filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_106_28803 | # -*- coding: utf-8 -*-
""" These are time functions provided for using the time-dependent solver.
Q: Why are there multiple versions of each?
A: The solver will want one list of arguments even if there are multiple
time-dependent parts to the Hamiltonian. (Say one laser is ramped on then CW
and another is a Gau... |
the-stack_106_28805 | import converters
import math
import random
import sys
def random_real(a, b):
"""
Random real between a and b inclusively.
"""
return a + random.random() * (b - a)
def branch_length(depth):
"""
Somewhat random length of the branch. Play around
with this to achieve a desired tree structure... |
the-stack_106_28806 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
def add_stalled_unresponsive_tags(apps, schema_editor):
"""Add "stalled" and "unresponsive" tags."""
Tag = apps.get_model('workshops', 'Tag')
Tag.objects.create(
name='stalled',
detail... |
the-stack_106_28807 | #
# Copyright (C) 2017 The Android Open Source Project
#
# 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_28808 | from django.test import TestCase
from django.utils.html import escape
from unittest import skip
from lists.models import Item, List
from lists.forms import ItemForm, ExistingListItemForm, EMPTY_ITEM_ERROR, DUPLICATE_ITEM_ERROR
class HomePageTest(TestCase):
def test_home_page_renders_home_template(self):
... |
the-stack_106_28810 | #!/usr/bin/env python
import plac
import re
import random
import json
from pathlib import Path
from collections import Counter
import thinc.extra.datasets
import spacy
import torch
from spacy.util import minibatch
import tqdm
import unicodedata
import wasabi
from spacy_pytorch_transformers.util import cyclic_triangular... |
the-stack_106_28811 | import numpy as np
class Node(object):
def __init__(self,label,root,level_n=0):
self.children = []
self.father = None
self.root = root
self.label = label
self.name = "-"
self.level_n = level_n
self.pos = -1
def __str__(self, level=0):
image = "\t... |
the-stack_106_28812 | #!/usr/bin/python
# Copyright: Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
... |
the-stack_106_28815 | """
Uses the Twitter API to collect the data required for inferring the relationship between two users
Requires access to the Twitter API for inference
"""
import tweepy
import numpy as np
import json
from tqdm import tqdm
def get_api_credentials():
credentials={}
with open('data/credentials.txt') as f:
... |
the-stack_106_28816 | import ctypes
import sdl2
from event_dispatcher import EventDispatcher
class EventLoop:
def __init__(self, window):
self._event_dispatcher = EventDispatcher(self, window)
self._running = False
rotate_event = sdl2.SDL_Event()
rotate_event.type = EventDispatcher.ROTATE_EVENT
... |
the-stack_106_28817 | import os
from pathlib import Path
from envparse import env
# load environment variables from .env
app_dir: Path = Path(__file__).parent.parent
env_file = app_dir / ".env"
if os.path.isfile(env_file):
env.read_envfile(env_file)
BOT_API_TOKEN = env.str("BOT_API_TOKEN", default="")
SERVERLESS = env.bool("SERVERLES... |
the-stack_106_28818 | # Setup paths for module imports
import gc
# Import required modules
from pyaedt import Emit
from pyaedt.generic.filesystem import Scratch
from pyaedt.modeler.PrimitivesEmit import EmitComponent, EmitComponents
from _unittest.conftest import scratch_path, config
try:
import pytest
except ImportError:
import ... |
the-stack_106_28819 | from typing import Optional, Union, Dict, Any
from algoliasearch.configs import RecommendationConfig
from algoliasearch.helpers import is_async_available
from algoliasearch.http.request_options import RequestOptions
from algoliasearch.http.requester import Requester
from algoliasearch.http.transporter import Transport... |
the-stack_106_28823 | # yellowbrick.model_selection.rfecv
# Visualize the number of features selected with recursive feature elimination
#
# Author: Benjamin Bengfort
# Created: Tue Apr 03 17:31:37 2018 -0400
#
# Copyright (C) 2018 The scikit-yb developers
# For license information, see LICENSE.txt
#
# ID: rfecv.py [a4599db] rebeccabilbro@... |
the-stack_106_28824 | import torch
import torch.nn as nn
import torch.nn.functional as F
import math
class route_func(nn.Module):
r"""CondConv: Conditionally Parameterized Convolutions for Efficient Inference
https://papers.nips.cc/paper/8412-condconv-conditionally-parameterized-convolutions-for-efficient-inference.pdf
Args:
... |
the-stack_106_28826 | # copyright (c) 2020 PaddlePaddle Authors. All Rights Reserve.
#
# 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 applic... |
the-stack_106_28827 | import pytest
from bayesian.factor_graph import *
def f_prize_door(prize_door):
return 1.0 / 3
def f_guest_door(guest_door):
return 1.0 / 3
def f_monty_door(prize_door, guest_door, monty_door):
if prize_door == guest_door:
if prize_door == monty_door:
return 0
else:
... |
the-stack_106_28828 | BACKEND = 'sqlite'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
}
}
INSTALLED_APPS = (
'django_pivot.tests.pivot',
)
SITE_ID = 1,
SECRET_KEY = 'secret'
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.middlewar... |
the-stack_106_28829 | # 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_28834 | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
the-stack_106_28835 | # (c) 2012, Daniel Hokka Zakrisson <daniel@hozac.com>
#
# This file is part of Ansible
#
# Ansible 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 License, or
# (at your option) any lat... |
the-stack_106_28836 | # -*- coding: utf-8 -*-
from __future__ import with_statement
from setuptools import setup, find_packages
import os
import sys
from sphinx_intl import __version__
install_requires = [
'setuptools',
'six',
'polib',
'sphinx',
]
if sys.version_info < (2, 7):
install_requires.append('ordereddict')
... |
the-stack_106_28838 | # -*- coding: utf-8 -*-
"""
DEPRICATE
TODO: Rename to ibeis/init/commands.py
The AID configuration selection is getting a mjor update right now
"""
from __future__ import absolute_import, division, print_function
import utool as ut
import numpy as np # NOQA
import six
from ibeis import params
(print, rrr, profile) =... |
the-stack_106_28840 | #!/usr/bin/env python3
# Copyright (c) 2014-2022 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 rescan behavior of importaddress, importpubkey, importprivkey, and
importmulti RPCs with different... |
the-stack_106_28841 | # Licensed to Modin Development Team under one or more contributor license agreements.
# See the NOTICE file distributed with this work for additional information regarding
# copyright ownership. The Modin Development Team licenses this file to you under the
# Apache License, Version 2.0 (the "License"); you may not u... |
the-stack_106_28844 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
Module that contains locators (transform) data part implementation
"""
from __future__ import print_function, division, absolute_import
import os
import re
import logging
from tpDcc import dcc
from tpDcc.core import dcc as core_dcc
from tpDcc.libs.datalibrary.core ... |
the-stack_106_28849 | # import necessary libraries
import io
import random
import string # to process standard python strings
import warnings
import numpy as np
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.metrics.pairwise import cosine_similarity
import warnings
warnings.filterwarnings('ignore')
i... |
the-stack_106_28851 | # Copyright 2012 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... |
the-stack_106_28852 | # !/usr/bin/env python
# -*- coding:utf-8 -*-
# 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
# https://www.tensorflow.org/get_started/mnist/... |
the-stack_106_28856 | import pytest
from plenum.cli.helper import getClientGrams
from plenum.common.constants import NAME, VERSION, TYPE, KEYS
from plenum.test.cli.helper import assertCliTokens
from plenum.test.cli.test_command_reg_ex import getMatchedVariables
from prompt_toolkit.contrib.regular_languages.compiler import compile
from sovr... |
the-stack_106_28861 | # using https://github.com/RaRe-Technologies/gensim-data
import pandas as pd
import numpy as np
import joblib
import os
label2mid = joblib.load(os.path.join('data','label2mid.joblib'))
def get_manual_bias_labels(biases):
df = pd.read_csv('bias_labels.csv')
biases = [bias if type(bias)==str else bias[0] for b... |
the-stack_106_28863 | """
Line colors with a custom CPT
-----------------------------
The color of the lines made by :meth:`pygmt.Figure.plot` can be set according
to a custom CPT and assigned with the ``pen`` parameter.
The custom CPT can be used by setting the plot command's ``cmap`` parameter to
``True``. The ``zvalue`` parameter sets ... |
the-stack_106_28865 | import os
import time
from jina import DocumentArray, Executor, requests
class TagTextExecutor(Executor):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.pod_uid = os.environ['POD_UID']
@requests
def process(self, docs: DocumentArray, *args, **kwargs):
... |
the-stack_106_28866 | """
Created on Mon Jul 31 07:07:07 2017
@author: Juan Carlos Entizne
@email: e.entizne[at]dundee.ac.uk
"""
import sys
import argparse
from logging import getLogger
from modules import srQC_args as srQC # short-reads Quality-Control (srQC)
description = \
"Description:\n" + \
"RTDmaker is a computational pipe... |
the-stack_106_28867 | import sublime, sublime_plugin
from .simplenote import Simplenote
import functools
import time
import copy
from collections import deque
from os import path, makedirs, remove, listdir
from datetime import datetime
from threading import Semaphore, Lock
from .operations import NoteCreator, MultipleNoteContentDownloader... |
the-stack_106_28868 | #!/usr/bin/env python
#
# Use the raw transactions API to spend bitcoins received on particular addresses,
# and send any change back to that same address.
#
# Example usage:
# spendfrom.py # Lists available funds
# spendfrom.py --from=ADDRESS --to=ADDRESS --amount=11.00
#
# Assumes it will talk to a bitcoind or Bit... |
the-stack_106_28869 | import threading
from .test_utils import skip_unless_module
from pulsar.client import amqp_exchange
TEST_CONNECTION = "memory://test_amqp"
@skip_unless_module("kombu")
def test_amqp():
manager1_exchange = amqp_exchange.PulsarExchange(TEST_CONNECTION, "manager_test")
manager3_exchange = amqp_exchange.PulsarE... |
the-stack_106_28870 | '''
Author: Geeticka Chauhan
Performs pre-processing on a csv file independent of the dataset (once converters have been applied).
Refer to notebooks/Data-Preprocessing for more details. The methods are specifically used in the non
_original notebooks for all datasets.
'''
import os
import pandas as pd
from ast impor... |
the-stack_106_28871 | #!/usr/bin/env python
#
# Stats.py -- Simple statistics class: computes mean, sigma, min, max, rms.
#
# Author: Brian Wilson
# @(#) Stats.py 1.0 2003/11/24
#
# Implemented by saving five accumulators:
# no of points, mean, sum of squares of diffs from mean, min, and max.
# Methods:
# add -- add a dat... |
the-stack_106_28873 | from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, VARCHAR, Text
from sqlalchemy.exc import StatementError
import sys
Base = declarative_base()
class Recipe(Base):
__tablename__ = "recipe"
id = Column(Integer, primary_key=True)
name = Column(VARCHAR(), null... |
the-stack_106_28874 | import time
from rauth import OAuth1Session
from st2common.util import isotime
from st2reactor.sensor.base import PollingSensor
__all__ = [
'CubeSensorsMeasurementsSensor'
]
BASE_URL = 'https://api.cubesensors.com/v1'
FIELD_CONVERT_FUNCS = {
'temp': lambda value: (float(value) / 100)
}
class CubeSensorsMe... |
the-stack_106_28875 | import click
import wandb
import torch
import torch.nn as nn
import torch.optim as optim
import torchvision
import torchvision.datasets as datasets
from torch.utils.data import DataLoader
import torchvision.transforms as transforms
from PIL import Image
import PIL
import os
from numpy import random
import numpy as np... |
the-stack_106_28876 | from django.urls import path
from django.views.decorators.cache import cache_page
from django.views.generic import TemplateView
from ovu.core.views import home_view, about_us_view, componentes_list_view, componente_detail, \
dato_create_view, indicador_modal_detail_view, indicador_tabla_porcentual, informe_vi... |
the-stack_106_28877 | """
Implementation of the FFTlog algorithm, very much inspired by mcfit (https://github.com/eelregit/mcfit) and implementation in
https://github.com/sfschen/velocileptors/blob/master/velocileptors/Utils/spherical_bessel_transform_fftw.py
"""
import os
import numpy as np
from scipy.special import gamma, loggamma
cl... |
the-stack_106_28880 | import os
import shutil
import pytest
from ramp_database.model import Model
from ramp_database.testing import add_users
from ramp_database.tools.team import sign_up_team
from ramp_database.tools.submission import get_submissions
from ramp_database.tools.submission import submit_starting_kits
from ramp_database.utils ... |
the-stack_106_28881 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
the-stack_106_28883 | """
Validate and clean request parameters for our endpoints using Django forms
"""
from datetime import MAXYEAR
from functools import reduce
from django import forms
from django.conf import settings
from django.utils.translation import get_language
import arrow
from .defaults import QUERY_ANALYZERS, RELATED_CONTENT_... |
the-stack_106_28884 | import random
import time
import warnings
import sys
import argparse
import shutil
import os.path as osp
import torch
import torch.nn as nn
import torch.backends.cudnn as cudnn
from torch.optim import SGD
from torch.optim.lr_scheduler import LambdaLR
from torch.utils.data import DataLoader
import torchvision.transform... |
the-stack_106_28885 | import logging as log
import yaml
import os
import cv2 as cv
import json
import sys
import time
# application parameters
app_name = ""
app_version = "0.0.0"
matcher_directory = "repo"
matcher_tolerance = 0.6
extraction_layers = []
haarcascade_face_cascade = cv.CascadeClassifier()
haarcascade_eyes_cascade = cv.CascadeC... |
the-stack_106_28886 | # Copyright 2020 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
the-stack_106_28888 | import os
from flask import Flask, render_template, request
from pycardano import (
Address,
Asset,
BlockFrostChainContext,
MultiAsset,
Network,
Transaction,
TransactionBuilder,
TransactionOutput,
TransactionWitnessSet,
Value,
)
app = Flask(__name__)
block_forst_project_id = ... |
the-stack_106_28889 | """
Work with *.cab files
"""
from ctypes import pythonapi
from ctypes import cdll
from ctypes import cast
import ctypes as _ctypes
libc = cdll[_ctypes.util.find_library('c')]
libcab = cdll[_ctypes.util.find_library('cabinet')]
PyMem_Malloc = pythonapi.PyMem_Malloc
PyMem_Malloc.restype = _ctypes.c_size_t
PyMem_Malloc... |
the-stack_106_28890 | # -*- 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_28891 | errors = {
"profile_missing": {"errors": "profile with this username does not exist",
"status": 404},
"bad_image": {"errors": "Ensure that the file is an image",
"status": 400},
"follow_exists": {"errors": "You already follow this user",
"statu... |
the-stack_106_28892 | #!/share/software/user/open/python/3.6.1/bin/python3
from src.ModelDriver import *
## MODIFY THESE PARAMS FOR SPECIFIC RUN ###
X_train = "/oak/stanford/groups/aboettig/Aparna/NNreviews/TestRobustness/jitterData/train_5.23.18_JitterRad-20.0_jitterPerc-0.25_xyz.txt"
Y_train = "/oak/stanford/groups/aboettig/Aparna/NNproj... |
the-stack_106_28893 | import collections
import time
import numpy as np
# from forceDAQ.force import *
from .force import *
_ForceSensorSetting = collections.namedtuple('ForceSensorSetting',
'device_name_prefix device_ids sensor_names remote_control '
'ask_filename calibration_folder '
' zip_data write_Fx wr... |
the-stack_106_28895 | from IPython.display import display, Markdown, HTML
import ipywidgets as widgets
from os import listdir, path
from .bank import Bank
import io
from contextlib import redirect_stdout
from . import VERSION
from html import escape as escape_html
def run(bank=None):
if bank is None:
bank = Bank()
menu_drop... |
the-stack_106_28896 | """
Train the model on RANDOM DATA
Reference : Barnes et al. [2020, JAMES]
Author : Zachary M. Labe
Date : 19 October 2020
"""
### Import packages
import math
import time
import matplotlib.pyplot as plt
import numpy as np
import keras.backend as K
from keras.layers import Dense, Activation
from keras import ... |
the-stack_106_28897 | import numpy as np
import pandas as pd
from scipy import integrate
import matplotlib.pyplot as plt
class Model(list):
"""
The model class is central. It inherits from a list. Reactions are appended to this list to build the model.
Upon creating a new object logging can be turned off by passing in logging... |
the-stack_106_28899 | #
# MIT License
#
# Copyright (c) 2020 - Present Aaron Ma,
# Copyright (c) 2018 - 2020 Udacity, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without l... |
the-stack_106_28900 | import time
import logging
import ipc.enums
# from pebl.robots.pebl import memory as mem # NOTE disabled because this relies on a closed source library
log = logging.getLogger(__name__)
class TimedLoop(object):
"""
Decorator class to run a function repeatedly with some specified period.
Use:
- write... |
the-stack_106_28904 | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a cop... |
the-stack_106_28905 | """cli.py - Command line argument parser.
"""
import sys
import errno
import os
import argparse
import logging
import tempfile
import json
import time
from j2lint import NAME, VERSION, DESCRIPTION
from j2lint.linter.collection import RulesCollection
from j2lint.linter.runner import Runner
from j2lint.utils import get_f... |
the-stack_106_28908 | from dataclasses import dataclass, field
from typing import List, Optional
from output.models.ms_data.particles.particles_q030_xsd.particles_q030_imp import E2 as ParticlesQ030ImpE2
from output.models.ms_data.particles.particles_q030_xsd.particles_q030_imp2 import E2
__NAMESPACE__ = "http://xsdtesting"
@dataclass
cl... |
the-stack_106_28910 | # -*- coding: utf-8 -*-
#
# Copyright (C) 2010-2016 PPMessage.
# Guijin Ding, dingguijin@gmail.com
#
#
from .basehandler import BaseHandler
from ppmessage.api.error import API_ERR
from ppmessage.core.constant import API_LEVEL
from ppmessage.db.models import PredefinedScript
from ppmessage.db.models import Predefined... |
the-stack_106_28916 | import logging
import re
import threading
import time
from bot import download_dict, download_dict_lock
LOGGER = logging.getLogger(__name__)
URL_REGEX = r"(?:(?:https?|ftp):\/\/)?[\w/\-?=%.]+\.[\w/\-?=%.]+"
SIZE_UNITS = ['B', 'KB', 'MB', 'GB', 'TB', 'PB']
class setInterval:
def __init__(self, interval, action... |
the-stack_106_28918 | # -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ----------------------------------------------------... |
the-stack_106_28920 | import adv_test
import adv
from adv import *
def module():
return Fritz
class Fritz(adv.Adv):
def prerun(this):
this.stance = 0
this.s2fscharge = 0
def s2_proc(this, e):
this.s2fscharge = 3
def fs_proc(this, e):
if this.s2fscharge > 0:
this.s2fscharge -= ... |
the-stack_106_28921 | from copy import deepcopy
from datetime import datetime
from datetime import timezone
from email.utils import mktime_tz
from email.utils import parsedate_tz
from io import BytesIO
from itertools import chain
from mimetypes import guess_type
from typing import Callable
from typing import Iterable
from typing import List... |
the-stack_106_28923 | # -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# ... |
the-stack_106_28924 | from .base import AkiObject
from ..data.company import Company
from typing import NamedTuple
from decimal import Decimal
class AkiCompany(AkiObject):
__tuple: Company = None
def __init__(self, company_tuple: NamedTuple):
self.__original = company_tuple
cnpj_basico = getattr(company_tuple, "c... |
the-stack_106_28925 | import io
import time
import picamera
import picamera.array
import cv2
from keras.applications.resnet50 import ResNet50
from keras.preprocessing.image import array_to_img
from keras.applications.resnet50 import preprocess_input, decode_predictions
import numpy as np
t1= time.clock()
model = ResNet50(weights='imagenet'... |
the-stack_106_28927 | import _plotly_utils.basevalidators
class ColorsrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(
self,
plotly_name='colorsrc',
parent_name='contour.hoverlabel.font',
**kwargs
):
super(ColorsrcValidator, self).__init__(
plotly_name=plotl... |
the-stack_106_28928 | r"""
Implements the a multivariate Gaussian approximation to a uniform simplex
distribution.
The expected values may be computed explicitly for this distribution.
"""
import numpy as np
from smm.rvs.normalrv import NormalRV
from smm.rvs.basesimplexrv import BaseSimplexRV
from scipy.linalg import eigh
class NormalSi... |
the-stack_106_28929 |
import sys
from os.path import join as path_join
from os.path import dirname
from sys import path as sys_path
# assume script in brat tools/ directory, extend path to find sentencesplit.py
sys_path.append(path_join(dirname(__file__), '.'))
sys.path.append('.')
import torch
import argparse
import numpy as np
from fe... |
the-stack_106_28930 | import unittest
from pathlib import Path
from filecmp import cmp
from striprtf.striprtf import rtf_to_text
RTF_DIR = Path.cwd() / 'tests' / 'rtf'
TEXT_DIR = Path.cwd() / 'tests' / 'text'
class TestSimple(unittest.TestCase):
def test_sample(self):
example_rtf = RTF_DIR / 'sample_3.rtf'
example_tx... |
the-stack_106_28932 | import datetime
import pandas as pd
import numpy as np
from lifetimes.utils import summary_data_from_transaction_data
df_columns = pd.read_table('../data/db_dict.txt')
def txt_to_df(directory):
headers = df_columns['field'][df_columns['table'] == 'atk_transaction'].tolist()
df = pd.read_table(directory, hea... |
the-stack_106_28933 | # -*- mode: python; coding: utf-8 -*-
# Copyright 2019 the .Net Foundation
# Distributed under the terms of the revised (3-clause) BSD license.
"""Note! This test suite will hit the network!
"""
import pytest
from xml.etree import ElementTree
from .. import Client
INF = float('inf')
NAN = float('nan')
def _assert... |
the-stack_106_28934 | #!/usr/bin/env python
# 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
# "Li... |
the-stack_106_28935 | """
Inline Bayesian Linear Regression
---------------------------------
Figure 8.1
An example showing the online nature of Bayesian regression. The upper panel
shows the four points used in regression, drawn from the line
y = theta_1 x + theta_0 with theta_1 = 1 and theta_0 = 0. The lower panel shows
the posterior pdf... |
the-stack_106_28936 | from sys import stderr
from numpy.core.fromnumeric import std
from numpy.lib.utils import source
from pcbnewTransition import pcbnew, isV6
from kikit.panelize_ui_impl import loadPresetChain, obtainPreset
from kikit import panelize_ui
from kikit.panelize import appendItem
from kikit.common import PKG_BASE
import kikit.p... |
the-stack_106_28937 | import numpy as np
from growth_procs import direction_to,\
normalize_length,\
get_entity,\
prepare_next_front
L_NORM=3.0
def extend_front(front,seed,constellation) :
# attract by a different neuron, get information
other_entities = get_entity("cell_type_2",constellation)
if not len(other_e... |
the-stack_106_28938 | #!/usr/bin/env python
import base_filters
COPY_GOOGLE_DOC_KEY = '1KMoI6pkllZPbHV--HvMa3BgxNgrO8bVgQKCfWwJ3FuA'
USE_ASSETS = False
# Use these variables to override the default cache timeouts for this graphic
# DEFAULT_MAX_AGE = 20
# ASSETS_MAX_AGE = 300
JINJA_FILTER_FUNCTIONS = base_filters.FILTERS
|
the-stack_106_28940 | # Copyright 2020 (c) Cognizant Digital Business, Evolutionary AI. All rights reserved. Issued under the Apache 2.0 License.
import os
import argparse
import numpy as np
import pandas as pd
from copy import deepcopy
import neat
# Path to file containing neat prescriptors. Here we simply use a
# recent checkpoint of ... |
the-stack_106_28941 | from notest.notest_lib import notest_run
import logging
logging.basicConfig(level=logging.INFO)
args = {
# 'config_file': '../examples/config.json',
# 'default_base_url': None,
'override_config_variable_binds': {
'title': 'GodQ-override'
},
# 'ext_dir': None,
'loop_interval': 1,
# ... |
the-stack_106_28942 | # Copyright 2022 The Sigstore Authors
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... |
the-stack_106_28947 | # -*- coding: utf-8 -*-
"""
Testing phrasedml.
"""
from __future__ import print_function
import tellurium as te
ant = '''
model myModel
S1 -> S2; k1*S1
S1 = 10; S2 = 0
k1 = 1
end
'''
phrasedml = '''
model1 = model "myModel"
sim1 = simulate uniform(0, 5, 100)
task1 = run sim1 on model1
plot "Figure 1" ti... |
the-stack_106_28948 | from PIL import Image, ImageColor
import numpy as np
import matplotlib.pyplot as plt
from opensimplex import OpenSimplex
import skimage.transform as tf
class ImageMap:
def __init__(self, in_map, mapping=None):
if not isinstance(in_map, np.ndarray):
in_map = plt.imread(in_map)[:, :, :3] # RGBA... |
the-stack_106_28951 | # Copyright 2020 The KNIX Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... |
the-stack_106_28952 | from __future__ import print_function, absolute_import, division
import sys
import inspect
import socket
import numpy as np
from sklearn.utils import check_random_state
from sklearn.model_selection import ParameterGrid
import math
try:
from hyperopt import (Trials, tpe, fmin, STATUS_OK, STATUS_RUNNING,
... |
the-stack_106_28955 | from django.utils import timezone
from digitalsky_provider.models import DigitalSkyLog
from gcs_operations.models import FlightPlan, FlightOperation, Transaction, FlightPermission, FlightLog
from pki_framework.models import AerobridgeCredential
from registry.models import Person, Address, Activity, Authorization, Oper... |
the-stack_106_28956 | """
Dueling Double DQN
Zhiang Chen, Jan 3 2018
MIT License
"""
import tensorflow as tf
import numpy as np
class Dueling_DDQN(object):
def __init__(self,
n_action,
n_feature,
learning_rate,
batch_size,
gamma,
e_gr... |
the-stack_106_28958 | import cv2 as cv
from configparser import ConfigParser
from utils.capture_stream import CaptureStream
from utils.bounding_box import BoundingBox
# Detect objects from a live camera feed
def main():
# create parser instance
config = ConfigParser()
# Read detection.cfg
config.read('config/detection.cfg'... |
the-stack_106_28959 | from flask import Blueprint, jsonify, request
from flask_cors import cross_origin
from server import aql
info_bp = Blueprint("info_bp", __name__)
@info_bp.route("/info/image")
@cross_origin()
def fetch_image():
img_id = request.args.get("id")
if img_id and img_id.isdigit():
data = aql.fetch_image_in... |
the-stack_106_28962 | from algoritmia.datastructures.digraphs import UndirectedGraph
from algoritmia.datastructures.mergefindsets import MergeFindSet
from algoritmia.datastructures.queues import Fifo
from random import shuffle
from victor.lab3._aux.labyrinthviewer import LabyrinthViewer
def create_labyrinth(rows, cols, n=0):
# for i in... |
the-stack_106_28963 | #!usr/bin/env python
#-*- coding:utf-8 _*-
"""
@version:
author:Sleepy
@time: 2019/02/02
@file: DataTable.py
@function:
@modify:
"""
from os import sys, path
root_path = path.dirname(path.dirname(path.abspath(__file__)))
from Utiltity.common import *
from Database.SqlRw import SqlAccess
class AliasTable:
"""
... |
the-stack_106_28970 | import functools
import re
from itertools import chain
from django.conf import settings
from django.db import models
from django.db.migrations import operations
from django.db.migrations.migration import Migration
from django.db.migrations.operations.models import AlterModelOptions
from django.db.migrations.optimizer ... |
the-stack_106_28971 | # coding: utf-8
"""
Copyright 2018 OSIsoft, 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 o... |
the-stack_106_28972 | import os
#os.environ['CUDA_VISIBLE_DEVICES'] = '0'
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
import sys
sys.path.append("..")
import tensorflow as tf
import tensorflow_probability as tfp
import tensorflow.python.keras.backend as K
import numpy as np
import sympy as sp
import time
import math
import argparse
import ML... |
the-stack_106_28973 | # type: ignore
import cflearn
from cflearn.misc.toolkit import check_is_ci
is_ci = check_is_ci()
num_classes = 10
data = cflearn.cv.MNISTData(batch_size=4 if is_ci else 64, transform="for_generation")
m = cflearn.api.vanilla_vae_gray(
28,
model_config={"num_classes": num_classes},
debug=is_ci,
)
m.fit... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.