repo_name stringlengths 6 100 | path stringlengths 4 294 | copies stringlengths 1 5 | size stringlengths 4 6 | content stringlengths 606 896k | license stringclasses 15
values |
|---|---|---|---|---|---|
dylanjbarth/luigi | test/contrib/spark_test.py | 4 | 11041 | # -*- coding: utf-8 -*-
#
# Copyright 2012-2015 Spotify 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 law... | apache-2.0 |
code4futuredotorg/reeborg_tw | src/libraries/Brython3.2.3/Lib/encodings/cp865.py | 272 | 34618 | """ Python Character Mapping Codec generated from 'VENDORS/MICSFT/PC/CP865.TXT' with gencodec.py.
"""#"
import codecs
### Codec APIs
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_map)
def decode(self,input,errors='strict'):
... | agpl-3.0 |
etkirsch/scikit-learn | examples/semi_supervised/plot_label_propagation_digits.py | 268 | 2723 | """
===================================================
Label Propagation digits: Demonstrating performance
===================================================
This example demonstrates the power of semisupervised learning by
training a Label Spreading model to classify handwritten digits
with sets of very few labels.... | bsd-3-clause |
Bachmann1234/diff-cover | diff_cover/report_generator.py | 1 | 11385 | """
Classes for generating diff coverage reports.
"""
from __future__ import unicode_literals
from abc import ABCMeta, abstractmethod
from jinja2 import Environment, PackageLoader
from jinja2_pluralize import pluralize_dj
from diff_cover.snippets import Snippet
import six
class DiffViolations(object):
"""
Cla... | apache-2.0 |
FrankBian/kuma | kuma/demos/admin.py | 5 | 6125 | from django.contrib import admin
from django.contrib.admin import helpers
from django.contrib.admin.util import model_ngettext, get_deleted_objects
from django.db import router
from django.core.exceptions import PermissionDenied
from django.template.response import TemplateResponse
from django.utils.encoding import for... | mpl-2.0 |
leiferikb/bitpop | build/third_party/twisted_10_2/twisted/news/test/test_nntp.py | 55 | 3417 | # Copyright (c) 2001-2004 Twisted Matrix Laboratories.
# See LICENSE for details.
from twisted.trial import unittest
from twisted.news import database
from twisted.news import nntp
from twisted.protocols import loopback
ALL_GROUPS = ('alt.test.nntp', 0, 1, 'y'),
GROUP = ('0', '1', '0', 'alt.test.nntp', 'group', 'sele... | gpl-3.0 |
jjmleiro/hue | desktop/core/ext-py/pycparser-2.14/pycparser/c_lexer.py | 42 | 14447 | #------------------------------------------------------------------------------
# pycparser: c_lexer.py
#
# CLexer class: lexer for the C language
#
# Copyright (C) 2008-2015, Eli Bendersky
# License: BSD
#------------------------------------------------------------------------------
import re
import sys
from .ply imp... | apache-2.0 |
carlosfunk/django-environ | docs/conf.py | 4 | 7832 | # -*- coding: utf-8 -*-
#
# Django-environ documentation build configuration file, created by
# sphinx-quickstart on Mon Apr 1 23:01:04 2013.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
... | mit |
metiscus/pychess | lib/pychess/System/TaskQueue.py | 22 | 2187 | # http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/475160
# Was accepted into Python 2.5, but earlier versions still have
# to do stuff manually
import threading
from pychess.compat import Queue
def TaskQueue ():
if hasattr(Queue, "task_done"):
return Queue()
return _TaskQueue()
class _TaskQue... | gpl-3.0 |
ynov/nwg | deps/boost/tools/build/v2/test/build_file.py | 44 | 5117 | #!/usr/bin/python
# Copyright (C) 2006. Vladimir Prus
# Copyright (C) 2008. Jurko Gospodnetic
# 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)
# Tests that we explicitly request a file (not target) to be built by
#... | mit |
duanwujie/depot_tools | third_party/logilab/astroid/manager.py | 56 | 15736 | # copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of astroid.
#
# astroid 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
#... | bsd-3-clause |
franekp/ankidict | ankidict/thirdparty/bs4/__init__.py | 2 | 18267 | """Beautiful Soup
Elixir and Tonic
"The Screen-Scraper's Friend"
http://www.crummy.com/software/BeautifulSoup/
Beautiful Soup uses a pluggable XML or HTML parser to parse a
(possibly invalid) document into a tree representation. Beautiful Soup
provides provides methods and Pythonic idioms that make it easy to
navigate... | agpl-3.0 |
dcherian/pyroms | examples/Beaufort/make_weight_files.py | 1 | 1429 | import pyroms
# Part of Arctic2 grid containing the Beaufort
irange=(420,580)
jrange=(470,570)
#irange=None
#jrange=None
srcgrd = pyroms.grid.get_ROMS_grid('ARCTIC2')
dstgrd = pyroms.grid.get_ROMS_grid('BEAUFORT')
pyroms.remapping.make_remap_grid_file(srcgrd,irange=irange,jrange=jrange)
pyroms.remapping.make_remap_g... | bsd-3-clause |
Richard-West/RootTheBox | handlers/ErrorHandlers.py | 6 | 2716 | # -*- coding: utf-8 -*-
'''
Created on Mar 13, 2012
@author: moloch
Copyright 2012 Root the Box
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/licen... | apache-2.0 |
owenmorris/pylucene | test/test_FilteredQuery.py | 3 | 4823 | # ====================================================================
# 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 re... | apache-2.0 |
richardmcc/TREC-IS | Interfaces/InterfaceV0.5/project/target/node-modules/webjars/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSUtil.py | 566 | 9386 | # 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.
"""Utility functions shared amongst the Windows generators."""
import copy
import os
_TARGET_TYPE_EXT = {
'executable': '.exe',
'loadable_module': '.dll',
... | apache-2.0 |
sontek/rethinkdb | test/common/test_report.py | 41 | 4853 | # Copyright 2010-2014 RethinkDB, all rights reserved.
from __future__ import print_function
import json, os, re, subprocess
import utils
def format_tests(test_root, test_tree):
tests = []
for name, test in test_tree:
command_line = test.read_file('description')
failed = test.read_file('fail_message'... | agpl-3.0 |
yobin/saepy-log | pygments/lexers/text.py | 41 | 67382 | # -*- coding: utf-8 -*-
"""
pygments.lexers.text
~~~~~~~~~~~~~~~~~~~~
Lexers for non-source code file types.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from bisect import bisect
from pygments.lexer import Lexer, LexerC... | mit |
konkasoftci/azure-linux-automation | remote-scripts/start-server.py | 8 | 1730 | #!/usr/bin/python
##########################################
#THIS SCRIPT ACCETPS SOME SERVER PARAMETERS.
#PLEASE RUN THE SCRIPT WITH -h OR -help FOR MORE DETAILS.
##########################################
from azuremodules import *
import argparse
import sys
#for error checking
parser = argparse.ArgumentParser... | apache-2.0 |
abenzbiria/clients_odoo | addons/hr_payroll/wizard/hr_payroll_contribution_register_report.py | 337 | 2074 | # -*- 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 |
eHealthAfrica/formhub | formhub/preset/mysql_test.py | 2 | 1111 | # this system uses structured settings.py as defined in http://www.slideshare.net/jacobian/the-best-and-worst-of-django
#
# this example third-level staging file overrides some definitions in staging_example.py
# so that it returns the same definitions as the former localsettings.py.examples in the formhub distribution... | bsd-2-clause |
total-impact/depsy | providers/github.py | 5 | 1068 | import requests
from requests.auth import HTTPBasicAuth
import os
import logging
logger = logging.getLogger("github")
# generated the "OAuth Personal Access Token" token here: https://github.com/settings/tokens/new
user = os.environ["GITHUB_OAUTH_USERNAME"]
password = os.environ["GITHUB_OAUTH_ACCESS_TOKEN"]
users_u... | mit |
emedinaa/contentbox | third_party/unidecode/x02c.py | 4 | 3853 | data = (
'', # 0x00
'', # 0x01
'', # 0x02
'', # 0x03
'', # 0x04
'', # 0x05
'', # 0x06
'', # 0x07
'', # 0x08
'', # 0x09
'', # 0x0a
'', # 0x0b
'', # 0x0c
'', # 0x0d
'', # 0x0e
'', # 0x0f
'', # 0x10
'', # 0x11
'', # 0x12
'', # 0x13
'', # 0... | apache-2.0 |
nmartensen/pandas | asv_bench/benchmarks/categoricals.py | 3 | 2803 | from .pandas_vb_common import *
try:
from pandas.api.types import union_categoricals
except ImportError:
try:
from pandas.types.concat import union_categoricals
except ImportError:
pass
class Categoricals(object):
goal_time = 0.2
def setup(self):
N = 100000
self.s ... | bsd-3-clause |
heeraj123/oh-mainline | vendor/packages/twisted/twisted/conch/test/test_helper.py | 17 | 18248 | # -*- test-case-name: twisted.conch.test.test_helper -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
from twisted.conch.insults import helper
from twisted.conch.insults.insults import G0, G1, G2, G3
from twisted.conch.insults.insults import modes, privateModes
from twisted.conch.insults.ins... | agpl-3.0 |
google-research/federated | utils/models/resnet_models.py | 1 | 11325 | # Copyright 2019 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | apache-2.0 |
ptoraskar/scrapy | scrapy/extensions/debug.py | 152 | 1890 | """
Extensions for debugging Scrapy
See documentation in docs/topics/extensions.rst
"""
import sys
import signal
import logging
import traceback
import threading
from pdb import Pdb
from scrapy.utils.engine import format_engine_status
from scrapy.utils.trackref import format_live_refs
logger = logging.getLogger(__n... | bsd-3-clause |
crafty78/ansible | lib/ansible/plugins/callback/dense.py | 14 | 17424 | # (c) 2016, Dag Wieers <dag@wieers.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
... | gpl-3.0 |
CloudServer/nova | nova/tests/unit/api/openstack/compute/test_plugins/dummy_schema.py | 94 | 1276 | # Copyright 2014 IBM
#
# 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 w... | apache-2.0 |
imruahmed/microblog | flask/lib/python2.7/site-packages/openid/urinorm.py | 159 | 5230 | import re
# from appendix B of rfc 3986 (http://www.ietf.org/rfc/rfc3986.txt)
uri_pattern = r'^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?'
uri_re = re.compile(uri_pattern)
# gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@"
#
# sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
# / "*"... | bsd-3-clause |
astrorafael/ema | ema/dev/todtimer.py | 1 | 7813 | # ----------------------------------------------------------------------
# Copyright (c) 2014 Rafael Gonzalez.
#
# 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... | mit |
andre-senna/opencog | opencog/python/dingjie/m_adaptors.py | 36 | 1735 | ##
# @file m_adaptors.py
# @brief adaptor to opencog
# @author Dingjie.Wang
# @version 1.0
# @date 2012-07-31
from opencog.atomspace import Atom, types
from types_inheritance import type_to_name
class Viz_OpenCog_Tree_Adaptor(object):
"""docstring for tree"""
def __init__(self, tree_opencog):
self._op =... | agpl-3.0 |
thundernet8/WRGameVideos-Server | venv/lib/python2.7/site.py | 784 | 27543 | """Append module search paths for third-party packages to sys.path.
****************************************************************
* This module is automatically imported during initialization. *
****************************************************************
In earlier versions of Python (up to 1.5a3), scripts or... | gpl-2.0 |
myfunprograms/deep_learning | project5/files/problem_unittests.py | 159 | 6094 | from copy import deepcopy
from unittest import mock
import tensorflow as tf
def test_safe(func):
"""
Isolate tests
"""
def func_wrapper(*args):
with tf.Graph().as_default():
result = func(*args)
print('Tests Passed')
return result
return func_wrapper
def _ass... | gpl-3.0 |
catkin/xylem | setup.py | 1 | 3476 | #!/usr/bin/env python
from setuptools import setup, find_packages
# TODO: read README and LICENSE files to compose "long description"
#
# This might be useful:
# http://stackoverflow.com/questions/1192632/how-to-convert-restructuredtext-to-plain-text
# http://www.jeffknupp.com/blog/2013/08/16/open-sourcing-a-python-p... | apache-2.0 |
cyx1231st/nova | nova/api/openstack/compute/legacy_v2/contrib/server_groups.py | 15 | 9330 | # Copyright (c) 2014 Cisco Systems, 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 r... | apache-2.0 |
krunal3103/servo | tests/wpt/web-platform-tests/tools/pytest/testing/code/test_excinfo.py | 165 | 30814 | # -*- coding: utf-8 -*-
import _pytest
import py
import pytest
from _pytest._code.code import FormattedExcinfo, ReprExceptionInfo
queue = py.builtin._tryimport('queue', 'Queue')
failsonjython = pytest.mark.xfail("sys.platform.startswith('java')")
from test_source import astonly
try:
import importlib
except Impo... | mpl-2.0 |
miniconfig/home-assistant | homeassistant/helpers/aiohttp_client.py | 9 | 4716 | """Helper for aiohttp webclient stuff."""
import asyncio
import sys
import aiohttp
from aiohttp.hdrs import USER_AGENT, CONTENT_TYPE
from aiohttp import web
from aiohttp.web_exceptions import HTTPGatewayTimeout
import async_timeout
from homeassistant.core import callback
from homeassistant.const import EVENT_HOMEASSI... | mit |
robovm/robovm-studio | python/lib/Lib/site-packages/django/contrib/staticfiles/storage.py | 71 | 3364 | import os
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.core.files.storage import FileSystemStorage
from django.utils.importlib import import_module
from django.contrib.staticfiles import utils
class StaticFilesStorage(FileSystemStorage):
"""
Standard fi... | apache-2.0 |
ClearCorp-dev/odoo | addons/mrp_operations/__init__.py | 443 | 1091 | # -*- 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... | agpl-3.0 |
rubyu/anki | aqt/fields.py | 18 | 5690 | # Copyright: Damien Elmes <anki@ichi2.net>
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
from aqt.qt import *
from anki.consts import *
import aqt
from aqt.utils import showWarning, openHelp, getOnlyText, askUser
class FieldDialog(QDialog):
def __init__(self, mw, note, ord=0, par... | agpl-3.0 |
chamaelj/tools-artbio | unstable/local_tools/id_to_fasta_in_bowtie.py | 4 | 1821 | #!/usr/bin/python
import sys
# python script to extract read id from the id column and pick up the corresponding sequence in a fasta reference read library.
# to use when 3' trimming in bowtie has degraded the information of the initial sequence read
# The script takes a bowtie standard output and create a dictionary... | mit |
fiete201/qutebrowser | qutebrowser/misc/utilcmds.py | 2 | 9615 | # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2014-2021 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser 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 S... | gpl-3.0 |
YinongLong/scikit-learn | examples/preprocessing/plot_function_transformer.py | 158 | 1993 | """
=========================================================
Using FunctionTransformer to select columns
=========================================================
Shows how to use a function transformer in a pipeline. If you know your
dataset's first principle component is irrelevant for a classification task,
you ca... | bsd-3-clause |
aureooms/networkx | networkx/algorithms/bipartite/centrality.py | 4 | 8129 | #-*- coding: utf-8 -*-
# Copyright (C) 2011 by
# Jordi Torrents <jtorrents@milnou.net>
# Aric Hagberg <hagberg@lanl.gov>
# All rights reserved.
# BSD license.
import networkx as nx
__author__ = """\n""".join(['Jordi Torrents <jtorrents@milnou.net>',
'Aric Hagberg (hagberg@lan... | bsd-3-clause |
kmoocdev2/edx-platform | cms/djangoapps/contentstore/views/tests/test_entrance_exam.py | 22 | 13731 | """
Test module for Entrance Exams AJAX callback handler workflows
"""
import json
from django.conf import settings
from django.contrib.auth.models import User
from django.test.client import RequestFactory
from milestones.tests.utils import MilestonesTestCaseMixin
from mock import patch
from opaque_keys.edx.keys impor... | agpl-3.0 |
SlicerRt/SlicerDebuggingTools | PyDevRemoteDebug/ptvsd-4.1.3/ptvsd/_vendored/pydevd/_pydevd_bundle/pydevd_console.py | 1 | 9547 | '''An helper file for the pydev debugger (REPL) console
'''
import sys
import traceback
from code import InteractiveConsole
from _pydev_bundle import _pydev_completer
from _pydev_bundle.pydev_console_utils import BaseInterpreterInterface, BaseStdIn
from _pydev_bundle.pydev_imports import Exec
from _pydev_bund... | bsd-3-clause |
robbiet480/home-assistant | homeassistant/components/min_max/sensor.py | 3 | 6925 | """Support for displaying the minimal and the maximal value."""
import logging
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import (
ATTR_UNIT_OF_MEASUREMENT,
CONF_NAME,
CONF_TYPE,
STATE_UNAVAILABLE,
STATE_UNKNOWN,
)
from homeassista... | apache-2.0 |
mcedit/mcedit | drawable.py | 1 | 1360 | """
${NAME}
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import logging
log = logging.getLogger(__name__)
from OpenGL import GL
class Drawable(object):
def __init__(self):
super(Drawable, self).__init__()
self._displayList = None
self.invalidL... | isc |
a4a881d4/lovecoin | contrib/spendfrom/spendfrom.py | 792 | 10053 | #!/usr/bin/env python
#
# Use the raw transactions API to spend bitcoins received on particular addresses,
# and send any change back to that same address.
#
# Example usage:
# spendfrom.py # Lists available funds
# spendfrom.py --from=ADDRESS --to=ADDRESS --amount=11.00
#
# Assumes it will talk to a bitcoind or Bit... | mit |
moutai/scikit-learn | sklearn/utils/linear_assignment_.py | 67 | 9524 | """
Solve the unique lowest-cost assignment problem using the
Hungarian algorithm (also known as Munkres algorithm).
"""
# Based on original code by Brain Clapper, adapted to NumPy by Gael Varoquaux.
# Heavily refactored by Lars Buitinck.
#
# TODO: a version of this algorithm has been incorporated in SciPy; use that
#... | bsd-3-clause |
tesidroni/mp | Lib/ntpath.py | 81 | 18082 | # Module 'ntpath' -- common operations on WinNT/Win95 pathnames
"""Common pathname manipulations, WindowsNT/95 version.
Instead of importing this module directly, import os and refer to this
module as os.path.
"""
import os
import sys
import stat
import genericpath
import warnings
from genericpath import *
__all__ ... | gpl-3.0 |
cynapse/cynin | products/Plone4ArtistsCalendar/pythonlib/p4a/common/at.py | 4 | 2479 | from Acquisition import aq_inner, aq_base
from zope import schema
from zope.formlib import form
from zope.app.form.browser.textwidgets import TextAreaWidget
from Products.Five.formlib.formbase import PageDisplayForm, PageForm
from Products.Five.browser import BrowserView
from Products.Five.browser.pagetemplatefile impo... | gpl-3.0 |
bdastur/notes | python/asyncio/future_1.py | 1 | 2115 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
https://pymotw.com/3/asyncio/futures.html
'''
import asyncio
import time
import functools
#import gc
#gc.set_debug(gc.DEBUG_STATS)
def mark_done(future, result):
print("Setting future result to ", result)
future.set_result(result)
async def work_one(future... | apache-2.0 |
gurneyalex/OpenUpgrade | addons/account_anglo_saxon/purchase.py | 427 | 2043 | # -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of t... | agpl-3.0 |
poffuomo/spark | examples/src/main/python/ml/vector_indexer_example.py | 123 | 1685 | #
# 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 |
jumpstarter-io/horizon | openstack_dashboard/test/api_tests/cinder_tests.py | 1 | 7570 | # 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
#
# Unless required by applicable law or agre... | apache-2.0 |
abzaloid/maps | django-project/lib/python2.7/site-packages/django/db/backends/base/base.py | 103 | 17962 | import time
import warnings
from collections import deque
from contextlib import contextmanager
from django.conf import settings
from django.db import DEFAULT_DB_ALIAS
from django.db.backends import utils
from django.db.backends.signals import connection_created
from django.db.transaction import TransactionManagementE... | mit |
75651/kbengine_cloud | kbe/src/lib/python/Lib/encodings/mbcs.py | 860 | 1211 | """ Python 'mbcs' Codec for Windows
Cloned by Mark Hammond (mhammond@skippinet.com.au) from ascii.py,
which was written by Marc-Andre Lemburg (mal@lemburg.com).
(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
"""
# Import them explicitly to cause an ImportError
# on non-Windows systems
from codecs import mbcs... | lgpl-3.0 |
Dahlgren/HTPC-Manager | libs/requests/adapters.py | 205 | 16799 | # -*- coding: utf-8 -*-
"""
requests.adapters
~~~~~~~~~~~~~~~~~
This module contains the transport adapters that Requests uses to define
and maintain connections.
"""
import socket
from .models import Response
from .packages.urllib3 import Retry
from .packages.urllib3.poolmanager import PoolManager, proxy_from_url
... | mit |
MarkusH/django-osm-field | example/example/views.py | 1 | 1290 | from django.urls import reverse
from django.views.generic import (
CreateView,
DeleteView,
DetailView,
ListView,
UpdateView,
)
from .models import ExampleModel
class ExampleCreateView(CreateView):
fields = [
"location",
"location_lat",
"location_lon",
"another"... | mit |
QuintonJason/qvids | build/x264/tools/digress/cli.py | 145 | 4413 | """
Digress's CLI interface.
"""
import inspect
import sys
from optparse import OptionParser
import textwrap
from types import MethodType
from digress import __version__ as version
def dispatchable(func):
"""
Mark a method as dispatchable.
"""
func.digress_dispatchable = True
return func
class... | mit |
Zord13appdesa/python-for-android | python-build/python-libs/gdata/src/gdata/Crypto/PublicKey/qNEW.py | 228 | 5545 | #
# qNEW.py : The q-NEW signature algorithm.
#
# Part of the Python Cryptography Toolkit
#
# Distribute and use freely; there are no restrictions on further
# dissemination and usage except those imposed by the laws of your
# country of residence. This software is provided "as is" without
# warranty of fitness fo... | apache-2.0 |
ujjvala-addsol/addsol_hr | openerp/addons/gamification/tests/test_challenge.py | 386 | 5133 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (c) 2013 OpenERP S.A. <http://openerp.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GN... | agpl-3.0 |
tudorvio/nova | nova/tests/unit/keymgr/test_single_key_mgr.py | 78 | 2448 | # 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 |
tjsavage/sfcsdatabase | django/conf/locale/en_GB/formats.py | 80 | 1770 | # -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
DATE_FORMAT = 'N j, Y' # 'Oct. 25, 2006'
TIME_FORMAT = 'P' # '2:30 pm'
DATETIME_FORMAT = 'N j, Y, P' # 'Oct. 25, 2006, 2:30 pm'
YEAR_MONTH_FORMAT = 'F Y' #... | bsd-3-clause |
yg257/Pangea | templates/root/ec2/lib/boto-2.34.0/boto/ec2/autoscale/activity.py | 152 | 3058 | # Copyright (c) 2009-2011 Reza Lotun http://reza.lotun.name/
#
# 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 the rights to use, copy, mod... | apache-2.0 |
kspviswa/personfinder | tools/admin.py | 19 | 5570 | # Copyright 2011 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, soft... | apache-2.0 |
newville/scikit-image | doc/examples/plot_rank_mean.py | 17 | 1499 | """
============
Mean filters
============
This example compares the following mean filters of the rank filter package:
* **local mean**: all pixels belonging to the structuring element to compute
average gray level.
* **percentile mean**: only use values between percentiles p0 and p1
(here 10% and 90%).
* *... | bsd-3-clause |
Arcanemagus/SickRage | lib/hachoir_parser/image/tga.py | 95 | 2911 | """
Truevision Targa Graphic (TGA) picture parser.
Author: Victor Stinner
Creation: 18 december 2006
"""
from hachoir_parser import Parser
from hachoir_core.field import FieldSet, UInt8, UInt16, Enum, RawBytes
from hachoir_core.endian import LITTLE_ENDIAN
from hachoir_parser.image.common import PaletteRGB
class Line... | gpl-3.0 |
lsaffre/voga | lino_voga/lib/voga/fixtures/demo.py | 2 | 1358 | # -*- coding: UTF-8 -*-
# Copyright 2013-2017 Rumma & Ko Ltd
# License: BSD (see file COPYING for details)
from __future__ import unicode_literals
from django.conf import settings
from lino.api import dd, rt
def objects():
Person = rt.models.contacts.Person
Teacher = rt.models.courses.Teacher
User = rt.... | agpl-3.0 |
ldieselUT/Kruus-robtech | install/_setup_util.py | 1 | 12413 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Software License Agreement (BSD License)
#
# Copyright (c) 2012, Willow Garage, 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:
#
# * Redistrib... | mit |
odubno/microblog | flask/lib/python2.7/site-packages/jinja2/_compat.py | 638 | 4042 | # -*- coding: utf-8 -*-
"""
jinja2._compat
~~~~~~~~~~~~~~
Some py2/py3 compatibility support based on a stripped down
version of six so we don't have to depend on a specific version
of it.
:copyright: Copyright 2013 by the Jinja team, see AUTHORS.
:license: BSD, see LICENSE for details.
""... | bsd-3-clause |
signal18/replication-manager | share/opensvc/compliance/com.replication-manager/sysctl.py | 2 | 8354 | #!/usr/bin/env python
data = {
"default_prefix": "OSVC_COMP_SYSCTL_",
"example_value": """
{
"key": "vm.lowmem_reserve_ratio",
"index": 1,
"op": ">",
"value": 256
}
""",
"description": """* Verify a linux kernel parameter value is on target
* Live parameter value (sysctl executable)
* Persistent param... | gpl-3.0 |
nikolas/lettuce | tests/integration/lib/Django-1.3/tests/regressiontests/model_inheritance_regress/models.py | 75 | 4389 | import datetime
from django.db import models
class Place(models.Model):
name = models.CharField(max_length=50)
address = models.CharField(max_length=80)
class Meta:
ordering = ('name',)
def __unicode__(self):
return u"%s the place" % self.name
class Restaurant(Place):
serves_hot... | gpl-3.0 |
hkawasaki/kawasaki-aio8-0 | lms/djangoapps/class_dashboard/dashboard_data.py | 10 | 20700 | """
Computes the data to display on the Instructor Dashboard
"""
from util.json_request import JsonResponse
from courseware import models
from django.db.models import Count
from django.utils.translation import ugettext as _
from xmodule.course_module import CourseDescriptor
from xmodule.modulestore.django import modu... | agpl-3.0 |
AnishShah/tensorflow | tensorflow/contrib/rnn/python/tools/checkpoint_convert_test.py | 46 | 4250 | # 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 |
praveenmax/OctoPrint-redd | src/octoprint/server/__init__.py | 3 | 47109 | # coding=utf-8
from __future__ import absolute_import
__author__ = "Gina Häußge <osd@foosel.net>"
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
__copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License"
import uuid
from sockjs.torn... | agpl-3.0 |
NateBrune/bitcoin-fio | qa/rpc-tests/rest.py | 10 | 12151 | #!/usr/bin/env python2
# Copyright (c) 2014 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 REST interface
#
from test_framework.test_framework import BitcoinTestFramework
from test_framework... | mit |
dipanjanS/text-analytics-with-python | Old-First-Edition/Ch06_Text_Similarity_and_Clustering/utils.py | 1 | 1097 | # -*- coding: utf-8 -*-
"""
Created on Sun Sep 11 23:06:06 2016
@author: DIP
"""
from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer
def build_feature_matrix(documents, feature_type='frequency',
ngram_range=(1, 1), min_df=0.0, max_df=1.0):
feature_type = featur... | apache-2.0 |
tzewangdorje/SIPserv | Twisted-13.1.0/twisted/conch/test/test_insults.py | 15 | 17669 | # -*- test-case-name: twisted.conch.test.test_insults -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
from twisted.trial import unittest
from twisted.test.proto_helpers import StringTransport
from twisted.conch.insults.insults import ServerProtocol, ClientProtocol
from twisted.conch.insult... | gpl-3.0 |
DakRomo/2017Challenges | challenge_3/python/mindm/src/majority.py | 3 | 1522 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
from collections import defaultdict
def main():
if len(sys.argv) == 1: # Arguments provided by piping in shell
args = sys.stdin.read()
elif len(sys.argv) == 2: # Arguments provided as command line args
args = s... | mit |
sudheesh001/oh-mainline | vendor/packages/docutils/test/test_parsers/test_rst/test_targets.py | 16 | 13765 | #! /usr/bin/env python
# $Id: test_targets.py 7062 2011-06-30 22:14:29Z milde $
# Author: David Goodger <goodger@python.org>
# Copyright: This module has been placed in the public domain.
"""
Tests for states.py.
"""
from __init__ import DocutilsTestSupport
def suite():
s = DocutilsTestSupport.ParserTestSuite()... | agpl-3.0 |
fuhongliang/erpnext | erpnext/patches/v6_0/set_default_title.py | 19 | 1193 | import frappe
def execute():
frappe.reload_doctype("Quotation")
frappe.db.sql("""update tabQuotation set title = customer_name""")
frappe.reload_doctype("Sales Order")
frappe.db.sql("""update `tabSales Order` set title = customer_name""")
frappe.reload_doctype("Delivery Note")
frappe.db.sql("""update `tabDeliv... | agpl-3.0 |
Dhivyap/ansible | lib/ansible/modules/network/aci/aci_epg_to_contract.py | 27 | 9836 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# 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
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
... | gpl-3.0 |
billy-inn/scikit-learn | examples/decomposition/plot_ica_vs_pca.py | 306 | 3329 | """
==========================
FastICA on 2D point clouds
==========================
This example illustrates visually in the feature space a comparison by
results using two different component analysis techniques.
:ref:`ICA` vs :ref:`PCA`.
Representing ICA in the feature space gives the view of 'geometric ICA':
ICA... | bsd-3-clause |
rcarrillocruz/ansible | lib/ansible/module_utils/facts/other/facter.py | 232 | 2985 | # This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that ... | gpl-3.0 |
endlessm/chromium-browser | tools/site_compare/scrapers/chrome/chromebase.py | 189 | 5358 | #!/usr/bin/env python
# Copyright (c) 2011 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.
"""Does scraping for all currently-known versions of Chrome"""
import pywintypes
import types
from drivers import keyboard
from d... | bsd-3-clause |
jmesmon/trifles | 2011s_lab2/gen_spice2.py | 1 | 4333 | #! /usr/bin/env python
act2_spice = """\
* Lab 1, Act 2, BJT {bjt}, Part {part}, Plot Num {qn}
Vs Vi1 0 {wave}
Vcc Vi2 0 DC 5
RC1 Vi2 Vo1 {rc}
RB1 Vi1 Vb {rb}
Q1 Vo1 Vb 0 {bjt}
{extra}
* Model for 2N3904 NPN BJT (from Eval library in Pspice)
.model 2N3904 NPN(Is=6.734f Xti=3 Eg=1.11 Vaf=74.03 Bf=416.4 Ne... | gpl-3.0 |
ayushin78/coala | coalib/bears/GlobalBear.py | 10 | 1175 | from coalib.bears.Bear import Bear
from coalib.bears.BEAR_KIND import BEAR_KIND
class GlobalBear(Bear):
"""
A GlobalBear is able to analyze semantic facts across several file.
The results of a GlobalBear will be presented grouped by the origin Bear.
Therefore Results spanning above multiple files are... | agpl-3.0 |
ajose01/rethinkdb | external/v8_3.30.33.16/build/gyp/test/win/gyptest-cl-optimizations.py | 247 | 3416 | #!/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.
"""
Make sure optimization settings are extracted properly.
"""
import TestGyp
import sys
if sys.platform == 'win32':
test = TestGyp.Te... | agpl-3.0 |
ibinti/intellij-community | plugins/hg4idea/testData/bin/mercurial/osutil.py | 90 | 5363 | # osutil.py - pure Python version of osutil.c
#
# Copyright 2009 Matt Mackall <mpm@selenic.com> and others
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
import os
import stat as statmod
def _mode_to_kind(mode):
if statmod.... | apache-2.0 |
mcepl/rope | rope/contrib/generate.py | 3 | 14402 | import rope.base.evaluate
from rope.base import libutils
from rope.base import (change, pyobjects, exceptions, pynames, worder,
codeanalyze)
from rope.refactor import sourceutils, importutils, functionutils, suites
def create_generate(kind, project, resource, offset, goal_resource=None):
""... | lgpl-3.0 |
sigma-random/androguard | androguard/gui/treewindow.py | 8 | 4341 | from PySide import QtCore, QtGui
from androguard.core import androconf
from androguard.gui.xrefwindow import XrefDialog
from androguard.gui.sourcewindow import SourceWindow
from androguard.gui.helpers import classdot2class, Signature
class TreeWindow(QtGui.QTreeWidget):
'''TODO
'''
def __init__(self, par... | apache-2.0 |
bardes/sonitus | tools/tone_gen.py | 1 | 1271 | #!/usr/bin/env python
from sys import argv, stderr
usage = \
"""
Usage: {program} <sample rate> <A4 freq.> [octaves=8]
e.g.: {program} 64000 442.0 5
""".format(program=argv[0])
if len(argv) < 3 or len(argv) > 4 :
print(usage, file = stderr)
exit(1)
A4 = 0
sample_rate = 0
octaves = 8
try:
A4 = float(argv... | mit |
yewang15215/django | tests/template_tests/filter_tests/test_phone2numeric.py | 176 | 1500 | from django.template.defaultfilters import phone2numeric_filter
from django.test import SimpleTestCase
from django.utils.safestring import mark_safe
from ..utils import setup
class Phone2numericTests(SimpleTestCase):
@setup({'phone2numeric01': '{{ a|phone2numeric }} {{ b|phone2numeric }}'})
def test_phone2n... | bsd-3-clause |
ellipsys/discover | misc/python/ex2.py | 6 | 1050 | #!/usr/bin/env python
import os
from xml.dom.minidom import parse
import xml.dom.minidom
os.system('clear')
# Open XML document using minidom parser
DOMTree = xml.dom.minidom.parse('movies.xml')
collection = DOMTree.documentElement
if collection.hasAttribute('shelf'):
print '\n\nRoot element: %s\n' % collection... | bsd-3-clause |
cihai/cihai | cihai/exc.py | 1 | 2127 | """Exceptions raised from the Cihai library."""
class CihaiException(Exception):
"""Base Cihai Exception class."""
class ImportStringError(ImportError, CihaiException):
"""
Provides information about a failed :func:`import_string` attempt.
Notes
-----
This is from werkzeug.utils c769200 on ... | mit |
FireWRT/OpenWrt-Firefly-Libraries | staging_dir/host/lib/python3.4/test/test_imghdr.py | 87 | 4413 | import imghdr
import io
import os
import unittest
import warnings
from test.support import findfile, TESTFN, unlink
TEST_FILES = (
('python.png', 'png'),
('python.gif', 'gif'),
('python.bmp', 'bmp'),
('python.ppm', 'ppm'),
('python.pgm', 'pgm'),
('python.pbm', 'pbm'),
('python.jpg', 'jpeg')... | gpl-2.0 |
sam-tsai/django | tests/gis_tests/gis_migrations/migrations/0001_initial.py | 269 | 2465 | from django.db import connection, migrations, models
from ...models import models as gis_models
ops = [
migrations.CreateModel(
name='Neighborhood',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('name', models.C... | bsd-3-clause |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.