text stringlengths 957 885k |
|---|
"""animacion de la simulacion."""
import pygame
import sys
import copy
from pygame.locals import QUIT
from animacion.gui import gui
pygame.init()
def intefaz():
"""Mostrar Datos."""
# tll = "{0:.3f}".format(5.1234554321)
g.panel()
g.caja()
def control_evento():
"""Manejo de eventos."""
for e... |
<filename>tests/st/ops/gpu/test_relu_v2.py
# 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
#
# Unl... |
<gh_stars>0
"""
Listing 6.1 Word-level one-hot encoding (toy example)
"""
import numpy as np
# Initial data: one entry persample (in this example, a sampe is a sentence but it could be an entire document)
samples = ['The cat sat on the mat.','The dog ate my homework.']
# Builds an index of all tokens in the data
tok... |
"""Switch for the Adaptive Lighting integration."""
from __future__ import annotations
import asyncio
import bisect
from collections import defaultdict
from copy import deepcopy
from dataclasses import dataclass
import datetime
from datetime import timedelta
import functools
import hashlib
import logging
import math
f... |
"""Implementation (in 3D) of network in:
http://openaccess.thecvf.com/content_CVPRW_2019/papers/CLIC 2019/Zhou_End-to-end_Optimized_Image_Compression_with_Attention_Mechanism_CVPRW_2019_paper.pdf
Winner of CLIC 2019
"""
import torch
from torch import nn
from VarDACAE.nn.pytorch_gdn import GDN
from VarDACAE.nn.RAB ... |
<reponame>petrs/py-tpm-analysis
import constatnts
import os
from analytics.algtest import AlgtestCase
from analytics.windows import WindowsCase
# a record represents a folder of results either containing a single test scenario (1 dataset) or multiple
class Record:
record_count = 0
def __init__(self, path, ... |
#!/usr/bin/env python
"""
node.py: Map all the node types of the PL grammar to node_id
Usage:
node.py --lang=<str> NODE_FILE [options]
Options:
-h --help Show this screen.
--lang=<str> target language
"""
from docopt import docopt
import pickle
import torch
from utils im... |
import os
import logging
from utils.feature_utils import FeatureUtils, PairFeatureUtils
from utils.file_utils import FileUtils
logger = logging.getLogger(__name__)
logging.basicConfig(level = logging.INFO)
def copy_clusters(clusters):
from copy import deepcopy
clusters = deepcopy(clusters)
return clust... |
# -*- coding: utf-8 -*-
#
# Copyright 2016 <NAME>
#
# 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... |
<filename>limix/plot/manhattan.py
from __future__ import division
from numpy import arange, asarray, cumsum, flipud, log10
def plot_manhattan(df,
alpha=None,
null_style=dict(alpha=0.1, color='DarkBlue'),
alt_style=dict(alpha=0.5, color='Orange'),
... |
<reponame>uigc/equities<filename>options/bsm.py<gh_stars>0
# Option Pricing in Python using the Black-Scholes-Merton Model (BSM) - Nov 2018. Author: <NAME>.
# Copyright 2018, <NAME>, All Rights Reserved.
import numpy as np
import scipy.stats as si
'''
Black-Scholes-Merton Model for European Options
S: Spot stock pric... |
<reponame>deepio-oc/RPBot
import pytest
import io
from rpbot.reader.robot_results_parser import RobotResultsParser
@pytest.fixture
def reporter(mocker):
reporter = mocker.MagicMock()
yield reporter
@pytest.fixture
def parser(reporter):
parser = RobotResultsParser(reporter)
yield parser
simple_outp... |
# Practice: Collections & Loops
This section is meant to give you additional practice, with a particular focus on collections and loops. However, we do assume that you have the previous section's material understood as well, so we can't forget about conditionals or variable types learned previously.
As in the last p... |
<gh_stars>1-10
import sys
from collections import defaultdict
from operator import attrgetter
from typing import Tuple
from enum import Enum, IntEnum
from src.exceptions import *
from src.helpers import has_enough_mana
def eprint(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
class Phase(IntEnum):
... |
<gh_stars>1-10
'''
Created on Mar 28, 2012
@author: jan
'''
import random
import numpy as np
from scipy.stats import norm, expon, gamma
from scipy.spatial.distance import squareform
def gaussian_influence(mu, width):
''' creates a 2D-function for gaussian influence sphere'''
return lambda x, y: np.exp(-width... |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: common_rpc.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection... |
import sys
import random
import json
import collections
from twisted.web.static import File
from twisted.python import log
from twisted.web.server import Site
from twisted.internet import reactor
import itertools
import codecs
import time
import os
from typing import Dict, List, Iterable, Any, Union, Optional, Tuple
f... |
<filename>expyfun/io/_parse.py
# -*- coding: utf-8 -*-
"""File parsing functions
"""
import ast
from collections import OrderedDict
import csv
import json
import numpy as np
def read_tab_raw(fname, return_params=False):
"""Read .tab file from expyfun output without segmenting into trials.
Parameters
--... |
#!/usr/bin/python
"""
Register brains, landmarks, and labels to a template.
(c) 2011, @rno klein
"""
import os
from os.path import exists
from subprocess import call
from numpy import float, isnan
# Run intensity-based registration
# 1. Register brains to template
# 2. Transform brains to each other via template
# 3... |
import os
import tensorflow as tf
from util import constants
from util.config_util import get_model_params, get_task_params, get_train_params
from tf2_models.trainer import Trainer
from absl import app
from absl import flags
import numpy as np
from util.models import MODELS
from util.tasks import TASKS
import tensorflo... |
<gh_stars>0
#!/usr/bin/python
# Copyright 2016 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 requi... |
import numba as nb
from numba import cuda
from numba.cuda.random import xoroshiro128p_uniform_float32
size = -1
k = -1
E = -1
N = -1
@cuda.jit
def tabuWVCP_NoRandom_AFISA(
rng_states,
D,
max_iter,
A,
W,
tColor,
vect_fit,
vect_score,
vect_conflicts,
alpha,
phi,
):
# vec... |
import re
from baserow.core.utils import split_comma_separated_string
from baserow.contrib.database.fields.models import Field
def get_include_exclude_field_ids(table, include=None, exclude=None):
"""
Returns a list containing the field ids based on the value
of the include and exclude parameters.
:p... |
import os
import time
from six.moves.urllib.parse import urlparse, urljoin, urlsplit, parse_qs
from conans.client.remote_manager import check_compressed_files
from conans.client.rest.differ import diff_snapshots
from conans.client.rest.rest_client_common import RestCommonMethods
from conans.client.rest.uploader_downl... |
__author__ = '<NAME>'
__license__ = "MIT"
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from math import sqrt
import datetime
from mpl_toolkits.basemap import Basemap
from matplotlib.colors import LinearSegmentedColormap
# Set the plot styles
parse = lambda x: datetime.... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
import ctypes
def get_file_icon(path, large=True):
import ctypes
SHGetFileInfo = ctypes.windll.shell32.SHGetFileInfoW
SHGFI_ICON = 0x100
SHGFI_SYSICONINDEX = 0x4000
SHGFI_LARGEICON = 0x0
SHGFI_SMALLICON = 0x1
class... |
<filename>tvrenamer/services/trakt_service.py
import logging
import os
from oslo_config import cfg
import trakt
from trakt.core import exceptions
from tvrenamer.services import base
LOG = logging.getLogger(__name__)
OPTS = [
cfg.StrOpt(
'client_id',
secret=True,
default=os.environ.get('T... |
import os
import numpy
ROOT = '/home/lorenzp/adversialml/src/src/submodules/adversarial-detection/expts'
DATA_PATH = os.path.join(ROOT, 'data')
NUMPY_DATA_PATH = os.path.join(ROOT, 'numpy_data')
MODEL_PATH = os.path.join(ROOT, 'models')
OUTPUT_PATH = os.path.join(ROOT, 'outputs')
# Normalization constants for the dif... |
import re
import unicodedata
from ..base import Plugin
class Unicode(Plugin):
# Plugin
def handleInitialize(self):
self.registerCommand("unicode", self.handleUnicodeSearch).setDescription("Searches for Unicode code points by name.").addParameter("search text")
self.registerCommand("utf8", self.handleUnicodeS... |
<filename>locora/grid_solvent/solvent_field.py
import numpy as np
from locora.grid_solvent.spatial import field
from locora.grid_solvent.spatial import set_euler as _set_euler
from locora.grid_solvent.spatial import set_quaternion as _set_quaternion
from locora.grid_solvent.crd_systems import internal_rectangular
cla... |
import numpy as np
#from LEM_initial_landscape import *
def slope_direction(eta_vector,nrows,ncols,dx,dy,validID,bn_ID):
#neighbors
z = eta_vector.reshape(nrows,ncols)
xn = [-1,0,1,-1,1,-1, 0, 1]
yn = [1, 1,1, 0,0,-1,-1,-1]
dn = [2.**.5,1.,2.**.5,1.,1.,2.**.5,1.,2.**.5]
# 530
... |
import actions
import logger
import testutil
import test_engine
log = logger.Logger(__name__, logger.INFO)
def _bulk_update(table_name, col_names, row_data):
return actions.BulkUpdateRecord(
*testutil.table_data_from_rows(table_name, col_names, row_data))
class TestDerived(test_engine.EngineTestCase):
sampl... |
from akf_corelib.conditional_print import ConditionalPrint
from akf_corelib.configuration_handler import ConfigurationHandler
from akf_corelib.random import Random
import numpy as np
class LineFeatures():
counter_special_chars = -1
counter_alphanumerical_chars = -1
counter_numbers = -1
counter_chars ... |
<gh_stars>0
import numpy as np
import h5py
import numpy as np
import platform
import os
import json
import sys
import argparse
import scipy.ndimage as nd
import pickle
from contextlib import redirect_stdout
from ipdb import set_trace as stop
if (platform.node() == 'viga'):
os.environ["THEANO_FLAGS"] = "mode=FAST_R... |
<reponame>jkl1337/ankisport
# coding=utf-8
from PyQt4 import QtCore, QtGui
from aqt import mw
from aqt.qt import *
from aqt.utils import showWarning, tooltip
from exporter import TOMLNoteExporter
import pytoml as toml
class ExportDialog(QDialog):
def __init__(self, mw):
QDialog.__init__(self, mw, Qt.Wind... |
<reponame>Defense-Cyber-Crime-Center/plaso<filename>tests/output/interface.py<gh_stars>1-10
#!/usr/bin/python
# -*- coding: utf-8 -*-
import unittest
from plaso.output import interface
from plaso.output import manager
from tests.cli import test_lib as cli_test_lib
from tests.output import test_lib
class TestEvent(... |
# @Author: <NAME> <arthur>
# @Date: 10.05.2021
# @Filename: test_analysis.py
# @Last modified by: arthur
# @Last modified time: 15.09.2021
import pyrexMD.analysis.analyze as ana
import pyrexMD.misc as misc
import MDAnalysis as mda
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
from numpy.tes... |
# Authors: <NAME> <<EMAIL>>
#
# License: BSD (3-clause)
from pathlib import Path
import numpy as np
from numpy.core.records import fromarrays
from scipy.io import savemat
import mne
from ..utils import have
def write_fif(fname, raw):
raw.save(fname)
def write_set(fname, raw):
"""Export raw to EEGLAB .set... |
<gh_stars>1-10
"""
This is an example settings/local.py file.
These settings overrides what's in settings/base.py
"""
import logging
# To extend any settings from settings/base.py here's an example:
#from . import base
#INSTALLED_APPS = base.INSTALLED_APPS + ['debug_toolbar']
DATABASES = {
'default': {
'... |
<gh_stars>0
"""Core methods for find-data extraction/parsing."""
import os
import sys
import re
import json
from datetime import date, datetime
from normalization import author_role
from cons_platforms import PLATFORM_ALIASES
from region_tree import search_region_tree
from tag_match import tag_match, yolo_spl, _clean_e... |
<reponame>busyyang/torch_ecg
"""
"""
import os, sys, re, logging
import time, datetime
from functools import reduce
from copy import deepcopy
from itertools import repeat
from numbers import Real, Number
from typing import Union, Optional, List, Tuple, Dict, Sequence, NoReturn
import numpy as np
import pandas as pd
... |
#!/usr/bin/env python
import os.path
import numpy as np
from gmprocess.io.knet.core import is_knet, read_knet
import pkg_resources
from gmprocess.utils.test_utils import read_data_dir
def test():
dpath = os.path.join('data', 'testdata', 'knet', 'us2000cnnl')
datadir = pkg_resources.resource_filename('gmproce... |
# coding=UTF-8
from .forms import Form, FormPlGen, FormSg
from .attributes import Gender
from .xml_helpers import formsg_node, formpl_node, formplgen_node, write_sg, write_pl, write_pl_gen
from typing import List
import xml.etree.ElementTree as ET
class Noun:
def __str__(self) -> str:
return self._gramada... |
<gh_stars>10-100
##############################################################################
# Copyright (c) 2017 Ericsson AB and others.
# Author: <NAME> (<EMAIL>)
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accom... |
"""
env.py:
Read a bash script and learn the environment variables into a python dictionary.
This allows MySQL database host, database, username and password to be set in
environment variables for both bash scripts and Python programs.
Can read environment variables in bash scripts such as:
export FOO=bar
export BA... |
import numpy as np
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
os.environ["CUDA_DEVICE_ORDER"] = "PCI_" \
"BUS_ID" # see issue #152
os.environ["CUDA_VISIBLE_DEVICES"] = "2"
import tensorflow as tf
def permute_batched_tensor_3dim(batched_x, batched_perm_ids):
indices = tf... |
import torch as tn
from torchvision import datasets, transforms
import torchtt as tntt
import torch.nn as nn
import matplotlib.pyplot as plt
import numpy as np
import datetime
data_dir = 'Cat_Dog_data/'
transform_train = transforms.Compose([transforms.Resize(64), transforms.CenterCrop(64), transforms.ToTensor()])
dat... |
<gh_stars>0
import numpy as np
import pickle as pkl
import networkx as nx
import scipy.sparse as sp
from scipy.sparse.linalg.eigen.arpack import eigsh
import sys
import random
def parse_index_file(filename):
"""Parse index file."""
index = []
for line in open(filename):
index.append(int(line.strip... |
<reponame>BlackLight/platypush
import datetime
import enum
import logging
import threading
import croniter
from dateutil.tz import gettz
from platypush.procedure import Procedure
from platypush.utils import is_functional_cron
logger = logging.getLogger('platypush:cron')
class CronjobState(enum.IntEnum):
IDLE =... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
"""
This file provides the definition of the convolutional heads used to predict masks, as well as the losses
"""
from typing import List
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch import Tensor
from detectron2.s... |
<reponame>jimwaldo/HarvardX-Tools<filename>src/main/python/logs/buildClassHistograph.py
#!/usr/bin/env python
"""
Run from a directory containing directories with name harvardx-YYYY-MM-DD and which has
a set of directories that might contain a ClassList.csv file, this program will
create a set of csv files (written to... |
<filename>emergency_stop.py
#!/usr/bin/env python
"""
Este programa implementa un freno de emergencia para evitar accidentes en Duckietown.
"""
import sys
import argparse
import gym
import gym_duckietown
from gym_duckietown.envs import DuckietownEnv
import numpy as np
import cv2
def mov_duckiebot(key):... |
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from builtins import *
from future.builtins.disabled import *
import re
from ._common import *
class Clone(SubCommand):
def __init__(self, *args, **kwargs):
super(Clone, self).__init__(*a... |
<filename>busca.py<gh_stars>0
import os
import tkinter as tk
from tkinter import ttk
#chave = input("Palavra chave: ")
#b = ("start chrome https://www.google.com/search?q=site%3Aempregacampinas.com.br+%22{}%22+inurl:2022".format(chave))
#os.system(b)
class Tela:
def __init__(self, master):
#Imagem EMPR... |
<reponame>zplab/zplib
import numpy
def weighted_mean_and_std(x, w):
"""Return the mean and standard deviation of the data points x, weighted by
the weights in w (which do not need to sum to 1)."""
w = numpy.array(w, dtype=float)
w /= w.sum()
x = numpy.asarray(x)
weighted_mean = (w*x).sum()
... |
#
#
# All Rights Reserved.
# Copyright 2013 OpenStack LLC
# 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
#
# ... |
import threading
import requests
import traceback
import time
import os
import json
import atexit
import subprocess
import logging
import sys
import configparser
from pathlib import Path
# BEGIN Parsing config
config = configparser.ConfigParser()
config.read("supervisor-config.ini")
default_config = config["DEFAULT"]... |
<reponame>noragami/scraptimus
#!/usr/bin/env python
# -*- coding: utf8 -*-
from bs4 import BeautifulSoup
from argparse import ArgumentParser
from platform import python_version_tuple
import json
import pandas as pd
import re
import requests
import time
if python_version_tuple()[0] == u'2':
def input(prompt): retu... |
import os
import unittest
import pickle
from pandas import read_csv
from sklearn.linear_model import SGDClassifier
from sklearn.tree import DecisionTreeClassifier
from fp.traindata_samplers import CompleteData
from fp.missingvalue_handlers import CompleteCaseAnalysis
from fp.scalers import NoScaler
from fp.learners im... |
import numpy as np
import re
class SWEEncoder_ja:
def __init__(self, bpe, emoji):
self.bpe = [[b] if (b==',' or ',' not in b) else b.split(',') for b in bpe]
self.swe = {}
for idx, b in enumerate(self.bpe):
for wd in b:
self.swe[wd] = idx
self.emoji = emo... |
'''Tests configuration.'''
import multiprocessing
import os
import sys
import pytest
TEST_DIR = os.path.abspath(os.path.dirname(__file__))
if TEST_DIR not in sys.path:
sys.path.append(TEST_DIR)
from server import test_server_process # noqa: E402
def values_list():
return ['foo', 'bar', 'baz', 1, -1.5, T... |
import sys
import time
from pathlib import Path
import torchvision.transforms
from PyQt5.QtWidgets import QApplication, QMainWindow, QMessageBox, QFileDialog
from PyQt5.QtGui import QImage, QPixmap
from PyQt5.QtCore import QThread, QDir
import numpy as np
import cv2
from form import Ui_OakDDetector
from oakd_camera imp... |
'''
Created on Feb 15, 2014
@author: sethjn
This sample shows how to do some basic things with playground.
It does not use the PlaygroundNode interface. To see an example
of that, check out computePi.py.
'''
# We will use "BOOL1" and "STRING" in our message definition
from playground.network.packet.fieldtypes import... |
# -*- coding: utf-8 -*-
"""This module defines classes which can be used to build interfaces from
external packages to the data description and assosiated objects.
Each interface type is a subclass of the Interface abstract class and certain
attributes and methods must be defined for these to become "concrete".
The ... |
from flask import Flask, render_template, request
from datetime import date, datetime
from message import text
import psycopg2
import math
import simplejson
import prediction
class CustomFlask(Flask):
jinja_options = Flask.jinja_options.copy()
jinja_options.update(dict(
block_start_string='<%',
... |
<gh_stars>10-100
# -*- coding: utf-8 -*-
from __future__ import (unicode_literals, absolute_import, division)
import datetime
import random
import logging
import collections
import six
from dateutil import relativedelta
from django.core.urlresolvers import reverse
from django.core.exceptions import ObjectDoesNotExis... |
description = 'PUMA multi detector device'
group = 'lowlevel'
import math
excludes = ['detector']
modules = ['nicos_mlz.puma.commands']
vis = ('devlist', 'namespace', 'metadata')
devices = dict(
med = device('nicos_mlz.puma.devices.PumaMultiDetectorLayout',
description = 'PUMA multi detector',
... |
<gh_stars>1-10
from __future__ import annotations
import asyncio
import os
from datetime import datetime
from pathlib import Path
from typing import TYPE_CHECKING, Any, Callable, Iterable, Optional, overload
from typing_extensions import Final, Literal
from ...client import Client
from ...ext import commands
from ..... |
<filename>cyborg/tests/unit/accelerator/drivers/spdk/nvmf/test_nvmf.py
# Copyright 2017 Huawei Technologies Co.,LTD.
# 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 Licen... |
<reponame>stevejaker/psychic-journey
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Sample Message.py program
"""
import re
import mysql.connector
# import fuzzy
# import uuid # To be used eventually
# from DBINFO import *
# import db_manage
class Message(object):
"""
"""
def __init__(self, msg, d... |
"""Client for staging inputs for Galaxy Tools and Workflows.
Implement as a connector to serve a bridge between galactic_job_json
utility and a Galaxy API library.
"""
import abc
import json
import logging
import os
import yaml
from galaxy.tool_util.cwl.util import (
DirectoryUploadTarget,
FileLiteralTarget,... |
# Copyright (c) 2018 ISP RAS (http://www.ispras.ru)
# Ivannikov Institute for System Programming of the Russian Academy of Sciences
#
# 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
#
# htt... |
from stormed.util import WithFields
class Declare(WithFields):
_name = "queue.declare"
_class_id = 50
_method_id = 10
_sync = True
_content = False
_fields = [
('ticket' , 'short'),
('queue' , 'shortstr'),
('passive' , '... |
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 1.3.31
#
# Don't modify this file, modify the SWIG interface instead.
# This file is compatible with both classic and new-style classes.
import _lbiemesher
import new
new_instancemethod = new.instancemethod
try:
_swig_property = prope... |
<filename>backend/api/models.py
import datetime
from django.db import models
class Company(models.Model):
name = models.CharField(unique=True, max_length=55)
def __str__(self):
return "%s" % (self.name)
class Province(models.Model):
code = models.CharField(primary_key=True, max_length=2)
def... |
<gh_stars>0
import datetime, uuid
from django.db import models
from django.utils import timezone
from django.utils.translation import gettext_lazy as _
from django.core.validators import ValidationError
from Laelia.apps.base.fields import MinMaxFloatField
from Laelia.apps.base.functions import funcTime
from Laelia.apps... |
"""
pyart.aux_io.read_gamic
=======================
Utilities for reading gamic hdf5 files.
.. autosummary::
:toctree: generated/
read_gamic
_h5_to_dict
_h5_moments_to_dict
"""
import datetime
import h5py
import numpy as np
from ..config import FileMetadata
from ..io.common import make_time_unit_... |
<gh_stars>1-10
import os
import torch
import shutil
import numpy as np
import torch.nn.functional as F
from network import get_network
from PIL import Image
from scipy.io import wavfile
from torch import topk
from torch.utils.data.dataloader import default_collate
from vad import read_wave, write_wave, frame_generator... |
#pylint: disable-all
import os
import yaml
import pytest
# we use environments variable to mark slow instead of register new pytest marks here.
AWNAS_TEST_SLOW = os.environ.get("AWNAS_TEST_SLOW", None)
sample_cfg_str = """
## ---- Component search_space ----
# ---- Type cnn ----
search_space_type: cnn
search_space_c... |
import json
import pytricia
from src.reader import FileReader
from src.dl.download_zoom import ZoomCidrDownloader
from src.pytrie_support import PytrieSupport
from src.whois import whois
def run_test():
# 128 bits needed for holding IPv6
pyt = pytricia.PyTricia(128)
support = PytrieSupport()
# read all the... |
import streamlink, sys, datetime, time, os, requests, datetime
def cDateTime():
format = "%Y-%m-%d_%H-%M-%S"
now_utc = datetime.datetime.now()
return now_utc.strftime(format)
def cDate():
format = "%Y-%m-%d"
now_utc = datetime.datetime.now()
return now_utc.strftime(format)
def logToFile(s):
d = cDate()
dt = ... |
import json
from ..views import View
from ..controllers import Controller
from ..utils.structures import data_get
class HttpTestResponse:
def __init__(self, testcase, application, request, response, route):
self.testcase = testcase
self.application = application
self.request = request
... |
#!encoding=utf-8
'''
Created on 2015年10月12日
@author: Yafei
'''
import MySQLdb
import sys
class DB(object):
'''
classdocs
'''
def __init__(self, conf):
'''
Constructor
'''
self.db_host = conf.db_host
self.db_port = conf.db_port
self.db_user = conf.db_us... |
"""Docker controller"""
from time import sleep
from typing import Optional
from urllib.parse import urlparse
from django.conf import settings
from django.utils.text import slugify
from docker import DockerClient as UpstreamDockerClient
from docker.errors import DockerException, NotFound
from docker.models.containers i... |
<gh_stars>1-10
import sys
import os
import re
import glob
import subprocess
import shutil
import warnings
import tclwrapper
from tclwrapper.tclutil import *
import bluespecrepl.verilog_mutator as verilog_mutator
import bluespecrepl.pyverilatorbsv as pyverilatorbsv
class BSVProject:
"""Bluespec System Verilog Proje... |
import pytest
import numpy as np
from mesohops.dynamics.hops_aux import AuxiliaryVector
from mesohops.util.exceptions import AuxError
def test_auxvec_ordering():
"""
This function test whether an incorrectly ordered array_aux_vex properly raises
the correct AuxError
"""
aux_1010 = AuxiliaryVector(... |
# -*- coding:utf8 -*-
from __future__ import print_function
import numpy as np
from nltk.corpus import stopwords
from nltk.stem import SnowballStemmer
from nltk.stem.porter import *
from string import punctuation
from keras.preprocessing.text import Tokenizer
from keras.preprocessing import sequence
from config imp... |
<reponame>neelasha23/ploomber
"""
On languages and kernels
------------------------
NotebookSource represents source code in a Jupyter notebook format (language
agnostic). Apart from .ipynb, we also support any other extension supported
by jupytext.
Given a notebook, we have to know which language it is written in to ... |
<reponame>talbertc-usgs/GuanoMDEditor<filename>guanomdeditor/gui/SingleGuanoEditor.py
import sys
import os
from pathlib import Path
from collections import OrderedDict
from PyQt5.QtWidgets import QApplication
from PyQt5.QtWidgets import QMessageBox
from PyQt5.QtWidgets import QWidget
from PyQt5.QtWidgets import QCheck... |
# -*- coding: utf-8 -*-
from __future__ import division
import matplotlib.pyplot as plt
import numpy as np
# import numpy.linalg as la
from procedural_city_generation.additional_stuff.Singleton import Singleton
from procedural_city_generation.building_generation.building_tools import *
from procedural_city_generation... |
<reponame>dane-king/intake
from django.test import TestCase
from django.conf import settings
from django.urls import reverse
from intake.permissions import get_all_followup_permissions
from user_accounts.tests.factories import UserProfileFactory, UserFactory
from intake.tests.factories import FormSubmissionWithOrgsFact... |
<filename>test/test_view_individual_module.py<gh_stars>1-10
'''
test_view_individual_module.py tests the app's view individual mod page
'''
from paste.fixture import TestApp
from nose.tools import assert_equal, raises
from app import APP
from components import session
class TestCode(object):
'''
This c... |
import argparse
import logging
import os
import sys
from configparser import ConfigParser
from functools import wraps
import boto3
from flask import (
Flask,
request,
session,
jsonify,
render_template
)
from flask_sqlalchemy import SQLAlchemy
from osisoft_pi2aws_root import PROJECT_DIR
from schedul... |
<gh_stars>1-10
from pathlib import Path
from typing import Union, List, Optional, Tuple
from functools import partial, reduce
from multiprocessing import Pool, cpu_count
import json
from .example import Example
from .tables import Result, Cycle
from .errors import PrecisionError
from .database import session_scope
fr... |
<reponame>dyndeploy-test/timestrap
import conf.managers
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.db.models.manager
class Migration(migrations.Migration):
initial = True
dependencies = [
('sites', '0002_alter_domain_uniqu... |
#!/usr/bin/env python
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from absl import flags
from absl import app as absl_app
import numpy as np
import tensorflow as tf
from models import embed_pool, embed_cnn, cnn_lstm, resnet_cnn, \
embed_lstm, emb... |
from __future__ import annotations
from os import PathLike
from pathlib import Path
import click
from grapl_tests_common.upload_logs import upload_osquery_logs, upload_sysmon_logs
from graplctl import idempotency_checks
from graplctl.common import State, pass_graplctl_state
from graplctl.upload.lib import upload_anal... |
<filename>signal_ocean/historical_tonnage_list/vessel_filter.py
# noqa: D100
from datetime import date
from dataclasses import dataclass, field
from typing import List, Optional, cast
from .vessel_subclass import VesselSubclass
from .._internals import QueryString, format_iso_date
@dataclass(eq=False)
class VesselF... |
<gh_stars>0
# -*- coding: UTF-8 -*-
"""
Author:wistn
since:2020-05-22
LastEditors:Do not edit
LastEditTime:2020-10-06
Description:
"""
from .org_noear_sited_SdAttributeList import SdAttributeList
from .org_noear_sited_SdNode import SdNode
from .mytool import TextUtils
class DdNode(SdNode):
def s(self):
re... |
from openpyxl import load_workbook
import os
import yaml
from pathlib import Path
import re
import networkx as nx
def import_from_xls(reqmodule, req_xls, wb=None):
if not wb:
wb = load_workbook(req_xls)
if reqmodule.module_prefix in wb.sheetnames:
sheet = wb[reqmodule.module_prefix]
else:
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.