repo_name stringlengths 5 100 | ref stringlengths 12 67 | path stringlengths 4 244 | copies stringlengths 1 8 | content stringlengths 0 1.05M ⌀ |
|---|---|---|---|---|
akurtakov/Pydev | refs/heads/master | plugins/org.python.pydev.jython/Lib/_google_ipaddr_r234.py | 28 | #!/usr/bin/python
#
# Copyright 2007 Google Inc.
# Licensed to PSF under a Contributor Agreement.
#
# 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/lice... |
jessstrap/servotk | refs/heads/master | tests/wpt/web-platform-tests/tools/pywebsocket/src/test/mock.py | 465 | # Copyright 2011, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... |
thenenadx/forseti-security | refs/heads/master | tests/scanner/audit/cloudsql_rules_engine_test.py | 2 | # Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... |
atlab/attorch | refs/heads/master | attorch/dataloaders.py | 3 | from torch.utils.data.sampler import Sampler
import numpy as np
class RepeatsBatchSampler(Sampler):
def __init__(self, keys, subset_index=None):
if subset_index is None:
subset_index = np.arange(len(keys))
_, inv = np.unique(keys[subset_index], return_inverse=True)
self.repeat... |
BerkeleyAutomation/rlpy | refs/heads/master | rlpy/Domains/PacmanPackage/graphicsUtils.py | 4 | # graphicsUtils.py
# ----------------
# Licensing Information: Please do not distribute or publish solutions to this
# project. You are free to use and extend these projects for educational
# purposes. The Pacman AI projects were developed at UC Berkeley, primarily by
# John DeNero (denero@cs.berkeley.edu) and Dan Klei... |
genialis/resolwe-bio | refs/heads/master | resolwe_bio/tests/processes/test_wgs.py | 1 | from pathlib import Path
from resolwe.flow.models import Process
from resolwe.test import tag_process
from resolwe_bio.utils.filter import filter_vcf_variable
from resolwe_bio.utils.test import BioProcessTestCase
class WgsProcessorTestCase(BioProcessTestCase):
@tag_process("wgs-preprocess")
def test_wgs_pre... |
suhussai/youtube-dl | refs/heads/master | youtube_dl/extractor/sina.py | 107 | # coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import (
compat_urllib_request,
compat_urllib_parse,
)
class SinaIE(InfoExtractor):
_VALID_URL = r'''(?x)https?://(.*?\.)?video\.sina\.com\.cn/
(
... |
alex8866/cinder | refs/heads/f22-patches | cinder/db/sqlalchemy/migrate_repo/versions/005_add_source_volume_column.py | 11 | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... |
MrReN/django-oscar | refs/heads/master | oscar/apps/shipping/models.py | 2 | from decimal import Decimal as D
from django.db import models
from django.utils.translation import ugettext_lazy as _
from oscar.core.utils import slugify
from oscar.apps.shipping import Scales
class ShippingMethod(models.Model):
# Fields from shipping.base.ShippingMethod must be added here manually.
code =... |
mchristopher/PokemonGo-DesktopMap | refs/heads/master | app/pylibs/shared/pgoapi/protos/POGOProtos/Enums/TutorialState_pb2.py | 16 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: POGOProtos/Enums/TutorialState.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf.internal import enum_type_wrapper
from google.protobuf import descriptor as _descriptor
from google.protob... |
fastai/courses | refs/heads/master | deeplearning2/torch_utils.py | 14 | import torch
from torch import optim, nn, FloatTensor as FT
import torch.nn.parallel
import torch.utils.data
from torch.backends import cudnn
from torchvision import datasets, transforms, utils as vutils
from torch.autograd import Variable
import operator
def unit_prefix(x, n=1):
for i in range(n): x = x.unsqueez... |
ChanduERP/odoo | refs/heads/8.0 | addons/stock/wizard/stock_transfer_details.py | 169 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-TODAY OpenERP S.A. <http://www.odoo.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of t... |
potatolondon/django-nonrel-1-4 | refs/heads/master | django/contrib/gis/gdal/layer.py | 401 | # Needed ctypes routines
from ctypes import c_double, byref
# Other GDAL imports.
from django.contrib.gis.gdal.base import GDALBase
from django.contrib.gis.gdal.envelope import Envelope, OGREnvelope
from django.contrib.gis.gdal.error import OGRException, OGRIndexError, SRSException
from django.contrib.gis.gdal.feature... |
TomasTomecek/trello-reporter | refs/heads/master | trello_reporter/charting/apps.py | 1 | from __future__ import unicode_literals
from django.apps import AppConfig
class HarvesterConfig(AppConfig):
name = 'harvester'
|
idem2lyon/persomov | refs/heads/master | libs/suds/xsd/doctor.py | 205 | # This program is free software; you can redistribute it and/or modify
# it under the terms of the (LGPL) GNU Lesser General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will ... |
tuxfux-hlp-notes/python-batches | refs/heads/master | archieves/batch-57/modules/sheets/lib/python2.7/site-packages/wheel/util.py | 345 | """Utility functions."""
import sys
import os
import base64
import json
import hashlib
try:
from collections import OrderedDict
except ImportError:
OrderedDict = dict
__all__ = ['urlsafe_b64encode', 'urlsafe_b64decode', 'utf8',
'to_json', 'from_json', 'matches_requirement']
def urlsafe_b64encode(d... |
hyperized/ansible | refs/heads/devel | lib/ansible/modules/storage/netapp/netapp_e_lun_mapping.py | 25 | #!/usr/bin/python
# (c) 2016, NetApp, 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',
'status': ['preview'],
... |
scripnichenko/nova | refs/heads/master | nova/ipv6/api.py | 69 | # Copyright (c) 2011 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... |
shawnadelic/shuup | refs/heads/master | shuup/utils/properties.py | 2 | # This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from shuup.core.pricing import Price, TaxfulPrice, TaxlessPrice
from shuup.utils.money import Money... |
lunafeng/django | refs/heads/master | tests/gis_tests/geo3d/tests.py | 199 | from __future__ import unicode_literals
import os
import re
from unittest import skipUnless
from django.contrib.gis.db.models import Extent3D, Union
from django.contrib.gis.db.models.functions import (
AsGeoJSON, AsKML, Length, Perimeter, Scale, Translate,
)
from django.contrib.gis.gdal import HAS_GDAL
from djang... |
siddhika1889/Pydev-Dependencies | refs/heads/master | pysrc/test_pydevd_reload/test_pydevd_reload.py | 53 | import os # @NoMove
import sys # @NoMove
sys.path.insert(0, os.path.realpath(os.path.abspath('..')))
import pydevd_reload
import tempfile
import unittest
SAMPLE_CODE = """
class C:
def foo(self):
return 0
@classmethod
def bar(cls):
return (0, 0)
@staticmethod
def stomp():
... |
3dfxsoftware/cbss-addons | refs/heads/master | openerp_voucher_calculate_amount-master/__init__.py | 2 | # -*- encoding: utf-8 -*-
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2014 Savoir-faire Linux
# (<http://www.savoirfairelinux.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# ... |
mahabs/nitro | refs/heads/master | nssrc/com/citrix/netscaler/nitro/resource/config/lb/lbvserver_appflowpolicy_binding.py | 1 | #
# Copyright (c) 2008-2015 Citrix Systems, 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 l... |
rob356/SickRage | refs/heads/master | autoProcessTV/lib/requests/packages/urllib3/packages/six.py | 2374 | """Utilities for writing code that runs on Python 2 and 3"""
#Copyright (c) 2010-2011 Benjamin Peterson
#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 l... |
fly19890211/edx-platform | refs/heads/master | cms/lib/xblock/test/test_authoring_mixin.py | 105 | """
Tests for the Studio authoring XBlock mixin.
"""
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
from xmodule.partitions.partitions import Group, UserPartition
class AuthoringMixinTestCase(ModuleStoreTestCase):
... |
proxysh/Safejumper-for-Mac | refs/heads/master | buildlinux/env32/local/lib/python2.7/encodings/cp500.py | 593 | """ Python Character Mapping Codec cp500 generated from 'MAPPINGS/VENDORS/MICSFT/EBCDIC/CP500.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,input... |
indictranstech/phrerp | refs/heads/develop | erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py | 24 | # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import unittest
import frappe
import frappe.defaults
from frappe.utils import cint
class TestPurchaseReceipt(unittest.TestCase):
def test_make_pur... |
qedsoftware/commcare-hq | refs/heads/master | testapps/test_pillowtop/tests/test_group_pillow.py | 1 | import uuid
from django.test import TestCase
from corehq.apps.change_feed import data_sources
from corehq.apps.change_feed.document_types import GROUP, change_meta_from_doc
from corehq.apps.change_feed.producer import producer
from corehq.apps.change_feed.topics import get_topic_offset
from corehq.apps.es import GroupE... |
stwunsch/gnuradio | refs/heads/master | gr-digital/examples/ofdm/tunnel.py | 38 | #!/usr/bin/env python
#
# Copyright 2005,2006,2011 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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, or (at you... |
defance/edx-platform | refs/heads/master | lms/djangoapps/lti_provider/urls.py | 134 | """
LTI Provider API endpoint urls.
"""
from django.conf import settings
from django.conf.urls import patterns, url
urlpatterns = patterns(
'',
url(
r'^courses/{course_id}/{usage_id}$'.format(
course_id=settings.COURSE_ID_PATTERN,
usage_id=settings.USAGE_ID_PATTERN
),
... |
paulvangentcom/heartrate_analysis_python | refs/heads/master | docs/conf.py | 1 | # -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ------------------------------------------------------------... |
Ayub-Khan/edx-platform | refs/heads/master | common/djangoapps/config_models/admin.py | 26 | """
Admin site models for managing :class:`.ConfigurationModel` subclasses
"""
from django.forms import models
from django.contrib import admin
from django.contrib.admin import ListFilter
from django.core.cache import caches, InvalidCacheBackendError
from django.core.urlresolvers import reverse
from django.http import... |
mweisman/QGIS | refs/heads/master | python/plugins/processing/parameters/ParameterSelection.py | 6 | # -*- coding: utf-8 -*-
"""
***************************************************************************
ParameterSelection.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
********************... |
klahnakoski/ActiveData | refs/heads/dev | vendor/jx_elasticsearch/es52/expressions/not_op.py | 1 | # encoding: utf-8
#
#
# 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/.
#
# Contact: Kyle Lahnakoski (kyle@lahnakoski.com)
#
from __future__ import absolute_import, divisi... |
blakfeld/ansible-modules-extras | refs/heads/devel | cloud/misc/ovirt.py | 20 | #!/usr/bin/python
# (c) 2013, Vincent Van der Kussen <vincent at vanderkussen.org>
#
# 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,... |
d3trax/asuswrt-merlin | refs/heads/master | release/src/router/samba-3.5.8/source4/heimdal/lib/wind/rfc3454.py | 22 | #!/usr/local/bin/python
# -*- coding: iso-8859-1 -*-
# $Id: rfc3454.py,v 1.1.1.1 2011/06/10 09:34:42 andrew Exp $
# Copyright (c) 2004 Kungliga Tekniska Högskolan
# (Royal Institute of Technology, Stockholm, Sweden).
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# m... |
jborean93/ansible | refs/heads/devel | test/lib/ansible_test/_data/sanity/code-smell/replace-urlopen.py | 68 | #!/usr/bin/env python
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import re
import sys
def main():
for path in sys.argv[1:] or sys.stdin.read().splitlines():
with open(path, 'r') as path_fd:
for line, text in enumerate(path_fd.readlines()):
... |
prometheanfire/cloud-init | refs/heads/gentoo-integration | cloudinit/config/cc_disk_setup.py | 2 | # vi: ts=4 expandtab
#
# Copyright (C) 2009-2010 Canonical Ltd.
# Copyright (C) 2012 Hewlett-Packard Development Company, L.P.
#
# Author: Ben Howard <ben.howard@canonical.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License ... |
GenericStudent/home-assistant | refs/heads/dev | homeassistant/components/opentherm_gw/sensor.py | 12 | """Support for OpenTherm Gateway sensors."""
import logging
from homeassistant.components.sensor import ENTITY_ID_FORMAT
from homeassistant.const import CONF_ID
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity import Entity,... |
blademainer/intellij-community | refs/heads/master | python/testData/optimizeImports/suppressed.py | 166 | #noinspection PyUnresolvedReferences
import sys
|
wrlkyle/cuda-convnet2 | refs/heads/master | shownet.py | 180 | # Copyright 2014 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
paukenba/youtube-dl | refs/heads/master | youtube_dl/extractor/adobetv.py | 96 | from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
parse_duration,
unified_strdate,
str_to_int,
float_or_none,
ISO639Utils,
)
class AdobeTVIE(InfoExtractor):
_VALID_URL = r'https?://tv\.adobe\.com/watch/[^/]+/(?P<id>[^/]+)'
_TEST = {
'... |
nitrogen-os-devices/nitrogen_kernel_lge_hammerhead | refs/heads/n2 | 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... |
Arcanemagus/plexpy | refs/heads/master | lib/oauthlib/oauth2/rfc6749/clients/web_application.py | 86 | # -*- coding: utf-8 -*-
"""
oauthlib.oauth2.rfc6749
~~~~~~~~~~~~~~~~~~~~~~~
This module is an implementation of various logic needed
for consuming and providing OAuth 2.0 RFC6749.
"""
from __future__ import absolute_import, unicode_literals
from .base import Client
from ..parameters import prepare_grant_uri, prepare_... |
mikerofone/lcdproc-rhythmbox | refs/heads/master | lcdproc-plugin/lcdproc_config_dialog.py | 1 | # -*- coding: utf-8 -*-
# Copyright (c) 2011 Nikolai Knopp <mike_rofone at imail.de>
# Was adapted from JamendoConfigureDialog.py
#
# Copyright (C) 2007 - Guillaume Desmottes
#
# 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
... |
razvanphp/arangodb | refs/heads/devel | 3rdParty/V8-3.31.74.1/build/gyp/test/rules/gyptest-input-root.py | 350 | #!/usr/bin/env python
# Copyright (c) 2011 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.
"""
Verifies that RULE_INPUT_ROOT isn't turned into a path in rule actions
"""
import TestGyp
test = TestGyp.TestGyp()
test.run_gyp('inpu... |
tcwicklund/django | refs/heads/master | django/contrib/gis/db/backends/postgis/adapter.py | 373 | """
This object provides quoting for GEOS geometries into PostgreSQL/PostGIS.
"""
from __future__ import unicode_literals
from psycopg2 import Binary
from psycopg2.extensions import ISQLQuote
class PostGISAdapter(object):
def __init__(self, geom, geography=False):
"Initializes on the geometry."
... |
mlperf/training_results_v0.7 | refs/heads/master | Fujitsu/benchmarks/resnet/implementations/implementation_open/mxnet/3rdparty/tvm/tests/python/unittest/test_arith_deduce_bound.py | 1 | # 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... |
OCA/server-tools | refs/heads/12.0 | base_kanban_stage/tests/__init__.py | 2 | # Copyright 2016 LasLabs Inc.
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
from . import test_base_kanban_abstract
from . import test_base_kanban_stage
|
naousse/odoo | refs/heads/8.0 | addons/l10n_nl/__init__.py | 424 | # -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2009 Veritos - Jan Verlaan - www.veritos.nl
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# con... |
dulems/hue | refs/heads/master | desktop/core/ext-py/Django-1.6.10/django/contrib/admin/filters.py | 101 | """
This encapsulates the logic for displaying filters in the Django admin.
Filters are specified in models with the "list_filter" option.
Each filter subclass knows how to display a filter for a field that passes a
certain test -- e.g. being a DateField or ForeignKey.
"""
import datetime
from django.db import models... |
zenefits/sentry | refs/heads/master | src/sentry/south_migrations/0277_auto__add_commitfilechange__add_unique_commitfilechange_commit_filenam.py | 4 | # -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'CommitFileChange'
db.create_table('sentry_commitfilechang... |
ohjimijimijimi/convert_tracks | refs/heads/master | term.py | 1 | import curses
class Colors:
_fg = {}
_bg = {}
def __init__(self):
curses.setupterm()
self._init_fg()
self._init_bg()
def _init_fg(self):
self._fg = {
'black': curses.tparm(curses.tigetstr('setaf'), 0),
'red': curses.tparm(curses.tigetstr('setaf'), 1),
'green': curses.tparm(curses.tigetstr('... |
bonitadecker77/python-for-android | refs/heads/master | python-modules/twisted/twisted/names/dns.py | 49 | # -*- test-case-name: twisted.names.test.test_dns -*-
# Copyright (c) 2001-2010 Twisted Matrix Laboratories.
# See LICENSE for details.
"""
DNS protocol implementation.
Future Plans:
- Get rid of some toplevels, maybe.
@author: Moshe Zadka
@author: Jean-Paul Calderone
"""
__all__ = [
'IEncodable', 'IRecord'... |
galtay/hcc_risk_models | refs/heads/master | hcc_risk_models/examples_requests.py | 1 | import json
import requests
base_url = 'https://galtay.pythonanywhere.com/hcc_risk_models/api/v1.0/models'
url = base_url
print('url: ', url)
result_models = requests.get(url)
print('result_models: ', json.dumps(result_models.json(), indent=2))
print()
model = 'V2217_79_O1'
url = '{}/{}'.format(base_url, model)
prin... |
betoesquivel/fil2014 | refs/heads/master | filenv/lib/python2.7/site-packages/whoosh/lang/snowball/romanian.py | 73 | from .bases import _StandardStemmer
from whoosh.compat import u
class RomanianStemmer(_StandardStemmer):
"""
The Romanian Snowball stemmer.
:cvar __vowels: The Romanian vowels.
:type __vowels: unicode
:cvar __step0_suffixes: Suffixes to be deleted in step 0 of the algorithm.
:type __step0_s... |
zbanga/ibpy | refs/heads/master | ib/opt/dispatcher.py | 3 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
##
# Defines Dispatcher class to send messages to registered listeners.
#
##
from Queue import Queue, Empty
from ib.lib import maybeName, logger
from ib.opt import message
class Dispatcher(object):
"""
"""
def __init__(self, listeners=None, messageTypes=Non... |
n1bor/bitcoin | refs/heads/master | test/functional/feature_proxy.py | 10 | #!/usr/bin/env python3
# Copyright (c) 2015-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 bitcoind with different proxy configuration.
Test plan:
- Start bitcoind's with different proxy c... |
xuxiao19910803/edx | refs/heads/master | common/lib/calc/calc/tests/test_preview.py | 257 | # -*- coding: utf-8 -*-
"""
Unit tests for preview.py
"""
import unittest
from calc import preview
import pyparsing
class LatexRenderedTest(unittest.TestCase):
"""
Test the initializing code for LatexRendered.
Specifically that it stores the correct data and handles parens well.
"""
def test_sim... |
hbrunn/OCB | refs/heads/8.0 | addons/google_drive/google_drive.py | 98 | ##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2012 OpenERP SA (<http://www.openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General... |
samueldotj/TeeRISC-Simulator | refs/heads/master | src/arch/x86/isa/insts/simd64/integer/arithmetic/addition.py | 91 | # Copyright (c) 2007 The Hewlett-Packard Development Company
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implemen... |
frdavid1/agar-project | refs/heads/master | node_modules/utf8/tests/generate-test-data.py | 1788 | #!/usr/bin/env python
import re
import json
# https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
# http://stackoverflow.com/a/13436167/96656
def unisymbol(codePoint):
if codePoint >= 0x0000 and codePoint <= 0xFFFF:
return unichr(codePoint)
elif codePoint >= 0x010000 and codePoint <= 0x10FFFF:
... |
skyduy/zfverify | refs/heads/master | Verify-Manual-python/train/core/lrCostFunction.py | 1 | # coding: utf-8
from numpy import log, sum
from numpy import array, matrix
from sigmoid import sigmoid
def lrCostFunction(theta, *args):
theta = matrix(theta).transpose()
X, y, the_lambda = args
m = y.shape[0]
htheta = sigmoid(X*theta)
J = -sum(array(y)*array(log(htheta)) + array((1-y))*array(log... |
cloudformdesign/micropython | refs/heads/master | tests/pyb/can.py | 18 | from pyb import CAN
import pyb
# test we can correctly create by id or name
for bus in (-1, 0, 1, 2, 3, "YA", "YB", "YC"):
try:
CAN(bus, CAN.LOOPBACK)
print("CAN", bus)
except ValueError:
print("ValueError", bus)
CAN.initfilterbanks(14)
can = CAN(1)
print(can)
can.init(CAN.LOOPBACK)
p... |
bokeh/bokeh | refs/heads/branch-2.4 | sphinx/source/docs/user_guide/examples/interaction_slider.py | 1 | from bokeh.io import show
from bokeh.models import CustomJS, Slider
slider = Slider(start=0, end=10, value=1, step=.1, title="Stuff")
slider.js_on_change("value", CustomJS(code="""
console.log('slider: value=' + this.value, this.toString())
"""))
show(slider)
|
tdr130/sulley | refs/heads/master | sulley/legos/ber.py | 15 | ########################################################################################################################
### ASN.1 / BER TYPES (http://luca.ntop.org/Teaching/Appunti/asn1.html)
########################################################################################################################
impor... |
tossp/lede-k3 | refs/heads/master | scripts/sercomm-crypto.py | 27 | #!/usr/bin/env python3
import argparse
import binascii
import hashlib
import os
import struct
def create_header(key, version, iv, random, size):
header = struct.pack('32s32s32s32s32s', key, version, iv, random, size)
return header
def create_output(args):
in_st = os.stat(args.input_file)
in_size = in_st.st_size... |
sunlianqiang/kbengine | refs/heads/master | kbe/src/lib/python/Lib/test/test_cmd.py | 74 | """
Test script for the 'cmd' module
Original by Michael Schneider
"""
import cmd
import sys
import re
import unittest
import io
from test import support
class samplecmdclass(cmd.Cmd):
"""
Instance the sampleclass:
>>> mycmd = samplecmdclass()
Test for the function parseline():
>>> mycmd.parseli... |
jeppeter/drizzlebr | refs/heads/master | tests/lib/server_mgmt/drizzled.py | 4 | #! /usr/bin/env python
# -*- mode: python; indent-tabs-mode: nil; -*-
# vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
#
# Copyright (C) 2010,2011 Patrick Crews
#
# 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 Soft... |
shepdelacreme/ansible | refs/heads/devel | lib/ansible/modules/storage/netapp/netapp_e_global.py | 25 | #!/usr/bin/python
# (c) 2018, NetApp, 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',
'status': ['preview'],
... |
grlee77/nipype | refs/heads/master | nipype/interfaces/mrtrix/tests/test_auto_GenerateWhiteMatterMask.py | 9 | # AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from nipype.testing import assert_equal
from nipype.interfaces.mrtrix.preprocess import GenerateWhiteMatterMask
def test_GenerateWhiteMatterMask_inputs():
input_map = dict(args=dict(argstr='%s',
),
binary_mask=dict(argstr='%s',
mandatory=True,
p... |
kisel/trex-core | refs/heads/master | scripts/external_libs/pyzmq-14.5.0/python2/ucs2/32bit/zmq/utils/constant_names.py | 19 | """0MQ Constant names"""
# Copyright (C) PyZMQ Developers
# Distributed under the terms of the Modified BSD License.
# dictionaries of constants new or removed in particular versions
new_in = {
(2,2,0) : [
'RCVTIMEO',
'SNDTIMEO',
],
(3,2,2) : [
# errnos
'EMSGSIZE',
... |
JamesMura/sentry | refs/heads/master | tests/sentry/api/serializers/test_user.py | 4 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
import six
from sentry.api.serializers import serialize
from sentry.testutils import TestCase
from sentry.models import Authenticator, UserEmail
from sentry.models.authenticator import available_authenticators
class UserSerializerTest(TestCase):
de... |
Dino0631/RedRain-Bot | refs/heads/develop | lib/youtube_dl/extractor/wdr.py | 31 | # coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
determine_ext,
ExtractorError,
js_to_json,
strip_jsonp,
unified_strdate,
update_url_query,
urlhandle_detect_ext,
)
class WDRBaseIE(InfoExtractor):
def _extract_wd... |
piksels-and-lines-orchestra/inkscape | refs/heads/master | share/extensions/Barcode/UPCA.py | 3 | #
# Copyright (C) 2007 Martin Owens
#
# 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.
#
# This program is distributed in... |
VagrantApe/flaskMicroblog | refs/heads/master | venv/lib/python2.7/site-packages/tempita/_looper.py | 140 | """
Helper for looping over sequences, particular in templates.
Often in a loop in a template it's handy to know what's next up,
previously up, if this is the first or last item in the sequence, etc.
These can be awkward to manage in a normal Python loop, but using the
looper you can get a better sense of the context.... |
barseghyanartur/oauthlib | refs/heads/master | tests/oauth2/rfc6749/grant_types/test_refresh_token.py | 24 | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from ....unittest import TestCase
import json
import mock
from oauthlib.common import Request
from oauthlib.oauth2.rfc6749.grant_types import RefreshTokenGrant
from oauthlib.oauth2.rfc6749.tokens import BearerToken
from oauthlib.oauth2.rf... |
ingokegel/intellij-community | refs/heads/master | python/testData/codeInsight/smartEnter/multilineSetLiteral.py | 10 | xs = {
1<caret>
} |
nkhuyu/SFrame | refs/heads/master | oss_src/unity/python/sframe/version_info.py | 8 | '''
Copyright (C) 2015 Dato, Inc.
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
'''
# python egg version
__VERSION__ = '{{VERSION_STRING}}'
version = '{{VERSION_STRING}}'
|
ostcar/OpenSlides | refs/heads/master | server/openslides/mediafiles/management/commands/export_mediafiles.py | 7 | import mimetypes
from typing import cast
from django.core.management.base import BaseCommand
from openslides.mediafiles.models import Mediafile
class Command(BaseCommand):
help = "Exports all mediafiles for the external media service."
def add_arguments(self, parser):
parser.add_argument(
... |
tstieven/amiunique | refs/heads/master | website/venv/lib/python2.7/genericpath.py | 4 | /usr/lib/python2.7/genericpath.py |
sosguns2002/interactive-mining | refs/heads/master | interactive-mining-3rdparty-madis/madis/src/lib/pyreadline/lineeditor/wordmatcher.py | 10 | # -*- coding: utf-8 -*-
#*****************************************************************************
# Copyright (C) 2006 Jorgen Stenarson. <jorgen.stenarson@bostream.nu>
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this software.
#***... |
marcelocure/django | refs/heads/master | tests/empty/models.py | 542 | """
Empty model tests
These test that things behave sensibly for the rare corner-case of a model with
no fields.
"""
from django.db import models
class Empty(models.Model):
pass
|
waseem18/oh-mainline | refs/heads/master | vendor/packages/Django/tests/regressiontests/views/generic_urls.py | 44 | # -*- coding:utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django.conf.urls import patterns, url
from django.views.generic import RedirectView
from . import views
from .models import Article, DateArticle, UrlArticle
date_based_info_dict = {
'queryset': Article.objects.all(),
'date_... |
fintech-circle/edx-platform | refs/heads/master | common/test/acceptance/tests/lms/test_lms_split_test_courseware_search.py | 1 | """
Test courseware search
"""
import json
from nose.plugins.attrib import attr
from common.test.acceptance.fixtures.course import XBlockFixtureDesc
from common.test.acceptance.pages.common.auto_auth import AutoAuthPage
from common.test.acceptance.pages.common.logout import LogoutPage
from common.test.acceptance.pag... |
ahmadio/edx-platform | refs/heads/master | common/djangoapps/student/migrations/0039_auto__del_courseregistrationcode.py | 114 | # -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting model 'CourseRegistrationCode'
db.delete_table('student_courseregistrationcode')
def backwa... |
Beauhurst/django | refs/heads/master | tests/null_fk_ordering/tests.py | 133 | from django.test import TestCase
from .models import Article, Author, Comment, Forum, Post, SystemInfo
class NullFkOrderingTests(TestCase):
def test_ordering_across_null_fk(self):
"""
Regression test for #7512
ordering across nullable Foreign Keys shouldn't exclude results
"""
... |
iLoop2/ResInsight | refs/heads/dev | ThirdParty/Ert/devel/python/python/ert/enkf/enums/enkf_run_enum.py | 1 | # Copyright (C) 2013 Statoil ASA, Norway.
#
# The file 'content_type_enum.py' is part of ERT - Ensemble based Reservoir Tool.
#
# ERT 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 t... |
procangroup/edx-platform | refs/heads/master | common/djangoapps/student/migrations/0010_auto_20170207_0458.py | 24 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('student', '0009_auto_20170111_0422'),
]
# This migration was to add a constraint that we lost in the Django
# 1.4->1.8 upgrade. ... |
UWPCE-PythonCert/IntroPython2016 | refs/heads/master | students/jbearer/session02/lpthw_ex13-3.py | 3 | from sys import argv
script, name, age = argv
print("The script is called:", script)
print("Your first name is:", name)
print("Your age is:", age)
weight = input("Weight: ")
height = input("Height: ")
print("Weight: %r \n Height: %r " % (weight, height)) |
mganeva/mantid | refs/heads/master | scripts/test/SANS/state/state_functions_test.py | 1 | # Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
# NScD Oak Ridge National Laboratory, European Spallation Source
# & Institut Laue - Langevin
# SPDX - License - Identifier: GPL - 3.0 +
from __future__ import (absolute_import, divi... |
davidcusatis/horizon | refs/heads/master | openstack_dashboard/contrib/developer/tests.py | 22 | # Copyright 2015 Cisco Systems, 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... |
KanoComputing/kano-settings | refs/heads/master | kano_wifi_gui/misc.py | 1 | #
# misc.py
#
# Copyright (C) 2014 - 2018 Kano Computing Ltd.
# License: http://www.gnu.org/licenses/gpl-2.0.txt GNU GPLv2
#
# Miscellaneous functions
#
import os
from gi import require_version
require_version('Gtk', '3.0')
from gi.repository import Gtk, GdkPixbuf
from kano.paths import common_images_dir
def tick... |
f3r/scikit-learn | refs/heads/master | sklearn/manifold/isomap.py | 229 | """Isomap for manifold learning"""
# Author: Jake Vanderplas -- <vanderplas@astro.washington.edu>
# License: BSD 3 clause (C) 2011
import numpy as np
from ..base import BaseEstimator, TransformerMixin
from ..neighbors import NearestNeighbors, kneighbors_graph
from ..utils import check_array
from ..utils.graph import... |
iDTLabssl/hr | refs/heads/8.0 | hr_unported/hr_job_hierarchy/__openerp__.py | 1 | # -*- 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... |
SUSE/azure-sdk-for-python | refs/heads/master | azure-mgmt-commerce/azure/mgmt/commerce/operations/usage_aggregates_operations.py | 2 | # 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 ... |
qiankunshe/sky_engine | refs/heads/master | build/android/adb_logcat_printer.py | 69 | #!/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.
"""Shutdown adb_logcat_monitor and print accumulated logs.
To test, call './adb_logcat_printer.py <base_dir>' where
<base_dir> c... |
JamesGuthrie/libcloud | refs/heads/trunk | docs/examples/compute/ec2/create_provisioned_iops_volume.py | 50 | from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver
cls = get_driver(Provider.EC2, region='us-east-i1')
driver = cls('access key', 'secret key')
volume = driver.create_volume(size=100, name='Test IOPS volume',
ex_volume_type='io1', ex_iops=1000)
|
defionscode/ansible | refs/heads/devel | lib/ansible/modules/remote_management/manageiq/manageiq_policies.py | 64 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, Daniel Korn <korndaniel1@gmail.com>
# (c) 2017, Yaacov Zamir <yzamir@redhat.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANS... |
veger/ansible | refs/heads/devel | lib/ansible/module_utils/facts/system/cmdline.py | 137 | # 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 in the hope that ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.