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
bf24abb4ffba4f63f641cc61e22357253cdca956
Fix migration script
src/adhocracy/migration/versions/053_add_newsservice.py
src/adhocracy/migration/versions/053_add_newsservice.py
from datetime import datetime from sqlalchemy import MetaData, Column, ForeignKey, Table from sqlalchemy import Boolean, DateTime, Integer, Unicode, UnicodeText metadata = MetaData() message_table = Table( 'message', metadata, Column('id', Integer, primary_key=True), Column('subject', Unicode(140), nulla...
from datetime import datetime from sqlalchemy import MetaData, Column, ForeignKey, Table from sqlalchemy import Boolean, DateTime, Integer, Unicode, UnicodeText metadata = MetaData() message_table = Table( 'message', metadata, Column('id', Integer, primary_key=True), Column('subject', Unicode(140), nulla...
Python
0.000008
307d866bb6538a78effcc44e005a4dcb90a2a4b5
Increment to 0.5.4
sanic/__init__.py
sanic/__init__.py
from sanic.app import Sanic from sanic.blueprints import Blueprint __version__ = '0.5.4' __all__ = ['Sanic', 'Blueprint']
from sanic.app import Sanic from sanic.blueprints import Blueprint __version__ = '0.5.3' __all__ = ['Sanic', 'Blueprint']
Python
0.999999
5fd62098bd2f2722876a0873d5856d70046d3889
Increment to 0.5.2
sanic/__init__.py
sanic/__init__.py
from sanic.app import Sanic from sanic.blueprints import Blueprint __version__ = '0.5.2' __all__ = ['Sanic', 'Blueprint']
from sanic.app import Sanic from sanic.blueprints import Blueprint __version__ = '0.5.1' __all__ = ['Sanic', 'Blueprint']
Python
0.999999
035938d8c0f3cc2cda353286c0089ee02ffe3b87
Use dj six
likert_field/models.py
likert_field/models.py
#-*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models from django.utils.encoding import force_text, python_2_unicode_compatible from django.utils.six import string_types from django.utils.translation import ugettext_lazy as _ import likert_field.forms as forms @python_2_unicode...
#-*- coding: utf-8 -*- from __future__ import unicode_literals from six import string_types from django.db import models from django.utils.encoding import force_text, python_2_unicode_compatible from django.utils.translation import ugettext_lazy as _ import likert_field.forms as forms @python_2_unicode_compatible ...
Python
0.000001
2194cc4e96fb2168b55c23a1c7a71636074ae8bf
Fix a comment
scout/adapter/mongo/rank_model.py
scout/adapter/mongo/rank_model.py
# -*- coding: utf-8 -*- import logging from io import StringIO import requests from configobj import ConfigObj LOG = logging.getLogger(__name__) TIMEUT = 20 class RankModelHandler(object): def fetch_rank_model(self, rank_model_url): """Send HTTP request to retrieve rank model config file Args: ...
# -*- coding: utf-8 -*- import logging from io import StringIO import requests from configobj import ConfigObj LOG = logging.getLogger(__name__) TIMEUT = 20 class RankModelHandler(object): def fetch_rank_model(self, rank_model_url): """Send HTTP request to retrieve rank model config file Args: ...
Python
0.999759
e8254ced75ce9d0df1033b6e4acb8e33f9b00e93
''.join want strings
scheduler/send.py
scheduler/send.py
#!/usr/bin/env python import logging logger = logging.getLogger('') from models import Task def send(function, args=None): if args is None: args = [] Task.objects.create(function=function, args=args) logging.info("[x] Sent %s(%s)" % (function, ", ".join(map(lambda x: "%s" % x, args))))
#!/usr/bin/env python import logging logger = logging.getLogger('') from models import Task def send(function, args=None): if args is None: args = [] Task.objects.create(function=function, args=args) logging.info("[x] Sent %s(%s)" % (function, ", ".join(args)))
Python
0.999958
60156236836944205f3993badcf179aaa6e7ae54
Add an (unexposed) ResourceHandler so inheriting objects serialise better
ehriportal/portal/api/handlers.py
ehriportal/portal/api/handlers.py
""" Piston handlers for notable resources. """ from piston.handler import BaseHandler from portal import models class ResourceHandler(BaseHandler): model = models.Resource class RepositoryHandler(BaseHandler): model = models.Repository class CollectionHandler(BaseHandler): model = models.Collection ...
""" Piston handlers for notable resources. """ from piston.handler import BaseHandler from portal import models class RepositoryHandler(BaseHandler): model = models.Repository class CollectionHandler(BaseHandler): model = models.Collection class PlaceHandler(BaseHandler): model = models.Place clas...
Python
0
488e5dd9bcdcba26de98fdbcaba1e23e8b4a8188
use csv writer for listing scraper
scrape_listing.py
scrape_listing.py
#!/usr/bin/env python import csv import sys import requests from models.listing import Listing def scrape_listing(url): writer = csv.writer(sys.stdout) response = requests.get(url) listing = Listing(response.content) # print('Title: ' + listing.title) # print('Price: ' + listing.price) # prin...
#!/usr/bin/env python import sys import requests from models.listing import Listing def scrape_listing(url): response = requests.get(url) listing = Listing(response.content) # print('Title: ' + listing.title) # print('Price: ' + listing.price) # print('Image URLs: ' + listing.imgs) # print('L...
Python
0
ca356ae7b85c9d88f42c5adc6227d0125ff49399
Update settings.py
udbproject/settings.py
udbproject/settings.py
""" Django settings for udbproject project. For more information on this file, see https://docs.djangoproject.com/en/1.7/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.7/ref/settings/ """ # Build paths inside the project like this: os.path.join(BASE_DIR, ...)...
""" Django settings for udbproject project. For more information on this file, see https://docs.djangoproject.com/en/1.7/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.7/ref/settings/ """ # Build paths inside the project like this: os.path.join(BASE_DIR, ...)...
Python
0
844e1917e971e834f7c95064dc7ea31fc7cc0947
Make build_plugins.py bail on error
build/build_plugins.py
build/build_plugins.py
from __future__ import print_function import glob, os.path, sys from mergeex import mergeex try: import simplejson as json except ImportError: import json plugins = [] filters = [] for fileName in sorted(glob.glob('../plugins/*.json')): try: with open(fileName, 'rb') as f: content = f...
from __future__ import print_function import glob, os.path, sys from mergeex import mergeex try: import simplejson as json except ImportError: import json plugins = [] filters = [] for fileName in sorted(glob.glob('../plugins/*.json')): try: with open(fileName, 'rb') as f: content = f.read().decode('utf-8') ...
Python
0.000001
3b3a7d482b3091959533c6de3138af349a8af558
Tidy and comment spreadsheet reader module
autumn_model/spreadsheet.py
autumn_model/spreadsheet.py
from __future__ import print_function from xlrd import open_workbook from numpy import nan import numpy import os import tool_kit ####################################### ### Individual spreadsheet readers ### ####################################### class GlobalTbReportReader: """ Reader object for the WHO'...
from __future__ import print_function from xlrd import open_workbook from numpy import nan import numpy import os import tool_kit ####################################### ### Individual spreadsheet readers ### ####################################### class GlobalTbReportReader: def __init__(self, country_to_rea...
Python
0
6aa7acba495648b710635b465d5b7cd955d9f476
remove tmp line
api/__database.py
api/__database.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import sqlite3 import os from core.config import _core_config from core.config_builder import _core_default_config from core.config_builder import _builder from core.alert import warn from core.alert import messages def create_connection(language): try: retur...
#!/usr/bin/env python # -*- coding: utf-8 -*- import sqlite3 import os from core.config import _core_config from core.config_builder import _core_default_config from core.config_builder import _builder from core.alert import warn from core.alert import messages def create_connection(language): try: retur...
Python
0.000008
4b75e23687c3629d197cbdf0edac23d90e9c52b7
Add Sample and Observation models
varda/models.py
varda/models.py
""" Models backed by SQL using SQLAlchemy. """ from datetime import date from sqlalchemy import Index from varda import db class Variant(db.Model): """ Genomic variant. """ id = db.Column(db.Integer, primary_key=True) chromosome = db.Column(db.String(2)) begin = db.Column(db.Integer) e...
""" Models backed by SQL using SQLAlchemy. """ from datetime import date from sqlalchemy import Index from varda import db class Variant(db.Model): """ Genomic variant. """ id = db.Column(db.Integer, primary_key=True) chromosome = db.Column(db.String(2)) begin = db.Column(db.Integer) e...
Python
0
591b0550e0724f3e515974fee02d8d40e070e52a
Bump version
lintreview/__init__.py
lintreview/__init__.py
__version__ = '2.25.1'
__version__ = '2.25.0'
Python
0
c0b3a1b40149e939e91c5483383f1a1c715a9b9c
Update ipc_lista1.7.py
lista1/ipc_lista1.7.py
lista1/ipc_lista1.7.py
#ipc_lista1.7 #Professor: Jucimar Junior #Any Mendes Carvalho # # # # #Faça um programa que calcule a área de um quadrado, em seguida mostre o dobro desta área para o #usuário. altura = input("Digite a altura do quadrado em metros: ") largura = input("Digite a largura em
#ipc_lista1.7 #Professor: Jucimar Junior #Any Mendes Carvalho # # # # #Faça um programa que calcule a área de um quadrado, em seguida mostre o dobro desta área para o #usuário. altura = input("Digite a altura do quadrado em metros: ") largura = input("Digite a largura
Python
0
4fb6112552ab7969bddca7193dd51910be51d8b2
Update ipc_lista1.7.py
lista1/ipc_lista1.7.py
lista1/ipc_lista1.7.py
#ipc_lista1.7 #Professor: Jucimar Junior #Any Mendes Carvalho # # # # #Faça um programa que calcule a área de um quadrado, em seguida mostre o dobro desta área para o #usuário. altura = input("Digite a altura do quadrado em metros: ") largura = input("Digite a largura do quadrado em
#ipc_lista1.7 #Professor: Jucimar Junior #Any Mendes Carvalho # # # # #Faça um programa que calcule a área de um quadrado, em seguida mostre o dobro desta área para o #usuário. altura = input("Digite a altura do quadrado em metros: ") largura = input("Digite a largura do em
Python
0
f7d8d58393cf2e9fa69dfde58e5da18758408105
move order_with_respect_to to correct location (Meta class of models)
api/api/models.py
api/api/models.py
# REST API Backend for the Radiocontrol Project # # Copyright (C) 2017 Stefan Derkits <stefan@derkits.at> # # 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...
# REST API Backend for the Radiocontrol Project # # Copyright (C) 2017 Stefan Derkits <stefan@derkits.at> # # 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...
Python
0
360ef0dec991d4486ec51f23ffb065d0225347fa
Update ipc_lista1.8.py
lista1/ipc_lista1.8.py
lista1/ipc_lista1.8.py
#ipc_lista1.8 #Professor: Jucimar
#ipc_lista1.8 #Professor:
Python
0
93a91ac118ab4e7280562bd0cfac0ea964ae0a7e
remove auth_check import
plstackapi/core/api/sites.py
plstackapi/core/api/sites.py
from types import StringTypes from django.contrib.auth import authenticate from plstackapi.openstack.manager import OpenStackManager from plstackapi.core.models import Site def _get_sites(filter): if isinstance(filter, StringTypes) and filter.isdigit(): filter = int(filter) if isinstance(filter, i...
from types import StringTypes from django.contrib.auth import authenticate from plstackapi.openstack.manager import OpenStackManager from plstackapi.core.api.auth import auth_check from plstackapi.core.models import Site def _get_sites(filter): if isinstance(filter, StringTypes) and filter.isdigit(): ...
Python
0.000002
273aeda221aa12aac7fe1eea51e0aed859cd9098
move fixme to right pos
sim.py
sim.py
import logging from cardroom import Game, Table, Player, Stock, Waste, Card log = logging.getLogger(__name__) def play_game(players=3, cardsPerPlayer=5): game = start_new_game(players, cardsPerPlayer) while not game.over: game.next_turn() play_turn(game.player, game.table) return game ...
import logging from cardroom import Game, Table, Player, Stock, Waste, Card log = logging.getLogger(__name__) def play_game(players=3, cardsPerPlayer=5): game = start_new_game(players, cardsPerPlayer) while not game.over: game.next_turn() play_turn(game.player, game.table) return game ...
Python
0
36ae43735ed899b0ecb7b5679e60e4b0b2496d80
Move pdf under chromiumcontent
chromiumcontent/chromiumcontent.gyp
chromiumcontent/chromiumcontent.gyp
{ 'targets': [ { 'target_name': 'chromiumcontent_all', 'type': 'none', 'dependencies': [ 'chromiumcontent', '<(DEPTH)/chrome/chrome.gyp:chromedriver', ], 'conditions': [ ['OS=="linux"', { 'dependencies': [ 'chromiumviews', '<(...
{ 'targets': [ { 'target_name': 'chromiumcontent_all', 'type': 'none', 'dependencies': [ 'chromiumcontent', '<(DEPTH)/chrome/chrome.gyp:chromedriver', ], 'conditions': [ ['OS=="linux"', { 'dependencies': [ 'chromiumviews', '<(...
Python
0
2656e59215e0f94892a79e8f94cd90b8717fe8d6
change list style
archivebox/cli/archivebox_add.py
archivebox/cli/archivebox_add.py
#!/usr/bin/env python3 __package__ = 'archivebox.cli' __command__ = 'archivebox add' import sys import argparse from typing import List, Optional, IO from ..main import add from ..util import docstring from ..parsers import PARSERS from ..config import OUTPUT_DIR, ONLY_NEW from ..logging_util import SmartFormatter,...
#!/usr/bin/env python3 __package__ = 'archivebox.cli' __command__ = 'archivebox add' import sys import argparse from typing import List, Optional, IO from ..main import add from ..util import docstring from ..parsers import PARSERS from ..config import OUTPUT_DIR, ONLY_NEW from ..logging_util import SmartFormatter,...
Python
0.000002
07f9edc5764d3002fd3d4c1018a6ec43d5046dd0
Fix unused import.
kinto2xml/tests/test_verifier.py
kinto2xml/tests/test_verifier.py
import json import mock import os from six import StringIO from kinto2xml.verifier import sort_lists_in_dict, main def build_path(filename): return os.path.join(os.path.dirname(__file__), 'fixtures', filename) def test_sort_lists_in_dict_handles_recursion(): assert json.dumps(sort_lists_in_dict({ '...
import json import mock import os import sys from six import StringIO from kinto2xml.verifier import sort_lists_in_dict, main def build_path(filename): return os.path.join(os.path.dirname(__file__), 'fixtures', filename) def test_sort_lists_in_dict_handles_recursion(): assert json.dumps(sort_lists_in_dict(...
Python
0
51f4d40cf6750d35f10f37d939a2c30c5f26d300
Update script to write results to the database.
backend/scripts/updatedf.py
backend/scripts/updatedf.py
#!/usr/bin/env python import hashlib import os import rethinkdb as r def main(): conn = r.connect('localhost', 28015, db='materialscommons') for root, dirs, files in os.walk("/mcfs/data/materialscommons"): for f in files: path = os.path.join(root, f) with open(path) as fd: ...
#!/usr/bin/env python #import hashlib import os def main(): for root, dirs, files in os.walk("/mcfs/data/materialscommons"): for f in files: print f if __name__ == "__main__": main()
Python
0
599672acbf925cab634bc15ab47055aabb131efd
Fix xkcd text regex. Closes #46
dosagelib/plugins/x.py
dosagelib/plugins/x.py
# -*- coding: iso-8859-1 -*- # Copyright (C) 2004-2005 Tristan Seligmann and Jonathan Jacobs # Copyright (C) 2012-2013 Bastian Kleineidam from re import compile from ..scraper import _BasicScraper from ..helpers import bounceStarter from ..util import tagre class xkcd(_BasicScraper): url = 'http://xkcd.com/' ...
# -*- coding: iso-8859-1 -*- # Copyright (C) 2004-2005 Tristan Seligmann and Jonathan Jacobs # Copyright (C) 2012-2013 Bastian Kleineidam from re import compile from ..scraper import _BasicScraper from ..helpers import bounceStarter from ..util import tagre class xkcd(_BasicScraper): url = 'http://xkcd.com/' ...
Python
0.999991
f0593b2d69730441b5a486e27ed6eb7001939bf4
Include unlimited features for enterprise
corehq/apps/accounting/bootstrap/config/user_buckets_august_2018.py
corehq/apps/accounting/bootstrap/config/user_buckets_august_2018.py
from __future__ import absolute_import from __future__ import unicode_literals from decimal import Decimal from corehq.apps.accounting.models import ( FeatureType, SoftwarePlanEdition, UNLIMITED_FEATURE_USAGE ) BOOTSTRAP_CONFIG = { (SoftwarePlanEdition.COMMUNITY, False, False): { 'role': 'comm...
from __future__ import absolute_import from __future__ import unicode_literals from decimal import Decimal from corehq.apps.accounting.models import ( FeatureType, SoftwarePlanEdition, ) BOOTSTRAP_CONFIG = { (SoftwarePlanEdition.COMMUNITY, False, False): { 'role': 'community_plan_v1', 'pro...
Python
0
205f3fb2f36f33c6d13b4541ad49522b799d358d
simplify the call to make file list
src/actions/server.py
src/actions/server.py
import sys from twisted.python import log from twisted.web.server import Site from twisted.web.static import File from twisted.internet import task from twisted.internet.protocol import DatagramProtocol from . import utils class Broadcaster(DatagramProtocol): """ Broadcast the ip to all of the listeners on ...
import sys from twisted.python import log from twisted.web.server import Site from twisted.web.static import File from twisted.internet import task from twisted.internet.protocol import DatagramProtocol from . import utils class Broadcaster(DatagramProtocol): """ Broadcast the ip to all of the listeners on ...
Python
0.000129
923d49c753acf7d8945d6b79efbdb08363e130a2
Bring test_frame_of_test_null_file up to date with new signature of frame_of_test().
noseprogressive/tests/test_utils.py
noseprogressive/tests/test_utils.py
from os import chdir, getcwd from os.path import dirname, basename from unittest import TestCase from nose.tools import eq_ from noseprogressive.utils import human_path, frame_of_test class UtilsTests(TestCase): """Tests for independent little bits and pieces""" def test_human_path(self): chdir(dir...
from os import chdir, getcwd from os.path import dirname, basename from unittest import TestCase from nose.tools import eq_ from noseprogressive.utils import human_path, frame_of_test class UtilsTests(TestCase): """Tests for independent little bits and pieces""" def test_human_path(self): chdir(dir...
Python
0
0658a099a386791b3bde27f8e76c240253310890
Update pplot.py
src/analysis/pplot.py
src/analysis/pplot.py
#-*- coding:utf-8 -*- #!/usr/bin/python ''' This file is designed to plot the cost curve, maybe deprecated. author: iiiiiiiiiiii iiiiiiiiiiii !!!!!!! !!!!!! # ### # ### ### I# #: # ### # I...
#!/usr/bin/python # -*- coding:utf-8 -*- '''Result analysis for automatic speech recognition @Date:2016-4-9 @Author:zhang zewang ''' import os import matplotlib import matplotlib.pyplot as plt import numpy as np class Analysis(object): ''' class Analysis for ASR results ''' def __init__(self,logFile,sa...
Python
0.000002
ac5053ada316e46d4286b1944c2fb957c42c3975
truncate superfluous trailing zeros
durationpy/duration.py
durationpy/duration.py
# -*- coding: UTF-8 -*- import re import datetime _nanosecond_size = 1 _microsecond_size = 1000 * _nanosecond_size _millisecond_size = 1000 * _microsecond_size _second_size = 1000 * _millisecond_size _minute_size = 60 * _second_size _hour_size = 60 * _minute_size _day_size = 24 * _hour...
# -*- coding: UTF-8 -*- import re import datetime _nanosecond_size = 1 _microsecond_size = 1000 * _nanosecond_size _millisecond_size = 1000 * _microsecond_size _second_size = 1000 * _millisecond_size _minute_size = 60 * _second_size _hour_size = 60 * _minute_size _day_size = 24 * _hour...
Python
0.004364
d9800c562b81f4e118e9db96a68e301396af46f9
Add abstract job serializer
polyaxon/jobs/serializers.py
polyaxon/jobs/serializers.py
# -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function from rest_framework import serializers, fields from jobs.models import JobResources class JobResourcesSerializer(serializers.ModelSerializer): class Meta: model = JobResources exclude = ('id',) class JobS...
# -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function from rest_framework import serializers from jobs.models import JobResources class JobResourcesSerializer(serializers.ModelSerializer): class Meta: model = JobResources exclude = ('id',)
Python
0.003237
77c4b5a72ddad68717b6fb1291ce643f20a63e2d
Update SeleniumBase exceptions
seleniumbase/common/exceptions.py
seleniumbase/common/exceptions.py
""" SeleniumBase Exceptions NoSuchFileException => Called when self.assert_downloaded_file(...) fails. NotUsingChromeException => Used by Chrome-only methods if not using Chrome. OutOfScopeException => Used by BaseCase methods when setUp() is skipped. TextNotVisibleException => Called when expected text...
""" SeleniumBase Exceptions NoSuchFileException => Used by self.assert_downloaded_file(...) NotUsingChromeException => Used by Chrome-only methods if not using Chrome OutOfScopeException => Used by BaseCase methods when setUp() is skipped TimeLimitExceededException => Used by "--time-limit=SECONDS" """ ...
Python
0
e6af9d901f26fdf779a6a13319face483fe48a3b
Disable clickjacking protection on demos to display them in iframes
dwitter/dweet/views.py
dwitter/dweet/views.py
from django.shortcuts import get_object_or_404, render from django.http import HttpResponseRedirect, HttpResponse, Http404 from django.core.urlresolvers import reverse from django.contrib.auth.decorators import login_required from dwitter.models import Dweet from django.views.decorators.clickjacking import xframe_opti...
from django.shortcuts import get_object_or_404, render from django.http import HttpResponseRedirect, HttpResponse, Http404 from django.core.urlresolvers import reverse from django.contrib.auth.decorators import login_required from dwitter.models import Dweet def fullscreen_dweet(request, dweet_id): dweet = get_obje...
Python
0
2e72be703998b2d0d9fdc06bfffddccec8fb11e3
use rps balancing
scripts/cycler.py
scripts/cycler.py
#!/usr/bin/python from itertools import cycle import subprocess import time targetsize = 16 def start(): # subprocess.call("sudo gcloud components update --quiet", shell=True) # For completeness this should also create the backend, HTTP load balancer, template, and network # Get the available zones zones = s...
#!/usr/bin/python from itertools import cycle import subprocess import time targetsize = 16 def start(): # subprocess.call("sudo gcloud components update --quiet", shell=True) # For completeness this should also create the backend, HTTP load balancer, template, and network # Get the available zones zones = s...
Python
0
4d5a15a4a087ea8bcf458243da947f5e0934013b
Fix html not loading the initial value (#569)
src/blocks/widgets.py
src/blocks/widgets.py
from django import forms from wagtail.utils.widgets import WidgetWithScript class CodeMirrorWidget(WidgetWithScript, forms.Textarea): def render_js_init(self, id, name, value): js = """ document.addEventListener('DOMContentLoaded', function(){{ CodeMirror.fromTextArea( ...
from django import forms from wagtail.utils.widgets import WidgetWithScript class CodeMirrorWidget(WidgetWithScript, forms.Textarea): def render_js_init(self, id, name, value): js = """ CodeMirror.fromTextArea( document.getElementById("{id}"), {{ lineWrapping: true, ...
Python
0
84c07019572d8945bd2d4c7473c2b86c314107d0
Attempt to return better json
zpr.py
zpr.py
#!/var/lib/zpr/api/bin/python import json import lib_zpr #import logging #from logging.handlers import RotatingFileHandler from flask import Flask, jsonify, make_response app = Flask(__name__) # app.logger.setLevel(logging.INFO) # app.logger.disabled = False # handler = logging.handlers.RotatingFileHandler( # '...
#!/var/lib/zpr/api/bin/python import json import lib_zpr #import logging #from logging.handlers import RotatingFileHandler from flask import Flask, jsonify, make_response app = Flask(__name__) # app.logger.setLevel(logging.INFO) # app.logger.disabled = False # handler = logging.handlers.RotatingFileHandler( # '...
Python
0.999868
938d255db088ff721e69659db1afdd5cfa109c3f
Save temp as C and F
webapp/app/views/api/v1/points.py
webapp/app/views/api/v1/points.py
import time from flask import request, abort from app.views.api.v1 import APIView_v1 class PointsParser(object): def __init__(self, data): self.points = [] self.interval = None self.state = 'root' lines = map(lambda l: l.split(), filter(None, map(str.strip, data.split('\n')))) ...
import time from flask import request, abort from app.views.api.v1 import APIView_v1 class PointsParser(object): def __init__(self, data): self.points = [] self.interval = None self.state = 'root' lines = map(lambda l: l.split(), filter(None, map(str.strip, data.split('\n')))) ...
Python
0.000001
a9bf968facd2a89017ef258e5afead093d1054f7
add method execute
CURD.py
CURD.py
# coding=utf8 # Permission to use, copy, modify, # and distribute this software for any purpose with # or without fee is hereby granted, # provided that the above copyright notice # and this permission notice appear in all copies. # """ CURD.py ~~~~~~~ Tiny Python ORM for MySQL :Author: Hit9 :Emai...
# coding=utf8 # Permission to use, copy, modify, # and distribute this software for any purpose with # or without fee is hereby granted, # provided that the above copyright notice # and this permission notice appear in all copies. # """ CURD.py ~~~~~~~ Tiny Python ORM for MySQL :Author: Hit9 :Emai...
Python
0.000005
452899e183c6a8dcb2e7eb10a34a9a560e99145f
test problems
basic_cms/tests/test_api.py
basic_cms/tests/test_api.py
"""Django page CMS functionnal tests suite module.""" from basic_cms.models import Page from basic_cms.tests.testcase import TestCase import json from django.template.loader import render_to_string from django.core.urlresolvers import reverse class CMSPagesApiTests(TestCase): fixtures = ['pages_tests.json', 'ap...
"""Django page CMS functionnal tests suite module.""" from basic_cms.models import Page from basic_cms.tests.testcase import TestCase import json from django.template.loader import render_to_string from django.core.urlresolvers import reverse class CMSPagesApiTests(TestCase): fixtures = ['pages_tests.json', 'ap...
Python
0.000011
c358f467bbab9bd0366347f9a1bd10cb2e027bb8
use moksha widget template
fedoracommunity/mokshaapps/packagemaintresource/controllers/root.py
fedoracommunity/mokshaapps/packagemaintresource/controllers/root.py
from moksha.lib.base import Controller from moksha.lib.helpers import MokshaApp from tg import expose, tmpl_context from fedoracommunity.widgets import SubTabbedContainer class TabbedNav(SubTabbedContainer): tabs= (MokshaApp('Overview', 'fedoracommunity.packagemaint.overview'), MokshaApp('Builds', 'fedo...
from moksha.lib.base import Controller from moksha.lib.helpers import MokshaApp from tg import expose, tmpl_context from fedoracommunity.widgets import SubTabbedContainer class TabbedNav(SubTabbedContainer): tabs= (MokshaApp('Overview', 'fedoracommunity.packagemaint.overview'), MokshaApp('Builds', 'fedo...
Python
0
367b28277b03473e6453ad9aa26c734136db4105
use compound dimensions
ktbh/modelling.py
ktbh/modelling.py
import json class AutoModellingException(Exception): pass def make_model(amount_field, date_field, fields): currency = "GBP" dataset_name = "new-dataset" description = "Dataset description" label = "Dataset label" dataset = { "description": description, "temporal_granularity": "d...
import json class AutoModellingException(Exception): pass def make_model(amount_field, date_field, fields): currency = "GBP" dataset_name = "new-dataset" description = "Dataset description" label = "Dataset label" dataset = { "description": description, "temporal_granularity": "d...
Python
0.000001
5b6aa3f6cca7ea83a53178be7b9e58892597ac0b
Add some logging to Auth
opwen_email_server/services/auth.py
opwen_email_server/services/auth.py
from abc import ABCMeta from abc import abstractmethod from functools import lru_cache from typing import Callable from typing import Optional from azure.storage.table import TableService from opwen_email_server.utils.log import LogMixin class Auth(metaclass=ABCMeta): @abstractmethod def domain_for(self, cl...
from abc import ABCMeta from abc import abstractmethod from functools import lru_cache from typing import Callable from typing import Optional from azure.storage.table import TableService class Auth(metaclass=ABCMeta): @abstractmethod def domain_for(self, client_id: str) -> Optional[str]: raise NotIm...
Python
0.000001
4b2a29c484ddd5e2dfb4ad91bb0ae5c7681553c1
Bump version to 0.1.5
lacrm/_version.py
lacrm/_version.py
__version_info__ = (0, 1, 5) __version__ = '.'.join(map(str, __version_info__))
__version_info__ = (0, 1, 4) __version__ = '.'.join(map(str, __version_info__))
Python
0.000001
0cdac10ee51cc3e812ae9188606301e6be0644ee
Fix default url bug
web/project/main/urls.py
web/project/main/urls.py
from django.conf.urls import url, include from rest_framework.authtoken import views as authviews from rest_framework_jwt import views as jwt_views from . import views urlpatterns = [ url(r'^home/', views.index, name='index'), # Authentication APIs url(r'^api/auth', jwt_views.obtain_jwt_token, name="auth")...
from django.conf.urls import url, include from rest_framework.authtoken import views as authviews from rest_framework_jwt import views as jwt_views from . import views urlpatterns = [ url(r'', views.index, name='index'), url(r'^home/', views.index, name='index'), # Authentication APIs url(r'^api/auth',...
Python
0.000003
9f7837f572017a4a8176c4e74b0aaba0625905ed
Add support for custom import apps
parachute/management/commands/import_from.py
parachute/management/commands/import_from.py
import logging from optparse import make_option from django.db.models.loading import load_app from django.core.management.base import LabelCommand class Command(LabelCommand): import_app = 'parachute' option_list = LabelCommand.option_list + ( make_option('--database', dest='database', ...
import logging from optparse import make_option from django.db.models.loading import load_app from django.core.management.base import LabelCommand class Command(LabelCommand): import_app = 'importer' option_list = LabelCommand.option_list + ( make_option('--importer', dest='force_update'...
Python
0
27a39812088b9312314b44a013483b49a77d8dfb
update set of modules to install for pyquickhelper
src/pymyinstall/packaged/packaged_config_0_pyquickhelper.py
src/pymyinstall/packaged/packaged_config_0_pyquickhelper.py
#-*- coding: utf-8 -*- """ @file @brief Defines different a set of usual modules for Python. """ import sys def pyquickhelper_set(): """ list of modules needed to run unit test of module *pyquickhelper* """ names = [ "alabaster", "autopep8", "babel", "certifi", ...
#-*- coding: utf-8 -*- """ @file @brief Defines different a set of usual modules for Python. """ import sys def pyquickhelper_set(): """ list of modules needed to run unit test of module *pyquickhelper* """ names = [ "alabaster", "autopep8", "babel", "certifi", ...
Python
0
ba73e1e06dae26716da29a02c1705458d402a9be
update PRISM model to take CDDs into account for electricity
eemeter/meter/prism.py
eemeter/meter/prism.py
from eemeter.meter.base import MeterBase from eemeter.config.yaml_parser import load class PRISMMeter(MeterBase): """Implementation of Princeton Scorekeeping Method. """ def __init__(self,**kwargs): super(self.__class__, self).__init__(**kwargs) self.meter = load(self._meter_yaml()) d...
from eemeter.meter.base import MeterBase from eemeter.config.yaml_parser import load class PRISMMeter(MeterBase): """Implementation of Princeton Scorekeeping Method. """ def __init__(self,**kwargs): super(self.__class__, self).__init__(**kwargs) self.meter = load(self._meter_yaml()) d...
Python
0
9e0c83e751e72e3396a4729392b972834b25c8b7
Add TODO
v2/aws_secgroup_ids_from_names.py
v2/aws_secgroup_ids_from_names.py
# (c) 2015, Jon Hadfield <jon@lessknown.co.uk> """ Description: This lookup takes an AWS region and a list of one or more security Group Names and returns a list of matching security Group IDs. Example Usage: {{ lookup('aws_secgroup_ids_from_names', ('eu-west-1', ['nginx_group', 'mysql_group'])) }} """ from __future_...
# (c) 2015, Jon Hadfield <jon@lessknown.co.uk> """ Description: This lookup takes an AWS region and a list of one or more security Group Names and returns a list of matching security Group IDs. Example Usage: {{ lookup('aws_secgroup_ids_from_names', ('eu-west-1', ['nginx_group', 'mysql_group'])) }} """ from __future_...
Python
0.000002
0c731bf993eea346421d9dbcd5eaa61484e84018
fix bug in site_hrn()
sfa/util/plxrn.py
sfa/util/plxrn.py
# specialized Xrn class for PlanetLab import re from sfa.util.xrn import Xrn # temporary helper functions to use this module instead of namespace def hostname_to_hrn (auth, login_base, hostname): return PlXrn(auth=auth+'.'+login_base,hostname=hostname).get_hrn() def hostname_to_urn(auth, login_base, hostname): ...
# specialized Xrn class for PlanetLab import re from sfa.util.xrn import Xrn # temporary helper functions to use this module instead of namespace def hostname_to_hrn (auth, login_base, hostname): return PlXrn(auth=auth+'.'+login_base,hostname=hostname).get_hrn() def hostname_to_urn(auth, login_base, hostname): ...
Python
0
1337c5269d97dc6f1cd47aed838cf26c6b488be2
bump version
shell/__init__.py
shell/__init__.py
#!/usr/bin/env python # -*- coding:utf-8 -*- __title__ = 'shell' __version__ = '0.0.7' __author__ = 'Qingping Hou' __license__ = 'MIT' from .run_cmd import RunCmd from .input_stream import InputStream from .api import instream, cmd, pipe_all, ex, p, ex_all
#!/usr/bin/env python # -*- coding:utf-8 -*- __title__ = 'shell' __version__ = '0.0.6' __author__ = 'Qingping Hou' __license__ = 'MIT' from .run_cmd import RunCmd from .input_stream import InputStream from .api import instream, cmd, pipe_all, ex, p, ex_all
Python
0
5873bb323d21ab8f9373518a5dd9688df4b38a9a
Break line before 80 columns.
shell/src/main.py
shell/src/main.py
# -*- coding: utf-8 -*- # Copyright (c) 2010-2014, MIT Probabilistic Computing Project # # 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/LICENS...
# -*- coding: utf-8 -*- # Copyright (c) 2010-2014, MIT Probabilistic Computing Project # # 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/LICENS...
Python
0.000001
3ccd648ba58fd7e6a84b94e464094d0c5e3a8e55
Add line to separate results
states/bootstrap/bootstrap.dir/modules/utils/salt_output.py
states/bootstrap/bootstrap.dir/modules/utils/salt_output.py
#!/usr/bin/env python # import sys import yaml import logging ############################################################################### def load_yaml_file_data(file_path): """ Load YAML formated data from file_path. """ # Instead of using `with` keyword, perform standard `try`/`finally` ...
#!/usr/bin/env python # import sys import yaml import logging ############################################################################### def load_yaml_file_data(file_path): """ Load YAML formated data from file_path. """ # Instead of using `with` keyword, perform standard `try`/`finally` ...
Python
0
21ab430368ee262377c77f1ecc24b645377dd520
Revert "Bug Fix: sort keys when creating json data to send"
generic_request_signer/client.py
generic_request_signer/client.py
import six from datetime import date import json import decimal if six.PY3: import urllib.request as urllib else: import urllib2 as urllib from generic_request_signer import response, factory def json_encoder(obj): if isinstance(obj, date): return str(obj.isoformat()) if isinstance(obj, deci...
import six from datetime import date import json import decimal from apysigner import DefaultJSONEncoder if six.PY3: import urllib.request as urllib else: import urllib2 as urllib from generic_request_signer import response, factory def json_encoder(obj): if isinstance(obj, date): return str(ob...
Python
0
67dfbfa250cd5de550a493c9951d456e05b05454
Make ModelImporter.model static for flexibility of usage
girder/utility/model_importer.py
girder/utility/model_importer.py
#!/usr/bin/env python # -*- coding: utf-8 -*- ############################################################################### # Copyright 2013 Kitware 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 cop...
#!/usr/bin/env python # -*- coding: utf-8 -*- ############################################################################### # Copyright 2013 Kitware 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 cop...
Python
0
b28ca4abf8a6986b96bfb89cf8737c8f737fee4e
update boto import to use boto3 (#1000)
global_settings/wagtail_hooks.py
global_settings/wagtail_hooks.py
import boto3 import wagtail.admin.rich_text.editors.draftail.features as draftail_features from wagtail.admin.rich_text.converters.html_to_contentstate import InlineStyleElementHandler from wagtail.core import hooks from django.urls import reverse from wagtail.admin.menu import MenuItem from .models import CloudfrontD...
import boto import wagtail.admin.rich_text.editors.draftail.features as draftail_features from wagtail.admin.rich_text.converters.html_to_contentstate import InlineStyleElementHandler from wagtail.core import hooks from django.urls import reverse from wagtail.admin.menu import MenuItem from .models import CloudfrontDi...
Python
0
c437074ee3ee15fc29790ca4de5413bbdd19728c
delete unused imports
autograd/convenience_wrappers.py
autograd/convenience_wrappers.py
"""Convenience functions built on top of `grad`.""" from __future__ import absolute_import import autograd.numpy as np from autograd.core import grad, getval def multigrad(fun, argnums=0): """Takes gradients wrt multiple arguments simultaneously.""" original_fun = fun def combined_arg_fun(multi_arg, *arg...
"""Convenience functions built on top of `grad`.""" from __future__ import absolute_import import itertools as it import autograd.numpy as np from autograd.core import grad, getval from builtins import map def multigrad(fun, argnums=0): """Takes gradients wrt multiple arguments simultaneously.""" original_fu...
Python
0.000001
550133348a09b197025bc1352439cb055bf50c7b
Make sure mocks in place for setUp command.
autopush/tests/test_websocket.py
autopush/tests/test_websocket.py
import json import twisted.internet.base from mock import Mock from moto import mock_dynamodb2 from txstatsd.metrics.metrics import Metrics from twisted.internet import reactor from twisted.internet.defer import Deferred from twisted.trial import unittest from autopush.settings import AutopushSettings from autopush.w...
import json import twisted.internet.base from mock import Mock from moto import mock_dynamodb2 from txstatsd.metrics.metrics import Metrics from twisted.internet import reactor from twisted.internet.defer import Deferred from twisted.trial import unittest from autopush.settings import AutopushSettings from autopush.w...
Python
0
009ab26737923cfff97ba37a035dcff7639135b1
Replace all_pages_in_directory with concat_pdf_pages
Util.py
Util.py
"""Collection of Helper Functions""" import os from fnmatch import fnmatch from PyPDF2 import PdfFileReader def pdf_file(filename): """Test whether or the the filename ends with '.pdf'.""" return fnmatch(filename, '*.pdf') def all_pdf_files_in_directory(path): """Return a list of of PDF files in a dire...
"""Collection of Helper Functions""" import os from fnmatch import fnmatch from PyPDF2 import PdfFileReader def pdf_file(filename): """Test whether or the the filename ends with '.pdf'.""" return fnmatch(filename, '*.pdf') def all_pdf_files_in_directory(path): """Return a list of of PDF files in a dire...
Python
0
d16373609b2f30c6ffa576c1269c529f12c9622c
Switch to fast method for personal timetable
backend/uclapi/timetable/urls.py
backend/uclapi/timetable/urls.py
from django.conf.urls import url from . import views urlpatterns = [ url(r'^personal$', views.get_personal_timetable_fast), url(r'^bymodule$', views.get_modules_timetable), ]
from django.conf.urls import url from . import views urlpatterns = [ url(r'^personal_fast$', views.get_personal_timetable_fast), url(r'^personal$', views.get_personal_timetable), url(r'^bymodule$', views.get_modules_timetable), ]
Python
0
22785c709956365ac51bc3b79135e6debc6418ae
Exclude legacy objc API tests properly.
all.gyp
all.gyp
# Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. # # Use of this source code is governed by a BSD-style license # that can be found in the LICENSE file in the root of the source # tree. An additional intellectual property rights grant can be found # in the file PATENTS. All contributing project au...
# Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. # # Use of this source code is governed by a BSD-style license # that can be found in the LICENSE file in the root of the source # tree. An additional intellectual property rights grant can be found # in the file PATENTS. All contributing project au...
Python
0.000026
f6e6c10fe3a83be491eae7d1b675be0f49e639b6
add key_watcher
MellPlayer/mell_controller.py
MellPlayer/mell_controller.py
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' Netease Music MellController Created on 2017-02-21 @author: Mellcap ''' import threading import time import queue import getch import ui import player from directory import create_directory CONFIG = { # 主页 'q': 'quit', 'j': 'next_line', 'k': 'prev_l...
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' Netease Music MellController Created on 2017-02-21 @author: Mellcap ''' import threading import time import getch import ui import player from directory import create_directory CONFIG = { # 主页 'q': 'quit', 'j': 'next_line', 'k': 'prev_line', # 音...
Python
0.000002
127434cdc04ae3655747ff1e3530148404dbf849
fix flush
blaz.py
blaz.py
from os import environ, chdir, getenv from os.path import abspath, basename, dirname from subprocess import check_call from sys import argv from colors import bold from hashlib import md5 import sys class Blaz(object): def __init__(self, **kwargs): self.__dict__ = kwargs self.file = abspath(argv[0...
from os import environ, chdir, getenv from os.path import abspath, basename, dirname from subprocess import check_call from sys import argv from colors import bold from hashlib import md5 import sys class Blaz(object): def __init__(self, **kwargs): self.__dict__ = kwargs self.file = abspath(argv[0...
Python
0.000001
bb679edf2b7030de07e3d3688327c5e13851232e
Troubleshoot CI
kevlar/__init__.py
kevlar/__init__.py
#!/usr/bin/env python # # ----------------------------------------------------------------------------- # Copyright (c) 2016 The Regents of the University of California # # This file is part of kevlar (http://github.com/dib-lab/kevlar) and is # licensed under the MIT license: see LICENSE. # ----------------------------...
#!/usr/bin/env python # # ----------------------------------------------------------------------------- # Copyright (c) 2016 The Regents of the University of California # # This file is part of kevlar (http://github.com/dib-lab/kevlar) and is # licensed under the MIT license: see LICENSE. # ----------------------------...
Python
0.000001
c46e2053c0c093c2ee82f13f48787584d48664af
Fix reorder unit test for Django 1.8
shuup_tests/front/test_reorder.py
shuup_tests/front/test_reorder.py
# -*- coding: utf-8 -*- # This file is part of Shuup. # # Copyright (c) 2012-2018, Shuup Inc. All rights reserved. # # This source code is licensed under the OSL-3.0 license found in the # LICENSE file in the root directory of this source tree. import pytest from django.core.urlresolvers import reverse from django.tes...
# -*- coding: utf-8 -*- # This file is part of Shuup. # # Copyright (c) 2012-2018, Shuup Inc. All rights reserved. # # This source code is licensed under the OSL-3.0 license found in the # LICENSE file in the root directory of this source tree. import pytest from django.core.urlresolvers import reverse from django.tes...
Python
0.000002
8092ac34f95280adf884336999b481ef5241c2cb
update data container description to make sure that scalar values are returned as scalar
simphony/scripts/cuba-generate.py
simphony/scripts/cuba-generate.py
import click import yaml # Cuba keywords that are excludes from DataContainers CUBA_DATA_CONTAINER_EXLCUDE = ['Id', 'Position'] @click.group() def cli(): """ Auto-generate code from cuba yaml description. """ @cli.command() @click.argument('input', type=click.File('rb')) @click.argument('output', type=click.Fi...
import click import yaml # Cuba keywords that are excludes from DataContainers CUBA_DATA_CONTAINER_EXLCUDE = ['Id', 'Position'] @click.group() def cli(): """ Auto-generate code from cuba yaml description. """ @cli.command() @click.argument('input', type=click.File('rb')) @click.argument('output', type=click.Fi...
Python
0.000001
3159f3fa6d4d055e8a53a0b4f1d798397cc3c3a3
The alteration of the context has no effect
base_report_to_printer/report.py
base_report_to_printer/report.py
# -*- coding: utf-8 -*- ############################################################################## # # Author: Guewen Baconnier # Copyright 2014 Camptocamp SA # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # pu...
# -*- coding: utf-8 -*- ############################################################################## # # Author: Guewen Baconnier # Copyright 2014 Camptocamp SA # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # pu...
Python
0.999999
e89e721225e916f4c2514f4a6568571abfc2acc0
Add slides frame simibar
lib/plotter/matching/__init__.py
lib/plotter/matching/__init__.py
__all__ = ["core", "single_matching_plotter"] from lib.exp.evaluator.ground_truth import GroundTruth as GT from core import MatchingPlotterBase class MatchingPlotter(MatchingPlotterBase): def __init__(self, root, name): """ Try to show one matching pairs use set_data to set matched result...
__all__ = ["core", "single_matching_plotter"] from core import MatchingPlotterBase class MatchingPlotter(MatchingPlotterBase): def __init__(self, root, name): """ Try to show one matching pairs use set_data to set matched results: array of `sid`, `fid`, `matches` """ ...
Python
0
95b08f0cb82fa376a6f07d5395bcba343a131dea
update labels
plantcv/plantcv/hyperspectral/analyze_spectral.py
plantcv/plantcv/hyperspectral/analyze_spectral.py
# Analyze signal data in Thermal image import os import numpy as np import pandas as pd from plantcv.plantcv import params from plantcv.plantcv import outputs from plotnine import ggplot, aes, geom_line, scale_x_continuous def analyze_spectral(array, header_dict, mask, histplot=True): """This extracts the hypers...
# Analyze signal data in Thermal image import os import numpy as np import pandas as pd from plantcv.plantcv import params from plantcv.plantcv import outputs from plotnine import ggplot, aes, geom_line, scale_x_continuous def analyze_spectral(array, header_dict, mask, histplot=True): """This extracts the hypers...
Python
0.000001
cd59979ab446d7613ec7df5d5737539464918edf
Fix span boundary handling in Spanish noun_chunks (#5860)
spacy/lang/es/syntax_iterators.py
spacy/lang/es/syntax_iterators.py
# coding: utf8 from __future__ import unicode_literals from ...symbols import NOUN, PROPN, PRON, VERB, AUX from ...errors import Errors def noun_chunks(doclike): doc = doclike.doc if not doc.is_parsed: raise ValueError(Errors.E029) if not len(doc): return np_label = doc.vocab.string...
# coding: utf8 from __future__ import unicode_literals from ...symbols import NOUN, PROPN, PRON, VERB, AUX from ...errors import Errors def noun_chunks(doclike): doc = doclike.doc if not doc.is_parsed: raise ValueError(Errors.E029) if not len(doc): return np_label = doc.vocab.string...
Python
0
d07b48c018d8edf5c8dc3689e22a0c4e551f79a7
Add single file output option
cube.py
cube.py
#!/usr/bin/env python import numpy as np from scipy import ndimage, misc import sys, math, os import argparse parser = argparse.ArgumentParser(description='Turn a panorama image into a cube map (6 images)') parser.add_argument("--size", default=512, type=int, help="Size of output image sides") parser.add_argument("-...
#!/usr/bin/env python import numpy as np from scipy import ndimage, misc import sys, math, os import argparse parser = argparse.ArgumentParser(description='Turn a panorama image into a cube map (6 images)') parser.add_argument("--size", default=512, type=int, help="Size of output image sides") parser.add_argument("-...
Python
0.000004
75cb305c025ca3549c721faacb5ea51297c80052
Use GitPython
buster.py
buster.py
"""Ghost Buster. Static site generator for Ghost. Usage: buster.py generate [--domain=<local-address>] [--dir=<path>] buster.py preview [--dir=<path>] buster.py setup [--gh-repo=<repo-url>] [--dir=<path>] buster.py deploy [--dir=<path>] buster.py (-h | --help) buster.py --version Options: -h --help ...
"""Ghost Buster. Static site generator for Ghost. Usage: buster.py generate [--domain=<local-address>] buster.py preview buster.py setup [--gh-repo=<repo-url>] buster.py deploy buster.py (-h | --help) buster.py --version Options: -h --help Show this screen. --version Sh...
Python
0.000001
a0afdc5f38c237918b2bb6906c977e83ba1574a0
allow to define a mandatory output extension
carpet.py
carpet.py
import tempfile import os class TempFileContext: remove_at_exit = True removable_files = [] """ Base class to create 'with' contexts. The __init__ method must define: - self.removable_files <list>. This list will hold a list of filenames which will removed at the end of the contex...
import tempfile import os class TempFileContext: remove_at_exit = True removable_files = [] """ Base class to create 'with' contexts. The __init__ method must define: - self.removable_files <list>. This list will hold a list of filenames which will removed at the end of the contex...
Python
0.000001
db67db3cea880e40d1982149fea86699c15b5f75
change append to add (for the set in part 1)
day3.py
day3.py
#!/usr/local/bin/python3 from collections import namedtuple with open('day3_input.txt') as f: instructions = f.read().rstrip() Point = namedtuple('Point', ['x', 'y']) location = Point(0, 0) visited = {location} def new_loc(current_loc, instruction): if instruction == '^': xy = current_loc.x, curren...
#!/usr/local/bin/python3 from collections import namedtuple with open('day3_input.txt') as f: instructions = f.read().rstrip() Point = namedtuple('Point', ['x', 'y']) location = Point(0, 0) visited = {location} def new_loc(current_loc, instruction): if instruction == '^': xy = current_loc.x, curren...
Python
0
db713e62eafb29c1a968e16b997a4e8f49156c78
Correct config for touchscreen
config.py
config.py
__author__ = 'Florian' from util import get_lan_ip ################# # CONFIGURATION # ################# # CHANGE FROM HERE # UDP_PORT = 18877 IP = get_lan_ip() BUF_SIZE = 4096 TIMEOUT_IN_SECONDS = 0.1 # SCREEN_WIDTH = 320 SCREEN_HEIGHT = 240 SCREEN_DEEP = 32 # LABEL_RIGHT = 0 LABEL_LEFT = 1 ALIGN_CENTER = 0 ALIG...
__author__ = 'Florian' from util import get_lan_ip ################# # CONFIGURATION # ################# # CHANGE FROM HERE # UDP_PORT = 18877 IP = get_lan_ip() BUF_SIZE = 4096 TIMEOUT_IN_SECONDS = 0.1 # SCREEN_WIDTH = 320 SCREEN_HEIGHT = 240 SCREEN_DEEP = 32 # LABEL_RIGHT = 0 LABEL_LEFT = 1 ALIGN_CENTER = 0 ALIG...
Python
0.000002
68593e359d5bb79c096d584c83df1ff55262a686
use with
config.py
config.py
# coding=utf-8 from configparser import ConfigParser import os __author__ = 'Victor Häggqvist' class Config: confdir = os.path.dirname(os.path.realpath(__file__)) config_file = os.path.join(confdir, 'ledman.conf') default = """ [gpio] red=22 green=27 blue=17 [default_level] red=0 green=0.3 blue=0.5 [se...
# coding=utf-8 from configparser import ConfigParser import os __author__ = 'Victor Häggqvist' class Config: confdir = os.path.dirname(os.path.realpath(__file__)) config_file = os.path.join(confdir, 'ledman.conf') default = """ [gpio] red=22 green=27 blue=17 [default_level] red=0 green=0.3 blue=0.5 [se...
Python
0
0812ec319291b709613152e9e1d781671047a428
Make server ignore missing environment variables
config.py
config.py
import os SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL', 'sqlite://') ACCESS_TOKEN = os.environ.get('ACCESS_TOKEN') PAGE_ID = os.environ.get('PAGE_ID') APP_ID = os.environ.get('APP_ID') VERIFY_TOKEN = os.environ.get('VERIFY_TOKEN')
import os SQLALCHEMY_DATABASE_URI = os.environ['DATABASE_URL'] ACCESS_TOKEN = os.environ['ACCESS_TOKEN'] PAGE_ID = os.environ['PAGE_ID'] APP_ID = os.environ['APP_ID'] VERIFY_TOKEN = os.environ['VERIFY_TOKEN']
Python
0
d7e03596f8bf1e886e984c0ea98334af878a15e2
Use __future__.print_function so syntax is valid on Python 3
meta/bytecodetools/print_code.py
meta/bytecodetools/print_code.py
''' Created on May 10, 2012 @author: sean ''' from __future__ import print_function from .bytecode_consumer import ByteCodeConsumer from argparse import ArgumentParser class ByteCodePrinter(ByteCodeConsumer): def generic_consume(self, instr): print(instr) def main(): parser = ArgumentParser() ...
''' Created on May 10, 2012 @author: sean ''' from .bytecode_consumer import ByteCodeConsumer from argparse import ArgumentParser class ByteCodePrinter(ByteCodeConsumer): def generic_consume(self, instr): print instr def main(): parser = ArgumentParser() parser.add_argument() if __name__ ==...
Python
0.9985
1f343e52abb67ab2f85836b10dadb3cb34a95379
fix login issue with django 1.7: check_for_test_cookie is deprecated and removed in django 1.7.
xadmin/forms.py
xadmin/forms.py
from django import forms from django.contrib.auth import authenticate from django.contrib.auth.forms import AuthenticationForm from django.utils.translation import ugettext_lazy, ugettext as _ from xadmin.util import User ERROR_MESSAGE = ugettext_lazy("Please enter the correct username and password " ...
from django import forms from django.contrib.auth import authenticate from django.contrib.auth.forms import AuthenticationForm from django.utils.translation import ugettext_lazy, ugettext as _ from xadmin.util import User ERROR_MESSAGE = ugettext_lazy("Please enter the correct username and password " ...
Python
0
55dec7060ff988468499dbce1f2c56c65f2f4f81
Add support for running from CLI without Gtk
zram-monitor.py
zram-monitor.py
#!/usr/bin/env python import os import psutil import sys try: from gi.repository import Gtk, GLib from gi.repository import AppIndicator3 as appindicator gtk = True except ImportError: gtk = False def sizeof_fmt(num): for x in ['bytes', 'KB', 'MB', 'GB']: if num < 1024.0 and num > -1024.0: ...
#!/usr/bin/env python import os import psutil import sys from gi.repository import Gtk, GLib from gi.repository import AppIndicator3 as appindicator def sizeof_fmt(num): for x in ['bytes', 'KB', 'MB', 'GB']: if num < 1024.0 and num > -1024.0: return "%3.1f%s" % (num, x) num /= 1024.0 ...
Python
0
19e59e90cd44f6375d81c971bb5005efc1165a08
Fix security issue in filter_non_video_iframes
website/utils/filters.py
website/utils/filters.py
def filter_non_video_iframes(html, testing = False): """ Given an HTML string, strips iframe tags that do not (just) contain an embedded video. Returns the remaining HTML string. """ from bs4 import BeautifulSoup import re # Tuple of regexes that define allowed URL patterns ma...
def filter_non_video_iframes(html, testing = False): """ Given an HTML string, strips iframe tags that do not (just) contain an embedded video. Returns the remaining HTML string. """ from bs4 import BeautifulSoup import re # Tuple of regexes that define allowed URL patterns ma...
Python
0.000001
f99246cb8a41f9271d4d531c036975c9d105d973
Add ignored exceptions
polyaxon/polyaxon/config_settings/logging.py
polyaxon/polyaxon/config_settings/logging.py
import os from polyaxon.config_manager import ROOT_DIR, config LOG_DIRECTORY = ROOT_DIR.child('logs') if not os.path.exists(LOG_DIRECTORY): os.makedirs(LOG_DIRECTORY) LOGGING = { 'version': 1, 'disable_existing_loggers': False, 'formatters': { 'standard': { 'format': '[%(asctime)...
import os from polyaxon.config_manager import ROOT_DIR, config LOG_DIRECTORY = ROOT_DIR.child('logs') if not os.path.exists(LOG_DIRECTORY): os.makedirs(LOG_DIRECTORY) LOGGING = { 'version': 1, 'disable_existing_loggers': False, 'formatters': { 'standard': { 'format': '[%(asctime)...
Python
0.000032
54282058900b473b1e1211f8e0b68c1d36280788
Fix investigations if no user input
core/web/frontend/investigations.py
core/web/frontend/investigations.py
from __future__ import unicode_literals from flask_classy import route from flask_login import current_user from flask import render_template, request, flash, redirect, url_for from mongoengine import DoesNotExist from core.web.frontend.generic import GenericView from core.investigation import Investigation, ImportMe...
from __future__ import unicode_literals from flask_classy import route from flask_login import current_user from flask import render_template, request, flash, redirect, url_for from mongoengine import DoesNotExist from core.web.frontend.generic import GenericView from core.investigation import Investigation, ImportMe...
Python
0.014118
7b6542d58bbe788587b47e282ef393eda461f267
add get method in UserAPI
api/route/user.py
api/route/user.py
from flask import request from flask.ext import restful from flask.ext.restful import marshal_with from route.base import api from flask.ext.bcrypt import generate_password_hash from model.base import db from model.user import User, user_marshaller class UserAPI(restful.Resource): @marshal_with(user_marshaller) ...
from flask import request from flask.ext import restful from flask.ext.restful import marshal_with from route.base import api from flask.ext.bcrypt import generate_password_hash from model.base import db from model.user import User, user_marshaller class UserAPI(restful.Resource): @marshal_with(user_marshaller) ...
Python
0.000001
346a7d18ef6dc063e2802a0347709700a1543902
update 影视列表
1/showics/models.py
1/showics/models.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Last modified: Wang Tai (i@wangtai.me) """docstring """ __revision__ = '0.1' from django.db import models class ShowTableIcs(models.Model): uid = models.CharField(max_length=255, unique=True, primary_key=True) title = models.CharField(max_length=255, null=Fal...
#!/usr/bin/env python # -*- coding: utf-8 -*- # Last modified: Wang Tai (i@wangtai.me) """docstring """ __revision__ = '0.1' from django.db import models class ShowTableIcs(models.Model): # uid uid = models.CharField(max_length=255, unique=True, primary_key=True) # title title = models.CharField(ma...
Python
0
5b2cc6ed06045bbe219f9cf81317c1c1a5bac714
add missing docstring in ttls
biggraphite/drivers/ttls.py
biggraphite/drivers/ttls.py
#!/usr/bin/env python # Copyright 2016 Criteo # # 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 agree...
#!/usr/bin/env python # Copyright 2016 Criteo # # 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 agree...
Python
0.000007
808a5b14fc0bfff8d8c23cb4e1f125ef84de6d91
Remove deprecated oslotest.mockpatch usage
bilean/tests/common/base.py
bilean/tests/common/base.py
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed unde...
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed unde...
Python
0.000006
c1d35c37bb51943c28f58b4dc8005b775b7076c4
Clean the terp file
bin/addons/base/__terp__.py
bin/addons/base/__terp__.py
# -*- encoding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved # $Id$ # # This program is free software: you can redistribute it and/or modify # ...
# -*- encoding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved # $Id$ # # This program is free software: you can redistribute it and/or modify # ...
Python
0
ca5c3648ad5f28090c09ecbbc0e008c51a4ce708
Add a new dev (optional) parameter and use it
bin/push/silent_ios_push.py
bin/push/silent_ios_push.py
import json import logging import argparse import emission.net.ext_service.push.notify_usage as pnu if __name__ == '__main__': logging.basicConfig(level=logging.DEBUG) parser = argparse.ArgumentParser(prog="silent_ios_push") parser.add_argument("interval", help="specify the sync interval that the ...
import json import logging import argparse import emission.net.ext_service.push.notify_usage as pnu if __name__ == '__main__': logging.basicConfig(level=logging.DEBUG) parser = argparse.ArgumentParser(prog="silent_ios_push") parser.add_argument("interval", help="specify the sync interval that the ...
Python
0.000001
a33b8222959cc14a4c89658e6d7aa6ff07f27c0c
remove commented code
ephypype/import_ctf.py
ephypype/import_ctf.py
"""Import ctf.""" # -------------------- nodes (Function) def convert_ds_to_raw_fif(ds_file): """CTF .ds to .fif and save result in pipeline folder structure.""" import os import os.path as op from nipype.utils.filemanip import split_filename as split_f from mne.io import read_raw_ctf _, bas...
"""Import ctf.""" # -------------------- nodes (Function) def convert_ds_to_raw_fif(ds_file): """CTF .ds to .fif and save result in pipeline folder structure.""" import os import os.path as op from nipype.utils.filemanip import split_filename as split_f from mne.io import read_raw_ctf _, bas...
Python
0
697d3c4c80574d82e8aa37e2a13cbaeefdad255c
bump version
kuyruk/__init__.py
kuyruk/__init__.py
from __future__ import absolute_import import logging from kuyruk.kuyruk import Kuyruk from kuyruk.worker import Worker from kuyruk.task import Task from kuyruk.config import Config __version__ = '0.13.2' try: # not available in python 2.6 from logging import NullHandler except ImportError: class NullHan...
from __future__ import absolute_import import logging from kuyruk.kuyruk import Kuyruk from kuyruk.worker import Worker from kuyruk.task import Task from kuyruk.config import Config __version__ = '0.13.1' try: # not available in python 2.6 from logging import NullHandler except ImportError: class NullHan...
Python
0
50b189888a0ff68f1cc4db1615991d1afe364854
Update cigar_party.py
Python/Logic_1/cigar_party.py
Python/Logic_1/cigar_party.py
# When squirrels get together for a party, they like to have cigars. A squirrel # party is successful when the number of cigars is between 40 and 60, inclusive. # Unless it is the weekend, in which case there is no upper bound on the number # of cigars. Return True if the party with the given values is successful, or #...
# When squirrels get together for a party, they like to have cigars. A squirrel # party is successful when the number of cigars is between 40 and 60, inclusive. # Unless it is the weekend, in which case there is no upper bound on the number # of cigars. Return True if the party with the given values is successful, or #...
Python
0.000002
4d3d4e457c5886ace69250de1c5f4f696604d43b
Fix cal_seqs with no delay
QGL/BasicSequences/helpers.py
QGL/BasicSequences/helpers.py
# coding=utf-8 from itertools import product import operator from ..PulsePrimitives import Id, X, MEAS from ..ControlFlow import qwait from functools import reduce def create_cal_seqs(qubits, numRepeats, measChans=None, waitcmp=False, delay=None): """ Helper function to create a set of calibration sequences. P...
# coding=utf-8 from itertools import product import operator from ..PulsePrimitives import Id, X, MEAS from ..ControlFlow import qwait from functools import reduce def create_cal_seqs(qubits, numRepeats, measChans=None, waitcmp=False, delay=None): """ Helper function to create a set of calibration sequences. P...
Python
0.000002
22f6ecc5b61dae0a638b4191eb2ae3ddf1b13895
fix organization events don't have repository/owner/login
bioconda_utils/bot/views.py
bioconda_utils/bot/views.py
""" HTTP Views (pages) """ import logging from aiohttp import web from .events import event_routes from ..githubhandler import Event from .. import __version__ as VERSION from .worker import celery from .config import APP_SECRET logger = logging.getLogger(__name__) # pylint: disable=invalid-name web_routes = web.R...
""" HTTP Views (pages) """ import logging from aiohttp import web from .events import event_routes from ..githubhandler import Event from .. import __version__ as VERSION from .worker import celery from .config import APP_SECRET logger = logging.getLogger(__name__) # pylint: disable=invalid-name web_routes = web.R...
Python
0.000713
667a87988d168a4dbd9b0d86267b445d91f1460b
Fix Daikin sensor temperature_unit & cleanup (#34116)
homeassistant/components/daikin/sensor.py
homeassistant/components/daikin/sensor.py
"""Support for Daikin AC sensors.""" import logging from homeassistant.const import CONF_ICON, CONF_NAME, TEMP_CELSIUS from homeassistant.helpers.entity import Entity from . import DOMAIN as DAIKIN_DOMAIN from .const import ATTR_INSIDE_TEMPERATURE, ATTR_OUTSIDE_TEMPERATURE, SENSOR_TYPES _LOGGER = logging.getLogger(_...
"""Support for Daikin AC sensors.""" import logging from homeassistant.const import CONF_ICON, CONF_NAME, CONF_TYPE from homeassistant.helpers.entity import Entity from homeassistant.util.unit_system import UnitSystem from . import DOMAIN as DAIKIN_DOMAIN from .const import ( ATTR_INSIDE_TEMPERATURE, ATTR_OUT...
Python
0
fc975bd573d439490a65bb72ff5f6c69b2b0a771
Update loudness_zwicker_lowpass_intp.py
mosqito/functions/loudness_zwicker/loudness_zwicker_lowpass_intp.py
mosqito/functions/loudness_zwicker/loudness_zwicker_lowpass_intp.py
# -*- coding: utf-8 -*- """ @date Created on Fri May 22 2020 @author martin_g for Eomys """ # Standard library imports import math import numpy as np #Needed for the loudness_zwicker_lowpass_intp_ea function from scipy import signal def loudness_zwicker_lowpass_intp(loudness, tau, sample_rate): """1st order low-p...
# -*- coding: utf-8 -*- """ @date Created on Fri May 22 2020 @author martin_g for Eomys """ # Standard library imports import math import numpy as np def loudness_zwicker_lowpass_intp(loudness, tau, sample_rate): """1st order low-pass with linear interpolation of signal for increased precision Parameter...
Python
0.014013
260f5ba0b74cfbad9ed13809c62a1a942cc2be7a
fix style
tests/links_tests/connection_tests/test_conv_2d_bn_activ.py
tests/links_tests/connection_tests/test_conv_2d_bn_activ.py
import unittest import numpy as np import chainer from chainer import cuda from chainer.functions import relu from chainer import testing from chainer.testing import attr from chainercv.links import Conv2DBNActiv def _add_one(x): return x + 1 @testing.parameterize(*testing.product({ 'args_style': ['expli...
import unittest import numpy as np import chainer from chainer import cuda from chainer.functions import relu from chainer import testing from chainer.testing import attr from chainercv.links import Conv2DBNActiv def _add_one(x): return x + 1 @testing.parameterize(*testing.product({ 'args_style': ['expli...
Python
0.000001
4748fd514fcafd9a0536b24069bf3365cb60a926
Bump development version number
debreach/__init__.py
debreach/__init__.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from distutils import version __version__ = '1.3.1' version_info = version.StrictVersion(__version__).version default_app_config = 'debreach.apps.DebreachConfig'
# -*- coding: utf-8 -*- from __future__ import unicode_literals from distutils import version __version__ = '1.3.0' version_info = version.StrictVersion(__version__).version default_app_config = 'debreach.apps.DebreachConfig'
Python
0
f4a010660aecaccf24fe2afdd5a568e06e65dd1e
Fix adding board_collaborator to invite
blimp_boards/boards/serializers.py
blimp_boards/boards/serializers.py
from django.core.exceptions import ValidationError from rest_framework import serializers from ..accounts.models import AccountCollaborator from ..invitations.models import InvitedUser from ..accounts.permissions import AccountPermission from ..users.serializers import UserSimpleSerializer from .models import Board, ...
from django.core.exceptions import ValidationError from rest_framework import serializers from ..accounts.models import AccountCollaborator from ..invitations.models import InvitedUser from ..accounts.permissions import AccountPermission from ..users.serializers import UserSimpleSerializer from .models import Board, ...
Python
0
6e3cd31c7efbea71b5f731429c24e946ce6fc476
Bump version
debreach/__init__.py
debreach/__init__.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from distutils import version __version__ = '0.2.0' version_info = version.StrictVersion(__version__).version
# -*- coding: utf-8 -*- from __future__ import unicode_literals from distutils import version __version__ = '0.1.1' version_info = version.StrictVersion(__version__).version
Python
0
21149eb8d128c405d0b69991d1855e99ced951c7
Test fixed: WorkbenchUser is auto created by signal, so creating it separately is not required
ExperimentsManager/tests.py
ExperimentsManager/tests.py
from django.test import TestCase from .models import Experiment from UserManager.models import WorkbenchUser from django.contrib.auth.models import User from django.test import Client class ExperimentTestCase(TestCase): def setUp(self): self.user = User.objects.create_user('test', 'test@test.nl', 'test') ...
from django.test import TestCase from .models import Experiment from UserManager.models import WorkbenchUser from django.contrib.auth.models import User from django.test import Client class ExperimentTestCase(TestCase): def setUp(self): self.user = User.objects.create_user('test', 'test@test.nl', 'test') ...
Python
0