repo_name stringlengths 5 100 | path stringlengths 4 294 | copies stringclasses 990
values | size stringlengths 4 7 | content stringlengths 666 1M | license stringclasses 15
values |
|---|---|---|---|---|---|
meabsence/python-for-android | python3-alpha/python3-src/Lib/ctypes/test/test_anon.py | 264 | 2051 | import unittest
from ctypes import *
class AnonTest(unittest.TestCase):
def test_anon(self):
class ANON(Union):
_fields_ = [("a", c_int),
("b", c_int)]
class Y(Structure):
_fields_ = [("x", c_int),
("_", ANON),
... | apache-2.0 |
iulian787/spack | lib/spack/spack/util/string.py | 5 | 1573 | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
def comma_list(sequence, article=''):
if type(sequence) != list:
sequence = list(sequence)
if not sequen... | lgpl-2.1 |
m1ck/bookadoptions | django/core/mail/backends/console.py | 308 | 1295 | """
Email backend that writes messages to console instead of sending them.
"""
import sys
import threading
from django.core.mail.backends.base import BaseEmailBackend
class EmailBackend(BaseEmailBackend):
def __init__(self, *args, **kwargs):
self.stream = kwargs.pop('stream', sys.stdout)
self._loc... | bsd-3-clause |
pkappesser/youtube-dl | devscripts/fish-completion.py | 39 | 1613 | #!/usr/bin/env python
from __future__ import unicode_literals
import optparse
import os
from os.path import dirname as dirn
import sys
sys.path.insert(0, dirn(dirn((os.path.abspath(__file__)))))
import youtube_dl
from youtube_dl.utils import shell_quote
FISH_COMPLETION_FILE = 'youtube-dl.fish'
FISH_COMPLETION_TEMPLA... | unlicense |
simark/pysaleae | saleae/logic.py | 1 | 6347 | # This file is part of pysaleae.
#
# pysaleae 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.
#
# pysaleae is distributed in the hope t... | gpl-3.0 |
pymedusa/SickRage | ext2/enum/__init__.py | 105 | 31054 | """Python Enumerations"""
import sys as _sys
__all__ = ['Enum', 'IntEnum', 'unique']
version = 1, 1, 6
pyver = float('%s.%s' % _sys.version_info[:2])
try:
any
except NameError:
def any(iterable):
for element in iterable:
if element:
return True
return False
try:... | gpl-3.0 |
rallylee/gem5 | ext/pybind11/tests/test_smart_ptr.py | 3 | 8048 | import pytest
from pybind11_tests import ConstructorStats
def test_smart_ptr(capture):
# Object1
from pybind11_tests import (MyObject1, make_object_1, make_object_2,
print_object_1, print_object_2, print_object_3, print_object_4)
for i, o in enumerate([make_object_1(), mak... | bsd-3-clause |
linuxlewis/django-diffs | diffs/signals.py | 1 | 2338 | from __future__ import absolute_import, unicode_literals
import logging
from django.core import serializers
from django.db import connection
from django.db.models.signals import pre_save, post_save
from .helpers import precise_timestamp
from .settings import diffs_settings
logger = logging.getLogger("diffs")
def ... | mit |
albertliangcode/Pi_MonteCarloSim | venv/lib/python2.7/site-packages/pip/__init__.py | 61 | 10305 | #!/usr/bin/env python
from __future__ import absolute_import
import logging
import os
import optparse
import warnings
import sys
import re
from pip.exceptions import InstallationError, CommandError, PipError
from pip.utils import get_installed_distributions, get_prog
from pip.utils import deprecation
from pip.vcs im... | mit |
ychen820/microblog | y/google-cloud-sdk/.install/.backup/lib/yaml/events.py | 985 | 2445 |
# Abstract classes.
class Event(object):
def __init__(self, start_mark=None, end_mark=None):
self.start_mark = start_mark
self.end_mark = end_mark
def __repr__(self):
attributes = [key for key in ['anchor', 'tag', 'implicit', 'value']
if hasattr(self, key)]
argu... | bsd-3-clause |
bixbydev/Bixby | google/gdata-2.0.18/src/gdata/tlslite/utils/dateFuncs.py | 407 | 2181 |
import os
#Functions for manipulating datetime objects
#CCYY-MM-DDThh:mm:ssZ
def parseDateClass(s):
year, month, day = s.split("-")
day, tail = day[:2], day[2:]
hour, minute, second = tail[1:].split(":")
second = second[:2]
year, month, day = int(year), int(month), int(day)
hour, minute, secon... | gpl-3.0 |
jburger424/MediaQueueHCI | m-q-env/lib/python3.4/site-packages/pip/_vendor/distlib/util.py | 190 | 51230 | #
# Copyright (C) 2012-2013 The Python Software Foundation.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
import codecs
from collections import deque
import contextlib
import csv
from glob import iglob as std_iglob
import io
import json
import logging
import os
import py_compile
import re
import shutil
import socket
import... | mit |
dulaccc/django-accounting | accounting/apps/reports/wrappers.py | 3 | 7987 | from decimal import Decimal as D
from collections import defaultdict, OrderedDict
from dateutil.relativedelta import relativedelta
from accounting.apps.books.models import Invoice, Bill
from accounting.apps.books.calculators import ProfitsLossCalculator
from accounting.libs.intervals import TimeInterval
class BaseR... | mit |
rafalo1333/kivy | kivy/uix/behaviors/emacs.py | 10 | 5601 | # -*- encoding: utf-8 -*-
'''
Emacs Behavior
==============
The :class:`~kivy.uix.behaviors.emacs.EmacsBehavior`
`mixin <https://en.wikipedia.org/wiki/Mixin>`_ allows you to add
`Emacs <https://www.gnu.org/software/emacs/>`_ keyboard shortcuts for basic
movement and editing to the :class:`~kivy.uix.textinput.TextInput... | mit |
SnappleCap/oh-mainline | vendor/packages/twisted/doc/core/examples/mouse.py | 19 | 2392 | #!/usr/bin/env python
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Example using MouseMan protocol with the SerialPort transport.
"""
# TODO set tty modes, etc.
# This works for me:
# speed 1200 baud; rows 0; columns 0; line = 0;
# intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D... | agpl-3.0 |
mbauskar/Das_Erpnext | erpnext/stock/report/batch_wise_balance_history/batch_wise_balance_history.py | 3 | 3255 | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import flt, cint, getdate
def execute(filters=None):
if not filters: filters = {}
float_precis... | agpl-3.0 |
tylertian/Openstack | openstack F/nova/nova/tests/compute/test_compute.py | 1 | 234580 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 Piston Cloud Computing, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); y... | apache-2.0 |
arthurchan1111/EventPlanner | node_modules/node-gyp/gyp/tools/pretty_gyp.py | 2618 | 4756 | #!/usr/bin/env python
# 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.
"""Pretty-prints the contents of a GYP file."""
import sys
import re
# Regex to remove comments when we're counting braces.
COMMENT_RE = ... | mit |
raffaelespazzoli/origin | vendor/github.com/google/certificate-transparency/python/demo/vdb/verifiable_base.py | 30 | 2670 | import cPickle as pickle
from verifiable_log import VerifiableLog
from verifiable_map import VerifiableMap
# Extend this class, override _apply_operation and add your own API to:
# 1. append to log
# 2. read from map
class VerifiableBase:
def __init__(self, log):
# The log, such as a VerifiableLog
self._log... | apache-2.0 |
fkorotkov/pants | tests/python/pants_test/backend/jvm/tasks/test_bundle_create.py | 8 | 11859 | # coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
from pant... | apache-2.0 |
JT5D/Alfred-Popclip-Sublime | Sublime Text 2/Emmet/emmet/pyv8loader.py | 2 | 16997 | # coding=utf-8
import os
import os.path
import sys
import json
import re
import threading
import subprocess
import tempfile
import collections
import platform
import semver
import time
import zipfile
is_python3 = sys.version_info[0] > 2
if is_python3:
import urllib.request as url_req
import urllib.error as url_err
... | gpl-2.0 |
jcurbelo/networkx | networkx/classes/tests/test_multigraph.py | 14 | 8638 | #!/usr/bin/env python
from nose.tools import *
import networkx
from test_graph import BaseAttrGraphTester, TestGraph
class BaseMultiGraphTester(BaseAttrGraphTester):
def test_has_edge(self):
G=self.K3
assert_equal(G.has_edge(0,1),True)
assert_equal(G.has_edge(0,-1),False)
assert_equ... | bsd-3-clause |
kostaspl/SpiderMonkey38 | python/mozbuild/mozbuild/test/test_mozinfo.py | 4 | 8470 | #!/usr/bin/env python
# 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/.
import json
import os
import tempfile
import unittest
from StringIO import StringIO
import mozun... | mpl-2.0 |
jtrobec/pants | contrib/go/tests/python/pants_test/contrib/go/tasks/test_go_task.py | 4 | 2527 | # coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from pants_test.task... | apache-2.0 |
mikalstill/nova | nova/scheduler/filters/ram_filter.py | 1 | 4044 | # Copyright (c) 2011 OpenStack Foundation
# Copyright (c) 2012 Cloudscaling
# 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/l... | apache-2.0 |
ycaihua/kbengine | kbe/res/scripts/common/Lib/site-packages/pip/locations.py | 390 | 6202 | """Locations where we look for configs, install stuff, etc"""
import sys
import site
import os
import tempfile
from distutils.command.install import install, SCHEME_KEYS
import getpass
from pip.backwardcompat import get_python_lib, get_path_uid, user_site
import pip.exceptions
DELETE_MARKER_MESSAGE = '''\
This file ... | lgpl-3.0 |
CankingApp/cankingapp.github.io | node_modules/node-gyp/gyp/tools/pretty_vcproj.py | 2637 | 9586 | #!/usr/bin/env python
# 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.
"""Make the format of a vcproj really pretty.
This script normalize and sort an xml. It also fetches all the properties
inside linked... | apache-2.0 |
Edraak/edraak-platform | lms/djangoapps/commerce/tests/test_utils.py | 9 | 13123 | """Tests of commerce utilities."""
import json
import unittest
from urllib import urlencode
import ddt
import httpretty
from django.conf import settings
from django.test import TestCase
from django.test.client import RequestFactory
from django.test.utils import override_settings
from mock import patch
from waffle.test... | agpl-3.0 |
apagac/robottelo-blrm | tests/foreman/ui/test_template.py | 2 | 10200 | # -*- encoding: utf-8 -*-
"""Test class for Template UI"""
from ddt import ddt
from fauxfactory import gen_string
from robottelo import entities
from robottelo.common.constants import OS_TEMPLATE_DATA_FILE, SNIPPET_DATA_FILE
from robottelo.common.decorators import data, run_only_on, skip_if_bug_open
from robottelo.comm... | gpl-3.0 |
robinro/ansible | lib/ansible/modules/windows/win_firewall.py | 12 | 1988 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, Michael Eaton <meaton@iforium.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the Li... | gpl-3.0 |
mhugent/Quantum-GIS | python/plugins/processing/algs/admintools/DeleteWorkspace.py | 2 | 1798 | # -*- coding: utf-8 -*-
"""
***************************************************************************
DeleteWorkspace.py
---------------------
Date : October 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
**********************... | gpl-2.0 |
jagguli/intellij-community | python/lib/Lib/CGIHTTPServer.py | 86 | 12466 | """CGI-savvy HTTP Server.
This module builds on SimpleHTTPServer by implementing GET and POST
requests to cgi-bin scripts.
If the os.fork() function is not present (e.g. on Windows),
os.popen2() is used as a fallback, with slightly altered semantics; if
that function is not present either (e.g. on Macintosh), only Py... | apache-2.0 |
raymancao/Flask-Migrate | tests/test_migrate.py | 4 | 2789 | import os
import shutil
import unittest
import subprocess
import shlex
def run_cmd(cmd):
"""Run a command and return a tuple with (stdout, stderr, exit_code)"""
process = subprocess.Popen(shlex.split(cmd), stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
(stdout, stderr) = pr... | mit |
tiagofrepereira2012/tensorflow | tensorflow/python/framework/importer_test.py | 9 | 44172 | # 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 |
PartidoDeLaRed/pdr-wiki | extensions/ConfirmEdit/captcha.py | 47 | 7848 | #!/usr/bin/python
#
# Script to generate distorted text images for a captcha system.
#
# Copyright (C) 2005 Neil Harris
#
# 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 ... | gpl-2.0 |
nouiz/pylearn2 | pylearn2/training_algorithms/sgd.py | 32 | 48169 | """
Stochastic Gradient Descent and related functionality such as
learning rate adaptation, momentum, and Polyak averaging.
"""
from __future__ import division
__authors__ = "Ian Goodfellow"
__copyright__ = "Copyright 2010-2012, Universite de Montreal"
__credits__ = ["Ian Goodfellow, David Warde-Farley"]
__license__ =... | bsd-3-clause |
zuotingbing/spark | python/pyspark/testing/streamingutils.py | 23 | 6062 | #
# 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 |
jameshicks/pydigree | pydigree/genotypes/labelledalleles.py | 1 | 7621 |
from pydigree.common import all_same_type
from .genoabc import AlleleContainer
class LabelledAlleles(AlleleContainer):
def __init__(self, spans=None, chromobj=None, nmark=None):
if not (chromobj or nmark):
raise ValueError('One of chromobj or nmark must be specified')
self.spans = spa... | apache-2.0 |
jayceyxc/hue | desktop/core/ext-py/lxml-3.3.6/src/lxml/_elementpath.py | 36 | 9311 | #
# ElementTree
# $Id: ElementPath.py 3375 2008-02-13 08:05:08Z fredrik $
#
# limited xpath support for element trees
#
# history:
# 2003-05-23 fl created
# 2003-05-28 fl added support for // etc
# 2003-08-27 fl fixed parsing of periods in element names
# 2007-09-10 fl new selection engine
# 2007-09-12 fl fix... | apache-2.0 |
jayceyxc/hue | apps/security/src/security/api/test_hive.py | 10 | 4602 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (... | apache-2.0 |
Intel-Corporation/tensorflow | tensorflow/python/grappler/controller.py | 39 | 4640 | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | apache-2.0 |
IndonesiaX/edx-platform | common/lib/xmodule/xmodule/modulestore/edit_info.py | 201 | 2843 | """
Access methods to get EditInfo for xblocks
"""
from xblock.fields import XBlockMixin
from abc import ABCMeta, abstractmethod
class EditInfoMixin(XBlockMixin):
"""
Provides the interfaces for getting the edit info from XBlocks
"""
@property
def edited_by(self):
"""
The user id o... | agpl-3.0 |
nmarley/dash | test/functional/test_framework/coverage.py | 6 | 3389 | #!/usr/bin/env python3
# Copyright (c) 2015-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.
"""Utilities for doing coverage analysis on the RPC interface.
Provides a way to track which RPC commands... | mit |
Digenis/scrapy | scrapy/linkextractors/regex.py | 23 | 1360 | import re
from six.moves.urllib.parse import urljoin
from w3lib.html import remove_tags, replace_entities, replace_escape_chars, get_base_url
from scrapy.link import Link
from .sgml import SgmlLinkExtractor
linkre = re.compile(
"<a\s.*?href=(\"[.#]+?\"|\'[.#]+?\'|[^\s]+?)(>|\s.*?>)(.*?)<[/ ]?a>",
re.... | bsd-3-clause |
kampanita/pelisalacarta | python/main-classic/servers/allmyvideos.py | 6 | 5438 | # -*- coding: utf-8 -*-
# ------------------------------------------------------------
# pelisalacarta - XBMC Plugin
# Conector para allmyvideos
# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
# ------------------------------------------------------------
import re
from core import logger
from core import s... | gpl-3.0 |
IV-GII/SocialCookies | Twitter_Python/twitter.py | 1 | 1938 | import tweepy
import web
from web.contrib.template import render_mako
from web import form
web.config.debug=False
consumer_key = 'acisTloOHSws1UA289etVw'
consumer_secret = 'b9eVS9CeFxIFx3jIwKkeeQPfsO3hlrAdWNOfIItQEgU'
access_token = '2308079432-cDmExMexRNNwAEvIUdrtKQFXgfIA1vQPeM4mLRC'
access_token_secret = 'eUFjHJf3W... | gpl-2.0 |
martinez-zea/tts | tlslite/handshakesettings.py | 1 | 5859 | # Author: Trevor Perrin
# See the LICENSE file for legal information regarding use of this file.
"""Class for setting handshake parameters."""
from .constants import CertificateType
from .utils import cryptomath
from .utils import cipherfactory
class HandshakeSettings:
"""This class encapsulates various paramete... | gpl-3.0 |
pytroll/pygac | pygac/utils.py | 1 | 11310 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author(s):
# Stephan Finkensieper <stephan.finkensieper@dwd.de>
# Carlos Horn <carlos.horn@external.eumetsat.int>
# 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 Fre... | gpl-3.0 |
pinae/ctSESAM-python | ctSESAM.py | 2 | 1134 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
import getpass
from hashlib import pbkdf2_hmac
small_letters = list('abcdefghijklmnopqrstuvwxyz')
big_letters = list('ABCDEFGHJKLMNPQRTUVWXYZ')
numbers = list('0123456789')
special_characters = list('#!"§$%&/()[]{}=-_+*<>;:.')
password_characters = small_letters + big_letter... | gpl-3.0 |
mccheung/kbengine | kbe/res/scripts/common/Lib/encodings/shift_jisx0213.py | 816 | 1059 | #
# shift_jisx0213.py: Python Unicode Codec for SHIFT_JISX0213
#
# Written by Hye-Shik Chang <perky@FreeBSD.org>
#
import _codecs_jp, codecs
import _multibytecodec as mbc
codec = _codecs_jp.getcodec('shift_jisx0213')
class Codec(codecs.Codec):
encode = codec.encode
decode = codec.decode
class IncrementalEnc... | lgpl-3.0 |
daavery/audacity | lib-src/lv2/serd/waflib/ConfigSet.py | 266 | 3763 | #! /usr/bin/env python
# encoding: utf-8
# WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file
import copy,re,os
from waflib import Logs,Utils
re_imp=re.compile('^(#)*?([^#=]*?)\ =\ (.*?)$',re.M)
class ConfigSet(object):
__slots__=('table','parent')
def __init__(self,... | gpl-2.0 |
ScottWales/rose | lib/python/rose/config_editor/menu.py | 1 | 47000 | # -*- coding: utf-8 -*-
#-----------------------------------------------------------------------------
# (C) British Crown Copyright 2012-5 Met Office.
#
# This file is part of Rose, a framework for meteorological suites.
#
# Rose is free software: you can redistribute it and/or modify
# it under the terms of the GNU G... | gpl-3.0 |
bhargav2408/python-for-android | python3-alpha/python3-src/Lib/test/test_imp.py | 48 | 13451 | import imp
import os
import os.path
import shutil
import sys
import unittest
from test import support
import importlib
class LockTests(unittest.TestCase):
"""Very basic test of import lock functions."""
def verify_lock_state(self, expected):
self.assertEqual(imp.lock_held(), expected,
... | apache-2.0 |
sacharya/nova | nova/api/openstack/compute/contrib/baremetal_ext_status.py | 3 | 1038 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 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-... | apache-2.0 |
joakim-hove/django | django/utils/decorators.py | 126 | 6875 | "Functions that help with dynamically creating decorators for views."
try:
from contextlib import ContextDecorator
except ImportError:
ContextDecorator = None
from functools import WRAPPER_ASSIGNMENTS, update_wrapper, wraps
from django.utils import six
class classonlymethod(classmethod):
def __get__(se... | bsd-3-clause |
Zerschmetterling91/three.js | utils/exporters/blender/addons/io_three/exporter/utilities.py | 225 | 1229 | import uuid
import hashlib
from .. import constants
ROUND = constants.DEFAULT_PRECISION
def bit_mask(flags):
"""Generate a bit mask.
:type flags: dict
:return: int
"""
bit = 0
true = lambda x, y: (x | (1 << y))
false = lambda x, y: (x & (~(1 << y)))
for mask, position in constant... | mit |
mpvismer/pyqtgraph | pyqtgraph/GraphicsScene/GraphicsScene.py | 16 | 24745 | import weakref
from ..Qt import QtCore, QtGui
from ..python2_3 import sortList, cmp
from ..Point import Point
from .. import functions as fn
from .. import ptime as ptime
from .mouseEvents import *
from .. import debug as debug
if hasattr(QtCore, 'PYQT_VERSION'):
try:
import sip
HAVE_SIP = True
... | mit |
sandymanu/sandy_lettuce_8916 | tools/perf/scripts/python/netdev-times.py | 11271 | 15048 | # Display a process of packets and processed time.
# It helps us to investigate networking or network device.
#
# options
# tx: show only tx chart
# rx: show only rx chart
# dev=: show only thing related to specified device
# debug: work with debug mode. It shows buffer status.
import os
import sys
sys.path.append(os... | gpl-2.0 |
ROCmSoftwarePlatform/Tensile | Tensile/LibraryLogic.py | 1 | 58384 | ################################################################################
# Copyright 2016-2021 Advanced Micro Devices, 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 t... | mit |
hurricup/intellij-community | python/testData/inspections/PyNumpyType/ReturnOptional.py | 79 | 1681 | def unique(ar, return_index=False, return_inverse=False, return_counts=False):
"""
Find the unique elements of an array.
Returns the sorted unique elements of an array. There are two optional
outputs in addition to the unique elements: the indices of the input array
that give the unique values, and... | apache-2.0 |
jjingrong/PONUS-1.2 | venv/Lib/encodings/cp1140.py | 593 | 13361 | """ Python Character Mapping Codec cp1140 generated from 'python-mappings/CP1140.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='stri... | mit |
knossos-project/PythonQt | examples/NicePyConsole/pygments/lexers/pascal.py | 5 | 40611 | # -*- coding: utf-8 -*-
"""
pygments.lexers.pascal
~~~~~~~~~~~~~~~~~~~~~~
Lexers for Pascal family languages.
:copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexer import Lexer, RegexLexer, include, bygroups, ... | lgpl-2.1 |
danlrobertson/servo | tests/wpt/web-platform-tests/tools/third_party/attrs/docs/conf.py | 53 | 4831 | # -*- coding: utf-8 -*-
import codecs
import os
import re
def read(*parts):
"""
Build an absolute path from *parts* and and return the contents of the
resulting file. Assume UTF-8 encoding.
"""
here = os.path.abspath(os.path.dirname(__file__))
with codecs.open(os.path.join(here, *parts), "rb... | mpl-2.0 |
melersh/Yasta | flask/testsuite/ext.py | 57 | 4720 | # -*- coding: utf-8 -*-
"""
flask.testsuite.ext
~~~~~~~~~~~~~~~~~~~
Tests the extension import thing.
:copyright: (c) 2011 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
from __future__ import with_statement
import sys
import unittest
from flask.testsuite import FlaskTestCase... | mit |
MMaus/mutils | fmalibs/aviout.py | 2 | 1460 | import time, glob, os
from pylab import *
class AviOut:
def __init__( self, pth, fps=25):
self.n = 1
self.fig = gcf()
if type(pth)==str:
pfx = pth[:-4]
if pth[-4:].lower() != ".avi":
raise TypeError,"Filename pattern must end with .avi"
if glob.glob(pfx):
raise KeyError,... | gpl-2.0 |
CloudServer/cinder | cinder/tests/unit/monkey_patch_example/__init__.py | 57 | 1112 | # Copyright 2011 OpenStack Foundation
# 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 |
stochasticHydroTools/RotationalDiffusion | read_input/read_clones_file.py | 1 | 1575 | '''
Small module to read a file with the initial locations and orientation
of the rigid bodies.
'''
from __future__ import division, print_function
import numpy as np
import sys
sys.path.append('../')
from quaternion_integrator.quaternion import Quaternion
def read_clones_file(name_file):
'''
It reads a file with ... | gpl-3.0 |
micahflee/supercipher | supercipher_gui/supercipher_gui.py | 1 | 6130 | import os, sys, subprocess, inspect, platform, argparse, socket, json
from PyQt4 import QtCore, QtGui
from file_selection import FileSelection
from passphrases import Passphrases
import common
try:
import supercipher
except ImportError:
sys.path.append(os.path.abspath(common.supercipher_gui_dir+"/.."))
imp... | gpl-3.0 |
infoxchange/lettuce | tests/integration/lib/Django-1.3/tests/regressiontests/forms/tests/widgets.py | 47 | 67270 | # -*- coding: utf-8 -*-
import datetime
from decimal import Decimal
import re
import time
from django.conf import settings
from django.core.files.uploadedfile import SimpleUploadedFile
from django.forms import *
from django.forms.widgets import RadioFieldRenderer
from django.utils import copycompat as copy
from django.... | gpl-3.0 |
noxora/flask-base | flask/lib/python3.4/site-packages/passlib/hash.py | 5 | 3710 | """
passlib.hash - proxy object mapping hash scheme names -> handlers
==================
***** NOTICE *****
==================
This module does not actually contain any hashes. This file
is a stub that replaces itself with a proxy object.
This proxy object (passlib.registry._PasslibRegistryProxy)
handles lazy-loadin... | mit |
roadmapper/ansible | test/units/modules/network/fortios/test_fortios_endpoint_control_settings.py | 21 | 10922 | # Copyright 2019 Fortinet, 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 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the... | gpl-3.0 |
ismangil/pjproject | tests/pjsua/mod_sipp.py | 19 | 8562 | # $Id$
## Automatic test module for SIPp.
##
## This module will need a test driver for each SIPp scenario:
## - For simple scenario, i.e: make/receive call (including auth), this
## test module can auto-generate a default test driver, i.e: make call
## or apply auto answer. Just name the SIPp scenario using "uas"... | gpl-2.0 |
claudep/pootle | pootle/core/dateparse.py | 10 | 1145 | # -*- coding: utf-8 -*-
#
# Copyright (C) Pootle contributors.
#
# This file is a part of the Pootle project. It is distributed under the GPL3
# or later license. See the LICENSE file for a copy of the license and the
# AUTHORS file for copyright and authorship information.
from django.utils import dateparse as django... | gpl-3.0 |
zding5/Microblog-Flask | flask/lib/python2.7/site-packages/sqlalchemy/util/deprecations.py | 21 | 4403 | # util/deprecations.py
# Copyright (C) 2005-2015 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""Helpers related to deprecation of functions, methods, classes, other
functio... | mit |
igemsoftware/SYSU-Software2013 | project/Python27/Lib/test/test_richcmp.py | 129 | 11466 | # Tests for rich comparisons
import unittest
from test import test_support
import operator
class Number:
def __init__(self, x):
self.x = x
def __lt__(self, other):
return self.x < other
def __le__(self, other):
return self.x <= other
def __eq__(self, other):
return... | mit |
DevicePilot/synth | synth/devices/helpers/people_names.py | 1 | 6446 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017 DevicePilot Ltd.
#
# 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 r... | mit |
mezz64/home-assistant | homeassistant/components/venstar/climate.py | 16 | 11240 | """Support for Venstar WiFi Thermostats."""
import logging
from venstarcolortouch import VenstarColorTouch
import voluptuous as vol
from homeassistant.components.climate import PLATFORM_SCHEMA, ClimateEntity
from homeassistant.components.climate.const import (
ATTR_HVAC_MODE,
ATTR_TARGET_TEMP_HIGH,
ATTR_T... | apache-2.0 |
OpenUpgrade/OpenUpgrade | addons/account/wizard/account_use_model.py | 341 | 3361 | # -*- 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 |
koningdde/Arduitools | ESP8266/nodemcu-firmware-master/nodemcu-firmware-master/tools/make_server_cert.py | 13 | 1910 | import os
import argparse
import base64
import re
import sys
class Cert(object):
def __init__(self, name, buff):
self.name = name
self.len = len(buff)
self.buff = buff
pass
def __str__(self):
out_str = ['\0']*32
for i in range(len(self.name)):
o... | gpl-3.0 |
MattDevo/edk2 | AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_13.py | 93 | 13834 | """ Python Character Mapping Codec iso8859_13 generated from 'MAPPINGS/ISO8859/8859-13.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... | bsd-2-clause |
dexterx17/nodoSocket | clients/Python-2.7.6/Misc/BeOS-setup.py | 10 | 23664 | # Autodetecting setup.py script for building the Python extensions
#
# Modified for BeOS build. Donn Cave, March 27 2001.
__version__ = "special BeOS after 1.37"
import sys, os
from distutils import sysconfig
from distutils import text_file
from distutils.errors import *
from distutils.core import Extension, setup
f... | mit |
amyvmiwei/chromium | third_party/scons/scons-local/SCons/Variables/ListVariable.py | 3 | 4455 | """engine.SCons.Variables.ListVariable
This file defines the option type for SCons implementing 'lists'.
A 'list' option may either be 'all', 'none' or a list of names
separated by comma. After the option has been processed, the option
value holds either the named list elements, all list elemens or no
list elements a... | bsd-3-clause |
hendradarwin/VTK | ThirdParty/Twisted/twisted/python/threadpool.py | 29 | 8125 | # -*- test-case-name: twisted.test.test_threadpool -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
twisted.python.threadpool: a pool of threads to which we dispatch tasks.
In most cases you can just use C{reactor.callInThread} and friends
instead of creating a thread pool directly.
"""... | bsd-3-clause |
zorroz/microblog | flask/lib/python2.7/site-packages/pip/util.py | 343 | 24172 | import sys
import shutil
import os
import stat
import re
import posixpath
import zipfile
import tarfile
import subprocess
import textwrap
from pip.exceptions import InstallationError, BadCommand, PipError
from pip.backwardcompat import(WindowsError, string_types, raw_input,
console_to_s... | bsd-3-clause |
wiltonlazary/arangodb | 3rdParty/V8/V8-5.0.71.39/build/gyp/test/rules/gyptest-all.py | 34 | 2191 | #!/usr/bin/env python
# Copyright (c) 2011 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.
"""
Verifies simple rules when using an explicit build target of 'all'.
"""
import sys
if sys.platform == 'win32':
print "This test is c... | apache-2.0 |
Jollytown/Garuda | server/garuda/lib/python2.7/site-packages/django/contrib/admin/checks.py | 34 | 38521 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from itertools import chain
from django.contrib.admin.utils import get_fields_from_path, NotRelationField, flatten
from django.core import checks
from django.db import models
from django.db.models.fields import FieldDoesNotExist
from django.forms.models ... | mit |
egabancho/invenio-access | invenio_access/upgrades/access_2015_05_06_accROLE_accACTION_accARGUMENT_id.py | 4 | 3144 | # -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015 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 later... | gpl-2.0 |
cloudant/bigcouch | couchjs/scons/scons-local-2.0.1/SCons/Script/__init__.py | 61 | 14152 | """SCons.Script
This file implements the main() function used by the scons script.
Architecturally, this *is* the scons script, and will likely only be
called from the external "scons" wrapper. Consequently, anything here
should not be, or be considered, part of the build engine. If it's
something that we expect ot... | apache-2.0 |
vrv/tensorflow | tensorflow/contrib/learn/python/learn/ops/embeddings_ops.py | 116 | 3510 | # Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | apache-2.0 |
edx-solutions/edx-platform | openedx/core/djangoapps/credentials/tests/test_tasks.py | 4 | 2124 | """
Test credentials tasks
"""
import mock
from django.conf import settings
from django.test import TestCase, override_settings
from openedx.core.djangolib.testing.utils import skip_unless_lms
from student.tests.factories import UserFactory
from ..tasks.v1 import tasks
TASKS_MODULE = 'openedx.core.djangoapps.crede... | agpl-3.0 |
xbmc/xbmc-antiquated | xbmc/lib/libPython/Python/Lib/stat.py | 145 | 1667 | """Constants/functions for interpreting results of os.stat() and os.lstat().
Suggested usage: from stat import *
"""
# XXX Strictly spoken, this module may have to be adapted for each POSIX
# implementation; in practice, however, the numeric constants used by
# stat() are almost universal (even for stat() emulations ... | gpl-2.0 |
sonnyhu/numpy | numpy/lib/stride_tricks.py | 57 | 6761 | """
Utilities that manipulate strides to achieve desirable effects.
An explanation of strides can be found in the "ndarray.rst" file in the
NumPy reference guide.
"""
from __future__ import division, absolute_import, print_function
import numpy as np
__all__ = ['broadcast_to', 'broadcast_arrays']
class DummyArray... | bsd-3-clause |
djbaldey/django | tests/template_tests/syntax_tests/test_if_equal.py | 368 | 9892 | from django.test import SimpleTestCase
from ..utils import setup
class IfEqualTagTests(SimpleTestCase):
@setup({'ifequal01': '{% ifequal a b %}yes{% endifequal %}'})
def test_ifequal01(self):
output = self.engine.render_to_string('ifequal01', {'a': 1, 'b': 2})
self.assertEqual(output, '')
... | bsd-3-clause |
chiragjogi/odoo | addons/website_crm/controllers/main.py | 250 | 5499 | # -*- coding: utf-8 -*-
import base64
import werkzeug
import werkzeug.urls
from openerp import http, SUPERUSER_ID
from openerp.http import request
from openerp.tools.translate import _
class contactus(http.Controller):
def generate_google_map_url(self, street, city, city_zip, country_name):
url = "http... | agpl-3.0 |
mitdbg/aurum-datadiscovery | nearpy/__init__.py | 8 | 1126 | # 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, publish, distribute, sublicense, and/or sell
# copi... | mit |
Jianchun1/zulip | zerver/lib/str_utils.py | 5 | 3687 | """
String Utilities:
This module helps in converting strings from one type to another.
Currently we have strings of 3 semantic types:
1. text strings: These strings are used to represent all textual data,
like people's names, stream names, content of messages, etc.
These strings can contain non-ASCII chara... | apache-2.0 |
massifor/distcc | bench/actions.py | 28 | 3161 | # benchmark -- automated system for testing distcc correctness
# and performance on various source trees.
# Copyright (C) 2002, 2003 by Martin Pool
# Copyright 2008 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... | gpl-2.0 |
betoesquivel/CIE | flask/lib/python2.7/site-packages/mako/pyparser.py | 13 | 7737 | # mako/pyparser.py
# Copyright (C) 2006-2014 the Mako authors and contributors <see AUTHORS file>
#
# This module is part of Mako and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""Handles parsing of Python code.
Parsing to AST is done via _ast on Python > 2.5, otherwise th... | mit |
M4sse/chromium.src | tools/telemetry/telemetry/core/platform/profiler/tcpdump_profiler.py | 48 | 4160 | # 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 signal
import subprocess
import sys
import tempfile
from telemetry.core.platform import profiler
from telemetry.core.platform.profiler impo... | bsd-3-clause |
mbr/simplekv | tests/idgens.py | 3 | 4248 | import os
import re
import tempfile
import uuid
from simplekv.idgen import UUIDDecorator, HashDecorator
from simplekv._compat import text_type
import pytest
UUID_REGEXP = re.compile(
r'^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$'
)
class IDGen(object):
@pytest.fixture(params=[
u... | mit |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.