repo_name stringlengths 5 100 | path stringlengths 4 294 | copies stringclasses 990
values | size stringlengths 4 7 | content stringlengths 666 1M | license stringclasses 15
values |
|---|---|---|---|---|---|
mdimjasevic/debile | debile/master/interface.py | 4 | 13878 | # Copyright (c) 2012-2013 Paul Tagliamonte <paultag@debian.org>
# Copyright (c) 2014-2015 Clement Schreiner <clement@mux.me>
# Copyright (c) 2015 Lucas Kanashiro <kanashiro.duarte@gmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documenta... | mit |
naziris/HomeSecPi | venv/lib/python2.7/site-packages/jinja2/compiler.py | 623 | 61785 | # -*- coding: utf-8 -*-
"""
jinja2.compiler
~~~~~~~~~~~~~~~
Compiles nodes into python code.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
from itertools import chain
from copy import deepcopy
from keyword import iskeyword as is_python_keyword
from jinja2... | apache-2.0 |
dekatzenel/team-k | mds/api/v1/urls.py | 3 | 3898 | """The Django url mappings for 1.x mds.
:Authors: Sana dev team
:Version: 1.1
"""
from django.conf.urls.defaults import patterns, url
urlpatterns = patterns(
'',
# Old home for for connection check
# url(r'^$',
# 'sana.mrs.views.home',
# name="sana-home"),
url(r'^notifications/$',
... | bsd-3-clause |
thumbimigwe/echorizr | lib/python2.7/site-packages/django/contrib/gis/geos/prototypes/io.py | 309 | 9480 | import threading
from ctypes import POINTER, Structure, byref, c_char, c_char_p, c_int, c_size_t
from django.contrib.gis.geos.base import GEOSBase
from django.contrib.gis.geos.libgeos import GEOM_PTR, GEOSFuncFactory
from django.contrib.gis.geos.prototypes.errcheck import (
check_geom, check_sized_string, check_st... | mit |
ccccccccccc/mitmproxy | test/test_filt.py | 14 | 7900 | import cStringIO
from libmproxy import filt, flow
from libmproxy.protocol import http
from libmproxy.models import Error
from netlib.http import Headers
import tutils
class TestParsing:
def _dump(self, x):
c = cStringIO.StringIO()
x.dump(fp=c)
assert c.getvalue()
def test_parse_err(se... | mit |
whygee/oppia | core/domain/stats_domain.py | 15 | 3016 | # 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 |
PIVX-Project/PIVX | test/util/bitcoin-util-test.py | 6 | 6722 | #!/usr/bin/env python3
# Copyright 2014 BitPay Inc.
# Copyright 2016-2017 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 framework for pivx utils.
Runs automatically during `make check`.
Can a... | mit |
mozilla/verbatim | vendor/lib/python/django/middleware/gzip.py | 98 | 1747 | import re
from django.utils.text import compress_string
from django.utils.cache import patch_vary_headers
re_accepts_gzip = re.compile(r'\bgzip\b')
class GZipMiddleware(object):
"""
This middleware compresses content if the browser allows gzip compression.
It sets the Vary header accordingly, so that cac... | gpl-2.0 |
mazaclub/electrum-nmc | lib/qrscanner.py | 3 | 1278 | import os
from i18n import _
try:
import zbar
except ImportError:
zbar = None
proc = None
def scan_qr(config):
global proc
if not zbar:
raise BaseException("\n".join([_("Cannot start QR scanner."),_("The zbar package is not available."),_("On Linux, try 'sudo pip install zbar'")]))
if pr... | gpl-3.0 |
michaelBenin/sqlalchemy | doc/build/conf.py | 1 | 10689 | # -*- coding: utf-8 -*-
#
# SQLAlchemy documentation build configuration file, created by
# sphinx-quickstart on Wed Nov 26 19:50:10 2008.
#
# 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 |
myzhan/bottle-doc-zh-cn | test/test_mdict.py | 50 | 2047 | import unittest
from bottle import MultiDict, HeaderDict
class TestMultiDict(unittest.TestCase):
def test_isadict(self):
""" MultiDict should behaves like a normal dict """
d, m = dict(a=5), MultiDict(a=5)
d['key'], m['key'] = 'value', 'value'
d['k2'], m['k2'] = 'v1', 'v1'
d... | mit |
fenglu-g/incubator-airflow | tests/contrib/operators/test_dataproc_operator.py | 4 | 29835 | # -*- coding: utf-8 -*-
#
# 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
#... | apache-2.0 |
LouisPlisso/visemo | bs4/builder/_lxml.py | 446 | 8661 | __all__ = [
'LXMLTreeBuilderForXML',
'LXMLTreeBuilder',
]
from io import BytesIO
from StringIO import StringIO
import collections
from lxml import etree
from bs4.element import Comment, Doctype, NamespacedAttribute
from bs4.builder import (
FAST,
HTML,
HTMLTreeBuilder,
PERMISSIVE,
Parse... | gpl-3.0 |
abzaloid/kazakh-story-generator | webserver/lib/jinja2/__init__.py | 73 | 2565 | # -*- coding: utf-8 -*-
"""
jinja2
~~~~~~
Jinja2 is a template engine written in pure Python. It provides a
Django inspired non-XML syntax but supports inline expressions and
an optional sandboxed environment.
Nutshell
--------
Here a small example of a Jinja2 template::
{% ... | mit |
40223101/2015final2 | static/Brython3.1.3-20150514-095342/Lib/decimal.py | 623 | 230510 | # Copyright (c) 2004 Python Software Foundation.
# All rights reserved.
# Written by Eric Price <eprice at tjhsst.edu>
# and Facundo Batista <facundo at taniquetil.com.ar>
# and Raymond Hettinger <python at rcn.com>
# and Aahz <aahz at pobox.com>
# and Tim Peters
# This module should be kept in sync with ... | gpl-3.0 |
leotsem/django-ios-notifications | ios_notifications/decorators.py | 1 | 2062 | from django.contrib.auth import authenticate
from ios_notifications.http import JSONResponse
from django.conf import settings
import binascii
class InvalidAuthenticationType(Exception):
pass
# TODO: OAuth
VALID_AUTH_TYPES = ('AuthBasic', 'AuthBasicIsStaff', 'AuthNone')
def api_authentication_required(func):
... | bsd-3-clause |
Konosh93/locallibrary | locallibrary/settings.py | 1 | 4331 | """
Django settings for locallibrary project.
Generated by 'django-admin startproject' using Django 1.10.4.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
impo... | mit |
red2fred2/todo-app | node_modules/node-gyp/gyp/tools/pretty_vcproj.py | 2637 | 9586 | #!/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 the format of a vcproj really pretty.
This script normalize and sort an xml. It also fetches all the properties
inside linked... | mpl-2.0 |
darkleons/odoo | addons/website_sale_delivery/models/sale_order.py | 48 | 6001 | # -*- coding: utf-8 -*-
from openerp.osv import orm, fields
from openerp import SUPERUSER_ID
from openerp.addons import decimal_precision
class delivery_carrier(orm.Model):
_inherit = 'delivery.carrier'
_columns = {
'website_published': fields.boolean('Available in the website', copy=False),
... | agpl-3.0 |
quasipedia/googios | setup.py | 1 | 2724 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import os.path as path
from setuptools import setup, find_packages
long_description = '''
GooGios
=======
GooGios allows to use Google apps (calendar, contacts) to manage a roster of
on-call people. The script keeps in sync a local cache of the on-call shifts
and it can... | gpl-3.0 |
NoelMacwan/android_kernel_sony_msm8226 | tools/perf/scripts/python/net_dropmonitor.py | 4235 | 1554 | # Monitor the system for dropped packets and proudce a report of drop locations and counts
import os
import sys
sys.path.append(os.environ['PERF_EXEC_PATH'] + \
'/scripts/python/Perf-Trace-Util/lib/Perf/Trace')
from perf_trace_context import *
from Core import *
from Util import *
drop_log = {}
kallsyms = []
def... | gpl-2.0 |
craftytrickster/servo | tests/wpt/harness/wptrunner/executors/executorservodriver.py | 40 | 8852 | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
import json
import os
import socket
import threading
import time
import traceback
from .base import (Protocol,
... | mpl-2.0 |
phlax/translate | translate/tools/test_pypo2phppo.py | 4 | 1706 | # -*- coding: utf-8 -*-
# pypo2phppo unit tests
# Author: Wil Clouser <wclouser@mozilla.com>
# Date: 2009-12-03
from io import BytesIO
from translate.convert import test_convert
from translate.tools import pypo2phppo
class TestPyPo2PhpPo:
def test_single_po(self):
inputfile = b"""
# This user comment ... | gpl-2.0 |
MobinRanjbar/hue | apps/search/src/search/management/commands/search_setup.py | 9 | 1378 | #!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | apache-2.0 |
lunafeng/django | tests/template_tests/syntax_tests/test_named_endblock.py | 521 | 2312 | from django.template import TemplateSyntaxError
from django.test import SimpleTestCase
from ..utils import setup
class NamedEndblockTests(SimpleTestCase):
@setup({'namedendblocks01': '1{% block first %}_{% block second %}'
'2{% endblock second %}_{% endblock first %}3'})
def ... | bsd-3-clause |
BT-fgarbely/account-invoicing | account_invoice_shipping_address/__openerp__.py | 10 | 1559 | # -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2011 Domsense s.r.l. (<http://www.domsense.com>).
# Copyright (C) 2013 Andrea Cometa Perito Informatico (www.andreacometa.it)
#
# This program... | agpl-3.0 |
EdLeafe/pyrax | samples/cloud_blockstorage/create_volume.py | 13 | 1259 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c)2012 Rackspace US, 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.ap... | apache-2.0 |
campbe13/openhatch | vendor/packages/Django/django/test/signals.py | 222 | 2719 | import os
import time
from django.conf import settings
from django.db import connections
from django.dispatch import receiver, Signal
from django.utils import timezone
from django.utils.functional import empty
template_rendered = Signal(providing_args=["template", "context"])
setting_changed = Signal(providing_args=... | agpl-3.0 |
porcobosso/spark-ec2 | lib/boto-2.34.0/boto/glacier/layer2.py | 153 | 3745 | # -*- coding: utf-8 -*-
# Copyright (c) 2012 Thomas Parslow http://almostobsolete.net/
#
# 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 th... | apache-2.0 |
helldorado/ansible | test/units/modules/network/f5/test_bigip_vlan.py | 16 | 10690 | # -*- coding: utf-8 -*-
#
# Copyright (c) 2017 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 |
marratj/ansible | lib/ansible/modules/network/iosxr/iosxr_facts.py | 27 | 12721 | #!/usr/bin/python
#
# Copyright: Ansible Project
# 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 |
Valeureux/wezer-exchange | __unreviewed__/community/res_config.py | 1 | 7508 | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Yannick Buron and Valeureux Copyright Valeureux.org
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# ... | agpl-3.0 |
Balachan27/django | tests/template_tests/filter_tests/test_time.py | 326 | 1812 | from datetime import time
from django.template.defaultfilters import time as time_filter
from django.test import SimpleTestCase
from django.utils import timezone
from ..utils import setup
from .timezone_utils import TimezoneTestCase
class TimeTests(TimezoneTestCase):
"""
#20693: Timezone support for the tim... | bsd-3-clause |
TUW-GEO/rt1 | rt1/surface.py | 1 | 29407 | """Definition of BRDF functions"""
import numpy as np
import sympy as sp
from functools import partial, update_wrapper, lru_cache
from .scatter import Scatter
from .rtplots import polarplot, hemreflect
class Surface(Scatter):
"""basic surface class"""
def __init__(self, **kwargs):
# set scattering ... | apache-2.0 |
sandeepkbhat/pylearn2 | pylearn2/optimization/linear_cg.py | 49 | 2914 | """
.. todo::
WRITEME
"""
import theano
from theano import tensor
from theano.ifelse import ifelse
def linear_cg(fn, params, tol=1e-3, max_iters=1000, floatX=None):
"""
Minimizes a POSITIVE DEFINITE quadratic function via linear conjugate
gradient using the R operator to avoid explicitly representing ... | bsd-3-clause |
invisiblek/android_external_skia | tools/skpdiff/generate_pmetric_tables.py | 179 | 4156 | #!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import print_function
from math import *
COPYRIGHT = '''/*
* Copyright 2013 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/'''
HELP = '// To regenerate SkPMetricUtil_generated.h, si... | bsd-3-clause |
ntt-sic/nova | nova/tests/api/openstack/compute/plugins/v3/test_quota_sets.py | 8 | 18489 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack Foundation
# Copyright 2013 IBM Corp.
# 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 |
Weihonghao/ECM | Vpy34/lib/python3.5/site-packages/google/protobuf/internal/descriptor_database_test.py | 75 | 3116 | #! /usr/bin/env python
#
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions ... | agpl-3.0 |
jigneshvasoya/ruffus | setup.py | 6 | 6508 | #!/usr/bin/env python
from distutils.core import setup
#from setuptools import find_packages
import sys, os
if not sys.version_info[0:2] >= (2,6):
sys.stderr.write("Requires Python later than 2.6\n")
sys.exit(1)
# quickly import the latest version of ruffus
sys.path.insert(0, os.path.abspath("."))
import ruff... | mit |
GNS3/gns3-vm | ova.py | 1 | 1364 | #!/usr/bin/env python
#
# Copyright (C) 2015 GNS3 Technologies Inc.
#
# 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 version.
#
... | gpl-3.0 |
nugget/home-assistant | homeassistant/components/esphome/fan.py | 3 | 3973 | """Support for ESPHome fans."""
import logging
from typing import List, Optional, TYPE_CHECKING
from homeassistant.components.esphome import EsphomeEntity, \
platform_async_setup_entry
from homeassistant.components.fan import FanEntity, SPEED_HIGH, SPEED_LOW, \
SPEED_MEDIUM, SUPPORT_OSCILLATE, SUPPORT_SET_SPEE... | apache-2.0 |
FuturesFromYesterday/ardupilot | mk/PX4/Tools/genmsg/test/test_genmsg_msgs.py | 215 | 11646 | # Software License Agreement (BSD License)
#
# Copyright (c) 2009, 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:
#
# * Redistributions of source code must retain the above... | gpl-3.0 |
polyaxon/polyaxon | sdks/python/http_client/v1/polyaxon_sdk/models/v1_run_edge_kind.py | 1 | 3561 | #!/usr/bin/python
#
# Copyright 2018-2021 Polyaxon, 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 ... | apache-2.0 |
oppo-source/Find7-5.0-kernel-source | tools/perf/scripts/python/check-perf-trace.py | 11214 | 2503 | # perf script event handlers, generated by perf script -g python
# (c) 2010, Tom Zanussi <tzanussi@gmail.com>
# Licensed under the terms of the GNU GPL License version 2
#
# This script tests basic functionality such as flag and symbol
# strings, common_xxx() calls back into perf, begin, end, unhandled
# events, etc. ... | gpl-2.0 |
gjhiggins/RDFAlchemy | rdfalchemy/engine/__init__.py | 1 | 5337 | """
"""
import os
import re
import cgi
import urllib
def create_engine(url='', identifier="", create=False):
"""
:returns: returns an opened rdflib ConjunctiveGraph
:param url: a string of the url
:param identifier: URIRef of the default context for writing e.g.:
- create_engine('sleepycat://... | mit |
ranl/mta-exam-scraper | mta_exam_scraper/spiders/user_agent_generator.py | 1 | 1190 | # -*- coding: utf-8 -*-
"""
Create a list of user agents
scrapy crawl --output=/tmp/ran --output-format=csv user_agent_generator && sed -i '1d' /tmp/ran
"""
# python
import re
# Scrapy
import scrapy
# mta_exam_scraper
from mta_exam_scraper.items import UserAgent
class UserAgentGenerator(scrapy.Spider):
"""
... | apache-2.0 |
vmax-feihu/hue | desktop/core/ext-py/kazoo-2.0/kazoo/interfaces.py | 54 | 6363 | """Kazoo Interfaces
.. versionchanged:: 1.4
The classes in this module used to be interface declarations based on
`zope.interface.Interface`. They were converted to normal classes and
now serve as documentation only.
"""
# public API
class IHandler(object):
"""A Callback Handler for Zookeeper comp... | apache-2.0 |
katiecheng/Bombolone | env/lib/python2.7/site-packages/gridfs/errors.py | 16 | 1602 | # Copyright 2009-2012 10gen, 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,... | bsd-3-clause |
gdementen/numexpr-numba | bench/poly.py | 1 | 1861 | ###################################################################
# Numexpr - Fast numerical array expression evaluator for NumPy.
#
# License: MIT
# Author: See AUTHORS.txt
#
# See LICENSE.txt and LICENSES/*.txt for details about copyright and
# rights to use.
##########################################... | mit |
RO-ny9/python-for-android | python3-alpha/python3-src/Lib/sched.py | 47 | 5541 | """A generally useful event scheduler class.
Each instance of this class manages its own queue.
No multi-threading is implied; you are supposed to hack that
yourself, or use a single instance per application.
Each instance is parametrized with two functions, one that is
supposed to return the current time, one that i... | apache-2.0 |
walterreade/scikit-learn | sklearn/cluster/tests/test_dbscan.py | 176 | 12155 | """
Tests for DBSCAN clustering algorithm
"""
import pickle
import numpy as np
from scipy.spatial import distance
from scipy import sparse
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_raises
from sklearn.utils.testing im... | bsd-3-clause |
endlessm/chromium-browser | third_party/catapult/third_party/oauth2client/oauth2client/util.py | 60 | 5704 | #!/usr/bin/env python
#
# Copyright 2014 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | bsd-3-clause |
alxgu/ansible | lib/ansible/modules/network/fortios/fortios_log_fortianalyzer3_setting.py | 24 | 13194 | #!/usr/bin/python
from __future__ import (absolute_import, division, print_function)
# Copyright 2019 Fortinet, Inc.
#
# 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 Lic... | gpl-3.0 |
ksrajkumar/openerp-6.1 | openerp/workflow/__init__.py | 76 | 1110 | # -*- coding: 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 the... | agpl-3.0 |
rooi/CouchPotatoServer | libs/bs4/__init__.py | 417 | 15401 | """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... | gpl-3.0 |
benjixx/ansible | lib/ansible/playbook/block.py | 13 | 14599 | # (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 |
snakeleon/YouCompleteMe-x64 | third_party/ycmd/third_party/jedi_deps/jedi/jedi/inference/__init__.py | 2 | 8499 | """
Type inference of Python code in |jedi| is based on three assumptions:
* The code uses as least side effects as possible. Jedi understands certain
list/tuple/set modifications, but there's no guarantee that Jedi detects
everything (list.append in different modules for example).
* No magic is being used:
- m... | gpl-3.0 |
nicholasserra/sentry | src/sentry/api/endpoints/release_files.py | 1 | 6287 | from __future__ import absolute_import
from StringIO import StringIO
from django.db import IntegrityError, transaction
from rest_framework.negotiation import DefaultContentNegotiation
from rest_framework.parsers import FormParser, MultiPartParser
from rest_framework.response import Response
from sentry.api.base impo... | bsd-3-clause |
futurice/vdsm | tests/iscsiTests.py | 2 | 2056 | import threading
import time
from contextlib import contextmanager
from testrunner import VdsmTestCase as TestCaseBase
from storage import iscsi
class AsyncStubOperation(object):
def __init__(self, timeout):
self._evt = threading.Event()
if timeout == 0:
self._evt.set()
else:... | gpl-2.0 |
HonzaKral/django | django/contrib/sessions/middleware.py | 104 | 2642 | import time
from importlib import import_module
from django.conf import settings
from django.utils.cache import patch_vary_headers
from django.utils.http import cookie_date
class SessionMiddleware(object):
def __init__(self):
engine = import_module(settings.SESSION_ENGINE)
self.SessionStore = eng... | bsd-3-clause |
kenshay/ImageScript | ProgramData/SystemFiles/Python/Lib/site-packages/networkx/__init__.py | 5 | 3178 | """
NetworkX
========
NetworkX is a Python package for the creation, manipulation,
and study of the structure, dynamics, and functions
of complex networks.
Website (including documentation)::
http://networkx.github.io
Mailing list::
https://groups.google.com/forum/#!forum/networkx-discuss
Source::
ht... | gpl-3.0 |
resmio/heroku-buildpack-geodjango | vendor/pip-pop/docopt.py | 283 | 19784 | """Pythonic command-line interface parser that will make you smile.
* http://docopt.org
* Repository and issue-tracker: https://github.com/docopt/docopt
* Licensed under terms of MIT license (see LICENSE-MIT)
* Copyright (c) 2013 Vladimir Keleshev, vladimir@keleshev.com
"""
import sys
import re
__all__ = ['doco... | mit |
mattgiguere/scikit-learn | sklearn/feature_extraction/tests/test_feature_hasher.py | 258 | 2861 | from __future__ import unicode_literals
import numpy as np
from sklearn.feature_extraction import FeatureHasher
from nose.tools import assert_raises, assert_true
from numpy.testing import assert_array_equal, assert_equal
def test_feature_hasher_dicts():
h = FeatureHasher(n_features=16)
assert_equal("dict",... | bsd-3-clause |
nhr/openshift-ansible | roles/openshift_health_checker/test/openshift_check_test.py | 4 | 2699 | import pytest
from openshift_checks import OpenShiftCheck, OpenShiftCheckException
from openshift_checks import load_checks, get_var
# Fixtures
@pytest.fixture()
def task_vars():
return dict(foo=42, bar=dict(baz="openshift"))
@pytest.fixture(params=[
("notfound",),
("multiple", "keys", "not", "in", "... | apache-2.0 |
cesargtz/YecoraOdoo | addons/hr_timesheet/__init__.py | 410 | 1104 | # -*- 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 |
Tatsh-ansible/ansible | lib/ansible/plugins/callback/hipchat.py | 43 | 6195 | # (C) 2014, Matt Martz <matt@sivel.net>
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
#... | gpl-3.0 |
egabancho/invenio | invenio/legacy/bibcatalog/templates.py | 3 | 3374 | ## This file is part of Invenio.
## Copyright (C) 2009, 2010, 2011, 2014 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 |
NEricN/RobotCSimulator | Python/App/Lib/msilib/__init__.py | 37 | 17575 | # -*- coding: iso-8859-1 -*-
# Copyright (C) 2005 Martin v. Löwis
# Licensed to PSF under a Contributor Agreement.
from _msi import *
import os, string, re, sys
AMD64 = "AMD64" in sys.version
Itanium = "Itanium" in sys.version
Win64 = AMD64 or Itanium
# Partially taken from Wine
datasizemask= 0x00ff
type_valid= ... | apache-2.0 |
snikch/elasticsearch | dev-tools/get-bwc-version.py | 136 | 3149 | # Licensed to Elasticsearch under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this file except... | apache-2.0 |
SocialProgrammingUnion/SamaritanAnalytics | SPU-Front_templates/SPU_BLOG/migrations/env.py | 557 | 2883 | from __future__ import with_statement
from alembic import context
from sqlalchemy import engine_from_config, pool
from logging.config import fileConfig
import logging
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = context.config
# Interpret the config ... | mit |
pamoakoy/invenio | modules/webcomment/lib/webcomment_webinterface.py | 1 | 41075 | # -*- coding: utf-8 -*-
## Comments and reviews for records.
## This file is part of Invenio.
## Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 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 Foun... | gpl-2.0 |
sunqb/oa_qian | flask/Lib/site-packages/wheel/signatures/__init__.py | 565 | 3779 | """
Create and verify jws-js format Ed25519 signatures.
"""
__all__ = [ 'sign', 'verify' ]
import json
from ..util import urlsafe_b64decode, urlsafe_b64encode, native, binary
ed25519ll = None
ALG = "Ed25519"
def get_ed25519ll():
"""Lazy import-and-test of ed25519 module"""
global ed25519ll
if not ... | apache-2.0 |
Comunitea/OCB | addons/account_anglo_saxon/stock.py | 57 | 3489 | # -*- 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 |
HopeFOAM/HopeFOAM | ThirdParty-0.1/ParaView-5.0.1/VTK/IO/Parallel/Testing/Python/TestPImageWriter.py | 26 | 1106 | #!/usr/bin/env python
# Image pipeline
image1 = vtk.vtkTIFFReader()
image1.SetFileName("" + str(VTK_DATA_ROOT) + "/Data/beach.tif")
# "beach.tif" image contains ORIENTATION tag which is
# ORIENTATION_TOPLEFT (row 0 top, col 0 lhs) type. The TIFF
# reader parses this tag and sets the internal TIFF image
# orientation a... | gpl-3.0 |
juvham/Cactus | cactus/tests/test_compat.py | 9 | 1359 | #coding:utf-8
from cactus.tests import SiteTestCase
class TestCompatibility(SiteTestCase):
def _paths_key_exists(self, obj, old_key):
try:
obj.paths[old_key]
except KeyError:
self.fail('Old key does not exist anymore: {0}'.format(old_key))
def test_compatibility(self):... | bsd-3-clause |
storborg/pyweaving | pyweaving/__init__.py | 1 | 19858 | from __future__ import (absolute_import, division, print_function,
unicode_literals)
import datetime
import json
from copy import deepcopy
from collections import defaultdict
__version__ = '0.0.8.dev'
class Color(object):
"""
A color type. Internally stored as RGB, and does not supp... | mit |
googleapis/googleapis-gen | google/cloud/speech/v1/speech-v1-py/tests/unit/gapic/speech_v1/test_speech.py | 1 | 55209 | # -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | apache-2.0 |
tux-00/ansible | lib/ansible/modules/net_tools/basics/uri.py | 32 | 18754 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2013, Romeo Theriault <romeot () hawaii.edu>
#
# 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 th... | gpl-3.0 |
jspraul/bite-project | deps/mrtaskman/server/mapreduce/namespace_range.py | 27 | 12792 | #!/usr/bin/env python
#
# Copyright 2010 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 o... | apache-2.0 |
hackebrot/pytest | testing/test_runner_xunit.py | 1 | 7636 | """
test correct setup/teardowns at
module, class, and instance level
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import pytest
def test_module_and_function_setup(testdir):
reprec = testdir.inline_runsource(
"""
modlevel = []
... | mit |
slashdd/sos | sos/report/plugins/manageiq.py | 5 | 2925 | # -*- python -*-
# -*- coding: utf-8 -*-
# Copyright (C) 2015 Red Hat, Inc., Pep Turró Mauri <pep@redhat.com>
# This file is part of the sos project: https://github.com/sosreport/sos
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and c... | gpl-2.0 |
mmolero/pcloudpy | pcloudpy/core/filters/vtkPointSetNormalsEstimation.py | 1 | 5076 | """
Class that define a normal estimation method based on vtkPointSetNormalsEstimation by David Doria
"""
__all__ = ["vtkPointSetNormalsEstimation"]
from pcloudpy.core.filters.base import FilterBase
import numpy as np
from vtk import vtkPolyDataAlgorithm, vtkFloatArray, vtkKdTree, vtkPlane, vtkPolyData, vtkIdList
from... | bsd-3-clause |
AlanZatarain/pysal | pysal/spatial_dynamics/ergodic.py | 5 | 4744 | """
:mod:`ergodic` --- summary measures for ergodic Markov chains
=============================================================
"""
__author__ = "Sergio J. Rey <srey@asu.edu>"
__all__ = ['steady_state', 'fmpt']
import numpy as np
import numpy.linalg as la
def steady_state(P):
"""
Calculates the steady stat... | bsd-3-clause |
Curious72/sympy | sympy/tensor/indexed.py | 12 | 17230 | """Module that defines indexed objects
The classes IndexedBase, Indexed and Idx would represent a matrix element
M[i, j] as in the following graph::
1) The Indexed class represents the entire indexed object.
|
___|___
' '
M[i, j]
... | bsd-3-clause |
LiuRoy/dracula | dracula/thrift/decode.py | 1 | 17917 | # -*- coding=utf8 -*-
import struct
from cStringIO import StringIO
from .common import (
VERSION_MASK,
VERSION_1,
TType,
TState,
TError,
BASIC_TYPE,
ParseData,
)
def unpack_i8(buf):
return struct.unpack("!b", buf)[0]
def unpack_i16(buf):
return struct.unpack("!h", buf)[0]
def u... | apache-2.0 |
RevelSystems/django | tests/admin_checks/tests.py | 24 | 22025 | from __future__ import unicode_literals
from django import forms
from django.contrib import admin
from django.contrib.contenttypes.admin import GenericStackedInline
from django.core import checks
from django.test import TestCase, override_settings
from .models import Album, Book, City, Influence, Song, State, TwoAlbu... | bsd-3-clause |
cdrttn/samba-regedit | python/samba/tests/samba_tool/base.py | 36 | 4702 | # Unix SMB/CIFS implementation.
# Copyright (C) Sean Dague <sdague@linux.vnet.ibm.com> 2011
#
# 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 optio... | gpl-3.0 |
tsacha/rss2email | rss2email/version.py | 9 | 1599 | # Copyright (C) 2013 W. Trevor King <wking@tremily.us>
#
# This file is part of rss2email.
#
# rss2email 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) ver... | gpl-2.0 |
jeffzheng1/tensorflow | tensorflow/python/tools/optimize_for_inference.py | 22 | 3970 | # pylint: disable=g-bad-file-header
# 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/LICENS... | apache-2.0 |
misnyo/searx | searx/engines/searx_engine.py | 4 | 1264 | """
Searx (all)
@website https://github.com/asciimoo/searx
@provide-api yes (https://asciimoo.github.io/searx/dev/search_api.html)
@using-api yes
@results JSON
@stable yes (using api)
@parse url, title, content
"""
from json import loads
from searx.engines import categories as searx_categ... | agpl-3.0 |
tempbottle/ironpython3 | Src/StdLib/Lib/turtledemo/nim.py | 65 | 6502 | """ turtle-example-suite:
tdemo_nim.py
Play nim against the computer. The player
who takes the last stick is the winner.
Implements the model-view-controller
design pattern.
"""
import turtle
import random
import time
SCREENWIDTH = 640
SCREENHEIGHT = 480
MINSTICKS = 7
MAXSTICKS = 31
HUNIT = SCR... | apache-2.0 |
aluedeke/chromedriver | py/selenium/webdriver/common/keys.py | 34 | 2581 | # copyright 2008-2009 WebDriver committers
# Copyright 2008-2009 Google Inc.
#
# Licensed under the Apache License Version 2.0 = uthe "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 requ... | apache-2.0 |
scharron/chardet | chardet/langhungarianmodel.py | 25 | 12784 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is Mozilla Communicator client code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Ri... | lgpl-2.1 |
lulf/qpid-dispatch | tests/router_policy_test.py | 2 | 13755 | #
# 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 |
botswana-harvard/edc-sync | edc_sync/tests/models.py | 1 | 3084 | from edc_base.model_managers import HistoricalRecords
from edc_base.model_mixins.list_model_mixin import ListModelMixin
from uuid import uuid4
from django.db import models
from django.db.models.deletion import PROTECT
from edc_base.model_mixins import BaseUuidModel, BaseModel
from edc_base.utils import get_utcnow
from... | gpl-2.0 |
bop/hybrid | lib/python2.6/site-packages/django/contrib/gis/tests/geo3d/models.py | 222 | 2064 | from django.contrib.gis.db import models
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class City3D(models.Model):
name = models.CharField(max_length=30)
point = models.PointField(dim=3)
objects = models.GeoManager()
def __str__(self):
return self.n... | gpl-2.0 |
lianwutech/plugin_linkworld-discard- | channels/serial_rtu.py | 1 | 8808 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
串口RTU通道类
通过调用管理类对象的process_data函数实现信息的发送。
"""
import logging
import serial
from pymodbus.client.sync import ModbusSerialClient
from libs.modbus_define import *
from libs.base_channel import BaseChannel
logger = logging.getLogger('linkworld')
class SerialRtuChanne... | apache-2.0 |
jamesleesaunders/pi-hive | scripts/setup-db.py | 2 | 1428 | #!/usr/bin/python
# coding: utf-8
# Filename: setup-db.py
# Description: Sets up DB used by zigbeehub.py
# Author: James Saunders [james@saunders-family.net]
# Copyright: Copyright (C) 2017 James Saunders
# License: MIT
import sqlite3
# Setup DB Connection
conn = sqlite3.connect('nodes.db')
print "Data... | mit |
Denisolt/IEEE-NYIT-MA | local/lib/python2.7/site-packages/unidecode/__init__.py | 42 | 3095 | # -*- coding: utf-8 -*-
# vi:tabstop=4:expandtab:sw=4
"""Transliterate Unicode text into plain 7-bit ASCII.
Example usage:
>>> from unidecode import unidecode:
>>> unidecode(u"\u5317\u4EB0")
"Bei Jing "
The transliteration uses a straightforward map, and doesn't have alternatives
for the same character based on langu... | gpl-3.0 |
HuaweiSwitch/ansible | lib/ansible/modules/network/nxos/nxos_udld.py | 57 | 8727 | #!/usr/bin/python
#
# 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 distribut... | gpl-3.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.