text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
# 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 the Li... | rdo-management/tuskar | tuskar/tests/templates/test_namespace.py | Python | apache-2.0 | 1,765 | 0 |
from unittest import TestCase
from mock import Mock
from cloudshell.cp.openstack.domain.services.nova.nova_instance_service import NovaInstanceService
import cloudshell.cp.openstack.domain.services.nova.nova_instance_service as test_nova_instance_service
from cloudshell.cp.openstack.common.driver_helper import Cloudsh... | QualiSystems/OpenStack-Shell | package/tests/test_cp/test_openstack/test_domain/test_services/test_nova/test_nova_instance_service.py | Python | isc | 27,295 | 0.005166 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015-2018: Alignak team, see AUTHORS.txt file for contributors
#
# This file is part of Alignak.
#
# Alignak is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free So... | Alignak-monitoring/alignak | tests/test_macros_resolver.py | Python | agpl-3.0 | 51,044 | 0.005924 |
# Version 4.0
import csv
import sys
count = 10
offset = 0
if len(sys.argv) >= 3:
count = int(sys.argv[1])
offset = int(sys.argv[2]) - 1
start = offset*count
start = 1 if start==0 else start
end = start + count
r = csv.reader(sys.stdin)
rows = []
i = 0
for l in r:
rows.append(l[:1] + l[start:end])
... | nachiketmistry/splunk-app-pstack | bin/paginatefields.py | Python | mit | 391 | 0.015345 |
# Copyright 2009 Shikhar Bhushan
# Copyright 2014 Leonidas Poulopoulos
#
# 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... | OpenClovis/ncclient | ncclient/transport/session.py | Python | apache-2.0 | 9,854 | 0.003146 |
from .__about__ import __version__
from .portworx import PortworxCheck
__all__ = ['__version__', 'PortworxCheck']
| DataDog/integrations-extras | portworx/datadog_checks/portworx/__init__.py | Python | bsd-3-clause | 115 | 0 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import os
from zeeko._build_helpers import get_utils_extension_args, get_zmq_extension_args, _generate_cython_extensions, pxd, get_package_data
from astropy_helpers import setup_helpers
utilities = [pxd("..utils.rc"),
pxd("..utils.msg"),
... | alexrudy/Zeeko | zeeko/handlers/setup_package.py | Python | bsd-3-clause | 1,501 | 0.016656 |
#!/usr/bin/env python
# Encoding: utf-8
# -----------------------------------------------------------------------------
# Project : Broken Promises
# -----------------------------------------------------------------------------
# Author : Edouard Richard <edou4rd@gmail.com>
# ----------... | jplusplus/broken-promises | Scripts/collect_articles.py | Python | gpl-3.0 | 3,847 | 0.011178 |
#/usr/bin/env python
# -#- coding: utf-8 -#-
#
# contract/core/api.py - functions which simplify contract package feature access
#
# This file is part of OndALear collection of open source components
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be hel... | ajaniv/softwarebook | cpython/contract/core/api.py | Python | gpl-2.0 | 1,699 | 0.006474 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from utils.init_weights import init_weights, normalized_columns_initializer
from core.mo... | lukashermann/pytorch-rl | core/models/a3c_mlp_con.py | Python | mit | 4,501 | 0.005776 |
n = int(input())
s = input()
letterlist = ['x', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F']
letter = {}
for l in letterlist:
letter[l] = 0
for i in range(n):
if s[i:i+1] in letterlist:
letter[s[i:i+1]] += 1
if letter['x'] > 0 and letter['0'] > 0:
letter['0'] -=... | dluschan/olymp | lomonosov/num16.py | Python | mit | 550 | 0.005455 |
from django.apps import AppConfig
class TorrentsConfig(AppConfig):
name = 'torrents'
| ReanGD/web-home-manage | backend/torrents/apps.py | Python | apache-2.0 | 91 | 0 |
import sys
import json
def make_column_to_candidate_dict(header_row):
my_dict = {}
for colIndex, candidate in enumerate(header_row):
my_dict[colIndex] = candidate.strip()
return my_dict
def return_candidates_in_order(row, col_to_candidate_dict):
ballot = []
for i in range(0,len(row)):
... | pivot-libre/tideman | tests/parse_ballot.py | Python | apache-2.0 | 2,798 | 0.006076 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Static()
result.template = "object/static/structure/tatooine/shared_pillar_pristine_small_style_01.iff"
result.at... | anhstudios/swganh | data/scripts/templates/object/static/structure/tatooine/shared_pillar_pristine_small_style_01.py | Python | mit | 469 | 0.046908 |
#!/usr/bin/eny python
#coding:utf-8
from gi.repository import Gtk
class ButtonWindow(Gtk.Window):
def __init__(self):
Gtk.Window.__init__(self, title='Button Demo')
self.set_border_width(10)
hbox = Gtk.Box(spacing=6)
self.add(hbox)
button = Gtk.Button('Click Me')
... | qytz/qytz-notes | source/tech/PyGObject-Tutorial/examples/button_example.py | Python | mit | 1,105 | 0.00362 |
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
##
## Copyright (C) 2012 Async Open Source <http://www.async.com.br>
## All rights reserved
##
## 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 Foundati... | andrebellafronte/stoq | stoqlib/gui/test/test_stocktransferwizard.py | Python | gpl-2.0 | 2,810 | 0.004982 |
""" Fixer for imports of itertools.(imap|ifilter|izip|ifilterfalse) """
# Local imports
from lib2to3 import fixer_base
from lib2to3.fixer_util import BlankLine, syms, token
class FixItertoolsImports(fixer_base.BaseFix):
PATTERN = """
import_from< 'from' 'itertools' 'import' imports=any >
... | 2ndy/RaspIM | usr/lib/python2.6/lib2to3/fixes/fix_itertools_imports.py | Python | gpl-2.0 | 1,840 | 0.000543 |
'''
Created on Jun 29, 2016
@author: Thomas Adriaan Hellinger
'''
import pytest
from roodestem.voting_systems.voting_system import Result
class TestResult:
def test_null_result_not_tolerated(self):
with pytest.raises(TypeError):
Result()
def test_passed_multiple_winners(self):
... | brotherjack/RoodeStem | tests/test_voting_systems.py | Python | mit | 709 | 0.008463 |
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework.status import HTTP_204_NO_CONTENT
from users.serializers import UserSerializer
from rest_framework.permissions import AllowAny
from django.contrib.auth import login, logout
from rest_framework.authentication import... | KDD-OpenSource/fexum | users/views.py | Python | mit | 1,286 | 0.001555 |
"""
The consumer's code.
It takes HTML from the queue and outputs the URIs found in it.
"""
import asyncio
import json
import logging
from typing import List
from urllib.parse import urljoin
import aioredis
from bs4 import BeautifulSoup
from . import app_cli, redis_queue
_log = logging.getLogger('url_extractor')
... | butla/experiments | aiohttp_redis_producer_consumer/txodds_code_test/url_extractor.py | Python | mit | 2,896 | 0.003108 |
from math import log
def sort(a_list, base):
"""Sort the input list with the specified base, using Radix sort.
This implementation assumes that the input list does not contain negative
numbers. This algorithm is inspired from the Wikipedia implmentation of
Radix sort.
"""
passes = int(log(ma... | isubuz/zahlen | algorithms/sorting/radix_sort.py | Python | mit | 805 | 0 |
#!/usr/bin/env python
"""
Framework to start a simulated vehicle and connect it to MAVProxy.
Peter Barker, April 2016
based on sim_vehicle.sh by Andrew Tridgell, October 2011
"""
from __future__ import print_function
import atexit
import getpass
import optparse
import os
import os.path
import re
import signal
import... | bnsgeyer/Copter3_4 | Tools/autotest/sim_vehicle.py | Python | gpl-3.0 | 32,299 | 0.002848 |
import urllib2
from lxml import etree
####################################################################
# API
####################################################################
class Scrape_Quora:
regexpNS = "http://exslt.org/regular-expressions"
@staticmethod
def get_name(user_name):
url =... | hansika/pyquora | scrape_quora/pyquora.py | Python | apache-2.0 | 3,445 | 0.004354 |
from .group_analysis import create_fsl_flame_wf, \
get_operation
__all__ = ['create_fsl_flame_wf', \
'get_operation']
| FCP-INDI/C-PAC | CPAC/group_analysis/__init__.py | Python | bsd-3-clause | 158 | 0.006329 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Removing unique constraint on 'OperatingSystem', fields ['item_id', 'document']
db.delete_unique('wiki_ope... | mastizada/kuma | kuma/wiki/migrations/0041_auto__del_firefoxversion__del_unique_firefoxversion_item_id_document__.py | Python | mpl-2.0 | 21,931 | 0.007387 |
# Copyright (c) 2016 EMC Corporation, 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 ap... | cloudbase/cinder | cinder/tests/unit/volume/drivers/emc/vnx/test_client.py | Python | apache-2.0 | 17,512 | 0 |
#!/usr/bin/env python
import sys
import src.json_importing as I
import src.data_training as T
import src.data_cross_validation as V
import src.extract_feature_multilabel as EML
if __name__ == '__main__':
print('Hello, I am Trellearn')
jsonFileName = sys.argv[1]
cards = I.parseJSON(jsonFileName)
X,... | AntoineToubhans/trellearn | main.py | Python | mit | 389 | 0.002571 |
/usr/share/pyshared/gwibber/lib/gtk/widgets.py | Alberto-Beralix/Beralix | i386-squashfs-root/usr/lib/pymodules/python2.7/gwibber/lib/gtk/widgets.py | Python | gpl-3.0 | 46 | 0.021739 |
# CodeIgniter
# http://codeigniter.com
#
# An open source application development framework for PHP
#
# This content is released under the MIT License (MIT)
#
# Copyright (c) 2014 - 2015, British Columbia Institute of Technology
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of thi... | ajose1024/Code_Igniter_Extended | user_guide_src/cilexer/cilexer/cilexer.py | Python | mit | 2,222 | 0.00495 |
import urllib.request, urllib.parse, urllib.error
from oauth2 import Request as OAuthRequest, SignatureMethod_HMAC_SHA1
try:
import json as simplejson
except ImportError:
try:
import simplejson
except ImportError:
from django.utils import simplejson
from social_auth.backends import Consum... | limdauto/django-social-auth | social_auth/backends/contrib/rdio.py | Python | bsd-3-clause | 4,358 | 0.000918 |
from LSP.plugin.core.typing import Any, Callable
from types import MethodType
import weakref
__all__ = ['weak_method']
# An implementation of weak method borrowed from sublime_lib [1]
#
# We need it to be able to weak reference bound methods as `weakref.WeakMethod` is not available in
# 3.3 runtime.
#
# The reason ... | dmilith/SublimeText3-dmilith | Packages/lsp_utils/st3/lsp_utils/_util/weak_method.py | Python | mit | 1,266 | 0.004739 |
#------------------------------------------------------------------------------
# Copyright (c) 2005, Enthought, Inc.
# 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 describe... | enthought/etsproxy | enthought/util/math.py | Python | bsd-3-clause | 1,984 | 0.003528 |
#!/usr/bin/env python
# Copyright 2016 Battelle Energy Alliance, LLC
#
# 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 ... | idaholab/civet | ci/recipe/recipe_to_bash.py | Python | apache-2.0 | 6,708 | 0.00641 |
"""
Test multiword commands ('platform' in this case).
"""
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
class MultiwordCommandsTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@no_debug_info_test
def test_ambiguous_subcommand(self):
self.e... | llvm-mirror/lldb | packages/Python/lldbsuite/test/functionalities/multiword-commands/TestMultiWordCommands.py | Python | apache-2.0 | 1,161 | 0.002584 |
#!/usr/bin/env python3
#
# Copyright (c) 2015-2017 Nest Labs, 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/lic... | openweave/openweave-core | src/test-apps/happy/bin/weave-ping.py | Python | apache-2.0 | 2,876 | 0.001043 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
debug = True
REDIS_HOST = 'localhost'
REDIS_PORT = 6379
REDIS_DB = 0
REDIS_PASSWORD = '820AEC1BFC5D2C71E06CBF947A3A6191'
GUAVA_API_URL = 'http://localhost:5000' | Awesomeomics/webserver | guava/settings.py | Python | mit | 210 | 0.009524 |
from sklearn.tree import DecisionTreeClassifier
# weak classifier
# decision tree (max depth = 2) using scikit-learn
class WeakClassifier:
# initialize
def __init__(self):
self.clf = DecisionTreeClassifier(max_depth = 2)
# train on dataset (X, y) with distribution weight w
def fit(self, X, y, w):
se... | huangshenno1/algo | ml/iris/ada_MO/weakclassifier.py | Python | mit | 425 | 0.030588 |
import time
from prometheus_client import Counter, Histogram
from prometheus_client import start_http_server
from flask import request
FLASK_REQUEST_LATENCY = Histogram('flask_request_latency_seconds', 'Flask Request Latency',
['method', 'endpoint'])
FLASK_REQUEST_COUNT = Counter('flask_request_count', ... | sbarratt/flask-prometheus | flask_prometheus/__init__.py | Python | bsd-3-clause | 1,126 | 0.008881 |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RRrcov(RPackage):
"""rrcov: Scalable Robust Estimators with High Breakdown Point"""
h... | iulian787/spack | var/spack/repos/builtin/packages/r-rrcov/package.py | Python | lgpl-2.1 | 932 | 0.002146 |
from __future__ import unicode_literals
from django.utils.encoding import python_2_unicode_compatible
"""
Model for testing arithmetic expressions.
"""
from django.db import models
@python_2_unicode_compatible
class Number(models.Model):
integer = models.BigIntegerField(db_column='the_integer')
float = models... | ericholscher/django | tests/expressions_regress/models.py | Python | bsd-3-clause | 766 | 0.001305 |
import socket
import os
RUN_IN_TOPOLOGY = False
TOPOLOGY_FROM_RESOURCE_SERVER = False
HOSTNAME_1 = HOSTNAME_2 = HOSTNAME_3 = socket.gethostname()
USE_SSL = False
ICAT_HOSTNAME = socket.gethostname()
PREEXISTING_ADMIN_PASSWORD = 'rods'
# TODO: allow for arbitrary number of remote zones
class FEDERATION(object):
... | janiheikkinen/irods | tests/pydevtest/configuration.py | Python | bsd-3-clause | 802 | 0 |
# 20170226 Add more additional info
import acm
import ael
import HTI_Util
import HTI_FeedTrade_EDD_Util
import fnmatch
import datetime
import os
import sys
import csv
import re
import sqlite3
import math
import glob
import win32com.client
import traceback
ael_variables = [['asofdate', 'Date', 'string', [str(ael.date_t... | frederick623/pb | fa_collateral_upload/HTI_Loan_Collateral_Automation.py | Python | apache-2.0 | 25,027 | 0.010349 |
from gbdxtools import Interface
gbdx = None
def go():
print(gbdx.task_registry.list())
print(gbdx.task_registry.get_definition('HelloGBDX'))
if __name__ == "__main__":
gbdx = Interface()
go()
| DigitalGlobe/gbdxtools | examples/basic_workflow_client.py | Python | mit | 211 | 0.009479 |
"""This module provides the main functionality of cfbackup
"""
from __future__ import print_function
import sys
import argparse
import json
import CloudFlare
# https://api.cloudflare.com/#dns-records-for-a-zone-list-dns-records
class CF_DNS_Records(object):
"""
commands for zones manipulation
"""
def ... | nordicdyno/cfbackup | cfbackup/core.py | Python | bsd-2-clause | 6,025 | 0.001494 |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
#
# Documents
#
"""
Documents
"""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
import os
import inspect
from . import pyarduino
this_file_path = os.path.abspath(ins... | kidmillions/Stino | stino/st_base.py | Python | mit | 1,584 | 0.000631 |
'''MobileNetV2 in PyTorch.
See the paper "Inverted Residuals and Linear Bottlenecks:
Mobile Networks for Classification, Detection and Segmentation" for more details.
'''
import torch
import torch.nn as nn
import torch.nn.functional as F
class Block(nn.Module):
'''expand + depthwise + pointwise'''
def __init... | kuangliu/pytorch-cifar | models/mobilenetv2.py | Python | mit | 3,092 | 0.003558 |
#!/usr/bin/env python3
############################################################################
# Copyright 2017 RIFT.IO Inc #
# #
# Licensed under the Apache License, Version 2.0 (the "License");... | RIFTIO/rift.ware-descriptor-packages | 4.3/src/nsd/haproxy_waf_http_ns/scripts/waf_config.py | Python | apache-2.0 | 9,663 | 0.003415 |
# Mostly from http://peterdowns.com/posts/first-time-with-pypi.html
from distutils.core import setup
setup(
name = 'pmdp',
packages = ['pmdp'],
version = '0.3',
description = 'A poor man\'s data pipeline',
author = 'Dan Goldin',
author_email = 'dangoldin@gmail.com',
url = 'https://github.com/dangoldin/po... | dangoldin/poor-mans-data-pipeline | setup.py | Python | mit | 491 | 0.04277 |
# -*- coding: utf-8 -*-
import os
import glob
import sys
import re
# Display debug information, print to statistics file
verbose = 0
obstruents = {'b':'B', 'd':'D', 'g':'G'}
nasals = ['m', 'n', 'N']
# Vocales
vowels = ['a', 'e', 'i', 'o', 'u']
# Semivocales
semivowels = ['%', '#', '@', '$', '&', '!', '*', '+', '-', ... | lawphill/PhillipsPearl_Corpora | Spanish/scripts/dict_convert.py | Python | mit | 8,349 | 0.010189 |
#!/usr/bin/env python
#
# Copyright (c) 2013 In-Q-Tel, Inc/Lab41, 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
#
# Unles... | kfoss/try41 | dockerfiles/redwood/visual.py | Python | apache-2.0 | 2,481 | 0.008061 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2013 The Plaso Project Authors.
# Please see the AUTHORS file for details on individual 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 L... | iwm911/plaso | plaso/parsers/winreg_plugins/outlook.py | Python | apache-2.0 | 2,761 | 0.010503 |
# -*- coding: utf-8 -*-
import warnings
from django import forms
from django.contrib.admin.sites import site
from django.contrib.admin.widgets import ForeignKeyRawIdWidget
from django.contrib.staticfiles.templatetags.staticfiles import static
from django.core.urlresolvers import reverse
from django.db import models
f... | DylannCordel/django-filer | filer/fields/folder.py | Python | bsd-3-clause | 4,982 | 0.001004 |
"""
Copyright 2016 Andrea McIntosh
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 i... | akmcinto/TodoApp | ToDoApp/polls/views.py | Python | apache-2.0 | 1,788 | 0.003356 |
import os
import sys
root_path = os.path.abspath("../../../")
if root_path not in sys.path:
sys.path.append(root_path)
import numpy as np
import tensorflow as tf
from _Dist.NeuralNetworks.Base import Generator4d
from _Dist.NeuralNetworks.h_RNN.RNN import Basic3d
from _Dist.NeuralNetworks.NNUtil import Activations... | carefree0910/MachineLearning | _Dist/NeuralNetworks/i_CNN/CNN.py | Python | mit | 3,860 | 0.00544 |
# Initialize App Engine and import the default settings (DB backend, etc.).
# If you want to use a different backend you have to remove all occurences
# of "djangoappengine" from this file.
from djangoappengine.settings_base import *
from private_settings import SECRET_KEY
import os
# Activate django-dbindexer for th... | ukch/gae_simple_blog | settings.py | Python | bsd-3-clause | 2,108 | 0.000949 |
import utils
import re
import subprocess
#regexes
duration_regex = re.compile('Duration:\s*(?P<time>\d{2}:\d{2}:\d{2}.\d{2})')
stream_regex = re.compile('Stream #(?P<stream_id>\d+:\d+)(\((?P<language>\w+)\))?: (?P<type>\w+): (?P<format>[\w\d]+)')
crop_regex = re.compile('crop=(?P<width>\d+):(?P<height>\d+):(?P<x>\d+)... | choffmeister/transcode | lib/ffmpeg.py | Python | mit | 1,356 | 0.030236 |
# -*- coding: utf-8-unix; mode: python -*-
"""Module to assist to make HTML.
This module provides class that assist to make HTML.
Author: 2011 IMAI Toshiyuki
Copyright (c) 2011 IMAI Toshiyuki
This software is released under the MIT License.
http://opensource.org/licenses/mit-license.php
Class:
HTML -- Assist t... | imait/HtmlDocument | for_python2.x/htmldocument.py | Python | mit | 46,242 | 0.00093 |
# -*- coding: utf-8 -*-
import logging
from speaklater import make_lazy_string
from quokka.modules.accounts.models import User
logger = logging.getLogger()
def lazy_str_setting(key, default=None):
from flask import current_app
return make_lazy_string(
lambda: current_app.config.get(key, default)
... | maurobaraldi/quokka | quokka/utils/__init__.py | Python | mit | 714 | 0 |
from .req import Req
class Records(Req):
def __init__(self, url, email, secret):
super().__init__(url=url, email=email, secret=secret)
def get(self, zone_id, layer='default'):
return self.do_get("/zones/{}/{}/records".format(zone_id, layer))
def create(self, zone, layer, name, ttl, rtype... | cloudnsru/PyCloudNS | PyCloudNS/records.py | Python | mit | 967 | 0 |
# crop.py
# Derek Groenendyk
# 2/15/2017
# reads input data from Excel workbook
from collections import OrderedDict
import logging
import numpy as np
import os
import sys
from cons2.cu import CONSUMPTIVE_USE
# from utils import excel
logger = logging.getLogger('crop')
logger.setLevel(logging.DEBUG)
class CROP(obje... | MoonRaker/cons2-python | cons2/crop.py | Python | gpl-3.0 | 6,619 | 0.009216 |
"""Auto-generated file, do not edit by hand. BS metadata"""
from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata
PHONE_METADATA_BS = PhoneMetadata(id='BS', country_code=None, international_prefix=None,
general_desc=PhoneNumberDesc(national_number_pattern='9\\d\\d', possible_length=(3,)),
to... | daviddrysdale/python-phonenumbers | python/phonenumbers/shortdata/region_BS.py | Python | apache-2.0 | 677 | 0.008863 |
"""
Functions that ignore NaN.
Functions
---------
- `nanmin` -- minimum non-NaN value
- `nanmax` -- maximum non-NaN value
- `nanargmin` -- index of minimum non-NaN value
- `nanargmax` -- index of maximum non-NaN value
- `nansum` -- sum of non-NaN values
- `nanprod` -- product of non-NaN values
- `nanmean` -- mean of... | chiffa/numpy | numpy/lib/nanfunctions.py | Python | bsd-3-clause | 46,492 | 0.000022 |
# Copyright 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | chheplo/jaikuengine | common/models.py | Python | apache-2.0 | 22,503 | 0.016531 |
##########################################################################
#
# Copyright (c) 2011-2012, Image Engine Design Inc. All rights reserved.
# Copyright (c) 2011-2012, John Haddon. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted ... | DoubleNegativeVisualEffects/gaffer | python/GafferUI/OpDialogue.py | Python | bsd-3-clause | 4,512 | 0.038121 |
# Authors: John Dennis <jdennis@redhat.com>
#
# Copyright (C) 2011 Red Hat
# see file 'COPYING' for use and warranty information
#
# 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... | hroncok/freeipa | ipapython/ipa_log_manager.py | Python | gpl-3.0 | 8,302 | 0.004095 |
import ConfigParser
import StringIO
import os
import unittest
import UserDict
from test import test_support
class SortedDict(UserDict.UserDict):
def items(self):
result = self.data.items()
result.sort()
return result
def keys(self):
result = self.data.keys()
... | alanjw/GreenOpenERP-Win-X86 | python/Lib/test/test_cfgparser.py | Python | agpl-3.0 | 28,482 | 0.000632 |
"""This example shows how to create a scatter plot using the `shell` package.
"""
# Major library imports
from numpy import linspace, random, pi
# Enthought library imports
from chaco.shell import plot, hold, title, show
# Create some data
x = linspace(-2*pi, 2*pi, 100)
y1 = random.random(100)
y2 = random.random(10... | burnpanck/chaco | examples/demo/shell/scatter.py | Python | bsd-3-clause | 533 | 0 |
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 05 17:10:34 2014
@author: Ning
"""
from util import *
from util.log import _logger
from feat.terms.term_categorize import term_category
import codecs
def parse(sentence):
for term in sentence.split():
yield term_category(term)
def tokenize():
r... | luanjunyi/cortana | feat/bow/tokenize.py | Python | mit | 834 | 0.020384 |
#!/usr/bin/env python
from __future__ import print_function, division, absolute_import
import re
import os
from copy import deepcopy
import numpy as np
import toytree
import toyplot
#######################################################
# Exception Classes
#######################################################
c... | eaton-lab/toytree | toytree/utils.py | Python | bsd-3-clause | 22,118 | 0.003979 |
###############################################################################
#
# Copyright (C) 2001-2014 Micronaet SRL (<http://www.micronaet.it>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the ... | Micronaet/micronaet-xmlrpc | xmlrpc_operation_invoice/__openerp__.py | Python | agpl-3.0 | 1,553 | 0.001288 |
import re
from django.contrib.sites.models import Site
from django.contrib.syndication.views import Feed
from django.core.urlresolvers import reverse
from django.utils.feedgenerator import Atom1Feed
from django.utils.text import slugify
from django.utils.translation import ugettext_lazy as _
from .models import Logge... | datamade/yournextmp-popit | candidates/feeds.py | Python | agpl-3.0 | 1,820 | 0.001099 |
import json
import random
import time
import urllib
import re
from scrapy.utils.misc import load_object
from scrapy.http import Request
from scrapy.conf import settings
import redis
from crawler.schedulers.redis.dupefilter import RFPDupeFilter
from crawler.schedulers.redis.queue import RedisPriorityQueue
try:
im... | openslack/openslack-crawler | crawler/schedulers/kafka/scheduler.py | Python | apache-2.0 | 6,484 | 0.000617 |
from sklearntools.kfold import ThresholdHybridCV
import numpy as np
from six.moves import reduce
from operator import __add__
from numpy.testing.utils import assert_array_equal
from nose.tools import assert_equal
def test_hybrid_cv():
X = np.random.normal(size=(100,10))
y = np.random.normal(size=100)
cv =... | jcrudy/sklearntools | sklearntools/test/test_kfold.py | Python | bsd-3-clause | 809 | 0.003708 |
"""
sentry.utils.email
~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import logging
import os
import subprocess
import tempfile
import time
from email.utils import parseaddr
from fu... | mitsuhiko/sentry | src/sentry/utils/email.py | Python | bsd-3-clause | 15,463 | 0.000776 |
#!/usr/bin/env python
"""plot_softmax_results.py: Plot results of mnist softmax tests."""
from helper_scripts.mnist_read_log import plot_results
import matplotlib.pyplot as plt
# Produce cross entropy and accuracy plots for softmax models.
# Requires the training data for each of the models.
files = [r"""../mnist_s... | hutcho66/imagerecognition | softmax_scripts/plot_softmax_results.py | Python | mit | 636 | 0.003145 |
# -*- coding: utf-8 -*-
#
# mfp documentation build configuration file, created by
# sphinx-quickstart.
#
# 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 configuration values have a def... | levental/visualizer | docs/conf.py | Python | bsd-3-clause | 7,793 | 0.001155 |
#!/usr/bin/env python2.5
from optparse import OptionParser
from rosettautil.rosetta import rosettaScore
usage = "%prog [options] --term=scoreterm silent files"
parser=OptionParser(usage)
parser.add_option("--term",dest="term",help="score term to use")
(options,args) = parser.parse_args()
if len(args) < 1:
parser... | decarboxy/py_protein_utils | scripts/best_models.py | Python | mit | 1,426 | 0.018934 |
####
#### Give a report on the "sanity" of the users and groups YAML
#### metadata files.
####
#### Example usage to analyze the usual suspects:
#### python3 sanity-check-users-and-groups.py --help
#### Get report of current problems:
#### python3 ./scripts/sanity-check-users-and-groups.py --users metadata/users.yaml... | geneontology/go-site | scripts/sanity-check-users-and-groups.py | Python | bsd-3-clause | 7,704 | 0.007269 |
import requests
from Norman.errors import HttpMethodError
class BaseAPI(object):
"""
"""
_content_type = "application/json"
def __init__(self):
pass
def _json_parser(self, json_response):
response = json_response.json()
return response
def exec_request(self, metho... | Olamyy/Norman | Norman/api/base.py | Python | bsd-3-clause | 846 | 0.002364 |
from . import NetworkObject
import z3
class ErroneousAclWebProxy (NetworkObject):
"""A caching web proxy which enforces ACLs erroneously.
The idea here was to present something that is deliberately not path independent"""
def _init (self, node, network, context):
super(ErroneousAclWebProxy, self... | apanda/modeling | mcnet/components/erroneous_aclfull_proxy.py | Python | bsd-3-clause | 10,082 | 0.019242 |
import sys
import random, string
import os
numberOfEmailsToGenerate = sys.argv[1]
try:
int(numberOfEmailsToGenerate)
print('Generating a CSV with ' + numberOfEmailsToGenerate + ' random emails')
print('This make take some time if the CSV is large ...')
except:
sys.exit('Please pass a number as the fir... | karuppiah7890/Mail-for-Good | utility/generateEmailCsv.py | Python | bsd-3-clause | 664 | 0.004518 |
# This code is part of Ansible, but is an independent component.
# This particular file snippet, and this file snippet only, is BSD licensed.
# Modules you write using this snippet, which is embedded dynamically by Ansible
# still belong to the author of the module, and may assign their own license
# to the complete wo... | kustodian/ansible | lib/ansible/module_utils/network/common/utils.py | Python | gpl-3.0 | 21,313 | 0.001314 |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.7.4
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
im... | djkonro/client-python | kubernetes/test/test_v1beta1_storage_class.py | Python | apache-2.0 | 891 | 0.003367 |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from .....testing import assert_equal
from ..histogrammatching import HistogramMatching
def test_HistogramMatching_inputs():
input_map = dict(args=dict(argstr='%s',
),
environ=dict(nohash=True,
usedefault=True,
),
ignore_exception=dict(noha... | FCP-INDI/nipype | nipype/interfaces/slicer/filtering/tests/test_auto_HistogramMatching.py | Python | bsd-3-clause | 1,372 | 0.019679 |
from ..errors import ErrorFolderNotFound, ErrorInvalidOperation, ErrorNoPublicFolderReplicaAvailable
from ..util import MNS, create_element
from .common import EWSAccountService, folder_ids_element, parse_folder_elem, shape_element
class GetFolder(EWSAccountService):
"""MSDN: https://docs.microsoft.com/en-us/exch... | ecederstrand/exchangelib | exchangelib/services/get_folder.py | Python | bsd-2-clause | 2,503 | 0.004395 |
# 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 ... | jkonecki/autorest | AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storagemanagementclient/models/bar.py | Python | mit | 1,021 | 0.000979 |
#
# gPrime - a web-based genealogy program
#
# Copyright (c) 2015 Gramps Development Team
#
# 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 of the License, or
# (at your option)... | sam-m888/gprime | gprime/app/forms/nameform.py | Python | gpl-2.0 | 2,701 | 0.00074 |
import calendar
import os
import subprocess
import tempfile
import shutil
import stat
import datetime
import time
import csv
from collections import defaultdict
from io import StringIO
import pytz
from pyquery import PyQuery as pq
from django import http
from django.core.cache import cache
from django.utils.timezone im... | mozilla/peekaboo | peekaboo/main/views.py | Python | mpl-2.0 | 17,096 | 0 |
"""
Progress Tab Serializers
"""
from rest_framework import serializers
from rest_framework.reverse import reverse
class GradedTotalSerializer(serializers.Serializer):
earned = serializers.FloatField()
possible = serializers.FloatField()
class SubsectionSerializer(serializers.Serializer):
display_name =... | stvstnfrd/edx-platform | lms/djangoapps/course_home_api/progress/v1/serializers.py | Python | agpl-3.0 | 3,620 | 0.000276 |
## p7.py - parallel processing microframework
## (c) 2017 by mobarski (at) gmail (dot) com
## licence: MIT
## version: ex4 (simple fan-in of subprocess outputs)
from __future__ import print_function
# CONFIG ###################################################################################
HEAD_LEN_IN = 2
HEAD_LEN_... | mobarski/sandbox | parallel/p7ex4.py | Python | mit | 2,120 | 0.032075 |
# -*- coding: utf-8 -*-
"""
flango.template
~~~~~~~~~~~~~~
template module provide a simple template system that compiles
templates to Python code which like django and tornado template
modules.
Usage
-----
Well, you can view the tests file directly for the usage under tests.
Bas... | hziling/template | template.py | Python | mit | 11,977 | 0.002004 |
"""Django middlewares."""
try:
# Python 2.x
from urlparse import urlsplit, urlunsplit
except ImportError:
# Python 3.x
from urllib.parse import urlsplit
from urllib.parse import urlunsplit
from django.conf import settings
from django.http import HttpResponsePermanentRedirect
try:
# Django 1.... | rdegges/django-sslify | sslify/middleware.py | Python | unlicense | 2,315 | 0.001296 |
import argparse
import codecs
import sys
from .auth import parse_authentication
from .confluence_api import create_confluence_api
from .confluence import ConfluencePageManager
from .constants import DEFAULT_CONFLUENCE_API_VERSION
def main():
parser = argparse.ArgumentParser(description='Dumps Confluence page in ... | dopuskh3/confluence-publisher | conf_publisher/page_dumper.py | Python | mit | 1,397 | 0.003579 |
#!/usr/bin/env python3
import fnmatch
import os
import re
import ntpath
import sys
import argparse
def get_private_declare(content):
priv_declared = []
srch = re.compile('private.*')
priv_srch_declared = srch.findall(content)
priv_srch_declared = sorted(set(priv_srch_declared))
priv_dec... | kerckasha/ACE3 | tools/search_privates.py | Python | gpl-2.0 | 4,384 | 0.021908 |
from django.db import models
from django.utils.translation import ugettext_lazy as _
class HelperShift(models.Model):
"""
n-m relation between helper and shift.
This model then can be used by other apps to "attach" more data with OneToOne fields and signals.
The fields `present` and `manual_presence... | helfertool/helfertool | src/registration/models/helpershift.py | Python | agpl-3.0 | 1,614 | 0.002478 |
""" Tests the implementation of the solution to the Euclidean Minimum Spanning
Tree (EMST) problem """
import pytest
from exhaustive_search.point import Point
from exhaustive_search.euclidean_mst import solve, edist
def compare_solutions(actual, expected):
assert len(actual) == len(expected), "expected %d to equ... | ciarand/exhausting-search-homework | test/test_euclidean_mst.py | Python | isc | 2,000 | 0.0055 |
# Copyright 2014-2020 The PySCF Developers. 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 appl... | sunqm/pyscf | pyscf/agf2/test/test_c_agf2.py | Python | apache-2.0 | 4,413 | 0.004759 |
#!/usr/bin/python
from macaroon.playback import *
import utils
sequence = MacroSequence()
sequence.append(PauseAction(3000))
sequence.append(KeyComboAction("F10"))
sequence.append(KeyComboAction("Tab"))
sequence.append(KeyComboAction("Tab"))
sequence.append(KeyComboAction("Tab"))
sequence.append(KeyComboAction("Tab"... | GNOME/orca | test/keystrokes/gnome-clocks/timer_flat_review.py | Python | lgpl-2.1 | 3,398 | 0.000896 |
from django.views.generic import ListView, DetailView, CreateView, \
DeleteView, UpdateView, \
ArchiveIndexView, DateDetailView, \
DayArchiveView, MonthArchiveView, \
TodayArchiveView, Wee... | tnemis/staging-server | baseapp/views/class_studying_views.py | Python | mit | 3,912 | 0.005624 |
### extends 'class_empty.py'
### block ClassImports
# NOTICE: Do not edit anything here, it is generated code
from . import gxapi_cy
from geosoft.gxapi import GXContext, float_ref, int_ref, str_ref
### endblock ClassImports
### block Header
# NOTICE: The code generator will not replace the code in this block
### end... | GeosoftInc/gxpy | geosoft/gxapi/GXRA.py | Python | bsd-2-clause | 5,242 | 0.00744 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.