repo_name stringlengths 5 100 | path stringlengths 4 294 | copies stringclasses 990
values | size stringlengths 4 7 | content stringlengths 666 1M | license stringclasses 15
values |
|---|---|---|---|---|---|
hemantsangwan/Python-home-assistant | homeassistant/components/light/tellstick.py | 2 | 3083 | """ Support for Tellstick lights. """
import logging
# pylint: disable=no-name-in-module, import-error
from homeassistant.components.light import ATTR_BRIGHTNESS
from homeassistant.const import ATTR_FRIENDLY_NAME
from homeassistant.helpers.device import ToggleDevice
import tellcore.constants as tellcore_constants
def... | mit |
gangadharkadam/contributionerp | erpnext/patches/v5_0/update_item_desc_in_invoice.py | 96 | 1641 | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import frappe
from frappe.website.utils import find_first_image
from frappe.utils import cstr
import re
def execute():
item_details = frappe._dict()
for d in frappe.db.sql("select name, des... | agpl-3.0 |
pigeonflight/strider-plone | docker/appengine/lib/django-1.4/tests/regressiontests/utils/jslex.py | 34 | 9619 | """Tests for jslex."""
# encoding: utf-8
# originally from https://bitbucket.org/ned/jslex
from django.test import TestCase
from django.utils.jslex import JsLexer, prepare_js_for_gettext
class JsTokensTest(TestCase):
LEX_CASES = [
# ids
("a ABC $ _ a123", ["id a", "id ABC", "id $", "id _", "id a12... | mit |
ttfseiko/openerp-trunk | openerp/addons/base/module/report/ir_module_reference_print.py | 384 | 3704 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the... | agpl-3.0 |
sunze/py_flask | venv/lib/python3.4/site-packages/kombu/transport/sqlalchemy/models.py | 38 | 1961 | from __future__ import absolute_import
import datetime
from sqlalchemy import (Column, Integer, String, Text, DateTime,
Sequence, Boolean, ForeignKey, SmallInteger)
from sqlalchemy.orm import relation
from sqlalchemy.ext.declarative import declarative_base, declared_attr
from sqlalchemy.schema... | mit |
msabramo/pip | pip/vcs/subversion.py | 86 | 10632 | from __future__ import absolute_import
import logging
import os
import re
from pip._vendor.six.moves.urllib import parse as urllib_parse
from pip.index import Link
from pip.utils import rmtree, display_path, call_subprocess
from pip.utils.logging import indent_log
from pip.vcs import vcs, VersionControl
_svn_xml_ur... | mit |
biolab/red | examples.py | 1 | 3607 | """
Copyright (C) 2013 Marinka Zitnik <marinka.zitnik@fri.uni-lj.si>
This file is part of Red.
Red is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later ... | gpl-3.0 |
afaheem88/tempest | tempest/services/compute/json/migrations_client.py | 6 | 1231 | # Copyright 2014 NEC Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | apache-2.0 |
sakshambhatla/twitterDataAnalysis | main.py | 1 | 1030 | #!/usr/bin/env python
import tweepy, time
def search_tweets(q, count=100):
return t.search.tweets(q=q, result_type='recent', count=count)
accessFile = open("../accessDetails.txt", "rb")
CONSUMER_KEY = str(accessFile.readline()).rstrip()
CONSUMER_SECRET = str(accessFile.readline()).rstrip()
ACCESS_KEY = str(access... | gpl-2.0 |
alrusdi/lettuce | tests/integration/lib/Django-1.2.5/django/contrib/sites/tests.py | 139 | 2138 | from django.conf import settings
from django.contrib.sites.models import Site, RequestSite, get_current_site
from django.core.exceptions import ObjectDoesNotExist
from django.http import HttpRequest
from django.test import TestCase
class SitesFrameworkTests(TestCase):
def setUp(self):
Site(id=settings.SI... | gpl-3.0 |
JVillella/tensorflow | tensorflow/python/kernel_tests/clip_ops_test.py | 87 | 12131 | # 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 |
cgwalters/anaconda | pyanaconda/ui/tui/spokes/askvnc.py | 2 | 6302 | # Ask vnc text spoke
#
# Copyright (C) 2012 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distributed in the... | gpl-2.0 |
rjhunter8285/nsc-cloudproject-s22016 | api/FlaskApp/FlaskApp/python_modules/oauthlib/oauth2/rfc6749/grant_types/base.py | 35 | 1739 | # -*- coding: utf-8 -*-
"""
oauthlib.oauth2.rfc6749.grant_types
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
from __future__ import unicode_literals, absolute_import
import logging
from oauthlib.oauth2.rfc6749 import errors, utils
log = logging.getLogger(__name__)
class GrantTypeBase(object):
error_uri = None
... | apache-2.0 |
danielefranceschi/mitochondriametrics | src/imageDecorator.py | 1 | 2647 | # import the necessary packages
import string
import cv2
import numpy as np
class ImageDecorator:
@staticmethod
def drawDot(img,x,y,color,size=5):
cv2.circle(img, (int(x), int(y)), size, color, -1)
@staticmethod
def decorateImage(img, features, pixelsPerMetric=1, drawMidPoints=True):
... | gpl-3.0 |
KitKatXperience/platform_external_chromium_org | third_party/closure_linter/closure_linter/javascripttokens.py | 266 | 4955 | #!/usr/bin/env python
#
# Copyright 2008 The Closure Linter 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
#... | bsd-3-clause |
skoppisetty/idigbio-appliance | lib/sqlalchemy/exc.py | 17 | 10556 | # sqlalchemy/exc.py
# Copyright (C) 2005-2012 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
"""Exceptions used with SQLAlchemy.
The base exception class is :class:`.SQLAlchemy... | gpl-3.0 |
miacro/pkget | pkget/test/test_yaml.py | 1 | 3955 | import unittest
import os
from pkget import Yaml
class YamlTest(unittest.TestCase):
def test_load_all(self):
def test_load_all(*args, **kwargs):
result = []
for item in Yaml.load_all(*args, **kwargs):
result.append(item)
return result
def assert... | gpl-3.0 |
khagler/boto | boto/gs/connection.py | 157 | 5478 | # Copyright 2010 Google Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish, dis-
# trib... | mit |
DanialLiu/SkiaWin32Port | third_party/externals/gyp/test/mac/gyptest-ldflags.py | 244 | 1864 | #!/usr/bin/env python
# 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.
"""
Verifies that filenames passed to various linker flags are converted into
build-directory relative paths correctly.
"""
import TestGyp
... | bsd-3-clause |
tomaszhof/python | scripts/dicomSender.py | 1 | 2034 | import os
import sys
import shlex, subprocess
from multiprocessing import Process, Pool
def psend(fname):
command_line = "~/tools/dcm4/dcm4che-2.0.28/bin/dcmsnd DCM@mdc.scape.psnc.pl:7183 " + fname + " -keystore ~/keys/wcpit/wcpit-keystore.jks -keystorepw wcpit. -truststore ~/keys/wcpit/wcpit-truststore.jks -trustst... | apache-2.0 |
ashhher3/cvxpy | cvxpy/tests/test_scs.py | 11 | 6736 | """
Copyright 2013 Steven Diamond, Eric Chu
This file is part of CVXPY.
CVXPY 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.
CVXPY is dis... | gpl-3.0 |
rectory-school/rectory-apps | detention_notifier/management/commands/send_detentions.py | 1 | 2557 | #!/usr/bin/python
import logging
from datetime import date, datetime
import time
import traceback
from django.core.management.base import BaseCommand, CommandError
from django.db import transaction
from django.core.mail import send_mail
from django.utils import timezone
from detention_notifier.models import Detenti... | mit |
tastynoodle/django | tests/m2m_intermediary/models.py | 114 | 1262 | """
9. Many-to-many relationships via an intermediary table
For many-to-many relationships that need extra fields on the intermediary
table, use an intermediary model.
In this example, an ``Article`` can have multiple ``Reporter`` objects, and
each ``Article``-``Reporter`` combination (a ``Writer``) has a ``position`... | bsd-3-clause |
zangree/ryu | ryu/services/protocols/bgp/info_base/ipv6.py | 47 | 2988 | # 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 |
tobspr/panda3d | direct/src/stdpy/file.py | 10 | 12313 | """ This module reimplements Python's file I/O mechanisms using Panda
constructs. This enables Python to interface more easily with Panda's
virtual file system, and it also better-supports Panda's
SIMPLE_THREADS model, by avoiding blocking all threads while waiting
for I/O to complete. """
__all__ = [
'open', 'li... | bsd-3-clause |
ilovezy/three.js | utils/exporters/blender/addons/io_three/exporter/api/light.py | 195 | 1099 | from bpy import data, types
from .. import utilities, logger
def _lamp(func):
"""
:param func:
"""
def inner(name, *args, **kwargs):
"""
:param name:
:param *args:
:param **kwargs:
"""
if isinstance(name, types.Lamp):
lamp = name
... | mit |
martinwicke/tensorflow | tensorflow/tools/quantization/quantize_graph.py | 6 | 55970 | # 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 |
akaariai/django | tests/admin_docs/models.py | 82 | 1592 | """
Models for testing various aspects of the djang.contrib.admindocs app
"""
from django.db import models
class Company(models.Model):
name = models.CharField(max_length=200)
class Group(models.Model):
name = models.CharField(max_length=200)
class Family(models.Model):
last_name = models.CharField(m... | bsd-3-clause |
krzk/tizen-tv-rpi-linux | arch/ia64/scripts/unwcheck.py | 13143 | 1714 | #!/usr/bin/python
#
# Usage: unwcheck.py FILE
#
# This script checks the unwind info of each function in file FILE
# and verifies that the sum of the region-lengths matches the total
# length of the function.
#
# Based on a shell/awk script originally written by Harish Patil,
# which was converted to Perl by Matthew Ch... | gpl-2.0 |
glensc/libcomps | libcomps/src/python/tests/test_merge_comps.py | 1 | 1916 | #!/usr/bin/python
# -*- coding: utf-8 -*-
import unittest
import utest
try:
import _libpycomps as libcomps
except ImportError:
import libcomps
class TestMergeComps(unittest.TestCase):
def setUp(self):
self.maxDiff = None
self.comps = libcomps.Comps()
def test_merge_1_1(self):
... | gpl-2.0 |
starrify/scrapy | scrapy/downloadermiddlewares/redirect.py | 6 | 4501 | import logging
from urllib.parse import urljoin, urlparse
from w3lib.url import safe_url_string
from scrapy.http import HtmlResponse
from scrapy.utils.response import get_meta_refresh
from scrapy.exceptions import IgnoreRequest, NotConfigured
logger = logging.getLogger(__name__)
class BaseRedirectMiddleware:
... | bsd-3-clause |
jemmyw/ansible-modules-extras | system/at.py | 146 | 6419 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# (c) 2014, Richard Isaacson <richard.c.isaacson@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 versi... | gpl-3.0 |
RunningLight/machinekit | share/gscreen/skins/industrial/industrial_handler.py | 20 | 17237 | import hal
import gtk
import gladevcp.makepins # needed for the dialog's calulator widget
import pango
_MAN = 0;_MDI = 1;_AUTO = 2;_LOCKTOGGLE = 1
# This is a handler file for using Gscreen's infrastructure
# to load a completely custom glade screen
# The only things that really matters is that it's saved as a GTK bu... | lgpl-2.1 |
J861449197/edx-platform | common/lib/xmodule/xmodule/modulestore/split_mongo/mongo_connection.py | 35 | 20486 | """
Segregation of pymongo functions from the data modeling mechanisms for split modulestore.
"""
import datetime
import cPickle as pickle
import math
import zlib
import pymongo
import pytz
import re
from contextlib import contextmanager
from time import time
# Import this just to export it
from pymongo.errors import ... | agpl-3.0 |
tarikkdiry/Flock | sqlalchemy-workspace/lib/python2.7/site-packages/wheel/signatures/ed25519py.py | 565 | 1695 | # -*- coding: utf-8 -*-
import warnings
import os
from collections import namedtuple
from . import djbec
__all__ = ['crypto_sign', 'crypto_sign_open', 'crypto_sign_keypair', 'Keypair',
'PUBLICKEYBYTES', 'SECRETKEYBYTES', 'SIGNATUREBYTES']
PUBLICKEYBYTES=32
SECRETKEYBYTES=64
SIGNATUREBYTES=64
Keypair = n... | bsd-3-clause |
jiajiax/crosswalk-test-suite | wrt/wrt-packertool2-android-tests/packertool2/projectdirtest.py | 4 | 4789 | #!/usr/bin/env python
#
# Copyright (c) 2015 Intel Corporation.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of works must retain the original copyright notice, this
# list of conditions and t... | bsd-3-clause |
bastik/youtube-dl | youtube_dl/extractor/cinchcast.py | 177 | 1678 | # coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
unified_strdate,
xpath_text,
)
class CinchcastIE(InfoExtractor):
_VALID_URL = r'https?://player\.cinchcast\.com/.*?assetId=(?P<id>[0-9]+)'
_TEST = {
# Actual test is run in generic,... | unlicense |
microcom/odoo | addons/gamification/models/res_users.py | 47 | 3150 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp.osv import osv
from challenge import MAX_VISIBILITY_RANKING
class res_users_gamification_group(osv.Model):
""" Update of res.users class
- if adding groups to an user, check gamification.challen... | agpl-3.0 |
Kabele/bootstrap | test-infra/s3_cache.py | 2166 | 5734 | #!/usr/bin/env python2.7
# pylint: disable=C0301
from __future__ import absolute_import, unicode_literals, print_function, division
from sys import argv
from os import environ, stat, chdir, remove as _delete_file
from os.path import dirname, basename, abspath, realpath, expandvars
from hashlib import sha256
from subpr... | mit |
saumishr/django | tests/regressiontests/admin_custom_urls/models.py | 42 | 1467 | from functools import update_wrapper
from django.contrib import admin
from django.db import models
class Action(models.Model):
name = models.CharField(max_length=50, primary_key=True)
description = models.CharField(max_length=70)
def __unicode__(self):
return self.name
class ActionAdmin(admin.... | bsd-3-clause |
rerobins/django_auth_addon | django_auth_addon/backend/google_authentication.py | 1 | 3221 | from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.auth.backends import ModelBackend
from apiclient.discovery import build
import httplib2
import json
from uuid import uuid4
from oauth2client.client import flow_from_clientsecrets
from oauth2client.client import FlowExchange... | bsd-3-clause |
openpolis/rst2pdf-patched-docutils-0.8 | rst2pdf/tests/input/sphinx-issue162/conf.py | 9 | 7189 | # -*- coding: utf-8 -*-
#
# issue162 documentation build configuration file, created by
# sphinx-quickstart on Tue Aug 18 22:54:33 2009.
#
# 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.
#
# Al... | mit |
jinankjain/zamboni | apps/amo/tests/test_storage_utils.py | 7 | 4706 | from functools import partial
import os
import tempfile
import unittest
from django.core.files.base import ContentFile
from django.core.files.storage import default_storage as storage
from nose.tools import eq_
from amo.storage_utils import (walk_storage, copy_stored_file,
move_stored_... | bsd-3-clause |
ianj-als/pcl | src/pclc/parser/component.py | 1 | 3739 | #
# Copyright Capita Translation and Interpreting 2013
#
# This file is part of Pipeline Creation Language (PCL).
#
# Pipeline Creation Language (PCL) 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 ve... | gpl-3.0 |
ambitioninc/django-activatable-model | activatable_model/validation.py | 1 | 2222 | from itertools import chain
from activatable_model.models import BaseActivatableModel
from django.apps import apps
from django.core.exceptions import ValidationError
from django.db import models
def get_activatable_models():
all_models = chain(*[app.get_models() for app in apps.get_app_configs()])
return [mo... | mit |
SamYaple/ansible-modules-extras | windows/win_iis_website.py | 69 | 3682 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2015, Henrik Wallström <henrik@wallstroms.nu>
#
# 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 |
valtech-mooc/edx-platform | lms/djangoapps/mobile_api/users/views.py | 8 | 9282 | """
Views for user API
"""
from django.shortcuts import redirect
from django.utils import dateparse
from rest_framework import generics, views
from rest_framework.decorators import api_view
from rest_framework.response import Response
from opaque_keys.edx.keys import UsageKey
from opaque_keys import InvalidKeyError
... | agpl-3.0 |
sankhesh/VTK | Rendering/Core/Testing/Python/TestCameraInterpolator.py | 20 | 3316 | #!/usr/bin/env python
import vtk
from vtk.test import Testing
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
lut = vtk.vtkLookupTable()
lut.SetHueRange(0.6, 0)
lut.SetSaturationRange(1.0, 0)
lut.SetValueRange(0.5, 1.0)
# Read the data: a height field results
demReader = vtk.vtkDEMReader()
d... | bsd-3-clause |
k0001/mscrap | mscrap/mscrap/constants.py | 1 | 16105 | # -*- coding: utf-8 -*-
DISTRITOS_NORM = {
u'rio negro' : u'Río Negro',
u'catamarca' : u'Catamarca',
u'santiago del estero' : u'Santiago del Estero',
u'la rioja' : u'La Rioja',
u'buenos aires' : u... | bsd-3-clause |
lahosken/pants | src/python/pants/stats/statsdb.py | 16 | 5058 | # 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 sql... | apache-2.0 |
bhupennewalkar1337/erpnext | erpnext/accounts/doctype/sales_invoice/pos.py | 2 | 10968 | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe, json
from frappe import _
from frappe.utils import nowdate
from erpnext.setup.utils import get_exchange_rate
from erpnext.stock.get_item_... | gpl-3.0 |
piqueserver/piqueserver | piqueserver/scripts/protect.py | 2 | 2409 | """
Protects areas against block destroying/building.
Commands
^^^^^^^^
* ``/protect <area coordinates>`` puts an area under protected status *admin only*
* ``/protect`` clears all protected areas *admin only*
.. codeauthor:: hompy
"""
from piqueserver.commands import command, admin
from pyspades.common import coor... | gpl-3.0 |
gratefulfrog/lib | python/pymol/colorramping.py | 1 | 13994 | import math
class ColorPoint:
"""
Simple color-storage class; stores way-points on a color ramp
"""
def __init__(self,idx,col,colType):
# index, X-coordinate, on a palette
self.idx = idx
# color; usually an RGBA quad
self.color = col
# One of ColorTypes members
... | gpl-2.0 |
mancoast/CPythonPyc_test | cpython/231_string_tests.py | 7 | 30084 | """
Common tests shared by test_str, test_unicode, test_userstring and test_string.
"""
import unittest, string, sys
from test import test_support
from UserList import UserList
class Sequence:
def __init__(self, seq='wxyz'): self.seq = seq
def __len__(self): return len(self.seq)
def __getitem__(self, i): ... | gpl-3.0 |
mancoast/CPythonPyc_test | fail/331_test_posixpath.py | 1 | 26081 | import itertools
import os
import posixpath
import sys
import unittest
import warnings
from posixpath import realpath, abspath, dirname, basename
from test import support, test_genericpath
try:
import posix
except ImportError:
posix = None
# An absolute path to a temporary filename for testing. We can't rely ... | gpl-3.0 |
jiangyonghang/bitcoin | test/functional/replace-by-fee.py | 10 | 20698 | #!/usr/bin/env python3
# Copyright (c) 2014-2016 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 the RBF code."""
from test_framework.test_framework import BitcoinTestFramework
from test_framewo... | mit |
tomdee/calico-containers | calicoctl/tests/unit/node_test.py | 2 | 41982 | # Copyright 2015 Metaswitch Networks
#
# 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 w... | apache-2.0 |
mcking49/apache-flask | Python/Lib/site-packages/simplejson/compat.py | 155 | 1036 | """Python 3 compatibility shims
"""
import sys
if sys.version_info[0] < 3:
PY3 = False
def b(s):
return s
def u(s):
return unicode(s, 'unicode_escape')
import cStringIO as StringIO
StringIO = BytesIO = StringIO.StringIO
text_type = unicode
binary_type = str
string_types =... | mit |
imsally/redash | redash/handlers/data_sources.py | 5 | 5528 | import logging
from flask import make_response, request
from flask_restful import abort
from funcy import project
from redash import models
from redash.utils.configuration import ConfigurationContainer, ValidationError
from redash.permissions import require_admin, require_permission, require_access, view_only
from red... | bsd-2-clause |
splunk/splunk-demo-yelp-search-command | bin/requests/packages/charade/latin1prober.py | 50 | 5387 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is Mozilla Universal charset detector code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 2001
# the Initial Developer.... | apache-2.0 |
martong/python-mode | pymode/libs2/rope/base/oi/runmod.py | 27 | 7631 |
def __rope_start_everything():
import os
import sys
import socket
import cPickle as pickle
import marshal
import inspect
import types
import threading
class _MessageSender(object):
def send_data(self, data):
pass
class _SocketSender(_MessageSender):
... | lgpl-3.0 |
damonkohler/sl4a | python-build/python-libs/gdata/src/atom/mock_http.py | 278 | 4474 | #!/usr/bin/python
#
# Copyright (C) 2008 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 ... | apache-2.0 |
stephen-soltesz/collectd-mlab | site-packages/mlab/disco/route.py | 2 | 2298 | """Implements a minimally compatible form of netifaces.gateways."""
import netifaces
# Path to the routing table file under the /proc filesystem.
_ROUTE_FILENAME = '/proc/net/route'
# The default IPv4 route address as reported by /proc/net/route.
_ROUTE_DEFAULT_ADDR = '00000000'
AF_INET = netifaces.AF_INET
# TODO... | apache-2.0 |
Ballz0fSteel/Umeko | lib/aiohttp/_ws_impl.py | 20 | 14844 | """WebSocket protocol versions 13 and 8."""
import base64
import binascii
import collections
import hashlib
import json
import os
import random
import sys
from enum import IntEnum
from struct import Struct
from aiohttp import errors, hdrs
from aiohttp.log import ws_logger
__all__ = ('WebSocketParser', 'WebSocketWrit... | gpl-3.0 |
shakamunyi/nova | nova/openstack/common/versionutils.py | 4 | 7305 | # Copyright (c) 2013 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 |
darkk/ansible | lib/ansible/utils/module_docs_fragments/files.py | 8 | 4027 | # (c) 2014, Matt Martz <matt@sivel.net>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
... | gpl-3.0 |
XiaodunServerGroup/xiaodun-platform | cms/djangoapps/contentstore/tests/test_transcripts_utils.py | 6 | 18269 | """ Tests for transcripts_utils. """
import unittest
from uuid import uuid4
import copy
import textwrap
from mock import patch, Mock
from pymongo import MongoClient
from django.test.utils import override_settings
from django.conf import settings
from django.utils import translation
from nose.plugins.skip import Skip... | agpl-3.0 |
naslanidis/ansible | lib/ansible/modules/cloud/cloudstack/cs_affinitygroup.py | 48 | 7633 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# (c) 2015, René Moser <mail@renemoser.net>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the Lice... | gpl-3.0 |
cuongnv23/ansible | lib/ansible/modules/network/nxos/nxos_vrrp.py | 23 | 12514 | #!/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 |
spulec/moto | moto/sqs/exceptions.py | 1 | 3660 | from __future__ import unicode_literals
from moto.core.exceptions import RESTError
class MessageNotInflight(Exception):
description = "The message referred to is not in flight."
status_code = 400
class ReceiptHandleIsInvalid(RESTError):
code = 400
def __init__(self):
super(ReceiptHandleIsIn... | apache-2.0 |
x303597316/hue | desktop/core/ext-py/Django-1.6.10/tests/tablespaces/models.py | 150 | 1819 | from django.db import models
# Since the test database doesn't have tablespaces, it's impossible for Django
# to create the tables for models where db_tablespace is set. To avoid this
# problem, we mark the models as unmanaged, and temporarily revert them to
# managed during each test. We also set them to use the same... | apache-2.0 |
Kniyl/mezzanine | mezzanine/blog/views.py | 1 | 3433 | from __future__ import unicode_literals
from future.builtins import str
from future.builtins import int
from calendar import month_name
from django.contrib.auth import get_user_model
from django.http import Http404
from django.shortcuts import get_object_or_404
from mezzanine.blog.models import BlogPost, BlogCategory... | bsd-2-clause |
Emergya/icm-openedx-educamadrid-platform-basic | lms/djangoapps/mailing/management/commands/mailchimp_id.py | 155 | 1629 | """
mailchimp_id: Returns whether or not a given mailchimp key represents
a valid list.
"""
import sys
from optparse import make_option
from django.core.management.base import BaseCommand, CommandError
from mailsnake import MailSnake
class Command(BaseCommand):
"""
Given a mailchimp key, validates that a li... | agpl-3.0 |
mrabbah/snmpccgx | flask/lib/python2.7/site-packages/click/_textwrap.py | 282 | 1198 | import textwrap
from contextlib import contextmanager
class TextWrapper(textwrap.TextWrapper):
def _handle_long_word(self, reversed_chunks, cur_line, cur_len, width):
space_left = max(width - cur_len, 1)
if self.break_long_words:
last = reversed_chunks[-1]
cut = last[:spa... | gpl-3.0 |
Batterfii/django | django/forms/utils.py | 241 | 6131 | from __future__ import unicode_literals
import json
import sys
from django.conf import settings
from django.core.exceptions import ValidationError # backwards compatibility
from django.utils import six, timezone
from django.utils.encoding import force_text, python_2_unicode_compatible
from django.utils.html import e... | bsd-3-clause |
edry/edx-platform | openedx/core/djangoapps/content/course_overviews/migrations/0005_add_enrollment_fields.py | 57 | 5537 | # -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# The default values for these new columns may not match the actual
# val... | agpl-3.0 |
Orochimarufan/youtube-dl | youtube_dl/extractor/generic.py | 3 | 142659 | # coding: utf-8
from __future__ import unicode_literals
import os
import re
import sys
from .common import InfoExtractor
from .youtube import YoutubeIE
from ..compat import (
compat_etree_fromstring,
compat_str,
compat_urllib_parse_unquote,
compat_urlparse,
compat_xml_parse_error,
)
from ..utils ... | unlicense |
ccgreen13/theharvester | discovery/shodan/api.py | 24 | 7784 | try:
from json import dumps, loads
except:
from simplejson import dumps, loads
from urllib2 import urlopen
from urllib import urlencode
__all__ = ['WebAPI']
class WebAPIError(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return self.valu... | gpl-2.0 |
mSenyor/kivy | kivy/input/providers/wm_common.py | 57 | 1439 | '''
Common definitions for a Windows provider
=========================================
This file provides common definitions for constants used by WM_Touch / WM_Pen.
'''
WM_MOUSEFIRST = 512
WM_MOUSEMOVE = 512
WM_LBUTTONDOWN = 513
WM_LBUTTONUP = 514
WM_LBUTTONDBLCLK = 515
WM_RBUTTONDOWN = 516
WM_RBUTTONUP = 517
WM_RB... | mit |
aselle/tensorflow | tensorflow/python/framework/graph_to_function_def.py | 48 | 6943 | # 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 |
nvoron23/statsmodels | statsmodels/examples/ex_generic_mle.py | 32 | 16462 |
from __future__ import print_function
import numpy as np
from scipy import stats
import statsmodels.api as sm
from statsmodels.base.model import GenericLikelihoodModel
data = sm.datasets.spector.load()
data.exog = sm.add_constant(data.exog, prepend=False)
# in this dir
probit_mod = sm.Probit(data.endog, data.exog)
... | bsd-3-clause |
endlessm/chromium-browser | native_client/tests/testutils.py | 9 | 1150 | # Copyright 2009 The Native Client 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 shutil
import subprocess
import tempfile
import unittest
# From http://lackingrhoticity.blogspot.com/2008/11/tempdirtestcase-python-unittest-he... | bsd-3-clause |
jjs0sbw/CSPLN | apps/scaffolding/linux/web2py/gluon/contrib/login_methods/dropbox_account.py | 42 | 4563 | #!/usr/bin/env python
# coding: utf8
"""
Dropbox Authentication for web2py
Developed by Massimo Di Pierro (2012)
Same License as Web2py License
"""
# mind here session is dropbox session, not current.session
import os
import re
import urllib
from dropbox import client, rest, session
from gluon import *
from gluon.to... | gpl-3.0 |
baylee-d/osf.io | addons/github/tests/test_models.py | 6 | 14682 | # -*- coding: utf-8 -*-
import mock
import pytest
import unittest
from json import dumps
from addons.base.tests.models import (OAuthAddonNodeSettingsTestSuiteMixin,
OAuthAddonUserSettingTestSuiteMixin)
from addons.github.models import NodeSettings
from addons.github.tests import ... | apache-2.0 |
dipakvwarade/pychef | chef/tests/test_api.py | 3 | 1062 | import os
import unittest2
from chef.api import ChefAPI
class APITestCase(unittest2.TestCase):
def load(self, path):
path = os.path.join(os.path.dirname(__file__), 'configs', path)
return ChefAPI.from_config_file(path)
def test_basic(self):
api = self.load('basic.rb')
self.as... | apache-2.0 |
yencarnacion/jaikuengine | .google_appengine/lib/django-1.3/django/db/models/sql/query.py | 30 | 82774 | """
Create SQL statements for QuerySets.
The code in here encapsulates all of the SQL construction so that QuerySets
themselves do not have to (and could be backed by things other than SQL
databases). The abstraction barrier only works one way: this module has to know
all about the internals of models in order to get ... | apache-2.0 |
PennartLoettring/Poettrix | rootfs/usr/lib/python3.4/unittest/util.py | 89 | 5429 | """Various utility functions."""
from collections import namedtuple, OrderedDict
from os.path import commonprefix
__unittest = True
_MAX_LENGTH = 80
_PLACEHOLDER_LEN = 12
_MIN_BEGIN_LEN = 5
_MIN_END_LEN = 5
_MIN_COMMON_LEN = 5
_MIN_DIFF_LEN = _MAX_LENGTH - \
(_MIN_BEGIN_LEN + _PLACEHOLDER_LEN + _MIN_C... | gpl-2.0 |
takeshineshiro/heat | heat/tests/test_instance_group.py | 1 | 17980 | #
# 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
# ... | apache-2.0 |
rabimba/google-appengine-wx-launcher | launcher/platform.py | 28 | 17271 | #!/usr/bin/env python
#
# Copyright 2008 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 requir... | apache-2.0 |
kofron/bigcouch | couchjs/scons/scons-local-2.0.1/SCons/Tool/mslink.py | 61 | 10682 | """SCons.Tool.mslink
Tool-specific initialization for the Microsoft linker.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SC... | apache-2.0 |
rcarrillocruz/ansible | lib/ansible/modules/network/nxos/nxos_snmp_community.py | 55 | 8226 | #!/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 |
spacelis/hrnn4sim | hrnn4sim/base.py | 1 | 6693 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
File: training.py
Author: Wen Li
Email: spacelis@gmail.com
Github: http://github.com/spacelis
Description: Training utility functions
"""
# pylint: disable=invalid-name
from __future__ import print_function
from datetime import datetime
from os.path import join as pjo... | mit |
wangmiao1981/PredictionIO | examples/scala-parallel-similarproduct/add-rateevent/data/import_eventserver.py | 142 | 1844 | """
Import sample data for similar product engine
"""
import predictionio
import argparse
import random
SEED = 3
def import_events(client):
random.seed(SEED)
count = 0
print client.get_status()
print "Importing data..."
# generate 10 users, with user ids u1,u2,....,u10
user_ids = ["u%s" % i for i in ran... | apache-2.0 |
xiaoluobo/Medline-Pubmed-Search-Engine | build/lib/pymetamap/MetaMap.py | 4 | 1901 | # 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 the Li... | apache-2.0 |
ryanpetrello/pecan | pecan/tests/test_generic.py | 2 | 2900 | from json import dumps
from webtest import TestApp
from six import b as b_
from pecan import Pecan, expose, abort
from pecan.tests import PecanTestCase
class TestGeneric(PecanTestCase):
def test_simple_generic(self):
class RootController(object):
@expose(generic=True)
def index(... | bsd-3-clause |
joelddiaz/openshift-tools | openshift/installer/vendored/openshift-ansible-3.8.36-1/roles/lib_openshift/src/lib/clusterrole.py | 64 | 1995 | # pylint: skip-file
# flake8: noqa
# pylint: disable=too-many-public-methods
class ClusterRole(Yedit):
''' Class to model an openshift ClusterRole'''
rules_path = "rules"
def __init__(self, name=None, content=None):
''' Constructor for clusterrole '''
if content is None:
conte... | apache-2.0 |
aquajach/sample_teach | node_modules/node-sass/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py | 241 | 63805 | # 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.
"""
This module contains classes that help to emulate xcodebuild behavior on top of
other build systems, such as make and ninja.
"""
import copy
import gyp.common... | mit |
tianweizhang/nova | nova/api/openstack/compute/contrib/server_usage.py | 21 | 4148 | # Copyright 2013 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | apache-2.0 |
mahabs/nitro | nssrc/com/citrix/netscaler/nitro/resource/config/lb/lbvserver_filterpolicy_binding.py | 1 | 14739 | #
# Copyright (c) 2008-2015 Citrix Systems, 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 l... | apache-2.0 |
T-002/pycast | pycast/tests/errormeasuretest.py | 1 | 9111 | # !/usr/bin/env python
# -*- coding: UTF-8 -*-
# Copyright (c) 2012-2015 Christian Schwarz
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitat... | mit |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.