code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
# -*- encoding: utf-8 -*-
from datetime import date
from django.test import TestCase
from contact.tests.factories import ContactFactory
from crm.tests.factories import TicketFactory
from finance.tests.factories import VatSettingsFactory
from invoice.models import InvoiceError
from invoice.service import (
Invoice... | pkimber/invoice | invoice/tests/test_invoice_print.py | Python | apache-2.0 | 1,817 |
# Copyright 2014
# The Cloudscaling Group, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | MayankGo/ec2-api | ec2api/api/quota.py | Python | apache-2.0 | 2,313 |
# 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 agreed to in writing, softw... | google/fuzzbench | docs/reference/benchmarks.py | Python | apache-2.0 | 6,523 |
# -*- coding: utf8 -*-
# Copyright 2017 Lockheed Martin 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 ... | lmco/dart | missions/apps.py | Python | apache-2.0 | 827 |
#
# Copyright 2019 The FATE Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | FederatedAI/FATE | examples/pipeline/upload/pipeline-upload-extend-sid.py | Python | apache-2.0 | 2,416 |
#!/usr/bin/env python
import numpy as np
import torch as th
from torchvision import datasets, transforms
from nnexp import learn
if __name__ == '__main__':
dataset = datasets.MNIST('./data', train=True, download=True, transform=transforms.ToTensor())
learn('mnist_simple', dataset)
| seba-1511/nnexp | examples/mnist_simple.py | Python | apache-2.0 | 293 |
from django.utils.translation import ugettext_lazy as _
# The slug of the panel group to be added to HORIZON_CONFIG. Required.
PANEL_GROUP = 'bsnextensions'
# The display name of the PANEL_GROUP. Required.
PANEL_GROUP_NAME = _('BSN Extensions')
# The slug of the dashboard the PANEL_GROUP associated with. Required.
PAN... | wolverineav/horizon-bsn | horizon_bsn/future_enabled/_8005_bsnextensions.py | Python | apache-2.0 | 356 |
#
# Copyright 2013-2015 University of Southern California
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | ini-bdds/ermrest | ermrest/model/table.py | Python | apache-2.0 | 10,745 |
# Copyright 2021 DeepMind Technologies 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 applicable law or agr... | deepmind/alphafold | alphafold/data/parsers.py | Python | apache-2.0 | 21,397 |
from __future__ import unicode_literals
import logging
import pykka
from mopidy import mixer
logger = logging.getLogger(__name__)
class SoftwareMixer(pykka.ThreadingActor, mixer.Mixer):
name = 'software'
def __init__(self, config):
super(SoftwareMixer, self).__init__(config)
self.audio... | liamw9534/mopidy | mopidy/softwaremixer/mixer.py | Python | apache-2.0 | 1,391 |
# -*- 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... | googleapis/python-dialogflow | samples/generated_samples/dialogflow_generated_dialogflow_v2_documents_reload_document_async.py | Python | apache-2.0 | 1,621 |
# Copyright 2017 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... | tensorflow/autograph | reference_tests/assertion_test.py | Python | apache-2.0 | 1,233 |
# -*- coding: utf-8 -*-
#
# 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 ... | vilobhmm/delimiter | delimiter/drivers/sql.py | Python | apache-2.0 | 715 |
# From: https://github.com/sussexwearlab/DeepConvLSTM
# Which is from http://www.johnvinyard.com/blog/?p=268
import numpy as np
from numpy.lib.stride_tricks import as_strided as ast
def norm_shape(shape):
'''
Normalize numpy array shapes so they're always expressed as a tuple,
even for one-dimensional sha... | guillaume-chevalier/HAR-stacked-residual-bidir-LSTMs | sliding_window.py | Python | apache-2.0 | 3,228 |
from django.contrib import admin
from . import models
class OrderItemInline(admin.TabularInline):
fields = ('product', 'quantity')
raw_id_fields = ('product',)
model = models.OrderItem
extra = 1
class ProductAdmin(admin.ModelAdmin):
list_display = ('name', 'price', 'description', 'stock', 'discont... | PrestonMonteWest/compmart | commerce/admin.py | Python | apache-2.0 | 1,286 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-05-05 20:10
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('opconsole', '0026_auto_20170504_2048'),
]
operations = [
migrations.AddField(... | baalkor/timetracking | opconsole/migrations/0027_device_name.py | Python | apache-2.0 | 468 |
# -*- 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 o... | googleapis/python-api-common-protos | google/api/log_pb2.py | Python | apache-2.0 | 2,402 |
#!/usr/bin/env python
import pynotify
'''
No purpose here other than creating a callable library for system notifications
'''
class message:
def __init__(self, messagex):
pynotify.init('EventCall')
m = pynotify.Notification("RSEvent Notification", "%s" % messagex)
m.show()
| krazybean/message_agent_abandoned | lin/lin_notify_lib.py | Python | apache-2.0 | 282 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import time
import logging
from avashell.base.shell import ShellBase, STR_EXIT, STR_OPEN_HELP
_logger = logging.getLogger(__name__)
class Shell(ShellBase):
def __init__(self):
super(Shell, self).... | nickchen-mitac/fork | src/avashell/cli/shell.py | Python | apache-2.0 | 632 |
#!/usr/bin/env python
# encoding: utf-8
#pylint: disable=no-member, no-init, too-many-public-methods
#pylint: disable=attribute-defined-outside-init
# This disable is because the tests need to be name such that
# you can understand what the test is doing from the method name.
#pylint: disable=missing-docstring
"""
test... | jackzhao-mj/ok | server/tests/integration/test_api_course.py | Python | apache-2.0 | 1,100 |
# -*- encoding: utf-8 -*-
#
# Copyright © 2012 New Dream Network, LLC (DreamHost)
#
# Author: Steven Berler <steven.berler@dreamhost.com>
#
# 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
#
# ... | dreamhost/ceilometer | tests/api/v2/test_max_project_volume.py | Python | apache-2.0 | 5,448 |
"""TensorFlow ops for deep neural networks."""
# Copyright 2015-present The Scikit Flow 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.apac... | wchan/tensorflow | tensorflow/contrib/learn/python/learn/ops/dnn_ops.py | Python | apache-2.0 | 2,001 |
import pytest
from flask_pyoidc.redirect_uri_config import RedirectUriConfig
class TestRedirectUriConfig(object):
LEGACY_CONFIG = {'SERVER_NAME': 'example.com', 'PREFERRED_URL_SCHEME': 'http'}
def test_legacy_config_defaults(self):
config = RedirectUriConfig.from_config(self.LEGACY_CONFIG)
as... | its-dirg/Flask-pyoidc | tests/test_redirect_uri_config.py | Python | apache-2.0 | 1,687 |
# Copyright 2014 Hewlett-Packard Development Company, L.P.
#
# 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... | froyobin/ironic | ironic/drivers/modules/ilo/deploy.py | Python | apache-2.0 | 25,377 |
from django.db import models
from django.contrib.auth.models import User
# Create your models here.
class UserProfile(models.Model):
user = models.OneToOneField(User, verbose_name=u'用户名', on_delete=models.CASCADE, related_name="userprofile")
nickname = models.CharField(max_length=32, verbose_name=u'昵称')
a... | ZhangXiaoyu-Chief/sandwich | account/models.py | Python | apache-2.0 | 1,237 |
from __future__ import absolute_import
from . import TypeSlots
from .ExprNodes import not_a_constant
import cython
cython.declare(UtilityCode=object, EncodedString=object, BytesLiteral=object,
Nodes=object, ExprNodes=object, PyrexTypes=object, Builtin=object,
UtilNodes=object)
from . imp... | ABcDexter/cython | Cython/Compiler/Optimize.py | Python | apache-2.0 | 169,504 |
#!/usr/bin/env python
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008,2009,2010,2012,2013,2014,2015,2016,2017,2018 Contributor
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance... | quattor/aquilon | tests/broker/test_del_chassis.py | Python | apache-2.0 | 3,407 |
###############################################################################
#
# Copyright 2010 Locomatix, 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.or... | locomatix/locomatix-python | locomatix/cli/__init__.py | Python | apache-2.0 | 3,074 |
# 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
# distributed under the... | mrunge/openstack_horizon | openstack_horizon/dashboards/project/data_processing/job_binaries/urls.py | Python | apache-2.0 | 1,483 |
# Licensed to the StackStorm, Inc ('StackStorm') 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 use th... | armab/st2 | st2common/st2common/models/utils/action_alias_utils.py | Python | apache-2.0 | 4,206 |
import click
from parsec.cli import pass_context, json_loads
from parsec.decorators import custom_exception, json_output
@click.command('copy_from_dataset')
@click.argument("library_id", type=str)
@click.argument("dataset_id", type=str)
@click.option(
"--folder_id",
help="id of the folder where to place the u... | galaxy-iuc/parsec | parsec/commands/libraries/copy_from_dataset.py | Python | apache-2.0 | 785 |
import numpy as np
import unittest
import ray
from ray import tune
from ray.rllib import _register_all
MB = 1024 * 1024
@ray.remote(memory=100 * MB)
class Actor(object):
def __init__(self):
pass
def ping(self):
return "ok"
@ray.remote(object_store_memory=100 * MB)
class Actor2(object):
... | ujvl/ray-ng | python/ray/tests/test_memory_scheduling.py | Python | apache-2.0 | 4,709 |
#!/usr/bin/env python3
# http://sebastianraschka.com/Articles/2014_multiprocessing.html
import multiprocessing as mp
import yaml
# Define an output queue
output = mp.Queue()
def create_transition_dic(width,height):
transition_dic={}
num_tiles=width*height
# print("width= "+str(width))
# print("height=... | bhpayne/domino_tile_floor | transitions/domino_tiles_transition_graph_breadth_first_multiprocessing.py | Python | apache-2.0 | 5,268 |
"""Utility functions for Twitter API interactions"""
from datetime import datetime
import twitter
TWITTER_DATE_FORMAT = "%a %b %d %H:%M:%S +0000 %Y"
def pretty_twitter_date(tweet):
"""Converts a Twitter formatted date to a Python object."""
py_date = datetime.strptime(tweet.created_at, TWITTER_DATE_FORMAT)... | rhefner1/c3po | c3po/util/twitter_api.py | Python | apache-2.0 | 1,485 |
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | googleads/google-ads-python | google/ads/googleads/interceptors/metadata_interceptor.py | Python | apache-2.0 | 5,368 |
"""Support for Bond fans."""
import math
from typing import Any, Callable, List, Optional
from bond_api import Action, DeviceType, Direction
from homeassistant.components.fan import (
DIRECTION_FORWARD,
DIRECTION_REVERSE,
SPEED_HIGH,
SPEED_LOW,
SPEED_MEDIUM,
SPEED_OFF,
SUPPORT_DIRECTION,
... | titilambert/home-assistant | homeassistant/components/bond/fan.py | Python | apache-2.0 | 4,093 |
# -*- coding: utf-8 -*-
## Copyright 2012 Peter Halliday
##
## 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 requir... | hoangelos/Herd | lib/herd/cluster/client.py | Python | apache-2.0 | 2,221 |
from flask import request
from sqlalchemy.dialects.postgresql import array_agg
from zeus.config import db
from zeus.constants import Result
from zeus.db.func import array_agg_row
from zeus.models import Job, TestCase, Revision
from zeus.utils.builds import fetch_build_for_revision
from .base_revision import BaseRevis... | getsentry/zeus | zeus/api/resources/revision_tests.py | Python | apache-2.0 | 1,984 |
# coding: utf-8
"""
MINDBODY Public API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: v6
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
impor... | mindbody/API-Examples | SDKs/Python/swagger_client/models/contact_log_comment.py | Python | bsd-2-clause | 5,761 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-07-06 22:06
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migration... | italopaiva/your.car | yourcar/telegram_bot/migrations/0001_initial.py | Python | bsd-2-clause | 818 |
# -*- coding: utf-8 -*-
import unittest
import mock
import os
import random
from collections import Counter
import logging
logging.disable(logging.WARNING)
import gdal
from qgis.core import *
from PyQt4.QtCore import QVariant
os.environ['LANGUAGE'] = 'C'
import setup
import osm
from layer import *
from catatom2osm im... | javiersanp/CatAtom2Osm | test/test_layer.py | Python | bsd-2-clause | 55,167 |
###############################################################################
#
# Tests for XlsxWriter.
#
# SPDX-License-Identifier: BSD-2-Clause
# Copyright (c), 2013-2022, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparison_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompar... | jmcnamara/XlsxWriter | xlsxwriter/test/comparison/test_outline06.py | Python | bsd-2-clause | 2,749 |
import collections
import email
import types
import urllib
import urlparse
import responses
import times
# todo: implement own conversion utility
from django.utils.encoding import force_bytes
from .loading import load_resource
def parse_http_date(header, headers):
if header in headers and headers[header]:
... | marcinn/restosaur | restosaur/context.py | Python | bsd-2-clause | 7,771 |
"""
create specializer projects
basically copies all files and directories from a template.
"""
from __future__ import print_function
import sys
import argparse
import collections
import shutil
import os
import ctree
from ctree.tools.generators.builder import Builder
if sys.version_info >= (3, 0, 0): # python 3
... | ucb-sejits/ctree | ctree/tools/runner.py | Python | bsd-2-clause | 5,410 |
from flask import Flask, request, render_template
app = Flask(__name__)
@app.route("/")
def hello():
return render_template('test.html', r=request)
if __name__ == "__main__":
app.run(host='0.0.0.0', port=8001, debug=True)
| Elemnir/presentations | utk_prog_team_2015_04_09/flask2/flask2.py | Python | bsd-2-clause | 233 |
#
# Copyright (c) dushin.net All Rights Reserved
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the foll... | fadushin/esp8266 | micropython/neolamp/neolamp/scheduler.py | Python | bsd-2-clause | 5,621 |
from .cgc_exploit import CGCExploit
from .c_templates import c_template_type1
import logging
l = logging.getLogger("rex.exploit.cgc.cgc_type1_exploit")
class CGCType1Exploit(CGCExploit):
'''
A CGC exploit object, offers more flexibility than an Exploit object for
the sake of the game. This should repres... | shellphish/rex | rex/exploit/cgc/cgc_type1_exploit.py | Python | bsd-2-clause | 3,456 |
from __future__ import absolute_import
import platform
import datetime
import sunpy
__all__ = ['system_info']
def system_info():
"""Prints system information.
Prints information about the runtime environment that SunPy lives in.
Information about the OS, architecture, Python, and all major dependen... | mjm159/sunpy | sunpy/util/sysinfo.py | Python | bsd-2-clause | 3,403 |
# Copyright 2015-2017 Luc Saffre
# License: BSD (see file COPYING for details)
"""
Database models for `lino.modlib.checkdata`.
.. autosummary::
"""
from __future__ import unicode_literals, print_function
import six
from builtins import object
from builtins import str
from collections import OrderedDict
from djang... | khchine5/lino | lino/modlib/checkdata/models.py | Python | bsd-2-clause | 10,733 |
"""
Counting sort is applicable when each input is known to belong to a particular
set, S, of possibilities. The algorithm runs in O(|S| + n) time and O(|S|)
memory where n is the length of the input. It works by creating an integer array
of size |S| and using the ith bin to count the occurrences of the ith member of
S... | rahulnadella/Sort_Algorithms | countingsort/countingsort.py | Python | bsd-2-clause | 1,805 |
'''
SPDX-License-Identifier: Apache-2.0
Copyright 2017 Massachusetts Institute of Technology.
'''
from multiprocessing import Process
import threading
import functools
import time
import os
import sys
import signal
import simplejson as json
import zmq
from keylime import config
from keylime import crypto
from keylim... | mit-ll/python-keylime | keylime/revocation_notifier.py | Python | bsd-2-clause | 5,242 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Project Haystack timezone data
# (C) 2016 VRT Systems
#
# vim: set ts=4 sts=4 et tw=78 sw=4 si:
import pytz
import datetime
from .version import LATEST_VER
# The official list of timezones as of 6th Jan 2016:
# Yes, that's *without* the usual country prefix.
HAYSTACK_TIME... | vrtsystems/hszinc | hszinc/zoneinfo.py | Python | bsd-2-clause | 6,577 |
"""Piecewise constant signal (with noise)"""
import numpy as np
from ruptures.utils import draw_bkps
def pw_constant(
n_samples=200, n_features=1, n_bkps=3, noise_std=None, delta=(1, 10), seed=None
):
"""Return a piecewise constant signal and the associated changepoints.
Args:
n_samples (int): ... | deepcharles/ruptures | src/ruptures/datasets/pw_constant.py | Python | bsd-2-clause | 1,465 |
import MySQLdb
from parameters import Parameters
import logging
def run_sql(sql, db=None):
db = MySQLdb.connect(host=Parameters.DB_HOST, user=Parameters.DB_USER, passwd=Parameters.DB_PASSWORD, db=Parameters.DB_SCHEMA)
cursor = db.cursor()
logging.debug(sql)
try:
cursor.execut... | willycs40/zoopla_pull | db.py | Python | bsd-2-clause | 795 |
import os
import codecs
from io import StringIO
from pytest import fixture
from rave import filesystem
class DummyProvider:
def __init__(self, files):
self.files = files;
def list(self):
return self.files
def has(self, filename):
return filename in self.list()
def open(self,... | rave-engine/rave | tests/support/filesystem.py | Python | bsd-2-clause | 4,963 |
# Copyright (c) 2017, John Skinner
import unittest
import numpy as np
import transforms3d as tf3d
import util.transform as tf
import dataset.tum.tum_loader as tum_loader
class TestTUMLoader(unittest.TestCase):
def test_make_camera_pose_returns_transform_object(self):
pose = tum_loader.make_camera_pose(10... | jskinn/robot-vision-experiment-framework | dataset/tum/tests/test_tum_loader.py | Python | bsd-2-clause | 4,693 |
import os
import re
import ast
from six.moves.configparser import ConfigParser as Config
from .logging import logger
class ConfigError(Exception):
"""Configuration parsing error."""
pass
def read_config(*locations):
"""
Reads and parses the given configuration files.
:param locations: the i... | ohsu-qin/qiutil | qiutil/ast_config.py | Python | bsd-2-clause | 8,113 |
""" Utility for managing relative file system paths """
__author__ = "Luke Campbell, Michael Meisinger"
import errno
import StringIO
import tempfile
import shutil
import os
import re
import random
import string
from pyon.core.bootstrap import CFG as bootcfg, get_sys_name
from pyon.util.log import log
from pyon.util.... | scionrep/scioncc | src/pyon/util/file_sys.py | Python | bsd-2-clause | 10,353 |
#!/usr/bin/env python
"""
@package mi.dataset.parser.zplsc_c
@file /mi/dataset/parser/zplsc_c.py
@author Rene Gelinas
@brief Parser for the zplsc_c dataset driver
This file contains code for the zplsc_c parser and code to produce data particles.
The ZPLSC sensor, series C, provides acoustic return measurements from ... | vipullakhani/mi-instrument | mi/dataset/parser/zplsc_c.py | Python | bsd-2-clause | 17,455 |
import io
from datetime import timedelta
from mox3 import mox
import wsgiservice
import wsgiservice.application
import wsgiservice.exceptions
from webob import Request
def test_getapp():
"""get_app returns a list of resources from the dictionary."""
app = wsgiservice.get_app(globals())
print(app)
pr... | pneff/wsgiservice | tests/test_application.py | Python | bsd-2-clause | 20,489 |
from fabric.api import *
settings_fabric = settings
def identify(env):
if 'linux' in env.uname.lower():
with settings_fabric(warn_only=True):
env.lsb_release = env.lsb_release or run('lsb_release -d').lower()
if 'debian' in env.lsb_release:
return True
def settings(... | ryanwitt/django-liberace | liberace/systems/debian.py | Python | bsd-2-clause | 554 |
import json
import subprocess
import coremonitor
import sys
import os
PSTACK_BIN = os.environ.get("PSTACK_BIN", "pstack")
def JSON(cmd, childfunc = None):
with coremonitor.CoreMonitor( cmd, childfunc ) as cm:
args = ["./%s" % PSTACK_BIN, "-j" ]
if childfunc:
args.append(sys.executable)... | peadar/pstack | tests/pstack.py | Python | bsd-2-clause | 613 |
class InsertionSort:
def sort(self, array):
length = len(array)
for j in range (1, length):
key = array[j]
i = j-1
while (i >=0) & (array[i] > key):
array[i+1] = array[i]
i = i-1
array[i + 1] = key
return arr... | tugot17/Introduction-to-Algorithms | Algorithms/Sorts/InsertionSort.py | Python | bsd-2-clause | 325 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
from settings import config
import scrape, logger
from datetime import datetime
class user(object):
def __init__(self,driver):
self.scrape = scrape.scrape(driver)
self.logger = logger.logger()
self.url = "https://www.twitter.com/"
def is_p... | jammie080/Twitter-Bot | twitter/user.py | Python | bsd-2-clause | 5,841 |
from __future__ import print_function
# (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org)
# Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
import sys
import os
import inspect
from . import copydir
from . import command
from paste.util.template import ... | stefanv/aandete | app/lib/paste/script/templates.py | Python | bsd-3-clause | 10,088 |
"""
Tests that duplicate columns are handled appropriately when parsed by the
CSV engine. In general, the expected result is that they are either thoroughly
de-duplicated (if mangling requested) or ignored otherwise.
"""
from io import StringIO
import pytest
from pandas import DataFrame
import pandas.util.testing as ... | cbertinato/pandas | pandas/tests/io/parser/test_mangle_dupes.py | Python | bsd-3-clause | 3,885 |
from django import forms
from .models import Company
class I18nForm(forms.Form):
decimal_field = forms.DecimalField(localize=True)
float_field = forms.FloatField(localize=True)
date_field = forms.DateField(localize=True)
datetime_field = forms.DateTimeField(localize=True)
time_field = f... | yephper/django | tests/i18n/forms.py | Python | bsd-3-clause | 820 |
import logging
pvl_logger = logging.getLogger('pvlib')
import datetime
import numpy as np
import pandas as pd
from nose.tools import raises
from nose.tools import assert_almost_equals
from pvlib.location import Location
from pvlib import solarposition
from pvlib import atmosphere
# setup times and location to be ... | rubennj/pvlib-python | pvlib/test/test_atmosphere.py | Python | bsd-3-clause | 1,611 |
# coding: utf-8
import os
from setuptools import setup, find_packages
README = open(os.path.join(os.path.dirname(__file__), 'README.rst')).read()
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name='django-nomad-activity-feed',
v... | Nomadblue/django-nomad-activity-feed | setup.py | Python | bsd-3-clause | 1,187 |
# -*- coding: utf-8 -*-
from utils import log, register
from plexapi import CONFIG
# TODO: test_navigation/test_navigate_to_movie
# FAIL: (500) internal_server_error
# @register()
def test_navigate_to_movie(account, plex):
result_library = plex.library.get(CONFIG.movie_title)
result_movies = plex.library.sect... | Hellowlol/plexapi | tests/test_navigation.py | Python | bsd-3-clause | 3,622 |
import unittest
from assertpy import assert_that
from mapperpy.test.common_test_classes import *
from mapperpy import OneWayMapper, ObjectMapper
from datetime import datetime
__author__ = 'lgrech'
class DateTimeConversionTest(unittest.TestCase):
def test_map_from_datetime_it_target_type_not_known(self):
... | lgrech/MapperPy | mapperpy/test/conversions/test_datetime_conversion.py | Python | bsd-3-clause | 6,813 |
from contextlib import contextmanager
from filecmp import dircmp
from tempfile import mkdtemp
from shutil import rmtree
from unittest import TestCase
@contextmanager
def temp_folder():
tmp_dir = mkdtemp()
try:
yield tmp_dir
finally:
rmtree(tmp_dir)
class DummyLogger(object):
def info(... | dbaty/soho | tests/test_builder.py | Python | bsd-3-clause | 4,834 |
# BEGIN GPL LICENSE BLOCK #####
#
# 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.
#
# This program is distributed i... | mifth/mifthtools | blender/addons/2.7/io_simple_3dcoat/__init__.py | Python | bsd-3-clause | 3,677 |
from django.forms import CheckboxSelectMultiple, ClearableFileInput
class BootstrapCheckboxSelectMultiple(CheckboxSelectMultiple):
def render(self, name, value, attrs=None, choices=()):
output = super(BootstrapCheckboxSelectMultiple, self).render(
name, value, attrs, choices)
# we don... | softak/webfaction_demo | utils/widgets.py | Python | bsd-3-clause | 869 |
import subprocess
import shutil
def generate_cpu_project(project) :
f = open('template_cpu.vcxproj')
text = f.read()
f.close()
text = text.replace("@name@", project[0])
text = text.replace("@GUID@", project[1])
f = open(project[0] + ".vcxproj", 'w')
f.write(text)
f.close()
def generate... | shinmorino/quant_sandbox | VS/sqaodpy_cext/gen_projects.py | Python | bsd-3-clause | 2,396 |
import os
from django.test.utils import override_settings
from django.test import TestCase
from casexml.apps.case.tests.util import delete_all_cases
from corehq.apps.receiverwrapper.util import submit_form_locally
from corehq.form_processor.interfaces.dbaccessors import CaseAccessors
@override_settings(CASEXML_FORCE_... | qedsoftware/commcare-hq | corehq/ex-submodules/casexml/apps/case/tests/test_out_of_order_processing.py | Python | bsd-3-clause | 1,076 |
import numpy as np
import pytest
from pandas.core.dtypes.common import is_datetime64_dtype, is_timedelta64_dtype
from pandas.core.dtypes.dtypes import DatetimeTZDtype
import pandas as pd
from pandas import CategoricalIndex, Series, Timedelta, Timestamp
import pandas._testing as tm
from pandas.core.arrays import (
... | TomAugspurger/pandas | pandas/tests/base/test_conversion.py | Python | bsd-3-clause | 14,519 |
import pymorph
import numpy as np
def test_patspec():
f = np.array([
[0,0,0,0,0,0,0,0],
[0,0,1,1,1,1,0,0],
[0,1,0,1,1,1,0,0],
[0,0,1,1,1,1,0,0],
[1,1,0,0,0,0,0,0]], bool)
assert pymorph.patspec(f).sum() == (f > 0).sum()
def test_linear_h():
f = np.arange(9).reshape((... | luispedro/pymorph | tests/test_patspec.py | Python | bsd-3-clause | 436 |
#!/usr/bin/python
import re
# phone = "2004-959-559 # This is Phone Number http://www.google.com \n"
# # Delete Python-style comments
# num = re.sub(r'#.*$', "", phone)
# # print "Phone Num : ", num
# # Remove anything other than digits
# num = re.sub(r'\D', "", phone)
# # print "Phone Num : ", num
# phone = "20... | yclavinas/TSA | semurl.py | Python | bsd-3-clause | 988 |
""" Settings for inventory """
from .base import *
try:
from .local import *
except ImportError, exc:
exc.args = tuple(
['%s (did you rename settings/local-dist.py?)' % exc.args[0]])
raise exc
| sloria/device-inventory | inventory/settings/__init__.py | Python | bsd-3-clause | 214 |
# -*- coding: utf-8 -*-
import cPickle as pickle
GEO_FILES = './geo_files'
def gen_db():
u'''Функция для генерации pickle базы ipgeobase.ru
'''
res = []
tmp_list = []
cities_dict = {}
# cidr_optim.txt
for line in open('%s/cidr_optim.txt' % GEO_FILES, 'r'):
a = line.split('\t'... | greggy/python-ipgeobase | cidr_create.py | Python | bsd-3-clause | 1,230 |
from datetime import datetime
from django.db import models
from django.contrib.auth.models import User
from django.contrib.contenttypes.generic import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
class Comment(models.Model):
author = models.ForeignKey(User, null=True, related_na... | rizumu/dialogos | dialogos/models.py | Python | bsd-3-clause | 880 |
# -*- coding: utf-8 -*-
from __future__ import division
from otree.common import Currency as c, currency_range, safe_json
from . import models
from ._builtin import Page, WaitPage
from .models import Constants
class Contribute(Page):
form_model = models.Player
form_fields = ['contribution']
class ResultsWa... | bocchan/costly | public_goods_reg_noise/views.py | Python | bsd-3-clause | 793 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
for group in orm['auth.Group'].objects.all():
try:
obj = orm.GroupInformation.objects.get(group=gro... | nikdoof/test-auth | app/groups/migrations/0002_groupinformation.py | Python | bsd-3-clause | 5,402 |
"""
$Id$
"""
| saebyn/django-classifieds | classifieds/__init__.py | Python | bsd-3-clause | 17 |
from flask import Flask, url_for, redirect, render_template, request
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext import superadmin, login, wtf
from flask.ext.superadmin.contrib import sqlamodel
from wtforms.fields import TextField, PasswordField
from wtforms.validators import Required, ValidationError
... | syrusakbary/Flask-SuperAdmin | examples/auth/auth.py | Python | bsd-3-clause | 3,960 |
# -*- coding: utf-8 -*-
# ----------------------------------------------------------------------
# Copyright © 2010, RedJack, LLC.
# All rights reserved.
#
# Please see the LICENSE.txt file in this distribution for license
# details.
# ----------------------------------------------------------------------
import sys
i... | janies/dataleach | src/dataleach/process/configreader.py | Python | bsd-3-clause | 11,227 |
#!/usr/bin/env python
"""
output of various data for VAMP project
"""
from numpy import ndarray
class DataWriter():
def __init__(self, datadict, title='Data export file'):
self.title=title
self.data = datadict
self.allfields = sorted(datadict.keys())
self.numparams= []
self.... | pshchelo/vampy | calc/output.py | Python | bsd-3-clause | 2,387 |
from django.conf.urls import patterns, url
urlpatterns = patterns(
'us_ignite.blog.views',
url(r'^$', 'post_list', name='blog_post_list'),
url(r'^(?P<year>\d{4})/(?P<month>\d{1,2})/(?P<slug>[-\w]+)/$',
'post_detail', name='blog_post_detail'),
)
| us-ignite/us_ignite | us_ignite/blog/urls.py | Python | bsd-3-clause | 266 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('convos', '0004_auto_20150511_0945'),
]
operations = [
migrations.AddField(
model_name='convothread',
... | jessehon/etsy-convos | etsy_convos/convos/migrations/0005_convothread_last_message_at.py | Python | bsd-3-clause | 457 |
# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
#
# Astropy shared Sphinx settings. These settings are shared between
# astropy itself and affiliated packages.
#
# Note that not all possible configuration values are present in this file.
#
# All configuration values have a defau... | larrybradley/astropy-helpers | astropy_helpers/sphinx/conf.py | Python | bsd-3-clause | 11,881 |
import json
from django.contrib import messages
from django.core.exceptions import PermissionDenied
from django.forms.formsets import formset_factory
from django.http import HttpResponse, HttpResponseRedirect
from django.http.response import Http404
from django.utils.decorators import method_decorator
from django.views... | qedsoftware/commcare-hq | custom/ewsghana/views.py | Python | bsd-3-clause | 11,616 |
#!/usr/bin/env python
from functools import wraps
from glob import glob
from hashlib import sha1
import os, shutil, sys, tempfile
from django.template.loader import render_to_string
from fabric.state import env
from fabric.operations import run, sudo, put
from fabric.context_managers import cd, settings, hide
from fa... | bretth/woven | woven/deployment.py | Python | bsd-3-clause | 8,823 |
from logging import Handler
class NullHandler(Handler):
"""
NullHandler from Python 2.7 - doesn't exist on Python 2.6
"""
def handle(self, record):
pass
def emit(self, record):
pass
def createLock(self):
self.lock = None
| vmalloc/json_rest | json_rest/logging_utils.py | Python | bsd-3-clause | 269 |
#!/usr/bin/env python3
# Software License Agreement (BSD License)
#
# Copyright (c) 2017, UFactory, Inc.
# All rights reserved.
#
# Author: Vinman <vinman.wen@ufactory.cc>
import os
from distutils.util import convert_path
try:
from setuptools import setup, find_packages
except ImportError:
from distutils.core ... | xArm-Developer/xArm-Python-SDK | setup.py | Python | bsd-3-clause | 1,795 |
"""
ipython analogue:
tr = TimeResolution()
mi = pd.MultiIndex.from_product(tr.params[:-1] + ([str(x) for x in tr.params[-1]],))
df = pd.DataFrame(np.nan, index=mi, columns=["mean", "stdev"])
for unit in tr.params[0]:
for size in tr.params[1]:
for tz in tr.params[2]:
tr.setup(unit, size, tz)
... | jreback/pandas | asv_bench/benchmarks/tslibs/resolution.py | Python | bsd-3-clause | 1,414 |
import functools
from django.contrib import admin
from django.contrib.admin.options import operator
from django.core.exceptions import FieldDoesNotExist
from django.db import models
from django.db.models.constants import LOOKUP_SEP
from .models import FakeEmail
class CommaSearchInAdminMixin:
def get_search_id_f... | eviljeff/olympia | src/olympia/amo/admin.py | Python | bsd-3-clause | 5,736 |
'''
A module that conducts unit tests on all top-level methods within each class.
Created on Jun 20, 2012
@author: ccabot
'''
import unittest
import sys
# add to PYTHONPATH
sys.path.append("../")
from libpgm.dictionary import Dictionary
from libpgm.graphskeleton import GraphSkeleton
from libpgm.orderedskeleton impo... | CyberPoint/libpgm | tests/run_unit_tests.py | Python | bsd-3-clause | 14,090 |
#
# $Filename$$
# $Authors$
# Last Changed: $Date$ $Committer$ $Revision-Id$
#
# Copyright (c) 2003-2011, German Aerospace Center (DLR)
# All rights reserved.
#
#
#Redistribution and use in source and binary forms, with or without
#modification, are permitted provided that the following conditions are
#met:
... | DLR-SC/DataFinder | test/unittest/datafinder_test/gui/user/dialogs/datastore_dialog/__init__.py | Python | bsd-3-clause | 1,798 |
from datetime import datetime
from redis import Redis
from redis_sessions.session import SessionStore
from multilogger.users.models import User
def get_logged_users():
# Query all non-expired sessions
redconn = Redis()
store = SessionStore()
sessions = [redconn.get(key) for key in redconn.keys(... | Cahersan/SexySignOn | multilogger/multilogger/api/utils.py | Python | bsd-3-clause | 622 |