repo_name
stringlengths
5
104
path
stringlengths
4
248
content
stringlengths
102
99.9k
liangcun/ConceptsOfSpatialInformation
CoreConceptsPy/GdalPy/examples/events/earthquake/EarthquakeRdfWriter2.py
# -*- coding: utf-8 -*- """ Abstract: Creates RDF for earthquake objects. Gets an Array of Python Earthquake objects and turns them to RDF using RDFlib. The RDF can either be outputted or written to a file. This class does not inherit from RDFWriter! """ __author__ = "Marc Tim Thiemann" __copyright__ = "Copyright ...
tensor-tang/Paddle
python/paddle/fluid/tests/unittests/test_parallel_executor_seresnext_base_cpu.py
# Copyright (c) 2019 PaddlePaddle 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 appli...
forslund/mycroft-core
mycroft/skills/mycroft_skill/event_container.py
from inspect import signature from mycroft.messagebus import Message from mycroft.metrics import Stopwatch, report_timing from mycroft.util.log import LOG from ..skill_data import to_alnum def unmunge_message(message, skill_id): """Restore message keywords by removing the Letterified skill ID. Args: ...
JioCloud/oslo.config
tests/test_cfgfilter.py
# Copyright 2014 Red Hat, 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 agre...
sittingbull/artefact.connectors
artefact/utils/tests/test_consume_parser.py
import unittest import mock from artefact.utils.consume_parser import ConsumeParser, UnconsumedDataException, ConsumeParseException, ConsumeTimeoutException class MultiRuleTestParser(ConsumeParser): rules = [ (r'^(?P<left>[^,]+),', False), (r'^(?P<right>[^,]+)', False) ] class RepeatingRule...
quattor/aquilon
lib/aquilon/worker/commands/show_organization_all.py
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*- # ex: set expandtab softtabstop=4 shiftwidth=4: # # Copyright (C) 2008,2009,2010,2011,2012,2013,2014,2016 Contributor # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obt...
reyoung/Paddle
benchmark/fluid/models/se_resnext.py
# Copyright (c) 2018 PaddlePaddle 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 appli...
onponomarev/ganeti
lib/query.py
# # # Copyright (C) 2010, 2011, 2012, 2013 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: # # 1. Redistributions of source code must retain the above copyright notice, # this list ...
olafhauk/mne-python
mne/conftest.py
# -*- coding: utf-8 -*- # Author: Eric Larson <larson.eric.d@gmail.com> # # License: BSD (3-clause) from distutils.version import LooseVersion import gc import os import os.path as op from pathlib import Path import shutil import sys import warnings import pytest # For some unknown reason, on Travis-xenial there are s...
Nikea/VisTrails
vistrails/core/vistrail/module_function.py
############################################################################### ## ## Copyright (C) 2011-2014, NYU-Poly. ## Copyright (C) 2006-2011, University of Utah. ## All rights reserved. ## Contact: contact@vistrails.org ## ## This file is part of VisTrails. ## ## "Redistribution and use in source and binary for...
illume/numpy3k
numpy/testing/decorators.py
"""Decorators for labeling test objects Decorators that merely return a modified version of the original function object are straightforward. Decorators that return a new function object need to use nose.tools.make_decorator(original_function)(decorator) in returning the decorator, in order to preserve metadata such ...
ucsd-progsys/ml2
paper/oopsla17-cameraready/plots.py
import csv import matplotlib import matplotlib.pyplot as plt import numpy as np UCSD = 'UCSD' BUCKETS = [0.1, 0.2, 1.0, 10.0, 60.0 ] # range(500, 3001, 500) #COLORS=['#90B0D4', '#90D492', '#D4B490', '#D490D2'] COLORS=['#8dd3c7','#bebada','#ffffb3','#fb8072','#80b1d3','#fdb462'] COLORS_E=['#8dd3c7','#bebada','#80b1d3'...
hlzz/dotfiles
graphics/VTK-7.0.0/ThirdParty/Twisted/twisted/python/threadpool.py
# -*- test-case-name: twisted.test.test_threadpool -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. """ twisted.python.threadpool: a pool of threads to which we dispatch tasks. In most cases you can just use C{reactor.callInThread} and friends instead of creating a thread pool direc...
argonemyth/sentry
tests/sentry/api/endpoints/test_project_group_index.py
from __future__ import absolute_import from datetime import timedelta from django.core.urlresolvers import reverse from django.utils import timezone from mock import patch from sentry.models import Group, GroupBookmark, GroupSeen, GroupStatus from sentry.testutils import APITestCase from sentry.testutils.helpers impo...
ajrichards/notebook
visualization/mpl-simple-pick-event.py
""" You can enable picking by setting the "picker" property of an artist (for example, a matplotlib Line2D, Text, Patch, Polygon, AxesImage, etc...) There are a variety of meanings of the picker property None - picking is disabled for this artist (default) boolean - if True then picking will be enabled and...
fritzo/loom
loom/gridding.py
# Copyright (c) 2014, Salesforce.com, Inc. All rights reserved. # Copyright (c) 2015, Google, Inc. # # 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 ...
chrsrds/scikit-learn
sklearn/decomposition/tests/test_online_lda.py
import sys import numpy as np from scipy.linalg import block_diag from scipy.sparse import csr_matrix from scipy.special import psi import pytest from sklearn.decomposition import LatentDirichletAllocation from sklearn.decomposition._online_lda import (_dirichlet_expectation_1d, ...
codeboy/coddy-sitetools
sitetools/coddy_site/procesors.py
# -*- coding: utf-8 -*- from django.core import urlresolvers def custom_processor(request): proc_data = dict() resolver = urlresolvers.get_resolver(None) patterns = sorted( (key, val[0][0][0]) for key, val in resolver.reverse_dict.iteritems() if isinstance(key, basestring)) proc_data['pat'] ...
youtube/cobalt
third_party/llvm-project/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_events/TestWatchpointEvents.py
"""Test that adding, deleting and modifying watchpoints sends the appropriate events.""" from __future__ import print_function import os import time import lldb from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil class TestWatchpointEvents (TestBase): ...
kumar303/addons-server
src/olympia/users/tests/test_commands.py
import json import uuid from django.core.management import call_command from unittest.mock import ANY, patch from six import StringIO from olympia.amo.tests import TestCase from olympia.users.management.commands.createsuperuser import ( Command as CreateSuperUser) from olympia.users.models import UserProfile @...
PaballoDitshego/grassroot-platform
docs/tests/vote_requests.py
__author__ = 'aakilomar' import requests, json, time requests.packages.urllib3.disable_warnings() host = "https://localhost:8443" #from rest_requests import add_user def add_user(phone): post_url = host + "/api/user/add/" + str(phone) return requests.post(post_url,None, verify=False).json() def add_group(use...
vsco/grpc
src/python/grpcio/grpc_core_dependencies.py
# Copyright 2015, 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 f...
laurencium/CausalInference
tests/test_tools.py
from nose.tools import * import numpy as np import causalinference.utils.tools as t def test_convert_to_formatting(): entry_types = ['string', 'float', 'integer', 'float'] ans = ['s', '.3f', '.0f', '.3f'] assert_equal(list(t.convert_to_formatting(entry_types)), ans) def test_add_row(): entries1 = ('Variable...
bailey-ann/diamanda-fork
diamandas/myghtyboard/views.py
#!/usr/bin/python # Diamanda Application Set # myghtyboard forum from django.shortcuts import render_to_response from django.http import HttpResponseRedirect from django.template import RequestContext from django.utils.translation import ugettext as _ from django.views.generic.list_detail import object_list from django...
jamwt/diesel-pmxbot
pmxbot/karma.py
# vim:ts=4:sw=4:noexpandtab from __future__ import print_function, absolute_import import itertools import re import random import pmxbot from . import storage from .core import command class SameName(ValueError): pass class AlreadyLinked(ValueError): pass class Karma(storage.SelectableStorage): @classmethod de...
SuperMarioBean/microblog
app/views.py
from flask import render_template, flash, redirect, session, url_for, request, g from flask.ext.login import login_user, logout_user, current_user, login_required from app import app, db, lm, oid from forms import LoginForm, EditForm, PostForm, SearchForm from models import User, ROLE_USER, ROLE_ADMIN, Post from dateti...
chromium2014/src
chrome/common/extensions/docs/server2/document_renderer_test.py
#!/usr/bin/env python # Copyright 2013 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. import unittest from document_renderer import DocumentRenderer from server_instance import ServerInstance from test_file_system import...
ryfeus/lambda-packs
pytorch/source/caffe2/contrib/tensorboard/tensorboard_exporter_test.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import unittest from caffe2.proto import caffe2_pb2 import caffe2.python.cnn as cnn import caffe2.python.core as core import caffe2.contrib.tensorboard.tensorboard_expor...
kdart/bpython
doc/sphinx/source/conf.py
# -*- coding: utf-8 -*- # # bpython documentation build configuration file, created by # sphinx-quickstart on Mon Jun 8 11:58:16 2009. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All...
atvKumar/open-tamil
transliterate/azhagi.py
## -*- coding: utf-8 -*- # (C) 2013 Muthiah Annamalai # # Implementation of Azhagi rules - தமிழ் எழுத்துக்கள் # Ref: B. Viswanathan, http://www.mazhalaigal.com/tamil/learn/keys.php # class Transliteration: table = {} # not implemented - many-to-one table # Azhagi has a many-to-one mapping - using a Tamil...
Spiderlover/Toontown
toontown/hood/FishAnimatedProp.py
import AnimatedProp from direct.actor import Actor from direct.interval.IntervalGlobal import * from toontown.effects.Splash import * from toontown.effects.Ripples import * import random class FishAnimatedProp(AnimatedProp.AnimatedProp): def __init__(self, node): AnimatedProp.AnimatedProp.__init__(self, n...
MKridler/pyxley
pyxley/charts/mg/mg.py
from ..charts import Chart class MG(Chart): def __init__(self, chart_id, url, params, api_route): opts = { "url": url, "chart_id": chart_id, "params": params } super(MG, self).__init__("MetricsGraphics", opts, api_route) class OptionHelper(object): d...
lillian-gardenia-seabreeze/sappho
tests/test_layers.py
from __future__ import absolute_import import pygame import sappho.layers from .common import compare_surfaces class TestSurfaceLayers(object): """ Do not need to test create_surface_layers(), because it's inherent to SurfaceLayers' initialization and everything else tested. """ NUMBER_OF...
gregarmer/trunserver
trunserv/autoreload.py
# Autoreloading launcher. # Borrowed from Peter Hunt and the CherryPy project (http://www.cherrypy.org). # Some taken from Ian Bicking's Paste (http://pythonpaste.org/). # Adjustments made by Michael Elsdoerfer (michael@elsdoerfer.com). # # Portions copyright (c) 2004, CherryPy Team (team@cherrypy.org) # All rights res...
archifix/settings
sublime/Packages/backrefs/tools/unipropgen.py
""" Generate a Unicode prop table for Python narrow and wide builds. Narrow builds will stop at `0xffff`. """ from __future__ import unicode_literals import sys import struct import unicodedata import codecs import os import re __version__ = '4.2.0' UNIVERSION = unicodedata.unidata_version UNIVERSION_INFO = tuple([i...
safwanrahman/readthedocs.org
readthedocs/projects/migrations/0007_migrate_canonical_data.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals, print_function from __future__ import absolute_import from django.db import migrations from django.db import transaction def migrate_canonical(apps, schema_editor): Project = apps.get_model("projects", "Project") for project in Project.objects....
ylatuya/Flumotion
flumotion/ui/fgtk.py
# -*- Mode: Python; test-case-name: flumotion.test.test_ui_fgtk -*- # vi:si:et:sw=4:sts=4:ts=4 # # Flumotion - a streaming media server # Copyright (C) 2004,2005,2006,2007 Fluendo, S.L. (www.fluendo.com). # All rights reserved. # This file may be distributed and/or modified under the terms of # the GNU General Public ...
vedang/Rope
ropetest/pycoretest.py
import sys import unittest from rope.base import exceptions from rope.base.pycore import _TextChangeDetector from rope.base.pyobjects import get_base_type, AbstractFunction from ropetest import testutils class PyCoreTest(unittest.TestCase): def setUp(self): super(PyCoreTest, self).setUp() self.p...
jpopelka/firewalld
src/tests/python/firewalld_direct.py
#!/usr/bin/python # -*- coding: utf-8 -*- # # Copyright (C) 2012 Red Hat, Inc. # # Authors: # Thomas Woerner <twoerner@redhat.com> # Jiri Popelka <jpopelka@redhat.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 Fr...
sunweaver/ganetimgr
context/pending_notifications.py
# -*- coding: utf-8 -*- vim:fileencoding=utf-8: # Copyright (C) 2010-2014 GRNET S.A. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any ...
maurizioandreotti/D-Rats-0.3.ev
d_rats/wl2k.py
import sys import os import socket import tempfile import subprocess import shutil import email import threading import gobject import struct import time import re sys.path.insert(0, "..") if __name__=="__main__": import gettext gettext.install("D-RATS") from d_rats import version from d_rats import platform...
guduchango/pyafipws
wsbfev1.py
#!/usr/bin/python # -*- coding: latin-1 -*- # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 3, or (at your option) any later # version. # # This program is distributed in t...
Ckrisirkc/Red-DiscordBot
cogs/customcom.py
import discord from discord.ext import commands from .utils.dataIO import fileIO from .utils import checks from __main__ import user_allowed, send_cmd_help import os class CustomCommands: """Custom commands.""" def __init__(self, bot): self.bot = bot self.c_commands = fileIO("data/customcom/co...
hcs/mailman
src/mailman/commands/cli_control.py
# Copyright (C) 2009-2012 by the Free Software Foundation, Inc. # # This file is part of GNU Mailman. # # GNU Mailman 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 you...
non-official-SD/base
src/tools/ceguidemo/menumanager.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """Menu manager. A dictionary of menu instance() functions (see MenuFactory) """ class MenuManager: menus = { } def register(menuName, menuFactory): MenuManager.menus[menuName] = menuFactory register = staticmethod(register) def get(menuName): return Me...
xenoxaos/pithos
pithos/pithosconfig.py
# -*- coding: utf-8; tab-width: 4; indent-tabs-mode: nil; -*- ### BEGIN LICENSE # Copyright (C) 2010-2012 Kevin Mehall <km@kevinmehall.net> #This program is free software: you can redistribute it and/or modify it #under the terms of the GNU General Public License version 3, as published #by the Free Software Foundation...
albertosalmeronunefa/tuconsejocomunal
addons/tcc_communal_council/models/family.py
# -*- coding: utf-8 -*- from datetime import date, datetime from dateutil.relativedelta import relativedelta from odoo import api, fields, models, tools, SUPERUSER_ID, _ from odoo.exceptions import AccessDenied, AccessError, UserError, ValidationError from odoo.tools import DEFAULT_SERVER_DATE_FORMAT as DF from odoo...
qrkourier/ansible
lib/ansible/plugins/action/dellos6.py
# 2016 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 distrib...
angelapper/odoo
addons/account/models/account_bank_statement.py
# -*- coding: utf-8 -*- from openerp import api, fields, models, _ from openerp.osv import expression from openerp.tools import float_is_zero from openerp.tools import float_compare, float_round from openerp.tools.misc import formatLang from openerp.exceptions import UserError, ValidationError import time import math...
Eagles2F/sync-engine
tests/security/test_smtp_ssl.py
import ssl import json import smtpd import asyncore import datetime import pytest import gevent from tests.util.base import default_account from tests.api.base import api_client, new_api_client from tests.api_legacy.base import api_client as api_legacy_client __all__ = ['api_client', 'api_legacy_client', 'default_ac...
arbrandes/edx-platform
openedx/core/djangoapps/bookmarks/views.py
""" HTTP end-points for the Bookmarks API. For more information, see: https://openedx.atlassian.net/wiki/display/TNL/Bookmarks+API """ import logging import eventtracking from django.conf import settings from django.core.exceptions import ObjectDoesNotExist from django.utils.translation import gettext as _ from dja...
philanthropy-u/edx-platform
openedx/core/djangoapps/user_api/validation/views.py
# -*- coding: utf-8 -*- """ An API for client-side validation of (potential) user data. """ from rest_framework.response import Response from rest_framework.views import APIView from rest_framework.throttling import AnonRateThrottle from openedx.core.djangoapps.user_api.accounts.api import ( get_email_validation_...
rspavel/spack
var/spack/repos/builtin/packages/py-requests-toolbelt/package.py
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class PyRequestsToolbelt(PythonPackage): """A toolbelt of useful classes and functions to be use...
tectronics/ambhas
ambhas/gis.py
#! /usr/bin/env python # -*- coding: utf-8 -*- """ Created on Mon Nov 15 19:54:08 2010 @author: sat kumar tomer (http://civil.iisc.ernet.in/~satkumar/) Functions: utm2deg: Calculate utm co-ordinates from Lat, Lon deg2utm : Calculate Lat, Lon from UTM kabini: berambadi: great_circle_distance: ...
apache/cloudstack-ec2stack
tests/utils.py
#!/usr/bin/env python # 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 Licens...
sarvex/tensorflow
tensorflow/compiler/tests/image_ops_test.py
# 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...
crossbario/crossbarexamples
xbr/teststack1/_init/set_xbrmm_key.py
import sys import binascii from init_data import MARKETS xbrmm_key_file = sys.argv[1] #from init_data import ACCOUNTS, _ACCOUNT_KEYS #xbr_marketmaker = 'marketop1-marketmaker1' #addr, pkey = _ACCOUNT_KEYS[ACCOUNTS[xbr_marketmaker]] addr = MARKETS[0]['maker'] pkey = MARKETS[0]['maker_pkey'] print(xbrmm_key_file) w...
stackforge/networking-bagpipe-l2
networking_bagpipe/tests/unit/agent/sfc/test_agent_extension.py
# Copyright (c) 2017 Orange. # 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 a...
chadversary/deqp
scripts/caselist_diff.py
# -*- coding: utf-8 -*- #------------------------------------------------------------------------- # drawElements Quality Program utilities # -------------------------------------- # # Copyright 2015 The Android Open Source Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use t...
Arelle/Arelle
arelle/ViewWinXml.py
''' Created on Feb 6, 2011 @author: Mark V Systems Limited (c) Copyright 2011 Mark V Systems Limited, All rights reserved. ''' from tkinter import * try: from tkinter.ttk import * except ImportError: from ttk import * from arelle.CntlrWinTooltip import ToolTip import io from arelle import (XmlUtil, ViewWinList...
ostree/plaso
plaso/cli/hexdump.py
# -*- coding: utf-8 -*- """Class to represent binary data as hexadecimal.""" class Hexdump(object): """Class that defines a hexadecimal representation formatter (hexdump).""" @classmethod def _FormatDataLine(cls, data, data_offset, data_size): """Formats binary data in a single line of hexadecimal represen...
sparkslabs/kamaelia_
Sketches/MPS/BugReports/FixTests/Kamaelia/Kamaelia/Apps/JsonRPC/BDJsonRPC.py
#!/usr/bin/python # -*- coding: utf-8 -*- # # Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1) # # (1) Kamaelia Contributors are listed in the AUTHORS file and at # http://www.kamaelia.org/AUTHORS - please extend this file, # not this notice. # # Licensed under the Apache License, Ve...
samtstern/FirebaseUI-Android
scripts/translations/fix_typography.py
# coding=UTF-8 import sys from base_string_script import BaseStringScript BAD_ELLIPSIS = "..." GOOD_ELLIPSIS = "…" BAD_ELLIPSIS_SPACING = " …" GOOD_ELLIPSIS_SPACING = "…" BAD_SINGLE_QUOTE = "\\\'%1$s\\\'" BAD_DOUBLE_QUOTE = "\\\"%1$s\\\"" GOOD_DOUBLE_QUOTE = "“%1$s”" class FixTypographyScript(BaseStringScript): ...
lukecwik/incubator-beam
sdks/python/apache_beam/runners/dataflow/internal/apiclient_test.py
# # 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 us...
nkgilley/home-assistant
homeassistant/components/github/sensor.py
"""Support for GitHub.""" from datetime import timedelta import logging import github import voluptuous as vol from homeassistant.components.sensor import PLATFORM_SCHEMA from homeassistant.const import ( ATTR_NAME, CONF_ACCESS_TOKEN, CONF_NAME, CONF_PATH, CONF_URL, ) import homeassistant.helpers....
nigelsmall/py2neo
py2neo/packages/httpstream/watch.py
#!/usr/bin/env python # -*- encoding: utf-8 -*- # Copyright 2011-2014, Nigel Small # # 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 # # Unle...
allegro/django-powerdns-dnssec
powerdns/migrations/0015_auto_20151214_0632.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import django.core.validators import powerdns.models.powerdns class Migration(migrations.Migration): dependencies = [ ('powerdns', '0014_auto_20151124_0505'), ] operations = [ migrat...
albertz/music-player
mac/pyobjc-framework-Cocoa/PyObjCTest/test_nsrange.py
from Foundation import * from PyObjCTools.TestSupport import * try: unicode except NameError: unicode = str try: long except NameError: long = int class TestNSRange (TestCase): def testStructs(self): v = NSRange() self.assertHasAttr(v, 'location') self.assertHasAttr(v, '...
starrify/scrapy
scrapy/settings/default_settings.py
""" This module contains the default values for all settings used by Scrapy. For more information about these settings you can read the settings documentation in docs/topics/settings.rst Scrapy developers, if you add a setting here remember to: * add it in alphabetical order * group similar settings without leaving ...
niklasf/python-prompt-toolkit
examples/auto-suggestion.py
#!/usr/bin/env python """ Simple example of a CLI that demonstrates fish-style auto suggestion. When you type some input, it will match the input against the history. If One entry of the history starts with the given input, then it will show the remaining part as a suggestion. Pressing the right arrow will insert this...
mozilla/popcorn_maker
vendor-local/lib/python/bleach/tests/test_css.py
from functools import partial from nose.tools import eq_ from bleach import clean clean = partial(clean, tags=['p'], attributes=['style']) def test_allowed_css(): tests = ( ('font-family: Arial; color: red; float: left; ' 'background-color: red;', 'color: red;', ['color']), ('border: ...
chrxr/wagtail
wagtail/wagtailforms/models.py
from __future__ import absolute_import, unicode_literals import json import os from django.contrib.contenttypes.models import ContentType from django.core.serializers.json import DjangoJSONEncoder from django.db import models from django.shortcuts import render from django.utils.encoding import python_2_unicode_compa...
sahat/bokeh
examples/app/sampleapp/server.py
from flask import Flask, render_template from os.path import dirname, join, abspath import logging approot = abspath(dirname(dirname(__file__))) app = Flask('sampleapp') app.debug = True import pandas as pd from bokeh.pluginutils import app_document from bokeh.plotting import output_server, session, circle import numpy...
pllim/ginga
ginga/rv/plugins/Pipeline.py
# This is open-source software licensed under a BSD license. # Please see the file LICENSE.txt for details. """ Simple data processing pipeline plugin for Ginga. **Plugin Type: Local** ``Pipeline`` is a local plugin, which means it is associated with a channel. An instance can be opened for each channel. **Usage** ...
andymcguinness/Planet-Lab
backend/src/backend/common/resource.py
"""Common tools for building restful resources.""" import flask import flask_restful import flask_restful.reqparse import functools import sqlalchemy import sqlalchemy.orm as orm import backend import backend.common.auth as auth class RequestParser(flask_restful.reqparse.RequestParser): """RequestParser subcla...
artas360/pythran
pythran/tests/openmp.legacy/omp_parallel_reduction.py
def omp_parallel_reduction(): import math dt = 0.5 rounding_error = 1.E-9 sum = 0 dsum = 0 dt = 1. / 3. result = True product = 1 logic_and = 1 logic_or = 0 bit_and = 1 bit_or = 0 exclusiv_bit_or = 0 known_sum = (1000 * (1000 + 1)) / 2 'omp parallel for sch...
DoubleNegativeVisualEffects/gaffer
python/GafferUI/VectorDataPlugValueWidget.py
########################################################################## # # Copyright (c) 2011-2012, Image Engine Design Inc. All rights reserved. # Copyright (c) 2012, John Haddon. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provi...
dylanh724/tol-node-public
tol2-test/node_modules/erlpack/py/tests/integration/echo_server.py
#!/usr/bin/env python from erlpack import pack, unpack import socket import struct from string import Template PORT = 5001 HOST = '' BACKLOG = 5 file_tmpl = Template(""" from erlpack import Atom, pack, unpack ${testcases} """.strip()) testcase_pack_tmpl = Template(""" def test_pack_${name}(): assert pack(${pyt...
mit-crpg/openmc
openmc/lib/filter.py
from collections.abc import Mapping from ctypes import c_int, c_int32, c_double, c_char_p, POINTER, \ create_string_buffer, c_size_t from weakref import WeakValueDictionary import numpy as np from numpy.ctypeslib import as_array from openmc.exceptions import AllocationError, InvalidIDError from . import _dll from...
QingChenmsft/azure-cli
src/azure-cli-core/azure/cli/core/tests/test_command_registration.py
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
ikasumi/chainer
cupy/cindexer.py
import ctypes import six from cupy import carray from cupy import internal def _make_cindexer(n): class CIndexer(ctypes.Structure): _fields_ = [('size', ctypes.c_int), ('shape', ctypes.c_int * n), ('index', ctypes.c_int * n)] return CIndexer _cindexers = [_m...
arnaudsj/pebl
src/pebl/learner/greedy.py
"""Learner that implements a greedy learning algorithm""" import time from pebl import network, result, evaluator from pebl.util import * from pebl.learner.base import * class GreedyLearnerStatistics: def __init__(self): self.restarts = -1 self.iterations = 0 self.unimproved_iterations = ...
Smart-Torvy/torvy-home-assistant
homeassistant/components/sensor/worldclock.py
""" Support for showing the time in a different time zone. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/sensor.worldclock/ """ import logging import voluptuous as vol from homeassistant.components.sensor import PLATFORM_SCHEMA from homeassistant.cons...
lukw00/spaCy
tests/spans/test_span.py
from __future__ import unicode_literals import pytest @pytest.fixture def doc(EN): return EN('This is a sentence. This is another sentence. And a third.') @pytest.mark.models def test_sent_spans(doc): sents = list(doc.sents) assert sents[0].start == 0 assert sents[0].end == 5 assert len(sents)...
66eli77/kolibri
kolibri/logger/test/test_api.py
""" Tests that ensure the correct items are returned from api calls. Also tests whether the users with permissions can create logs. """ import csv import datetime import uuid from django.core.urlresolvers import reverse from rest_framework import status from rest_framework.test import APITestCase from kolibri.auth.mo...
SUSE/azure-sdk-for-python
azure-mgmt-servermanager/azure/mgmt/servermanager/models/session_parameters.py
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes ...
dominikl/openmicroscopy
examples/Training/python/Groups_Permissions.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (C) 2014 University of Dundee & Open Microscopy Environment. # All Rights Reserved. # Use is subject to license terms supplied in LICENSE.txt # """ FOR TRAINING PURPOSES ONLY! """ from omero.gateway import BlitzGateway from Parse_OMERO_Pr...
eric-stanley/freeciv-android
lib/freeciv/dropbox_civsync.py
import sync import ui import features import functools import save as _save from freeciv.dropbox import get_download_path def _impl_save(name, path): def _do(): data = open(path, 'rb').read() sync.request_with_sid('/sync/upload_save', name=name, ...
geimer/easybuild-easyblocks
easybuild/easyblocks/m/mvapich2.py
## # Copyright 2009-2013 Ghent University # # This file is part of EasyBuild, # originally created by the HPC team of Ghent University (http://ugent.be/hpc/en), # with support of Ghent University (http://ugent.be/hpc), # the Flemish Supercomputer Centre (VSC) (https://vscentrum.be/nl/en), # the Hercules foundation (htt...
henryhallam/peregrine
peregrine/analysis/acquisition.py
#!/usr/bin/env python # Copyright (C) 2012 Swift Navigation Inc. # # This source is subject to the license found in the file 'LICENSE' which must # be be distributed together with this source. All other rights reserved. # # THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, # EITHER EXPRESSED ...
michaelgugino/web_keyer
sqlalchemy/events.py
# sqlalchemy/events.py # Copyright (C) 2005-2013 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 """Core event interfaces.""" from . import event, exc from .pool import Pool fro...
toofar/qutebrowser
tests/unit/utils/test_urlmatch.py
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: # Copyright 2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # # qutebrowser 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 Softwa...
bhupennewalkar1337/erpnext
erpnext/buying/doctype/request_for_quotation/request_for_quotation.py
# -*- coding: utf-8 -*- # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors # For license information, please see license.txt from __future__ import unicode_literals import frappe, json from frappe import _ from frappe.model.mapper import get_mapped_doc from frappe.utils import get_url, random_string,...
DevinZ1993/Code-Cupboard
java/demos/hadoop/gen_data.py
#! /usr/bin/env python # -*- coding: utf-8 -*- import random import os import subprocess if __name__=='__main__': HADOOP_PATH = "/usr/share/hadoop" DICT_PATH = "/usr/share/dict/words" DATA_DIR = os.path.dirname(os.path.realpath(__file__)) OUT_PATH = os.path.join(DATA_DIR, "wordcount.in") vocab = ...
LLNL/spack
var/spack/repos/builtin/packages/py-nistats/package.py
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class PyNistats(PythonPackage): """Modeling and Statistical analysis of fMRI data in Python.""" ...
nuclear-wizard/moose
python/MooseDocs/extensions/floats.py
#* This file is part of the MOOSE framework #* https://www.mooseframework.org #* #* All rights reserved, see COPYRIGHT for full restrictions #* https://github.com/idaholab/moose/blob/master/COPYRIGHT #* #* Licensed under LGPL 2.1, please see LICENSE for details #* https://www.gnu.org/licenses/lgpl-2.1.html import uuid...
reminisce/mxnet
python/mxnet/symbol/numpy_extension/__init__.py
# 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...
silenci/neutron
neutron/tests/unit/plugins/ml2/drivers/mech_sriov/agent/extension_drivers/test_qos_driver.py
# Copyright 2015 Mellanox Technologies, Ltd # # 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 t...
sebrandon1/nova
nova/tests/unit/test_cinder.py
# Copyright 2011 OpenStack Foundation # # 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 l...
jawilson/home-assistant
homeassistant/components/flipr/binary_sensor.py
"""Support for Flipr binary sensors.""" from __future__ import annotations from homeassistant.components.binary_sensor import ( DEVICE_CLASS_PROBLEM, BinarySensorEntity, BinarySensorEntityDescription, ) from . import FliprEntity from .const import DOMAIN BINARY_SENSORS_TYPES: tuple[BinarySensorEntityDesc...