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 |
|---|---|---|---|---|---|
#!/usr/bin/env python2
# vim:fileencoding=utf-8
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2014, Kovid Goyal <kovid at kovidgoyal.net>'
# Support for excporting Qt's MenuBars/Menus over DBUS. The API is defined i... | drxaero/calibre | src/calibre/gui2/dbus_export/menu.py | Python | gpl-3.0 | 14,935 |
from ..broker import Broker
class DeviceServiceServiceBroker(Broker):
controller = "device_service_services"
def show(self, **kwargs):
"""Shows the details for the specified device service service.
**Inputs**
| ``api version min:`` None
| ``api version max:`` N... | infobloxopen/infoblox-netmri | infoblox_netmri/api/broker/v3_8_0/device_service_service_broker.py | Python | apache-2.0 | 49,305 |
#! /usr/bin/env python
#
# See README for usage instructions.
import glob
import os
import subprocess
import sys
import platform
# We must use setuptools, not distutils, because we need to use the
# namespace_packages option for the "google" package.
from setuptools import setup, Extension, find_packages
from distuti... | sunghan-chang/TizenRT | external/protobuf/python/setup.py | Python | apache-2.0 | 10,629 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, Ansible by Red Hat, inc
#
# This file is part of Ansible by Red Hat
#
# 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 Li... | hkariti/ansible | lib/ansible/modules/network/vyos/vyos_banner.py | Python | gpl-3.0 | 5,186 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# (c) 2015, René Moser <mail@renemoser.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... | crafty78/ansible | contrib/inventory/cloudstack.py | Python | gpl-3.0 | 9,221 |
# Copyright 2011 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | eharney/nova | nova/tests/api/openstack/compute/plugins/v3/test_multinic.py | Python | apache-2.0 | 5,154 |
# Copyright (C) 2010 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and th... | mogoweb/webkit_for_android5.1 | webkit/Tools/Scripts/webkitpy/tool/steps/checkstyle.py | Python | apache-2.0 | 2,811 |
from attr import dataclass
class A7:
x: int = 1
def __lt__(self, other):
pass
@dataclass(cmp=True)
class B7(A7):
y: str = "1"
print(A7() < B7())
print(B7() <error descr="'__lt__' not supported between instances of 'B7' and 'A7'"><</error> A7())
print(A7() < object())
print(B7() <error descr="'__... | siosio/intellij-community | python/testData/inspections/PyDataclassInspection/comparisonForManuallyOrderedInAttrsInheritance.py | Python | apache-2.0 | 1,285 |
"""
.. _tut_stats_cluster_source_2samp:
=========================================================================
2 samples permutation test on source data with spatio-temporal clustering
=========================================================================
Tests if the source space data are significantly differe... | trachelr/mne-python | tutorials/plot_cluster_stats_spatio_temporal_2samp.py | Python | bsd-3-clause | 4,321 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, Ansible by Red Hat, 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
ANSIBLE_METADATA = {
"metadata_version": "1.1",
"s... | Shaps/ansible | test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/modules/net_logging.py | Python | gpl-3.0 | 2,503 |
"""
Constants specific to the SQL storage portion of the ORM.
"""
from collections import namedtuple
import re
# Valid query types (a set is used for speedy lookups). These are (currently)
# considered SQL-specific; other storage systems may choose to use different
# lookup types.
QUERY_TERMS = {
'exact', 'iexact... | simbha/mAngE-Gin | lib/django/db/models/sql/constants.py | Python | mit | 1,399 |
#!/usr/bin/python2.7
# 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 ... | hsarmiento/people_finder_chile | app/jp_mobile_carriers.py | Python | apache-2.0 | 7,659 |
#
# Copyright (C) 2014
# Sean Poyser (seanpoyser@gmail.com)
#
# 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, or (at your option)
# any later version.
#
# This... | mrquim/repository.mrquim | repo/plugin.program.super.favourites/launcher.py | Python | gpl-2.0 | 929 |
# -*- coding: utf-8 -*-
from reportlab.lib.colors import Color, CMYKColor, getAllNamedColors, toColor, \
HexColor
from reportlab.lib.enums import TA_LEFT, TA_CENTER, TA_RIGHT, TA_JUSTIFY
from reportlab.lib.units import inch, cm
import base64
import httplib
import logging
import mimetypes
import os.path
import re
im... | tecknicaltom/xhtml2pdf | xhtml2pdf/util.py | Python | apache-2.0 | 27,717 |
#!/usr/bin/python
"""Utility to generate files to benchmark"""
# Copyright Abel Sinkovics (abel@sinkovics.hu) 2016.
# 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)
import argparse
import os
import stri... | stan-dev/math | lib/boost_1.75.0/libs/metaparse/tools/benchmark/generate.py | Python | bsd-3-clause | 8,790 |
# flake8: noqa
from __future__ import absolute_import
from .filterset import FilterSet
from .filters import *
__version__ = '0.9.2'
def parse_version(version):
'''
'0.1.2-dev' -> (0, 1, 2, 'dev')
'0.1.2' -> (0, 1, 2)
'''
v = version.split('.')
v = v[:-1] + v[-1].split('-')
ret = []
fo... | andela-bojengwa/talk | venv/lib/python2.7/site-packages/django_filters/__init__.py | Python | mit | 485 |
#!./uwsgi --http-socket :9090 --async 100 ...
# same chat example but using uwsgi async api
# for pypy + continulets just run:
# uwsgi --http-socket :9090 --pypy-home /opt/pypy --pypy-wsgi-file tests/websockets_chat_async.py --pypy-eval "uwsgi_pypy_setup_continulets()" --async 100
import uwsgi
import time
import redis
... | goal/uwsgi | tests/websockets_chat_async.py | Python | gpl-2.0 | 3,284 |
"""Sanity test using rstcheck."""
from __future__ import absolute_import, print_function
import os
from lib.sanity import (
SanitySingleVersion,
SanityMessage,
SanityFailure,
SanitySuccess,
SanitySkipped,
)
from lib.util import (
SubprocessError,
run_command,
parse_to_dict,
find_e... | tsdmgz/ansible | test/runner/lib/sanity/rstcheck.py | Python | gpl-3.0 | 2,126 |
def handle(foo, *args, <error descr="multiple * parameters are not allowed">*moreargs</error>):
print(foo, args, moreargs)
def handle(foo, *args: int, <error descr="multiple * parameters are not allowed">*moreargs: int</error>):
print(foo, args, moreargs) | dahlstrom-g/intellij-community | python/testData/highlighting/multiplePositionalContainers.py | Python | apache-2.0 | 264 |
class OAuthToolkitError(Exception):
"""
Base class for exceptions
"""
def __init__(self, error=None, redirect_uri=None, *args, **kwargs):
super(OAuthToolkitError, self).__init__(*args, **kwargs)
self.oauthlib_error = error
if redirect_uri:
self.oauthlib_error.redirec... | ramcn/demo3 | venv/lib/python3.4/site-packages/oauth2_provider/exceptions.py | Python | mit | 441 |
try:
try:
import ubinascii as binascii
except ImportError:
import binascii
except ImportError:
print("SKIP")
raise SystemExit
print(binascii.unhexlify(b'0001020304050607'))
print(binascii.unhexlify(b'08090a0b0c0d0e0f'))
print(binascii.unhexlify(b'7f80ff'))
print(binascii.unhexlify(b'313... | AriZuu/micropython | tests/extmod/ubinascii_unhexlify.py | Python | mit | 546 |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2012 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) a... | Panos512/invenio | modules/webaccess/lib/external_authentication_oauth1.py | Python | gpl-2.0 | 8,849 |
# -*- coding: utf-8 -*-
"""Converts an IRI to a URI."""
__author__ = "Joe Gregorio (joe@bitworking.org)"
__copyright__ = "Copyright 2006, Joe Gregorio"
__contributors__ = []
__version__ = "1.0.0"
__license__ = "MIT"
import urllib.parse
# Convert an IRI to a URI following the rules in RFC 3987
#
# The characters we n... | endlessm/chromium-browser | tools/swarming_client/third_party/httplib2/python3/httplib2/iri2uri.py | Python | bsd-3-clause | 4,153 |
"""
Demo platform that has two fake alarm control panels.
For more details about this platform, please refer to the documentation
https://home-assistant.io/components/demo/
"""
import homeassistant.components.alarm_control_panel.manual as manual
def setup_platform(hass, config, add_devices, discovery_info=None):
... | Smart-Torvy/torvy-home-assistant | homeassistant/components/alarm_control_panel/demo.py | Python | mit | 462 |
#!/usr/bin/env python
# Author: Shao Zhang and Phil Saltzman
# Last Updated: 2015-03-13
#
# This tutorial is intended as a initial panda scripting lesson going over
# display initialization, loading models, placing objects, and the scene graph.
#
# Step 3: In this step, we create a function called loadPlanets, which w... | brakhane/panda3d | samples/solar-system/step3_load_model.py | Python | bsd-3-clause | 4,775 |
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (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.mozilla.org/MPL/
#
# Softwa... | ruibarreira/linuxtrail | usr/lib/virtualbox/sdk/bindings/xpcom/python/xpcom/file.py | Python | gpl-3.0 | 11,962 |
#!/usr/bin/env python3
# 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 runner
import pytest
def test_log_parser():
mock_log = b'''
[PERF] perf block start... | wldcordeiro/servo | etc/ci/performance/test_runner.py | Python | mpl-2.0 | 14,471 |
#!/usr/bin/python
# This creates a CSV file from the output of the debug output of subtarget:
# llvm-tblgen --gen-subtarget --debug-only=subtarget-emitter
# With thanks to Dave Estes for mentioning the idea at 2014 LLVM Developers' Meeting
import os;
import sys;
import re;
import operator;
table = {}
models = set(... | apple/swift-llvm | utils/schedcover.py | Python | apache-2.0 | 2,759 |
def main(request, response):
import simplejson as json
f = file('config.json')
source = f.read()
s = json.JSONDecoder().decode(source)
url1 = "http://" + s['host'] + ":" + str(s['ports']['http'][1])
_CSP = "font-src " + url1
response.headers.set("Content-Security-Policy", _CSP)
response.... | kaixinjxq/web-testing-service | wts/tests/csp/csp_font-src_cross-origin_allowed-manual.py | Python | bsd-3-clause | 2,615 |
#!/usr/bin/env python
# This demonstrates a node group configurations.
#
# Node groups can be defined with the syntax "-g N@IP0,IP1-IP2,IP3".
# This says to create a group of N nodes with IPs IP0, IP1, ..., IP2,
# IP3. Run it with deterministic IPs causes lots of gratuitous IP
# reassignments. Running with --nd fixe... | rootfs/ctdb | tests/takeover/simulation/node_group.py | Python | gpl-3.0 | 1,299 |
"""Intesishome platform."""
| jawilson/home-assistant | homeassistant/components/intesishome/__init__.py | Python | apache-2.0 | 28 |
callback_classes = [
['void', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['void', 'double', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['void', 'int', 'ns... | letiangit/802.11ah-ns3 | src/energy/bindings/callbacks_list.py | Python | gpl-2.0 | 641 |
# testing/schema.py
# Copyright (C) 2005-2017 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
from . import exclusions
from .. import schema, event
from . import config
__all_... | wildchildyn/autism-website | yanni_env/lib/python3.6/site-packages/sqlalchemy/testing/schema.py | Python | gpl-3.0 | 3,556 |
from .responses import CloudWatchResponse
url_bases = [
"https?://monitoring.(.+).amazonaws.com",
]
url_paths = {
'{0}/$': CloudWatchResponse.dispatch,
}
| botify-labs/moto | moto/cloudwatch/urls.py | Python | apache-2.0 | 164 |
# 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 may not use this file ex... | vmanoria/bluemix-hue-filebrowser | hue-3.8.1-bluemix/apps/sqoop/src/sqoop/client/connector.py | Python | gpl-2.0 | 2,640 |
"""
Helper functions for managing interactions with the LTI outcomes service defined
in LTI v1.1.
"""
from hashlib import sha1
from base64 import b64encode
import logging
import uuid
from lxml import etree
from lxml.builder import ElementMaker
from oauthlib.oauth1 import Client
from oauthlib.common import to_unicode
... | zofuthan/edx-platform | lms/djangoapps/lti_provider/outcomes.py | Python | agpl-3.0 | 9,222 |
import re
from os.path import splitext
from livestreamer.compat import urlparse, unquote
from livestreamer.plugin import Plugin
from livestreamer.plugin.api import http, validate
from livestreamer.stream import HTTPStream, RTMPStream
_url_re = re.compile("""
http(s)?://(\w+\.)?aliez.tv
(?:
/live/[^/]... | charmander/livestreamer | src/livestreamer/plugins/alieztv.py | Python | bsd-2-clause | 2,005 |
import os
from numpy.testing import assert_array_equal, raises, run_module_suite
import numpy as np
import skimage.io as io
from skimage.io.manage_plugins import plugin_store
from skimage import data_dir
def test_stack_basic():
x = np.arange(12).reshape(3, 4)
io.push(x)
assert_array_equal(io.pop(), x)
... | Britefury/scikit-image | skimage/io/tests/test_io.py | Python | bsd-3-clause | 769 |
# Kills a process by process name
#
# Uses the Performance Data Helper to locate the PID, then kills it.
# Will only kill the process if there is only one process of that name
# (eg, attempting to kill "Python.exe" will only work if there is only
# one Python.exe running. (Note that the current process does not
# coun... | JulienMcJay/eclock | windows/Python27/Lib/site-packages/pywin32-218-py2.7-win32.egg/scripts/killProcName.py | Python | gpl-2.0 | 1,766 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2012, Luis Alberto Perez Lazaro <luisperlazaro@gmail.com>
# Copyright: (c) 2015, Jakub Jirutka <jakub@jirutka.cz>
# Copyright: (c) 2017, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future... | rosmo/ansible | lib/ansible/modules/files/patch.py | Python | gpl-3.0 | 7,109 |
from setuptools import setup
# Replace the place holders with values for your project
setup(
# Do not use underscores in the plugin name.
name='custom-wf-plugin',
version='0.1',
author='alien',
author_email='alien@fastconnect.fr',
description='custom generated workflows',
# This must co... | victorkeophila/alien4cloud-cloudify3-provider | src/test/resources/outputs/blueprints/openstack/tomcat/plugins/custom_wf_plugin/setup.py | Python | apache-2.0 | 650 |
# -*- coding: utf-8 -*-
from __future__ import with_statement
from os.path import exists
from os.path import join
CONF_VERSION = 1
########################################################################
class ConfigParser:
#----------------------------------------------------------------------
def __init_... | EvolutionClip/pyload | module/gui/CoreConfigParser.py | Python | gpl-3.0 | 5,711 |
import re
import sys
import pip
from pip.req import InstallRequirement
from pip.log import logger
from pip.basecommand import Command
from pip.util import get_installed_distributions
import pkg_resources
class FreezeCommand(Command):
"""Output installed packages in requirements format."""
name = 'freeze'
... | OpenWinCon/OpenWinNet | web-gui/myvenv/lib/python3.4/site-packages/pip/commands/freeze.py | Python | apache-2.0 | 4,647 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
"""
WSGI stack, common code.
"""
import httplib
import urllib
import xmlrpclib
import StringIO
import errno
import logging
import platform
import socket
import sys
import threading
import traceback
import werkzeug.s... | vileopratama/vitech | src/openerp/service/wsgi_server.py | Python | mit | 8,202 |
# -*- coding: utf-8 -*-
"""
pygments.lexers._openedge_builtins
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Builtin list for the OpenEdgeLexer.
:copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
OPENEDGEKEYWORDS = (
'ABSOLUTE',
'ABS',
... | GarySparrow/mFlaskWeb | venv/Lib/site-packages/pygments/lexers/_openedge_builtins.py | Python | mit | 48,362 |
#
# Secret Labs' Regular Expression Engine
#
# various symbols used by the regular expression engine.
# run this script to update the _sre include files!
#
# Copyright (c) 1998-2001 by Secret Labs AB. All rights reserved.
#
# See the sre.py file for information on usage and redistribution.
#
"""Internal support modul... | 2014c2g12/c2g12 | wsgi/w2/static/Brython2.0.0-20140209-164925/Lib/sre_constants.py | Python | gpl-2.0 | 7,171 |
# -*- 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... | bealdav/OpenUpgrade | addons/sale/report/sale_report.py | Python | agpl-3.0 | 5,204 |
# -*- 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... | inovtec-solutions/OpenERP | openerp/addons/hr_attendance/__openerp__.py | Python | agpl-3.0 | 2,163 |
# Copyright (C) 2003-2007 Robey Pointer <robeypointer@gmail.com>
#
# This file is part of paramiko.
#
# Paramiko is free software; you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free
# Software Foundation; either version 2.1 of the License, or (a... | mytliulei/DCNRobotInstallPackages | windows/win32/paramiko-1.14.0/paramiko/compress.py | Python | apache-2.0 | 1,245 |
"""
Example generation for the scikit learn
Generate the rst files for the examples by iterating over the python
example files.
Files that generate images should start with 'plot'
"""
from __future__ import division, print_function
from time import time
import ast
import os
import re
import shutil
import traceback
i... | NelisVerhoef/scikit-learn | doc/sphinxext/gen_rst.py | Python | bsd-3-clause | 40,198 |
from __future__ import unicode_literals
from functools import total_ordering
from django.contrib.gis.geos import (
LinearRing, LineString, Point, Polygon, fromstr,
)
from django.utils import six
from django.utils.encoding import python_2_unicode_compatible
from django.utils.html import html_safe
@html_safe
@pyt... | Vvucinic/Wander | venv_2_7/lib/python2.7/site-packages/Django-1.9-py2.7.egg/django/contrib/gis/maps/google/overlays.py | Python | artistic-2.0 | 11,955 |
#-*- coding:utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# d$
#
# This program is free software: you can redistribute it and/or modify
# it ... | diogocs1/comps | web/addons/hr_payroll/wizard/__init__.py | Python | apache-2.0 | 1,159 |
# -*- 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::
{% ... | Drvanon/Game | venv/lib/python3.3/site-packages/jinja2/__init__.py | Python | apache-2.0 | 2,270 |
from __future__ import unicode_literals
import logging
from oauthlib.common import generate_token, urldecode
from oauthlib.oauth2 import WebApplicationClient, InsecureTransportError
from oauthlib.oauth2 import TokenExpiredError, is_secure_transport
import requests
log = logging.getLogger(__name__)
log.setLevel(loggi... | lucidbard/requests-oauthlib | requests_oauthlib/oauth2_session.py | Python | isc | 14,834 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2020-2022 F4PGA Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unl... | SymbiFlow/prjuray | utils/spec/slice_memory.py | Python | isc | 9,356 |
from django.core.management.base import BaseCommand, CommandError
from metricsapp.models import Metric, SprintMetric
class Command(BaseCommand):
help = 'Runs all available metrics.'
#parser.add_argument('poll_id', nargs='+', type=int)
def add_arguments(self, parser):
parser.add_argument("-m", "--metric-names", ... | chrisma/ScrumLint | metricsapp/management/commands/run_metrics.py | Python | mit | 788 |
import unittest
from katas.kyu_7.complementary_dna import DNA_strand
class DNAStrandTestCase(unittest.TestCase):
def test_equals(self):
self.assertEqual(DNA_strand('AAAA'), 'TTTT')
def test_equals_2(self):
self.assertEqual(DNA_strand('ATTGC'), 'TAACG')
def test_equals_3(self):
s... | the-zebulan/CodeWars | tests/kyu_7_tests/test_complementary_dna.py | Python | mit | 364 |
# -*- encoding: utf-8 -*-
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.test.client import Client
from pytils import VERSION as pytils_version
class ExamplesTestCase(TestCase):
def setUp(self):
self.c = Client()
def testIndex(self):
resp = self.c.g... | Forever-Young/pytils | doc/examples-django/pytilsex/tests.py | Python | mit | 2,702 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2017-02-13 17:41
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('product', '0028_product_related_title'),
]
operations = [
migrations.RemoveF... | skylifewww/pangolin-fog | product/migrations/0029_auto_20170213_1741.py | Python | mit | 681 |
from collections import Counter
from imblearn.datasets import make_imbalance
from imblearn.metrics import classification_report_imbalanced
from imblearn.pipeline import make_pipeline
from imblearn.under_sampling import ClusterCentroids
from imblearn.under_sampling import NearMiss
import matplotlib.pyplot as plt
from ... | shunw/pythonML_code | eg2_real_world_data.py | Python | mit | 4,961 |
import unittest
class MyTest(unittest.TestCase):
def test(self):
self.assertEqual(4, 4)
| manjitkumar/drf-url-filters | filters/tests/tests.py | Python | mit | 102 |
'''trec_dd.* namespace package can have several subpackages, see
http://github.com/trec-dd for more info
.. This software is released under an MIT/X11 open source license.
Copyright 2015 Diffeo, Inc.
'''
import pkg_resources
pkg_resources.declare_namespace(__name__)
| trec-dd/trec-dd-simulation-harness | trec_dd/__init__.py | Python | mit | 272 |
# encoding: utf-8
"""
Test suite for pptx.presentation module.
"""
from __future__ import (
absolute_import, division, print_function, unicode_literals
)
import pytest
from pptx.parts.coreprops import CorePropertiesPart
from pptx.parts.presentation import PresentationPart
from pptx.parts.slide import NotesMaste... | biggihs/python-pptx | tests/test_presentation.py | Python | mit | 8,885 |
import nltk
class Text:
def __init__(self, raw_text):
self.raw_text = raw_text
def parse(self):
sentences = nltk.sent_tokenize(self.raw_text)
tokens = [nltk.word_tokenize(sentence) for sentence in sentences]
self.tagged_sentences = [self.tag(words) for words in tokens]
... | kodki/cortext | cortext/text.py | Python | mit | 1,056 |
from pathlib import Path
import os
import structlog
log = structlog.get_logger()
_config = None
def get():
global _config
if not isinstance(_config, _build_config):
_config = _build_config()
return _config
class _build_config:
def __init__(self):
self._config = {}
self.dos... | meantheory/dotfiles | dos/src/dos/config.py | Python | mit | 2,504 |
import importlib
from pygments.lexer import RegexLexer, bygroups
from pygments.styles import STYLE_MAP
from pygments.token import *
def load_style(full_class_string):
modulename, styleclass = full_class_string.split('::')
module = importlib.import_module("pygments.styles." + modulename)
return getattr(mo... | cwells/franz | lib/pygments.py | Python | mit | 1,729 |
#!/usr/bin/env python
from .schema import Schema
from .yamale_error import YamaleError
def make_schema(path=None, parser='PyYAML', validators=None, content=None):
# validators = None means use default.
# Import readers here so we can get version information in setup.py.
from . import readers
raw_schem... | 23andMe/Yamale | yamale/yamale.py | Python | mit | 1,460 |
from __future__ import absolute_import, division, print_function
import platform
import sys
from threading import Thread, Lock
import json
import warnings
import time
import stripe
import pytest
if platform.python_implementation() == "PyPy":
pytest.skip("skip integration tests with PyPy", allow_module_level=True... | stripe/stripe-python | tests/test_integration.py | Python | mit | 9,930 |
import functools
import os
import sys
import unittest
from contextlib import contextmanager
from cloudbridge.cloud.factory import CloudProviderFactory
from cloudbridge.cloud.interfaces import InstanceState
from cloudbridge.cloud.interfaces import TestMockHelperMixin
from six import reraise
def parse_bool(val):
... | ms-azure-cloudbroker/cloudbridge | cloudbridge/cloud/providers/azure/integration_test/helpers.py | Python | mit | 7,555 |
from setuptools import setup
setup(
name='g1.databases',
packages=[
'g1.databases',
],
install_requires=[
'SQLAlchemy',
'g1.bases',
],
extras_require={
'parts': [
'g1.apps',
],
},
zip_safe=False,
)
| clchiou/garage | py/g1/databases/setup.py | Python | mit | 283 |
# Generated by Django 2.2.10 on 2021-06-08 14:37
import django.db.models.deletion
from django.db import (
migrations,
models,
)
from accelerator.utils import copy_m2m_fields
def migrate_member_profile_data(apps, schema_editor):
MemberProfile = apps.get_model('accelerator', 'MemberProfile')
MemberPro... | masschallenge/django-accelerator | accelerator/migrations/0058_memberprofile1.py | Python | mit | 1,918 |
# -*- coding: utf-8 -*-
# pylint: disable=too-many-lines
import logging
import random
import time
import gevent
from gevent.event import AsyncResult
from gevent.queue import Empty, Queue
from gevent.timeout import Timeout
from random import randint
from ethereum import slogging
from ethereum.utils import sha3
from ... | tomaaron/raiden | raiden/tasks.py | Python | mit | 50,038 |
#!/usr/bin/python
# The contents of this file are in the public domain. See LICENSE_FOR_EXAMPLE_PROGRAMS.txt
#
#
# This simple example shows how to call dlib's optimal linear assignment problem solver.
# It is an implementation of the famous Hungarian algorithm and is quite fast, operating in
# O(N^3) time.
#
# COMPIL... | kaathleen/LeapGesture-library | DynamicGestures/dlib-18.5/python_examples/max_cost_assignment.py | Python | mit | 2,357 |
#
# First, let us create some utility functions for Plotting
#
def pd_centers(featuresUsed, centers):
from itertools import cycle, islice
from pandas.tools.plotting import parallel_coordinates
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
colNames = list(featuresUsed)
colNames.append(... | harishkrao/DSE200x | Week-1-Intro-new/customplot.py | Python | mit | 940 |
# coding: utf-8
from __future__ import absolute_import, unicode_literals
from rest_framework import status
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response
from rest_framework.views import APIView
from rest_framework_sso import claims
from rest_framework_sso.models i... | namespace-ee/django-rest-framework-sso | rest_framework_sso/views.py | Python | mit | 4,556 |
# vim: set ff=unix expandtab ts=4 sw=4:
from unittest import TestCase, main
import numpy as np
from CompartmentalSystems.bins.TimeField import TimeField
class TestTimeField(TestCase):
def setUp(self):
self.ar = np.zeros(3)
self.ar[2] = 2
self.arr = np.zeros((3, 2))
self.arr[2, 1] =... | MPIBGC-TEE/CompartmentalSystems | tests/bins/TestTimeField.py | Python | mit | 496 |
"""
RFB protocol implementattion, client side.
Override RFBClient and RFBFactory in your application.
See vncviewer.py for an example.
Reference:
http://www.realvnc.com/docs/rfbproto.pdf
(C) 2003 cliechti@gmx.net
MIT License
"""
# flake8: noqa
import sys
import math
import zlib
import getpass
import os
from Crypto... | sibson/vncdotool | vncdotool/rfb.py | Python | mit | 35,587 |
"""Solve the Project Euler problems using functional Python.
https://projecteuler.net/archives
"""
from importlib import import_module
from os import listdir
from os.path import abspath, dirname
from re import match
SOLVED = set(
int(m.group(1))
for f in listdir(abspath(dirname(__file__)))
for m in (mat... | 2Cubed/ProjectEuler | euler/__init__.py | Python | mit | 584 |
# coding: utf8
# Greek Numeral Converter
#
# https://en.wikipedia.org/wiki/Greek_numerals
keraia = 'ʹ'
# Multiply by 10000
myriads = 'Μ'
numbers_to_letters = {
1: 'Α',
2: 'Β',
3: 'Γ',
4: 'Δ',
5: 'Ε',
6: 'ΣΤ',
7: 'Ζ',
8: 'Η',
9: 'Θ',
10: 'Ι',
20: 'Κ',
30: 'Λ',
40: '... | pgk/kountanis.com | _code_examples/greek_numerals.py | Python | mit | 1,783 |
# Copyright (c) 2020 Manfred Moitzi
# License: MIT License
from pathlib import Path
from time import perf_counter
import math
from ezdxf.addons import MengerSponge
from ezdxf.addons import r12writer
from ezdxf.render.forms import sphere, circle, translate
DIR = Path("~/Desktop/Outbox").expanduser()
def menger_sponge... | mozman/ezdxf | examples/addons/r12writer.py | Python | mit | 2,030 |
"""Group models."""
from django.conf import settings
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Group as AuthGroup, Permission
from django.core.cache import cache
from django.core.exceptions import ValidationError
from django.core.urlresolvers import reverse
from django.db imp... | lpatmo/actionify_the_news | open_connect/groups/models.py | Python | mit | 12,456 |
import tensorflow as tf
'''
Model for sequence classification and localization with weighted loss
'''
class DeepLocalizationWeightedLossVariableLengthDeeper:
def get_name(self):
return "deep_localization_weighted_loss_variable_length_6"
def input_placeholders(self):
inputs_placeholder = tf.p... | thePetrMarek/SequenceOfDigitsRecognition | sequences_of_variable_length/deep_localization_weighted_loss_variable_length_deeper.py | Python | mit | 7,054 |
"""
basic set of `jut run` tests
"""
import json
import unittest
from tests.util import jut
BAD_PROGRAM = 'foo'
BAD_PROGRAM_ERROR = 'Error line 1, column 1 of main: Error: no such sub: foo'
class JutRunTests(unittest.TestCase):
def test_jut_run_syntatically_incorrect_program_reports_error_with_format_json(s... | jut-io/jut-python-tools | tests/jut_run_tests.py | Python | mit | 3,794 |
#! -*- coding: utf-8 -*-
"""
Web Scraper Project
Scrape data from a regularly updated website livingsocial.com and
save to a database (postgres).
Scrapy spider part - it actually performs scraping.
"""
from scrapy.spider import BaseSpider
from scrapy.selector import HtmlXPathSelector
from scrapy.contrib.loader impo... | enilsen16/python | scrape/living_social/scraper_app/spiders/livingsocial_spider.py | Python | mit | 2,134 |
from bs4 import BeautifulSoup
from models.course import Course
import requests
default_postdata = {
'CAMPUS': '0',
'TERMYEAR': '201709',
'CORE_CODE': 'AR%',
'subj_code': '',
'CRSE_NUMBER': '',
'crn': '',
'open_only': 'on',
'BTN_PRESSED': 'FIND class sections',
}
url = 'https://banweb.b... | amhokies/Timetable-Stalker | course_search.py | Python | mit | 2,048 |
# -*- coding: utf-8 -*-
#
# spikeplot - plot_cluster.py
#
# Philipp Meier <pmeier82 at googlemail dot com>
# 2011-09-29
#
"""scatter plot for clustering data"""
__docformat__ = 'restructuredtext'
__all__ = ['cluster']
##---IMPORTS
from .common import COLOURS, save_figure, check_plotting_handle, mpl, plt
##---FUNC... | pmeier82/SpikePlot | spikeplot/plot_cluster.py | Python | mit | 3,737 |
"""Ask Admin URL."""
from django.conf.urls.defaults import url, patterns
urlpatterns = patterns('',
url(r'^my_question/$',
'apps.widgets.AskedQuestions.views.send_question', name="ask_que_question"),
)
| vijayanandau/KnowledgeShare | makahiki/apps/widgets/AskedQuestions/urls.py | Python | mit | 216 |
try:
from setuptools import setup, find_packages
except ImportError:
from distutils.core import setup
setup(name='antk',
version=0.3,
description='Automated Neural-graph Toolkit: A Tensorflow wrapper for '
'common deep learning tasks and rapid development of innovative'
... | aarontuor/antk | setup.py | Python | mit | 1,606 |
from __future__ import print_function
from __future__ import unicode_literals
import io
import os.path
import pipes
import sys
from pre_commit import output
from pre_commit.util import make_executable
from pre_commit.util import mkdirp
from pre_commit.util import resource_filename
# This is used to identify the hoo... | Lucas-C/pre-commit | pre_commit/commands/install_uninstall.py | Python | mit | 3,549 |
#!/usr/bin/python
#
# Manage JSON database of Micro-BESM opcodes.
#
import sys, json, codecs
# Check parameters.
if len(sys.argv) != 2:
print "Usage:"
print " opcode [option] file.json"
print "Options:"
print " TODO"
sys.exit(1)
opcode = [] # List of all opcodes
#
# Proc... | besm6/micro-besm | doc/opcodes/opcode.py | Python | mit | 1,130 |
from django.contrib import admin
from django.contrib.contenttypes import generic
from models import Attribute, BaseModel
from django.utils.translation import ugettext_lazy as _
class MetaInline(generic.GenericTabularInline):
model = Attribute
extra = 0
class BaseAdmin(admin.ModelAdmin):
"""
def get_re... | Mercy-Nekesa/sokoapp | sokoapp/utils/admin.py | Python | mit | 1,954 |
from __future__ import absolute_import, unicode_literals
from .base import *
DEBUG = False
TEMPLATE_DEBUG = False
COMPRESS_OFFLINE = True
AWS_STORAGE_BUCKET_NAME = get_env_variable("AWS_STORAGE_BUCKET_NAME")
AWS_S3_CUSTOM_DOMAIN = '{}.s3.amazonaws.com'.format(AWS_STORAGE_BUCKET_NAME)
DEFAULT_FILE_STORAGE = 'storag... | OpenCanada/lindinitiative | lindinitiative/settings/production.py | Python | mit | 1,319 |
from syhelpers.log import print_error, print_table_terminal
class ModuleBase:
"""
Base class for all modules (handler, transport, platform, ...)
Allows functions for options
"""
def __init__(self):
"""
Initialize Module, should be overwritten and options should be added
""... | SySS-Research/outis | syhelpers/modulebase.py | Python | mit | 4,301 |
import re
def pythonize_camelcase_name(name):
"""
GetProperty -> get_property
"""
def repl(match):
return '_' + match.group(0).lower()
s = re.sub(r'([A-Z])', repl, name)
if s.startswith('_'):
return s[1:]
else:
return s
| fredreichbier/babbisch-ooc | babbisch_ooc/wraplib/utils.py | Python | mit | 279 |
try:
from hashlib import md5
except ImportError:
from md5 import md5
class ratingMiddleware(object):
def process_request(self, request):
request.rating_token = self.generate_token(request)
def generate_token(self, request):
raise NotImplementedError
class ratingIpMiddleware(ratingMi... | contactr2m/remote_repo | src/rating/middleware.py | Python | mit | 625 |
"""
Graph isomorphism functions.
"""
import networkx as nx
from networkx.exception import NetworkXError
__author__ = """\n""".join(['Aric Hagberg (hagberg@lanl.gov)',
'Pieter Swart (swart@lanl.gov)',
'Christopher Ellison cellison@cse.ucdavis.edu)'])
# Copyright... | sserrot/champion_relationships | venv/Lib/site-packages/networkx/algorithms/isomorphism/isomorph.py | Python | mit | 6,757 |
from django.db import models
from django.contrib.auth.models import User
class Profile(models.Model):
user = models.OneToOneField(User)
description = models.TextField(blank=True, null=True)
| axiome-oss/dive-into-django-i18n | your_project/your_package/models.py | Python | mit | 199 |
from django.contrib import admin
from polls.models import Choice, Poll
class ChoiceInline(admin.TabularInline):
model = Choice
extra = 3
class PollAdmin(admin.ModelAdmin):
fieldsets = [
(None, {'fields': ['question']}),
('Date information', {'fields': ['pub_date'], 'classes... | damiencalloway/djtut | mysite/polls/admin.py | Python | mit | 570 |
# !/usr/bin/env python
# -*- encoding: utf-8 -*-
# vim: set et sw=4 ts=4 sts=4 ff=unix fenc=utf8:
# Author: Vincent<vincent8280@outlook.com>
# http://wax8280.github.io
# Created on 18-2-12 上午2:34
# !/usr/bin/env python
import datetime
import os
import re
import time
from copy import deepcopy
from queue import Q... | wax8280/web2kindle | web2kindle/script/zhihu_daily.py | Python | mit | 9,297 |
#print("OK, imported signal handling")
from registration.signals import user_registered
import os
from django_maps2 import settings
#This callback is listening for user to register. Creates directories for user images.
def postRegistration(sender,user,request, **kwargs):
media_root = settings.USER_MEDIA_ROOT
... | agilman/django_maps2 | maps/signals.py | Python | mit | 601 |