repo_name stringlengths 5 100 | ref stringlengths 12 67 | path stringlengths 4 244 | copies stringlengths 1 8 | content stringlengths 0 1.05M ⌀ |
|---|---|---|---|---|
linjoahow/2015cdaa-w11 | refs/heads/master | static/Brython3.1.1-20150328-091302/Lib/site-packages/spur.py | 184 | #coding: utf-8
import math
# 導入數學函式後, 圓周率為 pi
# deg 為角度轉為徑度的轉換因子
deg = math.pi/180.
class Spur(object):
def __init__(self, ctx):
self.ctx = ctx
def create_line(self, x1, y1, x2, y2, width=3, fill="red"):
self.ctx.beginPath()
self.ctx.lineWidth = width
self.ctx.moveTo(x1, y1)
... |
elainenaomi/sciwonc-dataflow-examples | refs/heads/master | sbbd2016/experiments/1-postgres/3_workflow_full_10files_primary_nosh_nors_annot_with_proj_3s/pegasus.bDkvI/pegasus-4.6.0/lib/pegasus/externals/python/boto/dynamodb2/results.py | 135 | class ResultSet(object):
"""
A class used to lazily handle page-to-page navigation through a set of
results.
It presents a transparent iterator interface, so that all the user has
to do is use it in a typical ``for`` loop (or list comprehension, etc.)
to fetch results, even if they weren't pres... |
rudhir-upretee/Sumo_With_Netsim | refs/heads/master | tools/net/reprojectpolys.py | 3 | #!/usr/bin/env python
"""
@file reprojectpolys.py
@author Daniel Krajzewicz
@author Michael Behrisch
@date 2008-03-27
@version $Id: reprojectpolys.py 11671 2012-01-07 20:14:30Z behrisch $
This script computes projection needed to make net2 (-2) fit
to net1 (-1). The read polygons (-p) are then reprojected
us... |
acmeyer/voteid | refs/heads/master | client/jsonrpc/_tests/__init__.py | 53 |
"""
Copyright (c) 2007 Jan-Klaas Kollhof
This file is part of jsonrpc.
jsonrpc is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later... |
arista-eosplus/ansible | refs/heads/devel | lib/ansible/modules/cloud/ovirt/ovirt_storage_domains.py | 16 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 Red Hat, Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
#... |
andreya108/bindu-kernel-base | refs/heads/master | 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 ... |
y12uc231/edx-platform | refs/heads/master | cms/startup.py | 88 | """
Module with code executed during Studio startup
"""
from django.conf import settings
# Force settings to run so that the python path is modified
settings.INSTALLED_APPS # pylint: disable=pointless-statement
from openedx.core.lib.django_startup import autostartup
from monkey_patch import django_utils_translation... |
planetarypy/pdsspect | refs/heads/master | tests/test_pds_image_view_canvas.py | 1 | import pytest
from pdsspect.pds_image_view_canvas import PDSImageViewCanvas, ImageViewCanvas
def test_add_subview():
view = PDSImageViewCanvas()
subview1 = PDSImageViewCanvas()
view.add_subview(subview1)
assert subview1 in view._subviews
subview2 = ImageViewCanvas()
view.add_subview(subview2)... |
WilsonWangTHU/clothesDetection | refs/heads/master | caffe-fast-rcnn/python/caffe/pycaffe.py | 9 | """
Wrap the internal caffe C++ module (_caffe.so) with a clean, Pythonic
interface.
"""
from collections import OrderedDict
try:
from itertools import izip_longest
except:
from itertools import zip_longest as izip_longest
import numpy as np
from ._caffe import Net, SGDSolver
import caffe.io
# We directly update m... |
rakeshmi/cinder | refs/heads/master | cinder/db/sqlalchemy/migrate_repo/versions/019_add_migration_status.py | 45 | # Copyright 2013 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 agree... |
stefano-martina/tests | refs/heads/master | python/vtkTetrahedron.py | 2 | #!/bin/python
import vtk
import vtk.util.colors
points = vtk.vtkPoints()
points.InsertNextPoint(0, 0, 0)
points.InsertNextPoint(0, 1, 0)
points.InsertNextPoint(1, 0, 0)
points.InsertNextPoint(0, 0, 1)
unstructuredGrid = vtk.vtkUnstructuredGrid()
unstructuredGrid.SetPoints(points)
unstructuredGrid.InsertNextCell(vtk.... |
ojengwa/oh-mainline | refs/heads/master | vendor/packages/Django/django/contrib/admin/templatetags/admin_list.py | 103 | from __future__ import unicode_literals
import datetime
from django.contrib.admin.util import (lookup_field, display_for_field,
display_for_value, label_for_field)
from django.contrib.admin.views.main import (ALL_VAR, EMPTY_CHANGELIST_VALUE,
ORDER_VAR, PAGE_VAR, SEARCH_VAR)
from django.contrib.admin.templatet... |
highco-groupe/odoo | refs/heads/master | openerp/addons/base/tests/test_db_cursor.py | 175 | # -*- coding: utf-8 -*-
import unittest2
import openerp
from openerp.tools.misc import mute_logger
from openerp.tests import common
DB = common.DB
ADMIN_USER_ID = common.ADMIN_USER_ID
def registry():
return openerp.modules.registry.RegistryManager.get(DB)
class test_cr_execute(unittest2.TestCase):
""" Try... |
msarahan/psutil | refs/heads/master | docs/conf.py | 16 | # -*- coding: utf-8 -*-
#
# psutil documentation build configuration file, created by
# sphinx-quickstart.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have ... |
mdeemer/XlsxWriter | refs/heads/master | examples/chart_styles.py | 9 | #######################################################################
#
# An example showing all 48 default chart styles available in Excel 2007
# using Python and XlsxWriter. Note, these styles are not the same as
# the styles available in Excel 2013.
#
# Copyright 2013-2015, John McNamara, [email protected]
#
impo... |
jbedorf/tensorflow | refs/heads/master | tensorflow/contrib/gan/python/eval/python/eval_utils_impl.py | 73 | # Copyright 2017 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... |
yubinbai/leetcode | refs/heads/master | src/reverseWordsInString/solution.py | 2 | import re
class Solution:
# @param s, a string
# @return a string
def reverseWords(self, s):
return ' '.join(re.split('\s+', s)[::-1]).strip()
if __name__ == '__main__':
s = Solution()
print '___' + s.reverseWords('the sky is blue') + '___'
print '___' + s.reverseWords(' a b ') + '... |
ixiom/phantomjs | refs/heads/master | src/qt/qtwebkit/Tools/Scripts/webkitpy/tool/multicommandtool_unittest.py | 121 | # Copyright (c) 2009 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the... |
ClearCorp-dev/odoo | refs/heads/8.0 | openerp/conf/deprecation.py | 380 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2011 OpenERP s.a. (<http://openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the G... |
Eric89GXL/scipy | refs/heads/master | scipy/linalg/tests/test_sketches.py | 20 | """Tests for _sketches.py."""
from __future__ import division, print_function, absolute_import
import numpy as np
from scipy.linalg import clarkson_woodruff_transform
from numpy.testing import assert_
def make_random_dense_gaussian_matrix(n_rows, n_columns, mu=0, sigma=0.01):
"""
Make some random data with ... |
camallen/aggregation | refs/heads/master | experimental/old/logisticRegression.py | 2 | __author__ = 'greg'
import math
import numpy as np
def hypothesis(theta,X):
z = sum([t*x for t,x in zip(theta,X)])
return 1/(1. + math.exp(-z))
def cost(hypothesis_value,actual):
if actual == 1:
return -math.log(hypothesis_value)
else:
return -math.log(1.-hypothesis_value)
def cost... |
jrper/fluidity | refs/heads/master | tests/viscous_fs_zhong_spatial_explicit_varrho/calculate_order_zhong_spatial_explicit_varrho.py | 16 |
import solution
from fluidity_tools import stat_parser as stat
from math import log, sqrt
def report_convergence(file1, file2):
print file1, "->", file2
stat1 = stat(file1)
stat2 = stat(file2)
errortop_l2_1 = sqrt(stat1["Fluid"]["DifferenceSquared"]["surface_integral%TopSurfaceL2Norm"][-1])
errortop_l2_... |
Teamxrtc/webrtc-streaming-node | refs/heads/master | third_party/webrtc/src/chromium/src/build/get_landmines.py | 17 | #!/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.
"""
This file emits the list of reasons why a particular build needs to be clobbered
(or a list of 'landmines').
"""
import sys
impor... |
cldershem/osf.io | refs/heads/develop | website/addons/github/views/__init__.py | 30 | from . import auth, config, crud, hgrid, hooks, repos # noqa
|
BorisJeremic/Real-ESSI-Examples | refs/heads/master | analytic_solution/test_cases/Contact/Stress_Based_Contact_Verification/HardContact_NonLinHardShear/Normal_Load/Sigma_n_1e9/compare_txt.py | 637 | #!/usr/bin/python
import h5py
import sys
import numpy as np
import os
import re
import random
# find the path to my own python function:
cur_dir=os.getcwd()
sep='test_cases'
test_DIR=cur_dir.split(sep,1)[0]
scriptDIR=test_DIR+'compare_function'
sys.path.append(scriptDIR)
# import my own function for color and comparat... |
jtwhite79/pyemu | refs/heads/develop | autotest/smoother/chenoliver/template/chenoliver.py | 2 | import os
with open(os.path.join("par.dat"),'r') as f:
par = float(f.readline().strip())
result = ((7.0/12.0) * par**3) - ((7.0/2.0) * par**2) + (8.0 * par)
with open(os.path.join("obs.dat"),'w') as f:
f.write("{0:20.8E}\n".format(result)) |
felixbuenemann/sentry | refs/heads/master | src/sentry/rules/actions/base.py | 40 | """
sentry.rules.actions.base
~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import, print_function
from sentry.rules.base import RuleBase
class EventAction(RuleBase):
rule_ty... |
fenginx/django | refs/heads/master | tests/test_runner_apps/sample/tests_sample.py | 466 | import doctest
from unittest import TestCase
from django.test import SimpleTestCase, TestCase as DjangoTestCase
from . import doctests
class TestVanillaUnittest(TestCase):
def test_sample(self):
self.assertEqual(1, 1)
class TestDjangoTestCase(DjangoTestCase):
def test_sample(self):
self.... |
Livit/Livit.Learn.EdX | refs/heads/labster/develop | lms/djangoapps/mobile_api/mobile_platform.py | 54 | """
Platform related Operations for Mobile APP
"""
import abc
import re
class MobilePlatform:
"""
MobilePlatform class creates an instance of platform based on user agent and supports platform
related operations.
"""
__metaclass__ = abc.ABCMeta
version = None
def __init__(self, version):
... |
pratikmallya/hue | refs/heads/master | apps/beeswax/src/beeswax/server/__init__.py | 646 | #!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... |
Nu3001/external_chromium_org | refs/heads/master | third_party/tlslite/tlslite/__init__.py | 409 | """
TLS Lite is a free python library that implements SSL v3, TLS v1, and
TLS v1.1. TLS Lite supports non-traditional authentication methods
such as SRP, shared keys, and cryptoIDs, in addition to X.509
certificates. TLS Lite is pure python, however it can access OpenSSL,
cryptlib, pycrypto, and GMPY for faster crypt... |
CapOM/ChromiumGStreamerBackend | refs/heads/master | chrome/common/extensions/docs/server2/render_refresher.py | 37 | # Copyright 2014 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 posixpath
from custom_logger import CustomLogger
from extensions_paths import EXAMPLES
from file_system_util import CreateURLsFromPath... |
tarvitz/django-actions | refs/heads/master | django_actions/forms.py | 1 | # coding: utf-8
import sys
from django import forms
from django.http import Http404
from django.db.models.query import QuerySet
from django.utils.translation import ugettext_lazy as _
from django.core.exceptions import ObjectDoesNotExist
class ActionForm(forms.Form):
items = forms.ModelMultipleChoiceField(queryset... |
takeshineshiro/python-mode | refs/heads/develop | pymode/libs/pylint/config.py | 67 | # Copyright (c) 2003-2013 LOGILAB S.A. (Paris, FRANCE).
# 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... |
technologiescollege/s2a_fr | refs/heads/portable | s2a/Python/Lib/test/test_threaded_import.py | 137 | # This is a variant of the very old (early 90's) file
# Demo/threads/bug.py. It simply provokes a number of threads into
# trying to import the same module "at the same time".
# There are no pleasant failure modes -- most likely is that Python
# complains several times about module random having no attribute
# randran... |
BlaXpirit/swtg-map | refs/heads/master | qt/webkit.py | 2 | # Copyright (C) 2014 Oleh Prypin <[email protected]>
#
# This file is part of UniversalQt.
#
# UniversalQt 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 opt... |
ghtmtt/DataPlotly | refs/heads/master | DataPlotly/data_plotly.py | 1 | # -*- coding: utf-8 -*-
"""
/***************************************************************************
DataPlotly
A QGIS plugin
D3 Plots for QGIS
-------------------
begin : 2017-03-05
git sha : $Format:%H$
... |
GalaxyTab4/android_kernel_samsung_millet | refs/heads/millet | Documentation/target/tcm_mod_builder.py | 4981 | #!/usr/bin/python
# The TCM v4 multi-protocol fabric module generation script for drivers/target/$NEW_MOD
#
# Copyright (c) 2010 Rising Tide Systems
# Copyright (c) 2010 Linux-iSCSI.org
#
# Author: [email protected]
#
import os, sys
import subprocess as sub
import string
import re
import optparse
tcm_dir = ""
fabric_ops... |
apixandru/intellij-community | refs/heads/master | python/testData/resolve/GlobalDefinedLocally.py | 83 | def f():
global xx
xx = 1
f()
print(x<ref>x)
|
Lightmatter/django-inlineformfield | refs/heads/master | .tox/py27/lib/python2.7/site-packages/IPython/terminal/console/tests/test_console.py | 8 | """Tests for two-process terminal frontend
Currently only has the most simple test possible, starting a console and running
a single command.
Authors:
* Min RK
"""
#-----------------------------------------------------------------------------
# Imports
#--------------------------------------------------------------... |
David44144/Atom | refs/heads/master | contrib/devtools/update-translations.py | 54 | #!/usr/bin/python
# Copyright (c) 2014 Wladimir J. van der Laan
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
Run this script from the root of the repository to update all translations from
transifex.
It will do the follo... |
elena/django | refs/heads/master | tests/db_functions/math/test_asin.py | 57 | import math
from decimal import Decimal
from django.db.models import DecimalField
from django.db.models.functions import ASin
from django.test import TestCase
from django.test.utils import register_lookup
from ..models import DecimalModel, FloatModel, IntegerModel
class ASinTests(TestCase):
def test_null(self)... |
cjb/curveship | refs/heads/master | fiction/lost_one.py | 3 | """Lost One
A demo interactive fiction in Curveship, an IF development system by
Nick Montfort. Shows how narrative distance can be changed based on the
player character's actions."""
__author__ = 'Nick Montfort'
__copyright__ = 'Copyright 2011 Nick Montfort'
__license__ = 'ISC'
__version__ = '0.5.0.0'
__status__ = '... |
abridgett/boto | refs/heads/develop | tests/unit/machinelearning/test_machinelearning.py | 91 | # Copyright (c) 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights ... |
Suite5/DataColibri | refs/heads/master | allauth/socialaccount/providers/google/tests.py | 1 | from django.test.utils import override_settings
from allauth.socialaccount.tests import create_oauth2_tests
from allauth.account import app_settings as account_settings
from allauth.account.models import EmailConfirmation, EmailAddress
from allauth.socialaccount.providers import registry
from allauth.tests import Mock... |
talhajaved/nyuadmarket | refs/heads/master | flask/lib/python2.7/site-packages/setuptools/tests/contexts.py | 73 | import tempfile
import os
import shutil
import sys
import contextlib
import site
from ..compat import StringIO
@contextlib.contextmanager
def tempdir(cd=lambda dir:None, **kwargs):
temp_dir = tempfile.mkdtemp(**kwargs)
orig_dir = os.getcwd()
try:
cd(temp_dir)
yield temp_dir
finally:
... |
woobe/h2o | refs/heads/master | py/testdir_single_jvm_fvec/sum_1B.py | 11 | #!/usr/bin/python
# http://axialcorps.com/2013/09/27/dont-slurp-how-to-read-files-in-python/
# a simple filter that prepends line numbers
import sys
# this reads in one line at a time from stdin
s = 0.0
count = 0
for line in sys.stdin:
f = float(line)
s += f
count += 1
# print "%.13f %.13f" % (f, s)
pr... |
sabi0/intellij-community | refs/heads/master | python/testData/inspections/RenameUnresolvedReference_after.py | 83 |
def foo(y1):
y1 + 1
print y1
|
openstack/neutron | refs/heads/master | neutron/services/logapi/drivers/openvswitch/log_oskenapp.py | 2 | # Copyright (C) 2017 Fujitsu Limited
# 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 requi... |
mluke93/osf.io | refs/heads/develop | api_tests/nodes/views/test_node_embeds.py | 7 | from nose.tools import * # flake8: noqa
import functools
from framework.auth.core import Auth
from api.base.settings.defaults import API_BASE
from tests.base import ApiTestCase
from tests.factories import (
ProjectFactory,
AuthUserFactory
)
class TestNodeEmbeds(ApiTestCase):
def setUp(self):
su... |
procrastinatio/mapproxy | refs/heads/master | mapproxy/test/unit/test_seed_cachelock.py | 6 | # This file is part of the MapProxy project.
# Copyright (C) 2012 Omniscale <http://omniscale.de>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICEN... |
mbrukman/mapnik | refs/heads/master | scons/scons-local-2.3.6/SCons/Tool/hpc++.py | 4 | """SCons.Tool.hpc++
Tool-specific initialization for c++ on HP/UX.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001 - 2015 The SCons Foundation
#
# Permission is hereby granted, free of... |
raviflipsyde/servo | refs/heads/master | python/mach/mach/test/test_logger.py | 128 | # 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/.
from __future__ import absolute_import, unicode_literals
import logging
import time
import unittest
from mach.logging ... |
wfxiang08/django185 | refs/heads/master | django/db/models/sql/compiler.py | 26 | import re
import warnings
from itertools import chain
from django.core.exceptions import FieldError
from django.db.models.constants import LOOKUP_SEP
from django.db.models.expressions import OrderBy, Random, RawSQL, Ref
from django.db.models.query_utils import QueryWrapper, select_related_descend
from django.db.models... |
syphar/django | refs/heads/master | django/contrib/auth/signals.py | 165 | from django.dispatch import Signal
user_logged_in = Signal(providing_args=['request', 'user'])
user_login_failed = Signal(providing_args=['credentials', 'request'])
user_logged_out = Signal(providing_args=['request', 'user'])
|
naojsoft/ginga | refs/heads/master | ginga/mplw/transform.py | 3 | #
# transform.py -- a custom projection for supporting matplotlib plotting
# on ginga
#
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
#
# NOTE: this code is based on "custom_projection_example.py", an example
# script developed by ma... |
ssbarnea/ansible | refs/heads/devel | test/units/module_utils/basic/test_safe_eval.py | 35 | # -*- coding: utf-8 -*-
# (c) 2015-2017, Toshio Kuratomi <[email protected]>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from itertools import cha... |
gooddata/openstack-nova | refs/heads/master | nova/api/openstack/compute/wsgi.py | 10 | # 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... |
aptana/Pydev | refs/heads/development | bundles/org.python.pydev/pysrc/interpreterInfo.py | 1 | '''
This module was created to get information available in the interpreter, such as libraries,
paths, etc.
what is what:
sys.builtin_module_names: contains the builtin modules embeeded in python (rigth now, we specify all manually).
sys.prefix: A string giving the site-specific directory prefix where the platform ind... |
isandlaTech/cohorte-demos | refs/heads/dev | led/dump/led-demo-yun/cohorte/dist/cohorte-1.0.0-20141216.234517-57-python-distribution/repo/cohorte/vote/servlet.py | 4 | #!/usr/bin/env python
# -- Content-Encoding: UTF-8 --
"""
Voting system servlet: shows the charts made by the cartoonist
:author: Thomas Calmant
:license: Apache Software License 2.0
:version: 1.0.0
..
Copyright 2014 isandlaTech
Licensed under the Apache License, Version 2.0 (the "License");
you may not... |
cyanna/edx-platform | 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... |
krsjoseph/youtube-dl | refs/heads/master | youtube_dl/extractor/tvplay.py | 86 | # coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import compat_str
from ..utils import (
parse_iso8601,
qualities,
)
class TVPlayIE(InfoExtractor):
IE_DESC = 'TV3Play and related services'
_VALID_URL = r'''(?x)http://(?:www\.)?
... |
C1994/learn-python3 | refs/heads/master | samples/basic/do_while.py | 20 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 计算1+2+3+...+100:
sum = 0
n = 1
while n <= 100:
sum = sum + n
n = n + 1
print(sum)
# 计算1x2x3x...x100:
acc = 1
n = 1
while n <= 100:
acc = acc * n
n = n + 1
print(acc)
|
rynomster/django | refs/heads/master | tests/string_lookup/models.py | 281 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class Foo(models.Model):
name = models.CharField(max_length=50)
friend = models.CharField(max_length=50, blank=True)
def... |
rajendrakrp/GeoMicroFormat | refs/heads/master | django/db/models/sql/aggregates.py | 277 | """
Classes to represent the default SQL aggregate functions
"""
class AggregateField(object):
"""An internal field mockup used to identify aggregates in the
data-conversion parts of the database backend.
"""
def __init__(self, internal_type):
self.internal_type = internal_type
def get_int... |
mrquim/repository.mrquim | refs/heads/master | repo/script.module.unidecode/lib/unidecode/x06b.py | 252 | data = (
'Xiang ', # 0x00
'Nong ', # 0x01
'Bo ', # 0x02
'Chan ', # 0x03
'Lan ', # 0x04
'Ju ', # 0x05
'Shuang ', # 0x06
'She ', # 0x07
'Wei ', # 0x08
'Cong ', # 0x09
'Quan ', # 0x0a
'Qu ', # 0x0b
'Cang ', # 0x0c
'[?] ', # 0x0d
'Yu ', # 0x0e
'Luo ', # 0x0f
'Li ', # 0x10
... |
pepetreshere/odoo | refs/heads/patch-2 | addons/account/models/account_journal.py | 1 | # -*- coding: utf-8 -*-
from odoo import api, fields, models, _
from odoo.osv import expression
from odoo.exceptions import UserError, ValidationError
from odoo.addons.base.models.res_bank import sanitize_account_number
from odoo.tools import remove_accents
import logging
import re
_logger = logging.getLogger(__name__... |
kemalakyol48/python-for-android | refs/heads/master | python3-alpha/python3-src/Lib/ctypes/test/test_delattr.py | 337 | import unittest
from ctypes import *
class X(Structure):
_fields_ = [("foo", c_int)]
class TestCase(unittest.TestCase):
def test_simple(self):
self.assertRaises(TypeError,
delattr, c_int(42), "value")
def test_chararray(self):
self.assertRaises(TypeError,
... |
KontorConsulting/odoo | refs/heads/8.0 | addons/account/project/wizard/account_analytic_journal_report.py | 378 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... |
jakobworldpeace/scikit-learn | refs/heads/master | sklearn/datasets/svmlight_format.py | 41 | """This module implements a loader and dumper for the svmlight format
This format is a text-based format, with one sample per line. It does
not store zero valued features hence is suitable for sparse dataset.
The first element of each line can be used to store a target variable to
predict.
This format is used as the... |
apergos/docker-saltcluster | refs/heads/master | salt-cluster.py | 1 | import sys
import subprocess
import httplib
import getopt
import json
import socket
import Queue
import threading
import traceback
import time
import re
# script to start a salt master via docker, fix up minion
# configs and start salt clients via docker, get all the
# hostnames and ips and populate the relevant files... |
google/NeuroNER-CSPMC | refs/heads/master | neuroner/scripts/train.py | 1 | #!/usr/bin/env python3
# Lint as: python3
# MIT License
#
# Copyright 2019 Google LLC
# Copyright (c) 2019 Franck Dernoncourt, Jenny Lee, Tom Pollard
#
# 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... |
allotria/intellij-community | refs/heads/master | python/testData/completion/heavyStarPropagation/lib/_pkg0/_pkg0_0/_pkg0_0_0/_pkg0_0_0_1/_pkg0_0_0_1_0/_mod0_0_0_1_0_2.py | 30 | name0_0_0_1_0_2_0 = None
name0_0_0_1_0_2_1 = None
name0_0_0_1_0_2_2 = None
name0_0_0_1_0_2_3 = None
name0_0_0_1_0_2_4 = None |
dednal/chromium.src | refs/heads/nw12 | native_client_sdk/src/build_tools/tests/sdktools_test.py | 76 | #!/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.
import os
import re
import subprocess
import sys
import tarfile
import tempfile
import test_server
import unittest
import zipfile
... |
fprados/nipype | refs/heads/master | nipype/interfaces/tests/test_auto_LookupMeta.py | 14 | # AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from nipype.testing import assert_equal
from nipype.interfaces.dcmstack import LookupMeta
def test_LookupMeta_inputs():
input_map = dict(in_file=dict(mandatory=True,
),
meta_keys=dict(mandatory=True,
),
)
inputs = LookupMeta.input_spec()
... |
dbrattli/python-elements | refs/heads/master | tests/test_int_list.py | 1 | from elements import Element, IntegerElement, ListElement
import sys
xml_string = """
<message>
<integer>1</integer>
<integer>2</integer>
<integer>3</integer>
<integer>4</integer>
</message>
"""
#
# >>> m = Message()
# >>> m.from_string()
#
# >>> m.myints
# [IntegerElement(), ...]
#
# >>> m.myints[0... |
linjoahow/cd0505 | refs/heads/master | static/Brython3.1.1-20150328-091302/Lib/site-packages/pygame/sprite.py | 603 | ## pygame - Python Game Library
## Copyright (C) 2000-2003, 2007 Pete Shinners
## (C) 2004 Joe Wreschnig
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Library General Public
## License as published by the Free Software Foundation; e... |
junhuac/MQUIC | refs/heads/master | depot_tools/recipe_modules/presubmit/api.py | 1 | # Copyright 2016 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.
from recipe_engine import recipe_api
class PresubmitApi(recipe_api.RecipeApi):
def __call__(self, *args, **kwargs):
"""Return a presubmit step."""
... |
emaste/binutils-gdb | refs/heads/master | gdb/testsuite/gdb.python/py-pp-re-notag.py | 46 | # Copyright (C) 2013-2015 Free Software Foundation, Inc.
# 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.
#
# This progr... |
wavelets/GroundHog | refs/heads/master | groundhog/layers/rec_layers.py | 1 | """
Recurrent layers.
TODO: write more documentation
"""
__docformat__ = 'restructedtext en'
__authors__ = ("Razvan Pascanu "
"KyungHyun Cho "
"Caglar Gulcehre ")
__contact__ = "Razvan Pascanu <r.pascanu@gmail>"
import numpy
import copy
import theano
import theano.tensor as TT
# Nicer i... |
marratj/ansible | refs/heads/devel | lib/ansible/modules/cloud/ovirt/ovirt_vms_facts.py | 73 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 Red Hat, Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
#... |
Zenfone2-Dev/Kernel-for-Asus-Zenfone-2 | refs/heads/master | drivers/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Util.py | 12527 | # Util.py - Python extension for perf script, miscellaneous utility code
#
# Copyright (C) 2010 by Tom Zanussi <[email protected]>
#
# This software may be distributed under the terms of the GNU General
# Public License ("GPL") version 2 as published by the Free Software
# Foundation.
import errno, os
FUTEX_WAIT = 0... |
Dhivyap/ansible | refs/heads/devel | lib/ansible/modules/storage/netapp/na_ontap_cifs_server.py | 21 | #!/usr/bin/python
""" this is cifs_server module
(c) 2018-2019, 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',
... |
unifycore/ryu | refs/heads/master | ryu/lib/netconf/__init__.py | 15 | # Copyright (C) 2013 Nippon Telegraph and Telephone Corporation.
# Copyright (C) 2013 Isaku Yamahata <yamahata at private email ne jp>
#
# 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
#
# h... |
python-control/python-control | refs/heads/master | control/exception.py | 3 | # exception.py - exception definitions for the control package
#
# Author: Richard M. Murray
# Date: 31 May 2010
#
# This file contains definitions of standard exceptions for the control package
#
# Copyright (c) 2010 by California Institute of Technology
# All rights reserved.
#
# Redistribution and use in source and ... |
zas/picard | refs/heads/master | picard/log.py | 3 | # -*- coding: utf-8 -*-
#
# Picard, the next-generation MusicBrainz tagger
#
# Copyright (C) 2007, 2011 Lukáš Lalinský
# Copyright (C) 2008-2010, 2019, 2021 Philipp Wolfer
# Copyright (C) 2012-2013 Michael Wiencek
# Copyright (C) 2013, 2015, 2018-2020 Laurent Monin
# Copyright (C) 2016-2018 Sambhav Kothari
# Copyright ... |
ychen820/microblog | refs/heads/master | src/lib/wtforms/ext/dateutil/fields.py | 119 | """
A DateTimeField and DateField that use the `dateutil` package for parsing.
"""
from __future__ import unicode_literals
from dateutil import parser
from wtforms.fields import Field
from wtforms.validators import ValidationError
from wtforms.widgets import TextInput
__all__ = (
'DateTimeField', 'DateField',
)... |
hawkeyexp/plugin.video.netflix | refs/heads/master | resources/lib/config_wizard.py | 1 | # -*- coding: utf-8 -*-
"""
Copyright (C) 2017 Sebastian Golasch (plugin.video.netflix)
Copyright (C) 2020 Stefano Gottardo - @CastagnaIT (original implementation module)
Add-on configuration wizard
SPDX-License-Identifier: MIT
See LICENSES/MIT.md for more information.
"""
from __future__ import ab... |
Soya93/Extract-Refactoring | refs/heads/master | python/testData/refactoring/changeSignature/moveRenameParam.before.py | 83 | def bar(a=2):
a += 1
|
solanolabs/rply | refs/heads/master | tests/test_tokens.py | 1 | from rply.token import Token, SourcePosition
class TestTokens(object):
def test_source_pos(self):
t = Token("VALUE", "3", SourcePosition(5, 2, 1))
assert t.getsourcepos().lineno == 2
|
Fokko/incubator-airflow | refs/heads/master | airflow/contrib/operators/opsgenie_alert_operator.py | 1 | # -*- coding: utf-8 -*-
#
# 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
#... |
QuickSander/CouchPotatoServer | refs/heads/master | libs/requests/packages/urllib3/request.py | 83 | try:
from urllib.parse import urlencode
except ImportError:
from urllib import urlencode
from .filepost import encode_multipart_formdata
__all__ = ['RequestMethods']
class RequestMethods(object):
"""
Convenience mixin for classes who implement a :meth:`urlopen` method, such
as :class:`~urllib3.... |
Distrotech/intellij-community | refs/heads/master | python/testData/completion/classNameFromVarName.after.py | 83 | class Product:
def doStuff(self): pass
def foo(product):
product.doStuff() |
louyihua/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):
... |
mupi/escolamupi | refs/heads/master | payments/migrations/0007_auto__chg_field_userpayments_payment_id.py | 1 | # -*- 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):
# Changing field 'UserPayments.payment_id'
db.alter_column(u'payments_us... |
sathieu/samba | refs/heads/master | source3/build/charset.py | 40 | # tests for charsets for Samba3
from Configure import conf
@conf
def CHECK_SAMBA3_CHARSET(conf, crossbuild=False):
'''Check for default charsets for Samba3
'''
if conf.CHECK_ICONV(define='HAVE_NATIVE_ICONV'):
default_dos_charset=False
default_unix_charset=False
# check for default... |
nathanielvarona/airflow | refs/heads/master | airflow/utils/cli.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... |
numpy/datetime | refs/heads/main | numpy/distutils/exec_command.py | 32 | #!/usr/bin/env python
"""
exec_command
Implements exec_command function that is (almost) equivalent to
commands.getstatusoutput function but on NT, DOS systems the
returned status is actually correct (though, the returned status
values may be different by a factor). In addition, exec_command
takes keyword arguments fo... |
swenson/sagewiki | refs/heads/master | unidecode/unidecode/x062.py | 252 | data = (
'Lian ', # 0x00
'Nan ', # 0x01
'Mi ', # 0x02
'Tang ', # 0x03
'Jue ', # 0x04
'Gang ', # 0x05
'Gang ', # 0x06
'Gang ', # 0x07
'Ge ', # 0x08
'Yue ', # 0x09
'Wu ', # 0x0a
'Jian ', # 0x0b
'Xu ', # 0x0c
'Shu ', # 0x0d
'Rong ', # 0x0e
'Xi ', # 0x0f
'Cheng ', # 0x10
'... |
XiaosongWei/chromium-crosswalk | refs/heads/master | tools/telemetry/third_party/modulegraph/modulegraph_tests/testpkg-packages/pkg/sub2/mod.py | 52 | """ pkg.sub2.mod """
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.