repo_name stringlengths 6 100 | path stringlengths 4 294 | copies stringlengths 1 5 | size stringlengths 4 6 | content stringlengths 606 896k | license stringclasses 15
values |
|---|---|---|---|---|---|
isohybrid/dotfile | vim/bundle/git:--github.com-klen-python-mode/pylibs/rope/base/history.py | 115 | 8654 | from rope.base import exceptions, change, taskhandle
class History(object):
"""A class that holds project history"""
def __init__(self, project, maxundos=None):
self.project = project
self._undo_list = []
self._redo_list = []
self._maxundos = maxundos
self._load_histor... | bsd-2-clause |
pankajp/pyface | pyface/action/action_event.py | 2 | 1201 | """ The event passed to an action's 'perform' method. """
# Standard library imports.
import time
# Enthought library imports.
from traits.api import Float, HasTraits, Int
class ActionEvent(HasTraits):
""" The event passed to an action's 'perform' method. """
#### 'ActionEvent' interface #################... | bsd-3-clause |
iacdingping/WebFundamentals | appengine/main.py | 44 | 2895 | #!/usr/bin/env python
#
# Copyright 2014 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | apache-2.0 |
consulo/consulo-python | plugin/src/main/dist/helpers/pydev/third_party/pep8/lib2to3/lib2to3/fixes/fix_tuple_params.py | 324 | 5577 | """Fixer for function definitions with tuple parameters.
def func(((a, b), c), d):
...
->
def func(x, d):
((a, b), c) = x
...
It will also support lambdas:
lambda (x, y): x + y -> lambda t: t[0] + t[1]
# The parens are a syntax error in Python 3
lambda (x): x + y -> lambda x: x + y
"""... | apache-2.0 |
DylanSecreast/uoregon-cis-portfolio | uoregon-cis-471/project-1b/game.py | 8 | 21232 | # game.py
# -------
# Licensing Information: Please do not distribute or publish solutions to this
# project. You are free to use and extend these projects for educational
# purposes. The Pacman AI projects were developed at UC Berkeley, primarily by
# John DeNero (denero@cs.berkeley.edu) and Dan Klein (klein@cs.berkel... | gpl-3.0 |
aioue/ansible | lib/ansible/modules/network/f5/bigip_snmp_trap.py | 41 | 14161 | #!/usr/bin/python
#
# Copyright 2017 F5 Networks Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any lat... | gpl-3.0 |
suto/infernal-twin | build/reportlab/src/reportlab/pdfbase/_fontdata_enc_macroman.py | 56 | 2934 | MacRomanEncoding = (
None, None, None, None, None, None, None, None, None, None, None, None,
None, None, None, None, None, None, None, None, None, None, None, None,
None, None, None, None, None, None, None, None, 'space', 'exclam',
'quotedbl', 'numbers... | gpl-3.0 |
1986ks/chainer | tests/cupy_tests/math_tests/test_explog.py | 12 | 1221 | import unittest
import numpy
from cupy import testing
@testing.gpu
class TestExplog(unittest.TestCase):
_multiprocess_can_split_ = True
@testing.for_all_dtypes()
@testing.numpy_cupy_allclose(atol=1e-5)
def check_unary(self, name, xp, dtype):
numpy.seterr(divide='ignore')
a = testin... | mit |
DSMan195276/protura-binutils | gdb/testsuite/gdb.python/py-events.py | 46 | 4480 | # Copyright (C) 2010-2015 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This progr... | gpl-2.0 |
afb/0install | zeroinstall/injector/handler.py | 1 | 9160 | """
Integrates download callbacks with an external mainloop.
While things are being downloaded, Zero Install returns control to your program.
Your mainloop is responsible for monitoring the state of the downloads and notifying
Zero Install when they are complete.
To do this, you supply a L{Handler} to the L{policy}.
"... | lgpl-2.1 |
OpenDroneMap/WebODM | app/api/common.py | 1 | 1763 | from django.core.exceptions import ObjectDoesNotExist, SuspiciousFileOperation
from rest_framework import exceptions
import os
from app import models
def get_and_check_project(request, project_pk, perms=('view_project',)):
"""
Django comes with a standard `model level` permission system. You can
check whe... | mpl-2.0 |
slank/ansible | lib/ansible/module_utils/api.py | 106 | 3560 | #
# (c) 2015 Brian Ccoa, <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, either version 3 of the License, or
# (at your option) any later versio... | gpl-3.0 |
yanheven/nova | nova/virt/libvirt/remotefs.py | 34 | 2255 | # Copyright 2014 Cloudbase Solutions Srl
# 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 r... | apache-2.0 |
ic-labs/django-icekit | icekit_events/page_types/eventlistingfordate/migrations/0004_auto_20161115_1118.py | 2 | 1204 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('icekit_plugins_image', '0001_initial'),
('eventlistingfordate', '0003_auto_20161019_1906'),
]
operations = [
migrati... | mit |
MostafaGazar/tensorflow | tensorflow/contrib/learn/python/learn/dataframe/dataframe.py | 85 | 4704 | # Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | apache-2.0 |
willusher/ansible-modules-core | files/replace.py | 6 | 5594 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2013, Evan Kaufman <evan@digitalflophouse.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 t... | gpl-3.0 |
oberlin/django | django/templatetags/i18n.py | 219 | 19311 | from __future__ import unicode_literals
import sys
from django.conf import settings
from django.template import Library, Node, TemplateSyntaxError, Variable
from django.template.base import TOKEN_TEXT, TOKEN_VAR, render_value_in_context
from django.template.defaulttags import token_kwargs
from django.utils import six... | bsd-3-clause |
michaelgugino/turbo-lister | flask/testsuite/blueprints.py | 563 | 28089 | # -*- coding: utf-8 -*-
"""
flask.testsuite.blueprints
~~~~~~~~~~~~~~~~~~~~~~~~~~
Blueprints (and currently modules)
:copyright: (c) 2011 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import flask
import unittest
import warnings
from flask.testsuite import FlaskTestCase, emi... | gpl-3.0 |
r39132/airflow | airflow/utils/asciiart.py | 5 | 2542 | # -*- coding: utf-8 -*-
#
# 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
#... | apache-2.0 |
dbtsai/spark | examples/src/main/python/mllib/isotonic_regression_example.py | 27 | 2341 | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | apache-2.0 |
thnee/ansible | lib/ansible/modules/cloud/oneandone/oneandone_firewall_policy.py | 21 | 18690 | #!/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 distributed... | gpl-3.0 |
evewspace/eve-wspace | evewspace/SiteTracker/models.py | 6 | 10750 | # Eve W-Space
# Copyright 2014 Andrew Austin and contributors
#
# 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 requi... | apache-2.0 |
mKeRix/home-assistant | tests/components/upnp/mock_device.py | 14 | 2050 | """Mock device for testing purposes."""
from typing import Mapping
from homeassistant.components.upnp.const import (
BYTES_RECEIVED,
BYTES_SENT,
PACKETS_RECEIVED,
PACKETS_SENT,
TIMESTAMP,
)
from homeassistant.components.upnp.device import Device
import homeassistant.util.dt as dt_util
class Mock... | mit |
lsqtongxin/ryu | ryu/services/protocols/bgp/info_base/vpn.py | 34 | 3720 | # Copyright (C) 2014 Nippon Telegraph and Telephone 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 appli... | apache-2.0 |
person142/scipy | scipy/fft/tests/test_helper.py | 7 | 9706 | from scipy.fft._helper import next_fast_len, _init_nd_shape_and_axes
from numpy.testing import assert_equal, assert_array_equal
from pytest import raises as assert_raises
import pytest
import numpy as np
import sys
_5_smooth_numbers = [
2, 3, 4, 5, 6, 8, 9, 10,
2 * 3 * 5,
2**3 * 3**5,
2**3 * 3**3 * 5**... | bsd-3-clause |
drjeep/django | tests/admin_changelist/models.py | 276 | 2890 | from django.db import models
from django.utils.encoding import python_2_unicode_compatible
class Event(models.Model):
# Oracle can have problems with a column named "date"
date = models.DateField(db_column="event_date")
class Parent(models.Model):
name = models.CharField(max_length=128)
class Child(mo... | bsd-3-clause |
wolfram74/numerical_methods_iserles_notes | venv/lib/python2.7/site-packages/tornado/platform/caresresolver.py | 193 | 3092 | from __future__ import absolute_import, division, print_function, with_statement
import pycares
import socket
from tornado import gen
from tornado.ioloop import IOLoop
from tornado.netutil import Resolver, is_valid_ip
class CaresResolver(Resolver):
"""Name resolver based on the c-ares library.
This is a non... | mit |
morelab/weblabdeusto | server/src/voodoo/sessions/sqlalchemy_data.py | 3 | 1209 | #-*-*- encoding: utf-8 -*-*-
#
# Copyright (C) 2005 onwards University of Deusto
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
# This software consists of contributions made by many individuals,
# listed below:
#
#... | bsd-2-clause |
juanyaw/PTVS | Python/Product/Django/Templates/Projects/DjangoProject/settings.py | 36 | 5582 | """
Django settings for $safeprojectname$ project.
"""
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
# Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'ENGINE': 'django.db.ba... | apache-2.0 |
walbert947/ansible-modules-core | system/authorized_key.py | 9 | 16360 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Ansible module to add authorized_keys for ssh logins.
(c) 2012, Brad Olson <brado@movedbylight.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 ... | gpl-3.0 |
rarbg/ZeroNet | src/lib/pybitcointools/bitcoin/main.py | 20 | 15353 | #!/usr/bin/python
from .py2specials import *
from .py3specials import *
import binascii
import hashlib
import re
import sys
import os
import base64
import time
import random
import hmac
from .ripemd import *
# Elliptic curve parameters (secp256k1)
P = 2**256 - 2**32 - 977
N = 11579208923731619542357098500868790785283... | gpl-2.0 |
dynaryu/inasafe | safe/impact_functions/impact_function_metadata.py | 6 | 33608 | # coding=utf-8
"""
InaSAFE Disaster risk assessment tool developed by AusAid -
**Impact Function Metadata**
Contact : ole.moller.nielsen@gmail.com
.. note:: This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software... | gpl-3.0 |
lwiecek/django | django/contrib/gis/measure.py | 15 | 12471 | # 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 |
hottwaj/django | django/utils/datastructures.py | 394 | 9231 | import copy
from collections import OrderedDict
from django.utils import six
class OrderedSet(object):
"""
A set which keeps the ordering of the inserted items.
Currently backs onto OrderedDict.
"""
def __init__(self, iterable=None):
self.dict = OrderedDict(((x, None) for x in iterable) ... | bsd-3-clause |
nichung/wwwflaskBlogrevA | env/lib/python2.7/site-packages/setuptools/tests/test_dist_info.py | 452 | 2615 | """Test .dist-info style distributions.
"""
import os
import shutil
import tempfile
import unittest
import textwrap
try:
import ast
except:
pass
import pkg_resources
from setuptools.tests.py26compat import skipIf
def DALS(s):
"dedent and left-strip"
return textwrap.dedent(s).lstrip()
class TestDist... | mit |
binhqnguyen/lena-local | src/visualizer/visualizer/plugins/olsr.py | 182 | 3935 | import gtk
import ns.core
import ns.network
import ns.internet
import ns.olsr
from visualizer.base import InformationWindow
class ShowOlsrRoutingTable(InformationWindow):
(
COLUMN_DESTINATION,
COLUMN_NEXT_HOP,
COLUMN_INTERFACE,
COLUMN_NUM_HOPS,
) = range(4)
def __init... | gpl-2.0 |
JingheZ/shogun | examples/undocumented/python_modular/classifier_domainadaptationsvm_modular.py | 17 | 3284 | #!/usr/bin/env python
import numpy
from modshogun import StringCharFeatures, BinaryLabels, DNA
from modshogun import WeightedDegreeStringKernel
from modshogun import SVMLight, DomainAdaptationSVM, MSG_DEBUG
traindna = ['CGCACGTACGTAGCTCGAT',
'CGACGTAGTCGTAGTCGTA',
'CGACGGGGGGGGGGTCGTA',
'CGACC... | gpl-3.0 |
cloudbau/nova | nova/api/manager.py | 27 | 1428 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# 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 compli... | apache-2.0 |
Comunitea/OCB | openerp/cli/scaffold.py | 49 | 4380 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import os
import re
import sys
import jinja2
from . import Command
from openerp.modules.module import (get_module_root, MANIFEST, load_information_from_description_file as load_manifest)
class Scaffold(Command):
""" Generates an Odoo module skeleton... | agpl-3.0 |
zlcnup/csmath | hw4_lm/lm.py | 1 | 2784 | # -*- coding: utf-8 -*-
#!/usr/bin/enzl_v python
from pylab import *
from numpy import *
from math import *
def data_generator(N):
#生成向量函数F:ai*exp(bi*x)的系数数组
zl_mean = [3.4,4.5]
zl_cozl_v = [[1,0],[0,10]]
zl_coff = np.random.multivariate_normal(zl_mean,zl_cozl_v,N)
#生成观测值向量y
x = np.random.unif... | mit |
misterdanb/micropython | tests/extmod/uctypes_sizeof_native.py | 61 | 1036 | import uctypes
S1 = {}
assert uctypes.sizeof(S1) == 0
S2 = {"a": uctypes.UINT8 | 0}
assert uctypes.sizeof(S2) == 1
S3 = {
"a": uctypes.UINT8 | 0,
"b": uctypes.UINT8 | 1,
}
assert uctypes.sizeof(S3) == 2
S4 = {
"a": uctypes.UINT8 | 0,
"b": uctypes.UINT32 | 4,
"c": uctypes.UINT8 | 8,
}
assert ucty... | mit |
aoom/pattern | pattern/text/es/inflect.py | 21 | 18687 | #### PATTERN | ES | INFLECT ########################################################################
# -*- coding: utf-8 -*-
# Copyright (c) 2012 University of Antwerp, Belgium
# Author: Tom De Smedt <tom@organisms.be>
# License: BSD (see LICENSE.txt for details).
######################################################... | bsd-3-clause |
Gaia3D/QGIS | tests/src/python/test_qgsapplication.py | 11 | 1100 | """QGIS Unit tests for QgsApplication.
.. note:: This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
"""
__author__ = 'Tim Sutton (... | gpl-2.0 |
mancoast/CPythonPyc_test | fail/332_test_shelve.py | 34 | 5840 | import unittest
import shelve
import glob
from test import support
from collections.abc import MutableMapping
from test.test_dbm import dbm_iterator
def L1(s):
return s.decode("latin-1")
class byteskeydict(MutableMapping):
"Mapping that supports bytes keys"
def __init__(self):
self.d = {}
de... | gpl-3.0 |
IONISx/edx-platform | common/djangoapps/third_party_auth/migrations/0004_lti_tool_consumers.py | 32 | 11936 | # -*- coding: utf-8 -*-
# pylint: disable=C,E,F,R,W
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 model 'LTIProviderConfig'
db.create_... | agpl-3.0 |
mikeclement/SiK | Firmware/tools/mavtester.py | 9 | 10626 | #!/usr/bin/env python
'''
test MAVLink performance between two radios
'''
import sys, time, os, threading, Queue
from optparse import OptionParser
parser = OptionParser("mavtester.py [options]")
parser.add_option("--baudrate", type='int',
help="connection baud rate", default=57600)
parser.add_opti... | bsd-2-clause |
tfar/RIOT | tests/lwip/tests/01-run.py | 24 | 9890 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2016 Martine Lenders <mail@martine-lenders.eu>
#
# Distributed under terms of the MIT license.
from __future__ import print_function
import argparse
import os, sys
import random
import pexpect
import subprocess
import time
import types
DE... | lgpl-2.1 |
akshatharaj/django | tests/distinct_on_fields/tests.py | 263 | 5996 | from __future__ import unicode_literals
from django.db.models import Max
from django.test import TestCase, skipUnlessDBFeature
from django.test.utils import str_prefix
from .models import Celebrity, Fan, Staff, StaffTag, Tag
@skipUnlessDBFeature('can_distinct_on_fields')
@skipUnlessDBFeature('supports_nullable_uniq... | bsd-3-clause |
bittner/django-allauth | allauth/socialaccount/providers/mailru/views.py | 10 | 1290 | import requests
from hashlib import md5
from allauth.socialaccount.providers.oauth2.views import (
OAuth2Adapter,
OAuth2CallbackView,
OAuth2LoginView,
)
from .provider import MailRuProvider
class MailRuOAuth2Adapter(OAuth2Adapter):
provider_id = MailRuProvider.id
access_token_url = 'https://conn... | mit |
AsgerPetersen/QGIS | python/plugins/processing/algs/grass7/ext/r_li_shannon_ascii.py | 3 | 1385 | # -*- coding: utf-8 -*-
"""
***************************************************************************
r_li_shannon_ascii.py
---------------------
Date : February 2016
Copyright : (C) 2016 by Médéric Ribreux
Email : medspx at medspx dot fr
****************... | gpl-2.0 |
accraze/bitcoin | qa/rpc-tests/receivedby.py | 18 | 7492 | #!/usr/bin/env python2
# Copyright (c) 2014-2015 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
# Exercise the listreceivedbyaddress API
from test_framework.test_framework import BitcoinTestFramework
... | mit |
stack-of-tasks/rbdlpy | tutorial/lib/python2.7/site-packages/OpenGL/GL/MESA/resize_buffers.py | 9 | 1565 | '''OpenGL extension MESA.resize_buffers
This module customises the behaviour of the
OpenGL.raw.GL.MESA.resize_buffers to provide a more
Python-friendly API
Overview (from the spec)
Mesa is often used as a client library with no integration with
the computer's window system (an X server, for example). And since... | lgpl-3.0 |
KimLemon/AKL-Kernel | tools/perf/scripts/python/futex-contention.py | 11261 | 1486 | # futex contention
# (c) 2010, Arnaldo Carvalho de Melo <acme@redhat.com>
# Licensed under the terms of the GNU GPL License version 2
#
# Translation of:
#
# http://sourceware.org/systemtap/wiki/WSFutexContention
#
# to perf python scripting.
#
# Measures futex contention
import os, sys
sys.path.append(os.environ['PER... | gpl-2.0 |
christophlsa/odoo | addons/account/wizard/account_period_close.py | 341 | 2646 | # -*- 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 |
bob-the-hamster/commandergenius | project/jni/python/src/Tools/freeze/makeconfig.py | 37 | 1668 | import re
# Write the config.c file
never = ['marshal', '__main__', '__builtin__', 'sys', 'exceptions']
def makeconfig(infp, outfp, modules, with_ifdef=0):
m1 = re.compile('-- ADDMODULE MARKER 1 --')
m2 = re.compile('-- ADDMODULE MARKER 2 --')
while 1:
line = infp.readline()
if not line:... | lgpl-2.1 |
atizo/pygobject | ltihooks.py | 1 | 2327 | # -*- Mode: Python; py-indent-offset: 4 -*-
# ltihooks.py: python import hooks that understand libtool libraries.
# Copyright (C) 2000 James Henstridge.
#
# 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 Fou... | lgpl-2.1 |
metaron-uk/xbmc | lib/gtest/test/gtest_test_utils.py | 408 | 10444 | #!/usr/bin/env python
#
# Copyright 2006, 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... | gpl-2.0 |
alon/servo | tests/wpt/web-platform-tests/tools/pywebsocket/src/example/internal_error_wsh.py | 465 | 1738 | # Copyright 2012, 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 |
837468220/python-for-android | python-modules/twisted/twisted/trial/test/mockdoctest.py | 64 | 2671 | # Copyright (c) 2001-2004 Twisted Matrix Laboratories.
# See LICENSE for details.
# this module is a trivial class with doctests and a __test__ attribute
# to test trial's doctest support with python2.4
class Counter(object):
"""a simple counter object for testing trial's doctest support
>>> c = Counte... | apache-2.0 |
eBay/cronus-agent | agent/agent/lib/agent_thread/deactivate_manifest.py | 1 | 5040 | #pylint: disable=W0703,R0912,R0915,R0904,W0105
'''
Copyright 2014 eBay Software 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 req... | apache-2.0 |
martbhell/wasthereannhlgamelastnight | src/lib/oauthlib/oauth1/rfc5849/request_validator.py | 6 | 31092 | # -*- coding: utf-8 -*-
"""
oauthlib.oauth1.rfc5849
~~~~~~~~~~~~~~
This module is an implementation of various logic needed
for signing and checking OAuth 1.0 RFC 5849 requests.
"""
from __future__ import absolute_import, unicode_literals
import sys
from . import SIGNATURE_METHODS, utils
class RequestValidator(obj... | mit |
slightstone/SickRage | sickbeard/notifiers/pytivo.py | 13 | 3585 | # Author: Nic Wolfe <nic@wolfeden.ca>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of SickRage.
#
# SickRage 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,... | gpl-3.0 |
prestona/qpid-proton | proton-c/bindings/python/proton/wrapper.py | 4 | 3470 | #
# 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... | apache-2.0 |
AustereCuriosity/astropy | astropy/modeling/tests/test_quantities_fitting.py | 2 | 4268 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Tests that relate to fitting models with quantity parameters
"""
from __future__ import (absolute_import, unicode_literals, division,
print_function)
import numpy as np
from ..models import Gaussian1D
from ... import units a... | bsd-3-clause |
pbrunet/pythran | pythran/tests/openmp.legacy/omp_sections_reduction.py | 4 | 9174 | def omp_sections_reduction():
import math
dt = 0.5
rounding_error = 1.E-9
sum = 7
dsum = 0
dt = 1. / 3.
result = True
product = 1
logic_and = 1
logic_or = 0
bit_and = 1
bit_or = 0
i = 0
exclusiv_bit_or = 0
known_sum = (1000 * 999) / 2 + 7
if 'omp parall... | bsd-3-clause |
thonkify/thonkify | src/lib/Crypto/Protocol/KDF.py | 123 | 5071 | #
# KDF.py : a collection of Key Derivation Functions
#
# Part of the Python Cryptography Toolkit
#
# ===================================================================
# The contents of this file are dedicated to the public domain. To
# the extent that dedication to the public domain is not available,
# everyone is... | mit |
pchaigno/grreat | lib/time_utils.py | 4 | 2416 | #!/usr/bin/env python
"""This file contains various utilities for datetime handling."""
import calendar
import datetime
import re
import time
# Special Windows value for 'the beginning of time'
NULL_FILETIME = datetime.datetime(1601, 1, 1, 0, 0, 0)
# Regex for times in windows wmi converted format 20080726084622.... | apache-2.0 |
Parisson/Telemeta | telemeta/south_migrations/0009_auto__chg_field_mediaitem_language_iso__del_field_userprofile_departem.py | 2 | 45229 | # -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'MediaItem.language_iso'
db.alter_column('media_items', 'language_iso_id', self.gf('teleme... | agpl-3.0 |
cizixs/tftp | tftp/tftp_client.py | 1 | 7600 | import sys
import struct
import binascii
import argparse
import tftp
from tftp import SocketBase
from tftp import get_opcode
from tftp import default_port
from tftp import make_data_packet
from tftp import make_ack_packet
class State(object):
START, DATA = range(2)
# Make packet functions.
def make_request_pa... | mit |
binjitsu/tutorial | walkthrough/remote-network-connection/exploit.py | 2 | 1146 | from pwn import *
# Vortex Level 0 -> Level 1
#
# Level Goal
#
# Your goal is to connect to port 5842 on vortex.labs.overthewire.org and read
# in 4 unsigned integers in host byte order. Add these integers together and
# send back the results to get a username and password for vortex1.
#
# This information can be used... | mit |
baberthal/CouchPotatoServer | libs/html5lib/serializer/htmlserializer.py | 235 | 12897 | from __future__ import absolute_import, division, unicode_literals
from six import text_type
import gettext
_ = gettext.gettext
try:
from functools import reduce
except ImportError:
pass
from ..constants import voidElements, booleanAttributes, spaceCharacters
from ..constants import rcdataElements, entities,... | gpl-3.0 |
nwokeo/supysonic | venv/lib/python2.7/site-packages/pip/_vendor/requests/packages/chardet/eucjpprober.py | 2919 | 3678 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights Reserved.
#
# Con... | agpl-3.0 |
mtconley/turntable | test/lib/python2.7/site-packages/scipy/stats/tests/test_morestats.py | 7 | 38719 | # Author: Travis Oliphant, 2002
#
# Further enhancements and tests added by numerous SciPy developers.
#
from __future__ import division, print_function, absolute_import
import warnings
import numpy as np
from numpy.random import RandomState
from numpy.testing import (TestCase, run_module_suite, assert_array_equal,
... | mit |
mduggan/toumeika | shikin/review.py | 1 | 4611 | # -*- coding: utf-8 -*-
"""
Shikin review page and associated API
"""
from sqlalchemy import func
import datetime
import random
from flask import render_template, abort, request, jsonify, session
from . import app, ocrfix
from .model import DocSegment, DocSegmentReview, User
from .util import dologin
def get_user_o... | bsd-2-clause |
direvus/ansible | lib/ansible/modules/network/nxos/nxos_vxlan_vtep.py | 39 | 10851 | #!/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 |
shuggiefisher/potato | django/contrib/gis/db/models/query.py | 290 | 35968 | from django.db import connections
from django.db.models.query import QuerySet, Q, ValuesQuerySet, ValuesListQuerySet
from django.contrib.gis.db.models import aggregates
from django.contrib.gis.db.models.fields import get_srid_info, GeometryField, PointField, LineStringField
from django.contrib.gis.db.models.sql import... | bsd-3-clause |
falkTX/Cadence | src/systray.py | 1 | 23718 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# KDE, App-Indicator or Qt Systray
# Copyright (C) 2011-2018 Filipe Coelho <falktx@falktx.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; e... | gpl-2.0 |
Griffiths117/TG-s-IRC | client/IRClient.py | 1 | 4985 | import socket, _thread, tkinter as tk, tkinter.ttk as ttk
from time import strftime, sleep
from tkinter import messagebox, simpledialog
#===========================================================================#
class BasicInputDialog:
def __init__(self,question,title=None,hideWindow=True):
if title == ... | mit |
hsaputra/tensorflow | tensorflow/contrib/sparsemax/__init__.py | 106 | 1275 | # Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | apache-2.0 |
patrickglass/creo | creo/packages/creoconfig/tests/test_interactive_prompt.py | 2 | 1305 | #!/usr/bin/env python
"""
Module test_interactive_prompt
"""
import os
import sys
sys.path.append(os.path.realpath('.'))
from creoconfig import Config
def interactive_prompt():
c = Config()
c.add_option(
'strkey',
prefix='Please enter string',
help='This is a string key')
c.add_op... | apache-2.0 |
lgscofield/odoo | openerp/addons/base/module/wizard/base_import_language.py | 337 | 2644 | # -*- 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 |
xunilrj/sandbox | courses/MITx/MITx 6.86x Machine Learning with Python-From Linear Models to Deep Learning/project3/mnist/part2-twodigit/mlp.py | 1 | 2432 | import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from train_utils import batchify_data, run_epoch, train_model, Flatten
import utils_multiMNIST as U
path_to_data_dir = '../Datasets/'
use_mini_dataset = True
batch_size = 64
nb_classes = 10
nb_epoch = 30
num_classes = 10
img_rows, im... | apache-2.0 |
daivietpda/m7-gpe-l | tools/perf/scripts/python/net_dropmonitor.py | 4235 | 1554 | # Monitor the system for dropped packets and proudce a report of drop locations and counts
import os
import sys
sys.path.append(os.environ['PERF_EXEC_PATH'] + \
'/scripts/python/Perf-Trace-Util/lib/Perf/Trace')
from perf_trace_context import *
from Core import *
from Util import *
drop_log = {}
kallsyms = []
def... | gpl-2.0 |
moritzpein/airflow | airflow/operators/hive_to_mysql.py | 9 | 3561 | import logging
from airflow.hooks import HiveServer2Hook, MySqlHook
from airflow.models import BaseOperator
from airflow.utils import apply_defaults
from tempfile import NamedTemporaryFile
class HiveToMySqlTransfer(BaseOperator):
"""
Moves data from Hive to MySQL, note that for now the data is loaded
int... | apache-2.0 |
xxsergzzxx/python-for-android | python3-alpha/python3-src/Lib/smtplib.py | 45 | 35108 | #! /usr/bin/env python3
'''SMTP/ESMTP client class.
This should follow RFC 821 (SMTP), RFC 1869 (ESMTP), RFC 2554 (SMTP
Authentication) and RFC 2487 (Secure SMTP over TLS).
Notes:
Please remember, when doing ESMTP, that the names of the SMTP service
extensions are NOT the same thing as the option keywords for the R... | apache-2.0 |
omni5cience/django-inlineformfield | .tox/py27/lib/python2.7/site-packages/django/contrib/staticfiles/views.py | 78 | 1302 | """
Views and functions for serving static files. These are only to be used during
development, and SHOULD NOT be used in a production setting.
"""
import os
import posixpath
from django.conf import settings
from django.http import Http404
from django.utils.six.moves.urllib.parse import unquote
from django.views impo... | mit |
davehunt/selenium | py/test/unit/selenium/webdriver/ie/test_ie_options.py | 13 | 5556 | # Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | apache-2.0 |
mjgrav2001/scikit-learn | sklearn/decomposition/base.py | 313 | 5647 | """Principal Component Analysis Base Classes"""
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Olivier Grisel <olivier.grisel@ensta.org>
# Mathieu Blondel <mathieu@mblondel.org>
# Denis A. Engemann <d.engemann@fz-juelich.de>
# Kyle Kastner <kastnerkyle@gmail.com>
#
# Licen... | bsd-3-clause |
skywin/p2pool | SOAPpy/Types.py | 289 | 52214 | from __future__ import nested_scopes
"""
################################################################################
# Copyright (c) 2003, Pfizer
# Copyright (c) 2001, Cayce Ullman.
# Copyright (c) 2001, Brian Matthews.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or withou... | gpl-3.0 |
TraceContext/tracecontext-spec | test/server.py | 1 | 3239 | from aiohttp import ClientSession, ClientTimeout, ContentTypeError, web
from multidict import MultiDict
class AsyncTestServer(object):
scopes = {}
def __init__(self, host, port, timeout = 5):
self.host = host
self.port = port
self.timeout = ClientTimeout(total = timeout)
self.app = web.Application()
self.... | apache-2.0 |
markhamstra/spark | examples/src/main/python/sql/arrow.py | 13 | 3997 | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | apache-2.0 |
rosmo/ansible-modules-core | cloud/openstack/os_ironic_node.py | 131 | 12309 | #!/usr/bin/python
# coding: utf-8 -*-
# (c) 2015, Hewlett-Packard Development Company, L.P.
#
# This module is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your optio... | gpl-3.0 |
mnaberez/pypng | code/exnumpy.py | 2 | 4828 | #!/usr/bin/env python
# $URL$
# $Rev$
# Numpy example.
# Original code created by Mel Raab, modified by David Jones.
'''
Example code integrating RGB PNG files, PyPNG and NumPy
(abstracted from Mel Raab's functioning code)
'''
# http://www.python.org/doc/2.4.4/lib/module-itertools.html
import itertools
import n... | mit |
40223101/w16b_test | static/Brython3.1.3-20150514-095342/Lib/threading.py | 730 | 45641 | """Thread module emulating a subset of Java's threading model."""
import sys as _sys
import _thread
from time import sleep as _sleep
try:
from time import monotonic as _time
except ImportError:
from time import time as _time
from traceback import format_exc as _format_exc
from _weakrefset import WeakSet
# No... | agpl-3.0 |
AOSPA-L/android_kernel_oppo_msm8974 | tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Core.py | 11088 | 3246 | # Core.py - Python extension for perf script, core functions
#
# Copyright (C) 2010 by Tom Zanussi <tzanussi@gmail.com>
#
# This software may be distributed under the terms of the GNU General
# Public License ("GPL") version 2 as published by the Free Software
# Foundation.
from collections import defaultdict
def aut... | gpl-2.0 |
azurestandard/django | tests/regressiontests/localflavor/tests.py | 21 | 1815 | from __future__ import absolute_import
from .ar.tests import ARLocalFlavorTests
from .at.tests import ATLocalFlavorTests
from .au.tests import AULocalflavorTests
from .be.tests import BELocalFlavorTests
from .br.tests import BRLocalFlavorTests
from .ca.tests import CALocalFlavorTests
from .ch.tests import CHLocalFlavo... | bsd-3-clause |
spektom/incubator-airflow | airflow/utils/decorators.py | 5 | 3422 | #
# 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... | apache-2.0 |
LegitSavage/namebench | libnamebench/better_webbrowser.py | 175 | 4191 | #!/usr/bin/env python
# Copyright 2009 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... | apache-2.0 |
garretlh/nimbus | nimbus-main/src/main/python/nimbuscfg/config.py | 2 | 3424 | #
# Copyright (c) 2009-2015 Tom Keffer <tkeffer@gmail.com> and
# Matthew Wall
#
# See the file LICENSE.txt for your full rights.
#
"""Utilities for managing the config file"""
import logging
import sys
import os
import stat
import platform
from pkg_resources import resource_string
imp... | gpl-3.0 |
simkarlier/autorad.io | py/mysql/connector/network.py | 5 | 17410 | # MySQL Connector/Python - MySQL driver written in Python.
# Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
# MySQL Connector/Python is licensed under the terms of the GPLv2
# <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
# MySQL Connectors. There are special exceptio... | gpl-3.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.