code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
"""Module containing a preprocessor that converts outputs in the notebook from
one format to another.
"""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from .base import Preprocessor
from traitlets import Unicode
class ConvertFiguresPreprocessor(Preprocessor)... | unnikrishnankgs/va | venv/lib/python3.5/site-packages/nbconvert/preprocessors/convertfigures.py | Python | bsd-2-clause | 1,450 |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("migrations", "0001_initial"),
]
operations = [
migrations.DeleteModel("Tribble"),
migrations.RemoveField("Author", "silly_field"),
migrations.AddField("Author", "rating",... | beckastar/django | tests/migrations/test_migrations/0002_second.py | Python | bsd-3-clause | 592 |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | jjas0nn/solvem | tensorflow/lib/python2.7/site-packages/tensorflow/contrib/slim/python/slim/learning_test.py | Python | mit | 34,627 |
# SOAPpy modules
from Config import Config
from Types import *
from NS import NS
from Utilities import *
import string
import fpconst
import xml.sax
from wstools.XMLname import fromXMLname
try: from M2Crypto import SSL
except: pass
ident = '$Id: Parser.py,v 1.16 2005/02/22 04:29:42 warnes Exp $'
from v... | 2ndy/RaspIM | usr/share/python-support/python-soappy/SOAPpy/Parser.py | Python | gpl-2.0 | 35,390 |
# -*- coding: utf-8 -*-
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2003-2005 Donald N. Allingham
# Copyright (C) 2008 Brian G. Matherly
# Copyright (C) 2005-2012 Julio Sanchez
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Genera... | sam-m888/gramps | gramps/plugins/rel/rel_es.py | Python | gpl-2.0 | 35,961 |
from __future__ import unicode_literals
from django.db import models
from django.db.migrations.operations.base import Operation
from django.db.migrations.state import ModelState
from django.db.models.options import normalize_together
from django.utils import six
from django.utils.functional import cached_property
fro... | KrzysztofStachanczyk/Sensors-WWW-website | www/env/lib/python2.7/site-packages/django/db/migrations/operations/models.py | Python | gpl-3.0 | 29,026 |
#!/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... | andreaso/ansible | lib/ansible/modules/network/nxos/nxos_evpn_vni.py | Python | gpl-3.0 | 10,487 |
"""
Import celery, load its settings from the django settings
and auto discover tasks in all installed django apps.
Taken from: https://celery.readthedocs.org/en/latest/django/first-steps-with-django.html
"""
from __future__ import absolute_import
import os
from celery import Celery
from django.conf import settings
... | ahmedaljazzar/edx-platform | cms/celery.py | Python | agpl-3.0 | 1,791 |
"""
mbed SDK
Copyright (c) 2016 ARM Limited
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, so... | jeremybrodt/mbed | tools/settings.py | Python | apache-2.0 | 3,231 |
from __future__ import division, print_function
from functools import partial
from itertools import product
import numpy as np
import scipy.sparse as sp
from sklearn.datasets import make_multilabel_classification
from sklearn.preprocessing import LabelBinarizer
from sklearn.utils.multiclass import type_of_target
fro... | herilalaina/scikit-learn | sklearn/metrics/tests/test_common.py | Python | bsd-3-clause | 43,823 |
import logging
import multiprocessing
PARSER_PROCESS_JOIN_TIMEOUT = 3
logger = logging.getLogger('grab.spider.parser_pipeline')
class ParserPipeline(object):
def __init__(self, bot, mp_mode, pool_size, shutdown_event,
network_result_queue, requests_per_process):
self.bot = bot
se... | alihalabyah/grab | grab/spider/parser_pipeline.py | Python | mit | 4,714 |
#!/usr/bin/env python
"""
Easy Install
------------
A tool for doing automatic download/extract/build of distutils-based Python
packages. For detailed documentation, see the accompanying EasyInstall.txt
file, or visit the `EasyInstall home page`__.
__ https://setuptools.readthedocs.io/en/latest/easy_install.html
""... | pcu4dros/pandora-core | workspace/lib/python3.5/site-packages/setuptools/command/easy_install.py | Python | mit | 87,125 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
MessageDialog.py
---------------------
Date : October 2014
Copyright : (C) 2014 by Alexander Bruy
Email : alexander dot bruy at gmail dot com
***********... | dwadler/QGIS | python/plugins/processing/gui/MessageDialog.py | Python | gpl-2.0 | 2,138 |
#********************************************************************************
#* Dionaea
#* - catches bugs -
#*
#*
#*
#* Copyright (C) 2009 Paul Baecher & Markus Koetter
#*
#* This program is free software; you can redistribute it and/or
#* modify it under t... | gento/dionaea | modules/python/scripts/store.py | Python | gpl-2.0 | 2,119 |
#!/usr/bin/env python2
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:fdm=marker:ai
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2012, Kovid Goyal <kovid at kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
... | ashang/calibre | src/calibre/devices/mtp/defaults.py | Python | gpl-3.0 | 1,629 |
"""
Models for the custom course feature
"""
from __future__ import unicode_literals
import json
import logging
from datetime import datetime
from ccx_keys.locator import CCXLocator
from django.contrib.auth.models import User
from django.db import models
from lazy import lazy
from opaque_keys.edx.django.models import... | Stanford-Online/edx-platform | lms/djangoapps/ccx/models.py | Python | agpl-3.0 | 3,795 |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for L{twisted.python.usage}, a command line option parsing library.
"""
from twisted.trial import unittest
from twisted.python import usage
class WellBehaved(usage.Options):
optParameters = [['long', 'w', 'default', 'and a docstri... | nlloyd/SubliminalCollaborator | libs/twisted/test/test_usage.py | Python | apache-2.0 | 19,879 |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | jbedorf/tensorflow | tensorflow/python/ops/distributions/util.py | Python | apache-2.0 | 54,998 |
from __future__ import unicode_literals
import frappe
def execute():
if frappe.db.exists("DocType", "Guardian"):
# 'Schools' module changed to the 'Education'
# frappe.reload_doc("schools", "doctype", "student")
# frappe.reload_doc("schools", "doctype", "student_guardian")
# frappe.reload_doc("schools", "doc... | ebukoz/thrive | erpnext/patches/v7_1/set_student_guardian.py | Python | gpl-3.0 | 850 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo.api import Environment
import odoo.tests
@odoo.tests.tagged('post_install', '-at_install')
class TestWebsiteHrRecruitmentForm(odoo.tests.HttpCase):
def test_tour(self):
self.phantom_js("/", "odoo._... | maxive/erp | addons/website_hr_recruitment/tests/test_website_hr_recruitment.py | Python | agpl-3.0 | 830 |
'''
Copyright 2016, EMC, Inc.
Author(s):
George Paulos
'''
import fit_path # NOQA: unused import
import os
import sys
import subprocess
import fit_common
from nose.plugins.attrib import attr
@attr(all=True, regression=True, smoke=True)
class rackhd20_api_config(fit_common.unittest.TestCase):
def test_api_20_co... | johren/RackHD | test/tests/rackhd20/test_rackhd20_api_config.py | Python | apache-2.0 | 3,739 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import account_bank_statement
from . import account_journal
from . import barcode_rule
from . import pos_category
from . import pos_config
from . import pos_order
from . import pos_session
from . import product
fr... | Aravinthu/odoo | addons/point_of_sale/models/__init__.py | Python | agpl-3.0 | 368 |
#! /usr/bin/env python
# -*- coding: iso-8859-1 -*-
# vi:ts=4:et
# $Id: test_multi_socket.py,v 1.1 2006/11/10 15:03:05 kjetilja Exp $
import os, sys
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
import pycurl
urls = (
"http://curl.haxx.se",
"http://www.python.o... | blite/python-curl | tests/test_multi_socket.py | Python | lgpl-2.1 | 1,924 |
"""Encryption module that uses pycryptopp or pycrypto"""
try:
# Pycryptopp is preferred over Crypto because Crypto has had
# various periods of not being maintained, and pycryptopp uses
# the Crypto++ library which is generally considered the 'gold standard'
# of crypto implementations
from pycrypto... | abdesslem/malwareHunter | web/controller/beaker/crypto/pycrypto.py | Python | gpl-2.0 | 970 |
import unittest
import objects
""" 1: Object-Oriented Programming - TESTS
Testing Object Oriented Programming Examples from objects.py
Gabby Ortman 2015
"""
class TestObjectMethods(unittest.TestCase):
def test_vehicle(self):
self.vehicle = objects.Vehicle('Broken Skateboard')
... | erhuabushuo/Data-Structure-Zoo | 0-Object-Oriented Programming/test.py | Python | mit | 1,293 |
import warnings
import os
import unittest
from test import test_support
# The warnings module isn't easily tested, because it relies on module
# globals to store configuration information. setUp() and tearDown()
# preserve the current settings to avoid bashing them while running tests.
# To capture the warning messa... | xbmc/atv2 | xbmc/lib/libPython/Python/Lib/test/test_warnings.py | Python | gpl-2.0 | 3,221 |
# Natural Language Toolkit: WordNet stemmer interface
#
# Copyright (C) 2001-2012 NLTK Project
# Author: Steven Bird <sb@csse.unimelb.edu.au>
# Edward Loper <edloper@gradient.cis.upenn.edu>
# URL: <http://www.nltk.org/>
# For license information, see LICENSE.TXT
from nltk.corpus.reader.wordnet import NOUN
from... | cortext/crawtextV2 | ~/venvs/crawler/lib/python2.7/site-packages/nltk/stem/wordnet.py | Python | mit | 1,263 |
from __future__ import absolute_import
try:
import rjsmin
except ImportError:
from . import rjsmin
from webassets.filter import Filter
__all__ = ('RJSMin',)
class RJSMin(Filter):
"""Minifies Javascript by removing whitespace, comments, etc.
Uses the `rJSmin library <http://opensource.perlig.de/rj... | jessekl/flixr | venv/lib/python2.7/site-packages/webassets/filter/rjsmin/__init__.py | Python | mit | 631 |
# -*- coding: utf-8 -*-
"""
Tests for RectPolygonVisual
All images are of size (100,100) to keep a small file size
"""
from vispy.scene import visuals, transforms
from vispy.testing import (requires_application, TestingCanvas,
run_tests_if_main, raises)
from vispy.testing.image_tester impor... | sh4wn/vispy | vispy/visuals/tests/test_rectangle.py | Python | bsd-3-clause | 6,191 |
"""Compute the Taylor series for zeta(x) - 1 around x = 0."""
try:
import mpmath
except ImportError:
pass
def zetac_series(N):
coeffs = []
with mpmath.workdps(100):
coeffs.append(-1.5)
for n in range(1, N):
coeff = mpmath.diff(mpmath.zeta, 0, n)/mpmath.factorial(n)
... | grlee77/scipy | scipy/special/_precompute/zetac.py | Python | bsd-3-clause | 591 |
# This file is automatically generated by setup.py.
__version__ = '2.6.0'
__sha__ = 'gd16713a'
__revision__ = 'gd16713a'
| pcu4dros/pandora-core | workspace/lib/python3.5/site-packages/jsonschema/_version.py | Python | mit | 122 |
#!/usr/bin/env python
# Copyright (C) 2009-2014:
# Gabes Jean, naparuba@gmail.com
# Gerhard Lausser, Gerhard.Lausser@consol.de
#
# This file is part of Shinken.
#
# Shinken 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 F... | naparuba/shinken | test/test_downtimes.py | Python | agpl-3.0 | 21,518 |
# test simple async with execution
class AContext:
async def __aenter__(self):
print('enter')
return 1
async def __aexit__(self, exc_type, exc, tb):
print('exit', exc_type, exc)
async def f():
async with AContext():
print('body')
o = f()
try:
o.send(None)
except StopIt... | kerneltask/micropython | tests/basics/async_with.py | Python | mit | 750 |
import pytest
from numpy.testing import assert_allclose, assert_
import numpy as np
from scipy.integrate import RK23, RK45, DOP853
from scipy.integrate._ivp import dop853_coefficients
@pytest.mark.parametrize("solver", [RK23, RK45, DOP853])
def test_coefficient_properties(solver):
assert_allclose(np.sum(solver.B)... | matthew-brett/scipy | scipy/integrate/_ivp/tests/test_rk.py | Python | bsd-3-clause | 1,326 |
"""
Tests for tools
Author: Chad Fulton
License: Simplified-BSD
"""
from __future__ import division, absolute_import, print_function
import numpy as np
import pandas as pd
from statsmodels.tsa.statespace import tools
# from .results import results_sarimax
from numpy.testing import (
assert_equal, assert_array_eq... | hlin117/statsmodels | statsmodels/tsa/statespace/tests/test_tools.py | Python | bsd-3-clause | 4,268 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 Red Hat, Inc.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUME... | Dhivyap/ansible | lib/ansible/modules/cloud/ovirt/ovirt_host_info.py | Python | gpl-3.0 | 4,875 |
#
# -*- coding: utf-8 -*-
# Copyright 2019 Red Hat
# GNU General Public License v3.0+
# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
"""
The eos lldp_global fact class
It is in this file the configuration is collected from the device
for a given resource, parsed, and the facts tree is populated
based on th... | thaim/ansible | lib/ansible/module_utils/network/eos/facts/lldp_global/lldp_global.py | Python | mit | 2,946 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
TopoColors.py
--------------
Date : February 2017
Copyright : (C) 2017 by Nyall Dawson
Email : nyall dot dawson at gmail dot com
************************... | SrNetoChan/QGIS | python/plugins/processing/algs/qgis/TopoColors.py | Python | gpl-2.0 | 12,608 |
from django import http
from django.contrib.messages import constants, get_level, set_level, utils
from django.contrib.messages.api import MessageFailure
from django.contrib.messages.constants import DEFAULT_LEVELS
from django.contrib.messages.storage import base, default_storage
from django.contrib.messages.storage.ba... | baylee/django | tests/messages_tests/base.py | Python | bsd-3-clause | 14,082 |
# -*- coding: utf-8 -*-
import cStringIO
import datetime
from itertools import islice
import json
import xml.etree.ElementTree as ET
import logging
import re
import werkzeug.utils
import urllib2
import werkzeug.wrappers
from PIL import Image
import openerp
from openerp.addons.web.controllers.main import WebClient
fr... | minhphung171093/GreenERP_V8 | openerp/addons/website/controllers/main.py | Python | agpl-3.0 | 20,190 |
def foo(a, b=None):
pass
foo("a", "b")
foo("a")
foo("a", b="b")
foo("a", None)
| siosio/intellij-community | python/testData/refactoring/changeSignature/newParameterWithSignatureDefaultMakesSubsequentExistingParametersUseKeywordArguments.before.py | Python | apache-2.0 | 82 |
import numpy as np
from scipy import stats
from statsmodels.regression.linear_model import OLS
from statsmodels.tools import tools
from statsmodels.sandbox.regression.gmm import IV2SLS, IVGMM, DistQuantilesGMM, spec_hausman
from statsmodels.sandbox.regression import gmm
if __name__ == '__main__':
import stats... | hlin117/statsmodels | statsmodels/sandbox/examples/try_gmm_other.py | Python | bsd-3-clause | 5,387 |
# Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | mojwang/selenium | py/test/selenium/webdriver/common/results_page.py | Python | apache-2.0 | 1,408 |
print(1)<caret> | asedunov/intellij-community | python/testData/postfix/print/number3_after.py | Python | apache-2.0 | 15 |
# (c) 2018, NetApp, Inc
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
''' unit test template for ONTAP Ansible module '''
from __future__ import print_function
import json
import pytest
from units.compat import unittest
from units.compat.mock import patch, Mock
from ans... | andmos/ansible | test/units/modules/storage/netapp/test_na_ontap_lun_copy.py | Python | gpl-3.0 | 5,814 |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsMultiEditToolButton.
.. note:: 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 2 of the License, or
(at your option) any later version... | pblottiere/QGIS | tests/src/python/test_qgsmultiedittoolbutton.py | Python | gpl-2.0 | 2,332 |
#!/usr/bin/env python2.5
# Copyright 2006 Google, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""Unit tests for pytree.py.
NOTE: Please *don't* add doc strings to individual test methods!
In verbose mode, printing of the module, class and method name is much
more helpful than printing o... | leighpauls/k2cro4 | third_party/python_26/Lib/lib2to3/tests/test_pytree.py | Python | bsd-3-clause | 15,828 |
# Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | jerome-jacob/selenium | py/test/selenium/webdriver/common/page_loading_tests.py | Python | apache-2.0 | 5,014 |
#
# cl.h - Compression Library typedefs and prototypes
#
# 01/07/92 Cleanup by Brian Knittel
# 02/18/92 Original Version by Brian Knittel
#
#
# originalFormat parameter values
#
from warnings import warnpy3k
warnpy3k("the CL_old module has been removed in Python 3.0", stacklevel=2)
del warnpy3k
MAX_NUMBER_O... | teeple/pns_server | work/install/Python-2.7.4/Lib/plat-irix5/CL_old.py | Python | gpl-2.0 | 6,162 |
"""
22. Using properties on models
Use properties on models just like on any other Python object.
"""
from django.db import models
class Person(models.Model):
first_name = models.CharField(max_length=30)
last_name = models.CharField(max_length=30)
def _get_full_name(self):
return "%s %s" % (self... | mzdaniel/oh-mainline | vendor/packages/Django/tests/modeltests/properties/models.py | Python | agpl-3.0 | 567 |
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
from __future__ import unicode_literals
DATE_FORMAT = r'j \d\e F \d\e Y'
TIME_FORMAT = 'H:i'
DATETIME_FORMAT = r'j \d\e F \d\e Y \a \l\a\s H:i'
YEAR_MONTH_FORMAT = r'F \d\e Y'
MONTH_DAY_FORMAT = r'j \d\e F'
SHORT_DATE_... | BitWriters/Zenith_project | zango/lib/python3.5/site-packages/django/conf/locale/es_PR/formats.py | Python | mit | 738 |
# -*- coding: utf-8 -*-
import cStringIO
import datetime
import functools
import itertools
import time
import psycopg2
import pytz
from openerp import models, api, _
from openerp.tools import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT, ustr
REFERENCING_FIELDS = set([None, 'id', '.id'])
def only_ref_f... | eino-makitalo/odoo | openerp/addons/base/ir/ir_fields.py | Python | agpl-3.0 | 17,664 |
# This program is free software; you can redistribute it and/or modify
# it under the terms of the (LGPL) GNU Lesser General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will ... | marcellodesales/svnedge-console | svn-server/lib/suds/xsd/query.py | Python | agpl-3.0 | 6,451 |
from mutant_django.generator import DjangoBase
def register(app):
app.extend_generator('django', django_json_field)
def django_json_field(gen):
gen.field_generators['JSON'] = JSONField
class JSONField(DjangoBase):
DJANGO_FIELD = 'JSONField'
def render_imports(self):
return ['from jsonfiel... | peterdemin/mutant | src/mutant_django_json/__init__.py | Python | isc | 341 |
"""
WSGI config for zemantaCounter project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "zemantaCounter.settings")
from... | kostans3k/DistributedCounters | zemantaCounter/wsgi.py | Python | mit | 403 |
# SendImage.py: read an image from the command line, spit it out to DMX
# Requires Python Image library: http://www.pythonware.com/products/pil/
# usage: Python SendImage.py test.png
import Image
import sys
import os
import time
import colorsys
from optparse import OptionParser
#local classes
import aurora
class Ima... | headrotor/aurora-server | imagemunger.py | Python | mit | 6,314 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import click
import requests
from .exceptions import (
CachedPage,
WaybackRuntimeError,
BlockedByRobots
)
from urllib.parse import urljoin
from requests.utils import parse_header_links
def capture(
target_url,
user_agent="savepagenow (https://github.co... | pastpages/savepagenow | savepagenow/api.py | Python | mit | 4,446 |
from django.http import Http404
from django.shortcuts import render
from django.template import TemplateDoesNotExist
def index(request):
return render(request, 'frontend/index.html')
def view_provider(request, view_url):
try:
return render(request, 'frontend/views/' + view_url)
except TemplateDo... | samupl/simpleERP | apps/frontend/views.py | Python | mit | 354 |
# vim: set fileencoding=utf-8 :
import datetime
import textwrap
import pytest
import pytz
from khal.khalendar.event import Event
from .aux import normalize_component
def test_normalize_component():
assert normalize_component(textwrap.dedent("""
BEGIN:VEVENT
DTSTART;TZID=Europe/Berlin;VALUE=DATE-TIME:2... | sheeprine/khal | tests/event_test.py | Python | mit | 11,219 |
import pytest
from ..helpers import config_file, main_run
@config_file('''
deploy:
- fab: |
run('touch depl_fab')
sudo("rm depl_fab")
''')
def test_no_error(tmpdir):
main_run(['depl', 'deploy', 'localhost'])
@config_file('''
deploy:
- fab: |
sudo("rm... | davidhalter/depl | test/deploy/test_fab.py | Python | mit | 709 |
# -*- coding: utf-8 -*-
#
# python-syncthing documentation build configuration file, created by
# sphinx-quickstart on Tue Jan 3 16:17:40 2017.
#
# 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 fi... | blakev/python-syncthing | docs/source/conf.py | Python | mit | 9,994 |
"""WebSocket-specific events."""
import mitmproxy.http
import mitmproxy.websocket
class Events:
# Websocket lifecycle
def websocket_handshake(self, flow: mitmproxy.http.HTTPFlow):
"""
Called when a client wants to establish a WebSocket connection. The
WebSocket-specific headers... | vhaupert/mitmproxy | examples/addons/events-websocket-specific.py | Python | mit | 1,300 |
import chardet
from vint.ast.node_type import NodeType
from vint.ast.traversing import traverse, SKIP_CHILDREN
from vint.linting.level import Level
from vint.linting.lint_target import AbstractLintTarget
from vint.linting.policy.abstract_policy import AbstractPolicy
from vint.linting.policy_registry import register_po... | Kuniwak/vint | vint/linting/policy/prohibit_missing_scriptencoding.py | Python | mit | 1,557 |
from create_rule_image_multiprocessed_bypx import phenological_classificaion, read_reference_file
import os
from pyhytemporal.utils import find_files
clip1refs = find_files("/Users/phoetrymaster/Documents/School/Geography/Thesis/Data/MODIS_KANSAS_2007-2012/reprojected/Refs/2012/clip1", "mean.ref")
clip2refs = find_fil... | jkeifer/pyHytemporal | old_TO_MIGRATE/classifyclips.py | Python | mit | 4,401 |
from base_uri import URI
class HomeURI(URI):
path = '/'
| LINKIWI/modern-paste | app/uri/main.py | Python | mit | 62 |
#!/usr/bin/env python3
# Copyright (c) 2016 Zurcoin Core Developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
# This script will locally construct a merge commit for a pull request on a
# github repository, inspect it, sign ... | zurcoin/zurcoin | contrib/devtools/github-merge.py | Python | mit | 10,860 |
#!/usr/bin/python
import fetch
import sys
from pymongo import MongoClient
db = MongoClient().ppa.ticket
for loc in db.distinct('location'):
print loc
sys.exit(1)
''' Getting the count for each date
for date in sorted(db.distinct('issueDate')):
print "%s: %s" % (date, db.find({'issueDate':date}).count())
''... | di/ppa | stats.py | Python | mit | 2,062 |
#!/usr/bin/env python
"""
:Author Patrik Valkovic
:Created 23.12.2017 16:03
:Licence MIT
Part of grammpy
"""
from typing import TYPE_CHECKING
from .SplittedRules import splitted_rules
if TYPE_CHECKING: # pragma no cover
from .. import Nonterminal
class InverseCommon:
"""
Class that aggregates function... | PatrikValkovic/grammpy | grammpy/transforms/InverseCommon.py | Python | mit | 807 |
# coding=utf-8
__author__ = 'javon'
import sys
rdfTemplate = """<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
xmlns="http://vocab.cdmk-caribbean.net/cdmk#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns... | JA-VON/python-helpers-msbm | converter.py | Python | mit | 10,280 |
#!/usr/bin/env python3
import os, sys, argparse, stat, time, copy
# From StackOverflow :: http://stackoverflow.com/a/1094933
def sizeof_fmt(num, suffix='B'):
for unit in ['','Ki','Mi','Gi','Ti','Pi','Ei','Zi']:
if abs(num) < 1024.0:
return "%3.1f%s%s" % (num, unit, suffix)
num /= 1024.0
return "%.1f%... | stwb/pywinux | ls.py | Python | mit | 2,725 |
from amqpstorm.management import ManagementApi
from amqpstorm.message import Message
from amqpstorm.tests import HTTP_URL
from amqpstorm.tests import PASSWORD
from amqpstorm.tests import USERNAME
from amqpstorm.tests.utility import TestFunctionalFramework
from amqpstorm.tests.utility import setup
class ApiBasicFuncti... | eandersson/amqp-storm | amqpstorm/tests/functional/management/basic_tests.py | Python | mit | 2,492 |
from unittest import TestCase
from pyrake.contrib.spidermiddleware.urllength import UrlLengthMiddleware
from pyrake.http import Response, Request
from pyrake.spider import Spider
class TestUrlLengthMiddleware(TestCase):
def test_process_spider_output(self):
res = Response('http://pyraketest.org')
... | elkingtowa/pyrake | tests/test_spidermiddleware_urllength.py | Python | mit | 685 |
from django.db import models
class Offer(models.Model):
"""
Describes an offer/advertisement
"""
image = models.URLField()
button_text = models.CharField(max_length=32, null=True, blank=True, help_text="Call to action/Button Text")
url = models.URLField(help_text="Destination url for this off... | AmandaCMS/amanda-cms | amanda/offer/models.py | Python | mit | 325 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import sys
import argparse
import logging
import numpy as np
from sklearn.cross_validation import StratifiedKFold, train_test_split
def read_triples(path):
with open(path, 'rt') as f:
lines = f.readlines()
triples = [(s.strip(), p.strip(), o.... | uclmr/inferbeddings | data/nations/make_folds_stratified.py | Python | mit | 3,031 |
# Copyright (C) 2010-2011 Richard Lincoln
#
# 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, modify, merge, publish... | rwl/PyCIM | CIM14/ENTSOE/Equipment/Core/Curve.py | Python | mit | 4,106 |
# -*- coding: utf-8 -*-
# Copyright (c) 2014 Tampere University of Technology,
# Intel Corporation,
# OptoFidelity,
# and authors
#
# 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 res... | teroc/Otero | tests/run_tests.py | Python | mit | 1,499 |
'''
The Core of peterhellberg
'''
import requests
from . import metadata
def parse(url, use_ssl=False):
'''Send a http request to the remote server
Return the response, as a dictionary
Raises requests.exceptions.ConnectionError in event of a network error
Raises requests.exceptions.HTTPError in even... | forfuturellc/peterhellberg | peterhellberg/main.py | Python | mit | 1,258 |
"""
__/\\\\\\\\\\\\______________________/\\\\\\\\\\\____/\\\________/\\\_
_\/\\\////////\\\__________________/\\\/////////\\\_\/\\\_______\/\\\_
_\/\\\______\//\\\________________\//\\\______\///__\/\\\_______\/\\\_
_\/\\\_______\/\\\_____/\\\\\______\////\\\_________\/\\\_______\/\\\_
_\/\\\_______\/\\\___/... | tsandrini/dosu | dosu/utils.py | Python | mit | 2,094 |
"""
Functions for reading/writing/manipulating klattgrid files
A klattgrid can be used for speech synthesis/resynthesis.
For more information on the praat klattgrid:
http://www.fon.hum.uva.nl/praat/manual/KlattGrid.html
There are three kinds of data types in a klattgrid:
null tiers (contain no data points -- seem to ... | timmahrt/praatIO | praatio/klattgrid.py | Python | mit | 8,030 |
######################################################################
# Interrupt.py
#
# This program enable interrupt on gpio pin 18 for read switch
# button
######################################################################
import RPi.GPIO as GPIO
import time
def myCallback(channel):
print("You press... | reza-arjmandi/rpi-course | session3/Interrupt.py | Python | mit | 560 |
"""
Display all the icons available in :obj:`QtWidgets.QStyle.StandardPixmap` and in
the *standard* Windows DLL/EXE files.
"""
from msl.qt import (
QtWidgets,
QtCore,
application,
convert
)
try:
# check if pythonnet is installed
import clr
has_clr = True
except ImportError:
has_clr = Fa... | MSLNZ/msl-qt | msl/examples/qt/show_standard_icons.py | Python | mit | 5,135 |
#! /usr/bin/env python3
# This was forked from https://github.com/rustyrussell/lightning-payencode/tree/acc16ec13a3fa1dc16c07af6ec67c261bd8aff23
import re
import time
from hashlib import sha256
from binascii import hexlify
from decimal import Decimal
from typing import Optional, TYPE_CHECKING, Type
import random
impo... | wakiyamap/electrum-mona | electrum_mona/lnaddr.py | Python | mit | 18,219 |
import pp
from pp.mask.merge_json import merge_json
from pp.mask.merge_markdown import merge_markdown
from pp.mask.merge_test_metadata import merge_test_metadata
from pp.mask.write_labels import write_labels
def merge_metadata(gdspath, labels_prefix="opt", label_layer=pp.LAYER.LABEL, **kwargs):
mdpath = gdspath.w... | psiq/gdsfactory | pp/mask/merge_metadata.py | Python | mit | 914 |
# http://codingbat.com/prob/p184853
def big_diff(nums):
max_num = nums[0]
min_num = nums[0]
for num in nums:
max_num = max(num, max_num)
min_num = min(num, min_num)
return abs(max_num - min_num)
| dvt32/cpp-journey | Python/CodingBat/big_diff.py | Python | mit | 220 |
from collections import OrderedDict
import functools
import itertools
import torch
from ..backends.thnn import backend as thnn_backend
from ..parameter import Parameter
import torch.utils.hooks as hooks
def _addindent(s_, numSpaces):
s = s_.split('\n')
# don't do anything for single-line stuff
if len(s) ... | ryfeus/lambda-packs | pytorch/source/torch/nn/modules/module.py | Python | mit | 41,372 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2017-03-19 02:09
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('pos', '0001_initial'),
]
operations = [
migrations.AddField(
mo... | nuxis/p0sX-server | p0sx/pos/migrations/0002_itemingredient_exclusive.py | Python | mit | 448 |
'''
PathwayGenie (c) University of Manchester 2017
PathwayGenie is licensed under the MIT License.
To view a copy of this license, visit <http://opensource.org/licenses/MIT/>.
@author: neilswainston
'''
from threading import Thread
import json
import time
from ice.ice import IceThread
from parts_genie.parts import... | synbiochem/PathwayGenie | pathway_genie/pathway.py | Python | mit | 2,745 |
#!/usr/bin/env python3
from __future__ import unicode_literals
from builtins import bytes, dict, list, int, float, str
import os
import sys
import unittest
import pexpect
sys.path.append('..')
from reflectrpc.rpcsh import print_functions
from reflectrpc.rpcsh import split_exec_line
from reflectrpc.rpcsh import Ref... | aheck/reflectrpc | tests/rpcsh-tests.py | Python | mit | 16,724 |
"""pilvi URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-base... | prawn-cake/pilvi | pilvi/urls.py | Python | mit | 762 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/_configuration.py | Python | mit | 3,327 |
#!/usr/bin/env python
import sys
import re
import os
inFilename = sys.argv[1]
if os.path.isfile(inFilename):
namelength = inFilename.rfind(".")
name = inFilename[0:namelength]
exten = inFilename[namelength:]
outFilename = name+"-cachecmp"+exten
print "inFilename:", inFilename
print "outFilename:", outFilename
fpR... | bcheung92/Paperproject | gem5/pyscript/cachecmp.py | Python | mit | 2,915 |
import os
from setuptools import setup
ROOT = os.path.dirname(os.path.realpath(__file__))
with open(os.path.join(ROOT, 'README.rst'), encoding='utf-8') as inp:
LONG_DESCRIPTION = inp.read()
setup(
# Meta data
name='user_agent',
version='0.1.10',
author="Gregory Petukhov",
author_email='lorie... | lorien/user_agent | setup.py | Python | mit | 1,599 |
import tornado.web
from tornado.options import options
class CaptureHandler(tornado.web.RequestHandler):
def get(self):
self.render('capture.html',
address=options.address,
public_address=options.public_address)
| AlexPereverzyev/html5stream | html5stream/handlers/capture_handler.py | Python | mit | 268 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""晨星基金评级数据,用来买基金作为参考"""
import _env
import copy
import heapq
import requests
from operator import itemgetter
from tornado.escape import utf8
from six import print_
from bs4 import BeautifulSoup
from web_util import get
def parse_html(html):
html = utf8(html)
sou... | PegasusWang/pyhome | crawler/morningstar/morningstar.py | Python | mit | 2,629 |
"""
There are a total of n courses you have to take, labeled from 0 to n - 1.
Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is expressed as a pair: [0,1]
Given the total number of courses and a list of prerequisite pairs, return the ordering of courses you sh... | yingcuhk/LeetCode | Algorithms/#210 CourseSchedule II/PythonCode.py | Python | mit | 2,023 |
# -*- coding: utf-8 -*-
"""
unit_conversion.py
==================
Functions for checking and sanitizing units that do not follow the FITS specification.
This uses functions from ``astropy.unit`` to parse and handle units.
"""
import warnings
from astropy.units import Unit, UnrecognizedUnit
from astropy.io.fits.verify... | telegraphic/fits2hdf | fits2hdf/unit_conversion.py | Python | mit | 2,314 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Unit tests for all SQL implementations of spectrum libraries.
"""
from os import path as os_path
import uuid
import unittest
import numpy as np
import fourgp_speclib
class TestSpectrumLibrarySQL(object):
"""
This class is a mixin which adds lots of standard... | dcf21/4most-4gp | src/pythonModules/fourgp_speclib/fourgp_speclib/tests/test_spectrum_library_sql.py | Python | mit | 7,484 |
# Задача №1:
# Сформировать массив из N элементов вида [1,2,3,4,...N]
#
# Вариант решения №2, через превращение range() в массив
#
# =!!= Запускать с помощью Python3 =!!=
# Указываем количество
N = 10
# Создаем массив
A = [ *range(1,N+1) ]
# Выводим A
print( A )
# Пояснения:
# 1) range(1,N+1) создает последовательн... | DmitrySPetrov/simulation_g11 | l06/12.py | Python | mit | 1,229 |
#!/usr/bin/env python
#
# This code is a part of `ardrone_autopilot` project
# which is distributed under the MIT license.
# See `LICENSE` file for details.
#
"""
This node is based on `base.py`. See there a documentation.
Inputs
------
* in/image -- main picture stream.
Outputs
-------
* out/image -- result imag... | AmatanHead/ardrone-autopilot | nodes_opencv/frame.py | Python | mit | 1,941 |
import os
import time
import datetime
import logging
import gzip
from hardware.channel import Channel
"""
Sensor Class
- ggf. Logfile als Datasource per Parameter
- Logging in eigene Klasse oder Scheduler
"""
class Sensor:
def __init__(self, device):
self.initialized = False
self.device = device
self.in... | Psychedelic-Engineering/sleep-machine | hardware/sensors.py | Python | mit | 2,531 |