code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
import os.path
import shutil
import uuid
import re
from django.test import TestCase
from django.contrib.auth.models import User
from mock import patch, Mock, PropertyMock
from docker.errors import APIError as DockerAPIError, DockerException
from readthedocs.projects.models import Project
from... | stevepiercy/readthedocs.org | readthedocs/rtd_tests/tests/test_doc_building.py | Python | mit | 15,211 |
# coding=utf-8
# (c) 2018, NetApp Inc.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from ansible.modules.storage.netapp.netapp_e_mgmt_interface import MgmtInterface
from units.modules.utils import AnsibleExitJson, AnsibleFailJson, ModuleTestCase, set_module_args
__metac... | thaim/ansible | test/units/modules/storage/netapp/test_netapp_e_mgmt_interface.py | Python | mit | 28,142 |
from inspect import ismethod, isfunction
import os
import time
import traceback
from CodernityDB.database import RecordDeleted, RecordNotFound
from couchpotato import md5, get_db
from couchpotato.api import addApiView
from couchpotato.core.event import fireEvent, addEvent
from couchpotato.core.helpers.encoding import ... | coderb0t/CouchPotatoServer | couchpotato/core/plugins/release/main.py | Python | gpl-3.0 | 20,734 |
from edxmako.shortcuts import render_to_string
from pipeline.conf import settings
from pipeline.packager import Packager
from pipeline.utils import guess_type
from static_replace import try_staticfiles_lookup
def compressed_css(package_name):
package = settings.PIPELINE_CSS.get(package_name, {})
if package:
... | liuqr/edx-xiaodun | common/djangoapps/pipeline_mako/__init__.py | Python | agpl-3.0 | 2,354 |
self.description = "Install a package from a sync db with fnmatch'ed NoExtract"
sp = pmpkg("dummy")
sp.files = ["bin/dummy",
"usr/share/man/man8",
"usr/share/man/man1/dummy.1"]
self.addpkg2db("sync", sp)
self.option["NoExtract"] = ["usr/share/man/*"]
self.args = "-S %s" % sp.name
self.addrul... | kylon/pacman-fakeroot | test/pacman/tests/sync502.py | Python | gpl-2.0 | 513 |
# -*- coding: utf-8 -*-
from . import project_sla
from . import analytic_account
from . import project_sla_control
from . import project_issue
from . import project_task
from . import report
| sergiocorato/project-service | project_sla/__init__.py | Python | agpl-3.0 | 191 |
from nose.tools import *
from framework.mongo import database as db
from scripts.remove_wiki_title_forward_slashes import main
from tests.base import OsfTestCase
from tests.factories import NodeWikiFactory, ProjectFactory
class TestRemoveWikiTitleForwardSlashes(OsfTestCase):
def test_forward_slash_is_removed_... | rdhyee/osf.io | scripts/tests/test_remove_wiki_title_forward_slashes.py | Python | apache-2.0 | 1,335 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2017, Ansible Project
# 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',
... | e-gob/plataforma-kioscos-autoatencion | scripts/ansible-play/.venv/lib/python2.7/site-packages/ansible/modules/files/acl.py | Python | bsd-3-clause | 11,261 |
from __future__ import absolute_import
import psycopg2 as Database
# Some of these imports are unused, but they are inherited from other engines
# and should be available as part of the backend ``base.py`` namespace.
from django.db.backends.postgresql_psycopg2.base import ( # NOQA
DatabaseWrapper, DatabaseFeatur... | Kryz/sentry | src/sentry/db/postgres/base.py | Python | bsd-3-clause | 2,640 |
from random import shuffle
def bogosort(arr):
while not sorted(arr) == arr:
shuffle(arr)
return arr | warreee/Algorithm-Implementations | Bogosort/Python/jcla1/bogosort.py | Python | mit | 116 |
# Copyright 2011 James McCauley
# Copyright 2008 (C) Nicira, Inc.
#
# This file is part of POX.
#
# POX 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) an... | srijanmishra/RouteFlow | pox/pox/lib/packet/udp.py | Python | apache-2.0 | 5,386 |
#!/usr/bin/env python3
# Copyright (c) 2017-2018 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 logic for setting nMinimumChainWork on command line.
Nodes don't consider themselves out of "init... | afk11/bitcoin | test/functional/feature_minchainwork.py | Python | mit | 4,122 |
#!/usr/bin/python
"""
Ansible module to manage the ssh known_hosts file.
Copyright(c) 2014, Matthew Vernon <mcv21@cam.ac.uk>
This module 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 Li... | andreaso/ansible | lib/ansible/modules/system/known_hosts.py | Python | gpl-3.0 | 12,710 |
"""
report test results in JUnit-XML format,
for use with Jenkins and build integration servers.
Based on initial code from Ross Lawley.
Output conforms to https://github.com/jenkinsci/xunit-plugin/blob/master/
src/main/resources/org/jenkinsci/plugins/xunit/types/model/xsd/junit-10.xsd
"""
from __future__ im... | anthgur/servo | tests/wpt/web-platform-tests/tools/third_party/pytest/_pytest/junitxml.py | Python | mpl-2.0 | 15,681 |
import frappe
def execute():
duplicates = frappe.db.sql("""select email_group, email, count(name)
from `tabEmail Group Member`
group by email_group, email
having count(name) > 1""")
# delete all duplicates except 1
for email_group, email, count in duplicates:
frappe.db.sql("""delete from `tabEmail Group Me... | hassanibi/erpnext | erpnext/patches/v6_2/remove_newsletter_duplicates.py | Python | gpl-3.0 | 407 |
# -*- 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 ... | diogocs1/comps | web/addons/sale_layout/models/sale_layout.py | Python | apache-2.0 | 4,907 |
"""
Integration tests for third_party_auth LTI auth providers
"""
import unittest
from django.conf import settings
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from oauthlib.oauth1.rfc5849 import Client, SIGNATURE_TYPE_BODY
from third_party_auth.tests import testutil
FORM_EN... | solashirai/edx-platform | common/djangoapps/third_party_auth/tests/specs/test_lti.py | Python | agpl-3.0 | 7,079 |
"""
By specifying the 'proxy' Meta attribute, model subclasses can specify that
they will take data directly from the table of their base class table rather
than using a new table of their own. This allows them to act as simple proxies,
providing a modified interface to the data from the base class.
"""
from django.db ... | benjaminjkraft/django | tests/proxy_models/models.py | Python | bsd-3-clause | 4,514 |
"""
SCGI-->WSGI application proxy, "SWAP".
(Originally written by Titus Brown.)
This lets an SCGI front-end like mod_scgi be used to execute WSGI
application objects. To use it, subclass the SWAP class like so::
class TestAppHandler(swap.SWAP):
def __init__(self, *args, **kwargs):
self.prefix =... | endlessm/chromium-browser | third_party/catapult/third_party/Paste/paste/util/scgiserver.py | Python | bsd-3-clause | 5,612 |
# orm/exc.py
# Copyright (C) 2005-2016 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""SQLAlchemy ORM exceptions."""
from .. import exc as sa_exc, util
NO_STATE = (Attribut... | pcu4dros/pandora-core | workspace/lib/python3.5/site-packages/sqlalchemy/orm/exc.py | Python | mit | 5,439 |
#!/usr/bin/env python
"""
exec_command
Implements exec_command function that is (almost) equivalent to
commands.getstatusoutput function but on NT, DOS systems the
returned status is actually correct (though, the returned status
values may be different by a factor). In addition, exec_command
takes keyword arguments fo... | LumPenPacK/NetworkExtractionFromImages | win_build/nefi2_win_amd64_msvc_2015/site-packages/numpy/distutils/exec_command.py | Python | bsd-2-clause | 20,462 |
""" Unit tests for nonlinear solvers
Author: Ondrej Certik
May 2007
"""
from __future__ import division, print_function, absolute_import
from numpy.testing import assert_, dec, TestCase, run_module_suite
from scipy._lib.six import xrange
from scipy.optimize import nonlin, root
from numpy import matrix, diag, dot
from... | valexandersaulys/airbnb_kaggle_contest | venv/lib/python3.4/site-packages/scipy/optimize/tests/test_nonlin.py | Python | gpl-2.0 | 15,160 |
# databases/__init__.py
# Copyright (C) 2005-2014 the SQLAlchemy authors and contributors <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""Include imports from the sqlalchemy.dialects package for backwards
compatibil... | jessekl/flixr | venv/lib/python2.7/site-packages/sqlalchemy/databases/__init__.py | Python | mit | 881 |
class MyExc(Exception):
pass
e = MyExc(100, "Some error")
print(e)
print(repr(e))
print(e.args)
try:
raise MyExc("Some error")
except MyExc as e:
print("Caught exception:", repr(e))
try:
raise MyExc("Some error2")
except Exception as e:
print("Caught exception:", repr(e))
try:
raise MyExc("S... | AriZuu/micropython | tests/basics/subclass_native3.py | Python | mit | 376 |
# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose with or without fee is hereby granted,
# provided that the above copyright notice and this permission notice
# appear in all copies.
#
# THE SOFTWARE IS PROVIDED "... | enigmamarketing/csf-allow-domains | usr/local/csf/bin/csf-allow-domains/dns/rdtypes/mxbase.py | Python | mit | 3,968 |
"""Utilities to evaluate models with respect to a variable
"""
# Author: Alexander Fabisch <afabisch@informatik.uni-bremen.de>
#
# License: BSD 3 clause
import warnings
import numpy as np
from .base import is_classifier, clone
from .cross_validation import check_cv
from .externals.joblib import Parallel, delayed
fro... | Achuth17/scikit-learn | sklearn/learning_curve.py | Python | bsd-3-clause | 13,467 |