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 |
|---|---|---|---|---|---|
import sys
import os
import re
import imp
from Tkinter import *
import tkSimpleDialog
import tkMessageBox
import webbrowser
from idlelib.MultiCall import MultiCallCreator
from idlelib import idlever
from idlelib import WindowList
from idlelib import SearchDialog
from idlelib import GrepDialog
from idlelib import Repla... | ianyh/heroku-buildpack-python-opencv | vendor/.heroku/lib/python2.7/idlelib/EditorWindow.py | Python | mit | 66,031 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | SUSE/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/flow_log_status_parameters.py | Python | mit | 1,037 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
__license__ = """
GoLismero 2.0 - The web knife - Copyright (C) 2011-2014
Authors:
Jekkay Hu | jekkay<@>gmail.com
Daniel Garcia Garcia a.k.a cr0hn | cr0hn<@>cr0hn.com
Mario Vilas | mvilas<@>gmail.com
Golismero project site: http://golismero-project.com
Golismero projec... | golismero/golismero | golismero/api/data/vulnerability/injection/xss.py | Python | gpl-2.0 | 2,381 |
#!/usr/bin/env python
# coding=utf-8
"""
Site: http://www.beebeeto.com/
Framework: https://github.com/n0tr00t/Beebeeto-framework
"""
import time
import struct
import random
import socket
import select
import urlparse
from baseframe import BaseFrame
from utils.common.str import hex_dump
class MyPoc(BaseFrame):
... | forbidden-ali/Beebeeto-framework | demo/openssl_man_in_middle.py | Python | gpl-2.0 | 9,009 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2014, GeekChimp - Franck Nijhof <franck@geekchimp.com>
#
# 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 you... | kaarolch/ansible | lib/ansible/modules/system/osx_defaults.py | Python | gpl-3.0 | 14,430 |
#!/usr/bin/env python
#
# Copyright 2011 Facebook
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | whitepyro/debian_server_setup | tornado/netutil.py | Python | gpl-3.0 | 17,330 |
from m1 import <error descr="Cannot find reference 'foo' in 'm1.pyi'">foo</error>
from m1 import <error descr="Cannot find reference 'bar' in 'm1.pyi'">bar</error>
from m1 import bar_imported
from m1 import <error descr="Cannot find reference 'm2' in 'm1.pyi'">m2</error>
from m1 import m2_imported
print(foo, bar, bar_... | goodwinnk/intellij-community | python/testData/pyi/inspections/hiddenPyiImports/HiddenPyiImports.py | Python | apache-2.0 | 347 |
'''
Full setup, used to distribute the debugger backend to PyPi.
Note that this is mostly so that users can do:
pip install pydevd
in a machine for doing remote-debugging, as a local installation with the IDE should have
everything already distributed.
Reference on wheels:
https://hynek.me/articles/sharing-your-lab... | asedunov/intellij-community | python/helpers/pydev/setup.py | Python | apache-2.0 | 4,628 |
# Copyright 2013-2015 DataStax, 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 writi... | bbirand/python-driver | tests/integration/standard/test_prepared_statements.py | Python | apache-2.0 | 13,413 |
"""
Set operations for 1D numeric arrays based on sorting.
:Contains:
ediff1d,
unique,
intersect1d,
setxor1d,
in1d,
union1d,
setdiff1d
:Notes:
For floating point arrays, inaccurate results may appear due to usual round-off
and floating point comparison issues.
Speed could be gained in some operations ... | ssanderson/numpy | numpy/lib/arraysetops.py | Python | bsd-3-clause | 16,818 |
# Copyright (c) 2006-2007 The Regents of The University of Michigan
# Copyright (c) 2009 Advanced Micro Devices, 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 co... | dpac-vlsi/SynchroTrace | util/configs/ruby/MI_example.py | Python | bsd-3-clause | 6,181 |
"""Assorted commands.
"""
import os
import threading
import sublime
import sublime_plugin
from Vintageous.state import _init_vintageous
from Vintageous.state import State
from Vintageous.vi import settings
from Vintageous.vi import cmd_defs
from Vintageous.vi.dot_file import DotFile
from Vintageous.vi.utils import m... | zhangtuoparis13/Vintageous | xsupport.py | Python | mit | 6,043 |
import urllib
from allmydata.scripts.common_http import do_http, check_http_error
from allmydata.scripts.common import get_alias, DEFAULT_ALIAS, UnknownAliasError
from allmydata.util.encodingutil import quote_output
def mkdir(options):
nodeurl = options['node-url']
aliases = options.aliases
where = option... | david415/tahoe-lafs | src/allmydata/scripts/tahoe_mkdir.py | Python | gpl-2.0 | 1,660 |
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
#
# Copyright (C) 2016 Guido Günther <agx@sigxcpu.org>,
# Daniel Lobato Garcia <dlobatog@redhat.com>
#
# This script is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# t... | trondhindenes/ansible | contrib/inventory/foreman.py | Python | gpl-3.0 | 17,060 |
# telepathy-python - Base classes defining the interfaces of the Telepathy framework
#
# Copyright (C) 2005, 2006 Collabora Limited
# Copyright (C) 2005, 2006 Nokia Corporation
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as pub... | davidedmundson/telepathy-hangups | telepathy/interfaces.py | Python | lgpl-2.1 | 1,435 |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | staslev/beam | sdks/python/apache_beam/io/gcp/internal/clients/storage/storage_v1_messages.py | Python | apache-2.0 | 78,320 |
import pygraph.algorithms.generators as gen
import pygraph.algorithms.accessibility as acc
import pygraph.algorithms.minmax as minmax
graph = gen.generate(5000, 10000, weight_range=(50, 2000))
components = acc.connected_components(graph)
nodes = [g for g in graph if components[g] == 1]
print "GRAPH NODES"
for n in g... | kentya6/swift | utils/benchmark/Graph/generate-data.py | Python | apache-2.0 | 748 |
# pylint: disable=E1101,E1103
# pylint: disable=W0703,W0622,W0613,W0201
from pandas.compat import range, zip
from pandas import compat
import itertools
import numpy as np
from pandas.core.series import Series
from pandas.core.frame import DataFrame
from pandas.core.sparse import SparseDataFrame, SparseSeries
from pa... | Vvucinic/Wander | venv_2_7/lib/python2.7/site-packages/pandas/core/reshape.py | Python | artistic-2.0 | 39,134 |
import numpy as np
import numpy.testing as npt
from dipy.reconst.peaks import default_sphere, peaks_from_model
def test_PeaksAndMetricsDirectionGetter():
class SillyModel(object):
def fit(self, data, mask=None):
return SillyFit(self)
class SillyFit(object):
def __init__(self, m... | mdesco/dipy | dipy/reconst/tests/test_peakdf.py | Python | bsd-3-clause | 2,414 |
"""
A Python "serializer". Doesn't do much serializing per se -- just converts to
and from basic Python data types (lists, dicts, strings, etc.). Useful as a basis for
other serializers.
"""
from __future__ import unicode_literals
from collections import OrderedDict
from django.apps import apps
from django.conf impor... | djbaldey/django | django/core/serializers/python.py | Python | bsd-3-clause | 7,685 |
import json
import logging
import pytz
import datetime
import dateutil.parser
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse
from django.shortcuts import redirect
from django.conf import settings
from mitxmako.shortcuts import render_to_response
from django_future.csrf ... | PepperPD/edx-pepper-platform | common/djangoapps/track/views.py | Python | agpl-3.0 | 5,519 |
# 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... | drpngx/tensorflow | tensorflow/contrib/predictor/contrib_estimator_predictor.py | Python | apache-2.0 | 3,274 |
# Copyright 2014 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | tvansteenburgh/PerfKitBenchmarker | tests/sample_test.py | Python | apache-2.0 | 1,098 |
from __future__ import unicode_literals
import datetime
import hashlib
import random
import re
from django.conf import settings
from django.core.mail import EmailMultiAlternatives
from django.db import models
from django.template import RequestContext, TemplateDoesNotExist
from django.template.loader import render_to... | alawnchen/django-registration | registration/models.py | Python | bsd-3-clause | 12,135 |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""Camino top level namespace
"""
from .connectivity import Conmat
from .convert import (Image2Voxel, FSL2Scheme, VtkStreamlines, ProcStreamlines,
TractShredder, DT2NIfTI, NIfTIDT2Cam... | sgiavasis/nipype | nipype/interfaces/camino/__init__.py | Python | bsd-3-clause | 848 |
"""Top-level import for all CLI-related functionality in apitools.
Note that importing this file will ultimately have side-effects, and
may require imports not available in all environments (such as App
Engine). In particular, picking up some readline-related imports can
cause pain.
"""
# pylint:disable=wildcard-impo... | harshilasu/LinkurApp | y/google-cloud-sdk/lib/googlecloudapis/apitools/base/py/cli.py | Python | gpl-3.0 | 432 |
#!/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'],
... | anryko/ansible | lib/ansible/modules/cloud/amazon/cloudwatchlogs_log_group_info.py | Python | gpl-3.0 | 4,728 |
# 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, software
# distributed under t... | takeshineshiro/keystone | keystone/endpoint_policy/__init__.py | Python | apache-2.0 | 651 |
##########################################################################
#
# Copyright (c) 2017, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistrib... | lucienfostier/gaffer | python/GafferSceneUI/EncapsulateUI.py | Python | bsd-3-clause | 2,924 |
from numpy.random import random
from bokeh.plotting import figure, show, output_file
def mscatter(p, x, y, marker):
p.scatter(x, y, marker=marker, size=15,
line_color="navy", fill_color="orange", alpha=0.5)
def mtext(p, x, y, text):
p.text(x, y, text=[text],
text_color="firebrick", t... | pombredanne/bokeh | examples/plotting/file/markers.py | Python | bsd-3-clause | 1,583 |
# test some extreme cases of allocating exceptions and tracebacks
import micropython
# Check for stackless build, which can't call functions without
# allocating a frame on the heap.
try:
def stackless():
pass
micropython.heap_lock()
stackless()
micropython.heap_unlock()
except RuntimeError:... | MrSurly/micropython | tests/micropython/extreme_exc.py | Python | mit | 3,386 |
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | Eric-Gaudiello/tensorflow_dev | tensorflow_home/tensorflow_venv/lib/python3.4/site-packages/tensorflow/python/ops/logging_ops.py | Python | gpl-3.0 | 2,741 |
# -*- 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... | ahu-odoo/odoo | addons/account/partner.py | Python | agpl-3.0 | 15,435 |
g = 2
i = 2
<warning descr="Non-ASCII character 'ɡ' in the file, but no encoding declared">ɡ</warning> = 1
a = g + i
| siosio/intellij-community | python/testData/inspections/PyNonAsciiCharReferenceInspection/test.py | Python | apache-2.0 | 119 |
def func():
value = "not-none"
# pylint: disable=unused-argument1
<caret>if value is None:
print("None")
# pylint: disable=unused-argument2
print(value)
| siosio/intellij-community | python/testData/intentions/PyInvertIfConditionIntentionTest/commentsPylintNoElseBoth.py | Python | apache-2.0 | 183 |
from itertools import chain
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ValidationError
from django.test import TestCase
import guardian
from guardian.backends import ObjectPermissionBackend
from guardian.exceptions import GuardianError
from guardian.exceptions import... | sumit4iit/django-guardian | guardian/tests/other_test.py | Python | bsd-2-clause | 12,625 |
import numpy as np
import pandas as pd
from bokeh import mpl
from bokeh.plotting import show
ts = pd.Series(np.random.randn(1000), index=pd.date_range('1/1/2000', periods=1000))
ts = ts.cumsum()
df = pd.DataFrame(np.random.randn(1000, 4), index=ts.index, columns=list('ABCD'))
df = df.cumsum()
df.plot(legend=False)
s... | zrhans/python | exemplos/Examples.lnk/bokeh/compat/pandas/dataframe.py | Python | gpl-2.0 | 356 |
import audioop
import sys
import unittest
def pack(width, data):
return b''.join(v.to_bytes(width, sys.byteorder, signed=True) for v in data)
def unpack(width, data):
return [int.from_bytes(data[i: i + width], sys.byteorder, signed=True)
for i in range(0, len(data), width)]
packs = {w: (lambda *d... | Microvellum/Fluid-Designer | win64-vc/2.78/python/lib/test/test_audioop.py | Python | gpl-3.0 | 28,719 |
#!/usr/bin/python
from __future__ import (absolute_import, division, print_function)
# 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 Lic... | kvar/ansible | lib/ansible/modules/network/fortios/fortios_system_replacemsg_traffic_quota.py | Python | gpl-3.0 | 10,207 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2013 Agile Business Group sagl
# (<http://www.agilebg.com>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public ... | andrius-preimantas/purchase-workflow | purchase_order_force_number/__openerp__.py | Python | agpl-3.0 | 1,589 |
from lib.action import PyraxBaseAction
from lib.formatters import to_dns_zone_dict
__all__ = [
'CreateDNSZoneAction'
]
class CreateDNSZoneAction(PyraxBaseAction):
def run(self, name, email_address, ttl=None, comment=None):
cdns = self.pyrax.cloud_dns
zone = cdns.create(name=name, emailAddres... | armab/st2contrib | packs/rackspace/actions/create_dns_zone.py | Python | apache-2.0 | 452 |
#
# 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, software
# ... | dragorosson/heat | heat/db/sqlalchemy/migrate_repo/versions/064_raw_template_predecessor.py | Python | apache-2.0 | 1,809 |
"""Mixin classes for custom array types that don't inherit from ndarray."""
from numpy.core import umath as um
__all__ = ['NDArrayOperatorsMixin']
def _disables_array_ufunc(obj):
"""True when __array_ufunc__ is set to None."""
try:
return obj.__array_ufunc__ is None
except AttributeError:
... | charris/numpy | numpy/lib/mixins.py | Python | bsd-3-clause | 7,052 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017 Google
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
#
... | thaim/ansible | lib/ansible/modules/cloud/google/gcp_resourcemanager_project.py | Python | mit | 12,612 |
# 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 applicab... | infilect/ml-course1 | week4/attention_ocr/python/datasets/unittest_utils.py | Python | mit | 2,107 |
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))
... | bijaydev/Implementation-of-Explicit-congestion-notification-ECN-in-TCP-over-wireless-network-in-ns-3 | src/flow-monitor/bindings/modulegen__gcc_ILP32.py | Python | gpl-2.0 | 454,665 |
########################################################################
#
# (C) 2015, Brian Coca <bcoca@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... | emersonsoftware/ansiblefork | lib/ansible/galaxy/role.py | Python | gpl-3.0 | 14,352 |
import numpy
import os
class ByteOrder:
LittleEndian, BigEndian = range(2)
class FeatureException(Exception):
def __init__(self,msg):
self.msg = msg
def __str__(self):
return repr(self.msg)
def ReadLabel(filename):
labels = numpy.loadtxt(filename, ndmin=1)
return labels.astype(numpy.int32)
class BaseRea... | likelyzhao/mxnet | example/speech-demo/io_func/feat_readers/common.py | Python | apache-2.0 | 1,508 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2014 Akretion
# (<http://www.akretion.com>).
#
# This program is free software: you can redistribute it and/or modify
# it unde... | OpenUpgrade-dev/OpenUpgrade | addons/fleet/migrations/8.0.0.1/post_migration.py | Python | agpl-3.0 | 1,304 |
# 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... | Tesora/tesora-tempest | tempest/api/compute/test_extensions.py | Python | apache-2.0 | 2,079 |
from django.conf import settings
from django.contrib.sites.models import Site
from celery import task
from tower import ugettext as _
from kitsune.sumo.decorators import timeit
from kitsune.sumo import email_utils
@task()
@timeit
def send_award_notification(award):
"""Sends the award notification email
:ar... | orvi2014/kitsune | kitsune/kbadge/tasks.py | Python | bsd-3-clause | 1,390 |
'''
Button Behavior
===============
The :class:`~kivy.uix.behaviors.button.ButtonBehavior`
`mixin <https://en.wikipedia.org/wiki/Mixin>`_ class provides
:class:`~kivy.uix.button.Button` behavior. You can combine this class with
other widgets, such as an :class:`~kivy.uix.image.Image`, to provide
alternative buttons th... | inclement/kivy | kivy/uix/behaviors/button.py | Python | mit | 6,290 |
from __future__ import absolute_import, division, print_function, with_statement
import contextlib
import datetime
import functools
import sys
import textwrap
import time
import platform
import weakref
from tornado.concurrent import return_future, Future
from tornado.escape import url_escape
from tornado.httpclient i... | keen99/SickRage | tornado/test/gen_test.py | Python | gpl-3.0 | 38,133 |
# Copyright (c) 2012 OpenStack Foundation.
# 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 copy of the License a... | rdo-management/neutron | neutron/openstack/common/eventlet_backdoor.py | Python | apache-2.0 | 4,859 |
#!/usr/bin/env python
"""
runtests.py [OPTIONS] [-- ARGS]
Run tests, building the project first.
Examples::
$ python runtests.py
$ python runtests.py -s {SAMPLE_SUBMODULE}
$ python runtests.py -t {SAMPLE_TEST}
$ python runtests.py --ipython
$ python runtests.py --python somescript.py
$ python... | moreati/numpy | runtests.py | Python | bsd-3-clause | 15,724 |
#!/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... | Slezhuk/ansible | lib/ansible/modules/network/nxos/nxos_vpc_interface.py | Python | gpl-3.0 | 11,899 |
class Buffer(object):
"""
A Buffer is a simple FIFO buffer. You write() stuff to it, and you
read() them back. You can also peek() or drain() data.
"""
def __init__(self, data=''):
"""
Initialize a buffer with 'data'.
"""
self.buffer = bytes(data)
def read(self,... | infinity0/obfsproxy | obfsproxy/network/buffer.py | Python | bsd-3-clause | 1,998 |
# coding=utf-8
"""
Write the collected stats to a locally stored log file. Rotate the log file
every night and remove after 7 days.
"""
from Handler import Handler
import logging
import logging.handlers
class ArchiveHandler(Handler):
"""
Implements the Handler abstract class, archiving data to a log file
... | Ormod/Diamond | src/diamond/handler/archive.py | Python | mit | 2,195 |
# -*- encoding: utf-8 -*-
"""
Tests for django.core.servers.
"""
from __future__ import unicode_literals
import os
import socket
try:
from urllib.request import urlopen, HTTPError
except ImportError: # Python 2
from urllib2 import urlopen, HTTPError
from django.core.exceptions import ImproperlyConfigured
... | waseem18/oh-mainline | vendor/packages/Django/tests/regressiontests/servers/tests.py | Python | agpl-3.0 | 5,529 |
# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import gyp
import gyp.common
import gyp.SCons as SCons
import os.path
import pprint
import re
# TODO: remove when we delete the last WriteList() call in this mo... | AlericInglewood/3p-google-breakpad | src/tools/gyp/pylib/gyp/generator/scons.py | Python | bsd-3-clause | 34,839 |
# sqlalchemy/events.py
# Copyright (C) 2005-2015 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""Core event interfaces."""
from . import event, exc
from .pool import Pool
f... | adamwwt/chvac | venv/lib/python2.7/site-packages/sqlalchemy/events.py | Python | mit | 40,130 |
# Copyright 2010-2011 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... | eharney/nova | nova/api/openstack/compute/views/limits.py | Python | apache-2.0 | 3,639 |
#!/usr/bin/python
#coding: utf-8 -*-
# (c) 2013, David Stygstra <david.stygstra@gmail.com>
#
# Portions copyright @ 2015 VMware, Inc.
#
# This file is part of Ansible
#
# 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 Fre... | calamityman/ansible-modules-extras | network/openvswitch_bridge.py | Python | gpl-3.0 | 8,748 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# The path to enlightenment starts with the following:
import unittest
from koans.about_asserts import AboutAsserts
from koans.about_strings import AboutStrings
from koans.about_none import AboutNone
from koans.about_lists import AboutLists
from koans.about_list_assignme... | tokyo-jesus/university | src/python/koans/python3/runner/path_to_enlightenment.py | Python | unlicense | 4,893 |
import unittest
from coalib.core.CircularDependencyError import CircularDependencyError
class CircularDependencyErrorTest(unittest.TestCase):
def test_default_message(self):
with self.assertRaises(CircularDependencyError) as cm:
# test the default case (names is None)
raise Circu... | arjunsinghy96/coala | tests/core/CircularDependencyErrorTest.py | Python | agpl-3.0 | 707 |
import re
import unittest
from urlparse import urlsplit, urlunsplit
from xml.dom.minidom import parseString, Node
from django.conf import settings
from django.core import mail
from django.core.management import call_command
from django.core.urlresolvers import clear_url_caches
from django.db import transaction
from dj... | Shrews/PyGerrit | webapp/django/test/testcases.py | Python | apache-2.0 | 14,719 |
#!/usr/bin/python
# coding: utf-8 -*-
# (c) 2017, Wayne Witzel III <wayne@riotousliving.com>
# 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... | tsdmgz/ansible | lib/ansible/modules/web_infrastructure/ansible_tower/tower_credential.py | Python | gpl-3.0 | 7,515 |
"""This module provides the components needed to build your own __import__
function. Undocumented functions are obsolete.
In most cases it is preferred you consider using the importlib module's
functionality over this module.
"""
# (Probably) need to stay in _imp
from _imp import (lock_held, acquire_lock, release_lo... | Microvellum/Fluid-Designer | win64-vc/2.78/python/lib/imp.py | Python | gpl-3.0 | 10,631 |
# 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... | hsaputra/tensorflow | tensorflow/python/keras/_impl/keras/layers/embeddings_test.py | Python | apache-2.0 | 2,384 |
name1_1_1_0_0_1_0 = None
name1_1_1_0_0_1_1 = None
name1_1_1_0_0_1_2 = None
name1_1_1_0_0_1_3 = None
name1_1_1_0_0_1_4 = None | asedunov/intellij-community | python/testData/completion/heavyStarPropagation/lib/_pkg1/_pkg1_1/_pkg1_1_1/_pkg1_1_1_0/_pkg1_1_1_0_0/_mod1_1_1_0_0_1.py | Python | apache-2.0 | 128 |
# -*- coding: utf-'8' "-*-"
from hashlib import sha1
import logging
from lxml import etree, objectify
from pprint import pformat
import time
from urllib import urlencode
import urllib2
import urlparse
from openerp.addons.payment.models.payment_acquirer import ValidationError
from openerp.addons.payment_ogone.controll... | mycodeday/crm-platform | payment_ogone/models/ogone.py | Python | gpl-3.0 | 19,078 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, Jon Hawkesworth (@jhawkesworth) <figs@unity.demon.co.uk>
#
# 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, eith... | e-gob/plataforma-kioscos-autoatencion | scripts/ansible-play/.venv/lib/python2.7/site-packages/ansible/modules/windows/win_msg.py | Python | bsd-3-clause | 3,581 |
# This module definitely remains in 1.0.x, probably in versions after that too.
import warnings
warnings.warn('gevent.coros has been renamed to gevent.lock', DeprecationWarning, stacklevel=2)
from gevent.lock import *
from gevent.lock import __all__
| matthappens/taskqueue | taskqueue/venv_tq/lib/python2.7/site-packages/gevent/coros.py | Python | mit | 251 |
from __future__ import print_function
#import unittest
import os
import sys
from functools import wraps
from django.conf import settings
from south.hacks import hacks
# Make sure skipping tests is available.
try:
# easiest and best is unittest included in Django>=1.3
from django.utils import unittest
except I... | esplinr/foodcheck | wsgi/foodcheck_proj/south/tests/__init__.py | Python | agpl-3.0 | 3,147 |
""" Python Character Mapping Codec generated from 'VENDORS/APPLE/ARABIC.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='st... | amrdraz/brython | www/src/Lib/encodings/mac_arabic.py | Python | bsd-3-clause | 37,165 |
from __future__ import unicode_literals
from django.contrib.gis.db.models import F, Collect, Count, Extent, Union
from django.contrib.gis.geometry.backend import Geometry
from django.contrib.gis.geos import GEOSGeometry, MultiPoint, Point
from django.db import connection
from django.test import TestCase, skipUnlessDBF... | WillGuan105/django | tests/gis_tests/relatedapp/tests.py | Python | bsd-3-clause | 15,582 |
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# pelisalacarta - XBMC Plugin
# Conector para adfly (acortador de url)
# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
#------------------------------------------------------------
import urlparse,urllib2,urllib,re
import os... | jose36/plugin.video.live.ProyectoLuzDigital- | servers/adfly.py | Python | gpl-2.0 | 2,142 |
"""
18. Using SQL reserved names
Need to use a reserved SQL name as a column name or table name? Need to include
a hyphen in a column or table name? No problem. Django quotes names
appropriately behind the scenes, so your database won't complain about
reserved-name usage.
"""
from django.db import models
from django.... | diegoguimaraes/django | tests/reserved_names/models.py | Python | bsd-3-clause | 910 |
from . import common
from .common import *
| richard-willowit/odoo | odoo/tests/__init__.py | Python | gpl-3.0 | 43 |
from test import support
import unittest
import codecs
import locale
import sys, _testcapi, io
class Queue(object):
"""
queue: write bytes at one end, read bytes from the other end
"""
def __init__(self, buffer):
self._buffer = buffer
def write(self, chars):
self._buffer += chars
... | 837468220/python-for-android | python3-alpha/python3-src/Lib/test/test_codecs.py | Python | apache-2.0 | 64,172 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2011 Chris Dekter
#
# 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 late... | nuclearsandwich/autokey | src/lib/qtui/dialogs.py | Python | gpl-3.0 | 20,532 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# @author Philip
import tarfile as tf
import zipfile as zf
import os, re, shutil, sys, platform
pyversion = platform.python_version()
islinux = platform.system().lower() == 'linux'
if pyversion[:3] in ['2.6', '2.7']:
import urllib as urllib_request
import codecs
o... | AKFourSeven/antoinekougblenou | old/wiki/includes/zhtable/Makefile.py | Python | mit | 13,221 |
import os, sys, json, urlparse, urllib
def get_template(template_basename):
script_directory = os.path.dirname(os.path.abspath(__file__))
template_directory = os.path.abspath(os.path.join(script_directory,
"..",
... | snehasi/servo | tests/wpt/web-platform-tests/referrer-policy/generic/subresource/subresource.py | Python | mpl-2.0 | 3,167 |
#!/usr/bin/env python
# $Id: $
"""
postgresql.conf configuration file reader
Module contents:
readfile() - Read postgresql.conf file
class gucdict - Container for postgresql.conf settings
class setting - Holds one setting
class ConfigurationError - a subclass of EnvironmentError
Example:
import li... | ysung-pivotal/incubator-hawq | tools/bin/gppylib/pgconf.py | Python | apache-2.0 | 10,433 |
# urllib3/request.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
try:
from urllib.parse import urlencode
except ImportError:
from urllib import urlencod... | kristerhedfors/xnet | xnet/packages/urllib3/request.py | Python | bsd-3-clause | 5,873 |
from django.conf import settings
from django.db.backends.postgresql_psycopg2.creation import DatabaseCreation
from django.utils.functional import cached_property
class PostGISCreation(DatabaseCreation):
geom_index_type = 'GIST'
geom_index_ops = 'GIST_GEOMETRY_OPS'
geom_index_ops_nd = 'GIST_GEOMETRY_OPS_ND... | 912/M-new | virtualenvironment/experimental/lib/python2.7/site-packages/django/contrib/gis/db/backends/postgis/creation.py | Python | gpl-2.0 | 4,546 |
# Copyright 2013 Kylin, 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... | redhat-cip/horizon | openstack_dashboard/dashboards/admin/defaults/urls.py | Python | apache-2.0 | 986 |
#
# 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... | YakindanEgitim/EN-LinuxClipper | thrift/transport/TZlibTransport.py | Python | gpl-3.0 | 8,187 |
from btcommon import *
raise NotImplementedError
| olapaola/olapaola-android-scripting | python-modules/pybluez/python/bluetooth/osx.py | Python | apache-2.0 | 50 |
import sys
from m2ext import SSL
from M2Crypto import X509
print "Validating certificate %s using CApath %s" % (sys.argv[1], sys.argv[2])
cert = X509.load_cert(sys.argv[1])
ctx = SSL.Context()
ctx.load_verify_locations(capath=sys.argv[2])
if ctx.validate_certificate(cert):
print "valid"
else:
print "invalid"
| gholt/megacfs | vendor/github.com/cloudflare/cfssl/testdata/test.py | Python | apache-2.0 | 319 |
# Copyright (C) 2001-2006 Python Software Foundation
# Author: Barry Warsaw
# Contact: email-sig@python.org
"""email package exception classes."""
class MessageError(Exception):
"""Base class for errors in the email package."""
class MessageParseError(MessageError):
"""Base class for message... | nmercier/linux-cross-gcc | win32/bin/Lib/email/errors.py | Python | bsd-3-clause | 1,685 |
# -*- coding: utf-8 -*-
# (c) 2016, Hiroaki Nakamura <hnakamur@gmail.com>
#
# This code is part of Ansible, but is an independent component.
# This particular file snippet, and this file snippet only, is BSD licensed.
# Modules you write using this snippet, which is embedded dynamically by Ansible
# still belong to th... | camradal/ansible | lib/ansible/module_utils/lxd.py | Python | gpl-3.0 | 6,180 |
# -*- coding: utf-8 -*-
from south.db import db
from south.v2 import SchemaMigration
try:
from django.contrib.auth import get_user_model
except ImportError: # django < 1.5
from django.contrib.auth.models import User
else:
User = get_user_model()
class Migration(SchemaMigration):
def forwards(self, ... | ramcn/demo3 | venv/lib/python3.4/site-packages/rest_framework/authtoken/south_migrations/0001_initial.py | Python | mit | 3,298 |
# pylint: disable=unused-import
# TODO: eventually move this implementation into the user_api
"""
Django Administration forms module
"""
from student.forms import PasswordResetFormNoActive
| xingyepei/edx-platform | openedx/core/djangoapps/user_api/forms.py | Python | agpl-3.0 | 189 |
"""
Cached, database-backed sessions.
"""
from django.conf import settings
from django.contrib.sessions.backends.db import SessionStore as DBStore
from django.core.cache import cache
KEY_PREFIX = "django.contrib.sessions.cached_db"
class SessionStore(DBStore):
"""
Implements cached, database backed sessions... | ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/lib/django-1.4/django/contrib/sessions/backends/cached_db.py | Python | bsd-3-clause | 1,823 |
#
# Copyright 2016 Peter Sprygada <psprygada@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... | e-gob/plataforma-kioscos-autoatencion | scripts/ansible-play/.venv/lib/python2.7/site-packages/ansible/plugins/action/netconf_config.py | Python | bsd-3-clause | 987 |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | fharenheit/template-spark-app | src/main/python/ml/sql_transformer.py | Python | apache-2.0 | 1,382 |
"""
The server module is responsible for managng the threaded UDP socket server.
This server is used to communicate with Matlab/Simulink simulations. It will be renamed appropriately soon
@todo: rename this module to indicate it's role in any Matlab connections
"""
from __future__ import absolute_import, division, pr... | friend0/tower | tower/server/server.py | Python | isc | 6,756 |
# tests/test_configuration.py
# vim: ai et ts=4 sw=4 sts=4 ft=python fileencoding=utf-8
from io import StringIO
from pcrunner.configuration import (
read_check_commands,
read_check_commands_txt,
read_check_commands_yaml,
)
def test_read_check_commmands_txt_with_extra_lines():
fd = StringIO(
... | maartenq/pcrunner | tests/test_configuration.py | Python | isc | 1,602 |
#!/usr/bin/env python
#Protocol:
# num_files:uint(4)
# repeat num_files times:
# filename:string
# size:uint(8)
# data:bytes(size)
import sys, socket
import os
from time import time
DEFAULT_PORT = 52423
PROGRESSBAR_WIDTH = 50
BUFSIZE = 1024*1024
CONNECTION_TIMEOUT = 3.0
RECEIVE_TIMEOUT = 5.0
if os.name == "nt... | lorian1333/netcopy | netcopy.py | Python | mit | 5,187 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.