repo_name stringlengths 5 100 | ref stringlengths 12 67 | path stringlengths 4 244 | copies stringlengths 1 8 | content stringlengths 0 1.05M ⌀ |
|---|---|---|---|---|
xtao/code | refs/heads/master | vilya/models/ngit/submodule.py | 3 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
class Submodule(object):
def __init__(self, url, path):
self._url = url
self._path = path
if url.find('code.dapps.douban.com/'):
self._host = 'code'
elif url.find('github.com/'):
self._host = '... |
mitodl/xanalytics | refs/heads/master | pytest/hookspec.py | 3 | """ hook specifications for pytest plugins, invoked from main.py and builtin plugins. """
# -------------------------------------------------------------------------
# Initialization
# -------------------------------------------------------------------------
def pytest_addhooks(pluginmanager):
"""called at plugi... |
quamilek/django | refs/heads/master | tests/migrations/test_migrations_conflict/0001_initial.py | 2995 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
operations = [
migrations.CreateModel(
"Author",
[
("id", models.AutoField(primary_key=True)),
("name",... |
ATIX-AG/ansible | refs/heads/devel | lib/ansible/modules/commands/psexec.py | 28 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2018, Jordan Borean <jborean93@gmail.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1... |
pam-bot/SMSQuery | refs/heads/master | lib/flask/testsuite/deprecations.py | 563 | # -*- coding: utf-8 -*-
"""
flask.testsuite.deprecations
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tests deprecation support.
:copyright: (c) 2011 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import flask
import unittest
from flask.testsuite import FlaskTestCase, catch_warnings
class ... |
pquentin/django | refs/heads/stable/1.8.x | tests/generic_views/test_forms.py | 453 | from __future__ import unicode_literals
from django import forms
from .models import Author
class AuthorForm(forms.ModelForm):
name = forms.CharField()
slug = forms.SlugField()
class Meta:
model = Author
fields = ['name', 'slug']
class ContactForm(forms.Form):
name = forms.CharFie... |
brosander/lc-tools | refs/heads/master | lcNeat.py | 1 | #!/usr/bin/python
import argparse
import csv
import json
import logging
import math
import MultiNEAT as NEAT
import os
import pickle
import random
import shutil
import sys
import time
def outputFilename(outputDir, prefix, timestamp, extension):
return '/'.join([outputDir, '.'.join([prefix, str(timestamp), extension... |
blitzmann/Pyfa | refs/heads/master | gui/builtinAdditionPanes/fighterView.py | 1 | # =============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of pyfa.
#
# pyfa 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 ... |
behzadnouri/scipy | refs/heads/master | runtests.py | 15 | #!/usr/bin/env python
"""
runtests.py [OPTIONS] [-- ARGS]
Run tests, building the project first.
Examples::
$ python runtests.py
$ python runtests.py -s {SAMPLE_SUBMODULE}
$ python runtests.py -t {SAMPLE_TEST}
$ python runtests.py --ipython
$ python runtests.py --python somescript.py
$ python... |
zachmullen/boto | refs/heads/develop | boto/iam/connection.py | 61 | # Copyright (c) 2010-2011 Mitch Garnaat http://garnaat.org/
# Copyright (c) 2010-2011, Eucalyptus Systems, Inc.
#
# 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, includin... |
apache/airflow | refs/heads/main | airflow/providers/google/cloud/sensors/dataproc.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 not... |
piffey/ansible | refs/heads/devel | test/units/modules/network/nxos/test_nxos_vxlan_vtep.py | 57 | # (c) 2016 Red Hat Inc.
#
# 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 dis... |
lightopa/Aiopa-Battles | refs/heads/master | lib/raven/transport/eventlet.py | 16 | """
raven.transport.eventlet
~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import sys
from raven.transport.http import HTTPTransport
try:
import eventlet
try:
... |
geggo/pyface | refs/heads/master | pyface/ui/qt4/code_editor/pygments_highlighter.py | 3 | #------------------------------------------------------------------------------
# Copyright (c) 2010, Enthought Inc
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD license.
#
# Author: Enthought Inc
# Description: <Enthought pyface code editor>
#------------------------... |
zhaodelong/django | refs/heads/master | tests/many_to_one/tests.py | 88 | import datetime
from copy import deepcopy
from django.core.exceptions import FieldError, MultipleObjectsReturned
from django.db import models, transaction
from django.test import TestCase
from django.utils import six
from django.utils.translation import ugettext_lazy
from .models import (
Article, Category, Child... |
ihsanudin/odoo | refs/heads/8.0 | addons/l10n_be_hr_payroll_account/__init__.py | 430 | # -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2011 OpenERP SA (<http://openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the G... |
jokajak/itweb | refs/heads/master | data/env/lib/python2.6/site-packages/simplejson-2.0.9-py2.6-linux-x86_64.egg/simplejson/tests/test_pass1.py | 259 | from unittest import TestCase
import simplejson as json
# from http://json.org/JSON_checker/test/pass1.json
JSON = r'''
[
"JSON Test Pattern pass1",
{"object with 1 member":["array with 1 element"]},
{},
[],
-42,
true,
false,
null,
{
"integer": 1234567890,
"real": -... |
ilastikdev/ilastik | refs/heads/master | ilastik/applets/base/__init__.py | 115 | ###############################################################################
# ilastik: interactive learning and segmentation toolkit
#
# Copyright (C) 2011-2014, the ilastik developers
# <team@ilastik.org>
#
# This program is free software; you can redistribute it and/or
# mod... |
gptech/ansible | refs/heads/devel | lib/ansible/modules/notification/flowdock.py | 35 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2013 Matt Coddington <coddington@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 ... |
savoirfairelinux/odoo | refs/heads/master | addons/board/controllers.py | 44 | # -*- coding: utf-8 -*-
from xml.etree import ElementTree
from openerp.addons.web.controllers.main import load_actions_from_ir_values
from openerp.addons.web.http import Controller, route, request
class Board(Controller):
@route('/board/add_to_dashboard', type='json', auth='user')
def add_to_dashboard(self, m... |
rleigh-dundee/openmicroscopy | refs/heads/develop | components/tools/OmeroPy/src/omero/plugins/download.py | 4 | #!/usr/bin/env python
"""
download plugin
Plugin read by omero.cli.Cli during initialization. The method(s)
defined here will be added to the Cli class for later use.
Copyright 2007 Glencoe Software, Inc. All rights reserved.
Use is subject to license terms supplied in LICENSE.txt
"""
import sys
from... |
SCPR/accountability-tracker | refs/heads/master | maplight_finance/migrations/0001_initial.py | 1 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Initiative',
fields=[
('id', mo... |
rev2004/android2cloud.app-engine | refs/heads/master | google_appengine/lib/django/django/db/models/query.py | 32 | from django.db import backend, connection, transaction
from django.db.models.fields import DateField, FieldDoesNotExist
from django.db.models.fields.generic import GenericRelation
from django.db.models import signals
from django.dispatch import dispatcher
from django.utils.datastructures import SortedDict
import operat... |
eepp/delicolour | refs/heads/master | delicolour/colour.py | 1 | import re
from colormath.color_objects import sRGBColor
from colormath.color_objects import HSVColor
from colormath.color_objects import HSLColor
from colormath.color_conversions import convert_color
class Colour:
def __init__(self, r=0, g=0, b=0):
self.set_rgb(r, g, b)
def __repr__(self):
r, ... |
dsajkl/123 | refs/heads/master | lms/djangoapps/shoppingcart/migrations/0003_auto__del_field_orderitem_line_cost.py | 182 | # -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting field 'OrderItem.line_cost'
db.delete_column('shoppingcart_orderitem', 'line_cost')
def back... |
adiyengar/Spirit | refs/heads/master | spirit/core/utils/ratelimit/ratelimit.py | 9 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import hashlib
from django.conf import settings
from django.core.cache import caches
TIME_DICT = {
's': 1,
'm': 60,
}
class RateLimit:
def __init__(self, request, uid, method=None, field=None, rate='5/5m'):
self.request = reques... |
wisfern/vnpy | refs/heads/master | beta/api/korbit/vnkorbit.py | 1 | # encoding: utf-8
import urllib
import hashlib
import json
import requests
import hmac
import time
from datetime import datetime
from time import time, sleep , mktime
from Queue import Queue, Empty
from threading import Thread
import urllib
import websocket
import inspect
import requests
import cerberus
korbit_ho... |
havard024/prego | refs/heads/master | venv/lib/python2.7/site-packages/south/tests/deps_c/migrations/0005_c.py | 348 | from south.db import db
from django.db import models
class Migration:
depends_on = [('deps_a', '0002_a')]
def forwards(self):
pass
def backwards(self):
pass
|
40223204/w16b_test | refs/heads/master | static/Brython3.1.3-20150514-095342/Lib/codecs.py | 739 | """ codecs -- Python Codec Registry, API and helpers.
Written by Marc-Andre Lemburg (mal@lemburg.com).
(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
"""#"
import builtins, sys
### Registry and builtin stateless codec functions
try:
from _codecs import *
except ImportError as why:
raise SystemErro... |
0jpq0/kbengine | refs/heads/master | kbe/src/lib/python/Tools/clinic/clinic_test.py | 41 | # Argument Clinic
# Copyright 2012-2013 by Larry Hastings.
# Licensed to the PSF under a contributor agreement.
#
import builtins
import clinic
from clinic import DSLParser
import collections
import inspect
from test import support
import sys
import unittest
from unittest import TestCase
class FakeConverter:
def... |
claudep/translate | refs/heads/master | translate/tools/test_phppo2pypo.py | 26 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# phppo2pypo unit tests
# Author: Wil Clouser <wclouser@mozilla.com>
# Date: 2009-12-03
from translate.convert import test_convert
from translate.misc import wStringIO
from translate.tools import phppo2pypo
class TestPhpPo2PyPo:
def test_single_po(self):
in... |
wangjun/odoo | refs/heads/8.0 | addons/account_asset/wizard/account_asset_change_duration.py | 258 | # -*- encoding: 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 t... |
eeshangarg/zulip | refs/heads/master | zerver/lib/user_status.py | 5 | from typing import Any, Dict, Optional
from django.db.models import Q
from django.utils.timezone import now as timezone_now
from zerver.models import UserStatus
def get_user_info_dict(realm_id: int) -> Dict[str, Dict[str, Any]]:
rows = (
UserStatus.objects.filter(
user_profile__realm_id=real... |
hitsthings/node-gyp | refs/heads/master | gyp/test/win/gyptest-cl-buffer-security-check.py | 344 | #!/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 sure buffer security check setting is extracted properly.
"""
import TestGyp
import sys
if sys.platform == 'win32':
test = Tes... |
maxamillion/anaconda | refs/heads/master | pyanaconda/ui/gui/helpers.py | 1 | # Abstract base classes for GUI classes
#
# Copyright (C) 2014 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is... |
KarimAllah/nova | refs/heads/master | nova/db/sqlalchemy/migrate_repo/versions/030_multi_nic.py | 2 | # Copyright 2011 OpenStack LLC.
# 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... |
aleonliao/depot_tools | refs/heads/master | recipes.py | 11 | #!/usr/bin/env python
# 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.
"""Bootstrap script to clone and forward to the recipe engine tool."""
import ast
import logging
import os
import random
import re
im... |
rsteca/python-social-auth | refs/heads/master | social/apps/flask_app/template_filters.py | 84 | from flask import g, request
from social.backends.utils import user_backends_data
from social.apps.flask_app.utils import get_helper
def backends():
"""Load Social Auth current user data to context under the key 'backends'.
Will return the output of social.backends.utils.user_backends_data."""
return {
... |
0x7678/youtube-dl | refs/heads/master | youtube_dl/extractor/ringtv.py | 22 | from __future__ import unicode_literals
import re
from .common import InfoExtractor
class RingTVIE(InfoExtractor):
_VALID_URL = r'(?:http://)?(?:www\.)?ringtv\.craveonline\.com/(?P<type>news|videos/video)/(?P<id>[^/?#]+)'
_TEST = {
"url": "http://ringtv.craveonline.com/news/310833-luis-collazo-says-... |
joram/sickbeard-orange | refs/heads/ThePirateBay | lib/requests/packages/urllib3/connectionpool.py | 17 | # urllib3/connectionpool.py
# Copyright 2008-2013 Andrey Petrov and contributors (see CONTRIBUTORS.txt)
#
# This module is part of urllib3 and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
import errno
import logging
from socket import error as SocketError, timeout as SocketT... |
rootulp/exercism | refs/heads/master | python/sublist/sublist.py | 1 | SUBLIST = 0
SUPERLIST = 1
EQUAL = 2
UNEQUAL = 3
def check_lists(l1, l2):
if l1 == l2:
return EQUAL
elif l1 in each_cons(l2, len(l1)):
return SUBLIST
elif l2 in each_cons(l1, len(l2)):
return SUPERLIST
else:
return UNEQUAL
# Not the most efficent
def each_cons(lst, siz... |
upsuper/servo | refs/heads/master | tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/script-not-found-not-executed-2.py | 154 | def main(request, response):
headers = [("Content-Type", "text/javascript")]
body = "test2_token = \"script executed\";"
return 200, headers, body
|
fake-name/ReadableWebProxy | refs/heads/master | WebMirror/management/rss_parser_funcs/feed_parse_extractBrassboltsBlogspotCom.py | 1 |
def extractBrassboltsBlogspotCom(item):
'''
Parser for 'brassbolts.blogspot.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', 'translated'),
('Loite... |
leoc/home-assistant | refs/heads/dev | homeassistant/components/vera.py | 6 | """
Support for Vera devices.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/vera/
"""
import logging
from collections import defaultdict
import voluptuous as vol
from requests.exceptions import RequestException
from homeassistant.util.dt import utc_... |
alexvanboxel/airflow | refs/heads/master | airflow/migrations/versions/64de9cddf6c9_add_task_fails_journal_table.py | 59 | #
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the ... |
lakshayg/tensorflow | refs/heads/master | tensorflow/contrib/learn/python/learn/estimators/linear.py | 14 | # 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... |
mssurajkaiga/rhythmbox | refs/heads/master | plugins/artsearch/musicbrainz.py | 2 | # -*- Mode: python; coding: utf-8; tab-width: 8; indent-tabs-mode: t; -*-
#
# Copyright (C) 2009 Jonathan Matthew <jonathan@d14n.org>
#
# 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 ve... |
PeterWangPo/phantomjs | refs/heads/master | src/qt/qtwebkit/Tools/Scripts/webkitpy/tool/steps/__init__.py | 122 | # Copyright (C) 2010 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 th... |
indashnet/InDashNet.Open.UN2000 | refs/heads/master | android/cts/tools/utils/cts/__init__.py | 6 | #!/usr/bin/python2.4
# Copyright (C) 2009 The Android Open Source Project
#
# 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 requir... |
lwiecek/django | refs/heads/master | tests/utils_tests/test_itercompat.py | 569 | from django.test import TestCase
from .models import Category, Thing
class TestIsIterator(TestCase):
def test_regression(self):
"""This failed on Django 1.5/Py2.6 because category has a next method."""
category = Category.objects.create(name='category')
Thing.objects.create(category=categ... |
CompassionCH/compassion-modules | refs/heads/10.0 | sponsorship_compassion/mappings/cancel_sponsorship_mapping.py | 4 | # -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2016 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: Michael Sandoz <michaelsandoz87@gmail.com>
#
# The licence is in the file __manif... |
shubhdev/edxOnBaadal | refs/heads/master | lms/djangoapps/certificates/badge_handler.py | 32 | """
BadgeHandler object-- used to award Badges to users who have completed courses.
"""
import hashlib
import logging
import mimetypes
from eventtracking import tracker
import requests
from django.template.defaultfilters import slugify
from django.utils.translation import ugettext as _
from django.conf import settings... |
sinisterchipmunk/tomato | refs/heads/master | ext/tomato/external/scons/engine/SCons/Tool/gnulink.py | 34 | """SCons.Tool.gnulink
Tool-specific initialization for the gnu linker.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons F... |
WCCCEDU/twitter-commons | refs/heads/master | src/python/twitter/common/zookeeper/named_value.py | 16 | from abc import ABCMeta, abstractproperty
from twitter.common.lang import Compatibility
class NamedValue(object):
__metaclass__ = ABCMeta
def __init__(self, value):
if isinstance(value, int):
self._value = value if value in self.map else 0
elif isinstance(value, Compatibility.string):
self._v... |
c-amr/camr | refs/heads/master | stanfordnlp/unidecode/x05d.py | 252 | data = (
'Lang ', # 0x00
'Kan ', # 0x01
'Lao ', # 0x02
'Lai ', # 0x03
'Xian ', # 0x04
'Que ', # 0x05
'Kong ', # 0x06
'Chong ', # 0x07
'Chong ', # 0x08
'Ta ', # 0x09
'Lin ', # 0x0a
'Hua ', # 0x0b
'Ju ', # 0x0c
'Lai ', # 0x0d
'Qi ', # 0x0e
'Min ', # 0x0f
'Kun ', # 0x10
'... |
p0lyb1us/polybius.fyi | refs/heads/master | reveal.js/node_modules/node-gyp/gyp/pylib/gyp/generator/dump_dependency_json.py | 1534 | # 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.
import collections
import os
import gyp
import gyp.common
import gyp.msvs_emulation
import json
import sys
generator_supports_multiple_toolsets = True
generator_... |
tanghong123/googletest | refs/heads/master | scripts/fuse_gtest_files.py | 2577 | #!/usr/bin/env python
#
# Copyright 2009, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list... |
3nids/QGIS | refs/heads/master | tests/src/python/test_qgsrasterfilewritertask.py | 42 | # -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsRasterFileWriterTask.
.. note:: This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later versio... |
kexplo/miasm | refs/heads/master | example/disasm/single_instr.py | 9 | from miasm2.arch.x86.arch import mn_x86
from miasm2.arch.x86.regs import EDX
l = mn_x86.fromstring('MOV EAX, EBX', 32)
print "instruction:", l
print "arg:", l.args[0]
x = mn_x86.asm(l)
print x
l.args[0] = EDX
y = mn_x86.asm(l)
print y
print mn_x86.dis(y[0], 32)
|
baixuexue123/note | refs/heads/master | patterns/single_dispatch.py | 1 | from functools import singledispatch
@singledispatch
def func(a, b):
return 'default'
@func.register(int)
def _(a, b):
print('int')
return a+b
@func.register(str)
def _(a, b):
print('str')
return a+b
@func.register(tuple)
@func.register(list)
def _(a, b):
print('list or tuple')
retur... |
rjeschmi/easybuild-framework | refs/heads/master | easybuild/framework/easyconfig/parser.py | 3 | # #
# Copyright 2013-2015 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://vscentrum.be/nl/en),
# the Hercules foundation (ht... |
40123148/w17b | refs/heads/master | static/Brython3.1.3-20150514-095342/Lib/heapq.py | 628 | """Heap queue algorithm (a.k.a. priority queue).
Heaps are arrays for which a[k] <= a[2*k+1] and a[k] <= a[2*k+2] for
all k, counting elements from 0. For the sake of comparison,
non-existing elements are considered to be infinite. The interesting
property of a heap is that a[0] is always its smallest element.
Usag... |
Yong-Lee/decode-Django | refs/heads/master | Django-1.5.1/django/views/generic/detail.py | 4 | from __future__ import unicode_literals
from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist
from django.db import models
from django.http import Http404
from django.utils.translation import ugettext as _
from django.views.generic.base import TemplateResponseMixin, ContextMixin, View
显示 self.ob... |
EliotBerriot/django | refs/heads/master | tests/template_tests/test_callables.py | 347 | from __future__ import unicode_literals
from unittest import TestCase
from django.template import Context, Engine
class CallableVariablesTests(TestCase):
@classmethod
def setUpClass(cls):
cls.engine = Engine()
super(CallableVariablesTests, cls).setUpClass()
def test_callable(self):
... |
elkingtonmcb/django | refs/heads/master | tests/auth_tests/test_signals.py | 312 | import datetime
from django.contrib.auth import signals
from django.contrib.auth.models import User
from django.test import TestCase, override_settings
from django.test.client import RequestFactory
@override_settings(USE_TZ=False,
PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
ROOT_URLC... |
dmerejkowsky/qibuild | refs/heads/master | python/qibuild/test/test_project_config.py | 1 | ## Copyright (c) 2012-2015 Aldebaran Robotics. All rights reserved.
## Use of this source code is governed by a BSD-style license that can be
## found in the COPYING file.
""" Automatic testing for qibuild.project.ProjectConfig
"""
from qibuild.config import ProjectConfig
import unittest
from StringIO import StringI... |
iho/wagtail | refs/heads/master | wagtail/wagtailusers/tests.py | 7 | from __future__ import unicode_literals
import unittest
from django.test import TestCase
from django.core.urlresolvers import reverse
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Group, Permission
from django.utils import six
from wagtail.tests.utils import WagtailTestUtils
f... |
benschmaus/catapult | refs/heads/master | third_party/google-endpoints/pyasn1_modules/rfc3414.py | 127 | #
# SNMPv3 message syntax
#
# ASN.1 source from:
# http://www.ietf.org/rfc/rfc3414.txt
#
from pyasn1.type import univ, namedtype, namedval, tag, constraint
class UsmSecurityParameters(univ.Sequence):
componentType = namedtype.NamedTypes(
namedtype.NamedType('msgAuthoritativeEngineID', univ.OctetString()),
... |
UK992/servo | refs/heads/master | tests/wpt/web-platform-tests/clear-site-data/support/echo-clear-site-data.py | 46 | import json
RESPONSE = """
<!DOCTYPE html>
<html>
<head>
<title>Clear-Site-Data</title>
<script src="test_utils.sub.js"></script>
</head>
<body>
<script>
/**
* A map between a datatype name and whether it is empty.
* @property Object.<string, boolean>
*/
var report = ... |
brianlsharp/MissionPlanner | refs/heads/master | Lib/encodings/quopri_codec.py | 87 | """Codec for quoted-printable encoding.
Like base64 and rot13, this returns Python strings, not Unicode.
"""
import codecs, quopri
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
def quopri_encode(input, errors='strict'):
"""Encode the input, returning a ... |
Komodo/dbexplorer_pgsql | refs/heads/master | platform/Linux_x86_64-gcc3/pylib/psycopg2/__init__.py | 10 | """A Python driver for PostgreSQL
psycopg is a PostgreSQL_ database adapter for the Python_ programming
language. This is version 2, a complete rewrite of the original code to
provide new-style classes for connection and cursor objects and other sweet
candies. Like the original, psycopg 2 was written with the aim of b... |
daenamkim/ansible | refs/heads/devel | lib/ansible/modules/network/avi/avi_poolgroupdeploymentpolicy.py | 3 | #!/usr/bin/python
#
# Created on Aug 25, 2016
# @author: Gaurav Rastogi (grastogi@avinetworks.com)
# Eric Anderson (eanderson@avinetworks.com)
# module_check: supported
#
#
# 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... |
bwhicks/PlinyProject | refs/heads/master | backend/letters/migrations/0003_add_citations.py | 1 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.9 on 2018-03-16 20:46
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('common', '0002_add_citation'),
('letters', '0002_set_ordering_letter'),
]
o... |
cherokee/webserver | refs/heads/master | qa/142-SCGI-ExtraVars.py | 8 | import os
from base import *
from util import *
DIR = "/SCGI4/"
PORT = get_free_port()
PYTHON = look_for_python()
HDR1 = "X-Whatever"
VAL1 = "Value1"
HDR2 = "Something"
VAL2 = "Second"
SCRIPT = """
from pyscgi import *
class TestHandler (SCGIHandler):
def handle_request (self):
self.handle_post()
... |
boooka/GeoPowerOff | refs/heads/master | venv/lib/python2.7/site-packages/django/db/models/fields/__init__.py | 15 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import collections
import copy
import datetime
import decimal
import math
import warnings
from base64 import b64decode, b64encode
from itertools import tee
from django.apps import apps
from django.db import connection
from django.db.models.lookups import... |
pism/pism | refs/heads/master | examples/bedmap2/readgeom.py | 1 | #!/usr/bin/env python3
# readgeom reads bed elevation and ice thickness from BEDMAP2 files
# and either shows as figures or writes into NetCDF file
# edit these:
BM2PATH = '/home/ed/Desktop/bedmap2_bin/'
showgeom = False
import numpy as np
import numpy.ma as ma
import matplotlib.pyplot as plt
import sy... |
JetStarBlues/Nand-2-Tetris | refs/heads/master | Assembler/asm2bin_TECS_legacy.py | 1 | # ========================================================================================
#
# Description:
#
# Compiles Hack ASM (assembly) code to Hack BIN (binary) code
# Uses the vanilla TECS specification
#
# Attribution:
#
# Code by www.jk-quantized.com
#
# Redistribution and use of this code ... |
Carrotsmile/CS428 | refs/heads/master | steerstats/steersuitedb/SFConfig.py | 8 | import psycopg2
# from Sequence import ConfigSequence
class SFConfig(object):
_id_name = "sf_ai_config_id"
_table_name = "sf_ai_config"
_insert_order = """
(sf_ai_config_id,
hidac_acceleration,
hidac_personal_space_threshold,
hidac_agent_repulsion_importance,
hidac_query_radius,
hidac_body_force,
hidac_a... |
kennedyshead/home-assistant | refs/heads/dev | homeassistant/components/atag/water_heater.py | 5 | """ATAG water heater component."""
from homeassistant.components.water_heater import (
ATTR_TEMPERATURE,
STATE_ECO,
STATE_PERFORMANCE,
WaterHeaterEntity,
)
from homeassistant.const import STATE_OFF, TEMP_CELSIUS
from . import DOMAIN, WATER_HEATER, AtagEntity
SUPPORT_FLAGS_HEATER = 0
OPERATION_LIST = [... |
espadrine/opera | refs/heads/master | chromium/src/third_party/python_26/Lib/sched.py | 59 | """A generally useful event scheduler class.
Each instance of this class manages its own queue.
No multi-threading is implied; you are supposed to hack that
yourself, or use a single instance per application.
Each instance is parametrized with two functions, one that is
supposed to return the current time, one that i... |
vaas-krish/openthread | refs/heads/master | tools/harness-automation/cases/ed_6_3_1.py | 16 | #!/usr/bin/env python
#
# Copyright (c) 2016, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notic... |
ChihChengLiang/python-rtmbot | refs/heads/master | rtmbot/utils/module_loading.py | 6 | from importlib import import_module
def import_string(dotted_path):
"""
Source: django.utils.module_loading
Import a dotted module path and return the attribute/class designated by the
last name in the path. Raise ImportError if the import failed.
"""
try:
module_path, class_name = do... |
zhengjue/mytornado | refs/heads/master | mydjiango/echo_site/manage.py | 1 | #!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "echo_site.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that th... |
sjspence/epicPCR | refs/heads/master | filterBar.py | 1 | #!/usr/bin/env python
# filterBar.py
# 10/20/2014 Sarah J. Spencer, Alm Lab, MIT
# Filter Illumina sequence reads for matches to synthetic barcode primer
# structure. Export 16S sequences trimmed to common length.
from optparse import OptionParser
# Import data from fasta file and save in header and sequence variable... |
beiko-lab/gengis | refs/heads/master | bin/Lib/site-packages/numpy/oldnumeric/fft.py | 1 |
__all__ = ['fft', 'fft2d', 'fftnd', 'hermite_fft', 'inverse_fft',
'inverse_fft2d', 'inverse_fftnd',
'inverse_hermite_fft', 'inverse_real_fft',
'inverse_real_fft2d', 'inverse_real_fftnd',
'real_fft', 'real_fft2d', 'real_fftnd']
from numpy.fft import fft
from numpy.ff... |
eltonkevani/tempest_el_env | refs/heads/master | tempest/api/compute/admin/test_availability_zone.py | 3 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 NEC Corporation
# 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... |
40223220/cd0504 | refs/heads/master | static/Brython3.1.1-20150328-091302/Lib/_markupbase.py | 891 | """Shared support for scanning document type declarations in HTML and XHTML.
This module is used as a foundation for the html.parser module. It has no
documented public API and should not be used directly.
"""
import re
_declname_match = re.compile(r'[a-zA-Z][-_.a-zA-Z0-9]*\s*').match
_declstringlit_match = re.com... |
cpausmit/IntelROCCS | refs/heads/master | Api/src/crabApi.py | 3 | #!/usr/local/bin/python
#---------------------------------------------------------------------------------------------------
# Access CRAB3 data via HTCondor
#---------------------------------------------------------------------------------------------------
import os, htcondor, ConfigParser
from email.MIMEText import ... |
sriprasanna/django-1.3.1 | refs/heads/master | django/contrib/gis/db/backend/__init__.py | 307 | from django.db import connection
if hasattr(connection.ops, 'spatial_version'):
from warnings import warn
warn('The `django.contrib.gis.db.backend` module was refactored and '
'renamed to `django.contrib.gis.db.backends` in 1.2. '
'All functionality of `SpatialBackend` '
'has been m... |
blueboxgroup/nova | refs/heads/master | nova/compute/resources/vcpu.py | 58 | # Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
# 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/LICEN... |
DannySapz/is210-week-03-warmup | refs/heads/master | tests/test_task_13.py | 28 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests lesson 03 task 13."""
# Import Python libs
import unittest
# Import student file
import task_13
class L03T13TestCase(unittest.TestCase):
"""
Tests for lesson 03 task 13.
"""
def test_frac_dec_equal(self):
"""
Tests that the FRA... |
songyi199111/sentry | refs/heads/master | src/sentry/models/eventmapping.py | 23 | """
sentry.models.groupmeta
~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
from django.db import models
from django.utils import timezone
from sentry.db.models import FlexibleF... |
niosus/tapiriik | refs/heads/master | tapiriik/services/fit.py | 8 | from datetime import datetime, timedelta
from .interchange import WaypointType, ActivityStatisticUnit, ActivityType, LapIntensity, LapTriggerMethod
from .devices import DeviceIdentifier, DeviceIdentifierType
import struct
import sys
import pytz
class FITFileType:
Activity = 4 # The only one we care about now.
class ... |
ajaali/django | refs/heads/master | django/core/checks/compatibility/django_1_8_0.py | 286 | from __future__ import unicode_literals
from django.conf import global_settings, settings
from .. import Tags, Warning, register
@register(Tags.compatibility)
def check_duplicate_template_settings(app_configs, **kwargs):
if settings.TEMPLATES:
values = [
'TEMPLATE_DIRS',
'ALLOWED... |
willworth/thermos | refs/heads/master | thermos/Lib/site-packages/pip/_vendor/distlib/util.py | 327 | #
# Copyright (C) 2012-2016 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
try:
... |
MeirKriheli/Open-Knesset | refs/heads/master | committees/migrations/0014_add_committee_type.py | 14 | # -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Committee.type'
db.add_column('committees_committee', 'type',
self.gf(... |
bankonme/password-manager | refs/heads/master | backend/flask/src/clipperz.py | 9 | from clipperz import app, db
def main():
db.create_all()
app.run(debug=True)
if __name__ == "__main__":
main()
|
fxstein/cement | refs/heads/master | cement/core/exc.py | 6 | """Cement core exceptions module."""
class FrameworkError(Exception):
"""
General framework (non-application) related errors.
:param msg: The error message.
"""
def __init__(self, msg):
Exception.__init__(self)
self.msg = msg
def __str__(self):
return self.msg
cl... |
maciejkula/spotlight | refs/heads/master | tests/factorization/test_explicit.py | 1 | import os
import numpy as np
import pytest
from spotlight.cross_validation import random_train_test_split
from spotlight.datasets import movielens
from spotlight.evaluation import rmse_score
from spotlight.factorization.explicit import ExplicitFactorizationModel
from spotlight.factorization.representations import Bil... |
jorsea/odoomrp-wip | refs/heads/8.0 | mrp_operations_extension/models/mrp_routing.py | 4 | # -*- encoding: utf-8 -*-
##############################################################################
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.