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 |
|---|---|---|---|---|---|
alekz112/statsmodels | statsmodels/datasets/tests/test_utils.py | 26 | 1697 | import os
import sys
from statsmodels.datasets import get_rdataset, webuse, check_internet
from numpy.testing import assert_, assert_array_equal, dec
cur_dir = os.path.dirname(os.path.abspath(__file__))
def test_get_rdataset():
# smoke test
if sys.version_info[0] >= 3:
#NOTE: there's no way to test bo... | bsd-3-clause |
carlos-ferras/Sequence-ToolKit | pyqtgraph/graphicsItems/GraphicsObject.py | 44 | 1720 | from ..Qt import QtGui, QtCore, USE_PYSIDE
if not USE_PYSIDE:
import sip
from .GraphicsItem import GraphicsItem
__all__ = ['GraphicsObject']
class GraphicsObject(GraphicsItem, QtGui.QGraphicsObject):
"""
**Bases:** :class:`GraphicsItem <pyqtgraph.graphicsItems.GraphicsItem>`, :class:`QtGui.QGraphicsObject`... | gpl-3.0 |
gtko/CouchPotatoServer | libs/guessit/transfo/guess_bonus_features.py | 150 | 2155 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# GuessIt - A library for guessing information from filenames
# Copyright (c) 2012 Nicolas Wack <wackou@gmail.com>
#
# GuessIt is free software; you can redistribute it and/or modify it under
# the terms of the Lesser GNU General Public License as published by
# the Free ... | gpl-3.0 |
Mibou/django-memcache-status | memcache_status/templatetags/memcache_status_tags.py | 1 | 3249 | from django import template
from django.conf import settings
try:
from django.core.cache import caches
except:
from django.core.cache import get_cache as caches
if caches.__module__.startswith('debug_toolbar'):
from debug_toolbar.panels.cache import original_get_cache as caches
get_cache = lambda cache_na... | bsd-3-clause |
alexteodor/odoo | addons/sale/edi/sale_order.py | 403 | 10861 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (c) 2011-2012 OpenERP S.A. <http://openerp.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of t... | agpl-3.0 |
gcd0318/django | django/contrib/auth/backends.py | 468 | 6114 | from __future__ import unicode_literals
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Permission
class ModelBackend(object):
"""
Authenticates against settings.AUTH_USER_MODEL.
"""
def authenticate(self, username=None, password=None, **kwargs):
UserMod... | bsd-3-clause |
twitter-forks/bazel | src/test/py/bazel/bazel_clean_test.py | 6 | 4484 | # Copyright 2017 The Bazel 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 applicable la... | apache-2.0 |
MCP1/android_kernel_motorola_msm8960dt-common | tools/perf/scripts/python/net_dropmonitor.py | 1258 | 1562 | # Monitor the system for dropped packets and proudce a report of drop locations and counts
import os
import sys
sys.path.append(os.environ['PERF_EXEC_PATH'] + \
'/scripts/python/Perf-Trace-Util/lib/Perf/Trace')
from perf_trace_context import *
from Core import *
from Util import *
drop_log = {}
kallsyms = []
def... | gpl-2.0 |
SonyCSL/KadecotPepperSample | KadecotSamples/lib/requests/packages/urllib3/response.py | 64 | 17149 | from contextlib import contextmanager
import zlib
import io
from socket import timeout as SocketTimeout
from ._collections import HTTPHeaderDict
from .exceptions import (
ProtocolError, DecodeError, ReadTimeoutError, ResponseNotChunked
)
from .packages.six import string_types as basestring, binary_type, PY3
from .... | mit |
nikolas/lettuce | tests/integration/lib/Django-1.3/tests/regressiontests/forms/models.py | 89 | 2477 | # -*- coding: utf-8 -*-
import datetime
import tempfile
from django.db import models
from django.core.files.storage import FileSystemStorage
temp_storage_location = tempfile.mkdtemp()
temp_storage = FileSystemStorage(location=temp_storage_location)
class BoundaryModel(models.Model):
positive_integer = models.P... | gpl-3.0 |
gnieboer/tensorflow | tensorflow/contrib/learn/python/learn/preprocessing/__init__.py | 138 | 1071 | # 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 |
cnbeining/ABPlayerHTML5-Py--nix | httpd.py | 3 | 6069 | #!/usr/bin/env python
#coding=utf-8
"""
Author: Xia Kai <xiaket@corp.netease.com/xiaket@gmail.com>
Filename: httpd.py
Type: httpd that support resume.
Last modified: 2011-06-27 17:38
Description:
"""
import os
import socket
import sys
from SocketServer import ThreadingMixIn
from random import... | mit |
Peddle/hue | desktop/core/ext-py/urllib2_kerberos-0.1.6/urllib2_kerberos.py | 44 | 5663 | #!/usr/bin/python
# urllib2 with kerberos proof of concept
# Copyright 2008 Lime Nest LLC
# Copyright 2008 Lime Spot 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.apa... | apache-2.0 |
AndresCidoncha/Python-Bot | telegram/user.py | 5 | 2192 | #!/usr/bin/env python
# pylint: disable=C0103,W0622
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015 Leandro Toledo de Souza <leandrotoeldodesouza@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public ... | gpl-3.0 |
googyanas/GoogyMax-G4 | Documentation/target/tcm_mod_builder.py | 2358 | 40707 | #!/usr/bin/python
# The TCM v4 multi-protocol fabric module generation script for drivers/target/$NEW_MOD
#
# Copyright (c) 2010 Rising Tide Systems
# Copyright (c) 2010 Linux-iSCSI.org
#
# Author: nab@kernel.org
#
import os, sys
import subprocess as sub
import string
import re
import optparse
tcm_dir = ""
fabric_ops... | gpl-2.0 |
nacl-webkit/chrome_deps | third_party/mesa/MesaLib/src/gallium/docs/source/exts/formatting.py | 52 | 1120 | # formatting.py
# Sphinx extension providing formatting for Gallium-specific data
# (c) Corbin Simpson 2010
# Public domain to the extent permitted; contact author for special licensing
import docutils.nodes
import sphinx.addnodes
def parse_envvar(env, sig, signode):
envvar, t, default = sig.split(" ", 2)
env... | bsd-3-clause |
40223117cda/w16cdaa | static/Brython3.1.0-20150301-090019/Lib/ui/widget.py | 706 | 1774 | import random
from browser import doc
def getMousePosition(e):
if e is None:
e=win.event
if e.pageX or e.pageY:
return {'x': e.pageX, 'y': e.pageY}
if e.clientX or e.clientY:
_posx=e.clientX + doc.body.scrollLeft + doc.documentElement.scrollLeft;
_posy=e.clientY + doc.body.scr... | gpl-3.0 |
knifenomad/django | django/contrib/postgres/forms/array.py | 258 | 6743 | import copy
from django import forms
from django.contrib.postgres.validators import (
ArrayMaxLengthValidator, ArrayMinLengthValidator,
)
from django.core.exceptions import ValidationError
from django.utils import six
from django.utils.safestring import mark_safe
from django.utils.translation import string_concat,... | bsd-3-clause |
disigma/depot_tools | third_party/oauth2client/tools.py | 171 | 8344 | # Copyright (C) 2013 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | bsd-3-clause |
russelmahmud/mess-account | django/contrib/localflavor/uy/forms.py | 310 | 2083 | # -*- coding: utf-8 -*-
"""
UY-specific form helpers.
"""
import re
from django.core.validators import EMPTY_VALUES
from django.forms.fields import Select, RegexField
from django.forms import ValidationError
from django.utils.translation import ugettext_lazy as _
from django.contrib.localflavor.uy.util import get_vali... | bsd-3-clause |
hiteshagrawal/python | battleship3.py | 1 | 1558 | #!/usr/bin/python
import random
board = []
size = 0
def board_print():
global board
for row in board:
print " ".join(row)
def new_game():
global board,size
board = []
size = input("Enter board size:") ## Input will automatically convert it to integer
for row in range(size):
board.append(["0"] * size )
b... | gpl-2.0 |
windyuuy/opera | chromium/src/third_party/WebKit/Tools/Scripts/webkitpy/common/system/user_unittest.py | 124 | 7300 | # Copyright (C) 2010 Research in Motion Ltd. 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 conditio... | bsd-3-clause |
commshare/testLiveSRS | trunk/objs/CherryPy-3.2.4/cherrypy/test/test_auth_basic.py | 54 | 2853 | # This file is part of CherryPy <http://www.cherrypy.org/>
# -*- coding: utf-8 -*-
# vim:ts=4:sw=4:expandtab:fileencoding=utf-8
import cherrypy
from cherrypy._cpcompat import md5, ntob
from cherrypy.lib import auth_basic
from cherrypy.test import helper
class BasicAuthTest(helper.CPWebCase):
def setup_server():... | mit |
chromium/chromium | third_party/blink/tools/blinkpy/web_tests/port/driver.py | 1 | 30937 | # Copyright (C) 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 ... | bsd-3-clause |
Barrog/C4-Datapack | data/jscript/quests/343_UnderTheShadowOfTheIvoryTower/__init__.py | 1 | 7613 | # Made by mtrix - v0.2 by DrLecter
import sys
from net.sf.l2j.gameserver.model.quest import State
from net.sf.l2j.gameserver.model.quest import QuestState
from net.sf.l2j.gameserver.model.quest.jython import QuestJython as JQuest
ORB = 4364
ECTOPLASM = 4365
ADENA = 57
CHANCE = 65
RANDOM_REWARDS=[[951,1], #Enchant We... | gpl-2.0 |
jumping/Diamond | src/collectors/exim/exim.py | 60 | 1658 | # coding=utf-8
"""
Shells out to get the exim queue length
#### Dependencies
* /usr/sbin/exim
"""
import diamond.collector
import subprocess
import os
from diamond.collector import str_to_bool
class EximCollector(diamond.collector.Collector):
def get_default_config_help(self):
config_help = super(E... | mit |
xodus7/tensorflow | tensorflow/contrib/solvers/python/kernel_tests/util_test.py | 25 | 4551 | # 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 |
npf-ati/linux-2.6-imx | scripts/tracing/draw_functrace.py | 14676 | 3560 | #!/usr/bin/python
"""
Copyright 2008 (c) Frederic Weisbecker <fweisbec@gmail.com>
Licensed under the terms of the GNU GPL License version 2
This script parses a trace provided by the function tracer in
kernel/trace/trace_functions.c
The resulted trace is processed into a tree to produce a more human
view of the call ... | gpl-2.0 |
chadnickbok/npm | node_modules/node-gyp/gyp/pylib/gyp/generator/cmake.py | 1355 | 44604 | # 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.
"""cmake output module
This module is under development and should be considered experimental.
This module produces cmake (2.8.8+) input as its output. One CMake... | artistic-2.0 |
ShineFan/odoo | addons/l10n_be_hr_payroll/__openerp__.py | 312 | 1872 | # -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2011 OpenERP SA (<http://openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the G... | agpl-3.0 |
ofermend/medicare-demo | socialite/jython/Lib/distutils/tests/test_install.py | 155 | 1861 | """Tests for distutils.command.install."""
import os
import unittest
from distutils.command.install import install
from distutils.core import Distribution
from distutils.tests import support
class InstallTestCase(support.TempdirManager, unittest.TestCase):
def test_home_installation_scheme(self):
# Th... | apache-2.0 |
lightning-round/salud-api | app/mod_profiles/models/Permission.py | 3 | 1397 | # -*- coding: utf-8 -*-
from app.mod_shared.models.db import db
class Permission(db.Model):
# Attributes
id = db.Column(db.Integer, primary_key=True)
# Foreign keys
analysis_id = db.Column(db.Integer, db.ForeignKey('analysis.id'))
permission_type_id = db.Column(db.Inte... | gpl-2.0 |
XXMrHyde/android_external_chromium_org | tools/telemetry/telemetry/core/chrome/inspector_page_unittest.py | 29 | 2064 | # 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.
import os
from telemetry.unittest import tab_test_case
unittest_data_dir = os.path.join(os.path.dirname(__file__),
'..'... | bsd-3-clause |
rven/odoo | addons/auth_signup/models/res_config_settings.py | 4 | 1186 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from ast import literal_eval
from odoo import api, fields, models
class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings'
auth_signup_reset_password = fields.Boolean(string='Enable pa... | agpl-3.0 |
kvar/ansible | test/units/modules/network/fortios/test_fortios_switch_controller_custom_command.py | 21 | 8565 | # Copyright 2019 Fortinet, 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 program is distributed in the... | gpl-3.0 |
flavour/helios | modules/s3/s3validators.py | 3 | 69315 | # -*- coding: utf-8 -*-
""" Custom Validators
@requires: U{B{I{gluon}} <http://web2py.com>}
@author: Fran Boon <fran[at]aidiq.com>
@author: Dominic König <dominic[at]aidiq.com>
@author: Michael Howden <michael[at]aidiq.com>
@author: sunneach
@copyright: (c) 2010-2011 Sahana Software Foundati... | mit |
mmiklavc/incubator-metron | metron-deployment/packaging/ambari/metron-mpack/src/main/resources/common-services/METRON/CURRENT/package/scripts/management_ui_master.py | 4 | 3498 | """
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 use this ... | apache-2.0 |
meisterkleister/erpnext | erpnext/setup/page/setup_wizard/test_setup_data.py | 52 | 159337 | from __future__ import unicode_literals
args = {
"attach_letterhead": "erpnext.jpg,data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/4gxYSUNDX1BST0ZJTEUAAQEAAAxITGlubwIQAABtbnRyUkdCIFhZWiAHzgACAAkABgAxAABhY3NwTVNGVAAAAABJRUMgc1JHQgAAAAAAAAAAAAAAAAAA9tYAAQAAAADTLUhQICAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA... | agpl-3.0 |
40223102/2015cd_midterm | static/Brython3.1.1-20150328-091302/Lib/xml/dom/minidom.py | 727 | 66854 | """Simple implementation of the Level 1 DOM.
Namespaces and other minor Level 2 features are also supported.
parse("foo.xml")
parseString("<foo><bar/></foo>")
Todo:
=====
* convenience methods for getting elements and text.
* more testing
* bring some of the writer and linearizer code into conformance with this
... | gpl-3.0 |
meteorfox/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/ycsb.py | 1 | 28681 | # Copyright 2016 PerfKitBenchmarker Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | apache-2.0 |
dfstrauss/textmagic-sms-api-python | textmagic/gsm0338.py | 3 | 5571 | """
Check whether a string consists entirely of characters in the GSM 03.38
character set.
Pass your Unicode or ASCII string to is_gsm() to determine whether all
characters in the string are from the GSM 03.38 character set.
"""
#GSM 03.38 character set mapping to Unicode is specified here:
# http://unicode.org/P... | bsd-3-clause |
jlmadurga/django-oscar | src/oscar/apps/offer/migrations/0001_initial.py | 52 | 15207 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import oscar.models.fields.autoslugfield
from decimal import Decimal
import oscar.models.fields
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('catalogue', ... | bsd-3-clause |
jsoref/django | django/db/backends/postgresql/schema.py | 202 | 4100 | import psycopg2
from django.db.backends.base.schema import BaseDatabaseSchemaEditor
class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
sql_alter_column_type = "ALTER COLUMN %(column)s TYPE %(type)s USING %(column)s::%(type)s"
sql_create_sequence = "CREATE SEQUENCE %(sequence)s"
sql_delete_sequence =... | bsd-3-clause |
erjohnso/ansible | lib/ansible/modules/notification/hipchat.py | 49 | 6387 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# 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',
... | gpl-3.0 |
jcrist/pydy | pydy/viz/shapes.py | 4 | 19419 | #!/usr/bin/env python
__all__ = ['Cube',
'Cylinder',
'Cone',
'Sphere',
'Circle',
'Plane',
'Tetrahedron',
'Octahedron',
'Icosahedron',
'Torus',
'TorusKnot',
'Tube']
import numpy as np
# This is a ... | bsd-3-clause |
vene/ambra | ambra/cross_validation.py | 1 | 9371 | import numbers
import time
import numpy as np
from sklearn.utils import safe_indexing
from sklearn.base import is_classifier, clone
from sklearn.metrics.scorer import check_scoring
from sklearn.externals.joblib import Parallel, delayed, logger
from ambra.backports import _num_samples, indexable
from sklearn.cross_val... | bsd-2-clause |
michaelkirk/QGIS | tests/src/python/test_qgscolorscheme.py | 11 | 3130 | # -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsColorScheme.
.. 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 version.
"""
__... | gpl-2.0 |
kupiakos/pybcd | bcdelement.py | 1 | 3754 |
from common import *
from elements import *
from bcddevice import BCDDevice
class BCDElement:
obj = None
_type = None
_changed = False
_identifier = None
_enum = None
_value = None
fmt = None
def __init__(self, obj, type):
self.obj = obj
self._type = type
... | mit |
ceph/radosgw-agent | radosgw_agent/util/log.py | 1 | 2537 | import logging
import sys
def get_dev_logger(name='dev.radosgw_agent'):
"""
A simple utility to be able to log things that are meant for developer-eyes
and not for user facing.
All developer logs must be prepended with `dev` so this utility ensures
that is the case. To use it::
dev_log =... | mit |
jmccrae/wn-rdf | stresstest.py | 1 | 1210 | import multiprocessing
import sqlite3
import time
import urllib
def do_query(uri):
t1 = time.time()
try:
for line in urllib.urlopen(uri):
pass
print "Got %s in %f" % (uri, time.time() - t1)
except Exception as e:
print "Failed on %s: %s" % (uri, str(e))
if __name__ == ... | bsd-3-clause |
tectronics/mythbox | resources/test/mythboxtest/mythtv/test_domain.py | 5 | 34567 | #
# MythBox for XBMC - http://mythbox.googlecode.com
# Copyright (C) 2011 analogue@yahoo.com
#
# 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 you... | gpl-2.0 |
Pablo126/SSBW | Tarea4/tarea4/lib/python3.5/site-packages/setuptools/namespaces.py | 99 | 3181 | import os
from distutils import log
import itertools
from six.moves import map
flatten = itertools.chain.from_iterable
class Installer:
nspkg_ext = '-nspkg.pth'
def install_namespaces(self):
nsp = self._get_all_ns_packages()
if not nsp:
return
filename, ext = os.path.s... | gpl-3.0 |
jomolinare/kobocat | onadata/apps/main/migrations/0007_replace_special_chars_and_whitespace_in_usernames.py | 13 | 7266 | # encoding: utf-8
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
import re
class Migration(DataMigration):
def forwards(self, orm):
def update_username_for_user(user, match_on, sub_with):
regex = re.compile(match_on)
if regex... | bsd-2-clause |
hpcloud-mon/tempest | tempest/api/compute/servers/test_servers.py | 4 | 5628 | # Copyright 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 requ... | apache-2.0 |
jchevin/MissionPlanner-master | packages/IronPython.StdLib.2.7.4/content/Lib/distutils/command/install_headers.py | 251 | 1346 | """distutils.command.install_headers
Implements the Distutils 'install_headers' command, to install C/C++ header
files to the Python include directory."""
__revision__ = "$Id$"
from distutils.core import Command
# XXX force is never used
class install_headers(Command):
description = "install C/C++ header file... | gpl-3.0 |
acutesoftware/AIKIF | aikif/.z_prototype/create_word_lists.py | 1 | 5833 | # coding: utf-8
# create_word_lists.py written by Duncan Murray 3/2/2014
# creates a simple list of verbs, nouns and adjectives for
# simple 'bag of words' parsing.
# First implementation uses the following dataset:
# WordNet 3.1 Copyright 2011 by Princeton University.
import os
import sys
from xml.dom.minidom ... | gpl-3.0 |
Jet-Streaming/framework | deps/v8/test/simdjs/testcfg.py | 3 | 2290 | # Copyright 2014 the V8 project 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 os
import shutil
import sys
from testrunner.local import testsuite
from testrunner.objects import testcase
SIMDJS_SUITE_PATH = ["data", "src"]
... | mpl-2.0 |
JavML/django | django/middleware/csrf.py | 118 | 9930 | """
Cross Site Request Forgery Middleware.
This module provides a middleware that implements protection
against request forgeries from other sites.
"""
from __future__ import unicode_literals
import logging
import re
from django.conf import settings
from django.core.urlresolvers import get_callable
from django.utils... | bsd-3-clause |
Infinidat/gitpy | gitpy/tag.py | 1 | 1690 | # Copyright (c) 2009, Rotem Yaari <vmalloc@gmail.com>
# 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 li... | bsd-3-clause |
dsully/SoCo | soco/alarms.py | 6 | 11801 | # -*- coding: utf-8 -*-
"""This module contains classes relating to Sonos Alarms."""
from __future__ import unicode_literals
import logging
import re
import weakref
from datetime import datetime
from .core import PLAY_MODES
from .xml import XML
log = logging.getLogger(__name__) # pylint: disable=C0103
TIME_FORMAT... | mit |
phantasien/falkor | deps/bastian/tools/gyp/pylib/gyp/ordered_dict.py | 2354 | 10366 | # Unmodified from http://code.activestate.com/recipes/576693/
# other than to add MIT license header (as specified on page, but not in code).
# Linked from Python documentation here:
# http://docs.python.org/2/library/collections.html#collections.OrderedDict
#
# This should be deleted once Py2.7 is available on all bot... | mit |
sebrandon1/bitcoin | test/functional/test_framework/address.py | 19 | 2850 | #!/usr/bin/env python3
# Copyright (c) 2016-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.
"""Encode and decode BASE58, P2PKH and P2SH addresses."""
from .script import hash256, hash160, sha256, C... | mit |
awkspace/ansible | test/units/modules/storage/netapp/test_na_ontap_unix_user.py | 43 | 11306 | # (c) 2018, NetApp, Inc
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
''' unit test template for ONTAP Ansible module '''
from __future__ import print_function
import json
import pytest
from units.compat import unittest
from units.compat.mock import patch, Mock
from ans... | gpl-3.0 |
shish/sdog | sdog/monitor.py | 1 | 4065 | #!/usr/bin/env python
import socket
import os
import subprocess
from optparse import OptionParser
from time import time, sleep
from select import select
import sys
try:
from setproctitle import setproctitle
except ImportError:
def setproctitle(title):
pass
def main(argv=sys.argv):
parser = Optio... | mit |
40223105/2015cd_midterm | static/Brython3.1.1-20150328-091302/Lib/reprlib.py | 923 | 5110 | """Redo the builtin repr() (representation) but with limits on most sizes."""
__all__ = ["Repr", "repr", "recursive_repr"]
import builtins
from itertools import islice
try:
from _thread import get_ident
except ImportError:
from _dummy_thread import get_ident
def recursive_repr(fillvalue='...'):
'Decorato... | gpl-3.0 |
rakeshmi/cinder | cinder/tests/unit/test_replication.py | 5 | 5069 | # Copyright 2014 IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed t... | apache-2.0 |
benfinke/ns_python | build/lib/nssrc/com/citrix/netscaler/nitro/resource/stat/system/system_stats.py | 3 | 18080 | #
# Copyright (c) 2008-2015 Citrix Systems, 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 l... | apache-2.0 |
yannrouillard/weboob | weboob/applications/boobill/boobill.py | 2 | 8189 | # -*- coding: utf-8 -*-
# Copyright(C) 2012-2013 Florent Fourcot
#
# This file is part of weboob.
#
# weboob 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, or
# (at yo... | agpl-3.0 |
bgxavier/nova | nova/tests/unit/virt/test_events.py | 113 | 1178 | # 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 writing, softw... | apache-2.0 |
chenjun0210/tensorflow | tensorflow/python/kernel_tests/slice_op_test.py | 48 | 11026 | # Copyright 2015 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 |
youssef-emad/shogun | examples/undocumented/python_modular/classifier_multiclass_ecoc.py | 24 | 2869 | #!/usr/bin/env python
import re
import time
from tools.multiclass_shared import prepare_data
# run with toy data
[traindat, label_traindat, testdat, label_testdat] = prepare_data()
# run with opt-digits if available
#[traindat, label_traindat, testdat, label_testdat] = prepare_data(False)
parameter_list = [[traindat,... | gpl-3.0 |
Phonebooth/depot_tools | third_party/coverage/results.py | 49 | 10023 | """Results of coverage measurement."""
import os
from coverage.backward import iitems, set, sorted # pylint: disable=W0622
from coverage.misc import format_lines, join_regex, NoSource
from coverage.parser import CodeParser
class Analysis(object):
"""The results of analyzing a code unit."""
def __init... | bsd-3-clause |
Telthor/cppDonorSimulation | donorTests/lib/googletest-master/googletest/test/gtest_filter_unittest.py | 364 | 21325 | #!/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... | mit |
sodafree/backend | build/lib.linux-i686-2.7/django/conf/locale/sl/formats.py | 257 | 1834 | # -*- encoding: utf-8 -*-
# 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 = 'd. F Y'
TIME_FORMAT = 'H:i:s'
DATETIME_FORMAT = 'j. F Y. H:i'
YEAR_MONTH_... | bsd-3-clause |
stansonhealth/ansible-modules-core | cloud/openstack/_nova_keypair.py | 41 | 5486 | #!/usr/bin/python
#coding: utf-8 -*-
# (c) 2013, Benno Joy <benno@ansible.com>
# (c) 2013, John Dewey <john@dewey.ws>
#
# This module 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 Li... | gpl-3.0 |
drmrd/ansible | lib/ansible/modules/cloud/google/gcp_healthcheck.py | 48 | 15302 | #!/usr/bin/python
# Copyright 2017 Google 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',
'status': ['preview'],
... | gpl-3.0 |
Dino0631/RedRain-Bot | lib/pip/_vendor/requests/packages/urllib3/exceptions.py | 515 | 5599 | from __future__ import absolute_import
# Base Exceptions
class HTTPError(Exception):
"Base exception used by this module."
pass
class HTTPWarning(Warning):
"Base warning used by this module."
pass
class PoolError(HTTPError):
"Base exception for errors caused within a pool."
def __init__(se... | gpl-3.0 |
40423106/2016fallcadp_ag4 | publishconf.py | 251 | 1705 | #!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
# This file is only used if you use `make publish` or
# explicitly specify it as your config file.
import os
import sys
sys.path.append(os.curdir)
from pelicanconf import *
# 因為 publishconf.py 在 pelicanconf.py 之後, 因此若兩處有相同變數的設定, ... | agpl-3.0 |
citrix-openstack-build/swift | swift/container/sync.py | 2 | 19536 | # Copyright (c) 2010-2012 OpenStack, 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 ... | apache-2.0 |
scieloorg/scielo-manager | scielomanager/editorialmanager/notifications.py | 3 | 3509 | # coding: utf-8
import logging
from django.core.exceptions import ObjectDoesNotExist
from scielomanager.tools import get_users_by_group_by_collections, user_receive_emails
from scielomanager import notifications
logger = logging.getLogger(__name__)
class IssueBoardMessage(notifications.Message):
EMAIL_DATA_BY... | bsd-2-clause |
online-behaviour/machine-learning | getTweetText.py | 1 | 1768 | #!/usr/bin/python3 -W all
"""
getTweetText.py: extract tweet text from json file
usage: getTweetText.py < file
20170418 erikt(at)xs4all.nl
"""
import csv
import json
import re
import sys
# command name for error messages
COMMAND = sys.argv[0]
patternNewline = re.compile("\n")
# open csv output
with sys.s... | apache-2.0 |
jlegendary/scikit-learn | sklearn/decomposition/tests/test_dict_learning.py | 47 | 8095 | import numpy as np
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_less
from sklearn.utils.testing import assert_raises
... | bsd-3-clause |
kiritoe/pokeapi | data/v2/build.py | 7 | 51228 | # To build out the data you'll need to jump into the Django shell
#
# $ python manage.py shell
#
# and run the build script with
#
# $ execfile('data/v2/build.py')
#
# Each time the build script is run it will iterate over each table in the database,
# wipe it and rewrite each row using the data found in da... | bsd-3-clause |
valexandersaulys/prudential_insurance_kaggle | venv/lib/python2.7/site-packages/scipy/interpolate/tests/test_ndgriddata.py | 63 | 5962 | from __future__ import division, print_function, absolute_import
import numpy as np
from numpy.testing import assert_equal, assert_array_equal, assert_allclose, \
run_module_suite, assert_raises
from scipy.interpolate import griddata
class TestGriddata(object):
def test_fill_value(self):
x = [(0... | gpl-2.0 |
pyload/pyload | src/pyload/plugins/downloaders/SpeedyshareCom.py | 2 | 1461 | # -*- coding: utf-8 -*-
#
# Test links:
# http://speedy.sh/ep2qY/Zapp-Brannigan.jpg
import re
from ..base.simple_downloader import SimpleDownloader
class SpeedyshareCom(SimpleDownloader):
__name__ = "SpeedyshareCom"
__type__ = "downloader"
__version__ = "0.11"
__status__ = "testing"
__pattern_... | agpl-3.0 |
knowmetools/km-api | km_api/know_me/migrations/0006_subscription.py | 1 | 2495 | # Generated by Django 2.0.6 on 2018-10-20 23:41
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import permission_utils.model_mixins
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL... | apache-2.0 |
yawnosnorous/python-for-android | python-modules/twisted/twisted/web/test/test_distrib.py | 52 | 12485 | # Copyright (c) 2008-2010 Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for L{twisted.web.distrib}.
"""
from os.path import abspath
from xml.dom.minidom import parseString
try:
import pwd
except ImportError:
pwd = None
from zope.interface.verify import verifyObject
from twisted.python im... | apache-2.0 |
ZHAW-INES/rioxo-uClinux-dist | user/python/python-2.4.4/Lib/hotshot/stats.py | 252 | 2582 | """Statistics analyzer for HotShot."""
import profile
import pstats
import hotshot.log
from hotshot.log import ENTER, EXIT
def load(filename):
return StatsLoader(filename).load()
class StatsLoader:
def __init__(self, logfn):
self._logfn = logfn
self._code = {}
self._stack = []
... | gpl-2.0 |
mrksu/flac2m | src/paths.py | 1 | 4790 | #!/usr/bin/env python3
from typing import List, Tuple
import os
from common import error_exit
MusicDir = Tuple[str, List[str]] # A tuple of dir name and all of its files
MusicMap = List[MusicDir] # List of dirs containing music
def find_music(roots: List[str]) -> MusicMap:
music_dirs = []
for ... | gpl-3.0 |
julienbou/heroku-buildpack-serpan | vendor/pip-1.3.1/pip/vcs/subversion.py | 63 | 10620 | import os
import re
from pip.backwardcompat import urlparse
from pip import InstallationError
from pip.index import Link
from pip.util import rmtree, display_path, call_subprocess
from pip.log import logger
from pip.vcs import vcs, VersionControl
_svn_xml_url_re = re.compile('url="([^"]+)"')
_svn_rev_re = re.compile('... | mit |
opensourcechipspark/platform_external_chromium_org | third_party/tlslite/tlslite/utils/PyCrypto_RSAKey.py | 361 | 1814 | """PyCrypto RSA implementation."""
from cryptomath import *
from RSAKey import *
from Python_RSAKey import Python_RSAKey
if pycryptoLoaded:
from Crypto.PublicKey import RSA
class PyCrypto_RSAKey(RSAKey):
def __init__(self, n=0, e=0, d=0, p=0, q=0, dP=0, dQ=0, qInv=0):
if not d:
... | bsd-3-clause |
freedesktop-unofficial-mirror/telepathy__telepathy-idle | tests/twisted/servicetest.py | 2 | 21869 |
"""
Infrastructure code for testing connection managers.
"""
from twisted.internet import glib2reactor
from twisted.internet.protocol import Protocol, Factory, ClientFactory
glib2reactor.install()
import sys
import time
import os
import pprint
import unittest
import dbus
from dbus.mainloop.glib import DBusGMainLoop... | lgpl-2.1 |
ammarkhann/FinalSeniorCode | lib/python2.7/site-packages/requests/packages/chardet/mbcharsetprober.py | 2924 | 3268 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is Mozilla Universal charset detector code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 2001
# the Initial Developer. All R... | mit |
Ryex/airtime | python_apps/media-monitor/mm2/tests/test_owners.py | 12 | 1265 | # -*- coding: utf-8 -*-
import unittest
from media.monitor import owners
class TestMMP(unittest.TestCase):
def setUp(self):
self.f = "test.mp3"
def test_has_owner(self):
owners.reset_owners()
o = 12345
self.assertTrue( owners.add_file_owner(self.f,o) )
self.assertTrue( ... | agpl-3.0 |
fnp/wolnelektury | src/social/models.py | 1 | 6767 | # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
from random import randint
from django.db import models
from django.conf import settings
from django.core.exceptions import ValidationError
from django.urls import ... | agpl-3.0 |
glouppe/scikit-learn | examples/model_selection/plot_roc.py | 49 | 5041 | """
=======================================
Receiver Operating Characteristic (ROC)
=======================================
Example of Receiver Operating Characteristic (ROC) metric to evaluate
classifier output quality.
ROC curves typically feature true positive rate on the Y axis, and false
positive rate on the X a... | bsd-3-clause |
MenZil/kuma | vendor/packages/nose/commands.py | 68 | 6310 | """
nosetests setuptools command
----------------------------
The easiest way to run tests with nose is to use the `nosetests` setuptools
command::
python setup.py nosetests
This command has one *major* benefit over the standard `test` command: *all
nose plugins are supported*.
To configure the `nosetests` comman... | mpl-2.0 |
blackzw/openwrt_sdk_dev1 | staging_dir/target-mips_r2_uClibc-0.9.33.2/usr/lib/python2.7/unittest/loader.py | 152 | 13420 | """Loading unittests."""
import os
import re
import sys
import traceback
import types
from functools import cmp_to_key as _CmpToKey
from fnmatch import fnmatch
from . import case, suite
__unittest = True
# what about .pyc or .pyo (etc)
# we would need to avoid loading the same tests multiple times
# from '.py', '.... | gpl-2.0 |
square/pants | src/python/pants/backend/python/tasks/python_binary_create.py | 2 | 2193 | # coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (nested_scopes, generators, division, absolute_import, with_statement,
print_function, unicode_literals)
import os
import tim... | apache-2.0 |
da1z/intellij-community | python/testData/inspections/PyStringFormatInspection/UnionCallType.py | 8 | 1566 | from collections import namedtuple
def simple_func(cond):
if cond:
return 1
else:
return 1, 2
Point = namedtuple('Point', ['x', 'y'])
def named_tuple_func(cond):
if cond:
return 1
else:
return Point(1, 1)
def primitive_types_func(cond):
if cond:
return 1
... | apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.