text stringlengths 957 885k |
|---|
from datetime import datetime, timedelta
from critiquebrainz.data.testing import DataTestCase
import critiquebrainz.db.oauth_token as db_oauth_token
import critiquebrainz.db.oauth_client as db_oauth_client
import critiquebrainz.db.users as db_users
import critiquebrainz.db.exceptions as db_exceptions
from critiquebrain... |
#!/usr/bin/env python
"""Provide a command line tool to validate and transform tabular samplesheets."""
import os
import sys
import errno
import argparse
import pandas as pd
def parse_args(args=None):
Description = "Reformat nf-core/metapep samplesheet file and check its contents."
Epilog = "Example usage:... |
<reponame>wis-software/rocketchat-tests-based-on-splinter
from argparse import ArgumentParser
from sys import stderr
from time import sleep
from rocketchat_API.rocketchat import RocketChat
from base import SplinterTestCase
LOCALHOST = 'http://127.0.0.1:8006'
class SplinterWizardInit(SplinterTestCase):
def __i... |
import traceback
import ujson as json
from insanic import __version__
from insanic.conf import settings
from insanic.request import Request
from sanic.response import BaseHTTPResponse
from incendiary.xray.utils import abbreviate_for_xray, get_safe_dict
from aws_xray_sdk.core.models import http
from aws_xray_sdk.ext.... |
<reponame>kistlin/xknx
"""Unit test for Sensor objects."""
from unittest.mock import AsyncMock
import pytest
from xknx import XKNX
from xknx.devices import Sensor
from xknx.dpt import DPTArray
from xknx.telegram import GroupAddress, Telegram
from xknx.telegram.apci import GroupValueRead, GroupValueResponse, GroupValu... |
<filename>emout/plot/basic_plot.py
import copy
import emout.utils as utils
import matplotlib
import matplotlib.cm as cm
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.colors import Colormap
import matplotlib.colors as mcolors
_r = 0.98
_d = 0.5
mycmap = mcolors.LinearSegmentedColormap('gray-jet', ... |
<filename>app/nanoleaf/state.py
import colorsys
import re
from app.nanoleaf.model import AuroraObject
from app.nanoleaf.exceptions import BadRequestException
class State(AuroraObject):
def __init__(self, requester):
super().__init__(requester)
@property
def color_mode(self):
"""Returns ... |
"""Routines to generate spatial and temporal partitions."""
import numpy as np
from attr import dataclass, field
__all__ = [
"Mesh",
"MeshArrays",
"MeshPartitions",
"Partition",
"TimePartition",
]
@dataclass(frozen=True)
class Partition:
"""Construct a spatial partition.
:param float lo... |
<gh_stars>1-10
import locale
import logging
from subprocess import Popen, PIPE, CalledProcessError
from collections import UserDict
import rebuild_tool.exceptions as ex
from rebuild_tool.pkg_source import PkgSrcArchive, set_class_attrs
from rebuild_tool.utils import subprocess_popen_call, ChangeDir
logger = logging.g... |
# Copyright 2009-2017 <NAME>.
# This program is distributed under the MIT license.
'''Defines several functions that may be useful when working with dicts.'''
from __future__ import generator_stop
import collections
from python_toolbox import cute_iter_tools
from python_toolbox import comparison_tools
def filter_... |
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.init as init
class View(nn.Module):
def __init__(self, size):
super(View, self).__init__()
self.size = size
def forward(self, tensor):
return tensor.view(self.size)
class VAE(nn.Module):
"""Encode... |
<reponame>jrp55/smash
import argparse
import sys
import os
import os.path
import requests
import json
from flask import Flask, request, render_template, abort
from werkzeug import secure_filename
ALLOWED_IMG_EXTENSIONS = set(['tiff', 'jpg', 'jpeg', 'png', 'gif', 'bmp', 'ico', 'pbm', 'pgm', 'ppm'])
UPLOAD_FOLDER = '/tm... |
import h5py
import json
import gzip
layer_name_dict = {
'Merge': 'mergeLayer',
'Dense': 'denseLayer',
'Dropout': 'dropoutLayer',
'Flatten': 'flattenLayer',
'Embedding': 'embeddingLayer',
'BatchNormalization': 'batchNormalizationLayer',
'LeakyReLU': 'leakyReLULayer',
'PReLU': 'parametric... |
# -*- coding: utf-8 -*-
# Copyright (c), 2011, the txyoga authors. See the LICENSE file for details.
"""
Serializable REST errors.
"""
from zope.interface import implements
from twisted.web import http, resource
from txyoga import interface
class RESTErrorPage(resource.Resource):
"""
An alternative to C{Err... |
import pymel.core as pm
import os
import System.blueprint as blueprint
import System.utils as utils
#reload(blueprint)
reload(utils)
CLASS_NAME = "HingeJoint"
TITLE = "Hinge Joint"
DESCRIPTION = "Creates 3 joints (the middle joint acting as a hinge joint). Ideal use: arm/leg"
ICON = "%s/Icons/_hinge.png" %os.environ[... |
<gh_stars>0
#!/bin/env python
"""
Acquire a series of images using the XPP Rayonix detector with the
LCLS data acquisition system and a server running on a "mond" node
Setup:
source ~schotte/Software/Lauecollect/setup_env.sh
DAQ Control: check Sync Sequence 3 - Target State: Allocate
(if grayed out: daq.diconnect())... |
import numpy as np
"""
basic implementation of Recurrent Neural Networks from scrach
to train model to learn to add any number pair when given in binary arrayed format
devloper--><NAME>
"""
class RecurrentNeuralNetwork:
def __init__(self,hidden_size=10):
"""hidden_size is number of neurons ... |
from param import Param
import tensorflow as tf
from gpflow import transforms
float_type = tf.float64
jitter_level = 1e-6
class Kernel:
def __init__(self,sf0,ell0,name="kernel",learning_rate=0.01,
summ=False,fix_sf=False,fix_ell=False):
with tf.name_scope(name):
sf = Param(sf... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from CTFd.models import Teams, Users
from CTFd.utils import set_config
from tests.helpers import (
create_ctfd,
destroy_ctfd,
login_as_user,
login_with_mlc,
register_user,
)
def test_oauth_not_configured():
"""Test that OAuth redirection fails if ... |
import io
import logging
import os
import tempfile
import pyfuse3
from aiofile import AIOFile, Reader
log = logging.getLogger(__name__)
def flags_can_write(flags):
if flags & 0x03 == os.O_RDWR:
return True
if flags & 0x03 == os.O_WRONLY:
return True
return False
class BaseFileContext:
... |
<reponame>markstor/trimesh
import io
import copy
import uuid
import numpy as np
from .. import util
from .. import visual
from ..constants import log
def load_collada(file_obj, resolver=None, **kwargs):
"""
Load a COLLADA (.dae) file into a list of trimesh kwargs.
Parameters
----------
file_ob... |
"""
ReBATE was primarily developed at the University of Pennsylvania by:
- <NAME> (<EMAIL>)
- <NAME> (<EMAIL>)
- <NAME> (<EMAIL>)
- and many more generous open source contributors
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation... |
import warnings
from typing import Optional, Tuple, Any, Literal
from pandas.core.dtypes.common import is_numeric_dtype
from statsmodels.api import stats
from statsmodels.formula.api import ols
import numpy as np
import pandas as pd
import scipy.stats as sp
import seaborn as sns
import matplotlib.pyplot as plt
__all_... |
<gh_stars>0
"""
implementation of the MNIST/Fashion MNIST database
"""
import os
import numpy as np
import gzip
import urllib.request
import tensorflow as tf
from tensorflow.python.platform import gfile # pylint: disable=E0611
DEFAULT_SOURCE_URL = 'https://storage.googleapis.com/cvdf-datasets/mnist/'
# For Fash... |
<reponame>jaraco/pycoreutils
import os
import sys
import zipfile
from .. import exception
def parseargs(p):
"""
Add arguments and `func` to `p`.
:param p: ArgumentParser
:return: ArgumentParser
"""
p.set_defaults(func=func)
p.description = "package and compress (archive) files"
p.us... |
# -*- coding: utf-8 -*-
def gldas_variables():
return [('Air Temperature', 'Tair_f_inst'),
('Canopy Water Amount', 'CanopInt_inst'),
('Downward Heat Flux In Soil', 'Qg_tavg'),
('Evaporation Flux From Canopy', 'ECanop_tavg'),
('Evaporation Flux From Soil', 'ESoil_tav... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# LICENSE
#
# Copyright (C) 2010-2018 GEM Foundation, <NAME>, <NAME>,
# <NAME>.
#
# The Hazard Modeller's Toolkit is free software: you can redistribute
# it and/or modify it under the terms of the GNU Affero General Public
# L... |
<gh_stars>0
import json
import cachetools
from botocore.client import Config
from botocore.exceptions import ClientError
from s1crets.core import DictQuery
from s1crets.providers.base import BaseProvider, DefaultValue, args_cache_key
from s1crets.providers.aws.base import ServiceWrapper
@cachetools.cached(cache={}, k... |
__author__ = 'jfb_000'
from AddressBook import Book
def testbook(bookobj, firstname=None, lastname=None, phonenumber=None, emailaddress=None, street=None, city=None,
state=None, country=None):
print("----------------TEST-------------------")
# create book
print("This is " + bookobj.owner... |
import jinja2
page = {}
page['title'] = 'Shkola'
page['item_path'] = '../src/'
page['google_signin_client_id'] = ""
page['google_site_verification'] = ""
page['exit'] = "EXIT"
page["debug_checkall"] = True
page["user_picture"] = "https://lh5.googleusercontent.com/-3VJ2UlD0Y3U/AAAAAAAAAAI/AAAAAAAAAAA/AMZuucnCsCk0v... |
import pronouncing
import pyphen
from num2words import num2words as n2w
from syllables import estimate
from lib.constants import (
BANNED_WORDS,
BANNED_PHRASES,
CHARS_ONLY,
PRONUNCIATION_OVERRIDES,
LICK_STRESSES,
LICK_NOTES
)
dic = pyphen.Pyphen(lang="en_UK")
def isLick(title: str):
"""
... |
# Copyright 2013 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.
{
'variables': {
'chromium_code': 1,
},
'targets': [
{
# GN version: //ui/wm
'target_name': 'wm',
'type': '<(component)',
... |
# -*- coding: utf-8 -*-
# Import Python libs
from __future__ import absolute_import
# Import Salt Libs
from salt.modules import win_dism as dism
# Import Salt Testing Libs
from salttesting import TestCase
from salttesting.helpers import ensure_in_syspath
from salttesting.mock import (
MagicMock,
patch
)
ens... |
<filename>scripts/apply_def_template.py
#!/usr/bin/env python3
# Copyright 2020 Efabless 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/LI... |
from typing import Callable, Iterable, List, Tuple, Optional, Any, Dict, Hashable
import logging
from multiprocessing import TimeoutError
import os
import time
import collections
import threading
import queue
import copy
import gc
import sys
import itertools
try:
from joblib.parallel import BatchedCalls, parallel_... |
<reponame>SeitaroShinagawa/ClipBERT
from torch.optim import Adam, Adamax, SGD
from src.optimization.adamw import AdamW
def setup_optimizer(model, opts, model_type="transformer"):
"""model_type: str, one of [transformer, cnn]"""
if model_type == "transformer":
param_optimizer = list(model.named_parame... |
from torch.utils.data import Dataset
import numpy as np
import matplotlib.pyplot as plt
import utils.forward_kinematics as fk
import torch
import utils.data_utils as data_utils
import os
import pickle as pkl
class H36motion(Dataset):
def __init__(self, path_to_data, actions, input_n=10, output_n=10, dct_n=20, spl... |
<reponame>corbanvilla/AlHosLetMeIn
import cv2
import numpy as np
import queue
import asyncio
import time
import findfaces
import face_recognition
from findfaces import FaceBox
from aiortc import VideoStreamTrack
from av import VideoFrame
from loguru import logger as log
from database.database import SessionLocal, en... |
from __future__ import absolute_import, division, print_function
from .timeline.models import TimeLine
from .timeline.processing import derivative_filtered
import matplotlib
import numpy as np
from matplotlib import pyplot as plt
matplotlib.use("agg")
import matplotlib.pyplot as plt
import matplotlib.gridspec as grids... |
from django import forms
from .models import Team, Tournament, Match, Score
from player.models import Player
from performance.models import BattingInnings, BowlingInnings
class TeamCreationForm(forms.ModelForm):
logo = forms.ImageField(required=False)
class Meta:
model = Team
fields = [
... |
import time
import http.client
from SidebarPage import SidebarPage
class TestIMS(SidebarPage):
def cornerTitle(self):
return 'Testing'
def error(self, msg):
self.write(f'<p style="color:red">{self.htmlEncode(msg)}</p>')
def writeMsg(self, msg):
self.write(f'<p>{self.htmlEncode(... |
# Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License.
# A copy of the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "LICENSE.txt" file acc... |
# -*- coding: utf-8 -*-
"""Views for anything that relates to adminstration of members.
Login and logout stays in SVPB
"""
import os
from django.contrib.auth.decorators import user_passes_test
from django.core.management import call_command
from django.core.urlresolvers import reverse_lazy
from django.utils.decorat... |
<reponame>affinis-lab/car-detection-module
import cv2
from keras.callbacks import ModelCheckpoint
from keras.models import Model
from keras.layers import Input, Flatten, Dense, Reshape, Lambda
from keras.layers import Conv2D, BatchNormalization, LeakyReLU, MaxPooling2D, Dropout, Activation, \
GlobalAveragePooling2D... |
from __future__ import absolute_import
from __future__ import unicode_literals
import os
from datetime import datetime
from django.test import SimpleTestCase
from corehq.apps.app_manager.tests.util import TestXmlMixin
from corehq.form_processor.interfaces.processor import FormProcessorInterface
from corehq.form_proc... |
<reponame>briis/pysecspy<filename>pysecspy/secspy_data.py
"""SecuritySpy Data."""
import datetime
import json
import logging
import time
from collections import OrderedDict
_LOGGER = logging.getLogger(__name__)
CAMERA_KEYS = {
"state",
"recordingSettings_A",
"recordingSettings_C",
"recordingSettings_M... |
import pytz
from bs4 import BeautifulSoup
from datetime import datetime
import requests
import os
from github import Github
# local import
from dotenv import load_dotenv
def get_github_repo(access_token, repo_name):
"""
get github repository info
:param access_token: Personal Access Token from Github
... |
<reponame>theshiv303/kegbot-server
from builtins import str
from builtins import object
from pykeg.backend import get_kegbot_backend
from pykeg.core import models
from pykeg import config
from pykeg.core.util import get_version_object
from pykeg.core.util import set_current_request
from pykeg.core.util import must_upgr... |
import thorpy
import parameters
def make_alert(title, text, font_size=None, font_color=None, ok_text="Ok"):
from thorpy.miscgui.launchers.launcher import make_ok_box
e_title = thorpy.make_text(title, thorpy.style.TITLE_FONT_SIZE, (255,0,0))
e_text = thorpy.make_text(text, font_size, font_color)
box = m... |
<gh_stars>0
'''
'''
# 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
# ... |
<filename>fish/fishbase.py
import os
import types
UNIX_CREDENTIALS_FILE = u'.fluidDBcredentials'
UNIX_USER_CREDENTIALS_FILE = u'.fluidDBcredentials.%s'
CRED_FILE_VAR = 'FISH_CREDENTIALS_FILE'
WIN_CRED_FILE = 'c:\\fish\\credentials.txt'
TEXTUAL_MIMES = {
'txt': None,
'csv': 'text/plain',
'html': 'text/htm... |
import numpy as np
import os
from PIL import Image
from skimage.measure import compare_ssim
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
import tqdm
import scipy.misc
def crop(im, height=64, width=64, stride=1):
img_height = im.shape[0]
img_width = im.shape[1]
ssim = []
for ... |
from abc import ABCMeta, abstractmethod
from monitor import HANAServerDBOperatorService
from monitor import HANAServerOSOperatorService
from util import MonitorUtility
from util import MonitorConst as Mc
import traceback
class MonitorInitializer:
"""The root Class for the Initializer
initialize -- perf... |
import warnings
import copy
import math as m
import numpy as nu
from scipy import integrate, optimize
import scipy
if int(scipy.__version__.split('.')[1]) < 10: #pragma: no cover
from scipy.maxentropy import logsumexp
else:
from scipy.misc import logsumexp
from galpy.potential_src.Potential import evaluateRforc... |
<reponame>itsmesatwik/pants
"""Install next gen sequencing analysis tools not currently packaged.
"""
import os
from fabric.api import *
from fabric.contrib.files import *
from shared import (_if_not_installed, _make_tmp_dir,
_get_install, _get_install_local, _make_copy, _configure_make,
... |
<reponame>Reiningecho90/Raspberry-Pi-0W-Rocket-Project<filename>Launch.py
# Imports
from datetime import datetime
import smbus
import math
import time
import sys
import pandas as pd
import RPi.GPIO as GPIO
# GPIO initialization
GPIO.setmode(GPIO.BOARD)
GPIO.setup(18, GPIO.OUT)
pwm = GPIO.PWM(18, 100)
pwm.start(0)
... |
<filename>openrave/docs/breathe/__init__.py
from docutils import nodes
from docutils.parsers.rst.directives import unchanged_required
import os
import sys
import copy
from docutils.parsers import rst
from breathe.builder import RstBuilder, BuilderFactory
from breathe.finder import FinderFactory, NoMatchesError, Mult... |
# ____ ____
# / /\/ /
# /___/ \ / Copyright (c) 2021, Xilinx®.
# \ \ \/ Author: <NAME> <<EMAIL>>
# \ \
# / /
# /___/ /\
# \ \ / \
# \___\/\___\
#
# Licensed under the Apache License, Version 2.0
#
import os
import sys
from colcon_core.plugin_system import satisfies_version
from... |
import os
import json
import time
import torch
from nas_201_api import NASBench201API as API
from xautodl.models import get_cell_based_tiny_net
from fvcore.nn import FlopCountAnalysis, parameter_count
from matrix_transform import build_matrix
NODE_TYPE_DICT = {
"none": 0,
"skip_connect": 1,
"nor_conv_1x1... |
import concurrent.futures
import logging
import time
import traceback
from pybatfish.exception import BatfishException
from concurrent.futures import TimeoutError
from timeit import default_timer as timer
from RouterConfiguration import router_configurator
import rt_comparator
from GNS3 import gns3_interface
from se... |
<filename>example/vedio_scripts/game.py
import pygame as pg
import gym_gvgai as gvg
class Game:
def __init__(self, game, lvl):
self.env = gvg.make('gvgai-' + game + '-' + lvl + '-v0')
self.stateObs = self.env.reset()
size = (len(self.stateObs), len(self.stateObs[0]))
self.... |
<reponame>NKI-AI/direct<filename>direct/train.py
# coding=utf-8
# Copyright (c) DIRECT Contributors
import argparse
import functools
import logging
import os
import pathlib
import sys
import urllib.parse
from collections import defaultdict
from typing import Callable, Dict, List, Optional, Union
import numpy as np
imp... |
<reponame>olivier-nexmo/py-nexmo-rent_numbers
############################################################
##### Title: Search Owned Numbers #####
##### Author: <NAME> #####
##### Date: 09 May 2018 ... |
<reponame>topblue/RootTheBox
# -*- coding: utf-8 -*-
'''
Created on Mar 13, 2012
@author: moloch
Copyright 2012 Root the Box
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
... |
<reponame>AdamPrzybyla/Impansible
from distutils.core import setup
setup(
name = 'robotframework-impansible',
packages = ['Impansible'],
version = '0.11',
license='MIT',
description = 'Robotframework library to access all ansible internal modules.',
long_description='''Impansible
===============
.. content... |
# -*- coding:utf-8 -*-
import collections
import math
import numpy as np
import os
import random
import tensorflow as tf
import zipfile
from scipy.sparse import lil_matrix
os.environ["CUDA_VISIBLE_DEVICES"] = "1"
config = tf.ConfigProto()
config.gpu_options.per_process_gpu_memory_fraction = 0.5
session = tf.Session(c... |
from collections import OrderedDict
from django.conf import settings
from settings.config import Config
from utility.filesystem import load_yaml, save_yaml, remove_dir, remove_file
from utility.data import Collection, sorted_keys
from utility.time import Time
import os
import threading
import copy
class Environment... |
#
# Copyright (c) 2019, Infosys Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... |
<reponame>HyechurnJang/archon<filename>application/asa/manager.py
# -*- coding: utf-8 -*-
################################################################################
# _____ _ _____ _ #
# / ____(_) / ____| | | ... |
<filename>surpyval/tests/test_real_data.py
import pytest
import numpy as np
import lifelines
import surpyval as surv
from collections import namedtuple
from lifelines.datasets import *
from reliability.Fitters import *
# Datasets in x, c, n: as namedtuples
SurvivalData = namedtuple('SurvivalData', ['x', 'c', 'n', 'na... |
<filename>qt-creator-opensource-src-4.6.1/tests/system/suite_editors/tst_rename_macros/test.py
############################################################################
#
# Copyright (C) 2016 The Qt Company Ltd.
# Contact: https://www.qt.io/licensing/
#
# This file is part of Qt Creator.
#
# Commercial License Usage... |
<filename>reframe/frontend/executors/__init__.py<gh_stars>0
import abc
import sys
import reframe.core.debug as debug
import reframe.core.logging as logging
import reframe.core.runtime as runtime
from reframe.core.environments import EnvironmentSnapshot
from reframe.core.exceptions import (AbortTaskError, JobNotStarted... |
import time
import onionGpio
from OmegaExpansion import oledExp
from requests import get
from dns import resolver
from datetime import datetime
oledExp.driverInit(1)
oledExp.setBrightness(0)
oledExp.setTextColumns()
gpio_rled = onionGpio.OnionGpio(17)
gpio_gled = onionGpio.OnionGpio(16)
gpio_bled = onionGpio.OnionGpi... |
from http.cookiejar import CookieJar
import pandas as pd
import requests as req
from strategy.keep_increasing import check as ki_check
import utils
import time
import settings
import talib as tl
settings.init()
def check():
'''
通达信尾盘选股法
14:30开始进行选股,依次按以下步骤执行:
步骤1: 涨幅 3%-5%
步骤2: 按量比lb筛选,按... |
<reponame>BrendaH/django-machina
import os
import pytest
from django.conf import settings
from django.core.files import File
from django.urls import reverse
from faker import Faker
from machina.core.db.models import get_model
from machina.core.loading import get_class
from machina.test.factories import (
Attachme... |
<reponame>mustafa-travisci/lto-api.python
import requests
import json
from lto.transactions import from_data as tx_from_data, SetScript
from lto.accounts import Account
from lto import crypto
class PublicNode(object):
def __init__(self, url, api_key=''):
self.url = url
self.api_key = api_key
... |
#!/usr/bin/env python
"""
Postprocess the outputs of a PISA analysis.
"""
from __future__ import absolute_import
from argparse import ArgumentParser
from collections import OrderedDict
from os.path import basename
import sys
import numpy as np
from pisa.utils.fileio import mkdir
from pisa.utils.log import logging,... |
<gh_stars>10-100
import warnings, os
# We don't want warnings in dependencies to show up in bioscrape's tests.
with warnings.catch_warnings():
warnings.simplefilter("ignore")
import numpy as np
import pylab as plt
import random
import pytest
import test_utils
from bioscrape.simulator import *
from bioscrape.type... |
#!/usr/bin/python
import utmp
from UTMPCONST import *
import time, pwd, grp, os, string, sys, socket, popen2
from stat import *
from string import lower
def getrealname(gec):
# get real name from gecos fiels
return string.split(gec,",",1)[0]
def formatidle(t):
if t<30:
return ""
if t<80:... |
<reponame>gsneha26/cactus
#!/usr/bin/env python3
"""
Functions to launch and manage Redis servers.
"""
import os
import random
import signal
import sys
import traceback
from multiprocessing import Process, Queue
from time import sleep
from toil.lib.bioio import logger
from cactus.shared.common import cactus_call
from... |
<gh_stars>1-10
# import copy
from .Data import Data, DataDict
from .Node import Node, Operator
from .Layer import Layer
import gc
from pathlib import Path
from time import gmtime, strftime
from typing import List, Tuple, Dict
class Pipeline(Node):
"""Pipeline works with DataLayer and Layer"""
def __init__(se... |
<filename>woof/partitioned_producer.py<gh_stars>0
import logging
import random
from kafka import KafkaProducer
from kafka.errors import KafkaTimeoutError
from kafka.partitioner.default import DefaultPartitioner
from .common import CURRENT_PROD_BROKER_VERSION
from .transactions import make_kafka_safe
log = logging.get... |
#!/usr/bin/env python
# Copyright (C) 2012, Code for America
# This is open source software, released under a standard 3-clause
# BSD-style license; see the file LICENSE for details.
import os
import math
import datetime
import smtplib
from email.mime.text import MIMEText
from threading import Thread
from optparse im... |
# /*
# * Copyright 2010-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# *
# * Licensed under the Apache License, Version 2.0 (the "License").
# * You may not use this file except in compliance with the License.
# * A copy of the License is located at
# *
# * http://aws.amazon.com/apache2.0
# *
# * or i... |
<gh_stars>1-10
"""Unit tests for orbitpy.mission module.
The following tests are framed to test the different possible ways in which the mission can be framed in the JSON string and called to execute.
TODO: In each test, the output is tested with the results as computed on July 2021 (thus representing the "truth" dat... |
<reponame>ohduran/ring<filename>tests/test_redis.py
import ring
from .test_func_sync import redis_client
import pytest
__all__ = ('redis_client', )
@pytest.mark.parametrize('expire', [
1,
None,
])
def test_redis(redis_client, expire):
@ring.redis(redis_client, 'ring-test', expire=expire)
def f(a, b):... |
from ..archive import Archive
from ..individual import Individual
from ..operators import crowding_distance
import unittest
class TestArchive(unittest.TestCase):
def setUp(self):
self.archive = Archive()
def test_should_constructor_create_a_non_null_object(self):
self.assertIsNotNone(self.a... |
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup --------------------------------------------------------------
# If extensions (or module... |
from tkinter import *
from tkinter import messagebox
import sqlite3
from sqlite3 import Error
import os,sys
from datetime import datetime,date
py = sys.executable
class ret(Tk):
def __init__(self):
super().__init__()
self.iconbitmap(r'libico.ico')
self.title("Return")
... |
<filename>samples/containerregistry/manage_task.py
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# ---------------------------------... |
<reponame>netvisionhcm/app-server
# example usage: python yolo_video.py -i video.mp4 -o video_out.avi
import argparse
import glob
import time
import logging
import cv2
import numpy as np
import threading
from pathlib import Path
from ai_logging import LOG
class ObjectDetectionEngine(object):
def __init__(self):
... |
import numpy as np
import sys
def same_dist_elems(arr):
"""
Smart little script to check if indices are equidistant.
Found at https://stackoverflow.com/questions/58741961/how-to-check-if-consecutive-elements-of-array-are-evenly-spaced
Parameters
----------
arr : array_like
Input a... |
<reponame>elecun/mlpack
'''
@brief Leg-Rest Pos Recommendataion with DecisionTree Regressor
@author <NAME> <<EMAIL>>
@date 2021. 05. 21
'''
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.tree import DecisionTreeRegressor
from sklearn.neural_network import ML... |
from src.dqn import DQN
from glob import glob
import random, os
import numpy as np
from retro.scripts import playback_movie
from src import actions_builder, env_creator
import math
from src import utils
from collections import deque
logger = utils.get_logger(__name__)
def train_on_random_movie(dqn):
human_games =... |
# Copyright (c) 2020 Graphcore Ltd. All Rights Reserved.
# Copyright (c) 2019 NVIDIA CORPORATION. All rights reserved.
# Copyright 2018 The Google AI Language Team 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 ob... |
import unittest.mock as mock
from unittest.mock import Mock, MagicMock
import unittest
import cloudpickle
from queue import Empty as EmptyQueue
from mlagents.envs.subprocess_env_manager import (
SubprocessEnvManager,
EnvironmentResponse,
EnvironmentCommand,
worker,
StepResponse,
)
from mlagents.env... |
import lvgl as lv
from audio import Player
# RESOURCES_ROOT = "S:/Users/liujuncheng/workspace/iot/esp32/solution/MicroPython/smart_panel/smart_panel/"
RESOURCES_ROOT = "S:/data/pyamp/"
functionImage = [
RESOURCES_ROOT + "images/prev.png",
RESOURCES_ROOT + "images/play.png",
RESOURCES_ROOT + "... |
<reponame>TaaoWen/PSC_AgentBasedModellingCode<filename>main.py
# main.py
'''
Agent Based Modelling
This Python code is a used as the practicals (Agent Based Modelling) for the module "Programming for Social Science".
This is the main file, and Agents classes are stored in "agentframework.py".
More detail can be found ... |
from heartbeat import BaseTest
import urllib2
import json
import nose.tools
import os
from nose.plugins.skip import SkipTest
class Test(BaseTest):
def __init__(self, *args):
self.proc = None
super(Test, self).__init__(*args)
def test_telemetry(self):
"""
Test that telemetry me... |
#!/usr/bin/env python
#coding=utf-8
#======================================================================
#Program: Diffusion Weighted MRI Reconstruction
#Module: $RCSfile: spherical_splines.py,v $
#Language: Python
#Author: $Author: bjian $
#Date: $Date: 2009/04/09 06:04:19 $
#Version: $Rev... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.