repo_name stringlengths 6 100 | path stringlengths 4 294 | copies stringlengths 1 5 | size stringlengths 4 6 | content stringlengths 606 896k | license stringclasses 15
values |
|---|---|---|---|---|---|
openstack/nova | nova/tests/unit/network/test_os_vif_util.py | 2 | 48551 | # Copyright 2016 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | apache-2.0 |
andrewsomething/python-digitalocean | digitalocean/tests/test_load_balancer.py | 2 | 12023 | import json
import unittest
import responses
import digitalocean
from .BaseTest import BaseTest
class TestLoadBalancer(BaseTest):
def setUp(self):
super(TestLoadBalancer, self).setUp()
self.lb_id = '4de7ac8b-495b-4884-9a69-1050c6793cd6'
self.lb = digitalocean.LoadBalancer(id=self.lb_id, ... | lgpl-3.0 |
ketjow4/NOV | Lib/site-packages/numpy/distutils/command/build_py.py | 89 | 1125 |
from distutils.command.build_py import build_py as old_build_py
from numpy.distutils.misc_util import is_string
class build_py(old_build_py):
def run(self):
build_src = self.get_finalized_command('build_src')
if build_src.py_modules_dict and self.packages is None:
self.packages = buil... | gpl-3.0 |
marcsans/cnn-physics-perception | phy/lib/python2.7/site-packages/sklearn/linear_model/perceptron.py | 39 | 3863 | # Author: Mathieu Blondel
# License: BSD 3 clause
from .stochastic_gradient import BaseSGDClassifier
from ..feature_selection.from_model import _LearntSelectorMixin
class Perceptron(BaseSGDClassifier, _LearntSelectorMixin):
"""Perceptron
Read more in the :ref:`User Guide <perceptron>`.
Parameters
-... | mit |
Arcanemagus/SickRage | lib/requests/adapters.py | 69 | 20836 | # -*- coding: utf-8 -*-
"""
requests.adapters
~~~~~~~~~~~~~~~~~
This module contains the transport adapters that Requests uses to define
and maintain connections.
"""
import os.path
import socket
from urllib3.poolmanager import PoolManager, proxy_from_url
from urllib3.response import HTTPResponse
from urllib3.util ... | gpl-3.0 |
Bloomie/murano-agent | muranoagent/common/messaging/mqclient.py | 1 | 3280 | # Copyright (c) 2013 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | apache-2.0 |
HyacinthBathan/FinalProject | tailbone/geoip/__init__.py | 34 | 1044 | # Copyright 2013 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 a... | apache-2.0 |
hsaputra/tensorflow | tensorflow/python/kernel_tests/ctc_decoder_ops_test.py | 103 | 8844 | # 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... | apache-2.0 |
tbeadle/docker-py | tests/integration/exec_test.py | 12 | 4673 | import pytest
from .. import helpers
BUSYBOX = helpers.BUSYBOX
class ExecTest(helpers.BaseTestCase):
def test_execute_command(self):
if not helpers.exec_driver_is_native():
pytest.skip('Exec driver not native')
container = self.client.create_container(BUSYBOX, 'cat',
... | apache-2.0 |
moutai/scikit-learn | sklearn/cluster/tests/test_dbscan.py | 176 | 12155 | """
Tests for DBSCAN clustering algorithm
"""
import pickle
import numpy as np
from scipy.spatial import distance
from scipy import sparse
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_raises
from sklearn.utils.testing im... | bsd-3-clause |
RobotCaleb/zulip | zerver/management/commands/create_realm.py | 114 | 3832 | from __future__ import absolute_import
from optparse import make_option
from django.conf import settings
from django.core.management.base import BaseCommand
from zerver.lib.actions import do_create_realm, set_default_streams
from zerver.models import RealmAlias
if not settings.VOYAGER:
from zilencer.models import... | apache-2.0 |
ebar0n/django | django/db/migrations/writer.py | 38 | 11085 | import os
import re
from importlib import import_module
from django import get_version
from django.apps import apps
from django.db import migrations
from django.db.migrations.loader import MigrationLoader
from django.db.migrations.serializer import serializer_factory
from django.utils.inspect import get_func_args
from... | bsd-3-clause |
MysterionRise/fantazy-predictor | enriching_data.py | 1 | 10896 | #!/usr/local/bin/python
# -*- coding: utf-8 -*-
import calendar
import os
import pandas as pd
# Правила подсчета очков:
#
# за участие в матче – 2 очка, если сыграно 10 минут и больше; 1 очко, если сыграно меньше 10 минут
#
# за победу – 3 очка (в гостях); 2 очка (дома)
#
# за поражение – минус 3 очка (дома); минуc... | mit |
vasili-v/themis | vendor/github.com/apache/thrift/test/py.tornado/test_suite.py | 10 | 6403 | #!/usr/bin/env python
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "L... | apache-2.0 |
Universal-Model-Converter/UMC3.0a | data/Python/x86/Lib/test/test_imp.py | 91 | 2339 | import imp
import unittest
from test import test_support
class LockTests(unittest.TestCase):
"""Very basic test of import lock functions."""
def verify_lock_state(self, expected):
self.assertEqual(imp.lock_held(), expected,
"expected imp.lock_held() to be %r" % expected)... | mit |
ULHPC/easybuild-framework | easybuild/scripts/repo_setup.py | 3 | 3206 | #!/usr/bin/env python
##
# Copyright 2009-2017 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
# Flemish ... | gpl-2.0 |
Gixugif/CDRecording | Call_Detail_Record.py | 1 | 2248 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Title: Call_Detail_Record
# Description: Class for one
# CDR
# separately.
# Date: 6/9/16
# Author: Jeffrey Zic
class Call_Detail_Record:
""" Call Detail Records contain metadata for phone calls."""
def __init__(self):
self.bbx_cdr_id = ('', )
self.... | gpl-3.0 |
amisrs/one-eighty | venv2/lib/python2.7/site-packages/pip/_vendor/cachecontrol/caches/file_cache.py | 762 | 3532 | import hashlib
import os
from pip._vendor.lockfile import LockFile
from pip._vendor.lockfile.mkdirlockfile import MkdirLockFile
from ..cache import BaseCache
from ..controller import CacheController
def _secure_open_write(filename, fmode):
# We only want to write to this file, so open it in write only mode
... | mit |
horance-liu/tensorflow | tensorflow/contrib/distributions/python/ops/gumbel.py | 65 | 7694 | # 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... | apache-2.0 |
marinkaz/orange3 | Orange/classification/naive_bayes.py | 2 | 2294 | import numpy as np
from Orange.classification import Learner, Model
from Orange.data import Instance, Storage, Table, DiscreteVariable
from Orange.statistics import contingency
from Orange.preprocess import Discretize
__all__ = ["NaiveBayesLearner"]
class NaiveBayesLearner(Learner):
"""
Naive Bayes classifi... | bsd-2-clause |
steveb/heat | heat/tests/openstack/neutron/test_neutron_metering.py | 4 | 11163 | #
# 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
# ... | apache-2.0 |
jspargo/AneMo | django/lib/python2.7/site-packages/django/contrib/formtools/tests/wizard/namedwizardtests/tests.py | 49 | 16581 | from __future__ import unicode_literals
import copy
from django.core.urlresolvers import reverse
from django.http import QueryDict
from django.test import TestCase
from django.utils._os import upath
from django.contrib.auth.models import User
from django.contrib.auth.tests.utils import skipIfCustomUser
from django.... | gpl-2.0 |
MSOpenTech/edx-platform | common/djangoapps/student/migrations/0005_name_change.py | 188 | 10730 | # encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'PendingEmailChange'
db.create_table('student_pendingemailchange', (
('id', self.gf('d... | agpl-3.0 |
t3dev/odoo | addons/test_mass_mailing/tests/test_blacklist_mixin.py | 8 | 3038 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from unittest.mock import patch
from odoo.tests.common import users
from odoo.addons.test_mass_mailing.tests import common
from odoo.addons.test_mass_mailing.models.mass_mail_test import MassMailTestBlacklist
from odoo.... | gpl-3.0 |
kprkpr/platform_external_gtest | test/gtest_xml_test_utils.py | 42 | 6871 | #!/usr/bin/env python
#
# Copyright 2006, Google Inc.
# 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... | bsd-3-clause |
ghtmtt/QGIS | tests/src/python/test_qgsmergedfeaturerenderer.py | 19 | 7103 | # -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsMergedFeatureRenderer
.. note:: 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 versio... | gpl-2.0 |
stevenaubertin/showsServer | lib/werkzeug/testsuite/http.py | 145 | 18911 | # -*- coding: utf-8 -*-
"""
werkzeug.testsuite.http
~~~~~~~~~~~~~~~~~~~~~~~
HTTP parsing utilities.
:copyright: (c) 2014 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import unittest
from datetime import datetime
from werkzeug.testsuite import WerkzeugTestCase
from werkzeug.... | apache-2.0 |
jlspyaozhongkai/Uter | third_party_backup/Python-2.7.9/Lib/nntplib.py | 92 | 21470 | """An NNTP client class based on RFC 977: Network News Transfer Protocol.
Example:
>>> from nntplib import NNTP
>>> s = NNTP('news')
>>> resp, count, first, last, name = s.group('comp.lang.python')
>>> print 'Group', name, 'has', count, 'articles, range', first, 'to', last
Group comp.lang.python has 51 articles, rang... | gpl-3.0 |
blighj/django | django/conf/locale/th/formats.py | 44 | 1070 | # This file is distributed under the same license as the Django package.
#
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'j F Y'
TIME_FORMAT = 'G:i'
DATETIME_FORMAT = 'j F Y, G:i'
YEAR_MONTH_FORMAT = 'F Y'
MONTH_DAY_FORMAT... | bsd-3-clause |
jmbergmann/yogi | yogi-python/tests/test_subscription.py | 1 | 3085 | #!/usr/bin/env python3
import sys
import os
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)) + '/..')
import yogi
import unittest
from proto import yogi_0000d007_pb2
from test_terminals import AsyncCall
class TestSubscription(unittest.TestC... | gpl-3.0 |
kannon92/psi4 | doc/sphinxman/source/psi4doc/ext/psidomain.py | 1 | 1221 | #
# @BEGIN LICENSE
#
# Psi4: an open-source quantum chemistry software package
#
# Copyright (c) 2007-2016 The Psi4 Developers.
#
# The copyrights for code used from other parties are included in
# the corresponding files.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of ... | gpl-2.0 |
chmberl/django-cms | cms/utils/__init__.py | 40 | 3233 | # -*- coding: utf-8 -*-
# TODO: this is just stuff from utils.py - should be splitted / moved
from django.conf import settings
from django.core.files.storage import get_storage_class
from django.utils.functional import LazyObject
from cms import constants
from cms.utils.conf import get_cms_setting
from cms.utils.conf i... | bsd-3-clause |
shsingh/ansible | lib/ansible/module_utils/facts/system/selinux.py | 162 | 3207 | # Collect facts related to selinux
#
# This file is part of Ansible
#
# Ansible 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.
#
# Ans... | gpl-3.0 |
roselleebarle04/opencog | opencog/python/blending/src/decider/base_decider.py | 22 | 2632 | from abc import ABCMeta, abstractmethod
from blending.util.blending_config import BlendConfig
from blending.util.blending_error import blending_status
__author__ = 'DongMin Kim'
class BaseDecider(object):
"""Abstract class to provide 'blending_decide()' interface.
The blender will call the method 'blending... | agpl-3.0 |
GauravSahu/odoo | addons/stock_account/stock_account.py | 77 | 19901 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | agpl-3.0 |
karllessard/tensorflow | tensorflow/python/data/experimental/kernel_tests/optimization/latency_all_edges_test.py | 6 | 4086 | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | apache-2.0 |
hectorip/gae-boilerplate | bp_includes/external/requests/packages/urllib3/packages/ssl_match_hostname/_implementation.py | 2360 | 3778 | """The match_hostname() function from Python 3.3.3, essential when using SSL."""
# Note: This file is under the PSF license as the code comes from the python
# stdlib. http://docs.python.org/3/license.html
import re
__version__ = '3.4.0.2'
class CertificateError(ValueError):
pass
def _dnsname_match(dn, host... | lgpl-3.0 |
kingosticks/mopidy | mopidy/models/immutable.py | 4 | 7076 | import copy
import itertools
import weakref
from mopidy.models.fields import Field
# Registered models for automatic deserialization
_models = {}
class ImmutableObject:
"""
Superclass for immutable objects whose fields can only be modified via the
constructor.
This version of this class has been re... | apache-2.0 |
CaptainDesAstres/Simple-Blender-Render-Manager | usefullFunctions.py | 1 | 1409 | #!/usr/bin/python3.4
# -*-coding:Utf-8 -*
import time
def now(short = True):
'''return current date in short or long form (HH:MM:SS or DD.MM.AAAA-HH:MM:SS)'''
if short == True:
return time.strftime('%H:%M:%S')
else:
return time.strftime('%d.%m.%Y-%H:%M:%S')
def columnLimit(value, limit, begin = True, sep =... | mit |
MathewWi/fbzx-wii | src/z80free/z80free_gencode.py | 8 | 50964 | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
# Copyright 2008-2009 (C) Raster Software Vigo (Sergio Costas)
# This file is part of Z80Free
#
# Z80Free 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... | gpl-3.0 |
safwanrahman/kuma | kuma/wiki/management/commands/generate_sphinx_template.py | 3 | 2377 | import datetime
from django.conf import settings
from django.core.management.base import NoArgsCommand
from django.shortcuts import render
from django.test import RequestFactory, override_settings
from django.utils import translation
from html5lib import constants as html5lib_constants
from kuma.wiki.content import ... | mpl-2.0 |
pipermerriam/web3.py | tests/core/contracts/conftest.py | 1 | 41212 | import pytest
import json
from eth_utils import (
event_signature_to_log_topic,
)
CONTRACT_CODE = "0x606060405261022e806100126000396000f360606040523615610074576000357c01000000000000000000000000000000000000000000000000000000009004806316216f391461007657806361bc221a146100995780637cf5dab0146100bc578063a5f3c23b146100... | mit |
willdecker/suds | suds/client.py | 1 | 27894 | # This program is free software; you can redistribute it and/or modify
# it under the terms of the (LGPL) GNU Lesser 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 b... | mit |
OpenCode/l10n-italy | l10n_it_pec/model/partner.py | 11 | 1108 | # -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2014 Associazione Odoo Italia
# (<http://www.openerp-italia.org>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General ... | agpl-3.0 |
ksooklall/deep_learning_foundation | embeddings/utils.py | 150 | 2194 | import re
from collections import Counter
def preprocess(text):
# Replace punctuation with tokens so we can use them in our model
text = text.lower()
text = text.replace('.', ' <PERIOD> ')
text = text.replace(',', ' <COMMA> ')
text = text.replace('"', ' <QUOTATION_MARK> ')
text = text.replace(... | mit |
robk5uj/invenio | modules/bibclassify/lib/bibclassify_daemon.py | 8 | 15571 | # -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2007, 2008, 2009, 2010, 2011 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
## Licens... | gpl-2.0 |
slub/vk2-georeference | georeference/views/user/georeferencehistory.py | 1 | 3257 | # -*- coding: utf-8 -*-
'''
Copyright (c) 2015 Jacob Mendt
Created on 07.10.15
@author: mendt
'''
import traceback
from pyramid.view import view_config
from pyramid.httpexceptions import HTTPInternalServerError
from sqlalchemy import desc
from georeference import LOGGER
from georeference.settings import OAI_ID_PATTE... | gpl-3.0 |
kinverarity1/pyexperiment | tests/test_printers.py | 3 | 3779 | """Tests the utils.printers module of pyexperiment
Written by Peter Duerr
"""
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
import unittest
import io
import re
from pyexperiment.utils.stdout_redirector import stdo... | mit |
user-none/calibre | src/calibre/db/legacy.py | 2 | 41359 | #!/usr/bin/env python2
# vim:fileencoding=utf-8
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
import os, traceback, types
from future_builtins import zip
from calibre im... | gpl-3.0 |
tobegit3hub/cinder_docker | cinder/db/sqlalchemy/migrate_repo/versions/023_add_expire_reservations_index.py | 20 | 1526 | # 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 agreed to in... | apache-2.0 |
NorfolkDataSci/presentations | 2018-01_chatbot/serverless-chatbots-workshop-master/LambdaFunctions/nlp/nltk/tag/api.py | 7 | 2800 | # Natural Language Toolkit: Tagger Interface
#
# Copyright (C) 2001-2016 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# Steven Bird <stevenbird1@gmail.com> (minor additions)
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
"""
Interface for tagging each token in a sentence with s... | mit |
nitzmahone/tower-cli | lib/tower_cli/api.py | 2 | 8189 | # Copyright 2014, Ansible, Inc.
# Luke Sneeringer <lsneeringer@ansible.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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | apache-2.0 |
rspc/mmc-sd40 | tools/perf/util/setup.py | 766 | 1540 | #!/usr/bin/python2
from distutils.core import setup, Extension
from os import getenv
from distutils.command.build_ext import build_ext as _build_ext
from distutils.command.install_lib import install_lib as _install_lib
class build_ext(_build_ext):
def finalize_options(self):
_build_ext.finalize_optio... | gpl-2.0 |
0x90sled/catapult | third_party/apiclient/googleapiclient/errors.py | 25 | 3511 | # Copyright 2014 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 ... | bsd-3-clause |
CamelBackNotation/CarnotKE | jyhton/lib-python/2.7/ctypes/test/test_internals.py | 109 | 2623 | # This tests the internal _objects attribute
import unittest
from ctypes import *
from sys import getrefcount as grc
# XXX This test must be reviewed for correctness!!!
"""
ctypes' types are container types.
They have an internal memory block, which only consists of some bytes,
but it has to keep references to other... | apache-2.0 |
mtpajula/ijonmap | core/project.py | 1 | 4348 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from .elements.point import Point
from .elements.line import Line
from .elements.polygon import Polygon
import os
class Project(object):
def __init__(self, messages):
self.messages = messages
self.points = []
self.lines = ... | gpl-2.0 |
twiest/openshift-tools | openshift/installer/vendored/openshift-ansible-3.2.24/playbooks/common/openshift-cluster/upgrades/library/openshift_upgrade_config.py | 91 | 5294 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# vim: expandtab:tabstop=4:shiftwidth=4
"""Ansible module for modifying OpenShift configs during an upgrade"""
import os
import yaml
DOCUMENTATION = '''
---
module: openshift_upgrade_config
short_description: OpenShift Upgrade Config
author: Jason DeTiberus
requirements: [ ]... | apache-2.0 |
neuroo/equip | tests/test_imports.py | 2 | 1461 | import pytest
from testutils import get_co, get_bytecode
import equip
from equip.bytecode.utils import show_bytecode
IMPORTS_CODE = """
from __future__ import absolute_import
from .test_import import *
import sub
from . import sub
from .... import sub
import foo.bar
from foo import bar
import foo.bar as bar
from . i... | apache-2.0 |
mhaessig/servo | tests/wpt/css-tests/tools/manifest/XMLParser.py | 97 | 4413 | from os.path import dirname, join
from collections import OrderedDict
from xml.parsers import expat
import xml.etree.ElementTree as etree
_catalog = join(dirname(__file__), "catalog")
def _wrap_error(e):
err = etree.ParseError(e)
err.code = e.code
err.position = e.lineno, e.offset
raise err
_names ... | mpl-2.0 |
xodus7/tensorflow | tensorflow/contrib/tensor_forest/python/tensor_forest.py | 33 | 26822 | # 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... | apache-2.0 |
ssorgatem/qiime | scripts/compare_alpha_diversity.py | 15 | 12087 | #!/usr/bin/env python
# File created on 06 Jun 2011
from __future__ import division
__author__ = "William Van Treuren"
__copyright__ = "Copyright 2011, The QIIME project"
__credits__ = ["William Van Treuren", "Greg Caparaso", "Jai Ram Rideout"]
__license__ = "GPL"
__version__ = "1.9.1-dev"
__maintainer__ = "William Va... | gpl-2.0 |
pyfa-org/eos | eos/util/repr.py | 1 | 1866 | # ==============================================================================
# Copyright (C) 2011 Diego Duclos
# Copyright (C) 2011-2018 Anton Vorobyov
#
# This file is part of Eos.
#
# Eos is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as publi... | lgpl-3.0 |
taoger/titanium_mobile | site_scons/apicoverage.py | 30 | 13031 | #!/usr/bin/env python
#
# Titanium API Coverage Generator
#
# Initial Author: Jeff Haynie, 3/30/09
#
import glob, re, os.path as path
import fnmatch, os, sys, types
import traceback
cwd = os.path.abspath(os.path.dirname(sys._getframe(0).f_code.co_filename))
sys.path.append(path.join(cwd, "..", "build"))
sys.path.appen... | apache-2.0 |
Ophrys-Project/Ophrys | ophrys/utils/models.py | 1 | 4817 | from django.conf.urls import patterns, url, include
from django.core.urlresolvers import reverse, NoReverseMatch
from django.db import models
from .views import ListView, CreateView, DetailView, UpdateView, DeleteView
class GetAbsoluteUrlMixin:
"""
Mixin to add the methods get_absolute_url() and get_absolute... | mit |
halberom/ansible | lib/ansible/utils/module_docs_fragments/cloudengine.py | 28 | 2959 | #
#
# This file is part of Ansible
#
# Ansible 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.
#
# Ansible is distributed in the hope t... | gpl-3.0 |
yasoob/PythonRSSReader | venv/lib/python2.7/dist-packages/gobject/propertyhelper.py | 3 | 10311 | # -*- Mode: Python; py-indent-offset: 4 -*-
# pygobject - Python bindings for the GObject library
# Copyright (C) 2007 Johan Dahlin
#
# gobject/propertyhelper.py: GObject property wrapper/helper
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Pub... | mit |
zekearneodo/ephys-tools | zk/pca_filter.py | 1 | 4586 | __author__ = 'chris'
import logging
import tables
from scipy import signal
import numpy as np
def PCA_filter(self, rec_h5_obj, probe):
"""
Filtering based on
doi:10.1016/S0165-0270(01)00516-7
"""
data = self.run_group.data
D_all_clean = rec_h5_obj.create_carray(self.run_group,... | gpl-2.0 |
mfalesni/python-kwargify | test_kwargify.py | 1 | 5569 | # -*- coding: utf-8 -*-
import pytest
from kwargify import kwargify
class TestFunctionWithNoArgs(object):
@pytest.fixture(scope="class")
def function(self):
@kwargify
def f():
return True
return f
def test_no_args_given(self, function):
function()
@pytest... | lgpl-3.0 |
markbrough/exchangerates | exchangerates/util.py | 1 | 1344 | fred_countries_currencies = {
'Australia': 'AUD',
'Austria': 'ATS',
'Belgium': 'BEF',
'Brazil': 'BRL',
'Canada': 'CAD',
'China': 'CNY',
'Denmark': 'DKK',
'Euro': 'EUR',
'Finland': 'FIM',
'France': 'FRF',
'Germany': 'DEM',
'Greece': 'GRD',
'Hong Kong': 'HKD',
'Irel... | mit |
bmazin/SDR | Projects/ChannelizerSim/legacy/bin_width_1st_stage.py | 1 | 1524 |
import matplotlib.pyplot as plt
import scipy.signal
import numpy as np
import math
import random
from matplotlib.backends.backend_pdf import PdfPages
samples = 51200
L = samples/512
fs = 512e6
dt = 1/fs
time = [i*dt for i in range(samples)]
def pfb_fir(x):
N = len(x)
T = 4
L = 512
bin_width_scale = 2.5
dx = T*... | gpl-2.0 |
Sweetgrassbuffalo/ReactionSweeGrass-v2 | .meteor/local/dev_bundle/python/Lib/os2emxpath.py | 24 | 4635 | # Module 'os2emxpath' -- common operations on OS/2 pathnames
"""Common pathname manipulations, OS/2 EMX version.
Instead of importing this module directly, import os and refer to this
module as os.path.
"""
import os
import stat
from genericpath import *
from genericpath import _unicode
from ntpath import (expanduser... | gpl-3.0 |
maxalbert/bokeh | bokeh/sphinxext/bokeh_palette.py | 46 | 2209 | """ Generate color representations of all known Bokeh palettes.
Usage
-----
This directive takes no arguments.
"""
from __future__ import absolute_import
from docutils import nodes
import jinja2
from sphinx.locale import _
from sphinx.util.compat import Directive
from bokeh.palettes import brewer
BREWER_TEMPLAT... | bsd-3-clause |
kingctan/Misago | misago/threads/tests/test_threadslist_view.py | 8 | 6188 | from django.test import TestCase
from misago.threads.moderation import ModerationError
from misago.threads.views.generic.threads import Actions, Sorting
from misago.users.testutils import AuthenticatedUserTestCase
class MockRequest(object):
def __init__(self, user, method='GET', POST=None):
self.POST = ... | gpl-2.0 |
doctorzeb8/django-era | era/tests/test_functools.py | 1 | 1525 | from ..utils.functools import unidec, pluck, separate, pick, omit, truthful, avg
from .base import SimpleTestCase, IsOkTestCase
class UnidecTestCase(IsOkTestCase):
def test_default_behaviour(self):
self.assertOk(
unidec(lambda fn, a: fn(a) + 'k') \
(lambda a: a[1:])('oo'))
def... | mit |
wujuguang/sentry | tests/integration/tests.py | 9 | 10414 | # -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function
import datetime
import json
import logging
import mock
import zlib
from django.conf import settings
from django.core.urlresolvers import reverse
from django.test.utils import override_settings
from django.utils import timezone
from gzip i... | bsd-3-clause |
SlothMellow/android_kernel_moto_shamu | tools/perf/scripts/python/syscall-counts.py | 11181 | 1522 | # system call counts
# (c) 2010, Tom Zanussi <tzanussi@gmail.com>
# Licensed under the terms of the GNU GPL License version 2
#
# Displays system-wide system call totals, broken down by syscall.
# If a [comm] arg is specified, only syscalls called by [comm] are displayed.
import os
import sys
sys.path.append(os.envir... | gpl-2.0 |
yavwa/Shilling | test/functional/rpc_decodescript.py | 13 | 13449 | #!/usr/bin/env python3
# Copyright (c) 2015-2017 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 decoding scripts via decodescript RPC command."""
from test_framework.test_framework import Bitco... | mit |
yoziru-desu/airflow | airflow/operators/sqlite_operator.py | 9 | 1088 | import logging
from airflow.hooks import SqliteHook
from airflow.models import BaseOperator
from airflow.utils import apply_defaults
class SqliteOperator(BaseOperator):
"""
Executes sql code in a specific Sqlite database
:param sqlite_conn_id: reference to a specific sqlite database
:type sqlite_con... | apache-2.0 |
fkolacek/FIT-VUT | bp-revok/python/lib/python2.7/test/test_iter.py | 39 | 28949 | # Test iterators.
import unittest
from test.test_support import run_unittest, TESTFN, unlink, have_unicode, \
check_py3k_warnings, cpython_only
# Test result of triple loop (too big to inline)
TRIPLETS = [(0, 0, 0), (0, 0, 1), (0, 0, 2),
(0, 1, 0), (0, 1, 1), (0, 1, 2),
... | apache-2.0 |
yeming233/horizon | openstack_dashboard/dashboards/project/security_groups/tests.py | 2 | 41700 | # Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the... | apache-2.0 |
dennis-sheil/commandergenius | project/jni/python/src/Lib/gettext.py | 73 | 19890 | """Internationalization and localization support.
This module provides internationalization (I18N) and localization (L10N)
support for your Python programs by providing an interface to the GNU gettext
message catalog library.
I18N refers to the operation by which a program is made aware of multiple
languages. L10N r... | lgpl-2.1 |
gaborbernat/tox | src/tox/package/builder/isolated.py | 2 | 5403 | from __future__ import unicode_literals
import json
import os
from collections import namedtuple
import six
from packaging.requirements import Requirement
from packaging.utils import canonicalize_name
from tox import reporter
from tox.config import DepConfig, get_py_project_toml
from tox.constants import BUILD_ISOLA... | mit |
tralamazza/micropython | tests/basics/op_error.py | 6 | 1386 | # test errors from bad operations (unary, binary, etc)
# unsupported unary operators
try:
~None
except TypeError:
print('TypeError')
try:
~''
except TypeError:
print('TypeError')
try:
~[]
except TypeError:
print('TypeError')
try:
~bytearray()
except TypeError:
print('TypeError')
# unsu... | mit |
Frankkkkk/arctic | tests/integration/scripts/test_list_libraries.py | 5 | 1033 | from mock import patch, call
import pytest
from arctic.scripts import arctic_list_libraries
from ...util import run_as_main
def test_list_library(mongo_host, library, library_name):
with patch('arctic.scripts.arctic_list_libraries.print') as p:
run_as_main(arctic_list_libraries.main, "--host", mongo_hos... | lgpl-2.1 |
sosolimited/Cinder | docs/libs/bs4/testing.py | 440 | 24510 | """Helper classes for tests."""
import copy
import functools
import unittest
from unittest import TestCase
from bs4 import BeautifulSoup
from bs4.element import (
CharsetMetaAttributeValue,
Comment,
ContentMetaAttributeValue,
Doctype,
SoupStrainer,
)
from bs4.builder import HTMLParserTreeBuilder
d... | bsd-2-clause |
zhhf/charging | charging/plugins/cisco/common/cisco_exceptions.py | 11 | 7811 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2011 Cisco Systems, Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache... | apache-2.0 |
rooty/minishopgae | werkzeug/testsuite/test.py | 66 | 14718 | # -*- coding: utf-8 -*-
"""
werkzeug.testsuite.test
~~~~~~~~~~~~~~~~~~~~~~~
Tests the testing tools.
:copyright: (c) 2011 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
from __future__ import with_statement
import sys
import unittest
from cStringIO import StringIO, OutputTyp... | gpl-3.0 |
xpostudio4/red-de-emprendimiento | app/institutions/views.py | 1 | 4872 | from django.contrib.auth import (login as django_login, authenticate,
logout as django_logout)
from django.contrib.auth.decorators import login_required
from django.contrib.auth.forms import SetPasswordForm
from django.http import JsonResponse, HttpResponseRedirect
from django.shortcuts... | mit |
yoer/hue | desktop/core/ext-py/pycrypto-2.6.1/lib/Crypto/Protocol/Chaffing.py | 127 | 10245 | #
# Chaffing.py : chaffing & winnowing support
#
# Part of the Python Cryptography Toolkit
#
# Written by Andrew M. Kuchling, Barry A. Warsaw, and others
#
# ===================================================================
# The contents of this file are dedicated to the public domain. To
# the extent that dedicat... | apache-2.0 |
Leoniela/nipype | nipype/interfaces/fsl/tests/test_auto_Eddy.py | 9 | 1850 | # AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from nipype.testing import assert_equal
from nipype.interfaces.fsl.epi import Eddy
def test_Eddy_inputs():
input_map = dict(args=dict(argstr='%s',
),
environ=dict(nohash=True,
usedefault=True,
),
flm=dict(argstr='--flm=%s',
),
fwhm=d... | bsd-3-clause |
TangHao1987/intellij-community | python/lib/Lib/site-packages/django/contrib/localflavor/no/forms.py | 309 | 2761 | """
Norwegian-specific Form helpers
"""
import re, datetime
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select
from django.utils.translation import ugettext_lazy as _
class NOZipCodeField(RegexField):
default_error_mes... | apache-2.0 |
todaychi/hue | desktop/core/ext-py/django-extensions-1.5.0/django_extensions/management/commands/runscript.py | 35 | 6775 | import sys
import traceback
from optparse import make_option
from django_extensions.management.email_notifications import EmailNotificationCommand
from django.conf import settings
try:
import importlib
except ImportError:
print("Runscript needs the importlib module to work. You can install it via 'pip install ... | apache-2.0 |
rismalrv/edx-platform | common/djangoapps/third_party_auth/tests/specs/base.py | 36 | 38777 | """Base integration test for provider implementations."""
import unittest
import json
import mock
from django import test
from django.contrib import auth
from django.contrib.auth import models as auth_models
from django.contrib.messages.storage import fallback
from django.contrib.sessions.backends import cache
from ... | agpl-3.0 |
igemsoftware/SYSU-Software2013 | project/Python27_32/Lib/test/test_bufio.py | 125 | 2755 | import unittest
from test import test_support as support
import io # C implementation.
import _pyio as pyio # Python implementation.
# Simple test to ensure that optimizations in the IO library deliver the
# expected results. For best testing, run this under a debug-build Python too
# (to exercise asserts in the C c... | mit |
noironetworks/group-based-policy | gbpservice/nfp/core/cfg.py | 1 | 1671 | # 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
# d... | apache-2.0 |
GodBlessPP/w16b_test | static/Brython3.1.3-20150514-095342/Lib/genericpath.py | 727 | 3093 | """
Path operations common to more than one OS
Do not use directly. The OS specific modules import the appropriate
functions from this module themselves.
"""
import os
import stat
__all__ = ['commonprefix', 'exists', 'getatime', 'getctime', 'getmtime',
'getsize', 'isdir', 'isfile']
# Does a path exist?
#... | agpl-3.0 |
rzambre/servo | tests/wpt/web-platform-tests/cors/resources/preflight.py | 253 | 1238 | def main(request, response):
headers = [("Content-Type", "text/plain")]
if "check" in request.GET:
token = request.GET.first("token")
value = request.server.stash.take(token)
if value == None:
body = "0"
else:
if request.GET.first("check", None) == "keep"... | mpl-2.0 |
pipicold/BlockyTime | server_new/testing/blocks_controller_tester.py | 1 | 2255 | import datetime
from Initialization import Initialization
from Data_Controllers.blocks_controller import blocks_controller
from DB_Model import database_helper
from DB_Model.database_tester import database_tester
from DB_Model.database_model import Blocks
from DB_Model.database_model import Users
class blocks_control... | gpl-3.0 |
alx-eu/django | tests/modeltests/select_related/models.py | 114 | 1906 | """
41. Tests for select_related()
``select_related()`` follows all relationships and pre-caches any foreign key
values so that complex trees can be fetched in a single query. However, this
isn't always a good idea, so the ``depth`` argument control how many "levels"
the select-related behavior will traverse.
"""
fro... | bsd-3-clause |
jiegec/gnuradio | grc/base/Param.py | 9 | 7863 | """
Copyright 2008-2011 Free Software Foundation, Inc.
This file is part of GNU Radio
GNU Radio Companion 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 l... | gpl-3.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.