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 |
|---|---|---|---|---|---|
lmorchard/django | django/contrib/admin/utils.py | 119 | 16639 | from __future__ import unicode_literals
import datetime
import decimal
from collections import defaultdict
from django.contrib.auth import get_permission_codename
from django.core.exceptions import FieldDoesNotExist
from django.core.urlresolvers import NoReverseMatch, reverse
from django.db import models
from django.... | bsd-3-clause |
yoghadj/or-tools | data/nonogram_regular/nonogram_nonunique.py | 74 | 1268 | # Copyright 2010 Hakan Kjellerstrand hakank@bonetmail.com
#
# 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 |
Karm/qpid-proton | proton-j/src/main/resources/cmessage.py | 8 | 6420 | #
# Licensed to the Apache Software Foundation (ASF) 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... | apache-2.0 |
EricssonResearch/calvin-base | calvinextras/calvinsys/io/gpiopin/BaseGPIOPin.py | 1 | 2281 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Ericsson AB
#
# 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... | apache-2.0 |
lmazuel/azure-sdk-for-python | azure-servicefabric/azure/servicefabric/models/delta_nodes_check_health_evaluation.py | 1 | 3728 | # 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 ... | mit |
eLRuLL/scrapy | scrapy/spiders/sitemap.py | 1 | 3542 | import re
import logging
from scrapy.spiders import Spider
from scrapy.http import Request, XmlResponse
from scrapy.utils.sitemap import Sitemap, sitemap_urls_from_robots
from scrapy.utils.gz import gunzip, gzip_magic_number
logger = logging.getLogger(__name__)
class SitemapSpider(Spider):
sitemap_urls = ()
... | bsd-3-clause |
zenoss/Community-Zenpacks | ZenPacks.community.libvirt/ZenPacks/community/libvirt/libvirtGuest.py | 2 | 3631 | from Globals import InitializeClass
# from AccessControl import ClassSecurityInfo
from Products.ZenRelations.RelSchema import *
from Products.ZenModel.DeviceComponent import DeviceComponent
from Products.ZenModel.ManagedEntity import ManagedEntity
from Products.ZenUtils.Utils import convToUnits
from Products.ZenModel... | gpl-2.0 |
t1g0r/npyscreen | build/lib/npyscreen/fmFileSelector.py | 14 | 8371 | from . import fmFormMutt
from . import wgmultiline
from . import wggrid
from . import wgautocomplete
from . import utilNotify
import curses
import os
import os.path
import operator
class FileCommand(wgautocomplete.Filename):
def set_up_handlers(self):
super(FileCommand, self).set_up_handlers()
sel... | bsd-2-clause |
matthewtownson/soapy | soapy/pyqtgraph/graphicsItems/tests/test_InfiniteLine.py | 20 | 3452 | import pyqtgraph as pg
from pyqtgraph.Qt import QtGui, QtCore, QtTest
from pyqtgraph.tests import mouseDrag, mouseMove
pg.mkQApp()
def test_InfiniteLine():
# Test basic InfiniteLine API
plt = pg.plot()
plt.setXRange(-10, 10)
plt.setYRange(-10, 10)
plt.resize(600, 600)
# seemingly arbitrar... | gpl-3.0 |
kagayakidan/scikit-learn | examples/cluster/plot_lena_segmentation.py | 271 | 2444 | """
=========================================
Segmenting the picture of Lena in regions
=========================================
This example uses :ref:`spectral_clustering` on a graph created from
voxel-to-voxel difference on an image to break this image into multiple
partly-homogeneous regions.
This procedure (spe... | bsd-3-clause |
mikeboers/aque | tests/test_event_loop.py | 1 | 1233 | from . import *
class TestTimers(TestCase):
def test_timer(self):
res = []
one = functools.partial(res.append, 1)
two = functools.partial(res.append, 2)
def once():
res.append(3)
raise StopSelection()
start_time = time.time()
loop = EventL... | bsd-3-clause |
pepeportela/edx-platform | common/lib/xmodule/xmodule/modulestore/tests/test_contentstore.py | 37 | 8192 | """
Test contentstore.mongo functionality
"""
import logging
from uuid import uuid4
import unittest
import mimetypes
from tempfile import mkdtemp
import path
import shutil
from opaque_keys.edx.locator import CourseLocator, AssetLocator
from opaque_keys.edx.keys import AssetKey
from xmodule.tests import DATA_DIR
from ... | agpl-3.0 |
alkorgun/urlcf | setup.py | 1 | 1120 | """
@author: alkorgun
"""
import os
from distutils.core import setup
from distutils.command.install import install
import urlcf.db
name = "urlcf"
version = os.getenv("version") or "1.0.0"
class Initializer(install):
def run(self):
install.run(self)
urlcf.db.init()
def ls(folder):
files ... | mit |
CTSRD-SOAAP/chromium-42.0.2311.135 | native_client/src/trusted/validator_ragel/avx1_xmm_ymm_memory_3op_ps_proof.py | 8 | 1205 | # Copyright (c) 2014 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Proof for adding 3 operand xmm/ymm/memory packed single precision ops."""
import proof_tools
from proof_tools_templates import XmmYmmOrMemory3op... | bsd-3-clause |
heytcass/homeassistant-config | deps/cherrypy/test/test_misc_tools.py | 7 | 7453 | import os
localDir = os.path.dirname(__file__)
logfile = os.path.join(localDir, "test_misc_tools.log")
import cherrypy
from cherrypy import tools
def setup_server():
class Root:
@cherrypy.expose
def index(self):
yield "Hello, world"
h = [("Content-Language", "en-GB"), ('Conte... | mit |
dawnpower/nova | nova/keymgr/single_key_mgr.py | 69 | 2539 | # Copyright (c) 2013 The Johns Hopkins University/Applied Physics Laboratory
# 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/... | apache-2.0 |
prampey/servo | tests/wpt/css-tests/tools/html5lib/html5lib/tests/test_whitespace_filter.py | 453 | 5642 | from __future__ import absolute_import, division, unicode_literals
import unittest
from html5lib.filters.whitespace import Filter
from html5lib.constants import spaceCharacters
spaceCharacters = "".join(spaceCharacters)
try:
unittest.TestCase.assertEqual
except AttributeError:
unittest.TestCase.assertEqual =... | mpl-2.0 |
brianlsharp/MissionPlanner | Lib/site-packages/numpy/lib/format.py | 53 | 19853 | """
Define a simple format for saving numpy arrays to disk with the full
information about them.
The ``.npy`` format is the standard binary file format in NumPy for
persisting a *single* arbitrary NumPy array on disk. The format stores all
of the shape and dtype information necessary to reconstruct the array
correctly... | gpl-3.0 |
afifnz/django-material | fabfile.py | 13 | 1127 | import os
from fabric.api import env, task, local
BASEDIR = os.path.dirname(env.real_fabfile)
@task
def start_xvfb():
local('/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid'
'--make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1280x1024x16')
@task
def gene... | bsd-3-clause |
Trinitaria/namebench | libnamebench/selectors.py | 176 | 3262 | #!/usr/bin/env python
# Copyright 2009 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... | apache-2.0 |
elkingtonmcb/cloudbiolinux | cloudbio/config_management/puppet.py | 10 | 2026 | from fabric.state import _AttributeDict
from fabric.api import cd
from utils import upload_config, config_dir, build_properties
from cloudbio.package.deb import _apt_packages
import os
DEFAULTS = dict(
path='/var/puppet',
log_level='info',
modules=config_dir(os.path.join('puppet', 'modules'))
)
puppet = ... | mit |
monadius/mapnik2_maps | create_regions.py | 1 | 21636 | import os
import sys
import argparse
import json
# Global variables
base_dir = '/Users/monad/Work/data'
cult10m_dir = os.path.join(base_dir, '10m_cultural', '10m_cultural')
phys10m_dir = os.path.join(base_dir, '10m_physical')
edited10m_dir = os.path.join(base_dir, 'edited10m')
cult50m_dir = os.path.join(base_dir, '... | mit |
cebrusfs/217gdb | pwndbg/color/context.py | 1 | 3407 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import pwndbg.color.theme as theme
import pwndbg.config as config
from pwndbg.color import generateColorFunction
config_pre... | mit |
Architektor/PySnip | venv/lib/python2.7/site-packages/twisted/words/xish/utility.py | 49 | 13379 | # -*- test-case-name: twisted.words.test.test_xishutil -*-
#
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Event Dispatching and Callback utilities.
"""
from twisted.python import log
from twisted.words.xish import xpath
class _MethodWrapper(object):
"""
Internal class for track... | gpl-3.0 |
pombredanne/MOG | nova/tests/integrated/v3/test_quota_sets.py | 11 | 3153 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# 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... | apache-2.0 |
ThomasFeher/audacity | lib-src/lv2/serd/waflib/Tools/compiler_fc.py | 287 | 1846 | #! /usr/bin/env python
# encoding: utf-8
# WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file
import os,sys,imp,types
from waflib import Utils,Configure,Options,Logs,Errors
from waflib.Tools import fc
fc_compiler={'win32':['gfortran','ifort'],'darwin':['gfortran','g95'... | gpl-2.0 |
okaywit/livestreamer | src/livestreamer/plugins/twitch.py | 15 | 14791 | import re
import requests
from random import random
from livestreamer.compat import urlparse
from livestreamer.exceptions import NoStreamsError, PluginError, StreamError
from livestreamer.plugin import Plugin, PluginOptions
from livestreamer.plugin.api import http, validate
from livestreamer.plugin.api.utils import ... | bsd-2-clause |
ntiufalara/openerp7 | openerp/addons/procurement/wizard/make_procurement_product.py | 56 | 5673 | # -*- 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... | mit |
ClimbsRocks/scikit-learn | sklearn/externals/joblib/testing.py | 45 | 2720 | """
Helper for testing.
"""
import sys
import warnings
import os.path
import re
import subprocess
import threading
from sklearn.externals.joblib._compat import PY3_OR_LATER
def warnings_to_stdout():
""" Redirect all warnings to stdout.
"""
showwarning_orig = warnings.showwarning
def showwarning(msg... | bsd-3-clause |
RicardoJohann/um | erpnext/accounts/general_ledger.py | 24 | 4602 | # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils import flt, cstr
from frappe import _
from erpnext.accounts.utils import validate_expense_against_budget
class Stoc... | agpl-3.0 |
tersmitten/ansible | test/units/modules/network/f5/test_bigip_dns_resolver.py | 16 | 3687 | # -*- coding: utf-8 -*-
#
# Copyright: (c) 2018, F5 Networks Inc.
# 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
import os
import json
import pytest
import sys
if sys.version_info < (2... | gpl-3.0 |
Revanth47/addons-server | src/olympia/activity/serializers.py | 3 | 1380 | from django.utils.translation import ugettext_lazy as _
from rest_framework import serializers
from olympia.users.serializers import BaseUserSerializer
from olympia.devhub.models import ActivityLog
class ActivityLogSerializer(serializers.ModelSerializer):
action = serializers.SerializerMethodField()
action_... | bsd-3-clause |
rkerr/trigger | trigger/contrib/commando/__init__.py | 12 | 6964 | """
trigger.contrib.commando
~~~~~~~~~~~~~~~~~~~~~~~~
Simple command running for Trigger meant to be used with a
long-running reactor loop (such using the Twisted XMLRPC server).
This differs from `~trigger.cmds.Commando` in that:
+ It does not start/stop the reactor, instead it uses sentinel values and a
task mon... | bsd-3-clause |
clearzale/pyflag | src/plugins/Themes/Menus.py | 7 | 5385 | """ A more advanced menu based theme """
import pyflag.conf
config=pyflag.conf.ConfObject()
import pyflag.FlagFramework as FlagFramework
import pyflag.Registry as Registry
import pyflag.Theme as Theme
import pyflag.DB as DB
class Menu(Theme.BasicTheme):
""" Class to implement the Menus theme """
def make_menu_... | gpl-2.0 |
shuhaowu/kvkit | kvkit/backends/slow_memory.py | 1 | 3222 | # -*- coding: utf-8 -*-
# This file is part of kvkit
#
# kvkit is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# kvkit is dist... | lgpl-3.0 |
crasker/scrapy | scrapy/http/request/__init__.py | 16 | 2868 | """
This module implements the Request class which is used to represent HTTP
requests in Scrapy.
See documentation in docs/topics/request-response.rst
"""
import six
from w3lib.url import safe_url_string
from scrapy.http.headers import Headers
from scrapy.utils.python import to_bytes
from scrapy.utils.trackref import... | bsd-3-clause |
guschmue/tensorflow | tensorflow/compiler/tests/adam_test.py | 79 | 7193 | # 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 |
whereismyjetpack/ansible | lib/ansible/executor/stats.py | 9 | 2778 | # (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.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) an... | gpl-3.0 |
zhuwenping/python-for-android | python-modules/twisted/twisted/runner/topfiles/setup.py | 54 | 1297 | # Copyright (c) 2008 Twisted Matrix Laboratories.
# See LICENSE for details.
try:
from twisted.python.dist import setup, ConditionalExtension as Extension
except ImportError:
raise SystemExit("twisted.python.dist module not found. Make sure you "
"have installed the Twisted core package b... | apache-2.0 |
daviddupont69/CouchPotatoServer | libs/pyutil/test/current/json_tests/test_recursion.py | 106 | 1686 | from unittest import TestCase
from pyutil import jsonutil as json
class JSONTestObject:
pass
class RecursiveJSONEncoder(json.JSONEncoder):
recurse = False
def default(self, o):
if o is JSONTestObject:
if self.recurse:
return [JSONTestObject]
else:
... | gpl-3.0 |
Dandandan/wikiprogramming | jsrepl/build/extern/python/closured/lib/python2.7/netrc.py | 168 | 4576 | """An object-oriented interface to .netrc files."""
# Module and documentation by Eric S. Raymond, 21 Dec 1998
import os, shlex
__all__ = ["netrc", "NetrcParseError"]
class NetrcParseError(Exception):
"""Exception raised on syntax errors in the .netrc file."""
def __init__(self, msg, filename=None, lineno=... | mit |
pabulumm/neighbors | lib/python3.4/site-packages/django_extensions/management/commands/runscript.py | 26 | 6625 | import sys
import traceback
from optparse import make_option
from django_extensions.compat import importlib, list_apps
from django_extensions.management.email_notifications import \
EmailNotificationCommand
from django_extensions.management.utils import signalcommand
def vararg_callback(option, opt_str, opt_valu... | bsd-3-clause |
scripnichenko/glance | glance/api/middleware/context.py | 2 | 5885 | # Copyright 2011-2012 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 |
teltek/edx-platform | openedx/core/djangoapps/site_configuration/__init__.py | 63 | 1388 | """
This app is used for creating/updating site's configuration. This app encapsulate configuration related logic for sites
and provides a way for sites to override default/system behavioural or presentation logic.
Models:
SiteConfiguration (models.Model):
This model contains configuration for a site and c... | agpl-3.0 |
cpcloud/numpy | numpy/testing/decorators.py | 73 | 8464 | """
Decorators for labeling and modifying behavior of test objects.
Decorators that merely return a modified version of the original
function object are straightforward. Decorators that return a new
function object need to use
::
nose.tools.make_decorator(original_function)(decorator)
in returning the decorator, i... | bsd-3-clause |
CSC-ORG/Dynamic-Dashboard-2015 | engine/lib/python2.7/site-packages/django/contrib/gis/management/commands/inspectdb.py | 74 | 1467 | from django.core.management.commands.inspectdb import Command as InspectDBCommand
class Command(InspectDBCommand):
db_module = 'django.contrib.gis.db'
gis_tables = {}
def get_field_type(self, connection, table_name, row):
field_type, field_params, field_notes = super(Command, self).get_field_type... | mit |
jolevq/odoopub | addons/project_timesheet/report/__init__.py | 441 | 1063 | # -*- 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 |
bjennin/StarduPlane | Tools/autotest/apm_unit_tests/dev/arducopter_AP_Limits.py | 227 | 2098 | import arducopter
import util, pexpect, sys, time, math, shutil, os
from common import *
import mavutil, mavwp, random
def unit_test(mavproxy, mav):
'''A scripted flight plan for testing AP_Limits'''
time.sleep(5)
print "# Setting AP_Limits parameters"
mavproxy.send('param set LIM_ENABLED 1\n')
... | gpl-3.0 |
Yung-Hsuan-Yeh/sharp-maker-100211 | lib/werkzeug/testapp.py | 303 | 9398 | # -*- coding: utf-8 -*-
"""
werkzeug.testapp
~~~~~~~~~~~~~~~~
Provide a small test application that can be used to test a WSGI server
and check it for WSGI compliance.
:copyright: (c) 2013 by the Werkzeug Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
impo... | apache-2.0 |
akuster/linux-stable | tools/perf/util/setup.py | 766 | 1540 | #!/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 |
alex-dow/pybuilder | src/integrationtest/python/should_list_multiple_tasks_for_simple_project_tests.py | 7 | 1336 | # -*- coding: utf-8 -*-
#
# This file is part of PyBuilder
#
# Copyright 2011-2015 PyBuilder Team
#
# 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... | apache-2.0 |
Miceuz/pidgenetics | pid.py | 1 | 2139 | #The recipe gives simple implementation of a Discrete Proportional-Integral-Derivative (PID) controller. PID controller gives output value for error between desired reference input and measurement feedback to minimize error value.
#More information: http://en.wikipedia.org/wiki/PID_controller
#
#cnr437@gmail.com
#
####... | bsd-3-clause |
smi96/django-blog_website | lib/python2.7/site-packages/django/template/context_processors.py | 187 | 2463 | """
A set of request processors that return dictionaries to be merged into a
template context. Each function takes the request object as its only parameter
and returns a dictionary to add to the context.
These are referenced from the 'context_processors' option of the configuration
of a DjangoTemplates backend and use... | mit |
xrmx/django | django/contrib/contenttypes/migrations/0001_initial.py | 585 | 1227 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import django.contrib.contenttypes.models
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='ContentType',
fields=... | bsd-3-clause |
mdiener21/python-geospatial-analysis-cookbook | ch07/code/gdal_merge.py | 2 | 16547 | #!/usr/bin/env python
###############################################################################
# $Id: gdal_merge.py 27044 2014-03-16 23:41:27Z rouault $
#
# Project: InSAR Peppers
# Purpose: Module to extract data from many rasters into one output.
# Author: Frank Warmerdam, warmerdam@pobox.com
#
###########... | mit |
Stvad/anki | anki/hooks.py | 1 | 1825 | # -*- coding: utf-8 -*-
# Copyright: Damien Elmes <anki@ichi2.net>
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
"""\
Hooks - hook management and tools for extending Anki
==============================================================================
To find available hooks, grep for r... | agpl-3.0 |
sodafree/backend | tests/regressiontests/forms/tests/util.py | 33 | 3154 | # -*- coding: utf-8 -*-
from django.core.exceptions import ValidationError
from django.forms.util import flatatt, ErrorDict, ErrorList
from django.test import TestCase
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy
class FormsUtilTestCase(TestCase):
# Tests fo... | bsd-3-clause |
squirrelo/qiita | qiita_db/job.py | 1 | 23100 | r"""
Data objects (:mod: `qiita_db.data`)
====================================
..currentmodule:: qiita_db.data
This module provides functionality for creating, running, and storing results
of jobs in an analysis. It also provides the ability to query what commmands
are available for jobs, as well as the options for t... | bsd-3-clause |
scholer/cadnano2.5 | cadnano/views/abstractitems/abstractoligoitem.py | 2 | 1178 | # -*- coding: utf-8 -*-
from cadnano.cntypes import (
OligoT,
ValueT
)
class AbstractOligoItem(object):
"""
AbstractOligoItem is a base class for oligoitems in all views.
It includes slots that get connected in OligoController which
can be overridden.
Slots that must be overridden should r... | mit |
LoiX07/photobooth | tools/gui.py | 1 | 8977 | # -*- coding: utf-8 -*-
"""
GUI-related classes
"""
import pygame
from .remote_log import REMOTE_LOG as log
class GuiException(Exception):
"""
Custom exception class to handle GUI class errors
"""
class GUIModule:
""" GUI Display using PyGame """
def __init__(self, name, size, fullscreen=True... | gpl-3.0 |
charlesjlee/Kaggle | Yandex_web_search/Code/poulejapon.py | 1 | 4374 | ## Taken from https://gist.github.com/poulejapon/7909562
import itertools
from collections import defaultdict, OrderedDict
from math import log
def dcg(scores):
return sum( (2**score - 1) / log(i+2) for (i, score) in enumerate(scores) )
class Session(object):
__slots__ = ('sid', 'day', 'day', 'user', 'queri... | mit |
ray-project/ray | python/ray/tune/examples/mnist_pytorch_lightning.py | 1 | 9321 | # flake8: noqa
# yapf: disable
# __import_lightning_begin__
import math
import torch
import pytorch_lightning as pl
from filelock import FileLock
from torch.utils.data import DataLoader, random_split
from torch.nn import functional as F
from torchvision.datasets import MNIST
from torchvision import transforms
import ... | apache-2.0 |
ubuntu-touch-apps/webbrowser-app | tests/autopilot/webapp_container/tests/test_intent_uri_support.py | 1 | 4859 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
# Copyright 2014 Canonical
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
#
# This program is distributed... | gpl-3.0 |
Manojkumar91/odoo_inresto | addons/analytic_user_function/analytic_user_function.py | 7 | 7679 | # -*- 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 |
grap/OpenUpgrade | addons/point_of_sale/report/pos_lines.py | 230 | 2464 | # -*- 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 |
wbchen99/bitcoin-hnote0 | qa/rpc-tests/nodehandling.py | 62 | 3559 | #!/usr/bin/env python3
# Copyright (c) 2014-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test node handling
#
from test_framework.test_framework import BitcoinTestFramework
from test_framew... | mit |
jakevdp/altair | altair/utils/save.py | 1 | 4261 | import json
import six
from .mimebundle import spec_to_mimebundle
def write_file_or_filename(fp, content, mode='w'):
"""Write content to fp, whether fp is a string or a file-like object"""
if isinstance(fp, six.string_types):
with open(fp, mode) as f:
f.write(content)
else:
f... | bsd-3-clause |
ckane/crits | crits/certificates/certificate.py | 8 | 4316 | from mongoengine import Document, StringField, IntField
from django.conf import settings
from crits.certificates.migrate import migrate_certificate
from crits.core.crits_mongoengine import CritsBaseAttributes, CritsSourceDocument
from crits.core.crits_mongoengine import CritsActionsDocument
from crits.core.fields impo... | mit |
sergiopasra/numina | numina/user/logconf.py | 3 | 1823 | #
# Copyright 2008-2020 Universidad Complutense de Madrid
#
# This file is part of Numina
#
# SPDX-License-Identifier: GPL-3.0+
# License-Filename: LICENSE.txt
#
"""Default logging configuration for Numina CLI."""
LOGCONF = {
'version': 1,
'formatters': {
'simple': {'format': '%(levelname)s: %(messa... | gpl-3.0 |
SaschaMester/delicium | tools/find_runtime_symbols/PRESUBMIT.py | 53 | 1438 | # Copyright (c) 2012 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.
"""Top-level presubmit script for find_runtime_symbols.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more details on ... | bsd-3-clause |
vikkyrk/incubator-beam | sdks/python/apache_beam/transforms/trigger.py | 1 | 36634 | #
# Licensed to the Apache Software Foundation (ASF) 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 us... | apache-2.0 |
mzdaniel/oh-mainline | vendor/packages/whoosh/docs/source/conf.py | 16 | 6391 |
import sys, os, os.path
sys.path.append(os.path.abspath("../../src"))
import whoosh
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown h... | agpl-3.0 |
ctiller/grpc | tools/github/pr_latency.py | 8 | 6928 | #!/usr/bin/env python
# Copyright 2017 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 o... | apache-2.0 |
hoffmanc/uPdf | setup.py | 2 | 10123 | #!/usr/bin/env python
#
'''
from distutils.core import setup
'''
from distutils.core import setup
from DistUtilsExtra.command import *
from distutils import cmd
from distutils.command.install_data import install_data as _install_data
from distutils.command.build import build as _build
import msgfmt
import os
import g... | gpl-3.0 |
monikasulik/django-oscar | src/oscar/apps/dashboard/ranges/views.py | 34 | 8005 | import os
from django.conf import settings
from django.contrib import messages
from django.core import exceptions
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from django.shortcuts import get_object_or_404, HttpResponse
from django.template.loader import render_to_string
fr... | bsd-3-clause |
indrajitr/ansible | lib/ansible/module_utils/splitter.py | 197 | 9433 | # This code is part of Ansible, but is an independent component.
# This particular file snippet, and this file snippet only, is BSD licensed.
# Modules you write using this snippet, which is embedded dynamically by Ansible
# still belong to the author of the module, and may assign their own license
# to the complete wo... | gpl-3.0 |
srisankethu/coala-bears | tests/go/GofmtBearTest.py | 10 | 1749 | from queue import Queue
from bears.go.GofmtBear import GofmtBear
from coalib.testing.LocalBearTestHelper import LocalBearTestHelper, \
execute_bear
from coalib.settings.Section import Section
from coala_utils.ContextManagers import prepare_file
in_file1 = """package main
func main() {
return 1
}"""
out_fil... | agpl-3.0 |
LeBarbouze/tunacell | tunacell/io/metadata.py | 1 | 10798 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Metadata can be used to filter containers, or to use the 'period' parameter
when computing local_rates by joining mother and daughter cells (specifically,
the joining timepoint is set at the first registered timepoint in current
daughter cell, minus half the acquisition... | mit |
oasiswork/odoo | addons/account/report/account_analytic_entries_report.py | 306 | 3879 | # -*- 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 |
stanlee321/pysolper | permit/lib/dist/tipfy/i18n.py | 9 | 27835 | # -*- coding: utf-8 -*-
"""
tipfy.i18n
~~~~~~~~~~
Internationalization extension.
This extension provides internationalization utilities: a translations
store, hooks to set locale for the current request, functions to manipulate
dates according to timezones or translate and localize strings an... | apache-2.0 |
Cgruppo/oppia | core/domain/user_jobs_test.py | 6 | 24147 | # 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 |
meska/telegrambot | parser.py | 1 | 6562 | #!/usr/bin/env python
#coding:utf-8
"""
Author: Marco Mescalchin --<>
Purpose: incoming messages parser for telegram bot, TODO: use signals for better separation
Created: 06/25/15
"""
from io import BytesIO
import re
import requests
class Parser():
patterns = [
['/help','help'],
['/show','... | gpl-2.0 |
adesor/Pokeball | pokeball/sub.py | 1 | 1445 | import pika
def get_subscriber(host='localhost', port=5672, exchange='default',
binding_keys=['#'], queue=None, exclusive=False):
if not isinstance(binding_keys, list):
binding_keys = list(binding_keys)
connection = pika.BlockingConnection(pika.ConnectionParameters(host=host))
c... | gpl-2.0 |
mitya57/django | tests/httpwrappers/tests.py | 14 | 30531 | import copy
import json
import os
import pickle
import unittest
import uuid
from django.core.exceptions import DisallowedRedirect, SuspiciousOperation
from django.core.serializers.json import DjangoJSONEncoder
from django.core.signals import request_finished
from django.db import close_old_connections
from django.http... | bsd-3-clause |
dparshin/phantomjs | src/qt/qtwebkit/Tools/Scripts/webkitpy/common/thread/messagepump.py | 151 | 2482 | # Copyright (c) 2010 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 ... | bsd-3-clause |
mskala/birdie | birdieapp/gui/mediaviewer.py | 1 | 3319 | # -*- coding: utf-8 -*-
# Copyright (C) 2013-2014 Ivo Nunes/Vasco Nunes
# 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 versio... | gpl-3.0 |
vipul-sharma20/oh-mainline | vendor/packages/gdata/samples/oauth/oauth_on_appengine/appengine_utilities/sessions.py | 128 | 36373 | # -*- coding: utf-8 -*-
"""
Copyright (c) 2008, appengine-utilities project
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
... | agpl-3.0 |
Dunkas12/BeepBoopBot | lib/youtube_dl/extractor/rutv.py | 21 | 7710 | # coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
ExtractorError,
int_or_none
)
class RUTVIE(InfoExtractor):
IE_DESC = 'RUTV.RU'
_VALID_URL = r'''(?x)
https?://player\.(?:rutv\.ru|vgtrk\.com)/
(?P<path>flash\... | gpl-3.0 |
leohmoraes/weblate | weblate/trans/management/commands/loadpo.py | 9 | 1599 | # -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2015 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <http://weblate.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, eithe... | gpl-3.0 |
tumbl3w33d/ansible | lib/ansible/plugins/connection/kubectl.py | 26 | 13568 | # Based on the docker connection plugin
#
# Connection plugin for configuring kubernetes containers with kubectl
# (c) 2017, XuXinkun <xuxinkun@gmail.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 publis... | gpl-3.0 |
mday299/ardupilot | Tools/scripts/build_binaries.py | 1 | 29784 | #!/usr/bin/env python
"""
script to build the latest binaries for each vehicle type, ready to upload
Peter Barker, August 2017
based on build_binaries.sh by Andrew Tridgell, March 2013
"""
from __future__ import print_function
import datetime
import optparse
import os
import re
import shutil
import time
import subpr... | gpl-3.0 |
hdinsight/hue | desktop/core/ext-py/pyformance-0.3.2/pyformance/reporters/console_reporter.py | 33 | 1438 | # -*- coding: utf-8 -*-
from __future__ import print_function
import sys
import datetime
from .reporter import Reporter
class ConsoleReporter(Reporter):
"""
Show metrics in a human readable form.
This is useful for debugging if you want to read the current state on the console.
"""
def __init__(... | apache-2.0 |
stympy/ansible-modules-extras | windows/win_nssm.py | 80 | 5380 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2015, Heyo
#
# 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) a... | gpl-3.0 |
dchilds7/Deysha-Star-Formation | vispy/ext/_bundled/freetype.py | 20 | 18446 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
#
# FreeType high-level python API - Copyright 2011 Nicolas P. Rougier
# Distributed under the terms of the new BSD license.
#
# ---------------------------------------------------------------... | bsd-3-clause |
smurfix/HomEvenT | modules/wago.py | 1 | 24981 | # -*- coding: utf-8 -*-
##
## Copyright © 2007-2012, Matthias Urlichs <matthias@urlichs.de>
##
## 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... | gpl-3.0 |
aviciimaxwell/odoo | addons/website_blog/controllers/main.py | 132 | 16323 | # -*- coding: utf-8 -*-
import datetime
import werkzeug
from openerp import tools
from openerp.addons.web import http
from openerp.addons.web.controllers.main import login_redirect
from openerp.addons.web.http import request
from openerp.addons.website.models.website import slug
from openerp.osv.orm import browse_rec... | agpl-3.0 |
arangodb/arangodb | 3rdParty/boost/1.71.0/libs/python/test/calling_conventions_mf.py | 20 | 1808 | # Copyright Nicolas Lelong, 2010. Distributed under the Boost
# Software License, Version 1.0 (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
"""
>>> from calling_conventions_mf_ext import *
>>> x = X__cdecl()
>>> x.f0()
>>> x.g0()
>>> x.f1(1)
>>> x.g1(1)
>>> x.f2(1, 2)
>>> ... | apache-2.0 |
effa/flocs | concepts/models/instruction.py | 2 | 1213 | """
Model for instruction that is shown to user in case he deals with new (or not
yet mastered) concept.
"""
from django.db import models
from concepts.models import Concept
from collections import namedtuple
class Instruction(models.Model):
""" Instruction for better understanding of a specific concept by
... | gpl-2.0 |
mortada/tensorflow | tensorflow/python/training/saver_large_partitioned_variable_test.py | 141 | 2261 | # 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 |
nikolas/lettuce | tests/integration/lib/Django-1.3/tests/regressiontests/admin_validation/models.py | 92 | 1245 | """
Tests of ModelAdmin validation logic.
"""
from django.db import models
class Album(models.Model):
title = models.CharField(max_length=150)
class Song(models.Model):
title = models.CharField(max_length=150)
album = models.ForeignKey(Album)
original_release = models.DateField(editable=False)
... | gpl-3.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.