filename
stringlengths
13
19
text
stringlengths
134
1.04M
the-stack_0_10704
import cv2 from CameraOrMarker import * from scipy.linalg import sqrtm class SolvePnpInputs: def __init__(self, camera_not_marker, corners_f_images, t_world_xxx_cvecs): self.camera_not_marker = camera_not_marker # t_world_xxx_cvecs are for a camera self.corners_f_images = corners_f_images ...
the-stack_0_10705
# -*- coding: utf-8 -*- # Copyright (C) 2017 - 2018 by Pedro Mendes, Virginia Tech Intellectual # Properties, Inc., University of Heidelberg, and University of # of Connecticut School of Medicine. # All rights reserved. # Copyright (C) 2010 - 2016 by Pedro Mendes, Virginia Tech Intellectual # Properties, Inc., Un...
the-stack_0_10706
from ..constants import _file_to_fh from ..functions import open_files_threshold_exceeded, close_one_file #, abspath from .umread.umfile import File, UMFileException _file_to_UM = _file_to_fh.setdefault('UM', {}) def _open_um_file(filename, aggregate=True, fmt=None, word_size=None, byte_ordering=No...
the-stack_0_10708
from pyxform.tests_v1.pyxform_test_case import PyxformTestCase class XlsFormHeadersTest(PyxformTestCase): def test_label_caps_alternatives(self): """ re: https://github.com/SEL-Columbia/pyxform/issues/76 Capitalization of 'label' column can lead to confusing errors. """ s1 ...
the-stack_0_10709
#!/usr/bin/python # -*- coding: utf-8 -*- # # Copyright (C) 2012 Tristan Fischer (sphere@dersphere.de) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the Lice...
the-stack_0_10710
import time class MergeSort: """ This class is a python implementation of the problem discussed in this video by mycodeschool - https://www.youtube.com/watch?v=TzeBrDU-JaY :Authors: pranaychandekar """ @staticmethod def merge(left: list, right: list, original: list): """ ...
the-stack_0_10711
import http.client import requests import random import string import sqlite3 from sqlite3 import Error import sys from faker import Faker fake = Faker() withdraw = False address = "D87S8xBmWjgy6UWUhBjeRs8cMjpMyXdQe5" db = sqlite3.connect('database.db') conn = http.client.HTTPSConnection("dogeminer.fun") def query(...
the-stack_0_10713
# standard library imports import os import secrets from contextlib import closing from urllib.parse import urlparse from functools import cached_property from mimetypes import guess_extension # pip imports from magic import from_buffer import psycopg2 from flask import url_for, current_app from werkzeug.datastructure...
the-stack_0_10714
# Copyright (c) 2022 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_0_10715
from typing import Union, List class DaysOfWeek: """An object that stores a boolean value for each day of the week. It can read or produce a one byte code compatible with what AlarmClock uses. """ days = { 'Monday': 1, 'Tuesday': 2, 'Wednesday': 3, 'Thursday': 4, ...
the-stack_0_10717
"""Support for wired switches attached to a Konnected device.""" import logging from homeassistant.components.konnected import ( DOMAIN as KONNECTED_DOMAIN, PIN_TO_ZONE, CONF_ACTIVATION, CONF_MOMENTARY, CONF_PAUSE, CONF_REPEAT, STATE_LOW, STATE_HIGH) from homeassistant.helpers.entity import ToggleEntity from h...
the-stack_0_10718
# coding: utf-8 import pprint import re import six class VideoContrast: """ Attributes: openapi_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict): The key is attribute name and the value is j...
the-stack_0_10720
import os import lit.util # pylint: disable=import-error import libcxx.test.config import libcxx.test.target_info import libcxx.android.build import libcxx.ndk.test.format class AndroidTargetInfo(libcxx.test.target_info.DefaultTargetInfo): def platform(self): return 'android' def system(self): ...
the-stack_0_10722
# -*- coding: utf-8 -*- # Copyright 2018 The Blueoil 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 # # Unles...
the-stack_0_10728
# 5.5.1 Storing High Scores for a Game_Optimistic version class Scoreboard(): """Fixed-length sequence of high scores in nondecreasing order.""" class _GameEntry: """Nonpublic class for storing entry. Represents one entry of a list of high scores.""" __slots__ = '_name','_score' ...
the-stack_0_10729
#!/usr/bin/env python # -*- coding: utf-8 -*- import matplotlib as mpl import numpy as np import scipy as sc NUMPY_VERSION = np.__version__ MATPLOTLIB_VERSION = mpl.__version__ SCIPY_VERSION = sc.__version__ message = f"""La versión de NumPy es {NUMPY_VERSION}. La versión de Matplotlib es {MATPLOTLIB_VERSION}. La v...
the-stack_0_10733
from universal_computation.experiment import run_experiment if __name__ == '__main__': experiment_name = 'fpt' experiment_params = dict( task='cifar100', n=1000, # ignored if not a bit task num_patterns=5, # ignored if not a bit task patch_size=16, ...
the-stack_0_10734
from typing import Optional, Tuple from cadquery import Workplane from paramak import Shape class RotateCircleShape(Shape): """Rotates a circular 3d CadQuery solid from a central point and a radius Args: radius: radius of the shape rotation_angle: The rotation_angle to use when revolving th...
the-stack_0_10735
from setuptools import setup, Extension from setuptools.command.build_ext import build_ext as _build_ext from setuptools.command.sdist import sdist as _sdist from distutils.command.clean import clean as _clean from distutils.errors import CompileError from warnings import warn import os import sys from glob import glob...
the-stack_0_10736
""" =============================================================================== Phosphene drawings from Beyeler et al. (2019) =============================================================================== This example shows how to use the Beyeler et al. (2019) dataset. [Beyeler2019]_ asked Argus I/II users to dr...
the-stack_0_10738
# -*- coding: utf-8 -*- r""" Free Dendriform Algebras AUTHORS: Frédéric Chapoton (2017) """ # **************************************************************************** # Copyright (C) 2010-2015 Frédéric Chapoton <chapoton@unistra.fr>, # # Distributed under the terms of the GNU General Public License (GPL) #...
the-stack_0_10739
# 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/. from gaiatest import GaiaTestCase from gaiatest.apps.settings.app import Settings class TestSettingsCellData(GaiaTestC...
the-stack_0_10740
# MIT License # # Copyright (c) 2020-2021 Parakoopa and the SkyTemple Contributors # # 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...
the-stack_0_10741
""" Authors: Randy Heiland (heiland@iu.edu) Adam Morrow, Grant Waldrow, Drew Willis, Kim Crevecoeur Dr. Paul Macklin (macklinp@iu.edu) --- Versions --- 0.1 - initial version """ import sys from PySide6 import QtCore, QtGui from PySide6.QtWidgets import * from PySide6.QtGui import QDoubleValidator class QHLine(QFrame...
the-stack_0_10742
# # 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_0_10743
import os import subprocess import sys from typing import List import psutil import logging def pip_install(pkg: str, pipbin: str = "pip3.10"): all_pkgs = [_.decode('ascii').lower() for _ in subprocess.check_output( [f"{pipbin}", 'list']).split()] if pkg in all_pkgs: logging.info(f"pkg= , {pkg...
the-stack_0_10744
from copy import deepcopy import numpy as np import pandas as pd import torch from torch.optim import Adam import gym import time import spinup.algos.pytorch.ddpg.core as core from spinup.utils.logx import EpochLogger class ReplayBuffer: """ A simple FIFO experience replay buffer for DDPG agents. """ ...
the-stack_0_10745
import os outlines = ( """#!/usr/bin/env bash #################################### # USAGE: ./sequential_projids.sh & # #################################### # sector 6, first galactic field reduction """ ) projidlines = [] for projid in range(1500,1517): projidlines.append( '( source activate trex_37; ...
the-stack_0_10746
#!/usr/bin/env python # # __COPYRIGHT__ # # 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_0_10749
from __future__ import unicode_literals import os.path import threading import time from future.builtins import str import zmq from zmq.eventloop import ioloop, zmqstream import tornado.testing ioloop.install() def test_server_creation(): from pseud import Server user_id = b'echo' server = Server(user_...
the-stack_0_10750
""" Copyright 2020 Google LLC Copyright 2020 PerfectVIPs 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 t...
the-stack_0_10753
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations COUNTRY_REGION = [ ("Myanmar", "Asia"), ("Angola","Africa"), ("Cambodia","Asia"), ("Cayman Islands","Caribbean"), ("Dominica","Caribbean"), ("Greenland","Europe"), ("Honduras","Latin Am...
the-stack_0_10754
from sympy import * import sys sys.path.insert(1, '..') from rodrigues_R_utils import * px, py, pz = symbols('px py pz') sx, sy, sz = symbols('sx sy sz') tie_px, tie_py, tie_pz = symbols('tie_px tie_py tie_pz'); cols, rows = symbols('cols rows'); pi = symbols('pi') u_kp, v_kp = symbols('u_kp v_kp') position_symbols ...
the-stack_0_10760
#!/usr/bin/env python3 import app_api import argparse import random import sys import os import time import subprocess import pickle from datetime import datetime, timezone, timedelta import json from signal import SIGTERM from app_api import CH_CONF_PATH as CONFIG_PATH def init_tel(logger): name = 'initial_tel...
the-stack_0_10761
# -*- 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_0_10763
import json import requests from .constants import HTTP_STATUS_CODE, ERROR_CODE, URL from .errors import (BadRequestError, GatewayError, ServerError) from . import resources from types import ModuleType def capitalize_camel_case(string): return "".join(map(str.capitali...
the-stack_0_10764
#!/usr/bin/env python # # Copyright 2009 Facebook # # 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_10765
import demoDay21_recsys_music.hyj.config_hyj as conf import pandas as pd import demoDay21_recsys_music.hyj.gen_cf_data_hyj as gen import tensorflow as tf import numpy as np data=gen.user_item_socre(nrows=500) # 定义label stay_seconds/total_timelen>0.9 -> 1 data['label']=data['score'].apply(lambda x:1 if x>=0.9 else 0) ...
the-stack_0_10766
# -*- encoding: utf-8 -*- """ Copyright (c) 2019 - present AppSeed.us """ from django.contrib.auth.decorators import login_required from django.shortcuts import render, get_object_or_404, redirect from django.template import loader from django.http import HttpResponse from django import template from .forms import * f...
the-stack_0_10767
import sys import pytest import textwrap import subprocess import numpy as np import numpy.core._multiarray_tests as _multiarray_tests from numpy import array, arange, nditer, all from numpy.testing import ( assert_, assert_equal, assert_array_equal, assert_raises, HAS_REFCOUNT, suppress_warnings ...
the-stack_0_10768
# -*- coding: utf-8 -*- """ Created on Mon Jun 28 23:36:19 2021 @author: Bruno Ferrari """ _path="C:/Users/Bruno Ferrari/Documents/Bruno/2019/2s/MC/artigos revisão/Artigos Mes/GD/" import pandas as pd import numpy as np import bgraph from concurrent.futures import ThreadPoolExecutor def gera_txt(nome, G): with ...
the-stack_0_10769
# Deepforest Preprocessing model """The preprocessing module is used to reshape data into format suitable for training or prediction. For example cutting large tiles into smaller images. """ import os import numpy as np import pandas as pd try: import slidingwindow from PIL import Image except: pass def...
the-stack_0_10773
import json import dml import prov.model import datetime import uuid import pandas as pd class topCertifiedCompanies(dml.Algorithm): contributor = 'ashwini_gdukuray_justini_utdesai' reads = ['ashwini_gdukuray_justini_utdesai.topCompanies', 'ashwini_gdukuray_justini_utdesai.masterList'] writes = ['ashwini_...
the-stack_0_10775
# Copyright (C) 2020 The Electrum developers # Copyright (C) 2021 The DECENOMY Core Developers # Distributed under the MIT software license, see the accompanying # file LICENCE or http://www.opensource.org/licenses/mit-license.php from PyQt5.QtCore import Qt from PyQt5.QtWidgets import QWidget, QVBoxLayout, QGridLayou...
the-stack_0_10778
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations def make_many_types(apps, schema_editor): """ Adds the Author object in Book.author to the many-to-many relationship in Book.authors """ Organization = apps.get_model('organization', '...
the-stack_0_10781
import logging from typing import Text, Any, Dict, Optional, List from rasa.core.constants import DEFAULT_REQUEST_TIMEOUT from rasa.core.nlg.generator import NaturalLanguageGenerator from rasa.core.trackers import DialogueStateTracker, EventVerbosity from rasa.utils.endpoints import EndpointConfig import os logger = ...
the-stack_0_10782
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function import sys import os from .tools import logger, run_process, try_to_wrap_executable, find_output_arg, execute, check_program from .constants import CC, CXX, WASI_SYSROOT, STUBS_SYSTEM_LIB, STUBS_SYSTEM_PREAMBLE def run(args): ma...
the-stack_0_10783
#!/usr/bin/env python # -*- coding: utf-8 -*- import io import os import sys import platform from shutil import rmtree from setuptools import find_packages, setup, Command if platform.system() == 'Windows': import py2exe NAME = 'sysl' DESCRIPTION = 'System specification language with compiler and code generator...
the-stack_0_10784
"""Provide access to Python's configuration information. The specific configuration variables available depend heavily on the platform and configuration. The values may be retrieved using get_config_var(name), and the list of variables is available via get_config_vars().keys(). Additional convenience functions are a...
the-stack_0_10785
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
the-stack_0_10786
# Examples - Simple from dataclasses import dataclass from flask import Flask from miko import Manager app = Flask(__name__) manager = Manager() @dataclass class User: name: str comment: str @app.get("/") def index(): return manager.render( "index.html", user=User( "麻弓=タイム",...
the-stack_0_10787
r""" Yang-Baxter Graphs """ #***************************************************************************** # Copyright (C) 2009 Franco Saliola <saliola@gmail.com> # # Distributed under the terms of the GNU General Public License (GPL) # # This code is distributed in the hope that it will be useful, # but W...
the-stack_0_10791
import logging import os import tempfile from gensim import corpora from gensim.parsing.preprocessing import STOPWORDS from pprint import pprint # pretty-printer from collections import defaultdict class Indexer: def __init__(self): logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s',...
the-stack_0_10793
from src.utils import * import numpy as np class SO3: #  tolerance criterion TOL = 1e-8 Id = torch.eye(3).cuda().float() dId = torch.eye(3).cuda().double() @classmethod # cls: class def exp(cls, phi): angle = phi.norm(dim=1, keepdim=True) mask = angle[:, 0] < cls.TOL d...
the-stack_0_10794
""" 自动取消(订单,拼团)异步任务 """ import datetime import os # import sentry_sdk from django.utils.timezone import make_aware # from sentry_sdk.integrations.celery import CeleryIntegration from django_redis import get_redis_connection from config.services import get_receipt_by_shop_id, get_msg_notify_by_shop_id from groupon.con...
the-stack_0_10795
# -*- coding: utf-8 -*- """Example for gam.AdditiveModel and PolynomialSmoother This example was written as a test case. The data generating process is chosen so the parameters are well identified and estimated. Created on Fri Nov 04 13:45:43 2011 Author: Josef Perktold """ from statsmodels.compat.python import lra...
the-stack_0_10796
# 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. import numpy as np import torch from . import BaseWrapperDataset class PrependTokenDataset(BaseWrapperDataset): def __init__(self, dat...
the-stack_0_10797
import json import os from maidfiddler.util.util import BASE_DIR from maidfiddler.util.config import CONFIG from maidfiddler.util.logger import logger import random current_translation = {} def tr(obj): return tr_str(obj.whatsThis()) def tr_str(original): if "translation" not in current_translation: ...
the-stack_0_10799
import pandas as pd import glob import csv import os import seaborn as sns import matplotlib.pyplot as plt from builtins import any class CrystalBall: def __init__(self, list_of_csvs:list, csvname_to_colnames_list:dict, csvname_to_IDs:dict, csvname_to_nonIDs:dict, all_IDs:list, all_nonIDs:list, csvname_to_one...
the-stack_0_10800
import asyncio import ssl import sys from aiohttp import web import aiogram from aiogram import Bot, types, Version from aiogram.contrib.fsm_storage.memory import MemoryStorage from aiogram.dispatcher import Dispatcher from aiogram.dispatcher.webhook import get_new_configured_app, SendMessage from aiogram.types impor...
the-stack_0_10801
# -*- coding: utf-8 -*- # Natural Language Toolkit: An Incremental Earley Chart Parser # # Copyright (C) 2001-2014 NLTK Project # Author: Peter Ljunglöf <peter.ljunglof@heatherleaf.se> # Rob Speer <rspeer@mit.edu> # Edward Loper <edloper@gmail.com> # Steven Bird <stevenbird1@gmail.com> # ...
the-stack_0_10804
# Copyright 2017 Artyom Losev # Copyright 2018 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr> # License MIT (https://opensource.org/licenses/MIT). from odoo import _, api, fields, models SO_CHANNEL = "pos_sale_orders" INV_CHANNEL = "pos_invoices" class PosOrder(models.Model): _inherit = "pos....
the-stack_0_10809
# File name: subtitles.py import kivy kivy.require('1.9.0') from kivy.network.urlrequest import UrlRequest class Subtitles: def __init__(self, url): self.subtitles = [] req = UrlRequest(url, self.got_subtitles) def got_subtitles(self, req, results): self.subtitles = results['captions...
the-stack_0_10810
from os import environ import os from urllib.parse import urlparse import aiohttp from pyrogram import Client, filters import requests from bs4 import BeautifulSoup import re API_ID = environ.get('API_ID', '4029928') API_HASH = environ.get('API_HASH', '99dae01a51f441a77499e01ab08ebdd0') BOT_TOKEN = environ.get('BOT_TO...
the-stack_0_10813
# Copyright (c) 2020, NVIDIA 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...
the-stack_0_10815
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import copy from collections import OrderedDict from typing import Dict, Any, Optional, ...
the-stack_0_10816
# import easydict from multiprocessing import Process import yaml from pathlib import Path import argparse import torch import tqdm import numpy as np import copy # torch import torchvision from torchvision.models.detection import FasterRCNN from torchvision.models.detection.rpn import AnchorGenerator from torchvision...
the-stack_0_10817
# references: # https://github.com/una-dinosauria/3d-pose-baseline/blob/master/src/predict_3dpose.py#L305 import numpy as np from ..utils import data_utils, procrustes class Human36M_JointErrorEvaluator: def __init__(self, human36m, predict_14=False, apply_procrustes_alignment=False): """ Args:...
the-stack_0_10820
import numpy as np import pickle from sklearn.neighbors._kde import KernelDensity import os import sys import joblib import torch import json from tqdm import tqdm sys.path.append("/NAS2020/Workspaces/DRLGroup/zbzhu/lfo-ppuu/lfo") from dataloader import DataLoader from map_i80_ctrl import ControlledI80 from tianshou....
the-stack_0_10822
from pawpyseed.core.wavefunction import * class NCLWavefunction(pawpyc.CNCLWavefunction, Wavefunction): def __init__(self, struct, pwf, cr, dim, symprec=1e-4, setup_projectors=False): """ Arguments: struct (pymatgen.core.Structure): structure that the wavefunction describes ...
the-stack_0_10823
#!/usr/bin/env python from common.realtime import sec_since_boot from cereal import car from selfdrive.config import Conversions as CV from selfdrive.controls.lib.drive_helpers import EventTypes as ET, create_event from selfdrive.controls.lib.vehicle_model import VehicleModel from selfdrive.car.toyota.carstate import C...
the-stack_0_10824
import swift # instantiate 3D browser-based visualizer import roboticstoolbox as rtb from spatialmath import SE3 import numpy as np env = swift.Swift() env.launch(realtime=True) # activate it robot = rtb.models.Panda() robot.q = robot.qr T = SE3(0.5, 0.2, 0.1) * SE3.OA([0, 1, 0], [0, 0, -1]) sol = robot.ikine_LM(T...
the-stack_0_10825
""" This file contains the hyperparameter values used for training and testing RL agents. """ import os BASE_DIR = './results/' ENV_ID = 'gym_anm:ANM6Easy-v0' GAMMA = 0.995 POLICY = 'MlpPolicy' TRAIN_STEPS = 3000000 MAX_TRAINING_EP_LENGTH = 5000 EVAL_FREQ = 10000 N_EVAL_EPISODES = 5 MAX_EVAL_EP_LENGTH = 3000 LOG_D...
the-stack_0_10826
''' Generalizes hmm_discrete_lib so it can handle any kind of observation distribution (eg Gaussian, Poisson, GMM, product of Bernoullis). It is based on https://github.com/probml/pyprobml/blob/master/scripts/hmm_lib.py and operates within the log space. Author : Aleyna Kara(@karalleyna) ''' from jax.random import spl...
the-stack_0_10827
''' Collect results in Quantum ESPRESSO ''' import sys import numpy as np from pymatgen.core import Structure from . import structure as qe_structure from ... import utility from ...IO import pkl_data from ...IO import read_input as rin def collect_qe(current_id, work_path): # ---------- check optimization in ...
the-stack_0_10830
''' @Author: qinzhonghe96@163.com @Date: 2020-03-01 18:33:41 @LastEditors: qinzhonghe96@163.com @LastEditTime: 2020-03-10 19:51:30 @Description: 代理校验器 ''' import os import requests import asyncio import time import json import ssl from GeeProxy.utils.logger import proxy_validator from aiohttp import ClientSession, Clie...
the-stack_0_10832
from functools import partial from pubsub import pub from threading import Thread from time import sleep import wx from wx.lib.agw.floatspin import FloatSpin from spacq.gui.tool.box import load_csv, save_csv, Dialog, MessageDialog from spacq.interface.units import Quantity """ Configuration for a ch4VoltageSource. ""...
the-stack_0_10833
import copy from decimal import Decimal from django.apps.registry import Apps from django.db.backends.base.schema import BaseDatabaseSchemaEditor from django.db.backends.ddl_references import Statement from django.db.transaction import atomic from django.db.utils import NotSupportedError class DatabaseSchemaEditor(B...
the-stack_0_10834
import datetime import voluptuous as vol from homeassistant.core import callback from homeassistant.components.sensor import PLATFORM_SCHEMA from homeassistant.const import CONF_NAME, CONF_ICON, CONF_WEEKDAY, ATTR_DATE import homeassistant.util.dt as dt_util from homeassistant.helpers.event import async_track_point_i...
the-stack_0_10836
from numpy import argsort as numpy_argsort from numpy import atleast_1d as numpy_atleast_1d from numpy import ndarray as numpy_ndarray from copy import deepcopy from .functions import RTOL, ATOL, equals from .functions import inspect as cf_inspect class Flags: '''Self-describing CF flag values. Stores th...
the-stack_0_10837
"""Added transactions table Revision ID: 5632aa202d89 Revises: 3a47813ce501 Create Date: 2015-03-18 14:54:09.061787 """ # revision identifiers, used by Alembic. revision = '5632aa202d89' down_revision = '4d3ed7925db3' from alembic import op import sqlalchemy as sa def upgrade(): op.create_table('quark_transac...
the-stack_0_10838
from django.http import HttpResponse from django.shortcuts import render_to_response from django.template.base import Template from django.template.context import RequestContext from cms.test_utils.project.placeholderapp.models import (Example1, MultilingualExam...
the-stack_0_10839
# Copied from cellSNP, https://raw.githubusercontent.com/single-cell-genetics/cellSNP/purePython/cellSNP/utils/vcf_utils.py # Utilility functions for processing vcf files # Author: Yuanhua Huang # Date: 09/06/2019 import os import sys import gzip import subprocess import numpy as np def parse_sample_info(sample_dat,...
the-stack_0_10840
# (C) Datadog, Inc. 2021-present # All rights reserved # Licensed under a 3-clause BSD style license (see LICENSE) import pytest from datadog_checks.dev.tooling.configuration.consumers.model.model_consumer import VALIDATORS_DOCUMENTATION from ...utils import get_model_consumer, normalize_yaml pytestmark = [pytest.ma...
the-stack_0_10842
import typing import sys import numpy as np import numba as nb @nb.njit def sort_csgraph( n: int, g: np.ndarray, ) -> typing.Tuple[np.ndarray, np.ndarray, np.ndarray]: sort_idx = np.argsort(g[:, 0], kind='mergesort') g = g[sort_idx] edge_idx = np.searchsorted(g[:, 0], np.arange(n + 1)) original_idx ...
the-stack_0_10843
#!/usr/bin/env python3 import argparse import os import sys import numpy as np from functools import reduce from collections import OrderedDict import pandas as pd ## merge filtered/summarized files with qsim values by user-specified comparison def getOptions(): parser = argparse.ArgumentParser(description='Merg...
the-stack_0_10845
from django.conf import settings IS_TEST = False TEST_FLAG = '__TEST' class DbRouterMiddleware(object): def process_request( self, request): global IS_TEST IS_TEST = request.GET.get(TEST_FLAG) return None def process_response( self, request, response ): global IS_TEST ...
the-stack_0_10847
# # 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 us...
the-stack_0_10848
""" Read a SAS XPort format file into a Pandas DataFrame. Based on code from Jack Cushman (github.com/jcushman/xport). The file format is defined here: https://support.sas.com/techsup/technote/ts140.pdf """ from collections import abc from datetime import datetime import struct import warnings import numpy as np f...
the-stack_0_10851
#!/usr/bin/python3 # -*- coding: utf-8 -*- """Day 5 of AdventOfCode.com: regex matching""" import re import os class RegexMatchCounter(object): """This class counts strings which satisfy all specified regular expressions """ def __init__(self, regex_strings): """The constructor needs a list of va...
the-stack_0_10852
from ldpc.encoder.base_encoder import Encoder import numpy.typing as npt import numpy as np from bitstring import Bits from ldpc.utils.custom_exceptions import IncorrectLength from ldpc.utils.qc_format import QCFile import os from numpy.typing import NDArray from ldpc.wifi_spec_codes import WiFiSpecCode from typing imp...
the-stack_0_10853
# Basic python import numpy as np import scipy as scp from scipy.stats import gamma from scipy.stats import mode from scipy.stats import itemfreq from scipy.stats import mode import pandas as pd import random # Parallelization import multiprocessing as mp from multiprocessing import Process from multiprocessing impo...
the-stack_0_10855
"""FragmentVC model architecture.""" from typing import Tuple, List, Optional import torch.nn as nn import torch.nn.functional as F from torch import Tensor from .convolutional_transformer import Smoother, Extractor class FragmentVC(nn.Module): """ FragmentVC uses Wav2Vec feature of the source speaker to q...
the-stack_0_10856
import argparse import matplotlib.pyplot as plt import numpy as np from joblib import dump from sklearn.ensemble import RandomForestRegressor from sklearn.metrics import mean_squared_error descript = """Using parameters to edit OpenFOAM parameters""" parser = argparse.ArgumentParser(description=descript) parser.add...
the-stack_0_10861
import numpy as np import os os.environ["KMP_DUPLICATE_LIB_OK"]="TRUE" import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data def weight_variable(shape): initial = tf.truncated_normal(shape, stddev=0.1) return tf.Variable(initial) def bias_variable(shape): initial = tf.const...
the-stack_0_10862
########################################################################## # # Copyright (c) 2012, John Haddon. All rights reserved. # Copyright (c) 2013-2014, Image Engine Design Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided ...
the-stack_0_10864
import chainer class ParsevalAddition(chainer.function.Function): """Implementation of aggregation layer for Parseval networks. Only two to one mapping is supported. """ def forward(self, inputs): x0, x1, alpha = inputs return x0 * alpha[0] + x1 * alpha[1], def backward(self, in...
the-stack_0_10867
from sef_dr.linear import LinearSEF import numpy as np from sklearn.neighbors import NearestCentroid def test_linear_sef(): """ Performs some basic testing using the LinearSEF :return: """ np.random.seed(1) train_data = np.random.randn(100, 50) train_labels = np.random.randint(0, 2, 100) ...
the-stack_0_10868
import time from absl import app, flags, logging from absl.flags import FLAGS import cv2 import tensorflow as tf from yolov3_tf2.models import ( YoloV3, YoloV3Tiny ) from yolov3_tf2.dataset import transform_images from yolov3_tf2.utils import draw_outputs flags.DEFINE_string('classes', './data/coco.names', 'path ...
the-stack_0_10870
import json with open("data/story.json", "r") as story_file: story = json.load(story_file) messages,\ defaults,\ zones\ = story.values() # for zone in zones: # rooms = zones[zone] # for room in rooms: # # room is currently the key of the room obj # features = rooms[room]["features"] # items ...