repo_name stringlengths 5 100 | path stringlengths 4 375 | copies stringclasses 991
values | size stringlengths 4 7 | content stringlengths 666 1M | license stringclasses 15
values |
|---|---|---|---|---|---|
szbesting/backup | software/rt-thread/tools/codeblocks.py | 23 | 3674 | import os
import sys
import string
import building
import xml.etree.ElementTree as etree
from xml.etree.ElementTree import SubElement
from utils import _make_path_relative
from utils import xml_indent
fs_encoding = sys.getfilesystemencoding()
def CB_AddHeadFiles(program, elem, project_path):
building.source_ext =... | gpl-2.0 |
ace02000/pyload | module/lib/Getch.py | 43 | 2048 | class Getch:
"""
Gets a single character from standard input. Does not echo to
the screen.
"""
def __init__(self):
try:
self.impl = _GetchWindows()
except ImportError:
try:
self.impl = _GetchMacCarbon()
except(AttributeError, Impo... | gpl-3.0 |
wfxiang08/django178 | tests/view_tests/urls.py | 5 | 2608 | # -*- coding: utf-8 -*-
from os import path
from django.conf.urls import patterns, url, include
from django.utils._os import upath
from . import views
base_dir = path.dirname(path.abspath(upath(__file__)))
media_dir = path.join(base_dir, 'media')
locale_dir = path.join(base_dir, 'locale')
js_info_dict = {
'dom... | bsd-3-clause |
skonto/spark | python/pyspark/tests/test_worker.py | 5 | 7057 | # -*- encoding: 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 |
nex3/pygments | pygments/formatters/latex.py | 59 | 12866 | # -*- coding: utf-8 -*-
"""
pygments.formatters.latex
~~~~~~~~~~~~~~~~~~~~~~~~~
Formatter for LaTeX fancyvrb output.
:copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pygments.formatter import Formatter
from pygments.token import T... | bsd-2-clause |
dagwieers/ansible | lib/ansible/modules/remote_management/manageiq/manageiq_alert_profiles.py | 17 | 11301 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2017 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',
... | gpl-3.0 |
zolegus/neon | tests/test_gradient_batchnorm.py | 10 | 3025 | # ----------------------------------------------------------------------------
# Copyright 2015 Nervana Systems 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.o... | apache-2.0 |
jesusfcr/airflow | airflow/contrib/plugins/metastore_browser/main.py | 62 | 5773 | # -*- coding: utf-8 -*-
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
... | apache-2.0 |
pkruskal/scikit-learn | examples/covariance/plot_sparse_cov.py | 300 | 5078 | """
======================================
Sparse inverse covariance estimation
======================================
Using the GraphLasso estimator to learn a covariance and sparse precision
from a small number of samples.
To estimate a probabilistic model (e.g. a Gaussian model), estimating the
precision matrix, t... | bsd-3-clause |
arush0311/scrapy | tests/test_crawl.py | 5 | 11413 | import json
import socket
import logging
from testfixtures import LogCapture
from twisted.internet import defer
from twisted.trial.unittest import TestCase
from scrapy.http import Request
from scrapy.crawler import CrawlerRunner
from scrapy.utils.python import to_unicode
from tests import mock
from tests.spiders impo... | bsd-3-clause |
Medium/phantomjs-1 | src/qt/qtwebkit/Tools/Scripts/webkitpy/common/net/statusserver_unittest.py | 124 | 2214 | # 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 the ... | bsd-3-clause |
coderb0t/CouchPotatoServer | libs/dateutil/tz.py | 217 | 32988 | """
Copyright (c) 2003-2007 Gustavo Niemeyer <gustavo@niemeyer.net>
This module offers extensions to the standard Python
datetime module.
"""
__license__ = "Simplified BSD"
from six import string_types, PY3
import datetime
import struct
import time
import sys
import os
relativedelta = None
parser = None
rrule = No... | gpl-3.0 |
TheTacoScott/tacozmq | cherrypy/test/test_config.py | 12 | 8010 | """Tests for the CherryPy configuration system."""
import os, sys
localDir = os.path.join(os.getcwd(), os.path.dirname(__file__))
from cherrypy._cpcompat import ntob, StringIO
import unittest
import cherrypy
def setup_server():
class Root:
_cp_config = {'foo': 'this',
'bar': 'tha... | mit |
TallonRain/horsefaxbot | horsefax/bot/modules/collections.py | 1 | 3159 | from typing import cast
from pony.orm import *
from horsefax.telegram.services.command import Command
from ..core import HorseFaxBot, ModuleTools, BaseModule, ChatService
from ..db import db
class Collection(db.Entity):
id = PrimaryKey(int, auto=True)
name = Required(str, unique=True)
added_by = Optiona... | mit |
moreati/django | tests/auth_tests/test_context_processors.py | 269 | 6773 | import datetime
from django.contrib.auth import authenticate
from django.contrib.auth.context_processors import PermLookupDict, PermWrapper
from django.contrib.auth.models import Permission, User
from django.contrib.contenttypes.models import ContentType
from django.db.models import Q
from django.test import SimpleTes... | bsd-3-clause |
henridwyer/scikit-learn | sklearn/datasets/__init__.py | 74 | 3616 | """
The :mod:`sklearn.datasets` module includes utilities to load datasets,
including methods to load and fetch popular reference datasets. It also
features some artificial data generators.
"""
from .base import load_diabetes
from .base import load_digits
from .base import load_files
from .base import load_iris
from .... | bsd-3-clause |
Fireblend/chromium-crosswalk | tools/telemetry/telemetry/core/android_process.py | 8 | 1729 | # Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry.core.backends import adb_commands
from telemetry.core.backends.chrome_inspector import devtools_client_backend
from telemetry.core import web_... | bsd-3-clause |
AndreasMadsen/tensorflow | tensorflow/contrib/ffmpeg/ffmpeg_ops.py | 42 | 4398 | # 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... | apache-2.0 |
antoviaque/edx-platform | lms/djangoapps/gating/tests/test_signals.py | 22 | 1936 | """
Unit tests for gating.signals module
"""
from mock import patch
from opaque_keys.edx.keys import UsageKey
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory
from xmodule.modulestore.django import modulestore
from gating.signals impo... | agpl-3.0 |
ivanhorvath/openshift-tools | ansible/roles/lib_oa_openshift/library/oc_adm_router.py | 15 | 111849 | #!/usr/bin/env python
# pylint: disable=missing-docstring
# flake8: noqa: T001
# ___ ___ _ _ ___ ___ _ _____ ___ ___
# / __| __| \| | __| _ \ /_\_ _| __| \
# | (_ | _|| .` | _|| / / _ \| | | _|| |) |
# \___|___|_|\_|___|_|_\/_/_\_\_|_|___|___/_ _____
# | \ / _ \ | \| |/ _ \_ _| | __| \_ ... | apache-2.0 |
oyiptong/splice | splice/queries/reporting.py | 3 | 4150 | from splice.models import impression_stats_daily
from splice.queries.tile import get_tiles, get_tile_ids_by_group
from sqlalchemy.sql import func
from sqlalchemy.orm import aliased
from sqlalchemy import case
from splice.queries.common import tuple_to_dict
from sqlalchemy.exc import InvalidRequestError
CROSS_DB_COLUMN... | mpl-2.0 |
sfrenza/test-for-bot | venv/Lib/site-packages/pip/req/req_set.py | 338 | 34462 | from __future__ import absolute_import
from collections import defaultdict
from itertools import chain
import logging
import os
from pip._vendor import pkg_resources
from pip._vendor import requests
from pip.compat import expanduser
from pip.download import (is_file_url, is_dir_url, is_vcs_url, url_to_path,
... | mit |
montimaj/ShaktiT_LLVM | llvm/utils/lit/tests/Inputs/test-data/dummy_format.py | 66 | 1203 | import os
try:
import ConfigParser
except ImportError:
import configparser as ConfigParser
import lit.formats
import lit.Test
class DummyFormat(lit.formats.FileBasedTest):
def execute(self, test, lit_config):
# In this dummy format, expect that each test file is actually just a
# .ini form... | gpl-3.0 |
email2liyang/pypoll | mysite/books/models.py | 1 | 1352 | from django.db import models
class BookManager(models.Manager):
def title_count(self,keyword):
return self.filter(title__icontains=keyword).count()
class IvanBookManager(models.Manager):
def get_query_set(self):
return super(IvanBookManager,self).get_query_set().filter(id=1)
# Create your mode... | mit |
noslenfa/tdjangorest | uw/lib/python2.7/site-packages/pip/_vendor/requests/packages/chardet/escprober.py | 2936 | 3187 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is mozilla.org 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 Rights Reserved.
#
# Con... | apache-2.0 |
qedsoftware/commcare-hq | corehq/apps/app_manager/suite_xml/features/careplan.py | 1 | 2076 | from django.utils.translation import ugettext as _
from corehq.apps.app_manager import id_strings
from corehq.apps.app_manager.const import CAREPLAN_GOAL, CAREPLAN_TASK
from corehq.apps.app_manager.suite_xml.contributors import SuiteContributorByModule
from corehq.apps.app_manager.suite_xml.xml_models import Menu, Comm... | bsd-3-clause |
chenxilinsidney/ScrapyNews | NewsSpiderMan/settings.py | 1 | 4072 | # -*- coding: utf-8 -*-
# Scrapy settings for tutorial project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
# http://doc.scrapy.org/en/latest/topics/settings.html
# http://scrapy.readthedocs.org/en/lates... | gpl-3.0 |
vandenheuvel/tribler | Tribler/Core/Modules/restapi/util.py | 1 | 6686 | """
This file contains some utility methods that are used by the API.
"""
import json
import math
from struct import unpack_from
from twisted.web import http
from Tribler.Core.Modules.restapi import VOTE_SUBSCRIBE
from Tribler.Core.simpledefs import NTFY_TORRENTS
from Tribler.community.channel.community import Channel... | lgpl-3.0 |
BT-ojossen/account-invoicing | account_invoice_pricelist/model/account_invoice.py | 20 | 2543 | # -*- encoding: utf-8 -*-
##############################################################################
#
# Account - Pricelist on Invoices for Odoo
# Copyright (C) 2015-Today GRAP (http://www.grap.coop)
# @author Sylvain LE GAL (https://twitter.com/legalsylvain)
#
# This program is free software: you can ... | agpl-3.0 |
pigeonflight/strider-plone | docker/appengine/lib/grizzled/grizzled/os.py | 19 | 11769 | #!/usr/bin/env python
# NOTE: Documentation is intended to be processed by epydoc and contains
# epydoc markup.
"""
Overview
========
The ``grizzled.os`` module contains some operating system-related functions and
classes. It is a conceptual extension of the standard Python ``os`` module.
"""
from __future__ import... | mit |
ch1huizong/dj | educasite/educa/courses/api/views.py | 1 | 1923 | from django.shortcuts import get_object_or_404
from rest_framework import generics
from rest_framework import viewsets
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework.authentication import BasicAuthentication
from rest_framework.permissions import IsAuthenticat... | unlicense |
alfredodeza/pacha | pacha/tests/test_cli.py | 1 | 20760 | import unittest
import sys
import os
import shutil
import getpass
from mock import MockSys
from guachi import ConfigMapper
from pacha import config, host
from pacha.util import YELLOW, ENDS
import pacha
CONFIG_GONE = YELLOW+"""
+---------------------------------------------------... | mit |
brentpayton/fifteen-express-ejs-on-server | selenium/tc_131.py | 1 | 3134 | import sys
from selenium import webdriver
# -----------------------------------------------------------------------------
# TC 131 - Basic log in / log out with pre-existing admin account.
# View user admin page.
# View poem admin page.
# Should check for the presence of a flash message when the login succeeds.
# -----... | unlicense |
eagle0422/eagle-huanyi-linux3.3.0 | scripts/tracing/draw_functrace.py | 14676 | 3560 | #!/usr/bin/python
"""
Copyright 2008 (c) Frederic Weisbecker <fweisbec@gmail.com>
Licensed under the terms of the GNU GPL License version 2
This script parses a trace provided by the function tracer in
kernel/trace/trace_functions.c
The resulted trace is processed into a tree to produce a more human
view of the call ... | gpl-2.0 |
McMustard/pf_items | cgi-bin/pf_items/enumerate.py | 1 | 13675 | #!/usr/bin/env python3.3
# vim: set fileencoding=utf-8
# Pathfinder Item Generator
#
# Copyright 2012-2014, Steven Clark.
#
# This program is free software, and is provided "as is", without warranty of
# any kind, express or implied, to the extent permitted by applicable law.
# See the full license in the file 'LICENS... | mit |
thekingofkings/focusread | libs/werkzeug/utils.py | 18 | 22972 | # -*- coding: utf-8 -*-
"""
werkzeug.utils
~~~~~~~~~~~~~~
This module implements various utilities for WSGI applications. Most of
them are used by the request and response wrappers but especially for
middleware development it makes sense to use them without the wrappers.
:copyright: (c) 2014 ... | mit |
luxnovalabs/enjigo_door | web_interface/django/contrib/localflavor/fr/fr_department.py | 109 | 3687 | # -*- coding: utf-8 -*-
# See the "Code officiel géographique" on the INSEE website <www.insee.fr>.
from __future__ import unicode_literals
DEPARTMENT_CHOICES = (
# Metropolitan departments
('01', '01 - Ain'),
('02', '02 - Aisne'),
('03', '03 - Allier'),
('04', '04 - Alpes-de-Haute-Provence'),
... | unlicense |
pombredanne/grr | lib/output_plugins/csv_plugin_test.py | 6 | 6789 | #!/usr/bin/env python
# -*- mode: python; encoding: utf-8 -*-
"""Tests for CSV output plugin."""
import csv
import StringIO
from grr.lib import flags
from grr.lib import rdfvalue
from grr.lib import test_lib
from grr.lib.output_plugins import csv_plugin
from grr.lib.rdfvalues import client as rdf_client
from grr.lib... | apache-2.0 |
KamilWo/bestja | addons/bestja_project_hierarchy/wizards.py | 1 | 2258 | # -*- coding: utf-8 -*-
from openerp import models, fields, api
class InvitationWizard(models.TransientModel):
_name = 'bestja.project.invitation_wizard'
def _available_organizations(self):
project_id = self.env.context.get('active_id')
domain = []
if project_id:
project =... | agpl-3.0 |
charukiewicz/beer-manager | venv/lib/python3.4/site-packages/jinja2/testsuite/utils.py | 415 | 2235 | # -*- coding: utf-8 -*-
"""
jinja2.testsuite.utils
~~~~~~~~~~~~~~~~~~~~~~
Tests utilities jinja uses.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
import gc
import unittest
import pickle
from jinja2.testsuite import JinjaTestCase
from jinja2.utils imp... | mit |
Muktesh01/flexx | flexx/react/pyscript.py | 21 | 10446 | """
Implementation of flexx.react in JS via PyScript.
"""
import json
from ..pyscript import py2js, evaljs, evalpy
from ..pyscript.parser2 import get_class_definition
from .signals import Signal, SourceSignal
class HasSignalsJS:
""" An implementation of the HasSignals class in PyScript. It has
some boilerp... | bsd-2-clause |
YihaoLu/statsmodels | statsmodels/nonparametric/smoothers_lowess_old.py | 31 | 10412 | """
Univariate lowess function, like in R.
References
----------
Hastie, Tibshirani, Friedman. (2009) The Elements of Statistical Learning: Data Mining, Inference, and Prediction, Second Edition: Chapter 6.
Cleveland, W.S. (1979) "Robust Locally Weighted Regression and Smoothing Scatterplots". Journal of the American... | bsd-3-clause |
sradl1981/LIGGGHTS-PUBLIC-ParScale | python/examples/viz_pymol.py | 25 | 1874 | #!/usr/bin/env python -i
# preceeding line should have path for Python on your machine
# viz_pymol.py
# Purpose: viz running LAMMPS simulation via PyMol
# Syntax: viz_pymol.py in.lammps Nfreq Nsteps
# in.lammps = LAMMPS input script
# Nfreq = dump and viz shapshot every this many steps
# Ns... | gpl-2.0 |
jbueler/dotfiles | .vim/bundle/sparkup/ftplugin/html/sparkup.py | 13 | 34827 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
version = "0.1.3"
import os
import fileinput
import getopt
import sys
import re
# ===============================================================================
class Dialect:
shortcuts = {}
synonyms = {}
required = {}
short_tags = ()
class HtmlDialect... | mit |
BranchMetrics/Titanium-Deferred-Deep-Linking-SDK | tests/plugins/ti.alloy/plugin.py | 1729 | 5251 | import os, sys, subprocess, hashlib
import subprocess
def check_output(*popenargs, **kwargs):
r"""Run command with arguments and return its output as a byte string.
Backported from Python 2.7 as it's implemented as pure python on stdlib.
>>> check_output(['/usr/bin/python', '--version'])
Python 2.6.... | mit |
psrthegreat/heroku-buildpack-python-sklearn | vendor/pip-1.3.1/pip/locations.py | 63 | 3814 | """Locations where we look for configs, install stuff, etc"""
import sys
import site
import os
import tempfile
import getpass
from pip.backwardcompat import get_python_lib
import pip.exceptions
default_cert_path = os.path.join(os.path.dirname(__file__), 'cacert.pem')
def running_under_virtualenv():
"""
Retur... | mit |
eayunstack/neutron | neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/openflow/ovs_ofctl/test_br_tun.py | 1 | 13812 | # Copyright (C) 2014,2015 VA Linux Systems Japan K.K.
# Copyright (C) 2014,2015 YAMAMOTO Takashi <yamamoto at valinux co jp>
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of t... | apache-2.0 |
mhnatiuk/phd_sociology_of_religion | scrapper/build/cryptography/src/cryptography/hazmat/bindings/openssl/ssl.py | 2 | 22760 | # This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function
INCLUDES = """
#include <openssl/ssl.h>
typedef STACK_OF(SSL_CIPHER) Cry... | gpl-2.0 |
TalShafir/ansible | lib/ansible/modules/notification/snow_record.py | 32 | 10243 | #!/usr/bin/python
# Copyright (c) 2017 Tim Rightnour <thegarbledone@gmail.com>
# 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',
'sta... | gpl-3.0 |
fibbo/DIRAC | DataManagementSystem/Agent/RequestOperations/RegisterReplica.py | 2 | 5019 | """ :mod: RegisterReplica
==================
.. module: RegisterReplica
:synopsis: register replica handler
RegisterReplica operation handler
"""
__RCSID__ = "$Id $"
from DIRAC import S_OK, S_ERROR
from DIRAC.FrameworkSystem.Client.MonitoringClient import gMonitor
from DIRAC.DataManagementSystem.Age... | gpl-3.0 |
CGATOxford/Optic | Optic/WrapperSlr.py | 1 | 20931 | ##########################################################################
#
# MRC FGU Computational Genomics Group
#
# $Id$
#
# Copyright (C) 2009 Andreas Heger
#
# 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 ... | mit |
pohno/hurricane | Processing/material.py | 2 | 1435 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jul 13 12:06:48 2018
@author: geiger
"""
from optics_calcs.refrIndexData import RefrIndexData
import numpy as np
import matplotlib.pyplot as plt
import scipy.interpolate
class Material:
def __init__(self,name):
#get wavelength and re... | mit |
totallybradical/temp_servo2 | tests/wpt/css-tests/tools/py/py/_path/local.py | 171 | 32118 | """
local path implementation.
"""
from __future__ import with_statement
from contextlib import contextmanager
import sys, os, re, atexit, io
import py
from py._path import common
from py._path.common import iswin32
from stat import S_ISLNK, S_ISDIR, S_ISREG
from os.path import abspath, normpath, isabs, exists, isdir... | mpl-2.0 |
biddyweb/merchant | billing/tests/test_braintree_payments.py | 3 | 8537 | import braintree
from django.conf import settings
from django.test import TestCase
from django.utils.unittest import skipIf
from billing import get_gateway, CreditCard
from billing.signals import *
from billing.gateway import CardNotSupported, InvalidData
from billing.utils.credit_card import Visa
@skipIf(not setti... | bsd-3-clause |
portalmod/mod-host | tests/errors_test.py | 2 | 3211 | #!/usr/bin/env python
import socket, time
import subprocess as sp
# get mod-host pid
pid = sp.check_output("pgrep mod-host; exit 0", shell=True)
if pid == '':
print 'mod-host is not running'
exit(0)
# setup socket
s = socket.socket()
s.connect(('localhost', 5555))
s.settimeout(0.1)
def send_command(command... | gpl-3.0 |
dayutianfei/impala-Q | thirdparty/gtest-1.6.0/test/gtest_xml_output_unittest.py | 397 | 11279 | #!/usr/bin/env python
#
# Copyright 2006, 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... | apache-2.0 |
pjdelport/django | django/contrib/gis/gdal/geometries.py | 7 | 25901 | """
The OGRGeometry is a wrapper for using the OGR Geometry class
(see http://www.gdal.org/ogr/classOGRGeometry.html). OGRGeometry
may be instantiated when reading geometries from OGR Data Sources
(e.g. SHP files), or when given OGC WKT (a string).
While the 'full' API is not present yet, the API is "pythonic" u... | bsd-3-clause |
TomAugspurger/pandas | pandas/tests/indexes/multi/test_analytics.py | 1 | 6771 | import numpy as np
import pytest
from pandas.compat.numpy import _np_version_under1p17
import pandas as pd
from pandas import Index, MultiIndex, date_range, period_range
import pandas._testing as tm
def test_shift(idx):
# GH8083 test the base class for shift
msg = "Not supported for type MultiIndex"
wi... | bsd-3-clause |
nkgilley/home-assistant | tests/components/mqtt/test_camera.py | 5 | 7528 | """The tests for mqtt camera component."""
import json
import pytest
from homeassistant.components import camera, mqtt
from homeassistant.components.mqtt.discovery import async_start
from homeassistant.setup import async_setup_component
from .test_common import (
help_test_availability_when_connection_lost,
... | apache-2.0 |
sbuss/voteswap | lib/networkx/utils/tests/test_rcm.py | 32 | 1305 | from nose.tools import *
from networkx.utils import reverse_cuthill_mckee_ordering
import networkx as nx
def test_reverse_cuthill_mckee():
# example graph from
# http://www.boost.org/doc/libs/1_37_0/libs/graph/example/cuthill_mckee_ordering.cpp
G = nx.Graph([(0, 3), (0, 5), (1, 2), (1, 4), (1, 6), (1, 9),... | mit |
keisuke-umezawa/chainer | tests/chainermn_tests/functions_tests/test_point_to_point_communication.py | 2 | 8160 | import copy
import functools
import chainer
import chainer.testing
import chainer.testing.attr
import numpy
import pytest
import chainermn
from chainer.functions import sigmoid
from chainer.functions import mean_squared_error as mse
class Param(object):
def __init__(self, param):
self.dtype = None
... | mit |
plotly/python-api | packages/python/plotly/plotly/graph_objs/layout/scene/yaxis/_tickfont.py | 2 | 8468 | from plotly.basedatatypes import BaseLayoutHierarchyType as _BaseLayoutHierarchyType
import copy as _copy
class Tickfont(_BaseLayoutHierarchyType):
# class properties
# --------------------
_parent_path_str = "layout.scene.yaxis"
_path_str = "layout.scene.yaxis.tickfont"
_valid_props = {"color", ... | mit |
schleichdi2/openpli-e2 | po/xml2po.py | 27 | 1599 | #!/usr/bin/python
import sys
import os
import string
import re
from xml.sax import make_parser
from xml.sax.handler import ContentHandler, property_lexical_handler
try:
from _xmlplus.sax.saxlib import LexicalHandler
no_comments = False
except ImportError:
class LexicalHandler:
pass
no_comments = True
class parse... | gpl-2.0 |
halberom/ansible | lib/ansible/modules/system/cronvar.py | 25 | 14300 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# 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 |
iwelland/hop | ez_setup.py | 202 | 10285 | #!python
"""Bootstrap setuptools installation
If you want to use setuptools in your package's setup.py, just include this
file in the same directory with it, and add this to the top of your setup.py::
from ez_setup import use_setuptools
use_setuptools()
If you want to require a specific version of setuptools... | lgpl-3.0 |
BT-astauder/odoo | addons/l10n_ro/res_partner.py | 309 | 2255 | # -*- encoding: utf-8 -*-
##############################################################################
#
# @author - Fekete Mihai <feketemihai@gmail.com>
# Copyright (C) 2011 TOTAL PC SYSTEMS (http://www.www.erpsystems.ro).
# Copyright (C) 2009 (<http://www.filsystem.ro>)
#
# This program is free softwa... | agpl-3.0 |
hoangt/gem5v | ext/ply/example/BASIC/basic.py | 166 | 1533 | # An implementation of Dartmouth BASIC (1964)
#
import sys
sys.path.insert(0,"../..")
if sys.version_info[0] >= 3:
raw_input = input
import basiclex
import basparse
import basinterp
# If a filename has been specified, we try to run it.
# If a runtime error occurs, we bail out and enter
# interactive mode below
... | bsd-3-clause |
pratapvardhan/scikit-image | skimage/measure/tests/test_find_contours.py | 38 | 1826 | import numpy as np
from numpy.testing import (assert_raises,
assert_array_equal,
)
from skimage.measure import find_contours
a = np.ones((8, 8), dtype=np.float32)
a[1:-1, 1] = 0
a[1, 1:-1] = 0
x, y = np.mgrid[-1:1:5j, -1:1:5j]
r = np.sqrt(x**2 + y**2)
def test_... | bsd-3-clause |
DevinDewitt/pyqt5 | examples/animation/stickman/stickman.py | 2 | 19645 | #!/usr/bin/env python
#############################################################################
##
## Copyright (C) 2013 Riverbank Computing Limited.
## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
## All rights reserved.
##
## This file is part of the examples of PyQt.
##
## $QT_BEGIN_LICENS... | gpl-3.0 |
dpetzold/dakku | dakku/tests/fields.py | 1 | 2696 | import unittest
from django.conf import settings
from django.core.management import call_command
from django.db.models import loading
from django.db import models
from dakku.fields import RandomCharField
class RandomCharTestModel(models.Model):
chars = RandomCharField(length=12)
class RandomCharTestModelAlpha(mo... | bsd-3-clause |
yatinkumbhare/openstack-nova | nova/safe_utils.py | 23 | 2343 | # Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 Justin Santa Barbara
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance wi... | apache-2.0 |
mjbrewer/testindex | magnum/common/pythonk8sclient/swagger_client/models/v1_iscsi_volume_source.py | 5 | 5322 | # coding: utf-8
"""
Copyright 2015 SmartBear Software
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applica... | apache-2.0 |
TathagataChakraborti/resource-conflicts | PLANROB-2015/seq-sat-lama/Python-2.5.2/Lib/test/test_threadedtempfile.py | 19 | 2416 | """
Create and delete FILES_PER_THREAD temp files (via tempfile.TemporaryFile)
in each of NUM_THREADS threads, recording the number of successes and
failures. A failure is a bug in tempfile, and may be due to:
+ Trying to create more than one tempfile with the same name.
+ Trying to delete a tempfile that doesn't sti... | mit |
geodynamics/gale | boost/libs/python/pyste/src/Pyste/infos.py | 54 | 8953 | # Copyright Bruno da Silva de Oliveira 2003. Use, modification and
# distribution is subject to 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 os.path
import copy
import exporters
from ClassExporter import ClassExporter
fro... | gpl-2.0 |
Glyfina-Fernando/pymtl | accel/dotprod/DotProductRTL.py | 7 | 12025 | #=========================================================================
# DotProductRTL
#=========================================================================
from pymtl import *
from pclib.ifcs import InValRdyBundle, OutValRdyBundle
from pclib.ifcs import ParentReqRespBundle, ChildReqRespBundle
nmul_st... | bsd-3-clause |
lz1988/django-web | build/lib/django/conf/urls/__init__.py | 116 | 2538 | from django.core.urlresolvers import (RegexURLPattern,
RegexURLResolver, LocaleRegexURLResolver)
from django.core.exceptions import ImproperlyConfigured
from django.utils.importlib import import_module
from django.utils import six
__all__ = ['handler403', 'handler404', 'handler500', 'include', 'patterns', 'url']
... | apache-2.0 |
ComputerNetworks-UFRGS/Aurora | cloud/models/metric.py | 1 | 1270 | import logging
from django.db import models
from cloud.models.base_model import BaseModel
RETURN_DATA_TYPE = (
(u'counter', u'Counter'),
(u'number', u'Number'),
(u'text', u'Text'),
(u'object', u'Object'),
)
METRIC_STATES = (
(u'enabled', u'Enabled'),
(u'disabled', u'Disa... | gpl-2.0 |
mitsuhiko/sentry | src/sentry/south_migrations/0190_auto__add_field_release_new_groups.py | 32 | 39030 | # -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Release.new_groups'
db.add_column('sentry_release', 'new_... | bsd-3-clause |
laenderoliveira/exerclivropy | exercicios_resolvidos/capitulo 05/exercicio-05-23.py | 1 | 1199 | ##############################################################################
# Parte do livro Introdução à Programação com Python
# Autor: Nilo Ney Coutinho Menezes
# Editora Novatec (c) 2010-2014
# Primeira edição - Novembro/2010 - ISBN 978-85-7522-250-8
# Primeira reimpressão - Outubro/2011
# Segunda reimpressão - ... | mit |
itsvetkov/pyqtgraph | examples/SpinBox.py | 7 | 4046 | # -*- coding: utf-8 -*-
"""
This example demonstrates the SpinBox widget, which is an extension of
QDoubleSpinBox providing some advanced features:
* SI-prefixed units
* Non-linear stepping modes
* Bounded/unbounded values
"""
import initExample ## Add path to library (just for examples; you do not need this)
... | mit |
ariel17/poppurri | poppurri/mixture/migrations/0016_auto__del_category__del_field_mixture_expose__add_field_mixture_is_pub.py | 1 | 8510 | # -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting model 'Category'
db.delete_table(u'mixture_category')
... | mit |
robocomp/robocomp | tools/robocompdsl/test/resources/reference_components/test_subStatesTestPython/src/testcomp.py | 7 | 2559 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2021 by YOUR NAME HERE
#
# This file is part of RoboComp
#
# RoboComp 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 ver... | gpl-3.0 |
nimbis/django-filer | filer/migrations/0004_auto__del_field_file__file__add_field_file_file__add_field_file_is_pub.py | 69 | 11108 | # encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Rename field 'file._file'
db.rename_column('filer_file', '_file', 'file')
# Adding field 'File.... | bsd-3-clause |
TGITS/programming-workouts | exercism/python/armstrong-numbers/armstrong_numbers_test.py | 4 | 1327 | import unittest
from armstrong_numbers import is_armstrong_number
# Tests adapted from `problem-specifications//canonical-data.json` @ v1.1.0
class ArmstrongNumbersTest(unittest.TestCase):
def test_zero_is_an_armstrong_number(self):
self.assertIs(is_armstrong_number(0), True)
def test_single_digit_... | mit |
mythmon/airmozilla | mysql2postgres/py-mysql2pgsql-0.1.5/mysql2pgsql/lib/postgres_db_writer.py | 16 | 7142 | from __future__ import with_statement, absolute_import
import time
from contextlib import closing
import psycopg2
from . import print_row_progress, status_logger
from .postgres_writer import PostgresWriter
class PostgresDbWriter(PostgresWriter):
"""Class used to stream DDL and/or data
from a MySQL server t... | bsd-3-clause |
playfulgod/kernel_samsung_klte | Documentation/networking/cxacru-cf.py | 14668 | 1626 | #!/usr/bin/env python
# Copyright 2009 Simon Arlott
#
# 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.
#
# This program i... | gpl-2.0 |
tedder/ansible | lib/ansible/modules/network/nxos/nxos_igmp_snooping.py | 41 | 8914 | #!/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 |
vipulkanade/EventbriteDjango | lib/python2.7/site-packages/django/contrib/gis/gdal/base.py | 654 | 1179 | from ctypes import c_void_p
from django.contrib.gis.gdal.error import GDALException
from django.utils import six
class GDALBase(object):
"""
Base object for GDAL objects that has a pointer access property
that controls access to the underlying C pointer.
"""
# Initially the pointer is NULL.
_... | mit |
leopittelli/Django-on-App-Engine-Example | django/contrib/auth/tests/test_handlers.py | 111 | 3005 | from __future__ import unicode_literals
from django.contrib.auth.handlers.modwsgi import check_password, groups_for_user
from django.contrib.auth.models import User, Group
from django.contrib.auth.tests.custom_user import CustomUser
from django.contrib.auth.tests.utils import skipIfCustomUser
from django.test import T... | mit |
majorcs/fail2ban | fail2ban/tests/databasetestcase.py | 8 | 11756 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: t -*-
# vi: set ft=python sts=4 ts=4 sw=4 noet :
# This file is part of Fail2Ban.
#
# Fail2Ban 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;... | gpl-2.0 |
John-Chan/protobuf-rpc-test | protobuf-rpc-test/protobuf/protobuf-2.6.0/python/google/protobuf/internal/text_encoding_test.py | 27 | 2845 | #! /usr/bin/python
#
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# http://code.google.com/p/protobuf/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# ... | apache-2.0 |
ZuluPro/namebench | namebench.py | 171 | 2390 | #!/usr/bin/env python
# Copyright 2009 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required... | apache-2.0 |
azurestandard/django | django/utils/tree.py | 103 | 5755 | """
A class for storing a tree graph. Primarily used for filter constructs in the
ORM.
"""
import copy
class Node(object):
"""
A single internal node in the tree graph. A Node should be viewed as a
connection (the root) with the children being either leaf nodes or other
Node instances.
"""
# S... | bsd-3-clause |
HerlanAssis/Django-AulaOsvandoSantana | lib/python2.7/site-packages/django/contrib/gis/utils/layermapping.py | 61 | 27288 | # LayerMapping -- A Django Model/OGR Layer Mapping Utility
"""
The LayerMapping class provides a way to map the contents of OGR
vector files (e.g. SHP files) to Geographic-enabled Django models.
For more information, please consult the GeoDjango documentation:
https://docs.djangoproject.com/en/dev/ref/contrib/gi... | mit |
ykaneko/neutron | neutron/openstack/common/notifier/rabbit_notifier.py | 23 | 1090 | # Copyright 2012 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | apache-2.0 |
turbomanage/training-data-analyst | courses/machine_learning/deepdive2/structured/solutions/serving/application/lib/jinja2/runtime.py | 9 | 27644 | # -*- coding: utf-8 -*-
"""
jinja2.runtime
~~~~~~~~~~~~~~
Runtime helpers.
:copyright: (c) 2017 by the Jinja Team.
:license: BSD.
"""
import sys
from itertools import chain
from types import MethodType
from jinja2.nodes import EvalContext, _context_function_types
from jinja2.utils import Markup,... | apache-2.0 |
TalShafir/ansible | lib/ansible/modules/utilities/logic/async_wrapper.py | 19 | 10223 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>, and others
# 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 json
import shlex
impo... | gpl-3.0 |
palaniyappanBala/rekall | rekall-core/rekall/entities/component.py | 4 | 9760 | # Rekall Memory Forensics
#
# Copyright 2014 Google Inc. All Rights Reserved.
#
# 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 v... | gpl-2.0 |
beiko-lab/gengis | bin/Lib/site-packages/scipy/optimize/tests/test_minpack.py | 1 | 15132 | """
Unit tests for optimization routines from minpack.py.
"""
from __future__ import division, print_function, absolute_import
from numpy.testing import assert_, assert_almost_equal, assert_array_equal, \
assert_array_almost_equal, TestCase, run_module_suite, assert_raises, \
assert_allclose
im... | gpl-3.0 |
0k/odoo | addons/crm/report/crm_lead_report.py | 309 | 5123 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | agpl-3.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.