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 |
|---|---|---|---|---|---|
cmauec/Cloud-Vision-Api | oauth2client/anyjson/simplejson/tests/test_for_json.py | 143 | 2767 | import unittest
import simplejson as json
class ForJson(object):
def for_json(self):
return {'for_json': 1}
class NestedForJson(object):
def for_json(self):
return {'nested': ForJson()}
class ForJsonList(object):
def for_json(self):
return ['list']
class DictForJson(dict):
... | gpl-2.0 |
sintefmath/Splipy | splipy/io/grdecl.py | 1 | 14711 | import numpy as np
from itertools import product, chain
from splipy import Surface, Volume, SplineObject, BSplineBasis
from splipy import surface_factory, volume_factory, curve_factory
from splipy.io import G2
from splipy.utils import ensure_listlike
from .master import MasterIO
import re
import warnings
from scipy.spa... | gpl-3.0 |
rienafairefr/pynYNAB | tests/test_operations.py | 2 | 2203 | import json
import pytest
from pynYNAB.Client import nYnabClient
from pynYNAB.ClientFactory import nYnabClientFactory
from pynYNAB.exceptions import NoBudgetNameException
from pynYNAB.schema.catalog import BudgetVersion
class MockConnection2(object):
id = '12345'
@pytest.fixture
def factory():
return nYna... | mit |
lildadou/Flexget | flexget/utils/qualities.py | 14 | 17358 | from __future__ import unicode_literals, division, absolute_import
import re
import copy
import logging
log = logging.getLogger('utils.qualities')
class QualityComponent(object):
""""""
def __init__(self, type, value, name, regexp=None, modifier=None, defaults=None):
"""
:param type: Type of ... | mit |
nsalomonis/AltAnalyze | AltAnalyzeViewer.py | 1 | 282646 | import os.path, sys, shutil
import os
import string, re
import subprocess
import numpy as np
import unique
import traceback
import wx
import wx.lib.scrolledpanel
import wx.grid as gridlib
try:
import warnings
with warnings.catch_warnings():
warnings.filterwarnings("ignore",category=UserWarning) ... | apache-2.0 |
teltek/edx-platform | common/djangoapps/enrollment/api.py | 2 | 18093 | """
Enrollment API for creating, updating, and deleting enrollments. Also provides access to enrollment information at a
course level, such as available course modes.
"""
import importlib
import logging
from django.conf import settings
from django.core.cache import cache
from opaque_keys.edx.keys import CourseKey
fr... | agpl-3.0 |
mdhaman/superdesk-core | apps/marked_desks/service.py | 3 | 3511 | # -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014, 2015 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... | agpl-3.0 |
BondAnthony/ansible | hacking/tests/gen_distribution_version_testcase.py | 13 | 2703 | #!/usr/bin/env python
"""
This script generated test_cases for test_distribution_version.py.
To do so it outputs the relevant files from /etc/*release, the output of distro.linux_distribution()
and the current ansible_facts regarding the distribution version.
This assumes a working ansible version in the path.
"""
... | gpl-3.0 |
prasen-ftech/pywinauto | examples/windowmediaplayer.py | 19 | 2581 | # GUI Application automation and testing library
# Copyright (C) 2006 Mark Mc Mahon
#
# This library 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 2.1
# of the License, or (at you... | lgpl-2.1 |
TNT-Samuel/Coding-Projects | DNS Server/Source/Lib/encodings/idna.py | 215 | 9170 | # This module implements the RFCs 3490 (IDNA) and 3491 (Nameprep)
import stringprep, re, codecs
from unicodedata import ucd_3_2_0 as unicodedata
# IDNA section 3.1
dots = re.compile("[\u002E\u3002\uFF0E\uFF61]")
# IDNA section 5
ace_prefix = b"xn--"
sace_prefix = "xn--"
# This assumes query strings, so AllowUnassig... | gpl-3.0 |
rturumella/CloudBot | plugins/reddit.py | 2 | 3282 | from datetime import datetime
import re
import random
import asyncio
import functools
import urllib.parse
import requests
from cloudbot import hook
from cloudbot.util import timeformat, formatting
reddit_re = re.compile(r'.*(((www\.)?reddit\.com/r|redd\.it)[^ ]+)', re.I)
base_url = "http://reddit.com/r/{}/.json"
s... | gpl-3.0 |
f2nd/yandex-tank | yandextank/stepper/tests/test_load_plan.py | 4 | 6624 | import pytest
from yandextank.stepper.load_plan import create, Const, Line, Composite, Stairway, StepFactory
from yandextank.stepper.util import take
class TestLine(object):
def test_get_rps_list(self):
lp = create(["line(1, 100, 10s)"])
rps_list = lp.get_rps_list()
assert len(rps_list) ==... | lgpl-2.1 |
sjohns09/MSRDM | vendor/googletest/googlemock/scripts/fuse_gmock_files.py | 242 | 8631 | #!/usr/bin/env python
#
# Copyright 2009, 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... | lgpl-3.0 |
nathanial/lettuce | tests/integration/lib/Django-1.3/django/contrib/gis/tests/geogapp/tests.py | 222 | 4080 | """
Tests for geography support in PostGIS 1.5+
"""
import os
from django.contrib.gis import gdal
from django.contrib.gis.measure import D
from django.test import TestCase
from models import City, County, Zipcode
class GeographyTest(TestCase):
def test01_fixture_load(self):
"Ensure geography features load... | gpl-3.0 |
cloud-engineering/wifi | db.py | 1 | 2100 | # Python Standard Library Imports
import logging
# External Imports
from sqlalchemy import Column
from sqlalchemy import String, INTEGER, FLOAT
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import scoped_session, sessionmaker
# Custom Imports
import c... | mit |
yanikou19/pymatgen | pymatgen/io/aseio.py | 3 | 1743 | # coding: utf-8
from __future__ import division, unicode_literals
"""
This module provides conversion between the Atomic Simulation Environment
Atoms object and pymatgen Structure objects.
"""
__author__ = "Shyue Ping Ong"
__copyright__ = "Copyright 2012, The Materials Project"
__version__ = "1.0"
__maintainer__ = ... | mit |
uchuugaka/anaconda | anaconda_lib/jedi/parser/__init__.py | 38 | 16804 | """
The ``Parser`` tries to convert the available Python code in an easy to read
format, something like an abstract syntax tree. The classes who represent this
tree, are sitting in the :mod:`jedi.parser.tree` module.
The Python module ``tokenize`` is a very important part in the ``Parser``,
because it splits the code ... | gpl-3.0 |
revjunkie/lge-g2-d802 | scripts/build-all.py | 1474 | 10189 | #! /usr/bin/env python
# Copyright (c) 2009-2013, The Linux Foundation. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# ... | gpl-2.0 |
bigdatauniversity/edx-platform | lms/lib/courseware_search/lms_filter_generator.py | 43 | 2452 | """
This file contains implementation override of SearchFilterGenerator which will allow
* Filter by all courses in which the user is enrolled in
"""
from microsite_configuration import microsite
from student.models import CourseEnrollment
from search.filter_generator import SearchFilterGenerator
from openedx.core... | agpl-3.0 |
Mirantis/mos-horizon | openstack_dashboard/templatetags/themes.py | 14 | 2548 | # Copyright 2016 Hewlett Packard Enterprise Software, LLC
# 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 |
richard-willowit/odoo | addons/web/models/ir_http.py | 6 | 2130 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import json
from odoo import models
from odoo.http import request
import odoo
class Http(models.AbstractModel):
_inherit = 'ir.http'
def webclient_rendering_context(self):
return {
'menu_... | gpl-3.0 |
alope107/nbgrader | nbgrader/tests/api/test_gradebook.py | 4 | 25911 | import pytest
from datetime import datetime
from nbgrader import api
from nbgrader import utils
from nbgrader.api import InvalidEntry, MissingEntry
@pytest.fixture
def gradebook(request):
gb = api.Gradebook("sqlite:///:memory:")
def fin():
gb.db.close()
request.addfinalizer(fin)
return gb
@p... | bsd-3-clause |
tojon/treeherder | treeherder/webapp/api/performance_data.py | 2 | 14534 | import datetime
import time
from collections import defaultdict
import django_filters
from django.conf import settings
from rest_framework import (exceptions,
filters,
pagination,
viewsets)
from rest_framework.response import Response
... | mpl-2.0 |
x111ong/django | tests/flatpages_tests/test_middleware.py | 290 | 8134 | from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.flatpages.models import FlatPage
from django.contrib.sites.models import Site
from django.test import TestCase, modify_settings, override_settings
from .settings import FLATPAGES_TEMPLATES
class TestDataMixin(object):
... | bsd-3-clause |
Diiaablo95/friendsNet | test/services_api_test_media_item.py | 1 | 6919 | import unittest
import json
import flask
import friendsNet.resources as resources
import friendsNet.database as database
DB_PATH = 'db/friendsNet_test.db'
ENGINE = database.Engine(DB_PATH)
COLLECTION_JSON = "application/vnd.collection+json"
HAL_JSON = "application/hal+json"
MEDIA_ITEM_PROFILE = "/profiles/media_item... | gpl-3.0 |
kxz/waapuro | setup.py | 1 | 1353 | #!/usr/bin/env python
import os
import sys
from setuptools import setup, find_packages
from setuptools.command.test import test
class Tox(test):
def finalize_options(self):
test.finalize_options(self)
self.test_args = []
self.test_suite = True
def run_tests(self):
import tox
... | mit |
LeandroRoberto/acrobatasdovento | node_modules/node-gyp/gyp/pylib/gyp/ordered_dict.py | 2354 | 10366 | # Unmodified from http://code.activestate.com/recipes/576693/
# other than to add MIT license header (as specified on page, but not in code).
# Linked from Python documentation here:
# http://docs.python.org/2/library/collections.html#collections.OrderedDict
#
# This should be deleted once Py2.7 is available on all bot... | mit |
grow/pygrow | grow/documents/document_fields_test.py | 1 | 1484 | """Tests for the document fields."""
import copy
import unittest
from grow.documents import document_fields
class DocumentFieldsTestCase(unittest.TestCase):
def testContains(self):
doc_fields = document_fields.DocumentFields({
'foo': 'bar',
}, None)
self.assertEquals(True, '... | mit |
kennethgillen/ansible | lib/ansible/plugins/cache/pickle.py | 27 | 1645 | # (c) 2017, Brian Coca
#
# 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 dist... | gpl-3.0 |
imply/chuu | third_party/closure_linter/closure_linter/statetracker.py | 135 | 31214 | #!/usr/bin/env python
#
# Copyright 2007 The Closure Linter 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
#... | bsd-3-clause |
sileht/gnocchi | gnocchi/tests/functional/fixtures.py | 1 | 9173 | #
# Copyright 2015-2017 Red Hat. 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 |
meabsence/python-for-android | python3-alpha/python3-src/Lib/encodings/iso8859_3.py | 272 | 13089 | """ Python Character Mapping Codec iso8859_3 generated from 'MAPPINGS/ISO8859/8859-3.TXT' with gencodec.py.
"""#"
import codecs
### Codec APIs
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,input,errors='... | apache-2.0 |
asm666/sympy | sympy/utilities/pytest.py | 78 | 4728 | """py.test hacks to support XFAIL/XPASS"""
from __future__ import print_function, division
import sys
import functools
import os
from sympy.core.compatibility import get_function_name
try:
import py
from py.test import skip, raises
USE_PYTEST = getattr(sys, '_running_pytest', False)
except ImportError:
... | bsd-3-clause |
ViennaChen/mysql-connector-python | setupinfo.py | 7 | 4296 | # MySQL Connector/Python - MySQL driver written in Python.
# Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
# MySQL Connector/Python is licensed under the terms of the GPLv2
# <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
# MySQL Connectors. There are special exceptio... | gpl-2.0 |
kustodian/ansible | lib/ansible/modules/cloud/amazon/aws_batch_compute_environment.py | 11 | 17073 | #!/usr/bin/python
# Copyright (c) 2017 Jon Meran <jonathan.meran@sonos.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 |
boundarydevices/android_external_chromium_org | tools/telemetry/telemetry/core/platform/profiler/java_heap_profiler.py | 8 | 3258 | # 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 os
import subprocess
import threading
from telemetry.core import util
from telemetry.core.backends.chrome import android_browser_finder
from telemetr... | bsd-3-clause |
arantebillywilson/python-snippets | microblog/flask/lib/python3.5/site-packages/whoosh/util/__init__.py | 52 | 4424 | # Copyright 2007 Matt Chaput. 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,
# this list of conditions and the... | mit |
ruzhytskyi/Koans | python3/koans/about_class_attributes.py | 97 | 4668 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Based on AboutClassMethods in the Ruby Koans
#
from runner.koan import *
class AboutClassAttributes(Koan):
class Dog:
pass
def test_objects_are_objects(self):
fido = self.Dog()
self.assertEqual(__, isinstance(fido, object))
def t... | mit |
savoirfairelinux/django | tests/admin_inlines/admin.py | 17 | 5776 | from django import forms
from django.contrib import admin
from .models import (
Author, BinaryTree, CapoFamiglia, Chapter, ChildModel1, ChildModel2,
Consigliere, EditablePKBook, ExtraTerrestrial, Fashionista, Holder,
Holder2, Holder3, Holder4, Inner, Inner2, Inner3, Inner4Stacked,
Inner4Tabular, NonAut... | bsd-3-clause |
golismero/golismero | golismero/common.py | 8 | 38619 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Common constants, classes and functions used across GoLismero.
"""
__license__ = """
GoLismero 2.0 - The web knife - Copyright (C) 2011-2014
Golismero project site: https://github.com/golismero
Golismero project mail: contact@golismero-project.com
This program is fr... | gpl-2.0 |
dednal/chromium.src | build/android/pylib/remote/device/remote_device_test_run.py | 9 | 9695 | # Copyright 2014 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.
"""Run specific test on specific environment."""
import logging
import os
import sys
import tempfile
import time
import zipfile
from pylib import constants... | bsd-3-clause |
Tomsod/gemrb | gemrb/GUIScripts/bg2/GUICG9.py | 7 | 2316 | # GemRB - Infinity Engine Emulator
# Copyright (C) 2003 The GemRB Project
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later versi... | gpl-2.0 |
wanghuan1115/sdkbox-vungle-sample | cpp/cocos2d/tools/gen-prebuilt/gen_prebuilt_libs.py | 80 | 13293 | #!/usr/bin/python
# ----------------------------------------------------------------------------
# generate the prebuilt libs of engine
#
# Copyright 2014 (C) zhangbin
#
# License: MIT
# ----------------------------------------------------------------------------
'''
Generate the prebuilt libs of engine
'''
import os
... | mit |
wangjun/odoo | addons/base_report_designer/plugin/openerp_report_designer/test/test_fields.py | 391 | 1308 | #
# Use this module to retrive the fields you need according to the type
# of the OpenOffice operation:
# * Insert a Field
# * Insert a RepeatIn
#
import xmlrpclib
import time
sock = xmlrpclib.ServerProxy('http://localhost:8069/xmlrpc/object')
def get(object, level=3, ending=None, ending_excl=None, recur=None, roo... | agpl-3.0 |
aldebjer/pysim | doc/conf.py | 1 | 10355 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# PySim documentation build configuration file, created by
# sphinx-quickstart on Fri Mar 14 13:23:12 2014.
#
# 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
# auto... | bsd-3-clause |
yonglehou/pybrain | pybrain/rl/environments/shipsteer/viewer.py | 25 | 12969 | from __future__ import print_function
__author__ = 'Frank Sehnke, sehnke@in.tum.de'
#@PydevCodeAnalysisIgnore
#########################################################################
# OpenGL viewer for the FlexCube Environment
#
# The FlexCube Environment is a Mass-Spring-System composed of 8 mass points.
# These r... | bsd-3-clause |
Phonemetra/TurboCoin | test/functional/rpc_deprecated.py | 1 | 1168 | #!/usr/bin/env python3
# Copyright (c) 2017-2019 TurboCoin
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test deprecation of RPC calls."""
from test_framework.test_framework import TurbocoinTestFramework
# from test_framework.... | mit |
storborg/axibot | axibot/colors.py | 1 | 1166 | from __future__ import (absolute_import, division, print_function,
unicode_literals)
import math
from operator import itemgetter
from colormath.color_objects import sRGBColor, LabColor
from colormath.color_conversions import convert_color
pen_sets = {
'precise-v5': {
'black': (59,... | gpl-2.0 |
fossoult/odoo | openerp/__init__.py | 235 | 3586 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 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 |
karllessard/tensorflow | tensorflow/python/kernel_tests/cumulative_logsumexp_test.py | 15 | 4359 | # 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 |
ssvsergeyev/ZenPacks.zenoss.AWS | src/boto/tests/unit/beanstalk/test_exception.py | 114 | 2085 | # Copyright (c) 2014 Amazon.com, Inc. or its affiliates.
# All Rights Reserved
#
# 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... | gpl-2.0 |
jnewland/home-assistant | homeassistant/components/wemo/binary_sensor.py | 7 | 4329 | """Support for WeMo binary sensors."""
import asyncio
import logging
import async_timeout
import requests
from homeassistant.components.binary_sensor import BinarySensorDevice
from homeassistant.exceptions import PlatformNotReady
from . import SUBSCRIPTION_REGISTRY
_LOGGER = logging.getLogger(__name__)
def setup_... | apache-2.0 |
payet-s/pyrser | pyrser/directives/ignore.py | 2 | 1577 | from pyrser import meta, parsing
@meta.rule(parsing.Parser, "Base.ignore_cxx")
def ignore_cxx(self) -> bool:
"""Consume comments and whitespace characters."""
self._stream.save_context()
while not self.read_eof():
idxref = self._stream.index
if self._stream.peek_char in " \t\v\f\r\n":
... | gpl-3.0 |
TheMOOCAgency/edx-platform | openedx/core/djangoapps/content/block_structure/signals.py | 13 | 1230 | """
Signal handlers for invalidating cached data.
"""
from django.conf import settings
from django.dispatch.dispatcher import receiver
from xmodule.modulestore.django import SignalHandler
from .api import clear_course_from_cache
from .tasks import update_course_in_cache
@receiver(SignalHandler.course_published)
def... | agpl-3.0 |
letaureau/b-tk.core | Testing/Python/SeparateKnownVirtualMarkersFilterTest.py | 4 | 18217 | import btk
import unittest
import _TDDConfigure
import numpy
class SeparateKnownVirtualMarkersFilterTest(unittest.TestCase):
def test_Constructor(self):
skvm = btk.btkSeparateKnownVirtualMarkersFilter()
labels = skvm.GetVirtualReferenceFrames()
num = 19
self.assertEqual(labels.size(... | bsd-3-clause |
badreddinetahir/pwn_plug_sources | src/voiper/sulley/requests/sip_valid.py | 8 | 1257 | from sulley import *
s_initialize("INVITE_VALID")
s_static('\r\n'.join(['INVITE sip:tester@192.168.3.104 SIP/2.0',
'CSeq: 1 INVITE',
'Via: SIP/2.0/UDP 192.168.3.102:5068;branch=z9hG4bKlm4zshdowki1t8c7ep6j0yavq2ug5r3x;rport',
'From: "nnp" <sip:nnp@192.168.3.104>;tag=so08p5k39wuv1dczfnij7bet4l2m6hrq',
'Call-ID: rzxd6tm... | gpl-3.0 |
donkirkby/django | tests/reverse_lookup/tests.py | 326 | 1675 | from __future__ import unicode_literals
from django.core.exceptions import FieldError
from django.test import TestCase
from .models import Choice, Poll, User
class ReverseLookupTests(TestCase):
def setUp(self):
john = User.objects.create(name="John Doe")
jim = User.objects.create(name="Jim Bo")... | bsd-3-clause |
fivejjs/PTVS | Python/Tests/TestData/DjangoAnalysisTestApp/DjangoAnalysisTestApp/settings.py | 18 | 5537 | # Django settings for DjangoAnalysisTestApp project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
... | apache-2.0 |
hgrif/ds-utils | dsutils/sklearn.py | 1 | 2913 | import numpy as np
from sklearn import cross_validation
from sklearn import metrics
from sklearn import preprocessing
def multiclass_roc_auc_score(y_true, y_score, label_binarizer=None, **kwargs):
"""Compute ROC AUC score for multiclass.
:param y_true: true multiclass predictions [n_samples]
:param y_scor... | mit |
nuncjo/odoo | addons/auth_signup/__init__.py | 446 | 1039 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2012-today OpenERP SA (<http://www.openerp.com>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms o... | agpl-3.0 |
ctb/cvxpy | doc/sphinxext/docscrape.py | 68 | 15425 | """Extract reference documentation from the NumPy source tree.
"""
import inspect
import textwrap
import re
import pydoc
from StringIO import StringIO
from warnings import warn
class Reader(object):
"""A line-based string reader.
"""
def __init__(self, data):
"""
Parameters
-----... | gpl-3.0 |
kidaa30/spacewalk | backend/server/rhnSQL/sql_row.py | 4 | 4930 | #
# Copyright (c) 2008--2015 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 c... | gpl-2.0 |
alexcuellar/odoo | addons/account_budget/account_budget.py | 194 | 9368 | # -*- 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 |
yogo1212/RIOT | tests/bench_runtime_coreapis/tests/01-run.py | 14 | 1439 | #!/usr/bin/env python3
# Copyright (C) 2018 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 sys
from testrunner import run
# The default timeout is not enough for... | lgpl-2.1 |
topic2k/EventGhost | plugins/FS20PCS/__init__.py | 4 | 21740 | """<rst>
Allows to send commands to FS20 receivers.
|
|fS20Image|_
`Direct shop link <http://www.elv.de/output/controller.aspx?cid=74&detail=10&detail2=27743>`__
.. |fS20Image| image:: picture.jpg
.. _fS20Image: http://www.elv.de/
"""
import time
eg.RegisterPlugin(
name = "ELV FS20 PCS",
author = "Bartman"... | gpl-2.0 |
neilLasrado/erpnext | erpnext/crm/doctype/investor/investor.py | 1 | 2929 | # -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
import frappe
from frappe.model.document import Document
from frappe.contacts.address_and_contact import load_address_and_contact
from erpnext.accounts.party import validate_pa... | gpl-3.0 |
ThinkingBridge/platform_external_chromium_org | media/tools/constrained_network_server/cns.py | 168 | 17314 | #!/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.
"""Constrained Network Server. Serves files with supplied network constraints.
The CNS exposes a web based API allowing network co... | bsd-3-clause |
doismellburning/django | tests/signals/tests.py | 311 | 10273 | from __future__ import unicode_literals
from django.db import models
from django.db.models import signals
from django.dispatch import receiver
from django.test import TestCase
from django.utils import six
from .models import Author, Book, Car, Person
class BaseSignalTest(TestCase):
def setUp(self):
# Sa... | bsd-3-clause |
a-doumoulakis/tensorflow | tensorflow/contrib/opt/python/training/moving_average_optimizer.py | 84 | 5839 | # 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 |
Serag8/Bachelor | google_appengine/lib/django-1.3/django/db/backends/mysql/creation.py | 311 | 3019 | from django.db.backends.creation import BaseDatabaseCreation
class DatabaseCreation(BaseDatabaseCreation):
# This dictionary maps Field objects to their associated MySQL column
# types, as strings. Column-type strings can contain format strings; they'll
# be interpolated against the values of Field.__dict_... | mit |
nlu90/heron | heron/instance/tests/python/utils/topology_context_impl_unittest.py | 5 | 2275 | #!/usr/bin/env python
# -*- encoding: 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... | apache-2.0 |
nzavagli/UnrealPy | UnrealPyEmbed/Development/Python/2015.08.07-Python2710-x64-Source-vs2015/Python27/Source/reportlab-3.2.0/tests/test_platypus_wrapping.py | 14 | 3840 | #Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
"""Tests for context-dependent indentation
"""
__version__='''$Id: test_platypus_indents.py 3660 2010-02-08 18:17:33Z damian $'''
from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, outputfile, printLocation
setOutDir(__name_... | mit |
ivanlmj/PyCaptive | app/modules/checksys.py | 1 | 2085 |
import socket
import subprocess as sp
import sys
from app import app
class Components():
def __init__(self):
self._binaries = (app.config['CHECKSYS_DICT']["IPTABLES"], app.config['CHECKSYS_DICT']["CONNTRACK"])
self._services = None
if app.config['TEST_MODE']:
self._services =... | gpl-3.0 |
emersonsoftware/ansiblefork | lib/ansible/utils/module_docs_fragments/openstack.py | 26 | 4023 | # Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
#
# 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... | gpl-3.0 |
grupozeety/CDerpnext | erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.py | 7 | 1698 | # 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
from erpnext.accounts.report.financial_statements import (get_period_list, get_columns, ... | agpl-3.0 |
Kussie/HTPC-Manager | libs/requests/packages/urllib3/util/request.py | 1008 | 2089 | from base64 import b64encode
from ..packages.six import b
ACCEPT_ENCODING = 'gzip,deflate'
def make_headers(keep_alive=None, accept_encoding=None, user_agent=None,
basic_auth=None, proxy_basic_auth=None, disable_cache=None):
"""
Shortcuts for generating request headers.
:param keep_ali... | mit |
DarthMaulware/EquationGroupLeaks | Leak #5 - Lost In Translation/windows/Resources/LegacyWindowsExploits/Exploits/EAFU 2.2.0/EAFU_SSL.py | 1 | 1272 | import re, socket, string, sys
if __name__ == "__main__":
if len(sys.argv) < 3:
sys.exit(2)
target_address = (sys.argv[1])
target_port = int(sys.argv[2])
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((target_address, target_port))
ssl_sock = socket.ssl(s)
# print the cert info
#pr... | unlicense |
rd37/horizon | horizon/conf/__init__.py | 77 | 2063 | # 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
# distributed under t... | apache-2.0 |
hassanabidpk/django | tests/gis_tests/test_geoip.py | 73 | 5275 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
import unittest
import warnings
from unittest import skipUnless
from django.conf import settings
from django.contrib.gis.geoip import HAS_GEOIP
from django.contrib.gis.geos import HAS_GEOS, GEOSGeometry
from django.test import ignore_warnings
f... | bsd-3-clause |
amnet04/ALECMAPREADER1 | funcionesCV_recurrentes.py | 1 | 4438 | import numpy as np
import pandas
import cv2
def cargar_imagen(archivo):
'''
Carga en variables dos matrices de la imágen, una gris y otra a color,
devuelve un diccionario con las dos versiones.
'''
imagen = {}
imagen['gris'] = cv2.imread(archivo,0)
imagen['color'] = cv2.imread(archivo)
... | mit |
takluyver/readthedocs.org | readthedocs/restapi/views/footer_views.py | 6 | 4195 | from django.shortcuts import get_object_or_404
from django.template import Context, loader as template_loader
from django.conf import settings
from django.core.context_processors import csrf
from rest_framework import decorators, permissions
from rest_framework.renderers import JSONPRenderer, JSONRenderer, BrowsableAP... | mit |
RO-ny9/python-for-android | python-build/python-libs/xmpppy/doc/examples/commandsbot.py | 87 | 7937 | #!/usr/bin/python
""" The example of using xmpppy's Ad-Hoc Commands (JEP-0050) implementation.
"""
import xmpp
from xmpp.protocol import *
options = {
'JID': 'circles@example.com',
'Password': '********',
}
class TestCommand(xmpp.commands.Command_Handler_Prototype):
""" Example class. You should read source if you... | apache-2.0 |
pizzapanther/HoverMom | hovermom/django/db/transaction.py | 77 | 20601 | """
This module implements a transaction manager that can be used to define
transaction handling in a request or view function. It is used by transaction
control middleware and decorators.
The transaction manager can be in managed or in auto state. Auto state means the
system is using a commit-on-save strategy (actual... | mit |
oberlin/django | tests/migrations/test_base.py | 292 | 4620 | import os
import shutil
import tempfile
from contextlib import contextmanager
from importlib import import_module
from django.apps import apps
from django.db import connection
from django.db.migrations.recorder import MigrationRecorder
from django.test import TransactionTestCase
from django.test.utils import extend_sy... | bsd-3-clause |
zerc/django | django/contrib/gis/gdal/raster/const.py | 238 | 1537 | """
GDAL - Constant definitions
"""
from ctypes import (
c_byte, c_double, c_float, c_int16, c_int32, c_uint16, c_uint32,
)
# See http://www.gdal.org/gdal_8h.html#a22e22ce0a55036a96f652765793fb7a4
GDAL_PIXEL_TYPES = {
0: 'GDT_Unknown', # Unknown or unspecified type
1: 'GDT_Byte', # Eight bit unsigned int... | bsd-3-clause |
tashigaofei/BlogSpider | scrapy/tests/test_downloadermiddleware_redirect.py | 15 | 9245 | import unittest
from scrapy.contrib.downloadermiddleware.redirect import RedirectMiddleware, MetaRefreshMiddleware
from scrapy.spider import Spider
from scrapy.exceptions import IgnoreRequest
from scrapy.http import Request, Response, HtmlResponse
from scrapy.utils.test import get_crawler
class RedirectMiddlewareTes... | mit |
writefaruq/lionface-app | django/contrib/gis/tests/test_spatialrefsys.py | 12 | 6799 | from django.db import connection
from django.contrib.gis.tests.utils import mysql, no_mysql, oracle, postgis, spatialite
from django.utils import unittest
test_srs = ({'srid' : 4326,
'auth_name' : ('EPSG', True),
'auth_srid' : 4326,
'srtext' : 'GEOGCS["WGS 84",DATUM["WGS... | bsd-3-clause |
valorekhov/AvrBee | src/AvrBee/HexFileFormat.py | 1 | 2846 | from abc import ABCMeta, abstractmethod
import struct
import binascii, os, sys
class HexFileFormat(object):
"""Parses out Hex File format into a byte stream"""
def __init__(self, path=None, file=None):
self.path = path
self.file = file
pass
def get_bytes(self):
with open(se... | unlicense |
NaturalSolutions/NsPortal | Back/ns_portal/resources/root/security/oauth2/v1/login/login_resource.py | 1 | 2467 | from ns_portal.core.resources import (
MetaEndPointResource
)
from marshmallow import (
Schema,
fields,
EXCLUDE,
ValidationError
)
from ns_portal.database.main_db import (
TUsers
)
from sqlalchemy import (
and_
)
from sqlalchemy.orm.exc import (
MultipleResultsFound
)
from pyramid.securi... | mit |
AustereCuriosity/astropy | astropy/wcs/tests/extension/test_extension.py | 1 | 2869 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import absolute_import, division, print_function, unicode_literals
import os
import subprocess
import sys
import pytest
def test_wcsapi_extension(tmpdir):
# Test that we can build a simple C extension with the astropy.wcs C API
... | bsd-3-clause |
mlcommons/training | object_detection/pytorch/maskrcnn_benchmark/config/paths_catalog.py | 1 | 8463 | # Copyright (c) 2021, NVIDIA 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/licenses/LICENSE-2.0
#
# Unless required by applic... | apache-2.0 |
schreiberx/sweet | benchmarks_plane/nonlinear_interaction/pp_plot_errors_single.py | 2 | 2935 | #! /usr/bin/env python3
import sys
import matplotlib
matplotlib.use('Agg')
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.colors as colors
from matplotlib.lines import Line2D
from mule.postprocessing.JobsData import *
from mule.postprocessing.JobsDataConsolidate import *
if len(sys.argv) > ... | mit |
SatoshiNXSimudrone/sl4a-damon-clone | python/src/Tools/pybench/With.py | 43 | 4137 | from __future__ import with_statement
from pybench import Test
class WithFinally(Test):
version = 2.0
operations = 20
rounds = 80000
class ContextManager(object):
def __enter__(self):
pass
def __exit__(self, exc, val, tb):
pass
def test(self):
cm ... | apache-2.0 |
francisco-dlp/hyperspy | hyperspy/samfire_utils/weights/red_chisq.py | 6 | 1212 | # -*- coding: utf-8 -*-
# Copyright 2007-2011 The HyperSpy developers
#
# This file is part of HyperSpy.
#
# HyperSpy 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... | gpl-3.0 |
johnnykv/heralding | heralding/tests/test_pop3.py | 1 | 2904 | # Copyright (C) 2017 Johnny Vestergaard <jkv@unixcluster.dk>
#
# 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 p... | gpl-3.0 |
unicri/edx-platform | lms/djangoapps/ccx/tests/test_utils.py | 6 | 22042 | """
test utils
"""
from nose.plugins.attrib import attr
from ccx.models import ( # pylint: disable=import-error
CcxMembership,
CcxFutureMembership,
)
from ccx.tests.factories import ( # pylint: disable=import-error
CcxFactory,
CcxMembershipFactory,
CcxFutureMembershipFactory,
)
from student.roles... | agpl-3.0 |
guewen/OpenUpgrade | addons/account/wizard/account_chart.py | 39 | 5159 | # -*- 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 |
PetrDlouhy/django | django/utils/module_loading.py | 30 | 6416 | import copy
import os
import sys
from importlib import import_module
from django.utils import six
def import_string(dotted_path):
"""
Import a dotted module path and return the attribute/class designated by the
last name in the path. Raise ImportError if the import failed.
"""
try:
module... | bsd-3-clause |
couchand/petard | vendor/cxxtest-4.3/test/test_doc.py | 54 | 1097 | #-------------------------------------------------------------------------
# CxxTest: A lightweight C++ unit testing library.
# Copyright (c) 2008 Sandia Corporation.
# This software is distributed under the LGPL License v3
# For more information, see the COPYING file in the top CxxTest directory.
# Under the terms of ... | mit |
pdellaert/ansible | test/units/modules/network/fortios/test_fortios_application_name.py | 21 | 11085 | # Copyright 2019 Fortinet, Inc.
#
# 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 in the... | gpl-3.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.