commit stringlengths 40 40 | subject stringlengths 4 1.73k | repos stringlengths 5 127k | old_file stringlengths 2 751 | new_file stringlengths 2 751 | new_contents stringlengths 1 8.98k | old_contents stringlengths 0 6.59k | license stringclasses 13
values | lang stringclasses 23
values |
|---|---|---|---|---|---|---|---|---|
0fc2cc8aafc1cf778ecc12439becf8482cb47097 | resolve imports | jharris119/set-game,jharris119/set-game,jharris119/set-game | setapp.py | setapp.py | import os
import cherrypy
from ws4py.server.cherrypyserver import WebSocketPlugin, WebSocketTool
from app.setutils import Card
import webservices.solitairegame
import webservices.multiplayergame
class SetApp:
homepage = ''
@cherrypy.expose
def index(self):
try:
return open(self.home... | import os
import cherrypy
from ws4py.server.cherrypyserver import WebSocketPlugin, WebSocketTool
from app.setutils import Card
import webservices.solitairegame
class SetApp:
homepage = ''
@cherrypy.expose
def index(self):
try:
return open(self.homepage)
except FileNotFoundEr... | mit | Python |
6b276c384141bd2f2a22523184db349a91849169 | Determine supported http methods from the classes. | jaapverloop/massa | massa/api.py | massa/api.py | # -*- coding: utf-8 -*-
from flask import Blueprint, jsonify, g, request, url_for
from flask.views import MethodView
from .domain import EntityNotFoundError, InvalidInputError
def endpoint(f):
def wrapper(*args, **kwargs):
try:
rv = f(*args, **kwargs)
except EntityNotFoundError as e:
... | # -*- coding: utf-8 -*-
from flask import Blueprint, jsonify, g, request, url_for
from flask.views import MethodView
from .domain import EntityNotFoundError, InvalidInputError
def endpoint(f):
def wrapper(*args, **kwargs):
try:
rv = f(*args, **kwargs)
except EntityNotFoundError as e:
... | mit | Python |
3cc3c22acbdc84124bade7c6f81af016951cb4cd | Fix typo in stream_spec. | PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge | spec/data/stream_spec.py | spec/data/stream_spec.py | import mock
from data import stream
from spec.mamba import *
with description('stream'):
with it('instantiates without errors'):
expect(calling(stream.Stream)).not_to(raise_error)
with it('subscribes without errors'):
s = stream.Stream()
expect(calling(s.subscribe, mock.Mock())).not_to(raise_error)
... | import mock
from data import stream
from spec.mamba import *
with description('stream'):
with it('instantiates without errors'):
expect(calling(stream.Stream)).not_to(raise_error)
with it('subscribes without errors'):
s = stream.Stream()
expect(calling(s.subscribe, mock.Mock())).not_to(raise_error)
... | mit | Python |
1f59ad4a5fa14a420c683cfd8713c0eb31a9acec | Bump version number for aio. | aioTV/django-rest-swagger,aioTV/django-rest-swagger,aioTV/django-rest-swagger | rest_framework_swagger/__init__.py | rest_framework_swagger/__init__.py | VERSION = '0.3.5-aio-v1'
DEFAULT_SWAGGER_SETTINGS = {
'exclude_namespaces': [],
'api_version': '',
'api_key': '',
'token_type': 'Token',
'enabled_methods': ['get', 'post', 'put', 'patch', 'delete'],
'is_authenticated': False,
'is_superuser': False,
'permission_denied_handler': None,
... | VERSION = '0.3.2'
DEFAULT_SWAGGER_SETTINGS = {
'exclude_namespaces': [],
'api_version': '',
'api_key': '',
'token_type': 'Token',
'enabled_methods': ['get', 'post', 'put', 'patch', 'delete'],
'is_authenticated': False,
'is_superuser': False,
'permission_denied_handler': None,
'resou... | bsd-2-clause | Python |
62a978256476754a7f604b2f872b7bd221930ac2 | add test_debian_repo and test_nested_debian_repo | alfredodeza/merfi | merfi/tests/test_repocollector.py | merfi/tests/test_repocollector.py | from merfi.collector import RepoCollector, DebRepo
from os.path import join, dirname
class TestRepoCollector(object):
def setup(self):
self.repos = RepoCollector(path='/', _eager=False)
def test_simple_tree(self, deb_repotree):
repos = RepoCollector(path=deb_repotree)
# The root of t... | from merfi.collector import RepoCollector
from os.path import join, dirname
class TestRepoCollector(object):
def setup(self):
self.repos = RepoCollector(path='/', _eager=False)
def test_simple_tree(self, deb_repotree):
repos = RepoCollector(path=deb_repotree)
# The root of the deb_re... | mit | Python |
19fd0b75e07311bb3eb863d132125325e3478424 | Fix typo in docstring | m-ober/byceps,homeworkprod/byceps,m-ober/byceps,m-ober/byceps,homeworkprod/byceps,homeworkprod/byceps | byceps/services/user_avatar/models.py | byceps/services/user_avatar/models.py | """
byceps.services.user_avatar.models
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2017 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from collections import namedtuple
from datetime import datetime
from pathlib import Path
from flask import current_app, url_for
from sqlalchemy.ex... | """
byceps.services.user_avatar.models
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2017 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from collections import namedtuple
from datetime import datetime
from pathlib import Path
from flask import current_app, url_for
from sqlalchemy.ex... | bsd-3-clause | Python |
ef03541b2b25ab9cf34deec554a19a32dad7fbec | Add new line to end of init file for Meta Writer application | percival-detector/odin-data,odin-detector/odin-data,percival-detector/odin-data,odin-detector/odin-data,odin-detector/odin-data,percival-detector/odin-data,percival-detector/odin-data,odin-detector/odin-data,odin-detector/odin-data,odin-detector/odin-data,percival-detector/odin-data,odin-detector/odin-data,percival-det... | tools/python/odin_data/meta_writer/__init__.py | tools/python/odin_data/meta_writer/__init__.py | from pkg_resources import require
require('pygelf==0.3.1')
require("h5py==2.8.0")
require('pyzmq==16.0.2')
| from pkg_resources import require
require('pygelf==0.3.1')
require("h5py==2.8.0")
require('pyzmq==16.0.2') | apache-2.0 | Python |
514074dee639b30fb56ec664804bdd3f533befda | Apply `cacheonceproperty` on props of Tree & Chunk. | drowse314-dev-ymat/xmlpumpkin | xmlpumpkin/tree.py | xmlpumpkin/tree.py | # encoding: utf-8
from lxml import etree
from .utils import cacheonceproperty
XML_ENCODING = 'utf-8'
class Tree(object):
"""Tree accessor for CaboCha xml."""
def __init__(self, cabocha_xml):
self._element = etree.fromstring(
cabocha_xml.encode(XML_ENCODING),
)
@cacheoncepr... | # encoding: utf-8
from lxml import etree
XML_ENCODING = 'utf-8'
class Tree(object):
"""Tree accessor for CaboCha xml."""
def __init__(self, cabocha_xml):
self._element = etree.fromstring(
cabocha_xml.encode(XML_ENCODING),
)
@property
def chunks(self):
chunk_ele... | mit | Python |
7aae3f244f15d31e4d5a0c844df5cbbb5a594e84 | update mongostring | oschumac/python-uart-pi-xbridge,oschumac/python-uart-pi-xbridge,oschumac/python-uart-pi-xbridge | mongo.py | mongo.py | import os
import sys
import pymongo
from bson import BSON
from bson import json_util
MONGODB_URI_LOCAL = 'mongodb://aps:aps@127.0.0.1:27017/aps'
def getlast3():
try:
client = pymongo.MongoClient(MONGODB_URI_LOCAL)
except:
print('Error: Unable to Connect')
connection = None
db = client['aps']
curs... | import os
import sys
import pymongo
from bson import BSON
from bson import json_util
MONGODB_URI_REMOTE = 'mongodb://Lars_2009:Lars65535@euve76271.serverprofi24.de:21060/larscgmtest'
MONGODB_URI_LOCAL = 'mongodb://aps:aps@127.0.0.1:27017/aps'
def getlast3():
try:
client = pymongo.MongoClient(MONGODB_URI_LOCAL)
... | mit | Python |
de3b4775b7dbcecc9c42e18c59b35485f83ca74a | Update max-chunks-to-make-sorted-i.py | kamyu104/LeetCode,kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015 | Python/max-chunks-to-make-sorted-i.py | Python/max-chunks-to-make-sorted-i.py | # Time: O(n)
# Space: O(1)
# Given an array arr that is a permutation of [0, 1, ..., arr.length - 1],
# we split the array into some number of "chunks" (partitions), and individually sort each chunk.
# After concatenating them, the result equals the sorted array.
#
# What is the most number of chunks we could have ma... | # Time: O(n)
# Space: O(1)
class Solution(object):
def maxChunksToSorted(self, arr):
"""
:type arr: List[int]
:rtype: int
"""
result, max_i = 0, 0
for i, v in enumerate(arr):
max_i = max(max_i, v)
if max_i == i:
result += 1
... | mit | Python |
32fccb04bac6be7e79f6b05b727e5e847fef498c | Update misc.py | CounterClops/Counter-Cogs | misc/misc.py | misc/misc.py | import discord
from discord.ext import commands
import random
import time
class misc:
"""My custom cog that does stuff"""
def __init__(self, bot):
self.bot = bot
self.bank = Bank(bot, "data/economy/bank.json")
def role_colour():
#Rand between 0 - 256
a = random.randrange(0,... | mit | Python | |
4b9948e665c78df468917b0906afc288244fa303 | add doc back in. | twaugh/osbs-client,jpopelka/osbs-client,jpopelka/osbs-client,pombredanne/osbs-client,TomasTomecek/osbs,bfontecc007/osbs-client,vrutkovs/osbs-client,twaugh/osbs-client,TomasTomecek/osbs,vrutkovs/osbs-client,pbabinca/osbs,pombredanne/osbs-client,projectatomic/osbs-client,bfontecc007/osbs-client,pbabinca/osbs,projectatomi... | osbs/exceptions.py | osbs/exceptions.py | """
Exceptions raised by OSBS
"""
class OsbsException(Exception):
pass
class OsbsResponseException(OsbsException):
""" OpenShift didn't respond with OK (200) status """
def __init__ (self, message, status_code, *args, **kwargs):
super (OsbsResponseException, self).__init__ (message, *args, **kwar... | """
Exceptions raised by OSBS
"""
class OsbsException(Exception):
pass
class OsbsResponseException(OsbsException):
def __init__ (self, message, status_code, *args, **kwargs):
super (OsbsResponseException, self).__init__ (message, *args, **kwargs)
self.status_code = status_code
class OsbsNetwo... | bsd-3-clause | Python |
bbf8886a2cbf4fa371f0a67157fdd3df3dfa47dd | Fix broken MLflow DB README link in CLI docs (#2377) | mlflow/mlflow,mlflow/mlflow,mlflow/mlflow,mlflow/mlflow,mlflow/mlflow,mlflow/mlflow,mlflow/mlflow | mlflow/db.py | mlflow/db.py | import click
import mlflow.store.db.utils
@click.group("db")
def commands():
"""
Commands for managing an MLflow tracking database.
"""
pass
@commands.command()
@click.argument("url")
def upgrade(url):
"""
Upgrade the schema of an MLflow tracking database to the latest supported version.
... | import click
import mlflow.store.db.utils
@click.group("db")
def commands():
"""
Commands for managing an MLflow tracking database.
"""
pass
@commands.command()
@click.argument("url")
def upgrade(url):
"""
Upgrade the schema of an MLflow tracking database to the latest supported version.
... | apache-2.0 | Python |
d5f979236089e7cb3de90b03303e1c3af967331c | add UW-Madison, minor formatting | materialsproject/MPContribs,materialsproject/MPContribs,materialsproject/MPContribs,materialsproject/MPContribs | uw_si2/rest/rester.py | uw_si2/rest/rester.py | from __future__ import division, unicode_literals
import six, bson, os
from bson.json_util import dumps, loads
from mpcontribs.rest.rester import MPContribsRester
from mpcontribs.io.core.utils import get_short_object_id
from mpcontribs.io.archieml.mpfile import MPFile
from pandas import Series
class UWSI2Rester(MPCont... | from __future__ import division, unicode_literals
import six, bson, os
from bson.json_util import dumps, loads
from mpcontribs.rest.rester import MPContribsRester
from mpcontribs.io.core.utils import get_short_object_id
from mpcontribs.io.archieml.mpfile import MPFile
from pandas import Series
class UWSI2Rester(MPCont... | mit | Python |
af54f9666b15cd68e5404b60f495f6d51c1470b1 | Fix upload_manual_flac command to add its arguments | karamanolev/WhatManager2,karamanolev/WhatManager2,karamanolev/WhatManager2,karamanolev/WhatManager2 | WhatManager2/management/commands/upload_manual_flac.py | WhatManager2/management/commands/upload_manual_flac.py | #!/usr/bin/env python
from __future__ import unicode_literals
import requests
import time
from django.core.management.base import BaseCommand
from WhatManager2.utils import wm_unicode
from home.models import get_what_client
from what_transcode.tasks import TranscodeSingleJob
def _add_to_wm_transcode(what_id):
... | #!/usr/bin/env python
from __future__ import unicode_literals
import time
from django.core.management.base import BaseCommand
import requests
from WhatManager2.utils import wm_unicode
from home.models import get_what_client
from what_transcode.tasks import TranscodeSingleJob
def _add_to_wm_transcode(what_id):
... | mit | Python |
fdeb06bdf33a55413f1f8f8cd780c84438ad2277 | add missing import | ZeitOnline/zeit.content.cp,ZeitOnline/zeit.content.cp | src/zeit/content/cp/browser/blocks/av.py | src/zeit/content/cp/browser/blocks/av.py | # Copyright (c) 2009 gocept gmbh & co. kg
# See also LICENSE.txt
from zeit.content.cp.i18n import MessageFactory as _
import zeit.content.cp.interfaces
import zope.app.pagetemplate
import zope.formlib.form
class EditProperties(zope.formlib.form.SubPageEditForm):
template = zope.app.pagetemplate.ViewPageTemplate... | # Copyright (c) 2009 gocept gmbh & co. kg
# See also LICENSE.txt
import zeit.content.cp.interfaces
import zope.app.pagetemplate
import zope.formlib.form
class EditProperties(zope.formlib.form.SubPageEditForm):
template = zope.app.pagetemplate.ViewPageTemplateFile(
'av.edit-properties.pt')
form_fiel... | bsd-3-clause | Python |
db1f0556f72eb84e4273ff8925494de81bf21898 | rename paths / meta not needed | nathbo/GO_DILab,nathbo/GO_DILab | src/learn/dev_ben/generate_training_data.py | src/learn/dev_ben/generate_training_data.py | import os
import sgf
from time import strftime
from os.path import dirname, abspath
from src.play.model.Board import Board
size = 9
EMPTY_val = 0 # 0.45
BLACK_val = 1 # -1.35
WHITE_val = -1 # 1.05
data_dir = os.path.join(dirname(dirname(dirname(dirname(abspath(__file__))))), 'data')
sgf_files = [
... | import os
import sgf
from time import strftime
from os.path import dirname, abspath
from src.play.model.Board import Board
size = 9
EMPTY_val = 0 # 0.45
BLACK_val = 1 # -1.35
WHITE_val = -1 # 1.05
data_dir = os.path.join(dirname(dirname(dirname(dirname(abspath(__file__))))), 'data')
paths = [
os.p... | mit | Python |
327fcfd4c6b0ad10b25c286f271c577afd741099 | set width for login details to 50 chars. | barry-scott/scm-workbench,barry-scott/git-workbench,barry-scott/scm-workbench,barry-scott/git-workbench,barry-scott/scm-workbench | Source/Hg/wb_hg_credential_dialogs.py | Source/Hg/wb_hg_credential_dialogs.py | '''
====================================================================
Copyright (c) 2016 Barry A Scott. All rights reserved.
This software is licensed as described in the file LICENSE.txt,
which you should have received as part of this distribution.
===========================================================... | '''
====================================================================
Copyright (c) 2016 Barry A Scott. All rights reserved.
This software is licensed as described in the file LICENSE.txt,
which you should have received as part of this distribution.
===========================================================... | apache-2.0 | Python |
fe7d5ec956f0277d0689dec57d9e145fcd19f79f | Modify svm | Evensgn/MNIST-learning | mnist_svm.py | mnist_svm.py | import numpy as np
import matplotlib.pyplot as plt
GRAY_SCALE_RANGE = 255
import pickle
data_filename = 'data_deskewed.pkl'
print('Loading data from file \'' + data_filename + '\' ...')
with open(data_filename, 'rb') as f:
train_labels = pickle.load(f)
train_images = pickle.load(f)
test_labels = pickle.l... | import numpy as np
import matplotlib.pyplot as plt
GRAY_SCALE_RANGE = 255
import pickle
data_filename = 'data_deskewed.pkl'
print('Loading data from file \'' + data_filename + '\' ...')
with open(data_filename, 'rb') as f:
train_labels = pickle.load(f)
train_images = pickle.load(f)
test_labels = pickle.l... | mit | Python |
ec7411f409f07bd04778c9baf509adb10f446f10 | allow cross origin requests | socialc0de/germany-says-welcome-backend | mock/mock.py | mock/mock.py | import cherrypy
class MockController:
def poi(self, location):
cherrypy.response.headers['Access-Control-Allow-Origin'] = '*'
with open("poi.json") as poifile:
return poifile.read()
def faq(self, location):
cherrypy.response.headers['Access-Control-Allow-Origin'] = '*'
... | import cherrypy
class MockController:
def poi(self, location):
with open("poi.json") as poifile:
return poifile.read()
def faq(self, location):
with open("faq.json") as faqfile:
return faqfile.read()
def phrasebook(self, location):
with open("phrasebook.json") a... | agpl-3.0 | Python |
f5cd2c396bcc9ef2775503b4f86aa9bb7d6c8d93 | Sort operator extra links (#24992) | cfei18/incubator-airflow,nathanielvarona/airflow,cfei18/incubator-airflow,nathanielvarona/airflow,cfei18/incubator-airflow,apache/airflow,apache/airflow,nathanielvarona/airflow,apache/airflow,apache/airflow,apache/airflow,cfei18/incubator-airflow,nathanielvarona/airflow,nathanielvarona/airflow,cfei18/incubator-airflow,... | airflow/api_connexion/endpoints/extra_link_endpoint.py | airflow/api_connexion/endpoints/extra_link_endpoint.py | # 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... | # 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... | apache-2.0 | Python |
7f248f252b0a846e39c60d66485f796576b2179e | fix doctest | erikedin/aoc2016 | aoc2016/day9.py | aoc2016/day9.py | import re
def parse(lines):
return ''.join([x.strip() for x in lines])
class Marker(object):
def __init__(self, chars, repeats):
self.chars = chars
self.repeats = repeats
@classmethod
def parse(clazz, text):
"""
>>> m, rest = Marker.parse('(10x2)abc')
>>> m... | import re
def parse(lines):
return ''.join([x.strip() for x in lines])
class Marker(object):
def __init__(self, chars, repeats):
self.chars = chars
self.repeats = repeats
@classmethod
def parse(clazz, text):
"""
>>> m, rest = Marker.parse('(10x2)abc')
>>> m... | mit | Python |
eaae2a1e88572e224621e242be1d15e92065f15e | Use new extension setup() API | ZenithDK/mopidy-primare,mopidy/mopidy-nad | mopidy_nad/__init__.py | mopidy_nad/__init__.py | from __future__ import unicode_literals
import os
import pygst
pygst.require('0.10')
import gst
import gobject
from mopidy import config, ext
__version__ = '1.0.0'
class Extension(ext.Extension):
dist_name = 'Mopidy-NAD'
ext_name = 'nad'
version = __version__
def get_default_config(self):
... | from __future__ import unicode_literals
import os
import pygst
pygst.require('0.10')
import gst
import gobject
from mopidy import config, ext
__version__ = '1.0.0'
class Extension(ext.Extension):
dist_name = 'Mopidy-NAD'
ext_name = 'nad'
version = __version__
def get_default_config(self):
... | apache-2.0 | Python |
daf577f1e4bab13f9d5f2e3fdad8765dbab70dfe | refactor settings | openstax/openstax-cms,Connexions/openstax-cms,openstax/openstax-cms,openstax/openstax-cms,Connexions/openstax-cms,openstax/openstax-cms | openstax/settings/dev.py | openstax/settings/dev.py | from .base import *
DEBUG = True
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
# BASE_URL required for notification emails
BASE_URL = 'http://localhost:8000'
try:
from .local import *
except ImportError:
pass
##################################
# OVERRIDE ACCOUNTS SETTINGS #
#########... | from .base import *
DEBUG = True
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
# BASE_URL required for notification emails
BASE_URL = 'http://localhost:8000'
try:
from .local import *
except ImportError:
pass
##################################
# ACCOUNTS SETTINGS #
########... | agpl-3.0 | Python |
945c93fa91cb7b3b14f002e37e2a8bd2ee915fdd | Clean the mako cache between runs, because it breaks theme switching | TyberiusPrime/nikola,yamila-moreno/nikola,techdragon/nikola,getnikola/nikola,xuhdev/nikola,s2hc-johan/nikola,masayuko/nikola,okin/nikola,atiro/nikola,atiro/nikola,Proteus-tech/nikola,yamila-moreno/nikola,immanetize/nikola,berezovskyi/nikola,Proteus-tech/nikola,gwax/nikola,schettino72/nikola,x1101/nikola,pluser/nikola,l... | nikola/mako_templates.py | nikola/mako_templates.py | ########################################
# Mako template handlers
########################################
import os
import shutil
from mako import util, lexer
from mako.lookup import TemplateLookup
lookup = None
cache = {}
def get_deps(filename):
text = util.read_file(filename)
lex = lexer.Lexer(text=text,... | ########################################
# Mako template handlers
########################################
import os
import shutil
from mako import util, lexer
from mako.lookup import TemplateLookup
lookup = None
cache = {}
def get_deps(filename):
text = util.read_file(filename)
lex = lexer.Lexer(text=text,... | mit | Python |
4912027d6cb0f27c736e46498231595f50a36cd3 | add cv element | oesteban/mriqc,oesteban/mriqc,poldracklab/mriqc,poldracklab/mriqc,oesteban/mriqc,poldracklab/mriqc,poldracklab/mriqc,oesteban/mriqc | mriqc/classifier/cv.py | mriqc/classifier/cv.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: oesteban
# @Date: 2015-11-19 16:44:27
# @Last Modified by: oesteban
# @Last Modified time: 2016-05-12 17:46:31
"""
MRIQC Cross-validation
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from _... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: oesteban
# @Date: 2015-11-19 16:44:27
# @Last Modified by: oesteban
# @Last Modified time: 2016-05-12 17:46:31
"""
MRIQC Cross-validation
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from _... | apache-2.0 | Python |
2aeda5c12710e197282f015f7e4b8519f1d8bcc5 | Update tests.py | jtokaz/checkio-mission-compare-functions,jtokaz/checkio-mission-compare-functions,jtokaz/checkio-mission-compare-functions | verification/tests.py | verification/tests.py | """
TESTS is a dict with all you tests.
Keys for this will be categories' names.
Each test is dict with
"input" -- input data for user function
"answer" -- your right answer
"explanation" -- not necessary key, it's using for additional info in animation.
"""
TESTS = {
"Basics": [
{
... | """
TESTS is a dict with all you tests.
Keys for this will be categories' names.
Each test is dict with
"input" -- input data for user function
"answer" -- your right answer
"explanation" -- not necessary key, it's using for additional info in animation.
"""
TESTS = {
"Basics": [
{
... | mit | Python |
0626c8db3f2287d78c467c194e01cf004f0c7e78 | Convert simple-mapped results back to Series. | jorisvandenbossche/pandas,zfrenchee/pandas,datapythonista/pandas,kdebrab/pandas,louispotok/pandas,jmmease/pandas,MJuddBooth/pandas,toobaz/pandas,amolkahat/pandas,Winand/pandas,pandas-dev/pandas,linebp/pandas,harisbal/pandas,nmartensen/pandas,winklerand/pandas,DGrady/pandas,rs2/pandas,Winand/pandas,zfrenchee/pandas,kdeb... | pandas/util/map.py | pandas/util/map.py | import numpy as np
from pandas import _tseries as lib
from pandas import notnull, Series
from functools import wraps
class repeat(object):
def __init__(self, obj):
self.obj = obj
def __getitem__(self, i):
return self.obj
class azip(object):
def __init__(self, *args):
self.cols... | import numpy as np
from pandas import _tseries as lib
from pandas import notnull, Series
from functools import wraps
class repeat(object):
def __init__(self, obj):
self.obj = obj
def __getitem__(self, i):
return self.obj
class azip(object):
def __init__(self, *args):
self.cols... | bsd-3-clause | Python |
42f74f304d0ac404f17d6489033b6140816cb194 | Implement Stonesplinter Trogg, Burly Rockjaw Trogg, Ship's Cannon | Ragowit/fireplace,NightKev/fireplace,jleclanche/fireplace,smallnamespace/fireplace,smallnamespace/fireplace,amw2104/fireplace,beheh/fireplace,Meerkov/fireplace,amw2104/fireplace,oftc-ftw/fireplace,butozerca/fireplace,liujimj/fireplace,oftc-ftw/fireplace,Meerkov/fireplace,butozerca/fireplace,Ragowit/fireplace,liujimj/fi... | fireplace/cards/gvg/neutral_common.py | fireplace/cards/gvg/neutral_common.py | from ..utils import *
##
# Minions
# Stonesplinter Trogg
class GVG_067:
def CARD_PLAYED(self, player, card):
if player is not self.controller and card.type == CardType.SPELL:
self.buff("GVG_067a")
class GVG_067a:
Atk = 1
# Burly Rockjaw Trogg
class GVG_068:
def CARD_PLAYED(self, player, card):
if player... | from ..utils import *
##
# Minions
# Explosive Sheep
class GVG_076:
def deathrattle(self):
for target in self.game.board:
self.hit(target, 2)
# Clockwork Gnome
class GVG_082:
deathrattle = giveSparePart
# Micro Machine
class GVG_103:
def TURN_BEGIN(self, player):
# That card ID is not a mistake
self.... | agpl-3.0 | Python |
0bd2fffcab47c79999e5bf20b881a69193855bd9 | Fix install script | SpamapS/dstat-plugins | dstat_plugins/__init__.py | dstat_plugins/__init__.py | import glob
import shutil
import sys
import os
import os.path
import pkg_resources as pr
def install():
destdir = sys.argv[1]
datadir = pr.resource_filename('dstat_plugins', 'plugins')
try:
os.makedirs(destdir)
except OSError:
if not os.path.isdir(destdir):
sys.stderr.write... | import shutil
import sys
import pkg_resources as pr
def install():
destdir = sys.argv[1]
datadir = pr.resource_filename(__name__, 'plugins/dstat_mysql5_innodb.py')
shutil.copytree(datadir, destdir)
| apache-2.0 | Python |
2cc505d3a3c54f3ce1e91941a905c6a298a46d05 | Fix classifiers. | ralphbean/narcissus,ralphbean/narcissus,ralphbean/narcissus | narcissus.hub/setup.py | narcissus.hub/setup.py | # This file is part of Narcissus
# Copyright (C) 2011-2013 Ralph Bean
#
# 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 v... | # This file is part of Narcissus
# Copyright (C) 2011-2013 Ralph Bean
#
# 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 v... | agpl-3.0 | Python |
624599bc0172e9166536abfc6be254b5117ac64c | Add error handling in plugin installation process | eayunstack/fuel-web,zhaochao/fuel-web,Fiware/ops.Fuel-main-dev,stackforge/fuel-web,huntxu/fuel-web,huntxu/fuel-web,Fiware/ops.Fuel-main-dev,SmartInfrastructures/fuel-web-dev,nebril/fuel-web,ddepaoli3/fuel-main-dev,teselkin/fuel-main,prmtl/fuel-web,zhaochao/fuel-main,SmartInfrastructures/fuel-web-dev,dancn/fuel-main-dev... | nailgun/nailgun/plugin/process.py | nailgun/nailgun/plugin/process.py | # -*- coding: utf-8 -*-
import traceback
import time
from multiprocessing import Queue, Process
from sqlalchemy import update
from nailgun.api.models import Task
from nailgun.task.helpers import TaskHelper
from nailgun.logger import logger
from nailgun.db import make_session
import nailgun.plugin.manager
PLUGIN_PROC... | # -*- coding: utf-8 -*-
import traceback
import time
from multiprocessing import Queue, Process
from nailgun.task.helpers import TaskHelper
from nailgun.logger import logger
from nailgun.db import make_session
import nailgun.plugin.manager
PLUGIN_PROCESSING_QUEUE = None
def get_queue():
global PLUGIN_PROCESSING... | apache-2.0 | Python |
00556c84e23dd86eb4ca08ba4c6238425a3eba7e | Create Preparation model | iCHAIT/whats-fresh-api,osu-cass/whats-fresh-api,osu-cass/whats-fresh-api,iCHAIT/whats-fresh-api,osu-cass/whats-fresh-api,osu-cass/whats-fresh-api,iCHAIT/whats-fresh-api,iCHAIT/whats-fresh-api | project_fish/whats_fresh/models.py | project_fish/whats_fresh/models.py | from django.contrib.gis.db import models
import os
from phonenumber_field.modelfields import PhoneNumberField
class Image(models.Model):
"""
The Image model holds an image and related data.
The Created and Modified time fields are created automatically by
Django when the object is created or modified... | from django.contrib.gis.db import models
import os
from phonenumber_field.modelfields import PhoneNumberField
class Image(models.Model):
"""
The Image model holds an image and related data.
The Created and Modified time fields are created automatically by
Django when the object is created or modified... | apache-2.0 | Python |
c0259abdd1b34cd195e3f1ffcb7fb5479d76a0fe | bump version to 1.0.0 | sibson/vncdotool | vncdotool/__init__.py | vncdotool/__init__.py | __version__ = "1.0.0"
| __version__ = "1.0.0dev"
| mit | Python |
7d1463fc732cdc6aef3299c6d2bbe916418e6d6e | Add full_name field to API | mikkokeskinen/tunnistamo,mikkokeskinen/tunnistamo | hkisaml/api.py | hkisaml/api.py | from django.contrib.auth.models import User
from rest_framework import permissions, serializers, generics, mixins
from oauth2_provider.ext.rest_framework import TokenHasReadWriteScope
class UserSerializer(serializers.ModelSerializer):
def to_representation(self, obj):
ret = super(UserSerializer, self).to_... | from django.contrib.auth.models import User
from rest_framework import permissions, routers, serializers, generics, mixins
from oauth2_provider.ext.rest_framework import TokenHasReadWriteScope
class UserSerializer(serializers.ModelSerializer):
def to_representation(self, obj):
ret = super(UserSerializer, ... | mit | Python |
7fb0e28ad6ef1190e61fc38bfb19744739b2e096 | Remove unused deps from admin view | pwnbus/scoring_engine,pwnbus/scoring_engine,pwnbus/scoring_engine,pwnbus/scoring_engine | scoring_engine/web/views/admin.py | scoring_engine/web/views/admin.py | from flask import Blueprint, redirect, render_template, url_for
from flask_login import current_user, login_required
from operator import itemgetter
from scoring_engine.models.user import User
from scoring_engine.models.team import Team
mod = Blueprint('admin', __name__)
@mod.route('/admin')
@mod.route('/admin/stat... | from flask import Blueprint, flash, redirect, render_template, request, url_for,
from flask_login import current_user, login_required
from operator import itemgetter
from scoring_engine.models.user import User
from scoring_engine.models.team import Team
mod = Blueprint('admin', __name__)
@mod.route('/admin')
@mod.r... | mit | Python |
a900501804a5a07ed9cea77d5d5348be5e100d67 | Use Acapela TTS if available | chili-epfl/pyrobots,chili-epfl/pyrobots-nao | src/robots/actions/speech.py | src/robots/actions/speech.py | # coding=utf-8
import logging; logger = logging.getLogger("robot." + __name__)
logger.setLevel(logging.DEBUG)
from robots.action import *
@action
def say(robot, msg, callback = None, feedback =None):
""" Says loudly the message.
Several TTS systems are tested:
- first, try the Acapela TTS (through the ... | # coding=utf-8
import logging; logger = logging.getLogger("robot." + __name__)
logger.setLevel(logging.DEBUG)
from robots.action import *
@action
def say(robot, msg):
""" Says loudly the message.
Speech synthesis relies on the ROS wrapper around Festival.
:param msg: a text to say.
"""
def exec... | isc | Python |
a2982804011e808bd8bf8d9781d9b7bb20328ddc | remove import test line | baudren/NoteOrganiser,egolus/NoteOrganiser,egolus/NoteOrganiser,baudren/NoteOrganiser | noteorganiser/tests/test_utils.py | noteorganiser/tests/test_utils.py | """tests for utilities"""
import os
import shutil
import datetime
from PySide import QtGui
from PySide import QtCore
#utils to test
from ..utils import fuzzySearch
from .custom_fixtures import parent
def test_fuzzySearch():
### these should return True
#starts with the searchstring
assert fuzzySearch('... | """tests for utilities"""
import os
import shutil
import datetime
from PySide import QtGui
from PySide import QtCore
import test
#utils to test
from ..utils import fuzzySearch
from .custom_fixtures import parent
def test_fuzzySearch():
### these should return True
#starts with the searchstring
assert f... | mit | Python |
6e42e355d6ae60f115c9027ff6fcb17814b346c2 | use mah special charm helpers | chuckbutler/docker-charm,chuckbutler/docker-charm | hooks/setup.py | hooks/setup.py | import subprocess
def pre_install():
"""
Do any setup required before the install hook.
"""
install_charmhelpers()
def install_charmhelpers():
"""
Install the charmhelpers library, if not present.
"""
try:
import charmhelpers # noqa
except ImportError:
subprocess... | import subprocess
def pre_install():
"""
Do any setup required before the install hook.
"""
install_charmhelpers()
def install_charmhelpers():
"""
Install the charmhelpers library, if not present.
"""
try:
import charmhelpers # noqa
except ImportError:
subprocess... | bsd-3-clause | Python |
a02624cdbacd666d4e0cdba6230e2ee67837f874 | add AsText to __all__ list | geoalchemy/geoalchemy2 | geoalchemy2/functions.py | geoalchemy2/functions.py | from sqlalchemy.sql import functions
from . import types
__all__ = [
'GenericFunction',
'GeometryType',
'AsText',
'Buffer'
]
class GenericFunction(functions.GenericFunction):
def __init__(self, *args, **kwargs):
expr = kwargs.pop('expr', None)
if expr is ... | from sqlalchemy.sql import functions
from . import types
__all__ = [
'GenericFunction', 'GeometryType', 'Buffer'
]
class GenericFunction(functions.GenericFunction):
def __init__(self, *args, **kwargs):
expr = kwargs.pop('expr', None)
if expr is not None:
args = (expr... | mit | Python |
9fb1c2781582e52c6618b61d4a8a60c3363ee711 | bump controller API to v1.1 | Joshua-Anderson/controller-sdk-go,Joshua-Anderson/controller-sdk-go | api/__init__.py | api/__init__.py | """
The **api** Django app presents a RESTful web API for interacting with the **deis** system.
"""
__version__ = '1.1.0'
| """
The **api** Django app presents a RESTful web API for interacting with the **deis** system.
"""
__version__ = '1.0.0'
| apache-2.0 | Python |
ab3f331246e844812fd91b51908a0d0972a9793f | improve run_bin (#885) | google/graphicsfuzz,google/graphicsfuzz,google/graphicsfuzz,google/graphicsfuzz,google/graphicsfuzz,google/graphicsfuzz,google/graphicsfuzz | gfauto/gfauto/run_bin.py | gfauto/gfauto/run_bin.py | # -*- coding: utf-8 -*-
# Copyright 2019 The GraphicsFuzz Project 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | # -*- coding: utf-8 -*-
# Copyright 2019 The GraphicsFuzz Project 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | apache-2.0 | Python |
15f22d7c0ac9ddce6cb14cb0cbb35c4d630605d2 | Remove period so input corresponds to output. | EmilStenstrom/json-tagger,EmilStenstrom/json-tagger,EmilStenstrom/json-tagger,EmilStenstrom/json-tagger,EmilStenstrom/json-tagger | api/ud_helper.py | api/ud_helper.py | import re
from ufal.udpipe import Model, Pipeline, ProcessingError
class Parser:
MODELS = {
"swe": "data/swedish-ud-2.0-170801.udpipe",
}
def __init__(self, language):
model_path = self.MODELS.get(language, None)
if not model_path:
raise ParserException("Cannot find mod... | import re
from ufal.udpipe import Model, Pipeline, ProcessingError
class Parser:
MODELS = {
"swe": "data/swedish-ud-2.0-170801.udpipe",
}
def __init__(self, language):
model_path = self.MODELS.get(language, None)
if not model_path:
raise ParserException("Cannot find mod... | mit | Python |
dffcfa42fbf4f200a22b739a0cd24f36317b054c | Fix so that /api/login/ follow the specified api documentation. | tobbez/lys-reader | api/userview.py | api/userview.py | from flask import abort, request, jsonify, make_response, session
from datetime import datetime, timedelta
from api import app
from api.user import *
@require_csrf_token
@app.route('/api/signup/', methods = ['POST'])
def api_user_signup():
generate_csrf_token(session)
status = {}
httpcode = 200
if 'em... | from flask import abort, request, jsonify, make_response, session
from datetime import datetime, timedelta
from api import app
from api.user import *
@require_csrf_token
@app.route('/api/signup/', methods = ['POST'])
def api_user_signup():
generate_csrf_token(session)
status = {}
httpcode = 200
if 'em... | isc | Python |
bfb4ba8cb863d80cdd558ebad25f630fef5dc190 | Stop to use the __future__ module. | openstack/oslo.middleware | oslo_middleware/debug.py | oslo_middleware/debug.py | # Copyright 2011 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 req... | # Copyright 2011 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 req... | apache-2.0 | Python |
f5de027e14e50ff5085ac1765bdfd2ee7646cabb | Adjust extras sublime plugin to follow new changes | facelessuser/PyMdown,facelessuser/PyMdown,facelessuser/PyMdown | extras/sublime_mdown.py | extras/sublime_mdown.py | import sublime
import sublime_plugin
from os.path import basename, dirname
import subprocess
def parse_file_name(file_name):
if file_name is None:
title = "Untitled"
basepath = None
else:
title = basename(file_name)
basepath = dirname(file_name)
return title, basepath
cla... | import sublime
import sublime_plugin
from os.path import basename, dirname
import subprocess
def parse_file_name(file_name):
if file_name is None:
title = "Untitled"
basepath = None
else:
title = basename(file_name)
basepath = dirname(file_name)
return title, basepath
cla... | mit | Python |
2e8a2d2ac8b90a0806bea90c25d9b06ce8cc3a96 | check roi for each layer | carlomt/dicom_tools,carlomt/dicom_tools | dicom_tools/myroi2roi.py | dicom_tools/myroi2roi.py | import numpy as np
from skimage.measure import grid_points_in_poly
from dicom_tools.roiFileHandler import roiFileHandler
def myroi2roi(myrois, shape, verbose=False):
if verbose:
print("myroi2roi: called \n")
outroi = np.full(shape,False,dtype=bool)
if len(myrois) != len(outroi):
print("err... | import numpy as np
from skimage.measure import grid_points_in_poly
from dicom_tools.roiFileHandler import roiFileHandler
def myroi2roi(myrois, shape, verbose=False):
if verbose:
print("myroi2roi: called \n")
outroi = np.full(shape,False,dtype=bool)
if len(myrois) != len(outroi):
print("err... | mit | Python |
ba5edd102ddd53f2e95da8b673bf14bdd72dc012 | Add quotes around user-provided values | google/pigweed,google/pigweed,google/pigweed,google/pigweed,google/pigweed,google/pigweed,google/pigweed,google/pigweed,google/pigweed,google/pigweed | pw_cli/py/pw_cli/argument_types.py | pw_cli/py/pw_cli/argument_types.py | # Copyright 2021 The Pigweed 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | # Copyright 2021 The Pigweed 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | apache-2.0 | Python |
4283aaf601482ee2512c642101f587ffe3515ef9 | raise if user doesn't exist in forgotten password form | Psycojoker/voltairine,Psycojoker/voltairine,Psycojoker/voltairine | authentification/forms.py | authentification/forms.py | from django import forms
from django.contrib.auth.models import User
class ForgottenPasswordForm(forms.Form):
username = forms.CharField(label="Identifiant")
email = forms.EmailField(label="Votre adresse e-mail")
def clean_username(self):
username = self.cleaned_data['username']
if not ... | from django import forms
class ForgottenPasswordForm(forms.Form):
username = forms.CharField(label="Identifiant")
email = forms.EmailField(label="Votre adresse e-mail")
| agpl-3.0 | Python |
f55c0bd8db7850668582bb7b47da4d0acafabc46 | Optimize imports | gwhigs/digital-manifesto,gwhigs/digital-manifesto,gwhigs/digital-manifesto,gwhigs/digital-manifesto | digitalmanifesto/urls.py | digitalmanifesto/urls.py | from __future__ import absolute_import, unicode_literals
from django.conf.urls import include, url
from django.contrib import admin
from django.views.generic import TemplateView
from . import views
urlpatterns = [
# Admin
url(r'^jet/', include('jet.urls', 'jet')), # Django JET URLS
url(r'^admin/', inclu... | from __future__ import absolute_import
from __future__ import unicode_literals
from django.conf.urls import include, url
from django.contrib import admin
from django.views.generic import TemplateView
from . import views
urlpatterns = [
# Admin
url(r'^jet/', include('jet.urls', 'jet')), # Django JET URLS
... | mit | Python |
a5f3ad5700aa766fec99a184bae1d732d0754491 | Support of HACluster added | viswesn/charm-murano | src/reactive/murano_handlers.py | src/reactive/murano_handlers.py | # Copyright 2016 Canonical Ltd
#
# 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, s... | # Copyright 2016 Canonical Ltd
#
# 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, s... | apache-2.0 | Python |
f5d948c159a4d398a1347220a4fcd4315c725b04 | Fix issue handling Image as a paint source | mfnch/pyrtist,mfnch/pyrtist,mfnch/pyrtist,mfnch/pyrtist,mfnch/pyrtist,mfnch/pyrtist | pyrtist/pyrtist/lib2d/primitive.py | pyrtist/pyrtist/lib2d/primitive.py | __all__ = ('Primitive',)
from .core_types import Point
from .style import Stroke, Fill, StrokeStyle, Style
from .pattern import Pattern
from .path import Path
from .base import Taker, combination
from .cmd_stream import CmdStream, Cmd
from .window import Window
from .bbox import BBox
class Primitive(Taker):
def ... | __all__ = ('Primitive',)
from .core_types import Point
from .style import Color, Stroke, Fill, StrokeStyle, Style
from .path import Path
from .base import Taker, combination
from .cmd_stream import CmdStream, Cmd
from .window import Window
from .bbox import BBox
class Primitive(Taker):
def __init__(self, *args):... | lgpl-2.1 | Python |
9783844b1597598fad833794b4b291fce49438d4 | Send alerts as one mail | nikdoof/test-auth | app/hr/tasks.py | app/hr/tasks.py | from django.conf import settings
import logging
from datetime import datetime, timedelta
from celery.decorators import task
from hr.utils import blacklist_values
from django.contrib.auth.models import User
from django.core.mail import send_mail
@task(ignore_result=True)
def blacklist_check():
log = blacklist_check... | from django.conf import settings
import logging
from datetime import datetime, timedelta
from celery.decorators import task
from hr.utils import blacklist_values
from django.contrib.auth.models import User
from django.core.mail import send_mail
@task(ignore_result=True)
def blacklist_check():
log = blacklist_check... | bsd-3-clause | Python |
0dfd0ec2beb069d56d7b81911bb468199565672a | remove print | ccxt/ccxt,ccxt/ccxt,ccxt/ccxt,ccxt/ccxt,ccxt/ccxt | python/ccxtpro/base/fast_client.py | python/ccxtpro/base/fast_client.py | """A faster version of aiohttp's websocket client that uses select and other optimizations"""
import asyncio
import collections
from ccxt import NetworkError
from ccxtpro.base.aiohttp_client import AiohttpClient
class FastClient(AiohttpClient):
transport = None
def __init__(self, url, on_message_callback, o... | """A faster version of aiohttp's websocket client that uses select and other optimizations"""
import asyncio
import collections
from ccxt import NetworkError
from ccxtpro.base.aiohttp_client import AiohttpClient
class FastClient(AiohttpClient):
transport = None
def __init__(self, url, on_message_callback, o... | mit | Python |
d51adea3d19578da9165202696d80c44949c43f6 | remove debug level logging from i2tun.py | str4d/i2p-tools,str4d/i2p-tools,str4d/i2p-tools,majestrate/i2p-tools,str4d/i2p-tools,majestrate/i2p-tools,majestrate/i2p-tools,majestrate/i2p-tools,majestrate/i2p-tools | i2tun/i2tun.py | i2tun/i2tun.py | #!/usr/bin/env python3.4
from i2p.i2cp import client as i2cp
import pytun
import threading
import logging
import struct
import select
class IPV4Handler(i2cp.I2CPHandler):
def __init__(self, remote_dest, our_addr, their_addr, mtu):
self._them = remote_dest
self._iface = pytun.TunTapDevice()
... | #!/usr/bin/env python3.4
from i2p.i2cp import client as i2cp
import pytun
import threading
import logging
import struct
import select
class IPV4Handler(i2cp.I2CPHandler):
def __init__(self, remote_dest, our_addr, their_addr, mtu):
self._them = remote_dest
self._iface = pytun.TunTapDevice()
... | mit | Python |
abe4f0577baef3dbbceb06fc6d569d2bec69257e | Fix internal import | tensorflow/probability,tensorflow/probability | tensorflow_probability/python/internal/backend/jax/rewrite.py | tensorflow_probability/python/internal/backend/jax/rewrite.py | # Copyright 2019 The TensorFlow Probability 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 o... | # Copyright 2019 The TensorFlow Probability 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 o... | apache-2.0 | Python |
695e171d1eca459075ad03adf0712f5b7427cac4 | Add get_or_404() to __all__ | dirn/Flask-Simon,dirn/Flask-Simon | flask_simon/__init__.py | flask_simon/__init__.py | from flask import abort
from pymongo import uri_parser
import simon.connection
__all__ = ('Simon', 'get_or_404')
class Simon(object):
def __init__(self, app=None):
if app is not None:
self.init_app(app)
def init_app(self, app):
if 'simon' not in app.extensions:
app.ex... | __all__ = ('Simon',)
import simon.connection
from flask import abort
from pymongo import uri_parser
class Simon(object):
def __init__(self, app=None):
if app is not None:
self.init_app(app)
def init_app(self, app):
if 'simon' not in app.extensions:
app.extensions['si... | bsd-3-clause | Python |
24ee61ecf5767d10b2fb92acc5d0217ffbfb3834 | Update get_branches.py | YufeiZhang/nothingButUseless | Group8/get_branches.py | Group8/get_branches.py | ny branches we have
#print(branches) # this shows all branches in a list
#print(branches_posi)
from pyfbsdk import *
import math
'''
This file is to read all branches of both target and source skeleton
This should be using motion-builder
I used People.FBX as a testcase
'''
def get_banch(parents, children, index,... | from pyfbsdk import *
import math
'''
This file is to read all branches of both target and source skeleton
This should be using motion-builder
I used People.FBX as a testcase
'''
def get_banch(parents, children, index, branches):
parents.append(children.Name)
# if there is no children, append this branch to... | mit | Python |
c9df16f35af2cf51a4612eb76fab59819a32df64 | Handle TypeError in is_float | ewdurbin/sentry,BuildingLink/sentry,boneyao/sentry,JTCunning/sentry,TedaLIEz/sentry,gencer/sentry,zenefits/sentry,looker/sentry,looker/sentry,BuildingLink/sentry,drcapulet/sentry,jean/sentry,argonemyth/sentry,nicholasserra/sentry,kevinastone/sentry,korealerts1/sentry,daevaorn/sentry,mvaled/sentry,mvaled/sentry,vperron/... | src/sentry/utils/__init__.py | src/sentry/utils/__init__.py | """
sentry.utils
~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
from django.utils.encoding import force_unicode
import six
def to_unicode(value):
try:
value = six.text_type(... | """
sentry.utils
~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
from django.utils.encoding import force_unicode
import six
def to_unicode(value):
try:
value = six.text_type(... | bsd-3-clause | Python |
7fb89e4dbe2cbed4ef37e13073d4fa3f2a650049 | Check for missing part thumbnails when the server first runs | inventree/InvenTree,SchrodingersGat/InvenTree,inventree/InvenTree,inventree/InvenTree,SchrodingersGat/InvenTree,SchrodingersGat/InvenTree,inventree/InvenTree,SchrodingersGat/InvenTree | InvenTree/part/apps.py | InvenTree/part/apps.py | from __future__ import unicode_literals
import os
from django.db.utils import OperationalError, ProgrammingError
from django.apps import AppConfig
from django.conf import settings
class PartConfig(AppConfig):
name = 'part'
def ready(self):
"""
This function is called whenever the Part app i... | from __future__ import unicode_literals
from django.apps import AppConfig
class PartConfig(AppConfig):
name = 'part'
| mit | Python |
7f5f10132334c1f6685497d3fff48c2c65617845 | Remove broken URL (#3623) | inventree/InvenTree,SchrodingersGat/InvenTree,inventree/InvenTree,SchrodingersGat/InvenTree,SchrodingersGat/InvenTree,inventree/InvenTree,SchrodingersGat/InvenTree,inventree/InvenTree | InvenTree/part/urls.py | InvenTree/part/urls.py | """URL lookup for Part app. Provides URL endpoints for:
- Display / Create / Edit / Delete PartCategory
- Display / Create / Edit / Delete Part
- Create / Edit / Delete PartAttachment
- Display / Create / Edit / Delete SupplierPart
"""
from django.urls import include, re_path
from . import views
part_detail_urls = ... | """URL lookup for Part app. Provides URL endpoints for:
- Display / Create / Edit / Delete PartCategory
- Display / Create / Edit / Delete Part
- Create / Edit / Delete PartAttachment
- Display / Create / Edit / Delete SupplierPart
"""
from django.urls import include, re_path
from . import views
part_detail_urls = ... | mit | Python |
d0e31fdb5ec99e91f7b5f7da5b81fc7a391689df | Update django_facebook/admin.py | danosaure/Django-facebook,danosaure/Django-facebook,danosaure/Django-facebook | django_facebook/admin.py | django_facebook/admin.py | from django.contrib import admin
from django.conf import settings
from django.core.urlresolvers import reverse
from django_facebook import admin_actions
from django_facebook import models
class FacebookUserAdmin(admin.ModelAdmin):
list_display = ('user_id', 'name', 'facebook_id',)
search_fields = ('name',)
... | from django.contrib import admin
from django.conf import settings
from django.core.urlresolvers import reverse
from django_facebook import admin_actions
from django_facebook import models
class FacebookUserAdmin(admin.ModelAdmin):
list_display = ('user_id', 'name', 'facebook_id',)
search_fields = ('name',)
... | bsd-3-clause | Python |
dbf736ba66fe6b530bfe3d9d503caa2e24ee8f01 | Make /config more CORS-y | matrix-org/synapse,matrix-org/synapse,matrix-org/synapse,matrix-org/synapse,matrix-org/synapse,matrix-org/synapse | synapse/rest/media/v1/config_resource.py | synapse/rest/media/v1/config_resource.py | # -*- coding: utf-8 -*-
# Copyright 2018 Will Hunt <will@half-shot.uk>
#
# 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... | # -*- coding: utf-8 -*-
# Copyright 2018 Will Hunt <will@half-shot.uk>
#
# 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... | apache-2.0 | Python |
54e1cb0048ffd0024feae4e5dc0c1e047ca55328 | remove debug print | openaps/openaps,openaps/openaps | openaps/devices/device.py | openaps/devices/device.py | import json
from openaps.configurable import Configurable
class ExtraConfig (Configurable):
prefix = 'device'
pass
class Device (Configurable):
vendor = None
required = ['name', 'vendor']
optional = [ ]
prefix = 'device'
_uses = [ ]
def __init__ (self, name, vendor):
self.name = name
self.vendo... | import json
from openaps.configurable import Configurable
class ExtraConfig (Configurable):
prefix = 'device'
pass
class Device (Configurable):
vendor = None
required = ['name', 'vendor']
optional = [ ]
prefix = 'device'
_uses = [ ]
def __init__ (self, name, vendor):
self.name = name
self.vendo... | mit | Python |
294e8b120d507237f1129338c476939b20604f26 | Save release test metrics under a single column (#30215) | ray-project/ray,ray-project/ray,ray-project/ray,ray-project/ray,ray-project/ray,ray-project/ray,ray-project/ray,ray-project/ray | release/ray_release/reporter/db.py | release/ray_release/reporter/db.py | import time
import json
import boto3
from botocore.config import Config
from ray_release.reporter.reporter import Reporter
from ray_release.result import Result
from ray_release.config import Test
from ray_release.logger import logger
class DBReporter(Reporter):
def __init__(self):
self.firehose = boto3.... | import time
import json
import boto3
from botocore.config import Config
from ray_release.reporter.reporter import Reporter
from ray_release.result import Result
from ray_release.config import Test
from ray_release.logger import logger
class DBReporter(Reporter):
def __init__(self):
self.firehose = boto3.... | apache-2.0 | Python |
0a94b8a4756e9b46211567c430560a314c554a1d | add help for org command | RhubarbSin/arin-whois-rws | parse.py | parse.py | import argparse
class Parser(argparse.ArgumentParser):
def populate(self):
self.add_argument('--output', choices=('xml', 'text', 'html'),
default='text')
subparsers = self.add_subparsers(title='Commands', metavar='',
dest='call')
... | import argparse
class Parser(argparse.ArgumentParser):
def populate(self):
self.add_argument('--output', choices=('xml', 'text', 'html'),
default='text')
subparsers = self.add_subparsers(title='Commands', metavar='',
dest='call')
... | mit | Python |
65fb9244df69646721c8273afae22fe6248976f0 | optimise common.py | Tocknicsu/nctuoj,Tocknicsu/nctuoj,Tocknicsu/nctuoj | backend/service/common.py | backend/service/common.py | from service.base import BaseService
import config
### need to add rs
class CommonService(BaseService):
def __init__(self, db, rs):
super().__init__(db, rs)
CommonService.inst = self
def get_execute_type(self):
res ={ x['id']: x for x in (yield self.db.execute("SELECT * FROM execute_ty... | from service.base import BaseService
import config
### need to add rs
class CommonService(BaseService):
def __init__(self, db, rs):
super().__init__(db, rs)
CommonService.inst = self
def get_execute_type(self):
res = (yield self.db.execute("SELECT * FROM execute_types order by id")).fe... | mit | Python |
b9c076865f4e0ff9b4ab007472cbab735ccf01ab | Bump version to 3.1.2 | opensciencegrid/osg-configure,matyasselmeci/osg-configure,opensciencegrid/osg-configure,matyasselmeci/osg-configure | osg_configure/version.py | osg_configure/version.py | __version__ = "3.1.2"
| __version__ = "3.1.1"
| apache-2.0 | Python |
214f4094b6b5c2f4a43ff96567a7bbe87ba63d28 | Update bob.py | malvikasharan/software_writing_skills_potsdam | Python_sessions/session-2/practice_codes/bob.py | Python_sessions/session-2/practice_codes/bob.py | hello = "Hi Human, I am B.O.B. "
question1 = "What is your name? "
response1 = "Thats a lovely name! "
input(hello+question1)
print response1
answer_type = "Please answer in 'yes' or 'no'. "
question2 = "Can I help you? "
response2 = "I am a computer, not a human. "
input(question2+answer_type)
print response2
questi... | hello = "Hi Human, I am B.O.B. "
question1 = "What is your name? "
response1 = "Thats a lovely name! "
input(hello+question1)
print response1
answer_type = "Please answer in 'yes' of 'no'. "
question2 = "Can I help you? "
response2 = "I am a computer, not a human. "
input(question2+answer_type)
print response2
questi... | isc | Python |
f44c7670ee06d0ff3976c11b921cc3f288b0259b | add TestMPEventLoopRunner.test_ProgressMonitor | alphatwirl/alphatwirl,alphatwirl/alphatwirl,alphatwirl/alphatwirl,TaiSakuma/AlphaTwirl,TaiSakuma/AlphaTwirl,alphatwirl/alphatwirl | tests/EventReader/test_MPEventLoopRunner.py | tests/EventReader/test_MPEventLoopRunner.py | from AlphaTwirl.EventReader import MPEventLoopRunner
import unittest
import os
##____________________________________________________________________________||
class MockReader(object):
def __init__(self):
self._results = None
def setResults(self, results):
self._results = results
def res... | from AlphaTwirl.EventReader import MPEventLoopRunner
import unittest
##____________________________________________________________________________||
class MockReader(object):
def __init__(self):
self._results = None
def setResults(self, results):
self._results = results
def results(self)... | bsd-3-clause | Python |
e6e0d96790d71caccb3f00487bfeeddccdc78139 | Fix variable and return value | legco-watch/legco-watch,comsaint/legco-watch,comsaint/legco-watch,legco-watch/legco-watch,comsaint/legco-watch,legco-watch/legco-watch,comsaint/legco-watch,legco-watch/legco-watch | app/raw/tasks.py | app/raw/tasks.py | from __future__ import absolute_import
from celery import shared_task
from twisted.internet import reactor
from scrapy.crawler import Crawler
from scrapy import log, signals
from scrapy.utils.project import get_project_settings
import os
from raw.scraper.spiders.legco_library import LibraryAgendaSpider
from raw.scrape... | from __future__ import absolute_import
from celery import shared_task
from twisted.internet import reactor
from scrapy.crawler import Crawler
from scrapy import log, signals
from scrapy.utils.project import get_project_settings
import os
from raw.scraper.spiders.legco_library import LibraryAgendaSpider
from raw.scrape... | mit | Python |
6f06728b7ce48084f7ae5d00f96aec086509640f | Accelerate the presubmit check. | wi-ed/wi | presubmit.py | presubmit.py | #!/usr/bin/env python
# Copyright 2014 Marc-Antoine Ruel. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
import os
import subprocess
import sys
import time
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
def call(cmd, ... | #!/usr/bin/env python
# Copyright 2014 Marc-Antoine Ruel. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
import os
import subprocess
import sys
import time
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
def call(cmd, ... | apache-2.0 | Python |
600e68fc3e4b708090f5c3349d002ea9c3d2fbf8 | improve examples group | rsalmei/clearly | tests/examples/user_code/publisher_group.py | tests/examples/user_code/publisher_group.py | import time
from celery import chord, group
from .worker import function_aggregate, function_test
chord(
group(function_test.s(0, value=i) for i in range(1000)),
function_aggregate.s(from_chord=True)
)()
time.sleep(5)
| import time
from celery import chord, group
from .tasks import *
chord(
group(function_value.s(0, value=i) for i in range(1000)),
function_any.s(from_chord=True)
)()
time.sleep(5)
| mit | Python |
902cbd511f2f42948991713cdf0a98c4473c66c0 | add tqdm to hagrid setup.py | OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft | packages/hagrid/setup.py | packages/hagrid/setup.py | # stdlib
import platform
# third party
from setuptools import find_packages
from setuptools import setup
__version__ = "0.2.89"
DATA_FILES = {
"img": ["hagrid/img/*.png"],
}
packages = [
"ascii_magic",
"click",
"cryptography>=37.0.2",
"gitpython",
"jinja2",
"names",
"packaging>=21.3"... | # stdlib
import platform
# third party
from setuptools import find_packages
from setuptools import setup
__version__ = "0.2.89"
DATA_FILES = {
"img": ["hagrid/img/*.png"],
}
packages = [
"ascii_magic",
"click",
"cryptography>=37.0.2",
"gitpython",
"jinja2",
"names",
"packaging>=21.3"... | apache-2.0 | Python |
10ba0ea095e4765a2d60751371f7dca8e36e2d18 | Fix infinite loop in grit headers clobbering script. | mohamed--abdel-maksoud/chromium.src,mogoweb/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,crosswalk-project/chromium-crosswalk-efl,hgl888/chromium-crosswalk,hgl888/chromium-crosswalk-efl,rogerwang/chromium,mohamed--abdel-maksoud/chromium.src,anirudhSK/chromium,jaruba/chromium.src,Just-D/chromium-1,Just-D/chrom... | build/win/clobber_generated_headers.py | build/win/clobber_generated_headers.py | #!/usr/bin/python
# Copyright (c) 2009 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.
# This script helps workaround IncrediBuild problem on Windows.
# See http://crbug.com/17706.
import os
import sys
_SRC_PATH = os.pat... | #!/usr/bin/python
# Copyright (c) 2009 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.
# This script helps workaround IncrediBuild problem on Windows.
# See http://crbug.com/17706.
import os
import sys
_SRC_PATH = os.pat... | bsd-3-clause | Python |
e71870736959efcde2188bdcbd89838b67ca8582 | Add AbstractSanitizer/AbstractValidator class to import path | thombashi/pathvalidate | pathvalidate/__init__.py | pathvalidate/__init__.py | """
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""
from .__version__ import __author__, __copyright__, __email__, __license__, __version__
from ._base import AbstractSanitizer, AbstractValidator
from ._common import (
Platform,
ascii_symbols,
normalize_platform,
replace_ansi_escape... | """
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""
from .__version__ import __author__, __copyright__, __email__, __license__, __version__
from ._common import (
Platform,
ascii_symbols,
normalize_platform,
replace_ansi_escape,
replace_unprintable_char,
unprintable_ascii_ch... | mit | Python |
395617afca4d242de12e2a75a3ae7d2a258f75a7 | use template string | andela-sjames/paystack-python | paystackapi/constants.py | paystackapi/constants.py | """Script used to define constants used across codebase."""
PAYSTACK_SECRET_KEY = 'sk_test_0a246ef179dc841f42d20959bebdd790f69605d8'
HEADERS = {'Authorization': 'Bearer {}'}
API_URL = 'https://api.paystack.co/'
| """Script used to define constants used across codebase."""
PAYSTACK_SECRET_KEY = 'sk_test_0a246ef179dc841f42d20959bebdd790f69605d8'
HEADERS = {'Authorization': 'Bearer ' + PAYSTACK_SECRET_KEY}
API_URL = 'https://api.paystack.co/'
| mit | Python |
39beb9cbb3d0158dab58787cbe95651c8ec66db9 | Bump up minor version. | pgexperts/patroni,zalando/patroni,pgexperts/patroni,zalando/patroni | patroni/version.py | patroni/version.py | __version__ = '0.76'
| __version__ = '0.75'
| mit | Python |
d0568b2c132ebe2cdf1f656ee96442a0888257cd | add NSecurity class | MBALearnsToCode/CorpFin,MBALearnsToCode/FinSymPy,MBALearnsToCode/FinSymPy,MBALearnsToCode/CorpFin | CorpFin/Security.py | CorpFin/Security.py | from HelpyFuncs.SymPy import sympy_theanify
class Security:
def __init__(self, label='', bs_val=0., val=0.):
self.label = label
self.bs_val_expr = bs_val
self.bs_val = sympy_theanify(bs_val)
self.val_expr = val
self.val = sympy_theanify(val)
def __call__(self, **kwar... | from HelpyFuncs.SymPy import sympy_theanify
class Security:
def __init__(self, label='', bs_val=0., val=0.):
self.label = label
self.bs_val_expr = bs_val
self.bs_val = sympy_theanify(bs_val)
self.val_expr = val
self.val = sympy_theanify(val)
def __call__(self, **kwar... | mit | Python |
99818f02ebc46debe349a6c1b6bba70be6e04968 | Update error message for no plugins | oew1v07/scikit-image,robintw/scikit-image,rjeli/scikit-image,vighneshbirodkar/scikit-image,Hiyorimi/scikit-image,paalge/scikit-image,juliusbierk/scikit-image,ofgulban/scikit-image,bennlich/scikit-image,bsipocz/scikit-image,chriscrosscutler/scikit-image,vighneshbirodkar/scikit-image,keflavich/scikit-image,oew1v07/scikit... | skimage/io/_plugins/null_plugin.py | skimage/io/_plugins/null_plugin.py | __all__ = ['imshow', 'imread', 'imsave', '_app_show']
import warnings
message = '''\
No plugin has been loaded. Please refer to the docstring for ``skimage.io``
for a list of available plugins. You may specify a plugin explicitly as
an argument to ``imread``, e.g. ``imread("image.jpg", plugin='pil')``.
'''
def i... | __all__ = ['imshow', 'imread', 'imsave', '_app_show']
import warnings
message = '''\
No plugin has been loaded. Please refer to
skimage.io.plugins()
for a list of available plugins.'''
def imshow(*args, **kwargs):
warnings.warn(RuntimeWarning(message))
def imread(*args, **kwargs):
warnings.warn(Runtime... | bsd-3-clause | Python |
c9170cb4c0d63a6dc75f0fa7ca76faa688a1678a | Make tags optional | techtonik/blog.pinaxproject.com,pinax/blog.pinaxproject.com,pinax/blog.pinaxproject.com,pinax/blog.pinaxproject.com,techtonik/blog.pinaxproject.com | ppb/forms.py | ppb/forms.py | from pinax.blog.forms import FIELDS, AdminPostForm
from pinax.blog.models import Post
from taggit.forms import TagField
FIELDS.append("tags")
class AdminPostTagsForm(AdminPostForm):
tags = TagField(required=False)
class Meta:
model = Post
fields = FIELDS
| from pinax.blog.forms import FIELDS, AdminPostForm
from pinax.blog.models import Post
from taggit.forms import TagField
FIELDS.append("tags")
class AdminPostTagsForm(AdminPostForm):
tags = TagField()
class Meta:
model = Post
fields = FIELDS
| mit | Python |
9ee9ba34e447e99c868fcb43d40ce905cebf5fb9 | Add list and define functions. | maxdeviant/noah | noah/noah.py | noah/noah.py | import json
class Noah(object):
def __init__(self, dictionary_file):
self.dictionary = json.load(dictionary_file)
def list(self):
return '\n'.join([entry['word'] for entry in self.dictionary])
def define(self, word):
entry = next((x for x in self.dictionary if x['word'] == word), ... | import json
class Noah(object):
pass | mit | Python |
0dd2bd0a8d2b041672afdf66666df63e2dd1a044 | Add author friends url. | CMPUT404W17T06/CMPUT404-project,CMPUT404W17T06/CMPUT404-project,CMPUT404W17T06/CMPUT404-project | rest/urls.py | rest/urls.py | # Author: Braedy Kuzma
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^posts/$', views.PostsView.as_view(), name='posts'),
url(r'^posts/(?P<pid>[0-9a-fA-F\-]+)/$', views.PostView.as_view(),
name='post'),
url(r'^posts/(?P<pid>[0-9a-fA-F\-]+)/comments/$',
views.Com... | # Author: Braedy Kuzma
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^posts/(?P<pid>[0-9a-fA-F\-]+)/$', views.PostView.as_view(),
name='post'),
url(r'^posts/$', views.PostsView.as_view(), name='posts'),
url(r'^author/(?P<aid>[0-9a-fA-F\-]+)/$', views.AuthorView.as_view(... | apache-2.0 | Python |
6fce2e52715f1a77edb19eca8b1133875fff3d34 | Set HearingViewSet read Only | vikoivun/kerrokantasi,stephawe/kerrokantasi,City-of-Helsinki/kerrokantasi,stephawe/kerrokantasi,City-of-Helsinki/kerrokantasi,City-of-Helsinki/kerrokantasi,vikoivun/kerrokantasi,stephawe/kerrokantasi,vikoivun/kerrokantasi,City-of-Helsinki/kerrokantasi | kk/views/hearing.py | kk/views/hearing.py | import django_filters
from rest_framework import viewsets
from rest_framework import serializers
from rest_framework import filters
from rest_framework.decorators import detail_route
from rest_framework.response import Response
from kk.models import Hearing
from .image import ImageFieldSerializer, ImageSerializer
... | import django_filters
from rest_framework import viewsets
from rest_framework import serializers
from rest_framework import filters
from rest_framework.decorators import detail_route
from rest_framework.response import Response
from kk.models import Hearing
from .image import ImageFieldSerializer, ImageSerializer
... | mit | Python |
829ddcdf0ceff4f43cf871b7438170d4e4971a70 | Fix cyclomatic complexity problem in exception handling | Administrate/surveymonkey | surveymonkey/exceptions.py | surveymonkey/exceptions.py | # -*- coding: utf-8 -*-
class SurveyMonkeyException(Exception):
def __init__(self, response):
data = response.json()
super(SurveyMonkeyException, self).__init__(data["error"]["message"])
self.status_code = response.status_code
self.error_code = data["error"]["id"]
class SurveyMon... | # -*- coding: utf-8 -*-
class SurveyMonkeyException(Exception):
def __init__(self, response):
data = response.json()
super(SurveyMonkeyException, self).__init__(data["error"]["message"])
self.status_code = response.status_code
self.error_code = data["error"]["id"]
class SurveyMon... | mit | Python |
954c06d2715090e15dbe9a76dffb0eeabda06a48 | make flake8 happy | INCF/pybids | bids/grabbids/__init__.py | bids/grabbids/__init__.py | from .bids_layout import BIDSLayout
__all__ = ["BIDSLayout"]
| __all__ = ["bids_layout"]
| mit | Python |
93eb1fb058629f25f919a9c5f3647702c2767b22 | test parsing nested rules and toplevel imports | nivertech/peru,scalp42/peru,scalp42/peru,enzochiau/peru,olson-sean-k/peru,oconnor663/peru,ierceg/peru,oconnor663/peru,buildinspace/peru,ierceg/peru,enzochiau/peru,nivertech/peru,olson-sean-k/peru,buildinspace/peru | peru/test/test_parser.py | peru/test/test_parser.py | from textwrap import dedent
import unittest
from peru.parser import parse_string
from peru.remote_module import RemoteModule
from peru.rule import Rule
class ParserTest(unittest.TestCase):
def test_parse_empty_file(self):
scope, local_module = parse_string("")
self.assertDictEqual(scope, {})
... | from textwrap import dedent
import unittest
from peru.parser import parse_string
from peru.remote_module import RemoteModule
from peru.rule import Rule
class ParserTest(unittest.TestCase):
def test_parse_empty_file(self):
scope, local_module = parse_string("")
self.assertDictEqual(scope, {})
... | mit | Python |
8bb77e1cf4c5ec284641a178a106300db2f5575d | Use UTC | ritstudentgovernment/PawPrints,ritstudentgovernment/PawPrints,ritstudentgovernment/PawPrints,ritstudentgovernment/PawPrints | petitions/views.py | petitions/views.py | from django.shortcuts import render, get_object_or_404, render, redirect
from django.views.decorators.http import require_POST
from django.contrib.auth.decorators import login_required
from django.db.models import F
from datetime import datetime
from petitions.models import Petition
from profile.models import Profile
... | from django.shortcuts import render, get_object_or_404, render, redirect
from django.views.decorators.http import require_POST
from django.contrib.auth.decorators import login_required
from django.db.models import F
from datetime import datetime
from petitions.models import Petition
from profile.models import Profile
... | apache-2.0 | Python |
03b17837ed2c88692f1b99ec5b9b477f86fdddb6 | Update version to 2.2b4-dev | CatoTH/OpenSlides,tsiegleauq/OpenSlides,boehlke/OpenSlides,normanjaeckel/OpenSlides,ostcar/OpenSlides,jwinzer/OpenSlides,jwinzer/OpenSlides,ostcar/OpenSlides,emanuelschuetze/OpenSlides,normanjaeckel/OpenSlides,emanuelschuetze/OpenSlides,CatoTH/OpenSlides,OpenSlides/OpenSlides,boehlke/OpenSlides,jwinzer/OpenSlides,jwinz... | openslides/__init__.py | openslides/__init__.py | __author__ = 'OpenSlides Team <support@openslides.org>'
__description__ = 'Presentation and assembly system'
__version__ = '2.2b4-dev'
__license__ = 'MIT'
__url__ = 'https://openslides.org'
args = None
| __author__ = 'OpenSlides Team <support@openslides.org>'
__description__ = 'Presentation and assembly system'
__version__ = '2.2b3'
__license__ = 'MIT'
__url__ = 'https://openslides.org'
args = None
| mit | Python |
356fdc5d69dadbddeb7cd064593ab31b7993a0bc | Use shared helper code for palevoccbot. | abusesa/abusehelper | abusehelper/contrib/abusech/palevoccbot.py | abusehelper/contrib/abusech/palevoccbot.py | """
abuse.ch Palevo C&C feed RSS bot.
Maintainer: Lari Huttunen <mit-code@huttu.net>
"""
from abusehelper.core import bot
from . import is_ip, split_description, AbuseCHFeedBot
class PalevoCcBot(AbuseCHFeedBot):
feeds = bot.ListParam(default=["https://palevotracker.abuse.ch/?rssfeed"])
# If treat_as_dns_so... | """
abuse.ch Palevo C&C feed RSS bot.
Maintainer: Lari Huttunen <mit-code@huttu.net>
"""
from abusehelper.core import bot, events
from abusehelper.contrib.rssbot.rssbot import RSSBot
from . import is_ip
class PalevoCcBot(RSSBot):
feeds = bot.ListParam(default=["https://palevotracker.abuse.ch/?rssfeed"])
# ... | mit | Python |
490230242d51d23650406085a7af92dfbb14c16d | Use shop ID from order | m-ober/byceps,m-ober/byceps,homeworkprod/byceps,homeworkprod/byceps,homeworkprod/byceps,m-ober/byceps | byceps/blueprints/shop/orders/views.py | byceps/blueprints/shop/orders/views.py | """
byceps.blueprints.shop.orders.views
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2019 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from flask import abort, g
from ....services.party import service as party_service
from ....services.shop.order import service as order_service
f... | """
byceps.blueprints.shop.orders.views
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2019 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from flask import abort, g
from ....services.party import service as party_service
from ....services.shop.order import service as order_service
f... | bsd-3-clause | Python |
652711e9a4884a31be74df6ae791e47dcd401871 | remove deprecated test suite declarations | ddico/account-financial-tools,ddico/account-financial-tools | account_partner_required/tests/__init__.py | account_partner_required/tests/__init__.py | # -*- encoding: utf-8 -*-
##############################################################################
#
# Account partner required module for OpenERP
# Copyright (C) 2014 Acsone (http://acsone.eu).
# @author Stéphane Bidoul <stephane.bidoul@acsone.eu>
#
# This program is free software: you can redistribu... | # -*- encoding: utf-8 -*-
##############################################################################
#
# Account partner required module for OpenERP
# Copyright (C) 2014 Acsone (http://acsone.eu).
# @author Stéphane Bidoul <stephane.bidoul@acsone.eu>
#
# This program is free software: you can redistribu... | agpl-3.0 | Python |
55983401814bc0e7158d213885ebdfdbc7e02e9b | Add dependency on the requests module and refactor | loarabia/DeployUtil | DeployUtil/authentication.py | DeployUtil/authentication.py | import requests
import json
#TODO: give an indicator of success
#TODO: handle errors a bit better.
def do_pair(ip, pin, **_args):
# IF YOU DON'T DO THIS OVER HTTPS YOU WILL GET 308s to goto HTTPS
# But we cannot verify our HTTPS cert yet because we cannot get it off
# of all devices.
# If the tooling gets smarter... | import urllib.request
import http.cookiejar
import DeployUtil.toolsession as session
#TODO: give an indicator of success
#TODO: handle errors a bit better.
def do_pair(ip, pin, **_args):
# IF YOU DON'T DO THIS OVER HTTPS YOU WILL GET 308s to goto HTTPS
scheme = 'https://'
port = ''
api = '/api/authorize/pair?pin=... | mit | Python |
40957fe0b273f92a28e0b5f27cc4a46ba5e1f2b8 | Add coverage pragma | bnoi/scikit-tracker,bnoi/scikit-tracker,bnoi/scikit-tracker | sktracker/trajectories/__init__.py | sktracker/trajectories/__init__.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
import logging
log = logging.getLogger(__name__)
from .trajectories import Trajectories
try: # pragma: no cover
from . import draw
__a... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
import logging
log = logging.getLogger(__name__)
from .trajectories import Trajectories
try:
from . import draw
__all__ = ['Trajectorie... | bsd-3-clause | Python |
92ebaf9e1507acf1fc10f4448fc00db43508f23b | Allow alternate string key lookup for enums | tkwon/dj-stripe,dj-stripe/dj-stripe,jleclanche/dj-stripe,pydanny/dj-stripe,jleclanche/dj-stripe,kavdev/dj-stripe,dj-stripe/dj-stripe,pydanny/dj-stripe,tkwon/dj-stripe,jameshiew/dj-stripe,jameshiew/dj-stripe,kavdev/dj-stripe | djstripe/enums.py | djstripe/enums.py | from enum import Enum as _Enum
from django.utils.decorators import classproperty
class Enum(_Enum):
@classproperty
def choices(cls):
return tuple((cls.keys.get(k, k), v.value) for k, v in cls.__members__.items())
@classproperty
def keys(cls):
# Returns a mapping of key overrides.
... | from enum import Enum as _Enum
from django.utils.decorators import classproperty
class Enum(_Enum):
@classproperty
def choices(cls):
return tuple((k, v.value) for k, v in cls.__members__.items())
class CardTokenizationMethod(Enum):
apple_pay = "Apple Pay"
android_pay = "Android Pay"
| mit | Python |
ec5cc5d30b50e12c2e11f6206c220b4f2731e352 | implement class | plepe/pgmapcss,plepe/pgmapcss | pgmapcss/misc/pgcache.py | pgmapcss/misc/pgcache.py | class PGCache:
def __init__(self, id, read_id=False, read_geo=False):
global PGCaches
try:
PGCaches
except:
PGCaches = {}
PGCaches[id] = self
self.id = id
self.read_id = read_id
self.read_geo = read_geo
self.cache_id = len(PGCa... | class PGCache:
def __init__(self, id, read_id=False, read_geo=False):
global PGCaches
try:
PGCaches
except:
PGCaches = {}
PGCaches[id] = self
def add(self, data, id=None, geo=None):
pass
def get(self, id=None):
pass
def query(se... | agpl-3.0 | Python |
6094b147dccc4abf3ef23d5e54b1e23a955d6ecb | remove prints | Krozark/django-slider,Krozark/django-slider,Krozark/django-slider | slider/templatetags/slider_tags.py | slider/templatetags/slider_tags.py | # -*- coding: utf-8 -*-
from django import template
from slider.models import SliderImage
register = template.Library()
@register.assignment_tag
def get_slider_images(limit=False, randomize=True, slider=1):
qs = SliderImage.objects.filter(is_visible=True,slider=slider)
if randomize:
qs = qs.order... | # -*- coding: utf-8 -*-
from django import template
from slider.models import SliderImage
register = template.Library()
@register.assignment_tag
def get_slider_images(limit=False, randomize=True, slider=1):
qs = SliderImage.objects.filter(is_visible=True,slider=slider)
print randomize
if randomize:
... | bsd-2-clause | Python |
2378a64ab1e106c8f6f455a9023d350eaf627767 | add manual | Impactstory/oadoi,Impactstory/sherlockoa,Impactstory/oadoi,Impactstory/sherlockoa,Impactstory/oadoi | oa_manual.py | oa_manual.py | from collections import defaultdict
from time import time
from util import elapsed
# things to set here:
# license, free_metadata_url, free_pdf_url
# free_fulltext_url is set automatically from free_metadata_url and free_pdf_url
def get_overrides_dict():
override_dict = defaultdict(dict)
# cindy wu ex... | from collections import defaultdict
from time import time
from util import elapsed
# things to set here:
# license, free_metadata_url, free_pdf_url
# free_fulltext_url is set automatically from free_metadata_url and free_pdf_url
def get_overrides_dict():
override_dict = defaultdict(dict)
# cindy wu ex... | mit | Python |
8206ea76804cf08298eeab8673b2326440aa8663 | check for existing bonds before drawing | randlet/Orbis | orbis/gui/sketchpad.py | orbis/gui/sketchpad.py | import matplotlib
import matplotlib.patches
import numpy
import wx
from plots import Plot
#====================================================================================
class SketchPad(Plot):
"""sketch pad for drawing molecules"""
ATOM_RADIUS = 0.1
PICK_TOLERANCE = 5
#--------------------... | import matplotlib
import matplotlib.patches
import numpy
import wx
from plots import Plot
#====================================================================================
class SketchPad(Plot):
"""sketch pad for drawing molecules"""
ATOM_RADIUS = 0.1
PICK_TOLERANCE = 5
#--------------------... | bsd-3-clause | Python |
c55f21aa4925f6227086dedca2a3f839db98d8e1 | implement unit tests for debug command | fretboardfreak/space,fretboardfreak/space | tests/lib/cmdline/commands/test_debug.py | tests/lib/cmdline/commands/test_debug.py | # Copyright 2015 Curtis Sand
#
# 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, ... | # Copyright 2015 Curtis Sand
#
# 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, ... | apache-2.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.