repo_name stringlengths 5 100 | ref stringlengths 12 67 | path stringlengths 4 244 | copies stringlengths 1 8 | content stringlengths 0 1.05M ⌀ |
|---|---|---|---|---|
AuyaJackie/odoo | refs/heads/8.0 | addons/website_gengo/controllers/main.py | 350 | # -*- coding: utf-8 -*-
import openerp
from openerp import http, SUPERUSER_ID
from openerp.http import request
import time
GENGO_DEFAULT_LIMIT = 20
class website_gengo(http.Controller):
@http.route('/website/get_translated_length', type='json', auth='user', website=True)
def get_translated_length(self, tran... |
vng/omim | refs/heads/master | 3party/freetype/src/tools/docmaker/content.py | 97 | #
# content.py
#
# Parse comment blocks to build content blocks (library file).
#
# Copyright 2002-2015 by
# David Turner.
#
# This file is part of the FreeType project, and may only be used,
# modified, and distributed under the terms of the FreeType project
# license, LICENSE.TXT. By continuing to use, modi... |
aonotas/chainer | refs/heads/master | tests/chainer_tests/functions_tests/connection_tests/test_convolution_nd.py | 1 | import unittest
import functools
import numpy
from operator import mul
import chainer
from chainer.backends import cuda
import chainer.functions as F
from chainer import gradient_check
from chainer import testing
from chainer.testing import attr
from chainer.testing import condition
from chainer.utils import conv
@... |
chenc10/Spark-PAF | refs/heads/master | ec2/lib/boto-2.34.0/boto/gs/bucketlistresultset.py | 168 | # Copyright 2012 Google Inc.
# 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 ... |
minhphung171093/OpenERP_V7 | refs/heads/master | openerp/addons/document/test_cindex.py | 444 | #!/usr/bin/python
import sys
import os
import glob
import time
import logging
from optparse import OptionParser
logging.basicConfig(level=logging.DEBUG)
parser = OptionParser()
parser.add_option("-q", "--quiet",
action="store_false", dest="verbose", default=True,
help="don't prin... |
pireerliu/ardupilot | refs/heads/master | Tools/LogAnalyzer/tests/TestAutotune.py | 265 | from LogAnalyzer import Test,TestResult
import DataflashLog
# from ArduCopter/defines.h
AUTOTUNE_INITIALISED = 30
AUTOTUNE_OFF = 31
AUTOTUNE_RESTART = 32
AUTOTUNE_SUCCESS = 33
AUTOTUNE_FAILED = 34
AUTOTUNE_REACHED_LIMIT = 35
AUTOTUNE_PILOT_TESTING = 36
AUTOTUN... |
zitouni/gnuradio-3.6.1 | refs/heads/master | volk/gen/volk_kernel_defs.py | 7 | #
# Copyright 2011-2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version... |
miguelpeixe/mapaguarani | refs/heads/master | mapaguarani/core/management/commands/import_village_layer.py | 1 | from django.core.management.base import BaseCommand, CommandError
from django.contrib.gis.utils import LayerMapping
from django.contrib.gis.gdal import DataSource
from core.models import IndigenousVillage, MapLayer, EthnicGroup, GuaraniPresence, Population, ProminentEthnicSubGroup
import datetime
class Command(BaseC... |
Zerglrisk/binnavi | refs/heads/master | src/main/java/com/google/security/zynamics/binnavi/scripts/mono/sample/sample.py | 70 | """
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 agr... |
Vassius/ttrss-python | refs/heads/master | ttrss/auth.py | 1 | from requests.auth import AuthBase
import requests
import json
from ttrss.exceptions import raise_on_error
class TTRAuth(AuthBase):
def __init__(self, user, password, http_auth):
self.user = user
self.password = password
self.http_auth = http_auth
self.sid = None
def response_... |
GeekTrainer/Flask | refs/heads/master | Work/Trivia - Module 5/env/Lib/site-packages/pip/commands/help.py | 401 | from pip.basecommand import Command, SUCCESS
from pip.exceptions import CommandError
class HelpCommand(Command):
"""Show help for commands"""
name = 'help'
usage = """
%prog <command>"""
summary = 'Show help for commands.'
def run(self, options, args):
from pip.commands import comma... |
kwailamchan/programming-languages | refs/heads/master | python/django/elf/elf/src/todo/migrations/0002_auto_20141003_1941.py | 3 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('todo', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='todo',
name='donetime',
... |
theogofen/bitsbot | refs/heads/master | btcebot/trader.py | 2 | # Copyright (c) 2013 Alan McIntyre
import btceapi
import decimal
import logging
logger = logging.getLogger()
class TraderBase(object):
def __init__(self, pairs):
self.pairs = pairs
def onNewDepth(self, t, pair, asks, bids):
pass
def onNewTradeHistory(self, t, pair, trades):
pass... |
joelby/heroku-buildpack-python-scikit-learn-git | refs/heads/master | vendor/distribute-0.6.36/setuptools/tests/test_develop.py | 66 | """develop tests
"""
import sys
import os, shutil, tempfile, unittest
import tempfile
import site
from StringIO import StringIO
from distutils.errors import DistutilsError
from setuptools.command.develop import develop
from setuptools.command import easy_install as easy_install_pkg
from setuptools.dist import Distribu... |
xguse/bokeh | refs/heads/master | sphinx/source/docs/user_guide/source_examples/tools_position_toolbar.py | 63 | from bokeh.plotting import figure, output_file, show
output_file("toolbar.html")
# create a new plot with the toolbar below
p = figure(plot_width=400, plot_height=400,
title=None, toolbar_location="below")
p.circle([1, 2, 3, 4, 5], [2, 5, 8, 2, 7], size=10)
show(p)
|
gchild320/flo | refs/heads/m | arch/ia64/scripts/unwcheck.py | 13143 | #!/usr/bin/python
#
# Usage: unwcheck.py FILE
#
# This script checks the unwind info of each function in file FILE
# and verifies that the sum of the region-lengths matches the total
# length of the function.
#
# Based on a shell/awk script originally written by Harish Patil,
# which was converted to Perl by Matthew Ch... |
benob/icsisumm | refs/heads/master | icsisumm-primary-sys34_v1/nltk/nltk-0.9.2/nltk_contrib/fst/__init__.py | 9 | """
Finite state transducer support, including graphical display & demo,
and interface code for AT&T fsmtools.
"""
|
nicko96/Chrome-Infra | refs/heads/master | appengine/chromium_rietveld/tools/remote_api.py | 2 | #!/usr/bin/env python
# Copyright 2011 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... |
mhvk/astropy | refs/heads/placeholder | astropy/modeling/tabular.py | 5 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Tabular models.
Tabular models of any dimension can be created using `tabular_model`.
For convenience `Tabular1D` and `Tabular2D` are provided.
Examples
--------
>>> table = np.array([[ 3., 0., 0.],
... [ 0., 2., 0.],
... ... |
xj9/indieinvasion.net | refs/heads/master | libs/jinja2/constants.py | 220 | # -*- coding: utf-8 -*-
"""
jinja.constants
~~~~~~~~~~~~~~~
Various constants.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
#: list of lorem ipsum words used by the lipsum() helper function
LOREM_IPSUM_WORDS = u'''\
a ac accumsan ad adipiscing aenean a... |
polimediaupv/edx-platform | refs/heads/master | lms/djangoapps/shoppingcart/tests/payment_fake.py | 127 | # -*- coding: utf-8 -*-
"""
Fake payment page for use in acceptance tests.
This view is enabled in the URLs by the feature flag `ENABLE_PAYMENT_FAKE`.
Note that you will still need to configure this view as the payment
processor endpoint in order for the shopping cart to use it:
settings.CC_PROCESSOR['CyberSource... |
ultilix/catawampus | refs/heads/master | tr/vendor/tornado/tornado/ioloop.py | 5 | #!/usr/bin/env python
#
# Copyright 2009 Facebook
#
# 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 a... |
gabrielfalcao/lettuce | refs/heads/master | tests/integration/lib/Django-1.3/django/contrib/localflavor/fr/forms.py | 309 | """
FR-specific Form helpers
"""
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select
from django.utils.encoding import smart_unicode
from django.utils.translation import ugettext_lazy as _
import re
phone_digits_re = re.com... |
jbzdak/edx-platform | refs/heads/master | openedx/core/djangoapps/content/course_overviews/management/commands/generate_course_overview.py | 29 | """
Command to load course overviews.
"""
import logging
from optparse import make_option
from django.core.management.base import BaseCommand, CommandError
from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import CourseKey
from xmodule.modulestore.django import modulestore
from openedx.core.djangoapps... |
javierTerry/odoo | refs/heads/8.0 | addons/website_instantclick/__openerp__.py | 342 | {
'name': 'Website Instantclick',
'category': 'Website',
'summary': 'Preloads and speeds up website on public browsing of the website using Instantclick.',
'version': '1.0',
'description': """
Preloads data on anonymous mode of website
==========================================
""",
'au... |
cntnboys/410Lab6 | refs/heads/master | build/django/django/conf/locale/ja/formats.py | 83 | # -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'Y年n月j日'
TIME_FORMAT = 'G:i:s'
DAT... |
johnmgregoire/JCAPGeneratePrintCode | refs/heads/master | xxgenplatemap9.py | 1 | import numpy,pylab
def rgb_comp(terncoordlist):
cmy_cmyk=lambda a:a[:3]*(1.-a[3])+a[3]
rgb_cmy=lambda a:1.-a
rgb_cmyk=lambda a:rgb_cmy(cmy_cmyk(a))
return numpy.array([rgb_cmyk(numpy.array(a)) for a in terncoordlist])
sc=2.032
#xy=numpy.array([(x,y) for x in numpy.linspace(-25,25,51) for y i... |
Edu-Glez/Bank_sentiment_analysis | refs/heads/master | env/lib/python3.6/site-packages/prompt_toolkit/styles/utils.py | 23 | from __future__ import unicode_literals
from .base import DEFAULT_ATTRS, Attrs
__all__ = (
'split_token_in_parts',
'merge_attrs',
)
def split_token_in_parts(token):
"""
Take a Token, and turn it in a list of tokens, by splitting
it on ':' (taking that as a separator.)
"""
result = []
... |
eyolfson/django-ssh | refs/heads/dependabot/pip/django-3.1.12 | django_ssh/forms.py | 1 | # Copyright 2014 Jon Eyolfson
#
# This file is part of Django SSH.
#
# Django SSH 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.
#
# D... |
OpusVL/odoo | refs/heads/master | openerp/cli/templates/theme/__openerp__.py | 73 | {
# Theme information
'name': "{{name}}",
'description': """
""",
'category': 'Theme',
'version': '1.0',
'depends': ['website'],
# templates, pages, and snippets
'data': [
'views/pages.xml',
'views/options.xml',
'views/snippets.xml',
],
# Your inform... |
xiaognol/android_kernel_zte_nx503a-4.2 | refs/heads/jb-4.2 | arch/ia64/scripts/unwcheck.py | 13143 | #!/usr/bin/python
#
# Usage: unwcheck.py FILE
#
# This script checks the unwind info of each function in file FILE
# and verifies that the sum of the region-lengths matches the total
# length of the function.
#
# Based on a shell/awk script originally written by Harish Patil,
# which was converted to Perl by Matthew Ch... |
ddico/sale-workflow | refs/heads/8.0 | sale_automatic_workflow_exception/automatic_workflow_job.py | 8 | # -*- coding: utf-8 -*-
# © 2014-2016 Akretion (http://www.akretion.com)
# Sébastien BEAU <sebastien.beau@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import api, models
class AutomaticWorkflowJob(models.Model):
_inherit = 'automatic.workflow.job'
@api.mult... |
jmt4/django-oscar | refs/heads/master | src/oscar/apps/customer/notifications/services.py | 56 | from oscar.core.loading import get_model
Notification = get_model('customer', 'Notification')
def notify_user(user, msg, **kwargs):
"""
Send a simple notification to a user
"""
Notification.objects.create(recipient=user, subject=msg, **kwargs)
def notify_users(users, msg, **kwargs):
"""
Sen... |
faneshion/MatchZoo | refs/heads/master | matchzoo/metrics/normalized_discounted_cumulative_gain.py | 1 | """Normalized discounted cumulative gain metric for ranking."""
import numpy as np
from matchzoo.engine.base_metric import BaseMetric, sort_and_couple
from .discounted_cumulative_gain import DiscountedCumulativeGain
class NormalizedDiscountedCumulativeGain(BaseMetric):
"""Normalized discounted cumulative gain me... |
huard/scipy-work | refs/heads/master | scipy/sparse/linalg/dsolve/__init__.py | 2 | "Direct Solvers for Sparse Linear Systems"
from info import __doc__
#import umfpack
#__doc__ = '\n\n'.join( (__doc__, umfpack.__doc__) )
#del umfpack
from linsolve import *
__all__ = filter(lambda s:not s.startswith('_'),dir())
from numpy.testing import Tester
test = Tester().test
|
dsajkl/reqiop | refs/heads/master | common/lib/capa/capa/safe_exec/__init__.py | 285 | """Capa's specialized use of codejail.safe_exec."""
from .safe_exec import safe_exec, update_hash
|
mrquim/mrquimrepo | refs/heads/master | repo/script.module.youtube.dl/lib/youtube_dl/extractor/onet.py | 37 | # coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
determine_ext,
ExtractorError,
float_or_none,
get_element_by_class,
int_or_none,
js_to_json,
NO_DEFAULT,
parse_iso8601,
remove_start,
strip_or_none,
url... |
Zord13appdesa/python-for-android | refs/heads/master | python3-alpha/python3-src/Tools/scripts/untabify.py | 49 | #! /usr/bin/env python3
"Replace tabs with spaces in argument files. Print names of changed files."
import os
import sys
import getopt
import tokenize
def main():
tabsize = 8
try:
opts, args = getopt.getopt(sys.argv[1:], "t:")
if not args:
raise getopt.error("At least one file ar... |
yeming233/horizon | refs/heads/master | openstack_dashboard/dashboards/project/routers/ports/views.py | 25 | # Copyright 2012, Nachi Ueno, NTT MCL, 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 applic... |
pythonhacker/pyconindia2017concurrency | refs/heads/master | intgen.py | 1 | import random
nums=list(range(10, 1000000))
for i in range(10000):
mynums = random.sample(nums, 1000)
# Write first 1000 numbers in a file
fname = 'numbers/num_%d.txt' % (i + 1)
print('Making',fname,'...')
open(fname, 'w').writelines(map(lambda x: str(x) + '\n', mynums))
|
DepthDeluxe/ansible | refs/heads/devel | lib/ansible/parsing/yaml/__init__.py | 2520 | # (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.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) an... |
apache/stratos | refs/heads/master | components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/databridge/thrift/thrift/TSerialization.py | 184 | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
willhardy/django | refs/heads/master | tests/admin_scripts/complex_app/models/foo.py | 581 | from django.db import models
class Foo(models.Model):
name = models.CharField(max_length=5)
class Meta:
app_label = 'complex_app'
|
furbrain/Coherence | refs/heads/maintain/0.6.x | coherence/upnp/devices/wan_device_client.py | 4 | # -*- coding: utf-8 -*-
# Licensed under the MIT license
# http://opensource.org/licenses/mit-license.php
# Copyright 2010 Frank Scholz <dev@coherence-project.org>
from coherence.upnp.devices.wan_connection_device_client import WANConnectionDeviceClient
from coherence.upnp.services.clients.wan_common_interface_conf... |
gencer/sentry | refs/heads/master | tests/acceptance/test_dashboard.py | 1 | from __future__ import absolute_import
from django.utils import timezone
from sentry.testutils import AcceptanceTestCase
class DashboardTest(AcceptanceTestCase):
def setUp(self):
super(DashboardTest, self).setUp()
self.user = self.create_user('foo@example.com')
self.org = self.create_org... |
dhruvagarwal/django | refs/heads/master | django/contrib/humanize/templatetags/humanize.py | 526 | # -*- encoding: utf-8 -*-
from __future__ import unicode_literals
import re
from datetime import date, datetime
from decimal import Decimal
from django import template
from django.conf import settings
from django.template import defaultfilters
from django.utils.encoding import force_text
from django.utils.formats imp... |
MattiasFredriksson/Blender-Projection_Ops | refs/heads/master | 2.79/projection_ops/funcs_tri.py | 4 | import sys
from math import *
from mathutils import *
class TriBias :
bias = 0.00001
def averageTexCoord(triFace, uvw, uv_lay) :
""" Calculates the Texture UV coordinates from the specified barycentric coords
"""
uv = triFace.loops[0][uv_lay].uv * uvw[0]
uv += triFace.loops[1][uv_lay].uv * uvw[1]
uv += triFace.... |
openstack/smaug | refs/heads/master | karbor/api/v1/router.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... |
fabioticconi/scikit-learn | refs/heads/master | sklearn/datasets/tests/test_mldata.py | 384 | """Test functionality of mldata fetching utilities."""
import os
import shutil
import tempfile
import scipy as sp
from sklearn import datasets
from sklearn.datasets import mldata_filename, fetch_mldata
from sklearn.utils.testing import assert_in
from sklearn.utils.testing import assert_not_in
from sklearn.utils.test... |
markap/TravelMap | refs/heads/master | boilerplate/external/httplib2/socks.py | 91 | """SocksiPy - Python SOCKS module.
Version 1.00
Copyright 2006 Dan-Haim. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
... |
elijah513/tweepy | refs/heads/master | tweepy/parsers.py | 51 | # Tweepy
# Copyright 2009-2010 Joshua Roesslein
# See LICENSE for details.
from __future__ import print_function
from tweepy.models import ModelFactory
from tweepy.utils import import_simplejson
from tweepy.error import TweepError
class Parser(object):
def parse(self, method, payload):
"""
Pars... |
pforret/python-for-android | refs/heads/master | python-build/python-libs/gdata/build/lib/gdata/tlslite/Session.py | 359 | """Class representing a TLS session."""
from utils.compat import *
from mathtls import *
from constants import *
class Session:
"""
This class represents a TLS session.
TLS distinguishes between connections and sessions. A new
handshake creates both a connection and a session. Data is
transmitt... |
tequa/ammisoft | refs/heads/master | ammimain/WinPython-64bit-2.7.13.1Zero/python-2.7.13.amd64/Lib/aifc.py | 29 | """Stuff to parse AIFF-C and AIFF files.
Unless explicitly stated otherwise, the description below is true
both for AIFF-C files and AIFF files.
An AIFF-C file has the following structure.
+-----------------+
| FORM |
+-----------------+
| <size> |
+----+------------+
| | AIFC ... |
bakhtout/odoo-educ | refs/heads/8.0 | addons/payment_paypal/tests/test_paypal.py | 378 | # -*- coding: utf-8 -*-
from openerp.addons.payment.models.payment_acquirer import ValidationError
from openerp.addons.payment.tests.common import PaymentAcquirerCommon
from openerp.addons.payment_paypal.controllers.main import PaypalController
from openerp.tools import mute_logger
from lxml import objectify
import u... |
FlorianLudwig/odoo | refs/heads/8.0 | addons/account_budget/account_budget.py | 194 | # -*- 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... |
evernym/plenum | refs/heads/master | plenum/test/req_handler/test_txn_author_agreement_disable_handler.py | 2 | import pytest as pytest
from plenum.common.util import get_utc_epoch
from plenum.server.request_handlers.txn_author_agreement_disable_handler import TxnAuthorAgreementDisableHandler
from plenum.test.req_handler.conftest import taa_request
from storage.kv_in_memory import KeyValueStorageInMemory
from common.serializer... |
stack-of-tasks/rbdlpy | refs/heads/master | tutorial/lib/python2.7/site-packages/OpenGL/raw/GL/EXT/texture_filter_anisotropic.py | 9 | '''Autogenerated by xml_generate script, do not edit!'''
from OpenGL import platform as _p, arrays
# Code generation uses this
from OpenGL.raw.GL import _types as _cs
# End users want this...
from OpenGL.raw.GL._types import *
from OpenGL.raw.GL import _errors
from OpenGL.constant import Constant as _C
import ctypes
_... |
bsmr-eve/Pyfa | refs/heads/master | eos/effects/shieldtransportermaxrangebonus.py | 2 | # shieldTransporterMaxRangeBonus
#
# Used by:
# Ships from group: Industrial Command Ship (2 of 2)
# Ship: Osprey
# Ship: Rorqual
# Ship: Scythe
type = "passive"
def handler(fit, ship, context):
fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Remote Shield Booster", "maxRange",
... |
teamfx/openjfx-10-dev-rt | refs/heads/master | modules/javafx.web/src/main/native/Tools/QueueStatusServer/model/queuepropertymixin.py | 143 | # 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 ... |
graphite-server/carbon | refs/heads/master | lib/carbon/hashing.py | 9 | try:
from hashlib import md5
except ImportError:
from md5 import md5
import bisect
class ConsistentHashRing:
def __init__(self, nodes, replica_count=100):
self.ring = []
self.nodes = set()
self.replica_count = replica_count
for node in nodes:
self.add_node(node)
def compute_ring_positio... |
ales-erjavec/orange | refs/heads/master | Orange/testing/regression/tests_20/modules_kmeans-cmp-init.py | 6 | import orange
import orngClustering
import random
data_names = ["iris.tab", "housing.tab", "vehicle.tab"]
data_sets = [orange.ExampleTable(name) for name in data_names]
print "%10s %3s %3s %3s" % ("", "Rnd", "Div", "HC")
for data, name in zip(data_sets, data_names):
random.seed(42)
km_random = orngClustering.... |
sublime1809/django | refs/heads/master | tests/middleware_exceptions/urls.py | 107 | from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^middleware_exceptions/view/$', views.normal_view),
url(r'^middleware_exceptions/not_found/$', views.not_found),
url(r'^middleware_exceptions/error/$', views.server_error),
url(r'^middleware_exceptions/null_view/$', views.null_... |
eviljeff/zamboni | refs/heads/master | migrations/904-exclude-more-new-regions.py | 5 | #!/usr/bin/env python
from mkt.constants import regions
from mkt.developers.cron import exclude_new_region
def run():
exclude_new_region([regions.CAF, regions.GIN, regions.KEN])
|
iArjan/xbmc | refs/heads/master | lib/gtest/test/gtest_catch_exceptions_test.py | 403 | #!/usr/bin/env python
#
# Copyright 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 o... |
CSyllabus/webapp | refs/heads/dev | backend/apps/csyllabusapi/migrations/0015_auto_20171209_2340.py | 1 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2017-12-09 22:40
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('csyllabusapi', '0014_courseresult'),
]
operations ... |
mapr/hue | refs/heads/hue-3.9.0-mapr | desktop/core/ext-py/guppy-0.1.10/guppy/gsl/Main.py | 37 | #._cv_part guppy.gsl.Main
from guppy.gsl.Exceptions import *
class SpecEnv:
def __init__(self, mod):
self.mod = mod
self.imported_packages = {}
self.importing_packages = {}
self.error_reports = []
self.num_errors = 0
self.num_warnings = 0
def errmsg_context(self, context):
linetext = ''
filename = '<... |
lulandco/SickRage | refs/heads/develop | lib/hachoir_core/field/static_field_set.py | 93 | from hachoir_core.field import FieldSet, ParserError
class StaticFieldSet(FieldSet):
"""
Static field set: format class attribute is a tuple of all fields
in syntax like:
format = (
(TYPE1, ARG1, ARG2, ...),
(TYPE2, ARG1, ARG2, ..., {KEY1=VALUE1, ...}),
...
)
... |
vpsfreecz/brutus | refs/heads/master | tests/testexamples.py | 1 | #!/usr/bin/python
import os
import yaml
def test_examples():
for filename in os.listdir("examples/"):
with open(os.path.join("examples", filename)) as stream:
print(yaml.load(stream))
|
geekroot/erpnext | refs/heads/develop | erpnext/buying/doctype/supplier/test_supplier.py | 32 | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe, unittest
from erpnext.accounts.party import get_due_date
from erpnext.exceptions import PartyFrozen, PartyDisabled
from frappe.test_runn... |
hqxu/deepnet | refs/heads/master | deepnet/trainer.py | 2 | from neuralnet import *
from dbm import *
from dbn import *
from sparse_coder import *
import cudamat as cm
import numpy as np
from cudamat import gpu_lock
from time import sleep
def LockGPU(max_retries=10):
for retry_count in range(max_retries):
board = gpu_lock.obtain_lock_id()
if board != -1:
break
... |
jamesrp/pyeq2 | refs/heads/master | Models_2D/NIST.py | 3 | from __future__ import print_function
from __future__ import unicode_literals
from __future__ import absolute_import
# pyeq2 is a collection of equations expressed as Python classes
#
# Copyright (C) 2013 James R. Phillips
# 2548 Vera Cruz Drive
# Birmingham, AL 35235 USA
#
# email: zunzun@zunzun.com
#
... |
EdgarSun/Django-Demo | refs/heads/master | django/contrib/admindocs/tests/__init__.py | 325 | from django.contrib.admindocs import views
from django.db.models import fields as builtin_fields
from django.utils import unittest
import fields
class TestFieldType(unittest.TestCase):
def setUp(self):
pass
def test_field_name(self):
self.assertRaises(AttributeError,
views.get_re... |
clem-on/bennetout | refs/heads/master | tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/share/gdb/python/gdb/xmethod.py | 54 | # Python side of the support for xmethods.
# 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 you... |
welcheb/trevecca_undergraduate_catalog_2015-16 | refs/heads/master | trevecca.py | 1 | #!/usr/bin/env python
# import necessay modules
from lxml import html
from lxml import etree
import requests
# top-level domain
parent_domain = 'http://trevecca.smartcatalogiq.com'
# parent page showing the porgrams of study
parent_page_url = parent_domain + '/en/2015-2016/University-Catalog/Programs-of-Study'
paren... |
tszym/ansible | refs/heads/devel | lib/ansible/modules/storage/purestorage/purefa_hg.py | 7 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, Simon Dodsley (simon@purestorage.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... |
dcosentino/edx-platform | refs/heads/master | common/djangoapps/microsite_configuration/__init__.py | 188 | from .templatetags.microsite import page_title_breadcrumbs
|
iaksit/AB2017 | refs/heads/master | userprofile/admin.py | 2 | from django.contrib import admin
from userprofile.models import UserProfile
@admin.register(UserProfile)
class UserProfileAdmin(admin.ModelAdmin):
pass
|
jkettleb/iris | refs/heads/placeholder | lib/iris/tests/test_mapping.py | 11 | # (C) British Crown Copyright 2010 - 2015, Met Office
#
# This file is part of Iris.
#
# Iris 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 3 of the License, or
# (at your option) any l... |
ech45/immigration_station | refs/heads/master | Mallet/pca.py | 1 | import pandas as pd
from sklearn.decomposition import PCA
from sklearn.feature_selection import VarianceThreshold
import matplotlib.pyplot as plt
# read tsv into dataframe, includes header row by default
df = pd.read_csv('debate_composition.tsv', sep='\t')
# print(df['speaker'])
# make a copy
df_vectors = df.copy()
# r... |
SorenOlegnowicz/tracker | refs/heads/master | tracker/beacon/migrations/0011_inquiry_replystamp.py | 1 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('beacon', '0010_auto_20150805_1620'),
]
operations = [
migrations.AddField(
model_name='inquiry',
nam... |
X-ROM/android_kernel_motorola_msm8226 | refs/heads/kitkat | 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: nab@kernel.org
#
import os, sys
import subprocess as sub
import string
import re
import optparse
tcm_dir = ""
fabric_ops... |
rrooij/youtube-dl | refs/heads/master | youtube_dl/extractor/shahid.py | 26 | # coding: utf-8
from __future__ import unicode_literals
import json
import math
import re
from .aws import AWSIE
from ..compat import compat_HTTPError
from ..utils import (
clean_html,
ExtractorError,
InAdvancePagedList,
int_or_none,
parse_iso8601,
str_or_none,
urlencode_postdata,
)
clas... |
molotof/MITMf | refs/heads/master | core/mitmfapi.py | 18 | # Copyright (c) 2014-2016 Marcello Salvati
#
# 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 distrib... |
darktears/chromium-crosswalk | refs/heads/master | tools/cr/cr/actions/linuxchromeos.py | 57 | # Copyright 2015 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.
"""Linux ChromeOS specific implementations."""
import cr
class LinuxChromeOSRunner(cr.LinuxRunner):
"""A version of cr.LinuxRunner for LinuxChromeOS.
... |
jedie/pypyjs-standalone | refs/heads/master | website/js/pypy.js-0.3.0/lib/modules/test/test_sys.py | 5 | # -*- coding: utf-8 -*-
import unittest, test.test_support
from test.script_helper import assert_python_ok, assert_python_failure
import sys, os, cStringIO
import struct
import operator
class SysModuleTest(unittest.TestCase):
def tearDown(self):
test.test_support.reap_children()
def test_original_dis... |
yd0str/infernal-twin | refs/heads/master | build/pip/build/lib.linux-i686-2.7/pip/locations.py | 184 | """Locations where we look for configs, install stuff, etc"""
from __future__ import absolute_import
import getpass
import os
import os.path
import site
import sys
from distutils import sysconfig
from distutils.command.install import install, SCHEME_KEYS # noqa
from pip.compat import WINDOWS
from pip.utils import a... |
lizardsystem/lizard5-apps | refs/heads/master | lizard_map/templatetags/workspaces.py | 1 | from django import template
from django.utils import simplejson as json
from django.core.urlresolvers import reverse
from lizard_map.daterange import current_start_end_dates
#from lizard_map.models import Workspace
from lizard_map.utility import float_to_string
from lizard_map.views import CUSTOM_LEGENDS
register = t... |
chennan47/osf.io | refs/heads/develop | addons/onedrive/tests/test_client.py | 22 | # -*- coding: utf-8 -*-
import pytest
from osf_tests.factories import UserFactory
from addons.onedrive.models import UserSettings
pytestmark = pytest.mark.django_db
class TestCore:
@pytest.fixture()
def user(self):
ret = UserFactory()
ret.add_addon('onedrive')
ret.save()
ret... |
klahnakoski/eideticker | refs/heads/master | util/vendor/aespython/key_expander.py | 2 | #!/usr/bin/env python
"""
AES Key Expansion.
Expands 128, 192, or 256 bit key for use with AES
Running this file as __main__ will result in a self-test of the algorithm.
Algorithm per NIST FIPS-197 http://csrc.nist.gov/publications/fips/fips197/fips-197.pdf
Copyright (c) 2010, Adam Newman http://www.caller9.com/
L... |
ovresko/erpnext | refs/heads/master | erpnext/education/doctype/course/course.py | 35 | # -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe import _
class Course(Document):
def validate(self):
self.validate_assess... |
satterly/alerta5 | refs/heads/master | alerta/app/database/backends/postgres/base.py | 1 |
import psycopg2 as pg
from datetime import datetime
from flask import current_app
from psycopg2.extras import NamedTupleCursor, register_composite
from psycopg2.extensions import register_adapter, adapt, AsIs
class Backend:
def __init__(self, app=None):
self.app = None
if app is not None:
... |
ruslan2k/public-files | refs/heads/master | python/04-django/polls/urls.py | 1 | from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^register/', views.register, name='register'),
]
|
ravindrapanda/tensorflow | refs/heads/master | tensorflow/python/estimator/canned/dnn.py | 4 | # 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... |
ge0rgi/cinder | refs/heads/stable/ocata | cinder/tests/unit/test_evaluator.py | 40 | # Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
# 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/LICEN... |
p0psicles/SickRage | refs/heads/master | lib/tornado/curl_httpclient.py | 102 | #!/usr/bin/env python
#
# Copyright 2009 Facebook
#
# 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 a... |
aayushidwivedi01/spark-tk | refs/heads/master | regression-tests/exampletests/__init__.py | 170 | # vim: set encoding=utf-8
# Copyright (c) 2016 Intel 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 License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... |
imsplitbit/nova | refs/heads/master | nova/tests/test_test_utils.py | 2 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2010 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/LICE... |
ortutay/23andme-phenotypes-hackathon | refs/heads/master | my_app/lib/ttam_api/ttam_api/django/context_processors.py | 1 | from . import client
def login_url(request):
return {'login_url': client.login_url(request)}
|
adnanh/zulip | refs/heads/master | api/integrations/perforce/zulip_change-commit.py | 115 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright © 2012-2014 Zulip, Inc.
#
# 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 rig... |
matt-leach/django-strava-auth | refs/heads/master | stravauth/templatetags/stravauth_tags.py | 1 | from django import template
from stravauth.utils import get_stravauth_url
register = template.Library()
@register.tag(name='stravauth_url')
def stravauth_url_tag(parser, format):
return StravauthUrlNode()
class StravauthUrlNode(template.Node):
def __init__(self):
pass
def render(se... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.