filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_0_9690 | import os
import torch
from torch.utils.tensorboard import SummaryWriter
from torch.cuda.amp import GradScaler, autocast
from scripts.focalloss import FocalLoss
from Transformers_VQA.dataset_final import make_final_loader
from Transformers_VQA.modified_uniter_attnbias_rcnn_SBERT_graph import Modified_Uniter_attnbias_... |
the-stack_0_9693 | import csv
import flask
import operator
import sqlite3
app = flask.Flask(__name__)
@app.route('/api/ships/')
def ships():
cursor = get_db()
result = []
for ship in cursor.execute('select * from Ships'):
result.append({'name': str(ship[0]), 'imo': str(ship[1])})
return flask.jsonify(result)... |
the-stack_0_9694 | import subprocess
import tempfile
import os
clone_dir = os.path.join(tempfile.gettempdir(), 'scikit-beam-examples')
try:
ret = subprocess.check_output(
['git', 'clone', 'https://github.com/scikit-beam/scikit-beam-examples',
clone_dir])
except subprocess.CalledProcessError:
print("scikit-beam-ex... |
the-stack_0_9696 | import argparse
import os
import torchvision.transforms as transforms
from src.datamanager import *
from src.datamanager import DataProvider
import src.datamanager.utils as datautils
from PIL import Image
from src.configs import *
from src.ml.net import PyNet
from src.results import performance
from src.results.reid im... |
the-stack_0_9697 | from abc import ABCMeta, abstractmethod
from collections.abc import Iterable
from numbers import Integral
from typing import Callable
import operator
from functools import reduce
import numpy as np
import scipy.sparse as ss
from ._umath import elemwise
from ._utils import _zero_of_dtype, html_table, equivalent, norma... |
the-stack_0_9698 | """Webroot plugin."""
import argparse
import collections
import json
import logging
from typing import DefaultDict
from typing import Dict
from typing import List
from typing import Set
from acme import challenges
from certbot import crypto_util
from certbot import errors
from certbot import interfaces
from certbot._i... |
the-stack_0_9699 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from neodroid.utilities.unity_specifications import Motion, Reaction, ReactionParameters
__author__ = "Christian Heider Nielsen"
import neodroid.wrappers.formal_wrapper as neo
def construct_reactions(env):
parameters = ReactionParameters(
terminable=True,
... |
the-stack_0_9700 | #!/usr/bin/env python
# -*- mode: python; coding: utf-8 -*-
u"""
OMD Livestatus dynamic inventory script
=======================================
If running as an OMD site user, i.e. if ${OMD_ROOT} is set, we try to
connect to the Livestatus socket at the default location
${OMD_ROOT}/tmp/run/live
Alternatively, ... |
the-stack_0_9702 | """
Copyright 2020 The Magma Authors.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES O... |
the-stack_0_9705 | #!/usr/bin/env python
#===============================================================================
# Copyright 2021 Intel Corporation
#
# 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... |
the-stack_0_9708 | ###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2018, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""... |
the-stack_0_9709 | import sys
sys.path.append("..")
from intcode import IntCodeMachine
from collections import defaultdict
def read_input():
f = open("input_day09.txt")
l = [int(n) for n in f.readline().strip().split(",")]
return defaultdict(int, enumerate(l))
def run():
input_list = read_input()
m = IntCodeMachine... |
the-stack_0_9710 | # Copyright (c) 2019 Remi Salmon
#
# 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, merge, publish, distrib... |
the-stack_0_9714 | import json
from . import eosapi
from . import config
def create_account_on_chain(from_account, new_account, balance, public_key):
assert len(new_account) == 12
assert balance <= 1.0
assert len(public_key) == 53 and public_key[:3] == 'EOS'
memo = '%s-%s'%(new_account, public_key)
return eosapi.tran... |
the-stack_0_9717 | import os
f=open("/tmp/yy.txt")
q=f.read()
s=''
for i in str(q):
# print(ord(i)+2,end="")
s=s+str(ord(i)+2)
#print()
#print(s)
s1=open("/tmp/yy1.txt",'w')
s1.write(s)
s1.close()
#print(q)
|
the-stack_0_9718 | # Construção do grafo com networkx para obtenção de informações e alterações necessárias
import networkx as nx
import json
from networkx.algorithms.simple_paths import all_simple_paths
with open("./data/disciplinas.json", 'r') as f:
line = f.readline()
disciplinas = json.loads(line)
G = nx.DiGraph()
G.add_nodes_f... |
the-stack_0_9720 | """Contains methods and classes to collect data from
tushare API
"""
import pandas as pd
import tushare as ts
from tqdm import tqdm
class TushareDownloader :
"""Provides methods for retrieving daily stock data from
tushare API
Attributes
----------
start_date : str
start date of th... |
the-stack_0_9723 | #!/home/knielbo/virtenvs/teki/bin/python
"""
# front page only for us
$ python infomedia_parser.py --dataset ../dat/NEWS-DATA/berglinske-print --pagecontrol True --page 1 --sort True --verbose 10
# all pages for Peter
$ python infomedia_parser.py --dataset ../dat/NEWS-DATA/berglinske-print --pagecontrol False --page ... |
the-stack_0_9726 | # Copyright 2016-2018 Dirk Thomas
# Licensed under the Apache License, Version 2.0
import traceback
from colcon_core.logging import colcon_logger
from colcon_core.plugin_system import instantiate_extensions
from colcon_core.plugin_system import order_extensions_by_priority
logger = colcon_logger.getChild(__name__)
... |
the-stack_0_9727 | import os
import errno
import random
import numpy as np
import torch as th
def set_random_seeds(seed, cuda):
"""Set seeds for python random module numpy.random and torch.
Parameters
----------
seed: int
Random seed.
cuda: bool
Whether to set cuda seed with torch.
"""
ran... |
the-stack_0_9728 | #! /usr/bin/env python3
from __future__ import print_function
import sys
import os
import re
from ROOT import *
import MultipleCompare as MultipleCompare
__author__ = "Lars Perchalla (lars.perchalla@cern.ch)"
__doc__ = """Script to execute multiple plotting commands via MultipleCompare.py. Switch between massiveMod... |
the-stack_0_9729 | from lib.interface.cores import c
from lib.interface.valida import leiaInt
def linha(s, x=60, cor=0):
print(f'{c(cor)}{s}'*x, f'{c(0)}')
def cabecalho(x, msg):
linha(x, cor=9)
print('{}{}{}'.format(c(11), msg.center(60), c(0)))
linha(x, cor=9)
def menu(lst):
cabecalho('-', 'MENU PRINCIPAL')
... |
the-stack_0_9731 | import json
from pprint import pprint
from configparser import ConfigParser
from pybea.client import BureauEconomicAnalysisClient
# Grab configuration values.
config = ConfigParser()
config.read("configs/config.ini")
API_KEY = config.get("alex_credentials", "API_KEY")
def save_response(name: str, data: dict) -> None... |
the-stack_0_9732 | from django.core import mail
from selenium.webdriver.common.keys import Keys
import re
from .base import FunctionalTest
TEST_EMAIL = 'edith@example.com'
SUBJECT = 'Your login link for Superlists'
class LoginTest(FunctionalTest):
def test_can_get_email_link_to_log_in(self):
# Edith entra no site e nota ... |
the-stack_0_9733 | # -*- coding: utf-8 -*- {{{
# vim: set fenc=utf-8 ft=python sw=4 ts=4 sts=4 et:
#
# Copyright 2020, Battelle Memorial Institute.
#
# 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... |
the-stack_0_9734 | import torch
from torch.autograd import Variable
from torch.autograd import Function
import numpy as np
import scipy.linalg
class MatrixSquareRoot(Function):
"""Square root of a positive definite matrix.
NOTE: matrix square root is not differentiable for matrices with
zero eigenvalues.
"""
@s... |
the-stack_0_9737 | from __future__ import absolute_import, print_function, division
import copy
import numpy as np
import logging
import pdb
import time
from six import iteritems
from six.moves import xrange
import sys
import theano
from theano import tensor, scalar, gof, config
from theano.compile import optdb
from theano.compile.ops i... |
the-stack_0_9740 | import pickle
import joblib
import pytest
import numpy as np
import scipy.sparse as sp
from unittest.mock import Mock
from sklearn.utils._testing import assert_allclose
from sklearn.utils._testing import assert_array_equal
from sklearn.utils._testing import assert_almost_equal
from sklearn.utils._testing import asser... |
the-stack_0_9743 | import csv
import ctypes
import datetime
from easydict import EasyDict
import logging
import multiprocessing as mp
import os
import random
import sys
from pathlib import Path
from typing import Union, Tuple, Dict
import yaml
from typing import Any, Dict, List, Tuple
import GPUtil
import numpy as np
import psutil
impo... |
the-stack_0_9748 | #!/usr/bin/env python
from __future__ import print_function
import itertools
from sympy import symbols, simplify_logic
TMPL_ADD = '''def {name}({args}):
if {body}
else:
raise Exception('{name}: Unhandled case "{{}}"'.format({args}))'''
def _sym_to_py(expr):
try:
if expr.is_Symbol:
... |
the-stack_0_9754 | # Copyright (c) 2021 Mira Geoscience Ltd.
#
# This file is part of geoapps.
#
# geoapps is distributed under the terms and conditions of the MIT License
# (see LICENSE file at the root of this source code package).
from typing import Optional, Union
import ipywidgets as widgets
import numpy as np
from geoh5py.dat... |
the-stack_0_9755 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jul 16 13:01:35 2019
@author: avelinojaver
"""
import sys
from pathlib import Path
root_dir = Path(__file__).resolve().parents[1]
sys.path.append(str(root_dir))
from cell_localization.flow import CoordFlow, collate_simple
from cell_localization.model... |
the-stack_0_9757 | #!/usr/bin/python
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
seg={'a':21, 'b':8, 'c':11, 'd':26, 'e':19, 'f':20, 'g':13}
for s in "abcdefg":
GPIO.setup(seg[s], GPIO.OUT, initial=0)
zif=[16, 12, 7, 6]
for z in zif:
GPIO.setup(z, GPIO.OUT, initial=1)
dp = 5
GPIO.setup(dp, GPIO.OUT, initial=0)... |
the-stack_0_9759 | from itertools import tee, zip_longest
from django.db.models import Model
from typing import Any, Iterator, List, Sequence, Type, TypeVar, Tuple
T = TypeVar('T', covariant=True)
def pairwise(iterable: Sequence[T]) -> Iterator[Tuple[T, T]]:
a, b = tee(iterable)
next(b, None)
return zip(a, b)
def modelna... |
the-stack_0_9760 | # Copyright 2014 Midokura SARL
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... |
the-stack_0_9761 | """
mbed SDK
Copyright (c) 2011-2013 ARM Limited
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 wr... |
the-stack_0_9762 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from thing.models import Contract
# We need to delete duplicate contract IDs before we make it a unique field
def delete_contract_duplicates_forward(apps, schema_editor):
ids = Contract.objects.all().values_l... |
the-stack_0_9763 | from collections import namedtuple
from spinn.util.data import *
ModelSpec_ = namedtuple("ModelSpec", ["model_dim", "word_embedding_dim",
"batch_size", "vocab_size", "seq_length",
"model_visible_dim"])
def ModelSpec(*args, **kwargs):
arg... |
the-stack_0_9764 | # Copyright (c) 2018 PaddlePaddle 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 app... |
the-stack_0_9765 | import pytest
from app.models import Expense, User
from app.models import expense
pytestmark = pytest.mark.nologin
def headers(tok):
return {'Authorization': f'Bearer {tok}'}
def test_get_expenses(db_with_expenses, token, client):
resp = client.get('/api/expenses?page=1&page_size=10',
... |
the-stack_0_9766 | """The sma integration."""
from __future__ import annotations
from datetime import timedelta
import logging
import pysma
from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry, ConfigEntryNotReady
from homeassistant.const import (
CONF_HOST,
CONF_PASSWORD,
CONF_PATH,
CONF_SCAN_INTERVAL,
... |
the-stack_0_9767 | import numpy as np
from tensorflow.examples.tutorials.mnist import input_data
# pad our images with zeros in both dimensions.
# images should be input images of shape raw_image_size by raw_image_size, and output is of size image_size x image_size
# input image tensor should be of shape [-1, raw_image_size^2]. Output ... |
the-stack_0_9768 | def binary_Search(arr,val):
start=0
end=len(arr)-1
while start<=end:
mid=(start+end)//2
if arr[mid]==val:
return True
elif arr[mid]>val:
end=mid-1
else:
start=mid+1
return False
arr=list(map(int,input().split()))
#sort the array if ... |
the-stack_0_9771 | # DADSA - Assignment 1
# Reece Benson
import random
from classes import Menu as Menu
from classes import Handler as Handler
class App():
# Define the variables we will be using
debug = True
handler = None
# Define all of the properties we will need to use
def __init__(self):
# Load our ha... |
the-stack_0_9773 | from numpy import *
import numpy as np
import random
import math
import os
import time
import pandas as pd
import csv
import math
import random
# 定义函数
def ReadMyCsv(SaveList, fileName):
csv_reader = csv.reader(open(fileName))
for row in csv_reader: # 把每个rna疾病对加入OriginalData,注意表头
SaveLis... |
the-stack_0_9776 | # -*- coding:UTF-8 -*-
import falcon
class QuoteResource:
def on_get(self, req, resp):
"""Handles GET requests"""
quote = {
'quote': (
"I've always been more interested in "
"the future than in the past."
),
'author': 'Grace Hopp... |
the-stack_0_9777 |
def test():
test_instructions = """0
3
0
1
-3"""
assert run(test_instructions) == 10
def run(in_val):
instructions = [int(instruction) for instruction in in_val.split()]
offsets = {}
register = 0
steps = 0
while True:
try:
instruction = instructions[register]
... |
the-stack_0_9778 | # -*- coding: utf-8 -*-
#
# VEGASSceneDetect: Python-Based Video Scene Detector
# ---------------------------------------------------------------
# [ Site: http://www.hlinke.de/ ]
# [ Github: coming soon ]
# [ Documentation: coming soon ]
#
# Copyright (C) 2019 Harold Linke <http... |
the-stack_0_9779 | from PIL import Image
import tqdm
from itertools import compress
import os
import multiprocessing
def is_corrupted_img(file):
try:
img = Image.open(file)
img.verify()
return img is None
except:
return True
def read_files(path, exts):
files = []
for r, d, f in os.walk(pa... |
the-stack_0_9780 | #!/usr/bin/env python3
#
# Copyright 2011-2015 Jeff Bush
#
# 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... |
the-stack_0_9783 | from datetime import datetime
import numpy as np
import copy
import logging
import math
import os
import pickle
import time
import tempfile
from typing import Callable, Dict, List, Optional, Type, Union
import ray
from ray.exceptions import RayError
from ray.rllib.agents.callbacks import DefaultCallbacks
from ray.rlli... |
the-stack_0_9785 | from typing import FrozenSet, Tuple
import pysmt.typing as types
from pysmt.environment import Environment as PysmtEnv
from pysmt.fnode import FNode
from utils import symb_to_next
from hint import Hint, Location
def transition_system(env: PysmtEnv) -> Tuple[FrozenSet[FNode], FNode, FNode,
... |
the-stack_0_9786 | import nltk
import discord
from discord.ext import commands
from nltk.sentiment import SentimentIntensityAnalyzer
import database as db
import variables as var
from functions import get_prefix
from ext.permissions import has_command_permission
nltk.download('vader_lexicon')
sia = SentimentIntensityAnalyzer()
class ... |
the-stack_0_9787 | import numpy as np
import pytest
import pandas as pd
import pandas.util.testing as tm
@pytest.mark.parametrize("ordered", [True, False])
@pytest.mark.parametrize("categories", [["b", "a", "c"], ["a", "b", "c", "d"]])
def test_factorize(categories, ordered):
cat = pd.Categorical(
["b", "b", "a", "c", None... |
the-stack_0_9788 | # ---------------------------------------------------------------------
# Eltex.MA4000.get_interfaces
# ---------------------------------------------------------------------
# Copyright (C) 2007-2020 The NOC Project
# See LICENSE for details
# ---------------------------------------------------------------------
# Pyt... |
the-stack_0_9789 | from datetime import date
from mockito import *
from django.test.client import Client
from django.utils import unittest
from molly.apps.places.models import Entity, Journey
from molly.apps.places.providers.cif import CifTimetableProvider
import httplib
class AtcoCifTestCase(unittest.TestCase):
def testBan... |
the-stack_0_9791 | import unittest
import os
from shutil import rmtree
from abc import ABC
import numpy as np
import z5py
class DatasetTestMixin(ABC):
def setUp(self):
self.shape = (100, 100, 100)
self.path = 'array.' + self.data_format
self.root_file = z5py.File(self.path, use_zarr_format=self.data_format ... |
the-stack_0_9795 | from os import path, environ
from os.path import join, abspath, dirname
from setuptools import setup, find_packages
here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'README.rst')) as f:
readme = f.read()
with open(join(here, 'requirements.txt')) as f:
required = f.read().splitlines()
wi... |
the-stack_0_9796 | # https://codeforces.com/problemset/problem/1358/A
def find_min_lamps(n: int, m: int) -> int:
if n%2 ==0:
count = n//2 * m
else:
if m%2 == 0:
count = m//2 * n
else:
count = n//2 * m + m//2 + 1
return count
def main():
t = int(input())
cases = [list(... |
the-stack_0_9797 | import argparse
import os
import sys
import time
import re
from tqdm import tqdm
from datetime import datetime
import numpy as np
import torch
from torch.optim import Adam
from torch.utils.data import DataLoader
from torchvision import datasets
from torchvision import transforms
import torch.onnx
import utils
from tr... |
the-stack_0_9799 | import hashlib
import hmac
import os
from collections import namedtuple
from functools import lru_cache
from typing import List, Tuple
from urllib.parse import urlparse, urlunparse, quote
from botocore.client import ClientEndpointBridge
from botocore.loaders import create_loader
from botocore.model import ServiceModel... |
the-stack_0_9800 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# scvi documentation build configuration file, created by
# sphinx-quickstart on Fri Jun 9 13:47:02 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autoge... |
the-stack_0_9804 | import cv2,os,PIL
import numpy as np
from keras.applications.vgg16 import decode_predictions
from keras.applications import ResNet50, Xception, InceptionV3, VGG16, VGG19
from keras.preprocessing import image as Image
from keras.applications.vgg16 import preprocess_input
from tqdm import tqdm
from skimage import feature... |
the-stack_0_9805 | __all__ = ["ICOS"]
class ICOS:
""" Interface for processing ICOS data
"""
def __init__(self):
# Sampling period of ICOS data in seconds
self._sampling_period = "NA"
def read_file(self, data_filepath, site=None, network=None):
""" Reads ICOS data files and returns the UUIDS o... |
the-stack_0_9806 | import uuid
from clarifai_grpc.grpc.api import resources_pb2, service_pb2, service_pb2_grpc
from clarifai_grpc.grpc.api.status import status_code_pb2
from tests.common import both_channels, metadata, raise_on_failure
@both_channels
def test_concept_post_get_patch(channel):
stub = service_pb2_grpc.V2Stub(channel)... |
the-stack_0_9807 | import bpy
import os
D = bpy.data
"""
This little script show in the Blender console textures paths
that not conform to the reference one.
"""
searchPath = r"partOfTextureName"
print("+++ search paths +++")
for img in D.images:
if img.filepath.endswith(searchPath) or img.name.endswith(searchPath):
... |
the-stack_0_9808 | # This file is part of ZS
# Copyright (C) 2013-2014 Nathaniel Smith <njs@pobox.com>
# See file LICENSE.txt for license information.
from contextlib import contextmanager
import math
from six import BytesIO
from nose.tools import assert_raises
from zs import ZS, ZSWriter, ZSError
from zs.common import write_length_pr... |
the-stack_0_9809 | from os import path, rename, remove
import pytz
import datetime as dt
from flask import current_app
from flask_restful import request, Resource
from flask_apispec import marshal_with
from flask_jwt_extended import jwt_required
from webargs.flaskparser import use_kwargs
from werkzeug.utils import secure_filename... |
the-stack_0_9810 | # -*- coding: future_fstrings -*-
from .. import loader, utils
import logging, asyncio
logger = logging.getLogger(__name__)
def register(cb):
cb(AFKMod())
class AFKMod(loader.Module):
"""Provides a message saying that you are unavailable (out of office)"""
def __init__(self):
self.commands = {"a... |
the-stack_0_9811 | from datetime import datetime
from flask import Flask, render_template, url_for, request, redirect
from flask_sqlalchemy import SQLAlchemy
from werkzeug.utils import redirect
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///books.db'
db = SQLAlchemy(app)
class Publisher(db.Model):
... |
the-stack_0_9812 | from src.ArchiveUtility import ArchiveUtility
from src.Downloader import Downloader
from src.FileOrganizer import FileOrganizer
from src.Utils import Utils
def handle_archival():
print("Would you like to use an existing CSV file in the archival of files?")
with_csv = Utils.get_string_input("Yes or no: ", ["YE... |
the-stack_0_9813 | # -*- coding: utf-8 -*-
# Copyright 2015 Mirantis, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version... |
the-stack_0_9815 | # -*- coding: utf-8 -*-
"""
Created on Mon Aug 13 14:50:35 2018
@author: Ashutosh Verma
"""
'''
Write a program that calculates and prints the value according to the given formula:
Q = Square root of [(2 * C * D)/H]
Following are the fixed values of C and H:
C is 50. H is 30.
D is the variable whose value... |
the-stack_0_9816 | #!/bin/env python
# pylint: disable=E1101, W0201, E1103
# E1101: reference config file variables
# W0201: Don't much around with __init__
# E1103: Use thread members
from __future__ import print_function
from builtins import range, object
import cProfile
import os
import pickle
import pstats
import random
import thre... |
the-stack_0_9818 | #!/usr/bin/env python
# Python version 3.4+
import sys
import os
import re
import math
import requests
# Simple ranged download script. For those times when the other end just decides
# to close the file stream and you end up with partial files. This fixes
# that issue.
# -> Requests is required. Use 'p... |
the-stack_0_9821 | from io import StringIO
import os
import numpy as np
import pandas as pd
from .. import fem_attribute
class ListStringSeries():
def __init__(self, list_string_series):
self._list_string_series = list_string_series
return
def __len__(self):
return len(self._list_string_series)
... |
the-stack_0_9822 | # -*- coding: utf-8 -*-
import requests, json
import numpy as np
import scipy.interpolate as si
from scipy.optimize import brentq
from functools import partial
_error_msg = {
1: 'Parameter t must be a list or an array that represents knot vector.',
2: 'Method parameter must be one of: "interp", ... |
the-stack_0_9823 | # 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... |
the-stack_0_9824 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2020, 2022.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivat... |
the-stack_0_9827 | # -*- 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
# this allows to use the readthedocs theme also locally
import sphi... |
the-stack_0_9828 | import math
import random
# random
x = 10
y = 50
print(random.randrange(x, y))
# math
num1 = 234.01
num2 = 6
num3 = -27.01
print("The smallest integer greater than or equal to num1,",
num1, ":", math.ceil(num1))
print("The largest integer smaller than or equal to num1,",
num1, ":", math.floor(num1))
pri... |
the-stack_0_9829 | """Tests for the MDWeb Base Objects."""
from pyfakefs import fake_filesystem_unittest, fake_filesystem
import unittest
from mdweb.BaseObjects import MetaInfParser
from mdweb.Exceptions import PageMetaInfFieldException
from mdweb.Navigation import Navigation
from mdweb.Page import Page, load_page
class TesNavigationBa... |
the-stack_0_9832 | # -*- coding:utf-8 -*-
__author__ = 'Randolph'
import os
import sys
import time
import logging
sys.path.append('../')
logging.getLogger('tensorflow').disabled = True
import numpy as np
import tensorflow as tf
from tensorboard.plugins import projector
from text_fast import TextFAST
from utils import checkmate as cm
f... |
the-stack_0_9833 | # Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the BSD 3-Clause License (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://opensource.org/licenses/BSD-3-Clause
#
# Unless required by applicable law or agreed to in ... |
the-stack_0_9835 | # Copyright 2017 the pycolab 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... |
the-stack_0_9837 | """Utility for retrieveing the docstring of a dataclass's attributes
@author: Fabrice Normandin
"""
import inspect
import typing
from argparse import ArgumentTypeError
from dataclasses import dataclass
from typing import *
from logging import getLogger
logger = getLogger(__name__)
@dataclass
class AttributeDocStrin... |
the-stack_0_9838 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 5/15/20 4:49 PM
# @File : grover.py
# qubit number=4
# total number=38
import cirq
import cirq.google as cg
from typing import Optional
import sys
from math import log2
import numpy as np
#thatsNoCode
from cirq.contrib.svg import SVGCircuit
# Symbols for... |
the-stack_0_9839 | from openpyxl import Workbook
from openpyxl.styles import PatternFill
from openpyxl.formatting.rule import FormulaRule
wb = Workbook()
ws = wb.active
ws.cell(2, 1).value = '空白ではない'
ws.cell(4, 1).value = 5.3529
orange_fill = PatternFill('solid', start_color='FFA500', end_color='FFA500')
is_blank_rule = Formu... |
the-stack_0_9841 | template_open = '{{#ctx.payload.aggregations.result.hits.hits.0._source}}'
template_close = template_open.replace('{{#','{{/')
kibana_url = (
"{{ctx.metadata.kibana_url}}/app/kibana#/discover?"
"_a=(columns:!(_source),filters:!(('$state':(store:appState),meta:(alias:!n,disabled:!f,"
"index:'metr... |
the-stack_0_9842 | import logging
import re
from streamlink.plugin import Plugin, pluginmatcher
from streamlink.plugin.api import validate
from streamlink.stream.hls import HLSStream
log = logging.getLogger(__name__)
@pluginmatcher(re.compile(
r"https?://(?:www\.)?pandalive\.co\.kr/"
))
class Pandalive(Plugin):
_room_id_re = ... |
the-stack_0_9843 | # coding=utf-8
"""
Ingest data from the command-line.
python srtm_prepare.py --output Elevation_1secSRTM_DEMs_v1.0_DEM_Mosaic_dem1sv1_0.yaml \
/g/data/rr1/Elevation/NetCDF/1secSRTM_DEMs_v1.0/DEM/Elevation_1secSRTM_DEMs_v1.0_DEM_Mosaic_dem1sv1_0.nc
"""
from __future__ import absolute_import
import uuid
from dateutil... |
the-stack_0_9844 | '''
By Benjamin
'''
class Dealer:
'''
INPUT: None
This is the dealer's class.
'''
def __init__(self):
self.cards = [] # Place holder for the dealer's cards
self.hidden_card = 0 # Place holder for the hidden card
# ----------------------------
def hide_first_card(self):
... |
the-stack_0_9846 | # Copyright 2020 The PyMC Developers
#
# 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 ag... |
the-stack_0_9847 | #!/usr/bin/env python3
# Complete the maxSubsetSum function below.
def maxSubsetSum(arr):
if len(arr) == 0: return 0
if len(arr) == 1: return arr[0]
arr[0] = max(0, arr[0])
arr[1] = max(arr[0], arr[1])
for i in range(2, len(arr)):
arr[i] = max(arr[i - 1], arr[i] + arr[i - 2])
return ar... |
the-stack_0_9849 | lista = []
jogador = dict()
golslist = []
total = 0
while True:
jogador.clear()
golslist.clear()
jogador['nome'] = str(input('Nome do jogador: '))
jogador['partidas'] = int(input(f'Quantas partidas {jogador["nome"]} jogou? '))
for i in range(0, jogador['partidas']):
gol = int(input(f'Quanto... |
the-stack_0_9852 | import curses
import time
from sudoku import Sudoku
menu = ["Rules", "Play", "Exit"]
submenu = ["Easy", "Hard", "Exit"]
def intro_message():
welcome_message = """
Welcome to Sudoku
Rules:
All rows should have the digits 1-9, without repition.
All columns should have the digits 1-9, without repit... |
the-stack_0_9853 | from django.db.models.signals import m2m_changed
from django.dispatch import receiver
from guardian.shortcuts import assign_perm, remove_perm
from grandchallenge.cases.models import Image
from grandchallenge.reader_studies.models import Answer, ReaderStudy
from grandchallenge.reader_studies.tasks import add_scores
@... |
the-stack_0_9854 | import os
import yaml
import collections
import logging
log = logging.getLogger(__name__)
# Recursive dictionary merge
# Copyright (C) 2016 Paul Durivage <pauldurivage+github@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as p... |
the-stack_0_9855 | """."""
import os
import matplotlib.gridspec as gridspec
import matplotlib.pyplot as plt
import numpy as np
SCRIPT_ABS_DIR = os.sys.path[0]
os.sys.path.append(os.path.join(SCRIPT_ABS_DIR, '../../config'))
import my_py_picture as config # noqa
figure_width = config.MAX_FULL_PAGE_WIDTH * 0.8
FIGSIZE = (figure_width,... |
the-stack_0_9856 | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.