repo_name
stringlengths
5
100
path
stringlengths
4
375
copies
stringclasses
991 values
size
stringlengths
4
7
content
stringlengths
666
1M
license
stringclasses
15 values
Zaneh-/bearded-tribble-back
taiga/projects/attachments/migrations/0002_add_size_and_name_fields.py
29
1119
# -*- coding: utf-8 -*- from __future__ import unicode_literals import os.path as path from django.db import models, migrations def parse_filenames_and_sizes(apps, schema_editor): Attachment = apps.get_model("attachments", "Attachment") for item in Attachment.objects.all(): try: item.siz...
agpl-3.0
Justin-Yuan/Image2Music-Generator
library/jython2.5.3/Lib/test/testcodec.py
252
1047
""" Test Codecs (used by test_charmapcodec) Written by Marc-Andre Lemburg (mal@lemburg.com). (c) Copyright 2000 Guido van Rossum. """#" import codecs ### Codec APIs class Codec(codecs.Codec): def encode(self,input,errors='strict'): return codecs.charmap_encode(input,errors,encoding_map) def deco...
gpl-2.0
kfwang/Glance-OVA-OVF
glance/tests/__init__.py
19
1197
# Copyright 2010-2011 OpenStack Foundation # 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...
apache-2.0
KaelChen/numpy
numpy/ma/mrecords.py
90
27383
""":mod:`numpy.ma..mrecords` Defines the equivalent of :class:`numpy.recarrays` for masked arrays, where fields can be accessed as attributes. Note that :class:`numpy.ma.MaskedArray` already supports structured datatypes and the masking of individual fields. .. moduleauthor:: Pierre Gerard-Marchant """ from __future...
bsd-3-clause
szezso/android_kernel_motorola_msm8916
scripts/rt-tester/rt-tester.py
11005
5307
#!/usr/bin/python # # rt-mutex tester # # (C) 2006 Thomas Gleixner <tglx@linutronix.de> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as # published by the Free Software Foundation. # import os import sys import getopt import sh...
gpl-2.0
h2non/riprova
riprova/async_retrier.py
1
11086
# -*- coding: utf-8 -*- from six import raise_from from .backoff import Backoff from .retrier import Retrier from .constants import PY_34 from .errors import ErrorWhitelist from .strategies import ConstantBackoff from .exceptions import MaxRetriesExceeded, RetryError # Ensure user do not import this module in unsuppor...
mit
spiffytech/npcworld
lib/test_market.py
1
10747
import market def test_default_inventory(): default_amount = 10 inventory = market.Inventory() assert inventory.wood == default_amount assert inventory.food == default_amount assert inventory.ore == default_amount assert inventory.metal == default_amount assert inventory.tools == default_am...
gpl-3.0
mezz64/home-assistant
tests/components/demo/test_climate.py
9
13154
"""The tests for the demo climate component.""" import pytest import voluptuous as vol from homeassistant.components.climate.const import ( ATTR_AUX_HEAT, ATTR_CURRENT_HUMIDITY, ATTR_CURRENT_TEMPERATURE, ATTR_FAN_MODE, ATTR_HUMIDITY, ATTR_HVAC_ACTION, ATTR_HVAC_MODE, ATTR_HVAC_MODES, ...
apache-2.0
xianjunzhengbackup/Cloud-Native-Python
env/lib/python3.5/site-packages/pip/req/req_uninstall.py
510
6897
from __future__ import absolute_import import logging import os import tempfile from pip.compat import uses_pycache, WINDOWS, cache_from_source from pip.exceptions import UninstallationError from pip.utils import rmtree, ask, is_local, renames, normalize_path from pip.utils.logging import indent_log logger = loggin...
mit
rvalyi/openerp-pt_br
tests_use_case/test_create_sale_order.py
2
1035
def test_create_sale_order(oerp): sale_order_obj = oerp.pool.get('sale.order') product_obj = oerp.pool.get('product.product') sale_order_lines = [] prod1 = product_obj.browse(oerp.cr, 1, [5])[0] sol = {'name': prod1.name, 'product_uom_qty': 1, 'product_id': prod1.id, ...
agpl-3.0
airspeedswift/swift
utils/swift_build_support/swift_build_support/host_specific_configuration.py
7
14126
# swift_build_support/host_configuration_support.py -------------*- python -*- # # This source file is part of the Swift.org open source project # # Copyright (c) 2014 - 2019 Apple Inc. and the Swift project authors # Licensed under Apache License v2.0 with Runtime Library Exception # # See https://swift.org/LICENSE.tx...
apache-2.0
isaacfeng/Traffic-sign-recognition
new_try.py
1
4365
import os import random import skimage.data import skimage.transform import matplotlib import matplotlib.pyplot as plt import numpy as np import tensorflow as tf import my_lib as my sess = tf.InteractiveSession() ROOT_PATH = "GTSRB" train_data_dir = os.path.join(ROOT_PATH, "Final_Training/Images/") test_data_dir = os...
apache-2.0
JianyuWang/nova
nova/tests/functional/api_sample_tests/test_hosts.py
17
2565
# Copyright 2012 Nebula, Inc. # Copyright 2013 IBM Corp. # # 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
timesking/MITMf
core/servers/FTP.py
24
2544
#!/usr/bin/env python # This file is part of Responder # Original work by Laurent Gaffie - Trustwave Holdings # # 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, o...
gpl-3.0
ejona86/grpc
src/python/grpcio_status/grpc_status/_async.py
10
1950
# Copyright 2020 The 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 writ...
apache-2.0
fdvarela/odoo8
addons/hr_timesheet_invoice/wizard/__init__.py
433
1159
# -*- 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
cristian99garcia/pilas-activity
pilas/actores/entradadetexto.py
1
1732
# -*- encoding: utf-8 -*- # Pilas engine - A video game framework. # # Copyright 2010 - Hugo Ruscitti # License: LGPLv3 (see http://www.gnu.org/licenses/lgpl.html) # # Website - http://www.pilas-engine.com.ar from pilas.actores import Actor import pilas class EntradaDeTexto(Actor): """Representa una caja de texto...
gpl-3.0
jiemakel/omorfi
src/python/generate-yaml.py
1
4497
#!/usr/bin/env python3 # -*- coding: utf8 -*- """ This script converts TSV formatted tests to yaml formatted tests """ # Author: Tommi A Pirinen <flammie@iki.fi> 2014 # 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 # ...
gpl-3.0
r0e/servo
tests/wpt/harness/wptrunner/executors/executorselenium.py
72
9431
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http://mozilla.org/MPL/2.0/. import os import socket import sys import threading import time import traceback import urlparse import uuid from .base...
mpl-2.0
hsaputra/tensorflow
tensorflow/contrib/session_bundle/session_bundle.py
89
6887
# Copyright 2016 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
apache-2.0
kaner/gettor
lib/gettor/i18n.py
1
20837
# Copyright (c) 2008 - 2011, Jacob Appelbaum <jacob@appelbaum.net>, # Christian Fromme <kaner@strace.org> # This is Free Software. See LICENSE for license information. # -*- coding: utf-8 -*- import os import gettext def getLang(lang, config): """Return the Translation instance for a ...
bsd-3-clause
Dev4X/oppia
extensions/rules/normalized_string_test.py
20
2859
# coding: utf-8 # # Copyright 2014 The Oppia 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 requi...
apache-2.0
googleapis/googleapis-gen
google/cloud/automl/v1/automl-v1-py/google/cloud/automl_v1/types/data_items.py
1
8129
# -*- 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
piyushroshan/xen-4.3.2
tools/xm-test/lib/XmTestLib/NetConfig.py
31
8702
#!/usr/bin/python """ Copyright (C) International Business Machines Corp., 2005, 2006 Authors: Dan Smith <danms@us.ibm.com> Daniel Stekloff <dsteklof@us.ibm.com> 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 ...
gpl-2.0
MicroTrustRepos/microkernel
src/l4/pkg/python/contrib/Mac/IDLE/idlemain.py
71
2786
""" Bootstrap script for IDLE as an application bundle. """ import sys, os # Change the current directory the user's home directory, that way we'll get # a more useful default location in the open/save dialogs. os.chdir(os.path.expanduser('~/Documents')) # Make sure sys.executable points to the python interpreter in...
gpl-2.0
losnikitos/googleads-python-lib
examples/dfp/v201411/product_template_service/get_sponsorship_product_templates.py
4
1924
#!/usr/bin/python # # Copyright 2015 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 b...
apache-2.0
Djlavoy/scrapy
scrapy/loader/__init__.py
78
6221
"""Item Loader See documentation in docs/topics/loaders.rst """ from collections import defaultdict import six from scrapy.item import Item from scrapy.selector import Selector from scrapy.utils.decorators import deprecated from scrapy.utils.deprecate import create_deprecated_class from scrapy.utils.misc import arg_...
bsd-3-clause
Edraak/edraak-platform
lms/djangoapps/ccx/tests/test_models.py
9
7556
""" tests for the models """ import json from datetime import datetime, timedelta import ddt from nose.plugins.attrib import attr from pytz import utc from student.roles import CourseCcxCoachRole from student.tests.factories import AdminFactory from xmodule.modulestore.tests.django_utils import TEST_DATA_SPLIT_MODULE...
agpl-3.0
nkrinner/nova
nova/openstack/common/middleware/request_id.py
19
1423
# Copyright (c) 2013 NEC Corporation # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
apache-2.0
stuarteberg/ray
ray/classify.py
1
39656
#!/usr/bin/env python # system modules import sys, os, argparse import cPickle import logging from math import sqrt from abc import ABCMeta, abstractmethod from random import shuffle # libraries import h5py import time import itertools from numpy import bool, array, double, zeros, mean, random, concatenate, where,\ ...
mit
pilou-/ansible
lib/ansible/plugins/doc_fragments/oneview.py
43
2374
# -*- coding: utf-8 -*- # # Copyright: (c) 2016-2017, Hewlett Packard Enterprise Development LP # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) class ModuleDocFragment(object): # OneView doc fragment DOCUMENTATION = r''' options: config: description: ...
gpl-3.0
rajanshah/dx
dx/dx_valuation.py
5
49297
# # DX Analytics # Derivatives Instruments and Portfolio Valuation Classes # dx_valuation.py # # DX Analytics is a financial analytics library, mainly for # derviatives modeling and pricing by Monte Carlo simulation # # (c) Dr. Yves J. Hilpisch # The Python Quants GmbH # # This program is free software: you can redistr...
agpl-3.0
talishte/ctigre
env/lib/python2.7/site-packages/django/utils/encoding.py
92
9512
from __future__ import unicode_literals import codecs import datetime from decimal import Decimal import locale import warnings from django.utils.functional import Promise from django.utils import six from django.utils.six.moves.urllib.parse import quote class DjangoUnicodeDecodeError(UnicodeDecodeError): def __...
bsd-2-clause
alienlike/courier
courier/fsio.py
1
1420
import os import string from pkg_resources import resource_filename datadir = resource_filename(__name__, '.data') class FileSystemIO: # generate the absolute and relative paths for a message element def get_path(self, msg_elem_id): # convert id to a 20-character string padded with zeros msg...
gpl-3.0
openstack/python-openstacksdk
openstack/tests/unit/block_storage/v2/test_stats.py
2
1622
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under t...
apache-2.0
rihtak/foursquared.eclair
util/gen_parser.py
262
4392
#!/usr/bin/python import datetime import sys import textwrap import common from xml.dom import pulldom PARSER = """\ /** * Copyright 2009 Joe LaPenna */ package com.joelapenna.foursquare.parsers; import com.joelapenna.foursquare.Foursquare; import com.joelapenna.foursquare.error.FoursquareError; import com.joel...
apache-2.0
adlnet-archive/edx-platform
lms/djangoapps/foldit/views.py
191
6365
import hashlib import json import logging from django.contrib.auth.decorators import login_required from django.http import HttpResponse from django.views.decorators.http import require_POST from django.views.decorators.csrf import csrf_exempt from foldit.models import Score, PuzzleComplete from student.models import...
agpl-3.0
gooli/termenu
termenu/ansi.py
1
2889
from __future__ import print_function import errno import sys import re import os COLORS = dict(black=0, red=1, green=2, yellow=3, blue=4, magenta=5, cyan=6, white=7, default=9) def write(text): written = 0 fd = sys.stdout.fileno() while written < len(text): remains = text[written:].encode("utf8"...
mit
bhargav2408/kivy
examples/widgets/effectwidget2.py
43
1264
''' This is an example of creating your own effect by writing a glsl string. ''' from kivy.base import runTouchApp from kivy.lang import Builder from kivy.uix.effectwidget import EffectWidget, EffectBase # The effect string is glsl code defining an effect function. effect_string = ''' vec4 effect(vec4 color, sampler...
mit
puzan/ansible
lib/ansible/plugins/action/ios_config.py
126
4162
# # (c) 2017, Red Hat, Inc. # # 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...
gpl-3.0
aponxi/libmysqlpp
bakefile-0.2.9/src/portautils.py
1
3095
# # This file is part of Bakefile (http://www.bakefile.org) # # Copyright (C) 2003,2004,2008 Vaclav Slavik # # 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, includin...
lgpl-2.1
rrauenza/factory_boy
factory/builder.py
1
12577
"""Build factory instances.""" import collections from . import declarations from . import enums from . import errors from . import utils DeclarationWithContext = collections.namedtuple( 'DeclarationWithContext', ['name', 'declaration', 'context'], ) PostGenerationContext = collections.namedtuple( 'Po...
mit
grandtiger/profitpy
profit/series/advanced.py
18
10262
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 2007 Troy Melhase # Distributed under the terms of the GNU General Public License v2 # Author: Troy Melhase <troy@gci.net> from numpy import arctan, array, log, mean, std, median from scipy.stats import linregress, mode from profit.series.basic import SeriesI...
gpl-2.0
bhtucker/perceptron_viz
voweler/perceptron.py
1
1376
# -*- coding: utf-8 -*- """ perceptron ~~~~~~~~~~ Module for our learning node logic """ import numpy as np import math from string import ascii_lowercase from letters import is_vowel class Perceptron(object): """Basic Perceptron functionality: store weights, apply them to points, update weights...
mit
stevenewey/django
setup.py
123
3257
import os import sys from distutils.sysconfig import get_python_lib from setuptools import find_packages, setup # Warn if we are installing over top of an existing installation. This can # cause issues where files that were deleted from a more recent Django are # still present in site-packages. See #18115. overlay_wa...
bsd-3-clause
learking/aaCodonProbPred
predAAprob/aa_studyHydro.py
1
1256
import sys from aaProbSolver import * import re import glob import math #'L' is the reference codon aaList = ['A','C','D','E','F','G','H','I','K','L','M','N','P','Q','R','S','T','V','W','Y'] #coef file and folders ...
gpl-2.0
zaclimon/Quanta-Flo
tools/perf/util/setup.py
4998
1330
#!/usr/bin/python2 from distutils.core import setup, Extension from os import getenv from distutils.command.build_ext import build_ext as _build_ext from distutils.command.install_lib import install_lib as _install_lib class build_ext(_build_ext): def finalize_options(self): _build_ext.finalize_optio...
gpl-2.0
mzizzi/ansible
lib/ansible/modules/files/blockinfile.py
24
10652
#!/usr/bin/python # -*- coding: utf-8 -*- # (c) 2014, 2015 YAEGASHI Takeshi <yaegashi@debian.org> # # 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 ...
gpl-3.0
AnishShah/tensorflow
tensorflow/contrib/data/python/kernel_tests/serialization/dataset_constructor_serialization_test.py
14
3762
# 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
javiergarridomellado/Empresa_django
devcodela/lib/python2.7/site-packages/django/contrib/contenttypes/management.py
96
2903
from django.contrib.contenttypes.models import ContentType from django.db import DEFAULT_DB_ALIAS, router from django.db.models import get_apps, get_models, signals from django.utils.encoding import smart_text from django.utils import six from django.utils.six.moves import input def update_contenttypes(app, created_m...
gpl-2.0
bigdatauniversity/edx-platform
common/djangoapps/util/request.py
163
1285
""" Utility functions related to HTTP requests """ import re from django.conf import settings from microsite_configuration import microsite from opaque_keys import InvalidKeyError from opaque_keys.edx.locations import SlashSeparatedCourseKey COURSE_REGEX = re.compile(r'^.*?/courses/{}'.format(settings.COURSE_ID_PAT...
agpl-3.0
ltilve/ChromiumGStreamerBackend
tools/telemetry/third_party/gsutilz/third_party/httplib2/python2/httplib2/socks.py
811
18459
"""SocksiPy - Python SOCKS module. Version 1.00 Copyright 2006 Dan-Haim. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this ...
bsd-3-clause
qnu/paratrac
fs/data.py
1
16469
############################################################################# # ParaTrac: Scalable Tracking Tools for Parallel Applications # Copyright (C) 2009,2010 Nan Dun <dunnan@yl.is.s.u-tokyo.ac.jp> # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Pu...
gpl-3.0
DrXyzzy/smc
src/smc_pyutil/smc_pyutil/status.py
1
1405
#!/usr/bin/python import json, os SMC = os.environ['SMC'] os.chdir(SMC) status = {} def set(prop, val): status[prop] = val def read(prop, filename, strip=False, int_value=False, to_int=False): try: s = open(filename).read() if strip: s = s.strip() if '.port' in prop: ...
agpl-3.0
freakboy3742/django
tests/asgi/tests.py
13
11078
import asyncio import sys import threading from pathlib import Path from unittest import skipIf from asgiref.sync import SyncToAsync from asgiref.testing import ApplicationCommunicator from django.contrib.staticfiles.handlers import ASGIStaticFilesHandler from django.core.asgi import get_asgi_application from django....
bsd-3-clause
360youlun/cmsplugin-bootstrap-carousel
cmsplugin_bootstrap_carousel/models_default.py
1
3456
# coding: utf-8 import os from django.db import models from django.core.files.uploadedfile import SimpleUploadedFile from django.utils.translation import ugettext_lazy as _ from cms.models.pluginmodel import CMSPlugin from PIL import Image from cStringIO import StringIO from . import config class Carousel(CMSPlugin)...
bsd-3-clause
virtualopensystems/nova
nova/tests/network/test_manager.py
1
147793
# Copyright 2011 Rackspace # Copyright (c) 2011 X.commerce, a business unit of eBay Inc. # Copyright 2013 IBM Corp. # 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 # # ...
apache-2.0
DirectDev/wds-V2
www/admin/plugins/ionicons/builder/scripts/generate_font.py
348
5381
# Font generation script from FontCustom # https://github.com/FontCustom/fontcustom/ # http://fontcustom.com/ import fontforge import os import md5 import subprocess import tempfile import json import copy SCRIPT_PATH = os.path.dirname(os.path.abspath(__file__)) INPUT_SVG_DIR = os.path.join(SCRIPT_PATH, '..', '..', '...
mit
CompMusic/essentia
src/examples/tutorial/extractor_predominantmelody.py
10
2747
# Copyright (C) 2006-2013 Music Technology Group - Universitat Pompeu Fabra # # This file is part of Essentia # # Essentia is free software: you can redistribute it and/or modify it under # the terms of the GNU Affero General Public License as published by the Free # Software Foundation (FSF), either version 3 of the ...
agpl-3.0
YingYang/STFT_R_git_repo
MNE_stft/mne_regression.py
1
7284
# -*- coding: utf-8 -*- """ Created on Tue Apr 1 12:55:06 2014 @author: ying """ import mne import numpy as np import numpy.linalg as la from mne_stft_regression import _apply_inverse_evoked_list # =========================================================================== def mne_regression(evoked_list, inverse_ope...
gpl-3.0
OpenFacetracker/facetracker-core
lib/youtube-dl/youtube_dl/downloader/__init__.py
8
1105
from __future__ import unicode_literals from .common import FileDownloader from .external import get_external_downloader from .f4m import F4mFD from .hls import HlsFD from .hls import NativeHlsFD from .http import HttpFD from .mplayer import MplayerFD from .rtmp import RtmpFD from ..utils import ( determine_proto...
gpl-2.0
swapnakrishnan2k/tp-qemu
qemu/tests/virtio_port_login.py
9
4239
""" Collection of virtio_console and virtio_serialport tests. :copyright: 2010-2012 Red Hat Inc. """ import logging import aexpect from autotest.client.shared import error from virttest import utils_misc from virttest import remote from virttest import utils_virtio_port class ConsoleLoginTest(utils_virtio_port.Vi...
gpl-2.0
Johnetordoff/osf.io
admin/registration_providers/urls.py
5
1610
from django.conf.urls import url from . import views app_name = 'admin' urlpatterns = [ url(r'^create/$', views.CreateRegistrationProvider.as_view(), name='create'), url(r'^$', views.RegistrationProviderList.as_view(), name='list'), url(r'^import/$', views.ImportRegistrationProvider.as_view(), name='impor...
apache-2.0
dbcls/dbcls-galaxy
lib/galaxy/util/heartbeat.py
3
3730
# Attempt to load threadframe module, and only define Heartbeat class # if available try: import pkg_resources pkg_resources.require( "threadframe" ) except: import sys print >> sys.stderr, "No threadframe module, Heartbeat not available" Heartbeat = None else: import threadin...
mit
QijunPan/ansible
lib/ansible/modules/cloud/ovirt/ovirt_tags_facts.py
13
4781
#!/usr/bin/python # -*- coding: utf-8 -*- # # Copyright (c) 2016 Red Hat, Inc. # # 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 #...
gpl-3.0
eugena/django
tests/select_for_update/tests.py
203
9626
from __future__ import unicode_literals import threading import time from multiple_database.routers import TestRouter from django.conf import settings from django.db import connection, router, transaction from django.db.utils import DEFAULT_DB_ALIAS, ConnectionHandler, DatabaseError from django.test import ( Tra...
bsd-3-clause
vlinhd11/vlinhd11-android-scripting
python/gdata/src/gdata/experimental_oauth.py
133
4540
#!/usr/bin/env python import binascii import urllib import time import random import hmac from gdata.tlslite.utils import keyfactory from gdata.tlslite.utils import cryptomath OAUTH_VERSION = '1.0' def get_normalized_http_url(http_request): full_url = http_request.uri.to_string() return full_url[:full_url.find('...
apache-2.0
algorhythms/LintCode
Subarray Sum II.py
4
1766
""" Given an integer array, find a subarray where the sum of numbers is between two given interval. Your code should return the number of possible answer. Have you met this question in a real interview? Yes Example Given [1,2,3,4] and interval = [1,3], return 4. The possible answers are: [0, 0] [0, 1] [1, 1] [3, 3] ...
apache-2.0
Gendreau/SnapchatBot
snapchat_bots/bot.py
4
6980
import logging, time, uuid, requests, base64 from pysnap import Snapchat from pysnap.utils import make_request_token, timestamp from snap import Snap from constants import DEFAULT_TIMEOUT, STATIC_TOKEN, BASE_URL FORMAT = '[%(asctime)-15s] %(message)s' logging.basicConfig(format=FORMAT) logger = logging.getLogger() log...
mit
dmoliveira/vim-bootstrap
lib/jinja2/runtime.py
606
19558
# -*- coding: utf-8 -*- """ jinja2.runtime ~~~~~~~~~~~~~~ Runtime helpers. :copyright: (c) 2010 by the Jinja Team. :license: BSD. """ from itertools import chain from jinja2.nodes import EvalContext, _context_function_types from jinja2.utils import Markup, soft_unicode, escape, missing, concat, \ ...
mit
mujiansu/arangodb
3rdParty/V8-4.3.61/third_party/python_26/Lib/test/test_multiprocessing.py
48
55201
#!/usr/bin/env python # # Unit tests for the multiprocessing package # import unittest import threading import Queue import time import sys import os import gc import signal import array import copy import socket import random import logging # Work around broken sem_open implementations try: import multiprocess...
apache-2.0
Glutanimate/image-occlusion-enhanced
src/image_occlusion_enhanced/editor.py
1
16200
# -*- coding: utf-8 -*- #################################################### ## ## ## Image Occlusion Enhanced ## ## ## ## Copyright (c) Glutanimate 2016-2017 ## ## (https://github.com/Gl...
bsd-2-clause
chillinc/angel
lib/devops/settings_helpers.py
2
1374
import sys def key_value_string_to_dict(data_string, key_value_separator='='): ''' Given a string like: key=value\nkey2=value2 Return a dict with data[key] = values. - Ignores all lines that start with # or are empty. - Returns None on any parse errors. - Strips leading...
apache-2.0
topxiaoke/myedx
cms/djangoapps/contentstore/features/video_editor.py
33
11227
# -*- coding: utf-8 -*- # disable missing docstring # pylint: disable=C0111 import requests from lettuce import world, step from nose.tools import assert_true, assert_equal, assert_in, assert_not_equal # pylint: disable=E0611 from terrain.steps import reload_the_page from django.conf import settings from common impor...
agpl-3.0
lgarren/spack
var/spack/repos/builtin/packages/kahip/package.py
3
3520
############################################################################## # Copyright (c) 2017 Christian Schulz # Karlsruhe Institute of Technology (KIT), Karlsruhe, Germany # # This file is released as part of Spack under the LGPL license # LLNL-CODE-647188 # # For details, see https://github.com/llnl/spack # Ple...
lgpl-2.1
chemelnucfin/tensorflow
tensorflow/contrib/distributions/python/ops/kumaraswamy.py
1
9274
# Copyright 2016 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
apache-2.0
workflo/dxf2gcode
python_examples/gtk/pygtkcanvas-1.0/canvas.py
1
11443
__all__ = ['Canvas'] import pygtk pygtk.require("2.0") import gtk import gobject import cairo from math import pi from canvasmath import * class Canvas(gtk.DrawingArea): def __init__(self): gtk.DrawingArea.__init__(self) self.set_double_buffered(False) self.add_events( gtk.gdk....
gpl-3.0
jamesbeebop/mkdocs
mkdocs/commands/new.py
30
1433
# coding: utf-8 from __future__ import unicode_literals import io import logging import os config_text = 'site_name: My Docs\n' index_text = """# Welcome to MkDocs For full documentation visit [mkdocs.org](http://mkdocs.org). ## Commands * `mkdocs new [dir-name]` - Create a new project. * `mkdocs serve` - Start th...
bsd-2-clause
krikru/tensorflow-opencl
tensorflow/python/kernel_tests/fractional_avg_pool_op_test.py
107
21031
# Copyright 2016 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
apache-2.0
roambotics/swift
utils/create-filecheck-test.py
33
1349
#!/usr/bin/env python # The following script takes as input a SIL fragment and changes all # SSA variables into FileCheck variables. This significantly reduces # the amount of time required for creating complicated FileCheck # Tests. import argparse import re import sys import textwrap parser = argparse.ArgumentPars...
apache-2.0
chuan9/chromium-crosswalk
tools/multi_process_rss.py
128
3646
#!/usr/bin/env python # Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # Counts a resident set size (RSS) of multiple processes without double-counts. # If they share the same page frame, the page frame is ...
bsd-3-clause
kctan0805/vdpm
share/gdal/gdal-2.0.0/swig/python/samples/ogr_layer_algebra.py
1
16666
#!/usr/bin/env python # -*- coding: utf-8 -*- #****************************************************************************** # $Id: ogr_layer_algebra.py 29254 2015-05-27 12:45:56Z rouault $ # # Project: GDAL Python Interface # Purpose: Application for executing OGR layer algebra operations # Author: Even Roua...
lgpl-2.1
kosz85/django
tests/basic/tests.py
8
29560
import threading from datetime import datetime, timedelta from django.core.exceptions import MultipleObjectsReturned, ObjectDoesNotExist from django.db import DEFAULT_DB_ALIAS, DatabaseError, connections from django.db.models.manager import BaseManager from django.db.models.query import EmptyQuerySet, QuerySet from dj...
bsd-3-clause
AdrianGaudebert/socorro
socorro/unittest/external/rabbitmq/test_connection_context.py
3
8203
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. from nose.tools import eq_, ok_, assert_raises from mock import ( Mock, call, patch ) from threading import ...
mpl-2.0
BNUCNL/FreeROI
froi/algorithm/unused/spectralmapper.py
6
3516
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """Mapper for spectral clustering. Date: 2012.05.29 """ __docformat__ = 'restructuredtext' import numpy as np import scipy.sparse as sp from mvpa2.base import warning from mvpa2.base.doc...
bsd-3-clause
kou/zulip
zerver/lib/markdown/fenced_code.py
2
16289
""" Fenced Code Extension for Python Markdown ========================================= This extension adds Fenced Code Blocks to Python-Markdown. >>> import markdown >>> text = ''' ... A paragraph before a fenced code block: ... ... ~~~ ... Fenced code block ... ~~~ ... ''' >>> ht...
apache-2.0
lachlandeer/bom-scraper
src/lib/processBoxOfficeReturns.py
1
10372
""" This collection of functions scrapes Box Office Returns at the weekly, weekend, and daily levels from a film's page on Box Office Mojo. Last Edit: March, 2017 """ import requests from bs4 import BeautifulSoup import re import dateutil.parser from string import ascii_uppercase import pandas as pd # import pickle i...
mit
qlands/onadata
onadata/apps/logger/migrations/0029_auto__chg_field_attachment_mimetype__add_field_xform_encrypted__add_fi.py
13
10462
# -*- coding: 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): # Changing field 'Attachment.mimetype' db.alter_column(u'odk_logger_attachment', 'mimetype', self.gf('djang...
bsd-2-clause
collex100/odoo
addons/mrp/wizard/stock_move.py
110
3398
# -*- 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
rynomster/django
django/contrib/gis/geos/prototypes/io.py
25
9981
import threading from ctypes import POINTER, Structure, byref, c_char, c_char_p, c_int, c_size_t from django.contrib.gis.geos.base import GEOSBase from django.contrib.gis.geos.libgeos import GEOM_PTR, GEOSFuncFactory from django.contrib.gis.geos.prototypes.errcheck import ( check_geom, check_sized_string, check_st...
bsd-3-clause
kenden/lollypop
src/toolbar_end.py
1
7416
# Copyright (c) 2014-2015 Cedric Bellegarde <cedric.bellegarde@adishatz.org> # 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 vers...
gpl-3.0
ar45/django
tests/template_tests/filter_tests/test_length.py
521
1900
from django.template.defaultfilters import length from django.test import SimpleTestCase from django.utils.safestring import mark_safe from ..utils import setup class LengthTests(SimpleTestCase): @setup({'length01': '{{ list|length }}'}) def test_length01(self): output = self.engine.render_to_string...
bsd-3-clause
pleaseproject/python-for-android
python3-alpha/python3-src/Lib/test/test_operator.py
67
16993
import operator import unittest from test import support class Seq1: def __init__(self, lst): self.lst = lst def __len__(self): return len(self.lst) def __getitem__(self, i): return self.lst[i] def __add__(self, other): return self.lst + other.lst def __mul__(self, ...
apache-2.0
schlueter/ansible
test/runner/lib/sanity/pylint.py
9
9399
"""Sanity test using pylint.""" from __future__ import absolute_import, print_function import collections import json import os import datetime try: import ConfigParser as configparser except ImportError: import configparser from lib.sanity import ( SanitySingleVersion, SanityMessage, SanityFailu...
gpl-3.0
Refefer/pylearn2
pylearn2/devtools/list_files.py
45
1772
"""Code for listing files that belong to the library.""" import logging import pylearn2 import os __authors__ = "Ian Goodfellow" __copyright__ = "Copyright 2010-2012, Universite de Montreal" __credits__ = ["Ian Goodfellow"] __license__ = "3-clause BSD" __maintainer__ = "LISA Lab" __email__ = "pylearn-dev@googlegroups" ...
bsd-3-clause
arnoldthebat/linux-stable
scripts/gdb/linux/lists.py
630
2897
# # gdb helper commands and functions for Linux kernel debugging # # list tools # # Copyright (c) Thiebaud Weksteen, 2015 # # Authors: # Thiebaud Weksteen <thiebaud@weksteen.fr> # # This work is licensed under the terms of the GNU GPL version 2. # import gdb from linux import utils list_head = utils.CachedType("st...
gpl-2.0
AIML/scikit-learn
sklearn/linear_model/randomized_l1.py
33
23358
""" Randomized Lasso/Logistic: feature selection based on Lasso and sparse Logistic Regression """ # Author: Gael Varoquaux, Alexandre Gramfort # # License: BSD 3 clause import itertools from abc import ABCMeta, abstractmethod import warnings import numpy as np from scipy.sparse import issparse from scipy import spar...
bsd-3-clause
dulems/hue
desktop/core/ext-py/MySQL-python-1.2.5/setup_common.py
47
1088
try: # Python 2.x from ConfigParser import SafeConfigParser except ImportError: # Python 3.x from configparser import ConfigParser as SafeConfigParser def get_metadata_and_options(): config = SafeConfigParser() config.read(['metadata.cfg', 'site.cfg']) metadata = dict(config.items('metadat...
apache-2.0
chouseknecht/ansible
lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py
5
11789
#!/usr/bin/python # -*- coding: utf-8 -*- # # Copyright (C) 2017 Google # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) # ---------------------------------------------------------------------------- # # *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** # ...
gpl-3.0
Caoimhinmg/PmagPy
dialogs/pmag_basic_dialogs_native3.py
1
142122
#!/usr/bin/env pythonw #-------------------------------------------------------------- # converting magnetometer files to MagIC format #-------------------------------------------------------------- import wx import wx.grid import os import subprocess import sys from pmagpy import pmag from pmagpy import ipmag from di...
bsd-3-clause