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 |
|---|---|---|---|---|---|
mcus/SickRage | lib/sqlalchemy/ext/mutable.py | 76 | 22912 | # ext/mutable.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
"""Provide support for tracking of in-place changes to scalar values,
which are propaga... | gpl-3.0 |
FenceAtMHacks/flaskbackend | fence-api/flask/lib/python2.7/site-packages/pip/_vendor/cachecontrol/adapter.py | 87 | 3967 | import functools
from pip._vendor.requests.adapters import HTTPAdapter
from .controller import CacheController
from .cache import DictCache
from .filewrapper import CallbackFileWrapper
class CacheControlAdapter(HTTPAdapter):
invalidating_methods = set(['PUT', 'DELETE'])
def __init__(self, cache=None,
... | mit |
puzan/ansible | test/units/modules/cloud/amazon/test_ec2_vpc_nat_gateway.py | 41 | 17149 | import pytest
import unittest
boto3 = pytest.importorskip("boto3")
botocore = pytest.importorskip("botocore")
from collections import namedtuple
from ansible.parsing.dataloader import DataLoader
from ansible.vars import VariableManager
from ansible.inventory import Inventory
from ansible.playbook.play import Play
fro... | gpl-3.0 |
adlius/osf.io | admin/nodes/urls.py | 6 | 2100 | from django.conf.urls import url
from admin.nodes import views
app_name = 'admin'
urlpatterns = [
url(r'^$', views.NodeFormView.as_view(),
name='search'),
url(r'^flagged_spam$', views.NodeFlaggedSpamList.as_view(),
name='flagged-spam'),
url(r'^known_spam$', views.NodeKnownSpamList.as_view(... | apache-2.0 |
camptocamp/odoo | addons/fetchmail/__init__.py | 437 | 1120 | #-*- coding:utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# mga@openerp.com
#
# This program is free software: you can redistribute it and/or mo... | agpl-3.0 |
ttm/percolation | percolation/rdf/ontology.py | 1 | 7460 | import percolation as P
from .rdflib import NS
a=NS.rdf.type
def percolationSystem():
triples=[
(NS.per.CurrentStatus, a, NS.per.SystemStatus)
]
def minimumTestOntology(context="minimum_ontology"):
triples=[
(NS.po.FacebookSnapshot,NS.rdfs.subClassOf,NS.po.Snapshot),
... | gpl-3.0 |
debsankha/bedtime-programming | ls222/visual-lotka.py | 1 | 5120 | #!/usr/bin/env python
from math import *
import thread
import random
import time
import pygtk
pygtk.require("2.0")
import gtk
import gtk.glade
import commands
import matplotlib.pyplot
class rodent:
def __init__(self):
self.time_from_last_childbirth=0
class felix:
def __init__(self):
self.size=0
self.is_virgin... | gpl-3.0 |
freedomtan/tensorflow | tensorflow/python/ops/confusion_matrix.py | 14 | 10762 | # Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | apache-2.0 |
kaiyou/docker-py | tests/unit/errors_test.py | 2 | 3097 | import unittest
import requests
from docker.errors import (APIError, DockerException,
create_unexpected_kwargs_error)
class APIErrorTest(unittest.TestCase):
def test_api_error_is_caught_by_dockerexception(self):
try:
raise APIError("this should be caught by DockerE... | apache-2.0 |
blaze/distributed | distributed/protocol/tests/test_collection_cuda.py | 1 | 2448 | import pytest
from distributed.protocol import serialize, deserialize
from dask.dataframe.utils import assert_eq
import pandas as pd
@pytest.mark.parametrize("collection", [tuple, dict])
@pytest.mark.parametrize("y,y_serializer", [(50, "cuda"), (None, "pickle")])
def test_serialize_cupy(collection, y, y_serializer):... | bsd-3-clause |
LTD-Beget/tornado | tornado/util.py | 2 | 13519 | """Miscellaneous utility functions and classes.
This module is used internally by Tornado. It is not necessarily expected
that the functions and classes defined here will be useful to other
applications, but they are documented here in case they are.
The one public-facing part of this module is the `Configurable` cl... | apache-2.0 |
cs243iitg/vehicle-webapp | webapp/vms/forms.py | 1 | 15620 | from vms import models
from django.contrib.auth.models import User
from django import forms
from django.forms.extras.widgets import SelectDateWidget
from django.contrib.admin.widgets import AdminSplitDateTime
from django.utils.translation import ugettext_lazy as _
from datetimewidget.widgets import DateTimeWidget, Date... | mit |
kernel64/AutobahnPython | examples/websocket/streaming/message_based_server.py | 27 | 1622 | ###############################################################################
##
## Copyright 2011 Tavendo GmbH
##
## 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
##
## ht... | apache-2.0 |
ringemup/satchmo | satchmo/apps/payment/views/contact.py | 6 | 5160 | ####################################################################
# First step in the order process - capture all the demographic info
#####################################################################
from django import http
from django.core import urlresolvers
from django.shortcuts import render_to_response
fr... | bsd-3-clause |
gibiansky/tensorflow | tensorflow/python/kernel_tests/reduction_ops_test.py | 21 | 33412 | # Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | apache-2.0 |
xianggong/m2c_unit_test | test/operator/remainder_short16short16/compile.py | 1861 | 4430 | #!/usr/bin/python
import os
import subprocess
import re
def runCommand(command):
p = subprocess.Popen(command,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
p.wait()
return iter(p.stdout.readline, b'')
def dumpRunCommand(command,... | gpl-2.0 |
nikolas/lettuce | tests/integration/lib/Django-1.2.5/django/core/mail/backends/filebased.py | 394 | 2485 | """Email backend that writes messages to a file."""
import datetime
import os
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.core.mail.backends.console import EmailBackend as ConsoleEmailBackend
class EmailBackend(ConsoleEmailBackend):
def __init__(self, *arg... | gpl-3.0 |
tashaxe/Red-DiscordBot | lib/youtube_dl/extractor/abc.py | 24 | 6210 | from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
ExtractorError,
js_to_json,
int_or_none,
parse_iso8601,
)
class ABCIE(InfoExtractor):
IE_NAME = 'abc.net.au'
_VALID_URL = r'https?://(?:www\.)?abc\.net\.au/news/(?:[^/]+/){1,2}(?P<id>\d+... | gpl-3.0 |
halfcrazy/sqlalchemy | lib/sqlalchemy/testing/requirements.py | 42 | 19949 | # testing/requirements.py
# Copyright (C) 2005-2015 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
"""Global database feature support policy.
Provides decorators to mark test... | mit |
dragon788/wordfreq | tests/test.py | 1 | 5277 | from wordfreq import (
word_frequency, available_languages, cB_to_freq,
top_n_list, random_words, random_ascii_words, tokenize
)
from nose.tools import (
eq_, assert_almost_equal, assert_greater, raises
)
def test_freq_examples():
# Stopwords are most common in the correct language
assert_greater(... | mit |
exelearning/iteexe | nevow/url.py | 14 | 16868 | # -*- test-case-name: "nevow.test.test_url" -*-
# Copyright (c) 2004 Divmod.
# See LICENSE for details.
"""URL parsing, construction and rendering.
"""
from __future__ import generators
import weakref
from nevow import inevow
from nevow.stan import raw
from nevow.flat import flatten, serialize
from nevow.context imp... | gpl-2.0 |
ddd332/presto | presto-docs/target/sphinx/docutils/writers/xetex/__init__.py | 4 | 5079 | #!/usr/bin/env python
# -*- coding: utf8 -*-
# :Author: Günter Milde <milde@users.sourceforge.net>
# :Revision: $Revision: 7389 $
# :Date: $Date: 2012-03-30 13:58:21 +0200 (Fre, 30 Mär 2012) $
# :Copyright: © 2010 Günter Milde.
# :License: Released under the terms of the `2-Clause BSD license`_, in short:
#
# Copy... | apache-2.0 |
wasade/qiime | tests/test_plot_semivariogram.py | 1 | 12517 | #!/usr/bin/env python
__author__ = "Antonio Gonzalez Pena"
__copyright__ = "Copyright 2011, The QIIME Project"
__credits__ = ["Antonio Gonzalez Pena"]
__license__ = "GPL"
__version__ = "1.8.0-dev"
__maintainer__ = "Antonio Gonzalez Pena"
__email__ = "antgonza@gmail.com"
from qiime.plot_semivariogram import hist_bins... | gpl-2.0 |
auready/docker-py | docker/utils/socket.py | 10 | 1771 | import errno
import os
import select
import struct
import six
try:
from ..transport import NpipeSocket
except ImportError:
NpipeSocket = type(None)
class SocketError(Exception):
pass
def read(socket, n=4096):
"""
Reads at most n bytes from socket
"""
recoverable_errors = (errno.EINTR,... | apache-2.0 |
SuperKogito/Cryptos | CryptosCode/ExitPage.py | 1 | 2699 | # -*- coding: utf-8 -*-
"""
Created on Sat Sep 23 19:05:35 2017
@author: SuperKogito
"""
# Define imports
import tkinter as tk
class ExitPage(tk.Frame):
""" Exit page class """
def __init__(self, parent, controller):
tk.Frame.__init__(self, parent)
self.controller = controller
self.con... | mit |
scorphus/thefuck | thefuck/specific/git.py | 4 | 1128 | import re
from decorator import decorator
from ..utils import is_app
from ..shells import shell
@decorator
def git_support(fn, command):
"""Resolves git aliases and supports testing for both git and hub."""
# supports GitHub's `hub` command
# which is recommended to be used with `alias git=hub`
# but ... | mit |
astrofrog/numpy | numpy/matlib.py | 90 | 9494 | import numpy as np
from numpy.matrixlib.defmatrix import matrix, asmatrix
# need * as we're copying the numpy namespace
from numpy import *
__version__ = np.__version__
__all__ = np.__all__[:] # copy numpy namespace
__all__ += ['rand', 'randn', 'repmat']
def empty(shape, dtype=None, order='C'):
"""
Return a ... | bsd-3-clause |
nicholaschris/landsatpy | utils.py | 1 | 2693 | import operator
import pandas as pd
import numpy as np
from numpy import ma
from scipy.misc import imresize
import scipy.ndimage as ndimage
from skimage.morphology import disk, dilation
def get_truth(input_one, input_two, comparison): # too much abstraction
ops = {'>': operator.gt,
'<': operator.lt,
... | mit |
guludo/ardupilot-1 | Tools/scripts/frame_sizes.py | 351 | 1117 | #!/usr/bin/env python
import re, sys, operator, os
code_line = re.compile("^\s*\d+:/")
frame_line = re.compile("^\s*\d+\s+/\* frame size = (\d+) \*/")
class frame(object):
def __init__(self, code, frame_size):
self.code = code
self.frame_size = int(frame_size)
frames = []
def process_lst(filena... | gpl-3.0 |
John-Hart/autorest | src/generator/AutoRest.Python.Tests/AcceptanceTests/model_flattening_tests.py | 6 | 11782 | # --------------------------------------------------------------------------
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the ""Software""),... | mit |
ashishfinoit/django-rest-framework | tests/test_permissions.py | 68 | 18850 | from __future__ import unicode_literals
import base64
from django.contrib.auth.models import Group, Permission, User
from django.core.urlresolvers import ResolverMatch
from django.db import models
from django.test import TestCase
from django.utils import unittest
from rest_framework import (
HTTP_HEADER_ENCODING... | bsd-2-clause |
Brainiarc7/linux-3.18-parrot | 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 |
taigaio/taiga-back | taiga/projects/settings/migrations/0001_initial.py | 1 | 1897 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2018-09-24 11:49
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import taiga.projects.settings.choices
class Migration(migrations.Mi... | agpl-3.0 |
mogers/buck | third-party/nailgun/pynailgun/ng.py | 17 | 19064 | #!/usr/bin/env python
#
# Copyright 2004-2015, Martian Software, 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 app... | apache-2.0 |
chooyan-eng/ChooyanHttp | http_client.py | 1 | 2148 | import socket
class ChooyanHttpClient:
def request(host, port=80):
response = ChooyanResponse()
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((host, port))
request_str = 'GET / HTTP/1.1\nHost: %s\r\n\r\n' % (host)
s.send(request_str.encode('utf-8'))
... | apache-2.0 |
nttks/jenkins-test | cms/djangoapps/contentstore/views/entrance_exam.py | 7 | 8293 | """
Entrance Exams view module -- handles all requests related to entrance exam management via Studio
Intended to be utilized as an AJAX callback handler, versus a proper view/screen
"""
import json
import logging
from django.contrib.auth.decorators import login_required
from django_future.csrf import ensure_csrf_cook... | agpl-3.0 |
amenonsen/ansible | lib/ansible/modules/network/aci/aci_contract_subject_to_filter.py | 26 | 9088 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# 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',
'status': ['preview'],
... | gpl-3.0 |
mollstam/UnrealPy | UnrealPyEmbed/Development/Python/2015.08.07-Python2710-x64-Source-vs2015/Python27/Source/django-1.8.2/tests/auth_tests/test_hashers.py | 12 | 14727 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from unittest import skipUnless
from django.conf.global_settings import PASSWORD_HASHERS
from django.contrib.auth.hashers import (
UNUSABLE_PASSWORD_PREFIX, UNUSABLE_PASSWORD_SUFFIX_LENGTH,
BasePasswordHasher, PBKDF2PasswordHasher, PBKDF2SHA1Pass... | mit |
PennPanda/xenproject | tools/libxl/gentypes.py | 8 | 27441 | #!/usr/bin/python
import sys
import re
import idl
def libxl_C_instance_of(ty, instancename):
if isinstance(ty, idl.Aggregate) and ty.typename is None:
if instancename is None:
return libxl_C_type_define(ty)
else:
return libxl_C_type_define(ty) + " " + instancename
s =... | gpl-2.0 |
normanyahq/Parameterized-Remote-Shell-Execution-Service | server.py | 1 | 1415 | from flask import Flask, request
from subprocess import Popen, PIPE
import json
app = Flask(__name__)
HelpMessage = """
Usage:
POST command to this URL with following payload:
{"file": "...", args:[...]}
We are using this format to keep it the same with NodeJs spawnSync
Example:
{"file": "ls", arg... | mit |
vijayendrabvs/ssl-neutron | neutron/plugins/openvswitch/ovs_models_v2.py | 7 | 3864 | # Copyright 2011 VMware, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | apache-2.0 |
trondhindenes/ansible-modules-core | network/nxos/nxos_snmp_contact.py | 20 | 11922 | #!/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 |
daniponi/django | tests/custom_pk/models.py | 282 | 1272 | # -*- coding: utf-8 -*-
"""
Using a custom primary key
By default, Django adds an ``"id"`` field to each model. But you can override
this behavior by explicitly adding ``primary_key=True`` to a field.
"""
from __future__ import unicode_literals
from django.db import models
from django.utils.encoding import python_2_... | bsd-3-clause |
WillisXChen/django-oscar | oscar/lib/python2.7/site-packages/django/contrib/gis/geos/base.py | 197 | 1660 | from ctypes import c_void_p
from django.contrib.gis.geos.error import GEOSException
# Trying to import GDAL libraries, if available. Have to place in
# try/except since this package may be used outside GeoDjango.
try:
from django.contrib.gis import gdal
except ImportError:
# A 'dummy' gdal module.
class ... | bsd-3-clause |
kwilliams-mo/iris | lib/iris/tests/test_plot.py | 1 | 32122 | # (C) British Crown Copyright 2010 - 2013, Met Office
#
# This file is part of Iris.
#
# Iris is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation, either version 3 of the License, or
# (at your option) any l... | gpl-3.0 |
google/orchestra | orchestra/google/marketing_platform/operators/display_video_360.py | 1 | 18902 | #
# Copyright 2019 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | apache-2.0 |
gilneidp/FinalProject | ALL_FILES/pox/misc/pidfile.py | 44 | 2096 | # Copyright 2013 James McCauley
#
# 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 writi... | mit |
caot/intellij-community | python/lib/Lib/encodings/cp1140.py | 593 | 13361 | """ Python Character Mapping Codec cp1140 generated from 'python-mappings/CP1140.TXT' with gencodec.py.
"""#"
import codecs
### Codec APIs
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,input,errors='stri... | apache-2.0 |
numerigraphe/odoo | addons/sale_mrp/tests/__init__.py | 262 | 1085 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (c) 2012-TODAY OpenERP S.A. <http://openerp.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of ... | agpl-3.0 |
datalogics-robb/scons | bin/SConsDoc.py | 2 | 9625 | #!/usr/bin/env python
#
# Module for handling SCons documentation processing.
#
__doc__ = """
This module parses home-brew XML files that document various things
in SCons. Right now, it handles Builders, construction variables,
and Tools, but we expect it to get extended in the future.
In general, you can use any Do... | mit |
TyberiusPrime/pysam | tests/tabix_test.py | 2 | 43143 | #!/usr/bin/env python
'''unit testing code for pysam.
Execute in the :file:`tests` directory as it requires the Makefile
and data files located there.
'''
import sys
import os
import shutil
import gzip
import pysam
import unittest
import glob
import re
import copy
from TestUtils import checkURL
DATADIR = 'tabix_data... | mit |
harvardinformatics/jobTree | src/jobTreeStats.py | 3 | 32075 | #!/usr/bin/env python
# Copyright (C) 2011 by Benedict Paten (benedictpaten@gmail.com)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the... | mit |
z-jason/anki | aqt/forms/dconf.py | 1 | 20860 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'designer/dconf.ui'
#
# Created: Sun Mar 30 10:19:28 2014
# by: PyQt4 UI code generator 4.10.3
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except... | agpl-3.0 |
Stanford-Online/edx-platform | lms/djangoapps/mobile_api/decorators.py | 22 | 2476 | """
Decorators for Mobile APIs.
"""
import functools
from django.http import Http404
from opaque_keys.edx.keys import CourseKey
from rest_framework import status
from rest_framework.response import Response
from lms.djangoapps.courseware.courses import get_course_with_access
from lms.djangoapps.courseware.courseware_... | agpl-3.0 |
cyanna/edx-platform | cms/djangoapps/contentstore/views/tests/test_videos.py | 17 | 15670 | #-*- coding: utf-8 -*-
"""
Unit tests for video-related REST APIs.
"""
# pylint: disable=attribute-defined-outside-init
import csv
import json
import dateutil.parser
import re
from StringIO import StringIO
from django.conf import settings
from django.test.utils import override_settings
from mock import Mock, patch
fr... | agpl-3.0 |
TheParrotsAreComing/PAS | TestingAssets/Files/delete_foster.py | 2 | 3543 | import time
import sys
import _mysql
import random
import string
import re
import os
import urllib.parse
from selenium import webdriver
from selenium.webdriver.support.ui import Select
import selenium.webdriver.chrome.service as service
from shutil import copyfile
try:
# Check to see if it was added
db=_mysql.con... | mit |
lyceel/engine | build/android/pylib/base/test_run_factory.py | 45 | 2028 | # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from pylib.gtest import gtest_test_instance
from pylib.gtest import local_device_gtest_run
from pylib.instrumentation import instrumentation_test_instance
fr... | bsd-3-clause |
mrphlip/lrrbot | lrrbot/desertbus_moderator_actions.py | 2 | 4185 | """
This module has basically nothing to do with actual lrrbot functionality...
It's just piggy-backing off it to share its code and steal its event loop.
Because that's easier than making this a separate process.
"""
import asyncio
import datetime
import sqlalchemy
from common import pubsub
from common import utils... | apache-2.0 |
Crach1015/plugin.video.superpack | zip/plugin.video.SportsDevil/lib/addonInstaller.py | 25 | 3511 | # -*- coding: utf-8 -*-
import os
import xbmc, xbmcaddon
import common
import urllib
import zipfile
from traceback import print_exc
from dialogs.dialogProgress import DialogProgress
from utils.fileUtils import getFileContent, clearDirectory
from utils.regexUtils import findall
PACKAGE_DIR = "special://home/addons/pac... | gpl-2.0 |
Beeblio/django | tests/custom_managers_regress/models.py | 38 | 1195 | """
Regression tests for custom manager classes.
"""
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
class RestrictedManager(models.Manager):
"""
A manager that filters out non-public instances.
"""
def get_queryset(self):
return super(RestrictedMana... | bsd-3-clause |
MakerDAO/click | tests/test_commands.py | 29 | 7114 | # -*- coding: utf-8 -*-
import re
import click
def test_other_command_invoke(runner):
@click.command()
@click.pass_context
def cli(ctx):
return ctx.invoke(other_cmd, arg=42)
@click.command()
@click.argument('arg', type=click.INT)
def other_cmd(arg):
click.echo(arg)
result... | bsd-3-clause |
maestro-hybrid-cloud/horizon | openstack_dashboard/dashboards/project/network_topology/subnets/tables.py | 33 | 1052 | # Copyright 2015 Cisco Systems.
#
# 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 agr... | apache-2.0 |
invisiblearts/DRCN | drcn_main.py | 1 | 3349 | # The MIT License (MIT)
#
# Copyright (c) 2016 invisiblearts
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, mod... | mit |
rismalrv/edx-platform | lms/djangoapps/ccx/views.py | 13 | 20949 | """
Views related to the Custom Courses feature.
"""
import csv
import datetime
import functools
import json
import logging
import pytz
from contextlib import contextmanager
from copy import deepcopy
from cStringIO import StringIO
from django.core.urlresolvers import reverse
from django.http import (
HttpResponse... | agpl-3.0 |
Salat-Cx65/python-for-android | python-build/python-libs/xmpppy/xmpp/__init__.py | 212 | 1795 | # $Id: __init__.py,v 1.9 2005/03/07 09:34:51 snakeru Exp $
"""
All features of xmpppy library contained within separate modules.
At present there are modules:
simplexml - XML handling routines
protocol - jabber-objects (I.e. JID and different stanzas and sub-stanzas) handling routines.
debug - Jacob Lundquist's debugg... | apache-2.0 |
tcheehow/MissionPlanner | Lib/site-packages/numpy/distutils/from_template.py | 51 | 7890 | #!"C:\Users\hog\Documents\Visual Studio 2010\Projects\ArdupilotMega\ArdupilotMega\bin\Debug\ipy.exe"
"""
process_file(filename)
takes templated file .xxx.src and produces .xxx file where .xxx
is .pyf .f90 or .f using the following template rules:
'<..>' denotes a template.
All function and subroutine blocks... | gpl-3.0 |
SlideAtlas/SlideAtlas-Server | testing/unit/test_models.py | 1 | 3917 | import os
import sys
import logging
from bson import ObjectId
logging.basicConfig(level=logging.INFO)
slideatlaspath = os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))
sys.path.append(slideatlaspath)
from slideatlas import models
from slideatlas.models import Image
from slideatlas.models import Imag... | apache-2.0 |
sudheesh001/pontoon | pontoon/sync/tasks.py | 1 | 7172 | import logging
from django.conf import settings
from django.db import connection, transaction
from django.utils import timezone
from pontoon.administration.vcs import CommitToRepositoryException
from pontoon.base.models import ChangedEntityLocale, Project, Repository
from pontoon.base.tasks import PontoonTask
from po... | bsd-3-clause |
mfherbst/spack | var/spack/repos/builtin/packages/perl-mozilla-ca/package.py | 5 | 1577 | ##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | lgpl-2.1 |
yb-kim/gemV | src/arch/x86/isa/insts/general_purpose/rotate_and_shift/__init__.py | 91 | 2283 | # Copyright (c) 2007 The Hewlett-Packard Development Company
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implemen... | bsd-3-clause |
LingxiaoJIA/gem5 | tests/configs/tsunami-simple-atomic.py | 64 | 2352 | # Copyright (c) 2012 ARM Limited
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implementation of the functionality ... | bsd-3-clause |
SIFTeam/enigma2 | lib/python/Components/Sensors.py | 27 | 2023 | from Components.FanControl import fancontrol
class Sensors:
# (type, name, unit, directory)
TYPE_TEMPERATURE = 0
# (type, name, unit, fanid)
TYPE_FAN_RPM = 1
def __init__(self):
# (type, name, unit, sensor_specific_dict/list)
self.sensors_list = []
self.addSensors()
def getSensorsCount(self, type = No... | gpl-2.0 |
lucalianas/ProMort | promort/reviews_manager/migrations/0012_auto_20170522_1045.py | 2 | 2680 | # -*- coding: utf-8 -*-
# Copyright (c) 2019, CRS4
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify,... | mit |
Easy-as-Bit/p2pool | p2pool/work.py | 52 | 23955 | from __future__ import division
import base64
import random
import re
import sys
import time
from twisted.internet import defer
from twisted.python import log
import bitcoin.getwork as bitcoin_getwork, bitcoin.data as bitcoin_data
from bitcoin import helper, script, worker_interface
from util import forest, jsonrpc,... | gpl-3.0 |
yg257/Pangea | lib/boto-2.34.0/tests/integration/gs/test_storage_uri.py | 135 | 6558 | # -*- coding: utf-8 -*-
# Copyright (c) 2013, Google, Inc.
# All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rig... | apache-2.0 |
craigds/mapnik2 | scons/scons-local-1.2.0/SCons/compat/_scons_UserString.py | 12 | 3505 | #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the... | lgpl-2.1 |
Licshee/shadowsocks | shadowsocks/daemon.py | 694 | 5602 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2014-2015 clowwindy
#
# 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 requi... | apache-2.0 |
defance/edx-platform | lms/djangoapps/courseware/user_state_client.py | 27 | 14669 | """
An implementation of :class:`XBlockUserStateClient`, which stores XBlock Scope.user_state
data in a Django ORM model.
"""
import itertools
from operator import attrgetter
from time import time
try:
import simplejson as json
except ImportError:
import json
import dogstats_wrapper as dog_stats_api
from dja... | agpl-3.0 |
tdickers/mitmproxy | pathod/utils.py | 4 | 1080 | import os
import sys
import netlib.utils
class MemBool(object):
"""
Truth-checking with a memory, for use in chained if statements.
"""
def __init__(self):
self.v = None
def __call__(self, v):
self.v = v
return bool(v)
data = netlib.utils.Data(__name__)
def daemo... | mit |
Nirlendu/Dummy-Search-Engine | tornado-3.2/tornado/test/import_test.py | 42 | 1477 | from __future__ import absolute_import, division, print_function, with_statement
from tornado.test.util import unittest
class ImportTest(unittest.TestCase):
def test_import_everything(self):
# Some of our modules are not otherwise tested. Import them
# all (unless they have external dependencies)... | mit |
zhukaixy/kbengine | kbe/res/scripts/common/Lib/test/test_dbm_ndbm.py | 91 | 1622 | from test import support
support.import_module("dbm.ndbm") #skip if not supported
import unittest
import os
import random
import dbm.ndbm
from dbm.ndbm import error
class DbmTestCase(unittest.TestCase):
def setUp(self):
self.filename = support.TESTFN
self.d = dbm.ndbm.open(self.filename, 'c')
... | lgpl-3.0 |
matijapretnar/projekt-tomo | web/problems/models.py | 2 | 8264 | from copy import deepcopy
import json
from django.conf import settings
from django.core.urlresolvers import reverse
from django.db import models
from django.template.defaultfilters import slugify
from django.template.loader import render_to_string
from rest_framework.authtoken.models import Token
from simple_history.mo... | agpl-3.0 |
nathanpc/leafIRC | tests/googletest/xcode/Scripts/versiongenerate.py | 3088 | 4536 | #!/usr/bin/env python
#
# Copyright 2008, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list... | mit |
davidzchen/tensorflow | tensorflow/python/summary/writer/event_file_writer_v2.py | 19 | 5699 | # Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | apache-2.0 |
neerajvashistha/pa-dude | lib/python2.7/site-packages/nltk/tag/util.py | 3 | 2281 | # Natural Language Toolkit: Tagger Utilities
#
# Copyright (C) 2001-2015 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# Steven Bird <stevenbird1@gmail.com>
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
def str2tuple(s, sep='/'):
"""
Given the string representation of a... | mit |
kmp3325/linguine-python | linguine/ops/remove_caps.py | 4 | 1485 | #!/usr/bin/env python
"""
Removes all non-proper-noun capitals from a given text.
Removes capital letters from text, even for Bill Clinton.
Accepts as input a non-tokenized string.
There are multiple types of cap-removal to do.
greedy: removes all caps. GOAL -> goal, Mr. -> mr., Cook -> cook
preserve_nnp: removes capit... | mit |
leiferikb/bitpop | build/third_party/twisted_10_2/twisted/mail/pb.py | 57 | 3847 | # Copyright (c) 2001-2004 Twisted Matrix Laboratories.
# See LICENSE for details.
from twisted.spread import pb
from twisted.spread import banana
import os
import types
class Maildir(pb.Referenceable):
def __init__(self, directory, rootDirectory):
self.virtualDirectory = directory
self.rootDire... | gpl-3.0 |
exelearning/iteexe | nevow/stan.py | 14 | 16657 | # Copyright (c) 2004 Divmod.
# See LICENSE for details.
"""An s-expression-like syntax for expressing xml in pure python.
Stan tags allow you to build XML documents using Python. Stan tags
have special attributes that enable the developer to insert hooks in
the document for locating data and custom rendering.
Stan i... | gpl-2.0 |
keto/askbot-devel | askbot/migrations/0058_transplant_answer_count_field_2.py | 17 | 26835 | # 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):
# Deleting field 'Question.answer_count'
db.delete_column(u'question', 'answer_count')
def backwards... | gpl-3.0 |
grlee77/nipype | nipype/interfaces/mrtrix/tests/test_auto_ConstrainedSphericalDeconvolution.py | 9 | 1849 | # AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from nipype.testing import assert_equal
from nipype.interfaces.mrtrix.tensors import ConstrainedSphericalDeconvolution
def test_ConstrainedSphericalDeconvolution_inputs():
input_map = dict(args=dict(argstr='%s',
),
debug=dict(argstr='-debug',
),
... | bsd-3-clause |
flabby/rocksdb | build_tools/amalgamate.py | 45 | 4700 | #!/usr/bin/python
# amalgamate.py creates an amalgamation from a unity build.
# It can be run with either Python 2 or 3.
# An amalgamation consists of a header that includes the contents of all public
# headers and a source file that includes the contents of all source files and
# private headers.
#
# This script work... | bsd-3-clause |
xiangel/hue | desktop/core/ext-py/Django-1.6.10/django/db/backends/oracle/base.py | 17 | 40746 | """
Oracle database backend for Django.
Requires cx_Oracle: http://cx-oracle.sourceforge.net/
"""
from __future__ import unicode_literals
import decimal
import re
import sys
import warnings
def _setup_environment(environ):
import platform
# Cygwin requires some special voodoo to set the environment variables... | apache-2.0 |
olapaola/olapaola-android-scripting | python/src/Lib/bsddb/test/test_basics.py | 31 | 32840 | """
Basic TestCases for BTree and hash DBs, with and without a DBEnv, with
various DB flags, etc.
"""
import os
import errno
import string
from pprint import pprint
import unittest
import time
from test_all import db, test_support, verbose, get_new_environment_path, \
get_new_database_path
DASH = '-'
#----... | apache-2.0 |
snakeleon/YouCompleteMe-x86 | third_party/ycmd/cpp/ycm/tests/gmock/gtest/test/gtest_color_test.py | 3259 | 4911 | #!/usr/bin/env python
#
# Copyright 2008, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list... | gpl-3.0 |
Gaojiquan/android_kernel_zte_digger | tools/perf/scripts/python/netdev-times.py | 11271 | 15048 | # Display a process of packets and processed time.
# It helps us to investigate networking or network device.
#
# options
# tx: show only tx chart
# rx: show only rx chart
# dev=: show only thing related to specified device
# debug: work with debug mode. It shows buffer status.
import os
import sys
sys.path.append(os... | gpl-2.0 |
underlost/GamerNews | gamernews/apps/threadedcomments/management/commands/migrate_threaded_comments.py | 5 | 3452 | from django.core.management.base import NoArgsCommand
from django.contrib.sites.models import Site
from django.db import transaction, connection
from django.conf import settings
from threadedcomments.models import ThreadedComment
USER_SQL = """
SELECT
content_type_id,
object_id,
parent_id,
user_id,
... | mit |
cloudera/hue | desktop/core/ext-py/Paste-2.0.1/paste/config.py | 78 | 4312 | # (c) 2006 Ian Bicking, Philip Jenvey and contributors
# Written for Paste (http://pythonpaste.org)
# Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
"""Paste Configuration Middleware and Objects"""
from paste.registry import RegistryManager, StackedObjectProxy
__all__ = ['Dispatchin... | apache-2.0 |
cedriclaunay/gaffer | apps/license/license-1.py | 7 | 3146 | ##########################################################################
#
# Copyright (c) 2011-2012, John Haddon. All rights reserved.
# Copyright (c) 2011, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provi... | bsd-3-clause |
ReganBell/QReview | networkx/utils/tests/test_heaps.py | 64 | 3979 | from nose.tools import *
import networkx as nx
from networkx.utils import *
class X(object):
def __eq__(self, other):
raise self is other
def __ne__(self, other):
raise self is not other
def __lt__(self, other):
raise TypeError('cannot compare')
def __le__(self, other):
... | bsd-3-clause |
ogajduse/spacewalk | backend/server/action/kickstart_guest.py | 10 | 4459 | #
# Copyright (c) 2008--2016 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a c... | gpl-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.