content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
# Databricks notebook source
# MAGIC %md
# MAGIC # Project Timesheet Source Data
# COMMAND ----------
spark.conf.set(
"fs.azure.account.key.dmstore1.blob.core.windows.net",
"s8aN23JQ1EboPql5lx++0zQOyYrYC2EvT7NbgewR/8yAmQzpPfojntRWrCr4XOuonMowUUXsEzSxP11Jzd3kTg==")
# COMMAND ----------
# MAGIC %sql
# MAGIC creat... | spark.conf.set('fs.azure.account.key.dmstore1.blob.core.windows.net', 's8aN23JQ1EboPql5lx++0zQOyYrYC2EvT7NbgewR/8yAmQzpPfojntRWrCr4XOuonMowUUXsEzSxP11Jzd3kTg==') |
# Copyright 2018 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... | """Implementation of the `swift_binary` and `swift_test` rules."""
load(':api.bzl', 'swift_common')
load(':derived_files.bzl', 'derived_files')
load(':features.bzl', 'SWIFT_FEATURE_BUNDLED_XCTESTS', 'is_feature_enabled')
load(':linking.bzl', 'register_link_action')
load(':providers.bzl', 'SwiftBinaryInfo', 'SwiftToolch... |
class FormatSingle:
def __init__(self, singleData: dict):
self.data = singleData
def getMonthDay(self):
fullData = self.data["TimePeriod"]["Start"]
return fullData[5:]
def getAmount(self):
stringAmountData = self.data["Total"]["BlendedCost"]["Amount"]
return float(... | class Formatsingle:
def __init__(self, singleData: dict):
self.data = singleData
def get_month_day(self):
full_data = self.data['TimePeriod']['Start']
return fullData[5:]
def get_amount(self):
string_amount_data = self.data['Total']['BlendedCost']['Amount']
return ... |
"""
Minimum Domino version supported by this python-domino library
"""
MINIMUM_SUPPORTED_DOMINO_VERSION = '4.1.0'
"""
Environment variable names used by this python-domino library
"""
DOMINO_TOKEN_FILE_KEY_NAME = 'DOMINO_TOKEN_FILE'
DOMINO_USER_API_KEY_KEY_NAME = 'DOMINO_USER_API_KEY'
DOMINO_HOST_KEY_NAME = 'DOMINO_A... | """
Minimum Domino version supported by this python-domino library
"""
minimum_supported_domino_version = '4.1.0'
'\nEnvironment variable names used by this python-domino library\n'
domino_token_file_key_name = 'DOMINO_TOKEN_FILE'
domino_user_api_key_key_name = 'DOMINO_USER_API_KEY'
domino_host_key_name = 'DOMINO_API_H... |
def login_to_foxford(driver):
'''Foxford login'''
driver.get("about:blank")
driver.switch_to.window(driver.window_handles[0]) # <--- Needed in some cases when something popups
driver.get("https://foxford.ru/user/login/")
| def login_to_foxford(driver):
"""Foxford login"""
driver.get('about:blank')
driver.switch_to.window(driver.window_handles[0])
driver.get('https://foxford.ru/user/login/') |
# https://leetcode.com/problems/coin-change/
#You are given an integer array coins representing coins of different denominations and an integer amount representing a total amount of money.
#Return the fewest number of coins that you need to make up that amount. If that amount of money cannot be made up by any combinati... | class Solution(object):
def coin_change(self, coins, amount):
"""
:type coins: List[int]
:type amount: int
:rtype: int
"""
dp = [0] + [float('inf')] * amount
for i in range(1, amount + 1):
for coin in coins:
if i >= coin:
... |
# -*- coding: utf-8 -*-
LOG_TYPES = {
"s": {"event": "Success Login", "level": 1}, # Info
"seacft": {"event": "Success Exchange", "level": 1}, # Info
"seccft": {"event": "Success Exchange (Client Credentials)", "level": 1}, # Info
"feacft": {"event": "Failed Exchange", "level": 3}, # Error
"fec... | log_types = {'s': {'event': 'Success Login', 'level': 1}, 'seacft': {'event': 'Success Exchange', 'level': 1}, 'seccft': {'event': 'Success Exchange (Client Credentials)', 'level': 1}, 'feacft': {'event': 'Failed Exchange', 'level': 3}, 'feccft': {'event': 'Failed Exchange (Client Credentials)', 'level': 3}, 'f': {'eve... |
"""
==============
Array indexing
==============
Array indexing refers to any use of the square brackets ([]) to index
array values. There are many options to indexing, which give numpy
indexing great power, but with power comes some complexity and the
potential for confusion. This section is just an overview of the
v... | """
==============
Array indexing
==============
Array indexing refers to any use of the square brackets ([]) to index
array values. There are many options to indexing, which give numpy
indexing great power, but with power comes some complexity and the
potential for confusion. This section is just an overview of the
v... |
class InvalidProgramException(SystemException,ISerializable,_Exception):
"""
The exception that is thrown when a program contains invalid Microsoft intermediate language (MSIL) or metadata. Generally this indicates a bug in the compiler that generated the program.
InvalidProgramException()
InvalidProgr... | class Invalidprogramexception(SystemException, ISerializable, _Exception):
"""
The exception that is thrown when a program contains invalid Microsoft intermediate language (MSIL) or metadata. Generally this indicates a bug in the compiler that generated the program.
InvalidProgramException()
InvalidProgramE... |
# This sample tests error detection for certain cases that
# are explicitly disallowed by PEP 572 for assignment expressions
# when used in context of a list comprehension.
pairs = []
stuff = []
# These should generate an error because assignment
# expressions aren't allowed within an iterator expression
# in a "for"... | pairs = []
stuff = []
[x for (x, y) in (pairs2 := pairs) if x % 2 == 0]
[x for (x, y) in [1, 2, 3, (pairs2 := pairs)] if x % 2 == 0]
{x: y for (x, y) in (pairs2 := pairs) if x % 2 == 0}
{x for (x, y) in (pairs2 := pairs) if x % 2 == 0}
foo = (x for (x, y) in [1, 2, 3, (pairs2 := pairs)] if x % 2 == 0)
[[(j := j) for i ... |
class Component:
def __init__(self, id_, name_):
self.id = id_
self.name = name_
| class Component:
def __init__(self, id_, name_):
self.id = id_
self.name = name_ |
class Mods:
__slots__ = ('map_changing', 'nf', 'ez', 'hd', 'hr', 'dt', 'ht', 'nc',
'fl', 'so', 'speed_changing', 'map_changing')
def __init__(self, mods_str=''):
self.nf = False
self.ez = False
self.hd = False
self.hr = False
self.dt = False
self... | class Mods:
__slots__ = ('map_changing', 'nf', 'ez', 'hd', 'hr', 'dt', 'ht', 'nc', 'fl', 'so', 'speed_changing', 'map_changing')
def __init__(self, mods_str=''):
self.nf = False
self.ez = False
self.hd = False
self.hr = False
self.dt = False
self.ht = False
... |
class Solution:
def maxNumOfSubstrings(self, s: str) -> List[str]:
start, end = {}, {}
for i, c in enumerate(s):
if c not in start:
start[c] = i
end[c] = i
def checkSubstring(i):
curr = i
right = end[s[curr]]
... | class Solution:
def max_num_of_substrings(self, s: str) -> List[str]:
(start, end) = ({}, {})
for (i, c) in enumerate(s):
if c not in start:
start[c] = i
end[c] = i
def check_substring(i):
curr = i
right = end[s[curr]]
... |
# -*- coding: utf-8 -*-
{
'name': "HR Attendance Holidays",
'summary': """""",
'category': 'Human Resources',
'description': """
Hides the attendance presence button when an employee is on leave.
""",
'version': '1.0',
'depends': ['hr_attendance', 'hr_holidays'],
'auto_install': True,
... | {'name': 'HR Attendance Holidays', 'summary': '', 'category': 'Human Resources', 'description': '\nHides the attendance presence button when an employee is on leave.\n ', 'version': '1.0', 'depends': ['hr_attendance', 'hr_holidays'], 'auto_install': True, 'data': ['views/hr_employee_views.xml'], 'license': 'LGPL-3'} |
# -*- coding: utf-8 -*-
"""This Module helps test private extras."""
class PrivateDict(dict):
"""A priviate dictionary."""
| """This Module helps test private extras."""
class Privatedict(dict):
"""A priviate dictionary.""" |
# -*- coding: utf-8 -*-
"""
Created on Sat Oct 3 11:15:57 2020
@author: Tarun Jaiswal
"""
x=range(2,11,2)
print (x)
for item in x:
print(item,end=",")
| """
Created on Sat Oct 3 11:15:57 2020
@author: Tarun Jaiswal
"""
x = range(2, 11, 2)
print(x)
for item in x:
print(item, end=',') |
'''
this code is for using PySpark to read straight from S3 bucket instead of using the default data source (AWS Glue Data Catalog).
'''
#this is the default line that we will change:
datasource0 = glueContext.create_dynamic_frame.from_catalog(database = "<DATABASE_NAME>", table_name = "<TABLE_NAME>", transformation... | """
this code is for using PySpark to read straight from S3 bucket instead of using the default data source (AWS Glue Data Catalog).
"""
datasource0 = glueContext.create_dynamic_frame.from_catalog(database='<DATABASE_NAME>', table_name='<TABLE_NAME>', transformation_ctx='datasource0')
obj_list = ['s3://<OBJECT_PATH>'... |
"""
New England
Buffalo
Miami
N.Y. Jets
Pittsburgh
Baltimore
Cincinnati
Cleveland
Jacksonville
Tennessee
Indianapolis
Houston
Kansas City
L.A. Chargers
Las Vegas
Denver
Philadelphia
Dallas
Washington
N.Y. Giants
Minnesota
Detroit
Green Bay
Chicago
New Orleans
Carolina
Atlanta
Tampa Bay
L.A. Rams
Seattle
Arizona
San Fra... | """
New England
Buffalo
Miami
N.Y. Jets
Pittsburgh
Baltimore
Cincinnati
Cleveland
Jacksonville
Tennessee
Indianapolis
Houston
Kansas City
L.A. Chargers
Las Vegas
Denver
Philadelphia
Dallas
Washington
N.Y. Giants
Minnesota
Detroit
Green Bay
Chicago
New Orleans
Carolina
Atlanta
Tampa Bay
L.A. Rams
Seattle
Arizona
San Fra... |
class Solution:
def removePalindromeSub(self, s: str) -> int:
if not s or len(s) == 0:
return 0
left, right = 0, len(s) - 1
while left < right and s[left] == s[right]:
left += 1
right -= 1
if left >= right:
return 1... | class Solution:
def remove_palindrome_sub(self, s: str) -> int:
if not s or len(s) == 0:
return 0
(left, right) = (0, len(s) - 1)
while left < right and s[left] == s[right]:
left += 1
right -= 1
if left >= right:
return 1
else:... |
class Solution(object):
def backspaceCompare(self, s, t):
"""
:type s: str
:type t: str
:rtype: bool
"""
def manipulateString(string):
new_string = []
for char in string:
if char != '#':
new_string.append(cha... | class Solution(object):
def backspace_compare(self, s, t):
"""
:type s: str
:type t: str
:rtype: bool
"""
def manipulate_string(string):
new_string = []
for char in string:
if char != '#':
new_string.append... |
radious=2.5
area=3.14*radious**2
print("area of circle",area)
circum=2*3.14*radious
print("circumof",circum)
| radious = 2.5
area = 3.14 * radious ** 2
print('area of circle', area)
circum = 2 * 3.14 * radious
print('circumof', circum) |
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 09/10/14 #3623 randerso Manually created, do not regenerate
#
class SiteActivationNotification(object):
def __init__(self... | class Siteactivationnotification(object):
def __init__(self):
self.type = None
self.status = None
self.primarySite = None
self.modifiedSite = None
self.runMode = None
self.serverName = None
self.pluginName = None
def get_type(self):
return self.t... |
#!/usr/bin/env python3
# Change the variables and rename this file to secret.py
# add your url here (without trailing / at the end!)
url = "https://home-assistant.duckdns.org"
# get a "Long-Lived Access Token" at YOUR_URL/profile
token = "AJKSDHHASJKDHA871263291873KHGSDKAJSGD"
| url = 'https://home-assistant.duckdns.org'
token = 'AJKSDHHASJKDHA871263291873KHGSDKAJSGD' |
# Time: O(n)
# Space: O(1)
class Solution(object):
def largestSubarray(self, nums, k):
"""
:type nums: List[int]
:type k: int
:rtype: List[int]
"""
left, right, l = 0, 1, 0
while right+k-1 < len(nums) and right+l < len(nums):
if nums[left+l] == n... | class Solution(object):
def largest_subarray(self, nums, k):
"""
:type nums: List[int]
:type k: int
:rtype: List[int]
"""
(left, right, l) = (0, 1, 0)
while right + k - 1 < len(nums) and right + l < len(nums):
if nums[left + l] == nums[right + l]:... |
# pylint: skip-file
class OadmPolicyException(Exception):
''' Registry Exception Class '''
pass
class OadmPolicyUserConfig(OpenShiftCLIConfig):
''' RegistryConfig is a DTO for the registry. '''
def __init__(self, namespace, kubeconfig, policy_options):
super(OadmPolicyUserConfig, self).__init... | class Oadmpolicyexception(Exception):
""" Registry Exception Class """
pass
class Oadmpolicyuserconfig(OpenShiftCLIConfig):
""" RegistryConfig is a DTO for the registry. """
def __init__(self, namespace, kubeconfig, policy_options):
super(OadmPolicyUserConfig, self).__init__(policy_options['n... |
# Stage 3/6: More interaction
# Description
# We are going to make our program more complex. As you remember,
# the conicoin rate was fixed in the previous stage. But in the real world,
# things are different. It's time to write a program that takes your
# conicoins and an up-to-date conicoin exchange rate, then count... | class Currencyconverter:
def __init__(self):
self.exchange = 0
self.dollars = 0
self.coins = 0
self.conicoin_question = 'Please, enter the number of conicoins you have: '
self.exchange_question = 'Please, enter the exchange rate: '
self.amount_message = 'The total am... |
def test_convert_from_bool(get_contract_with_gas_estimation):
code = """
@external
def foo() -> bool:
val: bool = True and True and False
return val
@external
def bar() -> bool:
val: bool = True or True or False
return val
@external
def foobar() -> bool:
val: bool = False and True or False
... | def test_convert_from_bool(get_contract_with_gas_estimation):
code = '\n@external\ndef foo() -> bool:\n val: bool = True and True and False\n return val\n\n@external\ndef bar() -> bool:\n val: bool = True or True or False\n return val\n\n@external\ndef foobar() -> bool:\n val: bool = False and True o... |
class ForkName:
Frontier = 'Frontier'
Homestead = 'Homestead'
EIP150 = 'EIP150'
EIP158 = 'EIP158'
Byzantium = 'Byzantium'
Constantinople = 'Constantinople'
Metropolis = 'Metropolis'
ConstantinopleFix = 'ConstantinopleFix'
Istanbul = 'Istanbul'
Berlin = 'Berlin'
London = 'Lond... | class Forkname:
frontier = 'Frontier'
homestead = 'Homestead'
eip150 = 'EIP150'
eip158 = 'EIP158'
byzantium = 'Byzantium'
constantinople = 'Constantinople'
metropolis = 'Metropolis'
constantinople_fix = 'ConstantinopleFix'
istanbul = 'Istanbul'
berlin = 'Berlin'
london = 'Lon... |
class fruta:
def __init__ (self,nombre, calorias, vitamina_c, porcentaje_fibra, porcentaje_potasio):
self.nombre = nombre
self.calorias = calorias
self.vitamina_c = vitamina_c
self.porcentaje_fibra = porcentaje_fibra
self.porcentaje_potasio = porcentaje_potasio
def ... | class Fruta:
def __init__(self, nombre, calorias, vitamina_c, porcentaje_fibra, porcentaje_potasio):
self.nombre = nombre
self.calorias = calorias
self.vitamina_c = vitamina_c
self.porcentaje_fibra = porcentaje_fibra
self.porcentaje_potasio = porcentaje_potasio
def get_... |
load("//:bouncycastle.bzl", "bouncycastle_repos")
load("//:gerrit_api_version.bzl", "gerrit_api_version")
load("//:rules_python.bzl", "rules_python_repos")
load("//tools:maven_jar.bzl", "MAVEN_LOCAL", "MAVEN_CENTRAL", "maven_jar")
"""Bazel rule for building [Gerrit Code Review](https://www.gerritcodereview.com/)
gerri... | load('//:bouncycastle.bzl', 'bouncycastle_repos')
load('//:gerrit_api_version.bzl', 'gerrit_api_version')
load('//:rules_python.bzl', 'rules_python_repos')
load('//tools:maven_jar.bzl', 'MAVEN_LOCAL', 'MAVEN_CENTRAL', 'maven_jar')
'Bazel rule for building [Gerrit Code Review](https://www.gerritcodereview.com/)\ngerrit_... |
# this is an embedded Python script it's really on GitHub
# and this is only a reference - so when it changes people
# will see the change on the webpage .. GOODTIMES !
pid = Runtime.start("pid","PID") | pid = Runtime.start('pid', 'PID') |
def fram_write8(addr: number, val: number):
pins.digital_write_pin(DigitalPin.P16, 0)
pins.spi_write(OPCODE_WRITE)
pins.spi_write(addr >> 8)
pins.spi_write(addr & 0xff)
pins.spi_write(val)
pins.digital_write_pin(DigitalPin.P16, 1)
def on_button_pressed_a():
fram_write8(0, 10)
basic.paus... | def fram_write8(addr: number, val: number):
pins.digital_write_pin(DigitalPin.P16, 0)
pins.spi_write(OPCODE_WRITE)
pins.spi_write(addr >> 8)
pins.spi_write(addr & 255)
pins.spi_write(val)
pins.digital_write_pin(DigitalPin.P16, 1)
def on_button_pressed_a():
fram_write8(0, 10)
basic.pause... |
class HtmlDocument(object):
""" Provides top-level programmatic access to an HTML document hosted by the System.Windows.Forms.WebBrowser control. """
def AttachEventHandler(self,eventName,eventHandler):
"""
AttachEventHandler(self: HtmlDocument,eventName: str,eventHandler: EventHandler)
Adds an event ha... | class Htmldocument(object):
""" Provides top-level programmatic access to an HTML document hosted by the System.Windows.Forms.WebBrowser control. """
def attach_event_handler(self, eventName, eventHandler):
"""
AttachEventHandler(self: HtmlDocument,eventName: str,eventHandler: EventHandler)
Adds ... |
class GumoBaseError(RuntimeError):
pass
class ConfigurationError(GumoBaseError):
pass
class ServiceAccountConfigurationError(ConfigurationError):
pass
class ObjectNotoFoundError(GumoBaseError):
pass
| class Gumobaseerror(RuntimeError):
pass
class Configurationerror(GumoBaseError):
pass
class Serviceaccountconfigurationerror(ConfigurationError):
pass
class Objectnotofounderror(GumoBaseError):
pass |
class CrudBackend(object):
def __init__(self):
pass
def create(self, key, data=None):
return NotImplementedError()
def read(self, key):
return NotImplementedError()
def update(self, key, data):
return NotImplementedError()
def delete(self, key):
return Not... | class Crudbackend(object):
def __init__(self):
pass
def create(self, key, data=None):
return not_implemented_error()
def read(self, key):
return not_implemented_error()
def update(self, key, data):
return not_implemented_error()
def delete(self, key):
ret... |
class CommonInfoAdminMixin:
def get_readonly_fields(self, request, obj=None):
return super().get_readonly_fields(request, obj) + ('created_by', 'lastmodified_by', 'created_at',
'lastmodified_at')
def save_form(self, request, form, change):
... | class Commoninfoadminmixin:
def get_readonly_fields(self, request, obj=None):
return super().get_readonly_fields(request, obj) + ('created_by', 'lastmodified_by', 'created_at', 'lastmodified_at')
def save_form(self, request, form, change):
if form.instance and request.user:
if not ... |
'''
Problem Statement
Given a linked list with integer data, arrange the elements in such a manner that all nodes with even numbers are placed after odd numbers.
Do not create any new nodes and avoid using any other data structure. The relative order of even and odd elements must not change.
Example:
linked list = 1... | """
Problem Statement
Given a linked list with integer data, arrange the elements in such a manner that all nodes with even numbers are placed after odd numbers.
Do not create any new nodes and avoid using any other data structure. The relative order of even and odd elements must not change.
Example:
linked list = 1... |
# krotki
k = ('a', 1, 'qqq', {1: 'x', 2: 'y'})
print(k)
print(k[0])
print(k[-1])
print(k[1:-1])
print('------operacje ----------')
# k.append('www')
# k.remove('qq')
print(k.index(1))
# print k.index('b')
print(k.count('b'))
print(len(k))
k[-1][1] = 'zzz'
print(k)
print('a' in k, 'z' in k)
# krotka jako lista
l = ... | k = ('a', 1, 'qqq', {1: 'x', 2: 'y'})
print(k)
print(k[0])
print(k[-1])
print(k[1:-1])
print('------operacje ----------')
print(k.index(1))
print(k.count('b'))
print(len(k))
k[-1][1] = 'zzz'
print(k)
print('a' in k, 'z' in k)
l = list(k)
print(l)
l[0] = 'x'
k = tuple(l)
print(k)
print(dir(tuple))
x = []
x.append(x)
l =... |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | def _assemble_versioned_impl(ctx):
if not ctx.attr.version_file:
version_file = ctx.actions.declare_file(ctx.attr.name + '__do_not_reference.version')
version = ctx.var.get('version', '0.0.0')
ctx.actions.run_shell(inputs=[], outputs=[version_file], command='echo {} > {}'.format(version, ver... |
"""--------------------------------------------------------------------
* $Id: GUI_definition.py $
*
* This file is part of libRadtran.
* Copyright (c) 1997-2012 by Arve Kylling, Bernhard Mayer,
* Claudia Emde, Robert Buras
*
* ######### Contact info: http://www.libradtran.org #######... | """--------------------------------------------------------------------
* $Id: GUI_definition.py $
*
* This file is part of libRadtran.
* Copyright (c) 1997-2012 by Arve Kylling, Bernhard Mayer,
* Claudia Emde, Robert Buras
*
* ######### Contact info: http://www.libradtran.org #######... |
test = {
'name': 'What Would Scheme Display?',
'points': 1,
'suites': [
{
'cases': [
{
'code': r"""
scm> (- 10 4)
6
scm> (* 7 6)
42
scm> (+ 1 2 3 4)
10
scm> (/ 8 2 2)
2
scm> (quotient 29 5)
... | test = {'name': 'What Would Scheme Display?', 'points': 1, 'suites': [{'cases': [{'code': '\n scm> (- 10 4)\n 6\n scm> (* 7 6)\n 42\n scm> (+ 1 2 3 4)\n 10\n scm> (/ 8 2 2)\n 2\n scm> (quotient 29 5)\n 5\n scm> (modulo 29... |
MODAL_REQUEST = {
"callback_id": "change_request_review",
"type": "modal",
"title": {
"type": "plain_text",
"text": "Switcher Change Request"
},
"submit": {
"type": "plain_text",
"text": "Submit"
},
"close": {
"type": "plain_text",
"text": "Cancel"
},
"blocks": [
{
"type": "context",
"eleme... | modal_request = {'callback_id': 'change_request_review', 'type': 'modal', 'title': {'type': 'plain_text', 'text': 'Switcher Change Request'}, 'submit': {'type': 'plain_text', 'text': 'Submit'}, 'close': {'type': 'plain_text', 'text': 'Cancel'}, 'blocks': [{'type': 'context', 'elements': [{'type': 'plain_text', 'text': ... |
# File: wildfire_consts.py
#
# Copyright (c) 2016-2022 Splunk Inc.
#
# 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 ap... | wildfire_json_base_url = 'base_url'
wildfire_json_task_id = 'task_id'
wildfire_json_api_key = 'api_key'
wildfire_json_malware = 'malware'
wildfire_json_task_id = 'id'
wildfire_json_url = 'url'
wildfire_json_hash = 'hash'
wildfire_json_platform = 'platform'
wildfire_json_poll_timeout_mins = 'timeout'
wildfire_err_unable... |
birds = ( ('Passerculus sandwichensis','Savannah sparrow',18.7),
('Delichon urbica','House martin',19),
('Junco phaeonotus','Yellow-eyed junco',19.5),
('Junco hyemalis','Dark-eyed junco',19.6),
('Tachycineata bicolor','Tree swallow',20.2),
)
#(1) Write three separate li... | birds = (('Passerculus sandwichensis', 'Savannah sparrow', 18.7), ('Delichon urbica', 'House martin', 19), ('Junco phaeonotus', 'Yellow-eyed junco', 19.5), ('Junco hyemalis', 'Dark-eyed junco', 19.6), ('Tachycineata bicolor', 'Tree swallow', 20.2)) |
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 21 16:19:46 2018
@author: Sherry
Done
"""
def CorsairStats():
#Get base stats
Agility = 7 + d6()
Alertness = 3 + d6()
Charm = 2 + d6()
Cunning = 12 + d6()
Dexterity = 13 + d6()
Fate = 4 + d6()
Intelligence = 10 + d6()
... | """
Created on Sun Jan 21 16:19:46 2018
@author: Sherry
Done
"""
def corsair_stats():
agility = 7 + d6()
alertness = 3 + d6()
charm = 2 + d6()
cunning = 12 + d6()
dexterity = 13 + d6()
fate = 4 + d6()
intelligence = 10 + d6()
knowledge = 9 + d6()
mechanical = 11 + d6()
nature =... |
COLORS = {
'PROBLEM': 'red',
'RECOVERY': 'green',
'UP': 'green',
'ACKNOWLEDGEMENT': 'purple',
'FLAPPINGSTART': 'yellow',
'WARNING': 'yellow',
'UNKNOWN': 'gray',
'CRITICAL': 'red',
'FLAPPINGEND': 'green',
'FLAPPINGSTOP': 'green',
'FLAPPINGDISABLED': 'purple',
'DOWNTIMESTAR... | colors = {'PROBLEM': 'red', 'RECOVERY': 'green', 'UP': 'green', 'ACKNOWLEDGEMENT': 'purple', 'FLAPPINGSTART': 'yellow', 'WARNING': 'yellow', 'UNKNOWN': 'gray', 'CRITICAL': 'red', 'FLAPPINGEND': 'green', 'FLAPPINGSTOP': 'green', 'FLAPPINGDISABLED': 'purple', 'DOWNTIMESTART': 'red', 'DOWNTIMESTOP': 'green', 'DOWNTIMEEND'... |
def load(h):
return ({'abbr': 0,
'code': 0,
'title': 'Mass density (concentration)',
'units': 'kg m-3'},
{'abbr': 1,
'code': 1,
'title': 'Column-integrated mass density',
'units': 'kg m-2'},
{'abbr': 2,
... | def load(h):
return ({'abbr': 0, 'code': 0, 'title': 'Mass density (concentration)', 'units': 'kg m-3'}, {'abbr': 1, 'code': 1, 'title': 'Column-integrated mass density', 'units': 'kg m-2'}, {'abbr': 2, 'code': 2, 'title': 'Mass mixing ratio (mass fraction in air)', 'units': 'kg/kg'}, {'abbr': 3, 'code': 3, 'title'... |
#===========================================================================
#
# Port to use for the web server. Configure the Eagle to use this
# port as it's 'cloud provider' using http://host:PORT
#
#===========================================================================
httpPort = 22042
#=====================... | http_port = 22042
mqtt_energy = 'power/elec/Home/energy'
mqtt_power = 'power/elec/Home/power'
mqtt_price = 'power/elec/Home/price'
mqtt_rate_label = 'power/elec/Home/ratelabel'
log_file = '/var/log/tHome/eagle.log'
log_level = 20 |
def runUserScript(func, params, paramTypes):
if (len(params) != len(paramTypes)):
onParameterError()
newParams = []
for i, val in enumerate(params):
newParams.append(parseParameter(i, paramTypes[i], val))
func(*newParams)
class Node:
def __init__(self, val, left, right,... | def run_user_script(func, params, paramTypes):
if len(params) != len(paramTypes):
on_parameter_error()
new_params = []
for (i, val) in enumerate(params):
newParams.append(parse_parameter(i, paramTypes[i], val))
func(*newParams)
class Node:
def __init__(self, val, left, right, next)... |
def readlines(fname):
try:
with open(fname, 'r') as fpt:
return fpt.readlines()
except:
return []
def convert(data):
for i in range(len(data)):
try:
data[i] = float(data[i])
except ValueError:
continue
def csv_lst(fname):
l = readli... | def readlines(fname):
try:
with open(fname, 'r') as fpt:
return fpt.readlines()
except:
return []
def convert(data):
for i in range(len(data)):
try:
data[i] = float(data[i])
except ValueError:
continue
def csv_lst(fname):
l = readline... |
def functionA(A: torch.Tensor, B: torch.Tensor) -> torch.Tensor:
## TODO for students
output = A.sum(axis = 0) * B.sum()
return output
def functionB(C: torch.Tensor) -> torch.Tensor:
# TODO flatten the tensor C
C = C.flatten()
# TODO create the idx tensor to be concatenated to C
# here we're going ... | def function_a(A: torch.Tensor, B: torch.Tensor) -> torch.Tensor:
output = A.sum(axis=0) * B.sum()
return output
def function_b(C: torch.Tensor) -> torch.Tensor:
c = C.flatten()
idx_tensor = torch.arange(0, len(C))
output = torch.cat([idx_tensor.unsqueeze(0), C.unsqueeze(0)], axis=1)
return out... |
minimum_points = 100
data_points = 150
if data_points >= minimum_points:
print("There are enough data points!")
if data_points < minimum_points:
print("Keep collecting data.") | minimum_points = 100
data_points = 150
if data_points >= minimum_points:
print('There are enough data points!')
if data_points < minimum_points:
print('Keep collecting data.') |
class Hand:
def __init__(self):
self.cards = []
self.value = 0
def add_card(self, card):
self.cards.append(card)
def calculate_value(self):
self.value = 0
has_ace = False
for card in self.cards:
if card.value.isnumeric():
self.val... | class Hand:
def __init__(self):
self.cards = []
self.value = 0
def add_card(self, card):
self.cards.append(card)
def calculate_value(self):
self.value = 0
has_ace = False
for card in self.cards:
if card.value.isnumeric():
self.va... |
# This module is used in `test_doctest`.
# It must not have a docstring.
def func_with_docstring():
"""Some unrelated info."""
def func_without_docstring():
pass
def func_with_doctest():
"""
This function really contains a test case.
>>> func_with_doctest.__name__
'func_with_doctest'
"... | def func_with_docstring():
"""Some unrelated info."""
def func_without_docstring():
pass
def func_with_doctest():
"""
This function really contains a test case.
>>> func_with_doctest.__name__
'func_with_doctest'
"""
return 3
class Classwithdocstring:
"""Some unrelated class infor... |
# -*- coding: utf-8 -*-
"""
pyalgs
~~~~~
pyalgs provides the python implementation of the Robert Sedgwick's Coursera course on Algorithms (Part I and Part II).
:copyright: (c) 2017 by Xianshun Chen.
:license: BSD, see LICENSE for more details.
"""
__version__ = '0.01-dev' | """
pyalgs
~~~~~
pyalgs provides the python implementation of the Robert Sedgwick's Coursera course on Algorithms (Part I and Part II).
:copyright: (c) 2017 by Xianshun Chen.
:license: BSD, see LICENSE for more details.
"""
__version__ = '0.01-dev' |
#
# PySNMP MIB module GSM7312-QOS-ACL-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/GSM7312-QOS-ACL-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:20:03 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, value_size_constraint, constraints_union, constraints_intersection, single_value_constraint) ... |
class AttributeUsageAttribute(Attribute,_Attribute):
"""
Specifies the usage of another attribute class. This class cannot be inherited.
AttributeUsageAttribute(validOn: AttributeTargets)
"""
def __init__(self,*args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__... | class Attributeusageattribute(Attribute, _Attribute):
"""
Specifies the usage of another attribute class. This class cannot be inherited.
AttributeUsageAttribute(validOn: AttributeTargets)
"""
def __init__(self, *args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__... |
"""
Backports of library components from newer python versions.
For internal use only.
"""
| """
Backports of library components from newer python versions.
For internal use only.
""" |
settings = {
"ARCHIVE" : True,
"MAX_POSTS" : 5000
}
| settings = {'ARCHIVE': True, 'MAX_POSTS': 5000} |
def minim(lst):
min = 100000
minI = 99999
for i in range(len(lst)):
if lst[i]<min:
min = lst[i]
minI=i
return min,minI
lst = list(map(int, input().split()))
lst2 = len(lst)*[0]
min = lst[1]
for i in range(len(lst)):
x,y = minim(lst)
lst2.append(x)
# print(minim... | def minim(lst):
min = 100000
min_i = 99999
for i in range(len(lst)):
if lst[i] < min:
min = lst[i]
min_i = i
return (min, minI)
lst = list(map(int, input().split()))
lst2 = len(lst) * [0]
min = lst[1]
for i in range(len(lst)):
(x, y) = minim(lst)
lst2.append(x) |
class CapacityMixin:
@staticmethod
def get_capacity(capacity, amount):
if amount > capacity:
return "Capacity reached!"
return capacity - amount
| class Capacitymixin:
@staticmethod
def get_capacity(capacity, amount):
if amount > capacity:
return 'Capacity reached!'
return capacity - amount |
# Copyright (c) 2009 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'targets': [
{
'target_name': 'program',
'type': 'executable',
'msvs_cygwin_shell': 0,
'sources': [
'program.c',... | {'targets': [{'target_name': 'program', 'type': 'executable', 'msvs_cygwin_shell': 0, 'sources': ['program.c'], 'actions': [{'action_name': 'make-prog1', 'inputs': ['make-prog1.py'], 'outputs': ['<(INTERMEDIATE_DIR)/prog1.c'], 'action': ['python', '<(_inputs)', '<@(_outputs)'], 'process_outputs_as_sources': 1}, {'actio... |
print("Enter Num 1 : ")
num1 = int(input())
print("Enter Num 2 : ")
num2 = int(input())
print("Sum = ", num1+num2)
print("This is important") | print('Enter Num 1 : ')
num1 = int(input())
print('Enter Num 2 : ')
num2 = int(input())
print('Sum = ', num1 + num2)
print('This is important') |
def likelihood(theta_hat, x, y):
"""The likelihood function for a linear model with noise sampled from a
Gaussian distribution with zero mean and unit variance.
Args:
theta_hat (float): An estimate of the slope parameter.
x (ndarray): An array of shape (samples,) that contains the input values.
... | def likelihood(theta_hat, x, y):
"""The likelihood function for a linear model with noise sampled from a
Gaussian distribution with zero mean and unit variance.
Args:
theta_hat (float): An estimate of the slope parameter.
x (ndarray): An array of shape (samples,) that contains the input values.
... |
UI={
'new_goal':{
't':'Send me the name of your goal'
}
}
| ui = {'new_goal': {'t': 'Send me the name of your goal'}} |
"""
Write a Python program to count occurrences of a substring in a string.
"""
str1 = "This pandemic is something serious, in the sense that a virus can spread while lockdown is on. Let's re_examine this virus please."
print("The Text is:", str1)
print()
print("The Number of occurence of the word virus is: ",str1.cou... | """
Write a Python program to count occurrences of a substring in a string.
"""
str1 = "This pandemic is something serious, in the sense that a virus can spread while lockdown is on. Let's re_examine this virus please."
print('The Text is:', str1)
print()
print('The Number of occurence of the word virus is: ', str1.cou... |
#if customizations are required when doing the update of the code of the jpackage
def main(j,jp,force=False):
recipe=jp.getCodeMgmtRecipe()
recipe.update(force=force)
| def main(j, jp, force=False):
recipe = jp.getCodeMgmtRecipe()
recipe.update(force=force) |
"""Targets for generating TensorFlow Python API __init__.py files."""
# keep sorted
TENSORFLOW_API_INIT_FILES = [
# BEGIN GENERATED FILES
"__init__.py",
"app/__init__.py",
"bitwise/__init__.py",
"compat/__init__.py",
"data/__init__.py",
"debugging/__init__.py",
"distributions/__init__.p... | """Targets for generating TensorFlow Python API __init__.py files."""
tensorflow_api_init_files = ['__init__.py', 'app/__init__.py', 'bitwise/__init__.py', 'compat/__init__.py', 'data/__init__.py', 'debugging/__init__.py', 'distributions/__init__.py', 'distributions/bijectors/__init__.py', 'dtypes/__init__.py', 'errors... |
# Copyright 1999-2021 Alibaba Group Holding Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | _flex_doc_frame = "\nGet {desc} of dataframe and other, element-wise (binary operator `{op_name}`).\nEquivalent to ``{equiv}``, but with support to substitute a fill_value\nfor missing data in one of the inputs. With reverse version, `{reverse}`.\nAmong flexible wrappers (`add`, `sub`, `mul`, `div`, `mod`, `pow`) to\na... |
def maximo(x, y):
if x > y:
return x
else:
return y
| def maximo(x, y):
if x > y:
return x
else:
return y |
########
# PART 1
def get_layers(data, width = 25, height = 6):
layers = []
while data:
layer = []
for _ in range(width * height):
layer.append(data.pop(0))
layers.append(layer)
return layers
def count_digit_on_layer(layer, digit):
return sum([1 for val in layer if v... | def get_layers(data, width=25, height=6):
layers = []
while data:
layer = []
for _ in range(width * height):
layer.append(data.pop(0))
layers.append(layer)
return layers
def count_digit_on_layer(layer, digit):
return sum([1 for val in layer if val == digit])
def get... |
# System phrases
started: str = "Bot {} started"
closed: str = "Bot disabled"
loaded_cog: str = "Load cog - {}"
loading_failed: str = "Failed to load cog - {}\n{}"
kill: str = "Bot disabled"
# System errors
not_owner: str = "You have to be bot's owner to use this command"
# LanguageService
lang_changed: str = "Langua... | started: str = 'Bot {} started'
closed: str = 'Bot disabled'
loaded_cog: str = 'Load cog - {}'
loading_failed: str = 'Failed to load cog - {}\n{}'
kill: str = 'Bot disabled'
not_owner: str = "You have to be bot's owner to use this command"
lang_changed: str = 'Language has been changed' |
wordlist = [
"a's",
"able",
"about",
"above",
"according",
"accordingly",
"across",
"actually",
"after",
"afterwards",
"again",
"against",
"ain't",
"all",
"allow",
"allows",
"almost",
"alone",
"along",
"already",
"also",
"although",... | wordlist = ["a's", 'able', 'about', 'above', 'according', 'accordingly', 'across', 'actually', 'after', 'afterwards', 'again', 'against', "ain't", 'all', 'allow', 'allows', 'almost', 'alone', 'along', 'already', 'also', 'although', 'always', 'am', 'among', 'amongst', 'an', 'and', 'another', 'any', 'anybody', 'anyhow', ... |
sample_trajectory = [[[8.29394929e-01, 2.94382693e-05, 1.24370992e+00], [0.8300607, 0.00321705, 1.24627523],
[0.83197002, 0.01345206, 1.25535293], [0.83280536, 0.02711211, 1.26502481],
[0.83431212, 0.04126721, 1.27488879], [0.83557291, 0.05575593, 1.28517274],
... | sample_trajectory = [[[0.829394929, 2.94382693e-05, 1.24370992], [0.8300607, 0.00321705, 1.24627523], [0.83197002, 0.01345206, 1.25535293], [0.83280536, 0.02711211, 1.26502481], [0.83431212, 0.04126721, 1.27488879], [0.83557291, 0.05575593, 1.28517274], [0.83835516, 0.07094685, 1.29766037], [0.84018236, 0.0848757, 1.30... |
###
# Copyright 2019 Hewlett Packard Enterprise, Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... | """This module contains common helper functions used by several pmem commands"""
class Pmemhelpers(object):
"""
Class containing common helper functions used by several pmem commands
"""
@staticmethod
def py3_round(number, precision):
"""
Rounds numbers in accordance with the Pytho... |
# https://binarysearch.com/
# GGA 2020.12.04
"""
User Problem
You Have:
You Need:
You Must:
Input/Output Example:
Solution (Feature/Product)
(Edge cases)
Reflect On, Improvements, Comparisons with other Solutions:
I learned:
"""
# function counting 'only-children' in tree
class Solution:
def solve(se... | """
User Problem
You Have:
You Need:
You Must:
Input/Output Example:
Solution (Feature/Product)
(Edge cases)
Reflect On, Improvements, Comparisons with other Solutions:
I learned:
"""
class Solution:
def solve(self, root):
local_counter = 0
cumulative_total_counter = 0
if not ... |
#-*- coding: utf-8 -*-
# https://github.com/Kodi-vStream/venom-xbmc-addons
class iHoster:
def getDisplayName(self):
raise NotImplementedError()
def setDisplayName(self, sDisplayName):
raise NotImplementedError()
def setFileName(self, sFileName):
raise NotImplementedError()
d... | class Ihoster:
def get_display_name(self):
raise not_implemented_error()
def set_display_name(self, sDisplayName):
raise not_implemented_error()
def set_file_name(self, sFileName):
raise not_implemented_error()
def get_file_name(self):
raise not_implemented_error()
... |
"""
LC887 -- super egg drop
You are given K eggs, and you have access to a building with N floors from 1 to N.
Each egg is identical in function, and if an egg breaks, you cannot drop it again.
You know that there exists a floor F with 0 <= F <= N such that any egg dropped at a floor higher than F will break, and an... | """
LC887 -- super egg drop
You are given K eggs, and you have access to a building with N floors from 1 to N.
Each egg is identical in function, and if an egg breaks, you cannot drop it again.
You know that there exists a floor F with 0 <= F <= N such that any egg dropped at a floor higher than F will break, and an... |
expected_output={
"drops":{
"IN_US_CL_V4_PKT_FAILED_POLICY":{
"drop_type":8,
"packets":11019,
},
"IN_US_V4_PKT_SA_NOT_FOUND_SPI":{
"drop_type":4,
"p... | expected_output = {'drops': {'IN_US_CL_V4_PKT_FAILED_POLICY': {'drop_type': 8, 'packets': 11019}, 'IN_US_V4_PKT_SA_NOT_FOUND_SPI': {'drop_type': 4, 'packets': 67643}, 'OCT_GEN_NOTIFY_SOFT_EXPIRY': {'drop_type': 66, 'packets': 159949980}, 'OCT_PKT_HIT_INVALID_SA': {'drop_type': 68, 'packets': 2797}, 'OUT_OCT_HARD_EXPIRY... |
#
# PySNMP MIB module FASTPATH-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/FASTPATH-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:12:15 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,... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, constraints_intersection, constraints_union, value_size_constraint, value_range_constraint) ... |
# python3.7
"""Configuration for StyleGAN training demo.
All settings are particularly used for one replica (GPU), such as `batch_size`
and `num_workers`.
"""
runner_type = 'StyleGANRunner'
gan_type = 'stylegan'
resolution = 64
batch_size = 4
val_batch_size = 32
total_img = 100_000
# Training dataset is repeated at ... | """Configuration for StyleGAN training demo.
All settings are particularly used for one replica (GPU), such as `batch_size`
and `num_workers`.
"""
runner_type = 'StyleGANRunner'
gan_type = 'stylegan'
resolution = 64
batch_size = 4
val_batch_size = 32
total_img = 100000
data = dict(num_workers=4, repeat=500, train=dict... |
"""Planets"""
LIGHT_GREY = (220, 220, 220)
ORANGE = (255, 128, 0)
BLUE = (0, 0, 255)
RED = (255, 0, 0)
YELLOW = (255, 255, 0)
LIGHT_BLUE = (0, 255, 255)
class Planet:
"""Planet"""
def __init__(self, name, mass, diameter, density, gravity, esc_velocity, rotation_period, day_length, from_sun, perihelion, aphel... | """Planets"""
light_grey = (220, 220, 220)
orange = (255, 128, 0)
blue = (0, 0, 255)
red = (255, 0, 0)
yellow = (255, 255, 0)
light_blue = (0, 255, 255)
class Planet:
"""Planet"""
def __init__(self, name, mass, diameter, density, gravity, esc_velocity, rotation_period, day_length, from_sun, perihelion, aphele... |
# Time: O(1)
# Space: O(1)
#
# Write a function to delete a node (except the tail) in a singly linked list,
# given only access to that node.
#
# Supposed the linked list is 1 -> 2 -> 3 -> 4 and you are given the third node
# with value 3, the linked list should become 1 -> 2 -> 4 after calling your function.
#
# Defi... | class Solution:
def delete_node(self, node):
if node and node.next:
node_to_delete = node.next
node.val = node_to_delete.val
node.next = node_to_delete.next
del node_to_delete |
#sum in python
'''
weight = float(input("Weight:"))
height = float(input("height"))
total = weight + height
print(total)
'''
#cal monthly salary
'''
import math
age= 17
pi= 3.14
print(type(age),age)
print(type(pi),pi)
print(math.pi)
salary = float(input('Salary: ')) #float convert text(string) to number with decima... | """
weight = float(input("Weight:"))
height = float(input("height"))
total = weight + height
print(total)
"""
'\nimport math\n\nage= 17\npi= 3.14\nprint(type(age),age)\nprint(type(pi),pi)\n\nprint(math.pi)\n\nsalary = float(input(\'Salary: \')) #float convert text(string) to number with decimal place\nbonus = float(inp... |
nonverified_users = ['calvin klein','ralph lauren','christian dior','donna karran']
verified_users = []
#verifying if there are new users and moving them to a verified list
while nonverified_users:
current_user = nonverified_users.pop()
print(f"\nVerifying user: {current_user}")
verified_users.append(curre... | nonverified_users = ['calvin klein', 'ralph lauren', 'christian dior', 'donna karran']
verified_users = []
while nonverified_users:
current_user = nonverified_users.pop()
print(f'\nVerifying user: {current_user}')
verified_users.append(current_user)
for user in verified_users:
print(f'\n\t{user.title()}... |
# from ..interpreter import model
# Commented out to make static node recovery be used
# @model('map_server', 'map_server')
def map_server(c):
c.read('~frame_id', 'map')
c.read('~negate', 0)
c.read('~occupied_thresh', 0.65)
c.read('~free_thresh', 0.196)
c.provide('static_map', 'nav_msgs/GetMap')
... | def map_server(c):
c.read('~frame_id', 'map')
c.read('~negate', 0)
c.read('~occupied_thresh', 0.65)
c.read('~free_thresh', 0.196)
c.provide('static_map', 'nav_msgs/GetMap')
c.pub('map_metadata', 'nav_msgs/MapMetaData')
c.pub('map', 'nav_msgs/OccupancyGrid') |
def func1():
def func2():
return True
return func2()
if(func1()):
print("Acabou")
| def func1():
def func2():
return True
return func2()
if func1():
print('Acabou') |
fname = input('Enter File: ')
if len(fname) < 1:
fname = 'clown.txt'
hand = open(fname)
di = dict()
for lin in hand:
lin = lin.rstrip()
wds = lin.split()
#print(wds)
for w in wds:
# if the key is not there the count is zero
#print(w)
#print('**',w,di.get(w,-99))
#... | fname = input('Enter File: ')
if len(fname) < 1:
fname = 'clown.txt'
hand = open(fname)
di = dict()
for lin in hand:
lin = lin.rstrip()
wds = lin.split()
for w in wds:
di[w] = di.get(w, 0) + 1
largest = -1
theword = None
for (k, v) in di.items():
if v > largest:
largest = v
... |
'''
Square Root of Integer
Asked in:
Facebook
Amazon
Microsoft
Given an integar A.
Compute and return the square root of A.
If A is not a perfect square, return floor(sqrt(A)).
DO NOT USE SQRT FUNCTION FROM STANDARD LIBRARY
Input Format
The first and only argument given is the integer A.
Output Format
Return ... | """
Square Root of Integer
Asked in:
Facebook
Amazon
Microsoft
Given an integar A.
Compute and return the square root of A.
If A is not a perfect square, return floor(sqrt(A)).
DO NOT USE SQRT FUNCTION FROM STANDARD LIBRARY
Input Format
The first and only argument given is the integer A.
Output Format
Return ... |
# buildifier: disable=module-docstring
load("//bazel/platform:transitions.bzl", "risc0_transition")
# https://github.com/bazelbuild/bazel/blob/master/src/main/starlark/builtins_bzl/common/cc/cc_library.bzl
CC_TOOLCHAIN_TYPE = "@bazel_tools//tools/cpp:toolchain_type"
def _get_compilation_contexts_from_deps(deps):
... | load('//bazel/platform:transitions.bzl', 'risc0_transition')
cc_toolchain_type = '@bazel_tools//tools/cpp:toolchain_type'
def _get_compilation_contexts_from_deps(deps):
compilation_contexts = []
for dep in deps:
if CcInfo in dep:
compilation_contexts.append(dep[CcInfo].compilation_context)
... |
"""Cornershop Models.
"""
class Aisle:
"""Model for an aisle.
"""
def __init__(self, data:dict):
for key in data:
setattr(self, key, data[key])
self.products = [Product(p) for p in self.products]
def __repr__(self) -> str:
return f'<cornershop.models.Aisle: {... | """Cornershop Models.
"""
class Aisle:
"""Model for an aisle.
"""
def __init__(self, data: dict):
for key in data:
setattr(self, key, data[key])
self.products = [product(p) for p in self.products]
def __repr__(self) -> str:
return f'<cornershop.models.Aisle: ... |
# 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:context.bzl', 'go_context')
load('@io_bazel_rules_go//go/private:providers.bzl', 'GoPath')
load('@io_bazel_rules_go//go/private:rules/rule.bzl', 'go_rule')
def _go_vet_generate_impl(ctx):
print('\nEXPERIMENTAL: the go_vet_test rule is still very experimental\nPlease do not rely... |
"""
==========================
kikola.contrib.basicsearch
==========================
Application to lightweight search over models, existed in your project.
Installation
============
1. Add ``kikola.contrib.basicsearch`` to your project's ``settings``
``INSTALLED_APPS`` var.
2. Set up ``SEARCH_MODELS`` var in yo... | """
==========================
kikola.contrib.basicsearch
==========================
Application to lightweight search over models, existed in your project.
Installation
============
1. Add ``kikola.contrib.basicsearch`` to your project's ``settings``
``INSTALLED_APPS`` var.
2. Set up ``SEARCH_MODELS`` var in yo... |
"""
##################################################################################################
# Copyright Info : Copyright (c) Davar Lab @ Hikvision Research Institute. All rights reserved.
# Filename : lgpma_pub.py
# Abstract : Model settings for LGPMA detector on PubTabNet
# Current Ver... | """
##################################################################################################
# Copyright Info : Copyright (c) Davar Lab @ Hikvision Research Institute. All rights reserved.
# Filename : lgpma_pub.py
# Abstract : Model settings for LGPMA detector on PubTabNet
# Current Ver... |
class Solution:
def findLHS(self, nums: List[int]) -> int:
d=collections.defaultdict(lambda:0)
for i in range(0,len(nums)):
d[nums[i]]+=1
maxi=0
for i in d.keys():
if(d.get(i+1,"E")!="E"):
maxi=max(maxi,d[i]+d[i+1])
return maxi
| class Solution:
def find_lhs(self, nums: List[int]) -> int:
d = collections.defaultdict(lambda : 0)
for i in range(0, len(nums)):
d[nums[i]] += 1
maxi = 0
for i in d.keys():
if d.get(i + 1, 'E') != 'E':
maxi = max(maxi, d[i] + d[i + 1])
... |
model_config = {}
# alpha config
model_config['alpha_jump_mode'] = "linear"
model_config['iter_alpha_jump'] = []
model_config['alpha_jump_vals'] = []
model_config['alpha_n_jumps'] = [0, 600, 600, 600, 600, 600, 600, 600, 600]
model_config['alpha_size_jumps'] = [0, 32, 32, 32, 32, 32, 32, 32, 32, 32]
# base config
mod... | model_config = {}
model_config['alpha_jump_mode'] = 'linear'
model_config['iter_alpha_jump'] = []
model_config['alpha_jump_vals'] = []
model_config['alpha_n_jumps'] = [0, 600, 600, 600, 600, 600, 600, 600, 600]
model_config['alpha_size_jumps'] = [0, 32, 32, 32, 32, 32, 32, 32, 32, 32]
model_config['max_iter_at_scale'] ... |
"""
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below 1000.
"""
def multiples_sum():
return sum(i for i in range(1000) if (i % 3 == 0 or i % 5 == 0))
| """
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below 1000.
"""
def multiples_sum():
return sum((i for i in range(1000) if i % 3 == 0 or i % 5 == 0)) |
class LineItem(object):
def __init__(self, description, weight, price):
self.description = description
self.set_weight(weight)
self.price = price
def subtotal(self):
return self.get_weight() * self.price
def get_weight(self):
return self.__weight
def set_weigh... | class Lineitem(object):
def __init__(self, description, weight, price):
self.description = description
self.set_weight(weight)
self.price = price
def subtotal(self):
return self.get_weight() * self.price
def get_weight(self):
return self.__weight
def set_weigh... |
_out_ = ""
_in_ = ""
_err_ = ""
_root_ = "" | _out_ = ''
_in_ = ''
_err_ = ''
_root_ = '' |
class FrontMiddleBackQueue:
def __init__(self):
self.queue = []
def pushFront(self, val: int):
self.queue.insert(0,val)
def pushMiddle(self, val: int):
self.queue.insert(len(self.queue) // 2,val)
def pushBack(self, val: int):
self.queue.append(val)
d... | class Frontmiddlebackqueue:
def __init__(self):
self.queue = []
def push_front(self, val: int):
self.queue.insert(0, val)
def push_middle(self, val: int):
self.queue.insert(len(self.queue) // 2, val)
def push_back(self, val: int):
self.queue.append(val)
def pop_f... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.