repo_name stringlengths 5 100 | path stringlengths 4 375 | copies stringclasses 991
values | size stringlengths 4 7 | content stringlengths 666 1M | license stringclasses 15
values |
|---|---|---|---|---|---|
victorbriz/rethinkdb | external/v8_3.30.33.16/build/gyp/test/mac/gyptest-xctest.py | 221 | 1196 | #!/usr/bin/env python
# Copyright (c) 2013 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.
"""
Verifies that xctest targets are correctly configured.
"""
import TestGyp
import sys
if sys.platform == 'darwin':
test = TestGyp.Te... | agpl-3.0 |
jackru/pybrain | examples/optimization/multiobjective/constnsga2jpq.py | 25 | 2336 | from __future__ import print_function
#!/usr/bin/env python
""" An illustration of using the NSGA-II multi-objective optimization algorithm
on Constrained Multi-Objective Optimization benchmark function. """
__author__ = 'Jean Pierre Queau, jeanpierre.queau@sbmoffshore.com'
from pybrain.optimization import ConstMult... | bsd-3-clause |
mrkm4ntr/incubator-airflow | tests/api_connexion/endpoints/test_dag_run_endpoint.py | 7 | 36001 | # 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 |
n4xh4ck5/RastLeak | RastLeak/old/RastLeak_1_1.py | 2 | 7141 | import requests
import wget
import json
from urlparse import urlparse
from bs4 import BeautifulSoup
import optparse
#Analyze metadata pdf
import PyPDF2
from PyPDF2 import PdfFileReader
#Analyze metadata docx
import docx
import datetime
#Parser arguments
import argparse
from argparse import RawTextHelpForm... | gpl-3.0 |
HenryHu/Turpial | turpial/ui/qt/updatebox.py | 2 | 17499 | # -*- coding: utf-8 -*-
# Qt update box for Turpial
from PyQt4.QtGui import QFont
from PyQt4.QtGui import QIcon
from PyQt4.QtGui import QLabel
from PyQt4.QtGui import QWidget
from PyQt4.QtGui import QPixmap
from PyQt4.QtGui import QComboBox
from PyQt4.QtGui import QTextEdit
from PyQt4.QtGui import QCompleter
from PyQ... | gpl-3.0 |
Hawstein/xhtml2pdf | xhtml2pdf/pdf.py | 37 | 1983 | # -*- coding: utf-8 -*-
# Copyright 2010 Dirk Holtwick, holtwick.it
#
# 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 ... | apache-2.0 |
mnahm5/django-estore | Lib/site-packages/django/core/cache/backends/dummy.py | 629 | 1213 | "Dummy cache backend"
from django.core.cache.backends.base import DEFAULT_TIMEOUT, BaseCache
class DummyCache(BaseCache):
def __init__(self, host, *args, **kwargs):
BaseCache.__init__(self, *args, **kwargs)
def add(self, key, value, timeout=DEFAULT_TIMEOUT, version=None):
key = self.make_key... | mit |
bspink/django | django/template/loaders/filesystem.py | 418 | 2158 | """
Wrapper for loading templates from the filesystem.
"""
import errno
import io
import warnings
from django.core.exceptions import SuspiciousFileOperation
from django.template import Origin, TemplateDoesNotExist
from django.utils._os import safe_join
from django.utils.deprecation import RemovedInDjango20Warning
fr... | bsd-3-clause |
DataDog/integrations-core | gitlab/tests/test_integration.py | 1 | 2728 | # (C) Datadog, Inc. 2018-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import mock
import pytest
from requests.exceptions import ConnectionError
from datadog_checks.gitlab import GitlabCheck
from .common import AUTH_CONFIG, BAD_CONFIG, CONFIG, CUSTOM_TAGS, HOST, METRICS, as... | bsd-3-clause |
mharding01/herbpy | src/herbpy/tsr/bowl.py | 1 | 2604 | import numpy
from prpy.tsr.tsrlibrary import TSRFactory
from prpy.tsr.tsr import *
@TSRFactory('herb', 'plastic_bowl', 'grasp')
def bowl_grasp(robot, bowl, manip=None):
'''
@param robot The robot performing the grasp
@param bowl The bowl to grasp
@param manip The manipulator to perform the grasp,
... | bsd-3-clause |
tsilva/appier_scaffold | src/controllers/base.py | 1 | 7534 | #!/usr/bin/python
# -*- coding: utf-8 -*-
import appier
import models
class BaseController(appier.Controller):
@appier.route("/", "GET")
def index(self):
account_s = models.Account.get_from_session(raise_e = False)
success = self.field("success")
return self.template(
... | apache-2.0 |
kevalds51/sympy | sympy/printing/mathml.py | 58 | 16250 | """
A MathML printer.
"""
from __future__ import print_function, division
from sympy import sympify, S, Mul
from sympy.core.function import _coeff_isneg
from sympy.core.alphabets import greeks
from sympy.core.compatibility import u, range
from .printer import Printer
from .pretty.pretty_symbology import greek_unicode... | bsd-3-clause |
tartley/chronotank | pyweek12/color.py | 1 | 6169 | from __future__ import division
from collections import namedtuple
from random import randint, uniform
class Color(namedtuple('__BaseColor', 'r g b a')):
'''
4-component named tuple: (r, g, b, a), all floats from 0.0 to 1.0,
with some methods.
.. function:: __init__(r, g, b[, a=1])
``r``, ... | bsd-3-clause |
googleapis/google-cloud-php-debugger | synth.py | 2 | 3371 | # Copyright 2018 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, s... | apache-2.0 |
ns950/calibre | setup/installer/windows/site.py | 14 | 4425 | #!/usr/bin/env python2
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
__license__ = 'GPL v3'
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import sys
import os
import zipimport
import _memimporter
DEBUG_ZIPIMPORT = False
class ZipExtensionImporter(zipimport.z... | gpl-3.0 |
mac389/semantic-distance | Area 51/semantic-clustering.py | 2 | 2337 | print(__doc__)
import numpy as np
import Graphics as artist
from sklearn.cluster import DBSCAN
from sklearn import metrics
from sklearn.datasets.samples_generator import make_blobs
from sklearn.preprocessing import StandardScaler
##############################################################################
# Genera... | mit |
grueni75/GeoDiscoverer | Source/Platform/Target/Android/core/src/main/jni/freetype-2.4.2/builds/mac/ascii2mpw.py | 830 | 1033 | #!/usr/bin/env python
import sys
import string
if len( sys.argv ) == 1 :
for asc_line in sys.stdin.readlines():
mpw_line = string.replace(asc_line, "\\xA5", "\245")
mpw_line = string.replace(mpw_line, "\\xB6", "\266")
mpw_line = string.replace(mpw_line, "\\xC4", "\304")
mpw_line = string.replace(mpw_... | gpl-3.0 |
CristianBB/SickRage | lib/unidecode/x01f.py | 252 | 3899 | data = (
'a', # 0x00
'a', # 0x01
'a', # 0x02
'a', # 0x03
'a', # 0x04
'a', # 0x05
'a', # 0x06
'a', # 0x07
'A', # 0x08
'A', # 0x09
'A', # 0x0a
'A', # 0x0b
'A', # 0x0c
'A', # 0x0d
'A', # 0x0e
'A', # 0x0f
'e', # 0x10
'e', # 0x11
'e', # 0x12
'e', # 0x13
'e', # 0... | gpl-3.0 |
mickojavanese/support-tools | wiki_to_md/wiki2gfm.py | 25 | 4695 | # 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 a... | apache-2.0 |
TaskEvolution/Task-Coach-Evolution | taskcoach/taskcoachlib/thirdparty/tests/test_parser2.py | 451 | 2119 | from __future__ import absolute_import, division, unicode_literals
import io
from . import support # flake8: noqa
from html5lib import html5parser
from html5lib.constants import namespaces
from html5lib import treebuilders
import unittest
# tests that aren't autogenerated from text files
class MoreParserTests(un... | gpl-3.0 |
thomassa/xen-api | ocaml/xapi/tests/looper2.py | 38 | 1410 | #!/usr/bin/python
print "Program attempts to log into an XAPI server to fetch a list of VMs and"
print "a list of debug objects. It then chooses the first debug object, "
print "queries the int->float map and then calls the 'recycle' message using"
print "that map as an argument"
print
import getopt, sys, xapi
url =... | lgpl-2.1 |
jiangxb1987/spark | examples/src/main/python/ml/interaction_example.py | 24 | 1907 | #
# 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 us... | apache-2.0 |
etashjian/ECE757-final | src/arch/x86/isa/insts/system/control_registers.py | 91 | 3073 | # Copyright (c) 2009 The Regents of The University of Michigan
# 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 |
skidzo/sympy | sympy/strategies/rl.py | 94 | 4296 | """ Generic Rules for SymPy
This file assumes knowledge of Basic and little else.
"""
from __future__ import print_function, division
from sympy.utilities.iterables import sift
from .util import new
# Functions that create rules
def rm_id(isid, new=new):
""" Create a rule to remove identities
isid - fn :: ... | bsd-3-clause |
Lmaths/linux-stable-rcn-ee | tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Core.py | 1891 | 3300 | # Core.py - Python extension for perf script, core functions
#
# Copyright (C) 2010 by Tom Zanussi <tzanussi@gmail.com>
#
# This software may be distributed under the terms of the GNU General
# Public License ("GPL") version 2 as published by the Free Software
# Foundation.
from collections import defaultdict
def aut... | gpl-2.0 |
niamoto/niamoto-core | niamoto/utils.py | 2 | 2339 | # coding: utf-8
import re
from sphinx.util import docstrings
# --------------------------------------------------------------- #
# The Following code is taken from #
# https://github.com/openstack/rally/blob/master/rally/common/ #
# plugin/info.py#L31-L78 ... | gpl-3.0 |
altairpearl/scikit-learn | examples/ensemble/plot_voting_decision_regions.py | 86 | 2386 | """
==================================================
Plot the decision boundaries of a VotingClassifier
==================================================
Plot the decision boundaries of a `VotingClassifier` for
two features of the Iris dataset.
Plot the class probabilities of the first sample in a toy dataset
pred... | bsd-3-clause |
AlexanderDolgan/sputnik | wp-content/themes/node_modules/gulp-sass/node_modules/node-sass/node_modules/node-gyp/gyp/buildbot/buildbot_run.py | 270 | 8338 | #!/usr/bin/env python
# Copyright (c) 2012 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.
"""Argument-less script to select what to run on the buildbots."""
import filecmp
import os
import shutil
import subprocess
import sys
i... | gpl-2.0 |
pheinrichs/librenms | LibreNMS/service.py | 14 | 31186 | import LibreNMS
import json
import logging
import os
import subprocess
import threading
import sys
import time
import timeit
from datetime import timedelta
from logging import debug, info, warning, error, critical, exception
from platform import python_version
from time import sleep
from socket import gethostname
fro... | gpl-3.0 |
m11s/MissionPlanner | Lib/ssl.py | 50 | 16075 | # Wrapper module for _ssl, providing some additional facilities
# implemented in Python. Written by Bill Janssen.
"""\
This module provides some more Pythonic support for SSL.
Object types:
SSLSocket -- subtype of socket.socket which does SSL over the socket
Exceptions:
SSLError -- exception raise... | gpl-3.0 |
JulyKikuAkita/PythonPrac | cs15211/24Game.py | 1 | 4885 | __source__ = 'https://leetcode.com/problems/24-game/description/'
# Time: O()
# Space: O()
#
# Description: Leetcode # 679. 24 Game
#
# You have 4 cards each containing a number from 1 to 9.
# You need to judge whether they could operated through *, /, +, -, (, ) to get the value of 24.
#
# Example 1:
# Input: [4, 1, ... | apache-2.0 |
TeamTwisted/external_chromium_org | chrome/common/extensions/docs/server2/gitiles_file_system_test.py | 41 | 5259 | #!/usr/bin/env python
# Copyright 2014 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.
import base64
import json
import unittest
from extensions_paths import SERVER2
from file_system import StatInfo
from future import Fut... | bsd-3-clause |
vodik/pyroute2 | pyroute2/netlink/taskstats/__init__.py | 7 | 5936 | '''
TaskStats module
================
All that you should know about TaskStats, is that you should not
use it. But if you have to, ok::
import os
from pyroute2 import TaskStats
ts = TaskStats()
ts.get_pid_stat(os.getpid())
It is not implemented normally yet, but some methods are already
usable.
'''
... | apache-2.0 |
glovebx/odoo | addons/point_of_sale/report/pos_report.py | 381 | 6370 | # -*- 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 |
caisq/tensorflow | tensorflow/contrib/learn/python/learn/utils/export.py | 14 | 13875 | # 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 |
Vishluck/sympy | sympy/polys/tests/test_polyutils.py | 46 | 10845 | """Tests for useful utilities for higher level polynomial classes. """
from sympy import S, Integer, sin, cos, sqrt, symbols, pi, Eq, Integral, exp
from sympy.utilities.pytest import raises
from sympy.polys.polyutils import (
_nsort,
_sort_gens,
_unify_gens,
_analyze_gens,
_sort_factors,
paral... | bsd-3-clause |
PhonologicalCorpusTools/SLP-Annotator | slpa/gui/search.py | 1 | 34301 | from imports import (Qt, QDialog, QVBoxLayout, QHBoxLayout, QTabWidget, QPushButton, QFont, QListWidget,
QComboBox, QCheckBox, QTableWidget, QTableWidgetItem, QAbstractItemView, QFrame, QButtonGroup,
QRadioButton, QLineEdit, QMenu, QAction, QCompleter, QStringListModel)
from gu... | gpl-3.0 |
farodin91/servo | tests/wpt/css-tests/tools/pywebsocket/src/example/origin_check_wsh.py | 516 | 1992 | # Copyright 2011, 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 of conditions and the f... | mpl-2.0 |
hellodata/hellodate | 2/site-packages/django/db/backends/oracle/creation.py | 34 | 14625 | import sys
import time
from django.conf import settings
from django.db.backends.creation import BaseDatabaseCreation
from django.db.utils import DatabaseError
from django.utils.six.moves import input
TEST_DATABASE_PREFIX = 'test_'
PASSWORD = 'Im_a_lumberjack'
class DatabaseCreation(BaseDatabaseCreation):
# Thi... | lgpl-3.0 |
rbaerzib/xtreemfs | cpp/thirdparty/gtest-1.7.0/test/gtest_filter_unittest.py | 2826 | 21261 | #!/usr/bin/env python
#
# Copyright 2005 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 of... | bsd-3-clause |
40223243/2015cd_midterm2 | static/Brython3.1.1-20150328-091302/Lib/warnings.py | 752 | 13825 | """Python part of the warnings subsystem."""
# Note: function level imports should *not* be used
# in this module as it may cause import lock deadlock.
# See bug 683658.
import linecache
import sys
__all__ = ["warn", "showwarning", "formatwarning", "filterwarnings",
"resetwarnings", "catch_warnings"]
def... | agpl-3.0 |
avadacatavra/servo | tests/wpt/web-platform-tests/tools/lint/tests/test_file_lints.py | 3 | 21473 | from __future__ import unicode_literals
from ..lint import check_file_contents
from .base import check_errors
import os
import pytest
import six
INTERESTING_FILE_NAMES = {
"python": [
"test.py",
],
"js": [
"test.js",
],
"web-lax": [
"test.htm",
"test.html",
],
... | mpl-2.0 |
CS-SI/QGIS | python/plugins/db_manager/db_plugins/spatialite/data_model.py | 59 | 3450 | # -*- coding: utf-8 -*-
"""
/***************************************************************************
Name : DB Manager
Description : Database manager plugin for QGIS
Date : May 23, 2011
copyright : (C) 2011 by Giuseppe Sucameli
email : brush.tyler@... | gpl-2.0 |
nwchandler/ansible | test/runner/lib/core_ci.py | 15 | 12905 | """Access Ansible Core CI remote services."""
from __future__ import absolute_import, print_function
import json
import os
import traceback
import uuid
import errno
import time
from lib.http import (
HttpClient,
HttpResponse,
HttpError,
)
from lib.util import (
ApplicationError,
run_command,
... | gpl-3.0 |
outboxafrica/pimaa | PiMaa/sensors/lib/GrovePi/grove_co2_sensor/grove_co2_example.py | 2 | 1825 | #!/usr/bin/env python
#
# GrovePi Example for using the Grove - CO2 Sensor(http://www.seeedstudio.com/depot/Grove-CO2-Sensor-p-1863.html)
#
# The GrovePi connects the Raspberry Pi and Grove sensors. You can learn more about GrovePi here: http://www.dexterindustries.com/GrovePi
#
# Have a question about this example? ... | gpl-3.0 |
PeterBeard/project-euler | python/problem-027.py | 1 | 1633 | """
Copyright 2016 Peter Beard
Distributed under the GNU GPL v2. For full terms, see the LICENSE file.
Problem #027
Euler discovered the remarkable quadratic formula:
n² + n + 41
It turns out that the formula will produce 40 primes for the consecutive values
n = 0 to 39. However, when n = 40, 402 + 40 + 41 = 40(40 ... | gpl-2.0 |
stadelmanma/OpenPNM | OpenPNM/Geometry/models/throat_surface_area.py | 1 | 2248 | r"""
===============================================================================
Submodule -- throat_surface_area
===============================================================================
"""
import scipy as _sp
def cylinder(geometry, throat_diameter='throat.diameter',
throat_length='throat.le... | mit |
wangjun/odoo | addons/purchase/wizard/purchase_line_invoice.py | 177 | 5258 | # -*- 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 |
SeanWaclawik/open_source | lab6/markdown.py | 1 | 1813 | """
Markdown.py
0. just print whatever is passed in to stdin
0. if filename passed in as a command line parameter,
then print file instead of stdin
1. wrap input in paragraph tags
2. convert single asterisk or underscore pairs to em tags
3. convert double asterisk or underscore pairs to strong tags
4. conve... | mit |
aam-at/tensorflow | tensorflow/compiler/tests/extract_image_patches_op_test.py | 25 | 4754 | # 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 |
mihailignatenko/erp | openerp/report/int_to_text.py | 442 | 2641 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the... | agpl-3.0 |
strint/tensorflow | tensorflow/contrib/metrics/python/metrics/classification.py | 111 | 2647 | # 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 |
littlstar/chromium.src | third_party/pexpect/pexpect.py | 173 | 77354 | """Pexpect is a Python module for spawning child applications and controlling
them automatically. Pexpect can be used for automating interactive applications
such as ssh, ftp, passwd, telnet, etc. It can be used to a automate setup
scripts for duplicating software package installations on different servers. It
can be u... | bsd-3-clause |
CenterForOpenScience/osf.io | api_tests/nodes/serializers/test_serializers.py | 5 | 9672 | from dateutil.parser import parse as parse_date
import pytest
from future.moves.urllib.parse import urlparse
from api.base.settings.defaults import API_BASE
from api.nodes.serializers import NodeSerializer
from api.sparse.serializers import SparseNodeSerializer, SparseRegistrationSerializer
from api.registrations.seri... | apache-2.0 |
HolgerPeters/scikit-learn | sklearn/cluster/spectral.py | 19 | 18536 | # -*- coding: utf-8 -*-
"""Algorithms for spectral clustering"""
# Author: Gael Varoquaux gael.varoquaux@normalesup.org
# Brian Cheung
# Wei LI <kuantkid@gmail.com>
# License: BSD 3 clause
import warnings
import numpy as np
from ..base import BaseEstimator, ClusterMixin
from ..utils import check_rand... | bsd-3-clause |
alexschiller/osf.io | addons/googledrive/serializer.py | 32 | 1733 | from oauthlib.oauth2 import InvalidGrantError
from addons.base.serializer import StorageAddonSerializer
from website.util import api_url_for
class GoogleDriveSerializer(StorageAddonSerializer):
addon_short_name = 'googledrive'
def credentials_are_valid(self, user_settings, client):
try:
s... | apache-2.0 |
mollstam/UnrealPy | UnrealPyEmbed/Development/Python/2015.08.07-Python2710-x64-Source-vs2015/Python27/Source/Flask-0.10/flask/testsuite/subclassing.py | 563 | 1214 | # -*- coding: utf-8 -*-
"""
flask.testsuite.subclassing
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Test that certain behavior of flask can be customized by
subclasses.
:copyright: (c) 2011 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import flask
import unittest
from logging import Str... | mit |
mitocw/edx-platform | openedx/core/djangolib/fields.py | 4 | 1497 | """
Custom Django fields.
"""
from django.db import models
class CharNullField(models.CharField):
"""
CharField that stores NULL but returns ''
"""
description = "CharField that stores NULL but returns ''"
def to_python(self, value):
"""Converts the value into the correct Python object.... | agpl-3.0 |
stefanw/flanker | tests/addresslib/external_dataset_test.py | 9 | 1684 | # coding:utf-8
import re
from .. import *
from nose.tools import assert_equal, assert_not_equal
from flanker.addresslib import address
COMMENT = re.compile(r'''\s*#''')
def test_mailbox_valid_set():
for line in MAILBOX_VALID_TESTS.split('\n'):
# strip line, skip over empty lines
line = line.st... | apache-2.0 |
koduj-z-klasa/python101 | bazy/sqlraw/sqlraw05.py | 1 | 2291 | #! /usr/bin/env python2
# -*- coding: utf-8 -*-
import sqlite3
# utworzenie połączenia z bazą przechowywaną na dysku
# lub w pamięci (':memory:')
con = sqlite3.connect('test.db')
# dostęp do kolumn przez indeksy i przez nazwy
con.row_factory = sqlite3.Row
# utworzenie obiektu kursora
cur = con.cursor()
# tworzenie... | mit |
quickresolve/accel.ai | flask-aws/lib/python2.7/site-packages/requests/packages/urllib3/request.py | 714 | 5988 | from __future__ import absolute_import
try:
from urllib.parse import urlencode
except ImportError:
from urllib import urlencode
from .filepost import encode_multipart_formdata
__all__ = ['RequestMethods']
class RequestMethods(object):
"""
Convenience mixin for classes who implement a :meth:`urlopen... | mit |
partofthething/home-assistant | tests/components/template/test_weather.py | 1 | 1945 | """The tests for the Template Weather platform."""
from homeassistant.components.weather import (
ATTR_WEATHER_HUMIDITY,
ATTR_WEATHER_PRESSURE,
ATTR_WEATHER_TEMPERATURE,
ATTR_WEATHER_WIND_SPEED,
DOMAIN,
)
from homeassistant.setup import async_setup_component
async def test_template_state_text(hass... | mit |
Donkyhotay/pgu | examples/gui10.py | 13 | 4945 | """<title>Integration with a Game</title>
For games, it is usually preferrable to not have your game within
a GUI framework. This GUI framework can be placed within your game.
"""
import time
import random
import pygame
from pygame.locals import *
# the following line is not needed if pgu is installed
import sys; sy... | lgpl-2.1 |
smmribeiro/intellij-community | python/helpers/pydev/third_party/pep8/lib2to3/lib2to3/fixes/fix_urllib.py | 325 | 8385 | """Fix changes imports of urllib which are now incompatible.
This is rather similar to fix_imports, but because of the more
complex nature of the fixing for urllib, it has its own fixer.
"""
# Author: Nick Edds
# Local imports
from lib2to3.fixes.fix_imports import alternates, FixImports
from lib2to3 import fixer... | apache-2.0 |
pombredanne/http-repo.gem5.org-gem5- | src/cpu/o3/probe/SimpleTrace.py | 59 | 2231 | # Copyright (c) 2013 ARM Limited
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implementation of the functionality ... | bsd-3-clause |
groovecoder/kuma | vendor/packages/translate/storage/bundleprojstore.py | 24 | 10543 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2010 Zuza Software Foundation
#
# This file is part of the Translate Toolkit.
#
# 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... | mpl-2.0 |
hajuuk/R7000 | ap/gpl/samba-3.0.13/source/stf/smbcontrol.py | 137 | 7998 | #!/usr/bin/python
#
# Test for smbcontrol command line argument handling.
#
import comfychair
class NoArgs(comfychair.TestCase):
"""Test no arguments produces usage message."""
def runtest(self):
out = self.runcmd("smbcontrol", expectedResult = 1)
self.assert_re_match("Usage: smbcontrol", out[... | gpl-2.0 |
atlassian/boto | boto/sdb/db/sequence.py | 153 | 8223 | # Copyright (c) 2010 Chris Moyer http://coredumped.org/
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, ... | mit |
lakshmi-kannan/st2 | st2common/st2common/models/db/liveaction.py | 6 | 4188 | # 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... | apache-2.0 |
pybel/pybel-tools | tests/test_mutation/test_inference.py | 1 | 1121 | # -*- coding: utf-8 -*-
"""Tests for inference functions."""
import unittest
from pybel import BELGraph
from pybel.constants import *
from pybel.dsl import protein
from pybel_tools.mutation.inference import infer_missing_two_way_edges
class TestMutationInference(unittest.TestCase):
def test_infer_missing_two_w... | mit |
pombredanne/django-rest-framework-json-api | example/tests/integration/test_meta.py | 2 | 1789 | from datetime import datetime
from django.core.urlresolvers import reverse
import pytest
from example.tests.utils import dump_json, redump_json
pytestmark = pytest.mark.django_db
def test_top_level_meta_for_list_view(blog, client):
expected = {
"data": [{
"type": "blogs",
"id": ... | bsd-2-clause |
lunixbochs/sublimelint | lint/edit.py | 1 | 3614 | # edit.py
# buffer editing for both ST2 and ST3 that "just works"
import inspect
import sublime
import sublime_plugin
try:
sublime.sublimelint_edit_storage
except AttributeError:
sublime.sublimelint_edit_storage = {}
def run_callback(func, *args, **kwargs):
spec = inspect.getfullargspec(func)
if spec... | mit |
tobinjt/Flexget | flexget/components/notify/notifiers/email.py | 4 | 7177 | from __future__ import unicode_literals, division, absolute_import
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
from future.utils import text_to_native_str
import logging
import smtplib
import socket
import getpass
from email.mime.multipart import MIMEMultipart
from email.mime.text i... | mit |
belokop/indico_bare | indico/MaKaC/common/Locators.py | 2 | 1943 | # This file is part of Indico.
# Copyright (C) 2002 - 2016 European Organization for Nuclear Research (CERN).
#
# Indico 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 (a... | gpl-3.0 |
QuLogic/vispy | examples/tutorial/gloo/colored_quad.py | 18 | 1648 | # -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
# -------------------------------------------------------------------------... | bsd-3-clause |
cartersgenes/namebench | nb_third_party/httplib2/__init__.py | 451 | 51082 | from __future__ import generators
"""
httplib2
A caching http interface that supports ETags and gzip
to conserve bandwidth.
Requires Python 2.3 or later
Changelog:
2007-08-18, Rick: Modified so it's able to use a socks proxy if needed.
"""
__author__ = "Joe Gregorio (joe@bitworking.org)"
__copyright__ = "Copyrigh... | apache-2.0 |
1flow/1flow | oneflow/core/forms/chaineditem.py | 2 | 2164 | # -*- coding: utf-8 -*-
u"""
Copyright 2013-2014 Olivier Cortès <oc@1flow.io>.
This file is part of the 1flow project.
1flow is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of
the License... | agpl-3.0 |
jtoppins/beaker | IntegrationTests/src/bkr/inttest/client/test_job_list.py | 1 | 7304 |
# 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.
from turbogears.database import session
from bkr.inttest import data_s... | gpl-2.0 |
jchevin/MissionPlanner-master | Lib/distutils/command/config.py | 75 | 13130 | """distutils.command.config
Implements the Distutils 'config' command, a (mostly) empty command class
that exists mainly to be sub-classed by specific module distributions and
applications. The idea is that while every "config" command is different,
at least they're all named the same, and users always see "config" i... | gpl-3.0 |
SNoiraud/gramps | gramps/gen/filters/rules/event/_hassourcecount.py | 5 | 1756 | #
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2002-2007 Donald N. Allingham
# Copyright (C) 2007-2009 Brian G. Matherly
# Copyright (C) 2009 Benny Malengier
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publish... | gpl-2.0 |
heran7/edx-platform | common/lib/xmodule/xmodule/abtest_module.py | 9 | 5266 | import random
import logging
from lxml import etree
from xmodule.x_module import XModule
from xmodule.raw_module import RawDescriptor
from xmodule.xml_module import XmlDescriptor
from xmodule.exceptions import InvalidDefinitionError
from xblock.fields import String, Scope, Dict
DEFAULT = "_DEFAULT_GROUP"
log = logg... | agpl-3.0 |
theCatWisel/ThreatExchange | pytx/pytx/batch.py | 6 | 4375 | import json
from .access_token import get_access_token
from .request import Broker
from .vocabulary import Batch as b
from .vocabulary import ThreatExchange as t
from .errors import (
pytxFetchError
)
class Batch(object):
"""
Class for making Batch requests to the API.
"""
def __init__(self, *... | bsd-3-clause |
bpedman/py-notify-async | notify/base.py | 2 | 42093 | # -*- coding: utf-8 -*-
#--------------------------------------------------------------------#
# This file is part of Py-notify. #
# #
# Copyright (C) 2006, 2007, 2008 Paul Pogonyshev. #
# ... | lgpl-2.1 |
jcpowermac/ansible | lib/ansible/modules/cloud/centurylink/clc_firewall_policy.py | 30 | 21505 | #!/usr/bin/python
#
# Copyright (c) 2015 CenturyLink
# 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': ['previe... | gpl-3.0 |
kennethgillen/ansible | lib/ansible/utils/module_docs_fragments/return_common.py | 122 | 1591 | # Copyright (c) 2016 Ansible, Inc
#
# 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.
#
# Ansi... | gpl-3.0 |
lmazuel/azure-sdk-for-python | azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/models/list_service_sas_response.py | 6 | 1136 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | mit |
andreabrambilla/libres | python/tests/res/enkf/export/test_summary_observation_collector.py | 1 | 1748 | import os
from tests import ResTest
from res.test import ErtTestContext
from res.enkf.export import SummaryObservationCollector
class SummaryObservationCollectorTest(ResTest):
def setUp(self):
os.environ["TZ"] = "CET" # The ert_statoil case was generated in CET
self.config = self.createTestPath(... | gpl-3.0 |
aminorex/icsisumm | icsisumm-primary-sys34_v1/nltk/nltk-0.9.2/nltk_contrib/gluesemantics/lfg.py | 9 | 17968 | # Natural Language Toolkit: Lexical Functional Grammar
#
# Author: Dan Garrette <dhgarrette@gmail.com>
#
# URL: <http://nltk.sf.net>
# For license information, see LICENSE.TXT
class FStructure(dict):
def read_depgraph(depgraph):
return FStructure._read_depgraph(depgraph.root, depgraph, [0])
... | gpl-3.0 |
rickhurst/Django-non-rel-blog | django/contrib/admin/sites.py | 80 | 17398 | import re
from django import http, template
from django.contrib.admin import ModelAdmin, actions
from django.contrib.admin.forms import AdminAuthenticationForm
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.contrib.contenttypes import views as contenttype_views
from django.views.decorators.csrf import ... | bsd-3-clause |
tiffanyj41/hermes | src/data_prep/movieLens_vectorize.py | 3 | 6265 | import numpy as np
class movieLens_vectorize():
def __init__(self, user_interactions, content, user_vector_type, content_vector_type, sqlCtx, **support_files ):
"""
Class initializer to load the required files
Args:
user_interactions: The raw RDD of the user interactions. For ... | apache-2.0 |
EliasVansteenkiste/ConnectionRouter | vtr_flow/scripts/benchtracker/util.py | 2 | 1795 | from __future__ import print_function, division
import re
import sys
import os.path
import socket
import getpass
# working on the task directory
def sort_runs(runs):
natural_sort(runs)
def walk_runs(params, operation, select=sort_runs):
"""walk the selected run# directories and apply operation on each"""
... | mit |
cgstudiomap/cgstudiomap | main/parts/odoo/openerp/addons/test_documentation_examples/tests/test_delegation.py | 366 | 1299 | # -*- coding: utf-8 -*-
from openerp.tests import common
class TestDelegation(common.TransactionCase):
def setUp(self):
super(TestDelegation, self).setUp()
env = self.env
record = env['delegation.parent'].create({
'child0_id': env['delegation.child0'].create({'field_0': 0}).id,... | agpl-3.0 |
Pathel/deuterium | src/tests/test_comms_comms.py | 2 | 3446 | import unittest
class TestChannel(unittest.TestCase):
def test_at_channel_create(self):
# channel = Channel()
# self.assertEqual(expected, channel.at_channel_create())
assert True # TODO: implement your test here
def test_at_init(self):
# channel = Channel()
# self.asse... | bsd-3-clause |
theheros/kbengine | kbe/res/scripts/common/Lib/test/test_shutil.py | 3 | 36253 | # Copyright (C) 2003 Python Software Foundation
import unittest
import shutil
import tempfile
import sys
import stat
import os
import os.path
import functools
from test import support
from test.support import TESTFN
from os.path import splitdrive
from distutils.spawn import find_executable, spawn
from sh... | lgpl-3.0 |
fivejjs/pyhsmm-autoregressive | autoregressive/util.py | 1 | 1780 | from __future__ import division
import numpy as np
from numpy.lib.stride_tricks import as_strided as ast
### striding data for efficient AR computations
def AR_striding(data,nlags):
# I had some trouble with views and as_strided, so copy if not contiguous
data = np.asarray(data)
if not data.flags.c_contig... | gpl-2.0 |
mapbased/phantomjs | src/qt/qtbase/util/local_database/cldr2qlocalexml.py | 102 | 42691 | #!/usr/bin/env python
#############################################################################
##
## Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
## Contact: http://www.qt-project.org/legal
##
## This file is part of the test suite of the Qt Toolkit.
##
## $QT_BEGIN_LICENSE:LGPL$
## Commercial License... | bsd-3-clause |
hoangt/tpzsimul.gem5 | src/python/m5/util/sorteddict.py | 84 | 6183 | # Copyright (c) 2006-2009 Nathan Binkert <nate@binkert.org>
# 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 ... | bsd-3-clause |
CloudServer/nova | nova/tests/functional/v3/test_extension_info.py | 18 | 2310 | # Copyright 2012 Nebula, Inc.
# Copyright 2013 IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required... | apache-2.0 |
tlatzko/spmcluster | .tox/docs/lib/python2.7/site-packages/build/lib/build/lib/build/lib/build/lib/build/lib/build/lib/build/lib/tests/napoleon/test_napoleon.py | 11 | 6556 | # -*- coding: utf-8 -*-
# Copyright 2014 Rob Ruana
# Licensed under the BSD License, see LICENSE file for details.
"""Tests for :mod:`sphinxcontrib.napoleon.__init__` module."""
try:
# Python >=3.3
from unittest.mock import Mock
except ImportError:
from mock import Mock
from collections import namedtuple
... | bsd-2-clause |
lyarwood/sosreport | sos/plugins/rhui.py | 12 | 1382 | # 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 in the hope that it will be useful,
# but... | gpl-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.