repo_name stringlengths 5 100 | ref stringlengths 12 67 | path stringlengths 4 244 | copies stringlengths 1 8 | content stringlengths 0 1.05M ⌀ |
|---|---|---|---|---|
butterhirsch/newcutplace | refs/heads/master | tests/__init__.py | 4 | # Do nothing.
|
mansam/liveconnect | refs/heads/master | liveconnect/exceptions.py | 1 | class AuthorizationError(Exception):
pass |
40423206/2016fallcadp_hw | refs/heads/gh-pages | plugin/tipue_search/tipue_search.py | 251 | # -*- coding: utf-8 -*-
"""
Tipue Search
============
A Pelican plugin to serialize generated HTML to JSON
that can be used by jQuery plugin - Tipue Search.
Copyright (c) Talha Mansoor
"""
from __future__ import unicode_literals
import os.path
import json
from bs4 import BeautifulSoup
from codecs import open
try:
... |
kaulkie/keyczar | refs/heads/master | cpp/src/tools/scons/scons-local-1.2.0.d20090223/SCons/Tool/fortran.py | 19 | """SCons.Tool.fortran
Tool-specific initialization for a generic Posix f77/f90 Fortran compiler.
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, 2002, 2003, 2004, 2005, 2006, 2007, 20... |
calvinchengx/django-haystack | refs/heads/master | tests/whoosh_tests/tests/__init__.py | 4 | import warnings
warnings.simplefilter('ignore', Warning)
from whoosh_tests.tests.forms import *
from whoosh_tests.tests.whoosh_query import *
from whoosh_tests.tests.whoosh_backend import *
|
hopeall/odoo | refs/heads/8.0 | addons/hr_payroll/report/__init__.py | 427 | #-*- coding:utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# d$
#
# This program is free software: you can redistribute it and/or modify
# it... |
learningequality/kolibri | refs/heads/develop | kolibri/utils/logger.py | 2 | import logging
import os
import re
from logging import Formatter
from logging.handlers import TimedRotatingFileHandler
from . import conf
GET_FILES_TO_DELETE = "getFilesToDelete"
DO_ROLLOVER = "doRollover"
class KolibriTimedRotatingFileHandler(TimedRotatingFileHandler):
"""
A custom TimedRotatingFileHandle... |
eurekaclinical/eureka-python-client | refs/heads/master | eurekaclinical/analytics/client.py | 1 | from eurekaclinical import APISession, API, Struct, construct_api_session_context_manager
class Job(Struct):
def __init__(self):
super(Job, self).__init__()
self.sourceConfigId = None
self.destinationId = None
self.dateRangePhenotypeKey = None
self.earliestDate = None
... |
jhaux/tensorflow | refs/heads/master | tensorflow/tools/docs/generate_1_0.py | 19 | # 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... |
v-iam/azure-sdk-for-python | refs/heads/master | azure-mgmt-eventhub/azure/mgmt/eventhub/version.py | 1003 | # 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 ... |
Chilledheart/glibc | refs/heads/master | benchtests/scripts/import_bench.py | 5 | #!/usr/bin/python
# Copyright (C) 2015-2016 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
#
# The GNU C Library 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
# versio... |
golaizola/pelisalacarta-xbmc | refs/heads/master | servers/youtube.py | 4 | # -*- coding: utf-8 -*-
#------------------------------------------------------------
# pelisalacarta - XBMC Plugin
# Conector para Youtube
# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
#------------------------------------------------------------
import urlparse,urllib2,urllib,re,httplib
from core import co... |
dvliman/jaikuengine | refs/heads/master | .google_appengine/lib/django-1.5/django/db/models/fields/__init__.py | 4 | from __future__ import unicode_literals
import collections
import copy
import datetime
import decimal
import math
import warnings
from itertools import tee
from django.db import connection
from django.db.models.query_utils import QueryWrapper
from django.conf import settings
from django import forms
from django.core ... |
MaxMorais/frappe | refs/heads/develop | frappe/templates/pages/message.py | 40 | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils import strip_html_tags
no_cache = 1
no_sitemap = 1
def get_context(context):
message_context = {}
if hasattr(frappe.local, "message"):
messa... |
cudbg/planout | refs/heads/master | contrib/postgres_logger.py | 9 | from planout.experiment import SimpleExperiment
import psycopg2 as pg
from psycopg2.extras import Json as pJson
class PostgresLoggedExperiment(SimpleExperiment):
def configure_logger(self):
""" Sets up a logger to postgres.
1. Modify the connection_parameters variable to be a dictionary of the
... |
jlegendary/youtube-dl | refs/heads/master | youtube_dl/extractor/sandia.py | 106 | # coding: utf-8
from __future__ import unicode_literals
import itertools
import json
import re
from .common import InfoExtractor
from ..compat import (
compat_urllib_request,
compat_urlparse,
)
from ..utils import (
int_or_none,
js_to_json,
mimetype2ext,
unified_strdate,
)
class SandiaIE(Inf... |
franchoo/python-starter | refs/heads/master | fib.py | 1 | def fib(n):
a, b = 0, 1
while a < n:
print(a, end=' ')
a, b = b, a+b
print()
fib(1000)
|
bjorncooley/rainforest_makers | refs/heads/master | spirit/views/category.py | 1 | #-*- coding: utf-8 -*-
from django.views.generic import ListView
from django.shortcuts import render, get_object_or_404
from django.http import HttpResponsePermanentRedirect
from spirit.models.topic import Topic
from spirit.models.category import Category
def category_detail(request, pk, slug):
category = Cate... |
AAROC/invenio | refs/heads/master | invenio/base/__init__.py | 18 | # -*- coding: utf-8 -*-
# This file is part of Invenio.
# Copyright (C) 2012, 2013, 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)... |
John-Lin/electron | refs/heads/master | script/upload-windows-pdb.py | 156 | #!/usr/bin/env python
import os
import glob
import sys
from lib.config import s3_config
from lib.util import atom_gyp, execute, rm_rf, safe_mkdir, s3put
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
SYMBOLS_DIR = 'dist\\symbols'
DOWNLOAD_DIR = 'vendor\\brightray\\vendor\\download\\libchr... |
jeorgen/ngcccbase | refs/heads/master | ngcccbase/tests/test_wallet_model.py | 5 | #!/usr/bin/env python
import unittest
from coloredcoinlib import (ColorSet, ColorDataBuilderManager,
AidedColorDataBuilder, ThinColorData)
from ngcccbase.deterministic import DWalletAddressManager
from ngcccbase.pwallet import PersistentWallet
from ngcccbase.txcons import BasicTxSpec, Inv... |
iulian787/spack | refs/heads/develop | var/spack/repos/builtin/packages/r-dplyr/package.py | 5 | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RDplyr(RPackage):
"""A fast, consistent tool for working with data frame like objects, bot... |
spblightadv/rethinkdb | refs/heads/next | external/v8_3.30.33.16/tools/push-to-trunk/auto_roll.py | 40 | #!/usr/bin/env python
# Copyright 2014 the V8 project 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 argparse
import json
import os
import sys
import urllib
from common_includes import *
import chromium_roll
class CheckActiv... |
kumarkrishna/sympy | refs/heads/master | sympy/core/facts.py | 34 | # -*- coding: utf-8 -*-
"""This is rule-based deduction system for SymPy
The whole thing is split into two parts
- rules compilation and preparation of tables
- runtime inference
For rule-based inference engines, the classical work is RETE algorithm [1],
[2] Although we are not implementing it in full (or even si... |
devexp-db/distgen | refs/heads/master | tests/docker-labels/project.py | 1 | config = {
'macros': {
# Directory under which 'atomic CMD' will mount Host's '/' directory
# into (privileged) container.
'atomic_hostdir': '/host',
# Basic "privileged" docker command
'atomic_docker_pcmd':
"docker run -t -i --rm --privileged -u 0:0 " + \
... |
tobegit3hub/deep_cnn | refs/heads/master | java_predict_client/src/main/proto/tensorflow/contrib/distributions/python/kernel_tests/quantized_distribution_test.py | 12 | # Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
rezoo/chainer | refs/heads/master | chainer/utils/conv_nd_kernel.py | 13 | import functools
import six
from chainer.backends import cuda
def mulexp(xs, init=None):
if init is not None:
return functools.reduce('{} * {}'.format, xs, init)
else:
return functools.reduce('{} * {}'.format, xs)
def andexp(xs, init=None):
if init is not None:
return functools... |
vFense/vFenseAgent-nix | refs/heads/development | agent/deps/rpm/Python-2.7.5/lib/python2.7/test/test_pydoc.py | 42 | import os
import sys
import difflib
import __builtin__
import re
import pydoc
import inspect
import keyword
import unittest
import xml.etree
import test.test_support
from collections import namedtuple
from test.script_helper import assert_python_ok
from test.test_support import (
TESTFN, rmtree, reap_children, capt... |
moraesnicol/scrapy | refs/heads/master | tests/test_urlparse_monkeypatches.py | 155 | from six.moves.urllib.parse import urlparse
import unittest
class UrlparseTestCase(unittest.TestCase):
def test_s3_url(self):
p = urlparse('s3://bucket/key/name?param=value')
self.assertEquals(p.scheme, 's3')
self.assertEquals(p.hostname, 'bucket')
self.assertEquals(p.path, '/key/... |
openstack/tacker | refs/heads/master | tacker/objects/vim_connection.py | 2 | # Copyright (C) 2020 NTT DATA
# 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 ... |
salivatears/ansible | refs/heads/devel | lib/ansible/module_utils/splitter.py | 372 | # (c) 2014 James Cammarata, <jcammarata@ansible.com>
#
# 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 late... |
adviti/melange | refs/heads/master | thirdparty/google_appengine/google/appengine/tools/dev_appserver_login.py | 20 | #!/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... |
jarshwah/django | refs/heads/master | tests/forms_tests/field_tests/test_durationfield.py | 38 | from __future__ import unicode_literals
import datetime
from django.forms import DurationField
from django.test import SimpleTestCase
from django.utils.duration import duration_string
from . import FormFieldAssertionsMixin
class DurationFieldTest(FormFieldAssertionsMixin, SimpleTestCase):
def test_durationfie... |
radiosilence/pip | refs/heads/develop | tests/test_user_site.py | 1 | """
tests specific to "--user" option
"""
import sys
from os.path import abspath, join, curdir, isdir, isfile
from nose import SkipTest
from tests.local_repos import local_checkout
from tests.test_pip import here, reset_env, run_pip, pyversion, assert_all_changes
patch_dist_in_site_packages = """
def dist_in_... |
oktayacikalin/pyglet | refs/heads/pyglet-1.2-maintenance | contrib/layout/tests/layout/INLINE_FORMATTING.py | 29 | #!/usr/bin/env python
'''Test line-height and vertical align properties, using test case from
http://meyerweb.com/eric/css/inline-format.html
The reference rendering is
http://meyerweb.com/eric/css/inline-test-1-gecko.gif
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id: $'
import unittest
import base_layo... |
ToyamaTetsuji/hello-world | refs/heads/master | tests/test_compile.py | 11 | import shutil
import tempfile
import os.path
import json
from nose.tools import eq_
from build_pack_utils import BuildPack
class BaseTestCompile(object):
def set_web_server(self, optsFile, webServer):
options = json.load(open(optsFile))
options['WEB_SERVER'] = webServer
options['DOWNLOAD_U... |
lixxu/sanic | refs/heads/master | tests/test_server_events.py | 1 | import signal
import pytest
from sanic.testing import HOST, PORT
AVAILABLE_LISTENERS = [
"before_server_start",
"after_server_start",
"before_server_stop",
"after_server_stop",
]
skipif_no_alarm = pytest.mark.skipif(
not hasattr(signal, "SIGALRM"),
reason="SIGALRM is not implemented for this... |
miniconfig/home-assistant | refs/heads/dev | tests/components/sensor/test_yahoo_finance.py | 28 | """The tests for the Yahoo Finance platform."""
import json
import unittest
from unittest.mock import patch
import homeassistant.components.sensor as sensor
from homeassistant.setup import setup_component
from tests.common import (
get_test_home_assistant, load_fixture, assert_setup_component)
VALID_CONFIG = {
... |
daevaorn/sentry | refs/heads/master | tests/sentry/nodestore/riak/__init__.py | 2878 | from __future__ import absolute_import
|
williamjmorenor/mkdocs | refs/heads/master | mkdocs/tests/base.py | 30 | from __future__ import unicode_literals
import textwrap
import markdown
from mkdocs import toc
def dedent(text):
return textwrap.dedent(text).strip()
def markdown_to_toc(markdown_source):
md = markdown.Markdown(extensions=['toc'])
md.convert(markdown_source)
toc_output = md.toc
return toc.Table... |
quamilek/django | refs/heads/master | tests/model_fields/test_durationfield.py | 296 | import datetime
import json
from django import forms
from django.core import exceptions, serializers
from django.db import models
from django.test import SimpleTestCase, TestCase
from .models import DurationModel, NullDurationModel
class TestSaveLoad(TestCase):
def test_simple_roundtrip(self):
duration... |
dfdx2/django | refs/heads/master | django/conf/locale/nb/formats.py | 65 | # This file is distributed under the same license as the Django package.
#
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'j. F Y'
TIME_FORMAT = 'H:i'
DATETIME_FORMAT = 'j. F Y H:i'
YEAR_MONTH_FORMAT = 'F Y'
MONTH_DAY_FORMA... |
mbauskar/internal-hr | refs/heads/develop | erpnext/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.py | 10 | # 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 frappe
from frappe import msgprint, _
def execute(filters=None):
if not filters: filters = {}
columns = get_columns(filters)
data = get_... |
marcuskelly/recover | refs/heads/master | Lib/site-packages/pip/utils/glibc.py | 350 | from __future__ import absolute_import
import re
import ctypes
import platform
import warnings
def glibc_version_string():
"Returns glibc version string, or None if not using glibc."
# ctypes.CDLL(None) internally calls dlopen(NULL), and as the dlopen
# manpage says, "If filename is NULL, then the retur... |
mdaniel/intellij-community | refs/heads/master | python/testData/completion/heavyStarPropagation/lib/_pkg0/_pkg0_0/_pkg0_0_1/_pkg0_0_1_0/_pkg0_0_1_0_1/__init__.py | 30 | from ._mod0_0_1_0_1_0 import *
from ._mod0_0_1_0_1_1 import *
from ._mod0_0_1_0_1_2 import *
from ._mod0_0_1_0_1_3 import *
from ._mod0_0_1_0_1_4 import * |
ubreddy/cubes | refs/heads/master | cubes/namespace.py | 7 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from .errors import NoSuchCubeError, NoSuchDimensionError
from .common import read_json_file
from . import compat
__all__ = [
"Namespace",
]
class Namespace(object):
def __init__(self, name=None, parent=None):
"""Creates a cubes namespac... |
TeamExodus/external_chromium_org | refs/heads/EXODUS-5.1 | tools/usb_gadget/gadget.py | 54 | # 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.
"""Generic USB gadget functionality.
"""
import struct
import usb_constants
class Gadget(object):
"""Basic functionality for a USB device.
Implement... |
udibr/fuel | refs/heads/master | fuel/datasets/binarized_mnist.py | 15 | # -*- coding: utf-8 -*-
from fuel.datasets import H5PYDataset
from fuel.utils import find_in_data_path
class BinarizedMNIST(H5PYDataset):
u"""Binarized, unlabeled MNIST dataset.
MNIST (Mixed National Institute of Standards and Technology) [LBBH] is
a database of handwritten digits. It is one of the most ... |
eammx/proyectosWeb | refs/heads/master | proyectoPython/env/lib/python3.6/site-packages/pip/_internal/req/req_file.py | 7 | """
Requirements file parsing
"""
# The following comment should be removed at some point in the future.
# mypy: strict-optional=False
from __future__ import absolute_import
import optparse
import os
import re
import shlex
import sys
from pip._vendor.six.moves import filterfalse
from pip._vendor.six.moves.urllib im... |
leafclick/intellij-community | refs/heads/master | python/testData/inspections/PyAsyncCallInspection/ScheduleFutureBuiltin/a.py | 14 | import asyncio
async def nested():
print("42")
async def main():
# Schedule nested() to run soon concurrently with "main()".
asyncio.ensure_future(nested()) # new in Python 3.4
async def foo():
loop = asyncio.get_running_loop()
loop.create_task(nested()) # new in Python 3.4
loop.run_in_... |
jjmleiro/hue | refs/heads/master | desktop/core/ext-py/boto-2.38.0/boto/mashups/__init__.py | 782 | # Copyright (c) 2006,2007 Mitch Garnaat http://garnaat.org/
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modi... |
mariocesar/django-rocket | refs/heads/master | django_rocket/migrations/0001_initial.py | 1 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='InvitationToken',
fields=[
('id', models.AutoFi... |
ipaccess/fsm99xx-kernel-sources | refs/heads/master | Documentation/target/tcm_mod_builder.py | 2358 | #!/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: nab@kernel.org
#
import os, sys
import subprocess as sub
import string
import re
import optparse
tcm_dir = ""
fabric_ops... |
servioticy/servioticy-demo | refs/heads/master | cellphones-wp2demo/brain/venv/lib/python2.7/site-packages/pip/_vendor/distlib/index.py | 571 | # -*- coding: utf-8 -*-
#
# Copyright (C) 2013 Vinay Sajip.
# Licensed to the Python Software Foundation under a contributor agreement.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
import hashlib
import logging
import os
import shutil
import subprocess
import tempfile
try:
from threading import Thread
except ImportErr... |
dfc/beets | refs/heads/master | test/test_embedart.py | 15 | # This file is part of beets.
# Copyright 2015, Thomas Scholtes.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy,... |
Eric89GXL/mne-python | refs/heads/master | mne/viz/backends/_pyvista.py | 2 | """
Core visualization operations based on PyVista.
Actual implementation of _Renderer and _Projection classes.
"""
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Eric Larson <larson.eric.d@gmail.com>
# Guillaume Favelier <guillaume.favelier@gmail.com>
# Joan Massich <mailsik... |
Cubitect/ASMModSuit | refs/heads/master | Krakatau-master/Krakatau/ssa/mixin.py | 8 | class ValueType(object):
'''Define _key() and inherit from this class to implement comparison and hashing'''
# def __init__(self, *args, **kwargs): super(ValueType, self).__init__(*args, **kwargs)
def __eq__(self, other): return type(self) == type(other) and self._key() == other._key()
def __ne__(self, ... |
LuxoftAKutsan/sdl_core | refs/heads/feature/sdl_remote_control_baseline | src/components/dbus/codegen/make_qml_dbus_cpp.py | 13 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# @file make_qml_dbus_cpp.py
# @brief Generator of QML to QDbus C++ part
#
# This file is a part of HMI D-Bus layer.
#
# Copyright (c) 2013, Ford Motor Company
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification,... |
c0710204/edx-platform | refs/heads/master | lms/djangoapps/course_wiki/views.py | 32 | """
This file contains view functions for wrapping the django-wiki.
"""
import logging
import re
import cgi
from django.conf import settings
from django.contrib.sites.models import Site
from django.core.exceptions import ImproperlyConfigured
from django.shortcuts import redirect
from django.utils.translation import ug... |
mjg/PyX-svn | refs/heads/trunk | manual/graph2.py | 2 | from pyx import *
g = graph.graphxy(width=8)
g.plot(graph.data.file("graph.dat", x=1, y=2))
g.plot(graph.data.function("y(x)=x**2"))
g.writePDFfile()
|
krintoxi/NoobSec-Toolkit | refs/heads/master | NoobSecToolkit - MAC OSX/tools/sqli/plugins/dbms/mysql/connector.py | 10 | #!/usr/bin/env python
"""
Copyright (c) 2006-2015 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
try:
import pymysql
except ImportError:
pass
import logging
from lib.core.data import conf
from lib.core.data import logger
from lib.core.exception import SqlmapConn... |
GiladE/birde | refs/heads/master | venv/lib/python2.7/site-packages/django/db/backends/schema.py | 9 | import hashlib
import operator
from django.db.backends.creation import BaseDatabaseCreation
from django.db.backends.utils import truncate_name
from django.db.models.fields.related import ManyToManyField
from django.db.transaction import atomic
from django.utils.encoding import force_bytes
from django.utils.log import ... |
cloudbase/neutron | refs/heads/master | neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/openflow/native/test_ovs_bridge.py | 4 | # Copyright (c) 2016 Mirantis, 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 requir... |
factorlibre/OCB | refs/heads/8.0 | addons/account_voucher/report/__init__.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... |
tlgs/dailyprogrammer | refs/heads/master | Python/easy/e395.py | 1 | # 22/06/2021
import itertools
def nonogramrow(seq):
return [sum(g) for k, g in itertools.groupby(seq) if k]
assert nonogramrow([]) == []
assert nonogramrow([0, 0, 0, 0, 0]) == []
assert nonogramrow([1, 1, 1, 1, 1]) == [5]
assert nonogramrow([0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1]) == [5, 4]
assert nonogramrow([1, 1, ... |
WillisXChen/django-oscar | refs/heads/master | oscar/lib/python2.7/site-packages/IPython/lib/editorhooks.py | 8 | """ 'editor' hooks for common editors that work well with ipython
They should honor the line number argument, at least.
Contributions are *very* welcome.
"""
from __future__ import print_function
import os
import pipes
import subprocess
from IPython import get_ipython
from IPython.core.error import TryNext
from IPy... |
kostajh/bugwarrior | refs/heads/develop | bugwarrior/services/phab.py | 2 | from builtins import str
import six
from bugwarrior.config import aslist
from bugwarrior.services import IssueService, Issue
# This comes from PyPI
import phabricator
import logging
log = logging.getLogger(__name__)
class PhabricatorIssue(Issue):
TITLE = 'phabricatortitle'
URL = 'phabricatorurl'
TYPE =... |
samuelmaudo/yepes | refs/heads/master | yepes/utils/unidecode/x0ad.py | 253 | data = (
'gwan', # 0x00
'gwanj', # 0x01
'gwanh', # 0x02
'gwad', # 0x03
'gwal', # 0x04
'gwalg', # 0x05
'gwalm', # 0x06
'gwalb', # 0x07
'gwals', # 0x08
'gwalt', # 0x09
'gwalp', # 0x0a
'gwalh', # 0x0b
'gwam', # 0x0c
'gwab', # 0x0d
'gwabs', # 0x0e
'gwas', # 0x0f
'gwass', #... |
ZellMechanik-Dresden/dclab | refs/heads/master | dclab/cached.py | 1 | """
Cache for fast "recomputation"
"""
import gc
import hashlib
import numpy as np
MAX_SIZE = 100
class Cache(object):
_cache = {}
_keys = []
def __init__(self, func):
"""
A cache that can be used to decorate methods that accept
numpy ndarrays as arguments.
- cache is ... |
pyropeter/archweb | refs/heads/master | mirrors/models.py | 1 | from django.db import models
TIER_CHOICES = (
(0, 'Tier 0'),
(1, 'Tier 1'),
(2, 'Tier 2'),
(-1, 'Untiered'),
)
class Mirror(models.Model):
name = models.CharField(max_length=255)
tier = models.SmallIntegerField(default=2, choices=TIER_CHOICES)
upstream = models.ForeignKey('self', null=True... |
odejesush/tensorflow | refs/heads/master | venv/lib/python2.7/copy_reg.py | 4 | /usr/lib/python2.7/copy_reg.py |
maheshakya/scikit-learn | refs/heads/master | sklearn/preprocessing/_weights.py | 20 | import numpy as np
def _balance_weights(y):
"""Compute sample weights such that the class distribution of y becomes
balanced.
Parameters
----------
y : array-like
Labels for the samples.
Returns
-------
weights : array-like
The sample weights.
"""
y = np.as... |
shakamunyi/tensorflow | refs/heads/master | tensorflow/contrib/fused_conv/python/ops/fused_conv2d_bias_activation_benchmark.py | 40 | # 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... |
swieder227/three.js | refs/heads/master | utils/exporters/blender/addons/io_three/dialogs.py | 299 | from bpy import context
CONTEXT = {
0: {
'title': "Error Message",
'icon': 'CANCEL'
},
1: {
'title': "Warning Message",
'icon': 'ERROR' # I prefer this icon for warnings
},
2: {
'title': "Message",
'icon': 'NONE'
},
3: {
'title': "Ques... |
felixonmars/braintree_python | refs/heads/master | tests/unit/test_signature_service.py | 2 | from tests.test_helper import *
class FakeDigest(object):
@staticmethod
def hmac_hash(key, data):
return "%s_signed_with_%s" % (data, key)
class TestSignatureService(unittest.TestCase):
def test_hashes_with_digest(self):
signature_service = SignatureService("fake_key", FakeDigest.hmac_ha... |
Arthur2e5/arguman.org | refs/heads/master | web/nouns/migrations/0012_auto_20151102_2209.py | 3 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('nouns', '0011_auto_20151102_2154'),
]
operations = [
migrations.RenameModel('Synonym', 'Keyword')
]
|
allmende/synnefo | refs/heads/develop | snf-admin-app/synnefo_admin/admin/resources/groups/utils.py | 32 | # Copyright (C) 2010-2014 GRNET S.A.
#
# 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 program is distributed i... |
ptoraskar/django | refs/heads/master | tests/known_related_objects/tests.py | 363 | from __future__ import unicode_literals
from django.test import TestCase
from .models import Organiser, Pool, PoolStyle, Tournament
class ExistingRelatedInstancesTests(TestCase):
@classmethod
def setUpTestData(cls):
cls.t1 = Tournament.objects.create(name='Tourney 1')
cls.t2 = Tournament.ob... |
h3biomed/ansible | refs/heads/h3 | lib/ansible/module_utils/network/netconf/netconf.py | 33 | #
# (c) 2018 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
# (at your option) any later version.
#
# Ansible is ... |
aesquis/Introduccion-a-la-programacion-con-Python | refs/heads/master | 11-Como-guardar-informacion-en-archivos/examples.py | 1 | # access mode
# r Read the file
# w Write the file
# a Append the file
# b Open a binary file
# w+ Significa lectura/esccriptura
#fileName = 'demo.txt'
#WRITE = 'w'
#READ = 'r'
#APPEND = 'a'
#READWRITE = 'w+'
#file = open(fileName, mode = WRITE)
#file.write("Hi there!\n")
#file.... |
fertozudo/umatoo | refs/heads/master | lib/django/contrib/messages/__init__.py | 741 | from django.contrib.messages.api import * # NOQA
from django.contrib.messages.constants import * # NOQA
default_app_config = 'django.contrib.messages.apps.MessagesConfig'
|
huangy6/vroombot | refs/heads/master | lib/python2.7/site-packages/pip/_vendor/requests/hooks.py | 1891 | # -*- coding: utf-8 -*-
"""
requests.hooks
~~~~~~~~~~~~~~
This module provides the capabilities for the Requests hooks system.
Available hooks:
``response``:
The response generated from a Request.
"""
HOOKS = ['response']
def default_hooks():
hooks = {}
for event in HOOKS:
hooks[event] = []... |
gregdek/ansible | refs/heads/devel | lib/ansible/modules/cloud/cloudstack/cs_host.py | 13 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# (c) 2016, René Moser <mail@renemoser.net>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the Lice... |
queirozfcom/spam-filter | refs/heads/master | case3_naive_gumbel_l.py | 1 | import numpy as np
import scipy.stats as stats
import sys
# lib eh a nossa biblioteca criada para este trabalho
import lib.naive_bayes as nb
import lib.preprocessing as prep
import lib.validation as valid
import lib.normalization as normal
from config.constants import *
def case3(output=True):
accuracy_in_eac... |
pystruct/pystruct | refs/heads/master | pystruct/learners/svm.py | 5 | import numpy as np
import cvxopt
import cvxopt.solvers
class SVM(object):
def __init__(self, C=1.0):
self.C = float(C)
def fit(self, X, y):
n_samples, n_features = X.shape
Xy = X * y[:, np.newaxis]
P = cvxopt.matrix(np.dot(Xy, Xy.T))
q = cvxopt.matrix(np.ones(n_sampl... |
dennisobrien/bokeh | refs/heads/master | bokeh/sampledata/tests/test_olympics2014.py | 3 | #-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2017, Anaconda, Inc. All rights reserved.
#
# Powered by the Bokeh Development Team.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#---------------------------------------------------... |
Tschis/NabBot | refs/heads/master | utils/help_format.py | 1 | import inspect
import itertools
from discord.ext import commands
class NabHelpFormat(commands.HelpFormatter):
def get_ending_note(self):
command_name = self.context.invoked_with
if self.has_subcommands() and not self.is_bot():
return "Type {0} <subcommand> for more info on a command.... |
WillGuan105/django | refs/heads/master | tests/app_loading/tests.py | 288 | from __future__ import unicode_literals
import os
from django.apps import apps
from django.test import SimpleTestCase
from django.test.utils import extend_sys_path
from django.utils import six
from django.utils._os import upath
class EggLoadingTest(SimpleTestCase):
def setUp(self):
self.egg_dir = '%s/e... |
urielarg/pyramid_crud | refs/heads/master | docs/conf.py | 2 | # -*- coding: utf-8 -*-
#
# pyramid_crud documentation build configuration file, created by
# sphinx-quickstart on Wed Mar 12 12:47:26 2014.
#
# 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.
#
... |
AlexCatarino/Lean | refs/heads/master | Algorithm.Python/ConvertToFrameworkAlgorithm.py | 3 | # QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
# Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
#
# 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 Licen... |
adrienbrault/home-assistant | refs/heads/dev | tests/components/hassio/test_websocket_api.py | 4 | """Test websocket API."""
from homeassistant.components.hassio.const import (
ATTR_DATA,
ATTR_ENDPOINT,
ATTR_METHOD,
ATTR_WS_EVENT,
EVENT_SUPERVISOR_EVENT,
WS_ID,
WS_TYPE,
WS_TYPE_API,
WS_TYPE_SUBSCRIBE,
)
from homeassistant.core import HomeAssistant
from homeassistant.helpers.dispat... |
FiloSottile/youtube-dl | refs/heads/master | youtube_dl/extractor/gazeta.py | 125 | # coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
class GazetaIE(InfoExtractor):
_VALID_URL = r'(?P<url>https?://(?:www\.)?gazeta\.ru/(?:[^/]+/)?video/(?:(?:main|\d{4}/\d{2}/\d{2})/)?(?P<id>[A-Za-z0-9-_.]+)\.s?html)'
_TESTS = [{
'url': 'http://www.ga... |
niavlys/kivy | refs/heads/master | examples/widgets/effectwidget.py | 1 | '''
Example usage of the effectwidget.
Currently highly experimental.
'''
from kivy.app import App
from kivy.uix.effectwidget import EffectWidget
from kivy.uix.image import Image
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.scatter import Scatter
from kivy.uix.button import Button
from kivy.uix.spinner ... |
mpercich/Calendarize | refs/heads/master | ios/dateparser/lib/python2.7/site-packages/packaging/__about__.py | 771 | # This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function
__all__ = [
"__title__", "__summary__", "__uri__", "__version__", "__a... |
40223202/2015cdb_g2 | refs/heads/master | 2015scrum-3a6fed94d45237e506e5e1539e27a2c9e89e6740/static/Brython3.1.1-20150328-091302/Lib/browser/markdown.py | 623 | # -*- coding: utf-8 -*-
try:
import _jsre as re
except:
import re
import random
import time
letters = 'abcdefghijklmnopqrstuvwxyz'
letters += letters.upper()+'0123456789'
class URL:
def __init__(self,src):
elts = src.split(maxsplit=1)
self.href = elts[0]
self.alt = ''
if ... |
udacity/ggplot | refs/heads/master | examples/smooth.py | 13 | from ggplot import *
print (ggplot(aes(x='date', y='beef'), data=meat) + \
geom_point(alpha=0.3) + \
stat_smooth(colour="black", se=True))
plt.show(1)
|
jonyroda97/redbot-amigosprovaveis | refs/heads/develop | lib/youtube_dl/extractor/reddit.py | 10 | from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
ExtractorError,
int_or_none,
float_or_none,
)
class RedditIE(InfoExtractor):
_VALID_URL = r'https?://v\.redd\.it/(?P<id>[^/?#&]+)'
_TEST = {
# from https://www.reddit.com/r/videos/co... |
tbachman/python-group-based-policy-client | refs/heads/master | gbpclient/tests/unit/test_cli20.py | 1 | # 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... |
ykaneko/ryu | refs/heads/master | ryu/controller/conf_switch.py | 25 | # Copyright (C) 2012 Nippon Telegraph and Telephone Corporation.
# Copyright (C) 2012 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... |
thechampanurag/django-oscar | refs/heads/master | src/oscar/apps/shipping/admin.py | 63 | from django.contrib import admin
from oscar.core.loading import get_model
OrderAndItemCharges = get_model('shipping', 'OrderAndItemCharges')
WeightBand = get_model('shipping', 'WeightBand')
WeightBased = get_model('shipping', 'WeightBased')
class OrderChargesAdmin(admin.ModelAdmin):
filter_horizontal = ('countr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.