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 |
|---|---|---|---|---|---|
apophys/freeipa | ipaserver/p11helper.py | 1 | 65270 | #
# Copyright (C) 2014 FreeIPA Contributors see COPYING for license
#
import random
import ctypes.util
import binascii
import struct
import six
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import serialization
from cryptography.hazmat.primitives.asymmetric import dsa, ... | gpl-3.0 |
IBMStreams/streamsx.topology | test/python/spl/tests/test_splpy_mt.py | 2 | 1829 | import unittest
from datetime import timedelta
from streamsx.topology.topology import *
from streamsx.topology import schema
from streamsx.topology.tester import Tester
import streamsx.spl.op as op
import streamsx.spl.toolkit
import spl_tests_utils as stu
class TestMT(unittest.TestCase):
_multiprocess_can_split_... | apache-2.0 |
Brig13Team/Operation_Kerberos | tools/make.py | 1 | 58710 | #!/usr/bin/env python3
# vim: set fileencoding=utf-8 :
# make.py
# An Arma 3 addon build system
###############################################################################
# The MIT License (MIT)
# Copyright (c) 2013-2014 Ryan Schultz
# Permission is hereby granted, free of charge, to any person obtaining a co... | gpl-3.0 |
yuruidong/redis-py | redis/lock.py | 80 | 10563 | import threading
import time as mod_time
import uuid
from redis.exceptions import LockError, WatchError
from redis.utils import dummy
from redis._compat import b
class Lock(object):
"""
A shared, distributed Lock. Using Redis for locking allows the Lock
to be shared across processes and/or machines.
... | mit |
tinloaf/home-assistant | homeassistant/helpers/device_registry.py | 1 | 8500 | """Provide a way to connect entities belonging to one device."""
import logging
import uuid
from collections import OrderedDict
import attr
from homeassistant.core import callback
from homeassistant.loader import bind_hass
_LOGGER = logging.getLogger(__name__)
_UNDEF = object()
DATA_REGISTRY = 'device_registry'
S... | apache-2.0 |
jakevdp/scipy | scipy/io/tests/test_mmio.py | 14 | 21789 | from __future__ import division, print_function, absolute_import
from tempfile import mkdtemp, mktemp
import os
import shutil
import numpy as np
from numpy import array, transpose, pi
from numpy.testing import (TestCase, run_module_suite, assert_equal,
assert_array_equal, assert_array_almos... | bsd-3-clause |
msarana/selenium_python | ENV/Lib/encodings/iso8859_9.py | 593 | 13412 | """ Python Character Mapping Codec iso8859_9 generated from 'MAPPINGS/ISO8859/8859-9.TXT' with gencodec.py.
"""#"
import codecs
### Codec APIs
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,input,errors='... | apache-2.0 |
CraigHarris/gpdb | gpMgmt/sbin/gpoperation.py | 30 | 2114 | #!/usr/bin/env python
import sys
import pickle
import traceback
class NullDevice():
def write(self, s):
pass
# Prevent use of stdout, as it disrupts pickling mechanism
old_stdout = sys.stdout
sys.stdout = NullDevice()
# log initialization must be done only AFTER rerouting stdout
from gppylib import gplo... | apache-2.0 |
snipsco/snipsskills | snipsmanager/commands/setup/systemd/bluetooth.py | 1 | 3495 | # -*-: coding utf-8 -*-
"""The microphone setup command."""
import time
from ...base import Base
from ....utils.os_helpers import is_raspi_os, is_node_available, which, file_exists
from ....utils.systemd import Systemd
from ....utils.snipsfile import Snipsfile
from .... import NODE_MODULES_DIR, DEFAULT_SNIPSFILE_PAT... | mit |
andyraib/data-storage | python_scripts/env/lib/python3.6/site-packages/matplotlib/tests/test_backend_bases.py | 5 | 3227 | from matplotlib.backend_bases import FigureCanvasBase
from matplotlib.backend_bases import RendererBase
from matplotlib.testing.decorators import image_comparison, cleanup
import matplotlib.pyplot as plt
import matplotlib.transforms as transforms
import matplotlib.path as path
from nose.tools import assert_equal
imp... | apache-2.0 |
USGSDenverPychron/pychron | pychron/dvc/tasks/panes.py | 1 | 2889 | # ===============================================================================
# Copyright 2015 Jake Ross
#
# 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... | apache-2.0 |
hastexo/edx-platform | lms/djangoapps/lti_provider/models.py | 7 | 5815 | """
Database models for the LTI provider feature.
This app uses migrations. If you make changes to this model, be sure to create
an appropriate migration file and check it in at the same time as your model
changes. To do that,
1. Go to the edx-platform dir
2. ./manage.py lms schemamigration lti_provider --auto "descr... | agpl-3.0 |
CXQERP/ODOOERP | addons/l10n_bo/__init__.py | 2120 | 1456 | # -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (c) 2011 Cubic ERP - Teradata SAC. (http://cubicerp.com).
#
# WARNING: This program as such is intended to be used by professional
# programmers who take t... | agpl-3.0 |
qjw/grit-i18n | grit/format/policy_templates/writers/adm_writer.py | 41 | 10063 | #!/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.
from grit.format.policy_templates.writers import template_writer
NEWLINE = '\r\n'
def GetWriter(config):
'''Factory method f... | bsd-2-clause |
georgestarcher/TA-SyncKVStore | bin/ta_synckvstore/cloudconnectlib/splunktalib/event_writer.py | 4 | 2673 | import Queue
import multiprocessing
import threading
import sys
from collections import Iterable
from .common import log
class EventWriter(object):
def __init__(self, process_safe=False):
if process_safe:
self._mgr = multiprocessing.Manager()
self._event_queue = self._mgr.Queue(10... | mit |
TheMOOCAgency/edx-platform | lms/djangoapps/instructor_task/api_helper.py | 8 | 14823 | """
Helper lib for instructor_tasks API.
Includes methods to check args for rescoring task, encoding student input,
and task submission logic, including handling the Celery backend.
"""
import hashlib
import json
import logging
from django.utils.translation import ugettext as _
from util.db import outer_atomic
from ... | agpl-3.0 |
gnieboer/tensorflow | tensorflow/contrib/learn/python/learn/dataframe/estimator_utils.py | 75 | 7274 | # pylint: disable=g-bad-file-header
# 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/LICENS... | apache-2.0 |
sochotnicky/lyntin | tools/toolsutils.py | 1 | 7496 | #######################################################################
# This file is part of Lyntin.
# copyright (c) Free Software Foundation 2001, 2002
#
# Lyntin is distributed under the GNU General Public License license. See the
# file LICENSE for distribution details.
# $Id: toolsutils.py,v 1.1 2003/10/07 00:50... | gpl-3.0 |
proversity-org/edx-platform | common/test/acceptance/pages/studio/pagination.py | 165 | 2099 | """
Mixin to include for Paginated container pages
"""
from selenium.webdriver.common.keys import Keys
class PaginatedMixin(object):
"""
Mixin class used for paginated page tests.
"""
def nav_disabled(self, position, arrows=('next', 'previous')):
"""
Verifies that pagination nav is dis... | agpl-3.0 |
klmitch/humboldt | tools/hum_proto/tests/unit/test_main.py | 1 | 2768 | from hum_proto import main
class TestMain(object):
def test_base(self, mocker):
mock_get_ctx = mocker.patch.object(
main.ssl_utils, 'get_ctx', side_effect=['cli', 'srv']
)
mock_connect = mocker.patch.object(main.apploop, 'connect')
sock = mock_connect.return_value
... | apache-2.0 |
goliate/sarakha63-persomov | couchpotato/core/media/movie/providers/trailer/youtube_dl/extractor/grooveshark.py | 24 | 7179 | # coding: utf-8
from __future__ import unicode_literals
import time
import math
import os.path
import re
from .common import InfoExtractor
from ..compat import (
compat_html_parser,
compat_urllib_parse,
compat_urllib_request,
compat_urlparse,
)
from ..utils import ExtractorError
class GroovesharkHt... | gpl-3.0 |
40223231/2015cd_midterm | static/Brython3.1.1-20150328-091302/Lib/numbers.py | 883 | 10398 | # Copyright 2007 Google, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""Abstract Base Classes (ABCs) for numbers, according to PEP 3141.
TODO: Fill out more detailed documentation on the operators."""
from abc import ABCMeta, abstractmethod
__all__ = ["Number", "Complex", "Real", "Rat... | gpl-3.0 |
bittorrent/breakpad | src/tools/python/tests/filter_syms_unittest.py | 100 | 4454 | #!/usr/bin/env python
# Copyright (c) 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 lis... | bsd-3-clause |
tumbl3w33d/ansible | lib/ansible/modules/web_infrastructure/rundeck_acl_policy.py | 18 | 8437 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, Loic Blot <loic.blot@unix-experience.fr>
# Sponsored by Infopro Digital. http://www.infopro-digital.com/
# Sponsored by E.T.A.I. http://www.etai.fr/
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import... | gpl-3.0 |
sandeepkrjha/pgmpy | pgmpy/models/BayesianModel.py | 1 | 36803 | #!/usr/bin/env python3
import itertools
from collections import defaultdict
import logging
from operator import mul
import networkx as nx
import numpy as np
import pandas as pd
from pgmpy.base import DirectedGraph
from pgmpy.factors.discrete import TabularCPD, JointProbabilityDistribution, DiscreteFactor
from pgmpy.... | mit |
jepio/pers_engine | persanalysis/fitengine.py | 1 | 1436 | """ Module for fitting graphs to file """
import matplotlib.pyplot as plt
from plotengine import PlotEngine
# pylint: disable=E1101
import numpy as np
from scipy.optimize import curve_fit
class FitEngine(PlotEngine):
""" Class that performs fitting and saving of plots. """
functions = {"lin": (lambda x, a, ... | gpl-2.0 |
undoware/neutron-drive | google_appengine/google/appengine/_internal/django/core/management/commands/dumpdata.py | 23 | 7782 | from google.appengine._internal.django.core.exceptions import ImproperlyConfigured
from google.appengine._internal.django.core.management.base import BaseCommand, CommandError
from google.appengine._internal.django.core import serializers
from google.appengine._internal.django.db import connections, router, DEFAULT_DB_... | bsd-3-clause |
junhuac/MQUIC | depot_tools/external_bin/gsutil/gsutil_4.15/gsutil/third_party/rsa/rsa/asn1.py | 89 | 1147 | '''ASN.1 definitions.
Not all ASN.1-handling code use these definitions, but when it does, they should be here.
'''
from pyasn1.type import univ, namedtype, tag
class PubKeyHeader(univ.Sequence):
componentType = namedtype.NamedTypes(
namedtype.NamedType('oid', univ.ObjectIdentifier()),
namedtype.... | mit |
acsone/server-tools | security_protector/security_protector.py | 70 | 1772 | # -*- encoding: utf-8 -*-
##############################################################################
#
# Author Nicolas Bessi. Copyright Camptocamp SA
##############################################################################
from osv import fields, osv
class IrModelAccess(osv.osv):
"We inherit ir model... | agpl-3.0 |
Facetracker-project/facetracker-core | lib/youtube-dl/youtube_dl/extractor/tlc.py | 33 | 2463 | # encoding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from .brightcove import BrightcoveIE
from .discovery import DiscoveryIE
from ..compat import compat_urlparse
class TlcIE(DiscoveryIE):
IE_NAME = 'tlc.com'
_VALID_URL = r'http://www\.tlc\.com\/[a-zA-Z0-9\-]*/... | gpl-2.0 |
monetate/sqlalchemy | lib/sqlalchemy/orm/session.py | 3 | 155590 | # orm/session.py
# Copyright (C) 2005-2021 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: https://www.opensource.org/licenses/mit-license.php
"""Provides the Session class and related utilities."""
import itertools
import sys... | mit |
jonathanslenders/python-vterm | libpymux/pexpect_utils.py | 2 | 1611 | """
Some utilities that were taken from the pexpect source code.
http://pexpect.sourceforge.net/pexpect.html
"""
import os
def pty_make_controlling_tty(tty_fd):
"""
This makes the pseudo-terminal the controlling tty. This should be
more portable than the pty.fork() function. Specifically, this should
... | bsd-2-clause |
astitcher/qpid-proton | python/proton/_data.py | 2 | 55754 | #
# 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 |
schmidtc/pysal | pysal/spreg/ml_lag_regimes.py | 7 | 21409 | """
ML Estimation of Spatial Lag Model with Regimes
"""
__author__ = "Luc Anselin luc.anselin@asu.edu, Pedro V. Amaral pedro.amaral@asu.edu"
import pysal
import numpy as np
import regimes as REGI
import user_output as USER
import summary_output as SUMMARY
import diagnostics as DIAG
import multiprocessing as mp
from m... | bsd-3-clause |
xaoqao/p2pool-drs | SOAPpy/Utilities.py | 294 | 5112 | """
################################################################################
# Copyright (c) 2003, Pfizer
# Copyright (c) 2001, Cayce Ullman.
# Copyright (c) 2001, Brian Matthews.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provid... | gpl-3.0 |
Fat-Zer/FreeCAD_sf_master | src/Mod/Arch/ArchStairs.py | 2 | 73490 | #***************************************************************************
#* Copyright (c) 2013 Yorik van Havre <yorik@uncreated.net> *
#* *
#* This program is free software; you can redistribute it and/or modify *
#* it unde... | lgpl-2.1 |
huangzx/ybs | src/ybs/pybs.py | 1 | 16804 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
#
# Copyright © 2013 ivali.com
# Author: Zhongxin Huang <zhongxin.huang@gmail.com>
#
import os
import sys
import ybs.utils
import ybs.settings
import sqlite3
import argparse
import time
import StringIO
import multiprocessing
import re
VERSION = ybs.settings.__version__
P... | gpl-2.0 |
ndp-systemes/odoo-addons | sale_order_workflow_improved/__openerp__.py | 1 | 1392 | # -*- coding: utf8 -*-
#
# Copyright (C) 2014 NDP Systèmes (<http://www.ndp-systemes.fr>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License,... | agpl-3.0 |
dsfsdgsbngfggb/odoo | addons/knowledge/res_config.py | 378 | 1436 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (C) 2004-2012 OpenERP S.A. (<http://openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms o... | agpl-3.0 |
Basis/Diamond | src/collectors/diskusage/test/testdiskusage.py | 36 | 7195 | #!/usr/bin/python
# coding=utf-8
################################################################################
from test import CollectorTestCase
from test import get_collector_config
from test import unittest
from mock import Mock
from mock import patch
from diamond.collector import Collector
from diskusage impor... | mit |
40223114/w16 | static/Brython3.1.1-20150328-091302/Lib/_random.py | 518 | 2451 | from browser import window
def _randint(a, b):
return int(window.Math.random()*(b-a+1)+a)
def _urandom(n):
"""urandom(n) -> str
Return n random bytes suitable for cryptographic use."""
randbytes= [_randint(0,255) for i in range(n)]
return bytes(randbytes)
class Random:
"""Random n... | agpl-3.0 |
Bysmyyr/chromium-crosswalk | tools/profile_chrome/main.py | 17 | 11006 | #!/usr/bin/env python
#
# 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.
import logging
import optparse
import os
import sys
import webbrowser
from profile_chrome import chrome_controller
from profile_chro... | bsd-3-clause |
mjtamlyn/django | django/conf/locale/id/formats.py | 65 | 2068 | # 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 N Y'
DATETIME_FORMAT = "j N Y, G.i"
TIME_FORMAT = 'G.i'
YEAR_MONTH_FORMAT = 'F Y'
MONTH_DAY_FORMAT... | bsd-3-clause |
EmreAtes/spack | var/spack/repos/builtin/packages/valgrind/package.py | 2 | 3320 | ##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | lgpl-2.1 |
samabhi/pstHealth | venv/lib/python2.7/site-packages/pip/utils/outdated.py | 513 | 5455 | 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.models import PyPI
from pip.locations import USER_CACHE_DI... | mit |
aam-at/tensorflow | tensorflow/python/tools/import_pb_to_tensorboard.py | 7 | 3492 | # 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 |
desihub/surveysim | py/surveysim/test/test_surveysim.py | 1 | 1267 | from __future__ import print_function, division, absolute_import
import unittest
import os.path
import desisurvey.config
import desisurvey.scripts.surveyinit
import surveysim.stats
import surveysim.exposures
import surveysim.scripts.surveysim
from desisurvey.test.base import Tester
class TestSimulator(Tester):
... | bsd-3-clause |
avikdatta/python_scripts | lib/ftp_index_method.py | 1 | 2203 | #!/usr/bin/env python3
import os,sys
from ftplib import FTP
from tempfile import mkdtemp
from shutil import rmtree
from http.client import HTTPConnection
from urllib.parse import urlsplit
def get_temp_dir(work_dir,prefix='temp'):
'''
This function returns a temporary directory
'''
try:
temp_dir=mkdtemp(p... | apache-2.0 |
yi719/python-driver | tests/integration/standard/test_udts.py | 6 | 25672 | # Copyright 2013-2015 DataStax, 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 writi... | apache-2.0 |
sxwzhw/iproj-su640 | scripts/rt-tester/rt-tester.py | 11005 | 5307 | #!/usr/bin/python
#
# rt-mutex tester
#
# (C) 2006 Thomas Gleixner <tglx@linutronix.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
import os
import sys
import getopt
import sh... | gpl-2.0 |
detiber/ansible | lib/ansible/modules/system/make.py | 69 | 4784 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2015, Linus Unnebäck <linus@folkdatorn.se>
#
# This file is part of Ansible
#
# 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 ... | gpl-3.0 |
mtconley/turntable | test/lib/python2.7/site-packages/scipy/signal/tests/test_filter_design.py | 9 | 80240 | from __future__ import division, print_function, absolute_import
import warnings
import numpy as np
from numpy.testing import (TestCase, assert_array_almost_equal,
assert_array_equal, assert_array_less,
assert_raises, assert_equal, assert_,
... | mit |
mapr/sahara | sahara/tests/integration/configs/config.py | 1 | 49840 | # Copyright (c) 2013 Mirantis 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 writ... | apache-2.0 |
crhym3/bs2gcs | bs2gcs.py | 1 | 1439 | """Blobstore to GCS migration functions."""
from mapreduce import operation as op
from google.appengine.api import images as images_api
from google.appengine.ext import blobstore
import cloudstorage as gcs
BUCKET = 'bs2gcs'
def migrate(image):
"""Copies blobs stored in Blobstore over to a GCS bucket.
Args:
im... | mit |
potatolondon/django-nonrel-1-4 | django/utils/jslex.py | 329 | 8041 | """JsLex: a lexer for Javascript"""
# Originally from https://bitbucket.org/ned/jslex
import re
class Tok(object):
"""
A specification for a token class.
"""
num = 0
def __init__(self, name, regex, next=None):
self.id = Tok.num
Tok.num += 1
self.name = name
self.reg... | bsd-3-clause |
browseinfo/odoo_saas3_nicolas | history/migrate/3.3.0-3.4.0/post.py | 52 | 5645 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the... | agpl-3.0 |
nickp60/pyutilsnrw | setup.py | 1 | 4650 | """
Setup for nrw_python_utils
A setuptools based setup module.
See:
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
"""
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os i... | mit |
GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/sympy/polys/tests/test_euclidtools.py | 4 | 21096 | """Tests for Euclidean algorithms, GCDs, LCMs and polynomial remainder sequences. """
from sympy.polys.euclidtools import (
dup_gcdex, dup_half_gcdex, dup_invert,
dup_euclidean_prs, dmp_euclidean_prs,
dup_primitive_prs, dmp_primitive_prs,
dup_subresultants, dmp_subresultants,
dup_prs_resultant, dmp... | agpl-3.0 |
pkilambi/ceilometer | ceilometer/tests/meter/test_notifications.py | 1 | 12206 | #
# 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, software
# distributed under... | apache-2.0 |
dramaticlly/Python4Interview | yelpPalindrome.py | 1 | 1423 |
import re,string
def reverse(text):
return text[::-1];
def isPalindomeIgnorePunctation(text):
# test if word is palindrome ignore punctation
regex = re.compile('[%s]' % re.escape(string.punctuation));
text = regex.sub('',text);
return isPalindome(text)
def isPalindome(text):
# test if word is palindrome
# a... | mit |
mjfarmer/scada_py | env/lib/python2.7/site-packages/pip/commands/bundle.py | 392 | 1787 | import textwrap
from pip.locations import build_prefix, src_prefix
from pip.util import display_path, backup_dir
from pip.log import logger
from pip.exceptions import InstallationError
from pip.commands.install import InstallCommand
class BundleCommand(InstallCommand):
"""Create pybundles (archives containing mul... | gpl-3.0 |
ohio813/libforensics | code/lf/win/shell/consts/csidl.py | 13 | 8122 | # Copyright 2010 Michael Murr
#
# This file is part of LibForensics.
#
# LibForensics 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 later ver... | gpl-3.0 |
ravindrapanda/tensorflow | tensorflow/contrib/distributions/python/kernel_tests/mixture_test.py | 21 | 38286 | # 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 |
cyberark-bizdev/ansible | lib/ansible/modules/net_tools/ldap/ldap_attr.py | 49 | 11004 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2016, Peter Sagerson <psagers@ignorare.net>
# (c) 2016, Jiri Tyr <jiri.tyr@gmail.com>
#
# 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
A... | gpl-3.0 |
Leoniela/nipype | nipype/interfaces/fsl/utils.py | 1 | 79276 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""The fsl module provides classes for interfacing with the `FSL
<http://www.fmrib.ox.ac.uk/fsl/index.html>`_ command line tools. This
was written to work with FSL version 4.1.4.
Examples
--------
See the... | bsd-3-clause |
karthikvadla16/spark-tk | regression-tests/sparktkregtests/testcases/frames/frame_create_from_rows_test.py | 13 | 6451 | # vim: set encoding=utf-8
# Copyright (c) 2016 Intel Corporation
#
# 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 require... | apache-2.0 |
kquick/Thespian | examples/multi_system/act1/encoder.py | 1 | 1865 | from thespian.actors import *
class EncodeThis(object):
"""This is the message requesting an encoding and noting the original
encoding requester."""
def __init__(self, rawstr, requester):
self.rawstr = rawstr
self.requester = requester
class Encoded(object):
"""This is a message s... | mit |
poo12138/gem5-stable | src/mem/slicc/main.py | 83 | 3608 | # Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
# Copyright (c) 2009 The Hewlett-Packard Development Company
# 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 co... | bsd-3-clause |
robcarver17/pysystemtrade | systems/positionsizing.py | 1 | 18802 | import pandas as pd
from syscore.dateutils import ROOT_BDAYS_INYEAR
from syscore.objects import missing_data
from sysdata.config.configdata import Config
from sysdata.sim.sim_data import simData
from sysquant.estimators.vol import robust_vol_calc
from systems.stage import SystemStage
from systems.system_cache impor... | gpl-3.0 |
rajpurkar/chess-deep-rl | value.py | 1 | 1195 | import util
def build_network(**kwargs):
from keras.models import Model
from keras.layers import Dense, Reshape, Flatten, Input, merge
defaults = {
"board_side_length": 8,
"conv_layers": 4,
"num_filters": 32,
"dropout": 0.5,
"dense_layers": 2,
"dense_hidden"... | mit |
DCSR/Analysis | DataModel.py | 1 | 3350 |
"""
Definition of data structure
"""
class DataRecord:
def __init__(self, datalist, fileName):
self.fileName = fileName
self.datalist = datalist
self.numberOfL1Responses = 0
self.numberOfL2Responses = 0
self.numberOfInfusions = 0
self.totalPumpDuration = 0 ... | gpl-3.0 |
nitzmahone/ansible-modules-core | network/nxos/nxos_vrf_af.py | 4 | 13478 | #!/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 |
dblia/nosql-ganeti | lib/http/client.py | 8 | 11106 | #
#
# Copyright (C) 2007, 2008, 2010 Google Inc.
#
# 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 ... | gpl-2.0 |
divya-csekar/flask-microblog-server | flask/Lib/site-packages/sqlalchemy/testing/suite/test_insert.py | 54 | 6746 | from .. import fixtures, config
from ..config import requirements
from .. import exclusions
from ..assertions import eq_
from .. import engines
from sqlalchemy import Integer, String, select, util
from ..schema import Table, Column
class LastrowidTest(fixtures.TablesTest):
run_deletes = 'each'
__backend__ ... | bsd-3-clause |
joelstanner/codeeval | python_solutions/REMOVE_CHARACTERS/REMOVE_CHARACTERS.py | 1 | 1314 | """Write a program which removes specific characters from a string.
INPUT SAMPLE:
The first argument is a path to a file. The file contains the source strings
and the characters that need to be scrubbed. Each source string and characters
you need to scrub are delimited by comma.
For example:
how are you, abc
hello ... | mit |
yupcoin/yupcoin | share/qt/make_spinner.py | 4415 | 1035 | #!/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... | mit |
tnachen/git | contrib/hg-to-git/hg-to-git.py | 47 | 7867 | #!/usr/bin/env python
""" hg-to-git.py - A Mercurial to GIT converter
Copyright (C)2007 Stelian Pop <stelian@popies.net>
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 versi... | gpl-2.0 |
iamaleksey/cassandra-dtest | streaming_test.py | 5 | 4250 | import logging
import operator
import pytest
from cassandra import ConsistencyLevel
from pytest import mark
from dtest import Tester, create_ks, create_cf
from tools.data import insert_c1c2
since = pytest.mark.since
logger = logging.getLogger(__name__)
opmap = {
operator.eq: "==",
operator.gt: ">",
oper... | apache-2.0 |
anorfleet/turntable | test/lib/python2.7/site-packages/numpy/polynomial/polyutils.py | 41 | 11163 | """
Utililty classes and functions for the polynomial modules.
This module provides: error and warning objects; a polynomial base class;
and some routines used in both the `polynomial` and `chebyshev` modules.
Error objects
-------------
.. autosummary::
:toctree: generated/
PolyError base class fo... | mit |
alexcuellar/odoo | addons/l10n_hn/__openerp__.py | 343 | 2260 | # -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2009-2010 Salvatore Josué Trimarchi Pinto <salvatore@trigluu.com>
# (http://trigluu.com)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Gen... | agpl-3.0 |
nearlyfreeapps/python-googleadwords | examples/adspygoogle/adwords/v201109/account_management/create_account.py | 1 | 2286 | #!/usr/bin/python
#
# Copyright 2011 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 b... | apache-2.0 |
gaddman/ansible | test/units/modules/network/f5/test_bigip_ucs.py | 21 | 12316 | # -*- coding: utf-8 -*-
#
# Copyright (c) 2017 F5 Networks Inc.
# 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
import os
import json
import pytest
import sys
if sys.version_info < (2, ... | gpl-3.0 |
dalegregory/odoo | addons/document/__init__.py | 434 | 1128 | # -*- 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 |
bfontaine/alfred-pp | alp/request/bs4/builder/_lxml.py | 2 | 7199 | __all__ = [
'LXMLTreeBuilderForXML',
'LXMLTreeBuilder',
]
from StringIO import StringIO
import collections
from lxml import etree
from alp.request.bs4.element import Comment, Doctype, NamespacedAttribute
from alp.request.bs4.builder import (
FAST,
HTML,
HTMLTreeBuilder,
PERMISSIVE,
Tree... | mit |
yongshengwang/hue | build/env/lib/python2.7/site-packages/python_openid-2.2.5-py2.7.egg/openid/yadis/etxrd.py | 156 | 8301 | # -*- test-case-name: yadis.test.test_etxrd -*-
"""
ElementTree interface to an XRD document.
"""
__all__ = [
'nsTag',
'mkXRDTag',
'isXRDS',
'parseXRDS',
'getCanonicalID',
'getYadisXRD',
'getPriorityStrict',
'getPriority',
'prioSort',
'iterServices',
'expandService',
'ex... | apache-2.0 |
ulrichard/bitcoinutilities | accounts.py | 1 | 4978 | #! /usr/bin/python
# Find the current balances for known addresses
import blockchain_info, electrum_client
import json
import locale
import pycoin.key.BIP32Node, pycoin.key.Key, pycoin.key.electrum
from pycoin.tx.pay_to import address_for_pay_to_script, build_hash160_lookup, build_p2sh_lookup, ScriptMultisig
class a... | bsd-3-clause |
bobrock/eden | modules/templates/Syria/config.py | 8 | 83179 | # -*- coding: utf-8 -*-
try:
# Python 2.7
from collections import OrderedDict
except:
# Python 2.6
from gluon.contrib.simplejson.ordered_dict import OrderedDict
from datetime import timedelta
from gluon import current, Field, URL
from gluon.html import *
from gluon.storage import Storage
from s3 imp... | mit |
devendermishrajio/nova | nova/api/openstack/compute/legacy_v2/contrib/volumes.py | 21 | 21431 | # Copyright 2011 Justin Santa Barbara
# 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 requ... | apache-2.0 |
Xiaolang0/shadowsocks | shadowsocks/crypto/util.py | 1032 | 4287 | #!/usr/bin/env python
#
# Copyright 2015 clowwindy
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | apache-2.0 |
iSECPartners/AWS-recipes | Python/awsrecipes_create_default_iam_groups.py | 1 | 2117 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
from opinel.utils.aws import connect_service
from opinel.utils.cli_parser import OpinelArgumentParser
from opinel.utils.console import configPrintException, printInfo, printException
from opinel.utils.credentials import read_creds
from opinel.utils.gl... | gpl-2.0 |
leorochael/odoo | addons/l10n_be/wizard/l10n_be_vat_intra.py | 332 | 14728 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# Adapted by Noviat to
# - make the 'mand_id' field optional
# - support Noviat tax code scheme
#... | agpl-3.0 |
mbohlool/client-python | kubernetes/client/models/v1_endpoint_subset.py | 1 | 5566 | # coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.8.2
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
... | apache-2.0 |
kernc/scikit-learn | doc/datasets/mldata_fixture.py | 367 | 1183 | """Fixture module to skip the datasets loading when offline
Mock urllib2 access to mldata.org and create a temporary data folder.
"""
from os import makedirs
from os.path import join
import numpy as np
import tempfile
import shutil
from sklearn import datasets
from sklearn.utils.testing import install_mldata_mock
fr... | bsd-3-clause |
gnrfan/python-easyxsd | easyxsd/utils.py | 2 | 3492 | from lxml import etree
def xml_from_string(xmlstr):
"""
Returns an lxml.etree._ElementTree object from a string
containing a valid XML document.
"""
try:
return etree.XML(str(xmlstr).strip())
except etree.XMLSyntaxError:
return None
def xml_from_file(filepath):
"""
Ret... | bsd-3-clause |
msmolens/VTK | ThirdParty/Twisted/twisted/internet/_dumbwin32proc.py | 50 | 12510 | # -*- test-case-name: twisted.test.test_process -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
http://isometric.sixsided.org/_/gates_in_the_head/
"""
import os
# Win32 imports
import win32api
import win32con
import win32event
import win32file
import win32pipe
import win32process
impo... | bsd-3-clause |
pjdelport/django | django/core/management/commands/makemessages.py | 6 | 17062 | import fnmatch
import glob
import os
import re
import sys
from itertools import dropwhile
from optparse import make_option
from subprocess import PIPE, Popen
import django
from django.core.management.base import CommandError, NoArgsCommand
from django.utils.text import get_text_list
from django.utils.jslex import prep... | bsd-3-clause |
marissazhou/django | django/contrib/gis/db/backends/base/operations.py | 263 | 4865 | class BaseSpatialOperations(object):
"""
This module holds the base `BaseSpatialBackend` object, which is
instantiated by each spatial database backend with the features
it has.
"""
truncate_params = {}
# Quick booleans for the type of this spatial backend, and
# an attribute for the sp... | bsd-3-clause |
aburan28/blaze | blaze/compute/air/execution/python_interp.py | 5 | 1534 | # -*- coding: utf-8 -*-
"""
Python evaluation of blaze AIR.
"""
from __future__ import absolute_import, division, print_function
from pykit.ir import interp
import blaze
# Use numpy for now until dynd supports reshape
import numpy as np
#------------------------------------------------------------------------
# I... | bsd-3-clause |
ghmajx/shadowsocks | shadowsocks/lru_cache.py | 983 | 4290 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2015 clowwindy
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | apache-2.0 |
hflynn/openmicroscopy | components/tools/OmeroPy/src/omero/gateway/scripts/dbhelpers.py | 2 | 18443 | import sys
sys.path.append('.')
import omero.gateway
import omero.model
from omero.rtypes import *
import os
import subprocess
import re
import time
import urllib2
from types import StringTypes
from path import path
BASEPATH = os.path.dirname(os.path.abspath(__file__))
TESTIMG_URL = 'http://users.openmicroscopy.org.... | gpl-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.