repo_name stringlengths 5 100 | ref stringlengths 12 67 | path stringlengths 4 244 | copies stringlengths 1 8 | content stringlengths 0 1.05M ⌀ |
|---|---|---|---|---|
rekab/biketl | refs/heads/master | biketl_test.py | 1 | #!/usr/bin/python
import biketl
import random
import datetime
import unittest
TEST_FIT_FILE = 'testdata/2013-06-08-07-59-08.fit'
class TestPointList(unittest.TestCase):
def setUp(self):
self.pointlist = biketl.PointList(TEST_FIT_FILE)
def test_GetPointsNearestTime(self):
# Check random locations
fo... |
huntxu/fuel-web | refs/heads/master | nailgun/nailgun/test/unit/test_release_validator.py | 3 | # Copyright 2014 Mirantis, 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 ... |
suky/android_kernel_pantech_ef65l | refs/heads/a820l_3.4 | scripts/tracing/draw_functrace.py | 14679 | #!/usr/bin/python
"""
Copyright 2008 (c) Frederic Weisbecker <[email protected]>
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 ... |
xtiankisutsa/MARA_Framework | refs/heads/master | tools/enjarify/enjarify/main.py | 14 | # Copyright 2015 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 by applicable law or a... |
necaris/embedded-js-in-python-example | refs/heads/master | guestbook/__init__.py | 1 | import os
from pyramid.config import Configurator
from sqlalchemy import engine_from_config
from .models import DBSession, Base
_current_dir = os.path.abspath(os.path.dirname(__file__))
def main(global_config, **settings):
"""
Return a new application instance, appropriately configured.
"""
engine ... |
devtronics/Gitme | refs/heads/master | tip_calc.py | 1 | def tax(bill):
"""Adds 8% tax to a restaurant bill."""
bill *= 1.08
print "With tax: %f" %bill
return bill
def tip(bill):
"""Adds 15% tip to a restaurant bill."""
bill *= 1.15
print "With tip: %f" %bill
return bill
meal_cost = 100
meal_with_tax = tax(meal_cost)
meal_with_tip = tip(meal_with_tax)
|
Perferom/android_external_chromium_org | refs/heads/android-4.4 | chrome/common/extensions/docs/server2/appengine_blobstore.py | 120 | # 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.
import blob_reference_store as datastore
from blob_reference_store import BlobReferenceStore
from appengine_wrappers import blobstore
from appengine_wrap... |
mrucci/moto | refs/heads/master | moto/s3bucket_path/__init__.py | 7 | from __future__ import unicode_literals
from moto import mock_s3
mock_s3bucket_path = mock_s3
|
Azure/azure-sdk-for-python | refs/heads/sync-eng/common-js-nightly-docs-2-1768-ForTestPipeline | sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/operations/_subscription_client_operations.py | 1 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
mohittahiliani/adaptive-RED-ns3 | refs/heads/master | src/network/bindings/modulegen__gcc_LP64.py | 14 | from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
import pybindgen.settings
import warnings
class ErrorHandler(pybindgen.settings.ErrorHandler):
def handle_error(self, wrapper, exception, traceback_):
warnings.warn("exception %r in wrapper %s" % (exception, wrapper))
... |
davinwang/caffe2 | refs/heads/master | caffe2/python/operator_test/concat_split_op_test.py | 4 | # Copyright (c) 2016-present, Facebook, 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... |
sgraham/nope | refs/heads/master | tools/swarming_client/third_party/colorama/winterm.py | 523 | # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
from . import win32
# from wincon.h
class WinColor(object):
BLACK = 0
BLUE = 1
GREEN = 2
CYAN = 3
RED = 4
MAGENTA = 5
YELLOW = 6
GREY = 7
# from wincon.h
class WinStyle(object):
NORMAL = 0... |
ProjectSWGCore/NGECore2 | refs/heads/master | scripts/loot/lootItems/armor/composite/composite_armor_leggings.py | 2 |
def itemTemplate():
return ['object/tangible/wearables/armor/composite/shared_armor_composite_leggings.iff']
def customItemName():
return 'Composite Armor Leggings'
def customItemStackCount():
return 1
def customizationAttributes():
return []
def customizationValues():
return []
def itemStats():
st... |
mdrasmus/compbio | refs/heads/master | compbio/genecluster.py | 2 | """
genecluster.py
This module contains functions for creating gene clusters based on sequence
"""
# python libs
import os
import shutil
import time
from itertools import izip
# rasmus libs
from compbio import blast
from compbio.cluster import item2part
from compbio.cluster import unionPart
from compbio.set... |
gtrogers/roguelike_tdd_example | refs/heads/master | rl/tile.py | 1 | class Tile:
def __init__(self, blocked, blocked_sight=None):
self.blocked = blocked
if blocked_sight is None:
self.blocked_sight = blocked
else:
self.blocked_sight = blocked_sight
|
CallMeAldy/AK-Mako-Old | refs/heads/ak-5.0 | scripts/tracing/draw_functrace.py | 14679 | #!/usr/bin/python
"""
Copyright 2008 (c) Frederic Weisbecker <[email protected]>
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 ... |
acshan/odoo | refs/heads/8.0 | addons/stock_account/res_config.py | 315 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (C) 2004-2012 OpenERP S.A. (<http://openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms o... |
tedlaz/pyted | refs/heads/master | pymiles/miles_tst/tst_meta.py | 1 | # -*- coding: utf-8 -*-
from pymiles import u_db_meta as u_meta
if __name__ == '__main__':
import sys
reload(sys)
sys.setdefaultencoding("utf-8")
db = 'tst1.sql3'
tmeta = u_meta.Metadb(db)
print(tmeta.trpr('lmo'))
print(tmeta.db)
print(tmeta.zf_exists)
print(tmeta.pars('programmer'... |
axbaretto/beam | refs/heads/master | sdks/python/.tox/py27gcp/lib/python2.7/site-packages/apitools/base/protorpclite/util.py | 6 | #!/usr/bin/env python
#
# Copyright 2010 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 o... |
jank3/django | refs/heads/master | django/contrib/gis/measure.py | 344 | # Copyright (c) 2007, Robert Coup <[email protected]>
# 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,
#... |
georgemarshall/django | refs/heads/master | tests/aggregation/models.py | 104 | from django.db import models
class Author(models.Model):
name = models.CharField(max_length=100)
age = models.IntegerField()
friends = models.ManyToManyField('self', blank=True)
def __str__(self):
return self.name
class Publisher(models.Model):
name = models.CharField(max_length=255)
... |
JunkieStyle/corgi | refs/heads/master | corgi/experiment.py | 1 | import time
import xgboost as xgb
import lightgbm as lgb
import catboost as cat
import pandas as pd
import numpy as np
from hyperopt import fmin, tpe, Trials, STATUS_OK, STATUS_FAIL, hp
import os
from os.path import join
from os import listdir
from sklearn.model_selection import StratifiedKFold, TimeSeriesSplit, KFold... |
iw3hxn/LibrERP | refs/heads/master | account_due_list/__openerp__.py | 1 | # -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2014-2021 Didotech srl (<http://www.didotech.com>)
# Copyright (C) 2011 Agile Business Group sagl (<http://www.agilebg.com>)
# Copyright (C) 2011 Domsense srl (<http://www.domsense.com>)
#
#... |
gvigneron/pysucker | refs/heads/master | setup.py | 1 | from __future__ import print_function
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
import codecs
import os
import sys
import re
here = os.path.abspath(os.path.dirname(__file__))
def read(*parts):
# intentionally *not* adding an encoding option to open
r... |
dexterx17/nodoSocket | refs/heads/master | clients/Python-2.7.6/Lib/lib2to3/tests/data/py2_test_grammar.py | 285 | # Python test set -- part 1, grammar.
# This just tests whether the parser accepts them all.
# NOTE: When you run this test as a script from the command line, you
# get warnings about certain hex/oct constants. Since those are
# issued by the parser, you can't suppress them by adding a
# filterwarnings() call to this... |
kerr-huang/SL4A | refs/heads/master | python/src/Lib/lib-tk/turtle.py | 47 | #
# turtle.py: a Tkinter based turtle graphics module for Python
# Version 1.0b1 - 31. 5. 2008
#
# Copyright (C) 2006 - 2008 Gregor Lingl
# email: [email protected]
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liable for any damages
# arising from ... |
ebigelow/LOTlib | refs/heads/master | LOTlib/Testing/old/Examples/SimpleGenerativeHypothesis/demoTest.py | 2 | """
class to test demo.py
follows the standards in https://docs.python.org/2/library/unittest.html
"""
import unittest
from LOTlib.Examples.SimpleGenerativeHypothesis.Demo import *
class demoTest(unittest.TestCase):
# initialization that happens before each test is carried out
def setUp(self):
pass
... |
pombreda/swarming | refs/heads/master | appengine/components/components/third_party/protobuf/google/protobuf/message.py | 227 | # Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# http://code.google.com/p/protobuf/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions o... |
thombashi/pytablewriter | refs/heads/master | pytablewriter/writer/text/sourcecode/_javascript.py | 1 | import io
from typing import List
from dataproperty import ColumnDataProperty, DataProperty, DefaultValue
from typepy import StrictLevel, Typecode
from ...._converter import strip_quote
from ...._function import quote_datetime_formatter
from ....sanitizer import sanitize_js_var_name
from .._common import bool_to_str
... |
tseaver/google-cloud-python | refs/heads/master | iot/google/cloud/iot_v1/types.py | 2 | # -*- coding: utf-8 -*-
#
# Copyright 2019 Google 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... |
mancoast/CPythonPyc_test | refs/heads/master | cpython/251_test_decimal.py | 3 | # Copyright (c) 2004 Python Software Foundation.
# All rights reserved.
# Written by Eric Price <eprice at tjhsst.edu>
# and Facundo Batista <facundo at taniquetil.com.ar>
# and Raymond Hettinger <python at rcn.com>
# and Aahz (aahz at pobox.com)
# and Tim Peters
"""
These are the test cases for the Decim... |
dieface/erpnext | refs/heads/develop | erpnext/accounts/doctype/pos_profile/test_pos_profile.py | 62 | # -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest
# test_records = frappe.get_test_records('POS Profile')
class TestPOSProfile(unittest.TestCase):
pass
|
rohit21122012/DCASE2013 | refs/heads/master | runs/2013/dnn_layerwise/bs1024/dnn_1layer/src/evaluation.py | 38 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import numpy
import math
from sklearn import metrics
class DCASE2016_SceneClassification_Metrics():
"""DCASE 2016 scene classification metrics
Examples
--------
>>> dcase2016_scene_metric = DCASE2016_SceneClassification_Metrics(class_list=... |
Abc-Arbitrage/fixpp | refs/heads/master | googletest-release-1.8.0/googletest/test/gtest_xml_outfiles_test.py | 2526 | #!/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... |
jsha/letsencrypt | refs/heads/master | certbot-dns-dnsimple/setup.py | 1 | import sys
from setuptools import setup
from setuptools import find_packages
version = '0.20.0.dev0'
# Please update tox.ini when modifying dependency version requirements
install_requires = [
'acme=={0}'.format(version),
'certbot=={0}'.format(version),
'dns-lexicon',
'mock',
# For pkg_resources... |
kayarre/dicomwrangle | refs/heads/master | plotMesh.py | 1 | import numpy as np
import mayavi.mlab as mlab
def test_triangular_mesh():
"""An example of a cone, ie a non-regular mesh defined by its
triangles.
"""
n = 15
t = np.linspace(-np.pi, np.pi, n)
z = np.exp(1j * t)
x = z.real.copy()
y = z.imag.copy()
z = np.zeros_like(x)
triangles = [(0, i, i + ... |
lnielsen/invenio | refs/heads/pu | invenio/legacy/websearch_external_collections/__init__.py | 3 | # -*- coding: utf-8 -*-
## This file is part of Invenio.
## Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 CERN.
##
## Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of the... |
ummahusla/codecademy-exercise-answers | refs/heads/master | Language Skills/Python/Unit 03 Conditionals and Control Flow/02 PygLatin/PygLatin PART2/8-Word up.py | 2 | pyg = 'ay'
original = raw_input('Enter a word:')
if len(original) > 0 and original.isalpha():
word = original.lower()
first = word[0]
print original
else:
print 'empty'
|
gxx/lettuce | refs/heads/master | tests/integration/lib/Django-1.3/tests/regressiontests/inspectdb/tests.py | 52 | from StringIO import StringIO
from django.core.management import call_command
from django.test import TestCase, skipUnlessDBFeature
class InspectDBTestCase(TestCase):
@skipUnlessDBFeature('can_introspect_foreign_keys')
def test_attribute_name_not_python_keyword(self):
out = StringIO()
call_c... |
Don42/youtube-dl | refs/heads/master | youtube_dl/extractor/quickvid.py | 113 | from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import (
compat_urlparse,
)
from ..utils import (
determine_ext,
int_or_none,
)
class QuickVidIE(InfoExtractor):
_VALID_URL = r'https?://(www\.)?quickvid\.org/watch\.php\?v=(?P<id>[a-zA-Z_0-9-]+)'
_... |
whatsfordinnercoin/whatsfordinnercoin | refs/heads/master | contrib/spendfrom/spendfrom.py | 792 | #!/usr/bin/env python
#
# Use the raw transactions API to spend bitcoins received on particular addresses,
# and send any change back to that same address.
#
# Example usage:
# spendfrom.py # Lists available funds
# spendfrom.py --from=ADDRESS --to=ADDRESS --amount=11.00
#
# Assumes it will talk to a bitcoind or Bit... |
niclabs/ratadns-filters | refs/heads/master | tests/test_packetsummary.py | 1 | import unittest
from packetsexample import PacketsExample
import StringIO
from prers import PacketSummary
__author__ = 'franchoco'
class TestPacketSummary(unittest.TestCase):
def setUp(self):
self.__stringBuffer1 = StringIO.StringIO()
self.__p1 = PacketSummary(self.__stringBuffer1)
def test_... |
xforce/jc3-handling-editor | refs/heads/master | tools/gyp/test/same-source-file-name/gyptest-pass-shared.py | 51 | #!/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.
"""
Checks that gyp does not fail on shared_library targets which have several files
with the same basename.
"""
import TestGyp
test = Tes... |
youdar/work | refs/heads/master | work/MTRIX/process_results_mtrix.py | 1 | from __future__ import division
#import numpy as np
#import matplotlib.mlab as mlab
#import matplotlib.pyplot as plt
import cPickle as pickle
import pylab as plb
import os, sys
def run(directory_path):
# Read files in directory_path
files = os.listdir(directory_path)
# collect only the files that starts w... |
jbedorf/tensorflow | refs/heads/master | tensorflow/python/autograph/utils/type_check.py | 22 | # 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... |
fbradyirl/home-assistant | refs/heads/dev | homeassistant/components/esphome/__init__.py | 1 | """Support for esphome devices."""
import asyncio
import logging
import math
from typing import Any, Callable, Dict, List, Optional
from aioesphomeapi import (
APIClient,
APIConnectionError,
DeviceInfo,
EntityInfo,
EntityState,
HomeassistantServiceCall,
UserService,
UserServiceArgType,
... |
GodBlessPP/w16b_test | refs/heads/master | static/Brython3.1.3-20150514-095342/Lib/_weakrefset.py | 766 | # Access WeakSet through the weakref module.
# This code is separated-out because it is needed
# by abc.py to load everything else at startup.
from _weakref import ref
__all__ = ['WeakSet']
class _IterationGuard:
# This context manager registers itself in the current iterators of the
# weak container, such ... |
rossepstein2013/groupme-liker | refs/heads/master | lib/werkzeug/contrib/wrappers.py | 181 | # -*- coding: utf-8 -*-
"""
werkzeug.contrib.wrappers
~~~~~~~~~~~~~~~~~~~~~~~~~
Extra wrappers or mixins contributed by the community. These wrappers can
be mixed in into request objects to add extra functionality.
Example::
from werkzeug.wrappers import Request as RequestBase
fr... |
nickcdryan/rep | refs/heads/master | rep/metaml/__init__.py | 4 | from __future__ import division, print_function, absolute_import
from .factory import ClassifiersFactory, RegressorsFactory
from .folding import FoldingClassifier
from .gridsearch import GridOptimalSearchCV
from .stacking import FeatureSplitter
from .gridsearch import AbstractParameterGenerator, RandomParameterOptimi... |
sbadia/ifmap-python-client | refs/heads/master | ifmap/request.py | 2 | #!/usr/bin/python
#
# Copyright 2011, Infoblox, All Rights Reserved
#
# Open Source, see LICENSE
#
from util import attr
class RequestBase:
""" foundation class for request factory """
pass
class NewSessionRequest(RequestBase):
def __init__(self, max_poll_result=None):
self.__max_poll_result = max_poll_result
... |
jwalgran/otm-core | refs/heads/develop | opentreemap/treemap/tests/test_management.py | 3 | # -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from StringIO import StringIO
from django.core.management import call_command
from treemap.models import Instance, Plot, Tree, Species
from treemap.tests import (make_instance, make_u... |
CCharlieLi/StaffManagmentSystem | refs/heads/master | rest_framework/throttling.py | 6 | """
Provides various throttling policies.
"""
from __future__ import unicode_literals
from django.core.cache import cache as default_cache
from django.core.exceptions import ImproperlyConfigured
from rest_framework.settings import api_settings
import time
class BaseThrottle(object):
"""
Rate throttling of req... |
d3trax/asuswrt-merlin | refs/heads/master | release/src/router/samba36/source4/scripting/python/samba/getopt.py | 20 | #!/usr/bin/env python
# Samba-specific bits for optparse
# Copyright (C) Jelmer Vernooij <[email protected]> 2007
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the Licens... |
angea/corkami | refs/heads/master | wip/MakePE/examples/imports/kernel31.py | 1 | # this program generates a DLL to bring backward compatibility to executables compiled under SP3
# those executables will expect new functions from kernel32.
# this dll creates dummies for these functions leaving the other untouched.
# this lower the security provided by these new functions, but make it possible t... |
nwchandler/ansible | refs/heads/devel | test/integration/targets/module_utils/module_utils/a/b/c/d/e/f/g/h/__init__.py | 298 | data = 'abcdefgh'
|
vamsirajendra/iTerm2 | refs/heads/master | tools/ply/ply-3.4/test/lex_state4.py | 174 | # lex_state4.py
#
# Bad state declaration
import sys
if ".." not in sys.path: sys.path.insert(0,"..")
import ply.lex as lex
tokens = [
"PLUS",
"MINUS",
"NUMBER",
]
states = (('comment', 'exclsive'),)
t_PLUS = r'\+'
t_MINUS = r'-'
t_NUMBER = r'\d+'
# Comments
def t_comment(t):
r'/\*'
t.le... |
SlimRoms/android_external_chromium_org | refs/heads/lp5.0 | build/android/gyp/util/__init__.py | 998 | # 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.
|
sjas/hyde | refs/heads/master | hydeengine/siteinfo.py | 35 | from datetime import date, datetime, time
import operator
import re
from threading import Thread, Event
import time as sleeper
from hydeengine import url
from hydeengine.file_system import File, Folder
class SiteResource(object):
def __init__(self, a_file, node):
super(SiteResource, self).__init__()
... |
kenshay/ImageScripter | refs/heads/master | ProgramData/SystemFiles/Python/Lib/site-packages/skimage/measure/tests/test_block.py | 3 | import numpy as np
from skimage.measure import block_reduce
from skimage._shared import testing
from skimage._shared.testing import assert_equal
def test_block_reduce_sum():
image1 = np.arange(4 * 6).reshape(4, 6)
out1 = block_reduce(image1, (2, 3))
expected1 = np.array([[ 24, 42],
... |
toke/django-tastypie | refs/heads/master | tastypie/utils/__init__.py | 73 | from tastypie.utils.dict import dict_strip_unicode_keys
from tastypie.utils.formatting import mk_datetime, format_datetime, format_date, format_time
from tastypie.utils.urls import trailing_slash
from tastypie.utils.validate_jsonp import is_valid_jsonp_callback_value
from tastypie.utils.timezone import now, make_aware,... |
eyohansa/django | refs/heads/master | tests/model_validation/tests.py | 292 | from django.core import management
from django.core.checks import Error, run_checks
from django.db.models.signals import post_init
from django.test import SimpleTestCase
from django.test.utils import override_settings
from django.utils import six
class OnPostInit(object):
def __call__(self, **kwargs):
pas... |
bckwltn/SickRage | refs/heads/master | lib/rtorrent/lib/xmlrpc/http.py | 180 | # Copyright (c) 2013 Chris Lucas, <[email protected]>
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, ... |
Rolinh/tweetmining | refs/heads/master | src/features/features_helper.py | 1 | # coding: utf-8
import words_processing as wp
import datetime
def tf_freq_max(tweet, word_frequencies):
"""Return the maximum frequency of the word that has the max frequency in
the `tweet`"""
freq_max = 0
tokens = wp.filter_tweet_words(tweet)
for word in tokens:
v = word_frequencies[word]
... |
m4734/mysql_pio | refs/heads/5.7 | boost_1_59_0/tools/build/test/message.py | 44 | #!/usr/bin/python
# Copyright (C) Vladimir Prus 2003.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
# Test for the regression testing framework.
import BoostBuild
# Create a temporary working direct... |
tannoa2/RackHD | refs/heads/master | test/tests/rackhd11/test_rackhd11_api_misc.py | 1 | '''
Copyright 2016, EMC, Inc.
Author(s):
George Paulos
'''
import fit_path # NOQA: unused import
import os
import sys
import subprocess
import fit_common
# Select test group here using @attr
from nose.plugins.attrib import attr
@attr(all=True)
class rackhd11_api_misc(fit_common.unittest.TestCase):
def test_api... |
ghosthamlet/bigcouch | refs/heads/master | couchjs/scons/scons-local-2.0.1/SCons/Tool/MSCommon/common.py | 61 | #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation
#
# 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 li... |
emonty/ansible-modules-extras | refs/heads/devel | packaging/os/opkg.py | 35 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2013, Patrick Pelletier <[email protected]>
# Based on pacman (Afterburn) and pkgin (Shaun Zinck) modules
#
# This module 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 Softwa... |
dbinetti/barberscore | refs/heads/master | project/apps/bhs/filters.py | 3 | # Django
from django.contrib import admin
from .models import Group
# class ConventionStatusListFilter(admin.SimpleListFilter):
# title = 'Convention Status'
# parameter_name = 'convention_status'
# def lookups(self, request, model_admin):
# return (
# (-10, 'Inactive'),
# ... |
krautradio/PyRfK | refs/heads/master | setup.py | 4 | import os
from setuptools import setup
def find_packages(dir_):
packages = []
for _dir, subdirectories, files in os.walk(os.path.join(dir_, 'rfk')):
if '__init__.py' in files:
lib, fragment = _dir.split(os.sep, 1)
packages.append(fragment.replace(os.sep, '.'))
return packag... |
takeshineshiro/django | refs/heads/master | django/core/management/templates.py | 274 | import cgi
import errno
import mimetypes
import os
import posixpath
import re
import shutil
import stat
import sys
import tempfile
from os import path
import django
from django.core.management.base import BaseCommand, CommandError
from django.core.management.utils import handle_extensions
from django.template import C... |
wdzhou/mantid | refs/heads/master | Framework/PythonInterface/test/python/mantid/kernel/NullValidatorTest.py | 3 | from __future__ import (absolute_import, division, print_function)
import unittest
import testhelpers
from mantid.kernel import NullValidator
class NullValidatorTest(unittest.TestCase):
def test_NullValidator_can_be_default_constructed(self):
testhelpers.assertRaisesNothing(self, NullValidator)
if __nam... |
ahojjati/grr | refs/heads/master | parsers/chrome_history_test.py | 6 | #!/usr/bin/env python
# Copyright 2011 Google Inc. All Rights Reserved.
"""Tests for grr.parsers.chrome_history."""
import datetime
import os
from grr.lib import flags
from grr.lib import test_lib
from grr.parsers import chrome_history
class ChromeHistoryTest(test_lib.GRRBaseTest):
"""Test parsing of chrome hi... |
rghe/ansible | refs/heads/devel | lib/ansible/modules/cloud/rackspace/rax.py | 39 | #!/usr/bin/python
# Copyright: 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'],
... |
sdu-cfei/modest-py | refs/heads/master | modestpy/test/test_scipy.py | 1 | """
Copyright (c) 2017, University of Southern Denmark
All rights reserved.
This code is licensed under BSD 2-clause license.
See LICENSE file in the project root for license terms.
"""
import unittest
import shutil
import tempfile
import json
import os
import pandas as pd
from modestpy.estim.scipy.scipy import SCIPY
f... |
lmyboy/RaspberryPi | refs/heads/master | aquaPi.py | 1 | import os
import glob
import time
import RPi.GPIO as GPIO
from bluetooth import *
os.system('modprobe w1-gpio')
os.system('modprobe w1-therm')
#GPIO.setmode(GPIO.BCM)
#GPIO.setup(17, GPIO.OUT)
base_dir = '/sys/bus/w1/devices/w1_bus_master1'
device_file = base_dir + '/w1_master_slaves'
def read_temp_raw():
f = ... |
yqm/sl4a | refs/heads/master | python/src/Lib/test/test_fnmatch.py | 98 | """Test cases for the fnmatch module."""
from test import test_support
import unittest
from fnmatch import fnmatch, fnmatchcase
class FnmatchTestCase(unittest.TestCase):
def check_match(self, filename, pattern, should_match=1):
if should_match:
self.assert_(fnmatch(filename, pattern),
... |
fffy2366/image-processing | refs/heads/master | bin/python/pil_image_similarity.py | 1 | #sudo pip install PIL
def pil_image_similarity(filepath1, filepath2):
from PIL import Image
import math
import operator
image1 = Image.open(filepath1)
image2 = Image.open(filepath2)
# image1 = get_thumbnail(img1)
# image2 = get_thumbnail(img2)
h1 = image1.histogram()
h2 = image2.his... |
EvanK/ansible | refs/heads/devel | lib/ansible/modules/network/system/net_system.py | 26 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, Ansible by Red Hat, inc
# 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',
... |
EarthmanT/moto | refs/heads/master | moto/ses/__init__.py | 23 | from __future__ import unicode_literals
from .models import ses_backend
mock_ses = ses_backend.decorator
|
adrienbrault/home-assistant | refs/heads/dev | homeassistant/components/fibaro/binary_sensor.py | 14 | """Support for Fibaro binary sensors."""
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_DOOR,
DEVICE_CLASS_MOTION,
DEVICE_CLASS_SMOKE,
DEVICE_CLASS_WINDOW,
DOMAIN,
BinarySensorEntity,
)
from homeassistant.const import CONF_DEVICE_CLASS, CONF_ICON
from . import FIBARO_DEVICES,... |
Belxjander/Kirito | refs/heads/master | Python-3.5.0-Amiga/Lib/test/double_const.py | 203 | from test.support import TestFailed
# A test for SF bug 422177: manifest float constants varied way too much in
# precision depending on whether Python was loading a module for the first
# time, or reloading it from a precompiled .pyc. The "expected" failure
# mode is that when test_import imports this after all .py... |
mbareta/edx-platform-ft | refs/heads/open-release/eucalyptus.master | lms/djangoapps/course_wiki/plugins/markdownedx/__init__.py | 275 | # Make sure wiki_plugin.py gets run.
from course_wiki.plugins.markdownedx.wiki_plugin import ExtendMarkdownPlugin
|
sthirugn/tiertest | refs/heads/master | sampletests/__init__.py | 20 | # -*- encoding: utf-8 -*-
"""
This module contains tests both for Foreman and Robottelo itself.
Tests for Robottelo are in the ``robottelo`` module. Those tests are
inward-facing: they help ensure that this codebase is functioning correctly.
Tests for Foreman are in the ``foreman`` module. Those tests are
outward-fac... |
openthread/openthread | refs/heads/main | tools/harness-automation/cases/commissioner_9_2_4.py | 18 | #!/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... |
dentaku65/plugin.video.sod | refs/heads/master | servers/safelinking.py | 43 | # -*- coding: utf-8 -*-
#------------------------------------------------------------
# pelisalacarta - XBMC Plugin
# Conector para safelinking (ocultador de url)
# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
#------------------------------------------------------------
import urlparse,urllib2,urllib,re
imp... |
CUCWD/edx-platform | refs/heads/master | lms/djangoapps/certificates/services.py | 17 | """
Certificate service
"""
import logging
from django.core.exceptions import ObjectDoesNotExist
from lms.djangoapps.utils import _get_key
from opaque_keys.edx.keys import CourseKey
from .models import GeneratedCertificate
log = logging.getLogger(__name__)
class CertificateService(object):
"""
User Certifi... |
minhphung171093/OpenERP_V8 | refs/heads/master | openerp/addons/project/tests/test_project_flow.py | 198 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (c) 2013-TODAY OpenERP S.A. <http://www.openerp.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms... |
ArcherSys/ArcherSys | refs/heads/master | Lib/test/__main__.py | 2 | <<<<<<< HEAD
<<<<<<< HEAD
from test import regrtest
regrtest.main_in_temp_cwd()
=======
from test import regrtest
regrtest.main_in_temp_cwd()
>>>>>>> b875702c9c06ab5012e52ff4337439b03918f453
=======
from test import regrtest
regrtest.main_in_temp_cwd()
>>>>>>> b875702c9c06ab5012e52ff4337439b03918f453
|
Tanych/CodeTracking | refs/heads/master | 26-Remove-Duplicates-from-Sorted-Array/solution.py | 1 | class Solution(object):
def removeDuplicates(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
n=len(nums)
if n==0:
return 0
if n==1:
return 1
i=1
while i<len(nums):
if nums[i]==nums[i-1]:
... |
lgarren/spack | refs/heads/develop | var/spack/repos/builtin/packages/r-geomorph/package.py | 1 | ##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, [email protected], All rights reserved.
# LLNL-CODE-64... |
hainm/scikit-learn | refs/heads/master | benchmarks/bench_multilabel_metrics.py | 276 | #!/usr/bin/env python
"""
A comparison of multilabel target formats and metrics over them
"""
from __future__ import division
from __future__ import print_function
from timeit import timeit
from functools import partial
import itertools
import argparse
import sys
import matplotlib.pyplot as plt
import scipy.sparse as... |
autosub-team/autosub | refs/heads/master | tasks/tools/vhdl_task_creator/src/python_ui/ui_page_entity_config.py | 2 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '../qt5_ui/page_entity_config.ui'
#
# Created: Mon Oct 29 12:05:24 2018
# by: PyQt5 UI code generator 5.3.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_PageEntityConfig(o... |
marty331/jakesclock | refs/heads/master | flask/lib/python2.7/site-packages/werkzeug/useragents.py | 148 | # -*- coding: utf-8 -*-
"""
werkzeug.useragents
~~~~~~~~~~~~~~~~~~~
This module provides a helper to inspect user agent strings. This module
is far from complete but should work for most of the currently available
browsers.
:copyright: (c) 2014 by the Werkzeug Team, see AUTHORS for more deta... |
d2si-oss/demo-aws-lambda-buffer-api | refs/heads/master | code/buffer/functions/proxy/vendor/requests/packages/chardet/constants.py | 3007 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is Mozilla Universal charset detector code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 2001
# the Initial Developer. All R... |
chromakode/karmabot | refs/heads/master | karmabot/core/storage.py | 1 | import cPickle
from redis import Redis
from .signal import post_connection
from .subject import Subject
db = None
@post_connection.connect
def load_catalog(sender):
global db
db = Catalog()
class Catalog(dict):
def __init__(self, host='localhost', port=6379, db=0):
self.redis = Redis(host=host... |
jamespcole/home-assistant | refs/heads/master | homeassistant/components/coinbase/__init__.py | 3 | """Support for Coinbase."""
from datetime import timedelta
import logging
import voluptuous as vol
from homeassistant.const import CONF_API_KEY
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.discovery import load_platform
from homeassistant.util import Throttle
REQUIREMENTS = ['coinb... |
savoirfairelinux/django | refs/heads/master | tests/auth_tests/models/with_custom_email_field.py | 59 | from django.contrib.auth.base_user import AbstractBaseUser
from django.contrib.auth.models import BaseUserManager
from django.db import models
class CustomEmailFieldUserManager(BaseUserManager):
def create_user(self, username, password, email):
user = self.model(username=username)
user.set_passwor... |
junneyang/studysummary | refs/heads/master | 008Python学习/PythonSource/COMMON_SSH_Lib.py | 1 | # -*- coding: cp936 -*-
#-------------------------------------------------------------------------------
# Name:
# Purpose:
#
# Author: yangjun/y00193825
#
# Created:
# Copyright: (c) y00193825 2012
# Licence: <your licence>
#----------------------------------------------------------------------... |
kalxas/geonode | refs/heads/master | geonode/social/views.py | 4 | # -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2016 OSGeo
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 ... |
gmilos/swift | refs/heads/master | utils/swift_build_support/swift_build_support/products/libdispatch.py | 5 | # swift_build_support/products/libdispatch.py -------------------*- python -*-
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://swift.org/LICENSE.tx... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.