filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_0_8125 | #The simplest way to work with zlib requires holding all of the data to be compressed or decompressed in memory.
import zlib
import binascii
original_data = b'This is the original text.'
print('Original :', len(original_data), original_data)
compressed = zlib.compress(original_data)
print('Compressed :', len(c... |
the-stack_0_8127 | # !/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
# -------------------------------------------#
# author: sean lee #
# email: xmlee97@gmail.com #
#--------------------------------------------#
"""MIT License
Copyright ... |
the-stack_0_8128 | #!/usr/bin/env python
import matplotlib.pyplot as plt
import theanets
from utils import load_mnist, plot_layers, plot_images
e = theanets.Experiment(
theanets.Classifier,
layers=(784, 1024, 256, 64, 10),
train_batches=100,
)
# first, run an unsupervised layerwise pretrainer.
train, valid, _ = load_mnis... |
the-stack_0_8129 | import logging
from astropy.table import Table
from astropy.coordinates import SkyCoord
from astropy import units as u
from astropy.io import fits
import numpy as np
import math
import matplotlib.pyplot as plt
from LCOWCSLookupProvider import getWCSForcamera, transformList
from gaiaastrometryservicetools import astrome... |
the-stack_0_8130 | #!/usr/bin/env python3
# Copyright (c) 2017-2019 The BitPal Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the listsinceblock RPC."""
from test_framework.test_framework import BitPalTestFramework
from test... |
the-stack_0_8132 | # -*- coding: utf-8 -*-
"""
spectrum
"""
# import standard libraries
import os
from colour.colorimetry.spectrum import MultiSpectralDistributions
from colour.models.rgb.datasets import srgb
# import third party libraries
import numpy as np
from colour import SpectralShape, XYZ_to_RGB, XYZ_to_xyY
from colour.models im... |
the-stack_0_8133 | from bisect import bisect_left
from bisect import bisect_right
from contextlib import contextmanager
from copy import deepcopy
from functools import wraps
from inspect import isclass
import calendar
import collections
import datetime
import decimal
import hashlib
import itertools
import logging
import operator
import r... |
the-stack_0_8135 | import logging, sys, time
class Logger:
def __init__(self):
self.activatedLogger = False
def animation(self, string=None):
if string:
sys.stdout.write(string)
sys.stdout.flush()
sys.stdout.write(".")
sys.stdout.flush()
time.sleep(0.8)
... |
the-stack_0_8136 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
def create_logger(name, log_file=None):
""" use different log level for file and stream
"""
l = logging.getLogger(name)
formatter = logging.Formatter('[%(asctime)s] %(message)s')
l.setLevel(logging.DEBUG)
sh = logging.StreamHandler... |
the-stack_0_8138 | from boggle import Boggle
from flask import Flask, render_template, session, jsonify, request
# from flask_debugtoolbar import DebugToolbarExtension
app = Flask(__name__)
app.config["SECRET_KEY"] = "boggleSecretKey99"
# debug = DebugToolbarExtension(app)
boggle_game = Boggle()
@app.route('/')
def landing_page():
... |
the-stack_0_8139 |
# -*- coding: utf-8 -*-
"""
@author: Miguel Ángel López Robles
"""
#from PyDBOD import loop
import numpy as np
import matplotlib.pyplot as plt
from sklearn.metrics import roc_curve, auc
#from PyDBOD.ldof import LDOF
import sys
sys.path.append("..")
from ldof import LDOF
from load import load_data
#################... |
the-stack_0_8140 | """
The CharacteristicsHandler will receive a file path, read out its
characteristics as needed and return a dictionary with them.
More functions can will be added in the future.
Tip for usage:
import characteristicshandler.CharacteristicsHandler as chan
chars = chan.handle_file_path("/path/to/file.hi")
"""
import os... |
the-stack_0_8141 | from copy import deepcopy
from typing import Union, Dict, Any, List
from checkov.common.graph.graph_builder.graph_components.attribute_names import CustomAttributes
from checkov.common.graph.graph_builder.utils import calculate_hash, join_trimmed_strings
from checkov.common.graph.graph_builder.variable_rendering.bread... |
the-stack_0_8143 | # -*- coding: utf-8 -*-
# *****************************************************************************
# NICOS, the Networked Instrument Control System of the MLZ
# Copyright (c) 2009-2022 by the NICOS contributors (see AUTHORS)
#
# This program is free software; you can redistribute it and/or modify it under
# the t... |
the-stack_0_8144 | # -*- coding: utf-8 -*-
"""Language Tour: Generators"""
from typing import List, Tuple, Set, Generator, Dict, Iterable, Iterator
if __name__ == "__main__":
# Ternary compare
val: int = 32
print(val if val >= 0 else -val)
# List
var_list: List[int] = [i for i in range(20) if i % 3 > 0]
... |
the-stack_0_8147 | # Copyright (C) 2020 University of Oxford
#
# 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 t... |
the-stack_0_8148 | # Copyright 2018 The TensorFlow 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 applica... |
the-stack_0_8152 | #
# This file is part of pretix (Community Edition).
#
# Copyright (C) 2014-2020 Raphael Michel and contributors
# Copyright (C) 2020-2021 rami.io GmbH and contributors
#
# 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-stack_0_8153 | # Adapted from Sebastian Noack's python-goto, originally licensed under the
# Unlicence and re-licenced under Apache 2.0 as part of Pomagma.
import pytest
from goto import goto, label, with_goto
CODE = '''\
i = 0
result = []
label.start
if i == 10:
goto.end
result.append(i)
i += 1
goto.start
label.end
'''
EXP... |
the-stack_0_8154 | import numpy as np
import pandas as pd
import tensorflow as tf
import math
from sklearn.cluster import KMeans
import Loaddata
from numpy import random
import time
from datetime import date
import matplotlib.pyplot as plt
import os
from pandas import DataFrame, concat
import multiprocessing as mp
class LSTM_double:
... |
the-stack_0_8157 | from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Border(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "pointcloud.marker"
_path_str = "pointcloud.marker.border"
_valid_props = {"arearatio", "colo... |
the-stack_0_8158 | from array import array
from functools import partial
import traceback
import importlib
from enum import Enum
import dask
from dask.base import normalize_token
import msgpack
from . import pickle
from ..utils import has_keyword, typename, ensure_bytes
from .compression import maybe_compress, decompress
from .utils i... |
the-stack_0_8160 | list_ = input()
# list_ = "день победы 1945 года 9 мая"
list_01 = list_.split(' ')
num_ = []
for i in list_01:
if i.isdigit(): # условие должно быть [True], можно не прописывать
# print(list_01)
num_.append(int(i))
# print(num_)
num_.sort() # не нужно создавать новый массив, преобразует (сказано был... |
the-stack_0_8162 | import inspect
import os
import shutil
import subprocess
import stat
import sys
import tarfile
import time
import zipfile
def install_requirements(what):
old_path = sys.path[:]
w = os.path.join(os.getcwd(), os.path.dirname(inspect.getfile(inspect.currentframe())))
sys.path.insert(0, os.path.dirname(os.pat... |
the-stack_0_8163 | import tempfile
from pathlib import Path
import argparse
import shutil
import os
import glob
import cv2
import cog
from run import run_cmd
from datetime import datetime
class Predictor(cog.Predictor):
def setup(self):
parser = argparse.ArgumentParser()
parser.add_argument(
"--input_fold... |
the-stack_0_8164 | #!/usr/bin/env python3
#
# Copyright 2022 Graviti. Licensed under MIT License.
#
"""The implementation of the Sheets."""
from typing import Any, Dict, Iterator, MutableMapping
from tensorbay.dataset import Notes, RemoteData
from tensorbay.label import Catalog
from tensorbay.utility import URL
from graviti.client im... |
the-stack_0_8165 | # Copyright 2015 The TensorFlow 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 applica... |
the-stack_0_8166 | """Ajout vigilance meteo
Revision ID: 901a31d192ad
Revises: dcffac33e4fd
Create Date: 2021-11-26 16:35:51.243300
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = '901a31d192ad'
down_revision = 'dcffac33e4fd'
branch_label... |
the-stack_0_8167 | """
[PYTHON NAMING CONVENTION]
module_name, package_name, ClassName, method_name, ExceptionName, function_name,
GLOBAL_CONSTANT_NAME, global_var_name, instance_var_name, function_parameter_name,
local_var_name.
"""
import sys, os
import cv2
import re
import pprint
import numpy as np
import time, datetim... |
the-stack_0_8169 | # 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 ... |
the-stack_0_8172 | # 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 may ... |
the-stack_0_8173 | import math
import mpmath
import numpy as np
from PIL import Image
import os
class EvenDimensionError(Exception):
# The required resolution for the image is a square with a center pixel that
# has the same number of pixels to the left, to the right, above, and
# underneath, which precludes any even number... |
the-stack_0_8175 | from bddrest import response, when, status
from nanohttp import json
from sqlalchemy import Unicode, Integer
from restfulpy.controllers import JSONPatchControllerMixin, ModelRestController
from restfulpy.orm import commit, DeclarativeBase, Field, DBSession, \
FilteringMixin, PaginationMixin, OrderingMixin, Modifie... |
the-stack_0_8176 | import torch
import torch.nn as nn
import torch.utils.checkpoint as checkpoint
from timm.models.layers import DropPath, to_2tuple, trunc_normal_
class Mlp(nn.Module):
def __init__(self, in_features, hidden_features=None, out_features=None, act_layer=nn.GELU, drop=0.):
super().__init__()
out_featur... |
the-stack_0_8179 | # coding=utf8
import numpy as np
def rerec(bbox):
'''
Convert to square
:param bbox:
:return:
'''
h = bbox[:, 2] - bbox[:, 0] + 1
w = bbox[:, 3] - bbox[:, 1] + 1
max_l = np.maximum(h, w)
bbox[:, 0] = np.round(bbox[:, 0] + (h - max_l) * 0.5)
bbox[:, 1] = np.round(bbox[:, 1] + (... |
the-stack_0_8182 | import os
from binascii import unhexlify
import pytest
from cose.algorithms import EdDSA
from cose.keys.curves import Ed448, Ed25519, X448, X25519
from cose.exceptions import CoseInvalidKey, CoseIllegalKeyType, CoseUnsupportedCurve, CoseException, CoseIllegalKeyOps
from cose.keys import OKPKey, CoseKey
from cose.keys... |
the-stack_0_8185 | if __name__ == '__main__':
from setuptools import setup, Extension
_synctex_parser = Extension('pysynctex._synctex_parser',
sources=['wrapper/synctex_parser.i',
'wrapper/synctex_package/synctex_parser.c',
'wrapp... |
the-stack_0_8189 | #!/usr/bin/env python3
import os, sys
service = "[Unit]\n"\
"Description={description}\n"\
"After=network.target\n"\
"StartLimitIntervalSec=0\n"\
"\n"\
"[Service]\n"\
"Type=simple\n"\
"Restart=always\n"\
"RestartSec=1\n"\
"User=root\n"\
"ExecStart={exec}\n"\
"\n"\
"[Install]\n"\
"WantedBy=multi-user.target"
name = Fa... |
the-stack_0_8191 | from distutils.core import setup
with open("README.md", "r") as fh:
long_description = fh.read()
setup(
name="GPGame",
version="2020.0.2",
author="Nishant Vikramaditya",
author_email="junk4Nv7@gmail.com",
description="An abstraction layer on the Kivy GPU accelerated engine.",
long_descript... |
the-stack_0_8194 | import tempfile, time, sys
import pymailer
f = tempfile.NamedTemporaryFile('r+t', suffix='.html', delete=True)
f.write('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">\
<html lang="fr">\
<head>\
<meta http-equiv="content-type" content="text/html;charset=utf-8" />\
</head>\
<... |
the-stack_0_8196 | # Copyright (c) 2004 Divmod.
# See LICENSE for details.
import urllib.request, urllib.parse, urllib.error, warnings
from twisted.python import log, failure
from nevow import util
from nevow.stan import directive, Unset, invisible, _PrecompiledSlot
from nevow.inevow import ICanHandleException, IData, IMacroFactory,... |
the-stack_0_8197 | #!/usr/bin/env python3
#################################################################################
# The MIT License (MIT)
#
# Copyright (c) 2015, George Webster. All rights reserved.
#
# Approved for Public Release; Distribution Unlimited 14-1511
#
# Permission is hereby granted, free of charge, to any person o... |
the-stack_0_8198 | # Copyright (c) 2008, Humanized, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditio... |
the-stack_0_8200 | """
Author: <REPLACE>
Project: 100DaysPython
File: module3_day29_fileManipulations.py
Creation Date: <REPLACE>
Description: <REPLACE>
"""
import os
# First change the working directory to point to the folder containing the files
os.chdir("./audio")
# The `.listdir()` ... |
the-stack_0_8201 | #!/usr/bin/python
import datetime
from transformers import TFBertForSequenceClassification
import tensorflow as tf
from tensorflow.keras import Input
from tensorflow.keras import backend as K, initializers, regularizers, constraints
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Act... |
the-stack_0_8203 | from __future__ import annotations
import inspect
import re
from typing import TYPE_CHECKING, Any, Callable, List, Optional, Type, Union, cast
import numpy as np
from pandas._libs import (
Interval,
Period,
Timestamp,
algos as libalgos,
internals as libinternals,
lib,
writers,
)
from pand... |
the-stack_0_8204 | """Switch platform for Advantage Air integration."""
from homeassistant.helpers.entity import ToggleEntity
from .const import (
ADVANTAGE_AIR_STATE_OFF,
ADVANTAGE_AIR_STATE_ON,
DOMAIN as ADVANTAGE_AIR_DOMAIN,
)
from .entity import AdvantageAirEntity
async def async_setup_entry(hass, config_entry, async_... |
the-stack_0_8206 | #coding=utf8
import os
import itchat
from NetEaseMusicApi import interact_select_song
HELP_MSG = u'''\
欢迎使用微信网易云音乐
帮助: 显示帮助
关闭: 关闭歌曲
歌名: 按照引导播放音乐\
'''
with open('stop.mp3', 'w') as f: pass
def close_music():
os.startfile('stop.mp3')
@itchat.msg_register(itchat.content.TEXT)
def music_player(ms... |
the-stack_0_8209 | import pytest
from hypothesis import given, settings, HealthCheck
from hypothesis import reproduce_failure # pylint: disable=unused-import
from itertools import product
import numpy as np
from tests.hypothesis_helper import dfs_min2, dfs_no_min
from os import environ
if environ.get("TRAVIS"):
max_examples = ... |
the-stack_0_8210 | import os
import shlex
import subprocess
import h5py
import numpy as np
import torch
import torch.utils.data as data
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
def _get_data_files(list_filename):
with open(list_filename) as f:
return [line.rstrip() for line in f]
def _load_data_file(name):
... |
the-stack_0_8212 | # coding=utf-8
# Copyright (c) 2020, NVIDIA CORPORATION. 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 re... |
the-stack_0_8214 |
import random
import numpy as np
import matplotlib.pyplot as plt
def plus_minus_one_generator(): #funcao que retora +1 ou -1, com probabilidade
x = [-1,1,-1,1,-1,1] # de 50% para ambos.
return random.choice(x)
def main():
i =0
u = []
while(i < 50):
u.append(plus_minus_one_generator()... |
the-stack_0_8217 | import numpy as np
import os
import tensorflow as tf
from PIL import Image
import utility as Utility
from make_mnist_datasets import Make_mnist_datasets
#global variants
batchsize = 100
data_size = 6000
noise_num = 100
class_num = 10
n_epoch = 1000
l2_norm_lambda = 0.001
alpha_P = 0.5
alpha_pseudo = 0.1
alpha_apply_t... |
the-stack_0_8219 | # Copyright (c) 2011 X.commerce, a business unit of eBay Inc.
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# Copyright 2013 IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you... |
the-stack_0_8220 | """
PipelineWise CLI - Pipelinewise class
"""
import logging
import os
import shutil
import signal
import sys
import json
import copy
import psutil
import pidfile
from datetime import datetime
from time import time
from typing import Dict, Optional, List
from joblib import Parallel, delayed, parallel_backend
from tabu... |
the-stack_0_8221 | import pytest
from plenum.common.exceptions import RequestRejectedException, \
RequestNackedException
from indy_common.constants import POOL_RESTART, ACTION, START, DATETIME
from plenum.common.constants import TXN_TYPE
from plenum.test.helper import sdk_gen_request, sdk_sign_and_submit_req_obj, \
sdk_get_repl... |
the-stack_0_8224 | # -*- coding: utf-8 -*-
from __future__ import division
import numpy as np
import pandas as pd
from scipy.stats import multivariate_normal
from pgmpy.factors.base import BaseFactor
class LinearGaussianCPD(BaseFactor):
"""
For, X -> Y the Linear Gaussian model assumes that the mean
of Y is a linear func... |
the-stack_0_8226 | # Copyright 2019, OpenCensus 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 w... |
the-stack_0_8229 | import matplotlib.pyplot as plt
import numpy as np
import vae.training
import vae.cvae_model
import vae.regression_model
import vae.dataman
import torch
import torch.nn as nn
dataset = vae.dataman.DataManager(
mappings={
'sigma': None,
'albedo': lambda a: np.power(1 - a, 1.0 / 6),
'g': Non... |
the-stack_0_8232 | # SPDX-License-Identifier: BSD-3-Clause
# Copyright (c) 2020 Intel Corporation
"""REST inteface to model_runner."""
import io
from logging import exception
import sanic
from sanic import response
from logger import logger
from model_hub import ModelLoader
from model_hub import ImageProcessor
from model_hub import Mo... |
the-stack_0_8236 | # IMPORTATION STANDARD
# IMPORTATION THIRDPARTY
import requests
import pandas as pd
import pytest
# IMPORTATION INTERNAL
from gamestonk_terminal.stocks.due_diligence import ark_model
@pytest.fixture(scope="module")
def vcr_config():
return {
"filter_headers": [("User-Agent", None)],
"filter_quer... |
the-stack_0_8238 | # Python libraries
import argparse
import os
# Lib files
import lib.medloaders as medical_loaders
import lib.medzoo as medzoo
import lib.train as train
import lib.utils as utils
from lib.losses3D import DiceLoss
from lib.visual3D_temp import *
os.environ["CUDA_VISIBLE_DEVICES"] = "0,2"
seed = 1777777
def main():
... |
the-stack_0_8240 | #@+leo-ver=5-thin
#@+node:ekr.20031218072017.3603: * @file leoUndo.py
'''Leo's undo/redo manager.'''
#@+<< How Leo implements unlimited undo >>
#@+node:ekr.20031218072017.2413: ** << How Leo implements unlimited undo >>
#@+at Think of the actions that may be Undone or Redone as a string of beads
# (g.Bunches) containin... |
the-stack_0_8241 | #! coding:utf-8
"""
The bottle module defines the Bottle class that is one element in
a water sort puzzle.
"""
# Import to do typing :Bottle inside class Bottle
from __future__ import annotations
from typing import Sequence, Optional, Set, Any
class BottleError(Exception):
"""Exception from the Bottle class.""... |
the-stack_0_8242 | import base64
import json
import logging
from html.parser import HTMLParser
from http.client import HTTPConnection
from markupsafe import escape
from sqlalchemy import (
and_,
desc,
)
from sqlalchemy.orm import (
joinedload,
lazyload,
undefer,
)
from sqlalchemy.sql import expression
from galaxy im... |
the-stack_0_8243 | from batou.component import Component
from batou.lib.appenv import AppEnv
from batou.lib.file import SyncDirectory, File
from batou.lib.supervisor import Program
from batou.utils import Address
class Django(Component):
def configure(self):
self.address = Address(self.host.fqdn, "8081")
self += Ap... |
the-stack_0_8245 | from setuptools import setup
import os.path
current_dir = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(current_dir, 'README.md')) as rdr:
long_description = rdr.read()
setup(name='pymonkey',
version='0.1.0',
description='Monkey interpreter',
long_description=long_description... |
the-stack_0_8247 | import json
import jsonpickle
from decimal import Decimal
from flask import Blueprint
from farmsList.public.models import Parcel, Farmland, AdditionalLayer
from farmsList.database import db
from sqlalchemy import func
blueprint = Blueprint('api', __name__, url_prefix='/api',
static_folder="../static")
def pre... |
the-stack_0_8248 | import requests
import json
import time
import logging
log = logging.getLogger(__name__)
sh = logging.StreamHandler()
log.addHandler(sh)
log.setLevel(logging.INFO)
from nose.tools import with_setup
import pymongo
from bson.objectid import ObjectId
db = pymongo.MongoClient('mongodb://localhost:9001/scitran').get_defa... |
the-stack_0_8249 | """empty message
Revision ID: 65edcc47e4ed
Revises: c9d6313461dd
Create Date: 2020-05-24 17:13:03.346660
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '65edcc47e4ed'
down_revision = 'c9d6313461dd'
branch_labels = None
depends_on = None
def upgrade():
# ... |
the-stack_0_8251 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Project: Tesis Lali
Experiment: Camp Visual -> Perimetria
Created on Sun Feb 3 11:29:49 2019
@author: Aitor Matilla
Hitoria dels canvis
versio 2.0.0 canvi mètode: de dins a fora i de fora a dins (2 voltes) enlloc de
versio 2.0.1 canvi de nom a Perimetria, afegir time... |
the-stack_0_8254 | from .annospan import AnnoSpan, SpanGroup
from .utils import flatten, merge_dicts
class MetaSpan(AnnoSpan):
def __init__(self, span=None, start=None, end=None, doc=None, metadata={}):
if span is None:
self.start = start
self.end = end
self.doc = doc
elif isinsta... |
the-stack_0_8255 | from conans import ConanFile, CMake
class ValuePtrLiteConan(ConanFile):
version = "0.2.1"
name = "value-ptr-lite"
description = "A C++ smart-pointer with value semantics for C++98, C++11 and later"
license = "Boost Software License - Version 1.0. http://www.boost.org/LICENSE_1_0.txt"
url = "https:/... |
the-stack_0_8257 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import pandas as pd
import requests
UTAHAQ_API_BASE_URI = 'http://meso2.chpc.utah.edu/aq/cgi-bin/download_mobile_archive.cgi'
UTAHAQ_API_TOKEN = os.getenv('UTAHAQ_API_TOKEN')
def _utahaq_batch_get(stid: str,
yr: int,
... |
the-stack_0_8258 | #!/usr/bin/env python3
# Copyright (c) 2013-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Generate seeds.txt from Pieter's DNS seeder
#
NSEEDS = 512
MAX_SEEDS_PER_ASN = 2
MIN_BLOCKS = 33760... |
the-stack_0_8259 | from ..db import *
from .. import currentUser
from ..accounting import UsageStatistics
from ..lib import logging
from ..lib.error import UserError
from ..generic import *
class Organization(Entity, BaseDocument):
name = StringField(unique=True, required=True)
totalUsage = ReferenceField(UsageStatistics, db_field='to... |
the-stack_0_8260 | # coding=utf-8
# Copyright 2020 The Google Research 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 applicab... |
the-stack_0_8263 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @trojanzhex
from pyrogram import filters
from pyrogram import Client as trojanz
from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton
from config import Config
from script import Script
from helpers.progress import PRGRS
from helpers.tool... |
the-stack_0_8264 | """!
This file contains some pair potentials.
\ingroup lammpstools
"""
import lammpstools
import dumpreader
import numpy as np
import math
import sys
def make_pair_table( fname, name, pair_pot, N, mode = "R", lo = 1.0, hi = 10.0 ):
"Dumps a LAMMPS-style pair table to given file."
if mode == "R":
... |
the-stack_0_8268 | #===============================================================================
# Copyright 2009 Matt Chaput
#
# 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... |
the-stack_0_8269 |
import requests
#import sys
from selenium import webdriver
import re
from bs4 import BeautifulSoup
#from bs4 import UnicodeDammit
#sys.stdout = codecs.getwriter("iso-8859-8")(sys.stdout, 'xmlcharrefreplace')
import os
project_dir = os.path.dirname(os.path.abspath(__file__))
#project_dir = project_dir.replace('\\','/')... |
the-stack_0_8270 | import argparse
import os
import numpy as np
import torch
import torch.nn.functional as F
from pil import Image
from Network import UNet
from utils import resize_and_crop, normalize, split_img_into_squares, hwc_to_chw, merge_masks
from utils import plot_img_and_mask
from torchvision import transforms
... |
the-stack_0_8273 | import math, networkx as nx, timeit, unittest
class ConnectTheDotsBigDataTest(unittest.TestCase):
"""
Benchmarking suite for ConnectTheDots (large datasets)
"""
def test_bc_runtime(self):
"""
Test time needed to calculate betweenness centrality
"""
TEST_CASES = [] # ad... |
the-stack_0_8274 | from datetime import datetime
from io import BytesIO
import os
import shutil
from behave import *
from tsserver import configutils
from tsserver.dtutils import datetime_to_str
from tsserver.features.testutils import (
open_resource, resource_path, table_to_database
)
from tsserver.photos.models import Photo
PHO... |
the-stack_0_8278 | import os
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
import sys
import json
import gc
from tqdm import tqdm
from sklearn.cluster import KMeans
from encode import lstm_encoder
from dataprocess_tacred import data_sampler
from model import pro... |
the-stack_0_8280 | import asyncio
import logging
import pathlib
import random
import tempfile
from concurrent.futures.process import ProcessPoolExecutor
from typing import IO, List, Tuple, Optional
from chia.consensus.block_record import BlockRecord
from chia.consensus.constants import ConsensusConstants
from chia.full_node.weight_proof... |
the-stack_0_8282 | import urllib.request
import unittest
import time
import dewpoint.aws
class TestAWSAuthHandlerV4(unittest.TestCase):
def setUp(self):
self.auth_handler = dewpoint.aws.AWSAuthHandlerV4(
key='AKIDEXAMPLE',
secret='wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY',
region='us-eas... |
the-stack_0_8283 | from flask import current_app, Blueprint, request
from assemblyline_ui.api.base import api_login, make_api_response
from assemblyline_ui.config import config
API_PREFIX = "/api/v4"
apiv4 = Blueprint("apiv4", __name__, url_prefix=API_PREFIX)
apiv4._doc = "Version 4 Api Documentation"
################################... |
the-stack_0_8284 | mappp = [list(map(int, input().split())) for _ in range(9)]
pos = []
for i in range(9):
for j in range(9):
if mappp[i][j] == 0:
pos.append([i, j])
enddd = False
def back_dfs(idx):
global enddd
if enddd:
return
if idx == len(pos):
for i in range(9):
for j in range(9):
print(mappp[i][j], end=" ")
... |
the-stack_0_8285 | # -*- coding: utf-8 -*-
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)
"""Kite document requests handlers and senders."""
from collections import defaultdict
import logging
import hashlib
import os
import os.path as osp
from qtpy.QtCor... |
the-stack_0_8286 | #!/usr/bin/env python3
# Copyright (c) 2018 The Bitcoin Core developers
# Copyright (c) 2017 The Raven Core developers
# Copyright (c) 2018 The Rito Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Testing asset m... |
the-stack_0_8287 | """
Copyright 2019 Goldman Sachs.
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 di... |
the-stack_0_8290 | import pytest
from lkmltools.google_auth_helper import GoogleAuthHelper
import os
import json
@pytest.fixture(scope="module")
def get_raw_json():
raw_json = {
"type": "service_account",
"project_id": "someproject",
"private_key_id": "xxx",
"private_key": "-----BEGIN PRIVATE KEY----... |
the-stack_0_8293 | """ Cisco_IOS_XR_lpts_pa_oper
This module contains a collection of YANG definitions
for Cisco IOS\-XR lpts\-pa package operational data.
This module contains definitions
for the following management objects\:
lpts\-pa\: lpts pre\-ifib data
Copyright (c) 2013\-2018 by Cisco Systems, Inc.
All rights reserved.
"""
... |
the-stack_0_8295 | # Copyright 2007-2010 by Peter Cock. All rights reserved.
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
from __future__ import print_function
from Bio._py3k import basestring
import os
import war... |
the-stack_0_8297 | class Solution:
def compareVersion(self, version1: str, version2: str) -> int:
l1 = [int(s) for s in version1.split(".")]
l2 = [int(s) for s in version2.split(".")]
len1, len2 = len(l1), len(l2)
if len1 > len2:
l2 += [0] * (len1 - len2)
elif len1 < len2:
... |
the-stack_0_8298 | import unittest
from unittest import mock
from datetime import datetime,timedelta
from shutil import rmtree
import os
import json
import dotenv
# project modules
from logs.config.logging import logs_config
from locations import paths, dirs, root_dir, test_dir
from modules.email import email_notification, login_to_gmai... |
the-stack_0_8299 | import os
import json
import logging
def load_mock_data(filename):
base_dir = os.path.dirname(os.path.abspath(__file__))
resource_file = os.path.join(base_dir, 'test_data/%s' % filename)
json_text = '[]'
try:
with open(resource_file, 'r') as f:
json_text = f.read()
except IOEr... |
the-stack_0_8300 | import onnx
from onnx import helper
from onnx import TensorProto
from onnx import OperatorSetIdProto
import itertools
onnxdomain = OperatorSetIdProto()
onnxdomain.version = 12
# The empty string ("") or absence of this field implies the operator set that is defined as part of the ONNX specification.
onnxdomain.domain ... |
the-stack_0_8301 | import os
import re
from . import utils
SASS_IMPORT_RE = re.compile(r"""@import\s+['"](.+?(?:\.s[ca]ss)?)['"]\s*;""")
def _read_sass_imports(file):
deps = []
with open(file) as f:
sassfile = f.read()
imports = SASS_IMPORT_RE.findall(sassfile)
sass_dir = os.path.dirname(file)
for imp in ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.