text stringlengths 2 999k |
|---|
import httplib
import urlparse
from oauth2client.client import flow_from_clientsecrets
headers = {"Content-Type":"application/json"}
url = "https://picasaweb.google.com/data/feed/api/user/101458158860096958252"
domain = urlparse.urlparse(url).netloc
connection = httplib.HTTPSConnection(domain)
connection.request("GET... |
import sys
import os
sys.path.append(os.path.dirname(__file__))
import faser_general as fsr
import faser_high_performance as fmr
from faser_transform import tm
|
# Copyright Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompan... |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: event.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf impor... |
#!/usr/bin/env python
"""
Copyright (c) 2015-2017 Alex Forencich
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,... |
import asyncio
import os
import platform
from pathlib import Path
from . import urlscan, utils
def main():
parser = utils.create_arg_parser()
args = parser.parse_args()
utils.validate_arguments(args)
api_key = os.environ["URLSCAN_API_KEY"]
data_dir = Path(os.getenv("URLSCAN_DATA_DIR", "."))
... |
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/60_medical.imaging.ipynb (unless otherwise specified).
__all__ = ['DcmDataset', 'DcmTag', 'DcmMultiValue', 'dcmread', 'get_dicom_files', 'DicomSegmentationDataLoaders',
'get_dicom_files', 'TensorDicom', 'PILDicom', 'pixels', 'scaled_px', 'array_freqhist_bins',... |
try:
from heat.common.i18n import _
except ImportError:
pass
from heat.engine import attributes
from heat.engine import constraints
from heat.engine import properties
try:
from heat.openstack.common import log as logging
except ImportError:
from oslo_log import log as logging
from vnc_api import vnc_api... |
import codecs
import os.path
import docutils.io
import nbformat
from sphinx.util.osutil import ensuredir, os_path
from ..writers.jupyter import JupyterWriter
from sphinx.builders import Builder
from sphinx.util.console import bold, darkgreen, brown
from sphinx.util.fileutil import copy_asset
from ..writers.execute_nb ... |
#!/usr/bin/env python3 -u
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Translate pre-processed data with a trained model.
"""
import ast
import logging
import math
import os
import sy... |
################################################################################
# Copyright (c) 2018-2019, National Research Foundation (Square Kilometre Array)
#
# Licensed under the BSD 3-Clause License (the "License"); you may not use
# this file except in compliance with the License. You may obtain a copy
# of the... |
import os
import torch
import torch.nn as nn
import torch.quantization
from torch.utils.mobile_optimizer import optimize_for_mobile
from openunmix import utils
from openunmix import model
from openunmix.model import OpenUnmix
target_urls_umxhq = {
"bass": "https://zenodo.org/api/files/1c8f83c5-33a5-4f59-b109-721f... |
import pytest
from fastai import *
from fastai.vision import *
@pytest.fixture(scope="module")
def path():
path = untar_data(URLs.MNIST_TINY)
return path
def mnist_tiny_sanity_test(data):
assert data.c == 2
assert set(map(str, set(data.classes))) == {'3', '7'}
assert set(data.train_ds.y) == set(da... |
from Drain import * |
from PyQt5 import QtCore, QtGui, QtWidgets
from power_bar import PowerBar
app = QtWidgets.QApplication([])
volume = PowerBar(["#053061", "#2166ac", "#4393c3", "#92c5de", "#d1e5f0", "#f7f7f7", "#fddbc7", "#f4a582", "#d6604d", "#b2182b", "#67001f"])
volume.setBarSolidPercent(0.8)
volume.setBarPadding(5)
volume.show()
ap... |
"""This file contains tracers for convolution operations."""
from typing import List, Optional, Tuple, Union, cast
import numpy as np
from ...numpy.tracing import NPConstant, NPTracer
from ..representation.intermediate import Conv2D
from ..tracing.base_tracer import BaseTracer
SUPPORTED_AUTO_PAD = [
"NOTSET",
]... |
from .asset import TuyaAssetManager
from .device import TuyaDevice, TuyaDeviceListener, TuyaDeviceManager
from .home import TuyaHomeManager, TuyaScene
from .infrared import TuyaRemote
from .openapi import TuyaOpenAPI, TuyaTokenInfo
from .openlogging import TUYA_LOGGER
from .openmq import TuyaOpenMQ
from .tuya_enums imp... |
# coding: utf-8
"""
FlashBlade REST API Client
A lightweight client for FlashBlade REST API 2.0, developed by Pure Storage, Inc. (http://www.purestorage.com/).
OpenAPI spec version: 2.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re
import six
imp... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2017-12-30 04:44
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('places', '0030_auto_20171230_0321'),
]
operations = [
migrations.AddField(
... |
import os
import unittest
from abc import ABC
from shutil import rmtree
import numpy as np
from pybdv import make_bdv
from pybdv.util import n5_file
class MetadataTestMixin(ABC):
tmp_folder = './tmp'
xml_path = './tmp/test.xml'
xml_path2 = './tmp/test2.xml'
shape = (64,) * 3
chunks = (32,) * 3
... |
# -*- coding: utf-8 -*-
# Copyright © 2012-2016 Roberto Alsina and others.
# 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 t... |
#!/bin/python3
from cheetah_demo import _abs_path, init_cheetah
import pyaudio
import struct
import argparse
import signal
def init_argparser() :
"""Define arguments and parse them"""
parser = argparse.ArgumentParser()
parser.add_argument(
'--library_path',
help="absolute path to Cheetah'... |
'''
Author: bobby
Date created: Feb 1,2016
Date last modified: May 14, 2016
Python Version: 2.7
'''
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
def IterationGraph(loss,val_loss,history_path,graph_out_path,features):
history_f = open(h... |
# 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 u... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 13 10:04:41 2018
@author: anonymous
"""
import os
import datetime
import numpy as np
import visdom
def running_average(data, window=7):
"""
Create running average of data
"""
alpha = 2 /(window + 1.0)
alpha_rev = 1-alpha
... |
"""Pytorch Dataset object that loads 27x27 patches that contain single cells."""
import os
import random
import numpy as np
import scipy.io
import torch
import torch.utils.data as data_utils
import torchvision.transforms as transforms
from skimage import io, color
from sklearn.model_selection import KFold
import uti... |
import sys
import os
import argparse
import json
import time
import math
from irmark1.parts.datastore import Tub
from irmark1.utils import *
from irmark1.parts.controller import JoystickCreatorController
try:
from prettytable import PrettyTable
except:
print("need: pip install PrettyTable")
class CreateJoyst... |
from __future__ import unicode_literals
from django.db import models
# Create your models here.
class Proyecto(models.Model):
nombreProyecto = models.CharField(max_length=50, primary_key=True)
csvArchive = models.FileField()
def __str__(self):
return self.nombreProyecto
|
from hash import hash
def verify(message, z, c, t, length, generator, prime, pub_key):
print("Verifying the signature")
m_binary = ''.join(format(ord(i), 'b') for i in message)
if c == hash(int(bin(t)+m_binary,2), generator, prime, length):
if (pow(pub_key, c, prime)*t)%prime == pow(generator, z, p... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
fro... |
######################################################################
#
# energy.py: calculate the energy of a molecule
#
######################################################################
import openbabel
import sys
# Make sure we have a filename
try:
filename = sys.argv[1]
except:
print "Usage: python ener... |
if __name__ == '__main__':
n = int(input())
arr = list(map(int, input().split()))
maxi = max(arr)
for i in range(n):
if max(arr) == maxi:
arr.remove(maxi)
print(max(arr))
|
import logging
from bisect import bisect
import torch
import torch.nn as nn
import torch.nn.functional as F
from pytorch_transformers.tokenization_bert import BertTokenizer
from torch.optim import Adam
from torch.optim.lr_scheduler import LambdaLR
from torch.utils.data import ConcatDataset, DataLoader, RandomSampler
... |
from __future__ import absolute_import, division, print_function
# LIBTBX_SET_DISPATCHER_NAME phenix.secondary_structure_restraints
from mmtbx.secondary_structure import sec_str_master_phil_str, \
sec_str_master_phil, manager
import iotbx.pdb
import mmtbx.model
import iotbx.phil
from scitbx.array_family import flex
... |
import torch
import torch.nn as nn
from utils import intersection_over_union
import config
class LicensePlateCharactersLoss(nn.Module):
def __init__(self):
super().__init__()
self.mse = nn.MSELoss()
self.sigmoid = nn.Sigmoid()
# Constants
self.lambda_class = 1
sel... |
# encoding: utf-8
##################################################
# This script shows an example of a header section. This sections is a group of commented lines (lines starting with
# the "#" character) that describes general features of the script such as the type of licence (defined by the
# developer), authors,... |
from collections import Counter
from utils import get_clean_words
import dictionary_words
import rearrange
import random
import sys
def anagram(params):
for val in range(len(params) - 1, 0, -1):
j = random.randint(0, val + 1)
params[val], params[j] = params[j], params[val]
return params
# Chec... |
from os import getenv
from dotenv import load_dotenv
load_dotenv()
que = {}
SESSION_NAME = getenv("SESSION_NAME","session")
BOT_TOKEN = getenv("BOT_TOKEN")
BOT_USERNAME = getenv("BOT_USERNAME")
admins = {}
API_ID = int(getenv("API_ID"))
API_HASH = getenv("API_HASH")
DURATION_LIMIT = int(getenv("DURATION_LIMIT","10"))... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jul 4 12:32:53 2017
@author: wroscoe
"""
import os
import sys
import time
import json
import datetime
import random
import tarfile
import numpy as np
import pandas as pd
from PIL import Image
from donkeycar import util
from ..log import get_logger
l... |
import hashlib
import struct
import hmac
import base58
try:
hashlib.new("ripemd160")
except ValueError:
# No native implementation
from . import _ripemd
def ripemd160(*args):
return _ripemd.new(*args)
else:
# Use OpenSSL
def ripemd160(*args):
return hashlib.new("ripemd160", *ar... |
# -*- coding:utf-8 -*-
MAX = int(1e7) # 所有数字均不超过 MAX
|
from .dataset import BlinkDataset
from .transforms import BlinkTransform
from .rpn import BlinkRPN
from .head import BlinkHead |
from django.urls import path
# local
from . import views
urlpatterns = [
path('import/data', views.data_import, name='import'),
] |
# Copyright (c) 2017, Lawrence Livermore National Security, LLC. Produced at
# the Lawrence Livermore National Laboratory. LLNL-CODE-734707. All Rights
# reserved. See files LICENSE and NOTICE for details.
#
# This file is part of CEED, a collection of benchmarks, miniapps, software
# libraries and APIs for efficient h... |
# -*- coding: utf-8 -*-
# Copyright 2020 Google 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... |
import pandas as pd
import os
def read_pred_csv(csv_path):
df = pd.read_csv(csv_path,
parse_dates = ['date'],
infer_datetime_format = True)
return df
def calc_doy_means(df, site_id, out_file=None):
doy_means = df.groupby([df.date.dt.month, df.date.dt.day]).mean()
... |
#!/usr/bin/env python
import sys
# To use a consistent encoding
from codecs import open
from os import path
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
from sphinx.setup_command import BuildDoc
import versioneer
### py.test ###
class PyTest(TestCommand):
... |
import ast
from ctree.visitors import NodeVisitor
from ctree.util import enumerate_flatten
def label_for_py_ast_nodes(self):
from ctree.py.dotgen import PyDotLabeller
return PyDotLabeller().visit(self)
def to_dot_outer_for_py_ast_nodes(self):
return "digraph mytree {\n%s}" % self._to_dot()
def to_dot_... |
# https://github.com/pytorch/ignite/blob/master/examples/notebooks/FashionMNIST.ipynb
# https://www.kaggle.com/stuarthallows/using-xgboost-with-scikit-learn
import time
import sys, os
from sklearn.metrics import f1_score
idx = os.getcwd().index("trade")
PROJECT_HOME = os.getcwd()[:idx] + "trade"
sys.path.append(PROJE... |
# this script modified from built-in predict.py script
# # original codes refer to fasterRCNN/predict.py
import argparse
import itertools
import os
import os.path
import shutil
import socket
import subprocess # for calling shell script
import sys
import tempfile
import time
import cv2
import numpy as np
import tensor... |
"""Database production tests."""
from open_alchemy import package_security
def test_security():
"""
GIVEN sub
WHEN credentials are created, the secret key hash is calculated, the secret key is
retrieved and the secret key hash is compared with itself
THEN the secret key hash of the credential... |
class FileWriter ():
@staticmethod
def wirte_to_file(data, out_path, sep = ';'):
data.to_csv(out_path, sep=sep, index=False, header=False)
|
from main import app
if __name__ == "__main__":
app.run(host='127.0.0.1', port=8080)
|
import datetime
from django.shortcuts import render, get_object_or_404
# Create your views here.
from django.http import HttpResponse, Http404, HttpResponseRedirect
from django.template import loader
from django.urls import reverse
from django.views import generic
from polls.models import Question, Choice
class In... |
# -*- coding: utf-8 -*-
# Author: Hao Xiang <haxiang@g.ucla.edu>
# License: TDG-Attribution-NonCommercial-NoDistrib
"""
Convert lidar to bev
"""
import numpy as np
import torch
from opencood.data_utils.pre_processor.base_preprocessor import \
BasePreprocessor
class BevPreprocessor(BasePreprocessor):
def __... |
# -------------------------------------------------------------------------------------------------------------------------------------------------------------
# Deauthentication Attack for bluetooth
# @Authors: Authors: Shir, Hodaya and Alexey
# @Version: 1.0
# @Date 07.2019
# ----------------------------------------... |
"""
OpenAPI Petstore
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
"""
import re # noq... |
import csv
import os
import json
import gspread
import datetime
import re
import unicodecsv as csv
from app import db
from util import safe_commit
from emailer import send
from emailer import create_email
from endpoint import Endpoint
from repository import Repository
from repo_request import RepoRequest
def get_rep... |
from collections import namedtuple
ModelOutput = namedtuple('ModelOutput', ['loss', 'logits'])
|
"""
Modeling Relational Data with Graph Convolutional Networks
Paper: https://arxiv.org/abs/1703.06103
Code: https://github.com/tkipf/relational-gcn
Difference compared to tkipf/relation-gcn
* l2norm applied to all weights
* remove nodes that won't be touched
"""
import argparse
import numpy as np
import time
import ... |
#!/usr/bin/env python
import numpy as np
from sklearn.neighbors import NearestNeighbors
from sklearn.metrics.pairwise import euclidean_distances
# Return the id of k nearest sample points
samples = [[0, 0, 2], [1, 0, 1], [0, 0, 1], [1,1,1]]
neigh = NearestNeighbors(2, 0.4)
neigh.fit(samples)
[distances, indices] = ... |
# -*- coding: utf-8 -*-
# this file is released under public domain and you can use without limitations
#response.title = request.application.replace('_',' ').title()
response.title = 'MVC store'
response.subtitle = ''
## read more at http://dev.w3.org/html5/markup/meta.name.html
response.meta.author = 'Your Name <yo... |
#!/usr/bin/env python3
# Apache License, Version 2.0
import argparse
import os
import shlex
import shutil
import subprocess
import sys
def get_arguments(filepath, output_filepath):
dirname = os.path.dirname(filepath)
basedir = os.path.dirname(dirname)
subject = os.path.basename(dirname)
args = [
... |
# Copyright (C) 2010-2011 Richard Lincoln
#
# 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 os
import re
import shutil
import subprocess
import stat
import platform
import asyncio
from typing import Any, Dict, List, Optional, Tuple
from pathlib import Path
import requests
from spotdl.utils.config import get_spotdl_path
FFMPEG_URLS = {
"windows": {
"amd64": "https://github.com/eugeneware/... |
#!/usr/bin/env python
#
# Field class implementation
import logging
import sys
from air.air_common import *
from iri_exception import *
from field import field_instance, field_width_get
class HeaderInstance(object):
"""
@brief Represent a header or header stack instance for a packet
@todo Support header... |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import sys
import llnl.util.tty as tty
import llnl.util.tty.color as color
import spack.cmd
import spack.cmd.common.arg... |
"""
The MIT License (MIT)
Copyright (c) 2020 Nils T.
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, publ... |
#!/usr/bin/env python
#
# Copyright 2007 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 o... |
# Generated by Django 3.0.10 on 2021-02-11 21:09
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('rolodex', '0012_auto_20210211_1853'),
]
operations = [
migrations.AddField(
model_name='projectsubtask',
name='mark... |
import argparse
import pandas as pd
from model import KillerKMer
parser = argparse.ArgumentParser()
parser.add_argument('--input_csv', default='input.csv')
args = parser.parse_args()
# Config
output_file_path = 'predictions.csv'
# Load input.csv
with open(args.input_csv) as input_csv:
df = pd.read_csv(input_csv)... |
# -*- coding: utf-8 -*-
'''
Error generator to enable integration testing of salt wheel error handling
'''
from __future__ import absolute_import
# Import python libs
# Import salt libs
import salt.utils.error
def error(name=None, message=''):
'''
If name is None Then return empty dict
Otherwise rais... |
##########################################################################
#
# Copyright (c) 2008-2011, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redis... |
import os, os.path, sys
import zipfile, urllib2
import platform
import shutil, tempfile, json
import errno
import platform
import shutil
import time
import fnmatch
import distutils.core
from shutil import move
from tempfile import mkstemp
from os import remove, close
from minecriftversion import mc_version, of_file_na... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-06-20 19:29
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('sos', '0009_auto_20170505_1705'),
]
operations = [... |
from typing import Any, Dict, Iterable, Optional
from django.http import HttpRequest, HttpResponse
from django.utils.translation import ugettext as _
from zerver.decorator import api_key_only_webhook_view
from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_error, json_succes... |
import numpy
from six import moves
import chainer
from chainer import backend
from chainer.backends import cuda
from chainer import configuration
from chainer import function_node
from chainer.functions.connection import convolution_2d
from chainer.utils import conv
from chainer.utils import conv_nd
from chainer.utils... |
import logging
from .hdf5_format import HDF5Format
import hickle
from qcodes.utils.helpers import deep_update
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from .data_set import DataSet
#%%
log = logging.getLogger(__name__)
class HDF5FormatHickle(HDF5Format):
_metadata_file = 'snapshot.hickle'
_... |
""" RemoveNestedFunctions turns nested function into top-level functions. """
from pythran.analyses import GlobalDeclarations, ImportedIds
from pythran.passmanager import Transformation
from pythran.tables import MODULES
from pythran.conversion import mangle
import gast as ast
class _NestedFunctionRemover(ast.NodeT... |
import collections
import random
import unittest
import numpy
import logging
import gelcoverage.stats.coverage_stats as coverage_stats
import gelcoverage.stats.sequence_stats as sequence_stats
import gelcoverage.constants as constants
from gelcoverage.tools.bigwig_reader import BigWigReader
from gelcoverage.tools.bed_r... |
from django import forms
from profiles.models import Profile
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout, Fieldset, ButtonHolder, Submit, HTML
class ProfileForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.he... |
# Generated by Django 3.0.8 on 2020-08-01 07:17
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('customer', '0006_auto_20190430_1736'),
]
operations = [
migrations.AlterModelOptions(
name='productalert',
options={... |
"""
This component provides light support for Buspro.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/...
"""
import logging
import homeassistant.helpers.config_validation as cv
import voluptuous as vol
from homeassistant.components.light import LightEn... |
__version__ = '5.1.63 R-3'
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# complexity documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 9 22:26:36 2013.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# au... |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import six
from . import backend_cairo, backend_gtk3
from .backend_cairo import cairo, HAS_CAIRO_CFFI
from .backend_gtk3 import _BackendGTK3
from matplotlib.backend_bases import cursors
from matplotlib.figure ... |
from flask import render_template
from app import app
from app.forms import LoginForm
@app.route('/')
@app.route('/index')
def index():
user = {'username': 'tyc'}
posts = [
{
'author': {'username': 'John'},
'body': 'Beautiful day in Portland!'
},
{
... |
import time
from loguru import logger
from ogame import OGame
from ogame.constants import mission, ships, coordinates, destination
class DebrisField(object):
def __init__(self, properties, empire, telegram, utils):
self.properties = properties
self.empire = empire
self.telegram = telegram... |
# -*- coding: utf-8 -*-
"""
Created on 2017-01-09 10:38
---------
@summary: 组装parser、 parser_control 和 collector
---------
@author: Boris
@email: boris@bzkj.tech
"""
import threading
import time
from collections import Iterable
import spider.setting as setting
import spider.utils.tools as tools
from spider.buffer.item... |
import datetime
import os
import time
import warnings
import presets
import torch
import torch.utils.data
import torchvision
import transforms
import utils
from torch import nn
from torch.utils.data.dataloader import default_collate
from torchvision.transforms.functional import InterpolationMode
try:
from torchv... |
from abc import ABCMeta, abstractmethod
class AbstractFactory(metaclass=ABCMeta):
@abstractmethod
def create_view(self):
pass
@abstractmethod
def create_controller(self, view):
pass
|
# -*- coding: utf-8 -*-
"""
Unit Test: orchard.errors.e403
"""
import unittest
import orchard
class Error403UnitTest(unittest.TestCase):
def setUp(self):
app = orchard.create_app('Testing')
self.app_context = app.app_context()
self.app_context.push()
self.client = app.test_... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from refinery.units import Arg, Unit
class cca(Unit):
"""
Append data to the input.
"""
def __init__(self, data: Arg(help='Binary string to be appended to the input.')):
super().__init__(data=data)
def process(self, data: bytear... |
# Simple Adafruit BNO055 sensor reading example. Will print the orientation
# and calibration data every second.
#
# Copyright (c) 2015 Adafruit Industries
# Author: Tony DiCola
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "... |
"""Provide a mock standalone component."""
DOMAIN = "test_standalone"
async def async_setup(opp, config):
"""Mock a successful setup."""
return True
|
# import necessary packages
import os, time, cv2, csv, json, base64
import numpy as np
from imutils import paths
# directory name of current file
current_path = os.path.dirname(os.path.realpath(__file__))
# path to YOLO weights & model configuration
weights_path = os.path.sep.join([current_path, "models", "yolov3-t... |
#
# PySNMP MIB module PW-ATM-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/PW-ATM-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:42:37 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:... |
"""Module to work with summarizer database."""
import logging
from fastapi import FastAPI
from tortoise import Tortoise, run_async
from tortoise.contrib.fastapi import register_tortoise
from app.config import get_settings
TORTOISE_ORM = {
'connections': {'default': get_settings().database_url},
'apps': {
... |
# Copyright © 2019 Province of British Columbia
#
# 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 agr... |
""" Face swapping inference pipeline.
This script implements face swapping for both images and videos using an appearance map for the source subject.
The main pipeline components are: face reenactment and segmentation, inpainting, and blending.
Information about both source and target files will be extracted and cach... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.