repo_name stringlengths 5 100 | ref stringlengths 12 67 | path stringlengths 4 244 | copies stringlengths 1 8 | content stringlengths 0 1.05M ⌀ |
|---|---|---|---|---|
mbauskar/omnitech-erpnext | refs/heads/master | erpnext/accounts/general_ledger.py | 17 | # 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
from frappe.utils import flt, cstr, cint
from frappe import _
from frappe.model.meta import get_field_precision
from erpnext.accounts.util... |
johnny9/zulip | refs/heads/master | tools/run-dev.py | 114 | #!/usr/bin/env python
import optparse
import subprocess
import signal
import traceback
import sys
import os
from twisted.internet import reactor
from twisted.web import proxy, server, resource
# Monkey-patch twisted.web.http to avoid request.finish exceptions
# https://trac.zulip.net/ticket/1728
from twisted.web... |
Ayub-Khan/edx-platform | refs/heads/master | common/djangoapps/edxmako/tests.py | 20 |
from mock import patch, Mock
import unittest
import ddt
from django.conf import settings
from django.http import HttpResponse
from django.test import TestCase
from django.test.utils import override_settings
from django.test.client import RequestFactory
from django.core.urlresolvers import reverse
import edxmako.middl... |
davidsb30/eve-wspace | refs/heads/master | evewspace/search/views.py | 17 | # Eve W-Space
# Copyright (C) 2013 Andrew Austin and other contributors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option... |
joelddiaz/openshift-tools | refs/heads/prod | openshift/installer/vendored/openshift-ansible-3.8.36-1/roles/lib_openshift/src/class/oc_secret.py | 32 | # pylint: skip-file
# flake8: noqa
# pylint: skip-file
# pylint: disable=wrong-import-position,wrong-import-order
import base64
# pylint: disable=too-many-arguments
class OCSecret(OpenShiftCLI):
''' Class to wrap the oc command line tools
'''
def __init__(self,
namespace,
... |
stven/headphones | refs/heads/develop | lib/requests/packages/chardet/sbcsgroupprober.py | 235 | ######################## 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. All R... |
DavidNorman/tensorflow | refs/heads/master | tensorflow/python/compiler/tensorrt/test/base_test.py | 7 | # Copyright 2018 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... |
lmazuel/ansible | refs/heads/devel | lib/ansible/playbook/role/requirement.py | 81 | # (c) 2014 Michael DeHaan, <michael@ansible.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later ve... |
fentas/phantomjs | refs/heads/master | src/qt/qtwebkit/Tools/Scripts/webkitpy/common/system/executive.py | 117 | # Copyright (c) 2009, Google Inc. All rights reserved.
# Copyright (c) 2009 Apple 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 abov... |
miurahr/pinax-blog | refs/heads/master | pinax/blog/utils.py | 5 | from django.core.exceptions import ImproperlyConfigured
try:
from importlib import import_module
except ImportError:
from django.utils.importlib import import_module
try:
import twitter
except ImportError:
twitter = None
from .conf import settings
def can_tweet():
creds_available = (hasattr(set... |
quantumlib/OpenFermion-Cirq | refs/heads/master | openfermioncirq/variational/objective.py | 1 | # 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
# distribu... |
infus0815/xbmc | refs/heads/master | tools/Fake Episode Maker/openAnything.py | 169 | # -*- coding: utf-8 -*-
# Copyright (C) 2008-2013 Team XBMC
# http://xbmc.org
#
# This Program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any l... |
Lujeni/ansible | refs/heads/devel | test/units/modules/network/f5/test_bigip_monitor_tcp.py | 22 | # -*- coding: utf-8 -*-
#
# Copyright (c) 2017 F5 Networks 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
import os
import json
import pytest
import sys
if sys.version_info < (2, ... |
SUSE/azure-sdk-for-python | refs/heads/master | azure-mgmt-keyvault/azure/mgmt/keyvault/key_vault_management_client.py | 4 | # 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 ... |
infoxchange/lettuce | refs/heads/master | tests/integration/lib/Django-1.2.5/tests/regressiontests/utils/checksums.py | 246 | import unittest
from django.utils import checksums
class TestUtilsChecksums(unittest.TestCase):
def check_output(self, function, value, output=None):
"""
Check that function(value) equals output. If output is None,
check that function(value) equals value.
"""
if output is... |
lowitty/server | refs/heads/master | libsDarwin/twisted/names/hosts.py | 42 | # -*- test-case-name: twisted.names.test.test_hosts -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
hosts(5) support.
"""
from __future__ import division, absolute_import
from twisted.python.compat import nativeString
from twisted.names import dns
from twisted.python import failure
fr... |
adamgreenhall/scikit-learn | refs/heads/master | sklearn/tests/test_lda.py | 77 | import numpy as np
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert... |
zhangyage/Python-oldboy | refs/heads/master | day04/exceptions/guess.py | 1 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
import random
num = random.randint(0,100)
while True:
try:
guess = int(raw_input("Enter 1~100:"))
except ValueError,e: #当guess输入时判断输入的是否是数字
print "Enter 1~100"
continue
if guess > num:
print "guess Bigger:",guess... |
kalahbrown/HueBigSQL | refs/heads/master | desktop/core/ext-py/python-openid-2.2.5/openid/consumer/html_parse.py | 167 | """
This module implements a VERY limited parser that finds <link> tags in
the head of HTML or XHTML documents and parses out their attributes
according to the OpenID spec. It is a liberal parser, but it requires
these things from the data in order to work:
- There must be an open <html> tag
- There must be an open... |
jjmiranda/edx-platform | refs/heads/master | lms/djangoapps/courseware/tests/test_access.py | 8 | # -*- coding: utf-8 -*-
"""
Test the access control framework
"""
import datetime
import ddt
import itertools
import pytz
from django.contrib.auth.models import User
from ccx_keys.locator import CCXLocator
from django.test.client import RequestFactory
from django.core.urlresolvers import reverse
from django.test impor... |
lifanov/cobbler | refs/heads/master | tests/cobbler_xmlrpc_test.py | 16 | import logging
import os
import random
import re
import sys
import time
import unittest
import xmlrpclib
from cobbler.remote import EVENT_COMPLETE
from cobbler.utils import local_get_cobbler_api_url, get_shared_secret
FAKE_INITRD="initrd1.img"
FAKE_INITRD2="initrd2.img"
FAKE_INITRD3="initrd3.img"
FAKE_KERNEL="vmlinuz... |
mrry/tensorflow | refs/heads/windows | tensorflow/contrib/learn/python/learn/dataframe/__init__.py | 86 | # 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... |
semiautomaticgit/SemiAutomaticClassificationPlugin | refs/heads/master | maininterface/rgblistTab.py | 1 | # -*- coding: utf-8 -*-
'''
/**************************************************************************************************************************
SemiAutomaticClassificationPlugin
The Semi-Automatic Classification Plugin for QGIS allows for the supervised classification of remote sensing images,
provid... |
roselleebarle04/django | refs/heads/master | django/contrib/gis/maps/google/overlays.py | 133 | from __future__ import unicode_literals
from functools import total_ordering
from django.contrib.gis.geos import (
LinearRing, LineString, Point, Polygon, fromstr,
)
from django.utils import six
from django.utils.encoding import python_2_unicode_compatible
from django.utils.html import html_safe
@html_safe
@pyt... |
Bluetide/Cactus | refs/heads/master | cactus/utils/network.py | 9 | #coding:utf-8
import logging
import time
import urllib2
from cactus.utils.parallel import multiMap
logger = logging.getLogger(__name__)
def retry(exceptions, tries=4, delay=3, backoff=2):
"""
Retry execution in case we fail on one of the exceptions
"""
def deco_retry(f):
def f_retry(*args, ... |
zteifel/roboloid | refs/heads/master | lib/DynamixelSDK/python/protocol2_0/sync_read_write.py | 1 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
################################################################################
# Copyright (c) 2016, ROBOTIS CO., LTD.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following ... |
jtremback/FlyingFox | refs/heads/master | docs/python/pt/bci.py | 5 | #!/usr/bin/python
import urllib2, json, re, random, sys
# Makes a request to a given URL (first argument) and optional params (second argument)
def make_request(*args):
opener = urllib2.build_opener()
opener.addheaders = [('User-agent', 'Mozilla/5.0'+str(random.randrange(1000000)))]
try:
return ope... |
plxaye/chromium | refs/heads/master | src/third_party/protobuf/python/stubout.py | 670 | #!/usr/bin/python2.4
#
# Copyright 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 o... |
mortada/numpy | refs/heads/master | numpy/lib/user_array.py | 111 | """
Standard container-class for easy multiple-inheritance.
Try to inherit from the ndarray instead of using this class as this is not
complete.
"""
from __future__ import division, absolute_import, print_function
from numpy.core import (
array, asarray, absolute, add, subtract, multiply, divide,
remainder, p... |
Pencroff/ai-hackathon-2017 | refs/heads/master | Backend/venv/lib/python3.6/site-packages/flask/wrappers.py | 121 | # -*- coding: utf-8 -*-
"""
flask.wrappers
~~~~~~~~~~~~~~
Implements the WSGI wrappers (request and response).
:copyright: (c) 2015 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
from werkzeug.wrappers import Request as RequestBase, Response as ResponseBase
from werkzeug.exce... |
Mhynlo/SickRage | refs/heads/master | lib/sqlalchemy/sql/type_api.py | 78 | # sql/types_api.py
# Copyright (C) 2005-2014 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
"""Base types API.
"""
from .. import exc, util
from . import operators
from .visi... |
nzavagli/UnrealPy | refs/heads/master | UnrealPyEmbed/Development/Python/2015.08.07-Python2710-x64-Source-vs2015/Python27/Source/Python-2.7.10/Lib/encodings/cp850.py | 593 | """ Python Character Mapping Codec generated from 'VENDORS/MICSFT/PC/CP850.TXT' with gencodec.py.
"""#"
import codecs
### Codec APIs
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_map)
def decode(self,input,errors='strict'):
... |
ddzialak/boto | refs/heads/develop | boto/s3/connection.py | 1 | # Copyright (c) 2006-2012 Mitch Garnaat http://garnaat.org/
# Copyright (c) 2012 Amazon.com, Inc. or its affiliates.
# Copyright (c) 2010, Eucalyptus Systems, Inc.
# All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation file... |
Brocade-OpenSource/OpenStack-DNRM-Nova | refs/heads/master | nova/tests/api/openstack/compute/plugins/v3/test_aggregates.py | 3 | # Copyright (c) 2012 Citrix Systems, 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 ... |
dhwang99/statistics_introduction | refs/heads/master | learning/linear_all_subset.py | 1 | #encoding: utf8
import numpy as np
import pdb
from scipy.stats import f as f_stats
import matplotlib.pyplot as plt
from data_loader import load_data, normalize_data
from linear_regression import leasq
from cv_common import gen_CV_samples_by_K_folds, one_std_error_rule
'''
子集选择
穷举法找最优模型
注意:要求传入数据有偏置项,这样可以算出截距情况, 不需要... |
noslenfa/ubiwhere_challenge | refs/heads/master | clientum/clientum/urls.py | 1 | """clientum URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-ba... |
ZuluPro/libcloud | refs/heads/trunk | docs/examples/compute/openstack/tenant_name.py | 60 | from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver
OpenStack = get_driver(Provider.OPENSTACK)
driver = OpenStack('your_auth_username', 'your_auth_password',
ex_tenant_name='mytenant',
ex_force_auth_url='http://192.168.1.101:5000',
... |
nikolas/lettuce | refs/heads/master | tests/integration/lib/Django-1.2.5/tests/regressiontests/dispatch/__init__.py | 277 | """Unit-tests for the dispatch project
"""
|
Star2Billing/newfies-dialer | refs/heads/develop | newfies/survey/constants.py | 4 | #
# Newfies-Dialer License
# http://www.newfies-dialer.org
#
# 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/.
#
# Copyright (C) 2011-2015 Star2Billing S.L.
#
# The primar... |
Chris35Wills/Chris35Wills.github.io | refs/heads/master | _drafts/CONVOLUTION/moving_window_example.py | 1 | # -*- coding: utf-8 -*-
"""
Created on Mon Aug 20 12:09:54 2018
@author: chrwil
"""
import numpy as np
import matplotlib.pyplot as plt
# Make some toy data
arr_in = np.round(np.random.uniform(low=0, high=20, size=(11,11)), 2)
arr_out=np.ones(arr_in.shape)
# Set a kernel size (e.g. value of 3 for a 3x3 window)
kerne... |
Intel-tensorflow/tensorflow | refs/heads/master | tensorflow/python/keras/activations.py | 5 | # 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... |
eleonrk/SickRage | refs/heads/master | sickbeard/providers/ncore.py | 2 | # coding=utf-8
# Author: Dustyn Gibson <miigotu@gmail.com>
# URL: https://sickchill.github.io
#
# This file is part of SickChill.
#
# SickChill is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Fre$
# Foundation, either version 3 of the Lice... |
Stanford-Online/edx-platform | refs/heads/master | common/lib/capa/setup.py | 25 | from setuptools import find_packages, setup
setup(
name="capa",
version="0.1",
packages=find_packages(exclude=["tests"]),
install_requires=[
"setuptools",
"lxml",
"pytz"
],
)
|
AriZuu/micropython | refs/heads/master | tests/extmod/machine_pinbase.py | 24 | try:
import umachine as machine
except ImportError:
import machine
try:
machine.PinBase
except AttributeError:
print("SKIP")
raise SystemExit
class MyPin(machine.PinBase):
def __init__(self):
print("__init__")
self.v = False
def value(self, v=None):
print("value:"... |
Bryukh/ajenti | refs/heads/master | plugins/squid/__init__.py | 12 | MODULES = ['api', 'config', 'backend', 'main', 'ui_acls', 'ui_bindings', 'ui_http_access', 'ui_refresh_patterns']
DEPS = [
(['any'],
[
('plugin', 'services'),
('app', 'Squid', 'squid')
])
]
NAME = 'Squid'
PLATFORMS = ['any']
DESCRIPTION = 'Control Squid caching proxy server'
VERSION = '... |
ThQ/qd | refs/heads/master | translaters/sir_pp.py | 1 | import sys
class CommandHandler:
def __init__(self, preprocessor):
self.output = ""
self.pp = preprocessor
def get_output(self):
return self.output
def initialize(self, at, block_opcode_pos, args):
return False
def put_command(self, at, command, args):
return -1
def put... |
nycholas/ask-undrgz | refs/heads/master | src/ask-undrgz/django/contrib/sitemaps/views.py | 55 | from django.http import HttpResponse, Http404
from django.template import loader
from django.contrib.sites.models import Site
from django.core import urlresolvers
from django.utils.encoding import smart_str
from django.core.paginator import EmptyPage, PageNotAnInteger
def index(request, sitemaps):
current_site = S... |
FokkeZB/titanium_mobile | refs/heads/master | node_modules/ioslib/node_modules/node-ios-device/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings_test.py | 395 | #!/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.
"""Unit tests for the MSVSSettings.py file."""
import StringIO
import unittest
import gyp.MSVSSettings as MSVSSettings
class TestSequence... |
mikeumus/django-admin-views | refs/heads/master | example_project/example_project/urls.py | 1 | from django.conf.urls import patterns, include, url
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'example_project.views.home', name='home'),
# url(r'^example_project/', include('example_project... |
jeffzheng1/tensorflow | refs/heads/master | tensorflow/python/util/future_api_test.py | 173 | # 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... |
Kayra/Thunder | refs/heads/master | server/routines/migrations/0002_auto_20160216_2236.py | 1 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('routines', '0001_initial'),
]
op... |
WhySoGeeky/DroidPot | refs/heads/master | venv/lib/python2.7/site-packages/jinja2/loaders.py | 333 | # -*- coding: utf-8 -*-
"""
jinja2.loaders
~~~~~~~~~~~~~~
Jinja loader classes.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
import os
import sys
import weakref
from types import ModuleType
from os import path
from hashlib import sha1
from jinja2.excepti... |
PandaWei/tp-qemu | refs/heads/master | generic/tests/yum_update.py | 5 | import logging
import time
def internal_yum_update(session, command, prompt, timeout):
"""
Helper function to perform the yum update test.
:param session: shell session stablished to the host
:param command: Command to be sent to the shell session
:param prompt: Machine prompt
:param timeout:... |
ox-it/python-sharepoint | refs/heads/master | sharepoint/site.py | 2 | import functools
from lxml import etree
from six.moves.urllib.request import Request
from six.moves.urllib.parse import urljoin
from .lists import SharePointLists
from .users import SharePointUsers
from .xml import soap_body, namespaces, OUT
class SharePointSite(object):
def __init__(self, url, opener, timeout... |
wfhio/tramcar | refs/heads/master | job_board/migrations/0009_auto_20161006_0234.py | 1 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-10-06 02:34
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('job_board', '0008_auto_20161001_2110'),
]
operations = [
migrations.AlterFi... |
rikuayanokozy/closure-templates | refs/heads/master | python/generated_sanitize.py | 5 | # START GENERATED CODE FOR ESCAPERS.
from __future__ import unicode_literals
import re
import urllib
try:
str = unicode
except NameError:
pass
def escape_uri_helper(v):
return urllib.quote(str(v))
_ESCAPE_MAP_FOR_ESCAPE_HTML__AND__NORMALIZE_HTML__AND__ESCAPE_HTML_NOSPACE__AND__NORMALIZE_HTML_NOSPACE = {
'\... |
fedackb/surface-constraint-tools | refs/heads/master | properties/ShrinkwrapProps.py | 1 | # ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distrib... |
LaoZhongGu/kbengine | refs/heads/master | kbe/src/lib/python/Lib/test/test_sys.py | 6 | import unittest, test.support
import sys, io, os
import struct
import subprocess
import textwrap
import warnings
import operator
import codecs
# count the number of test runs, used to create unique
# strings to intern in test_intern()
numruns = 0
try:
import threading
except ImportError:
threading = None
cla... |
egaxegax/django-dbcartajs | refs/heads/master | django/core/cache/__init__.py | 98 | """
Caching framework.
This package defines set of cache backends that all conform to a simple API.
In a nutshell, a cache is a set of values -- which can be any object that
may be pickled -- identified by string keys. For the complete API, see
the abstract BaseCache class in django.core.cache.backends.base.
Client ... |
bancek/egradebook | refs/heads/master | src/lib/django/contrib/comments/signals.py | 425 | """
Signals relating to comments.
"""
from django.dispatch import Signal
# Sent just before a comment will be posted (after it's been approved and
# moderated; this can be used to modify the comment (in place) with posting
# details or other such actions. If any receiver returns False the comment will be
# discarded a... |
iarroyof/nlp-pipeline | refs/heads/master | attention_lstm_.py | 1 | """
A keras attention layer that wraps RNN layers.
Based on tensorflows [attention_decoder](https://github.com/tensorflow/tensorflow/blob/c8a45a8e236776bed1d14fd71f3b6755bd63cc58/tensorflow/python/ops/seq2seq.py#L506)
and [Grammar as a Foreign Language](https://arxiv.org/abs/1412.7449).
date: 20161101
author: wassna... |
msegado/edx-platform | refs/heads/master | cms/tests/test_startup.py | 154 | """
Test cms startup
"""
from django.conf import settings
from django.test import TestCase
from django.test.utils import override_settings
from mock import patch
from cms.startup import run, enable_theme
class StartupTestCase(TestCase):
"""
Test cms startup
"""
def setUp(self):
super(Start... |
levilucio/SyVOLT | refs/heads/master | GM2AUTOSAR_MM/Properties/positive/Himesis/HECUSysTrivialTrueCompleteLHS.py | 1 |
from core.himesis import Himesis, HimesisPreConditionPatternLHS
class HECUSysTrivialTrueCompleteLHS(HimesisPreConditionPatternLHS):
def __init__(self):
"""
Creates the himesis graph representing the AToM3 model HECUSysTrivialTrueCompleteLHS.
"""
# Flag this instance as compiled no... |
absoludity/servo | refs/heads/master | tests/wpt/web-platform-tests/tools/html5lib/html5lib/filters/optionaltags.py | 1727 | from __future__ import absolute_import, division, unicode_literals
from . import _base
class Filter(_base.Filter):
def slider(self):
previous1 = previous2 = None
for token in self.source:
if previous1 is not None:
yield previous2, previous1, token
previous2... |
meee1/ardupilotold | refs/heads/master | Tools/autotest/apm_unit_tests/dev/arducopter_RTL.py | 250 | import arducopter
def unit_test(mavproxy, mav):
'''A scripted flight plan'''
if (
arducopter.calibrate_level(mavproxy, mav) and
arducopter.arm_motors(mavproxy, mav) and
arducopter.takeoff(mavproxy,mav, alt_min=80, takeoff_throttle=1510) and
arducopter.hover(mavproxy,mav, hove... |
manazhao/tf_recsys | refs/heads/r1.0 | tensorflow/python/ops/variables.py | 10 | # 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... |
brunobergher/dotfiles | refs/heads/master | sublime/pygments/all/pygments/lexers/data.py | 45 | # -*- coding: utf-8 -*-
"""
pygments.lexers.data
~~~~~~~~~~~~~~~~~~~~
Lexers for data file format.
:copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexer import RegexLexer, ExtendedRegexLexer, LexerContext, \
... |
froydnj/servo | refs/heads/master | python/mach/mach/test/providers/throw2.py | 131 | # 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/.
# This file exists to trigger the differences in mach error reporting between
# exceptions that occur in mach command mo... |
SamuelDSR/YouCompleteMe-Win7-GVIM | refs/heads/master | third_party/waitress/waitress/channel.py | 3 | ##############################################################################
#
# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# TH... |
intgr/django | refs/heads/master | tests/migrations/test_migrations_squashed_complex_multi_apps/app1/3_auto.py | 133 | from django.db import migrations
class Migration(migrations.Migration):
dependencies = [("app1", "2_auto"), ("app2", "2_auto")]
operations = [
migrations.RunPython(migrations.RunPython.noop)
]
|
zooba/PTVS | refs/heads/master | Python/Product/Miniconda/Miniconda3-x64/Lib/site-packages/conda_env/cli/main_list.py | 7 | # -*- coding: utf-8 -*-
# Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
from argparse import RawDescriptionHelpFormatter
from conda.cli import common
from conda.cli.conda_argparse import add_parser_json
from conda.core.envs_manager import list_all_known_prefixes
description = """
List the C... |
poiati/django | refs/heads/master | tests/admin_inlines/test_templates.py | 285 | from __future__ import unicode_literals
from django.template.loader import render_to_string
from django.test import SimpleTestCase
class TestTemplates(SimpleTestCase):
def test_javascript_escaping(self):
context = {
'inline_admin_formset': {
'formset': {'prefix': 'my-prefix'},... |
kotoroshinoto/Cluster_SimpleJob_Generator | refs/heads/master | pybin/DGESeqSimulation/aligntables.py | 1 | """
aligntables.py script
version 2013.08.09
@author: Bing
takes data from two spreadsheets and aligns the independent variables
"""
import os, sys
input_dir = os.path.join(os.path.dirname(__file__), 'Output')
old_dir = os.getcwd()
os.chdir(input_dir)
'''
if len(sys.argv) != 3:
sys.stderr.write('\... |
chris-wood/ns-3-dev-ndnSIM | refs/heads/ndnSIM-v2 | src/buildings/bindings/callbacks_list.py | 664 | callback_classes = [
['void', 'ns3::Ptr<ns3::NetDevice>', 'ns3::Ptr<ns3::Packet const>', 'unsigned short', 'ns3::Address const&', 'ns3::Address const&', 'ns3::NetDevice::PacketType', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
]
|
CapeDrew/DITK | refs/heads/master | Examples/Filtering/CurvatureAnisotropicDiffusionImageFilter.py | 13 | #==========================================================================
#
# Copyright Insight Software Consortium
#
# 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... |
soycode/pattern | refs/heads/master | pattern/server/cherrypy/cherrypy/lib/auth_digest.py | 101 | # This file is part of CherryPy <http://www.cherrypy.org/>
# -*- coding: utf-8 -*-
# vim:ts=4:sw=4:expandtab:fileencoding=utf-8
__doc__ = """An implementation of the server-side of HTTP Digest Access
Authentication, which is described in :rfc:`2617`.
Example usage, using the built-in get_ha1_dict_plain function which... |
sobercoder/gem5 | refs/heads/master | src/unittest/stattestmain.py | 8 | def main():
from _m5.stattest import stattest_init, stattest_run
import m5.stats
stattest_init()
# Initialize the global statistics
m5.stats.initSimStats()
m5.stats.initText("cout")
# We're done registering statistics. Enable the stats package now.
m5.stats.enable()
# Reset to p... |
yceruto/django-guardian | refs/heads/master | guardian/conf/settings.py | 30 | from __future__ import unicode_literals
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
ANONYMOUS_DEFAULT_USERNAME_VALUE = getattr(settings,
'ANONYMOUS_DEFAULT_USERNAME_VALUE', 'AnonymousUser')
ANONYMOUS_USER_ID = getattr(settings, 'ANONYMOUS_USER_ID', None)
if ANONYMOUS_US... |
40223136/-2015cd_midterm | refs/heads/master | static/Brython3.1.1-20150328-091302/Lib/xml/sax/_exceptions.py | 625 | """Different kinds of SAX Exceptions"""
#in brython the 4 lines below causes an $globals['Exception'] error
#import sys
#if sys.platform[:4] == "java":
# from java.lang import Exception
#del sys
# ===== SAXEXCEPTION =====
class SAXException(Exception):
"""Encapsulate an XML error or warning. This class can con... |
UQ-UQx/old_injestor | refs/heads/master | services/coursestructure/service.py | 1 | #!/usr/bin/python
import os
import lxml
import time
import json
import pymongo
from datetime import datetime
from bson.objectid import ObjectId
import baseservice
from lxml import etree
import pprint
basepath = os.path.dirname(__file__)
class Coursestructure(baseservice.BaseService):
inst = None
def __ini... |
ramitalat/odoo | refs/heads/8.0 | addons/product/pricelist.py | 23 | # -*- 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... |
mfherbst/spack | refs/heads/develop | lib/spack/external/_pytest/terminal.py | 23 | """ terminal reporting of the full testing process.
This is a good source for looking at the various reporting hooks.
"""
from __future__ import absolute_import, division, print_function
import itertools
from _pytest.main import EXIT_OK, EXIT_TESTSFAILED, EXIT_INTERRUPTED, \
EXIT_USAGEERROR, EXIT_NOTESTSCOLLECTED... |
nemesisdesign/openwisp2 | refs/heads/master | openwisp_controller/config/base/base.py | 1 | import collections
import hashlib
import json
from copy import deepcopy
from django.core.exceptions import ValidationError
from django.db import models
from django.utils.functional import cached_property
from django.utils.module_loading import import_string
from django.utils.translation import ugettext_lazy as _
from ... |
lbartoletti/QGIS | refs/heads/master | scripts/qgis_fixes/fix_funcattrs.py | 77 | from lib2to3.fixes.fix_funcattrs import FixFuncattrs
|
andresmargalef/xbmc-plugin.video.ted.talks | refs/heads/helix | resources/lib/settings_test.py | 1 | import unittest
import settings
class TestSettings(unittest.TestCase):
def setUp(self):
unittest.TestCase.setUp(self)
self.enable_subtitles = settings.enable_subtitles
self.xbmc_language = settings.xbmc_language
self.subtitle_language = settings.subtitle_language
def tearDown(... |
GdZ/scriptfile | refs/heads/master | software/googleAppEngine/lib/django_1_4/django/utils/numberformat.py | 94 | from django.conf import settings
from django.utils.safestring import mark_safe
def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='',
force_grouping=False):
"""
Gets a number (as a number or string), and returns it as a string,
using formats defined as arguments:
* ... |
z1gm4/desarrollo_web_udp | refs/heads/dev | env/lib/python2.7/UserDict.py | 4 | /usr/lib/python2.7/UserDict.py |
tbenthompson/taskloaf | refs/heads/master | taskloaf/protocol.py | 1 | import cloudpickle
import capnp # noqa
import taskloaf.message_capnp
import logging
log = logging.getLogger(__name__)
class CloudPickleMsg:
@staticmethod
def serialize(args):
msg = taskloaf.message_capnp.Message.new_message()
msg.arbitrary = cloudpickle.dumps(args)
return msg
@... |
cmvelo/ansible-modules-core | refs/heads/devel | cloud/openstack/_quantum_floating_ip_associate.py | 146 | #!/usr/bin/python
#coding: utf-8 -*-
# (c) 2013, Benno Joy <benno@ansible.com>
#
# This module is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later ... |
b-me/django | refs/heads/master | django/contrib/gis/db/models/query.py | 224 | import warnings
from django.contrib.gis.db.models import aggregates
from django.contrib.gis.db.models.fields import (
GeometryField, LineStringField, PointField, get_srid_info,
)
from django.contrib.gis.db.models.lookups import GISLookup
from django.contrib.gis.db.models.sql import (
AreaField, DistanceField, ... |
fabioz/Pydev | refs/heads/master | plugins/org.python.pydev.jython/Lib/poplib.py | 223 | """A POP3 client class.
Based on the J. Myers POP3 draft, Jan. 96
"""
# Author: David Ascher <david_ascher@brown.edu>
# [heavily stealing from nntplib.py]
# Updated: Piers Lauder <piers@cs.su.oz.au> [Jul '97]
# String method conversion and test jig improvements by ESR, February 2001.
# Added the POP3_SSL clas... |
alkalait/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers | refs/heads/master | ExamplesFromChapters/Chapter1/SMS_behaviour.py | 90 | import pymc as pm
import numpy as np
count_data = np.loadtxt("../../Chapter1_Introduction/data/txtdata.csv")
n_count_data = len(count_data)
alpha = 1.0 / count_data.mean() # recall count_data is
# the variable that holds our txt counts
lambda_1 = pm.Exponential("lambda_1", alpha)
l... |
andreyvit/pyjamas | refs/heads/master | examples/timesheet/components/Grid.py | 7 |
# vim: set ts=4 sw=4 expandtab:
import pyjamas.ui.Grid
class Grid(pyjamas.ui.Grid.Grid):
def __init__(self, topHeader = True, leftBorder=True):
pyjamas.ui.Grid.Grid.__init__(self)
self.selectedRow = 0
if topHeader:
self.top = 1
else:
self.top = 0
i... |
kartoza/miniSASS | refs/heads/master | monitor/migrations/0001_initial.py | 2 | # -*- 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 model 'Organisations'
db.create_table(u'organisations', (
('id', self.gf('django.db.mod... |
nicholas-silveira/art_pipeline | refs/heads/master | maya/packages/oop_maya/core/ui_test.py | 1 | import oop_maya.core as oop_maya
import oop_python.core as oop_python #@UnresolvedImport
UI_FILE_PATH = 'C:\\Users\\NicholasSilveira\\Documents\\GitHub\\art_pipeline\\dcc\\packages\\oop_dcc\\tools\\developer\\ui\\batch_tool.ui'
ui_object, base_class = oop_python.get_pyside_class( UI_FILE_PATH )
class ui_test( base_cl... |
jolyonb/edx-platform | refs/heads/master | common/djangoapps/util/query.py | 1 | """ Utility functions related to database queries """
from __future__ import absolute_import
from django.conf import settings
def use_read_replica_if_available(queryset):
"""
If there is a database called 'read_replica', use that database for the queryset.
"""
return queryset.using("read_replica") if... |
synth3tk/the-blue-alliance | refs/heads/master | datafeeds/tba_videos_parser.py | 7 | import logging
import re
from BeautifulSoup import BeautifulSoup
from datafeeds.parser_base import ParserBase
class TbaVideosParser(ParserBase):
"""
Facilitates building TBAVideos store from TBA.
"""
@classmethod
def parse(self, html):
"""
Parse the directory listing on TBA to ex... |
Ultrax5/android_kernel_sony_msm8960t | refs/heads/master_jb-4.3 | scripts/build-all.py | 1182 | #! /usr/bin/env python
# Copyright (c) 2009-2011, The Linux Foundation. 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
# ... |
mohsenSy/zulip | refs/heads/master | api/integrations/perforce/zulip_change-commit.py | 20 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright © 2012-2014 Zulip, 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 rig... |
tobbad/micropython | refs/heads/master | tests/basics/list_sort.py | 63 | l = [1, 3, 2, 5]
print(l)
print(sorted(l))
l.sort()
print(l)
print(l == sorted(l))
print(sorted(l, key=lambda x: -x))
l.sort(key=lambda x: -x)
print(l)
print(l == sorted(l, key=lambda x: -x))
print(sorted(l, key=lambda x: -x, reverse=True))
l.sort(key=lambda x: -x, reverse=True)
print(l)
print(l == sorted(l, key=lam... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.