repo_name stringlengths 5 100 | ref stringlengths 12 67 | path stringlengths 4 244 | copies stringlengths 1 8 | content stringlengths 0 1.05M ⌀ |
|---|---|---|---|---|
cloudstax/firecamp | refs/heads/master | vendor/lambda-python-requests/chardet/langgreekmodel.py | 269 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is Mozilla Communicator client 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 R... |
underscorephil/softlayer-python | refs/heads/master | SoftLayer/managers/dns.py | 4 | """
SoftLayer.dns
~~~~~~~~~~~~~
DNS Manager/helpers
:license: MIT, see LICENSE for more details.
"""
import time
from SoftLayer import utils
class DNSManager(utils.IdentifierMixin, object):
"""Domain Name System manager.
:param SoftLayer.API.Client client: the client instance
"""
... |
tyagow/FacebookBot | refs/heads/master | src/core/views.py | 1 | from django.shortcuts import render
def home(request):
return render(request, 'core/index.html') |
google-research/ssl_detection | refs/heads/master | third_party/tensorpack/tensorpack/models/utils.py | 2 | # -*- coding: utf-8 -*-
# File: utils.py
import six
class VariableHolder(object):
""" A proxy to access variables defined in a layer. """
def __init__(self, **kwargs):
"""
Args:
kwargs: {name:variable}
"""
self._vars = {}
for k, v in six.iteritems(kwargs):
... |
bitifirefly/edx-platform | refs/heads/master | common/lib/xmodule/xmodule/randomize_module.py | 99 | import logging
import random
from xmodule.x_module import XModule, STUDENT_VIEW
from xmodule.seq_module import SequenceDescriptor
from lxml import etree
from xblock.fields import Scope, Integer
from xblock.fragment import Fragment
log = logging.getLogger('edx.' + __name__)
class RandomizeFields(object):
choic... |
1suming/readthedocs.org | refs/heads/master | readthedocs/projects/migrations/0037_add_canonical_url.py | 12 | # -*- 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):
# Adding field 'Project.canonical_url'
db.add_column('projects_project', 'canonical_url',
... |
crazy-canux/django | refs/heads/master | tests/gis_tests/geoadmin/admin.py | 547 | from django.contrib.gis import admin
class UnmodifiableAdmin(admin.OSMGeoAdmin):
modifiable = False
|
ckirby/django | refs/heads/master | tests/apps/namespace_package_base/nsapp/apps.py | 441 | import os
from django.apps import AppConfig
from django.utils._os import upath
class NSAppConfig(AppConfig):
name = 'nsapp'
path = upath(os.path.dirname(__file__))
|
DebrahR/memory | refs/heads/master | server/lib/werkzeug/urls.py | 298 | # -*- coding: utf-8 -*-
"""
werkzeug.urls
~~~~~~~~~~~~~
This module implements various URL related functions.
:copyright: (c) 2013 by the Werkzeug Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import re
from werkzeug._compat import text_type, PY2, to_unicode,... |
bolkedebruin/airflow | refs/heads/master | airflow/providers/google/cloud/operators/s3_to_gcs.py | 1 | # -*- 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
#... |
nmrao/robotframework | refs/heads/master | src/robot/output/console/highlighting.py | 19 | # Copyright 2008-2015 Nokia Solutions and 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 l... |
fnugrahendi/saleor | refs/heads/master | saleor/dashboard/product/urls.py | 19 | from django.conf.urls import url
from . import api
from . import views
urlpatterns = [
url(r'^$',
views.product_list, name='product-list'),
url(r'^(?P<pk>[0-9]+)/update/$',
views.product_edit, name='product-update'),
url(r'^add/$',
views.product_create, name='product-add'),
ur... |
mennis/dpkt | refs/heads/master | dpkt/crc32c.py | 17 | # $Id$
import array
# CRC-32C Checksum
# http://tools.ietf.org/html/rfc3309
crc32c_table = (
0x00000000L, 0xF26B8303L, 0xE13B70F7L, 0x1350F3F4L, 0xC79A971FL,
0x35F1141CL, 0x26A1E7E8L, 0xD4CA64EBL, 0x8AD958CFL, 0x78B2DBCCL,
0x6BE22838L, 0x9989AB3BL, 0x4D43CFD0L, 0xBF284CD3L, 0xAC78BF27L,
0x5E133C24L, ... |
mir-ror/unbound | refs/heads/master | libunbound/python/examples/dnssec-valid.py | 11 | #!/usr/bin/python
'''
dnssec-valid.py: DNSSEC validation
Authors: Zdenek Vasicek (vasicek AT fit.vutbr.cz)
Marek Vavrusa (xvavru00 AT stud.fit.vutbr.cz)
Copyright (c) 2008. All rights reserved.
This software is open source.
Redistribution and use in source and binary forms, with or without
modifi... |
benschulz/servo | refs/heads/master | tests/wpt/web-platform-tests/tools/pywebsocket/src/test/client_for_testing.py | 451 | #!/usr/bin/env python
#
# 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... |
tallessa/tallessa-backend | refs/heads/master | tallessa/stuff/apps.py | 1 | from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
class StuffAppConfig(AppConfig):
name = 'tallessa.stuff'
verbose_name = _('Stuff')
label = 'tallessa_stuff'
|
zenoss/ZenPacks.chudler.xmppBot | refs/heads/master | ZenPacks/chudler/xmppBot/xmppBot.py | 3 | #!/usr/bin/env python
"""Start the jabber bot and load our plugins"""
import Globals
import sys
import os, glob
import transaction
from Jabber.Adapter import TwistedJabberClient
from Jabber.Plugins import initPluginSystem, findPlugins
HAVE_SSL = False
try:
from twisted.internet import ssl
HAVE_SSL = True
exc... |
patilsangram/erpnext | refs/heads/develop | erpnext/setup/doctype/naming_series/__init__.py | 37694 | from __future__ import unicode_literals
|
GeoODK/onadata | refs/heads/master | onadata/apps/main/migrations/0004_auto__add_metadata.py | 13 | # 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 'MetaData'
db.create_table('main_metadata', (
('id', self.gf('django.db.models.... |
ywangd/stash | refs/heads/master | lib/stashutils/fsi/errors.py | 1 | # -*- coding: utf-8 -*-
"""Errors and Exceptions."""
class OperationFailure(IOError):
"""raise this if a operation (e.g. cd) fails.
The FSI is responsible for undoing errors."""
pass
class IsDir(OperationFailure):
"""raise this if a command only works on a file but a dirname is passed."""
pass
cl... |
ayarshabeer/wagtail | refs/heads/master | wagtail/wagtailadmin/tests/test_widgets.py | 10 | from django.test import TestCase
from django.contrib.contenttypes.models import ContentType
from wagtail.wagtailadmin import widgets
from wagtail.wagtailcore.models import Page
from wagtail.tests.testapp.models import SimplePage, EventPage
class TestAdminPageChooserWidget(TestCase):
def setUp(self):
sel... |
ddboline/pylearn2 | refs/heads/master | pylearn2/sandbox/cuda_convnet/convnet_compile.py | 44 | import errno
import logging
import os
import shutil
import stat
import sys
from theano import config
from theano.gof.cmodule import get_lib_extension
from theano.gof.compilelock import get_lock, release_lock
from theano.sandbox import cuda
from theano.sandbox.cuda import nvcc_compiler
from .shared_code import this_di... |
KrzysztofCiba/DCube | refs/heads/master | DCubeClient/python/DCubeOptParser.py | 1 | #!/bin/env python
##
# @file DCubeOptParser.py
# @author Krzysztof Danile Ciba (Krzysztof.Ciba@NOSPAMgmail.com)
# @brief implementation of DCubeOptParser
#
# DCube
# Copyright (C) 2011 Krzysztof Ciba
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Ge... |
hydroshare/hydroshare | refs/heads/develop | theme/management/commands/email_users.py | 1 | from django.core.management.base import BaseCommand
from django.core.mail import send_mail
from django.conf import settings
from django.contrib.auth.models import User
from theme.utils import get_quota_message
class Command(BaseCommand):
help = "Send users emails for reporting over-quota usages and warnings, etc... |
whitehorse-io/encarnia | refs/heads/master | pyenv/lib/python2.7/site-packages/twisted/python/htmlizer.py | 14 | # -*- test-case-name: twisted.python.test.test_htmlizer -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
HTML rendering of Python source.
"""
from twisted.python.compat import _tokenize, escape
import tokenize, keyword
from . import reflect
from twisted.python._oldstyle import _oldStyl... |
Work4Labs/lettuce | refs/heads/master | tests/integration/lib/Django-1.2.5/django/core/urlresolvers.py | 51 | """
This module converts requested URLs to callback view functions.
RegexURLResolver is the main class here. Its resolve() method takes a URL (as
a string) and returns a tuple in this format:
(view_function, function_args, function_kwargs)
"""
import re
from django.http import Http404
from django.conf import se... |
v-iam/azure-sdk-for-python | refs/heads/master | azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/application_gateway_http_listener.py | 2 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... |
dfang/odoo | refs/heads/10.0 | odoo/addons/test_inherit/__manifest__.py | 72 | # -*- coding: utf-8 -*-
{
'name': 'test-inherit',
'version': '0.1',
'category': 'Tests',
'description': """A module to verify the inheritance.""",
'depends': ['base'],
'data': [
'ir.model.access.csv',
'demo_data.xml',
],
'installable': True,
'auto_install': False,
}
|
thaim/ansible | refs/heads/fix-broken-link | test/units/modules/network/check_point/test_cp_mgmt_dns_domain_facts.py | 19 | # Ansible module to manage CheckPoint Firewall (c) 2019
#
# 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 dist... |
samsu/neutron | refs/heads/master | services/firewall/drivers/varmour/__init__.py | 140 | # Copyright 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 req... |
SNAPPETITE/backend | refs/heads/master | flask/lib/python2.7/site-packages/flask/testsuite/blueprints.py | 563 | # -*- 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... |
dkorolev/omim | refs/heads/master | tools/user_code_coverage.py | 53 | import os
import json
import sys
if len(sys.argv) < 3:
print "USAGE: " + sys.argv[0] + " [username] [htmlfile]"
exit()
USERNAME = sys.argv[1]
HTMLFILE = sys.argv[1]
if __name__ == "__main__":
os.system('git log --pretty="%H" --author="'+USERNAME+'" | while read commit_hash; do git show --oneline --name-... |
twalthr/flink | refs/heads/master | flink-python/pyflink/common/restart_strategy.py | 9 | ################################################################################
# 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... |
pi11/xhtml2pdf | refs/heads/master | xhtml2pdf/parser.py | 19 | # -*- coding: utf-8 -*-
# Copyright 2010 Dirk Holtwick, holtwick.it
#
# 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 ... |
bpshetty/erpnext | refs/heads/master | erpnext/selling/doctype/lead_source/lead_source.py | 53 | # -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class LeadSource(Document):
pass
|
BootstrapHeroes/django-shopify | refs/heads/master | django_shopify/examples/privateapp/privateapp/urls.py | 1 | from django.conf.urls.defaults import patterns, include, url
from django.contrib import admin
from settings import MEDIA_ROOT
from django_conventions import UrlsManager
import privateapp_app.views as privateapp_app_root
admin.autodiscover()
urlpatterns = patterns('',
url(r'^admin/', include(admin.site.urls)),
... |
AustinRoy7/Pomodoro-timer | refs/heads/master | venv/Lib/collections/abc.py | 274 | from _collections_abc import *
from _collections_abc import __all__
|
ycaihua/kbengine | refs/heads/master | kbe/src/lib/python/Lib/uuid.py | 63 | r"""UUID objects (universally unique identifiers) according to RFC 4122.
This module provides immutable UUID objects (class UUID) and the functions
uuid1(), uuid3(), uuid4(), uuid5() for generating version 1, 3, 4, and 5
UUIDs as specified in RFC 4122.
If all you want is a unique ID, you should probably call uuid1() ... |
RPGOne/Skynet | refs/heads/Miho | scikit-learn-0.18.1/examples/plot_johnson_lindenstrauss_bound.py | 67 | r"""
=====================================================================
The Johnson-Lindenstrauss bound for embedding with random projections
=====================================================================
The `Johnson-Lindenstrauss lemma`_ states that any high dimensional
dataset can be randomly projected i... |
chroust/torrentflux | refs/heads/master | html/TF_BitTornado/btphptornado.py | 5 | #!/usr/bin/env python
# Written by Bram Cohen
# see LICENSE.txt for license information
from BitTornado import PSYCO
if PSYCO.psyco:
try:
import psyco
assert psyco.__version__ >= 0x010100f0
psyco.full()
except:
pass
from BitTornado.download_bt1 import BT1Download, defaults... |
androidarmv6/android_external_skia | refs/heads/cm-11.0 | bench/check_bench_regressions.py | 29 | '''
Created on May 16, 2011
@author: bungeman
'''
import bench_util
import getopt
import httplib
import itertools
import json
import os
import re
import sys
import urllib
import urllib2
import xml.sax.saxutils
# Maximum expected number of characters we expect in an svn revision.
MAX_SVN_REV_LENGTH = 5
def usage():
... |
Zhiqiang-He/kafka-0914-edit | refs/heads/trunk | tests/kafkatest/services/__init__.py | 156 | # 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 use ... |
hsr-ba-fs15-dat/opendatahub | refs/heads/master | src/main/python/hub/odhql/functions/geometry.py | 1 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
"""
Geometry functions. Functions and naming borrowed from PostGIS.
"""
from shapely import wkt
import geopandas as gp
import pyproj
from fiona.crs import from_epsg
import numpy as np
from hub.odhql.functions.core import VectorizedFunction, OdhQLExecut... |
statkclee/ThinkStats2 | refs/heads/kr | code/survival.py | 65 | """This file contains code for use with "Think Stats",
by Allen B. Downey, available from greenteapress.com
Copyright 2014 Allen B. Downey
License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html
"""
from __future__ import print_function, division
import numpy as np
import pandas
import nsfg
import thinkstats2
impor... |
rtruxal/metagoofil | refs/heads/master | hachoir_parser/common/win32_lang_id.py | 186 | """
Windows 2000 - List of Locale IDs and Language Groups
Original data table:
http://www.microsoft.com/globaldev/reference/win2k/setup/lcid.mspx
"""
LANGUAGE_ID = {
0x0436: u"Afrikaans",
0x041c: u"Albanian",
0x0401: u"Arabic Saudi Arabia",
0x0801: u"Arabic Iraq",
0x0c01: u"Arabic Egypt",
0x10... |
inteligencia-coletiva-lsd/pybossa | refs/heads/master | pybossa/ckan.py | 5 | # -*- coding: utf8 -*-
# This file is part of PyBossa.
#
# Copyright (C) 2015 SF Isle of Man Limited
#
# PyBossa is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at... |
netnetnet2/shadowsocks | refs/heads/master | shadowsocks/__init__.py | 1084 | #!/usr/bin/python
#
# Copyright 2012-2015 clowwindy
#
# 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... |
rusty1s/embedded_gcnn | refs/heads/master | lib/layer/image_augment_test.py | 1 | import tensorflow as tf
from .image_augment import ImageAugment
class ImageAugmentTest(tf.test.TestCase):
def test_init(self):
layer = ImageAugment()
self.assertEqual(layer.name, 'imageaugment_1')
def test_call(self):
layer = ImageAugment(name='call')
inputs = tf.constant([[[... |
watchcat/cbu-rotterdam | refs/heads/master | lib/web/http.py | 4 | """
HTTP Utilities
(from web.py)
"""
__all__ = [
"expires", "lastmodified",
"prefixurl", "modified",
"changequery", "url",
"profiler",
]
import sys, os, threading, urllib, urlparse
try: import datetime
except ImportError: pass
import net, utils, webapi as web
def prefixurl(base=''):
"""
Sorry, this... |
mkhuthir/learnPython | refs/heads/master | Book_pythonlearn_com/25_matplotlib/logo.py | 1 | import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.cm as cm
mpl.rcParams['xtick.labelsize'] = 10
mpl.rcParams['ytick.labelsize'] = 12
mpl.rcParams['axes.edgecolor'] = 'gray'
axalpha = 0.05
figcolor = 'white'
dpi = 80
fig = plt.figure(figsize=(6, 1.1), dpi=dpi)
fig.patch.set... |
kevinyu98/spark | refs/heads/master | python/pyspark/ml/tests/test_evaluation.py | 21 | #
# 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... |
dataxu/ansible | refs/heads/dx-stable-2.5 | lib/ansible/modules/cloud/amazon/_ec2_ami_find.py | 8 | #!/usr/bin/python
# Copyright: Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['deprecated']... |
bigplus/thefuck | refs/heads/master | thefuck/rules/python_execute.py | 5 | # Appends .py when executing python files
#
# Example:
# > python foo
# error: python: can't open file 'foo': [Errno 2] No such file or directory
from thefuck.utils import for_app
@for_app('python')
def match(command, settings):
return not command.script.endswith('.py')
def get_new_command(command, settings):
... |
cpanelli/-git-clone-https-chromium.googlesource.com-chromium-tools-depot_tools | refs/heads/master | third_party/coverage/cmdline.py | 49 | """Command-line support for Coverage."""
import optparse, os, sys, traceback
from coverage.backward import sorted # pylint: disable=W0622
from coverage.execfile import run_python_file, run_python_module
from coverage.misc import CoverageException, ExceptionDuringRun, NoSource
from coverage.debug import... |
jayceyxc/hue | refs/heads/master | desktop/core/ext-py/Django-1.6.10/django/core/files/base.py | 77 | from __future__ import unicode_literals
import os
from io import BytesIO, StringIO, UnsupportedOperation
from django.utils.encoding import smart_text
from django.core.files.utils import FileProxyMixin
from django.utils import six
from django.utils.encoding import force_bytes, python_2_unicode_compatible
@python_2_un... |
daniula/python-social-auth | refs/heads/master | social/backends/disqus.py | 70 | """
Disqus OAuth2 backend, docs at:
http://psa.matiasaguirre.net/docs/backends/disqus.html
"""
from social.backends.oauth import BaseOAuth2
class DisqusOAuth2(BaseOAuth2):
name = 'disqus'
AUTHORIZATION_URL = 'https://disqus.com/api/oauth/2.0/authorize/'
ACCESS_TOKEN_URL = 'https://disqus.com/api/oauth... |
adlai/p2pool | refs/heads/master | SOAPpy/URLopener.py | 294 | """Provide a class for loading data from URL's that handles basic
authentication"""
ident = '$Id: URLopener.py 541 2004-01-31 04:20:06Z warnes $'
from version import __version__
from Config import Config
from urllib import FancyURLopener
class URLopener(FancyURLopener):
username = None
passwd = None
d... |
admcrae/tensorflow | refs/heads/master | tensorflow/contrib/learn/python/learn/estimators/estimator_test.py | 8 | # 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... |
emory-libraries/eulcore-history | refs/heads/master | test/test_binfile/test_eudora.py | 1 | #!/usr/bin/env python
import unittest
import os
from eulcore.binfile import eudora
from testcore import main
TEST_ROOT = os.path.dirname(__file__)
def fixture(fname):
return os.path.join(TEST_ROOT, 'fixtures', fname)
class TestEudora(unittest.TestCase):
def test_members(self):
fname = fixture('In.to... |
HyukjinKwon/spark | refs/heads/master | sql/hive/src/test/resources/data/scripts/newline.py | 131 | #
# 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... |
sdopoku/flask-blog | refs/heads/master | env/lib/python2.7/site-packages/flask/_compat.py | 783 | # -*- coding: utf-8 -*-
"""
flask._compat
~~~~~~~~~~~~~
Some py2/py3 compatibility support based on a stripped down
version of six so we don't have to depend on a specific version
of it.
:copyright: (c) 2013 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import sys
PY... |
attilahorvath/phantomjs | refs/heads/master | src/breakpad/src/tools/gyp/test/module/gyptest-default.py | 158 | #!/usr/bin/env python
# Copyright (c) 2009 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 simple build of a "Hello, world!" program with loadable modules. The
default for all platforms should be to output the loadable... |
omnirom/android_external_chromium-org | refs/heads/android-5.1 | printing/cups_config_helper.py | 61 | #!/usr/bin/env python
# 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.
"""cups-config wrapper.
cups-config, at least on Ubuntu Lucid and Natty, dumps all
cflags/ldflags/libs when passed the --libs argu... |
spallavolu/scikit-learn | refs/heads/master | examples/tree/plot_tree_regression.py | 206 | """
===================================================================
Decision Tree Regression
===================================================================
A 1D regression with decision tree.
The :ref:`decision trees <tree>` is
used to fit a sine curve with addition noisy observation. As a result, it
learns ... |
jose36/plugin.video.live.ProyectoLuzDigital- | refs/heads/master | wattv.py | 304 | import hashlib,binascii, time,base64
def getWatToken(mediaId):
curr_time=int(time.time())
appName='sdk/Iphone/1.0'
method='getLiveUrl'
version='1.3'
#time=1417304914#fbc3d36ff262e98acedfcb5dda7ea346/1417304914
#46091b344ccc00e4db189c1097804bbc/1417193313000
secret=base64.b64decode('VzNtMCMxbUZJ')
s="%s-%s-%s-%s... |
chipsecintel/chipsec | refs/heads/master | source/tool/chipsec/modules/common/spi_desc.py | 2 | #CHIPSEC: Platform Security Assessment Framework
#Copyright (c) 2010-2015, Intel Corporation
#
#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; Version 2.
#
#This program is distributed in the hope... |
jeremiahmarks/sl4a | refs/heads/master | python-build/python-libs/gdata/tests/gdata_tests/auth_test.py | 126 | #!/usr/bin/env python
#
# Copyright (C) 2007, 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 require... |
Bourneer/scrapy | refs/heads/master | scrapy/downloadermiddlewares/robotstxt.py | 57 | """
This is a middleware to respect robots.txt policies. To activate it you must
enable this middleware and enable the ROBOTSTXT_OBEY setting.
"""
import logging
from six.moves.urllib import robotparser
from twisted.internet.defer import Deferred, maybeDeferred
from scrapy.exceptions import NotConfigured, IgnoreReq... |
2014c2g19/2014c2g19 | refs/heads/master | wsgi/static/reeborg/src/libraries/brython/Lib/inspect.py | 11 | """Get useful information from live Python objects.
This module encapsulates the interface provided by the internal special
attributes (co_*, im_*, tb_*, etc.) in a friendlier fashion.
It also provides some help for examining source code and class layout.
Here are some of the useful functions provided by this module:... |
legalsylvain/OpenUpgrade | refs/heads/master | addons/membership/membership.py | 27 | # -*- 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... |
mbauskar/erpnext | refs/heads/develop | erpnext/accounts/doctype/payment_gateway_account/payment_gateway_account.py | 62 | # -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class PaymentGatewayAccount(Document):
def autoname(self):
self.name = self... |
Sunnepah/iupds-appscale | refs/heads/master | iupdsmanager/exceptions.py | 1 | class OAuthToolkitError(Exception):
"""
Base class for exceptions
"""
def __init__(self, error=None, redirect_uri=None, *args, **kwargs):
super(OAuthToolkitError, self).__init__(*args, **kwargs)
self.oauthlib_error = error
if redirect_uri:
self.oauthlib_error.redirec... |
opensvn/test | refs/heads/master | src/study/python/cpp/ch19/alt/tkhello2.py | 3 | #!/usr/bin/env python
# $Id: tkhello2.py,v 1.1 2000/02/21 09:04:25 wesc Exp $
#
# tkhello2.py -- "Hello World!" 2 in Tkinter:
# - "Hello World!" with just a button (which quits the app)
#
# created by wesc 00/02/20
#
# import Tkinter module
import Tkinter
# create toplevel window
top = Tkinter.Tk()
# create b... |
kelvinxu/theano_exercises | refs/heads/master | 02_advanced/01_symbolic/04_two_step_backprop.py | 13 | import numpy as np
from theano import config
from theano import function
from theano import shared
from theano import tensor as T
raise NotImplementedError("TODO: add any imports you need.")
num_vis = 2
class SimpleMLP(object):
"""
An MLP with one sigmoid hidden layer and one linear output layer
(for so... |
log2timeline/l2tdevtools | refs/heads/main | tools/update-dependencies.py | 2 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# pylint: disable=invalid-name
"""Script to update the dependencies in various configuration files."""
import io
import os
import shutil
import sys
from l2tdevtools import dependencies
from l2tdevtools.helpers import project
from l2tdevtools.dependency_writers import app... |
wolfier/incubator-airflow | refs/heads/master | airflow/utils/configuration.py | 14 | # -*- 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
#... |
bop/hybrid | refs/heads/master | lib/python2.6/site-packages/django/contrib/localflavor/uy/util.py | 504 | # -*- coding: utf-8 -*-
def get_validation_digit(number):
""" Calculates the validation digit for the given number. """
sum = 0
dvs = [4, 3, 6, 7, 8, 9, 2]
number = str(number)
for i in range(0, len(number)):
sum = (int(number[-1 - i]) * dvs[i] + sum) % 10
return (10-sum) % 10
|
KamitsukiHoshizora/uno-zen | refs/heads/master | node_modules/gulp-sass/node_modules/node-sass/node_modules/node-gyp/gyp/pylib/gyp/generator/eclipse.py | 1825 | # 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.
"""GYP backend that generates Eclipse CDT settings files.
This backend DOES NOT generate Eclipse CDT projects. Instead, it generates XML
files that can be importe... |
eduNEXT/edunext-platform | refs/heads/master | lms/djangoapps/course_api/blocks/permissions.py | 4 | """
Encapsulates permissions checks for Course Blocks API
"""
from lms.djangoapps.courseware.access import has_access
from student.models import CourseEnrollment
from student.roles import CourseStaffRole
def can_access_all_blocks(requesting_user, course_key):
"""
Returns whether the requesting_user can acce... |
csunny/blog_project | refs/heads/master | source/libs/analysis/src/7_饼状图/homework-lesson7.py | 2 | import matplotlib.pyplot as plt
from matplotlib.gridspec import GridSpec
# Some data
labels = 'SH', 'BJ', 'SZ', 'GD'
fracs = [20, 10, 30, 25]
explode = (0, 0, 0.05, 0)
plt.axes(aspect=1)
plt.pie(fracs, explode=explode, labels=labels, autopct='%.1f%%', shadow=True)
plt.show() |
jpypi/ffnn | refs/heads/master | __init__.py | 1 | from . import neuralnet
from . import neuron
from . import helpers
__all__ = ["neuralnet", "neuron", "helpers"]
|
ivan-fedorov/intellij-community | refs/heads/master | python/testData/formatter/noWrapBeforeParen.py | 83 | def foo():
def bar():
def baz():
if comments:
for comment in comments:
record += ' <comment ' + "".join(ca + '=' + quoteattr(comment[ca]) + ' ' for ca in comment) + '/>\n' |
raj454raj/eden | refs/heads/master | modules/s3/s3xforms.py | 5 | # -*- coding: utf-8 -*-
""" S3 XForms API
@copyright: 2014-15 (c) Sahana Software Foundation
@license: MIT
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
restric... |
microelly2/reconstruction | refs/heads/master | examples/example_skeleton.py | 1 | #
# threshold tests
#
import reconstruction.CV2
reload( reconstruction.CV2)
createCV=reconstruction.CV2.createCV
if App.ActiveDocument==None:
App.newDocument("Unnamed")
App.setActiveDocument("Unnamed")
App.ActiveDocument=App.getDocument("Unnamed")
Gui.ActiveDocument=Gui.getDocument("Unnamed")
import reconst... |
CAAD-RWTH/ClockworkForDynamo | refs/heads/master | nodes/0.8.x/python/All View-Dependent Family Instances Of Category.py | 12 | import System
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument
cats = IN[0]
views = UnwrapElement(IN[1])
elementlist = list()
# This cou... |
fitoria/askbot-devel | refs/heads/master | askbot/migrations/0014_rename_schema_from_forum_to_askbot.py | 13 | # encoding: utf-8
import os
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
app_dir_name = os.path.basename(os.path.dirname(os.path.dirname(__file__)))
class Migration(SchemaMigration):
def forwards(self, orm):
if app_dir_name == 'forum':
... |
mkennedy04/knodj | refs/heads/master | env/Lib/site-packages/django/db/backends/base/schema.py | 45 | import hashlib
from django.db.backends.utils import truncate_name
from django.db.transaction import atomic
from django.utils import six
from django.utils.encoding import force_bytes
from django.utils.log import getLogger
logger = getLogger('django.db.backends.schema')
def _related_non_m2m_objects(old_field, new_fie... |
IMSGlobal/openbadges-validator-core | refs/heads/develop | openbadges/verifier/tasks/utils.py | 3 | from pyld import jsonld
import re
import rfc3986
import six
from ..openbadges_context import OPENBADGES_CONTEXT_V2_URI
URN_REGEX = r'^urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$'
def task_result(success=True, message='', actions=None):
"""
Formats a response from a task... |
yokose-ks/edx-platform | refs/heads/gacco3/master | common/djangoapps/terrain/stubs/comments.py | 11 | """
Stub implementation of cs_comments_service for acceptance tests
"""
import re
import urlparse
from .http import StubHttpRequestHandler, StubHttpService
class StubCommentsServiceHandler(StubHttpRequestHandler):
@property
def _params(self):
return urlparse.parse_qs(urlparse.urlparse(self.path).que... |
jarshwah/django | refs/heads/master | tests/contenttypes_tests/tests.py | 8 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime
from django.apps.registry import Apps, apps
from django.conf import settings
from django.contrib.contenttypes import management as contenttypes_management
from django.contrib.contenttypes.fields import (
GenericForeignKey, GenericRela... |
x0rnn/minqlx-plugins | refs/heads/master | killingspree.py | 1 | # killingspree.py by x0rnn, based on benny/bennz's kspree.lua for Enemy Territory
# Unreal Tournament sound announcements for:
#
# 5 kills in a row: killing spree
# 10 kills in a row: rampage
# 15 kills in a row: dominating
# 20 kills in a row: unstoppable
# 25 kills in a row: godlike
# 30 kills in a row: wicked ... |
mainakibui/dkobo | refs/heads/master | dkobo/koboform/kobocat_integration/__init__.py | 1 | import requests
from django.conf import settings
from rest_framework.test import APIClient
from rest_framework.authtoken.models import Token
def publish_survey_draft(survey_draft, kobocat_internal_url):
url, data, headers = _publish_survey_draft_params(survey_draft, kobocat_internal_url)
resp = requests.post... |
7digital/troposphere | refs/heads/master | troposphere/waf.py | 6 | # Copyright (c) 2012-2015, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
from . import AWSObject, AWSProperty
from .validators import boolean, integer
class Action(AWSProperty):
props = {
'Type': (basestring, True)
}
class FieldToMatch(AWSProperty):
pro... |
yoyo2k/l10n-romania | refs/heads/8.0 | l10n_ro_asset/__openerp__.py | 3 | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Fekete Mihai <mihai.fekete@forbiom.eu>
# Copyright (C) 2014 FOREST AND BIOMASS SERVICES ROMANIA SA
# (http://www.forbiom.eu).
#
# This program is free software: you can redistribute it and/or... |
mkieszek/odoo | refs/heads/master | addons/hw_escpos/escpos/exceptions.py | 170 | """ ESC/POS Exceptions classes """
import os
class Error(Exception):
""" Base class for ESC/POS errors """
def __init__(self, msg, status=None):
Exception.__init__(self)
self.msg = msg
self.resultcode = 1
if status is not None:
self.resultcode = status
def __st... |
gurbrinder/Arduino | refs/heads/master | arduino-core/src/processing/app/i18n/python/transifex.py | 75 | #!/usr/bin/env python
#vim:set fileencoding=utf-8 sw=2 expandtab
import update
import requests
import json
class Transifex(object):
def __init__(self, user, passwd):
self.auth_ = (user, passwd)
r = requests.get(
'http://www.transifex.com/api/2/project/'
'arduino-ide-15/resource/ide-15/?deta... |
faun/django_test | refs/heads/master | build/lib/django/utils/encoding.py | 89 | import types
import urllib
import locale
import datetime
import codecs
from decimal import Decimal
from django.utils.functional import Promise
class DjangoUnicodeDecodeError(UnicodeDecodeError):
def __init__(self, obj, *args):
self.obj = obj
UnicodeDecodeError.__init__(self, *args)
def __str_... |
codepython/restcommander | refs/heads/master | play-1.2.4/framework/pym/play/commands/classpath.py | 9 | # Show the computed classpath for the application
COMMANDS = ['cp', 'classpath']
HELP = {
'classpath': 'Display the computed classpath'
}
def execute(**kargs):
command = kargs.get("command")
app = kargs.get("app")
args = kargs.get("args")
print "~ Computed classpath is:"
print "~ "
print ... |
apihackers/wapps | refs/heads/master | tests/gallery/test_gallery_models.py | 1 | import pytest
from pytest_factoryboy import LazyFixture
from wapps.gallery.models import Gallery
@pytest.mark.django_db
@pytest.mark.parametrize('album__parent', [LazyFixture('gallery')])
def test_album_parent_gallery(gallery, album):
assert isinstance(album.gallery, Gallery)
assert album.gallery == gallery... |
cyberphox/MissionPlanner | refs/heads/master | Lib/site-packages/scipy/stats/tests/test_morestats.py | 57 | # Author: Travis Oliphant, 2002
#
# Further enhancements and tests added by numerous SciPy developers.
#
import warnings
from numpy.testing import TestCase, run_module_suite, assert_array_equal, \
assert_almost_equal, assert_array_less, assert_array_almost_equal, \
assert_raises
import scipy.stats as stats
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.