content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
i=input()
if "0000000" in i:
print("YES")
else:
print("NO") | i = input()
if '0000000' in i:
print('YES')
else:
print('NO') |
def for_Reverse_Left_faced_Right_Angled_Triangle():
""" pattern for : Reverse_Left_faced_Right_Angled_Triangle"""
for i in range(5):
for j in range(5):
if i<=j:
print('*',end=' ')
else:
print(' ',end=' ')
print()
def while_Reverse_... | def for__reverse__left_faced__right__angled__triangle():
""" pattern for : Reverse_Left_faced_Right_Angled_Triangle"""
for i in range(5):
for j in range(5):
if i <= j:
print('*', end=' ')
else:
print(' ', end=' ')
print()
def while__revers... |
nfolds = 4
random_seed = 0
classifier_head_str = 'RandomForestClassifierHead(n_estimators=500, n_jobs=-1)'
feature_extractor_str = 'TFIDFFeatureExtractor(max_features=1000)'
work_dir = 'artifacts/base' | nfolds = 4
random_seed = 0
classifier_head_str = 'RandomForestClassifierHead(n_estimators=500, n_jobs=-1)'
feature_extractor_str = 'TFIDFFeatureExtractor(max_features=1000)'
work_dir = 'artifacts/base' |
# -*- coding: utf-8 -*-
"""
.. module:: composite.fields
:synopsis: Fields
.. moduleauthor:: NickolasFox <tarvitz@blacklibrary.ru>
.. sectionauthor:: NickolasFox <tarvitz@blacklibrary.ru>
"""
class BaseField(object):
"""
Base Field abstract class
"""
__slots__ = ['name', 'type', 'default']
de... | """
.. module:: composite.fields
:synopsis: Fields
.. moduleauthor:: NickolasFox <tarvitz@blacklibrary.ru>
.. sectionauthor:: NickolasFox <tarvitz@blacklibrary.ru>
"""
class Basefield(object):
"""
Base Field abstract class
"""
__slots__ = ['name', 'type', 'default']
def __init__(self, name, ty... |
LANDSCAPE = 'landscape'
PORTRAIT = 'portrait'
SQUARE = 'square'
PAD = 'pad'
CROP = 'crop'
RESIZE = 'resize'
| landscape = 'landscape'
portrait = 'portrait'
square = 'square'
pad = 'pad'
crop = 'crop'
resize = 'resize' |
def parse_rooms_from_db(data):
rooms = list()
for i in data:
tmp = i[4]
if tmp == None:
tmp = 0
rooms.append(Room(i[0], i[1], i[2], i[3], tmp, i[5]))
return rooms
class Room():
def __init__(self, id, name, desc, master, signed, lim_in_room):
self.id =... | def parse_rooms_from_db(data):
rooms = list()
for i in data:
tmp = i[4]
if tmp == None:
tmp = 0
rooms.append(room(i[0], i[1], i[2], i[3], tmp, i[5]))
return rooms
class Room:
def __init__(self, id, name, desc, master, signed, lim_in_room):
self.id = id
... |
#!env/bin/python
"""Port of mailcheck.js
https://github.com/mailcheck/pymailcheck/
"""
DOMAIN_THRESHOLD = 2
SECOND_LEVEL_THRESHOLD = 2
TOP_LEVEL_THRESHOLD = 2
DOMAINS = frozenset([
"aim.com",
"aol.com",
"att.net",
"bellsouth.net",
"btinternet.com",
"charter.net",
"comcast.net",
"cox.ne... | """Port of mailcheck.js
https://github.com/mailcheck/pymailcheck/
"""
domain_threshold = 2
second_level_threshold = 2
top_level_threshold = 2
domains = frozenset(['aim.com', 'aol.com', 'att.net', 'bellsouth.net', 'btinternet.com', 'charter.net', 'comcast.net', 'cox.net', 'earthlink.net', 'gmail.com', 'google.com', 'go... |
class Order:
def __init__(self, order_number, customer_id, lp_number, category, pickup_date, return_date, price, insurance, actual_return_date):
self.__order_number = order_number
self.__customer_id = customer_id
self.__lp_number = lp_number
self.__category = category
se... | class Order:
def __init__(self, order_number, customer_id, lp_number, category, pickup_date, return_date, price, insurance, actual_return_date):
self.__order_number = order_number
self.__customer_id = customer_id
self.__lp_number = lp_number
self.__category = category
self._... |
S=int(input('Enter the Size: '))
TSUM=int(input('Enter Target Sum: '))
a=[]
for i in range(S):
a.append(int(input('Enter the array ElementS: ')))
def Quadruple(a,TSUM):
a.sort()
for i in range(S-3):
for j in range(i+1,S-2):
k=TSUM-(a[i]+a[j])
l=j+1
h=S-1
... | s = int(input('Enter the Size: '))
tsum = int(input('Enter Target Sum: '))
a = []
for i in range(S):
a.append(int(input('Enter the array ElementS: ')))
def quadruple(a, TSUM):
a.sort()
for i in range(S - 3):
for j in range(i + 1, S - 2):
k = TSUM - (a[i] + a[j])
l = j + 1
... |
#!/usr/bin/env python3
"""
:author Wang Weiwei <email>weiwei02@vip.qq.com / weiwei.wang@100credit.com</email>
:sine 2017/8/11
:version 1.0
""" | """
:author Wang Weiwei <email>weiwei02@vip.qq.com / weiwei.wang@100credit.com</email>
:sine 2017/8/11
:version 1.0
""" |
# Autogenerated by devscripts/update-version.py
__version__ = '2022.02.03'
RELEASE_GIT_HEAD = '28469edd7'
| __version__ = '2022.02.03'
release_git_head = '28469edd7' |
class Settings:
def __init__(self, public_key, private_key, mode):
self.api_key = public_key
self.secret_key = private_key
if mode == "test":
self.url = "https://bz-sandbox.opay-test.net/api/"
else:
self.url = "https://operapay.com/api/"
self.access... | class Settings:
def __init__(self, public_key, private_key, mode):
self.api_key = public_key
self.secret_key = private_key
if mode == 'test':
self.url = 'https://bz-sandbox.opay-test.net/api/'
else:
self.url = 'https://operapay.com/api/'
self.access_c... |
{
"targets": [
{
"target_name": "pikchr",
"sources": ["pikchr.cc"],
'dependencies': ['libpikchr'],
'conditions': [
['OS=="linux"', {
'libraries': ["<(module_root_dir)/build/Release/pikchr.a"]
}],
['OS=="win"', {
'librari... | {'targets': [{'target_name': 'pikchr', 'sources': ['pikchr.cc'], 'dependencies': ['libpikchr'], 'conditions': [['OS=="linux"', {'libraries': ['<(module_root_dir)/build/Release/pikchr.a']}], ['OS=="win"', {'libraries': ['<(module_root_dir)\\build\\Release\\libpikchr.lib']}, {'libraries': ['<(module_root_dir)/build/Relea... |
'''
Utilities for the caps_options
(functions needed for defining caps-options easily)
Created on Jul 25, 2011
@author: shai
'''
# Key types for supporting caps lock behaviors
EIGHT_LEVEL = 'EIGHT_LEVEL'
SIX_LEVEL = 'SIX_LEVEL'
FOUR_LEVEL = 'FOUR_LEVEL_ALPHABETIC'
CAPS_KEY_TYPES = frozenset([EIGHT_LEVEL, SIX_LEVEL,... | """
Utilities for the caps_options
(functions needed for defining caps-options easily)
Created on Jul 25, 2011
@author: shai
"""
eight_level = 'EIGHT_LEVEL'
six_level = 'SIX_LEVEL'
four_level = 'FOUR_LEVEL_ALPHABETIC'
caps_key_types = frozenset([EIGHT_LEVEL, SIX_LEVEL, FOUR_LEVEL])
options = {}
def caps_option(name,... |
class GalleryAction():
def __init__(self, icon, name, tooltip=None):
self._icon = icon
self._name = name
self._tooltip = tooltip
@property
def tooltip(self):
return self._tooltip
@tooltip.setter
def tooltip(self, value):
self._tooltip = value
@property
... | class Galleryaction:
def __init__(self, icon, name, tooltip=None):
self._icon = icon
self._name = name
self._tooltip = tooltip
@property
def tooltip(self):
return self._tooltip
@tooltip.setter
def tooltip(self, value):
self._tooltip = value
@property
... |
'''
Exceptions from sqlstr
-------------------------
'''
class sqlstrException(Exception):
def __init__(self, message):
'''
Instanitates a custom sqlstrException
message -- string. Message describing the exception.
'''
Exception.__init__(self, message)
| """
Exceptions from sqlstr
-------------------------
"""
class Sqlstrexception(Exception):
def __init__(self, message):
"""
Instanitates a custom sqlstrException
message -- string. Message describing the exception.
"""
Exception.__init__(self, message) |
class Solution:
def minRefuelStops(self, target: int, startFuel: int, stations: List[List[int]]) -> int:
dp = [startFuel] + [0] * len(stations) # Initialize dp
for i, (loc, cap) in enumerate(stations): # Traversing the gas station
for t in range(i, -1, -1):
if dp[t] >=... | class Solution:
def min_refuel_stops(self, target: int, startFuel: int, stations: List[List[int]]) -> int:
dp = [startFuel] + [0] * len(stations)
for (i, (loc, cap)) in enumerate(stations):
for t in range(i, -1, -1):
if dp[t] >= loc:
dp[t + 1] = max(d... |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Run `{dnf,yum} makecache` on each of the specified snapshots.
This is meant to be run on an image right after `install_rpm_repo_snapsho... | """
Run `{dnf,yum} makecache` on each of the specified snapshots.
This is meant to be run on an image right after `install_rpm_repo_snapshot`.
For example, you should use this when defining a build appliance.
We cannot call `makecache` a part of building a standalone snapshot, because
a cache only makes sense in the ... |
# Copyright (c) 2013, 2014, 2015, 2016 Philip Hane
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of c... | hr_asn = {'asn': {'_short': 'ASN', '_name': 'Autonomous System Number', '_description': 'Globally unique identifier used for routing information exchange with Autonomous Systems.'}, 'asn_cidr': {'_short': 'ASN CIDR Block', '_name': 'ASN Classless Inter-Domain Routing Block', '_description': 'Network routing block assig... |
x = [1,2,3]
def func(x):
x[1] = 42 # this affects the caller !
x = "something else" # this points x to a new string object
func(x)
print(x)
| x = [1, 2, 3]
def func(x):
x[1] = 42
x = 'something else'
func(x)
print(x) |
f=open("./2020/data/08a.txt","r")
# f=open("./2020/data/test.txt","r")
instructions=[]
for line in f:
instructions.append(line)
index=0
accumulate=0
been_there=[0]
found=False
while(found==False):
line=instructions[index]
# print(index," ", line)
action=line[:3]
if action=="acc":
accumulate+... | f = open('./2020/data/08a.txt', 'r')
instructions = []
for line in f:
instructions.append(line)
index = 0
accumulate = 0
been_there = [0]
found = False
while found == False:
line = instructions[index]
action = line[:3]
if action == 'acc':
accumulate += int(line[4:])
index += 1
if act... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Python for AHDA.
Part 4, Example 3.
"""
# reduce redundant newlines
F_IN = 'Moore_106_trimmed.txt'
F_OUT = 'Moore_106_slimmed.txt'
with open(F_IN, 'r', encoding='utf-8', newline='\n') as f_in:
raw_text = f_in.read()
with open(F_OUT, 'w', encoding='utf-8', newli... | """Python for AHDA.
Part 4, Example 3.
"""
f_in = 'Moore_106_trimmed.txt'
f_out = 'Moore_106_slimmed.txt'
with open(F_IN, 'r', encoding='utf-8', newline='\n') as f_in:
raw_text = f_in.read()
with open(F_OUT, 'w', encoding='utf-8', newline='\n') as f_out:
f_out.write(raw_text.replace('\n\n', '\n')) |
def decimal_to_binary(number):
'''
YOU MUST USE A WHILE LOOP
Given a number return its binary value in 8 bits
:param number: A whole number from 0-255
:return: a byte (8 bits) binary
TO GET CREDIT, YOU MUST WRITE CODE FOR FOLLOWING PSEUDOCODE Algorithm
Create a binary variable set it to ''
... | def decimal_to_binary(number):
"""
YOU MUST USE A WHILE LOOP
Given a number return its binary value in 8 bits
:param number: A whole number from 0-255
:return: a byte (8 bits) binary
TO GET CREDIT, YOU MUST WRITE CODE FOR FOLLOWING PSEUDOCODE Algorithm
Create a binary variable set it to ''
... |
# -*- coding: utf-8 -*-
# Copyright (c) 2017 the Reggie team, see AUTHORS.
# Licensed under the BSD License, see LICENSE for details.
"""
Reggie
>>> print('Reggie')
Reggie
"""
# flake8: noqa
| """
Reggie
>>> print('Reggie')
Reggie
""" |
s = input()
l = list(s)
last = ' '
for i in range(len(l)):
if l[i].islower() and last == ' ':
l[i] = l[i].upper()
last = l[i]
print(''.join(l))
| s = input()
l = list(s)
last = ' '
for i in range(len(l)):
if l[i].islower() and last == ' ':
l[i] = l[i].upper()
last = l[i]
print(''.join(l)) |
# :Id: $Id$
# :Author: Guenter Milde.
# :License: Released under the terms of the `2-Clause BSD license`_, in short:
#
# Copying and distribution of this file, with or without modification,
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved.
# This fi... | """
This is the Docutils (Python Documentation Utilities) "math" sub-package.
It contains various modules for conversion between different math formats
(LaTeX, MathML, HTML).
:math2html: LaTeX math -> HTML conversion from eLyXer
:latex2mathml: LaTeX math -> presentational MathML
:unichar2tex: Unicode character to ... |
# Event: LCCS Python Fundamental Skills Workshop
# Date: Dec 2018
# Author: Joe English, PDST
# eMail: computerscience@pdst.ie
# Purpose: Dictionary Programming Exercises 7.1
# Q4 - solution
# A dictionary of the number of days in each month
days = {
"January" : 31,
"February" : 28, # ignore leaps!
... | days = {'January': 31, 'February': 28, 'March': 31, 'April': 30, 'May': 31, 'June': 30, 'July': 31, 'August': 31, 'September': 30, 'October': 31, 'November': 30, 'December': 31}
def days_in_month(month_name):
return days[month_name]
print('List of months: January, February, March, April, May, June, July, August, S... |
def extractTakeyourhearttranslation000WebhostappCom(item):
'''
Parser for 'takeyourhearttranslation.000webhostapp.com'
'''
# Is trying to force a garbage app shit thing.
return None | def extract_takeyourhearttranslation000_webhostapp_com(item):
"""
Parser for 'takeyourhearttranslation.000webhostapp.com'
"""
return None |
class ListTable(list):
"""
Overridden list class which takes a 2-dimensional list of
the form [[1,2,3],[4,5,6]], and renders an HTML Table in
IPython Notebook.
"""
def _repr_html_(self):
html = ["<table>"]
for row in self:
html.append("<tr>")
for col... | class Listtable(list):
"""
Overridden list class which takes a 2-dimensional list of
the form [[1,2,3],[4,5,6]], and renders an HTML Table in
IPython Notebook.
"""
def _repr_html_(self):
html = ['<table>']
for row in self:
html.append('<tr>')
for col ... |
class Node:
def __init__(self):
self.ends_word = False
self.children = dict()
def __repr__(self):
return str(self.children)
def __str__(self):
return str(self.children)
class WordDict:
def __init__(self):
self.root = None
def insert(self, word):
... | class Node:
def __init__(self):
self.ends_word = False
self.children = dict()
def __repr__(self):
return str(self.children)
def __str__(self):
return str(self.children)
class Worddict:
def __init__(self):
self.root = None
def insert(self, word):
... |
Scale.default = 'dorian'
Root.default = 0
Clock.bpm = 100
print(Scale.names())
print(SynthDefs)
print(FxList)
print(Samples)
print(PatternMethods)
print(Clock.playing)
var.ch = var([3,0,2,-1,1,0],[4,4,4,4,8,8])
~p1 >> play('V V ', amp=.8, dur=1, sample=3, formant=PWhite(.4,1.6), shape=PWhite(.2,.8), lpf=sinvar([... | Scale.default = 'dorian'
Root.default = 0
Clock.bpm = 100
print(Scale.names())
print(SynthDefs)
print(FxList)
print(Samples)
print(PatternMethods)
print(Clock.playing)
var.ch = var([3, 0, 2, -1, 1, 0], [4, 4, 4, 4, 8, 8])
~p1 >> play('V V ', amp=0.8, dur=1, sample=3, formant=p_white(0.4, 1.6), shape=p_white(0.2, 0.... |
class SelectedCellsChangedEventArgs(EventArgs):
"""
Provides data for the System.Windows.Controls.DataGrid.SelectedCellsChanged event.
SelectedCellsChangedEventArgs(addedCells: List[DataGridCellInfo],removedCells: List[DataGridCellInfo])
SelectedCellsChangedEventArgs(addedCells: ReadOnlyCollection[Data... | class Selectedcellschangedeventargs(EventArgs):
"""
Provides data for the System.Windows.Controls.DataGrid.SelectedCellsChanged event.
SelectedCellsChangedEventArgs(addedCells: List[DataGridCellInfo],removedCells: List[DataGridCellInfo])
SelectedCellsChangedEventArgs(addedCells: ReadOnlyCollection[DataGridC... |
class Node():
def __init__(self, value):
self.value = value
self.adjacent_list = []
self.visited = False
class Queue():
def __init__(self):
self.items = []
def __len__(self):
return len(self.items)
def enqueue(self, item):
self.items.append(item)
... | class Node:
def __init__(self, value):
self.value = value
self.adjacent_list = []
self.visited = False
class Queue:
def __init__(self):
self.items = []
def __len__(self):
return len(self.items)
def enqueue(self, item):
self.items.append(item)
def... |
"""Samjin Multi Quirk."""
# <SimpleDescriptor endpoint=1 profile=260 device_type=1026
# device_version=0
# input_clusters=[0, 1, 3, 32, 1026, 1280, 64514]
# output_clusters=[3, 25]>
| """Samjin Multi Quirk.""" |
class Trie(object):
def __init__(self, words=None):
"""
A recursive data type implementation of Trie tree.
Paramaters:
-----------
words : list(str)
Words that is going to be inserted into the trie.
Attributes:
----... | class Trie(object):
def __init__(self, words=None):
"""
A recursive data type implementation of Trie tree.
Paramaters:
-----------
words : list(str)
Words that is going to be inserted into the trie.
Attributes:
------... |
# Copyright 2021 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
def AssertHistogramStatsAlmostEqual(test_ctx, v2_hist, v3_hist, precision=1e-3):
"""Asserts major histogram statistics are close enough.
sum, mean, max,... | def assert_histogram_stats_almost_equal(test_ctx, v2_hist, v3_hist, precision=0.001):
"""Asserts major histogram statistics are close enough.
sum, mean, max, min are asserted to be within 3 decimal places.
count is asserted to be exactly equal."""
v2_running = v2_hist.running
v3_running = v3_hist.runni... |
'''
https://leetcode.com/problems/regular-expression-matching/
10. Regular Expression Matching
Hard
Given an input string (s) and a pattern (p), implement regular expression matching with support for '.' and '*'.
'.' Matches any single character.
'*' Matches zero or more of the preceding element.
The matchin... | """
https://leetcode.com/problems/regular-expression-matching/
10. Regular Expression Matching
Hard
Given an input string (s) and a pattern (p), implement regular expression matching with support for '.' and '*'.
'.' Matches any single character.
'*' Matches zero or more of the preceding element.
The matching should ... |
i = 0 #define an integer
while(i<119): #while i is less than 119, do the following
print(i) #print the current value of i
i+= 10 #add 10 to i
| i = 0
while i < 119:
print(i)
i += 10 |
# rotating triangles final
# after Roger Antonsen (University of Oslo)
# and Peter Farrell (Math Adventures with Python, p. 93ff.)
def setup():
size(600, 600)
color_mode(HSB, 100)
t = 0
def draw():
global t
background(255, 0, 100) # white
translate(width/2, height/2)
for i in range(90):
... | def setup():
size(600, 600)
color_mode(HSB, 100)
t = 0
def draw():
global t
background(255, 0, 100)
translate(width / 2, height / 2)
for i in range(90):
rotate(radians(360 / 90))
push_matrix()
translate(200, 0)
stroke(i % 360, 100, 80)
rotate(radians(t + ... |
#!/usr/bin/env python3
#https://codeforces.com/problemset/problem/777/B
n = int(input()) #1000
il = [int(c) for c in input()]
jl = [int(c) for c in input()]
il.sort()
jl.sort()
i = 0
j = 0
lc = 0
while j<n:
if jl[j]>=il[i]:
i += 1
else:
lc += 1
j += 1
print(lc) #min # of lose... | n = int(input())
il = [int(c) for c in input()]
jl = [int(c) for c in input()]
il.sort()
jl.sort()
i = 0
j = 0
lc = 0
while j < n:
if jl[j] >= il[i]:
i += 1
else:
lc += 1
j += 1
print(lc)
i = 0
j = 0
wc = 0
while j < n:
if jl[j] > il[i]:
i += 1
wc += 1
j += 1
print(wc... |
# https://py.checkio.org/en/mission/sum-numbers/
def sum_numbers(text: str) -> int:
sum_i = 0
for i in text.split(' '):
try:
sum_i += int(i)
except ValueError:
pass
return sum_i
if __name__ == '__main__':
print("Example:")
print(sum_numbers('hi'))
# Th... | def sum_numbers(text: str) -> int:
sum_i = 0
for i in text.split(' '):
try:
sum_i += int(i)
except ValueError:
pass
return sum_i
if __name__ == '__main__':
print('Example:')
print(sum_numbers('hi'))
assert sum_numbers('hi') == 0
assert sum_numbers('who... |
expected_output = {
"eigrp_instance": {
"100": {
"vrf": {
"default": {
"address_family": {
"ipv4": {
"name": "",
"named_mode": False,
"eigrp_interface":... | expected_output = {'eigrp_instance': {'100': {'vrf': {'default': {'address_family': {'ipv4': {'name': '', 'named_mode': False, 'eigrp_interface': {'Ethernet1/0': {'eigrp_nbr': {'10.1.2.1': {'hold': 11, 'last_seq_number': 6, 'nbr_sw_ver': {'os_majorver': 5, 'os_minorver': 1, 'tlv_majorrev': 3, 'tlv_minorrev': 0}, 'peer_... |
# -*- coding: utf-8 -*-
"""
@author: Chenglong Chen <c.chenglong@gmail.com>
@brief: utils for ngram
"""
def _unigrams(words):
"""
Input: a list of words, e.g., ["I", "am", "Denny"]
Output: a list of unigram
"""
assert type(words) == list
return words
def _bigrams(words, join_string,... | """
@author: Chenglong Chen <c.chenglong@gmail.com>
@brief: utils for ngram
"""
def _unigrams(words):
"""
Input: a list of words, e.g., ["I", "am", "Denny"]
Output: a list of unigram
"""
assert type(words) == list
return words
def _bigrams(words, join_string, skip=0):
"""
I... |
# Problem: Array Partition 1
# Difficulty: Easy
# Category: Array
# Leetcode 561: https://leetcode.com/problems/array-partition-i/
# Description:
"""
Given an array of 2n integers, your task is to group these integers into n pairs of integer,
say (a1, b1), (a2, b2), ..., (an, bn) which makes sum of min(ai, bi) for all ... | """
Given an array of 2n integers, your task is to group these integers into n pairs of integer,
say (a1, b1), (a2, b2), ..., (an, bn) which makes sum of min(ai, bi) for all i from 1 to n as large as possible.
Example 1:
Input: [1,4,3,2]
Output: 4
Explanation: n is 2, and the maximum sum of pairs is 4 = min(1, 2) + m... |
'''
Used in Cube's turn_rotate method to use the correct indices of the cube when
applying a turn or rotation.
'''
PARAM_DICT = {
# Clockwise turns
'cw': {
'u': [1, 1, -1, 2, 1, 1, 1, 0], 'd': [1, -1, 1, 2, 1, 1, -1, 0],
'r': [0, 1, 1, 0, 1, 2, -1, 1], 'l': [0, -1, 1, 0, -1, 2, 1, 1],
... | """
Used in Cube's turn_rotate method to use the correct indices of the cube when
applying a turn or rotation.
"""
param_dict = {'cw': {'u': [1, 1, -1, 2, 1, 1, 1, 0], 'd': [1, -1, 1, 2, 1, 1, -1, 0], 'r': [0, 1, 1, 0, 1, 2, -1, 1], 'l': [0, -1, 1, 0, -1, 2, 1, 1], 'f': [2, 1, 1, 1, -1, 0, 1, 2], 'b': [2, -1, -1, 1, 1,... |
class Solution(object):
def findMin(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
start, end, mid = 0, len(nums) - 1, 0
while start + 1 < end:
mid = start + (end - start) / 2
if nums[start] <= nums[mid]:
start... | class Solution(object):
def find_min(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
(start, end, mid) = (0, len(nums) - 1, 0)
while start + 1 < end:
mid = start + (end - start) / 2
if nums[start] <= nums[mid]:
start = m... |
class Solution(object):
def groupThePeople(self, groupSizes):
"""
:type groupSizes: List[int]
:rtype: List[List[int]]
"""
n = len(groupSizes)
unique = set(groupSizes)
target = []
index = 0
group_switch = {}
for i in unique:
... | class Solution(object):
def group_the_people(self, groupSizes):
"""
:type groupSizes: List[int]
:rtype: List[List[int]]
"""
n = len(groupSizes)
unique = set(groupSizes)
target = []
index = 0
group_switch = {}
for i in unique:
... |
# Copyright (C) 2016 NooBaa
{
'includes': ['common_third_party.gypi'],
'targets': [
{
'target_name': 'isa-l-crc',
'type': 'static_library',
'includes': ['../asm.gypi'],
'include_dirs': [
'isa-l/include/',
'isa-l/crc/',
... | {'includes': ['common_third_party.gypi'], 'targets': [{'target_name': 'isa-l-crc', 'type': 'static_library', 'includes': ['../asm.gypi'], 'include_dirs': ['isa-l/include/', 'isa-l/crc/'], 'sources': ['isa-l/crc/crc_base.c', 'isa-l/crc/crc64_base.c', 'isa-l/crc/crc16_t10dif_01.asm', 'isa-l/crc/crc16_t10dif_by4.asm', 'is... |
# Email parameters
orig = "noreply@yourdomain.com"
dest = "email1@yourdomain.com,email2@yourdomain.com"
mx = "mx.yourdomain.com"
# Reporting parameters
ReportPeriod = 60 #days
tbd = "(TBD)"
# Asset Inventory
assetList = ["AIX", "Adobe", "AirDefense", "Apache", "Aruba", "Avaya", "Blackberry", "Blue C... | orig = 'noreply@yourdomain.com'
dest = 'email1@yourdomain.com,email2@yourdomain.com'
mx = 'mx.yourdomain.com'
report_period = 60
tbd = '(TBD)'
asset_list = ['AIX', 'Adobe', 'AirDefense', 'Apache', 'Aruba', 'Avaya', 'Blackberry', 'Blue Coat', 'Checkpoint', 'Cisco', 'Citrix', 'Clam', 'F5', 'FileZilla', 'Fortinet', 'HP', ... |
# Copyright 2017 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | """Rules to create RPM archives."""
load('//tools/config:common_settings.bzl', 'BuildSettingInfo')
rpm_filetype = ['.rpm']
spec_filetype = ['.spec']
def _pkg_rpm_impl(ctx):
"""Implements to pkg_rpm rule."""
if ctx.attr._no_build_defs_pkg_flag[BuildSettingInfo].value:
fail('The built-in version of pkg_r... |
a=int(input('Enter the number'))
b=str(a)
c=int(b[::-1])
if a==c:
print('Palindrome')
else:
print('Not palindrome')
| a = int(input('Enter the number'))
b = str(a)
c = int(b[::-1])
if a == c:
print('Palindrome')
else:
print('Not palindrome') |
def normalize_name(s):
return s.replace('-', '_')
class Name:
def __init__(self, internal, external=None):
self._internal = internal
self._external = external if external else normalize_name(internal)
@property
def internal(self):
return self._internal
@property
def e... | def normalize_name(s):
return s.replace('-', '_')
class Name:
def __init__(self, internal, external=None):
self._internal = internal
self._external = external if external else normalize_name(internal)
@property
def internal(self):
return self._internal
@property
def e... |
def slider_event_cb(evt):
slider = evt.get_target()
# Refresh the text
label.set_text(str(slider.get_value()))
#
# Create a slider and write its value on a label.
#
# Create a slider in the center of the display
slider = lv.slider(lv.scr_act())
slider.set_width(200) ... | def slider_event_cb(evt):
slider = evt.get_target()
label.set_text(str(slider.get_value()))
slider = lv.slider(lv.scr_act())
slider.set_width(200)
slider.center()
slider.add_event_cb(slider_event_cb, lv.EVENT.VALUE_CHANGED, None)
label = lv.label(lv.scr_act())
label.set_text('0')
label.align_to(slider, lv.ALIGN... |
"""Constants for the Canary integration."""
DOMAIN = "canary"
MANUFACTURER = "Canary Connect, Inc"
# Configuration
CONF_FFMPEG_ARGUMENTS = "ffmpeg_arguments"
# Data
DATA_CANARY = "canary"
DATA_UNDO_UPDATE_LISTENER = "undo_update_listener"
# Defaults
DEFAULT_FFMPEG_ARGUMENTS = "-pred 1"
DEFAULT_TIMEOUT = 10
| """Constants for the Canary integration."""
domain = 'canary'
manufacturer = 'Canary Connect, Inc'
conf_ffmpeg_arguments = 'ffmpeg_arguments'
data_canary = 'canary'
data_undo_update_listener = 'undo_update_listener'
default_ffmpeg_arguments = '-pred 1'
default_timeout = 10 |
gifts = input().split()
gifts_after = []
command = input()
while not command == "No Money":
order = command.split()
if order[0] == "OutOfStock":
for el in gifts:
if order[1] == el:
index = gifts.index(el)
gifts[index] = "None"
elif order[0] == "Required":... | gifts = input().split()
gifts_after = []
command = input()
while not command == 'No Money':
order = command.split()
if order[0] == 'OutOfStock':
for el in gifts:
if order[1] == el:
index = gifts.index(el)
gifts[index] = 'None'
elif order[0] == 'Required':
... |
def my_sum(x, y):
return x + y
def my_sub(x, y):
return x - y
def my_mul(x, y):
return x * y
def my_div(x, y):
return x / y
calc = {
'sum': my_sum,
'sub': my_sub,
'mul': my_mul,
'div': my_div
}
print(calc['sum'](10, 10))
print(calc['sub'](10, 10))
print(calc['mul'](10, 10))
pri... | def my_sum(x, y):
return x + y
def my_sub(x, y):
return x - y
def my_mul(x, y):
return x * y
def my_div(x, y):
return x / y
calc = {'sum': my_sum, 'sub': my_sub, 'mul': my_mul, 'div': my_div}
print(calc['sum'](10, 10))
print(calc['sub'](10, 10))
print(calc['mul'](10, 10))
print(calc['div'](10, 10)) |
# colorize me!
cln = '\033[m' # cor 'limpa'
cor = {
'vermelho': '\033[31m',
'verde': '\033[32m',
'amarelo': '\033[33m',
'azul': '\033[34m',
'magenta': '\033[35m',
'ciano': '\033[36m',
'cinza': '\033[37m',
'branco_vermelho': '\033[30;41m',
'branco_verde': '\033[30;42m',
'branco_... | cln = '\x1b[m'
cor = {'vermelho': '\x1b[31m', 'verde': '\x1b[32m', 'amarelo': '\x1b[33m', 'azul': '\x1b[34m', 'magenta': '\x1b[35m', 'ciano': '\x1b[36m', 'cinza': '\x1b[37m', 'branco_vermelho': '\x1b[30;41m', 'branco_verde': '\x1b[30;42m', 'branco_amarelo': '\x1b[30;43m', 'branco_azul': '\x1b[30;44m', 'branco_magenta':... |
"""
Routines to find the boundary of a set of nodes.
Edge boundaries are edges that have only one end
in the set of nodes.
Node boundaries are nodes outside the set of nodes
that have an edge to a node in the set.
"""
__author__ = """Aric Hagberg (hagberg@lanl.gov)\nPieter Swart (swart@lanl.gov)\nDan Schult (dschult... | """
Routines to find the boundary of a set of nodes.
Edge boundaries are edges that have only one end
in the set of nodes.
Node boundaries are nodes outside the set of nodes
that have an edge to a node in the set.
"""
__author__ = 'Aric Hagberg (hagberg@lanl.gov)\nPieter Swart (swart@lanl.gov)\nDan Schult (dschult@c... |
# para especificar el tipo a string
x = str(54)
print("x: ",x)
# para especificar el tipo a number del tipo int
y = int(3.56)
print("y: ",y)
z = int("3")
print("z: ",z)
# para especificar el tipo a number del tipo floar
r = float(567)
print("r: ",r)
w = float("3.56")
print("w: ",w)
# para obtener el tipo
print("x: "... | x = str(54)
print('x: ', x)
y = int(3.56)
print('y: ', y)
z = int('3')
print('z: ', z)
r = float(567)
print('r: ', r)
w = float('3.56')
print('w: ', w)
print('x: ', type(x))
print('y: ', type(y))
print('z: ', type(z))
print('w: ', type(w))
print('r: ', type(r)) |
effects = {
# instruction name -> [bytes, newva, contraints, effects]
'rdtsc': ('0f31', None, (),
('edx = TSC_HIGH',
'eax = TSC_LOW')),
'div16': ('66f7f2', None, (),
('eax = (((((edx & 0x0000ffff) << 16) | (eax & 0x0000ffff)) / (edx & 0x0000ffff)) | (eax & 0xffff00... | effects = {'rdtsc': ('0f31', None, (), ('edx = TSC_HIGH', 'eax = TSC_LOW')), 'div16': ('66f7f2', None, (), ('eax = (((((edx & 0x0000ffff) << 16) | (eax & 0x0000ffff)) / (edx & 0x0000ffff)) | (eax & 0xffff0000))', 'edx = (((((edx & 0x0000ffff) << 16) | (eax & 0x0000ffff)) % (edx & 0x0000ffff)) | (edx & 0xffff0000))')), ... |
'''
Given a linked list, remove the n-th node from the end of list and return its head.
Example:
Given linked list: 1->2->3->4->5, and n = 2.
After removing the second node from the end, the linked list becomes 1->2->3->5.
'''
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(se... | """
Given a linked list, remove the n-th node from the end of list and return its head.
Example:
Given linked list: 1->2->3->4->5, and n = 2.
After removing the second node from the end, the linked list becomes 1->2->3->5.
"""
class Solution(object):
def remove_nth_from_end(self, head, n):
"""
... |
def get_solver_definition(hyper_params):
# Define optimizer
optimizer = dict(
type='Adam',
lr=hyper_params["lr"],
betas=(0.9, 0.999),
weight_decay=hyper_params["weight_decay"],
)
# Define lr scheduler
lr_scheduler = dict(
type='CosineAnnealingLR',
T_ma... | def get_solver_definition(hyper_params):
optimizer = dict(type='Adam', lr=hyper_params['lr'], betas=(0.9, 0.999), weight_decay=hyper_params['weight_decay'])
lr_scheduler = dict(type='CosineAnnealingLR', T_max=hyper_params['max_epochs'], eta_min=0)
hooks = [dict(type='BackwardHook'), dict(type='LogHook', log... |
favorite_numbers = {
'Abe': ['6', '66', '6666'],
'Boswell': ['4', '44', '4444'],
'Francisco': ['7', '77', '7777'],
'Jane': ['3', '33', '3333'],
'Cecelia': ['0', '00', '0000'],
}
for person, numbers in favorite_numbers.items():
print("\n" + person.title() + "'s favorite numbers are:")
for nu... | favorite_numbers = {'Abe': ['6', '66', '6666'], 'Boswell': ['4', '44', '4444'], 'Francisco': ['7', '77', '7777'], 'Jane': ['3', '33', '3333'], 'Cecelia': ['0', '00', '0000']}
for (person, numbers) in favorite_numbers.items():
print('\n' + person.title() + "'s favorite numbers are:")
for number in numbers:
... |
start = int(input('Type a number for start: '))
reason = int(input('Reason: '))
final = start + (10 - 1) * reason
for c in range(start, final+reason, reason):
print(c)
| start = int(input('Type a number for start: '))
reason = int(input('Reason: '))
final = start + (10 - 1) * reason
for c in range(start, final + reason, reason):
print(c) |
# -*- coding:utf-8 -*-
class Parameters(object):
# Adversarial
RANDOM_SEED = 88
START_TOKEN = 0
BATCH_SIZE = 64
VOCAB_SIZE = 5000
# VOCAB_SIZE = 4492
# VOCAB_SIZE = 10000
GENERATED_NUM = 10000
ATTENTION_PRE_TRAIN_EPOCH = 300
K = 3
TOTAL_BATCHES = 120
N_GRAM = 2
ATT_LEARNING_RATE = 0.004
MONTE_CARLO_TUR... | class Parameters(object):
random_seed = 88
start_token = 0
batch_size = 64
vocab_size = 5000
generated_num = 10000
attention_pre_train_epoch = 300
k = 3
total_batches = 120
n_gram = 2
att_learning_rate = 0.004
monte_carlo_turns = 16
adversarial_dropout = 0.75
decay_st... |
n = int(input('please enter an integer between 1 and 9999: '))
tostring = str(n)
one_number = ["one", "two", "three", "four", "five", "six", "seven", "eight",
"nine", "ten", "eleven", "twelve", "thirteen", "fourteen",
"fifteen", "sixteen", "seventeen", "eighteen", "nineteen"]
two_numbers =... | n = int(input('please enter an integer between 1 and 9999: '))
tostring = str(n)
one_number = ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen']
two_numbers = ['twenty', 'thirty', 'forty',... |
# 818. Race Car
# ttungl@gmail.com
# Your car starts at position 0 and speed +1 on an infinite number line. (Your car can go into negative positions.)
# Your car drives automatically according to a sequence of instructions A (accelerate) and R (reverse).
# When you get an instruction "A", your car does the following... | class Solution(object):
def racecar(self, target):
"""
:type target: int
:rtype: int
"""
if target == 0:
return 0
queue = [(0, 1)]
(visited, cnt) = (set((0, 1)), 0)
while queue:
new_queue = []
cnt += 1
f... |
#!/usr/bin/env python
# class User defaults
IS_ADMIN = False
THEME_INDEX = 0
THEME_CHOICES = [
('0', 'default'),
# ('1', 'dark'),
# ('2', 'warm'),
]
RESULTS_PER_PAGE = 25
RECENT_DAYS = 30
# class Annotation defaults
ORIGIN = "user"
SOURCE_PREFIX = "SRC-"
SOURCE_NONE = {
"ID": "SRC-NONE",
"NAME": "... | is_admin = False
theme_index = 0
theme_choices = [('0', 'default')]
results_per_page = 25
recent_days = 30
origin = 'user'
source_prefix = 'SRC-'
source_none = {'ID': 'SRC-NONE', 'NAME': 'no source'}
author_prefix = 'AUT-'
author_none = {'ID': 'AUT-NONE', 'NAME': 'no author'} |
locations={'AZ': 'Arizona',
'CA': 'California',
'ID': 'Idaho',
'IN': 'Indiana',
'MA': 'Massachusetts',
'OK': 'Oklahoma',
'PA': 'Pennsylvania',
'VA': 'Virginia'}
def by_state(str):
dict={}
res=""
for i in str.split("\n"):
temp=i.replace(",","").split()
if not temp:
continue
... | locations = {'AZ': 'Arizona', 'CA': 'California', 'ID': 'Idaho', 'IN': 'Indiana', 'MA': 'Massachusetts', 'OK': 'Oklahoma', 'PA': 'Pennsylvania', 'VA': 'Virginia'}
def by_state(str):
dict = {}
res = ''
for i in str.split('\n'):
temp = i.replace(',', '').split()
if not temp:
conti... |
# Dictionary is a collection which is unordered, changeable and indexed. No duplicate members.
person = {
"name": "Yves",
"age": 26,
"gender": "male"
}
def displayValues(user):
for x in user:
print(f"{x}: {user[x]}")
def displayBoth(user):
for x,y in user.items():
print(x, y)
def does... | person = {'name': 'Yves', 'age': 26, 'gender': 'male'}
def display_values(user):
for x in user:
print(f'{x}: {user[x]}')
def display_both(user):
for (x, y) in user.items():
print(x, y)
def does_key_exists(keyName, user):
if keyName in user:
print('True')
def add_new_key(keyName, ... |
# 1-T otam (onam, akam, ukam, va hokazo) degan lug'at yarating va lug'atga shu inson haqida
# kamida 3 ta m'alumot kiriting (ismi, tu'gilgan yili, shahri, manzili va hokazo).
# Lug'atdagi ma'lumotni matn shaklida konsolga chiqaring :
# onam = {
# 'ism':'Gullbahor',
# 'tyil':1968,
# 'tjoy':'Oltnsoy tumani,... | atamalar = {'integer': 'Butun son', 'float': "O'nli kasr son", 'string': 'Matnlarni ifodalayi', 'if': 'Agar deb tarjima qillinadi.Shart operatori', 'else': 'Aks holda.', 'print': 'Chop qluvchi funksiya', 'input': 'Qabul qiluvchi funksiya.', 'for': 'tsikl loop', 'while': 'sikl operatori'}
n = input("Kalit so'zni kiritin... |
class ImageBackgroundSettings(BackgroundSettings,IDisposable):
""" Represents the rendering image background settings. """
def Dispose(self):
""" Dispose(self: BackgroundSettings,A_0: bool) """
pass
def ReleaseUnmanagedResources(self,*args):
""" ReleaseUnmanagedResources(self: BackgroundSettings,disposin... | class Imagebackgroundsettings(BackgroundSettings, IDisposable):
""" Represents the rendering image background settings. """
def dispose(self):
""" Dispose(self: BackgroundSettings,A_0: bool) """
pass
def release_unmanaged_resources(self, *args):
""" ReleaseUnmanagedResources(self: ... |
# Copyright (C) 2017 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""Constants for counters."""
PAGINATION_CTRLS_COUNT = 2
| """Constants for counters."""
pagination_ctrls_count = 2 |
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 3 11:40:50 2022
@author: Alexander
"""
def printHistogramm(imagePath):
image = Image.open(imagePath)
#Image Info
print(image.size)
print(image.info)
width = image.width
height = image.height
imageArray = np.asarray(image)
histogramAr... | """
Created on Mon Jan 3 11:40:50 2022
@author: Alexander
"""
def print_histogramm(imagePath):
image = Image.open(imagePath)
print(image.size)
print(image.info)
width = image.width
height = image.height
image_array = np.asarray(image)
histogram_array = []
for i in range(height):
... |
'''
This metadata identifies the folders to be zipped and uploaded to SDC for model distribution for a given VNF
'''
GLOBAL_SERVICE_FOLDER_MAPPING = {"AzurevFW" : ['AzurevFW/vSNK', 'AzurevFW/vPKG'], \
"vFW" : ['vFW'], \
"AzurevDNS" : ['AzurevDNS'], \
... | """
This metadata identifies the folders to be zipped and uploaded to SDC for model distribution for a given VNF
"""
global_service_folder_mapping = {'AzurevFW': ['AzurevFW/vSNK', 'AzurevFW/vPKG'], 'vFW': ['vFW'], 'AzurevDNS': ['AzurevDNS'], 'vLB': ['vLB'], 'vVG': ['vVG'], 'vCPE': ['vCPE/infra', 'vCPE/vbng', 'vCPE/vbrg... |
"""
Deletion of Node
------------------------
"""
class Node:
def __init__(self, data):
self.data = data
self.left = None
self.right = None
self.parent = None
class BSTree:
def __init__(self):
self.root = None
def get_Root(self):
return self.root.data
def insert(self, data):
if self.root is ... | """
Deletion of Node
------------------------
"""
class Node:
def __init__(self, data):
self.data = data
self.left = None
self.right = None
self.parent = None
class Bstree:
def __init__(self):
self.root = None
def get__root(self):
return self.root.data... |
message = {}
message['About'] = \
'''
Touchable 2020.06
Version 1.0.0
Copyright 2020-1 DS
Contact : https://github.com/PositivePeriod/Touchable
'''
message['Help'] = \
'''
Make Pen
c : choose / space : decide
Detection
space : cut drawing / z : undo / e : erase
r : rectangle / c : circle / p : polygon
l : line ... | message = {}
message['About'] = '\n Touchable 2020.06\n Version 1.0.0\n Copyright 2020-1 DS \n Contact : https://github.com/PositivePeriod/Touchable\n'
message['Help'] = '\nMake Pen\nc : choose / space : decide\n\nDetection\nspace : cut drawing / z : undo / e : erase\nr : rectangle / c : circle / p : polygon\nl : line ... |
"""AyudaEnPython: https://www.facebook.com/groups/ayudapython
"""
def merge(left, right):
merged_list = []
i = j = 0
while i < len(left) and j < len(right):
if left[i] < right[j]:
merged_list.append(left[i])
i += 1
else:
merged_list.append(right[j])
... | """AyudaEnPython: https://www.facebook.com/groups/ayudapython
"""
def merge(left, right):
merged_list = []
i = j = 0
while i < len(left) and j < len(right):
if left[i] < right[j]:
merged_list.append(left[i])
i += 1
else:
merged_list.append(right[j])
... |
class Window:
def __init__(self, title: str, window_id: int = None, type_str: str = None, type_color: str = None):
self.id = window_id
self.title = title
self.type_str = type_str
self.type_color = type_color
def get_name_part(self, index: int = -1) -> str:
return self.ti... | class Window:
def __init__(self, title: str, window_id: int=None, type_str: str=None, type_color: str=None):
self.id = window_id
self.title = title
self.type_str = type_str
self.type_color = type_color
def get_name_part(self, index: int=-1) -> str:
return self.title.spl... |
class A:
def __init__(self, a, /, b, *args, c, **kwargs):
pass
class B(A):
def __init__(self, a, /, b, *args, c, **kwargs):
super().__init__(a, b, *args, c=c, **kwargs) | class A:
def __init__(self, a, /, b, *args, c, **kwargs):
pass
class B(A):
def __init__(self, a, /, b, *args, c, **kwargs):
super().__init__(a, b, *args, c=c, **kwargs) |
class AtomicBool():
def __init__(self, initial_bool=False):
self.value = initial_bool
def set_value(self, new_value):
self.value = new_value
| class Atomicbool:
def __init__(self, initial_bool=False):
self.value = initial_bool
def set_value(self, new_value):
self.value = new_value |
#!/usr/bin/python3
print_reversed_list_integer = __import__('3-print_reversed_list_integer').print_reversed_list_integer
my_list = [1, 2, 3, 4, 5]
print_reversed_list_integer(my_list)
| print_reversed_list_integer = __import__('3-print_reversed_list_integer').print_reversed_list_integer
my_list = [1, 2, 3, 4, 5]
print_reversed_list_integer(my_list) |
class AsteroidMap:
def __init__(self, filePath):
self.filePath = filePath
self.maxX = 0
self.maxY = 0
self.traversed = []
self.initialTraversed = []
self.mapData = []
self.asteroidCoord = []
self.getMapData()
def getDistanceSlopeMap(self):
... | class Asteroidmap:
def __init__(self, filePath):
self.filePath = filePath
self.maxX = 0
self.maxY = 0
self.traversed = []
self.initialTraversed = []
self.mapData = []
self.asteroidCoord = []
self.getMapData()
def get_distance_slope_map(self):
... |
class CoolAstNode:
def __init__(self, lineno, columnno):
self.lineno = lineno
self.columnno = columnno
class CoolProgramNode(CoolAstNode):
def __init__(self, lineno, columnno, classes):
super().__init__(lineno, columnno)
# self.lineno = lineno
# self.columnno = columnno... | class Coolastnode:
def __init__(self, lineno, columnno):
self.lineno = lineno
self.columnno = columnno
class Coolprogramnode(CoolAstNode):
def __init__(self, lineno, columnno, classes):
super().__init__(lineno, columnno)
self.classes = classes
class Coolclassnode(CoolAstNode)... |
# -*- python -*-
# Copyright 2018-2020 Josh Pieper, jjp@pobox.com.
#
# 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 a... | load('@com_github_mjbots_bazel_deps//tools/workspace:generate_file.bzl', 'generate_file')
load('@com_github_mjbots_bazel_deps//tools/workspace:template_file.bzl', 'template_file')
_opencv_copts = ['-D_USE_MATH_DEFINES', '-D__OPENCV_BUILD=1', '-D__STDC_CONSTANT_MACROS', '-D__STDC_FORMAT_MACROS', '-D__STDC_LIMIT_MACROS',... |
# -*- coding: utf-8 -*-
def pytest_generate_tests(metafunc):
for key, value in getattr(metafunc.function, 'data', {}).items():
metafunc.parametrize(key, value, indirect=True)
| def pytest_generate_tests(metafunc):
for (key, value) in getattr(metafunc.function, 'data', {}).items():
metafunc.parametrize(key, value, indirect=True) |
def html_sanatize(in_str):
in_str = in_str.replace("&", "&")
in_str = in_str.replace("<", "<")
in_str = in_str.replace(">", ">")
in_str = in_str.replace("\"", """)
in_str = in_str.replace("'", "'")
in_str = in_str.replace("\r\n", "<br>")
in_str = in_str.replace("\r", "<br>")
in_str = in_str.... | def html_sanatize(in_str):
in_str = in_str.replace('&', '&')
in_str = in_str.replace('<', '<')
in_str = in_str.replace('>', '>')
in_str = in_str.replace('"', '"')
in_str = in_str.replace("'", ''')
in_str = in_str.replace('\r\n', '<br>')
in_str = in_str.replace('\r', '<br>... |
#Este modulo contiene los path de input y output, el de input es el path del archivo de cool que se va a compilar y el outut es el nombre del archivo de mips
#donde se va a guardar el resultado de compilar el input.
input_path = r'C:\Users\David\Documents\Version del compilador de Rayniel 9 de junio\Compiler\input\lif... | input_path = 'C:\\Users\\David\\Documents\\Version del compilador de Rayniel 9 de junio\\Compiler\\input\\life.cl'
output_path = 'C:\\Users\\David\\Documents\\Version del compilador de Rayniel 9 de junio\\Compiler\\output\\life1.s' |
# -*- coding: utf-8 -*-
"""Debt to Income Filter.
This script filters the bank list by the applicant's
maximum debt-to-income ratio.
"""
def filter_debt_to_income(monthly_debt_ratio, bank_list):
"""Filters the bank list by the maximum debt-to-income ratio allowed by the bank.
Args:
monthly_debt_rat... | """Debt to Income Filter.
This script filters the bank list by the applicant's
maximum debt-to-income ratio.
"""
def filter_debt_to_income(monthly_debt_ratio, bank_list):
"""Filters the bank list by the maximum debt-to-income ratio allowed by the bank.
Args:
monthly_debt_ratio (float): The applicant... |
v = [input() for _ in range(int(input()))]
i = 0
for x in list("ABCDEF"):
print(v.count(x))
i += v.count(x)
print(len(v) - i) | v = [input() for _ in range(int(input()))]
i = 0
for x in list('ABCDEF'):
print(v.count(x))
i += v.count(x)
print(len(v) - i) |
class Bits():
def __init__(self,width,value=0):
self.__width = width
self.__value = value
@property
def width(self):
return self.__width
@property
def value(self):
return self.__value
@property
def template(self):
return self
@property
d... | class Bits:
def __init__(self, width, value=0):
self.__width = width
self.__value = value
@property
def width(self):
return self.__width
@property
def value(self):
return self.__value
@property
def template(self):
return self
@property
def... |
# 1_hello.py - My first program
# Author: Ben Goldstone
# Date: 08/25/2020
print("Hello, World!")
| print('Hello, World!') |
class Program(object):
"""
This is a class that holds various information about the program.
"""
def __init__(self, name, version, usage):
super(Program, self).__init__()
self._name = name
self._version = version
self._usage = usage
self._values = {};
def bind(self, name, value):
self._values[name] = v... | class Program(object):
"""
This is a class that holds various information about the program.
"""
def __init__(self, name, version, usage):
super(Program, self).__init__()
self._name = name
self._version = version
self._usage = usage
self._values = {}
def bind(self... |
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 1 20:23:58 2021
@author: Srijhak
"""
def countprimes(n):
if n == 0:
return 0
if n == 1:
return 0
primes = [1]*n #create a list consisting of all true
primes[0]=0
primes[1]=0
i = 2
while i<n:
tmp = i
if pri... | """
Created on Thu Jul 1 20:23:58 2021
@author: Srijhak
"""
def countprimes(n):
if n == 0:
return 0
if n == 1:
return 0
primes = [1] * n
primes[0] = 0
primes[1] = 0
i = 2
while i < n:
tmp = i
if primes[i]:
tmp += i
while tmp < n:
... |
def compute(annual_salary, portion_saved, total_cost, semi_annual_raise):
portion_down_payment = 0.25
num_month = 0
increment_cycle = 0
monthly_salary = (annual_salary/12.0)
saving = 0
current_savings = 0
r = 0.04
while current_savings < (total_cost * portion_down_payment):
i... | def compute(annual_salary, portion_saved, total_cost, semi_annual_raise):
portion_down_payment = 0.25
num_month = 0
increment_cycle = 0
monthly_salary = annual_salary / 12.0
saving = 0
current_savings = 0
r = 0.04
while current_savings < total_cost * portion_down_payment:
if (num... |
#!/usr/bin/env python3
"""
github.com/greigdp, 2016
The Android pattern grid is as follows:
0 1 2
3 4 5
6 7 8
A pattern is just an array which can be appended to, until a pattern is formed.
Also note that this is not a particularly elegant or neat solution. For example, getAdjacent, g... | """
github.com/greigdp, 2016
The Android pattern grid is as follows:
0 1 2
3 4 5
6 7 8
A pattern is just an array which can be appended to, until a pattern is formed.
Also note that this is not a particularly elegant or neat solution. For example, getAdjacent, getLinear and getEndLinea... |
# -*- coding: utf-8 -*-
"""Top-level package for FPL Exporter."""
__author__ = """Toomas Ormisson"""
__email__ = "contact@verypythonproblems.com"
__version__ = "0.0.1"
| """Top-level package for FPL Exporter."""
__author__ = 'Toomas Ormisson'
__email__ = 'contact@verypythonproblems.com'
__version__ = '0.0.1' |
roblosecurity = "" # Insert .ROBLOSECURITY cookie here in the quotes
rbxid = "" # Insert .RBXID cookie here in the quotes
# It is normally a VERY BAD IDEA to share these cookies with anyone. But, in this case, they are required for the API endpoint that
# provides a means of obtaining bulk asset information. The sourc... | roblosecurity = ''
rbxid = '' |
class RegistrationConnectionType(Enum, IComparable, IFormattable, IConvertible):
"""
Defines the types of connections to a class object.
enum (flags) RegistrationConnectionType,values: MultipleUse (1),MultiSeparate (2),SingleUse (0),Surrogate (8),Suspended (4)
"""
def __eq__(self, *args):
... | class Registrationconnectiontype(Enum, IComparable, IFormattable, IConvertible):
"""
Defines the types of connections to a class object.
enum (flags) RegistrationConnectionType,values: MultipleUse (1),MultiSeparate (2),SingleUse (0),Surrogate (8),Suspended (4)
"""
def __eq__(self, *args):
""" x.... |
def print_hex_list(lst):
print("[{}]".format(", ".join(hex(x) for x in lst)))
| def print_hex_list(lst):
print('[{}]'.format(', '.join((hex(x) for x in lst)))) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.