content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
latest_global_ids = """
PREFIX dataid: <http://dataid.dbpedia.org/ns/core#>
PREFIX dct: <http://purl.org/dc/terms/>
PREFIX dcat: <http://www.w3.org/ns/dcat#>
# Get all files
SELECT DISTINCT ?file ?latest WHERE {
?dataset dataid:artifact <https://databus.dbpedia.org/dbpedia/id-manageme... | latest_global_ids = "\n PREFIX dataid: <http://dataid.dbpedia.org/ns/core#>\n PREFIX dct: <http://purl.org/dc/terms/>\n PREFIX dcat: <http://www.w3.org/ns/dcat#>\n \n # Get all files\n SELECT DISTINCT ?file ?latest WHERE {\n ?dataset dataid:artifact <https://databus.dbpedia.org/dbpedia/id-mana... |
A, B = map(int, input().split())
for i in range(A, B+1):
if '3' in str(i) or i % 3 == 0:
print(i)
| (a, b) = map(int, input().split())
for i in range(A, B + 1):
if '3' in str(i) or i % 3 == 0:
print(i) |
N = int(input())
if N==1:
print(2)
else:
remain = 1
for i in range(N):
print(remain+1)
remain = remain*(remain+1)
| n = int(input())
if N == 1:
print(2)
else:
remain = 1
for i in range(N):
print(remain + 1)
remain = remain * (remain + 1) |
#
# 0014.py
#
def avg(lst):
return sum(lst) / len(lst)
def SS(a, b):
aavg = avg(a)
bavg = avg(b)
ss = 0;
N = min(len(a), len(b))
for i in range(0, N):
ss += (a[i] - aavg) * (b[i] - bavg)
return ss
x = [1, 2, 3, 4, 5]
y = [2, 5, 8, 11, 14]
print("Data")
print("x = ", x)
print("y = ", y)
print()
b = SS(x, ... | def avg(lst):
return sum(lst) / len(lst)
def ss(a, b):
aavg = avg(a)
bavg = avg(b)
ss = 0
n = min(len(a), len(b))
for i in range(0, N):
ss += (a[i] - aavg) * (b[i] - bavg)
return ss
x = [1, 2, 3, 4, 5]
y = [2, 5, 8, 11, 14]
print('Data')
print('x = ', x)
print('y = ', y)
print()
b =... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
File: Item.py
Author: Scott Yang(Scott)
Email: yangyingfa@skybility.com
Copyright: Copyright (c) 2021, Skybility Software Co.,Ltd. All rights reserved.
Description:
"""
class Item(object):
_name = None
@property
def name(self):
return self._name
... | """
File: Item.py
Author: Scott Yang(Scott)
Email: yangyingfa@skybility.com
Copyright: Copyright (c) 2021, Skybility Software Co.,Ltd. All rights reserved.
Description:
"""
class Item(object):
_name = None
@property
def name(self):
return self._name
class Coffee(Item):
_name = 'Coffee'
class... |
N = int(input())
A = list(map(int, input().split()))
ans = 0
for v in A:
ans += 1/v
print(1/ans) | n = int(input())
a = list(map(int, input().split()))
ans = 0
for v in A:
ans += 1 / v
print(1 / ans) |
#!/usr/bin/env python3
n = int(input())
m = 3
r = [0]*(n+1) #sol[0] is reserved
c = [0]*(n+1)
s = [0]*(n+n+1)
d = [0]*(n+n) #d'=d+n
cnt = 0
def stack_dfs():
global n,m,cnt,r,c,s,d #r=stack
i = 1
while i>0:
j = r[i]+1
while j<=n and (c[j]>0 or s[i+j]>0 or d[i-j+n]>0):
j += 1
... | n = int(input())
m = 3
r = [0] * (n + 1)
c = [0] * (n + 1)
s = [0] * (n + n + 1)
d = [0] * (n + n)
cnt = 0
def stack_dfs():
global n, m, cnt, r, c, s, d
i = 1
while i > 0:
j = r[i] + 1
while j <= n and (c[j] > 0 or s[i + j] > 0 or d[i - j + n] > 0):
j += 1
if j <= n:
... |
# -*- coding: utf-8 -*-
#
# Implementation by Pedro Maat C. Massolino, hereby denoted as "the implementer".
#
# To the extent possible under law, the implementer has waived all copyright
# and related or neighboring rights to the source code in this file.
# http://creativecommons.org/publicdomain/zero/1.0/
#
de... | def generate_vhdl_instantiation_multiplication(temp_number, temp_range):
temp_name = 'temp_mult_' + str(temp_number)
final_string = 'signal ' + temp_name + ' : ' + 'std_logic_vector('
final_string = final_string + str(temp_range[1]) + ' downto ' + str(temp_range[0]) + ');'
return final_string
def gener... |
class Clock:
def __init__(self, hours, mins):
self.hours = hours
self.mins = mins
self.fixup()
def __eq__(self, other):
return self.hours == other.hours and self.mins == other.mins
def __str__(self):
return (self.format_hours() + ':' +
self.format_mi... | class Clock:
def __init__(self, hours, mins):
self.hours = hours
self.mins = mins
self.fixup()
def __eq__(self, other):
return self.hours == other.hours and self.mins == other.mins
def __str__(self):
return self.format_hours() + ':' + self.format_mins()
def ad... |
def convert(json_string: str) ->dict:
value_started = False
field_name = None
result = {}
i = 0
while i < len(json_string):
char = json_string[i]
if not field_name:
field_name, json_string = parse_field(json_string)
json_string = skip_unnecessary_chars(json_... | def convert(json_string: str) -> dict:
value_started = False
field_name = None
result = {}
i = 0
while i < len(json_string):
char = json_string[i]
if not field_name:
(field_name, json_string) = parse_field(json_string)
json_string = skip_unnecessary_chars(json... |
# test construction of bytes from different objects
# long ints
print(ord(bytes([14953042807679334000 & 0xff])))
| print(ord(bytes([14953042807679334000 & 255]))) |
class Solution:
# Insert (Accepted + Top Voted), O(n^2) time, O(n) space
def createTargetArray(self, nums: List[int], index: List[int]) -> List[int]:
res = []
for i in range(len(nums)):
res.insert(index[i], nums[i])
return res
# Slice Assignment (Top Voted), O(n^2) time,... | class Solution:
def create_target_array(self, nums: List[int], index: List[int]) -> List[int]:
res = []
for i in range(len(nums)):
res.insert(index[i], nums[i])
return res
def create_target_array(self, nums: List[int], index: List[int]) -> List[int]:
target = []
... |
distance = float(input())
day_or_nigh = input()
if distance < 20 and day_or_nigh == "day":
money = 0.7 + (distance * 0.79)
print(f"{money:.2f}")
elif distance < 20 and day_or_nigh == "night":
money = 0.7 + (distance * 0.9)
print(f"{money:.2f}")
elif 20 <= distance < 100:
money = distance * 0.09
... | distance = float(input())
day_or_nigh = input()
if distance < 20 and day_or_nigh == 'day':
money = 0.7 + distance * 0.79
print(f'{money:.2f}')
elif distance < 20 and day_or_nigh == 'night':
money = 0.7 + distance * 0.9
print(f'{money:.2f}')
elif 20 <= distance < 100:
money = distance * 0.09
prin... |
# TC: O(nlogn)
# SC:O(logn)
class Solution:
def sortList(self, head: ListNode) -> ListNode:
def sortFunc(head: ListNode, tail: ListNode) -> ListNode:
if not head or not head.next:
return head
if head.next == tail:
... | class Solution:
def sort_list(self, head: ListNode) -> ListNode:
def sort_func(head: ListNode, tail: ListNode) -> ListNode:
if not head or not head.next:
return head
if head.next == tail:
head.next = None
return head
fast ... |
##
## This file is maintained by Ansible - CHANGES WILL BE OVERWRITTEN
##
USERS = (
'outreach@galaxyproject.org',
'jen@bx.psu.edu',
'anton@bx.psu.edu',
'marius@galaxyproject.org',
)
NORM_USERS = [u.lower() for u in USERS]
def __dynamic_reserved(key, user_email):
if user_email is not None and use... | users = ('outreach@galaxyproject.org', 'jen@bx.psu.edu', 'anton@bx.psu.edu', 'marius@galaxyproject.org')
norm_users = [u.lower() for u in USERS]
def __dynamic_reserved(key, user_email):
if user_email is not None and user_email.lower() in NORM_USERS:
return 'reserved_' + key
return 'slurm_' + key
def d... |
class Example(object):
def __init__(self, node_features, fc_matrix, y):
# TODO: Add data shape validations
self.node_features = node_features
self.fc_matrix, self.y = fc_matrix, y
def to_data_obj(self):
pass # TODO
| class Example(object):
def __init__(self, node_features, fc_matrix, y):
self.node_features = node_features
(self.fc_matrix, self.y) = (fc_matrix, y)
def to_data_obj(self):
pass |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Author: Li Yuanming
Email: yli056@e.ntu.edu.sg
Date: 1/31/2021
ModelCI's experimental APIs.
"""
| """
Author: Li Yuanming
Email: yli056@e.ntu.edu.sg
Date: 1/31/2021
ModelCI's experimental APIs.
""" |
# Definition for singly-linked list.
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
# idea:
# pointers:
# 1. new list 'res'
# 2, 3 - heads h1, h2
# we go on until we have nodes:
# pick smallest node and attack to res
class Solution:
def mergeTwoLists... | class Listnode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution:
def merge_two_lists(self, l1: ListNode, l2: ListNode) -> ListNode:
res = None
r = res
(h1, h2) = (l1, l2)
while h1 is not None or h2 is not None:
i... |
#!/usr/bin/env python
"""
Problem 2: Even Fibonacci numbers
Each new term in the Fibonacci sequence is generated by adding the previous two
terms. By starting with 1 and 2, the first 10 terms will be:
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
By considering the terms in the Fibonacci sequence whose values do not exce... | """
Problem 2: Even Fibonacci numbers
Each new term in the Fibonacci sequence is generated by adding the previous two
terms. By starting with 1 and 2, the first 10 terms will be:
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
By considering the terms in the Fibonacci sequence whose values do not exceed
four million, find ... |
def bytes_to_int(by):
result = 0
for b in by:
result = result * 256 + int(b)
return result
| def bytes_to_int(by):
result = 0
for b in by:
result = result * 256 + int(b)
return result |
class LightControl:
def __init__(self, max_switch, logger, a_address, a_rst_pin, b_address, b_rst_pin):
pass
def run(self):
pass
def init(self):
pass
def can_switch(self, light):
pass
def update_switched(self, light):
pass
def schedule_switch(self, li... | class Lightcontrol:
def __init__(self, max_switch, logger, a_address, a_rst_pin, b_address, b_rst_pin):
pass
def run(self):
pass
def init(self):
pass
def can_switch(self, light):
pass
def update_switched(self, light):
pass
def schedule_switch(self, l... |
def relative_coordinates(move):
return {
"L": (-1*int(move[1:]), 0),
"R": (int(move[1:]), 0),
"U": (0, -1*int(move[1:])),
"D": (0, int(move[1:])),
}.get(move[0])
def create_wire(wire, name):
global coordinates
global crossings
position = [0, 0]
for move in wir... | def relative_coordinates(move):
return {'L': (-1 * int(move[1:]), 0), 'R': (int(move[1:]), 0), 'U': (0, -1 * int(move[1:])), 'D': (0, int(move[1:]))}.get(move[0])
def create_wire(wire, name):
global coordinates
global crossings
position = [0, 0]
for move in wire:
movement = relative_coordin... |
class Solution:
def isRationalEqual(self, S: str, T: str) -> bool:
def valueOf(s: str) -> float:
if s.find('(') == -1:
return float(s)
integer_nonRepeating = float(s[:s.find('(')])
nonRepeatingLength = s.find('(') - s.find('.') - 1
repeating = float(s[s.find('(') + 1: s.find(')')]... | class Solution:
def is_rational_equal(self, S: str, T: str) -> bool:
def value_of(s: str) -> float:
if s.find('(') == -1:
return float(s)
integer_non_repeating = float(s[:s.find('(')])
non_repeating_length = s.find('(') - s.find('.') - 1
repe... |
#!/usr/bin/env python
NAME = 'Barracuda Application Firewall (Barracuda Networks)'
def is_waf(self):
if self.matchcookie(r'^barra_counter_session='):
return True
if self.matchcookie(r'^BNI__BARRACUDA_LB_COOKIE='):
return True
if self.matchcookie(r'^BNI_persistence='):
return True... | name = 'Barracuda Application Firewall (Barracuda Networks)'
def is_waf(self):
if self.matchcookie('^barra_counter_session='):
return True
if self.matchcookie('^BNI__BARRACUDA_LB_COOKIE='):
return True
if self.matchcookie('^BNI_persistence='):
return True
if self.matchcookie('^B... |
class Solution:
def countSubstrings(self, s: str) -> int:
self.counter = 0
def helper(s, l, r):
while l >= 0 and r < len(s) and s[l] == s[r]:
l -= 1
r += 1
self.counter += 1
for i in range(len(s)):
... | class Solution:
def count_substrings(self, s: str) -> int:
self.counter = 0
def helper(s, l, r):
while l >= 0 and r < len(s) and (s[l] == s[r]):
l -= 1
r += 1
self.counter += 1
for i in range(len(s)):
helper(s, i, i)
... |
{
"targets": [
{
"target_name": "beepwin",
'conditions': [
['OS=="win"', {
'sources': [
'lib/beepwin.cc',
]
}]
]
}
]
} | {'targets': [{'target_name': 'beepwin', 'conditions': [['OS=="win"', {'sources': ['lib/beepwin.cc']}]]}]} |
microcode = '''
def macroop VMOVAPD_XMM_XMM {
movfp128 dest=xmm0, src1=xmm0m, dataSize=16
vclear dest=xmm2, destVL=16
};
def macroop VMOVAPD_XMM_M {
ldfp128 xmm0, seg, sib, "DISPLACEMENT + 0", dataSize=16
vclear dest=xmm2, destVL=16
};
def macroop VMOVAPD_XMM_P {
rdip t7
ldfp128 xmm0, seg, rip... | microcode = '\ndef macroop VMOVAPD_XMM_XMM {\n movfp128 dest=xmm0, src1=xmm0m, dataSize=16\n vclear dest=xmm2, destVL=16\n};\n\ndef macroop VMOVAPD_XMM_M {\n ldfp128 xmm0, seg, sib, "DISPLACEMENT + 0", dataSize=16\n vclear dest=xmm2, destVL=16\n};\n\ndef macroop VMOVAPD_XMM_P {\n rdip t7\n ldfp128 xmm... |
'''
Functions for producing csproj-style XML for various kinds of content.
Used by generate_sample_solutions to update the .csproj files for individual projects.
'''
def get_csproj_xml_for_nuget_packages(nuget_version_list):
'''
param nuget_version_list: a list of dictionaries.
keys are 'name' and 'version... | """
Functions for producing csproj-style XML for various kinds of content.
Used by generate_sample_solutions to update the .csproj files for individual projects.
"""
def get_csproj_xml_for_nuget_packages(nuget_version_list):
"""
param nuget_version_list: a list of dictionaries.
keys are 'name' and 'version... |
"""
Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=1500 ] = 0.120
Average Precision (AP) @[ IoU=0.25 | area= all | maxDets=1500 ] = -1.000
Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=1500 ] = 0.288
Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=1500 ] = 0... | """
Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=1500 ] = 0.120
Average Precision (AP) @[ IoU=0.25 | area= all | maxDets=1500 ] = -1.000
Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=1500 ] = 0.288
Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=1500 ] = 0... |
"""
Abstract classes for later subclassing and exposition
"""
class Exposed: # pylint: disable=R0903 # Too few public methods
"""
Base class for `ExposedQuery`, `ExposedMutation` and `ExposedModel`
"""
class ExposedQuery(Exposed): # pylint: disable=R0903 # Too few public methods
"""
A... | """
Abstract classes for later subclassing and exposition
"""
class Exposed:
"""
Base class for `ExposedQuery`, `ExposedMutation` and `ExposedModel`
"""
class Exposedquery(Exposed):
"""
Abstract base class for exposing a query
"""
class Exposedmutation(Exposed):
"""
Ab... |
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def lowestCommonAncestor(self,
root: TreeNode,
p: TreeNode,
q: TreeNode) -> TreeNode:
... | class Treenode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def lowest_common_ancestor(self, root: TreeNode, p: TreeNode, q: TreeNode) -> TreeNode:
(smaller, greater) = sorted([p.val, q.val])
while not smaller <= root.val <= g... |
# python3
class Request:
def __init__(self, arrival_time, process_time):
self.arrival_time = arrival_time
self.process_time = process_time
class Response:
def __init__(self, dropped, start_time):
self.dropped = dropped
self.start_time = start_time
class Buffer:
... | class Request:
def __init__(self, arrival_time, process_time):
self.arrival_time = arrival_time
self.process_time = process_time
class Response:
def __init__(self, dropped, start_time):
self.dropped = dropped
self.start_time = start_time
class Buffer:
def __init__(self, ... |
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | """Debug command flags."""
snapshot_list_format = '\n table(\n short_status():label=STATUS,\n userEmail.if(all_users),\n location,\n condition,\n finalTime.if(include_inactive != 0):label=COMPLETED_TIME,\n id,\n consoleViewUrl:label=V... |
#!/usr/bin/env python
# coding=utf-8
'''
Author: John
Email: johnjim0816@gmail.com
Date: 2020-07-30 23:01:40
LastEditor: John
LastEditTime: 2020-08-03 10:13:24
Discription:
Environment:
'''
# Source : https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree/
# Author : JohnJim0816
# Date : 2020-07-30
... | """
Author: John
Email: johnjim0816@gmail.com
Date: 2020-07-30 23:01:40
LastEditor: John
LastEditTime: 2020-08-03 10:13:24
Discription:
Environment:
"""
class Solution:
def lowest_common_ancestor(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode':
if not root or root == p or root == q:
... |
"""Tests for the models of the drf_auth app."""
# from django.test import TestCase
# from mixer.backend.django import mixer
| """Tests for the models of the drf_auth app.""" |
def greeting():
print("""
**************************************
** Welcome to the Snakes Cafe! **
** Please see our menu below. **
** **
** To quit at any time, type "quit" **
**************************************
""")
greeting()
def menu():
print("""
... | def greeting():
print('\n **************************************\n ** Welcome to the Snakes Cafe! **\n ** Please see our menu below. **\n ** **\n ** To quit at any time, type "quit" **\n **************************************\n\n ')
greeting()
def menu():
prin... |
# Copyright 2019 the rules_javascript authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | load('//javascript/internal:providers.bzl', _JavaScriptInfo='JavaScriptInfo', _NodeModulesInfo='NodeModulesInfo')
load('//javascript/node:node.bzl', _node_common='node_common')
toolchain_type = '@rules_javascript//tools/babel:toolchain_type'
babel_config_info = provider(fields=['files', 'babel_config_file'])
babel_pres... |
def add(x,y):
print(x+y)
add(5,3)
def sayHello():
print("Hello")
# sayHello("Hi") This does not work as sayHello() takes no args
def sayHello(name):
print(f"Hello {name}")
sayHello("Brent")
# Keyword arguments
def sayHello(name, surname):
print(f"Hello {name} {surname}")
sayHello(surname = "Bren... | def add(x, y):
print(x + y)
add(5, 3)
def say_hello():
print('Hello')
def say_hello(name):
print(f'Hello {name}')
say_hello('Brent')
def say_hello(name, surname):
print(f'Hello {name} {surname}')
say_hello(surname='Brent', name='Littlefield')
def divide(dividend, divisor):
if divisor != 0:
... |
#!/usr/bin/env python
# In case of poor (Sh***y) commenting contact adam.lamson@colorado.edu
# Basic
'''
Name: ase1_styles
Description: Dictionaries of different styles that you can use
Input:
Output:
'''
ase1_runs_stl = {
"axes.titlesize": 18,
"axes.labelsize": 15,
"lines.linewidth": 3,
"lines.marker... | """
Name: ase1_styles
Description: Dictionaries of different styles that you can use
Input:
Output:
"""
ase1_runs_stl = {'axes.titlesize': 18, 'axes.labelsize': 15, 'lines.linewidth': 3, 'lines.markersize': 10, 'xtick.labelsize': 15, 'ytick.labelsize': 15, 'font.size': 15}
ase1_sims_stl = {'axes.titlesize': 25, 'axes.l... |
# coding: utf-8
# vim: set et ts=4 sw=4 nu fdm=indent cc=80:
"""
Module sprkkr_inputs
===============
This function contains input templates for various input_parameters
New template include into dict_inp_data.
It returns list of strings which can be proceeded by
load_parameters
Please be carefull, each keyword in gi... | """
Module sprkkr_inputs
===============
This function contains input templates for various input_parameters
New template include into dict_inp_data.
It returns list of strings which can be proceeded by
load_parameters
Please be carefull, each keyword in given section has to be
on the new line
.. code-block:: python
... |
# Copyright (C) 2020-2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
QUANTIZE_AGNOSTIC_OPERATIONS = [
{'type': 'MaxPool'},
{'type': 'ReduceMax'},
{'type': 'Reshape'},
{'type': 'Concat'},
{'type': 'Flatten'},
{'type': 'Squeeze'},
{'type': 'Unsqueeze'},
{'type': 'Split'},
... | quantize_agnostic_operations = [{'type': 'MaxPool'}, {'type': 'ReduceMax'}, {'type': 'Reshape'}, {'type': 'Concat'}, {'type': 'Flatten'}, {'type': 'Squeeze'}, {'type': 'Unsqueeze'}, {'type': 'Split'}, {'type': 'VariadicSplit'}, {'type': 'Crop'}, {'type': 'Transpose'}, {'type': 'Tile'}, {'type': 'StridedSlice'}, {'type'... |
# Dictionary
person = {'name': 'Joseph Mtinangi', 'college': 'CIVE'}
# Print the dictionary
print(person)
# Print all keys
print('Keys')
print(person.keys())
print('Values')
print(person.values())
print('All')
print(person.items())
| person = {'name': 'Joseph Mtinangi', 'college': 'CIVE'}
print(person)
print('Keys')
print(person.keys())
print('Values')
print(person.values())
print('All')
print(person.items()) |
km=float(input("Enter the distance in km : \t"))
miles=km*0.621
cel=float(input("Enter the temp in celsius: \t"))
far=((9/5)*cel)+32
print("Distance in miles :",miles," \nTemperature in Fahrenheit: ",far) | km = float(input('Enter the distance in km : \t'))
miles = km * 0.621
cel = float(input('Enter the temp in celsius: \t'))
far = 9 / 5 * cel + 32
print('Distance in miles :', miles, ' \nTemperature in Fahrenheit: ', far) |
# Copyright 2015 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... | sass_filetypes = file_type(['.sass', '.scss'])
def collect_transitive_sources(ctx):
source_files = set(order='compile')
for dep in ctx.attr.deps:
source_files += dep.transitive_sass_files
return source_files
def _sass_library_impl(ctx):
transitive_sources = collect_transitive_sources(ctx)
... |
# encoding: utf-8
"""
message.py
Created by Thomas Mangin on 2013-02-26.
Copyright (c) 2009-2015 Exa Networks. All rights reserved.
"""
class FakeAddPath (object):
def send (self,afi,safi):
return False
def receive (self,afi,safi):
return False
class FakeNegotiated (object):
def __init__ (self,header,asn4):
... | """
message.py
Created by Thomas Mangin on 2013-02-26.
Copyright (c) 2009-2015 Exa Networks. All rights reserved.
"""
class Fakeaddpath(object):
def send(self, afi, safi):
return False
def receive(self, afi, safi):
return False
class Fakenegotiated(object):
def __init__(self, header, a... |
#
# PySNMP MIB module SERVICE-LOCATION-PROTOCOL-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SERVICE-LOCATION-PROTOCOL-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:01:52 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python ve... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, value_size_constraint, value_range_constraint, constraints_intersection, single_value_constraint) ... |
def maxSum(num_list, n, k):
if n < k:
print("Invalid")
return -1
max_sum = 0
for i in range(k):
max_sum += num_list[i]
window_sum = max_sum
for i in range(k,n):
window_sum += num_list[i] - num_list[i - k]
max_sum = max(max_sum, window_sum)
return max_sum... | def max_sum(num_list, n, k):
if n < k:
print('Invalid')
return -1
max_sum = 0
for i in range(k):
max_sum += num_list[i]
window_sum = max_sum
for i in range(k, n):
window_sum += num_list[i] - num_list[i - k]
max_sum = max(max_sum, window_sum)
return max_sum... |
y = 123
y = "Hola Mundo"
def sum(a,b):
return a+b
print(sum(3,4))
def toUnderscore(word):
return word.replace(" ", "_")
print(toUnderscore(y))
def changeLetters(string):
for x in string:
if(x.isupper()):
print(x.lower())
else:
print(x.upper())
changeLetters(y)
... | y = 123
y = 'Hola Mundo'
def sum(a, b):
return a + b
print(sum(3, 4))
def to_underscore(word):
return word.replace(' ', '_')
print(to_underscore(y))
def change_letters(string):
for x in string:
if x.isupper():
print(x.lower())
else:
print(x.upper())
change_letters(... |
ADVIL = "Advil"
ALEVE = "Aleve"
CELEBREX = "Celebrex"
COLCRYS = "Colcrys"
INDOCIN = "Indocin"
METHYLPRED = "Methylprednisolone"
MOBIC = "Mobic"
OTHERTREATMENT = "Other treatment"
PRED = "Prednisone"
TINCTUREOFTIME = "Tincture of time"
UNDERONE = "under 24 hours"
ONETOTHREE = "more than 1 but less than 3 days"
THREETOS... | advil = 'Advil'
aleve = 'Aleve'
celebrex = 'Celebrex'
colcrys = 'Colcrys'
indocin = 'Indocin'
methylpred = 'Methylprednisolone'
mobic = 'Mobic'
othertreatment = 'Other treatment'
pred = 'Prednisone'
tinctureoftime = 'Tincture of time'
underone = 'under 24 hours'
onetothree = 'more than 1 but less than 3 days'
threetose... |
class Brain():
def __init__(self):
self.experiences = [] | class Brain:
def __init__(self):
self.experiences = [] |
s = input()
t = input()
s = [i for i in s]
t = [i for i in t]
s.sort()
t.sort()
t.reverse()
s = "".join(s)
t = "".join(t)
if s < t:
print("Yes")
else:
print("No")
| s = input()
t = input()
s = [i for i in s]
t = [i for i in t]
s.sort()
t.sort()
t.reverse()
s = ''.join(s)
t = ''.join(t)
if s < t:
print('Yes')
else:
print('No') |
# transcribing DNA into RNA
DNA_seq = str(input("Input DNA-sequence: "))
DNA_seq = str.upper(DNA_seq)
RNA_complement = ""
n = len(DNA_seq) - 1
while n >= 0:
if DNA_seq[n] == "A":
RNA_complement += "A"
n = n - 1
elif DNA_seq[n] == "T":
RNA_complement += "U"
n = n - 1
elif D... | dna_seq = str(input('Input DNA-sequence: '))
dna_seq = str.upper(DNA_seq)
rna_complement = ''
n = len(DNA_seq) - 1
while n >= 0:
if DNA_seq[n] == 'A':
rna_complement += 'A'
n = n - 1
elif DNA_seq[n] == 'T':
rna_complement += 'U'
n = n - 1
elif DNA_seq[n] == 'C':
rna_c... |
'''
Source : https://leetcode.com/problems/longest-uncommon-subsequence-i/
Author : Yuan Wang
Date : 2018-07-17
/***************************************************************************************
*Given a group of two strings, you need to find the longest uncommon subsequence of this
*group of two strings. Th... | """
Source : https://leetcode.com/problems/longest-uncommon-subsequence-i/
Author : Yuan Wang
Date : 2018-07-17
/***************************************************************************************
*Given a group of two strings, you need to find the longest uncommon subsequence of this
*group of two strings. Th... |
# Name: Jaden Leflar
# Period: 4
# Course: CS30
# Date created: 25/10/19
# Description: RPG Nested Dictionaries
def thingy(Name):
# prints out the items, keys, and values in the Dictionaries
for Name, key in Name.items():
# Does a loop through the dictionaies and prints all their contents
prin... | def thingy(Name):
for (name, key) in Name.items():
print(Name + ':')
for items in key:
print(f'\t{items} - {key[items]}')
main_character = {'Main character': {'Name': '*@#$!&%^/', 'Age': 14, 'Grade': 9, 'Personality': 'depends on player choices'}}
side_characters = {'Side characters': {'... |
def read(filname, delimiter=','):
res = []
with open(filname, 'r', encoding = 'utf-8') as f:
table = f.readlines()
for row in table:
res.append(row.strip('\n').split(delimiter))
return res
def write(filename, table, delimiter=','):
rows = len(table)
columns = len(table[0])
wi... | def read(filname, delimiter=','):
res = []
with open(filname, 'r', encoding='utf-8') as f:
table = f.readlines()
for row in table:
res.append(row.strip('\n').split(delimiter))
return res
def write(filename, table, delimiter=','):
rows = len(table)
columns = len(table[0])
wit... |
"""
Python if else flow
"""
a = True
if a is False:
print('a is false')
elif a is True:
print('a is True')
else:
print('what is a?')
"""
The base structure of a an if else statment is that it checks a
expression on if, then if the expression is True, executes the code
on the if block.
If not, it will che... | """
Python if else flow
"""
a = True
if a is False:
print('a is false')
elif a is True:
print('a is True')
else:
print('what is a?')
'\nThe base structure of a an if else statment is that it checks a\nexpression on if, then if the expression is True, executes the code\non the if block.\nIf not, it will chec... |
A, B, C, D = map(int, input().split())
if A * D == B * C:
print('DRAW')
elif B * C > A * D:
print('TAKAHASHI')
else:
print('AOKI')
| (a, b, c, d) = map(int, input().split())
if A * D == B * C:
print('DRAW')
elif B * C > A * D:
print('TAKAHASHI')
else:
print('AOKI') |
numbers = int(input())
char = int(input()) + 97
for i in range(1, numbers + 1):
for i2 in range(1, numbers + 1):
for i3 in range(97, char):
for i4 in range(97, char):
for i5 in range(1, numbers + 1):
if i < i5 > i2:
print(f"{i}{i2}{chr... | numbers = int(input())
char = int(input()) + 97
for i in range(1, numbers + 1):
for i2 in range(1, numbers + 1):
for i3 in range(97, char):
for i4 in range(97, char):
for i5 in range(1, numbers + 1):
if i < i5 > i2:
print(f'{i}{i2}{chr(... |
debug = False
pieces = "pnbrqk"
def xy_to_i(xy: tuple) -> int:
return xy[0] + 8 * xy[1]
def i_to_xy(i: int) -> tuple:
return (i % 8, i // 8)
def add_chunk(result: list, offset: int, chunk: int):
if not offset:
result[-1] |= chunk
else:
result.append(chunk << 4)
def encode(data: d... | debug = False
pieces = 'pnbrqk'
def xy_to_i(xy: tuple) -> int:
return xy[0] + 8 * xy[1]
def i_to_xy(i: int) -> tuple:
return (i % 8, i // 8)
def add_chunk(result: list, offset: int, chunk: int):
if not offset:
result[-1] |= chunk
else:
result.append(chunk << 4)
def encode(data: dict)... |
# Copyright (c) 2020 Splunk Inc.
#
# Licensed under Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt)
#
TANIUM_DETECT_DEFAULT_LIMIT = 100
TANIUM_DETECT_MAX_LIMIT = 500
TANIUM_DETECT_API_BASE_URL = '/plugin/products/detect3/api/v1'
TANIUM_DETECT_API_PATH_SUPPRESSION_RULES = '/suppression-rules'
TANIUM_DETECT_... | tanium_detect_default_limit = 100
tanium_detect_max_limit = 500
tanium_detect_api_base_url = '/plugin/products/detect3/api/v1'
tanium_detect_api_path_suppression_rules = '/suppression-rules'
tanium_detect_api_path_sources = '/sources'
tanium_detect_api_path_source_types = '/source-types'
tanium_detect_api_path_notifica... |
a = set(map(int, input().split()))
for x in range(int(input())):
b = set(map(int, input().split()))
if len(b.intersection(a))<len(b):
print("False")
exit()
print("True")# Enter your code here. Read input from STDIN. Print output to STDOUT
| a = set(map(int, input().split()))
for x in range(int(input())):
b = set(map(int, input().split()))
if len(b.intersection(a)) < len(b):
print('False')
exit()
print('True') |
class Logger():
'''
Logs information about model progress into a file
'''
def __init__(self, filename=None):
if filename is None:
self.f = None
else:
self.f = open(filename,'a')
def log(self, message):
''' Adds message file '''
print(message)
... | class Logger:
"""
Logs information about model progress into a file
"""
def __init__(self, filename=None):
if filename is None:
self.f = None
else:
self.f = open(filename, 'a')
def log(self, message):
""" Adds message file """
print(message)
... |
class InvalidBudget(Exception):
def __init__(self, msg):
self.msg = msg
def __unicode__(self):
return self.msg | class Invalidbudget(Exception):
def __init__(self, msg):
self.msg = msg
def __unicode__(self):
return self.msg |
class Solution:
def numJewelsInStones(self, J: str, S: str) -> int:
num=0
list1=[x for x in J]
for i in S:
if i in list1:
num+=1
return num | class Solution:
def num_jewels_in_stones(self, J: str, S: str) -> int:
num = 0
list1 = [x for x in J]
for i in S:
if i in list1:
num += 1
return num |
guang
python-Levenshtein
psutil
pretty_errors
ephem
dill
# itchat
# numpy
# streamlit
# pandas
# matplotlib
# plotly
# treetable
| guang
python - Levenshtein
psutil
pretty_errors
ephem
dill |
module_j2 = '''
---
module:
name: &module "{{ item.module }}" # Module name
author: &author "{{ item.email }}" # Authors email
# A description of the module will be inserted at the top of the Excel worksheet
description: "This is default module description for {{ item.module }}"
# A list of provided pu... | module_j2 = '\n---\nmodule:\n name: &module "{{ item.module }}" # Module name\n author: &author "{{ item.email }}" # Authors email\n # A description of the module will be inserted at the top of the Excel worksheet\n description: "This is default module description for {{ item.module }}"\n # A list of provid... |
def render_block(self, block: str, block_type: str, y: int) -> int:
"""
:param self: MarkdownRenderer
:param block: string of text
:param block_type: type of the text (e.g. headers, ordered/unordered lists, blockquotes, code etc)
:param y: y-coordinate to start rendering on
:return: y-coordina... | def render_block(self, block: str, block_type: str, y: int) -> int:
"""
:param self: MarkdownRenderer
:param block: string of text
:param block_type: type of the text (e.g. headers, ordered/unordered lists, blockquotes, code etc)
:param y: y-coordinate to start rendering on
:return: y-coordinat... |
__version__ = '0.1.2'
__author__ = 'Alexander Thebelt'
__author_email__ = 'alexander.thebelt18@imperial.ac.uk'
__license__ = 'BSD 3-Clause License' | __version__ = '0.1.2'
__author__ = 'Alexander Thebelt'
__author_email__ = 'alexander.thebelt18@imperial.ac.uk'
__license__ = 'BSD 3-Clause License' |
def can_build(env, platform):
return True
def configure(env):
pass
def get_doc_classes():
return [
"CharacterAtlasEntry",
"CharacterAtlas",
"ESS",
"AuraGroup",
"CraftRecipeHelper",
"CraftRecipe",
"EquipmentData",
"ItemInstance",
"Ite... | def can_build(env, platform):
return True
def configure(env):
pass
def get_doc_classes():
return ['CharacterAtlasEntry', 'CharacterAtlas', 'ESS', 'AuraGroup', 'CraftRecipeHelper', 'CraftRecipe', 'EquipmentData', 'ItemInstance', 'ItemTemplate', 'ModelVisualEntry', 'ModelVisual', 'SpellCooldownManipulationD... |
def test_old_style_classes():
class C:
pass
def f(x):
"""
:type x: object
"""
pass
f(C()) #pass
| def test_old_style_classes():
class C:
pass
def f(x):
"""
:type x: object
"""
pass
f(c()) |
# -*- coding: utf-8 -*-
# License: See LICENSE file.
required_states = ['position','age']
required_matrices = ['cellular_binary_life']
def run(name, world, matrices, states, extra_life=10):
y,x = states['position']
if matrices['cellular_binary_life'][int(y),int(x)]:
# Eat the cell under the agent's p... | required_states = ['position', 'age']
required_matrices = ['cellular_binary_life']
def run(name, world, matrices, states, extra_life=10):
(y, x) = states['position']
if matrices['cellular_binary_life'][int(y), int(x)]:
matrices['cellular_binary_life'][int(y), int(x)] = False
states['age'] += ex... |
class Solution:
def entityParser(self, text: str) -> str:
text = text.replace(""", '"')
text = text.replace("'", "'")
text = text.replace(">", ">")
text = text.replace("<", "<")
text = text.replace("⁄", "/")
text = text.replace("&", "&")
... | class Solution:
def entity_parser(self, text: str) -> str:
text = text.replace('"', '"')
text = text.replace(''', "'")
text = text.replace('>', '>')
text = text.replace('<', '<')
text = text.replace('⁄', '/')
text = text.replace('&', '&')
... |
f = open("config.txt", 'w')
f.write("Random Seed <>\n\
Number of worlds <>\n\
Number of Days <>\n\
Agent Parameter Keys <>\n\
Agent list filename <>\n\
Interaction Info Keys <>\n\
Interaction Files list filename <>\n\
Location Parameter Keys <>\n\
Location list filename <>\n\
Event Parameter Keys <>\n\
Event Files list... | f = open('config.txt', 'w')
f.write('Random Seed <>\nNumber of worlds <>\nNumber of Days <>\nAgent Parameter Keys <>\nAgent list filename <>\nInteraction Info Keys <>\nInteraction Files list filename <>\nLocation Parameter Keys <>\nLocation list filename <>\nEvent Parameter Keys <>\nEvent Files list filename <>\nOne Ti... |
class Solution:
# @param {string} s
# @return {boolean}
def isPalindrome(self, s):
n = len(s)
s = s.lower()
if n < 2:
return True
i = 0
j = n-1
while(i<=j):
while(not s[i].isalnum() and i<j):
i+=1
while(not s... | class Solution:
def is_palindrome(self, s):
n = len(s)
s = s.lower()
if n < 2:
return True
i = 0
j = n - 1
while i <= j:
while not s[i].isalnum() and i < j:
i += 1
while not s[j].isalnum() and j > i:
... |
###################################
# File Name : dir_closure.py
###################################
#!/usr/bin/python3
def closure():
def inner():
pass
p = dir(inner())
print ("=== inner attribute ===")
print (p)
return inner
if __name__ == "__main__":
p = dir(closure())
prin... | def closure():
def inner():
pass
p = dir(inner())
print('=== inner attribute ===')
print(p)
return inner
if __name__ == '__main__':
p = dir(closure())
print('=== attribute ===')
print(p) |
'''
Description: In the Josephus problem from antiquity, N people are in dire straits and agree to the following strategy to reduce the population. They arrange themselves in a circle (at positions numbered from 0 to N-1) and proceed around the circle, eliminating every Mth person until only one person is left. Legend ... | """
Description: In the Josephus problem from antiquity, N people are in dire straits and agree to the following strategy to reduce the population. They arrange themselves in a circle (at positions numbered from 0 to N-1) and proceed around the circle, eliminating every Mth person until only one person is left. Legend ... |
class Flight:
def __init__(self, engine):
self.engine = engine
def startEngine(self):
self.engine.start()
class AirbusEngine:
def start(self):
print("Starting Airbus Engine.")
class BoingEngine:
def start(self):
print("Starting Boing Engine.")
ae = AirbusEngin... | class Flight:
def __init__(self, engine):
self.engine = engine
def start_engine(self):
self.engine.start()
class Airbusengine:
def start(self):
print('Starting Airbus Engine.')
class Boingengine:
def start(self):
print('Starting Boing Engine.')
ae = airbus_engine()
... |
def value_added_tax(amount):
tax = amount * 0.25
total_amount = amount * 1.25
return f"{amount}, {tax}, {total_amount}"
price = value_added_tax(100)
print(price, type(price)) | def value_added_tax(amount):
tax = amount * 0.25
total_amount = amount * 1.25
return f'{amount}, {tax}, {total_amount}'
price = value_added_tax(100)
print(price, type(price)) |
class Solution:
def calc(self, s):
s = s.strip()
s = s.replace(' ', '')
s = s.replace('--', '+')
try:
int(s)
return str(s)
except:
pass
# print('')
res = 0
queue = []
i = 0
while i < len(s):
... | class Solution:
def calc(self, s):
s = s.strip()
s = s.replace(' ', '')
s = s.replace('--', '+')
try:
int(s)
return str(s)
except:
pass
res = 0
queue = []
i = 0
while i < len(s):
tmp = ''
... |
# -*- test-case-name: twisted.protocols.haproxy.test -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Unit tests for L{twisted.protocols.haproxy}.
"""
| """
Unit tests for L{twisted.protocols.haproxy}.
""" |
def test_socfaker_logs_windows_eventlog(socfaker_fixture):
assert socfaker_fixture.logs.windows.eventlog()
def test_socfaker_logs_windows_sysmon_logs(socfaker_fixture):
assert socfaker_fixture.logs.windows.sysmon() | def test_socfaker_logs_windows_eventlog(socfaker_fixture):
assert socfaker_fixture.logs.windows.eventlog()
def test_socfaker_logs_windows_sysmon_logs(socfaker_fixture):
assert socfaker_fixture.logs.windows.sysmon() |
# test round() with large integer values and second arg
# rounding integers is an optional feature so test for it
try:
round(1, -1)
except NotImplementedError:
print('SKIP')
raise SystemExit
i = 2**70
tests = [
(i, 0), (i, -1), (i, -10), (i, 1),
(-i, 0), (-i, -1), (-i, -10), (-i, 1),
]
for t in t... | try:
round(1, -1)
except NotImplementedError:
print('SKIP')
raise SystemExit
i = 2 ** 70
tests = [(i, 0), (i, -1), (i, -10), (i, 1), (-i, 0), (-i, -1), (-i, -10), (-i, 1)]
for t in tests:
print(round(*t))
print('PASS') |
#### DOC START
"""[kubernetes_cluster_env]
_from = local
remote_engine = kubernetes_engine"""
"""[kubernetes_engine]
_type = kubernetes
container_repository = databand_examples
container_tag =
docker_build = True
docker_build_push = True
namespace = databand
debug = False
secrets = [
{ "type":"env", "target":... | """[kubernetes_cluster_env]
_from = local
remote_engine = kubernetes_engine"""
'[kubernetes_engine]\n_type = kubernetes\n\ncontainer_repository = databand_examples\ncontainer_tag =\n\ndocker_build = True\ndocker_build_push = True\n\nnamespace = databand\n\ndebug = False\nsecrets = [\n { "type":"env", "target": "AIRFL... |
# Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... | """
Collects constants to be shared between core code and tuning scripts or
benchmarks.
"""
syne_tune_folder = 'syne-tune'
st_tuner_creation_timestamp = 'st_tuner_creation_timestamp'
st_tuner_start_timestamp = 'st_tuner_start_timestamp'
st_worker_iter = 'st_worker_iter'
st_worker_timestamp = 'st_worker_timestamp'
st_wo... |
def is_user_has_access_to_view_submission(user, submission):
has_access = False
if not user.is_authenticated:
pass
elif user.is_apply_staff or submission.user == user or user.is_reviewer:
has_access = True
elif user.is_partner and submission.partners.filter(pk=user.pk).exists():
... | def is_user_has_access_to_view_submission(user, submission):
has_access = False
if not user.is_authenticated:
pass
elif user.is_apply_staff or submission.user == user or user.is_reviewer:
has_access = True
elif user.is_partner and submission.partners.filter(pk=user.pk).exists():
... |
# https://adventofcode.com/2015/day/2
# part 1
def calculate_size(input):
dims = list(map(int, input.split('x')))
dims.sort()
return 3 * dims[0] * dims[1] + 2 * (dims[1] * dims[2] + dims[2] * dims[0])
assert calculate_size('2x3x4') == 58
assert calculate_size('1x1x10') == 43
total = 0
for line in open("20... | def calculate_size(input):
dims = list(map(int, input.split('x')))
dims.sort()
return 3 * dims[0] * dims[1] + 2 * (dims[1] * dims[2] + dims[2] * dims[0])
assert calculate_size('2x3x4') == 58
assert calculate_size('1x1x10') == 43
total = 0
for line in open('201502_input.txt'):
total += calculate_size(lin... |
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Silvio Peroni <essepuntato@gmail.com>
#
# Permission to use, copy, modify, and/or distribute this software for any purpose
# with or without fee is hereby granted, provided that the above copyright notice
# and this permission notice appear in all copies.
#
# THE SOFTWARE I... | def r(gn, fn):
g = ''
f = None
fl = list()
for c in fn:
fl.append(c)
if len(fn) <= 1:
return fn + gn
else:
for c in reversed(gn):
if c >= fn[0]:
g += c
else:
f = fn[1]
g += f
if f:
... |
"""Helper to deal with common tasks"""
def stringify(obj):
"""Helper method which converts any given object into a string."""
if isinstance(obj, list):
return ''.join(obj)
else:
return str(obj)
| """Helper to deal with common tasks"""
def stringify(obj):
"""Helper method which converts any given object into a string."""
if isinstance(obj, list):
return ''.join(obj)
else:
return str(obj) |
'''
Sometimes, the story describing our probability distribution does not have a named distribution to go along with it. In these cases, fear not! You can always simulate it. We'll do that in this and the next exercise.
In earlier exercises, we looked at the rare event of no-hitters in Major League Baseball. Hitting t... | """
Sometimes, the story describing our probability distribution does not have a named distribution to go along with it. In these cases, fear not! You can always simulate it. We'll do that in this and the next exercise.
In earlier exercises, we looked at the rare event of no-hitters in Major League Baseball. Hitting t... |
# Copyright 2015 Hewlett-Packard Development Company, L.P.
# 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 req... | module = 'RIS'
http_boot_url = {'UefiShellStartupUrl': 'http://10.10.1.30:8081/startup.nsh'}
response_body_for_rest_op = '\n{\n "AssetTag": "",\n "AvailableActions": [\n {\n "Action": "Reset",\n "Capabilities": [\n {\n "AllowableValues": [\n ... |
class Solution:
def isValidPalindrome(self, s: str, k: int) -> bool:
dp = [[0] * len(s) for _ in range(len(s))]
for j in range(len(dp)):
dp[j][j] = 1
for i in range(j - 1, -1, -1):
if s[i] == s[j]:
dp[i][j] = 2 + dp[i + 1][j - 1]
... | class Solution:
def is_valid_palindrome(self, s: str, k: int) -> bool:
dp = [[0] * len(s) for _ in range(len(s))]
for j in range(len(dp)):
dp[j][j] = 1
for i in range(j - 1, -1, -1):
if s[i] == s[j]:
dp[i][j] = 2 + dp[i + 1][j - 1]
... |
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
def get_data():
return {
"fieldname": "release",
"transactions": [{"label": "GitHub", "items": ["Pull Request"]},],
}
| def get_data():
return {'fieldname': 'release', 'transactions': [{'label': 'GitHub', 'items': ['Pull Request']}]} |
__author__ = 'brighamhausman'
"""promotes display and commentary of data use it to work with html or pdf rendering libraries, perhaps...
__section -- one unit of a report containing one visual and commentary
title - string used for a header for the section
media - some kind of display besides text
... | __author__ = 'brighamhausman'
'promotes display and commentary of data use it to work with html or pdf rendering libraries, perhaps...\n __section -- one unit of a report containing one visual and commentary\n title - string used for a header for the section\n media - some kind of display besides text\... |
def splitter(filename):
with open(filename) as f:
return f.read().splitlines()
# in list.txt file seperate package name on next line to generate string and make sure that there is no adb command written in file. Also check for any additional quotes in the string.
# Author : Manmeet Singh
# url: https://www.g... | def splitter(filename):
with open(filename) as f:
return f.read().splitlines()
filename = 'list.txt'
usr_input = input('Enter 1 for install, 2 for Uninstall list and 3 for existing package install: ')
if usrInput == '1':
for ele in splitter(filename):
print('adb install "apk/%s.apk" > CON' % ele... |
class BundleDSSError(Exception):
"""There was a failure in bundle creation in DSS."""
class BundleFileUploadError(Exception):
"""There was a failure in bundle file upload."""
class FileDSSError(Exception):
"""There was a failure in file creation in DSS."""
class InvalidBundleError(Exception):
"""T... | class Bundledsserror(Exception):
"""There was a failure in bundle creation in DSS."""
class Bundlefileuploaderror(Exception):
"""There was a failure in bundle file upload."""
class Filedsserror(Exception):
"""There was a failure in file creation in DSS."""
class Invalidbundleerror(Exception):
"""Ther... |
__author__ = 'J. Michael Caine'
__copyright__ = '2020'
__version__ = '0.1'
__license__ = 'MIT'
re_alphanum = '^[\w\d- ]+$'
re_username = '^[\w\d_]+$'
#re_password = '(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$)'
re_email = '(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$)'
re_slug = '^[\w\d-_]+$'
| __author__ = 'J. Michael Caine'
__copyright__ = '2020'
__version__ = '0.1'
__license__ = 'MIT'
re_alphanum = '^[\\w\\d- ]+$'
re_username = '^[\\w\\d_]+$'
re_email = '(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\\.[a-zA-Z0-9-.]+$)'
re_slug = '^[\\w\\d-_]+$' |
def calculate_I_pos(pos_a, pos_b, pos_c, pos_d):
return (
(pos_a[0] + pos_b[0] + pos_c[0] + pos_d[0])/4,
(pos_a[1] + pos_b[1] + pos_c[1] + pos_d[1])/4)
def calculate_avg(pos_a, pos_b):
return (pos_a[0] + pos_b[0]) / 2, (pos_a[1] + pos_b[1]) / 2
| def calculate_i_pos(pos_a, pos_b, pos_c, pos_d):
return ((pos_a[0] + pos_b[0] + pos_c[0] + pos_d[0]) / 4, (pos_a[1] + pos_b[1] + pos_c[1] + pos_d[1]) / 4)
def calculate_avg(pos_a, pos_b):
return ((pos_a[0] + pos_b[0]) / 2, (pos_a[1] + pos_b[1]) / 2) |
def equizip(*xs):
xs = list(map(list, xs))
assert all(len(x) == len(xs[0]) for x in xs)
return zip(*xs)
def argany(xs):
for x in xs:
if x:
return x
| def equizip(*xs):
xs = list(map(list, xs))
assert all((len(x) == len(xs[0]) for x in xs))
return zip(*xs)
def argany(xs):
for x in xs:
if x:
return x |
class Solution:
def numberOfArithmeticSlices(self, A):
"""
:type A: List[int]
:rtype: int
"""
if len(A) < 3:
return 0
ans = 0
diff = A[0] - A[1]
count = 2
for i in range(1, len(A) - 1):
if A[i] - A[i+1] == diff:
... | class Solution:
def number_of_arithmetic_slices(self, A):
"""
:type A: List[int]
:rtype: int
"""
if len(A) < 3:
return 0
ans = 0
diff = A[0] - A[1]
count = 2
for i in range(1, len(A) - 1):
if A[i] - A[i + 1] == diff:
... |
#Write a program that allow user to enter classmate (name, Birthday, Email), validate if enter values are valid format (limit length apply), else ask user to enter again per field
def getinput():
while True:
name = input("Please input student name\n")
if len(name)<=12:
break
el... | def getinput():
while True:
name = input('Please input student name\n')
if len(name) <= 12:
break
else:
print('Name can only contain a maximum of 12 characters')
continue
while True:
birth = input('Please input student birthday mm/dd/yy \n')
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.