repo_name stringlengths 5 100 | ref stringlengths 12 67 | path stringlengths 4 244 | copies stringlengths 1 8 | content stringlengths 0 1.05M ⌀ |
|---|---|---|---|---|
explora26/zephyr | refs/heads/master | scripts/gen_idt.py | 2 | #!/usr/bin/env python3
#
# Copyright (c) 2017 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
import argparse
import sys
import struct
import os
import elftools
from distutils.version import LooseVersion
from elftools.elf.elffile import ELFFile
from elftools.elf.sections import SymbolTableSection
if LooseVe... |
Lilykos/inspire-next | refs/heads/master | inspire/modules/harvester/tasks/world_scientific.py | 2 | # -*- coding: utf-8 -*-
#
## This file is part of INSPIRE.
## Copyright (C) 2014, 2015 CERN.
##
## INSPIRE 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 opti... |
yongtang/tensorflow | refs/heads/master | tensorflow/python/feature_column/sequence_feature_column.py | 13 | # Copyright 2018 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... |
saurabh6790/medsyn-app | refs/heads/master | manufacturing/doctype/bom/bom.py | 30 | # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
from webnotes.utils import cint, cstr, flt, now, nowdate
from webnotes.model.doc import addchild
from webnotes.model.bean import getl... |
sankhesh/VTK | refs/heads/master | ThirdParty/Twisted/twisted/internet/test/test_gtkreactor.py | 28 | # Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests to ensure all attributes of L{twisted.internet.gtkreactor} are
deprecated.
"""
import sys
from twisted.trial.unittest import TestCase
class GtkReactorDeprecation(TestCase):
"""
Tests to ensure all attributes of L{twisted.int... |
mhnatiuk/phd_sociology_of_religion | refs/heads/master | scrapper/build/scrapy/scrapy/xlib/tx/__init__.py | 161 | from scrapy import twisted_version
if twisted_version > (13, 0, 0):
from twisted.web import client
from twisted.internet import endpoints
if twisted_version >= (11, 1, 0):
from . import client, endpoints
else:
from scrapy.exceptions import NotSupported
class _Mocked(object):
def __init__(sel... |
mhdella/scikit-learn | refs/heads/master | sklearn/covariance/tests/test_graph_lasso.py | 272 | """ Test the graph_lasso module.
"""
import sys
import numpy as np
from scipy import linalg
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_array_less
from sklearn.covariance import (graph_lasso, GraphLasso, GraphLassoCV,
empirical_... |
luiscarlosgph/nas | refs/heads/master | env/lib/python2.7/site-packages/django/conf/locale/el/formats.py | 49 | # -*- 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 = 'd E Y'
TIME_FORMAT = 'g:i:s A'
# ... |
xkmato/ureport | refs/heads/master | ureport/countries/management/commands/__init__.py | 14 | __author__ = 'norkans7'
|
glwu/python-for-android | refs/heads/master | python3-alpha/python3-src/Lib/test/test_setcomps.py | 201 | doctests = """
########### Tests mostly copied from test_listcomps.py ############
Test simple loop with conditional
>>> sum({i*i for i in range(100) if i&1 == 1})
166650
Test simple case
>>> {2*y + x + 1 for x in (0,) for y in (1,)}
{3}
Test simple nesting
>>> list(sorted({(i,j) for i in rang... |
ssuthiku/linux | refs/heads/master | tools/perf/scripts/python/sctop.py | 1996 | # system call top
# (c) 2010, Tom Zanussi <tzanussi@gmail.com>
# Licensed under the terms of the GNU GPL License version 2
#
# Periodically displays system-wide system call totals, broken down by
# syscall. If a [comm] arg is specified, only syscalls called by
# [comm] are displayed. If an [interval] arg is specified,... |
ptpt/taoblog | refs/heads/master | taoblog/application.py | 1 | __all__ = ['application']
import os
import tempfile
from flask import Flask
from .views import configure_app
from .models import bind_engine
DEBUG = False
DATABASE_ECHO = False
DATABASE_URI = 'sqlite:///%s' % tempfile.mkstemp()[1]
POST_PERPAGE = 8
POST_API_PERPAGE = 20
POST_FEED_PERPAGE = 20
# no one is admin by def... |
trakerr-com/trakerr-python | refs/heads/master | trakerr_client/models/stack_trace_lines.py | 3 | # coding: utf-8
"""
Trakerr API
Get your application events and errors to Trakerr via the *Trakerr API*.
OpenAPI spec version: 1.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file... |
palmtree5/Red-DiscordBot | refs/heads/V3/py39 | redbot/cogs/trivia/log.py | 4 | """Log for Trivia cog."""
import logging
__all__ = ["LOG"]
LOG = logging.getLogger("red.trivia")
|
bealdav/OpenUpgrade | refs/heads/8.0 | openerp/addons/base/workflow/workflow.py | 33 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (C) 2004-2014 OpenERP S.A. (<http://openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms o... |
ondra-novak/chromium.src | refs/heads/nw | tools/perf/benchmarks/media.py | 32 | # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from measurements import media
import page_sets
from telemetry import benchmark
from telemetry.page import page_test
from telemetry.value import list_of_scal... |
andrespires/python-buildpack | refs/heads/master | vendor/pip-pop/pip/utils/outdated.py | 191 | from __future__ import absolute_import
import datetime
import json
import logging
import os.path
import sys
from pip._vendor import lockfile
from pip._vendor.packaging import version as packaging_version
from pip.compat import total_seconds, WINDOWS
from pip.index import PyPI
from pip.locations import USER_CACHE_DIR... |
TNT-Samuel/Coding-Projects | refs/heads/master | DNS Server/Source - Copy/Lib/xmlrpc/client.py | 11 | #
# XML-RPC CLIENT LIBRARY
# $Id$
#
# an XML-RPC client interface for Python.
#
# the marshalling and response parser code can also be used to
# implement XML-RPC servers.
#
# Notes:
# this version is designed to work with Python 2.1 or newer.
#
# History:
# 1999-01-14 fl Created
# 1999-01-15 fl Changed dateTime to u... |
Justin-Yuan/Image2Music-Generator | refs/heads/master | library/jython2.5.3/Lib/test/test_threading_jy.py | 9 | """Misc threading module tests
Made for Jython.
"""
from __future__ import with_statement
import random
import subprocess
import sys
import threading
import time
import unittest
from subprocess import PIPE, Popen
from test import test_support
from threading import Condition, Lock, Thread
from java.lang import Thread... |
anthonylife/EventRecommendation | refs/heads/master | script/cntNumUserAttend.py | 1 | #!/usr/bin/env python
#encoding=utf8
#Copyright [2014] [Wei Zhang]
#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 ... |
wlerin/streamlink | refs/heads/master | src/streamlink/stream/flvconcat.py | 6 | from __future__ import division
import logging
from collections import namedtuple
from io import IOBase
from itertools import chain, islice
from threading import Thread
from ..buffers import RingBuffer
from ..packages.flashmedia import FLVError
from ..packages.flashmedia.tag import (AudioData, AACAudioData, VideoData... |
listen-lavender/webcrawl | refs/heads/master | webcrawl/queue/lib/__init__.py | 1 | #!/usr/bin/env python
# coding=utf8
import redis |
rlefevre1/hpp-rbprm-corba | refs/heads/modifs | script/dynamic/downSlope_hrp2_pathKino.py | 1 | from hpp.corbaserver.rbprm.rbprmbuilder import Builder
from hpp.gepetto import Viewer
from hpp.corbaserver import Client
from hpp.corbaserver.robot import Robot as Parent
from hpp.corbaserver.rbprm.problem_solver import ProblemSolver
class Robot (Parent):
rootJointType = 'freeflyer'
packageName = 'hpp-rbprm-corba'
... |
gangadharkadam/letzerp | refs/heads/v5.0 | erpnext/templates/pages/product_search.py | 35 | # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils import cstr
from erpnext.setup.doctype.item_group.item_group import get_item_for_list_in_html
no_cache = 1
no_sitema... |
jelugbo/hebs_master | refs/heads/master | lms/djangoapps/notifier_api/serializers.py | 14 | from django.contrib.auth.models import User
from django.http import Http404
from rest_framework import serializers
from course_groups.cohorts import is_course_cohorted
from notification_prefs import NOTIFICATION_PREF_KEY
from lang_pref import LANGUAGE_KEY
class NotifierUserSerializer(serializers.ModelSerializer):
... |
hendradarwin/VTK | refs/heads/master | Examples/GUI/Python/OrthogonalPlanesWithTkPhoto.py | 9 | import vtk
from vtk import *
import Tkinter
from Tkinter import *
import sys, os
import vtk.tk
import vtk.tk.vtkLoadPythonTkWidgets
import vtk.tk.vtkTkImageViewerWidget
from vtk.tk.vtkTkPhotoImage import *
from vtk.util.misc import *
class SampleViewer:
def __init__ ( self ):
self.Tk = Tk = Tkinter.Tk();
... |
dslomov/intellij-community | refs/heads/master | python/helpers/pydev/pycompletion.py | 56 | #!/usr/bin/python
'''
@author Radim Kubacki
'''
import _pydev_imports_tipper
import traceback
import StringIO
import sys
import urllib
import pycompletionserver
#=======================================================================================================================
# GetImports
#======================... |
bsipocz/scikit-image | refs/heads/master | skimage/feature/tests/test_orb.py | 20 | import numpy as np
from numpy.testing import assert_equal, assert_almost_equal, run_module_suite
from skimage.feature import ORB
from skimage import data
from skimage.color import rgb2gray
from skimage._shared.testing import test_parallel
img = rgb2gray(data.lena())
@test_parallel()
def test_keypoints_orb_desired_n... |
Microvellum/Fluid-Designer | refs/heads/master | win64-vc/2.78/Python/bin/2.78/scripts/addons_contrib/io_export_md3.py | 1 | # ##### BEGIN GPL LICENSE BLOCK #####
#
# 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 is distrib... |
SkyTruth/luigi | refs/heads/master | luigi/s3.py | 38 | # -*- coding: utf-8 -*-
#
# Copyright 2012-2015 Spotify AB
#
# 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... |
lifeeth/Zeya | refs/heads/master | directory.py | 1 | # -*- coding: utf-8 -*-
#
# Copyright (C) 2009 Samson Yeung, Phil Sung
#
# This file is part of Zeya.
#
# Zeya 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 you... |
chrisdunelm/grpc | refs/heads/master | third_party/nanopb/tests/site_scons/site_tools/nanopb.py | 79 | '''
Scons Builder for nanopb .proto definitions.
This tool will locate the nanopb generator and use it to generate .pb.c and
.pb.h files from the .proto files.
Basic example
-------------
# Build myproto.pb.c and myproto.pb.h from myproto.proto
myproto = env.NanopbProto("myproto")
# Link nanopb core to the program
e... |
whbrewer/spc | refs/heads/master | src/gluino/contrib/pymysql/util.py | 95 | import struct
def byte2int(b):
if isinstance(b, int):
return b
else:
return struct.unpack("!B", b)[0]
def int2byte(i):
return struct.pack("!B", i)
def join_bytes(bs):
if len(bs) == 0:
return ""
else:
rv = bs[0]
for b in bs[1:]:
rv += b
r... |
denys-duchier/django | refs/heads/master | tests/order_with_respect_to/base_tests.py | 63 | """
The tests are shared with contenttypes_tests and so shouldn't import or
reference any models directly. Subclasses should inherit django.test.TestCase.
"""
from operator import attrgetter
class BaseOrderWithRespectToTests:
# Hook to allow subclasses to run these tests with alternate models.
Answer = None
... |
perfidia/pytenseshift | refs/heads/master | en/parser/nltk_lite/corpora/gutenberg.py | 9 | # Natural Language Toolkit: Gutenberg Corpus Reader
#
# Copyright (C) 2001-2006 University of Pennsylvania
# Author: Steven Bird <sb@ldc.upenn.edu>
# Edward Loper <edloper@gradient.cis.upenn.edu>
# URL: <http://nltk.sf.net>
# For license information, see LICENSE.TXT
"""
Read tokens from the NLTK Gutenberg Corp... |
silly-wacky-3-town-toon/SOURCE-COD | refs/heads/master | toontown/suit/DistributedLawbotBossSuit.py | 1 | from panda3d.core import *
from panda3d.direct import *
from direct.interval.IntervalGlobal import *
from direct.fsm import ClassicFSM, State
from direct.fsm import State
from direct.directnotify import DirectNotifyGlobal
import DistributedSuitBase
from toontown.toonbase import ToontownGlobals
from toontown.battle impo... |
retr0h/ansible | refs/heads/devel | lib/ansible/inventory/ini.py | 1 | # (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... |
hasadna/OpenCommunity | refs/heads/master | src/communities/notifications.py | 1 | """Services for sending notifications to community members."""
import logging
import datetime
from itertools import chain
from django.conf import settings
from django.core.mail import EmailMultiAlternatives
from django.template.loader import render_to_string
from django.utils import translation
import django_rq
from co... |
videetssinghai/Blog-Rest-Api | refs/heads/master | lib/python2.7/site-packages/pip/utils/build.py | 899 | from __future__ import absolute_import
import os.path
import tempfile
from pip.utils import rmtree
class BuildDirectory(object):
def __init__(self, name=None, delete=None):
# If we were not given an explicit directory, and we were not given an
# explicit delete option, then we'll default to del... |
rmk135/objects | refs/heads/master | examples/miniapps/decoupled-packages/example/photo/repositories.py | 2 | """Photo repositories module."""
class PhotoRepository:
def __init__(self, entity_factory, fs, db):
self.entity_factory = entity_factory
self.fs = fs
self.db = db
def get_photos(self, user_id):
return [self.entity_factory() for _ in range(user_id*5)]
|
Aeva/waterworks | refs/heads/master | waterworks/waterworks.py | 1 |
# This file is part of Waterworks
#
# Waterworks 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.
#
# Waterworks is distributed in the ... |
kuangrewawa/OnosFw | refs/heads/master | tools/test/topos/chordal.py | 41 | """
"""
from mininet.topo import Topo
from mininet.net import Mininet
from mininet.node import RemoteController
from mininet.node import Node
from mininet.node import CPULimitedHost
from mininet.link import TCLink
from mininet.cli import CLI
from mininet.log import setLogLevel
from mininet.util import dumpNodeConnectio... |
CINPLA/expipe-dev | refs/heads/master | exana/exana/tracking/fields.py | 1 | import numpy as np
import quantities as pq
def spatial_rate_map(x, y, t, sptr, binsize=0.01*pq.m, box_xlen=1*pq.m,
box_ylen=1*pq.m, mask_unvisited=True, convolve=True,
return_bins=False, smoothing=0.02):
"""Divide a 2D space in bins of size binsize**2, count the number of... |
edlabh/SickRage | refs/heads/master | lib/unidecode/x079.py | 252 | data = (
'Tani ', # 0x00
'Jiao ', # 0x01
'[?] ', # 0x02
'Zhang ', # 0x03
'Qiao ', # 0x04
'Dun ', # 0x05
'Xian ', # 0x06
'Yu ', # 0x07
'Zhui ', # 0x08
'He ', # 0x09
'Huo ', # 0x0a
'Zhai ', # 0x0b
'Lei ', # 0x0c
'Ke ', # 0x0d
'Chu ', # 0x0e
'Ji ', # 0x0f
'Que ', # 0x10
'... |
mancoast/CPythonPyc_test | refs/heads/master | fail/334_test_fcntl.py | 24 | """Test program for the fcntl C module.
OS/2+EMX doesn't support the file locking operations.
"""
import platform
import os
import struct
import sys
import _testcapi
import unittest
from test.support import verbose, TESTFN, unlink, run_unittest, import_module
# Skip test if no fcntl module.
fcntl = import_module('fc... |
widdowquinn/find_differential_primers | refs/heads/diagnostic_primers | diagnostic_primers/scripts/subcommands/subcmd_primersearch.py | 1 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""subcmd_primersearch.py
Provides the primersearch subcommand for pdp.py
(c) The James Hutton Institute 2017-19
Author: Leighton Pritchard
Contact: leighton.pritchard@hutton.ac.uk
Leighton Pritchard,
Information and Computing Sciences,
James Hutton Institute,
Errol Ro... |
dturner-tw/pants | refs/heads/master | src/python/pants/option/global_options.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)
import logging
impor... |
RevelSystems/django | refs/heads/master | tests/gis_tests/geoapp/test_serializers.py | 50 | from __future__ import unicode_literals
import json
from django.contrib.gis.geos import HAS_GEOS
from django.core import serializers
from django.test import TestCase, skipUnlessDBFeature
if HAS_GEOS:
from django.contrib.gis.geos import LinearRing, Point, Polygon
from .models import City, MultiFields, Pennsyl... |
BaileySN/RAID_Reporter | refs/heads/master | bin/hostinfo.py | 1 | import os
import socket
if os.name != "nt":
import fcntl
import struct
def get_interface(ifname):
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
return socket.inet_ntoa(fcntl.ioctl(s.fileno(), 0x8915, struct.pack('256s', ifname[:15]))[20:24])
def hostaddr():
ip = socket.gethost... |
shawncaojob/LC | refs/heads/master | LINTCODE/29_interleaving_string.py | 1 | class Solution:
"""
@param: s1: A string
@param: s2: A string
@param: s3: A string
@return: Determine whether s3 is formed by interleaving of s1 and s2
"""
def isInterleave(self, s1, s2, s3):
# write your code here
n1, n2, n3 = len(s1), len(s2), len(s3)
if n1 + n2 != ... |
analyseuc3m/ANALYSE-v1 | refs/heads/master | cms/djangoapps/contentstore/management/commands/tests/test_create_course.py | 137 | """
Unittests for creating a course in an chosen modulestore
"""
import unittest
import ddt
from django.core.management import CommandError, call_command
from contentstore.management.commands.create_course import Command
from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.tests.django_utils import... |
meteorcloudy/tensorflow | refs/heads/master | tensorflow/contrib/rpc/python/ops/rpc_op.py | 41 | # Copyright 2018 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... |
omprakasha/odoo | refs/heads/8.0 | addons/sale/res_partner.py | 236 | # -*- 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... |
Immortalin/python-for-android | refs/heads/master | python-modules/twisted/twisted/python/dxprofile.py | 61 | # Copyright (c) 2001-2007 Twisted Matrix Laboratories.
# See LICENSE for details.
"""
DEPRECATED since Twisted 8.0.
Utility functions for reporting bytecode frequencies to Skip Montanaro's
stat collector.
This module requires a version of Python build with DYNAMIC_EXCUTION_PROFILE,
and optionally DXPAIRS, defined to... |
argaen/aiocache | refs/heads/master | aiocache/plugins.py | 1 | """
This module implements different plugins you can attach to your cache instance. They
are coded in a collaborative so you can use multiple inheritance.
"""
from aiocache.base import API
class BasePlugin:
@classmethod
def add_hook(cls, func, hooks):
for hook in hooks:
setattr(cls, hook,... |
boucman/systemd | refs/heads/master | tools/gdb-sd_dump_hashmaps.py | 14 | #!/usr/bin/env python3
# -*- Mode: python; coding: utf-8; indent-tabs-mode: nil -*- */
#
# This file is part of systemd.
#
# Copyright 2014 Michal Schmidt
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free So... |
congma/pypar | refs/heads/cma-devel | src/ext/pypar_balancer.py | 2 | # coding: UTF-8
"""
Simple load balancing with pypar
(based on demo3.py from pypar demo package)
Felix Richter <felix.richter2@uni-rostock.de>
"""
import sys
import time
import numpy
import pypar
PYPAR_WORKTAG = 1
PYPAR_DIETAG = 2
def mprint(txt):
"""
Print message txt
with indentation following the node... |
biggihs/python-pptx | refs/heads/master | features/steps/chart.py | 1 | # encoding: utf-8
"""
Gherkin step implementations for chart features.
"""
from __future__ import absolute_import, print_function
import hashlib
from itertools import islice
from behave import given, then, when
from pptx import Presentation
from pptx.chart.chart import Legend
from pptx.chart.data import (
Bub... |
smmosquera/serge | refs/heads/master | tools/template/startup.py | 2 | """Main startup file for %(name)s"""
from optparse import OptionParser
import sys
import os
if sys.version_info[0] == 3:
print 'Python 3 is not supported'
sys.exit(1)
elif sys.version_info[1] <= 5:
print 'Python 2.6+ is required'
sys.exit(1)
import serge.common
%(pymunk_code)s
parser = OptionParser(... |
lewer/gensim | refs/heads/develop | gensim/models/rpmodel.py | 70 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
import logging
import itertools
import numpy
import scipy
from gensim import interfaces, matutils, utils
logger = logging.getLogger... |
infobloxopen/netmri-toolkit | refs/heads/master | Python/getsubinterfaces.py | 1 | #Device subinterface data retrieval script. Copyright Ingmar Van Glabbeek ingmar@infoblox.com
#Licensed under Apache-2.0
#This script will pull all devices of a given device group and then list the devices management ip as well as the available management ips.
#By default it saves the output to "deviceinterfacedump.js... |
FusionSP/android_external_chromium_org | refs/heads/lp5.1 | components/policy/tools/syntax_check_policy_template_json.py | 34 | #!/usr/bin/env python
# Copyright (c) 2012 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.
'''
Checks a policy_templates.json file for conformity to its syntax specification.
'''
import json
import optparse
import os
impo... |
xyb/micropython | refs/heads/master | tests/basics/dict_setdefault.py | 116 | d = {}
print(d.setdefault(1))
print(d.setdefault(1))
print(d.setdefault(5, 42))
print(d.setdefault(5, 1))
print(d[1])
print(d[5])
d.pop(5)
print(d.setdefault(5, 1))
print(d[1])
print(d[5])
|
bernardopires/django-tenant-schemas | refs/heads/master | dts_test_project/dts_test_app/migrations/0003_test_add_db_index.py | 2 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('dts_test_app', '0002_test_drop_unique'),
]
operations = [
migrations.AddField(
... |
wyg3958/django-cms | refs/heads/develop | cms/extensions/admin.py | 51 | from cms.models import Page, Title
from django.contrib import admin
from django.contrib.admin.options import csrf_protect_m
from django.core.exceptions import PermissionDenied
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
class ExtensionAdmin(admin.ModelAdmin):
change_f... |
adobe-flash/avmplus | refs/heads/master | build/buildbot/master/custom/buildbot_ext/steps/shellAddons.py | 8 | # -*- test-case-name: buildbot.test.test_steps,buildbot.test.test_properties -*-
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from buildbot.steps.shell import Shell... |
replica-con-k/easyvideo | refs/heads/master | tests/08_layer_draw.py | 1 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
import test
test.start('Layer drawing')
import easyvideo.screen
scr = easyvideo.screen.Screen()
import random
import pygame
def _randint(max_val):
return random.randint(0, max_val)
for circle in range(100):
try:
pygame.draw.circle(scr.background.layer... |
hkhamm/django_rest_tutorial_2 | refs/heads/master | env/lib/python2.7/site-packages/pip/_vendor/distlib/util.py | 163 | #
# Copyright (C) 2012-2013 The Python Software Foundation.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
import codecs
from collections import deque
import contextlib
import csv
from glob import iglob as std_iglob
import io
import json
import logging
import os
import py_compile
import re
import shutil
import socket
import... |
bowlofstew/pycparser | refs/heads/master | tests/all_tests.py | 23 | #!/usr/bin/env python
import sys
sys.path[0:0] = ['.', '..']
import unittest
suite = unittest.TestLoader().loadTestsFromNames(
[
'test_c_lexer',
'test_c_ast',
'test_general',
'test_c_parser',
'test_c_generator',
]
)
testresult = unittest.TextTestRunner(verbosity=1).r... |
rombie/contrail-controller | refs/heads/master | src/container/kube-manager/kube_manager/tests/vnc/test_vnc_pod.py | 1 | #
# Copyright (c) 2017 Juniper Networks, Inc. All rights reserved.
#
import uuid
from collections import namedtuple
import ipaddress
import unittest
from cfgm_common.exceptions import NoIdError
import mock
from kube_manager.tests.vnc.test_case import KMTestCase
from kube_manager.common.kube_config_db import (Namespa... |
xfournet/intellij-community | refs/heads/master | python/testData/mover/innerIf_afterDown.py | 83 | if value is not None:
if not False or value <= 2:
pass
print "here"
|
microcom/odoo | refs/heads/9.0 | addons/website_event_sale/__init__.py | 1023 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import controllers
import models
|
telefonicaid/perseo-fe | refs/heads/master | test/acceptance/integration/notifications/__init__.py | 5 | # -*- coding: utf-8 -*-
#
# Copyright 2015 Telefonica Investigación y Desarrollo, S.A.U
#
# This file is part of perseo-fe
#
# perseo-fe 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 ... |
YiqunPeng/Leetcode-pyq | refs/heads/master | solutions/800SimilarRGBColor.py | 1 | class Solution:
def similarRGB(self, color):
"""
:type color: str
:rtype: str
"""
dic = {'0':0,'1':1,'2':2,'3':3,'4':4,'5':5,'6':6,'7':7,'8':8,
'9':9,'a':10,'b':11,'c':12,'d':13,'e':14,'f':15}
ans = '#'
for i in range(3):
... |
FireWRT/OpenWrt-Firefly-Libraries | refs/heads/master | staging_dir/target-mipsel_1004kc+dsp_uClibc-0.9.33.2/usr/lib/python3.4/email/errors.py | 120 | # Copyright (C) 2001-2006 Python Software Foundation
# Author: Barry Warsaw
# Contact: email-sig@python.org
"""email package exception classes."""
class MessageError(Exception):
"""Base class for errors in the email package."""
class MessageParseError(MessageError):
"""Base class for message parsing errors... |
mjtamlyn/django | refs/heads/master | tests/custom_pk/models.py | 106 | """
Using a custom primary key
By default, Django adds an ``"id"`` field to each model. But you can override
this behavior by explicitly adding ``primary_key=True`` to a field.
"""
from django.db import models
from .fields import MyAutoField
class Employee(models.Model):
employee_code = models.IntegerField(pri... |
joone/chromium-crosswalk | refs/heads/2016.04.css-round-display-edtior-draft-1 | native_client_sdk/src/build_tools/tests/test_projects_test.py | 45 | #!/usr/bin/env python
# Copyright (c) 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 os
import sys
import unittest
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
BUILD_TOOLS_DIR = os.path.dirname(SCR... |
mlperf/training_results_v0.6 | refs/heads/master | Fujitsu/benchmarks/resnet/implementations/mxnet/3rdparty/tvm/topi/tests/python/test_topi_conv2d_nhwc.py | 1 | """Example code to do convolution."""
import os
import numpy as np
import tvm
import topi
import topi.testing
from tvm.contrib.pickle_memoize import memoize
from topi.util import get_const_tuple
def verify_conv2d_nhwc(batch, in_channel, in_size, num_filter, kernel, stride, padding, dilation=1):
in_height = in_wid... |
iamutkarshtiwari/sympy | refs/heads/master | sympy/core/numbers.py | 26 | from __future__ import print_function, division
import decimal
import fractions
import math
import re as regex
from collections import defaultdict
from .containers import Tuple
from .sympify import converter, sympify, _sympify, SympifyError
from .singleton import S, Singleton
from .expr import Expr, AtomicExpr
from .... |
OsirisSPS/osiris-sps | refs/heads/master | client/share/plugins/AF9A4C281070FDB0F34CF417CDB168AB38C8A388/lib/plat-mac/lib-scriptpackages/Terminal/__init__.py | 73 | """
Package generated from /Applications/Utilities/Terminal.app
"""
from warnings import warnpy3k
warnpy3k("In 3.x, the Terminal module is removed.", stacklevel=2)
import aetools
Error = aetools.Error
import Standard_Suite
import Text_Suite
import Terminal_Suite
_code_to_module = {
'????' : Standard_Suite,
... |
gavioto/folly | refs/heads/master | folly/build/generate_format_tables.py | 61 | #!/usr/bin/env python
#
# Generate Format tables
import os
from optparse import OptionParser
OUTPUT_FILE = "FormatTables.cpp"
def generate_table(f, type_name, name, map):
f.write("extern const {0} {1}[] = {{".format(type_name, name))
for i in range(0, 256):
if i % 2 == 0:
f.write("\n ")... |
dednal/chromium.src | refs/heads/nw12 | tools/git/git-diff-ide.py | 197 | #!/usr/bin/env python
# Copyright (c) 2012 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.
"""
Invokes git diff [args...] and inserts file:line in front of each line of diff
output where possible.
This is useful fro... |
tuc-osg/micropython | refs/heads/master | esp8266/modules/ds18x20.py | 33 | # DS18x20 temperature sensor driver for MicroPython.
# MIT license; Copyright (c) 2016 Damien P. George
from micropython import const
_CONVERT = const(0x44)
_RD_SCRATCH = const(0xbe)
_WR_SCRATCH = const(0x4e)
class DS18X20:
def __init__(self, onewire):
self.ow = onewire
self.buf = bytearray(9)
... |
fangxingli/hue | refs/heads/master | apps/beeswax/src/beeswax/urls.py | 1 | #!/usr/bin/env python
# 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 ma... |
ctasims/Dive-Into-Python-3 | refs/heads/master | examples/plural4.py | 1 | '''Pluralize English nouns (stage 4)
Command line usage:
$ python plural4.py noun
nouns
'''
import re
def build_match_and_apply_functions(pattern, search, replace):
def matches_rule(word):
return re.search(pattern, word)
def apply_rule(word):
return re.sub(search, replace, word)
return (m... |
Peddle/hue | refs/heads/master | desktop/core/ext-py/lxml-3.3.6/src/lxml/tests/test_etree.py | 11 | # -*- coding: utf-8 -*-
"""
Tests specific to the extended etree API
Tests that apply to the general ElementTree API should go into
test_elementtree
"""
import os.path
import unittest
import copy
import sys
import re
import gc
import operator
import tempfile
import zlib
import gzip
this_dir = os.path.dirname(__file... |
laurent-george/weboob | refs/heads/master | modules/europarl/test.py | 7 | # -*- coding: utf-8 -*-
# Copyright(C) 2010-2011 Romain Bignon
# Copyright(C) 2012 François Revol
#
# This file is part of weboob.
#
# weboob 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 vers... |
nburn42/tensorflow | refs/heads/master | tensorflow/contrib/training/python/training/training_test.py | 44 | # 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 applicable ... |
narry/odenos | refs/heads/develop | src/test/python/org/o3project/__init__.py | 233 | # -*- coding:utf-8 -*-
# Copyright 2015 NEC Corporation. #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); #
# you may not use this file except in compliance with the License... |
aestrivex/mne-python | refs/heads/master | examples/stats/plot_cluster_1samp_test_time_frequency.py | 5 | """
===============================================================
Non-parametric 1 sample cluster statistic on single trial power
===============================================================
This script shows how to estimate significant clusters
in time-frequency power estimates. It uses a non-parametric
statisti... |
whereismyjetpack/ansible | refs/heads/devel | lib/ansible/plugins/filter/json_query.py | 93 | # (c) 2015, Filipe Niero Felisbino <filipenf@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 l... |
nacc/autotest | refs/heads/master | frontend/tko/models.py | 3 | from django.db import models as dbmodels, connection
from django.utils import datastructures
from autotest.frontend.afe import model_logic, readonly_connection
_quote_name = connection.ops.quote_name
class TempManager(model_logic.ExtendedManager):
_GROUP_COUNT_NAME = 'group_count'
def _get_key_unless_is_func... |
calfonso/ansible | refs/heads/devel | test/units/modules/network/nxos/test_nxos_vxlan_vtep.py | 57 | # (c) 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 dis... |
mewtaylor/django | refs/heads/master | django/core/management/commands/test.py | 267 | import logging
import os
import sys
from django.conf import settings
from django.core.management.base import BaseCommand
from django.test.utils import get_runner
class Command(BaseCommand):
help = 'Discover and run tests in the specified modules or the current directory.'
requires_system_checks = False
... |
baylee-d/osf.io | refs/heads/develop | addons/base/generic_views.py | 9 | """Generic add-on view factories"""
# -*- coding: utf-8 -*-
from rest_framework import status as http_status
from flask import request
from framework.exceptions import HTTPError, PermissionsError
from framework.auth.decorators import must_be_logged_in
from osf.models import ExternalAccount
from osf.utils import per... |
funkyfuture/cerberus | refs/heads/master | cerberus/tests/test_rule_…length.py | 2 | from random import choice
from string import ascii_lowercase
from cerberus import errors
from cerberus.tests import assert_fail, assert_success
def test_minlength_and_maxlength_with_list(schema):
field = 'a_list_length'
min_length = schema[field]['minlength']
max_length = schema[field]['maxlength']
... |
75651/kbengine_cloud | refs/heads/master | kbe/src/lib/python/Lib/nturl2path.py | 89 | """Convert a NT pathname to a file URL and vice versa."""
def url2pathname(url):
"""OS-specific conversion from a relative URL of the 'file' scheme
to a file system path; not recommended for general use."""
# e.g.
# ///C|/foo/bar/spam.foo
# becomes
# C:\foo\bar\spam.foo
import string, urlli... |
mou4e/zirconium | refs/heads/master | tools/valgrind/browser_wrapper_win.py | 76 | # Copyright (c) 2011 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 glob
import os
import re
import sys
import subprocess
# TODO(timurrrr): we may use it on POSIX too to avoid code duplication once we
# support la... |
a40223217/cadpw12 | refs/heads/master | wsgi/application_orig.py | 135 | ################################# 1. 宣告原始碼 coding, 導入必要模組
#coding=utf-8
import cherrypy
import random
# for path setup
import os
# for mako
from mako.lookup import TemplateLookup
################################# 2. 全域變數設定, 近端與遠端目錄設定
cwd = os.getcwd()
if 'OPENSHIFT_REPO_DIR' in os.environ.keys():
# 表示程式在雲端執行
... |
polyaxon/polyaxon | refs/heads/master | core/polyaxon/vendor/pynvml.py | 1 | #####
# Copyright (c) 2011-2015, NVIDIA Corporation. 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.