text
stringlengths
3.07k
12.6k
#!/usr/bin/env python """ parses Nexus formatted tree files and Branchlength info in log files """ import re from collections import defaultdict from cogent3.parse.record import RecordError from cogent3.util.io import open_ __author__ = "<NAME>" __copyright__ = "Copyright 2007-2022, The Cogent Project" __credits_...
import torch import torch.nn as nn import torch.optim as optim from torch.autograd import Variable from torchvision import datasets, transforms import torch.nn.functional as F import torchvision.utils as vutils import math import time import torch.multiprocessing as multiprocessing from torch.nn.parallel impo...
# -*- coding: utf-8 -*- """ Presenters for API data. """ import collections import copy from pyramid import security class AnnotationBasePresenter(object): def __init__(self, annotation_resource): self.annotation_resource = annotation_resource self.annotation = annotation_resource.annotation ...
""" contains color utility functions and xterm color data """ # Default mapping of #ansixxx to RGB colors. ansicolors = { # dark '#ansiblack' : '#000000', '#ansidarkred' : '#7f0000', '#ansidarkgreen' : '#007f00', '#ansibrown' : '#7f7fe0', '#ansidarkblue' : '#40407f', # lighter than n...
import argparse import numpy as np import torch import os.path as osp import matplotlib.pyplot as plt from mmdet import cv_core from mmdet.cv_core import Config from mmdet.datasets.builder import build_dataset, build_dataloader def parse_args(): parser = argparse.ArgumentParser(description='Browse a dataset') ...
""" Modified from django.utils.translation.trans_real """ from __future__ import unicode_literals import re from django.conf import settings from django.urls import resolve from django.urls import Resolver404 from django.urls.resolvers import RegexURLResolver from django.utils.translation import get_language from dja...
# Copyright 2013 Hewlett-Packard Development Company, L.P. # 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...
#!/usr/bin/env python # encoding: utf-8 from httpdns.db import rds from httpdns.consts import HTTPDNS_IP_PREFIX, HTTPDNS_DOMAIN_PREFIX, HTTPDNS_SERVICE_PREFIX, DEFAULT_SP_NUM from httpdns.utils import ip2long class IP(object): ''' IP have three properties: sp -- service provider ip_addr -- ip address ...
"""Set of utility functions shared amongst the Stanford/JAXGM OSDF script suite """ __author__ = '<NAME> (cometsong)' __email__ = 'benjamin(at)cometsong(dot)net' import os import sys import csv import re import logging import time import importlib """Subprocess module wrappers""" from subprocess import call, check_...
import mock import ckan.model as model import ckan.lib.search as search from ckan.lib.create_test_data import CreateTestData from ckan.logic import get_action from ckan.tests.legacy import * from base import FunctionalTestCase class TestGroup(FunctionalTestCase): @classmethod def setup_class(self): ...
import tensorflow as tf import numpy as np def max_pool_2d_nxn_regions(inputs, output_size: int, mode: str): """ Performs a pooling operation that results in a fixed size: output_size x output_size. Used by spatial_pyramid_pool. Refer to appendix A in [1]. Args: inputs: A 4D Tensor (B, H...
""" Small utility to assist with test data setup. Subcommands: add-catalog <site> <path> Add all of the files in <path> to the File Catalog at site <site> clear-catalog Remove all files from the File Catalog clear-lta-bundles Remove all Bundles from the LTA DB clear-lta-transfer...
''' This file can be used to quickly setup the files needed to execute create_project.py Steps: - Move file setup.create_project_command.sh to home dir if it doesn't exist already - Get path to create_project.py - Move file setup.create_project_settings.txt to home dir if it doesn't exist already ...
# encoding: utf-8 import contextlib import os import shutil import alembic.command import click from alembic.config import Config as AlembicConfig import ckan from ckan.cli.db import _resolve_alembic_config import ckan.plugins.toolkit as tk import uuid import string import secrets from ckan.cli import error_shout ...
# # # # # # common.py # # Contains methods used across # multiple backend files # # University of Illinois/NCSA Open Source License # Copyright (c) 2015 Information Trust Institute # All rights reserved. # # Developed by: # # Information Trust Institute # University of Illinois # http://www.iti.illinois.edu # # Permiss...
""" This is the Lithophane Module written by <NAME>. Core of this module uses matlab-stl to write stl files written by <NAME>. """ import matplotlib.image as img import matplotlib.pyplot as plt import os import sys #from PIL import Image from skimage.transform import resize import numpy as np from mpl_toolkits i...
import pyfiglet import pandas as pd import matplotlib.pyplot as plt import seaborn as sns sns.set(style='white') from collections import defaultdict import numpy as np import click from tabulate import tabulate import logging logging.basicConfig() logging.getLogger().setLevel(logging.INFO) from nba_matchup import get_l...
from __future__ import print_function from __future__ import absolute_import from __future__ import division try: basestring except NameError: basestring = str from compas_rhino.forms.base import BaseForm import clr from System.Drawing import Size from System.Drawing import Point from System.Drawing import C...
################################################################################ # Copyright 2020 Advanced Micro Devices, Inc. All rights reserved. # # 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 So...
import numpy as np import cairo import random import math random.seed(0) np.random.seed(0) image_path = 'shapes/images' text_path = 'shapes/texts' WIDTH = 64 HEIGHT = 64 colors = { 'red': (1.0, 0.0, 0.0), 'green': (0.0, 1.0, 0.0), 'blue': (0.0, 0.0, 1.0), 'yellow': (1.0, 1.0, 0.0), 'orange': (1....
import json import logging import os import shutil import socket from os.path import join from hacksport.operations import execute from shell_manager.bundle import get_bundle, get_bundle_root from shell_manager.util import (BUNDLE_ROOT, DEPLOYED_ROOT, get_problem, get_problem_root, HACK...
"""Imports contact informations from Highrise into a local database.""" import os import sys import xml.etree.ElementTree as ET import requests from serlo.model import SerloDatabase, Email, PhoneNumber, Person, UnitType, \ WorkingUnit, Tag TOKEN_VARIABLE = "HIGHRISE_API_TOKEN" PROJECT_ID = ...
# # Copyright (c) 2022 Airbyte, Inc., all rights reserved. # import time from socket import socket from typing import Any, Dict, List, Mapping import docker import pytest from airbyte_cdk import AirbyteLogger from airbyte_cdk.models import ( AirbyteMessage, AirbyteRecordMessage, AirbyteStateMessage, ...
""" """ from __future__ import absolute_import, division, print_function, unicode_literals import numpy as np from astropy.utils.misc import NumpyRNGContext import pytest from .external_delta_sigma import external_delta_sigma from ..delta_sigma import delta_sigma, delta_sigma_from_precomputed_pairs from ..surface_de...
# -*- encoding: utf-8 -*- # # Copyright © 2020–2021 Mergify SAS # # 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 appl...
#!/usr/bin/env python # -*- coding: utf-8 -*- import math from functools import total_ordering from RedBlackTree.rbtree import RedBlackNode from RedBlackTree.rbtree import RedBlackTree import tensorflow as tf def from_logit_to_log_softmax( logits ): '''converts logit to softmax in Tensor of tensorflow''' ...
# Status: ported # Base revision: 64488 # # Copyright (c) 2005, 2010 <NAME>. # Copyright 2006 <NAME>. # # Use, modification and distribution is subject to the Boost Software # License Version 1.0. (See accompanying file LICENSE.txt or # https://www.bfgroup.xyz/b2/LICENSE.txt) # Provides mechanism for installing whole ...
# -*- coding: utf-8 -*- """ Continuously monitor the bioreactor and take action. This is the core of the dosing automation. To change the automation over MQTT, pioreactor/<unit>/<experiment>/dosing_control/automation/set with payload a json object looking like pioreactor.structs.Automation, ex: specify the new...
#!/usr/bin/env python # encoding: utf-8 # # Copyright © 2014 <EMAIL> # # MIT Licence. See http://opensource.org/licenses/MIT # # Created on 2014-04-06 # """ Run background tasks """ from __future__ import print_function, unicode_literals import sys import os import subprocess import pickle from workflow import Work...
#!/usr/local/bin/python # coding: utf-8 # Copyright (C) 2011-2012 FeatureSpaceTree Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 ...
from glob import glob from threading import Lock from time import sleep from mesh.exceptions import ConnectionFailed from mesh.transport.http import Connection from scheme import * from spire.core import Assembly from spire.exceptions import TemporaryStartupError from spire.runtime.registration import ServiceEndpoint...
import hmac import logging from smtplib import SMTPRecipientsRefused from django.db import models from django.conf import settings from django.utils.translation import ugettext_lazy as _, ungettext_lazy from django.core.urlresolvers import reverse from django.dispatch import receiver from django.template.loader import...
import numpy as np from sklearn.metrics.pairwise import euclidean_distances def gradient_descent(D, x0, loss_f, grad_f, lr, tol, max_iter): losses = np.zeros(max_iter) y_old = x0 y = x0 for i in range(max_iter): g = grad_f(D, y) y = y_old - lr * g stress = loss_f(D, y) ...
from __future__ import absolute_import import re import logging logger = logging.getLogger(__name__) # py2 vs py3 transition from ..six import text_type as unicode from ..six.moves.urllib import parse as urlparse from .base_adapter import BaseSiteAdapter, makeDate def getClass(): return FictionManiaTVAdapter d...
# -*- coding: utf-8 -*- # Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause from __future__ import absolute_import, division, print_function, unicode_literals from logging import getLogger from os.path import basename, dirname, isdir, isfile, join import re import sys from ..auxlib.ish import d...
#!/usr/bin/env python3 r""" Embroidermodder 2. ------------------------------------------------------------ Copyright 2013-2022 The Embroidermodder Team Embroidermodder 2 is Open Source Software. See LICENSE for licensing terms. ------------------------------------------------------------ ...
# Copyright 2010 New Relic, 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 writ...
import pytest @pytest.mark.issue(351) def test_issue351(en_tokenizer): doc = en_tokenizer(" This is a cat.") assert doc[0].idx == 0 assert len(doc[0]) == 3 assert doc[1].idx == 3 @pytest.mark.issue(360) def test_issue360(en_tokenizer): """Test tokenization of big ellipsis""" tokens = en_to...
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys from xml.etree import ElementTree from xml.etree.ElementTree import Element, SubElement from lxml import etree import codecs from libs.shapeType import shapeTypes import const class PascalVocWriter: def __init__(self, foldername, filename, imgSize, database...
# (c) 2020 <NAME> <<EMAIL>> # # Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or # https://www.apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT # or https://opensource.org/licenses/MIT>, at your option. This file may not be # copied, modified, or distributed except according to those te...
import numpy as np import func class Input: def __init__(self): self.output = None self.bias = None def propagate_forward(self, input_data, batch_size): output = self.flatten(np.array(input_data)).\ reshape(batch_size, int(len(self.flatten(np.array(input_data)))/batch_siz...
import asyncio import asyncio.subprocess as asp import dataclasses as dc import cloudpickle as cp from pathlib import Path import os import sys from hashlib import sha256 from .specs import Runtime def ensure_list(obj): if obj is None: return [] if isinstance(obj, list): return obj return...
# NOTE : The API / Client couple here is DUAL to rest (because most of it is callback, not callforward) # => the API is what the user should use directly (and not the client like for REST) import asyncio import typing from aiokraken.websockets.channelstream import SubStreamPrivate from aiokraken.websockets.channels...
# Copyright 2016 PerfKitBenchmarker 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...
#!/usr/bin/env python import datetime import json import re import sys from bs4 import BeautifulSoup import requests """billboard.py: Unofficial Python API for accessing music charts from Billboard.com.""" __author__ = "<NAME>" __license__ = "MIT" __maintainer__ = "<NAME>" __email__ = "<EMAIL>" HEADER...
# coding=utf-8 # Copyright 2019 The TensorFlow GAN Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
#!/usr/bin/env python2 # Copyright 2014 The Rust Project Developers. See the COPYRIGHT # file at the top-level directory of this distribution and at # http://rust-lang.org/COPYRIGHT. # # Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or # http://www.apache.org/licenses/LICENSE-2.0> or the MIT license #...
from __future__ import print_function __authors__ = "<NAME>, <NAME>" __copyright__ = "Copyright 2010-2012, Universite de Montreal" __credits__ = ["<NAME>", "<NAME>"] __license__ = "3-clause BSD" __maintainer__ = "<NAME>" __email__ = "<EMAIL>" from pylearn2.testing.skip import skip_if_no_gpu skip_if_no_gpu() import n...
# Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use ...
import csv import json import logging import os from typing import List from google.cloud import bigquery from google.oauth2 import service_account import google.api_core.exceptions from gatherers.gathererabc import Gatherer from utils import utils # Options: # # --timeout: Override the 10 minute job timeout (specif...
import pytest skimage = pytest.importorskip("skimage") import numpy as np import pandas as pd from datashader.bundling import directly_connect_edges, hammer_bundle from datashader.layout import circular_layout, forceatlas2_layout, random_layout @pytest.fixture def nodes(): # Four nodes arranged at the corners o...
# -*- Python -*- """Repository rule for NCCL configuration. `nccl_configure` depends on the following environment variables: * `TF_NCCL_VERSION`: The NCCL version. * `NCCL_INSTALL_PATH`: The installation path of the NCCL library. """ load( "//third_party/gpus:cuda_configure.bzl", "auto_configure_fail", ...
from uuid import uuid4 from django.db import models from django.db.models import Q, F from django.utils.translation import ugettext as _, ugettext_lazy from django.utils.text import slugify from reversion import revisions as reversion from ecs.authorization import AuthorizationManager from ecs.documents.models impor...
import os import time import shutil import platform import dateutil.parser import pytest from watchdog.observers import Observer from stixcore.data.test import test_data from stixcore.processing.pipeline import GFTSFileHandler from stixcore.soop.manager import HeaderKeyword, KeywordSet, SOOPManager, SoopObservationTy...
""" @module CAM workflow module """ import sys import wx import wx.lib.stattext import koko from koko.cam.inputs import INPUTS from koko.cam.machines import MACHINES from koko.cam.panel import OutputPanel from koko.themes import APP_THEME #############################################################...
# Lint as: python3 # Copyright 2020 The TensorFlow Probability Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required ...
# # Copyright (c) 2021, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed ...
from urllib.request import urlretrieve from zipfile import ZipFile import fiona import geopandas as gpd import requests from bs4 import BeautifulSoup from keplergl_quickvis import Visualize as Vis from pyproj import CRS from constants import DESIGNATION_TYPES from util import find_root PAD_PROJECTION = CRS( f"""...
# stdlib from enum import Enum from typing import List from typing import Optional # third party from google.protobuf.reflection import GeneratedProtocolMessageType from nacl.signing import VerifyKey # relative from ...... import deserialize from ...... import serialize from ......logger import critical from ......lo...
from flask import Flask, request, Response, send_from_directory, redirect, render_template from flask_cors import CORS import os from apis import api #from ontodoc import ontodoc from SchemaInMemory import SchemaInMemory from util.APIUtil import APIUtil from cache import cache app = Flask(__name__) # init the config ...
from __future__ import unicode_literals import re import logging import random import os.path import time from itertools import chain import boto3 from botocore.exceptions import ClientError from .util import memoize VOLUME_TYPES = set(['standard', 'gp2', 'io1', 'sc1', 'st1']) logger = logging.getLogger('ebs-snat...
#!/usr/bin/env python ############################################################################## # Copyright 2017-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. ################################...
# Copyright 2015 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
from uuid import uuid4 import json import logging from django.contrib.gis.geos import GEOSGeometry from django.contrib.gis.geos.error import GEOSException from django.db import transaction from django.db.models import Q from django.utils import timezone from geocontrib.models import Feature from geocontrib.models imp...
import os from django import template from django.shortcuts import reverse from django.utils.html import format_html, escape from django.utils.http import urlencode import html2text from project.models import AccessPolicy from notification.utility import mailto_url register = template.Library() @register.filter(n...
from configobj import ConfigObj import numpy as np from pypeit import par, msgs from astropy.io import fits from pypeit.par import pypeitpar from pypeit.spectrographs.util import load_spectrograph import argparse from IPython import embed import textwrap from pypeit import sensfunc import os # A trick from stackover...
"""Helpful Utilities""" import math import os import holodeck from holodeck.command import DebugDrawCommand try: unicode # Python 2 except NameError: unicode = str # Python 3 def get_holodeck_version(): """Gets the current version of holodeck Returns: (:obj:`str`): the current version ...
import asyncio import csv import logging import re import os import discord from discord.ext import commands from discord.utils import get # logging config logging.basicConfig( filename='.log/reg.log', format='%(asctime)s - %(message)s', level=logging.INFO, datefmt='%d-%b-%y %H:%M:%S', ) # set up chan...
"""JOSE utilities.""" import collections from cryptography.hazmat.primitives.asymmetric import rsa import OpenSSL import six class abstractclassmethod(classmethod): # pylint: disable=invalid-name,too-few-public-methods """Descriptor for an abstract classmethod. It augments the :mod:`abc` framework with ...
import unittest from legaliser import legalise, Many, Optional, AnyType from legaliser import LegaliserTypeException, LegaliserValueException from legaliser import LegaliserKeysNotPresentException, LegaliserTooManyKeysPresentException from legaliser import LegaliserCriteriaException, LegaliserCriteriaOtherException ...
"""The tests for the REST switch platform.""" import unittest from unittest.mock import patch, Mock import requests from requests.exceptions import Timeout, MissingSchema, RequestException import requests_mock from homeassistant.bootstrap import setup_component import homeassistant.components.sensor.rest as rest from...
#------------------------------------------------------------------------------ # # Copyright (c) 2009, Enthought, Inc. # All rights reserved. # # This software is provided without warranty under the terms of the BSD # license included in enthought/LICENSE.txt and may be redistributed only # under the conditions ...
# Copyright 2009 Google 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...
"""Converters and helper functions for session dates and times Time handling is unfortunately a bit complicated for several reasons: - Dates/times in the input API can come in several text formats, e.g. with seconds or timezones either included or left off. - A session's time is an interval with start and end times....
import abc import enum import io import os import pathlib import textwrap import warnings from collections import Mapping from typing import ( Any, Callable, Dict, List, Optional, Sequence, Union, NoReturn, Iterable, Tuple, ) import torch from torch.utils.data import IterDataPip...
import logging from copy import deepcopy from stanza.models.common.doc import Document from tuw_nlp.grammar.ud_fl import UD_FL from tuw_nlp.graph.utils import pn_to_graph, GraphMatcher from brise_plandok.annotation.attributes import ATTR_TO_CAT from brise_plandok.constants import SenFields from brise_plandok.extracto...
"""Patch extraction for images.""" # Copyright 2019 CSIRO (Data61) # # 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 ap...
# Adapted from https://discuss.pytorch.org/t/unet-implementation/426 import torch from torch import nn import torch.nn.functional as F from torch.optim import Adam from torch.optim.lr_scheduler import ReduceLROnPlateau import pytorch_lightning as pl from pytorch_lightning.metrics.functional import f1_score, precision_...
from dynamic_graph.sot.core.filter_differentiator import FilterDifferentiator from numpy import arctan2, imag, pi, real, unwrap from pylab import grid, plot, show, subplot, subplots_adjust, title, xlabel, ylabel, ylim def create_butter_lp_filter_Wn_05_N_2(name, dt, size): lp_filter = FilterDifferentiator(name) ...
from subprocess import check_call import os import shutil as sh from glob import glob import nbformat as nbf from nbclean import NotebookCleaner from tqdm import tqdm import numpy as np SITE_ROOT = os.path.expanduser('~/github/forks/python/teaching/dsep/jupyterhub-for-education-template') SITE_NAVIGATION = os.path.joi...
# Copyright (c) 2021 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...
import sys import pandas as pd import numpy as np from sqlalchemy import create_engine import warnings warnings.simplefilter('ignore') from nltk.corpus import stopwords from nltk.tokenize import word_tokenize from nltk.stem import WordNetLemmatizer from nltk.stem import PorterStemmer import re import nltk nltk.downloa...
import numpy as np import tensorflow as tf from patchwork.loaders import dataset from patchwork.feature._generic import GenericExtractor def _build_autoencoder(num_channels=3, conv_layers=[32, 48, 64, 128], dropout=0.5): """ """ # encoder inpt = tf.keras.layers.Input((Non...
from time import sleep import cv2 as cv import argparse import sys import numpy as np import os.path from glob import glob #from PIL import image frame_count = 0 # used in mainloop where we're extracting images., and then to drawPred( called by post process) frame_count_out=0 # used in post proce...
# -*- coding:utf-8 -*- """ auth.py ~~~~~~~~ 登录认证相关 2020/9/15 """ import pickle from functools import wraps from authlib.integrations.flask_client import OAuth from flask import abort, current_app, request, session from flask_login import LoginManager as _LoginManager, login_user, current_user from .e...
# coding=utf-8 # Copyright 2018 The TF-Agents Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
# -*- coding: utf-8 -*- """metadata_format.py""" # The newer version has all fields in earlier versions # TODO: Update to current version metadata_versions = { "1.3.2": { "detections": { "ID": { "a": { "similar_to": [{ # Is this correct:...
""" YouTube API interface""" import http import re import time from tempfile import NamedTemporaryFile import boto3 import httplib2 import oauth2client from django.conf import settings from googleapiclient.discovery import build from googleapiclient.errors import HttpError from googleapiclient.http import MediaFileUp...
# Licensed under the MIT license # http://opensource.org/licenses/mit-license.php # an internet radio media server for the Coherence UPnP Framework # based on the radiotime (http://radiotime.com) catalog service # Copyright 2007, <NAME> <<EMAIL>> # Copyright 2009-2010, <NAME> <jmDOTsizunATfreeDOTfr> from lxml...
""" SE-ResNet, SE_ResNeXt codes are gently borrowed from https://github.com/Cadene/pretrained-models.pytorch/blob/master/pretrainedmodels/models/senet.py """ import torch import torch.nn as nn import torch.nn.functional as F from torchvision import models from senet import se_resnext101_32x4d class BaseNetwork(nn.Mo...
import pytest import pandas as pd from matplotlib.figure import Figure from shapely.geometry import Point, LineString from plotly.graph_objs import Scattermapbox from pam.plot.plans import build_person_df, build_cmap, build_person_travel_geodataframe, build_rgb_travel_cmap, \ plot_travel_plans from pam.plot.stats ...
import os import numpy as np import json import random import math import argparse import params import torch import time import torch.utils.data as data from data_utils import * def worker_init(dataset, idx): print ('hello world') #dataset.file_list = [dataset.file_list[idx]] l = len(dataset.file_list) ...
""" Unit tests for utility functions in chaco.base """ import unittest from math import sqrt from numpy import arange, array from numpy.testing import assert_equal, assert_almost_equal from chaco.api import bin_search, find_runs, reverse_map_1d, point_line_distance class BinSearchTestCase(unittest.TestCase): def...
import requests import os from pathvalidate import sanitize_filename from bs4 import BeautifulSoup from urllib.parse import urljoin import json import argparse import time import logging def check_for_redirection(response): response.raise_for_status() if response.status_code != 200: raise requests.HT...
#!/usr/bin/env python3 # 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 # "...
# -*- coding: utf-8 -*- import copy import redis from nose.tools import eq_, ok_ from ddtrace import Pin, compat from ddtrace.contrib.redis import get_traced_redis, get_traced_redis_from from ddtrace.contrib.redis.patch import patch, unpatch from ..config import REDIS_CONFIG from ...test_tracer import get_dummy_trac...
""" Attention Model """ import torch import torch.nn as nn import torch.nn.functional as F __all__ = ['CompoundAttentionNet'] # The networks contained in this file. # Modules that we will utilize class Identity(nn.Module): # We will replace some SELayers with Identity Blocks def __init__(self): su...
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ## Created by: <NAME> ## ECE Department, Rutgers University ## Email: <EMAIL> ## Copyright (c) 2017 ## ## This source code is licensed under the MIT-style license found in the ## LICENSE file in the root directory of this source tree ##++++++++...
#!/usr/bin/env python3 import os import pathlib import re from collections import defaultdict from typing import Dict, List, Optional, TypeVar import jinja2 MAJOR_VERSION = re.compile(r"(\d+)\.\d+\.\d+") MINOR_VERSION = re.compile(r"\d+\.(\d+)\.\d+") PATCH_VERSION = re.compile(r"\d+\.\d+\.(\d+)") MAJOR_MINOR_VERSION ...
import argparse import logging import sys import typing from pdfminer.layout import LAParams from . import __doc__, __version__, process_file from .printer import Printer from .printer.markdown import MarkdownPrinter, GroupedMarkdownPrinter from .printer.json import JsonPrinter MD_FORMAT_ARGS = ['print_filename', '...