content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
class Solution:
def updateMatrix(self, matrix):
"""
:type matrix: List[List[int]]
:rtype: List[List[int]]
"""
queue = collections.deque()
for i, row in enumerate(matrix):
for j, val in enumerate(row):
if val == 0:
queue.... | class Solution:
def update_matrix(self, matrix):
"""
:type matrix: List[List[int]]
:rtype: List[List[int]]
"""
queue = collections.deque()
for (i, row) in enumerate(matrix):
for (j, val) in enumerate(row):
if val == 0:
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
class Config(object):
config = None
def __init__(self, config):
self.config = config
def __str__(self):
return str(self.config)
def __getitem__(self, item):
return self.config[item]
def interactive(self):
return sel... | class Config(object):
config = None
def __init__(self, config):
self.config = config
def __str__(self):
return str(self.config)
def __getitem__(self, item):
return self.config[item]
def interactive(self):
return self.config['app']['interactive']
def dry(self)... |
palavra = ('Curso', 'Video', 'Python')
qualPalavra = 0
qualLetra = 0
while True:
if palavra[qualPalavra][qualLetra] in 'AaEeIiOoUu':
print(palavra[qualPalavra]) | palavra = ('Curso', 'Video', 'Python')
qual_palavra = 0
qual_letra = 0
while True:
if palavra[qualPalavra][qualLetra] in 'AaEeIiOoUu':
print(palavra[qualPalavra]) |
""" This file is create and managed by Tahir Iqbal
----------------------------------------------
It can be use only for education purpose
"""
# Printing Single and Double Quote
# single quote should print in double quotes
single = "Python's"
print(single)
# double quote should print in single quotes
doub... | """ This file is create and managed by Tahir Iqbal
----------------------------------------------
It can be use only for education purpose
"""
single = "Python's"
print(single)
double = 'Python"s'
print(double)
singles = "Python's"
print(singles)
doubles = 'Python"s'
print(doubles) |
"""California county names"""
bay_area_counties = [
"alameda",
"contra_costa",
"marin",
"napa",
"san_francisco",
"san_mateo",
"santa_clara",
"sonoma",
"solano"
]
other_ca_counties = [
"amador",
"butte",
"calaveras",
"colusa",
"del_norte",
"el_dorado",
"... | """California county names"""
bay_area_counties = ['alameda', 'contra_costa', 'marin', 'napa', 'san_francisco', 'san_mateo', 'santa_clara', 'sonoma', 'solano']
other_ca_counties = ['amador', 'butte', 'calaveras', 'colusa', 'del_norte', 'el_dorado', 'fresno', 'glenn', 'humboldt', 'imperial', 'inyo', 'kern', 'kings', 'la... |
def to_batch_seq(batch):
q_seq = []
history = []
label = []
for item in batch:
q_seq.append(item['question_tokens'])
history.append(item["history"])
label.append(item["label"])
return q_seq, history, label
# CHANGED
def to_batch_tables(batch, table_type):
# col_lens = [... | def to_batch_seq(batch):
q_seq = []
history = []
label = []
for item in batch:
q_seq.append(item['question_tokens'])
history.append(item['history'])
label.append(item['label'])
return (q_seq, history, label)
def to_batch_tables(batch, table_type):
col_seq = []
tname_... |
def horn(coefs, x0):
n = len(coefs)
b = coefs[0]
for index in range(1,n):
b = coefs[index] + b * x0
return b
j=horn([2,2,3,-21,8],8)
print(j) | def horn(coefs, x0):
n = len(coefs)
b = coefs[0]
for index in range(1, n):
b = coefs[index] + b * x0
return b
j = horn([2, 2, 3, -21, 8], 8)
print(j) |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
# SOURCE: https://www.codewars.com/kata/5ef9ca8b76be6d001d5e1c3e/train/python
def chunks(l, n):
"""Yield successive n-sized chunks from l."""
for i in range(0, len(l), n):
yield l[i: i + n]
# Task 1: Encode function
#
# Implem... | __author__ = 'ipetrash'
def chunks(l, n):
"""Yield successive n-sized chunks from l."""
for i in range(0, len(l), n):
yield l[i:i + n]
def encode(text: str) -> str:
return ''.join((''.join((b * 3 for b in f'{ord(c):08b}')) for c in text))
def decode(bits: str) -> str:
bit_items = []
for t... |
class TradingDayData:
def __init__(self, pricebars, tradingday):
self.__pricebars = pricebars
self.__tradingday = tradingday
@property
def price_bars(self):
return self.__pricebars
| class Tradingdaydata:
def __init__(self, pricebars, tradingday):
self.__pricebars = pricebars
self.__tradingday = tradingday
@property
def price_bars(self):
return self.__pricebars |
# MEDIUM
# since this is looking for permutation, the Time would be O(N!)
# 1. first check if the input can form a palindrome => only <=1 odd occured char can used
# 2. only permutate the half of the input == permutation II
# eg. input = "aabb"
# only permutate ["a","b"], append reversed(input) to the end
... | class Solution:
def generate_palindromes(self, s: str) -> List[str]:
check = [0] * 128
half = [0] * (len(s) // 2)
if not self.canPalin(s, check):
return []
k = 0
ch = 0
for i in range(128):
if check[i] % 2 == 1:
ch = chr(i)
... |
'''
Created on 15 May 2018
@author: igoroya
'''
def read_text(file_path):
my_file = open(file_path, 'r', encoding="utf-8")
text = my_file.read()
my_file.close()
return text
def print_text(text):
print(text)
def get_lines(text):
return text.split("\n")
def get_words(text):
words = []
... | """
Created on 15 May 2018
@author: igoroya
"""
def read_text(file_path):
my_file = open(file_path, 'r', encoding='utf-8')
text = my_file.read()
my_file.close()
return text
def print_text(text):
print(text)
def get_lines(text):
return text.split('\n')
def get_words(text):
words = []
... |
class Solution:
def isSubsequence(self, s: str, t: str) -> bool:
if not s:
return True
m, n = 0, len(s) - 1
i, j = 0, len(t) - 1
while i <= j and m <= n:
if t[i] == s[m]:
m += 1
i += 1
else:
i += 1
... | class Solution:
def is_subsequence(self, s: str, t: str) -> bool:
if not s:
return True
(m, n) = (0, len(s) - 1)
(i, j) = (0, len(t) - 1)
while i <= j and m <= n:
if t[i] == s[m]:
m += 1
i += 1
else:
... |
"""
Copyright 2015 Rackspace
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
dist... | """
Copyright 2015 Rackspace
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
dist... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
"""
def add_two(a, b):
return a + b
if __name__ == "__main__":
# print(add_two.__code__)
pass
| """
"""
def add_two(a, b):
return a + b
if __name__ == '__main__':
pass |
def even(n):
return n/2
def odd(n):
return (3*n)+1
if __name__ == '__main__':
appeared = []
z = 0
x = 0
for i in range(1,1000000):
y = 0
a = i
while a != 1:
if i not in appeared:
if a % 2 == 0:
a = even(a... | def even(n):
return n / 2
def odd(n):
return 3 * n + 1
if __name__ == '__main__':
appeared = []
z = 0
x = 0
for i in range(1, 1000000):
y = 0
a = i
while a != 1:
if i not in appeared:
if a % 2 == 0:
a = even(a)
... |
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
def arm_toolchains_repositories():
rules_pkg()
org_linaro_components_toolchain_gcc_5_3_1()
raspi_components_toolchain_gcc_4_8_3()
def org_linaro_components_toolchain_gcc_5_3_1():
http_archive(
name = 'org_linaro_components_to... | load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive')
def arm_toolchains_repositories():
rules_pkg()
org_linaro_components_toolchain_gcc_5_3_1()
raspi_components_toolchain_gcc_4_8_3()
def org_linaro_components_toolchain_gcc_5_3_1():
http_archive(name='org_linaro_components_toolchain_gcc... |
class Solution:
def solve(self, a, b):
def bin_sum(x,y,c):
x = int(x)
y = int(y)
c = int(c)
si = (x+y+c)%2
c = (x+y+c)//2
if c:
c = 1
return str(si),str(c)
n , m = len(a),len(b)
... | class Solution:
def solve(self, a, b):
def bin_sum(x, y, c):
x = int(x)
y = int(y)
c = int(c)
si = (x + y + c) % 2
c = (x + y + c) // 2
if c:
c = 1
return (str(si), str(c))
(n, m) = (len(a), len(b))... |
# Copyright 2009-2017 Ram Rachum.
# This program is distributed under the MIT license.
'''Defines exceptions.'''
class CuteBaseException(BaseException):
'''
Base exception that uses its first docstring line in lieu of a message.
'''
def __init__(self, message=None):
# We use `None` as the de... | """Defines exceptions."""
class Cutebaseexception(BaseException):
"""
Base exception that uses its first docstring line in lieu of a message.
"""
def __init__(self, message=None):
if message is None:
if self.__doc__ and type(self) not in (CuteBaseException, CuteException):
... |
"""
Top-level package for Python AvSong.
"""
__app_name__ = "pyavsong"
__version__ = "0.1"
| """
Top-level package for Python AvSong.
"""
__app_name__ = 'pyavsong'
__version__ = '0.1' |
class RoutingRulesList:
TITLE = "Maintain case routing rules"
CREATE_BUTTON = "Create new routing rule"
NO_CONTENT_NOTICE = "There are no registered routing rules at the moment."
ACTIVE = "Active"
DEACTIVATED = "Deactivated"
DEACTIVATE = "Deactivate"
REACTIVATE = "Reactivate"
EDIT = "Edi... | class Routingruleslist:
title = 'Maintain case routing rules'
create_button = 'Create new routing rule'
no_content_notice = 'There are no registered routing rules at the moment.'
active = 'Active'
deactivated = 'Deactivated'
deactivate = 'Deactivate'
reactivate = 'Reactivate'
edit = 'Edi... |
__all__ = ["_nsgroup", "association_api", "association_service_api", "codesystem_api",
"codesystem_service_api", "codesystemversion_api", "codesystemversion_service_api", "conceptdomain_api",
"conceptdomain_service_api", "conceptdomainbinding_api", "conceptdomainbinding_service_api",
"c... | __all__ = ['_nsgroup', 'association_api', 'association_service_api', 'codesystem_api', 'codesystem_service_api', 'codesystemversion_api', 'codesystemversion_service_api', 'conceptdomain_api', 'conceptdomain_service_api', 'conceptdomainbinding_api', 'conceptdomainbinding_service_api', 'core_api', 'core_service_api', 'en... |
"""
A `Command` is something that causes a change of state to
a persistant store.
"""
class Command(object):
"""
Inherit `Command` for specific commands that cause a chage
of state in a persisted database.
"""
def __init__(self, *args, **kwargs):
pass
def run(self):
"""
... | """
A `Command` is something that causes a change of state to
a persistant store.
"""
class Command(object):
"""
Inherit `Command` for specific commands that cause a chage
of state in a persisted database.
"""
def __init__(self, *args, **kwargs):
pass
def run(self):
"""
... |
# webex integration credentials
webex_integration_client_id = ""
webex_integration_client_secret= ""
webex_integration_redirect_uri = "http://localhost:5000/webexoauth"
webex_integration_scope = "spark:all meeting:schedules_write"
| webex_integration_client_id = ''
webex_integration_client_secret = ''
webex_integration_redirect_uri = 'http://localhost:5000/webexoauth'
webex_integration_scope = 'spark:all meeting:schedules_write' |
"""Top-level package for openapi-to-markdown."""
__author__ = """Shinji Matsumoto"""
__email__ = 'shinji.mtsmt@gmail.com'
__version__ = '0.1.0'
| """Top-level package for openapi-to-markdown."""
__author__ = 'Shinji Matsumoto'
__email__ = 'shinji.mtsmt@gmail.com'
__version__ = '0.1.0' |
# Advent of Code - Day 6 - Part Two
class LanterFishPopulation:
def __init__(self, initial_state):
self.population = initial_state
def tick(self, reset, gestation):
spawn_count = self.population[0]
# decrement all lantern fish timers
for k in self.population.keys():
... | class Lanterfishpopulation:
def __init__(self, initial_state):
self.population = initial_state
def tick(self, reset, gestation):
spawn_count = self.population[0]
for k in self.population.keys():
if k < gestation:
self.population[k] = self.population[k + 1]
... |
nombreACalculer = str(2**1000)
somme=0
for i in nombreACalculer:
somme += int(i)
print(somme)
input() | nombre_a_calculer = str(2 ** 1000)
somme = 0
for i in nombreACalculer:
somme += int(i)
print(somme)
input() |
# --------------
print(bool)
# --------------
print(bool)
| print(bool)
print(bool) |
pytest_plugins = ("pytester",)
def test_help_message(testdir):
result = testdir.runpytest("--help")
# fnmatch_lines does an assertion internally
result.stdout.fnmatch_lines(
[
"stress:",
"*--delay=DELAY*The amount of time to wait between each test loop.",
"*--ho... | pytest_plugins = ('pytester',)
def test_help_message(testdir):
result = testdir.runpytest('--help')
result.stdout.fnmatch_lines(['stress:', '*--delay=DELAY*The amount of time to wait between each test loop.', '*--hours=HOURS*The number of hours to loop the tests for.', '*--minutes=MINUTES*The number of minutes... |
class Solution:
def nextClosestTime(self, time):
t = sorted(set(time))[:-1]
nex = {a: b for a, b in zip(t, t[1:])}
for i, d in enumerate(time[::-1]):
if d in nex:
if i == 0:
return time[:4] + nex[d]
elif i == 1 and nex[d] < '6... | class Solution:
def next_closest_time(self, time):
t = sorted(set(time))[:-1]
nex = {a: b for (a, b) in zip(t, t[1:])}
for (i, d) in enumerate(time[::-1]):
if d in nex:
if i == 0:
return time[:4] + nex[d]
elif i == 1 and nex[d]... |
"""
******
######
******
######
"""
# 4 6
for r in range(4): # 0 1 2 3
for c in range(6):
if r % 2 == 0:
print("*", end="")
else:
print("#", end="")
print()
| """
******
######
******
######
"""
for r in range(4):
for c in range(6):
if r % 2 == 0:
print('*', end='')
else:
print('#', end='')
print() |
class Solution:
#Function to return a list containing the DFS traversal of the graph.
def dfs(self,i,vis,q,adj):
vis[i]=1
q.append(i)
for i in adj[i]:
if(vis[i]==0):
self.dfs(i,vis,q,adj)
def dfsOfGraph(self, V, adj):
vis=[0 for i in... | class Solution:
def dfs(self, i, vis, q, adj):
vis[i] = 1
q.append(i)
for i in adj[i]:
if vis[i] == 0:
self.dfs(i, vis, q, adj)
def dfs_of_graph(self, V, adj):
vis = [0 for i in range(V)]
q = []
self.dfs(0, vis, q, adj)
return... |
# -*- coding: utf-8 -*-
timeout = 8
keysize = 512
operator_root_path="/api/1.2"
operator_cr_path="/cr"
operator_slr_path="/slr"
account_management_url="http://myaccount.dy.fi/"
account_management_username="test_sdk"
account_management_password="test_sdk_pw"
operator_url="http://localhost:5000"
service_url ="http://... | timeout = 8
keysize = 512
operator_root_path = '/api/1.2'
operator_cr_path = '/cr'
operator_slr_path = '/slr'
account_management_url = 'http://myaccount.dy.fi/'
account_management_username = 'test_sdk'
account_management_password = 'test_sdk_pw'
operator_url = 'http://localhost:5000'
service_url = 'http://localhost:200... |
def in1to10(n, outside_mode):
if not outside_mode and n>=1 and n<=10:
return True
elif outside_mode:
if n<=1 or n>=10:
return True
else:
return False
else:
return False
| def in1to10(n, outside_mode):
if not outside_mode and n >= 1 and (n <= 10):
return True
elif outside_mode:
if n <= 1 or n >= 10:
return True
else:
return False
else:
return False |
''' Serialize objects into SQLITE database calls. '''
class Serializable:
''' Serializable class that implements methods for objects wishing to
serialize to SQLITE tables. This is done with a serialize table that maps
property names to SQLITE table columns. When insert_into is called it takes
the prop... | """ Serialize objects into SQLITE database calls. """
class Serializable:
""" Serializable class that implements methods for objects wishing to
serialize to SQLITE tables. This is done with a serialize table that maps
property names to SQLITE table columns. When insert_into is called it takes
the prope... |
# FMSPy - Copyright (c) 2009 Andrey Smirnov.
#
# See COPYRIGHT for details.
"""
RTMP (Real Time Messaging Protocol) implementation.
U{http://en.wikipedia.org/wiki/Real_Time_Messaging_Protocol}
"""
| """
RTMP (Real Time Messaging Protocol) implementation.
U{http://en.wikipedia.org/wiki/Real_Time_Messaging_Protocol}
""" |
#!/usr/bin/env python3
SLIDE_WINDOWS = 3
f = open("input.txt", "r")
window = []
for i in range(SLIDE_WINDOWS):
window.append(int(f.readline()))
count = 0
for cur in f:
#print(f'current: {cur}')
window.append(int(cur))
if sum(window[1:]) > sum(window[0:-1]):
count +=1
window.pop(0)
print(... | slide_windows = 3
f = open('input.txt', 'r')
window = []
for i in range(SLIDE_WINDOWS):
window.append(int(f.readline()))
count = 0
for cur in f:
window.append(int(cur))
if sum(window[1:]) > sum(window[0:-1]):
count += 1
window.pop(0)
print(f'increase: {count}') |
# Copyright (c) 2017 StackHPC Ltd.
#
# 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 writ... | def parse_mappings(mapping_list):
"""Parse a list of mapping strings into a dictionary.
Adapted from neutron_lib.utils.helpers.parse_mappings.
:param mapping_list: A list of strings of the form '<key>:<value>'.
:returns: A dict mapping keys to values or to list of values.
:raises ValueError: Upon ... |
def scale_01(feature,n_feature):
for i in range(n_feature):
feature_i=feature[:,i]
feature[:,i]=0+(feature_i-min(feature_i))/(max(feature_i)-min(feature_i))
return feature | def scale_01(feature, n_feature):
for i in range(n_feature):
feature_i = feature[:, i]
feature[:, i] = 0 + (feature_i - min(feature_i)) / (max(feature_i) - min(feature_i))
return feature |
# -*- coding: utf-8 -*-
"""Module defining Interval model and operations"""
# ActiveState recipe 576816
class Interval(object):
"""
Represents an interval.
Defined as closed interval [start,end), which includes the start and
end positions.
Start and end do not have to be numeric types.
"""
... | """Module defining Interval model and operations"""
class Interval(object):
"""
Represents an interval.
Defined as closed interval [start,end), which includes the start and
end positions.
Start and end do not have to be numeric types.
"""
__slots__ = ('_start', '_end')
def __init__(sel... |
class DriverBase(object):
def __init__(self, wheel_radius=0.06, wheel_track=0.33):
self.wheel_speeds = [0.0, 0.0, 0.0, 0.0]
self.wheel_radius = wheel_radius
self.wheel_track = wheel_track
def set_motors(self, linear, angular):
raise NotImplementedError()
class DriverStraight... | class Driverbase(object):
def __init__(self, wheel_radius=0.06, wheel_track=0.33):
self.wheel_speeds = [0.0, 0.0, 0.0, 0.0]
self.wheel_radius = wheel_radius
self.wheel_track = wheel_track
def set_motors(self, linear, angular):
raise not_implemented_error()
class Driverstraight... |
# -*- coding: utf-8 -*-
#
# Custom package settings
#
# Copyright (C)
# Honda Research Institute Europe GmbH
# Carl-Legien-Str. 30
# 63073 Offenbach/Main
# Germany
#
# UNPUBLISHED PROPRIETARY MATERIAL.
# ALL RIGHTS RESERVED.
#
#
name = 'ToolBOSCore'
package = 'ToolBOSCore'
version ... | name = 'ToolBOSCore'
package = 'ToolBOSCore'
version = '4.0'
section = 'DevelopmentTools'
category = 'DevelopmentTools'
patchlevel = 0
maintainer = ('mstein', 'Marijke Stein')
git_branch = 'TBCORE-2231-GitLabCI'
git_commit_id = '020950dfc0913a1a18b80335f25dd7b1335b0d48'
git_origin = 'https://github.com/HRI-EU/ToolBOSCo... |
INSTALLED_APPS = (
'automatica_prometheus',
)
TELEGRAM_BOT_NAME = 'name_bot'
| installed_apps = ('automatica_prometheus',)
telegram_bot_name = 'name_bot' |
#Exercise 5.2.1
def check_fermat(a,b,c,n):
a = int(a)
b = int(b)
c = int(c)
n = int(n)
if n>2 and a>0 and b>0 and c>0 and a**n + b**n == c**n:
print('Holy smokes, Fermat was wrong!')
else:
print("No, that doesn't work")
#Exercise 5.2.2
def prompting_fermat():
a = int(input('... | def check_fermat(a, b, c, n):
a = int(a)
b = int(b)
c = int(c)
n = int(n)
if n > 2 and a > 0 and (b > 0) and (c > 0) and (a ** n + b ** n == c ** n):
print('Holy smokes, Fermat was wrong!')
else:
print("No, that doesn't work")
def prompting_fermat():
a = int(input('Type a an... |
a,b,c=map(int,input().split())
x,d=0,0
while x<c:
d+=1
x+=a
if d%7==0: x+=b
print(d) | (a, b, c) = map(int, input().split())
(x, d) = (0, 0)
while x < c:
d += 1
x += a
if d % 7 == 0:
x += b
print(d) |
load("//csharp:csharp_grpc_compile.bzl", "csharp_grpc_compile")
load("//:compile.bzl", "invoke_transitive")
load("@io_bazel_rules_dotnet//dotnet:defs.bzl", "core_library")
def csharp_grpc_library(**kwargs):
kwargs["srcs"] = [invoke_transitive(csharp_grpc_compile, "_pb", kwargs)]
kwargs["deps"] = [
"... | load('//csharp:csharp_grpc_compile.bzl', 'csharp_grpc_compile')
load('//:compile.bzl', 'invoke_transitive')
load('@io_bazel_rules_dotnet//dotnet:defs.bzl', 'core_library')
def csharp_grpc_library(**kwargs):
kwargs['srcs'] = [invoke_transitive(csharp_grpc_compile, '_pb', kwargs)]
kwargs['deps'] = ['@google.prot... |
def is_number(s):
"""
Take a string and determin if it is a number
Arguments:
s (str): A string
Returns:
bool: True if it is a number, False otherwise
"""
try:
float(s)
return True
except ValueError:
return False
def check_info_annotation(a... | def is_number(s):
"""
Take a string and determin if it is a number
Arguments:
s (str): A string
Returns:
bool: True if it is a number, False otherwise
"""
try:
float(s)
return True
except ValueError:
return False
def check_info_annotation(an... |
class TrieNode:
def __init__(self):
self.children = [None] * 26
self.isEndOfWord = False
class Trie:
def __init__(self):
self.root_node = self.TrieNode()
def getNewNode(self):
return TrieNode()
def char_to_index(self, char):
return ord(char) - ord('a')
... | class Trienode:
def __init__(self):
self.children = [None] * 26
self.isEndOfWord = False
class Trie:
def __init__(self):
self.root_node = self.TrieNode()
def get_new_node(self):
return trie_node()
def char_to_index(self, char):
return ord(char) - ord('a')
... |
def reverseWords(string: str) -> str:
words = " ".join(string.split())
words = [word for word in words.split(' ')]
left, right = 0, len(words) - 1
while left < right:
temp = words[left]
words[left] = words[right]
words[right] = temp
left += 1
right -= 1
... | def reverse_words(string: str) -> str:
words = ' '.join(string.split())
words = [word for word in words.split(' ')]
(left, right) = (0, len(words) - 1)
while left < right:
temp = words[left]
words[left] = words[right]
words[right] = temp
left += 1
right -= 1
r... |
# -*- coding: utf-8 -*-
"""Dork Game main module.
"""
__version__ = '0.1.0'
__author__ = ", ".join([
"Luke Smith",
])
| """Dork Game main module.
"""
__version__ = '0.1.0'
__author__ = ', '.join(['Luke Smith']) |
bind = "0.0.0.0:5000"
workers = 1
worker_class = "eventlet"
reload = True
| bind = '0.0.0.0:5000'
workers = 1
worker_class = 'eventlet'
reload = True |
class Timespan:
def __init__(
self,
days: int = 0,
hours: int = 0,
minutes: int = 0,
seconds: int = 0,
milliseconds: int = 0):
conv_days = days * 3600 * 24 * 1000
conv_hours = hours * 3600000
conv_minutes = minutes * 60... | class Timespan:
def __init__(self, days: int=0, hours: int=0, minutes: int=0, seconds: int=0, milliseconds: int=0):
conv_days = days * 3600 * 24 * 1000
conv_hours = hours * 3600000
conv_minutes = minutes * 60000
conv_seconds = seconds * 1000
self._time = conv_days + conv_hou... |
def merge(alist):
if len(alist) > 1:
mid = len(alist)//2
left = alist[:mid]
right = alist[mid:]
merge(left)
merge(right)
i,j,k = 0, 0, 0
while i<len(left) and j<len(right):
if left[i]<right[j]:
alist[k] = left[i]
i... | def merge(alist):
if len(alist) > 1:
mid = len(alist) // 2
left = alist[:mid]
right = alist[mid:]
merge(left)
merge(right)
(i, j, k) = (0, 0, 0)
while i < len(left) and j < len(right):
if left[i] < right[j]:
alist[k] = left[i]
... |
class MACAddress:
@staticmethod
def isValid(macAddress):
sanitizedMACAddress = macAddress.strip().upper()
if sanitizedMACAddress == "":
return False
# Ensure that we have 6 sections
items = sanitizedMACAddress.split(":")
if len(items) != 6:
return... | class Macaddress:
@staticmethod
def is_valid(macAddress):
sanitized_mac_address = macAddress.strip().upper()
if sanitizedMACAddress == '':
return False
items = sanitizedMACAddress.split(':')
if len(items) != 6:
return False
for section in items:
... |
# GYP file to build experimental directory.
{
'targets': [
{
'target_name': 'experimental',
'type': 'static_library',
'include_dirs': [
'../include/config',
'../include/core',
],
'sources': [
'../experimental/SkSetPoly3To3.cpp',
'../experimental/SkSetP... | {'targets': [{'target_name': 'experimental', 'type': 'static_library', 'include_dirs': ['../include/config', '../include/core'], 'sources': ['../experimental/SkSetPoly3To3.cpp', '../experimental/SkSetPoly3To3_A.cpp', '../experimental/SkSetPoly3To3_D.cpp'], 'direct_dependent_settings': {'include_dirs': ['../experimental... |
def gem_id_compat(ob):
"""Compatibility for old files from v1.5, should be removed at some point"""
if ob.type == 'MESH' and 'gem' in ob.data:
if 'gem' not in ob:
ob['gem'] = {}
for k in ('TYPE', 'type'):
if k in ob.data['gem']:
ob['gem']['stone'] = ob.data['gem'][k]
for k in ('CUT', 'cut'):
... | def gem_id_compat(ob):
"""Compatibility for old files from v1.5, should be removed at some point"""
if ob.type == 'MESH' and 'gem' in ob.data:
if 'gem' not in ob:
ob['gem'] = {}
for k in ('TYPE', 'type'):
if k in ob.data['gem']:
ob['gem']['ston... |
# N stands for North
# S stands for south
# E stands for east
# W stands for west
#Oeste es West y Este es East
#NoSe == NWSE North and South are opposites, so are West and East
# N
# |
# W---+--E
# |
# S
# L stands for Left
# R stands for right
# F sta... | with open('E:\\code\\AoC\\day12\\input.txt', 'r') as input:
instructions = input.read().split('\n')
def degrees_to_position(action, degrees):
if degrees == 90:
if action == 'L':
return 1
else:
return -1
elif degrees == 180:
return 2
elif action == 'L':
... |
def divisors_count(n):
count = 0
for i in range(1, n+1):
if (n % i) == 0:
count += 1
return count
def triangulate(n):
y = [int(x) for x in list(str(n))]
return sum(y)
triangle = 1
while divisors_count(triangle) <= 500:
triangle += triangulate(triangle)
print(triangle)
| def divisors_count(n):
count = 0
for i in range(1, n + 1):
if n % i == 0:
count += 1
return count
def triangulate(n):
y = [int(x) for x in list(str(n))]
return sum(y)
triangle = 1
while divisors_count(triangle) <= 500:
triangle += triangulate(triangle)
print(triangle) |
class Solution:
def countElements(self, nums: List[int]) -> int:
nums.sort()
k=0
for i in nums:
if i+1 in nums:
k=k+1
return k
| class Solution:
def count_elements(self, nums: List[int]) -> int:
nums.sort()
k = 0
for i in nums:
if i + 1 in nums:
k = k + 1
return k |
# -*- coding: utf-8 -*-
N = int(input())
answer = " ".join(["Ho"] * N) + "!"
print(answer) | n = int(input())
answer = ' '.join(['Ho'] * N) + '!'
print(answer) |
for _ in range(int(input())):
n,k=map(int,input().split())
a=bin(k)[2:]
a=str(a)
a=a.zfill(n)
a=a[::-1]
print(int(a,2))
| for _ in range(int(input())):
(n, k) = map(int, input().split())
a = bin(k)[2:]
a = str(a)
a = a.zfill(n)
a = a[::-1]
print(int(a, 2)) |
'''
Goals:
-Have more options
-Make code much more clean
'''
class Temperature:
def __init__(self, degrees, kind):
self.degrees = degrees
self.kind = kind
def input(self):
Player_input = float(input("How many degrees?"))
self.degrees = Player_input
def Repeat():
while True:
try:
... | """
Goals:
-Have more options
-Make code much more clean
"""
class Temperature:
def __init__(self, degrees, kind):
self.degrees = degrees
self.kind = kind
def input(self):
player_input = float(input('How many degrees?'))
self.degrees = Player_input
def repeat():
w... |
# -*- coding: utf-8 -*-
'''
This module contains basic form access control classes.
You can set permissions to form and fields like this::
class SampleForm(form.Form):
permissions = 'rwcx'
fields=[fields.Field('input',
permissions='rw')]
or define your own permission log... | """
This module contains basic form access control classes.
You can set permissions to form and fields like this::
class SampleForm(form.Form):
permissions = 'rwcx'
fields=[fields.Field('input',
permissions='rw')]
or define your own permission logic::
class SampleFo... |
#!/usr/bin/env python
class Link(object):
"""docstring for Link"""
def __init__(self, url):
super(Link, self).__init__()
self.url = url
self.in_link = 1
self.out_link = 0
self.visited = False
self.round = 1
self.outs = set()
self.ins = set()
... | class Link(object):
"""docstring for Link"""
def __init__(self, url):
super(Link, self).__init__()
self.url = url
self.in_link = 1
self.out_link = 0
self.visited = False
self.round = 1
self.outs = set()
self.ins = set()
self.header = ''
c... |
# WAP in python to check the given year is leap or not.
year=int(input("Enter Year: "))
if year % 4 == 0:
if year % 100 == 0:
if year % 400 == 0:
print("{0} is a leap year".format(year))
else:
print("{0} is not a leap year".format(year))
else:
print("{0} is a le... | year = int(input('Enter Year: '))
if year % 4 == 0:
if year % 100 == 0:
if year % 400 == 0:
print('{0} is a leap year'.format(year))
else:
print('{0} is not a leap year'.format(year))
else:
print('{0} is a leap year'.format(year))
else:
print('{0} is not a lea... |
def power(n, m):
if m == 0:
return 1
elif m == 1:
return n
return (n*power(n, m-1))
print(power(2,3)) | def power(n, m):
if m == 0:
return 1
elif m == 1:
return n
return n * power(n, m - 1)
print(power(2, 3)) |
def convert_to_strsid(binsid):
if len(binsid) < 24:
return None
dashes = int(binsid[2:4])
list_sid = ["S", "1"]
range_parts = range(16, dashes*8+16, 8)
list_sid.append(str(int(binsid[4:16], 16)))
for i in range_parts:
list_sid.append(str(int(invert_endian(binsid[i:i+8]), 16)))
... | def convert_to_strsid(binsid):
if len(binsid) < 24:
return None
dashes = int(binsid[2:4])
list_sid = ['S', '1']
range_parts = range(16, dashes * 8 + 16, 8)
list_sid.append(str(int(binsid[4:16], 16)))
for i in range_parts:
list_sid.append(str(int(invert_endian(binsid[i:i + 8]), 16... |
# global settings
data_root = "../../data/winequality_dataset/"
feature_save_dir = data_root + "features/"
img_save_dir = data_root + "imgs/"
# split chunk settings
split_chunk_path = data_root + 'chunk/'
raw_train_file = dict(
file_path=data_root + 'raw_data/train.csv',
size=3397,
split_mode=['train', 'va... | data_root = '../../data/winequality_dataset/'
feature_save_dir = data_root + 'features/'
img_save_dir = data_root + 'imgs/'
split_chunk_path = data_root + 'chunk/'
raw_train_file = dict(file_path=data_root + 'raw_data/train.csv', size=3397, split_mode=['train', 'valA', 'valB'], split_ratio=[0.6, 0.2, 0.2], chunk_size=2... |
Import("env")
src_filter = ["+<TRB_MCP23017.h>"]
env.Replace(SRC_FILTER=src_filter)
build_flags = env.ParseFlags(env['BUILD_FLAGS'])
cppdefines = build_flags.get("CPPDEFINES")
if "TRB_MCP23017_ESP_IDF" in cppdefines:
env.Append(SRC_FILTER=["+<TRB_MCP23017.c>", "+<sys/esp_idf>"])
if "TRB_MCP23017_ARDUINO_WIRE" in ... | import('env')
src_filter = ['+<TRB_MCP23017.h>']
env.Replace(SRC_FILTER=src_filter)
build_flags = env.ParseFlags(env['BUILD_FLAGS'])
cppdefines = build_flags.get('CPPDEFINES')
if 'TRB_MCP23017_ESP_IDF' in cppdefines:
env.Append(SRC_FILTER=['+<TRB_MCP23017.c>', '+<sys/esp_idf>'])
if 'TRB_MCP23017_ARDUINO_WIRE' in cp... |
SEQUENCE_FILE = "data\\test_action_20_maxSeq15_20K.txt"
CRASH_INDEX = "1"
# SEQUENCE_FILE = "data\\activityseq_balanced_2018-02-05_2018-02-09_Excel_apphangb1_Production.tsv"
# SEQUENCE_FILE = r"C:\Users\mahajiag\Documents\tmp\crash\eventseq_balanced_2018-02-05_2018-02-09_Excel_apphangb1_Production.tsv"
ROOT_DIR = 'tf... | sequence_file = 'data\\test_action_20_maxSeq15_20K.txt'
crash_index = '1'
root_dir = 'tfboard'
actions_to_be_filtered = ['']
configs = {'batchSize': 512, 'maxSeqSize': 17, 'testSplit': 0.5, 'embeddingSize': None, 'epochs': 250, 'dedup': 1, 'conv1D': 0, 'lstmSize': None, 'testFlag': True, 'p2nRatio': 1, 'networkType': '... |
major_colors = ["White", "Red", "Black", "Yellow", "Violet"]
minor_colors = ["Blue", "Orange", "Green", "Brown", "Slate"]
def color_mapping():
cp_rows = []
for i, major_color in enumerate(major_colors):
for j, minor_color in enumerate(minor_colors):
print_color_map((i * 5 + j)+1 ... | major_colors = ['White', 'Red', 'Black', 'Yellow', 'Violet']
minor_colors = ['Blue', 'Orange', 'Green', 'Brown', 'Slate']
def color_mapping():
cp_rows = []
for (i, major_color) in enumerate(major_colors):
for (j, minor_color) in enumerate(minor_colors):
print_color_map(i * 5 + j + 1, major_... |
'''
Nd Genie Ops Object Outputs for IOSXR.
'''
class NdOutput(object):
ShowIpv6Neighbors = {
'interfaces': {
'GigabitEthernet0/0/0/0.90': {
'interface': 'Gi0/0/0/0.90',
'neighbors': {
'fe80::f816:3eff:fe26:1224': {
... | """
Nd Genie Ops Object Outputs for IOSXR.
"""
class Ndoutput(object):
show_ipv6_neighbors = {'interfaces': {'GigabitEthernet0/0/0/0.90': {'interface': 'Gi0/0/0/0.90', 'neighbors': {'fe80::f816:3eff:fe26:1224': {'age': '131', 'ip': 'fe80::f816:3eff:fe26:1224', 'link_layer_address': 'fa16.3e26.1224', 'neighbor_sta... |
"""Transaction unit."""
class TransactionUnit:
"""Transaction unit."""
def __init__(
self: "TransactionUnit", txid: str, fee: str, weight: str, parents: str
) -> None:
"""Initialize transaction unit.
Args:
txid (str): Txn ID
fee (str): fee of txn
... | """Transaction unit."""
class Transactionunit:
"""Transaction unit."""
def __init__(self: 'TransactionUnit', txid: str, fee: str, weight: str, parents: str) -> None:
"""Initialize transaction unit.
Args:
txid (str): Txn ID
fee (str): fee of txn
weight (str)... |
def solution():
sum = 0
for i in range(0,1000):
if i % 3 == 0 or i % 5 == 0: sum += i
return sum
def test_MultiplesOf3And5():
assert solution() == 233168 | def solution():
sum = 0
for i in range(0, 1000):
if i % 3 == 0 or i % 5 == 0:
sum += i
return sum
def test__multiples_of3_and5():
assert solution() == 233168 |
__all__ = ["__version__", "__version_info__"]
__version__ = "0.0.3"
__version_info__ = tuple(int(x) for x in __version__.split("."))
| __all__ = ['__version__', '__version_info__']
__version__ = '0.0.3'
__version_info__ = tuple((int(x) for x in __version__.split('.'))) |
@bot.message_handler(commands=['start', 'help'])
def send_welcome(message):
userid = message.from_user.id
banlist = redisserver.sismember('zigzag_banlist', '{}'.format(userid))
if banlist:
bot.reply_to(message, "You are banned!")
return
markup = types.ReplyKeyboardMarkup()
numbers = list(range(3, 300... | @bot.message_handler(commands=['start', 'help'])
def send_welcome(message):
userid = message.from_user.id
banlist = redisserver.sismember('zigzag_banlist', '{}'.format(userid))
if banlist:
bot.reply_to(message, 'You are banned!')
return
markup = types.ReplyKeyboardMarkup()
numbers = ... |
src = Split('''
uart_test.c
''')
component = aos_component('uart_test', src)
component.add_cflags('-Wall')
component.add_cflags('-Werror')
| src = split('\n uart_test.c\n')
component = aos_component('uart_test', src)
component.add_cflags('-Wall')
component.add_cflags('-Werror') |
#Helpfer Function:
def create_scoring_schema(number_objects):
_field = "id*:int64,image:blob,_image_:blob,_nObjects_:double,"
for obj in range(0,number_objects):
_field += "_Object" + str(obj) + "_:string,"
_field += "_P_Object" + str(obj) + "_:double,"
_field += "_Object" + str(obj) + "... | def create_scoring_schema(number_objects):
_field = 'id*:int64,image:blob,_image_:blob,_nObjects_:double,'
for obj in range(0, number_objects):
_field += '_Object' + str(obj) + '_:string,'
_field += '_P_Object' + str(obj) + '_:double,'
_field += '_Object' + str(obj) + '_x:double,'
... |
def load():
with open("input") as f:
return [int(x) for x in f.read().strip().split(",")]
def align_crabs():
crabs = load()
min_fuel = None
for pos in range(min(crabs), max(crabs) + 1):
fuel = sum(abs(c - pos) for c in crabs)
min_fuel = fuel if min_fuel is None else min(min_fu... | def load():
with open('input') as f:
return [int(x) for x in f.read().strip().split(',')]
def align_crabs():
crabs = load()
min_fuel = None
for pos in range(min(crabs), max(crabs) + 1):
fuel = sum((abs(c - pos) for c in crabs))
min_fuel = fuel if min_fuel is None else min(min_fu... |
a = [
1, 2, 3, 6, 10, 14,
]
t = 10
l = 0
r = len(a) - 1
while l != r:
c = (l + r) // 2
if a[c] < t:
l = c + 1
elif a[c] > t:
r = c - 1
else:
r = l = c
print(l, r, a[l], a[r])
| a = [1, 2, 3, 6, 10, 14]
t = 10
l = 0
r = len(a) - 1
while l != r:
c = (l + r) // 2
if a[c] < t:
l = c + 1
elif a[c] > t:
r = c - 1
else:
r = l = c
print(l, r, a[l], a[r]) |
# Runtime: 1007 ms, faster than 66.76% of Python3 online submissions for 3Sum.
# Memory Usage: 18.1 MB, less than 38.93% of Python3 online submissions for 3Sum.
class Solution:
def threeSum(self, nums: List[int]) -> List[List[int]]:
nums = sorted(nums)
res = []
for i in range(len(nums)):
... | class Solution:
def three_sum(self, nums: List[int]) -> List[List[int]]:
nums = sorted(nums)
res = []
for i in range(len(nums)):
if nums[i] > 0:
return res
elif i == 0 or nums[i] != nums[i - 1]:
hi = len(nums) - 1
lo = ... |
## Script eleminates rows that are having zero RPKM value then, divides replicate A of each damage type to corresponding XR-seq damage repair.
# If DMG_PPD_column and DMG_CPD_column column number changed to the replicate B of (6-4)PP and CPD damage, the Replicate B normalization could be performed.
### REMOVE RO... | stock_file_path = 'D://allseq-Data//MelanomaPrediction//Stock_Only_RPKM//Subsampled//5kBTSS//'
stock_file = open(stock_file_path + 'STOCK_allseq_subsampled_5kBTSS_RPKM_woHeader.bed', 'r')
without_zero_rows_list = []
for indiv_lines in stock_file:
splitted_lines = indiv_lines.split('\t')
dmg_ppd_column = float(s... |
# SPDX-FileCopyrightText: 2021 Mark Komus
# SPDX-License-Identifier: MIT
"""
LED glasses mappings
"""
# Maps to link IS31FL3741 LEDs to pixels
# Full LED glasses 18 x 5 matrix
glassesmatrix_ledmap = (
65535,
65535,
65535, # (0,0) (clipped, corner)
10,
8,
9, # (0,1) / right ring pixel 20
... | """
LED glasses mappings
"""
glassesmatrix_ledmap = (65535, 65535, 65535, 10, 8, 9, 13, 11, 12, 16, 14, 15, 4, 2, 3, 217, 215, 216, 220, 218, 219, 223, 221, 222, 226, 224, 225, 214, 212, 213, 187, 185, 186, 190, 188, 189, 193, 191, 192, 196, 194, 195, 184, 182, 183, 37, 35, 36, 40, 38, 39, 43, 41, 42, 46, 44, 45, 34, 3... |
# Adjusts numerical digits by a specified amount
class Offsetter:
# numericOffset is only altered by init
numericOffset=0
def __init__(self, offset):
self.numericOffset = int(offset)
# apply offset
def setOff(self, input_int):
return (( int(input_int) + self.numericOffset ) % 10)
# remov... | class Offsetter:
numeric_offset = 0
def __init__(self, offset):
self.numericOffset = int(offset)
def set_off(self, input_int):
return (int(input_int) + self.numericOffset) % 10
def set_on(self, input_int):
return (input_int + (10 - self.numericOffset)) % 10
def string_off... |
#!/usr/bin/env python3
"""
Node Class
This are the single blocks in the grid, which can be blocked or passable.
"""
class Node(object):
def __init__(self, x, y, blocked=False):
self.x = x
self.y = y
self.blocked = blocked
# calculate the distance to another node with the normal and ... | """
Node Class
This are the single blocks in the grid, which can be blocked or passable.
"""
class Node(object):
def __init__(self, x, y, blocked=False):
self.x = x
self.y = y
self.blocked = blocked
def calc_distance_to(self, other, normal_cost, diagonal_cost):
diff_x = abs(s... |
## Sum of Intervals
## 4 kyu
## https://www.codewars.com/kata/52b7ed099cdc285c300001cd
def sum_of_intervals(intervals):
seen = set()
for (low,high) in intervals:
for length in range(low, high):
seen.add(length)
return len(seen)
| def sum_of_intervals(intervals):
seen = set()
for (low, high) in intervals:
for length in range(low, high):
seen.add(length)
return len(seen) |
# https://leetcode.com/problems/guess-number-higher-or-lower/
# We are playing the Guess Game. The game is as follows:
#
# I pick a number from 1 to n. You have to guess which number I picked.
#
# Every time you guess wrong, I'll tell you whether the number is higher or lower.
#
# You call a pre-defined API guess(int n... | def guess(num, x):
pass
class Solution(object):
def guess_number(self, n):
(begin, end) = (1, n)
while True:
cur_num = (begin + end) // 2
cur_bool = guess(curNum)
if curBool == 1:
end = curNum - 1
elif curBool == -1:
... |
def isPalindrome(number):
ispalindrome = True
list = intToList(number)
#if list is not an even number it can't be a palindrome
if len(list) % 2 != 0:
ispalindrome = False
for x in range(0,int(len(list)/2)):
if(ispalindrome):
ispalindrome = (list[x] == list[len(list)-(x+... | def is_palindrome(number):
ispalindrome = True
list = int_to_list(number)
if len(list) % 2 != 0:
ispalindrome = False
for x in range(0, int(len(list) / 2)):
if ispalindrome:
ispalindrome = list[x] == list[len(list) - (x + 1)]
return ispalindrome
def int_to_list(number):
... |
sites = [
'https://yii2-menu.pceuropa.net/',
'https://pceuropa.net',
]
smtp = {
'server': 'smtp@example.com:587',
'login': 'info@example.com',
'password': 'pass',
'From': 'info@example.com',
'to': 'info@example.com',
}
| sites = ['https://yii2-menu.pceuropa.net/', 'https://pceuropa.net']
smtp = {'server': 'smtp@example.com:587', 'login': 'info@example.com', 'password': 'pass', 'From': 'info@example.com', 'to': 'info@example.com'} |
broker_url = 'amqp://guest:guest@localhost:5672//'
accept_content = ['application/json']
result_serializer = 'pickle'
task_serializer = 'pickle'
| broker_url = 'amqp://guest:guest@localhost:5672//'
accept_content = ['application/json']
result_serializer = 'pickle'
task_serializer = 'pickle' |
word = "bottles"
for beer_num in range(99, 0, -1):
print(beer_num, word, " of beer on the wall,")
print(beer_num, word, " bottles of beer.")
print("You take one down,")
print("You pass it around,")
if (beer_num == 1):
print("No more bottles of beer on the wall.")
else:
new_num =... | word = 'bottles'
for beer_num in range(99, 0, -1):
print(beer_num, word, ' of beer on the wall,')
print(beer_num, word, ' bottles of beer.')
print('You take one down,')
print('You pass it around,')
if beer_num == 1:
print('No more bottles of beer on the wall.')
else:
new_num = be... |
"""This problem was asked by Oracle.
Given a binary search tree, find the floor and ceiling of a given integer.
The floor is the highest element in the tree less than or equal to an integer,
while the ceiling is the lowest element in the tree greater than or equal to an integer.
If either value does not exist, retu... | """This problem was asked by Oracle.
Given a binary search tree, find the floor and ceiling of a given integer.
The floor is the highest element in the tree less than or equal to an integer,
while the ceiling is the lowest element in the tree greater than or equal to an integer.
If either value does not exist, retu... |
## Mel-filterbank
mel_n_channels = 80
win_length = 512
hop_length = 128
n_fft = 512
mel_window_length = 25 # In milliseconds
mel_window_step = 10 # In milliseconds
## Audio
sampling_rate = 24000
# Number of spectrogram frames in a partial utterance
partials_n_frames = 240 # 2400 ms
# Number of spectrogram fra... | mel_n_channels = 80
win_length = 512
hop_length = 128
n_fft = 512
mel_window_length = 25
mel_window_step = 10
sampling_rate = 24000
partials_n_frames = 240
inference_n_frames = 120
vad_window_length = 20
vad_moving_average_width = 8
vad_max_silence_length = 6
audio_norm_target_d_bfs = -30 |
class CollapseRenderMixin:
render_template = "djangocms_frontend/bootstrap5/collapse.html"
class CollapseContainerRenderMixin:
render_template = "djangocms_frontend/bootstrap5/collapse-container.html"
def render(self, context, instance, placeholder):
instance.add_classes("collapse")
retur... | class Collapserendermixin:
render_template = 'djangocms_frontend/bootstrap5/collapse.html'
class Collapsecontainerrendermixin:
render_template = 'djangocms_frontend/bootstrap5/collapse-container.html'
def render(self, context, instance, placeholder):
instance.add_classes('collapse')
return... |
#
# PySNMP MIB module AtiL2-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/AtiL2-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:33:22 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... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, value_range_constraint, constraints_intersection, constraints_union, single_value_constraint) ... |
TEST_CHANGES = {
('+1', '+1', '+1'): 3,
('+1', '+1', '-2'): 0,
('-1', '-2', '-3'): -6,
}
TEST_CHANGES_2 = {
('+1', '-1'): 0,
('+3', '+3', '+4', '-2', '-4'): 10,
('-6', '+3', '+8', '+5', '-6'): 5,
('+7', '+7', '-2', '-7', '-4'): 14,
}
def calibrate(deltas):
frequency = 0
for delta i... | test_changes = {('+1', '+1', '+1'): 3, ('+1', '+1', '-2'): 0, ('-1', '-2', '-3'): -6}
test_changes_2 = {('+1', '-1'): 0, ('+3', '+3', '+4', '-2', '-4'): 10, ('-6', '+3', '+8', '+5', '-6'): 5, ('+7', '+7', '-2', '-7', '-4'): 14}
def calibrate(deltas):
frequency = 0
for delta in deltas:
frequency += int(... |
if __name__ == '__main__':
"""
https://archive.ics.uci.edu/ml/datasets/Ecoli
"""
replacement = ""
with open('ecoli.data') as file:
line = file.readline()
i = 1
while line:
i += 1
elements = [el.strip() for el in line.split(' ')][1:]
elem... | if __name__ == '__main__':
'\n https://archive.ics.uci.edu/ml/datasets/Ecoli\n '
replacement = ''
with open('ecoli.data') as file:
line = file.readline()
i = 1
while line:
i += 1
elements = [el.strip() for el in line.split(' ')][1:]
elements... |
class Solution:
def reinitializePermutation(self, n: int) -> int:
perm = []
for i in range(n):
perm.append(i)
def op(perm):
arr = [0] * len(perm)
for i in range(len(perm)):
if i % 2 == 0:
arr[i] = perm[int(i / 2)]
... | class Solution:
def reinitialize_permutation(self, n: int) -> int:
perm = []
for i in range(n):
perm.append(i)
def op(perm):
arr = [0] * len(perm)
for i in range(len(perm)):
if i % 2 == 0:
arr[i] = perm[int(i / 2)]
... |
E_HOOK_ALREADY_EXISTS = u'Hook already exists on this repository'
def matches_github_exception(e, description, code=422):
"""Returns True if a GithubException was raised for a single error
matching the provided dict.
The error code needs to be equal to `code`, unless code is
None. For each field in `... | e_hook_already_exists = u'Hook already exists on this repository'
def matches_github_exception(e, description, code=422):
"""Returns True if a GithubException was raised for a single error
matching the provided dict.
The error code needs to be equal to `code`, unless code is
None. For each field in `d... |
N = int(input())
C = [list(map(int, input().split())) for _ in range(N)]
INF = 10 ** 18
a = INF
i, j = 0, 0
for y in range(N):
for x in range(N):
if C[y][x] >= a:
continue
i, j = y, x
a = C[y][x]
def f(z):
A = [INF] * N
B = [INF] * N
A[i] = z
for x in range(N)... | n = int(input())
c = [list(map(int, input().split())) for _ in range(N)]
inf = 10 ** 18
a = INF
(i, j) = (0, 0)
for y in range(N):
for x in range(N):
if C[y][x] >= a:
continue
(i, j) = (y, x)
a = C[y][x]
def f(z):
a = [INF] * N
b = [INF] * N
A[i] = z
for x in ran... |
{
"targets": [
{
"target_name": "lzh",
"sources": [ "src/binding.cc", "src/lzh.c" ],
"include_dirs": [
"<!(node -e \"require('nan')\")",
"<!(node -e \"require('cpp-debug')\")"
]
}
]
}
| {'targets': [{'target_name': 'lzh', 'sources': ['src/binding.cc', 'src/lzh.c'], 'include_dirs': ['<!(node -e "require(\'nan\')")', '<!(node -e "require(\'cpp-debug\')")']}]} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.