text stringlengths 2 999k |
|---|
# encoding: utf-8
def run():
pass
if __name__ == '__main__':
run() |
import abc
import math
import torch
from torch.optim import Optimizer, SGD
from settings import args, FILL_VAL, TOKENS_WEIGHT
from utils import get_losses, get_model_dir
from parallel import DataParallelCriterion
from torch.nn import CrossEntropyLoss, MSELoss
import pickle as pkl
import os
from torch.nn.functional impo... |
import win32con
import sys
def GenerateCppWin32VKMapTo(filename_prefix, namespace):
keys = {getattr(win32con, v) : v for v in dir(win32con) if v.startswith("VK_")}
# First generate the header file (declarations)
declBase = "\textern const Keycode KEYBOARD_{};\n"
allKeycodesStr = ""
# First start with all alph... |
import numpy as np
from math import sqrt
class KNN():
""" K Nearest Neighbors classifier.
Parameters:
-----------
k: int
The number of closest neighbors that will determine the class of the
sample that we wish to predict.
"""
def __init__(self, k=5):
self.k = k
def... |
from keras.models import Model
from keras.callbacks import ModelCheckpoint
from keras.layers.recurrent import LSTM
from keras.layers import Dense, Input, Embedding
from keras.preprocessing.sequence import pad_sequences
from collections import Counter
import nltk
import numpy as np
import os
import sys
import zipfile
im... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2020 Eka Cahya Pratama <ekapratama93@gmail.com>
from thumbor.loaders import http_loader
from urllib.parse import urlparse
import re
def _normalize_http_scheme(url):
re_url... |
import gym
import numpy as np
env = gym.make('SawyerPush-v0')
for _ in range(100):
env.reset()
for i in range(150):
env.render()
env.step(np.random.uniform(0, 1, size=(4,)))
|
from unittest import TestCase, main
from expects import expect, be, contain
import requests
from twin_sister import open_dependency_context
from twin_sister.expects_matchers import raise_ex
from twin_sister.fakes import EndlessFake
import questions_three.exceptions.http_error as error
from questions_three.http_client... |
class EagerResolutionMixin(object):
def _concrete_value(self, e):
r = super(EagerResolutionMixin, self)._concrete_value(e)
if r is not None:
return r
for b in backends._eager_backends:
try:
return b.eval(e, 1)[0]
except BackendError:
... |
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
from django.utils.translation import gettext as _
from core.models import Ingredient, Tag, User
class UserAdmin(BaseUserAdmin):
ordering = ['id']
list_display = ['email', 'name']
fieldsets = (
(None,... |
print("Contar de 1 a 10.")
for x in range(1,11):
print(x)
|
import argparse
import torch.backends.cudnn as cudnn
from models.experimental import *
from utils.datasets import *
from utils.utils import *
def detect(save_img=False):
out, source, weights, view_img, save_txt, imgsz = \
opt.output, opt.source, opt.weights, opt.view_img, opt.save_txt, opt.img_size
... |
from string import Template
def render(template, model):
s = Template(template)
return s.substitute(model) |
import pytest
from autoscraper import AutoScraper
url = 'https://stackoverflow.com/questions/2081586/web-scraping-with-python'
wanted_list = ["How to call an external command?"]
@pytest.mark.asyncio
async def test_async_autoscraper():
scraper = AutoScraper()
scraper.use_async = True
result = scraper.bui... |
##############################################################################################
#### ####
#### data augmentation method "Robust Learning Method", for Video Segmentations ####
#### use random selcted gausian and... |
# qubit number=5
# total number=69
import cirq
import qiskit
from qiskit.providers.aer import QasmSimulator
from qiskit.test.mock import FakeVigo
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit import BasicAer, execute, transpile
from pprint import pprint
from qiskit.test.mock import ... |
# -*- coding: utf-8 -*-
# A Survey on Negative Transfer
# https://github.com/chamwen/NT-Benchmark
import numpy as np
import argparse
import os
import torch as tr
import torch.nn as nn
import torch.optim as optim
from utils import network, loss, utils
from utils.LogRecord import LogRecord
from utils.dataloader import re... |
#
# Copyright (c) 2015 Autodesk Inc.
# All rights reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... |
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ------------------------------------------------------------... |
import json
from chargebee.model import Model
from chargebee import request
from chargebee import APIError
class Invoice(Model):
class LineItem(Model):
fields = ["id", "subscription_id", "date_from", "date_to", "unit_amount", "quantity", "amount", "pricing_model", "is_taxed", "tax_amount", "tax_rate", "unit_... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2005-2020 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at https://trac.edgewall.org/wiki/TracLicense.
#
# This software cons... |
import asyncio
import json
import logging
import time
from collections import defaultdict
from decimal import Decimal
import websockets
logger = logging.getLogger('luno_streams')
class BackoffException(Exception):
pass
class Updater:
def __init__(self, pair_code, api_key, api_secret, hooks=None):
... |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import glob
import argparse
from collections import defaultdict
import seaborn as sns
import pandas as pd
task_default_list = ['task_b_2021',
'task_b_vision_only_2021',
'task_b_sequence_ext_use_pred_20',
... |
#!flask/bin/python
import os
import sys
if not (os.path.dirname(os.path.dirname(__file__)) in sys.path): sys.path.append(os.path.dirname(os.path.dirname(__file__)))
if not (os.path.dirname(__file__) in sys.path): sys.path.append(os.path.dirname(__file__))
#print(sys.path)
from colorama import Fore
import datetime
# imp... |
# Copyright (C) 2018 - TODAY, Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': 'Warranty Date on Lot/Serial Numbers',
'summary': 'Add warranty date to stock production lot',
'version': '12.0.1.0.0',
'license': 'AGPL-3',
'author': 'Open Source Integra... |
# Representations abstraites
import matplotlib.pyplot as plt
import numpy as np
import pickle
import params
# # Ouverture des listes
# with open ('liste1', 'rb') as fp:
# l1x = pickle.load(fp)
# with open ('liste2', 'rb') as fp:
# l1y = pickle.load(fp)
# with open ('liste1v', 'rb') as fp:
# l2x = pickle.lo... |
import os
import pytest
from ddb.__main__ import load_registered_features
from ddb.config import config
from ddb.feature import features
from ddb.feature.core import CoreFeature
from ddb.utils import file
from ddb.utils.file import FileWalker, FileUtils
class TestHasSameContent:
def test_should_return_true_if_s... |
# Copyright 2019 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... |
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
n, w = map(int, input().split())
print(n // w)
|
#
# This file is part of LiteDRAM.
#
# Copyright (c) 2016-2019 Florent Kermarrec <florent@enjoy-digital.fr>
# Copyright (c) 2015 Sebastien Bourdeauducq <sb@m-labs.hk>
# SPDX-License-Identifier: BSD-2-Clause
"""LiteDRAM Refresher."""
from migen import *
from migen.genlib.misc import timeline
from litex.soc.interconne... |
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.package import *
class PyPytaridx(PythonPackage):
"""Python module/library for creating and maintaining a... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... |
"""
Ory Kratos API
Documentation for all public and administrative Ory Kratos APIs. Public and administrative APIs are exposed on different ports. Public APIs can face the public internet without any protection while administrative APIs should never be exposed without prior authorization. To protect the admini... |
# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils import getdate, cstr, flt, fmt_money
from frappe import _, _dict
import datetime
from datetime import date
def execute(filter... |
# Copyright (c) 2017 Jonathan Bredin
# MIT license http://opensource.org/licenses/MIT
from src.viewer import Mover
from src.viewer.logging import init_logging
if __name__ == "__main__":
init_logging()
args = Mover.parse_args()
mover = Mover(args.mountpoint, args.destination)
mover.run()
|
/home/sheldon/anaconda3/lib/python3.6/io.py |
# -*- coding: utf-8 -*-
from unittest2 import TestCase
from .. import CALLBACKS_MAP
class MailBotTestCase(TestCase):
"""TestCase that restores the CALLBACKS_MAP after each test run."""
def setUp(self):
self.callbacks_map_save = CALLBACKS_MAP.copy()
def tearDown(self):
CALLBACKS_MAP = s... |
from pkg_resources import get_distribution
__version__ = get_distribution(__name__).version
print(f"This is FileFlow version {__version__}")
from fileflow.config import Config
from fileflow.workflow import Workflow
from fileflow.task import Task, Future
from fileflow.file import File, Saveable
|
from django.db.backends.base.features import BaseDatabaseFeatures
from django.utils.functional import cached_property
class DatabaseFeatures(BaseDatabaseFeatures):
has_native_uuid_field = False
allow_sliced_subqueries_with_in = False
can_introspect_autofield = True
can_introspect_small_integer_field =... |
# Copyright 2021 The Kubeflow Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... |
#!/usr/bin/env python
# =======================================================================
# Copyright 2018 Cisco Systems, 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
#
# ht... |
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
def get_fbgemm_base_srcs():
return [
"src/GenerateI8Depthwise.cc",
"src/RefImplementations.cc",... |
# 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 u... |
import json
from glob import glob
from pathlib import Path
import subprocess
import os
def is_debug():
return os.getenv('PYCOMPSS_CLI_DEBUG', 'false').lower() == 'true'
def get_object_method_by_name(obj, method_name, include_in_name=False):
for class_method_name in dir(obj):
if not '__' in class_metho... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 IBM Corp.
#
# 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
#
# ... |
import os
import pickle
from scipy.ndimage.measurements import label
import numpy as np
import SimpleITK as sitk
from collections import OrderedDict
from lungmask import mask
from batchgenerators.utilities.file_and_folder_operations import *
from nnunet.paths import nnUNet_raw_data
MAIN_DATA_FOLDER = '/data'
MAIN_WORK... |
#!/usr/bin/python
# Write a mapreduce program that processes the purchases.txt file and outputs mean (average) of sales for each weekday.
# To get the weekday, use this expression: weekday = datetime.strptime(date, "%Y-%m-%d").weekday()
import sys
from datetime import datetime
WEEKDAYS = ['Monday', 'Tuesday', 'Wedne... |
from __future__ import print_function
from builtins import range
from six.moves import cPickle as pickle
import numpy as np
import os
# scipy.misc.imread is deprecated, so use imageio.imread
from scipy.misc import imread
import platform
def load_pickle(f):
version = platform.python_version_tuple()
if version... |
def merge(nums1,nums2):
i=0;
j=0;
a=len(nums1)
b=len(nums2)
ans=list()
while ((i<a) or (j<b)):
if ((i<a) and (j<b) and (nums1[i]<nums2[j])):
ans.append(nums1[i])
i=i+1
elif (j>=b):
ans.append(nums1[i])
i=i+1
else:
ans.append(nums2[j])
... |
import os
import pytest
from anchore_engine.subsys import logger
from test.integration.services.policy_engine.utils import LocalTestDataEnvironment
from anchore_engine.services.policy_engine.engine.tasks import ImageLoadTask
from anchore_engine.db import end_session
from test.fixtures import anchore_db, cls_anchore_db... |
from __future__ import with_statement
import unittest
import flask
from healthcheck import HealthCheck, EnvironmentDump
class BasicHealthCheckTest(unittest.TestCase):
def setUp(self):
self.path = '/h'
self.app = flask.Flask(__name__)
self.hc = self._hc()
self.client = self.app.te... |
"""
Internal utils
"""
import django
def add_media(dest, media):
"""
Optimized version of django.forms.Media.__add__() that doesn't create new objects.
"""
if django.VERSION >= (2, 2):
dest._css_lists.extend(media._css_lists)
dest._js_lists.extend(media._js_lists)
elif django.VERSI... |
from math import inf, sqrt
from benchmarking.ConfigurableAlgorithmBase import ConfigurableAlgorithmBase
def benchmark(algorithm: ConfigurableAlgorithmBase, benchmark_function, bounds, repeat_times=20):
results = []
values = []
best = {'input': None, 'value': inf}
for i in range(repeat_times):
... |
#!/usr/bin/env python2.7
# This file is adapted from samples/shellinabox/ssh-krb-wrapper in
# https://github.com/davidben/webathena, which has the following
# license:
#
# Copyright (c) 2013 David Benjamin and Alan Huang
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software... |
import os, sys, time, math
file = "depth_measurements.txt"
def main ():
depths = list()
with open(file, "r") as f:
for line in f:
try:
depths.append(int(line.strip()))
except Exception as e:
print(line)
print(e)
ex... |
# coding=utf-8
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from twilio.base import deserialize
from twilio.base import serialize
from twilio.base import values
from twilio.base.instance_context import InstanceContext
from twilio.base.instance_resource import... |
def add_time(start, duration, day=None):
hour, minutes = start.split(':')
minutes, am_pm = minutes.split()
add_hour, add_min = duration.split(":")
hour = int(hour)
minutes = int(minutes)
add_hour = int(add_hour)
add_min = int(add_min)
n = add_hour // 24
rem_hour = add_hour % 24
n... |
import pytest
from r2d7.meta import Metawing
import json
list_printer_tests = (
('{"position": 5, "id": 2085, "name": "DBS Swarm", "faction": "Separatist Alliance", "ships": [{"id": 55, "name": "Vulture-class Droid Fighter", "xws": "vultureclassdroidfighter", "link": "https://meta.listfortress.com/ships/55.jso... |
"""
_InsertRunStreamDone_
Oracle implementation of InsertRunStreamDone
Insert RunStreamDone record
"""
from WMCore.Database.DBFormatter import DBFormatter
class InsertRunStreamDone(DBFormatter):
def execute(self, binds, conn = None, transaction = False):
sql = """INSERT INTO run_stream_done
... |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# 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... |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# 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 ... |
# -*- coding: utf-8 -*-
#
# Copyright EAVISE
# Author: Maarten Vandersteegen
# Author: Tanguy Ophoff
#
# Functions for generating PR-curve values and calculating average precision
#
import math
from statistics import mean
import numpy as np
import scipy.interpolate
from .util import *
__all__ = ['pr', 'ap']
... |
from sortedListNoDubl import SortedListNoDubl
def main():
ar1 = SortedListNoDubl([1, 6, 2, 3])
print(ar1)
if __name__ == '__main__':
main()
|
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 1024 , FREQ = 'D', seed = 0, trendtype = "MovingMedian", cycle_length = 12, transform = "Anscombe", sigma = 0.0, exog_count = 0, ar_order = 0); |
"""Meta class for Databench Python kernel."""
import zmq
import time
import logging
class Meta(object):
"""Class providing Meta information about analyses.
For Python kernels.
Args:
name (str): Name of this analysis.
import_name (str): Usually the file name ``__name__`` where this
... |
from typing import Set, Dict, Union, List
from main.combiners.field_combiner import FieldCombiner
from main.downloaders.safe_browsing_api_downloader import SafeBrowsingApiDownloader
from main.enrichers.enricher import Enricher
from main.helpers.string_helper import remove_quotations
class ThreatInfoEnricher(Enricher... |
# qubit number=2
# total number=9
import cirq
import qiskit
from qiskit import IBMQ
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit import BasicAer, execute, transpile
from pprint import pprint
from qiskit.test.mock import FakeVigo
from math import log2,floor, sqrt, pi
import numpy as... |
"""
Main file for streaming Multicam tracker for 360 degree usecase
"""
__version__ = '0.2'
import argparse
import json
import logging
import signal
import sys
import os
import time
from code_libs.mctrack import mctrackstream
#logging.basicConfig(filename='mctracker360.log', level=logging.INFO)
DEFAULT_CONSUMER_KAFK... |
"""
Submlime Text Package File Search.
Licensed under MIT
Copyright (c) 2012 Isaac Muse <isaacmuse@gmail.com>
"""
import sublime
import re
from os import walk, listdir
from os.path import basename, dirname, isdir, join, normpath, splitext, exists
from fnmatch import fnmatch
import zipfile
__all__ = (
"sublime_pac... |
# Copyright 2015 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... |
import pickle
import numpy as np
from sklearn.model_selection import train_test_split
import tensorflow as tf
from tensorflow.keras.utils import to_categorical
from constants import CHECKPOINT_FILEPATH, PROJECT2_DATA_PATH, PROJECT2_VALIDATION_PATH
from model_architectures import create_model_project2_dense_20x20
from ... |
from feedback_synthesizer.hparams import hparams
from feedback_synthesizer.train import feedback_tacotron_train
from utils.argutils import print_args
from feedback_synthesizer import infolog
import argparse
import os
def prepare_run(args):
modified_hp = hparams.parse(args.hparams)
os.environ["TF_CPP_MIN_LOG_LE... |
"""
NNの学習
"""
import argparse
import numpy as np
import chainer
from .train_config import load_trainer
def main():
parser = argparse.ArgumentParser()
parser.add_argument("config_dir")
parser.add_argument("--gpu", type=int, default=0)
args = parser.parse_args()
if args.gpu >= 0:
chainer.... |
"""Support for the Fibaro devices."""
import logging
from collections import defaultdict
from typing import Optional
import voluptuous as vol
from homeassistant.const import (
ATTR_ARMED, ATTR_BATTERY_LEVEL, CONF_DEVICE_CLASS, CONF_EXCLUDE,
CONF_ICON, CONF_PASSWORD, CONF_URL, CONF_USERNAME,
CONF_WHITE_VALU... |
from ..common import WQXException
from .SimpleContent import (
MeasureQualifierCode,
MeasureUnitCode,
ResultMeasureValue
)
from typing import List, Union
from yattag import Doc
class Measure:
"""Identifies the value, associated units of measure, and qualifier for measuring the observation or analytical result ... |
from __future__ import print_function
import os
import yaml
import shlex
try:
basestring
except NameError:
basestring = str # Python 3
from .constants import *
from .utils import *
class ConfigError(Exception):
pass
class ConfigNotFoundError(ConfigError):
pass
# http://stackoverflow.com/a/9577670... |
import tensorflow as tf
class Lenet():
def __init__(self, mu, sigma, learning_rate, action_dim, parameterdim, statedim, name):
self.mu = mu
self.sigma = sigma
self.learning_rate = learning_rate
self.action_dim = action_dim
self.parameterdim = parameterdim
self.sta... |
# Copyright (c) 2020 Horizon Robotics. 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 applicab... |
import os, sys, time
from smartsim import Experiment
from smartsim.settings import AprunSettings
from smartsim.database import CobaltOrchestrator
# Parse command line arguments
ppn = int(sys.argv[1])
nodes = int(sys.argv[2])
allprocs = int(sys.argv[3])
dbnodes = int(sys.argv[4])
simnodes = int(sys.argv[5])
mlnodes = i... |
# coding=utf-8
""" Convert a folder with images to an ePub file. Great for comics and manga!
Copyright (C) 2021 Antoine Veenstra
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation... |
import logging
from getpass import getpass
from time import time
from base64 import b64decode
from steamctl import __appname__
from steamctl.utils.storage import UserDataFile, UserDataDirectory
from steamctl.utils.prompt import pmt_confirmation, pmt_input
from steamctl.utils.web import make_requests_session
from steam... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (C) 2013 Nicolas P. Rougier. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following co... |
from __future__ import absolute_import, unicode_literals
import unittest
import mock
from mopidy.core import CoreListener, PlaybackState
from mopidy.models import Playlist, TlTrack
class CoreListenerTest(unittest.TestCase):
def setUp(self): # noqa: N802
self.listener = CoreListener()
def test_on... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import copy
import logging
import random
from collections import defaultdict, namedtuple, deque
import typing
from tqdm import tqdm
from typing i... |
# coding: utf-8
# Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... |
import sys
numMinions = int(sys.stdin.readline())
minArray = []
# This code is from a prior attempt in solving
# minTemp = 100000000
# maxTemp = -100000000
for i in range(numMinions):
line = sys.stdin.readline()
line = line.split()
line[0] = int(line[0])
line[1] = int(line[1])
# This code is fro... |
r"""
Scalar Fields
Given a topological manifold `M` over a topological field `K` (in most
applications, `K = \RR` or `K = \CC`), a *scalar field* on `M` is a
continuous map
.. MATH::
f: M \longrightarrow K
Scalar fields are implemented by the class :class:`ScalarField`.
AUTHORS:
- Eric Gourgoulhon, Michal Be... |
"""
IMPLEMENTATION:
- crude method for removing periodic noise in images recorded
on Tietz CMOS slave camera in wq-mode
- integrates over several lines (e.g. 10x4096) of noise and
substracts signal from each line in sector
Copyright (c) 2013, pwachsmuth, rhambach
This file is part of... |
"""
Create YML Template files for the exclusions template command.
This way, users don't have to remember exactly how to phrase the yaml files, since this command creates it for them.
"""
# Copyright (c) 2020, salesforce.com, inc.
# All rights reserved.
# Licensed under the BSD 3-Clause license.
# For full license text... |
from statistics import median
def getInput():
with open("input.txt") as fp:
lines = fp.readlines()
return [x.strip() for x in lines]
data = getInput()
openers = ["{", "[", "(", "<"]
closers = ["}", "]", ")", ">"]
autocompletes = []
scores = []
for line in data:
linepath = []
autocomplete = []... |
# -*- encoding: utf-8 -*-
#
# Copyright (c) 2014, OVH
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, me... |
# Copyright (C) 2021, Pyronear contributors.
# This program is licensed under the GNU Affero General Public License version 3.
# See LICENSE or go to <https://www.gnu.org/licenses/agpl-3.0.txt> for full license details.
import unittest
import tempfile
from pathlib import Path
import json
from PIL.Image import Image
i... |
# 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 u... |
from __future__ import print_function
import datetime
from googleapiclient.discovery import build
from httplib2 import Http
from oauth2client import file, client, tools
SCOPES = 'https://www.googleapis.com/auth/calendar'
def fetchEvents():
store = file.Storage('token.json')
creds = store.get()
if not cr... |
import boto3
from botocore.config import Config
class Connector:
def __init__(self, srv_name):
# If you prefer using specific region rather than ~/.aws/credentials
self.config = Config(
region_name='ap-northeast-3',
signature_version='v4',
retries={
... |
grid =\
[[8, 2, 22, 97, 38, 15, 00, 40, 00, 75, 4, 5, 7, 78, 52, 12, 50, 77, 91, 8],
[49, 49, 99, 40, 17, 81, 18, 57, 60, 87, 17, 40, 98, 43, 69, 48, 4, 56, 62, 00],
[81, 49, 31, 73, 55, 79, 14, 29, 93, 71, 40, 67, 53, 88, 30, 3, 49, 13, 36, 65],
[52, 70, 95, 23, 4, 60, 11, 42, 69, 24, 68, 56, 1, 32, 56, 71, 37, 2, ... |
import inspect
from bson.dbref import DBRef
from pymongo import MongoClient
from .collection import Collection
from .document import Document
from ..utilities.conversion import Conversion
class Manager(object):
def __init__(self, database, host=None, port=None, username=None, password=None, case=None):
... |
import urllib.request
import random
from bs4 import BeautifulSoup
from requests import get
import mysql.connector
conn = mysql.connector.connect(user="root", passwd="",host="localhost", database="product")
cursor = conn.cursor()
sql = """INSERT INTO oilysund (about, rate, top, comment, dari) VALUES (%s, %s, %s, %s, ... |
import os
import json
import argparse
from copy import deepcopy
import spacy
from spacy import displacy
import re
from collections import defaultdict
def find_head(arg_start, arg_end, doc):
cur_i = arg_start
while doc[cur_i].head.i >= arg_start and doc[cur_i].head.i <=arg_end:
if doc[cur_i].head.... |
from rl.action.discrete_action import DiscreteAction
from rl.action.action_features import DiscreteActionFeatures
from rl.action.action_scores import DiscreteActionScores
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.