filename
stringlengths
13
19
text
stringlengths
134
1.04M
the-stack_106_22192
# Copyright 2021 PerfKitBenchmarker 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 appli...
the-stack_106_22193
# coding: utf-8 from __future__ import print_function # numerical import numpy as np from scipy.optimize import minimize_scalar, minimize from scipy.spatial.distance import euclidean, pdist, cdist, squareform from numpy import array from operator import itemgetter # niching benchmarking from lib.niching_func import ni...
the-stack_106_22194
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 5/15/20 4:49 PM # @File : grover.py # qubit number=4 # total number=22 import cirq import cirq.google as cg from typing import Optional import sys from math import log2 import numpy as np #thatsNoCode def make_circuit(n: int, input_qubit): c = cirq.Ci...
the-stack_106_22195
#!/usr/bin/env python3 # -*- coding: UTF-8 -*- """ ./test_code.py --fast; red_green_bar.py $? $COLUMNS red_green_bar.py is taken from https://github.com/kwadrat/rgb_tdd.git """ import sys if sys.version_info[0] < 3: print("You need Python 3 to run this script.") sys.exit(1) import unittest from pathlib impo...
the-stack_106_22200
import sys import configparser import RPi.GPIO as GPIO import time config_file = sys.argv[1] config = configparser.ConfigParser() config.read(config_file) led_pin = int(config['SETTINGS']['led_pin']) delay = float(config['SETTINGS']['delay']) exception_sleep_time = float(config['SETTINGS']['exception_sleep_time']) G...
the-stack_106_22203
import random def typoglycemia(sentence): transformed = [] for word in sentence.split(): if len(word) > 4: head, middle, last = word[0], list(word[1:-1]), word[-1] random.shuffle(middle) word = head + ''.join(middle) + last transformed.append(word) return ...
the-stack_106_22205
import Image def vectorToRGBA(vec, divider = 5): x1 = x2 = y1 = y2 = 0.0 if vec[0] < 0: x2 = -vec[0] else: x1 = vec[0] if vec[1] < 0: y2 = -vec[1] else: y1 = vec[1] return (int(x2*255.0)/divider, int(x1*255.0)/divider, int(y2*255.0)/divider, int(y1*255.0)/divider) d...
the-stack_106_22207
from const import * import numpy as np class HaasoscopeOversample(): def __init__(self): self.dooversample=np.zeros(HAAS_NUM_BOARD*HAAS_NUM_CHAN_PER_BOARD, dtype=int) # 1 is oversampling, 0 is no oversampling, 9 is over-oversampling def ToggleOversamp(self,chan): #tell it to toggle oversamplin...
the-stack_106_22209
from __future__ import print_function import sys from nose.tools import assert_equal, assert_true, assert_false, assert_is_instance, assert_multi_line_equal from six import StringIO import sqlparse from sqlparse import tokens as T from sqlparse.sql import Token, TokenList, Parenthesis from mbdata.utils.sql import ( ...
the-stack_106_22210
# coding: utf-8 """ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ ...
the-stack_106_22212
import networkx as nx import pytest import networkx.generators.line as line from networkx.utils import edges_equal class TestGeneratorLine: def test_star(self): G = nx.star_graph(5) L = nx.line_graph(G) assert nx.is_isomorphic(L, nx.complete_graph(5)) def test_path(self): G =...
the-stack_106_22214
# # 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...
the-stack_106_22217
class Util: @staticmethod def get_object_from_http_request(request): return request.split("\\r\\n")[0].split(" ")[1][1:] @staticmethod def get_file_data(filename, mode): f = open(filename, mode) data = f.read() f.close() return data @staticmethod def get...
the-stack_106_22218
from os import path from io import open from setuptools import setup from setuptools import find_packages here = path.abspath(path.dirname(__file__)) # Get the long description from the README file with open(path.join(here, 'README.md'), encoding='utf-8') as f: long_description = f.read() setup( name='mimi...
the-stack_106_22220
from sympy.integrals.transforms import (mellin_transform, inverse_mellin_transform, laplace_transform, inverse_laplace_transform, fourier_transform, inverse_fourier_transform, sine_transform, inverse_sine_transform, cosine_transform, inverse_cosine_transform, hankel_transform, inverse_hankel_transfo...
the-stack_106_22221
from __future__ import print_function, absolute_import from reid.snatch import * from reid import datasets from reid import models import numpy as np import torch import argparse import os from reid.utils.logging import Logger import os.path as osp import sys from torch.backends import cudnn from reid.utils.serializat...
the-stack_106_22222
# -*- coding: utf-8 -*- # Copyright (c) 2016 Mirantis 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 ...
the-stack_106_22223
import os from typing import Dict import pymongo from aiogram.types.input_file import InputFile from bot.imagesstorage import MissingMongoDBClient from bot.imagesstorage import LevelDoesNotExistError class ImagesStorage: """ This class implements interaction with database containing music scores. MongoDB ...
the-stack_106_22224
"""Agenda related views.""" import datetime import pytz import vobject as vobject from django.contrib.auth.mixins import LoginRequiredMixin from django.db.models import Q from django.http import HttpResponse from django.views import View from django.views.generic import ListView from icalendar import Calendar from Boo...
the-stack_106_22225
import asyncio import logging from bleak import BleakClient, BleakError, BleakScanner class SensorTile(): def __init__(self, address): self.address = address self.client = BleakClient(self.address) # A LiFo Queue will ensure that the most recent registered # ST data is retrieved ...
the-stack_106_22227
import os import json import warnings from io import open from os.path import dirname from os.path import abspath from os.path import join as pathjoin from .bids_validator import BIDSValidator from .utils import _merge_event_files from grabbit import Layout, File from grabbit.external import six from grabbit.utils im...
the-stack_106_22230
import torch import torch.nn as nn from ..utils.hyperparams import ACTIVATION_FN_FACTORY class DenseDiscriminator(nn.Module): def __init__(self, params): """ This class specifies the discriminator of an AAE. It can be trained to distinguish real samples from a target distr. (e.g. ...
the-stack_106_22232
import math angulo = float(input("Digite o ângulo que você deseja: ")) #convertendo o angulo que esta em graus para radianos, pois as funções que utilizas graus trabalham com os mesmos em radianos anguloRad = angulo * 0.01745 # uma outra forma de converter o angulo é usando a função radians da biblioteca math anguloN...
the-stack_106_22233
#!/usr/bin/env python3 # Copyright (c) 2015-2018 TurboCoin # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test node responses to invalid transactions. In this test we connect to one node over p2p, and test tx requests.""" from...
the-stack_106_22234
import os from azure.storage.blob import BlobServiceClient # Test connection string for Azurite (local development) TEST_CONN_STR = "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;" "AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;" "BlobEndpoint=http://a...
the-stack_106_22236
# coding: utf-8 import numpy as np from kerasy.ML.sampling import GibbsMsphereSampler def test_gibbs_msphere_sampling(target=0.15): radius = 10 num_samples = 10000 dimension = 6 sampler = GibbsMsphereSampler(dimension=dimension, radius=radius) sample = sampler.sample(num_samples, verbose=-1) ...
the-stack_106_22238
import re from unittest.mock import patch import numpy as np import pytest from netcdf_scm.weights import ( CubeWeightCalculator, InvalidWeights, get_land_weights, get_nh_weights, get_weights_for_area, multiply_weights, subtract_weights, ) @pytest.mark.parametrize("inp", ["fail string", ...
the-stack_106_22240
""" Provide user facing operators for doing the split part of the split-apply-combine paradigm. """ from typing import Tuple import warnings import numpy as np from pandas.util._decorators import cache_readonly from pandas.core.dtypes.common import ( ensure_categorical, is_categorical_dtype, is_datetime64_dtype...
the-stack_106_22242
# -*- coding: utf-8 -*- """ Authors: Tim Hessels and Gonzalo Espinoza UNESCO-IHE 2016 Contact: t.hessels@unesco-ihe.org g.espinoza@unesco-ihe.org Repository: https://github.com/wateraccounting/watools Module: Collect/CMRSET Restrictions: The data and this python file may not be distributed to others ...
the-stack_106_22243
#!/usr/bin/env python3 # Copyright (c) 2014-2019 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test the wallet.""" from decimal import Decimal import time from test_framework.test_framework import ...
the-stack_106_22244
#!/usr/bin/env python import os import sys import glob from functools import lru_cache from django.db import transaction import click from openstates import metadata from openstates.utils.django import init_django from utils import ( get_data_dir, get_jurisdiction_id, get_all_abbreviations, load_yaml, ...
the-stack_106_22245
from core.helpers import Url from core.helpers import Comparisons from core.library import Manage import json import core import datetime from core import searcher import xml.etree.cElementTree as ET import re import logging logging = logging.getLogger(__name__) searcher = searcher date_format = '%a, %d %b %Y %H:%M:...
the-stack_106_22249
from __future__ import print_function import os import shutil import sys import tempfile from tempfile import NamedTemporaryFile import uuid import yaml from subprocess import Popen, PIPE class Tpm2(object): def __init__(self, tmp): self._tmp = tmp def createprimary(self, ownerauth, objauth): ...
the-stack_106_22250
from __future__ import (absolute_import, division, print_function, unicode_literals) from iminuit.color import Gradient __all__ = ['LatexTable'] class LatexTable: """Latex table output. """ float_format = '%10.5g' int_format = '%d' latex_kwd = [ 'alpha', 'beta', 'g...
the-stack_106_22253
# -*- coding: utf-8 -*- """ Created on Nov 24, 2014 @author: moloch Copyright 2014 Root the Box 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/licen...
the-stack_106_22254
import src.model.tlform as tlform import src.model.term as TERM import src.model.rpython as rpy import src.model.pattern as pattern from src.codegen.pattern import PatternCodegen from src.codegen.term import TermCodegen from src.util import SymGen from src.context import CompilationContext from src.codegen.common...
the-stack_106_22255
import calendar import logging import time from typing import Any, Dict, List, Optional, Tuple from django.conf import settings from django.http import HttpRequest, HttpResponse, HttpResponseRedirect from django.shortcuts import redirect, render from django.urls import reverse from django.utils import translation from...
the-stack_106_22256
# coding=utf-8 # Copyright 2022 DeepMind Technologies 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 appli...
the-stack_106_22258
# -*- coding: utf-8 -*- """ Created on Mon Mar 21 21:43:08 2022 @author: Charissa """ #backtracking import numpy as np import math import copy from numpy.linalg import norm from conversiontxtfile import converttolist from conversiontxtfile import converttoarray from checkdata import SVFinder l...
the-stack_106_22260
#! /usr/bin/env python # coding=utf-8 # Copyright (c) 2019 Uber Technologies, 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 # # Unles...
the-stack_106_22261
import random class Hat: def __init__(self, **kwargs): self.contents = [] for k, v in kwargs.items(): for i in range(v): self.contents.append(k) def draw(self, n): total = self.contents if n >= len(total): return self.contents o...
the-stack_106_22263
import requests from lxml.html import fromstring import requests from itertools import cycle import traceback def get_proxies(): url = 'https://free-proxy-list.net/' response = requests.get(url) parser = fromstring(response.text) proxies = set() for i in parser.xpath('//tbody/tr')[:10]: if i...
the-stack_106_22264
import re import requests import CralwerSet.connect_mysql as connect_mysql import threading import CralwerSet.schedule as schedule import time import datetime import json from requests.packages import urllib3 urllib3.disable_warnings() class mythread(threading.Thread): def __init__(self, name, sc): threa...
the-stack_106_22268
# -*- coding: utf-8 -*- {{{ # vim: set fenc=utf-8 ft=python sw=4 ts=4 sts=4 et: # # Copyright 2019, 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_106_22269
from django.conf.urls import url from . import views urlpatterns = [ url(r'^tests_list', views.tests_list), url(r'^(?P<test_running_id>\d+)/update/', views.update), url(r'^(?P<test_running_id>\d+)/rtot/', views.online_test_rtot), url(r'^(?P<test_running_id>\d+)/success_rate/', views.online_test...
the-stack_106_22272
# Copyright 2012-2013 OpenStack Foundation # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
the-stack_106_22273
import math import numpy as np import torch from mmcv.runner import auto_fp16 from torch import nn from ..builder import MIDDLE_ENCODERS from mmdet3d.ops import flat2window, window2flat import random import pickle as pkl import os @MIDDLE_ENCODERS.register_module() class SSTInputLayer(nn.Module): """ This is...
the-stack_106_22275
import core try: from core.settings.local import DEBUG except ImportError: DEBUG = False try: from core.settings.local import ENABLE_DEBUG_TOOLBAR except ImportError: ENABLE_DEBUG_TOOLBAR = False ADMINS = ( ('Sergey Podolsky', 'spadolski@bnl.gov'), ) MANAGERS = ADMINS LANGUAGE_CODE = 'en-us' LANGU...
the-stack_106_22276
#!/usr/bin/env python3 """Sample Sheet generation for BCL2FASTQ pipeline """ # --- standard library imports # import sys import os import logging import argparse from collections import namedtuple import xml.etree.ElementTree as ET #--- third-party imports # import requests import yaml #--- project specific imports #...
the-stack_106_22277
from Bio import SeqIO import sys # Put error and out into the log file sys.stderr = sys.stdout = open(snakemake.log[0], "w") # Get all the proteins of the database inside a dict-like structure all_index_fasta = SeqIO.index(snakemake.input.protein_fasta, 'fasta') # List of possible truncatenated ids list_cutname = []...
the-stack_106_22279
# 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_106_22282
from django.shortcuts import render,redirect from django.http import HttpResponse,Http404 from .models import Image,Category,Location import pyperclip # Create your views here. def welcome(request): ''' a function to display the whole images and welcome message. ''' images = Image.ge...
the-stack_106_22283
""" Handle signal names. Author: Vishakha Created: 2020-08-07 """ import covidcast def add_prefix(signal_names, wip_signal, prefix="wip_"): """Adds prefix to signal if there is a WIP signal Parameters ---------- signal_names: List[str] Names of signals to be exported prefix : 'wip_' ...
the-stack_106_22285
#!/usr/local/bin/python3 """ _im_utils.py - separate utility functions for tif images date: 20160429 date: 20170810 - combine all util functions date: 20180218 - add sift functions date: 20180315 - tidy up and add Bobby's fitting algorithm """ import os import tifffile import skimage import scipy, scipy.signal import...
the-stack_106_22286
import ipaddress import subprocess from typing import Union # def ping_ip(ip_address: ipaddress.IPv4Address) -> bool: def ping_ip(ip_address: Union[str, ipaddress.IPv4Address]) -> bool: reply = subprocess.run( ["ping", "-c", "3", "-n", str(ip_address)], stdout=subprocess.PIPE, stderr=subpr...
the-stack_106_22288
from models.connection import get_cnx, tables student_table = tables["student"] class Student: @staticmethod def add_student(tournament_id, team_num, name): with get_cnx() as db: cursor = db.cursor() cursor.execute( f"INSERT INTO {student_table} (tournament_id,...
the-stack_106_22289
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import numpy as np from typing import Any, List, Tuple, Union import torch from mydl.layers import interpolate class Keypoints: """ Stores keypoint annotation data. GT Instances have a `gt_keypoints` property containing the x,y locati...
the-stack_106_22290
from shared.args import arg_help, base_parser def arguments(name): parser = base_parser(name) parser.add_argument( '-u', '--unfollow', default=0, type=int, dest='num_unfollow', help=arg_help('how many accounts to unfollow at once (0 = unlimited)') ) parser.add_argument( '-f', ...
the-stack_106_22291
from pathlib import Path from typer import Option from deckz.cli import app from deckz.running import run_all as running_run_all @app.command() def check_all( handout: bool = Option(False, help="Produce PDFs without animations"), presentation: bool = Option(True, help="Produce PDFs with animations"), pr...
the-stack_106_22292
# -*- coding: utf-8 -*- # Copyright (c) 2017-2020 Intel Corporation # # 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, c...
the-stack_106_22293
from django.conf.urls import url from . import views urlpatterns = [ # e.g.: / #url(r'^$', views.index, name='index'), url( regex=r'^$', view=views.GroupList.as_view(), name='list' ), # e.g.: /groups/3/ url( regex=r'^(?P<pk>[0-9]+)/$', view=views.GroupDe...
the-stack_106_22294
# This class create the instance to manage the serverIP and the relative broadcast management import network as net import socket as sock import machine import os import time import ubinascii import urandom import math def get_ip_address(): ip_address = '' sta_if = net.WLAN(net.STA_IF) temp = sta_if.ifco...
the-stack_106_22295
"""OpenCL target independent of PyOpenCL.""" from __future__ import division, absolute_import __copyright__ = "Copyright (C) 2015 Andreas Kloeckner" __license__ = """ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to ...
the-stack_106_22297
#CMPUT404W22 dchu Assignment 1 import socketserver, os # Copyright 2013 Abram Hindle, Eddie Antonio Santos # # 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/l...
the-stack_106_22298
# coding: utf-8 # 2021/5/20 @ tongshiwei import pytest from EduNLP.SIF.segment import seg from EduNLP.utils import image2base64 def test_segment(figure0, figure1, figure0_base64, figure1_base64): seg( r"如图所示,则$\FormFigureID{0}$的面积是$\SIFBlank$。$\FigureID{1}$", figures={ "0": figure0, ...
the-stack_106_22300
"""Collection of tests for unified neural network activation functions.""" # global import pytest import numpy as np from hypothesis import given, strategies as st # local import ivy import ivy_tests.test_ivy.helpers as helpers import ivy.functional.backends.numpy as ivy_np # relu @given( x=st.lists(st.floats()...
the-stack_106_22301
from paypalrestsdk import Payout, ResourceNotFound import random import string sender_batch_id = ''.join( random.choice(string.ascii_uppercase) for i in range(12)) payout = Payout({ "sender_batch_header": { "sender_batch_id": sender_batch_id, "email_subject": "You have a payment" }, "i...
the-stack_106_22302
import os import numpy as np import numpy.ctypeslib as clib c_int = clib.ctypes.c_int c_int8 = clib.ctypes.c_int8 c_int16 = clib.ctypes.c_int16 c_int32 = clib.ctypes.c_int32 c_int64 = clib.ctypes.c_int64 c_dbl = clib.ctypes.c_double c_dPt = clib.ndpointer(dtype=np.float64, flags="C_CONTIGUOUS") c_dPt = clib.ndpointer...
the-stack_106_22305
import config import requests import time import random import json from utils import Stack, Queue from room import Room # token = config.TOKEN # headers = { # 'Authorization': f"Token {token}", # 'Content-Type': 'application/json' # } # init_response = requests.get('https://lambda-treasure-hunt.herokuapp.co...
the-stack_106_22306
import torch import torch.nn as nn import torch.functional as F from torch.autograd import Variable import torch.utils.data as Data import torchvision import matplotlib.pyplot as plt from Dataloader import ImgDataset import numpy as np class CNN(nn.Module): def __init__(self): super(CNN, self).__init__() ...
the-stack_106_22309
""" This module defines tensors with abstract index notation. The abstract index notation has been first formalized by Penrose. Tensor indices are formal objects, with a tensor type; there is no notion of index range, it is only possible to assign the dimension, used to trace the Kronecker delta; the dimension can be...
the-stack_106_22313
import argparse from installer.parallel_installer import ParallelInstaller from typing import Dict, Any import json import sys def build_dependency_json(requirements_json_path: str) -> Dict[str, Any]: """ Returns a dictionary representation of the JSON object stored in the requirements file. """ t...
the-stack_106_22314
from kubernetes import client, config, watch import os import sys import requests from requests.packages.urllib3.util.retry import Retry from requests.adapters import HTTPAdapter def writeTextToFile(folder, filename, data): with open(folder +"/"+ filename, 'w') as f: f.write(data) f.close() def ...
the-stack_106_22315
# -*- coding: utf-8 -*- """Tests using pytest_resilient_circuits""" from __future__ import print_function import pytest from resilient_circuits.util import get_config_data, get_function_definition from resilient_circuits import SubmitTestFunction, FunctionResult PACKAGE_NAME = "fn_qradar_asset" FUNCTION_NAME = "qrada...
the-stack_106_22316
# -*- coding: utf-8 -*- from hearthstone.entities import Entity from entity.spell_entity import SpellEntity class LETL_030P3(SpellEntity): """ 热力迸发 造成12点伤害。下回合你的火焰技能速度值加快(1)点 """ def __init__(self, entity: Entity): super().__init__(entity) self.damage = 12 self.ra...
the-stack_106_22318
#!/usr/bin/env python3 # # Copyright (c) 2019, The OpenThread Authors. # 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 # ...
the-stack_106_22320
import argparse import codecs import logging import random from collections import defaultdict as ddict import nltk from nltk.stem.wordnet import WordNetLemmatizer random.seed(13370) logger = logging.getLogger(__name__) # pylint: disable=invalid-name def get_triples_from_file(filename): entity_pair_relations =...
the-stack_106_22321
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn plt.style.use('ggplot') import arch from arch.unitroot import ADF from statsmodels.graphics.tsaplots import plot_acf, plot_pacf from statsmodels.tsa.seasonal import seasonal_decompose import os import datetime as dt # # dff_df_R001...
the-stack_106_22323
#!/usr/bin/env python """Analysis of alignments for EdiTyper""" from __future__ import division from __future__ import print_function import sys PYTHON_VERSION = sys.version_info.major import os import time import logging import itertools from math import floor, ceil from collections import Counter, defaultdict, na...
the-stack_106_22326
from PyQt5.QtWidgets import QSizePolicy, QWidget, QTextEdit, QHBoxLayout, QLabel class GuiProjectDescription(object): tab2 = None text_edit = None tab2box = None authors_widget = None authors_label = None authors_box = None project_description = "The aim of the project is to implement an"...
the-stack_106_22328
from . import Databricks class DBFS(Databricks.Databricks): def __init__(self, url): super().__init__() self._api_type = 'dbfs' self._url = url def addBlock(self, data, handle): endpoint = 'add-block' url = self._set_url(self._url, self._api_type, endpoint) payload = { "data": data, "handle": ha...
the-stack_106_22329
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Testing :mod:`astropy.cosmology.flrw`.""" ############################################################################## # IMPORTS # STDLIB import abc import copy # THIRD PARTY import pytest import numpy as np # LOCAL import astropy.cosmology.unit...
the-stack_106_22330
# 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. # --------------------------------------------------------------------...
the-stack_106_22331
#!/usr/bin/env python # -*- encoding: utf-8 -*- from functools import partial import pytest import torch import torch.distributed as dist import torch.multiprocessing as mp from colossalai.communication import (recv_backward, recv_forward, recv_tensor_meta, send_backward, send_ba...
the-stack_106_22333
from setuptools import setup, find_packages import os import re import sys v = open(os.path.join(os.path.dirname(__file__), 'mako', '__init__.py')) VERSION = re.compile(r".*__version__ = '(.*?)'", re.S).match(v.read()).group(1) v.close() readme = open(os.path.join(os.path.dirname(__file__), 'README.rst')).read() mar...
the-stack_106_22334
import json import pandas as pd import numpy as np from matplotlib import pyplot as plt import requests import datetime ekb = (56.688468, 56.988468, 60.45337, 60.75337) today = datetime.datetime.now().strftime('%Y-%m-%d_%H-%M-%S') data = requests.get('https://www.gorses.na4u.ru/data/COVID.json').json() coords = [] f...
the-stack_106_22335
# Copyright (c) 2021 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 appli...
the-stack_106_22336
#!/usr/bin/env python # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. import urllib2 import json from gaiatest.mocks.mock_user import MockUser class PersonaTestUser:...
the-stack_106_22337
#!/usr/bin/env python from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from collections import defaultdict import io import os import sys import numpy as np # type: ignore from onnx import defs, FunctionProto, helper...
the-stack_106_22340
""" Network analysis module. """ import os import ipaddress import collections import geoip2.database import logging.config import disspcap from lisa.core.base import AbstractSubAnalyzer from lisa.analysis.anomaly import Anomaly from lisa.config import lisa_path, logging_config logging.config.dictConfig(logging_...
the-stack_106_22341
from os import getenv from typing import Dict from psycopg2 import OperationalError from psycopg2.pool import SimpleConnectionPool class Database: pg_config: Dict = None CONNECTION_NAME: str = None def __init__(self): self.CONNECTION_NAME = getenv('INSTANCE_CONNECTION_NAME') self.pg_con...
the-stack_106_22343
import numpy as np from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt from matplotlib import cm from matplotlib.ticker import LinearLocator, FormatStrFormatter import math class Wall(): def __init__(self, width, thick, center=(0, 0)): self.w = width self.t = thick self...
the-stack_106_22345
import unittest import simplerestler class ElementsTestCase(unittest.TestCase): """Tests for `elements.py`.""" def test_document_lists(self): """Lists Tests""" d = simplerestler.Document() ul = d.ul("One", "Two", "Three") result = """ * One * Two * Three """ self.ass...
the-stack_106_22346
# Copyright 2013-2021 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) """Utilities for managing paths in Spack. TODO: this is really part of spack.config. Consolidate it. """ import contextli...
the-stack_106_22348
#!/usr/bin/env python2.3 """ Notification engine for periodic reports on branches and CRs. """ import sys import os import time import cStringIO import pprint import optparse import mail from sfConstant import * from sfMagma import SFMagmaTool from sfReportCR import CRReport from sfUtil import g...
the-stack_106_22350
import numpy as np import os from pycocotools.coco import COCO from torch.utils.data import Dataset import cv2 import skimage import skimage.io class CocoDataset(Dataset): '''Coco data Style''' def __init__(self, img_dir, annot_dir, set_name='val', transform=None): self.img_dir = img_dir self...
the-stack_106_22356
# Copyright 2019 IBM 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 writing, ...
the-stack_106_22357
import json from datetime import datetime, timedelta from typing import Optional, List, Tuple, Dict # Core import pandas as pd import plotly.express as px import requests import streamlit as st import streamlit.components.v1 as components import numpy as np import ftx #################################################...
the-stack_106_22360
# Copyright (C) 2010-2011 Richard Lincoln # # 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...
the-stack_106_22364
# Download the Python helper library from twilio.com/docs/python/install from twilio.rest import Client # Your Account Sid and Auth Token from twilio.com/user/account account_sid = "ACCOUNT_SID" auth_token = "your_auth_token" client = Client(account_sid, auth_token) number = client.lookups.phone_numbers("+15108675310...