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 |
|---|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
""" watcher test cases """
from .shell_test_case import ShellTestCase
from zk_shell.watcher import ChildWatcher
class WatcherTestCase(ShellTestCase):
""" test watcher """
def test_add_update(self):
watcher = ChildWatcher(self.client, print_func=self.shell.show_output)
... | rgs1/zk_shell | zk_shell/tests/test_watcher.py | Python | apache-2.0 | 633 | 0 |
from .base import *
DEBUG = True
db_url = 'sqlite:///{}'.format(os.path.join(BASE_DIR, 'test.sqlite3'))
default_db = dj_database_url.config(default=db_url, conn_max_age=None)
DATABASES['default'].update(default_db)
PASSWORD_HASHERS = (
'django.contrib.auth.hashers.MD5PasswordHasher',
)
EMAIL_BACKEND = 'django.c... | citiufpe/citi-webplate | project_name/settings/test.py | Python | mit | 360 | 0 |
# Django settings for test_project project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'test.db',
}
}
TIME_ZONE = 'Etc/UTC'
LANGUAGE_CODE = 'en-u... | yprez/django-useful | test_project/test_project_py2/settings.py | Python | isc | 1,842 | 0.001086 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
# Author: Leonardo Pistone
# Copyright 2015 Camptocamp SA
from odoo.addons.stock.tests.common2 import TestStockCommon
from odoo.tests.common import Form
class TestVirtualAvailable(TestStockCommon):
def setUp(self)... | ygol/odoo | addons/stock/tests/test_product.py | Python | agpl-3.0 | 4,949 | 0.001819 |
#!/usr/bin/env python
# ----------------------------------------------------------------
# Copyright 2016 Cisco Systems
#
# 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.apac... | abhikeshav/ydk-py | core/samples/bgp_netconf.py | Python | apache-2.0 | 4,063 | 0.002461 |
"""Next-gen sequencing alignment with Novoalign: http://www.novocraft.com
For BAM input handling this requires:
novoalign (with license for multicore)
samtools
"""
import os
import subprocess
from bcbio import bam, utils
from bcbio.ngsalign import alignprep, postalign
from bcbio.pipeline import config_utils
from ... | biocyberman/bcbio-nextgen | bcbio/ngsalign/novoalign.py | Python | mit | 6,281 | 0.003184 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-05-25 15:50
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('pages', '0012_auto_20160519_1740'),
]
operations = [
migrations.AddField(
... | bruecksen/isimip | isi_mip/pages/migrations/0013_formpage_button_name.py | Python | mit | 500 | 0.002 |
import time
import binascii
import struct
from twisted.internet import defer
from stratum.services import GenericService
from stratum.pubsub import Pubsub, Subscription
from stratum.custom_exceptions import ServiceException, RemoteServiceException
from jobs import JobRegistry
import stratum.logger
log = stratum.log... | oxagast/hashnet | stratum-mining-proxy/mining_libs/stratum_listener.py | Python | gpl-2.0 | 7,466 | 0.008438 |
import librosa
import numpy as np
import help_functions
def extract_mfccdd(fpath, n_mfcc=13, winsize=0.25, sampling_rate=16000):
'''
Compute MFCCs, first and second derivatives
:param fpath: the file path
:param n_mfcc: the number of MFCC coefficients. Default = 13 coefficients
:param winsize: the ... | gkaramanolakis/adsm | adsm/feature_extraction.py | Python | gpl-3.0 | 3,139 | 0.021982 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
from loguru import logger
from pathlib import Path
def check_meta_yaml_for_noarch(fn:Path, text=None):
import re
logger.debug("Checking for noarch")
if text is None:
with open(fn, "rt") as fl:
text = fl.read()
mo = re... | mjirik/discon | discon/discon_tools.py | Python | mit | 600 | 0.003333 |
from pecan import expose, conf
from potasio.controllers.dashboards import DashboardController
class RootController(object):
@expose(template='index.html')
def index(self):
dashboards = conf.dashboards.to_dict()
return dict(
dashboards=dashboards.keys()
)
@expose()
... | alfredodeza/potasio | potasio/controllers/root.py | Python | bsd-3-clause | 411 | 0 |
#!/usr/bin/env python
import os
import sys
def usage():
print "{0} <feed>".format(os.path.basename(__file__))
if __name__ == '__main__':
kmotion_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
sys.path.append(kmotion_dir)
from core.camera_lost import CameraLost
feed = ''
... | dvor85/kmotion | bin/reboot_cam.py | Python | gpl-3.0 | 523 | 0.001912 |
from argparse import ArgumentParser
from yahoo_finance import Share
import pyperclip
import urllib2
from bs4 import BeautifulSoup
currentrelease = 'Pattern Target Finder 1.2'
#v1.2 - Added get earnings date function
#v1.1 - Get's current delayed price from Yahoo_Finance
# Allowed you to override price -p 123
# Copi... | nhsb1/PatternTargetFinder | ptf.py | Python | gpl-3.0 | 3,499 | 0.025722 |
# Copyright (c) 2012 <Jaume Devesa (jaumedevesa@gmail.com)>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modi... | jdevesa/gists | gists/gists.py | Python | mit | 12,061 | 0 |
# coding=utf-8
# Copyright 2021 TF.Text Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | chromium/chromium | third_party/tensorflow-text/src/tensorflow_text/python/keras/layers/todense_test.py | Python | bsd-3-clause | 8,393 | 0.002264 |
import os
import codecs
from io import StringIO
from pytest import fixture
from rave import filesystem
class DummyProvider:
def __init__(self, files):
self.files = files;
def list(self):
return self.files
def has(self, filename):
return filename in self.list()
def open(self,... | rave-engine/rave | tests/support/filesystem.py | Python | bsd-2-clause | 4,963 | 0.006045 |
"""A connection adapter that tries to use the best polling method for the
platform pika is running on.
"""
import os
import logging
import socket
import select
import errno
import time
from operator import itemgetter
from collections import defaultdict
import threading
import pika.compat
from pika.compat import dictk... | reddec/pika | pika/adapters/select_connection.py | Python | bsd-3-clause | 21,137 | 0.000378 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
from collections import OrderedDict
import imp
import time
import logging
import itertools
import os
import numpy as np
from path import Path
import theano
import theano.tensor as T
import lasagne
from fuel.datasets import CelebA
from gan.util import (
... | spellrun/Neural-Photo-Editor | gan/sample_ian.py | Python | mit | 5,521 | 0.011411 |
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2011 Nick Hall
#
# 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) any late... | pmghalvorsen/gramps_branch | gramps/plugins/gramplet/repositorydetails.py | Python | gpl-2.0 | 5,196 | 0.002694 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2012 Therp BV (<http://therp.nl>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of ... | archetipo/server-tools | users_ldap_groups/users_ldap_groups_operators.py | Python | agpl-3.0 | 2,298 | 0 |
"""Tests for the Modern Forms integration."""
from unittest.mock import MagicMock, patch
from aiomodernforms import ModernFormsConnectionError
from homeassistant.components.modern_forms.const import DOMAIN
from homeassistant.config_entries import ConfigEntryState
from homeassistant.core import HomeAssistant
from home... | aronsky/home-assistant | tests/components/modern_forms/test_init.py | Python | apache-2.0 | 1,806 | 0.000554 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from math import inf
import pytest
import numpy as np
from astropy.cosmology.utils import inf_like, vectorize_if_needed, vectorize_redshift_method
from astropy.utils.exceptions import AstropyDeprecationWarning
def test_vectorize_redshift_method():
... | mhvk/astropy | astropy/cosmology/tests/test_utils.py | Python | bsd-3-clause | 2,328 | 0.001289 |
"""
sentry.rules.actions.notify_event
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: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
from sentry.plugins import plugins
from sentry.rules.actions.base import EventAct... | felixbuenemann/sentry | src/sentry/rules/actions/notify_event.py | Python | bsd-3-clause | 1,345 | 0.000743 |
from migrate.versioning import api
from config import SQLALCHEMY_DATABASE_URI
from config import SQLALCHEMY_MIGRATE_REPO
from app import db
import os.path
db.create_all()
if not os.path.exists(SQLALCHEMY_MIGRATE_REPO):
api.create(SQLALCHEMY_MIGRATE_REPO, 'database_repository')
api.version_control(SQLALCHEMY_D... | CCS-Tech/duck-blocks | db_create.py | Python | gpl-3.0 | 475 | 0.004211 |
# The Adafruit16CServoDriver API is supported through Jython
servo1 = Runtime.createAndStart("servo1", "Servo")
pwm = Runtime.createAndStart("pwm", "Adafruit16CServoDriver")
pwm.connect("COM12")
# attach servo1 to pin 0 on the servo driver
pwm.attach(servo1, 0)
servo1.broadcastState()
servo1.moveTo(0)
sleep(1... | sujitbehera27/MyRoboticsProjects-Arduino | src/resource/Python/examples/Adafruit16CServoDriver.py | Python | apache-2.0 | 529 | 0.009452 |
"""Pyweet runtime settings."""
import os
class Settings(object):
"""Basic settings object for pyweet."""
API = "rgIYSFIeGBxVXOPy22QzA"
API_SECRET = "VX7ohOHpJm1mXlGX6XS08JcT4Vp8j83QhRNo1SVRevb"
AUTH_FILE = os.path.expanduser("~/.pyweet")
| a-tal/pyweet | pyweet/settings.py | Python | bsd-3-clause | 259 | 0 |
# coding: utf-8
# maposmatic, the web front-end of the MapOSMatic city map generation system
# Copyright (C) 2009 David Decotigny
# Copyright (C) 2009 Frédéric Lehobey
# Copyright (C) 2009 Pierre Mauduit
# Copyright (C) 2009 David Mentré
# Copyright (C) 2009 Maxime Petazzoni
# Copyright (C) 2009 Thomas Petazzoni... | hholzgra/maposmatic | www/maposmatic/views.py | Python | agpl-3.0 | 26,128 | 0.004785 |
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def upsideDownBinaryTree(self, root):
"""
:type root: TreeNode
:rtype: TreeNode
"""
... | tedye/leetcode | Python/leetcode.156.binary-tree-upside-down.py | Python | mit | 822 | 0.001217 |
from minieigen import *
from woo.dem import *
import woo.core, woo.models
from math import *
import numpy
class PourFeliciter(woo.core.Preprocessor,woo.pyderived.PyWooObject):
'''Showcase for custom packing predicates, and importing surfaces from STL.'''
_classTraits=None
_PAT=woo.pyderived.PyAttrTrait # ... | sjl767/woo | py/pre/toys.py | Python | gpl-2.0 | 3,537 | 0.035906 |
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# T... | Donkyhotay/MoonPy | zope/app/dtmlpage/interfaces.py | Python | gpl-3.0 | 1,715 | 0.000583 |
import numpy as np
from procgraph import COMPULSORY
from procgraph import simple_block
from .pil_conversions import Image_from_array
__all__ = ['resize']
@simple_block
def pil_zoom(value, factor=COMPULSORY):
""" Zooms by a given factor """
# TODO: RGBA?
shape = value.shape[:2]
shape2 = (int(factor *... | spillai/procgraph | src/procgraph_pil/pil_operations.py | Python | lgpl-3.0 | 1,746 | 0.006873 |
"""
Scatter Plot with LOESS Lines
-----------------------------
This example shows how to add a trend line to a scatter plot using
the LOESS transform (LOcally Estimated Scatterplot Smoothing).
"""
# category: scatter plots
import altair as alt
import pandas as pd
import numpy as np
np.random.seed(1)
source = pd.Da... | altair-viz/altair | altair/examples/scatter_with_loess.py | Python | bsd-3-clause | 755 | 0.005298 |
from django.conf import settings
from django.core.cache import get_cache
from django.db.models.fields.files import ImageField
from livesettings import config_value
from satchmo_utils.thumbnail.text import URLify
#ensure config is loaded
import satchmo_utils.thumbnail.config
import fnmatch
import logging
import os
imp... | grengojbo/satchmo | satchmo/apps/satchmo_utils/thumbnail/utils.py | Python | bsd-3-clause | 9,086 | 0.005393 |
"""Tests for the main nhlscraper CLI module"""
from subprocess import PIPE, getoutput
from unittest import TestCase
from nhl_logo_scraper import __version__ as VERSION
class TestHelp(TestCase):
def test_returns_usage_information(self):
output = getoutput("nhlscraper -h")
self.assertTrue('Usage:' ... | blindman/nhl-logo-scraper | tests/test_cli.py | Python | mit | 604 | 0.004967 |
#!/usr/bin/python
#
# Copyright (c) 2016 Thomas Stringer, <tomstr@microsoft.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | tersmitten/ansible | lib/ansible/modules/cloud/azure/azure_rm_functionapp_facts.py | Python | gpl-3.0 | 6,027 | 0.002323 |
# Copyright (C) 2012,2013
# Max Planck Institute for Polymer Research
# Copyright (C) 2008,2009,2010,2011
# Max-Planck-Institute for Polymer Research & Fraunhofer SCAI
#
# This file is part of ESPResSo++.
#
# ESPResSo++ is free software: you can redistribute it and/or modify
# it under the terms of the G... | espressopp/espressopp | src/Tensor.py | Python | gpl-3.0 | 3,339 | 0.000299 |
import numpy as np
from tyssue import Sheet, Monolayer
from tyssue.generation import three_faces_sheet, extrude
from tyssue.utils import connectivity
from tyssue.config.geometry import bulk_spec
def test_ef_connect():
data, specs = three_faces_sheet()
sheet = Sheet("test", data, specs)
ef_connect = conne... | CellModels/tyssue | tests/utils/test_connectivity.py | Python | gpl-2.0 | 2,530 | 0 |
#!/usr/bin/env python3
# Copyright 2013-present Barefoot Networks, 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... | p4lang/behavioral-model | mininet/1sw_demo.py | Python | apache-2.0 | 3,488 | 0.008601 |
# Copyright 2014, 2018, 2019, 2020 Andrzej Cichocki
# This file is part of pym2149.
#
# pym2149 is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later... | combatopera/pym2149 | ymtests/__init__.py | Python | gpl-3.0 | 707 | 0.001414 |
# 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.custom.doctype.custom_field.custom_field import create_custom_field_if_values_exist
def execute():
frappe.reload_doc("stock"... | saurabh6790/erpnext | erpnext/patches/v4_0/create_custom_fields_for_india_specific_fields.py | Python | gpl-3.0 | 1,704 | 0.032277 |
from . import cartan_decompose
from . import stabilizers
from . import noncommgraph
| dstahlke/qitensor | qitensor/experimental/__init__.py | Python | bsd-2-clause | 84 | 0 |
# coding: utf-8
"""
EVE Swagger Interface
An OpenAPI for EVE Online
OpenAPI spec version: 0.4.6
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
class GetCorporationsCorporationIdStructuresService(object):
... | minlexx/pyevemon | esi_client/models/get_corporations_corporation_id_structures_service.py | Python | gpl-3.0 | 4,135 | 0.001693 |
# This file is part of Virtual Programming Lab.
#
# Virtual Programming Lab is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Virtu... | buchuki/programming_lab | programming_lab/classlist/forms.py | Python | gpl-3.0 | 1,349 | 0.008154 |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | theflofly/tensorflow | tensorflow/python/saved_model/function_deserialization.py | Python | apache-2.0 | 14,043 | 0.008047 |
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
class InstalledApplication(Document):
pass
| adityahase/frappe | frappe/core/doctype/installed_application/installed_application.py | Python | mit | 278 | 0.007194 |
# -*- coding: utf-8 -*-
# ------------------------------------------------------------
# streamondemand.- XBMC Plugin
# Canal para piratestreaming
# http://blog.tvalacarta.info/plugin-xbmc/streamondemand.
# ------------------------------------------------------------
import re
import sys
import urlparse
from core impo... | orione7/Italorione | channels/guardarefilm.py | Python | gpl-3.0 | 11,213 | 0.002409 |
from django.db.models import Max
from django.db.models import Q
from django.utils import timezone
from pydoc import locate
from orchestra.core.errors import SanityBotError
from orchestra.models import Project
from orchestra.models import SanityCheck
from orchestra.models import WorkflowVersion
from orchestra.utils.not... | b12io/orchestra | orchestra/bots/sanitybot.py | Python | apache-2.0 | 3,750 | 0 |
# Copyright 2016 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 agree... | Vaan5/piecewisecrf | piecewisecrf/slim/variables_test.py | Python | mit | 16,163 | 0.011075 |
__problem_title__ = "Path sum: two ways"
__problem_url___ = "https://projecteuler.net/problem=81"
__problem_description__ = "In the 5 by 5 matrix below, the minimal path sum from the top left to " \
"the bottom right, by , is indicated in bold red and is equal to 2427. " \
... | jrichte43/ProjectEuler | Problem-0081/solutions.py | Python | gpl-3.0 | 949 | 0.007376 |
a, b, c, d = map(int, input().split())
print(a * 1728 + b * 144 + c * 12 + d)
| y-sira/atcoder | ddcc2017-qual/b.py | Python | mit | 79 | 0 |
# -*- coding: utf-8 -*-
from module.plugins.internal.DeadCrypter import DeadCrypter
class BitshareComFolder(DeadCrypter):
__name__ = "BitshareComFolder"
__type__ = "crypter"
__version__ = "0.10"
__status__ = "testing"
__pattern__ = r'http://(?:www\.)?bitshare\.com/\?d=\w+'
__config__ ... | kaarl/pyload | module/plugins/crypter/BitshareComFolder.py | Python | gpl-3.0 | 522 | 0.011494 |
import json
from PySide import QtCore, QtGui
from ..fe import FE
from ..widget_factory import EditorFactory
from ..base_editor import BaseValueEditor
from ..core.value_controller import MemberController
class NestedEditor(BaseValueEditor):
def __init__(self, valueController, parent=None):
super(NestedEd... | goshow-jp/Kraken | Python/kraken/ui/HAppkit_Editors/editor_widgets/nested_editor.py | Python | bsd-3-clause | 3,053 | 0.005568 |
__author__ = 'nb254'
import numpy as np
import pandas as pd
from sklearn import cluster
from sklearn.cluster import KMeans
from sklearn.neighbors import NearestNeighbors
from sklearn.neighbors import kneighbors_graph
import ClusteringPrediction as cp
import ClusteringSaveResults as csr
import DataPreprocessing as dp
... | Nik0l/UTemPro | ML/Clustering.py | Python | mit | 10,761 | 0.008642 |
#!/usr/bin/env python
# coding=utf-8
import sys
from flask import Flask, request, jsonify
import simplejson as json
import handlers
app = Flask(__name__)
api_list = {
'api/dns': u'get dns',
'api/update': u'update domain information',
}
@app.route("/", methods = ['GET', 'POST'])
def index():
retur... | inter-rpm/dns-interface | main.py | Python | gpl-3.0 | 650 | 0.009231 |
# Copyright 2013, Red Hat, 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 agr... | leilihh/nova | nova/scheduler/rpcapi.py | Python | apache-2.0 | 5,246 | 0.000953 |
# coding=utf-8
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from tests import IntegrationTestCase
from tests.holodeck import Request
from twilio.base.exceptions import TwilioException
from twilio.http.response import Response
class ConnectAppTestCase(Integr... | tysonholub/twilio-python | tests/integration/api/v2010/account/test_connect_app.py | Python | mit | 7,437 | 0.003765 |
##
# Copyright 2009-2015 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://vscentrum.be/nl/en),
# the Hercules foundation (htt... | ULHPC/modules | easybuild/easybuild-easyblocks/easybuild/easyblocks/w/wps.py | Python | mit | 14,921 | 0.003418 |
#!/usr/bin/python
import probe_config as conf
import socket
import re
import os
import tempfile
import shutil
class Swift:
def __init__(self, myname, is_storage):
self.myname = myname
print "Myname = " + self.myname
self.allnodes = conf.swift_nodes
print "all nodes=" + str(self.allnodes)
self.all_ips = [so... | SimbaService/Simba | server/scripts/probe/swift.py | Python | apache-2.0 | 8,605 | 0.023707 |
# Authors:
# Jan Cholasta <jcholast@redhat.com>
#
# Copyright (C) 2014 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 v... | realsobek/freeipa | ipalib/install/certstore.py | Python | gpl-3.0 | 15,409 | 0.00013 |
# 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.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | Stavitsky/python-neutronclient | neutronclient/neutron/v2_0/subnet.py | Python | apache-2.0 | 9,395 | 0 |
'''
Authentication by token for the serverland dashboard Web API.
Project: MT Server Land prototype code
Author: Will Roberts <William.Roberts@dfki.de>
'''
from piston.utils import rc, translate_mime, MimerDataException
from serverland.dashboard.api.models import AuthToken
from django.core.exceptions import Multiple... | NickRuiz/mt-serverland | dashboard/api/authentication.py | Python | bsd-3-clause | 1,948 | 0.002567 |
# -*- coding: utf-8 -*-
"""OSF mailing utilities.
Email templates go in website/templates/emails
Templates must end in ``.txt.mako`` for plaintext emails or``.html.mako`` for html emails.
You can then create a `Mail` object given the basename of the template and
the email subject. ::
CONFIRM_EMAIL = Mail(tpl_pre... | wearpants/osf.io | website/mails/mails.py | Python | apache-2.0 | 9,943 | 0.002715 |
# -*- coding: utf-8 -*-
"""
@file
@brief image et synthèse
"""
from .image_synthese_facette import Rectangle
from .image_synthese_base import Rayon, Couleur
from .image_synthese_sphere import Sphere
class RectangleImage(Rectangle):
"""définit un rectangle contenant un portrait"""
def __init__(self, a, b, c,... | sdpython/ensae_teaching_cs | src/ensae_teaching_cs/special/image/image_synthese_facette_image.py | Python | mit | 2,656 | 0 |
# Copyright (c) 2018-2021 Micro Focus or one of its affiliates.
# Copyright (c) 2018 Uber Technologies, 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/licen... | uber/vertica-python | vertica_python/vertica/messages/backend_messages/parameter_status.py | Python | apache-2.0 | 3,051 | 0.000983 |
# -*- coding: UTF-8 -*-
from xmpp import *
class OOB(PlugIn):
NS = "jabber:iq:oob"
def plugin(self,server):
server.Dispatcher.RegisterHandler('iq',self.OOBIqHandler,typ='set',ns="jabber:iq:oob",xmlns=NS_CLIENT)
server.Dispatcher.RegisterHandler('iq',self.OOBIqHandler,typ='result',ns="jabber:iq... | exic/spade2 | xmppd/modules/oob.py | Python | lgpl-2.1 | 818 | 0.031785 |
'''
Copyright (C) 2016-2019 Vanessa Sochat.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
This program is distribute... | vsoch/singularity-python | singularity/analysis/reproduce/utils.py | Python | agpl-3.0 | 6,015 | 0.002161 |
# Twisted, the Framework of Your Internet
# Copyright (C) 2001 Matthew W. Lefkowitz
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of version 2.1 of the GNU Lesser General Public
# License as published by the Free Software Foundation.
#
# This library is distributed in th... | fxia22/ASM_xf | PythonD/site_python/twisted/test/test_http.py | Python | gpl-2.0 | 11,674 | 0.002227 |
# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function
import warnings
from pyasn1.codec.der import decoder, encoder
f... | hipnusleo/laserjet | resource/pypi/cryptography-1.7.1/src/cryptography/hazmat/primitives/asymmetric/utils.py | Python | apache-2.0 | 2,460 | 0 |
#!/usr/bin/env python
"""
Static Analyzer qualification infrastructure: adding a new project to
the Repository Directory.
Add a new project for testing: build it and add to the Project Map file.
Assumes it's being run from the Repository Directory.
The project directory should be added inside the Repository D... | Bootz/multicore-opimization | llvm/tools/clang/utils/analyzer/SATestAdd.py | Python | gpl-3.0 | 2,950 | 0.008136 |
# Copyright 2020 The Cirq Developers
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | quantumlib/Cirq | cirq-google/cirq_google/ops/physical_z_tag_test.py | Python | apache-2.0 | 1,084 | 0.000923 |
survey_data_decoupled.groupby(survey_data_decoupled["eventDate"].dt.year).size().plot(kind='barh', color="#00007f", figsize=(10, 10)) | jorisvandenbossche/DS-python-data-analysis | notebooks/_solutions/case2_biodiversity_processing11.py | Python | bsd-3-clause | 133 | 0.015038 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# no... | Havate/havate-openstack | proto-build/gui/horizon/Horizon_GUI/openstack_dashboard/dashboards/admin/info/views.py | Python | apache-2.0 | 1,045 | 0 |
from unittest import TestCase
from .mixin.spider_cache import SpiderCacheMixin
class BasicSpiderTestCase(TestCase, SpiderCacheMixin):
def setUp(self):
SpiderCacheMixin.setUp(self)
def setup_cache(self, bot):
bot.setup_cache(backend='mysql', database='spider_test',
use... | alihalabyah/grab | test/spider_mysql_cache.py | Python | mit | 346 | 0 |
import synkhronos as synk
import numpy as np
import theano
synk.fork()
s = theano.shared(np.ones([5, 5], dtype='float32'), name="shared_var")
s2 = theano.shared(np.ones([4, 4], dtype='float32'), name="shared_var_2")
f = synk.function([], [s.dot(s), s2.dot(s2)])
synk.distribute()
# print(f())
# print(synk.get_va... | astooke/synkhronos | tests/get_set_value_lengths.py | Python | mit | 578 | 0 |
""" Loads hyperspy as a regular python library, creates a spectrum with random numbers and plots it to a file"""
import hyperspy.api as hs
import numpy as np
import matplotlib.pyplot as plt
s = hs.signals.Spectrum(np.random.rand(1024))
s.plot()
plt.savefig("testSpectrum.png")
| to266/hyperspy | examples/hyperspy_as_library/minimal_example.py | Python | gpl-3.0 | 280 | 0.003571 |
class ServiceUnavailable(Exception):
pass
class UnknownNode(Exception):
pass
class UnknownService(Exception):
pass
class ResourceException(Exception):
def __init__(self, error_message):
self.error_message = error_message
def __str__(self):
return self.__repr__()
def __repr_... | Lothiraldan/ZeroServices | zeroservices/exceptions.py | Python | mit | 434 | 0.009217 |
# Author: Immanuel Bayer
# License: BSD 3 clause
import ffm
import numpy as np
from .base import FactorizationMachine
from sklearn.utils.testing import assert_array_equal
from .validation import check_array, assert_all_finite
class FMRecommender(FactorizationMachine):
""" Factorization Machine Recommender with ... | ibayer/fastFM-fork | fastFM/bpr.py | Python | bsd-3-clause | 2,859 | 0 |
#!/usr/bin/env python
#
# Copyright (C) 2007 Sascha Peilicke <sasch.pe@gmx.de>
#
# 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) any later ... | saschpe/gnome_picross | gnomepicross/game.py | Python | gpl-2.0 | 5,836 | 0.035127 |
#!/usr/bin/python
# coding: utf-8 -*-
# (c) 2017, Wayne Witzel III <wayne@riotousliving.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1... | valentin-krasontovitsch/ansible | lib/ansible/modules/web_infrastructure/ansible_tower/tower_job_template.py | Python | gpl-3.0 | 10,716 | 0.001027 |
from FirmsLocations.Computers.precomputers import PrecomputerCollection
from FirmsLocations.Computers.computers import Directmodel, LocationOnlyModel,\
LocationGeneralModel
## Pathpameters
# Set path parameters
execfile('set_pathparameters.py')
# Set precomputation parameters
execfile('set_precomputationparamete... | tgquintela/Mscthesis | script_computation.py | Python | mit | 836 | 0.008373 |
"""Leetcode 695. Max Area of Island
Medium
URL: https://leetcode.com/problems/max-area-of-island/
Given a non-empty 2D array grid of 0's and 1's, an island is a group of 1's
(representing land) connected 4-directionally (horizontal or vertical.)
You may assume all four edges of the grid are surrounded by water.
Find... | bowen0701/algorithms_data_structures | lc0695_max_area_of_island.py | Python | bsd-2-clause | 4,625 | 0.045622 |
# Copyright (C) 2014 ABRT Team
# Copyright (C) 2014 Red Hat, Inc.
#
# This file is part of faf.
#
# faf is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) ... | abrt/faf | src/pyfaf/actions/addcompathashes.py | Python | gpl-3.0 | 5,960 | 0.001174 |
from django.test import TestCase
from api.models import UsernameSnippet
class TestUsernameSnippet(TestCase):
@classmethod
def setUpTestData(cls):
UsernameSnippet.objects.create(available=True)
def test_existence(self):
u = UsernameSnippet.objects.first()
self.assertIsInstance(u, UsernameSnippet)
self.ass... | jeremyphilemon/uniqna | api/tests/test_models.py | Python | bsd-3-clause | 459 | 0.021786 |
#!python
__author__ = "Curtis L. Olson < curtolson {at} flightgear {dot} org >"
__url__ = "http://gallinazo.flightgear.org"
__version__ = "1.0"
__license__ = "GPL v2"
import fileinput
import math
import string
from . import spline
import Polygon
import Polygon.Shapes
import Polygon.Utils
class Cutpos:
def __in... | clolsonus/madesigner | madesigner/madlib/contour.py | Python | gpl-3.0 | 28,367 | 0.007791 |
"""
Problem 44
Pentagonal numbers are generated by the formula, Pn = n*(3n−1)/2. The first ten pentagonal numbers are:
1, 5, 12, 22, 35, 51, 70, 92, 117, 145, ...
It can be seen that P4 + P7 = 22 + 70 = 92 = P8. However, their difference, 70 − 22 = 48, is not pentagonal.
Find the pair of pentagonal numbers, Pj and ... | Tony-Tsoi/proj-euler-ans | problems/prob044.py | Python | mit | 1,103 | 0.012762 |
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import os.path
from collections.abc import Mapping
from typing import Dict
from pants.base.exceptions import ResolveError
from pants.base.project_tree import Dir
from pants.base.specs imp... | wisechengyi/pants | src/python/pants/engine/build_files.py | Python | apache-2.0 | 12,398 | 0.003388 |
from django.contrib.gis.geos.base import GEOSBase
from django.contrib.gis.geos.geometry import GEOSGeometry
from django.contrib.gis.geos.prototypes import prepared as capi
class PreparedGeometry(GEOSBase):
"""
A geometry that is prepared for performing certain operations.
At the moment this includes the c... | rogerhu/django | django/contrib/gis/geos/prepared.py | Python | bsd-3-clause | 1,034 | 0 |
__version__="0.12.5"
| nzsquirrell/p2pool-myriad | oldstuff/SOAPpy/version.py | Python | gpl-3.0 | 22 | 0.090909 |
import os
import shutil
import boto
from boto.s3.key import Key
import subprocess
from io import StringIO
from django.core.management.base import BaseCommand
from django.core.management import call_command
from django.conf import settings
from django.utils import timezone
from django.core.mail import send_mail
from c... | BirkbeckCTP/janeway | src/utils/management/commands/backup.py | Python | agpl-3.0 | 5,466 | 0.002012 |
# -*- coding:utf-8 -*-
import os
site_title = 'plum.J'
site_description = '\'s blog'
site_url = 'http://plumj.com'
static_url = 'static'
theme_name = 'sealscript'
google_analytics = ''
catsup_path = os.path.dirname(__file__)
posts_path = os.path.join(catsup_path, '_posts')
theme_path = os.path.join(catsup_path, 'the... | plumJ/catsup | config.py | Python | mit | 1,211 | 0.012386 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | lmazuel/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/application_gateway_ssl_predefined_policy.py | Python | mit | 1,826 | 0.000548 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (C) 2009-2012:
# Gabes Jean, naparuba@gmail.com
# Gerhard Lausser, Gerhard.Lausser@consol.de
# Gregory Starck, g.starck@gmail.com
# Hartmut Goebel, h.goebel@goebel-consult.de
#
# This file is part of Shinken.
#
# Shinken is free software: you can redis... | wbsavage/shinken | shinken/misc/datamanagerhostd.py | Python | agpl-3.0 | 5,441 | 0.000919 |
#!/usr/bin/env python3
import sys
import datetime
import re
CHANGELOG_FORMAT = """
{version} ({date})
----------------------
{description}
"""
TIXURL = "https://github.com/hsoft/moneyguru/issues/{}"
def tixgen(tixurl):
"""This is a filter *generator*. tixurl is a url pattern for the tix with a {0} placeholder
... | brownnrl/moneyguru | support/genchangelog.py | Python | gpl-3.0 | 2,089 | 0.005744 |
# Copyright 2012 New Dream Network, LLC (DreamHost)
#
# 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 a... | Juniper/neutron | neutron/db/migration/cli.py | Python | apache-2.0 | 4,441 | 0.000225 |
# Copyright 2020 Google
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, soft... | quantumlib/ReCirq | recirq/quantum_chess/bit_utils.py | Python | apache-2.0 | 2,765 | 0 |
#!/usr/bin/python
import json
import os
import sys
if not os.access("data.json", os.F_OK):
print("Please run aggregate.py first")
sys.exit(1)
data = json.load(open("data.json", "r"))
print("Results for 1 connection")
print("{:<20s} {:>8s} | {:>7s} | {:>5s} | {:>5s} | {:>5s} | {:>5s}".format("name",
... | bigfootproject/OSMEF | data_processing/overview.py | Python | apache-2.0 | 3,112 | 0.010604 |
#!/usr/bin/env python
"""
fig2dev-ext.py
Python script for running fig2dev in Inkscape extensions
Copyright (C) 2008 Stephen Silver
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 ... | piksels-and-lines-orchestra/inkscape | share/extensions/fig2dev-ext.py | Python | gpl-2.0 | 1,025 | 0.001951 |
from .tensor import *
from .math import *
| cypherai/PySyft | syft/__init__.py | Python | apache-2.0 | 42 | 0 |
#!/usr/bin/env python
import os
import sys
import time
import yaml
import urllib
import hashlib
import argparse
required_keys = ['caffemodel', 'caffemodel_url', 'sha1']
def reporthook(count, block_size, total_size):
"""
From http://blog.moleculea.com/2012/10/04/urlretrieve-progres-indicator/
"""
glob... | wangg12/caffe | scripts/download_model_binary.py | Python | bsd-2-clause | 2,496 | 0.000401 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
#
# Author : RobertDing
# E-mail : robertdingx@gmail.com
# Date : 15/08/29 02:24:28
# Desc : fetch video
#
from __future__ import absolute_import, division, with_statement
| robertding/vo | vo/dl/__init__.py | Python | mit | 242 | 0.004132 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.