repo_name stringlengths 5 104 | path stringlengths 4 248 | content stringlengths 102 99.9k |
|---|---|---|
dherbst/python-icontact | icontact/client.py | # Copyright 2008 Online Agility (www.onlineagility.com)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... |
napalm-automation/napalm-yang | napalm_yang/models/openconfig/components/component/transceiver/physical_channels/channel/state/__init__.py | # -*- coding: utf-8 -*-
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import YANGBool
from pyangbind.lib.yangtypes import YANGListTy... |
yongshengwang/hue | build/env/lib/python2.7/site-packages/Werkzeug-0.6-py2.7.egg/werkzeug/wrappers.py | # -*- coding: utf-8 -*-
"""
werkzeug.wrappers
~~~~~~~~~~~~~~~~~
The wrappers are simple request and response objects which you can
subclass to do whatever you want them to do. The request object contains
the information transmitted by the client (webbrowser) and the response
object contains al... |
Dev-Cloud-Platform/Dev-Cloud | dev_cloud/core/utils/log.py | # -*- coding: utf-8 -*-
# @COPYRIGHT_begin
#
# Copyright [2015] Michał Szczygieł, M4GiK Software
#
# 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... |
npcasler/phenomics | HTPGeoprocessor.py | """
/***************************************************************************
Name : HTP Geoprocessor
Description : Tools for processing HTP geospatial data
Date : 29/Mar/12
copyright : (C) 2012 by Dr. Kelly Thorp, USDA-ARS
email : kelly.thorp@... |
smallyear/linuxLearn | salt/salt/states/boto_vpc.py | # -*- coding: utf-8 -*-
'''
Manage VPCs
=================
.. versionadded:: 2015.8.0
Create and destroy VPCs. Be aware that this interacts with Amazon's services,
and so may incur charges.
This module uses ``boto``, which can be installed via package, or pip.
This module accepts explicit vpc credentials but can als... |
intel-analytics/analytics-zoo | pyzoo/test/zoo/orca/automl/autoestimator/test_autoestimator_keras.py | #
# Copyright 2018 Analytics Zoo Authors.
#
# 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... |
felixbade/minecraft-proxy | app/server_manager/ec2.py | #!/usr/bin/env python
import logging
import boto.ec2
import config
class EC2Client:
def __init__(self):
self.conn = boto.ec2.connect_to_region(config.ec2_region)
def stop(self):
if self.get_status() in ['running', 'pending']:
logging.info('Stopping server...')
self.... |
mrosenstihl/PulsePrograms | make_clean.py | #!/usr/bin/env python
import os
print "Cleaning directory %s"%(os.path.realpath('.'))
rubbish_filetypes = ('h5','hdf','.dat','.pyc', '.png', '.pdf', '.tar.gz')
rubbish_startnames = ('job','logdata','Amplitude','Real','spool','pool')
choosing = raw_input("Continue [yes/anykey_for_NO] ?")
if choosing == 'yes':
print "C... |
sniemi/SamPy | sandbox/src1/TCSE3-3rd-examples/src/py/examples/pde/wave2D_func1_0.py | #!/usr/bin/env python
"""
As wave2D_func1.py, but the wave2D_func1_loop_0 module is used
for the purpose of measuring overhead in array copying.
"""
from __future__ import division # disable integer division
from scitools.numpyutils import *
def solver(I, f, c, bc, Lx, Ly, nx, ny, dt, tstop,
user_act... |
johnkerl/scripts-math | pythonlib/bin/jac.py | #!/usr/bin/python -Wall
# ================================================================
# Copyright (c) John Kerl 2007
# kerl.john.r@gmail.com
# ================================================================
from __future__ import division # 1/2 = 0.5, not 0.
from math import *
from sackmat_m import *
import cop... |
danielnyga/pracmln | python2/pracmln/__init__.py | # (C) 2012-2015 by Daniel Nyga
#
# 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, publish,
# distrib... |
tpazderka/pysaml2 | tests/idp_conf_mdb.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from saml2 import BINDING_SOAP, BINDING_URI
from saml2 import BINDING_HTTP_REDIRECT
from saml2 import BINDING_HTTP_POST
from saml2 import BINDING_HTTP_ARTIFACT
from saml2.saml import NAMEID_FORMAT_PERSISTENT
from saml2.saml import NAME_FORMAT_URI
from pathutils import full... |
fenderglass/Nano-Align | scripts/flip-blockades.py | #!/usr/bin/env python2.7
#(c) 2015-2016 by Authors
#This file is a part of Nano-Align program.
#Released under the BSD license (see LICENSE file)
"""
Flips blockades signals according to the protein's AA order
"""
from __future__ import print_function
import sys
import os
nanoalign_root = os.path.dirname(os.path.di... |
tanghaibao/jcvi | jcvi/assembly/geneticmap.py | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
Use genetic map to break chimeric scaffolds, order and orient scaffolds onto
chromosomes.
"""
import os.path as op
import sys
import logging
import numpy as np
from collections import Counter
from functools import lru_cache
from itertools import combinations, groupby
... |
huku-/pyrsistence | tests/em_dict_basic.py | #!/usr/bin/env python
'''em_dict_basic.py - Basic benchmark for external memory dictionary.'''
__author__ = 'huku <huku@grhack.net>'
import sys
import shutil
import random
import time
import util
import pyrsistence
def main(argv):
# Initialize new external memory dictionary.
util.msg('Populating external... |
coblo/pyiscclib | tests/test_iscclib_image.py | # -*- coding: utf-8 -*-
import pytest
from os.path import dirname, join
from iscclib.image import ImageID
TEST_IMG = join(dirname(__file__), '4.2.04.jpg')
TEST_CODE = u'CAUD7P6NU73ID'
TEST_IDENT = 13733935459959803788
def test_image_id_min_max():
max_value = 2 ** 64 - 1
iid = ImageID(ident=max_value)
ass... |
bmcfee/crema | setup.py | from setuptools import setup, find_packages
import imp
version = imp.load_source('crema.version', 'crema/version.py')
setup(
name='crema',
version=version.version,
description="Convolutional-recurrent estimators for music analysis",
author='Brian McFee',
url='http://github.com/bmcfee/crema',
... |
zlsun/XX-Net | code/default/x_tunnel/local/heroku_front/check_ip.py | #!/usr/bin/env python2
# coding:utf-8
import sys
import os
import threading
current_path = os.path.dirname(os.path.abspath(__file__))
root_path = os.path.abspath( os.path.join(current_path, os.pardir, os.pardir, os.pardir))
data_path = os.path.abspath(os.path.join(root_path, os.pardir, os.pardir, 'data'))
module_data... |
jlaine/django-timegraph | timegraph/admin.py | # -*- coding: utf-8 -*-
#
# django-timegraph - monitoring graphs for django
# Copyright (c) 2011-2012, Wifirst
# Copyright (c) 2013, Jeremy Lainé
# All rights reserved.
#
# See AUTHORS file for a full list of contributors.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permit... |
kylef/swiftenv-api | versions.py | import os
import glob
from pathlib import Path
import flask
import yaml
class VersionManager(object):
def __init__(self, versions=None):
self._versions = versions
@property
def versions(self):
if self._versions is None:
version_paths = Path('versions').glob('**/*.yaml')
... |
siye1982/kafkey | app/main/__init__.py | # -*- coding:utf-8 -*-
import socket
# 判断是否是ip:port
def is_ip_port(ip_port):
ip_port_arr = ip_port.split(':')
if len(ip_port_arr) != 2 or isinstance(ip_port_arr[1], int):
return False
return is_internal_ip(ip_port_arr[0])
# 判断是否是内网ip
def is_internal_ip(ip):
if not check_ip(ip):
retu... |
wraithan/reciblog | urls.py | from django.conf.urls.defaults import patterns, url, include
from django.contrib import admin
from django.conf import settings
from django.views.generic.simple import direct_to_template
admin.autodiscover()
urlpatterns = patterns(
'',
url(r'^', include('reciblog.blog.urls')),
url(r'^about$', direct_to_tem... |
benchalmers/win-installer | src/branding/branding.py |
branding = {
"toolsName" : "Citrix XenServer Tools",
"installerProductName" : "Citrix XenServer Tools Installer",
"manufacturer" : "Citrix",
"installerKeyWords" : "Citrix XenServer Windows Installer",
"shortTools" : "XenTools",
"installerServiceName" : "Citrix Xen... |
jambonrose/DjangoUnleashed-1.8 | blog/feeds.py | from datetime import datetime
from django.contrib.syndication.views import Feed
from django.core.urlresolvers import reverse_lazy
from django.utils.feedgenerator import (
Atom1Feed, Rss201rev2Feed)
from .models import Post
class BasePostFeedMixin():
title = "Latest Startup Organizer Blog Posts"
link = r... |
LarsBV/kate_plugin_template | my_plugin.py | # -*- coding: utf-8 -*-
# Author: <Your name>
# License see LICENSE
from PyKDE4.kdecore import i18n
from PyKDE4.kdeui import KAction, KIcon
from PyQt4.QtCore import QObject
from PyQt4.QtGui import QMenu
from libkatepate.errors import showOk, showError
import kate
class MyPlugin(QObject):
def __init__(self):
... |
dreinhold/pregnancy | contractions/views.py | # Create your views here.
import json
from django.views.generic import (
ListView,
UpdateView,
CreateView,
)
from django.core.urlresolvers import reverse
from contractions.models import Contraction
from django.http import HttpResponse
from django.http import HttpResponseRedirect
class AjaxableResponseMixin(obj... |
stefanseefeld/numba | numba/lowering.py | from __future__ import print_function, division, absolute_import
from collections import namedtuple
import sys
from functools import partial
from llvmlite.ir import Value
from llvmlite.llvmpy.core import Constant, Type, Builder
from . import (_dynfunc, cgutils, config, funcdesc, generators, ir, types,
... |
spiffcode/hostile-takeover | stats/drain.py | import os
import command
import serverinfo
import accounts
from google.appengine.ext.webapp import template
class Drain(command.Command):
def have_access(self):
account = accounts.account()
if not account or not account.DRAIN_ACCESS_RIGHT:
return False
return True
def fini... |
tidepool-org/dfaker | dfaker/tools.py | import pytz
from datetime import datetime, timedelta
def is_dst(zonename, date):
local_tz = pytz.timezone(zonename)
localized_time = local_tz.localize(date)
return localized_time.dst() != timedelta(0)
def get_offset(zonename, date):
local_tz = pytz.timezone(zonename)
if zonename == 'UTC':
... |
mikeh77/mi-instrument | mi/idk/test/test_comm_config.py | #!/usr/bin/env python
"""
@package mi.idk.test.test_comm_config
@file mi.idk/test/test_comm_config.py
@author Bill French
@brief test metadata object
"""
__author__ = 'Bill French'
__license__ = 'Apache 2.0'
from os.path import basename, dirname
from os import makedirs
from os import remove
from os.path import exist... |
desaster/uusipuu | modules/google.py | # -*- coding: ISO-8859-15 -*-
from twisted.web import client
from twisted.internet.defer import inlineCallbacks
from core.Uusipuu import UusipuuModule
import urllib, simplejson
class Module(UusipuuModule):
def startup(self):
self.log('google.py loaded')
@inlineCallbacks
def cmd_google(self, ... |
muhleder/timestrap | core/models.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from datetime import date
from decimal import Decimal, ROUND_DOWN
from django.contrib.sites.models import Site
from django.db import models
from django.db.models import Sum
from django.db.models.signals import post_save
from django.dispatch import receiv... |
frewsxcv/WeasyPrint | weasyprint/css/validation.py | # coding: utf8
"""
weasyprint.css.validation
-------------------------
Expand shorthands and validate property values.
See http://www.w3.org/TR/CSS21/propidx.html and various CSS3 modules.
:copyright: Copyright 2011-2014 Simon Sapin and contributors, see AUTHORS.
:license: BSD, see LICENSE for... |
shackra/thomas-aquinas | notestno/test_openwindow.py | # coding: utf-8
# This file is part of Thomas Aquinas.
#
# Thomas Aquinas 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.
#
# Thomas Aq... |
mattduan/proof | mapper/DatabaseMap.py | """
DatabaseMap is used to model a database.
"""
__version__= '$Revision: 3194 $'[11:-2]
__author__ = "Duan Guoqiang (mattgduan@gmail.com)"
import string
import proof.pk.IDMethod as IDMethod
import proof.pk.generator.IDBroker as IDBroker
import proof.mapper.TableMap as TableMap
class DatabaseMap:
def __init__... |
helix84/activae | deployment/__init__.py | # Copyright (C) 2010 CENATIC: Centro Nacional de Referencia de
# Aplicacion de las TIC basadas en Fuentes Abiertas, Spain.
#
# 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 reta... |
apbard/scipy | scipy/_lib/_numpy_compat.py | """Functions copypasted from newer versions of numpy.
"""
from __future__ import division, print_function, absolute_import
import warnings
import sys
from warnings import WarningMessage
import re
from functools import wraps
import numpy as np
from scipy._lib._version import NumpyVersion
def import_nose():
""" ... |
hmdavis/flask-mega-tutorial | app/views.py | from flask import render_template, flash, redirect, session, url_for, request, g
from flask.ext.login import login_user, logout_user, current_user, login_required
from app import app, db, lm, oid
from forms import LoginForm, EditForm
from models import User, ROLE_USER, ROLE_ADMIN
from datetime import datetime
@lm.user... |
disqus/django-old | tests/modeltests/validation/models.py | from datetime import datetime
from django.core.exceptions import ValidationError
from django.db import models
def validate_answer_to_universe(value):
if value != 42:
raise ValidationError('This is not the answer to life, universe and everything!', code='not42')
class ModelToValidate(models.Model):
na... |
ubgarbage/gae-blog | external_auth/google_login/views.py | from django.http import HttpResponse, HttpResponseRedirect
from django.conf import settings
from external_auth.auth_utils import authenticate_without_pass
from utils import get_view_url
import django
import urllib2
import urllib
def google_login(request):
return_to = get_view_url( request, check_and_auth )
ret... |
tequa/ammisoft | ammimain/WinPython-64bit-2.7.13.1Zero/python-2.7.13.amd64/Scripts/f2py.py | #!C:\Users\DMoran\Downloads\WinPython-64bit-2.7.13.1Zero\python-2.7.13.amd64\python.exe
# See http://cens.ioc.ee/projects/f2py2e/
from __future__ import division, print_function
import os
import sys
for mode in ["g3-numpy", "2e-numeric", "2e-numarray", "2e-numpy"]:
try:
i = sys.argv.index("--" + mode)
... |
mdameenh/elysia | fplassist/update_database.py | # -*- coding: utf-8 -*-
import requests
from datetime import datetime
from fplassist.models import Team_Info, Player_Info, Player_Basic_Stats, Player_Detailed_Stats, FPL_Config
def get_data(api_url):
api_response = requests.get(api_url)
try:
api_response.raise_for_status()
api_data = api_respon... |
lorin/umdinst | test/testidentifysourcefiles.py | import unittest
import sys
import os
import errno
import commands
from xml.dom import minidom
sys.path.append('bin')
from umdinst import wrap
from testsuccessfulcompiledata import getfield, timezonecheck, xmlifystring
from testcapturecompile import programcheck
def createemptyfile(fname):
"""Creates an empty fil... |
tsl143/addons-server | src/olympia/ratings/tests/test_tasks.py | import mock
from olympia.amo.tests import addon_factory, TestCase, user_factory
from olympia.ratings.models import Rating
from olympia.ratings.tasks import addon_rating_aggregates
class TestAddonRatingAggregates(TestCase):
# Prevent <Rating>.refresh() from being fired when setting up test data,
# since it'd ... |
rdevon/cortex | cortex/built_ins/networks/fully_connected.py | '''Simple dense network encoders
'''
import logging
import torch.nn as nn
from .base_network import BaseNet
logger = logging.getLogger('cortex.arch' + __name__)
class FullyConnectedNet(BaseNet):
def __init__(self, dim_in, dim_out=None, dim_h=64, dim_ex=None,
nonlinearity='ReLU', n_levels=N... |
qiita-spots/qiita_client | qiita_client/util.py | # -----------------------------------------------------------------------------
# Copyright (c) 2014--, The Qiita Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... |
idlesign/django-admirarchy | admirarchy/tests/testapp/models.py | from django.db import models
class AdjacencyListModel(models.Model):
title = models.CharField(max_length=100)
parent = models.ForeignKey(
'self', related_name='%(class)s_parent', on_delete=models.CASCADE, db_index=True, null=True, blank=True)
def __str__(self):
return 'adjacencylistmode... |
dcherian/pyroms | pyroms_toolbox/pyroms_toolbox/BGrid_GFDL/get_nc_BGrid_GFDL.py | import numpy as np
import pyroms
from pyroms_toolbox.BGrid_GFDL import BGrid_GFDL
def get_nc_BGrid_GFDL(grdfile, name='GFDL_CM2.1_North_Pacific', \
# xrange=(80,189), yrange=(96,198)):
xrange=(60,175), yrange=(120, 190)):
"""
Bgrd = get_nc_BGrid_GFDL(gr... |
robclark/chromium | ppapi/native_client/ppapi_scons_files.py | # Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
trusted_scons_files = [
'src/shared/ppapi/build.scons',
'src/shared/ppapi_proxy/build.scons',
'src/trusted/plugin/build.scons',
'tests/p... |
pelson/conda-build-all | conda_build_all/tests/unit/test_artefact_destination.py | from argparse import Namespace
from contextlib import contextmanager
import logging
import mock
import os
import sys
import unittest
from conda_build_all.tests.unit.dummy_index import DummyIndex, DummyPackage
from conda_build_all.artefact_destination import (ArtefactDestination,
... |
mozilla/kitsune | kitsune/customercare/migrations/0002_auto_20210716_0556.py | # Generated by Django 2.2.23 on 2021-07-16 05:56
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('customercare', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='reply',
name='user',
),
... |
krasnoperov/django-formalizr | formalizr/tests/tests.py | import json
from django.utils import unittest
from django.test.client import RequestFactory
from formalizr.tests.views import SimpleFormView, SimpleCreateView, SimpleUpdateView
from formalizr.tests.models import SimpleModel
class AjaxFormViewTest(unittest.TestCase):
view_class = SimpleFormView
VALUE = 1
... |
Heufneutje/txircd | txircd/modules/rfc/cmd_user.py | from twisted.plugin import IPlugin
from twisted.words.protocols import irc
from txircd.module_interface import Command, ICommand, IModuleData, ModuleData
from txircd.utils import isValidIdent, trimStringToByteLength
from zope.interface import implementer
from typing import Any, Dict, List, Optional, Tuple
@implementer... |
harikishen/addons-server | src/olympia/editors/management/commands/auto_approve.py | # -*- coding: utf-8 -*-
from collections import Counter
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
from django.core.urlresolvers import reverse
from django.db import transaction
import waffle
import olympia.core.logger
from olympia import amo
from olympia.edito... |
tisimst/pyDOE | pyDOE/doe_factorial.py | """
This code was originally published by the following individuals for use with
Scilab:
Copyright (C) 2012 - 2013 - Michael Baudin
Copyright (C) 2012 - Maria Christopoulou
Copyright (C) 2010 - 2011 - INRIA - Michael Baudin
Copyright (C) 2009 - Yann Collette
Copyright (C) 2009 - CEA - Jean-Ma... |
texttochange/vusion-backend | vusion/persist/model_manager.py | from datetime import datetime
class ModelManager(object):
def __init__(self, db, collection_name, has_stats=False, **kwargs):
self.property_helper = None
self.log_helper = None
self.collection_name = collection_name
self.db = db
if 'logger' in kwargs:
self.log_... |
andymckay/zamboni | mkt/api/tests/test_fields.py | # -*- coding: utf-8 -*-
from mock import Mock
from nose.tools import eq_, ok_
from rest_framework.request import Request
from rest_framework.serializers import CharField, Serializer
from rest_framework.test import APIRequestFactory
from test_utils import RequestFactory
import amo
from amo.tests import TestCase
from mk... |
JudoWill/glue | glue/qt/widgets/edit_subset_mode_toolbar.py | from __future__ import absolute_import, division, print_function
from ...external.qt import QtGui
from ...core.edit_subset_mode import (EditSubsetMode, OrMode, AndNotMode,
AndMode, XorMode, ReplaceMode)
from ..actions import act
from ..qtutil import nonpartial
def set_mode(mode... |
lavish205/olympia | src/olympia/amo/tasks.py | import datetime
from django.apps import apps
from django.core.mail import EmailMessage, EmailMultiAlternatives
import olympia.core.logger
from olympia import amo
from olympia.activity.models import ActivityLog
from olympia.amo.celery import task
from olympia.amo.utils import get_email_backend
from olympia.bandwagon.... |
infinit/couchdb-python | couchdb/client.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2009 Christopher Lenz
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
"""Python client API for CouchDB.
>>> server = Server()
>>> db = server.create('python-tests')
>>> ... |
chippey/gaffer | apps/execute/execute-1.py | ##########################################################################
#
# Copyright (c) 2011-2012, John Haddon. All rights reserved.
# Copyright (c) 2014-2015, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted prov... |
alexis-roche/nipy | nipy/labs/statistical_mapping.py | from __future__ import absolute_import
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
import numpy as np
import scipy.stats as sp_stats
# Use the nibabel image object
from nibabel import Nifti1Image as Image
from nibabel.affines import apply_affine
fr... |
rfleschenberg/django-safedelete | safedelete/tests.py | import django
from django.conf.urls import patterns, include
from django.core.exceptions import ValidationError
from django.contrib import admin
from django.contrib.admin.views.main import ChangeList
from django.contrib.admin.sites import AdminSite
from django.contrib.auth.models import User
from django.db import model... |
edgeflip/dispatch | tests/test_dispatcher.py | import gc
import sys
import time
import weakref
import unittest
from dispatch import Signal, receiver
if sys.platform.startswith('java'):
def garbage_collect():
# Some JVM GCs will execute finalizers in a different thread, meaning
# we need to wait for that to complete before we go on looking for... |
arrayfire/arrayfire_python | arrayfire/statistics.py | #######################################################
# Copyright (c) 2015, ArrayFire
# All rights reserved.
#
# This file is distributed under 3-clause BSD license.
# The complete license agreement can be obtained at:
# http://arrayfire.com/licenses/BSD-3-Clause
######################################################... |
denz/swarm-crawler | swarm_crawler/text.py | BREADABILITY_AVAILABLE = True
try:
from breadability.readable import Article, prep_article, check_siblings
except ImportError:
BREADABILITY_AVAILABLE = False
Article = object
from operator import attrgetter
from werkzeug.utils import cached_property
import re
from lxml.etree import tounicode, tostring
... |
dejlek/pulsar | examples/philosophers/tests.py | import unittest
import asyncio
from pulsar import send
from pulsar.apps.test import test_timeout
from .manage import DiningPhilosophers
class TestPhylosophers(unittest.TestCase):
app_cfg = None
concurrency = 'thread'
@classmethod
@asyncio.coroutine
def setUpClass(cls):
app = DiningPhilo... |
tommy-u/enable | kiva/pdf.py | # Copyright (c) 2005-2014, Enthought, Inc.
# some parts copyright 2002 by Space Telescope Science Institute
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions described in the a... |
MERegistro/meregistro | meregistro/apps/registro/forms/DependenciaFuncionalFormFilters.py | # -*- coding: UTF-8 -*-
from django import forms
from apps.registro.models import DependenciaFuncional, Jurisdiccion, TipoGestion, TipoDependenciaFuncional, TipoEducacion
class DependenciaFuncionalFormFilters(forms.Form):
jurisdiccion = forms.ModelChoiceField(queryset=Jurisdiccion.objects.order_by('nombre'), lab... |
puttarajubr/commcare-hq | corehq/apps/app_manager/tests/test_case_meta.py | from django.test.testcases import SimpleTestCase
from corehq.apps.app_manager.const import APP_V2
from corehq.apps.app_manager.models import Application, Module, OpenCaseAction, ParentSelect, OpenSubCaseAction, \
AdvancedModule, LoadUpdateAction, AdvancedOpenCaseAction
from mock import patch
class CaseMetaTest(Si... |
shub0/algorithm-data-structure | python/find_minimum.py | #! /usr/bin/python
'''
Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).
Find the minimum element.
'''
class Solution:
# @param num, a list of integer
# @return an integer
# You may assume no duplicate exists in the array.
def fi... |
UITools/saleor | saleor/product/migrations/0080_auto_20181214_0440.py | # Generated by Django 2.1.3 on 2018-12-14 10:40
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('product', '0079_default_tax_rate_instead_of_empty_field'),
]
operations = [
migrations.AddField(
model_name='category',
... |
all-of-us/raw-data-repository | rdr_service/lib_fhir/fhirclient_4_0_0/models/composition.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Composition) on 2019-05-07.
# 2019, SMART Health IT.
from . import domainresource
class Composition(domainresource.DomainResource):
""" A set of resources composed into a single coher... |
vsajip/django | tests/regressiontests/introspection/tests.py | from __future__ import absolute_import,unicode_literals
from functools import update_wrapper
from django.db import connection
from django.test import TestCase, skipUnlessDBFeature, skipIfDBFeature
from django.utils import six
from .models import Reporter, Article
#
# The introspection module is optional, so methods... |
wizgrav/protobot | server.py | import SocketServer
class ProtoHandler(SocketServer.BaseRequestHandler):
def handle(self):
msg = self.request.recv(1024)
a = msg.split(" ",2)
if len(a) >1 and a[0] == "GET":
a = a[1].split("/")
a =[i for i in a if i != '']
if len(a) == 0:
... |
tpltnt/SimpleCV | SimpleCV/examples/manipulation/tvexample.py | '''
This program super imposes the camera onto the television in the picture
'''
from __future__ import print_function
print(__doc__)
from SimpleCV import Camera, Image, Display
tv_original = Image("family_watching_television_1958.jpg", sample=True)
tv_coordinates = [(353, 379), (433,380),(432, 448), (354,446)]
tv_m... |
tovmeod/anaf | anaf/events/api/urls.py | # -*- coding: utf-8 -*-
import handlers
from django.conf.urls import url, patterns
from anaf.core.api.auth import auth_engine
from anaf.core.api.doc import documentation_view
from anaf.core.api.resource import CsrfExemptResource
ad = {'authentication': auth_engine}
# events resources
eventResource = CsrfExemptResour... |
SunPower/PVMismatch | pvmismatch/tests/test_pvconstants.py | from pvmismatch import *
import os
import numpy as np
BASEDIR = os.path.dirname(__file__)
def test_pvconst_npts_setter():
"""Test pvconst property and setter methods"""
pvconst = pvconstants.PVconstants()
assert pvconst.npts == pvconstants.NPTS
assert len(pvconst.pts) == pvconst.npts
assert pvco... |
qpxu007/Flask-AppBuilder | flask_appbuilder/security/forms.py | from wtforms import StringField, BooleanField, PasswordField
from flask_wtf.recaptcha import RecaptchaField
from flask_babelpkg import lazy_gettext
from wtforms.validators import DataRequired, EqualTo, Email
from ..fieldwidgets import BS3PasswordFieldWidget, BS3TextFieldWidget
from ..forms import DynamicForm
class Lo... |
CptLemming/django-socket-server | socket_server/client.py | import json
from autobahn.twisted.websocket import WebSocketClientProtocol, WebSocketClientFactory
class SocketClientProtocol(WebSocketClientProtocol):
def emit(self, event_name, **kwargs):
payload = self._format_outbound_data(event_name, **kwargs)
self.sendMessage(payload)
def _format_out... |
atztogo/phonopy | phonopy/qha/core.py | """Core routines for QHA."""
# Copyright (C) 2012 Atsushi Togo
# All rights reserved.
#
# This file is part of phonopy.
#
# 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 ... |
donbright/piliko | experiment/fiborec.py | from fractions import Fraction as f
import sys
# draw points of squares->tiling a rectangle
# size of squares = fibonacci seq
def sqr(x): return x*x
def greenq(x,y,x2,y2): return 2*(x2-x)*(y2-y)
def redq(x,y,x2,y2): return sqr(x2-x)-sqr(y2-y)
def blueq(x,y,x2,y2): return sqr(x2-x)+sqr(y2-y)
xs,ys=[],[]
depth=50
clas... |
samueladam/worldgame | src/worldgame/forms.py | # -*- coding: utf-8 -*-
from django.contrib.gis import admin
from django import forms
from .models import Country
# create a geoadmin instance
geoadmin = admin.GeoModelAdmin(Country, admin.site)
geoadmin.num_zoom = 4
geoadmin.modifiable = False
geoadmin.layerswitcher = False
geoadmin.mouse_position = False
geoadmin.s... |
rgommers/statsmodels | statsmodels/stats/multitest.py | '''Multiple Testing and P-Value Correction
Author: Josef Perktold
License: BSD-3
'''
from statsmodels.compat.python import range
from statsmodels.compat.collections import OrderedDict
import numpy as np
#==============================================
#
# Part 1: Multiple Tests and P-Value Correction
#
#=========... |
J535D165/recordlinkage | tests/test_measures.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import division
import recordlinkage as rl
import numpy
import pandas
FULL_INDEX = pandas.MultiIndex.from_product(
[[1, 2, 3], [1, 2, 3]], # 3x3 matrix
names=['first', 'second'])
LINKS_TRUE = pandas.MultiIndex.from_tuples(
[(1, 1), (2, 2), (... |
anushbmx/kitsune | kitsune/users/models.py | import hashlib
import logging
import random
import re
import time
from datetime import datetime, timedelta
from django.conf import settings
from django.contrib.auth.models import User, Group
from django.contrib.sites.models import Site
from django.db import models
from django.utils.translation import ugettext as _, ug... |
sdgdsffdsfff/pymesos | pymesos/scheduler.py | import time
import logging
import struct
import socket
from mesos.interface.mesos_pb2 import TASK_LOST, MasterInfo
from .messages_pb2 import (
RegisterFrameworkMessage, ReregisterFrameworkMessage,
DeactivateFrameworkMessage, UnregisterFrameworkMessage,
ResourceRequestMessage, ReviveOffersMessage, LaunchTa... |
pombredanne/ompc | ompclib/gplot/PlotItems.py | # $Id: PlotItems.py,v 2.13 2003/08/18 22:33:00 mhagger Exp $
# Copyright (C) 1998-2003 Michael Haggerty <mhagger@alum.mit.edu>
#
# This file is licensed under the GNU Lesser General Public License
# (LGPL). See LICENSE.txt for details.
"""PlotItems.py -- Objects that can be plotted by Gnuplot.
This module contains ... |
DanialLiu/SkiaWin32Port | third_party/externals/gyp/pylib/gyp/generator/ninja.py | # Copyright (c) 2013 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import copy
import hashlib
import multiprocessing
import os.path
import re
import signal
import subprocess
import sys
import gyp
import gyp.common
import gyp.msvs_... |
jrleeman/MetPy | metpy/io/_tools.py | # Copyright (c) 2009,2016 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""A collection of general purpose tools for reading files."""
from __future__ import print_function
import bz2
from collections import namedtuple
import gzip
import logging
f... |
danakj/chromium | third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/mac_unittest.py | # Copyright (C) 2010 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... |
globocom/database-as-a-service | dbaas/physical/commands.py | class HostCommands(object):
def __new__(cls, host):
if host.is_ol6:
return HostCommandOL6(host)
if host.is_ol7:
return HostCommandOL7(host)
class HostBaseCommands(object):
def __init__(self, host):
self.host = host
self.infra = host.infra
self.e... |
planetarypy/pvl | tests/test_init.py | #!/usr/bin/env python
"""This module has unit tests for the pvl __init__ functions."""
# Copyright 2019, Ross A. Beyer (rbeyer@seti.org)
#
# 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
#
# ... |
what-studio/gauge | recipes/namedgauge.py | # -*- coding: utf-8 -*-
"""A recipe to implement named gauge. Named gauge keeps momenta and their
names. You can manipulate a specific momentum by the name you named.
Test it by `py.test <http://pytest.org/>`_:
.. sourcecode:: console
$ py.test recipes/namedgauge.py
"""
from collections import namedtuple
from ti... |
cournape/ensetuptools | setuptools/utils.py | """
This module is not part of the original setuptools code.
It was created because much of the code in order modules was (and still
is) unorganized and simple utility functions were defined as class methods
for no obious reason, uselessly cluttering some of the large classes.
This module is a place such functions.
""... |
neurospin/pylearn-epac | test/bug_joblib/test_joblib_2000fts.py | from joblib import Parallel, delayed
from epac import Methods
import numpy as np
from sklearn import datasets
from sklearn.svm import SVC
X, y = datasets.make_classification(n_samples=500,
n_features=200000,
n_informative=2,
... |
leighpauls/k2cro4 | tools/swarm_client/PRESUBMIT.py | # Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Top-level presubmit script for swarm_client.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for
details on the presubmit... |
stanford-mast/nn_dataflow | nn_dataflow/core/loop_enum.py | """ $lic$
Copyright (C) 2016-2020 by Tsinghua University and The Board of Trustees of
Stanford University
This program is free software: you can redistribute it and/or modify it under
the terms of the Modified BSD-3 License as published by the Open Source
Initiative.
This program is distributed in the hope that it wi... |
MERegistro/meregistro | meregistro/apps/postitulos/models/Postitulo.py | # -*- coding: utf-8 -*-
from django.db import models
from apps.postitulos.models.EstadoPostitulo import EstadoPostitulo
from apps.postitulos.models.TipoPostitulo import TipoPostitulo
from apps.postitulos.models.PostituloTipoNormativa import PostituloTipoNormativa
from apps.postitulos.models.CarreraPostitulo import Carr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.