repo_name stringlengths 5 100 | ref stringlengths 12 67 | path stringlengths 4 244 | copies stringlengths 1 8 | content stringlengths 0 1.05M ⌀ |
|---|---|---|---|---|
hujiajie/pa-chromium | refs/heads/master | remoting/tools/uuidgen.py | 40 | #!/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.
"""
uuidgen.py -- UUID generation utility.
"""
import sys
import uuid
def main():
print uuid.uuid4()
return 0
if __name__ ==... |
jchevin/MissionPlanner-master | refs/heads/master | Lib/json/tool.py | 113 | r"""Command-line tool to validate and pretty-print JSON
Usage::
$ echo '{"json":"obj"}' | python -m json.tool
{
"json": "obj"
}
$ echo '{ 1.2:3.4}' | python -m json.tool
Expecting property name: line 1 column 2 (char 2)
"""
import sys
import json
def main():
if len(sys.argv) == 1:
... |
adamwwt/chvac | refs/heads/master | venv/lib/python2.7/site-packages/sqlalchemy/dialects/drizzle/__init__.py | 195 | from sqlalchemy.dialects.drizzle import base, mysqldb
base.dialect = mysqldb.dialect
from sqlalchemy.dialects.drizzle.base import \
BIGINT, BINARY, BLOB, \
BOOLEAN, CHAR, DATE, \
DATETIME, DECIMAL, DOUBLE, \
ENUM, FLOAT, INTEGER, \
NUMERIC, REAL, TEXT, \
TIME, TIMESTAMP, VARBINARY, \
VARCH... |
dgarros/ansible | refs/heads/devel | lib/ansible/modules/network/bigswitch/bigmon_policy.py | 51 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Ansible module to manage Big Monitoring Fabric service chains
# (c) 2016, Ted Elhourani <ted@bigswitch.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 publishe... |
tornadozou/tensorflow | refs/heads/master | tensorflow/contrib/distributions/python/ops/relaxed_bernoulli.py | 55 | # 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... |
Kazade/NeHe-Website | refs/heads/master | google_appengine/lib/django_1_2/django/contrib/gis/models.py | 624 | from django.db import connection
if (hasattr(connection.ops, 'spatial_version') and
not connection.ops.mysql):
# Getting the `SpatialRefSys` and `GeometryColumns`
# models for the default spatial backend. These
# aliases are provided for backwards-compatibility.
SpatialRefSys = connection.ops.spat... |
capybaralet/Sequential-Generation | refs/heads/master | TestRAMVideo.py | 1 | ##################################################################
# Code for testing the variational Multi-Stage Generative Model. #
##################################################################
from __future__ import print_function, division
# basic python
import cPickle as pickle
from PIL import Image
import ... |
mattaw/SoCFoundationFlow | refs/heads/master | admin/waf/waf-1.8.19/waflib/extras/go.py | 4 | #!/usr/bin/env python
# encoding: utf-8
# Tom Wambold tom5760 gmail.com 2009
# Thomas Nagy 2010
"""
Go as a language may look nice, but its toolchain is one of the worse a developer
has ever seen. It keeps changing though, and I would like to believe that it will get
better eventually, but the crude reality is that th... |
Vogtinator/micropython | refs/heads/nspire | tests/import/pkg3/subpkg1/mod1.py | 118 | print("subpkg1.mod1 __name__:", __name__)
from ..mod2 import foo
|
thomazs/geraldo | refs/heads/master | site/newsite/django_1_0/django/contrib/djangoplus/fieldtypes/__init__.py | 9 | import datetime
from django.db import models
from django.db.models import signals
from django.conf import settings
from django.utils import simplejson as json
from django.dispatch import dispatcher
"""
JSONField: http://www.djangosnippets.org/snippets/377/
"""
class JSONEncoder(json.JSONEncoder):
def default(self... |
TwolDE2/enigma2 | refs/heads/6.2 | lib/python/Components/Converter/EventTime.py | 52 | from Converter import Converter
from Poll import Poll
from time import time
from Components.Element import cached, ElementError
from Components.config import config
from enigma import eEPGCache
class EventTime(Poll, Converter, object):
STARTTIME = 0
ENDTIME = 1
REMAINING = 2
REMAINING_VFD = 3
PROGRESS = 4
DURATI... |
rcritten/novajoin | refs/heads/master | doc/source/conf.py | 1 | # -*- coding: utf-8 -*-
# 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... |
futuresystems/465-git4hiroaki | refs/heads/master | HW3/hshioi_cloudmesh_ex2.py | 4 | # coding: utf-8
import cloudmesh
print cloudmesh.shell("cloud list")
print cloudmesh.shell("cloud on india")
print cloudmesh.shell("cloud list")
|
whn09/tensorflow | refs/heads/master | tensorflow/contrib/ffmpeg/encode_audio_op_test.py | 75 | # 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... |
mancoast/CPythonPyc_test | refs/heads/master | fail/340_test_sys.py | 3 | import unittest, test.support
import sys, io, os
import struct
import subprocess
import textwrap
import warnings
import operator
import codecs
import gc
import sysconfig
import platform
# count the number of test runs, used to create unique
# strings to intern in test_intern()
numruns = 0
try:
import threading
ex... |
vmarkovtsev/django | refs/heads/master | django/contrib/gis/gdal/__init__.py | 327 | """
This module houses ctypes interfaces for GDAL objects. The following GDAL
objects are supported:
CoordTransform: Used for coordinate transformations from one spatial
reference system to another.
Driver: Wraps an OGR data source driver.
DataSource: Wrapper for the OGR data source object, supports
OGR-su... |
houssemFat/MeeM-Dev | refs/heads/master | core/apps/history/models.py | 1 | from django.contrib.contenttypes.models import ContentType
from django.utils.encoding import smart_text
from django.db import models
from django.utils.translation import ugettext, ugettext_lazy as _
from datetime import datetime
from core.apps.accounts.models import User
class UserLogEntryManager(models.Manager):
... |
repotvsupertuga/tvsupertuga.repository | refs/heads/master | instal/script.module.liveresolver/lib/js2py/host/jsfunctions.py | 39 | from js2py.base import *
RADIX_CHARS = {'1': 1, '0': 0, '3': 3, '2': 2, '5': 5, '4': 4, '7': 7, '6': 6, '9': 9, '8': 8, 'a': 10, 'c': 12,
'b': 11, 'e': 14, 'd': 13, 'g': 16, 'f': 15, 'i': 18, 'h': 17, 'k': 20, 'j': 19, 'm': 22, 'l': 21,
'o': 24, 'n': 23, 'q': 26, 'p': 25, 's': 28, 'r': 27... |
hiromu2000/ofxparse | refs/heads/master | ofxparse/ofxparse.py | 1 | from __future__ import absolute_import, with_statement
import sys
import decimal
import datetime
import codecs
import re
import collections
import contextlib
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
import six
if 'OrderedDict' in dir(collections):
odict = collection... |
tp7/assfc | refs/heads/master | font_loader/ttc_parser.py | 1 | from collections import namedtuple
import logging
import struct
from font_loader.ttf_parser import TTFFont
TTCHeader = namedtuple('TTCHeader', ['tag','version','num_fonts'])
class TTCFont(object):
def __init__(self, path):
self.__info = []
self.parse(path)
def parse(self, path):
with... |
moreati/django-userena | refs/heads/master | userena/contrib/umessages/signals.py | 23 | from django.dispatch import Signal
email_sent = Signal(providing_args=["msg"])
|
TinajaLabs/makerfaire2015 | refs/heads/master | SensorGateway/home/tinaja/downloads/simplejson-2.6.1/simplejson/tests/test_speedups.py | 129 | from unittest import TestCase
from simplejson import encoder, scanner
def has_speedups():
return encoder.c_make_encoder is not None
class TestDecode(TestCase):
def test_make_scanner(self):
if not has_speedups():
return
self.assertRaises(AttributeError, scanner.c_make_scanner, 1)
... |
molobrakos/home-assistant | refs/heads/master | homeassistant/helpers/device_registry.py | 4 | """Provide a way to connect entities belonging to one device."""
import logging
import uuid
from asyncio import Event
from collections import OrderedDict
from typing import List, Optional, cast
import attr
from homeassistant.core import callback
from homeassistant.loader import bind_hass
from .typing import HomeAssi... |
yohanboniface/python-mapnik | refs/heads/master | test/python_tests/ogr_test.py | 3 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from nose.tools import assert_almost_equal, eq_, raises
import mapnik
from .utilities import execution_path, run_all
try:
import json
except ImportError:
import simplejson as json
def setup():
# All of the paths used are relative, if we run the ... |
miyakz1192/neutron | refs/heads/master | neutron/openstack/common/systemd.py | 101 | # Copyright 2012-2014 Red Hat, 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... |
emawind84/readthedocs.org | refs/heads/master | readthedocs/builds/migrations/0001_initial.py | 34 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import readthedocs.builds.version_slug
import taggit.managers
class Migration(migrations.Migration):
dependencies = [
('projects', '0001_initial'),
('taggit', '0001_initial'),
]
oper... |
desteam/android_kernel_huawei_msm7x30 | refs/heads/cm-12.0 | tools/perf/util/setup.py | 4998 | #!/usr/bin/python2
from distutils.core import setup, Extension
from os import getenv
from distutils.command.build_ext import build_ext as _build_ext
from distutils.command.install_lib import install_lib as _install_lib
class build_ext(_build_ext):
def finalize_options(self):
_build_ext.finalize_optio... |
zhakui/python | refs/heads/master | NKUCodingCat/0019/0019.py | 40 | #coding=utf-8
import xlrd, json, os
from lxml import etree
path = os.path.split(os.path.realpath(__file__))[0]+"/"
data = xlrd.open_workbook(path+"numbers.xls")
table = data.sheets()[0]
nrows = table.nrows
Dict = []
for i in range(nrows ):
Arr = table.row_values(i)
Dict.append(Arr)
root = etree.Element("root")
child1... |
SUSE/azure-sdk-for-python | refs/heads/master | azure-mgmt-compute/azure/mgmt/compute/compute/v2016_04_30_preview/models/sub_resource.py | 29 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... |
v-iam/azure-sdk-for-python | refs/heads/master | azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/models/storage_account_regenerate_key_parameters.py | 5 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... |
hes19073/hesweewx | refs/heads/master | bin/user/forecastAeris.py | 1 | # -*- coding: utf-8 -*-
# $Id: forecastAeris.py 1651 2020-09-24 12:10:37Z hes $
# original by Pat O'Brien, August 19, 2018
# Copyright 2020 Hartmut Schweidler
#
# Wetter Prognose by AerisWeather
""" in skin.conf
[Extras]
# forecastAeris ny aerisWeather
forecast_enabled = 0
# getAeris
... |
rasbt/bugreport | refs/heads/master | scikit-learn/gridsearch_memory/code/naive_bayes_scripts/bernoulli_gridsearch_1.py | 1 | # Sebastian Raschka 2014
import os
from sklearn.feature_extraction.text import CountVectorizer, TfidfTransformer
from sklearn.grid_search import GridSearchCV
from time import time
from sklearn.pipeline import Pipeline
from sklearn.naive_bayes import MultinomialNB, BernoulliNB
import pandas as pd
from nltk.s... |
pombredanne/tahoe-lafs | refs/heads/master | src/allmydata/test/test_ftp.py | 6 |
from twisted.trial import unittest
from allmydata.frontends import ftpd
from allmydata.immutable import upload
from allmydata.mutable import publish
from allmydata.test.no_network import GridTestMixin
from allmydata.test.common_util import ReallyEqualMixin
class Handler(GridTestMixin, ReallyEqualMixin, unittest.Test... |
openiitbombayx/edx-platform | refs/heads/master | openedx/core/djangoapps/user_api/tests/test_middleware.py | 152 | """Tests for user API middleware"""
from mock import Mock, patch
from unittest import TestCase
from django.http import HttpResponse
from django.test.client import RequestFactory
from student.tests.factories import UserFactory, AnonymousUserFactory
from ..tests.factories import UserCourseTagFactory
from ..middleware ... |
Pulgama/supriya | refs/heads/master | supriya/osc/OscCallback.py | 1 | from supriya.system.SupriyaObject import SupriyaObject
class OscCallback(SupriyaObject):
"""
An OSC callback.
::
>>> import supriya.osc
>>> callback = supriya.osc.OscCallback(
... address_pattern='/*',
... procedure=lambda x: print('GOT:', x),
... )
... |
IgorGolubenkov/sample-code | refs/heads/master | sample-code/examples/python/android_sauce.py | 33 | from appium import webdriver
from appium import SauceTestCase, on_platforms
app = "http://appium.s3.amazonaws.com/NotesList.apk"
platforms = [{
"platformName": "Android",
"platformVersion": "4.4",
"deviceName": "Android Emulator",
"appPackage": "com.exam... |
retomerz/intellij-community | refs/heads/master | python/lib/Lib/site-packages/django/contrib/localflavor/jp/jp_prefectures.py | 543 | from django.utils.translation import ugettext_lazy
JP_PREFECTURES = (
('hokkaido', ugettext_lazy('Hokkaido'),),
('aomori', ugettext_lazy('Aomori'),),
('iwate', ugettext_lazy('Iwate'),),
('miyagi', ugettext_lazy('Miyagi'),),
('akita', ugettext_lazy('Akita'),),
('yamagata', ugettext_lazy('Yamagat... |
OCForks/phantomjs | refs/heads/master | src/breakpad/src/third_party/protobuf/protobuf/python/google/protobuf/internal/message_listener.py | 590 | # Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# http://code.google.com/p/protobuf/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions o... |
pattisdr/osf.io | refs/heads/develop | osf/management/commands/confirm_spam.py | 5 | """Mark specified nodes as spam.
python manage.py confirm_spam abc12
"""
import logging
from django.core.management.base import BaseCommand
from osf.models import Guid, Preprint
logger = logging.getLogger(__name__)
def confirm_spam(guid):
node = guid.referent
referent_type = 'preprint' if isinstance(nod... |
nerdvegas/rez | refs/heads/master | src/rezgui/widgets/TimeSelecterPopup.py | 1 | from Qt import QtCore, QtWidgets, QtGui
from rezgui.util import update_font, create_pane
from rez.utils.formatting import readable_time_duration
import math
class Canvas(QtWidgets.QWidget):
secondsHover = QtCore.Signal(int)
secondsClicked = QtCore.Signal(int)
def __init__(self, width, height, parent=Non... |
oberlin/django | refs/heads/master | django/core/serializers/pyyaml.py | 439 | """
YAML serializer.
Requires PyYaml (http://pyyaml.org/), but that's checked for in __init__.
"""
import collections
import decimal
import sys
from io import StringIO
import yaml
from django.core.serializers.base import DeserializationError
from django.core.serializers.python import (
Deserializer as PythonDes... |
pklimai/py-junos-eznc | refs/heads/master | lib/jnpr/junos/resources/syslog.py | 3 | """
Pythonifier for Syslog Table/View
"""
from jnpr.junos.factory import loadyaml
from os.path import splitext
_YAML_ = splitext(__file__)[0] + '.yml'
globals().update(loadyaml(_YAML_))
|
ProfessionalIT/professionalit-webiste | refs/heads/master | sdk/google_appengine/lib/django-1.4/django/contrib/gis/geoip/prototypes.py | 200 | from ctypes import c_char_p, c_float, c_int, string_at, Structure, POINTER
from django.contrib.gis.geoip.libgeoip import lgeoip, free
#### GeoIP C Structure definitions ####
class GeoIPRecord(Structure):
_fields_ = [('country_code', c_char_p),
('country_code3', c_char_p),
('country... |
sassoftware/mint | refs/heads/master | mint_test/resttest/apitest/modulehookstest.py | 1 | #!/usr/bin/python
#
# Copyright (c) SAS Institute 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... |
bowlofstew/Impala | refs/heads/cdh5-trunk | tests/__init__.py | 186 | # This file is needed to make the files in this directory a python module
|
funkring/fdoo | refs/heads/8.0-fdoo | addons/base_report_designer/__init__.py | 421 | # -*- 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... |
Qalthos/ansible | refs/heads/devel | test/units/utils/test_context_objects.py | 29 | # -*- coding: utf-8 -*-
# Copyright: (c) 2018, Toshio Kuratomi <tkuratomi@ansible.com>
# 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)
__metaclass__ = type
try:
import argparse
except Imp... |
ryfeus/lambda-packs | refs/heads/master | Lxml_requests/source/requests/packages/urllib3/connection.py | 64 | from __future__ import absolute_import
import datetime
import logging
import os
import sys
import socket
from socket import error as SocketError, timeout as SocketTimeout
import warnings
from .packages import six
from .packages.six.moves.http_client import HTTPConnection as _HTTPConnection
from .packages.six.moves.http... |
liuqr/edx-xiaodun | refs/heads/master | i18n/tests/test_compiled_messages.py | 22 | """
Test that the compiled .mo files match the translations in the
uncompiled .po files.
This is required because we are checking in the .mo files into
the repo, but compiling them is a manual process. We want to make
sure that we find out if someone forgets the compilation step.
"""
import ddt
import polib
from unit... |
TomT0m/cmds | refs/heads/master | command/cmds.py | 1 | #! /usr/bin/python3
#encoding: utf-8
"""
#Description : a script listing & showing description of other scripts
scripts listed must follow the following convention : a line beginning with # and matching 'Description( )?:(.*)'
Other meta information includes :
"Group" if command is a meta command, used as a simily ... |
GalaxyTab4/android_kernel_samsung_s3ve3g | refs/heads/cm-13.0 | tools/perf/util/setup.py | 4998 | #!/usr/bin/python2
from distutils.core import setup, Extension
from os import getenv
from distutils.command.build_ext import build_ext as _build_ext
from distutils.command.install_lib import install_lib as _install_lib
class build_ext(_build_ext):
def finalize_options(self):
_build_ext.finalize_optio... |
isu-enterprise/icc.cellula | refs/heads/master | src/icc/cellula/indexer/components.py | 3 | from icc.cellula.indexer.interfaces import IIndexer
from zope.interface import implementer, Interface
from zope.component import getUtility
import subprocess as sp
from icc.contentstorage import intdigest, hexdigest
import os.path, os, signal
from icc.cellula.indexer.sphinxapi import *
from pkg_resources import resourc... |
kaiserroll14/301finalproject | refs/heads/master | main/numpy/core/tests/test_indexerrors.py | 145 | from __future__ import division, absolute_import, print_function
import numpy as np
from numpy.testing import TestCase, run_module_suite, assert_raises
class TestIndexErrors(TestCase):
'''Tests to exercise indexerrors not covered by other tests.'''
def test_arraytypes_fasttake(self):
'take from a 0-l... |
adelton/django | refs/heads/master | django/views/static.py | 190 | """
Views and functions for serving static files. These are only to be used
during development, and SHOULD NOT be used in a production setting.
"""
from __future__ import unicode_literals
import mimetypes
import os
import posixpath
import re
import stat
from django.http import (
FileResponse, Http404, HttpRespons... |
bluedynamics/bda.bfg.app | refs/heads/master | src/bda/bfg/app/browser/authoring.py | 1 | from repoze.bfg.view import bfg_view
from bda.bfg.tile import (
Tile,
tile,
registerTile,
render_tile,
)
from bda.bfg.app.model import (
getNodeInfo,
Properties,
BaseNode,
AdapterNode,
)
from bda.bfg.app.browser import render_main_template
from bda.bfg.app.browser.layout import Protected... |
jabesq/home-assistant | refs/heads/dev | homeassistant/components/tellstick/sensor.py | 7 | """Support for Tellstick sensors."""
import logging
from collections import namedtuple
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import TEMP_CELSIUS, CONF_ID, CONF_NAME
from homeassistant.helpers.entity import Entity
import homeassistant.helpers.conf... |
linjoahow/w17test_1 | refs/heads/master | static/Brython3.1.1-20150328-091302/Lib/_socket.py | 742 | """Implementation module for socket operations.
See the socket module for documentation."""
AF_APPLETALK = 16
AF_DECnet = 12
AF_INET = 2
AF_INET6 = 23
AF_IPX = 6
AF_IRDA = 26
AF_SNA = 11
AF_UNSPEC = 0
AI_ADDRCONFIG = 1024
AI_ALL = 256
AI_CANONNAME = 2
AI_NUMERICHOST = 4
AI_NUMERICSERV = 8
AI_PASSIVE = 1... |
hnarayanan/django-rest-framework | refs/heads/master | tests/test_serializer.py | 5 | # coding: utf-8
from __future__ import unicode_literals
from .utils import MockObject
from rest_framework import serializers
from rest_framework.compat import unicode_repr
import pickle
import pytest
# Tests for core functionality.
# -----------------------------
class TestSerializer:
def setup(self):
cl... |
vadimtk/chrome4sdp | refs/heads/master | chrome/common/extensions/docs/server2/caching_rietveld_patcher_test.py | 121 | #!/usr/bin/env python
# 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 unittest
from caching_rietveld_patcher import (CachingRietveldPatcher,
_VERSION_CACHE_MAXA... |
ibinti/intellij-community | refs/heads/master | python/testData/inspections/ChainedComparison1_after.py | 83 | if e < a <= b < c <= d:
print "q" |
beiko-lab/gengis | refs/heads/master | bin/Lib/site-packages/wx-2.8-msw-unicode/wx/tools/Editra/src/syntax/_sh.py | 3 | ###############################################################################
# Name: sh.py #
# Purpose: Define Bourne/Bash/Csh/Korn Shell syntaxes for highlighting and #
# other features. #
... |
paweljasinski/ironpython3 | refs/heads/master | Tests/interop/net/__init__.py | 3 | #####################################################################################
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# This source code is subject to terms and conditions of the Apache License, Version 2.0. A
# copy of the license can be found in the License.html file at the root of th... |
sailfish-sdk/sailfish-qtcreator | refs/heads/master | tests/system/tools/objectsToTable.py | 6 | #!/usr/bin/env python
############################################################################
#
# Copyright (C) 2016 The Qt Company Ltd.
# Contact: https://www.qt.io/licensing/
#
# This file is part of Qt Creator.
#
# Commercial License Usage
# Licensees holding valid commercial Qt licenses may use this file in
#... |
dsajkl/123 | refs/heads/master | lms/lib/xblock/field_data.py | 63 | """
:class:`~xblock.field_data.FieldData` subclasses used by the LMS
"""
from xblock.field_data import ReadOnlyFieldData, SplitFieldData
from xblock.fields import Scope
class LmsFieldData(SplitFieldData):
"""
A :class:`~xblock.field_data.FieldData` that
reads all UserScope.ONE and UserScope.ALL fields fr... |
aaleotti-unimore/ComicsScraper | refs/heads/master | lib/packaging/utils.py | 1126 | # This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function
import re
_canonicalize_regex = re.compile(r"[-_.]+")
def canonicalize... |
benschmaus/catapult | refs/heads/master | telemetry/telemetry/story/__init__.py | 8 | # Copyright 2015 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 py_utils import cloud_storage # pylint: disable=import-error
from telemetry.story.shared_state import SharedState
from telemetry.story.story import St... |
ttglennhall/DjangoGirlsTutorial | refs/heads/master | myvenv/lib/python3.4/site-packages/pip/basecommand.py | 392 | """Base Command class, and related routines"""
import os
import sys
import tempfile
import traceback
import time
import optparse
from pip import cmdoptions
from pip.locations import running_under_virtualenv
from pip.log import logger
from pip.download import PipSession
from pip.exceptions import (BadCommand, Installa... |
IV-GII/Django_Traduccion | refs/heads/master | allauth/socialaccount/providers/google/views.py | 20 | import requests
from allauth.socialaccount.providers.oauth2.views import (OAuth2Adapter,
OAuth2LoginView,
OAuth2CallbackView)
from .provider import GoogleProvider
class GoogleOAuth2Adapter(OAuth2Adapt... |
sudotliu/oh-my-zsh | refs/heads/master | plugins/git-prompt/gitstatus.py | 343 | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
from subprocess import Popen, PIPE
import re
# change those symbols to whatever you prefer
symbols = {
'ahead of': '↑',
'behind': '↓',
'staged': '♦',
'changed': '‣',
'untracked': '…',
'clean': '⚡',
'unmerged': '≠',
'sha1': ':'
}
output, err... |
HesselTjeerdsma/Cyber-Physical-Pacman-Game | refs/heads/master | Algor/flask/bin/rst2odt_prepstyles.py | 1 | #!/home/hessel/Cyber-Physical-Pacman-Game/Algor/flask/bin/python2
# $Id: rst2odt_prepstyles.py 5839 2009-01-07 19:09:28Z dkuhlman $
# Author: Dave Kuhlman <dkuhlman@rexx.com>
# Copyright: This module has been placed in the public domain.
"""
Fix a word-processor-generated styles.odt for odtwriter use: Drop page size
... |
adnanh/zulip | refs/heads/master | zerver/management/commands/create_realm.py | 115 | from __future__ import absolute_import
from optparse import make_option
from django.conf import settings
from django.core.management.base import BaseCommand
from zerver.lib.actions import do_create_realm, set_default_streams
from zerver.models import RealmAlias
if not settings.VOYAGER:
from zilencer.models import... |
yuweijun/learning-programming | refs/heads/master | language-python/count_lines.py | 1 | #! /usr/bin/python
import sys
data = sys.stdin.readlines()
print "counted", len(data), "lines." |
swift-nav/libsbp | refs/heads/master | generator/sbpg/targets/java.py | 6 | #!/usr/bin/env python
# Copyright (C) 2015 Swift Navigation Inc.
# Contact: Bhaskar Mookerji <mookerji@swiftnav.com>
#
# This source is subject to the license found in the file 'LICENSE' which must
# be be distributed together with this source. All other rights reserved.
#
# THIS CODE AND INFORMATION IS PROVIDED "AS IS... |
algorhythms/LintCode | refs/heads/master | Count of Smaller Number.py | 4 | """
Give you an integer array (index from 0 to n-1, where n is the size of this array, value from 0 to 10000) and an query
list. For each query, give you an integer, return the number of element in the array that are smaller that the given
integer.
Example
For array [1,2,7,8,5], and queries [1,8,5], return [0,4,2]
No... |
polyval/CNC | refs/heads/master | flask/Lib/site-packages/pip/utils/__init__.py | 186 | from __future__ import absolute_import
import contextlib
import errno
import locale
import logging
import re
import os
import posixpath
import shutil
import stat
import subprocess
import sys
import tarfile
import zipfile
from pip.exceptions import InstallationError
from pip.compat import console_to_str, stdlib_pkgs
f... |
aron-bordin/kivy | refs/heads/master | examples/camera/main.py | 40 | '''
Camera Example
==============
This example demonstrates a simple use of the camera. It shows a window with
a buttoned labelled 'play' to turn the camera on and off. Note that
not finding a camera, perhaps because gstreamer is not installed, will
throw an exception during the kv language processing.
'''
# Uncomme... |
HatsuneMiku0309/2014cdag10 | refs/heads/master | wsgi/static/Brython2.1.0-20140419-113919/Lib/sre_parse.py | 111 | #
# Secret Labs' Regular Expression Engine
#
# convert re-style regular expression to sre pattern
#
# Copyright (c) 1998-2001 by Secret Labs AB. All rights reserved.
#
# See the sre.py file for information on usage and redistribution.
#
"""Internal support module for sre"""
# XXX: show string offset and offending ch... |
vzhong/pystacks | refs/heads/master | examples/__init__.py | 53 | __author__ = 'victor'
|
davidgfnet/buildroot-Os | refs/heads/master | support/scripts/kconfiglib.py | 146 | # This is Kconfiglib, a Python library for scripting, debugging, and extracting
# information from Kconfig-based configuration systems. To view the
# documentation, run
#
# $ pydoc kconfiglib
#
# or, if you prefer HTML,
#
# $ pydoc -w kconfiglib
#
# The examples/ subdirectory contains examples, to be run with e.g.
#
... |
andreparrish/python-for-android | refs/heads/master | python3-alpha/python3-src/Lib/asyncore.py | 46 | # -*- Mode: Python -*-
# Id: asyncore.py,v 2.51 2000/09/07 22:29:26 rushing Exp
# Author: Sam Rushing <rushing@nightmare.com>
# ======================================================================
# Copyright 1996 by Sam Rushing
#
# All Rights Reserved
#
# Permission to use, copy, modify,... |
calvin--/VCSRip | refs/heads/master | vcsrip/IndexParser.py | 1 | import struct
import binascii
def parse_index(index_file):
f = open(index_file, "rb")
def read(format):
format = "! " + format
bytes = f.read(struct.calcsize(format))
return struct.unpack(format, bytes)[0]
index = {}
entries = []
index["signature"] = f.read(4).decode("asc... |
AnimeshSinha1309/Website-Edunet | refs/heads/master | WebsiteEdunet/env/Lib/site-packages/django/contrib/gis/geoip/prototypes.py | 535 | from ctypes import POINTER, Structure, c_char_p, c_float, c_int, string_at
from django.contrib.gis.geoip.libgeoip import free, lgeoip
# #### GeoIP C Structure definitions ####
class GeoIPRecord(Structure):
_fields_ = [('country_code', c_char_p),
('country_code3', c_char_p),
('cou... |
smkr/pyclipse | refs/heads/master | plugins/org.python.pydev/pysrc/third_party/wrapped_for_pydev/ctypes/macholib/framework.py | 320 | """
Generic framework path manipulation
"""
import re
__all__ = ['framework_info']
STRICT_FRAMEWORK_RE = re.compile(r"""(?x)
(?P<location>^.*)(?:^|/)
(?P<name>
(?P<shortname>\w+).framework/
(?:Versions/(?P<version>[^/]+)/)?
(?P=shortname)
(?:_(?P<suffix>[^_]+))?
)$
""")
def framework_info(filename):... |
windworship/kmeansds | refs/heads/master | clustered_ds.py | 1 | # -*- coding: utf-8 -*-
#
# Author: huang
#
'''
The implementation of the framework of combining kmeans with distant supervision
'''
import argparse
import logging
import time
import random
import collections
from sklearn.cluster import MiniBatchKMeans, Birch
from sklearn.feature_extraction import FeatureHasher
fro... |
maxtaco/okws | refs/heads/master | test/system/xmlxlate/py/stress.py | 5 |
import xmlrpclib
import sys
class RpcConst:
def __init__ (self):
pass
def set (self, lst):
setattr (self, lst[0], lst[1])
def setall (self, lst):
for p in lst:
self.set (p)
if len (sys.argv) == 2:
host = sys.argv[1]
else:
host = "0.0.0.0:8081"
server_url... |
eezee-it/server-tools | refs/heads/8.0 | base_user_gravatar/models/__init__.py | 44 | # -*- coding: utf-8 -*-
# © 2015 Endika Iglesias
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import res_users
|
credativUK/OCB | refs/heads/7.0-local | addons/account_analytic_default/account_analytic_default.py | 43 | # -*- 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 GN... |
AJellyBean/CloudPan | refs/heads/master | python/wallpaper_plugin/test.py | 1 | # coding=utf8
# python 2.7
import time, platform
import os
import sys
import re
import fcntl
# import pidfile
def funzioneDemo():
# 这是具体业务函数示例
fout = open('/tmp/demone.log', 'w')
while True:
fout.write(time.ctime() + '\n')
fout.flush()
time.sleep(2)
fout.close()
def createDa... |
nox/servo | refs/heads/master | python/tidy/servo_tidy_tests/test_tidy.py | 4 | # Copyright 2013 The Servo Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution.
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
#... |
10clouds/edx-platform | refs/heads/dev | openedx/core/djangoapps/content/course_structures/tests.py | 7 | """
Course Structure Content sub-application test cases
"""
import json
from nose.plugins.attrib import attr
from xmodule_django.models import UsageKey
from xmodule.modulestore.django import SignalHandler
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories im... |
ehabkost/tp-qemu | refs/heads/master | qemu/tests/timedrift_with_migration.py | 7 | import logging
from autotest.client.shared import error
from virttest import utils_test
def run(test, params, env):
"""
Time drift test with migration:
1) Log into a guest.
2) Take a time reading from the guest and host.
3) Migrate the guest.
4) Take a second time reading.
5) If the drift... |
pombredanne/pyahocorasick | refs/heads/master | dump2dot.py | 2 | """
Aho-Corasick string search algorithm.
Author : Wojciech Muła, wojciech_mula@poczta.onet.pl
WWW : http://0x80.pl
License : public domain
"""
import ahocorasick
import os
from ahocorasick import EMPTY, TRIE, AHOCORASICK;
def dump2dot(automaton, file):
def writeln(text=""):
file.write(text + "\... |
Mixser/django | refs/heads/master | tests/utils_tests/test_tree.py | 429 | import copy
import unittest
from django.utils.tree import Node
class NodeTests(unittest.TestCase):
def setUp(self):
self.node1_children = [('a', 1), ('b', 2)]
self.node1 = Node(self.node1_children)
self.node2 = Node()
def test_str(self):
self.assertEqual(str(self.node1), "(DE... |
garbled1/ansible | refs/heads/devel | test/units/playbook/test_block.py | 119 | # (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) an... |
marma/rdflib | refs/heads/master | test/test_namespace.py | 8 | import unittest
from rdflib.graph import Graph
from rdflib.term import URIRef
from rdflib.py3compat import b
class NamespacePrefixTest(unittest.TestCase):
def test_compute_qname(self):
"""Test sequential assignment of unknown prefixes"""
g = Graph()
self.assertEqual(g.compute_qname(URIRef... |
rabipanda/tensorflow | refs/heads/master | tensorflow/contrib/distributions/python/kernel_tests/conditional_distribution_test.py | 135 | # 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... |
HackingWithPython/Chapter_Source_Code | refs/heads/master | Chapter_4/crack_gui.py | 1 | import win32gui, win32com.client
import time, sys, re, argparse
from itertools import chain, product
from datetime import datetime
class SendKeys:
def __init__ (self):
self.obj = win32com.client.Dispatch("WScript.Shell")
def send (self, data):
self.obj.SendKeys(data, 0)
def run (self, path)... |
j00bar/ansible | refs/heads/devel | lib/ansible/modules/cloud/amazon/ec2_eip.py | 78 | #!/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... |
samueldotj/TeeRISC-Simulator | refs/heads/master | src/python/m5/util/sorteddict.py | 84 | # Copyright (c) 2006-2009 Nathan Binkert <nate@binkert.org>
# 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 ... |
uiri/pxqz | refs/heads/master | venv/lib/python2.7/site-packages/django/contrib/auth/forms.py | 65 | from django import forms
from django.forms.util import flatatt
from django.template import loader
from django.utils.encoding import smart_str
from django.utils.http import int_to_base36
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext, ugettext_lazy as _
from django.contrib.a... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.