repo_name stringlengths 5 100 | ref stringlengths 12 67 | path stringlengths 4 244 | copies stringlengths 1 8 | content stringlengths 0 1.05M ⌀ |
|---|---|---|---|---|
admiyo/keystone | refs/heads/master | keystone/backends/sqlalchemy/models.py | 2 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2010-2011 OpenStack, LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unl... |
koparasy/gemfi | refs/heads/master | ext/ply/test/yacc_missing1.py | 174 | # -----------------------------------------------------------------------------
# yacc_missing1.py
#
# Grammar with a missing rule
# -----------------------------------------------------------------------------
import sys
if ".." not in sys.path: sys.path.insert(0,"..")
import ply.yacc as yacc
from calclex import tok... |
Leontes/ROS-ATP | refs/heads/master | parser_pkg/src/parser_pkg/primitive.py | 1 | #!/usr/bin/python
"""
primitive.py - Version 1.0 2015-05-15
Executable class thats implements a generic pyhop task
Copyright (c) 2015 Jose Angel Segura Muros. 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 ma... |
ampintilie/lis-test | refs/heads/master | WS2012R2/lisa/Infrastructure/patch-utils/patch_utils.py | 9 | import sys
import logging
from config import get_arg_parser
from patch_manager import PatchManager
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
def main(arguments):
parser = get_arg_parser()
logger.info('Running %s command' % arguments[0])
manager = PatchManager(
ar... |
procoder317/scikit-learn | refs/heads/master | examples/ensemble/plot_feature_transformation.py | 67 | """
===============================================
Feature transformations with ensembles of trees
===============================================
Transform your features into a higher dimensional, sparse space. Then
train a linear model on these features.
First fit an ensemble of trees (totally random trees, a rand... |
40423249/2016fallcadp_hw | refs/heads/gh-pages | plugin/liquid_tags/graphviz.py | 245 | """
GraphViz Tag
---------
This implements a Liquid-style graphviz tag for Pelican. You can use different
Graphviz programs like dot, neato, twopi etc. [1]
[1] http://www.graphviz.org/
Syntax
------
{% graphviz
<program> {
<DOT code>
}
%}
Examples
--------
{% graphviz
dot {
digraph graph... |
da1z/intellij-community | refs/heads/master | python/testData/intentions/addMissingVarargsInGoogleDocString_after.py | 53 | def f(x, *args, **kwargs):
"""
Args:
*args:
**kwargs:
x: foo
""" |
alexandrcoin/p2pooldoge-all | refs/heads/master | p2pool/bitcoin/networks/feathercoin.py | 10 | import os
import platform
from twisted.internet import defer
from .. import data, helper
from p2pool.util import pack
P2P_PREFIX = 'fbc0b6db'.decode('hex')
P2P_PORT = 9336
ADDRESS_VERSION = 14
RPC_PORT = 9337
RPC_CHECK = defer.inlineCallbacks(lambda bitcoind: defer.returnValue(
'feathercoinaddress' in (... |
tejal29/pants | refs/heads/master | tests/python/pants_test/backend/jvm/targets/test_unpacked_jars.py | 1 | # coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from textwrap import... |
wolverineav/horizon | refs/heads/master | openstack_dashboard/dashboards/identity/roles/panel.py | 17 | # Copyright 2013 Hewlett-Packard Development Company, L.P.
#
# 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 requir... |
bhavani33/iiit_project | refs/heads/master | land/views.py | 6445 | from django.shortcuts import render
# Create your views here.
|
dichen001/Go4Jobs | refs/heads/master | JackChen/string/68. Text Justification.py | 1 | """
Given an array of words and a length L, format the text such that each line has exactly L characters and is fully (left and right) justified.
You should pack your words in a greedy approach; that is, pack as many words as you can in each line. Pad extra spaces ' ' when necessary so that each line has exactly L cha... |
archangdcc/avalon-extras | refs/heads/master | scripts/avalon_nano/avalon_nano_v2.py | 3 | #!/usr/bin/env python2.7
# This simple script was for test Avalon nano.
import usb.core
import usb.util
from optparse import OptionParser
import binascii
import sys
import time
parser = OptionParser()
parser.add_option("-S", "--static", dest="is_static", default="0", help="Static flag: 0-turn off, 1-turn on")
(option... |
discreteoptimization/setcover | refs/heads/master | mip_ampl_001/solver.py | 3 | #!/usr/bin/python
import os
from subprocess import Popen, PIPE
def parse_solver_output(output):
# TODO: analyze output the first line from setcover.sol
# to determine if we get optimal solution or we stops since time limit
lines = output.split('\n')
for i in xrange(len(lines)):
if lines[i].star... |
pombredanne/cmsplugin-filer | refs/heads/develop | src/cmsplugin_filer_teaser/models.py | 9 | from django.utils.translation import ugettext_lazy as _
from django.db import models
from cms.models import CMSPlugin
from cms.models.fields import PageField
from filer.fields.image import FilerImageField
from django.conf import settings
CMSPLUGIN_FILER_TEASER_STYLE_CHOICES = getattr( settings, 'CMSPLUGIN_FILER_TEASER... |
bpowers/bcc | refs/heads/master | tests/cc/test_stat1.py | 3 | #!/usr/bin/env python
# Copyright (c) PLUMgrid, Inc.
# Licensed under the Apache License, Version 2.0 (the "License")
# test program to count the packets sent to a device in a .5
# second period
from ctypes import c_uint, c_ulong, Structure
from netaddr import IPAddress
from bcc import BPF
from subprocess import chec... |
fanngyuan/vitess | refs/heads/master | py/vtdb/field_types.py | 4 | from array import array
import datetime
from decimal import Decimal
from vtdb import times
# These numbers should exactly match values defined in dist/mysql-5.1.52/include/mysql/mysql_com.h
VT_DECIMAL = 0
VT_TINY = 1
VT_SHORT = 2
VT_LONG = 3
VT_FLOAT = 4
VT_DOUBLE = 5
VT_NULL = 6
VT_TIMESTAMP = 7
VT_LONGLONG = 8
VT_IN... |
jcsaezal/pmctrack | refs/heads/master | src/gui/backend/pmc_extract.py | 1 | # -*- coding: utf-8 -*-
#
# pmc_extract.py
# Component for getting data from pmctrack command-line tool.
#
##############################################################################
#
# Copyright (c) 2015 Jorge Casas <jorcasas@ucm.es>
#
# This program is free software; you can redistribute it and/or modify
# it un... |
ApolloJustice/HexChat-pyscripts | refs/heads/master | foobar.py | 1 | __module_name__ = "EWC Wrapper"
__module_version__ = "0.0.1a"
__module_description__ = "Fuck."
__author__ = "ApolloJustice"
import hexchat
def wrap(word, word_eol, userdata):
fullstr = word_eol[1].split('|')
title = fullstr[0]
artist = fullstr[1]
album = fullstr[2]
codec = fullstr[3]
fb2kver = f... |
zbqf109/goodo | refs/heads/master | openerp/addons/website_mail/models/update.py | 362 | # -*- coding: utf-8 -*-
from openerp.models import AbstractModel
class publisher_warranty_contract(AbstractModel):
_inherit = "publisher_warranty.contract"
def _get_message(self, cr, uid):
msg = super(publisher_warranty_contract, self)._get_message(cr, uid)
msg['website'] = True
return... |
cmunk/protwis | refs/heads/master | build_gpcr/management/commands/build_statistics_trees.py | 3 | from build.management.commands.build_statistics_trees import Command as BuildStatisticsTrees
class Command(BuildStatisticsTrees):
pass |
Selth/pypocket | refs/heads/master | pocket-cli.py | 1 | #!/usr/bin/python
import json,ConfigParser,urllib2,os
#read the ~/.cred
if not os.path.exists(os.path.expanduser('~/.config')):
os.makedirs(os.path.expanduser('~/.config'))
if not os.path.exists(os.path.expanduser('~/.config/pypocket')):
os.makedirs(os.path.expanduser('~/.config/pypocket'))
creds = ConfigPars... |
phektus/Django-Google-AppEngine-OpenId-Auth | refs/heads/master | django/contrib/gis/tests/geoapp/test_regress.py | 258 | import os, unittest
from django.contrib.gis.tests.utils import no_mysql, no_oracle, no_postgis, no_spatialite
from django.contrib.gis.shortcuts import render_to_kmz
from models import City
class GeoRegressionTests(unittest.TestCase):
def test01_update(self):
"Testing GeoQuerySet.update(), see #10411."
... |
akintoey/django | refs/heads/master | django/contrib/gis/geos/prototypes/coordseq.py | 485 | from ctypes import POINTER, c_double, c_int, c_uint
from django.contrib.gis.geos.libgeos import CS_PTR, GEOM_PTR, GEOSFuncFactory
from django.contrib.gis.geos.prototypes.errcheck import (
GEOSException, last_arg_byref,
)
# ## Error-checking routines specific to coordinate sequences. ##
def check_cs_op(result, fu... |
aktech/sympy | refs/heads/master | sympy/core/tests/test_var.py | 125 | # Tests for var are in their own file, because var pollutes global namespace.
from sympy import Symbol, var, Function, FunctionClass
from sympy.utilities.pytest import raises
# make z1 with call-depth = 1
def _make_z1():
var("z1")
# make z2 with call-depth = 2
def __make_z2():
var("z2")
def _make_z2():... |
40223137/w1717 | refs/heads/master | static/Brython3.1.1-20150328-091302/Lib/_abcoll.py | 688 | # Copyright 2007 Google, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""Abstract Base Classes (ABCs) for collections, according to PEP 3119.
DON'T USE THIS MODULE DIRECTLY! The classes here should be imported
via collections; they are defined here only to alleviate certain
bootstrappin... |
hustodemon/spacewalk | refs/heads/master | client/rhel/rhn-client-tools/src/up2date_client/rpmUtils.py | 2 | # some high level utility stuff for rpm handling
# Client code for Update Agent
# Copyright (c) 1999--2012 Red Hat, Inc. Distributed under GPLv2.
#
# Author: Preston Brown <pbrown@redhat.com>
# Adrian Likins <alikins@redhat.com>
#
#
# FIXME: Some exceptions in here are currently in up2date.py
# fix... |
NamelessRom/android_kernel_samsung_aries | refs/heads/n-2.0 | Documentation/networking/cxacru-cf.py | 14668 | #!/usr/bin/env python
# Copyright 2009 Simon Arlott
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your option)
# any later version.
#
# This program i... |
XKNX/xknx | refs/heads/main | test/remote_value_tests/remote_value_string_test.py | 1 | """Unit test for RemoteValueString objects."""
import pytest
from xknx import XKNX
from xknx.dpt import DPTArray, DPTBinary
from xknx.exceptions import ConversionError, CouldNotParseTelegram
from xknx.remote_value import RemoteValueString
from xknx.telegram import GroupAddress, Telegram
from xknx.telegram.apci import G... |
joariasl/odoo | refs/heads/8.0 | addons/note/__openerp__.py | 260 | # -*- 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... |
xxsergzzxx/python-for-android | refs/heads/master | python3-alpha/python3-src/Lib/cgitb.py | 48 | """More comprehensive traceback formatting for Python scripts.
To enable this module, do:
import cgitb; cgitb.enable()
at the top of your script. The optional arguments to enable() are:
display - if true, tracebacks are displayed in the web browser
logdir - if set, tracebacks are written to fi... |
kvar/ansible | refs/heads/seas_master_2.9.5 | test/integration/targets/module_precedence/multiple_roles/foo/library/ping.py | 480 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>
# (c) 2016, Toshio Kuratomi <tkuratomi@ansible.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... |
mvdbeek/tools-artbio | refs/heads/master | tools/blastx_to_scaffold/blastx_to_scaffold.py | 3 | #!/usr/bin/python
import sys
import argparse
def insert_newlines(string, every=60):
lines = []
for i in xrange(0, len(string), every):
lines.append(string[i:i+every])
return '\n'.join(lines)
def Parser():
the_parser = argparse.ArgumentParser(
description="Generate DNA scaffold from... |
michi-covalent/cilium | refs/heads/master | contrib/scripts/netperf_reporter.py | 7 | #!/usr/bin/env python3
# Copyright 2018 Authors of Cilium
# 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 la... |
johnhubbard/pnotify-linux-3.12.20 | refs/heads/master | tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Core.py | 11088 | # Core.py - Python extension for perf script, core functions
#
# Copyright (C) 2010 by Tom Zanussi <tzanussi@gmail.com>
#
# This software may be distributed under the terms of the GNU General
# Public License ("GPL") version 2 as published by the Free Software
# Foundation.
from collections import defaultdict
def aut... |
bravo-t/shadowsocks | refs/heads/master | shadowsocks/lru_cache.py | 983 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2015 clowwindy
#
# 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 b... |
JulienBalestra/enjoliver | refs/heads/master | app/tests/euid/discovery/test_kvm_discovery_client.py | 2 | import os
import sys
import time
import unittest
from app import generator
try:
import kvm_player
except ImportError:
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import kvm_player
class TestKVMDiscoveryClient(kvm_player.KernelVirtualMachinePlayer):
@classmethod
d... |
joyxu/autotest-client-tests | refs/heads/master | selftest/selftest.py | 2 | import os
import sys
import logging
from autotest.client import test
from autotest.client.shared import error
class selftest(test.test):
version = 1
def setup(self):
name = self.job.resultdir + '/sequence'
if (not os.path.exists(name)):
fd = file(name, 'w')
fd.write('0... |
svenstaro/ansible | refs/heads/devel | lib/ansible/plugins/lookup/indexed_items.py | 89 | # (c) 2012, 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) any lat... |
aodarc/flowers_room | refs/heads/master | apps/forum/urls.py | 1 | from django.conf.urls import url
from apps.forum.views import ForumView, SinglePost, TopicView, add_comment, SingleTopicPost
urlpatterns = [
url(r'^(?P<pk>\d+)/add_comment$', add_comment, name='forum-add-comment'),
url(r'^(?P<pk>\d+)$', SinglePost.as_view(), name='forum_single'),
url(r'^topic/(?P<pk>\d+)$... |
Abrackadabra/dedlykos | refs/heads/dedlykos | plugins/correction.py | 17 | import re
from cloudbot import hook
from cloudbot.util.formatting import ireplace
correction_re = re.compile(r"^[sS]/(.*/.*(?:/[igx]{,4})?)\S*$")
@hook.regex(correction_re)
def correction(match, conn, chan, message):
"""
:type match: re.__Match
:type conn: cloudbot.client.Client
:type chan: str
... |
timabbott/zulip | refs/heads/master | zerver/migrations/0142_userprofile_translate_emoticons.py | 7 | # Generated by Django 1.11.6 on 2018-02-19 22:27
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('zerver', '0141_change_usergroup_description_to_textfield'),
]
operations = [
migrations.AddField(
model_name='userprofile',
... |
alexproca/askbot-devel | refs/heads/master | askbot/management/commands/get_askbot_sphinx_search_config.py | 21 | """the management command that outputs configuration
for sphinx search"""
from django.conf import settings
from django.core.management.base import BaseCommand
from django.template import Template, Context
import askbot
class Command(BaseCommand):
def handle(self, *args, **noargs):
tpl_file = open(askbot.... |
hsum/sqlalchemy | refs/heads/master | test/sql/test_compiler.py | 1 | #! coding:utf-8
"""
compiler tests.
These tests are among the very first that were written when SQLAlchemy
began in 2005. As a result the testing style here is very dense;
it's an ongoing job to break these into much smaller tests with correct pep8
styling and coherent test organization.
"""
from sqlalchemy.testin... |
tigeli/futurice-ldap-user-manager | refs/heads/master | fum/projects/urls.py | 2 | from django.conf.urls import patterns, include, url
from views import *
urlpatterns = patterns('',
url(r'add/$', Create.as_view(), name='%s_add'%NAME),
url(r'json/$', projects_json, name='%s_json'%NAME),
url(r'(?P<projectname>[ -_\w]+)/users/$', projects_detail_json, name='%s_detail'%NAME),
url(r'(?P<s... |
waseem18/oh-mainline | refs/heads/master | vendor/packages/sessionprofile/sessionprofile/cleanup_inactive_sessions.py | 20 | '''
Created on Dec 14, 2009
@author: russn
'''
import datetime
from django.core.management.base import NoArgsCommand
from django.contrib.sessions.models import Session
from django.db import transaction
from sessionprofile.models import SessionProfile
class Command(NoArgsCommand):
help = """
Thi... |
stuartquin/pgcli | refs/heads/master | tests/test_expanded.py | 3 | from pgcli.packages.expanded import expanded_table
import pytest
def test_expanded_table_renders():
input = [("hello", 123),("world", 456)]
expected = """-[ RECORD 0 ]
name | hello
age | 123
-[ RECORD 1 ]
name | world
age | 456
"""
assert expected == expanded_table(input, ["name", "age"])
|
SA313161/ardupilot | refs/heads/master | Tools/autotest/param_metadata/htmlemit.py | 148 | #!/usr/bin/env python
import re
from param import *
from emit import Emit
import cgi
# Emit docs in a form acceptable to the APM wordpress docs site
class HtmlEmit(Emit):
def __init__(self):
html_fname = 'Parameters.html'
self.f = open(html_fname, mode='w')
self.preamble = '''<!-- Dyn... |
bigblindbais/pytk | refs/heads/master | src/pytk/factory/random.bk/__init__.py | 2 | from .factory import FactoryDistribution
from .real import RealDistribution
|
Grogdor/CouchPotatoServer | refs/heads/master | libs/html5lib/treebuilders/dom.py | 559 | from __future__ import absolute_import, division, unicode_literals
from xml.dom import minidom, Node
import weakref
from . import _base
from .. import constants
from ..constants import namespaces
from ..utils import moduleFactoryFactory
def getDomBuilder(DomImplementation):
Dom = DomImplementation
class A... |
FHannes/intellij-community | refs/heads/master | python/testData/psi/YieldAsArgument.py | 83 | def f():
foo(yield 42) |
mancoast/CPythonPyc_test | refs/heads/master | fail/334_test_pstats.py | 175 | import unittest
from test import support
from io import StringIO
import pstats
class AddCallersTestCase(unittest.TestCase):
"""Tests for pstats.add_callers helper."""
def test_combine_results(self):
# pstats.add_callers should combine the call results of both target
# and source by adding th... |
seeminglee/pyglet64 | refs/heads/master | experimental/buffer/test_retained.py | 28 | #!/usr/bin/python
# $Id:$
from pyglet.gl import *
from pyglet import graphics
from pyglet import window
win = window.Window()
batch = graphics.Batch()
batch.add(3, GL_TRIANGLES, None,
('v2f', [10., 10.,
100., 10.,
100., 100.]),
('c3B', [255, 0, 0,
0, 255, 0,
... |
nhomar/odoo-mirror | refs/heads/8.0 | openerp/sql_db.py | 31 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
# Copyright (C) 2010-2014 OpenERP s.a. (<http://openerp.com>).
#
# This program is free software: you ca... |
horizontracy/rpi_tool | refs/heads/master | api/venv/lib/python2.7/site-packages/pip/_vendor/html5lib/trie/_base.py | 1735 | from __future__ import absolute_import, division, unicode_literals
from collections import Mapping
class Trie(Mapping):
"""Abstract base class for tries"""
def keys(self, prefix=None):
keys = super().keys()
if prefix is None:
return set(keys)
# Python 2.6: no set compre... |
hortonworks/hortonworks-sandbox | refs/heads/master | desktop/core/ext-py/Django-1.2.3/django/core/files/uploadedfile.py | 402 | """
Classes representing uploaded files.
"""
import os
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
from django.conf import settings
from django.core.files.base import File
from django.core.files import temp as tempfile
from django.utils.encoding import smart_str
__al... |
drpaneas/linuxed.gr | refs/heads/master | lib/python2.7/site-packages/pygments/lexers/math.py | 77 | # -*- coding: utf-8 -*-
"""
pygments.lexers.math
~~~~~~~~~~~~~~~~~~~~
Just export lexers that were contained in this module.
:copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pygments.lexers.python import NumPyLexer
from pygments.l... |
gef756/statsmodels | refs/heads/master | tools/nbgenerate.py | 26 | #! /usr/bin/env python
"""
Script to generate notebooks with output from notebooks that don't have
output.
"""
# prefer HTML over rST for now until nbconvert changes drop
OUTPUT = "html"
import os
import io
import sys
import time
import shutil
SOURCE_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."... |
roselleebarle04/django | refs/heads/master | django/core/serializers/__init__.py | 347 | """
Interfaces for serializing Django objects.
Usage::
from django.core import serializers
json = serializers.serialize("json", some_queryset)
objects = list(serializers.deserialize("json", json))
To add your own serializers, use the SERIALIZATION_MODULES setting::
SERIALIZATION_MODULES = {
... |
sklnet/openblackhole-enigma2 | refs/heads/master | lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py | 47 | # -*- coding: iso-8859-1 -*-
from enigma import eConsoleAppContainer
from Components.Console import Console
from Components.About import about
from Components.PackageInfo import PackageInfoHandler
from Components.Language import language
from Components.Sources.List import List
from Components.Ipkg import IpkgComponent... |
PythonCharmers/bokeh | refs/heads/master | bokeh/cli/help_messages.py | 42 | from __future__ import absolute_import
from ..palettes import brewer
ERR_MSG_TEMPL = "##### ERRORS OCCURRED! #####\n" \
"An error occurred while building the Chart. No series filtering" \
" specified (using all series found: %s. " \
"If you have series with non numeric ... |
r0zar/ember-rails-stocks | refs/heads/master | stocks/node_modules/ember-cli/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_ninja.py | 1789 | # Copyright (c) 2014 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.
"""Xcode-ninja wrapper project file generator.
This updates the data structures passed to the Xcode gyp generator to build
with ninja instead. The Xcode project i... |
lhelwerd/ardupilot | refs/heads/master | Tools/LogAnalyzer/tests/TestVibration.py | 261 | from LogAnalyzer import Test,TestResult
import DataflashLog
import numpy
class TestVibration(Test):
'''test for accelerometer vibration (accX/accY/accZ) within recommendations'''
def __init__(self):
Test.__init__(self)
self.name = "Vibration"
def run(self, logdata, verbose):
se... |
lindenlab/eventlet | refs/heads/master | tests/queue_test.py | 5 | import eventlet
from eventlet import event, hubs, queue
from tests import LimitedTestCase, main
def do_bail(q):
eventlet.Timeout(0, RuntimeError())
try:
result = q.get()
return result
except RuntimeError:
return 'timed out'
class TestQueue(LimitedTestCase):
def test_send_firs... |
tedye/leetcode | refs/heads/master | Python/leetcode.235.lowest-common-ancestor-of-a-binary-search-tree.py | 1 | # Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def lowestCommonAncestor(self, root, p, q):
"""
:type root: TreeNode
:type p: TreeNode
:t... |
fuhongliang/odoo | refs/heads/8.0 | addons/crm_profiling/__init__.py | 438 | # -*- 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... |
Tarrasch/problemtools | refs/heads/master | template.py | 1 | import os
import re
import os.path
import glob
import tempfile
import shutil
# For backwards compatibility, remove in bright and shiny future.
def detect_version(problemdir, problemtex):
# Check for 0.1 - lack of \problemname
if open(problemtex).read().find('\problemname') < 0:
return '0.1'
return... |
La0/mozilla-relengapi | refs/heads/master | src/pulselistener/pulselistener/phabricator.py | 1 | # -*- coding: utf-8 -*-
import enum
import time
import structlog
logger = structlog.get_logger(__name__)
class PhabricatorBuildState(enum.Enum):
Queued = 1
Secured = 2
Public = 3
class PhabricatorBuild(object):
'''
A Phabricator buildable, triggered by HarborMaster
'''
def __init__(sel... |
devs1991/test_edx_docmode | refs/heads/master | lms/djangoapps/student_account/test/test_views.py | 2 | # -*- coding: utf-8 -*-
""" Tests for student account views. """
import re
from unittest import skipUnless
from urllib import urlencode
import mock
import ddt
from django.conf import settings
from django.core import mail
from django.core.files.uploadedfile import SimpleUploadedFile
from django.core.urlresolvers impor... |
mlperf/training_results_v0.7 | refs/heads/master | NVIDIA/benchmarks/minigo/implementations/tensorflow/minigo/gtp.py | 4 | # Copyright 2018 Google LLC
#
# 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, ... |
law12019/deep_learning | refs/heads/master | scripts/girder_dump.py | 1 | # dump all the annotations in the DigitalGlobe collection
# usage:
# python girder_dump_annotation out_path
# todo: Option to skip downloading / uploading file.
# Best done as a sync script
# 2019/05/14: Finished, but then gave an invalid item id message ....
import sys
import os
import pdb
import girder_cl... |
martinwicke/tensorflow | refs/heads/master | tensorflow/python/kernel_tests/draw_bounding_box_op_test.py | 21 | # Copyright 2015 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... |
rwaldron/atom-shell | refs/heads/master | script/coffeelint.py | 4 | #!/usr/bin/env python
import errno
import glob
import os
import subprocess
import sys
SOURCE_ROOT = os.path.dirname(os.path.dirname(__file__))
def main():
os.chdir(SOURCE_ROOT)
coffeelint = os.path.join(SOURCE_ROOT, 'node_modules', 'coffeelint', 'bin',
'coffeelint')
settings = ['... |
AlexandreProenca/django-rest-framework | refs/heads/master | tests/test_parsers.py | 81 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django import forms
from django.core.files.uploadhandler import MemoryFileUploadHandler
from django.test import TestCase
from django.utils.six.moves import StringIO
from rest_framework.exceptions import ParseError
from rest_framework.parsers import... |
edulramirez/nova | refs/heads/master | nova/virt/netutils.py | 35 | # Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# Copyright (c) 2010 Citrix Systems, Inc.
# Copyright 2013 IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use th... |
qinjian623/dlnotes | refs/heads/master | tutorials/pytorch/drl/reinforce.py | 1 | import argparse
import gym
import numpy as np
from itertools import count
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import torch.autograd as autograd
from torch.autograd import Variable
parser = argparse.ArgumentParser(description='PyTorch REINFORCE example')
pars... |
geminy/aidear | refs/heads/master | oss/qt/qt-everywhere-opensource-src-5.9.0/qtwebengine/src/3rdparty/chromium/third_party/skia/tools/generate_includes_cpp.py | 62 | #!/usr/bin/python
'''
Copyright 2014 Google Inc.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
'''
import os
import optparse
import posixpath
import re
def is_ignored(full_path, ignore_list):
for ignore_path in ignore_list:
if re.search(ignore_path, full_pa... |
pniedzielski/fb-hackathon-2013-11-21 | refs/heads/master | src/repl.it/jsrepl/extern/python/closured/lib/python2.7/popen2.py | 304 | """Spawn a command with pipes to its stdin, stdout, and optionally stderr.
The normal os.popen(cmd, mode) call spawns a shell command and provides a
file interface to just the input or output of the process depending on
whether mode is 'r' or 'w'. This module provides the functions popen2(cmd)
and popen3(cmd) which r... |
zqqf16/clipboard | refs/heads/master | clipboard/run_test.py | 1 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
import test
def main():
suites = test.all()
runner = unittest.TextTestRunner(verbosity=2).run(suites)
if __name__ == '__main__':
main()
|
robertchase/rhc | refs/heads/master | rhc/micro_fsm/fsm_micro.py | 1 | from rhc.fsm.FSM import STATE, EVENT, FSM
# add_config
# add_config_server
# add_connection
# add_header
# add_method
# add_old_server
# add_optional
# add_required
# add_resource
# add_resource_header
# add_route
# add_server
# add_setup
# add_teardown
# add_user
# silent
def create(**actions):
S_old_init=STATE('old... |
box/genty | refs/heads/master | test/test_genty_args.py | 1 | # coding: utf-8
from __future__ import unicode_literals
import six
from genty import genty_dataset, genty, genty_args
from genty.private import format_arg
from test.test_case_base import TestCase
@genty
class GentyArgsTest(TestCase):
"""Tests for :mod:`box.test.genty.genty_args`."""
@genty_dataset(
... |
quietcoolwu/leetcode-python | refs/heads/master | swap_nodes_in_pairs/solution2.py | 7 | # Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
# @param a ListNode
# @return a ListNode
def swapPairs(self, head):
if head is None:
return head
res = None
res_end = Non... |
sntran/portia | refs/heads/master | slybot/slybot/__init__.py | 17 | __version__ = '0.12.1'
|
Lukasa/urllib3 | refs/heads/master | urllib3/contrib/socks.py | 218 | # -*- coding: utf-8 -*-
"""
This module contains provisional support for SOCKS proxies from within
urllib3. This module supports SOCKS4 (specifically the SOCKS4A variant) and
SOCKS5. To enable its functionality, either install PySocks or install this
module with the ``socks`` extra.
The SOCKS implementation supports t... |
praekelt/jmbo-banner | refs/heads/develop | banner/tests/__init__.py | 1 | # import os
#
# from django.test import TestCase as BaseTestCase
# from django.test.client import Client as BaseClient, RequestFactory
# from django.contrib.auth.models import User
# from django.template import RequestContext, loader
# from django.core.files.base import ContentFile
#
# from banner.models import ImageBa... |
flakerimi/ajenti | refs/heads/master | plugins/services/s_gentoo.py | 12 | import os
from ajenti.com import *
from ajenti.utils import *
from ajenti import apis
from ajenti.api import *
class GentooServiceManager(Plugin):
implements(apis.services.IServiceManager)
platform = ['gentoo']
def list_all(self):
r = []
for s in shell('rc-update sho... |
ajenhl/django-tmapi | refs/heads/master | tmapi/models/copy_utils.py | 1 | # Copyright 2011 Jamie Norrish (jamie@artefact.org.nz)
# Copyright 2008 - 2010 Lars Heuer (heuer[at]semagia.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
#
# http://www.apache.org/... |
andresgz/django | refs/heads/master | tests/import_error_package/__init__.py | 513 | # A package that raises an ImportError that can be shared among test apps and
# excluded from test discovery.
raise ImportError("Oops")
|
ol-loginov/intellij-community | refs/heads/master | python/testData/codeInsight/smartEnter/while.py | 83 | while<caret> a |
Javiercerna/MissionPlanner | refs/heads/master | LogAnalyzer/tests/TestPitchRollCoupling.py | 267 | from LogAnalyzer import Test,TestResult
import DataflashLog
import collections
class TestPitchRollCoupling(Test):
'''test for divergence between input and output pitch/roll, i.e. mechanical failure or bad PID tuning'''
# TODO: currently we're only checking for roll/pitch outside of max lean angle, will come ... |
timorieber/wagtail | refs/heads/master | wagtail/embeds/urls.py | 16 | from django.conf.urls import url
from wagtail.embeds.views import chooser
app_name = 'wagtailembeds'
urlpatterns = [
url(r'^chooser/$', chooser.chooser, name='chooser'),
url(r'^chooser/upload/$', chooser.chooser_upload, name='chooser_upload'),
]
|
arenadata/ambari | refs/heads/branch-adh-1.6 | ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/HBASE/package/scripts/upgrade.py | 1 |
#!/usr/bin/env python
"""
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")... |
heavenshell/py-pyltsv | refs/heads/master | tests/test_ltsv.py | 1 | # -*- coding: utf-8 -*-
"""
pyltsv.tests.test_lstv
~~~~~~~~~~~~~~~~~~~~~~
Tests for pyltsv.
:copyright: (c) 2013 Shinya Ohyanagi, All rights reserved.
:license: BSD, see LICENSE for more details.
"""
import os
from unittest import TestCase
from pyltsv import parse_file, parse_line
class TestLts... |
vortex-ape/scikit-learn | refs/heads/master | sklearn/preprocessing/imputation.py | 16 | # Authors: Nicolas Tresegnie <nicolas.tresegnie@gmail.com>
# License: BSD 3 clause
import warnings
import numpy as np
import numpy.ma as ma
from scipy import sparse
from scipy import stats
from ..base import BaseEstimator, TransformerMixin
from ..utils import check_array
from ..utils import deprecated
from ..utils.s... |
eddyb/servo | refs/heads/master | tests/wpt/web-platform-tests/webdriver/tests/support/__init__.py | 48 | from merge_dictionaries import merge_dictionaries
|
kubaszostak/gdal-dragndrop | refs/heads/master | osgeo/apps/Python27/Lib/encodings/koi8_r.py | 93 | """ Python Character Mapping Codec koi8_r generated from 'MAPPINGS/VENDORS/MISC/KOI8-R.TXT' with gencodec.py.
"""#"
import codecs
### Codec APIs
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self... |
nathanielvarona/airflow | refs/heads/master | airflow/providers/google/cloud/transfers/bigquery_to_mysql.py | 1 | #
# 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... |
Hiestaa/3D-Lsystem | refs/heads/master | graphx/__init__.py | 1 | __all__ = ['Graphx', 'Camera'] |
yolowtf/idunnosomething | refs/heads/master | resources/site-packages/stream/utils.py | 2 | from contextlib import contextmanager
import xbmcgui
VIDEO_CODECS = {
"x264": "h264",
"h264": "h264",
"xvid": "xvid",
}
AUDIO_CODECS = {
"mp3": "mp3",
"aac": "aac",
"dts": "dts",
"ac3": "ac3",
"5.1ch": "ac3",
"dd5.1ch": "ac3",
}
RESOLUTIONS = {
# "dvdscr": (853, 480),
# "d... |
RonnyPfannschmidt/pip | refs/heads/develop | tests/unit/test_download.py | 2 | import hashlib
import os
from io import BytesIO
from shutil import copy, rmtree
from tempfile import mkdtemp
import pytest
from mock import Mock, patch
from pip._vendor.six.moves.urllib import request as urllib_request
import pip
from pip._internal.download import (
MultiDomainBasicAuth, PipSession, SafeFileCache... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.