repo_name stringlengths 5 100 | ref stringlengths 12 67 | path stringlengths 4 244 | copies stringlengths 1 8 | content stringlengths 0 1.05M ⌀ |
|---|---|---|---|---|
2013Commons/hue | refs/heads/master | desktop/core/ext-py/MySQL-python-1.2.3c1/MySQLdb/constants/ER.py | 118 | """MySQL ER Constants
These constants are error codes for the bulk of the error conditions
that may occur.
"""
HASHCHK = 1000
NISAMCHK = 1001
NO = 1002
YES = 1003
CANT_CREATE_FILE = 1004
CANT_CREATE_TABLE = 1005
CANT_CREATE_DB = 1006
DB_CREATE_EXISTS = 1007
DB_DROP_EXISTS = 1008
DB_DROP_DELETE = 1009
DB_DROP_RMDIR =... |
double12gzh/nova | refs/heads/master | nova/db/__init__.py | 123 | # Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# 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 ... |
klenks/jobsportal | refs/heads/master | venv/lib/python2.7/site-packages/django/contrib/admin/views/decorators.py | 638 | from django.contrib.auth import REDIRECT_FIELD_NAME
from django.contrib.auth.decorators import user_passes_test
def staff_member_required(view_func=None, redirect_field_name=REDIRECT_FIELD_NAME,
login_url='admin:login'):
"""
Decorator for views that checks that the user is logged in ... |
kdwink/intellij-community | refs/heads/master | python/lib/Lib/xml/etree/ElementTree.py | 79 | #
# ElementTree
# $Id: ElementTree.py 2326 2005-03-17 07:45:21Z fredrik $
#
# light-weight XML support for Python 1.5.2 and later.
#
# history:
# 2001-10-20 fl created (from various sources)
# 2001-11-01 fl return root from parse method
# 2002-02-16 fl sort attributes in lexical order
# 2002-04-06 fl TreeBuilde... |
markovianlabs/pychain | refs/heads/master | setup.py | 1 | from distutils.core import setup
setup(
name = 'pychain',
packages = ['pychain'], # this must be the same as the name above
version = '0.0.1',
description = 'Markov Chain Monte Carlo (MCMC) method using Metropolis-Hastings algorithm.',
author = 'Irshad Mohammed, Janu Verma',
author_email = 'creativeishu@gma... |
ocadotechnology/django-tastypie | refs/heads/master | tests/validation/tests.py | 9 | import json
from basic.models import Note
from testcases import TestCaseWithFixture
class FilteringErrorsTestCase(TestCaseWithFixture):
urls = 'validation.api.urls'
def test_valid_date(self):
resp = self.client.get('/api/v1/notes/', data={
'format': 'json',
'created__gte': '2... |
waytai/xhtml2pdf | refs/heads/master | xhtml2pdf/context.py | 28 | # -*- coding: utf-8 -*-
from reportlab.lib.enums import TA_LEFT
from reportlab.lib.fonts import addMapping
from reportlab.lib.pagesizes import landscape, A4
from reportlab.lib.styles import ParagraphStyle
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttfonts import TTFont
from reportlab.platypus.frame... |
alobbs/ansible | refs/heads/devel | lib/ansible/module_utils/rax.py | 280 | # This code is part of Ansible, but is an independent component.
# This particular file snippet, and this file snippet only, is BSD licensed.
# Modules you write using this snippet, which is embedded dynamically by
# Ansible still belong to the author of the module, and may assign their own
# license to the complete wo... |
icereval/osf.io | refs/heads/develop | addons/wiki/tests/conftest.py | 447 | from osf_tests.conftest import * # noqa
|
lekum/ansible | refs/heads/devel | v1/ansible/runner/lookup_plugins/inventory_hostnames.py | 173 | # (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>
# (c) 2013, Steven Dossett <sdossett@panath.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 versio... |
virlos/virl-salt | refs/heads/master | _states/consul_check.py | 4 | # -*- coding: utf-8 -*-
'''
Management of consul checks
==========================
:maintainer: Aaron Bell <aarontbellgmail.com>
:maturity: new
:depends: - python-consul (http://python-consul.readthedocs.org/en/latest/)
:platform: Linux
.. versionadded:: 2014.7.0
:depends: - consul Python module
:configuration:... |
GdZ/scriptfile | refs/heads/master | software/googleAppEngine/google/appengine/_internal/django/utils/translation/trans_null.py | 23 | # These are versions of the functions in django.utils.translation.trans_real
# that don't actually do anything. This is purely for performance, so that
# settings.USE_I18N = False can use this module rather than trans_real.py.
import warnings
from google.appengine._internal.django.conf import settings
from google.appe... |
pdonadeo/django-oscar | refs/heads/master | tests/unit/shipping/method_tests.py | 44 | from decimal import Decimal as D
from django.test import TestCase
import mock
from oscar.apps.shipping import methods
from oscar.apps.basket.models import Basket
class TestFreeShipppingForEmptyBasket(TestCase):
def setUp(self):
self.method = methods.Free()
self.basket = Basket()
self.ch... |
Kloudless/kloudless-python | refs/heads/master | tests/unit/test_resources.py | 1 | import json
import requests
import copy
import datetime
import pytz
from mock import MagicMock, patch, call
from requests.models import Response
import helpers
import kloudless
from kloudless.resources import Account, Folder, File
@helpers.configured_test
def test_account_list():
resp = Response()
resp._cont... |
CiscoSystems/cognitive | refs/heads/master | cognitive/app/api/experiments.py | 1 | # Copyright 2015 Cisco 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 agreed to in writing, ... |
sileht/deb-openstack-python-keystoneclient | refs/heads/debian/unstable | tests/test_http.py | 1 | import httplib2
import mock
from keystoneclient import client
from tests import utils
fake_response = httplib2.Response({"status": 200})
fake_body = '{"hi": "there"}'
mock_request = mock.Mock(return_value=(fake_response, fake_body))
def get_client():
cl = client.HTTPClient(username="username", password="passwo... |
theicfire/djangofun | refs/heads/master | django/templatetags/cache.py | 309 | from django.template import Library, Node, TemplateSyntaxError, Variable, VariableDoesNotExist
from django.template import resolve_variable
from django.core.cache import cache
from django.utils.encoding import force_unicode
from django.utils.http import urlquote
from django.utils.hashcompat import md5_constructor
regi... |
ademuk/django-oscar | refs/heads/master | src/oscar/apps/offer/models.py | 4 | import itertools
import os
import re
import operator
from decimal import Decimal as D, ROUND_DOWN, ROUND_UP
from django.core import exceptions
from django.template.defaultfilters import date as date_filter
from django.db import models
from django.db.models.query import Q
from django.utils.encoding import python_2_unic... |
cindyker/p2pool | refs/heads/master | p2pool/test/util/test_skiplist.py | 287 | from p2pool.util import skiplist
class NotSkipList(object):
def __call__(self, start, *args):
pos = start
sol = self.initial_solution(start, args)
while True:
decision = self.judge(sol, args)
if decision > 0:
raise AssertionError()
elif de... |
Salat-Cx65/python-for-android | refs/heads/master | python-build/python-libs/gdata/src/gdata/apps/groups/service.py | 137 | #!/usr/bin/python
#
# Copyright (C) 2008 Google, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... |
p0psicles/SickRage | refs/heads/master | lib/sqlalchemy/ext/compiler.py | 78 | # ext/compiler.py
# Copyright (C) 2005-2014 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
"""Provides an API for creation of custom ClauseElements and compilers.
Synopsis
====... |
ogenstad/ansible | refs/heads/devel | lib/ansible/modules/network/cloudengine/ce_snmp_contact.py | 43 | #!/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... |
lgarren/spack | refs/heads/develop | var/spack/repos/builtin/packages/r-illuminaio/package.py | 1 | ##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... |
kevin-hannegan/vps-droplet | refs/heads/master | website/lib/python2.7/site-packages/pip/_vendor/distlib/compat.py | 335 | # -*- coding: utf-8 -*-
#
# Copyright (C) 2013-2016 Vinay Sajip.
# Licensed to the Python Software Foundation under a contributor agreement.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
from __future__ import absolute_import
import os
import re
import sys
try:
import ssl
except ImportError:
ssl = None
if sys.ve... |
ericfc/django | refs/heads/master | django/conf/locale/bs/formats.py | 702 | # -*- 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. N Y.'
TIME_FORMAT = 'G:i'
DATE... |
Vector35/binaryninja-api | refs/heads/dev | python/examples/kaitai/lvm2.py | 2 | # This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild
from pkg_resources import parse_version
from .kaitaistruct import __version__ as ks_version, KaitaiStruct, KaitaiStream, BytesIO
import collections
from enum import Enum
if parse_version(ks_version) < parse_version('0.... |
huihoo/reader | refs/heads/master | apps/rss_feeds/migrations/0041_deuniqueify_feed_address_on_dupes.py | 18 | # 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):
# Removing unique constraint on 'DuplicateFeed', fields ['duplicate_address']
db.delete_unique('rss_feeds_... |
coder-james/mxnet | refs/heads/master | example/speech-demo/speechSGD.py | 15 | import mxnet as mx
from mxnet.ndarray import NDArray, zeros, clip, sqrt
from mxnet.random import normal
@mx.optimizer.register
class speechSGD(mx.optimizer.Optimizer):
"""A very simple SGD optimizer with momentum and weight regularization.
Parameters
----------
learning_rate : float, optional
... |
Chilledheart/chromium | refs/heads/master | tools/telemetry/catapult_base/refactor/module.py | 16 | # 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 catapult_base.refactor import annotated_symbol
class Module(object):
def __init__(self, file_path):
self._file_path = file_path
with open(s... |
ArcEye/MK-Qt5 | refs/heads/master | src/emc/usr_intf/gmoccapy/player.py | 20 | #!/usr/bin/env python
'''
This class is used to handle sound messages from gmoccapy,
it is just a coppy of a class from gscreen and has been slighly modified
Copyright 2014 Norbert Schechner
nieson@web.de
original Author = Chris Morley
This program is free software; you can redistribute it an... |
riveridea/gnuradio | refs/heads/master | grc/gui/Connection.py | 4 | """
Copyright 2007, 2008, 2009 Free Software Foundation, Inc.
This file is part of GNU Radio
GNU Radio Companion 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... |
sudo87/cm_api | refs/heads/master | cm_api/endpoints/types.py | 2 | # Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file ex... |
edx-solutions/edx-platform | refs/heads/master | openedx/core/djangoapps/course_date_signals/tests.py | 3 | from datetime import timedelta
import ddt
from unittest.mock import patch
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
from . import utils
@ddt.ddt
class SelfPacedDueDatesTests(ModuleStoreTestCase):
def setUp(sel... |
HalcyonChimera/osf.io | refs/heads/develop | scripts/osfstorage/usage_audit.py | 2 | """File: usage_audit.py
Find all users and projects where their total usage (current file + deleted files) is >= the set limit
Projects or users can have their GUID whitelisted via `usage_audit whitelist [GUID ...]`
User usage is defined as the total usage of all projects they have > READ access on
Project usage is def... |
shubhdev/openedx | refs/heads/master | pavelib/servers.py | 30 | """
Run and manage servers for local development.
"""
from __future__ import print_function
import sys
import argparse
from paver.easy import *
from .utils.cmd import django_cmd
from .utils.process import run_process, run_multi_processes
DEFAULT_PORT = {"lms": 8000, "studio": 8001}
DEFAULT_SETTINGS = 'devstack'
def... |
Cinntax/home-assistant | refs/heads/dev | homeassistant/components/opple/light.py | 4 | """Support for the Opple light."""
import logging
import voluptuous as vol
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
ATTR_COLOR_TEMP,
PLATFORM_SCHEMA,
SUPPORT_BRIGHTNESS,
SUPPORT_COLOR_TEMP,
Light,
)
from homeassistant.const import CONF_HOST, CONF_NAME
import homeassistant.... |
iut-ibk/DynaMind-UrbanSim | refs/heads/master | 3rdparty/opus/src/urbansim_parcel/building/age_masked.py | 2 | # Opus/UrbanSim urban simulation software.
# Copyright (C) 2005-2009 University of Washington
# See opus_core/LICENSE
from opus_core.variables.variable import Variable
from variable_functions import my_attribute_label
from opus_core.simulation_state import SimulationState
from numpy import maximum, ma, logical_... |
makinacorpus/odoo | refs/heads/8.0 | addons/l10n_uy/__openerp__.py | 260 | # -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (c) 2011 Openerp.uy <openerp.uy@lists.launchpad.net>
# Proyecto de Localización de OperERP para Uruguay
# $Id$
#
# This program i... |
fredericmohr/mitro | refs/heads/master | mitro-mail/build/venv/lib/python2.7/site-packages/tornado/ioloop.py | 7 | #!/usr/bin/env python
#
# Copyright 2009 Facebook
#
# 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 a... |
savanu/servo | refs/heads/master | components/script/dom/bindings/codegen/parser/tests/test_newobject.py | 68 | # Import the WebIDL module, so we can do isinstance checks and whatnot
import WebIDL
def WebIDLTest(parser, harness):
# Basic functionality
parser.parse(
"""
interface Iface {
[NewObject] readonly attribute Iface attr;
[NewObject] Iface method();
};
""")
... |
vied12/superdesk | refs/heads/master | server/worker.py | 1 | #!/usr/bin/env python
# -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014, 2015 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/sup... |
was4444/chromium.src | refs/heads/nw15 | third_party/cython/src/Cython/Compiler/FlowControl.py | 90 | import cython
cython.declare(PyrexTypes=object, ExprNodes=object, Nodes=object,
Builtin=object, InternalError=object,
error=object, warning=object,
py_object_type=object, unspecified_type=object,
object_expr=object, object_expr_not_none=object,
... |
XueqingLin/tensorflow | refs/heads/master | tensorflow/contrib/opt/python/training/variable_clipping_optimizer.py | 15 | # 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... |
vitaly4uk/django | refs/heads/master | django/contrib/admin/filters.py | 139 | """
This encapsulates the logic for displaying filters in the Django admin.
Filters are specified in models with the "list_filter" option.
Each filter subclass knows how to display a filter for a field that passes a
certain test -- e.g. being a DateField or ForeignKey.
"""
import datetime
from django.contrib.admin.op... |
pvanek/nomacs | refs/heads/master | scripts/versionupdate.py | 2 | #!/usr/bin/env python
"""Increments the build version of a C++ projects.
This script increments the build version after every build of
a Visual Stuido project. It manipulates the DkVersion.h file in order
to do so. The version number defined there is displayed in help and
used for the VS_VERSION_INFO in the *.rc file... |
dexterx17/nodoSocket | refs/heads/master | clients/Python-2.7.6/setup.py | 1 | # Autodetecting setup.py script for building the Python extensions
#
__version__ = "$Revision$"
import sys, os, imp, re, optparse
from glob import glob
from platform import machine as platform_machine
import sysconfig
from distutils import log
from distutils import text_file
from distutils.errors import *
from distu... |
shoreflyer/cerbero | refs/heads/master | test/test_cerbero_build_filesprovider.py | 27 | # cerbero - a multi-platform build system for Open Source software
# Copyright (C) 2012 Andoni Morales Alastruey <ylatuya@gmail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; eit... |
erwilan/ansible | refs/heads/devel | lib/ansible/plugins/callback/profile_tasks.py | 34 | # (C) 2016, Joel, http://github.com/jjshoe
# (C) 2015, Tom Paine, <github@aioue.net>
# (C) 2014, Jharrod LaFon, @JharrodLaFon
# (C) 2012-2013, Michael DeHaan, <michael.dehaan@gmail.com>
#
# This file is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publis... |
burnash/skype4py | refs/heads/master | examples/callfriend.py | 18 | #!python
# ---------------------------------------------------------------------------------------------
# Python / Skype4Py example that takes a skypename from command line parameter,
# checks if that skypename is in contact list and if yes then starts a call to that skypename.
#
# Tested with Skype4Py version 0.9... |
rabipanda/tensorflow | refs/heads/master | tensorflow/contrib/timeseries/python/timeseries/state_space_models/structural_ensemble_test.py | 92 | # 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... |
stanta/darfchain | refs/heads/master | ICO/ico/state.py | 1 | from enum import IntEnum
class CrowdsaleState(IntEnum):
"""Match Crowdsale.State in the contract."""
Unknown = 0
Preparing = 1
PreFunding = 2
Funding = 3
Success = 4
Failure = 5
Finalized = 6
Refunding = 7
class UpgradeState(IntEnum):
"""Match UpgradeAgentEnabledToken.State i... |
telminov/ansible-manager | refs/heads/master | core/views/rest.py | 1 | from django.db.models import Count
from django.http import HttpResponse
from rest_framework.generics import ListAPIView
from rest_framework.views import APIView
from rest_framework.authentication import TokenAuthentication
from prometheus_client import generate_latest
from core import models
from core import serializ... |
amyshi188/osf.io | refs/heads/develop | admin/pre_reg/utils.py | 21 |
SORT_BY = {
'initiator': 'initiator',
'n_initiator': '-initiator',
'title': 'title',
'n_title': '-title',
'date': 'date',
'n_date': '-date',
'state': 'state',
'n_state': '-state',
}
def sort_drafts(query_set, order_by):
if order_by == SORT_BY['date']:
return sorted(
... |
ZyqGitHub1/lms | refs/heads/master | myapp/admin.py | 13848 | from django.contrib import admin
# Register your models here.
|
denis-pitul/django | refs/heads/master | django/dispatch/__init__.py | 758 | """Multi-consumer multi-producer dispatching mechanism
Originally based on pydispatch (BSD) http://pypi.python.org/pypi/PyDispatcher/2.0.1
See license.txt for original license.
Heavily modified for Django's purposes.
"""
from django.dispatch.dispatcher import Signal, receiver # NOQA
|
mgyenik/micropython | refs/heads/master | tests/bench/funcall-3-funcall-local.py | 101 | # Function call overhead test
# Perform the same trivial operation as calling function, cached in a
# local variable. This is commonly known optimization for overly dynamic
# languages (the idea is to cut on symbolic look up overhead, as local
# variables are accessed by offset, not by name)
import bench
def f(x):
... |
moutai/scikit-learn | refs/heads/master | examples/linear_model/plot_omp.py | 385 | """
===========================
Orthogonal Matching Pursuit
===========================
Using orthogonal matching pursuit for recovering a sparse signal from a noisy
measurement encoded with a dictionary
"""
print(__doc__)
import matplotlib.pyplot as plt
import numpy as np
from sklearn.linear_model import OrthogonalM... |
siggame/server | refs/heads/master | util.py | 1 | import re
def command(function):
function.is_command = True
return function
def is_command(function):
return getattr(function, 'is_command', False)
#Copied from http://stackoverflow.com/a/1176023/1430838
first_cap_re = re.compile('(.)([A-Z][a-z]+)')
all_cap_re = re.compile('([a-z0-9])([A-Z])')
def uncame... |
asshatter/community-detect | refs/heads/master | community_detect/__init__.py | 1 | from community_detect.community_detect import Community |
sushant354/judis-re | refs/heads/master | utils.py | 2 | import os
import datetime
import string
import sys
import urllib
import urlparse
import subprocess
import types
from xml.sax import saxutils
from xml.parsers.expat import ExpatError
from xml.dom import minidom, Node
import re
import tempfile
import logging
import codecs
import magic
import calendar
import math
import r... |
adamdeprince/python-citibike-data | refs/heads/master | citibike/download.py | 1 | """Download original citibike data.
This application downloads the original citibike data and reencodes it
from a zip to a bz2 file."""
from pipes import quote
from tempfile import TemporaryFile
from distutils.dir_util import mkpath
from os import environ, makedirs, unlink
from os.path import join, exists
import errn... |
mapzen/vector-datasource | refs/heads/master | test/test_yaml_rules.py | 2 | from unittest import TestCase
class YamlRulesTest(TestCase):
def test_all_kinds(self):
"""
Test that we've enumerated all the possible values for kind and
kind_detail in the YAML files.
"""
from vectordatasource.meta import find_yaml_path
from vectordatasource.met... |
eyohansa/django | refs/heads/master | tests/staticfiles_tests/storage.py | 332 | from datetime import datetime
from django.contrib.staticfiles.storage import CachedStaticFilesStorage
from django.core.files import storage
class DummyStorage(storage.Storage):
"""
A storage class that does implement modified_time() but raises
NotImplementedError when calling
"""
def _save(self, ... |
dcelasun/thrift | refs/heads/master | test/crossrunner/test.py | 17 | #
# 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... |
bharath2020/SmartHome | refs/heads/master | temperature_server.py | 1 | #!/usr/bin/env python3
from flask import Flask, request, render_template
import os
import json
import time
import datetime
from smarthomemongo import SmartHomeDB
app = Flask(__name__)
smartDB = SmartHomeDB()
@app.route('/')
def index():
records = smartDB.getCurrentStats('raspberry')
if( 'timestamp' in records.keys... |
tanayseven/Voix | refs/heads/master | flask/lib/python2.7/site-packages/whoosh/support/levenshtein.py | 64 | """
Contains functions implementing edit distance algorithms.
"""
from whoosh.compat import xrange
def levenshtein(seq1, seq2, limit=None):
"""Returns the Levenshtein edit distance between two strings.
"""
oneago = None
thisrow = range(1, len(seq2) + 1) + [0]
for x in xrange(len(seq1)):
... |
SOKP/external_chromium_org | refs/heads/sokp-l5.1 | tools/deep_memory_profiler/graph.py | 55 | #!/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 json
import sys
from string import Template
_HTML_TEMPLATE = """<!DOCTYPE html>
<script src="https://www.google.com/jsapi"><... |
freenas/samba | refs/heads/freenas/master | python/samba/tests/kcc/kcc_utils.py | 29 | # Unix SMB/CIFS implementation. Tests for samba.kcc.kcc_utils.
# Copyright (C) Andrew Bartlett 2015
#
# Written by Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
#
# 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 ... |
manishpatell/erpcustomizationssaiimpex123qwe | refs/heads/master | openerp/tools/test_reports.py | 337 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2010-2012 OpenERP s.a. (<http://openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of ... |
IndonesiaX/configuration | refs/heads/master | util/vpc-tools/vpc_dns.py | 71 | #!/usr/bin/env python -u
#
# Updates DNS records for a stack
#
# Example usage:
#
# # update route53 entries for ec2 and rds instances
# # in the vpc with stack-name "stage-stack" and
# # create DNS entries in the example.com hosted
# # zone
#
# python vpc_dns.py -s stage-stack -z example.com
#
# # same thi... |
Bachaco-ve/odoo | refs/heads/8.0 | addons/account/wizard/account_chart.py | 271 | # -*- 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... |
joyxu/kernelci-backend | refs/heads/master | app/tests/__init__.py | 1 | # Copyright (C) 2014 Linaro Ltd.
#
# 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
# License, or (at your option) any later version.
#
# This program is distribute... |
OpenNetworkingFoundation/Snowmass-ONFOpenTransport | refs/heads/develop | RI/flask_server/tapi_server/models/tapi_oam_pm_threshold_data.py | 4 | # coding: utf-8
from __future__ import absolute_import
from datetime import date, datetime # noqa: F401
from typing import List, Dict # noqa: F401
from tapi_server.models.base_model_ import Model
from tapi_server.models.tapi_common_local_class import TapiCommonLocalClass # noqa: F401,E501
from tapi_server.models.... |
kynikos/wiki-scripts | refs/heads/master | tests/with_api/test_site.py | 2 | #! /usr/bin/env python3
import pytest
from ws.client.api import LoginFailed
# TODO: pytest attribute
#@attr(speed="slow")
@pytest.mark.skip(reason="The api fixture was removed.")
class test_site:
"""
Tests intended mostly for detecting changes in the ArchWiki configuration.
"""
props_data = {
"gene... |
orekyuu/intellij-community | refs/heads/master | python/helpers/pydev/third_party/pep8/lib2to3/lib2to3/pgen2/pgen.py | 321 | # Copyright 2004-2005 Elemental Security, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
# Pgen imports
from . import grammar, token, tokenize
class PgenGrammar(grammar.Grammar):
pass
class ParserGenerator(object):
def __init__(self, filename, stream=None):
close_stream =... |
pnichols104/python-koans | refs/heads/master | python2/koans/about_scope.py | 100 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
import jims
import joes
counter = 0 # Global
class AboutScope(Koan):
#
# NOTE:
# Look in jims.py and joes.py to see definitions of Dog used
# for this set of tests
#
def test_dog_is_not_available_in_the_current_sc... |
cfbraun/django-admintools-bootstrap | refs/heads/master | admintools_bootstrap/views.py | 6027 | # Create your views here.
|
jjiko/PokemonGo-Map | refs/heads/develop | pogom/__init__.py | 27 | #!/usr/bin/python
# -*- coding: utf-8 -*-
config = {
'LOCALE': 'en',
'LOCALES_DIR': 'static/locales',
'ROOT_PATH': None,
'ORIGINAL_LATITUDE': None,
'ORIGINAL_LONGITUDE': None,
'GMAPS_KEY': None,
'REQ_SLEEP': 1,
'REQ_HEAVY_SLEEP': 30,
'REQ_MAX_FAILED': 5
}
|
rrwen/search_google | refs/heads/master | search_google/tests/test_api_results.py | 1 | # -*- coding: utf-8 -*-
from os import listdir, remove
from os.path import isdir, isfile
from pkg_resources import resource_filename, Requirement
from shutil import rmtree
from tempfile import TemporaryFile, TemporaryDirectory
from unittest import TestCase
import json
import search_google.api
class resultsTest(TestC... |
odoomrp/odoomrp-wip | refs/heads/8.0 | quality_control_version/models/qc_test.py | 11 | # -*- coding: utf-8 -*-
# © 2016 Oihane Crucelaegui - AvanzOSC
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from openerp import api, fields, models
class QcTest(models.Model):
_inherit = 'qc.test'
version = fields.Integer(
string='Version Number', default=0, readonly=True, copy=F... |
Rouslan/NTracer | refs/heads/master | support/arg_helper.py | 1 | """Generate a header file containing a data-type for all interned strings used
in a given C++ file"""
import sys
import re
import os.path
from distutils import log
from distutils.dep_util import newer
RE_P = re.compile(r'(?<![a-zA-Z0-9_])P\(([^\)]+)\)')
RE_ACCEPTABLE = re.compile('[a-zA-Z0-9_]+')
def generate(input... |
rogerwang/chromium | refs/heads/node | third_party/mesa/MesaLib/src/mapi/glapi/gen/gl_x86_asm.py | 33 | #!/usr/bin/env python
# (C) Copyright IBM Corporation 2004, 2005
# All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# ... |
junhuac/MQUIC | refs/heads/master | depot_tools/external_bin/gsutil/gsutil_4.15/gsutil/third_party/apitools/apitools/base/py/transfer_test.py | 11 | """Tests for transfer.py."""
import string
import mock
import six
from six.moves import http_client
import unittest2
from apitools.base.py import base_api
from apitools.base.py import http_wrapper
from apitools.base.py import transfer
class TransferTest(unittest2.TestCase):
def assertRangeAndContentRangeCompat... |
shlomihod/scenario | refs/heads/master | scenario/__init__.py | 1 | __all__ = ['run_scenario', 'parse_scenario_json', 'play_scenario',
'get_timeout_feedback_json', 'get_overflow_feedback_json']
from scenario.runner import run_scenario
from scenario.parser import parse_scenario_json
from scenario.player import play_scenario
from scenario.api import get_timeout_feedback_json,... |
aaronbassett/djangocon-swampdragon | refs/heads/master | talk/todo/routers.py | 1 | # -*- coding: utf-8 -*-
# Swamp Dragon
from swampdragon import route_handler
from swampdragon.route_handler import ModelRouter
from .models import TodoList, TodoItem
from .serializers import TodoListSerializer, TodoItemSerializer
class TodoListRouter(ModelRouter):
route_name = 'todo-list'
serializer_class =... |
vleo/vleo-notebook | refs/heads/master | protobuf/trunk/protobuf/python/stubout.py | 670 | #!/usr/bin/python2.4
#
# Copyright 2008 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
cedar101/quepy | refs/heads/master | tests/random_expression.py | 9 | # -*- coding: utf-8 -*-
import random
from quepy.expression import Expression
def random_data(only_ascii=False):
data = []
first = True
while first or 1 / 20.0 < random.random():
first = False
if only_ascii:
c = unichr(random.randint(33, 126))
data.append(c)
... |
jazkarta/edx-platform-for-isc | refs/heads/backport-auto-certification | common/djangoapps/django_comment_common/tests.py | 34 | from django.test import TestCase
from opaque_keys.edx.locations import SlashSeparatedCourseKey
from django_comment_common.models import Role
from student.models import CourseEnrollment, User
class RoleAssignmentTest(TestCase):
"""
Basic checks to make sure our Roles get assigned and unassigned as students
... |
gedakc/manuskript | refs/heads/master | manuskript/ui/helpLabel.py | 2 | #!/usr/bin/env python
# --!-- coding: utf8 --!--
from PyQt5.QtWidgets import QLabel, QSizePolicy
class helpLabel(QLabel):
def __init__(self, text=None, parent=None):
QLabel.__init__(self, text, parent)
self.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Maximum)
self.setStatusTip(self.... |
mehmetkose/tornado | refs/heads/master | tornado/simple_httpclient.py | 14 | #!/usr/bin/env python
from __future__ import absolute_import, division, print_function, with_statement
from tornado.escape import utf8, _unicode
from tornado import gen
from tornado.httpclient import HTTPResponse, HTTPError, AsyncHTTPClient, main, _RequestProxy
from tornado import httputil
from tornado.http1connection... |
yhfudev/docsis3ns3 | refs/heads/master | src/bridge/test/examples-to-run.py | 200 | #! /usr/bin/env python
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
# A list of C++ examples to run in order to ensure that they remain
# buildable and runnable over time. Each tuple in the list contains
#
# (example_name, do_run, do_valgrind_run).
#
# See test.py for more i... |
JVenberg/PokemonGo-Bot-Desktop | refs/heads/development | pywin/Lib/distutils/version.py | 259 | #
# distutils/version.py
#
# Implements multiple version numbering conventions for the
# Python Module Distribution Utilities.
#
# $Id$
#
"""Provides classes to represent module version numbers (one class for
each style of version numbering). There are currently two such classes
implemented: StrictVersion and LooseVe... |
Seenivasanseeni/PyDaS | refs/heads/master | PDaS/LinkedList.py | 1 | class Node(object):
def __init__(self, data=None, next_node=None):
self.data = data
self.next = next_node
class LinkedList(object):
#default constructor
def __init__(self,array=None):
self.head=None
self.length=0
if(array!=None):
self.initArray(array)
#constructor with list as argument
def initArray(s... |
EdwardJKim/nbgrader | refs/heads/master | nbgrader/tests/nbextensions/test_assignment_list.py | 1 | import pytest
import os
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import TimeoutException, NoSuchElementException
from .. import run_nbgrader
from .conftest import... |
thandang/TComponent | refs/heads/master | TComponents/cpp/scons/scons-local-2.0.0.final.0/SCons/Tool/rpm.py | 34 | """SCons.Tool.rpm
Tool-specific initialization for rpm.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
The rpm tool calls the rpmbuild command. The first and only argument should a
tar.gz consisting of the sourc... |
kernel64/AutobahnPython | refs/heads/master | autobahn/autobahn/compress_base.py | 46 | ###############################################################################
##
## Copyright 2013 Tavendo GmbH
##
## 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... |
hoangminhitvn/flask | refs/heads/master | flask/lib/python2.7/site-packages/jinja2/bccache.py | 256 | # -*- coding: utf-8 -*-
"""
jinja2.bccache
~~~~~~~~~~~~~~
This module implements the bytecode cache system Jinja is optionally
using. This is useful if you have very complex template situations and
the compiliation of all those templates slow down your application too
much.
Situations whe... |
shail2810/nova | refs/heads/master | nova/cmd/novncproxy.py | 38 | # Copyright (c) 2012 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... |
EliteTK/PyBot | refs/heads/master | Commands/urban/urban.py | 1 | ###########################################################################
## PyBot ##
## Copyright (C) 2015, Kyle Repinski ##
## ##
## This program ... |
valentin-krasontovitsch/ansible | refs/heads/devel | lib/ansible/__init__.py | 301 | # (c) 2012-2014, Michael DeHaan <michael.dehaan@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 of the License, or
# (at your option) an... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.