text stringlengths 2 999k |
|---|
# Generated by Django 3.2.8 on 2021-10-22 19:56
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('restapi', '0003_auto_20211021_1509'),
]
operations = [
migrations.AddField(
model_name='producto',
name='product_des... |
# -*- coding: utf-8 -*-
from LineAPI.akad.ttypes import TalkException, ShouldSyncException
from .client import LINE
from threading import Thread
from types import *
import os, sys, time
class OEPoll(object):
OpInterrupt = {}
client = None
__squareSubId = {}
__squareSyncToken = {}
def __init__(sel... |
#! /bin/python
import os
import sys
import json
import luigi
import nifty
from elf.segmentation.clustering import mala_clustering
import cluster_tools.utils.volume_utils as vu
import cluster_tools.utils.function_utils as fu
from cluster_tools.cluster_tasks import SlurmTask, LocalTask, LSFTask
#
# Agglomerative Clus... |
import re
import subprocess
from datetime import datetime
from tempfile import mkdtemp
from typing import Optional, cast
from urllib.parse import urlparse
from .. import logger
from . import Abort
class Git:
"""Provides access to a local Git repository."""
def __init__(
self, github: str, repo: str... |
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 05 14:23:22 2018
@author: a002028
"""
import os
from collections import Mapping
from ctdpy.core import readers, mapping
def recursive_dict_update(d, u):
"""Recursive dictionary update.
Copied from:
http://stackoverflow.com/questions/3232943/update-value... |
# Copyright 2016 Nexenta Systems, 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 req... |
# AUTOGENERATED BY NBDEV! DO NOT EDIT!
__all__ = ["index", "modules", "custom_doc_links", "git_url"]
index = {"maybe_mount_gdrive": "000_export.ipynb",
"get_nb_name": "000_export.ipynb",
"get_colab_nb_name": "000_export.ipynb",
"get_nb_path": "000_export.ipynb",
"nb_name_to_py": "0... |
import asyncio
import logging
from common import utils
from common import command_parser
log = logging.getLogger("eris.command_parser")
class CommandParser(command_parser.CommandParser):
def __init__(self, eris, signals, engine, metadata):
super().__init__(eris.loop)
self.eris = eris
self.signals = signals
... |
from conans import AutoToolsBuildEnvironment, ConanFile, CMake, tools
from conans.errors import ConanInvalidConfiguration
import os
required_conan_version = ">=1.33.0"
class AprUtilConan(ConanFile):
name = "apr-util"
description = "The Apache Portable Runtime (APR) provides a predictable and consistent inte... |
"""
每日任务
"""
from .azurlane import AzurLaneControl
import numpy as np
import cv2 as cv
from simulator.image_tools import get_match, cv_crop, load_map
from config_loader import logging, config
logger = logging.getLogger(__name__)
filter_kernel = np.array([[-4, -2, -4], [-2, 24, -2], [-4, -2, -4]])
class Daily(AzurL... |
#
# Collective Knowledge workflow framework
#
# Developer: Grigori Fursin, Grigori.Fursin@cTuning.org, http://fursin.net
#
import os
import sys
import json
##############################################################################
# customize installation
def setup(i):
"""
Input: {
cfg ... |
# Zed Attack Proxy (ZAP) and its related class files.
#
# ZAP is an HTTP/HTTPS proxy for assessing web application security.
#
# Copyright 2012 ZAP Development Team
#
# 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 c... |
import numpy as np
from scipy.stats import norm
from numpy import vectorize
@vectorize
def U1(C, C_):
if C <= 0:
U = -np.inf
else:
U = -(1/2)*(C-C_)**2
return U
@vectorize
def U2(C, S):
if C <= 0:
U = -np.inf
else:
U = (C**(1-S) -1)/(1-S)
ret... |
import pyaf.Bench.TS_datasets as tsds
import pyaf.tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 32 , FREQ = 'D', seed = 0, trendtype = "MovingMedian", cycle_length = 7, transform = "Logit", sigma = 0.0, exog_count = 0, ar_order = 0); |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import alfred
import os
import plistlib
import json
import codecs
import urllib2
import logging
import inspect
from subprocess import call
import tempfile
import shutil
import logging.handlers
import threading
import Queue
class Workflow():
def __init__(self, dirname... |
import sys, re, os
import dill as pickle
import numpy as np
import pandas as pd
import scipy.interpolate as interpolate
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
plt.rcParams.update({'font.size': 14})
import grav_util_3 as gu
import bead_util as bu
import configuration as config
impo... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
ZetCode PyQt4 tutorial
This program creates a skeleton of
a classic GUI application with a menubar,
toolbar, statusbar and a central widget.
author: Jan Bodnar
website: zetcode.com
last edited: September 2011
"""
import sys
from PyQt4 import QtGui
class Example(QtG... |
# Copyright 2014 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... |
# The MIT License (MIT)
#
# Copyright (c) 2018 UMONS
#
# 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, m... |
# Copyright (c) 2016 SwiftStack, 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 w... |
import tensorflow as tf
import cv2
import glob
import numpy as np
pb_path = 'landmark.pb' # pb模型
sess = tf.Session()
with sess.as_default():
with tf.gfile.FastGFile(pb_path, 'rb') as f:
graph_def = sess.graph_def
graph_def.ParseFromString(f.read())
tf.import_graph_def(graph_def,name='')
# ... |
# app/__init__.py
from flask import Blueprint
from flask_restplus import Api
from .main.controller.auth_controller import api as auth_ns
from .main.controller.build_controller import api as build_ns
from .main.controller.info_controller import api as info_ns
from .main.controller.user_controller import api as user_ns... |
##
## The packages.
import pandas, os
import sklearn.model_selection
"""
影像資料儲存於資料夾,根據影像名稱以及路徑,建立資料表。
"""
##
## Handle the link of image.
root = "/media/houzeyu2683/120C3F2F0C3F0D6B/DataSetGroup/celebfacesattribute/"
folder = os.path.join(root, "jpg")
group = os.listdir(folder)
link = [os.path.join(folder, i) for ... |
import tensorflow as tf
import warnings
def conv2d(x, dim=(32, [3, 3], [1, 1]), pad='SAME', scope="conv2d", training=True, ema=None, init=False, bias_initializer=tf.constant_initializer(0.)):
num_filters, filter_size, stride = dim
with tf.variable_scope(scope):
V = tf.get_variable('V', shape=list(fil... |
# 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... |
##############################################################################
# Copyright by The HDF Group. #
# All rights reserved. #
# #
# Th... |
# coding: utf-8
"""
Wavefront REST API
<p>The Wavefront REST API enables you to interact with Wavefront servers using standard REST API tools. You can use the REST API to automate commonly executed operations such as automatically tagging sources.</p><p>When you make REST API calls outside the Wavefront REST ... |
#!/usr/bin/env python3
import os
import math
from numbers import Number
from cereal import car, log
from common.numpy_fast import clip, interp
from common.realtime import sec_since_boot, config_realtime_process, Priority, Ratekeeper, DT_CTRL
from common.profiler import Profiler
from common.params import Params, put_no... |
import random
import string
import datetime
import bcrypt
from sqlalchemy import (
Column,
Integer,
Unicode,
DateTime,
LargeBinary,
)
from sqlalchemy.orm import relationship
from .meta import Base, load_datetime
class User(Base):
"""User Class"""
__tablename__ = 'users'
id = Column(I... |
# 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... |
###############################################################################
##
## Copyright (C) 2011-2014, NYU-Poly.
## Copyright (C) 2006-2011, University of Utah.
## All rights reserved.
## Contact: contact@vistrails.org
##
## This file is part of VisTrails.
##
## "Redistribution and use in source and binary for... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# michael a.g. aïvázis
# orthologue
# (c) 1998-2021 all rights reserved
#
"""
Exercise finding both the minimum and the maximum value of a matrix
"""
def test():
# package access
import gsl
# make a matrix and initialize it
m = gsl.matrix(shape=(100,1... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Copyright (C) 2019-2021 Megvii Inc. All rights reserved.
from .base_detection_config import BaseDetectionConfig
_config_dict = dict(
MODEL=dict(
MASK_ON=True,
PIXEL_MEAN=[123.675, 116.28, 103.53], # RGB FORMAT
PIXEL_STD=[1.0, 1.0, 1.0],
... |
# 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)
class PyPySpy(PythonPackage):
"""A Sampling Profiler for Python."""
homepage = "https://github.com/benfred/py-sp... |
# -*- coding: utf-8 -*-
#
# Gradient Boosting documentation build configuration file, created by
# sphinx-quickstart.
#
# 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
# autogenerated file.
#
# All configuration val... |
import hmac
import os
import struct
import time
import binascii
from typing import Union
from peewee import *
import config
from lib.utils import get_today_start_timestamp
from model._post import PostModel
from model.log_manage import ManageLog
from slim.base.user import BaseUser
from slim.utils import StateObject
f... |
from django.contrib import admin
from django.conf import settings
from mce_filebrowser.admin import MCEFilebrowserAdmin
from website.models import Cozinheiro, Post, Pagina
# Register your models here.
class CozinheiroAdmin(MCEFilebrowserAdmin):
pass
class PostAdmin(MCEFilebrowserAdmin):
list_display = ('titulo... |
from setuptools import setup
setup(
name = "PyPermissions",
version = "0.1.4",
author = "Tyler O'Meara",
author_email = "Tyler@TylerOMeara.com",
description = "An extensible permissions framework for granular access control.",
license = "MIT",
keywords = "permissions access control",
ur... |
import json
import pickle
import os.path
from mapswipe_workers.basic import auth
from mapswipe_workers.basic import BaseFunctions
def upload_sample_data_to_firebase():
firebase, postgres = BaseFunctions.get_environment('development')
fb_db = firebase.database()
with open('sample_data.json') as f:
... |
# Generated by Django 2.1.15 on 2020-10-26 19:46
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('core', '0003_ingredient'),
]
operations = [
migrations.CreateModel(
... |
#!/usr/bin/env python
# encoding: utf-8
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import codecs
from distutils.util import strtobool
from io import open
import json
import logging
import sys
from espnet.utils.cli_utils import get_commandline_args
PY2 = sys.version... |
# Copyright 2020 BULL SAS All rights reserved
"""Init for the optimization engine."""
from pathlib import Path
COMPONENT_CONFIG = Path(__file__).parents[1] / "components/components.yaml"
|
"""AWS Image Creation, Management, Testing"""
import json
from copy import deepcopy
from typing import Tuple
import boto3
import botocore.exceptions
import pkg_resources
import yaml
from pkg_resources import resource_string
from retrying import retry
import gen
import gen.build_deploy.util as util
import pkgpanda.ut... |
#!/usr/bin/env python3
# Copyright (c) 2015-2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test multiple RPC users."""
from test_framework.test_framework import BitcoinTestFramework
from test_f... |
# Bep Marketplace ELE
# Copyright (c) 2016-2021 Kolibri Solutions
# License: See LICENSE file or https://github.com/KolibriSolutions/BepMarketplace/blob/master/LICENSE
#
from django.forms.widgets import PasswordInput, Select, TextInput, CheckboxInput, FileInput, DateTimeInput, TimeInput, DateInput, RadioSelect, URLI... |
#! /usr/bin/env python
import sys
import urllib2
import re
# N_glycosylation = 'N[^P](S|T)[^P]' lookahead version:
N_glycosylation = r'(?=(N[^P](S|T)[^P]))'
def main():
prot_ids = sys.argv[1:]
uniprot = 'http://www.uniprot.org/uniprot/'
fastas = {}
for prot_id in prot_ids:
prot_fid = urllib2.urlopen(uniprot +... |
import json
import requests
import pandas as pnd
from scipy.stats import hypergeom, fisher_exact, binom_test
from statsmodels.stats.multitest import multipletests
import sys
import geanno
class Enricher():
'''
Class for managing gene sets and performing GSEA.
...
Attributes
----------
__enric... |
import redis
import frappe
import logging
from zlib import compress
from six import string_types
from pygelf import GelfUdpHandler
def publish_redis_event(queue, compressed):
client = get_redis_client()
if not client:
return
client.lpush(f'events:queue:{queue}', compressed)
def publish_gelf_event(queue, compress... |
import torch
import torch.nn as nn
from torch.autograd import Function
from onmt.utils.misc import aeq as assert_equal
from onmt.modules.sparse_activations import sparsemax
def _fy_backward(ctx, grad_output):
p_star, = ctx.saved_tensors
grad = grad_output.unsqueeze(1) * p_star
return grad
def _omega_sp... |
# Generated by Django 3.1.2 on 2021-01-06 02:55
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0005_auto_20210106_0250'),
]
operations = [
migrations.RemoveField(
model_name='post',
name='tag',
),... |
from django.contrib import admin
from django.contrib.auth import get_user_model
from django.contrib.auth.admin import UserAdmin
from .forms import CustomUserCreationForm, CustomUserChangeForm
from .models import Pilot
class CustomUserAdmin(UserAdmin):
add_form = CustomUserCreationForm
form = CustomUserChangeF... |
from collections.abc import Iterable
from itertools import product
import pytest
import fib
def flat_prod(*xs):
# itertools.chain cannot be used for flattening because it cannot handle
# functions as elements
fs = []
for ps in product(*xs):
fp = []
for p in ps:
if isinstanc... |
"""Contains mocked file object inputs for tests."""
import io
def mock_file_input():
"""Return a string stream of an unfiltered vcf file content."""
return io.StringIO("""##fileformat=VCFv4.2
##FILTER=<ID=PASS,Description="All filters passed">
##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quali... |
"""
Contains the implementation of the Ruby language parser and a relevant keyword enum.
"""
# Authors: Grzegorz Lato <grzegorz.lato@gmail.com>
# License: MIT
from typing import Dict
from enum import Enum, unique
import logging
from pathlib import PosixPath
import os
import pyparsing as pp
import coloredlogs
from ... |
#!/usr/bin/env python
"""Script to generate toy detector variations.
This modifies the output data of a MC simulation.
"""
import argparse
import csv
import experiment
import numpy as np
import numpy.lib.recfunctions as rfn
parser = argparse.ArgumentParser(
description="Modify the reconstructed events of a sim... |
# Copyright 2017 The Bazel 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 applicable la... |
import json
from tests.conftest import setup_dashboard
def test_freeform_mode_has_no_rows_or_cols(monkeypatch, ctx, client):
app, test = client
data = dict(
mode='freeform',
name='Some dashboard',
module_baz=json.dumps(
dict(name=1, width=400, height=112, dataSource='...')... |
from trivia.views import DoubleRoundUpdate, FinalAnswerUpdate, FinalRoundStatusUpdate, FinalRoundWagerUpdate, manage_finalanswers
from django.urls import path
from . import views
app_name = 'trivia'
urlpatterns = [
path('', views.IndexView.as_view(), name='index'),
path('games/', views.GameIndexView.as_view()... |
from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, SubmitField
from wtforms.validators import DataRequired, Length, ValidationError
from app.models.user import User
class SignupForm(FlaskForm):
username = StringField('Username', validators=[DataRequired(), Length(min=4, max=32)])
... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
from typing import List, Union, Dict
from enum import Enum, auto
from rxnpy import Quantity
from rxnpy.chemical.lookup_tools.quantity_parsing.utils import _quantity_approx_equal, _flatten_list
class QuantClass(Enum):
SINGLE = auto()
SERIES = auto()
CONDITIONS = auto()
SERIES_CONDITIONS = auto()
def... |
from collections import namedtuple, deque
from typing import List, Dict, Optional, Union, Any, NamedTuple
from ding.utils.default_helper import deep_merge_dicts
from ding.policy import Policy
class BaseCarlaPolicy(Policy):
"""
Base class for Carla policy interact with environments. The policy is defined in s... |
# -*- coding: utf-8 -*-
# $Id: manpage.py 8860 2021-10-22 16:39:59Z milde $
# Author: Engelbert Gruber <grubert@users.sourceforge.net>
# Copyright: This module is put into the public domain.
"""
Simple man page writer for reStructuredText.
Man pages (short for "manual pages") contain system documentation on unix-like... |
from __future__ import unicode_literals
from django.test import TestCase
from django.test.utils import override_settings
from paypal.standard.forms import PayPalPaymentsForm
class PaymentsFormTest(TestCase):
def test_form_render(self):
f = PayPalPaymentsForm(initial={'business': 'me@mybusiness.com',
... |
# coding: utf-8
"""
Training module
"""
from itertools import count
import argparse
import time
import shutil
from typing import List, Dict
import os
from os.path import join
import queue
from functools import partial
import random
import numpy as np
import torch
import torch.nn as nn
from torch import Tensor
from ... |
import CSP_Solver as CS
problem_name = input('Name of Problem: ')
variables = int(input('Number of Variables: '))
genericCSP = CS.CSP(variables, problem_name=problem_name, solution_path = './Solutions/')
com = input('Do you want to have a common domain for variables(Y/N):')
if com is 'Y':
commonDomain = [in... |
from scrapy.spiders import CrawlSpider, Rule
from scrapy.linkextractors import LinkExtractor
from threatscrape.items import CveItem
import zipfile
import io
import json
import dateparser
class NvdCveSpider(CrawlSpider):
name = 'nvd_cve'
allowed_domains = ['nvd.nist.gov']
start_urls = ['https://nvd.nist.go... |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Copyright (c) 2014-2021 Megvii Inc. All rights reserved.
import torch.nn as nn
from .yolo_head import YOLOXHead,YOLOXHead4
from .yolo_pafpn import YOLOPAFPN,YOLOPAFPN4
class YOLOX(nn.Module):
"""
YOLOX model module. The module list is defined by create_yolov... |
import ssl
import smtplib
import imaplib
import email
class MailBot:
"""
Sending and receiving mail
This contains all methods to interact with smtp and imap servers
"""
# Configs - should not need to change
ssl_port = 465
smtp_server = "smtp.gmail.com"
imap_server = "imap.gmail.c... |
#!/usr/bin/env python
# -*- coding: ASCII -*-
"""
Extract the index sequence from the middle and end of an Illumina run. Separates reads for Paired End runs.
:Author: Martin Kircher
:Contact: mkircher@uw.edu
:Date: *06.12.2019
:Type: tool
:Input: fasta, fastq
:Output: BAM
"""
import sys
import os
import string
tabl... |
# libraries import
from keras.models import Sequential
from keras import layers
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.model_selection import StratifiedKFold
import numpy as np
import pandas as pd
# file import
import data_cleaner as dc
import model_helper as mh
df = dc.clean_item_da... |
from utils.model import Perceptron
from utils.all_utils import prepare_data, save_model, save_plot
import pandas as pd
import logging
logging_str = "[%(asctime)s: %(levelname)s: %(module)s] %(message)s"
logging.basicConfig(level=logging.INFO, format=logging_str)
def main(data, eta, epochs, filename, plotfilename):
... |
from django.http import HttpResponse
from django.shortcuts import render
from .models import Item, Category
# Create your views here.
def get_html(req):
return render(req,"item.html")
def create_item(req):
#解析参数
params = req.POST
name = params.get("i_name")
barcoade = params.get("i_barcode")
... |
__author__ = 'rolandh'
EDUPERSON_OID = "urn:oid:1.3.6.1.4.1.5923.1.1.1."
X500ATTR_OID = "urn:oid:2.5.4."
NOREDUPERSON_OID = "urn:oid:1.3.6.1.4.1.2428.90.1."
NETSCAPE_LDAP = "urn:oid:2.16.840.1.113730.3.1."
UCL_DIR_PILOT = 'urn:oid:0.9.2342.19200300.100.1.'
PKCS_9 = "urn:oid:1.2.840.113549.1.9.1."
UMICH = "urn:oid:1.3.... |
import json
import os
import unittest
import yaml
from cerberus import Validator
types_dir = os.path.join(os.path.dirname(__file__), "..", "types")
class ConditionUtilsTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
with open(os.path.dirname(__file__)+'/TypeSpecSchema.yaml') as in_file:
... |
import tkinter as tk
import pyperclip
from txtcli.model import ErrMsg
from txtcli.util import send_msg
def create_window_center(title: str) -> tk.Tk:
window = tk.Tk()
window.title(title)
window.rowconfigure(0, minsize=500, weight=1)
window.columnconfigure(1, minsize=500, weight=1)
window_width =... |
"""
Tools to process TCX files,
specifically for parsing and
converting to other formats.
"""
import numpy as np
import pandas as pd
from lxml import objectify
import dateutil.parser
import logging
TPXNS = "{http://www.garmin.com/xmlschemas/ActivityExtension/v2}TPX"
LXNS = "{http://www.garmin.com/xmlschemas/ActivityE... |
# Author: Alexander Sirotin / sirotin@gmail.com
# Copyright (c) 2017 Alexander Sirotin.
# Licensed under MIT license:
# https://opensource.org/licenses/mit-license.php
# Your use is on an "AS-IS" basis, and subject to the terms and conditions of this license.
import pickledb
import logging
import base64
import json
f... |
import os
import os.path
import re
import json
import time
import datetime
import hashlib
import logging
import tarfile
import textwrap
import urllib.parse
import io
from rfc3339 import rfc3339
from lxml import etree
from urllib.request import url2pathname
from django.db import models
from django.db.models import Q
f... |
# pylint:disable=unused-variable
# pylint:disable=unused-argument
# pylint:disable=redefined-outer-name
import os
from copy import deepcopy
from typing import Dict
import aiohttp
import pytest
import tenacity
from minio import Minio
from servicelib.minio_utils import MinioRetryPolicyUponInitialization
from... |
# -*- coding: utf-8 -*-
"""Integration tests with httplib2"""
import sys
from urllib.parse import urlencode
import pytest
import pytest_httpbin.certs
import vcr
from assertions import assert_cassette_has_one_response
httplib2 = pytest.importorskip("httplib2")
def http():
"""
Returns an httplib2 HTTP inst... |
# Universal Power Supply Controller
# USAID Middle East Water Security Initiative
#
# Developed by: Nathan Webster
# Primary Investigator: Nathan Johnson
#
# Version History (mm_dd_yyyy)
# 1.00 03_24_2018_NW
#
######################################################
def Run_Config():
# Water
global P_Min_Percent
... |
def findDecision(obj): #obj[0]: Passanger, obj[1]: Coupon, obj[2]: Education, obj[3]: Occupation, obj[4]: Restaurant20to50, obj[5]: Direction_same, obj[6]: Distance
# {"feature": "Restaurant20to50", "instances": 23, "metric_value": 0.9986, "depth": 1}
if obj[4]>0.0:
# {"feature": "Coupon", "instances": 21, "metric_... |
from setuptools import setup, find_packages
VERSION = '0.7'
DESCRIPTION = 'Little helper tools for IB API'
LONG_DESCRIPTION = 'Little helper tools for IB API'
setup(
name="ibtools",
version=VERSION,
author="Juergen Reiss",
author_email="juxeiier@gmail.com",
description=DESCRIPTION,
long_descri... |
import urllib
import re
from bs4 import BeautifulSoup
from bedetheque_lib import *
fname_series = "bdt_series.txt"
fname_parsed_series = "bdt_parsed_series.txt"
re_strg_bd = "http://www.bedetheque.com/BD[^#]+"
series = list()
fhand = open(fname_series)
print "Opening", fname_series
i = 0
for line in fhand:
line =... |
from ....data import datasets
from .coco import coco_evaluation
from .voc import voc_evaluation
def evaluate(dataset, predictions, output_folder, **kwargs):
"""evaluate dataset using different methods based on dataset type.
Args:
dataset: Dataset object
predictions(list[BoxList]): e... |
import os
from ciscosparkbot import SparkBot
import cico_meraki
import cico_spark_call
import cico_combined
import cico_common
import cico_umbrella
import sys
# Retrieve required details from environment variables
bot_email = os.getenv("SPARK_BOT_EMAIL")
spark_token = os.getenv("SPARK_BOT_TOKEN")
bot_url = os.getenv("... |
"""
Module for drawing trees.
"""
from PIL import ImageDraw
import svgwrite
from Tree.utils import convert_color
class Drawer(object):
"""A generic class for drawing tree on acanvas."""
def __init__(self, tree, canvas, stem_color=(255, 255, 255), leaf_color=(230, 120, 34), thickness=1, ages=None):
"""C... |
dataset_type = 'CocoDataset'
data_root = 'data/coco/'
img_norm_cfg = dict(
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
train_pipeline = [
dict(type='LoadImageFromFile'),
dict(
type='LoadAnnotations', with_bbox=True, with_mask=True, with_seg=True),
dict(type='Resize'... |
"""
raven.handlers.logbook
~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import logbook
import sys
import traceback
from raven.base import Client
from raven.utils.encoding import t... |
# Copyright 2010-2011 OpenStack Foundation
# Copyright 2011 Piston Cloud Computing, Inc.
# All Rights Reserved.
# Copyright 2013 Red Hat, 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 Li... |
import torch
from vltk.inspection import collect_args_to_func
class Processor:
_type = None
_keys = ()
@property
def keys(self):
if isinstance(self._keys, str):
return set([self._keys])
return set(self._keys)
def __init__(self, **kwargs):
for k, v in kwargs.it... |
from datetime import timedelta
from datetime import date
from strategy import Strategy
from pandas.core.frame import DataFrame
import pandas as pd
from trendy import segtrends
import numpy as np
import csv
import sys
import logging
class TrendStrategy(Strategy):
window = 21
field = 'Close'
predict =... |
# coding=utf-8
# Copyright 2020 The Google Research 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 applicab... |
'''
Michael Lam
ASTP-720, Spring 2020
Set of functions to perform interpolation
Should only do linear interpolation for now
as we haven't discussed matrices yet, sorry
'''
def linear_interpolator(xs, ys):
"""
Linear interpolation of points (x, y)
Parameters
----------
xs : list, np.ndarray
... |
"""
Copyright (c) 2019 Gabriel Kind
Hochschule Mittweida, University of Applied Sciences
Released under the MIT license
"""
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout, Button, HTML, Hidden
from crispy_forms.bootstrap import FormActions
from django import forms
from django.core.e... |
# -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# https://docs.scrapy.org/en/latest/topics/items.html
import scrapy
# 明确需要抓取的目标数据
class MovieItem(scrapy.Item):
# define the fields for your item here like:
download_url = scrapy.Field()
|
# 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... |
from __future__ import unicode_literals
import pytest
import boto
import boto3
from boto.exception import EC2ResponseError
from botocore.exceptions import ClientError
import sure # noqa
from moto import mock_ec2, mock_ec2_deprecated
from tests import EXAMPLE_AMI_ID
from tests.helpers import requires_boto_gte
@moc... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.