repo_name stringlengths 6 100 | path stringlengths 4 294 | copies stringlengths 1 5 | size stringlengths 4 6 | content stringlengths 606 896k | license stringclasses 15
values |
|---|---|---|---|---|---|
elkingtonmcb/h2o-2 | py/testdir_multi_jvm/test_KMeans_covtype_cols_fvec.py | 9 | 3499 | import unittest
import random, sys, time, os
sys.path.extend(['.','..','../..','py'])
import h2o, h2o_cmd, h2o_browse as h2b, h2o_import as h2i, h2o_kmeans
class Basic(unittest.TestCase):
def tearDown(self):
h2o.check_sandbox_for_errors()
@classmethod
def setUpClass(cls):
global SEED
... | apache-2.0 |
frishberg/django | django/test/utils.py | 16 | 29659 | import collections
import logging
import re
import sys
import time
import warnings
from contextlib import contextmanager
from functools import wraps
from unittest import TestCase, skipIf, skipUnless
from xml.dom.minidom import Node, parseString
from django.apps import apps
from django.apps.registry import Apps
from dj... | bsd-3-clause |
endlessm/chromium-browser | third_party/webrtc/tools_webrtc/vim/webrtc.ycm_extra_conf.py | 5 | 12354 | # Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All contributing project au... | bsd-3-clause |
helena/cassandra | pylib/cqlshlib/test/test_cqlsh_parsing.py | 86 | 1038 | # 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 |
Neitsch/ASE4156 | authentication/graphql.py | 1 | 9125 | """
GraphQL definitions for the Authentication App
"""
import datetime
from django.contrib.auth.models import User
from graphene import Argument, Field, Float, Int, List, Mutation, \
NonNull, String, relay
from graphene_django import DjangoObjectType, DjangoConnectionField
from trading.models import TradingAccount
... | apache-2.0 |
GaussDing/django | tests/prefetch_related/models.py | 42 | 7041 | from django.contrib.contenttypes.fields import (
GenericForeignKey, GenericRelation,
)
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
# Basic tests
@python_2_unicode_compatible
class Author(models.Model):
n... | bsd-3-clause |
Carralex/landlab | landlab/utils/jaggedarray_ma.py | 6 | 9168 | """Store arrays of variable-length arrays implemented with masked arrays.
Implements a JaggedArray class using numpy masked arrays.
Examples
--------
Create a JaggedArray that stores link IDs for the links attached to the
nodes of a 3x3 grid.
>>> from landlab.utils.jaggedarray_ma import JaggedArray
>>> links_at_nod... | mit |
slozier/ironpython2 | Src/StdLib/Lib/test/test_dbm.py | 136 | 1266 | from test import test_support
import unittest
dbm = test_support.import_module('dbm')
class DbmTestCase(unittest.TestCase):
def setUp(self):
self.filename = test_support.TESTFN
self.d = dbm.open(self.filename, 'c')
self.d.close()
def tearDown(self):
for suffix in ['', '.pag', ... | apache-2.0 |
zifeo/nest-simulator | topology/pynest/tests/test_plotting.py | 13 | 4111 | # -*- coding: utf-8 -*-
#
# test_plotting.py
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST 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, ... | gpl-2.0 |
Belxjander/Kirito | Python-3.5.0-main/Lib/_strptime.py | 9 | 21698 | """Strptime-related classes and functions.
CLASSES:
LocaleTime -- Discovers and stores locale-specific time information
TimeRE -- Creates regexes for pattern matching a string of text containing
time information
FUNCTIONS:
_getlang -- Figure out what language is being used for the locale
... | gpl-3.0 |
Facetracker-project/facetracker-core | lib/youtube-dl/youtube_dl/extractor/criterion.py | 138 | 1359 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import re
from .common import InfoExtractor
class CriterionIE(InfoExtractor):
_VALID_URL = r'https?://www\.criterion\.com/films/(?P<id>[0-9]+)-.+'
_TEST = {
'url': 'http://www.criterion.com/films/184-le-samourai',
'md5': 'bc51be... | gpl-2.0 |
open-synergy/social | mail_tracking/models/ir_mail_server.py | 2 | 4093 | # -*- coding: utf-8 -*-
# © 2016 Antonio Espinosa - <antonio.espinosa@tecnativa.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import re
import threading
from openerp import models, api, tools
class IrMailServer(models.Model):
_inherit = "ir.mail_server"
def _tracking_headers_add(... | agpl-3.0 |
niphlod/pydal | pydal/adapters/oracle.py | 1 | 5716 | import re
import sys
from .._compat import integer_types, long
from ..helpers.classes import Reference
from .base import SQLAdapter
from . import adapters, with_connection_or_raise
@adapters.register_for('')
class Oracle(SQLAdapter):
dbengine = 'oracle'
drivers = ('cx_Oracle',)
cmd_fix = re.compile(
... | bsd-3-clause |
Shaps/ansible | lib/ansible/utils/plugin_docs.py | 28 | 6674 | # Copyright: (c) 2012, Jan-Piet Mens <jpmens () gmail.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
from ansible import constants as C
from ansible.release import __version__ as ... | gpl-3.0 |
ldong/vim_youcompleteme | third_party/requests/requests/packages/charade/langbulgarianmodel.py | 172 | 13013 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is Mozilla Communicator client code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Ri... | gpl-3.0 |
jamiefolsom/edx-platform | lms/djangoapps/discussion_api/permissions.py | 79 | 2651 | """
Discussion API permission logic
"""
from lms.lib.comment_client.comment import Comment
from lms.lib.comment_client.thread import Thread
def _is_author(cc_content, context):
"""
Return True if the requester authored the given content, False otherwise
"""
return context["cc_requester"]["id"] == cc_c... | agpl-3.0 |
whbruce/upm | tests/check_examplenames.py | 12 | 2583 | #!/usr/bin/python
import unittest
import re, fnmatch, os, sys
# Example name map
sampleMappingFile = '../doxy/samples.mapping.txt'
# Example directories
sampledir = {}
sampledir['cxx'] = '../examples/c++/'
sampledir['java'] = '../examples/java/'
sampledir['js'] = '../examples/javascript/'
sampledir['py'] = '../exampl... | mit |
CitrusB/android_kernel_samsung_s6810p | tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Util.py | 12527 | 1935 | # Util.py - Python extension for perf script, miscellaneous utility code
#
# Copyright (C) 2010 by Tom Zanussi <tzanussi@gmail.com>
#
# This software may be distributed under the terms of the GNU General
# Public License ("GPL") version 2 as published by the Free Software
# Foundation.
import errno, os
FUTEX_WAIT = 0... | gpl-2.0 |
ipkn/crow | tests/template/test.py | 16 | 1097 | #!/usr/bin/env python
from __future__ import print_function
import glob
import json
import os
import subprocess
for testfile in glob.glob("*.json"):
testdoc = json.load(open(testfile))
for test in testdoc["tests"]:
if "lambda" in test["data"]:
continue
open('data', 'w').write(json.du... | bsd-3-clause |
opedroso/czmq | bindings/python_cffi/czmq_cffi/utils.py | 20 | 1731 | ################################################################################
# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY #
# Read the zproject/README.md for information about making permanent changes. #
#############################################################################... | mpl-2.0 |
ahamilton55/ansible | lib/ansible/modules/network/nxos/nxos_bgp_neighbor_af.py | 19 | 27536 | #!/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 |
andreasots/lrrbot | alembic/versions/a933db158324_drop_stats_votes.py | 2 | 3012 | revision = 'a933db158324'
down_revision = '7d1d0f735480'
branch_labels = None
depends_on = None
import alembic
import sqlalchemy
def upgrade():
alembic.op.drop_table("game_stats")
alembic.op.drop_table("game_votes")
alembic.op.drop_table("disabled_stats")
alembic.op.drop_table("stats")
def downgrade():
alembic.... | apache-2.0 |
thehyve/variant | eggs/django-1.3.1-py2.7.egg/django/core/context_processors.py | 151 | 3868 | """
A set of request processors that return dictionaries to be merged into a
template context. Each function takes the request object as its only parameter
and returns a dictionary to add to the context.
These are referenced from the setting TEMPLATE_CONTEXT_PROCESSORS and used by
RequestContext.
"""
from django.conf... | apache-2.0 |
alex/kombu | kombu/tests/transport/test_filesystem.py | 30 | 4288 | from __future__ import absolute_import
import sys
import tempfile
from kombu import Connection, Exchange, Queue, Consumer, Producer
from kombu.tests.case import Case, SkipTest
class test_FilesystemTransport(Case):
def setUp(self):
if sys.platform == 'win32':
raise SkipTest('Needs win32con ... | bsd-3-clause |
dchud/sentinel | bin/scripts/test-matplotlib-evidence.py | 1 | 5562 | #!/usr/bin/env python
from pylab import *
from canary.context import Context
from canary.loader import QueuedRecord
from canary.search import SearchIndex
from canary.study import Species, Study, Methodology
linkages = {
'rel': 'Relationships',
'inter': 'Interspecies',
'exp': 'Exposures',
'out': '... | mit |
caesar2164/edx-platform | openedx/core/djangoapps/self_paced/migrations/0001_initial.py | 86 | 1203 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operati... | agpl-3.0 |
mcku/elasticsearch | dev-tools/upgrade-tests.py | 118 | 15291 | # Licensed to Elasticsearch under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this file except... | apache-2.0 |
googleapis/googleapis-gen | google/cloud/recaptchaenterprise/v1/recaptchaenterprise-v1-py/google/cloud/recaptchaenterprise_v1/types/recaptchaenterprise.py | 1 | 16503 | # -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# 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... | apache-2.0 |
ayoubg/gem5-graphics | gem5/src/arch/x86/isa/insts/x87/transcendental_functions/trigonometric_functions.py | 62 | 2541 | # Copyright (c) 2007 The Hewlett-Packard Development Company
# Copyright (c) 2012-13 Mark D. Hill and David A. Wood
# 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 ... | bsd-3-clause |
OnroerendErfgoed/crabpy | tests/gateway/test_crab.py | 1 | 87963 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import six
import pytest
from mock import Mock
from crabpy.gateway.exception import (
GatewayRuntimeException,
GatewayResourceNotFoundException
)
from crabpy.gateway.crab import (
Gewest, Provincie,
Gemeente, Deelgemeente, Taal,
Bewe... | mit |
xguse/ete | doc/old_tutorial/examples/get_distances_between_nodes.py | 4 | 2475 | from ete_dev import Tree
# Loads a tree with branch lenght information. Note that if no
# distance info is provided in the newick, it will be initialized with
# the default dist value = 1.0
nw = """(((A:0.1, B:0.01):0.001, C:0.0001):1.0,
(((((D:0.00001:0,I:0):0,F:0):0,G:0):0,H:0):0,
E:0.000001):0.0000001):2.0;"""
t = ... | gpl-3.0 |
some-0n3/imgcls_utils | training.py | 1 | 21638 | """This module implements the training for lasagne models.
The classes are designed to train a lasagne model on a fixed data set
with different learning rates. The training schedule can be epoch or
iteration based.
The classes print the training and test error to the standard output
every epoch or in a given interval ... | mit |
LLNL/spack | var/spack/repos/builtin/packages/kallisto/package.py | 2 | 1805 | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Kallisto(CMakePackage):
"""kallisto is a program for quantifying abundances of transcripts... | lgpl-2.1 |
SUSE/azure-sdk-for-python | azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/resource_management_client.py | 2 | 5058 | # 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 |
QiJune/Paddle | python/paddle/fluid/concurrency.py | 1 | 15959 | # Copyright (c) 2018 PaddlePaddle 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 app... | apache-2.0 |
RichardWilliamPearse/namebench | tools/split_instance_in_csv.py | 174 | 1077 | #!/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 |
indictranstech/trufil-erpnext | erpnext/patches/v4_0/update_account_root_type.py | 90 | 1480 | # 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
def execute():
frappe.reload_doc("accounts", "doctype", "account")
account_table_columns = frappe.db.get_table_columns("Account")
if ... | agpl-3.0 |
tbeadle/django | django/utils/html.py | 56 | 14422 | """HTML utilities suitable for global use."""
from __future__ import unicode_literals
import re
from django.utils import six
from django.utils.encoding import force_str, force_text
from django.utils.functional import keep_lazy, keep_lazy_text
from django.utils.http import RFC3986_GENDELIMS, RFC3986_SUBDELIMS
from dj... | bsd-3-clause |
nikhilsaraf/Twitter-Analytics | venv/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/packages/six.py | 2375 | 11628 | """Utilities for writing code that runs on Python 2 and 3"""
#Copyright (c) 2010-2011 Benjamin Peterson
#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 l... | gpl-3.0 |
0x90sled/catapult | third_party/Paste/tests/test_exceptions/test_formatter.py | 47 | 4985 | from paste.exceptions import formatter
from paste.exceptions import collector
import sys
import os
import difflib
class Mock(object):
def __init__(self, **kw):
for name, value in kw.items():
setattr(self, name, value)
class Supplement(Mock):
object = 'test_object'
source_url = 'http:/... | bsd-3-clause |
gkarlin/django-jenkins | build/Django/tests/regressiontests/queryset_pickle/tests.py | 30 | 1689 | from __future__ import absolute_import
import pickle
import datetime
from django.test import TestCase
from .models import Group, Event, Happening
class PickleabilityTestCase(TestCase):
def assert_pickles(self, qs):
self.assertEqual(list(pickle.loads(pickle.dumps(qs))), list(qs))
def test_related_f... | lgpl-3.0 |
JioCloud/nova | nova/tests/unit/virt/xenapi/client/test_session.py | 20 | 6579 | # Copyright (c) 2014 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 |
BT-fgarbely/odoo | addons/product_visible_discount/__init__.py | 433 | 1054 | ##############################################################################
#
# 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 Affero General Public L... | agpl-3.0 |
jonnary/keystone | keystone/token/routers.py | 34 | 2709 | # Copyright 2012 OpenStack Foundation
#
# 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... | apache-2.0 |
40223240/2015cdb_w17_test | static/Brython3.1.1-20150328-091302/Lib/test/re_tests.py | 879 | 31796 | #!/usr/bin/env python3
# -*- mode: python -*-
# Re test suite and benchmark suite v1.5
# The 3 possible outcomes for each pattern
[SUCCEED, FAIL, SYNTAX_ERROR] = range(3)
# Benchmark suite (needs expansion)
#
# The benchmark suite does not test correctness, just speed. The
# first element of each tuple is the regex... | gpl-3.0 |
ryfeus/lambda-packs | LightGBM_sklearn_scipy_numpy/source/scipy/special/tests/test_precompute_gammainc.py | 10 | 4652 | from __future__ import division, print_function, absolute_import
import numpy as np
import pytest
from scipy.special._testutils import MissingModule, check_version
from scipy.special._mptestutils import (
Arg, IntArg, mp_assert_allclose, assert_mpmath_equal)
from scipy.special._precompute.gammainc_asy import (
... | mit |
agentr13/python-phonenumbers | python/phonenumbers/data/region_ZA.py | 11 | 2469 | """Auto-generated file, do not edit by hand. ZA metadata"""
from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata
PHONE_METADATA_ZA = PhoneMetadata(id='ZA', country_code=27, international_prefix='00',
general_desc=PhoneNumberDesc(national_number_pattern='[1-79]\\d{8}|8(?:[067]\\d{7}|[1-4]\\d{3,7... | apache-2.0 |
zhangxiaoli73/BigDL | pyspark/bigdl/models/ml_pipeline/dl_classifier.py | 6 | 6226 | from pyspark.ml.pipeline import Estimator, Model
from pyspark.ml.param.shared import *
from bigdl.util.common import *
if sys.version >= '3':
long = int
unicode = str
class HasBatchSize(Params):
"""
Mixin for param batchSize: batch size.
"""
# a placeholder to make it appear in the generate... | apache-2.0 |
rrooij/youtube-dl | youtube_dl/extractor/sohu.py | 50 | 6911 | # coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import (
compat_str,
compat_urllib_parse_urlencode,
)
from ..utils import (
ExtractorError,
int_or_none,
try_get,
)
class SohuIE(InfoExtractor):
_VALID_URL = r'https?://(?P<mytv>... | unlicense |
openfun/edx-platform | common/lib/capa/capa/tests/test_hint_functionality.py | 23 | 32238 | # -*- coding: utf-8 -*-
"""
Tests of extended hints
"""
import unittest
from ddt import ddt, data, unpack
# With the use of ddt, some of the data expected_string cases below are naturally long stretches
# of text text without whitespace. I think it's best to leave such lines intact
# in the test code. Therefore:
# ... | agpl-3.0 |
kcavagnolo/astroML | book_figures/chapter6/fig_great_wall_MST.py | 3 | 5216 | """
Euclidean Minimum Spanning Tree
-------------------------------
Figure 6.15
An approximate Euclidean minimum spanning tree over the two-dimensional
projection of the SDSS Great Wall. The upper panel shows the input points, and
the middle panel shows the dendrogram connecting them. The lower panel shows
clustering ... | bsd-2-clause |
sinuos/breakpad | src/tools/gyp/tools/pretty_sln.py | 137 | 4977 | #!/usr/bin/python2.5
# Copyright 2009 Google Inc.
# All Rights Reserved.
"""Prints the information in a sln file in a diffable way.
It first outputs each projects in alphabetical order with their
dependencies.
Then it outputs a possible build order.
"""
__author__ = 'nsylvain (Nicolas Sylvain)'
import os
... | bsd-3-clause |
napkindrawing/ansible | lib/ansible/modules/network/junos/junos_rpc.py | 23 | 4807 | #!/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 |
yashodhank/erpnext | erpnext/projects/report/daily_timesheet_summary/daily_timesheet_summary.py | 53 | 1922 | # Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.desk.reportview import build_match_conditions
def execute(filters=None):
if not filters:
filters = {}
elif f... | agpl-3.0 |
kuri65536/python-for-android | python-modules/twisted/twisted/internet/test/fakeendpoint.py | 49 | 1484 | # -*- test-case-name: twisted.internet.test.test_endpoints -*-
# Copyright (c) 2010 Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Fake client and server endpoint string parser plugins for testing purposes.
"""
from zope.interface.declarations import implements
from twisted.plugin import IPlugin
from twi... | apache-2.0 |
Wilbeibi/rethinkdb | external/v8_3.30.33.16/tools/push-to-trunk/script_test.py | 95 | 2294 | #!/usr/bin/env python
# Copyright 2014 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
# notice... | agpl-3.0 |
asen6/amartyasenguptadotcom | django/utils/dateformat.py | 234 | 8956 | """
PHP date() style date formatting
See http://www.php.net/date for format strings
Usage:
>>> import datetime
>>> d = datetime.datetime.now()
>>> df = DateFormat(d)
>>> print df.format('jS F Y H:i')
7th October 2003 11:39
>>>
"""
import re
import time
import calendar
from django.utils.dates import MONTHS, MONTHS_3, ... | bsd-3-clause |
ESOedX/edx-platform | lms/djangoapps/shoppingcart/context_processor.py | 19 | 1677 | """
This is the shoppingcart context_processor module.
Currently the only context_processor detects whether request.user has a cart that should be displayed in the
navigation. We want to do this in the context_processor to
1) keep database accesses out of templates (this led to a transaction bug with user email change... | agpl-3.0 |
schwarz/youtube-dl | youtube_dl/extractor/trilulilu.py | 109 | 2890 | # coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import ExtractorError
class TriluliluIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?trilulilu\.ro/(?:video-[^/]+/)?(?P<id>[^/#\?]+)'
_TEST = {
'url': 'http://www.trilulilu.ro/video-... | unlicense |
sspreitzer/tahoe-lafs | setuptools-0.6c16dev6.egg/setuptools/__init__.py | 5 | 3119 | """Extensions to the 'distutils' for large or complex distributions"""
from setuptools.extension import Extension, Library
from setuptools.dist import Distribution, Feature, _get_unpatched
import distutils.core, setuptools.command
from setuptools.depends import Require
from distutils.core import Command as _Command
fro... | gpl-2.0 |
gerald-yang/ubuntu-iotivity-demo | snappy/grovepi/python-env/local/lib/python2.7/encodings/unicode_internal.py | 827 | 1196 | """ Python 'unicode-internal' Codec
Written by Marc-Andre Lemburg (mal@lemburg.com).
(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
"""
import codecs
### Codec APIs
class Codec(codecs.Codec):
# Note: Binding these as C functions will result in the class not
# converting them to methods. This is in... | apache-2.0 |
ckc6cz/osf.io | scripts/dataverse/migrate_user_settings_field.py | 44 | 1267 | """
First run the following in a mongo shell:
db.getCollection('addondataversenodesettings').update({'user_settings': {'$type': 2}}, {$rename: { user_settings: 'foreign_user_settings'}}, {multi: true})
Then change the user_settings field of AddonDataverseNodeSettings to foreign_user_settings
"""
import sys
impor... | apache-2.0 |
preed/quickrelease | quickrelease/step.py | 1 | 12237 | # ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
r"""
The base class for QuickRelease steps, along with error reporting classes,
custom subclasses of steps, and classes to run the individual parts of the
steps.
L{Step}s are usually searched for in the C{quickrelease/steps} di... | mit |
lyfkevin/MIUIv5_iproj_kernel | Documentation/target/tcm_mod_builder.py | 3119 | 42754 | #!/usr/bin/python
# The TCM v4 multi-protocol fabric module generation script for drivers/target/$NEW_MOD
#
# Copyright (c) 2010 Rising Tide Systems
# Copyright (c) 2010 Linux-iSCSI.org
#
# Author: nab@kernel.org
#
import os, sys
import subprocess as sub
import string
import re
import optparse
tcm_dir = ""
fabric_ops... | gpl-2.0 |
wreckJ/intellij-community | python/helpers/pydev/pydevd_traceproperty.py | 53 | 3777 | '''For debug purpose we are replacing actual builtin property by the debug property
'''
from pydevd_comm import GetGlobalDebugger
from pydevd_constants import * #@UnusedWildImport
import pydevd_tracing
#====================================================================================================================... | apache-2.0 |
madscatt/sasmol | src/python/sasproperties.py | 1 | 31722 | '''
SASSIE: Copyright (C) 2011 Joseph E. Curtis, Ph.D.
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.
... | gpl-3.0 |
chrisdunelm/grpc | src/python/grpcio/grpc/framework/foundation/callable_util.py | 26 | 3151 | # Copyright 2015 gRPC 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 applicable law or agreed to in writing... | apache-2.0 |
page-io/Cactus | cactus/config/file.py | 9 | 1173 | #coding:utf-8
import json
import logging
logger = logging.getLogger(__name__)
class ConfigFile(object):
"""
A single config file, as present on the filesystem.
"""
_dirty = None
def __init__(self, path):
self.path = path
self.load()
def get(self, key, default=None):
... | bsd-3-clause |
shuggiefisher/crowdstock | django/contrib/gis/tests/test_measure.py | 231 | 8820 | """
Distance and Area objects to allow for sensible and convienient calculation
and conversions. Here are some tests.
"""
from django.contrib.gis.measure import Distance, Area, D, A
from django.utils import unittest
class DistanceTest(unittest.TestCase):
"Testing the Distance object"
def testInit(self):
... | bsd-3-clause |
highco-groupe/odoo | addons/project/report/project_report.py | 5 | 5630 | # -*- 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 |
johnkit/vtk-dev | Charts/Core/Testing/Python/TestLinePlot.py | 26 | 2094 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import vtk
import vtk.test.Testing
import math
class TestLinePlot(vtk.test.Testing.vtkTest):
def testLinePlot(self):
"Test if line plots can be built with python"
# Set up a 2D scene, add an XY chart to it
view = vtk.vtkContextView()... | bsd-3-clause |
oblank/pydjango-froum | forum/admin.py | 6 | 1277 | from django.contrib import admin
from forum.models import ForumUser, Plane, Node, Topic, Reply, Favorite, Notification, Transaction, Vote
class ForumUserAdmin(admin.ModelAdmin):
list_display = ('username', 'email', 'is_active', 'is_staff', 'date_joined')
search_fields = ('username', 'email', 'nickname')
l... | mit |
Beauhurst/django | tests/auth_tests/urls.py | 16 | 5533 | from django.conf.urls import url
from django.contrib import admin
from django.contrib.auth import views
from django.contrib.auth.decorators import login_required
from django.contrib.auth.forms import AuthenticationForm
from django.contrib.auth.urls import urlpatterns as auth_urlpatterns
from django.contrib.messages.api... | bsd-3-clause |
punker76/SmartAlarmClock | SmartAlarmClock/www/temboo/Library/Google/Calendar/GetNextEvent.py | 2 | 4346 | # -*- coding: utf-8 -*-
###############################################################################
#
# GetNextEvent
# Retrieves the next upcoming event in a Google calendar based on the current timestamp and the specified calendar's timezone setting.
#
# Python version 2.6
#
######################################... | mit |
mancoast/CPythonPyc_test | cpython/230_test_userlist.py | 9 | 6949 | # Check every path through every method of UserList
from UserList import UserList
import unittest, test.test_support
class UserListTest(unittest.TestCase):
def test_constructors(self):
l0 = []
l1 = [0]
l2 = [0, 1]
u = UserList()
u0 = UserList(l0)
u1 = UserList(l1)... | gpl-3.0 |
thaumos/ansible | test/units/modules/network/fortimanager/test_fmgr_fwobj_vip.py | 39 | 24644 | # Copyright 2018 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 |
tiancj/emesene | emesene/e3/xmpp/SleekXMPP/sleekxmpp/plugins/xep_0066/oob.py | 14 | 5530 | """
SleekXMPP: The Sleek XMPP Library
Copyright (C) 2011 Nathanael C. Fritz, Lance J.T. Stout
This file is part of SleekXMPP.
See the file LICENSE for copying permission.
"""
import logging
from sleekxmpp.stanza import Message, Presence, Iq
from sleekxmpp.exceptions import XMPPError
from sleekxmpp.xm... | gpl-3.0 |
kasper93/brotli | python/tests/test_utils.py | 98 | 1128 | from __future__ import print_function
import sys
import os
import sysconfig
import filecmp
def diff_q(first_file, second_file):
"""Simulate call to POSIX diff with -q argument"""
if not filecmp.cmp(first_file, second_file, shallow=False):
print("Files %s and %s differ" % (first_file, second_file),
... | apache-2.0 |
EvanK/ansible | lib/ansible/modules/network/avi/avi_network.py | 31 | 5011 | #!/usr/bin/python
#
# @author: Gaurav Rastogi (grastogi@avinetworks.com)
# Eric Anderson (eanderson@avinetworks.com)
# module_check: supported
# Avi Version: 17.1.1
#
# Copyright: (c) 2017 Gaurav Rastogi, <grastogi@avinetworks.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses... | gpl-3.0 |
lsd/dotfiles-1 | vim/bundle/eclim/eclim/autoload/eclim/python/rope/refactor/importutils/__init__.py | 90 | 12748 | """A package for handling imports
This package provides tools for modifying module imports after
refactorings or as a separate task.
"""
import rope.base.evaluate
from rope.base.change import ChangeSet, ChangeContents
from rope.refactor import occurrences, rename
from rope.refactor.importutils import module_imports, ... | mit |
aflaxman/scikit-learn | sklearn/decomposition/tests/test_truncated_svd.py | 66 | 8261 | """Test truncated SVD transformer."""
import numpy as np
import scipy.sparse as sp
from sklearn.decomposition import TruncatedSVD
from sklearn.utils import check_random_state
from sklearn.utils.testing import (assert_array_almost_equal, assert_equal,
assert_raises, assert_greater,
... | bsd-3-clause |
StefanRijnhart/odoo | addons/report/models/abstract_report.py | 96 | 2900 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2014-Today OpenERP SA (<http://www.openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms ... | agpl-3.0 |
StephenRJ/cm12_kernel_moto_shamu | tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Util.py | 12527 | 1935 | # Util.py - Python extension for perf script, miscellaneous utility code
#
# Copyright (C) 2010 by Tom Zanussi <tzanussi@gmail.com>
#
# This software may be distributed under the terms of the GNU General
# Public License ("GPL") version 2 as published by the Free Software
# Foundation.
import errno, os
FUTEX_WAIT = 0... | gpl-2.0 |
braiins/paparazzi | sw/ground_segment/python/ivytoredis/ivy_to_redis.py | 39 | 2358 | #!/usr/bin/env python
from __future__ import print_function
import redis
import time
import signal
import argparse
import sys
import os
# if PAPARAZZI_SRC not set, then assume the tree containing this
# file is a reasonable substitute
PPRZ_SRC = os.getenv("PAPARAZZI_SRC", os.path.normpath(os.path.join(os.path.dirnam... | gpl-2.0 |
abo-abo/edx-platform | common/lib/xmodule/xmodule/tests/test_graders.py | 102 | 12238 | """Grading tests"""
import unittest
from xmodule import graders
from xmodule.graders import Score, aggregate_scores
class GradesheetTest(unittest.TestCase):
'''Tests the aggregate_scores method'''
def test_weighted_grading(self):
scores = []
Score.__sub__ = lambda me, other: (me.earned - oth... | agpl-3.0 |
ozamiatin/oslo.messaging | oslo_messaging/_drivers/zmq_driver/zmq_version.py | 2 | 2194 | # Copyright 2016 Mirantis, 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 ... | apache-2.0 |
RedHatInsights/insights-core | insights/combiners/selinux.py | 1 | 4702 | """
SELinux
=======
Combiner for more complex handling of SELinux being disabled by any means
available to the users. It uses results of
:class:`insights.parsers.sestatus.SEStatus`, and
:class:`insights.parsers.selinux_config.SelinuxConfig` parsers and
:class:`insights.combiners.grub_conf.GrubConf` combiner.
It conta... | apache-2.0 |
Dawny33/luigi | test/worker_test.py | 5 | 27132 | # -*- coding: utf-8 -*-
#
# Copyright 2012-2015 Spotify AB
#
# 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 |
darjus-amzn/boto | tests/unit/ec2/test_blockdevicemapping.py | 111 | 6739 | from tests.compat import unittest
from boto.ec2.connection import EC2Connection
from boto.ec2.blockdevicemapping import BlockDeviceType, BlockDeviceMapping
from tests.compat import OrderedDict
from tests.unit import AWSMockServiceTestCase
class BlockDeviceTypeTests(unittest.TestCase):
def setUp(self):
s... | mit |
biolab/orange3-imageanalytics | orangecontrib/imageanalytics/tests/test_image_grid.py | 1 | 1102 | import logging
import unittest
from Orange.data import Table
from orangecontrib.imageanalytics.image_grid import ImageGrid
class ImageGridTest(unittest.TestCase):
def setUp(self):
logging.disable(logging.CRITICAL)
self.grid = ImageGrid(Table("iris"))
def tearDown(self):
logging.disa... | gpl-3.0 |
ElementsProject/elements | test/functional/mempool_packages.py | 1 | 17298 | #!/usr/bin/env python3
# Copyright (c) 2014-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 descendant package tracking code."""
from decimal import Decimal
from test_framework.messages im... | mit |
JohnGriffiths/nipype | nipype/interfaces/slicer/filtering/resamplescalarvectordwivolume.py | 15 | 5494 | # -*- coding: utf8 -*-
"""Autogenerated file - DO NOT EDIT
If you spot a bug, please report it on the mailing list and/or change the generator."""
from nipype.interfaces.base import CommandLine, CommandLineInputSpec, SEMLikeCommandLine, TraitedSpec, File, Directory, traits, isdefined, InputMultiPath, OutputMultiPath
i... | bsd-3-clause |
harmslab/pytc | pytc/fitters/bayesian.py | 2 | 7462 | __description__ = \
"""
Fitter subclass for performing bayesian (MCMC) fits.
"""
__author__ = "Michael J. Harms"
__date__ = "2017-05-10"
from .base import Fitter
import emcee, corner
import numpy as np
import scipy.optimize as optimize
import multiprocessing
class BayesianFitter(Fitter):
"""
"""
def __... | unlicense |
Intel-Corporation/tensorflow | tensorflow/python/debug/lib/debug_gradients_test.py | 14 | 15759 | # 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 |
sysalexis/kbengine | kbe/src/lib/python/Lib/test/test_asyncio/test_windows_events.py | 60 | 4592 | import os
import sys
import unittest
if sys.platform != 'win32':
raise unittest.SkipTest('Windows only')
import _winapi
import asyncio
from asyncio import _overlapped
from asyncio import test_utils
from asyncio import windows_events
class UpperProto(asyncio.Protocol):
def __init__(self):
self.buf =... | lgpl-3.0 |
dezelin/virtualbox | src/libs/libxml2-2.6.31/python/tests/build.py | 87 | 1542 | #!/usr/bin/python -u
import libxml2
import sys
# Memory debug specific
libxml2.debugMemory(1)
doc = libxml2.newDoc("1.0")
comment = doc.newDocComment("This is a generated document")
doc.addChild(comment)
pi = libxml2.newPI("test", "PI content")
doc.addChild(pi)
root = doc.newChild(None, "doc", None)
ns = root.newNs("... | gpl-2.0 |
miipl-naveen/optibizz | addons/subscription/subscription.py | 337 | 8906 | # -*- 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... | agpl-3.0 |
gunzy83/ansible-modules-extras | cloud/amazon/sns_topic.py | 33 | 13805 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# This is a 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 Ansible library is distri... | gpl-3.0 |
logonod/sshuttle | server.py | 13 | 7434 | import re, struct, socket, select, traceback, time
if not globals().get('skip_imports'):
import ssnet, helpers, hostwatch
import compat.ssubprocess as ssubprocess
from ssnet import SockWrapper, Handler, Proxy, Mux, MuxWrapper
from helpers import *
def _ipmatch(ipstr):
if ipstr == 'default':
... | lgpl-2.1 |
ziethan/decanter | decanter/install.py | 1 | 3967 | from __future__ import absolute_import, print_function
import tarfile
import json
import yaml
import os
import errno
import requests
import xml.etree.ElementTree as ET
from xml.etree.ElementTree import ParseError
from decanter import config
def InstallFromFile(**kwargs):
if kwargs.get('path') is None:
... | mit |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.