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 |
|---|---|---|---|---|---|
#!/usr/bin/env python
# -*- coding: utf8 -*-
# *****************************************************************
# ** PTS -- Python Toolkit for working with SKIRT **
# ** © Astronomical Observatory, Ghent University **
# *****************************************************************
##... | SKIRT/PTS | modeling/build/models/general.py | Python | agpl-3.0 | 13,577 |
# File Transfer model #3
#
# In which the client requests each chunk individually, using
# command pipelining to give us a credit-based flow control.
import os
from threading import Thread
import zmq
from zhelpers import socket_set_hwm, zpipe
CHUNK_SIZE = 250000
def client_thread(ctx, pipe):
dealer = ctx.socke... | soscpd/bee | root/tests/zguide/examples/Python/fileio3.py | Python | mit | 2,555 |
import sys
import numpy as np
from itertools import izip
SIGNALMATFILENAME = sys.argv[1]
MATERNALFASTAFILENAMELISTFILENAME = sys.argv[2]
PATERNALFASTAFILENAMELISTFILENAME = sys.argv[3]
OUTPUTSEQUENCESMATFILENAMEPREFIX = sys.argv[4] # Should not end with .
OUTPUTSEQUENCESPATFILENAMEPREFIX = sys.argv[5] # Should not end... | imk1/IMKTFBindingCode | getFastasWithSNPsUnique.py | Python | mit | 7,112 |
import base64
from subprocess import call
template = '{"kind":"node","version":"v2","metadata":{"name":"%s","labels":{"group":"gravitational/devc"}},"spec":{"addr":"%s","hostname":"%s","cmd_labels":{"kernel":{"period":"5m0s","command":["/bin/uname","-r"],"result":"4.15.0-32-generic"}},"rotation":{"current_id":"","star... | yacloud-io/teleport | examples/etcd/gen.py | Python | apache-2.0 | 778 |
from http.server import BaseHTTPRequestHandler,HTTPServer
import json
import numpy as np
from train import trainer
from utils import *
class RequestHandler(BaseHTTPRequestHandler):
def __init__(self,req,client,server):
BaseHTTPRequestHandler.__init__(self,req,client,server)
def log_message(self,... | lenLRX/Dota2_DPPO_bots | GameServer.py | Python | mit | 3,946 |
#!/usr/bin/python
"""
Copyright 2015 The Trustees of Princeton University
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 r... | iychoi/syndicate | python/syndicate/util/gateway.py | Python | apache-2.0 | 13,857 |
from __future__ import absolute_import
import pytest
import six
from sentry.runner.importer import ConfigurationError
from sentry.runner.initializer import bootstrap_options, apply_legacy_settings
@pytest.fixture
def settings():
class Settings(object):
pass
s = Settings()
s.TIME_ZONE = 'UTC'
... | alexm92/sentry | tests/sentry/runner/test_initializer.py | Python | bsd-3-clause | 7,162 |
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
import pybindgen.settings
import warnings
class ErrorHandler(pybindgen.settings.ErrorHandler):
def handle_error(self, wrapper, exception, traceback_):
warnings.warn("exception %r in wrapper %s" % (exception, wrapper))
... | Enchufa2/ns-3-dev-git | src/wimax/bindings/modulegen__gcc_LP64.py | Python | gpl-2.0 | 773,543 |
#!/usr/bin/python
from commonlib import FullNode
from hashlib import sha256
req = sha256('secretnr2').digest().encode('hex')
req2 = sha256('secretnr10').digest().encode('hex')
s = FullNode('a'*32, ('0.0.0.0', 30001))
s.p2pnodeinstance.public_reach(('127.0.0.1'),30001)
s.p2pnodeinstance.store_data('secretnr3')
s.p2p... | thestick613/secure-p2p-kv-store | test1.py | Python | gpl-3.0 | 510 |
#!/bin/env python
# Automatically translated python version of
# OpenSceneGraph example program "osgposter"
# !!! This program will need manual tuning before it will work. !!!
import sys
from osgpypp import osg
from osgpypp import osgDB
from osgpypp import osgGA
from osgpypp import osgUtil
from osgpypp import osgVi... | JaneliaSciComp/osgpyplusplus | examples/rough_translated1/osgposter.py | Python | bsd-3-clause | 33,474 |
import json
import sys
import datetime
from utils import clean_text
lang = sys.argv[1]
lang_git = sys.argv[2]
timestamp = '{:%Y-%m-%d %H:%M:%S %Z}'.format(datetime.datetime.now())
header="""---
layout: default
title: %s packages
---
%s: [trendy](#trendy) and [latest](#latest) repositories - updated %s
""" % (lang, ... | matteoredaelli/programming-languages-packages | build-package-html-page.py | Python | gpl-3.0 | 1,762 |
"""UptimeRobot binary_sensor platform."""
from __future__ import annotations
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_CONNECTIVITY,
BinarySensorEntity,
BinarySensorEntityDescription,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant... | aronsky/home-assistant | homeassistant/components/uptimerobot/binary_sensor.py | Python | apache-2.0 | 1,463 |
# -*- coding: utf-8 -*-
###############################################################################
#
# DeleteActivity
# Removes an individual strength training activity from a user’s feed.
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2014, Temboo Inc.
#
# Licensed under the Apache License, Version 2.0 (the "Li... | willprice/arduino-sphere-project | scripts/example_direction_finder/temboo/Library/RunKeeper/StrengthTrainingActivities/DeleteActivity.py | Python | gpl-2.0 | 3,469 |
#!/usr/bin/env python
"""
Copyright (c) 2014-2022 Maltrail developers (https://github.com/stamparm/maltrail/)
See the file 'LICENSE' for copying permission
"""
from __future__ import print_function
import codecs
import csv
import glob
import inspect
import os
import re
import sqlite3
import sys
import time
sys.dont_... | stamparm/maltrail | core/update.py | Python | mit | 19,284 |
#!/usr/bin/env python3
# Copyright (c) 2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the bumpfee RPC.
Verifies that the bumpfee RPC creates replacement transactions successfully when
its ... | Jcing95/iop-hd | test/functional/bumpfee.py | Python | mit | 13,445 |
import attr
from typing import ClassVar
@attr.s(auto_attribs=True)
class A1:
bar1: int
<error descr="Fields with a default value must come after any fields without a default.">baz1</error>: int = 1
foo1: int
<error descr="Fields with a default value must come after any fields without a default.">bar2<... | goodwinnk/intellij-community | python/testData/inspections/PyDataclassInspection/attrsFieldsOrder.py | Python | apache-2.0 | 1,439 |
"""
Last Edited By: Kevin Flathers
Date Las Edited: 06/07/2017
Author: Kevin Flathers
Date Created: 05/27/2017
Purpose:
"""
from .Tgml import *
class ConvertValue(Tgml):
DEFAULT_PROPERTIES = {}
SUPPORTED_CHILDREN = {}
def __init__(self, *args, input_type='blank', **kwargs):
super().__init__(*args, input_typ... | flatherskevin/TGML | ConvertValue.py | Python | mit | 713 |
from tornado import web,ioloop
from pymongo import *
import os
class joinHandler(web.RequestHandler):
def get(self):
self.set_header("Access-Control-Allow-Origin", "*")
self.set_header("Access-Control-Allow-Headers", "x-requested-with")
self.set_header('Access-Control-Allow-Methods', 'POST, GET, OPTIONS')
cl... | ezamlee/live-chat | handlers/joinHandler.py | Python | gpl-3.0 | 1,116 |
# -*- coding: utf-8 -*-
#
# Picard, the next-generation MusicBrainz tagger
# Copyright (C) 2007 Lukáš Lalinský
#
# 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... | kepstin/picard | picard/mbxml.py | Python | gpl-2.0 | 13,296 |
# -*- coding: utf-8 -*-
"""Collection of fixtures for simplified work with blockers.
You can use the :py:func:`blocker` fixture to retrieve any blocker
using blocker syntax (as described in :py:mod:`cfme.metaplugins.blockers`).
The :py:func:`bug` fixture is specific for bugzilla,
it accepts number argument and spits o... | jkandasa/integration_tests | fixtures/blockers.py | Python | gpl-2.0 | 3,804 |
import numpy as np
from numpy import linalg
from scipy.sparse import dok_matrix, csr_matrix, issparse
from scipy.spatial.distance import cosine, cityblock, minkowski, wminkowski
from sklearn.utils.testing import assert_greater
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing impo... | toastedcornflakes/scikit-learn | sklearn/metrics/tests/test_pairwise.py | Python | bsd-3-clause | 26,200 |
#!/usr/bin/env python
import sys, os, time, atexit
from signal import SIGTERM
class Daemon:
"""
A generic daemon class.
Usage: subclass the Daemon class and override the run() method
"""
def __init__(self, pidfile, stdin='/dev/null', stdout='/dev/null', stderr='/dev/null'):
self.stdi... | badbytes/pymeg | daemon/daemon.py | Python | gpl-3.0 | 3,997 |
# coding=utf-8
"""InaSAFE Disaster risk tool by Australian Aid - Flood Polygon on Roads
Impact Function.
Contact : ole.moller.nielsen@gmail.com
.. note:: 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 Softwar... | cchristelis/inasafe | safe/impact_functions/inundation/flood_polygon_roads/impact_function.py | Python | gpl-3.0 | 9,755 |
<<<<<<< HEAD
<<<<<<< HEAD
from tkinter import *
from idlelib.EditorWindow import EditorWindow
import re
import tkinter.messagebox as tkMessageBox
from idlelib import IOBinding
class OutputWindow(EditorWindow):
"""An editor window that can serve as an output file.
Also the future base class for the Python she... | ArcherSys/ArcherSys | Lib/idlelib/OutputWindow.py | Python | mit | 13,322 |
from django import forms
from django.test.utils import override_settings
from django_webtest import WebTest
from material import Layout, Row, Column
from . import build_test_urls
class LayoutForm(forms.Form):
test_field1 = forms.CharField()
test_field2 = forms.CharField()
test_field3 = forms.CharField()
... | 2947721120/django-material | tests/test_base_layout.py | Python | bsd-3-clause | 1,031 |
import pandas
import numpy
# Read the data
data = pandas.read_csv('data.csv')
# Split the data into X and y
X = numpy.array(data[['x1', 'x2']])
y = numpy.array(data['y'])
# import statements for the classification algorithms
from sklearn.linear_model import LogisticRegression
from sklearn.tree import DecisionTreeCla... | hetaodie/hetaodie.github.io | assets/media/uda-ml/code/sklearn/quiz.py | Python | mit | 665 |
# Copyright (c) 2013 Mirantis, 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... | ativelkov/murano-api | murano/db/services/environments.py | Python | apache-2.0 | 7,639 |
# bokeh_lineid_plot.py
#
# Copyright (C) 2015 - Julio Campagnolo <juliocampagnolo@gmail.com>
#
# 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 opti... | juliotux/bokeh_lineid_plot | bokeh_lineid_plot.py | Python | gpl-3.0 | 8,642 |
# pylint: disable=wrong-or-nonexistent-copyright-notice
"""Demonstrates Shor's algorithm.
Shor's algorithm [1] is a quantum algorithm for integer factorization. Given
a composite integer n, it finds its non-trivial factor d, i.e. a factor other
than 1 or n.
The algorithm consists of two parts: quantum order-finding s... | quantumlib/Cirq | examples/shor.py | Python | apache-2.0 | 13,340 |
#!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import absolute_import, division, print_function, unicode_literals
import re
import readline
import ... | facebook/redex | tools/redex-tool/DexSqlQuery.py | Python | mit | 5,468 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | resmo/cloudstack | test/integration/plugins/nuagevsp/test_nuage_vpc_internal_lb.py | Python | apache-2.0 | 123,514 |
from django.contrib import admin
# Register your models here.
from .models import Roles
@admin.register(Roles)
class RolesAdmin(admin.ModelAdmin):
list_display = ('group', 'description', 'color', 'internal')
| inteos/IBAdmin | roles/admin.py | Python | agpl-3.0 | 215 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
HTTP-Client通道类
通过调用管理类对象的process_data函数实现信息的发送。
"""
import logging
from libs.base_channel import BaseChannel
logger = logging.getLogger('linkworld')
class HttpClientChannel(BaseChannel):
def __init__(self, network, channel_name, channel_protocol, channel_params... | lianwutech/plugin_linkworld-discard- | channels/http_client.py | Python | apache-2.0 | 723 |
# Copyright 2008 German Aerospace Center (DLR)
#
# 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 agre... | DLR-SC/RepoGuard | src/repoguard/checks/unittests.py | Python | apache-2.0 | 2,532 |
# -*- coding: UTF-8 -*-
import logging
import json
logger = logging.getLogger("enviosms")
class MessageSMS(object):
def __init__(self, recipient=None, content=None, json_str=None):
if json_str:
data = json.loads(json_str)
self._recipient = data["recipient"]
self._conten... | cetres/enviosms | enviosms/message.py | Python | gpl-2.0 | 879 |
#!/usr/bin/env python3
from octopus.plugins.plugin import OctopusPlugin
from octopus.server.orientdb.orientdb_plugin_executor import OrientDBPluginExecutor
class DummyPlugin(OctopusPlugin):
def __init__(self, executor):
super().__init__(executor)
self._pluginname = 'dummy.jar'
self._clas... | octopus-platform/joern | projects/plugins/dummy/execute_dummy.py | Python | lgpl-3.0 | 851 |
#
# bignum.py
#
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# from __future__ import absolute_import, division, print_function, unicode_literals
import struct
import binascii
# from app.block.utils.typeutil import num... | JKingdom/KingCoin | app/base/bignum.py | Python | gpl-3.0 | 10,858 |
"""
.. module:: layer
:platform: Windows
:synopsis: Base Class from which AGOL function inherit from.
.. moduleauthor:: test
"""
import common
import filters
import featureservice
from base import BaseAGOLClass
import os
import json
import math
import urlparse
import mimetypes
import uuid
##################... | Esri/agol-helper | source/agol/layer.py | Python | apache-2.0 | 39,326 |
""" Web interface """
from .app import start_app
__all__ = ("start_app",)
| KarolBedkowski/webmon | webmon2/web/__init__.py | Python | gpl-2.0 | 77 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from setuptools import setup
from vargram_bot.version import VERSION
setup(
name = 'vargram-bot',
version = VERSION,
description = 'The official Telegram bot for the LinuxVar LUG.',
url = 'https://github.com/imko92/vargram-bot',
author = 'Riccardo Mac... | imko92/vargram-bot | setup.py | Python | mit | 734 |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
"""
This module defines convenience types for type hinting purposes.
Type hinting is new to pymatgen, so this module is subject to
change until best practices are established.
"""
from pathlib import Path
from... | gmatteo/pymatgen | pymatgen/util/typing.py | Python | mit | 1,085 |
"""Handle URL format for defining filters."""
import re
def get_filters(args):
"""Extract the filters from the URL."""
filters = {}
for parameter, argument in args.items():
match = re.search(r'filters\[([0-9]+)\]\[([a-z]+)\]', parameter)
if match:
(index, field) = match.groups... | bheiskell/logolas | logolas/web/url.py | Python | mit | 470 |
#!/usr/bin/env python
#=========================================================================
#
# Copyright Insight Software Consortium
#
# 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
... | luisibanez/ITK-RSNA | Exercises/SimpleITK/Python/MedianImageFilter01.py | Python | apache-2.0 | 1,155 |
# -*- coding: utf8 -*-
from . import TestCase
from inxpect import expect
from inxpect import getters
class ListMethodTest(TestCase):
def setUp(self):
get_attr = getters.AttrByName('attribute')
class Expect(object):
attribute = expect.List(get_attr)
self.expect = Expect()
... | apieum/inxpect | inxpect/tests/testList.py | Python | lgpl-3.0 | 2,770 |
import json
import urllib.error
import urllib.parse
import urllib.request
def post_data_to_server(codespeed_url, data, dry_run=False, max_chunk=8, verbose=False):
for chunk in [data[i:(i+max_chunk)] for i in range(0, len(data), max_chunk)]:
json_data = {'json': json.dumps(chunk)}
url = '%sresult/... | FStarLang/FStar | .scripts/benchmarking/codespeed_upload.py | Python | apache-2.0 | 1,017 |
'''
Utility to help "tail" AWS logs stored in S3 generated by S3 bucket
logging or ELB logging.
'''
from builtins import object
import os
import sys
import signal
import errno
import logging
import re
import click
from boto import s3
from configstruct import ConfigStruct
from .s3tail import S3Tail
# TODO:
# * consi... | bradrf/s3tail | s3tail/cli.py | Python | mit | 4,273 |
#/usr/bin/env/python
# This is older working code , a new version has been uploaded
class node:
def __init__(self, size,center,parent):
self.parent = parent
self.size = size
self.value = []
self.center = center
self.children = [None for i in range(8)]
def findQuadrant(self,coord,center):
if coord[0] <=... | ResByte/HMM-occupancy_grid | newOc.py | Python | gpl-2.0 | 4,235 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('profiles', '0001_initial'),
('military', '0003_unitdependency'),
('arenas', '0007_auto_20150522_0203'),
]
operations ... | mc706/prog-strat-game | combat/migrations/0001_initial.py | Python | mit | 2,011 |
'''
Created on 27 Jan 2017
@author: ernesto
'''
import pandas as pd
class p3BAMQC:
"""
Class representing a spreadsheet located at ftp://ftp.1000genomes.ebi.ac.uk/vol1/ftp/technical/working/20130606_sample_info/
20130606_sample_info.xlsx containing information on the BAM QC done for the p3
"""
d... | igsr/igsr_analysis | p3/p3BAMQC.py | Python | apache-2.0 | 1,522 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2002-2006 Donald N. Allingham
#
# 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 you... | SNoiraud/gramps | gramps/gen/filters/rules/person/_isdefaultperson.py | Python | gpl-2.0 | 1,950 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('goals', '0018_auto_20150312_1518'),
]
operations = [
migrations.AddField(
model_name='behavioraction',
... | tndatacommons/tndata_backend | tndata_backend/goals/migrations/0019_auto_20150312_1553.py | Python | mit | 671 |
__author__ = 'sepulchered'
| botdept/chatbot | bot/__init__.py | Python | agpl-3.0 | 27 |
from __future__ import absolute_import
import os
import importlib
from ..Logger import *
from ..settings.Settings import *
class cmd_list(object):
@classmethod
def usage(self):
return {
'name': 'list',
'args': '',
'desc': 'Displays SDKS for selected Xcode Insta... | samdmarshall/SDKBuild | sdkbuild/commandparse/cmd_list.py | Python | bsd-3-clause | 913 |
def func(a1):
"""
Parameters:
a1 (:class:`MyClass`): used to call :def:`my_function` and access :attr:`my_attr`
Raises:
:class:`MyException`: thrown in case of any error
""" | asedunov/intellij-community | python/testData/docstrings/typeReferences.py | Python | apache-2.0 | 206 |
from __future__ import print_function
import os
def log(*items):
print(*items)
def log_error(*items):
print(*items, file=sys.stderr)
def run_command(command):
log('>', command)
return os.WEXITSTATUS(os.system(command))
| theojepsen/p4app | docker/scripts/p4app_util.py | Python | apache-2.0 | 239 |
# -*- coding: utf-8 -*-
"""
This is an example settings/local.py file.
These settings overrides what's in settings/base.py
"""
import logging
# To extend any settings from settings/base.py here's an example:
#from . import base
#INSTALLED_APPS = base.INSTALLED_APPS + ['debug_toolbar']
DATABASES = {
'default': {
... | codeboy/coddy-sitetools | sitetools/settings/local-temp.py | Python | bsd-3-clause | 2,041 |
# 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/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/models/_models_py3.py | Python | mit | 22,105 |
# -*- coding: UTF-8 -*-
#######################################################################
# ----------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (Revision 42):
# @Daddy_Blamo wrote this file. As long as you retain this notice you
# can do whatever you want wi... | RuiNascimento/krepo | script.module.lambdascrapers/lib/lambdascrapers/sources_ lambdascrapers/de/foxx.py | Python | gpl-2.0 | 8,359 |
# Copyright 2009 James P Goodwin ped tiny python editor
""" module to implement search for files and search for pattern in files used in the ped editor """
import curses
import curses.ascii
import sys
import os
import tempfile
from ped_dialog import dialog
from ped_core import editor_common
import re
import traceback
f... | jpfxgood/ped | ped_dialog/file_find.py | Python | mit | 7,426 |
import unittest, os, sys
sys.path.append(os.path.abspath('..'))
from bayeser import Bayeser
from sure import expect
class BayeserTest(unittest.TestCase):
spam_words = set(['justin bieber is so cool', 'russian hiphop is the best', 'viagra on sale now'])
ham_words = set(['african american performance artist', 'jazz... | UMNLibraries/hamster | tests/test_bayeser.py | Python | mit | 854 |
import urllib.request, urllib.parse, urllib.error
import oauth
import hidden
def augment(url, parameters) :
secrets = hidden.oauth()
consumer = oauth.OAuthConsumer(secrets['consumer_key'], secrets['consumer_secret'])
token = oauth.OAuthToken(secrets['token_key'],secrets['token_secret'])
oauth_request ... | mkhuthir/learnPython | Book_pythonlearn_com/twitter/twurl.py | Python | mit | 923 |
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | cloudera/hue | apps/beeswax/src/beeswax/design.py | Python | apache-2.0 | 10,010 |
import numpy as np
def mypolyval(p, x):
_p = list(p)
res = _p.pop(0)
while _p:
res = res * x + _p.pop(0)
return res
vpolyval = np.vectorize(mypolyval, excluded=['p'])
vpolyval(p=[1,2,3],x=[0,1]) | LingboTang/LearningFiles | integration_examples2.py | Python | apache-2.0 | 203 |
import json
import os
from mock import patch
from unittest import TestCase, skip, skipIf, main
from url import APP_ROOT, TEMPLATES_PATH, ERROR_BACKGROUND
from url import replace_underscore
from url import tokenize
from url import guess_meme_image
from url import parse_meme_url
from url import derive_meme_path
from url... | monu27mr/gret | tests.py | Python | mit | 5,511 |
"""
Configure the Flask application.
"""
from logging.config import dictConfig
from time import ctime
from flask import request
from redis import Redis
from cheddar import defaults
from cheddar.controllers import create_routes
from cheddar.errorhandlers import create_errorhandlers
from cheddar.history import History
... | jessemyers/cheddar | cheddar/configure.py | Python | apache-2.0 | 2,383 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright 2013 Kitware 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 cop... | data-exp-lab/girder | test/test_webroot.py | Python | apache-2.0 | 3,979 |
#!/usr/bin/python
# coding=utf-8
# Select address and channel of PCA9571 I2C general purpose outputs
# I2C Address: 0x25 Fixed
# sudo ./gpo_active.py CHANNEL
# Example: sudo ./gpo_active.py 25 255 1 #all relays activates
import time
import argparse
import subprocess
import RPi.GPIO as GPIO
import smbus
def I2C_set... | lejubila/piGarden | drv/spb16ch/scripts/rele_1_16_active.py | Python | gpl-2.0 | 3,117 |
from django.utils.translation import ugettext_noop
from django.utils.translation import ugettext as _
from corehq.apps.reports.standard import CustomProjectReport
from corehq.apps.reports.generic import GenericTabularReport
from corehq.apps.reports.datatables import DataTablesColumn, DataTablesHeader
from casexml.apps.... | SEL-Columbia/commcare-hq | custom/_legacy/a5288/reports.py | Python | bsd-3-clause | 5,576 |
class A:
def method(self):
print('This method belongs to class A')
class B(A):
def method(self):
print('This method belongs to class B')
class C(A):
def method(self):
print('This method belongs to class C')
#pass
class D(C,B):
pass
d = D()
d.method() | cyberlearner13/techshots13 | OOOPython/diamond.py | Python | gpl-2.0 | 302 |
# -*- coding: utf-8 -*-
import requests
import datetime
import os
from voices import find_voice
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
class AccessError(Exception):
def __init__(self, response):
self.status_code = response.status_code
data = response.json()
error_msg = ""
... | newfies-dialer/python-msspeak | msspeak/msspeak.py | Python | mit | 6,354 |
# -*- coding: utf-8 -*-
import newrelic.agent
from django.http import HttpResponseBadRequest, JsonResponse
from django.shortcuts import render
from django.utils.translation import ugettext_lazy as _
from django.views.decorators.http import require_GET
from kuma.core.decorators import block_user_agents
from ..constant... | ollie314/kuma | kuma/wiki/views/misc.py | Python | mpl-2.0 | 2,763 |
from xml.etree import ElementTree as ET
def om(tag):
return "{http://omeka.org/schemas/omeka-xml/v5}" + tag
class Parser(object):
def __init__(self):
self._parse_item = ItemParser()
def read(self, text):
doc = ET.fromstring(text)
for item in doc.findall(om("item")):
itemid, pkt = self._pars... | BL-Labs/jokedbapp | jokedbapp/parse_omeka.py | Python | mit | 395 |
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
import parted
# Basic support for command line history. fdisk(1) doesn't do this,
# so we are even better!
import readline
import sys
class ExitMainLoop(Exception):
"""Exception that signals the job is done"""
pass
class UnknownCommand(Exception):
"""E... | vsinitsyn/fdisk.py | fdisk.py | Python | unlicense | 15,691 |
import logging
import os
import subprocess
from requests.exceptions import HTTPError
from git.exc import NoSuchPathError
from assigner.roster_util import get_filtered_roster
from assigner.backends import RepoError
from assigner.backends.decorators import requires_config_and_backend
from assigner import progress
help... | tymorrow/assigner | assigner/commands/commit.py | Python | mit | 5,551 |
import os
import glob
import pyfits
import numpy as np
arcperpix = 3. * 60.
bands = ['I1', 'I2', 'I3', 'I4', 'M1', 'S3', 'S4']
n_groups = 8
nx = 5
ny = 7
def rms(values):
return np.mean(values ** 2)
variance = {}
for model in glob.glob('models/basic/images_total_*_conv.fits'):
variance[model] = {}
... | hyperion-rt/paper-galaxy-rt-model | scripts/fit_profiles.py | Python | bsd-2-clause | 2,724 |
# #
# Copyright 2012-2014 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 (ht... | mesocentrefc/easybuild-framework | test/framework/run.py | Python | gpl-2.0 | 4,976 |
"""Gaussian process experiments."""
| kastnerkyle/gp2 | gp2/__init__.py | Python | bsd-3-clause | 36 |
#!/usr/bin/env python3
from os import mkdir, listdir
from os.path import isdir, isfile
#import time
import datetime
import numpy as np
from matplotlib import pyplot as plt
from scipy.optimize import brute, least_squares
import h5py
from LoLIM.utilities import processed_data_dir, v_air, antName_is_even, BoundingBox... | Bhare8972/LOFAR-LIM | LIM_scripts/iterativeMapper/iterative_mapper.py | Python | mit | 43,912 |
# -*- encoding: utf-8 -*-
from abjad import *
def test_mathtools_all_are_numbers_01():
r'''Is true when all elements in sequence are numbers.
'''
assert mathtools.all_are_numbers([1, 2, 5.5, Fraction(8, 3)])
def test_mathtools_all_are_numbers_02():
r'''True on empty sequence.
'''
assert ma... | mscuthbert/abjad | abjad/tools/mathtools/test/test_mathtools_all_are_numbers.py | Python | gpl-3.0 | 628 |
#!/usr/bin/python
from generator.actions import Actions
import random
import re
import subprocess
import sys
from struct import pack
from math import sin
# length of a dot in ms
dot_len_ms = 5
# num of PCM samples in a dot
samples_per_dot = int(44100*(dot_len_ms/1000.0))
# frequency of tones in Hz
freq = 440
# langua... | f0rki/cb-multios | original-challenges/PCM_Message_decoder/poller/for-testing/machine.py | Python | mit | 3,976 |
version = '1.0'
from utils import load, dump
from os.path import exists
from sklearn.lda import LDA
from knn-correlation import KNNC1
import numpy as np
from sklearn.metrix import confusion_matrix
_known_classifiers = { 'LDA': LDA,
'KNN-correlation': KNNC1,
}
def classify(Subject, classifier, mode, mask, mask_n... | maat25/brain-decoding | classifier/classify.py | Python | mit | 1,607 |
test = {
'name': 'Question',
'points': 1,
'suites': [
{
'cases': [
{
'code': r"""
>>> # It looks like you're not making an array. You shouldn't need to
>>> # use .item anywhere in your solution.
>>> import numpy as np
>>> type(total_charges) == ... | jamesfolberth/jupyterhub_AWS_deployment | notebooks/data8_notebooks/lab02/tests/q432.py | Python | bsd-3-clause | 853 |
'''Build an admin interface for pages and page-related things
'''
import functools
import urlparse
from django import http
from django.conf import settings
try:
from django.conf.urls import defaults as urls
except:
from django.conf import urls
from django.contrib import admin
from django.core import exceptions... | GrAndSE/django-pages | pages/admin.py | Python | bsd-3-clause | 16,940 |
# Copyright (c) 2008 Nokia Corporation
#
# 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... | pymo/pymo | symbian/PythonForS60_1.9.6/templates/calendar.py | Python | mit | 611 |
#!/usr/bin/env python
"Load data, train a random forest, output predictions"
import pandas as pd
from sklearn.ensemble import RandomForestClassifier as RF
train_file = 'data/orig/numerai_training_data.csv'
test_file = 'data/orig/numerai_tournament_data.csv'
output_file = 'data/predictions.csv'
#
train = pd.read_cs... | zygmuntz/numer.ai | predict.py | Python | bsd-3-clause | 1,277 |
# -*- coding: utf-8 -*-
# Copyright: (c) 2021, Ansible Project
# 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
import pytest
from ansible.module_utils._text import to_native
from ansibl... | ansible/ansible | test/units/module_utils/common/validation/test_check_required_by.py | Python | gpl-3.0 | 2,642 |
'''
Pango text provider
===================
.. versionadded:: 1.11.0
.. warning::
The low-level Pango API is experimental, and subject to change without
notice for as long as this warning is present.
Installation
------------
1. Install pangoft2 (`apt install libfreetype6-dev libpango1.0-dev
libpangoft2... | akshayaurora/kivy | kivy/core/text/text_pango.py | Python | mit | 5,729 |
'''
Build a tweet sentiment analyzer
'''
from collections import OrderedDict
import cPickle as pkl
import sys
import time
import numpy
import theano
from theano import config
import theano.tensor as tensor
from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams
import imdb
datasets = {'imdb': (imdb.loa... | SimonHL/TSA | simpleLSTMtmp.py | Python | bsd-2-clause | 22,625 |
import pika
import logging
class PublisherRabbit(object):
"""This is an example publisher that will handle unexpected interactions
with RabbitMQ such as channel and connection closures.
If RabbitMQ closes the connection, it will reopen it. You should
look at the output, as there are limited reasons ... | di-unipi-socc/DockerFinder | analysis/pyFinder/pyfinder/core/publisher_rabbit.py | Python | apache-2.0 | 14,745 |
from ceph_deploy.util import pkg_managers, templates
from ceph_deploy.lib import remoto
def install(distro, version_kind, version, adjust_repos):
pkg_managers.yum_clean(distro.conn)
pkg_managers.yum(distro.conn, ['ceph', 'ceph-mon', 'ceph-osd'])
def mirror_install(distro, repo_url, gpg_url, adjust_repos, ex... | rtulke/ceph-deploy | ceph_deploy/hosts/rhel/install.py | Python | mit | 2,132 |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | rangadi/beam | sdks/python/apache_beam/utils/__init__.py | Python | apache-2.0 | 936 |
import random
import time
import os
import tempfile
from infi.unittest import parameters
from pkg_resources import Requirement
import forge
from .test_cases import ForgeTest
from pydeploy import environment
from pydeploy import os_api
from pydeploy import virtualenv_api
from pydeploy.environment_utils import Environmen... | vmalloc/pydeploy | tests/test__environment.py | Python | bsd-3-clause | 9,757 |
"""
Django settings for a project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import o... | 13pi/HipstaChat | HipstaChat/settings.py | Python | gpl-2.0 | 2,553 |
#
# This file is part of GreatFET
#
from ..interface import PirateCompatibleInterface
class I2CBus(PirateCompatibleInterface):
"""
Class representing a GreatFET I2C bus.
For now, supports only the primary I2C bus (I2C0), but will be
expanded when the vendor commands are.
"""
# S... | dominicgs/GreatFET-experimental | host/greatfet/interfaces/i2c_bus.py | Python | bsd-3-clause | 6,235 |
from alembic.config import Config
from alembic.environment import EnvironmentContext
from alembic.migration import MigrationContext
from alembic.script import ScriptDirectory
from difflib import unified_diff
from pytest import fixture
from re import split
from sqlalchemy import engine_from_config
from subprocess import... | pyfidelity/rest-seed | backend/backrest/tests/test_migrations.py | Python | bsd-2-clause | 3,745 |
from riq_obj import RIQObject
from riq_base import RIQBase
class User(RIQObject,RIQBase) :
# Object Attributes
_id = None
_name = None
_email = None
_email = None
def __init__(self, _id=None, name=None, email=None, data=None) :
if data != None :
self.parse(data)
eli... | SalesforceIQ/apisdk | python/relateiq/users.py | Python | apache-2.0 | 1,236 |
#!/usr/bin/env python
#Skript ist momentan nur rudimentaer und unausgemistet, sorry!
from PIL import Image
from mpl_toolkits.axes_grid.axislines import SubplotZero
import matplotlib.pyplot as plt
import numpy as np
#todo: calculate gauss-filter with s defined by the command line
#v=[1,3,6,9,10,9,6,3,1] # Gauss F... | kolg/light-section_script | profil.py | Python | gpl-2.0 | 5,171 |
from itertools import permutations
destinations = set()
distances = dict()
with open("inputData.txt", "r") as infile:
for line in infile:
values = line.split()
# 0 = Departing, 2 = Arriving, 4 = Cost
destinations.add(values[0])
destinations.add(values[2])
# This will create... | gytdau/advent | Day9/part2.py | Python | mit | 970 |
import redis
import uuid
import pytz
import random
import pika
from datetime import datetime
class hmfkException(Exception):
def __init__(self,code,message):
self.code=code
self.message=message
class projectsEntity:
def __init__(self,name='',enabled=False,x_account_bytes_used=0,x_account_contain... | zbitmanis/cmanager | bd/utils.py | Python | apache-2.0 | 3,433 |
#
# Copyright (C) 2010 Sorcerer
#
# This file is part of UrTSB.
#
# UrTSB 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.
#
# UrTSB is... | anthonynguyen/UrTSB | urtsb_src/log.py | Python | gpl-3.0 | 1,640 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.