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 python3
"""Play a web stream.
ffmpeg-python (https://github.com/kkroening/ffmpeg-python) has to be installed.
If you don't know a stream URL, try http://icecast.spc.org:8000/longplayer
(see https://longplayer.org/ for a description).
"""
import argparse
import queue
import sys
import ffmpeg
import so... | spatialaudio/python-sounddevice | examples/play_stream.py | Python | mit | 3,596 |
# Compute grades using real division, with no integer truncation
from __future__ import division
import json
import logging
import random
from collections import defaultdict
from functools import partial
import dogstats_wrapper as dog_stats_api
from django.conf import settings
from django.core.cache import cache
from... | ampax/edx-platform | lms/djangoapps/courseware/grades.py | Python | agpl-3.0 | 37,488 |
# File: Relation.py
# Date: 20 gen 16
# Note: adattamento del file relation.py di Relational
# This module provides a classes to represent relations and to perform
# relational operations on them.
from . import Exp, Types
import csv
class Relation (object):
'''This objects defines a rela... | thadumi/radb | bin/core/Relation.py | Python | gpl-3.0 | 27,502 |
import libtcodpy as libtcod
class Doodad(object):
def __init__(self, x, y, colors=None, tileSize=1):
self.x = x
self.y = y
self.character = None
self.tileSize = tileSize
if colors is not None:
self.color = colors[libtcod.random_get_int(0,0, len(colors) - 1)]
... | sandlst/journey-of-the-necromancer | doodad.py | Python | mit | 2,395 |
# https://www.hackerrank.com/challenges/nested-list
# Enter your code here. Read input from STDIN. Print output to STDOUT
a = int(raw_input().strip())
data = []
result = []
for i in range(0, a):
name = str(raw_input().strip())
marks = float(raw_input().strip())
data.append([name, marks])
marks = zip(*data... | JaguarPaw2409/HackerRank | python/nested_list.py | Python | gpl-3.0 | 604 |
#!/usr/bin/env python3
#
# Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Allots libraries to modules to be packaged into.
All libraries that are depended on by a single module will be allotted to this
... | ric2b/Vivaldi-browser | chromium/build/android/gyp/allot_native_libraries.py | Python | bsd-3-clause | 5,364 |
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import android_commands
import constants
import logging
import os
import subprocess
import time
class FakeDns(object):
"""Wrapper class for the fake_... | matsumoto-r/synciga | src/build/android/pylib/fake_dns.py | Python | bsd-3-clause | 2,195 |
__author__ = 'Nicklas Boerjesson'
import unittest
from os import listdir, remove, rmdir
from lib.smbutils import smb_connect
from service.lib.synctools import copy_files, walk_local, walk_smb
local_source_files = ['resources/source/test_root.txt', 'resources/source/l1/l2_1/l2_1.txt']
local_destination_files = ['r... | OptimalBPM/optimal_file_sync | service/lib/tests/test_synctools.py | Python | apache-2.0 | 4,494 |
import subprocess
import re
import os
import logging
#TODO:
# add API to set credentials (Ammon Larsen)
logger = logging.getLogger('gitclient')
logger.setLevel(logging.DEBUG)
logger_handler_console = logging.StreamHandler()
logger_handler_console.setLevel(logging.DEBUG)
logger_formatter = logging.Formatter('%(asctime... | ewertons/gitclient | gitclient.py | Python | mit | 16,102 |
#!/usr/bin/python3
def ask(questionText, answerTypeAllowed = 0, allowedAnswers = None, acceptedAnswerText = "Answer accepted.", typeErrorText = "Your answer was of the wrong type.", badAnswerText = "Your answer was not one of the allowed answers.", genericErrorText = "An error occured.", defaultAnswer = None):
"""... | bearbin/box-server | askquestion.py | Python | mit | 8,008 |
"""
Use the 'Dummy' auth provider for generic integration tests of third_party_auth.
"""
import unittest
from third_party_auth.tests import testutil
from .base import IntegrationTestMixin
@unittest.skipUnless(testutil.AUTH_FEATURE_ENABLED, 'third_party_auth not enabled')
class GenericIntegrationTest(IntegrationTestM... | defance/edx-platform | common/djangoapps/third_party_auth/tests/specs/test_generic.py | Python | agpl-3.0 | 1,103 |
#! /usr/bin/env python3
import http.server
import os
import shutil
import subprocess
import sys
import tempfile
import threading
import unittest
@unittest.skipUnless(sys.platform.startswith("win"), "requires Windows")
class WrapperScriptTests(unittest.TestCase):
http_port = 8080
default_download_url = "http:... | charleskorn/batect | wrapper/windows/test/tests.py | Python | apache-2.0 | 7,673 |
from django.conf import settings
from django.contrib.sites.shortcuts import get_current_site
from django.http import Http404
from django.utils.translation import ugettext_lazy as _
from django_filters.rest_framework import DjangoFilterBackend
from rest_framework import serializers
from rest_framework.decorators import ... | DMPwerkzeug/DMPwerkzeug | rdmo/projects/viewsets.py | Python | apache-2.0 | 13,206 |
#!/usr/bin/env python
# **********************************************************************
#
# Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved.
#
# This copy of Ice is licensed to you under the terms described in the
# ICE_LICENSE file included in this distribution.
#
# *************************************... | joshmoore/zeroc-ice | py/test/Ice/application/Client.py | Python | gpl-2.0 | 1,730 |
# © 2016 Tecnativa - Vicent Cubells
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl-3.0).
from odoo.exceptions import UserError
from odoo.tests import common
class TestRecursion(common.SavepointCase):
@classmethod
def setUpClass(cls):
super(TestRecursion, cls).setUpClass()
cls.d... | OCA/partner-contact | partner_contact_department/tests/test_recursion.py | Python | agpl-3.0 | 915 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-02-09 20:48
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('elearning', '0010_auto_20160209_2042'),
]
operations = [
migrations.AddField... | tkupek/tkupek-elearning | tkupek_elearning/elearning/migrations/0011_setting_logo.py | Python | gpl-3.0 | 461 |
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
import copy
import grp
import inspect
try:
import argparse
except ImportError: # python 2.6
from . import argparse_compat as argparse
import os
import pwd
import sys
import textwrap
im... | ammaraskar/gunicorn | gunicorn/config.py | Python | mit | 38,001 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import time
import tornado.web
from tornado import gen
from bson.objectid import ObjectId
from . import BaseHandler
from .utils import make_content
class UploadHandler(BaseHandler):
@tornado.web.authenticated
def get(self):
self.render('tool/up... | JmPotato/College | handlers/tool.py | Python | mit | 5,001 |
#
# This file is part of LiteSPI
#
# Copyright (c) 2020 Antmicro <www.antmicro.com>
# SPDX-License-Identifier: BSD-2-Clause
from migen import *
from migen.genlib.cdc import MultiReg
from migen.genlib.misc import WaitTimer
from litespi.common import *
from litespi.clkgen import DDRLiteSPIClkGen
from litex.soc.interco... | litex-hub/litespi | litespi/phy/generic_ddr.py | Python | bsd-2-clause | 6,281 |
# -*- coding: UTF-8 -*-
'''
Created on 27.01.2012
@author: rack
'''
import logging
import random
from datetime import date
from interaction.irc.module import InteractiveModule, InteractiveModuleCommand, InteractiveModuleResponse
from components.topic import TopicNotFound, AdditionNotFound, NoAdditionAvailable, NoAff... | msteinhoff/foption-bot | src/python/interaction/irc/modules/topic.py | Python | mit | 7,648 |
# https://oj.leetcode.com/problems/gas-station/
class Solution:
# @param gas, a list of integers
# @param cost, a list of integers
# @return an integer
def canCompleteCircuit(self, gas, cost):
n = len(gas)
if n == 0:
return -1
startIndex, total = 0, 0
for i in xrange(2*n):
j = i % n... | yaoxuanw007/forfun | leetcode/python/gasStation.py | Python | mit | 714 |
from pyqtgraph.Qt import QtGui, QtCore
from flow import *
import numpy as np
import pyo
from traits.api import Int
class BinauralBeat(Block):
volume = Input()
def __init__(self, **config):
super(BinauralBeat, self).__init__(**config)
self.server = pyo.Server(buffersize=1024).boot()
... | strfry/OpenNFB | protocols/clear-windshield.py | Python | gpl-3.0 | 3,466 |
import OOMP
newPart = OOMP.oompItem(9178)
newPart.addTag("oompType", "OPAM")
newPart.addTag("oompSize", "MS08")
newPart.addTag("oompColor", "X")
newPart.addTag("oompDesc", "KLMV358")
newPart.addTag("oompIndex", "01")
OOMP.parts.append(newPart)
| oomlout/oomlout-OOMP | old/OOMPpart_OPAM_MS08_X_KLMV358_01.py | Python | cc0-1.0 | 246 |
"""Test that minimum and maximum window size can be set.
Expected behaviour:
One window will be opened. The window's dimensions will be printed
to the terminal. Initially the window has no minimum or maximum
size (besides any OS-enforced limit).
- press "n" to set the minimum size to be the current... | bitcraft/pyglet | tests/interactive/window/window_set_min_max_size.py | Python | bsd-3-clause | 1,569 |
#!/usr/bin/env python
###########################################################################
#
# Copyright 2017 Samsung Electronics 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 ... | an4967/TizenRT | tools/dump_tool/gui_ramdumpParser.py | Python | apache-2.0 | 8,549 |
# coding:utf-8
"""
TokenStream represents a stream of tokens that a parser will consume.
TokenStream can be used to consume tokens, peek ahead, and synchonize to a
delimiter token. The tokens that the token stream operates on are either
compiled regular expressions or strings.
"""
import re
import six
class TokenSt... | mailgun/flanker | flanker/addresslib/plugins/_tokenizer.py | Python | apache-2.0 | 2,400 |
import json
from collections import OrderedDict
from datetime import date, datetime, timedelta
from django.conf import settings
from django.core.cache import cache
from django.db import models
from django.db.models import Q, Sum
from django.template import loader
from django.utils.encoding import python_2_unicode_com... | wagnerand/olympia | src/olympia/reviewers/models.py | Python | bsd-3-clause | 48,527 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('apimanager', '0011_auto_20151030_1604'),
]
operations = [
migrations.AlterField(
model_name='apipage',
... | City-of-Helsinki/devheldev | apimanager/migrations/0012_auto_20151103_1659.py | Python | agpl-3.0 | 554 |
import json
import logging
from django.core.serializers import serialize
from django.http import HttpResponse, JsonResponse, HttpResponseRedirect, HttpResponseBadRequest
from django.views.generic import TemplateView, FormView
from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib.auth import logo... | ianastewart/cwltc-admin | pos/views/ipad_views.py | Python | mit | 18,953 |
# -*- coding: utf-8 -*-
"""
Created on Mar 13, 2012
@author: moloch
Copyright 2012 Root the Box
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... | moloch--/RootTheBox | handlers/FileUploadHandlers.py | Python | apache-2.0 | 6,090 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# 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... | savi-dev/heat | heat/tests/test_engine_service.py | Python | apache-2.0 | 73,519 |
from . import BaseReporter
class LogReporter(BaseReporter):
""" Log based reporter.
"""
def __init__(self, output_log=None):
""" output will be logged to output_log
:param output_log: a python log object to output reports to.
"""
super(LogReporter, self).__init__()
... | prismskylabs/pycounters | src/pycounters/reporters/logreporter.py | Python | apache-2.0 | 657 |
import sys
import threading
import traceback
def get_app_info_string():
"""
Get a string representing global information about the application. This is used for debugging.
:rtype: str
"""
app_info_list = _get_formatted_thread_stack_traces()
return '\n'.join(app_info_list)
def _get_formatted... | nickzuber/ClusterRunner | app/util/app_info.py | Python | apache-2.0 | 1,152 |
"""
SkCode internal tag test code.
"""
import unittest
from skcode.etree import RootTreeNode
from skcode.tags import (
TextTreeNode,
NewlineTreeNode,
HardNewlineTreeNode
)
class TextTagTestCase(unittest.TestCase):
""" Tests suite for the text tag module. """
def test_tag_constant_values(self):
... | TamiaLab/PySkCode | tests/tests_tags/tests_internal.py | Python | agpl-3.0 | 5,497 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
laszip.py
---------------------
Date : September 2013
Copyright : (C) 2013 by Martin Isenburg
Email : martin near rapidlasso point com
******************... | alexbruy/QGIS | python/plugins/processing/algs/lidar/lastools/laszip.py | Python | gpl-2.0 | 3,010 |
from kvmap.code.projections import *
from urllib2 import urlopen
from httplib import HTTPConnection
from threading import Thread
from kivy.logger import Logger
from kivy.loader import Loader
from os.path import join, dirname
import time, os
import hashlib
try:
from pyproj import Proj
from xml.etree import Element... | jchome/LocalGuide-Mobile | kvmap/overlays/WMSOverlayServer.py | Python | gpl-2.0 | 5,614 |
from sys import argv
from grslra.scaling import *
import numpy as np
from grslra.tools import subspace_angle
from grslra.testdata import testdata_rpca_lmafit
from grslra.grpca import grpca
import time
# This experiment computes the phase transitions for incomplete observations (20% to 80% of missing entries)
# defin... | clemenshage/grslra | experiments/4_grpca/completion/completion.py | Python | mit | 3,409 |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | skosukhin/spack | var/spack/repos/builtin/packages/swiftsim/package.py | Python | lgpl-2.1 | 2,785 |
# Postr, a Flickr Uploader
#
# Copyright (C) 2006-2008 Ross Burton <ross@burtonini.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, or (at your option) any later version.... | GNOME/postr | src/AuthenticationDialog.py | Python | gpl-2.0 | 2,724 |
# 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... | qiuminxu/tensorboard | tensorboard/plugins/hparams/list_session_groups_test.py | Python | apache-2.0 | 22,679 |
from flask import Flask, jsonify, abort, request
from goshna import *
from goshna import ApiFunctions
class Airport:
def __init__(self, id, airport_short, airport_full):
self.id = id
self.airport_short = airport_short
self.airport_full = airport_full
def to_json(self):
return {... | sumiquitous/Goshna-Server | goshna/Airport.py | Python | mit | 2,080 |
#! /usr/bin/env python
# -*- coding: UTF8 -*-
import os
import sqlite3
import sys
import datetime
import math
def stat_moyenne(ech):
if len(ech) == 0:
return 0
return sum(ech) / float(len(ech))
def stat_variance(ech):
if len(ech) == 0:
return 0
t1 = float(1. / (len(ech) - 1 ))
m... | egeeamu/voskhod | bin/voskload_preload_database_validate_contigs.py | Python | gpl-3.0 | 3,881 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# pylint: disable=no-else-return, too-many-instance-attributes
from datetime import datetime, timedelta
from glob import glob
import imp
import os
import re
import sys
from flask import g, current_app
class HookError(Exception):
pass
class Dispatcher:
def __init... | tryagainconcepts/debot | debot/dispatcher.py | Python | mit | 5,882 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# create a class for correlation matrix and other class to find out similar users who have rated a particular movie w.r.t. a particular user based on correlation
import numpy as np
import pandas as pd
class Correlation:
"""
"""
def pearson(self, rating_matrix... | sagnik17/Movie-Recommendation-System | mrs/recsys/cf.py | Python | gpl-3.0 | 387 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 Midokura PTE LTD.
# All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENS... | celebdor/python-midonetclient | src/midonetclient/port_group.py | Python | apache-2.0 | 1,908 |
#!/usr/bin/env python
#
# Copyright 2011 Facebook
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | jordoncm/ft2json | tornado/platform/posix.py | Python | apache-2.0 | 1,723 |
import os
import shutil
import sys
dest = 'py2only'
futures_dirname = 'concurrent'
DIST_DIR = os.path.realpath('kolibri/dist')
def hide_py2_modules():
"""
Move the directory of 'futures' and python2-only modules of 'future'
inside the directory 'py2only'
"""
# Move the directory of 'futures' ins... | christianmemije/kolibri | build_tools/py2only.py | Python | mit | 1,365 |
'''
Created on Oct 22, 2012
@author: Gary
'''
from housemonitor.hm.inputthead import InputThread
from housemonitor.hm.display import Display
from time import sleep
if __name__ == '__main__':
cv = {}
it = InputThread( cv )
it.start()
sleep( 15 )
display = Display( cv )
display.update()
... | gary-pickens/HouseMonitor | housemonitor/hm/hmon.py | Python | mit | 334 |
def generate_dispatcher(method_handler, parent_class=None):
"""
Create a dispatcher class and return an instance of it from a dispatcher
definition.
The definition is a class with the following attributes:
_ EXPORTED_METHOD: dictionary where keys are method names and values
class attribute nam... | ActiveState/code | recipes/Python/83048_Dynamic_generatidispatcher/recipe-83048.py | Python | mit | 2,283 |
def is_funny(s):
codes = [ord(c) for c in s]
codes_len = len(codes)
for i in range(codes_len - 1):
d1 = codes[i + 1] - codes[i]
d2 = codes[-(i + 1)] - codes[-(i + 2)]
if abs(d1) != abs(d2):
return False
return True
t = int(input())
for _ in range(t):
print('Funny... | ahavrylyuk/hackerrank | python3/funny-string.py | Python | mit | 361 |
# -*- coding: utf-8 -*-
from django.conf.urls import url
from djshop.apps.store.views import index
from djshop.apps.store.views import products
urlpatterns = [
url(r'^index/?$', index.index, name="index"),
# Products
url(r'^products/?$', products.index, name="view_products"),
url(r'^products/new/?$... | diegojromerolopez/djshop | src/djshop/apps/store/urls.py | Python | mit | 622 |
from __future__ import print_function, absolute_import
import os
import sys
import imp
import json
import string
import shutil
import subprocess
import tempfile
from distutils.dep_util import newer_group
from distutils.core import Extension
from distutils.errors import DistutilsExecError
from distutils.ccompiler import... | rmcgibbo/msmbuilder | basesetup.py | Python | lgpl-2.1 | 12,526 |
# Copyright (c) 2018 PaddlePaddle 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 app... | reyoung/Paddle | python/paddle/fluid/tests/unittests/test_softmax_with_cross_entropy_op.py | Python | apache-2.0 | 4,712 |
from . import boxscore
from . import draft
from . import miscellaneous
from . import playbyplay
from . import player
from . import team | CardinalAdvising/py-Goldsberry | goldsberry/__init__.py | Python | mit | 135 |
import pytest
from .fixtures import Adder, Divider
from ..brokers.standard import Standard as StandardBroker
from ..brokers.eager import Eager as EagerBroker
from ..brokers.base import Broker as BaseBroker
from ..connectors.dummy import Dummy as DummyConnector
class TestBrokerInterface(object):
def test_default... | gnufede/sqjobs | sqjobs/tests/broker_test.py | Python | bsd-3-clause | 3,222 |
#!/usr/bin/env python3
# Copyright (c) 2014-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.
"""Base class for RPC testing."""
from collections import deque
import errno
from enum import Enum
import... | spiritlinxl/BTCGPU | test/functional/test_framework/test_framework.py | Python | mit | 21,499 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# tritonschedule documentation build configuration file, created by
# sphinx-quickstart on Wed Jun 22 11:40:06 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in th... | brianhang/tritonscheduler | docs/conf.py | Python | mit | 11,786 |
# Copyright 2015 Google 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 applicable law or agreed to in writing, s... | tseaver/google-cloud-python | bigtable/tests/unit/test_table.py | Python | apache-2.0 | 69,707 |
import os
from flask import Blueprint, render_template, session, redirect, url_for, request, abort, flash
from flask import current_app, send_from_directory
from itsdangerous import URLSafeSerializer, BadSignature
from werkzeug import secure_filename
from flask.ext.login import current_user, login_user, logout_user
fro... | teamgivn/givnapp | app/blueprints/donors/views.py | Python | mit | 3,057 |
#! /usr/bin/python3
import curses as c
from pyotp import TOTP
from math import floor
from sys import exit
import os
import bcrypt
import json
from aes import AESCipher
import base64
from time import strftime
from getpass import getuser
cotp_dir = os.path.dirname(os.path.realpath(__file__))
user_name = str(getuser())... | filiparag/cotp | cotp.py | Python | gpl-3.0 | 11,957 |
import random
import string
def _pad_message(message):
""" A PKCS#7 padding implementation for the end of the plaintext message.
Args:
message (str): The full plaintext message.
Returns:
str: A PKCS#7 padded message.
"""
pad = len(message) % 5
if pad is 0:
message +=... | atoponce/cardciphers | chaocipher/encoder/__init__.py | Python | gpl-3.0 | 3,178 |
# OpenCMISS Zinc widgets Python package initialisation file.
__version__ = "1.0.0"
| OpenCMISS-Bindings/ZincPythonTools | opencmiss/zincwidgets/__init__.py | Python | mpl-2.0 | 87 |
"""
Module containing the CanonicalGaussian object
and some helper functions.
@author: scj robertson
@since: 22/05/2016
"""
import numpy as np
import numbers
class CanonicalGaussian:
'''
Class for representing a multivariate Gaussian distribution,
given a partitioned precision matrix and information vect... | scjrobertson/xRange | tracking/canonical_gaussian.py | Python | gpl-3.0 | 10,114 |
import unittest
from test import *
unittest.main() | supersheep/huixiang | run_test.py | Python | mit | 51 |
import skrf as rf
from numpy import *
import os
def deembed(deembedtype,temps,rawpath,dpath,pcb1,pcb2,pcb3):
pcbNet1 = rf.Network(pcb1)
if temps == 1:
pcbNet2 = rf.Network(pcb2)
pcbNet3 = rf.Network(pcb3)
# need to figure out way to only perform the open preparation once
def allopen... | joescape/DeembedProject | DeembedFiles.py | Python | gpl-3.0 | 1,036 |
#!/usr/bin/env python
""" Main deployment script for app
"""
from flaskgur import app
if __name__ == '__main__':
if app.debug:
app.run(debug=True, host='0.0.0.0', port=5018)
else:
app.run(host='0.0.0.0', port=5018)
| chokepoint/flaskgur | runserver.py | Python | gpl-2.0 | 241 |
# -*- coding: utf-8 -*-
import socket
import ibm_db
conn = ibm_db.connect("DATABASE=sample;HOSTNAME=66.3.44.37;PORT=60004;PROTOCOL=TCPIP;UID=cyrus;PWD=cyrus;", "", "")
sql = "SELECT PHONENO FROM EMPLOYEE"
def queryData(s):
result = []
if conn:
try:
stmt = ibm_db.exec_immediate(conn, s)
... | cysuncn/python | study/Socket/SocketClient.py | Python | gpl-3.0 | 1,102 |
#!/usr/bin/env python3
#
# mmgen = Multi-Mode GENerator, a command-line cryptocurrency wallet
# Copyright (C)2013-2022 The MMGen Project <mmgen@tuta.io>
# Licensed under the GNU General Public License, Version 3:
# https://www.gnu.org/licenses
# Public project repositories:
# https://github.com/mmgen/mmgen
# http... | mmgen/mmgen | mmgen/base_proto/bitcoin/tw/addrs.py | Python | gpl-3.0 | 3,890 |
#!/usr/bin/python
import subprocess
import threading
import multiprocessing
conf_str_template = '''init_cwnd: 12
max_cwnd: 15
retx_timeout: 45e-06
queue_size: 36864
propagation_delay: 0.0000002
bandwidth: 40000000000.0
queue_type: {0}
flow_type: 2
num_flow: 100000
flow_trace: CDF_aditya.txt
cut_through: 1
mean_flow_s... | InfocomFlowSimulator/queue_simulator | runner/run_experiments.py | Python | bsd-3-clause | 2,485 |
#
# 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
# ... | cwolferh/heat-scratch | heat/engine/resources/openstack/heat/remote_stack.py | Python | apache-2.0 | 11,589 |
# Copyright: (c) 2017 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
import json
import pytest
from ansible.modules.net_tools import nmcli
pytestmark = pytest.mark.usefixtures('patch_ansible_module')
TESTCASE_CONNECTION = [
{
'type': 'ethern... | wrouesnel/ansible | test/units/modules/net_tools/test_nmcli.py | Python | gpl-3.0 | 12,890 |
"""
Definition of a metaclass for immutable user-defined objects
"""
import functools
import itertools
import collections
#
# The metaclass
# =============
#
class ImmutableClass(type):
"""Immutable class metaclass derived from tuple"""
def __new__(mcs, name, bases, nmspc, default_attr=lambda _: None):
... | tschijnmo/immutableclass | immutableclass.py | Python | mit | 10,899 |
#!/usr/bin/env python
from telegram import TelegramObject
class ForceReply(TelegramObject):
def __init__(self,
force_reply=True,
selective=None):
self.force_reply = force_reply
self.selective = selective
@staticmethod
def de_json(data):
... | yosit/kinnernet_bot | lib/telegram/forcereply.py | Python | apache-2.0 | 628 |
"""
"""
from docker import DockerCompose
from common import Directories, ConfigManager
import util
import time
import logging
logger = logging.getLogger(__name__)
class WebService:
SERVICE_NAME = "webapp"
def __init__(self, context):
self.context = context
self.config = self.context.manager.... | 2pisoftware/cmfive-boilerplate | .build/setup/service/web.py | Python | gpl-3.0 | 2,888 |
import logging
from base import ActionRunner, ActionManager
from collections import namedtuple
from gevent.pool import Group
from gevent import sleep
from robotActionController.Data.storage import StorageFactory
from robotActionController.Data.Model import Action
class GroupRunner(ActionRunner):
supportedClass = ... | scheunemann/robotActionController | robotActionController/ActionRunner/groupRunner.py | Python | mit | 2,761 |
#!/usr/bin/env python3.7
#-----------------------------------------------------------------------------
#
# 2019-03-17
#-----------------------------------------------------------------------------
import unittest
from unittest.mock import patch, Mock
import json
class TestRdapC(unittest.TestCase):
def setUp(sel... | carlosm3011/cm2c-skunkworks | graduated/30-minirdapc/test.py | Python | bsd-2-clause | 3,605 |
"""
Radiative transfer solvers for the atmosphere model.
Modules:
pydisort - Python implementation of CDISORT
twostream - Fast numerical solver for heterogenous layers
"""
from . import twostream
from . import pydisort
__all__ = ['twostream','pydisort'] | adamkovics/atmosphere | atmosphere/rt/__init__.py | Python | gpl-2.0 | 261 |
from .struct import Struct
from .types import Int16, Int32, String, Schema
class RequestHeader(Struct):
SCHEMA = Schema(
('api_key', Int16),
('api_version', Int16),
('correlation_id', Int32),
('client_id', String('utf-8'))
)
def __init__(self, request, correlation_id=0, cl... | zackdever/kafka-python | kafka/protocol/api.py | Python | apache-2.0 | 476 |
"""JSON implementations of relationship searches."""
# pylint: disable=no-init
# Numerous classes don't require __init__.
# pylint: disable=too-many-public-methods,too-few-public-methods
# Number of methods are defined in specification
# pylint: disable=protected-access
# Access to protected methods allowe... | mitsei/dlkit | dlkit/json_/relationship/searches.py | Python | mit | 11,651 |
# 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-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/training/models/image_create_result.py | Python | mit | 1,635 |
# -*- coding: utf-8 -*-
from scrapy import signals, Request
from scrapy.exceptions import CloseSpider, NotConfigured
from scrapy.loader import ItemLoader
from rojak_pantau.spiders.base import BaseSpider
from datetime import datetime
from rojak_pantau.items import News
from rojak_pantau.util.wib_to_utc import wib_to_... | CodeRiderz/rojak | rojak-pantau/rojak_pantau/spiders/sindonews.py | Python | bsd-3-clause | 4,716 |
template_string = '''#!/bin/bash
#PBS -S /bin/bash
#PBS -N ${jobname}
#PBS -m n
#PBS -l walltime=$walltime
#PBS -l nodes=${nodes_per_block}:ppn=${tasks_per_node}
#PBS -o ${submit_script_dir}/${jobname}.submit.stdout
#PBS -e ${submit_script_dir}/${jobname}.submit.stderr
${scheduler_options}
${worker_init}
export JOBN... | swift-lang/swift-e-lab | parsl/providers/torque/template.py | Python | apache-2.0 | 358 |
'''
Problem 21
05 July 2002
Let d(n) be defined as the sum of proper divisors of n (numbers less
than n which divide evenly into n).
If d(a) = b and d(b) = a, where a != b, then a and b are an amicable
pair and each of a and b are called amicable numbers.
For example, the proper divisors of 220 are 1, 2, 4... | arturh85/projecteuler | python/src/problem021.py | Python | mit | 1,841 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#Load modules
try:
import imp
import sys
import os
import time
import prefcheck
import gui
#import update
import json
except ImportError:
raise Exception("Error: Faild to import critical modules.")
sys.exit(1)
def sysCheck():
#start writing to sysCheck.log
unlo... | TheEnvironmentGuy/noodle-pipe | Source/Qt5/modules/syscheck.py | Python | mit | 4,017 |
#!/usr/bin/env python
"""
Copyright 2015-2020 Knights Lab, Regents of the University of Minnesota.
This software is released under the GNU Affero General Public License (AGPL) v3.0 License.
"""
import click
import os
from ninja_utils.utils import verify_make_dir
from ninja_utils.parsers import FASTA
from dojo.datab... | knights-lab/NINJA-SHOGUN | shogun/scripts/old/shogun_bt2_db.py | Python | mit | 3,276 |
#!/usr/bin/env python
from ZSI import dispatch
from Test_server import EchoResponse
from Test_server import AddResponse
def echo(message):
response = EchoResponse()
response._Message = message
return response
def add( operators ):
response = AddResponse()
print operators
response._Result = 0
... | rd2b/tools | python-soaptest/src/server.py | Python | gpl-3.0 | 482 |
import pygraphviz as pgv
from lxml import etree
import textwrap
from flask import Flask
import json
import os
import copy
class SyllabusGraph(pgv.AGraph):
def __init__(self, style_path, is_embedded=False):
super(SyllabusGraph,self).__init__(overlap='false', outputorder='edgesfirst')
self.is_embed... | UoMCS/syllabus-visualisation | server/graph.py | Python | mit | 3,655 |
#!/usr/bin/python
#
# release_notes.py - "I can't believe it's not a web browser."
#
# David Cantrell <dcantrell@redhat.com>
#
# Copyright 2006 Red Hat, Inc.
#
# This software may be freely redistributed under the terms of the GNU
# library public license.
#
# You should have received a copy of the GNU Library Public L... | sergey-senozhatsky/anaconda-11-vlan-support | iw/release_notes.py | Python | gpl-2.0 | 7,725 |
from django.conf.urls import patterns, include, url
from rms.views import *
from django.conf.urls.defaults import *
from django.contrib import admin
from django.core.urlresolvers import reverse
from django.conf.urls.defaults import patterns, include
from dajaxice.core import dajaxice_autodiscover, dajaxice_config... | cseanitc/RMS | rms/rms/urls.py | Python | gpl-3.0 | 2,128 |
import pathlib
import itertools
import shutil
import modelx as mx
from modelx.tests.testdata.testpkg import testmod
import pytest
from importlib.machinery import SourceFileLoader
from importlib.util import spec_from_loader, module_from_spec
SAMPLE_MODULE = pathlib.Path(testmod.__file__)
params = list(itertools.produc... | fumitoh/modelx | modelx/tests/io/test_moduleio.py | Python | gpl-3.0 | 4,061 |
from django.contrib import admin
from django.core.urlresolvers import reverse
from django.shortcuts import redirect
from django.utils.translation import ugettext_lazy as _
from reversion.models import Revision
from sapl.base.models import ProblemaMigracao
from sapl.utils import register_all_models_in_admin
register_a... | LeandroRoberto/sapl | sapl/base/admin.py | Python | gpl-3.0 | 1,490 |
# -*- coding: utf-8 -*-
from collections import defaultdict
import itertools
import math
import networkx as nx
import re
from typing import Any, DefaultDict, Dict, List, Union
from django.db import connection
from django.http import HttpRequest, JsonResponse
from django.shortcuts import get_object_or_404
from rest_f... | tomka/CATMAID | django/applications/catmaid/control/treenode.py | Python | gpl-3.0 | 53,294 |
# Copyright (C) 2008-2010 Adam Olsen
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that... | eri-trabiccolo/exaile | xlgui/panel/radio.py | Python | gpl-2.0 | 20,745 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2012-2013 Vinay Sajip.
# Licensed to the Python Software Foundation under a contributor agreement.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
import logging
__version__ = '0.1.6'
class DistlibException(Exception):
pass
try:
from logging import NullHandler
except Impor... | minrk/pip | pip/_vendor/distlib/__init__.py | Python | mit | 534 |
"""
If Salt's OS detection does not identify a different virtual service module, the minion will fall back to using this basic module, which simply wraps sysvinit scripts.
"""
import fnmatch
import os
import re
__func_alias__ = {"reload_": "reload"}
_GRAINMAP = {"Arch": "/etc/rc.d", "Arch ARM": "/etc/rc.d"}
def __... | saltstack/salt | salt/modules/linux_service.py | Python | apache-2.0 | 4,753 |
#!/usr/bin/env python
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
__license__ = 'GPL v3'
__copyright__ = '2010, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import os, posixpath
from functools import partial
from PyQt4.Qt import (QMenu, Qt, QInputDialog, QToolButton, QDialog,
... | yeyanchao/calibre | src/calibre/gui2/actions/choose_library.py | Python | gpl-3.0 | 21,394 |
from os import path
from Components.HTMLComponent import HTMLComponent
from Components.GUIComponent import GUIComponent
from Screens.Screen import Screen
from Components.ActionMap import ActionMap
from Components.Label import Label
from ServiceReference import ServiceReference
from enigma import eListboxPythonMultiCont... | vitmod/enigma2-1 | lib/python/Screens/ServiceInfo.py | Python | gpl-2.0 | 12,007 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | dhp-denero/LibrERP | res_user_signature/__openerp__.py | Python | agpl-3.0 | 1,454 |
import pickle
import os
import re
from models import Serializable, Category, PatternInfo
from views import FuseView, CrawlerView, AgarView, GrowingSpaceshipView, WaveView, GunView, InductionCoilView, \
MethuselahView, MovingBreederView, OscillatorView, MiscPatternView, PufferView, ReflectorView, RotorView, \
S... | mir3z/life.js | library-scrapper/library-builder.py | Python | mit | 2,763 |
from django.contrib import admin
#from .models import Tag
#import sys
#import importlib
#importlib.reload(sys)
#admin.site.register(Tag)
# Register your models here.
| summerzhangft/summer | tag/admin.py | Python | gpl-3.0 | 167 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.