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 |
|---|---|---|---|---|---|
from flask import request
from flask.ext.restful import Resource
from .decorators import auth
from .helpers import *
from .models import User, BucketList, BucketListItem
class LoginUser(Resource):
'''
Manage responses to user requests.
URL:
/api/v1/auth/login/
Methods:
POST
'''
... | andela-hoyeboade/bucketlist-api | app/resources.py | Python | mit | 11,032 |
"""alter database for mysql compatibility
Revision ID: 9be372ec38bc
Revises: 4328f2c08f05
Create Date: 2020-02-16 15:43:35.276655
"""
from alembic import op
import sqlalchemy as sa
from docassemble.webapp.database import dbtableprefix, dbprefix, daconfig
import sys
# revision identifiers, used by Alembic.
revision =... | jhpyle/docassemble | docassemble_webapp/docassemble/webapp/alembic/versions/9be372ec38bc_alter_database_for_mysql_compatibility.py | Python | mit | 3,895 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import messages
from django.contrib.admin.models import DELETION, LogEntry
from django.contrib.admin.options import get_content_type_for_model
from django.core.urlresolvers import NoReverseMatch, Resolver404, resolve, reverse
from dja... | mishbahr/staticgen-demo | staticgen_demo/blog/middleware.py | Python | bsd-3-clause | 1,941 |
import django
from django.contrib.contenttypes.fields import GenericRel, GenericRelation
from django.contrib.contenttypes.models import ContentType
from django.db import DEFAULT_DB_ALIAS
from django.db.models.query_utils import Q
from django.utils.functional import lazy
from django.utils.text import capfirst
from flue... | edoburu/django-fluent-contents | fluent_contents/models/fields.py | Python | apache-2.0 | 10,676 |
# -*- coding: utf8 -*-
# This file is part of PyBossa.
#
# Copyright (C) 2015 SciFabric LTD.
#
# PyBossa is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your op... | geotagx/pybossa | test/test_authorization/test_token_auth.py | Python | agpl-3.0 | 3,924 |
# Copyright 2015, 2016 IBM Corp.
#
# 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 require... | PowerHMC/HmcRestClient | src/performance_capacity_monitor/LongTermMonitor.py | Python | apache-2.0 | 8,441 |
"""Honeybee configurations.
Import this module in every module that you need to access Honeybee configurations.
Usage:
import config
print config.radlibPath
print config.radbinPath
print config.platform
config.radbinPath = "c:/radiance/bin"
"""
from honeybee.config import *
from collections impor... | antonszilasi/honeybeex | honeybeex/config.py | Python | gpl-3.0 | 5,455 |
from __future__ import absolute_import, print_function
import six
from bitfield import BitField
from datetime import timedelta
from django.db import models, transaction
from django.utils import timezone
from uuid import uuid4
from sentry.models.apiscopes import ApiScopes
from sentry.db.models import (
ArrayField... | looker/sentry | src/sentry/models/apitoken.py | Python | bsd-3-clause | 2,742 |
"""
Message Types for user_api emails
"""
from django.conf import settings
from openedx.core.djangoapps.ace_common.message import BaseMessageType
from openedx.core.djangoapps.site_configuration import helpers
class DeletionNotificationMessage(BaseMessageType):
"""
Message to notify learners that their acco... | stvstnfrd/edx-platform | openedx/core/djangoapps/user_api/message_types.py | Python | agpl-3.0 | 806 |
#! /usr/bin/env python
from ppclass import pp
tsurf = pp()
tsurf.file = "/home/aymeric/Big_Data/DATAPLOT/diagfired.nc"
tsurf.var = "tsurf"
tsurf.x = None
tsurf.y = 10.
tsurf.t = 2.
tsurf.getdefineplot()
ps = pp()
ps << tsurf
ps.var = "ps"
ps.getdefineplot()
S = ps.func(tsurf)
S.p[0].linestyle=""
S.p[0].marker="h"
S.... | aymeric-spiga/planetoplot | examples/ppclass_reference/scatter.py | Python | gpl-2.0 | 1,220 |
# -*- coding: utf-8 -*-
"""
The MIT License (MIT)
Copyright (c) 2017 SML
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... | smlbiobot/SML-Cogs | channelmanager/channelmanager.py | Python | mit | 6,880 |
#-------------------------------------------------------------------------
# The Azure Batch Apps Python Client
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated docu... | Azure/azure-batch-apps-python | samples/BatchAppsExample-submit_job.py | Python | mit | 5,961 |
# Copyright 2018 The Exoplanet ML 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 agreed t... | google-research/exoplanet-ml | exoplanet-ml/box_least_squares/python/bin_by_phase_test.py | Python | apache-2.0 | 4,734 |
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from subprocess import Popen,PIPE
from scapy.all import *
from Dns_Func import frm_dhcp_Attack
import threading
from os import popen,system,getuid,path,makedirs
from re import search,compile,match
from Core.Settings import frm_Settings
from Modules.fuc_airodump impo... | stevenliuit/3vilTwinAttacker | Modules/deauth_func.py | Python | mit | 15,164 |
'''
Created on Aug 28, 2010
@author: Aaron Cooper
'''
import os
import unittest
import sys
def my_import(name):
mod = __import__(name)
components = name.split('.')
for comp in components[1:]:
mod = getattr(mod, comp)
return mod
if __name__ == "__main__":
path = os.path.... | guineawheek/abc2as3 | src/unittest_main.py | Python | gpl-3.0 | 748 |
# -*- encoding: utf-8
"""
This file maps ugly curses keycodes to human readable versions.
"""
import curses
key_map = {
# Single keys
# F1
curses.KEY_F1: "f1", # 265
curses.KEY_F2: "f2", # 266
curses.KEY_F3: "f3", # 267
curses.KEY_F4: "f4", # 268
curses.KEY_F5: "f5", # 269
... | severin31/suplemon | suplemon/key_mappings.py | Python | mit | 2,302 |
#
# Copyright (C) 2019 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distributed in the hope that it will be ... | atodorov/anaconda | pyanaconda/modules/localization/localed.py | Python | gpl-2.0 | 9,105 |
import luigi
import target
from luigi_gcloud.dataflow import DataFlowJavaTask
from storage_tasks import CopyLocalToStorage
class CopyViaDataFlowToStorage(DataFlowJavaTask):
day = luigi.DateParameter()
def output(self):
return target.storage_mail(self.day, 'dump').gcs
def requires(self):
... | alexvanboxel/luigiext-gcloud | examples/dataflow_tasks.py | Python | apache-2.0 | 812 |
# The Hazard Library
# Copyright (C) 2012-2017 GEM Foundation
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#... | gem/oq-hazardlib | openquake/hazardlib/tests/source/complex_fault_test.py | Python | agpl-3.0 | 18,749 |
from distutils.core import setup
from distutils.command import build_ext
from distutils.core import Extension
import os, sys
def load_description():
try:
f = open('README.rst', 'r')
description = f.read()
f.close()
return description
except:
return ""
class OpensslBu... | abbot/m2ext | setup.py | Python | bsd-2-clause | 2,152 |
# 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... | fullfanta/mxnet | python/mxnet/gluon/parameter.py | Python | apache-2.0 | 31,399 |
# -*- coding: utf-8 -*-
"""\
Test the fake fastnumbers module.
"""
import unicodedata
from math import isnan
from typing import Union, cast
from hypothesis import given
from hypothesis.strategies import floats, integers, text
from natsort.compat.fake_fastnumbers import fast_float, fast_int
def is_float(x: str) -> b... | SethMMorton/natsort | tests/test_fake_fastnumbers.py | Python | mit | 3,584 |
#!/bin/python3
arr = []
for arr_i in range(6):
arr_t = [int(arr_temp) for arr_temp in input().strip().split(' ')]
arr.append(arr_t)
def hourglass_sum(i, j):
return arr[i - 1][j - 1] + arr[i - 1][j] + arr[i - 1][j + 1] + arr[i][j] + arr[i + 1][j - 1] + arr[i + 1][j] + \
arr[i + 1][j + 1]
max... | benosment/daily-exercises | hr-2d.py | Python | gpl-2.0 | 482 |
import os
import tempfile
import cv2
try:
from win32com import client as com
from win32com.client import constants as c
except ImportError:
com = c = None
from gouda.barcode import Barcode
from gouda.gouda_error import GoudaError
from gouda.util import debug_print, is_clsid_registered
class DTKEngine(... | koceg/gouda | gouda/engines/dtk.py | Python | gpl-2.0 | 3,651 |
import os
import twisted
from twisted.trial import unittest
from twisted.protocols.policies import WrappingFactory
from twisted.python.filepath import FilePath
from twisted.internet import reactor, defer, error
from twisted.web import server, static, util, resource
from twisted.web.test.test_webclient import ForeverTa... | scrapinghub/scrapy | tests/test_downloader_handlers.py | Python | bsd-3-clause | 18,951 |
# pylint: disable=W0223
from pandas.core.index import Index, MultiIndex
from pandas.compat import range, zip
import pandas.compat as compat
import pandas.core.common as com
from pandas.core.common import (is_bool_indexer, is_integer_dtype,
_asarray_tuplesafe, is_list_like, isnull,
... | Vvucinic/Wander | venv_2_7/lib/python2.7/site-packages/pandas/core/indexing.py | Python | artistic-2.0 | 64,500 |
import unittest
from hpfeeds.twisted import BaseProtocol, ClientProtocol
from .utils import mock
class TestTwistedBaseProtocol(unittest.TestCase):
def setUp(self):
self.protocol = BaseProtocol()
self.transport = self.patch_object(self.protocol, 'transport')
def patch_object(self, *args, **... | rep/hpfeeds | tests/test_twisted_protocol.py | Python | gpl-3.0 | 8,065 |
"""Random variable generators.
integers
--------
uniform within range
sequences
---------
pick random element
pick random sample
pick weighted random sample
generate random permutation
distributions on the real line:
---------------------... | thecodinghub/news-for-good | news/Lib/random.py | Python | bsd-3-clause | 27,228 |
import os
import socket
import sys
from xdg.BaseDirectory import get_runtime_dir
def panic(*message_parts, exit_code=1):
"""Print an error message to stderr and exit"""
print("pyxtrlock:", *message_parts, file=sys.stderr)
sys.exit(exit_code)
def require_x11_session():
"""
Detect whether we're ... | leonnnn/pyxtrlock | pyxtrlock/__init__.py | Python | gpl-3.0 | 1,342 |
# -*- coding: utf-8 -*-
"""
Created on Thu Dec 20 10:07:47 2018
@author: fschneider
"""
import tensorflow as tf
def _mlp(x, num_outputs):
def dense(inputs, units, activation=tf.nn.relu):
"""Convenience wrapper for max pool layers."""
return tf.layers.dense(
inputs,
units,... | fsschneider/DeepOBS | deepobs/tensorflow/testproblems/_mlp.py | Python | mit | 660 |
def handle(foo, *args, <error descr="multiple * parameters are not allowed">*moreargs</error>):
print(foo, args, moreargs)
def handle(foo, *args: int, <error descr="multiple * parameters are not allowed">*moreargs: int</error>):
print(foo, args, moreargs) | dahlstrom-g/intellij-community | python/testData/highlighting/multiplePositionalContainers.py | Python | apache-2.0 | 264 |
from collections import namedtuple
import sklearn.linear_model as lm
import numpy as np
from . import gat, regions
def compute_score(sigmas, tol):
x = (sigmas - 1) / tol
weights = np.exp(-(x**2))
score = np.sum(weights)
if score > 0:
sigma_est = np.sum(sigmas * weights) / score
else:
... | simonsfoundation/CaImAn | caiman/external/houghvst/estimation.py | Python | gpl-2.0 | 3,834 |
#Copyright (C) 2013 Miheer Dewaskar <miheerdew@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
#(at your option) any later version.
#
#This program... | miheerdew/SalesMan | salesman/lib/gui/ItemViewer.py | Python | gpl-3.0 | 3,806 |
VERSION_STATUS = "ALPHA"
VERSION_DATE = "2011-04-23T00:00:00Z"
from keystone.logic.service import IdentityService
SERVICE = IdentityService()
# These just need to be imported somewhere, nothing appears to access them?
from keystone.backends import sqlalchemy
SQLALCHEMY = sqlalchemy
| ntt-pf-lab/backup_keystone | keystone/config.py | Python | apache-2.0 | 285 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
__author__ = "Vivek Dhayaal"
__copyright__ = "Copyright 2014, Reliance Jio Infocomm Ltd."
from horizon import forms
from horizon import messages
from django import shortcuts
from horizon_jiocloud.api import keystoneapi
from horizon_jiocloud.utils.utils import gener... | JioCloud/horizon | horizon_jiocloud/change_phone/views.py | Python | apache-2.0 | 1,800 |
import subprocess
proc = subprocess.Popen(["./lomb", "A.txt"], stdout = subprocess.PIPE, stderr = subprocess.STDOUT)
for line in proc.stdout:
print(line)
proc.wait()
| sonicyang/TIE | tools/sub.py | Python | gpl-2.0 | 172 |
from zeit.cms.i18n import MessageFactory as _
import copy
import grokcore.component as grok
import lxml.objectify
import zeit.cms.content.property
import zeit.cms.interfaces
import zeit.cms.syndication.feed
import zeit.cms.syndication.interfaces
import zeit.content.cp.blocks.block
import zeit.content.cp.interfaces
impo... | ZeitOnline/zeit.content.cp | src/zeit/content/cp/blocks/teaser.py | Python | bsd-3-clause | 7,905 |
#!/usr/bin/env python
#/******************************************************************************
# * $Id$
# *
# * Project: GDAL Utilities
# * Purpose: Create a PDS compatible (raw w PDS label) from a GDAL supported image.
# * Currently only LMMP projections supported (geographic,
# * eq... | USGS-Astrogeology/GDAL_scripts | gdal2ISIS3/LMMP_gdal2PDS.py | Python | unlicense | 40,880 |
# 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... | Yelp/avro | lang/py/src/avro/datafile.py | Python | apache-2.0 | 12,300 |
#!/usr/bin/env python
import os, sys
from polib import pofile
from config import CONFIGURATION
from extract import SOURCE_WARN
from execute import execute
TRANSIFEX_HEADER = 'Translations in this file have been downloaded from %s'
TRANSIFEX_URL = 'https://www.transifex.com/projects/p/edx-studio/'
def push():
exe... | abdoosh00/edx-rtl-final | i18n/transifex.py | Python | agpl-3.0 | 2,013 |
'''
Compatibility module for Python 2.7 and > 3.3
=============================================
'''
# pylint: disable=invalid-name
__all__ = ('PY2', 'string_types', 'queue', 'iterkeys',
'itervalues', 'iteritems', 'xrange')
import sys
try:
import queue
except ImportError:
import Queue as queue
#: T... | KeyWeeUsr/plyer | plyer/compat.py | Python | mit | 1,120 |
#coding=utf-8
import os
import sys
sys.path.append(sys.path[0] + "/lib/")
from werkzeug.contrib.fixers import ProxyFix
import packet
from client import Client
from dictionary import Dictionary
import mschap2
from socket import gethostname
from time import time
import random
from PIL import Image, ImageDraw, ImageFont,... | shanghai-edu/radius-1xtest | app/utils.py | Python | apache-2.0 | 6,206 |
from .physics import *
from tools import *
from geo2xml import generate_mesh
from dirnames import *
from geometries import get_geo, get_pore
from scripts import * #simulation2D, simulate
import plots | mitschabaude/nanopores | nanopores/__init__.py | Python | mit | 201 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (c) 2016 Juniper Networks, Inc. All rights reserved.
#
"""
Device Manager amqp handler
"""
from cfgm_common.vnc_amqp import VncAmqpHandle
from db import DBBaseDM, VirtualNetworkDM, PhysicalRouterDM
class DMAmqpHandle(VncAmqpHandle):
def __init__(self, ... | eonpatapon/contrail-controller | src/config/device-manager/device_manager/dm_amqp.py | Python | apache-2.0 | 1,671 |
# vim:ts=4 sw=4 expandtab softtabstop=4
import unittest
import warnings
from collections import OrderedDict
import jsonmerge
import jsonmerge.strategies
from jsonmerge.exceptions import (
HeadInstanceError,
BaseInstanceError,
SchemaError
)
from jsonmerge.jsonvalue import JSONValue
import jsonschema
try:
... | avian2/jsonmerge | tests/test_jsonmerge.py | Python | mit | 69,662 |
import numpy as np
from scipy.integrate import ode
class Simulator(object):
'''
This class simulates the initial value problem that results from solving
the boundary value problem of the control system.
Parameters
----------
ff : callable
Vectorfield of the control system.
T : ... | akunze3/pytrajectory | pytrajectory/simulation.py | Python | bsd-3-clause | 2,039 |
# coding:utf-8
'''
_AddressParser is an implementation of a recursive descent parser for email
addresses and urls. While _AddressParser can be used directly it is not
recommended, use the the parse() and parse_list() methods which are provided
in the address module for convenience.
The grammar supported by the parser... | alex/flanker | flanker/addresslib/parser.py | Python | apache-2.0 | 20,067 |
import sys
sys.path.insert(1,"../../../")
import h2o
from tests import pyunit_utils
import random
import inspect
def cv_carsGBM():
# read in the dataset and construct training set (and validation set)
cars = h2o.import_file(path=pyunit_utils.locate("smalldata/junit/cars_20mpg.csv"))
# choose the type... | madmax983/h2o-3 | h2o-py/tests/testdir_algos/gbm/pyunit_DEPRECATED_cv_carsGBM.py | Python | apache-2.0 | 6,858 |
# Copyright (C) 2020 Christopher Gearhart
# chris@bblanimation.com
# http://bblanimation.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
# (at your opt... | feureau/Small-Scripts | Blender/Blender config/2.91/scripts/addons/bricksculpt_v1-2-0/functions/common/wrappers.py | Python | gpl-3.0 | 3,894 |
# Licensed to the StackStorm, Inc ('StackStorm') 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 use th... | jtopjian/st2 | st2common/tests/unit/test_mongoescape.py | Python | apache-2.0 | 2,640 |
import bench
from _collections import namedtuple
T = namedtuple("Tup", ["foo1", "foo2", "foo3", "foo4", "num"])
def test(num):
t = T(0, 0, 0, 0, 20000000)
i = 0
while i < t.num:
i += 1
bench.run(test)
| martinribelotta/micropython | tests/bench/var-8.1-namedtuple-5th.py | Python | mit | 224 |
#!/usr/bin/python
#
# Copyright 2007 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | google/python_portpicker | src/tests/portpicker_test.py | Python | apache-2.0 | 16,155 |
import __future__
import random
import insertion_sort
from sort_helper import less, exchange, test_sort
def my_sort(array):
#random.shuffle(array)
quicksort(array)
return array
def quicksort(array, begin=0, end= None):
if end is None:
end = len(array)-1
if end <= begin + 10:
arra... | ErikSeguinte/Personal-Code-library | Sorts/quick_sort.py | Python | mit | 1,532 |
def run(config, status):
open(config["file_to_create"], 'a').close()
| ni/hoplite | tests/test_resources/test_jobs_package/test_jobs_package/create_file_job.py | Python | mit | 73 |
import numpy as np
import random
def_alpha = ' etaoinshrdlcumwfgypbvkjxqz'
from filter import filter
class Ciphertext(object):
def __init__(self, text_indices=np.zeros(0), map_record=0, alpha=def_alpha):
if np.all(map_record == 0):
map_record = np.arange(len(alpha))
self.map_record = ma... | paulsbrookes/subcipher | index_based/ciphertext.py | Python | apache-2.0 | 3,930 |
import unittest2 as unittest
from Products.CMFCore.utils import getToolByName
from groupdocs.viewer_java.testing import\
GROUPDOCS_VIEWER_INTEGRATION
class TestExample(unittest.TestCase):
layer = GROUPDOCS_VIEWER_INTEGRATION
def setUp(self):
self.app = self.layer['app']
self.portal... | liosha2007/plone-groupdocs-viewer-java-source | src/groupdocs/viewer_java/tests/test_example.py | Python | apache-2.0 | 805 |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from argparse import ArgumentParser, Namespace
from idb.cli import ClientCommand
from idb.common.types import Client
... | facebook/FBSimulatorControl | idb/cli/commands/debugserver.py | Python | mit | 1,675 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import collections
import copy
import datetime
import decimal
import itertools
import uuid
import warnings
from base64 import b64decode, b64encode
from functools import total_ordering
from django import forms
from django.apps import apps
from django.conf... | SantosDevelopers/sborganicos | venv/lib/python3.5/site-packages/django/db/models/fields/__init__.py | Python | mit | 88,153 |
from coati.powerpoint import open_pptx, runpowerpoint
import os
import sys
import logging
from shutil import copyfile
from colorlog import ColoredFormatter
LOG_LEVEL = logging.DEBUG
LOGFORMAT = "%(asctime)s - %(log_color)s%(message)s"
logging.root.setLevel(LOG_LEVEL)
formatter = ColoredFormatter(LOGFORMAT)
stream = lo... | Intelimetrica/coati | coati/generator.py | Python | mit | 3,847 |
# coding=utf-8
# Author: Nic Wolfe <nic@wolfeden.ca>
# URL: https://sickchill.github.io
#
# This file is part of SickChill.
#
# SickChill 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... | coderbone/SickRage-alt | sickbeard/ui.py | Python | gpl-3.0 | 5,666 |
import unittest
from tests.core.torrentclient_tests import TorrentClientTest
def suite():
tests = ['test_get_save_path']
return unittest.TestSuite(map(TorrentClientTest, tests))
clientTestSuite = suite()
unittest.TextTestRunner(clientTestSuite)
if __name__ == '__main__':
unittest.main()
| marcosflp/torrents_and_subtitles_downloader | run_tests.py | Python | mit | 306 |
import unittest
import pygame.constants
class KmodTests(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.constants = [
'KMOD_NONE',
'KMOD_LSHIFT',
'KMOD_RSHIFT',
'KMOD_LCTRL',
'KMOD_RCTRL',
'KMOD_LALT',
'KMOD_... | mark-me/Pi-Jukebox | venv/Lib/site-packages/pygame/tests/constants_test.py | Python | agpl-3.0 | 1,445 |
# -*- coding: utf-8 -*-
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import as_declarative
import settings
def db_connect():
""" Performs database connection using database settings from settings.py.
:return: sqlalchemy engine instance ... | drewdru/AutoTags | vk_base/models/modelsHelper.py | Python | gpl-3.0 | 984 |
'''
Text PIL: Draw text with PIL
'''
__all__ = ('LabelPIL', )
try:
from PIL import Image, ImageFont, ImageDraw
except:
raise
from kivy.compat import text_type
from kivy.core.text import LabelBase
from kivy.core.image import ImageData
# used for fetching extends before creature image surface
default_font = I... | BillBillBillBill/Tickeys-linux | tickeys/kivy_32/kivy/core/text/text_pil.py | Python | mit | 1,686 |
"""
Contains class Affine2D for preforming affine transformation (general linear
transformation followed by translation) on points (vectors) in 2D.
# Author: Vladan Lucic (Max Planck Institute for Biochemistry)
# $Id: affine_2d.py 1311 2016-06-13 12:41:50Z vladan $
"""
__version__ = "$Revision: 1311 $"
import loggi... | Splo0sh/3DCT | pyto/affine_2d.py | Python | gpl-3.0 | 24,972 |
#!/usr/bin/env python
import glob
import os
for file in glob.glob("*.ui"):
print "Processing", file
os.system("pyuic -x %s -o ../kuraclient/%s.py" %
(file, os.path.splitext(file)[0]))
| boudewijnrempt/kura | dialogs/convert.py | Python | bsd-2-clause | 209 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Script to plot tasks from profiling data.
This script requires the matplotlib and numpy Python modules.
"""
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import glob
import os
import sys
import numpy # pylint: disable... | rgayon/plaso | utils/plot_tasks.py | Python | apache-2.0 | 6,415 |
# 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-research/falken | service/generated_flatbuffers/tflite/TransposeOptions.py | Python | apache-2.0 | 2,218 |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | tgroh/incubator-beam | sdks/python/apache_beam/io/vcfio.py | Python | apache-2.0 | 19,256 |
# -*- coding: utf-8 -*-
"""
@namespace Desenho
Pixmap manipulation
Copyright 2007, NATE-LSI-EPUSP
Oficina is developed in Brazil at Escola Politécnica of
Universidade de São Paulo. NATE is part of LSI (Integrable
Systems Laboratory) and stands for Learning, Work and Entertainment
Research Group. Visit our web p... | samdroid-apps/paint-activity | Desenho.py | Python | gpl-2.0 | 32,007 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2017 Georgi Georgiev
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with th... | ge0rgi/cinder | cinder/volume/manager.py | Python | apache-2.0 | 211,218 |
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.forms import (
UserCreationForm,
UserChangeForm,
)
from django.forms import forms
from django.contrib import admin
from kirppu.kirppuauth.models import User
__author__ = 'codez'
class KirppuUserCreationForm(UserCreationForm):
class... | mniemela/kirppu | kirppu/kirppuauth/admin.py | Python | mit | 929 |
from bluebottle.bluebottle_utils.managers import GenericForeignKeyManagerMixin
from django.db import models
from polymorphic import PolymorphicManager
class WallPostManager(GenericForeignKeyManagerMixin, PolymorphicManager):
pass
class ReactionManager(models.Manager):
def get_query_set(self):
querys... | gannetson/sportschooldeopenlucht | apps/wallposts/managers.py | Python | bsd-3-clause | 423 |
import uuid
from libs import db
from rainwave.user import User
ALLOWED_DESTINATIONS = ("web", "rw", "app", "rwpath")
class R4SetupSessionMixin:
def get_destination(self):
destination = self.get_argument("destination", "web")
if destination not in ALLOWED_DESTINATIONS:
destination = "web"
return de... | rmcauley/rainwave | api_requests/auth/r4_mixin.py | Python | gpl-2.0 | 1,057 |
../../../../../share/pyshared/zope/interface/adapter.py | Alberto-Beralix/Beralix | i386-squashfs-root/usr/lib/python2.7/dist-packages/zope/interface/adapter.py | Python | gpl-3.0 | 55 |
"""Includes GirderDicomProcessor class.
GirderDicomProcessor class authenticates with girder instance and
processes dicom images.
Dicom files are downloaded from girder and the pixel data is extracted.
Can processes either a folder of dicom images or a single volumetric
dicom image file.
"""
import dicom
import gir... | chapmanbe/pymitools | pymitools/girder/girderProcessor.py | Python | apache-2.0 | 5,991 |
"""
Copyright (C) 2012-2018 Craig Thomas
This project uses an MIT style license - see LICENSE for details.
A simple Chip 8 emulator - see the README file for more information.
"""
# I M P O R T S ###############################################################
import mock
import pygame
import unittest
import collectio... | craigthomas/Chip8Python | test/test_chip8cpu.py | Python | mit | 32,960 |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2020, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... | ericmjl/bokeh | bokeh/sampledata/commits.py | Python | bsd-3-clause | 2,253 |
import os
import sys
def main():
"""
This file will checkout the empty file from the previous submission and have them relabeled.
"""
input_file = sys.argv[1]
assert 'input' in input_file
old_dir = input_file.replace('-redo', '').replace('/input', '')
while old_dir[-1] == '/':
old_d... | andriluka/mechturk-public | utils/redo_input_from_empty.py | Python | bsd-3-clause | 1,074 |
def First_Part(orbits):
Orbits = dict()
checksum = 0
for orbit in orbits:
od, og = orbit.split(')')
Orbits[og] = od
for og in Orbits.keys():
while 1:
try:
og = Orbits[og]
checksum += 1
except KeyError:
break... | ImpregnableProgrammer/Advent-of-Code | 2019/Day_06.py | Python | gpl-3.0 | 1,071 |
import numpy as np
from scipy import stats
import spm1d
#(0) Load dataset:
dataset = spm1d.data.uv0d.regress.RSRegression()
dataset = spm1d.data.uv0d.regress.ColumbiaHeadCircumference()
y,x = dataset.get_data()
print( dataset )
#(1) Conduct test using spm1d:
spmt = spm1d.stats.regress(y, x)
spmti = spmt... | 0todd0000/spm1d | spm1d/examples/scipy/ex_regression.py | Python | gpl-3.0 | 577 |
# -*- coding: utf8 -*-
# Copyright (C) 2013 - Oscar Campos <oscar.campos@member.fsf.org>
# This program is Free Software see LICENSE file for details
import re
import _ast
from linting import linter
import pyflakes.checker as pyflakes
pyflakes.messages.Message.__str__ = (
lambda self: self.message % self.messa... | alexfalcucc/anaconda | anaconda_lib/linting/anaconda_pyflakes.py | Python | gpl-3.0 | 5,568 |
from django.db import models
class Utilisateur(models.Model):
pseudo = models.CharField(max_length=12)
mdp = models.CharField(max_length=12)
mail = models.CharField(max_length=20)
class Amis(models.Model):
utilisateur = models.ForeignKey(Utilisateur,on_delete=models.CASCADE)
amisde = models.ForeignKey(Utilisateu... | batebates/L3ProjetWeb | BDR/models.py | Python | mit | 709 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.db.models.deletion
from django.conf import settings
import djangobmf.fields
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MOD... | django-bmf/django-bmf | djangobmf/contrib/invoice/migrations/0001_initial.py | Python | bsd-3-clause | 4,828 |
# Copyright 2020 DeepMind Technologies Limited. 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 ... | deepmind/dm-haiku | examples/transformer/model.py | Python | apache-2.0 | 4,120 |
"""Problem 45 of https://projecteuler.net"""
from projecteuler.generators import triangle_numbers
from projecteuler.inspectors import is_pentagonal, is_hexagonal
def problem_45():
"""Solution to problem 45."""
count = 0
triangle_generator = triangle_numbers()
while True:
number = next(triangl... | hjheath/ProjectEuler | projecteuler/problems/problem_45.py | Python | mit | 518 |
__version__ = '0.7.0'
| ceholden/yatsm | yatsm/version.py | Python | mit | 22 |
import os
from flask import session
from everyclass.server.utils.web_consts import SESSION_CURRENT_USER, SESSION_USER_SEQ
def plugin_available(plugin_name: str) -> bool:
"""
check if a plugin (Sentry, apm, logstash) is available in the current environment.
:return True if available else False
"""
... | fr0der1c/EveryClass-server | everyclass/server/utils/common_helpers.py | Python | mpl-2.0 | 1,226 |
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login
from rest_framework.serializers import (
ModelSerializer,
HyperlinkedIdentityField,
SerializerMethodField,
)
from photos.models import *
class UserSerializer(ModelSerializer):
class Meta:
model = U... | andela-snwuguru/photo-editing | app/photos/api/serializers.py | Python | gpl-3.0 | 2,287 |
# Copyright 2019 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... | tensorflow/tensorflow | tensorflow/python/keras/distribute/__init__.py | Python | apache-2.0 | 831 |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""
Package contains interfaces for using existing functionality in other packages
Exaples FSL, matlab/SPM , afni
Requires Packages to be installed
"""
from ConfigParser import NoOptionError
from copy i... | FredLoney/nipype | nipype/interfaces/base.py | Python | bsd-3-clause | 71,243 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# (c) 2016, René Moser <mail@renemoser.net>
#
# 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 Lice... | DepthDeluxe/ansible | lib/ansible/modules/cloud/cloudstack/cs_zone.py | Python | gpl-3.0 | 11,062 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-03-18 23:03
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('politicalplaces', '0008_auto_20170317_1636'),
]
operations = [
migrations.A... | 20tab/django-political-map | politicalplaces/migrations/0009_politicalplace_postal_code.py | Python | mit | 483 |
import random
from . import base
import alvi.client.containers
class BinarySearch(base.Scene):
def init(self, array, n):
array.init(n)
array.sync()
def generate_points(self, array, data_generator):
for i, value in enumerate(data_generator.values):
array[i] = value
... | alviproject/alvi | alvi/client/scenes/binary_search.py | Python | mit | 1,857 |
#!/usr/bin/python
import argparse
import httplib2
from apiclient.discovery import build
from oauth2client.client import flow_from_clientsecrets
from oauth2client.file import Storage
from oauth2client.tools import run_flow, argparser
# Parse the command-line arguments (e.g. --noauth_local_webserver)
parser = argparse... | erdincay/gmvault | src/sandbox/python_api_tests.py | Python | agpl-3.0 | 1,557 |
__all__ = ["config", "pageserver", "restful", "worker"]
import config
import pageserver
import restful
import worker
def run(host, port):
"""
Runs the server.
@param host The host for the server
@param port The port for the server
"""
config.app.run(host=host, port=int(port), debug=True,... | wallarelvo/SmallCartography | carto/master/__init__.py | Python | apache-2.0 | 341 |
import fechbase
class Records(fechbase.RecordsBase):
def __init__(self):
fechbase.RecordsBase.__init__(self)
self.fields = [
{'name': 'FORM TYPE', 'number': '1'},
{'name': 'FEC COMMITTEE ID NUMBER (PCC)', 'number': '2'},
{'name': 'COMMITTEE NAME (PCC)', 'number': ... | h4ck3rm1k3/FEC-Field-Documentation | fec/version/v1/F3Z.py | Python | unlicense | 2,766 |
#! /usr/bin/env python
# coding=utf-8
#############################################################################
# #
# File: setup.py #
# ... | gauravssnl/gappproxy | uploader/setup.py | Python | gpl-3.0 | 2,173 |
# Copyright 2013 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 ctypes.wintypes
import hashlib
import json
import os
import subprocess
import sys
BASEDIR = os.path.dirname(os.path.abspath(__file__))
GetFileAttr... | androidarmv6/android_external_chromium_org | tools/win/toolchain/get_toolchain_if_necessary.py | Python | bsd-3-clause | 4,403 |
# Copyright (c) 2015 Openstack Foundation
#
# 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 ... | mandeepdhami/neutron | neutron/agent/ovsdb/native/commands.py | Python | apache-2.0 | 14,603 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.