src stringlengths 721 1.04M |
|---|
# Copyright 2021 Nisaba 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 applicable law or agreed to in writi... |
from __future__ import absolute_import
import contextlib
import logging
import multiprocessing
import socket
import time
from flask.ext.testing import TestCase
from viceroy.api import ViceroyTestCase
try:
ConnectionRefusedError
except NameError:
ConnectionRefusedError = socket.error
def _server_started(por... |
# coding: utf-8
import numpy as np
from .block import Block
from .._global import OptionalModule
try:
import matplotlib.pyplot as plt
from matplotlib.widgets import Button
except (ModuleNotFoundError, ImportError):
plt = OptionalModule("matplotlib")
Button = OptionalModule("matplotlib")
class Grapher(Block... |
# Copyright (c) 2012 - 2015 EMC Corporation, 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
#
# ... |
from model import MemoryRegion
import util
import re
def parse_smaps_header(header):
info = MemoryRegion(free=False)
# Example line is:
# 011e6000-01239000 rw-p 00000000 00:00 0 [heap]
# 8ec00000-8ec01000 rw-s 00000000 00:14 20 /dev/shm/NS2371 (deleted)
# All numbers are hex except for the ino... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Service.city'
db.add_column(u'home_service', 'city',
... |
# -*- coding: utf-8 -*-
"""
Copyright (C) 2014 Dariusz Suchojad <dsuch at zato.io>
Licensed under LGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# stdlib
from contextlib import closing
from time import time
# Zato
from zato.c... |
from JumpScale import j
import redis
from influxdb import client as influxdb
class InfluxdbFactory:
"""
"""
def __init__(self):
pass
def get(self, host='localhost', port=8086,username='root', password='root', database=None, ssl=False, verify_ssl=False, timeout=None, use_udp=False, udp_port=4... |
#!/usr/bin/env python
# The MIT License (MIT)
#
# Copyright (c) 2015 Keith Davidson
#
# 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... |
from __future__ import unicode_literals, division, absolute_import, with_statement
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
from past.builtins import basestring
from future.moves.urllib.parse import quote
import os
import re
import threading
import logging
from xml.etree.ElementT... |
##############################################################################
#
# Copyright 2015 Vauxoo
# Author : Osval Reyes <osval@vauxoo.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the F... |
"""Classes to handle plotting during the training."""
from __future__ import print_function, division
import math
import cPickle as pickle
from collections import OrderedDict
import numpy as np
import matplotlib.pyplot as plt
import time
GROWTH_BY = 500
class History(object):
def __init__(self):
self.line... |
# -*- coding: utf-8 -*-
"""Copyright 2015 Roger R Labbe Jr.
FilterPy library.
http://github.com/rlabbe/filterpy
Documentation at:
https://filterpy.readthedocs.org
Supporting book at:
https://github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python
This is licensed under an MIT license. See the readme.MD file
for mor... |
# Copyright 2017 IBM Corp.
#
# 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 t... |
from __future__ import division
import warnings
from math import log, sqrt
import numpy as np
from ..constants import gas_constant, kelvin, pitts
def acidity(self, ionic_strength=None, temperature=None):
"""Return the effective acidity constant, Ka, for each valence state.
The value is corrected for ionic s... |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... |
# Copyright (c) 2016 RIPE NCC
#
# 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 h... |
from vcr_unittest import VCRTestCase
from abiosgaming.client import AbiosClient
from urllib3.exceptions import MaxRetryError
from requests.exceptions import HTTPError, RetryError
import logging
try:
from unittest import mock
except ImportError:
import mock
logging.basicConfig(level=logging.DEBUG)
class Abios... |
"""Tests for Coordinates class"""
from nose.tools import assert_almost_equals
from nose.tools import raises
import os
from lightdock.gso.coordinates import Coordinates
from lightdock.gso.coordinates import CoordinatesFileReader
from lightdock.error.lightdock_errors import GSOCoordinatesError
class TestCoordinates:
... |
# Generated by Django 2.0.1 on 2018-01-17 11:30
import crypsis.models
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('crypsis_tests', '0007_auto_20171222_1155'),
]
operations = [
migrations.AlterModelOptions... |
# Copyright Hybrid Logic Ltd. See LICENSE file for details.
"""
Generate a Flocker package that can be deployed onto cluster nodes.
"""
import os
import platform
from setuptools import setup, find_packages
import versioneer
versioneer.vcs = "git"
versioneer.versionfile_source = "flocker/_version.py"
versioneer.vers... |
import scipy as sp
import numpy as np
def rbf_kernel(X, Z, variance, lengthscale):
"""
A classic radial-basis function (Gaussian; exponential squared) covariance kernel
.. math::
\\kappa(X, Z | \\sigma^2, \\Lambda) = \\sigma^2 \\exp\\left[-\\frac12 (X-Z)^T \\Lambda^{-1} (X-Z) \\right]
Parame... |
# refer to http://pythonhosted.org/dxfgrabber/#
# Note that there must not a line or shape overlapped
import sys
import math
import functools
from itertools import groupby
import dxfgrabber
import kicad_mod_format as kf
def _arc_point(center, radius, angle_degree):
'''
point defined by arc cen... |
import re, os, logging, time
from autotest.client.shared import utils, error
from virttest import qemu_monitor, storage, env_process, data_dir, utils_misc
@error.context_aware
def run_block_mirror(test, params, env):
"""
Test block mirroring functionality
Test consists of two subtests:
1) Mirror the... |
import requests
import datetime
import lxml.html
from lxml.cssselect import CSSSelector
from . import UniScraper, DATE_FORMAT
# Months in Dutch, to allow the parsing of the (Dutch) site
MONTHS = ['januari', 'februari', 'maart', 'april', 'mei', 'juni', 'juli',
'augustus', 'september', 'oktober', 'november',... |
# Copyright 2017 The Armada 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 applicable law or agreed to in w... |
"""
To understand why this file is here, please read:
http://cookiecutter-django.readthedocs.io/en/latest/faq.html#why-is-there-a-django-contrib-sites-directory-in-cookiecutter-django
"""
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations... |
# ***** BEGIN LICENSE BLOCK *****
# Sconspiracy - Copyright (C) IRCAD, 2004-2010.
# Distributed under the terms of the BSD Licence as
# published by the Open Source Initiative.
# ****** END LICENSE BLOCK ******
"""SCons.Tool.qt
Tool-specific initialization for Qt.
There normally shouldn't be any need to import th... |
import matplotlib.pyplot as plt
import numpy as np
from scipy import fftpack
from scipy.signal import kaiserord, firwin, lfilter
import scipy.io.wavfile as wavfile
FREQ = 466.16
fs, data = wavfile.read('teste_de_som.wav')
print("Taxa de amostragem: {} Hz".format(fs))
t = np.arange(0, len(data) / fs, 1 / fs)
new = 30... |
# -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2011 credativ Ltd (<http://www.credativ.co.uk>).
# All Rights Reserved
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero Ge... |
#!/usr/bin/env python2
# Copyright (c) 2014 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 spending coinbase transactions.
# The coinbase transaction in block N can appear in block
# N+100... ... |
from OpenGL import GL
import numpy
import ctypes
from . import shaders
class Texture:
__slots__ = ('width', 'height', 'data', 'texture')
def __init__(self, width, height, data):
self.width = width
self.height = height
self.data = data
self.texture = GL.glGenTextures(1)
... |
# -*- coding: utf-8 -*-
"""
Created on 2017-4-27
@author: cheng.li
"""
import datetime as dt
import numpy as np
import pandas as pd
from alphamind.portfolio.rankbuilder import rank_build
def benchmark_build_rank(n_samples: int, n_loops: int, n_included: int) -> None:
print("-" * 60)
print... |
# coding=utf-8
from plugins.TreesAreMemory2.Constituent import Constituent
from plugins.TreesAreMemory2.Feature import Feature
from plugins.TreesAreMemory2.Document import Document
from plugins.TreesAreMemory2.SyntaxAPI import SyntaxAPI
# see ExamplePlugin/readme.txt and ExamplePlugin/plugin.json
# List those classes... |
from django.db import models
from django.conf import settings
# from game.round.models import Round
# Create your models here.
class Control(models.Model):
user = models.OneToOneField(settings.AUTH_USER_MODEL, on_delete=models.CASCADE, unique=True)
start_time = models.DateTimeField(auto_now_add=True, null=Tr... |
from .base import Node, OperationNode
class SetNode(Node):
"""
Represents a Redis set
Note that this class does *not* try too hard to look like a Python
set. For example, you cannot pass an iterable into its constructor
to provide the members of the set. This is because a set in Redis
may or... |
#! /usr/bin/env python
# Copyright (C) 2014-2019 The BET Development Team
r"""
This example requires the following external packages not shipped
with BET:
(1) An installation of FEniCS that can be run using the same
python as used for installing BET. See http://fenicsproject.org/
for more information.
(2) ... |
import os
import unittest
from redisco.containerstests import (SetTestCase, ListTestCase, TypedListTestCase, SortedSetTestCase, HashTestCase)
from redisco.models.basetests import (ModelTestCase, DateFieldTestCase, FloatFieldTestCase,
BooleanFieldTestCase, ListFieldTestCase, Referen... |
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (C) 2019, GEM Foundation
#
# OpenQuake is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, ... |
'''Setup dissolve^struct environment on Brutus. (To be executed ON Brutus in the home directory.)
'''
__author__ = 'tribhu'
import os
import argparse
from benchmark_utils import *
from retrieve_datasets import retrieve, download_to_gen_dir
from paths import PROJECT_DIR, JARS_DIR, DATA_DIR
LIB_JAR_URL = 'https://dl.... |
#
# 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
# ... |
import os
from django.conf import global_settings
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
('Karol Farbiś', 'kpchwk@gmail.com'),
)
MANAGERS = ADMINS
INSTALL_DIR = os.path.split(os.path.realpath(__file__ + '/../'))[0]
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME... |
#!/usr/bin/python2.7
import re
import sys
from string import maketrans
max_word_size = 25
offset = 65
solutions = []
maps = []
filename = ""
cypher = ""
known_letters = ""
mapped_to = ""
precise = False
verbose = False
thorough = False
color = False
blue = ""
green = ""
red = ""
white = ""
# Return letters in the str... |
"""Test zha binary sensor."""
from homeassistant.components.binary_sensor import DOMAIN
from homeassistant.const import STATE_ON, STATE_OFF, STATE_UNAVAILABLE
from .common import (
async_init_zigpy_device,
make_attribute,
make_entity_id,
async_test_device_join,
async_enable_traffic,
)
async def te... |
class CheckUser:
"""
A class to perform various ban checks on a User object.
The checks will be done, against the different ban lists
and other ban rules in the config file.
If a test is True, then the user will be banned.
"""
def __init__(self, tinybot, user, conf):
"""
... |
#!/usr/bin/python3
import shelve
import sys
import pyperclip
print('\nWelcome to mcb!\n')
print('Type help to see manual\n')
while True:
args = input('>').split()
commands = ['help', 'list', 'load', 'save', 'quit', 'delete', 'show']
command = args[0]
mcb_shelve = shelve.open('mcb')
if command ... |
#! /usr/bin/env python3
#
# In this script we solve the linear plane strain elasticity problem for an
# infinite plate with a circular hole under tension. We do this by placing the
# circle in the origin of a unit square, imposing symmetry conditions on the
# left and bottom, and Dirichlet conditions constraining the d... |
# -*- coding: utf-8 -*-
#
# Copyright 2015-2017 - Gabriel Acosta <acostadariogabriel@gmail.com>
#
# This file is part of Pireal.
#
# Pireal 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 t... |
from __future__ import unicode_literals
from flask import Blueprint, request, url_for
from flask import render_template
from wtforms.fields import Field
import pprint
import json
ajax_wtforms_bp = Blueprint('ajax_wtforms', __name__, template_folder="templates", static_folder='static', static_url_path='/static/ajaxform... |
# Micromagnetics standard proplem no. 5
# As proposed by M. Najafi et al., JAP 105, 113914 (2009).
# @author Mykola Dvornik
from mumax2 import *
from mumax2_geom import *
Nx = 32
Ny = 32
Nz = 1
setgridsize(Nx, Ny, Nz)
# physical size in meters
sizeX = 100e-9
sizeY = 100e-9
sizeZ = 10e-9
csX = (sizeX/Nx)
csY = (size... |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
# http://www.pythonchallenge.com/pc/return/italy.html
__author__ = 'chihchieh.sun'
from PIL import Image
import urllib.request
from io import BytesIO
def getImg(url):
# User Name & Password
password_mgr = urllib.request.HTTPPasswordMgrWithDefaultRealm()
top_level_url = 'http://www.pythonchalle... |
import logging
import logging
from django.contrib.contenttypes.models import ContentType
from django.db.models import Q
from django.db.models import Q
from django.forms.fields import CharField, MultiValueField
from django.forms.widgets import MultiWidget, TextInput
from django.http import Http404
from django.utils im... |
from django.contrib.auth import get_user_model
from django.urls import reverse
from rest_framework import status
from rest_framework.test import APITestCase
from oauth_api.models import get_application_model
from oauth_api.settings import oauth_api_settings
from oauth_api.tests.views import RESPONSE_DATA
from oauth_a... |
#!/usr/bin/env python3
import math
from numbers import Number
import torch
from torch.distributions import constraints
from torch.nn import Module as TModule
from ..utils.cholesky import psd_safe_cholesky
from .prior import Prior
class LKJPrior(Prior):
r"""LKJ prior over n x n (positive definite) correlation m... |
import os
from urllib.request import urlopen
from IPython.parallel import Client, interactive
import gcmstools.filetypes as gcf
import gcmstools.reference as gcr
import gcmstools.fitting as gcfit
import gcmstools.datastore as gcd
import gcmstools.calibration as gcc
_ROOT = os.path.abspath(os.path.dirname(__file__))... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
Telegram Text Image Render Bot
'''
import os
import re
import sys
import time
import json
import queue
import base64
import logging
import hashlib
import requests
import tempfile
import functools
import threading
import subprocess
import collections
import concurrent... |
"""
Scriptable Packages Installer - Parcks
Copyright (C) 2017 JValck - Setarit
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 later version.... |
# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... |
#!/usr/bin/env python
# encoding: utf-8
"""
Created by Softwell on 2008-07-10.
Copyright (c) 2008 Softwell. All rights reserved.
"""
# --------------------------- GnrWebPage Standard header ---------------------------
from gnr.core.gnrbag import Bag
class GnrCustomWebPage(object):
maintable = 'hosting.client'
... |
# Copyright (c) 2013-2014 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 required by ... |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2014 CERN.
##
## Invenio 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) a... |
from pkg_resources import iter_entry_points
from .version import _warn_if_setuptools_outdated
from .utils import do, trace_exception
from . import _get_version, Configuration
def version_keyword(dist, keyword, value):
_warn_if_setuptools_outdated()
if not value:
return
if value is True:
v... |
import re
from traceback import format_exc
import pytest
from wrapanapi.utils import eval_strings
from cfme import test_requirements
from cfme.containers.provider import ContainersProvider
from cfme.utils.appliance.implementations.ui import navigate_to
from cfme.utils.wait import TimedOutError
pytestmark = [
py... |
# Copyright (c) 2003-2013 LOGILAB S.A. (Paris, FRANCE).
# Copyright (c) 2009-2010 Arista Networks, Inc.
# http://www.logilab.fr/ -- mailto:contact@logilab.fr
# 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
# ... |
"""
Django settings for Django for IoT project on Heroku. For more info, see:
https://github.com/aschn/cookiecutter-django-iot
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/set... |
#!/usr/bin/python
#
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Interpreter version: python 2.7
#
# Imports =====================================================================
from setuptools import setup, find_packages
from docs import getVersion
# Variables ===================================================================
... |
"""Copyright 2008 Orbitz WorldWide
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, softwa... |
# coding=utf-8
# Copyright (c) 2001-2014, Canal TP and/or its affiliates. All rights reserved.
#
# This file is part of Navitia,
# the software to build cool stuff with public transport.
#
# Hope you'll enjoy and contribute to this project,
# powered by Canal TP (www.canaltp.fr).
# Help us simplify mobility an... |
# -*- coding: utf-8 -*-
from path import Path
# Load shared config file
execfile(Path('../../_shared/conf.py').abspath())
# -- General configuration -----------------------------------------------------
project = u'Office Native WOPI Integration Documentation'
# Configure sphinx.ext.intersphinx
# noinspection PyUn... |
#!/usr/bin/python
import sys
import argparse
from os import path
from src.bag import Bag
from src.package import Package
from src.task import Task
from src.message import Message
from src.application import Application
from src.application_info import ApplicationInfo
from src.bootstrap import Bootstrap
from src impor... |
# Authors: Olivier Grisel <olivier.grisel@ensta.org>
# Mathieu Blondel <mathieu@mblondel.org>
# Denis Engemann <d.engemann@fz-juelich.de>
#
# License: BSD 3 clause
import warnings
import numpy as np
from scipy import sparse
from scipy import linalg
from scipy import stats
from sklearn.utils.testing i... |
"""Support for OpenUV binary sensors."""
import logging
from homeassistant.components.binary_sensor import BinarySensorDevice
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.util.dt import as_local, parse_datetime, utcnow
from . import (... |
# -*- coding: utf-8 -*-
#
# Text-Geolocator documentation build configuration file, created by
# sphinx-quickstart on Mon Mar 2 18:40:28 2015.
#
# 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 fil... |
""" This module contains various functions that are special cases
of incomplete gamma functions. It should probably be renamed. """
from sympy.core import Add, S, C, sympify, cacheit, pi, I
from sympy.core.function import Function, ArgumentIndexError
from sympy.functions.elementary.miscellaneous import sqrt, root
... |
# yellowbrick.contrib.scatter
# Implements a 2d scatter plot for feature analysis.
#
# Author: Nathan Danielsen
# Created: Fri Feb 26 19:40:00 2017 -0400
#
# Copyright (C) 2017 The scikit-yb developers
# For license information, see LICENSE.txt
#
# ID: scatter.py [a89633e] benjamin@bengfort.com $
"""
Implements a 2D... |
"""Development settings and globals."""
from os.path import join, normpath
from base import *
########## DEBUG CONFIGURATION
# See: https://docs.djangoproject.com/en/dev/ref/settings/#debug
DEBUG = True
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-debug
TEMPLATE_DEBUG = DEBUG
########## END... |
# when the system starts, load all the configuration
import xml.etree.ElementTree as ET
"""
@author zhb
this class contains the information which is saved in the
configuration file.
key: developer's application key
uname: store the account user name
upass: store the account user passwd
access_token: authority ... |
import inspect
import os
import pickle
import pkgutil
import unittest
import numpy as np
import traceback
from Orange.base import SklLearner
import Orange.classification
from Orange.classification import (
Learner, Model, NaiveBayesLearner, LogisticRegressionLearner)
from Orange.data import ContinuousVariable, Di... |
# 6.00.2x Problem Set 5
# Graph optimization
# Finding shortest paths through MIT buildings
#
import string
# This imports everything from `graph.py` as if it was defined in this file!
from graph import *
#
# Problem 2: Building up the Campus Map
#
# Before you write any code, write a couple of sentences here
# descr... |
# coding: utf-8
"""
DocuSign REST API
The DocuSign REST API provides you with a powerful, convenient, and simple Web services API for interacting with DocuSign. # noqa: E501
OpenAPI spec version: v2.1
Contact: devcenter@docusign.com
Generated by: https://github.com/swagger-api/swagger-codegen.gi... |
from collections import deque
def detect_group(people_graph, everyone_in_frame, grouping_max_distance):
"""
:param people_graph:
:type people_graph: Graph
:param everyone_in_frame: [PersonPath]
:type everyone_in_frame: list
:param grouping_max_distance:
:return:
"""
groups = deq... |
"""
Django settings for splsplsh_project project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR... |
# Copyright 2011 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 req... |
from django.contrib import admin
from django.contrib.sites.models import RequestSite
from django.contrib.sites.models import Site
from django.utils.translation import ugettext_lazy as _
from registration.models import RegistrationProfile
class RegistrationAdmin(admin.ModelAdmin):
actions = ['resend_activation_em... |
<<<<<<< HEAD
<<<<<<< HEAD
#!/usr/bin/env python3
# Copyright 2006 Google, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""Main program for testing the infrastructure."""
from __future__ import print_function
__author__ = "Guido van Rossum <guido@python.org>"
# Support imports (need to ... |
# -*- coding: UTF-8 -*-
from time import time
from step3_feature_engineering import preprocess_2
from sklearn.neighbors import KNeighborsClassifier
from sklearn.cross_validation import KFold
from sklearn import grid_search
features, labels, vectorizer, selector, le = preprocess_2("pkl/article_2_people.pkl", "pkl/labl... |
# 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/local/bin/python2.7
""" Counts the number of occurrences for each 311 service category
http://www.michael-noll.com/tutorials/
writing-an-hadoop-mapreduce-program-in-python/"""
from collections import defaultdict
import csv
import json
import sys
class Reducer(object):
""" Counts the number of occurrenc... |
#***********************************************************************
# This code is part of CmplServer
#
# Copyright (C) 2013, 2014
# Mike Steglich - Technical University of Applied Sciences
# Wildau, Germany
#
# CmplServer is a project of the Technical University of
# Applied Sciences Wildau and t... |
# encoding: utf-8
import datetime
from nose.tools import assert_equal
from ckan.tests.legacy import *
import ckan.model as model
# NB Lots of revision tests are part of vdm. No need to repeat those here.
class TestRevision:
@classmethod
def setup_class(cls):
# Create a test package
rev = mo... |
from drivnal.constants import *
from drivnal.client import Client
from drivnal.task import Task
from drivnal.event import Event
import drivnal.utils as utils
from drivnal import server
import os
import flask
import time
@server.app.route('/task/<volume_id>', methods=['GET'])
def task_get(volume_id):
client = Clien... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import operator
import random
import sys
def get_parser():
parser = argparse.ArgumentParser("Randomly sample k items from an input S containing n items.")
parser.add_argument("infile", nargs='?', type=argparse.FileType('r'), default=sys.stdin)
parser.ad... |
# Copyright (c) 2011 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 ... |
# -*- 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... |
from django import template
register = template.Library()
@register.filter
def get_range(value):
if value is not None:
return range(value)
else:
return 0
@register.filter
def absolute(value):
return abs(value)
@register.filter
def subtract(value, arg):
return value - arg
@regist... |
"""
By starting at the top of the triangle below and moving to adjacent numbers on the row below, the maximum total from
top to bottom is 23.
3
7 4
2 4 6
8 5 9 3
That is, 3 + 7 + 4 + 9 = 23.
Find the maximum total from top to bottom of the triangle below:
75
95 64
17 47 82
18 35 87 10
20 04 82 47 65
19 01 23 75 03 ... |
__author__ = 'alexander'
import urllib2
import os
from lib import pyperclip
def PageScrape(pageurl):
hdr= {'Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'User-Agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.110 Safari/537.3... |
#!/usr/bin/env python
from __future__ import absolute_import, division, with_statement
from tornado.httputil import url_concat, parse_multipart_form_data, HTTPHeaders
from tornado.escape import utf8
from tornado.log import gen_log
from tornado.testing import ExpectLog
from tornado.test.util import unittest
from torna... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.