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 |
|---|---|---|---|---|---|
__license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
class Recipe(object):
pass
| yeyanchao/calibre | src/calibre/web/__init__.py | Python | gpl-3.0 | 121 |
from abc import ABCMeta, abstractmethod
import numpy as np
class Illustration2VecBase(object):
__metaclass__ = ABCMeta
def __init__(self, net, tags=None, threshold=None):
self.net = net
if tags is not None:
self.tags = np.array(tags)
self.index = {t: i for i, t in enu... | rezoo/illustration2vec | i2v/base.py | Python | mit | 5,296 |
# Generated by Django 2.2.6 on 2019-10-23 14:05
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('versions', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='version',
name='needs_human_review',
... | eviljeff/olympia | src/olympia/versions/migrations/0002_version_needs_human_review.py | Python | bsd-3-clause | 393 |
"""
ldap - base module
See http://www.python-ldap.org/ for details.
$Id: __init__.py,v 1.70 2011/02/19 14:36:53 stroeder Exp $
"""
# This is also the overall release version number
__version__ = '2.3.13'
import sys
if __debug__:
# Tracing is only supported in debugging mode
import traceback
_trace_level = 0... | vmanoria/bluemix-hue-filebrowser | hue-3.8.1-bluemix/desktop/core/ext-py/python-ldap-2.3.13/Lib/ldap/__init__.py | Python | gpl-2.0 | 2,052 |
#!/usr/bin/python
from gpiozero import Button
from signal import pause
import time
#import Adafruit_CharLCD as LCD
# Raspberry Pi configuration:
lcd_rs = 27 # Change this to pin 21 on older revision Raspberry Pi's
lcd_en = 22
lcd_d4 = 25
lcd_d5 = 24
lcd_d6 = 23
lcd_d7 = 18
lcd_red = 4
lcd_green = 17
lcd_blue = 7 # ... | jgreat/reason-pi | key_switch/key_switch.py | Python | mit | 2,092 |
# coding: utf8
# 10/12/2012 jichi
# VNR's interactive machine translation online.
#
# See: http://transer.com/sdk/rest_api_function.html
# See (auth): http://translation.infoseek.ne.jp/js/translation-text.js
# See (lang): http://translation.infoseek.ne.jp/js/userinfo.js
if __name__ == '__main__':
import sys
sys.pa... | Dangetsu/vnr | Frameworks/Sakura/py/libs/vtrans/vtrans.py | Python | gpl-3.0 | 4,155 |
from flask_wtf import FlaskForm
from wtforms.fields import StringField, PasswordField, HiddenField, IntegerField, BooleanField
from wtforms.validators import DataRequired
from wtforms.widgets import HiddenInput
class LoginForm(FlaskForm):
username = StringField("username", validators=[DataRequired()])
passwor... | der-michik/c3bottles | c3bottles/views/forms.py | Python | mit | 1,168 |
import frida
import sys
from framework.logging.logger import Logger
from subprocess import Popen
from datetime import datetime
from blessings import Terminal
t = Terminal()
class Instrumentation(object):
def __init__(self, apk):
super(Instrumentation, self).__init__()
self.apk = apk
@staticm... | HackerTool/lobotomy | framework/brains/dynamic/frida/instrumentation.py | Python | mit | 5,215 |
# -*-coding:Utf-8 -*
# Copyright (c) 2010 LE GOFF Vincent
# 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
# lis... | stormi/tsunami | src/primaires/perso/equipement.py | Python | bsd-3-clause | 16,797 |
"""
Flask
-----
Flask is a microframework for Python based on Werkzeug, Jinja 2 and good
intentions. And before you ask: It's BSD licensed!
Flask is Fun
````````````
Save in a hello.py:
.. code:: python
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hell... | dawran6/flask | setup.py | Python | bsd-3-clause | 2,470 |
from __future__ import print_function
from __future__ import unicode_literals
from gi.repository import Gtk, Gdk, GLib, Pango
from pkg_resources import resource_filename # @UnresolvedImport
import logging
from . import cli
from kalite_gtk import validators
from kalite_gtk.exceptions import ValidationError
logger =... | benjaoming/ka-lite-gtk | kalite_gtk/mainwindow.py | Python | bsd-3-clause | 11,373 |
# -*- coding: utf-8 -*-
from lxml.html import document_fromstring
from widgetastic.exceptions import NoSuchElementException
from widgetastic.utils import VersionPick, Version
from widgetastic.widget import View, Text, ConditionalSwitchableView, ParametrizedView
from widgetastic_patternfly import Dropdown, BootstrapSel... | akarol/cfme_tests | cfme/common/provider_views.py | Python | gpl-2.0 | 21,334 |
import os
from leosacpy.tests.test_helper import WSTestBase, check_return_code, \
with_leosac_infrastructure, with_leosac_ws_client, ws_authenticated_as_admin
from leosacpy.wsclient import LowLevelWSClient, APIStatusCode, LeosacMessage
class WSWiegandReader(WSTestBase):
"""
Test the Websocket API of the ... | islog/leosac | python/leosacpy/tests/test_ws_wiegand_reader.py | Python | agpl-3.0 | 2,771 |
#import misc
class DocumentController(object):
"""
Keep track of the currently opened input file.
Provide the functions to be used by enviroChecker
when an eviroment is detected.
Atributes:
list insideEnviros -- keeps track of the open enviros, beng 0 the top one
int __chapterNum__ -- ... | fraret/epub-parser | src/seml_compiler.py | Python | gpl-3.0 | 1,846 |
import unittest
from minimax_kata.arena import DIRECTIONS
from minimax_kata.arena import translated_position
from minimax_kata.arena import Arena
from minimax_kata.player import Player
class TestNorthTranslation(unittest.TestCase):
def setUp(self):
self.position = (2, 2)
self.direction = DIRECTIONS.nort... | JamesChristie/minimax_kata | tests/test_arena.py | Python | gpl-3.0 | 3,266 |
# 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... | openstack/python-openstackclient | openstackclient/network/v2/l3_conntrack_helper.py | Python | apache-2.0 | 8,285 |
# 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... | hehongliang/tensorflow | tensorflow/python/ops/linalg/linalg_impl.py | Python | apache-2.0 | 13,117 |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: common/ledger.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as ... | lukehuangch/fabric | bddtests/common/ledger_pb2.py | Python | apache-2.0 | 3,410 |
# Copyright 2014 TellApart, 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 or agreed to in writi... | tellapart/taba | src/taba/agent/handlers.py | Python | apache-2.0 | 3,203 |
"""
Cone filter
Functions
---------
conefilter2d(data,window,null=None)
"""
from __future__ import print_function, division
import numpy as np
from pysar.signal import _conefilt_modc
__all__ = ['conefilter2d']
def conefilter2d(data,window,dx=1.,dy=1.,null=None,numthrd=8):
'''
conefilter2d(data,window,dx=1.,dy... | bminchew/PySAR | pysar/signal/conefilter.py | Python | gpl-3.0 | 2,666 |
#!/usr/bin/env python3
# Copyright (c) 2017-2019 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 HD Wallet keypool restore function.
Two nodes. Node1 is under test. Node0 is providing transactio... | cculianu/bitcoin-abc | test/functional/wallet_keypool_topup.py | Python | mit | 2,877 |
#: c06:ChainOfResponsibility.py
# Carry the information into the strategy:
class Messenger: pass
# The Result object carries the result data and
# whether the strategy was successful:
class Result:
def __init__(self):
self.succeeded = 0
def isSuccessful(self):
return self.succeeded
def setSuccessful(s... | tapomayukh/projects_in_python | sandbox_tapo/src/refs/TIPython/code/c06/ChainOfResponsibility.py | Python | mit | 2,687 |
# -*- coding: utf8 -*-
# ||
# +------+ / __ )(_) /_______________ _____ ___
# | 0xBC | / __ / / __/ ___/ ___/ __ `/_ / / _ \
# +------+ / /_/ / / /_/ /__/ / / /_/ / / /_/ __/
# || || /_____/_/\__/\___/_/ \__,_/ /___/\___/
#
# Copyright (C) 2011-2013 Bitcraze AB
#
# Crazyflie Nano Quadc... | capriele/crazyflie-clients-python-move | lib/cfclient/utils/joystick/linuxjsdev.py | Python | gpl-2.0 | 7,228 |
from BuildSystem.Parts.Application import Application
from BuildSystem.Parts.CompiledBinary import CompiledBinary
from BuildSystem.Parts.Library import Library
| LudoSapiens/Dev | Tools/BS/BuildSystem/Parts/__init__.py | Python | mit | 161 |
#!/usr/bin/python
# Copyright (C) 2010-2011 Reece H. Dunn
#
# This file is part of cainteoir-engine.
#
# cainteoir-engine 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
# ... | rhdunn/cainteoir-engine | tests/xmlreader.py | Python | gpl-3.0 | 7,898 |
from django.db import models
from student.models import District, State
from django.contrib.auth.models import User
from django.conf import settings
import logging
class OrganizationMetadata(models.Model):
class Meta:
db_table = 'organization_metadata'
OrganizationName = models.CharField(bla... | EduPepperPDTesting/pepper2013-testing | lms/djangoapps/organization/models.py | Python | agpl-3.0 | 3,456 |
from ppa.models import Policy, Section
import random
def get_random_policy():
num_policy = Policy.objects.count()
idx = random.randint(0, num_policy - 1)
policy = Policy.objects.get(pid=idx)
sections = Section.objects.filter(pid=idx)
return policy, sections
def get_policy(pid):
policy = Poli... | mindbergh/PrivacyPolicyAnalyser | www/ppa/utils/corpus_manager.py | Python | apache-2.0 | 419 |
import unittest
from test_conversation_manager import *
from test_performer import *
from test_emmer import *
from test_packets import *
from test_reactor import *
from test_response_router import *
from test_tftp_conversation import *
if __name__ == "__main__":
unittest.main()
| dropbox/emmer | tests/__init__.py | Python | mit | 284 |
from django import forms
from django.contrib.auth.models import User
from django.contrib.auth.forms import PasswordResetForm
from django.contrib.auth.hashers import UNUSABLE_PASSWORD
class PasswordResetFormNoActive(PasswordResetForm):
def clean_email(self):
"""
This is a literal copy from Django 1.... | EduPepperPDTesting/pepper2013-testing | lms/djangoapps/notifications/forms.py | Python | agpl-3.0 | 992 |
import logging
from waitlist.base import db
from waitlist.storage.database import Setting
logger = logging.getLogger(__name__)
def get(setting_name):
setting = db.session.query(Setting).get(setting_name)
if setting is None:
return None
else:
return setting.value
def get_int(setting_name)... | SpeedProg/eve-inc-waitlist | waitlist/utility/settings/__init__.py | Python | mit | 1,979 |
# Line too long - pylint: disable=C0301
# Copyright (c) Greenplum Inc 2011. All Rights Reserved.
from gppylib import gplog
from gppylib.commands import gp
from optparse import OptionGroup
from gppylib.gpparseopts import OptParser, OptChecker
from gppylib.mainUtils import addStandardLoggingAndHelpOptions, ProgramArgume... | hornn/interviews | tools/bin/gppylib/programs/kill.py | Python | apache-2.0 | 3,641 |
#!/usr/bin/env python
"""
SpaceHub
Copyright (C) 2013 Ryan Brown <sb@ryansb.com>, Sam Lucidi <mansam@csh.rit.edu>,
Ross Delinger <rossdylan@csh.rit.edu>, Greg Jurman <jurman.greg@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General ... | ryansb/spacehub | app.py | Python | agpl-3.0 | 2,131 |
# Python 2.7 and 3.5
# Author: Christoph Schranz, Salzburg Research
import sys
import math
import random
import time
import itertools
from collections import Counter
class Tweak:
""" The Tweaker is an auto rotate class for 3D objects.
It requires following mesh format as input:
[[v1x,v1y,v1z],
[v2x... | iot-salzburg/STL-tweaker | MeshTweaker.py | Python | lgpl-3.0 | 12,367 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import logging
import uuid
from hashlib import md5
from werkzeug import urls
from odoo import api, fields, models, _
from odoo.addons.payment.models.payment_acquirer import ValidationError
from odoo.tools.float_utils i... | ddico/odoo | addons/payment_payulatam/models/payment.py | Python | agpl-3.0 | 7,075 |
"""
ioHub Common Eye Tracker Interface for EyeLink(C) Systems.
EyeLink(C) calibration graphics implemented using PsychoPy.
"""
# Part of the PsychoPy.iohub library
# Copyright (C) 2012-2016 iSolver Software Solutions
# Distributed under the terms of the GNU General Public License (GPL).
import numpy as np
from PIL impo... | psychopy/versions | psychopy/iohub/devices/eyetracker/hw/sr_research/eyelink/eyeLinkCoreGraphicsIOHubPsychopy.py | Python | gpl-3.0 | 30,059 |
# vim: set fileencoding=utf-8 sw=4 ts=4 et :
# pylint: disable-msg=C0111,W0212,R0904
# Copyright (C) 2006-2020 CS GROUP - France
# License: GNU GPL v2 <http://www.gnu.org/licenses/gpl-2.0.html>
from __future__ import absolute_import, print_function
import os
import unittest
import shutil
import glob
import subprocess
... | vigilo/vigiconf | src/vigilo/vigiconf/test/test_conf_parse.py | Python | gpl-2.0 | 32,240 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# (c) Copyright 2012-2015 Hewlett Packard Enterprise Development LP
# 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 ... | hpe-storage/python-3parclient | hpe3parclient/exceptions.py | Python | apache-2.0 | 12,347 |
# 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
# distributed under the... | daasbank/swift | swift/common/storage_policy.py | Python | apache-2.0 | 27,430 |
from django.conf.urls import url
from src.accounts.views import (
logout_view,
settings, password,
register_view
)
from django.contrib.auth import views as auth_views
urlpatterns = [
url(r'^login/$', auth_views.login, name='login'),
url(r'^logout/$', logout_view, name='logout'),
url(r'^registe... | tyagow/FacebookBot | src/accounts/urls.py | Python | mit | 473 |
from flaskiwsapp.users.controllers.userControllers import get_user_by_id, get_user_by_email
from flaskiwsapp.snippets.customApi import DUMMY_ERROR_CODE
from flask_jwt import JWTError
from flask import jsonify
from flaskiwsapp.snippets.exceptions.userExceptions import UserInactiveException, UserDoesNotExistsException
fr... | rafasis1986/EngineeringMidLevel | flaskiwsapp/auth/jwt.py | Python | mit | 1,655 |
__author__ = 'andrucuna'
# Ball motion with an explicit timer
import simplegui
# Initialize globals
WIDTH = 600
HEIGHT = 400
BALL_RADIUS = 20
init_pos = [WIDTH / 2, HEIGHT / 2]
vel = [0, 3] # pixels per tick
time = 0
# define event handlers
def tick():
global time
time = time + 1
def draw(canvas):
# ... | andrucuna/python | interactivepython-coursera/interactivepython/week4/Motion.py | Python | gpl-2.0 | 796 |
import sys
str = ''
for line in sys.stdin:
str += line.strip()
if len(str)>0 and str[-1] == '#':
num = int(str[:-1], 2)
if num%131071 == 0:
print("YES")
else:
print("NO")
str = ''
| arash16/prays | UVA/vol-101/10176.py | Python | mit | 244 |
from __future__ import print_function
from django.test import TestCase
from django.contrib.auth.models import User
from imager_images.models import Photo, Album
from django.test import Client
import factory
class UserFactory(factory.django.DjangoModelFactory):
class Meta:
model = User
django_get_... | joelstanner/django-imager | imager/imager/tests.py | Python | mit | 2,457 |
# -*- coding: utf-8 -*-
"""
Source objects abstract online news source websites & domains.
www.cnn.com would be its own source.
"""
__title__ = 'newspaper'
__author__ = 'Lucas Ou-Yang'
__license__ = 'MIT'
__copyright__ = 'Copyright 2014, Lucas Ou-Yang'
import logging
from . import network
from .article import Article... | cantino/newspaper | newspaper/source.py | Python | mit | 15,054 |
#!/usr/bin/env python2
from __future__ import division
import rosbag, rospy, numpy as np
import sys, os, cv2, glob
from itertools import izip, repeat
import argparse
# try to find cv_bridge:
try:
from cv_bridge import CvBridge
except ImportError:
# assume we are on an older ROS version, and try loading the du... | OSUrobotics/bag2video | bag2video.py | Python | bsd-3-clause | 4,496 |
# -*- coding: utf-8 -*-
# Copyright 2015 Objectif Libre
#
# 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 ... | muraliselva10/cloudkitty | cloudkitty/collector/fake.py | Python | apache-2.0 | 4,824 |
# encoding: utf-8
'''
Created on 7 janv. 2016
@author: remipassmoilesel
'''
# creer une liste
stringList = ["hello", "world"]
# ajouter un elemenrt
stringList.append("!")
# taille de la liste
len(stringList)
for i, val in enumerate(stringList):
print i, val
mon_dictionnaire = {}
mon_dictionnaire["pseudo... | remipassmoilesel/python_scripts | memo_python/lists.py | Python | gpl-3.0 | 784 |
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
#
# 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... | veger/ansible | lib/ansible/utils/module_docs_fragments/openstack.py | Python | gpl-3.0 | 4,156 |
#! /usr/bin/python
# -*- coding:utf-8 -*-
from flask import Flask, request, render_template, jsonify
app = Flask(__name__)
import paramiko
import time
#Recherche du chemin du fichier main (sans le nom)
path = __file__
nomFichierCourant = "main.py"
taille = len(nomFichierCourant)
cheminMain = path[0:-taill... | MarionPiEnsg/RaspiModel | Application/Serveur_Flask/main.py | Python | gpl-3.0 | 21,092 |
from __future__ import absolute_import
from sentry.models.projectoption import ProjectOption
from sentry.testutils import TestCase
from sentry.utils.safe import set_path
from sentry.message_filters import (
_localhost_filter,
_browser_extensions_filter,
_web_crawlers_filter,
_legacy_browsers_filter,
)
... | mvaled/sentry | tests/integration/test_message_filters.py | Python | bsd-3-clause | 5,142 |
from pulp.bindings.base import PulpAPI
from pulp.bindings.search import SearchAPI
class UserAPI(PulpAPI):
"""
Connection class to access user specific calls
"""
def __init__(self, pulp_connection):
super(UserAPI, self).__init__(pulp_connection)
self.base_path = "/v2/users/"
def us... | rbramwell/pulp | bindings/pulp/bindings/auth.py | Python | gpl-2.0 | 4,601 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'AddImagesWidget.ui'
#
# Created: Tue Oct 9 22:34:29 2012
# by: pyside-uic 0.2.13 running on PySide 1.1.0
#
# WARNING! All changes made in this file will be lost!
from PySide import QtCore, QtGui
class Ui_AddImagesWidget(object):
... | eugenesan/postman | postman_lib/Ui_AddImagesWidget.py | Python | gpl-3.0 | 2,913 |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
# -------------------------------------------------------------------------... | hronoses/vispy | vispy/visuals/text/text.py | Python | bsd-3-clause | 19,968 |
# Copyright 2018 ForgeFlow, S.L. <contact@forgeflow.com>
# Copyright 2018-2019 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl
{
"name": "Plantillas MIS Builder para informes contables españoles",
"summary": "Plantillas MIS Builder para informes contables españoles",
... | OCA/l10n-spain | l10n_es_mis_report/__manifest__.py | Python | agpl-3.0 | 1,087 |
from pyjamas.ui.Grid import Grid
_logger = None
class Logger(Grid):
def __new__(cls):
global _logger
# make sure there is only one instance of this class
if _logger:
return _logger
_logger = Grid.__new__(cls)
return _logger
def __init__(self, target="", mes... | lovelysystems/pyjamas | examples/mail/Logger.py | Python | apache-2.0 | 1,965 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('author', '0002_author_bio'),
]
operations = [
migrations.AddField(
model_name='author',
name='bio_as... | PARINetwork/pari | author/migrations/0003_auto_20160619_1946.py | Python | bsd-3-clause | 2,307 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Urwid escape sequences common to curses_display and raw_display
# Copyright (C) 2004-2011 Ian Ward
#
# This library 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 ... | urwid/urwid | urwid/escape.py | Python | lgpl-2.1 | 15,967 |
import os
import pickle
import tensorflow as tf
from utils import ops
from abc import abstractmethod, ABC
class Model(ABC):
"""
An Abstract Base Class for models in general. To create a new model, you just have to
implement the missing methods for this class. The rest will be taken care by the
utilit... | mindgarage/Ovation | models/model.py | Python | apache-2.0 | 10,557 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from .common import InfoExtractor
from ..compat import compat_parse_qs
from ..utils import (
int_or_none,
parse_duration,
parse_iso8601,
xpath_text,
)
class FolketingetIE(InfoExtractor):
IE_DESC = 'Folketinget (ft.dk; Danish parliame... | apllicationCOM/youtube-dl-api-server | youtube_dl_server/youtube_dl/extractor/folketinget.py | Python | unlicense | 2,557 |
class Solution:
"""
@param obstacleGrid: An list of lists of integers
@return: An integer
"""
def uniquePathsWithObstacles(self, obstacleGrid):
# write your code here
res = []
for i in range(len(obstacleGrid)):
res.append([])
for j in range(len(obstacl... | Rhadow/leetcode | lintcode/Easy/115_Unique_paths_II.py | Python | mit | 756 |
import os
import unittest
import tempfile
from bork import buuk
class BuuksTest(unittest.TestCase):
def test_buuks(self):
return
PATH = "%s/../../buuks/.test" % os.path.dirname(__file__)
class PathTest(unittest.TestCase):
def test_path(self):
b = buuk.Path(PATH)
self.assertTrue(os... | cablehead/bork | bork/test/test_buuk.py | Python | mit | 2,475 |
# Copyright 2020 The 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 to in writing... | google-research/sam | sam_jax/train.py | Python | apache-2.0 | 7,099 |
from ..utils import *
##
# Hero Powers
# Pile On!
class BRMA01_2:
activate = (
Summon(CONTROLLER, RANDOM(CONTROLLER_DECK + MINION)),
Summon(OPPONENT, RANDOM(OPPONENT_DECK + MINION))
)
class BRMA01_2H:
activate = (
Summon(CONTROLLER, RANDOM(CONTROLLER_DECK + MINION) * 2),
Summon(OPPONENT, RANDOM(OPPONENT_... | butozerca/fireplace | fireplace/cards/blackrock/adventure.py | Python | agpl-3.0 | 2,950 |
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | chengduoZH/Paddle | python/paddle/fluid/tests/book/notest_understand_sentiment.py | Python | apache-2.0 | 13,855 |
import os
import warnings
from collections import namedtuple
from . import djbec
__all__ = ['crypto_sign', 'crypto_sign_open', 'crypto_sign_keypair', 'Keypair',
'PUBLICKEYBYTES', 'SECRETKEYBYTES', 'SIGNATUREBYTES']
PUBLICKEYBYTES = 32
SECRETKEYBYTES = 64
SIGNATUREBYTES = 64
Keypair = namedtuple('Keypair'... | pcu4dros/pandora-core | workspace/lib/python3.5/site-packages/wheel/signatures/ed25519py.py | Python | mit | 1,669 |
#!/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.
"""
Pretrained wizard of wikipedia end2end generative model.
"""
from parlai.core.build_data import download_models
de... | facebookresearch/ParlAI | parlai/zoo/wizard_of_wikipedia/end2end_generator.py | Python | mit | 527 |
__doc__ = """
Dirt Simple Events
A Dispatcher (or a subclass of Dispatcher) stores event handlers that
are 'fired' simple event objects when interesting things happen.
Create a dispatcher:
>>> d = Dispatcher()
Now create a handler for the event and subscribe it to the dispatcher
to handle Event events. A handler... | gloaec/trifle | src/rdflib/events.py | Python | gpl-3.0 | 2,618 |
# 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... | sekikn/incubator-airflow | chart/tests/test_webserver.py | Python | apache-2.0 | 19,141 |
#!/usr/bin/python
# Copyright (c) 2017 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['pre... | sestrella/ansible | lib/ansible/modules/cloud/amazon/aws_waf_web_acl.py | Python | gpl-3.0 | 13,044 |
from __future__ import print_function, unicode_literals
import json
def test_process_team_join(realish_eventrouter, team):
# delete charles so we can add him
del team.users["U4096CBHC"]
assert len(team.users) == 3
datafile = "_pytest/data/websocket/1485975606.59-team_join.json"
data = json.load... | wee-slack/wee-slack | _pytest/test_processteamjoin.py | Python | mit | 509 |
import scriptcontext
from . import utility as rhutil
import Rhino
import System.Guid
from .view import __viewhelper
def AddAlignedDimension(start_point, end_point, point_on_dimension_line, style=None):
"""Adds an aligned dimension object to the document. An aligned dimension
is a linear dimension lined up wit... | ksteinfe/decodes | src/decodes/io/rhinoscript/dimension.py | Python | gpl-3.0 | 23,399 |
import json
import datetime
import asyncio
from asyncio.subprocess import PIPE
from subprocess import Popen, PIPE
import os
import random
import logging
import sys
from hypersh_client.main.hypersh import HypershClient
from sanic.response import json as json_resp
from urllib3.exceptions import NewConnectionError
from ... | eventjumbler/selenium-container-autoscale | proxy/logic.py | Python | mit | 13,831 |
"""zinnia-theme-foundation"""
__version__ = '1.0.2'
__license__ = 'GPL'
__author__ = 'gustavi'
__email__ = 'augustin.laville@gustavi.net'
__url__ = 'https://github.com/django-blog-zinnia/zinnia-theme-foundation'
| django-blog-zinnia/zinnia-theme-foundation | zinnia_foundation/__init__.py | Python | gpl-3.0 | 214 |
#
# Written by Luke Kenneth Casson Leighton <lkcl@lkcl.net>
# This theme is demonstrates the interval timer changing.
#this import statement allows access to the karamba functions
import karamba
seq = 0
text = None
#this is called when you widget is initialized
def initWidget(widget):
karamba.redrawWidget(widget... | serghei/kde3-kdeutils | superkaramba/examples/change_interval/interval.py | Python | gpl-2.0 | 1,292 |
Experiment(description='Trying faster version',
data_dir='../data/tsdlr-250/',
max_depth=8,
random_order=True,
k=1,
debug=False,
local_computation=False,
n_rand=4,
sd=4,
max_jobs=400,
verbose=False,
... | ekamioka/gpss-research | experiments/2013-08-28-time-series.py | Python | mit | 620 |
# Copyright 2015 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.
def _RunTests(input_api, output_api):
return (input_api.canned_checks.RunUnitTestsInDirectory(
input_api, output_api, '.', files_to_check=[r'.+_test... | youtube/cobalt | build/util/lib/common/PRESUBMIT.py | Python | bsd-3-clause | 513 |
#!/usr/bin/python3
from app.wdnyc import app
app.run(debug=True)
| TanukiDemon/WhatDoNYC | run.py | Python | gpl-3.0 | 65 |
# coding=utf-8
from __future__ import unicode_literals
from .. import Provider as CompanyProvider
def company_id_checksum(digits):
digits = list(digits)
weights = 6, 5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2
dv = sum(w * d for w, d in zip(weights[1:], digits))
dv = (11 - dv) % 11
dv = 0 if dv >= 10 else... | deanishe/alfred-fakeum | src/libs/faker/providers/company/pt_BR/__init__.py | Python | mit | 2,945 |
"""
Programa de Segmentacion
Contiene Binarizacion, promedios de polarizacion, corte mediante contornos
"""
import cv2 #Opencv 3.000 a 32bits
import numpy as np
from skimage.filters import threshold_otsu
from scipy.ndimage import gaussian_filter
from skimage import measure
from skimage import filters
def avgPol(matrix... | xteeven/multispectral | Bin/Segment.py | Python | apache-2.0 | 2,509 |
# Copyright 2016 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 applicable law or ag... | bda2017-shallowermind/MusTGAN | magenta/magenta/models/shared/events_rnn_graph.py | Python | apache-2.0 | 8,269 |
"""
This module contains the models for the setup
package
.. module:: application.setup.models
.. moduleauthor:: Devin Schwab <dts34@case.edu>
"""
from google.appengine.ext import db
class SetupModel(db.Model):
"""
This model will be used to
store which versions have
been configured
... | rhololkeolke/apo-website-devin | src/application/setup/models.py | Python | bsd-3-clause | 383 |
"""
NOTE:
the below code is to be maintained Python 2.x-compatible
as the whole Cookiecutter Django project initialization
can potentially be run in Python 2.x environment
(at least so we presume in `pre_gen_project.py`).
TODO: ? restrict Cookiecutter Django project initialization to Python 3.x environ... | trungdong/cookiecutter-django | hooks/post_gen_project.py | Python | bsd-3-clause | 12,061 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# encoding=UTF8
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file ... | TieWei/nova | nova/tests/db/test_db_api.py | Python | apache-2.0 | 311,863 |
# -*- coding: utf-8 -*-
"""
Copyright [2009-2020] EMBL-European Bioinformatics Institute
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... | RNAcentral/rnacentral-import-pipeline | rnacentral_pipeline/databases/silva/helpers.py | Python | apache-2.0 | 3,561 |
Flags = {
'production' : True
}
Folder = {
'rescanIntervalS' : 45
}
| Jvlythical/KoDrive | kodrive/data/config.py | Python | mit | 77 |
# -*- coding: utf-8 -*-
# Import the reverse lookup function
from django.core.urlresolvers import reverse
# view imports
from django.views.generic import DetailView
from django.views.generic import RedirectView
from django.views.generic import UpdateView
from django.views.generic import ListView
# Only authenticated ... | zlorenz/synergy | synergy/users/views.py | Python | bsd-3-clause | 3,016 |
"""
"""
from __future__ import absolute_import, print_function, unicode_literals
import datetime
import numbers
import six
from .exceptions import ValidationError
from future.utils import raise_with_traceback
def check_length(value, min_length=None, max_length=None):
if min_length and len(value) < min_length:
... | anthonyalmarza/ngen | ngen/validators.py | Python | mit | 2,250 |
# Copyright 2019 DeepMind Technologies Limited
#
# 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 agr... | deepmind/open_spiel | open_spiel/python/examples/uniform_policy_exploitability.py | Python | apache-2.0 | 1,104 |
"""Connect to a MySensors gateway via pymysensors API."""
import logging
import voluptuous as vol
from homeassistant.components.mqtt import valid_publish_topic, valid_subscribe_topic
from homeassistant.const import CONF_OPTIMISTIC
from homeassistant.core import callback
import homeassistant.helpers.config_validation ... | leppa/home-assistant | homeassistant/components/mysensors/__init__.py | Python | apache-2.0 | 5,788 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Addons modules by CLEARCORP S.A.
# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
#
# This program is free software: you can redistribute... | sysadminmatmoz/odoo-clearcorp | account_banking_ccorp/account_banking_ccorp.py | Python | agpl-3.0 | 2,646 |
"""
Compatibility layer for Python 3/Python 2 single codebase
"""
import sys
PY3_OR_LATER = sys.version_info[0] >= 3
PY27 = sys.version_info[:2] == (2, 7)
try:
_basestring = basestring
_bytes_or_unicode = (str, unicode)
except NameError:
_basestring = str
_bytes_or_unicode = (bytes, str)
def with_me... | mbayon/TFG-MachineLearning | venv/lib/python3.6/site-packages/sklearn/externals/joblib/_compat.py | Python | mit | 429 |
#!/usr/bin/env python3
# Copyright 2018 The Crashpad 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
#
# Unle... | nwjs/chromium.src | third_party/crashpad/crashpad/build/install_linux_sysroot.py | Python | bsd-3-clause | 2,174 |
##
# Copyright 2013-2015 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://vscentrum.be/nl/en),
# the Hercules foundation (htt... | valtandor/easybuild-framework | test/framework/sandbox/easybuild/tools/module_naming_scheme/test_module_naming_scheme_more.py | Python | gpl-2.0 | 2,999 |
import os
import csv
def deleteKeys(folder, keys):
for fil in os.listdir(folder):
if os.path.splitext(fil)[1] == '.csv':
with open(os.path.join(folder, fil)) as f:
rows = [row for row in csv.reader(f)]
origLength = len(rows)
rows = [row for row in... | nikwin/ecsCompiler | deleteRows.py | Python | mit | 728 |
# Draw graph x-axios is the number of nodes in the network.
import re
import sys
import os
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.ticker import NullFormatter # useful for `logit` scale
from mininet.log import setLogLevel, output, info
# Read the experimental result data file in a specfied ... | iamxg/minindn-wifi | ndnwifi/averesultgraph-consumer-bread.py | Python | gpl-3.0 | 8,800 |
import os
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'tango_with_django_project.settings')
import django
django.setup()
from rango.models import Category, Page
def populate():
python_cat = add_cat('Python')
add_page(cat=python_cat,
title="Official Python Tutorial",
url="http://docs.pyt... | nallar/WAD-TangoWithDjango | tango_with_django_project/populate_rango.py | Python | mit | 1,823 |
# coding=utf-8
""""
Random Collaborative Filtering Recommender
[Item Recommendation (Ranking)]
Random predicts a user’s ranking based on random scores.
"""
# © 2019. Case Recommender (MIT License)
import random
from caserec.recommenders.item_recommendation.base_item_recommendation import BaseItemRecomm... | ArthurFortes/CaseRecommender | caserec/recommenders/item_recommendation/random_rec.py | Python | mit | 3,673 |
from django.core.exceptions import PermissionDenied
from django.http import HttpResponse
from django.contrib.auth.decorators import login_required
from django.shortcuts import render_to_response
from django.template import RequestContext
from review_app.models import ReviewSession, ReviewUser
@login_required
def prot... | hacknashvillereview/review_application | review_app/review_app/views.py | Python | mit | 1,254 |
#
# Copyright (c) 2008-2015 Citrix Systems, 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 l... | benfinke/ns_python | nssrc/com/citrix/netscaler/nitro/resource/config/rise/riseapbrsvc.py | Python | apache-2.0 | 5,867 |
#MenuTitle: Garbage Collection
# -*- coding: utf-8 -*-
from __future__ import division, print_function, unicode_literals
__doc__="""
Removes annotations, glyph notes, guides, and node names.
"""
import vanilla
class GarbageCollection( object ):
def __init__( self ):
# Window 'self.w':
windowWidth = 310
window... | mekkablue/Glyphs-Scripts | Glyph Names, Notes and Unicode/Garbage Collection.py | Python | apache-2.0 | 11,827 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.