repo_name stringlengths 5 100 | ref stringlengths 12 67 | path stringlengths 4 244 | copies stringlengths 1 8 | content stringlengths 0 1.05M ⌀ |
|---|---|---|---|---|
kjs73/pele | refs/heads/master | playground/native_code/setup.py | 7 | import os
import numpy as np
from numpy.distutils.core import setup, Extension
from numpy.distutils.command.build_src import build_src as np_build_src
## Numpy header files
numpy_lib = os.path.split(np.__file__)[0]
numpy_include = os.path.join(numpy_lib, 'core/include')
include_dirs = [numpy_include, "include/"]
in... |
imron/scalyr-agent-2 | refs/heads/master | scalyr_agent/third_party/pysnmp/proto/secmod/rfc3414/auth/__init__.py | 3653 | # This file is necessary to make this directory a package.
|
ansuz/cjdns | refs/heads/master | node_build/dependencies/libuv/build/gyp/test/win/gyptest-midl-excluded.py | 125 | #!/usr/bin/env python
# Copyright (c) 2014 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.
"""
Test that .idl files in actions and non-native rules are excluded.
"""
import TestGyp
import sys
if sys.platform == 'win32':
test =... |
Dtambara/cadastroLivros | refs/heads/master | node_modules/node-gyp/gyp/pylib/gyp/generator/xcode.py | 1363 | # Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import filecmp
import gyp.common
import gyp.xcodeproj_file
import gyp.xcode_ninja
import errno
import os
import sys
import posixpath
import re
import shutil
import... |
kiyoto/statsmodels | refs/heads/master | statsmodels/compat/tests/test_scipy_compat.py | 39 | from numpy.testing import assert_equal
from statsmodels.compat.scipy import _next_regular
def test_next_regular():
hams = {
1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 8, 8: 8, 14: 15, 15: 15,
16: 16, 17: 18, 1021: 1024, 1536: 1536, 51200000: 51200000,
510183360: 510183360, 510183360+1: 5120000... |
andreparrish/python-for-android | refs/heads/master | python3-alpha/extra_modules/gdata/apps/__init__.py | 285 | #!/usr/bin/python
#
# Copyright (C) 2007 SIOS Technology, 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 appli... |
UQ-UQx/edx-platform_lti | refs/heads/master | common/lib/xmodule/xmodule/tests/test_randomize_module.py | 108 | import unittest
from .test_course_module import DummySystem as DummyImportSystem
ORG = 'test_org'
COURSE = 'test_course'
START = '2013-01-01T01:00:00'
class RandomizeModuleTestCase(unittest.TestCase):
"""Make sure the randomize module works"""
@staticmethod
def get_dummy_course(start):
"""Get a... |
BT-fgarbely/connector | refs/heads/8.0 | connector/event.py | 19 | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Guewen Baconnier
# Copyright 2012-2013 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# ... |
alajara/servo | refs/heads/master | tests/wpt/web-platform-tests/XMLHttpRequest/resources/auth2/corsenabled.py | 28 | import imp
import os
def main(request, response):
response.headers.set('Access-Control-Allow-Origin', request.headers.get("origin"));
response.headers.set('Access-Control-Allow-Credentials', 'true');
response.headers.set('Access-Control-Allow-Methods', 'GET');
response.headers.set('Access-Control-Allow... |
dfdx2/django | refs/heads/master | django/utils/translation/__init__.py | 16 | """
Internationalization support.
"""
import re
import warnings
from contextlib import ContextDecorator
from django.utils.deprecation import RemovedInDjango21Warning
from django.utils.encoding import force_text
from django.utils.functional import lazy
__all__ = [
'activate', 'deactivate', 'override', 'deactivate_... |
spirali/shampoo | refs/heads/master | src/foam/foamparser.py | 1 | #
# Copyright (C) 2014 Stanislav Bohm
#
# This file is part of Shampoo.
#
# Shampoo is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# Shampoo is distributed in the... |
0k/odoo | refs/heads/master | openerp/report/pyPdf/__init__.py | 75 | from pdf import PdfFileReader, PdfFileWriter
__all__ = ["pdf"]
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
fengzhyuan/scikit-learn | refs/heads/master | examples/cluster/plot_lena_segmentation.py | 271 | """
=========================================
Segmenting the picture of Lena in regions
=========================================
This example uses :ref:`spectral_clustering` on a graph created from
voxel-to-voxel difference on an image to break this image into multiple
partly-homogeneous regions.
This procedure (spe... |
harshita-gupta/Harvard-FRSEM-Catalog-2016-17 | refs/heads/master | flask/lib/python2.7/site-packages/requests/packages/chardet/charsetgroupprober.py | 2928 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is Mozilla Communicator client code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights ... |
igorgai/django-allauth | refs/heads/master | allauth/socialaccount/providers/odnoklassniki/models.py | 4209 | # Create your models here.
|
cricketclubucd/davisdragons | refs/heads/master | platform-tools/systrace/catapult/telemetry/telemetry/wpr/archive_info_unittest.py | 5 | # Copyright 2017 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 json
import os
import shutil
import tempfile
import unittest
from py_utils import cloud_storage # pylint: disable=import-error
from telemetry.page i... |
ProjectSWGCore/NGECore2 | refs/heads/master | scripts/object/mobile/dressed_commoner_tatooine_nikto_male_08.py | 85615 | import sys
def setup(core, object):
return |
DreamerKing/LightweightHtmlWidgets | refs/heads/master | publish-rc/v1.1/files/Ipy.Lib/encodings/ascii.py | 858 | """ Python 'ascii' Codec
Written by Marc-Andre Lemburg (mal@lemburg.com).
(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
"""
import codecs
### Codec APIs
class Codec(codecs.Codec):
# Note: Binding these as C functions will result in the class not
# converting them to methods. This is intended.
... |
citrix-openstack-build/sahara | refs/heads/master | sahara/tests/unit/utils/test_xml_utils.py | 5 | # Copyright (c) 2013 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... |
TomHeatwole/osf.io | refs/heads/develop | tests/test_citations.py | 54 | # -*- coding: utf-8 -*-
import datetime
from nose.tools import * # noqa
from scripts import parse_citation_styles
from framework.auth.core import Auth
from website.util import api_url_for
from website.citations.utils import datetime_to_csl
from website.models import Node, User
from flask import redirect
from tests.... |
florianholzapfel/home-assistant | refs/heads/dev | homeassistant/components/media_player/philips_js.py | 5 | """
Media Player component to integrate TVs exposing the Joint Space API.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/media_player.philips_js/
"""
import logging
from datetime import timedelta
import voluptuous as vol
import homeassistant.helpers.co... |
mac-l1/xbmc | refs/heads/master | lib/gtest/scripts/upload.py | 2511 | #!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
dob71/x2swn | refs/heads/master | skeinforge/skeinforge_application/skeinforge_plugins/craft_plugins/cool.py | 6 | """
This page is in the table of contents.
Cool is a craft tool to cool the shape.
Cool works well with a stepper extruder, it does not work well with a DC motor extruder.
If enabled, before each layer that takes less then "Minimum Layer Time" to print the tool head will orbit around the printed area for 'Minimum Lay... |
DataDog/integrations-core | refs/heads/master | marklogic/tests/test_api.py | 1 | # (C) Datadog, Inc. 2020-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
from typing import Any, Dict
import pytest
from datadog_checks.marklogic.api import MarkLogicApi
pytestmark = pytest.mark.unit
class MockResponseWrapper:
def __init__(self, return_value):
... |
queria/my-tempest | refs/heads/juno | tempest/api/compute/v3/images/test_images.py | 2 | # Copyright 2012 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 law ... |
willthames/ansible | refs/heads/devel | lib/ansible/modules/network/asa/asa_acl.py | 51 | #!/usr/bin/python
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distribut... |
submergerock/avatar-hadoop | refs/heads/master | src/contrib/hod/hodlib/RingMaster/__init__.py | 1638 | #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 use thi... |
noah-dev/todo_django | refs/heads/master | todo/migrations/0005_auto_20170625_1732.py | 1 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-06-25 22:32
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('todo', '0004_auto_20170625_1728'),
]
operations = [
migrations.AlterField(
... |
seem-sky/kbengine | refs/heads/master | kbe/res/scripts/common/Lib/encodings/iso8859_2.py | 272 | """ Python Character Mapping Codec iso8859_2 generated from 'MAPPINGS/ISO8859/8859-2.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,errors='... |
dkarakats/edx-platform | refs/heads/master | lms/djangoapps/mobile_api/social_facebook/groups/__init__.py | 128 | """
Groups API
"""
|
mlwbarlow/scripts-as-required | refs/heads/master | python/ABS_TSSearchServlet_AllTimeSeriesCatalogueNos.py | 2 | # Uses ABS Webservice to obtain TimeSeries CatalogueNumbers, then retrieves latest issue date from ABS Web Site www.abs.gov.au
#
# dictCatCatalogueNumbers e.g. {1 : ListOfCatalogueNumbersStartingWith1, 2 : ListOfCatalogueNumbersStartingWith2, ... }
# For each catNum in range (1 to 9)
# catalogueNumbers - list for one... |
TikhomirovSergey/selenium | refs/heads/master | py/selenium/webdriver/edge/webdriver.py | 43 | # Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... |
rzhxeo/youtube-dl | refs/heads/master | youtube_dl/extractor/vier.py | 15 | # coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
class VierIE(InfoExtractor):
IE_NAME = 'vier'
_VALID_URL = r'https?://(?:www\.)?vier\.be/(?:[^/]+/videos/(?P<display_id>[^/]+)(?:/(?P<id>\d+))?|video/v3/embed/(?P<embed_id>\d+))'
_TESTS = [{
'url'... |
gtko/CouchPotatoServer | refs/heads/develop | libs/xmpp/commands.py | 200 | ## $Id: commands.py,v 1.17 2007/08/28 09:54:15 normanr Exp $
## Ad-Hoc Command manager
## Mike Albon (c) 5th January 2005
## 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... |
AchimTuran/sfs-python | refs/heads/master | tests/test_array.py | 1 | import numpy as np
import sfs
import pytest
linear_cases = [
((3, 1), [[-1, 0, 0], [0, 0, 0], [1, 0, 0]]),
((2, 1), [[-0.5, 0, 0], [0.5, 0, 0]]),
((1, 1), [[0, 0, 0]]),
((3, 0.5), [[-0.5, 0, 0], [0, 0, 0], [0.5, 0, 0]]),
((2, 1, [0.5, 2, 3]), [[0, 2, 3], [1, 2, 3]]),
((2, 1, np.array([0.5, 2, ... |
ales-erjavec/orange | refs/heads/master | docs/reference/rst/code/instance-metavar.py | 6 | import random
import Orange
random.seed(42)
lenses = Orange.data.Table("lenses")
id = Orange.feature.Descriptor.new_meta_id()
for inst in lenses:
inst[id] = random.random()
print lenses[0]
|
Godiyos/python-for-android | refs/heads/master | python3-alpha/python3-src/Lib/shutil.py | 45 | """Utility functions for copying and archiving files and directory trees.
XXX The functions here don't copy the resource fork or other metadata on Mac.
"""
import os
import sys
import stat
from os.path import abspath
import fnmatch
import collections
import errno
import tarfile
try:
import bz2
_BZ2_SUPPORTE... |
Anonymous-X6/django | refs/heads/master | tests/sitemaps_tests/test_https.py | 205 | from __future__ import unicode_literals
from datetime import date
from django.test import ignore_warnings, override_settings
from django.utils.deprecation import RemovedInDjango110Warning
from .base import SitemapTestsBase
@override_settings(ROOT_URLCONF='sitemaps_tests.urls.https')
class HTTPSSitemapTests(Sitemap... |
xyzz/vcmi-build | refs/heads/master | project/jni/python/src/Lib/plat-mac/ic.py | 33 | """IC wrapper module, based on Internet Config 1.3"""
from warnings import warnpy3k
warnpy3k("In 3.x, the ic module is removed.", stacklevel=2)
import icglue
import string
import sys
import os
from Carbon import Res
import Carbon.File
import macostools
error=icglue.error
# From ictypes.h:
icPrefNotFoundErr = -666 ... |
xiandiancloud/ji | refs/heads/master | cms/djangoapps/contentstore/management/commands/cleanup_assets.py | 204 | """
Script for removing all redundant Mac OS metadata files (with filename ".DS_Store"
or with filename which starts with "._") for all courses
"""
import logging
from django.core.management.base import BaseCommand
from xmodule.contentstore.django import contentstore
log = logging.getLogger(__name__)
class Command... |
sbuss/voteswap | refs/heads/master | lib/networkx/algorithms/bipartite/generators.py | 45 | # -*- coding: utf-8 -*-
"""
Generators and functions for bipartite graphs.
"""
# Copyright (C) 2006-2011 by
# Aric Hagberg <hagberg@lanl.gov>
# Dan Schult <dschult@colgate.edu>
# Pieter Swart <swart@lanl.gov>
# All rights reserved.
# BSD license.
import math
import random
import networkx
from funct... |
I--P/numpy | refs/heads/master | numpy/core/function_base.py | 7 | from __future__ import division, absolute_import, print_function
__all__ = ['logspace', 'linspace']
from . import numeric as _nx
from .numeric import result_type, NaN, shares_memory, MAY_SHARE_BOUNDS, TooHardError
def linspace(start, stop, num=50, endpoint=True, retstep=False, dtype=None):
"""
Return evenly... |
ryfeus/lambda-packs | refs/heads/master | HDF4_H5_NETCDF/source2.7/Cython/Compiler/Scanning.py | 2 | # cython: infer_types=True, language_level=3, py2_import=True, auto_pickle=False
#
# Cython Scanner
#
from __future__ import absolute_import
import cython
cython.declare(make_lexicon=object, lexicon=object,
print_function=object, error=object, warning=object,
os=object, platform=object... |
kuri65536/python-for-android | refs/heads/master | python-build/python-libs/gdata/src/gdata/alt/appengine.py | 133 | #!/usr/bin/python
#
# Copyright (C) 2008 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 ... |
temasek/android_external_chromium_org_third_party_WebKit | refs/heads/cm-12.1 | Tools/Scripts/webkitpy/tool/servers/rebaselineserver_unittest.py | 44 | # Copyright (C) 2010 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... |
allotria/intellij-community | refs/heads/master | python/testData/mover/moveStatement_afterDown.py | 83 | class A:
def f(self, a, b):
while a:
a = a / 2
for i in range(1, 10):
if a:
b = 1
elif b:
a = 1
else:
print "a"
print i |
bbusemeyer/busempyer | refs/heads/master | busempyer/fit_tools.py | 2 | ''' Convenience tools for simple and quick fitting. '''
from inspect import getargspec
from scipy.optimize import curve_fit
import numpy as np
### Fitting tools.
class FitFunc:
"""
Define a function that can be fit to and plotted with.
"""
def __init__(self,form,jacobian=None,pnames=[]):
self.form = form... |
nicolacimmino/msgp2p | refs/heads/develop | python/examples/send.py | 1 | #!/usr/bin/env python
# send is part of msgp2p and is an example of msgp2p message sending.
# Copyright (C) 2014 Nicola Cimmino
#
# 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, eithe... |
shi2wei3/tp-libvirt | refs/heads/master | libvirt/tests/src/virsh_cmd/domain/virsh_numatune.py | 3 | import re
import logging
from virttest.utils_test.libvirt import cpus_parser
from autotest.client.shared import error, utils
from virttest import libvirt_xml, virsh, utils_libvirtd, utils_misc
from virttest.libvirt_xml.xcepts import LibvirtXMLAccessorError
try:
from virttest.staging import utils_cgroup
except Impor... |
kotobukki/MobSF-Translate | refs/heads/master | APITester/cloud/cloud_server.py | 3 | #!/usr/bin/env python
import tornado.ioloop
import tornado.web,re
import sqlite3 as lite
import datetime
def CleanDB():
con = lite.connect('db.db')
with con:
cur = con.cursor()
tms = datetime.datetime.now() - datetime.timedelta(minutes=5)
cur.execute("DELETE FROM XXE WHERE ts <=?",(tms... |
anakinsolo/backend | refs/heads/master | Lib/encodings/iso8859_2.py | 593 | """ Python Character Mapping Codec iso8859_2 generated from 'MAPPINGS/ISO8859/8859-2.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,errors='... |
Kongsea/tensorflow | refs/heads/master | tensorflow/python/kernel_tests/sparse_tensor_dense_matmul_op_test.py | 61 | # Copyright 2015 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... |
kdwink/intellij-community | refs/heads/master | python/lib/Lib/xml/dom/NodeFilter.py | 455 | # This is the Python mapping for interface NodeFilter from
# DOM2-Traversal-Range. It contains only constants.
class NodeFilter:
"""
This is the DOM2 NodeFilter interface. It contains only constants.
"""
FILTER_ACCEPT = 1
FILTER_REJECT = 2
FILTER_SKIP = 3
SHOW_ALL = 0x... |
MichSchli/QuestionAnsweringGCN | refs/heads/master | old_version/candidate_selection/tensorflow_models/models/path_bag_with_type_gates_vs_lstm.py | 1 | import tensorflow as tf
from candidate_selection.tensorflow_hypergraph_representation import TensorflowHypergraphRepresentation
from candidate_selection.tensorflow_models.abstract_tensorflow_model import AbstractTensorflowModel
from candidate_selection.tensorflow_models.components.decoders.softmax_decoder import Softm... |
Akasurde/ansible | refs/heads/devel | test/lib/ansible_test/_data/pytest/plugins/ansible_pytest_collections.py | 15 | """Enable unit testing of Ansible collections. PYTEST_DONT_REWRITE"""
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import sys
# set by ansible-test to a single directory, rather than a list of directories as supported by Ansible itself
ANSIBLE_COLLECTIONS_PATH = os... |
xpansa/account-financial-tools | refs/heads/8.0 | account_cancel_invoice_check_payment_order/account_invoice.py | 44 | # -*- coding: utf-8 -*-
##############################################################################
#
# Author Vincent Renaville. Copyright 2012 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# publis... |
CERNDocumentServer/invenio | refs/heads/prod | modules/websubmit/lib/websubmit_web_tests.py | 1 | # -*- coding: utf-8 -*-
# This file is part of Invenio.
# Copyright (C) 2011, 2014 CERN.
#
# Invenio is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any ... |
benhoff/listenerplugins | refs/heads/master | listenerplugins/python.py | 36 | from cloudbot import hook
from cloudbot.util import web
@hook.command("python", "py")
def python(text):
"""<python code> - executes <python code> using eval.appspot.com"""
output = web.pyeval(text, pastebin=False)
if '\n' in output:
if 'Traceback (most recent call last):' in output:
... |
nathanbjenx/cairis | refs/heads/master | cairis/mio/DomainValueContentHandler.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... |
martinmcbride/pytexture | refs/heads/master | test/test_color.py | 1 | import unittest
from generativepy.color import Color, make_colormap
class TestColour(unittest.TestCase):
# Test RGB and RGBA colours
def test_rgb_rgb_black(self):
color = Color(0, 0, 0)
self.assertEqual(color.rgb, (0, 0, 0))
def test_rgb_rgb_color(self):
color = Color(1, 0.5, 0.2... |
gannetson/sportschooldeopenlucht | refs/heads/master | env/lib/python2.7/site-packages/django/core/management/commands/testserver.py | 307 | from django.core.management.base import BaseCommand
from optparse import make_option
class Command(BaseCommand):
option_list = BaseCommand.option_list + (
make_option('--noinput', action='store_false', dest='interactive', default=True,
help='Tells Django to NOT prompt the user for input of any... |
franklingu/leetcode-solutions | refs/heads/master | questions/find-the-duplicate-number/Solution.py | 1 | '''
Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist. Assume that there is only one duplicate number, find the duplicate one.
Example 1:
Input: [1,3,4,2,2]
Output: 2
Example 2:
Input: [3,1,3,4,2]
Output: 3
Note:
You ... |
ereslibre/salt | refs/heads/master | salt/_states/caasp_etcd.py | 1 | from __future__ import absolute_import
# default number of trials for etcdctl
DEFAULT_ATTEMPTS = 10
# ... and the interval between them
DEFAULT_ATTEMPTS_INTERVAL = 2
# default etcd peer port
ETCD_PEER_PORT = 2380
def api_version():
return __salt__['caasp_etcd.api_version']()
def etcdctl(name, retry={}, **kwa... |
FLYKingdom/MyCode | refs/heads/master | PycharmProjects/PythonTest/venv/lib/python2.7/site-packages/pip/_vendor/requests/packages/chardet/charsetprober.py | 3126 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is Mozilla Universal charset detector code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 2001
# the Initial Developer. All R... |
mayankcu/Django-social | refs/heads/master | venv/Lib/site-packages/psycopg2/errorcodes.py | 9 | """Error codes for PostgresSQL
This module contains symbolic names for all PostgreSQL error codes.
"""
# psycopg2/errorcodes.py - PostgreSQL error codes
#
# Copyright (C) 2006-2010 Johan Dahlin <jdahlin@async.com.br>
#
# psycopg2 is free software: you can redistribute it and/or modify it
# under the terms of the GNU ... |
xiaojunwu/crosswalk-test-suite | refs/heads/master | webapi/tct-csp-w3c-tests/csp-py/csp_media-src_asterisk_video_allowed_int.py | 5 | def main(request, response):
import simplejson as json
f = file('config.json')
source = f.read()
s = json.JSONDecoder().decode(source)
url1 = "http://" + s['host'] + ":" + str(s['ports']['http'][1])
url2 = "http://" + s['host'] + ":" + str(s['ports']['http'][0])
response.headers.set("Content... |
fqtools/shadowsocks | refs/heads/master | tests/test.py | 1016 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2015 clowwindy
#
# 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 b... |
pombredanne/django-rest-framework-api-server | refs/heads/master | rest_api_project/settings/development.py | 1 | import os
DEBUG = True
TEMPLATE_DEBUG = DEBUG
DATABASES = {'default': {'ENGINE': 'django.db.backends.sqlite3','NAME': 'reservations.sqlite'}}
LOGGING = {
'version': 1,
'formatters': {
'simple': {
'format': '%(levelname)s %(message)s'
},
},
'handlers': {
'console': ... |
dabrahams/0install | refs/heads/master | zeroinstall/zerostore/manifest.py | 3 |
"""Processing of implementation manifests.
A manifest is a string representing a directory tree, with the property
that two trees will generate identical manifest strings if and only if:
- They have extactly the same set of files, directories and symlinks.
- For each pair of corresponding directories in the two se... |
ROMFactory/android_external_chromium_org | refs/heads/kitkat | native_client_sdk/src/build_tools/build_app.py | 23 | #!/usr/bin/env python
# Copyright (c) 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 json
import optparse
import os
import re
import sys
if sys.version_info < (2, 6, 0):
sys.stderr.write("python 2.6 or late... |
bright-sparks/titanium_mobile | refs/heads/master | support/common/markdown/extensions/toc.py | 106 | """
Table of Contents Extension for Python-Markdown
* * *
(c) 2008 [Jack Miller](http://codezen.org)
Dependencies:
* [Markdown 2.0+](http://www.freewisdom.org/projects/python-markdown/)
"""
import markdown
from markdown import etree
import re
class TocTreeprocessor(markdown.treeprocessors.Treeprocessor):
# Iter... |
ujjwal96/mitmproxy | refs/heads/master | examples/addons/scripting-headers.py | 4 |
def request(flow):
flow.request.headers["myheader"] = "value"
|
henryfjordan/django | refs/heads/master | django/db/migrations/executor.py | 103 | from __future__ import unicode_literals
from django.apps.registry import apps as global_apps
from django.db import migrations
from .exceptions import InvalidMigrationPlan
from .loader import MigrationLoader
from .recorder import MigrationRecorder
from .state import ProjectState
class MigrationExecutor(object):
... |
rahuldan/sympy | refs/heads/master | sympy/logic/tests/test_dimacs.py | 102 | """Various tests on satisfiability using dimacs cnf file syntax
You can find lots of cnf files in
ftp://dimacs.rutgers.edu/pub/challenge/satisfiability/benchmarks/cnf/
"""
from sympy.logic.utilities.dimacs import load
from sympy.logic.algorithms.dpll import dpll_satisfiable
def test_f1():
assert bool(dpll_satisf... |
schlizbaeda/yamuplay | refs/heads/master | python-omxplayer-wrapper/tests/context.py | 2 | import sys
import os
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
import omxplayer
|
efiring/numpy-work | refs/heads/cfastma | numpy/distutils/tests/setup.py | 49 | #!/usr/bin/env python
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('testnumpydistutils',parent_package,top_path)
config.add_subpackage('pyrex_ext')
config.add_subpackage('f2py_ext')
#config.add_subpackage('f2py_f90_ext... |
gautam1858/tensorflow | refs/heads/master | tensorflow/python/kernel_tests/sparse_slice_op_test.py | 22 | # Copyright 2015 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... |
HumanExposure/factotum | refs/heads/master | dashboard/tests/unit/test_clean_comp_form.py | 1 | from decimal import Decimal
from django.test import TestCase
from dashboard.forms.data_group import CleanCompForm
from dashboard.tests import factories
class CleanCompFormTest(TestCase):
"""This is the base form used to make up CleanCompFormSet.
Due to this it does not have a "save" function."""
def se... |
tangyiyong/odoo | refs/heads/8.0 | addons/website_customer/controllers/main.py | 251 | # -*- coding: utf-8 -*-
import openerp
from openerp import SUPERUSER_ID
from openerp.addons.web import http
from openerp.addons.website.models.website import unslug
from openerp.tools.translate import _
from openerp.addons.web.http import request
import werkzeug.urls
class WebsiteCustomer(http.Controller):
_refere... |
angularlyons/cuda-convnet2 | refs/heads/master | make-data/make-data.py | 179 | # 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... |
Ashaba/rms | refs/heads/master | rmslocalenv/lib/python2.7/site-packages/setuptools/command/easy_install.py | 44 | #!/usr/bin/env python
"""
Easy Install
------------
A tool for doing automatic download/extract/build of distutils-based Python
packages. For detailed documentation, see the accompanying EasyInstall.txt
file, or visit the `EasyInstall home page`__.
__ https://setuptools.readthedocs.io/en/latest/easy_install.html
""... |
jorik041/scrapy | refs/heads/master | scrapy/commands/list.py | 15 | from __future__ import print_function
from scrapy.command import ScrapyCommand
class Command(ScrapyCommand):
requires_project = True
default_settings = {'LOG_ENABLED': False}
def short_desc(self):
return "List available spiders"
def run(self, args, opts):
for s in sorted(self.crawler... |
Ilyes-Hammadi/awesome-app | refs/heads/master | awesome_app/users/tests/test_views.py | 367 | from django.test import RequestFactory
from test_plus.test import TestCase
from ..views import (
UserRedirectView,
UserUpdateView
)
class BaseUserTestCase(TestCase):
def setUp(self):
self.user = self.make_user()
self.factory = RequestFactory()
class TestUserRedirectView(BaseUserTestCa... |
newtdb/db | refs/heads/master | src/newt/db/updater.py | 1 | from __future__ import print_function
"""Updates database json representation
"""
import argparse
import itertools
import logging
import relstorage.adapters.postgresql
import relstorage.options
import sys
from . import pg_connection
from . import follow
from .jsonpickle import Jsonifier
from ._adapter import DELETE_T... |
tao12345666333/app-turbo | refs/heads/master | demos/helloworld/app-server/apps/app/__init__.py | 1 |
from turbo import register
import app
register.register_group_urls('', [
('/', app.HomeHandler),
('/index', app.HomeHandler, 'index'),
('/hello', app.HomeHandler, 'home'),
])
register.register_url('/v1/hello', app.ApiHandler)
|
ahaberlie/MetPy | refs/heads/master | examples/XArray_Projections.py | 7 | # Copyright (c) 2018 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""
XArray Projection Handling
==========================
Use MetPy's XArray accessors to simplify opening a data file and plotting
data on a map using CartoPy.
"""
import cartopy.f... |
kostyll/micropython | refs/heads/master | tests/bytecode/mp-tests/decorate1.py | 22 | @d
def f():
pass
@d
@e
def g():
pass
@d.e.f
def h():
pass
@d(a + 1)
def i():
pass
@d(a + 1, b + 2)
def i():
pass
|
lanbing510/GTDWeb | refs/heads/master | django/contrib/staticfiles/management/commands/runserver.py | 248 | from django.conf import settings
from django.contrib.staticfiles.handlers import StaticFilesHandler
from django.core.management.commands.runserver import \
Command as RunserverCommand
class Command(RunserverCommand):
help = "Starts a lightweight Web server for development and also serves static files."
d... |
Drvanon/Game | refs/heads/master | venv/lib/python3.3/site-packages/sqlalchemy/orm/dynamic.py | 14 | # orm/dynamic.py
# Copyright (C) 2005-2013 the SQLAlchemy authors and contributors <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""Dynamic collection API.
Dynamic collections act like Query() objects for read opera... |
wolfdale/Spaghetti-code | refs/heads/master | Python/Thread.py | 1 | #Simple Threads
import threading
import time
def worker():
'@Thread Method with sleep 1 Sec'
print threading.currentThread().getName(),'Starting'
time.sleep(1)
print threading.currentThread().getName(),'Exiting'
def service():
'@Thread Method With Sleep 3 Sec'
print threading.currentThread().getName(),'S... |
kartikeys98/coala | refs/heads/master | coalib/parsing/filters/CanFixFilter.py | 9 | from coalib.parsing.filters.Filter import filter
@filter
def can_fix_filter(bear, args):
"""
Filters the bears by ``CAN_FIX``.
:param bear: Bear object.
:param args: Set of fixable issue types on which ``bear`` is to be
filtered.
:return: ``True`` if this bear matches the cri... |
falau/pogom | refs/heads/mewmewmew | pogom/pgoapi/protos/POGOProtos/Inventory/EggIncubator_pb2.py | 6 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: POGOProtos/Inventory/EggIncubator.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf i... |
bop/rango | refs/heads/master | lib/python2.7/site-packages/django/utils/unittest/util.py | 751 | """Various utility functions."""
__unittest = True
_MAX_LENGTH = 80
def safe_repr(obj, short=False):
try:
result = repr(obj)
except Exception:
result = object.__repr__(obj)
if not short or len(result) < _MAX_LENGTH:
return result
return result[:_MAX_LENGTH] + ' [truncated]...'... |
timbuchwaldt/bundlewrap | refs/heads/master | tests/integration/bw_apply_autoskip.py | 1 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from os.path import exists, join
from bundlewrap.utils.testing import host_os, make_repo, run
def test_skip_bundle(tmpdir):
make_repo(
tmpdir,
bundles={
"test": {
'files': {
join(str(t... |
alex-robbins/micropython | refs/heads/master | tests/basics/string_istest.py | 117 | print("".isspace())
print(" \t\n\r\v\f".isspace())
print("a".isspace())
print(" \t\n\r\v\fa".isspace())
print("".isalpha())
print("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".isalpha())
print("0abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".isalpha())
print("this ".isalpha())
print("".isdigit())
print(... |
fifoforlifo/pynja | refs/heads/master | test2/build/repo/boost/boost-b2-msvc-invoke.py | 1 | import os
import sys
import glob
script, boostDir, vcVer, vcDir, arch, runtimeLink, config, stageDir, logFilePath, guardFileBase, guardFilePath = sys.argv
# For this to work, modify tools\build\v2\tools\msvc.jam with this:
#
# local rule auto-detect-toolset-versions ( )
# {
# # pynja: add explicit control o... |
sherlocke/pycanlii | refs/heads/master | tests/test_enums.py | 1 | import pycanlii.enums as enums
class TestEnums(object):
#This probably seems redundant, it's just to check if it works on all versions of python
def test_enums(self):
#Tests if the enum will run at all
assert enums.Jurisdiction.ca == enums.Jurisdiction.ca
#Tests if you can get the na... |
mattn/ultisnips | refs/heads/master | test/test_ContextSnippets.py | 4 | from test.vim_test_case import VimTestCase as _VimTest
from test.constant import *
class ContextSnippets_SimpleSnippet(_VimTest):
files = { 'us/all.snippets': r"""
snippet a "desc" "True" e
abc
endsnippet
"""}
keys = 'a' + EX
wanted = 'abc'
class ContextSnippets_ExpandOnT... |
openhatch/new-mini-tasks | refs/heads/master | vendor/packages/Django/django/core/paginator.py | 103 | from math import ceil
from django.utils import six
class InvalidPage(Exception):
pass
class PageNotAnInteger(InvalidPage):
pass
class EmptyPage(InvalidPage):
pass
class Paginator(object):
def __init__(self, object_list, per_page, orphans=0, allow_empty_first_page=True):
self.object_list = ... |
rtyoung/learn_django | refs/heads/master | src/trydjango/urls.py | 1 | """trydjango URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-b... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.