text stringlengths 3.07k 22.1k |
|---|
#Author-Autodesk Inc.
#Description-Caculate the intersections between the selected curve/surface/body/component/occurrence and curve/surface.
# non planar surface does not support for now
import adsk.core, adsk.fusion, traceback
import os
pi = 3.1415926
nearZero = 0.000001
# global set of event handlers to keep them ... |
#!/usr/bin/env python
# coding: utf-8
import json
from datetime import datetime
import os
import pandas as pd
import numpy as np
def filenames(path):
"""
get file names from json folder to derive with data and timestamp
"""
files = os.listdir(path)
files_lst = []
for f in files:
dt =... |
# Neural Network python module
# Written by <NAME> 2014
import sys, random, math
# Utility function to create an empty (zero) array of length n
def zeroArray(n):
return [0 for i in range(0, n)]
# A neural network class capable of saving/loading from a file,
# Training based on user-provided input-output data,
# an... |
import openseespy.opensees as ops
from math import pi,cos,cosh,ceil
from PyPonding.PondingLoadCell import PondingLoadCell2d
import numpy as np
import matplotlib.pyplot as plt
class PondingLoadCell2d_OPS(PondingLoadCell2d):
def __init__(self,id,nodeI,nodeJ,gamma,tw):
self.id = id
self.nodeI = nodeI
... |
# coding=utf-8
import unittest
import warnings
from mock import patch, Mock
from . import interface_factory
from . import api_details
from paypal.exceptions import PayPalAPIResponseError, PayPalConfigError
from paypal.interface import PayPalInterface
from paypal.response import PayPalResponse
interface = interface_... |
# based on https://github.com/openai/baselines/blob/master/baslines/common/atari_wrappers.py
import numpy as np
import os
os.environ.setdefault('PATH', '')
from collections import deque
import gym
from gym import spaces
import cv2
cv2.ocl.setUseOpenCL(False)
#from matplotlib import pyplot
class NoopResetEnv... |
import os
from typing import Callable
import numpy as np
import tensorflow as tf
from tensorflow.keras.layers.experimental import preprocessing
# Data reading and formatting
# =============================================================================
def replace_subset_with_uniform_images(sampling_prob: float) ->... |
import torchvision.transforms as transforms
import numpy as np
import pdb
from torch.utils.data import DataLoader, Dataset
from dl4d.datasets.pamap import PAMAP2
from dl4d.datasets.ucr import CROP, FordB, ElectricDevices
from dl4d.datasets.sits import SITS
from dl4d.datasets.wisdm import WISDM
from dl4d.datasets.cifa... |
"""
Set of helper functions to trace cubic and conic arcs described by true type fonts outlines. Each glyph can be
converted to a list of vertex arrays, each one representing a closed contour of the glyph outline. Vertex arrays
can be further processed to obtain a list of line segments that can be drawn in a plot or us... |
from numba import cuda
import numpy as np
import os
from sklearn.preprocessing import normalize
import time
import multiprocessing as mp
from math import ceil
import sys
import atexit
from scipy.interpolate import interp1d
from ctypes import cdll
import argparse
@cuda.jit
def calc_ROC(feature, label, subfeature, subla... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from operations import *
from torch.autograd import Variable
from sparse_max import sparsemax, sparsemoid, entmoid15, entmax15
#from genotypes import PRIMITIVES
from genotypes import Genotype
import time
from MixedOp import *
from Cell import *
class O... |
# <NAME>
# C950 submission
# WGU Student # 000955107
# Date = 2020/7/15
from datetime import datetime, timedelta
from Hash_Table import HashTable
from Package import Package
from Truck import Truck
import re
# Creates the global variables for this project (Hash Table, Time, Trucks)
receiveing = HashTable()
global_ti... |
import copy
import selfremarket
# class player:
# def __init__(self,name):
# self.name=name
# the Market Class contains the portfolio of all playes including production, consumption and contracts
# the optimization of the nomination is included "player-wise" by the make-nomination method
# , which changes t... |
import os, sys
import pygame
import constants as con
from shutil import copyfile
p = True
def is_int(mystring):
try:
temp = int(mystring)
return True
except:
return False
def clean_int(mystring):
if is_int(mystring): return int(mystring)
return mystring
def create_file(filepa... |
import os
import ssl
import datetime
import urllib
import zipfile
#from ecmwfapi import ECMWFDataServer
import cdsapi
def wind(input_path):
filename = 'ERA_wind.nc'
weather_path = os.path.join(input_path, 'weather')
os.makedirs(weather_path, exist_ok=True)
file = os.path.join(weather_path, filename)
... |
"""Various with-statement context utilities."""
import errno
import inspect
import os
import pickle
import signal
import subprocess
import sys
import threading
import traceback
from contextlib import AbstractContextManager, contextmanager
from importlib import import_module
from multiprocessing.connection import Pipe
... |
#!/usr/bin/env pypy3
"""
FlexAEADv1.py - this class is used to define the FlexAEADv1 cipher
Usage:
import FlexAEADv1
Options:
no options
"""
__author__ = '<NAME>'
__copyright__ = 'Copyright 2018-11-25'
__credits__ = ''
__license__ = 'MIT'
__version__ = '0.01'
__maintainer__ = ''
__... |
import curses
import sys
import threading
import time
import traceback
from .__main__ import (process_cpu_command, process_mem_command,
process_pid_command, process_stderr_command,
process_stdout_command, process_uptime_command)
from .units import Size, Time
CTRL_Z = 26
C... |
import logging
import uuid
from datetime import datetime
from django.contrib.auth.models import AnonymousUser, User
from django.contrib.auth.signals import (
user_logged_in,
user_logged_out,
#user_login_failed,
)
from django.contrib.contenttypes.models import ContentType
from django.utils.functional import... |
import sys, os
import numpy as np
import matplotlib.pyplot as plt
from utils import riemann_tools
f = lambda q: q*(1-q)
c = lambda q: 1 - 2*q
shock_speed = lambda qr, ql: (f(qr)-f(ql))/(qr-ql)
def exact_riemann_solution(q_l,q_r,D):
r"""
Exact solution to the Riemann problem for the LWR traffic model
with... |
import argparse
import os
import sys
import time
import math
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import gc
import common.data
from mos import model
from common.excavator import DataSelector
from common.utils import repackage_hidden... |
# Copyright 2019 Systems & Technology Research, LLC
# Use of this software is governed by the license.txt file.
import os
import imageio
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import make_axes_locatable
import numpy as np
import skimage.color
import skimage... |
# -*- coding: utf-8 -*-
## FileSync ##
from os import path
from os import system
import glob
## Config ##
PathOnC = ""
OrdnerName = "test"
print("\033[46m //####### ## // //####### \033[0m")
print("\033[46m // ## // // \033[0m")
print("\033[46m //##### ## // //######... |
import requests
from musicbrainzngs import musicbrainz as mb
from requests.adapters import HTTPAdapter
from .ceimport import cache
mb.set_useragent('trompa', '0.1')
s = requests.Session()
adapter = HTTPAdapter(max_retries=5, pool_connections=100, pool_maxsize=100)
s.mount("https://", adapter)
s.mount("http://", ada... |
"""
.. py:module:: tmc_http_server
:platform: *nix
:synopsis: Defines a HTTP server designed for monitoring
multithreaded Python3 applications. Altough we strive
to be production-grade for the intended use case, this
server is no meant to e.g. handle a RESTful API backend.
The AP... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for the `cube` module."""
# Copyright 2020, <NAME> (<EMAIL>)
#
# Reuse is permitted under the terms of the license.
# The AUTHORS file and the LICENSE file are at the
# top level of this library.
import contextlib
import unittest
from pathlib import Path
import... |
import os.path as osp
from math import ceil
import torch
import torch.nn.functional as F
from torch_geometric.datasets import TUDataset
import torch_geometric.transforms as T
from torch_geometric.data import DenseDataLoader
from torch_geometric.nn import DenseSAGEConv, dense_diff_pool
import IPython
import sys
torch.... |
# Copyright 2002 by <NAME>. All rights reserved.
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
# This module was deprecated, as it does not seem to have any users,
# no documentation, and the exam... |
# aws-pcf-quickstart
#
# Copyright (c) 2017-Present Pivotal Software, Inc. All Rights Reserved.
#
# This program and the accompanying materials are made available under
# the terms of the under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may ... |
#coding=utf-8
import glob,os,sys,re,subprocess,platform
def print红(*kw):
print("\033[0;31m",*kw,"\033[0m")
def print绿(*kw):
print("\033[0;32m",*kw,"\033[0m")
def print黄(*kw):
print("\033[0;33m",*kw,"\033[0m")
def print蓝(*kw):
print("\033[0;34m",*kw,"\033[0m")
def print紫(*kw):
print("\033[0;35m",*k... |
"""Autoupdate older conda dependencies in the requirements section."""
from __future__ import absolute_import
import collections
import re
import xml.etree.ElementTree as ET
from galaxy.tool_util.deps import conda_util
import planemo.conda
from planemo.io import error, info
def find_macros(xml_tree):
"""
G... |
'''
Classes for accessing and manipulating structured data
'''
import json
import os
from collections import namedtuple, OrderedDict
from collections.abc import Mapping
from datetime import datetime, timezone
from hods import (
HashMismatchError,
__name__ as _top_level_module,
)
from hods._lib.hash import da... |
from __future__ import print_function
import os
import torch
import torch.optim as optim
import torch.backends.cudnn as cudnn
import argparse
import torch.utils.data as data
import time
import datetime
import math
import sys
sys.path.append(os.path.realpath(__file__).replace('/train_retinaface.py', ''))
from models.ret... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
r"""
This bot removes sections from a page and store the removed text in a local
file.
This bot takes a list of headings as input and removes the sections with a
matching title from a list of pages.
Specific parameters:
-always Don't prompt for confirmation befor... |
"""Constraints for the study with synthetic constraints
Classes representing generators of certain types of constraints.
Each class is able to evaluate its constraint type on a given feature-selection problem.
"""
from abc import ABCMeta, abstractmethod
import random
from typing import Optional, Sequence
import pand... |
"""
Copyright (c) Contributors to the Open 3D Engine Project.
For complete copyright and license terms please see the LICENSE at the root of this distribution.
SPDX-License-Identifier: Apache-2.0 OR MIT
"""
# Test case ID : C4976209
# Test Case Title : Verify that when Compute COM is enabled, the PhysX system comput... |
"""
This file contains code to run beam search decoding.
"""
import numpy as np
import os
import data
import language_check
class Hypothesis(object):
"""
Class to represent a hypothesis (partial output of a summary) during beam search. Holds all
the information needed for the hypothesis.
"""
de... |
import logging
import math
import os
import string
import re
import unicodedata
from enum import Enum
from typing import List
import pythoncommons.file_utils as fileutils
LOG = logging.getLogger(__name__)
def auto_str(cls, with_repr=True):
def __str__(self):
return "%s(%s)" % (type(self).__name__, ", ".... |
import base64
import io
import mimetypes
from datetime import datetime
import pytz
from PIL import Image
from boto.s3.connection import S3Connection
from boto.s3.key import Key
from django.conf import settings
from django.contrib.gis.geos import Point
from django.forms.models import model_to_dict
from django.shortcut... |
"""Module to hold the logger instances themselves."""
import logging
import re
import shutil
import subprocess
import sys
from buildscripts.resmokelib import config
from buildscripts.resmokelib import errors
from buildscripts.resmokelib.core import redirect as redirect_lib
from buildscripts.resmokelib.logging import ... |
import collections
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
MAXLOG = 0.1
GENERATORCONFIGS = {
# hidden_dimension, latent_dimension, input_channel, n_class, noise_dim
"cifar10": (512, 64, 3, 10, 64),
"cifar100": (512, 32, 3, ... |
#! /usr/bin/env python
import base64
from bson import Binary
import gevent
import gevent.monkey
import gevent.pool
import json
import multiprocessing
from multiprocessing import Process
import os.path
from oplog_applier import _op_id
import pymongo
import random
import time
import utils
from utils import squelch_keyboa... |
from typing import Any, Dict, Optional, Tuple, Union
import numpy as np
import torchvision.transforms
from autoPyTorch.datasets.base_dataset import BaseDataset
from autoPyTorch.datasets.resampling_strategy import (
CrossValFuncs,
CrossValTypes,
HoldOutFuncs,
HoldoutValTypes
)
TIME_SERIES_FORECASTING... |
def firstValid(*iterable):
'''Return the first non-None value in the list
'''
try:
return list((el for el in iterable if el is not None))[0]
except:
return None
def lcase_keys(d):
'''Return a dictionary object with all keys having been lowercased
'''
return dict(([k.lower(),... |
import os
import subprocess
from fnmatch import fnmatch
import importlib
from ruamel import yaml
import os_utils
import verif_utils
import module_utils
# vivado settings
vivado_ver = "2019.1"
vivado_path = {
"win_local": r"C:\Xilinx\Vivado\{}\bin".format(vivado_ver),
"linux_local": r"/tools/Xilinx... |
# coding: utf-8
# # Test pyIAST for match with competitive Langmuir model
# In the case that the pure-component isotherms $N_{i,pure}(P)$ follow the Langmuir model with the same saturation loading $M$:
#
# $N_{i,pure} = M \frac{K_iP}{1+K_iP},$
#
# The mixed gas adsorption isotherm follows the competitive Langmuir iso... |
import os
from collections import deque
import freetype as ft
import matplotlib.pyplot as plt
import numpy as np
from igibson import assets_path
class Character(object):
"""
Manages data for a single character.
"""
def __init__(self, tex_id, size, bearing, advance, buffer):
"""
:par... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = "<NAME>"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
__copyright__ = "Copyright (C) 2020, Nokia"
__license__ = "BSD-3"
from collections import defaultdict
from pybgl.property_map import make_assoc_property_map
from pybgl.automaton import make_automaton
... |
# Copyright 2018 The Imaging Source Europe GmbH
#
# 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 ... |
'''
This streamlit app shows information about GitHub forks.
'''
import streamlit as st
import requests
import json
import os
import matplotlib.pyplot as plt
import plotly.express as px
import plotly.graph_objects as go
if os.path.exists('./.streamlit/secrets.toml'):
# read GITHUB_AUTH_TOKEN from secrets.toml... |
from __future__ import absolute_import
import os
import threading
import logging
import time
try:
import queue
except ImportError:
import Queue as queue
import torch
import horovod.torch as hvd
from horovod.torch.mpi_ops import size, rank, broadcast_async, synchronize
from ..common.bytecore import core
from .ho... |
# encoding: utf-8
"""
version=0.1
Match工具包
Utiltool : 工具类包含各种常用工具 比如日志 状态条等
dataMaker : 数据生成工具 采用多进程方式生成数据
"""
import os
import math
import sys
import shutil
import logging
import time
import sys
import ctypes
import multiprocessing
import numpy as np
import inspect
import matplotlib.pyplot as plt
import imgaug as ia
... |
import math
import re
from typing import Any, Iterable, List, NamedTuple, Tuple, Union
import xml.etree.ElementTree as etree
import geojson as geo
import networkx as nx
EARTH_RADIUS = 6378137 # In meters
MERCATOR_WIDTH = 2.5 * EARTH_RADIUS
DEGREES_PER_RADIAN = 180 / math.pi
LONGITUDE_FACTOR = DEGREES_PER_RADIAN / E... |
from __future__ import print_function
from constant import *
from models import *
from dataset import *
from utils import f_score
import os
import sys
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from sklearn.metrics import f1_score,precision_score,re... |
"""
Usage
export GST_PLUGIN_PATH=$GST_PLUGIN_PATH:$PWD/venv/lib/gstreamer-1.0/:$PWD/gst/
export GST_DEBUG=python:4
gst-launch-1.0 filesrc location=video.mp4 ! decodebin ! videoconvert ! \
gst_tf_detection config=data/tf_object_api_cfg.yml ! videoconvert ! autovideosink
"""
import os
import logging... |
from random import choice, randint
from operator import itemgetter
from itertools import islice
from string import ascii_uppercase
def choices(items, k):
"""Reimplementation of random.choices to support older versions of Python"""
ret = []
for _ in range(k):
ret.append(choice(items))
return ret... |
"""Basis for core game logic."""
from __future__ import annotations
import abc
import random
import secrets
from collections.abc import Iterable
from collections.abc import Iterator
from collections.abc import Sequence
from typing import Any, Optional, overload, TYPE_CHECKING
from tetris.types import Board
from tetr... |
import os
import pytest
from archetypal import Schedule, load_idf, copy_file, run_eplus
def test_schedules_in_necb_specific(config):
files = [
'tests/input_data/regular/NECB 2011-MediumOffice-NECB HDD '
'Method-CAN_PQ_Montreal.Intl.AP.716270_CWEC.epw.idf']
idfs = {os.path.basename(file): loa... |
import json
import os
import string
import subprocess
import time
from typing import Union
import pytz
from django.conf import settings
from django.http import HttpResponse
from loguru import logger
from rest_framework import status
from rest_framework.response import Response
from agents.models import Agent
logger.... |
from NCAABracketMaker.utilities import bracketpath, simbracketpath, teampath, modulepath
import yaml
from NCAABracketMaker.AnalyzeGame import whoWins
from math import pow
import pandas as pd
import os
from openpyxl import load_workbook
def roundResults(teams, rnd, teamdatadf, pointcof, wincof, rankcof, ratiocof):
... |
import inspect
import re
import typing
import datetime
import decimal
import uuid
from stark import http, document, exceptions
from stark.server.utils import import_path, parse_docstring
from stark.schema import (
is_field,
is_schema,
Any,
Array,
Boolean,
Date,
DateTime,
Decimal,
Flo... |
# Copyright 2016 Battelle Energy Alliance, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... |
#!/bin/bash/python3
# cosine_art.py
from os import path
import imageio
import argparse
from tqdm import tqdm
import numpy as np
def main(args):
img = np.asarray(imageio.imread(args.input))
if len(img.shape) == 3 and img.shape[-1] == 4: # last dimension is alpha
img = img[:, :, :3]
if len(img.shape) == 3 and img... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may... |
import datetime
from copy import deepcopy
from enum import Enum
from typing import Dict
import sqlparse
from pypika import Criterion, Field
from pypika.terms import LiteralValue
from sqlparse.tokens import Error, Name, Punctuation
from metrics_layer.core.model.base import MetricsLayerBase
from metrics_layer.core.mode... |
from bs4 import BeautifulSoup as bs
from bs4 import Comment, Tag, NavigableString
import requests
import re
import logging
import os
from format_filename import formatFilename
# Use this file to crawl fangal.org/short
def get_indent(replyItem):
# replyItem: bs4.element.Tag object
indents = 0
try:
... |
# -*- coding: utf-8 -*-
"""Tests for the main app."""
from __future__ import (
absolute_import, division, print_function, unicode_literals,
)
import itertools
import json
import logging
import os
import subprocess
from unittest import TestCase
import jupyter_core.paths
import nose.tools as nt
from jupyter_contri... |
import os
import time
import argparse
import torch
import torch.optim as optim
import torch.nn as nn
import torch.utils.data as data
import torch.distributed as dist
import torch.multiprocessing as mp
import torch.utils.tensorboard as tb
import torch.cuda.amp as amp
import torchvision
from tqdm import tqdm
import u... |
#! /usr/bin/env python3
#
# Extract gene mention candidates and perform distant supervision
#
import fileinput
from dstruct.Mention import Mention
from dstruct.Sentence import Sentence
from helper.dictionaries import load_dict
from helper.easierlife import get_all_phrases_in_sentence, \
get_dict_from_TSVline, TSV... |
# -*- coding: utf-8 -*-
"""
Created on Sat Apr 14 14:48:42 2018
"""
from datetime import datetime
import pandas as pd
import matplotlib.pyplot as plt
def todays_date():
"""Returns today's date in 'YYYYMMDD' format"""
todays_date = datetime.now()
if todays_date.month <10:
month = '0'+str(... |
import discord
import time
import psutil
from discord.ext import commands as cmd
import teapot
def __init__(bot):
""" Initialize commands """
helpcmd(bot)
info(bot)
ping(bot)
prune(bot)
kick(bot)
ban(bot)
admin(bot)
owner(bot)
debug(bot)
def helpcmd(bot):
bot.remove_comm... |
import logging
import multiprocessing
import os
import time
from datetime import timedelta
from django.conf import settings
from django.core.management.base import BaseCommand
from django.db import close_old_connections, reset_queries
from django.utils.encoding import force_text, smart_bytes
from django.utils.timezon... |
"""
Provides a class to manage a remote connection via the host's connector.
Stores state along with the connection.
"""
from __future__ import annotations
from copy import copy
from types import TracebackType
from typing import Type, cast, Optional
import fora
from fora import logger
from fora.connectors.connector ... |
from itertools import compress
import argparse
import sys
import numpy as np
import os
import subprocess
import re
from numpy.random import RandomState
import logging
from subprocess import PIPE
from collections import defaultdict
from BayesPaths.UnitigGraph import UnitigGraph
from BayesPaths.UtilsFunctions import... |
""" Program to generate all 2xN flat foldable maps for a given N
In general, assume left-most horizontal crease is a valley
Real answer = final answer * 2
Implementation details:
- each "face" is a tuple (column, row) (a.k.a (x,y)) whose entries are INTS (start @ (1,1))
- graph will be a dictionary whose values are ... |
import numpy as np
from scipy.spatial.distance import cdist
try:
# Python 2
xrange
except NameError:
# Python 3, xrange is now named range
xrange = range
def fitLamp(self, X):
sample_size = int(np.sqrt(X.shape[0]))
ctp_ids = np.random.randint(0, high=X.shape[0], size=(sample_size,)) #list of indexes
... |
# -*- coding: utf-8 -*-
"""
utils - List of utility functions for tools.
"""
from __future__ import unicode_literals
import logging
import sys
import codecs
from lgr import text_type
from lgr.utils import cp_to_ulabel
from lgr.parser.xml_parser import XMLParser
from lgr.tools.merge_set import merge_lgr_set
logger = ... |
#!/usr/bin/python3
# This file is part of Cockpit.
#
# Copyright (C) 2016 Red Hat, Inc.
#
# Cockpit is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your opti... |
import tempfile
import time
import logging
from collections import OrderedDict
from .exceptions import RateLimitError
try:
import fiona # try importing fiona directly, because otherwise geopandas defers errors to later on when it actually needs to use it
import geopandas
GEOPANDAS_AVAILABLE = True
except ImportEr... |
# Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... |
import bitmex
import winsound
import json
import threading
from datetime import datetime
class Tick():
def __init__(self, time, price):
self.time = time
self.price = price
class bcolors:
OKBLUE = '\033[0;36;44m'
OKGREEN = '\033[0;30;42m'
OKRED = '\033[4;33;41m'
END... |
# -*- coding: utf-8 -*-
import json
from typing import List
import MySQLdb
from interpro7dw import logger
from interpro7dw.ebi.interpro import production as ippro
from interpro7dw.ebi.interpro.utils import Table
from interpro7dw.utils import Store, loadobj, url2dict
def get_entry_databases(url: str) -> List[str]:
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
from lexer import *
from parser import *
class ParserTest(unittest.TestCase):
def setUp(self):
self._parser = Parser(Lexer())
def parseToStr(self, string):
ast = self._parser.parse(string)
res = ast.eval({})
return st... |
'''Generates an undirected graph in d3-force-graph format based on user inputs
Args:
--nodes, -n: integer (required)
Number of nodes in network.
--edge-density, -ed: float [0, 1] (optional, default: .5)
Density from [0, 1] of edges to create.
0 means no edges, 1 means fully-connected gr... |
from shapely.geometry import Polygon
from collections import Counter
from src.services.horizontal_merging import horzontal_merging
from rtree import index
import copy
import numpy as np
import src.utilities.app_context as app_context
import uuid, os, io, sys
class MapKeys:
def __init__(self):
self.left =... |
##
# Copyright (c) 2010-2017 Apple Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... |
from ..core.serialization.addressjson import AddressJson
from ..core.serialization.attachmentjson import AttachmentJson
from ..core.serialization.customheaderjson import CustomHeaderJson
from ..core.serialization.injectionrequest import InjectionRequest
from ..core.serialization.mergedatajson import MergeDataJson
from ... |
import torch
from torch import nn
from torch.nn import functional as F
from torch.nn.utils.spectral_norm import spectral_norm
from networks.base_network import BaseNetwork
from networks.normalization import ALIASNorm
from networks.cnn_networks import FeatureRegression, FeatureCorrelation, FeatureExtraction
fro... |
# "fantasypros.py"
import pandas as pd
from bs4 import BeautifulSoup
from fantasyfootball.config import DATA_DIR, DRIVER_PATH
import requests
from os import path
from datetime import date
import sys
import fantasyfootball.config as config
import fantasyfootball.ffcalculator as ffcalculator
from matplotlib import pyplo... |
#!/usr/bin/env python3
from pathlib import Path
import regex as re
DATA = {
"authors": {
"<NAME>": "<EMAIL>",
},
"maintainers": {
"<NAME>": "<EMAIL>"
},
"owner": "Learning Algorithms and Systems Laboratory, EPFL, Switzerland",
"owner_website": "lasa.epfl.ch",
"project_nam... |
'''
Note: due to sluggish performance, the highlighter will be broken
up into a Qt element and the regex processing block. The regex part
should be independent and safe to run in a thread, and will return
a list of highlighting rules to feed into the qt block in the
main thread.
Performance notes:
For a t file, or... |
import math
import midiutil as midi
import numpy as np
from scipy import signal
import soundfile as sf
import matplotlib
matplotlib.use("TkAgg")
import matplotlib.pylab as plt
import audioplayer
import instrument
# Whether to plot the returned signals.
debug = False
class AudioProcessor:
"""Handles direct proce... |
#!/usr/bin/env python
# coding: utf-8
# # Social Network Analysis on BTS Fandom in Python
# In[1]:
import tweepy
import json
import pandas as pd
from pandas.io.json import json_normalize
import time
get_ipython().run_line_magic('matplotlib', 'inline')
import matplotlib.pyplot as plt
import networkx as nx
import num... |
import os
import datetime
import csv
import numpy as np
from collections import namedtuple
import raman.raman as rm
import raman.utilities as ut
from mpl_toolkits.mplot3d import axes3d
import matplotlib.pyplot as plt
from matplotlib import cm
def raman_gain_efficiency_from_csv(csv_file_name):
with open(csv_file_nam... |
""" Media system utility functions """
__author__ = '<NAME>'
__copyright__ = 'Copyright 2015, <NAME>'
__licence__ = 'BSD-3'
__email__ = '<EMAIL>'
from django.core.exceptions import ValidationError
from django.conf import settings
from ninecms.utils.transliterate import transliterate
from subprocess import check_output... |
import numpy as np
import tensorflow as tf
from keras import initializers
from keras.models import Model
from keras.layers import Embedding, Input, Dense, Flatten, concatenate, Dot, Lambda, multiply, Reshape, merge
from keras.optimizers import Adagrad, Adam, SGD, RMSprop
from keras import backend as K
from evaluate imp... |
import json
import logging
import math
import random
from datetime import datetime
from googleapiclient.discovery import build
from googleapiclient.errors import HttpError
from sqlalchemy import func
from rdr_service import config
from rdr_service.cloud_utils.bigquery import BigQueryJob
from rdr_service.cloud_utils.g... |
from contextlib import contextmanager
import os
import os.path as op
import tempfile
import unittest
import h5py
import numpy as np
from numpy.testing import assert_equal
from scipy.sparse import coo_matrix, eye
import sdafile
from sdafile.utils import get_decoded
DATA_DIR = op.join(op.abspath(op.dirname(sdafile.__... |
import sys
from ..generic import iterate_commands_and_outputs, run_command
from .. import utils
from .targets import get_settings
import subprocess
import time
import threading
from signal import signal, getsignal, SIGINT
from typing import List
from types import ModuleType
CTRL_C = False
original_sigint_handler = ... |
# Copyright (c) 2020. <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
# associated documentation files (the "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish, distribu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.