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
from setuptools import setup, find_packages
README = open('README.md').readlines()
setup(
name='django-msgpackfield',
version='0.15',
packages=find_packages(),
include_package_data=True,
license='MIT License',
description=README[2].rstrip('\n'),
long_description=''.... | vakorol/django-msgpackfield | setup.py | Python | mit | 1,098 |
#!/usr/bin/env python
from __future__ import print_function
import roslib
roslib.load_manifest('spheretrax_ros')
import rospy
from spheretrax_ros.spheretrax_publisher import SphereTrax_Publisher
rospy.init_node('spheretrax_publisher_test')
pub = SphereTrax_Publisher()
cnt = 0
data = {}
while not rospy.is_shutdown():... | willdickson/spheretrax_ros | nodes/test.py | Python | bsd-2-clause | 636 |
# drv_pylab.py
#
# Copyright 2009 charley <charley@hosts-137-205-164-145.phys.warwick.ac.uk>
#
# 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 ... | Charley-fan/metaArray | drv_pylab.py | Python | gpl-3.0 | 13,872 |
import os
from wheelerdata.load.base import Wheelerdata
class Butterfly(Wheelerdata):
"""Butterfly data"""
def __init__(self):
super(Butterfly, self).__init__()
self.scodes = [4, 5, 7, 17, 18, 19, 21, 22, 23, 25, 26, 30]
# self.scodes = [4, 5, 7, 17, 18, 19, 20, 21, 22, 23, 25, 26, 3... | parenthetical-e/wheelerdata | load/butterfly.py | Python | bsd-2-clause | 1,030 |
'''
Created on 24 feb. 2017
@author: fara
'''
from matplotlib import use
#use('TkAgg')
from __builtin__ import int
import matplotlib.pyplot as plt
import numpy as np
from show import show
def displayData(X):
'''
%DISPLAYDATA Display 2D data in a nice grid
% [h, display_array] = DISPLAYDATA(X, example_w... | ramondiez/machine-learning | ex3/displayData.py | Python | gpl-3.0 | 2,360 |
# -- coding: utf-8 --
# Note that we import as `DjangoRequestFactory` and `DjangoClient` in order
# to make it harder for the user to import the wrong thing without realizing.
from __future__ import unicode_literals
import django
from django.conf import settings
from django.test.client import Client as DjangoCl... | hsfzxjy/wisecitymbc | site_packages/rest_framework/test.py | Python | gpl-2.0 | 6,436 |
import asyncio
from base import Event
class TerminalEmulator(object):
def __init__(self):
super(TerminalEmulator, self).__init__()
self._logger = None
self.revision = 0
self._width = 0
self._height = 0
self.lines = []
self.cursorX = 0
self.cursorY ... | squahtx/hal9000 | plugins/base/terminalemulator.py | Python | mit | 8,289 |
#!/usr/bin/env python2.5
#
# Copyright 2008 the Melange authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... | MatthewWilkes/mw4068-packaging | src/melange/src/soc/logic/models/role.py | Python | apache-2.0 | 4,706 |
# Small ipython extensions
import sys
import subprocess
def pip(line):
"""Execute a pip command.
Do:
%pip --help
to get an overview.
Note: when doing '%pip uninstall ...', use the -y option
to avoid being prompted (which does not work using %pip).
"""
do_pip(line.split())
def do_p... | stephanh42/ipython_pip_magics | ipython_pip_magics/__init__.py | Python | mit | 1,829 |
#!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/google/appengine/api/oauth/oauth_api.py | Python | bsd-3-clause | 8,814 |
import numpy as np
import theano
import theano.tensor as T
from util import debug_input_data, show_debug_sample
from printing import print_section, print_test, print_valid, print_training
import random, sys, timeit
from sdg import Backpropagation
import interface.server
from config import visual_params
from wrapper i... | olavvatne/CNN | evaluator.py | Python | mit | 13,092 |
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord
from Bio import SeqIO
#os imports
import os
from sys import stdin,argv
import sys
from optparse import OptionParser
def name_set(in_names):
name_set = set([])
for i in in_names:
if not i.startswith("#"):
name_set.add(i)
return... | widdowquinn/THAPBI | Phyt_ITS_identifying_pipeline/database_files/ITS_only_working/rewrite_as_fasta.py | Python | mit | 2,075 |
# 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... | airbnb/caravel | superset/migrations/versions/b318dfe5fb6c_adding_verbose_name_to_druid_column.py | Python | apache-2.0 | 1,242 |
from datetime import datetime
from unittest.mock import PropertyMock, patch
from django.test import SimpleTestCase
from ws import models
from ws.utils import model_dates as utils
class MissedLectureTests(SimpleTestCase):
""" Test the logic that checks if a participant has missed lectures. """
def test_lega... | DavidCain/WinterSchool | ws/tests/utils/test_model_dates.py | Python | gpl-3.0 | 4,964 |
import cPickle as pickle
import urllib2 as web
import re
import os
from time import sleep
class TenWeek(object):
def __init__(self):
self.file = 'tenw.PICKLE'
self.tenw = dict()
self.todayNotice = list()
self.load()
self.moodle()
self.dump()
def load(self):
if not os.path.exists(self.file):
with o... | thtrieu/nyose | TenWeek.py | Python | gpl-3.0 | 9,256 |
import logging
import os
import os.path
import shutil
import subprocess
import tempfile
import time
from six.moves import urllib
import uuid
from six.moves.urllib.parse import urlparse # pylint: disable=E0611,F0401
from test.service import ExternalService, SpawnedService
from test.testutil import get_open_port
log =... | gamechanger/kafka-python | test/fixtures.py | Python | apache-2.0 | 9,197 |
from ldapcherry.roles import Roles
from ldapcherry.exceptions import DumplicateRoleKey, MissingKey, DumplicateRoleContent, MissingRolesFile
from ldapcherry.pyyamlwrapper import DumplicatedKey, RelationError
from yaml import load, dump
import yaml
try:
from yaml import CLoader as Loader, CDumper as Dumper
except Im... | kakwa/ldapcherry | misc/debug_roles.py | Python | mit | 1,028 |
import os
import sys
from copy import copy
from watchdog.events import RegexMatchingEventHandler
if sys.platform == "darwin":
from watchdog.observers.polling import PollingObserver as Observer
else:
from watchdog.observers import Observer
from microproxy.log import ProxyLogger
logger = ProxyLogger.get_logger(... | mike820324/microProxy | microproxy/interceptor/plugin_manager.py | Python | mit | 3,707 |
# 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
# distrib... | sjsucohort6/openstack | python/venv/lib/python2.7/site-packages/openstackclient/tests/common/test_context.py | Python | mit | 8,911 |
#This program will create random numbers for all of the different
# types of dice
#import necessary libraries
from random import randint
#defining the functions
def d4():
d4 = randint(1, 4)
return d4
def d6():
d6 = randint(1, 6)
return d6
def d8():
d8 = randint(1, 8)
return d8
def d12()... | CelebornMcGinnis/Dungeons-and-Monsters | RandomDiceNumbers.py | Python | mit | 2,605 |
# Copyright 2018 The Cirq Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | quantumlib/Cirq | cirq-core/cirq/transformers/heuristic_decompositions/two_qubit_gate_tabulation_test.py | Python | apache-2.0 | 3,830 |
import json
import mimetypes
import os
from flask import send_file, request, flash, redirect, jsonify
from utils import random_string
ALLOWED_EXTENSIONS = set(['png'])
def allowed_file(filename):
return '.' in filename and \
filename.rsplit('.', 1)[1] in ALLOWED_EXTENSIONS
def add_routes(app):
... | boehlke/openslides-multiinstance-backend | python/multiinstance/upload.py | Python | mit | 1,700 |
# -*- python -*-
# Copyright (C) 2009-2017 Free Software Foundation, Inc.
# 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 3 of the License, or
# (at your option) any later versio... | jocelynmass/nrf51 | toolchain/arm_cm0/arm-none-eabi/lib/thumb/v7-m/libstdc++.a-gdb.py | Python | gpl-2.0 | 2,482 |
from flask import Blueprint
from flask import current_app
from flask import request
from flask import jsonify
from flask import abort
from flask import render_template
from flask import redirect
from flask import url_for
from flask import flash
from werkzeug.exceptions import NotFound
from printus.web.models import Re... | matrixise/printus | old_code/printus/web/views/general/__init__.py | Python | mit | 2,782 |
# LADITools - Linux Audio Desktop Integration Tools
# Copyright (C) 2007-2010, Marc-Olivier Barre <marco@marcochapeau.org>
# Copyright (C) 2007-2009, Nedko Arnaudov <nedko@arnaudov.name>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as pu... | LADI/laditools | laditools/jack_configure.py | Python | gpl-3.0 | 5,047 |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
#
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2... | dietrichc/streamline-ppc-reports | tests/adwords_test.py | Python | apache-2.0 | 18,546 |
# Copyright 2021 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, ... | google/tink | testing/cross_language/jwt_validation_test.py | Python | apache-2.0 | 22,698 |
from django.db import models
from django.utils.translation import ugettext_lazy as _
from konfera.models.countries import COUNTRIES
from konfera.models.abstract import KonferaModel
class Speaker(KonferaModel):
TITLE_UNSET = 'none'
TITLE_MR = 'mr'
TITLE_MS = 'ms'
TITLE_MX = 'mx'
COUNTRY_DEFAULT = ... | pyconsk/django-konfera | konfera/models/speaker.py | Python | mit | 1,385 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 128 , FREQ = 'D', seed = 0, trendtype = "Lag1Trend", cycle_length = 7, transform = "Integration", sigma = 0.0, exog_count = 20, ar_order = 12); | antoinecarme/pyaf | tests/artificial/transf_Integration/trend_Lag1Trend/cycle_7/ar_12/test_artificial_128_Integration_Lag1Trend_7_12_20.py | Python | bsd-3-clause | 267 |
# coding=utf-8
# Copyright 2018 The Tensor2Tensor Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | mlperf/training_results_v0.5 | v0.5.0/google/research_v3.32/gnmt-tpuv3-32/code/gnmt/model/t2t/tensor2tensor/data_generators/video_generated.py | Python | apache-2.0 | 5,705 |
import asyncio
from db_object import DBItem
from core import BotMiddleware, UsesMiddleware, FakeRAWMiddleware, FakeActionMiddleware, LoggerMiddleware, Log, UsesLogger
from actions import (
ReplyAction,
QueuedNotificationAction,
PlayOneSongAction,
ListQueueAction,
DumpQueue
)
from tinydb import TinyDB, where
f... | aeturnum/NeonDJBot | middleware.py | Python | gpl-3.0 | 10,013 |
# Copyright 2015 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... | TakayukiSakai/tensorflow | tensorflow/contrib/rnn/python/ops/rnn_cell.py | Python | apache-2.0 | 20,382 |
import os, sys
def load_setup_modules(client_dir):
try:
sys.path.insert(0, client_dir)
import setup_modules
finally:
sys.path.pop(0)
return setup_modules
dirname = os.path.dirname(sys.modules[__name__].__file__)
virt_test_dir = os.path.abspath(os.path.join(dirname, ".."))
sys.path.... | sathnaga/virt-test | libguestfs/common.py | Python | gpl-2.0 | 1,347 |
#!/usr/bin/env python3
# encoding: UTF-8
# This file is part of turberfield.
#
# Turberfield 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 ve... | tundish/turberfield-dialogue | turberfield/dialogue/test/test_matcher.py | Python | gpl-3.0 | 4,798 |
# -*- coding: utf-8 -*-
import json
import logging
import requests
logger = logging.getLogger(__name__)
class OMDBApiClient(object):
URL = "http://www.omdbapi.com/"
def get_movie_info(self, title=None, id=None):
assert(title or id)
params = {}
if not title is None:
params[... | rafallo/p2c | catalogs/info_clients/omdbclient.py | Python | mit | 1,630 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015-2018 CERN.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Version information for Invenio-Search.
This file is imported by ``invenio_search... | tiborsimko/invenio-search | invenio_search/version.py | Python | mit | 444 |
# Copyright (c) 2015. Librato, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions a... | librato/librato-python-web | test/instrumentor_/test_logging.py | Python | bsd-3-clause | 3,795 |
import extra_parse
import data
import sys
# Call with Pyth program on STDIN.
global J_used
global K_used
J_used = False
K_used = False
nums = '0123456789'
def make_tree(code):
if code == '':
return [], ''
char, code = code[0], code[1:]
if char == '.' and code[0] not in nums:
char += cod... | jakobkogler/pyth | tree.py | Python | mit | 4,496 |
# -*- coding: utf-8 -*-
"""
Authors: Tim Hessels
UNESCO-IHE 2017
Contact: t.hessels@unesco-ihe.org
Repository: https://github.com/wateraccounting/wa
Module: Collect/DEM
"""
#General modules
import os
import sys
# Water Accounting modules
from wa.Collect.DEM.DataAccess import DownloadData
def main(Dir, latli... | wateraccounting/wa | Collect/DEM/HydroSHED_Dir.py | Python | apache-2.0 | 2,097 |
from FlaskBackend import *
import sys
import json
import datetime
import logging
app.debug = True
DATABASE = './db/directory.db'
# Setup logging redirection
logger = logging.getLogger('directory')
hdlr = logging.FileHandler('./directory.log')
formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
hdl... | chris-wood/CCNSink | submission/code/GatewayDirectory.py | Python | mit | 3,429 |
import random
from collections import defaultdict
matching = defaultdict(int,{
('P','K'):3,
('K','G'):3,
('G','L'):3,
('L','P'):3,
('K','P'):-3,
('G','K'):-3,
('L','G'):-3,
('P','L'):-3
})
def dieroll(n):
return sum([random.randrange(6) + 1 for i in range(n)])
class Player(object):
def __... | Shashwat986/BattleSim | battlesim.py | Python | mit | 3,338 |
import numpy as np
X = np.array([[-1, -1], [-2, -1], [1, 1], [2, 1]])
y = np.array([1, 1, 2, 2])
from sklearn.svm import SVC
clf = SVC()
clf.fit(X, y)
print(clf.predict([[-0.8, -1]])) | askldjd/udacity-machine-learning | svm/test.py | Python | mit | 183 |
##############################################################################
#
# Copyright (c) 2006 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOF... | cutoffthetop/zeitnow | bootstrap.py | Python | bsd-2-clause | 4,121 |
from time import sleep
import math
__author__ = 'sergio'
## @package clitellum.endpoints.channels.reconnectiontimers
# Este paquete contiene las clases para los temporizadores de reconexion
#
## Metodo factoria que crea una instancia de un temporizador
# instantaneo
def CreateInstantTimer():
return InstantRecon... | petxo/clitellum | clitellum/endpoints/channels/reconnectiontimers.py | Python | gpl-3.0 | 3,471 |
#!/usr/bin/env python
print " Formated number:", "{:,}".format(102403)
| daltonmenezes/learning-C | src/Python/format/thousands_separator.py | Python | mit | 72 |
# coding=utf-8
# Copyright 2020 The PI-SAC Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | google-research/pisac | pisac/metric_utils.py | Python | apache-2.0 | 7,332 |
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ------------------------------------------------------------... | Kegbot/kegbot-server | docs/source/conf.py | Python | gpl-2.0 | 5,642 |
# -------------------------------------------------------------------------------
# Name: module1
# Purpose:
#
# Author: Stefan
#
# Created: 11.07.2017
# Copyright: (c) Stefan 2017
# Licence: <your licence>
# ------------------------------------------------------------------------... | stcioc/localdocindex | python/scrape_ps3.py | Python | mit | 7,074 |
#!/usr/bin/env ipython
import os
import readline
from pprint import pprint
from marvinbot.log import configure_logging
from marvinbot import *
from marvinbot.models import *
from marvinbot.plugins import load_plugins
from marvinbot.scheduler import configure_scheduler
from marvinbot.utils import get_config, configure... | BotDevGroup/marvin | marvinbot/shell.py | Python | mit | 795 |
"""
The module sweepers exports the definition of sweep homotopies and
the tracking of solution paths defined by sweep homotopies.
A sweep homotopy is a polynomial system where some of the variables
are considered as parameters. Given solutions for some parameters
and new values for the parameters, we can track the so... | janverschelde/PHCpack | src/Python/PHCpy2/phcpy/sweepers.py | Python | gpl-3.0 | 14,790 |
{
event: {
"display_title": "",
"subtitle": "",
"capacity": 0,
"current_fill": 0,
"attendee_min_age": 21,
"lat": "",
"lon": "",
"point": "()",
"venue_id": 3,
"event_directions": "",
"private": "",
"date": DateTime,
... | cdepman/falcon_api | models.py | Python | mit | 1,540 |
def char_in_string(s1, s2):
dictionary = {}
for i in s2:
dictionary[i] = True
for i in range(len(s1)):
if s1[i] in dictionary:
return i
return -1
if __name__ == '__main__':
print char_in_string('adf6ysh', '123678')
| MichaelReiter/ProgrammingPractice | char_in_string.py | Python | mit | 240 |
"""Convergence client implementation."""
# Copyright (c) 2011-2013 Loris Cuoghi <loris.cuoghi@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 3 of the License, or
# ... | loris0/Cuivre | cuivre/client/__init__.py | Python | gpl-3.0 | 1,135 |
#!/usr/bin/env python3
import logging
import datetime
from pycaching.errors import ValueError, LoadError
from pycaching.enums import Type, Size
from pycaching.point import Point
from pycaching.util import Util
from pycaching.trackable import Trackable
# prefix _type() function to avoid colisions with cache type
_type... | mrvdb/pycaching | pycaching/cache.py | Python | lgpl-3.0 | 10,846 |
"""
Custom migration script to add slug field to all ProviderConfig models.
"""
from django.db import migrations, models
from django.utils.text import slugify
def fill_slug_field(apps, schema_editor):
"""
Fill in the slug field for each ProviderConfig class for backwards compatability.
"""
OAuth2Pro... | eduNEXT/edunext-platform | common/djangoapps/third_party_auth/migrations/0019_consolidate_slug.py | Python | agpl-3.0 | 2,165 |
import numpy as np
import pytest
from rig.type_casts import (
float_to_fix, fix_to_float,
float_to_fp, fp_to_float,
NumpyFloatToFixConverter, NumpyFixToFloatConverter
)
import struct
sz = {
8: 'b',
16: 'h',
32: 'i',
}
SZ = {k: v.upper() for k, v in sz.items()}
class TestFloatToFix(object):
... | project-rig/rig | tests/test_type_casts.py | Python | gpl-2.0 | 8,696 |
"""Test that schema creation catalog script behaves correctly."""
import os
import pytest
import xml_helpers.utils as xml_utils
from ipt.scripts.create_schema_catalog import main
from tests.testcommon import shell
from tests.testcommon.settings import TESTDATADIR
@pytest.mark.parametrize(
('sip', 'mets', 'catalo... | Digital-Preservation-Finland/dpres-ipt | tests/scripts/create_schema_catalog_test.py | Python | lgpl-3.0 | 2,486 |
# Sketch - A Python-based interactive drawing program
# Copyright (C) 1997, 1998, 2001 by Bernhard Herzog
#
# 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 Foundation; either
# version 2 of the Lice... | shumik/skencil-c | Sketch/UI/command.py | Python | gpl-2.0 | 7,045 |
#!/usr/bin/env python3
"Load data, create the validation split, train a random forest, evaluate"
"uncomment the appropriate lines to save processed data to disk"
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestClassifier as RF
from sklearn.metrics imp... | altermarkive/Resurrecting-JimFleming-Numerai | src/ml-zygmuntz--numer.ai/validate.py | Python | mit | 879 |
"""Tests the isort API module"""
import os
from io import StringIO
from unittest.mock import MagicMock, patch
import pytest
from isort import ImportKey, api
from isort.settings import Config
imperfect_content = "import b\nimport a\n"
fixed_content = "import a\nimport b\n"
fixed_diff = "+import a\n import b\n-import ... | PyCQA/isort | tests/unit/test_api.py | Python | mit | 3,619 |
import os, sys
from fastlmm.util.runner import *
import base64
import logging
import fastlmm.util.util as util
import cPickle as pickle
class LocalReducer: # implements IRunner
def __init__(self, taskcount, result_file, mkl_num_threads, logging_handler=logging.StreamHandler(sys.stdout), instream=sys.stdin):
... | MicrosoftGenomics/FaST-LMM | fastlmm/util/runner/LocalReducer.py | Python | apache-2.0 | 2,646 |
# coding: utf8
# 项目系统以及权限控制 | Geew/issue-task | project/__init__.py | Python | mit | 47 |
import logging
import os
import sys
import unittest
from sickchill.oldbeard import browser
class BrowserTestAll(unittest.TestCase):
"""
Test methods in oldbeard.browser
"""
def setUp(self):
self.here = os.path.normpath(os.path.dirname(__file__))
@unittest.skipUnless(os.name == 'nt', 'Tes... | Vagab0nd/SiCKRAGE | tests/browser_tests.py | Python | gpl-3.0 | 3,177 |
# Copyright 2012 Lee Verberne <lee@blarg.org>
#
# 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 3 of the License, or
# (at your option) any later version.
#
# This program is dis... | kafana/ubik | lib/ubik/fab/filemap.py | Python | gpl-3.0 | 3,975 |
# -*- coding:utf-8 -*-
import unittest
import mock
from employee.models import EmployeeQuestionnaire
from ..views import QuestionnaireSavedMatchesView
class QuestionnaireSavedMatchesViewTestCase(unittest.TestCase):
def test_get_query_should_return_all_user_matches(self):
# setup
view = Questionna... | hellhovnd/dentexchange | dentexchange/apps/matches/tests/test_questionnaire_saved_matches_view.py | Python | bsd-3-clause | 1,262 |
# -*- coding: utf-8 -*-
#
# test_doctests.py - Run any doctests in the package.
# Copyright (C) 2008 by Drew Hess <dhess@bothan.net>
#
# 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 vers... | dhess/lobbyists | lobbyists/tests/test_doctests.py | Python | gpl-3.0 | 1,016 |
from sqlalchemy import and_
from codeMarble_Web.database import dao
from codeMarble_Web.model.notice import Notice
def insert_notice(userIndex, content):
return Notice(userIndex=userIndex, content=content, isRead=False)
def select_notice(userIndex):
return dao.query(Notice).\
filter(Notice.u... | codeMarble/codeMarble_Web | codeMarble_Web/utils/utilNoticeQuery.py | Python | gpl-3.0 | 591 |
#@+leo-ver=5-thin
#@+node:2014spring.20140628104046.1746: * @file openshiftlibs.py
#@@language python
#@@tabwidth -4
#@+others
#@+node:2014spring.20140628104046.1747: ** openshiftlibs declarations
#!/usr/bin/env python
import hashlib, inspect, os, random, sys
#@+node:2014spring.20140628104046.1748: ** get_openshift_s... | coursemdetw/2015wcms | wsgi/openshift/openshiftlibs.py | Python | gpl-2.0 | 3,730 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2015 ADHOC SA (http://www.adhoc.com.ar)
# All Rights Reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Pu... | dvitme/odoo-addons | stock_picking_control/__openerp__.py | Python | agpl-3.0 | 1,610 |
'''This module provides a class for Balances calls to the CC API'''
from currencycloud.http import Http
from currencycloud.resources import PaginatedCollection, Balance, MarginBalanceTopUp
class Balances(Http):
'''This class provides an interface to the Balances endpoints of the CC API'''
def for_currency(s... | CurrencyCloud/currencycloud-python | src/currencycloud/clients/balances.py | Python | mit | 1,295 |
"""
Uses a folder full of SMOS *.dbl files, converts them with the ESA snap command
line tool pconvert.exe to IMG
Uses then arcpy to to convert IMG to GeoTIFF
and crops them in the process to a specified extent and compresses them
"""
import os, subprocess, shutil
import arcpy
from arcpy import env
from arcpy.sa i... | jdegene/ArcGIS-scripts | SMOS.py | Python | mit | 2,615 |
# -*- coding: utf-8 -*-
"""
werkzeug.local
~~~~~~~~~~~~~~
This module implements context-local objects.
:copyright: (c) 2011 by the Werkzeug Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from werkzeug.wsgi import ClosingIterator
from werkzeug._internal import... | rooty/minishopgae | werkzeug/local.py | Python | gpl-3.0 | 13,416 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 NEC 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
#... | openstack-ja/horizon | openstack_dashboard/api/network.py | Python | apache-2.0 | 4,543 |
#!/usr/bin/env python2
# Copyright (c) 2014-2015 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 for -rpcbind, as well as -rpcallowip and -rpcconnect
# TODO extend this test from the test framew... | janko33bd/bitcoin | qa/rpc-tests/rpcbind_test.py | Python | mit | 5,587 |
import signal
_signal_name = {}
_name_signal = {}
def _init_lookup_tables():
d = signal.__dict__
for k in d.keys():
if k[:3] == 'SIG' and k[3] != '_':
v = d[k]
if not _signal_name.has_key(v): # first name seen seems more canonical
_signal_name[v] = k
... | tutufan/subterfugue | signalmap.py | Python | gpl-2.0 | 626 |
from email.utils import parseaddr
from sqlalchemy import not_
from datetime import datetime
from pyramid.view import (
view_config,
)
from pyramid.httpexceptions import (
HTTPFound,
)
import colander
from deform import (
Form,
widget,
ValidationFailure,
)
from ..tools import (email_valid... | aagusti/e-sipkd | esipkd_ori_26012017/views/wp.py | Python | lgpl-3.0 | 27,272 |
# Link: https://oj.leetcode.com/problems/evaluate-reverse-polish-notation/
class Solution:
# @param tokens, a list of string
# @return an integer
def evalRPN(self, tokens):
"""
Use stack.
An easy problem.
Care about the accuracy !
"""
import operator as op
... | ibigbug/leetcode | evaluate-reverse-polish-notation.py | Python | mit | 802 |
from PySide import QtGui
class SettingsDialog(QtGui.QDialog):
def __init__(self, ip, interval):
super(SettingsDialog, self).__init__()
self._ip = ip
self._interval = interval
self.setupUi()
@property
def ip(self):
return self._ip
@property
def interval(se... | ilya-fedin/hilink-tray | hilink/settings.py | Python | mit | 1,153 |
from web3.module import (
Module,
)
class Net(Module):
@property
def listening(self):
return self.web3.manager.request_blocking("net_listening", [])
@property
def peerCount(self):
return self.web3.manager.request_blocking("net_peerCount", [])
@property
def version(self):
... | pipermerriam/web3.py | web3/net.py | Python | mit | 389 |
# Copyright 2016 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... | mlperf/training_results_v0.7 | Google/benchmarks/bert/implementations/bert-research-TF-tpu-v4-16/hparam.py | Python | apache-2.0 | 27,205 |
"""
Third Party Auth REST API views
"""
from collections import namedtuple
from django.conf import settings
from django.contrib.auth.models import User
from django.db.models import Q
from django.http import Http404
from django.urls import reverse
from edx_rest_framework_extensions.auth.jwt.authentication import JwtA... | msegado/edx-platform | common/djangoapps/third_party_auth/api/views.py | Python | agpl-3.0 | 16,714 |
#!/usr/bin/env python
# This file is part of nexdatas - Tango Server for NeXus data writer
#
# Copyright (C) 2012-2018 DESY, Jan Kotanski <jkotan@mail.desy.de>
#
# nexdatas is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the ... | nexdatas/tools | nxstools/nxsxml.py | Python | gpl-3.0 | 24,266 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import (unicode_literals, division, absolute_import,
print_function)
import time
from urllib import quote
from lxml.html import fromstring, tostring
from calibre.ebooks.metadata.sources.base import Source
from calibre import brows... | pikpok/calibre-helion | __init__.py | Python | mit | 4,162 |
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.action_chains import ActionChains
import PIL.Image as image
import time, re, random, os
import requests
from retrying import retry
try:
from StringIO import StringIO
except ImportError:
from io... | cysuncn/python | study/numpyStudy/retryTest.py | Python | gpl-3.0 | 2,492 |
"""
Copyright 2007 Free Software Foundation, Inc.
This file is part of GNU Radio
SPDX-License-Identifier: GPL-2.0-or-later
"""
from os import path
from gi.repository import Gtk
from . import Constants, Utils, Dialogs
class FileDialogHelper(Gtk.FileChooserDialog, object):
"""
A wrapper class for the gtk ... | mrjacobagilbert/gnuradio | grc/gui/FileDialogs.py | Python | gpl-3.0 | 6,524 |
# Django settings for testautoslug project.
import os
PROJECT_ROOT = os.path.dirname(__file__)
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@domain.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', ... | Egregors/django-autoslug-field | testautoslug/settings.py | Python | mit | 3,357 |
# vi: ts=4 expandtab
#
# Copyright (C) 2011 Canonical Ltd.
# Copyright (C) 2012 Hewlett-Packard Development Company, L.P.
#
# Author: Scott Moser <scott.moser@canonical.com>
# Author: Juerg Haefliger <juerg.haefliger@hp.com>
#
# This program is free software: you can redistribute it and/or modify
# it... | prometheanfire/cloud-init | cloudinit/config/cc_keys_to_console.py | Python | gpl-3.0 | 2,179 |
import setpath
import functions
import json
registered=True
# Filters the input table using the filters argument
# For example
# lala table :
# [1|1[2|tear-prod-rate[3|normal[4|?
# --- [0|Column names ---
# [1|no [2|colname [3|val [4|nextnode
# var 'filters' from select tabletojson(colname,val, "colname,val") from lal... | madgik/exareme | Exareme-Docker/src/exareme/exareme-tools/madis/src/functionslocal/vtable/filtertable.py | Python | mit | 3,582 |
from __future__ import absolute_import
import os
import unittest
from svtplay_dl.fetcher.dash import _dashparse
from svtplay_dl.fetcher.dash import parse_duration
from svtplay_dl.utils.parser import setup_defaults
def parse(playlist):
with open(os.path.join(os.path.dirname(os.path.realpath(__file__)), "dash-man... | olof/svtplay-dl | lib/svtplay_dl/tests/test_dash.py | Python | mit | 1,835 |
import sys
sys.path.insert(0, "/input/") #for
sys.path.insert(0, "../common/") #for local
import common
from keras.models import Sequential
from keras.layers import *
model = Sequential()
model.add(Conv2D(8, (3, 3), padding='same',
input_shape=(common.resolution_x, common.resolution_y, 3)))
model.add... | cytadela8/trypophobia | models/small_model_Artur/main.py | Python | gpl-3.0 | 1,293 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from caffe2.python import core
import caffe2.python.hypothesis_test_util as hu
import caffe2.python.serialized_test.serialized_test_util as serial
from hypothesis import ... | ryfeus/lambda-packs | pytorch/source/caffe2/python/operator_test/channel_shuffle_test.py | Python | mit | 1,970 |
#!/usr/bin/env python2
import logging
logging.basicConfig(level=logging.WARNING)
from functools import partial
import wx
from spacq import VERSION
from spacq.gui.display.plot.static.delegator import formats, available_formats
from spacq.gui.display.table.filter import FilterListDialog
from spacq.gui.display.table.ge... | 0/SpanishAcquisition | examples/data_explorer.py | Python | bsd-2-clause | 5,055 |
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
#... | go-bears/rally | tests/unit/plugins/openstack/context/ceilometer/test_samples.py | Python | apache-2.0 | 4,459 |
import turtle
import time
window = turtle.Screen()
def test():
allturtles = []
for i in range(4):
t1 = turtle.Turtle()
t2 = turtle.Turtle()
t3 = turtle.Turtle()
t4 = turtle.Turtle()
t1.speed(0)
t2.speed(0)
t3.speed(0)
t4.speed(0)
t1.penup()
t2.penup()
t3.penup()
t4.penup()
t1.... | willybh11/python | advProg/turtleStuff/helloturtleworld.py | Python | gpl-3.0 | 846 |
################################################################################
# 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... | apache/flink | flink-python/pyflink/fn_execution/beam/beam_coder_impl_slow.py | Python | apache-2.0 | 3,466 |
##############################################################################
# Copyright (c) 2017, Los Alamos National Security, LLC
# Produced at the Los Alamos National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-647188
#
# For details, ... | skosukhin/spack | var/spack/repos/builtin/packages/berkeley-db/package.py | Python | lgpl-2.1 | 2,089 |
# Copyright 2008-2015 Nokia Solutions and Networks
#
# 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 l... | fingeronthebutton/RIDE | src/robotide/widgets/sizers.py | Python | apache-2.0 | 1,341 |
from setuptools import setup
setup(
name="python-cmr",
version="0.4.1",
license="MIT",
url="https://github.com/jddeal/python-cmr",
description="Python wrapper to the NASA Common Metadata Repository (CMR) API.",
long_description=open("README.rst").read(),
author="Justin Deal, Matt Isnor",
... | jddeal/python-cmr | setup.py | Python | mit | 455 |
# -*- coding:utf-8 -*-
__author__ = 'q00222219@huawei'
import time
from heat.openstack.common import log as logging
import heat.engine.resources.cloudmanager.commonutils as commonutils
import heat.engine.resources.cloudmanager.constant as constant
import heat.engine.resources.cloudmanager.exception as exception
impor... | hgqislub/hybird-orchard | code/cloudmanager/install/hws/hws_cascaded_configer.py | Python | apache-2.0 | 4,081 |
import random
import string
def generate_random_key(letters=True, digits=True, punctuation=True,
length=50):
charset = []
if letters:
charset.append(string.ascii_letters)
if digits:
charset.append(string.digits)
if punctuation:
charset.append(string.punc... | Outernet-Project/librarian-core | librarian_core/contrib/auth/utils.py | Python | gpl-3.0 | 579 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.