text stringlengths 3.07k 12.6k |
|---|
'''
* @author Waldinsamkeit
* @email <EMAIL>
* @create date 2020-11-16 11:12:26
* @desc
'''
from typing import Any,Dict
import torch
from torch.utils.tensorboard import SummaryWriter
import torch.optim as optim
from dataloader import DataSetDir, DataSet, Dataloader, DataItemSet,select_sampler
from wrapper import ... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2012 The Plaso Project Authors.
# Please see the AUTHORS file for details on individual 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 L... |
"""Policy tests."""
from __future__ import division, print_function, absolute_import
from SafeRLBench.spaces import BoundedSpace
from SafeRLBench.envs.quadrocopter import Reference
from SafeRLBench.envs._quadrocopter import StateVector
from SafeRLBench.policy import (NeuralNetwork,
Line... |
import argparse
import cPickle as pickle
import os
from tempfile import mkstemp
import subprocess
import matplotlib.pyplot as plt
import numpy as np
def find_package(package_name):
cmd = ['cmake', '--find-package', '-DNAME=' + package_name, '-DLANGUAGE=CXX', '-DCOMPILER_ID=GNU', '-DMODE=COMPILE']
p = subpro... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import argparse
import os
import subprocess
import sys
PYTHON_VERSION = sys.version_info[0]
if PYTHON_VERSION < 3:
from ConfigParser import ConfigParser
else:
from configparser import ConfigParser
CREDENTIALS_ROOT... |
import torch
import torchvision
from PIL import Image
import torchvision.transforms as transforms
import numpy as np
import copy
import warnings
class MISLABELCIFAR10(torchvision.datasets.CIFAR10):
def __init__(self, root, mislabel_type='agnostic', mislabel_ratio=0.5, rand_number=0, train=True,
... |
from py_edamam import PyEdamam
e = PyEdamam(nutrition_appid='your key',
nutrition_appkey='your key',
recipes_appid='your key',
recipes_appkey='your key',
food_appid='your key',
food_appkey='your key')
def bmr_calculation(weightInkgs,heightInCentimeters,age,maleorFemale):
if... |
import sys
sys.path.append('../')
import copy
import numpy as np
import pandas as pd
# ~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<
# Order & Aesthetic FUNCTIONS <~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~
# ~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<... |
#!/usr/bin/env python
import sys
import os
import argparse
import itertools
from fractions import Fraction as Frac
try:
# Python 3
from tkinter import *
from tkinter import filedialog
except ImportError:
# Python 2
from Tkinter import *
import tkFileDialog as filedialog
from level import Level... |
#!/usr/bin/python3
import os
import sys
import tty
import termios
import argparse
from c_nn import *
# PATH_NN_OBJECT = '../topology_example.json'
PATH_NN_OBJECT = '../topology_8_16_12_8_4.json'
PATH_TEST_DATA = '../topology_example_test.json'
############### DEFAULT MODE ###############
def mode_default(pathOut, pa... |
# -*- coding: utf-8 -*-
from pysseg.models import segnet_basic
from pysseg.models import segnet_proper
from pysseg.util import fnameutil
import ubelt as ub
from os.path import join
import re
from pysseg import getLogger
logger = getLogger(__name__)
print = logger.info
model_modules = {
'segnet_basic': segnet_basi... |
import pghistory
from django.contrib.contenttypes.fields import GenericRelation
# from django.contrib.postgres.fields.jsonb import JSONField
from django.contrib.postgres.indexes import GinIndex
from django.core.exceptions import ValidationError
from django.db import models
from django.urls import reverse
import django.... |
from json import loads
from django.core.management.base import BaseCommand
from django.db.models.fields.related import ForeignKey
from django.utils import dateparse
from guardian.shortcuts import assign_perm
from resources_portal.config.logging import get_and_configure_logger
from resources_portal.models import (
... |
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
"""Visualization of the filters based off of:
https://blog.keras.io/how-convolutional-neural-networks-see-the-world.html
"""
from __future__ import print_function
from scipy.misc import imsave
import numpy as np
import time
import os
import fnmatch
from PIL import Image
from keras.models import load_model
from keras i... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import unittest
from nose.plugins.attrib import attr
import hgvs.dataproviders.uta
import hgvs.parser
import hgvs.variantmapper
@attr(tags=["quick"])
class Test_VariantMapper(unittest.TestCase):
def setUp... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Command-line tool to generate word clouds
Usage:
depends:
- libs: python, pip, wordcloud
- fonts: ...
+ run: easy_install pip; sudo pip install wordcloud;
"""
import re
import argparse
import wordcloud as WC
import numpy as np
from PIL import Image
import jie... |
# -*- coding: utf-8 -*-
"""mtwi2018 预处理模块。"""
import math
import numpy as np
from skimage import io, transform
def read_img(file_name):
"""加载图片。
Args:
file_name: 文件路径。
Returns:
返回图片的ndarray数组。
"""
return io.imread(file_name)
def save_img(file_name, arr):
"""保存图片。
Ar... |
# Python Standard Library Imports
# Django Imports
from django.http import Http404
from django.shortcuts import redirect
from django.urls import reverse
from django.views.decorators.http import require_POST
# HTK Imports
from htk.api.utils import json_response_error
from htk.api.utils import json_response_okay
from h... |
import os
import numpy as np
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import sys
from glob import glob
import pandas as pd
import seaborn as sns
import math
sns.set_style("white")
def GetBaseTime (fn):
with open(fn) as f:
for li... |
import uuid
import logging
import inspect
from queue import Queue, Empty
from threading import Thread
from functools import partial
from uniflex.core.common import is_func_implemented
from . import events
__author__ = "<NAME>"
__copyright__ = "Copyright (c) 2015, Technische Universität Berlin"
__version__ = "0.1.0"
__... |
"""Authors: <NAME>, <NAME>."""
from typing import Tuple, Iterable
import numpy as np
from tqdm import tqdm
from hdmf.data_utils import GenericDataChunkIterator
from ....utils import FilePathType
try:
import cv2
HAVE_OPENCV = True
except ImportError:
HAVE_OPENCV = False
INSTALL_MESSAGE = "Please install... |
import numpy as np
import matplotlib.pyplot as plt
import filenames
from hivevo.patients import Patient
import trajectory
def get_proba_fix(trajectories, nb_bin=8, freq_range=[0.1, 0.9]):
"""
Gives the probability of fixation in each frequency bin.
"""
frequency_bins = get_nonuniform_bins(nb_bin, bin... |
#!/usr/bin/env python
"""
Makes a tarball suitable for distros.
It contains the following:
1. The repo source code.
2. An additional `dist` directory with:
1. `FetchContent` dependencies that currently must be vendored.
These are stripped from especially heavy bloat.
2. `devilutionx.mpq`.
While... |
import pandas as pd
import re, glob, nltk, sys, os
import nltk
# Connective cuewords are defined in paper
CUEWORDS_COMPARISON = set(['but', 'however', 'although', 'by contrast'])
CUEWORDS_CONTINGENCY = set(['because', 'so', 'thus', 'as a result', 'consequently', 'therefore'])
CUEWORDS_EXPANSION = set(['also', 'for ex... |
from headerReplace import *
import unittest
# findExpression() Test Cases
class FindExpressionTests(unittest.TestCase):
""" A Series of methods designed to test the functionality of FindExpression in the 'header replace' script """
def test_findExpression_emptyLines(self):
""" Sanity check that 'find... |
import random
def mySort(array):
for i in range(len(array) - 1):
for j in range(len(array) - i - 1):
if array[j] > array[j + 1]:
array[j], array[j + 1] = array[j + 1], array[j]
def nInput():
while True:
try:
n = int(input("Enter n(size): "))
... |
#!/usr/bin/python3
import argparse
import json
import sys
import requests
import elasticsearch
from es2json import esgenerator
from es2json import isint
from es2json import litter
from es2json import eprint
from es2json import isfloat
from es2json import isiter
"""
Use geonames API (slow and quota limit for free acc... |
#!/usr/bin/env python3
from prjxray.segmaker import Segmaker
from prjxray import segmaker
from prjxray import verilog
import os
import json
def bitfilter(frame, word):
if frame < 26:
return False
return True
def mk_drive_opt(iostandard, drive):
return '{}.DRIVE.I{}'.format(iostandard, drive)
... |
#!/usr/bin/env python
"""
Artificial Intelligence for Humans
Volume 2: Nature-Inspired Algorithms
Python Version
http://www.aifh.org
http://www.jeffheaton.com
Code repository:
https://github.com/jeffheaton/aifh
Copyright 2014 by <NAME>
Licensed under the Apache License, Version 2.... |
#!/usr/bin/env python3
# SPDX-FileCopyrightText: 2020 <NAME> and robotnix contributors
# SPDX-License-Identifier: MIT
import argparse
import copy
import json
import os
import pathlib
from typing import Any, Callable, Dict, List, Optional, cast
from robotnix_common import save, checkout_git, ls_remote, get_mirrored_u... |
import tensorflow as tf
import numpy as np
import gym
import sys
import time
def create_environment():
env = gym.make('CartPole-v0')
env = env.unwrapped
env.seed(1)
state = env.reset()
state_size = len(state)
action_size = env.action_space.n
return env, state_size, action_size
def test_... |
import argparse
import pydoc
import sys
import json
import os
from eg import config
from eg import util
_MSG_BAD_ARGS = 'specify a program or pass the --list or --version flags'
LABELS_PATH = os.path.expanduser('~/.eglabels.json')
def _show_version():
"""Show the version string."""
print(util.VERSION)
de... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
import logging
import json
import os
import requests
from mutagen.id3 import TALB, APIC, TSRC, TDRC, TRCK, TIT2, TPE1
from dateutil.parser import parse as parse_date
import musicbrainzngs
from . import __version__ as mutagenerat... |
import argparse
import json
import logging
import os
import re
import sys
from urllib.parse import parse_qs
from typing import Tuple
__version__ = "0.4"
__author__ = "<NAME>"
__copyright__ = "2021 <NAME>"
__license__ = "MIT License"
__all__ = (
"REGEX",
"REGEX_PATTERN",
"SESSION_NAME_SUFFIX",
"clean_da... |
from django.conf import settings
from django.shortcuts import get_object_or_404
from django.http import Http404, JsonResponse
from rest_framework import (
routers,
serializers,
views,
viewsets,
response,
decorators,
filters,
status,
permissions
)
from .models import Group, Permissi... |
# Branch and bound implementation for TSP
import copy
import Queue
import numpy as np
# Calculates total path distance of the edges connecting the nodes in nodes_visited according to the graph adjacency matrix.
def calculate_path_distance(graph, nodes_visited):
distance = 0
for i in range(1, len(nodes_visited)):
... |
import cv2, os, glob, csv, logging, time
import numpy as np
from pathlib import Path
from xml.etree import ElementTree as ET
from ...txtdetn.datasets.base import TextDetectionDatasetBase, Compose
from ...base.synthtext import *
from ..._utils import DATA_ROOT, _check_ins, _get_xml_et_value
class SynthTextDetectionDat... |
import os
from glob import glob
import numpy as np
import torch_em
from elf.io import open_file, is_group
from skimage.transform import rescale
from .util import download_source, update_kwargs
# TODO just download the full zip from https://osf.io/uzq3w/ instead
# but this is currently broken
URLS = {
"root": {
... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import json
import math
import os
import numpy as np
import tensorflow as tf
import argparse
from cleverhans.utils import set_log_level
from cleverhans.attacks import ElasticNetMethod, CarliniWagnerL2
from cl... |
import sys
import os
import re
import glob
import argparse
from pydub import AudioSegment
import scipy.io.wavfile as wavfile
from matplotlib import pyplot as mp
from pyAudioAnalysis import audioBasicIO as aIO
from pyAudioAnalysis import audioSegmentation as aS
def produceVisuals(filename,results):
print('drawing ... |
import cv2;
import numpy as np;
import os
import time
import multiprocessing as mp;
import Queue;
NUM_PROCESSES = 3
##customerize this function to find the images
def list_imgs_labels(file_dir, data): #data = train or test
imgs = [];
labels = [];
file_dir = os.path.join(file_dir, data);
#for f in os... |
#!/usr/bin/env python
# coding: utf-8
# In[1]:
#pip install playsound
# In[2]:
import cv2
import numpy as np
face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
eye_cascade = cv2.CascadeClassifier('haarcascade_eye_tree_eyeglasses.xml')
# In[3]:
def detect_eyes(img... |
# first order tools, find EPD, calculate system power, etc
from __future__ import division as __division__
import numpy as __np__
import matplotlib.pyplot as __plt__
def print_verbose(*args, verbose=False):
if verbose:
print(*args)
def start_end(Lens,start_surface=0,end_surface=0, verbose=False):
'''
return sta... |
# This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/gufe
import logging
# openff complains about oechem being missing, shhh
logger = logging.getLogger('openff.toolkit')
logger.setLevel(logging.ERROR)
from openff.toolkit.topology import Molecule as OF... |
"""
This module reads and parses the skin cancer MNIST data set captured in CSV files. It does not read the image files.
"""
from src.utils.constants import DATA_PATH
from src.utils.types import NP_DTYPE
import src.visualisation.plotters as vis
from csv import reader as csv_reader
import matplotlib.pyplot as plot
imp... |
#!/usr/bin/python
# vim:fileencoding=utf-8
# (c) 2017 <NAME> <<EMAIL>>
# Released under the terms of the 2-clause BSD license.
import itertools
from abc import abstractmethod
from collections import defaultdict
from operator import attrgetter
from .filter import transform_keyword_filters
from ..exceptions import Emp... |
# Copyright 2016 by <NAME> Technologies Corp. All Rights Reserved.
"""
Sequences for optimizing gating timing.
OBE: This assumes you modify the gateDelay on a generator. That is no longer a thing.
"""
from qgl2.qgl2 import qgl2decl, qreg
from qgl2.qgl1 import Id, X90, MEAS
from qgl2.util import init
@qgl2decl
def s... |
'''Conducts an evolutionary computation to develop better solvers'''
from random import Random
from time import time
from inspyred import ec
from GenerateMaze import *
from GenerateSolver import *
from MicroEC import *
def discard_useless(random, population, args): #removes obviously suboptimal solvers
ret... |
"""
>--#########################################################################--<
>---------------------Heat/Cold Wave Magnitude Index daily--------------------<
>------------------------Warm/Cold Spell Duration Index-----------------------<
>--#########################################################################... |
"""
Postprocessing data.
This aids in collecting, filtering, formatting and emitting data
acquired through the core machinery.
Extending pandas
================
- https://pandas.pydata.org/pandas-docs/stable/development/extending.html
"""
import logging
import pandas as pd
from urllib.parse import urlparse, parse_qs
... |
"""
Test a more in-depth usage of making and modifying a deeper structure and make
sure the attribute searches return the correct results after each change. This
is especially to confirm that the attribute cache feature is working.
"""
from typing import Any
import pytest
import sections
from sections import Section... |
import pytest
from sklearn.utils.estimator_checks import check_estimator
import scipy.sparse
import numpy as np
from textmap import WordMAP
from textmap import DocMAP
from textmap import TopicMAP
from textmap.vectorizers import (
DocVectorizer,
WordVectorizer,
FeatureBasisConverter,
JointWordDocVecto... |
import sys
import cv2
import numpy as np
import types
# from google.colab.patches import cv2_imshow #Google colab crashes if you try to display
# #image using cv2.imshow() thus use this import
def messageToBinary(message):
if type(message) == str:
return ''.join([format(ord(i), "08b") for i in message])
... |
from textwrap import dedent, indent
from typing import Mapping, Any
from hbutils.collection import nested_map
from hbutils.string import plural_word
from .base import BaseUnit, _to_unit, UnitProcessProxy, _UnitModel
from ..base import PValue, ParseResult, ParseError
class TransformUnit(BaseUnit):
"""
Overvi... |
import re
from collections import OrderedDict
from elifetools import utils as etoolsutils
from elifearticle import utils as eautils
TAG_REPLACEMENT_MAP = OrderedDict(
[
("italic", "i"),
("bold", "b"),
("underline", "u"),
]
)
def allowed_tags():
"tuple of whitelisted tags"
ret... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Create a HTCondor submit file from a CSV file.
Input is a file formatted as by Excel's CSV writing. We take this and, for
every row, write a job entry for an HTCondor submit file. Command names are
expected in the header row.
Columns with values that are the same in e... |
from flask import Flask , flash, redirect
# from flask.templating import render_template_string
from flask.templating import render_template, render_template_string
from datetime import datetime
from mymodel import db
from mymodel import User
from forms import LoginForm, SearchUserByName
app = Flask(... |
from outils.vizu_graphe import VizuGraphe
from outils.xile import File, Pile
from copy import deepcopy
class Dessin:
def __init__(self):
self.graphe = dict()
self.nb_m = 3
self.nb_c = 3
self.depart = Situation(self.nb_m,self.nb_c,'g',0,0)
self.gagnant = Situation(0,0,'... |
# encoding: utf-8
# 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
# "Licens... |
import construction as cs
import networkx as nx
import numpy as np
from scipy import stats
#compute_all_metrics
def compute_all_metrics(graphs_in,graphs_gen):
v_density,p_density = compute_average_ks(density,graphs_in,graphs_gen)
print("density \t %.3f %f"% (v_density,p_density))
v_glo_c,p_glo_c = compute... |
"""Load dict from json file. Make random pyglet imag from directory.
Image conversion functions.
"""
from __future__ import annotations
from typing import List
import json
import os
import random
import copy
from glob import glob
from PIL import Image
import pyglet # type: ignore
from loguru import logger
from rich.tr... |
#!/usr/bin/env python
#
# This file is part of the `zaster` software package.
# zaster is released under the MIT license (see LICENSE.txt)
#
# Copyright (c) 2015 - 2016 <NAME>
import collections
import optparse
import os
import sys
import xml.sax
PROG = os.path.basename(sys.argv[0])
class MissingRequiredAttributeE... |
# Copyright 2019 Xilinx Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
from flask import Flask, request, jsonify, render_template, redirect, url_for, Response
from argparse import ArgumentParser, SUPPRESS
import logging as log
import webbrowser, threading
from openvino.inference_engine import IEPlugin, IENetwork
import cv2
import numpy as np
import base64
from PIL import Image
import io
i... |
import os
from time import perf_counter
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import plotly.express as px
import torch
from ase import Atoms
from ase.calculators.dftd3 import DFTD3
from ase.cluster.cubic import FaceCenteredCubic
from ase.io import write
from torch_dftd.torch_dftd3_calc... |
import json
import re
from abc import ABC, abstractmethod
from pathlib import Path
from typing import Iterable, Optional, Final, Dict
import html2text as html2text
from gmail_fisher.gateway import GmailGateway
from gmail_fisher.models import (
GmailMessage,
UberEatsExpense,
BoltFoodExpense,
FoodExpens... |
from typing import Iterable, Optional
import numpy as np
import networkx as nx
from textworld.utils import check_modules
from textworld.logic import Proposition
missing_modules = []
try:
import plotly
import plotly.graph_objects as go
except ImportError:
missing_modules.append("plotly")
try:
import ... |
# Copyright 2020 Netflix, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... |
import sys
import argparse
import os
import toml
actions = {
"PART": R"\part{{{}}}",
"CHAPTER": R"\chapter{{{}}}",
"SUBSECTION": R"\subsection{{{}}}",
"SECTION": R"\section{{{}}}",
"NAME": """\directlua{{
names[\"{name}\"] = {{
nominative= \"{nom}\",
genitive= \"{gen}\",
... |
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys
from webdriver_manager.chrome import ChromeDriverManager
from credentials import load_credentials, login
from time import ... |
import torch
import math
def dct(x):
"""
Revised torch_dct.dct for PyTorch 1.8.x
"""
x_shape = x.shape
N = x_shape[-1]
x = x.contiguous().view(-1, N)
v = torch.cat([x[:, ::2], x[:, 1::2].flip([1])], dim=1)
if torch.__version__[:3] == '1.7':
Vc = torch.rfft(v, 1, onesid... |
import torch
from torch import nn
from ..classification.resnet import conv3x3x3, conv1x1x1
from ..classification.myronenko import MyronenkoEncoder, MyronenkoLayer, MyronenkoResidualBlock
from ..classification.decoder import MirroredDecoder
from ..autoencoder.variational import ConvolutionalAutoEncoder
class UNetEncod... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
**Project Name:** MakeHuman
**Product Home Page:** http://www.makehumancommunity.org/
**Github Code Home Page:** https://github.com/makehumancommunity/
**Authors:** <NAME>
**Copyright(c):** MakeHuman Team 2001-2019
**Licensing:** AG... |
import tensorflow as tf
import tensorflow_datasets as tfds
import sys
sys.path.append('..')
from trainer.config import config
AUTOTUNE = tf.data.experimental.AUTOTUNE
BUFFER_SIZE = config.buffer_size
BATCH_SIZE = config.bs
IMG_WIDTH = config.in_w
IMG_HEIGHT = config.in_h
def random_crop(image):
cropped_image = tf... |
import os
import unittest
from abc import ABC
from glob import glob
from shutil import rmtree
import numpy as np
from batchlib.workflows import run_cell_analysis, cell_analysis_parser
from batchlib.workflows.mean_and_sum_cell_analysis import mean_and_sum_cell_analysis
from batchlib.util import read_table, open_file, ... |
#!/usr/bin/env python
import isambard_dev,sys,subprocess,re, os
from ast import literal_eval
def pymol_align_protein2model(mobile,target,out_pdb,ampal_out=True):
pymol_command = ['pymol','-qc','align_protein2model.py','--',mobile,target,out_pdb]
if ampal_out == True:
subprocess.check_output(pymol_command)
protei... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ----------------------------------------------------------------------------
#
# TITLE : _figure
# PROJECT : starkplot
#
# ----------------------------------------------------------------------------
### Docstring and Metadata
"""**DOCSTRING**
TODO
- contextmanager w... |
from pathlib import Path
from itertools import chain
from alfred3.data_manager import DataManager
from alfred3.export import Exporter, find_unique_name
import click
class Extractor:
"""
Turns uncurated alfred data from json format into csv format.
Args:
in_path (str): Path to directory containin... |
import networkx as nx
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm
from networkx.algorithms import community
import random
import io
import zipfile
import urllib.request as urllib
def num(strings):
try:
return int(strings)
except ValueError:
return float(strings... |
#!/usr/bin/env python
"""Test suite for :py:mod:`plastid.bin.slidejuncs`"""
import tempfile
import shutil
import os
import itertools
import numpy
import copy
import shlex
from nose.tools import assert_set_equal
from nose.plugins.attrib import attr
from pkg_resources import resource_filename, cleanup_resources
from pla... |
################################################
# Ex1 #
# Project by: #
# Group 13 #
# <NAME> 81105 #
# <NAME> 81115 #
# <NAME> #
################################################
##############################################... |
import math
import ounce
import pytest
def test_all_units():
for x in ["in", "cm", "deg", "years"]:
assert x in ounce.all_units
for method in ["all_units", "factor", "convert"]:
assert method not in ounce.all_units
def test_all_units_classes():
assert set(ounce.all_units_classes) == set(... |
#!/usr/bin/python
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = '''
---
module: qem_task_status
short_description: Manage Qlik Replicate/Compose task status via Qlik Enterprise Manager (QEM)
version_... |
import os
import time
import glob
from copy import deepcopy
from flask import Flask, redirect, render_template, request, url_for, flash, session, jsonify
from werkzeug.utils import secure_filename
# custom libraries
from settings import GRID_SIZE, BOX_SIZE, UPLOAD_FOLDER, ALLOWED_EXTENSIONS
from imageProcessing impor... |
from flask import Flask, abort, request
from flask_cors import CORS
from influxdb import InfluxDBClient
from datetime import datetime, timedelta
import pytz
app = Flask(__name__)
CORS(app)
client = InfluxDBClient('localhost', 8086, database='telegraf')
SENSORS = [
('air', 0, 'pm25'),
('air', 0, 'temp'),
]
TI... |
import psycopg2
from configcust import config
from flask import Flask
import requests, json
def insertdata(datastream):
""" insert multiple vendors into the vendors table """
sql1 = "INSERT INTO currency(cur_id, cur_name, cur_sym, web_slg, rank, last_updated) VALUES(%s, %s, %s, %s, %s, %s)"
sql2 = "INSERT INTO sup... |
#==============================================================================
#
# This code was developed as part of the Astronomy Data and Computing Services
# (ADACS; https:#adacs.org.au) 2017B Software Support program.
#
# Written by: <NAME>, <NAME>, <NAME>
# Date: December 2017
#
# It is distributed under t... |
"""
Test synaptic connections between two different cell types.
usage: test_synapses.py [-h] [-t {simple,multisite}] [-c]
{sgc,tstellate,dstellate,tuberculoventral}
{bushy,tstellate,dstellate,octopus,tuberculoventral,pyramidal}
Compute AN only PSTH in postsynaptic cell... |
# -*- coding: utf-8 -*-
'''
#############################
Acme::MetaSyntactic::weekdays
#############################
****
NAME
****
Acme::MetaSyntactic::weekdays - The days of the week theme
***********
DESCRIPTION
***********
Days of the week, in various languages.
(Some letters have been brutally translitera... |
from .EmbThread import EmbThread
def get_thread_set():
return [
None, #EmbThreadJef(0x000000, "Placeholder", "000"),
EmbThreadJef(0x000000, "Black", "002"),
EmbThreadJef(0xffffff, "White", "001"),
EmbThreadJef(0xffff17, "Yellow", "204"),
EmbThreadJef(0xff6600, "Or... |
# suds-jurko library required
from collections import OrderedDict
import xml.etree.ElementTree as ET
from datetime import datetime, time
from django.utils import timezone
import logging
from suds.client import Client as SOAPClient
import json
SOAP_URL = r'http://graphical.weather.gov/xml/DWMLgen/wsdl/ndfdXML.wsdl'
l... |
import numpy as np
from ..util import three_dimensionalize, euclidean, unitize
from ..constants import log
from ..constants import tol_path as tol
from ..constants import res_path as res
from .intersections import line_line
def arc_center(points):
"""
Given three points of an arc, find the center, radius, no... |
"""
Tests for f(x) = (1 + x) sin(10 tanh(x)).
"""
from collections import OrderedDict
from experiments.experiment import Experiment
from models.hmc_samplers import HMCSampler, SGHMCSampler
from models.ld_samplers import LDSampler, SGLDSampler, pSGLDSampler
from experiments.synthetic.synthetic_env import SyntheticEnv
... |
from collections import defaultdict
from contextvars import ContextVar
from itertools import chain
import logging
import re
from time import time
from typing import Optional
from aiohttp import web
import prometheus_client
import sentry_sdk
from athenian.api import metadata
from athenian.api.metadata import __package... |
from __future__ import division, print_function, absolute_import
import os
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
import tflearn
from tflearn.data_utils import image_preloader
import numpy as np
import rasterio
import cv2
from scipy.misc import imread, imresize
import... |
import datetime
from unittest import mock
import pytest
from django.utils import timezone
from model_bakery import baker
from core.currencies import CURRENT_CURRENCY_SYMBOL
from ..models import Detour, Job
pytestmark = pytest.mark.django_db
def test_send_jobs_notification_email_to_all_users_with_routes(
clien... |
import argparse
import os
import sys
sys.path.append(os.getcwd())
from nas_lib.data import data
from nas_lib.trainer.trainer_retrain import NASBenchReTrain
from nas_lib.utils.comm import set_random_seed
from collections import defaultdict
import os
import pickle
from nas_lib.utils.comm import random_id, random_id_int, ... |
#!/usr/bin/env python3
# import math
import glob
import gzip
# import multiprocessing
import sys
from pathlib import Path
# import matplotlib.patches as mpatches
# import numpy as np
import pandas as pd
from astropy import constants as const
from astropy import units as u
# from collections import namedtuple
from fu... |
import numpy as np
import os
import os.path as osp
import torch
import torch_geometric
import torch_geometric.utils
from torch_geometric.data import Dataset, Data, Batch
from glob import glob
import pickle
import multiprocessing
# assumes pkl files exist in /test_tmp_delphes/data/pythia8_ttbar/raw
# they are processe... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.