repo_name stringlengths 5 100 | path stringlengths 4 375 | copies stringclasses 991
values | size stringlengths 4 7 | content stringlengths 666 1M | license stringclasses 15
values |
|---|---|---|---|---|---|
pplatek/odoo | addons/account_asset/account_asset_invoice.py | 193 | 3070 | # -*- encoding: 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 G... | agpl-3.0 |
frankyrumple/smc | modules/requests/packages/urllib3/util/url.py | 375 | 5760 | from collections import namedtuple
from ..exceptions import LocationParseError
url_attrs = ['scheme', 'auth', 'host', 'port', 'path', 'query', 'fragment']
class Url(namedtuple('Url', url_attrs)):
"""
Datastructure for representing an HTTP URL. Used as a return value for
:func:`parse_url`.
"""
s... | mit |
Yannig/ansible | lib/ansible/plugins/action/ce_template.py | 65 | 3803 | #
# Copyright 2015 Peter Sprygada <psprygada@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... | gpl-3.0 |
anton-golubkov/Garland | src/gui/image_convert.py | 1 | 3100 | #-------------------------------------------------------------------------------
# Copyright (c) 2011 Anton Golubkov.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the GNU Public License v2.0
# which accompanies this distribution, and is available at
# http:/... | lgpl-2.1 |
michaeljohn32/odoomrp-wip | mrp_product_variants_operations/__openerp__.py | 17 | 1511 | # -*- encoding: utf-8 -*-
##############################################################################
#
# 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... | agpl-3.0 |
tquilian/exelearningTest | twisted/enterprise/sqlreflector.py | 17 | 11849 | # -*- test-case-name: twisted.test.test_reflector -*-
# Copyright (c) 2001-2004 Twisted Matrix Laboratories.
# See LICENSE for details.
from twisted.enterprise import reflector
from twisted.enterprise.util import DBError, getKeyColumn, quote, safe
from twisted.enterprise.util import _TableInfo
from twisted.enterprise... | gpl-2.0 |
wuhengzhi/chromium-crosswalk | tools/grit/grit/node/io_unittest.py | 52 | 6149 | #!/usr/bin/env python
# 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.
'''Unit tests for io.FileNode'''
import os
import sys
if __name__ == '__main__':
sys.path.append(os.path.join(os.path.dirname(__... | bsd-3-clause |
cblecker/test-infra | scenarios/kubernetes_bazel.py | 12 | 10166 | #!/usr/bin/env python
# Copyright 2017 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | apache-2.0 |
sankhesh/VTK | ThirdParty/Twisted/twisted/trial/_dist/managercommands.py | 45 | 1560 | # Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Commands for reporting test success of failure to the manager.
@since: 12.3
"""
from twisted.protocols.amp import Command, String, Boolean, ListOf
class AddSuccess(Command):
"""
Add a success.
"""
arguments = [('testName',... | bsd-3-clause |
singingwolfboy/invoke | invoke/vendor/yaml3/scanner.py | 235 | 51879 |
# Scanner produces tokens of the following types:
# STREAM-START
# STREAM-END
# DIRECTIVE(name, value)
# DOCUMENT-START
# DOCUMENT-END
# BLOCK-SEQUENCE-START
# BLOCK-MAPPING-START
# BLOCK-END
# FLOW-SEQUENCE-START
# FLOW-MAPPING-START
# FLOW-SEQUENCE-END
# FLOW-MAPPING-END
# BLOCK-ENTRY
# FLOW-ENTRY
# KEY
# VALUE
# AL... | bsd-2-clause |
DasIch/django | tests/serializers/test_json.py | 81 | 9163 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import json
import re
from django.core import serializers
from django.core.serializers.base import DeserializationError
from django.core.serializers.json import DjangoJSONEncoder
from django.test import SimpleTestCase, TestCase, TransactionTestCase
from ... | bsd-3-clause |
gam-phon/taiga-back | taiga/base/utils/urls.py | 3 | 1794 | # Copyright (C) 2014-2016 Andrey Antukh <niwi@niwi.nz>
# Copyright (C) 2014-2016 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014-2016 David Barragán <bameda@dbarragan.com>
# Copyright (C) 2014-2016 Alejandro Alonso <alejandro.alonso@kaleidos.net>
# Copyright (C) 2014-2016 Anler Hernández <hello@anler.me>
# This ... | agpl-3.0 |
vmindru/ansible | test/units/modules/network/nxos/test_nxos_pim.py | 44 | 2195 | # (c) 2016 Red Hat Inc.
#
# 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 dis... | gpl-3.0 |
alkyl1978/gnuradio | gr-wxgui/python/wxgui/plotter/channel_plotter.py | 57 | 7757 | #
# Copyright 2008, 2009, 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 ... | gpl-3.0 |
osvalr/odoo | openerp/addons/__init__.py | 378 | 1537 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
# Copyright (C) 2010-2011 OpenERP s.a. (<http://openerp.com>).
#
# This program is free software: you ca... | agpl-3.0 |
strahlc/exaile | xl/migrations/settings/rating.py | 5 | 1797 | # Copyright (C) 2008-2010 Adam Olsen
#
# 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 later version.
#
# This program is distributed in the hope that... | gpl-2.0 |
webgeodatavore/django | django/contrib/gis/gdal/base.py | 654 | 1179 | from ctypes import c_void_p
from django.contrib.gis.gdal.error import GDALException
from django.utils import six
class GDALBase(object):
"""
Base object for GDAL objects that has a pointer access property
that controls access to the underlying C pointer.
"""
# Initially the pointer is NULL.
_... | bsd-3-clause |
bikong2/django | tests/check_framework/test_templates.py | 288 | 1403 | from copy import deepcopy
from django.core.checks.templates import E001
from django.test import SimpleTestCase
from django.test.utils import override_settings
class CheckTemplateSettingsAppDirsTest(SimpleTestCase):
TEMPLATES_APP_DIRS_AND_LOADERS = [
{
'BACKEND': 'django.template.backends.djan... | bsd-3-clause |
shipci/sympy | sympy/external/importtools.py | 85 | 7294 | """Tools to assist importing optional external modules."""
from __future__ import print_function, division
import sys
# Override these in the module to change the default warning behavior.
# For example, you might set both to False before running the tests so that
# warnings are not printed to the console, or set bo... | bsd-3-clause |
lokkju/gr-smartnet | 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 |
jmt4/django-oscar | tests/integration/offer/fixed_price_benefit_tests.py | 53 | 3007 | from decimal import Decimal as D
from django.test import TestCase
import mock
from oscar.apps.offer import models
from oscar.test import factories
from oscar.test.basket import add_product, add_products
class TestAFixedPriceDiscountAppliedWithCountCondition(TestCase):
def setUp(self):
range = models.Ra... | bsd-3-clause |
MwanzanFelipe/rockletonfortune | lib/django/middleware/security.py | 510 | 1753 | import re
from django.conf import settings
from django.http import HttpResponsePermanentRedirect
class SecurityMiddleware(object):
def __init__(self):
self.sts_seconds = settings.SECURE_HSTS_SECONDS
self.sts_include_subdomains = settings.SECURE_HSTS_INCLUDE_SUBDOMAINS
self.content_type_no... | bsd-3-clause |
dhimmel/networkx | examples/basic/properties.py | 44 | 1071 | #!/usr/bin/env python
"""
Compute some network properties for the lollipop graph.
"""
# Copyright (C) 2004 by
# Aric Hagberg <hagberg@lanl.gov>
# Dan Schult <dschult@colgate.edu>
# Pieter Swart <swart@lanl.gov>
# All rights reserved.
# BSD license.
from networkx import *
G = lollipop_graph(4,6)
pa... | bsd-3-clause |
DMLoy/ECommerceBasic | lib/python2.7/site-packages/django/templatetags/i18n.py | 107 | 16719 | from __future__ import unicode_literals
import re
from django.template import (Node, Variable, TemplateSyntaxError,
TokenParser, Library, TOKEN_TEXT, TOKEN_VAR)
from django.template.base import _render_value_in_context
from django.template.defaulttags import token_kwargs
from django.utils import six
from django.ut... | mit |
willhardy/django | django/shortcuts.py | 117 | 5429 | """
This module collects helper functions and classes that "span" multiple levels
of MVC. In other words, these functions/classes introduce controlled coupling
for convenience's sake.
"""
from django.http import (
Http404, HttpResponse, HttpResponsePermanentRedirect, HttpResponseRedirect,
)
from django.template imp... | bsd-3-clause |
hwu25/AppPkg | Applications/Python/Python-2.7.2/Lib/distutils/tests/test_cmd.py | 10 | 4028 | """Tests for distutils.cmd."""
import unittest
import os
from test.test_support import captured_stdout, run_unittest
from distutils.cmd import Command
from distutils.dist import Distribution
from distutils.errors import DistutilsOptionError
from distutils import debug
class MyCmd(Command):
def initiali... | bsd-2-clause |
Venturi/oldcms | env/lib/python2.7/site-packages/pip/req/req_file.py | 239 | 9670 | """
Requirements file parsing
"""
from __future__ import absolute_import
import os
import re
import shlex
import optparse
from pip._vendor.six.moves.urllib import parse as urllib_parse
from pip._vendor.six.moves import filterfalse
import pip
from pip.download import get_file_content
from pip.req.req_install import ... | apache-2.0 |
ebukoz/thrive | erpnext/patches/v8_0/update_production_orders.py | 16 | 1606 | # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
def execute():
# reload schema
for doctype in ("Work Order", "Work Order Item", "Work Order Operation",
"BOM Item", "BOM Explosio... | gpl-3.0 |
tensorflow/tensorflow | tensorflow/python/kernel_tests/conv2d_transpose_test.py | 9 | 12650 | # 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 |
tuomassalo/vr-no-flash | parse-coachmap.py | 1 | 2371 | #!/usr/bin/env python
"""
Read coachmap.swf and export all coaches to dist/coaches/*.{svg,js}.
"""
from swf.movie import SWF
from swf.export import SVGExporter, SingleShapeSVGExporterMixin, FrameSVGExporterMixin, NamesSVGExporterMixin
from swf.tag import TagPlaceObject, TagDefineShape, TagDefineSprite, TagFrameLabel
... | mit |
perezg/infoxchange | BASE/lib/python2.7/site-packages/django/contrib/admin/options.py | 24 | 65679 | import copy
from functools import update_wrapper, partial
import warnings
from django import forms
from django.conf import settings
from django.forms.formsets import all_valid
from django.forms.models import (modelform_factory, modelformset_factory,
inlineformset_factory, BaseInlineFormSet)
from django.contrib.con... | apache-2.0 |
malkavi/Flexget | flexget/tests/test_tmdb.py | 3 | 1857 | import pytest
from flexget.components.tmdb.api_tmdb import TMDBSearchResult
from flexget.manager import Session
@pytest.mark.online
class TestTmdbLookup:
config = """
tasks:
test:
mock:
- {title: '[Group] Taken 720p', imdb_url: 'http://www.imdb.com/title/tt0936501/'}
... | mit |
freelan-developers/chromalog | chromalog/log.py | 1 | 5905 | """
Log-related functions and structures.
"""
from builtins import map
import sys
import logging
from colorama import AnsiToWin32
from functools import partial
from contextlib import contextmanager
from .colorizer import Colorizer
from .mark.objects import Mark
from .stream import stream_has_color_support
class Co... | mit |
jody-frankowski/ansible-modules-core | system/mount.py | 29 | 10793 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2012, Red Hat, inc
# Written by Seth Vidal
# based on the mount modules from salt and puppet
#
# 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 ... | gpl-3.0 |
red-hood/calendarserver | contrib/performance/report_principals.py | 1 | 2743 | ##
# Copyright (c) 2010-2015 Apple 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 applicab... | apache-2.0 |
scottw13/BET-1 | doc/conf.py | 1 | 8589 | # Copyright (C) 2014-2015 The BET Development Team
# -*- coding: utf-8 -*-
#
# BET documentation build configuration file, created by
# sphinx-quickstart on Tue Apr 15 14:33:13 2014.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values a... | gpl-3.0 |
Pencroff/ai-hackathon-2017 | Backend/venv/lib/python3.6/site-packages/requests/packages/urllib3/packages/backports/makefile.py | 339 | 1461 | # -*- coding: utf-8 -*-
"""
backports.makefile
~~~~~~~~~~~~~~~~~~
Backports the Python 3 ``socket.makefile`` method for use with anything that
wants to create a "fake" socket object.
"""
import io
from socket import SocketIO
def backport_makefile(self, mode="r", buffering=None, encoding=None,
... | mit |
batermj/algorithm-challenger | code-analysis/programming_anguage/python/source_codes/Python3.8.0/Python-3.8.0/Lib/lib2to3/fixes/fix_apply.py | 22 | 2430 | # Copyright 2006 Google, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""Fixer for apply().
This converts apply(func, v, k) into (func)(*v, **k)."""
# Local imports
from .. import pytree
from ..pgen2 import token
from .. import fixer_base
from ..fixer_util import Call, Comma, parenthesi... | apache-2.0 |
MatthewShao/mitmproxy | test/mitmproxy/tools/web/test_static_viewer.py | 3 | 2522 | import json
from unittest import mock
from mitmproxy.test import taddons
from mitmproxy.test import tflow
from mitmproxy import flowfilter
from mitmproxy.tools.web.app import flow_to_json
from mitmproxy.tools.web import static_viewer
from mitmproxy.addons import save
def test_save_static(tmpdir):
tmpdir.mkdir(... | mit |
ramsateesh/designate | designate/storage/impl_sqlalchemy/migrate_repo/versions/060_placeholder.py | 140 | 1035 | # Copyright 2015 Hewlett-Packard Development Company, L.P.
#
# Author: Kiall Mac Innes <kiall@hp.com>
#
# 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/L... | apache-2.0 |
OmnInfinity/volatility | volatility/plugins/malware/cmdhistory.py | 50 | 34078 | # Volatility
# Copyright (C) 2007-2013 Volatility Foundation
#
# Authors:
# Michael Hale Ligh <michael.ligh@mnin.org>
#
# Contributors/References:
# Richard Stevens and Eoghan Casey
# Extracting Windows Cmd Line Details from Physical Memory.
# http://ww.dfrws.org/2010/proceedings/stevens.pdf
#
# This file is part... | gpl-2.0 |
superdesk/superdesk-content-api | content_api/packages/service.py | 1 | 2020 | # -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
import loggi... | agpl-3.0 |
PiRSquared17/damnvid | dModules.py | 12 | 5307 | # -*- coding: utf-8 -*-
from dCore import *
from dLog import *
from dTubes import *
import time
import tarfile
import shutil
class DamnVideoModule:
def __init__(self, uri):
self.name = 'generic'
self.uri = uri
self.link = None
self.id = None
self.valid = None
self.title = None
self.ticket = None
self.t... | gpl-3.0 |
schleichdi2/OPENNFR-6.1-CORE | bitbake/lib/toaster/tests/browser/test_new_project_page.py | 4 | 4101 | #! /usr/bin/env python
# ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
#
# BitBake Toaster Implementation
#
# Copyright (C) 2013-2016 Intel Corporation
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License... | gpl-2.0 |
opavader/ansible | lib/ansible/plugins/lookup/ini.py | 82 | 3304 | # (c) 2015, Yannig Perre <yannig.perre(at)gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any late... | gpl-3.0 |
musicpax/funcy | tests/test_debug.py | 2 | 3333 | import re
import time
from funcy.debug import *
from funcy.flow import silent
def test_tap():
assert capture(tap, 42) == '42\n'
assert capture(tap, 42, label='Life and ...') == 'Life and ...: 42\n'
def test_log_calls():
log = []
@log_calls(log.append)
def f(x, y):
return x + y
f(1... | bsd-3-clause |
hobbe/notifry-o | appengine/web/browser.py | 103 | 7679 | """Browser to test web applications.
(from web.py)
"""
from utils import re_compile
from net import htmlunquote
import httplib, urllib, urllib2
import copy
from StringIO import StringIO
DEBUG = False
__all__ = [
"BrowserError",
"Browser", "AppBrowser",
"AppHandler"
]
class BrowserError(Exception):
p... | apache-2.0 |
HuaweiSwitch/ansible | lib/ansible/modules/network/cloudengine/ce_vxlan_vap.py | 47 | 34406 | #!/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 |
endlessm/chromium-browser | third_party/catapult/tracing/tracing/value/diagnostics/diagnostic.py | 4 | 3699 | # Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import uuid
try:
from py_utils import slots_metaclass
SlotsMetaclass = slots_metaclass.SlotsMetaclass # pylint: disable=invalid-name
except ImportError:... | bsd-3-clause |
greggyNapalm/lunaport_client | setup.py | 1 | 1258 | import os
import re
from setuptools import setup, find_packages
base_path = os.path.dirname(__file__)
# Get the version (borrowed from SQLAlchemy)
fp = open(os.path.join(base_path, 'lunaport_client', '__init__.py'))
VERSION = re.compile(r".*__version__ = '(.*?)'",
re.S).match(fp.read()).group(1)
... | apache-2.0 |
cryptobanana/ansible | lib/ansible/modules/network/cnos/cnos_template.py | 35 | 7351 | #!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
#
# Copyright (C) 2017 Lenovo, Inc.
#
# 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 Licens... | gpl-3.0 |
louietsai/python-for-android | python3-alpha/extra_modules/atom/mock_http_core.py | 46 | 11993 | #!/usr/bin/env python
#
# Copyright (C) 2009 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 ... | apache-2.0 |
rotofly/odoo | openerp/workflow/workitem.py | 294 | 14389 |
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2014 OpenERP S.A. (<http://openerp.com).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General P... | agpl-3.0 |
ademmers/ansible | test/lib/ansible_test/_internal/thread.py | 68 | 1866 | """Python threading tools."""
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import threading
import sys
try:
# noinspection PyPep8Naming
import Queue as queue
except ImportError:
# noinspection PyUnresolvedReferences
import queue # pylint: disable=locally-dis... | gpl-3.0 |
balp/googletest | scripts/gen_gtest_pred_impl.py | 2538 | 21986 | #!/usr/bin/env python
#
# Copyright 2006, 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... | bsd-3-clause |
geraldinepascal/FROGS | tools/demultiplex/demultiplex.py | 1 | 19651 | #!/usr/bin/env python3
#
# Copyright (C) 2018 INRA
#
# 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... | gpl-3.0 |
lolhi/at1-S0834211 | tools/perf/scripts/python/netdev-times.py | 11271 | 15048 | # Display a process of packets and processed time.
# It helps us to investigate networking or network device.
#
# options
# tx: show only tx chart
# rx: show only rx chart
# dev=: show only thing related to specified device
# debug: work with debug mode. It shows buffer status.
import os
import sys
sys.path.append(os... | gpl-2.0 |
cosmoharrigan/pylearn2 | pylearn2/models/dbm/ising.py | 32 | 54938 | """
Implementation of a densely connected Ising model in the
pylearn2.models.dbm framework
Notes
-----
If :math:`h` can be -1 or 1, and
.. math::
p(h) = \exp(T\dot z \dot h),
then the expected value of :math:`h` is given by
.. math::
\\tanh(T \dot z),
and the probability that :math:`h` is 1 is given by
... | bsd-3-clause |
landscapeio/astroid | __pkginfo__.py | 2 | 1746 | # copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of astroid.
#
# astroid 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
#... | gpl-2.0 |
MingwangLin/automatic-colorization-of-sketch | util/helper.py | 1 | 9155 | import cv2
import time
import string
import random
from scipy import ndimage
import numpy as np
from datetime import datetime
def get_normal_map(img):
img = img.astype(np.float)
img = img / 255.0
img = - img + 1
img[img < 0] = 0
img[img > 1] = 1
return img
def get_gray_map(img):
gray = c... | apache-2.0 |
plq/spyne | examples/validation.py | 2 | 2587 | #!/usr/bin/env python
# encoding: utf8
#
# Copyright © Burak Arslan <burak at arskom dot com dot tr>,
# Arskom Ltd. http://www.arskom.com.tr
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are ... | lgpl-2.1 |
cgundogan/RIOT | tests/gnrc_ipv6_ext_frag/tests-as-root/01-run.py | 7 | 15314 | #!/usr/bin/env python3
# Copyright (C) 2019 Freie Universität Berlin
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
import re
import os
import pexpect
import socket
import sys
import subprocess
i... | lgpl-2.1 |
chunywang/crosswalk-test-suite | tools/lint/sourcefile.py | 12 | 9976 | import os
import urlparse
from fnmatch import fnmatch
try:
from xml.etree import cElementTree as ElementTree
except ImportError:
from xml.etree import ElementTree
import html5lib
import vcs
from item import Stub, ManualTest, WebdriverSpecTest, RefTest, TestharnessTest
from utils import rel_path_to_url, Contex... | bsd-3-clause |
noelbk/neutron-juniper | neutron/tests/unit/nec/test_portbindings.py | 9 | 15003 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 NEC Corporation
# 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... | apache-2.0 |
40223211/2015cd_midterm- | wsgi.py | 1 | 27730 | #@+leo-ver=5-thin
#@+node:2014fall.20141212095015.1775: * @file wsgi.py
# coding=utf-8
# 上面的程式內容編碼必須在程式的第一或者第二行才會有作用
################# (1) 模組導入區
# 導入 cherrypy 模組, 為了在 OpenShift 平台上使用 cherrypy 模組, 必須透過 setup.py 安裝
#@@language python
#@@tabwidth -4
#@+<<declarations>>
#@+node:2014fall.20141212095015.1776: ** <<declar... | gpl-3.0 |
thaim/ansible | lib/ansible/module_utils/facts/network/base.py | 88 | 2400 | # This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that ... | mit |
ourbest/sns_app | backend/dates.py | 1 | 1240 | from datetime import datetime, timedelta
from dj import times
def get_date(date=None):
if date and isinstance(date, str):
return times.localtime(datetime.strptime(date[0:10], '%Y-%m-%d'))
if not date:
return times.localtime(datetime.now()).replace(hour=0, second=0, minute=0, microsecond=0)
... | lgpl-3.0 |
julianwang/cinder | cinder/api/views/backups.py | 8 | 3833 | # Copyright (C) 2012 Hewlett-Packard Development Company, L.P.
# 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/LICEN... | apache-2.0 |
rofehr/enigma2 | lib/python/Components/Timeshift.py | 1 | 69940 | # -*- coding: utf-8 -*-
# InfoBarTimeshift requires InfoBarSeek, instantiated BEFORE!
# Hrmf.
#
# Timeshift works the following way:
# demux0 demux1 "TimeshiftActions" "TimeshiftActivateActions" "SeekActions"
# - normal playback TUNER ... | gpl-2.0 |
mhei/openwrt | scripts/json_overview_image_info.py | 4 | 1044 | #!/usr/bin/env python3
import json
from pathlib import Path
from os import getenv
from sys import argv
if len(argv) != 2:
print("JSON info files script requires ouput file as argument")
exit(1)
output_path = Path(argv[1])
assert getenv("WORK_DIR"), "$WORK_DIR required"
work_dir = Path(getenv("WORK_DIR"))
... | gpl-2.0 |
proxysh/Safejumper-for-Mac | buildlinux/env32/lib/python2.7/site-packages/pip/_vendor/requests/packages/chardet/langthaimodel.py | 2930 | 11275 | ######################## 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... | gpl-2.0 |
andymckay/django | django/contrib/gis/tests/geoapp/tests.py | 91 | 35402 | from __future__ import absolute_import
import re
from django.db import connection
from django.db.utils import DatabaseError
from django.contrib.gis import gdal
from django.contrib.gis.geos import (fromstr, GEOSGeometry,
Point, LineString, LinearRing, Polygon, GeometryCollection)
from django.contrib.gis.tests.util... | bsd-3-clause |
brandonium21/snowflake | snowflakeEnv/lib/python2.7/site-packages/Crypto/SelfTest/Cipher/test_pkcs1_oaep.py | 113 | 17292 | # -*- coding: utf-8 -*-
#
# SelfTest/Cipher/test_pkcs1_oaep.py: Self-test for PKCS#1 OAEP encryption
#
# ===================================================================
# The contents of this file are dedicated to the public domain. To
# the extent that dedication to the public domain is not available,
# everyone... | bsd-2-clause |
ftl-toolbox/lib_openshift | lib_openshift/models/v1_template.py | 2 | 8698 | # coding: utf-8
"""
OpenAPI spec version:
Generated by: https://github.com/swagger-api/swagger-codegen.git
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
... | apache-2.0 |
beswarm/django-allauth | allauth/socialaccount/providers/xing/views.py | 65 | 1258 | import json
from allauth.socialaccount.providers.oauth.client import OAuth
from allauth.socialaccount.providers.oauth.views import (OAuthAdapter,
OAuthLoginView,
OAuthCallbackView)
from .provider import X... | mit |
caisq/tensorflow | tensorflow/contrib/kafka/python/ops/kafka_dataset_ops.py | 19 | 2777 | # 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 |
eramirem/astroML | book_figures/chapter7/fig_spec_reconstruction.py | 3 | 3410 | """
PCA Reconstruction of a spectrum
--------------------------------
Figure 7.6
The reconstruction of a particular spectrum from its eigenvectors. The input
spectrum is shown in gray, and the partial reconstruction for progressively
more terms is shown in black. The top panel shows only the mean of the set of
spectra... | bsd-2-clause |
mikemccann/stoqs | utils/utils.py | 4 | 13897 | # A collection of various utility functions
import logging
from datetime import datetime
logger = logging.getLogger(__name__)
# An epoch good for time axis labels - OceanSITES uses 1 Jan 1950
EPOCH_STRING = '1950-01-01'
EPOCH_DATETIME = datetime(1950, 1, 1)
def round_to_n(x, n):
'''
Round to n significant di... | gpl-3.0 |
rbtcollins/pip | tests/unit/test_options.py | 22 | 9922 | import os
import pytest
import pip.baseparser
from pip import main
from pip import cmdoptions
from pip.basecommand import Command
from pip.commands import commands_dict as commands
class FakeCommand(Command):
name = 'fake'
summary = name
def main(self, args):
index_opts = cmdoptions.make_option_g... | mit |
kxliugang/edx-platform | openedx/core/djangoapps/credit/migrations/0005_auto__add_field_creditprovider_provider_url__add_field_creditprovider_.py | 84 | 5535 | # -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'CreditProvider.provider_url'
db.add_column('credit_credit... | agpl-3.0 |
beck/django | tests/datetimes/tests.py | 345 | 5922 | from __future__ import unicode_literals
import datetime
from unittest import skipIf
from django.test import TestCase, override_settings
from django.utils import timezone
from .models import Article, Category, Comment
try:
import pytz
except ImportError:
pytz = None
class DateTimesTests(TestCase):
def ... | bsd-3-clause |
svanschalkwyk/datafari | windows/python/Lib/difflib.py | 42 | 82320 | """
Module difflib -- helpers for computing deltas between objects.
Function get_close_matches(word, possibilities, n=3, cutoff=0.6):
Use SequenceMatcher to return list of the best "good enough" matches.
Function context_diff(a, b):
For two lists of strings, return a delta in context diff format.
Function nd... | apache-2.0 |
dawehner/root | tutorials/pyroot/first.py | 28 | 1524 | from ROOT import TCanvas, TF1, TPaveLabel, TPad, TText
from ROOT import gROOT
nut = TCanvas( 'nut', 'FirstSession', 100, 10, 700, 900 )
nut.Range( 0, 0, 20, 24 )
nut.SetFillColor( 10 )
nut.SetBorderSize( 2 )
pl = TPaveLabel( 3, 22, 17, 23.7, 'My first PyROOT interactive session', 'br' )
pl.SetFillColor( 18 )
pl.Draw... | lgpl-2.1 |
sorenk/ansible | test/units/plugins/connection/test_ssh.py | 21 | 29848 | # -*- coding: utf-8 -*-
# (c) 2015, Toshio Kuratomi <tkuratomi@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
# (a... | gpl-3.0 |
dchilds7/Deysha-Star-Formation | vispy/util/config.py | 21 | 14665 | # -*- coding: utf-8 -*-
# Copyright (c) 2015, Vispy Development Team.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
"""Vispy configuration functions
"""
import os
from os import path as op
import json
import sys
import platform
import getopt
import traceback
import tempfile
import atexit
f... | bsd-3-clause |
CCI-MOC/nova | nova/api/openstack/compute/fping.py | 32 | 4924 | # Copyright 2011 Grid Dynamics
# Copyright 2011 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses... | apache-2.0 |
nonemaw/pynet | learnpy_ecourse/class10/uptime.py | 4 | 2224 | import re
def find_uptime_field(a_pattern, uptime_str):
'''
If there is a match return the match group(1)
Else return 0
'''
a_check = re.search(a_pattern, uptime_str)
if a_check:
return int(a_check.group(1))
else:
return 0
class Uptime(object):
'''
Create an Upti... | gpl-2.0 |
wimnat/ansible-modules-extras | packaging/os/layman.py | 45 | 7881 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2014, Jakub Jirutka <jakub@jirutka.cz>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the Lice... | gpl-3.0 |
tcwicklund/django | django/contrib/sessions/backends/signed_cookies.py | 383 | 2895 | from django.conf import settings
from django.contrib.sessions.backends.base import SessionBase
from django.core import signing
class SessionStore(SessionBase):
def load(self):
"""
We load the data from the key itself instead of fetching from
some external data store. Opposite of _get_sess... | bsd-3-clause |
sholsapp/cryptography | tests/hazmat/primitives/fixtures_dsa.py | 10 | 7822 | # This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function
from cryptography.hazmat.primitives.asymmetric.dsa import (
DSAParame... | bsd-3-clause |
klusark/android_external_chromium_org | tools/deep_memory_profiler/subcommands/stacktrace.py | 59 | 1156 | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import sys
from lib.bucket import BUCKET_ID
from lib.subcommand import SubCommand
class StacktraceCommand(SubCommand):
def __init__(self):
super(Sta... | bsd-3-clause |
hgrif/incubator-airflow | tests/contrib/operators/test_mlengine_operator_utils.py | 11 | 7521 | # 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 |
patsissons/Flexget | flexget/plugins/urlrewrite_deadfrog.py | 24 | 1630 | from __future__ import unicode_literals, division, absolute_import
import logging
import re
import urllib2
from flexget import plugin
from flexget.event import event
from flexget.plugins.plugin_urlrewriting import UrlRewritingError
from flexget.utils.tools import urlopener
from flexget.utils.soup import get_soup
log ... | mit |
AlexHill/django | django/contrib/gis/tests/layermap/models.py | 5 | 2279 | from django.contrib.gis.db import models
class State(models.Model):
name = models.CharField(max_length=20)
objects = models.GeoManager()
class County(models.Model):
name = models.CharField(max_length=25)
state = models.ForeignKey(State)
mpoly = models.MultiPolygonField(srid=4269) # Multipolygon... | bsd-3-clause |
NielsZeilemaker/incubator-airflow | airflow/hooks/samba_hook.py | 61 | 1562 | # -*- coding: utf-8 -*-
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
... | apache-2.0 |
jbedorf/tensorflow | tensorflow/python/keras/utils/data_utils_test.py | 15 | 10290 | # 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... | apache-2.0 |
n3wb13/OpenNfrGui-5.0-1 | lib/python/Screens/OScamInfo.py | 1 | 41624 | from Screens.Screen import Screen
from Screens.MessageBox import MessageBox
from Screens.ChoiceBox import ChoiceBox
from Components.ActionMap import ActionMap, NumberActionMap
from Components.Sources.List import List
from Components.Sources.StaticText import StaticText
from Components.config import config, configfile,... | gpl-2.0 |
XXMrHyde/android_external_chromium_org | tools/perf/page_sets/PRESUBMIT.py | 23 | 2163 | # Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import re
import sys
def _SyncFilesToCloud(input_api, output_api):
"""Searches for .sha1 files and uploads them to Cloud Storage.
It vali... | bsd-3-clause |
trabacus-softapps/openerp-8.0-cc | openerp/addons/marketing_campaign_crm_demo/__openerp__.py | 119 | 1675 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | agpl-3.0 |
anandbhoraskar/Diamond | src/collectors/bind/test/testbind.py | 31 | 7690 | #!/usr/bin/python
# coding=utf-8
##########################################################################
from test import CollectorTestCase
from test import get_collector_config
from test import unittest
from mock import Mock
from mock import patch
from diamond.collector import Collector
from bind import BindColle... | mit |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.