repo_name stringlengths 5 100 | path stringlengths 4 375 | copies stringclasses 991
values | size stringlengths 4 7 | content stringlengths 666 1M | license stringclasses 15
values |
|---|---|---|---|---|---|
vipins/ccccms | env/Lib/site-packages/setuptools/tests/server.py | 452 | 2651 | """Basic http server for tests to simulate PyPI or custom indexes
"""
import sys
import time
import threading
from setuptools.compat import BaseHTTPRequestHandler
from setuptools.compat import (urllib2, URLError, HTTPServer,
SimpleHTTPRequestHandler)
class IndexServer(HTTPServer):
""... | bsd-3-clause |
jvs/sourcer | sourcer/expressions/str.py | 1 | 1444 | from outsourcer import Code
from . import utils
from .base import Expression
from .constants import POS, RESULT, STATUS, TEXT
class Str(Expression):
is_commented = False
def __init__(self, value):
if not isinstance(value, (bytes, str)):
raise TypeError(f'Expected bytes or str. Received: ... | mit |
rhiever/bokeh | sphinx/source/docs/tutorials/exercises/unemployment.py | 23 | 2160 | import numpy as np
from bokeh.models import HoverTool
from bokeh.plotting import ColumnDataSource, figure, output_file, show
from bokeh.sampledata.unemployment1948 import data
# Read in the data with pandas. Convert the year column to string
data['Year'] = [str(x) for x in data['Year']]
years = list(data['Year'])
mon... | bsd-3-clause |
heiher/libreoffice-core | scripting/examples/python/HelloWorld.py | 12 | 1539 | # HelloWorld python script for the scripting framework
#
# This file is part of the LibreOffice project.
#
# 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/.
#
# This file... | gpl-3.0 |
abrowning80/solutions-geoevent-java | data/packages/geoprocessing/visibility/Toolshare/scripts/makefeature.py | 6 | 1382 | #-------------------------------------------------------------------------------
# Name: module2
# Purpose:
#
# Author: patr5136
#
# Created: 23/08/2013
# Copyright: (c) patr5136 2013
# Licence: <your licence>
#-------------------------------------------------------------------------------
import ... | apache-2.0 |
ccarouge/cwsl-mas | cwsl/core/file_creator.py | 4 | 11088 | """
Authors: Tim Bedin, Tim Erwin
Copyright 2014 CSIRO
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 w... | apache-2.0 |
knxd/PyKNyX | tests/core/dptXlator/dptXlator2ByteFloat.py | 2 | 2328 | # -*- coding: utf-8 -*-
from pyknyx.core.dptXlator.dptXlator2ByteFloat import *
import unittest
# Mute logger
from pyknyx.services.logger import logging
logger = logging.getLogger(__name__)
logging.getLogger("pyknyx").setLevel(logging.ERROR)
class DPTXlator2ByteFloatTestCase(unittest.TestCase):
def setUp(self):... | gpl-3.0 |
wweiradio/django | django/conf/locale/zh_Hant/formats.py | 1008 | 1810 | # -*- 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 = 'Y年n月j日' # 2016年9月5... | bsd-3-clause |
ycl2045/nova-master | nova/tests/integrated/v3/test_security_groups.py | 29 | 2233 | # Copyright 2012 Nebula, Inc.
# Copyright 2013 IBM Corp.
#
# 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... | apache-2.0 |
dannyboi104/SickRage | sickbeard/providers/t411.py | 2 | 9980 | # -*- coding: latin-1 -*-
# Author: djoole <bobby.djoole@gmail.com>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of Sick Beard.
#
# Sick Beard 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... | gpl-3.0 |
444thLiao/VarappX | tests/data_models/test_users.py | 2 | 3481 | #!/usr/bin/env python3
import unittest
import django.test
from varapp.data_models.users import *
from varapp.models.users import *
from django.conf import settings
class TestUser(unittest.TestCase):
def test_user_constructor(self):
s = User('A', 'a@a', 'code', '', 1, Person(firstname='A'), Role('guest'))
... | gpl-3.0 |
bmerry/mlsgpu | utils/simulate.py | 1 | 12858 | #!/usr/bin/env python
# mlsgpu: surface reconstruction from point clouds
# Copyright (C) 2013 University of Cape Town
#
# This file is part of mlsgpu.
#
# mlsgpu 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 Foundatio... | gpl-3.0 |
kc4271/batch_downloader | requests/packages/urllib3/contrib/pyopenssl.py | 304 | 15086 | '''SSL with SNI_-support for Python 2. Follow these instructions if you would
like to verify SSL certificates in Python 2. Note, the default libraries do
*not* do certificate checking; you need to do additional work to validate
certificates yourself.
This needs the following packages installed:
* pyOpenSSL (tested wi... | mit |
elahejalalpour/ELRyu | ryu/services/protocols/bgp/operator/commands/show/memory.py | 27 | 2971 | import gc
import sys
from ryu.services.protocols.bgp.operator.command import Command
from ryu.services.protocols.bgp.operator.command import CommandsResponse
from ryu.services.protocols.bgp.operator.command import STATUS_ERROR
from ryu.services.protocols.bgp.operator.command import STATUS_OK
class Memory(Command):
... | apache-2.0 |
drunken-economist/euler-project | 008_largest_product_in_series.py | 1 | 2731 | # The four adjacent digits in the 1000-digit number that have the greatest product are 9 x 9 x 8 x 9 = 5832
# 73167176531330624919225119674426574742355349194934
# 96983520312774506326239578318016984801869478851843
# 85861560789112949495459501737958331952853208805511
# 12540698747158523863050715693290963295227443043557... | mit |
mastizada/pontoon | pontoon/base/migrations/0049_create_translation_memory_entries.py | 3 | 1418 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
def create_translation_memory_entries(apps, schema):
Translation = apps.get_model('base', 'Translation')
TranslationMemoryEntry = apps.get_model('base', 'TranslationMemoryEntry')
def get_memory_entry(... | bsd-3-clause |
kosgroup/odoo | addons/note/models/note.py | 2 | 5954 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models, _
from odoo.tools import html2plaintext
class Stage(models.Model):
_name = "note.stage"
_description = "Note Stage"
_order = 'sequence'
name = fields.Char('Stage ... | gpl-3.0 |
magicrub/MissionPlanner | Lib/distutils/version.py | 59 | 11732 | #
# distutils/version.py
#
# Implements multiple version numbering conventions for the
# Python Module Distribution Utilities.
#
# $Id$
#
"""Provides classes to represent module version numbers (one class for
each style of version numbering). There are currently two such classes
implemented: StrictVersion ... | gpl-3.0 |
ukanga/SickRage | sickbeard/search.py | 3 | 30233 | # coding=utf-8
# Author: Nic Wolfe <nic@wolfeden.ca>
# URL: https://sickrage.github.io
# Git: https://github.com/SickRage/SickRage.git
#
# This file is part of SickRage.
#
# SickRage 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... | gpl-3.0 |
ghchinoy/tensorflow | tensorflow/python/tools/freeze_graph_test.py | 4 | 13446 | # 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... | apache-2.0 |
2014cdbg4/2015cd_midterm2 | static/Brython3.1.1-20150328-091302/Lib/types.py | 756 | 3167 | """
Define names for built-in types that aren't directly accessible as a builtin.
"""
import sys
# Iterators in Python aren't a matter of type but of protocol. A large
# and changing number of builtin types implement *some* flavor of
# iterator. Don't check the type! Use hasattr to check for both
# "__iter__" and "... | gpl-2.0 |
BeZazz/lamebench | nb_third_party/dns/rdtypes/IN/WKS.py | 248 | 4116 | # Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose with or without fee is hereby granted,
# provided that the above copyright notice and this permission notice
# appear in all copies.
#
# THE SOFTWARE IS PROVIDED ... | apache-2.0 |
kod3r/neon | neon/backends/tests/test_batched_dot.py | 10 | 3638 | # ----------------------------------------------------------------------------
# Copyright 2015 Nervana Systems 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.o... | apache-2.0 |
cntnboys/410Lab6 | build/django/build/lib.linux-x86_64-2.7/django/db/backends/mysql/validation.py | 65 | 1311 | from django.core import checks
from django.db.backends import BaseDatabaseValidation
class DatabaseValidation(BaseDatabaseValidation):
def check_field(self, field, **kwargs):
"""
MySQL has the following field length restriction:
No character (varchar) fields can have a length exceeding 255... | apache-2.0 |
jostep/tensorflow | tensorflow/python/kernel_tests/string_to_number_op_test.py | 104 | 4041 | # 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... | apache-2.0 |
zhwei/cabric | cabric/perm.py | 1 | 2522 | # -*- coding: utf-8 -*-
from fabric.api import *
from cabric.cmd import cmd_expanduser,cmd_su
import os
def put_public_key(path=None, user=None):
"""
Upload pub key from remote server.
Limit: Openssh standard key,must comment with user mail.
:param path:local path
:param user:remote username
... | mit |
vvv1559/intellij-community | python/lib/Lib/site-packages/django/utils/_os.py | 71 | 2011 | import os
from os.path import join, normcase, normpath, abspath, isabs, sep
from django.utils.encoding import force_unicode
# Define our own abspath function that can handle joining
# unicode paths to a current working directory that has non-ASCII
# characters in it. This isn't necessary on Windows since the
# Wind... | apache-2.0 |
sparkslabs/kamaelia_ | Sketches/DK/Kamaelia-Paint/App/XYPad.py | 3 | 22735 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
# http://www.kamaelia.org/AUTHORS - please extend this file,
# not this notice.
#
# Licensed under the Apache License, ... | apache-2.0 |
fhaoquan/kbengine | kbe/src/lib/python/Lib/test/list_tests.py | 106 | 17676 | """
Tests common to list and UserList.UserList
"""
import sys
import os
from functools import cmp_to_key
from test import support, seq_tests
class CommonTest(seq_tests.CommonTest):
def test_init(self):
# Iterable arg is optional
self.assertEqual(self.type2test([]), self.type2test())
# ... | lgpl-3.0 |
jakesyl/pychess | testing/draw.py | 21 | 1665 | import unittest
from pychess.Savers import pgn
from pychess.Utils.lutils import ldraw
class DrawTestCase(unittest.TestCase):
def setUp(self):
with open('gamefiles/3fold.pgn') as f1:
self.PgnFile1 = pgn.load(f1)
with open('gamefiles/bilbao.pgn') as f2:
self.PgnFil... | gpl-3.0 |
takis/django | django/template/__init__.py | 198 | 2022 | """
Django's support for templates.
The django.template namespace contains two independent subsystems:
1. Multiple Template Engines: support for pluggable template backends,
built-in backends and backend-independent APIs
2. Django Template Language: Django's own template engine, including its
built-in loaders, ... | bsd-3-clause |
chirilo/kitsune | kitsune/search/tests/test_plugin.py | 15 | 1279 | from django.contrib.sites.models import Site
import mock
from nose.tools import eq_
from kitsune.sumo.tests import TestCase
from kitsune.sumo.urlresolvers import reverse
class OpenSearchTestCase(TestCase):
"""Test the SUMO OpenSearch plugin."""
@mock.patch.object(Site.objects, 'get_current')
def test_p... | bsd-3-clause |
CognetTestbed/COGNET_CODE | LIB_NETLINK/libnl-3-android-nogit/python/netlink/route/links/vlan.py | 13 | 1943 | #
# Copyright (c) 2011 Thomas Graf <tgraf@suug.ch>
#
"""VLAN network link
"""
from __future__ import absolute_import
from ... import core as netlink
from .. import capi as capi
class VLANLink(object):
def __init__(self, link):
self._link = link
@property
@netlink.nlattr(type=int)
def id(s... | gpl-3.0 |
pixelrebel/st2 | st2actions/st2actions/resultstracker/resultstracker.py | 5 | 4285 | # Licensed to the StackStorm, Inc ('StackStorm') 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 use th... | apache-2.0 |
HLFH/CouchPotatoServer | couchpotato/core/media/movie/providers/trailer/youtube_dl/extractor/walla.py | 27 | 2976 | # coding: utf-8
from __future__ import unicode_literals
import re
from .subtitles import SubtitlesInfoExtractor
from ..utils import (
xpath_text,
int_or_none,
)
class WallaIE(SubtitlesInfoExtractor):
_VALID_URL = r'http://vod\.walla\.co\.il/[^/]+/(?P<id>\d+)/(?P<display_id>.+)'
_TEST = {
'ur... | gpl-3.0 |
wrouesnel/ansible | lib/ansible/plugins/callback/full_skip.py | 25 | 2290 | # (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
# (c) 2017 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = '''
... | gpl-3.0 |
Sergiojimenez/criticas_del_doctor_Mabuse | node_modules/gulp-sass/node_modules/node-sass/node_modules/node-gyp/gyp/PRESUBMIT.py | 1369 | 3662 | # 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.
"""Top-level presubmit script for GYP.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more details about the presubmit API built... | mit |
jithinbp/pslab-desktop-apps | psl_res/GUI/Z_SCHOOL_LEVEL/A_voltage_fundamentals/K_LDR.py | 2 | 3951 | #!/usr/bin/python
"""
::
This experiment is used to study........
"""
from __future__ import print_function
from PSL_Apps.utilitiesClass import utilitiesClass
from PSL_Apps.templates import ui_template_graph_nofft as template_graph_nofft
import numpy as np
from PyQt4 import QtGui,QtCore
import pyqtgraph as p... | gpl-3.0 |
proxysh/Safejumper-for-Mac | buildlinux/env32/lib/python2.7/site-packages/Crypto/PublicKey/pubkey.py | 125 | 8221 | #
# pubkey.py : Internal functions for public key operations
#
# Part of the Python Cryptography Toolkit
#
# Written by Andrew Kuchling, Paul Swartz, and others
#
# ===================================================================
# The contents of this file are dedicated to the public domain. To
# the extent th... | gpl-2.0 |
eMerzh/Diamond-1 | src/diamond/handler/g_metric.py | 52 | 2760 | # coding=utf-8
"""
Emulate a gmetric client for usage with
[Ganglia Monitoring System](http://ganglia.sourceforge.net/)
"""
from Handler import Handler
import logging
try:
import gmetric
except ImportError:
gmetric = None
class GmetricHandler(Handler):
"""
Implements the abstract Handler class, send... | mit |
groschovskiy/lerigos_music | Server/API/lib/bson/min_key.py | 55 | 1324 | # Copyright 2010-2015 MongoDB, 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 writin... | apache-2.0 |
sharadagarwal/autorest | AutoRest/Generators/Python/Python.Tests/AcceptanceTests/file_tests.py | 2 | 5671 | # --------------------------------------------------------------------------
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the ""Software""),... | mit |
openshift/openshift-tools | openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_openshift/src/class/oc_edit.py | 21 | 3384 | # pylint: skip-file
# flake8: noqa
class Edit(OpenShiftCLI):
''' Class to wrap the oc command line tools
'''
# pylint: disable=too-many-arguments
def __init__(self,
kind,
namespace,
resource_name=None,
kubeconfig='/etc/origin/master/ad... | apache-2.0 |
FederatedAI/FATE | python/fate_test/fate_test/flow_test/flow_process.py | 1 | 17149 | import json
import os
import tarfile
import time
from contextlib import closing
from datetime import datetime
import requests
def get_dict_from_file(file_name):
with open(file_name, 'r', encoding='utf-8') as f:
json_info = json.load(f)
return json_info
class Base(object):
def __init__(self, ser... | apache-2.0 |
Lambdanaut/crits | crits/campaigns/forms.py | 15 | 2173 | from django import forms
from django.forms.widgets import HiddenInput
from crits.campaigns.campaign import Campaign
from crits.core.forms import add_bucketlist_to_form, add_ticket_to_form
from crits.core.handlers import get_item_names
class AddCampaignForm(forms.Form):
"""
Django form for adding a new Campaig... | mit |
monarch-initiative/monarch-app | tests/behave/steps/selenium-forms.py | 3 | 1359 | ####
#### Steps for operating on the various forms and their results.
####
from behave import *
###
### radio button click
###
@given('I click the "{id}" radio button')
def step_impl(context, id):
webelt = context.browser.find_element_by_id(id)
webelt.click()
###
### Submission.
###
## Submit analyze pheno... | bsd-3-clause |
Distrotech/intellij-community | python/lib/Lib/site-packages/django/conf/locale/no/formats.py | 685 | 1657 | # -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'j. F Y'
TIME_FORMAT = 'H:i'
DATETIME_FORMAT = 'j. F Y H:i'
YEAR_MONTH_FOR... | apache-2.0 |
yousrabk/mne-python | mne/viz/tests/test_misc.py | 17 | 4858 | # Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Denis Engemann <denis.engemann@gmail.com>
# Martin Luessi <mluessi@nmr.mgh.harvard.edu>
# Eric Larson <larson.eric.d@gmail.com>
# Cathy Nangini <cnangini@gmail.com>
# Mainak Jas <mainak@neuro.hut.fi>
#... | bsd-3-clause |
350dotorg/Django | django/contrib/gis/db/models/fields.py | 400 | 11157 | from django.db.models.fields import Field
from django.db.models.sql.expressions import SQLEvaluator
from django.utils.translation import ugettext_lazy as _
from django.contrib.gis import forms
from django.contrib.gis.db.models.proxy import GeometryProxy
from django.contrib.gis.geometry.backend import Geometry, Geometry... | bsd-3-clause |
osgcc/ryzom | nel/tools/build_gamedata/processes/clodbank/3_install.py | 3 | 1753 | #!/usr/bin/python
#
# \file 3_install.py
# \brief Install clodbank
# \date 2009-03-10 13:13GMT
# \author Jan Boon (Kaetemi)
# Python port of game data build pipeline.
# Install clodbank
#
# NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
# Copyright (C) 2010 Winch Gate Property Limited
#
# This program i... | agpl-3.0 |
royc1/gpdb | gpMgmt/bin/gppylib/mainUtils.py | 19 | 22742 | # Line too long - pylint: disable=C0301
# Invalid name - pylint: disable=C0103
"""
mainUtils.py
------------
This file provides a rudimentary framework to support top-level option
parsing, initialization and cleanup logic common to multiple programs.
It also implements workarounds to make other modules we use like
... | apache-2.0 |
endlessm/chromium-browser | third_party/catapult/third_party/cloudstorage/cloudstorage/api_utils.py | 11 | 12009 | # Copyright 2013 Google Inc. 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 law or ag... | bsd-3-clause |
kdani3/searx | searx/engines/bing_images.py | 3 | 2634 | """
Bing (Images)
@website https://www.bing.com/images
@provide-api yes (http://datamarket.azure.com/dataset/bing/search),
max. 5000 query/month
@using-api no (because of query limit)
@results HTML (using search portal)
@stable no (HTML can change)
@parse url, title, img_src
... | agpl-3.0 |
cjhak/b2share | invenio/modules/communities/signals.py | 14 | 3231 | # -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2013, 2014 CERN.
#
# Invenio 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... | gpl-2.0 |
getstackd/stackd | vendor/boost-context/tools/build/v2/test/static_and_shared_library.py | 44 | 1094 | #!/usr/bin/python
# Copyright 2002, 2003 Dave Abrahams
# Copyright 2002, 2003, 2005 Vladimir Prus
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
import BoostBuild
t = BoostBuild.Tester(use_test_config=False)
t.write("jamr... | mit |
indhub/mxnet | tools/coreml/converter/_mxnet_converter.py | 41 | 8850 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | apache-2.0 |
apache/incubator-singa | tool/opencl/clsrc_to_str.py | 3 | 3166 | #!/usr/bin/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
# "Lice... | apache-2.0 |
AndKe/MAVProxy | MAVProxy/modules/mavproxy_mmap/mmap_server.py | 6 | 1971 | import BaseHTTPServer
import json
import os.path
import thread
import urlparse
DOC_DIR = os.path.join(os.path.dirname(__file__), 'mmap_app')
class Server(BaseHTTPServer.HTTPServer):
def __init__(self, handler, address='', port=9999, module_state=None):
BaseHTTPServer.HTTPServer.__init__(self, (address, port), ... | gpl-3.0 |
udacity/deep-learning | language-translation/problem_unittests.py | 1 | 20559 | import numpy as np
import tensorflow as tf
from tensorflow.python.layers.core import Dense
import itertools
import collections
import helper
def _print_success_message():
print('Tests Passed')
def test_text_to_ids(text_to_ids):
test_source_text = 'new jersey is sometimes quiet during autumn , and it is snow... | mit |
runtimejs/runtime | deps/v8/tools/release/merge_to_branch.py | 13 | 10549 | #!/usr/bin/env python
# Copyright 2014 the V8 project authors. 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... | apache-2.0 |
molobrakos/home-assistant | homeassistant/components/websocket_api/http.py | 5 | 6900 | """View to accept incoming websocket connection."""
import asyncio
from contextlib import suppress
from functools import partial
import json
import logging
from aiohttp import web, WSMsgType
import async_timeout
from homeassistant.const import EVENT_HOMEASSISTANT_STOP
from homeassistant.core import callback
from home... | apache-2.0 |
Renzo-Olivares/android_kk_kernel_htc_monarudo | Documentation/target/tcm_mod_builder.py | 4981 | 41422 | #!/usr/bin/python
# The TCM v4 multi-protocol fabric module generation script for drivers/target/$NEW_MOD
#
# Copyright (c) 2010 Rising Tide Systems
# Copyright (c) 2010 Linux-iSCSI.org
#
# Author: nab@kernel.org
#
import os, sys
import subprocess as sub
import string
import re
import optparse
tcm_dir = ""
fabric_ops... | gpl-2.0 |
CopeX/odoo | addons/account/report/account_analytic_entries_report.py | 306 | 3879 | # -*- 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... | agpl-3.0 |
angad/libjingle-mac | scons-2.2.0/engine/SCons/Tool/ipkg.py | 14 | 2532 | """SCons.Tool.ipkg
Tool-specific initialization for ipkg.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
The ipkg tool calls the ipkg-build. Its only argument should be the
packages fake_root.
"""
#
# Copyrigh... | bsd-3-clause |
SebDieBln/QGIS | python/ext-libs/pytz/exceptions.py | 657 | 1333 | '''
Custom exceptions raised by pytz.
'''
__all__ = [
'UnknownTimeZoneError', 'InvalidTimeError', 'AmbiguousTimeError',
'NonExistentTimeError',
]
class UnknownTimeZoneError(KeyError):
'''Exception raised when pytz is passed an unknown timezone.
>>> isinstance(UnknownTimeZoneError(), LookupError)... | gpl-2.0 |
rajathkumarmp/BinPy | BinPy/algorithms/ExpressionConvert.py | 4 | 9668 | def makeCompatible(expr):
'''Used by convertExpression to convert logical operators to english words.'''
expr = expr.replace('~&', ' NAND ')
expr = expr.replace('~|', ' NOR ')
expr = expr.replace('~^', ' XNOR ')
expr = expr.replace('&', ' AND ')
expr = expr.replace('|', ' OR ')
expr = expr.r... | bsd-3-clause |
AnishShah/tensorflow | tensorflow/python/data/util/nest.py | 17 | 17827 | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | apache-2.0 |
zielmicha/pam_ssh | pam_ssh.py | 1 | 1482 | import os
import sys
import pwd
import socket
import json
auth_token = None
def rpc(name, args):
sock = socket.socket(socket.AF_UNIX)
sock.connect('/var/run/pam_ssh.sock')
f = sock.makefile('r+')
f.write(json.dumps([name, args]) + '\n')
f.flush()
resp = int(f.readline())
return resp
def p... | mit |
nkrishnaswami/census | uscensus/data/whooshindex.py | 1 | 3248 | from __future__ import print_function
from __future__ import unicode_literals
from collections import OrderedDict
from whoosh.analysis.filters import StopFilter
from whoosh.analysis import (KeywordAnalyzer, StandardAnalyzer)
from whoosh.filedb.filestore import FileStorage, RamStorage
from whoosh.fields import Schema, ... | apache-2.0 |
arpitprogressive/arpittest | apps/admin/migrations/0012_auto__add_field_subsector_career_guide.py | 1 | 13328 | # -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'SubSector.career_guide'
db.add_column(u'admin_subsector', 'career_guide',
... | bsd-3-clause |
okolisny/integration_tests | cfme/tests/cloud_infra_common/test_snapshots_rest.py | 1 | 4663 | # -*- coding: utf-8 -*-
import pytest
import fauxfactory
from cfme import test_requirements
from cfme.cloud.provider.openstack import OpenStackProvider
from cfme.common.vm import VM
from cfme.infrastructure.provider import InfraProvider
from cfme.infrastructure.provider.virtualcenter import VMwareProvider
from cfme.u... | gpl-2.0 |
geerlingguy/ansible-modules-extras | monitoring/bigpanda.py | 20 | 5211 | #!/usr/bin/python
DOCUMENTATION = '''
---
module: bigpanda
author: "Hagai Kariti (@hkariti)"
short_description: Notify BigPanda about deployments
version_added: "1.8"
description:
- Notify BigPanda when deployments start and end (successfully or not). Returns a deployment object containing all the parameters for f... | gpl-3.0 |
xuvw/viewfinder | backend/prod/babysitter.py | 13 | 1670 | #!/usr/bin/env python
#
# Copyright 2011 Viewfinder Inc. All Rights Reserved.
"""Babysitter server starts instances of servers defined in a deployment
template.
Each server instance is started, monitored, and restarted as
necessary. Log files for each server are archived to S3 as
appropriate, custom cloud watch metri... | apache-2.0 |
akarki15/mozillians | vendor-local/lib/python/tablib/packages/openpyxl3/writer/workbook.py | 116 | 10769 | # file openpyxl/writer/workbook.py
# Copyright (c) 2010 openpyxl
#
# 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... | bsd-3-clause |
chrismeyersfsu/ansible-modules-core | network/nxos/nxos_vxlan_vtep.py | 27 | 17268 | #!/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... | gpl-3.0 |
robotlinker/robotlinker_core | src/rosbridge_suite/rosbridge_server/src/tornado/curl_httpclient.py | 20 | 19862 | #!/usr/bin/env python
#
# Copyright 2009 Facebook
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | apache-2.0 |
jankeromnes/depot_tools | third_party/gsutil/oauth2_plugin/__init__.py | 51 | 1121 | # Copyright 2011 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, merge,... | bsd-3-clause |
mcalmer/spacewalk | backend/common/rhn_pkg.py | 10 | 4128 | #
# Copyright (c) 2008--2016 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a c... | gpl-2.0 |
SatoshiNXSimudrone/sl4a-damon-clone | python/src/Lib/distutils/tests/test_bdist_wininst.py | 47 | 1101 | """Tests for distutils.command.bdist_wininst."""
import unittest
import os
from distutils.dist import Distribution
from distutils.command.bdist_wininst import bdist_wininst
from distutils.tests import support
class BuildWinInstTestCase(support.TempdirManager,
unittest.TestCase):
def te... | apache-2.0 |
ah744/ScaffCC_RKQC | clang/tools/scan-view/Reporter.py | 65 | 8135 | """Methods for reporting bugs."""
import subprocess, sys, os
__all__ = ['ReportFailure', 'BugReport', 'getReporters']
#
class ReportFailure(Exception):
"""Generic exception for failures in bug reporting."""
def __init__(self, value):
self.value = value
# Collect information about a bug.
cl... | bsd-2-clause |
varlog00/Sigil | src/Resource_Files/plugin_launchers/python/sigil_gumboc_tags.py | 6 | 4774 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab
from __future__ import unicode_literals
TagNames = [
"A",
"ABBR",
"ACRONYM",
"ADDRESS",
"ALTGLYPH",
"ALTGLYPHDEF",
"ALTGLYPHITEM",
"ANIMATE",
"ANIMATEC... | gpl-3.0 |
chamikaramj/beam | sdks/python/apache_beam/transforms/write_ptransform_test.py | 9 | 4178 | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | apache-2.0 |
rjsproxy/wagtail | wagtail/wagtailadmin/tests/test_widgets.py | 10 | 2561 | from django.test import TestCase
from django.contrib.contenttypes.models import ContentType
from wagtail.wagtailadmin import widgets
from wagtail.wagtailcore.models import Page
from wagtail.tests.testapp.models import SimplePage, EventPage
class TestAdminPageChooserWidget(TestCase):
def setUp(self):
sel... | bsd-3-clause |
imsparsh/python-for-android | python3-alpha/python3-src/Lib/importlib/test/extension/test_case_sensitivity.py | 50 | 1152 | import sys
from test import support
import unittest
from importlib import _bootstrap
from .. import util
from . import util as ext_util
@util.case_insensitive_tests
class ExtensionModuleCaseSensitivityTest(unittest.TestCase):
def find_module(self):
good_name = ext_util.NAME
bad_name = good_name.u... | apache-2.0 |
nathanielvarona/airflow | airflow/migrations/versions/4446e08588_dagrun_start_end.py | 8 | 1400 | #
# 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... | apache-2.0 |
Dhivyap/ansible | test/units/modules/storage/netapp/test_na_ontap_vscan_scanner_pool.py | 38 | 6534 | # (c) 2018, NetApp, Inc
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
''' unit tests for Ansible module: na_ontap_vscan_scanner_pool '''
from __future__ import print_function
import json
import pytest
from units.compat import unittest
from units.compat.mock import patch... | gpl-3.0 |
ReachingOut/unisubs | bin/update-integration.py | 4 | 2255 | #!/usr/bin/env python
import optparse
import os
import sys
import subprocess
root_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
def optional_dir():
return os.path.join(root_dir, 'optional')
def repo_dir(repo_name):
return os.path.join(root_dir, repo_name)
def get_repo_names():
retur... | agpl-3.0 |
benschulz/servo | tests/wpt/web-platform-tests/tools/pywebsocket/src/test/testdata/handlers/sub/wrong_handshake_sig_wsh.py | 499 | 1859 | # Copyright 2009, 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... | mpl-2.0 |
tensorflow/agents | tf_agents/policies/random_tf_policy.py | 1 | 7986 | # coding=utf-8
# Copyright 2020 The TF-Agents Authors.
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | apache-2.0 |
jordiclariana/ansible | lib/ansible/module_utils/asa.py | 14 | 4321 | # This code is part of Ansible, but is an independent component.
# This particular file snippet, and this file snippet only, is BSD licensed.
# Modules you write using this snippet, which is embedded dynamically by Ansible
# still belong to the author of the module, and may assign their own license
# to the complete wo... | gpl-3.0 |
SciTools/mo_pack | lib/mo_pack/tests/test_wgdos.py | 3 | 3859 | # (C) British Crown Copyright 2015, Met Office
#
# This file is part of mo_pack.
#
# mo_pack 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 Software Foundation, either version 3 of the License, or
# (at your option) any la... | gpl-3.0 |
40223119/2015w13 | static/Brython3.1.3-20150514-095342/Lib/unittest/main.py | 739 | 10385 | """Unittest main program"""
import sys
import optparse
import os
from . import loader, runner
from .signals import installHandler
__unittest = True
FAILFAST = " -f, --failfast Stop on first failure\n"
CATCHBREAK = " -c, --catch Catch control-C and display results\n"
BUFFEROUTPUT = " -b, --buffer ... | gpl-3.0 |
NewCell/Call-Text-v1 | jni/pjsip/sources/tests/cdash/cfg_site_sample.py | 107 | 1530 | #
# cfg_site_sample.py - Sample site configuration
#
# Copyright (C) 2008-2009 Teluu Inc. (http://www.teluu.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 Free Software Foundation; either version 2 of the License... | gpl-3.0 |
Yannig/ansible-modules-core | cloud/amazon/rds.py | 7 | 40737 | #!/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... | gpl-3.0 |
mick-d/nipype_source | nipype/interfaces/slicer/surface.py | 13 | 16200 | # -*- coding: utf8 -*-
"""Autogenerated file - DO NOT EDIT
If you spot a bug, please report it on the mailing list and/or change the generator."""
from nipype.interfaces.base import CommandLine, CommandLineInputSpec, SEMLikeCommandLine, TraitedSpec, File, Directory, traits, isdefined, InputMultiPath, OutputMultiPath
i... | bsd-3-clause |
TNT-Samuel/Coding-Projects | DNS Server/Source - Copy/Lib/site-packages/toolz/curried/__init__.py | 7 | 2615 | """
Alternate namespace for toolz such that all functions are curried
Currying provides implicit partial evaluation of all functions
Example:
Get usually requires two arguments, an index and a collection
>>> from toolz.curried import get
>>> get(0, ('a', 'b'))
'a'
When we use it in higher order ... | gpl-3.0 |
TeachAtTUM/edx-platform | cms/djangoapps/contentstore/management/commands/reindex_library.py | 18 | 2454 | """ Management command to update libraries' search index """
from __future__ import print_function
from textwrap import dedent
from django.core.management import BaseCommand, CommandError
from opaque_keys.edx.keys import CourseKey
from opaque_keys.edx.locator import LibraryLocator
from contentstore.courseware_index i... | agpl-3.0 |
CVML/scikit-learn | examples/model_selection/plot_underfitting_overfitting.py | 230 | 2649 | """
============================
Underfitting vs. Overfitting
============================
This example demonstrates the problems of underfitting and overfitting and
how we can use linear regression with polynomial features to approximate
nonlinear functions. The plot shows the function that we want to approximate,
wh... | bsd-3-clause |
appcelerator-developer-relations/appc-sample-ti500 | plugins/ti.alloy/plugin.py | 1729 | 5251 | import os, sys, subprocess, hashlib
import subprocess
def check_output(*popenargs, **kwargs):
r"""Run command with arguments and return its output as a byte string.
Backported from Python 2.7 as it's implemented as pure python on stdlib.
>>> check_output(['/usr/bin/python', '--version'])
Python 2.6.... | apache-2.0 |
danuzclaudes/robottelo | tests/foreman/ui/test_template.py | 3 | 10224 | # -*- encoding: utf-8 -*-
"""Test class for Template UI"""
from fauxfactory import gen_string
from nailgun import entities
from robottelo.constants import OS_TEMPLATE_DATA_FILE, SNIPPET_DATA_FILE
from robottelo.datafactory import generate_strings_list, invalid_values_list
from robottelo.decorators import run_only_on, t... | gpl-3.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.