code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from .base import CreditCardProvider
from .gencc import mastercardPrefixList
from .gencc import credit_card_number
from random import Random
class MastercardProvider(CreditCardProvider):
def __init__(self, *args, **kwargs):
super(MastercardProvider, self).__i... | ryankanno/vor | vor/backends/cc/mastercard.py | Python | mit | 500 |
import unittest
import pygame
import pygame.gfxdraw
from pygame.locals import *
from pygame.tests.test_utils import SurfaceSubclass
def intensity(c, i):
"""Return color c changed by intensity i
For 0 <= i <= 127 the color is a shade, with 0 being black, 127 being the
unaltered color.
For 128 <= i <= ... | mark-me/Pi-Jukebox | venv/Lib/site-packages/pygame/tests/gfxdraw_test.py | Python | agpl-3.0 | 34,365 |
from django.contrib import admin
from cmsplugin_filery.models import Image
class ImageInline(admin.TabularInline):
model = Image
| jasekz/cmsplugin-filery | cmsplugin_filery/admin.py | Python | bsd-2-clause | 134 |
#!/usr/bin/python
#
# Copyright 2007 Google Inc.
# Licensed to PSF under a Contributor Agreement.
#
# 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/LICE... | nouiz/fredericbastien-ipaddr-py-speed-up | tags/2.1.5/ipaddr.py | Python | apache-2.0 | 60,213 |
# class definitions (object-oriented codes)
# Built-ins
import os
import warnings
# Standard
import numpy as np
import scipy as scp
import matplotlib.pyplot as plt
# tofu-specific
import tf.__version__ as __version__
# dumpro-specific
import _comp
# !!!! never use 'from ... import *'
# Always remain explicit !!!... | Didou09/tofu | tofu/dumpro/_core.py | Python | mit | 553 |
import numpy as np
from skimage.filters import gabor_kernel
from scipy.ndimage.filters import convolve as convolveim
class GaborFilter:
def __init__(self, frequency, theta, sigma_x=None, sigma_y=None):
""" Instantiate a Gabor kernel
Parameters
----------
frequency: float
... | benitesf/Skin-Lesion-Analysis-Towards-Melanoma-Detection | util/gabor.py | Python | mit | 1,369 |
# Generated by Django 3.2.8 on 2021-12-02 10:49
import time
from django.db import migrations
def noop(apps, schema_editor): # pragma: no cover
pass
def populate_flow_results_word_cloud(apps, schema_editor): # pragma: no cover
Org = apps.get_model("orgs", "Org")
PollWordCloud = apps.get_model("stats... | rapidpro/ureport | ureport/stats/migrations/0026_populate_flow_result_word_clouds.py | Python | agpl-3.0 | 1,413 |
from math import *
class FuncWithDerivatives:
def __init__(self, h=1.0E-9):
self.h = h # spacing for numerical derivatives
def __call__(self, x):
raise NotImplementedError('___call__ missing in class %s' %
self.__class__.__name__)
def df(self, x):
... | qilicun/python | python3/src/oo/session.py | Python | gpl-3.0 | 2,475 |
# socket_talk.py
#
# Copyright 2010 dan collins <danc@badbytes.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 version 2 of the License, or
# (a... | badbytes/pymeg | com/socket_talk.py | Python | gpl-3.0 | 2,008 |
# Copyright (c) 2012 The Khronos Group Inc.
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and /or associated documentation files (the "Materials "), to deal in the Materials without restriction, including without limitation the rights to use, copy, modify, merge, publ... | KhronosGroup/COLLADA-CTS | StandardDataSets/1_5/collada/library_kinematics_model/kinematics_model/asset/unit/unit.py | Python | mit | 3,954 |
import unittest
from urllib import quote_plus as enc
from merlin import Merlin
from merlin.filter import Field, NF
from merlin.vrec import Vrec
class VrecTest(unittest.TestCase):
def test_simple_vrec(self):
s = Vrec(id="a1234")
self.assertEquals(s.build(), "products/vrec?id=a1234")
def test_... | blackbirdtech/merlin-python | tests/test_vrec.py | Python | apache-2.0 | 1,732 |
# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... | lispc/Paddle | python/paddle/v2/dataset/cifar.py | Python | apache-2.0 | 4,196 |
#! /usr/bin/env python
#
# 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... | j-griffith/cinder | tools/generate_driver_list.py | Python | apache-2.0 | 4,677 |
"""
PCA Reconstruction of a spectrum
--------------------------------
Figure 7.6
The reconstruction of a particular spectrum from its eigenvectors. The input
spectrum is shown in gray, and the partial reconstruction for progressively
more terms is shown in black. The top panel shows only the mean of the set of
spectra... | eramirem/astroML | book_figures/chapter7/fig_spec_reconstruction.py | Python | bsd-2-clause | 3,410 |
# ===============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of eos.
#
# eos is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, ... | blitzmann/Pyfa | eos/saveddata/mode.py | Python | gpl-3.0 | 2,114 |
# -*- coding: utf-8 -*-
"""Functions for FIR filter design."""
from __future__ import division, print_function, absolute_import
from math import ceil, log
import warnings
import numpy as np
from numpy.fft import irfft, fft, ifft
from scipy.special import sinc
from scipy.linalg import toeplitz, hankel, pinv
from scipy... | kenshay/ImageScript | ProgramData/SystemFiles/Python/Lib/site-packages/scipy/signal/fir_filter_design.py | Python | gpl-3.0 | 41,878 |
# ------------------------------------------------------------------------------
# Mari Shader Library Registration Init
# Copyright (c) 2013 Mari Ideascale. All Rights Reserved.
# ------------------------------------------------------------------------------
# File: __init__.py
# Description: Initiate file for python ... | sonictk/MARI-Extension-Pack | Scripts/Shaders/__init__.py | Python | bsd-3-clause | 1,988 |
# Copyright 2021 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 | dev_tools/pylint_copyright_checker_test.py | Python | apache-2.0 | 3,278 |
__author__ = 'kartik'
from lib.filter.base_filter import BaseFilter
# class that filters sentences based on sentence length
class LengthFilter(BaseFilter):
# method to filter sentence
def filter(self, sentence):
if not sentence is None:
sentence = sentence.strip()
if ... | kperisetla/glossextractionengine | lib/filter/length_filter.py | Python | gpl-3.0 | 494 |
#!/usr/bin/env python
################################################################################
# \file build.py
# \author Gregory Diamos <gregory.diamos@gatech.edu>
# \date Thursday March 29, 2012
# \brief The top level Ocelot build script to direct scons builds
# and run unit tests
#########... | 3upperm2n/gpuocelot | build.py | Python | bsd-3-clause | 9,177 |
# 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... | StackStorm/st2-auth-backend-pam | st2auth_pam_backend/pam_backend.py | Python | apache-2.0 | 2,681 |
from mongoengine import *
from room import *
from scenario import *
from device import *
import datetime
connect('domotica')
#tim = Room(name = 'Tim').save()
#living = Room(name = 'Living').save()
arne = Room(name = 'Arne').save()
bedLight = OldKakuDevice(name = 'BedLight', room = arne, state = 0, rc = 'C', rcid =... | DJTim/SmartHome | models/main.py | Python | gpl-2.0 | 1,465 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from generator import Generator
import logging
class Phobia(Generator):
""" Define a phobia to be used in your game """
def __init__(self, redis, features={}):
Generator.__init__(self, redis, features)
self.logger = logging.getLogger(__name__)
... | CityGenerator/Megacosm-Generator | megacosm/generators/phobia.py | Python | gpl-2.0 | 661 |
# -*- coding: utf-8 -*-
"""
The moo Editor
~~~~~~~~~~~~~~
:copyright: 2005-2008 by The PIDA Project
:license: GPL 2 or later (see README/COPYING/LICENSE)
"""
# Standard Libs
import os
import gtk
import gobject
import re
from gtk import gdk
# UGLY UGLY workarround as suggested by muntyan_
# this will... | fermat618/pida | pida/editors/mooedit/mooedit.py | Python | gpl-2.0 | 60,125 |
#!/usr/bin/env python
# Copyright 2017 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 os.path
import sqlite3
import sys
import time
import uuid
# Database Default File Name
_WEB_DATA_DB = 'Web Data'
# Table Name... | nwjs/chromium.src | components/test/data/autofill/tools/add_disused_address.py | Python | bsd-3-clause | 2,854 |
# Sequence Assembler for CS362 Project 3
# Authors: Charles Eyermann and Sam Hinh
from simulator import *
from node import *
import argparse, copy, csv, timeit
from collections import Counter
class Subgraph:
'''a subgraph class to allow for separating main graph into
its connected components'''
def __init__(self,g... | eyermann/Computational-Biology | Assembly Project/assembler.py | Python | apache-2.0 | 20,059 |
# Licensed under an MIT open source license - see LICENSE
from __future__ import print_function, absolute_import, division
import pytest
import numpy as np
import numpy.testing as npt
from astropy.utils.misc import NumpyRNGContext
from ..statistics.lm_seg import Lm_Seg
def test_lmseg():
x = np.linspace(0, 10, ... | e-koch/TurbuStat | turbustat/tests/test_lmseg.py | Python | mit | 1,087 |
import unittest
from conans.model.info import ConanInfo
info_text = '''[settings]
arch=x86_64
build_type=Debug
compiler=gcc
compiler.libcxx=libstdc++11
compiler.version=5.2
os=Linux
[requires]
bzip2/1.Y.Z
zlib/1.Y.Z
[options]
fPIC=True
header_only=False
shared=False
[full... | dragly/conan | conans/test/model/info_test.py | Python | mit | 1,511 |
import numpy as np
from collections import OrderedDict
from utils.fio import get_config, get_absolute_path
class WordCoord:
def __init__(self, coordinate_string):
self.id = coordinate_string
parts = coordinate_string.split('-')
self.doc_id = parts[0].strip()
self.line_id = parts[1... | dwettstein/pattern-recognition-2016 | utils/transcription.py | Python | mit | 2,542 |
#! /usr/bin/env python
import nmrglue.fileio.pipe as pipe
import nmrglue.process.pipe_proc as p
d,a = pipe.read("time_complex.fid")
d,a = p.sign(d,a,ri=True)
pipe.write("s1.glue",d,a,overwrite=True)
d,a = pipe.read("time_complex.fid")
d,a = p.sign(d,a,r=True)
pipe.write("s2.glue",d,a,overwrite=True)
d,a = pipe.read... | rpbarnes/nmrglue | tests/pipe_proc_tests/sign.py | Python | bsd-3-clause | 937 |
class Actions:
@staticmethod
def Teleport(map, tileX, tileY):
def teleport(trigger, entity):
entity.TileX = tileX
entity.TileY = tileY
TeleportEntity(entity, map)
return teleport
| ericrrichards/rpgEngine | RpgEngine/RpgEngine/Scripts/Actions.py | Python | mit | 242 |
from business_rules.operators import BaseType, type_operator
from tests import TestCase
from mock import MagicMock
class OperatorsClassTests(TestCase):
""" Test methods on classes that inherit from BaseType.
"""
def test_base_has_no_operators(self):
self.assertEqual(len(BaseType.get_all_operators(... | adnymics/business-rules | tests/unit/test_operators_class.py | Python | mit | 2,393 |
#Removing all extractors that are failing their tests
#so they can be worked on later
from __future__ import unicode_literals
from .abc import ABCIE
from .academicearth import AcademicEarthCourseIE
from .addanime import AddAnimeIE
from .adobetv import AdobeTVIE
from .adultswim import AdultSwimIE
from .aftonbladet imp... | Brainiq7/Ananse | ananse_dl/extractor/__init__.py | Python | unlicense | 16,145 |
from skidl import SKIDL, TEMPLATE, Part, Pin, SchLib
SKIDL_lib_version = '0.0.1'
transf = SchLib(tool=SKIDL).add_parts(*[
Part(name='TEZ0.5-D-1',dest=TEMPLATE,tool=SKIDL,keywords='0.5VA PCB Transformer Single Secondary',description='TEZ0.5/D/x, 0.5VA, Single Secondary, Cast Resin Transformer, PCB',ref_prefix=... | xesscorp/skidl | skidl/libs/transf_sklib.py | Python | mit | 11,592 |
#
# (c) 2016 Red Hat Inc.
#
# 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 License, or
# (at your option) any later version.
#
# Ansible is d... | tux-00/ansible | test/units/modules/network/nxos/test_nxos_system.py | Python | gpl-3.0 | 6,187 |
from rx.observable import Observable
from rx.anonymousobservable import AnonymousObservable
from rx.disposables import CompositeDisposable, SingleAssignmentDisposable
from rx.internal import extensionmethod
@extensionmethod(Observable)
def exclusive(self):
"""Performs a exclusive waiting for the first to finish ... | dbrattli/RxPY | rx/linq/observable/exclusive.py | Python | apache-2.0 | 1,789 |
from setuptools import setup, find_packages
import sys, os
version = '0.1'
setup(name='notarcpy',
version=version,
description="(I Can't Believe It's) Not ArcPy: fake objects for testing",
long_description="""\
""",
classifiers=[], # Get strings from http://pypi.python.org/pypi?%3Aaction=list_... | sgillies/notarcpy | setup.py | Python | bsd-3-clause | 790 |
from pythonforandroid.recipe import NDKRecipe
from pythonforandroid.toolchain import current_directory, shprint
from os.path import join
import sh
class OggRecipe(NDKRecipe):
version = '1.3.3'
url = 'http://downloads.xiph.org/releases/ogg/libogg-{version}.tar.gz'
generated_libraries = ['libogg.so']
... | kronenpj/python-for-android | pythonforandroid/recipes/libogg/__init__.py | Python | mit | 833 |
# Create your views here.
from django.http import Http404
from django.shortcuts import render_to_response
from django.template.context import RequestContext
from menus.utils import simple_language_changer
from project.sampleapp.models import Category
@simple_language_changer
def sample_view(request, **kw):
context... | VillageAlliance/django-cms | tests/project/sampleapp/views.py | Python | bsd-3-clause | 617 |
#########
# ps_drone.py
# (w)+(c) J. Philipp de Graaff, www.playsheep.de, drone@playsheep.de, 2012-2015
# Project homepage: www.playsheep.de/drone and https://sourceforge.net/projects/ps-drone/
# Dependencies: a POSIX OS, openCV2 for video-support.
# Base-program of the PS-Drone API: "An open and enhanced API for unive... | caelooney/pennappsf16site | python/ps_drone.py | Python | mit | 97,326 |
"""
.. module stratumgs.game.engine
This module contains the base engine that all game engines extend, as well as
code for interacting with clients.
"""
# flake8:noqa
from .engine import BaseEngine
| stratumgs/stratumgs | stratumgs/game/engine/__init__.py | Python | mit | 201 |
"""
Copyright 2017 Attila Szollosi
This file is part of pmbootstrap.
pmbootstrap 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.
pmbootstr... | lawl/pmbootstrap | pmb/install/recovery.py | Python | gpl-3.0 | 2,861 |
#!/usr/bin/python
# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Script that resets your Chrome GIT checkout."""
import logging
import optparse
import os
import re
from chromite.buildbot impor... | espadrine/opera | chromium/src/third_party/chromite/scripts/chrome_set_ver.py | Python | bsd-3-clause | 14,475 |
# ---------------------------------------------------------------------------- #
# #
# 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 ... | speksofdust/BeyondDreams | beyonddreams/item/equipslots.py | Python | gpl-3.0 | 5,339 |
from __future__ import print_function, division
from pyscf.nao import tddft_iter
from pyscf.nao.m_x_zip import x_zip, ee2dos, ee_xx_oo2dos
import numpy as np
c = tddft_iter(label='siesta', force_gamma=True, gen_pb=False, dealloc_hsx=False)
eps = 0.01
vst, i2w,i2dos, m2e, ma2x = x_zip(c.mo_energy[0,0], c.mo_coeff[0,0,... | gkc1000/pyscf | pyscf/nao/test/ag54/x_zip.py | Python | apache-2.0 | 677 |
#!/usr/bin/python2.7
# -*- coding: utf-8 -*-
import os
import json
import base64
import pickle
import zipfile
import logging
import functools
from io import StringIO
from os.path import join
from gotit_api.utils import exceptions
from gotit_api.utils.redis2s import Redis
def json_dumps(s):
""" json dump
:pa... | zhwei/gotit-api | gotit_api/utils/helper.py | Python | mit | 3,308 |
# Copyright 2017 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... | memo/tensorflow | tensorflow/contrib/data/python/kernel_tests/sequence_dataset_op_test.py | Python | apache-2.0 | 8,032 |
#!/usr/bin/env python
# ==========================================================================
#
# Copyright NumFOCUS
#
# 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
#
# ... | InsightSoftwareConsortium/ITKExamples | src/Core/Common/CreateAVector/Code.py | Python | apache-2.0 | 941 |
"""
.. warning::
This module is deprecated. Use :mod:`feincms3.renderer.RegionRenderer`
instead.
"""
import warnings
from collections import deque
from functools import wraps
from content_editor.contents import contents_for_item
from django.core.cache import cache
from django.utils.functional import SimpleLazyO... | matthiask/feincms3 | feincms3/regions.py | Python | bsd-3-clause | 5,446 |
# -*- coding: utf-8 -*-
#
# This file is part of PyGaze - the open-source toolbox for eye tracking
#
# PyGaze is a Python module for easily creating gaze contingent experiments
# or other software (as well as non-gaze contingent experiments/software)
# Copyright (C) 2012-2013 Edwin S. Dalmaijer
#
# ... | esdalmaijer/PyGaze | pygaze/_mouse/psychopymouse.py | Python | gpl-3.0 | 4,414 |
#!/usr/bin/env python
import wx
class View(wx.Panel):
def __init__(self, parent):
super(View, self).__init__(parent)
self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM)
self.Bind(wx.EVT_SIZE, self.on_size)
self.Bind(wx.EVT_PAINT, self.on_paint)
def on_size(self, event):
ev... | wunderlins/learning | python/wx/hud/example.py | Python | gpl-2.0 | 947 |
# coding=utf8
import sublime
import sys
import os
from .Liste import get_root
#from .Project import ProjectSettings, ProjectError, errorSetting
from ..Utils import read_and_decode_json_file, read_file, get_any_ts_view, fn2l, get_any_view_with_root
# ----------------------------------------- CONSTANT ----------------... | Phaiax/ArcticTypescript | lib/system/busted/Settings.py | Python | mit | 3,881 |
#!/usr/local/bin/python
# -*-coding:Utf-8 -*
import os
import math
def GA_settings():
"""Provides the view for the user setting of the GA experiments and returns the settings set"""
options = {}
os.system("clear")
print('===== OPTIONS =====\n')
preset = int(raw_input(
"PRESET\n"
... | goujonpa/jeankevin | views/settingsView.py | Python | mit | 7,278 |
from django.dispatch import Signal
css_compressed = Signal()
js_compressed = Signal()
| cyberdelia/django-pipeline | pipeline/signals.py | Python | mit | 88 |
import matplotlib
matplotlib.use("TKAgg",warn=False)
import pylab
import pandas as pd
import numpy as np
import logging
import unittest
import doctest
import os.path
from pysnptools.snpreader import Bed, Pheno,SnpData
from fastlmm.association import single_snp_all_plus_select,single_snp
from fastlmm.feature_selection.... | MicrosoftGenomics/FaST-LMM | fastlmm/association/tests/test_single_snp_all_plus_select.py | Python | apache-2.0 | 24,522 |
#
# 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
# ... | redhat-openstack/heat | heat/engine/resources/neutron/vpnservice.py | Python | apache-2.0 | 24,469 |
#!/usr/bin/python2
#coding=utf-8
import urllib2
import HTMLParser
import sys
import xml.dom.minidom as minidom
from htmlentitydefs import entitydefs
import glob
reload(sys)
sys.setdefaultencoding('utf8')
class MyParser(HTMLParser.HTMLParser):
def __init__(self):
HTMLParser.HTMLParser.__init__(self)
... | doge-search/webdoge | xiaoqiqi/Wustl/scrap_professors.py | Python | unlicense | 1,778 |
#!/usr/bin/python
#
# Copyright 2014 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 b... | jdilallo/jdilallo-test | examples/dfp/v201311/content_service/get_all_content.py | Python | apache-2.0 | 1,829 |
import api
class Profile():
# Profile.Profile_View
def profile_view(self, auth=True):
return api.call('Profile_View', {}, auth)
| wryyl/pyivle | pyivle/profile.py | Python | mit | 145 |
__author__ = "Jeremy Carbaugh (jcarbaugh@sunlightfoundation.com)"
__version__ = "0.1"
__copyright__ = "Copyright (c) 2008 Sunlight Labs"
__license__ = "BSD"
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from django.contrib.sites.... | uclastudentmedia/django-gatekeeper | gatekeeper/__init__.py | Python | bsd-3-clause | 7,984 |
# -*- coding: utf-8 -*-
"""
Created on Thu Nov 19 06:37:35 2013
@author: Sukhbinder Singh
Reads a Binary file and
Returns Header,Points,Normals,Vertex1,Vertex2,Vertex3
Source: http://sukhbinder.wordpress.com/2013/11/28/binary-stl-file-reader-in-python-powered-by-numpy/
"""
import numpy as np
from struct import unpa... | rcpedersen/stl-warper | reader.py | Python | mit | 1,235 |
import unittest
from .support import LoggingResult
class Test_TestSkipping(unittest.TestCase):
def test_skipping(self):
class Foo(unittest.TestCase):
def test_skip_me(self):
self.skipTest("skip")
events = []
result = LoggingResult(events)
... | utluiz/utluiz.github.io | pyscript/Lib/unittest/test/test_skipping.py | Python | mit | 5,322 |
import numpy as np
import tensorflow as tf
import os
import matplotlib.pyplot as plt
plt.switch_backend('agg')
from scipy.io import savemat
from scipy.io import loadmat
from tl_vgg16_fcl import *
class tl_face_classifier:
def __init__(self, face_data, test_size):
self.face_data = face_data
self... | wezteoh/face_saliency_research | vgg/transfer_learning.py | Python | mit | 9,748 |
from discord.ext import commands
class Github:
def __init__(self, bot):
self.bot = bot
@commands.command(pass_context=True)
async def permrole(self, ctx, argument:str):
await self.bot.say(';py for perm in discord.utils.get(ctx.message.server.roles, name="{}").permissions: print(perm)'.for... | shivaco/selfbot | cogs/role_perms.py | Python | gpl-3.0 | 398 |
# vim:fileencoding=utf-8:noet
from __future__ import (unicode_literals, division, absolute_import, print_function)
import sys
from powerline.lib.shell import asrun, run_cmd
from powerline.lib.unicode import out_u
from powerline.segments import Segment, with_docstring
STATE_SYMBOLS = {
'fallback': '',
'play': '>',... | junix/powerline | powerline/segments/common/players.py | Python | mit | 13,926 |
# -*- coding: utf-8 -*-
import sys,re,json,urllib,urlparse,random,datetime,time
from resources.lib.zmodules import control
from resources.lib.zmodules import cleantitle
from resources.lib.zmodules import client
from resources.lib.zmodules import debrid
from resources.lib.zmodules import workers
try: from sqlite3 ... | repotvsupertuga/repo | plugin.video.TVsupertuga/resources/lib/zmodules/sources.py | Python | gpl-2.0 | 20,263 |
# -*- coding: utf-8 -*-
"""Interpret PEP 345 environment markers.
EXPR [in|==|!=|not in] EXPR [or|and] ...
where EXPR belongs to any of those:
python_version = '%s.%s' % (sys.version_info[0], sys.version_info[1])
python_full_version = sys.version.split()[0]
os.name = os.name
sys.platform = sys.platfo... | Drvanon/Game | venv/lib/python3.3/site-packages/distribute-0.6.34-py3.3.egg/_markerlib/markers.py | Python | apache-2.0 | 3,878 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | marionleborgne/nupic | src/nupic/frameworks/opf/opfutils.py | Python | agpl-3.0 | 15,080 |
# -*- coding: utf-8 -*-
# MinIO Python Library for Amazon S3 Compatible Cloud Storage,
# (C) 2015 MinIO, 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/lic... | minio/minio-py | examples/make_bucket.py | Python | apache-2.0 | 1,074 |
from __future__ import unicode_literals
import json
from datetime import datetime
from django.test.testcases import TestCase
from django_evolution.models import Version
from django_evolution.signature import AppSignature, ProjectSignature
class VersionManagerTests(TestCase):
"""Unit tests for django_evolution.... | beanbaginc/django-evolution | django_evolution/tests/test_evolution_models.py | Python | bsd-3-clause | 3,613 |
import gridfs
from flask_pymongo import MongoClient, PyMongo
from pymongo.errors import ServerSelectionTimeoutError
mongo = PyMongo()
class Database:
def __init__(self):
self.gridfs = None
def init(self):
self.gridfs = gridfs.GridFS(mongo.db)
database = Database()
def is_db_server_up(mon... | guardicore/monkey | monkey/monkey_island/cc/database.py | Python | gpl-3.0 | 862 |
"""Test the bonus mode."""
from unittest.mock import MagicMock
from mpf.tests.MpfTestCase import MpfTestCase
from mpf._version import version, extended_version
class TestMachineVariables(MpfTestCase):
def get_config_file(self):
return 'config.yaml'
def get_machine_path(self):
return 'tests/... | missionpinball/mpf | mpf/tests/test_MachineVariables.py | Python | mit | 7,410 |
"""Some portions of this code (QJsonTreeItem and QJsonModel) belong to
https://github.com/dridk/QJsonModel, which is distributes under
the following license:
MIT License
Copyright (c) 2017 sacha schutz
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated docume... | robocomp/learnbot | learnbot_dsl/learnbotCode/guiJsonEditor.py | Python | gpl-3.0 | 9,015 |
"""Importer for WorkUp events.
See http://go/pe:notebooks/datasets/workup_events.ipynb for analysis on the
WorkUp dataset.
"""
import json
import math
from typing import Any, Dict, List, TextIO, Union
import pandas as pd
from bob_emploi.data_analysis.lib import mongo
# Buffer distance to add to département bounds:... | bayesimpact/bob-emploi | data_analysis/importer/workup_events.py | Python | gpl-3.0 | 3,256 |
import torch.nn as nn
from utils import *
class pspnet(nn.Module):
def __init__(self, feature_scale=4, n_classes=21, is_deconv=True, in_channels=3, is_batchnorm=True):
super(pspnet, self).__init__()
self.is_deconv = is_deconv
self.in_channels = in_channels
self.is_batchnorm = is_b... | hzh8311/project | ptsemseg/models/pspnet.py | Python | mit | 3,277 |
from setuptools import setup, find_packages
from formaldehyde import __author__, __version__, __license__, __email__
setup(
name='django-formaldehyde',
version=__version__,
license=__license__,
url='https://github.com/kunitoki/django-formaldehyde',
author=__author__,
author_email=__email__,
... | kunitoki/django-formaldehyde | setup.py | Python | mit | 1,179 |
from django.core.management import call_command
from popular_proposal.tests import ProposingCycleTestCaseBase
from proposal_subscriptions.models import SearchSubscription
from datetime import timedelta
from popular_proposal.models import PopularProposal
from django.contrib.auth.models import User
from proposal_subscri... | lfalvarez/votai | proposal_subscriptions/tests/subscription_model_tests.py | Python | gpl-3.0 | 15,424 |
#!/usr/bin/env python
from __future__ import absolute_import
from email.utils import parseaddr
import functools
import htmlentitydefs
import itertools
import logging
import operator
import psycopg2
import re
from ast import literal_eval
from openerp.exceptions import ValidationError
from openerp.tools import mute_logge... | vileopratama/vitech | src/addons/crm/base_partner_merge.py | Python | mit | 31,204 |
from .nested_k_fold_cross_validation import NestedKFoldCrossValidation
from .pipeline_builder import PipelineBuilder
from .old import PipelineOptimization
| JaggedParadigm/pyplearnr | pyplearnr/__init__.py | Python | apache-2.0 | 155 |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | QingChenmsft/azure-cli | src/azure-cli-core/azure/cli/core/tests/test_progress.py | Python | mit | 3,634 |
import os, sys, torch
import numpy as np
from skimage import io, transform
from utils import *
import scipy
def get_K(intersection_points, img_shape):
H_norm = get_normalization_matrix(img_shape, is_normalize=True)
A = np.empty(shape=[0, 6])
for img_index in range(5):
x1, y1, h1 = np.dot(H_norm, in... | InnovArul/codesmart | Assignments/Jan-May-2018/GeometryAndPhotometryBasedComputerVision/homework2/perpendicular_5points.py | Python | gpl-2.0 | 2,170 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# update-database.py - Create and update Mycodo SQLite databases
#
# Copyright (C) 2015 Kyle T. Gabriel
#
# This file is part of Mycodo
#
# Mycodo is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published... | Cabalist/Mycodo | 3.5/databases/notes_db/models.py | Python | gpl-3.0 | 1,323 |
#!/usr/bin/env python
import subprocess
import re
def main():
""" Kill the python server """
try:
pid = subprocess.check_output("lsof -i :12345 -F".split(" "))
except subprocess.CalledProcessError:
print "Server already stopped."
else:
pid = re.findall('p[0-9]*', pid)[0][1:]
... | luqmaan/luqmaan.github.io | stop.py | Python | mit | 472 |
# Copyright (c) 2006,2007 Mitch Garnaat http://garnaat.org/
#
# 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, modi... | adamfisk/littleshoot-client | server/appengine/boto/s3/key.py | Python | gpl-2.0 | 31,633 |
# -*- coding: utf-8 -*-
from .config import Config
| wenxer/empire-agent | empire_agent/config/__init__.py | Python | mit | 52 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import eventlet
eventlet.monkey_patch()
import re
import sys
import errno
import logging
from settings import LOG_NAME
class BaseAuthConfig(object):
"""
read auth config and store it.
Try be a singletone
"""
def __init__(self):
... | xenolog/fuel-utils | fuel_utils/fdb_cleaner/config.py | Python | apache-2.0 | 2,221 |
from django.conf import settings
from django.contrib.auth import get_user_model
from django.contrib.auth.models import User
from django.db.models.signals import post_save, pre_save
from django.dispatch import receiver
from django.core.mail import send_mail
from django.utils.translation import gettext as _
from rest_fr... | nextcloud/appstore | nextcloudappstore/user/signals.py | Python | agpl-3.0 | 1,481 |
##
## This file is part of the libsigrokdecode project.
##
## Copyright (C) 2017 Christoph Rackwitz <christoph.rackwitz@rwth-aachen.de>
##
## 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; eith... | Entropy512/libsigrokdecode | decoders/miller/pd.py | Python | gpl-3.0 | 6,831 |
import data
import brain
import time
from json import JSONDecodeError
from socket import timeout
# Location of data directory and keyfile
datadir = r'/home/craig/KrakenBot/Data/'
keyfile = r'/home/craig/KrakenBot/Key/kraken.key'
# Trading Pairs:
# XETH ZEUR
# XXBT ZEUR
# XLTC ZEUR
# Set trading pair, OHLC timefra... | CeramicDingo/KrakenBot | remote_app.py | Python | mit | 2,001 |
"""Handles all command line actions for Berth."""
import berth.build as build
import berth.config as config
import berth.package as package
import berth.utils as utils
import click
@click.command(help='Berth use Docker containers to build packages for you, based on a YAML configuration file.')
@click.pass_context
@c... | FalconSocial/berth | berth/cli.py | Python | mit | 2,299 |
# Copyright 2012 OpenStack Foundation
# 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 requ... | nuagenetworks/tempest | tempest/api/identity/admin/v2/test_tenants.py | Python | apache-2.0 | 7,481 |
def baesoo(a):
# 파일 이름은 hw_학번.py 로 합니다.
if a%15==0:
message='3과5의 공배수입니다'
elif a%5==0:
message='5의 배수입니다'
elif a%3==0:
message= '3의 배수입니다'
else :
message='아무것도안함'
return message
def dan(a):
for x in range(1,10):
print (a*x)
| saintdragon2/python-3-lecture-2015 | homework_checker/hw_civil_3/hw_civil_googoo_15030049.py | Python | mit | 316 |
from ceo import ridge_prediction as rp
import ceo
import os
import os.path as op
import pandas as pd
import inspect
data_path = op.join(ceo.__path__[0], 'Data')
data_path = op.join(data_path, 'Cleaned Data')
def test_pred_nuclear():
"""
Function to test pred_nuclear
Input:
None
Returns:
... | uwkejia/Clean-Energy-Outlook | ceo/test_ridge_prediction.py | Python | mit | 3,043 |
#!/usr/bin/env python2
import numpy as np
import unittest
import sys
#from regionOfInterest import PlotRegion
from roi_amplitude import ROI_Amplitude
from roi_maximaAndMinima import ROI_MaximaAndMinima
class TestRegionOfInterest(unittest.TestCase):
def testFindingInterestingAmplitudePartsEmpty(self):
f... | robbje/eis | src/preprocessing/test_regionOfInterest.py | Python | mit | 3,006 |
import os
from select import select
from subprocess import PIPE
import sys
from plumbum.commands.processes import run_proc, ProcessExecutionError
#===================================================================================================
# execution modifiers (background, foreground)
#======================... | astraw38/plumbum | plumbum/commands/modifiers.py | Python | mit | 9,763 |
__author__ = 'maciej'
from time import time
class Camera(object):
def __init__(self):
self.frames = [open(f + '.jpg', 'rb').read() for f in ['1', '2', '3']]
def get_frame(self):
return self.frames[int(time()) % 3] | MaciejSzaflik/tirt-W4-Project | MSzGarbage/Camera.py | Python | mit | 239 |
import os
TEST_PATH = os.path.dirname(__file__)
| jyapayne/Atheris | tests/config.py | Python | mit | 49 |
# Copyright (c) 2016 OpenStack Foundation. 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 ... | noironetworks/neutron | neutron/objects/network.py | Python | apache-2.0 | 13,313 |
'''
Created on 2 Mar 2016
@author: steve
'''
#Copyright Stephen Fletcher
import get_ref
import amiR_finder
"""
Set conserved region sequence length (ie. 21nt)
Script returns all sequences of that length that
appear in all provided refernce sequences,
along with their positions in each. Additionally,
longest_com_se... | Mitter-lab/amiR_target_finder | modules/id_cons_seq.py | Python | mit | 6,063 |
SME, LARGE = ['micro', 'small', 'medium'], ['large']
COMPLETED_BRIEF_RESPONSE_STATUSES = ['submitted', 'pending-awarded', 'awarded']
ALL_BRIEF_RESPONSE_STATUSES = ['draft', 'submitted', 'pending-awarded', 'awarded']
PUBLISHED_BRIEF_STATUSES = ['live', 'withdrawn', 'closed', 'awarded', 'cancelled', 'unsuccessful']
def... | alphagov/digitalmarketplace-buyer-frontend | app/main/helpers/brief_helpers.py | Python | mit | 1,624 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.