content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
class Solution: def getSmallestString(self, n: int, k: int) -> str: def toChar(n): return chr(97 + n - 1) ans = [''] * n i = 0 while i < n: # how many spaces left to fill? left = n - i if k < left: # you got `left` spac...
class Solution: def get_smallest_string(self, n: int, k: int) -> str: def to_char(n): return chr(97 + n - 1) ans = [''] * n i = 0 while i < n: left = n - i if k < left: pass if k - 26 < left - 1: ans[i]...
def version(): if __grains__['os'] == 'eos': res = __salt__['napalm.pyeapi_run_commands']('show version') return res[0]['version'] else: return 'Not supported on this platform' def model(): if __grains__['os'] == 'eos': res = __salt__['napalm.pyeapi_run_commands']('show vers...
def version(): if __grains__['os'] == 'eos': res = __salt__['napalm.pyeapi_run_commands']('show version') return res[0]['version'] else: return 'Not supported on this platform' def model(): if __grains__['os'] == 'eos': res = __salt__['napalm.pyeapi_run_commands']('show vers...
class Solution(object): def numTrees(self, n): """ :type n: int :rtype: int """ ## DP solution dp=[1,1]+[None for _ in range(n-1)] for x in range(2, n+1): t=0 for y in range(x): i=y j=x-1-y ...
class Solution(object): def num_trees(self, n): """ :type n: int :rtype: int """ dp = [1, 1] + [None for _ in range(n - 1)] for x in range(2, n + 1): t = 0 for y in range(x): i = y j = x - 1 - y ...
class digested_sequence: def __init__(ds, sticky0, sticky1, sequence): # Both sticky ends (left and right, respectively) encoded based on sticky stranded alphabet with respect to top sequence. ds.sticky0 = sticky0 ds.sticky1 = sticky1 # Top sequence between two sticky ends ds.sequence = sequence
class Digested_Sequence: def __init__(ds, sticky0, sticky1, sequence): ds.sticky0 = sticky0 ds.sticky1 = sticky1 ds.sequence = sequence
class Publication: def __init__(self, title, price): self.title = title self.price = price class Periodical(Publication): def __init__(self, title, publisher, price, period): Publication.__init__(self, title, price) self.period = period self.publisher = publisher clas...
class Publication: def __init__(self, title, price): self.title = title self.price = price class Periodical(Publication): def __init__(self, title, publisher, price, period): Publication.__init__(self, title, price) self.period = period self.publisher = publisher clas...
def configurations(): return { "components": { "kvstore": False, "web": True, "indexing": False, "dmc": True } }
def configurations(): return {'components': {'kvstore': False, 'web': True, 'indexing': False, 'dmc': True}}
""" Problem:https://www.hackerrank.com/challenges/triangle-quest-2/problem Author: Eda AYDIN """ for i in range(1, int(input()) + 1): print(((10 ** i) // 9) ** 2)
""" Problem:https://www.hackerrank.com/challenges/triangle-quest-2/problem Author: Eda AYDIN """ for i in range(1, int(input()) + 1): print((10 ** i // 9) ** 2)
#!/bin/python3 if __name__ == '__main__': n = int(input()) english = list(map(int, input().split(' '))) b = int(input()) french = list(map(int, input().split(' '))) students = set(english).difference(french) print(len(students))
if __name__ == '__main__': n = int(input()) english = list(map(int, input().split(' '))) b = int(input()) french = list(map(int, input().split(' '))) students = set(english).difference(french) print(len(students))
""" Loop while General form; while bool_expression: //execute loop Repeat until bool expression is True bool expression is all expression where the result is True or False Sample: num = 5 num < 5 # False num > 5 # False # sample 1 number = 1 while number < 10: # 1, 2, 3, 4, 5, 6, 7, 8, 9 print(number...
""" Loop while General form; while bool_expression: //execute loop Repeat until bool expression is True bool expression is all expression where the result is True or False Sample: num = 5 num < 5 # False num > 5 # False # sample 1 number = 1 while number < 10: # 1, 2, 3, 4, 5, 6, 7, 8, 9 print(number...
class Ssh: def __init__(self,user,server,port,mode): self.user=user self.server=server self.port=port self.mode=mode @classmethod def fromconfig(cls, config): propbag={} for key, item in config: if key.strip()[0] == ";": continue ...
class Ssh: def __init__(self, user, server, port, mode): self.user = user self.server = server self.port = port self.mode = mode @classmethod def fromconfig(cls, config): propbag = {} for (key, item) in config: if key.strip()[0] == ';': ...
def extractLizonkanovelsWordpressCom(item): ''' Parser for 'lizonkanovels.wordpress.com' ''' vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if not (chp or vol) or "preview" in item['title'].lower(): return None tagmap = [ ('bestial blade by priest', ...
def extract_lizonkanovels_wordpress_com(item): """ Parser for 'lizonkanovels.wordpress.com' """ (vol, chp, frag, postfix) = extract_vol_chapter_fragment_postfix(item['title']) if not (chp or vol) or 'preview' in item['title'].lower(): return None tagmap = [('bestial blade by priest', 'bestial ...
def debug( content ): print( "[*] " + str(content) , flush=True) def bad( content ): print( "[-] " + str(content) , flush=True) def good( content ): print( "[+] " + str(content) , flush=True) # sample output: # [*] Gimme yo money # [-] Money taken by chad. # [+] Chad receives the money.
def debug(content): print('[*] ' + str(content), flush=True) def bad(content): print('[-] ' + str(content), flush=True) def good(content): print('[+] ' + str(content), flush=True)
# API Error Codes AUTHORIZATION_FAILED = 5 # Invalid access token PERMISSION_IS_DENIED = 7 CAPTCHA_IS_NEEDED = 14 ACCESS_DENIED = 15 # No access to call this method INVALID_USER_ID = 113 # User deactivated class VkException(Exception): pass class VkAuthError(VkException): pass class VkA...
authorization_failed = 5 permission_is_denied = 7 captcha_is_needed = 14 access_denied = 15 invalid_user_id = 113 class Vkexception(Exception): pass class Vkautherror(VkException): pass class Vkapierror(VkException): __slots__ = ['error', 'code', 'message', 'request_params', 'redirect_uri'] captcha_n...
def read_ims_legacy(name): data = {} dls = [] #should read in .tex file infile = open(name + ".tex") instring = infile.read() ##instring = instring.replace(':description',' :citation') ## to be deprecated soon instring = unicode(instring,'utf-8') meta = {} metatxt = instri...
def read_ims_legacy(name): data = {} dls = [] infile = open(name + '.tex') instring = infile.read() instring = unicode(instring, 'utf-8') meta = {} metatxt = instring.split('::')[1] meta['record_txt'] = '::' + metatxt.strip() + '\n\n' (meta['bibtype'], rest) = metatxt.split(None, 1) ...
# encoding: utf-8 # module Grasshopper.Kernel.Geometry.ConvexHull calls itself ConvexHull # from Grasshopper,Version=1.0.0.20,Culture=neutral,PublicKeyToken=dda4f5ec2cd80803 # by generator 1.145 """ NamespaceTracker represent a CLS namespace. """ # no imports # no functions # classes class Solver(object): ...
""" NamespaceTracker represent a CLS namespace. """ class Solver(object): @staticmethod def compute(nodes, hull): """ Compute(nodes: Node2List,hull: List[int]) -> bool """ pass @staticmethod def compute_hull(*__args): """ ComputeHull(pts: Node2List) -> Polyline ComputeHul...
first_line = input().split() second_line = input().split() third_line = input().split() board_list = [ first_line, second_line, third_line ] first = '1' second = '2' empty = '0' first_win = [first] * 3 second_win = [second] * 3 is_first_player = False is_second_player = False diagonal...
first_line = input().split() second_line = input().split() third_line = input().split() board_list = [first_line, second_line, third_line] first = '1' second = '2' empty = '0' first_win = [first] * 3 second_win = [second] * 3 is_first_player = False is_second_player = False diagonals = [board_list[0][0], board_list[1][...
try: count = int(input("Give me a number: ")) except ValueError: print("That's not a number!") else: print("Hi " * count)
try: count = int(input('Give me a number: ')) except ValueError: print("That's not a number!") else: print('Hi ' * count)
def parse_frame_message(msg:str): """ Parses a CAN message sent from the PCAN module over the serial bus Example: 't1234DEADBEEF' - standard (11-bit) identifier message frame 'R123456784' - extended (29-bit) identifier request frame Returns a tuple with type, ID, size, and message Ex...
def parse_frame_message(msg: str): """ Parses a CAN message sent from the PCAN module over the serial bus Example: 't1234DEADBEEF' - standard (11-bit) identifier message frame 'R123456784' - extended (29-bit) identifier request frame Returns a tuple with type, ID, size, and message E...
""" News: main.py module """ def news_page_link(html_soup): """ Returns -> [str] link of news page. Params -> [requests.HTML object] HTML of web page. """ # Container div with all top news and p tag(at last) with more link news_div = html_soup.find("div#news_event", first=True) more_news_...
""" News: main.py module """ def news_page_link(html_soup): """ Returns -> [str] link of news page. Params -> [requests.HTML object] HTML of web page. """ news_div = html_soup.find('div#news_event', first=True) more_news_div_tag = news_div.find('div')[-1] more_news_a_tag = more_news_div_tag...
""" Ex 27 - make a program that reads from the keyboard the first and last name of a person """ name = str(input('Type your full name:')).upper().strip() pri = name.find(' ') ult = name.rfind(' ') print(f'Your first name is: {name[:pri]}') print(f'Your last name is: {name[ult:]}') input('Enter to exit')
""" Ex 27 - make a program that reads from the keyboard the first and last name of a person """ name = str(input('Type your full name:')).upper().strip() pri = name.find(' ') ult = name.rfind(' ') print(f'Your first name is: {name[:pri]}') print(f'Your last name is: {name[ult:]}') input('Enter to exit')
x = int(input()) dentro = fora = 0 for y in range(0, x, 1): num = int(input()) if num >= 10 and num <= 20: dentro += 1 else: fora += 1; print('{} in'.format(dentro)) print('{} out'.format(fora))
x = int(input()) dentro = fora = 0 for y in range(0, x, 1): num = int(input()) if num >= 10 and num <= 20: dentro += 1 else: fora += 1 print('{} in'.format(dentro)) print('{} out'.format(fora))
# # PySNMP MIB module NNCFRINTSTATISTICS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NNCFRINTSTATISTICS-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:23:02 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (d...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_union, single_value_constraint, constraints_intersection, value_size_constraint) ...
class StylusButtonEventArgs(StylusEventArgs): """ Provides data for the System.Windows.UIElement.StylusButtonDown and System.Windows.UIElement.StylusButtonUp events. StylusButtonEventArgs(stylusDevice: StylusDevice,timestamp: int,button: StylusButton) """ @staticmethod def __new__(self,stylusDevice,tim...
class Stylusbuttoneventargs(StylusEventArgs): """ Provides data for the System.Windows.UIElement.StylusButtonDown and System.Windows.UIElement.StylusButtonUp events. StylusButtonEventArgs(stylusDevice: StylusDevice,timestamp: int,button: StylusButton) """ @staticmethod def __new__(self, stylusDevice...
def betterSurround(st): st = list(st) if st[0]!= '+' and st[len(st)-1]!= '=': return False else: for i in range(0,len(st)): if st[i].isalpha(): if not (st[i-1]=='+' or st[i-1]=='=') and (st[i+1] == '+' or st[i+1] == '='): return false ...
def better_surround(st): st = list(st) if st[0] != '+' and st[len(st) - 1] != '=': return False else: for i in range(0, len(st)): if st[i].isalpha(): if not (st[i - 1] == '+' or st[i - 1] == '=') and (st[i + 1] == '+' or st[i + 1] == '='): retu...
for i in range(4): outfile = 'paramslist.txt' params = [0, 1, 2] with open(outfile, 'a+') as f: for param in params: f.write(str(param)) f.write(' ') f.write('\n')
for i in range(4): outfile = 'paramslist.txt' params = [0, 1, 2] with open(outfile, 'a+') as f: for param in params: f.write(str(param)) f.write(' ') f.write('\n')
# ParPy: A python natural language # parser based on the one used # by Zork, for use in Python games # Copyright (c) Finn Lancaster 2021 # This file contains the BASE action words # accepted by the users program. For example # , take, move, etc. # ParPy handles similar entries and conversion # to program-accepted one...
recognized_terms = [('', ''), ('', '')]
config = { 'matrikkel_zip_files': [{ 'zip_name': 'Y:/kartdata/Matrikkeldata/SOSIuttrekk/07_Vestfold/0709_Larvik/UTM32_Euref89/Shape/32_Matrikkeldata_0709.zip', 'target_shape_prefix': '32_0709adresse_punkt' },{ 'zip_name': 'Y:/kartdata/Matrikkeldata/SOSIuttrekk/07_Vestfold/0706_Sandefjord/UTM32_Euref89/Shape/32_...
config = {'matrikkel_zip_files': [{'zip_name': 'Y:/kartdata/Matrikkeldata/SOSIuttrekk/07_Vestfold/0709_Larvik/UTM32_Euref89/Shape/32_Matrikkeldata_0709.zip', 'target_shape_prefix': '32_0709adresse_punkt'}, {'zip_name': 'Y:/kartdata/Matrikkeldata/SOSIuttrekk/07_Vestfold/0706_Sandefjord/UTM32_Euref89/Shape/32_Matrikkelda...
"""PatchmatchNet dataset module reference: https://github.com/FangjinhuaWang/PatchmatchNet """
"""PatchmatchNet dataset module reference: https://github.com/FangjinhuaWang/PatchmatchNet """
#!/usr/bin/env python class ColumnIdentifierError(Exception): """ Exception raised when the user supplies an invalid column identifier. """ def __init__(self, msg): self.msg = msg class XLSDataError(Exception): """ Exception raised when there is a problem converting XLS data. """ ...
class Columnidentifiererror(Exception): """ Exception raised when the user supplies an invalid column identifier. """ def __init__(self, msg): self.msg = msg class Xlsdataerror(Exception): """ Exception raised when there is a problem converting XLS data. """ def __init__(self,...
''' Gets memory usage of Linux python process Tyson Jones, Nov 2017 tyson.jones@materials.ox.ac.uk ''' _FIELDS = ['VmRSS', 'VmHWM', 'VmSize', 'VmPeak'] def get_memory(): ''' returns the current and peak, real and virtual memories used by the calling linux python process, in Bytes ''' # read i...
""" Gets memory usage of Linux python process Tyson Jones, Nov 2017 tyson.jones@materials.ox.ac.uk """ _fields = ['VmRSS', 'VmHWM', 'VmSize', 'VmPeak'] def get_memory(): """ returns the current and peak, real and virtual memories used by the calling linux python process, in Bytes """ with open('/p...
class Time(): current_world = None current_time_step = None @staticmethod def get_current_world(): return Time.current_world @staticmethod def get_current_time_step(): return Time.current_time_step @staticmethod def reset(): Time.current_world = None Ti...
class Time: current_world = None current_time_step = None @staticmethod def get_current_world(): return Time.current_world @staticmethod def get_current_time_step(): return Time.current_time_step @staticmethod def reset(): Time.current_world = None Time...
class InvalidPasswordException(Exception): pass class InvalidValueException(Exception): pass
class Invalidpasswordexception(Exception): pass class Invalidvalueexception(Exception): pass
class Carta(): CARTAS_VALORES = { "3": 10, "2": 9, "1": 8, "13": 7, "12": 6, "11": 5, "7": 4, "6": 3, "5": 2, "4": 1 } NAIPES_VALORES = { "Paus": 4, "Copas": 3, "Espadas": 2, ...
class Carta: cartas_valores = {'3': 10, '2': 9, '1': 8, '13': 7, '12': 6, '11': 5, '7': 4, '6': 3, '5': 2, '4': 1} naipes_valores = {'Paus': 4, 'Copas': 3, 'Espadas': 2, 'Moles': 1} def __init__(self, numero, naipe): self.numero = numero self.naipe = naipe def verificar_carta(self, car...
def subUnsort(A): n = len(A) for i in range(0, n - 1): if A[i] > A[i + 1]: break if i == n - 1: return -1 start = i for i in range(n - 1, start, -1): if A[i] < A[start] or A[i] < A[i - 1]: break end = i min = A[start] max = A[start] fo...
def sub_unsort(A): n = len(A) for i in range(0, n - 1): if A[i] > A[i + 1]: break if i == n - 1: return -1 start = i for i in range(n - 1, start, -1): if A[i] < A[start] or A[i] < A[i - 1]: break end = i min = A[start] max = A[start] fo...
#!/usr/bin/env python3 #pylint: disable=missing-docstring class DeviceNotFoundException(Exception): status_code = 404 def __init__(self, message): Exception.__init__(self) self.message = message def to_dict(self): return {'message': self.message} class UpstreamApiException(Except...
class Devicenotfoundexception(Exception): status_code = 404 def __init__(self, message): Exception.__init__(self) self.message = message def to_dict(self): return {'message': self.message} class Upstreamapiexception(Exception): status_code = 502 def __init__(self, message...
#validation DS server_fields = { "match_keys": "['id', 'mac_address', 'cluster_id', 'ip_address', 'tag', 'where']", "obj_name": "server", "primary_keys": "['id', 'mac_address']", "id": "", "host_name": "", "mac_address": "", "ip_address": "", "parameters": """{ 'int...
server_fields = {'match_keys': "['id', 'mac_address', 'cluster_id', 'ip_address', 'tag', 'where']", 'obj_name': 'server', 'primary_keys': "['id', 'mac_address']", 'id': '', 'host_name': '', 'mac_address': '', 'ip_address': '', 'parameters': "{\n 'interface_name': ''\n }", 'roles': ...
Node11 = {"ip":"10.1.3.11", "user":"marian", "password":"descartes"} Node17 = {"ip":"10.1.3.17", "user":"marian", "password":"descartes"}
node11 = {'ip': '10.1.3.11', 'user': 'marian', 'password': 'descartes'} node17 = {'ip': '10.1.3.17', 'user': 'marian', 'password': 'descartes'}
user_name,age = input("Enter the name and age to watch the movie : ").split() age = int(age) conduction = user_name[0].lower() if conduction == 'a' and age >= 10 : print(f"Hello {user_name}!! \n You can watch the coco movie ") else : if age < 10: print("Your age is smaller then limit to watch...
(user_name, age) = input('Enter the name and age to watch the movie : ').split() age = int(age) conduction = user_name[0].lower() if conduction == 'a' and age >= 10: print(f'Hello {user_name}!! \n You can watch the coco movie ') elif age < 10: print('Your age is smaller then limit to watch the movie ') else: ...
class TimeoutError(Exception): """ Indicates a database operation timed out in some way. """ pass
class Timeouterror(Exception): """ Indicates a database operation timed out in some way. """ pass
def test_can_withdraw_as_alice(nft_funded, alice, bob, accounts, beneficiary): nft_funded.withdraw({"from": alice}) init_balance = beneficiary.balance() accounts[1].transfer(nft_funded, 10 ** 18) nft_funded.mint({"from": bob}) nft_funded.withdraw({"from": alice}) final_balance = beneficiary.bala...
def test_can_withdraw_as_alice(nft_funded, alice, bob, accounts, beneficiary): nft_funded.withdraw({'from': alice}) init_balance = beneficiary.balance() accounts[1].transfer(nft_funded, 10 ** 18) nft_funded.mint({'from': bob}) nft_funded.withdraw({'from': alice}) final_balance = beneficiary.bala...
class Solution: def solve(self, nums): numsDict = {} for i in nums: if i in numsDict: numsDict[i] += 1 else: numsDict[i] = 1 for num in numsDict: if num == numsDict[num]: return True ...
class Solution: def solve(self, nums): nums_dict = {} for i in nums: if i in numsDict: numsDict[i] += 1 else: numsDict[i] = 1 for num in numsDict: if num == numsDict[num]: return True return False
# noinspection SqlNoDataSourceInspection,SqlDialectInspection class Postgres: """ Provides functions to query PostgreSQL :param str table: Param to select the right table :param str column: Param to search duplicate or unique on """ def __init__(self, table: str, column: str) -> None: ...
class Postgres: """ Provides functions to query PostgreSQL :param str table: Param to select the right table :param str column: Param to search duplicate or unique on """ def __init__(self, table: str, column: str) -> None: self.table = table self.column = column if not...
# Author: veelion db_host = 'localhost' db_db = 'crawler' db_user = 'your-user' db_password = 'your-password'
db_host = 'localhost' db_db = 'crawler' db_user = 'your-user' db_password = 'your-password'
BCT_ADDRESS = '0x2f800db0fdb5223b3c3f354886d907a671414a7f' NCT_ADDRESS = '0xd838290e877e0188a4a44700463419ed96c16107' UBO_ADDRESS = '0x2b3ecb0991af0498ece9135bcd04013d7993110c' NBO_ADDRESS = '0x6bca3b77c1909ce1a4ba1a20d1103bde8d222e48' GRAY = '#232B2B' DARK_GRAY = '#343a40' FIGURE_BG_COLOR = '#202020' MCO2_ADDRESS = '0...
bct_address = '0x2f800db0fdb5223b3c3f354886d907a671414a7f' nct_address = '0xd838290e877e0188a4a44700463419ed96c16107' ubo_address = '0x2b3ecb0991af0498ece9135bcd04013d7993110c' nbo_address = '0x6bca3b77c1909ce1a4ba1a20d1103bde8d222e48' gray = '#232B2B' dark_gray = '#343a40' figure_bg_color = '#202020' mco2_address = '0...
#!/usr/bin/env python # encoding: utf-8 """ permutation_ii.py Created by Shengwei on 2014-07-15. """ # https://oj.leetcode.com/problems/permutations-ii/ # tags: medium / hard, numbers, permutation, dp, recursion """ Given a collection of numbers that might contain duplicates, return all possible unique permutations....
""" permutation_ii.py Created by Shengwei on 2014-07-15. """ '\nGiven a collection of numbers that might contain duplicates, return all possible unique permutations.\n\nFor example,\n[1,1,2] have the following unique permutations:\n[1,1,2], [1,2,1], and [2,1,1].\n' class Solution: def permute_unique(self, nums):...
class BaseValidator: """ Base class for validator """ def is_applicable(self, schema): raise NotImplementedError() def validate_type(self, upstream, downstream): raise NotImplementedError()
class Basevalidator: """ Base class for validator """ def is_applicable(self, schema): raise not_implemented_error() def validate_type(self, upstream, downstream): raise not_implemented_error()
CrfSegMoodPath = 'E:\python_code\Djangotest2\cmdb\model\msr.crfsuite' HmmDIC = 'E:\python_code\Djangotest2\cmdb\model\HMMDic.pkl' HmmDISTRIBUTION = 'E:\python_code\Djangotest2\cmdb\model\HMMDistribution.pkl' CrfNERMoodPath = 'E:\python_code\Djangotest2\cmdb\model\PKU.crfsuite' BiLSTMCXPath = 'E:\python_code\Djangotest2...
crf_seg_mood_path = 'E:\\python_code\\Djangotest2\\cmdb\\model\\msr.crfsuite' hmm_dic = 'E:\\python_code\\Djangotest2\\cmdb\\model\\HMMDic.pkl' hmm_distribution = 'E:\\python_code\\Djangotest2\\cmdb\\model\\HMMDistribution.pkl' crf_ner_mood_path = 'E:\\python_code\\Djangotest2\\cmdb\\model\\PKU.crfsuite' bi_lstmcx_path...
# -*- coding: utf-8 -*- # Copyright 2021 Cohesity Inc. class RoleCreateIpConfigParametersEnum(object): """Implementation of the 'Role_CreateIpConfigParameters' enum. Specifies the interface role. 'kPrimary' indicates a primary role. 'kSecondary' indicates a secondary role. Attributes: KP...
class Rolecreateipconfigparametersenum(object): """Implementation of the 'Role_CreateIpConfigParameters' enum. Specifies the interface role. 'kPrimary' indicates a primary role. 'kSecondary' indicates a secondary role. Attributes: KPRIMARY: TODO: type description here. KSECONDARY: ...
# # @lc app=leetcode.cn id=50 lang=python3 # # [50] Pow(x, n) # n = 5 x = 6 x & 1 # @lc code=start class Solution: def myPow(self, x: float, n: int) -> float: ans = 0 pow_n = x if n > 0: while x > 0: if x & 1 == 1: ans += pow_n ...
n = 5 x = 6 x & 1 class Solution: def my_pow(self, x: float, n: int) -> float: ans = 0 pow_n = x if n > 0: while x > 0: if x & 1 == 1: ans += pow_n x = x >> 1 pow_n *= pow_n
class UnknownList(Exception): pass class InsufficientPermissions(Exception): pass class AlreadySubscribed(Exception): pass class NotSubscribed(Exception): pass class ClosedSubscription(Exception): pass class ClosedUnsubscription(Exception): pass class UnknownFlag(Exception): pass clas...
class Unknownlist(Exception): pass class Insufficientpermissions(Exception): pass class Alreadysubscribed(Exception): pass class Notsubscribed(Exception): pass class Closedsubscription(Exception): pass class Closedunsubscription(Exception): pass class Unknownflag(Exception): pass clas...
# -*- coding: utf-8 -*- """Release data for the IPython project.""" #----------------------------------------------------------------------------- # Copyright (c) 2008, IPython Development Team. # Copyright (c) 2001, Fernando Perez <fernando.perez@colorado.edu> # Copyright (c) 2001, Janko Hauser <jhauser@zscout.de>...
"""Release data for the IPython project.""" _version_major = 8 _version_minor = 0 _version_patch = 1 _version_extra = '.dev' _version_extra = '' _ver = [_version_major, _version_minor, _version_patch] __version__ = '.'.join(map(str, _ver)) if _version_extra: __version__ = __version__ + _version_extra version = __ve...
heroes_number = int(input()) heroes_list = dict() for heroes in range(heroes_number): hero = input().split(' ') hero_name = hero[0] hero_hit_points = int(hero[1]) hero_mana_points = int(hero[2]) heroes_list[hero_name] = {'HP': hero_hit_points, 'MP': hero_mana_points} command = input() while comm...
heroes_number = int(input()) heroes_list = dict() for heroes in range(heroes_number): hero = input().split(' ') hero_name = hero[0] hero_hit_points = int(hero[1]) hero_mana_points = int(hero[2]) heroes_list[hero_name] = {'HP': hero_hit_points, 'MP': hero_mana_points} command = input() while command ...
#!/usr/bin/python # ============================================================================== # Author: Tao Li (taoli@ucsd.edu) # Date: May 1, 2015 # Question: 083-Remove-Duplicates-from-Sorted-List # Link: https://leetcode.com/problems/remove-duplicates-from-sorted-list/ # ==============================...
class Solution: def delete_duplicates(self, head): ptr = head while ptr: ptr.next = self.findNext(ptr) ptr = ptr.next return head def find_next(self, head): if not head or not head.next: return None elif head.val != head.next.val: ...
#Check if NOT txt = "Hello buddie unu!" print("owo" not in txt) txt = "The best things in life are free!" if "expensive" not in txt: print("Yes, 'expensive' is NOT present.") ''' Terminal: True Yes, 'expensive' is NOT present. ''' #https://www.w3schools.com/python/python_strings.asp
txt = 'Hello buddie unu!' print('owo' not in txt) txt = 'The best things in life are free!' if 'expensive' not in txt: print("Yes, 'expensive' is NOT present.") "\nTerminal:\nTrue\nYes, 'expensive' is NOT present.\n"
# SPDX-License-Identifier: BSD-3-Clause # Copyright Contributors to the OpenColorIO Project. class FileTransform: """ FileTransform """ def __init__(self): pass def getSrc(self): pass def setSrc(self, src): pass def getCCCId(self): pass def setCCCId(self,...
class Filetransform: """ FileTransform """ def __init__(self): pass def get_src(self): pass def set_src(self, src): pass def get_ccc_id(self): pass def set_ccc_id(self, cccid): pass def get_interpolation(self): pass def set_i...
class InternalError(Exception): pass class InvalidAccessError(Exception): pass class InvalidStateError(Exception): pass
class Internalerror(Exception): pass class Invalidaccesserror(Exception): pass class Invalidstateerror(Exception): pass
{ 'targets': [ { 'target_name': 'profiler', 'sources': [ 'cpu_profiler.cc', 'graph_edge.cc', 'graph_node.cc', 'heap_profiler.cc', 'profile.cc', 'profile_node.cc', 'profiler.cc', 'snapshot.cc', ], } ] }
{'targets': [{'target_name': 'profiler', 'sources': ['cpu_profiler.cc', 'graph_edge.cc', 'graph_node.cc', 'heap_profiler.cc', 'profile.cc', 'profile_node.cc', 'profiler.cc', 'snapshot.cc']}]}
def Insertionsort(A): for i in range(1, len(A)): tmp = A[i] k = i while k > 0 and tmp < A[k - 1]: A[k] = A[k - 1] k -= 1 A[k] = tmp A = [54, 26, 93, 17, 77, 31, 44, 55, 20] Insertionsort(A) print(A)
def insertionsort(A): for i in range(1, len(A)): tmp = A[i] k = i while k > 0 and tmp < A[k - 1]: A[k] = A[k - 1] k -= 1 A[k] = tmp a = [54, 26, 93, 17, 77, 31, 44, 55, 20] insertionsort(A) print(A)
class policy_name_protection(): def __init__(self,name_protection): self.np=name_protection def __call__(self,target): try: if target.policy.has_key('name_protection')==True: if target.policy.get('name_protection')==False and self.np==True: ...
class Policy_Name_Protection: def __init__(self, name_protection): self.np = name_protection def __call__(self, target): try: if target.policy.has_key('name_protection') == True: if target.policy.get('name_protection') == False and self.np == True: ...
''' Leetcode problem No 300 Longest Increasing Subsequence Solution written by Xuqiang Fang on 20 June, 2018 ''' class Solution(object): ######## ''' This is a classic problem and the following is a classic solution in O(nlogn) tails is an array storing the smallest tail of all increasing subsequences ...
""" Leetcode problem No 300 Longest Increasing Subsequence Solution written by Xuqiang Fang on 20 June, 2018 """ class Solution(object): """ This is a classic problem and the following is a classic solution in O(nlogn) tails is an array storing the smallest tail of all increasing subsequences with length i...
#!/usr/bin/env python3 # Problem Set 4A # Name: John L. Jones # Collaborators: # Time Spent: x:xx def get_permutations(sequence): ''' Enumerate all permutations of a given string sequence (string): an arbitrary string to permute. Assume that it is a non-empty string. You MUST use recursion for ...
def get_permutations(sequence): """ Enumerate all permutations of a given string sequence (string): an arbitrary string to permute. Assume that it is a non-empty string. You MUST use recursion for this part. Non-recursive solutions will not be accepted. Returns: a list of all permutatio...
def function(param, param1): pass def result(): pass function(result<arg1>(), result())
def function(param, param1): pass def result(): pass function(result < arg1 > (), result())
''' - Leetcode problem: 5 - Difficulty: Medium - Brief problem description: Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example: Input: "babad" Output: "bab" Note: "aba" is also a valid answer. Example: Input: "cbbd"...
""" - Leetcode problem: 5 - Difficulty: Medium - Brief problem description: Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example: Input: "babad" Output: "bab" Note: "aba" is also a valid answer. Example: Input: "cbbd" Output: "bb" - S...
# https://open.kattis.com/problems/stockbroker # init values cash = 100 shares = 0 prices = [] #first input: num days (1-365) num_days = int(input()) #next inputs: values on each day (1-500) for _ in range(num_days): prices.append(int(input())) for i in range(len(prices)-1): if prices[i] ...
cash = 100 shares = 0 prices = [] num_days = int(input()) for _ in range(num_days): prices.append(int(input())) for i in range(len(prices) - 1): if prices[i] < prices[i + 1]: if shares + cash // prices[i] > 100000: cash = cash - (100000 - shares) * prices[i] shares = 100000 ...
class Solution(object): def missingNumber(self, nums): """ :type nums: List[int] :rtype: int """ res = len(nums) for i in xrange(len(nums)): res ^= nums[i] res ^= i return res
class Solution(object): def missing_number(self, nums): """ :type nums: List[int] :rtype: int """ res = len(nums) for i in xrange(len(nums)): res ^= nums[i] res ^= i return res
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Les fonctions et les exceptions Quelques exemples de fonctions """ def ask_ok(prompt, retries=3, reminder='Essayes encore!'): while True: ok = input(prompt).upper() if ok in ('Y', 'YES', 'O', 'OUI'): return True if ok in ('N', ...
"""Les fonctions et les exceptions Quelques exemples de fonctions """ def ask_ok(prompt, retries=3, reminder='Essayes encore!'): while True: ok = input(prompt).upper() if ok in ('Y', 'YES', 'O', 'OUI'): return True if ok in ('N', 'NO', 'NON'): return False r...
class RequestInfo: def __init__(self, human_string, # human-readable string (will be printed for Human object) action_requested, # action requested ('card' + index of card / 'opponent' / 'guess') current_hand = [], ...
class Requestinfo: def __init__(self, human_string, action_requested, current_hand=[], discard_pile=[], move_history=[], players_active_status=[], players_protection_status=[], invalid_moves=[], valid_moves=[], players_active=[], players_protected=[]): self.human_string = human_string self.action_r...
""" # Definition for a Node. class Node(object): def __init__(self, val, children): self.val = val self.children = children """ class Solution(object): def maxDepth(self, root): """ :type root: Node :rtype: int """ stack = [] if root is not None: ...
""" # Definition for a Node. class Node(object): def __init__(self, val, children): self.val = val self.children = children """ class Solution(object): def max_depth(self, root): """ :type root: Node :rtype: int """ stack = [] if root is not None...
__author__ = '@dominofire' class Task: """ Represents a task in the workflow """ def __init__(self, name, cmd): self.name = name """ A name for the task that is unique among workflow scope """ self.command = cmd """ A valid bash command to be executed """ # Used...
__author__ = '@dominofire' class Task: """ Represents a task in the workflow """ def __init__(self, name, cmd): self.name = name ' A name for the task that is unique among workflow scope ' self.command = cmd ' A valid bash command to be executed ' self.parents =...
class RawMemory(object): '''Represents raw memory.''' def __init__(self): self._pointer_to_object = {} self._object_to_pointer = {} # address 0 won't be used self._current_pointer = 0 def get_pointer(self, obj): assert obj in self._object_to_pointer return se...
class Rawmemory(object): """Represents raw memory.""" def __init__(self): self._pointer_to_object = {} self._object_to_pointer = {} self._current_pointer = 0 def get_pointer(self, obj): assert obj in self._object_to_pointer return self._object_to_pointer[obj] d...
class Paginator: def __init__(self, configuration, request): self.configuration = configuration self.page = request.args.get('page', 1, type=int) self.page_size = request.args.get('page_size', configuration.per_page, type=int) if self.page_size > configuration.max_page_size: ...
class Paginator: def __init__(self, configuration, request): self.configuration = configuration self.page = request.args.get('page', 1, type=int) self.page_size = request.args.get('page_size', configuration.per_page, type=int) if self.page_size > configuration.max_page_size: ...
''' Python To-Do A simple to-do list program using text files to hold tasks Authored by: Bryce Buchanan ''' # TO DO 1. Convert to class # TO DO 2. Allow editing of tasks # TO DO 3. Detemine and implement best data structure # TO DO 4. File I/O # TO DO 5. GUI #class ToDoItem: # def __init__(self, task): # self.task ...
""" Python To-Do A simple to-do list program using text files to hold tasks Authored by: Bryce Buchanan """ class Todomodule: def __init__(self, toDoList, completedTasks, head=None): self.toDoList = toDoList self.completedTasks = completedTasks self.head = head def add(self): ...
EXECUTE_MODE_AUTO = "auto" EXECUTE_MODE_ASYNC = "async" EXECUTE_MODE_SYNC = "sync" EXECUTE_MODE_OPTIONS = frozenset([ EXECUTE_MODE_AUTO, EXECUTE_MODE_ASYNC, EXECUTE_MODE_SYNC, ]) EXECUTE_CONTROL_OPTION_ASYNC = "async-execute" EXECUTE_CONTROL_OPTION_SYNC = "sync-execute" EXECUTE_CONTROL_OPTIONS = frozense...
execute_mode_auto = 'auto' execute_mode_async = 'async' execute_mode_sync = 'sync' execute_mode_options = frozenset([EXECUTE_MODE_AUTO, EXECUTE_MODE_ASYNC, EXECUTE_MODE_SYNC]) execute_control_option_async = 'async-execute' execute_control_option_sync = 'sync-execute' execute_control_options = frozenset([EXECUTE_CONTROL...
# Euler problem 90: Cube digit pairs def solve(): # Find all possible dies with 6 digits on faces out of 10 combinations options = [] find_options(options, []) count = 0 # Figure out which combinations of two dies make a square for die1 in options: for die2 in options: ...
def solve(): options = [] find_options(options, []) count = 0 for die1 in options: for die2 in options: if is_solution(die1, die2): count += 1 print(count // 2) def find_options(options, die): if len(die) == 6: options.append(die) return i...
class SimHash: def __init__(self, bit=64, limit=3): self.bit = bit self.limit = limit self.docs = [] def compute_bits(self, text): word_hash = [] for word in text: word_hash.append(hash(word)) hash_bits = [] while len(hash_bits) <...
class Simhash: def __init__(self, bit=64, limit=3): self.bit = bit self.limit = limit self.docs = [] def compute_bits(self, text): word_hash = [] for word in text: word_hash.append(hash(word)) hash_bits = [] while len(hash_bits) < self.bit: ...
# Write a function that takes a string as input and returns the string reversed. class Solution(object): def reverseString(self, s): return s[::-1]
class Solution(object): def reverse_string(self, s): return s[::-1]
# Copyright 2018, Michael DeHaan LLC # License: Apache License Version 2.0 + Commons Clause # --------------------------------------------------------------------------- # workers.py - configuration related to worker setup. This file *CAN* be # different per worker. # ------------------------------------------------...
build_root = '/tmp/vespene/buildroot/' fileserving_enabled = True fileserving_port = 8000 fileserving_hostname = '' fileserving_url = '/srv' buildroot_web_link = ''
#1016 #ENTRADA DE DADOS entrada = int(input()) #SE O CARRO Y CONSEGUE SE DISTANCIAR EM CADA MINUTO 500metros = 0.5km tempo = entrada/0.5 print(int(tempo), 'minutos')
entrada = int(input()) tempo = entrada / 0.5 print(int(tempo), 'minutos')
# Licensed under a 3-clause BSD style license - see LICENSE.rst # coding: utf8 class ConsumerSequential(): """`ConsumerSequential` class represents a Consumer pipeline Step. """ def __init__( self, coroutine, name=None): """ Parameters ---------- coroutine : Cl...
class Consumersequential: """`ConsumerSequential` class represents a Consumer pipeline Step. """ def __init__(self, coroutine, name=None): """ Parameters ---------- coroutine : Class instance that contains init, run and finish methods """ self.name = name ...
""" 0056. Merge Intervals Given a collection of intervals, merge all overlapping intervals. Example 1: Input: [[1,3],[2,6],[8,10],[15,18]] Output: [[1,6],[8,10],[15,18]] Explanation: Since intervals [1,3] and [2,6] overlaps, merge them into [1,6]. Example 2: Input: [[1,4],[4,5]] Output: [[1,5]] Explanation: Interval...
""" 0056. Merge Intervals Given a collection of intervals, merge all overlapping intervals. Example 1: Input: [[1,3],[2,6],[8,10],[15,18]] Output: [[1,6],[8,10],[15,18]] Explanation: Since intervals [1,3] and [2,6] overlaps, merge them into [1,6]. Example 2: Input: [[1,4],[4,5]] Output: [[1,5]] Explanation: Interval...
class InsertQueryComposer(object): _insert_part = None _values_part_template = None _values_part = None values_count = None def __init__(self, table_name, columns): columns_clause = "" values_clause = "" for column in columns: columns_clause += "`{column_name}`, ...
class Insertquerycomposer(object): _insert_part = None _values_part_template = None _values_part = None values_count = None def __init__(self, table_name, columns): columns_clause = '' values_clause = '' for column in columns: columns_clause += '`{column_name}`, ...
# parsetable.py # This file is automatically generated. Do not edit. _tabversion = '3.10' _lr_method = 'LALR' _lr_signature = 'AND ARRAY ASSIGNMENT BINDIGSEQ CASE CHAR COLON COMMA COMMENT CONST DIGSEQ DIV DO DOT DOTDOT DOWNTO ELSE END EQUAL FOR FORWARD FUNCTION GE GOTO GT HEXDIGSEQ IDENTIFIER IF IN LABEL LBRAC LE LP...
_tabversion = '3.10' _lr_method = 'LALR' _lr_signature = 'AND ARRAY ASSIGNMENT BINDIGSEQ CASE CHAR COLON COMMA COMMENT CONST DIGSEQ DIV DO DOT DOTDOT DOWNTO ELSE END EQUAL FOR FORWARD FUNCTION GE GOTO GT HEXDIGSEQ IDENTIFIER IF IN LABEL LBRAC LE LPAREN LT MINUS MOD NIL NOT NOTEQUAL OCTDIGSEQ OF OR OTHERWISE PACKED PBEG...
# coding: utf-8 # # Copyright 2022 :Barry-Thomas-Paul: Moss # # 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 applicab...
class Formcomponenttype(object): """ Const Class These constants specify the class types used to identify a component. See Also: `API FormComponentType <https://api.libreoffice.org/docs/idl/ref/namespacecom_1_1sun_1_1star_1_1form_1_1FormComponentType.html>`_ """ __ooo_ns__: str = 'com....
# program to display student's marks from record student_n = 'Soyuj' marks = {'James': 90, 'Jules': 55, 'Arthur': 77} for student in marks: if student == student_n: print(marks[student]) break else: print('No entry with that name found.')
student_n = 'Soyuj' marks = {'James': 90, 'Jules': 55, 'Arthur': 77} for student in marks: if student == student_n: print(marks[student]) break else: print('No entry with that name found.')
def shouldAttack(target): return target and target.type != "burl" while True: enemy = hero.findNearestEnemy() if shouldAttack(enemy): hero.attack(enemy)
def should_attack(target): return target and target.type != 'burl' while True: enemy = hero.findNearestEnemy() if should_attack(enemy): hero.attack(enemy)
# Author: Chaojie Wang <xd_silly@163.com>; Jiawen Wu <wjw19960807@163.com>; Wei Zhao <13279389260@163.com> # License: BSD-3-Claus class Params(object): def __init__(self): """ The basic class for storing the parameters in the probabilistic model """ super(Params, self).__init__() ...
class Params(object): def __init__(self): """ The basic class for storing the parameters in the probabilistic model """ super(Params, self).__init__() class Basic_Model(object): def __init__(self, *args, **kwargs): """ The basic model for all probabilistic mode...
class AbstractPoint(object): __slots__ = ('x', 'y') def __init__(self, x, y): self.x = self.field()(x) self.y = self.field()(y) def __neg__(self): return self.neg() def __add__(self, other): return self.add(other) def __sub__(self, other): return self.add(other.neg()) def __mul__(self, n): retur...
class Abstractpoint(object): __slots__ = ('x', 'y') def __init__(self, x, y): self.x = self.field()(x) self.y = self.field()(y) def __neg__(self): return self.neg() def __add__(self, other): return self.add(other) def __sub__(self, other): return self.add(...
class Animal: cat = "cat" dog = "dog" panda = "panda" koala = "koala" fox = "fox" bird = "bird" racoon = "racoon" kangaroo = "kangaroo" elephant = "elephant" giraffe = "giraffe" whale = "whale" birb = "birb" raccoon = "raccoon" class Gif: wink = "wink" pat = ...
class Animal: cat = 'cat' dog = 'dog' panda = 'panda' koala = 'koala' fox = 'fox' bird = 'bird' racoon = 'racoon' kangaroo = 'kangaroo' elephant = 'elephant' giraffe = 'giraffe' whale = 'whale' birb = 'birb' raccoon = 'raccoon' class Gif: wink = 'wink' pat = ...
##### Functions ################################################################ def lgis3( seq, count ): ''' Returns reversed version of (a) longest increasing subsequence. seq: the sequence for which (a) longest increasing subsequence is desired. count: number of items in seq Notes: Uses "P...
def lgis3(seq, count): """ Returns reversed version of (a) longest increasing subsequence. seq: the sequence for which (a) longest increasing subsequence is desired. count: number of items in seq Notes: Uses "Patience Sorting" Each 'pile' is a subsequence with the opposite polarity {decrea...
# Copyright 2017 John McGehee # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing...
"""This module is for testing pyfakefs :py:class:`fake_filesystem_unittest.Patcher`. It defines attributes that have the same names as file modules, sudh as 'io` and `path`. Since these are not modules, :py:class:`fake_filesystem_unittest.Patcher` should not patch them. Whenever a new module is added to :py:meth:`fa...
class Customer(object): def __init__(self, match, customer, **kwargs): self.id = kwargs.get('id', None) self.match = match self.customer = customer def __repr__(self): return 'Customer(id=%r, match=%r, customer=%r)' % ( self.id, self.match, self.customer) @cla...
class Customer(object): def __init__(self, match, customer, **kwargs): self.id = kwargs.get('id', None) self.match = match self.customer = customer def __repr__(self): return 'Customer(id=%r, match=%r, customer=%r)' % (self.id, self.match, self.customer) @classmethod d...
# -*- coding: utf-8 -*- """ Created on Sat Mar 2 22:24:05 2019 @author: Pooyan """ #this code must be checked x=10 if x<20: print('hello...') else: print('good Bye')
""" Created on Sat Mar 2 22:24:05 2019 @author: Pooyan """ x = 10 if x < 20: print('hello...') else: print('good Bye')
# -*- coding: utf-8 -*- """ 322. Coin Change You are given coins of different denominations and a total amount of money amount. Write a function to compute the fewest number of coins that you need to make up that amount. If that amount of money cannot be made up by any combination of the coins, return -1. Note: You m...
""" 322. Coin Change You are given coins of different denominations and a total amount of money amount. Write a function to compute the fewest number of coins that you need to make up that amount. If that amount of money cannot be made up by any combination of the coins, return -1. Note: You may assume that you have ...
{ 'variables': { 'zmq_shared%': 'false', 'zmq_draft%': 'false', 'zmq_no_sync_resolve%': 'false', }, 'targets': [ { 'target_name': 'libzmq', 'type': 'none', 'conditions': [ ["zmq_shared == 'false'", { 'actions': [{ 'action_name': 'build_libzmq', ...
{'variables': {'zmq_shared%': 'false', 'zmq_draft%': 'false', 'zmq_no_sync_resolve%': 'false'}, 'targets': [{'target_name': 'libzmq', 'type': 'none', 'conditions': [["zmq_shared == 'false'", {'actions': [{'action_name': 'build_libzmq', 'inputs': ['package.json'], 'outputs': ['libzmq/lib'], 'action': ['sh', '<(PRODUCT_D...
#n! = 1 * 2 * 3 * 4 ..... * n #n! = [1 * 2 * 3 * 4 ..... n-1]* n #n! = n * (n-1)! # n = 7 # product = 1 # for i in range(n): # product = product * (i+1) # print(product) def factorial_iter(n): product = 1 for i in range(n): product = product * (i+1) return product def factorial_recursive(n):...
def factorial_iter(n): product = 1 for i in range(n): product = product * (i + 1) return product def factorial_recursive(n): if n == 1 or n == 0: return 1 return n * factorial_recursive(n - 1) f = factorial_recursive(3) print(f)
def remove_whilespace_nodes(node, unlink=False): """Removes all of the whitespace-only text decendants of a DOM node. When creating a DOM from an XML source, XML parsers are required to consider several conditions when deciding whether to include whitespace-only text nodes. This function ignores al...
def remove_whilespace_nodes(node, unlink=False): """Removes all of the whitespace-only text decendants of a DOM node. When creating a DOM from an XML source, XML parsers are required to consider several conditions when deciding whether to include whitespace-only text nodes. This function ignores al...
""" image process detail byte, int, float, double, rgb """
""" image process detail byte, int, float, double, rgb """
#!/usr/bin/env python2 # The MIT License (MIT) # # Copyright (c) 2015 Shane O'Connor # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the r...
rgb_colors = dict(neon_green='#39FF14', brown='#774400', purple='#440077', cornflower_blue='#6495ED', firebrick='#B22222')
class Cell: def __init__(self, c=' '): self.c = c self.highlight = {} def __mul__(self, n): return [Cell(self.c) for i in range(n)] def __str__(self): return self.c class Highlight: def __init__(self, line, highlight): self.line = line self.highlight = ...
class Cell: def __init__(self, c=' '): self.c = c self.highlight = {} def __mul__(self, n): return [cell(self.c) for i in range(n)] def __str__(self): return self.c class Highlight: def __init__(self, line, highlight): self.line = line self.highlight ...
def parse_args(r_args): columns = r_args.get('columns') args = {key:value for (key,value) in r_args.items() if key not in ('columns', 'api_key')} return columns, args
def parse_args(r_args): columns = r_args.get('columns') args = {key: value for (key, value) in r_args.items() if key not in ('columns', 'api_key')} return (columns, args)