filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_106_31218 | import re
import platform
import distro
import psutil
import discord
from discord.ext import tasks, commands
from utils.scrape import get_overwatch_news
class Tasks(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.update.start()
self.statistics.start()
self.subscripti... |
the-stack_106_31219 | import numpy as np
from sklearn.neighbors import KNeighborsClassifier
from sklearn.linear_model import LogisticRegression
from sklearn.cluster import KMeans
from scipy.spatial import distance
from sklearn.metrics import accuracy_score
from collections import defaultdict
import os
import time
from tensorflow.python.plat... |
the-stack_106_31220 | #!/usr/bin/python3
'''
Implements sending messages via fedora-messaging. To send messages
one needs credentials to the restricted Fedora broker. In a developer
workflow, one can also run it against a local rabbitmq instance.
For more details, see:
https://fedora-messaging.readthedocs.io/en/latest/... |
the-stack_106_31221 | """WOLFGOATCABBAGE implementation and main
Created By: Kim Eaton and Luciano Gibertoni
Date: 2/27/2022
"""
from search import *
class WolfGoatCabbage(Problem):
def __init__(self, initial=frozenset({'F','G', 'W', 'C'}), goal=frozenset({})):
""" Define goal state and initialize a problem """
super... |
the-stack_106_31225 | # -*- coding: utf-8 -*-
'''
@author: Angel Navia Vázquez
Feb 2021
python3 pom5_MBSVM_master_pycloudmessenger.py --dataset M-mnist-dlp100 --verbose 1
'''
import argparse
import time
import json
import sys, os
import numpy as np
import pickle
# Add higher directory to python modules path.
sys.path.appen... |
the-stack_106_31226 | import logging
import re
import signal
import sys
import time
from typing import Callable, Tuple, Any
import praw
import prawcore
from tor_ocr.core.config import config
from tor_ocr.core.strings import bot_footer
default_exceptions = (
prawcore.exceptions.RequestException,
prawcore.exceptions.ServerError,
... |
the-stack_106_31230 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division, print_function, unicode_literals
from itertools import chain
from operator import attrgetter
from .._compat import ffilter
from ._summarizer import AbstractSummarizer
class EdmundsonLocationMethod(AbstractSummarizer):
... |
the-stack_106_31231 | from flask import redirect
from q_app.engine.utils import get_field_var_name
def get_next_question_id(qdef, qtype, answer):
if qtype != "MULTI_SELECT":
return 0
for index, stored_answer in enumerate(qdef["answer"]):
if stored_answer == answer:
return index
return 0
class U... |
the-stack_106_31232 | import pytest
import numpy as np
from scipy.stats import ttest_ind, ttest_1samp, mannwhitneyu, shapiro, median_test, levene, mood
import abito as ab
@pytest.fixture()
def normal_obs():
np.random.seed(1)
return np.random.normal(loc=102, scale=10, size=1000)
@pytest.fixture()
def normal_obs_control():
np.... |
the-stack_106_31233 | # -*- coding: utf-8 -*-
"""Certificates and the associated private keys
"""
from enum import Enum, unique
from pyssldemo.params import KeyAlgos, SigAlgos, HashAlgos
class Cert(object):
def __init__(
self,
key_algo,
sig_algo,
hash_algo,
cert_name):
... |
the-stack_106_31234 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 OpenStack LLC.
# 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/... |
the-stack_106_31236 | from __future__ import annotations
from typing import Optional, TYPE_CHECKING
from spark_auto_mapper_fhir.fhir_types.boolean import FhirBoolean
from spark_auto_mapper_fhir.fhir_types.list import FhirList
from spark_auto_mapper_fhir.fhir_types.string import FhirString
from spark_auto_mapper_fhir.extensions.extension_ba... |
the-stack_106_31238 | # MIT License
#
# Copyright (c) 2018-2019 Red Hat, Inc.
# 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, m... |
the-stack_106_31239 | # Gemma Radio Tuning Knob
# for fine tuning Software Defined Radio CubicSDR software
# 10k pot hooked to 3v, A2, and D2 acting as GND
import time
import board
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keycode import Keycode
from analogio import AnalogIn
from digitalio import DigitalInOut, Direction... |
the-stack_106_31240 | from random import shuffle
alfabeto = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T']
# def sorteio_roleta(populacao):
# #populacao
#
def get_cidades(tamanho):
return alfabeto[0:tamanho-1]
def get_primeiras_populacoes(tamanho, tamanho_populacao):
model... |
the-stack_106_31241 | #!/usr/bin/env python
import json
import re
import urllib
import logging
import webapp2
import urllib2
import settings
class TelegramAPIError(Exception):
pass
class OSMAPIError(Exception):
pass
def create_osm_note(lat, lon, text):
url = "{}/notes?{}".format(settings.osm_api_prefix,
... |
the-stack_106_31242 | class AbortImportMixin(object):
def abort_import(self, obj):
obj.abort()
self.cleanup_celery(obj)
def cleanup_celery(self, obj):
app = self.get_celery_app()
app.control.revoke(obj.task_id, terminate=True, signal="SIGUSR1")
app.control.purge()
stats = app.control.... |
the-stack_106_31243 |
class ModelSeedBuilder:
def __init__(self, fbamodel, modelseed):
self.fbamodel = fbamodel
self.modelseed = modelseed
def configure_reaction(self, seed_reaction, direction, compartment_config, model_reaction_proteins):
maxforflux = 1000
maxrevflux = 1000
if ... |
the-stack_106_31244 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2018 The Kubeflow 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/licens... |
the-stack_106_31247 | import time
from dataclasses import dataclass
from typing import Optional, List, Union, Dict
import requests
from rchain.crypto import PrivateKey
from rchain.pb.CasperMessage_pb2 import DeployDataProto
from rchain.util import sign_deploy_data
class HttpRequestException(Exception):
def __init__(self, status_code: in... |
the-stack_106_31248 | # 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 import *
class RAbadata(RPackage):
"""Averaged gene expression in human brain regions from Allen Brain At... |
the-stack_106_31249 | from glitter2.analysis import FileDataAnalysis
from glitter2.tests.coded_data import check_metadata, check_channel_data, \
get_timestamps, get_pos_data, get_rounded_list, channel_names, \
get_event_data
def test_import_csv(sample_csv_data_file):
from glitter2.analysis.export import CSVImporter, SourceFile... |
the-stack_106_31250 | import matplotlib
matplotlib.use('Agg')
import os, sys
import yaml
from argparse import ArgumentParser
from tqdm import tqdm
import imageio
import numpy as np
from skimage.transform import resize
from skimage import img_as_ubyte
import torch
from sync_batchnorm import DataParallelWithCallback
from modules.generator i... |
the-stack_106_31251 | import threading
import time
import random
import trio
import asyncio
import contextlib
import logging
import signal
import os
import gc
import pytest
from cobald.daemon.runners.service import ServiceRunner, service
logging.getLogger().level = 10
class TerminateRunner(Exception):
pass
@contextlib.contextman... |
the-stack_106_31253 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
__author__ = 'Richard J. Sears'
VERSION = "0.6 (2021-04-22)"
"""
Simple python script that helps to move my chia plots from my plotter to
my nas. I wanted to use netcat as it was much faster on my 10GBe link than
rsync and the servers are secure so I wrote this script to ma... |
the-stack_106_31254 | """ Parse SLA Lambda Construct """
from aws_cdk import (
core,
aws_iam,
aws_lambda
)
class SlaParseConstruct(core.Construct):
""" Lambda Construct """
stream_name: str
def __init__(
self,
scope: core.Construct,
id: str, # pylint: disable=redefined-builtin
centra... |
the-stack_106_31255 | import cv2
class FrameProvider(cv2.VideoCapture):
"""
The FrameProvider class role is to provide frames from a video stream so that the app will be able
to send the frames to the ANN models.
"""
def __init__(self, param):
"""
Creating a FrameProvider object.
:param param:... |
the-stack_106_31256 | import time
from prefect.tasks.kafka.kafka import KafkaBatchConsume, KafkaBatchProduce
from prefect import task, Flow, Parameter
TOPIC = "example_events"
BOOTSTRAP_SERVER = "localhost:9092"
GROUP_ID = "1"
@task
def print_results(x):
print(f"First two messages: {x[:2]}")
print(f"Last two messages: {x[-2:]}")
... |
the-stack_106_31257 | #!/usr/bin/env python3
import argparse
from contextlib import contextmanager
from copy import deepcopy
import math
import random
from pathlib import Path
import sys
import os
import re
import shlex
import pytorch_lightning as pl
from pytorch_lightning.utilities.distributed import rank_zero_only
import torch
import tor... |
the-stack_106_31264 | import os
from plotly.offline import iplot, plot
import plotly.graph_objs as go
import plotly.figure_factory as ff
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import scipy.stats as stats
import colorlover as cl
def get_spaced_colors(n):
max_value = 255
interval = int(max_value / n)... |
the-stack_106_31265 | import sys
import os
sys.path.append('..')
import tkinter as tk
from tkinter import ttk
from login import A
from tkinter import messagebox
from tkinter import filedialog
from buissness.login_services import Authentication
from buissness.UMS_services import UMS_services
from data.user import User
import socket
import ti... |
the-stack_106_31266 | from a10sdk.common.A10BaseClass import A10BaseClass
class Ip6Stats(A10BaseClass):
"""Class Description::
Statistics for the object ip6-stats.
Class ip6-stats supports CRUD Operations and inherits from `common/A10BaseClass`.
This class is the `"PARENT"` class for this module.`
:param DeviceP... |
the-stack_106_31268 | # 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_106_31269 | import codecs
import logging
import os
import re
from time import strftime
from typing import List, Tuple
from bs4 import BeautifulSoup
from bs4.element import NavigableString, Tag
from text_importer.importers import (CONTENTITEM_TYPE_ADVERTISEMENT,
CONTENTITEM_TYPE_ARTICLE,
... |
the-stack_106_31270 | # -*- coding: utf-8 -*-
# Copyright (c) 2016-2018 by University of Kassel and Fraunhofer Institute for Energy Economics
# and Energy System Technology (IEE), Kassel. All rights reserved.
import numpy as np
import pytest
import pandapower as pp
from pandapower.test.consistency_checks import runpp_with_consistency_ch... |
the-stack_106_31272 | # -*- coding: utf-8 -*-
from bot.dfs.bridge.data import Data
from gevent import monkey
from mock import patch
monkey.patch_all()
import uuid
from simplejson import dumps
from gevent.queue import Queue
from bottle import response, request
from base import BaseServersTest, config
from bot.dfs.bridge.constants import ... |
the-stack_106_31273 | from rdflib import ConjunctiveGraph, exceptions, Namespace
from rdflib import RDFS, RDF, BNode
from rdflib.collection import Collection
import json
EPILOG = __doc__
OWLNS = Namespace("http://www.w3.org/2002/07/owl#")
OBO_OWL = Namespace("http://www.geneontology.org/formats/oboInOwl#")
EFO = Namespace("http://www.ebi.... |
the-stack_106_31276 | """Copyright (c) 2021, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause"""
import torch
from transformers import PreTrainedModel, BartModel, BartConfig, BartPretrainedModel
from t... |
the-stack_106_31278 | # Change to directory `examples/ex16-mfnwt2` before running this script.
"""Example program that shows modifying constant head values of MF6.
"""
from pymf6.callback import Func
from pymf6 import mf6
class MyFunc(Func):
"""Class whose instances act like a function, i.e. are callables
"""
# PyLint canno... |
the-stack_106_31279 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Run benchmarks for CMAES.
Requires installing cma from pip. The experiments here used version 2.7.0.
"""
import cma
import time
import j... |
the-stack_106_31281 | import numpy as np
from autoarray import numba_util
@numba_util.jit()
def constant_regularization_matrix_from(
coefficient: float, pixel_neighbors: np.ndarray, pixel_neighbors_sizes: np.ndarray
) -> np.ndarray:
"""
From the pixel-neighbors array, setup the regularization matrix using the instan... |
the-stack_106_31282 | #!/usr/bin/env python
#
# spyne - Copyright (C) Spyne contributors.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later ve... |
the-stack_106_31283 | # Copyright 2015 Google 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 law or a... |
the-stack_106_31284 | #!/usr/bin/env python
"""RecursiveDeleter removes an entire secret tree from Vault.
"""
import click
import hvac # type: ignore
from .timeformatter import getLogger
@click.command()
@click.argument("vault_path")
@click.option("--url", envvar="VAULT_ADDR", help="URL of Vault endpoint.")
@click.option("--token", envv... |
the-stack_106_31285 | # Copyright 2020 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_106_31287 | import copy
import pytest
import typing
import argparse
from mitmproxy import options
from mitmproxy import optmanager
from mitmproxy import exceptions
class TO(optmanager.OptManager):
def __init__(self):
super().__init__()
self.add_option("one", typing.Optional[int], None, "help")
self.a... |
the-stack_106_31288 | """
FILE: config.py
DESCRIPTION: Configurations
AUTHOR: Nuttaphat Arunoprayoch
DATE: 26-Nov-2020
"""
CONFIG = {
'app': {
'title': 'COVID-19 API',
'description': 'Simply FAST API for COVID-19 cases exploration',
'version': '2.1.3'
}
}
|
the-stack_106_31289 | import random
import graphics
class Ship:
"""A ship that can be placed on the grid."""
def __repr__(self):
return f"Ship('{self.name}', {self.positions})"
def __str__(self):
return f'{repr(self)} with hits {self.hits}'
def __init__(self, name, positions):
self.name = name... |
the-stack_106_31291 | from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from builtins import str
from future import standard_library
standard_library.install_aliases()
import json
from flask import request
from flask_restx import Namespace, ... |
the-stack_106_31292 | #! /usr/bin/env python
# vim: fileencoding=utf-8
# From https://github.com/ysangkok/python-binary-in-utf8/blob/master/base128.py
# using bitarray.
#
# testing:
# py.test -s --doctest-modules base128.py
r"""
If called from command line, this encodes a binary file into base128.
If imported from python it provides a ba... |
the-stack_106_31293 | # Lint as: python3
# Copyright 2020 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
the-stack_106_31295 | from sympy.concrete.summations import Sum
from sympy.core.basic import Basic
from sympy.core.function import Lambda
from sympy.core.symbol import Dummy
from sympy.integrals.integrals import Integral
from sympy.stats.rv import (NamedArgsMixin, random_symbols, _symbol_converter,
PSpace, Rand... |
the-stack_106_31296 | # 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_106_31297 | # Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2015-Present Datadog, Inc
try:
from collections.abc import Iterable
except ImportError:
from collections ... |
the-stack_106_31298 | import click
from tcp_latency import measure_latency
from heapq import nsmallest
def Average(lst):
return sum(lst, 0.0) / len(lst)
@click.command()
@click.option('-p', '--path', default='ips.txt', help='File path (Default: ips.txt)')
@click.option('-r', '--runs', default=5, help='Number of trys to get avarage (... |
the-stack_106_31300 | # -*- coding: utf-8 -*-
# Copyright 2020 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... |
the-stack_106_31302 | # Copyright 2014 Cloudbase Solutions Srl
# 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 r... |
the-stack_106_31304 | # Copyright (c) 2020 Software Platform Lab
# 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 condition... |
the-stack_106_31305 | # 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... |
the-stack_106_31307 | import os
import pandas as pd
from os2d.utils.logger import extract_value_from_os2d_binary_log, mAP_percent_to_points
if __name__ == "__main__":
config_path = os.path.dirname(os.path.abspath(__file__))
config_job_name = "exp2"
log_path = os.path.abspath(os.path.join(config_path, "..", "output/exp2"))
... |
the-stack_106_31309 | import copy
# For a given bag and token, resolve and return a list of all possible resolutions
def resolveToken(token, bag, cards, character, result=None):
###################################################################
# Instantiate intial result dict #
###############... |
the-stack_106_31313 | import collections
import datetime
import logging
import time
class TimeTaskManager:
"""
定时任务管理者
"""
def __init__(self, tzinfo):
"""
初始化定时任务管理者
:param tzinfo: 时区信息, 为None代表使用UTC+0时区
"""
self.task_callback = {}
self.time_task_dict = {}
if tzinfo ... |
the-stack_106_31314 | #
# Tests for the base battery model class
#
import pybamm
import unittest
class TestBaseBatteryModel(unittest.TestCase):
def test_process_parameters_and_discretise(self):
model = pybamm.lithium_ion.SPM()
# Set up geometry and parameters
geometry = model.default_geometry
parameter_... |
the-stack_106_31315 | # Wordle Game (TKinter)
# Tom Simpson
# Importing Modules
import tkinter as tk
import random as r
# --- Defining Methods --- #
# Generating possible answer list
def read_answers():
answers = []
with open("../Solver/guesses.txt", "r") as f:
for line in f:
answers.append(li... |
the-stack_106_31317 | from setuptools import setup
import glob
import os
with open('requirements.txt') as f:
required = f.read().splitlines()
from vcfkit import __version__
def gen_data_files(*dirs):
results = []
for src_dir in dirs:
for root,dirs,files in os.walk(src_dir):
results.append((root, map(lambda... |
the-stack_106_31318 | if __name__ == '__main__':
import os, sys
path = os.path.abspath(os.path.dirname(__file__))
sys.path.insert(0, os.path.join(path, '..', '..'))
from ..Qt import QtGui, QtCore
from .. import functions as fn
import weakref
from .UIGraphicsItem import UIGraphicsItem
__all__ = ['VTickGroup']
class V... |
the-stack_106_31319 | #!/usr/bin/env python3
from read_dmidecode import get_baseboard, get_chassis, get_connectors
from read_lspci_and_glxinfo import read_lspci_and_glxinfo
from read_lscpu import read_lscpu
filedir = 'glxinfo+lspci/'
def test_lspci_dedicated1():
filesubdir = 'dedicated/NVIDIA6200/'
expect = {
"type": "graphics-card"... |
the-stack_106_31320 | from __future__ import with_statement
import os
from unittest2 import skipIf
try:
import lxml
except ImportError:
lxml = None
try:
import html5lib
except ImportError:
html5lib = None
try:
from BeautifulSoup import BeautifulSoup
except ImportError:
BeautifulSoup = None
from compressor.base i... |
the-stack_106_31322 | # !/usr/bin/env/python3
# Copyright (c) Facebook, Inc. and its affiliates.
# 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 ... |
the-stack_106_31323 | from hypothesis import given
from tests.integration_tests.utils import (
BoundPortedBoundsPair,
BoundPortedPointsPair,
BoundPortedRingManagersPair,
are_bound_ported_bounds_equal,
are_bound_ported_ring_managers_equal)
from . import strategies
@given(strategies.initialized_non_empty_hot_pixels_ring... |
the-stack_106_31324 | # coding: utf-8
"""
Copyright 2016 SmartBear Software
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_106_31327 | from django.shortcuts import render, redirect, get_object_or_404
from django.urls import reverse
from .models import Product, Category, Hashtag, Rating, Artist, Size, Format, Technology
from .forms import FileUploadForm # probably superseded, to be deleted
from .forms import EditProductFormOne, EditProductFormThree, R... |
the-stack_106_31328 | import os
import time
import logging
import requests
import json
from libs.functions import get_icon, indent, paste, write_weather, get_desc
from datetime import datetime
from libs.waveshare_epd import epd2in7
from PIL import Image, ImageDraw, ImageFont
from settings import API_KEY
pic_dir = '/home/pi/eink-2in7/pics'... |
the-stack_106_31329 | _base_ = '../faster_rcnn/faster_rcnn_r50_fpn_1x_coco.py'
model = dict(
backbone=dict(
plugins=[
dict(
cfg=dict(
type='GeneralizedAttention',
spatial_range=-1,
num_heads=8,
attention_type='1111',
... |
the-stack_106_31330 | import subprocess
import threading
import asyncio
import time
from typing import List, TYPE_CHECKING
if TYPE_CHECKING:
from app.bot import CCBot
class AlreadyRunnning(Exception):
def __init__(self):
super().__init__("The MC Server is already running!")
class McClient:
def __init__(self, path: s... |
the-stack_106_31331 | #!/usr/bin/python
# Copyright 2005 David Abrahams
# Copyright 2008 Jurko Gospodnetic
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
# Tests the build step timing facilities.
import BoostBuild
import re
################... |
the-stack_106_31333 | # -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making BK-BASE 蓝鲸基础平台 available.
Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
BK-BASE 蓝鲸基础平台 is licensed under the MIT License.
License for BK-BASE 蓝鲸基础平台:
------------------------------------------... |
the-stack_106_31334 | # -*- 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 ------------------------------------------------------------... |
the-stack_106_31337 | import csv
import datetime
import numpy as np
def read_INMS_1A(filename):
"""
Reads INMS 1A data
"""
INMSdata = {'datetime': [], 'alt_t': [], 'amu/q': [], 'c1': []}
datacounter = 0
tempmass = 0
tempv = 0
with open('data/titan/inms/' + filename + ".csv", 'r') as csvfile:
tem... |
the-stack_106_31338 | import warnings
warnings.simplefilter("ignore", FutureWarning)
import geopandas as gpd
import os
import time
from planet_emu import util, gee, image
def main(year: int = 2020) -> None:
NAME = os.getenv("GCP_SERVICE_NAME")
PROJECT = os.getenv("GCP_PROJECT")
gee.init(NAME, PROJECT)
counties_gdf = u... |
the-stack_106_31341 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
The base `Sampler` class containing various helpful functions. All other
samplers inherit this class either explicitly or implicitly.
"""
from __future__ import (print_function, division)
from six.moves import range
import sys
import warnings
from functools import p... |
the-stack_106_31342 | import argparse
import sys
CHANGELOG_FILE = "CHANGELOG.md"
def main():
parser = argparse.ArgumentParser()
parser.add_argument("run", type=str, help="the job to run")
parser.add_argument("--tag", type=str, help="the Git tag to work with")
args = parser.parse_args()
if args.run == "check-changelog... |
the-stack_106_31343 | # -*- coding: utf-8 -*-
try:
from django.conf.urls import url
except ImportError:
from django.urls import re_path as url
from . import views
from . import forms
app_name = 'paymaster'
urlpatterns = [
url(r'^init/', views.InitialView.as_view(
form_class=forms.DefaultPaymentForm,
template_n... |
the-stack_106_31345 | import requests
TIDE_FORCAST_LOCATIONS = [
{'name': 'Half Moon Bay, California',
'url': 'https://www.tide-forecast.com/locations/Half-Moon-Bay-California/tides/latest'},
{'name': 'Huntington Beach, California',
'url': 'https://www.tide-forecast.com/locations/Huntington-Beach/tides/latest'},
{'nam... |
the-stack_106_31346 | from ete3 import Tree
import pandas as pd
def get_support_parents(tree_file):
"""Tree information summarization
This function uses ete3 package to open the tree file and the function
'assemble_df' to extract the node information from the tree. Data is
colected for the parent node (parent) of the sequ... |
the-stack_106_31348 | # Copyright 2017 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 applicab... |
the-stack_106_31351 |
def extractWwwAmjtranslationCom(item):
'''
Parser for 'www.amjtranslation.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', 'translated'),
('Loitero... |
the-stack_106_31354 | import numpy as np
from Get_global_value import num_q
from Get_global_value import J_type
from Get_global_value import Ez
from Get_global_value import BB
from Get_global_value import m0
from Get_global_value import m
from Get_global_value import mass
from Get_global_value import inertia0
from Get_global_value import in... |
the-stack_106_31355 | """Legacy device tracker classes."""
import asyncio
from datetime import timedelta
import hashlib
from typing import Any, List, Sequence
import voluptuous as vol
from homeassistant import util
from homeassistant.components import zone
from homeassistant.config import async_log_exception, load_yaml_config_file
from ho... |
the-stack_106_31357 | # -*- coding: utf-8 -*-
# Description: web log netdata python.d module
# Author: ilyam8
# SPDX-License-Identifier: GPL-3.0-or-later
import bisect
import os
import re
from collections import namedtuple, defaultdict
from copy import deepcopy
try:
from itertools import filterfalse
except ImportError:
from iterto... |
the-stack_106_31358 | # 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... |
the-stack_106_31359 | """Files uploader.
"""
import concurrent.futures as cf
import functools
import hashlib
import json
import logging
import math
import os
import urllib
from ...errors import UploadError
from delairstack.core.utils.typing import Optional
logger = logging.getLogger(__name__)
# Minimal chunk size for multipart upload o... |
the-stack_106_31360 | # Copyright 2021 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompa... |
the-stack_106_31368 | # Copyright 2011 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... |
the-stack_106_31371 | """
Middleware to check for obedience to the WSGI specification.
Some of the things this checks:
* Signature of the application and start_response (including that
keyword arguments are not used).
* Environment checks:
- Environment is a dictionary (and not a subclass).
- That all the required keys are in the... |
the-stack_106_31372 | # -*- coding: utf-8 -*-
import asyncio
import pytest
import logging
from grapheneapi.exceptions import RPCError
log = logging.getLogger("grapheneapi")
log.setLevel(logging.DEBUG)
@pytest.mark.asyncio
async def test_parse_error(bitshares, default_account):
with pytest.raises(RPCError, match="Invalid JSON message... |
the-stack_106_31374 | from bfxhfindicators.indicator import Indicator
from bfxhfindicators.ema import EMA
from bfxhfindicators.accumulation_distribution import AccumulationDistribution
from math import isfinite
class ChaikinOsc(Indicator):
def __init__(self, args = []):
[ short, long ] = args
self._shortEMA = EMA([short])
se... |
the-stack_106_31376 | # Copyright 2016 Canonical Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... |
the-stack_106_31378 | import pandas as pd
def build_date_mapper_new (original_dates,master_dates):
# original dates should be a unique list
# master dates should be a sorted pandas index
mapper = pd.DataFrame()
mapper['original'] = original_dates
mapper = mapper[(mapper.original >= master_dates.min()) & (mapper.original... |
the-stack_106_31380 | import cv2
import tensorflow as tf
IMG_H_SIZE = 256
IMG_W_SIZE = 256
def discriminator_loss(loss_object, real_output, fake_output):
real_loss = loss_object(tf.ones_like(real_output), real_output)
fake_loss = loss_object(tf.zeros_like(fake_output), fake_output)
total_loss = real_loss + fake_loss
retu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.