text stringlengths 3.07k 22.1k |
|---|
#!/usr/bin/env python
'''
Redmine endpoints
'''
from flask import (jsonify, request, Response, current_app)
from ooiservices.app.redmine import redmine as api
from ooiservices.app.main.authentication import auth
from ooiservices.app.decorators import scope_required
from collections import OrderedDict
from redmine imp... |
from pyroutelib3 import Router
import click
import sys
import attr
import osmnx as ox
import networkx as nx
import numpy as np
import matplotlib.pyplot as plt
from src.traffic_planner import EdgeData, solve_milp, get_speed_delta, SolutionNotFound
def meters_to_miles(meters):
return meters * 0.0006213712
def _... |
import os
import gzip
import zipfile
from urllib import request
import yaml
import numpy as np
from sklearn.datasets import make_classification
from sklearn.model_selection import train_test_split
from ilp.constants import DATA_DIR
CWD = os.path.split(__file__)[0]
DATASET_CONFIG_PATH = os.path.join(CWD, 'datasets.ym... |
import argparse
from datetime import datetime
from logging import Logger, DEBUG
from os.path import abspath, join
import threading
from typing import Dict, List, Tuple
from qcore import constants as const
from qcore import qclogging
from qcore.utils import load_yaml
from scripts.cybershake import queue_monitor
from s... |
# -*- coding: utf-8 -*-
import itertools
from prompt_smart_menu.helpers import InvalidArgError, Kwarg, NestedDict
from prompt_smart_menu.smart_menu import MenuNode
import pytest
def dummy(*args, **kwargs):
pass
class TestMenuNode:
_nest = {'prompt': {'toolkit', 'menu'}, 'exit': None}
def test_init_c... |
#!/usr/bin/env python
# charset: utf-8
# by Qige <<EMAIL>> since 2018.03.02
import time
import random
from optparse import OptionParser
import json
import requests
'''
Simulate ARN Device Agent
1. post "sync"
2. post "report" but abb is idle
3. post "report" with abb connected
'''
class ARNDeviceS... |
""" An OpenAI gym environment that uses a WorldModel trained on DonkeyCar data as the environment.
To pass in the arguments needed during environment creation:
your_env = gym.make('DKWMEnv', vae=vae_object, ...etc...)
From: https://stackoverflow.com/questions/54259338/how-to-pass-arguments-to-opena... |
# Copyright (c) nexB Inc. and others. All rights reserved.
# http://nexb.com and https://github.com/nexB/vulnerablecode/
# The VulnerableCode software is licensed under the Apache License version 2.0.
# Data generated with VulnerableCode require an acknowledgment.
#
# You may not use this software except in compliance ... |
from __future__ import absolute_import
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
import numpy as np
from ._segmentation import _ve_step, _interaction_energy
NITERS = 10
NGB_SIZE = 26
BETA = 0.1
nonzero = lambda x: np.maximum(x, 1e-50)
log = lambd... |
# Copyright (c) 2021 The Trade Desk, Inc
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following discl... |
import happyforms
from django import forms
from django.db.models import Q
from django.conf import settings
from django.contrib.auth.models import User
from django.core.exceptions import ValidationError
from django.core.validators import MinValueValidator
from django.utils.timezone import make_naive, now
from product_de... |
# Copyright (c) 2019 <NAME>.
# Full license can be found in the top level "LICENSE" file.
import numpy as np
from toast.pipeline_tools import Telescope, Focalplane, Site, Schedule, CES
from toast.timing import function_timer, Timer
from toast.utils import Logger
from .. import hardware
FOCALPLANE_RADII_DEG = {"LAT... |
#!/usr/bin/env python
# <NAME>
# <EMAIL>
#
########################################################################
# Copyright 2013 Mandiant
# Copyright 2014,2018 FireEye
#
# Mandiant licenses this file to you under the Apache License, Version
# 2.0 (the "License"); you may not use this file except in compliance with... |
# original implementation: https://github.com/odegeasslbc/FastGAN-pytorch/blob/main/models.py
#
# modified by <NAME> for "Projected GANs Converge Faster"
#
import torch.nn as nn
from pg_modules.blocks import (InitLayer, UpBlockComp, UpBlockCompCond, UpBlock, UpBlockCond, SEBlock, conv2d)
def normalize_second_moment(x... |
#!/usr/bin/env python
"""
generate_geuvadis_sims.py
<NAME> / November 28, 2014
Based heavily on generate_bioreps.py
Generates 660 GEUVADIS sims for Rail paper using Flux Simulator by:
1) starting a single Flux simulation and interrupting the pipeline after
6 columns of a PRO file P have been written.
2) reading R... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import os
import random
import numpy as np
import pytest
from astropy.wcs import WCS
from astropy.io.fits import Header
from numpy.testing import assert_allclose
from ... import reproject_exact, reproject_interp
from ..coadd import reproject_and_coadd
... |
""" Direct tests of fixes to wheels """
import os
import sys
from os.path import (join as pjoin, basename, realpath, abspath, exists, isdir)
import stat
from glob import glob
import shutil
from subprocess import check_call
from ..delocating import (DelocationError, delocate_wheel, patch_wheel,
... |
# (C) Quantum Economic Development Consortium (QED-C) 2021.
# Technical Advisory Committee on Standards and Benchmarks (TAC)
#
# 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.... |
import os
import warnings
import numpy as np
from pyrates.utility.genetic_algorithm import CGSGeneticAlgorithm
from pandas import DataFrame, read_hdf
from copy import deepcopy
class CustomGOA(CGSGeneticAlgorithm):
def eval_fitness(self, target: list, **kwargs):
# define simulation conditions
wor... |
from abc import ABCMeta, abstractmethod, abstractproperty
from collections import defaultdict, Counter
import numpy as np
from numpy.testing import assert_approx_equal
def last_k(tokens, k):
"""Get the last k elements of a list as a tuple."""
if not (0 <= k <= len(tokens)):
raise ValueError('k must b... |
# coding=utf-8
import re
import random
import base64
import itertools
import concurrent.futures
import difflib
import logging
from urllib import parse
from lib.sqldb import Sqldb
from lib.settings import *
from lib.cli_output import *
from lib.Requests import Requests
class Cartesian(object):
def __init__(self):... |
# C generation
import datetime
import os
import time
datestring = datetime.datetime.utcfromtimestamp(
int(os.environ.get('SOURCE_DATE_EPOCH', time.time())))
input_filename = 'inputfil'
top_boilerplate = '''\
/*
* VLIB API definitions {datestring}
* Input file: {input_filename}
* Automatically generated: please ... |
import numpy as np
from collections import defaultdict
import dsl_data
import types
import functools
def copy_func(f):
"""Based on http://stackoverflow.com/a/6528148/190597 (<NAME>)"""
g = types.FunctionType(f.__code__, f.__globals__, name=f.__name__,
argdefs=f.__defaults__,
closure=f.... |
import os
import sys
import shutil
import argparse
import torch
import numpy as np
TASKS = ['MNLI', 'QNLI', 'QQP', 'RTE', 'SST-2', 'MRPC', 'CoLA', 'STS-B']
from fairseq.models.roberta import RobertaModel
from sklearn.metrics import f1_score, matthews_corrcoef
from scipy.stats import pearsonr, spearmanr
def simple_... |
from django.db import models
from django.conf import settings
from django.utils.translation import ugettext_lazy as _, ugettext
from django.contrib.contenttypes.models import ContentType
from django.core.urlresolvers import reverse
from django.contrib.redirects.models import Redirect
from django.core.validators import ... |
import functools as ft
from peak import Peak, name_outputs, family_closure, Const
from .isa import ISA_fc
from .util import Initial, clo
from . import family
from .micro import Micro_fc
@family_closure(family)
def MIPS32_fc(family):
Bit = family.Bit
BitVector = family.BitVector
Unsigned = family.Unsig... |
"""
TencentBlueKing is pleased to support the open source community by making
蓝鲸智云PaaS平台社区版 (BlueKing PaaSCommunity Edition) available.
Copyright (C) 2017-2018 THL A29 Limited,
a Tencent company. All rights reserved.
Licensed under the MIT License (the "License");
you may not use this file except in compliance with the... |
import asyncio
import base64
import functools
import hashlib
import os
import struct
from concurrent.futures.thread import ThreadPoolExecutor
from getpass import getpass
from typing import Union, List, Optional, Dict
import pyrogram
from pyrogram import raw
from pyrogram import types
from pyrogram.file_id import FileI... |
import logging
import math
import os
import re
import shutil
import subprocess
from core.result_types import ResultType
from core import utility as util
# AVAIN variables & shared scan result
INTERMEDIATE_RESULTS = {ResultType.SCAN: None}
CONFIG = None
VERBOSE = None
# output files
SMBMAP_OUTPUT_FILE = "smbmap_out.t... |
def gocko(meas_t=1):
dets = [pil300KW, xbpm3.sumY]
xlocs1 = [-48000,-34000,-23000,-12000, 2000, 15000, 30000, 43000]
names1 = ['BWXLE-new-water30min-CsBrsoaked-THF','BWXLE-new-water30min-CsBrsoaked-DCM','BW30-new-water30min-CsBrsoaked-THF','BW30-new-water30min-CsBrsoaked-DCM',\
'BWXLE-n... |
# The MIT License (MIT)
#
# Copyright (c) 2020 NVIDIA CORPORATION. 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 Software without restriction, including without limitation the... |
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Model for a group of alerts."""
import logging
from google.appengine.ext import ndb
from dashboard import quick_logger
from dashboard.common import uti... |
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class SpatialAttnNet(nn.Module):
""" Constructor """
def __init__(self, cube_size,n_head,n_state,study=False):
super(SpatialAttnNet, self).__init__()
# Parameters
self.high = cube_size[0]
self.wid... |
from ..base import *
from ..menu import Menu
class SeparatorGhostImage:
def __init__(self):
gfx_id = Skin.atlas.gfx_ids["statusbar"]["separator_ghost"][0][0]
x, y, w, h = Skin.atlas.regions[gfx_id]
img = PNMImage(w, h, 4)
img.copy_sub_image(Skin.atlas.image, 0, 0, x, y, w, h)
... |
# Copyright (c) 2012-2013 <NAME> http://garnaat.org/
# Copyright 2012-2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Modifications made by Cloudera are:
# Copyright (c) 2016 Cloudera, Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use t... |
import scipy.optimize
from scipy.optimize import leastsq
import xlrd
from fnmatch import fnmatch
'''
<NAME>
<EMAIL>
feb 2014
reads experimental data from Excel spreadsheet as provided from inflow control tests performed in
HP AICD rig in Porsgrunn.
useful for doing curvefitting, plotting etc.
see documentation under... |
"""
MIT License
Copyright (c) 2020 Open Ephys
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, di... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jul 27 14:07:01 2018
@author: gbaechle
"""
import numpy as np
from scipy import misc
import matplotlib.pyplot as plt
from os import listdir
from os.path import isfile, join, exists
import warnings
gdal_available = True
try:
from osgeo import gda... |
import os
import numpy as np
import tensorflow as tf
import tensorflow_addons as tfa
# from keras_contrib.layers import InstanceNormalization
from tensorflow.keras.layers import Layer, InputSpec
PRETRAINED_WEIGHT_DIR = os.path.join(
os.path.dirname(os.path.realpath(__file__)), "pretrained_weights")
# ref: https:... |
from __future__ import annotations
from numpy import array, ndarray
class UGridNetwork1D:
"""This class is used for define/put/inquire/get Network1D data
Attributes:
name (str): The network name.
node_x (ndarray): The x-coordinates of the network node.
node_y (ndarray): The y-coordin... |
#This is not a minigame mod script. It's a powerup.
import bs
import bsUtils
import bsVector
import bsBomb
from math import cos
from random import randrange
import weakref
class snoMessage(object):
#Message passed to a snoBall by collision with a spaz
pass
class otherHitMessage(object):
#Message pa... |
# Copyright (c) 2019 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 app... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import sys
import traceback
from threading import Lock
from alphalogic_api.objects.event import Event
from alphalogic_api.objects.command import Command
from alphalogic_api.objects.parameter import Parameter, ParameterString, ParameterBool, ParameterLong... |
"""
the implementation of ATOM iou net
"""
import paddle
import paddle.fluid as fluid
import paddle.fluid.dygraph.nn as nn
import numpy as np
import os.path as osp
import sys
CURRENT_DIR = osp.dirname(__file__)
sys.path.append(osp.join(CURRENT_DIR, '..', '..', '..'))
def weight_init():
init = flui... |
# Cog containing Nubot's minesweeper
import discord
from discord import Embed
from discord.ext import commands
import asyncio
from Scripts.utilities import get_configs, truncate, transform_input
from Scripts.database import Database
class Minesweeper_Game():
def __init__(self, height: int, width: int): # heigh... |
"""Common configuration for tests."""
import json
import os
import re
from pathlib import Path
from urllib.parse import urlparse
import pytest
from lxml import etree
from lxml.doctestcompare import LHTMLOutputChecker
from sphinx.util.console import nocolor
pytest_plugins = "sphinx.testing.fixtures"
TEST_FILE_DIR = ... |
"""
Analyze the grades of the students.
Here's an example of the data
.. code-block::
111111004 5.0 5.0 6.0
111111005 3.75 3.0 4.0
111111006 4.5 2.25 4.0
Every line represents a grading of a student. It starts with her matriculation number,
followed by space-delimited grades (between 1.0 and 6.0,... |
import numpy as np
import torch
import cv2
import os
#from time_analyze import func_line_time
def bbox_ious(boxes1, boxes2):
""" Compute IOU between all boxes from ``boxes1`` with all boxes from ``boxes2``.
Args:
boxes1 (torch.Tensor): List of bounding boxes
boxes2 (torch.Tensor): List of boun... |
import datetime
import os
import time
from flask import current_app as app, Blueprint, jsonify, render_template, abort, send_file, session, request
from flask.helpers import safe_join
from app import utils
import misc_utils
import json
import random
import subprocess
views = Blueprint('views', __name__)
tensorboard... |
# -*- coding: utf-8 -*-
"""
chrandr - Configuration classes/utils
"""
import os
import os.path
import logging
import configparser
# Generate the default configuration filename
try:
from xdg import BaseDirectory
_config_dir = BaseDirectory.save_config_path('chrandr')
except ImportError:
logger = logging.... |
import praw
import os
from pprint import pprint
print("Logging into Reddit")
#Get into Reddit
reddit = praw.Reddit(client_id=' ',
client_secret=' ',
user_agent='< ')
print("Logged in to Reddit")
def newLookUp():
# Get the subreddit
desiredSubreddit = input("What is th... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
from django.utils.translation import ugettext_lazy as _
from shortuuidfield import ShortUUIDField
from utils.basemodels import CreateUpdateMixin
class BusinessAccountInfo(CreateUpdateMixin):
""" 出题帐户类 """
... |
import os
import json
import time
import math
import pandas as pd
import matplotlib.pyplot as plt
from src.data_processor import DataLoader
# from src.model import Model
from sklearn.metrics import roc_curve, roc_auc_score
from sklearn.preprocessing import StandardScaler
import matplotlib as mpl
import numpy as np
imp... |
from typing import Optional, Tuple
from esipy import EsiClient
from waitlist.utility import outgate
from waitlist.utility.config import banned_by_default
from waitlist.utility.sde import add_type_by_id_to_database
from waitlist.storage.database import Constellation, SolarSystem, Station,\
InvType, Account, Charac... |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (nested_scopes, generators, division, absolute_import, with_statement,
print_function, unicode_literals)
from collections imp... |
# Copyright 2017-2020 TensorHub, 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... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2013 Netflix, Inc.
"""Command line tools entry point."""
from cligraphy.core import capture, decorators, read_configuration, ctx
from cligraphy.core.log import setup_logging
from cligraphy.core.parsers import (
AutoDiscoveryCommandMap,
SmartCommandMap... |
import pandas as pd
import numpy as np
import cv2, utils
import random
import copy
import threading
import itertools
import numpy.random as npr
pos_max_overlaps = 0.7
neg_min_overlaps = 0.3
batchsize = 256
fraction = 0.5
RPN_BBOX_INSIDE_WEIGHTS = (1.0, 1.0, 1.0, 1.0)
# Give the positive RPN examples weight of p * 1 / {... |
# Copyright 2016 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... |
import datetime
import os
import pathlib
import shutil
from common import ExtensionBase, loggedmethod, formatValue, parseValue
# noinspection PyUnreachableCode
if False:
# noinspection PyUnresolvedReferences
from _stubs import *
_inputResMultipliers = {
'quarter': 0.25,
'half': 0.5,
'original': 1,
'double': 2,... |
from __future__ import unicode_literals
import re
from ..utils import ExtractorError
from .commonwebdriver import SeleniumInfoExtractor
from concurrent.futures import (
ThreadPoolExecutor
)
from selenium.webdriver.support import expected_conditions as ec
from selenium.webdriver.common.by import By
impor... |
from __future__ import unicode_literals
import datetime
from raster.models import Legend, RasterLayer
from raster.tiles.parser import rasterlayers_parser_ended
from raster.valuecount import Aggregator
from django.contrib.gis.db import models
from django.contrib.postgres.fields import HStoreField
from django.db.model... |
# The core application of the Mia project.
# by imacat <<EMAIL>>, 2020/7/4
# Copyright (c) 2020 imacat.
#
# 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/l... |
# ----------------------------------------------------------------------------------------------------------------------
# FILE DESCRIPTION
# ----------------------------------------------------------------------------------------------------------------------
# File: loss.py
# Author: <NAME>
# Date written: 01-28-... |
import aiohttp
import asyncio
from datetime import datetime
from functools import partial
import logging
from multiprocessing import Manager, Process
from os import mkdir
from os.path import exists
from pickle import dumps, loads
from queue import Empty
from urllib.parse import urljoin
import uvloop
from utils import ... |
import os
import numpy as np
from datetime import datetime
from tqdm import tqdm
import torch
import torch.optim as optim
import torch.nn.functional as F
from .utils import register_algorithm, Algorithm, acc, ood_metric
from src.data.utils import load_dataset
from src.data.class_indices import class_indices
from src.... |
# MIT License
# Copyright (c) 2022 <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... |
import scipy.misc
import scipy.ndimage
import os
import math
import numpy as np
def preprocess_patches(patches, mean_BGR):
"""
(h,w,c) --> (c,h,w); RGB --> BGR; minuse mean_BGR along coler channel.
------------
inputs:
patches: np (...,h,w,c) in the RGB order
mean_BGR: np (3/1,)
... |
import numpy as np
import pandas as pd
import xarray as xr
import matplotlib.pyplot as plt
import pathlib
import attr
import enum
from attr.validators import instance_of
import tifffile
import scipy.ndimage
import scipy.spatial.distance
import scipy.stats
import warnings
import skimage.draw, skimage.measure
class Tif... |
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import pickle
import pandas as pd
import cv2 as cv
import os
import collections
import scipy.signal as sig
import order_obj
def det(a, b):
return a[0] * b[1] - a[1] * b[0]
def line_intersection(line1, line2):
xdiff = (l... |
import os, io
import numpy as np
import tensorflow
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Conv2D, MaxPooling2D, UpSampling2D, ZeroPadding2D, BatchNormalization
from tensorflow.keras.layers import Activation
import cv2
from sklearn.model_selection import train_test_split
impor... |
#!/usr/bin/env python3
import math
from ast import literal_eval
from typing import List
import torch
import torch.nn as nn
import torch.nn.functional as F
from fairseq.models import register_model, register_model_architecture
from pytorch_translate import (
char_encoder,
char_source_hybrid,
char_source_mo... |
#!/usr/bin/env python3
'''
A Simple UDI Poloyglot Controller to Listen for Plex Webhooks.
'''
try:
import polyinterface
except ImportError:
import pgc_interface as polyinterface
from http.server import HTTPServer, BaseHTTPRequestHandler
from socket import socket,AF_INET,SOCK_DGRAM
from threading import Thread... |
import datetime, time
import platform
import simpy
import shapely.geometry
from simplekml import Kml, Style
import numpy as np
import openclsim.core as core
import openclsim.model as model
import openclsim.plot as plot
import halem
import halem.Mesh_maker as Mesh_maker
import halem.Functions as Functions
import halem... |
#!/usr/bin/env python
# vim:fenc=utf-8
#
# pylint: disable=superfluous-parens
# pylint: disable=missing-docstring
"""Manage servers
Usage:
haproxytool server [-D DIR | -F SOCKET] (-A | -r | -s | -e | -R | -p | -W |
-i | -c | -C | -S | -X) [--backend=<name>...] [NAME...]
haproxytool serve... |
from django.utils import timezone
from django.conf import settings
from django.core.validators import MinLengthValidator, MaxLengthValidator, MinValueValidator, MaxValueValidator
from django.db import models
from survey.interviewer_configs import LEVEL_OF_EDUCATION, LANGUAGES, INTERVIEWER_MIN_AGE, INTERVIEWER_MAX_AGE
f... |
################################################################################
# breakpoint pair detection and filtering
################################################################################
#------------------------------------------------------------------------------#
import pysam
import re
import numpy... |
import cv2
import numpy as np
import glob
from moviepy.editor import VideoFileClip
# The left and right polyline fit
left_fit, right_fit = None, None
# We maintain the last 5 frames to compute the average polyline fit
max_averge_frame = 5
# The left and right polyline fit in the last 5 frames are kept in this list
pre... |
#!/usr/bin/env python3
# author: greyshell
# description: finding allowed operations / opcode from allowed chars set
import argparse
import sys
from colorama import Fore
# global constant variable
PROGRAM_LOGO = """
____ _ _ _ ___ ____ ____ ____ ____ ____ ___ ____ ____ ___ ____
|___ | |\ | | \ [__ |... |
# -*- coding: utf-8 -*-
# MegEngine is Licensed under the Apache License, Version 2.0 (the "License")
#
# Copyright (c) 2014-2021 Megvii Inc. All rights reserved.
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT ARRANTI... |
#!/usr/bin/python
# Copyright 2012 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy
# of the License at: http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... |
# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
import copy
import inspect
import logging
from datetime import datetime
import os
import traceback
import numpy as np
formatter = logging.Formatter('%(asctime)s - %(levelname)s -- %(message)s')
def setup_logger(name, log_file = None, level=logging.INFO, format = True):
''' Create a logger with an option... |
# -*- coding: utf-8 -*-
"""
flask_principal
~~~~~~~~~~~~~~~
Identity management for Flask.
:copyright: (c) 2012 by <NAME>.
:license: MIT, see LICENSE for more details.
"""
from __future__ import with_statement
__version__ = '0.3.5'
import sys
from functools import partial, wraps
from collecti... |
# Copyright (C) 2012 Nippon Telegraph and Telephone 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 appli... |
""" rpkm_annotate.py : Library / script to combine pathway information, RPKM data, and annotation information into output data"""
__author__ = "<NAME>"
__email__ = "<EMAIL>"
__license__ = "CC0 - No rights reserved. See LICENSE"
import csv
import sys
from os import listdir
from os.path import join
from r... |
# Copyright (c) OpenMMLab. All rights reserved.
import os.path as osp
import tempfile
import mmcv
import numpy as np
from mmdet.datasets.coco_panoptic import INSTANCE_OFFSET, CocoPanopticDataset
try:
from panopticapi.utils import id2rgb
except ImportError:
id2rgb = None
def _create_panoptic_... |
"""Misc. legacy helpers :mod:`subprocess` and finding VCS binaries.
:class:`libvcs._internal.run.run` will be deprecated by
:mod:`libvcs._internal.subprocess`.
Note
----
This is an internal API not covered by versioning policy.
"""
import datetime
import errno
import logging
import os
import subprocess
import sys
fro... |
import gin
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.utils import weight_norm
@gin.configurable('masking')
def parrallel_recomb(q_t, kv_t, att_type='all', local_context=3, bin_size=None):
""" Return mask of attention matrix (ts_q, ts_kv) """
with torch.no_gra... |
"""Class to parse a textual schedule into a usuable structure."""
from datetime import date, datetime, time, timedelta
import re
from typing import List
from .schedule import Schedule
from .scheduletypes import ScheduleEntry, ScheduleEvent
class Invalid(Exception):
"""Raised when there is a parsing error."""
... |
# import the necessary packages
from skimage.feature import peak_local_max
from skimage.morphology import watershed, disk
from scipy import ndimage
import numpy as np
import cv2
from helpFunctions import *
non_tomato_number = 0
def waterShedSelectedRigon(img, center, minRadius = 5,maxRadius = 60):
X = 0
Y = 0
R =... |
#!/usr/bin/python
import json
import sys
downloadlist_filename = "download_command_list.txt"
input_yml_filename = "inputs.yml"
env_filename = "env_command_list.txt"
INPUT_DIR = "/data1/input"
def main():
# read json file
with open(sys.argv[1], 'r') as json_file:
Dict = json.load(json_file)
Di... |
import petsc4py
import sys
petsc4py.init(sys.argv)
from petsc4py import PETSc
import numpy
from dolfin import *
import os, inspect
from scipy.sparse import coo_matrix, spdiags
import time
import CheckPetsc4py as CP
import PETScIO as IO
def HiptmairMatrixSetup(mesh, N, M):
path = os.path.abspath(os.path.join(insp... |
import os
import re
import datetime
import glob
import tarfile
import statistics
import hashlib
import urllib.parse
from difflib import SequenceMatcher
import requests
from cached_property import cached_property
import pandas as pd
from eircode.address import Address
from property_price_register.utils import isnan
... |
# coding=utf-8
import os
import commands
import socket
# 检查当前系统
def check_sys():
global sys
value = commands.getstatusoutput('cat /etc/redhat-release | grep -q -E -i "centos"')
if value[0] == 0:
sys = 'centos'
else:
value = commands.getstatusoutput('cat / etc / issue | grep - q - E - i ... |
# xpyBuild - eXtensible Python-based Build System
#
# This module holds definitions that are used throughout the build system, and
# typically all names from this module will be imported.
#
# Copyright (c) 2013 - 2017, 2019 Software AG, Darmstadt, Germany and/or its licensors
#
# Licensed under the Apache License, ... |
import scrapy
from selenium import webdriver
from scrapy.utils.project import get_project_settings
from decathlon_scrapy.items import ProductItem
from decathlon_scrapy.items import ProductReviewItem
import os
import hashlib
import datetime
from urllib.parse import urlparse, urlunparse, urljoin
# Django integration
f... |
#!/usr/bin/env python
# Copyright 2017 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... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import dash
import dash_core_components as dcc
import dash_html_components as html
import networkx as nx
import plotly.express as px
import plotly.graph_objects as go
import pandas as pd
from colour import Color
from datetime import datetime
from textwrap im... |
#!/usr/bin/python2.5
#
# Copyright 2009 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.