text stringlengths 1 927k |
|---|
from simulation.speedLimits import *
from simulation.trafficGenerators import *
maxFps= 40
size = width, heigth = 1280, 500
# in miliseconds
updateFrame = 500
seed = None
lanes = 2
length = 200
maxSpeed = 5
maxLength = 10000
speedLimits = [ SpeedLimit( range=((100,1),(100,1)), limit=0, ticks=0, active=False),
... |
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import functools
import json
import logging
import os
import re
import sys
import traceback
import uuid
from datetime import datetime
from django.utils import html
from six.moves.urllib.parse import urlparse... |
"""NN modules"""
import torch as th
import torch.nn as nn
from torch.nn import init
import dgl.function as fn
import dgl.nn.pytorch as dglnn
from utils import get_activation
class GCMCGraphConv(nn.Module):
"""Graph convolution module used in the GCMC model.
Parameters
----------
in_feats : int
... |
"""
https://leetcode.com/problems/plus-one/
Given a non-empty arr of digits representing a non-neg int, increment that int by 1.
Most significant digit is at the head of the list.
Each el contains a single digit.
The int doesn't contain leading zeros, except for the int 0 itself.
examples:
[1,2,3] -> [1,2,4]
[4,3,2,1... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import signal, os
import time
def handler(signum, frame):
print ("Signal handler called with signal: " +str(signum))
print ("complete operations needed when alarm received")
def main():
signal.signal(signal.SIGALRM, handler)
print ("set alarm signal")
si... |
# -*- coding: utf-8 -*-
import subprocess
from pyhammer.tasks.taskbase import TaskBase
class TortoiseSvnCommitTask( TaskBase ):
def __init__( self, path ):
super(TortoiseSvnCommitTask, self).__init__()
self.__path = path
def RunCmd( self, CmdLine, CmdDir = None ):
p = subprocess.Pope... |
def extraction_colunms_value(DataFrame, DataCompare, ColumName):
data = []
index = DataFrame.Species.str.contains(DataCompare)
if(ColumName == 'SepalLengthCm'):
data = DataFrame[index].SepalLengthCm
if(ColumName == 'SepalWidthCm'):
data = DataFrame[index].SepalWidthCm
if(ColumName == 'PetalWidthCm'):... |
#!/usr/bin/env python3
# Copyright (c) 2019-2022, Dr.-Ing. Marc Hirschvogel
# All rights reserved.
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import ufl
# fluid mechanics variational forms class
# Principle of Virtual Power
# TeX... |
from .modeling import *
from .tokenizer import * |
##################################################
# Import Own Assets
##################################################
from hyperparameter_hunter import exceptions
from hyperparameter_hunter.settings import G
from hyperparameter_hunter.utils.general_utils import now_time, expand_mins_secs
##########################... |
#!/usr/bin/env python
"""
Setuptools bootstrapping installer.
Run this script to install or upgrade setuptools.
"""
import os
import shutil
import sys
import tempfile
import zipfile
import optparse
import subprocess
import platform
import textwrap
import contextlib
import warnings
from distutils import log
try:
... |
import os
import rasterio
import numpy as np
from ..utils import pair, bytescale
from .base import BaseRasterData
class RasterSampleDataset(BaseRasterData):
"""Dataset wrapper for remote sensing data.
Args:
fname:
win_size:
step_size:
pad_size:
band_index:
"""
... |
from __future__ import print_function, division
import os
import numpy as np
from astropy import log
from astropy.io import fits
from astropy.table import Table
from scipy.interpolate import interp1d
from astropy import units as u
from ..utils.validator import validate_array
from .helpers import parse_unit_safe, as... |
import os
base_path = os.path.dirname(os.path.abspath(__file__))
class Config:
"""Parent configuration class."""
DEBUG = False
SQLALCHEMY_DATABASE_URI = "sqlite:///shopyo.db"
SQLALCHEMY_TRACK_MODIFICATIONS = False
SECRET_KEY = os.urandom(24)
BASE_DIR = base_path
STATIC = os.path.join(BAS... |
import numpy as np
import matplotlib.pyplot as plt
import main.utils as utils
import time
# ---------------------------- 说明 ----------------------------------
# MCN的python复现
# ---------------------------- 说明 ----------------------------------
class MCNParams:
"""
a struct define the input params MCN class us... |
import importlib
import numpy as np
import torch
from scipy.ndimage import rotate, map_coordinates, gaussian_filter
from scipy.ndimage.filters import convolve
from skimage.filters import gaussian
from skimage.segmentation import find_boundaries
from torchvision.transforms import Compose
# WARN: use fixed random state... |
#
# 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... |
"""
Customized Mixin2to3 support:
- adds support for converting doctests
This module raises an ImportError on Python 2.
"""
from distutils.util import Mixin2to3 as _Mixin2to3
from distutils import log
from lib2to3.refactor import RefactoringTool, get_fixers_from_package
import setuptools
class DistutilsRefactori... |
#!/usr/bin/env python
import sys
import struct
import os
from scapy.all import sniff, sendp, hexdump, get_if_list, get_if_hwaddr
from scapy.all import Packet, IPOption
from scapy.all import ShortField, IntField, LongField, BitField, FieldListField, FieldLenField
from scapy.all import IP, TCP, UDP, Raw
from scapy.layer... |
from path import Path
from paver.doctools import cog, html
from paver.easy import options
from paver.options import Bunch
from paver.setuputils import setup
IMPORTS=[cog, html, setup]
options(
cog=Bunch(
basedir='.',
pattern='README.rst',
includedir='pyscreenshot',
beginspec='... |
"""Reducing Functions in Python
These are functions that recombine an iterable recursively, ending up with a single return value
Also called accumulators, aggregators, or folding functions
Example
""" |
# -*- coding: utf-8 -*-
"""
Script for å interaktivt legge til NVDB-vegnett og fagdata via python
kommandolinje i QGIS. Se dokumentasjon på bruk av nvdbapi - funskjoner på
https://github.com/LtGlahn/nvdbapi-V3
Legg dette scriptet et sted hvor det er lettvint
å finne fra QGIS. F.eks. C:/Users/<dittbrukernavn>.
EKS... |
import torch
import torch.nn as nn
class LayerNorm(nn.Module):
"""
Layer Normalization.
https://arxiv.org/abs/1607.06450
"""
def __init__(self, hidden_size, eps=1e-6):
super(LayerNorm, self).__init__()
self.eps = eps
self.gamma = nn.Parameter(torch.ones(hidden_size))
... |
#!/usr/bin/env python
# Written by John Hoffman
# see LICENSE.txt for license information
from BitTornado import PSYCO
if PSYCO.psyco:
try:
import psyco
assert psyco.__version__ >= 0x010100f0
psyco.full()
except:
pass
from download_bt1 import BT1Download
from RawServer import ... |
# -*- coding: utf-8 -*-
for i in range(2, int(raw_input()) + 1, 2):
print '%d^2 = %d' % (i, i ** 2) |
from kazoo.client import KazooClient
from kazoo.exceptions import NoNodeError
from kazoo.exceptions import NodeExistsError
_callback = None
_zk = None
def init_kazoo(hosts, data_path, callback, children=True):
global _zk
global _callback
_zk = KazooClient(hosts=hosts)
_zk.start()
_callback = ca... |
import functools
from .events import FunctionEvent
from .formatters import BaseFormatter, DefaultFormatter
def docstringer(
_func=None, *, active=True, formatter: BaseFormatter = DefaultFormatter()
):
"""
A decorator that will output the function docstring, call values and return value when the function... |
from django.core.management.base import BaseCommand
from django.db.utils import OperationalError
from customers.models import Customer
from geolocation.models import Location
import csv
import sys
class Command(BaseCommand):
"""
Command that populates the Customers table
"""
def __init__(self, *arg... |
import ustruct
import i2c_bus
class RTC:
def __init__(self):
self.addr = 0x51
self.i2c = i2c_bus.get(i2c_bus.M_BUS)
def get_time(self):
buf = self._regchar(0x02, buf=bytearray(3))
seconds = self.bcd2_to_byte(buf[0] & 0x7f)
minutes = self.bcd2_to_byte(buf[1] & 0x7f)
... |
import numpy as np
detection_file = 'samples.npy'
detections = None
if detection_file is not None:
detections = np.load(detection_file)
np.savetxt('samples.txt', detections, fmt='%0.18f')
f = open('samples.txt')
out = open('complex.txt', "w")
lines = f.readlines()
for line in lines:
for i in line:
if i... |
# Copyright (c) 2020, Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can be
# found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
from coremltools.converters.mil.mil import get_new_symbol
from ._op_reqs import *
@register_op(doc_... |
import random
symbols = ['rock', 'paper', 'scissors']
player_wins = 0
computer_wins = 0
while max([player_wins, computer_wins]) < 3:
player_symbol = None
while player_symbol is None:
input_symbol = input("What symbol do you want? ")
if input_symbol in symbols:
player_symbol = inpu... |
# 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 writing, software
# distribu... |
#! /usr/bin/env python3
# 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.
r"""
Multi-objective optimization benchmark problems.
References
.. [Deb2005dtlz]
K. Deb, L. Thiele, M. Laumanns... |
# Copyright 2020-2021 Open Networking Foundation
# Copyright 2021-present Princeton University
#
# 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... |
"""
Record known compressors
Includes utilities for determining whether or not to compress
"""
from __future__ import print_function, division, absolute_import
import logging
import random
import dask
from toolz import identity, partial
try:
import blosc
n = blosc.set_nthreads(2)
if hasattr("blosc", "r... |
"""
Console Module display message of a dialog
"""
import wx
import sys
from sas.sascalc.dataloader.loader import Loader
_BOX_WIDTH = 60
CONSOLE_WIDTH = 340
CONSOLE_HEIGHT = 240
if sys.platform.count("win32") > 0:
_STATICBOX_WIDTH = 450
PANEL_WIDTH = 500
PANEL_HEIGHT = 550
FONT_VARIANT = 0
else:
_S... |
"""
A set of functions to handle syntax differences between DBs
"""
def bind_var(var, db='oracle'):
"""Format of named bind variable"""
if db == 'postgresql':
return '%({})s'.format(var)
elif db == 'oracle':
return ':{}'.format(var)
else:
return ':{}'.format(var) |
import ctypes
import llvmlite.ir as ir
from CodeGen import LLVMCodeGenerator
from coretypes import *
from scopes import Scope
from typelib import *
ZERO = ir.Constant(ir.IntType(64), 0)
def _eq_Float(cg: LLVMCodeGenerator, args, arg_types):
return cg.builder.fcmp_ordered("==", args[0], args[1])
def _neq_Floa... |
import module1 |
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Manuel Moussallam <manuel.moussallam@gmail.com>
#
# License: BSD (3-clause)
import numpy as np
from numpy.testing import assert_array_almost_equal
from bird.mdct_tools import mdct, imdct
def test_mdct():
"Test mdct and imdct tight frame prope... |
from .base import *
from .hash_util import *
from .cyclic import *
from .bounded import *
from .unbounded import *
from .dihedral_lattice import *
from .null import *
from .bridge import *
from .stack import *
from .f222 import * |
import argparse
import collections
import datetime
import itertools
import logging
import re
import sys
import time
# 500 17458
# 5000 179458
# 50000 1799458
# 50B 1799999999458
def parse_args(args):
parser = argparse.ArgumentParser()
parser.add_argument("input", type=argparse.FileType('r'),
... |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
#! /usr/bin/python
# Copyright 2019 Nokia
#
# 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 ... |
from typing import List
class Solution:
def moveZeroes(self, nums: List[int]) -> None:
"""
Do not return anything, modify nums in-place instead.
"""
cur_idx = 0
for num in nums:
if num == 0:
continue
nums[cur_idx] = num
cu... |
'''
Created on 2016/10/25
:author: hubo
'''
from vlcp.config import config
from vlcp.protocol.zookeeper import ZooKeeper
import vlcp.protocol.zookeeper
from random import random
from vlcp.event.core import syscall_clearqueue
from logging import getLogger
_logger = getLogger(__name__)
@config('protocol.zookeeper')... |
#!/usr/bin/env python3
# Copyright (c) 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 the blocksdir option.
"""
import os
import shutil
from test_framework.test_framework import bitcoinRT... |
import datetime
from unittest import TestCase
from pystac import Provider, MediaType
from pystac.extensions.projection import ProjectionExtension
from pystac.provider import ProviderRole
from stactools.cop_dem import stac
from tests import test_data
class StacTest(TestCase):
def setUp(self):
self.glo30... |
# INVERTED HIERARCHY
import prior_handler as phandle
import math
import numpy as np
import os
cwd = os.path.dirname(os.path.realpath(__file__))
print(cwd)
prior_handler = phandle.PriorHandler(cwd)
con = prior_handler.c
n_pars = prior_handler.n_pars
def prior(cube, n_dims, n_pars):
return prior_handler.scale(cube)... |
# Copyright 2018 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 applic... |
from game.combat.effects.moveeffect.basemoveeffect import BaseMoveEffect
class Avghp(BaseMoveEffect):
def after_action(self):
user_hp = self.scene.board.get_data(self.move.user).current_hp
user_max_hp = self.scene.board.get_actor(self.move.user).stats[0]
target_hp = self.scene.board.get_da... |
from ProjectEulerCommons.Base import *
def get_triangle_length_pairs(p):
return sum([True for a in range(1, p - 2) for b in range(a, p - a - 1) if p - a - b > b and a**2 + b**2 == (p - a - b)**2])
Answer(
max_index([(p, get_triangle_length_pairs(p)) for p in range(3, 1000 + 1)])[0]
)
"""
--------------------... |
# Copyright 2020 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 ac... |
import nodes
from parsers import parse
"""
This file contains a function to parse a query.
It will have to return a rootnode.
"""
BINARY_OPERATOR, UNARY_OPERATOR, MODIFIER, TERM = range(4)
# Contains a tuple : The first element is the node, the second is the priority of the operator (the bigger it is, the more the o... |
import zlib
from datetime import datetime
from django.conf import settings
from django.db import models
from django.urls import reverse
from django.utils import timezone
from django.utils.http import urlencode
from django.utils.timesince import timesince
from django.utils.translation import ugettext_lazy as _
from da... |
#!/usr/bin/env python
# Jonas Schnelli, 2013
# make sure the Graincoin-Qt.app contains the right plist (including the right version)
# fix made because of serval bugs in Qt mac deployment (https://bugreports.qt-project.org/browse/QTBUG-21267)
from string import Template
from datetime import date
bitcoinDir = "./";
i... |
"""
Part 1 of https://adventofcode.com/2020/day/9
"""
def read_data(filename: str) -> list:
with open(filename, "r") as f:
data = f.read().split("\n")
return data
def sum_to_n(n, options):
"""
Helper function adapted from Day 1 :)
"""
try:
for num in options:
comp... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import logging
import logging.config
import sys
import json
from optparse import OptionParser
import discogs_client
parentdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(parentdir)
from discogstagger.tagger_config import TaggerCon... |
import unittest
import os
from labchain.datastructure.txpool import TxPool
from labchain.datastructure.transaction import Transaction
from labchain.util.cryptoHelper import CryptoHelper
from labchain.datastructure.blockchain import BlockChain
from labchain.util.configReader import ConfigReader
from labchain.consensus.... |
import numpy as np
from gdsfactory.simulation.modes.find_mode_dispersion import find_mode_dispersion
def test_find_modes_waveguide_dispersion() -> None:
modes = find_mode_dispersion(wg_width=0.45, resolution=20, cache=None)
m1 = modes
# print(f"neff1 = {m1.neff}")
# print(f"ng1 = {m1.ng}")
# ne... |
"""
University of Minnesota
Aerospace Engineering and Mechanics - UAV Lab
Copyright 2019 Regents of the University of Minnesota.
See: LICENSE.md for complete license details.
Author: Louis Mueller, Chris Regan
"""
import os.path
from xml.etree import ElementTree as ET
import numpy as np
ft2m = 0.3048
psf2pa = 47.8... |
# Copyright (c) 2015 Pixomondo
#
# CONFIDENTIAL AND PROPRIETARY
#
# This work is provided "AS IS" and subject to the MIT License included in this
# distribution package. See LICENSE.
# By accessing, using, copying or modifying this work you indicate your
# agreement to the MIT License. All rights
# not expressly grante... |
from datetime import datetime
from urbanairship import common
from urbanairship.push import ScheduledPush
VALID_DAYS = [
"monday",
"tuesday",
"wednesday",
"thursday",
"friday",
"saturday",
"sunday",
]
VALID_RECURRING_TYPES = ["hourly", "daily", "weekly", "monthly", "yearly"]
class Schedu... |
from django import forms
from .models import *
# create your forms
class PostArticle(forms.ModelForm):
class Meta:
model = Article
fieldS = '__all__'
exclude = ['article_author', 'slug', 'posted_on']
class PostComment(forms.ModelForm):
class Meta:
model = Comment
... |
"""
Django settings for basicforms project.
Generated by 'django-admin startproject' using Django 2.1.4.
For more information on this file, see
https://docs.djangoproject.com/en/2.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.1/ref/settings/
"""
import os... |
# 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 ... |
"""
Python Interchangeable Virtual Instrument Library
Copyright (c) 2012-2016 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... |
import sys
import json
import cgi
fs = cgi.FieldStorage()
sys.stdout.write("Content-Type: application/json")
sys.stdout.write("\n")
sys.stdout.write("\n")
result = {}
result['success'] = True
result['message'] = "The command Completed Successfully"
result['keys'] = ",".join(fs.keys())
d = {}
for k in fs.keys():
... |
"""Handle multiple samples present on a single flowcell
Merges samples located in multiple lanes on a flowcell. Unique sample names identify
items to combine within a group.
"""
import os
import shutil
from bcbio import bam, utils
from bcbio.distributed.transaction import file_transaction, tx_tmpdir
from bcbio.pipeli... |
# from abc import ABCMeta, abstractmethod
# from typing import Iterator
# class Transform(metaclass=ABCMeta):
# def __init__(self):
# pass
# @property
# @abstractmethod
# def waveform(self) -> Iterator[float]:
# pass |
"""
Author: CaptCorpMURICA
Project: 100DaysPython
File: module1_day04_variables.py
Creation Date: 6/2/2019, 8:55 AM
Description: Learn about using variables in python.
"""
# Variables need to start with a letter or an underscore. Numbers can be used in the variable name... |
#!/usr/bin/python
# (c) 2016, Pierre Jodouin <pjodouin@virtualcomputing.solutions>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... |
from setuptools import setup, find_packages
with open('README.rst', 'r', encoding='utf8') as f:
readme = f.read()
with open('requirements.txt','r',encoding='utf8') as f:
requirements = f.readlines()
version = __import__('island_backup').version
setup(
name='island_backup',
version=version,
desc... |
"""
sphinx.util.i18n
~~~~~~~~~~~~~~~~
Builder superclass for all builders.
:copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import os
import re
from datetime import datetime, timezone
from os import path
from typing import TYPE_CHECKING,... |
import abc
class WriterBase(abc.ABC):
@abc.abstractmethod
def set_pipe(self, pipe):
pass
@abc.abstractmethod
def parallel_write_end_loop(self) -> None:
pass
@abc.abstractmethod
def is_running(self):
pass
@abc.abstractmethod
def is_stopped(self):
pass... |
#!/usr/bin/env python
#
# @file muse_combineRoiMapsIter.py
# @brief Combine roi probability maps for a single subject
#
# Copyright (c) 2011, 2012 University of Pennsylvania. All rights reserved.<br />
# See http://www.cbica.upenn.edu/sbia/software/license.html or COPYING file.
#
# Contact: SBIA Group <sbia-software a... |
#!/usr/bin/env python3
#
#
# 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 writing,
# sof... |
# Download the helper library from https://www.twilio.com/docs/python/install
from twilio.rest import Client
# Your Account Sid and Auth Token from twilio.com/console
# DANGER! This is insecure. See http://twil.io/secure
account_sid = 'ACc07d36f2bedb365988af5c81d578bfef'
auth_token = 'd7698b135d26730bf84600c176d6815f... |
import torch
import torch.nn as nn
from torchvision.transforms import ToTensor, ToPILImage
class Generator(nn.Module):
def __init__(self):
super().__init__()
self.conv_block = nn.Sequential(
nn.ConvTranspose2d(100, 512, 4, 1, 0),
... |
## @package Engines
# The superior method to solving complex problems is by easily consumable and scalable design, not complex code.
#
# The engines package consists of virtual classes and methods that define the structure of the engine modules.
#
# New modules are installed simply by dropping a compliant engine module... |
import sys, os
print("Ola do filho", os.getpid(), sys.argv[1]) |
from django import template
register = template.Library()
@register.simple_tag(takes_context=True)
def append_to_get(context, replace=True, **kwargs):
"""
Adds/deletes arguments to the current GET value
and returns a querystring containing it.
@argument replace: If true, any existing argument
... |
#
# ReportConverter: A graphical report generator for DRace
#
# Copyright 2019 Siemens AG
#
# Authors:
# <Philip Harr> <philip.harr@siemens.com>
#
# SPDX-License-Identifier: MIT
#
## \package ReportConverter
## \brief Python XML to HTML report converter for the better visualization of drace result data
import... |
"""A setuptools based setup module.
See:
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
"""
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path
here = path.absp... |
from django.db.models import Q
from django.core.exceptions import ValidationError
from settings.local import people_who_need_to_know_about_failures
from settings.local import inventorys_email
from email.mime.text import MIMEText
import ipaddr
import smtplib
import re
import urllib
# http://dev.mysql.com/doc/refman/... |
from wtforms import Form, TextField, SelectField
from wtforms.validators import DataRequired
class QueryForm(Form):
search_query = TextField('', validators=[DataRequired()], render_kw={"placeholder": "Your query here"})
search_category = SelectField('Search for', choices=[('pa', 'Paper / Author'), ('p', 'Pape... |
#!/usr/bin/env python3
# Copyright (c) 2017-2020 The Finalcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test deprecation of RPC calls."""
from test_framework.test_framework import FinalcoinTestFramework
c... |
#!/usr/bin/env python
"""
This scripts uses the phraseengine to process and generate
noun phrases from documents
"""
from phraseengine import PhraseEngine
from phraseengine.exceptions import PhraseEngineServiceException
def run_engine(document):
response = {}
engine = PhraseEngine()
try:
engine.set... |
"""
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 pytest, sys, os
myPath = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, myPath + '/../src/')
from sqlitedriver import sqliteclass
dbname = 'test.db'
shorturl = "shortdata"
longurl = "longdata"
@pytest.fixture(scope='module')
def resource_setup(request):
print('Setting up resources for testi... |
# -*- coding: UTF-8 -*-
__author__ = 'Joynice'
import queue
import re
import threading
import requests
from faker import Faker
from flask_migrate import Migrate, MigrateCommand
from flask_script import Manager
from lxml import etree
from .app import create_app
from .exts import db
from .models import Poem, Poet
user... |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 Justin Santa Barbara
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance wi... |
import torch
from torch import nn
import torch.nn.functional as F
from torch_scatter import scatter_add
class NCE_C_Parameter(torch.nn.Module):
def __init__(self, N):
super(NCE_C_Parameter, self).__init__()
self.NCE_C = nn.Parameter(torch.zeros(N, requires_grad=True))
class GNN_EBM_Layer_01(torc... |
from __future__ import print_function, division
import sys
sys.path.insert(0, 'lib')
import numpy as np
import random
import scipy.io as sio
import os
import pandas as pd
import scipy.ndimage as ndimage
import math
import os
import scipy.linalg as la
from joblib import Parallel, delayed
from scipy.optimize import curv... |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "somedjango.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that t... |
import logging
import sys
import itertools
import time
import click
import click_log
import tqdm
import pysam
import multiprocessing as mp
from inspect import getframeinfo, currentframe, getdoc
from ..utils import bam_utils
from ..utils.model import LibraryModel
from ..annotate.command import get_segments
from .... |
""" Represents a bundle. In the words of the Apple docs, it's a convenient way to deliver
software. Really it's a particular kind of directory structure, with one main executable,
well-known places for various data files and libraries,
and tracking hashes of all those files for signing purposes.
For is... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated from FHIR 3.0.0.11832 on 2017-03-22.
# 2017, SMART Health IT.
import os
import io
import unittest
import json
from . import servicedefinition
from .fhirdate import FHIRDate
class ServiceDefinitionTests(unittest.TestCase):
def instantiate_from(self, f... |
# coding: utf-8
from ..cryptmanager import *
from ..utils import *
from ..cartaodecidadao import CartaoDeCidadao
from ..certmanager import CertManager
from Crypto.Hash import SHA256
from hmac import compare_digest
import hashlib
import json
import os
import getpass
import sys
class ReceiptManager:
def __init__(self,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.