commit
stringlengths
40
40
subject
stringlengths
1
1.49k
old_file
stringlengths
4
311
new_file
stringlengths
4
311
new_contents
stringlengths
1
29.8k
old_contents
stringlengths
0
9.9k
lang
stringclasses
3 values
proba
float64
0
1
62a978256476754a7f604b2f872b7bd221930ac2
add test_debian_repo and test_nested_debian_repo
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...
Python
0
ecece212605bb588212a70588dc7fd4b67e85cc9
Corrected first two lines
roles/common/tests/test_default.py
roles/common/tests/test_default.py
from testinfra.utils.ansible_runner import AnsibleRunner testinfra_hosts = AnsibleRunner('.molecule/ansible_inventory').get_hosts('all') def test_hosts_file(File): f = File('/etc/hosts') assert f.exists assert f.user == 'root' assert f.group == 'root'
import testinfra.utils.ansible_runner testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( '.molecule/ansible_inventory').get_hosts('all') def test_hosts_file(File): f = File('/etc/hosts') assert f.exists assert f.user == 'root' assert f.group == 'root'
Python
0.999691
19fd0b75e07311bb3eb863d132125325e3478424
Fix typo in docstring
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...
Python
0.013244
ef03541b2b25ab9cf34deec554a19a32dad7fbec
Add new line to end of init file for Meta Writer application
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')
Python
0
5eaf4ed148f36f6cf578c9d943ee32652628de64
Fix broken tests
xero/exceptions.py
xero/exceptions.py
from six.moves.urllib.parse import parse_qs from xml.dom.minidom import parseString import json class XeroException(Exception): def __init__(self, response, msg=None): self.response = response super(XeroException, self).__init__(msg) class XeroNotVerified(Exception): # Credentials haven't be...
from six.moves.urllib.parse import parse_qs from xml.dom.minidom import parseString import json class XeroException(Exception): def __init__(self, response, msg=None): self.response = response super(XeroException, self).__init__(msg) class XeroNotVerified(Exception): # Credentials haven't be...
Python
0.000555
514074dee639b30fb56ec664804bdd3f533befda
Apply `cacheonceproperty` on props of Tree & Chunk.
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...
Python
0
7aae3f244f15d31e4d5a0c844df5cbbb5a594e84
update mongostring
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) ...
Python
0.000001
de3b4775b7dbcecc9c42e18c59b35485f83ca74a
Update max-chunks-to-make-sorted-i.py
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 ...
Python
0.000001
32fccb04bac6be7e79f6b05b727e5e847fef498c
Update misc.py
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,...
Python
0
4b9948e665c78df468917b0906afc288244fa303
add doc back in.
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...
Python
0
e9a1ee7faef9b208e83173c39c62926553ab6b5f
mark issue as closed if resolution type is finished or fixed
src/survivor/tasks/sync.py
src/survivor/tasks/sync.py
""" Synchronises local database with JIRA. """ import argparse import iso8601 import itertools from jira.client import JIRA from survivor import config, init from survivor.models import User, Issue # max number of issues to have jira return for the project MAX_ISSUE_RESULTS = 99999 def create_user(jira_user): ...
""" Synchronises local database with JIRA. """ import argparse import iso8601 import itertools from jira.client import JIRA from survivor import config, init from survivor.models import User, Issue # max number of issues to have jira return for the project MAX_ISSUE_RESULTS = 99999 def create_user(jira_user): ...
Python
0
bbf8886a2cbf4fa371f0a67157fdd3df3dfa47dd
Fix broken MLflow DB README link in CLI docs (#2377)
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. ...
Python
0
d5f979236089e7cb3de90b03303e1c3af967331c
add UW-Madison, minor formatting
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...
Python
0.00243
af54f9666b15cd68e5404b60f495f6d51c1470b1
Fix upload_manual_flac command to add its arguments
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): ...
Python
0
fdeb06bdf33a55413f1f8f8cd780c84438ad2277
add missing import
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...
Python
0.000042
db1f0556f72eb84e4273ff8925494de81bf21898
rename paths / meta not needed
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...
Python
0
9e86d12e1135d16b32da5f130e14cfde4ffe9a95
Support CloudFlare "email" protection
module/plugins/hoster/UpleaCom.py
module/plugins/hoster/UpleaCom.py
# -*- coding: utf-8 -*- import re import urlparse from module.plugins.internal.XFSHoster import XFSHoster def decode_cloudflare_email(value): email = "" key = int(value[:2], 16) for i in xrange(2, len(value), 2): email += chr(int(value[i:i+2], 16) ^ key) return email class UpleaCom(XFSHo...
# -*- coding: utf-8 -*- import re import urlparse from module.plugins.internal.XFSHoster import XFSHoster class UpleaCom(XFSHoster): __name__ = "UpleaCom" __type__ = "hoster" __version__ = "0.17" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?uplea\.com/dl/\w{15}' __config...
Python
0
f9e63022eb975c131bef86a81655885ea0563857
Capitalise constants
saau/sections/geology/elevation.py
saau/sections/geology/elevation.py
# geology-elevation1 from os.path import basename import cartopy.crs as ccrs from ..image_provider import ImageProvider from ...utils.download import get_binary from ...utils.shape import shape_from_zip URL = 'http://www.ga.gov.au/corporate_data/48006/48006_shp.zip' FILENAME = basename(URL) class ElevationImagePro...
# geology-elevation1 from os.path import basename import cartopy.crs as ccrs from ..image_provider import ImageProvider from ...utils.download import get_binary from ...utils.shape import shape_from_zip url = 'http://www.ga.gov.au/corporate_data/48006/48006_shp.zip' filename = basename(url) class ElevationImagePro...
Python
0.999886
327fcfd4c6b0ad10b25c286f271c577afd741099
set width for login details to 50 chars.
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. ===========================================================...
Python
0
bd66185722417cfc24f348b7538e189636c75352
Fix full node in VoresourceRendererMixin
daiquiri/core/renderers/voresource.py
daiquiri/core/renderers/voresource.py
from datetime import datetime from . import XMLRenderer from .vosi import CapabilitiesRendererMixin, TablesetRendererMixin class VoresourceRendererMixin(CapabilitiesRendererMixin, TablesetRendererMixin): def render_voresource(self, metadata): self.start('ri:Resource', { 'created': self.rende...
from datetime import datetime from . import XMLRenderer from .vosi import CapabilitiesRendererMixin, TablesetRendererMixin class VoresourceRendererMixin(CapabilitiesRendererMixin, TablesetRendererMixin): def render_voresource(self, metadata): self.start('ri:Resource', { 'created': self.rende...
Python
0.000001
fe7d5ec956f0277d0689dec57d9e145fcd19f79f
Modify svm
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...
Python
0.000426
ec7411f409f07bd04778c9baf509adb10f446f10
allow cross origin requests
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...
Python
0
fa58cda42afaf1ed80352d9b59cf473a16706436
work around, closes #464
vent/helpers/paths.py
vent/helpers/paths.py
import errno import os import platform from vent.api.templates import Template class PathDirs: """ Global path directories for vent """ def __init__(self, base_dir=os.path.join(os.path.expanduser("~"), ".vent/"), plugins_dir="plugins/", meta_dir=os.path.join(...
import errno import os from vent.api.templates import Template class PathDirs: """ Global path directories for vent """ def __init__(self, base_dir=os.path.join(os.path.expanduser("~"), ".vent/"), plugins_dir="plugins/", meta_dir=os.path.join(os.path.expandus...
Python
0
7f248f252b0a846e39c60d66485f796576b2179e
fix doctest
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...
Python
0.000001
cef46656955cca0a5b0a83487418cc733a79e52b
fix profile url (#849)
open_discussions/urls.py
open_discussions/urls.py
"""project URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.8/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-bas...
"""project URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.8/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-bas...
Python
0
6b8de33dbd50243d566e095005699f0611a38d8b
add new fail message during commit
netmiko/vyos/vyos_ssh.py
netmiko/vyos/vyos_ssh.py
from __future__ import print_function from __future__ import unicode_literals import time from netmiko.cisco_base_connection import CiscoSSHConnection class VyOSSSH(CiscoSSHConnection): """Implement methods for interacting with VyOS network devices.""" def session_preparation(self): """Prepare the se...
from __future__ import print_function from __future__ import unicode_literals import time from netmiko.cisco_base_connection import CiscoSSHConnection class VyOSSSH(CiscoSSHConnection): """Implement methods for interacting with VyOS network devices.""" def session_preparation(self): """Prepare the se...
Python
0
eaae2a1e88572e224621e242be1d15e92065f15e
Use new extension setup() API
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): ...
Python
0
daf577f1e4bab13f9d5f2e3fdad8765dbab70dfe
refactor settings
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 # ########...
Python
0.000002
945c93fa91cb7b3b14f002e37e2a8bd2ee915fdd
Clean the mako cache between runs, because it breaks theme switching
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,...
Python
0
c21d7bee740fe27012d9affed27b6c489e5f6cac
add logging types
avalanche/evaluation/metric_results.py
avalanche/evaluation/metric_results.py
################################################################################ # Copyright (c) 2021 ContinualAI. # # Copyrights licensed under the MIT License. # # See the accompanying LICENSE file for terms. ...
################################################################################ # Copyright (c) 2021 ContinualAI. # # Copyrights licensed under the MIT License. # # See the accompanying LICENSE file for terms. ...
Python
0.000001
4912027d6cb0f27c736e46498231595f50a36cd3
add cv element
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 _...
Python
0.000001
2aeda5c12710e197282f015f7e4b8519f1d8bcc5
Update tests.py
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": [ { ...
Python
0.000001
711e49f0a49a45d7b7021b5c26137989883c270c
Refresh monitoring.nagios.probes.mssql and fix pylint+pep8.
monitoring/nagios/probes/mssql.py
monitoring/nagios/probes/mssql.py
# -*- coding: utf-8 -*- # Copyright (C) Vincent BESANCON <besancon.vincent@gmail.com> # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation # the...
# -*- coding: utf-8 -*- #=============================================================================== # Filename : mssql # Author : Vincent BESANCON <besancon.vincent@gmail.com> # Description : Module that define a MS SQL Server probe. #------------------------------------------------------------------...
Python
0
decab6827b5dacc21f0263af7e5d895e5a737726
Update tests.py
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": [ { ...
Python
0.000001
0626c8db3f2287d78c467c194e01cf004f0c7e78
Convert simple-mapped results back to Series.
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...
Python
0.000129
42f74f304d0ac404f17d6489033b6140816cb194
Implement Stonesplinter Trogg, Burly Rockjaw Trogg, Ship's Cannon
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....
Python
0
0bd2fffcab47c79999e5bf20b881a69193855bd9
Fix install script
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)
Python
0.000001
2cc505d3a3c54f3ce1e91941a905c6a298a46d05
Fix classifiers.
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...
Python
0.000007
624599bc0172e9166536abfc6be254b5117ac64c
Add error handling in plugin installation process
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...
Python
0
4cd7bc99509c197e8c8139d6d597ab04bece0cb1
Use include_paths_relative_to_dir
vim/ycm_extra_conf.py
vim/ycm_extra_conf.py
from itertools import chain, repeat from subprocess import Popen, PIPE import os import re import ycm_core extra_flags = [ '-Wall', '-Wextra', '-pedantic', '-DNDEBUG', '-I', '.', ] filetype_flags = { 'c': ['-x', 'c', '-std=c11'], 'cpp': ['-x', 'c++', '-std=c++14'], } # Set this to the abs...
from subprocess import Popen, PIPE import os import re import ycm_core # These are the compilation flags that will be used in case there's no # compilation database set (by default, one is not set). # CHANGE THIS LIST OF FLAGS. YES, THIS IS THE DROID YOU HAVE BEEN LOOKING FOR. default_flags = [ '-Wall', '-Wext...
Python
0.000004
49ab81275b0e29281703257000c62a54f9627df8
fix property usage
polyjit/buildbot/builders/slurm.py
polyjit/buildbot/builders/slurm.py
import sys from polyjit.buildbot.builders import register from polyjit.buildbot import slaves from polyjit.buildbot.utils import (builder, define, git, cmd, trigger, ip, mkdir, s_sbranch, s_force, s_trigger, hash_download_from_master, clean_unpack...
import sys from polyjit.buildbot.builders import register from polyjit.buildbot import slaves from polyjit.buildbot.utils import (builder, define, git, cmd, trigger, ip, mkdir, s_sbranch, s_force, s_trigger, hash_download_from_master, clean_unpack...
Python
0.000002
3b9954b3a6206d758664084dc24cd83774f8a623
use flownet to compute flow map
FlowNet/flownet-release/models/flownet/read_video.py
FlowNet/flownet-release/models/flownet/read_video.py
# Simple optical flow algorithm # # # OpenCV version: 2.4.8 # # # Contact: # Min-Hung (Steve) Chen at <cmhungsteve@gatech.edu> # Chih-Yao Ma at <cyma@gatech.edu> # # Last update: 05/16/2016 import numpy as np import cv2 from scripts.flownet import FlowNet # read the video file cap = cv2.VideoCapture('v_Basketball_g01...
# Simple optical flow algorithm # # # OpenCV version: 2.4.8 # # # Contact: # Min-Hung (Steve) Chen at <cmhungsteve@gatech.edu> # Chih-Yao Ma at <cyma@gatech.edu> # # Last update: 05/13/2016 import numpy as np import cv2 from scripts.flownet import FlowNet cap = cv2.VideoCapture('v_Basketball_g01_c01.avi') # infor...
Python
0
3a910621b36f0555b4a16f22582313333e162093
Check for icons when displaying thumbnails
paw/admin.py
paw/admin.py
from django.contrib import admin from paw.models import TextLink, IconLink, IconFolder, Page, PageTextLink, PageIconDisplay, IconFolderIcon, EntryPoint from adminsortable.admin import NonSortableParentAdmin, SortableStackedInline, SortableTabularInline, SortableAdmin class PageTextLinkInline(SortableStackedInline): ...
from django.contrib import admin from paw.models import TextLink, IconLink, IconFolder, Page, PageTextLink, PageIconDisplay, IconFolderIcon, EntryPoint from adminsortable.admin import NonSortableParentAdmin, SortableStackedInline, SortableTabularInline, SortableAdmin class PageTextLinkInline(SortableStackedInline): ...
Python
0
00556c84e23dd86eb4ca08ba4c6238425a3eba7e
Create Preparation model
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...
Python
0
5d9f83c06e3418cbb4bd5314136bd4700d7e26c3
Remove print statement
paasta_tools/cli/cmds/performance_check.py
paasta_tools/cli/cmds/performance_check.py
#!/usr/bin/env python # Copyright 2015-2016 Yelp 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 ...
#!/usr/bin/env python # Copyright 2015-2016 Yelp 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 ...
Python
0.007015
0de2aace2a493d0d760b1ceec3b67f5a6c3f86e6
fix exceptin 'TypeError: a float is required'
vmchecker/coursedb.py
vmchecker/coursedb.py
#!/usr/bin/env python """Manage the course database""" from __future__ import with_statement import sqlite3 from contextlib import contextmanager, closing class CourseDb(object): """A class to encapsulate the logic behind updates and querries of the course's db""" def __init__(self, db_cursor): ...
#!/usr/bin/env python """Manage the course database""" from __future__ import with_statement import sqlite3 from contextlib import contextmanager, closing class CourseDb(object): """A class to encapsulate the logic behind updates and querries of the course's db""" def __init__(self, db_cursor): ...
Python
0
c0259abdd1b34cd195e3f1ffcb7fb5479d76a0fe
bump version to 1.0.0
vncdotool/__init__.py
vncdotool/__init__.py
__version__ = "1.0.0"
__version__ = "1.0.0dev"
Python
0
4e6207361d7ef08a20e343cb5dab500c2c9cdf28
Update AppleApple!.py
AppleApple!/AppleApple!.py
AppleApple!/AppleApple!.py
import pygame, random from pygame.locals import * costPerTree = 0 class Item(object): def __init__(self, itemName, isMaterial, isFood, isWeapon, isCraftable, cost, recipe=()): self.name = str(itemName) self.isMaterial = isMaterial self.isFood = isFood self.isWeapon = isWeapon ...
import pygame, random from pygame.locals import * costPerTree = 0 class Item(object): def __init__(self, itemName, isMaterial, isFood, isWeapon, isCraftable, cost, recipe=()): self.name = str(itemName) self.isMaterial = isMaterial self.isFood = isFood self.isWeapon = isWeapon ...
Python
0.000001
7d1463fc732cdc6aef3299c6d2bbe916418e6d6e
Add full_name field to API
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, ...
Python
0.000001
7fb0e28ad6ef1190e61fc38bfb19744739b2e096
Remove unused deps from admin view
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...
Python
0
a900501804a5a07ed9cea77d5d5348be5e100d67
Use Acapela TTS if available
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...
Python
0
b00ae9a1023bb649171776f9cfdbf8675621272d
Use of `@api.multi`.
base_custom_info/models/custom_info.py
base_custom_info/models/custom_info.py
# -*- coding: utf-8 -*- # © 2015 Antiun Ingeniería S.L. - Sergio Teruel # © 2015 Antiun Ingeniería S.L. - Carlos Dauden # © 2015 Antiun Ingeniería S.L. - Jairo Llopis # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html from openerp import api, fields, models class CustomInfoTemplate(models.Model): "...
# -*- coding: utf-8 -*- # © 2015 Antiun Ingeniería S.L. - Sergio Teruel # © 2015 Antiun Ingeniería S.L. - Carlos Dauden # © 2015 Antiun Ingeniería S.L. - Jairo Llopis # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html from openerp import api, fields, models class CustomInfoTemplate(models.Model): "...
Python
0
74101a9f24b218c036cf32c540cfb911e601080b
fix freeze of ppo2 (#849)
baselines/common/mpi_adam_optimizer.py
baselines/common/mpi_adam_optimizer.py
import numpy as np import tensorflow as tf from baselines.common import tf_util as U from baselines.common.tests.test_with_mpi import with_mpi try: from mpi4py import MPI except ImportError: MPI = None class MpiAdamOptimizer(tf.train.AdamOptimizer): """Adam optimizer that averages gradients across mpi proc...
import numpy as np import tensorflow as tf from mpi4py import MPI class MpiAdamOptimizer(tf.train.AdamOptimizer): """Adam optimizer that averages gradients across mpi processes.""" def __init__(self, comm, **kwargs): self.comm = comm tf.train.AdamOptimizer.__init__(self, **kwargs) def compu...
Python
0
a2982804011e808bd8bf8d9781d9b7bb20328ddc
remove import test line
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...
Python
0.000001
6e42e355d6ae60f115c9027ff6fcb17814b346c2
use mah special charm helpers
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...
Python
0
a02624cdbacd666d4e0cdba6230e2ee67837f874
add AsText to __all__ list
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...
Python
0.000861
28b2d0d4c92656b2b1fb7a519cb0f33657048e0c
improve plotting and update to pyIEM
scripts/current/q3_today_total.py
scripts/current/q3_today_total.py
""" Create a plot of today's estimated precipitation based on the Q3 data """ import datetime import numpy as np import os import sys sys.path.insert(0, '../mrms') import util import pytz import gzip from pyiem.plot import MapPlot def doday(ts, realtime): """ Create a plot of precipitation stage4 estimates ...
""" Create a plot of today's estimated precipitation based on the Q3 data """ import datetime import numpy as np import os import sys sys.path.insert(0, '../mrms') import util import pytz import gzip from iem.plot import MapPlot def doday(ts): """ Create a plot of precipitation stage4 estimates for some day...
Python
0
9fb1c2781582e52c6618b61d4a8a60c3363ee711
bump controller API to v1.1
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'
Python
0.000001
60e60c9d7c5551701eafbfe15dd3931d45b594b6
Handle Accept headers
api/__init__.py
api/__init__.py
# try and keep Flask imports to a minimum, going to refactor later to use # just werkzeug, for now, prototype speed is king from flask import Flask, request import yaml import os import re from datetime import datetime from api.config import config, ConfigException import api.repo import api.utils app = Flask(__name_...
# try and keep Flask imports to a minimum, going to refactor later to use # just werkzeug, for now, prototype speed is king from flask import Flask, request import yaml import os import re from datetime import datetime from api.config import config, ConfigException import api.repo import api.utils app = Flask(__name_...
Python
0
a652e43ca73eacda7e42e27afb0d91d75000b4df
Fix typing errors
gerber_to_scad/vector.py
gerber_to_scad/vector.py
# Basic vector maths class import math class V(object): def __init__(self, x=0, y=0): self.x = float(x) self.y = float(y) def __unicode__(self): return "(%s, %s)" % (self.x, self.y) __repr__ = __unicode__ @classmethod def from_tuple(cls, coordinates): x, y = coor...
# Basic vector maths class import math class V(object): def __init__(self, x=0, y=0): self.x = float(x) self.y = float(y) def __unicode__(self): return "(%s, %s)" % (self.x, self.y) __repr__ = __unicode__ @classmethod def from_tuple(cls, coordinates): x, y = coord...
Python
0.00611
ab3f331246e844812fd91b51908a0d0972a9793f
improve run_bin (#885)
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...
Python
0
15f22d7c0ac9ddce6cb14cb0cbb35c4d630605d2
Remove period so input corresponds to output.
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...
Python
0.999999
ccef871b45f78845a12c3209b463e861244a107e
Fix the moin parser.
external/moin-parser.py
external/moin-parser.py
# -*- coding: utf-8 -*- """ The Pygments MoinMoin Parser ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This is a MoinMoin parser plugin that renders source code to HTML via Pygments; you need Pygments 0.7 or newer for this parser to work. To use it, set the options below to match your setup and put this file in ...
# -*- coding: utf-8 -*- """ The Pygments MoinMoin Parser ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This is a MoinMoin parser plugin that renders source code to HTML via Pygments; you need Pygments 0.7 or newer for this parser to work. To use it, set the options below to match your setup and put this file in ...
Python
0.000001
dffcfa42fbf4f200a22b739a0cd24f36317b054c
Fix so that /api/login/ follow the specified api documentation.
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...
Python
0
bfb4ba8cb863d80cdd558ebad25f630fef5dc190
Stop to use the __future__ module.
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...
Python
0.999929
2e8a2d2ac8b90a0806bea90c25d9b06ce8cc3a96
check roi for each layer
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...
Python
0
d671acb2c8a381fa49e98c50d967122738ebbd7b
Remove extra slash problem
app/comicbook.py
app/comicbook.py
import os import sys from natsort import natsorted class comicbook(object): filelist = [] def __init__(self, name, filename=None): self.name = name self.path = (name + "/").replace('//','/') self.localpath = "res/" + name + "/" self.filename = filename self.generate_fil...
import os import sys from natsort import natsorted class comicbook(object): filelist = [] def __init__(self, name, filename=None): self.name = name self.path = name + "/" self.localpath = "res/" + name + "/" self.filename = filename self.generate_filelist() if s...
Python
0.000009
ba5edd102ddd53f2e95da8b673bf14bdd72dc012
Add quotes around user-provided values
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 ...
Python
0.000001
cf36f9792886c6dd67b37c29af4a5d510b924902
Use UTF-8 by default instead of locale encoding.
pybtex/io.py
pybtex/io.py
# Copyright (c) 2009, 2010, 2011, 2012 Andrey Golovizin # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify,...
# Copyright (c) 2009, 2010, 2011, 2012 Andrey Golovizin # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify,...
Python
0
4283aaf601482ee2512c642101f587ffe3515ef9
raise if user doesn't exist in forgotten password form
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")
Python
0.000001
f55c0bd8db7850668582bb7b47da4d0acafabc46
Optimize imports
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 ...
Python
0.000002
a5f3ad5700aa766fec99a184bae1d732d0754491
Support of HACluster added
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...
Python
0
837aea7b39662a8285df01522461c51ce0f91de5
fix suppressions - don't overwrite config setting with super() - be explict in debug log what is going on with filters/suppression
nymms/reactor/handlers/Handler.py
nymms/reactor/handlers/Handler.py
import logging logger = logging.getLogger(__name__) from nymms.utils import load_object_from_string class Handler(object): def __init__(self, config=None): self.config = config self._filters = [] self._suppression_enabled = self.config.pop( 'suppression_enabled', ...
import logging logger = logging.getLogger(__name__) from nymms.utils import load_object_from_string class Handler(object): def __init__(self, config=None): self.config = config self._filters = [] self._suppressions_enabled = self.config.pop('suppressions_enabled', False) ...
Python
0.000001
f5d948c159a4d398a1347220a4fcd4315c725b04
Fix issue handling Image as a paint source
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):...
Python
0.000001
91064ed8d7c6b6ab7eb8bb9da94136ba34e8a2e5
use length validator on description
abilian/sbe/apps/communities/forms.py
abilian/sbe/apps/communities/forms.py
import imghdr from string import strip import PIL from flask import request from flask.ext.babel import lazy_gettext as _l, gettext as _ from wtforms.fields import BooleanField, TextField, TextAreaField from wtforms.validators import ValidationError, required from abilian.web.forms import Form from abilian.web.forms....
import imghdr from string import strip import PIL from flask import request from flask.ext.babel import lazy_gettext as _l, gettext as _ from wtforms.fields import BooleanField, TextField, TextAreaField from wtforms.validators import ValidationError, required from abilian.web.forms import Form from abilian.web.forms....
Python
0.000002
848e12dde9685cf1c6e44178bb0f3eff9d4203be
Fix migrations
actistream/migrations/0001_initial.py
actistream/migrations/0001_initial.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.8 on 2016-09-15 20:40 from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ('content...
# -*- coding: utf-8 -*- # Generated by Django 1.9.8 on 2016-09-15 20:40 from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ('content...
Python
0.000006
9783844b1597598fad833794b4b291fce49438d4
Send alerts as one mail
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...
Python
0
0dfd0ec2beb069d56d7b81911bb468199565672a
remove print
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...
Python
0.000793
d51adea3d19578da9165202696d80c44949c43f6
remove debug level logging from i2tun.py
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() ...
Python
0.000001
abe4f0577baef3dbbceb06fc6d569d2bec69257e
Fix internal import
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...
Python
0.000012
695e171d1eca459075ad03adf0712f5b7427cac4
Add get_or_404() to __all__
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...
Python
0
acdb6bbba1d6114f6ccf9dfc3307905fc88e17bb
Put the updated format into the Cryomagnetics device test.
tests/unit/test_devices/test_abstract_cryomagnetics_device.py
tests/unit/test_devices/test_abstract_cryomagnetics_device.py
""" Contains unit tests for :mod:`mr_freeze.devices.abstract_cryomagnetics_device` """ import unittest from mr_freeze.devices.abstract_cryomagnetics_device import \ AbstractCryomagneticsDevice class ConcreteCryomagneticsDevice(AbstractCryomagneticsDevice): was_read_called = False data_to_read = None ...
""" Contains unit tests for :mod:`mr_freeze.devices.abstract_cryomagnetics_device` """ import unittest from mr_freeze.devices.abstract_cryomagnetics_device import \ AbstractCryomagneticsDevice class ConcreteCryomagneticsDevice(AbstractCryomagneticsDevice): was_read_called = False data_to_read = None ...
Python
0
24ee61ecf5767d10b2fb92acc5d0217ffbfb3834
Update get_branches.py
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...
Python
0
c9df16f35af2cf51a4612eb76fab59819a32df64
Handle TypeError in is_float
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(...
Python
0.003037
1dff7ff24903f470bf1e1d325c6eb88590b9fa0f
Make generator to get last bot utterance
rasa/core/channels/twilio_voice.py
rasa/core/channels/twilio_voice.py
import inspect from sanic import Blueprint, response from sanic.request import Request from sanic.response import HTTPResponse from twilio.twiml.voice_response import VoiceResponse, Gather from typing import Text, Callable, Awaitable, List from rasa.shared.core.events import BotUttered from rasa.core.channels.channel ...
import inspect from sanic import Blueprint, response from sanic.request import Request from sanic.response import HTTPResponse from twilio.twiml.voice_response import VoiceResponse, Gather from typing import Text, Callable, Awaitable, List from rasa.core.channels.channel import ( InputChannel, CollectingOutput...
Python
0.000011
7fb89e4dbe2cbed4ef37e13073d4fa3f2a650049
Check for missing part thumbnails when the server first runs
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'
Python
0
7f5f10132334c1f6685497d3fff48c2c65617845
Remove broken URL (#3623)
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 = ...
Python
0
d0e31fdb5ec99e91f7b5f7da5b81fc7a391689df
Update django_facebook/admin.py
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',) ...
Python
0
4d1e3e548ee80d4a3ef42ad22506fcb8dd64ef05
Make TestBackend compatible with Python 2 (Closes: #72)
django_slack/backends.py
django_slack/backends.py
import pprint import logging from six.moves import urllib from django.http.request import QueryDict from django.utils.module_loading import import_string from .utils import Backend from .app_settings import app_settings logger = logging.getLogger(__name__) class UrllibBackend(Backend): def send(self, url, mes...
import pprint import logging from six.moves import urllib from django.http.request import QueryDict from django.utils.module_loading import import_string from .utils import Backend from .app_settings import app_settings logger = logging.getLogger(__name__) class UrllibBackend(Backend): def send(self, url, mes...
Python
0
d06e5e51695d40b8248d5854454b7d291b76bafd
Fix a few first run issues.
observy/notifications/__init__.py
observy/notifications/__init__.py
#!/usr/bin/python # # Copyright 2016 Eldon Ahrold # # 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 a...
#!/usr/bin/python # # Copyright 2016 Eldon Ahrold # # 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 a...
Python
0
dbf736ba66fe6b530bfe3d9d503caa2e24ee8f01
Make /config more CORS-y
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...
Python
0
1a00800940b64fe33bbba22eb33da14df84de1a1
Fix broken TPShim
nupic/research/TP_shim.py
nupic/research/TP_shim.py
# ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2014, Numenta, Inc. Unless you have an agreement # with Numenta, Inc., for a separate license for this software code, the # following terms and conditions apply: # # This progra...
# ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2014, Numenta, Inc. Unless you have an agreement # with Numenta, Inc., for a separate license for this software code, the # following terms and conditions apply: # # This progra...
Python
0.000116
f54690eb9962489a387674985055e305b9b57aa9
remove discription by message body
addons/project_mailgate/project_mailgate.py
addons/project_mailgate/project_mailgate.py
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU...
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU...
Python
0.000001
54e1cb0048ffd0024feae4e5dc0c1e047ca55328
remove debug print
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...
Python
0.000008
294e8b120d507237f1129338c476939b20604f26
Save release test metrics under a single column (#30215)
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....
Python
0
0a94b8a4756e9b46211567c430560a314c554a1d
add help for org command
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') ...
Python
0.000001
70477e0a8da15592f5f2197e8d1bffe57eece871
Add back import of operations, which was lost during cleanup.
nuage_amp/nuage_amp.py
nuage_amp/nuage_amp.py
#!/usr/bin/python """ Usage: nuage-amp sync [--once] [options] nuage-amp audit-vports [options] nuage-amp network-macro-from-url (create|delete) <url> <enterprise> [options] nuage-amp vsdmanaged-tenant (create|delete) <name> [--force] [options] nuage-amp vsdmanaged-tenant list nuage-amp (-h | --help) Optio...
#!/usr/bin/python """ Usage: nuage-amp sync [--once] [options] nuage-amp audit-vports [options] nuage-amp network-macro-from-url (create|delete) <url> <enterprise> [options] nuage-amp vsdmanaged-tenant (create|delete) <name> [--force] [options] nuage-amp vsdmanaged-tenant list nuage-amp (-h | --help) Optio...
Python
0
6b3363b1486bd92f5355023074db9a52e60b1b34
Set AWS MQTT timeouts to 120 / 60.
src/scs_core/aws/client/mqtt_client.py
src/scs_core/aws/client/mqtt_client.py
""" Created on 6 Oct 2017 @author: Bruno Beloff (bruno.beloff@southcoastscience.com) https://github.com/aws/aws-iot-device-sdk-python https://stackoverflow.com/questions/20083858/how-to-extract-value-from-bound-method-in-python """ import AWSIoTPythonSDK.exception.AWSIoTExceptions as AWSIoTExceptions import AWSIoTP...
""" Created on 6 Oct 2017 @author: Bruno Beloff (bruno.beloff@southcoastscience.com) https://github.com/aws/aws-iot-device-sdk-python https://stackoverflow.com/questions/20083858/how-to-extract-value-from-bound-method-in-python """ import AWSIoTPythonSDK.exception.AWSIoTExceptions as AWSIoTExceptions import AWSIoTP...
Python
0
400f127fb3264b5a4f403a67a89c25238ff192a4
Fix missing import in fs.sshfs.error_tools
fs/sshfs/error_tools.py
fs/sshfs/error_tools.py
from __future__ import absolute_import from __future__ import unicode_literals import errno import six import sys from .. import errors class _ConvertSSHFSErrors(object): """Context manager to convert OSErrors in to FS Errors.""" FILE_ERRORS = { 64: errors.RemoteConnectionError, # ENONET e...
from __future__ import absolute_import from __future__ import unicode_literals import errno import six from .. import errors class _ConvertSSHFSErrors(object): """Context manager to convert OSErrors in to FS Errors.""" FILE_ERRORS = { 64: errors.RemoteConnectionError, # ENONET errno.EN...
Python
0.00021
65fb9244df69646721c8273afae22fe6248976f0
optimise common.py
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...
Python
0.022141