repo_name stringlengths 5 100 | ref stringlengths 12 67 | path stringlengths 4 244 | copies stringlengths 1 8 | content stringlengths 0 1.05M ⌀ |
|---|---|---|---|---|
Jiangshangmin/mpld3 | refs/heads/master | mpld3/utils.py | 16 | """
mpld3 Utilities
===============
Utility routines for the mpld3 package
"""
import os
import re
import shutil
import warnings
from functools import wraps
from . import urls
# Make sure that DeprecationWarning gets printed
warnings.simplefilter("always", DeprecationWarning)
def html_id_ok(objid, html5=False):
... |
ning/collector | refs/heads/master | src/utils/py/opsAlert/constants.py | 305 | #
# Autogenerated by Thrift
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
from thrift.Thrift import *
from ttypes import *
|
kstaniek/csm | refs/heads/master | csmserver/horizon/package_lib.py | 1 | # =============================================================================
#
# Copyright (c) 2013, Cisco Systems
# 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... |
vmindru/ansible-modules-core | refs/heads/devel | cloud/openstack/_quantum_subnet.py | 41 | #!/usr/bin/python
#coding: utf-8 -*-
# (c) 2013, Benno Joy <benno@ansible.com>
#
# This module 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 ... |
leansoft/edx-platform | refs/heads/master | lms/djangoapps/bulk_email/migrations/0001_initial.py | 182 | # -*- coding: utf-8 -*-
from south.db import db
from south.v2 import SchemaMigration
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'CourseEmail'
db.create_table('bulk_email_courseemail', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True... |
DirtyUnicorns/android_external_chromium_org | refs/heads/lollipop | tools/telemetry/telemetry/value/list_of_scalar_values_unittest.py | 29 | # 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 os
import unittest
from telemetry import value
from telemetry.page import page_set
from telemetry.value import list_of_scalar_values
from telemetry.va... |
openwns/wrowser | refs/heads/master | openwns/wrowser/Time.py | 1 | ###############################################################################
# This file is part of openWNS (open Wireless Network Simulator)
# _____________________________________________________________________________
#
# Copyright (C) 2004-2007
# Chair of Communication Networks (ComNets)
# Kopernikusstr. 16, D-... |
jamespcole/home-assistant | refs/heads/master | homeassistant/components/input_text/__init__.py | 10 | """Support to enter a value into a text box."""
import logging
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.const import (
ATTR_ENTITY_ID, ATTR_UNIT_OF_MEASUREMENT, CONF_ICON, CONF_NAME, CONF_MODE)
from homeassistant.helpers.entity_component import EntityCompone... |
nkgilley/home-assistant | refs/heads/dev | homeassistant/components/zha/core/channels/__init__.py | 7 | """Channels module for Zigbee Home Automation."""
import asyncio
import logging
from typing import Any, Dict, List, Optional, Tuple, Union
import zigpy.zcl.clusters.closures
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_send
from . import ( # noqa: F401 # pyli... |
brburns/netdisco | refs/heads/master | example_service.py | 5 | """
Example use of DiscoveryService.
Will scan every 10 seconds and print out new found entries.
Will quit after 2 minutes.
"""
from __future__ import print_function
import logging
from datetime import datetime
import time
from netdisco.service import DiscoveryService
logging.basicConfig(level=logging.INFO)
# Sca... |
petemounce/ansible | refs/heads/devel | lib/ansible/plugins/inventory/yaml.py | 4 | # Copyright 2017 RedHat, 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 i... |
NathanW2/QGIS | refs/heads/master | python/plugins/processing/algs/qgis/VectorLayerHistogram.py | 2 | # -*- coding: utf-8 -*-
"""
***************************************************************************
VectorLayerHistogram.py
---------------------
Date : January 2013
Copyright : (C) 2013 by Victor Olaya
Email : volayaf at gmail dot com
*****************... |
xuxiao19910803/edx | refs/heads/master | lms/djangoapps/instructor/tests/test_legacy_xss.py | 46 | """
Tests of various instructor dashboard features that include lists of students
"""
from django.conf import settings
from django.test.client import RequestFactory
from markupsafe import escape
from nose.plugins.attrib import attr
from student.tests.factories import UserFactory, CourseEnrollmentFactory
from edxmako.... |
deathmetalland/IkaLog | refs/heads/youtube_sample | tools/IkaWatcher.py | 3 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# IkaLog
# ======
# Copyright (C) 2016 Takeshi HASEGAWA
# Copyright (C) 2016 Hiroyuki KOMATSU
#
# 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 Lice... |
cuteio/cute-python-client | refs/heads/master | cute.py | 1 | def cute():
print 'This is cute egg'
|
madhurrajn/samashthi | refs/heads/master | lib/gevent/greenlet.py | 9 | # Copyright (c) 2009-2012 Denis Bilenko. See LICENSE for details.
import sys
from gevent.hub import GreenletExit
from gevent.hub import InvalidSwitchError
from gevent.hub import PY3
from gevent.hub import PYPY
from gevent.hub import Waiter
from gevent.hub import get_hub
from gevent.hub import getcurrent
from gevent.hu... |
lmmsoft/LeetCode | refs/heads/master | LeetCode-Algorithm/0852. Peak Index in a Mountain Array/852.py | 1 | from typing import List
class Solution:
def peakIndexInMountainArray1(self, A: List[int]) -> int:
return A.index(max(A))
def peakIndexInMountainArray2(self, A: List[int]) -> int:
l, r = 0, len(A) - 1
while l < r:
mid = (l + r) // 2
if A[mid] > A[mid + 1]: # 因为... |
xen0l/ansible | refs/heads/devel | lib/ansible/modules/network/edgeos/edgeos_facts.py | 68 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2018 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... |
TNick/pylearn2 | refs/heads/master | pylearn2/datasets/tests/test_wiskott.py | 45 | """module to test datasets.wiskott"""
from pylearn2.datasets.wiskott import Wiskott
import unittest
from pylearn2.testing.skip import skip_if_no_data
from pylearn2.utils import isfinite
import numpy as np
def test_wiskott():
"""loads wiskott dataset"""
skip_if_no_data()
data = Wiskott()
assert isfinit... |
AlanZatarain/visvis.dev | refs/heads/master | core/light.py | 5 | # -*- coding: utf-8 -*-
# Copyright (C) 2012, Almar Klein
#
# Visvis is distributed under the terms of the (new) BSD License.
# The full license can be found in 'license.txt'.
""" Module light
Defines a light source to light polygonal surfaces. Each axes has up
to eight lights associated with it.
"""
import OpenGL.... |
gauribhoite/personfinder | refs/heads/master | env/google_appengine/backends_conversion.py | 69 | #!/usr/bin/env python
#
# Copyright 2007 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... |
stefanv/scipy3 | refs/heads/master | scipy/sparse/extract.py | 3 | """Functions to extract parts of sparse matrices
"""
__docformat__ = "restructuredtext en"
__all__ = ['find', 'tril', 'triu']
from coo import coo_matrix
def find(A):
"""Return the indices and values of the nonzero elements of a matrix
Parameters
----------
A : dense or sparse matrix
Matrix... |
LaoZhongGu/kbengine | refs/heads/master | kbe/res/scripts/common/Lib/test/test_with.py | 83 | #!/usr/bin/env python3
"""Unit tests for the with statement specified in PEP 343."""
__author__ = "Mike Bland"
__email__ = "mbland at acm dot org"
import sys
import unittest
from collections import deque
from contextlib import _GeneratorContextManager, contextmanager
from test.support import run_unittest
class Mo... |
zhengyongbo/phantomjs | refs/heads/master | src/breakpad/src/tools/gyp/pylib/gyp/common.py | 137 | #!/usr/bin/python
# Copyright (c) 2009 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.
import errno
import filecmp
import os.path
import re
import tempfile
import sys
def ExceptionAppend(e, msg):
"""Append a message to the given... |
bratatidas9/Impala-1 | refs/heads/cdh5-trunk | tests/query_test/test_delimited_text.py | 13 | # Copyright (c) 2012 Cloudera, Inc. All rights reserved.
# Targeted Impala tests for different tuple delimiters, field delimiters,
# and escape characters.
#
from tests.common.test_vector import *
from tests.common.impala_test_suite import *
from tests.common.test_dimensions import create_exec_option_dimension
from tes... |
gabriel-laet/graphql-py | refs/heads/master | graphql/core/execution/middlewares/sync.py | 2 | from graphql.core.defer import Deferred
from graphql.core.error import GraphQLError
class SynchronousExecutionMiddleware(object):
def run_resolve_fn(self, resolver, original_resolver):
result = resolver()
if isinstance(result, Deferred):
raise GraphQLError('You cannot return a Deferred... |
yamada-h/ryu | refs/heads/master | ryu/tests/unit/cmd/dummy_openflow_app.py | 56 | # Copyright (C) 2013,2014 Nippon Telegraph and Telephone Corporation.
# Copyright (C) 2013,2014 YAMAMOTO Takashi <yamamoto at valinux co jp>
#
# 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
#
... |
gardner/youtube-dl | refs/heads/master | youtube_dl/extractor/moevideo.py | 112 | # coding: utf-8
from __future__ import unicode_literals
import json
import re
from .common import InfoExtractor
from ..compat import (
compat_urllib_parse,
compat_urllib_request,
)
from ..utils import (
ExtractorError,
int_or_none,
)
class MoeVideoIE(InfoExtractor):
IE_DESC = 'LetitBit video ser... |
amjith/python-prompt-toolkit | refs/heads/master | examples/auto-suggestion.py | 3 | #!/usr/bin/env python
"""
Simple example of a CLI that demonstrates fish-style auto suggestion.
When you type some input, it will match the input against the history. If One
entry of the history starts with the given input, then it will show the
remaining part as a suggestion. Pressing the right arrow will insert this... |
krintoxi/NoobSec-Toolkit | refs/heads/master | NoobSecToolkit /tools/sqli/waf/cloudflare.py | 10 | #!/usr/bin/env python
"""
Copyright (c) 2006-2015 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
import re
from lib.core.enums import HTTP_HEADER
from lib.core.settings import WAF_ATTACK_VECTORS
__product__ = "CloudFlare Web Application Firewall (CloudFlare)"
def detec... |
brianrock/brianrock-ringo | refs/heads/master | third_party/simplejson/tests/test_encode_for_html.py | 132 | import unittest
import simplejson.decoder
import simplejson.encoder
class TestEncodeForHTML(unittest.TestCase):
def setUp(self):
self.decoder = simplejson.decoder.JSONDecoder()
self.encoder = simplejson.encoder.JSONEncoderForHTML()
def test_basic_encode(self):
self.assertEqual(r'"\u... |
sigmavirus24/rpc-openstack | refs/heads/master | maas/plugins/horizon_check.py | 1 | #!/usr/bin/env python
# Copyright 2014, Rackspace US, 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 applicabl... |
edxnercel/edx-platform | refs/heads/master | cms/djangoapps/contentstore/management/commands/utils.py | 112 | """
Common methods for cms commands to use
"""
from django.contrib.auth.models import User
def user_from_str(identifier):
"""
Return a user identified by the given string. The string could be an email
address, or a stringified integer corresponding to the ID of the user in
the database. If no user cou... |
ibinti/intellij-community | refs/heads/master | python/testData/completion/instanceFromFunctionAssignedToCallAttr.py | 39 | class Foo(object):
bar = True
class FooMaker(object):
def foo(self):
return Foo()
__call__ = foo
fm = FooMaker()
f3 = fm()
f3.b<caret> |
xzYue/odoo | refs/heads/8.0 | addons/l10n_si/__init__.py | 439 | # -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright: (C) 2012 - Mentis d.o.o., Dravograd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affe... |
171121130/SWI | refs/heads/master | venv/Lib/site-packages/openpyxl/chart/label.py | 3 | from openpyxl.descriptors.serialisable import Serialisable
from openpyxl.descriptors import (
Typed,
String,
Integer,
Bool,
Set,
Float,
Sequence,
Alias
)
from openpyxl.descriptors.excel import ExtensionList
from openpyxl.descriptors.nested import (
NestedNoneSet,
NestedBool,
... |
kittiu/sale-workflow | refs/heads/10.0 | sale_procurement_group_by_line/model/__init__.py | 1 | # -*- coding: utf-8 -*-
# Copyright 2013-2014 Camptocamp SA - Guewen Baconnier
# © 2016 Eficent Business and IT Consulting Services S.L.
# © 2016 Serpent Consulting Services Pvt. Ltd.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import sale
|
mxjl620/scikit-learn | refs/heads/master | sklearn/manifold/tests/test_mds.py | 324 | import numpy as np
from numpy.testing import assert_array_almost_equal
from nose.tools import assert_raises
from sklearn.manifold import mds
def test_smacof():
# test metric smacof using the data of "Modern Multidimensional Scaling",
# Borg & Groenen, p 154
sim = np.array([[0, 5, 3, 4],
... |
labcodes/django | refs/heads/master | tests/template_tests/filter_tests/test_yesno.py | 430 | from django.template.defaultfilters import yesno
from django.test import SimpleTestCase
class FunctionTests(SimpleTestCase):
def test_true(self):
self.assertEqual(yesno(True), 'yes')
def test_false(self):
self.assertEqual(yesno(False), 'no')
def test_none(self):
self.assertEqual... |
lancezlin/pyjs | refs/heads/master | pyjswidgets/pyjamas/Canvas/ImageLoaderhulahop.py | 7 | """
* 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 or agreed to in writing, s... |
abdullah2891/remo | refs/heads/master | vendor-local/lib/python/unidecode/x095.py | 252 | data = (
'Xiao ', # 0x00
'Suo ', # 0x01
'Li ', # 0x02
'Zheng ', # 0x03
'Chu ', # 0x04
'Guo ', # 0x05
'Gao ', # 0x06
'Tie ', # 0x07
'Xiu ', # 0x08
'Cuo ', # 0x09
'Lue ', # 0x0a
'Feng ', # 0x0b
'Xin ', # 0x0c
'Liu ', # 0x0d
'Kai ', # 0x0e
'Jian ', # 0x0f
'Rui ', # 0x10
'... |
alexconlin/three.js | refs/heads/master | utils/exporters/blender/addons/io_three/exporter/material.py | 70 | from .. import constants, logger
from . import base_classes, utilities, api
class Material(base_classes.BaseNode):
"""Class that wraps material nodes"""
def __init__(self, node, parent):
logger.debug("Material().__init__(%s)", node)
base_classes.BaseNode.__init__(self, node, parent,
... |
wrouesnel/ansible-modules-core | refs/heads/devel | cloud/rackspace/rax_clb_nodes.py | 157 | #!/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 distributed... |
NOAA-PMEL/PyFerret | refs/heads/master | pyfermod/regrid/regrid2dtests.py | 1 | '''
Unit tests for CurvRectRegridder
@author: Karl Smith
'''
from __future__ import print_function
import unittest
import numpy
import ESMP
from esmpcontrol import ESMPControl
from regrid2d import CurvRectRegridder
class CurvRectRegridderTests(unittest.TestCase):
'''
Unit tests for the CurvRectRegridder cl... |
linglaiyao1314/SFrame | refs/heads/master | oss_src/unity/python/sframe/meta/asttools/tests/test_sourcegen.py | 15 | '''
Created on Aug 3, 2011
@author: sean
'''
from __future__ import print_function
import unittest
import ast
from ...asttools.visitors.pysourcegen import SourceGen
from ...asttools.tests import AllTypesTested
from ...testing import py2only, py3only
tested = AllTypesTested()
def simple_expr(expr):
def test_sour... |
kylebegovich/ProjectEuler | refs/heads/master | Python/Solved/Page2/Problem57.py | 1 | def next_numerator(prev_numerator, prev_denominator):
return prev_numerator + (2*prev_denominator)
def next_denominator(next_numerator, prev_denominator):
# Yes, the numerator is purposefully next, not curr
return next_numerator - prev_denominator
if __name__ == '__main__':
curr_numerator = 3
c... |
grnet/synnefo | refs/heads/develop | snf-cyclades-app/synnefo/volume/urls.py | 1 | # Copyright (C) 2010-2016 GRNET S.A.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed i... |
GraemeFulton/job-search | refs/heads/master | docutils-0.12/test/test_parsers/test_rst/test_option_lists.py | 18 | #! /usr/bin/env python
# $Id: test_option_lists.py 7128 2011-09-17 18:00:35Z grubert $
# Author: David Goodger <goodger@python.org>
# Copyright: This module has been placed in the public domain.
"""
Tests for states.py.
"""
from __init__ import DocutilsTestSupport
def suite():
s = DocutilsTestSupport.ParserTest... |
jmcarp/django | refs/heads/master | tests/gis_tests/geogapp/tests.py | 253 | """
Tests for geography support in PostGIS
"""
from __future__ import unicode_literals
import os
from unittest import skipUnless
from django.contrib.gis.db.models.functions import Area, Distance
from django.contrib.gis.gdal import HAS_GDAL
from django.contrib.gis.measure import D
from django.test import TestCase, ign... |
damdam-s/OpenUpgrade | refs/heads/8.0 | addons/account_payment/wizard/account_payment_populate_statement.py | 274 | # -*- 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... |
rsunder10/PopularityBased-SearchEngine | refs/heads/master | lib/python3.4/site-packages/django/contrib/admindocs/middleware.py | 477 | from django import http
from django.conf import settings
class XViewMiddleware(object):
"""
Adds an X-View header to internal HEAD requests -- used by the documentation system.
"""
def process_view(self, request, view_func, view_args, view_kwargs):
"""
If the request method is HEAD and... |
martijnengler/mycli | refs/heads/master | mycli/key_bindings.py | 14 | import logging
from prompt_toolkit.keys import Keys
from prompt_toolkit.key_binding.manager import KeyBindingManager
from prompt_toolkit.filters import Condition
_logger = logging.getLogger(__name__)
def mycli_bindings(get_key_bindings, set_key_bindings):
"""
Custom key bindings for mycli.
"""
assert ... |
lxn2/mxnet | refs/heads/master | example/recommenders/matrix_fact.py | 15 | import math
import mxnet as mx
import numpy as np
import mxnet.notebook.callback
import logging
logging.basicConfig(level=logging.DEBUG)
def RMSE(label, pred):
ret = 0.0
n = 0.0
pred = pred.flatten()
for i in range(len(label)):
ret += (label[i] - pred[i]) * (label[i] - pred[i])
n += 1.... |
daveferrara1/linkchecker | refs/heads/master | third_party/miniboa-r42/hello_demo.py | 13 | #!/usr/bin/env python
#------------------------------------------------------------------------------
# hello_demo.py
# Copyright 2009 Jim Storch
# 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 ... |
jmargeta/scikit-learn | refs/heads/master | examples/hashing_vs_dict_vectorizer.py | 5 | """
===================================================================
Comparison of hashing-based and dictionary based text vectorization
===================================================================
Compares FeatureHasher and DictVectorizer by using both to vectorize
text documents.
The example demonstrates... |
ixc/glamkit-feincmstools | refs/heads/master | feincmstools/templatetags/feincmstools_tags.py | 1 | import os
from django import template
from feincms.templatetags.feincms_tags import feincms_render_content
register = template.Library()
@register.filter
def is_parent_of(page1, page2):
"""
Determines whether a given page is the parent of another page
Example:
{% if page|is_parent_of:feincms_page ... |
kickstandproject/sarlacc | refs/heads/master | sarlacc/tests/asterisk/agi/test_database_deltree.py | 1 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (C) 2013 PolyBeacon, Inc.
#
# Author: Paul Belanger <paul.belanger@polybeacon.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
#
#... |
masschallenge/django-accelerator | refs/heads/development | accelerator/tests/contexts/mentor_program_group_context.py | 1 | from accelerator.tests.contexts.mentor_user_context import MentorUserContext
from accelerator.tests.factories.named_group_factory import NamedGroupFactory
class MentorProgramGroupContext(object):
def __init__(self):
mentor_context1 = MentorUserContext()
mentor_context2 = MentorUserContext()
... |
KidFashion/boo | refs/heads/master | examples/misc/arrayperformance.py | 21 | from time import time
def test():
items = 2000000
array = tuple(range(items))
collect = []
start = time()
for i in xrange(items):
collect.append(array[i])
elapsed = time() - start
print elapsed*1000, " elapsed."
test()
test()
test()
|
inkcoin/inkcoin-project | refs/heads/master | share/qt/make_spinner.py | 4415 | #!/usr/bin/env python
# W.J. van der Laan, 2011
# Make spinning .mng animation from a .png
# Requires imagemagick 6.7+
from __future__ import division
from os import path
from PIL import Image
from subprocess import Popen
SRC='img/reload_scaled.png'
DST='../../src/qt/res/movies/update_spinner.mng'
TMPDIR='/tmp'
TMPNAM... |
raschuetz/foundations-homework | refs/heads/master | 07/data-analysis/bin/activate_this.py | 1076 | """By using execfile(this_file, dict(__file__=this_file)) you will
activate this virtualenv environment.
This can be used when you must use an existing Python interpreter, not
the virtualenv bin/python
"""
try:
__file__
except NameError:
raise AssertionError(
"You must run this like execfile('path/to/... |
danielkza/dnf | refs/heads/master | doc/__init__.py | 22 | # __init__.py
# DNF documentation package.
#
# Copyright (C) 2012-2013 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This pr... |
perezg/infoxchange | refs/heads/master | BASE/lib/python2.7/site-packages/tastypie/utils/formatting.py | 47 | from __future__ import unicode_literals
import email
import datetime
import time
from django.utils import dateformat
from tastypie.utils.timezone import make_aware, make_naive, aware_datetime
# Try to use dateutil for maximum date-parsing niceness. Fall back to
# hard-coded RFC2822 parsing if that's not possible.
try:... |
ah-anssi/SecuML | refs/heads/master | SecuML/experiments/experiment_db_tools.py | 1 | # SecuML
# Copyright (C) 2016-2017 ANSSI
#
# SecuML 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.
#
# SecuML is distributed in the h... |
luzheqi1987/nova-annotation | refs/heads/master | nova/cmd/cert.py | 37 | # Copyright 2012 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... |
ddrmanxbxfr/servo | refs/heads/master | tests/wpt/web-platform-tests/tools/pywebsocket/src/mod_pywebsocket/handshake/_base.py | 652 | # Copyright 2012, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... |
bop/bauhaus | refs/heads/master | lib/python2.7/site-packages/django/test/simple.py | 108 | """
This module is pending deprecation as of Django 1.6 and will be removed in
version 1.8.
"""
import json
import re
import unittest as real_unittest
import warnings
from django.db.models import get_app, get_apps
from django.test import _doctest as doctest
from django.test import runner
from django.test.utils import... |
nickdex/cosmos | refs/heads/master | code/dynamic_programming/src/coin_change/coin_change.py | 3 | #################
## dynamic programming | coin change | Python
## Part of Cosmos by OpenGenus Foundation
#################
def coin_change(coins, amount):
# init the dp table
tab = [0 for i in range(amount + 1)]
tab[0] = 1 # base case
for j in range(len(coins)):
for i in range(1, amount ... |
dr-prodigy/python-holidays | refs/heads/master | holidays/countries/georgia.py | 1 | # -*- coding: utf-8 -*-
# python-holidays
# ---------------
# A fast, efficient Python library for generating country, province and state
# specific sets of holidays on the fly. It aims to make determining whether a
# specific date is a holiday as fast and flexible as possible.
#
# Author: ryanss <ryanssdev@icl... |
jonmash/ardupilot | refs/heads/master | mk/PX4/Tools/gencpp/src/gencpp/__init__.py | 214 | # Software License Agreement (BSD License)
#
# Copyright (c) 2011, Willow Garage, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above ... |
timelapseplus/VIEW | refs/heads/master | node_modules/nodeimu/node_modules/node-gyp/gyp/pylib/gyp/MSVSUtil.py | 1812 | # Copyright (c) 2013 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.
"""Utility functions shared amongst the Windows generators."""
import copy
import os
# A dictionary mapping supported target types to extensions.
TARGET_TYPE_EX... |
c0defreak/python-for-android | refs/heads/master | python3-alpha/python3-src/Lib/turtledemo/__main__.py | 55 | #!/usr/bin/env python3
import sys
import os
from tkinter import *
from idlelib.Percolator import Percolator
from idlelib.ColorDelegator import ColorDelegator
from idlelib.textView import view_file # TextViewer
from imp import reload
import turtle
import time
demo_dir = os.path.dirname(os.path.abspath(__file__))
STA... |
Chilledheart/chromium | refs/heads/master | tools/telemetry/third_party/gsutilz/third_party/boto/tests/integration/gs/util.py | 101 | # Copyright (c) 2012, Google, Inc.
# 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 the rights to use, copy, modify... |
Boggart/-tg-station | refs/heads/master | bot/C_srtd.py | 36 | import random
def srtd(data,debug,sender):
try:
arg1,arg2 = data.split("d")
except ValueError, err:
if str(err) == "need more than 1 value to unpack":
return("Too small amount of arguments")
else:
return("Too many arguments")
else:
if debug:
print sender+":!rtd "+arg1+... |
galaxy001/libtorrent | refs/heads/master | python_BTL_BitTorrent-5.3-GPL/BTL/greenlet_coro.py | 5 | # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# bu... |
neurotechuoft/MindType | refs/heads/master | Code/V1/src/deprecated/pyqtgraph/graphicsItems/CurvePoint.py | 21 | from ..Qt import QtGui, QtCore
from . import ArrowItem
import numpy as np
from ..Point import Point
import weakref
from .GraphicsObject import GraphicsObject
__all__ = ['CurvePoint', 'CurveArrow']
class CurvePoint(GraphicsObject):
"""A GraphicsItem that sets its location to a point on a PlotCurveItem.
Also rot... |
Azure/azure-sdk-for-python | refs/heads/sync-eng/common-js-nightly-docs-2-1768-ForTestPipeline | sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_12_01/operations/_network_watchers_operations.py | 1 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
naojsoft/qplan | refs/heads/master | qplan/q2ope.py | 1 | #!/usr/bin/env python
#
# q2ope.py -- Queue integration with legacy OPE
#
# Eric Jeschke (eric@naoj.org)
#
"""
Usage:
q2ope.py
"""
from __future__ import print_function
# stdlib imports
import sys, os
from io import BytesIO, StringIO
# 3rd party imports
from ginga.misc import log
# Local imports
from . import ent... |
wrouesnel/ansible | refs/heads/devel | test/units/modules/network/vyos/test_vyos_user.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... |
SanketDG/contributr | refs/heads/master | contributr/contributr/wsgi.py | 3 | """
WSGI config for contributr project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
if os.environ.get("DJANGO_SETTIN... |
rezoo/chainer | refs/heads/master | chainer/functions/math/fix.py | 4 | import chainer
from chainer.backends import cuda
from chainer import utils
def fix(x):
"""Elementwise fix function.
.. math::
y_i = \\lfix x_i \\rfix
Args:
x (~chainer.Variable): Input variable.
Returns:
~chainer.Variable: Output variable.
"""
if isinstance(x, chaine... |
gogobebe2/thefuck | refs/heads/master | tests/conftest.py | 14 | import pytest
@pytest.fixture
def no_memoize(monkeypatch):
monkeypatch.setattr('thefuck.utils.memoize.disabled', True)
|
daltonsena/eyed3 | refs/heads/master | src/test/id3/test_tag.py | 1 | # -*- coding: utf-8 -*-
################################################################################
# Copyright (C) 2011-2012 Travis Shirk <travis@pobox.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Fr... |
gamahead/nupic | refs/heads/master | nupic/regions/ImageSensorExplorers/ExhaustiveSweep.py | 17 | # ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... |
ppn029012/One-man-band | refs/heads/master | hackcamp/taps.py | 2 | import numpy as np
#import pyaudio
import struct
import math
# import pylab as pl
import time
import pygame as pg
import pygame.mixer as pm
import alsaaudio, time, audioop
pm.init()
string=['a','b','c','d']
channela=pm.Sound('beat.wav')
channelb=pm.Sound('hihat.wav')
channelc=pm.Sound(string[0]+'.wav')... |
jcftang/ansible | refs/heads/devel | lib/ansible/modules/network/nxos/nxos_ospf_vrf.py | 8 | #!/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... |
slingcoin/sling-market | refs/heads/master | test/functional/importprunedfunds.py | 34 | #!/usr/bin/env python3
# Copyright (c) 2014-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the importprunedfunds and removeprunedfunds RPCs."""
from test_framework.test_framework import Bit... |
JFriel/honours_project | refs/heads/master | networkx/build/lib/networkx/algorithms/centrality/betweenness_subset.py | 10 | """
Betweenness centrality measures for subsets of nodes.
"""
# Copyright (C) 2004-2015 by
# Aric Hagberg <hagberg@lanl.gov>
# Dan Schult <dschult@colgate.edu>
# Pieter Swart <swart@lanl.gov>
# All rights reserved.
# BSD license.
__author__ = """Aric Hagberg (hagberg@lanl.gov)"""
__all__ = ['between... |
nicecapj/crossplatfromMmorpgServer | refs/heads/master | ThirdParty/googletest/googlemock/scripts/generator/cpp/ast.py | 384 | #!/usr/bin/env python
#
# Copyright 2007 Neal Norwitz
# Portions Copyright 2007 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... |
funkyHat/cloudify-gcp-plugin | refs/heads/master | cloudify_gcp/compute/tests/test_health_check.py | 1 | # -*- coding: utf-8 -*-
########
# Copyright (c) 2016 GigaSpaces Technologies Ltd. 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/license... |
roadmapper/ansible | refs/heads/devel | lib/ansible/modules/cloud/amazon/iam_saml_federation.py | 18 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# 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.
#
... |
ryfeus/lambda-packs | refs/heads/master | Keras_tensorflow_nightly/source2.7/tensorflow/tools/api/generator/api/keras/datasets/imdb/__init__.py | 1 | """Imports for Python API.
This file is MACHINE GENERATED! Do not edit.
Generated by: tensorflow/tools/api/generator/create_python_api.py script.
"""
from tensorflow.python.keras._impl.keras.datasets.imdb import get_word_index
from tensorflow.python.keras._impl.keras.datasets.imdb import load_data |
shakamunyi/neutron-vrrp | refs/heads/master | neutron/plugins/nec/db/router.py | 15 | # Copyright 2013 NEC Corporation. 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 ... |
Tvlistings/tuxtrax | refs/heads/master | runserver.py | 2 | import os
os.environ["DEBUG"] = "true"
import penguicontrax
penguicontrax.init()
app = penguicontrax.app
apppath = os.path.abspath(os.path.dirname(__file__))
extra_dirs = [apppath + '/penguicontrax/templates/js']
extra_files = extra_dirs[:]
for extra_dir in extra_dirs:
for dirname, dirs, files in os.... |
marianotepper/dask | refs/heads/master | dask/dataframe/tests/test_io.py | 3 | import gzip
import pandas as pd
import numpy as np
import pandas.util.testing as tm
import os
import dask
import bcolz
from pframe import pframe
from operator import getitem
from toolz import valmap
import dask.dataframe as dd
from dask.dataframe.io import (read_csv, file_size, categories_and_quantiles,
datafr... |
guileschool/BEAGLEBONE-tutorials | refs/heads/master | BBB-firmware/u-boot-v2018.05-rc2/tools/dtoc/dtb_platdata.py | 1 | #!/usr/bin/python
#
# Copyright (C) 2017 Google, Inc
# Written by Simon Glass <sjg@chromium.org>
#
# SPDX-License-Identifier: GPL-2.0+
#
"""Device tree to platform data class
This supports converting device tree data to C structures definitions and
static data.
"""
import collections
import copy
import sys
import f... |
alexcuellar/odoo | refs/heads/8.0 | addons/l10n_es/migrations/8.0.5.1/pre-migration.py | 52 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2015 Serv. Tecnol. Avanz. (<http://www.serviciosbaeza.com>)
# Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
#
# This progra... |
theotherphp/relay | refs/heads/master | relay_rfid.py | 1 | """
Read and write RFID tags for the Relay app
"""
import argparse
from functools import partial
import logging
from signal import signal, SIGTERM, SIGINT
import sys
import time
import mercury
from relay_config import Config
from relay_websocket import RelayWebsocket
logging.basicConfig(
name=__name__,
filen... |
Volune/npm | refs/heads/master | node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py | 1407 | # Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
This module helps emulate Visual Studio 2008 behavior on top of other
build systems, primarily ninja.
"""
import os
import re
import subprocess
import sys
fr... |
tchernomax/ansible | refs/heads/devel | test/units/modules/network/ios/test_ios_vlan.py | 12 | # (c) 2018 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.