repo_name
stringlengths
5
100
ref
stringlengths
12
67
path
stringlengths
4
244
copies
stringlengths
1
8
content
stringlengths
0
1.05M
⌀
venth/aws-adfs
refs/heads/master
test/test_version.py
1
from aws_adfs import commands class TestVersion: def test_returns_version(self): # given # when try: result = commands.cli(['--version']) assert False except SystemExit as e: # then assert e.code == 0
sharkykh/SickRage
refs/heads/develop
lib/validators/slug.py
32
import re from .utils import validator slug_regex = re.compile(r'^[-a-zA-Z0-9_]+$') @validator def slug(value): """ Validate whether or not given value is valid slug. Valid slug can contain only alphanumeric characters, hyphens and underscores. Examples:: >>> slug('my.slug') V...
pravisankar/origin
refs/heads/master
vendor/github.com/getsentry/raven-go/docs/_sentryext/verify-docs.py
37
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This can be run as a commit hook to ensure that the rst files do not contain some of the more frustrating issues for federated doc support. """ import os import re import sys import errno import subprocess _ref_target_re = re.compile(r'^\.\.\s+_([^:]+):') _doc_ref_re ...
ryano144/intellij-community
refs/heads/master
python/lib/Lib/site-packages/django/middleware/common.py
86
import re from django.conf import settings from django import http from django.core.mail import mail_managers from django.utils.http import urlquote from django.core import urlresolvers from django.utils.hashcompat import md5_constructor from django.utils.log import getLogger logger = getLogger('django.request') cl...
ActiveState/code
refs/heads/master
recipes/Python/578789_Sticky_window/recipe-578789.py
1
from PyQt4 import QtGui from PyQt4.QtGui import QApplication import sys, ctypes class WINDOWPOS(ctypes.Structure): _fields_ = [ ('hwnd', ctypes.c_ulong), ('hwndInsertAfter', ctypes.c_ulong), ('x', ctypes.c_int), ('y', ctypes.c_int), ('cx', ctypes.c_int), ('cy', ctypes...
almeidapaulopt/erpnext
refs/heads/develop
erpnext/accounts/doctype/pos_profile/test_pos_profile.py
2
# -*- 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 from erpnext.stock.get_item_details import get_pos_profile from erpnext.accounts.doctype.sales_invoice.pos import get_ite...
windyuuy/opera
refs/heads/master
chromium/src/tools/grit/grit/exception.py
54
#!/usr/bin/env python # Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. '''Exception types for GRIT. ''' class Base(Exception): '''A base exception that uses the class's docstring in addition to any ...
stack-of-tasks/rbdlpy
refs/heads/master
tutorial/lib/python2.7/site-packages/OpenGL/raw/GL/NV/texture_expand_normal.py
9
'''Autogenerated by xml_generate script, do not edit!''' from OpenGL import platform as _p, arrays # Code generation uses this from OpenGL.raw.GL import _types as _cs # End users want this... from OpenGL.raw.GL._types import * from OpenGL.raw.GL import _errors from OpenGL.constant import Constant as _C import ctypes _...
skyostil/tracy
refs/heads/master
src/generator/Cheetah/Macros/I18n.py
1
import gettext _ = gettext.gettext class I18n(object): def __init__(self, parser): pass ## junk I'm playing with to test the macro framework # def parseArgs(self, parser, startPos): # parser.getWhiteSpace() # args = parser.getExpression(useNameMapper=False, # ...
remybaranx/qtaste
refs/heads/master
tools/jython/lib/Lib/xml/sax/saxutils.py
9
""" A library of useful helper classes to the saxlib classes, for the convenience of application and driver writers. $Id: saxutils.py,v 1.37 2005/04/13 14:02:08 syt Exp $ """ import os, urlparse, urllib2, types import handler import xmlreader import sys, _exceptions, saxlib from xml.Uri import Absolutize, MakeUrllibS...
abdoosh00/edraak
refs/heads/master
lms/envs/cms/microsite_test.py
1
""" This is a localdev test for the Microsite processing pipeline """ # We intentionally define lots of variables that aren't used, and # want to import all variables from base settings files # pylint: disable=W0401, W0614 from .dev import * from ..dev import ENV_ROOT, FEATURES MICROSITE_CONFIGURATION = { "opene...
azjps/bokeh
refs/heads/master
examples/charts/file/stacked_bar.py
7
from bokeh.charts import Bar, output_file, show from bokeh.charts.attributes import cat, color from bokeh.charts.operations import blend from bokeh.charts.utils import df_from_json from bokeh.sampledata.olympics2014 import data # utilize utility to make it easy to get json/dict data converted to a dataframe df = df_fr...
TathagataChakraborti/resource-conflicts
refs/heads/master
PLANROB-2015/py2.5/lib/python2.5/idlelib/testcode.py
312
import string def f(): a = 0 b = 1 c = 2 d = 3 e = 4 g() def g(): h() def h(): i() def i(): j() def j(): k() def k(): l() l = lambda: test() def test(): string.capwords(1) f()
iulian787/spack
refs/heads/develop
var/spack/repos/builtin/packages/heputils/package.py
2
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class Heputils(MakefilePackage): """Generic tools for high energy physics, e.g. vectors, event r...
kronicz/ecommerce-2
refs/heads/master
lib/python2.7/site-packages/registration/utils.py
7
import sys try: from importlib import import_module except ImportError: from django.utils.importlib import import_module from django.utils import six def import_string(dotted_path): """ COPIED FROM DJANGO 1.7 (django.utils.module_loading.import_string) Import a dotted module path and return the at...
oculusstorystudio/kraken
refs/heads/develop_OSS
Python/kraken_components/biped/hand_component.py
2
from collections import OrderedDict from kraken.core.maths import Vec3 from kraken.core.maths.xfo import Xfo from kraken.core.objects.components.base_example_component import BaseExampleComponent from kraken.core.objects.attributes.attribute_group import AttributeGroup from kraken.core.objects.attributes.scalar_at...
jsma/django-cms
refs/heads/develop
cms/tests/test_docs.py
6
# -*- coding: utf-8 -*- from contextlib import contextmanager from unittest import skipIf, skipUnless import os import socket import sys import django from django.utils.six.moves import StringIO from sphinx.application import Sphinx, SphinxWarning try: import enchant except ImportError: enchant = None impor...
ehashman/oh-mainline
refs/heads/master
vendor/packages/twisted/twisted/news/test/test_database.py
17
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. """ Tests for L{twisted.news.database}. """ __metaclass__ = type from email.Parser import Parser from socket import gethostname from twisted.trial.unittest import TestCase from twisted.internet.defer import succeed from twisted.mail.smtp import...
codeaudit/gp-structure-search
refs/heads/master
experiments/multi-d-250-16Feb.py
3
# Runs all 1d datasets. Experiment(description='Run all multi D datasets', data_dir='../data/kfold_data/', max_depth=12, random_order=False, k=1, debug=False, local_computation=False, n_rand=2, sd=4, max_jobs=250, ...
Distrotech/intellij-community
refs/heads/master
python/lib/Lib/site-packages/django/core/management/commands/cleanup.py
350
import datetime from django.core.management.base import NoArgsCommand class Command(NoArgsCommand): help = "Can be run as a cronjob or directly to clean out old data from the database (only expired sessions at the moment)." def handle_noargs(self, **options): from django.db import transaction ...
Joergen/zamboni
refs/heads/uge43
apps/amo/urls.py
5
import csp.views from waffle.views import wafflejs from django.conf.urls import include, patterns, url from django.views.decorators.cache import never_cache from . import views, install services_patterns = patterns('', url('^monitor(.json)?$', never_cache(views.monitor), name='amo.monitor'), url('^lo...
dattatreya303/zulip
refs/heads/master
zerver/webhooks/jira/view.py
3
# Webhooks for external integrations. from __future__ import absolute_import from typing import Any, Dict, List, Optional, Text, Tuple from django.utils.translation import ugettext as _ from django.db.models import Q from django.conf import settings from django.http import HttpRequest, HttpResponse from zerver.models...
ESS-LLP/erpnext-healthcare
refs/heads/master
erpnext/accounts/report/non_billed_report.py
41
# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors # For license information, please see license.txt from __future__ import unicode_literals import frappe from frappe import _ from erpnext import get_default_currency from frappe.model.meta import get_field_precision def get_ordered_to_be_billed_data...
coreynicholson/youtube-dl
refs/heads/master
youtube_dl/extractor/tagesschau.py
58
# coding: utf-8 from __future__ import unicode_literals import re from .common import InfoExtractor from ..utils import ( determine_ext, js_to_json, parse_iso8601, parse_filesize, ) class TagesschauPlayerIE(InfoExtractor): IE_NAME = 'tagesschau:player' _VALID_URL = r'https?://(?:www\.)?tages...
xcLtw/small-blog
refs/heads/master
app/models.py
1
from werkzeug.security import generate_password_hash, check_password_hash from app import db, login_manager from flask_login import UserMixin, AnonymousUserMixin from itsdangerous import TimedJSONWebSignatureSerializer as Serialzer from flask import current_app, request from datetime import datetime import hashlib cl...
betrisey/home-assistant
refs/heads/dev
homeassistant/components/netatmo.py
2
""" Support for the Netatmo devices. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/netatmo/ """ import logging from datetime import timedelta from urllib.error import HTTPError import voluptuous as vol from homeassistant.const import ( CONF_API_KE...
kopach/git-cola
refs/heads/master
cola/resources.py
2
"""Provides the prefix() function for finding cola resources""" from __future__ import division, absolute_import, unicode_literals import os import webbrowser from os.path import dirname from . import core # Default git-cola icon theme _default_icon_theme = 'light' _modpath = core.abspath(__file__) if os.path.join...
jk1/intellij-community
refs/heads/master
python/lib/Lib/site-packages/django/contrib/admindocs/models.py
634
# Empty models.py to allow for specifying admindocs as a test label.
hsharsha/depot_tools
refs/heads/master
fetch_configs/ios.py
12
# Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import sys import config_util # pylint: disable=F0401 # This class doesn't need an __init__ method, so we disable the warning # pylint: disable=W0232 cla...
terrycain/razer-drivers
refs/heads/master
pylib/openrazer/client/__init__.py
2
import json import dbus as _dbus from openrazer.client.device import RazerDeviceFactory as _RazerDeviceFactory from openrazer.client import constants __version__ = '2.5.0' class DaemonNotFound(Exception): pass class DeviceManager(object): """ DeviceManager Class """ def __init__(self): ...
PhilLidar-DAD/geonode
refs/heads/master
geonode/documents/urls.py
1
# -*- coding: utf-8 -*- ######################################################################### # # Copyright (C) 2012 OpenPlans # # 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 versio...
bvorjohan/2048_AI
refs/heads/master
logic.py
1
# from random import * import numpy as np def new_game(n): ##### # Generate new matrix ##### matrix = [] for i in range(n): matrix.append([0] * n) return matrix def num_zeros(mat): ##### # Returns the number of 0s in a 4x4 matrix ##### return 16-np.count_nonzero(mat)...
virajs/selenium-1
refs/heads/trunk
py/test/selenium/common/utils.py
20
import os import socket import time import urllib import subprocess import signal SERVER_ADDR = "localhost" DEFAULT_PORT = 4444 SERVER_PATH = "build/java/server/src/org/openqa/grid/selenium/selenium-standalone.jar" def start_server(module): _socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) url = "...
arjay2539/Hacktoberfest-2k17
refs/heads/master
Python/pankaj.py
3
import random print(random.randint(0,99))
ziozzang/kernel-rhel6
refs/heads/master
tools/perf/python/twatch.py
3213
#! /usr/bin/python # -*- python -*- # -*- coding: utf-8 -*- # twatch - Experimental use of the perf python interface # Copyright (C) 2011 Arnaldo Carvalho de Melo <acme@redhat.com> # # This application is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License...
alanljj/oca_hr
refs/heads/8.0
hr_infraction/wizard/__init__.py
28
# -*- coding:utf-8 -*- # # # Copyright (C) 2013 Michael Telahun Makonnen <mmakonnen@gmail.com>. # All Rights Reserved. # # 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, eit...
osgn/python-topojson
refs/heads/master
src/topojson/clockwise.py
1
class Clock: def __init__(self, area): self.area = area def clock(self, feature): if 'geometries' in feature: feature['geometries'] = map( self.clock_geometry, feature['geometries']) elif 'geometry' in feature: feature['geometry'] = sel...
VioletRed/script.module.urlresolver
refs/heads/master
lib/urlresolver/plugins/cloudy.py
1
""" urlresolver XBMC Addon Copyright (C) 2011 t0mm0 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 License, or (at your option) any later version. ...
apaleyes/mxnet
refs/heads/master
example/recommenders/matrix_fact.py
15
import math import mxnet as mx import numpy as np import mxnet.notebook.callback import logging logging.basicConfig(level=logging.DEBUG) def RMSE(label, pred): ret = 0.0 n = 0.0 pred = pred.flatten() for i in range(len(label)): ret += (label[i] - pred[i]) * (label[i] - pred[i]) n += 1....
swails/chemlab
refs/heads/master
chemlab/db/utils.py
6
# Utilities for data handling class InsensitiveDict: """Dictionary, that has case-insensitive keys. Normally keys are retained in their original form when queried with .keys() or .items(). If initialized with preserveCase=0, keys are both looked up in lowercase and returned in lowercase by .keys() an...
jjo31/ATHAM-Fluidity
refs/heads/ToMerge
tests/gls-Kato_Phillips-mixed_layer_depth/mld_calc.py
4
from numpy import arange,concatenate,array,argsort,zeros import os import sys import vtktools import math import re from math import sqrt from scipy.interpolate import UnivariateSpline #### taken from http://www.codinghorror.com/blog/archives/001018.html ####### def sort_nicely( l ): """ Sort the given list in th...
edisonlz/fruit
refs/heads/master
web_project/base/site-packages/sorl/thumbnail/images.py
2
# encoding=utf-8 from __future__ import unicode_literals, division import os import re from django.core.files.base import File, ContentFile from django.core.files.storage import Storage, default_storage from django.utils.functional import LazyObject, empty from sorl.thumbnail import default from sorl.thumbnail.conf ...
ryfeus/lambda-packs
refs/heads/master
Tensorflow/source/tensorflow/contrib/tensor_forest/client/eval_metrics.py
52
# 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...
privacyidea/privacyidea
refs/heads/master
privacyidea/webui/__init__.py
7
__author__ = 'cornelius koelbel <cornelius@privacyidea.org>'
neerajvashistha/pa-dude
refs/heads/master
lib/python2.7/site-packages/django/contrib/contenttypes/fields.py
58
from __future__ import unicode_literals from collections import defaultdict from django.contrib.contenttypes.models import ContentType from django.core import checks from django.core.exceptions import FieldDoesNotExist, ObjectDoesNotExist from django.db import DEFAULT_DB_ALIAS, models, router, transaction from django...
sahilshekhawat/sympy
refs/heads/master
sympy/series/tests/test_residues.py
5
from sympy import residue, Symbol, Function, sin, S, I, exp, log, pi, factorial from sympy.utilities.pytest import XFAIL, raises from sympy.abc import x, z, a, s def test_basic1(): assert residue(1/x, x, 0) == 1 assert residue(-2/x, x, 0) == -2 assert residue(81/x, x, 0) == 81 assert residue(1/x**2, x...
HwisooSo/gemV-update
refs/heads/gemV
src/python/m5/simulate.py
3
# Copyright (c) 2012 ARM Limited # All rights reserved. # # The license below extends only to copyright in the software and shall # not be construed as granting a license to any other intellectual # property including but not limited to intellectual property relating # to a hardware implementation of the functionality ...
c0defreak/python-for-android
refs/heads/master
python-modules/twisted/twisted/plugins/twisted_conch.py
61
# Copyright (c) 2001-2008 Twisted Matrix Laboratories. # See LICENSE for details. from twisted.application.service import ServiceMaker TwistedSSH = ServiceMaker( "Twisted Conch Server", "twisted.conch.tap", "A Conch SSH service.", "conch") TwistedManhole = ServiceMaker( "Twisted Manhole (new)", ...
akiyoko/oscar_project
refs/heads/master
src/oscar/views/__init__.py
68
from django.shortcuts import render def handler403(request): return render(request, '403.html', status=403) def handler404(request): return render(request, '404.html', status=404) def handler500(request): return render(request, '500.html', status=500) def sort_queryset(queryset, request, allowed_sor...
rationalAgent/edx-platform-custom
refs/heads/master
common/djangoapps/external_auth/tests/test_shib.py
2
""" Tests for Shibboleth Authentication @jbau """ import unittest from django.conf import settings from django.http import HttpResponseRedirect from django.test.client import RequestFactory, Client as DjangoTestClient from django.test.utils import override_settings from django.core.urlresolvers import reverse from dja...
lucafavatella/intellij-community
refs/heads/cli-wip
python/testData/deprecation/deprecatedModule.py
83
import warnings warnings.warn("the deprecated module is deprecated; use a non-deprecated module instead", DeprecationWarning, 2)
Baumelbi/IntroPython2016
refs/heads/master
students/sheree/lightning_talk/holy_shazbot.py
3
''' This is my handcrafted artisanal locally sourced gluten free vegan docstrings. ''' #I stripped the content because it's private
andyzsf/Cactus-
refs/heads/master
cactus/tests/deployment/test_engine_api.py
14
#coding:utf-8 from cactus.tests.deployment import DummyUI, DummySite, DummyDeploymentEngine, BaseDeploymentTestCase class BucketCreateTestCase(BaseDeploymentTestCase): def setUp(self): super(BucketCreateTestCase, self).setUp() self.ui = DummyUI() self.site = DummySite(self.test_dir, self.u...
haxoza/django
refs/heads/master
tests/servers/views.py
384
from django.http import HttpResponse from .models import Person def example_view(request): return HttpResponse('example view') def model_view(request): people = Person.objects.all() return HttpResponse('\n'.join(person.name for person in people)) def create_model_instance(request): person = Perso...
aospx-kitkat/platform_external_chromium_org
refs/heads/kitkat
tools/deep_memory_profiler/lib/subcommand.py
24
# Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import logging import optparse import os import re from lib.bucket import BucketSet from lib.dump import Dump, DumpList from lib.symbol import SymbolDataSou...
eduNEXT/edunext-platform
refs/heads/master
common/djangoapps/entitlements/api/v1/tests/test_serializers.py
4
import unittest from django.conf import settings from django.test import RequestFactory from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase # Entitlements is not in CMS' INSTALLED_APPS so these imports will error during test collection if settings.ROOT_URLCONF == 'lms.urls': from entitlement...
annegabrielle/secure_adhoc_network_ns-3
refs/heads/master
ns3_source_code/ns-3.10/.waf-1.5.16-e6d03192b5ddfa5ef2c8d65308e48e42/wafadmin/Tools/winres.py
6
#! /usr/bin/env python # encoding: utf-8 import os,sys,re import TaskGen,Task from Utils import quote_whitespace from TaskGen import extension EXT_WINRC=['.rc'] winrc_str='${WINRC} ${_CPPDEFFLAGS} ${_CCDEFFLAGS} ${WINRCFLAGS} ${_CPPINCFLAGS} ${_CCINCFLAGS} ${WINRC_TGT_F} ${TGT} ${WINRC_SRC_F} ${SRC}' def rc_file(self,...
nathanielparke/huxley
refs/heads/master
huxley/logging/migrations/0001_initial.py
3
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ] operations = [ migrations.CreateModel( name='LogEntry', fields=[ ('id', models.AutoField(ver...
coreynicholson/youtube-dl
refs/heads/master
youtube_dl/extractor/patreon.py
41
# coding: utf-8 from __future__ import unicode_literals from .common import InfoExtractor from ..utils import js_to_json class PatreonIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?patreon\.com/creation\?hid=(?P<id>[^&#]+)' _TESTS = [ { 'url': 'http://www.patreon.com/creation?hid=74...
norn/bustime
refs/heads/master
utils/nbusstops-export.py
1
#!/usr/bin/python # -*- coding: utf-8 -*- from devinclude import * from bustime.models import * import time import urllib import socket import random from django.contrib.sessions.models import Session import csv from django.contrib.gis.geos import Point import codecs import json import pickle #city=City.objects.get(...
steebchen/youtube-dl
refs/heads/master
youtube_dl/extractor/tvnoe.py
59
# coding: utf-8 from __future__ import unicode_literals from .common import InfoExtractor from ..utils import ( clean_html, get_element_by_class, js_to_json, ) class TVNoeIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?tvnoe\.cz/video/(?P<id>[0-9]+)' _TEST = { 'url': 'http://www.tvno...
sandvine/horizon
refs/heads/master
horizon/contrib/bootstrap_datepicker.py
87
# Copyright 2014 IBM Corp. # # 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, s...
ronaldahmed/SLAM-for-ugv
refs/heads/master
neural-navigation-with-lstm/MARCO/Utility/logger.py
2
import gzip, logging, os, os.path, sys, time Sep ={ 'DEBUG' : '~', 'INFO' : '.', 'STAGE' : '=', 'RUN' : '!', 'WARNING' : '.', 'ERROR' : '_', 'CRITICAL' : '#', } def initLogger(loggerName,consoleLevel=logging.INFO,doTrace=True,LogDir='Logs'): global timeStamp,logger logger = log...
nmaswood/tv_scraping
refs/heads/master
lib/python2.7/site-packages/pip/commands/wheel.py
239
# -*- coding: utf-8 -*- from __future__ import absolute_import import logging import os import warnings from pip.basecommand import RequirementCommand from pip.index import PackageFinder from pip.exceptions import CommandError, PreviousBuildDirError from pip.req import RequirementSet from pip.utils import import_or_r...
snak3ater/kernel_msm
refs/heads/Sema_M
tools/perf/util/setup.py
4998
#!/usr/bin/python2 from distutils.core import setup, Extension from os import getenv from distutils.command.build_ext import build_ext as _build_ext from distutils.command.install_lib import install_lib as _install_lib class build_ext(_build_ext): def finalize_options(self): _build_ext.finalize_optio...
JFriel/honours_project
refs/heads/master
venv/lib/python2.7/site-packages/pip/commands/zip.py
84
import sys import re import fnmatch import os import shutil import zipfile from pip.util import display_path, backup_dir, rmtree from pip.log import logger from pip.exceptions import InstallationError from pip.basecommand import Command class ZipCommand(Command): """Zip individual packages.""" name = 'zip' ...
hyperized/ansible
refs/heads/devel
lib/ansible/modules/cloud/openstack/os_router.py
52
#!/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'],...
Unknowncmbk/HiddenMarkovModel
refs/heads/master
test.py
1
# # Provides test cases for various test cases. # # Compiled against Python 2.7 # Author: Stephen Bahr (sbahr@bu.edu) import copy import math import unittest import markov class Test(unittest.TestCase): '''Unit tests for assignment 5''' _TRAINING_DATA = ( ('<s>', '<s>'), ('N', 'spot'), ('V', '...
CospanDesign/nysa-tx1-pcie-platform
refs/heads/master
tx1_pcie/slave/wb_tx1_pcie/cocotb/dut_driver.py
1
#PUT LICENCE HERE! """ wb_tx1_pcie Driver """ import sys import os import time from array import array as Array sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir)) from nysa.host.driver import driver #Sub Module ID #Use 'nysa devices' to get a list of different availabl...
danlrobertson/servo
refs/heads/master
tests/wpt/web-platform-tests/service-workers/service-worker/resources/update-max-aged-worker-imported-script.py
46
import time def main(request, response): headers = [('Content-Type', 'application/javascript'), ('Cache-Control', 'max-age=86400'), ('Last-Modified', time.strftime("%a, %d %b %Y %H:%M:%S GMT", time.gmtime()))] body = ''' const importTime = {time:8f}; '''.format(time=t...
TangXT/edx-platform
refs/heads/master
common/djangoapps/user_api/middleware.py
9
""" Middleware for user api. Adds user's tags to tracking event context. """ from track.contexts import COURSE_REGEX from eventtracking import tracker from user_api.models import UserCourseTag from opaque_keys.edx.locations import SlashSeparatedCourseKey class UserTagsEventContextMiddleware(object): """Middleware...
atsolakid/edx-platform
refs/heads/master
common/djangoapps/student/migrations/0048_add_profile_image_version.py
84
# -*- coding: utf-8 -*- from south.utils import datetime_utils as datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding field 'UserProfile.profile_image_uploaded_at' db.add_column('aut...
gunthercox/ChatterBot
refs/heads/master
chatterbot/storage/__init__.py
2
from chatterbot.storage.storage_adapter import StorageAdapter from chatterbot.storage.django_storage import DjangoStorageAdapter from chatterbot.storage.mongodb import MongoDatabaseAdapter from chatterbot.storage.sql_storage import SQLStorageAdapter __all__ = ( 'StorageAdapter', 'DjangoStorageAdapter', 'M...
denisff/python-for-android
refs/heads/master
python-modules/twisted/twisted/trial/test/test_output.py
61
# Copyright (c) 2008 Twisted Matrix Laboratories. # See LICENSE for details. """ Tests for the output generated by trial. """ import os, StringIO from twisted.scripts import trial from twisted.trial import runner from twisted.trial.test import packages def runTrial(*args): from twisted.trial import reporter ...
msebire/intellij-community
refs/heads/master
python/testData/refactoring/rename/googleDocStringAttribute.py
53
class C: """ Attributes: foo : ignored """ def __init__(self): self.fo<caret>o = 42
MotorolaMobilityLLC/external-chromium_org
refs/heads/kitkat-mr1-release-falcon-gpe
chrome/browser/safe_browsing/safe_browsing_testserver.py
74
#!/usr/bin/env python # Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Wraps the upstream safebrowsing_test_server.py to run in Chrome tests.""" import os import sys BASE_DIR = os.path.dirname(os.path....
tjsavage/rototutor_djangononrel
refs/heads/master
dbindexes.py
228
from dbindexer import autodiscover autodiscover()
EduPepperPD/pepper2013
refs/heads/master
lms/djangoapps/bulk_email/models.py
8
""" Models for bulk email WE'RE USING MIGRATIONS! If you make changes to this model, be sure to create an appropriate migration file and check it in at the same time as your model changes. To do that, 1. Go to the edx-platform dir 2. ./manage.py lms schemamigration bulk_email --auto description_of_your_change 3. Add...
zBMNForks/graphite-web
refs/heads/master
webapp/tests/test_browser.py
35
# -*- coding: utf-8 -*- import json import os from django.contrib.auth.models import User from django.core.urlresolvers import reverse from django.test import TestCase from django.test.utils import override_settings from . import DATA_DIR class BrowserTest(TestCase): def test_browser(self): url = revers...
vikingMei/mxnet
refs/heads/master
python/mxnet/contrib/text/embedding.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 u...
tinkhaven-organization/odoo
refs/heads/8.0
addons/payment_paypal/tests/test_paypal.py
378
# -*- coding: utf-8 -*- from openerp.addons.payment.models.payment_acquirer import ValidationError from openerp.addons.payment.tests.common import PaymentAcquirerCommon from openerp.addons.payment_paypal.controllers.main import PaypalController from openerp.tools import mute_logger from lxml import objectify import u...
stefanbo92/maleChildren
refs/heads/master
Raspi/MotorControl.py
1
import time import RPi.GPIO as GPIO import matplotlib.pyplot as plt # Use BCM GPIO references # instead of physical pin numbers GPIO.setmode(GPIO.BCM) class MotorControl: def __init__(self): #specify params self.forwardSpeed=30 self.turnSpeed=40 self.maxSpeed=1.7*self.forwardSpee...
HeyItsAlan/flask
refs/heads/master
tests/test_helpers.py
142
# -*- coding: utf-8 -*- """ tests.helpers ~~~~~~~~~~~~~~~~~~~~~~~ Various helpers. :copyright: (c) 2015 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ import pytest import os import datetime import flask from logging import StreamHandler from werkzeug.http import parse_cache...
gsnedders/presto-testo
refs/heads/master
css/image-fit/reftests/svg-no-viewBox/build.py
4
#!/usr/bin/python pARs = ['none', 'xMidYMid meet', 'xMidYMid slice'] fits = ['fill', 'contain', 'cover', 'auto', 'none'] test_template = """<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>-o-object-fit:%s; pAR:%s</title> <link rel="stylesheet" href="../../support/reftests.css"/> <style> #te...
magic0704/neutron
refs/heads/master
neutron/plugins/nec/config.py
26
# Copyright 2012 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 ...
google/ehr-predictions
refs/heads/main
ehr_prediction_modeling/tasks/labs_task.py
1
# coding=utf-8 # Copyright 2020 Google Health Research. # # 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 la...
cpaulik/scipy
refs/heads/master
tools/validate_runtests_log.py
75
#!/usr/bin/env python """ Take the test runner log output from the stdin, looking for the magic line nose runner prints when the test run was successful. In an ideal world, this should be done directly in runtests.py using the nose API, some failure modes are fooling nose to terminate the python process with zero exi...
Distrotech/intellij-community
refs/heads/master
python/testData/completion/parameterFromUsages.after.py
83
def foo(bar): bar.append() def baz(): foo(['hello', 'world'])
rahul-ramadas/leetcode
refs/heads/master
search-a-2d-matrix-ii/Solution.36544532.py
1
class Solution: # @param {integer[][]} matrix # @param {integer} target # @return {boolean} def searchMatrix(self, matrix, target): for row in matrix: if target in row: return True return False
Yannig/ansible
refs/heads/devel
lib/ansible/modules/cloud/cloudstack/cs_zone_facts.py
47
#!/usr/bin/python # -*- coding: utf-8 -*- # # (c) 2016, René Moser <mail@renemoser.net> # # 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 Lice...
huran2014/huran.github.io
refs/heads/master
wot_gateway/usr/lib/python2.7/urllib2.py
33
"""An extensible library for opening URLs using a variety of protocols The simplest way to use this module is to call the urlopen function, which accepts a string containing a URL or a Request object (described below). It opens the URL and returns the results as file-like object; the returned object has some extra me...
farrajota/dbcollection
refs/heads/master
dbcollection/datasets/__init__.py
2
""" This module contains scripts to download/process all datasets available in dbcollection. These scripts are self contained, meaning they can be imported and used to manually setup a dataset. """ from __future__ import print_function import os import h5py import numpy as np from dbcollection.utils.hdf5 import HDF...
beck/django
refs/heads/master
tests/bash_completion/tests.py
327
""" A series of tests to establish that the command-line bash completion works. """ import os import sys import unittest from django.apps import apps from django.core.management import ManagementUtility from django.test.utils import captured_stdout class BashCompletionTests(unittest.TestCase): """ Testing th...
azureplus/hue
refs/heads/master
desktop/core/ext-py/PyYAML-3.09/tests/lib3/test_mark.py
62
import yaml def test_marks(marks_filename, verbose=False): inputs = open(marks_filename, 'r').read().split('---\n')[1:] for input in inputs: index = 0 line = 0 column = 0 while input[index] != '*': if input[index] == '\n': line += 1 c...
davidyezsetz/kuma
refs/heads/master
vendor/packages/pyparsing/examples/parseListString.py
16
# parseListString.py # # Copyright, 2006, by Paul McGuire # from pyparsing import * # first pass lbrack = Literal("[") rbrack = Literal("]") integer = Word(nums).setName("integer") real = Combine(Optional(oneOf("+ -")) + Word(nums) + "." + Optional(Word(nums))).setName("real") listItem =...
liqd/adhocracy
refs/heads/develop
src/adhocracy/model/user.py
4
from copy import copy import hashlib import os import logging from datetime import datetime from babel import Locale from pylons.i18n import _ from sqlalchemy import Table, Column, func, or_ from sqlalchemy import Boolean, DateTime, Integer, Unicode, UnicodeText from sqlalchemy.orm import eagerload_all from adhocrac...
tobspr/panda3d
refs/heads/master
direct/src/p3d/Packager.py
5
""" This module is used to build a "Package", a collection of files within a Panda3D Multifile, which can be easily be downloaded and/or patched onto a client machine, for the purpose of running a large application. """ __all__ = ["Packager", "PackagerError", "OutsideOfPackageError", "ArgumentError"] # Important to i...
axsauze/eventsfinder
refs/heads/master
django/core/mail/backends/locmem.py
227
""" Backend for test environment. """ from django.core import mail from django.core.mail.backends.base import BaseEmailBackend class EmailBackend(BaseEmailBackend): """A email backend for use during test sessions. The test connection stores email messages in a dummy outbox, rather than sending them out o...
ashwinreddy/rlg
refs/heads/master
test.py
1
import argparse import logging import sys import gym from gym import wrappers class RandomAgent(object): """The world's simplest agent!""" def __init__(self, action_space): self.action_space = action_space def act(self, observation, reward, done): return self.action_space.sample() if __...
Johnzero/OE7
refs/heads/master
openerp/report/render/rml2pdf/color.py
443
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the...