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 |
|---|---|---|---|---|---|
Zhongqilong/kbengine | kbe/res/scripts/common/Lib/site-packages/pip/_vendor/requests/packages/urllib3/fields.py | 294 | 5976 | # urllib3/fields.py
# Copyright 2008-2013 Andrey Petrov and contributors (see CONTRIBUTORS.txt)
#
# This module is part of urllib3 and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
import email.utils
import mimetypes
from .packages import six
def guess_content_type(filename... | lgpl-3.0 |
tarzan0820/odoo | addons/stock/res_config.py | 200 | 8133 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (C) 2004-2012 OpenERP S.A. (<http://openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms o... | agpl-3.0 |
ahmadRagheb/goldenHR | erpnext/manufacturing/doctype/workstation/workstation.py | 34 | 3885 | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import flt, cint, getdate, formatdate, comma_and, time_diff_in_seconds, to_timedelta
from frappe.mo... | gpl-3.0 |
proxysh/Safejumper-for-Mac | buildlinux/env64/lib/python2.7/site-packages/twisted/trial/test/skipping.py | 59 | 5356 | # -*- test-case-name: twisted.trial.test.test_tests -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Definitions of test cases with various interesting behaviors, to be used by
L{twisted.trial.test.test_tests} and other test modules to exercise different
features of trial's test runner.
... | gpl-2.0 |
billy-wang/T11 | tools/perf/tests/attr.py | 3174 | 9441 | #! /usr/bin/python
import os
import sys
import glob
import optparse
import tempfile
import logging
import shutil
import ConfigParser
class Fail(Exception):
def __init__(self, test, msg):
self.msg = msg
self.test = test
def getMsg(self):
return '\'%s\' - %s' % (self.test.path, self.msg)... | gpl-2.0 |
zenith0/foodroller | foodroller/migrations/0001_initial.py | 1 | 3326 | # -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-05-03 16:51
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateM... | apache-2.0 |
gogobook/wagtail | wagtail/wagtailcore/migrations/0001_initial.py | 2 | 7534 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
import wagtail.wagtailsearch.index
def set_page_path_collation(apps, schema_editor):
"""
Treebeard's path comparison logic can fail on certain locales such as sk_SK, which... | bsd-3-clause |
zulip/zulip | scripts/lib/clean_venv_cache.py | 3 | 1954 | #!/usr/bin/env python3
import argparse
import glob
import os
import sys
from typing import Set
ZULIP_PATH = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
sys.path.append(ZULIP_PATH)
from scripts.lib.hash_reqs import expand_reqs, hash_deps
from scripts.lib.zulip_tools import (
get_env... | apache-2.0 |
jiangzhuo/kbengine | kbe/src/lib/python/Lib/test/test_kqueue.py | 72 | 7619 | """
Tests for kqueue wrapper.
"""
import errno
import os
import select
import socket
import sys
import time
import unittest
from test import support
if not hasattr(select, "kqueue"):
raise unittest.SkipTest("test works only on BSD")
class TestKQueue(unittest.TestCase):
def test_create_queue(self):
kq ... | lgpl-3.0 |
DanielSBrown/osf.io | api/applications/serializers.py | 10 | 3981 | from django.core.validators import URLValidator
from rest_framework import serializers as ser
from modularodm import Q
from website.models import ApiOAuth2Application
from api.base.serializers import JSONAPISerializer, LinksField, IDField, TypeField
from api.base.utils import absolute_reverse
class ApiOAuthApplica... | apache-2.0 |
CollabQ/CollabQ | .google_appengine/lib/django/django/contrib/admin/urls.py | 33 | 2246 | from django.conf import settings
from django.conf.urls.defaults import *
if settings.USE_I18N:
i18n_view = 'django.views.i18n.javascript_catalog'
else:
i18n_view = 'django.views.i18n.null_javascript_catalog'
urlpatterns = patterns('',
('^$', 'django.contrib.admin.views.main.index'),
('^r/(\d+)/(.*)/$'... | apache-2.0 |
icaics/QQBot-Msg-Handler | plugins/IMocca.py | 1 | 3030 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from Define import Global
from Define import IMocca
from Define import Utility
# from qqbot import qqbotsched
def onQQMessage(bot, contact, member, content):
""" QQBot 全局调用入口 """
# print(bot)
# print(contact)
# print(member)
# print(content)
... | mit |
hortonworks/hortonworks-sandbox | desktop/core/ext-py/Twisted/twisted/test/test_banana.py | 2 | 9535 | # Copyright (c) 2001-2007 Twisted Matrix Laboratories.
# See LICENSE for details.
import StringIO
import sys
# Twisted Imports
from twisted.trial import unittest
from twisted.spread import banana
from twisted.python import failure
from twisted.internet import protocol, main
class MathTestCase(unittest.TestCase):
... | apache-2.0 |
andyraib/data-storage | python_scripts/env/lib/python3.6/site-packages/pandas/tests/test_take.py | 8 | 19159 | # -*- coding: utf-8 -*-
import re
from datetime import datetime
import nose
import numpy as np
from pandas.compat import long
import pandas.core.algorithms as algos
import pandas.util.testing as tm
from pandas.tslib import iNaT
_multiprocess_can_split_ = True
class TestTake(tm.TestCase):
# standard incompatible... | apache-2.0 |
great-expectations/great_expectations | contrib/experimental/great_expectations_experimental/expectations/expect_column_values_to_not_be_outliers.py | 1 | 14239 | import json
from scipy import stats
# !!! This giant block of imports should be something simpler, such as:
# from great_exepectations.helpers.expectation_creation import *
from great_expectations.execution_engine import (
PandasExecutionEngine,
SparkDFExecutionEngine,
SqlAlchemyExecutionEngine,
)
from gr... | apache-2.0 |
dannyperry571/theapprentice | script.module.buggalo/lib/buggalo_gui.py | 4 | 4695 | #
# Copyright (C) 2013 Tommy Winther
# http://tommy.winther.nu
#
# 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, or (at your option)
# any later version.
#
# Thi... | gpl-2.0 |
ephes/scikit-learn | sklearn/metrics/tests/test_regression.py | 272 | 6066 | from __future__ import division, print_function
import numpy as np
from itertools import product
from sklearn.utils.testing import assert_raises
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.... | bsd-3-clause |
bsmedberg/socorro | socorro/unittest/app/test_generic_fetch_transform_save_app.py | 4 | 10840 | # 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/.
from nose.tools import eq_, ok_, assert_raises
from socorro.app.fetch_transform_save_app import FetchTransformSaveApp
f... | mpl-2.0 |
AOKP/external_chromium_org | third_party/gtk+/gtk/compose-parse.py | 149 | 34346 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# compose-parse.py, version 1.3
#
# multifunction script that helps manage the compose sequence table in GTK+ (gtk/gtkimcontextsimple.c)
# the script produces statistics and information about the whole process, run with --help for more.
#
# You may need to switch your pyt... | bsd-3-clause |
patcon/open-cabinet | venv/lib/python2.7/site-packages/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 =... | mit |
uwdata/termite-data-server | web2py/gluon/compileapp.py | 9 | 27954 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
| This file is part of the web2py Web Framework
| Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>
| License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
Functions required to execute app components
---------------------------------------------
Note:
... | bsd-3-clause |
beepscore/google-python-exercises | basic/string1.py | 1 | 4031 | #!/usr/bin/python -tt
# -tt throws error if tabs are mixed with spaces
# http://stackoverflow.com/questions/9050331/what-does-it-mean-in-linux-scripts-usr-bin-python-tt
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
#... | apache-2.0 |
miguelgrinberg/oreilly-intro-to-flask-video | 6b/login.py | 1 | 2697 | from werkzeug.security import generate_password_hash, check_password_hash
from flask import Flask, render_template, redirect, url_for, request
from flask.ext.bootstrap import Bootstrap
from flask.ext.wtf import Form
from wtforms import StringField, PasswordField, BooleanField, SubmitField
from wtforms.validators import... | mit |
andymckay/addons-server | src/olympia/devhub/tests/test_tasks.py | 2 | 27628 | import json
import os
import shutil
import tempfile
from contextlib import contextmanager
from datetime import datetime, timedelta
from decimal import Decimal
from django.conf import settings
from django.test.utils import override_settings
import mock
import pytest
from PIL import Image
from olympia import amo
from ... | bsd-3-clause |
TheSooth/WinObjC | deps/3rdparty/iculegacy/source/tools/icu-svnprops-check.py | 388 | 9251 | #! /usr/bin/python
# Copyright (C) 2009-2011, International Business Machines Corporation, Google and Others.
# All rights reserved.
#
# Script to check and fix svn property settings for ICU source files.
# Also check for the correct line endings on files with svn:eol-style = native
#
# THIS SCRIPT DOES NOT WORK O... | mit |
kytvi2p/Sigil | 3rdparty/python/Lib/idlelib/textView.py | 76 | 3225 | """Simple text browser for IDLE
"""
from tkinter import *
import tkinter.messagebox as tkMessageBox
class TextViewer(Toplevel):
"""A simple text viewer dialog for IDLE
"""
def __init__(self, parent, title, text, modal=True, _htest=False):
"""Show the given text in a scrollable window with a 'clo... | gpl-3.0 |
Alphadelta14/ansible | test/units/plugins/connections/test_connection.py | 86 | 3988 | # (c) 2015, Toshio Kuratomi <tkuratomi@ansible.com>
#
# 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... | gpl-3.0 |
chauffer/pyamazonclouddrive | bin/acdmkdir.py | 10 | 4824 | #!/usr/bin/env python
#
# Copyright (c) 2011 anatanokeitai.com(sakurai_youhei)
#
# 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 right... | mit |
poiati/django | django/contrib/gis/measure.py | 344 | 12272 | # Copyright (c) 2007, Robert Coup <robert.coup@onetrackmind.co.nz>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
#... | bsd-3-clause |
rohitsaboo/bazel | tools/build_defs/docker/create_image.py | 5 | 4449 | # Copyright 2015 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 |
ramcn/demo3 | venv/lib/python3.4/site-packages/django/contrib/gis/db/models/query.py | 56 | 36394 | import warnings
from django.contrib.gis.db.models import aggregates
from django.contrib.gis.db.models.fields import (
GeometryField, LineStringField, PointField, get_srid_info,
)
from django.contrib.gis.db.models.lookups import GISLookup
from django.contrib.gis.db.models.sql import (
AreaField, DistanceField, ... | mit |
bioinformatics-ua/catalogue | emif/developer/migrations/0005_auto__add_field_pluginversion_create_date__add_field_pluginversion_lat.py | 2 | 6257 | # -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'PluginVersion.create_date'
db.add_column('developer_plugi... | gpl-3.0 |
ad-uistyleguide/ad-uistyleguide.github.io | node_modules/gulp-sass/node_modules/node-sass/node_modules/pangyp/gyp/pylib/gyp/input_test.py | 604 | 3207 | #!/usr/bin/env python
# Copyright 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.
"""Unit tests for the input.py file."""
import gyp.input
import unittest
import sys
class TestFindCycles(unittest.TestCase):
def setUp(self... | mit |
rahul-c1/scikit-learn | sklearn/feature_selection/tests/test_base.py | 170 | 3666 | import numpy as np
from scipy import sparse as sp
from nose.tools import assert_raises, assert_equal
from numpy.testing import assert_array_equal
from sklearn.base import BaseEstimator
from sklearn.feature_selection.base import SelectorMixin
from sklearn.utils import check_array
class StepSelector(SelectorMixin, Ba... | bsd-3-clause |
natalieschauser/csp_media_wiki | extensions/ConfirmEdit/captcha.py | 47 | 7848 | #!/usr/bin/python
#
# Script to generate distorted text images for a captcha system.
#
# Copyright (C) 2005 Neil Harris
#
# 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 ... | gpl-2.0 |
h2oloopan/easymerge | EasyMerge/tests/scrapy/scrapy/utils/defer.py | 33 | 3241 | """
Helper functions for dealing with Twisted deferreds
"""
from twisted.internet import defer, reactor, task
from twisted.python import failure
from scrapy.exceptions import IgnoreRequest
def defer_fail(_failure):
"""Same as twisted.internet.defer.fail, but delay calling errback until
next reactor loop
... | mit |
mikewadsten/asuswrt | release/src/router/libxml2/check-xsddata-test-suite.py | 343 | 10682 | #!/usr/bin/python
import sys
import time
import os
import string
import StringIO
sys.path.insert(0, "python")
import libxml2
# Memory debug specific
libxml2.debugMemory(1)
debug = 0
verbose = 0
quiet = 1
#
# the testsuite description
#
CONF=os.path.join(os.path.dirname(__file__), "test/xsdtest/xsdtestsuite.xml")
LOG=... | gpl-2.0 |
anamud/mir-dev | scripts/helpers/result-parse.py | 1 | 3317 | #!/usr/bin/python
import sys
import re
import operator
#import csv
from collections import defaultdict
scenario = {'worker':-1, 'schedule':'none', 'allocation':'none', 'time':0.0}
scenarios = []
def fast_unique(seq):
seen = set()
seen_add = seen.add
return [ x for x in seq if x not in seen and not seen_a... | apache-2.0 |
ARM-software/bob-build | tests/static_libs/check_link_order.py | 1 | 2680 | #!/usr/bin/env python
# Copyright 2018, 2020 Arm Limited.
# SPDX-License-Identifier: Apache-2.0
#
# 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... | apache-2.0 |
zhjunlang/kbengine | kbe/res/scripts/common/Lib/test/test_weakset.py | 86 | 15546 | import unittest
from test import support
from weakref import proxy, ref, WeakSet
import operator
import copy
import string
import os
from random import randrange, shuffle
import sys
import warnings
import collections
from collections import UserString as ustr
import gc
import contextlib
class Foo:
pass
class Ref... | lgpl-3.0 |
Innovahn/cybex | addons/point_of_sale/wizard/__init__.py | 382 | 1200 | # -*- 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... | agpl-3.0 |
ltilve/chromium | native_client_sdk/src/tools/tests/nacl_config_test.py | 13 | 5102 | #!/usr/bin/env python
# Copyright 2013 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
import sys
import unittest
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
TOOLS_DIR = os.path.dirname(SCRIPT_DIR)
C... | bsd-3-clause |
flwh/KK_mt6589_iq451 | prebuilts/python/linux-x86/2.7.5/lib/python2.7/test/test_future_builtins.py | 136 | 1318 | import test.test_support, unittest
# we're testing the behavior of these future builtins:
from future_builtins import hex, oct, map, zip, filter
class BuiltinTest(unittest.TestCase):
def test_hex(self):
self.assertEqual(hex(0), '0x0')
self.assertEqual(hex(16), '0x10')
self.assertEqual(hex(... | gpl-2.0 |
simplyguru-dot/ansible-modules-extras | cloud/cloudstack/cs_securitygroup.py | 24 | 5616 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# (c) 2015, René Moser <mail@renemoser.net>
#
# 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 Lice... | gpl-3.0 |
langit/pymprog | models/+lotsp.py | 1 | 1386 | import csv
#dm = (
#( 0,86,49,57,31,69,50),
#(86, 0,68,79,93,24, 5),
#(49,68, 0,16, 7,72,67),
#(57,79,16, 0,90,69, 1),
#(31,93, 7,90, 0,86,59),
#(69,24,72,69,86, 0,81),
#(50, 5,67, 1,59,81, 0))
dists = csv.reader(open('capdist.csv'), 'excel')
dm = [[int(k) for k in t[2:33]]
for t in dists if t[1]]
... | gpl-3.0 |
pschmitt/home-assistant | homeassistant/components/demo/air_quality.py | 21 | 1585 | """Demo platform that offers fake air quality data."""
from homeassistant.components.air_quality import AirQualityEntity
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up the Air Quality."""
async_add_entities(
[DemoAirQuality("Home", 14, 23, 100), DemoAi... | apache-2.0 |
kevclarx/ansible | lib/ansible/modules/network/junos/junos_package.py | 15 | 6497 | #!/usr/bin/python
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distribut... | gpl-3.0 |
sdague/home-assistant | tests/components/broadlink/__init__.py | 6 | 3650 | """Tests for the Broadlink integration."""
from homeassistant.components.broadlink.const import DOMAIN
from tests.async_mock import MagicMock, patch
from tests.common import MockConfigEntry
# Do not edit/remove. Adding is ok.
BROADLINK_DEVICES = {
"Entrance": (
"192.168.0.11",
"34ea34befc25",
... | apache-2.0 |
jeremiahyan/odoo | addons/stock/models/stock_storage_category.py | 1 | 3802 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import _, api, fields, models
class StorageCategory(models.Model):
_name = 'stock.storage.category'
_description = "Storage Category"
_order = "name"
name = fields.Char('Storage Category', re... | gpl-3.0 |
emersonsoftware/ansiblefork | lib/ansible/modules/packaging/os/package.py | 47 | 2256 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2015, 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 o... | gpl-3.0 |
Godiyos/python-for-android | python3-alpha/python3-src/Lib/lib2to3/fixes/fix_ws_comma.py | 204 | 1090 | """Fixer that changes 'a ,b' into 'a, b'.
This also changes '{a :b}' into '{a: b}', but does not touch other
uses of colons. It does not touch other uses of whitespace.
"""
from .. import pytree
from ..pgen2 import token
from .. import fixer_base
class FixWsComma(fixer_base.BaseFix):
explicit = True # The use... | apache-2.0 |
iostackproject/IO-Bandwidth-Differentiation-Client | swiftclient/shell.py | 1 | 58675 | #!/usr/bin/python -u
# 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 applica... | apache-2.0 |
petermat/phantomjs | src/qt/qtwebkit/Tools/TestResultServer/model/testfile.py | 129 | 3795 | # Copyright (C) 2010 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 |
aspidites/django | tests/postgres_tests/test_aggregates.py | 307 | 11910 | from django.contrib.postgres.aggregates import (
ArrayAgg, BitAnd, BitOr, BoolAnd, BoolOr, Corr, CovarPop, RegrAvgX,
RegrAvgY, RegrCount, RegrIntercept, RegrR2, RegrSlope, RegrSXX, RegrSXY,
RegrSYY, StatAggregate, StringAgg,
)
from django.db.models.expressions import F, Value
from django.test.utils import A... | bsd-3-clause |
robin-lai/scikit-learn | examples/cluster/plot_affinity_propagation.py | 349 | 2304 | """
=================================================
Demo of affinity propagation clustering algorithm
=================================================
Reference:
Brendan J. Frey and Delbert Dueck, "Clustering by Passing Messages
Between Data Points", Science Feb. 2007
"""
print(__doc__)
from sklearn.cluster impor... | bsd-3-clause |
creativcoder/servo | tests/wpt/web-platform-tests/tools/py/testing/io_/test_saferepr.py | 162 | 2388 | # -*- coding: utf-8 -*-
from __future__ import generators
import py
import sys
saferepr = py.io.saferepr
class TestSafeRepr:
def test_simple_repr(self):
assert saferepr(1) == '1'
assert saferepr(None) == 'None'
def test_maxsize(self):
s = saferepr('x'*50, maxsize=25)
assert l... | mpl-2.0 |
fmaguire/ete | sdoc/old_tutorial/examples/get_trees_from_phylomeDB.py | 5 | 2114 | from ete3 import PhylomeDBConnector
# This connects to the main phylomeDB server (default parameters)
p = PhylomeDBConnector()
# Obtains the phylomeDB internal ID for my gene of interest
idmatches = p.search_id("ENSG00000146556")
# Take the only match (several would be possible)
geneid = idmatches[0]
# Gets the 'geneid... | gpl-3.0 |
jmacmahon/invenio | modules/webaccess/lib/external_authentication_oauth1.py | 3 | 8832 | # -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2012 CERN.
#
# Invenio is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later... | gpl-2.0 |
hostmaster/ansible-modules-extras | monitoring/zabbix_group.py | 26 | 6520 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2014, René Moser <mail@renemoser.net>
#
# 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 Licen... | gpl-3.0 |
xxshutong/openerp-7.0 | openerp/addons/sale_crm/__openerp__.py | 54 | 2229 | # -*- 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 |
kechie/python_koans | python3/koans/about_control_statements.py | 56 | 2178 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
class AboutControlStatements(Koan):
def test_if_then_else_statements(self):
if True:
result = 'true value'
else:
result = 'false value'
self.assertEqual(__, result)
def test_if_then_statem... | mit |
qnib/QNIBCollect | src/diamond/collectors/httpd/httpd.py | 7 | 7782 | # coding=utf-8
"""
Collect stats from Apache HTTPD server using mod_status
#### Dependencies
* mod_status
* httplib
* urlparse
"""
import collections
import re
import httplib
import urlparse
import diamond.collector
from subprocess import Popen, PIPE
class HttpdCollector(diamond.collector.Collector):
de... | apache-2.0 |
luxnovalabs/enjigo_door | web_interface/django/utils/functional.py | 79 | 14702 | import copy
import operator
from functools import wraps, update_wrapper
import sys
from django.utils import six
from django.utils.six.moves import copyreg
# You can't trivially replace this `functools.partial` because this binds to
# classes and returns bound instances, whereas functools.partial (on CPython)
# is a ... | unlicense |
bmess/scrapy | scrapy/core/downloader/handlers/ftp.py | 130 | 4134 | """
An asynchronous FTP file download handler for scrapy which somehow emulates an http response.
FTP connection parameters are passed using the request meta field:
- ftp_user (required)
- ftp_password (required)
- ftp_passive (by default, enabled) sets FTP connection passive mode
- ftp_local_filename
- If not... | bsd-3-clause |
TRox1972/youtube-dl | youtube_dl/extractor/globo.py | 49 | 22115 | # coding: utf-8
from __future__ import unicode_literals
import random
import re
import math
from .common import InfoExtractor
from ..compat import (
compat_str,
compat_chr,
compat_ord,
)
from ..utils import (
ExtractorError,
float_or_none,
int_or_none,
orderedSet,
str_or_none,
)
clas... | unlicense |
Limags/MissionPlanner | Lib/lib2to3/fixes/fix_raise.py | 61 | 3024 | """Fixer for 'raise E, V, T'
raise -> raise
raise E -> raise E
raise E, V -> raise E(V)
raise E, V, T -> raise E(V).with_traceback(T)
raise E, None, T -> raise E.with_traceback(T)
raise (((E, E'), E''), E'''), V -> raise E(V)
raise "foo", V, T -> warns about string exceptions
... | gpl-3.0 |
pknight007/electrum-vtc | plugins/trezor/plugin.py | 2 | 16728 | import base64
import re
import threading
from binascii import hexlify, unhexlify
from functools import partial
from electrum_vtc.bitcoin import (bc_address_to_hash_160, xpub_from_pubkey,
public_key_to_p2pkh, EncodeBase58Check,
TYPE_ADDRESS, TYPE_SCRIPT,
... | mit |
Erotemic/ibeis | ibeis/control/manual_lblannot_funcs.py | 1 | 17156 | # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
import uuid
from six.moves import range
from ibeis import constants as const
from ibeis.other import ibsfuncs
from ibeis.control.accessor_decors import (
adder, deleter, setter, getter_1to1, getter_1toM, default_decorator, ider... | apache-2.0 |
tealover/nova | nova/api/openstack/compute/contrib/createserverext.py | 100 | 1156 | # Copyright 2011 OpenStack Foundation
#
# 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 ... | apache-2.0 |
beni55/networkx | networkx/algorithms/tree/branchings.py | 14 | 25243 | # encoding: utf-8
"""
Algorithms for finding optimum branchings and spanning arborescences.
This implementation is based on:
J. Edmonds, Optimum branchings, J. Res. Natl. Bur. Standards 71B (1967),
233–240. URL: http://archive.org/details/jresv71Bn4p233
"""
# TODO: Implement method from Gabow, Galil, Spence ... | bsd-3-clause |
rentongzhang/servo | tests/wpt/css-tests/tools/pywebsocket/src/mod_pywebsocket/handshake/__init__.py | 658 | 4406 | # 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 |
rbauduin/mptcp | tools/perf/scripts/python/syscall-counts-by-pid.py | 11180 | 1927 | # system call counts, by pid
# (c) 2010, Tom Zanussi <tzanussi@gmail.com>
# Licensed under the terms of the GNU GPL License version 2
#
# Displays system-wide system call totals, broken down by syscall.
# If a [comm] arg is specified, only syscalls called by [comm] are displayed.
import os, sys
sys.path.append(os.env... | gpl-2.0 |
wushuyi/quokka | quokka/ext/blueprints.py | 12 | 2452 | # coding: utf-8
import os
import importlib
import random
import logging
from .commands_collector import CommandsCollector
logger = logging.getLogger()
def load_from_packages(app):
pass
def load_from_folder(app):
"""
This code looks for any modules or packages in the given
directory, loads th... | mit |
luotao1/Paddle | python/paddle/fluid/tests/unittests/test_maxout_op.py | 2 | 5104 | # Copyright (c) 2018 PaddlePaddle 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 app... | apache-2.0 |
leopoul/ncclient | examples/nc04.py | 5 | 1046 | #! /usr/bin/env python
#
# Create a new user to the running configuration using edit-config
# and the test-option provided by the :validate capability.
#
# $ ./nc04.py broccoli bob 42 42
import sys, os, warnings
warnings.simplefilter("ignore", DeprecationWarning)
from ncclient import manager
def demo(host, user, name... | apache-2.0 |
SellWellDesigns/orion | node_modules/grunt-docker/node_modules/docker/node_modules/pygmentize-bundled/vendor/pygments/build-2.7/pygments/formatters/__init__.py | 363 | 1827 | # -*- coding: utf-8 -*-
"""
pygments.formatters
~~~~~~~~~~~~~~~~~~~
Pygments formatters.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import os.path
import fnmatch
from pygments.formatters._mapping import FORMATTERS
from pygments.p... | mit |
CouchPotato/CouchPotatoServer | libs/suds/umx/core.py | 199 | 7575 | # This program is free software; you can redistribute it and/or modify
# it under the terms of the (LGPL) GNU Lesser General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will ... | gpl-3.0 |
divyang4481/photivo | scons-local-2.2.0/SCons/Tool/ipkg.py | 14 | 2532 | """SCons.Tool.ipkg
Tool-specific initialization for ipkg.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
The ipkg tool calls the ipkg-build. Its only argument should be the
packages fake_root.
"""
#
# Copyrigh... | gpl-3.0 |
alexandreleroux/mayavi | mayavi/tests/csv_files/54.py | 5 | 3644 | { 'array':
array([('8C', 'TS', 'KC', '9H', '4S', '7D', '2S', '5D', '3S', 'AC'),
('5C', 'AD', '5D', 'AC', '9C', '7C', '5H', '8D', 'TD', 'KS'),
('3H', '7H', '6S', 'KC', 'JS', 'QH', 'TD', 'JC', '2D', '8S'),
('TH', '8H', '5C', 'QS', 'TC', '9H', '4D', 'JC', 'KS', 'JS'),
('7C', '5H', 'KC', 'QH', ... | bsd-3-clause |
nevins-b/lemur | lemur/tests/test_domains.py | 1 | 2642 | import pytest
from lemur.domains.views import * # noqa
from .vectors import VALID_ADMIN_HEADER_TOKEN, VALID_USER_HEADER_TOKEN
@pytest.mark.parametrize("token,status", [
(VALID_USER_HEADER_TOKEN, 200),
(VALID_ADMIN_HEADER_TOKEN, 200),
('', 401)
])
def test_domain_get(client, token, status):
assert ... | apache-2.0 |
Klaudit/wagtail | wagtail/contrib/wagtailstyleguide/views.py | 11 | 2523 | from django import forms
from django.shortcuts import render
from django.utils.translation import ugettext as _
from wagtail.wagtailadmin import messages
from wagtail.wagtailadmin.forms import SearchForm
from wagtail.wagtailadmin.widgets import AdminPageChooser, AdminDateInput, AdminTimeInput, AdminDateTimeInput
from ... | bsd-3-clause |
francrodriguez/scrapy-FrancRodriguez | osl/osl/pipelines.py | 1 | 2320 | # -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
from scrapy import signals
from scrapy.contrib.exporter import XmlItemExporter
import codecs
import json
class JsonWithEncodin... | lgpl-3.0 |
marckuz/django | tests/template_tests/test_callables.py | 347 | 4265 | from __future__ import unicode_literals
from unittest import TestCase
from django.template import Context, Engine
class CallableVariablesTests(TestCase):
@classmethod
def setUpClass(cls):
cls.engine = Engine()
super(CallableVariablesTests, cls).setUpClass()
def test_callable(self):
... | bsd-3-clause |
chagn/chagn.github.com | node_modules/pygmentize-bundled/vendor/pygments/pygments/styles/bw.py | 364 | 1355 | # -*- coding: utf-8 -*-
"""
pygments.styles.bw
~~~~~~~~~~~~~~~~~~
Simple black/white only style.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pygments.style import Style
from pygments.token import Keyword, Name, Comment, Strin... | mit |
rbarlow/pulp | playpen/v2_plugins/distributors/harness_distributor/distributor.py | 17 | 4394 | # -*- coding: utf-8 -*-
#
# Copyright © 2011 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public
# License as published by the Free Software Foundation; either version
# 2 of the License (GPLv2) or (at your option) any later version.
# There is NO WARRANTY for this software, express or impli... | gpl-2.0 |
rtrigoso/tastycakes | node_modules/grunt-docker/node_modules/docker/node_modules/pygmentize-bundled/vendor/pygments/build-2.7/pygments/styles/emacs.py | 364 | 2486 | # -*- coding: utf-8 -*-
"""
pygments.styles.emacs
~~~~~~~~~~~~~~~~~~~~~
A highlighting style for Pygments, inspired by Emacs.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pygments.style import Style
from pygments.token import ... | mit |
Pablo126/SSBW | Tarea3/tarea3/lib/python3.5/site-packages/mongoengine/queryset/manager.py | 3 | 2229 | from functools import partial
from mongoengine.queryset.queryset import QuerySet
__all__ = ('queryset_manager', 'QuerySetManager')
class QuerySetManager(object):
"""
The default QuerySet Manager.
Custom QuerySet Manager functions can extend this class and users can
add extra queryset functionality. ... | gpl-3.0 |
mcardacci/tools_of_the_dark_arts | droopescan/dscan/plugins/tests.py | 6 | 3091 | from cement.core import handler, controller
from dscan.plugins import HumanBasePlugin
from subprocess import call
import os, sys, dscan
BASE_FOLDER = '/var/www/drupal/'
UPDATE_MAJOR = ['6', '7']
def recursive_grep(directory, needle):
return_file = None
for f in os.listdir(directory):
if f.endswith('.p... | gpl-3.0 |
moneymaker365/script.module.dnspython | lib/dns/edns.py | 8 | 4323 | # Copyright (C) 2009, 2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose with or without fee is hereby granted,
# provided that the above copyright notice and this permission notice
# appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND... | isc |
HaroldMills/Vesper | scripts/create_2018_mpg_ranch_archive_data_yaml.py | 1 | 11157 | """Creates an archive data YAML file from a stations CSV file."""
from collections import Counter, defaultdict
from pathlib import Path
import textwrap
from vesper.util.bunch import Bunch
WORKING_DIR_PATH = Path(
'/Users/Harold/Desktop/NFC/Data/MPG Ranch/2018 MPG Ranch Archive/'
'Archive Data YAML')
CSV_F... | mit |
frederick-masterton/django | django/contrib/flatpages/tests/test_middleware.py | 40 | 6848 | import os
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.auth.tests.utils import skipIfCustomUser
from django.contrib.flatpages.models import FlatPage
from django.test import TestCase, override_settings
@override_settings(
LOGIN_URL='/accounts/login/',
MIDDLEW... | bsd-3-clause |
epam-mooc/edx-platform | lms/djangoapps/courseware/features/navigation.py | 21 | 5649 | # pylint: disable=C0111
# pylint: disable=W0621
from lettuce import world, step
from common import course_id, course_location
from problems_setup import PROBLEM_DICT
from nose.tools import assert_in
from opaque_keys.edx.locations import SlashSeparatedCourseKey
@step(u'I am viewing a course with multiple sections')
d... | agpl-3.0 |
anarang/robottelo | tests/foreman/endtoend/test_cli_endtoend.py | 1 | 14197 | """Smoke tests for the ``CLI`` end-to-end scenario."""
import random
from fauxfactory import gen_alphanumeric, gen_ipaddr
from robottelo import manifests, ssh
from robottelo.cli.activationkey import ActivationKey
from robottelo.cli.computeresource import ComputeResource
from robottelo.cli.contenthost import ContentHos... | gpl-3.0 |
discosultan/quake-console | Samples/Sandbox/Lib/encodings/cp863.py | 593 | 34508 | """ Python Character Mapping Codec generated from 'VENDORS/MICSFT/PC/CP863.TXT' with gencodec.py.
"""#"
import codecs
### Codec APIs
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_map)
def decode(self,input,errors='strict'):
... | mit |
proxysh/Safejumper-for-Mac | buildlinux/env64/lib/python2.7/site-packages/twisted/test/test_paths.py | 13 | 74412 | # Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Test cases covering L{twisted.python.filepath}.
"""
from __future__ import division, absolute_import
import os, time, pickle, errno, stat
from pprint import pformat
from twisted.python.compat import _PY3, unicode
from twisted.python.win32 i... | gpl-2.0 |
imjonsnooow/vivisect | vtrace/archs/amd64.py | 27 | 1068 | """
Amd64 Support Module
"""
# Copyright (C) 2007 Invisigoth - See LICENSE file for details
import struct
import envi.archs.amd64 as e_amd64
import vtrace.archs.i386 as vt_i386
class Amd64Mixin(
e_amd64.Amd64Module,
e_amd64.Amd64RegisterContext,
vt_i386.i386WatchMixin):
"""
Do what we ... | apache-2.0 |
EDUlib/edx-platform | common/djangoapps/entitlements/tests/test_utils.py | 4 | 6520 | """
Test entitlements utilities
"""
from datetime import timedelta
from django.conf import settings
from django.utils.timezone import now
from opaque_keys.edx.keys import CourseKey
from common.djangoapps.course_modes.models import CourseMode
from common.djangoapps.course_modes.tests.factories import CourseModeFacto... | agpl-3.0 |
frankvdp/django | django/contrib/gis/gdal/feature.py | 10 | 3929 | from django.contrib.gis.gdal.base import GDALBase
from django.contrib.gis.gdal.error import GDALException
from django.contrib.gis.gdal.field import Field
from django.contrib.gis.gdal.geometries import OGRGeometry, OGRGeomType
from django.contrib.gis.gdal.prototypes import ds as capi, geom as geom_api
from django.utils.... | bsd-3-clause |
girving/tensorflow | tensorflow/contrib/boosted_trees/lib/learner/batch/base_split_handler.py | 9 | 6849 | # 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 |
katre/bazel | tools/jdk/proguard_whitelister_test.py | 13 | 2988 | # Lint as: python2, python3
# Copyright 2015 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
#
# Unle... | apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.