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 |
|---|---|---|---|---|---|
tutengfei/w3af-api-client-py3 | w3af_api_client/connection.py | 1 | 6007 | import requests
from urllib import parse
import logging
import json
# These two lines enable debugging at httplib level
# (requests->urllib3->http.client) You will see the REQUEST, including HEADERS
# and DATA, and RESPONSE with HEADERS but without DATA.
# The only thing missing will be the response.body which is not ... | gpl-2.0 |
Xiaofei-Zhang/NAMD_Docking_pipeline | post_DOCKING/get_enrichment.py | 1 | 3249 | # get_enrichment.py
# Creates the text file for the enrichment plot
#
# Usage:
# python get_enrichment.py $INPUT $RECEPTOR $ACTIVE $DECOY
#
# $INPUT=the sorted_results file of docking results
# $RECEPTOR=the name of receptor
# $ACTIVE=the label string of the active ligands
# $DECOY=the label string of the decoy ligand... | mit |
calcutec/flask-burtonblog | db_repository/versions/015_migration.py | 1 | 1109 | from sqlalchemy import *
from migrate import *
from migrate.changeset import schema
pre_meta = MetaData()
post_meta = MetaData()
post = Table('post', post_meta,
Column('id', Integer, primary_key=True, nullable=False),
Column('header', String(length=140)),
Column('body', Text),
Column('timestamp', Date... | bsd-3-clause |
inirudebwoy/AutobahnPython | autobahn/wamp/test/test_websocket.py | 11 | 1766 | ###############################################################################
#
# The MIT License (MIT)
#
# Copyright (c) Tavendo GmbH
#
# 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 with... | mit |
deepakselvaraj/federated-horizon | horizon/management/commands/startdash.py | 1 | 2482 | import glob
from optparse import make_option # noqa
import os
from django.core.management.base import CommandError # noqa
from django.core.management.templates import TemplateCommand # noqa
from django.utils.importlib import import_module # noqa
import horizon
class Command(TemplateCommand):
template = os.p... | apache-2.0 |
flh/odoo | addons/project/__openerp__.py | 62 | 2843 | # -*- 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 |
sserrot/champion_relationships | venv/Lib/site-packages/prompt_toolkit/eventloop/dummy_contextvars.py | 1 | 1117 | """
Dummy contextvars implementation, to make prompt_toolkit work on Python 3.6.
As long as there is only one application running at a time, we don't need the
real contextvars. So, stuff like the telnet-server and so on requires 3.7.
"""
from typing import Any, Callable, Generic, Optional, TypeVar
def copy_context()... | mit |
zsulocal/pycoin | tests/msg_signing_test.py | 1 | 6057 | import unittest
from pycoin.contrib.msg_signing import parse_signed_message, verify_message
from pycoin.key import Key
def test_against_myself():
"""
Test code that verifies against ourselves only. Useful but not so great.
"""
from pycoin.contrib.msg_signing import (
parse_signed_message,... | mit |
youdonghai/intellij-community | python/helpers/python-skeletons/math.py | 62 | 6499 | """Skeleton for 'math' stdlib module."""
import sys
import math
def ceil(x):
"""Return the ceiling of x as a float, the smallest integer value greater
than or equal to x.
:type x: numbers.Real
:rtype: float
"""
return 0.0
if sys.version_info >= (2, 6):
def copysign(x, y):
"""R... | apache-2.0 |
abhishek-ch/hue | desktop/core/ext-py/Django-1.6.10/tests/m2o_recursive/tests.py | 150 | 1722 | from __future__ import absolute_import
from django.test import TestCase
from .models import Category, Person
class ManyToOneRecursiveTests(TestCase):
def setUp(self):
self.r = Category(id=None, name='Root category', parent=None)
self.r.save()
self.c = Category(id=None, name='Child categ... | apache-2.0 |
goulu/Goulib | tests/test_Goulib_notebook.py | 1 | 2033 | #!/usr/bin/env python
# coding: utf8
from nose.tools import assert_equal
from nose import SkipTest
# lines above are inserted automatically by pythoscope. Line below overrides them
from Goulib.tests import *
from Goulib.notebook import *
from IPython.core.interactiveshell import InteractiveShell
class ... | lgpl-3.0 |
CroissanceCommune/autonomie | autonomie/tests/conftest.py | 1 | 21919 | # -*- coding: utf-8 -*-
# * Copyright (C) 2012-2014 Croissance Commune
# * Authors:
# * Arezki Feth <f.a@majerti.fr>;
# * Miotte Julien <j.m@majerti.fr>;
# * TJEBBES Gaston <g.t@majerti.fr>
#
# This file is part of Autonomie : Progiciel de gestion de CAE.
#
# Autonomie is free software: you can red... | gpl-3.0 |
BaconPancakes/valor | lib/youtube_dl/extractor/chilloutzone.py | 169 | 3600 | from __future__ import unicode_literals
import re
import base64
import json
from .common import InfoExtractor
from ..utils import (
clean_html,
ExtractorError
)
class ChilloutzoneIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?chilloutzone\.net/video/(?P<id>[\w|-]+)\.html'
_TESTS = [{
'... | gpl-3.0 |
vulcansteel/autorest | AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/operations/array.py | 1 | 7992 | # 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 ... | mit |
AlwinEsch/kodi-agile | addons/service.xbmc.versioncheck/service.py | 25 | 3958 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2013 Team-XBMC
#
# 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... | gpl-2.0 |
pedrolegold/uforge-cli | test/integration/test.py | 1 | 41187 | # Didn't find a way to run all the testSuite at once in the main.
# So to run a test enter command : python -m unittest test.<NAME OF THE TEST SUITE>.
import httplib2
import base64
import unittest
import sys
import os
from uforgecli.commands.user.user import User_Cmd
from uforgecli.commands.user.user_format import Us... | apache-2.0 |
marmyshev/item_title | openlp/plugins/songs/forms/topicsform.py | 2 | 3520 | # -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# ------------------------------------------------------... | gpl-2.0 |
csrocha/OpenUpgrade | addons/l10n_uk/__openerp__.py | 260 | 1999 | # -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2011 Smartmode LTD (<http://www.smartmode.co.uk>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as... | agpl-3.0 |
knowsis/django | django/contrib/sites/management.py | 232 | 1587 | """
Creates the default Site object.
"""
from django.db.models import signals
from django.db import connections
from django.db import router
from django.contrib.sites.models import Site
from django.contrib.sites import models as site_app
from django.core.management.color import no_style
def create_default_site(app, c... | bsd-3-clause |
lmallin/coverage_test | python_venv/lib/python2.7/site-packages/pandas/tests/dtypes/test_dtypes.py | 10 | 18488 | # -*- coding: utf-8 -*-
import pytest
from itertools import product
import numpy as np
import pandas as pd
from pandas import Series, Categorical, IntervalIndex, date_range
from pandas.core.dtypes.dtypes import (
DatetimeTZDtype, PeriodDtype,
IntervalDtype, CategoricalDtype)
from pandas.core.dtypes.common im... | mit |
GuillaumeHolley/DARRC | external/zstd/tests/test-zstd-versions.py | 7 | 10661 | #!/usr/bin/env python3
"""Test zstd interoperability between versions"""
#
# Copyright (c) 2016-present, Yann Collet, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent... | mit |
tfroehlich82/erpnext | erpnext/stock/report/batch_wise_balance_history/batch_wise_balance_history.py | 32 | 3377 | # 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 import _
from frappe.utils import flt, cint, getdate
def execute(filters=None):
if not filters: filters = {}
float_precisi... | gpl-3.0 |
ThomasZh/legend-club-wxpub | foo/dao/cret_template_dao.py | 1 | 1900 | #!/usr/bin/env python
# _*_ coding: utf-8_*_
#
# Copyright 2016 planc2c.com
# thomas@time2box.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/LICENS... | apache-2.0 |
Antelox/mhn | server/mhn/common/ruleutils.py | 11 | 2974 | import re
def _parse_plain(r):
"""
Takes in a plain text rule and returns a dictionary
object containing the parsed information.
Adapted from: jasonish/idstools.py at GitHub.
"""
option_patterns = (
re.compile("(msg)\s*:\s*\"(.*?)\";"),
re.compile("(sid)\s*:\s*(\d+);"),
... | lgpl-2.1 |
llazzaro/virtual_decoys | setup.py | 1 | 1606 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
with open('README.rst') as readme_file:
readme = readme_file.read()
with open('HISTORY.rst') as history_file:
history = history_file.read()
requirements = [
# TO... | isc |
Kromey/antlife | lib/gtest-1.7.0/scripts/pump.py | 2471 | 23673 | #!/usr/bin/env python
#
# Copyright 2008, 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... | mit |
Krossom/python-for-android | python3-alpha/python3-src/Lib/test/lock_tests.py | 46 | 25219 | """
Various tests for synchronization primitives.
"""
import sys
import time
from _thread import start_new_thread, get_ident, TIMEOUT_MAX
import threading
import unittest
from test import support
def _wait():
# A crude wait/yield function not relying on synchronization primitives.
time.sleep(0.01)
class Bu... | apache-2.0 |
Vaidyanath/tempest | tempest/api/compute/servers/test_server_addresses_negative.py | 1 | 2007 | # Copyright 2012 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 requ... | apache-2.0 |
lzh9102/cherrymusic | cherrymusicserver/pathprovider.py | 4 | 6692 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# CherryMusic - a standalone music server
# Copyright (c) 2012 - 2014 Tom Wallroth & Tilman Boerner
#
# Project page:
# http://fomori.org/cherrymusic/
# Sources on github:
# http://github.com/devsnd/cherrymusic/
#
# CherryMusic is based on
# jPlayer (GPL/MIT licens... | gpl-3.0 |
silenceli/nova | nova/cells/driver.py | 126 | 1393 | # Copyright (c) 2012 Rackspace Hosting
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless req... | apache-2.0 |
DarwinAwardWinner/melpa | docker/logprocessor/process_log.py | 21 | 3403 | #!/usr/bin/env python
import argparse
from datetime import datetime
import gzip
import json
import os
import re
import sys
import time
import tempfile
import sqlite3
from operator import or_
STABLE = os.getenv("STABLE")
LOGFILE = "/mnt/store/log/melpa.access.log"
if STABLE:
LOGFILE = "/mnt/store/log-stable/melpa... | gpl-3.0 |
mgit-at/ansible | test/units/modules/network/f5/test_bigip_gtm_topology_record.py | 21 | 3613 | # -*- coding: utf-8 -*-
#
# Copyright: (c) 2018, 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 |
40223150/2015cd_midterm | static/Brython3.1.1-20150328-091302/Lib/_socket.py | 742 | 6431 | """Implementation module for socket operations.
See the socket module for documentation."""
AF_APPLETALK = 16
AF_DECnet = 12
AF_INET = 2
AF_INET6 = 23
AF_IPX = 6
AF_IRDA = 26
AF_SNA = 11
AF_UNSPEC = 0
AI_ADDRCONFIG = 1024
AI_ALL = 256
AI_CANONNAME = 2
AI_NUMERICHOST = 4
AI_NUMERICSERV = 8
AI_PASSIVE = 1... | gpl-3.0 |
imsparsh/python-social-auth | social/backends/thisismyjam.py | 3 | 1108 | """
ThisIsMyJam OAuth1 backend, docs at:
http://psa.matiasaguirre.net/docs/backends/thisismyjam.html
"""
from social.backends.oauth import BaseOAuth1
class ThisIsMyJamOAuth1(BaseOAuth1):
"""ThisIsMyJam OAuth1 authentication backend"""
name = 'thisismyjam'
REQUEST_TOKEN_URL = 'http://www.thisismyjam.co... | bsd-3-clause |
enkafan/shouldly | docs/conf.py | 5 | 9808 | # -*- coding: utf-8 -*-
#
# Shouldly documentation build configuration file, created by
# sphinx-quickstart on Thu Oct 01 06:42:41 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# ... | bsd-3-clause |
pythononwheels/diary | controllers/diary_handler.py | 1 | 1061 | from controllers.base_handler import BaseHandler
class DiaryHandler(BaseHandler):
"""
general RequestHandler docu see : http://tornado.readthedocs.org/en/latest/web.html
"""
def initialize(self):
"""
A dictionary passed as the third argument of a url spec will
... | mit |
talbrecht/pism_pik06 | test/vfnow.py | 1 | 13509 | #!/usr/bin/env python
## @package vfnow
## \author Ed Bueler and Constantine Khroulev, University of Alaska Fairbanks, USA
## \brief A script for verification of numerical schemes in PISM.
## \details It specifies a refinement path for each of Tests ABCDEFGIJKL and runs
## pismv accordingly.
## Copyright (C) 2007--201... | gpl-3.0 |
lkwjohn/personaldirection | googlemaps/timezone.py | 2 | 1796 | #
# Copyright 2014 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 applicable law ... | apache-2.0 |
delhivery/django | tests/utils_tests/test_termcolors.py | 337 | 6461 | import unittest
from django.utils.termcolors import (
DARK_PALETTE, DEFAULT_PALETTE, LIGHT_PALETTE, NOCOLOR_PALETTE, PALETTES,
colorize, parse_color_setting,
)
class TermColorTests(unittest.TestCase):
def test_empty_string(self):
self.assertEqual(parse_color_setting(''), PALETTES[DEFAULT_PALETTE... | bsd-3-clause |
hazelcast/hazelcast-python-client | tests/unit/discovery/address_provider_test.py | 1 | 1080 | from unittest import TestCase
from hazelcast.connection import DefaultAddressProvider
from hazelcast.discovery import HazelcastCloudAddressProvider
from hazelcast import HazelcastClient
from hazelcast.errors import IllegalStateError
class _TestClient(HazelcastClient):
def _start(self):
pass
class Addres... | apache-2.0 |
sumanthha/fundafriend | django/contrib/formtools/tests/forms.py | 99 | 1164 | from django import forms
from django.contrib.formtools.wizard import FormWizard
from django.http import HttpResponse
class Page1(forms.Form):
name = forms.CharField(max_length=100)
thirsty = forms.NullBooleanField()
class Page2(forms.Form):
address1 = forms.CharField(max_length=100)
address2 = forms.C... | bsd-3-clause |
aaxelb/osf.io | website/conferences/views.py | 1 | 9119 | # -*- coding: utf-8 -*-
import httplib
import logging
from django.db import transaction
from bulk_update.helper import bulk_update
from addons.osfstorage.models import OsfStorageFile
from framework.auth import get_or_create_user
from framework.exceptions import HTTPError
from framework.flask import redirect
from fra... | apache-2.0 |
candlepin/subscription-manager | src/subscription_manager/gui/autobind.py | 2 | 3037 | from __future__ import print_function, division, absolute_import
#
# GUI Module for the Autobind Wizard
#
# Copyright (c) 2012 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 implie... | gpl-2.0 |
simone-campagna/rubik | testing/rubik_testing/rubik_test_program.py | 1 | 6345 | #!/usr/bin/env python3
#
# Copyright 2014 Simone Campagna
#
# 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 |
vipmike007/tp-qemu | qemu/tests/valgrind_memalign.py | 9 | 1873 | import logging
import time
from autotest.client.shared import error
from autotest.client.shared import utils
from virttest import env_process
@error.context_aware
def run(test, params, env):
"""
This case is from [general operation] Work around valgrind choking on our
use of memalign():
1.download v... | gpl-2.0 |
RomainBrault/scikit-learn | sklearn/utils/tests/test_linear_assignment.py | 421 | 1349 | # Author: Brian M. Clapper, G Varoquaux
# License: BSD
import numpy as np
# XXX we should be testing the public API here
from sklearn.utils.linear_assignment_ import _hungarian
def test_hungarian():
matrices = [
# Square
([[400, 150, 400],
[400, 450, 600],
[300, 225, 300]],
... | bsd-3-clause |
blademainer/intellij-community | python/lib/Lib/site-packages/django/test/utils.py | 185 | 3644 | import sys
import time
import os
import warnings
from django.conf import settings
from django.core import mail
from django.core.mail.backends import locmem
from django.test import signals
from django.template import Template
from django.utils.translation import deactivate
__all__ = ('Approximate', 'ContextList', 'setu... | apache-2.0 |
hackerkid/zulip | zerver/views/message_flags.py | 1 | 3194 | from typing import List, Optional
from django.http import HttpRequest, HttpResponse
from django.utils.translation import ugettext as _
from zerver.decorator import REQ, has_request_variables
from zerver.lib.actions import (
do_mark_all_as_read,
do_mark_stream_messages_as_read,
do_update_message_flags,
)
f... | apache-2.0 |
minggo/electron | tools/mac/copy-locales.py | 46 | 1534 | #!/usr/bin/env python
# Copyright (c) 2013 GitHub, Inc.
# Use of this source code is governed by the MIT license that can be
# found in the LICENSE file.
import errno
import optparse
import os
import shutil
import sys
def main(argv):
parser = optparse.OptionParser()
usage = 'usage: %s [options ...] src dest local... | mit |
dcroc16/skunk_works | google_appengine/lib/django-1.4/tests/modeltests/custom_columns/models.py | 34 | 1244 | """
17. Custom column/table names
If your database column name is different than your model attribute, use the
``db_column`` parameter. Note that you'll use the field's name, not its column
name, in API usage.
If your database table name is different than your model name, use the
``db_table`` Meta attribute. This has... | mit |
Mitchkoens/sympy | sympy/physics/quantum/tests/test_cg.py | 35 | 8514 | from __future__ import division
from sympy import S, sqrt, Sum, symbols
from sympy.physics.quantum.cg import Wigner3j, Wigner6j, Wigner9j, CG, cg_simp
from sympy.functions.special.tensor_functions import KroneckerDelta
def test_cg_simp_add():
j, m1, m1p, m2, m2p = symbols('j m1 m1p m2 m2p')
# Test Varshalovic... | bsd-3-clause |
nidhididi/CloudBot | plugins/fishbans.py | 3 | 2705 | from urllib.parse import quote_plus
import asyncio
import requests
import requests.exceptions
import functools
from cloudbot import hook
from cloudbot.util import formatting
api_url = "http://api.fishbans.com/stats/{}/"
@asyncio.coroutine
@hook.command("bans", "fishbans")
def fishbans(text, bot, loop):
"""<use... | gpl-3.0 |
qmarlats/pyquizz | env/lib/python3.5/site-packages/pip/commands/hash.py | 514 | 1597 | from __future__ import absolute_import
import hashlib
import logging
import sys
from pip.basecommand import Command
from pip.status_codes import ERROR
from pip.utils import read_chunks
from pip.utils.hashes import FAVORITE_HASH, STRONG_HASHES
logger = logging.getLogger(__name__)
class HashCommand(Command):
""... | gpl-3.0 |
erjohnso/ansible | lib/ansible/modules/cloud/openstack/os_server_volume.py | 7 | 4459 | #!/usr/bin/python
#coding: utf-8 -*-
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
# 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... | gpl-3.0 |
entropy1337/infernal-twin | Modules/build/pillow/Tests/test_file_pcx.py | 11 | 1419 | from helper import unittest, PillowTestCase, hopper
from PIL import Image
class TestFilePcx(PillowTestCase):
def _roundtrip(self, im):
f = self.tempfile("temp.pcx")
im.save(f)
im2 = Image.open(f)
self.assertEqual(im2.mode, im.mode)
self.assertEqual(im2.size, im.size)
... | gpl-3.0 |
Intel-Corporation/tensorflow | tensorflow/python/data/experimental/kernel_tests/serialization/tf_record_dataset_serialization_test.py | 21 | 3957 | # 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 |
onitake/ansible | lib/ansible/modules/network/aci/aci_interface_selector_to_switch_policy_leaf_profile.py | 15 | 7609 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2017, Bruno Calogero <brunocalogero@hotmail.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_... | gpl-3.0 |
ytoyama/yans_chainer_hackathon | tests/chainer_tests/functions_tests/normalization_tests/test_local_response_normalization.py | 16 | 2112 | import unittest
import numpy
import six
import chainer
from chainer import cuda
from chainer import functions
from chainer import gradient_check
from chainer import testing
from chainer.testing import attr
from chainer.testing import condition
class TestLocalResponseNormalization(unittest.TestCase):
def setUp(... | mit |
doismellburning/django | django/core/files/uploadhandler.py | 103 | 6890 | """
Base file upload handler classes, and the built-in concrete subclasses
"""
from __future__ import unicode_literals
from io import BytesIO
from django.conf import settings
from django.core.files.uploadedfile import TemporaryUploadedFile, InMemoryUploadedFile
from django.utils.encoding import python_2_unicode_comp... | bsd-3-clause |
boghison/servo | tests/wpt/css-tests/tools/pywebsocket/src/test/test_http_header_util.py | 496 | 3372 | #!/usr/bin/env python
#
# Copyright 2011, 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... | mpl-2.0 |
MihaiMoldovanu/ansible | lib/ansible/modules/cloud/azure/azure_rm_resourcegroup.py | 33 | 8741 | #!/usr/bin/python
#
# Copyright (c) 2016 Matt Davis, <mdavis@ansible.com>
# Chris Houseknecht, <house@redhat.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
ANS... | gpl-3.0 |
wolfe-pack/moro | public/javascripts/brat/server/src/convert/stanford.py | 2 | 21392 | #!/usr/bin/env python
'''
Conversion scripts related to Stanford tools.
Author: Pontus Stenetorp <pontus stenetorp se>
Version: 2012-06-26
'''
# TODO: Currently pretty much every single call re-parses the XML, optimise?
# TODO: We could potentially put the lemma into a comment
from __future__ import with_... | bsd-2-clause |
kczapla/pylint | pylint/test/functional/class_members_py30.py | 1 | 1806 | """ Various tests for class members access. """
# pylint: disable=R0903,import-error,no-init,missing-docstring, wrong-import-position,wrong-import-order, useless-object-inheritance
from missing import Missing
class MyClass(object):
"""class docstring"""
def __init__(self):
"""init"""
se... | gpl-2.0 |
brchiu/tensorflow | tensorflow/python/kernel_tests/fifo_queue_test.py | 2 | 61398 | # 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 |
MattsFleaMarket/python-for-android | python3-alpha/extra_modules/gdata/tlslite/utils/OpenSSL_RSAKey.py | 48 | 5017 | """OpenSSL/M2Crypto RSA implementation."""
from .cryptomath import *
from .RSAKey import *
from .Python_RSAKey import Python_RSAKey
#copied from M2Crypto.util.py, so when we load the local copy of m2
#we can still use it
def password_callback(v, prompt1='Enter private key passphrase:',
pro... | apache-2.0 |
srimai/odoo | addons/email_template/ir_actions.py | 281 | 3520 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (c) 2013 OpenERP S.A. <http://www.openerp.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of th... | agpl-3.0 |
kaltsimon/youtube-dl | youtube_dl/extractor/comcarcoff.py | 85 | 2219 | # encoding: utf-8
from __future__ import unicode_literals
import json
from .common import InfoExtractor
from ..utils import parse_iso8601
class ComCarCoffIE(InfoExtractor):
_VALID_URL = r'http://(?:www\.)?comediansincarsgettingcoffee\.com/(?P<id>[a-z0-9\-]*)'
_TESTS = [{
'url': 'http://comediansinca... | unlicense |
eggmaster/tempest | tempest/api/orchestration/stacks/test_soft_conf.py | 14 | 8011 | # 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
# d... | apache-2.0 |
dfranco/shinken | test/test_downtimes.py | 18 | 21518 | #!/usr/bin/env python
# Copyright (C) 2009-2014:
# Gabes Jean, naparuba@gmail.com
# Gerhard Lausser, Gerhard.Lausser@consol.de
#
# This file is part of Shinken.
#
# Shinken 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 F... | agpl-3.0 |
alqfahad/odoo | openerp/report/render/rml2html/rml2html.py | 438 | 15438 | # -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2005, Fabien Pinckaers, UCL, FSA
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesse... | agpl-3.0 |
cchurch/ansible | lib/ansible/module_utils/memset.py | 64 | 5156 | # This code is part of Ansible, but is an independent component.
# This particular file snippet, and this file snippet only, is BSD licensed.
# Modules you write using this snippet, which is embedded dynamically by Ansible
# still belong to the author of the module, and may assign their own license
# to the complete wo... | gpl-3.0 |
bearstech/ansible | lib/ansible/utils/module_docs_fragments/eos.py | 87 | 5493 | #
# (c) 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 late... | gpl-3.0 |
robbiet480/home-assistant | homeassistant/components/toon/const.py | 3 | 11757 | """Constants for the Toon integration."""
from datetime import timedelta
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_CONNECTIVITY,
DEVICE_CLASS_PROBLEM,
)
from homeassistant.components.sensor import DEVICE_CLASS_POWER
from homeassistant.const import (
ATTR_DEVICE_CLASS,
ATTR_ICON,... | apache-2.0 |
steventimberman/masterDebater | venv/lib/python2.7/site-packages/rest_framework/utils/model_meta.py | 21 | 5652 | """
Helper function for returning the field information that is associated
with a model class. This includes returning all the forward and reverse
relationships and their associated metadata.
Usage: `get_field_info(model)` returns a `FieldInfo` instance.
"""
from collections import OrderedDict, namedtuple
from rest_f... | mit |
m2lan/amonone | amonone/web/apps/settings/views/users.py | 5 | 3161 | from formencode.validators import Invalid as InvalidForm
from tornado.web import authenticated
from amonone.web.apps.core.baseview import BaseView
from amonone.web.apps.auth.models import user_model
from amonone.web.apps.core.models import server_model
from amonone.web.apps.settings.forms import CreateUserForm
class ... | mit |
alaski/nova | nova/tests/unit/virt/libvirt/volume/test_fibrechannel.py | 13 | 2574 | # 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
# d... | apache-2.0 |
chiviak/headphones | lib/beets/dbcore/query.py | 14 | 20323 | # This file is part of beets.
# Copyright 2014, 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 the rights to use, copy, ... | gpl-3.0 |
mspark93/VTK | ThirdParty/Twisted/twisted/conch/test/test_scripts.py | 41 | 1874 | # Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for the command-line interfaces to conch.
"""
try:
import pyasn1
except ImportError:
pyasn1Skip = "Cannot run without PyASN1"
else:
pyasn1Skip = None
try:
import Crypto
except ImportError:
cryptoSkip = "can't run w... | bsd-3-clause |
tntnatbry/tensorflow | tensorflow/contrib/distributions/python/ops/uniform.py | 11 | 6929 | # 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 |
mixedpuppy/git-repo | subcmds/stage.py | 78 | 2999 | #
# Copyright (C) 2008 The Android Open Source Project
#
# 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 la... | apache-2.0 |
google-research/google-research | saccader/visual_attention/dram_test.py | 1 | 1872 | # coding=utf-8
# Copyright 2021 The Google Research 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 applicab... | apache-2.0 |
kenshay/ImageScript | ProgramData/SystemFiles/Python/Lib/site-packages/pylint/test/extensions/test_elseif_used.py | 4 | 1508 | # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# For details: https://github.com/PyCQA/pylint/blob/master/COPYING
"""Tests for the pylint checker in :mod:`pylint.extensions.check_elif
"""
import os
import os.path as osp
import unittest
from pylint import checkers
from pylint.extensi... | gpl-3.0 |
adlnet-archive/edx-platform | common/djangoapps/xmodule_modifiers.py | 16 | 12125 | """
Functions that can are used to modify XBlock fragments for use in the LMS and Studio
"""
import datetime
import json
import logging
import static_replace
import uuid
import markupsafe
from django.conf import settings
from django.utils.timezone import UTC
from edxmako.shortcuts import render_to_string
from xblock.... | agpl-3.0 |
glaudsonml/kurgan-ai | tools/sqlmap/lib/techniques/union/test.py | 1 | 14550 | #!/usr/bin/env python
"""
Copyright (c) 2006-2016 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
import random
import re
from lib.core.agent import agent
from lib.core.common import average
from lib.core.common import Backend
from lib.core.common import isNullValue
from ... | apache-2.0 |
jamesward-demo/air-quick-fix | AIRQuickFixServer/pyamf/remoting/gateway/twisted.py | 1 | 11344 | # Copyright (c) 2007-2008 The PyAMF Project.
# See LICENSE for details.
"""
Twisted server implementation.
This gateway allows you to expose functions in Twisted to AMF
clients and servers.
@see: U{Twisted homepage (external)<http://twistedmatrix.com>}
@author: U{Thijs Triemstra<mailto:info@collab.nl>}
@author: U{N... | apache-2.0 |
BenefitA3/android_kernel_ark_msm8916 | tools/perf/scripts/python/net_dropmonitor.py | 2669 | 1738 | # Monitor the system for dropped packets and proudce a report of drop locations and counts
import os
import sys
sys.path.append(os.environ['PERF_EXEC_PATH'] + \
'/scripts/python/Perf-Trace-Util/lib/Perf/Trace')
from perf_trace_context import *
from Core import *
from Util import *
drop_log = {}
kallsyms = []
def... | gpl-2.0 |
qtekfun/htcDesire820Kernel | external/chromium_org/build/linux/rewrite_dirs.py | 259 | 2013 | #!/usr/bin/env python
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Rewrites paths in -I, -L and other option to be relative to a sysroot."""
import sys
import os
import optparse
REWRITE_PREFIX ... | gpl-2.0 |
TheTypoMaster/chromium-crosswalk | build/android/findbugs_diff.py | 39 | 3479 | #!/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.
"""Runs findbugs, and returns an error code if there are new warnings.
Other options
--only-analyze used to only analyze the c... | bsd-3-clause |
SanchayanMaity/gem5 | util/encode_inst_dep_trace.py | 13 | 8604 | #!/usr/bin/env python
# Copyright (c) 2015 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... | bsd-3-clause |
apollo13/ansible | test/units/module_utils/urls/test_fetch_url.py | 30 | 8420 | # -*- coding: utf-8 -*-
# (c) 2018 Matt Martz <matt@sivel.net>
# 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 socket
from ansible.module_utils.six import StringIO
from ansible.mo... | gpl-3.0 |
HLFH/CouchPotatoServer | couchpotato/core/media/movie/providers/trailer/youtube_dl/extractor/cinemassacre.py | 23 | 3899 | # encoding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
ExtractorError,
int_or_none,
)
class CinemassacreIE(InfoExtractor):
_VALID_URL = r'http://(?:www\.)?cinemassacre\.com/(?P<date_Y>[0-9]{4})/(?P<date_m>[0-9]{2})/(?P<date_d>[0-9]{2})... | gpl-3.0 |
Jetsly/pjsip-csharp | tests/pjsua/scripts-call/301_ice_public_b.py | 59 | 1114 | # $Id: 301_ice_public_b.py 2392 2008-12-22 18:54:58Z bennylp $
#
from inc_cfg import *
# This test:
# to make call with ICE but without STUN.
# Note:
# - need --dis-codec to make INVITE packet less than typical MTU
uas_args = "--null-audio --id=\"<sip:test1@pjsip.org>\" --registrar=sip:sip.pjsip.org --username=test... | gpl-2.0 |
scifiswapnil/Project-LoCatr | lib/python2.7/site-packages/django/contrib/gis/geos/prototypes/prepared.py | 178 | 1184 | from ctypes import c_char
from django.contrib.gis.geos.libgeos import (
GEOM_PTR, PREPGEOM_PTR, GEOSFuncFactory,
)
from django.contrib.gis.geos.prototypes.errcheck import check_predicate
# Prepared geometry constructor and destructors.
geos_prepare = GEOSFuncFactory('GEOSPrepare', argtypes=[GEOM_PTR], restype=PRE... | mit |
dbaxa/django | django/core/files/move.py | 554 | 2794 | """
Move a file in the safest way possible::
>>> from django.core.files.move import file_move_safe
>>> file_move_safe("/tmp/old_file", "/tmp/new_file")
"""
import os
from shutil import copystat
from django.core.files import locks
__all__ = ['file_move_safe']
def _samefile(src, dst):
# Macintosh, Unix.... | bsd-3-clause |
centwave/jg82ksgvqkuan | django/contrib/gis/db/backends/oracle/introspection.py | 388 | 1777 | import cx_Oracle
from django.db.backends.oracle.introspection import DatabaseIntrospection
class OracleIntrospection(DatabaseIntrospection):
# Associating any OBJECTVAR instances with GeometryField. Of course,
# this won't work right on Oracle objects that aren't MDSYS.SDO_GEOMETRY,
# but it is the only o... | bsd-3-clause |
romanz/trezor-agent | libagent/device/fake_device.py | 1 | 2468 | """Fake device - ONLY FOR TESTS!!! (NEVER USE WITH REAL DATA)."""
import hashlib
import logging
import ecdsa
from .. import formats
from . import interface
log = logging.getLogger(__name__)
def _verify_support(identity):
"""Make sure the device supports given configuration."""
if identity.curve_name not i... | lgpl-3.0 |
markeldigital/design-system | vendor/ruby/2.0.0/gems/pygments.rb-0.6.3/vendor/pygments-main/pygments/lexers/graph.py | 47 | 2314 | # -*- coding: utf-8 -*-
"""
pygments.lexers.graph
~~~~~~~~~~~~~~~~~~~~~
Lexers for graph query languages.
:copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexer import RegexLexer, include, bygroups, using, this... | mit |
olapaola/olapaola-android-scripting | python/src/Lib/test/test_sgmllib.py | 52 | 15994 | import pprint
import re
import unittest
from test import test_support
sgmllib = test_support.import_module('sgmllib', deprecated=True)
class EventCollector(sgmllib.SGMLParser):
def __init__(self):
self.events = []
self.append = self.events.append
sgmllib.SGMLParser.__init__(self)
def... | apache-2.0 |
nikkitan/bitcoin | test/functional/mining_prioritisetransaction.py | 4 | 7637 | #!/usr/bin/env python3
# Copyright (c) 2015-2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the prioritisetransaction mining RPC."""
import time
from test_framework.messages import COIN, M... | mit |
staslev/incubator-beam | sdks/python/apache_beam/examples/complete/top_wikipedia_sessions.py | 15 | 6055 | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.