repo_name stringlengths 5 100 | path stringlengths 4 375 | copies stringclasses 991
values | size stringlengths 4 7 | content stringlengths 666 1M | license stringclasses 15
values |
|---|---|---|---|---|---|
Dreizan/csci1200OnlineCourse | modules/course_explorer/course_explorer.py | 19 | 2859 | # Copyright 2013 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 ... | apache-2.0 |
Alwnikrotikz/open-hea | src/openhea/xlrd/compdoc.py | 64 | 14974 | # -*- coding: cp1252 -*-
##
# Implements the minimal functionality required
# to extract a "Workbook" or "Book" stream (as one big string)
# from an OLE2 Compound Document file.
# <p>Copyright © 2005-2008 Stephen John Machin, Lingfo Pty Ltd</p>
# <p>This module is part of the xlrd package, which is released under a BS... | lgpl-2.1 |
mpSchrader/gym-sokoban | examples/Human_Playing_Commandline.py | 1 | 3725 | import gym
import gym_sokoban
import time
from PIL import Image
import numpy as np
import argparse
import os
parser = argparse.ArgumentParser(description='Run environment with random selected actions.')
parser.add_argument('--rounds', '-r', metavar='rounds', type=int,
help='number of rounds to play... | mit |
popazerty/enigma2-4.3 | lib/python/Components/Sources/EventInfo.py | 85 | 1245 | from Components.PerServiceDisplay import PerServiceBase
from Components.Element import cached
from enigma import iPlayableService, iServiceInformation, eServiceReference, eEPGCache
from Source import Source
class EventInfo(PerServiceBase, Source, object):
NOW = 0
NEXT = 1
def __init__(self, navcore, now_or_next):
... | gpl-2.0 |
xaviercobain88/framework-python | build/lib.linux-i686-2.7/openerp/addons/stock/stock.py | 2 | 157623 | # -*- 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 |
lepistone/odoo | addons/note_pad/note_pad.py | 441 | 1301 | # -*- 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 |
Henrilin28/lightblue-0.4 | src/linux/_obexcommon.py | 49 | 18261 | # Copyright (c) 2009 Bea Lam. All rights reserved.
#
# This file is part of LightBlue.
#
# LightBlue 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 l... | gpl-3.0 |
Jewel-Systems/server | udp.py | 1 | 1268 | import socket
import threading
from log import log
web_server_port = 53455
listen_port = 53456
reply_port = 53457
debug_timeout = 10 # seconds
d = None
def daemon():
# find local IP
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(('8.8.8.8', 0))
local_ip_address = s.getsockname()[0]
... | mit |
40223236/lego | static/Brython3.1.1-20150328-091302/Lib/unittest/test/test_setups.py | 791 | 16440 | import io
import sys
import unittest
def resultFactory(*_):
return unittest.TestResult()
class TestSetups(unittest.TestCase):
def getRunner(self):
return unittest.TextTestRunner(resultclass=resultFactory,
stream=io.StringIO())
def runTests(self, *cases... | agpl-3.0 |
manipopopo/tensorflow | tensorflow/contrib/eager/python/examples/spinn/data_test.py | 42 | 11219 | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | apache-2.0 |
z1gm4/desarrollo_web_udp | env/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/fields.py | 200 | 5872 | from __future__ import absolute_import
import email.utils
import mimetypes
from .packages import six
def guess_content_type(filename, default='application/octet-stream'):
"""
Guess the "Content-Type" of a file.
:param filename:
The filename to guess the "Content-Type" of using :mod:`mimetypes`.
... | gpl-3.0 |
renner/spacewalk | client/tools/rhn-virtualization/virtualization/state.py | 7 | 2331 | #
# Copyright (c) 2008--2013 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a c... | gpl-2.0 |
jniediek/mne-python | mne/channels/tests/test_interpolation.py | 3 | 5400 | import os.path as op
import warnings
import numpy as np
from numpy.testing import (assert_allclose, assert_array_equal)
from nose.tools import assert_raises, assert_equal, assert_true
from mne import io, pick_types, pick_channels, read_events, Epochs
from mne.channels.interpolation import _make_interpolation_matrix
f... | bsd-3-clause |
sergiohgz/incubator-airflow | airflow/www/views.py | 2 | 111267 | # -*- 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 |
alown/chromium | mothership/tools/tiledialog.py | 4 | 4700 | # Copyright (c) 2001, Stanford University
# All rights reserved.
#
# See the file LICENSE.txt for information on redistributing this software.
#
# Authors:
# Brian Paul
"""The TileDialog class is a dialog used to edit a list of tiles for
a server/network node. If the server node is an N-instance node the
dialog wi... | bsd-3-clause |
bbuchalter/python_koans | python3/koans/about_lists.py | 30 | 3202 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Based on AboutArrays in the Ruby Koans
#
from runner.koan import *
class AboutLists(Koan):
def test_creating_lists(self):
empty_list = list()
self.assertEqual(list, type(empty_list))
self.assertEqual(__, len(empty_list))
def test_list... | mit |
mananam/pelican-prajna | prajna/readers.py | 1 | 2368 | # -*- coding: utf-8 -*-
"""Readers for Sloka content."""
from __future__ import unicode_literals, print_function
import json
import logging
from pelican.readers import BaseReader
logger = logging.getLogger(__name__)
class SlokaReader(BaseReader):
"""A commonmarkdown based reader for sanskrit verses.
Uses... | mit |
fengshao0907/fbthrift | thrift/lib/py/server/TServer.py | 14 | 13984 | #
# 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... | apache-2.0 |
onestarshang/flask_super_config | venv/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/__init__.py | 482 | 2055 | """
urllib3 - Thread-safe connection pooling and re-using.
"""
__author__ = 'Andrey Petrov (andrey.petrov@shazow.net)'
__license__ = 'MIT'
__version__ = '1.10.4'
from .connectionpool import (
HTTPConnectionPool,
HTTPSConnectionPool,
connection_from_url
)
from . import exceptions
from .filepost import en... | gpl-2.0 |
weizhenwei/wireshark | tools/wireshark_gen.py | 11 | 100064 | # -*- python -*-
#
# wireshark_gen.py (part of idl2wrs)
#
# Author : Frank Singleton (frank.singleton@ericsson.com)
#
# Copyright (C) 2001 Frank Singleton, Ericsson Inc.
#
# This file is a backend to "omniidl", used to generate "Wireshark"
# dissectors from CORBA IDL descriptions. The output language generated
# ... | gpl-2.0 |
Peddle/hue | desktop/core/ext-py/boto-2.38.0/boto/dynamodb2/fields.py | 163 | 8292 | from boto.dynamodb2.types import STRING
class BaseSchemaField(object):
"""
An abstract class for defining schema fields.
Contains most of the core functionality for the field. Subclasses must
define an ``attr_type`` to pass to DynamoDB.
"""
attr_type = None
def __init__(self, name, data_... | apache-2.0 |
PaulKinlan/cli-caniuse | site/app/scripts/bower_components/jsrepl-build/extern/python/unclosured/lib/python2.7/functools.py | 259 | 4478 | """functools.py - Tools for working with functions and callable objects
"""
# Python module wrapper for _functools C module
# to allow utilities written in Python to be added
# to the functools module.
# Written by Nick Coghlan <ncoghlan at gmail.com>
# Copyright (C) 2006 Python Software Foundation.
# See C source co... | apache-2.0 |
chuckgu/Alphabeta | tensorflow/json_txt.py | 1 | 1272 | # -*- coding: utf-8 -*-
"""
Created on Wed Mar 9 00:35:54 2016
@author: chuckgu
"""
import json,os
from nltk.tokenize import sent_tokenize,word_tokenize
from konlpy.tag import Twitter
import numpy as np
import sys
reload(sys)
sys.setdefaultencoding('utf8')
twitter=Twitter()
txt=[]
checklist=['Exclamation','A... | gpl-3.0 |
trhd/meson | setup.py | 4 | 4010 | #!/usr/bin/env python3
# Copyright 2016 The Meson development team
# 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 appl... | apache-2.0 |
JuliaSprenger/python-neo | neo/io/neuroshareapiio.py | 5 | 19948 | """
Class for "reading" data from Neuroshare compatible files (check neuroshare.org)
It runs through the whole file and searches for: analog signals, spike cutouts,
and trigger events (without duration)
Depends on: Neuroshare API 0.9.1, numpy 1.6.1, quantities 0.10.1
Supported: Read
Author: Andre Maia Chagas
"""
# n... | bsd-3-clause |
syndicate-storage/syndicate-core | python/syndicate/observer/sync.py | 2 | 12422 | #!/usr/bin/env python
"""
Copyright 2014 The Trustees of Princeton University
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... | apache-2.0 |
anirudhSK/chromium | tools/site_compare/operators/equals_with_mask.py | 189 | 1589 | # Copyright (c) 2011 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.
"""Compare two images for equality, subject to a mask."""
from PIL import Image
from PIL import ImageChops
import os.path
def Compare(file1, file2, *... | bsd-3-clause |
jevinw/rec_utilities | babel_util/scripts/arxivmd_to_leveldb.py | 1 | 1158 | #!/usr/bin/env python3
import leveldb
import msgpack
import csv
from util.misc import Benchmark, open_file
REQUIRED_KEYS = {'title', 'paper_id', 'date'}
if __name__ == "__main__":
import argparse
parser = argparse.ArgumentParser(description="Creates a LevelDB of TSV metadata in infile")
parser.add_argumen... | agpl-3.0 |
hayd/contracts | src/contracts/library/__init__.py | 3 | 1109 | from .suggester import create_suggester
from .dummy import Any, Never
from .separate_context import SeparateContext
from .types_misc import Type, CheckType, Number
from .strings import *
from .lists import List
from .seq import Seq
from .tuple import Tuple
from .dicts import Dict
from .map import Map
from .sets import ... | lgpl-3.0 |
EDUlib/edx-platform | lms/djangoapps/program_enrollments/admin.py | 5 | 4269 | """
Admin tool for the Program Enrollments models
"""
from django.contrib import admin
from django.urls import reverse
from django.utils.html import format_html
from lms.djangoapps.program_enrollments.models import (
CourseAccessRoleAssignment,
ProgramCourseEnrollment,
ProgramEnrollment
)
class ProgramEn... | agpl-3.0 |
autowitch/pypov | scenes/geomorphs/lib/environment.py | 1 | 1895 | from pypov.pov import Vector, Texture, Pigment, POV, File, Camera, Cylinder
from pypov.pov import LightSource, Sphere, Finish, Settings, Plane, Box, Cone
from pypov.pov import Checker, SkySphere, Union, GlobalSettings, Radiosity
from pypov.pov import Polygon_4, Difference, Object, parse_args
dark_glass = Texture(
... | mit |
cancro7/gem5 | configs/dram/sweep.py | 4 | 8090 | # Copyright (c) 2014-2015 ARM Limited
# 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 implementation of the functiona... | bsd-3-clause |
sshah-solarflare/Libvirt-PCI-passthrough- | examples/domain-events/events-python/event-test.py | 3 | 17964 | #!/usr/bin/python -u
#
#
#
#################################################################################
# Start off by implementing a general purpose event loop for anyones use
#################################################################################
import sys
import getopt
import os
import libvirt
impor... | lgpl-2.1 |
ATIX-AG/ansible | lib/ansible/modules/system/hostname.py | 34 | 24853 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2013, Hiroaki Nakamura <hnakamur@gmail.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_versi... | gpl-3.0 |
cowenberg/snap | snap_website/users/views.py | 1 | 1850 | from django.shortcuts import render, redirect
from django.http.response import HttpResponse
from users.decorators import user_is_anonymous, user_is_authenticated
from users.models import UserRegistrationForm, UserAuthenticationForm
from django.contrib.auth import logout
from django.contrib import messages
REQUEST_METH... | gpl-2.0 |
rnicoll/bitcoin | test/functional/p2p_unrequested_blocks.py | 35 | 13067 | #!/usr/bin/env python3
# Copyright (c) 2015-2020 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test processing of unrequested blocks.
Setup: two nodes, node0 + node1, not connected to each other. N... | mit |
40223141/0505 | static/Brython3.1.1-20150328-091302/Lib/_thread.py | 740 | 4879 | """Drop-in replacement for the thread module.
Meant to be used as a brain-dead substitute so that threaded code does
not need to be rewritten for when the thread module is not present.
Suggested usage is::
try:
import _thread
except ImportError:
import _dummy_thread as _thread
"""
# Exports ... | agpl-3.0 |
hsaputra/tensorflow | tensorflow/contrib/metrics/python/ops/confusion_matrix_ops.py | 164 | 1319 | # Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | apache-2.0 |
manojpandey/hackenvision16 | tinybank/tinybank/venv/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.py | 1005 | 92627 | #-------------------------------------------------------------------
# tarfile.py
#-------------------------------------------------------------------
# Copyright (C) 2002 Lars Gustaebel <lars@gustaebel.de>
# All rights reserved.
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy ... | mit |
google/dnae | services/service-example/service_example_test.py | 1 | 3295 | # Copyright 2018 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | apache-2.0 |
molobrakos/home-assistant | tests/helpers/test_config_validation.py | 5 | 27755 | """Test config validators."""
from datetime import date, datetime, timedelta
import enum
import os
from socket import _GLOBAL_DEFAULT_TIMEOUT
from unittest.mock import Mock, patch
import uuid
import pytest
import voluptuous as vol
import homeassistant
import homeassistant.helpers.config_validation as cv
def test_bo... | apache-2.0 |
jamiefolsom/edx-platform | common/djangoapps/student/tests/test_login.py | 23 | 25132 | '''
Tests for student activation and login
'''
import json
import unittest
from django.test import TestCase
from django.test.client import Client
from django.test.utils import override_settings
from django.conf import settings
from django.contrib.auth.models import User
from django.core.cache import cache
from django.... | agpl-3.0 |
dudymas/python-openstacksdk | openstack/compute/v2/server_interface.py | 3 | 1503 | # 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... | apache-2.0 |
alqfahad/odoo | addons/event/__openerp__.py | 261 | 2296 | # -*- 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 |
USGSDenverPychron/pychron | pychron/loading/tasks/actions.py | 1 | 1926 | # ===============================================================================
# Copyright 2013 Jake Ross
#
# 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... | apache-2.0 |
eiginn/passpie | passpie/process.py | 1 | 1326 | import logging
import os
from subprocess import Popen, PIPE
from ._compat import *
DEVNULL = open(os.devnull, 'w')
class Proc(Popen):
def communicate(self, **kwargs):
if kwargs.get('input') and isinstance(kwargs['input'], basestring):
kwargs['input'] = kwargs['input'].encode('utf-8')
... | mit |
lucienfostier/gaffer | python/GafferSceneTest/ParentConstraintTest.py | 2 | 6192 | ##########################################################################
#
# Copyright (c) 2013, 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... | bsd-3-clause |
StackOps/fabuloso-catalog-360 | automation/automation.py | 1 | 4992 | # Copyright 2012-2013 STACKOPS TECHNOLOGIES S.L.
#
# 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 applic... | apache-2.0 |
TansyArron/pants | src/python/pants/backend/python/tasks/python_eval.py | 4 | 6324 | # coding=utf-8
# Copyright 2015 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)
import os
import pkg... | apache-2.0 |
gpotter2/scapy | scapy/contrib/automotive/obd/pid/pids_80_9F.py | 5 | 7374 | # This file is part of Scapy
# See http://www.secdev.org/projects/scapy for more information
# Copyright (C) Andreas Korb <andreas.d.korb@gmail.com>
# Copyright (C) Nils Weiss <nils@we155.de>
# This program is published under a GPLv2 license
# scapy.contrib.status = skip
from scapy.fields import StrFixedLenField, Fla... | gpl-2.0 |
ravenland/ycmWinRepo | third_party/ycmd/third_party/jedi/test/completion/basic.py | 8 | 4900 | # -----------------
# cursor position
# -----------------
#? 0 int
int()
#? 3 int
int()
#? 4 str
int(str)
# -----------------
# should not complete
# -----------------
#? []
.
#? []
str..
#? []
a(0):.
# -----------------
# if/else/elif
# -----------------
if 1:
1
elif(3):
a = 3
else:
a = ''
#? int() str... | gpl-3.0 |
janebeckman/gpdb | src/test/tinc/tincrepo/mpp/gpdb/tests/storage/access_methods/duplicate_entries/test_duplicate_entries.py | 7 | 2374 | """
Copyright (c) 2004-Present Pivotal Software, Inc.
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
http://www.apache.... | apache-2.0 |
mavenlin/tensorflow | tensorflow/examples/speech_commands/label_wav_test.py | 53 | 2298 | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | apache-2.0 |
kkouer/PcGcs | Lib/site-packages/numpy/lib/benchmarks/bench_arraysetops.py | 65 | 1615 | import numpy as np
import time
from numpy.lib.arraysetops import *
def bench_unique1d( plot_results = False ):
exponents = np.linspace( 2, 7, 9 )
ratios = []
nItems = []
dt1s = []
dt2s = []
for ii in exponents:
nItem = 10 ** ii
print 'using %d items:' % nItem
a = np.fix... | gpl-3.0 |
staer/mosbius | mosbius/fabfile.py | 1 | 1286 | from __future__ import with_statement
from fabric.api import *
from fabric.contrib.console import confirm
def deploy(revision=''):
if revision!='':
print "Deploying to server using revision: %s" % revision
updateSource(revision)
migrateDatabase()
restartApache()
def backupDatabas... | mit |
matthaywardwebdesign/rethinkdb | test/rql_test/connections/connection_star.py | 10 | 1535 | #!/usr/bin/env python
'''Basic test that `from rethinkdb import *` works'''
import os, sys
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir, os.pardir, "common"))
import driver, utils
dbName, tableName = utils.get_test_db_table()
# -- import rethikndb driver via star method
p... | agpl-3.0 |
Mj258/weiboapi | srapyDemo/envs/Lib/site-packages/win32/Demos/service/nativePipeTestService.py | 15 | 2084 | # This is an example of a service hosted by python.exe rather than
# pythonservice.exe.
# Note that it is very rare that using python.exe is a better option
# than the default pythonservice.exe - the latter has better error handling
# so that if Python itself can't be initialized or there are very early
# import erro... | mit |
synasius/django | tests/template_tests/syntax_tests/test_list_index.py | 521 | 2694 | from django.test import SimpleTestCase
from ..utils import setup
class ListIndexTests(SimpleTestCase):
@setup({'list-index01': '{{ var.1 }}'})
def test_list_index01(self):
"""
List-index syntax allows a template to access a certain item of a
subscriptable object.
"""
... | bsd-3-clause |
pigeonflight/strider-plone | docker/appengine/lib/django-1.5/django/contrib/localflavor/us/forms.py | 101 | 4555 | """
USA-specific Form helpers
"""
from __future__ import absolute_import, unicode_literals
import re
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select, CharField
from django.utils.encoding import smart_text
from django.u... | mit |
westinedu/similarinterest | dbindexer/api.py | 74 | 1119 | from .lookups import LookupDoesNotExist, ExtraFieldLookup
from . import lookups as lookups_module
from .resolver import resolver
import inspect
# TODO: add possibility to add lookup modules
def create_lookup(lookup_def):
for _, cls in inspect.getmembers(lookups_module):
if inspect.isclass(cls) and issubcla... | bsd-3-clause |
gottesmm/swift | utils/swift_build_support/tests/test_host.py | 48 | 2433 | # test_host.py - Unit tests for swift_build_support.cmake -*-- python -*-
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://swift.org/LICENSE.txt for... | apache-2.0 |
brokenjacobs/ansible | lib/ansible/modules/cloud/openstack/os_server_volume.py | 29 | 4905 | #!/usr/bin/python
#coding: utf-8 -*-
# Copyright (c) 2014 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 yo... | gpl-3.0 |
chetan51/nupic | examples/opf/experiments/opfrunexperiment_test/checkpoints/b/description.py | 17 | 2324 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progr... | gpl-3.0 |
boundarydevices/android_external_chromium_org | chrome/common/extensions/docs/server2/api_categorizer_test.py | 10 | 2368 | #!/usr/bin/env python
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import unittest
from api_categorizer import APICategorizer
from compiled_file_system import CompiledFileSystem
from extensions_paths im... | bsd-3-clause |
nowopen/scrapy | tests/test_contracts.py | 140 | 5471 | from unittest import TextTestResult
from twisted.trial import unittest
from scrapy.spiders import Spider
from scrapy.http import Request
from scrapy.item import Item, Field
from scrapy.contracts import ContractsManager
from scrapy.contracts.default import (
UrlContract,
ReturnsContract,
ScrapesContract,
)... | bsd-3-clause |
google/rekall | rekall-core/rekall/plugins/windows/malware/apihooks_test.py | 4 | 1482 | from rekall import addrspace
from rekall import testlib
from rekall.plugins.windows.malware import apihooks
class TestHookHeuristics(testlib.RekallBaseUnitTestCase):
"""Test the hook detection heuristic.
The actual test cases are generated using the nasm assembler in:
rekall/src/hooks/amd64.asm and reka... | gpl-2.0 |
mgaffney/avro | lang/py/src/avro/protocol.py | 2 | 8167 | # 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... | apache-2.0 |
Tiger66639/ansible-modules-core | packaging/os/rhn_register.py | 122 | 12900 | #!/usr/bin/python
# (c) James Laska
#
# 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.
#
# A... | gpl-3.0 |
doptio/you-owe-it | yoi/app.py | 1 | 2787 | from __future__ import unicode_literals, division
from flask import Flask, request, redirect
from flask.ext.sqlalchemy import SQLAlchemy
import os
from raven import Client
from raven.middleware import Sentry
from yoi.account.user import bp as account
from yoi.config import (secret,
database_ur... | mit |
shepdelacreme/ansible | lib/ansible/modules/network/interface/net_linkagg.py | 96 | 2696 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, Ansible by Red Hat, inc
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | gpl-3.0 |
AaltoML/kalman-jax | kalmanjax/likelihoods.py | 1 | 48869 | import jax.numpy as np
from jax.scipy.special import erf, gammaln
from jax import jit, partial, jacrev, random, vmap, grad
from jax.scipy.linalg import cholesky, cho_factor, cho_solve
from utils import inv, softplus, sigmoid, logphi, gaussian_moment_match, softplus_inv, gauss_hermite, \
ensure_positive_precision
pi... | apache-2.0 |
potsmaster/cinder | cinder/openstack/common/scheduler/filters/json_filter.py | 22 | 4914 | # Copyright (c) 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... | apache-2.0 |
kobejean/tensorflow | tensorflow/python/eager/execution_callbacks.py | 11 | 11832 | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | apache-2.0 |
lucastan/django-starter-box | djcdn/filters/__init__.py | 1 | 3858 | from __future__ import unicode_literals
import re
import os.path
import subprocess
import shutil
import tempfile
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
import cssmin as cssmin_mod
import slimit as slimit_mod
from django.conf import settings
from django.core.fi... | mit |
wallnerryan/quantum_migrate | quantum/tests/unit/test_routerserviceinsertion.py | 2 | 18424 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 VMware, 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/lice... | apache-2.0 |
rahushen/ansible | lib/ansible/modules/database/misc/riak.py | 20 | 7457 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2013, James Martin <jmartin@basho.com>, Drew Kerrigan <dkerrigan@basho.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_METAD... | gpl-3.0 |
rghe/ansible | lib/ansible/modules/notification/twilio.py | 47 | 5594 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2015, Matt Makai <matthew.makai@gmail.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',... | gpl-3.0 |
tseaver/gcloud-python | dataproc/google/cloud/dataproc_v1/proto/clusters_pb2.py | 3 | 90026 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/cloud/dataproc_v1/proto/clusters.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.prot... | apache-2.0 |
magne4000/werkzeug | werkzeug/contrib/limiter.py | 365 | 1334 | # -*- coding: utf-8 -*-
"""
werkzeug.contrib.limiter
~~~~~~~~~~~~~~~~~~~~~~~~
A middleware that limits incoming data. This works around problems with
Trac_ or Django_ because those directly stream into the memory.
.. _Trac: http://trac.edgewall.org/
.. _Django: http://www.djangoproject.com/
... | bsd-3-clause |
nrc/servo | tests/wpt/web-platform-tests/tools/pywebsocket/src/test/testdata/handlers/sub/wrong_handshake_sig_wsh.py | 499 | 1859 | # Copyright 2009, 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 |
ad-m/petycja-faoo | docs/conf.py | 2 | 7782 | # -*- coding: utf-8 -*-
#
# ankieta documentation build configuration file, created by
# sphinx-quickstart.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a... | bsd-3-clause |
chenyyx/scikit-learn-doc-zh | examples/en/neighbors/plot_digits_kde_sampling.py | 108 | 2026 | """
=========================
Kernel Density Estimation
=========================
This example shows how kernel density estimation (KDE), a powerful
non-parametric density estimation technique, can be used to learn
a generative model for a dataset. With this generative model in place,
new samples can be drawn. These... | gpl-3.0 |
RobinD42/pyside | tests/QtGui/qpainter_test.py | 6 | 3431 | import unittest
from PySide.QtGui import QPainter, QLinearGradient
from PySide.QtCore import QLine, QLineF, QPoint, QPointF, QRect, QRectF, Qt
class QPainterDrawText(unittest.TestCase):
def setUp(self):
self.painter = QPainter()
self.text = 'teste!'
def tearDown(self):
del self.text
... | lgpl-2.1 |
mp2apps/pesetacoin-master | share/qt/extract_strings_qt.py | 2945 | 1844 | #!/usr/bin/python
'''
Extract _("...") strings for translation and convert to Qt4 stringdefs so that
they can be picked up by Qt linguist.
'''
from subprocess import Popen, PIPE
import glob
import operator
OUT_CPP="src/qt/bitcoinstrings.cpp"
EMPTY=['""']
def parse_po(text):
"""
Parse 'po' format produced by x... | mit |
oxford-pcs/zemax_controller | MeritFunction.py | 1 | 6082 | class MeritFunctionError(Exception):
def __init__(self, message, error):
super(Exception, self).__init__(message)
self.errors = error
class MeritFunction():
'''
This class provides functionality to create a merit function
using Zemax's command DEFAULTMERIT.
To create a merit fnction, a bl... | mit |
dcroc16/skunk_works | google_appengine/lib/django-1.4/django/utils/dateparse.py | 96 | 2896 | """Functions to parse datetime objects."""
# We're using regular expressions rather than time.strptime because:
# - They provide both validation and parsing.
# - They're more flexible for datetimes.
# - The date/datetime/time constructors produce friendlier error messages.
import datetime
import re
from django.utils.... | mit |
leki75/ansible | lib/ansible/module_utils/facts/other/facter.py | 232 | 2985 | # 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 in the hope that ... | gpl-3.0 |
windofthesky/thrift | test/crossrunner/util.py | 55 | 1057 | #
# 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... | apache-2.0 |
cloudtools/troposphere | troposphere/emr.py | 1 | 15025 | # Copyright (c) 2012-2013, Antonio Alonso Dominguez <alonso.domin@gmail.com>
# All rights reserved.
#
# See LICENSE file for full license.
from . import AWSHelperFn, AWSObject, AWSProperty, Tags
from .validators import boolean, defer, double, integer, positive_integer
CHANGE_IN_CAPACITY = "CHANGE_IN_CAPACITY"
PERCENT... | bsd-2-clause |
codefisher/mozbutton_sdk | builder/web_extension.py | 1 | 10238 | import os
import json
import re
from builder.ext_button import Button, get_image, ExtensionConfigError, bytes_string
from builder.locales import WebExtensionLocal, message_name
class WebExtensionButton(Button):
def __init__(self, folders, buttons, settings, applications):
super(WebExtensionButton, self)... | mit |
glaubitz/fs-uae-debian | launcher/fsgs/SignalContext.py | 2 | 1928 | import weakref
from fsbc.signal import Signal
from .contextaware import ContextAware
class SignalBehavior:
def __init__(self, context, parent, names):
parent.__signal_enable_behavior = self
self._context = context
self._parent = weakref.ref(parent)
self._names = set(names)
... | gpl-2.0 |
jimsmith80/android_kernel_zte_warplte | tools/perf/scripts/python/failed-syscalls-by-pid.py | 11180 | 2058 | # failed 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 failed system call totals, broken down by pid.
# If a [comm] arg is specified, only syscalls called by [comm] are displayed.
import os
import sys
sys.pa... | gpl-2.0 |
openplans/streetscore | street_score/project/migrations/0008_auto__add_userinfo.py | 1 | 4037 | # encoding: 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):
# Adding model 'UserInfo'
db.create_table('project_userinfo', (
('id', self.gf('django.db.mode... | mit |
ejpbruel/servo | components/style/properties/build.py | 17 | 2862 | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import json
import os.path
import sys
BASE = os.path.dirname(__file__.replace('\\', '/'))
sys.path.insert(0, os.path.jo... | mpl-2.0 |
mapr/hue | desktop/core/ext-py/Django-1.6.10/django/contrib/gis/db/backends/mysql/compiler.py | 120 | 1089 | from django.contrib.gis.db.models.sql.compiler import GeoSQLCompiler as BaseGeoSQLCompiler
from django.db.backends.mysql import compiler
SQLCompiler = compiler.SQLCompiler
class GeoSQLCompiler(BaseGeoSQLCompiler, SQLCompiler):
def resolve_columns(self, row, fields=()):
"""
Integrate the cases hand... | apache-2.0 |
JayKickliter/gr-ieee802-15-4 | python/qa_deinterleaver_ff.py | 2 | 2345 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2015 Felix Wunsch, Communications Engineering Lab (CEL) / Karlsruhe Institute of Technology (KIT) <wunsch.felix@googlemail.com>.
#
# This is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publis... | gpl-3.0 |
enthought/traitsgui | enthought/pyface/image_button.py | 1 | 10217 | #------------------------------------------------------------------------------
#
# Copyright (c) 2005, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions d... | bsd-3-clause |
drmrd/ansible | lib/ansible/plugins/action/patch.py | 107 | 2644 | # (c) 2015, Brian Coca <briancoca+dev@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) any later v... | gpl-3.0 |
yanchen036/tensorflow | tensorflow/python/kernel_tests/identity_n_op_py_test.py | 58 | 2742 | # Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | apache-2.0 |
mbkumar/pymatgen | setup.py | 1 | 9254 | # coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
"""Setup.py for pymatgen."""
import sys
import platform
from setuptools import setup, find_packages, Extension
from setuptools.command.build_ext import build_ext as _build_ext
class build_ext(_build_ext):
... | mit |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.