repo_name stringlengths 6 100 | path stringlengths 4 294 | copies stringlengths 1 5 | size stringlengths 4 6 | content stringlengths 606 896k | license stringclasses 15
values |
|---|---|---|---|---|---|
Stanford-Online/edx-platform | lms/djangoapps/support/views/certificate.py | 23 | 1319 | """
Certificate tool in the student support app.
"""
import urllib
from django.utils.decorators import method_decorator
from django.views.generic import View
from edxmako.shortcuts import render_to_response
from support.decorators import require_support_permission
class CertificatesSupportView(View):
"""
Vi... | agpl-3.0 |
ojengwa/oh-mainline | vendor/packages/docutils/docutils/parsers/rst/roles.py | 108 | 14739 | # $Id: roles.py 7514 2012-09-14 14:27:12Z milde $
# Author: Edward Loper <edloper@gradient.cis.upenn.edu>
# Copyright: This module has been placed in the public domain.
"""
This module defines standard interpreted text role functions, a registry for
interpreted text roles, and an API for adding to and retrieving from ... | agpl-3.0 |
davenovak/mtasa-blue | vendor/google-breakpad/src/tools/gyp/test/rules/gyptest-default.py | 226 | 1431 | #!/usr/bin/env python
# Copyright (c) 2011 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 rules when using an explicit build target of 'all'.
"""
import TestGyp
test = TestGyp.TestGyp()
test.run_gyp('actions... | gpl-3.0 |
cogitate/twitter-zipkin-uuid | doc/src/sphinx/exts/includecode.py | 121 | 5444 | import os
import codecs
from os import path
from docutils import nodes
from docutils.parsers.rst import Directive, directives
class IncludeCode(Directive):
"""
Include a code example from a file with sections delimited with special comments.
"""
has_content = False
required_arguments = 1
opti... | apache-2.0 |
amyvmiwei/kbengine | kbe/res/scripts/common/Lib/site-packages/pip/_vendor/requests/packages/urllib3/util/timeout.py | 303 | 9236 | from socket import _GLOBAL_DEFAULT_TIMEOUT
import time
from ..exceptions import TimeoutStateError
def current_time():
"""
Retrieve the current time, this function is mocked out in unit testing.
"""
return time.time()
_Default = object()
# The default timeout to use for socket connections. This is t... | lgpl-3.0 |
candlepin/rho | src/rho/crypto.py | 2 | 5263 | #
# Copyright (c) 2009 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a copy of... | gpl-2.0 |
saurabh6790/trufil_lib | core/doctype/event/event.py | 16 | 5774 | # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import webnotes
from webnotes.utils import getdate, cint, add_months, date_diff, add_days, nowdate
weekdays = ["monday", "tuesday", "wednesday", "thursday", "friday", "saturd... | mit |
thesquelched/libcloud | libcloud/common/cloudsigma.py | 29 | 4014 | # -*- 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 "Lic... | apache-2.0 |
a710128/Lesson9 | API/course.py | 1 | 3339 | import re
class CourseException(Exception):
def __init__(self, msg, err):
super(CourseException, self).__init__()
self.msg = msg
self.err = err
def __str__(self):
return "CourseError : " + self.msg
def __repr__(self):
return '<CourseException msg : "%s", errcode :... | mit |
knotwork/old-devcoin-qt | scripts/extract_strings_qt.py | 2 | 2027 | #!/usr/bin/python
'''
Extract _("...") strings for translation and convert to Qt4 stringdefs so that
they can be picked up by Qt linguist.
'''
from subprocess import Popen, PIPE
OUT_CPP="src/qt/bitcoinstrings.cpp"
EMPTY=['""']
def parse_po(text):
"""
Parse 'po' format produced by xgettext.
Return a list o... | mit |
mrquim/mrquimrepo | script.module.livestreamer/lib/livestreamer/plugins/stream.py | 37 | 2374 | from livestreamer.compat import urlparse
from livestreamer.exceptions import PluginError
from livestreamer.plugin import Plugin
from livestreamer.stream import (AkamaiHDStream, HDSStream, HLSStream,
HTTPStream, RTMPStream)
import ast
import re
PROTOCOL_MAP = {
"akamaihd": AkamaiHD... | gpl-2.0 |
swayf/pyLoad | module/lib/simplejson/__init__.py | 45 | 18626 | r"""JSON (JavaScript Object Notation) <http://json.org> is a subset of
JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data
interchange format.
:mod:`simplejson` exposes an API familiar to users of the standard library
:mod:`marshal` and :mod:`pickle` modules. It is the externally maintained
version of ... | agpl-3.0 |
marcore/edx-platform | cms/lib/xblock/tagging/migrations/0001_initial.py | 39 | 1187 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='TagAvailableValues',
fields=[
('id', models.Aut... | agpl-3.0 |
hsgui/interest-only | deeplearning/reinforcementlearning/ghostAgents.py | 44 | 3108 | # ghostAgents.py
# --------------
# Licensing Information: You are free to use or extend these projects for
# educational purposes provided that (1) you do not distribute or publish
# solutions, (2) you retain this notice, and (3) you provide clear
# attribution to UC Berkeley, including a link to http://ai.berkeley.e... | gpl-2.0 |
gale320/newfies-dialer | newfies/apirest/view_callrequest.py | 4 | 1563 | # -*- coding: utf-8 -*-
#
# 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-2014 Star2Bil... | mpl-2.0 |
aldian/tensorflow | tensorflow/python/tools/strip_unused.py | 180 | 3786 | # 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 |
wuhengzhi/chromium-crosswalk | chrome/common/extensions/docs/server2/path_canonicalizer.py | 78 | 4806 | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from collections import defaultdict
import posixpath
from future import Future
from path_util import SplitParent
from special_paths import SITE_VERIFICATION... | bsd-3-clause |
LICEF/edx-platform | lms/djangoapps/courseware/management/commands/metadata_to_json.py | 30 | 2740 | """
A script to walk a course xml tree, generate a dictionary of all the metadata,
and print it out as a json dict.
"""
import sys
import json
from collections import OrderedDict
from path import path
from django.core.management.base import BaseCommand
from xmodule.modulestore.xml import XMLModuleStore
from xmodule.... | agpl-3.0 |
robwarm/gpaw-symm | gpaw/cluster.py | 1 | 6122 | """Extensions to the ase Atoms class
"""
import numpy as np
from ase import Atoms
from ase.io import read, write
from ase.data import covalent_radii
from ase.calculators.neighborlist import NeighborList
class Cluster(Atoms):
"""A class for cluster structures
to enable simplified manipulation"""
def __in... | gpl-3.0 |
Jorge-Rodriguez/ansible | test/units/modules/network/f5/test_bigip_remote_syslog.py | 21 | 6862 | # -*- 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, ... | gpl-3.0 |
cggh/DQXServer | responders/recordinfo.py | 1 | 1698 | # This file is part of DQXServer - (C) Copyright 2014, Paul Vauterin, Ben Jeffery, Alistair Miles <info@cggh.org>
# This program is free software licensed under the GNU Affero General Public License.
# You can find a copy of this license in LICENSE in the top directory of the source code or at <http://opensource.org/... | agpl-3.0 |
BeegorMif/HTPC-Manager | lib/html5lib/sanitizer.py | 100 | 14472 | import re
from xml.sax.saxutils import escape, unescape
from tokenizer import HTMLTokenizer
from constants import tokenTypes
class HTMLSanitizerMixin(object):
""" sanitization of XHTML+MathML+SVG and of inline style attributes."""
acceptable_elements = ['a', 'abbr', 'acronym', 'address', 'area',
'art... | gpl-3.0 |
lthall/Leonard_ardupilot | libraries/AP_HAL_ChibiOS/hwdef/scripts/dma_resolver.py | 15 | 20646 | #!/usr/bin/env python
import sys, fnmatch
import importlib
# peripheral types that can be shared, wildcard patterns
SHARED_MAP = ["I2C*", "USART*_TX", "UART*_TX", "SPI*", "TIM*_UP", "TIM*_CH*"]
ignore_list = []
dma_map = None
debug = False
def check_possibility(periph, dma_stream, curr_dict, dma_map, check_list, c... | gpl-3.0 |
troukny/NetGen | configtool/setuptools-3.6/setuptools/tests/test_sdist.py | 332 | 17816 | # -*- coding: utf-8 -*-
"""sdist tests"""
import locale
import os
import shutil
import sys
import tempfile
import unittest
import unicodedata
import re
from setuptools.tests import environment, test_svn
from setuptools.tests.py26compat import skipIf
from setuptools.compat import StringIO, unicode
from setuptools.test... | gpl-3.0 |
neoareslinux/neutron | neutron/agent/dhcp/config.py | 2 | 3128 | # Copyright 2015 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 re... | apache-2.0 |
htzy/bigfour | common/lib/calc/calc/functions.py | 279 | 1521 | """
Provide the mathematical functions that numpy doesn't.
Specifically, the secant/cosecant/cotangents and their inverses and
hyperbolic counterparts
"""
import numpy
# Normal Trig
def sec(arg):
"""
Secant
"""
return 1 / numpy.cos(arg)
def csc(arg):
"""
Cosecant
"""
return 1 / nump... | agpl-3.0 |
alexdglover/shill-isms | venv/lib/python2.7/site-packages/gunicorn/reloader.py | 98 | 1533 | # -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
import os
import re
import sys
import time
import threading
class Reloader(threading.Thread):
def __init__(self, extra_files=None, interval=1, callback=None):
super(Reloader, sel... | mit |
hudora/huDjango | hudjango/management/commands/couchdb-init.py | 1 | 1234 | # encoding: utf-8
import couchdb
from optparse import make_option
from hudjango.management.couchdb.support import CouchDBBaseCommand
from django.core.management.base import CommandError
class Command(CouchDBBaseCommand):
help = """ Creates a new couchdb database. """
option_list = CouchDBBaseCommand.option_l... | bsd-2-clause |
vicky2135/lucious | oscar/lib/python2.7/site-packages/factory/containers.py | 2 | 11658 | # -*- coding: utf-8 -*-
# Copyright (c) 2010 Mark Sandstrom
# Copyright (c) 2011-2015 Raphaël Barrois
#
# 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 ... | bsd-3-clause |
iwaseyusuke/ryu | ryu/tests/unit/ofproto/test_oxm.py | 29 | 5609 | # Copyright (C) 2015 Nippon Telegraph and Telephone Corporation.
# Copyright (C) 2015 YAMAMOTO Takashi <yamamoto at valinux co jp>
#
# 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:... | apache-2.0 |
sestrella/ansible | lib/ansible/modules/cloud/azure/azure_rm_sqlfirewallrule.py | 24 | 9625 | #!/usr/bin/python
#
# Copyright (c) 2017 Zim Kalinowski, <zikalino@microsoft.com>
#
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | gpl-3.0 |
rubencabrera/odoo | addons/website/models/test_models.py | 335 | 1386 | # -*- coding: utf-8 -*-
from openerp.osv import orm, fields
class test_converter(orm.Model):
_name = 'website.converter.test'
# disable translation export for those brilliant field labels and values
_translate = False
_columns = {
'char': fields.char(),
'integer': fields.integer(),
... | agpl-3.0 |
hgrall/merite | archives/grall/node_modules/node-gyp/gyp/pylib/gyp/common.py | 1292 | 20063 | # 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.
from __future__ import with_statement
import collections
import errno
import filecmp
import os.path
import re
import tempfile
import sys
# A minimal memoizing d... | gpl-3.0 |
capitalone/cloud-custodian | tools/c7n_mailer/c7n_mailer/replay.py | 1 | 5458 | """
Allow local testing of mailer and templates by replaying an SQS message.
MAILER_FILE input is a file containing the exact base64-encoded, gzipped
data that's enqueued to SQS via :py:meth:`c7n.actions.Notify.send_sqs`.
Alternatively, with -p|--plain specified, the file will be assumed to be
JSON data that can be l... | apache-2.0 |
40223143/2015cd_midterm | static/Brython3.1.1-20150328-091302/Lib/tokenize.py | 728 | 24424 | """Tokenization help for Python programs.
tokenize(readline) is a generator that breaks a stream of bytes into
Python tokens. It decodes the bytes according to PEP-0263 for
determining source file encoding.
It accepts a readline-like method which is called repeatedly to get the
next line of input (or b"" for EOF). ... | gpl-3.0 |
dbolgheroni/rswtch | rswtch-legacy.py | 1 | 6564 | #!/usr/bin/env python2.7
#
# Copyright (c) 2016, Daniel Bolgheroni.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# ... | bsd-2-clause |
GaryKriebel/osf.io | framework/email/tasks.py | 32 | 1454 | import smtplib
import logging
from email.mime.text import MIMEText
from framework.tasks import app
from website import settings
logger = logging.getLogger(__name__)
@app.task
def send_email(from_addr, to_addr, subject, message, mimetype='html', ttls=True, login=True,
username=None, password=None, ma... | apache-2.0 |
is06/navitia | source/jormungandr/jormungandr/renderers.py | 11 | 5578 | # coding=utf-8
# Copyright (c) 2001-2014, Canal TP and/or its affiliates. All rights reserved.
#
# This file is part of Navitia,
# the software to build cool stuff with public transport.
#
# Hope you'll enjoy and contribute to this project,
# powered by Canal TP (www.canaltp.fr).
# Help us simplify mobility a... | agpl-3.0 |
zzzzzsh/pyspider | pyspider/webui/webdav.py | 56 | 6092 | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
# vim: set et sw=4 ts=4 sts=4 ff=unix fenc=utf8:
# Author: Binux<roy@binux.me>
# http://binux.me
# Created on 2015-6-3 11:29
import os
import re
import time
import base64
from six import BytesIO
from wsgidav.wsgidav_app import DEFAULT_CONFIG, WsgiDAVApp
from wsg... | apache-2.0 |
kevgliss/lemur | lemur/tests/vectors.py | 1 | 14798 | from lemur.common.utils import parse_certificate
VALID_USER_HEADER_TOKEN = {
'Authorization': 'Basic ' + 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1MjE2NTIwMjIsImV4cCI6MjM4NTY1MjAyMiwic3ViIjoxfQ.uK4PZjVAs0gt6_9h2EkYkKd64nFXdOq-rHsJZzeQicc',
'Content-Type': 'application/json'
}
VALID_ADMIN_HEADER_TOKEN... | apache-2.0 |
purpleidea/macaronic-net | django/utils/synch.py | 376 | 2549 | """
Synchronization primitives:
- reader-writer lock (preference to writers)
(Contributed to Django by eugene@lazutkin.com)
"""
try:
import threading
except ImportError:
import dummy_threading as threading
class RWLock:
"""
Classic implementation of reader-writer lock with preference to writers.... | agpl-3.0 |
reiaaoyama/contrail-controller | src/config/vnc_openstack/vnc_openstack/tests/test_basic.py | 7 | 8854 | import sys
import json
from testtools.matchers import Equals, Contains
sys.path.append('../common/tests')
from test_utils import *
import test_common
import test_case
class TestBasic(test_case.NeutronBackendTestCase):
def test_list_with_inconsistent_members(self):
self.skipTest("Skipping this flakky tes... | apache-2.0 |
ArcherSys/ArcherSys | Lib/site-packages/IPython/testing/plugin/ipdoctest.py | 5 | 31223 | """Nose Plugin that supports IPython doctests.
Limitations:
- When generating examples for use as doctests, make sure that you have
pretty-printing OFF. This can be done either by setting the
``PlainTextFormatter.pprint`` option in your configuration file to False, or
by interactively disabling it with %Ppri... | mit |
dlorenc/runtimes-common | appengine/runtime_builders/data_integrity.py | 5 | 4257 | #!/usr/bin/python
# Copyright 2017 Google Inc. All rights reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by app... | apache-2.0 |
petteyg/intellij-community | python/lib/Lib/site-packages/django/template/loader.py | 78 | 8038 | # Wrapper for loading templates from storage of some sort (e.g. filesystem, database).
#
# This uses the TEMPLATE_LOADERS setting, which is a list of loaders to use.
# Each loader is expected to have this interface:
#
# callable(name, dirs=[])
#
# name is the template name.
# dirs is an optional list of directories ... | apache-2.0 |
pseudocubic/neutronpy | neutronpy/models.py | 3 | 3939 | # -*- coding: utf-8 -*-
r"""Physical Models
"""
import numpy as np
def simple_harmonic_oscillator(p, t):
r"""Standard equation for a simple harmonic oscillator
Parameters
----------
p : list
Parameters, in the following format:
+-------+----------------------------+
... | mit |
rupran/ansible | contrib/inventory/serf.py | 395 | 3032 | #!/usr/bin/env python
# (c) 2015, Marc Abramowitz <marca@surveymonkey.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
# (... | gpl-3.0 |
trnewman/VT-USRP-daughterboard-drivers | gnuradio-core/src/python/gnuradio/gr/qa_fractional_interpolator.py | 6 | 1212 | #!/usr/bin/env python
#
# Copyright 2007 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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, or (at your option)
... | gpl-3.0 |
moniqx4/bite-project | deps/gdata-python-client/src/gdata/tlslite/mathtls.py | 273 | 11647 | """Miscellaneous helper functions."""
from utils.compat import *
from utils.cryptomath import *
import hmac
import md5
import sha
#1024, 1536, 2048, 3072, 4096, 6144, and 8192 bit groups]
goodGroupParameters = [(2,0xEEAF0AB9ADB38DD69C33F80AFA8FC5E86072618775FF3C0B9EA2314C9C256576D674DF7496EA81D3383B4813D692C6E0E0D5D... | apache-2.0 |
duqiao/django | tests/validation/test_unique.py | 337 | 7108 | from __future__ import unicode_literals
import datetime
import unittest
from django.apps.registry import Apps
from django.core.exceptions import ValidationError
from django.db import models
from django.test import TestCase
from .models import (
CustomPKModel, FlexibleDatePost, ModelToValidate, Post, UniqueErrors... | bsd-3-clause |
jackwilsdon/beets | beets/mediafile.py | 6 | 1052 | # -*- coding: utf-8 -*-
# This file is part of beets.
# Copyright 2016, Adrian Sampson.
#
# 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 t... | mit |
T-R0D/JustForFun | aoc2016/aoc2016/day18/solution.py | 1 | 2158 | # This file is part of aoc2016.
#
# aoc2016 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.
#
# aoc2016 is distributed in the hope that... | gpl-2.0 |
joshmoore/openmicroscopy | components/tools/OmeroWeb/omeroweb/webclient/controller/impexp.py | 1 | 1058 | #!/usr/bin/env python
#
#
#
# Copyright (c) 2008-2011 University of Dundee.
#
# This program 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 your option) an... | gpl-2.0 |
havard024/prego | crm/lib/python2.7/site-packages/django/views/decorators/clickjacking.py | 550 | 1759 | from functools import wraps
from django.utils.decorators import available_attrs
def xframe_options_deny(view_func):
"""
Modifies a view function so its response has the X-Frame-Options HTTP
header set to 'DENY' as long as the response doesn't already have that
header set.
e.g.
@xframe_optio... | mit |
vaygr/ansible | test/units/modules/cloud/amazon/test_api_gateway.py | 45 | 2355 | #
# (c) 2016 Michael De La Rue
#
# 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... | gpl-3.0 |
mindbender-studio/setup | bin/windows/python36/Lib/webbrowser.py | 8 | 21817 | #! /usr/bin/env python3
"""Interfaces for launching and remotely controlling Web browsers."""
# Maintained by Georg Brandl.
import os
import shlex
import shutil
import sys
import subprocess
__all__ = ["Error", "open", "open_new", "open_new_tab", "get", "register"]
class Error(Exception):
pass
_browsers = {} ... | mit |
BiznetGIO/horizon | openstack_dashboard/dashboards/project/instances/workflows/update_instance.py | 2 | 5828 | # Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the... | apache-2.0 |
codrut3/tensorflow | tensorflow/contrib/mpi_collectives/mpi_ops_test.py | 71 | 11058 | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | apache-2.0 |
mats116/ElasticBigQuery | dmp/external/simplejson/tests/test_iterable.py | 20 | 1151 | import unittest
from StringIO import StringIO
import simplejson as json
def iter_dumps(obj, **kw):
return ''.join(json.JSONEncoder(**kw).iterencode(obj))
def sio_dump(obj, **kw):
sio = StringIO()
json.dumps(obj, **kw)
return sio.getvalue()
class TestIterable(unittest.TestCase):
def test_iterable... | lgpl-3.0 |
diogenesjf/userinfuser | serverside/tools/utils.py | 12 | 2539 | # Copyright (C) 2011, CloudCaptive
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed i... | gpl-3.0 |
erlimar/prototypeguide | src/lib/markupsafe/tests.py | 155 | 3926 | # -*- coding: utf-8 -*-
import gc
import unittest
from markupsafe import Markup, escape, escape_silent
from markupsafe._compat import text_type
class MarkupTestCase(unittest.TestCase):
def test_adding(self):
# adding two strings should escape the unsafe one
unsafe = '<script type="application/x-s... | mit |
jelmer/samba | examples/scripts/shares/python/smbparm.py | 40 | 27894 | ######################################################################
##
## autogenerated file of smb.conf parameters
## generate_parm_table <..../param/loadparm.c>
##
## Copyright (C) Gerald Carter 2004.
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the... | gpl-3.0 |
tracierenea/gnuradio | docs/doxygen/doxyxml/text.py | 333 | 1832 | #
# Copyright 2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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, or (at your option)
# any later version.
#
#... | gpl-3.0 |
helldorado/ansible | lib/ansible/modules/windows/win_scheduled_task_stat.py | 31 | 10444 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2017, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# this is a windows documentation stub. actual code lives in the .ps1
# file of the same name
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | gpl-3.0 |
wenbinf/ndkale | kale/tests/test_task.py | 1 | 9275 | """Module testing the kale.task module."""
import mock
import unittest
from kale import exceptions
from kale import task
from kale import test_utils
class TaskFailureTestCase(unittest.TestCase):
"""Test handle_failure logic."""
def _create_patch(self, name):
"""Helper method for creating scoped moc... | bsd-2-clause |
axbaretto/beam | sdks/python/.tox/lint/lib/python2.7/site-packages/unit_tests/test_credentials.py | 6 | 8612 | # Copyright 2014 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | apache-2.0 |
salfab/CouchPotatoServer | libs/subliminal/services/tvsubtitles.py | 106 | 6240 | # -*- coding: utf-8 -*-
# Copyright 2012 Nicolas Wack <wackou@gmail.com>
#
# This file is part of subliminal.
#
# subliminal is free software; you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 3 of the Licen... | gpl-3.0 |
jnerin/ansible | lib/ansible/modules/network/nxos/nxos_overlay_global.py | 20 | 5917 | #!/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 |
costalfy/Vega-Strike | data/cgi-accountserver/register_submit.py | 3 | 2329 | #! /usr/bin/python
import sys
import os
import string
import cgitb; cgitb.enable()
import db
import settings
header = """
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Account Creation Results</title>
</head>
<body>
"""
footer = """
</body>
</html>
"""
get_form=False
post_fo... | gpl-2.0 |
pyfa-org/Pyfa | gui/builtinViews/implantEditor.py | 1 | 12699 | import re
# noinspection PyPackageRequirements
import wx
# noinspection PyPackageRequirements
from wx.lib.buttons import GenBitmapButton
import gui.builtinMarketBrowser.pfSearchBox as SBox
import gui.display as d
from gui.bitmap_loader import BitmapLoader
from gui.marketBrowser import SearchBox
from service.market im... | gpl-3.0 |
bchareyre/ratchet | py/ymport.py | 1 | 14686 | """
Import geometry from various formats ('import' is python keyword, hence the name 'ymport').
"""
from yade.wrapper import *
from yade import utils
try:
from minieigen import *
except ImportError:
from miniEigen import *
def textExt(fileName,format='x_y_z_r',shift=Vector3.Zero,scale=1.0,**kw):
"""Load sphere co... | gpl-2.0 |
solin319/incubator-mxnet | example/speech_recognition/stt_layer_fc.py | 52 | 6097 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | apache-2.0 |
ericholscher/pinax | scripts/create-venv-script.py | 3 | 1932 | #!/usr/bin/env python
"""
Call this like ``python pinax/bin/create-venv-script.py``
it will refresh the pinax-boot.py script
"""
import os
import virtualenv
from optparse import OptionParser
from os.path import join, exists, dirname, abspath
def main():
usage = "usage: %prog [options]"
description = "Creates a... | mit |
nimiq/moogle-project | magpie/response.py | 1 | 3599 | from abc import ABCMeta, abstractmethod
from utils.exceptions import ResponseError, InconsistentItemError, EntryNotToBeIndexed
class AbstractApiResponse(metaclass=ABCMeta):
"""
Response got after a query to a `Provider`.
Parameters:
response -- a `requests.models.Response` instance.
"""
def... | apache-2.0 |
feroda/gasistafelice | gasistafelice/rest/views/blocks/order_details.py | 3 | 1831 | """View for block details specialized for a GASSupplierOrder"""
from django.utils.translation import ugettext as _, ugettext_lazy as _lazy
from gasistafelice.rest.views.blocks import details
from gasistafelice.gas.forms import order as order_forms
from gasistafelice.consts import INCOME, EXPENSE
from gasistafelice.r... | agpl-3.0 |
chugunovyar/factoryForBuild | env/lib/python2.7/site-packages/scipy/optimize/tests/test_slsqp.py | 20 | 14213 | """
Unit test for SLSQP optimization.
"""
from __future__ import division, print_function, absolute_import
from numpy.testing import (assert_, assert_array_almost_equal, TestCase,
assert_allclose, assert_equal, run_module_suite)
import numpy as np
from scipy._lib._testutils import knownfail... | gpl-3.0 |
pdsteele/DES-Python | rvms.py | 1 | 20759 |
# -------------------------------------------------------------------------
# * This is an ANSI C library that can be used to evaluate the probability
# * density functions (pdf's), cumulative distribution functions (cdf's), and
# * inverse distribution functions (idf's) for a variety of discrete and
# * cont... | mit |
derekjamescurtis/veritranspay | tests/response_virtualaccount_charge_tests.py | 1 | 5544 | from unittest import TestCase
from veritranspay.response.response import VirtualAccountBniChargeResponse, VirtualAccountPermataChargeResponse, \
VirtualAccountBcaChargeResponse, VirtualAccountMandiriChargeResponse
class VirtualAccountPermataChargeResponseTests(TestCase):
"""
https://api-docs.midtrans.com... | bsd-3-clause |
NicholasColotouros/RaspiCorder | RaspiCorder/Menus.py | 1 | 2928 | #!/usr/bin/python
from time import sleep
from Adafruit_CharLCDPlate import Adafruit_CharLCDPlate
class Instrument:
drums = 1
guitar = 2
bass = 3
other = 4
@staticmethod
def instrumentName(num):
if num == 1:
return "drums"
elif num == 2:
return "guitar"
elif num == 3:
return "bass"
... | gpl-2.0 |
jtopjian/st2 | st2api/tests/unit/controllers/v1/test_policies.py | 2 | 10587 | # Licensed to the StackStorm, Inc ('StackStorm') 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 th... | apache-2.0 |
mat128/netman | tests/core/switch_session_test.py | 3 | 7133 | # Copyright 2015 Internap.
#
# 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, so... | apache-2.0 |
chugle/myapp | applications/welcome/controllers/appadmin.py | 6 | 15339 | # -*- coding: utf-8 -*-
# ##########################################################
# ## make sure administrator is on localhost
# ###########################################################
import os
import socket
import datetime
import copy
import gluon.contenttype
import gluon.fileutils
response.subtitle = 'Data... | gpl-2.0 |
firerszd/kbengine | kbe/src/lib/python/Lib/multiprocessing/popen_spawn_win32.py | 102 | 2998 | import os
import msvcrt
import signal
import sys
import _winapi
from . import context
from . import spawn
from . import reduction
from . import util
__all__ = ['Popen']
#
#
#
TERMINATE = 0x10000
WINEXE = (sys.platform == 'win32' and getattr(sys, 'frozen', False))
WINSERVICE = sys.executable.lower().endswith("python... | lgpl-3.0 |
yfried/ansible | lib/ansible/modules/cloud/openstack/os_recordset.py | 29 | 7460 | #!/usr/bin/python
# Copyright (c) 2016 Hewlett-Packard Enterprise
# 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',
'stat... | gpl-3.0 |
ppwwyyxx/tensorpack | examples/DoReFa-Net/resnet-dorefa.py | 1 | 6148 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: resnet-dorefa.py
import argparse
import numpy as np
import os
import cv2
import tensorflow as tf
from tensorpack import *
from tensorpack.dataflow import dataset
from tensorpack.tfutils.varreplace import remap_variables
from dorefa import get_dorefa
from imagenet... | apache-2.0 |
udaciouspeople/site | themes/tranquilpeak/.node_modules/node-gyp/gyp/pylib/gyp/generator/gypd.py | 1824 | 3474 | # Copyright (c) 2011 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.
"""gypd output module
This module produces gyp input as its output. Output files are given the
.gypd extension to avoid overwriting the .gyp files that they are ... | mit |
JudoWill/glue | glue/core/tests/test_subset_group.py | 2 | 6779 | from mock import MagicMock, patch
import numpy as np
from .. import DataCollection, Data, SubsetGroup
from .. import subset
from ..subset import SubsetState
from ..subset_group import coerce_subset_groups
from .test_state import clone
class TestSubsetGroup(object):
def setup_method(self, method):
x = Da... | bsd-3-clause |
flavour/RedHat | modules/ClimateDataPortal/Cache.py | 41 | 2217 |
import errno
import os
from os.path import join, exists
from os import stat, makedirs
# create folder for cache:
# mkdir -p /tmp/climate_data_portal/images/recent/
# mkdir -p /tmp/climate_data_portal/images/older/
MAX_CACHE_FOLDER_SIZE = 2**24 # 16 MiB
class TwoStageCache(object):
def __init__(self, folder, max... | mit |
christianurich/VIBe2UrbanSim | 3rdparty/opus/src/sanfrancisco/zone/aggregate_SSS_DDD_from_building.py | 2 | 2259 | # Opus/UrbanSim urban simulation software.
# Copyright (C) 2005-2009 University of Washington
# See opus_core/LICENSE
from opus_core.variables.variable import Variable
from variable_functions import my_attribute_label
class aggregate_SSS_DDD_from_building(Variable):
"""aggregate SSS_DDD variable from buil... | gpl-2.0 |
duramato/SickRage | sickbeard/providers/t411.py | 2 | 8994 | # -*- coding: latin-1 -*-
# Author: djoole <bobby.djoole@gmail.com>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of SickRage.
#
# Sick Beard 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, ... | gpl-3.0 |
gitprouser/appengine-bottle-skeleton | lib/bs4/diagnose.py | 63 | 6747 | """Diagnostic functions, mainly for use when doing tech support."""
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
__license__ = "MIT"
import cProfile
from StringIO import StringIO
from HTMLParser import HTMLParser
import bs4
from bs4 import BeautifulSoup, __vers... | apache-2.0 |
libscie/liberator | liberator/lib/python3.6/site-packages/django/utils/text.py | 46 | 14941 | from __future__ import unicode_literals
import re
import unicodedata
from gzip import GzipFile
from io import BytesIO
from django.utils import six
from django.utils.encoding import force_text
from django.utils.functional import (
SimpleLazyObject, keep_lazy, keep_lazy_text, lazy,
)
from django.utils.safestring im... | cc0-1.0 |
nilmini20s/gem5-2016-08-13 | src/mem/cache/prefetch/Prefetcher.py | 39 | 4355 | # Copyright (c) 2012, 2014 ARM Limited
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implementation of the function... | bsd-3-clause |
tupolev/plugin.video.mitele | lib/youtube_dl/extractor/newstube.py | 16 | 4603 | # encoding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
ExtractorError,
int_or_none,
)
class NewstubeIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?newstube\.ru/media/(?P<id>.+)'
_TEST = {
'url': 'http://www.newstube.r... | gpl-3.0 |
gfreed/android_external_chromium-org | tools/perf/benchmarks/kraken.py | 24 | 1580 | # Copyright (c) 2012 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.
"""Runs Mozilla's Kraken JavaScript benchmark."""
import os
from telemetry import test
from telemetry.core import util
from telemetry.page import page_... | bsd-3-clause |
nvoron23/arangodb | 3rdParty/V8-4.3.61/buildtools/clang_format/script/clang-format-diff.py | 50 | 3891 | #!/usr/bin/python
#
#===- clang-format-diff.py - ClangFormat Diff Reformatter ----*- python -*--===#
#
# The LLVM Compiler Infrastructure
#
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
#===------------------------------------------... | apache-2.0 |
piotr1212/carbon | lib/carbon/tests/test_rewrite.py | 14 | 7790 | from mock import Mock, mock_open, patch
from unittest import TestCase
from carbon.pipeline import Processor
from carbon.rewrite import PRE, RewriteProcessor, RewriteRule, RewriteRuleManager
class RewriteProcessorTest(TestCase):
def tearDown(self):
RewriteRuleManager.clear()
def test_registers_plugin(self):
... | apache-2.0 |
WatanabeYasumasa/edx-platform | common/djangoapps/student/tests/test_create_account.py | 33 | 3344 | "Tests for account creation"
import ddt
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.db.transaction import rollback
from django.test import TestCase, TransactionTestCase
from django.test.utils import override_settings
import mock
from user_api.models import User... | agpl-3.0 |
basicthinker/THNVM | src/mem/slicc/ast/FuncCallExprAST.py | 31 | 7898 | # Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
# Copyright (c) 2009 The Hewlett-Packard Development Company
# 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 co... | bsd-3-clause |
ani2404/ee6761cloud | inference.py | 1 | 1332 | # Build the model, restore the variables and run the inference
# Need to use SavedModel builder and loader instead - future work
import sys
sys.path.append('/home/ani2404/Desktop/ee6761cloud/')
import numpy as np
#Need to replace with the actual model
from code_ref.model import Model
class infer(object):
de... | mit |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.