repo_name stringlengths 5 100 | ref stringlengths 12 67 | path stringlengths 4 244 | copies stringlengths 1 8 | content stringlengths 0 1.05M ⌀ |
|---|---|---|---|---|
chriscrosscutler/scikit-image | refs/heads/master | skimage/morphology/tests/test_selem.py | 37 | """
Tests for Morphological structuring elements
(skimage.morphology.selem)
Author: Damian Eads
"""
import os.path
import numpy as np
from numpy.testing import assert_equal
from skimage import data_dir
from skimage.morphology import selem
class TestSElem():
def test_square_selem(self):
"""Test square ... |
MattsFleaMarket/python-for-android | refs/heads/master | python3-alpha/python3-src/Lib/idlelib/ObjectBrowser.py | 67 | # XXX TO DO:
# - popup menu
# - support partial or total redisplay
# - more doc strings
# - tooltips
# object browser
# XXX TO DO:
# - for classes/modules, add "open source" to object browser
from idlelib.TreeWidget import TreeItem, TreeNode, ScrolledCanvas
from reprlib import Repr
myrepr = Repr()
myrepr.maxstring... |
ishay2b/tensorflow | refs/heads/segnet | tensorflow/python/kernel_tests/sparse_concat_op_test.py | 138 | # 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... |
anurag313/scikit-learn | refs/heads/master | sklearn/covariance/robust_covariance.py | 198 | """
Robust location and covariance estimators.
Here are implemented estimators that are resistant to outliers.
"""
# Author: Virgile Fritsch <virgile.fritsch@inria.fr>
#
# License: BSD 3 clause
import warnings
import numbers
import numpy as np
from scipy import linalg
from scipy.stats import chi2
from . import empir... |
passiweinberger/nupic | refs/heads/master | tests/integration/nupic/opf/opf_checkpoint_test/experiments/backwards_compatibility/base.py | 62 | # ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2012-2015, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This p... |
snehasi/servo | refs/heads/master | tests/wpt/css-tests/tools/pywebsocket/src/mod_pywebsocket/handshake/_base.py | 652 | # Copyright 2012, 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 of conditions and the f... |
Neetuj/softlayer-python | refs/heads/master | SoftLayer/CLI/loadbal/__init__.py | 8 | """Load balancers."""
from SoftLayer.CLI import exceptions
def parse_id(input_id):
"""Parse the load balancer kind and actual id from the "kind:id" form."""
parts = input_id.split(':')
if len(parts) != 2:
raise exceptions.CLIAbort(
'Invalid ID %s: ID should be of the form "kind:id"' %... |
leppa/home-assistant | refs/heads/dev | tests/components/mqtt/conftest.py | 18 | """Test fixtures for mqtt component."""
import pytest
from tests.common import async_mock_mqtt_component
@pytest.fixture
def mqtt_mock(loop, hass):
"""Fixture to mock MQTT."""
client = loop.run_until_complete(async_mock_mqtt_component(hass))
client.reset_mock()
return client
|
AKVorrat/ueberwachungspaket.at | refs/heads/master | config/mail.py | 1 | #-*- coding: utf-8 -*-
MAIL_DISCLAIMER = "Diese E-Mail wird übermittelt im Namen von: {name_user}, {mail_user}"
MAIL_REPRESENTATIVE = """
{salutation} {name_rep},
das geplante Überwachungspaket im neuen Regierungsprogramm vom 30. Jänner 2017 erfüllt mich mit großer Besorgnis. Die vorgeschlagenen Maßnahmen laufen au... |
DazWorrall/ansible | refs/heads/devel | contrib/inventory/vagrant.py | 148 | #!/usr/bin/env python
"""
Vagrant external inventory script. Automatically finds the IP of the booted vagrant vm(s), and
returns it under the host group 'vagrant'
Example Vagrant configuration using this script:
config.vm.provision :ansible do |ansible|
ansible.playbook = "./provision/your_playbook.yml"
... |
lmazuel/azure-sdk-for-python | refs/heads/master | azure-mgmt-servicebus/azure/mgmt/servicebus/models/sb_namespace_update_parameters.py | 2 | # 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 ... |
windyuuy/opera | refs/heads/master | chromium/src/third_party/python_26/Lib/test/test_future4.py | 58 | from __future__ import unicode_literals
import unittest
from test import test_support
class TestFuture(unittest.TestCase):
def assertType(self, obj, typ):
self.assert_(type(obj) is typ,
"type(%r) is %r, not %r" % (obj, type(obj), typ))
def test_unicode_strings(self):
self.assertTy... |
iivic/BoiseStateX | refs/heads/master | openedx/core/djangoapps/credit/routers.py | 138 | """ DRF routers. """
from rest_framework import routers
class SimpleRouter(routers.SimpleRouter):
""" Simple DRF router. """
# Note (CCB): This is a retrofit of a DRF 2.4 feature onto DRF 2.3. This is, sadly, simpler than
# updating edx-ora2 to work with DRF 2.4. See https://github.com/tomchristie/djang... |
plotly/plotly.py | refs/heads/master | packages/python/plotly/plotly/validators/scattergeo/_geo.py | 1 | import _plotly_utils.basevalidators
class GeoValidator(_plotly_utils.basevalidators.SubplotidValidator):
def __init__(self, plotly_name="geo", parent_name="scattergeo", **kwargs):
super(GeoValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
dflt... |
tbeadle/django | refs/heads/master | tests/known_related_objects/models.py | 269 | """
Existing related object instance caching.
Test that queries are not redone when going back through known relations.
"""
from django.db import models
class Tournament(models.Model):
name = models.CharField(max_length=30)
class Organiser(models.Model):
name = models.CharField(max_length=30)
class Pool... |
aplicatii-romanesti/allinclusive-kodi-pi | refs/heads/master | .kodi/addons/plugin.video.p2p-streams/resources/core/autoconf.py | 4 | # -*- coding: utf-8 -*-
""" p2p-streams (c) 2014 enen92 fightnight
This file contains a single function. It's a function that will run on the addon first boot to download and configure the system for acestream/sopcast. The platform will be automatically detected and the necessary files downloaded and extracted ... |
XiaofengZhu/atlasifyUI | refs/heads/master | run.py | 125 | #!flask/bin/python
from app import app
app.run(debug=True)
|
bsn069/ssdb | refs/heads/master | deps/cpy/antlr3/dottreegen.py | 105 | """ @package antlr3.dottreegenerator
@brief ANTLR3 runtime package, tree module
This module contains all support classes for AST construction and tree parsers.
"""
# begin[licence]
#
# [The "BSD licence"]
# Copyright (c) 2005-2008 Terence Parr
# All rights reserved.
#
# Redistribution and use in source and binary fo... |
idovear/odoo | refs/heads/master | addons/mail/__openerp__.py | 257 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2010-Today OpenERP S.A. (<http://www.openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the term... |
globocom/database-as-a-service | refs/heads/master | dbaas/physical/migrations/0085_auto__add_field_databaseinfra_ssl_expire_at.py | 1 | # -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'DatabaseInfra.ssl_expire_at'
db.add_column(u'physical_dat... |
fjferrer/angr | refs/heads/master | angr/surveyor.py | 9 | #!/usr/bin/env python
import multiprocessing
#import concurrent.futures
import logging
import weakref
import functools
l = logging.getLogger("angr.surveyor")
#
# Surveyor debugging
#
STOP_RUNS = False
PAUSE_RUNS = False
def enable_singlestep():
global PAUSE_RUNS
PAUSE_RUNS = True
def disable_singlestep():... |
nhomar/odoo-mirror | refs/heads/8.0 | addons/base_report_designer/plugin/openerp_report_designer/bin/script/Change.py | 293 | #########################################################################
#
# Copyright (c) 2003-2004 Danny Brewer d29583@groovegarden.com
# Copyright (C) 2004-2010 OpenERP SA (<http://openerp.com>).
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser Gene... |
rismalrv/edx-platform | refs/heads/master | cms/djangoapps/contentstore/signals.py | 51 | """ receivers of course_published and library_updated events in order to trigger indexing task """
from datetime import datetime
from pytz import UTC
from django.dispatch import receiver
from xmodule.modulestore.django import SignalHandler
from contentstore.courseware_index import CoursewareSearchIndexer, LibrarySea... |
nataliakoval/mic | refs/heads/master | mic/3rdparty/pykickstart/commands/fcoe.py | 10 | #
# Hans de Goede <hdegoede@redhat.com>
#
# Copyright 2009 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use, modify,
# copy, or redistribute it subject to the terms and conditions of the GNU
# General Public License v.2. This program is distributed in the hope that it
# will be us... |
Pazitos10/TNT | refs/heads/master | webapp/app/tntserver/asgi.py | 1 | import os
import channels.asgi
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tntserver.settings")
channel_layer = channels.asgi.get_channel_layer()
|
jefimenko/network_tools | refs/heads/master | test_http.py | 1 | from echo_server\
import create_server_socket, response_ok, response_error, parse_request
import pytest
def test_ok():
assert response_ok() == """\
HTTP/1.1 200 OK\r\n\
"""
def test_error():
assert """\
HTTP/1.1 403 Forbidden\r\n\
""" == response_error(ValueError('403', "Forbidden"))
def test_parse():... |
pgmcd/ansible | refs/heads/devel | lib/ansible/plugins/lookup/pipe.py | 184 | # (c) 2012, Daniel Hokka Zakrisson <daniel@hozac.com>
#
# 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 lat... |
afourmy/pyNMS | refs/heads/master | pyNMS/pyQT_widgets/Q_dict_tree_view.py | 2 | from PyQt5.QtWidgets import QTreeView
from PyQt5.QtGui import QStandardItem, QStandardItemModel
class QDictTreeView(QTreeView):
def __init__(self, data=None):
super().__init__()
self.header().hide()
self.root_model = QStandardItemModel()
self.setModel(self.root_model)
i... |
Abi1ity/uniclust2.0 | refs/heads/master | flask/lib/python2.7/site-packages/sqlalchemy/sql/expression.py | 17 | # sql/expression.py
# Copyright (C) 2005-2012 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
"""Defines the base components of SQL expression trees.
All components are derived ... |
ChillarAnand/elpy | refs/heads/master | setup.py | 7 | #!/usr/bin/env python
from setuptools import setup, find_packages
import elpy
setup(
name="elpy",
version=elpy.__version__,
description="Backend for the elpy Emacs mode",
long_description=elpy.__doc__,
url="https://github.com/jorgenschaefer/elpy",
author="Jorgen Schaefer",
author_email="c... |
garvitr/sympy | refs/heads/master | sympy/polys/tests/test_injections.py | 126 | """Tests for functions that inject symbols into the global namespace. """
from sympy.polys.rings import vring
from sympy.polys.fields import vfield
from sympy.polys.domains import QQ
from sympy.utilities.pytest import raises
# make r1 with call-depth = 1
def _make_r1():
return vring("r1", QQ)
# make r2 with cal... |
Fiedzia/Django-facebook | refs/heads/master | docs/docs_env/Lib/encodings/ascii.py | 858 | """ Python 'ascii' 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 intended.
... |
Jonekee/chromium.src | refs/heads/nw12 | tools/telemetry/telemetry/web_perf/metrics/mainthread_jank_stats.py | 92 | # 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.
# A top level slice of a main thread can cause the webapp to behave
# unresponsively if its thread duration is greater than or equals to
# USER_PERCEIVABLE_... |
lilleswing/deepchem | refs/heads/master | examples/kaggle/KAGGLE_tf_singletask.py | 6 | """
Script that trains Tensorflow Singletask models on KAGGLE dataset.
"""
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
import os
import numpy as np
import tempfile
import shutil
import deepchem as dc
from deepchem.molnet import load_kaggle
###Load data... |
spalladino/algoritmos-gcba | refs/heads/master | codigo/python-binaria/binaria.py | 1 | # Version iterativa de la funcion busqueda binaria
# TAREA: Hacer la version recursiva
def busquedaBinaria(buscado, arreglo):
desde = 0
hasta = len(arreglo)-1
while desde < hasta:
medio = (desde + hasta) / 2
if arreglo[medio] > buscado:
hasta = medio -1
elif arreglo[medio... |
gnuhub/intellij-community | refs/heads/master | python/helpers/pydev/pydevd_attach_to_process/winappdbg/plugins/do_example.py | 100 | #!~/.wine/drive_c/Python25/python.exe
# -*- coding: utf-8 -*-
# Command line debugger using WinAppDbg
# Example command
# Copyright (c) 2009-2014, Mario Vilas
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditio... |
BhallaLab/moose-full | refs/heads/master | moose-examples/tutorials/Rdesigneur/proto20.py | 2 | #/* FILE INFORMATION
#** Based mostly on the traub91proto.g by Dave Beeman
#** Main difference is addition of Glu and NMDA channels
#** The 1991 Traub set of voltage and concentration dependent channels
#** Implemented as tabchannels by : Dave Beeman
#** R.D.Traub, R. K. S. Wong, R. Miles, and H. Michelson
#** Jou... |
jaruba/chromium.src | refs/heads/nw12 | build/android/pylib/utils/timeout_retry_unittest.py | 99 | # 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.
"""Unittests for timeout_and_retry.py."""
import unittest
from pylib.utils import reraiser_thread
from pylib.utils import timeout_retry
class TestExcepti... |
TactileUniverse/3D-Printed-Galaxy-Software | refs/heads/master | tactile_universe_plugin/name_plate.py | 1 | import bpy
import math
from mathutils import Vector, Matrix
from bpy.props import FloatProperty, BoolProperty, StringProperty
class NamePlate(bpy.types.Operator):
'''TU Name Plate'''
bl_idname = 'object.name_plate'
bl_label = 'Make a name plate for Tactile Universe model'
bl_options = {'REGISTER', 'U... |
willthames/ansible | refs/heads/devel | lib/ansible/modules/cloud/cloudstack/cs_instancegroup.py | 18 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# (c) 2015, René Moser <mail@renemoser.net>
#
# 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 Lice... |
ivan-fedorov/intellij-community | refs/heads/master | python/helpers/pycharm/django_manage_commands_provider/_parser/_argparse.py | 81 | # coding=utf-8
"""
Fetches arguments from argparse-based Django (1.8+)
"""
from argparse import Action, _StoreTrueAction, _StoreFalseAction
from django_manage_commands_provider._parser import _utils
__author__ = 'Ilya.Kazakevich'
# noinspection PyUnusedLocal
# Command here by contract
def process_command(dumper, c... |
javilonas/NCam | refs/heads/master | cross/android-toolchain/lib/python2.7/unittest/runner.py | 136 | """Running tests"""
import sys
import time
from . import result
from .signals import registerResult
__unittest = True
class _WritelnDecorator(object):
"""Used to decorate file-like objects with a handy 'writeln' method"""
def __init__(self,stream):
self.stream = stream
def __getattr__(self, at... |
mcardillo55/django | refs/heads/master | django/template/loaders/base.py | 137 | import warnings
from django.template import Origin, Template, TemplateDoesNotExist
from django.utils.deprecation import RemovedInDjango20Warning
from django.utils.inspect import func_supports_parameter
class Loader(object):
# Only used to raise a deprecation warning. Remove in Django 1.10.
is_usable = False
... |
ioram7/keystone-federado-pgid2013 | refs/heads/master | build/simplejson/build/lib.linux-x86_64-2.7/simplejson/__init__.py | 80 | r"""JSON (JavaScript Object Notation) <http://json.org> is a subset of
JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data
interchange format.
:mod:`simplejson` exposes an API familiar to users of the standard library
:mod:`marshal` and :mod:`pickle` modules. It is the externally maintained
version of ... |
anorfleet/turntable | refs/heads/master | test/lib/python2.7/site-packages/setuptools/tests/test_bdist_egg.py | 151 | """develop tests
"""
import os
import re
import pytest
from setuptools.dist import Distribution
from . import contexts
SETUP_PY = """\
from setuptools import setup
setup(name='foo', py_modules=['hi'])
"""
@pytest.yield_fixture
def setup_context(tmpdir):
with (tmpdir/'setup.py').open('w') as f:
f.write... |
GoogleCloudPlatform/solutions-speech-productionized-transcription | refs/heads/master | client/audio_client.py | 1 | # 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, soft... |
vinthony/jiandan-raccoon | refs/heads/master | scrapy_jiandan/spiders/jiandan_spider.py | 1 | import scrapy
class JianDanSpider(scrapy.Spider):
name = "jiandan"
allowed_domains = ["jiandan.net"]
start_urls = [
"http://jiandan.net/ooxx"
]
def parse(self,response):
for img in response.css('#comments img'):
self.log('%s' % img.extract())
|
endlessm/chromium-browser | refs/heads/master | third_party/skia/gn/cp.py | 17 | #!/usr/bin/env python
#
# Copyright 2016 Google Inc.
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import shutil
import sys
src, dst = sys.argv[1:]
if os.path.exists(dst):
if os.path.isdir(dst):
shutil.rmtree(dst)
else:
os.remove(dst)
i... |
tonyfast/tidy-harness | refs/heads/master | harness/python/ext/base.py | 1 |
# coding: utf-8
# In[6]:
try:
from ..base import AttributeObject
except:
from harness.python.base import AttributeObject
from toolz.curried import *
import importlib, inspect, jinja2.ext
__all__ = ['HarnessExtension']
# In[4]:
class HarnessExtension(jinja2.ext.Extension):
"""Use the jinja2 extension... |
DreamerKing/LightweightHtmlWidgets | refs/heads/master | LightweightHtmlWidgets/bin/Debug/Ipy.Lib/traceback.py | 125 | """Extract, format and print information about Python stack traces."""
import linecache
import sys
import types
__all__ = ['extract_stack', 'extract_tb', 'format_exception',
'format_exception_only', 'format_list', 'format_stack',
'format_tb', 'print_exc', 'format_exc', 'print_exception',
... |
Bysmyyr/blink-crosswalk | refs/heads/master | Tools/Scripts/webkitpy/style/checkers/text.py | 193 | # Copyright (C) 2009 Google Inc. All rights reserved.
# Copyright (C) 2010 Chris Jerdonek (cjerdonek@webkit.org)
#
# 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... |
CforED/Machine-Learning | refs/heads/master | sklearn/ensemble/tests/test_weight_boosting.py | 58 | """Testing for the boost module (sklearn.ensemble.boost)."""
import numpy as np
from sklearn.utils.testing import assert_array_equal, assert_array_less
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_equal, assert_true
from sklearn.utils.testing import assert_raises... |
pinterb/st2 | refs/heads/master | st2client/tests/unit/test_auth.py | 5 | # Licensed to the StackStorm, Inc ('StackStorm') 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 use th... |
horazont/aioxmpp | refs/heads/devel | tests/adhoc/test_xso.py | 1 | ########################################################################
# File name: test_xso.py
# This file is part of: aioxmpp
#
# LICENSE
#
# This program 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 Foundat... |
ollie314/browserscope | refs/heads/master | categories/network/test_set.py | 9 | #!/usr/bin/python2.5
#
# Copyright 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the 'License')
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... |
lin-credible/scikit-learn | refs/heads/master | examples/model_selection/plot_precision_recall.py | 249 | """
================
Precision-Recall
================
Example of Precision-Recall metric to evaluate classifier output quality.
In information retrieval, precision is a measure of result relevancy, while
recall is a measure of how many truly relevant results are returned. A high
area under the curve represents both ... |
paulmcquad/projecteuler | refs/heads/master | 100-200/problem141.py | 1 | #http://d.hatena.ne.jp/inamori/20120426/p1
from itertools import *
from math import sqrt
import time
def is_square(n):
m = int(sqrt(n))
return m * m == n
def div_pow(n, d):
e = 0
while n % d == 0:
n /= d
e += 1
return e, n
def make_primes(N):
a = [ True ] * (N + 1)
for p i... |
servo/servo | refs/heads/master | tests/wpt/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/resources/meta-refresh.py | 20 | def main(request, response):
time = request.url_parts.query if request.url_parts.query else u'0'
return 200, [[b'Content-Type', b'text/html']], u'<meta http-equiv=refresh content=%s>' % time
|
haiiiiiyun/scrapy | refs/heads/master | tests/test_downloadermiddleware_retry.py | 108 | import unittest
from twisted.internet import defer
from twisted.internet.error import TimeoutError, DNSLookupError, \
ConnectionRefusedError, ConnectionDone, ConnectError, \
ConnectionLost, TCPTimedOutError
from scrapy import optional_features
from scrapy.downloadermiddlewares.retry import RetryMiddlew... |
calpeyser/google-cloud-python | refs/heads/master | spanner/google/cloud/spanner/pool.py | 2 | # Copyright 2016 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 by applicable law or a... |
mfasDa/pdsftrain | refs/heads/master | train/transfer/copy_files.py | 3 | #! /usr/bin/env python
#
#Usage: Run this script with the trainname as argument.
#For example: ./copy_trainrun.py EMCALTrain_20140912_43554_lhc13e_pass2 [OPTIONS]
#
#This script assumes that in this PATH_IN_ALIEN there are any number of folders (All 3 digit numbers e.g. "000","001",...)
#Every of these folders again co... |
dskoda/vasp-ita | refs/heads/master | vaspirin/projection.py | 2 | import re,sys
class PROJECTION (object):
'''
Deals with PROJECTION files, which are a custom user-generated file to process projection
onto orbitals and atomic sites. The PROJECTION file should have the following format:
The file PROJECTION (default name) should have the following format:
Material1Name ionsBe... |
evandavid/dodolipet | refs/heads/master | yowsup/layers/interface/interface.py | 22 | from yowsup.layers import YowLayer, YowLayerEvent
from yowsup.layers.protocol_iq.protocolentities import IqProtocolEntity
from yowsup.layers.network import YowNetworkLayer
from yowsup.layers.auth import YowAuthenticationProtocolLayer
import inspect
class ProtocolEntityCallback(object):
def __init__(self, entityTyp... |
TileHalo/servo | refs/heads/master | tests/wpt/web-platform-tests/tools/manifest/sourcefile.py | 16 | import os
import urlparse
from fnmatch import fnmatch
try:
from xml.etree import cElementTree as ElementTree
except ImportError:
from xml.etree import ElementTree
import html5lib
import vcs
from item import Stub, ManualTest, WebdriverSpecTest, RefTest, TestharnessTest
from utils import rel_path_to_url, is_bla... |
jbassen/edx-platform | refs/heads/master | common/djangoapps/microsite_configuration/__init__.py | 188 | from .templatetags.microsite import page_title_breadcrumbs
|
adamjmcgrath/glancydesign | refs/heads/master | django/contrib/gis/tests/utils.py | 397 | from django.conf import settings
from django.db import DEFAULT_DB_ALIAS
# function that will pass a test.
def pass_test(*args): return
def no_backend(test_func, backend):
"Use this decorator to disable test on specified backend."
if settings.DATABASES[DEFAULT_DB_ALIAS]['ENGINE'].rsplit('.')[-1] == backend:
... |
matrogers/pylearn2 | refs/heads/master | pylearn2/scripts/tutorials/grbm_smd/make_dataset.py | 44 | # pylearn2 tutorial example: make_dataset.py by Ian Goodfellow
# See README before reading this file
#
#
# This script creates a preprocessed version of a dataset using pylearn2.
# It's not necessary to save preprocessed versions of your dataset to
# disk but this is an instructive example, because later we can show
# ... |
devs1991/test_edx_docmode | refs/heads/master | lms/djangoapps/discussion_api/api.py | 11 | """
Discussion API internal interface
"""
from collections import defaultdict
from urllib import urlencode
from urlparse import urlunparse
from django.core.exceptions import ValidationError
from django.core.urlresolvers import reverse
from django.http import Http404
import itertools
from rest_framework.exceptions imp... |
minhphung171093/GreenERP_V9 | refs/heads/master | openerp/addons/sale_expense/models/product.py | 44 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp import fields, models
class ProductProduct(models.Model):
_inherit = "product.template"
expense_policy = fields.Selection(
[('cost', 'At Cost'), ('sales_price', 'At Sales Price')],
... |
dietrichc/streamline-ppc-reports | refs/heads/master | examples/dfp/v201408/creative_set_service/get_all_creative_sets.py | 4 | #!/usr/bin/python
#
# Copyright 2014 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... |
jounex/hue | refs/heads/master | desktop/core/ext-py/Django-1.6.10/django/contrib/gis/geoip/tests.py | 76 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
from django.conf import settings
from django.contrib.gis.geos import HAS_GEOS
from django.contrib.gis.geoip import HAS_GEOIP
from django.utils import unittest
from django.utils.unittest import skipUnless
from django.utils import six
if HAS_GEO... |
omriher/CapTipper | refs/heads/master | pcapparser/httpparser.py | 1 | # Changes made to integrate with CapTipper in lines: 176-177,198-191,223-227,236,261-262,329,341-346
from __future__ import unicode_literals, print_function, division
import threading
from collections import defaultdict
from Queue import Queue
import CTCore
from pcapparser import utils
from pcapparser.constant impor... |
masterperson40/retr3d | refs/heads/master | log.py | 1 | import os
import sys
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
import logging
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
import platform
import __main__
class Logging(object):
def __init__(self):
if not os.path.exists(os.path.dirname(os.path.abspath(__file__)) + '/logs/')... |
Kalyzee/edx-platform | refs/heads/master | lms/djangoapps/commerce/tests/mocks.py | 75 | """ Commerce app tests package. """
import json
import httpretty
from commerce.tests import TEST_API_URL
class mock_ecommerce_api_endpoint(object): # pylint: disable=invalid-name
"""
Base class for contextmanagers used to mock calls to api endpoints.
The contextmanager internally activates and deactiv... |
p0psicles/SickRage | refs/heads/master | lib/unidecode/x09e.py | 252 | data = (
'Shu ', # 0x00
'Luo ', # 0x01
'Qi ', # 0x02
'Yi ', # 0x03
'Ji ', # 0x04
'Zhe ', # 0x05
'Yu ', # 0x06
'Zhan ', # 0x07
'Ye ', # 0x08
'Yang ', # 0x09
'Pi ', # 0x0a
'Ning ', # 0x0b
'Huo ', # 0x0c
'Mi ', # 0x0d
'Ying ', # 0x0e
'Meng ', # 0x0f
'Di ', # 0x10
'Yue ', ... |
s3rvac/talks | refs/heads/master | 2018-03-05-Introduction-to-Python/examples/24-instance-creation-meta.py | 2 | # A full version of 24-instance-creation.py that also covers metaclasses.
class Meta(type):
def __new__(meta, name, bases, dict):
print('Meta.__new__()')
return type.__new__(meta, name, bases, dict)
def __init__(cls, name, bases, dict):
print('Meta.__init__()')
return type.__in... |
mcoolive/graphite-web | refs/heads/master | contrib/test_aggregator_rules.py | 3 | import sys
from os.path import dirname, join, abspath
# Figure out where we're installed
ROOT_DIR = dirname(dirname(abspath(__file__)))
# Make sure that carbon's 'lib' dir is in the $PYTHONPATH if we're running from source.
LIB_DIR = join(ROOT_DIR, 'graphite', 'lib')
sys.path.insert(0, LIB_DIR)
from carbon.aggregato... |
munyirik/python | refs/heads/develop | cpython/Lib/distutils/tests/test_bdist_dumb.py | 103 | """Tests for distutils.command.bdist_dumb."""
import os
import sys
import zipfile
import unittest
from test.support import run_unittest
from distutils.core import Distribution
from distutils.command.bdist_dumb import bdist_dumb
from distutils.tests import support
SETUP_PY = """\
from distutils.core import setup
impo... |
GarySparrow/mFlaskWeb | refs/heads/master | venv/Lib/site-packages/gunicorn/http/wsgi.py | 24 | # -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
import io
import logging
import os
import re
import sys
from gunicorn._compat import unquote_to_wsgi_str
from gunicorn.http.message import HEADER_RE
from gunicorn.http.errors import InvalidHe... |
svanschalkwyk/datafari | refs/heads/master | windows/python/Lib/copy.py | 253 | """Generic (shallow and deep) copying operations.
Interface summary:
import copy
x = copy.copy(y) # make a shallow copy of y
x = copy.deepcopy(y) # make a deep copy of y
For module specific errors, copy.Error is raised.
The difference between shallow and deep copying is only relev... |
picsadotcom/maguire | refs/heads/master | backend/credits/models.py | 10644 | from django.db import models
# Create your models here.
|
poiesisconsulting/openerp-restaurant | refs/heads/master | procurement/wizard/make_procurement_product.py | 7 | # -*- 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... |
zhhf/charging | refs/heads/master | charging/plugins/embrane/__init__.py | 160 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 Embrane, 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/l... |
pompiduskus/scikit-learn | refs/heads/master | examples/linear_model/plot_lasso_model_selection.py | 311 | """
===================================================
Lasso model selection: Cross-Validation / AIC / BIC
===================================================
Use the Akaike information criterion (AIC), the Bayes Information
criterion (BIC) and cross-validation to select an optimal value
of the regularization paramet... |
MostlyOpen/odoo_api | refs/heads/master | myo_person_category.py | 1 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
#
# Copyright (C) 2013-Today Carlos Eduardo Vercelino - CLVsol
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Pub... |
lakshayg/tensorflow | refs/heads/master | tensorflow/python/ops/spectral_ops.py | 23 | # 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... |
resmo/ansible | refs/heads/devel | test/units/module_utils/urls/test_generic_urlparse.py | 144 | # -*- coding: utf-8 -*-
# (c) 2018 Matt Martz <matt@sivel.net>
# 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.module_utils.urls import generic_urlparse
from ansible.module_u... |
vortex-ape/scikit-learn | refs/heads/master | sklearn/preprocessing/__init__.py | 4 | """
The :mod:`sklearn.preprocessing` module includes scaling, centering,
normalization, binarization and imputation methods.
"""
from ._function_transformer import FunctionTransformer
from .data import Binarizer
from .data import KernelCenterer
from .data import MinMaxScaler
from .data import MaxAbsScaler
from .data ... |
alhashash/odoo | refs/heads/master | addons/web_view_editor/__init__.py | 14224 | # -*- coding: utf-8 -*-
|
sh-chris110/chris | refs/heads/master | python/oct/a.py | 1 | #!/usr/bin/python
import cv2
import Image
import numpy as np
from skimage.feature import hog
#hog(image, orientations=9, pixels_per_cell=(8, 8), cells_per_block=(3, 3), block_norm='L1', visualise=False, transform_sqrt=False, feature_vector=True, normalise=None)
img_color = cv2.imread("22.jpg")
#img_color = cv2.imread(... |
1900/scrapy | refs/heads/master | scrapy/http/cookies.py | 24 | from cookielib import CookieJar as _CookieJar, DefaultCookiePolicy
from scrapy.utils.httpobj import urlparse_cached
class CookieJar(object):
def __init__(self, policy=None):
self.jar = _CookieJar(policy or DefaultCookiePolicy())
self.jar._cookies_lock = _DummyLock()
def extract_cookies(self, ... |
n6g7/django_markdown | refs/heads/develop | django_markdown/widgets.py | 1 | """ Widgets for django-markdown. """
import os
from django import forms
from django.contrib.admin.widgets import AdminTextareaWidget
from django.contrib.staticfiles.storage import staticfiles_storage
from django.utils.safestring import mark_safe
from . import settings
from .utils import editor_js_initialization
cla... |
sysalexis/kbengine | refs/heads/master | kbe/res/scripts/common/Lib/turtledemo/peace.py | 99 | #!/usr/bin/env python3
""" turtle-example-suite:
tdemo_peace.py
A simple drawing suitable as a beginner's
programming example. Aside from the
peacecolors assignment and the for loop,
it only uses turtle commands.
"""
from turtle import *
def main():
peacecolors = ("red3", "orange", "yellow"... |
agaffney/ansible | refs/heads/devel | lib/ansible/module_utils/facts/network/base.py | 88 | # This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that ... |
messense/wechatpy | refs/heads/master | wechatpy/pay/utils.py | 1 | # -*- coding: utf-8 -*-
import base64
import copy
import hashlib
import hmac
import socket
import logging
from wechatpy.utils import to_binary, to_text
logger = logging.getLogger(__name__)
def format_url(params, api_key=None):
data = [to_binary('{0}={1}'.format(k, params[k])) for k in sorted(params) if params... |
LUTAN/tensorflow | refs/heads/master | tensorflow/contrib/keras/python/keras/applications/vgg16_test.py | 52 | # 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... |
leafclick/intellij-community | refs/heads/master | python/testData/types/NumpyArrayType/numpy/core/__init__.py | 275 | from . import multiarray
from . import numeric
from .numeric import *
__all__ = []
__all__ += numeric.__all__
|
shikil/sympy | refs/heads/master | sympy/core/tests/test_wester.py | 25 | """ Tests from Michael Wester's 1999 paper "Review of CAS mathematical
capabilities".
http://www.math.unm.edu/~wester/cas/book/Wester.pdf
See also http://math.unm.edu/~wester/cas_review.html for detailed output of
each tested system.
"""
from sympy import (Rational, symbols, Dummy, factorial, sqrt, log, exp, oo, zoo,... |
op/hyde | refs/heads/master | hyde.py | 7 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import optparse
import os
import sys
import hydeengine
PROG_ROOT = os.path.dirname(os.path.realpath( __file__ ))
def main(argv):
parser = optparse.OptionParser(usage="%prog [-f] [-q]", version="%prog 0.4")
parser.add_option("-s", "--sitepath",
... |
vipul-sharma20/oh-mainline | refs/heads/master | vendor/packages/twisted/twisted/test/test_jelly.py | 18 | # Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Test cases for L{jelly} object serialization.
"""
import datetime
try:
import decimal
except ImportError:
decimal = None
from twisted.spread import jelly, pb
from twisted.python.compat import set, frozenset
from twisted.trial import... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.