src stringlengths 721 1.04M |
|---|
## begin license ##
#
# "Meresco Oai" are components to build Oai repositories, based on
# "Meresco Core" and "Meresco Components".
#
# Copyright (C) 2007-2008 SURF Foundation. http://www.surf.nl
# Copyright (C) 2007-2010 Seek You Too (CQ2) http://www.cq2.nl
# Copyright (C) 2007-2009 Stichting Kennisnet Ict op school. ... |
#!/usr/bin/env python
# python: coding=utf-8
#
# 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 Licens... |
import random
from contextlib import suppress
from django.conf import settings
from django.contrib.auth import get_user_model
from django.contrib.sites.models import Site
from django.core.management.base import BaseCommand
from django.db.utils import IntegrityError
from faker import Faker
from api.elections.models i... |
#!/usr/bin/python
# Generate original static file to another with new prefix
# ./sgen index.html old_prefix static_index.html new_prefix
import sys
from os import walk, path, environ
# File lists
# The two file lists should be aligned.
root = environ['TRAVIS_BUILD_DIR']
files = []
for (dirpath, dirname, filenames)... |
import os
import yaml
from . import parse
parser_dict = {
"extract": parse.extract.validate_yaml,
"select": parse.select.validate_yaml,
"predict": parse.predict.validate_yaml,
}
def _parse_helper(config_type, config_path, config_yaml):
"""
helper function to avoid repeating code
Parameters... |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# ThinkOpen Solutions Brasil
# Copyright (C) Thinkopen Solutions <http://www.tkobr.com>.
#
# This... |
# -*- coding: utf-8; Mode: Python; indent-tabs-mode: nil; tab-width: 4 -*-
# Copyright (C) 2006, 2007, 2008 Canonical Ltd.
# Written by Colin Watson <cjwatson@ubuntu.com>.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# t... |
#########################################################################
#########################################################################
# Classes for handling genome-wide association input and output files, ##
# analysis and qc programs, and post-hoc analyses ##
########################... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
AUTHOR
Pedro Cerqueira
github: @pedrorvc
DESCRIPTION
This script serves to create xml files contaning the information necessary
for the execution of BRIG (Blast Ring Image Generator), reducing the time
performing the tedious task of setting u... |
#! /usr/bin/env python2
"""
mbed SDK
Copyright (c) 2011-2013 ARM Limited
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicabl... |
#!/usr/bin/env python
# Copyright (c) 2012 Cloudera, Inc. All rights reserved.
#
# This test suite validates query results in recordservice are always updated.
from subprocess import call
from tests.common.impala_test_suite import *
TEST_DB1 = 'tmpDb1'
TEST_DB2 = 'tmpDb2'
TEST_TBL1 = 'tmpTbl1'
TEST_TBL2 = 'tmpTbl2'
T... |
import unittest
from pykhet.components.types import MoveType, Move, TeamColor, Orientation
from pykhet.components.types import Position
from pykhet.games.game_types import ClassicGame
class TestClassicGames(unittest.TestCase):
def setUp(self):
self.game = ClassicGame()
def tearDown(self):
s... |
"""
pgoapi - Pokemon Go API
Copyright (c) 2016 tjado <https://github.com/tejado>
Modifications Copyright (c) 2016 j-e-k <https://github.com/j-e-k>
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 w... |
import ctypes
# ctypes makes it very simple to interact with the Windows API in a python script,so it will be a required import for this script. It provides C compatible data types and allows calling functions in DLLs or shared libraries
shellcode = (
);
# Shellcode - This is the shellcode that will be injected into me... |
# -*- coding: utf-8 -*-
#
# IOTile CoreTools documentation build configuration file, created by
# sphinx-quickstart on Sun Jan 15 09:29:56 2017.
#
# 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 fi... |
from nose.tools import assert_equal
from nose.tools import assert_raises
import zuice
from zuice import Bindings
from zuice import Injector
from zuice import NoSuchBindingException
from zuice import dependency
from zuice import Base
class Apple(object):
pass
default_apple = Apple()
class Banana(object):... |
#
# General-purpose Photovoltaic Device Model - a drift diffusion base/Shockley-Read-Hall
# model for 1st, 2nd and 3rd generation solar cells.
# Copyright (C) 2012-2017 Roderick C. I. MacKenzie r.c.i.mackenzie at googlemail.com
#
# https://www.gpvdm.com
# Room B86 Coates, University Park, Nottingham, NG7 2RD... |
import socket
import optparse
def parseargs():
def parse_field_args(option, opt_str, value, parser):
args=[]
for arg in parser.rargs:
if arg[0] != "-":
args.append(arg)
else:
del parser.rargs[:len(args)]
break
if getatt... |
import time
import re
import os
import mimetypes
import json
import cgi
from Config import config
from Site import SiteManager
from User import UserManager
from Plugin import PluginManager
from Ui.UiWebsocket import UiWebsocket
from Crypt import CryptHash
status_texts = {
200: "200 OK",
206: "206 Partial Cont... |
#!/usr/bin/env python
import kalipi
from kalipi import *
#############################
## Kismet version ##
if "KISMETVER" in os.environ and os.environ["KISMETVER"] == "2":
kismetver = 2
else:
kismetver = 1
#############################
## Local Functions ##
# Toggle Kismet
def toggle_kism... |
'''
Copyright (c) 2011, Universidad Industrial de Santander, Colombia
University of Delaware
All rights reserved.
@author: Sergio Pino
@author: Henry Arguello
Website: http://www.eecis.udel.edu/
emails : sergiop@udel.edu - henarfu@udel.edu
Date : Apr, 2011
'''
from gnuradio import gr
from gnuradio.gr import firdes... |
# -*- coding: utf-8 -*-
""" Sahana Eden Survey Tool
@copyright: 2011-2013 (c) Sahana Software Foundation
@license: MIT
ADAT - Assessment Data Analysis Tool
For more details see the blueprint at:
http://eden.sahanafoundation.org/wiki/BluePrint/SurveyTool/ADAT
Permission is hereby granted, fr... |
# -*- coding: utf-8 -*-
#
# This file is part of the bliss project
#
# Copyright (c) 2016 Beamline Control Unit, ESRF
# Distributed under the GNU LGPLv3. See LICENSE for more info.
"""
ID31 motion hook for the carnac motors.
"""
import logging
import gevent
from bliss.common.hook import MotionHook
class CarnacHoo... |
from setuptools import setup, find_packages
version = '0.4.dev0'
long_desc = open("README.rst").read() + "\n" + open('CHANGES.txt').read()
setup(
name='doublespeak',
version=version,
author='Minddistrict',
url='https://github.com/minddistrict/doublespeak',
license='BSD',
package_dir={'': 'src'... |
from functools import partial
from .. import races
from .. import classes
from ..magic import SpellBook
class Character(object):
def __init__(self, name, description, equipment, inventory, attributes, level=1, race="Human", base_class="Fighter",
spellbook=None):
"""
@param name... |
# Copyright 2014-2016 Nathan West
#
# This file is part of autocommand.
#
# autocommand is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later v... |
import os
import sys
import numpy
try:
from setuptools import setup
from setuptools import Extension
except ImportError:
from distutils.core import setup
from distutils.extension import Extension
if sys.argv[-1] == "publish":
os.system("python setup.py sdist upload")
sys.exit()
setup(
na... |
# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
# copyright 2003-2010 Sylvain Thenault, all rights reserved.
# contact mailto:thenault@gmail.com
#
# This file is part of logilab-astng.
#
# logilab-astng is free software: you can redi... |
import contextlib
import json
import os
import re
import subprocess
from setuptools import setup
VERSION_FILE = os.path.join(os.path.dirname(__file__), "version.json")
def _get_git_description():
try:
return subprocess.check_output(["git", "describe"]).decode("utf-8").strip()
except subprocess.Calle... |
"""Tests for 'site'.
Tests assume the initial paths in sys.path once the interpreter has begun
executing have not been removed.
"""
import unittest
from test.test_support import TestSkipped, run_unittest, TESTFN, EnvironmentVarGuard
import __builtin__
import os
import sys
import encodings
import subproces... |
# Vim: tabstop=4 shiftwidth=4 softtabstop=4
# coding=utf-8
# Copyright 2013 Hewlett-Packard Development Company, L.P.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the Lic... |
import path
import asyncio
from datetime import datetime, timedelta
from watchdog.observers import Observer
from watchdog.events import PatternMatchingEventHandler
from read_schedule import read_schedule
import config
from config import logging
class FileChangeHandler(PatternMatchingEventHandler):
def __init__(s... |
# coding=utf-8
from openprovider.modules import E, OE, common
from openprovider.models import SSLProduct, SSLOrder
def _domain_validation_methods(methods):
if not methods:
return None
items = [E.item(E.hostName(hostname), E.method(method)) for hostname, method in methods.items()]
return E.array(... |
import os
import six
import ckanserviceprovider.web as web
from datapusher import jobs
# check whether jobs have been imported properly
assert(jobs.push_to_datastore)
def serve():
web.init()
web.app.run(web.app.config.get('HOST'), web.app.config.get('PORT'))
def serve_test():
web.init()
return web... |
import pandas as pd
import numpy as np
import pyaf.ForecastEngine as autof
import pyaf.Bench.TS_datasets as tsds
b1 = tsds.load_airline_passengers()
df = b1.mPastData
df.head()
lEngine = autof.cForecastEngine()
lEngine
H = b1.mHorizon;
# lEngine.mOptions.enable_slow_mode();
# lEngine.mOptions.mDebugPerformance = ... |
# -*- coding: utf-8 -*-
import os
import sys
import pytest
import mock
from copy import deepcopy
class VimError(Exception):
pass
class List(object):
pass
class Vars(dict):
def __set__(self, inst, value):
if not value:
inst._vars = deepcopy(self)
inst._vars.update(value)
... |
# 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... |
# -*- coding: utf-8 -*-
"""Application configuration."""
import os
class Config(object):
"""Base configuration."""
SECRET_KEY = os.environ.get('IVI_SECRET', 'secret-key') # TODO: Change me
APP_DIR = os.path.abspath(os.path.dirname(__file__)) # This directory
PROJECT_ROOT = os.path.abspath(os.path.j... |
'''
Created on 28.08.2017
@author: Peer
'''
from collections import defaultdict
import datetime
from itertools import chain
import matplotlib.pyplot as plt
from gitexplorer.basics import GitExplorerBase
def draw_punchcard(infos,
xaxis_range=24,
yaxis_range=7,
... |
# -*- coding: utf-8 -*-
"""
Copyright [2009-2018] EMBL-European Bioinformatics Institute
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... |
# coding=utf-8
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from twilio.base import values
from twilio.base.instance_context import InstanceContext
from twilio.base.instance_resource import InstanceResource
from twilio.base.list_resource import ListResource
f... |
# Copyright 2012 NEC Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... |
#!/usr/bin/python
import cPickle as pickle
import numpy as np
import ROOTInterface.Import
import ROOTInterface.Export
from sys import argv,exit
nEvents = -1
doMultiThread = False
def divide(a):
return a[0]/a[1]
def bin(a,b,m):
return min(int(a[0]/b),m)
def angleTruncate(a):
return min(6.28,max(0,a[0]))
print ... |
import sys
import segyio
import numpy as np
def main():
if len( sys.argv ) < 2:
sys.exit("Usage: write.py [file]")
filename = sys.argv[1]
# the mode parameter is passed directly to C's fopen
# opening the file for writing requires r+, not rw because rw would
# truncate (effectively destro... |
import os
from . import room
def do():
got_thing = False
x = 30
while x < 40:
path = "C:\Python"+ str(x) +"\Lib\site-packages\easygui.py" #credit Hlynur
path2 = "C:\Python"+ str(x) +"\Lib\easygui.py"
cool = os.path.exists(path)
cool2 = os.path.exists(path2)
print(path... |
import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'mkxdrp%^@nc##a#b(rkzk)agha065$ng5g%=1v(b-d2n36ptbl'
# SECURITY WARNING: don't run w... |
"""backend URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-ba... |
#!/usr/bin/python
#
# Copyright 2019 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 ag... |
from django.utils.translation import ugettext as _
#ADMINS = (
#('amon-ra', 'amon.raj@gmail.com'),
#)
#EMAIL_HOST_USER = '
#EMAIL_USE_TLS = True
#EMAIL_HOST = '172.2.6.7'
#EMAIL_HOST_PASSWORD = 'xxxxxx2'
#EMAIL_PORT = 25
#Activate on debugging
DEBUG = True
TEMPLATE_DEBUG = DEBUG
INTERNAL_IPS = ('10.61.0.1',)
#PUB... |
# Copyright 2012 OpenStack Foundation.
# 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 requ... |
# This library provides a pluggable that lets plugins that *use* our
# key editor to provide extra information based on the ingredient
# key. This will be used to show info in both the key editor and
# recipe card view and possibly to allow editing etc.
from gourmet.plugin_loader import Pluggable
from gourmet.plugin i... |
"""A PyQT4 dialog to select from automated issue matches"""
# Copyright 2012-2014 Anthony Beville
# 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... |
#!/usr/bin/python
#
# ice - web frontend for SeaIce, based on the Python-Flask framework.
#
# Copyright (c) 2013, Christopher Patton, all rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistrib... |
#!/usr/bin/env python
import getopt, sys, re, os, glob, csv
from classifier import tree, NGclassify, consts, datatypes, parse_mhcs
from bioinf.seqs import SeqList
import io_modules.csv
import io_modules.old_table
import io_modules.serialize
import os.path
# folder where to find data for haplogroup classification and... |
# coding=utf-8
"""Provider code for AniDex."""
from __future__ import unicode_literals
import logging
import random
import string
from medusa import tv
from medusa.bs4_parser import BS4Parser
from medusa.helper.common import convert_size, try_int
from medusa.logger.adapters.style import BraceAdapter
from medusa.pro... |
from .box import Box
import numpy as np
from numba import jit
class Octree(object):
"""
Octree implementation to be used in particle dipole networks
"""
def __init__(self, max_level=3, p=0, n_particle_min=20, mac=0.0, cut=1000.0):
self.max_level = max_level
self.p = p
self.n_... |
#!/usr/bin/env python
import requests
import json
import os
from fabric.colors import red, green, blue, cyan, magenta
from time import sleep
api_key = 'be25c8a17fdcd031f54dd3417ee4d083'
api_base_url = 'http://api.themoviedb.org/3'
def pretty(data):
print ""
print json.dumps(data, sort_keys=True, indent=2)
prin... |
import codecs
import mimetypes
from uuid import uuid4
from io import BytesIO
CRLF = '\r\n'
writer = codecs.lookup('utf-8')[3]
def guess_type(filename):
return mimetypes.guess_type(filename)[0] or 'application/sctet-stream'
def iter_fields(fields):
if isinstance(fields, dict):
fields = fields.iteritem... |
#TSTOP
#
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation, either version 3 of the License, or
#(at your option) any later version.
#
#This program is distributed in the hope that it will be useful,
... |
import base64
import importlib
import sys
from metamagic.json import dumps, dumpb, loadb
from django.core.management.base import BaseCommand
class Command(BaseCommand):
help = 'Import a model'
def add_arguments(self, parser):
parser.add_argument('-i,--import', dest='import', help='File to import fr... |
import sys, os
#import logging
import unittest
from google.appengine.ext import ndb #, testbed
from google.appengine.api import datastore_errors
class TestCollection(unittest.TestCase):
# enable the datastore stub
nosegae_datastore_v3 = True
nosegae_memcache = True
#import model # does not work yet
def se... |
#-*- coding: utf-8 -*-
import time
import getpass
import os
from selenium import webdriver
from selenium.webdriver.support.ui import Select
max_wait_time = 60
#page_url = "http://gamesstats.hopto.org/"
#page_url = "http://gamesstats.loc/"
def login(driver):
file_ = open("config/upload")
page_url = file_.re... |
from test import test_support
import unittest
import java
from org.python.util import PythonObjectInputStream
def serialize(o, special=0):
b = java.io.ByteArrayOutputStream()
objs = java.io.ObjectOutputStream(b)
objs.writeObject(o)
if not special:
OIS = java.io.ObjectInputStream
else:
... |
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... |
import argparse
from nredarwin.webservice import DarwinLdbSession
import csv
import sys
from tabulate import tabulate
from functools import partial
def rows_to_display(station_board):
"""
Iterator for tabular output of board
"""
yield (("Platform", "Destination", "Scheduled", "Due"))
for service i... |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import numpy as np
from astropy.tests.helper import pytest
from astropy import units as u
from astropy.utils import NumpyRNGContext
from ..ccddata import CCDData
# If additional pytest markers are defined th... |
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
import unittest
import time
from test_util import ScanPointGeneratorTest
from scanpointgenerator import CompoundGenerator
from scanpointgenerator import LineGenerator, StaticPointGenerator, LissajousGenerator, SpiralGenerator
from scan... |
# -*- coding: utf-8 -*-
# Strawberry Blog Engine
#
# Copyright (c) 2014 Regis FLORET
#
# 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 ri... |
#!/opt/anaconda2/bin/python
# -*- coding: utf-8 -*-
"""
################################################################################
#
# Copyright (c) 2016 Wojciech Migda
# All rights reserved
# Distributed under the terms of the MIT license
#
####################################################################... |
#!/usr/bin/python
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (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.mozilla.... |
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008-2016,2018 Contributor
#
# 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... |
#!/usr/bin/python3
import acunits.ac as ac
import acunits.acseries as series
import RPi.GPIO as GPIO
import time
import sys
GPIO.setmode(GPIO.BCM)
LIMIT = 16
units = [ac.AcUnit("AC1", 18, 12, 9), ac.AcUnit("AC2", 23, 16, 6),
ac.AcUnit("AC3", 24, 20, 6)]
def restart():
"Restart the Pi"
from subproces... |
from __future__ import absolute_import, unicode_literals
import re
import os
import lxml.html
import uuid
import datetime
import requests
import markdown
import hashlib
try:
import urlparse
except ImportError:
from urllib import parse as urlparse
from PIL import Image
from django.db import models
from django... |
from distutils.core import setup, Command
from unittest import TextTestRunner, TestLoader
class TestCommand(Command):
'''Run test suite using `python setup.py test `'''
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
'... |
# 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 ... |
# coding=utf-8
import os
import cv2
import numpy as np
from .utils import DSIZE, TRAIN_DATA
class DigitClassifier(object):
@staticmethod
def _feature(image):
"""
It's faster but still accurate enough with DSIZE = 14.
~0.9983 precision and recall
:param image:
:return:... |
from steamapi.getproplayerlist import proPlayerDictionary
from steamapi.getheroes import heroDictionary
from steamapi.getgameitems import itemDictionary
from converter import timeconverter, playerconverter
def displayResult(matchJson, playerSummariesJson):
introTemplate = '####	\n#####	 ' \
... |
from controller.registrar import Registrar
import json
class TestRegistrar:
def __init__(self, conf, auth_info):
self.registrar = Registrar(conf, auth_info)
def test_client(self):
assert self.registrar.client != None
assert self.registrar.client != None
print self.registrar.cl... |
# Copyright 2017 Tecnativa - Sergio Teruel
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
from odoo import fields, models
class TemplateEventQuestion(models.Model):
_name = 'event.question.template'
_description = 'Event questions template'
name = fields.Char(required=True)
question... |
#!/usr/bin/env python
##################################################
# Gnuradio Python Flow Graph
# Title: writeToFile
# Author: stephan sigg
# Description: USRP source write to file
# Generated: Mon May 27 12:41:33 2013
##################################################
from PyQt4 import Qt
from gnuradio import en... |
#!/usr/bin/env python
from nose.tools import *
import networkx as nx
class TestCore:
def setUp(self):
# G is the example graph in Figure 1 from Batagelj and
# Zaversnik's paper titled An O(m) Algorithm for Cores
# Decomposition of Networks, 2003,
# http://arXiv.org/abs/cs/0310049. ... |
import os
from django.contrib.auth.models import User
from django.db import models
from django.utils.deconstruct import deconstructible
from ct.models import Course
@deconstructible
class UploadTo(object):
"""
Deconstructable class as function to serialize in migrations,
compatibility for python 2
... |
import requests
BASE_URL = 'https://www2.deepl.com/jsonrpc'
LANGUAGES = {
'auto': 'Auto',
'DE': 'German',
'EN': 'English',
'FR': 'French',
'ES': 'Spanish',
'IT': 'Italian',
'NL': 'Dutch',
'PL': 'Polish'
}
JSONRPC_VERSION = '2.0'
class SplittingError(Exception):
def __init__(self... |
import math
import numpy as np
import os
import pandas as pd
from coccimorph.aux import load_image
import cv2
RED = (0, 0, 255)
fowl_species = [
'E. acervulina',
'E. maxima',
'E. brunetti',
'E. mitis',
'E. praecox',
'E. tenella',
'E. necatrix'
]
rabbit_species = [
'E. coecicola',
... |
# Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: jernej@reciprocitylabs.com
# Maintained By: jernej@reciprocitylabs.com
class LandingPage(object):
BUTTON_LOGIN = "Login"
PROGRAM_INFO_TAB = "P... |
import time
import argparse
from torchtext.experimental.transforms import load_sp_model as load_pybind_sp_model
from torchtext.data.functional import load_sp_model as load_torchbind_sp_model
from torchtext.utils import download_from_url
from torchtext.datasets import DATASETS
def benchmark_sentencepiece(args):
de... |
# -*- coding: utf-8 -*-
# from __future__ import absolute_import, print_function, division
from future.utils import with_metaclass
import numpy as np
import scipy as sp
from abc import ABCMeta, abstractmethod
from scipy import integrate
import scipy.interpolate as interpolate
from . import core
__all__ = ['CompressEo... |
# Copyright 2010-2011 OpenStack Foundation
# Copyright 2011 Piston Cloud Computing, 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... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
readme = open('README.rst').read()
history = open('HISTORY.rst').read().replace('.. :changelog:', '')
requirements = [
# TODO: put package requirements here
]
test_requi... |
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
import uui... |
"""
Settings for Bok Choy tests that are used when running LMS.
Bok Choy uses two different settings files:
1. test_static_optimized is used when invoking collectstatic
2. bok_choy is used when running the tests
Note: it isn't possible to have a single settings file, because Django doesn't
support both generating sta... |
# This file is part of Androguard.
#
# Copyright (C) 2012, Anthony Desnos <desnos at t0t0.fr>
# All rights reserved.
#
# Androguard is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of th... |
"""
Functions to test that map measurements haven't changed.
Use generate() to save data, and test() to check that the data is
unchanged in a later version. Results from generate() are already
checked into svn, so intentional changes to map measurement mean new
data must be generated and committed. E.g.
# ...delibera... |
import logging
import time
from django.utils import timezone
from django.db.models import Sum
from django.http import HttpResponse
from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned
from pa3.models import WaitingNumberBatch, WaitingNumber, NewestNumberBatch, StatisticalData
def get_src_s... |
"""
aspen.http
++++++++++
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
status_strings = {
100 : "Continue",
101 : "Switching Protocols",
200 : "OK",
201 : "Created",
202 : "Accepted",
2... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from perceptron import Perceptron
class LinearUnit(Perceptron):
def __init__(self, input_num, activator):
'''
初始化感知器,设置输入参数的个数,以及激活函数。
'''
Perceptron.__init__(self, input_num, activator)
def func(x):
'''
定义激活函数func
'''
return x
def get_training_dataset():
... |
import functools
import logging
from collections import defaultdict
from twisted.internet.defer import Deferred, DeferredList, _DefGen_Return
from twisted.python.failure import Failure
from scrapy.settings import Settings
from scrapy.utils.datatypes import SequenceExclude
from scrapy.utils.defer import mustbe_deferred... |
# TestReferences.py
#
# Copyright (C) 2011 Carlos Garcia Campos <carlosgc@gnome.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any ... |
# Copyright 2020 The SQLFlow 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 law o... |
#!/usr/bin/env python
from origin import OriginData
from structdata.project import g_project
class Area(OriginData):
"""
Area gestisce coordinate e dimensione fisiche. Nell'xml le informazioni
sono in coordinate logiche; al momento del caricamento del progetto viene
fatta la conversione
"""
t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.