code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
'''
Copyright (c) 2012-2017, Agora Games, LLC All rights reserved.
https://github.com/agoragames/kairos/blob/master/LICENSE.txt
'''
from .exceptions import *
from .timeseries import *
import operator
import sys
import time
import re
import pymongo
from pymongo import ASCENDING, DESCENDING
from datetime import datetim... | agoragames/kairos | kairos/mongo_backend.py | Python | bsd-3-clause | 12,707 |
# -*- coding: utf8 -*-
"""
.. module:: burpui.misc.acl.meta
:platform: Unix
:synopsis: Burp-UI ACL meta definitions.
.. moduleauthor:: Ziirish <hi+burpui@ziirish.me>
"""
from .interface import BUIacl
from ...utils import make_list
from ...config import config
from ...ext.cache import cache
import re
import j... | ziirish/burp-ui | burpui/misc/acl/meta.py | Python | bsd-3-clause | 28,562 |
""" serve HTML page
TODO the RevealServer setting should be available at front end
"""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from __future__ import print_function
import os
import signal
import webbrowser
from tornado import web, ioloop, httpserver, log... | chrisjsewell/ipypublish | ipypublish/postprocessors/reveal_serve.py | Python | bsd-3-clause | 5,004 |
from poap.controller import BaseWorkerThread
from poapextensions.BaseWorkerTypes import (
BaseEventWorker,
BaseInterruptibleWorker,
BasePreemptibleWorker,
)
import logging
import Queue
# Get module-level logger
logger = logging.getLogger(__name__)
class ThreadWorker(BaseWorkerThread):
"""
Sets up... | prw54/cloud_based_optimization_of_preemptible_vms | poapextensions/ThreadWorkers.py | Python | bsd-3-clause | 3,212 |
# pylint: disable=W0212
# W0212: For testing it is fine to access protected members.
#
# $Filename$$
# $Authors$
# Last Changed: $Date$ $Committer$ $Revision-Id$
#
# Copyright (c) 2003-2011, German Aerospace Center (DLR)
# All rights reserved.
#
#
#Redistribution and use in source and binary forms, with or w... | DLR-SC/DataFinder | test/unittest/datafinder_test/gui/user/dialogs/privilege_dialog/principal_search_test.py | Python | bsd-3-clause | 5,637 |
VERSION = (1, 0, 0)
__version__ = '.'.join(map(str, VERSION))
from django_nose.runner import *
from django_nose.testcases import *
# Django < 1.2 compatibility.
run_tests = run_gis_tests = NoseTestSuiteRunner
| mzdaniel/django-nose | django_nose/__init__.py | Python | bsd-3-clause | 212 |
# Each setting is documented at:
# https://docs.djangoproject.com/en/1.9/ref/settings/
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/
import os
from datetime import timedelta
from django.utils.translation import ugettext_lazy as _... | mbaragiola/heimdalerp | heimdalerp/settings.py | Python | isc | 9,675 |
#!/usr/bin/env python
# #!/bin/bash
#
# . ~/.bash_profile
# . ~/.bashrc
#
# DATE=`date "+%Y-%m-%d"`
# DAY=`date "+%Y-%m-%d-RetouchToDo"`
#
# searchDir="$1"
#
# stylePath=`find $searchDir -iname \*[^2-9][0-9,{8}]_[1-6].\*`
#
# for f in $stylePath:
# do
# style=`basename $f | awk -F_ '{ print $1 }'`
# paired=`echo ... | relic7/prodimages | python/metaDataNewTaggerAltVers.py | Python | mit | 7,620 |
# Bug in PyPy was not handling CALL_METHOD_xxx like
# CALL_FUNCTION_XXX
def truncate(self, size=None):
self.db.put(self.key, '', txn=self.txn, dlen=self.len - size, doff=size)
| moagstar/python-uncompyle6 | test/simple_source/bug_pypy27/02_call_method.py | Python | mit | 180 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Creature()
result.template = "object/mobile/shared_dressed_blood_razor_pirate_captain_wee_m.iff"
result.attribute... | anhstudios/swganh | data/scripts/templates/object/mobile/shared_dressed_blood_razor_pirate_captain_wee_m.py | Python | mit | 467 |
from PIL import Image
import glob, os
def resize():
for files in glob.glob('*.jpg'):
filepath,filename = os.path.split(files) #分割文件名和路径名
fname,fext = os.path.splitext(filename)
im = Image.open(files)
w,h = im.size
if w > 640:
x = w/640.0
w = 640
... | Show-Me-the-Code/python | Liez-python-code/0005/0005.py | Python | mit | 559 |
"""
Room Typeclasses for the TutorialWorld.
This defines special types of Rooms available in the tutorial. To keep
everything in one place we define them together with the custom
commands needed to control them. Those commands could also have been
in a separate module (e.g. if they could have been re-used elsewhere.)... | whitehorse-io/encarnia | evennia/evennia/contrib/tutorial_world/rooms.py | Python | mit | 40,714 |
from PIL import Image
import os
from random import randint
import argparse
parser = argparse.ArgumentParser("map_from_bitmap")
parser.add_argument(
"filename", help="the name of the input image excluding .bmp")
parser.add_argument("-s", "--spawns", nargs="+", type=int,
default=[0], hel... | thdb-theo/Zombie-Survival | docs/assets/Tools/map_from_bitmap.py | Python | mit | 3,556 |
from pymongo import MongoClient
client = MongoClient('mongodb://127.0.0.1:27017/')
db = client.tspv
import os
import csv
import datetime
def csv_reader(file_obj):
reader = csv.reader(file_obj)
for row in reader:
date_parts = row[0].split("/")
order_date = datetime.datetime(int(date_parts[2])... | Manto/TradeStationPositionView | script/load_orders.py | Python | mit | 1,282 |
"""
Hub implementation.
No dedicated Controller class.
Only one callback function that is called once during ConnectionUp
that instructs all the switches to flood every packet to every port
except the one whose the packet was coming from.
Notice that this is the simplest example of a proactive(static) configuration... | remmihsorp/minicps | scripts/pox/hub.py | Python | mit | 1,925 |
def test_queryai_run_query(requests_mock):
"""Tests queryai-run-quer command function.
"""
from QueryAI import Client, queryai_run_query_command
mock_response = {
"data": [
{"agegroupdesc": "18-19", "agegroupbin": 2},
{"agegroupdesc": "20-21", "agegroupbin": 3},
... | demisto/content | Packs/QueryAI/Integrations/QueryAI/QueryAI_test.py | Python | mit | 2,060 |
#!/usr/bin/python
from copy import copy, deepcopy
import sys
from lap import best_pairs
import numpy as np
__all__ = [ "cost_list" ]
myINF=1e100
def main(filename='tmp', mxbest=20, mxdelta=50):
a=np.loadtxt(filename)
costs=best_costs(a,mxbest=int(mxbest), mxdelta=float(mxdelta))
for x in costs:
print x
def... | albapa/glosim | libmatch/lap/murty.py | Python | mit | 3,760 |
import os
import subprocess
from bcbio import utils
from bcbio.log import logger
from bcbio.provenance import do
import bcbio.pipeline.datadict as dd
from bcbio.pipeline import config_utils
HS = {"hg19": "2.7e9",
"GRCh37": "2.7e9",
"mm10": "1.87e9"}
def run(name, chip_bam, input_bam, genome_build, out_d... | Cyberbio-Lab/bcbio-nextgen | bcbio/chipseq/macs2.py | Python | mit | 2,159 |
# The MIT License(MIT)
# Copyright (c) 2013-2014 Matt Thomson
# 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, mo... | pyembed/pyembed | pyembed/core/render.py | Python | mit | 2,132 |
# Copyright (c) 2012-2015 Netforce Co. Ltd.
#
# 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, modify, merge, publ... | anastue/netforce | netforce_account/netforce_account/models/account_account.py | Python | mit | 20,630 |
#!/usr/bin/python
# Jared Henry Oviatt
# create raw data
import random
# pull prices from api csv
def parse_csv():
# for if you download csv froma browser and then want to use it. Deprecated.
filename = 'csv/per_day_all_time_history.csv'
f = open(filename, 'r')
data = f.readlines()
prices = []
for each in... | underscorejho/bitcoin-trader-jho | test/src/fake_data.py | Python | mit | 2,112 |
from __future__ import division
import sys
import numpy
import six
from cupy import binary
from cupy import core
from cupy import creation
from cupy import indexing
from cupy import io
from cupy import linalg
from cupy import logic
from cupy import manipulation
from cupy import math
import cupy.random
from cupy impo... | muupan/chainer | cupy/__init__.py | Python | mit | 11,440 |
from models.notifications.requests.request import Request
WEBHOOK_VERSION = 1
class WebhookRequest(Request):
""" Represents a webhook notification payload.
Attributes:
notification (Notification): The Notification to send.
url (string): The URL to send the notification payload to.
s... | fangeugene/the-blue-alliance | models/notifications/requests/webhook_request.py | Python | mit | 4,001 |
# -*- coding: utf-8 -*-
#
# inventory_project documentation build configuration file, created by
# sphinx-quickstart on Sun Feb 17 11:46:20 2013.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated fil... | seanherron/data-inventory | docs/conf.py | Python | mit | 7,828 |
"""Learning from examples (Chapters 18)"""
import copy
from collections import defaultdict
from statistics import stdev
from qpsolvers import solve_qp
from probabilistic_learning import NaiveBayesLearner
from utils import *
class DataSet:
"""
A data set for a machine learning problem. It has the following ... | Chipe1/aima-python | learning.py | Python | mit | 45,678 |
import demistomock as demisto
from TopMaliciousRatioIndicators import main, find_indicators_with_mal_ratio
import io
import json
def util_load_json(path):
with io.open(path, mode='r', encoding='utf-8') as f:
return json.loads(f.read())
def test_find_indicators_with_mal_ratio(mocker):
"""
Giv... | demisto/content | Packs/CommonScripts/Scripts/TopMaliciousRatioIndicators/TopMaliciousRatioIndicators_test.py | Python | mit | 3,814 |
#!/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.
"""Test gettxoutproof and verifytxoutproof RPCs."""
from test_framework.test_framework import IoPTestFram... | Jcing95/iop-hd | test/functional/merkle_blocks.py | Python | mit | 4,382 |
# encoding: utf-8
"""
Some functions that cannot be in pdf.py file to prevent import loop.
"""
from io import BytesIO
import logging
from django.core.files import File
from membership.billing import pdf
logger = logging.getLogger("membership.billing.pdf")
def create_reminder_pdf(cycles, output_file, payments=Non... | annttu/sikteeri | membership/billing/pdf_utils.py | Python | mit | 1,603 |
#!/usr/bin/env python
# Copyright (c) 2012-2013 Mitch Garnaat http://garnaat.org/
# Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to d... | jonparrott/botocore | tests/unit/test_directconnect_operations.py | Python | mit | 3,105 |
from flask import make_response
from systemofrecord.services import ingest_queue_producer
from datatypes import system_of_record_request_validator
from systemofrecord import configure_logging
class StoreObjectController(object):
def __init__(self):
self.logger = configure_logging(self)
def store_obj... | LandRegistry/system-of-record-alpha | systemofrecord/controllers/store_object_controller.py | Python | mit | 623 |
"""
Atomic file operations
"""
from __future__ import with_statement
import os
import threading
import sys
import atexit
from contextlib import contextmanager
from plumbum.machines.local import local
from plumbum.lib import six
if not hasattr(threading, "get_ident"):
try:
import thread
except ImportE... | siemens/plumbum | plumbum/fs/atomic.py | Python | mit | 9,669 |
from unittest import TestCase
from tornado.httpclient import HTTPRequest
from tornado_stub_client.collection import (RequestCollection,
_new_collection)
class CollectionTest(TestCase):
def setUp(self):
RequestCollection._requests = _new_collection()
def te... | venmo/tornado-stub-client | tests/test_collection.py | Python | mit | 1,758 |
######################################################################
#
# Copyright (C) 2013
# Associated Universities, Inc. Washington DC, USA,
#
# This library is free software; you can redistribute it and/or modify it
# under the terms of the GNU Library General Public License as published by
# the Free Software Fo... | e-koch/VLA_Lband | 16B/pipeline4.7.1_custom/EVLA_pipe_applycals.py | Python | mit | 3,013 |
VERSION_TUPLE = (0, 5, 4)
VERSION = ".".join(map(str, VERSION_TUPLE))
from .chain import Chain
from .text import Text, NewlineText
from .splitters import split_into_sentences
from .utils import combine
| nosae/TwitterBot | markovify/__init__.py | Python | mit | 203 |
import math
from bitarray import bitarray
class LZ77Compressor:
"""
A simplified implementation of the LZ77 Compression Algorithm
"""
MAX_WINDOW_SIZE = 400
def __init__(self, window_size=20):
self.window_size = min(window_size, self.MAX_WINDOW_SIZE)
self.lookahead_buffer_size = 15 # length of match is at mo... | ohmtrivedi/LZ77-Compressor | src/LZ77.py | Python | mit | 5,184 |
# -*- coding: utf-8 -*-
#
# NGI_dashboards-kpiupdater documentation build configuration file, created by
# sphinx-quickstart on Mon Oct 9 14:11:16 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogen... | remiolsen/NGI_dashboards | docs/source/conf.py | Python | mit | 8,397 |
"""
sdns_tests.
"""
import time
# TODO: move to swat
from mininet.net import Mininet
from mininet.node import RemoteController # CPULimitedHost
from mininet.link import TCLink
from mininet.cli import CLI
from nose.plugins.skip import SkipTest # Skip
from minicps.sdns import OF_MISC, POXL2Pairs
from minicps.utils ... | scy-phy/minicps | tests/sdns_tests.py | Python | mit | 4,517 |
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.core.urlresolvers import reverse
from model_utils.models import TimeStampedModel, MonitorField
from audit_log.models import AuthStampedModel
from contributions.models import Pledge
class BasePromotion(AuthStampedModel, ... | phani00/tovp | tovp/promotions/models.py | Python | mit | 12,109 |
import heapq
import numpy
from chainer import cuda
from chainer import flag
class Variable(object):
"""Array with a structure to keep track of computation.
Every variable holds a data array of type either :class:`numpy.ndarray` or
:class:`cupy.ndarray`.
A Variable object may be constructed in two... | muupan/chainer | chainer/variable.py | Python | mit | 13,060 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Installation()
result.template = "object/installation/battlefield/destructible/shared_bfield_gungan_wall_ruined_sm... | anhstudios/swganh | data/scripts/templates/object/installation/battlefield/destructible/shared_bfield_gungan_wall_ruined_sm_s02.py | Python | mit | 499 |
import copy
import sys
import unittest
import os
import time
from app.plans import k8s_2t
try:
import kvm_player
except ImportError:
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import kvm_player
@unittest.skipIf(os.getenv("DISK_OK") is None, "Skip because DISK_OK=")
cla... | kirek007/enjoliver | app/tests/euid/plans/test_kvm_plan_k8s_enjolivage_disk.py | Python | mit | 11,216 |
class Solution(object):
def lengthLongestPath(self, input):
"""
:type input: str
:rtype: int
"""
if input is None or len(input) == 0:
return 0
lines = input.split('\n')
last_level_len = [0] * (len(lines) + 1); max_len = 0
for line in lines:... | qiyuangong/leetcode | python/388_Longest_Absolute_File_Path.py | Python | mit | 727 |
import os
import yaml
import click
import logging
import urllib
import urlparse
import requests
from jsongraph.uri import check as check_uri
log = logging.getLogger()
class GraphKitException(click.ClickException):
""" Base class for library exceptions. """
def show(self):
log.error(self)
exit_... | tmtmtmtm/graphkit | graphkit/util.py | Python | mit | 1,459 |
class Track(object):
"""
Track class to contain, select, and manage :class:`~polyglotdb.acoustics.classes.TimePoint` objects
Attributes
----------
points : iterable of :class:`~polyglotdb.acoustics.classes.TimePoint`
Time points with values of the acoustic track
"""
def __init__(sel... | MontrealCorpusTools/PolyglotDB | polyglotdb/acoustics/classes.py | Python | mit | 5,140 |
#!/usr/bin/env python
"""
Tests of ugali stats
"""
import unittest
# Execute tests in order: https://stackoverflow.com/a/22317851/4075339
unittest.TestLoader.sortTestMethodsUsing = None
import numpy as np
import scipy.stats
import ugali.utils.stats
def generate_distribution(p1=[1.0,0.1,10000],p2=[-1.0,0.6,30000]):
... | kadrlica/ugali | tests/test_stats.py | Python | mit | 4,439 |
# -*- coding: utf-8 -*-
"""
pyvisa.ctwrapper._ct
~~~~~~~~~~~~~~~~~~~~
Cross platform helper of ctypes.
This file is part of PyVISA.
:copyright: 2014 by PyVISA Authors, see AUTHORS for more details.
:license: MIT, see LICENSE for more details.
"""
from __future__ import division, unicode_lite... | rubund/debian-pyvisa | pyvisa/ctwrapper/cthelper.py | Python | mit | 2,701 |
from django import forms
from schedule.models import Event
import datetime
import time
class GlobalSplitDateTimeWidget(forms.SplitDateTimeWidget):
def __init__(self, hour24 = False, attrs=None, *args, **kwargs):
"""
hour24 is a boolean. If set to true it will display like a normal
SplitDate... | indro/t2c | apps/external_apps/schedule/forms.py | Python | mit | 2,370 |
from django.db import transaction
from django.utils.translation import ugettext_lazy as _
from python_freeipa import exceptions as freeipa_exceptions
from rest_framework import decorators, exceptions, response, status
from waldur_core.core import views as core_views
from . import backend, filters, models, serializers... | opennode/nodeconductor-assembly-waldur | src/waldur_freeipa/views.py | Python | mit | 3,548 |
# -*- coding: utf-8 -*-
# todo/todo.py
from flask import Flask, g
app = Flask(__name__)
import os
import sqlite3
app.config.update(dict(
SECRET_KEY = 'bardzosekretnawartosc',
DATABASE = os.path.join(app.root_path, 'db.sqlite'),
SITE_NAME = 'Moje zadania'
))
def connect_db():
"""Nawiazywanie połacze... | roninek/python101 | docs/webapps/todo/todo_z3.py | Python | mit | 943 |
from myhdl import Signal, intbv, concat, always, always_comb
from . import SERDESInterface
| cfelton/rhea | rhea/vendor/output_serdes.py | Python | mit | 97 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/ship/components/weapon_capacitor/shared_cap_tiefighter_basic.iff"
r... | anhstudios/swganh | data/scripts/templates/object/tangible/ship/components/weapon_capacitor/shared_cap_tiefighter_basic.py | Python | mit | 495 |
import os
import re
import json
import base64
import logging
import datetime
import time
import copy
import decimal
import cgi
import numpy
import pymongo
from lib import config, util, util_czarcoin
D = decimal.Decimal
def get_market_price(price_data, vol_data):
assert len(price_data) == len(vol_data)
asser... | Peertokens/peerblockd | lib/components/assets_trading.py | Python | mit | 37,179 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2013, Jan-Piet Mens <jpmens () gmail.com>
#
# This file is part of Ansible
#
# Ansible 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 L... | muff1nman/ansible-modules | net/resolver.py | Python | mit | 2,503 |
"""
This library provides a set of basic utilities for interacting with MediaWiki's
"action" API -- usually available at /w/api.php. The most salient feature of
this library is the `Session` class that provides a
connection session that sustains a logged-in user status and provides
convenience functions for calling th... | mediawiki-utilities/python-mwapi | mwapi/__init__.py | Python | mit | 829 |
"""
Provides all the model run schedulers.
"""
from smif.controller.run.dafni_run_scheduler import DAFNIRunScheduler
# import classes for access like ::
# from smif.controller.run import SubProcessRunScheduler
from smif.controller.run.subprocess_run_scheduler import SubProcessRunScheduler
# Define what should... | nismod/smif | src/smif/controller/run/__init__.py | Python | mit | 443 |
# stdlib imports
import re
# third-party imports
from babel import Locale
# Locale code = <language>_<territory> (ie 'en_US')
# to pick locale codes see http://cldr.unicode.org/index/cldr-spec/picking-the-right-language-code
# also see http://www.sil.org/iso639-3/codes.asp
# Language codes defined under iso 639-1 ht... | nacelle/nacelle | nacelle/core/utils/i18n.py | Python | mit | 2,372 |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
class FilterModule(object):
def filters(self):
return {
'verchg': self.mark_devel
}
def mark_devel(self, var):
result = var.split('-')[0] + '-devel'
return result
| F5Networks/f5-ansible-modules | ansible_collections/f5networks/f5_modules/plugins/filter/markdev.py | Python | mit | 304 |
# -*- coding: utf-8 -*-
#
# Sonos Controller (SoCo) documentation build configuration file, created by
# sphinx-quickstart on Sun Feb 24 10:28:22 2013.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerat... | oyvindmal/SocoWebService | doc/conf.py | Python | mit | 8,108 |
# -*- coding: utf-8 -*-
# Copyright 2012 splinter 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 tempfile
import time
import re
import sys
from contextlib import contextmanager
from selenium.common.exceptions import NoSuchEle... | harish0507/GMapsScrapper | lib/splinter-0.7.2/splinter/driver/webdriver/__init__.py | Python | mit | 21,065 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('lan', '__first__'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations... | CasualGaming/studlan | apps/lottery/migrations/0001_initial.py | Python | mit | 2,741 |
#!/usr/bin/env python
# coding: utf-8
class Solution(object):
def findErrorNums(self, nums):
"""
:type nums: List[int]
:rtype: List[int]
"""
n = len(nums)
minus = n * (n + 1) // 2 - sum(nums) # miss - dup
minus2 = sum(i * i for i in range(1, n + 1)) - sum(m... | feigaochn/leetcode | p645_set_mismatch.py | Python | mit | 623 |
#!/usr/bin/env python2
import unittest
import tempfile
import shutil
import os
from pymaptools.io import open_gz, read_text_resource, GzipFileType, \
JSONLineReader
class TestIO(unittest.TestCase):
def setUp(self):
self.sample_strings = ["a\n", "#b\n", "c\n"]
self.tmp_dir = tempfile.mkdtemp(... | Livefyre/pymaptools | tests/test_io.py | Python | mit | 2,022 |
class HttpRequestError(Exception):
"""HTTP error.
Shortcut for raising HTTP errors with custom code, message and headers.
:param int code: HTTP Error code.
:param str message: (optional) Error message.
:param list of [tuple] headers: (optional) Headers to be sent in response.
based on https://g... | botstory/botstory | botstory/integrations/commonhttp/errors.py | Python | mit | 693 |
#############################################################################
#
# Copyright (c) 2008 by Casey Duncan and contributors
# All Rights Reserved.
#
# This software is subject to the provisions of the MIT License
# A copy of the license should accompany this distribution.
# THE SOFTWARE IS PROVIDED "AS IS", W... | NiclasEriksen/py-towerwars | src/lepton/examples/flyby.py | Python | cc0-1.0 | 2,996 |
__author__ = 'aniket'
import freenect
import cv2
import numpy as np
kernel = nfrp.ones((5,5),np.uint8)
freenect.C
def grayscale():
maske = np.zeros((480,640,3))
a = freenect.sync_get_depth(format=freenect.DEPTH_MM)[0]
mask = a == 0
a[mask] = 8000
mask1 = a > 1000
b = freenect.sync_get_video()... | amirajdhawan/eYSIP_2015_Depth_Mapping_Kinect | Research/MyProjects/Codec.py | Python | cc0-1.0 | 554 |
# Generates RGB images.
from simple_image import createImage as createSimpleImage
from ntndarray import createImage as createNormativeImage
from pvaccess import PvaServer, PvScalarArray, STRING
from array import array
from time import sleep
data = ([0] * 20 + [127] * 10 + [255] * 10) * 1000
image = createSimpleImage(... | ESSICS/org.csstudio.display.builder | org.csstudio.display.builder.model/examples/image_server/colorsdemo.py | Python | epl-1.0 | 2,567 |
from thlib.side.Qt import QtCore
class Output(QtCore.QObject):
written = QtCore.Signal(unicode)
flushed = QtCore.Signal()
def __init__(self, std, parent_stream=None, parent=None):
"""
Initialize default settings.
"""
self.__parent_stream = parent_stream
super(O... | listyque/TACTIC-Handler | thlib/side/console/core/stream/output.py | Python | epl-1.0 | 1,744 |
#!/usr/bin/python
## Create Service-Now incident from Zabbix
## Copyright (C) 2001-2015 Jan Garaj - www.jangaraj.com
## Doc: http://wiki.servicenow.com/index.php?title=Python_Web_Services_Client_Examples
## WSDL doc: https://<your_instance>.service-now.com/incident.do?WSDL
##
debug = 0 # 0/1 - ena... | jangaraj/zabbix-script-servicenow | zabbix-create-service-now-incident.py | Python | gpl-2.0 | 6,635 |
from django.conf.urls import patterns, include, url
from dajaxice.core import dajaxice_autodiscover, dajaxice_config
dajaxice_autodiscover()
from django.conf import settings
from django.conf.urls.static import static
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover... | luk156/minimo | minimo/urls.py | Python | gpl-2.0 | 1,746 |
'''viewhtml - unpack html message and display with browser
'''
# $Id$
import email, email.Errors, email.Iterators, email.Utils
import os.path, re, shutil, sys, tempfile
from muttils import pybrowser, ui, util
try:
import inotifyx
except ImportError:
import time
class viewhtml(pybrowser.browser):
def __... | cwarden/muttils | muttils/viewhtmlmsg.py | Python | gpl-2.0 | 3,979 |
import pdb
from types import *
def findCfg(key,cfgLst,default=None):
for a in cfgLst:
if a.has_key(key): return a[key]
return default
class Dot:
"""
The dot class lets you access fields either through field notation (.)
or dictionary notation ([]).
"""
def shouldRecurse(self,thing):
return (typ... | OpenClovis/SAFplus-Availability-Scalability-Platform | src/ide/dot.py | Python | gpl-2.0 | 6,705 |
import numpy as np
import tensorflow as tf
import wandb
from util import Images
# Add random noise to images.
def add_noise(x_train, x_test):
noise_factor = 0.5
x_train_noisy = x_train + \
np.random.normal(loc=0.0, scale=noise_factor, size=x_train.shape)
x_test_noisy = x_test + \
np.random... | lukas/ml-class | examples/keras-autoencoder/denoising_autoencoder.py | Python | gpl-2.0 | 1,430 |
from django.conf.urls import *
from django.conf import settings
from django.contrib import admin
from django.conf.urls.static import static
from django.views.generic import RedirectView
from django.contrib.auth.decorators import user_passes_test
from django.views.decorators.cache import cache_control
import pages
impo... | evangeline97/localwiki-backend-server | localwiki/main/urls.py | Python | gpl-2.0 | 3,509 |
#!/usr/bin/python -uB
# -*- coding: utf-8 -*-
import sys
import getopt
import logging
import random
import json
import gzip
import rdflib
import numpy as np
import scipy.sparse as sp
def main(argv):
kb_path, format, block_size = '/dev/stdin', 'nt', 10000
train_path, valid_path, test_path = 'train.nt', 'val... | knowledgegraph/schema | tools/rdf_splitter.py | Python | gpl-2.0 | 3,642 |
#! /usr/bin/env python
#
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions ... | google/mysql-protobuf | protobuf/python/google/protobuf/internal/proto_builder_test.py | Python | gpl-2.0 | 3,631 |
"""Basic Layer of Neural Network
This module describes a base layer of neural network (not including ConvNet)
It can be base of:
+ Identity layer
+ Tanh layer
+ Sigmoid layer
+ ReLU layer
+ Softmax layer
"""
import theano.tensor as T
import nnet.util as util
class Layer(object):
"""Abstract layer for Feed-for... | Tejas-Khot/deep-learning | nnet/layer.py | Python | gpl-2.0 | 2,636 |
# #
# Copyright 2009-2017 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://www.vscentrum.be),
# Flemish Research Foundation (... | migueldiascosta/easybuild-framework | easybuild/framework/easyblock.py | Python | gpl-2.0 | 120,005 |
# -*- coding: utf-8 -*-
#
# This file is part of Zenodo.
# Copyright (C) 2017 CERN.
#
# Zenodo 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 v... | slint/zenodo | zenodo/modules/openaire/__init__.py | Python | gpl-2.0 | 1,132 |
# The build code for the site.
# -------- Standard Libraries -------- #
import os
import re
import subprocess
# -------- Third Party Libraries -------- #
import markdown
# -------- Project Libraries -------- #
import megaphysics.views
from megaphysics.urls import generate_links
from megaphysics.minify import co... | Ap0c/megaphysics.github.io | megaphysics/build.py | Python | gpl-2.0 | 3,521 |
# This work is licensed under the GNU GPLv2 or later.
# See the COPYING file in the top-level directory.
import datetime
from . import lib
###################################
# UI tests for the 'About' dialog #
###################################
def testAbout(app):
app.root.find("Help", "menu").click()
ap... | virt-manager/virt-manager | tests/uitests/test_about.py | Python | gpl-2.0 | 686 |
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
import os
import re
import sys
import functools
import subprocess
import ConfigParser
windows = sys.platform == 'win32'
linux = sys.platform.startswith('linux')
macosx =... | cnvogelg/fs-uae-gles | launcher/fs_uae_launcher/fs.py | Python | gpl-2.0 | 10,421 |
#!/usr/bin/python
import optparse
import os
import platform
import socket
import subprocess
import sys
PROG = "r" + "$Rev$".strip("$ ").replace("Rev: ", "")
PYTHON = os.path.basename(sys.executable)
build_type = ""
vs_target = ""
s60_target = ""
no_test = False
no_pjsua_test = False
#
# Get gcc version
#
def gcc_ver... | xhook/asterisk-v11 | res/pjproject/tests/automated/configure.py | Python | gpl-2.0 | 11,485 |
from decorators import get_items
def add(stack):
"""
Adds the two top numbers ontop of the stack
"""
item_1 = stack.pop()
item_2 = stack.pop()
result = item_2 + item_1
stack.append(result)
def subtract(stack):
"""
Subtracts the second from the first top numbers ontop of the stack... | chiraldev/rpn | rpn/functions.py | Python | gpl-2.0 | 4,418 |
from database import DBConstants
from parsers.Parser import Parser
import pandas as pd
import numpy as np
import sys
class LiveStatsGenerator:
# The normalize_perf parameter is needed to correctly compute the number of perf metrics accordingly to the measurement interval
def extract(self, table, DBconn, start... | stefanodoni/mtperf | statistics/LiveStatsGenerator.py | Python | gpl-2.0 | 3,271 |
DATE_FORMAT = 'l, N j, Y'
| tanzquotient/tq_website | tq_website/formats/en/formats.py | Python | gpl-2.0 | 26 |
# -*- coding: utf-8 -*-
#
# Hebel documentation build configuration file, created by
# sphinx-quickstart on Mon Nov 25 19:20:29 2013.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All c... | dinnozap/hebel | docs/conf.py | Python | gpl-2.0 | 9,313 |
#!/usr/bin/python
#
# Copyright (C) 2009 Julian Andres Klode <jak@debian.org>
#
# Copying and distribution of this file, with or without modification,
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved.
"""Unit tests for verifying the correctness of hashsums in a... | JoliOS/python-apt | tests/test_hashes.py | Python | gpl-2.0 | 4,387 |
# -*- coding: utf-8 -*-
#
# This file is part of EventGhost.
# Copyright © 2005-2020 EventGhost Project <http://www.eventghost.net/>
#
# EventGhost 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 versi... | tfroehlich82/EventGhost | eg/PythonPaths.py | Python | gpl-2.0 | 1,915 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
Explode.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
*******************************... | dracos/QGIS | python/plugins/processing/algs/qgis/Explode.py | Python | gpl-2.0 | 3,404 |
#-----------------------------------------------------------------------------
# Copyright (c) 2013-2019, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this s... | etherkit/OpenBeacon2 | client/win/venv/Lib/site-packages/PyInstaller/hooks/hook-xml.dom.domreg.py | Python | gpl-3.0 | 471 |
import _surface
import chimera
try:
import chimera.runCommand
except:
pass
from VolumePath import markerset as ms
try:
from VolumePath import Marker_Set, Link
new_marker_set=Marker_Set
except:
from VolumePath import volume_path_dialog
d= volume_path_dialog(True)
new_marker_set= d.new_marker_set
marker_set... | batxes/4Cin | SHH_INV_models/SHH_INV_models_final_output_0.2_-0.1_10000/SHH_INV_models29492.py | Python | gpl-3.0 | 17,596 |
import _surface
import chimera
try:
import chimera.runCommand
except:
pass
from VolumePath import markerset as ms
try:
from VolumePath import Marker_Set, Link
new_marker_set=Marker_Set
except:
from VolumePath import volume_path_dialog
d= volume_path_dialog(True)
new_marker_set= d.new_marker_set
marker_set... | batxes/4Cin | Six_mouse_models/Six_mouse_models_final_output_0.2_-0.1_11000/Six_mouse_models45856.py | Python | gpl-3.0 | 18,213 |
# -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest
from ..quality_goal.test_quality_goal import get_quality_goal
from .quality_review import review
class TestQualityReview(unittest.TestCase):
def test_review_c... | saurabh6790/erpnext | erpnext/quality_management/doctype/quality_review/test_quality_review.py | Python | gpl-3.0 | 632 |
import numpy
from . import LossFunction
class ExponentialLoss(LossFunction):
""" The class implements the exponential loss function for the boosting framework."""
def loss(self, targets, scores):
"""The function computes the exponential loss values using prediction scores and targets.
It can ... | bioidiap/bob.ip.facedetect | bob/learn/boosting/ExponentialLoss.py | Python | gpl-3.0 | 1,349 |
#-----------------------------------------------------------------------------
# Copyright (c) 2013-2019, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this s... | etherkit/OpenBeacon2 | client/win/venv/Lib/site-packages/PyInstaller/loader/rthooks/pyi_rth_nltk.py | Python | gpl-3.0 | 534 |
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
# Copyright 2012 Canonical
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
"""Autopilot tests and emulato... | ubports-weblate/gallery-app | tests/autopilot/gallery_app/__init__.py | Python | gpl-3.0 | 359 |
#!/usr/bin/env python
# --!-- coding: utf8 --!--
from PyQt5.QtCore import pyqtSignal, Qt, QTimer, QRect
from PyQt5.QtGui import QBrush, QCursor, QPalette, QFontMetrics, QColor
from PyQt5.QtWidgets import QWidget, QListWidgetItem, QToolTip, QStyledItemDelegate, QStyle
from manuskript.enums import Character
from manuskr... | gedakc/manuskript | manuskript/ui/cheatSheet.py | Python | gpl-3.0 | 6,913 |
# -*- coding: utf-8 -*-
# Copyright (c) 2010 - 2015 Detlev Offenbach <detlev@die-offenbachs.de>
#
"""
Package implementing the offline storage related dialogs and models.
"""
| testmana2/test | Helpviewer/OfflineStorage/__init__.py | Python | gpl-3.0 | 177 |
from openest.lincombo.pooling import *
from numpy.testing import *
def test_disagg():
mv = lincombo_pooled([4, 7, 2], [1, 3, 1], [[1, 0], [0, 1], [1, 0]])
assert_equal(mv.means, [3, 7])
assert_equal(mv.big_sigma, [[.5, 0], [0, 9.]])
def test_single():
mv = lincombo_pooled([0, 1, 0], [1, 1, 2], [[1], [... | ClimateImpactLab/open-estimate | openest/test/lincombo/test_pooling.py | Python | gpl-3.0 | 1,007 |
#init
__all__ = [
'ep_pygame_desktop',
]
from ep_desktop_pygame import * | mypinballs/sternindianajones | ep/__init__.py | Python | gpl-3.0 | 78 |