repo_name stringlengths 5 100 | ref stringlengths 12 67 | path stringlengths 4 244 | copies stringlengths 1 8 | content stringlengths 0 1.05M ⌀ |
|---|---|---|---|---|
fperez/sympy | refs/heads/master | sympy/thirdparty/pyglet/pyglet/media/procedural.py | 7 | # ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistribu... |
jyt109/termite-data-server | refs/heads/master | web2py/gluon/contrib/login_methods/dropbox_account.py | 42 | #!/usr/bin/env python
# coding: utf8
"""
Dropbox Authentication for web2py
Developed by Massimo Di Pierro (2012)
Same License as Web2py License
"""
# mind here session is dropbox session, not current.session
import os
import re
import urllib
from dropbox import client, rest, session
from gluon import *
from gluon.to... |
AndrzejR/mining | refs/heads/master | mining/db/backends/mleveldb.py | 6 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from leveldb import LevelDB as DB
from mining.db.datawarehouse import GenericDataWarehouse
class LevelDB(GenericDataWarehouse):
def conn(self):
"""Open connection on LevelDB DataBase"""
conn = DB("/tmp/{}.mining".format(self.conf.get("db"))... |
mcanthony/nupic | refs/heads/master | examples/opf/experiments/spatial_classification/make_datasets.py | 34 | #! /usr/bin/env python
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions... |
douggeiger/gnuradio | refs/heads/master | docs/sphinx/hieroglyph/errors.py | 47 |
from sphinx.errors import ExtensionError
__author__ = 'rjs'
class HieroglyphError(ExtensionError):
'''
An exception type specific to the Hieroglyph Sphinx extension.
'''
pass |
gimite/personfinder | refs/heads/master | app/vendors/pytz/tzfile.py | 129 | #!/usr/bin/env python
'''
$Id: tzfile.py,v 1.8 2004/06/03 00:15:24 zenzen Exp $
'''
try:
from cStringIO import StringIO
except ImportError:
from io import StringIO
from datetime import datetime, timedelta
from struct import unpack, calcsize
from pytz.tzinfo import StaticTzInfo, DstTzInfo, memorized_ttinfo
fro... |
mbroadst/rethinkdb | refs/heads/next | test/common/http_support/flask/templating.py | 783 | # -*- coding: utf-8 -*-
"""
flask.templating
~~~~~~~~~~~~~~~~
Implements the bridge to Jinja2.
:copyright: (c) 2011 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import posixpath
from jinja2 import BaseLoader, Environment as BaseEnvironment, \
TemplateNotFound
from .glo... |
neale/CS-program | refs/heads/master | 434-MachineLearning/final_project/linearClassifier/sklearn/gaussian_process/gpr.py | 43 | """Gaussian processes regression. """
# Authors: Jan Hendrik Metzen <jhm@informatik.uni-bremen.de>
#
# License: BSD 3 clause
import warnings
from operator import itemgetter
import numpy as np
from scipy.linalg import cholesky, cho_solve, solve_triangular
from scipy.optimize import fmin_l_bfgs_b
from sklearn.base im... |
konopski/httpie | refs/heads/master | httpie/core.py | 44 | """This module provides the main functionality of HTTPie.
Invocation flow:
1. Read, validate and process the input (args, `stdin`).
2. Create and send a request.
3. Stream, and possibly process and format, the parts
of the request-response exchange selected by output options.
4. Simultaneously write to `... |
jtopjian/st2 | refs/heads/master | st2common/st2common/transport/bootstrap.py | 3 | # Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... |
m4grio/termineter | refs/heads/master | c1219/errors.py | 6 | # c1219/errors.py
#
# Copyright 2011 Spencer J. McIntyre <SMcIntyre [at] SecureState [dot] 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 version 2 of the License, or
# ... |
prife/rt-thread-prife | refs/heads/master | components/external/freetype/src/tools/docmaker/sources.py | 16 | # Sources (c) 2002, 2003, 2004, 2006, 2007, 2008, 2009
# David Turner <david@freetype.org>
#
#
# this file contains definitions of classes needed to decompose
# C sources files into a series of multi-line "blocks". There are
# two kinds of blocks:
#
# - normal blocks, which contain source code or ordinary... |
sarthakmeh03/django | refs/heads/master | django/contrib/admin/models.py | 60 | from __future__ import unicode_literals
import json
from django.conf import settings
from django.contrib.admin.utils import quote
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.urls import NoReverseMatch, reverse
from django.utils import timezone
from django.utils.... |
tvibliani/odoo | refs/heads/8.0 | addons/l10n_fr/report/base_report.py | 57 | # -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2008 JAILLET Simon - CrysaLEAD - www.crysalead.fr
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
#... |
mrkipling/maraschino | refs/heads/master | modules/transmission.py | 4 | # Author: Geoffrey Huntley <ghuntley@ghuntley.com>
from flask import render_template
import transmissionrpc
from datetime import timedelta
from maraschino.tools import *
from maraschino import app, logger
def log_exception(e):
logger.log('Transmission :: EXCEPTION -- %s' % e, 'DEBUG')
@app.route('/xhr/transmi... |
40223136/w17test2 | refs/heads/master | static/Brython3.1.0-20150301-090019/Lib/importlib/basehook.py | 608 | from javascript import JSObject
from browser import window
import urllib.request
class TempMod:
def __init__(self, name):
self.name=name
#define my custom import hook (just to see if it get called etc).
class BaseHook:
def __init__(self, fullname=None, path=None):
self._fullname=fullname
self._p... |
naousse/odoo | refs/heads/8.0 | addons/pad/py_etherpad/__init__.py | 505 | """Module to talk to EtherpadLite API."""
import json
import urllib
import urllib2
class EtherpadLiteClient:
"""Client to talk to EtherpadLite API."""
API_VERSION = 1 # TODO probably 1.1 sometime soon
CODE_OK = 0
CODE_INVALID_PARAMETERS = 1
CODE_INTERNAL_ERROR = 2
CODE_INVALID_FUNCTION = 3
... |
plumps/i3pystatus | refs/heads/master | i3pystatus/updates/__init__.py | 7 | from i3pystatus import SettingsBase, IntervalModule, formatp
from i3pystatus.core.util import internet, require
class Backend(SettingsBase):
settings = ()
updates = 0
class Updates(IntervalModule):
"""
Generic update checker.
To use select appropriate backend(s) for your system.
For list of ... |
signed/intellij-community | refs/heads/master | python/testData/copyPaste/singleLine/Indent43.after.py | 747 | class C:
def foo(self):
x = 1
y = 2
|
akrehl/dotfiles | refs/heads/master | vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/tests/gmock/gtest/scripts/pump.py | 2471 | #!/usr/bin/env python
#
# Copyright 2008, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list... |
sjagoe/cygit2 | refs/heads/master | cygit2/pygit2/blob.py | 1 | # -*- coding: utf-8 -*-
#
# Copyright 2010-2013 The cygit2 contributors
#
# This file 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.
#
# In addition to the permissions in the GNU General Public Li... |
CSSIP-AIR/UMETRICS | refs/heads/master | ThirdParty/jellyfish/source/test.py | 6 | # -*- coding: utf-8 -*-
import csv
import unittest
import jellyfish
class JellyfishTestCase(unittest.TestCase):
def test_jaro_winkler(self):
cases = [("dixon", "dicksonx", 0.8133),
("dixon", "dicksonx", 0.8133),
("martha", "marhta", 0.9611),
("dwayne", "... |
Jamlum/pytomo | refs/heads/master | pytomo/dns/rdtypes/keybase.py | 2 | # Copyright (C) 2004-2007, 2009, 2010 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose with or without fee is hereby granted,
# provided that the above copyright notice and this permission notice
# appear in all copies.
#
# THE SOFTWARE IS PROVIDED ... |
sxhao/phantomjs | refs/heads/master | src/qt/qtwebkit/Tools/Scripts/webkitpy/tool/commands/findusers.py | 121 | # Copyright (c) 2011 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the ... |
fossilet/ansible | refs/heads/devel | lib/ansible/plugins/connection/jail.py | 11 | # Based on local.py (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>
# and chroot.py (c) 2013, Maykel Moya <mmoya@speedyrails.com>
# (c) 2013, Michael Scherer <misc@zarb.org>
# (c) 2015, Toshio Kuratomi <tkuratomi@ansible.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it... |
hep-gc/glint-horizon | refs/heads/master | openstack_dashboard/dashboards/admin/images/urls.py | 9 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# no... |
xuxiao19910803/edx | refs/heads/master | lms/djangoapps/teams/migrations/0001_initial.py | 84 | # -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'CourseTeam'
db.create_table('teams_courseteam', (
... |
CML/GP0-2.6.35-Kernel | refs/heads/master | scripts/tracing/draw_functrace.py | 14679 | #!/usr/bin/python
"""
Copyright 2008 (c) Frederic Weisbecker <fweisbec@gmail.com>
Licensed under the terms of the GNU GPL License version 2
This script parses a trace provided by the function tracer in
kernel/trace/trace_functions.c
The resulted trace is processed into a tree to produce a more human
view of the call ... |
kutuhal/oracle-r12-accounting | refs/heads/master | lib/django/views/generic/base.py | 82 | from __future__ import unicode_literals
import logging
import warnings
from functools import update_wrapper
from django import http
from django.core.exceptions import ImproperlyConfigured
from django.core.urlresolvers import NoReverseMatch, reverse
from django.template.response import TemplateResponse
from django.uti... |
paulrouget/servo | refs/heads/master | tests/wpt/web-platform-tests/websockets/handlers/receive-backpressure_wsh.py | 38 | #!/usr/bin/python
import time
def web_socket_do_extra_handshake(request):
# Turn off permessage-deflate, otherwise it shrinks our 8MB buffer to 8KB.
request.ws_extension_processors = []
def web_socket_transfer_data(request):
# Wait two seconds to cause backpressure.
time.sleep(2);
request.ws_st... |
treygreer/treb | refs/heads/master | treb_sim/src/first_in_fright_2013.py | 1 | ''' a little bit more in the comment...
'''
import dynamics.simulation
from dynamics.frame import Frame
from dynamics.spring import NailSpring
from dynamics.object import Rectangle, Circle, Beam
from dynamics.constraint import Nail, Rod, Pin, Shelf
from dynamics.animation import Animation
from dynamics.constants impo... |
CatsAndDogsbvba/odoo | refs/heads/8.0 | addons/l10n_es/migrations/8.0.5.1/pre-migration.py | 52 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2015 Serv. Tecnol. Avanz. (<http://www.serviciosbaeza.com>)
# Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
#
# This progra... |
lmtierney/watir-snake | refs/heads/master | nerodia/locators/element/locator.py | 1 | from copy import copy
from time import sleep
from selenium.common.exceptions import NoSuchElementException, StaleElementReferenceException
from nerodia.exception import LocatorException
from nerodia.locators import W3C_FINDERS
from nerodia.locators.class_helpers import ClassHelpers
class Locator(object):
built ... |
mszewczy/odoo | refs/heads/8.0 | addons/point_of_sale/__openerp__.py | 261 | # -*- 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... |
martinb07/mysmarthome | refs/heads/develop | lib/config.py | 1 | #!/usr/bin/env python3
# vim: set encoding=utf-8 tabstop=4 softtabstop=4 shiftwidth=4 expandtab
#########################################################################
# Copyright 2013 Marcus Popp marcus@popp.mx
#########################################################################
# ... |
openstack/taskflow | refs/heads/master | taskflow/jobs/backends/__init__.py | 2 | # -*- coding: utf-8 -*-
# Copyright (C) 2014 Yahoo! 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... |
NMGRL/pychron | refs/heads/develop | pychron/database/orms/isotope/meas.py | 2 | # ===============================================================================
# Copyright 2013 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/licens... |
Tisseo/navitia | refs/heads/dev | source/sql/models/navitia.py | 3 | # -*- coding: utf-8 -*-
## File autogenerated by SQLAutoCode
## see http://code.google.com/p/sqlautocode/
from sqlalchemy import *
from sqlalchemy.dialects.postgresql import *
from geoalchemy2 import Geography
from models import metadata
object_type = Table('object_type', metadata,*[
Column('id', INTEGER(), prima... |
rhyswat/blewog | refs/heads/master | ann.py | 1 | #!/usr/bin/env python3
import collections
import itertools
import math
import pprint
import random
class ANN:
'''
Artifiial Neural Network.
This implementation is based on https://www4.rgu.ac.uk/files/chapter3%20-%20bp.pdf
The data structures don't use Nodes directly. Instead each node is represented... |
samsu/neutron | refs/heads/master | tests/unit/ml2/drivers/cisco/apic/test_cisco_apic_common.py | 6 | # Copyright (c) 2014 Cisco Systems
# 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 require... |
ifduyue/django | refs/heads/master | tests/model_package/models/article.py | 522 | from django.db import models
class Site(models.Model):
name = models.CharField(max_length=100)
class Article(models.Model):
sites = models.ManyToManyField(Site)
headline = models.CharField(max_length=100)
publications = models.ManyToManyField("model_package.Publication", blank=True)
|
leonardo-modules/leonardo-admin-sso | refs/heads/master | leonardo_admin_sso/__init__.py | 1 |
from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
default_app_config = 'leonardo_admin_sso.Config'
LEONARDO_OPTGROUP = 'Admin SSO'
LEONARDO_APPS = ['leonardo_admin_sso', 'admin_sso']
LEONARDO_AUTH_BACKENDS = [
'admin_sso.auth.DjangoSSOAuthBackend',
]
LEONARDO_CONFIG = {
... |
modulexcite/chromium-dashboard | refs/heads/master | server.py | 1 | # -*- coding: utf-8 -*-
# Copyright 2013 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License")
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
jonashaag/django-nonrel-nohistory | refs/heads/master | django/contrib/admin/templatetags/admin_list.py | 154 | import datetime
from django.conf import settings
from django.contrib.admin.util import lookup_field, display_for_field, label_for_field
from django.contrib.admin.views.main import (ALL_VAR, EMPTY_CHANGELIST_VALUE,
ORDER_VAR, ORDER_TYPE_VAR, PAGE_VAR, SEARCH_VAR)
from django.core.exceptions import ObjectDoesNotExis... |
pyblish/pyblish-win | refs/heads/master | lib/Python27/Lib/test/pystone.py | 189 | #! /usr/bin/env python
"""
"PYSTONE" Benchmark Program
Version: Python/1.1 (corresponds to C/1.1 plus 2 Pystone fixes)
Author: Reinhold P. Weicker, CACM Vol 27, No 10, 10/84 pg. 1013.
Translated from ADA to C by Rick Richardson.
Every method to preserve ADA-likeness h... |
itbabu/django-filer | refs/heads/develop | filer/admin/folderadmin.py | 3 | #-*- coding: utf-8 -*-
from django import forms
from django import template
from django.contrib import admin
from django.contrib.admin import helpers
from django.contrib.admin.util import quote, unquote, get_deleted_objects, capfirst
from django.core.exceptions import PermissionDenied
from django.core.paginator import ... |
paramiko/paramiko | refs/heads/master | paramiko/kex_group1.py | 2 | # Copyright (C) 2003-2007 Robey Pointer <robeypointer@gmail.com>
#
# This file is part of paramiko.
#
# Paramiko 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 2.1 of the License, or (a... |
Zhongqilong/kbengine | refs/heads/master | kbe/src/lib/python/Lib/glob.py | 86 | """Filename globbing utility."""
import os
import re
import fnmatch
__all__ = ["glob", "iglob"]
def glob(pathname):
"""Return a list of paths matching a pathname pattern.
The pattern may contain simple shell-style wildcards a la
fnmatch. However, unlike fnmatch, filenames starting with a
dot are spe... |
RedFantom/GSF-Parser | refs/heads/master | data/statistics.py | 1 | """
Author: RedFantom
Contributors: Daethyra (Naiii) and Sprigellania (Zarainia)
License: GNU GPLv3 as in LICENSE
Copyright (C) 2016-2018 RedFantom
"""
categories = ["Hull_and_Shields", "Engine", "Maneuverability", "Weapons", "Sensors"]
weapon_categories = ["General", "Accuracy", "Range", "Missile", "Railgun"]
actives... |
RubnMrtin/CursoPython | refs/heads/master | funciones4.py | 1 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# 22 junio 2016
# Archivo correspondiente al 3er día del curso: "Programando en Python: curso completo"
# del 20 al 24 de junio de 2016 en la Facultad de Ciencias - UGR
# http://www.darwineventur.com/2016/05/programando-en-python-curso-completo.html
#
#
# Rubén Martín Moren... |
liamgh/liamgreenhughes-sl4a-tf101 | refs/heads/master | python-modules/pybluez/python/bluetooth/bluez.py | 67 | import sys
import struct
import binascii
from btcommon import *
import _bluetooth as _bt
import array
import fcntl
_constants = [ 'HCI', 'RFCOMM', 'L2CAP', 'SCO', 'SOL_L2CAP', 'SOL_RFCOMM',\
'L2CAP_OPTIONS' ]
for _c in _constants: exec "%s = _bt.%s" % (_c, _c)
del _constants
# ============== SDP service registrat... |
40223202/2015cdb_g2 | refs/heads/master | 2015scrum-3a6fed94d45237e506e5e1539e27a2c9e89e6740/static/Brython3.1.1-20150328-091302/Lib/unittest/test/testmock/testmagicmethods.py | 737 | import unittest
import inspect
import sys
from unittest.mock import Mock, MagicMock, _magics
class TestMockingMagicMethods(unittest.TestCase):
def test_deleting_magic_methods(self):
mock = Mock()
self.assertFalse(hasattr(mock, '__getitem__'))
mock.__getitem__ = Mock()
self.asser... |
Nitrate/nitrate-v2 | refs/heads/master | nitrate/nitrate/plans/views.py | 1 | # -*- coding: utf-8 -*-
from flask import Blueprint, request
from nitrate import db
from nitrate.plans.models import PlanType
mod = Blueprint('plan', __name__, url_prefix='/plans')
@mod.route('/', methods=['GET'])
def get_plans():
return 'get plans'
|
thetoine/eruditorg | refs/heads/master | erudit/apps/userspace/reporting/apps.py | 1 | # -*- coding: utf-8 -*-
from django.apps import AppConfig
class ReportingConfig(AppConfig):
label = 'userspace_reporting'
name = 'apps.userspace.reporting'
|
mwv/scikit-learn | refs/heads/master | sklearn/semi_supervised/tests/test_label_propagation.py | 307 | """ test the label propagation module """
import nose
import numpy as np
from sklearn.semi_supervised import label_propagation
from numpy.testing import assert_array_almost_equal
from numpy.testing import assert_array_equal
ESTIMATORS = [
(label_propagation.LabelPropagation, {'kernel': 'rbf'}),
(label_propa... |
orviz/ooi | refs/heads/master | ooi/api/storage.py | 3 | # -*- coding: utf-8 -*-
# Copyright 2015 Spanish National Research Council
#
# 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... |
davidsminor/gaffer | refs/heads/master | python/GafferSceneUI/PrimitiveVariablesUI.py | 1 | ##########################################################################
#
# Copyright (c) 2014, John Haddon. 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 so... |
thachhoang/boxmover | refs/heads/master | boxmover/utils.py | 1 | import sys
import json
def tumblr_iterate(total, next_batch, limit=None, offset=None):
# The index of the last processed item. We can skip the first (offset) items.
processed_index = 0
if offset is not None:
processed_index = offset
# The max index of the item we can look at. This is no large... |
silly-wacky-3-town-toon/SOURCE-COD | refs/heads/master | otp/speedchat/SCEmoteTerminal.py | 6 | from direct.gui.DirectGui import *
from SCTerminal import SCTerminal
from otp.otpbase.OTPLocalizer import EmoteList, EmoteWhispers
from otp.avatar import Emote
SCEmoteMsgEvent = 'SCEmoteMsg'
SCEmoteNoAccessEvent = 'SCEmoteNoAccess'
def decodeSCEmoteWhisperMsg(emoteId, avName):
if emoteId >= len(EmoteWhispers):
... |
rmartinho/boo | refs/heads/master | lib/antlr-2.7.5/examples/python/inherit.tinyc/inherit.py | 21 |
import sys
import antlr
import tinyc_l
import inherit_p
def main():
L = tinyc_l.Lexer()
P = inherit_p.Parser(L)
P.setFilename(L.getFilename())
### Parse the input expression
try:
P.program()
except antlr.ANTLRException, ex:
print "*** error(s) while parsing."
pri... |
cungen/itface | refs/heads/master | server/utils/json_util.py | 1 | """
# Author: Cungen
# Created Time: 2015-27-25 09:27:38
# File Name: json_util.py
# Description: utilities class for json
"""
# coding=utf-8
import json
from bson import ObjectId
class JSONEncoder(json.JSONEncoder):
def default(self, o):
if isinstance(o, ObjectId):
return str(o)
re... |
bschug/python-git-webhook | refs/heads/master | webhook-test.py | 1 | from __future__ import print_function
import os
import functools
import json
import webhook
def eval_test(test_name, expected, payload):
actual = json.dumps(payload, indent=4, sort_keys=True)
if expected != actual:
print(test_name + " Test failed: ")
print("Expected:")
print(expected)... |
acsone/account-financial-tools | refs/heads/8.0 | account_move_line_payable_receivable_filter/__openerp__.py | 13 | # -*- coding: utf-8 -*-
##############################################################################
#
# This file is part of account_move_line_payable_receivable_filter, an
# Odoo module.
#
# Copyright (c) 2015 ACSONE SA/NV (<http://acsone.eu>)
#
# account_move_line_payable_receivable_filter is free ... |
scieloorg/Logger | refs/heads/master | tests/test_readcube.py | 2 | import unittest
from logger import readcube
class ReadCubeBulkTests(unittest.TestCase):
def test_instantiating_invalid_len(self):
sample_line = []
with self.assertRaises(ValueError):
am = readcube.AccessMap(sample_line)
def test_access_map_acesses_invalid_date(self):
sa... |
GdZ/scriptfile | refs/heads/master | software/googleAppEngine/lib/django_1_2/tests/regressiontests/forms/localflavor/ar.py | 87 | from django.contrib.localflavor.ar.forms import (ARProvinceSelect,
ARPostalCodeField, ARDNIField, ARCUITField)
from utils import LocalFlavorTestCase
class ARLocalFlavorTests(LocalFlavorTestCase):
def test_ARProvinceSelect(self):
f = ARProvinceSelect()
out = u'''<select name="provincias">
<opt... |
ovnicraft/edx-platform | refs/heads/master | common/lib/xmodule/xmodule/imageannotation_module.py | 19 | """
Module for Image annotations using annotator.
"""
from lxml import etree
from pkg_resources import resource_string
from xmodule.x_module import XModule
from xmodule.raw_module import RawDescriptor
from xblock.core import Scope, String
from xmodule.annotator_mixin import get_instructions, html_to_text
from xmodule.... |
coreos/autotest | refs/heads/master | database_legacy/migrations/036_add_special_tasks.py | 19 | UP_SQL = """
CREATE TABLE special_tasks (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
host_id INT NOT NULL REFERENCES hosts(id),
task VARCHAR(64) NOT NULL,
time_requested DATETIME NOT NULL,
is_active TINYINT(1) NOT NULL DEFAULT FALSE,
is_complete TINYINT(1) NOT NULL DEFAULT FALSE,
INDEX special_tasks_host... |
mancoast/CPythonPyc_test | refs/heads/master | fail/333_test_grp.py | 85 | """Test script for the grp module."""
import unittest
from test import support
grp = support.import_module('grp')
class GroupDatabaseTestCase(unittest.TestCase):
def check_value(self, value):
# check that a grp tuple has the entries and
# attributes promised by the docs
self.assertEqual(... |
bh107/bohrium | refs/heads/master | test/python/tests/test_reduce.py | 3 | import util
class test_views:
""" Test reduction of all kind of views"""
def init(self):
for cmd, shape in util.gen_random_arrays("R", 4, dtype="np.float32"):
cmd = "R = bh.random.RandomState(42); a = %s; " % cmd
for i in range(len(shape)):
yield (cmd, i)
... |
ewandor/home-assistant | refs/heads/dev | homeassistant/components/notify/lametric.py | 4 | """
Notifier for LaMetric time.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/notify.lametric/
"""
import logging
import voluptuous as vol
from homeassistant.components.notify import (
ATTR_TARGET, ATTR_DATA, PLATFORM_SCHEMA, BaseNotificationServi... |
iabdalkader/micropython | refs/heads/master | tests/basics/frozenset1.py | 41 | # basic sets
try:
frozenset
except NameError:
print("SKIP")
raise SystemExit
s = frozenset()
print(s)
s = frozenset({1})
print(s)
s = frozenset({3, 4, 3, 1})
print(sorted(s))
# frozensets are hashable unlike sets
print({frozenset("1"): 2})
|
rassor/mongo-connector | refs/heads/master | mongo_connector/doc_managers/doc_manager_simulator.py | 6 | # Copyright 2013-2014 MongoDB, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... |
watonyweng/neutron | refs/heads/master | neutron/db/migration/alembic_migrations/core_init_ops.py | 32 | # Copyright 2014 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... |
aperigault/ansible | refs/heads/devel | lib/ansible/modules/web_infrastructure/jenkins_job_info.py | 25 | #!/usr/bin/python
#
# Copyright: (c) Ansible Project
#
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.1',
'status': ['preview'],
... |
ntt-sic/keystone | refs/heads/master | keystone/token/routers.py | 8 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unle... |
rehandalal/buchner | refs/heads/master | buchner/project-template/PROJECTMODULE/database/classes.py | 1 | from sqlalchemy.ext.declarative import declarative_base
Model = declarative_base(name='Model')
|
iansf/sky_engine | refs/heads/master | tools/android/findbugs_plugin/test/run_findbugs_plugin_tests.py | 63 | #!/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.
# This is used to test the findbugs plugin, it calls
# build/android/pylib/utils/findbugs.py to analyze the classes in
# org.chro... |
grueni75/GeoDiscoverer | refs/heads/master | Source/Platform/Target/Android/core/src/main/jni/gdal-3.2.1/swig/python/samples/gdal_vrtmerge.py | 1 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2000, Atlantis Scientific Inc. (www.atlsci.com)
# Copyright (C) 2005 Gabriel Ebner <ge@gabrielebner.at>
# Copyright (c) 2009, Even Rouault <even dot rouault at spatialys.com>
#
# This library is free software; you can redistribute it and/or
# modify it und... |
adit-chandra/tensorflow | refs/heads/master | tensorflow/python/ops/nn_batchnorm_test.py | 9 | # 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... |
jblackburne/scikit-learn | refs/heads/master | sklearn/linear_model/tests/test_randomized_l1.py | 57 | # Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# License: BSD 3 clause
import numpy as np
from scipy import sparse
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_raises
from sklearn.linear_model.randomized_l1 i... |
amidabuddha/saga-ics-crc-3.0.16 | refs/heads/linux | tools/perf/scripts/python/netdev-times.py | 11271 | # 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... |
openmv/micropython | refs/heads/master | tests/basics/del_name.py | 115 | # del name
x = 1
print(x)
del x
try:
print(x)
except NameError:
print("NameError")
try:
del x
except: # NameError:
# FIXME uPy returns KeyError for this
print("NameError")
class C:
def f():
pass
|
pombredanne/datrie | refs/heads/master | setup.py | 1 | #! /usr/bin/env python
"""Super-fast, efficiently stored Trie for Python."""
import os
import sys
from setuptools import setup, Extension
from setuptools.command.test import test as TestCommand
LIBDATRIE_DIR = 'libdatrie/datrie'
LIBDATRIE_FILE_NAMES = [
'alpha-map.c', 'darray.c', 'fileutils.c', 'tail.c', 'trie.c... |
nathanbjenx/cairis | refs/heads/master | cairis/gui/KaosModel.py | 2 | # 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... |
raphaelning/resteasy-client-android | refs/heads/master | jaxrs/examples/smime/postSigned.py | 3 | import httplib, urlparse
import re
from M2Crypto import BIO, Rand, SMIME, X509
data = """Content-Type: application/xml
<customer name="bill"/>
"""
# Make a MemoryBuffer of the message.
buf = BIO.MemoryBuffer(data)
# Seed the PRNG.
Rand.load_file('randpool.dat', -1)
# Instantiate an SMIME object.
s = SMIME.SMIME(... |
deepmind/dm_control | refs/heads/master | dm_control/entities/manipulators/__init__.py | 1 | # Copyright 2019 The dm_control Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... |
damdam-s/OCB | refs/heads/8.0 | addons/l10n_es/__init__.py | 307 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
#
# 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 Fre... |
coxmediagroup/googleads-python-lib | refs/heads/master | examples/dfp/v201408/audience_segment_service/update_audience_segments.py | 4 | #!/usr/bin/python
#
# Copyright 2014 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... |
Averroes/statsmodels | refs/heads/master | statsmodels/miscmodels/tests/test_tmodel.py | 28 | # -*- coding: utf-8 -*-
"""
Created on Sun Jun 30 20:25:22 2013
Author: Josef Perktold
"""
import numpy as np
from numpy.testing import assert_allclose
from statsmodels.tools.tools import add_constant
from statsmodels.miscmodels.tmodel import TLinearModel
class Holder(object):
def __init__(self, **kwds):
... |
verych/dymatrix | refs/heads/master | node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSUtil.py | 1812 | # Copyright (c) 2013 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Utility functions shared amongst the Windows generators."""
import copy
import os
# A dictionary mapping supported target types to extensions.
TARGET_TYPE_EX... |
Chilledheart/seahub | refs/heads/master | seahub/base/generic.py | 5 | from django.views.generic import TemplateView
class DirectTemplateView(TemplateView):
"""
Extend Django ``TemplateView`` to accept extra contexts.
"""
extra_context = None
def get_context_data(self, **kwargs):
context = super(self.__class__, self).get_context_data(**kwargs)
if self.... |
3dfxsoftware/cbss-addons | refs/heads/master | budget/__openerp__.py | 1 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Addons modules by CLEARCORP S.A.
# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
#
# This program is free software: you can redistribute... |
thepiper/standoff | refs/heads/master | vpy/lib/python2.7/site-packages/pip/_vendor/distlib/metadata.py | 427 | # -*- coding: utf-8 -*-
#
# Copyright (C) 2012 The Python Software Foundation.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
"""Implementation of the Metadata for Python packages PEPs.
Supports all metadata formats (1.0, 1.1, 1.2, and 2.0 experimental).
"""
from __future__ import unicode_literals
import codecs
from email... |
sonuyos/couchpotato | refs/heads/master | libs/caper/step.py | 81 | # Copyright 2013 Dean Gardiner <gardiner91@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
kvar/ansible | refs/heads/seas_master_2.9.5 | test/integration/targets/collections/collection_root_user/ansible_collections/testns/testcoll/plugins/callback/usercallback.py | 37 | from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.plugins.callback import CallbackBase
DOCUMENTATION = '''
callback: usercallback
callback_type: notification
short_description: does stuff
description:
- does some stuff
'''
class CallbackModule... |
kevinxucs/p2pool | refs/heads/master | p2pool/util/math.py | 44 | from __future__ import absolute_import, division
import __builtin__
import math
import random
import time
def median(x, use_float=True):
# there exist better algorithms...
y = sorted(x)
if not y:
raise ValueError('empty sequence!')
left = (len(y) - 1)//2
right = len(y)//2
sum = y[left]... |
fernandog/Medusa | refs/heads/optimized | ext/subliminal/providers/tvsubtitles.py | 11 | # -*- coding: utf-8 -*-
import io
import logging
import re
from zipfile import ZipFile
from babelfish import Language, language_converters
from guessit import guessit
from requests import Session
from . import ParserBeautifulSoup, Provider
from .. import __short_version__
from ..cache import EPISODE_EXPIRATION_TIME, ... |
Menooker/gem5_pcm | refs/heads/master | src/arch/x86/isa/insts/simd128/__init__.py | 91 | # Copyright (c) 2007 The Hewlett-Packard Development Company
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implemen... |
kmonsoor/python-for-android | refs/heads/master | python3-alpha/python3-src/Lib/test/test_descrtut.py | 56 | # This contains most of the executable examples from Guido's descr
# tutorial, once at
#
# http://www.python.org/2.2/descrintro.html
#
# A few examples left implicit in the writeup were fleshed out, a few were
# skipped due to lack of interest (e.g., faking super() by hand isn't
# of much interest anymore), and a f... |
mbodock/pygar-me | refs/heads/master | pygar_me/transaction.py | 1 | # encoding: utf-8
import json
import requests
from .exceptions import PygarmeTransactionApiError, PygarmeTransactionError, NotPaidException
class Transaction(object):
BASE_URL = 'https://api.pagar.me/1/'
def __init__(self, api_key=None, amount=None, card_hash=None,
payment_method='credit_card',... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.