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 |
|---|---|---|---|---|---|
mstriemer/zamboni | mkt/detail/tests/test_views.py | 3 | 7327 | # -*- coding: utf-8 -*-
import hashlib
import json
import zipfile
from django.core.files.storage import default_storage as storage
import mock
from nose.tools import eq_
import mkt
import mkt.site.tests
from mkt.constants import MANIFEST_CONTENT_TYPE
from mkt.webapps.models import Webapp
from mkt.site.fixtures impo... | bsd-3-clause |
oleiade/py-elevator | pyelevator/client.py | 1 | 2696 | # -*- coding: utf-8 -*-
# Copyright (c) 2012 theo crevon
#
# See the file LICENSE for copying permission.
from .base import Client
from .batch import WriteBatch
class RangeIter(object):
def __init__(self, range_datas):
self._container = range_datas if self._valid_range(range_datas) else None
def _v... | mit |
MartialD/hyperspy | hyperspy/_components/eels_vignetting.py | 3 | 3548 | # -*- coding: utf-8 -*-
# Copyright 2007-2016 The HyperSpy developers
#
# This file is part of HyperSpy.
#
# HyperSpy 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 |
SamiHiltunen/invenio-upgrader | invenio_upgrader/upgrades/invenio_2013_09_02_new_bibARXIVPDF.py | 5 | 1418 | # -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2013 CERN.
#
# Invenio is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later... | gpl-2.0 |
seeschloss/grammalecte | Grammalecte.py | 1 | 4975 | # -*- encoding: UTF-8 -*-
# Grammalecte for Writer
# License: MPL 2
# A derivative work of Lightproof from László Németh (http://cgit.freedesktop.org/libreoffice/lightproof/)
import uno
import unohelper
import sys
import traceback
from collections import deque
from com.sun.star.linguistic2 import XProofreader, XSuppo... | gpl-3.0 |
J861449197/edx-platform | openedx/core/djangoapps/credit/migrations/0015_auto__add_field_creditprovider_provider_description.py | 66 | 12700 | # -*- 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 'CreditProvider.provider_description'
db.add_column('credi... | agpl-3.0 |
tedi3231/openerp | openerp/addons/account_bank_statement_extensions/wizard/__init__.py | 442 | 1125 | # -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
#
# Copyright (c) 2011 Noviat nv/sa (www.noviat.be). All rights reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under ... | agpl-3.0 |
Arundhatii/erpnext | erpnext/controllers/selling_controller.py | 12 | 13180 | # Copyright (c) 2015, Frappe 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 cint, flt, cstr, comma_or
from frappe import _, throw
from erpnext.stock.get_item_details import get_bin_details
... | gpl-3.0 |
exelearning/iteexe | twisted/manhole/ui/gtk2manhole.py | 14 | 12391 | # -*- Python -*-
# $Id: gtk2manhole.py,v 1.9 2003/09/07 19:58:09 acapnotic Exp $
# Copyright (c) 2001-2004 Twisted Matrix Laboratories.
# See LICENSE for details.
"""Manhole client with a GTK v2.x front-end.
"""
__version__ = '$Revision: 1.9 $'[11:-2]
from twisted import copyright
from twisted.internet import react... | gpl-2.0 |
Kaceykaso/design_by_roomba | python/test2.py | 1 | 1337 | #! /usr/bin/env python
# Another simple test script, with a little more planning
# Longer song, moves forwards and backwards, turns in place
import serial
import create
# Create robot
robot = create.Create("/dev/ttyUSB0")
robot.toFullMode()
#Get pose, play song, dance, play song, and re-get pose!
pose = robot.getPo... | mit |
sarahgrogan/scikit-learn | examples/calibration/plot_calibration.py | 225 | 4795 | """
======================================
Probability calibration of classifiers
======================================
When performing classification you often want to predict not only
the class label, but also the associated probability. This probability
gives you some kind of confidence on the prediction. However,... | bsd-3-clause |
brandsoulmates/incubator-airflow | airflow/contrib/operators/ssh_execute_operator.py | 15 | 5606 | # -*- coding: utf-8 -*-
#
# 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
... | apache-2.0 |
funkring/fdoo | addons/report_webkit/report_helper.py | 381 | 3507 | # -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2010 Camptocamp SA (http://www.camptocamp.com)
# All Right Reserved
#
# Author : Nicolas Bessi (Camptocamp)
#
# WARNING: This program as such is intended to be used by professional
# programmers who... | agpl-3.0 |
mouhb/cjdns | node_build/dependencies/libuv/build/gyp/test/generator-output/gyptest-copies.py | 66 | 1920 | #!/usr/bin/env python
# Copyright (c) 2012 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 file copies with --generator-output using an explicit build
target of 'all'.
"""
import TestGyp
# Android doesn't support --g... | gpl-3.0 |
isuraed/nfldraft | draft/app/models.py | 1 | 1334 | from django.db import models
# Create your models here.
class PositionCategory(models.Model):
name = models.CharField(max_length=255)
def __unicode__(self):
return self.name
class Position(models.Model):
name = models.CharField(max_length=255)
category = models.ForeignKey(PositionCategory)
... | mit |
ecederstrand/django | tests/model_package/tests.py | 380 | 2668 | from __future__ import unicode_literals
from django.db import connection, models
from django.db.backends.utils import truncate_name
from django.test import TestCase
from .models.article import Article, Site
from .models.publication import Publication
class Advertisement(models.Model):
customer = models.CharFiel... | bsd-3-clause |
kenshay/ImageScript | Script_Runner/PYTHON/Lib/site-packages/setuptools/command/install_scripts.py | 454 | 2439 | from distutils import log
import distutils.command.install_scripts as orig
import os
import sys
from pkg_resources import Distribution, PathMetadata, ensure_directory
class install_scripts(orig.install_scripts):
"""Do normal script install, plus any egg_info wrapper scripts"""
def initialize_options(self):
... | gpl-3.0 |
chennan47/osf.io | addons/mendeley/migrations/0003_auto_20170713_1125.py | 22 | 1437 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-07-13 16:25
from __future__ import unicode_literals
import pytz
import datetime
from django.db import migrations
import django_extensions.db.fields
class Migration(migrations.Migration):
dependencies = [
('addons_mendeley', '0002_auto_20170323... | apache-2.0 |
alon/servo | tests/wpt/web-platform-tests/old-tests/webdriver/navigation/auth_tests.py | 141 | 1389 | import os
import sys
import unittest
import ConfigParser
sys.path.insert(1, os.path.abspath(os.path.join(__file__, "../..")))
import base_test
from selenium.common import exceptions
from wptserve import server
from wptserve.router import any_method
from wptserve.handlers import basic_auth_handler
class WebDriverAuthT... | mpl-2.0 |
ctogle/grapeipm_support | wu_gather.py | 1 | 6657 | #!/usr/bin/python2.7
import pdb,fnmatch,os,csv,json,time,numpy,argparse,datetime,collections
from six.moves import urllib
import convert
def urlfetch(origin,outpath):
'''If "outpath" is nonexistent, download data from "origin" to "outpath".
Return True if a download was performed, False otherwise.'''
if n... | mit |
rajsadho/django | django/contrib/gis/sitemaps/kml.py | 398 | 2544 | from django.apps import apps
from django.contrib.gis.db.models.fields import GeometryField
from django.contrib.sitemaps import Sitemap
from django.core import urlresolvers
from django.db import models
class KMLSitemap(Sitemap):
"""
A minimal hook to produce KML sitemaps.
"""
geo_format = 'kml'
de... | bsd-3-clause |
oliverhr/odoo | addons/stock_account/wizard/__init__.py | 351 | 1105 | # -*- 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 |
40223101/2015cd_midterm | static/Brython3.1.0-20150301-090019/Lib/test/support.py | 603 | 68067 | """Supporting definitions for the Python regression tests."""
if __name__ != 'test.support':
raise ImportError('support must be imported from the test package')
import contextlib
import errno
import functools
import gc
import socket
import sys
import os
import platform
import shutil
import warnings
import unittes... | gpl-3.0 |
takeshineshiro/django | tests/update/tests.py | 325 | 5121 | from __future__ import unicode_literals
from django.test import TestCase
from .models import A, B, D, Bar, DataPoint, Foo, RelatedPoint
class SimpleTest(TestCase):
def setUp(self):
self.a1 = A.objects.create()
self.a2 = A.objects.create()
for x in range(20):
B.objects.create(... | bsd-3-clause |
overtherain/scriptfile | software/googleAppEngine/lib/django_1_3/django/utils/datetime_safe.py | 496 | 2685 | # Python's datetime strftime doesn't handle dates before 1900.
# These classes override date and datetime to support the formatting of a date
# through its full "proleptic Gregorian" date range.
#
# Based on code submitted to comp.lang.python by Andrew Dalke
#
# >>> datetime_safe.date(1850, 8, 2).strftime("%Y/%m/%d was... | mit |
Mignet/dpark | dpark/serialize.py | 8 | 9566 | import sys, types
from cStringIO import StringIO
import marshal, new, cPickle
import itertools
from pickle import Pickler, whichmodule
import logging
logger = logging.getLogger(__name__)
class MyPickler(Pickler):
dispatch = Pickler.dispatch.copy()
@classmethod
def register(cls, type, reduce):
def ... | bsd-3-clause |
mzdaniel/oh-mainline | vendor/packages/django-invitation/invitation/models.py | 16 | 3996 | import os
import random
import datetime
from django.db import models
from django.conf import settings
from django.utils.http import int_to_base36
from django.utils.hashcompat import sha_constructor
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth.models import User
from django.core.mail ... | agpl-3.0 |
overtherain/scriptfile | software/googleAppEngine/lib/django_1_3/django/core/handlers/modpython.py | 56 | 8217 | import os
from pprint import pformat
import sys
from warnings import warn
from django import http
from django.core import signals
from django.core.handlers.base import BaseHandler
from django.core.urlresolvers import set_script_prefix
from django.utils import datastructures
from django.utils.encoding import force_unic... | mit |
Tiglas/pickup-planner | request_handler/flask/lib/python2.7/site-packages/flask/globals.py | 783 | 1137 | # -*- coding: utf-8 -*-
"""
flask.globals
~~~~~~~~~~~~~
Defines all the global objects that are proxies to the current
active context.
:copyright: (c) 2011 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
from functools import partial
from werkzeug.local import LocalStack, ... | mit |
whausen/part | src/adhocracy/migration/versions/032_remove_comment_title.py | 6 | 1441 | from datetime import datetime
from sqlalchemy import MetaData, Column, ForeignKey, Table
from sqlalchemy import DateTime, Integer, Unicode, UnicodeText
metadata = MetaData()
old_revision_table = Table('revision', metadata,
Column('id', Integer, primary_key=True),
Column('create_time', DateTime, default=datet... | agpl-3.0 |
rghe/ansible | test/units/plugins/connection/test_ssh.py | 27 | 28953 | # -*- coding: utf-8 -*-
# (c) 2015, Toshio Kuratomi <tkuratomi@ansible.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
# (a... | gpl-3.0 |
muhkuh-sys/org.muhkuh.tests-ramtest | jonchki/dulwich/contrib/swift.py | 4 | 35511 | # swift.py -- Repo implementation atop OpenStack SWIFT
# Copyright (C) 2013 eNovance SAS <licensing@enovance.com>
#
# Author: Fabien Boucher <fabien.boucher@enovance.com>
#
# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
# General Public License as public by the Free Software Foundation; ve... | gpl-2.0 |
hynnet/hiwifi-openwrt-HC5661-HC5761 | staging_dir/host/lib/scons-2.1.0/SCons/compat/_scons_builtins.py | 21 | 5045 | #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# with... | gpl-2.0 |
javiercantero/streamlink | src/streamlink/plugin/plugin.py | 1 | 15445 | import ast
import logging
import operator
import re
import time
import requests.cookies
from functools import partial
from collections import OrderedDict
from streamlink.cache import Cache
from streamlink.exceptions import PluginError, NoStreamsError
from streamlink.options import Options, Arguments
# FIXME: This is... | bsd-2-clause |
Nzbuu/SensorMesh.py | sensormesh/thingspeak.py | 1 | 3309 | from datetime import datetime
import requests
import dateutil.parser
from .endpoints import DataTarget, DataSource, ApiMixin, DataApi
from .exceptions import ConfigurationError
class ThingSpeakApi(DataApi):
def __init__(self, key=None, channel=None,
base_url='https://api.thingspeak.c... | mit |
r-icarus/openstack_microserver | openstack_dashboard/openstack/common/threadgroup.py | 19 | 3894 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Red Hat, 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
#
#... | apache-2.0 |
DeveloperMal/wger | wger/nutrition/views/meal.py | 2 | 2882 | # -*- coding: utf-8 -*-
# This file is part of wger Workout Manager.
#
# wger Workout Manager is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any ... | agpl-3.0 |
bpgc-cte/python2017 | Week 7/django/lib/python3.6/site-packages/django/test/client.py | 44 | 28212 | from __future__ import unicode_literals
import json
import mimetypes
import os
import re
import sys
from copy import copy
from importlib import import_module
from io import BytesIO
from django.conf import settings
from django.core.handlers.base import BaseHandler
from django.core.handlers.wsgi import ISO_8859_1, UTF_... | mit |
Mhkeane/SampleRSA | RSA.py | 1 | 1679 | import sys
def init():
global n_public_key, e_public_key, private_key
prime_one = 2957
prime_two = 3023
n_public_key = prime_one * prime_two
e_public_key = 65537
phi = (prime_one - 1) * (prime_two - 1)
# This is the Euler Phi function applied to n_public_key.
# As n_public_key is exact... | gpl-3.0 |
ToontownUprising/src | toontown/minigame/DistributedVineGame.py | 2 | 65487 | from pandac.PandaModules import Point3, ForceNode, LinearVectorForce, CollisionHandlerEvent, CollisionNode, CollisionSphere, Camera, PerspectiveLens, Vec4, Point2, ActorNode, Vec3, BitMask32
from direct.interval.IntervalGlobal import Sequence, Parallel, Func, Wait, LerpPosInterval, ActorInterval, LerpScaleInterval, Pro... | mit |
ChromiumWebApps/chromium | native_client_sdk/src/tools/tests/create_html_test.py | 108 | 1808 | #!/usr/bin/env python
# Copyright (c) 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 os
import unittest
import shutil
import sys
import tempfile
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
PARENT_D... | bsd-3-clause |
tgolen/garden | public/web/bower/bootstrap/test-infra/s3_cache.py | 1700 | 3523 | #!/usr/bin/env python2.7
from __future__ import absolute_import, unicode_literals, print_function, division
from sys import argv
from os import environ, stat, remove as _delete_file
from os.path import isfile, dirname, basename, abspath
from hashlib import sha256
from subprocess import check_call as run
from boto.s3.... | mit |
SanchayanMaity/gem5 | configs/ruby/__init__.py | 63 | 2098 | # Copyright (c) 2016 ARM Limited
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implementation of the functionality ... | bsd-3-clause |
scotwk/cloud-custodian | tools/zerodark/setup.py | 2 | 1619 | # Copyright 2017-2018 Capital One Services, 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 agreed ... | apache-2.0 |
huwenhui/flask | flask/wrappers.py | 142 | 7532 | # -*- coding: utf-8 -*-
"""
flask.wrappers
~~~~~~~~~~~~~~
Implements the WSGI wrappers (request and response).
:copyright: (c) 2015 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
from werkzeug.wrappers import Request as RequestBase, Response as ResponseBase
from werkzeug.exce... | bsd-3-clause |
airbnb/airflow | tests/providers/amazon/aws/operators/test_emr_modify_cluster.py | 7 | 2886 | #
# 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 |
lupyuen/RaspberryPiImage | home/pi/GrovePi/Software/Python/others/temboo/Library/NOAA/ListCoordinatesForZipcode.py | 5 | 3192 | # -*- coding: utf-8 -*-
###############################################################################
#
# ListCoordinatesForZipcode
# Retrieve latitude and longitude data for a specified zipcode (in 50 U.S. States and Puerto Rico).
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2014, Temboo Inc.
#
# Licensed under ... | apache-2.0 |
anthgur/servo | tests/wpt/web-platform-tests/tools/pywebsocket/test/testdata/handlers/sub/exception_in_transfer_wsh.py | 499 | 1816 | # 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 of conditions and the f... | mpl-2.0 |
miguelgrinberg/heat | heat/tests/test_grouputils.py | 6 | 2850 | #
# 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
# ... | apache-2.0 |
googleapis/api-client-staging | generated/python/gapic-google-cloud-spanner-admin-database-v1/test/google/cloud/gapic/spanner_admin_database/v1/test_database_admin_client.py | 7 | 18621 | # Copyright 2017, 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 ... | bsd-3-clause |
rvmoura96/projeto-almoxarifado | myvenv/Lib/site-packages/django/views/decorators/cache.py | 586 | 2304 | from functools import wraps
from django.middleware.cache import CacheMiddleware
from django.utils.cache import add_never_cache_headers, patch_cache_control
from django.utils.decorators import (
available_attrs, decorator_from_middleware_with_args,
)
def cache_page(*args, **kwargs):
"""
Decorator for view... | mit |
ivanhorvath/openshift-tools | openshift_tools/monitoring/gcputil.py | 13 | 3808 | #!/usr/bin/env python
# vim: expandtab:tabstop=4:shiftwidth=4
'''
Interface to gcloud
'''
#
# Copyright 2015 Red Hat 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
#
# ... | apache-2.0 |
smartercleanup/api | src/sa_api_v2/tests/test_models.py | 3 | 25975 | import json
from django.test import TestCase
# from django.test.client import Client
from django.test.client import RequestFactory
# from django.contrib.auth.models import User
from django.core.cache import cache
from django.core.urlresolvers import reverse
# from mock import patch
# from nose.tools import (istest, ass... | gpl-3.0 |
redengineer/airflow | airflow/operators/subdag_operator.py | 33 | 1588 | from airflow.utils import AirflowException
from airflow.models import BaseOperator
from airflow.utils import apply_defaults
from airflow.executors import DEFAULT_EXECUTOR
class SubDagOperator(BaseOperator):
template_fields = tuple()
ui_color = '#555'
ui_fgcolor = '#fff'
@apply_defaults
def __ini... | apache-2.0 |
ilyapatrushev/isimage | setup.py | 1 | 1132 | from setuptools import setup, find_packages
import os
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(name = 'isimage'
, version = '0.1.2'
, packages = find_packages()
, entry_points = {'console_scripts':['analyse_image = isimage.analyse_image:main'
... | gpl-2.0 |
jscn/django | tests/invalid_models_tests/test_backend_specific.py | 50 | 1060 | # -*- encoding: utf-8 -*-
from __future__ import unicode_literals
from django.core.checks import Error
from django.db import connections, models
from django.test import SimpleTestCase, mock
from django.test.utils import isolate_apps
def dummy_allow_migrate(db, app_label, **hints):
# Prevent checks from being run... | bsd-3-clause |
openstack/vitrage-dashboard | vitrage_dashboard/enabled/_4010_project_topology_vitrage_panel.py | 1 | 1176 | # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the... | apache-2.0 |
foodszhang/kbengine | kbe/res/scripts/common/Lib/unittest/test/testmock/testmock.py | 73 | 45075 | import copy
import sys
import unittest
from unittest.test.testmock.support import is_instance
from unittest import mock
from unittest.mock import (
call, DEFAULT, patch, sentinel,
MagicMock, Mock, NonCallableMock,
NonCallableMagicMock, _CallList,
create_autospec
)
class Iter(object):
def __init__... | lgpl-3.0 |
LukasBoersma/readthedocs.org | readthedocs/restapi/views/model_views.py | 16 | 8265 | import logging
from django.shortcuts import get_object_or_404
from docutils.utils.math.math2html import Link
from rest_framework import decorators, permissions, viewsets, status
from rest_framework.decorators import detail_route
from rest_framework.renderers import JSONPRenderer, JSONRenderer, BrowsableAPIRenderer
fro... | mit |
michaelgallacher/intellij-community | python/lib/Lib/markupbase.py | 243 | 14350 | """Shared support for scanning document type declarations in HTML and XHTML.
This module is used as a foundation for the HTMLParser and sgmllib
modules (indirectly, for htmllib as well). It has no documented
public API and should not be used directly.
"""
import re
_declname_match = re.compile(r'[a-zA-Z][-_.a-zA-Z... | apache-2.0 |
amyvmiwei/kbengine | kbe/src/lib/python/Tools/scripts/fixheader.py | 112 | 1208 | #! /usr/bin/env python3
# Add some standard cpp magic to a header file
import sys
def main():
args = sys.argv[1:]
for filename in args:
process(filename)
def process(filename):
try:
f = open(filename, 'r')
except IOError as msg:
sys.stderr.write('%s: can\'t open: %s\n' % (fil... | lgpl-3.0 |
Gamebasis/3DGamebasisServer | GameData/blender-2.71-windows64/2.71/python/lib/mimetypes.py | 83 | 20735 | """Guess the MIME type of a file.
This module defines two useful functions:
guess_type(url, strict=True) -- guess the MIME type and encoding of a URL.
guess_extension(type, strict=True) -- guess the extension for a given MIME type.
It also contains the following, for tuning the behavior:
Data:
knownfiles -- list ... | gpl-3.0 |
wetneb/multiprocessing_generator | multiprocessing_generator/__init__.py | 1 | 3447 | # -*- encoding: utf-8 -*-
from __future__ import unicode_literals
import sys, os
if sys.version_info[0] < 3:
from Queue import Empty
else:
from queue import Empty
from multiprocessing import Process, Queue
class ExceptionItem(object):
def __init__(self, exception):
self.exception = exception
cla... | mit |
lidiamcfreitas/FenixScheduleMaker | ScheduleMaker/brython/www/src/Lib/heapq.py | 628 | 18065 | """Heap queue algorithm (a.k.a. priority queue).
Heaps are arrays for which a[k] <= a[2*k+1] and a[k] <= a[2*k+2] for
all k, counting elements from 0. For the sake of comparison,
non-existing elements are considered to be infinite. The interesting
property of a heap is that a[0] is always its smallest element.
Usag... | bsd-2-clause |
xujianhai/flask | examples/flaskr/flaskr.py | 157 | 2893 | # -*- coding: utf-8 -*-
"""
Flaskr
~~~~~~
A microblog example application written as Flask tutorial with
Flask and sqlite3.
:copyright: (c) 2015 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import os
from sqlite3 import dbapi2 as sqlite3
from flask import Flask, request... | bsd-3-clause |
GuessWhoSamFoo/pandas | asv_bench/benchmarks/indexing.py | 5 | 10167 | import warnings
import numpy as np
import pandas.util.testing as tm
from pandas import (Series, DataFrame, Panel, MultiIndex,
Int64Index, UInt64Index, Float64Index,
IntervalIndex, CategoricalIndex,
IndexSlice, concat, date_range)
class NumericSeriesIndexing... | bsd-3-clause |
cloudera/hue | desktop/core/ext-py/sasl-0.1.1/sasl/saslwrapper.py | 76 | 4375 | # This file was automatically generated by SWIG (http://www.swig.org).
# Version 1.3.36
#
# Don't modify this file, modify the SWIG interface instead.
# This file is compatible with both classic and new-style classes.
import _saslwrapper
import new
new_instancemethod = new.instancemethod
try:
_swig_property = prop... | apache-2.0 |
DBCDK/opensearch | tools/create_test_suite_files.py | 1 | 4318 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# -*- mode: python -*-
# This file is part of opensearch.
# Copyright © 2009, Dansk Bibliotekscenter a/s,
# Tempovej 7-11, DK-2750 Ballerup, Denmark. CVR: 15149043
#
# opensearch is free software: you can redistribute it and/or modify
# it under the terms of the GNU Gene... | gpl-3.0 |
NINAnor/QGIS | python/plugins/processing/algs/lidar/fusion/TinSurfaceCreate.py | 5 | 4377 | # -*- coding: utf-8 -*-
"""
***************************************************************************
TINSurfaceCreate.py
---------------------
Date : June 2014
Copyright : (C) 2014 by Agresta S. Coop
Email : iescamochero at agresta dot org
**************... | gpl-2.0 |
mrcslws/htmresearch | projects/sdr_paper/tm_experiments/run_tm_noise_experiment.py | 7 | 7201 | # ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2017, 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 progra... | agpl-3.0 |
mosieurlaurin/kwapi | kwapi/plugins/rrd/app.py | 1 | 1601 | # -*- coding: utf-8 -*-
#
# Author: François Rossigneux <francois.rossigneux@inria.fr>
#
# 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
#
# Unles... | apache-2.0 |
alireza-molaee/django_simple_notifications | webline_notifications/tests.py | 2 | 5053 | from django.test import TestCase
from models import Notification
from django.contrib.auth.models import User
class NotificationsTestCase(TestCase):
fixtures = ['users.json']
@classmethod
def setUpTestData(cls):
admin = User.objects.get(pk=1)
group_foo = User.objects.filter(groups__nam... | gpl-2.0 |
andrewsmedina/django | tests/generic_views/test_detail.py | 5 | 4933 | from __future__ import absolute_import
from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase
from django.views.generic.base import View
from .models import Artist, Author, Page
class DetailViewTest(TestCase):
fixtures = ['generic-views-test-data.json']
urls = 'generic_view... | bsd-3-clause |
dwfreed/mitmproxy | mitmproxy/flowfilter.py | 1 | 13211 | """
The following operators are understood:
~q Request
~s Response
Headers:
Patterns are matched against "name: value" strings. Field names are
all-lowercase.
~a Asset content-type in response. Asset content types are:
... | mit |
thisismyrobot/gedit-pytts | src/geditpytts.py | 1 | 2206 | from gettext import gettext as _
import gtk
import gedit
import pyanalyse
import ttshelper
class GeditPyTTSWindowHelper:
def __init__(self, plugin, window):
self._window = window
self._plugin = plugin
# fire up tts
self._tts = ttshelper.TTSHelper(rate=150)
... | bsd-2-clause |
nagyistoce/euca2ools | euca2ools/commands/ec2/createcustomergateway.py | 3 | 2315 | # Copyright 2014 Eucalyptus Systems, Inc.
#
# Redistribution and use of this software 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 t... | bsd-2-clause |
wang1352083/pythontool | python-2.7.12-lib/rexec.py | 228 | 20148 | """Restricted execution facilities.
The class RExec exports methods r_exec(), r_eval(), r_execfile(), and
r_import(), which correspond roughly to the built-in operations
exec, eval(), execfile() and import, but executing the code in an
environment that only exposes those built-in operations that are
deemed safe. To t... | mit |
Alecto3-D/testable-greeter | bb-master/sandbox/lib/python3.5/site-packages/buildbot/scripts/tryserver.py | 11 | 1554 | # 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... | mit |
kevthunder/codewave-py | codewave_core/cmd_finder.py | 3 | 4857 | import codewave_core.command as command
import codewave_core.logger as logger
import codewave_core.util as util
import codewave_core.context as context
import codewave_core.cmds.core
import codewave_core.cmds.html
import codewave_core.cmds.js
import codewave_core.cmds.php
class CmdFinder():
def __init__(self,names, ... | gpl-2.0 |
kohout/djangocms-getaweb-events | djangocms_events/south_migrations/0007_auto__add_field_eventslist_max_item_count.py | 1 | 4701 | # -*- 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 'EventsList.max_item_count'
db.add_column(u'djangocms_even... | unlicense |
hahalml/bigcouch | couchjs/scons/scons-local-2.0.1/SCons/Tool/MSCommon/vc.py | 53 | 16640 | #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without li... | apache-2.0 |
ballouche/navitia | source/jormungandr/jormungandr/scenarios/tests/qualifier_tests.py | 1 | 13572 | # Copyright (c) 2001-2014, Canal TP and/or its affiliates. All rights reserved.
#
# This file is part of Navitia,
# the software to build cool stuff with public transport.
#
# Hope you'll enjoy and contribute to this project,
# powered by Canal TP (www.canaltp.fr).
# Help us simplify mobility and open public tr... | agpl-3.0 |
Outernet-Project/bottle-utils-common | bottle_utils/common.py | 1 | 3528 | """
.. module:: bottle_utils.common
:synopsis: Common utility functions
.. moduleauthor:: Outernet Inc <hello@outernet.is>
"""
from __future__ import unicode_literals
import sys
try:
from urllib.parse import quote
except ImportError:
from urllib import quote
from bottle import request, html_escape
__all... | bsd-2-clause |
projectcalico/calico-neutron | neutron/plugins/ofagent/common/config.py | 17 | 1426 | # Copyright (C) 2014 VA Linux Systems Japan K.K.
# Copyright (C) 2014 Fumihiko Kakuma <kakuma at valinux co jp>
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at... | apache-2.0 |
marcominetti/systemd-ubuntu-with-dbus | tools/make-man-index.py | 125 | 4070 | # -*- Mode: python; coding: utf-8; indent-tabs-mode: nil -*- */
#
# This file is part of systemd.
#
# Copyright 2012 Lennart Poettering
# Copyright 2013 Zbigniew Jędrzejewski-Szmek
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as ... | gpl-2.0 |
kisna72/django | django/utils/regex_helper.py | 432 | 12673 | """
Functions for reversing a regular expression (used in reverse URL resolving).
Used internally by Django and not intended for external use.
This is not, and is not intended to be, a complete reg-exp decompiler. It
should be good enough for a large class of URLS, however.
"""
from __future__ import unicode_literals
... | bsd-3-clause |
annarev/tensorflow | tensorflow/python/platform/test.py | 10 | 3579 | # Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | apache-2.0 |
vivsh/django-ginger | ginger/forms/forms.py | 1 | 8655 |
import inspect
from collections import OrderedDict
from django.core.exceptions import ImproperlyConfigured
from django.utils import six
from django import forms
from django.utils.encoding import force_text
from ginger.formatters import Formatter
from ginger.forms.fields import GingerSortField
from ginger import utils... | mit |
codelv/enaml-native | src/enamlnative/android/android_activity.py | 1 | 3472 | """
Copyright (c) 2017, Jairus Martin.
Distributed under the terms of the MIT License.
The full license is in the file LICENSE, distributed with this software.
Created on July 24, 2017
@author: jrm
"""
from atom.api import Int, set_default
from .bridge import JavaMethod, JavaCallback
from .android_content import C... | mit |
rafwiewiora/msmbuilder | msmbuilder/utils/progressbar/widgets.py | 14 | 11170 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# progressbar - Text progress bar library for Python.
# Copyright (c) 2005 Nilton Volpato
#
# This library 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; ei... | lgpl-2.1 |
hips/autograd | tests/test_dict.py | 3 | 3599 | import autograd.numpy as np
import autograd.numpy.random as npr
from autograd.test_util import check_grads
from autograd import dict as ag_dict, isinstance as ag_isinstance
from autograd import grad
import operator as op
npr.seed(0)
def test_getter():
def fun(input_dict):
A = np.sum(input_dict['item_1'])
... | mit |
openstack/monasca-common | monasca_common/kafka_lib/producer/base.py | 2 | 19954 | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the Li... | apache-2.0 |
OpenMined/PySyft | packages/syft/tests/syft/core/node/common/service/resolve_pointer_type_test.py | 1 | 2068 | # stdlib
import operator
from typing import Callable
from typing import List
from typing import Tuple
# third party
import pytest
import torch
# syft absolute
import syft as sy
@pytest.fixture()
def inputs() -> Tuple[int, float, bool, torch.Tensor]:
return (1, 1.5, True, torch.Tensor([1, 2, 3]))
@pytest.fixtu... | apache-2.0 |
nathany/GoSublime | gscomplete.py | 12 | 8352 | from gosubl import gs
from gosubl import mg9
from os.path import basename
from os.path import dirname
import json
import os
import re
import sublime
import sublime_plugin
AC_OPTS = sublime.INHIBIT_WORD_COMPLETIONS | sublime.INHIBIT_EXPLICIT_COMPLETIONS
REASONABLE_PKGNAME_PAT = re.compile(r'^\w+$')
last_gopath = ''
EN... | mit |
Pluto-tv/chromium-crosswalk | third_party/closure_linter/closure_linter/errors.py | 99 | 4184 | #!/usr/bin/env python
# Copyright 2007 The Closure Linter 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
#
#... | bsd-3-clause |
Cloudzero/cloudzero-reactor-aws | reactor/aws/sqs.py | 1 | 1333 | # -*- coding: utf-8 -*-
# Copyright (c) 2016-present, CloudZero, Inc. All rights reserved.
# Licensed under the BSD-style license. See LICENSE file in the project root for full license information.
import botocore.exceptions as botoerr
import lambda_tools
logger = lambda_tools.setup_logging('reactor')
def num_mes... | bsd-3-clause |
jalexvig/tensorflow | tensorflow/python/training/checkpointable/tracking_test.py | 1 | 7266 | # 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 |
myles/time-of-day | timeofday/__init__.py | 1 | 1076 | import os
from flask import Flask
from flask.ext.assets import Environment, Bundle
from webassets.filter import get_filter
from .views import views_blueprint
from .utils import CustomJSONEncoder
app = Flask(__name__, instance_relative_config=True)
assets = Environment(app)
app.json_encoder = CustomJSONEncoder
ap... | bsd-3-clause |
jhbsz/OSI-OS | sys/xen/interface/foreign/mkheader.py | 5 | 4334 | #!/usr/bin/python
import sys, re;
from structs import unions, structs, defines;
# command line arguments
arch = sys.argv[1];
outfile = sys.argv[2];
infiles = sys.argv[3:];
###########################################################################
# configuration #2: architecture information
inttypes = {};
head... | bsd-3-clause |
z-e-r-o/plugin.video.osn | resources/lib/dns/rdtypes/IN/WKS.py | 8 | 3812 | # Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose with or without fee is hereby granted,
# provided that the above copyright notice and this permission notice
# appear in all copies.
#
# THE SOFTWARE IS PROVIDED "... | gpl-3.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.