filename
stringlengths
13
19
text
stringlengths
134
1.04M
the-stack_0_6441
import numpy as np import torch import trajnetplusplustools def pre_process_test(sc_, obs_len=8): obs_frames = [primary_row.frame for primary_row in sc_[0]][:obs_len] last_frame = obs_frames[-1] sc_ = [[row for row in ped] for ped in sc_ if ped[0].frame <= last_frame] return sc_ def trajnet_loader(...
the-stack_0_6443
# Copyright 2021 Red Hat, 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...
the-stack_0_6445
import numpy as np from lazy import lazy from .cec2013lsgo import CEC2013LSGO class F13(CEC2013LSGO): """ 7-nonseparable, 1-separable Shifted and Rotated Elliptic Function """ def __init__( self, *, rng_seed: int = 42, use_shuffle: bool = False, verbose: int =...
the-stack_0_6446
# -*- coding: utf-8 -*- # # Copyright (C) 2013-2017 Gauvain Pocentek <gauvain@pocentek.net> # # This program 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 3 of the License, or # (at you...
the-stack_0_6448
import json import numpy as np import pdb import copy import torch from scipy.special import binom MISSING_VALUE = -1 HASNT_HAPPENED_VALUE = -5 RACE_CODE_TO_NAME = { 1: 'White', 2: 'African American', 3: 'American Indian, Eskimo, Aleut', 4: 'Asian or Pacific Islander', 5: 'Other Race', 6: 'Car...
the-stack_0_6449
from typing import Tuple import torch from kornia.geometry.bbox import infer_bbox_shape3d, validate_bbox3d from .projwarp import get_perspective_transform3d, warp_affine3d __all__ = [ "crop_and_resize3d", "crop_by_boxes3d", "crop_by_transform_mat3d", "center_crop3d", ] def crop_and_resize3d( t...
the-stack_0_6451
# Copyright 2014 Rackspace # # 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 agree...
the-stack_0_6452
class GetoptError(Exception): pass def w_getopt(args, options): """A getopt for Windows. Options may start with either '-' or '/', the option names may have more than one letter (/tlb or -RegServer), and option names are case insensitive. Returns two elements, just as getopt.getopt. The firs...
the-stack_0_6453
import pytest import logging import io from qcodes.instrument_drivers.stahl import Stahl import qcodes.instrument.sims as sims @pytest.fixture(scope="function") def stahl_instrument(): visa_lib = sims.__file__.replace( '__init__.py', 'stahl.yaml@sim' ) inst = Stahl('Stahl', 'ASRL3', visa...
the-stack_0_6454
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# """ BLIS - Balancing Load of Intermittent Solar: A characteristic-based transient power plant model Copyright (C) 2020. University of Virginia Licensing & Ventures Group (UVA LVG). All Rights Reserved. Permission is hereby granted, free ...
the-stack_0_6455
#!/usr/bin/env python from argparse import FileType import sys import agate from sqlalchemy import create_engine from csvkit.cli import CSVKitUtility class SQL2CSV(CSVKitUtility): description = 'Execute an SQL query on a database and output the result to a CSV file.' override_flags = 'f,b,d,e,H,p,q,S,t,u,z...
the-stack_0_6457
import re from typing import Optional, cast # noqa: F401 import flask_app.constants as constants from flask import abort, current_app, g, jsonify, make_response, redirect, render_template, request from flask_app.app_utils import ( add_session, authenticated, authorized, get_session_username, new_s...
the-stack_0_6458
from __future__ import absolute_import, unicode_literals from django import forms from django.forms.models import inlineformset_factory from django.utils.translation import ugettext_lazy as _ from tuiuiu.contrib.searchpromotions.models import SearchPromotion from tuiuiu.tuiuiuadmin.widgets import AdminPageChooser fro...
the-stack_0_6459
from tensorflow.python.client import device_lib # 测试tensorflow安装成功与否 import tensorflow as tf import numpy as np import math print(tf.test.is_gpu_available()) def get_available_gpus(): local_device_protos = device_lib.list_local_devices() return [x.name for x in local_device_protos if x.device_type == 'GPU'] p...
the-stack_0_6460
import random import math import copy from prj4_data import * def GetRandomVacancy(L): x = random.randint(0, L.xlim-1) y = random.randint(0, L.ylim-1) while L.layout[x][y] != None: x = random.randint(0, L.xlim-1) y = random.randint(0, L.ylim-1) return x, y def RandomPlacement(L): ...
the-stack_0_6461
#!/usr/bin/env python # This file is dual licensed under the terms of the Apache License, Version # 2.0, and the BSD License. See the LICENSE file in the root of this repository # for complete details. from __future__ import absolute_import, division, print_function import os import platform import subprocess import...
the-stack_0_6462
import distutils import os.path from setuptools import setup from setuptools.command.install import install as _install PTH = ( 'try:\n' ' import future_annotations\n' 'except ImportError:\n' ' pass\n' 'else:\n' ' future_annotations.register()\n' ) class install(_install): def ...
the-stack_0_6463
from Node import Node import numpy class Operation(object): BACK_MUTATION = 0 DELETE_MUTATION = 1 SWITCH_NODES = 2 PRUNE_REGRAFT = 3 @classmethod def tree_operation(cls, tree, operation, k, gamma, max_deletions): if operation == cls.BACK_MUTATION: return cls.add_back_mut...
the-stack_0_6466
# -*- coding: utf-8 -*- # # MPA Authors. All Rights Reserved. # """ Dataset for ISBI_2015""" # Import global packages import os import numpy as np import torch import torch.nn.functional as F import torchvision from PIL import Image import cv2 from matplotlib import pyplot as plt # Kornia library for data augmentati...
the-stack_0_6467
#!/usr/bin/python3 import numpy as np from rotor_tm_utils.vec2asym import vec2asym import scipy.linalg as LA from rotor_tm_utils.vee import vee from rotor_tm_utils.RPYtoRot_ZXY import RPYtoRot_ZXY from rotor_tm_utils import utilslib import scipy from scipy.spatial.transform import Rotation as tranrot import json clas...
the-stack_0_6469
# pylint: disable=g-bad-file-header # 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/LICENS...
the-stack_0_6473
""" Script used to create surface plots to illustrate (stochastic) gradient descent in chapter 5. """ import matplotlib.pyplot as plt from matplotlib import cm from matplotlib.ticker import LinearLocator, FormatStrFormatter import numpy as np # Initialize figure fig = plt.figure() ax = fig.gca(projection='3d') # Make...
the-stack_0_6474
""" Plugin Manager -------------- A plugin manager class is used to load plugins, manage the list of loaded plugins, and proxy calls to those plugins. The plugin managers provided with nose are: :class:`PluginManager` This manager doesn't implement loadPlugins, so it can only work with a static list of plugi...
the-stack_0_6477
# -------------- #Importing the modules import pandas as pd import numpy as np from scipy.stats import mode def categorical(df): """ Extract names of categorical column This function accepts a dataframe and returns categorical list, containing the names of categorical columns(categorical_var). ...
the-stack_0_6478
#!/usr/bin/env python3 # In this example, we demonstrate how a Korali experiment can # be resumed from any point (generation). This is a useful feature # for continuing jobs after an error, or to fragment big jobs into # smaller ones that can better fit a supercomputer queue. # # First, we run a simple Korali experime...
the-stack_0_6481
# Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import time from profile_chrome import chrome_startup_tracing_agent from profile_chrome import chrome_tracing_agent from profile_chrome import ui from profi...
the-stack_0_6482
def shellSort(arr): _len = len(arr) grap = _len while grap > 1: grap = grap // 2 # 间隔距离 for i in range(grap, _len): j, curr = i, arr[i] while j >= grap and curr < arr[j - grap]: arr[j] = arr[j - grap] # 比 curr大 则把前面大的值往后存放 j -= grap ...
the-stack_0_6483
''' Run models (ResNet18, MobileNetV2) by scaling filter sizes to different ratios on TinyImageNet. Stores accuracy for comparison plot. Default Scaling Ratios: 0.25, 0.5, 0.75, 1.0 ''' from __future__ import print_function import os, sys sys.path.append(os.path.dirname(os.path.dirname(os.path.realpath('.')))) import...
the-stack_0_6484
# Copyright 2018 The Oppia Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable ...
the-stack_0_6486
import random import math import time import mysql.connector import copy import json from .components.DBConfig import DBConfig from .components.Configuration import Configuration from .components.StudentsManager import StudentsManager from .components.ContainersManager import ContainersManager class CC: def __i...
the-stack_0_6487
import json from enum import Enum from json.decoder import JSONDecodeError import pygame from lib import constants _filePath = constants.res_loc() + "config.json" _values = {} class EntryType(Enum): # lambda for converting key values to strings Key = (0, lambda value: pygame.key.name(value).c...
the-stack_0_6489
# -*- coding: utf-8 -*- from __future__ import unicode_literals import re from django.forms.widgets import flatatt from django.template import Variable, VariableDoesNotExist from django.template.base import FilterExpression, kwarg_re, TemplateSyntaxError from .text import text_value # RegEx for quoted string QUOTE...
the-stack_0_6491
import wave import sys import struct import time import subprocess # import inspect import threading import traceback import shlex import os import string import random import datetime as dt import numpy as np import scipy as sp import scipy.special from contextlib import closing from argparse import ArgumentParser # ...
the-stack_0_6493
#! /usr/bin/env python import sys import os from django.conf import settings, global_settings APP_NAME = 'sitegate' def main(): sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..')) if not settings.configured: settings.configure( INSTALLED_APPS=( 'django.con...
the-stack_0_6494
from .family_methods import trio_matrix, mendel_errors, transmission_disequilibrium_test, de_novo from .impex import export_elasticsearch, export_gen, export_bgen, export_plink, export_vcf, \ import_locus_intervals, import_bed, import_fam, grep, import_bgen, import_gen, import_table, \ import_plink, read_matrix...
the-stack_0_6497
# Copyright 2018 Jose Cambronero and Phillip Stanley-Marbell # # 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, mod...
the-stack_0_6498
import sys sys.path.insert(0, 'augraphy') import augraphy import torchvision.transforms as transforms import random import torch import numpy as np import logging import cv2 from albumentations import augmentations from PIL import Image, ImageFilter from augmixations.blots import HandWrittenBlot from warp_mls import...
the-stack_0_6500
""" Example to show how to draw basic memes with OpenCV """ # Import required packages: import cv2 import numpy as np import matplotlib.pyplot as plt def show_with_matplotlib(img, title): """Shows an image using matplotlib capabilities""" # Convert BGR image to RGB: img_RGB = img[:, :, ::-1] # Show...
the-stack_0_6501
""" Copyright 2014 Rackspace 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 dist...
the-stack_0_6503
from typing import Any, ClassVar, Dict, List, Optional, TYPE_CHECKING from ..constants import Constants from ..config import Config from .irresource import IRResource from .irhttpmapping import IRHTTPMapping from .irtls import IRAmbassadorTLS from .irtlscontext import IRTLSContext from .ircors import IRCORS from .ir...
the-stack_0_6505
# Copyright 2019 The Microsoft DeepSpeed Team import time import logging import copy import os from types import MethodType from numpy import prod import torch import torch.nn as nn import torch.optim as optim import torch.distributed as dist from deepspeed.utils.logging import logger from deepspeed.utils.timer im...
the-stack_0_6506
#!/usr/bin/env python """Implements VFSHandlers for files on the client.""" from __future__ import unicode_literals import logging import os import platform import re import sys import threading from grr_response_client import client_utils from grr_response_client import vfs from grr_response_core.lib import utils fr...
the-stack_0_6508
from dataclasses import dataclass from datetime import timedelta from typing import Optional, Type, TypeVar from discord.abc import Messageable from commanderbot.ext.automod.automod_action import AutomodAction, AutomodActionBase from commanderbot.ext.automod.automod_event import AutomodEvent from commanderbot.lib imp...
the-stack_0_6510
# -*- coding: utf-8 -*- # Author: Naqwada (RuptureFarm 1029) <naqwada@pm.me> # License: MIT License (http://www.opensource.org/licenses/mit-license.php) # Docs: https://github.com/Naqwa/CVE-2022-26134 # Website: http://samy.link/ # Linkedin: https://www.linkedin.com/in/samy-younsi/ # Note: FOR EDUCATIONAL ...
the-stack_0_6512
# coding=utf-8 # Copyright 2022 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_6513
# Copyright 2019-2022 Cambridge Quantum Computing # # 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_0_6514
# -*- 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_0_6518
""" Base classes that implement the CLI framework """ import logging import importlib from collections import OrderedDict import click logger = logging.getLogger(__name__) _COMMAND_PACKAGE = [ "pcskcli.commands.command1", "pcskcli.commands.command2", ] class BaseCommand(click.MultiCommand): def __init_...
the-stack_0_6519
""" Invoke entrypoint, import here all the tasks we want to make available """ import os from invoke import Collection from . import ( agent, android, bench, cluster_agent, cluster_agent_cloudfoundry, customaction, docker, dogstatsd, github, installcmd, pipeline, proces...
the-stack_0_6520
import os token = 'your gitee account token' report_header = [ 'packageName', 'rvPRUser', 'rvPRUrl', 'rvPRStatus', 'created_at', 'updated_at', 'lastest comment time', 'lastest comment submitter' ] headers = { 'Content-Type': 'application/json;charset=UTF-8' } owner = 'open...
the-stack_0_6523
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = "Christian Heider Nielsen" __doc__ = r""" Created on 02-12-2020 """ from contextlib import contextmanager from itertools import tee from torch.nn import Module from draugr.torch_utilities.optimisation.parameters.freezing.parameters i...
the-stack_0_6524
import torch import torch.nn as nn import torch.nn.functional as F import math class Norm(nn.Module): def __init__(self, d_model, eps = 1e-6): super().__init__() self.size = d_model # create two learnable parameters to calibrate normalisation self.alpha = nn.Parameter...
the-stack_0_6528
import os import sys import types import logging from pprint import pformat import importlib from biothings.utils.hub_db import get_data_plugin from biothings.utils.manager import BaseSourceManager from biothings.utils.hub_db import get_src_master, get_src_dump class SourceManager(BaseSourceManager): """ Hel...
the-stack_0_6530
from collections import defaultdict from copy import deepcopy import matplotlib.font_manager as fm import numpy as np from ...config import SETTINGS from .plot_tree_graph import plot_tree_graph class AssemblyGraphMixin: def plot_assembly_graph(self, ax=None, margin=None, textprops=None, scale=1.0): """Plo...
the-stack_0_6534
# demo for binary search import math def binarysearch(search, sortedlist): left = 0 right = len(sortedlist) -1 mid = math.ceil((right + left) / 2) while sortedlist[mid] != search: if search > sortedlist[mid]: left = mid+1 else: right = mid-1 if left ...
the-stack_0_6535
# -*- coding: utf-8 -*- ''' salt.utils.aggregation ~~~~~~~~~~~~~~~~~~~~~~ This library allows to introspect dataset and aggregate nodes when it is instructed. .. note:: The following examples with be expressed in YAML for convenience sake: - !aggr-scalar will refer to Scalar pyth...
the-stack_0_6539
import argparse import os import time import typing as t from random import randint, choice import pandas as pd import requests from gradient_boosting_model.config.core import config from gradient_boosting_model.processing.data_management import load_dataset LOCAL_URL = f'http://{os.getenv("DB_HOST", "localhost")}:50...
the-stack_0_6540
"""This file and its contents are licensed under the Apache License 2.0. Please see the included NOTICE for copyright information and LICENSE for a copy of the license. """ import logging import json import socket import re import google.auth import re from google.auth import compute_engine from google.cloud import st...
the-stack_0_6542
# # Copyright (c) 2020 Averbis GmbH. # # This file is part of Averbis Python API. # See https://www.averbis.com for further info. # # 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:...
the-stack_0_6544
# -*- coding: utf-8 -*- # ex: set sts=4 ts=4 sw=4 noet: # ## ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ## # # See COPYING file distributed along with the datalad package for the # copyright and license terms. # # ## ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##...
the-stack_0_6554
# coding: utf-8 # /*########################################################################## # # Copyright (c) 2004-2018 European Synchrotron Radiation Facility # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to d...
the-stack_0_6555
import sys import os import scipy.sparse import numpy as np from util import argsort_bigtosmall_stable def loadKeffForTask( taskpath, effCountThr=0.01, MIN_PRESENT_COUNT=1e-10, **kwargs): ''' Load effective number of clusters used at each checkpoint. Returns ------- Ke...
the-stack_0_6558
import numpy as np class Agent(): """Three solving agents- 1. Sarsa(0) 2. Expected Sarsa 3. Q-Learning policy used: epsilon greedy Plus a run loop for windy gridworld """ def __init__(self, numStates, numActions, discount=1, lr = 0.5, update="sarsa0", epsilon = 0.1): self.update_Q = self.getAgent(u...
the-stack_0_6559
def main(): print('I will set up a pairwise-compete matrix') compare_pairwise_complete() # # test that distances calculated using custom and pdist functions are the same # # - they are # data_type = 'ptm_none' # dist_metric = 'euclidean' # compare_pdist_to_custom_dist_mat(data_type=data_type, dist_metri...
the-stack_0_6560
from typing import FrozenSet, Tuple import pysmt.typing as types from pysmt.environment import Environment as PysmtEnv from pysmt.fnode import FNode from utils import symb_to_next from hint import Hint, Location def transition_system(env: PysmtEnv) -> Tuple[FrozenSet[FNode], FNode, FNode, ...
the-stack_0_6561
from . httptools import Http from . task import Task class Client(object): """ :return: encoder object """ def __init__(self, api_key, api_url=None, version=None): self.api_key = api_key self.api_url = api_url if api_url else 'https://api.qencode.com/' self.version = version if version else '...
the-stack_0_6562
#!/usr/bin/env python from setuptools import setup, find_packages # versioneer config import versioneer versioneer.versionfile_source = 'httpsig/_version.py' versioneer.versionfile_build = 'httpsig/_version.py' versioneer.tag_prefix = 'v' # tags are like v1.2.0 versioneer.parentdir_prefix = 'httpsig-' ...
the-stack_0_6565
# -*- coding: utf-8 -*- # This code is part of Qiskit. # # (C) Copyright IBM 2018, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any...
the-stack_0_6566
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import socks import datetime from telethon.tl.types import UserStatusOnline from telethon.tl.types import UserStatusRecently from telethon.tl.types import UserStatusLastWeek from telethon.tl.types import UserStatusLastMonth from telethon.tl.types import UserStatusEmpty ...
the-stack_0_6568
import sqlalchemy as sa from sqlalchemy import ForeignKey from sqlalchemy import func from sqlalchemy import Integer from sqlalchemy import testing from sqlalchemy.orm import relationship from sqlalchemy.testing import eq_ from sqlalchemy.testing import fixtures from sqlalchemy.testing.fixtures import fixture_session f...
the-stack_0_6569
# Copyright (c) 2020, Huawei Technologies.All rights reserved. # # Licensed under the BSD 3-Clause License (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://opensource.org/licenses/BSD-3-Clause # # Unless required by applicable law...
the-stack_0_6571
# a(n) is the amount of individuals by day n # q(n) corresponds to the number of zeroes in day n n = 256 qmem = [-1 for i in range(n + 10)] def a(n): if n == 0: return 1 return a(n-1) + q(n-1) def q(n): if n <= 9: return 1 if n == 8 else 0 if qmem[n] != -1: return qmem[n] qmem[n] = q(n-7) + q(n-...
the-stack_0_6572
"""Management command for disabling an extension.""" from __future__ import unicode_literals from django.core.management.base import CommandError from django.utils.translation import ugettext as _ from djblets.util.compat.django.core.management.base import BaseCommand from reviewboard.extensions.base import get_exte...
the-stack_0_6574
import csv import requests import json from pprint import pprint import pandas as pd from csv import DictWriter # initializing a fixed token class EnvVariables: """ Initializing env variables """ t = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjozLCJpYXQiOjE2MzcxNDI2NjZ9.AkLL2rMRyvSkRoWEg2qbM...
the-stack_0_6576
'''10.2 Write a program to read through the mbox-short.txt and figure out the distribution by hour of the day for each of the messages. You can pull the hour out from the 'From ' line by finding the time and then splitting the string a second time using a colon. From stephen.marquard@uct.ac.za Sat Jan 5 09:14:16 20...
the-stack_0_6578
from __future__ import absolute_import from django.test import TestCase from .models import Reporter, Article class ManyToOneNullTests(TestCase): def setUp(self): # Create a Reporter. self.r = Reporter(name='John Smith') self.r.save() # Create an Article. self.a = Article...
the-stack_0_6579
""" Search indexing classes to index into Elasticsearch. Django settings that should be defined: `ES_HOSTS`: A list of hosts where Elasticsearch lives. E.g. ['192.168.1.1:9200', '192.168.2.1:9200'] `ES_DEFAULT_NUM_REPLICAS`: An integer of the number of replicas. `ES_DEFAULT_NUM_SHARDS`: ...
the-stack_0_6581
# Copyright 2011 OpenStack Foundation # 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 requ...
the-stack_0_6582
from mstrio.users_and_groups import list_users from mstrio.api.projects import get_projects from mstrio.distribution_services.subscription.subscription_manager import SubscriptionManager from mstrio.connection import Connection def delete_subscriptions_of_departed_users(connection: "Connection") -> None: """Delet...
the-stack_0_6583
"""This module contains the general information for LsbootSanCatSanImage ManagedObject.""" from ...ucsmo import ManagedObject from ...ucscoremeta import MoPropertyMeta, MoMeta from ...ucsmeta import VersionMeta class LsbootSanCatSanImageConsts: TYPE_PRIMARY = "primary" TYPE_SECONDARY = "secondary" class Ls...
the-stack_0_6584
import setuptools test_packages = [ "pytest>=5.4.3", "pytest-cov>=2.6.1" ] docs_packages = [ "mkdocs==1.1", "mkdocs-material==4.6.3", "mkdocstrings==0.8.0", ] dev_packages = docs_packages + test_packages with open("README.md", "r") as fh: long_description = fh.read() setuptools.setup( ...
the-stack_0_6585
# -*- coding: utf-8 -*- """ This module provide utilities for attempting to open other image files not opened by the sicd, sidd, or cphd reader collections. """ import os import sys import pkgutil from importlib import import_module from sarpy.io.general.base import BaseReader __classification__ = "UNCLASSIFIED" __...
the-stack_0_6592
"""Regresssion tests for urllib""" import urllib.parse import urllib.request import urllib.error import http.client import email.message import io import unittest from test import support import os import sys import tempfile from nturl2path import url2pathname, pathname2url from base64 import b64encode import collect...
the-stack_0_6593
import os import sys import time import shlex import shutil import random import inspect import logging import asyncio import pathlib import traceback import math import re import aiohttp import discord import colorlog from io import BytesIO, StringIO from functools import wraps from textwrap import dedent from datet...
the-stack_0_6594
import lcd import utime import sys import pmu from Maix import GPIO from fpioa_manager import * def display_hold(button): hold_status = False print(button.value()) if ((button.value() == 0)): hold_status = True while(hold_status): lcd.draw_string(0, 119, "Hold!", lcd.RED, lcd.BLACK) ...
the-stack_0_6597
import numpy as np import numpy.linalg import pytest from numpy import inf from numpy.testing import assert_array_almost_equal import aesara from aesara import function from aesara.configdefaults import config from aesara.tensor.math import _allclose from aesara.tensor.nlinalg import ( SVD, Eig, MatrixInve...
the-stack_0_6598
""" Prints which keys are pressed (0-4095), when any key is pressed or released. The interrupt fires when any key is pressed or released. """ import mpr121 from machine import Pin i2c = machine.I2C(3) mpr = mpr121.MPR121(i2c) # check all keys def check(pin): print(mpr.touched()) d3 = Pin('D3', Pin.IN, Pin.PULL...
the-stack_0_6600
from dataclasses import dataclass, field from typing import List from xsdata.models.datatype import XmlPeriod __NAMESPACE__ = "http://xstest-tns/schema11_D3_3_14_v01" @dataclass class Root: class Meta: name = "root" namespace = "http://xstest-tns/schema11_D3_3_14_v01" el_date: List[XmlPeriod...
the-stack_0_6602
import pyquil.quil as pq import pyquil.api as api from pyquil.gates import * from grove.amplification.grover import Grover import numpy as np from grove.utils.utility_programs import ControlledProgramBuilder import grove.amplification.oracles as oracle def grovers(n, s): """ generates a pyquil program for grov...
the-stack_0_6605
import datetime import json import os import re import fnmatch import cv2 from PIL import Image import numpy as np from pycococreatortools import pycococreatortools ROOT_DIR = '../' DATA_DIR = '/media/margery/4ABB9B07DF30B9DB/pythonDemo/medical_image_segmentation/Data/data_png_png' ANNOTATION_TUMOR_DIR = '../test_tum...
the-stack_0_6606
# make sure you use grpc version 1.39.0 or later, # because of https://github.com/grpc/grpc/issues/15880 that affected earlier versions import grpc import hello_pb2_grpc import hello_pb2 from locust import events, User, task from locust.exception import LocustError from locust.user.task import LOCUST_STATE_STOPPING fro...
the-stack_0_6608
import numpy as np import os import sklearn from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer from sklearn.svm import LinearSVC from sklearn.tree import DecisionTreeClassifier from sklearn.naive_bayes import MultinomialNB from sklearn.linear_model import RidgeClassifier from sklearn.model_se...
the-stack_0_6609
import logging from threading import Thread from .mikecrm import Mikecrm class MikeBrush(): def __init__(self, target, proxys, count): ''' Brush for voting on mike :param target: {"page":"", "data":""} :param proxys: Queue for {"type":"", "ip":"", "port":00} :param count: nu...
the-stack_0_6610
#!/usr/bin/env python __all__ = ['soundcloud_download', 'soundcloud_download_by_id'] from ..common import * import json import urllib.error client_id = 'WKcQQdEZw7Oi01KqtHWxeVSxNyRzgT8M' def soundcloud_download_by_id(id, title=None, output_dir='.', merge=True, info_only=False): assert title url = 'https://a...
the-stack_0_6612
import os import pandas as pd import yaml from tqdm import tqdm class ResLogger: def __init__(self, path): self.path = path if not os.path.isdir(path): os.mkdir(path) # Infer the last result computation that has been run if os.path.isfile(path+'res.c...
the-stack_0_6617
# coding:utf-8 import os import logging import datetime import requests import json from pagarme.config import __endpoint__, __user_agent__ from pagarme.common import merge_dict, make_url from pagarme import exceptions logger = logging.getLogger('pygarme') class PagarmeApi(object): def __init__(self, options=N...
the-stack_0_6620
#!/usr/bin/python # -*- coding: utf-8 -*- try: from PyQt5.QtGui import * from PyQt5.QtCore import * except ImportError: from PyQt4.QtGui import * from PyQt4.QtCore import * from libs.utils import distance import sys DEFAULT_LINE_COLOR = QColor(0, 255, 0, 128) DEFAULT_FILL_COLOR = QColor(255, 0, 0, 1...
the-stack_0_6623
from setuptools import setup, find_packages with open('README.md') as f: readme = f.read() setup( name='midi-websocket-server', version='1.0.0', description='Python Websocket server to facilitate two-way communication with all connected MIDI devices.', long_description=readme, url='https://git...
the-stack_0_6625
# Copyright 2021 BlackRock, 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, so...
the-stack_0_6628
from vector2D import Vector2D as vec from typing import List, Tuple Point = Tuple[int, int] def ear_clipping(polygon: List[Point]) -> List[List[Point]]: if len(polygon) > 3: polygon = vec.convert(polygon) total_triangles = len(polygon) - 2 triangles = [] while len(triangles) < t...