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 |
|---|---|---|---|---|---|
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack Foundation.
# 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.apach... | yamt/neutron | quantum/tests/unit/test_servicetype.py | Python | apache-2.0 | 20,304 |
"""
WSGI config for django_shopify project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICA... | BootstrapHeroes/django-shopify | django_shopify/django_shopify/wsgi.py | Python | gpl-3.0 | 1,443 |
# -*- coding: utf-8 -*-
from py3oauth2 import message
from py3oauth2.authorizationcodegrant import (
AccessTokenRequest,
AuthorizationRequest,
)
from oidc.idtoken import IDToken as BaseIDToken
__all__ = ['IDToken', 'AuthenticationRequest', 'AccessTokenRequest']
class AuthenticationRequest(AuthorizationRequ... | GehirnInc/python-oidc | oidc/authorizationcodeflow.py | Python | mit | 2,062 |
"""Reactions form class for email notifications."""
from wtforms import SelectField, TextAreaField, TextField
from wtforms.validators import DataRequired, Optional
from ..base import BaseReactForm
class ReactForm(BaseReactForm): #pylint: disable=no-init
''' Class that creates an form for the reaction Docker: S... | Runbook/runbook | src/web/reactionforms/docker-rm-container/__init__.py | Python | apache-2.0 | 2,588 |
# -*- coding: utf-8 -*-
# For debugging
# NVIM_PYTHON_LOG_FILE=nvim.log NVIM_PYTHON_LOG_LEVEL=INFO nvim
from __future__ import absolute_import
import os
py = 'python3'
# detect python2
if 'VIRTUAL_ENV' in os.environ:
py2 = os.path.join(os.environ['VIRTUAL_ENV'], 'bin', 'python2')
if os.path.isfile(py2):
... | roxma/nvim-completion-manager | pythonx/cm_sources/cm_jedi.py | Python | mit | 6,231 |
from logging import *
import json
import re
import os
site_conf = None
def _json_minify(json,strip_space=True):
""" The main purpose of us using this is to strip comments, which aren't actually
supported by json.
Based on JSON.minify.js:
https://github.com/getify/JSON.minify
"""
... | svagionitis/news-scraper | site_configuration.py | Python | gpl-2.0 | 2,723 |
# -*- coding: utf-8 -*-
import sys
import abc
import json
from six import with_metaclass
from payplug import config, exceptions
from payplug.__version__ import __version__
class HttpRequest(with_metaclass(abc.ABCMeta)):
"""
Generic interface to abstract an HTTP Request.
"""
def _raise_unrecoverable_er... | payplug/payplug-python | payplug/network.py | Python | mit | 11,294 |
exceedances = data.rolling(8).mean().resample('D').max() > 100
exceedances = exceedances.groupby(exceedances.index.year).sum()
ax = exceedances.loc[2005:].plot(kind='bar') | jorisvandenbossche/2015-EuroScipy-pandas-tutorial | snippets/07 - Case study - air quality data86.py | Python | bsd-2-clause | 171 |
# -*- coding: utf-8 -*-
#
# Copyright 2007,2009-2011 Zuza Software Foundation
#
# This file is part of the Translate Toolkit.
#
# 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 2 o... | unho/translate | translate/storage/jsonl10n.py | Python | gpl-2.0 | 12,302 |
class GymWrapper():
def __init__(self, env):
self.env = env
self.last_reward = 0.0
self.current_state = None
self.terminal_flag = False
self.n_actions = env.action_space.n
self.model_dims = env.observation_space.shape
def act(self, action):
"""
... | sisl/Chimp | chimp/simulators/gym/gym_wrapper.py | Python | apache-2.0 | 1,405 |
# -*- Mode: Python; py-indent-offset: 4 -*-
# pygobject - Python bindings for the GObject library
# Copyright (C) 2006-2012 Johan Dahlin
#
# gobject/__init__.py: initialisation file for gobject module
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser Gene... | onia/pygobject | gi/_gobject/__init__.py | Python | lgpl-2.1 | 2,297 |
# 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... | keras-team/keras | keras/distribute/keras_image_model_correctness_test.py | Python | apache-2.0 | 6,668 |
import uuid
import pytest
from conans.util import encrypt
def test_encryp_basic():
key = str(uuid.uuid4())
message = 'simple data ascii string'
data = encrypt.encode(message, key)
assert type(message) == type(data)
assert message != data
assert message != data
decoded = encrypt.decode(... | conan-io/conan | conans/test/unittests/util/test_encrypt.py | Python | mit | 1,463 |
"""
meuh.ctx
~~~~~~~~
"""
from __future__ import absolute_import, print_function, unicode_literals
__all__ = ['inline', 'EnvBuilder']
import abc
import logging
from six import add_metaclass
from six.moves import shlex_quote as quote
logger = logging.getLogger(__name__)
@add_metaclass(abc.ABCMeta)
class Pa... | johnnoone/meuh-python | meuh/ctx.py | Python | mit | 3,745 |
"""
==========================================================
Adjustment for chance in clustering performance evaluation
==========================================================
The following plots demonstrate the impact of the number of clusters and
number of samples on various clustering performance evaluation me... | shyamalschandra/scikit-learn | examples/cluster/plot_adjusted_for_chance_measures.py | Python | bsd-3-clause | 4,347 |
# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""New implementation of Visual Studio project generation."""
import os
import random
import gyp.common
# hashlib is supplied as of Python 2.5 as the... | mikemcdaid/getonupband | sites/all/themes/getonupband/node_modules/node-gyp/gyp/pylib/gyp/MSVSNew.py | Python | gpl-2.0 | 12,464 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import argparse
import numpy as np
import matplotlib
matplotlib.use('Agg')
matplotlib.rcParams['pdf.fonttype'] = 42
matplotlib.rcParams['svg.fonttype'] = 'none'
from deeptools import cm # noqa: F401
import matplotlib.pyplot as plt
from deeptools.correlation im... | fidelram/deepTools | deeptools/plotCorrelation.py | Python | gpl-3.0 | 10,834 |
from __future__ import unicode_literals
from rest_framework import viewsets
from onadata.apps.fsforms.models import InstanceStatusChanged, FInstance
from onadata.apps.fsforms.serializers.InstanceStatusChangedSerializer import InstanceStatusChangedSerializer, FInstanceResponcesSerializer
from rest_framework.pagination ... | awemulya/fieldsight-kobocat | onadata/apps/fsforms/viewsets/InstanceHistoryViewSet.py | Python | bsd-2-clause | 2,339 |
# 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 ... | Fokko/incubator-airflow | airflow/configuration.py | Python | apache-2.0 | 22,041 |
# To get the configuration paths to resolve correctly, we need to import each of
# the hand-coded extension modules in this package.
from . import _numpy
| rosenbrockc/acorn | acorn/subclass/__init__.py | Python | mit | 154 |
from ThreeDiToolbox.tool_commands.import_sufhyd.import_sufhyd_main import Importer
from ThreeDiToolbox.tool_commands.import_sufhyd.sufhyd_importer import SufhydReader
import unittest
class TestReadSufhyd(unittest.TestCase):
def test_knp(self):
knp = "*KNP 0000NOORD1 164371100 388463700... | nens/threedi-qgis-plugin | tool_commands/import_sufhyd/read_sufhyd.py | Python | gpl-3.0 | 6,870 |
from django.utils.translation import ugettext_noop as _
from custom.bihar.reports import supervisor, due_list, mch_reports
from custom.bihar.reports.indicators import reports as indicators
# some static strings go here
_("Active Cases")
_("Total Cases")
_("Total Form Submissions")
_("Days Since Last Submission")
_("... | qedsoftware/commcare-hq | custom/bihar/reports/__init__.py | Python | bsd-3-clause | 1,305 |
#!/usr/bin/env python
from datetime import datetime
import os
import sys
from ert.ecl import EclSum, EclSumTStep
from ert.test import ExtendedTestCase
try:
from synthesizer import OilSimulator
except ImportError as e:
share_lib_path = ExtendedTestCase.createSharePath("lib")
sys.path.insert(0, share_lib_p... | Ensembles/ert | test-data/local/snake_oil/jobs/snake_oil_simulator.py | Python | gpl-3.0 | 7,949 |
# coding: utf-8
# python imports
import re
# django imports
from django import template
from django.contrib.contenttypes.models import ContentType
from django.utils.formats import get_format
from django.db import models
from django.contrib import admin
from django.conf import settings
# grappelli imports
from grappe... | MehmetNuri/ozgurlukicin | grappelli/templatetags/grp_tags.py | Python | gpl-3.0 | 3,324 |
import math
from collections import defaultdict, Counter
import pre_process as pp
'''
BM25 scoring formula for VSM IR
Parameters k1, b, k3 need to be tuned
Defaults k1 = 1.5, b = 0.5, k3 = 0
BM25 gives better results than
basic vsm in ir.py
'''
bm25_index = defaultdict(list)
# Collect term frequencies for each se... | ethaninmel/BeautifulMind | probabilistic_ir.py | Python | mit | 3,064 |
from addons.models import Category
from olympia import amo
def run():
"""
We reorganized our categories:
https://bugzilla.mozilla.org/show_bug.cgi?id=854499
Usage::
python -B manage.py runscript migrations.575-reorganize-cats
"""
all_cats = Category.objects.filter(type=amo.AD... | harry-7/addons-server | src/olympia/migrations/575-reorganize-cats.py | Python | bsd-3-clause | 2,894 |
from hpp.corbaserver.rbprm.hyq_abstract import Robot
from hpp.gepetto import Viewer
from hpp.corbaserver import ProblemSolver
import time
vMax = 0.2# linear velocity bound for the root
aMax = 0.1# linear acceleration bound for the root
extraDof = 6
mu=0.5# coefficient of friction
# Creating an instance of the helper... | pFernbach/hpp-rbprm-corba | script/scenarios/demos/hyq_slalom_debris_path.py | Python | lgpl-3.0 | 3,955 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class BulkEmail(Document):
pass | gangadharkadam/v5_frappe | frappe/email/doctype/bulk_email/bulk_email.py | Python | mit | 235 |
from django.contrib.contenttypes.models import ContentType
from django.contrib.postgres.fields import ArrayField
from django.core.exceptions import ValidationError
from django.db import IntegrityError, models
from django.utils.functional import cached_property
from django.utils import timezone
from guardian.models impo... | binoculars/osf.io | osf/models/collection.py | Python | apache-2.0 | 8,029 |
from noodles.lib import coroutine
class EndOfWork(object):
pass
def close_coroutine(x):
try:
x.send(EndOfWork)
except StopIteration:
pass
def test_coroutine():
@coroutine
def list_sink(lst):
while True:
value = yield
if value is EndOfWork:
... | NLeSC/noodles | test/lib/test_coroutine.py | Python | apache-2.0 | 508 |
# Copyright 2015 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... | RyanYoung25/tensorflow | tensorflow/python/summary/event_multiplexer.py | Python | apache-2.0 | 10,678 |
from test.integration.base import DBTIntegrationTest, use_profile
import os
import json
import shutil
import yaml
from unittest import mock
import dbt.semver
import dbt.config
import dbt.exceptions
import dbt.flags
class BaseDependencyTest(DBTIntegrationTest):
@property
def schema(self):
return "loca... | analyst-collective/dbt | test/integration/006_simple_dependency_tests/test_local_dependency.py | Python | apache-2.0 | 9,369 |
# -*- coding: utf-8 -*-
"""
Copyright (c) Microsoft Open Technologies (Shanghai) Co. Ltd. All rights reserved.
The MIT License (MIT)
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 restr... | Fendoe/open-hackathon | open-hackathon-server/src/hackathon/hackathon_scheduler.py | Python | mit | 11,119 |
#$ neutron_plugin 01
def handler_help_help(type, source, parameters):
if parameters and COMMANDS.has_key(parameters):
reply = COMMANDS[parameters]['description'] + ' Usage: ' + COMMANDS[parameters]['syntax'] + '\nExamples:'
for example in COMMANDS[parameters]['examples']:
reply += '\n * ' + example
reply +... | mikemintz/neutron | plugins/help_plugin.py | Python | gpl-2.0 | 1,076 |
# -*- coding: utf-8 -*-
#
# pygot documentation build configuration file, created by
# sphinx-quickstart on Tue Apr 28 13:18:13 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All... | edwintye/pygotools | doc/source/conf.py | Python | gpl-2.0 | 12,062 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from PyQt4 import QtGui
from StarButton import StarButton
class StarsWidget( QtGui.QWidget ):
def __init__( self, parent ):
QtGui.QWidget.__init__( self, parent )
self.value = 0
self.star_1 = StarButton( self )
self.star_1.clicked.connect( self.set_value_1 ... | daign/daign-image-organizer | src/StarsWidget.py | Python | mit | 1,933 |
#!/usr/bin/env python
import optparse
import os
import sys
def compile_messages(locale=None):
basedir = None
if os.path.isdir(os.path.join('conf', 'locale')):
basedir = os.path.abspath(os.path.join('conf', 'locale'))
elif os.path.isdir('locale'):
basedir = os.path.abspath('locale')
el... | ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/lib/django-0.96/django/bin/compile-messages.py | Python | bsd-3-clause | 1,931 |
# Copyright (c) 2013 OpenStack Foundation
# 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 ... | wolverineav/neutron | neutron/plugins/ml2/driver_api.py | Python | apache-2.0 | 40,848 |
import threading
import time
import random
class Observer:
def started(self, observable, total_work_units):
pass
def progress(self, observable, work_units):
pass
def stopped(self, observable, error):
pass
@staticmethod
def broadcast_started(observers, observable, total_w... | DeDop/dedop-sandbox | backend/dedopws/processor.py | Python | gpl-3.0 | 3,899 |
# 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/v2018_01_01/models/route_filter.py | Python | mit | 2,621 |
adventures = [
{
"id" : 1,
"name" : "Test Location",
},
{
"id" : 12,
"name" : "The Sewer",
},
{
"id" : 15,
"name" : "The Spooky Forest",
},
{
"id" : 16,
"name" : "The Haiku Dungeon",
},
{
"id" : 17,
"name... | ijzer/cwbot-ndy | kol/data/Adventures.py | Python | bsd-3-clause | 12,146 |
from __future__ import print_function
import numpy
import time
import traceback
import colorsys
import random
class EffectLayer(object):
"""Abstract base class for one layer of an LED light effect. Layers operate on a shared framebuffer,
adding their own contribution to the buffer and possibly blending or o... | chillpop/RELAX-HARDER | effects/base.py | Python | mit | 10,042 |
"""
Support for the Psychrometrics component.
For more details about this platform, please refer to the documentation
https://home-assistant.io/components/binary_sensor.psychrometrics/
"""
import asyncio
from ..psychrometrics import (
DOMAIN, PsychrometricsBinarySensor, CONF_NAME,
ATTR_FRIENDLY_NAME, ATTR_DEV... | azogue/hass_config | custom_components/binary_sensor/psychrometrics.py | Python | mit | 855 |
import datetime
from unittest import TestCase
from unittest.mock import patch, Mock
from errorrat.proxies.rollbar import RollbarProxy, requests
from nose.tools import assert_equal, assert_raises
from requests.auth import HTTPBasicAuth
import json
def dummy_resp(user='userid1', ts=1459953157):
resp = Mock()
re... | piohhmy/error-rat | errorrat/proxies/tests/test_rollbar.py | Python | mit | 2,862 |
'''
Created on: May 09, 2013
@author: qwang
Memcache client
'''
import memcache
from weibonews.utils.decorators import perf_logging
_TIMEOUT = 0
class CacheClient:
def __init__(self, servers, timeout=_TIMEOUT):
if isinstance(servers, basestring):
self._client = memcache.Client(servers.split(... | vispeal/VoteHelper | weibonews/weibonews/utils/cache.py | Python | gpl-2.0 | 1,175 |
#!/usr/bin/env python
import logging
import random
import urllib
from bottle import Bottle, run, request, response, static_file, template, TEMPLATE_PATH, BaseRequest
import fcntl
import base64
import hashlib
import os
import json
import re
from copy import copy
os.umask(0077)
nameRe = re.compile ("^[a-zA-Z0-9_-]+$")... | lethalman/nixpaste | nixpaste.py | Python | gpl-3.0 | 6,490 |
# 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
from frappe.utils import flt, cstr, cint
from frappe import _
import json
from erpnext.stock.doctype.item.item import get_last_purchase_d... | brownharryb/erpnext | erpnext/buying/utils.py | Python | gpl-3.0 | 3,918 |
from parse import Parser
class ExtendedParser(Parser):
def _handle_field(self, field):
# handle as path parameter field
field = field[1:-1]
path_parameter_field = "{%s:PathParameter}" % field
return super()._handle_field(path_parameter_field)
class PathParameter:
name = "Pat... | p1c2u/openapi-core | openapi_core/templating/util.py | Python | bsd-3-clause | 930 |
"""
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this ... | sekikn/ambari | ambari-server/src/test/python/stacks/test_stack_adviser.py | Python | apache-2.0 | 7,755 |
# -*- coding: utf-8 -*-
from openerp import _, api, fields, models
class MailTemplate(models.Model):
_inherit = "mail.template"
force_email_send = fields.Boolean(string="Force mail send?")
@api.multi
def send_mail(self, res_id, force_send=False, raise_exception=False):
... | houssine78/addons | email_template_config/models/mail_template.py | Python | agpl-3.0 | 426 |
import sys
from toolshed import reader
# define our input files
seq_file = 'sample-seq-info.csv'
lab_file = 'sample-lab-info.tsv'
# this is a way to tell reader that we will skip all lines until we find one
# where fields[0] == "Lane"
def is_extra_lines(fields):
return fields[0] != "Lane"
# we will store all th... | jayhesselberth/workshop | content/Code/sample-merge.py | Python | gpl-2.0 | 2,252 |
#!/usr/bin/python
import base64
import struct
from hashlib import sha256
from Crypto.Cipher import AES
unpad = lambda s : s[0:-ord(s[-1])]
class jenkins(object):
def init(self):
conf={
'name':'jenkins',
'author':'tautology',
'hashes':[
{
'name': 'jenkins',
'decode': self.jenkinsdecode,
... | pentestpartners/Password-Decoders | pwdecoder/plugins/jenkins.py | Python | mit | 1,594 |
import os
import sublime
import sys
import threading
if os.name == 'nt':
from ctypes import windll, create_unicode_buffer
class Prefs:
@staticmethod
def load():
settings = sublime.load_settings('PHPIDE.sublime-settings')
Prefs.plugins = settings.get('plugins', [])
Prefs.debug = s... | stuartherbert/sublime-phpide | phpide.py | Python | bsd-3-clause | 1,532 |
import numpy as np
def reconstruction_error(XY, XY_completed, missing_mask, name=None):
"""
Returns mean squared error and mean absolute error for
completed matrices.
"""
value_pairs = [
(i, j, XY[i, j], XY_completed[i, j])
for i in range(XY.shape[0])
for j in range(XY.shap... | iskandr/fancyimpute | test/common.py | Python | apache-2.0 | 863 |
class Rectangle(object):
def draw(self):
print ("Rectangle draw() method")
class Square(object):
def draw(self):
print ("Square draw() method")
class Read(object):
def fill(self):
print ("Read fill")
class Blue(object):
def fill(self):
print ("Blue fill")
... | kimgea/design_patterns | creational/abstract_factory_fun.py | Python | mit | 2,291 |
"""Provides the view of a help topic."""
import json
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.template.loader import render_to_string
from django.contrib.auth.decorators import login_required
from django.shortcuts import get_object_or_404
from django.http im... | yongwen/makahiki | makahiki/apps/widgets/help/views.py | Python | mit | 1,167 |
# Copyright IBM Corp. 2013 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... | scottdangelo/RemoveVolumeMangerLocks | cinder/volume/drivers/ibm/gpfs.py | Python | apache-2.0 | 59,193 |
#
#
#
from {{appname}}.config import database, myapp
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from sqlalchemy import MetaData
import logging
db_log_file_name = myapp["logfile"]
db_handler_log_level = logging.INFO
db_logger_log_level = logging.DEBUG
formatter = myapp["logformat"]
d... | pythononwheels/pow_clean | start/database/sqldblib.py | Python | mit | 1,263 |
#!/usr/bin/env python
# The MIT License (MIT)
#
# Copyright (c) 2013 Bartosz Zaczynski
#
# 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... | bzaczynski/microanalyst | tests/test_stylesheet.py | Python | mit | 10,392 |
# ----------------------------------------------------------------------------
# Copyright (c) 2016-2021, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... | qiime2/q2-types | q2_types/feature_table/_transformer.py | Python | bsd-3-clause | 4,831 |
"""
Class for the height of the geoid.
"""
import numpy as _np
import copy as _copy
import xarray as _xr
from .shgrid import SHGrid as _SHGrid
from .shgrid import _pygmt_module
class SHGeoid(object):
"""
Class for the height of the geoid. The class is initialized from a class
instance of SHGravCoeffs... | SHTOOLS/SHTOOLS | pyshtools/shclasses/shgeoid.py | Python | bsd-3-clause | 15,251 |
#
# Copyright (C) 2009 Juan Pedro Bolivar Puente, Alberto Villegas Erce
#
# This file is part of Pidgeoncide.
#
# Pidgeoncide 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
# L... | arximboldi/pigeoncide | src/base/meta.py | Python | gpl-3.0 | 3,074 |
# -*- coding: utf8 -*-
"""
...
"""
from __future__ import absolute_import, division, print_function
| w495/python-video-shot-detector | shot_detector/features/metrics/__init__.py | Python | bsd-3-clause | 106 |
# -*- coding: utf-8 -*-
# Copyright (C) 2009 Canonical
#
# Authors:
# Michael Vogt
#
# 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; version 3.
#
# This program is distributed in the hope that... | vanhonit/xmario_center | softwarecenter/backend/reviews/__init__.py | Python | gpl-3.0 | 28,992 |
#!/usr/bin/env python
###
# This script sets up a Spark cluster on Google Compute Engine
# Sigmoidanalytics.com
###
from __future__ import with_statement
import logging
import os
import pipes
import random
import shutil
import subprocess
import sys
import tempfile
import time
import commands
import urllib2
from optp... | sigmoidanalytics/spark_gce | spark_gce.py | Python | apache-2.0 | 20,428 |
import wizard
import account_invoice | funkring/fdoo | addons-funkring/subscription_invoice/__init__.py | Python | agpl-3.0 | 36 |
"""Open ports in your router for Home Assistant and provide statistics."""
import asyncio
from ipaddress import ip_address
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.config_entries import ConfigEntry
from homeassistant.exceptions import ConfigEntryNotReady
from homeassistant.... | partofthething/home-assistant | homeassistant/components/upnp/__init__.py | Python | apache-2.0 | 5,372 |
from django import forms
from write.models import Author, Document
from django.contrib.auth.models import User
from django.contrib.auth.forms import UserCreationForm
from pagedown.widgets import PagedownWidget
from markdown_deux.templatetags.markdown_deux_tags import markdown_allowed
class BlurbForm(forms.ModelForm):... | mikelese/spitballingHere | write/forms.py | Python | mit | 1,756 |
from .._gae import ndb
from ..adapters.google import GoogleDatastore
from ..helpers.gae import NDBDecimalProperty
from .base import NoSQLDialect
from . import dialects, sqltype_for
@dialects.register_for(GoogleDatastore)
class GoogleDatastoreDialect(NoSQLDialect):
FILTER_OPTIONS = {
'=': lambda a, b: a ==... | stephenrauch/pydal | pydal/dialects/google.py | Python | bsd-3-clause | 5,667 |
from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
class Company(db.Model):
__table__name = "company"
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(255), unique=True)
location = db.Column(db.String(255))
description = db.Column(db.String(2000))
org_type = db.C... | studenton/NearU | models.py | Python | gpl-3.0 | 2,112 |
import sys
sys.path.append('gen-py')
from thrift.transport import TSocket
from thrift.server import TServer
from evolved import SocialLookup
site_rank = {1 : ("Facebook", 750000000),
2 : ("Twitter", 250000000),
3 : ("LinkedIn", 110000000) }
class SocialLookupHandler(SocialLookup.Iface):
... | RandyAbernethy/ThriftBook | part2/services/evolution/evolved_server.py | Python | apache-2.0 | 1,137 |
# -*- coding: utf-8 -*-
# Copyright (c) 2012 theo crevon
#
# See the file LICENSE for copying permission.
from fabric.api import *
from fabric.contrib.files import exists
@task
def mount(bucket_name, s3_endpoint="http://s3.amazonaws.com"):
"""Mounts a s3fs partition synced with `bucket_name` bucket on hosts"""
... | oleiade/Fridge | fabfile/config/s3fs.py | Python | mit | 1,238 |
"""Image Processing SciKit (Toolbox for SciPy)
``scikit-image`` (a.k.a. ``skimage``) is a collection of algorithms for image
processing and computer vision.
The main package of ``skimage`` only provides a few utilities for converting
between image data types; for most features, you need to import one of the
following... | kenshay/ImageScript | ProgramData/SystemFiles/Python/Lib/site-packages/skimage/__init__.py | Python | gpl-3.0 | 5,831 |
#!/usr/bin/env python
# The MIT License (MIT)
#
# Copyright (c) 2013 Bartosz Zaczynski
#
# 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... | bzaczynski/microanalyst | microanalyst/commons/osutils.py | Python | mit | 2,762 |
import inspect
import cytoolz
from types import BuiltinFunctionType
from cytoolz import curry, identity, keyfilter, valfilter, merge_with
from dev_skip_test import dev_skip_test
@curry
def isfrommod(modname, func):
mod = getattr(func, '__module__', '') or ''
return modname in mod
@dev_skip_test
def test_cl... | llllllllll/cytoolz | cytoolz/tests/test_embedded_sigs.py | Python | bsd-3-clause | 3,024 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-09-03 18:48
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0001_initial'),
]
operations = [
migrations.AlterField(
... | goodes/fit4school | fit4school/core/migrations/0002_auto_20170903_2148.py | Python | apache-2.0 | 579 |
# -*- coding: UTF-8 -*-
# /*
# * Copyright (C) 2015 Libor Zoubek + jondas
# *
# *
# * 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 2, or (at your option)
# * any lat... | bbaronSVK/plugin.video.sosac.ph | resources/lib/sosac.py | Python | gpl-2.0 | 25,065 |
# Outspline - A highly modular and extensible outliner.
# Copyright (C) 2011-2014 Dario Giovannetti <dev@dariogiovannetti.net>
#
# This file is part of Outspline.
#
# Outspline 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 Softw... | xguse/outspline | src/outspline/conf/plugins/wxtasklist.py | Python | gpl-3.0 | 4,538 |
from behave import given, when, then
from mock import patch
from os.path import dirname
from fastpay import FastPay
import requests
import json
def get_content_from_mock(filename):
filepath = dirname(dirname(__file__)) + '/mock/' + filename
with open(filepath) as f:
content = json.load(f)
retur... | yahoojapan/fastpay-python | tests/steps/steps.py | Python | mit | 9,903 |
##########################################################################
## # The Coq Proof Assistant / The Coq Development Team ##
## v # INRIA, CNRS and contributors - Copyright 1999-2018 ##
## <O___,, # (see CREDITS file for the list of authors) ##
## \VV/ #########... | letouzey/coq-wip | doc/tools/coqrst/repl/coqtop.py | Python | lgpl-2.1 | 3,927 |
from setuptools import setup
setup(
name="timekeeper",
version="0.1.1",
description="Send runtime measurements of your code to InfluxDB",
author="Torsten Rehn",
author_email="torsten@rehn.email",
license="ISC",
url="https://github.com/trehn/timekeeper",
keywords=["profiling", "profile"... | trehn/timekeeper | setup.py | Python | isc | 1,065 |
# -*- coding: utf-8 -*-
from setuptools import setup
setup(
name='asyncwsgi',
version='0.1.0',
author='Zhen Wang',
author_email='mail@zhenwang.info',
py_modules=['asyncwsgi'],
url='https://github.com/nehz/asyncwsgi',
download_url='https://github.com/nehz/asyncwsgi/archive/asyncwsgi-0.1.0.t... | nehz/asyncwsgi | setup.py | Python | mit | 518 |
import inspect
import sys
import types
from .backported import getcallargs, getfullargspec
from .docstring_parsing import Arg, DocStringInfo
from .enabling import all_disabled
from .interface import (CannotDecorateClassmethods, Contract,
ContractException,
ContractNotRes... | GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/contracts/main.py | Python | agpl-3.0 | 25,391 |
"""
tests.remote
~~~~~~~~~~~~~~
Tests Home Assistant remote methods and classes.
Uses port 8122 for master, 8123 for slave
Uses port 8125 as a port that nothing runs on
"""
# pylint: disable=protected-access,too-many-public-methods
import unittest
import homeassistant.core as ha
import homeassistant.bootstrap as boot... | CCOSTAN/home-assistant | tests/test_remote.py | Python | mit | 7,563 |
# This script is to set up various things for our projects. It can be used by:
#
# * developers - setting up their own environment
# * jenkins - setting up the environment and running tests
# * fabric - it will call a copy on the remote server when deploying
#
# The tasks it will do (eventually) include:
#
# * creating... | aptivate/dye | dye/tasklib/tasklib.py | Python | gpl-3.0 | 10,598 |
import io
import os.path
import sys
from configparser import ConfigParser
from jinja2 import Template
if __name__ == "__main__":
if len(sys.argv) != 3:
print("Usage: <program> <deploy_cfg_template_file> <file_with_properties>")
print("Properties from <file_with_properties> will be applied to <depl... | kbaseapps/GenomeFileUtil | scripts/prepare_deploy_cfg.py | Python | mit | 1,402 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=====
Benchmark Multicast UDP Reception
=====
Benchmark the reception of multicast packets
"""
__author__ = "Diarmuid Collins"
__copyright__ = "Copyright 2018"
__version__ = "0.0.1"
__maintainer__ = "Diarmuid Collins"
__email__ = "dcollins@curtisswright.com"... | diarmuidcwc/AcraNetwork | examples/benchmark_mcast_reception.py | Python | gpl-2.0 | 4,476 |
from django import forms
from django.template.loader import render_to_string
from ..utils import dict_merge
class FuelUxWidgetMeta(type(forms.Widget)):
def __init__(cls, name, bases, dic):
super().__init__(name, bases, dic)
default_attrs = {}
required_attrs = set()
for base in re... | jneuendorf/what-should-i-eat | fuelux_widgets/widgets/fuelux_widget.py | Python | mit | 2,195 |
import sys
import unittest
sys.path.insert(0, ".")
from coalib.tests.parsing.StringProcessingTest import StringProcessingTest
from coalib.parsing.StringProcessing import nested_search_in_between
class NestedSearchInBetweenTest(StringProcessingTest):
bs = StringProcessingTest.bs
test_basic_expected_results =... | andreimacavei/coala | coalib/tests/parsing/StringProcessingTests/NestedSearchInBetweenTest.py | Python | agpl-3.0 | 4,159 |
############################################################################
# Monte M. Goode, LBNL
# See LBNLCopyright for copyright notice!
###########################################################################
# main generator engine for new generation generator
# $Id$
import os, sys, warnings
from ZSI impor... | acigna/pywez | zsi/ZSI/generate/wsdl2python.py | Python | mit | 19,978 |
class Solution(object):
def plusOne(self, digits):
"""
:type digits: List[int]
:rtype: List[int]
"""
return [int(i) for i in str(int(''.join(map(str, digits)))+1)]
Solution().plusOne([0]) | xingjian-f/Leetcode-solution | 66. Plus One.py | Python | mit | 232 |
# Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | sankha93/selenium | py/selenium/webdriver/remote/command.py | Python | apache-2.0 | 5,766 |
from Crypto.PublicKey import RSA
from base64 import b64encode
import unittest
import vcsecret
class TestVCSecret(unittest.TestCase):
def setUp(self):
key = RSA.generate(2048)
self.private_key = b64encode(key.exportKey(format='DER'))
self.public_key = b64encode(key.publickey().exportKey(form... | isra17/vcsecret | vcsecret/tests.py | Python | lgpl-3.0 | 1,505 |
#!/usr/bin/env python
import sys
import math
import random
# Normalize the mbb into the range [0, 1] where the original dimensions
# are obtained via command line arguments
# The input should be tab-separated mbbs generated from step_sample
# object_id min_x min_y max_x max_y
# The output follows the same form... | EmoryUniversity/SATO | step_analyze/mbbnorm.py | Python | gpl-2.0 | 1,342 |
import logging
import pytest
import sqlalchemy
from datetime import date, time
from chronophore.models import Entry, User, add_test_users
logging.disable(logging.CRITICAL)
class TestEntry:
def test_foreign_key_constraint(self, db_session):
"""Try to add an entry for a user that
doesn't exist in... | mesbahamin/chronophore | tests/test_model.py | Python | mit | 1,696 |
#!/usr/bin/env python
import argparse
import sys
from CliClass import *
testGameFile="/tmp/testgame"
def newGameCode(code):
es=EnigmaStruct()
obj=ESObject()
ev=ESEvent()
ev.code = code
ev.id = 0
mev=ESMainEvent()
mev.id = 0
mev.eventCount = 1
mev.events = pointer(ev)
obj.mainEventCount = 1
obj.mainEvents ... | galexcode/ShittyIDE | cli.py | Python | mit | 2,634 |
"""
WSGI config for coral project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
from django.core.wsgi import... | zyshjklm/django-coral | wsgi.py | Python | gpl-2.0 | 379 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib.auth.backends import ModelBackend
from django.contrib.auth import get_user_model
from django.conf import settings
User = get_user_model()
class EmailAuthBackend(ModelBackend):
def authenticate(self, username=None, password=Non... | gogobook/Spirit | spirit/user/auth/backends.py | Python | mit | 1,278 |
# ----------------------------------------------------------------------------
# Copyright (c) 2013--, scikit-bio development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# --------------------------------------------... | kdmurray91/scikit-bio | skbio/_base.py | Python | bsd-3-clause | 1,687 |
#!/usr/bin/env python
#
# Copyright 2005,2007,2010 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 you... | jasonabele/gnuradio | gr-audio-alsa/src/qa_alsa.py | Python | gpl-3.0 | 1,289 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.