content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
# Copyright 2014 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...
load('@io_bazel_rules_go//go/private:mode.bzl', 'NORMAL_MODE') load('@io_bazel_rules_go//go/private:actions/action.bzl', 'action_with_go_env') def emit_asm(ctx, go_toolchain, source=None, hdrs=[], out_obj=None, mode=NORMAL_MODE): """See go/toolchains.rst#asm for full documentation.""" if source == None: ...
#!/usr/bin/python3 #------------------------------------------------------------------------------ class Solution: def romanToInt(self, s): """ :type s: str :rtype: int """ result = 0 for i in range(len(s)): if s[i] =='M': result += 1000 ...
class Solution: def roman_to_int(self, s): """ :type s: str :rtype: int """ result = 0 for i in range(len(s)): if s[i] == 'M': result += 1000 elif s[i] == 'D': result += 500 elif s[i] == 'C': ...
class Solution: def findErrorNums(self, nums: List[int]) -> List[int]: """Hash table. """ c = Counter(nums) res = [] m, d = None, None for i in range(1, len(nums) + 1): if i not in c: m = i if i in c and c[i] == 2: ...
class Solution: def find_error_nums(self, nums: List[int]) -> List[int]: """Hash table. """ c = counter(nums) res = [] (m, d) = (None, None) for i in range(1, len(nums) + 1): if i not in c: m = i if i in c and c[i] == 2: ...
""" Module docstring """ def well_formed(): """ Function docstring """ a = attr.string_list() if repr(a) != "<attr.string_list>": fail("Expected attr.string_list instance") a = attr.string_list(mandatory = True, doc = "Some string_list", default = ["foo"]) if repr(a) != "<attr.string_list>"...
""" Module docstring """ def well_formed(): """ Function docstring """ a = attr.string_list() if repr(a) != '<attr.string_list>': fail('Expected attr.string_list instance') a = attr.string_list(mandatory=True, doc='Some string_list', default=['foo']) if repr(a) != '<attr.string_list>': ...
""" You are given a string s, and an array of pairs of indices in the string pairs where pairs[i] = [a, b] indicates 2 indices(0-indexed) of the string. You can swap the characters at any pair of indices in the given pairs any number of times. Return the lexicographically smallest string that s can be cha...
""" You are given a string s, and an array of pairs of indices in the string pairs where pairs[i] = [a, b] indicates 2 indices(0-indexed) of the string. You can swap the characters at any pair of indices in the given pairs any number of times. Return the lexicographically smallest string that s can be cha...
#!/usr/bin/env python # coding: utf-8 # vim: ai ts=4 sts=4 et sw=4 nu """ nnnnEmpty modules required for unit tests. """
""" nnnnEmpty modules required for unit tests. """
SECRET_KEY = 'fake-key' ALLOWED_ADMIN_IP_LIST = ['xxx.xxx.xxx.xxx', 'xxx.xx.xx.xx'] MIDDLEWARE = [ 'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'admin_ip_restrictor.middleware....
secret_key = 'fake-key' allowed_admin_ip_list = ['xxx.xxx.xxx.xxx', 'xxx.xx.xx.xx'] middleware = ['django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'admin_ip_restrictor.middleware.AdminIPRestrictorMi...
""" 57. Insert Interval https://leetcode.com/problems/insert-interval/ Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary). You may assume that the intervals were initially sorted according to their start times. Example: Input: intervals = [[1,3],[6,9]], newInterv...
""" 57. Insert Interval https://leetcode.com/problems/insert-interval/ Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary). You may assume that the intervals were initially sorted according to their start times. Example: Input: intervals = [[1,3],[6,9]], newInterv...
"""fire_incidents_pipeline - An opinionated, minimal cookiecutter template for Python packages""" __version__ = '0.1.0' __author__ = 'Juan Laverde <juanelveerde@outlook.com>' __all__ = []
"""fire_incidents_pipeline - An opinionated, minimal cookiecutter template for Python packages""" __version__ = '0.1.0' __author__ = 'Juan Laverde <juanelveerde@outlook.com>' __all__ = []
print('====== DESAFIO 008 ======') medida = float(input('Digite um valor em metros: ')) cm = medida * 100 mm = medida * 1000 print('A medida de {}m corresponde a {:.0f}cm e a {:.0f}mm'.format(medida, cm, mm))
print('====== DESAFIO 008 ======') medida = float(input('Digite um valor em metros: ')) cm = medida * 100 mm = medida * 1000 print('A medida de {}m corresponde a {:.0f}cm e a {:.0f}mm'.format(medida, cm, mm))
class BaseMatrix: """A basic matrix object class!""" def __init__(self, rows, cols, data = None): self._numRows = rows self._numCols = cols if data == None: self._data = [0]*rows*cols elif len(data)>rows*cols: raise BufferError("data must be able to fit i...
class Basematrix: """A basic matrix object class!""" def __init__(self, rows, cols, data=None): self._numRows = rows self._numCols = cols if data == None: self._data = [0] * rows * cols elif len(data) > rows * cols: raise buffer_error('data must be able t...
class Solution: def minFallingPathSum(self, A: List[List[int]]) -> int: if not A or not A[0]: return 0 m, n = len(A), len(A[0]) dp = [[0] * n for _ in range(m)] for i in range(m): for j in range(n): if i == 0: dp[i]...
class Solution: def min_falling_path_sum(self, A: List[List[int]]) -> int: if not A or not A[0]: return 0 (m, n) = (len(A), len(A[0])) dp = [[0] * n for _ in range(m)] for i in range(m): for j in range(n): if i == 0: dp[i][...
def invoke(pkg): if not (pkg.destdir / "rdeps").is_file(): return pkg.logger.out_plain(" " + (pkg.destdir / "rdeps").read_text())
def invoke(pkg): if not (pkg.destdir / 'rdeps').is_file(): return pkg.logger.out_plain(' ' + (pkg.destdir / 'rdeps').read_text())
def flatten(aList): ''' aList: a list Returns a copy of aList, which is a flattened version of aList ''' flat = [] for e in aList: if (isinstance(e, list)): flat.extend(flatten(e)) else: flat.append(e) return flat
def flatten(aList): """ aList: a list Returns a copy of aList, which is a flattened version of aList """ flat = [] for e in aList: if isinstance(e, list): flat.extend(flatten(e)) else: flat.append(e) return flat
""" Copyright (c) 2021 Tilo van Ekeris / TMDT, University of Wuppertal Distributed under the MIT license, see the accompanying file LICENSE or https://opensource.org/licenses/MIT """ class ErrorCode: @staticmethod def extract(args): return args[2][5]
""" Copyright (c) 2021 Tilo van Ekeris / TMDT, University of Wuppertal Distributed under the MIT license, see the accompanying file LICENSE or https://opensource.org/licenses/MIT """ class Errorcode: @staticmethod def extract(args): return args[2][5]
def saludar(): print("hola a todos") saludar() def dibujar_tabla(): for i in range(5): print("5 * {} = {}".format(i, 5 * i)) dibujar_tabla()
def saludar(): print('hola a todos') saludar() def dibujar_tabla(): for i in range(5): print('5 * {} = {}'.format(i, 5 * i)) dibujar_tabla()
# -*- coding: utf-8 -*- # Copyright 2021 Cohesity Inc. class GcpTagTypeEnum(object): """Implementation of the 'GcpTagTypeEnum' enum. Specifies the tag attribute type of GCP. Going forward, there will be an additional TagTypes for AWS as well. Specifies the type of the tag GCP entity refers to. 'k...
class Gcptagtypeenum(object): """Implementation of the 'GcpTagTypeEnum' enum. Specifies the tag attribute type of GCP. Going forward, there will be an additional TagTypes for AWS as well. Specifies the type of the tag GCP entity refers to. 'kNetworkTag' indicates a network tag present on instances....
class ProcessedTweet: def __init__(self,term,id_str,text,latitude,longitude,country,state,city,creation_date,polarity,subjectivity,classification,neg_score,pos_score): self.term = term self.id_str = id_str self.text = text self.latitude=latitude self.longitude=longitude ...
class Processedtweet: def __init__(self, term, id_str, text, latitude, longitude, country, state, city, creation_date, polarity, subjectivity, classification, neg_score, pos_score): self.term = term self.id_str = id_str self.text = text self.latitude = latitude self.longitud...
__all__ = [ 'AnalyzerUtility', 'CollectorUtility', 'common', 'constant', 'dependency', 'df_utility', 'digit_utility', 'FactorUtility', 'plugin_manager', 'securities_selector', 'TableViewEx', 'task_queue', 'time_utility', 'ui_utility', ]
__all__ = ['AnalyzerUtility', 'CollectorUtility', 'common', 'constant', 'dependency', 'df_utility', 'digit_utility', 'FactorUtility', 'plugin_manager', 'securities_selector', 'TableViewEx', 'task_queue', 'time_utility', 'ui_utility']
KBsize = 1024 class ROM: sNES = "NES" # 3 byte def __init__(self, romFile): if (romFile.read(3) == self.sNES): _ = romFile.read(1) self.num16ROMBanks = int(romFile.read(1).encode('hex'), 16) self.num8ROMBanks = int(romFile.read(1).encode('hex'), 16) sel...
k_bsize = 1024 class Rom: s_nes = 'NES' def __init__(self, romFile): if romFile.read(3) == self.sNES: _ = romFile.read(1) self.num16ROMBanks = int(romFile.read(1).encode('hex'), 16) self.num8ROMBanks = int(romFile.read(1).encode('hex'), 16) self.ctrl1 = ...
# -*- coding: UTF-8 -*- # Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string. # If the last word does not exist, return 0. # # Note: A word is defined as a character sequence consists of non-space characters only. # # For example, # Give...
class Lengthoflastword(object): def length_of_last_word(self, s): """ :type s: str :rtype: int """ if s is None or len(s) == 0: return 0 strings = s.split(' ') for string in strings[::-1]: if len(string) != 0: return le...
class Comment(object): """Object containing all comment information""" def __init__(self, text: str, author: int, time: float, **kwargs): super(Comment, self).__init__(**kwargs) self.author = author self.text = text self.time = time
class Comment(object): """Object containing all comment information""" def __init__(self, text: str, author: int, time: float, **kwargs): super(Comment, self).__init__(**kwargs) self.author = author self.text = text self.time = time
# https://codeforces.com/contest/1327/problem/B for _ in range(int(input())): range_n = range(1, int(input()) + 1) available_women = set() available_men = set() for i in range_n: available_women.add(i) available_men.add(i) for woman in range_n: wanted_men = input().split()[1:] for man in wanted_men: ma...
for _ in range(int(input())): range_n = range(1, int(input()) + 1) available_women = set() available_men = set() for i in range_n: available_women.add(i) available_men.add(i) for woman in range_n: wanted_men = input().split()[1:] for man in wanted_men: man...
# -*- coding:utf-8 -*- """exceptions module""" __all__ = ['TimeframeError', 'SymbolError', 'CurrencyError', 'SideError'] class TimeframeError(ValueError): def __init__(self, timeframe, exchange=None): exchange = f' {str(exchange)}' if exchange else '.' super().__init__(f'{str(timeframe)} is not ...
"""exceptions module""" __all__ = ['TimeframeError', 'SymbolError', 'CurrencyError', 'SideError'] class Timeframeerror(ValueError): def __init__(self, timeframe, exchange=None): exchange = f' {str(exchange)}' if exchange else '.' super().__init__(f'{str(timeframe)} is not a valid timeframe for exc...
def evenodd_mergesort(x): if len(x)<=1: return x else: first = evenodd_mergesort(x[:len(x)/2]) second = evenodd_mergesort(x[len(x)/2:]) return evenodd_merge(first + second) def evenodd_merge(x): if len(x) == 2: if x[1]< x[0]: #swap x[0], x[1] = x[1], x[0]...
def evenodd_mergesort(x): if len(x) <= 1: return x else: first = evenodd_mergesort(x[:len(x) / 2]) second = evenodd_mergesort(x[len(x) / 2:]) return evenodd_merge(first + second) def evenodd_merge(x): if len(x) == 2: if x[1] < x[0]: (x[0], x[1]) = (x[1], ...
#!/usr/bin/env python3 __author__ = "Vijini Mallawaarachchi" __copyright__ = "Copyright 2019-2022, GraphBin Project" __credits__ = ["Vijini Mallawaarachchi", "Anuradha Wickramarachchi", "Yu Lin"] __license__ = "BSD-3" __version__ = "1.6.0" __maintainer__ = "Vijini Mallawaarachchi" __email__ = "vijini.mallawaarachchi@a...
__author__ = 'Vijini Mallawaarachchi' __copyright__ = 'Copyright 2019-2022, GraphBin Project' __credits__ = ['Vijini Mallawaarachchi', 'Anuradha Wickramarachchi', 'Yu Lin'] __license__ = 'BSD-3' __version__ = '1.6.0' __maintainer__ = 'Vijini Mallawaarachchi' __email__ = 'vijini.mallawaarachchi@anu.edu.au' __status__ = ...
class Taxonomy(object): def __init__(self, name, taxons={}): self.name = name self.taxons = taxons def inherit(self, parentTaxonomy): for name, value in parentTaxonomy.get_taxons().iteritems(): if name in self.taxons: continue self.taxons[name] =...
class Taxonomy(object): def __init__(self, name, taxons={}): self.name = name self.taxons = taxons def inherit(self, parentTaxonomy): for (name, value) in parentTaxonomy.get_taxons().iteritems(): if name in self.taxons: continue self.taxons[name]...
# # PySNMP MIB module ADTRAN-AOS (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ADTRAN-AOS # Produced by pysmi-0.3.4 at Wed May 1 11:13:55 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:...
(ad_shared, ad_identity_shared) = mibBuilder.importSymbols('ADTRAN-MIB', 'adShared', 'adIdentityShared') (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_...
api_key = "" headers = {} prev_response = {} _base = 'http://api.football-data.org' endpoints = { 'fixture': _base + '/v1/fixtures/{}', 'all_fixtures': _base + '/v1/fixtures/', 'competition': _base + '/v1/competitions/{}', 'all_competitions': _base + '/v1/competitions/', 'comp_teams': _base + '/v1/...
api_key = '' headers = {} prev_response = {} _base = 'http://api.football-data.org' endpoints = {'fixture': _base + '/v1/fixtures/{}', 'all_fixtures': _base + '/v1/fixtures/', 'competition': _base + '/v1/competitions/{}', 'all_competitions': _base + '/v1/competitions/', 'comp_teams': _base + '/v1/competitions/{}/teams'...
def isPrime(n): ''' Checks for a prime number.<br> Input - `n`, any integer <br> Output - boolean value ''' c=0 for i in range(2,n): if n%i==0: c=c+1 if c==0 and n!=1: return 1 else: return 0 ############################### def sum(a,b): ''...
def is_prime(n): """ Checks for a prime number.<br> Input - `n`, any integer <br> Output - boolean value """ c = 0 for i in range(2, n): if n % i == 0: c = c + 1 if c == 0 and n != 1: return 1 else: return 0 def sum(a, b): """ Adds to numb...
# Bubble Sort arr = [25, 15, -6, 8, 2] n = len(arr) for i in range(0,n-1,1): for j in range(0, n-i-1,1): if arr[j] > arr[j + 1] : arr[j], arr[j + 1] = arr[j + 1], arr[j] print ("Sorted array is:") for i in range(len(arr)): print (arr[i])
arr = [25, 15, -6, 8, 2] n = len(arr) for i in range(0, n - 1, 1): for j in range(0, n - i - 1, 1): if arr[j] > arr[j + 1]: (arr[j], arr[j + 1]) = (arr[j + 1], arr[j]) print('Sorted array is:') for i in range(len(arr)): print(arr[i])
class NBCollectionCIException(Exception): pass class InstallException(NBCollectionCIException): pass class InvalidRepoPath(NBCollectionCIException): pass class VENVValidationException(NBCollectionCIException): pass class VENVInstallException(NBCollectionCIException): pass class RendererExc...
class Nbcollectionciexception(Exception): pass class Installexception(NBCollectionCIException): pass class Invalidrepopath(NBCollectionCIException): pass class Venvvalidationexception(NBCollectionCIException): pass class Venvinstallexception(NBCollectionCIException): pass class Rendererexceptio...
# -*- coding: utf-8 -*- class Schema(object): CLONE = "clone" COMMIT = "commit" DATE = "date" HOST = "host" LANGUAGE = "language" REPO = "repo" URL = "url" schemas = [ Schema.HOST, Schema.REPO, Schema.LANGUAGE, Schema.URL, Schema.CLONE, Schema.COMMIT, Schema.D...
class Schema(object): clone = 'clone' commit = 'commit' date = 'date' host = 'host' language = 'language' repo = 'repo' url = 'url' schemas = [Schema.HOST, Schema.REPO, Schema.LANGUAGE, Schema.URL, Schema.CLONE, Schema.COMMIT, Schema.DATE]
""" Lecture 8 Functions return function should always be the last command in function """ #positional argument def my_function(a, b): result = a + b print('a is',a) print('b is',b) return result print(my_function(2, 1)) def my_function(a, b=0): result = a + b print('a is',a) print('b is'...
""" Lecture 8 Functions return function should always be the last command in function """ def my_function(a, b): result = a + b print('a is', a) print('b is', b) return result print(my_function(2, 1)) def my_function(a, b=0): result = a + b print('a is', a) print('b is', b) return resu...
# Copyright (c) 2021, salesforce.com, inc. # All rights reserved. # SPDX-License-Identifier: BSD-3-Clause # For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause """ This implementation is modified from https://github.com/BouchardLab/DynamicalComponentsAnalysis/tr...
""" This implementation is modified from https://github.com/BouchardLab/DynamicalComponentsAnalysis/tree/master/dca *** License Agreement *** Dynamical Components Analysis (DCA) Copyright (c) 2021, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any re...
def get_sync_data(): return { "status": "success", "data": { "id": 61, "label": None, "schedule_frequency": "never", "schedule_day": None, "schedule_hour": None, "schedule_minute": None, "created_at": "2021-10-22T00...
def get_sync_data(): return {'status': 'success', 'data': {'id': 61, 'label': None, 'schedule_frequency': 'never', 'schedule_day': None, 'schedule_hour': None, 'schedule_minute': None, 'created_at': '2021-10-22T00:40:11.246Z', 'updated_at': '2021-10-22T00:43:44.173Z', 'operation': 'upsert', 'paused': False, 'status...
class TestConceptsSearch: def test_concepts_search(self, client): res = client.get("/concepts?search=science") json_data = res.get_json() assert json_data["meta"]["count"] == 125 assert "science" in json_data["results"][0]["display_name"].lower() for result in json_data["resu...
class Testconceptssearch: def test_concepts_search(self, client): res = client.get('/concepts?search=science') json_data = res.get_json() assert json_data['meta']['count'] == 125 assert 'science' in json_data['results'][0]['display_name'].lower() for result in json_data['res...
class Solution: def isValid(self, s): """ :type s: str :rtype: bool """ if not s: return True s = list(s) my_stack = [] if s[0] in [')', ']', '}']: return False for i in range(len(s)): if s[i] in ['(', '[', '...
class Solution: def is_valid(self, s): """ :type s: str :rtype: bool """ if not s: return True s = list(s) my_stack = [] if s[0] in [')', ']', '}']: return False for i in range(len(s)): if s[i] in ['(', '[',...
# Settings used to fill the XML with data settings = { "product_page_url_prefix": "https://www.mysite.com/myproducts/", "filters": { "fieldType": ["Variant"], "name": ["Name1"] }, "category": "Product Category" }
settings = {'product_page_url_prefix': 'https://www.mysite.com/myproducts/', 'filters': {'fieldType': ['Variant'], 'name': ['Name1']}, 'category': 'Product Category'}
class MinHeap: def __init__(self, heap, heap_size=None): self.heap = heap self.heap_size = heap_size if heap_size else len(heap) self.build() def left(self, index): left_index = 2 * index if left_index > self.heap_size: return None return left_index ...
class Minheap: def __init__(self, heap, heap_size=None): self.heap = heap self.heap_size = heap_size if heap_size else len(heap) self.build() def left(self, index): left_index = 2 * index if left_index > self.heap_size: return None return left_index ...
class Token: def __init__(self, literal): self.literal = literal def __repr__(self): return f"{self.__class__.__qualname__}({self.literal})" class ILLEGAL(Token): def __init__(self, literal): self.literal = literal class EOF(Token): def __init__(self): self.literal = ...
class Token: def __init__(self, literal): self.literal = literal def __repr__(self): return f'{self.__class__.__qualname__}({self.literal})' class Illegal(Token): def __init__(self, literal): self.literal = literal class Eof(Token): def __init__(self): self.literal ...
class mockLight: def __init__(self): self.color = None self.curR = None self.curG = None self.curB = None def testInput(self, r, g, b, colorName): if isinstance(r, int) & isinstance(g, int) & isinstance(b, int) & isinstance(colorName, str): if 0 <= r <= 255 ...
class Mocklight: def __init__(self): self.color = None self.curR = None self.curG = None self.curB = None def test_input(self, r, g, b, colorName): if isinstance(r, int) & isinstance(g, int) & isinstance(b, int) & isinstance(colorName, str): if 0 <= r <= 255...
#!/usr/bin/env python3 n = int(input()) a = n // 2 a = a * 2 print(n == a)
n = int(input()) a = n // 2 a = a * 2 print(n == a)
""" Hackerrank Problem: https://www.hackerrank.com/challenges/zipped/problem """ # Read in the input values for how many lines to read n, x = map(int, input().split(" ")) scores = [] # Iterate through inputs and get the number of scores for i in range(x): input_scores = list(map(float, input().split(" "))) scor...
""" Hackerrank Problem: https://www.hackerrank.com/challenges/zipped/problem """ (n, x) = map(int, input().split(' ')) scores = [] for i in range(x): input_scores = list(map(float, input().split(' '))) scores.append(input_scores) averages = zip(*scores) for score in averages: print(sum(score) / len(scores))
class Solution: def moveZeroes(self, nums): """ Do not return anything, modify nums in-place instead. """ cnt = 0 for i in range(len(nums)): if nums[i] != 0: nums[i], nums[cnt] = nums[cnt], nums[i] cnt += 1 if __name__ == "__main_...
class Solution: def move_zeroes(self, nums): """ Do not return anything, modify nums in-place instead. """ cnt = 0 for i in range(len(nums)): if nums[i] != 0: (nums[i], nums[cnt]) = (nums[cnt], nums[i]) cnt += 1 if __name__ == '__m...
class LineFeeder: def __init__(self, parts): self.parts = parts self.number = 0 def read(self) -> str: return self.parts[self.number] def pop(self) -> str: text = self.parts[self.number] self.number += 1 return text def back(self): if self.numbe...
class Linefeeder: def __init__(self, parts): self.parts = parts self.number = 0 def read(self) -> str: return self.parts[self.number] def pop(self) -> str: text = self.parts[self.number] self.number += 1 return text def back(self): if self.numb...
#!/usr/bin/env python # -*- coding: utf-8 -*- class PyOWMError(Exception): """Generic base class for PyOWM exceptions""" pass class ConfigurationError(PyOWMError): """Generic base class for configuration related errors""" pass class ConfigurationNotFoundError(ConfigurationError): """Raised whe...
class Pyowmerror(Exception): """Generic base class for PyOWM exceptions""" pass class Configurationerror(PyOWMError): """Generic base class for configuration related errors""" pass class Configurationnotfounderror(ConfigurationError): """Raised when configuration source file is not available""" ...
""" Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order. You may assume no duplicates in the array. Example 1: Input: [1,3,5,6], 5 Output: 2 Solution: 1. linear search 2. binary search """ # linear search # Time-...
""" Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order. You may assume no duplicates in the array. Example 1: Input: [1,3,5,6], 5 Output: 2 Solution: 1. linear search 2. binary search """ class Solution: def...
# Set Stock Symbol as the index listings = listings.set_index('Stock Symbol') # Get ticker of the largest consumer services company listed after 1997 ticker = listings.loc[(listings.Sector == 'Consumer Services') & (listings['IPO Year'] > 1998), 'Market Capitalization'].idxmax() # Set the start date start = date(1998...
listings = listings.set_index('Stock Symbol') ticker = listings.loc[(listings.Sector == 'Consumer Services') & (listings['IPO Year'] > 1998), 'Market Capitalization'].idxmax() start = date(1998, 1, 1) data = data_reader(ticker, 'google', start) data[['Close', 'Volume']].plot(secondary_y='Volume', title=ticker) plt.show...
colors = {"clean": "\033[m", "red": "\033[31m", "green": "\033[32m", "yellow": "\033[33m", "blue": "\033[34m", "purple": "\033[35m", "cian": "\033[36m"} ans = 1 while ans == 1: ch, n1, n2 = 4, 0, 0 while ch == 4: n1 = int(input("Enter a number:...
colors = {'clean': '\x1b[m', 'red': '\x1b[31m', 'green': '\x1b[32m', 'yellow': '\x1b[33m', 'blue': '\x1b[34m', 'purple': '\x1b[35m', 'cian': '\x1b[36m'} ans = 1 while ans == 1: (ch, n1, n2) = (4, 0, 0) while ch == 4: n1 = int(input('Enter a number: ')) n2 = int(input('Enter a number: ')) ...
class Subject: def register_observer(): raise NotImplementedError def remove_observer(): raise NotImplementedError def notify_observers(): raise NotImplementedError class Observer: def update(): raise NotImplementedError class DisplayElement: def display(): ...
class Subject: def register_observer(): raise NotImplementedError def remove_observer(): raise NotImplementedError def notify_observers(): raise NotImplementedError class Observer: def update(): raise NotImplementedError class Displayelement: def display(): ...
class Solution: def countDigitOne(self, n): ones, m = 0, 1 while m <= n: ones += (n//m + 8) // 10 * m + (n//m % 10 == 1) * (n%m + 1) m *= 10 return ones
class Solution: def count_digit_one(self, n): (ones, m) = (0, 1) while m <= n: ones += (n // m + 8) // 10 * m + (n // m % 10 == 1) * (n % m + 1) m *= 10 return ones
def combination(n, m): if m == 0: return 1 if m == 1: return n if n == m: return 1 return combination(n-1, m) + combination(n-1, m-1) def factorial(n): if n == 0: return 1 sumBuf = 1 while n > 0: sumBuf = sumBuf * n n = n -1 return sumBuf ...
def combination(n, m): if m == 0: return 1 if m == 1: return n if n == m: return 1 return combination(n - 1, m) + combination(n - 1, m - 1) def factorial(n): if n == 0: return 1 sum_buf = 1 while n > 0: sum_buf = sumBuf * n n = n - 1 retur...
""" # Definition for a Node. class Node: def __init__(self, val=None, children=None): self.val = val self.children = children """ class Solution: def levelOrder(self, root: 'Node') -> List[List[int]]: if not root: return [] q = deque([root]) ans = [] ...
""" # Definition for a Node. class Node: def __init__(self, val=None, children=None): self.val = val self.children = children """ class Solution: def level_order(self, root: 'Node') -> List[List[int]]: if not root: return [] q = deque([root]) ans = [] ...
"""No library.""" class BadCellException(Exception): """ BadCellException. This class exception is raise when a bad cell is selected. """ pass
"""No library.""" class Badcellexception(Exception): """ BadCellException. This class exception is raise when a bad cell is selected. """ pass
VERSION = (0, 1, 1) GEO_LEVEL_COUNTRY = 0 GEO_LEVEL_REGION = 1 GEO_LEVEL_CITY = 2 LISTINGS_GEO_LEVELS = ( (GEO_LEVEL_COUNTRY, 'Country'), (GEO_LEVEL_REGION, 'Region'), (GEO_LEVEL_CITY, 'City') )
version = (0, 1, 1) geo_level_country = 0 geo_level_region = 1 geo_level_city = 2 listings_geo_levels = ((GEO_LEVEL_COUNTRY, 'Country'), (GEO_LEVEL_REGION, 'Region'), (GEO_LEVEL_CITY, 'City'))
class InteractionAdapter: def agent_reset(self, agent, data): return agent.new_episode() def env_reset(self, env, state): return env.reset() def agent_act(self, agent, state): return agent.act(state) def env_step(self, env, action): return env.step(action) def ag...
class Interactionadapter: def agent_reset(self, agent, data): return agent.new_episode() def env_reset(self, env, state): return env.reset() def agent_act(self, agent, state): return agent.act(state) def env_step(self, env, action): return env.step(action) def ag...
n = int(input()) fs = [i*i for i in range(224)] dp = [4 for x in range(n+1)] visit = [0 for x in range(n+1)] dp[0] = 0 dp[1] = 1 exNum = 50000**2 for i in range(1, n+1): minNum = exNum j = 1 while(not visit[i] and fs[j] <= i): minNum = min(dp[i-fs[j]], minNum) j = j+1 visit[i] = 1 ...
n = int(input()) fs = [i * i for i in range(224)] dp = [4 for x in range(n + 1)] visit = [0 for x in range(n + 1)] dp[0] = 0 dp[1] = 1 ex_num = 50000 ** 2 for i in range(1, n + 1): min_num = exNum j = 1 while not visit[i] and fs[j] <= i: min_num = min(dp[i - fs[j]], minNum) j = j + 1 vis...
class PaginatedResult(object): """ An instance of this class is returned from paginated operations """ def __init__(self, total_items, page_size, current_page): self.total_items = total_items self.page_size = page_size self.current_page = current_page
class Paginatedresult(object): """ An instance of this class is returned from paginated operations """ def __init__(self, total_items, page_size, current_page): self.total_items = total_items self.page_size = page_size self.current_page = current_page
""" Spearman's rank correlation coefficient Link: https://www.hackerrank.com/challenges/s10-spearman-rank-correlation-coefficient """ def rank(X): """ Return the rank of each element in X """ sorted_X = sorted(X) rank = [0]*len(X) for i in range(len(X)): # since index is zero-based, plu...
""" Spearman's rank correlation coefficient Link: https://www.hackerrank.com/challenges/s10-spearman-rank-correlation-coefficient """ def rank(X): """ Return the rank of each element in X """ sorted_x = sorted(X) rank = [0] * len(X) for i in range(len(X)): rank[i] = sorted_X.index(X[i]...
SUCCESS = "SUCCESS" FAILURE = "FAILURE" MISSING = "MISSING" START = "START" PROCESSING_TIME = "PROCESSING_TIME" def event_label(event): """Format event constants for Slack e.g. from `MISSING` to `*Missing*` """ return "{}".format(event.lower().title())
success = 'SUCCESS' failure = 'FAILURE' missing = 'MISSING' start = 'START' processing_time = 'PROCESSING_TIME' def event_label(event): """Format event constants for Slack e.g. from `MISSING` to `*Missing*` """ return '{}'.format(event.lower().title())
# # PySNMP MIB module BROCADE-NP-TM-STATS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/BROCADE-NP-TM-STATS-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:41:08 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 ...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, value_range_constraint, single_value_constraint, constraints_union, constraints_intersection) ...
""" Given a binary tree root and an integer target, delete all the leaf nodes with value target. Note that once you delete a leaf node with value target, if it's parent node becomes a leaf node and has the value target, it should also be deleted (you need to continue doing that until you can't). Example 1: Input: ro...
""" Given a binary tree root and an integer target, delete all the leaf nodes with value target. Note that once you delete a leaf node with value target, if it's parent node becomes a leaf node and has the value target, it should also be deleted (you need to continue doing that until you can't). Example 1: Input: ro...
n = int(input()) even = set() odd = set() for row in range(1, n + 1): name = input() ch_sum = sum([ord(ch) for ch in name]) value = ch_sum // row if value % 2 == 0: even.add(value) else: odd.add(value) even_sum = sum(even) odd_sum = sum(odd) result = set() if odd_sum == even_sum...
n = int(input()) even = set() odd = set() for row in range(1, n + 1): name = input() ch_sum = sum([ord(ch) for ch in name]) value = ch_sum // row if value % 2 == 0: even.add(value) else: odd.add(value) even_sum = sum(even) odd_sum = sum(odd) result = set() if odd_sum == even_sum: ...
"""Zero Plentiful Code Kata, codewars.""" def zero_plentiful(arr): """.""" four_zero_plus = 0 count = 0 if arr == [0]: return 0 if len(arr) == arr.count(0): return 1 for idx, el in enumerate(arr): if el == 0: count += 1 if el != 0 or idx == len(n) - 1...
"""Zero Plentiful Code Kata, codewars.""" def zero_plentiful(arr): """.""" four_zero_plus = 0 count = 0 if arr == [0]: return 0 if len(arr) == arr.count(0): return 1 for (idx, el) in enumerate(arr): if el == 0: count += 1 if el != 0 or idx == len(n) -...
#link: https://leetcode.com/problems/vertical-order-traversal-of-a-binary-tree/solution/ # Definition for a binary tree node. # class TreeNode(object): # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution(object): de...
class Solution(object): def vertical_traversal(self, root): """ :type root: TreeNode :rtype: List[List[int]] """ nodes_list = [] def dfs(root, r, c): if not root: return None nodes_list.append([c, r, root.val]) dfs...
PALETTES = [ ['NES_PALETTE_SMOOTH', 'Smooth (FBX)'], ['NES_PALETTE_CLASSIC', 'NES Classic (FBX)'], ['NES_PALETTE_COMPOSITE', 'Composite Direct (FBX)'], ['NES_PALETTE_PVM_D93', 'PVM Style D93 (FBX)'], ['NES_PALETTE_PC10', 'PC-10'], ['NES_PALETTE_SONY_CXA', 'Sony CXA'], ['NES_PALETTE_WAVEBEAM', 'Wavebeam'], ] if ...
palettes = [['NES_PALETTE_SMOOTH', 'Smooth (FBX)'], ['NES_PALETTE_CLASSIC', 'NES Classic (FBX)'], ['NES_PALETTE_COMPOSITE', 'Composite Direct (FBX)'], ['NES_PALETTE_PVM_D93', 'PVM Style D93 (FBX)'], ['NES_PALETTE_PC10', 'PC-10'], ['NES_PALETTE_SONY_CXA', 'Sony CXA'], ['NES_PALETTE_WAVEBEAM', 'Wavebeam']] if __name__ ==...
class Holder(object): """ A credit card holder. """ def __init__(self, first, last, street, post_code): """ Attaches holder data for later use. """ self.first = first self.last = last self.street = street self.post_code = post_code def __repr_...
class Holder(object): """ A credit card holder. """ def __init__(self, first, last, street, post_code): """ Attaches holder data for later use. """ self.first = first self.last = last self.street = street self.post_code = post_code def __repr...
''' Created on Sep 12, 2011 @author: Nich ''' vowels = ('a', 'e', 'i','o', 'u') #fuck y double_vowels = ('ea', 'ee', 'oo', 'ou') def makeVariants(word): variants = [] return variants def makeInflections(word): inflections = {} if word.category == "NOUN": #do plural inflections["plura...
""" Created on Sep 12, 2011 @author: Nich """ vowels = ('a', 'e', 'i', 'o', 'u') double_vowels = ('ea', 'ee', 'oo', 'ou') def make_variants(word): variants = [] return variants def make_inflections(word): inflections = {} if word.category == 'NOUN': inflections['plural'] = noun_plural(word) ...
class LoginException(Exception): def __init__(self, msg): super().__init__("Error while logging in: {}".format(msg)) class LoginUnknownError(LoginException): def __init__(self, matrix_exc): msg = "Unknown error, check debug log" if hasattr(matrix_exc, "code"): msg += " (co...
class Loginexception(Exception): def __init__(self, msg): super().__init__('Error while logging in: {}'.format(msg)) class Loginunknownerror(LoginException): def __init__(self, matrix_exc): msg = 'Unknown error, check debug log' if hasattr(matrix_exc, 'code'): msg += ' (co...
""" PASSENGERS """ numPassengers = 34614 passenger_arriving = ( (6, 10, 10, 7, 12, 4, 2, 4, 7, 2, 1, 0, 0, 12, 12, 6, 6, 9, 3, 4, 1, 2, 1, 0, 0, 0), # 0 (8, 15, 5, 5, 10, 2, 8, 2, 3, 0, 3, 0, 0, 11, 8, 8, 6, 7, 3, 3, 0, 2, 4, 2, 0, 0), # 1 (8, 11, 5, 12, 12, 5, 5, 4, 4, 1, 4, 1, 0, 10, 8, 7, 5, 9, 11, 6, 0, 4, ...
""" PASSENGERS """ num_passengers = 34614 passenger_arriving = ((6, 10, 10, 7, 12, 4, 2, 4, 7, 2, 1, 0, 0, 12, 12, 6, 6, 9, 3, 4, 1, 2, 1, 0, 0, 0), (8, 15, 5, 5, 10, 2, 8, 2, 3, 0, 3, 0, 0, 11, 8, 8, 6, 7, 3, 3, 0, 2, 4, 2, 0, 0), (8, 11, 5, 12, 12, 5, 5, 4, 4, 1, 4, 1, 0, 10, 8, 7, 5, 9, 11, 6, 0, 4, 1, 0, 3, 0), (11...
def a1_foo(): # reiz: tp ... def ___foo(): # reiz: tp ... def a2_foo_bar(): # reiz: tp ... def a__foo____(): # reiz: tp ... def aa1_foo(): ... def aa1foo(): ... def __afoo_bar(): ...
def a1_foo(): ... def ___foo(): ... def a2_foo_bar(): ... def a__foo____(): ... def aa1_foo(): ... def aa1foo(): ... def __afoo_bar(): ...
description = 'Temporary setup for the mota controller at AMOR' includes = ['detector_stage'] devices = dict( nu = device('nicos_sinq.amor.devices.logical_motor.DetectorAngleMotor', description = 'Intended detector angle', com = 'com', coz = 'coz', coz_scale_factor = 4100, ...
description = 'Temporary setup for the mota controller at AMOR' includes = ['detector_stage'] devices = dict(nu=device('nicos_sinq.amor.devices.logical_motor.DetectorAngleMotor', description='Intended detector angle', com='com', coz='coz', coz_scale_factor=4100, unit=''), mu=device('nicos.devices.generic.DeviceAlias', ...
def count_words(filepath, words_list): """ [According documentation style 'numpydoc' at MODULE level] Terminal command | pyment -w -o numpydoc inches_to_feet.py Flags -w | overwrite -o <style> | styleput in NumPy documentation style Parameters ---------- filepath : <type...
def count_words(filepath, words_list): """ [According documentation style 'numpydoc' at MODULE level] Terminal command | pyment -w -o numpydoc inches_to_feet.py Flags -w | overwrite -o <style> | styleput in NumPy documentation style Parameters ---------- filepath : <type...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- def fibonacci(n): """ object: fibonacci(n) returns the first n Fibonacci numbers in a list input: n- the number used to calculate the fibonacci list return: retList- the fibonacci list """ if type(n) != int: print(n) print(":inp...
def fibonacci(n): """ object: fibonacci(n) returns the first n Fibonacci numbers in a list input: n- the number used to calculate the fibonacci list return: retList- the fibonacci list """ if type(n) != int: print(n) print(':input not an integer') return False if ...
"""Something wrong with Leetcode's testing""" class Solution(object): def licenseKeyFormatting(self, S, K): """ :type S: str :type K: int :rtype: str """ parts = S.split('-') words = list() buff = list() for i in xrange(len(parts)-1, -1, -1): ...
"""Something wrong with Leetcode's testing""" class Solution(object): def license_key_formatting(self, S, K): """ :type S: str :type K: int :rtype: str """ parts = S.split('-') words = list() buff = list() for i in xrange(len(parts) - 1, -1, ...
greet = ' *Hello bob* ' # strip() remove beginning and ending whitespace greet_new = greet.strip() #lstrip() remove left whitespace greet_new1 = greet.lstrip() #rstrip() remove right whitespace greet_new2 = greet.rstrip() print(greet_new) print(greet_new1) print(greet_new2)
greet = ' *Hello bob* ' greet_new = greet.strip() greet_new1 = greet.lstrip() greet_new2 = greet.rstrip() print(greet_new) print(greet_new1) print(greet_new2)
"""djver - Ever wanted to know what version of Django someone else is running?""" __version__ = '0.1.0' __author__ = 'Brenton Cleeland <brenton@brntn.me>' __all__ = []
"""djver - Ever wanted to know what version of Django someone else is running?""" __version__ = '0.1.0' __author__ = 'Brenton Cleeland <brenton@brntn.me>' __all__ = []
# # PySNMP MIB module Nortel-Magellan-Passport-UtpDpnTrunksMIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Nortel-Magellan-Passport-UtpDpnTrunksMIB # Produced by pysmi-0.3.4 at Wed May 1 14:28:35 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davw...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, single_value_constraint, value_size_constraint, constraints_intersection, value_range_constraint) ...
# coding: utf8 """Text Utils""" def get_code_point(char: str) -> str: """ Get Character unicode codepoint Args: char (str): single character Returns: str """ return '%04x' % ord(char)
"""Text Utils""" def get_code_point(char: str) -> str: """ Get Character unicode codepoint Args: char (str): single character Returns: str """ return '%04x' % ord(char)
a = input("First no :") b = input("Second no:") c = int(a)+int(b) print ("sum is :",c)
a = input('First no :') b = input('Second no:') c = int(a) + int(b) print('sum is :', c)
# -*- coding: utf-8 -*- # Copyright 2019 Cohesity Inc. class FileTypeEnum(object): """Implementation of the 'FileType' enum. Specifies the format type of the file that SQL database stores the data. Specifies the format type of the file that SQL database stores the data. 'kRows' refers to a data file ...
class Filetypeenum(object): """Implementation of the 'FileType' enum. Specifies the format type of the file that SQL database stores the data. Specifies the format type of the file that SQL database stores the data. 'kRows' refers to a data file 'kLog' refers to a log file 'kFileStream' refers ...
# Copyright: (c) 2018, Huawei Inc. # GNU General Public License v3.0+ # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) class ModuleDocFragment(object): # HCS doc fragment. DOCUMENTATION = ''' options: auth: description: - Dictionary containing auth information as needed by ...
class Moduledocfragment(object): documentation = "\noptions:\n auth:\n description:\n - Dictionary containing auth information as needed by the cloud's auth plugin strategy.\n type: dict\n suboptions:\n auth_url:\n description:\n - The ...
def labels_to_string(label, vocabulary, blank_index=0): labels = [] for l in label: index_list = [index for index in l if index != blank_index] labels.append(''.join([vocabulary[index] for index in index_list])) return labels
def labels_to_string(label, vocabulary, blank_index=0): labels = [] for l in label: index_list = [index for index in l if index != blank_index] labels.append(''.join([vocabulary[index] for index in index_list])) return labels
# simple example of operathors overloading class Number: def __init__(self, start): """Define attr for Number Args: start (int): any number """ self.data = start def __sub__(self, other): """Overload sub operation for exemplars of Number Args:...
class Number: def __init__(self, start): """Define attr for Number Args: start (int): any number """ self.data = start def __sub__(self, other): """Overload sub operation for exemplars of Number Args: other (int): any number Re...
class LinkedNode(object): def __init__(self, val, _next=None): self._next = _next self.val = val @property def next(self): return self._next @next.setter def next(self, node): self._next = node
class Linkednode(object): def __init__(self, val, _next=None): self._next = _next self.val = val @property def next(self): return self._next @next.setter def next(self, node): self._next = node
class Solution: def removeInterval(self, intervals: List[List[int]], toBeRemoved: List[int]) -> List[List[int]]: res = [] for a, b in intervals: if a < toBeRemoved[0]: res.append([a, min(toBeRemoved[0], b)]) if b > toBeRemoved[1]: res.append([m...
class Solution: def remove_interval(self, intervals: List[List[int]], toBeRemoved: List[int]) -> List[List[int]]: res = [] for (a, b) in intervals: if a < toBeRemoved[0]: res.append([a, min(toBeRemoved[0], b)]) if b > toBeRemoved[1]: res.appen...
def GuildConfig(guild, prefix): return { "id": f"{guild.id}", "prefix": "{}".format(prefix if prefix != "" or prefix != None else "!"), "mute_role": "", "mod_log": "", "message_log": "", "server_log": "", "ignored_channels": [], "ignored_roles"...
def guild_config(guild, prefix): return {'id': f'{guild.id}', 'prefix': '{}'.format(prefix if prefix != '' or prefix != None else '!'), 'mute_role': '', 'mod_log': '', 'message_log': '', 'server_log': '', 'ignored_channels': [], 'ignored_roles': [], 'allowed_invites': [], 'black_listed_links': [], 'tags': {}, 'puni...
abspath = Path(Path.cwd(), FILENAME) if abspath.is_file(): result = 'file' elif abspath.is_dir(): result = 'directory' elif not abspath.exists(): result = 'missing'
abspath = path(Path.cwd(), FILENAME) if abspath.is_file(): result = 'file' elif abspath.is_dir(): result = 'directory' elif not abspath.exists(): result = 'missing'
"""Define constants commonly used throughout STACS CI. SPDX-License-Identifier: BSD-3-Clause """ PATTERN_GIT_DIFF_HEADER = r"^diff\s+.*?a/(.*?)\s+b/(.*)$" PATTERN_GIT_DIFF_HUNK = r"@@\s+-([0-9,]+)\s+\+([0-9,]+)\s+.*@@" PATH_SEPARATOR = "!" # Used to extract hashes of existing comments / bodies of text for deduplica...
"""Define constants commonly used throughout STACS CI. SPDX-License-Identifier: BSD-3-Clause """ pattern_git_diff_header = '^diff\\s+.*?a/(.*?)\\s+b/(.*)$' pattern_git_diff_hunk = '@@\\s+-([0-9,]+)\\s+\\+([0-9,]+)\\s+.*@@' path_separator = '!' pattern_fhash = '\\s+\\*\\*F\\*\\*:([a-f0-9]{40})]' finding_exit_code = 100
class Option(object): def __init__(self, option, otype): self.name = option self.type = otype @staticmethod def process_ports(data): ports = [] if data: for key, value in data.items(): port = key.split("/") port_str = "" ...
class Option(object): def __init__(self, option, otype): self.name = option self.type = otype @staticmethod def process_ports(data): ports = [] if data: for (key, value) in data.items(): port = key.split('/') port_str = '' ...
filename = input().strip() found_id = "" f = open(filename) for line in f: if line[:10] not in found_id: found_id += line[:10]+";" print(line[:10]) f.close()
filename = input().strip() found_id = '' f = open(filename) for line in f: if line[:10] not in found_id: found_id += line[:10] + ';' print(line[:10]) f.close()
# -*- coding: utf-8 -*- ######################################################################### ## Customize your APP title, subtitle and menus here ######################################################################### response.title = 'Example web scraping website' ## read more at http://dev.w3.org/html5/mark...
response.title = 'Example web scraping website' response.meta.author = 'Web Scraping with Python' response.meta.keywords = 'web2py, python, web scraping' response.meta.generator = 'Web2py Web Framework' response.menu = [(t('Home'), False, url('default', 'index'), []), (t('Search'), False, url('default', 'search'), [])]
# Copyright (C) 2021 The Android Open Source Project # # 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...
load('@bazel_skylib//rules:common_settings.bzl', 'BuildSettingInfo') _kernel_build_default_toolchain_version = 'r428724' def _debug_trap(): return "set -x\n trap '>&2 /bin/date' DEBUG" def kernel_build(name, build_config, srcs, outs, deps=(), toolchain_version=_KERNEL_BUILD_DEFAULT_TOOLCHAIN_VERSION)...
# SV configuration SV_FOV = '90' SV_SIZE = '640x640' SV_PITCH = '0' # Network configuration CITIES = {'NYC': 'New York City, New York, USA', 'SF': 'San Francisco, California, USA', 'Seattle': 'Seattle, Washington, USA', 'Boston': 'Boston, Massachusetts, USA', 'Chicago': 'Chicago...
sv_fov = '90' sv_size = '640x640' sv_pitch = '0' cities = {'NYC': 'New York City, New York, USA', 'SF': 'San Francisco, California, USA', 'Seattle': 'Seattle, Washington, USA', 'Boston': 'Boston, Massachusetts, USA', 'Chicago': 'Chicago, Illinois, USA', 'Philadelphia': 'Philadelphia, Pennsylvania, USA', 'DC': 'Washingt...
""" Module for reading and writing the SRT format. Attempts to deal with different encodings in a pass-through fashion: read and write as binary. """ def read_file_tuples(input_file): """ Read an SRT file to (seq, begin, end, text) tuples, where begin and end are float timestamps in seconds. Text is ac...
""" Module for reading and writing the SRT format. Attempts to deal with different encodings in a pass-through fashion: read and write as binary. """ def read_file_tuples(input_file): """ Read an SRT file to (seq, begin, end, text) tuples, where begin and end are float timestamps in seconds. Text is ac...
type_map = { 'CC' :'Coordinating conjunction', 'CD' :'Cardinal number', 'DT' :'Determiner', 'EX' :'Existential there', 'FW' :'Foreign word', 'IN' :'Preposition or subordinating conjunction', 'JJ' :'Adjective', 'JJR' :'Adjective, comparative', 'JJS' :'Adjective, superlative',...
type_map = {'CC': 'Coordinating conjunction', 'CD': 'Cardinal number', 'DT': 'Determiner', 'EX': 'Existential there', 'FW': 'Foreign word', 'IN': 'Preposition or subordinating conjunction', 'JJ': 'Adjective', 'JJR': 'Adjective, comparative', 'JJS': 'Adjective, superlative', 'LS': 'List item marker', 'MD': 'Modal', 'NN'...
''' 350. Intersection of Two Arrays II Given two arrays, write a function to compute their intersection. Example: Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2, 2]. Note: Each element in the result should appear as many times as it shows in both arrays. The result can be in any order. Follow up: - What if t...
""" 350. Intersection of Two Arrays II Given two arrays, write a function to compute their intersection. Example: Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2, 2]. Note: Each element in the result should appear as many times as it shows in both arrays. The result can be in any order. Follow up: - What if t...
def check_name(x,y): print(x) print(y) xx = input('Word1') yy = input('Word2') check_name(xx,yy) def name_check(name): if name.lower() == 'josh': print('He da man') else: print('Who is that?!') zz = input('Word3') name_check(zz)
def check_name(x, y): print(x) print(y) xx = input('Word1') yy = input('Word2') check_name(xx, yy) def name_check(name): if name.lower() == 'josh': print('He da man') else: print('Who is that?!') zz = input('Word3') name_check(zz)
''' Road: The road 2d world coordinate system is a 2D euclidean coordinate system. The intended semantics are - the x axis is identified with (1,0) and considered to be pointing right - the y axis is identified with (0,1) and considered to be pointing up y ...
""" Road: The road 2d world coordinate system is a 2D euclidean coordinate system. The intended semantics are - the x axis is identified with (1,0) and considered to be pointing right - the y axis is identified with (0,1) and considered to be pointing up y ...