repo_name stringlengths 6 100 | path stringlengths 4 294 | copies stringlengths 1 5 | size stringlengths 4 6 | content stringlengths 606 896k | license stringclasses 15
values |
|---|---|---|---|---|---|
duboviy/pybenchmark | pybenchmark/gprofiler.py | 1 | 3896 | """
Module for visualizing Python code profiles using the Chrome developer tools.
Example usage:
>>> profiler = Profiler()
>>> profiler.start()
>>> my_expensive_code()
>>> profiler.stop()
>>> with open('my.cpuprofile', 'w') as f:
... f.write(profiler.output())
In a gevented environnment, context switches can make t... | mit |
sorenk/ansible | test/sanity/import/importer.py | 29 | 6122 | #!/usr/bin/env python
"""Import the given python module(s) and report error(s) encountered."""
from __future__ import absolute_import, print_function
import contextlib
import imp
import os
import re
import sys
import traceback
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
im... | gpl-3.0 |
teeple/pns_server | work/install/Python-2.7.4/Lib/pyclbr.py | 139 | 13388 | """Parse a Python module and describe its classes and methods.
Parse enough of a Python file to recognize imports and class and
method definitions, and to find out the superclasses of a class.
The interface consists of a single function:
readmodule_ex(module [, path])
where module is the name of a Python modu... | gpl-2.0 |
federicoviola/alpha | wsgi/migrations/versions/42caf438dcdf_.py | 1 | 3965 | """empty message
Revision ID: 42caf438dcdf
Revises: None
Create Date: 2015-05-15 13:14:21.980616
"""
# revision identifiers, used by Alembic.
revision = '42caf438dcdf'
down_revision = None
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adjust! ###... | mit |
christianurich/DynaMind-ToolBox | DynaMind-Performance-Assessment/cd3/data/scripts/cd3.py | 5 | 1608 | import sys
sys.path.append("build/")
sys.path.append("data/scripts")
import pycd3 as cd
class PythonNodeFactory(cd.NodeFactory):
def __init__(self, node_klass):
cd.NodeFactory.__init__(self)
self.klass = node_klass
def createNode(self):
return self.klass()
def getNodeName(self):
return self.klass.__na... | gpl-2.0 |
patricksanders/muse | muse/apis/pyechonest/sandbox.py | 23 | 1849 | #!/usr/bin/env python
# encoding: utf-8
"""
Copyright (c) 2010 The Echo Nest. All rights reserved.
Created by Tyler Williams on 2011-10-21.
The Sandbox module loosely covers http://developer.echonest.com/docs/v4/sandbox.html
Refer to the official api documentation if you are unsure about something.
"""
try:
impor... | bsd-3-clause |
Rajeshkumar90/ansible-modules-extras | web_infrastructure/jboss.py | 48 | 5102 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2013, Jeroen Hoekx <jeroen.hoekx@dsquare.be>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of th... | gpl-3.0 |
thewball/ThewCoin | contrib/pyminer/pyminer.py | 1257 | 6438 | #!/usr/bin/python
#
# Copyright (c) 2011 The Bitcoin developers
# Distributed under the MIT/X11 software license, see the accompanying
# file license.txt or http://www.opensource.org/licenses/mit-license.php.
#
import time
import json
import pprint
import hashlib
import struct
import re
import base64
import httplib
im... | mit |
Agana/MyBlogAgain | django/views/decorators/cache.py | 229 | 3639 | try:
from functools import wraps
except ImportError:
from django.utils.functional import wraps # Python 2.4 fallback.
from django.utils.decorators import decorator_from_middleware_with_args, available_attrs
from django.utils.cache import patch_cache_control, add_never_cache_headers
from django.middleware.cach... | bsd-3-clause |
woggle/mesos-old | frameworks/hadoop-0.20.2/src/contrib/hod/hodlib/ServiceProxy/serviceProxy.py | 182 | 2235 | #Licensed to the Apache Software Foundation (ASF) under one
#or more contributor license agreements. See the NOTICE file
#distributed with this work for additional information
#regarding copyright ownership. The ASF licenses this file
#to you under the Apache License, Version 2.0 (the
#"License"); you may not use thi... | apache-2.0 |
mdaniel/intellij-community | plugins/hg4idea/testData/bin/mercurial/commandserver.py | 93 | 6720 | # commandserver.py - communicate with Mercurial's API over a pipe
#
# Copyright Matt Mackall <mpm@selenic.com>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
from i18n import _
import struct
import sys, os
import dispatch, encod... | apache-2.0 |
jakevdp/seaborn | doc/sphinxext/ipython_directive.py | 37 | 37557 | # -*- coding: utf-8 -*-
"""
Sphinx directive to support embedded IPython code.
This directive allows pasting of entire interactive IPython sessions, prompts
and all, and their code will actually get re-executed at doc build time, with
all prompts renumbered sequentially. It also allows you to input code as a pure
pyth... | bsd-3-clause |
MissCatLady/AlarmEZ | venv/lib/python2.7/site-packages/setuptools/command/build_py.py | 147 | 10457 | import os.path, sys, fnmatch
from distutils.command.build_py import build_py as _build_py
from distutils.util import convert_path
from glob import glob
try:
from distutils.util import Mixin2to3 as _Mixin2to3
# add support for converting doctests that is missing in 3.1 distutils
from distutils import log
... | mit |
maartenq/ansible | test/runner/lib/cloud/cs.py | 4 | 8841 | """CloudStack plugin for integration tests."""
from __future__ import absolute_import, print_function
import json
import os
import re
import time
from lib.cloud import (
CloudProvider,
CloudEnvironment,
)
from lib.util import (
find_executable,
ApplicationError,
display,
SubprocessError,
... | gpl-3.0 |
jkyeung/XlsxWriter | xlsxwriter/test/xmlwriter/test_xmlwriter.py | 1 | 4972 | ###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2016, John McNamara, jmcnamara@cpan.org
#
import unittest
from ...compatibility import StringIO
from ...xmlwriter import XMLwriter
class TestXMLwriter(unittest.TestCase):
"""
Test... | bsd-2-clause |
percyfal/bokeh | examples/plotting/file/css_classes.py | 11 | 1585 | from jinja2 import Template
from bokeh.embed import file_html
from bokeh.layouts import column
from bokeh.models import Div, Paragraph
from bokeh.resources import CDN
from bokeh.util.browser import view
template = Template("""
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>{... | bsd-3-clause |
PeterCP/Genera-Flask | migrations/versions/f90d3b386518_add_columns_to_event_model.py | 1 | 1289 | """Add columns to Event model
Columns added:
location_name
latitude
longitude
price
and max_attendants
Revision ID: f90d3b386518
Revises: 1150136bf0ab
Create Date: 2016-08-08 11:30:45.154593
"""
# revision identifiers, used by Alembic.
revision = 'f90d3b386518'
down_revision = '1150136bf0ab'
fro... | gpl-3.0 |
devonjones/PSRD-Parser | src/psrd/extensions/table/weapon.py | 1 | 2927 | #import pprint
from BeautifulSoup import BeautifulSoup
from psrd.extensions.table.general import add_additional_fields, fix_cost, set_subtype, clear_nbsp
def set_damage(weapon):
damage = {
"see text": ('see text', 'see text'),
"special": ('special', 'special'),
"Special": ('Special', 'Special'),
"1d2": ('&mda... | gpl-3.0 |
jonashaag/django-nonrel-nohistory | django/contrib/gis/tests/test_geoip.py | 290 | 4204 | import os, unittest
from django.db import settings
from django.contrib.gis.geos import GEOSGeometry
from django.contrib.gis.utils import GeoIP, GeoIPException
# Note: Requires use of both the GeoIP country and city datasets.
# The GEOIP_DATA path should be the only setting set (the directory
# should contain links or ... | bsd-3-clause |
welex91/ansible-modules-core | web_infrastructure/django_manage.py | 36 | 11488 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2013, Scott Anderson <scottanderson42@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 o... | gpl-3.0 |
opencloudinfra/orchestrator | venv/Lib/site-packages/django/conf/locale/de/formats.py | 504 | 1100 | # -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'j. F Y'
TIME_FORMAT = 'H:i'
DATET... | gpl-3.0 |
rienafairefr/pynYNAB | docs/conf.py | 2 | 4876 | # -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/stable/config
# -- Path setup ------------------------------------------------------------... | mit |
aaxelb/SHARE | share/transformers/mods.py | 2 | 16357 | import re
import logging
import xmltodict
from share.transform.chain import ChainTransformer, ctx, links as tools
from share.transform.chain.exceptions import InvalidIRI
from share.transform.chain.links import GuessAgentTypeLink
from share.transform.chain.parsers import Parser
from share.transform.chain.utils import ... | apache-2.0 |
INCF/BIDS2ISATab | setup.py | 1 | 2176 | from setuptools import setup
import os
here = os.path.abspath(os.path.dirname(__file__))
setup(
name="BIDS2ISATab",
# Versions should comply with PEP440. For a discussion on single-sourcing
# the version across setup.py and the project code, see
# http://packaging.python.org/en/latest/tutorial.html#... | apache-2.0 |
gfyoung/scipy | benchmarks/benchmarks/special.py | 33 | 1670 | from __future__ import division, absolute_import, print_function
import numpy as np
try:
from scipy.special import ai_zeros, bi_zeros, erf, expn
except ImportError:
pass
try:
# wasn't always in scipy.special, so import separately
from scipy.special import comb
except ImportError:
pass
try:
f... | bsd-3-clause |
Frezzle/xen-api | scripts/import-boxgrinder.py | 25 | 9294 | #!/usr/bin/env python
#
# Copyright (C) Citrix Inc
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DI... | lgpl-2.1 |
ikcalB/linuxcnc-mirror | lib/python/gladevcp/hal_gremlin.py | 5 | 11710 | #!/usr/bin/env python
# vim: sts=4 sw=4 et
# GladeVcp Widgets
#
# Copyright (c) 2010 Pavel Shramov <shramov@mexmat.net>
#
# 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... | lgpl-2.1 |
bowlofstew/Impala | thirdparty/hive-1.1.0-cdh5.7.0-SNAPSHOT/lib/py/hive_metastore/constants.py | 45 | 1159 | #
# Autogenerated by Thrift Compiler (0.9.0)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
# options string: py
#
from thrift.Thrift import TType, TMessageType, TException, TApplicationException
from ttypes import *
DDL_TIME = "transient_lastDdlTime"
HIVE_FILTER_FIELD_OWNER = "hive_filter_fi... | apache-2.0 |
dablak/boto | boto/mashups/interactive.py | 119 | 2737 | # Copyright (C) 2003-2007 Robey Pointer <robey@lag.net>
#
# 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 (at your op... | mit |
lkundrak/scraperwiki | web/api/viewshandlers.py | 1 | 31419 | import urllib
import urllib2
from django.contrib.sites.models import Site
from django.conf import settings
from django.template import RequestContext, loader, Context
from django.http import HttpResponseRedirect, HttpResponse, Http404, HttpResponseNotFound
from django.shortcuts import render_to_response
from django.s... | agpl-3.0 |
pshuff/sparts | tests/tasks/test_poller.py | 5 | 1315 | # Copyright (c) 2014, Facebook, Inc. All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
#
from sparts.tasks.poller import ... | bsd-3-clause |
npardington/fabric-bolt | fabric_bolt/task_runners/channels/consumers.py | 1 | 3109 | import json
import subprocess
from importlib import import_module
import ansiconv
import sys
from channels import Group
from channels.auth import channel_session_user_from_http
from channels.sessions import channel_session
from django.conf import settings
from fabric_bolt.projects.models import Project, Deployment
f... | mit |
marissazhou/django | tests/migrations/test_writer.py | 100 | 24300 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime
import functools
import math
import os
import re
import tokenize
import unittest
import custom_migration_operations.more_operations
import custom_migration_operations.operations
from django import get_version
from django.conf import sett... | bsd-3-clause |
gobstones/PyGobstones | pygobstones/gui/mainWindow.py | 1 | 26321 | # -*- coding: utf-8 -*-
from views.gobstonesMain import *
from PyQt4 import QtGui
from PyQt4 import QtCore
import datetime
from views.qDesigner.interactive import *
sys.path.append('..')
from .fileOption import FileOption
from .preferencesWindow import PreferencesWindow
from .editOption import EditOption
from .boardOp... | gpl-3.0 |
krafczyk/spack | lib/spack/external/_pytest/fixtures.py | 21 | 45468 | from __future__ import absolute_import, division, print_function
import inspect
import sys
import warnings
import py
from py._code.code import FormattedExcinfo
import _pytest
from _pytest import nodes
from _pytest._code.code import TerminalRepr
from _pytest.compat import (
NOTSET, exc_clear, _format_args,
ge... | lgpl-2.1 |
hn8841182/W11 | static/Brython3.1.0-20150301-090019/Lib/xml/sax/saxutils.py | 730 | 11688 | """\
A library of useful helper classes to the SAX classes, for the
convenience of application and driver writers.
"""
import os, urllib.parse, urllib.request
import io
from . import handler
from . import xmlreader
def __dict_replace(s, d):
"""Replace substrings of a string using a dictionary."""
for key, val... | gpl-3.0 |
teodorch85/teir | python/script.py | 1 | 1551 | import webiopi
import datetime
GPIO = webiopi.GPIO
#LIGHT = 17 # GPIO pin using BCM numbering
VALVE1 = 2
VALVE2 = 3
VALVE3 = 7
VALVE4 = 8
VALVE5 = 9
VALVE6 = 10
VALVE7 = 11
VALVE8 = 18
#HOUR_ON = 8 # Turn Light ON at 08:00
#HOUR_OFF = 18 # Turn Light OFF at 18:00
# setup function is automatically called at WebIOP... | mit |
OptiPop/external_chromium_org | tools/telemetry/telemetry/web_perf/metrics/rendering_frame.py | 45 | 3109 | # Copyright 2014 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 collections import defaultdict
from telemetry.timeline import slice as slice_module
from telemetry.timeline import bounds
class MissingData(Exception... | bsd-3-clause |
pichillilorenzo/JavaScript-Completions | helper/can_i_use/can_i_use_command.py | 2 | 10624 | items_found_can_i_use = None
can_i_use_file = None
can_i_use_popup_is_showing = False
can_i_use_list_from_main_menu = False
path_to_can_i_use_data = os.path.join(H_SETTINGS_FOLDER, "can_i_use", "can_i_use_data.json")
path_to_test_can_i_use_data = os.path.join(H_SETTINGS_FOLDER, "can_i_use", "can_i_use_data2.json")
url_... | mit |
cloudera/hue | desktop/core/ext-py/djangosaml2-0.16.11/djangosaml2/tests/auth_response.py | 4 | 5545 | # Copyright (C) 2011-2012 Yaco Sistemas (http://www.yaco.es)
# Copyright (C) 2010 Lorenzo Gil Sanchez <lorenzo.gil.sanchez@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ... | apache-2.0 |
crakensio/django_training | lib/python2.7/site-packages/pip/_vendor/html5lib/filters/optionaltags.py | 1727 | 10500 | from __future__ import absolute_import, division, unicode_literals
from . import _base
class Filter(_base.Filter):
def slider(self):
previous1 = previous2 = None
for token in self.source:
if previous1 is not None:
yield previous2, previous1, token
previous2... | cc0-1.0 |
PaloAltoNetworks-BD/autofocus-client-library | autofocus/config.py | 1 | 1373 | import logging
try:
from .gsrt_config import GSRTConfig
except ImportError:
from gsrt_config import GSRTConfig
def get_logger():
""" To change log level from calling code, use something like
logging.getLogger("autofocus").setLevel(logging.DEBUG)
"""
logger = logging.getLogger("autofocus")... | isc |
cklein/wtforms | tests/fields.py | 1 | 35845 | from __future__ import unicode_literals
import sys
from datetime import date, datetime
from decimal import Decimal, ROUND_UP, ROUND_DOWN
from unittest import TestCase
from wtforms import validators, widgets, meta
from wtforms.fields import *
from wtforms.fields import Label, Field, SelectFieldBase, html5
from wtform... | bsd-3-clause |
pgmillon/ansible | lib/ansible/plugins/cliconf/exos.py | 31 | 9970 | #
# (c) 2017 Red Hat Inc.
#
# 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 d... | gpl-3.0 |
denisenkom/django | tests/generic_views/urls.py | 6 | 12352 | from django.conf.urls import patterns, url
from django.views.decorators.cache import cache_page
from django.views.generic import TemplateView
from . import models
from . import views
urlpatterns = patterns('',
# base
#(r'^about/login-required/$',
# views.DecoratedAboutView()),
# TemplateView
... | bsd-3-clause |
loco-odoo/localizacion_co | doc/_themes/odoodoc/sphinx_monkeypatch.py | 22 | 3300 | # -*- coding: utf-8 -*-
import sphinx.roles
import sphinx.environment
from sphinx.writers.html import HTMLTranslator
from docutils.writers.html4css1 import HTMLTranslator as DocutilsTranslator
def patch():
# navify toctree (oh god)
@monkey(sphinx.environment.BuildEnvironment)
def resolve_toctree(old_resolv... | agpl-3.0 |
xdevelsistemas/taiga-back-community | taiga/base/utils/iterators.py | 2 | 1996 | # -*- coding: utf-8 -*-
# Copyright (C) 2014-2016 Andrey Antukh <niwi@niwi.nz>
# Copyright (C) 2014-2016 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014-2016 David Barragán <bameda@dbarragan.com>
# Copyright (C) 2014-2016 Alejandro Alonso <alejandro.alonso@kaleidos.net>
# Copyright (C) 2014-2016 Anler Hernández ... | agpl-3.0 |
fintler/vbox | src/libs/xpcom18a4/python/vboxxpcom.py | 4 | 1901 | """
Copyright (C) 2008-2012 Oracle Corporation
This file is part of VirtualBox Open Source Edition (OSE), as
available from http://www.virtualbox.org. This file is free software;
you can redistribute it and/or modify it under the terms of the GNU
General Public License (GPL) as published by the Free Software
Foundatio... | gpl-2.0 |
LanderU/ardupilot | mk/PX4/Tools/genmsg/src/genmsg/gentools.py | 214 | 6644 | #! /usr/bin/env python
# Software License Agreement (BSD License)
#
# Copyright (c) 2008, Willow Garage, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source cod... | gpl-3.0 |
HugoMMRabson/fonsa | src/my/oledhat/interface.py | 1 | 12780 | '''
my.oledhat.interface
This library contains the high-level functions for drawing on the MyOled class (the means of publishing
new images onto the NanoHat OLED device).
Key functions:-
prompt_for_keyboard_text display keyboard; let user enter a phrase; return the phrase
choose_from_list ... | gpl-3.0 |
giserh/pysparkling | pysparkling/rdd.py | 1 | 44048 | """
Provides a Python implementation of RDDs.
"""
from __future__ import (division, absolute_import, print_function,
unicode_literals)
import io
import sys
import copy
import pickle
import random
import logging
import functools
import itertools
import subprocess
from collections import defaul... | mit |
robjwells/adventofcode-solutions | 2015/python/2015-07.py | 1 | 3324 | #!/usr/bin/env python3
"""Advent of Code 2015, Day 7: Some Assembly Required"""
class Circuit:
"""A set of wires connected with bitwise logic gates"""
def __init__(self, instructions):
"""Parse instructions into a circuit layout
instructions should be the text from the puzzle input without
... | mit |
Cinntax/home-assistant | tests/components/statistics/test_sensor.py | 3 | 13029 | """The test for the statistics sensor platform."""
import unittest
import statistics
import pytest
from homeassistant.setup import setup_component
from homeassistant.components.statistics.sensor import StatisticsSensor
from homeassistant.const import ATTR_UNIT_OF_MEASUREMENT, TEMP_CELSIUS, STATE_UNKNOWN
from homeassi... | apache-2.0 |
simbs/edx-platform | openedx/core/djangoapps/user_api/accounts/serializers.py | 26 | 11572 | """
Django REST Framework serializers for the User API Accounts sub-application
"""
from rest_framework import serializers
from django.contrib.auth.models import User
from django.conf import settings
from django.core.urlresolvers import reverse
from openedx.core.djangoapps.user_api.accounts import NAME_MIN_LENGTH
from ... | agpl-3.0 |
edmundgentle/schoolscript | SchoolScript/bin/Debug/pythonlib/Lib/filecmp.py | 3 | 9893 | """Utilities for comparing files and directories.
Classes:
dircmp
Functions:
cmp(f1, f2, shallow=True) -> int
cmpfiles(a, b, common) -> ([], [], [])
"""
import os
import stat
from itertools import filterfalse
__all__ = ["cmp", "dircmp", "cmpfiles"]
_cache = {}
BUFSIZE = 8*1024
def... | gpl-2.0 |
charanpald/sandbox | sandbox/predictors/edge/EgoEdgeLabelPredictor.py | 1 | 4133 |
import logging
import gc
from apgl.predictors.AbstractPredictor import AbstractPredictor
from exp.sandbox.predictors.edge.AbstractEdgeLabelPredictor import AbstractEdgeLabelPredictor
from sandbox.util.Util import Util
from sandbox.util.Parameter import Parameter
from apgl.data import *
import numpy
class EgoEdgeL... | gpl-3.0 |
logost/mbed | workspace_tools/host_tests/dev_null_auto.py | 122 | 1754 | """
mbed SDK
Copyright (c) 2011-2013 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 wr... | apache-2.0 |
mhvk/astropy | astropy/coordinates/tests/utils.py | 5 | 1342 | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
from astropy import units as u
from astropy.utils import NumpyRNGContext
from astropy.utils.decorators import deprecated
# TODO: remove this function in v5.0. I think we can have a fairly fast
# deprecation c... | bsd-3-clause |
Zhongqilong/kbengine | kbe/src/lib/python/Lib/test/test_codecmaps_jp.py | 60 | 1880 | #
# test_codecmaps_jp.py
# Codec mapping tests for Japanese encodings
#
from test import support
from test import multibytecodec_support
import unittest
class TestCP932Map(multibytecodec_support.TestBase_Mapping,
unittest.TestCase):
encoding = 'cp932'
mapfileurl = 'http://www.unicode.org/... | lgpl-3.0 |
cgranade/qutip | qutip/qip/algorithms/qft.py | 2 | 4734 | # This file is part of QuTiP: Quantum Toolbox in Python.
#
# Copyright (c) 2011 and later, Paul D. Nation and Robert J. Johansson.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
... | bsd-3-clause |
Lynn-015/NJU_DMRG | dmrg/hgen.py | 1 | 4476 | import numpy as np
from scipy.sparse import kron,identity
from copy import copy,deepcopy
from ops import Z,Zs
from utils import index_map
class HGen(object):
def __init__(self,terms,L,d=2,part='left',fermi=False,sfermi=False,sectors=np.array([0.5,-0.5])):
self.l=1;self.d=d;self.D=self.d
self.H=np.zeros([self.d,s... | mit |
tinfoilboy/Tiger | Tiger/shader_build.py | 1 | 2471 | import json
import os
import textwrap
import re
import sys
BASE_DIR = os.path.dirname(__file__)
# Global defines for the file paths
shaders_path = "shaders/"
shader_builder_class_path = "FileFragments/Shader/ShaderBuilderClass.part"
shader_method_path = "FileFragments/Shader/ShaderMethod.part"
shader_builder_header_... | mit |
c-PRIMED/puq | puq/sweep.py | 1 | 13705 | """
This file is part of PUQ
Copyright (c) 2013 PUQ Authors
See LICENSE file for terms.
"""
from __future__ import absolute_import, division, print_function
import time, os, re, h5py, sys, string
import numpy as np
from puq.testprogram import TestProgram
from numpy import ndarray
from puq.hdf import get_output_names
f... | mit |
dpshelio/sunpy | sunpy/map/sources/iris.py | 2 | 2106 | import numpy as np
from sunpy.map import GenericMap
__all__ = ['SJIMap']
class SJIMap(GenericMap):
"""
A 2D IRIS Slit Jaw Imager Map.
The Interface Region Imaging Spectrograph (IRIS) small explorer spacecraft
provides simultaneous spectra and images of the photosphere, chromosphere,
transition ... | bsd-2-clause |
Smile-SA/odoo_addons | smile_access_control/tests/test_users.py | 1 | 3193 | # -*- coding: utf-8 -*-
# (C) 2011 Smile (<http://www.smile.fr>)
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl).
from odoo.tests.common import TransactionCase
from odoo.exceptions import ValidationError
class TestUsers(TransactionCase):
def setUp(self):
super(TestUsers, self).setUp()
... | agpl-3.0 |
all-of-us/raw-data-repository | rdr_service/lib_fhir/fhirclient_4_0_0/models/contactpoint.py | 1 | 2156 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ContactPoint) on 2019-05-07.
# 2019, SMART Health IT.
from . import element
class ContactPoint(element.Element):
""" Details of a Technology mediated contact point (phone, fax, email,... | bsd-3-clause |
sanjeevtripurari/hue | desktop/core/ext-py/Django-1.6.10/django/middleware/http.py | 225 | 1670 | from django.utils.http import http_date, parse_http_date_safe
class ConditionalGetMiddleware(object):
"""
Handles conditional GET operations. If the response has a ETag or
Last-Modified header, and the request has If-None-Match or
If-Modified-Since, the response is replaced by an HttpNotModified.
... | apache-2.0 |
csrwng/kubernetes | hack/boilerplate/boilerplate.py | 93 | 7447 | #!/usr/bin/env python
# Copyright 2015 The Kubernetes 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
#
# Unless required by appli... | apache-2.0 |
goldeneye-source/ges-python | lib/test/test_cmd_line.py | 72 | 19246 | # Tests invocation of the interpreter with various command line arguments
# Most tests are executed with environment variables ignored
# See test_cmd_line_script.py for testing of script execution
import test.support, unittest
import os
import shutil
import sys
import subprocess
import tempfile
from test.script_helper... | gpl-3.0 |
stefanv/aandete | app/lib/beaker/middleware.py | 3 | 6482 | import warnings
try:
from paste.registry import StackedObjectProxy
beaker_session = StackedObjectProxy(name="Beaker Session")
beaker_cache = StackedObjectProxy(name="Cache Manager")
except:
beaker_cache = None
beaker_session = None
from beaker.cache import CacheManager
from beaker.session import S... | bsd-3-clause |
zooniverse/aggregation | experimental/clusteringAlg/adaptiveDBSCAN.py | 2 | 4734 | #!/usr/bin/env python
__author__ = 'greg'
from sklearn.cluster import DBSCAN
import numpy as np
import math
def dist(c1,c2):
return math.sqrt((c1[0]-c2[0])**2 + (c1[1]-c2[1])**2)
class CannotSplit(Exception):
def __init__(self,value):
self.value = value
def __str__(self):
return ""
samples... | apache-2.0 |
splunk/splunk-app-twitter | twitter2/bin/requests/packages/charade/langthaimodel.py | 206 | 11475 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is Mozilla Communicator client code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Ri... | apache-2.0 |
Cojacfar/Maker | comm/lib/python2.7/site-packages/django/template/loaders/cached.py | 114 | 2619 | """
Wrapper class that takes a list of template loaders as an argument and attempts
to load templates from them in order, caching the result.
"""
import hashlib
from django.template.base import TemplateDoesNotExist
from django.template.loader import BaseLoader, get_template_from_string, find_template_loader, make_orig... | gpl-2.0 |
Guneet-Dhillon/mxnet | example/gluon/data.py | 8 | 5477 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | apache-2.0 |
DarkFenX/Pyfa | eos/db/migrations/upgrade12.py | 4 | 13947 | """
Migration 12
- Converts modules based on March 2016 Module Tiericide
Some modules have been unpublished (and unpublished module attributes are removed
from database), which causes pyfa to crash. We therefore replace these
modules with their new replacements
"""
CONVERSIONS = {
16457: ( # Crosslin... | gpl-3.0 |
maxsocl/django | tests/queries/models.py | 36 | 16195 | """
Various complex queries that have been problematic in the past.
"""
from __future__ import unicode_literals
import threading
from django.db import models
from django.utils import six
from django.utils.encoding import python_2_unicode_compatible
class DumbCategory(models.Model):
pass
class ProxyCategory(Du... | bsd-3-clause |
tbinjiayou/Odoo | addons/procurement/wizard/__init__.py | 374 | 1077 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the... | agpl-3.0 |
jirikuncar/invenio | invenio/legacy/webbasket/webinterface.py | 13 | 76050 | # This file is part of Invenio.
# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2013, 2015 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 o... | gpl-2.0 |
gautam1858/tensorflow | tensorflow/contrib/receptive_field/receptive_field_api.py | 48 | 1204 | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | apache-2.0 |
mhrivnak/pulp | server/pulp/server/db/model/criteria.py | 2 | 13940 | from types import NoneType
import copy
import re
import sys
import pymongo
from pulp.server import exceptions as pulp_exceptions
from pulp.server.db.model.base import Model
class Criteria(Model):
def __init__(self, filters=None, sort=None, limit=None, skip=None, fields=None):
super(Criteria, self).__ini... | gpl-2.0 |
rafaeltomesouza/frontend-class1 | aula2/a13/linkedin/client/.gradle/yarn/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings.py | 1361 | 45045 | # Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
r"""Code to validate and convert settings of the Microsoft build tools.
This file contains code to validate and convert settings of the Microsoft
build tools. Th... | mit |
rruebner/odoo | openerp/osv/orm.py | 126 | 6167 | import simplejson
from lxml import etree
from ..exceptions import except_orm
from ..models import (
MetaModel,
BaseModel,
Model, TransientModel, AbstractModel,
MAGIC_COLUMNS,
LOG_ACCESS_COLUMNS,
)
# extra definitions for backward compatibility
browse_record_list = BaseModel
class browse_record(o... | agpl-3.0 |
kvar/ansible | lib/ansible/modules/web_infrastructure/ansible_tower/tower_settings.py | 38 | 2607 | #!/usr/bin/python
# coding: utf-8 -*-
# (c) 2018, Nikhil Jain <nikjain@redhat.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',
... | gpl-3.0 |
guorendong/iridium-browser-ubuntu | third_party/pywebsocket/src/test/test_handshake.py | 14 | 8420 | #!/usr/bin/env python
#
# Copyright 2012, 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... | bsd-3-clause |
PennartLoettring/Poettrix | rootfs/usr/lib/python3.4/test/test_sysconfig.py | 80 | 16880 | import unittest
import sys
import os
import subprocess
import shutil
from copy import copy
from test.support import (run_unittest, TESTFN, unlink, check_warnings,
captured_stdout, skip_unless_symlink)
import sysconfig
from sysconfig import (get_paths, get_platform, get_config_vars,
... | gpl-2.0 |
alexandrucoman/vbox-nova-driver | nova/virt/xenapi/fake.py | 6 | 38578 | # Copyright (c) 2010 Citrix 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.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | apache-2.0 |
henry-ajere/rad2py | psp2py/modules/statistics.py | 8 | 4368 | #!/usr/bin/env python
# coding: utf8
import math
from integration import f_student_t_distribution, simpson_rule_integrate
def mean(values):
"Calculate the average of the numbers given"
return sum(values) / float(len(values))
def calc_correlation(x_values, y_values):
"Calculate strength of a relatio... | gpl-3.0 |
andrewebdev/tehblog | src/tehblog/templatetags/tehblog_tags.py | 1 | 3510 | # -*- coding: utf-8 -*-
# © Copyright 2009 Andre Engelbrecht. All Rights Reserved.
# This script is licensed under the BSD Open Source Licence
# Please see the text file LICENCE for more information
# If this script is distributed, it must be accompanied by the Licence
import re
from django import template
from djan... | bsd-3-clause |
cancro7/gem5 | src/mem/slicc/ast/MachineAST.py | 27 | 3157 | # Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
# Copyright (c) 2009 The Hewlett-Packard Development Company
# 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 co... | bsd-3-clause |
rhertzog/django | tests/forms_tests/tests/test_media.py | 76 | 23851 | # -*- coding: utf-8 -*-
from django.forms import CharField, Form, Media, MultiWidget, TextInput
from django.template import Context, Template
from django.test import SimpleTestCase, override_settings
from django.utils.encoding import force_text
@override_settings(
STATIC_URL='http://media.example.com/static/',
)
... | bsd-3-clause |
nzmm/granite | pages/admin.py | 1 | 1080 | from django.contrib import admin
from django.contrib.auth.models import User
from reversion.admin import VersionAdmin
from pages.models import (
Template,
Page,
)
from pages.forms import (
TemplateAdminForm,
PageAdminForm
)
@admin.register(Template)
class TemplateAdmin(VersionAdmin):
list_display ... | gpl-3.0 |
JungWinter/HongikFood | app/message.py | 1 | 3222 | from .keyboard import Keyboard
from json import loads, dumps
class Message:
# Message클래스를 생성할 때 기본적인 틀만 구현하고
# 값들은 던져주면 알아서 메시지를 리턴한다
baseKeyboard = {
"type": "buttons",
"buttons": Keyboard.buttons,
}
baseMessage = {
"message": {
"text": "",
},
... | mit |
40423247/2017springcd_hw | plugin/sitemap/sitemap.py | 292 | 8774 | # -*- coding: utf-8 -*-
'''
Sitemap
-------
The sitemap plugin generates plain-text or XML sitemaps.
'''
from __future__ import unicode_literals
import re
import collections
import os.path
from datetime import datetime
from logging import warning, info
from codecs import open
from pytz import timezone
from pelican... | agpl-3.0 |
jamesbeebop/CouchPotatoServer | libs/enzyme/real.py | 180 | 4547 | # -*- coding: utf-8 -*-
# enzyme - Video metadata parser
# Copyright 2011-2012 Antoine Bertin <diaoulael@gmail.com>
# Copyright 2003-2006 Thomas Schueppel <stain@acm.org>
# Copyright 2003-2006 Dirk Meyer <dischi@freevo.org>
#
# This file is part of enzyme.
#
# enzyme is free software; you can redistribute it and/or mod... | gpl-3.0 |
jamesbeebop/CouchPotatoServer | libs/html5lib/serializer/htmlserializer.py | 235 | 12897 | from __future__ import absolute_import, division, unicode_literals
from six import text_type
import gettext
_ = gettext.gettext
try:
from functools import reduce
except ImportError:
pass
from ..constants import voidElements, booleanAttributes, spaceCharacters
from ..constants import rcdataElements, entities,... | gpl-3.0 |
suyashphadtare/vestasi-erp-final | erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py | 31 | 9816 | # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils import add_days, getdate, cint
from frappe import throw, _
from erpnext.utilities.transaction_base import Transacti... | agpl-3.0 |
hospace/ToughRADIUS | toughradius/console/admin/node.py | 5 | 3863 | #!/usr/bin/env python
#coding=utf-8
import sys, os
from bottle import Bottle
from bottle import request
from bottle import response
from bottle import redirect
from bottle import MakoTemplate
from bottle import static_file
from bottle import abort
from beaker.cache import cache_managers
from toughradius.console.libs.p... | agpl-3.0 |
hendrikx-itc/python-minerva | tests/storage/test_outputdescriptor.py | 1 | 1255 | import unittest
from minerva.storage.valuedescriptor import ValueDescriptor
from minerva.storage.outputdescriptor import OutputDescriptor
from minerva.storage import datatype
class TestOutputDescriptor(unittest.TestCase):
def test_constructor(self):
value_descriptor = ValueDescriptor(
'x',
... | gpl-3.0 |
sirchia/CouchPotatoServer | libs/jinja2/_markupsafe/_constants.py | 1535 | 4795 | # -*- coding: utf-8 -*-
"""
markupsafe._constants
~~~~~~~~~~~~~~~~~~~~~
Highlevel implementation of the Markup string.
:copyright: (c) 2010 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
HTML_ENTITIES = {
'AElig': 198,
'Aacute': 193,
'Acirc': 194,
'Agrave': 1... | gpl-3.0 |
slevenhagen/odoomrp-wip-npg | mrp_production_capacity/models/mrp.py | 2 | 4275 | # -*- encoding: utf-8 -*-
##############################################################################
#
# This program 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 Free Software Foundation, either version 3 of the... | agpl-3.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.