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 |
|---|---|---|---|---|---|
civato/9005-LL-DEV | scripts/rt-tester/rt-tester.py | 11005 | 5307 | #!/usr/bin/python
#
# rt-mutex tester
#
# (C) 2006 Thomas Gleixner <tglx@linutronix.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
import os
import sys
import getopt
import sh... | gpl-2.0 |
theheros/kbengine | kbe/res/scripts/common/Lib/unittest/signals.py | 56 | 1715 | import signal
import weakref
from functools import wraps
__unittest = True
class _InterruptHandler(object):
def __init__(self, default_handler):
self.called = False
self.default_handler = default_handler
def __call__(self, signum, frame):
installed_handler = signal.get... | lgpl-3.0 |
timqian/sms-tools | lectures/3-Fourier-properties/plots-code/zero-padding.py | 26 | 1083 | import numpy as np
import matplotlib.pyplot as plt
from scipy.signal import hamming
from scipy.fftpack import fft, fftshift
plt.figure(1, figsize=(9.5, 6))
M = 8
N1 = 8
N2 = 16
N3 = 32
x = np.cos(2*np.pi*2/M*np.arange(M)) * np.hanning(M)
plt.subplot(4,1,1)
plt.title('x, M=8')
plt.plot(np.arange(-M/2.0,M/2), x, 'b', m... | agpl-3.0 |
ptitjes/quodlibet | quodlibet/util/library.py | 4 | 3655 | # Copyright 2004-2017 Joe Wreschnig, Michael Urman, Iñigo Serna,
# Christoph Reiter, Nick Boultbee
#
# 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... | gpl-2.0 |
AlanZatarain/cortex-vfx | python/IECoreNuke/__init__.py | 12 | 2342 | ##########################################################################
#
# Copyright (c) 2008-2010, Image Engine Design 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:
#
# * Redis... | bsd-3-clause |
AlanJAS/fischerTX | usb/control.py | 28 | 8739 | # Copyright (C) 2009-2014 Wander Lairson Costa
#
# The following terms apply to all files associated
# with the software unless explicitly disclaimed in individual files.
#
# The authors hereby grant permission to use, copy, modify, distribute,
# and license this software and its documentation for any purpose, provided... | gpl-3.0 |
projectcalico/calico-nova | nova/tests/unit/test_weights.py | 31 | 1875 | # Copyright 2011-2012 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | apache-2.0 |
blaggacao/OpenUpgrade | addons/l10n_br/__openerp__.py | 430 | 3125 | # -*- encoding: utf-8 -*-
###############################################################################
#
# Copyright (C) 2009 Renato Lima - Akretion
#
# 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 th... | agpl-3.0 |
NateBrune/bitcoin-nate | qa/rpc-tests/test_framework/util.py | 4 | 13111 | # 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.
#
# Helpful routines for regression testing
#
# Add python-bitcoinrpc to module search path:
import os
import sys
from decimal impor... | mit |
lduarte1991/edx-platform | cms/djangoapps/contentstore/features/courses.py | 20 | 2137 | # pylint: disable=missing-docstring
# pylint: disable=redefined-outer-name
# pylint: disable=unused-argument
from lettuce import step, world
from common import *
############### ACTIONS ####################
@step('There are no courses$')
def no_courses(step):
world.clear_courses()
create_studio_user()
@... | agpl-3.0 |
rubencabrera/odoo | addons/crm_helpdesk/crm_helpdesk.py | 182 | 7480 | # -*- 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 |
CalthorpeAnalytics/urbanfootprint | footprint/main/publishing/behavior_publishing.py | 1 | 5246 |
# UrbanFootprint v1.5
# Copyright (C) 2017 Calthorpe Analytics
#
# This file is part of UrbanFootprint version 1.5
#
# UrbanFootprint is distributed under the terms of the GNU General
# Public License version 3, as published by the Free Software Foundation. This
# code is distributed WITHOUT ANY WARRANTY, without impl... | gpl-3.0 |
aioue/ansible | contrib/inventory/rudder.py | 195 | 10674 | #!/usr/bin/env python
# Copyright (c) 2015, Normation SAS
#
# Inspired by the EC2 inventory plugin:
# https://github.com/ansible/ansible/blob/devel/contrib/inventory/ec2.py
#
# 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 Publ... | gpl-3.0 |
keishi/chromium | chrome/test/functional/gtalk/test_basic.py | 2 | 11852 | #!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Basic sanity tests for the GTalk extension.
This module contains the basic set of sanity tests run on the
GTalk extension.
"""
... | bsd-3-clause |
vivek8943/twython | setup.py | 4 | 1293 | #!/usr/bin/env python
import os
import sys
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
__author__ = 'Ryan McGrath <ryan@venodesigns.net>'
__version__ = '3.3.0'
packages = [
'twython',
'twython.streaming'
]
if sys.argv[-1] == 'publish':
os.system('pytho... | mit |
benletchford/stratego.io | gae/tests/FIXTURES.py | 1 | 2396 | import json
import copy
SETUP = [
[
{'rank': '1', 'side': 3},
{'rank': '2', 'side': 3},
{'rank': '3', 'side': 3},
{'rank': '3', 'side': 3},
{'rank': '4', 'side': 3},
{'rank': '4', 'side': 3},
{'rank': '4', 'side': 3},
{'rank': '5', 'side': 3},
... | mit |
jylaxp/django | django/contrib/admin/checks.py | 186 | 38800 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from itertools import chain
from django.contrib.admin.utils import (
NotRelationField, flatten, get_fields_from_path,
)
from django.core import checks
from django.core.exceptions import FieldDoesNotExist
from django.db import models
from django.forms... | bsd-3-clause |
42cs/book | modules/luther/sphinx/assess/assessbase.py | 1 | 2756 | # Copyright (C) 2011 Bradley N. Miller
#
# 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 distribute... | mit |
mheap/ansible | lib/ansible/modules/network/f5/bigip_pool.py | 18 | 29767 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017 F5 Networks Inc.
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | gpl-3.0 |
umrashrf/scrapy | scrapy/settings/default_settings.py | 3 | 8505 | """
This module contains the default values for all settings used by Scrapy.
For more information about these settings you can read the settings
documentation in docs/topics/settings.rst
Scrapy developers, if you add a setting here remember to:
* add it in alphabetical order
* group similar settings without leaving ... | bsd-3-clause |
dfalk/mezzanine-wiki | mezzanine_wiki/fields.py | 1 | 1385 | from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.db import models
from django.utils.translation import ugettext_lazy as _
from mezzanine.utils.importing import import_dotted_path
class WikiTextField(models.TextField):
"""
TextField that stores markup text.
... | bsd-2-clause |
mSenyor/sl4a | python/src/Lib/plat-irix6/panelparser.py | 132 | 3398 | # Module 'parser'
#
# Parse S-expressions output by the Panel Editor
# (which is written in Scheme so it can't help writing S-expressions).
#
# See notes at end of file.
from warnings import warnpy3k
warnpy3k("the panelparser module has been removed in Python 3.0", stacklevel=2)
del warnpy3k
whitespace = ' \t\n'
oper... | apache-2.0 |
beblount/Steer-Clear-Backend-Web | env/Lib/site-packages/pip/_vendor/_markerlib/markers.py | 1769 | 3979 | # -*- coding: utf-8 -*-
"""Interpret PEP 345 environment markers.
EXPR [in|==|!=|not in] EXPR [or|and] ...
where EXPR belongs to any of those:
python_version = '%s.%s' % (sys.version_info[0], sys.version_info[1])
python_full_version = sys.version.split()[0]
os.name = os.name
sys.platform = sys.platfo... | mit |
gdw2/zim | zim/formats/plain.py | 1 | 4786 | # -*- coding: utf-8 -*-
# Copyright 2008 Jaap Karssenberg <jaap.karssenberg@gmail.com>
'''This module handles parsing and dumping input in plain text'''
import re
import zim.parser
from zim.parser import prepare_text, Rule
from zim.formats import *
from zim.parsing import url_re
info = {
'name': 'plain',
'desc... | gpl-2.0 |
levythu/thefuck | tests/rules/test_git_two_dashes.py | 5 | 1778 | import pytest
from thefuck.rules.git_two_dashes import match, get_new_command
from tests.utils import Command
@pytest.fixture
def stderr(meant):
return 'error: did you mean `%s` (with two dashes ?)' % meant
@pytest.mark.parametrize('command', [
Command(script='git add -patch', stderr=stderr('--patch')),
... | mit |
ameily/mongo-python-driver | ez_setup.py | 164 | 12155 | #!python
"""Bootstrap setuptools installation
If you want to use setuptools in your package's setup.py, just include this
file in the same directory with it, and add this to the top of your setup.py::
from ez_setup import use_setuptools
use_setuptools()
If you want to require a specific version of setuptools... | apache-2.0 |
thoreg/satchmo | satchmo/apps/satchmo_ext/productratings/templatetags/satchmo_ratings.py | 6 | 1491 | from django import template
from django.template.loader import render_to_string
from livesettings import config_value
from satchmo_ext.productratings.utils import get_product_rating_string, get_product_rating
import logging
log = logging.getLogger('shop.templatetags')
register = template.Library()
def product_rating... | bsd-3-clause |
Jimdo/thumbor | thumbor/filters/__init__.py | 14 | 6047 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/globocom/thumbor/wiki
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com timehome@corp.globo.com
import re
import collections
STRIP_QUOTE = re.compile(r"^'(.+)'$")
... | mit |
lanbing510/GTDWeb | django/contrib/contenttypes/admin.py | 273 | 5345 | from __future__ import unicode_literals
from functools import partial
from django.contrib.admin.checks import InlineModelAdminChecks
from django.contrib.admin.options import InlineModelAdmin, flatten_fieldsets
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.forms impo... | gpl-2.0 |
ykim362/mxnet | example/gluon/learning_rate_manipulation.py | 27 | 2408 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | apache-2.0 |
the-useless-one/hide_my_python | regex.py | 3 | 2916 | #!/usr/bin/env python3
# -*- coding: utf8 -*-
#
# HideMyPython! - A parser for the free proxy list on HideMyAss!
#
# This file defines the different needed regular expressions to retrieve
# the proxy's parameters from the HideMyAss! proxy list.
#
# Copyright (C) 2013 Yannick Méheut <useless (at) utouch (dot) fr>
#
... | gpl-3.0 |
houghb/HDSAviz | savvy/tests/test_network_tools.py | 2 | 2500 | import unittest
import os.path as op
try:
import cPickle as pickle
except:
import pickle
import savvy
from ..network_tools import (build_graph, plot_network_random,
plot_network_circle)
# Load a sample file to use for testing
path = op.join(savvy.__path__[0], 'sample_data_files/'... | bsd-2-clause |
Mitali-Sodhi/CodeLingo | Dataset/python/test_foursquare.py | 92 | 4108 | import json
from social.tests.backends.oauth import OAuth2Test
class FoursquareOAuth2Test(OAuth2Test):
backend_path = 'social.backends.foursquare.FoursquareOAuth2'
user_data_url = 'https://api.foursquare.com/v2/users/self'
expected_username = 'FooBar'
access_token_body = json.dumps({
'access_... | mit |
mswart/pyopenmensa | setup.py | 1 | 2029 | from setuptools import setup # Always prefer setuptools over distutils
from codecs import open # To use a consistent encoding
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the relevant file
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_de... | lgpl-3.0 |
laprice/newfies-dialer | newfies/dialer_settings/models.py | 6 | 3296 | #
# Newfies-Dialer License
# http://www.newfies-dialer.org
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright (C) 2011-2012 Star2Billing S.L.
#
# The Initia... | mpl-2.0 |
interfect/cjdns | node_build/dependencies/libuv/build/gyp/pylib/gyp/generator/gypsh.py | 2779 | 1665 | # Copyright (c) 2011 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""gypsh output module
gypsh is a GYP shell. It's not really a generator per se. All it does is
fire up an interactive Python session with a few local variables... | gpl-3.0 |
talhajaved/nyuadmarket | flask/lib/python2.7/site-packages/sqlalchemy/inspection.py | 81 | 3093 | # sqlalchemy/inspect.py
# Copyright (C) 2005-2015 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""The inspection module provides the :func:`.inspect` function,
which deliver... | mit |
kevinmel2000/brython | www/src/Lib/select.py | 730 | 9440 | """
borrowed from jython
https://bitbucket.org/jython/jython/raw/28a66ba038620292520470a0bb4dc9bb8ac2e403/Lib/select.py
"""
#import java.nio.channels.SelectableChannel
#import java.nio.channels.SelectionKey
#import java.nio.channels.Selector
#from java.nio.channels.SelectionKey import OP_ACCEPT, OP_CONNECT, OP_WRITE, ... | bsd-3-clause |
aidan-fitz/graphics16 | parser.py | 2 | 6012 | from display import *
from matrix import *
from matrix import matrix_mult as mmult
from draw import *
from draw3d import *
from math import *
from stack import Stack
def parse_file( fname, screen, pen ):
# transformation matrix stack
stack = Stack()
# Iterating over the file so we can keep it open
# ... | bsd-3-clause |
paweltin/saleor | saleor/order/forms.py | 10 | 1249 | from django import forms
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from .models import Payment
class PaymentMethodsForm(forms.Form):
method = forms.ChoiceField(choices=settings.CHECKOUT_PAYMENT_CHOICES, widget=forms.RadioSelect,
initi... | bsd-3-clause |
mmardini/django | tests/pagination/tests.py | 3 | 13507 | from __future__ import unicode_literals
from datetime import datetime
import unittest
from django.core.paginator import (Paginator, EmptyPage, InvalidPage,
PageNotAnInteger)
from django.test import TestCase
from django.utils import six
from .models import Article
from .custom import ValidAdjacentNumsPaginator
... | bsd-3-clause |
hn8841182/2015cd_midterm | static/Brython3.1.0-20150301-090019/Lib/copyreg.py | 749 | 6611 | """Helper to provide extensibility for pickle.
This is only useful to add pickle support for extension types defined in
C, not for instances of user-defined classes.
"""
__all__ = ["pickle", "constructor",
"add_extension", "remove_extension", "clear_extension_cache"]
dispatch_table = {}
def pickle(ob_typ... | gpl-3.0 |
tmm1/home-assistant | homeassistant/components/sun.py | 7 | 6248 | """
homeassistant.components.sun
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Provides functionality to keep track of the sun.
Event listener
--------------
The suns event listener will call the service when the sun rises or sets with
an offset.
The sun event need to have the type 'sun', which service to call, which event
(sunset o... | mit |
beni55/edx-platform | openedx/core/djangoapps/user_api/errors.py | 146 | 3053 | """
Errors thrown by the various user APIs.
"""
class UserAPIRequestError(Exception):
"""There was a problem with the request to the User API. """
pass
class UserAPIInternalError(Exception):
"""An internal error occurred in the User API. """
pass
class UserNotFound(UserAPIRequestError):
"""The... | agpl-3.0 |
JohannesFeldmann/pism | examples/old/pddtune/linesearch.py | 5 | 11882 | #!/usr/bin/env python
## @package linesearch
## \author Ed Bueler, University of Alaska Fairbanks, USA
## \brief A script for doing a line search over stddev parameter of PDD.
## Copyright (C) 2010, 2012 Ed Bueler
##
## see README for role of this script
## This script uses NCO (http://nco.sourceforge.net/).
import c... | gpl-2.0 |
richard-shepherd/monopyly | AIs/Stephen Chan/big_brick.py | 1 | 20396 | from monopyly import *
import random
class BigBrickAI(PlayerAIBase):
mClassDebug = True
def __init__(self):
self.p("__init__")
self.turn_count = 0
self.chance_cards_count=0
self.community_chest_cards_count=0
self.property_mortgage_cards_count=0
self.auction_spr... | mit |
cfg2015/EPT-2015-2 | addons/hr_timesheet_sheet/report/hr_timesheet_report.py | 194 | 4092 | # -*- 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 |
pschmitt/home-assistant | tests/util/test_pressure.py | 23 | 2247 | """Test Home Assistant pressure utility functions."""
import pytest
from homeassistant.const import (
PRESSURE_HPA,
PRESSURE_INHG,
PRESSURE_MBAR,
PRESSURE_PA,
PRESSURE_PSI,
)
import homeassistant.util.pressure as pressure_util
INVALID_SYMBOL = "bob"
VALID_SYMBOL = PRESSURE_PA
def test_convert_sa... | apache-2.0 |
jbalogh/airflow | docs/conf.py | 36 | 8474 | # -*- coding: utf-8 -*-
#
# Airflow documentation build configuration file, created by
# sphinx-quickstart on Thu Oct 9 20:50:01 2014.
#
# 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 file.
#
# A... | apache-2.0 |
CforED/Machine-Learning | sklearn/exceptions.py | 18 | 4332 | """
The :mod:`sklearn.exceptions` module includes all custom warnings and error
classes used across scikit-learn.
"""
__all__ = ['NotFittedError',
'ChangedBehaviorWarning',
'ConvergenceWarning',
'DataConversionWarning',
'DataDimensionalityWarning',
'EfficiencyWarn... | bsd-3-clause |
JohnTheodore/cloud-custodian | c7n/resources/snowball.py | 5 | 1609 | # Copyright 2017 Capital One Services, 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... | apache-2.0 |
proyan/sot-torque-control | python/dynamic_graph/sot/torque_control/identification/identify_motor_acc.py | 1 | 2771 | # -*- coding: utf-8 -*-
"""
Created on Tue Sep 12 18:47:50 2017
@author: adelpret
"""
from scipy import signal
import numpy as np
from scipy import ndimage
import matplotlib.pyplot as plt
from identification_utils import solve1stOrderLeastSquare
def identify_motor_acc(dt, dq, ddq, current, tau, Kt_p, Kv_p, ZERO_VELO... | gpl-3.0 |
erickt/hue | desktop/libs/indexer/src/indexer/models.py | 5 | 2608 | #!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | apache-2.0 |
samboiki/smap-data | python/smap/ops/test/test_group.py | 4 | 15491 | """
Copyright (c) 2011, 2012, Regents of the University of California
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 l... | bsd-2-clause |
waqasjamil/gdb | gdb/python/lib/gdb/__init__.py | 27 | 3452 | # Copyright (C) 2010-2013 Free Software Foundation, Inc.
# 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 progr... | gpl-2.0 |
bhansa/fireball | pyvenv/Lib/site-packages/pip/_vendor/lockfile/linklockfile.py | 536 | 2652 | from __future__ import absolute_import
import time
import os
from . import (LockBase, LockFailed, NotLocked, NotMyLock, LockTimeout,
AlreadyLocked)
class LinkLockFile(LockBase):
"""Lock access to a file using atomic property of link(2).
>>> lock = LinkLockFile('somefile')
>>> lock = Link... | gpl-3.0 |
hhursev/recipe-scraper | tests/test_cookpad.py | 1 | 2502 | from recipe_scrapers.cookpad import CookPad
from tests import ScraperTest
class TestCookPadScraper(ScraperTest):
scraper_class = CookPad
def test_host(self):
self.assertEqual("cookpad.com", self.harvester_class.host())
def test_canonical_url(self):
self.assertEqual(
"https:/... | mit |
electrumalt/electrum-ixc-server | src/test/test_utils.py | 49 | 1107 | __author__ = 'erasmospunk'
import unittest
from utils import hash_160_to_address, bc_address_to_hash_160
class UtilTest(unittest.TestCase):
def test_hash_160_to_address(self):
self.assertEqual(hash_160_to_address(None), None)
self.assertEqual(hash_160_to_address('04e9fca1'.decode('hex')), None)
... | agpl-3.0 |
hynnet/hiwifi-openwrt-HC5661-HC5761 | staging_dir/target-mipsel_r2_uClibc-0.9.33.2/usr/lib/python2.7/test/test_urllibnet.py | 68 | 7844 | #!/usr/bin/env python
import unittest
from test import test_support
import socket
import urllib
import sys
import os
import time
mimetools = test_support.import_module("mimetools", deprecated=True)
def _open_with_retry(func, host, *args, **kwargs):
# Connecting to remote hosts is flaky. Make it more robust
... | gpl-2.0 |
yangzilong1986/python | neo1218/0023/web/migrations/versions/3277cb11e991_initial_migration.py | 38 | 1626 | """initial migration
Revision ID: 3277cb11e991
Revises: None
Create Date: 2015-05-10 08:39:17.826382
"""
# revision identifiers, used by Alembic.
revision = '3277cb11e991'
down_revision = None
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adjust!... | mit |
wildamerica/outdoors | docs/conf.py | 1 | 7761 | # -*- coding: utf-8 -*-
#
# outdoors documentation build configuration file, created by
# sphinx-quickstart.
#
# 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 file.
#
# All configuration values have ... | bsd-3-clause |
ashishdeshpande/robotframework | utest/running/test_userlibrary.py | 8 | 4601 | import unittest
import os
from robot.running import userkeyword
from robot.errors import DataError
from robot.parsing.model import UserKeyword
from robot.utils.asserts import (assert_equals, assert_none,
assert_raises_with_msg, assert_true)
class UserHandlerStub:
def __init__(se... | apache-2.0 |
emk/pyjamas | pygtkweb/demos/027-fixed.py | 8 | 1588 | #!/usr/bin/env python
# example fixed.py
import pygtk
pygtk.require('2.0')
import gtk
class FixedExample:
# This callback method moves the button to a new position
# in the Fixed container.
def move_button(self, widget):
self.x = (self.x+30)%300
self.y = (self.y+50)%300
self.fixed... | apache-2.0 |
voutilad/courtlistener | cl/simple_pages/tests.py | 1 | 7663 | # coding=utf-8
import datetime
import os
from django.conf import settings
from django.core import mail
from django.core.urlresolvers import reverse
from django.http import HttpRequest
from django.test import TestCase, RequestFactory
from django.test.utils import override_settings
from lxml.html import fromstring
from... | agpl-3.0 |
unlimitedlabs/orchestra | orchestra/migrations/0080_completed_project_status.py | 2 | 1407 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.12 on 2018-08-14 17:59
from __future__ import unicode_literals
from django.db import migrations, models
from django.db.models import Count
PROJECT_STATUS_ACTIVE = 0
PROJECT_STATUS_COMPLETED = 4
TASK_STATUS_COMPLETED = 5
def mark_completed_projects(apps, schema_edit... | apache-2.0 |
bjackman/trappy | trappy/utils.py | 2 | 3208 | # Copyright 2015-2017 ARM Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | apache-2.0 |
Ninjakow/TrueSkill | lib/numpy/ma/tests/test_core.py | 16 | 171610 | # pylint: disable-msg=W0401,W0511,W0611,W0612,W0614,R0201,E1102
"""Tests suite for MaskedArray & subclassing.
:author: Pierre Gerard-Marchant
:contact: pierregm_at_uga_dot_edu
"""
from __future__ import division, absolute_import, print_function
__author__ = "Pierre GF Gerard-Marchant"
import warnings
import pickle
i... | gpl-3.0 |
kbrebanov/ansible | lib/ansible/modules/cloud/amazon/ec2_group_facts.py | 48 | 5042 | #!/usr/bin/python
# Copyright: Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
... | gpl-3.0 |
stylianos-kampakis/scikit-learn | examples/exercises/plot_cv_diabetes.py | 231 | 2527 | """
===============================================
Cross-validation on diabetes Dataset Exercise
===============================================
A tutorial exercise which uses cross-validation with linear models.
This exercise is used in the :ref:`cv_estimators_tut` part of the
:ref:`model_selection_tut` section of ... | bsd-3-clause |
hydroshare/hydroshare_temp | hs_party/forms/person.py | 1 | 3624 | __author__ = 'valentin'
#from mezzanine.forms.models import Form
from django.forms import ModelForm, Textarea
from django import forms
from django.forms.models import inlineformset_factory,modelformset_factory,BaseModelFormSet
from ..models.organization import Organization
from ..models.person import Person,PersonLoca... | bsd-3-clause |
sujeet4github/MyLangUtils | LangPython/oreilly-intro-to-flask-video/venv/lib/python3.6/site-packages/pip/utils/deprecation.py | 343 | 2232 | """
A module that implements tooling to enable easy warnings about deprecations.
"""
from __future__ import absolute_import
import logging
import warnings
class PipDeprecationWarning(Warning):
pass
class Pending(object):
pass
class RemovedInPip10Warning(PipDeprecationWarning):
pass
class RemovedInP... | gpl-3.0 |
ecrespo/django_kanban-agile | kanban/lib/python2.7/site-packages/tastypie/utils/timezone.py | 48 | 1032 | from __future__ import unicode_literals
import datetime
from django.conf import settings
try:
from django.utils import timezone
def make_aware(value):
if getattr(settings, "USE_TZ", False) and timezone.is_naive(value):
default_tz = timezone.get_default_timezone()
value = timezo... | mit |
Gadal/sympy | sympy/physics/optics/tests/test_waves.py | 76 | 1699 | from sympy import (symbols, Symbol, pi, sqrt, cos, sin, Derivative,
Function, simplify, I, atan2)
from sympy.abc import epsilon, mu
from sympy.functions.elementary.exponential import exp
from sympy.physics.units import c, m, s
from sympy.physics.optics import TWave
def test_twave():
A1, phi1, A2, phi2, f = sy... | bsd-3-clause |
ivanfilippov/PowerDNS-Admin | create_db.py | 1 | 2745 | #!/usr/bin/env python
from migrate.versioning import api
from config import SQLALCHEMY_DATABASE_URI
from config import SQLALCHEMY_MIGRATE_REPO
from app import db
from app.models import Role, Setting
import os.path
import time
import sys
def start():
wait_time = get_waittime_from_env()
if not connect_db(wait_... | mit |
meghana1995/sympy | sympy/core/tests/test_exprtools.py | 51 | 15453 | """Tests for tools for manipulating of large commutative expressions. """
from sympy import (S, Add, sin, Mul, Symbol, oo, Integral, sqrt, Tuple, I,
Interval, O, symbols, simplify, collect, Sum, Basic, Dict,
root, exp, cos, sin, oo, Dummy, log)
from sympy.core.exprtools import (de... | bsd-3-clause |
vmax-feihu/hue | desktop/core/ext-py/django-axes-1.4.0/axes/decorators.py | 14 | 17459 | import logging
import socket
from datetime import timedelta
from django.conf import settings
from django.contrib.auth import logout
from django.core.exceptions import ObjectDoesNotExist
from django.http import HttpResponse
from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response
fr... | apache-2.0 |
nolanliou/tensorflow | tensorflow/contrib/data/python/ops/random_ops.py | 14 | 2483 | # 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... | apache-2.0 |
HenriWahl/Nagstamon | Nagstamon/thirdparty/Xlib/keysymdef/__init__.py | 1 | 1130 | # Xlib.keysymdef -- X keysym defs
#
# Copyright (C) 2001 Peter Liljenberg <petli@ctrl-c.liu.se>
#
# 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
... | gpl-2.0 |
MiyamotoAkira/kivy | kivy/core/video/video_ffmpeg.py | 38 | 2787 | '''
FFmpeg video abstraction
========================
.. versionadded:: 1.0.8
This abstraction requires ffmpeg python extensions. We have made a special
extension that is used for the android platform but can also be used on x86
platforms. The project is available at::
http://github.com/tito/ffmpeg-android
The ... | mit |
roadmapper/ansible | lib/ansible/module_utils/network/nxos/facts/vlans/vlans.py | 11 | 6982 | #
# -*- coding: utf-8 -*-
# Copyright 2019 Red Hat
# GNU General Public License v3.0+
# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)#!/usr/bin/python
"""
The nxos vlans fact class
It is in this file the configuration is collected from the device
for a given resource, parsed, and the facts tree is populated... | gpl-3.0 |
aschwaighofer/swift | utils/gyb_foundation_support.py | 30 | 3373 | def ObjectiveCBridgeableImplementationForNSValue(Type):
return """
extension {Type}: _ObjectiveCBridgeable {{
public func _bridgeToObjectiveC() -> NSValue {{
var myself = self
return NSValue(bytes: &myself, objCType: _getObjCTypeEncoding({Type}.self))
}}
public static func _forceBridgeFromObjectiveC(... | apache-2.0 |
ninuxorg/netdiff | tests/test_batman.py | 1 | 4523 | import os
import networkx
from netdiff import BatmanParser, diff
from netdiff.exceptions import ParserError
from netdiff.tests import TestCase
CURRENT_DIR = os.path.dirname(os.path.realpath(__file__))
iulinet = open('{0}/static/batman.json'.format(CURRENT_DIR)).read()
iulinet2 = open('{0}/static/batman-1+1.json'.for... | mit |
RyanChinSang/ECNG3020-ORSS4SCVI | BETA/dev02/test3.py | 1 | 4947 | from __future__ import print_function
from threading import Thread
import sys
import cv2
import numpy as np
import queue
from BETA.dev02.test2 import avg_color
from BETA.dev02.test4 import t2s_say
class VideoStream:
def __init__(self, src=None, height=None, width=None, ratio=None):
cv2.setUseOptimized(Tru... | gpl-3.0 |
shizhai/wprobe | build_dir/host/scons-2.1.0/build/lib.linux-i686-2.7/SCons/Platform/posix.py | 21 | 8703 | """SCons.Platform.posix
Platform-specific initialization for POSIX (Linux, UNIX, etc.) systems.
There normally shouldn't be any need to import this module directly. It
will usually be imported through the generic SCons.Platform.Platform()
selection method.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2... | gpl-2.0 |
AirChen/MachineLearningDoc | collective_intelligence/chapter_3/Imaging-1.1.7/PIL/XbmImagePlugin.py | 40 | 2375 | #
# The Python Imaging Library.
# $Id$
#
# XBM File handling
#
# History:
# 1995-09-08 fl Created
# 1996-11-01 fl Added save support
# 1997-07-07 fl Made header parser more tolerant
# 1997-07-22 fl Fixed yet another parser bug
# 2001-02-17 fl Use 're' instead of 'regex' (Python 2.1) (0.4)
# 2001-05-13 fl Ad... | mit |
yongtang/tensorflow | tensorflow/python/kernel_tests/xent_op_deterministic_test.py | 6 | 8561 | # Copyright 2021 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 |
anryko/ansible | lib/ansible/modules/database/proxysql/proxysql_scheduler.py | 5 | 13799 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2017, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = '''
---
module: proxysql_scheduler
version... | gpl-3.0 |
int19h/PTVS | Python/Product/Miniconda/Miniconda3-x64/Lib/site-packages/conda_env/specs/requirements.py | 7 | 1351 | # -*- coding: utf-8 -*-
# Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
import os
from .. import env
class RequirementsSpec(object):
'''
Reads depedencies from a requirements.txt file
and returns an Environment object from it.
'''
msg = None
extensions = set(['.txt'... | apache-2.0 |
liuwenf/moose | python/TestHarness/tests/test_DryRun.py | 5 | 1060 | import subprocess
from TestHarnessTestCase import TestHarnessTestCase
class TestHarnessTester(TestHarnessTestCase):
def testDryRun(self):
"""
Test that --dry-run returns a passing status
"""
output = self.runTests('-i', 'diffs', '--dry-run')
self.assertRegexpMatches(output,... | lgpl-2.1 |
aekul/yotsuba | src/libhw/data/generate.py | 2 | 2056 | #!/usr/bin/python
# This script turns the available GLSL shaders into a header file
# that can be included in the libhw binary.
import sys
def append(fname):
f = open(fname)
sys.stdout.write('static const char *' + fname.replace('.', '_') + ' MAYBE_UNUSED = ')
lineIndex = 0
for line in f:
lineIndex = lineIndex ... | gpl-3.0 |
marc-sensenich/ansible | lib/ansible/modules/network/avi/avi_cloudconnectoruser.py | 31 | 4201 | #!/usr/bin/python
#
# @author: Gaurav Rastogi (grastogi@avinetworks.com)
# Eric Anderson (eanderson@avinetworks.com)
# module_check: supported
# Avi Version: 17.1.1
#
# Copyright: (c) 2017 Gaurav Rastogi, <grastogi@avinetworks.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses... | gpl-3.0 |
alilotfi/django | django/db/backends/mysql/client.py | 520 | 1518 | import subprocess
from django.db.backends.base.client import BaseDatabaseClient
class DatabaseClient(BaseDatabaseClient):
executable_name = 'mysql'
@classmethod
def settings_to_cmd_args(cls, settings_dict):
args = [cls.executable_name]
db = settings_dict['OPTIONS'].get('db', settings_dic... | bsd-3-clause |
wangtaoking1/hummer | backend/kubernetes/k8sclient.py | 1 | 9953 | import json
import requests
import logging
from backend.kubernetes.namespace import Namespace
from backend.kubernetes.replicationcontroller import Controller
from backend.kubernetes.service import Service
from backend.kubernetes.volume import PersistentVolume, PersistentVolumeClaim
from backend.kubernetes.autoscaler i... | apache-2.0 |
jbbskinny/sympy | examples/galgebra/latex_check.py | 66 | 11565 | #!/usr/bin/env python
from __future__ import print_function
from sympy import Symbol, symbols, sin, cos, Rational, expand, simplify, collect, S
from sympy.galgebra import xdvi, Get_Program, Print_Function
from sympy.galgebra import MV, Format, Com, Nga
def F(x):
global n, nbar
Fx = Rational(1, 2)*((x*x)*n +... | bsd-3-clause |
mnahm5/django-estore | Lib/site-packages/unidecode/x089.py | 252 | 4628 | data = (
'Ji ', # 0x00
'Zhi ', # 0x01
'Gua ', # 0x02
'Ken ', # 0x03
'Che ', # 0x04
'Ti ', # 0x05
'Ti ', # 0x06
'Fu ', # 0x07
'Chong ', # 0x08
'Xie ', # 0x09
'Bian ', # 0x0a
'Die ', # 0x0b
'Kun ', # 0x0c
'Duan ', # 0x0d
'Xiu ', # 0x0e
'Xiu ', # 0x0f
'He ', # 0x10
'Yuan ... | mit |
adviti/melange | thirdparty/google_appengine/lib/django_1_2/django/contrib/localflavor/ar/forms.py | 309 | 3903 | # -*- coding: utf-8 -*-
"""
AR-specific Form helpers.
"""
from django.forms import ValidationError
from django.core.validators import EMPTY_VALUES
from django.forms.fields import RegexField, CharField, Select
from django.utils.encoding import smart_unicode
from django.utils.translation import ugettext_lazy as _
class... | apache-2.0 |
duramato/SickRage | lib/cachecontrol/controller.py | 57 | 10112 | """
The httplib2 algorithms ported for use with requests.
"""
import re
import calendar
import time
from email.utils import parsedate_tz
from requests.structures import CaseInsensitiveDict
from .cache import DictCache
from .serialize import Serializer
URI = re.compile(r"^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]... | gpl-3.0 |
jakirkham/bokeh | bokeh/command/subcommands/json.py | 3 | 3466 | #-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2018, Anaconda, Inc. All rights reserved.
#
# Powered by the Bokeh Development Team.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#---------------------------------------------------... | bsd-3-clause |
laijingtao/landlab | docs/model_grid_guide/overland_flow_with_model_grid_dem.py | 2 | 6735 | #! /usr/env/python
"""
2D numerical model of shallow-water flow over topography read from a DEM, using
the Bates et al. (2010) algorithm for storage-cell inundation modeling.
Last updated GT May 2014
"""
from landlab.io import read_esri_ascii
import time
import os
import pylab
import numpy as np
from landlab.plot i... | mit |
martijnvermaat/rpclib | src/rpclib/util/etreeconv.py | 1 | 3585 |
#
# rpclib - Copyright (C) Rpclib contributors.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This lib... | lgpl-2.1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.