repo_name stringlengths 5 100 | ref stringlengths 12 67 | path stringlengths 4 244 | copies stringlengths 1 8 | content stringlengths 0 1.05M ⌀ |
|---|---|---|---|---|
40223139/203739test | refs/heads/master | static/Brython3.1.1-20150328-091302/Lib/_imp.py | 625 | """(Extremely) low-level import machinery bits as used by importlib and imp."""
class __loader__(object):pass
def _fix_co_filename(*args,**kw):
raise NotImplementedError("%s:not implemented" % ('_imp.py:_fix_co_filename'))
def acquire_lock(*args,**kw):
"""acquire_lock() -> None Acquires the interpreter's... |
xando/django-rocket-engine | refs/heads/master | rocket_engine/mail.py | 50 | from email.MIMEBase import MIMEBase
from django.core.mail.backends.base import BaseEmailBackend
from django.core.mail import EmailMultiAlternatives
from django.core.exceptions import ImproperlyConfigured
from google.appengine.api import mail as aeemail
from google.appengine.runtime import apiproxy_errors
def _send_def... |
ansible/ansible | refs/heads/devel | test/units/module_utils/common/parameters/test_check_arguments.py | 15 | # -*- coding: utf-8 -*-
# Copyright (c) 2020 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
import pytest
from ansible.module_utils.common.parameters import _get_unsupp... |
rickerc/nova_audit | refs/heads/cis-havana-staging | nova/tests/api/openstack/compute/plugins/v3/test_instance_actions.py | 9 | # Copyright 2013 Rackspace Hosting
# 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... |
TalaatHarb/PredictOceanHealth | refs/heads/master | Prototype/save_load_RF_cPickle.py | 1 | # code piece to save and load random forest model
import cPickle
rf = RandomForestRegresor()
rf.fit(X, y)
with open('path/to/file', 'wb') as f:
cPickle.dump(rf, f)
# in your prediction file ... |
beni55/gunicorn | refs/heads/master | gunicorn/instrument/statsd.py | 35 | # -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
"Bare-bones implementation of statsD's protocol, client-side"
import socket
import logging
from re import sub
from gunicorn.glogging import Logger
# Instrumentation constants
STATSD_DEFAULT_... |
ryandougherty/mwa-capstone | refs/heads/heroku | MWA_Tools/build/matplotlib/doc/mpl_examples/event_handling/resample.py | 6 | import numpy as np
import matplotlib.pyplot as plt
from scikits.audiolab import wavread
# A class that will downsample the data and recompute when zoomed.
class DataDisplayDownsampler(object):
def __init__(self, xdata, ydata):
self.origYData = ydata
self.origXData = xdata
self.numpts = 3000... |
yen223/mclass-sky | refs/heads/master | mclearn/tests/datasets.py | 1 | from pandas import read_csv
class Dataset:
def __init__(self, name):
self.data_folder = 'mclearn/tests/data/'
if name == 'glass':
self.feature_cols = ['ri', 'na', 'mg', 'ai', 'si', 'k', 'ca' , 'ba', 'fe']
self.target_col = 'type'
elif name == 'sdss_tiny':
... |
tryoha/peterfrost | refs/heads/master | src/project/settings.py | 1 | """
Django settings for project project.
Generated by 'django-admin startproject' using Django 1.11.6.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import os... |
hareeshpc/networking-cisco | refs/heads/master | networking_cisco/tests/unit/ml2/drivers/cisco/nexus/test_type_nexus_vxlan.py | 2 | # Copyright (c) 2014 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... |
keyurpatel076/MissionPlannerGit | refs/heads/master | Lib/encodings/cp720.py | 417 | """Python Character Mapping Codec cp720 generated on Windows:
Vista 6.0.6002 SP2 Multiprocessor Free with the command:
python Tools/unicode/genwincodec.py 720
"""#"
import codecs
### Codec APIs
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,error... |
foss-transportationmodeling/rettina-server | refs/heads/master | flask/lib/python2.7/encodings/cp1251.py | 593 | """ Python Character Mapping Codec cp1251 generated from 'MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1251.TXT' with gencodec.py.
"""#"
import codecs
### Codec APIs
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,in... |
SAug3n/burpPlatform | refs/heads/master | compoment/ssh_burp.py | 1 | # -*- coding: UTF-8 -*-
import logging
import paramiko
import burp
class ssh_burp(burp.burp):
def burp_thread(self,password):
if self.stop_signal:
return None
try:
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
... |
xiejianying/pjsip | refs/heads/master | tests/pjsua/scripts-sipp/transfer-attended.py | 32 | # $Id$
#
import inc_const as const
PJSUA = ["--null-audio", # UA0
"--null-audio", # UA1
"--null-audio" # UA2
]
PJSUA_EXPECTS = [
# A calls B
[0, "", "m"],
[0, "", "$PJSUA_URI[1]"],
[0, const.STATE_CALLING, ""],
[1, const.EVENT_INCOMING_CALL, "a"],
[1, "", "200"],
[0, const.STATE_CO... |
cuongnv23/ansible | refs/heads/devel | lib/ansible/modules/cloud/amazon/iam.py | 15 | #!/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... |
leapcode/soledad | refs/heads/master | scripts/scalability/test_controller/server/blobs.py | 1 | #!/usr/bin/env python
import shutil
import os
from argparse import ArgumentParser
from twisted.logger import Logger
from test_controller.utils import mkdir_p, payload
logger = Logger()
def _create_blob(path, data):
with open(path, 'w') as f:
logger.info('Creating %s' % path)
f.write(data)
def ... |
pawelswoboda/opengm | refs/heads/partialOptimality | src/interfaces/python/opengm/opengmcore/factor_injector.py | 14 | from _opengmcore import adder,multiplier ,IndependentFactor
import numpy
def _extend_factor_classes():
_factorClasses=[adder.Factor,multiplier.Factor]
for factorClass in _factorClasses:
class _FactorInjector(object):
class __metaclass__(factorClass.__class__):
def __init__(self, name, b... |
gspeedtech/Audacity-2 | refs/heads/master | lib-src/lv2/lv2/waflib/Configure.py | 181 | #! /usr/bin/env python
# encoding: utf-8
# WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file
import os,shlex,sys,time
from waflib import ConfigSet,Utils,Options,Logs,Context,Build,Errors
try:
from urllib import request
except ImportError:
from urllib import urlopen
... |
PriceChild/ansible | refs/heads/devel | lib/ansible/utils/ssh_functions.py | 87 | # (c) 2016, James Tanner
# (c) 2016, Toshio Kuratomi <tkuratomi@ansible.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
# (... |
skulbrane/metagoofil | refs/heads/master | hachoir_core/field/timestamp.py | 29 | from hachoir_core.tools import (humanDatetime, humanDuration,
timestampUNIX, timestampMac32, timestampUUID60,
timestampWin64, durationWin64)
from hachoir_core.field import Bits, FieldSet
from datetime import datetime
class GenericTimestamp(Bits):
def __init__(self, parent, name, size, description=None):
... |
lashex/ped | refs/heads/master | plantextract/old_pedparser.py | 1 | # coding=utf-8
# Copyright 2013 Gridward LLC
#
# 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 ... |
sanjeevtripurari/hue | refs/heads/master | desktop/core/ext-py/tablib-0.10.0/tablib/packages/xlwt3/ExcelFormulaLexer.py | 46 | import sys
from .antlr import EOF, CommonToken as Tok, TokenStream, TokenStreamException
import struct
from . import ExcelFormulaParser
from re import compile as recompile, match, LOCALE, UNICODE, IGNORECASE, VERBOSE
int_const_pattern = r"\d+\b"
flt_const_pattern = r"""
(?:
(?: \d* \. \d+ ) # .1... |
iAmMrinal0/CouchPotatoServer | refs/heads/master | couchpotato/core/notifications/toasty.py | 62 | import traceback
from couchpotato.core.helpers.encoding import toUnicode, tryUrlencode
from couchpotato.core.logger import CPLog
from couchpotato.core.notifications.base import Notification
log = CPLog(__name__)
autoload = 'Toasty'
class Toasty(Notification):
urls = {
'api': 'http://api.supertoasty.c... |
eezee-it/runbot-addons | refs/heads/8.0 | runbot_skip_tests/__init__.py | 10 | # -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2010 - 2014 Savoir-faire Linux
# (<http://www.savoirfairelinux.com>).
#
# This program is free software: you can redistribute it a... |
enthought/etsproxy | refs/heads/master | enthought/developer/tools/traits_ui_db.py | 1 | # proxy module
from __future__ import absolute_import
from etsdevtools.developer.tools.traits_ui_db import *
|
dezelin/kvm | refs/heads/master | tools/perf/scripts/python/check-perf-trace.py | 11214 | # perf script event handlers, generated by perf script -g python
# (c) 2010, Tom Zanussi <tzanussi@gmail.com>
# Licensed under the terms of the GNU GPL License version 2
#
# This script tests basic functionality such as flag and symbol
# strings, common_xxx() calls back into perf, begin, end, unhandled
# events, etc. ... |
trankmichael/scipy | refs/heads/master | runtests.py | 29 | #!/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... |
errx/django | refs/heads/master | tests/m2o_recursive/models.py | 38 | """
11. Relating an object to itself, many-to-one
To define a many-to-one relationship between a model and itself, use
``ForeignKey('self')``.
In this example, a ``Category`` is related to itself. That is, each
``Category`` has a parent ``Category``.
Set ``related_name`` to designate what the reverse relationship is... |
v-legoff/pa-poc3 | refs/heads/master | src/model/types/datetime_pa.py | 1 | # Copyright (c) 2013 LE GOFF Vincent
# 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... |
GuessWhoSamFoo/pandas | refs/heads/master | pandas/tests/scalar/interval/test_interval.py | 2 | from __future__ import division
import numpy as np
import pytest
from pandas import Interval, Timedelta, Timestamp
import pandas.core.common as com
@pytest.fixture
def interval():
return Interval(0, 1)
class TestInterval(object):
def test_properties(self, interval):
assert interval.closed == 'rig... |
epsylon3/torrentflux | refs/heads/master | html/bin/clients/tornado/BitTornado/BT1/FileSelector.py | 17 | # Written by John Hoffman
# see LICENSE.txt for license information
from random import shuffle
from traceback import print_exc
try:
True
except:
True = 1
False = 0
class FileSelector:
def __init__(self, files, piece_length, bufferdir,
storage, storagewrapper, sched, failfunc):
... |
wooga/airflow | refs/heads/master | tests/providers/ssh/__init__.py | 5130 | #
# 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... |
fanquake/bitcoin | refs/heads/master | test/functional/p2p_eviction.py | 6 | #!/usr/bin/env python3
# Copyright (c) 2019-2020 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
""" Test node eviction logic
When the number of peers has reached the limit of maximum connections,
the ... |
mikhail-gorobets/chipsec | refs/heads/master | chipsec/modules/tools/vmm/msr_fuzz.py | 8 | #CHIPSEC: Platform Security Assessment Framework
#Copyright (c) 2010-2015, Intel Corporation
#
#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; Version 2.
#
#This program is distributed in the hope... |
RI-imaging/bornscat | refs/heads/master | setup.py | 2 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from os.path import dirname, realpath
from setuptools import setup, Command
import subprocess
import sys
author = u"Paul Müller"
authors = [author]
name = 'bornscat'
description = 'scattering code with Born/Rytov approximation'
year = "2015"
long_description = """
python... |
edenferreira/grafos_cmou | refs/heads/master | main.py | 1 | import os
for i in range(100):
os.system('python formatar_dados.py')
|
EDUlib/edx-platform | refs/heads/master | import_shims/lms/course_api/blocks/serializers.py | 2 | """Deprecated import support. Auto-generated by import_shims/generate_shims.sh."""
# pylint: disable=redefined-builtin,wrong-import-position,wildcard-import,useless-suppression,line-too-long
from import_shims.warn import warn_deprecated_import
warn_deprecated_import('course_api.blocks.serializers', 'lms.djangoapps.co... |
thetnswe/zawgyi | refs/heads/master | chatbot/PyAIML/aiml/__init__.py | 26 | __all__ = []
# The Kernel class is the only class most implementations should need.
from Kernel import Kernel
|
Samael500/pelican-plugins | refs/heads/master | liquid_tags/spotify.py | 313 | """
Spotify Tag
---------
This implements a Liquid-style spotify tag for Pelican,
based on the jekyll / octopress youtube tag [1]_
Syntax
------
{% spotify id %}
Example
-------
{% spotify 1HNZcRFlIKwHAJD3LxvX4d %}
Output
------
<iframe
src='https://embed.spotify.com/?uri=spotify:track:1HNZcRFlIKwHAJD3LxvX4d'
... |
logicus4078/vertx-web | refs/heads/master | src/test/sockjs-protocol/sockjs-protocol-0.1.py | 11 | #!/usr/bin/env python
"""
[**SockJS-protocol**](https://github.com/sockjs/sockjs-protocol) is an
effort to define a protocol between in-browser
[SockJS-client](https://github.com/sockjs/sockjs-client) and its
server-side counterparts, like
[SockJS-node](https://github.com/sockjs/sockjs-client). This should
help others ... |
locarise/locarise-drf-oauth2-support | refs/heads/develop | locarise_drf_oauth2_support/oauth2_client/backends.py | 1 | # -*- coding: utf-8 -*-
"""
Locarise OAuth2 backend, docs at:
https://accounts.locarise.com
"""
from social_core.backends.oauth import BaseOAuth2
class LocariseOAuth2(BaseOAuth2):
"""
Locarise OAuth authentication backend
"""
name = 'locarise-oauth2'
ACCESS_TOKEN_METHOD = 'POST'
SCOPE_SE... |
ianawilson/kafka-python | refs/heads/master | kafka/consumer/base.py | 15 | from __future__ import absolute_import
import atexit
import logging
import numbers
from threading import Lock
import kafka.common
from kafka.common import (
OffsetRequest, OffsetCommitRequest, OffsetFetchRequest,
UnknownTopicOrPartitionError, check_error, KafkaError
)
from kafka.util import kafka_bytestring,... |
delinhabit/django | refs/heads/master | tests/field_defaults/tests.py | 405 | from datetime import datetime
from django.test import TestCase
from django.utils import six
from .models import Article
class DefaultTests(TestCase):
def test_field_defaults(self):
a = Article()
now = datetime.now()
a.save()
self.assertIsInstance(a.id, six.integer_types)
... |
MQQiang/kbengine | refs/heads/master | kbe/res/scripts/common/Lib/idlelib/idle_test/test_rstrip.py | 143 | import unittest
import idlelib.RstripExtension as rs
from idlelib.idle_test.mock_idle import Editor
class rstripTest(unittest.TestCase):
def test_rstrip_line(self):
editor = Editor()
text = editor.text
do_rstrip = rs.RstripExtension(editor).do_rstrip
do_rstrip()
self.asser... |
DreamerKing/LightweightHtmlWidgets | refs/heads/master | LightweightHtmlWidgets/bin/Release/Ipy.Lib/UserList.py | 327 | """A more or less complete user-defined wrapper around list objects."""
import collections
class UserList(collections.MutableSequence):
def __init__(self, initlist=None):
self.data = []
if initlist is not None:
# XXX should this accept an arbitrary sequence?
if type(initlis... |
wangzhe0417/shadowsocks | refs/heads/master | shadowsocks/server.py | 11 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2014 clowwindy
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# ... |
fstd/wireshark | refs/heads/twdis | tools/dftestlib/__init__.py | 40 | #
# Copyright (C) 2013 by Gilbert Ramirez <gram@alumni.rice.edu>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
... |
goord/ece2cmor3 | refs/heads/master | test/taskloader_test.py | 1 | import os
import json
import logging
import unittest
from nose.tools import eq_, ok_
from ece2cmor3 import taskloader, ece2cmorlib, cmor_source, cmor_task, cmor_target
logging.basicConfig(level=logging.DEBUG)
drqpath = os.path.join(os.path.dirname(os.path.abspath(__file__)), "test_data", "testdrq.json")
class tas... |
DomDomPow/snapventure | refs/heads/master | snapventure-backend/snapventure/migrations/0013_auto_20161110_1307.py | 1 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-11-10 13:07
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('snapventure', '0012_auto_20161110_1024'),
]
operations = [
migrations.Alter... |
Mattwhooo/Hotdog | refs/heads/master | hotdog/Mustard.py | 2 | import datetime
import requests
import os
import base64
import sys
from hotdog.FilePath import get_full_path
from hotdog.Config import GetConfig
import time
MustardURL = GetConfig('MUSTARD_URL')
MustardKey = GetConfig('MUSTARD_KEY')
PROJECTFOLDER = GetConfig('ProjectFolder')
def takeScreenshot(driver, imageName):
... |
agry/NGECore2 | refs/heads/master | scripts/object/tangible/lair/base/poi_all_lair_bones_large_fog_gray.py | 85615 | import sys
def setup(core, object):
return |
digitalbitbox/electrum | refs/heads/master | plugins/keepkey/client.py | 13 | from keepkeylib.client import proto, BaseClient, ProtocolMixin
from .clientbase import KeepKeyClientBase
class KeepKeyClient(KeepKeyClientBase, ProtocolMixin, BaseClient):
def __init__(self, transport, handler, plugin):
BaseClient.__init__(self, transport)
ProtocolMixin.__init__(self, transport)
... |
sunqb/oa_qian | refs/heads/master | flask/Lib/site-packages/sqlalchemy/testing/suite/test_sequence.py | 114 | from .. import fixtures, config
from ..config import requirements
from ..assertions import eq_
from ... import testing
from ... import Integer, String, Sequence, schema
from ..schema import Table, Column
class SequenceTest(fixtures.TablesTest):
__requires__ = ('sequences',)
__backend__ = True
run_creat... |
DemocracyClub/Website | refs/heads/master | democracy_club/settings/base.py | 1 | import sys
from os.path import join, abspath, dirname
# PATH vars
here = lambda *x: join(abspath(dirname(__file__)), *x)
PROJECT_ROOT = here("..")
root = lambda *x: join(abspath(PROJECT_ROOT), *x)
sys.path.insert(0, root("apps"))
DEBUG = True
THUMBNAIL_DEBUG = DEBUG
ADMINS = ()
MANAGERS = ADMINS
DATABASES = {
... |
CoolCloud/python-oauth2 | refs/heads/master | oauth2/error.py | 6 | """
Errors raised during the OAuth 2.0 flow.
"""
class AccessTokenNotFound(Exception):
"""
Error indicating that an access token could not be read from the
storage backend by an instance of :class:`oauth2.store.AccessTokenStore`.
"""
pass
class AuthCodeNotFound(Exception):
"""
Error indi... |
eric-stanley/NewsBlur | refs/heads/master | apps/reader/migrations/0008_oldest_unread_story_date.py | 18 | # encoding: 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 'UserSubscription.oldest_unread_story_date'
db.add_column('reader_usersubscription', 'oldes... |
fayf/pyload | refs/heads/stable | module/plugins/crypter/DdlstorageComFolder.py | 15 | # -*- coding: utf-8 -*-
from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo
class DdlstorageComFolder(DeadCrypter):
__name__ = "DdlstorageComFolder"
__type__ = "crypter"
__version__ = "0.04"
__status__ = "testing"
__pattern__ = r'https?://(?:www\.)?ddlstorage\.com/... |
chanceraine/nupic | refs/heads/master | examples/prediction/experiments/confidenceTest/3/description.py | 50 | # ----------------------------------------------------------------------
# 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 apply:
#
# This progra... |
intel-iot-devkit/mraa | refs/heads/master | tests/mock/gpio_checks_basic.py | 2 | #!/usr/bin/env python
# Author: Alex Tereschenko <alext.mkrs@gmail.com>
# Copyright (c) 2016 Alex Tereschenko <alext.mkrs@gmail.com>
#
# SPDX-License-Identifier: MIT
import mraa as m
import unittest as u
MRAA_TEST_PIN = 0
class GpioChecksBasic(u.TestCase):
def setUp(self):
self.pin = m.Gpio(MRAA_TEST_PIN)
... |
kevintaw/django | refs/heads/master | tests/admin_scripts/management/commands/custom_startproject.py | 378 | from django.core.management.commands.startproject import Command as BaseCommand
class Command(BaseCommand):
def add_arguments(self, parser):
super(Command, self).add_arguments(parser)
parser.add_argument('--extra',
help='An arbitrary extra value passed to the context')
|
barbuza/django | refs/heads/master | tests/db_functions/models.py | 245 | """
Tests for built in Function expressions.
"""
from __future__ import unicode_literals
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class Author(models.Model):
name = models.CharField(max_length=50)
alias = models.CharField(max_leng... |
suncycheng/intellij-community | refs/heads/master | python/lib/Lib/site-packages/django/contrib/contenttypes/models.py | 307 | from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import smart_unicode
class ContentTypeManager(models.Manager):
# Cache to avoid re-looking up ContentType objects all over the place.
# This cache is shared by all the get_for_* methods.
_cache ... |
YanjieGao/sparrow | refs/heads/master | deploy/third_party/boto-2.1.1/boto/services/__init__.py | 782 | # Copyright (c) 2006,2007 Mitch Garnaat http://garnaat.org/
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modi... |
ge0rgi/cinder | refs/heads/stable/ocata | cinder/tests/unit/test_image_utils.py | 1 |
# Copyright (c) 2013 eNovance , 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 requ... |
endarthur/ply2atti-scanline | refs/heads/master | ply2atti.py | 1 | #!/usr/bin/python
# -*- coding: utf-8 -*-
from math import sin, radians, degrees, atan2, copysign, sqrt
from colorsys import hsv_to_rgb
from itertools import izip, combinations
from tempfile import TemporaryFile as temp
import numpy as np
from networkx import Graph, connected_components
from IPython import em... |
michelesr/gasistafelice | refs/heads/master | gasistafelice/gdxp/views/__init__.py | 3 | from django.http import HttpResponse
from django.shortcuts import get_object_or_404
from lib.shortcuts import render_to_response, render_to_xml_response
from gf.supplier.models import Supplier
from django.core.exceptions import FieldError
from django.core.servers.basehttp import FileWrapper
import urllib
def supp... |
junwucs/h2o-3 | refs/heads/master | h2o-py/tests/testdir_demos/pyunit_gbm_demo.py | 6 | import sys
sys.path.insert(1, "../../")
import h2o, tests
def demo_gbm():
h2o.demo(func="gbm", interactive=False, test=True)
if __name__ == "__main__":
tests.run_test(sys.argv, demo_gbm)
|
charanpald/APGL | refs/heads/master | apgl/version.py | 9 | __version__ = "0.8.1"
|
mschmidt87/nest-simulator | refs/heads/master | pynest/examples/brunel_siegert_nest.py | 10 | # -*- coding: utf-8 -*-
#
# brunel_siegert_nest.py
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST 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 Lic... |
CiscoSystems/nova | refs/heads/master | nova/tests/monkey_patch_example/example_a.py | 50 | # Copyright 2011 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... |
lovewinds/story-project | refs/heads/develop | external/scripts/packages/gtest/windows.py | 1 | #!/usr/bin/env python3
import os
from shutil import copytree, copy2, move
from pathlib import Path
from scripts.build_env import BuildEnv, Platform
from scripts.platform_builder import PlatformBuilder
class gtestWindowsBuilder(PlatformBuilder):
def __init__(self,
config_package: dict=None,
... |
caneGuy/spark | refs/heads/master | examples/src/main/python/ml/min_hash_lsh_example.py | 52 | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... |
UXE/edx-configuration | refs/heads/master | util/import_xml_courses.py | 68 | # Import XML Courses from git repos into the CMS.
# Run with sudo and make sure the user can clone
# the course repos.
# Output Has per course
#{
# repo_url:
# repo_name:
# org:
# course:
# run:
# disposition:
# version:
#}
import argparse
from os.path import basename
import yaml
if __name__ == ... |
weebygames/boto | refs/heads/develop | boto/dynamodb2/__init__.py | 145 | # Copyright (c) 2011 Mitch Garnaat http://garnaat.org/
# Copyright (c) 2011 Amazon.com, Inc. or its affiliates. All Rights Reserved
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without ... |
repotvsupertuga/tvsupertuga.repository | refs/heads/master | script.module.streamlink.base/resources/lib/streamlink/plugins/mediaklikk.py | 1 | import logging
import re
from streamlink.exceptions import PluginError
from streamlink.plugin import Plugin
from streamlink.stream import HLSStream
from streamlink.utils.url import update_scheme
log = logging.getLogger(__name__)
class Mediaklikk(Plugin):
PLAYER_URL = "https://player.mediaklikk.hu/playernew/play... |
tmerrick1/spack | refs/heads/develop | var/spack/repos/builtin/packages/py-pytest-httpbin/package.py | 5 | ##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... |
fanjunwei/depot_tools | refs/heads/master | third_party/boto/s3/user.py | 104 | # Copyright (c) 2006,2007 Mitch Garnaat http://garnaat.org/
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modi... |
pdebuyl/lammps | refs/heads/master | examples/SPIN/test_problems/validation_langevin_precession/plot_precession.py | 9 | #!/usr/bin/env python3
#Program fitting the exchange interaction
#Model curve: Bethe-Slater function
import numpy as np, pylab, tkinter
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
from decimal import *
import sys, string, os
argv = sys.argv
if len(argv) != 3:
print("Syntax: ./plot_precessi... |
martyngigg/pyqt-msvc | refs/heads/master | examples/designer/plugins/python/datetimeeditplugin.py | 20 | #============================================================================#
# Designer plugins for PyDateEdit and PyDateTimeEdit #
#----------------------------------------------------------------------------#
# Copyright (c) 2008 by Denviso GmbH, <ulrich.berning@denviso.de> #
# ... |
emgirardin/compassion-modules | refs/heads/master | __unported__/child_update_picture_date/__init__.py | 10 | # -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2014 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: David Coninckx <david@coninckx.com>
#
# The licence is in the file __ope... |
betoesquivel/fil2014 | refs/heads/master | build/django/build/lib.linux-x86_64-2.7/django/views/generic/list.py | 110 | from __future__ import unicode_literals
from django.core.paginator import Paginator, InvalidPage
from django.core.exceptions import ImproperlyConfigured
from django.http import Http404
from django.utils.translation import ugettext as _
from django.views.generic.base import TemplateResponseMixin, ContextMixin, View
c... |
uberamd/NGECore2 | refs/heads/master | scripts/object/tangible/ship/components/armor/arm_corellian_heavy_durasteel.py | 85615 | import sys
def setup(core, object):
return |
manolama/dd-agent | refs/heads/master | tests/checks/mock/test_ganglia.py | 23 | # stdlib
from cStringIO import StringIO
import logging
import subprocess
import time
import unittest
# 3p
import xml.etree.ElementTree as tree
# project
from checks.ganglia import Ganglia
from tests.checks.common import Fixtures
class TestGanglia(unittest.TestCase):
def testSpeed(self):
# Pretend to be ... |
brome-hq/brome | refs/heads/release | brome/admin/app.py | 2 | import os
import importlib
import base64
import logging
# from logging.handlers import TimedRotatingFileHandler
import sys
import asyncio
# from IPython import embed
from flask_admin.form import Select2Widget
from cryptography import fernet
from bson.objectid import ObjectId
from pymongo import MongoClient
from flask_... |
steventimberman/masterDebater | refs/heads/master | venv/lib/python2.7/site-packages/whoosh/codec/__init__.py | 96 | # Copyright 2012 Matt Chaput. 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 notice,
# this list of conditions and the... |
rhelmer/socorro-lib | refs/heads/master | socorro/external/postgresql/crash.py | 2 | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import logging
from socorro.external import MissingArgumentError
from socorro.external.postgresql.base import PostgreSQ... |
andersonjonathan/Navitas | refs/heads/master | navitas/blog/migrations/0007_auto_20170331_0030.py | 1 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('blog', '0006_fixture_loading'),
]
operations = [
migrations.AlterModelOptions(
name='article',
optio... |
backseatviolist/supercollider | refs/heads/master | editors/sced/scedwin/py/ScLang.py | 37 | # -*- coding: utf-8 -*-
# sced (SuperCollider mode for gedit)
#
# Copyright 2012 Jakob Leben
# Copyright 2009 Artem Popov and other contributors (see AUTHORS)
#
# sced 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... |
yaolinz/rethinkdb | refs/heads/next | external/v8_3.30.33.16/testing/gtest/scripts/release_docs.py | 1167 | #!/usr/bin/env python
#
# Copyright 2013 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... |
mariecpereira/IA369Z | refs/heads/master | deliver/ia870/iaintershow.py | 2 | # -*- encoding: utf-8 -*-
# Module iaintershow
from numpy import *
from string import join
def iaintershow(Iab):
from iaseunion import iaseunion
from iaintersec import iaintersec
assert (type(Iab) is tuple) and (len(Iab) == 2),'not proper fortmat of hit-or-miss template'
A,Bc = Iab
S = iaseunion... |
ubc/edx-platform | refs/heads/release | common/lib/xmodule/xmodule/tests/test_vertical.py | 118 | """
Tests for vertical module.
"""
from fs.memoryfs import MemoryFS
from xmodule.tests import get_test_system
from xmodule.tests.xml import XModuleXmlImportTest
from xmodule.tests.xml import factories as xml
from xmodule.x_module import STUDENT_VIEW, AUTHOR_VIEW
class BaseVerticalBlockTest(XModuleXmlImportTest):
... |
chrishas35/django-travis-ci | refs/heads/master | tests/regressiontests/localflavor/in_/tests.py | 33 | from django.contrib.localflavor.in_.forms import (INZipCodeField,
INStateField, INStateSelect, INPhoneNumberField)
from django.test import SimpleTestCase
class INLocalFlavorTests(SimpleTestCase):
def test_INPhoneNumberField(self):
error_format = [u'Phone numbers must be in 02X-8X or 03X-7X or 04X-6X... |
flyingfish007/tempest | refs/heads/master | tempest/tests/services/compute/test_services_client.py | 1 | # Copyright 2015 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/licenses/LICENSE-2.0
#
# Unless required ... |
placiano/NBKernel_NK4 | refs/heads/master | tools/perf/scripts/python/syscall-counts-by-pid.py | 11180 | # system call counts, by pid
# (c) 2010, Tom Zanussi <tzanussi@gmail.com>
# Licensed under the terms of the GNU GPL License version 2
#
# Displays system-wide system call totals, broken down by syscall.
# If a [comm] arg is specified, only syscalls called by [comm] are displayed.
import os, sys
sys.path.append(os.env... |
funkring/fdoo | refs/heads/8.0-fdoo | addons/im_chat/__init__.py | 349 | import im_chat
|
reinout/django | refs/heads/master | django/conf/locale/ko/formats.py | 65 | # This file is distributed under the same license as the Django package.
#
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'Y년 n월 j일'
TIME_FORMAT = 'A g:i'
DATETIME_FORMAT = 'Y년 n월 j일 g:i A'
YEAR_MONTH_FORMAT = 'Y년 n월'
MONTH... |
damianam/easybuild-framework | refs/heads/master | easybuild/toolchains/mpi/openmpi.py | 3 | ##
# Copyright 2012-2017 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://www.vscentrum.be),
# Flemish Research Foundation (F... |
tdautc19841202/micropython | refs/heads/master | tests/basics/builtin_hash.py | 24 | # test builtin hash function
print(hash(False))
print(hash(True))
print({():1}) # hash tuple
print({1 << 66:1}) # hash big int
print(hash in {hash:1}) # hash function
try:
hash([])
except TypeError:
print("TypeError")
class A:
def __hash__(self):
return 123
def __repr__(self):
return ... |
sodafree/backend | refs/heads/master | tests/modeltests/transactions/models.py | 34 | """
15. Transactions
Django handles transactions in three different ways. The default is to commit
each transaction upon a write, but you can decorate a function to get
commit-on-success behavior. Alternatively, you can manage the transaction
manually.
"""
from django.db import models
class Reporter(models.Model):
... |
new-xiaji/peewee | refs/heads/master | playhouse/tests/test_gfk.py | 16 | from peewee import *
from playhouse.gfk import *
from playhouse.tests.base import database_initializer
from playhouse.tests.base import ModelTestCase
db = database_initializer.get_in_memory_database()
class BaseModel(Model):
class Meta:
database = db
def add_tag(self, tag):
t = Tag(tag=tag)
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.