code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
# Generated by Django 1.9.9 on 2017-05-28 02:00
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('personas', '0034_auto_20170527_1648'),
]
operations = [
migrations.AlterFiel... | Ykharo/tutorial_P3_4 | personas/migrations/0035_auto_20170527_2200.py | Python | mit | 665 |
#!/usr/bin/env python
# Plot nurbs surface corresponding to a 2D damped oscillation.
# The surface has two holes. A Teapot below the surface is
# visible through these holes.
#
# Copyright (C) 2007 "Peter Roesch" <Peter.Roesch@fh-augsburg.de>
#
# This code is licensed under the PyOpenGL License.
# Details are given i... | mgood7123/UPM | Sources/PyOpenGL-Demo-3.0.1b1/PyOpenGL-Demo/proesch/nurbs/nurbs.py | Python | gpl-3.0 | 5,778 |
#!/usr/bin/env python
from __future__ import division, print_function, absolute_import
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('lobpcg',parent_package,top_path)
config.add_data_dir('tests')
return config
if __nam... | valexandersaulys/airbnb_kaggle_contest | venv/lib/python3.4/site-packages/scipy/sparse/linalg/eigen/lobpcg/setup.py | Python | gpl-2.0 | 431 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
from random import randint
"""
算法的思想是首先排序,然后从一端开始累加,在遇到使得结果值大于等于0.5的值的权的时候就把这个元素返回。
由于带权中位数偏向于大端,所以从大端开始累加。
证明算法的正确性:首先在返回结果的时候肯定在小的一端满足结果。这个时候可以证明在上一次的时候必定有累加
值小于0.5,否则就返回了。
"""
def partition(li, start, end):
li_len = end - start + 1
if li_len < 2:
raise... | ssjssh/algorithm | src/ssj/clrs/9/9-2(b).py | Python | gpl-2.0 | 1,854 |
try:
set
except NameError:
from sets import Set as set
from django import template
from django.http import Http404
from django.core.paginator import Paginator, InvalidPage
from django.conf import settings
register = template.Library()
DEFAULT_PAGINATION = getattr(settings, 'PAGINATION_DEFAULT_PAGINATION', 20... | Alerion/shopping-helper | lib/pagination/templatetags/pagination_tags.py | Python | mit | 8,885 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from transit_indicators.gtfs import GTFSRouteTypes
def forwards(apps, schema_editor):
""" Create a table row for each entry in GTFSRouteType.CHOICES
Note that this migration will use whatever the curren... | flibbertigibbet/open-transit-indicators | python/django/transit_indicators/migrations/0023_auto_20140904_1922.py | Python | gpl-3.0 | 1,222 |
#!/usr/bin/python
# Copyright: Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['stableinterf... | kvar/ansible | lib/ansible/modules/cloud/amazon/iam.py | Python | gpl-3.0 | 35,543 |
#!/usr/bin/env python
#==============================================================================
# Copyright 2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Amazon Software License (the "License"). You may not use
# this file except in compliance with the License. A copy of the... | JoaoVasques/aws-devtool | eb/macosx/python2.7/scli/operation/pseudo_operations.py | Python | apache-2.0 | 7,565 |
import sublime
import sublime_plugin
import os
from subprocess import call
class RubyMotionSpecCommand(sublime_plugin.WindowCommand):
def run(self):
s = sublime.load_settings("RubyMotionSpec.sublime-settings")
terminal = s.get("terminal")
if terminal == 'iTerm':
self.iterm_comm... | neocsr/sublime-RubyMotionSpec | ruby_motion_spec.py | Python | mit | 2,090 |
# -*- codes: utf-8 -*-
from __future__ import print_function
import os
import sys
from argparse import ArgumentParser
import regex
import requests
from .filters import style
from .utils import merge_dicts
def parse_arguments(args):
query = ArgumentParser(prog="poirot", description="""Poirot: Mind Your Languag... | emanuelfeld/poirot | poirot/parser.py | Python | mit | 5,131 |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2016, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""... | jkyeung/XlsxWriter | xlsxwriter/test/comparison/test_chart_axis20.py | Python | bsd-2-clause | 1,665 |
# vim: set ts=4 sw=4 et: coding=UTF-8
from .rpmsection import Section
class RpmPrep(Section):
'''
Try to simplify to %setup -q when possible.
Replace %patch with %patch0
'''
def add(self, line):
line = self._complete_cleanup(line)
line = self._cleanup_setup(line)
... | pombredanne/spec-cleaner | spec_cleaner/rpmprep.py | Python | bsd-3-clause | 1,581 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting field 'Citation.note'
db.delete_column('main_citation', 'note_id')
def backwards(self, or... | CENDARI/editorsnotes | editorsnotes/main/migrations/0028_auto__del_field_citation_note.py | Python | agpl-3.0 | 11,084 |
# Copyright (C) 2012,2013
# Max Planck Institute for Polymer Research
# Copyright (C) 2008,2009,2010,2011
# Max-Planck-Institute for Polymer Research & Fraunhofer SCAI
#
# This file is part of ESPResSo++.
#
# ESPResSo++ is free software: you can redistribute it and/or modify
# it under the terms of the G... | espressopp/espressopp | src/check/__init__.py | Python | gpl-3.0 | 900 |
"""Tests for the Risco event sensors."""
from homeassistant.components.risco import (
LAST_EVENT_TIMESTAMP_KEY,
CannotConnectError,
UnauthorizedError,
)
from homeassistant.components.risco.const import DOMAIN, EVENTS_COORDINATOR
from .util import TEST_CONFIG, setup_risco
from .util import two_zone_alarm #... | tboyce021/home-assistant | tests/components/risco/test_sensor.py | Python | apache-2.0 | 6,156 |
#!/usr/bin/env python
"""GRR restful API rendering plugins."""
# pylint: disable=unused-import
from grr.gui.api_plugins import aff4
from grr.gui.api_plugins import artifact
from grr.gui.api_plugins import config
from grr.gui.api_plugins import docs
from grr.gui.api_plugins import hunt
from grr.gui.api_plugins import r... | wandec/grr | gui/api_plugins/__init__.py | Python | apache-2.0 | 368 |
import csv
patent_info = {"feature": [abstract,number,inventor,phone,[litigation,listt]}
say its highly litigated, or lowly litigated, you know. Say that analytic for a patent
view similarly litigated patents
yeah all that
| JessieSalas/WatsonApp | database.py | Python | mit | 225 |
# -*- encoding: utf-8 -*-
"""Programs for computing and visualizing empirical power as a function of
effect size in the spatial separate-classes model.
Author: Tuomas Puoliväli
Email: tuomas.puolivali@helsinki.fi
Last modified: 24th April 2019
License: Revised 3-clause BSD
WARNING: There is unfinished code and only p... | puolival/multipy | multipy/separate_classes_power.py | Python | bsd-3-clause | 6,959 |
#!/usr/bin/env python2.7
import re
import os
def obtain_forces(file_in):
lista = []
for line in file_in.readlines():
m = re.match("\s+\d+\s+([0-9.-]+)\s+([0-9.-]+)\s+([0-9.-]+)",line)
if m:
lista.append(float(m.group(1)))
lista.append(float(m.group(2)))
lista.append(float(m... | ramirezfranciscof/lio | test/tests_engine/forces.py | Python | gpl-2.0 | 1,489 |
import click
import logging
import time
from dotenv import load_dotenv, find_dotenv
from grazer.config import Config
from grazer.core import crawler
from grazer.core import scrapper
from grazer.util import time_convert, grouper
logger = logging.getLogger("Verata")
@click.group()
@click.option("--env", default=find_... | CodersOfTheNight/verata | grazer/run.py | Python | mit | 2,536 |
# -*- coding: utf-8 -*-
"""
File: urls.py
Creator: MazeFX
Date: 11-7-2016
Main url resolver as from cookiecutter-django.
Added following resolver patterns:
* ('/') -> pages.home_page
* ('/contact/') -> pages.contact_page
* ('/contact/email_sent/') -> pages.email_sent_page
"""
from __future__ import unicode_literal... | MazeFX/cookiecutter_website_project | config/urls.py | Python | mit | 2,277 |
# encoding: utf-8
#
# Copyright (c) 2014 Dean Jackson <deanishe@deanishe.net>
#
# MIT Licence. See http://opensource.org/licenses/MIT
#
# Created on 2014-02-15
#
"""
The :class:`Workflow` object is the main interface to this library.
See :ref:`setup` in the :ref:`user-manual` for an example of how to set
up your Pyth... | fniephaus/alfred-hackernews | src/workflow/workflow.py | Python | mit | 75,128 |
#!/usr/bin/env python3
'''Test IXFR-from-diff with DNSSEC'''
from dnstest.test import Test
t = Test(stress=False)
master = t.server("knot")
slave = t.server("knot")
if not master.valgrind:
zones = t.zone_rnd(12)
else:
zones = t.zone_rnd(4, records=100)
slave.tcp_remote_io_timeout = 20000
master.ctl_params_... | CZ-NIC/knot | tests-extra/tests/dnssec/ixfr_diff/test.py | Python | gpl-3.0 | 1,178 |
# ----------------------------------------------------------------------------
# Copyright (c) 2017-, LabControl development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# -------------------------------------------------... | jdereus/labman | labcontrol/gui/handlers/plate.py | Python | bsd-3-clause | 9,784 |
# 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 ... | lmazuel/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/probe_paged.py | Python | mit | 917 |
#!/usr/bin/env python
import wx
import ape
import os
import genomics
class PCRSimulatorFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, title="PCR Simulator", size=(840, 400), name="PCR Simulator")
#self.icon = wx.Icon("res/icon.png", wx.BITMAP_TYPE_ANY)
#self.SetIcon(self.icon)
self.Creat... | tricorder42/pcr-simulator-2015 | interface.py | Python | mit | 13,594 |
# -*- coding: latin-1 -*-
##
## Copyright (c) 2000, 2001, 2002, 2003 Thomas Heller
##
## 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 limitatio... | skeenp/Roam | libs/py2exe-0.6.9/py2exe/resources/VersionInfo.py | Python | gpl-2.0 | 9,595 |
from captcha.fields import ReCaptchaField
from django import forms
from .models import Url
def get_client_ip(meta):
x_forwarded_for = meta.get('HTTP_X_FORWARDED_FOR')
if x_forwarded_for:
ip = x_forwarded_for.split(',')[0]
else:
ip = meta.get('REMOTE_ADDR')
return ip
class UrlForm(for... | andrewnsk/dorokhin.moscow | urlshortener/forms.py | Python | mit | 934 |
###############################################################################
#
# The MIT License (MIT)
#
# Copyright (c) Tavendo GmbH
#
# 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 with... | dash-dash/AutobahnPython | examples/twisted/websocket/auth_persona/server.py | Python | mit | 9,063 |
# -*- coding: utf-8 -*-
# __
# /__) _ _ _ _ _/ _
# / ( (- (/ (/ (- _) / _)
# /
"""
requests HTTP library
~~~~~~~~~~~~~~~~~~~~~
Requests is an HTTP library, written in Python, for human beings. Basic GET
usage:
>>> import requests
>>> r = requests.get('https://www.python.org')
>>> ... | gandarez/wakatime | wakatime/packages/requests/__init__.py | Python | bsd-3-clause | 1,861 |
ACCOUNT_NAME = 'Lego'
| 0--key/lib | portfolio/Python/scrapy/lego/__init__.py | Python | apache-2.0 | 22 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import pytest
import os
collect_ignore = [
"setup.py",
".pythonrc.py"
]
# Also ignore everything that git ignores.
git_ignore = os.path.join(os.path.dirname(__file__), '.gitignore')
collect_ignore += list(filter(None, open(git_ignore).read().split('\n')))
# Run... | slipperyhank/pyphi | conftest.py | Python | gpl-3.0 | 1,279 |
#This Source Code Form is subject to the terms of the Mozilla Public
#License, v. 2.0. If a copy of the MPL was not distributed with this
#file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#Created by Alexandre GAUTHIER-FOICHAT on 01/27/2015.
#To import the variable "natron"
import NatronEngine
def addFor... | AxelAF/Natron | Documentation/source/init.py | Python | gpl-2.0 | 1,571 |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2006, 2007, 2008, 2010, 2011, 2013 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
## ... | jirikuncar/invenio-demosite | invenio_demosite/testsuite/regression/test_bibauthority.py | Python | gpl-2.0 | 4,781 |
"""
Volume Drivers for aws storage arrays.
"""
import time
from cinder.i18n import _
from cinder import exception
from cinder.openstack.common import log as logging
from cinder.volume import driver
from oslo.config import cfg
import cinder.context
import io
import subprocess
import math
from cinder.openstack.common im... | Hybrid-Cloud/badam | fs_patches_of_hybrid_cloud/cherry_for_111T/cinder_cascading_proxy_normal/cinder/volume/drivers/cephiscsi/cephiscsi.py | Python | apache-2.0 | 23,563 |
#
# OSIS stands for Open Student Information System. It's an application
# designed to manage the core business of higher education institutions,
# such as universities, faculties, institutes and professional schools.
# The core business involves the administration of students, teachers,
# courses, progr... | uclouvain/osis | base/tests/utils/test_string.py | Python | agpl-3.0 | 2,098 |
# Copyright 2019 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... | karllessard/tensorflow | tensorflow/lite/testing/op_tests/unique.py | Python | apache-2.0 | 2,365 |
from mininet.net import Mininet
from mininet.node import Node, Switch
from mininet.link import Link, Intf
from mininet.log import setLogLevel, info
from mininet.cli import CLI
import mininet.ns3
from mininet.ns3 import WIFISegment
import ns.core
import ns.wifi
if __name__ == '__main__':
setLogLevel( 'info' )
... | pichuang/OpenNet | mininet-patch/examples/ns3/wifi-rate-anomaly.py | Python | gpl-2.0 | 1,903 |
##
# \namespace reviewTool.gui.delegates
#
# \remarks Contains reusable delegates for the Reveiw Tool system
#
# \author Dr. D Studios
# \date 08/03/11
#
# Copyright 2008-2012 Dr D Studios Pty Limited (ACN 127 184 954) (Dr. D Studios)
#
# This file is part of anim-studio-tools.
#
# anim-studio-... | xxxIsaacPeralxxx/anim-studio-tools | review_tool/sources/reviewTool/gui/delegates/__init__.py | Python | gpl-3.0 | 970 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-04-16 00:51
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Configu... | 827992983/yue | admin/migrations/0001_initial.py | Python | gpl-3.0 | 543 |
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
from kolibri.core.webpack.hooks import WebpackInclusionHook
class DeviceManagementSyncHook(WebpackInclusionHook):
"""
Inherit a hook defining assets to be loaded sychronously in the template
... | lyw07/kolibri | kolibri/plugins/device_management/hooks.py | Python | mit | 368 |
# -*- coding: utf-8 -*-
#
# This file is part of reprints released under the AGPLv3 license.
# See the NOTICE for more information.
# future compatibilty
from __future__ import absolute_import
# standard
import unittest
# local
from reprints import response
ONExONE_PNG = b'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x0... | gaelenh/python-reprints | reprints/response_test.py | Python | agpl-3.0 | 3,420 |
# Copyright (c) 2012-2015 Netforce Co. Ltd.
#
# 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, modify, merge, publ... | anastue/netforce | netforce_account_report/netforce_account_report/models/report_balance_sheet.py | Python | mit | 13,744 |
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import module as mojom
# This module provides a mechanism for determining the packed order and offsets
# of a mojom.Struct.
#
# ps = pack.PackedStruct(struc... | guorendong/iridium-browser-ubuntu | third_party/mojo/src/mojo/public/tools/bindings/pylib/mojom/generate/pack.py | Python | bsd-3-clause | 8,182 |
#!/usr/bin/env python
########################################################################
# $HeadURL$
# File : dirac-configure
# Author : Ricardo Graciani
########################################################################
"""
Main script to write dirac.cfg for a new DIRAC installation and initial downl... | vmendez/DIRAC | Core/scripts/dirac-configure.py | Python | gpl-3.0 | 20,061 |
import unittest
import os
import asyncio
from openhomedevice.device import Device
from aioresponses import aioresponses
def async_test(coro):
def wrapper(*args, **kwargs):
loop = asyncio.new_event_loop()
try:
return loop.run_until_complete(coro(*args, **kwargs))
finally:
... | bazwilliams/openhomedevice | tests/DeviceNoPinsTest.py | Python | mit | 5,425 |
# META: timeout=long
import pytest
from webdriver import error
from tests.support.asserts import assert_success
def execute_script(session, script, args=None):
if args is None:
args = []
body = {"script": script, "args": args}
return session.transport.send(
"POST", "/session/{session_i... | dati91/servo | tests/wpt/web-platform-tests/webdriver/tests/execute_script/user_prompts.py | Python | mpl-2.0 | 3,756 |
#!/usr/bin/env python
# -*- coding: utf8 -*-
import unittest
from datetime import datetime, timedelta
from yamlns.dateutils import Date
from yamlns import namespace as ns
from .scheduling import (
weekday,
weekstart,
nextweek,
choosers,
Scheduling,
)
class Scheduling_Test(unittest.TestCase):
... | Som-Energia/somenergia-tomatic | tomatic/scheduling_test.py | Python | gpl-3.0 | 24,860 |
import re
from thefuck.utils import get_closest, for_app
def extract_possibilities(command):
possib = re.findall(r'\n\(did you mean one of ([^\?]+)\?\)', command.stderr)
if possib:
return possib[0].split(', ')
possib = re.findall(r'\n ([^$]+)$', command.stderr)
if possib:
return pos... | PLNech/thefuck | thefuck/rules/mercurial.py | Python | mit | 807 |
from functools import reduce
from itertools import chain, combinations, product, permutations
# This class is used to represent and examine algebras on atom tables.
# It is intended to be used for nonassociative algebras, but this is not assumed.
class AtomicAlgebra:
# Create an algebra from a table of... | mdneuzerling/AtomicAlgebra | AtomicAlgebra.py | Python | gpl-3.0 | 23,406 |
import unittest
import numpy
import chainer
from chainer import cuda
from chainer import functions
from chainer import gradient_check
from chainer import testing
from chainer.testing import attr
@testing.parameterize(*testing.product({
'shape': [(3,), (3, 4)],
'dtype': [numpy.float16, numpy.float32, numpy.f... | kiyukuta/chainer | tests/chainer_tests/functions_tests/array_tests/test_flipud.py | Python | mit | 1,313 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from distutils.core import setup
setup(
name="pppcap",
version="0.1",
author="Ruy",
author_email="ruy.suzu7(at)gmail.com",
url="https://github.com/ainoniwa/pppcap",
description="Pppcap: pure python wrapper for libpcap/winpcap",
license="MIT",
... | ainoniwa/pppcap | setup.py | Python | mit | 627 |
from django.utils.encoding import python_2_unicode_compatible
from ..models import models
@python_2_unicode_compatible
class NamedModel(models.Model):
name = models.CharField(max_length=30)
objects = models.GeoManager()
class Meta:
abstract = True
required_db_features = ['gis_enabled']
... | DONIKAN/django | tests/gis_tests/geogapp/models.py | Python | bsd-3-clause | 954 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: MIT. See LICENSE
import frappe
from frappe import _
from frappe.model.document import Document
from frappe.model import no_value_fields
class Workflow(Document):
def validate(self):
self.set_active()
self.create_custom_field_for_wor... | frappe/frappe | frappe/workflow/doctype/workflow/workflow.py | Python | mit | 3,996 |
r"""
Nonlinear solvers
-----------------
.. currentmodule:: scipy.optimize
This is a collection of general-purpose nonlinear multidimensional
solvers. These solvers find *x* for which *F(x) = 0*. Both *x*
and *F* can be multidimensional.
Routines
~~~~~~~~
Large-scale nonlinear solvers:
.. autosummary::
newton... | arokem/scipy | scipy/optimize/nonlin.py | Python | bsd-3-clause | 48,377 |
# TmLibrary - TissueMAPS library for distibuted image analysis routines.
# Copyright (C) 2016 Markus D. Herrmann, University of Zurich and Robin Hafen
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Softwa... | TissueMAPS/TmLibrary | tmlib/models/mapobject.py | Python | agpl-3.0 | 36,238 |
from couchpotato import get_session
from couchpotato.core.event import addEvent, fireEventAsync, fireEvent
from couchpotato.core.helpers.encoding import toUnicode, simplifyString
from couchpotato.core.logger import CPLog
from couchpotato.core.media._base.library import LibraryBase
from couchpotato.core.settings.model i... | entomb/CouchPotatoServer | couchpotato/core/media/movie/library/movie/main.py | Python | gpl-3.0 | 6,972 |
# -*- coding: utf-8 -*-
from django import forms
from django.core.urlresolvers import reverse
from django.core.exceptions import ImproperlyConfigured
from django.forms.models import ModelForm
from django.template import TemplateSyntaxError
from django.test.utils import override_settings
from django.utils.encoding impo... | czpython/django-cms | cms/tests/test_wizards.py | Python | bsd-3-clause | 17,882 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'django_project.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^$', include('apps.home.urls', namespace='home', app_name='home')),
url(... | MDA2014/django-xpand | django_project/django_project/urls.py | Python | mit | 439 |
# this will go to src/common/xmpp later, for now it is in src/common
# -*- coding:utf-8 -*-
## src/common/dataforms.py
##
## Copyright (C) 2006-2007 Tomasz Melcer <liori AT exroot.org>
## Copyright (C) 2006-2017 Yann Leboulanger <asterix AT lagaule.org>
## Copyright (C) 2007 Stephan Erb <steve-e AT h3c.de>
##
## This f... | jabber-at/gajim | src/common/dataforms.py | Python | gpl-3.0 | 21,186 |
# SPDX-License-Identifier: GPL-2.0+
# Copyright (c) 2016 Google, Inc
# Written by Simon Glass <sjg@chromium.org>
#
# Test for the fdt modules
import os
import sys
import tempfile
import unittest
from dtoc import fdt
from dtoc import fdt_util
from dtoc.fdt import FdtScan
from patman import tools
class TestFdt(unittes... | Digilent/u-boot-digilent | tools/binman/fdt_test.py | Python | gpl-2.0 | 2,920 |
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
import unittest
from jnius import autoclass
class PassByReferenceOrValueTest(unittest.TestCase):
def _verify(self, numbers, changed):
for i in range(len(numbers)):
self.assertEqual(numb... | kivy/pyjnius | tests/test_pass_by_reference_or_value.py | Python | mit | 8,201 |
from setuptools import setup
setup(
name = 'mcnotify',
version = '1.0.1',
author = 'Shusui Moyatani',
author_email = 'syusui.s@gmail.com',
url = 'https://github.com/syusui-s/mcnotify',
license = ['MIT'],
description = 'Minecraft status notifier',
scripts = ['scripts/mcnotify_update'],
... | syusui-s/mcnotify | setup.py | Python | mit | 364 |
import collections
import nltk.classify.util, nltk.metrics
from nltk.classify import NaiveBayesClassifier
from nltk.classify import DecisionTreeClassifier
from nltk.corpus import CategorizedPlaintextCorpusReader
from sklearn import svm
from sklearn.svm import LinearSVC
import string
from tabulate import tabulate
corpu... | Sapphirine/Movie-Review-Sentiment-Analysis | Sentiment Analysis /evaluation.py | Python | mit | 6,756 |
'''
Created on Jun 12, 2014
Modified on Jun 16, 2014
Version 0.03
@author: rainier.madruga@gmail.com
A simple Python Program to scrape the BBC News website for content.
'''
from bs4 import BeautifulSoup
import os, sys, csv
import urllib2
import datetime
# Define current path for the Script
currentPath = o... | rainier-m/python-soccer | parseBBC.py | Python | gpl-2.0 | 1,877 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2013, Phillip Gentry <phillip@cx.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 Licen... | GustavoHennig/ansible | lib/ansible/modules/source_control/github_hooks.py | Python | gpl-3.0 | 6,852 |
# basic plugin
# example by Ryan Gaus
# from
from base import *
"""
A sample parser, that should explain everything nicely
"""
class sample_parser(parser):
# tells the main program if it should use this plugin to parse its query
# the query is contained within self.query
def validate(self):
return "sample"... | 1egoman/qmcstats | sample.py | Python | mit | 923 |
import warnings
from chempy.util.testing import requires
from chempy.units import units_library
from ..water_diffusivity_holz_2000 import water_self_diffusion_coefficient as w_sd
def test_water_self_diffusion_coefficient():
warnings.filterwarnings("error")
assert abs(w_sd(273.15 + 0.0) - 1.099e-9) < 0.027e-9
... | bjodah/aqchem | chempy/properties/tests/test_water_diffusivity_holz_2000.py | Python | bsd-2-clause | 1,297 |
# Copyright 2018 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 a... | mlperf/inference_results_v0.5 | closed/Google/code/gnmt/tpu-gnmt/home/kbuilder/mlperf-inference/google3/third_party/mlperf/inference/gnmt/nmt/tpu/distributed_iterator_utils.py | Python | apache-2.0 | 11,852 |
# ############################################################################
# OSIS stands for Open Student Information System. It's an application
# designed to manage the core business of higher education institutions,
# such as universities, faculties, institutes and professional schools.
# The core business i... | uclouvain/osis | base/tests/utils/test_operator.py | Python | agpl-3.0 | 2,143 |
import glob
import os
import sys
from typing import Any, Dict, Iterator, List
from warnings import warn
import setuptools # type: ignore
from . import api
from .settings import DEFAULT_CONFIG
class ISortCommand(setuptools.Command): # type: ignore
"""The :class:`ISortCommand` class is used by setuptools to per... | PyCQA/isort | isort/setuptools_commands.py | Python | mit | 2,299 |
from ..broker import Broker
class FailOverConfigurationBroker(Broker):
controller = "fail_over_configurations"
def get_config(self, **kwargs):
"""Get the failover configuration for the specified unit.
**Inputs**
| ``api version min:`` None
| ``api version max:`... | infobloxopen/infoblox-netmri | infoblox_netmri/api/broker/v3_8_0/fail_over_configuration_broker.py | Python | apache-2.0 | 12,204 |
import libtorrent as lt
from core.torrent import Torrent
from core.export import create_exporter
class Session(lt.session):
"""Libtorrent Session wrapper.
This class provides several methods around the libtorrent session class.
"""
# Create export decorator
export = create_exporter()
def __i... | DenBrahe/wetsuit | wetsuit/core/session.py | Python | apache-2.0 | 2,514 |
"""
Objects for dealing with Laguerre series.
This module provides a number of objects (mostly functions) useful for
dealing with Laguerre series, including a `Laguerre` class that
encapsulates the usual arithmetic operations. (General information
on how this module represents and works with such polynomials is in th... | cschenck/blender_sim | fluid_sim_deps/blender-2.69/2.69/python/lib/python3.3/site-packages/numpy/polynomial/laguerre.py | Python | gpl-3.0 | 54,045 |
__author__ = 'kiruba'
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import itertools
from matplotlib import rc
from spread import spread
import meteolib as met
import evaplib
from bisect import bisect_left, bisect_right
from scipy.optimize import curve_fit
import math
import scipy as sp
from da... | tejasckulkarni/hydrology | ch_591/ch_591_water_balance.py | Python | gpl-3.0 | 28,192 |
from __future__ import absolute_import, print_function
import logging
logger = logging.getLogger(__name__)
from . import _glyph_functions as gf
from .models import Axis, Grid, GridPlot, Legend, LogAxis, Plot
from .plotting_helpers import (
_list_attr_splat, _get_range, _get_axis_class, _get_num_minor_ticks, _proc... | khkaminska/bokeh | bokeh/plotting.py | Python | bsd-3-clause | 9,064 |
from __future__ import print_function
# Functions to import and export MT EDI files.
from SimPEG import mkvc
from scipy.constants import mu_0
from numpy.lib import recfunctions as recFunc
from .data_utils import rec_to_ndarr
# Import modules
import numpy as np
import os, sys, re
class EDIimporter:
"""
A cla... | simpeg/simpeg | SimPEG/electromagnetics/natural_source/utils/edi_files_utils.py | Python | mit | 7,066 |
# -*- coding: utf-8 -*-
###############################################################################
#
# GetTags
# Retrieves a list of all tags and the number of bookmarks that use them.
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2014, Temboo Inc.
#
# Licensed under the Apache License, Version 2.0 (the "Licens... | jordanemedlock/psychtruths | temboo/core/Library/Delicious/GetTags.py | Python | apache-2.0 | 3,138 |
import datetime
import lxml.etree
import lxml.builder
NS = {
'container': 'urn:oasis:names:tc:opendocument:xmlns:container',
'opf': 'http://www.idpf.org/2007/opf',
'ops': 'http://www.idpf.org/2007/ops',
'dc': 'http://purl.org/dc/elements/1.1/',
'ncx': 'http://www.daisy.org/z3986/2005/ncx/',
'html': 'http://www.... | Glose/dawn | dawn/utils.py | Python | mit | 1,037 |
"""
NOTE: Since a documented API is nowhere to be found for Huomao; this plugin
simply extracts the videos stream_id, stream_url and stream_quality by
scraping the HTML and JS of one of Huomaos mobile webpages.
When viewing a stream on huomao.com, the base URL references a room_id. This
room_id is mapped one-to-one to... | mmetak/streamlink | src/streamlink/plugins/huomao.py | Python | bsd-2-clause | 3,403 |
# -*- coding: utf-8 -*-
"""Process tasks in several modes."""
import logging
from .. import config
LOGGER = logging.getLogger(__name__)
def serial(named_tasks, arg):
"""Serial calls."""
results = {}
for name, task in named_tasks:
try:
results[name] = task(arg)
except: # p... | jonasjberg/autonameow | autonameow/vendor/isbnlib/dev/vias.py | Python | gpl-2.0 | 1,808 |
__all__ = ['savetxt', 'loadtxt',
'genfromtxt', 'ndfromtxt', 'mafromtxt', 'recfromtxt', 'recfromcsv',
'load', 'loads',
'save', 'savez',
'packbits', 'unpackbits',
'fromregex',
'DataSource']
import numpy as np
import format
import cStringIO
import os
impor... | plaes/numpy | numpy/lib/io.py | Python | bsd-3-clause | 53,226 |
#!/usr/bin/env python2
from __future__ import print_function
import os
import os.path
import pkgutil
import shutil
import sys
import tempfile
__all__ = ["version", "bootstrap"]
_SETUPTOOLS_VERSION = "18.2"
_PIP_VERSION = "7.1.2"
# pip currently requires ssl support, so we try to provide a nicer... | nmercier/linux-cross-gcc | win32/bin/Lib/ensurepip/__init__.py | Python | bsd-3-clause | 6,913 |
from .predicate import Predicate
from .report import Report
__author__ = 'Mikael Vind Mikkelsen'
__maintainer__ = 'Alexander Brandborg'
class ColumnNotNullPredicate(Predicate):
"""
Predicate for asserting that nulls do not exist in the columns of a table
"""
def __init__(self, table_name, column_nam... | Betaboxguugi/P6 | code/framework/predicates/column_not_null_predicate.py | Python | gpl-3.0 | 2,415 |
#!/usr/bin/env python
import unittest
import shutil
import os
import subprocess
import sys
from distutils.version import StrictVersion
def run(command):
""" run shell command & return unix exit code """
process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = proce... | snayfach/PhyloCNV | test/test_midas.py | Python | gpl-3.0 | 5,928 |
"""
Vamos a construir una pila LIFO last in first out. Vamos a crear unas funciones para manejar dicha pila.
Estas funciones serán:
introduce(pila, x) Añadimos un elemento al final de la pila
saca(pila) Devolvemos el último elemento de la pila (si la pila está vacía, devuelve None
... | IhToN/DAW1-PRG | Ejercicios/PrimTrim/Ejercicio22.py | Python | apache-2.0 | 1,016 |
#!/usr/bin/env python
'''
Affichage de la webcam
Usage:
affichage_webcam.py [<video source>]
'''
# Librairies
import cv2
import sys
# Programme
# Recuperation de l'argument
try:
fn = sys.argv[1]
except:
fn = 0
# Creation de la fenetre
cv2.namedWindow('Webcam')
# Demarrage de la webcam
cap = cv2.VideoC... | vportascarta/UQAC-8INF844-SPHERO | tracking/affichage_webcam.py | Python | gpl-3.0 | 510 |
# Copyright 2018 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... | annarev/tensorflow | tensorflow/python/keras/saving/model_config.py | Python | apache-2.0 | 4,477 |
from django.contrib import admin
import models
# Register your models here.
admin.site.register(models.UserProfile)
admin.site.register(models.Event)
| zhaogaolong/oneFinger | alarm/admin.py | Python | apache-2.0 | 150 |
import logging
from collections import defaultdict
from django.utils import six
from django.utils.safestring import mark_safe
from .base import (
Node, Template, TemplateSyntaxError, TextNode, Variable, token_kwargs,
)
from .library import Library
register = Library()
BLOCK_CONTEXT_KEY = 'block_con... | yephper/django | django/template/loader_tags.py | Python | bsd-3-clause | 12,647 |
import oyaml as yaml
import sys
import configargparse
parser = configargparse.ArgumentParser(auto_env_var_prefix="INIT_")
parser.add_argument("--config-path", help="path to the configuration.yml file", default="/opt/opencga/conf/configuration.yml")
parser.add_argument("--client-config-path", help="path to the client-c... | j-coll/opencga | opencga-app/app/cloud/docker/old/opencga-init/override-yaml.py | Python | apache-2.0 | 10,214 |
__doc__ = """Random number array generators for numarray.
This package was ported to numarray from Numeric's RandomArray and
provides functions to generate numarray of random numbers.
"""
from RandomArray2 import *
| fxia22/ASM_xf | PythonD/site_python/numarray/random_array/__init__.py | Python | gpl-2.0 | 218 |
#!/usr/bin/env python3
import urllib.request.Request as Request
req = Request('http://10.192.40.29',
headers = {},
method = 'GET'
)
with urllib.request.urlopen(req) as f:
print f.read().decode('utf-8')
| IvanJobs/play | ceph/s3/tpl.py | Python | mit | 243 |
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import TwilioTaskRouterClient
# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
workspace_sid = "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
t... | teoreteetik/api-snippets | rest/taskrouter/taskqueues/instance/get/example-1/example-1.5.x.py | Python | mit | 527 |
from math import log
"""
-- Various average (means) algorithms implementation
-- See: http://en.wikipedia.org/wiki/Average
-- Returns the sum of a sequence of values
"""
#Calculates the arithmetic mean of the list numbers and returns the result
def arithmetic_mean(numbers): return float(sum(numbers))/len(numbers)
... | jiang42/Algorithm-Implementations | Average/Python/wasi0013/Average.py | Python | mit | 2,303 |
# (C) British Crown Copyright 2013 - 2018, Met Office
#
# This file is part of cartopy.
#
# cartopy 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)... | pelson/cartopy | lib/cartopy/tests/crs/test_transverse_mercator.py | Python | lgpl-3.0 | 4,506 |
# -*- coding:utf-8 -*-
import requests, bs4
ROOT_URL = "http://item.jd.com/%s.html"
def get_response(id):#str
rs = requests.get(ROOT_URL%id)
if rs.ok:
return bs4.BeautifulSoup(rs.text)
return None
def parser_dns_prefetch(bs):#BeautifulSoup
all_dns = bs.find_all('link', rel = 'dns-prefetch')
i... | Tary/Python-Tool | PictureFetch/jdimage.py | Python | mit | 894 |
from aimacode.planning import Action
from aimacode.search import Problem
from aimacode.utils import expr
from lp_utils import decode_state
class PgNode():
''' Base class for planning graph nodes.
includes instance sets common to both types of nodes used in a planning graph
parents: the set of nodes in th... | fbrei/aind | planning/my_planning_graph.py | Python | mit | 22,173 |
"""tf.size(input, name = None)
解释:这个函数是返回input中一共有多少个元素。
使用例子:"""
import tensorflow as tf
sess = tf.Session()
data = tf.constant([[[1, 1, 1], [2, 2, 2]], [[3, 3, 3], [4, 4, 4]]])
print(sess.run(data))
d = tf.size(data)
print(sess.run(d)) # 12
"""输入参数:
● input: 一个Tensor。
● name:(可选)为这个操作取一个名字。
输出参数:
● 一个Tensor,... | Asurada2015/TFAPI_translation | array_ops/tf_size.py | Python | apache-2.0 | 465 |
import pytest
from transporter import create_app, redis_store
@pytest.fixture(scope='function')
def app(request):
"""Session-wide test `Flask` application."""
settings_override = {
'TESTING': True,
# 'SQLALCHEMY_DATABASE_URI': TEST_DATABASE_URI,
}
app = create_app(__name__, config=set... | suminb/transporter | tests/conftest.py | Python | mit | 974 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.