code stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 226 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
""" IPython extension: new prefilters for output grabbing
Provides
var = %magic blah blah
var = !ls
"""
import IPython.ipapi
from IPython.genutils import *
ip = IPython.ipapi.get()
import re
def hnd_magic(line,mo):
""" Handle a = %mymagic blah blah """
#cmd = genutils.make_quote... | mastizada/kuma | vendor/packages/ipython/IPython/Extensions/ext_rescapture.py | Python | mpl-2.0 | 1,498 |
#!/usr/bin/env python
import sys
from fs.opener import opener
from fs.commands.runner import Command
from fs.utils import print_fs
class FSTree(Command):
usage = """fstree [OPTION]... [PATH]
Recursively display the contents of PATH in an ascii tree"""
def get_optparse(self):
optparse = supe... | GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/fs/commands/fstree.py | Python | agpl-3.0 | 2,201 |
# -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
from superde... | ancafarcas/superdesk-core | apps/publish/formatters/resource.py | Python | agpl-3.0 | 793 |
#!/usr/bin/python3
"""
Global variables for onedrive_d.
"""
import os
import sys
import logging
import atexit
import json
from calendar import timegm
from datetime import timezone, datetime, timedelta
from pwd import getpwnam
from . import od_ignore_list
config_instance = None
logger_instance = None
update_last_run_... | kevinwincott/onedrive-d | onedrive_d/od_glob.py | Python | lgpl-3.0 | 5,976 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# 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 ... | dims/nova | nova/cmd/dhcpbridge.py | Python | apache-2.0 | 5,189 |
"""Allows to configure a switch using RPi GPIO."""
import logging
import voluptuous as vol
from homeassistant.components.switch import PLATFORM_SCHEMA
from homeassistant.components import rpi_gpio
from homeassistant.const import DEVICE_DEFAULT_NAME
from homeassistant.helpers.entity import ToggleEntity
import homeassi... | MartinHjelmare/home-assistant | homeassistant/components/rpi_gpio/switch.py | Python | apache-2.0 | 2,268 |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from pants.base.payl... | areitz/pants | src/python/pants/backend/core/targets/resources.py | Python | apache-2.0 | 1,552 |
# coding=utf-8
# Copyright 2018 The Tensor2Tensor Authors.
#
# 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... | vthorsteinsson/tensor2tensor | tensor2tensor/data_generators/image_utils.py | Python | apache-2.0 | 14,211 |
#!/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.
"""Tests for the module module, which contains Module and related classes."""
import os
import unittest
from tvcm import fake_fs
from... | dstockwell/catapult | tracing/third_party/tvcm/tvcm/module_unittest.py | Python | bsd-3-clause | 3,914 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from lxml import etree
import os, sys, logging, subprocess
from os.path import realpath, dirname
import xapian
sys.path.append('/home/liza/threepress')
from threepress import settings
db_dir = 'db/'
main_db = 'threepress'
logging.basicConfig(level=logging.WARNING)
index... | dekom/threepress-bookworm-read-only | data/bin/convert.py | Python | bsd-3-clause | 4,286 |
from src.platform.jboss.interfaces import WebConsoleInterface
class FPrint(WebConsoleInterface):
def __init__(self):
super(FPrint, self).__init__()
self.version = "5.0"
| GHubgenius/clusterd | src/platform/jboss/fingerprints/JBoss5WC.py | Python | mit | 196 |
# -*- coding: utf-8 -*-
"""
requests.models
~~~~~~~~~~~~~~~
This module contains the primary objects that power Requests.
"""
import os
from datetime import datetime
from .hooks import dispatch_hook, HOOKS
from .structures import CaseInsensitiveDict
from .status_codes import codes
from .auth import HTTPBasicAuth, ... | samabhi/pstHealth | venv/lib/python2.7/site-packages/requests/models.py | Python | mit | 26,299 |
from test_support import verbose
import strop, sys
def test(name, input, output, *args):
if verbose:
print 'string.%s%s =? %s... ' % (name, (input,) + args, output),
f = getattr(strop, name)
try:
value = apply(f, (input,) + args)
except:
value = sys.exc_type
if value != out... | atmark-techno/atmark-dist | user/python/Lib/test/test_strop.py | Python | gpl-2.0 | 3,659 |
# - coding: utf-8 -
# Copyright (C) 2007 Patryk Zawadzki <patrys at pld-linux.org>
# Copyright (C) 2007-2009 Toms Baugis <toms.baugis@gmail.com>
# This file is part of Project Hamster.
# Project Hamster is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as ... | wreckJ/hamster | src/hamster/client.py | Python | gpl-3.0 | 11,012 |
""" Handlers for OpenID Connect provider. """
from django.conf import settings
from django.core.cache import cache
from courseware.access import has_access
from openedx.core.djangoapps.content.course_overviews.models import CourseOverview
from openedx.core.djangoapps.lang_pref import LANGUAGE_KEY
from openedx.core.dj... | synergeticsedx/deployment-wipro | lms/djangoapps/oauth2_handler/handlers.py | Python | agpl-3.0 | 8,254 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import os
import subprocess
def runtests():
fail = 0
for test in os.listdir("."):
if test.startswith("tst_") and test.endswith(".py"):
if 0 != subprocess.call(["./" + test]):
fail += 1
print test, "failed... | Distrotech/iksemel | python/test/runtests.py | Python | lgpl-2.1 | 423 |
from builtins import range
import sys, os
sys.path.insert(1, os.path.join("..","..",".."))
import h2o
from tests import pyunit_utils
from h2o import H2OFrame
import numpy as np
import numpy.random
import scipy.stats
from sklearn import ensemble
from sklearn.metrics import roc_auc_score
from h2o.estimators.gbm import H2... | YzPaul3/h2o-3 | h2o-py/tests/testdir_algos/gbm/pyunit_bernoulli_synthetic_data_GBM_medium.py | Python | apache-2.0 | 3,234 |
# Copyright (C) 2012 Hewlett-Packard Development Company, L.P.
# 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/LICEN... | abusse/cinder | cinder/tests/backup/fake_service.py | Python | apache-2.0 | 1,422 |
import unittest
from cStringIO import StringIO
from pysal.core.util.shapefile import noneMax, noneMin, shp_file, shx_file, NullShape, Point, PolyLine, MultiPoint, PointZ, PolyLineZ, PolygonZ, MultiPointZ, PointM, PolyLineM, PolygonM, MultiPointM, MultiPatch
import os
import pysal
class TestNoneMax(unittest.TestCase):... | spreg-git/pysal | pysal/core/util/tests/test_shapefile.py | Python | bsd-3-clause | 16,445 |
import numpy as np
from dipy.data import default_sphere
from dipy.tracking.propspeed import ndarray_offset, eudx_both_directions
from numpy.testing import (assert_array_almost_equal, assert_equal,
assert_raises, run_module_suite)
def stepped_1d(arr_1d):
# Make a version of `arr_1d` wh... | FrancoisRheaultUS/dipy | dipy/tracking/tests/test_propagation.py | Python | bsd-3-clause | 2,183 |
# -*- 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... | crmccreary/openerp_server | openerp/addons/event/wizard/event_confirm_registration.py | Python | agpl-3.0 | 2,865 |
import mms
import unittest
from mooseutils import fuzzyAbsoluteEqual
class TestOutflow(unittest.TestCase):
def test(self):
df1 = mms.run_spatial('advection-outflow.i', 7, y_pp=['L2u', 'L2v'])
fig = mms.ConvergencePlot(xlabel='Element Size ($h$)', ylabel='$L_2$ Error')
fig.plot(df1,
... | harterj/moose | test/tests/fvkernels/mms/advective-outflow/test.py | Python | lgpl-2.1 | 7,075 |
from __future__ import absolute_import
import os
import csv
import json
from io import BytesIO
import tempfile
import shutil
from six.moves.urllib.parse import urlparse
from zope.interface.verify import verifyObject
from twisted.trial import unittest
from twisted.internet import defer
from scrapy.crawler import Crawle... | wenyu1001/scrapy | tests/test_feedexport.py | Python | bsd-3-clause | 16,261 |
# Copyright (C) 2004-2007, 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 "... | burzillibus/RobHome | venv/lib/python2.7/site-packages/dns/rdtypes/ANY/NSEC3PARAM.py | Python | mit | 3,098 |
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
import pybindgen.settings
import warnings
class ErrorHandler(pybindgen.settings.ErrorHandler):
def handle_error(self, wrapper, exception, traceback_):
warnings.warn("exception %r in wrapper %s" % (exception, wrapper))
... | thehajime/ns-3-dev | src/point-to-point/bindings/modulegen__gcc_LP64.py | Python | gpl-2.0 | 349,061 |
from binsearch import BinSearch
from nzbclub import NZBClub
from nzbindex import NZBIndex
from bs4 import BeautifulSoup
from couchpotato.core.helpers.variable import getTitle, splitString, tryInt
from couchpotato.core.helpers.encoding import simplifyString
from couchpotato.environment import Env
from couchpotato.core.... | thedep2/CouchPotatoServer | couchpotato/core/media/_base/providers/nzb/binnewz/main.py | Python | gpl-3.0 | 18,081 |
#!/usr/bin/python
# Copyright: Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
... | kustodian/ansible | lib/ansible/modules/cloud/amazon/kinesis_stream.py | Python | gpl-3.0 | 46,551 |
from gwpy.plot import Plot
plot = Plot(noise, signal, data, separate=True, sharex=True, sharey=True)
plot.gca().set_epoch(0)
plot.show() | gwpy/gwpy.github.io | docs/latest/examples/timeseries/inject-5.py | Python | gpl-3.0 | 136 |
#-*- coding: ISO-8859-1 -*-
# pysqlite2/test/regression.py: pysqlite regression tests
#
# Copyright (C) 2007 Gerhard Häring <gh@ghaering.de>
#
# This file is part of pysqlite.
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liable for any damages
#... | JeffHeard/terrapyn_docker | pysqlite-2.6.3/lib/test/py25/py25tests.py | Python | apache-2.0 | 2,745 |
# 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... | dmlc/mxnet | example/sparse/linear_classification/train.py | Python | apache-2.0 | 5,849 |
from datetime import datetime
from django.db import models
from django.utils.translation import ugettext_lazy as _
class TestModel(models.Model):
text = models.CharField(max_length=10, default=_('Anything'))
class Company(models.Model):
name = models.CharField(max_length=50)
date_added = models.DateTimeFi... | Smarsh/django | tests/regressiontests/i18n/models.py | Python | bsd-3-clause | 552 |
from django.apps import AppConfig
class LibraryConfig(AppConfig):
name = 'library'
| airportmarc/the416life | src/apps/library/apps.py | Python | mit | 89 |
#-*- coding: utf-8 -*-
from django.core.exceptions import PermissionDenied
def popup_status(request):
return '_popup' in request.REQUEST or 'pop' in request.REQUEST
def selectfolder_status(request):
return 'select_folder' in request.REQUEST
def popup_param(request):
if popup_status(request):
r... | hzlf/openbroadcast | website/__filer/admin/tools.py | Python | gpl-3.0 | 1,521 |
# (c) 2012-2015, Michael DeHaan <michael.dehaan@gmail.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) an... | Shaps/ansible | test/units/plugins/cache/test_cache.py | Python | gpl-3.0 | 5,922 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-today OpenERP SA (<http://www.openerp.com>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms o... | tedi3231/openerp | openerp/addons/crm/crm.py | Python | agpl-3.0 | 10,604 |
"""
NL2BR Extension
===============
A Python-Markdown extension to treat newlines as hard breaks; like
GitHub-flavored Markdown does.
Usage:
>>> import markdown
>>> print markdown.markdown('line 1\\nline 2', extensions=['nl2br'])
<p>line 1<br />
line 2</p>
Copyright 2011 [Brian Neal](http://deathofa... | GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/markdown/extensions/nl2br.py | Python | agpl-3.0 | 765 |
#!/usr/bin/env python
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "L... | strava/thrift | tutorial/py.twisted/PythonServer.py | Python | apache-2.0 | 2,652 |
"""Class for Roomba devices."""
import logging
from homeassistant.components.vacuum import SUPPORT_FAN_SPEED
from .irobot_base import SUPPORT_IROBOT, IRobotVacuum
_LOGGER = logging.getLogger(__name__)
ATTR_BIN_FULL = "bin_full"
ATTR_BIN_PRESENT = "bin_present"
FAN_SPEED_AUTOMATIC = "Automatic"
FAN_SPEED_ECO = "Eco... | jawilson/home-assistant | homeassistant/components/roomba/roomba.py | Python | apache-2.0 | 3,241 |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from ....testing import assert_equal
from ..postproc import TrackMerge
def test_TrackMerge_inputs():
input_map = dict(args=dict(argstr='%s',
),
environ=dict(nohash=True,
usedefault=True,
),
ignore_exception=dict(nohash=True,
usedefault=... | sgiavasis/nipype | nipype/interfaces/diffusion_toolkit/tests/test_auto_TrackMerge.py | Python | bsd-3-clause | 1,067 |
import sublime, sublime_plugin
import re
def match(rex, str):
m = rex.match(str)
if m:
return m.group(0)
else:
return None
# This responds to on_query_completions, but conceptually it's expanding
# expressions, rather than completing words.
#
# It expands these simple expressions:
# tag.cl... | herove/dotfiles | sublime/Packages/HTML/html_completions.py | Python | mit | 10,848 |
"""
Tests for Discussion API views
"""
from datetime import datetime
import json
from urlparse import urlparse
import ddt
import httpretty
import mock
from pytz import UTC
from django.core.urlresolvers import reverse
from rest_framework.test import APIClient
from discussion_api.tests.utils import (
CommentsServ... | jazztpt/edx-platform | lms/djangoapps/discussion_api/tests/test_views.py | Python | agpl-3.0 | 34,440 |
# Copyright 2012 NEC Corporation
#
# 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 ag... | openstack/horizon | openstack_dashboard/dashboards/project/networks/ports/urls.py | Python | apache-2.0 | 1,111 |
# Copyright 2011-2012 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | jumpstarter-io/nova | nova/tests/scheduler/test_weights.py | Python | apache-2.0 | 9,359 |
from __future__ import absolute_import
# Copyright (c) 2010-2015 openpyxl
from .formatting import ConditionalFormatting
from .rule import Rule
| saukrIppl/seahub | thirdpart/openpyxl-2.3.0-py2.7.egg/openpyxl/formatting/__init__.py | Python | apache-2.0 | 144 |
from django.conf.urls import url
from wagtail.admin.views import page_privacy, pages
app_name = 'wagtailadmin_pages'
urlpatterns = [
url(r'^add/(\w+)/(\w+)/(\d+)/$', pages.create, name='add'),
url(r'^add/(\w+)/(\w+)/(\d+)/preview/$', pages.PreviewOnCreate.as_view(), name='preview_on_add'),
url(r'^usage/(\... | nealtodd/wagtail | wagtail/admin/urls/pages.py | Python | bsd-3-clause | 2,210 |
#!/usr/bin/env python2
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
from __future__ import with_statement
__license__ = 'GPL v3'
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
from calibre.gui2.convert.azw3_output_ui import Ui_Form
from calibre.gui2.convert i... | drxaero/calibre | src/calibre/gui2/convert/azw3_output.py | Python | gpl-3.0 | 978 |
# encoding: utf-8
import logging
# emplacement ou charger les fichier de configuration par instances
INSTANCES_DIR = '/etc/jormungandr.d'
# Start the thread at startup, True in production, False for test environments
START_MONITORING_THREAD = False
# chaine de connnection à postgresql pour la base jormungandr
SQLAL... | francois-vincent/navitia | source/jormungandr/jormungandr/test_settings.py | Python | agpl-3.0 | 964 |
# 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... | kevin-coder/tensorflow-fork | tensorflow/python/saved_model/simple_save.py | Python | apache-2.0 | 4,171 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Joel Grand-Guillaume
# Copyright 2011-2012 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License a... | hbrunn/bank-statement-reconcile | account_statement_transactionid_completion/__init__.py | Python | agpl-3.0 | 971 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
from webnotes.utils import flt, cstr
from webnotes import msgprint
from webnotes.model.controller import DocListController
status_m... | saurabh6790/med_app_rels | controllers/status_updater.py | Python | agpl-3.0 | 8,752 |
# Tweepy
# Copyright 2009-2010 Joshua Roesslein
# See LICENSE for details.
import httplib
import urllib
import time
import re
from tweepy.error import TweepError
from tweepy.utils import convert_to_utf8_str
from tweepy.models import Model
re_path_template = re.compile('{\w+}')
def bind_api(**config):
class AP... | olemoudi/tweetdigest | tweepy/tweepy/binder.py | Python | apache-2.0 | 7,174 |
MODULE_DESCRIPTION = "Web pages"
| fredsmith/will | will/plugins/web/__init__.py | Python | mit | 33 |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2009, 2010, 2011 CERN.
##
## Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of the
## License, or (at yo... | jmartinm/invenio | modules/miscutil/lib/urlutils_unit_tests.py | Python | gpl-2.0 | 18,616 |
"""
Tests related to the Microsites feature
"""
from django.conf import settings
from django.core.urlresolvers import reverse
from django.test.utils import override_settings
from nose.plugins.attrib import attr
from courseware.tests.helpers import LoginEnrollmentTestCase
from course_modes.models import CourseMode
from... | IndonesiaX/edx-platform | lms/djangoapps/courseware/tests/test_microsites.py | Python | agpl-3.0 | 10,562 |
#!/usr/local/bin/python2.6 -tt
#
# 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 (... | getyourguide/fbthrift | thrift/compiler/py/generate/t_output.py | Python | apache-2.0 | 5,552 |
from . import website
| Vauxoo/e-commerce | website_snippet_product_category/controllers/__init__.py | Python | agpl-3.0 | 22 |
# To change this license header, choose License Headers in Project Properties.
# To change this template file, choose Tools | Templates
# and open the template in the editor.
| tzuria/Shift-It-Easy | webApp/shift-it-easy-2015/web/pages/__init__.py | Python | mit | 177 |
"""
Solve the unique lowest-cost assignment problem using the
Hungarian algorithm (also known as Munkres algorithm).
"""
# Based on original code by Brain Clapper, adapted to NumPy by Gael Varoquaux.
# Heavily refactored by Lars Buitinck.
#
# TODO: a version of this algorithm has been incorporated in SciPy; use that
#... | vortex-ape/scikit-learn | sklearn/utils/linear_assignment_.py | Python | bsd-3-clause | 9,494 |
# Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
# This source code is licensed under both the GPLv2 (found in the
# COPYING file in the root directory) and Apache 2.0 License
# (found in the LICENSE.Apache file in the root directory).
from abc import ABC, abstractmethod
from calendar import timeg... | TeamSPoon/logicmoo_workspace | packs_lib/rocksdb/rocksdb/tools/advisor/advisor/db_log_parser.py | Python | mit | 4,842 |
from test import test_support
test_support.requires('audio')
from test.test_support import verbose, findfile, TestFailed, TestSkipped
import errno
import fcntl
import ossaudiodev
import os
import sys
import select
import sunaudio
import time
import audioop
# Arggh, AFMT_S16_NE not defined on all platforms -- seems t... | zephyrplugins/zephyr | zephyr.plugin.jython/jython2.5.2rc3/Lib/test/test_ossaudiodev.py | Python | epl-1.0 | 5,471 |
"""A dummy module with no effect for use on systems without readline."""
def get_completer():
"""An empty implementation of readline.get_completer."""
def get_completer_delims():
"""An empty implementation of readline.get_completer_delims."""
def parse_and_bind(unused_command):
"""An empty implementat... | nohona/cron-crm | usr/local/certbot/certbot/display/dummy_readline.py | Python | gpl-3.0 | 570 |
# 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... | Mega-DatA-Lab/mxnet | tests/python/unittest/test_metric.py | Python | apache-2.0 | 1,757 |
#!/usr/bin/env python
import random
from nose.tools import *
import networkx as nx
from networkx import convert_node_labels_to_integers as cnlti
from networkx.algorithms.simple_paths import _bidirectional_shortest_path
from networkx.algorithms.simple_paths import _bidirectional_dijkstra
# Tests for all_simple_paths
d... | LumPenPacK/NetworkExtractionFromImages | win_build/nefi2_win_amd64_msvc_2015/site-packages/networkx/algorithms/tests/test_simple_paths.py | Python | bsd-2-clause | 9,703 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
from setuptools import setup
except ImportError:
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup
setup(
name='django-tastypie',
version='0.12.2-dev',
description='A flexible & capable API layer for Django.... | andresriancho/django-tastypie | setup.py | Python | bsd-3-clause | 1,615 |
#!/usr/bin/env python
import sys, os
from optparse import OptionParser
option_parser = OptionParser()
option_parser.add_option('--install-root',default='/opt/graphite/',
help="The base directory of the graphite installation")
option_parser.add_option('--libs',default=None,
help="The directory where the graphite p... | pcn/graphite-web | misc/generate-apache-config.py | Python | apache-2.0 | 1,339 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import sys
from os.path import abspath, dirname, join
if sys.getdefaultencoding() != 'utf-8':
reload(sys)
sys.setdefaultencoding('utf-8')
PREFIX = abspath(
join(
dirname(abspath(__file__)), '../'
)
)
if PREFIX not in sys.path:
sys.path.append(... | PegasusWang/pyhome | test/_env.py | Python | mit | 328 |
from django.core.management.base import BaseCommand
from optparse import make_option
from crits.dashboards.dashboard import SavedSearch
class Command(BaseCommand):
"""
Script Class.
"""
help = 'Creates the default dashboard.'
def handle(self, *args, **options):
"""
Script Execution... | seanthegeek/crits | crits/core/management/commands/migrate_dashboard_searches.py | Python | mit | 1,865 |
# 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... | ghchinoy/tensorflow | tensorflow/python/debug/wrappers/disk_usage_test.py | Python | apache-2.0 | 4,419 |
from sympy.external import import_module
from sympy.utilities.pytest import raises, SKIP
from sympy.core.compatibility import range
theano = import_module('theano')
if theano:
import numpy as np
ts = theano.scalar
tt = theano.tensor
xt, yt, zt = [tt.scalar(name, 'floatX') for name in 'xyz']
else:
#... | drufat/sympy | sympy/printing/tests/test_theanocode.py | Python | bsd-3-clause | 9,802 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the... | InakiZabala/odoomrp-wip | stock_packaging_info/__openerp__.py | Python | agpl-3.0 | 1,532 |
"""
Copyright (C) 2004-2015 Pivotal Software, Inc. All rights reserved.
This program and the accompanying materials are made available under
the terms of the 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
... | lintzc/gpdb | src/test/tinc/tincrepo/mpp/gpdb/tests/storage/pg_twophase/switch_ckpt_serial/cleanup_sql/test_cleanup.py | Python | apache-2.0 | 845 |
# -*- coding: utf-8 -*-
#
# Copyright 2012-2015 Spotify AB
#
# 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... | torypages/luigi | luigi/lock.py | Python | apache-2.0 | 3,102 |
# 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... | dongjoon-hyun/tensorflow | tensorflow/python/util/decorator_utils.py | Python | apache-2.0 | 3,614 |
# -*- coding: utf-8 -*-
"""
requests.adapters
~~~~~~~~~~~~~~~~~
This module contains the transport adapters that Requests uses to define
and maintain connections.
"""
import os.path
import socket
from urllib3.poolmanager import PoolManager, proxy_from_url
from urllib3.response import HTTPResponse
from urllib3.util ... | momm3/WelcomeBot | welcomebot/Lib/site-packages/requests/adapters.py | Python | mit | 20,601 |
"""Tests for the JuiceNet component."""
| nkgilley/home-assistant | tests/components/juicenet/__init__.py | Python | apache-2.0 | 40 |
# 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... | dongjoon-hyun/tensorflow | tensorflow/contrib/eager/python/examples/l2hmc/neural_nets.py | Python | apache-2.0 | 3,023 |
from coalib.bearlib.languages.Language import Language
@Language
class Java:
extensions = '.java',
comment_delimiter = '//'
multiline_comment_delimiters = {'/*': '*/'}
string_delimiters = {'"': '"'}
multiline_string_delimiters = {}
indent_types = {'{': '}'}
encapsulators = {'(': ')', '[': ... | refeed/coala | coalib/bearlib/languages/definitions/Java.py | Python | agpl-3.0 | 325 |
#!/usr/bin/python
# Copyright (c) 2016 Hewlett-Packard Enterprise Corporation
# 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',
... | alxgu/ansible | lib/ansible/modules/cloud/openstack/os_keystone_domain_facts.py | Python | gpl-3.0 | 3,511 |
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 08 22:28:48 2011
@author: josef
"""
from statsmodels.compat.python import zip
import numpy as np
from numpy.testing import assert_equal, assert_almost_equal, assert_
from statsmodels.tools.eval_measures import (
maxabs, meanabs, medianabs, medianbias, mse, rmse, std... | waynenilsen/statsmodels | statsmodels/tools/tests/test_eval_measures.py | Python | bsd-3-clause | 3,560 |
# Copyright 2016, 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... | arkmaxim/grpc | test/distrib/python/distribtest.py | Python | bsd-3-clause | 1,732 |
# Copyright 2015 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 httplib
import json
import logging
import pprint
import time
logger = logging.getLogger('proximity_auth.%s' % __name__)
_GOOGLE_APIS_URL = 'www.goog... | guorendong/iridium-browser-ubuntu | components/proximity_auth/e2e_test/cryptauth.py | Python | bsd-3-clause | 4,829 |
import numpy as np
def rainbow(n):
"""
Returns a list of colors sampled at equal intervals over the spectrum.
Parameters
----------
n : int
The number of colors to return
Returns
-------
R : (n,3) array
An of rows of RGB color values
Notes
-----
Converts f... | hlin117/statsmodels | statsmodels/graphics/plottools.py | Python | bsd-3-clause | 634 |
# -*- 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... | bealdav/OpenUpgrade | addons/account_voucher/__openerp__.py | Python | agpl-3.0 | 3,424 |
from django.conf import settings
def is_solr_supported():
try:
return 'Solr' in settings.HAYSTACK_CONNECTIONS['default']['ENGINE']
except (KeyError, AttributeError):
return False
def is_elasticsearch_supported():
try:
return 'Elasticsearch' in settings.HAYSTACK_CONNECTIONS['defau... | canhhs91/greenpointtrees | src/oscar/apps/search/features.py | Python | mit | 395 |
# -*- 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... | ncliam/serverpos | openerp/addons/mrp/report/price.py | Python | agpl-3.0 | 11,687 |
"""
Test cases for codeop.py
Nick Mathewson
"""
import unittest
from test.support import run_unittest, is_jython
from codeop import compile_command, PyCF_DONT_IMPLY_DEDENT
import io
if is_jython:
import sys
def unify_callables(d):
for n,v in d.items():
if hasattr(v, '__call__'):
... | invisiblek/python-for-android | python3-alpha/python3-src/Lib/test/test_codeop.py | Python | apache-2.0 | 7,630 |
"""
Copyright (C) 2004-2015 Pivotal Software, Inc. All rights reserved.
This program and the accompanying materials are made available under
the terms of the 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
... | rvs/gpdb | src/test/tinc/tincrepo/mpp/gpdb/tests/storage/pg_twophase/switch_ckpt_serial/trigger_sql/test_triggersqls.py | Python | apache-2.0 | 1,237 |
#
# iso2022_jp_1.py: Python Unicode Codec for ISO2022_JP_1
#
# Written by Hye-Shik Chang <perky@FreeBSD.org>
#
import _codecs_iso2022, codecs
import _multibytecodec as mbc
codec = _codecs_iso2022.getcodec('iso2022_jp_1')
class Codec(codecs.Codec):
encode = codec.encode
decode = codec.decode
c... | zwChan/VATEC | ~/eb-virt/Lib/encodings/iso2022_jp_1.py | Python | apache-2.0 | 1,100 |
# vim: ai ts=4 sts=4 et sw=4 encoding=utf-8
""" Python Character Mapping Codec based on gsm0338 generated from './GSM0338.TXT' with gencodec.py.
With extra sauce to deal with the 'multibyte' extensions!
"""#"
import codecs
import re
### Codec APIs
#
# Shared funcs
#
def _encode(input,errors='strict'):
... | developmentseed/slingshotSMS | pygsm/gsmcodecs/gsm0338.py | Python | bsd-3-clause | 19,653 |
"""
termcolors.py
"""
from django.utils import six
color_names = ('black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white')
foreground = {color_names[x]: '3%s' % x for x in range(8)}
background = {color_names[x]: '4%s' % x for x in range(8)}
RESET = '0'
opt_dict = {'bold': '1', 'underscore': '4', 'blink... | SujaySKumar/django | django/utils/termcolors.py | Python | bsd-3-clause | 7,479 |
import numpy as np
from scipy.ndimage import label
def generate_test_vecs(infile, strelfile, resultfile):
"test label with different structuring element neighborhoods"
def bitimage(l):
return np.array([[c for c in s] for s in l]) == '1'
data = [np.ones((7, 7)),
bitimage(["1110111",
... | ales-erjavec/scipy | scipy/ndimage/utils/generate_label_testvectors.py | Python | bsd-3-clause | 1,672 |
# -*- coding: utf-8 -*-
"""
pygments.filters
~~~~~~~~~~~~~~~~
Module containing filter lookup functions and default
filters.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.token import String, Comment, Ke... | JulienMcJay/eclock | windows/Python27/Lib/site-packages/pygments/filters/__init__.py | Python | gpl-2.0 | 11,486 |
# Copyright (c) 2007-2008 The Hewlett-Packard Development Company
# 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 imp... | austinharris/gem5-riscv | src/arch/x86/isa/insts/general_purpose/input_output/string_io.py | Python | bsd-3-clause | 4,418 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# This contains a 128x128 px thumbnail in PNG format
# Taken from http://www.zwahlendesign.ch/en/node/20
# openoffice_icons/openoffice_icons_linux/openoffice11.png
# License: Freeware
import base64
iconstr = """\
iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAAG0OVFdAAAABGdBTUEAANbY1E9Y... | chirilo/mozillians | vendor-local/lib/python/tablib/packages/odf3/thumbnail.py | Python | bsd-3-clause | 31,736 |
from __future__ import unicode_literals
import getpass
from django.contrib.auth import get_user_model
from django.contrib.auth.password_validation import validate_password
from django.core.exceptions import ValidationError
from django.core.management.base import BaseCommand, CommandError
from django.db import DEFAULT... | DONIKAN/django | django/contrib/auth/management/commands/changepassword.py | Python | bsd-3-clause | 2,610 |
# 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... | talnoah/android_kernel_htc_dlx | virt/tools/perf/scripts/python/syscall-counts-by-pid.py | Python | gpl-2.0 | 1,927 |
# Copyright (c) 2015 Prabhu Gurumurthy <pgurumur@users.noreply.github.com>
# Permission to use, copy, modify, and distribute this software 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... | pgurumur/netconf | core/lib/__init__.py | Python | isc | 791 |
import os
# maintain python 2.7 compatibility for time being. GSRTConfig is a dependency on everything else,
# including ow-swagger-library, which supports both python2 and python3. I think we should
# stop supporting 2.x if needed, but since many people outside GSRT are still just beginning
# to transition to python3... | PaloAltoNetworks-BD/autofocus-client-library | autofocus/gsrt_config.py | Python | isc | 6,385 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2020-2022 F4PGA Authors
#
# 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
#
# Unl... | SymbiFlow/prjuray | fuzzers/004-tileinfo/cleanup_site_pins.py | Python | isc | 4,765 |
# Generated by Django 3.0.13 on 2021-05-19 21:21
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('products', '0001_initial'),
migrations.swappable_dependency(se... | pmaigutyak/mp-shop | offers/migrations/0001_initial.py | Python | isc | 1,897 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.