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 |
|---|---|---|---|---|---|
cloudify-cosmo/cloudify-azure-plugin | azure_sdk/resources/network/public_ip_address.py | 1 | 2961 | # #######
# Copyright (c) 2020 Cloudify Platform Ltd. 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 |
sanguinariojoe/FreeCAD | src/Tools/generateTemplates/templateModuleAppMain.py | 27 | 1784 | #! python
# -*- coding: utf-8 -*-
# (c) 2006 Juergen Riegel
from . import template
import generateBase.generateModel_Module
import generateBase.generateTools
class TemplateModuleAppMain (template.ModelTemplate):
def Generate(self):
file = open(self.path + "/App" + self.module.Name + ".cpp",'w')
gener... | lgpl-2.1 |
CajetanP/coding-exercises | Exercism/python/leap/leap_test.py | 5 | 1268 | import unittest
from leap import leap_year
# Tests adapted from `problem-specifications//canonical-data.json` @ v1.6.0
class LeapTest(unittest.TestCase):
def test_year_not_divisible_by_4_in_common_year(self):
self.assertIs(leap_year(2015), False)
def test_year_divisible_by_2_not_divisible_by_4_in_c... | mit |
rtoma/Diamond | src/collectors/userscripts/test/testuserscripts.py | 30 | 2095 | #!/usr/bin/python
# coding=utf-8
################################################################################
import os
import sys
from test import CollectorTestCase
from test import get_collector_config
from test import unittest
from test import run_only
from mock import patch
from diamond.collector import Coll... | mit |
maas/maas | src/provisioningserver/ntp/tests/test_config.py | 1 | 12166 | # Copyright 2016 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Tests for NTP service configuration."""
from functools import partial
from itertools import chain
from random import randrange
import re
from netaddr import IPAddress
from te... | agpl-3.0 |
zaqwes8811/serial-a-and-ds | extern/gmock-1.6.0/gtest/scripts/gen_gtest_pred_impl.py | 412 | 21984 | #!/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... | apache-2.0 |
dyoung418/tensorflow | tensorflow/python/kernel_tests/shard_dataset_op_test.py | 42 | 4218 | # 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 |
thanhphat11/android_kernel_pantech_ef63l | Documentation/networking/cxacru-cf.py | 14668 | 1626 | #!/usr/bin/env python
# Copyright 2009 Simon Arlott
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your option)
# any later version.
#
# This program i... | gpl-2.0 |
adwiputra/LUMENS-repo | processing/outputs/OutputRaster.py | 6 | 2431 | # -*- coding: utf-8 -*-
"""
***************************************************************************
OutputRaster.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
**************************... | gpl-2.0 |
matthaywardwebdesign/rethinkdb | external/v8_3.30.33.16/tools/disasm.py | 73 | 3650 | #!/usr/bin/env python
#
# Copyright 2011 the V8 project authors. 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
# noti... | agpl-3.0 |
0jpq0/kbengine | kbe/src/lib/python/Lib/distutils/msvc9compiler.py | 81 | 30528 | """distutils.msvc9compiler
Contains MSVCCompiler, an implementation of the abstract CCompiler class
for the Microsoft Visual Studio 2008.
The module is compatible with VS 2005 and VS 2008. You can find legacy support
for older versions of VS in distutils.msvccompiler.
"""
# Written by Perry Stoll
# hacked by Robin B... | lgpl-3.0 |
xen0l/ansible | lib/ansible/modules/storage/purestorage/purefa_host.py | 24 | 6690 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, Simon Dodsley (simon@purestorage.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 |
JimCircadian/ansible | test/sanity/code-smell/no-get-exception.py | 38 | 1439 | #!/usr/bin/env python
import os
import re
import sys
def main():
skip = set([
'test/sanity/code-smell/%s' % os.path.basename(__file__),
'lib/ansible/module_utils/pycompat24.py',
'lib/ansible/module_utils/six/__init__.py',
# the following files should be fixed and removed from this... | gpl-3.0 |
t0nimas/ardupilot | Tools/autotest/arducopter.py | 4 | 45865 | # fly ArduCopter in SITL
# Flight mode switch positions are set-up in arducopter.param to be
# switch 1 = Circle
# switch 2 = Land
# switch 3 = RTL
# switch 4 = Auto
# switch 5 = Loiter
# switch 6 = Stabilize
import math
import os
import shutil
import time
import pexpect
from pymavlink import mavutil, mav... | gpl-3.0 |
hawkowl/towncrier | src/towncrier/test/test_write.py | 1 | 5561 | # Copyright (c) Amber Brown, 2015
# See LICENSE for details.
from twisted.trial.unittest import TestCase
import pkg_resources
import os
from collections import OrderedDict
from .._builder import render_fragments, split_fragments
from .._writer import append_to_newsfile
class WritingTests(TestCase):
def test_a... | mit |
google/playhvz | web/tests/notifications1.py | 1 | 3530 | #!/usr/bin/python
#
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | apache-2.0 |
tvall43/odroid-w_kernel | tools/perf/scripts/python/export-to-postgresql.py | 617 | 16128 | # export-to-postgresql.py: export perf data to a postgresql database
# Copyright (c) 2014, Intel Corporation.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU General Public License,
# version 2, as published by the Free Software Foundation.
#
# Thi... | gpl-2.0 |
chirilo/kuma | vendor/packages/git/blob.py | 32 | 5305 | # blob.py
# Copyright (C) 2008-2010 Michael Trier (mtrier@gmail.com) and contributors
#
# This module is part of GitPython and is released under
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
import mimetypes
import os
import re
import time
from actor import Actor
from commit import Commit
clas... | mpl-2.0 |
kastnerkyle/minet | minet/optimizers.py | 2 | 2966 | # Authors: Kyle Kastner
# License: BSD 3-clause
import theano.tensor as T
import numpy as np
import theano
class rmsprop(object):
"""
RMSProp with nesterov momentum and gradient rescaling
"""
def __init__(self, params):
self.running_square_ = [theano.shared(np.zeros_like(p.get_value()))
... | bsd-3-clause |
landlab/landlab | tests/utils/test_source_tracking_algorithm.py | 3 | 3637 | # -*- coding: utf-8 -*-
"""
Unit tests for source_tracking_algorithm.py
@author: Sai Nudurupati & Erkan Istanbulluoglu
"""
import numpy as np
import pytest
from landlab import RasterModelGrid
from landlab.components import FlowAccumulator
from landlab.utils import find_unique_upstream_hsd_ids_and_fractions, track_sou... | mit |
huahbo/pyamg | pyamg/krylov/_cgne.py | 2 | 7042 | from numpy import inner, ceil, asmatrix, mod
from scipy.sparse import isspmatrix
from scipy.sparse.sputils import upcast
from scipy.sparse.linalg.isolve.utils import make_system
from scipy.sparse.linalg.interface import aslinearoperator
from warnings import warn
from pyamg.util.linalg import norm
__docformat__ = "rest... | mit |
mohierf/shinken | shinken/action.py | 3 | 14645 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2009-2017:
# Gabes Jean, naparuba@gmail.com
# Gerhard Lausser, Gerhard.Lausser@consol.de
# Gregory Starck, g.starck@gmail.com
# Hartmut Goebel, h.goebel@goebel-consult.de
#
# This file is part of Shinken.
#
# Shinken is free software: you can r... | agpl-3.0 |
fluks/youtube-dl | youtube_dl/extractor/firedrive.py | 31 | 2604 | # coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import (
compat_urllib_parse,
compat_urllib_request,
)
from ..utils import (
ExtractorError,
)
class FiredriveIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?firedrive\.com/' + \
... | unlicense |
M4sse/chromium.src | tools/crx_id/PRESUBMIT.py | 129 | 1038 | # 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.
"""Presubmit script for crx_id.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for
details on the presubmit API built into ... | bsd-3-clause |
easyw/kicad-3d-models-in-freecad | cadquery/FCAD_script_generator/Battery/main_generator.py | 1 | 14313 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# This is derived from a cadquery script for generating Converter_DCDC 3D format
#
# from https://bitbucket.org/hyOzd/freecad-macros
# author hyOzd
# This is a
# Dimensions are from Microchips Packaging Specification document:
# DS00000049BY. Body drawing is the same as QFP g... | gpl-2.0 |
criccomini/airflow | tests/contrib/operators/test_mlengine_operator_utils.py | 16 | 7713 | # 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 |
YongMan/Xen-4.3.1 | tools/python/xen/xend/XendPBD.py | 48 | 2954 | #============================================================================
# This library is free software; you can redistribute it and/or
# modify it under the terms of version 2.1 of the GNU Lesser General Public
# License as published by the Free Software Foundation.
#
# This library is distributed in the hope th... | gpl-2.0 |
yavuzovski/playground | python/django/RESTTest/.venv/lib/python3.4/site-packages/django/contrib/gis/utils/srs.py | 94 | 3041 | from django.contrib.gis.gdal import SpatialReference
from django.db import DEFAULT_DB_ALIAS, connections
def add_srs_entry(srs, auth_name='EPSG', auth_srid=None, ref_sys_name=None,
database=None):
"""
This function takes a GDAL SpatialReference system and adds its information
to the `spa... | gpl-3.0 |
chatcannon/numpy | numpy/f2py/tests/test_parameter.py | 27 | 3970 | from __future__ import division, absolute_import, print_function
import os
import math
import numpy as np
from numpy.testing import run_module_suite, dec, assert_raises, assert_equal
import util
def _path(*a):
return os.path.join(*((os.path.dirname(__file__),) + a))
class TestParameters(util.F2PyTest):
#... | bsd-3-clause |
bcousson/impressive | impressive.py | 1 | 244069 | #!/usr/bin/env python
# -*- coding: iso-8859-1 -*-
#
# Impressive, a fancy presentation tool
# Copyright (C) 2005-2014 Martin J. Fiedler <martin.fiedler@gmx.net>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, version 2, as
# published by ... | gpl-2.0 |
atdaemon/pip | tests/lib/path.py | 56 | 6574 | # flake8: noqa
# -*- coding: utf-8 -*-
# Author: Aziz Köksal
from __future__ import absolute_import
import glob
import os
import sys
import shutil
try:
from os import supports_fd
except ImportError:
supports_fd = set()
if sys.version_info >= (3,):
unicode = str
u = str
else:
unicode = unicode
... | mit |
superchilli/webapp | venv/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/dom.py | 435 | 8835 | from __future__ import absolute_import, division, unicode_literals
from collections import MutableMapping
from xml.dom import minidom, Node
import weakref
from . import base
from .. import constants
from ..constants import namespaces
from .._utils import moduleFactoryFactory
def getDomBuilder(DomImplementation):
... | mit |
albertomurillo/ansible | test/units/modules/storage/netapp/test_na_ontap_nvme.py | 38 | 8038 | # (c) 2018, NetApp, Inc
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
''' unit tests ONTAP Ansible module: na_ontap_nvme'''
from __future__ import print_function
import json
import pytest
from units.compat import unittest
from units.compat.mock import patch
from ansible... | gpl-3.0 |
closeio/nylas | inbox/models/secret.py | 3 | 1495 | from sqlalchemy import Column, Enum, Integer
from sqlalchemy.types import BLOB
from sqlalchemy.orm import validates
from inbox.models.base import MailSyncBase
from inbox.models.mixins import UpdatedAtMixin, DeletedAtMixin
from inbox.security.oracles import get_encryption_oracle, get_decryption_oracle
class Secret(Ma... | agpl-3.0 |
bygreencn/DIGITS | digits/frameworks/torch_framework.py | 3 | 6741 | # Copyright (c) 2015-2016, NVIDIA CORPORATION. All rights reserved.
from __future__ import absolute_import
import os
import re
import subprocess
import time
import tempfile
import flask
from .errors import Error, NetworkVisualizationError, BadNetworkError
from .framework import Framework
import digits
from digits i... | bsd-3-clause |
numba/numba | numba/tests/test_npdatetime.py | 7 | 30503 | """
Test np.datetime64 and np.timedelta64 support.
"""
# NOTE: datetime64 and timedelta64 ufuncs are tested in test_ufuncs.
import contextlib
import itertools
import warnings
import numpy as np
import unittest
from numba import jit, vectorize, njit
from numba.np.numpy_support import numpy_version
from numba.core i... | bsd-2-clause |
switchboardOp/ansible | lib/ansible/modules/network/cloudengine/ce_acl.py | 26 | 36273 | #!/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 |
nyasara/azuremono-docker | IronPython-2.7.4/Lib/sre_parse.py | 54 | 27588 | #
# Secret Labs' Regular Expression Engine
#
# convert re-style regular expression to sre pattern
#
# Copyright (c) 1998-2001 by Secret Labs AB. All rights reserved.
#
# See the sre.py file for information on usage and redistribution.
#
"""Internal support module for sre"""
# XXX: show string offset and ... | mit |
sallaire/Sick-Beard | sickbeard/scene_exceptions.py | 30 | 6977 | # Author: Nic Wolfe <nic@wolfeden.ca>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of Sick Beard.
#
# Sick Beard is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the Lice... | gpl-3.0 |
indico/indico | indico/vendor/django_mail/utils.py | 4 | 1070 | # This file is part of Indico.
# Copyright (C) 2002 - 2021 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
# The code in here is taken almost verbatim from `django.core.mail.utils`,
# which is licensed under the t... | mit |
BT-astauder/odoo | openerp/addons/base/res/res_font.py | 322 | 7559 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2013 OpenERP SA (<http://openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | agpl-3.0 |
jakesyl/BitTornado | BitTornado/tests/test_selectpoll.py | 2 | 1392 | import unittest
from BitTornado.Network.selectpoll import remove, insert
class PollListTests(unittest.TestCase):
def test_remove(self):
x = [2, 4, 6]
remove(x, 2)
self.assertEqual(x, [4, 6])
x = [2, 4, 6]
remove(x, 4)
self.assertEqual(x, [2, 6])
x = [2, 4, ... | mit |
CSE3320/kernel-code | linux-5.8/drivers/staging/comedi/drivers/ni_routing/tools/ni_names.py | 548 | 1448 | # SPDX-License-Identifier: GPL-2.0+
# vim: ts=2:sw=2:et:tw=80:nowrap
"""
This file helps to extract string names of NI signals as included in comedi.h
between NI_NAMES_BASE and NI_NAMES_BASE+NI_NUM_NAMES.
"""
# This is simply to aide in creating the entries in the order of the value of
# the device-global NI signal/te... | gpl-2.0 |
markusressel/raspyrfm-client | raspyrfm_client/device_implementations/controlunit/manufacturer/pollin_electronic/Set2605.py | 1 | 1480 | from raspyrfm_client.device_implementations.controlunit.actions import Action
from raspyrfm_client.device_implementations.controlunit.manufacturer.universal.HX2262Compatible import HX2262Compatible
class Set2605(HX2262Compatible):
_h = '0'
_l = 'f'
_on = [_l, _l]
_off = [_l, _h]
_repetitions = 5
... | gpl-3.0 |
srajag/nova | nova/db/api.py | 1 | 66200 | # Copyright (c) 2011 X.commerce, a business unit of eBay Inc.
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file... | apache-2.0 |
armyofevilrobots/reticulatus | test/test_lexer.py | 1 | 1865 | """Test lexer"""
from reticulatus.toolpath.parser import lexer, tokens
import os
import unittest
GCODE = """; Comment...
N0001 G91
N0002 G02 X0 Y0.001
N0003 G01 F10 X0Y0Z-0.01
"""
with open(os.path.join(os.path.dirname(__file__),
'data', '20mmbox.gcode'), 'r') as fp:
GCODELARGE = fp.read()
with open(os.path... | gpl-3.0 |
ITCase/pyramid_sacrud | pyramid_sacrud/common.py | 3 | 1107 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2014 uralbash <root@uralbash.ru>
#
# Distributed under terms of the MIT license.
"""
Any helpers for Pyramid
"""
try:
from types import BooleanType as bool # noqa
except ImportError:
pass
def _silent_none(value):
'''
>>>... | mit |
shakamunyi/tensorflow | tensorflow/tools/test/run_and_gather_logs.py | 137 | 4918 | # 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 |
antonve/s4-project-mooc | common/lib/xmodule/xmodule/modulestore/split_mongo/split_mongo_kvs.py | 24 | 5572 | import copy
from contracts import contract, new_contract
from xblock.fields import Scope
from collections import namedtuple
from xblock.exceptions import InvalidScopeError
from .definition_lazy_loader import DefinitionLazyLoader
from xmodule.modulestore.inheritance import InheritanceKeyValueStore
from opaque_keys.edx.l... | agpl-3.0 |
guettli/django | tests/test_client/views.py | 1 | 11063 | from xml.dom.minidom import parseString
from django.contrib.auth.decorators import login_required, permission_required
from django.core import mail
from django.forms import fields
from django.forms.forms import Form, ValidationError
from django.forms.formsets import BaseFormSet, formset_factory
from django.http import... | bsd-3-clause |
anshumang/lammps-analytics | tools/eff/lmp2radii_col.py | 54 | 3374 | #!/usr/local/bin/python-2.5/bin/python
Info="""
Module name: lmp2radii-column.py
Author: (c) Andres Jaramillo-Botero
California Institute of Technology
ajaramil@wag.caltech.edu
Project: pEFF
Version: August 2009
Extracts the electron radii from a lammps trajectory dump of style custom:
dump 1 all custom period ... | gpl-2.0 |
abutcher/openshift-ansible | roles/openshift_health_checker/openshift_checks/logging/kibana.py | 39 | 9211 | """
Module for performing checks on a Kibana logging deployment
"""
import json
import ssl
# pylint can't find the package when its installed in virtualenv
# pylint: disable=import-error,no-name-in-module
from ansible.module_utils.six.moves.urllib import request
# pylint: disable=import-error,no-name-in-module
from a... | apache-2.0 |
st135yle/django-site | dbenv/lib/python3.4/site-packages/setuptools/command/install_egg_info.py | 412 | 2203 | from distutils import log, dir_util
import os
from setuptools import Command
from setuptools import namespaces
from setuptools.archive_util import unpack_archive
import pkg_resources
class install_egg_info(namespaces.Installer, Command):
"""Install an .egg-info directory for the package"""
description = "In... | mit |
CatsAndDogsbvba/odoo | addons/project_issue/__openerp__.py | 260 | 2329 | # -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
# This program is free software: you can redistribute it and/or modify
# ... | agpl-3.0 |
zjuwangg/scrapy | scrapy/utils/url.py | 89 | 4183 | """
This module contains general purpose URL functions not found in the standard
library.
Some of the functions that used to be imported from this module have been moved
to the w3lib.url module. Always import those from there instead.
"""
import posixpath
from six.moves.urllib.parse import (ParseResult, urlunparse, ur... | bsd-3-clause |
ibethune/lammps | tools/moltemplate/moltemplate/lttree_check.py | 3 | 144120 | #!/usr/bin/env python
# Author: Andrew Jewett (jewett.aij at g mail)
# http://www.moltemplate.org
# http://www.chem.ucsb.edu/~sheagroup
# License: 3-clause BSD License (See LICENSE.TXT)
# Copyright (c) 2011, Regents of the University of California
# All rights reserved.
"""
lttree_check.py
The origi... | gpl-2.0 |
charithag/iot-server-samples | utils/Arduino Lib/pubsubclient-master/tests/testcases/mqtt_basic.py | 11 | 1227 | import unittest
import settings
import time
import mosquitto
def on_message(mosq, obj, msg):
obj.message_queue.append(msg)
class mqtt_basic(unittest.TestCase):
message_queue = []
@classmethod
def setUpClass(self):
self.client = mosquitto.Mosquitto("pubsubclient_ut", clean_session=True, obj... | apache-2.0 |
jessstrap/servotk | tests/wpt/css-tests/tools/py/testing/path/test_cacheutil.py | 163 | 2949 | import py
from py._path import cacheutil
class BasicCacheAPITest:
cache = None
def test_getorbuild(self):
val = self.cache.getorbuild(-42, lambda: 42)
assert val == 42
val = self.cache.getorbuild(-42, lambda: 23)
assert val == 42
def test_cache_get_key_error(self):
... | mpl-2.0 |
AbdealiJK/coala | coalib/parsing/CliParsing.py | 8 | 3878 | import os
import sys
from collections import OrderedDict
from coalib.parsing.DefaultArgParser import default_arg_parser
from coalib.parsing.LineParser import LineParser
from coalib.settings.Section import Section, append_to_sections
def parse_cli(arg_list=None,
origin=os.getcwd(),
arg_par... | agpl-3.0 |
daherk2/authomatic | authomatic/providers/oauth1.py | 14 | 38270 | # -*- coding: utf-8 -*-
"""
|oauth1| Providers
--------------------
Providers which implement the |oauth1|_ protocol.
.. autosummary::
OAuth1
Bitbucket
Flickr
Meetup
Plurk
Twitter
Tumblr
UbuntuOne
Vimeo
Xero
Xing
Yahoo
"""
import abc
import authomatic.core as... | mit |
cuongnv23/ansible | lib/ansible/modules/network/vyos/vyos_config.py | 7 | 8716 | #!/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 |
liavkoren/djangoDev | django/contrib/auth/tests/test_handlers.py | 88 | 2999 | from __future__ import unicode_literals
from django.contrib.auth.handlers.modwsgi import check_password, groups_for_user
from django.contrib.auth.models import User, Group
from django.contrib.auth.tests.custom_user import CustomUser
from django.contrib.auth.tests.utils import skipIfCustomUser
from django.test import T... | bsd-3-clause |
prospwro/odoo | addons/irsid_edu_grading/report/edu_order_line.py | 3 | 1921 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2009-2013 IRSID (<http://irsid.ru>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Af... | agpl-3.0 |
varesa/pyactiveresource | pyactiveresource/fake_connection.py | 5 | 3621 | # Copyright 2008 Google Inc. All Rights Reserved.
"""A fake HTTP connection for testing"""
__author__ = 'Mark Roach (mrroach@google.com)'
from six.moves import urllib
from pyactiveresource import connection
from pyactiveresource import formats
class Error(Exception):
"""The base exception class for this module.... | mit |
mosesfistos1/beetbox | beetsplug/importfeeds.py | 11 | 5218 | # -*- coding: utf-8 -*-
# This file is part of beets.
# Copyright 2016, Fabrice Laporte.
#
# 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 ... | mit |
varuntiwari27/rally | tests/unit/plugins/openstack/cleanup/test_manager.py | 5 | 19008 | # Copyright 2014: Mirantis 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 b... | apache-2.0 |
mganeva/mantid | Testing/SystemTests/tests/analysis/SpaceGroupFactoryTest.py | 1 | 4242 | # Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
# NScD Oak Ridge National Laboratory, European Spallation Source
# & Institut Laue - Langevin
# SPDX - License - Identifier: GPL - 3.0 +
# pylint: disable=no-init
from __future__ imp... | gpl-3.0 |
lewisodriscoll/sasview | src/sas/sasgui/perspectives/calculator/model_editor.py | 1 | 46726 | '''
This module provides three model editor classes: the composite model editor,
the easy editor which provides a simple interface with tooltip help to enter
the parameters of the model and their default value and a panel to input a
function of y (usually the intensity). It also provides a drop down of
standard availa... | bsd-3-clause |
kjw0106/GCM_app_server | venv/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/lint.py | 250 | 4062 | from __future__ import absolute_import, division, unicode_literals
from gettext import gettext
_ = gettext
from . import _base
from ..constants import cdataElements, rcdataElements, voidElements
from ..constants import spaceCharacters
spaceCharacters = "".join(spaceCharacters)
class LintError(Exception):
pass
... | mit |
thonkify/thonkify | src/lib/libpasteurize/fixes/feature_base.py | 1 | 1727 | u"""
Base classes for features that are backwards-incompatible.
Usage:
features = Features()
features.add(Feature("py3k_feature", "power< 'py3k' any* >", "2.7"))
PATTERN = features.PATTERN
"""
pattern_unformatted = u"%s=%s" # name=pattern, for dict lookups
message_unformatted = u"""
%s is only supported in Python %s... | mit |
cogbio/Experimenter | ExptModule/Validator_classes.py | 1 | 6189 | '''
Validator_classes.py
This is a module for Experimenter to validate a value in a TextCtrl
widget.
----------------------------------------------------------------------
Copyright (C) 2014 Jinook Oh, W. Tecumseh Fitch for ERC Advanced Grant
SOMACCA # 230604
- Contact: jinook.oh@univie.ac.at, tecumseh.fitch@uni... | gpl-3.0 |
jgoclawski/django | tests/runtests.py | 32 | 16387 | #!/usr/bin/env python
import logging
import os
import shutil
import subprocess
import sys
import tempfile
import warnings
from argparse import ArgumentParser
import django
from django.apps import apps
from django.conf import settings
from django.db import connection
from django.test import TestCase, TransactionTestCas... | bsd-3-clause |
sankroh/satchmo | satchmo/payment/listeners.py | 2 | 1321 | from django.core import urlresolvers
from django import forms
import logging
from django.utils.translation import ugettext, ugettext_lazy as _
log = logging.getLogger('payment.listeners')
def form_terms_listener(sender, form=None, **kwargs):
"""Adds a 'do you accept the terms and conditions' checkbox to the form"... | bsd-3-clause |
maloep/romcollectionbrowser | resources/tests/test_scrapers_webscraper.py | 1 | 2445 | import os
import sys
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..', 'resources', 'lib'))
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'resources', 'lib', 'pyscraper'))
import unittest
from thegamesdb_scraper import TheGamesDB_Scraper
from giantbomb_scraper import GiantBo... | gpl-2.0 |
quinot/ansible | test/units/utils/test_shlex.py | 197 | 1290 | # (c) 2015, Marius Gedminas <marius@gedmin.as>
#
# 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 vers... | gpl-3.0 |
lshain-android-source/tools-idea | plugins/hg4idea/testData/bin/mercurial/treediscovery.py | 93 | 5172 | # discovery.py - protocol changeset discovery functions
#
# Copyright 2010 Matt Mackall <mpm@selenic.com>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
from node import nullid, short
from i18n import _
import util, error
def fi... | apache-2.0 |
liqd/a4-meinberlin | tests/extprojects/dashboard_components/test_views_extproject_plans.py | 1 | 1967 | import pytest
from adhocracy4.dashboard import components
from adhocracy4.test.helpers import redirect_target
from meinberlin.test.helpers import assert_dashboard_form_component_response
from meinberlin.test.helpers import setup_group_member
component = components.projects.get('plans')
@pytest.mark.django_db
def te... | agpl-3.0 |
goodwinnk/intellij-community | python/lib/Lib/encodings/mac_cyrillic.py | 593 | 13710 | """ Python Character Mapping Codec mac_cyrillic generated from 'MAPPINGS/VENDORS/APPLE/CYRILLIC.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,inp... | apache-2.0 |
2014cdag2/w17x1 | static/Brython3.1.3-20150514-095342/Lib/xml/etree/ElementInclude.py | 784 | 5146 | #
# ElementTree
# $Id: ElementInclude.py 3375 2008-02-13 08:05:08Z fredrik $
#
# limited xinclude support for element trees
#
# history:
# 2003-08-15 fl created
# 2003-11-14 fl fixed default loader
#
# Copyright (c) 2003-2004 by Fredrik Lundh. All rights reserved.
#
# fredrik@pythonware.com
# http://www.pythonware... | agpl-3.0 |
idlesign/torrt | torrt/base_tracker.py | 1 | 16560 | import re
from datetime import datetime
from http.cookiejar import CookieJar
from itertools import chain
from locale import getlocale, setlocale, LC_ALL
from typing import List, Optional, Union
from urllib.parse import urlparse, urljoin, parse_qs
from .exceptions import TorrtTrackerException
from .utils import (
p... | bsd-3-clause |
Conjuror/fxos-certsuite | mcts/web-platform-tests/tests/conformance-checkers/html/elements/picture/build.py | 7 | 28161 | # -*- coding: utf-8 -*-
template = """<!DOCTYPE html>
<meta charset=utf-8>
"""
errors = {
# missing src on img
"img-no-src": "<img alt>",
"img-no-src-with-srcset": "<img srcset=x alt>",
"img-no-src-with-picture": "<picture><img alt></picture>",
"img-no-src-with-srcset-and-picture": "<picture><img srcset=x al... | mpl-2.0 |
gasman/pyrecoil | setup.py | 1 | 1164 | from setuptools import setup, find_packages, Extension
recoil_module = Extension('_recoil', sources=['recoil_interface.c', 'recoil.c'])
def readme():
with open('README.rst') as f:
return f.read()
setup(
name="pyrecoil",
version="0.3.1",
packages=find_packages(),
ext_modules=[recoil_module... | gpl-2.0 |
damirda/ansible-modules-core | cloud/amazon/ec2_eip.py | 23 | 14580 | #!/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 distributed... | gpl-3.0 |
raj454raj/eden | modules/templates/custom/NZRC/menus.py | 5 | 20940 | # -*- coding: utf-8 -*-
from gluon import current
from s3 import *
from s3layouts import *
try:
from .layouts import *
except ImportError:
pass
import s3menus as default
# =============================================================================
class S3MainMenu(default.S3MainMenu):
""" Custom Applica... | mit |
0k/odoo | addons/account_followup/__openerp__.py | 52 | 3009 | # -*- 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 |
crossbridge-community/avmplus | gtest/gtest-1.6.0/test/gtest_break_on_failure_unittest.py | 1050 | 7214 | #!/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... | mpl-2.0 |
eyohansa/django | django/db/models/fields/related_lookups.py | 287 | 6153 | from django.db.models.lookups import (
Exact, GreaterThan, GreaterThanOrEqual, In, LessThan, LessThanOrEqual,
)
class MultiColSource(object):
contains_aggregate = False
def __init__(self, alias, targets, sources, field):
self.targets, self.sources, self.field, self.alias = targets, sources, field... | bsd-3-clause |
hep7agon/city-feedback-hub | api/tests/test_analysis.py | 1 | 1100 | from django.test import TestCase
from api.analysis import calc_fixing_time
from api.tests.db_utils import clear_db, insert_feedbacks_for_estimation
class EstimationTimeTestCase(TestCase):
@classmethod
def setUpClass(cls):
clear_db()
insert_feedbacks_for_estimation()
@classmethod
def ... | mit |
batmancn/TinySDNController | jsoncpp/scons-tools/srcdist.py | 16 | 5427 | # Copyright 2007 Baptiste Lepilleur
# Distributed under MIT license, or public domain if desired and
# recognized in your jurisdiction.
# See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
import os
import os.path
from fnmatch import fnmatch
import targz
##def DoxyfileParse(file_contents):
... | apache-2.0 |
deadly11ama/werkzeug | tests/test_exceptions.py | 26 | 2521 | # -*- coding: utf-8 -*-
"""
tests.exceptions
~~~~~~~~~~~~~~~~
The tests for the exception classes.
TODO:
- This is undertested. HTML is never checked
:copyright: (c) 2014 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import pytest
from werkzeug import exceptions... | bsd-3-clause |
jellysheep/pyload | module/lib/jinja2/ext.py | 64 | 23899 | # -*- coding: utf-8 -*-
"""
jinja2.ext
~~~~~~~~~~
Jinja extensions allow to add custom tags similar to the way django custom
tags work. By default two example extensions exist: an i18n and a cache
extension.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD.
"""
from collections impor... | gpl-3.0 |
khushboo9293/mailman3 | src/mailman/runners/tests/test_confirm.py | 7 | 10549 | # Copyright (C) 2012-2015 by the Free Software Foundation, Inc.
#
# This file is part of GNU Mailman.
#
# GNU Mailman 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 you... | gpl-2.0 |
transcode-de/hopper | form_data/models.py | 1 | 2436 | # encoding: utf-8
from __future__ import unicode_literals
import json
from django.conf import settings
from django_pgjson.fields import JsonField
from django.db import models
from django.dispatch import receiver
from django.utils.encoding import python_2_unicode_compatible
from django.utils.timezone import now
from ... | bsd-3-clause |
gangadhar-kadam/sapphire_app | setup/doctype/company/charts/import_from_openerp.py | 1 | 4355 | # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
"""
Import chart of accounts from OpenERP sources
"""
from __future__ import unicode_literals
import os, json
from xml.etree import ElementTree as ET
from webnotes.utils.datautils import read_csv_content
f... | agpl-3.0 |
Suninus/NewsBlur | apps/rss_feeds/migrations/0024_active_subscribers.py | 18 | 9679 | # encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Feed.active_subscribers'
db.add_column('feeds', 'active_subscribers', self.gf('django.db.m... | mit |
drnextgis/QGIS | python/ext-libs/nose2/tests/unit/test_doctest_plugin.py | 13 | 2190 | """Test doctests plugin."""
import doctest
from nose2 import events, loader, session
from nose2.plugins import doctests
from nose2.tests._common import TestCase
class UnitTestDocTestLoader(TestCase):
"""Test class DocTestLoader."""
tags = ['unit']
_RUN_IN_TEMP = True
def setUp(self):
self.... | gpl-2.0 |
ThunderShiviah/kaggle_directory_template | data_io.py | 6 | 1319 | import csv
import json
import numpy as np
import os
import pandas as pd
import pickle
def get_paths():
paths = json.loads(open("Settings.json").read())
for key in paths:
paths[key] = os.path.expandvars(paths[key])
return paths
def identity(x):
return x
# For pandas >= 10.1 this will trigger t... | bsd-2-clause |
jimmsta/namebench-1 | libnamebench/data_sources.py | 173 | 15580 | #!/usr/bin/env python
# Copyright 2009 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... | apache-2.0 |
nttks/edx-platform | lms/djangoapps/discussion_api/tests/test_pagination.py | 113 | 1841 | """
Tests for Discussion API pagination support
"""
from unittest import TestCase
from django.test import RequestFactory
from discussion_api.pagination import get_paginated_data
class PaginationSerializerTest(TestCase):
"""Tests for PaginationSerializer"""
def do_case(self, objects, page_num, num_pages, exp... | agpl-3.0 |
jamesblunt/edx-platform | openedx/core/djangoapps/user_api/tests/test_middleware.py | 152 | 4415 | """Tests for user API middleware"""
from mock import Mock, patch
from unittest import TestCase
from django.http import HttpResponse
from django.test.client import RequestFactory
from student.tests.factories import UserFactory, AnonymousUserFactory
from ..tests.factories import UserCourseTagFactory
from ..middleware ... | agpl-3.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.