repo_name stringlengths 5 100 | ref stringlengths 12 67 | path stringlengths 4 244 | copies stringlengths 1 8 | content stringlengths 0 1.05M ⌀ |
|---|---|---|---|---|
tjma12/pycbc | refs/heads/master | pycbc/waveform/sinegauss.py | 1 | """ Generation of sine-Gaussian bursty type things
"""
import pycbc.types
import numpy
def fd_sine_gaussian(amp, quality, central_frequency, fmin, fmax, delta_f):
""" Generate a Fourier domain sine-Gaussian
Parameters
----------
amp: float
Amplitude of the sine-Gaussian
quality: float
... |
crdoconnor/chess_app | refs/heads/master | app/database_funcs.py | 1 | #!/usr/bin/env python
# DATABASE INTERACTION FUNCTIONS
def get_db():
db = getattr(g, '_database', None)
if db is None:
db = g._database = connect_to_database()
return db
@app.teardown_appcontext
def close_connection(exception):
db = getattr(g, '_database', None)
if db is not None:
... |
lsaffre/lino | refs/heads/master | lino/utils/textfields.py | 1 | # -*- coding: UTF-8 -*-
# Copyright 2011 Rumma & Ko Ltd
# License: BSD (see file COPYING for details)
"""
This is taken from Helio Perroni Filho's answer at
http://stackoverflow.com/questions/328356/extracting-text-from-html-file-using-python/3987802#3987802
I added the extract_summary() function.
Lino never really... |
nox/servo | refs/heads/master | tests/wpt/web-platform-tests/resource-timing/resources/gzip_xml.py | 59 | import gzip as gzip_module
from cStringIO import StringIO
def main(request, response):
f = open('resource-timing/resources/resource_timing_test0.xml', 'r')
output = f.read()
out = StringIO()
with gzip_module.GzipFile(fileobj=out, mode="w") as f:
f.write(output)
output = out.getvalue()
h... |
MarcosCommunity/odoo | refs/heads/marcos-8.0 | addons/project/wizard/project_task_delegate.py | 142 | # -*- 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... |
40223136/-2015cd_midterm | refs/heads/master | static/Brython3.1.0-20150301-090019/Lib/textwrap.py | 745 | """Text wrapping and filling.
"""
# Copyright (C) 1999-2001 Gregory P. Ward.
# Copyright (C) 2002, 2003 Python Software Foundation.
# Written by Greg Ward <gward@python.net>
import re
__all__ = ['TextWrapper', 'wrap', 'fill', 'dedent', 'indent']
# Hardcode the recognized whitespace characters to the US-ASCII
# whit... |
boudewijnrempt/HyvesDesktop | refs/heads/master | 3rdparty/socorro/socorro/othertests/timeReplaces.py | 1 | import re
import time
numloops = 1000000
emptyCost = 0
ss = r'-L $dumpfileLocation -P$dumpfilePlan -d $dumpfilePathname -s $processorSymbolsPathnameList'
fixDumpfile = re.compile(r'\$dumpfilePathname')
def display(diff, label):
global constCost
diff -= emptyCost
print label, 'time: %03.3f'%diff
def loop(count... |
oscarlorentzon/OpenSfM | refs/heads/master | opensfm/unionfind.py | 2 | # Source: https://www.ics.uci.edu/~eppstein/PADS/UnionFind.py
# Licence: MIT
# This is PADS, a library of Python Algorithms and Data Structures
# implemented by David Eppstein of the University of California, Irvine.
#
# The current version of PADS may be found at
# <http://www.ics.uci.edu/~eppstein/PADS/>, as indivi... |
miacro/pkget | refs/heads/master | pkget/basic_config.py | 1 | from .exception import PkgetError
from .utils import Utils
class BasicConfig():
__type = {"int": "int",
"float": "float",
"string": "string",
"dict": "dict",
"list": "list"}
def is_reserved_attribute(name):
if (name[0:1] == "_") or (name[0:7] ==... |
ericholscher/django | refs/heads/master | tests/file_storage/tests.py | 1 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import errno
import os
import shutil
import sys
import tempfile
import time
import unittest
import zlib
from datetime import datetime, timedelta
from io import BytesIO
try:
import threading
except ImportError:
import dummy_threading as threading
... |
extertioner/django-blog-zinnia | refs/heads/develop | zinnia/tests/test_preview.py | 12 | # coding=utf-8
"""Test cases for Zinnia's preview"""
from django.test import TestCase
from zinnia.preview import HTMLPreview
class HTMLPreviewTestCase(TestCase):
def test_splitters(self):
text = '<p>Hello World</p><!-- more --><p>Hello dude</p>'
preview = HTMLPreview(text, splitters=['<!--more--... |
majorika/crawlers | refs/heads/master | election_commission/crawlers/local/candidates.py | 3 | #!/usr/bin/python2.7
# -*- encoding=utf-8 -*-
from base import *
from static import get_election_id, get_election_type_id, get_valid_election_type_ids
from static import url_city_ids_json as ucij
from static import reversed_election_types
def Crawler(nth, level):
print level
election_id = get_election_id(nth... |
theo-l/django | refs/heads/master | django/contrib/auth/context_processors.py | 127 | # PermWrapper and PermLookupDict proxy the permissions system into objects that
# the template system can understand.
class PermLookupDict:
def __init__(self, user, app_label):
self.user, self.app_label = user, app_label
def __repr__(self):
return str(self.user.get_all_permissions())
def... |
itsjeyd/edx-platform | refs/heads/master | lms/djangoapps/course_api/blocks/transformers/tests/test_student_view.py | 35 | """
Tests for StudentViewTransformer.
"""
# pylint: disable=protected-access
from openedx.core.lib.block_structure.factory import BlockStructureFactory
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import ToyCourseFactory
from ..student_view import St... |
benjaminjkraft/django | refs/heads/master | tests/urlpatterns_reverse/utils.py | 64 | from __future__ import unicode_literals
from django.conf.urls import url
from . import views
class URLObject(object):
urlpatterns = [
url(r'^inner/$', views.empty_view, name='urlobject-view'),
url(r'^inner/(?P<arg1>[0-9]+)/(?P<arg2>[0-9]+)/$', views.empty_view, name='urlobject-view'),
ur... |
evanccnyc/ansible | refs/heads/devel | contrib/inventory/fleet.py | 160 | #!/usr/bin/env python
"""
fleetctl base external inventory script. Automatically finds the IPs of the booted coreos instances and
returns it under the host group 'coreos'
"""
# Copyright (C) 2014 Andrew Rothstein <andrew.rothstein at gmail.com>
#
# This program is free software: you can redistribute it and/or modify
... |
abn/coreemu | refs/heads/master | daemon/examples/netns/wlantest.py | 11 | #!/usr/bin/python
# Copyright (c)2010-2012 the Boeing Company.
# See the LICENSE file included in this distribution.
# run iperf to measure the effective throughput between two nodes when
# n nodes are connected to a virtual wlan; run test for testsec
# and repeat for minnodes <= n <= maxnodes with a step size of
# n... |
elkingtonmcb/rethinkdb | refs/heads/next | external/v8_3.30.33.16/build/gyp/test/msvs/external_builder/external_builder.py | 260 | # Copyright (c) 2013 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import sys
with open('external_builder.out', 'w') as f:
f.write(' '.join(sys.argv))
|
mvaled/OpenUpgrade | refs/heads/8.0 | addons/hr_payroll_account/__openerp__.py | 260 | #-*- coding:utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# d$
#
# This program is free software: you can redistribute it and/or modify
# it ... |
garyfeng/pybrain | refs/heads/master | pybrain/rl/environments/twoplayergames/gomokuplayers/gomokuplayer.py | 31 | __author__ = 'Tom Schaul, tom@idsia.ch'
from pybrain.rl.agents.agent import Agent
from pybrain.rl.environments.twoplayergames import GomokuGame
class GomokuPlayer(Agent):
""" a class of agent that can play Go-Moku, i.e. provides actions in the format:
(playerid, position)
playerid is self.color, by conv... |
ogazitt/stackalytics | refs/heads/master | dashboard/vault.py | 2 | # Copyright (c) 2013 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... |
plilja/project-euler | refs/heads/master | problem_2/even_fibonacci.py | 1 | from math import sqrt, log
from common.functions import fibonacci
PSI = (1.0 + sqrt(5)) / 2.0
def even_fibonacci(upper_limit):
return even_fibonacci_mathematical(upper_limit)
def sum_of_nth_first_fibonnaci_numbers(last_even_n):
return fibonacci(last_even_n + 2) - 1
def even_fibonacci_mathematical(upper... |
theicfire/djangofun | refs/heads/master | django/db/models/sql/aggregates.py | 277 | """
Classes to represent the default SQL aggregate functions
"""
class AggregateField(object):
"""An internal field mockup used to identify aggregates in the
data-conversion parts of the database backend.
"""
def __init__(self, internal_type):
self.internal_type = internal_type
def get_int... |
CasparLi/shadowsocks | refs/heads/master | tests/test_udp_src.py | 39 | #!/usr/bin/python
import socket
import socks
SERVER_IP = '127.0.0.1'
SERVER_PORT = 1081
if __name__ == '__main__':
# Test 1: same source port IPv4
sock_out = socks.socksocket(socket.AF_INET, socket.SOCK_DGRAM,
socket.SOL_UDP)
sock_out.set_proxy(socks.SOCKS5, SERVER_IP, S... |
mcdaniel67/sympy | refs/heads/master | sympy/printing/mathml.py | 58 | """
A MathML printer.
"""
from __future__ import print_function, division
from sympy import sympify, S, Mul
from sympy.core.function import _coeff_isneg
from sympy.core.alphabets import greeks
from sympy.core.compatibility import u, range
from .printer import Printer
from .pretty.pretty_symbology import greek_unicode... |
disqus/django-old | refs/heads/master | django/contrib/messages/tests/base.py | 1 | from django import http
from django.test import TestCase
from django.conf import settings
from django.utils.translation import ugettext_lazy
from django.utils.unittest import skipIf
from django.contrib.messages import constants, utils, get_level, set_level
from django.contrib.messages.api import MessageFailure
from dja... |
RedhawkSDR/integration-gnuhawk | refs/heads/master | gnuradio/gr-wxgui/src/python/common.py | 17 | #
# Copyright 2008, 2009 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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, or (at your option)
# any later versio... |
clonetwin26/buck | refs/heads/master | python-dsl/buck_parser/__main__.py | 17 | """Main module for running this tool standalone.
When buck invokes this tool it generates its own main module.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import with_statement
from . import buck
if __name__ == '__main__':
buck... |
knehez/edx-platform | refs/heads/memooc | lms/djangoapps/commerce/api/v1/tests/__init__.py | 176 | """ Commerce API v1 tests. """
|
diogommartins/ryu | refs/heads/master | ryu/app/simple_switch_snort.py | 18 | # Copyright (C) 2013 Nippon Telegraph and Telephone Corporation.
#
# 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 appli... |
kerel-fs/skylines | refs/heads/master | skylines/lib/xcsoar_/__init__.py | 8 | # flake8: noqa
from .analysis import analyse_flight
from .flightpath import flight_path, FlightPathFix
|
nirmeshk/oh-mainline | refs/heads/master | vendor/packages/docutils/test/functional/tests/latex_cyrillic.py | 18 | # Source and destination file names.
test_source = "cyrillic.txt"
test_destination = "cyrillic.tex"
# Keyword parameters passed to publish_file.
reader_name = "standalone"
parser_name = "rst"
writer_name = "latex"
# Extra setting we need
settings_overrides['hyperref_options'] = 'unicode=true'
settings_overrides['fon... |
Bamtau/external_chromium | refs/heads/jb4.2 | testing/gmock/test/gmock_leak_test.py | 224 | #!/usr/bin/env python
#
# Copyright 2009, 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... |
wwq0327/shumanr | refs/heads/master | shumanr/profiles/migrations/0001_initial.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 model 'Profile'
db.create_table(u'profiles_profile', (
... |
ray-project/ray | refs/heads/master | python/ray/util/dask/tests/test_dask_scheduler.py | 1 | import dask
import dask.array as da
import pytest
import sys
import unittest
import ray
from ray.util.client.common import ClientObjectRef
@pytest.fixture
def ray_start_1_cpu():
address_info = ray.init(num_cpus=2)
yield address_info
# The code after the yield will run as teardown code.
ray.shutdown()
... |
admetricks/phantomjs | refs/heads/master | src/breakpad/src/tools/gyp/test/additional-targets/gyptest-additional.py | 137 | #!/usr/bin/env python
# Copyright (c) 2009 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Verifies simple actions when using an explicit build target of 'all'.
"""
import TestGyp
test = TestGyp.TestGyp()
test.run_gyp('all.g... |
yanchen036/tensorflow | refs/heads/master | tensorflow/examples/learn/random_forest_mnist.py | 46 | # 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... |
karthik-suresh/horizon | refs/heads/master | openstack_dashboard/dashboards/identity/groups/tables.py | 53 | # Copyright 2013 Hewlett-Packard Development Company, L.P.
#
# 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 requir... |
home-assistant/home-assistant | refs/heads/dev | tests/components/group/test_notify.py | 8 | """The tests for the notify.group platform."""
from os import path
from unittest.mock import MagicMock, patch
from homeassistant import config as hass_config
import homeassistant.components.demo.notify as demo
from homeassistant.components.group import SERVICE_RELOAD
import homeassistant.components.group.notify as gro... |
IsCoolEntertainment/debpkg_uwsgi | refs/heads/master | plugins/legion_cache_fetch/uwsgiplugin.py | 13 |
NAME = 'legion_cache_fetch'
CFLAGS = []
LDFLAGS = []
LIBS = []
GCC_LIST = ['legion_cache_fetch']
|
jillson/chrononaut | refs/heads/master | maps/migrations/0001_initial.py | 1 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Map',
fields=[
('id', models.AutoField(verbose_... |
nishnik/networkx | refs/heads/master | networkx/readwrite/edgelist.py | 5 | """
**********
Edge Lists
**********
Read and write NetworkX graphs as edge lists.
The multi-line adjacency list format is useful for graphs with nodes
that can be meaningfully represented as strings. With the edgelist
format simple edge data can be stored but node or graph data is not.
There is no way of representin... |
ABaldwinHunter/pep8 | refs/heads/master | setup.py | 52 | # -*- coding: utf-8 -*-
from __future__ import with_statement
from setuptools import setup
def get_version():
with open('pep8.py') as f:
for line in f:
if line.startswith('__version__'):
return eval(line.split('=')[-1])
def get_long_description():
descr = []
for fname... |
hnakamur/django | refs/heads/master | django/views/decorators/debug.py | 712 | import functools
from django.http import HttpRequest
def sensitive_variables(*variables):
"""
Indicates which variables used in the decorated function are sensitive, so
that those variables can later be treated in a special way, for example
by hiding them when logging unhandled exceptions.
Two f... |
iamahuman/angr | refs/heads/master | angr/exploration_techniques/spiller.py | 1 | import logging
l = logging.getLogger(name=__name__)
from . import ExplorationTechnique
class Spiller(ExplorationTechnique):
"""
Automatically spill states out. It can spill out states to a different stash, spill
them out to ANA, or first do the former and then (after enough states) the latter.
"""
... |
bobvanderlinden/machinekit | refs/heads/master | lib/python/servicediscovery.py | 13 | import sys
import os
import gtk.gdk
import gobject
import glib
import socket
try:
import avahi, dbus, gtk
except ImportError, e:
print "Sorry, to use this tool you need to install Avahi and python-dbus.\n Error: %s" % e
sys.exit(1)
except Exception, e:
print "Failed to initialize: %s" % e
sys.exit(... |
marcydoty/geraldo | refs/heads/master | site/newsite/django_1_0/django/core/signals.py | 47 | request_started = object()
request_finished = object()
got_request_exception = object()
|
TeamEOS/external_chromium_org | refs/heads/lp5.0 | chrome/common/extensions/docs/server2/api_models.py | 7 | # 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.
import posixpath
from compiled_file_system import SingleFile, Unicode
from extensions_paths import API_PATHS
from file_system import FileNotFoundError
from ... |
3dfxmadscientist/CBSS | refs/heads/master | addons/document_webdav/nodes.py | 54 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 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 Affe... |
GdZ/scriptfile | refs/heads/master | software/googleAppEngine/lib/django_1_2/django/contrib/gis/db/backends/postgis/creation.py | 308 | from django.conf import settings
from django.db.backends.postgresql.creation import DatabaseCreation
class PostGISCreation(DatabaseCreation):
geom_index_type = 'GIST'
geom_index_opts = 'GIST_GEOMETRY_OPS'
def sql_indexes_for_field(self, model, f, style):
"Return any spatial index creation SQL for ... |
OTWillems/GEO1005 | refs/heads/master | SpatialDecision/external/networkx/drawing/tests/test_layout.py | 43 | """Unit tests for layout functions."""
import sys
from nose import SkipTest
from nose.tools import assert_equal
import networkx as nx
class TestLayout(object):
numpy=1 # nosetests attribute, use nosetests -a 'not numpy' to skip test
@classmethod
def setupClass(cls):
global numpy
try:
... |
meshy/framewirc | refs/heads/master | tests/test_handlers.py | 1 | from unittest import mock
from framewirc import handlers
from framewirc.messages import ReceivedMessage
from .utils import BlankClient
class TestPing:
def test_ping(self):
"""Respond to PING with PONG."""
client = mock.MagicMock()
message = ReceivedMessage(b'PING :hostname.example.com')
... |
Serag8/Bachelor | refs/heads/master | google_appengine/lib/django-1.4/django/contrib/contenttypes/tests.py | 40 | from __future__ import with_statement
import urllib
from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes.views import shortcut
from django.contrib.sites.models import Site
from django.http import HttpRequest, Http404
from django.test import TestCase
... |
LabSoftwareUTP/CodeGeneratorUTP | refs/heads/master | apps/core/models.py | 1 | from django.db import models
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
class GenericManager(models.Manager):
def get_all_active(self):
return self.filter(is_active=True).distinct()
def get_or_none(self, **kwargs):
try:
ret... |
sharbison3/python-docs-samples | refs/heads/master | monitoring/api/v3/api-client/custom_metric.py | 6 | #!/usr/bin/env python
# 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
# di... |
openstack/taskflow | refs/heads/master | taskflow/persistence/path_based.py | 4 | # -*- coding: utf-8 -*-
# Copyright (C) 2015 Rackspace Hosting All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LIC... |
DoubleNegativeVisualEffects/gaffer | refs/heads/master | python/GafferScene/ScenePath.py | 3 | ##########################################################################
#
# Copyright (c) 2012, John Haddon. All rights reserved.
# Copyright (c) 2013, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided t... |
yuzhangcmu/Python-Study | refs/heads/master | Leetcode/Longest_Common_Prefix.py | 2 | """
Write a function to find the longest common prefix string amongst an array of strings.
"""
class Solution:
# @return a string
def longestCommonPrefix(self, strs):
if len(strs) == 0:
return ''
N = len(strs)
compare = strs[0]
for i in range(len(compare)):
... |
bluestemscott/librarygadget | refs/heads/master | librarygadget/librarybot/urlsui.py | 1 | from django.conf.urls.defaults import *
urlpatterns = patterns('librarybot.viewsui',
# UI
url(r'^libraries$', 'libraries', name='libraries'),
url(r'^privacy$', 'privacy', name='privacy'),
url(r'^about$', 'about', name='about'),
url(r'^checkedout$', 'checked_out', name='checked_out'),
ur... |
getefesto/efesto | refs/heads/master | efesto/handlers/Items.py | 1 | # -*- coding: utf-8 -*-
from falcon import HTTPBadRequest, HTTPNotFound, HTTP_204
from peewee import DoesNotExist
import rapidjson
from .BaseHandler import BaseHandler
from ..Siren import Siren
class Items(BaseHandler):
def query(self, params):
self.model.q = self.model.select().where(self.model.id ==... |
SunPower/Carousel | refs/heads/master | examples/PVPower/pvpower/sandia_performance_model.py | 1 | """
Sandia Performance Model
"""
from simkit.core.data_sources import DataSource
from simkit.core.formulas import Formula
from simkit.core.calculations import Calc
from simkit.core.calculators import Calculator
from simkit.core.outputs import Output
from simkit.core.simulations import Simulation
from simkit.core.model... |
mwmuni/LIGGGHTS_GUI | refs/heads/master | networkx/classes/tests/test_ordered.py | 53 | import networkx as nx
class SmokeTestOrdered(object):
# Just test instantiation.
def test_graph():
G = nx.OrderedGraph()
def test_digraph():
G = nx.OrderedDiGraph()
def test_multigraph():
G = nx.OrderedMultiGraph()
def test_multidigraph():
G = nx.OrderedMultiDiGra... |
dtaht/ns-3-dev-old | refs/heads/master | src/virtual-net-device/bindings/modulegen__gcc_LP64.py | 42 | from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
import pybindgen.settings
import warnings
class ErrorHandler(pybindgen.settings.ErrorHandler):
def handle_error(self, wrapper, exception, traceback_):
warnings.warn("exception %r in wrapper %s" % (exception, wrapper))
... |
zamattiac/SHARE | refs/heads/develop | providers/org/engrxiv/apps.py | 1 | from share.provider import ProviderAppConfig
from .harvester import EngrxivHarvester
# from providers.io.osf.preprints.normalizer import PreprintNormalizer
class AppConfig(ProviderAppConfig):
name = 'providers.org.engrxiv'
version = '0.0.1'
title = 'osf_preprints_engrxiv'
long_title = 'engrXiv'
ho... |
ravibhure/ansible | refs/heads/devel | test/units/modules/network/vyos/test_vyos_config.py | 42 | #
# (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
# (at your option) any later version.
#
# Ansible is d... |
kreatorkodi/repository.torrentbr | refs/heads/master | plugin.video.yatp/site-packages/hachoir_metadata/register.py | 2 | from hachoir_core.i18n import _
from hachoir_core.tools import (
humanDuration, humanBitRate,
humanFrequency, humanBitSize, humanFilesize,
humanDatetime)
from hachoir_core.language import Language
from hachoir_metadata.filter import Filter, NumberFilter, DATETIME_FILTER
from datetime import date, datetime, ... |
fengzhe29888/gnuradio-old | refs/heads/master | gr-utils/python/modtool/modtool_rename.py | 21 | #
# Copyright 2014 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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, or (at your option)
# any later version.
#
#... |
ofir123/CouchPotatoServer | refs/heads/master | libs/pio/api.py | 12 | # -*- coding: utf-8 -*-
# Changed
# Removed iso8601 library requirement
# Added CP logging
import os
import json
import binascii
import webbrowser
try:
from urllib import urlencode
except ImportError:
from urllib.parse import urlencode
from datetime import datetime
import tus
import requests
from requests.a... |
google/sg2im | refs/heads/master | scripts/sample_images.py | 1 | #!/usr/bin/python
#
# Copyright 2018 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 ag... |
saquiba2/numpy2 | refs/heads/master | tools/swig/test/testTensor.py | 116 | #! /usr/bin/env python
from __future__ import division, absolute_import, print_function
# System imports
from distutils.util import get_platform
from math import sqrt
import os
import sys
import unittest
# Import NumPy
import numpy as np
major, minor = [ int(d) for d in np.__version__.split(".")[:2] ]
i... |
carmilso/TFG | refs/heads/master | scripts/computeTags.py | 1 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
EXAMPLE USAGE: ./computeSegments.py ../logs/google_en_treated.log | ./computeTags.py
'''
import sys
import codecs
import fileinput
from string import *
UTF8Reader = codecs.getreader('utf-8')
sys.stdin = UTF8Reader(sys.stdin)
tags = codecs.open('../segment_tags', 'r... |
DalikarFT/CFVOP | refs/heads/master | venv/Lib/site-packages/pip/req/req_file.py | 343 | """
Requirements file parsing
"""
from __future__ import absolute_import
import os
import re
import shlex
import sys
import optparse
import warnings
from pip._vendor.six.moves.urllib import parse as urllib_parse
from pip._vendor.six.moves import filterfalse
import pip
from pip.download import get_file_content
from ... |
bsmr-eve/Pyfa | refs/heads/master | gui/aboutData.py | 2 | # =============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of pyfa.
#
# pyfa 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 ... |
sprucedev/DockCI | refs/heads/master | tests/conftest.py | 2 | import random
import subprocess
from contextlib import contextmanager
from urllib.parse import urlparse, urlunparse
import alembic
import pytest
from flask_migrate import migrate
from dockci.models.auth import Role
from dockci.models.job import Job, JobStageTmp
from dockci.models.project import Project
from dockci.... |
alburnum/alburnum-maas-client | refs/heads/master | maas/client/flesh/tests/test.py | 3 | """Tests for `maas.client.flesh`."""
__all__ = []
|
sublime1809/django | refs/heads/master | tests/admin_autodiscover/tests.py | 526 | from unittest import TestCase
from django.contrib import admin
class AdminAutoDiscoverTests(TestCase):
"""
Test for bug #8245 - don't raise an AlreadyRegistered exception when using
autodiscover() and an admin.py module contains an error.
"""
def test_double_call_autodiscover(self):
# The... |
pivotaccess2007/RapidSMS-Rwanda | refs/heads/master | apps/poll/views.py | 7 | #!/usr/bin/env python
# vim: noet
from django.views.decorators.http import require_GET, require_POST
from rapidsms.webui.utils import render_to_response
from django.shortcuts import get_object_or_404
from django.http import HttpResponse, HttpResponseRedirect, HttpResponseServerError
from django.db import IntegrityErro... |
kareemallen/beets | refs/heads/master | beets/util/__init__.py | 2 | # -*- coding: utf-8 -*-
# This file is part of beets.
# Copyright 2015, Adrian Sampson.
#
# 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 t... |
edx-solutions/edx-platform | refs/heads/master | common/djangoapps/third_party_auth/tests/specs/test_lti.py | 4 | """
Integration tests for third_party_auth LTI auth providers
"""
import unittest
from django.conf import settings
from django.contrib.auth.models import User
from django.urls import reverse
from oauthlib.oauth1.rfc5849 import Client, SIGNATURE_TYPE_BODY
from third_party_auth.tests import testutil
FORM_ENCODED = 'ap... |
aESeguridad/GERE | refs/heads/master | venv/lib/python2.7/site-packages/pip/_vendor/lockfile/linklockfile.py | 536 | from __future__ import absolute_import
import time
import os
from . import (LockBase, LockFailed, NotLocked, NotMyLock, LockTimeout,
AlreadyLocked)
class LinkLockFile(LockBase):
"""Lock access to a file using atomic property of link(2).
>>> lock = LinkLockFile('somefile')
>>> lock = Link... |
beatrizjesus/my-first-blog | refs/heads/master | pasta/Lib/site-packages/pip/_vendor/html5lib/utils.py | 982 | from __future__ import absolute_import, division, unicode_literals
from types import ModuleType
try:
import xml.etree.cElementTree as default_etree
except ImportError:
import xml.etree.ElementTree as default_etree
__all__ = ["default_etree", "MethodDispatcher", "isSurrogatePair",
"surrogatePairTo... |
georgewhewell/CouchPotatoServer | refs/heads/master | libs/requests/hooks.py | 1891 | # -*- coding: utf-8 -*-
"""
requests.hooks
~~~~~~~~~~~~~~
This module provides the capabilities for the Requests hooks system.
Available hooks:
``response``:
The response generated from a Request.
"""
HOOKS = ['response']
def default_hooks():
hooks = {}
for event in HOOKS:
hooks[event] = []... |
liu602348184/django | refs/heads/master | django/core/files/images.py | 429 | """
Utility functions for handling images.
Requires Pillow as you might imagine.
"""
import struct
import zlib
from django.core.files import File
class ImageFile(File):
"""
A mixin for use alongside django.core.files.base.File, which provides
additional features for dealing with images.
"""
def ... |
tintumonmartin/OPAC | refs/heads/master | bookstock.py | 1 | from openerp.osv import orm, fields
class book_stock(orm.Model):
_name = 'book.stock'
_rec_name = 'book_name'
_columns = {
'book_id':fields.char('Book ID'),
'book_name':fields.char('Book Name', size=100),
# 'book_name':fields.many2one('book.reserve', 'Book Name', ondelet... |
maleficarium/youtube-dl | refs/heads/master | youtube_dl/extractor/jeuxvideo.py | 60 | # coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
class JeuxVideoIE(InfoExtractor):
_VALID_URL = r'https?://.*?\.jeuxvideo\.com/.*/(.*?)\.htm'
_TESTS = [{
'url': 'http://www.jeuxvideo.com/reportages-videos-jeux/0004/00046170/tearaway-playstation-vi... |
aachik/flask-blog-abdulmx | refs/heads/master | env/lib/python2.7/site-packages/jinja2/testsuite/tests.py | 497 | # -*- coding: utf-8 -*-
"""
jinja2.testsuite.tests
~~~~~~~~~~~~~~~~~~~~~~
Who tests the tests?
:copyright: (c) 2010 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
import unittest
from jinja2.testsuite import JinjaTestCase
from jinja2 import Markup, Environment
env = Environm... |
jgmanzanas/CMNT_004_15 | refs/heads/master | project-addons/purchase_advance_payment/wizard/apply_advanced_amount_wzd.py | 1 | # -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2015 Comunitea Servicios Tecnológicos All Rights Reserved
# $Omar Castiñeira Saaevdra <omar@comunitea.com>$
#
# This program is free software: you can redistribute it and/or modify
# it u... |
tedi3231/openerp | refs/heads/master | build/lib/openerp/addons/account_analytic_plans/wizard/__init__.py | 445 | # -*- 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... |
protatremy/buildbot | refs/heads/master | master/buildbot/process/remotetransfer.py | 10 | # This file is part of Buildbot. Buildbot 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, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... |
vitan/hue | refs/heads/master | desktop/core/ext-py/Django-1.6.10/django/utils/unittest/signals.py | 571 | import signal
import weakref
from django.utils.unittest.compatibility import wraps
__unittest = True
class _InterruptHandler(object):
def __init__(self, default_handler):
self.called = False
self.default_handler = default_handler
def __call__(self, signum, frame):
installed_handler ... |
F0rth/seafile-obsd-wip | refs/heads/master | ccnet/python/ccnet/client.py | 1 | #coding: UTF-8
import os
import socket
import ConfigParser
import logging
from ccnet.packet import to_request_id, to_update_id
from ccnet.packet import request_to_packet, update_to_packet
from ccnet.packet import write_packet
from ccnet.errors import NetworkError
def parse_response(body):
'''Parse the content o... |
elifeasley/metacademy-application | refs/heads/master | content_server/utils.py | 2 | import sys
import pdb
import config
import database
import graphs
db = None
def load_db():
global db
db = database.Database.load(config.CONTENT_PATH)
def find_references(key):
global db
if db is None:
load_db()
if key not in db.nodes:
print 'Not found.'
return
print ... |
liberatorqjw/scikit-learn | refs/heads/master | doc/sphinxext/numpy_ext/numpydoc.py | 413 | """
========
numpydoc
========
Sphinx extension that handles docstrings in the Numpy standard format. [1]
It will:
- Convert Parameters etc. sections to field lists.
- Convert See Also section to a See also entry.
- Renumber references.
- Extract the signature from the docstring, if it can't be determined
otherwis... |
team484/team484.github.io | refs/heads/master | electronics/piface-digital/button.py | 1 | #!/usr/bin/python3
#
# flash the output LEDs one by one
#
from time import sleep
import pifacedigitalio as pfio
MAX_BUTTON = 4
pfio.init()
try:
current_state = []
for button in range(0, MAX_BUTTON):
current_state.append(pfio.digital_read(button))
while (True):
for button in range(0,MAX_BUTTON):
value = pf... |
40223211/cadpbtest-0420 | refs/heads/master | static/Brython3.1.1-20150328-091302/Lib/external_import.py | 742 | import os
from browser import doc
import urllib.request
## this module is able to download modules that are external to
## localhost/src
## so we could download from any URL
class ModuleFinder:
def __init__(self, path_entry):
print("external_import here..")
#print(path_entry)
self._module=... |
amith01994/intellij-community | refs/heads/master | python/testData/refactoring/extractsuperclass/withSuper.before.py | 83 | class Foo(object):
def bar(self):
print "foo"
def foo(self):
print "bar" |
ViktorNova/dino | refs/heads/master | scripts/interpreters/dino_dbus_wrapper.py | 1 | import dbus
bus = None
song = None
seq = None
class SequencerInterface(dbus.Interface):
def __init__(self, object, interface):
dbus.Interface.__init__(self, object, interface)
def play(self):
self.Play()
def stop(self):
self.Stop()
def goToBeat(self, beat):
... |
ThiagoGarciaAlves/intellij-community | refs/heads/master | python/lib/Lib/mimetools.py | 92 | """Various tools used by MIME-reading or MIME-writing programs."""
import os
import rfc822
import tempfile
__all__ = ["Message","choose_boundary","encode","decode","copyliteral",
"copybinary"]
class Message(rfc822.Message):
"""A derived class of rfc822.Message that knows about MIME headers and
co... |
victor-gil-sepulveda/PhD-ANMPythonHelpers | refs/heads/master | pca/dpca.py | 1 | """
Created on 18/05/2015
@author: user
"""
import numpy
import math
def min_density_angle(angles, numbins = 20):
"""
Returns the angle of less density as the less populated range in the
angle histogram (population != 0)
"""
his, edges = numpy.histogram(angles, bins = numbins)
# Get t... |
yamt/tempest | refs/heads/master | tempest/cmd/verify_tempest_config.py | 9 | #!/usr/bin/env python
# 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 by app... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.