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 |
|---|---|---|---|---|---|
import unittest
#from fusedwind.plant_flow.asym import AEPMultipleWindRoses
# from gclarsen.fused import FGCLarsen, FWindTurbine, FWindFarm, \
# generate_GenericWindTurbinePowerCurveVT, generate_GenericWindFarmTurbineLayout, \
# rosetta
import fusedwake.WindFarm as wf
import fusedwake.WindTurbine as wt
import ... | rethore/FUSED-Wake | fusedwake/gcl/python/test/test_gclarsen.py | Python | agpl-3.0 | 4,252 |
##############################################################################
#
# Copyright (c) 2004 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SO... | Donkyhotay/MoonPy | zope/testing/testrunner-ex/samplelayers.py | Python | gpl-3.0 | 4,377 |
# -*- coding: utf-8 -*-
#
# Flask-Session documentation build configuration file, created by
# sphinx-quickstart on Fri Apr 25 19:56:40 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.... | mchiocca/flask-session | docs/conf.py | Python | bsd-3-clause | 8,648 |
# coding=utf-8
# Author: Dieter Blomme <dieterblomme@gmail.com>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of SickRage.
#
# SickRage 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, eithe... | pkoutsias/SickRage | sickbeard/notifiers/trakt.py | Python | gpl-3.0 | 8,881 |
# coding=utf-8
# Copyright 2022 The Google Research 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 applicab... | google-research/google-research | rrlfd/residual/train_bc.py | Python | apache-2.0 | 17,630 |
#!/usr/bin/python
import os
import json
from pprint import pprint
from os import environ as env
import glanceclient.exc
from collections import Counter
import novaclient.v1_1.client as nvclient
import glanceclient.v2.client as glclient
import keystoneclient.v2_0.client as ksclient
def get_nova_credentials():
... | kionetworks/openstack-api-scripts | tenant_glance_images.py | Python | apache-2.0 | 1,996 |
# 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/.
import hashlib
import json
import os
import traceback
import urlparse
from abc import ABCMeta, abstractmethod
from ..te... | akumar21NCSU/servo | tests/wpt/harness/wptrunner/executors/base.py | Python | mpl-2.0 | 10,114 |
#######################################################################
# This file is part of Pyblosxom.
#
# Copyright (C) 2010-2011 by the Pyblosxom team. See AUTHORS.
#
# Pyblosxom is distributed under the MIT license. See the file
# LICENSE for distribution details.
###############################################... | maru-sama/pyblosxom | Pyblosxom/tests/test_pathinfo.py | Python | mit | 9,629 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2017, Kairo Araujo <kairo@kairo.eti.br>
# 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':... | andmos/ansible | lib/ansible/modules/packaging/os/installp.py | Python | gpl-3.0 | 9,242 |
'''
Created on June 6, 2018
Filer Guidelines: esma32-60-254_esef_reporting_manual.pdf
@author: Workiva
(c) Copyright 2022 Workiva, All rights reserved.
'''
try:
import regex as re
except ImportError:
import re
from arelle.ModelValue import qname
from arelle.XbrlConst import all, notAll, hypercubeDimension,... | acsone/Arelle | arelle/plugin/validate/ESEF/Const.py | Python | apache-2.0 | 19,152 |
media_file_scrubber.pyimport os
import sys
walk_dir = sys.argv[1]
print('walk_dir = ' + walk_dir)
# If your current working directory may change during script execution, it's recommended to
# immediately convert program arguments to an absolute path. Then the variable root below will
# be an absolute path as well. E... | TheShellLand/pies | v3/Libraries/os/path/walk/Walking recursively through dir.py | Python | mit | 1,161 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""\
linecnt.py -- shows line count in all files (specified by file mask) in the direcory.
It is useful for counting source code lines in a software project.
Usage: linecnt.py <base directory> <file mask>
"""
__author__ = "Andrey Nordin <http://claimid.com/anrienord>"
i... | pascalin/pycoon | test/linecnt.py | Python | gpl-2.0 | 904 |
# Copyright 2011 Citrix System.
# 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 b... | huntxu/neutron | neutron/api/api_common.py | Python | apache-2.0 | 19,029 |
"""Exports and imports mesh data"""
import bpy
import nose.tools
import math
import mathutils
from pyffi.formats.nif import NifFormat
from test import Base
from test import SingleNif
from test.geometry.trishape import gen_geometry
class TestBaseGeometry(SingleNif):
"""Test base geometry, single blender object."... | amorilia/blender_nif_plugin | testframework/test/geometry/trishape/test_geometry.py | Python | bsd-3-clause | 6,720 |
# Configuration file for jupyter-notebook.
#------------------------------------------------------------------------------
# Application(SingletonConfigurable) configuration
#------------------------------------------------------------------------------
## This is an application.
## The date format used by logging f... | hombit/scientific_python | misc/share_jupyter/jupyter/jupyter_notebook_config.py | Python | mit | 23,610 |
"""Parallel workflow execution via Condor DAGMan
"""
import os
import sys
from .base import (GraphPluginBase, logger)
from ...interfaces.base import CommandLine
class CondorDAGManPlugin(GraphPluginBase):
"""Execute using Condor DAGMan
The plugin_args input to run can be used to control the DAGMan executio... | christianbrodbeck/nipype | nipype/pipeline/plugins/dagman.py | Python | bsd-3-clause | 4,865 |
"""Conditional module is the xmodule, which you can use for disabling
some xmodules by conditions.
"""
import json
import logging
from lazy import lazy
from lxml import etree
from pkg_resources import resource_string
from xblock.fields import ReferenceList, Scope, String
from xblock.fragment import Fragment
from xmo... | pepeportela/edx-platform | common/lib/xmodule/xmodule/conditional_module.py | Python | agpl-3.0 | 14,768 |
import abc
from default_metrics import DefaultMetrics
class DefaultEnvironment(object):
"""
Abstract class for environments. All environments must implement these
methods to be able to work with SBB.
"""
__metaclass__ = abc.ABCMeta
def __init__(self):
self.metrics_ = Defau... | jpbonson/SBBReinforcementLearner | SBB/environments/default_environment.py | Python | bsd-2-clause | 2,122 |
"""Miscellaneous utility functions and classes specific to ansible cli tools."""
from __future__ import absolute_import, print_function
import os
from lib.util import common_environment
def ansible_environment(args):
"""
:type args: CommonConfig
:rtype: dict[str, str]
"""
env = common_environme... | camradal/ansible | test/runner/lib/ansible_util.py | Python | gpl-3.0 | 856 |
#!/usr/bin/env python3
import tvcheck.pyfs
pyfs.main()
| 35359595/pyfs | tvcheck/__init__.py | Python | apache-2.0 | 55 |
# pylint: disable=g-bad-file-header
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENS... | nburn42/tensorflow | tensorflow/python/tools/optimize_for_inference_test.py | Python | apache-2.0 | 13,432 |
from django.contrib import admin
from models import *
class LayerAdmin(admin.ModelAdmin):
list_display = ('name', 'layerName', 'provider', 'public', 'minzoom', 'maxzoom')
list_filter = ('public', 'provider')
list_editable = ('public',)
admin.site.register(Layer, LayerAdmin)
| trailbehind/EasyTileServer | webApp/layers/admin.py | Python | bsd-3-clause | 289 |
# -*- coding: utf-8 -*-
from fabric.api import *
@task
def bootstrap(puppetmaster=''):
"""Bootstrap an Ubuntu 14.04 host on Upcloud"""
from . import util, puppet
util.install_sudo()
fqdn = run('hostname -f')
hostname = run('hostname -s')
ipaddress = run("/sbin/ifconfig eth0 | grep 'inet ' | ... | mattock/fabric | upcloud.py | Python | bsd-2-clause | 676 |
import logging
logger = logging.getLogger(__name__)
from redbean.logs import setup_logging
from pathlib import Path
setup_logging(config=Path(__file__).parent / 'conf/logging.yaml')
import aiohttp
import redbean
rest = redbean.Routes()
def create_app():
app = aiohttp.web.Application()
app['secure_key']... | lcgong/alchemy | busiserv/app.py | Python | gpl-3.0 | 535 |
from JumpScale import j
class ActorsInfo():
def getActorMethodCall(self, appname, actor, method):
"""
used for during error show links to methods in browser
"""
url = "/rest/%s/%s/%s?" % (appname, actor, method)
auth = j.core.portal.active.ws.routes["%s_%s_%s" % (appname, ... | Jumpscale/jumpscale6_core | lib/JumpScale/portal/portalloaders/ActorsInfo.py | Python | bsd-2-clause | 4,625 |
from django.conf import settings
from django.contrib.messages.storage import default_storage
from django.utils.deprecation import MiddlewareMixin
class MessageMiddleware(MiddlewareMixin):
"""
Middleware that handles temporary messages.
"""
def process_request(self, request):
request._messages... | KrzysztofStachanczyk/Sensors-WWW-website | www/env/lib/python2.7/site-packages/django/contrib/messages/middleware.py | Python | gpl-3.0 | 1,019 |
import logging
import emission.core.wrapper.wrapperbase as ecwb
class Location(ecwb.WrapperBase):
props = {"latitude": ecwb.WrapperBase.Access.RO, # latitude of the point
"longitude": ecwb.WrapperBase.Access.RO, # longitude of the point
"loc": ecwb.WrapperBase.Access.RO, # location... | joshzarrabi/e-mission-server | emission/core/wrapper/location.py | Python | bsd-3-clause | 1,527 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | openstack/reno | reno/lister.py | Python | apache-2.0 | 1,130 |
# -*- encoding: utf-8 -*-
import abc
from abjad.tools.datastructuretools.TreeContainer import TreeContainer
class ReSTDirective(TreeContainer):
r'''A ReST directive.
'''
### INITIALIZER ###
def __init__(
self,
argument=None,
children=None,
directive=None,
name... | andrewyoung1991/abjad | abjad/tools/documentationtools/ReSTDirective.py | Python | gpl-3.0 | 3,357 |
import platform
import socket
import sys
import os
from mule_local.JobGeneration import *
from mule.JobPlatformResources import *
from . import JobPlatformAutodetect
# Underscore defines symbols to be private
_job_id = None
def get_platform_autodetect():
"""
Returns
-------
bool
True if curren... | schreiberx/sweet | mule/platforms/50_linuxcluster_intel/JobPlatform.py | Python | mit | 6,146 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2009—2010 Andrey Mikhailenko and contributors
#
# This file is part of Dark.
#
# Dark is free software under terms of the GNU Lesser
# General Public License version 3 (LGPLv3) as published by the Free
# Software Foundation. See the file README for copying conditions.
#
#... | neithere/dark | dark/aggregates.py | Python | lgpl-3.0 | 6,645 |
#!/usr/bin/env python
import os
import pkg_resources
import platform
import sys
from optparse import OptionParser
from random import choice
class SiteOptions(object):
copy_media = platform.system() == "Windows"
def create_settings():
if not os.path.exists("settings_local.py"):
print "Creating a set... | chazy/reviewboard | contrib/internal/prepare-dev.py | Python | mit | 4,605 |
#!/usr/bin/env python
#
# Copyright (c) 2012, Centre National de la Recherche Scientifique (CNRS)
#
# 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-... | StratusLab/client | api/code/src/main/python/stratuslab/tm/TMContext.py | Python | apache-2.0 | 6,394 |
import logging
import os
import errno
def create_file(filename):
if not os.path.exists(os.path.dirname(filename)):
try:
os.makedirs(os.path.dirname(filename))
open(filename, 'a').close()
except OSError as exc: # Guard against race condition
if exc.errno != errn... | AntoinePrv/hyperNN | problem/logger.py | Python | mit | 828 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (C) 2012 Yahoo! 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.or... | toby82/anvil | anvil/actions/remove.py | Python | apache-2.0 | 2,601 |
# Copyright 2014 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 requ... | mangalaman93/nova-docker | novadocker/virt/docker/network.py | Python | apache-2.0 | 2,161 |
import socket
import struct
import optparse
def prepare_sock(port):
udp_sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
udp_sock.bind(('0.0.0.0', 0))
udp_sock.connect(('0.0.0.0', port))
return udp_sock
if __name__ == '__main__':
parser = optparse.OptionParser()
parser.add_option('-p', '--port', dest='po... | eklitzke/event-clock | client.py | Python | isc | 594 |
#
# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Apache-2.0
#
from typing import Any, Dict, List, Optional, Set, Tuple, Union
from pyparsing import (Combine, Forward, Group, IndentedBlock, Keyword, LineEnd, Literal, OneOrMore, Opt,
ParseFatalE... | espressif/esp-idf | tools/ldgen/ldgen/fragments.py | Python | apache-2.0 | 14,903 |
import math
import random
import numpy as np
from ..commons.utils import *
from ...tools import dropout, add_bias
["check_network_structure", "verify_dataset_shape_and_modify", "print_training_status", "print_training_results"]
def backpropagation_foundation(network, trainingset, testset, cost_function, calculate_... | DailyActie/Surrogate-Model | 01-codes/python-neural-network-master/nimblenet/learning_algorithms/backpropagation/base.py | Python | mit | 4,246 |
#!/usr/bin/python
#coding=utf-8
#FileName: sms_alarm.py V1.0
'''
2012-07-31 修改content 编码格式由原来的UTF-8修改为gb2312以使发送邮件内容支持中文
'''
import smtplib
import sys
import email
from email.mime.text import MIMEText
#========================================
#需要配置
send_mail_host="smtp.126.com" # 发送的smtp
send_mail_user="usernam... | honglei619/AutoPost | sms_alarm.py | Python | gpl-2.0 | 1,530 |
import json
class TagsEndpointsMixin(object):
"""For endpoints in ``/tags/``."""
def tag_info(self, tag):
"""
Get tag info
:param tag:
:return:
"""
endpoint = 'tags/{tag!s}/info/'.format(**{'tag': tag})
res = self._call_api(endpoint)
return res... | hideki-saito/Data-Service-for-Instagram | instagram_private_api/endpoints/tags.py | Python | mit | 1,157 |
## @file current/tests.py
# @brief current server status unit testing
import datetime
import django.test
import models
import views
class CurrentModelTestCase(django.test.TestCase):
"""test module model"""
pass
class CurrentViewTestCase(django.test.TestCase):
"""test module interface"""
... | mingless/bayesian_webclass | bioweb/web/current/tests.py | Python | mit | 677 |
from django.test import TestCase
from django.conf import settings
from django.contrib.sites.models import Site
from django.db.models.query import QuerySet
from preferences import preferences
from music.models import TrackContributor, Credit, Track, Album, CreditOption
from music.utils import wikipedia, lastfm
class... | praekelt/jmbo-music | music/tests/__init__.py | Python | bsd-3-clause | 3,379 |
#!/usr/bin/env python
"""Test APIFlask class for input parameters causing TypeErrors.
"""
import apikit
import pytest
def test_lsstflask_type_errors():
"""Test APIFlask for input parameters causing TypeErrors.
"""
# No arguments at all.
# Obviously the linter is correct here...
with pytest.raises(... | lsst-sqre/sqre-apikit | tests/test_lsstflask_type_errors.py | Python | mit | 1,993 |
# 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 may ... | Azure/azure-sdk-for-python | sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_keys_operations.py | Python | mit | 13,131 |
"""ColorMod tool."""
import sublime
import sublime_plugin
from .lib.coloraide import Color
import mdpopups
from .lib import colorbox
from . import ch_util as util
from . import ch_tools as tools
from .ch_mixin import _ColorMixin
import copy
DEF_COLORMOD = """---
markdown_extensions:
- markdown.extensions.attr_list
- ... | facelessuser/ColorHelper | ch_tool_colormod.py | Python | mit | 6,471 |
"""Gaussian processes regression."""
# Authors: Jan Hendrik Metzen <jhm@informatik.uni-bremen.de>
# Modified by: Pete Green <p.l.green@liverpool.ac.uk>
# License: BSD 3 clause
import warnings
from operator import itemgetter
import numpy as np
from scipy.linalg import cholesky, cho_solve
import scipy.optimize
from .... | kevin-intel/scikit-learn | sklearn/gaussian_process/_gpr.py | Python | bsd-3-clause | 22,428 |
import numpy as np
import logging
from sklearn.metrics import roc_auc_score
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
log = logging.getLogger(__name__)
heaviside = lambda x: 1 if x >= 0 else 0
MIN_VAL = np.iinfo(np.int32).min
class AMDC:
"""
Imple... | arongdari/almc | almc/amdc/amdc.py | Python | gpl-2.0 | 15,652 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
from .... import units as u
from ...builtin_frames import ICRS, FK5
from ....time import Time
from ....table import Table
from ...angle_utilities import angular_separation
from ....utils.data import get_pkg_data_contents
# the number... | funbaker/astropy | astropy/coordinates/tests/accuracy/test_icrs_fk5.py | Python | bsd-3-clause | 1,844 |
#!/usr/bin/python
import os
import SimpleHTTPServer
import SocketServer
import socket
PORT = 8000
DOC_DIR = "docs/html/"
Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
os.chdir(DOC_DIR)
while 1 :
try :
httpd = SocketServer.TCPServer(("", PORT), Handler)
break
except socket.error :
... | chanke/hpss-utils | hpss-http_proxy/src/doxygen/serve_http_docs.py | Python | bsd-3-clause | 386 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('events', '0044_auto_20160306_1546'),
]
operations = [
migrations.AddField(
model_name='event',
name=... | I-sektionen/i-portalen | wsgi/iportalen_django/events/migrations/0045_event_cancel.py | Python | mit | 526 |
"""
The Request class is used as a wrapper around the standard request object.
The wrapped request then offers a richer API, in particular :
- content automatically parsed according to `Content-Type` header,
and available as `request.DATA`
- full support of PUT method, including support for file uploads... | GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/rest_framework/request.py | Python | agpl-3.0 | 14,123 |
import unittest, mock, os, sys, re
from mock import *
from mock import ANY
from tests.fakes import *
import xml.etree.ElementTree as ET
from resources.utils import *
from resources.net_IO import *
from resources.scrap import *
from resources.objects import *
from resources.constants import *
def read_file(pa... | chrisism/plugin.program.advanced.emulator.launcher | tests/mobygames_scraper_test.py | Python | gpl-2.0 | 4,354 |
from django.utils import translation
from nose.tools import eq_
from olympia import amo
from olympia.amo.tests import TestCase, ESTestCase
from olympia.addons.models import Addon
from olympia.reviews import tasks
from olympia.reviews.models import (
check_spam, GroupedRating, Review, ReviewFlag, Spam)
from olympi... | jpetto/olympia | src/olympia/reviews/tests/test_models.py | Python | bsd-3-clause | 4,623 |
"""passlib.apache - apache password support"""
# XXX: relocate this to passlib.ext.apache?
#=============================================================================
# imports
#=============================================================================
from __future__ import with_statement
# core
from hashlib imp... | cgstudiomap/cgstudiomap | main/eggs/passlib-1.6.5-py2.7.egg/passlib/apache.py | Python | agpl-3.0 | 39,957 |
from os.path import dirname
"""
Process MPDatClient responses
"""
def get_files_and_dirs_from_db(items):
"""
Returns (files, directories) from a source with files and directories mixed.
"""
files = []
dirs = []
for item in items:
if "directory" in item:
dirs.append(item["... | laurentb/mpdat | mpdat/process.py | Python | mit | 735 |
# -*- coding: utf-8 -*-
"""
Appends the codecov token to the 'codecov.yml' file at the root of the repository.
This is done by CI during PRs and builds on the pytest-dev repository so we can upload coverage, at least
until codecov grows some native integration like it has with Travis and AppVeyor.
See discussion in htt... | cloudera/hue | desktop/core/ext-py/pytest-4.6.11/scripts/append_codecov_token.py | Python | apache-2.0 | 1,053 |
# Ethan Busbee
# BARQ: Busbee's Assorted Reusable Queues
from heapq import heappop, heappush
class PriorityQueue(object):
queue = []
size = 0
def __init__(self):
self.queue = []
self.size = 0
def __del__(self):
self.queue = []
self.size = 0
# temporarily only supporting one item of data... | Marfle-Bark/myHUMPS | sim/BARQ.py | Python | mit | 1,078 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'DjangoPhonebook.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^admin/', include(admin.site.urls)),
url(r'^', include('phonebook.urls'... | JulienDrecq/django-phonebook | phonebook/tests/urls.py | Python | bsd-3-clause | 343 |
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
#
# 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... | tashaband/RYU295 | pbr-0.5.19-py2.7.egg/pbr/d2to1/tests/__init__.py | Python | apache-2.0 | 3,455 |
from __future__ import absolute_import, unicode_literals
from unittest import TestCase
from ..utils import FieldsParameterParseError, parse_boolean, parse_fields_parameter
class TestParseFieldsParameter(TestCase):
# GOOD STUFF
def test_valid_single_field(self):
parsed = parse_fields_parameter('test... | chrxr/wagtail | wagtail/api/v2/tests/tests.py | Python | bsd-3-clause | 9,127 |
# coding: utf-8
import cgi
from datetime import datetime, date
from io import StringIO
from importlib import import_module
from unittest.mock import patch
from django.conf import settings
from django.contrib.sessions.serializers import JSONSerializer
from django.test import TestCase
from django.core.urlresolvers impor... | wking/swc-amy | workshops/test/test_util.py | Python | mit | 19,660 |
""":mod:`padak` --- Padak EDSL template engine
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
An EDSL template engline written in Python.
:copyright: (c) 2012 by Hyunjun Kim.
:license: MIT, see LICENSE for more details.
"""
| yoloseem/padak | padak/__init__.py | Python | mit | 239 |
import unittest
from enum import Enum
from test.asserting.config_source import ConfigSourceAssertion, get_fixture_path
from vint.linting.config.config_global_source import ConfigGlobalSource
class TestConfigGlobalSource(ConfigSourceAssertion, unittest.TestCase):
def test_get_config_dict(self):
env = {
... | RianFuro/vint | test/unit/vint/linting/config/test_config_global_source.py | Python | mit | 1,841 |
#! /usr/bin/env python -u
# coding=utf-8
__author__ = 'xl'
| Wilbeibi/cloudapp-mp2 | internal_use/__init__.py | Python | apache-2.0 | 60 |
import datetime
from django.db import models
from django.utils import timezone
class Question(models.Model):
question_text = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
def __unicode__(self): # __unicode__ on Python 2
return self.question_text
... | JCraft40/finalproject | polls/models.py | Python | gpl-2.0 | 899 |
"""Support for collecting data from the ARWN project."""
import json
import logging
from homeassistant.components import mqtt
from homeassistant.const import TEMP_CELSIUS, TEMP_FAHRENHEIT
from homeassistant.core import callback
from homeassistant.helpers.entity import Entity
from homeassistant.util import slugify
_LO... | leppa/home-assistant | homeassistant/components/arwn/sensor.py | Python | apache-2.0 | 4,648 |
#!/usr/bin/python
from k5test import *
conf = {'realms': {'$realm': {'max_life': '20h', 'max_renewable_life': '20h'}}}
realm = K5Realm(create_host=False, get_creds=False, kdc_conf=conf)
def test(testname, life, rlife, expect_renewable, env=None):
global realm
flags = ['-l', life]
if rlife is not None:
... | drankye/kerb-token | krb5/src/tests/t_renew.py | Python | apache-2.0 | 3,101 |
"""Update models to avoid uniqueness errors
Revision ID: 4148c3cb14ad
Revises: 21e927fdf78c
Create Date: 2015-04-24 23:27:26.628208
"""
# revision identifiers, used by Alembic.
revision = '4148c3cb14ad'
down_revision = '21e927fdf78c'
import hashlib
from alembic import op
import sqlalchemy as sa
import sqlalchemy.sq... | go-lab/appcomposer | alembic/versions/4148c3cb14ad_update_models_to_avoid_uniqueness_errors.py | Python | bsd-2-clause | 1,977 |
"""Wrapper around gdax-python.
Gdax-python is the unofficial python library for GDAX.
https://github.com/danpaquin/gdax-python
https://pypi.python.org/pypi/gdax
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# OrderedDict retains its key order, so... | sonph/gdaxcli | gdaxcli/gdax_utils.py | Python | mit | 15,218 |
"""
This tutorial introduces logistic regression using Theano and stochastic
gradient descent.
Logistic regression is a probabilistic, linear classifier. It is parametrized
by a weight matrix :math:`W` and a bias vector :math:`b`. Classification is
done by projecting data points onto a set of hyperplanes, the distance... | mattdelhey/kaggle-galaxy | Old/CNN/logisticSGD.py | Python | mit | 15,297 |
#***************************************************************************
#* *
#* Copyright (c) 2014 Daniel Falck <ddfalck@gmail.com> *
#* *
#* This ... | cypsun/FreeCAD | src/Mod/Path/PathScripts/Macros/create_tool.py | Python | lgpl-2.1 | 2,174 |
# -*- encoding: utf-8 -*-
################################################################################
# #
# Copyright (C) 2013-Today Carlos Eduardo Vercelino - CLVsol #
# ... | CLVsol/odoo_solutions | vfmng/clv_annotation.py | Python | agpl-3.0 | 1,575 |
# Copyright 2008-2015 Nokia Solutions and Networks
#
# 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 appl... | fingeronthebutton/RIDE | src/robotide/application/releasenotes.py | Python | apache-2.0 | 5,022 |
#!/usr/bin/env python3
groups = []
with open('input.txt', 'r') as f:
groups = f.read().split('\n\n')
def get_group_answers(groups):
group_yes = []
for group_val in groups:
group_yes.append(len(list(set(''.join(group_val.split('\n'))))))
return group_yes
# this is waaaay ugly, but it works
def get_consis... | jekhokie/scriptbox | python--advent-of-code/2020/6/solve.py | Python | mit | 1,211 |
#Copyright 2018 Tim Wentlau.
#Distributed under the MIT License. See LICENSE in root of project.
import os
import sys
from .default_config import get_default_config
class Application(object):
def __init__(self, user_config = None):
print("Starting kervi (u)application")
#import inspect
i... | kervi/kervi | ukervi/ukervi/application/__init__.py | Python | mit | 1,697 |
# -*- coding: utf-8 -*-
from content_plugin import ContentPlugin
from plugin_ckeditor import CKEditor
from gluon.tools import PluginManager
class ContentVideo(ContentPlugin):
def get_item_url(self, item):
return URL('plugin_video', 'index.html', args=[item.unique_id])
def create_content(self, item):... | ybenitezf/nstock | models/plugin_video.py | Python | mit | 5,245 |
from cebulany.models import Member
class MemberQuery:
@classmethod
def get_list_query(cls, name=None, limit=None, order="name"):
query = Member.query
if order == "name":
query = query.order_by(Member.name)
elif order == "table":
query = query.order_by(Member.is... | hackerspace-silesia/cebulany-manager | cebulany/queries/member.py | Python | mit | 916 |
import subprocess
import os
import signal
import ctypes
class ProcessManager(object):
def __init__(self):
self._process = None
self._stdout = None
self._stderr = None
def start_process(self, *args):
self._process = subprocess.Popen(args, stderr=subprocess.PIPE,
... | userzimmermann/robotframework-python3 | atest/robot/running/ProcessManager.py | Python | apache-2.0 | 2,776 |
''' script to move users from old cognitive atlas mysql to postgres db with
schema based on a custom django users model'''
import os
import pymysql
import psycopg2
# postgres schema
# id | integer
# password | character varying(128)
# last_login | timestamp with time zone
# is_superuser | bool... | rwblair/cogat | scripts/user_import.py | Python | mit | 3,717 |
# coding: utf8
"""
cairocffi.surface
~~~~~~~~~~~~~~~~~
Bindings for the various types of surface objects.
:copyright: Copyright 2013 by Simon Sapin
:license: BSD, see LICENSE for details.
"""
import io
import sys
import ctypes
import weakref
from . import ffi, cairo, _check_status, constants
fr... | aESeguridad/GERE | venv/lib/python2.7/site-packages/cairocffi/surfaces.py | Python | gpl-3.0 | 49,514 |
#!/usr/bin/env python3
from modules import *
import configparser
import json
import re
#####################################################
## Database Connect
#####################################################
'''
Connects to the database using the connection string
'''
def database_connect():
# Read the c... | wx-Yao/Didactic-DBMS | Database_Application_Development/database.py | Python | mit | 8,548 |
from fastapi.testclient import TestClient
from docs_src.metadata.tutorial001 import app
client = TestClient(app)
openapi_schema = {
"openapi": "3.0.2",
"info": {
"title": "ChimichangApp",
"description": "\nChimichangApp API helps you do awesome stuff. 🚀\n\n## Items\n\nYou can **read items**.... | tiangolo/fastapi | tests/test_tutorial/test_metadata/test_tutorial001.py | Python | mit | 1,611 |
from django.db import models
from lino.api import dd
from lino.utils import join_elems
from etgen.html import E
from lino.mixins.polymorphic import Polymorphic
class Place(dd.Model):
name = models.CharField(max_length=200)
def __str__(self):
return self.name
class Member(Polymorphic):
name = ... | lino-framework/book | lino_book/projects/lets2/lets/models.py | Python | bsd-2-clause | 1,995 |
import sys
if sys.version_info[0] < 3:
print("This game is written in python 3.\nRun 'python3 "+sys.argv[0]+"' or './"+sys.argv[0]+"'")
sys.exit(-1)
if __package__ == "asciifarm.client":
from . import main
else:
import os.path
sys.path.append(os.path.join(os.path.dirname(__file__), "..", ".."))
... | jmdejong/Asciifarm | asciifarm/client/__main__.py | Python | gpl-3.0 | 371 |
# Copyright (c) Siemens AG, 2013
#
# This file is part of MANTIS. MANTIS is free software: you can
# redistribute it and/or modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation; either version 2
# of the License, or(at your option) any later version.
#
# This progr... | siemens/django-dingos | dingos/core/extractors.py | Python | gpl-2.0 | 981 |
from django.conf.urls import url
from . import views
urlpatterns = (
url(r'^$', views.group_selection, name='group-landing'),
url(r'^(?P<group_slug>[\w-]+)/$',
views.group_dashboard, name='group-detail'),
url(r'^(?P<group_slug>[\w-]+)/(?P<tenant_slug>[\w-]+)/$',
views.tenant_dashboard, na... | theirc/rapidsms-multitenancy | multitenancy/urls.py | Python | bsd-3-clause | 343 |
"""Unit tests for the route authentication plugin."""
import logging
import unittest
from datetime import datetime, timezone
from unittest.mock import Mock
import bottle
from shared.routes.plugins import InjectionPlugin
from external.routes.plugins.auth_plugin import AuthPlugin, EDIT_REPORT_PERMISSION
class AuthP... | ICTU/quality-time | components/server/tests/external/routes/plugins/test_route_auth_plugin.py | Python | apache-2.0 | 4,927 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
"""
from datetime import datetime
import numpy as np
from numpy import ma
from pyWOA.woa import WOA
def test_import():
# A shortcut
from pyWOA import WOA
db = WOA()
def test_available_vars():
db = WOA()
for v in ['TEMP', 'PSAL']:
... | castelao/pyWOA | tests/test_WOA_from_nc.py | Python | bsd-3-clause | 3,882 |
# -*- coding: utf-8 -*-
# Copyright: 2009-2011 Gentoo Foundation
# Author(s): Petteri Räty (betelgeuse@gentoo.org)
# License: GPL2
__all__ = ['database']
import errno
import portage
from portage.cache import fs_template
from portage.versions import catsplit
from portage import cpv_getkey
from portage import os
from ... | nullishzero/Portage | pym/portage/cache/ebuild_xattr.py | Python | gpl-2.0 | 4,204 |
#!/usr/bin/env python
text = open("time.txt", "r").read()
import re
def toMs(string):
# e.g. "0m0.031s"
matches = re.search("(\d+)m(\d+)\.(\d+)s", string )
min = int(matches.group(1))
sec = int(matches.group(2))
ms = int(matches.group(3))
return (min*60 + sec)*1000 + ms
real = toMs( re.se... | ilyaigpetrov/report-graph-traversal-c-vs-java | Code/retime.py | Python | mit | 529 |
#!/usr/bin/env python
# Jonas Schnelli, 2013
# make sure the BadCoind-Qt.app contains the right plist (including the right version)
# fix made because of serval bugs in Qt mac deployment (https://bugreports.qt-project.org/browse/QTBUG-21267)
from string import Template
from datetime import date
BadCoindir = "./";
in... | BadCoinBoss/BadCoin | share/qt/clean_mac_info_plist.py | Python | mit | 895 |
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | noironetworks/neutron | neutron/db/standard_attr.py | Python | apache-2.0 | 9,979 |
'''
Created on Apr 21, 2014
@author: Borja
'''
import os.path
import xlrd
from data import __data__
class XslReader(object):
def __init__(self):
if not os.path.exists(__data__.path()):
os.makedirs(__data__.path())
self._data_path = __data__.path()
... | landportal/landbook-importers | FAOAgriculturalCensues_Importer/es/weso/fao/ExcelManagement/excel_reader.py | Python | mit | 1,436 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['RelativeDifference'] , ['MovingAverage'] , ['Seasonal_DayOfMonth'] , ['AR'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_RelativeDifference/model_control_one_enabled_RelativeDifference_MovingAverage_Seasonal_DayOfMonth_AR.py | Python | bsd-3-clause | 174 |
# coding=utf-8
# Copyright 2022 The Google Research 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 applicab... | google-research/google-research | schema_guided_dst/baseline/pred_utils.py | Python | apache-2.0 | 6,649 |
#!/usr/bin/env python
##########################################################
# The setup.py for the Sage Notebook
##########################################################
import os
from setuptools import setup
def lremove(string, prefix):
while string.startswith(prefix):
string = string[len(prefix... | migeruhito/sagenb | setup.py | Python | gpl-3.0 | 2,069 |
def say_hello():
print 'Hello'
if __name__ == '__main__':
say_hello()
| MagicForest/Python | src/training/Core2/Chapter14ExecutionEnvironment/hello.py | Python | apache-2.0 | 88 |
# -*- coding: UTF-8 -*-
# TcosMonitor version __VERSION__
#
# Copyright (c) 2006-2011 Mario Izquierdo <mariodebian@gmail.com>
#
# This package 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 ... | mariodebian/tcosmonitor | tcosmonitor/TcosListView.py | Python | gpl-2.0 | 11,195 |
"""advanced.py
Illustrate usage of Query combined with the FromCache option,
including front-end loading, cache invalidation, namespace techniques
and collection caching.
"""
import environment
from model import Person, Address, cache_address_bits
from meta import Session, FromCache, RelationCache
from sqlalchemy.o... | obeattie/sqlalchemy | examples/beaker_caching/advanced.py | Python | mit | 3,027 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.