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
90d42e80690a80a7099142b6b024c8d3b0f78075
Fix DelayedCall cancellation in remind plugin on reload
plugins/remind/plugin.py
plugins/remind/plugin.py
from twisted.internet import error, reactor from cardinal.decorators import command, help class RemindPlugin: def __init__(self): self.call_ids = [] @command('remind') @help("Sends a reminder after a set time.") @help("Syntax: .remind <minutes> <message>") def remind(self, cardinal, user...
from twisted.internet import error, reactor from cardinal.decorators import command, help class RemindPlugin: def __init__(self): self.call_ids = [] @command('remind') @help("Sends a reminder after a set time.") @help("Syntax: .remind <minutes> <message>") def remind(self, cardinal, user...
Python
0
e6fb45d2e4b28db8e7d638f88e71ab3bc2720f57
Fix imports for django 1.8
src/django_babel_underscore/__init__.py
src/django_babel_underscore/__init__.py
# -*- coding: utf-8 -*- import django if django.VERSION[:2] >= (1, 8): from django.template.base import Lexer, TOKEN_TEXT else: from django.template import Lexer, TOKEN_TEXT from django.utils.encoding import force_text from django_babel.extract import extract_django from django.utils import six from markey im...
# -*- coding: utf-8 -*- from django.template import Lexer, TOKEN_TEXT from django.utils.encoding import force_text from django_babel.extract import extract_django from django.utils import six from markey import underscore from markey.tools import TokenStream from markey.machine import tokenize, parse_arguments def ex...
Python
0.000009
a7d261b9049eb2daa79d4e7fc40cc665650f014e
Test print.
ninja_shogun/scripts/shogun_bugbase.py
ninja_shogun/scripts/shogun_bugbase.py
#!/usr/bin/env python import click import os from collections import Counter, defaultdict import csv import pandas as pd import pickle from ninja_utils.utils import verify_make_dir from ninja_shogun.wrappers import utree_search def build_img_map(infile: str): gg2img_oid = defaultdict(int) df = pd.DataFrame....
#!/usr/bin/env python import click import os from collections import Counter, defaultdict import csv import pandas as pd import pickle from ninja_utils.utils import verify_make_dir from ninja_shogun.wrappers import utree_search def build_img_map(infile: str): gg2img_oid = defaultdict(int) df = pd.DataFrame....
Python
0
90e01a0e8ef2ea25456e49ad8f2cfa6e7d79b6b9
add credit
DataSources/raw/mastodon/Scraper.py
DataSources/raw/mastodon/Scraper.py
# uses https://github.com/halcy/Mastodon.py # install by typing pip install Mastodon.py import sys sys.path.append('c:/program files/anaconda3/lib/site-packages') import codecs import datetime import json from mastodon.Mastodon import Mastodon from mastodon.streaming import StreamListener, MalformedEventError __all...
import sys sys.path.append('c:/program files/anaconda3/lib/site-packages') import codecs import datetime import json from mastodon.Mastodon import Mastodon from mastodon.streaming import StreamListener, MalformedEventError __all__ = ['Mastodon', 'StreamListener', 'MalformedEventError'] ## you need to create an app ...
Python
0
7b8683f1798659c7fb7d5aa14a762518c60f69ad
fix test cases
learntools/intro_to_programming/ex3.py
learntools/intro_to_programming/ex3.py
from learntools.core import * def get_expected_cost(beds, baths, has_basement): value = 80000 + 30000 * beds + 10000 * baths + 40000 * has_basement return value class FloatToInt(ThoughtExperiment): _solution = ("Negative floats are always rounded UP to the closest integer (for instance, " ...
from learntools.core import * def get_expected_cost(beds, baths, has_basement): value = 80000 + 30000 * beds + 10000 * baths + 40000 * has_basement return value class FloatToInt(ThoughtExperiment): _solution = ("Negative floats are always rounded UP to the closest integer (for instance, " ...
Python
0.000013
d6c81135077867283738bcf9cceb0ce8198808d6
Enable SSL verify for prod
unicornclient/config.py
unicornclient/config.py
import os import logging ENV = os.getenv('PYTHONENV', 'prod') LOG_LEVEL = logging.DEBUG LOG_FORMAT = '%(asctime)s - %(levelname)s - %(message)s' HOST = 'localhost' PORT = 8080 SSL_VERIFY = False DEFAULT_ROUTINES = ['auth', 'ping', 'status', 'system'] if ENV == 'prod': LOG_LEVEL = logging.INFO HOST = 'unic...
import os import logging ENV = os.getenv('PYTHONENV', 'prod') LOG_LEVEL = logging.DEBUG LOG_FORMAT = '%(asctime)s - %(levelname)s - %(message)s' HOST = 'localhost' PORT = 8080 SSL_VERIFY = False DEFAULT_ROUTINES = ['auth', 'ping', 'status', 'system'] if ENV == 'prod': LOG_LEVEL = logging.INFO HOST = 'unic...
Python
0
9775ca470e423636880027a39f826452b7ce8d7a
Add the RoutePoint class. It didn't inherit from Django models
moveon/models.py
moveon/models.py
from django.db import models class Company(models.Model): name = models.TextField() code = models.TextField() url = models.URLField() logo = models.TextField() def __str__(self): return self.name class Transport(models.Model): name = models.TextField() def __str__(se...
from django.db import models class Company(models.Model): name = models.TextField() code = models.TextField() url = models.URLField() logo = models.TextField() def __str__(self): return self.name class Transport(models.Model): name = models.TextField() def __str__(se...
Python
0
5741d373ce42e7fbf7f888e4c220b033d21567fb
move default iembot listen ports
iembot.tac
iembot.tac
# Twisted Bits from twisted.application import service, internet from twisted.web import server from twisted.enterprise import adbapi # Base Python import json # Local Import import iemchatbot dbconfig = json.load(open('settings.json')) application = service.Application("Public IEMBOT") serviceCollection = service...
# Twisted Bits from twisted.application import service, internet from twisted.web import server from twisted.enterprise import adbapi # Base Python import json # Local Import import iemchatbot dbconfig = json.load(open('settings.json')) application = service.Application("Public IEMBOT") serviceCollection = service...
Python
0
f32affa563735a64466015ed543cc384531efa85
Fix missing trim of output string
modules/contrib/shell.py
modules/contrib/shell.py
# pylint: disable=C0111,R0903,W1401 """ Execute command in shell and print result Few command examples: 'ping -c 1 1.1.1.1 | grep -Po '(?<=time=)\d+(\.\d+)? ms'' 'echo 'BTC=$(curl -s rate.sx/1BTC | grep -Po \'^\d+\')USD'' 'curl -s https://wttr.in/London?format=%l+%t+%h+%w' 'pip3 freeze | wc -l' 'a...
# pylint: disable=C0111,R0903,W1401 """ Execute command in shell and print result Few command examples: 'ping -c 1 1.1.1.1 | grep -Po '(?<=time=)\d+(\.\d+)? ms'' 'echo 'BTC=$(curl -s rate.sx/1BTC | grep -Po \'^\d+\')USD'' 'curl -s https://wttr.in/London?format=%l+%t+%h+%w' 'pip3 freeze | wc -l' 'a...
Python
0.0005
656e13c14b0c24289cc5edbc84a3bbff5e1a8911
fix update
update_training_data.py
update_training_data.py
from db import conn import re import string curr = conn.cursor() def get_word_status(word): """ Returns word data in format [a_spam, d_spam, a_good, d_good] """ curr.execute("SELECT add_spam, add_good, del_spam, del_good FROM training_words WHERE word = %(word)s", {"word":word}) row = curr.fetchone() i...
from db import conn curr = conn.cursor() def get_word_status(word): """ Returns word data in format [a_spam, d_spam, a_good, d_good] """ curr.execute("SELECT add_spam, add_good, del_spam, del_good FROM training_words WHERE word = %(word)s", {"word":word}) row = curr.fetchone() if row is None: return [0...
Python
0.000001
9b3cd3eb39ac3d3e8d0e91de3860f21996ab51aa
fix inv
Cogs/utils.py
Cogs/utils.py
from discord.ext import commands import discord import os import asyncio import inspect import textwrap import tokage class Utilities: def __init__(self, bot): self.bot = bot @commands.command(hidden=True, enabled=False) async def setavatar(self, ctx, picture): path = os.path.join("Bot Pi...
from discord.ext import commands import discord import os import asyncio import inspect import textwrap import tokage class Utilities: def __init__(self, bot): self.bot = bot @commands.command(hidden=True, enabled=False) async def setavatar(self, ctx, picture): path = os.path.join("Bot Pi...
Python
0.000004
4312dcee00eabe97040a7a1da58f25d714a9dfee
Remove debug statement and prevent nsfw for images
scripts/python/reddit.py
scripts/python/reddit.py
#!/usr/bin/env python3 # Copyright 2012-2013 Jake Basile and Kyle Varga # # 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 requir...
#!/usr/bin/env python3 # Copyright 2012-2013 Jake Basile and Kyle Varga # # 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 requir...
Python
0
f6cf19966651e8c1e21fa3bde777c5bad6285c9f
add print
scripts/relay_control.py
scripts/relay_control.py
#!/usr/bin/python import RPi.GPIO as GPIO import argparse GPIO.setmode(GPIO.BOARD) # GPIO/BOARD | Relay IN | Rotors | Zone # 22/15 | R2 IN2 | 1 | B # 18/12 | R1 IN2 | 2 | A # 24/18 | R1 IN3 | 3 | D # 17/11 | R1 IN4 | 4 | C # 27/13 | R2 IN1 | 5 | E relayIO =...
#!/usr/bin/python import RPi.GPIO as GPIO import argparse GPIO.setmode(GPIO.BOARD) # GPIO/BOARD | Relay IN | Rotors | Zone # 22/15 | R2 IN2 | 1 | B # 18/12 | R1 IN2 | 2 | A # 24/18 | R1 IN3 | 3 | D # 17/11 | R1 IN4 | 4 | C # 27/13 | R2 IN1 | 5 | E relayIO =...
Python
0.000085
62957cca1251084751c78e2b9b5821342d1a9095
Add properties to CohortsBase model
scuole/cohorts/models.py
scuole/cohorts/models.py
# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals from django.db import models from django.utils.functional import cached_property from .managers import CohortQuerySet class CohortsBase(models.Model): FEMALE = 'Female' MALE = 'Male' GENDER_CHOICES = ( (FEMALE, 'Fe...
# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals from django.db import models from .managers import CohortQuerySet class CohortsBase(models.Model): FEMALE = 'Female' MALE = 'Male' GENDER_CHOICES = ( (FEMALE, 'Female'), (MALE, 'Male'), ) WHITE = '...
Python
0
8bc482db2e9cf98d3e3571f49a85ee7a287efaf7
Use DjangoJSONEncoder when serving jsonp requests
server/shared/request.py
server/shared/request.py
from django.core.serializers.json import DjangoJSONEncoder from django.http import JsonResponse, HttpResponse from django.shortcuts import render_to_response from django.template.loader import render_to_string import logging, json, re logger = logging.getLogger("logger") class ErrorResponse(Exception): def __ini...
from django.http import JsonResponse, HttpResponse from django.shortcuts import render_to_response from django.template.loader import render_to_string import logging import json import re logger = logging.getLogger("logger") class ErrorResponse(Exception): def __init__(self, message, data=None, status=401, err=N...
Python
0.000001
e1d119d743076b29cf19c584c337579903ab3875
fix templates path
flaskr/__init__.py
flaskr/__init__.py
#!/usr/bin/python3 # -*- coding: latin-1 -*- import os import sys # import psycopg2 import json from bson import json_util from pymongo import MongoClient from flask import Flask, request, session, g, redirect, url_for, abort, \ render_template, flash def create_app(): app = Flask(__name__) return app a...
#!/usr/bin/python3 # -*- coding: latin-1 -*- import os import sys # import psycopg2 import json from bson import json_util from pymongo import MongoClient from flask import Flask, request, session, g, redirect, url_for, abort, \ render_template, flash def create_app(): app = Flask(__name__) return app a...
Python
0.000001
22571c096051fefc28b467ca29d93a4f0ea6cb9c
fix column pruning
mongoose_fdw/__init__.py
mongoose_fdw/__init__.py
### ### Author: David Wallin ### Time-stamp: <2015-03-02 08:56:11 dwa> from multicorn import ForeignDataWrapper from multicorn.utils import log_to_postgres as log2pg from pymongo import MongoClient class Mongoose_fdw (ForeignDataWrapper): def __init__(self, options, columns): super(Mongoose_fdw, self)....
### ### Author: David Wallin ### Time-stamp: <2015-03-02 08:56:11 dwa> from multicorn import ForeignDataWrapper from multicorn.utils import log_to_postgres as log2pg from pymongo import MongoClient class Mongoose_fdw (ForeignDataWrapper): def __init__(self, options, columns): super(Mongoose_fdw, self)....
Python
0.000001
441cfadb97879d9ac76407145ba77185bbb292f8
fix regex n test
mots_vides/stop_words.py
mots_vides/stop_words.py
""" StopWord Python container, managing collection of stop words. """ import re class StopWord(object): """ Object managing collection of stop words for a given language. """ def __init__(self, language, collection=[]): """ Initializes with a given language and an optional collection....
""" StopWord Python container, managing collection of stop words. """ import re class StopWord(object): """ Object managing collection of stop words for a given language. """ def __init__(self, language, collection=[]): """ Initializes with a given language and an optional collection....
Python
0.99982
9c7d335780e219893f0976cda6a5388b51fa0a64
Update to v19.2.6
mycroft/version/__init__.py
mycroft/version/__init__.py
# Copyright 2017 Mycroft AI Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
# Copyright 2017 Mycroft AI Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
Python
0
0d77cb02dfec448c1de8def96c9b73856b602759
Update models.py
user_sessions/models.py
user_sessions/models.py
import django from django.conf import settings from django.contrib.sessions.models import SessionManager from django.db import models from django.utils.translation import ugettext_lazy as _ class Session(models.Model): """ Session objects containing user session information. Django provides full support ...
import django from django.conf import settings from django.contrib.sessions.models import SessionManager from django.db import models from django.utils.translation import ugettext_lazy as _ class Session(models.Model): """ Session objects containing user session information. Django provides full support ...
Python
0
b5814202bdcc5a15503d6c52c59aa2eb8736b7ec
Add whitelist to redpill plugin
proxy/plugins/redpill.py
proxy/plugins/redpill.py
# redpill.py PSO2Proxy plugin # For use with redpill.py flask webapp and website for packet logging and management import sqlite, plugins dbLocation = '/var/pso2-www/redpill/redpill.db' enabled = False if enabled: @plugins.onStartHook def redpillInit(): print("[Redpill] Redpill initilizing with database %s." % db...
# redpill.py PSO2Proxy plugin # For use with redpill.py flask webapp and website for packet logging and management import sqlite dbLocation = '/var/pso2-www/redpill/redpill.db' #TODO
Python
0
2bd8c77e1b1282412787d88f347e99f361a4d65f
disable flow class by default
config/settings/local.py
config/settings/local.py
# -*- coding: utf-8 -*- """ Local settings - Run in Debug mode - Use console backend for emails - Add Django Debug Toolbar - Add django-extensions as app """ import socket import os from .common import * # noqa # DEBUG # ------------------------------------------------------------------------------ DEBUG = env.bo...
# -*- coding: utf-8 -*- """ Local settings - Run in Debug mode - Use console backend for emails - Add Django Debug Toolbar - Add django-extensions as app """ import socket import os from .common import * # noqa # DEBUG # ------------------------------------------------------------------------------ DEBUG = env.bo...
Python
0
28f74edc5b2902ccb9026388db789807a5c2e1f1
Append layout and seat if in csv if exist in ticket.
congressus/invs/utils.py
congressus/invs/utils.py
from django.conf import settings from django.http import HttpResponse from .models import Invitation from tickets.utils import concat_pdf from tickets.utils import generate_pdf def gen_csv_from_generator(ig, numbered=True, string=True): csv = [] name = ig.type.name for i, inv in enumerate(ig.invitations....
from django.conf import settings from django.http import HttpResponse from .models import Invitation from tickets.utils import concat_pdf from tickets.utils import generate_pdf def gen_csv_from_generator(ig, numbered=True, string=True): csv = [] name = ig.type.name for i, inv in enumerate(ig.invitations....
Python
0
d7284d82367a3f9b7a3db4de88d3c06e92542b23
fix bug in domain blacklist
muckrock/task/signals.py
muckrock/task/signals.py
"""Signals for the task application""" from django.db.models.signals import post_save from email.utils import parseaddr import logging from muckrock.task.models import OrphanTask, BlacklistDomain logger = logging.getLogger(__name__) def domain_blacklist(sender, instance, **kwargs): """Blacklist certain domains ...
"""Signals for the task application""" from django.db.models.signals import post_save from email.utils import parseaddr import logging from muckrock.task.models import OrphanTask, BlacklistDomain logger = logging.getLogger(__name__) def domain_blacklist(sender, instance, **kwargs): """Blacklist certain domains ...
Python
0
009f1ec1580653dfc600c505622b95d153be231d
fix the id column
util/create_database.py
util/create_database.py
#!/usr/bin/env python import os import sys import sqlite3 base_dir = os.path.dirname(os.path.realpath(os.path.join(__file__, '..'))) db_path = os.path.join(base_dir, 'db/lightspeed.db') if len(sys.argv) == 2: db_path = os.path.realpath(sys.argv[1]) try: conn = sqlite3.connect(db_path) c = conn.cursor(); ...
#!/usr/bin/env python import os import sys import sqlite3 base_dir = os.path.dirname(os.path.realpath(os.path.join(__file__, '..'))) db_path = os.path.join(base_dir, 'db/lightspeed.db') if len(sys.argv) == 2: db_path = os.path.realpath(sys.argv[1]) try: conn = sqlite3.connect(db_path) c = conn.cursor(); ...
Python
0.999679
30c2463ea91a6ae5c43e3c31d8efae093e9708c3
fix attempt
viaduct/models/group.py
viaduct/models/group.py
#!/usr/bin/python from viaduct import db from viaduct.models.permission import GroupPermission user_group = db.Table('user_group', db.Column('user_id', db.Integer, db.ForeignKey('user.id')), db.Column('group_id', db.Integer, db.ForeignKey('group.id')) ) class Group(db.Model): __tablename__ = 'group' id = db.Col...
#!/usr/bin/python from viaduct import db from viaduct.models.permission import GroupPermission user_group = db.Table('user_group', db.Column('user_id', db.Integer, db.ForeignKey('user.id')), db.Column('group_id', db.Integer, db.ForeignKey('group.id')) ) class Group(db.Model): __tablename__ = 'group' id = db.Col...
Python
0.000013
f164d08d5364ba6db333b1be6ce8e2f148f976ec
Basic 'hello' command
__init__.py
__init__.py
from __future__ import unicode_literals from slackclient import SlackClient import time import secrets sc = SlackClient(secrets.SLACK_API_KEY) channels = sc.api_call('channels.list', exclude_archived=1) prefix = '!' def parse_command(event: dict): # Validate event if 'type' not in event: return i...
from __future__ import unicode_literals from slackclient import SlackClient import time import secrets sc = SlackClient(secrets.SLACK_API_KEY) channels = sc.api_call('channels.list', exclude_archived=1) print(channels) if sc.rtm_connect(): while True: events = sc.rtm_read() for event in events: ...
Python
0.99994
1e0c72560537d35f46f532b7ac3e48f52bb5ae31
Add logger to __init__.py
__init__.py
__init__.py
from maya import cmds import logging import json import imp import os # level = logging.DEBUG level = logging.ERROR logger = logging.getLogger(__name__) handler = logging.StreamHandler() logger.addHandler(handler) logger.setLevel(level) handler.setLevel(level) def getClassList(): """ Arg...
from maya import cmds import json import imp import os def getClassList(): """ Args: param (logger): logger Return: list: list of classes """ moduleDirName = "rush" mayaScriptDir = cmds.internalVar(userScriptDir=True) moduleRoot = os.path.join(mayaS...
Python
0.001012
980ea4be2fd6d05aa9ec64bfaa50d89161185ccd
rework httplib2.Http to be able to not verify certs if configuration tells the app not to verify them
pubs_ui/metrics/views.py
pubs_ui/metrics/views.py
from flask import Blueprint, render_template from flask_login import login_required from httplib2 import Http from oauth2client.service_account import ServiceAccountCredentials from .. import app metrics = Blueprint('metrics', __name__, template_folder='templates', static_fold...
from flask import Blueprint, render_template from flask_login import login_required from httplib2 import Http from oauth2client.service_account import ServiceAccountCredentials from .. import app metrics = Blueprint('metrics', __name__, template_folder='templates', static_fold...
Python
0
290f864f1bb44300cec9bb9e28679c3d7ba70c7e
Test 1 done
cookbook/seismic_conv.py
cookbook/seismic_conv.py
""" Synthetic convolutional seismogram for a simple two layer velocity model """ import numpy as np from fatiando.seismic import conv from fatiando.vis import mpl #model parameters n_samples, n_traces = [600, 20] rock_grid = 1500.*np.ones((n_samples, n_traces)) rock_grid[300:, :] = 2500. #synthetic calculation [vel_l, ...
""" Synthetic convolutional seismogram for a simple two layer velocity model """ import numpy as np from fatiando.seismic import conv from fatiando.vis import mpl #model parameters n_samples, n_traces = [600, 20] rock_grid = 1500.*np.ones((n_samples, n_traces)) rock_grid[300:,:] = 2500. #synthetic calculation [vel_l, r...
Python
0.000001
b4623bcdcd0a35091030057edc52870045a17223
fix for Anaconda compatibility
__init__.py
__init__.py
''' Import all subdirectories and modules. ''' import os as _os __all__ = [] for _path in _os.listdir(_os.path.dirname(__file__)): _full_path = _os.path.join(_os.path.dirname(__file__), _path) if _os.path.isdir(_full_path) and _path not in ['.git', 'examples', 'widgets']: __import__(_path, locals(), g...
''' Import all subdirectories and modules. ''' import os as _os __all__ = [] for _path in _os.listdir(_os.path.dirname(__file__)): _full_path = _os.path.join(_os.path.dirname(__file__), _path) if _os.path.isdir(_full_path) and _path not in ['.git', 'examples']: __import__(_path, locals(), globals()) ...
Python
0
2ce8efa3bf227c9a769121a4d313963f0cfbde51
print sys args
add_data.py
add_data.py
import psycopg2 import sys from connect import connect_to_db # add argparse for options via command line # add new temperature and date conn = connect_to_db() cur = conn.cursor() print sys.argv
import psycopg2 import sys from connect import connect_to_db # add argparse for options via command line # add new temperature and date def add_temp(date, temp): print date, temp # conn = connect_to_db()
Python
0.999189
85da4c8cb3d613882eb46fb398e361286d4b4286
fix add_page
add_page.py
add_page.py
from widgy.models import * page = ContentPage.objects.create( title='widgy page' ) page.root_widget = TwoColumnLayout.add_root().node page.save() for i in range(3): page.root_widget.data.left_bucket.data.add_child(TextContent, content='yay %s' % i ) for i in range(2): ...
from widgy.models import * page = ContentPage.objects.create( title='widgy page' ) page.root_widget = TwoColumnLayout.add_root().node page.save() for i in range(3): page.root_widget.data.left_bucket.add_child(TextContent, content='yay %s' % i ) for i in range(2): page...
Python
0.000001
8034a3f237fad994444cbc7edfffb658ef00f908
Test commit
__init__.py
__init__.py
# test
Python
0
f8e0ca3aac5530e0d1d93a1db79cbc17bde3ee89
Support saving to a file
__main__.py
__main__.py
import sys from PyQt5.QtCore import QPoint, QRect, Qt from PyQt5.QtGui import ( QColor, QImage, QPainter, ) from PyQt5.QtWidgets import ( QApplication, QDesktopWidget, QWidget, ) APPLICATION_TITLE = 'Wiggle' APPLICATION_VERSION = '0.1' class Image(object): WIDTH = 256 HEIGHT = 256 ...
import sys from PyQt5.QtCore import QPoint, QRect, Qt from PyQt5.QtGui import ( QColor, QImage, QPainter, ) from PyQt5.QtWidgets import ( QApplication, QDesktopWidget, QWidget, ) APPLICATION_TITLE = 'Wiggle' APPLICATION_VERSION = '0.1' class Image(object): WIDTH = 256 HEIGHT = 256 ...
Python
0
9cd440760ea789cf712491080e61205d03a027c8
Support verbose and bleeding config from file
__main__.py
__main__.py
import json, os.path import discord from discord.ext import commands from Fun import Fun def main(): # variables config_file = 'config.json' # load config with open(config_file) as f: config = json.load(f) # split config description, token = config['description'], config['token'] ...
import json, os.path import discord from discord.ext import commands from Fun import Fun def main(): # variables config_file = 'config.json' # load config with open(config_file) as f: config = json.load(f) # split config description, token = config['description'], config['token'] ...
Python
0
6bb6f73b6dd5a497a670ec3dc4d85483253737d2
update dev version after 0.9.6 tag [skip ci]
py/desimodel/_version.py
py/desimodel/_version.py
__version__ = '0.9.6.dev431'
__version__ = '0.9.6'
Python
0
a88156ecd020ab9736bcc90856c7f6042d56fab9
raise exception if user aborts
py/mel/cmd/addcluster.py
py/mel/cmd/addcluster.py
"""A tool for adding a new cluster / constellation from photographs.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import cv2 import numpy def setup_parser(parser): parser.add_argument( 'context', type=str, default=None, ...
"""A tool for adding a new cluster / constellation from photographs.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import cv2 import numpy def setup_parser(parser): parser.add_argument( 'context', type=str, default=None, ...
Python
0
45e326128beafee61b6913098808fe9e51829615
remove print
pyLibrary/thread/till.py
pyLibrary/thread/till.py
# encoding: utf-8 # # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http://mozilla.org/MPL/2.0/. # # Author: Kyle Lahnakoski (kyle@lahnakoski.com) # # THIS THREADING MODULE IS PERMEATED BY THE ple...
# encoding: utf-8 # # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http://mozilla.org/MPL/2.0/. # # Author: Kyle Lahnakoski (kyle@lahnakoski.com) # # THIS THREADING MODULE IS PERMEATED BY THE ple...
Python
0.000793
615613a3213e7b4023135b2fc85ac725d5f12656
Add jvm_path argument to connect method
pyathenajdbc/__init__.py
pyathenajdbc/__init__.py
# -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import unicode_literals import datetime __version__ = '1.0.2' __athena_driver_version__ = '1.0.0' # Globals https://www.python.org/dev/peps/pep-0249/#globals apilevel = '2.0' threadsafety = 3 paramstyle = 'pyformat' ATHENA_JAR = 'Athe...
# -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import unicode_literals import datetime __version__ = '1.0.2' __athena_driver_version__ = '1.0.0' # Globals https://www.python.org/dev/peps/pep-0249/#globals apilevel = '2.0' threadsafety = 3 paramstyle = 'pyformat' ATHENA_JAR = 'Athe...
Python
0.000001
d4464407c923ecf75cadcb11cfcac1ad143b0f38
correct bug
pybioportal/Bioportal.py
pybioportal/Bioportal.py
import requests import urllib from requests import HTTPError class Bioportal(object): '''A Python binding of the BioPortal REST API (http://data.bioontology.org/documentation)''' BASE_URL = 'http://data.bioontology.org' def __init__(self, api_key): self.apikey = api_key def classes(sel...
import requests import urllib from requests import HTTPError class Bioportal(object): '''A Python binding of the BioPortal REST API (http://data.bioontology.org/documentation)''' BASE_URL = 'http://data.bioontology.org' def __init__(self, api_key): self.apikey = api_key def classes(sel...
Python
0.000004
462312c3acf2d6daf7d8cd27f251b8cb92647f5e
Fix a typo in the variable name
pybossa/auth/category.py
pybossa/auth/category.py
from flaskext.login import current_user def create(category=None): if current_user.is_authenticated(): if current_user.admin is True: return True else: return False else: return False def read(category=None): return True def update(category): return ...
from flaskext.login import current_user def create(app=None): if current_user.is_authenticated(): if current_user.admin is True: return True else: return False else: return False def read(app=None): return True def update(app): return create(app) d...
Python
0.999999
9e8764128e83b104b6a7000451b7863209541d47
remove parent accounts from finance_accounts
pycroft/model/finance.py
pycroft/model/finance.py
# -*- coding: utf-8 -*- # Copyright (c) 2013 The Pycroft Authors. See the AUTHORS file. # This file is part of the Pycroft project and licensed under the terms of # the Apache License, Version 2.0. See the LICENSE file for details. """ pycroft.model.finance ~~~~~~~~~~~~~~ This module contains the classes F...
# -*- coding: utf-8 -*- # Copyright (c) 2013 The Pycroft Authors. See the AUTHORS file. # This file is part of the Pycroft project and licensed under the terms of # the Apache License, Version 2.0. See the LICENSE file for details. """ pycroft.model.finance ~~~~~~~~~~~~~~ This module contains the classes F...
Python
0.000004
ce384e6eb3f762f611bfd70874766248169a7d15
indent fix
nginpro/utils.py
nginpro/utils.py
""" Utilities """ from string import Template """ Generate configuration blocks """ def make_block(name, content, pattern=""): return Template( """ ${name} ${pattern} { ${content} } """).safe_substitute(name=name, content=content, pattern=pattern) """ Takes a python ...
""" Utilities """ from string import Template """ Generate configuration blocks """ def make_block(name, content, pattern=""): return Template(""" ${name} ${pattern} { ${content} } """).safe_substitute(name=name, content=content, pattern=pattern) """ Takes a python dictionary an...
Python
0.000002
96ad539fdf0302dd0e2996f746ce1fd055c8e590
fix log size to 5mb
vmmaster/core/logger.py
vmmaster/core/logger.py
import logging import logging.handlers import graypy import os import sys from .config import config class StreamToLogger(object): """ Fake file-like stream object that redirects writes to a logger instance. """ def __init__(self, logger, log_level=logging.INFO): self.logger = logger ...
import logging import logging.handlers import graypy import os import sys from .config import config class StreamToLogger(object): """ Fake file-like stream object that redirects writes to a logger instance. """ def __init__(self, logger, log_level=logging.INFO): self.logger = logger ...
Python
0.000949
23ab8664d1ed16ea0339f9b94938e1c95b574132
Remove silly try/except blocks in button.py
pygametemplate/button.py
pygametemplate/button.py
import time from pygametemplate import log class Button(object): """Class representing keyboard keys.""" def __init__(self, game, number): self.game = game self.number = number self.event = None # The last event that caused the button press self.pressed = 0 # If the but...
import time from pygametemplate import log class Button(object): """Class representing keyboard keys.""" def __init__(self, game, number): self.game = game try: self.number = number self.event = None # The last event that caused the button press self.pre...
Python
0.000001
1ee2e880872c4744f4159df7fc64bb64b3f35632
Add docstring to Button.time_held() method
pygametemplate/button.py
pygametemplate/button.py
import time class Button(object): """Class representing keyboard keys.""" def __init__(self, game, number): self.game = game self.number = number self.event = None # The last event that caused the button press self.pressed = 0 # If the button was just pressed sel...
import time class Button(object): """Class representing keyboard keys.""" def __init__(self, game, number): self.game = game self.number = number self.event = None # The last event that caused the button press self.pressed = 0 # If the button was just pressed sel...
Python
0.000001
d7249e710be3da451b4ca752780e5a86501f6198
update version number to 1.8.3
python/flame/__init__.py
python/flame/__init__.py
from collections import OrderedDict from ._internal import (Machine as MachineBase, GLPSPrinter, _GLPSParse, _pyapi_version, _capi_version, FLAME_ERROR, FLAME_WARN, FLAME_INFO, FLAME_DEBUG, setLogLe...
from collections import OrderedDict from ._internal import (Machine as MachineBase, GLPSPrinter, _GLPSParse, _pyapi_version, _capi_version, FLAME_ERROR, FLAME_WARN, FLAME_INFO, FLAME_DEBUG, setLogLe...
Python
0.000006
1809f2d3c73bff910fb7e538ace0e2584d1bd857
remove debug print
python/smurff/prepare.py
python/smurff/prepare.py
import numpy as np import scipy as sp import pandas as pd import scipy.sparse import numbers from .helper import SparseTensor from . import wrapper def make_sparse(Y, nnz, shape = None, seed = None): Ytr, Yte = make_train_test(Y, nnz, shape, seed) return Yte def make_train_test(Y, ntest, shape = None, seed...
import numpy as np import scipy as sp import pandas as pd import scipy.sparse import numbers from .helper import SparseTensor def make_sparse(Y, nnz, shape = None, seed = None): Ytr, Yte = make_train_test(Y, nnz, shape, seed) return Yte def make_train_test(Y, ntest, shape = None, seed = None): """Split...
Python
0.000001
2573670f0875e48cfacfb96f61a69b63c80cbec7
debug flag
analysis.py
analysis.py
#!/usr/bin/env python # -*- coding: utf-8 -*- #Author: Tim Henderson #Email: tim.tadh@hackthology.com #For licensing see the LICENSE file in the top level directory. import itertools from gram_parser import parse, EmptyString, EoS, NonTerminal def first(productions, sym): if isinstance(sym, tuple): symbo...
#!/usr/bin/env python # -*- coding: utf-8 -*- #Author: Tim Henderson #Email: tim.tadh@hackthology.com #For licensing see the LICENSE file in the top level directory. import itertools from gram_parser import parse, EmptyString, EoS, NonTerminal def first(productions, sym): if isinstance(sym, tuple): symbo...
Python
0
a26e735796534c34b31eef0d8f19eb400d137b9c
allow for empty string argument
pywebdata/baseservice.py
pywebdata/baseservice.py
import copy import json import requests from itertools import product, imap from xml.etree import ElementTree as ET from parameter import Input, Output from parsers import parse_query output_parsers = {'json': json.loads, 'xml': ET.parse} class ServiceMount(type): def __init__(self, name, bases, attrs): ...
import copy import json import requests from itertools import product, imap from xml.etree import ElementTree as ET from parameter import Input, Output from parsers import parse_query output_parsers = {'json': json.loads, 'xml': ET.parse} class ServiceMount(type): def __init__(self, name, bases, attrs): ...
Python
0.000223
6708830ab2bde841bbc3da2befbbe5ab9f3d21aa
Put test stuff inside `if __name__ == '__main__'`
ansi_str.py
ansi_str.py
import re _ansi_re = re.compile('\033\[((?:\d|;)*)([a-zA-Z])') def strip_ansi(value): return _ansi_re.sub('', value) def len_exclude_ansi(value): return len(strip_ansi(value)) class ansi_str(str): """A str subclass, specialized for strings containing ANSI escapes. When you call the ``len`` metho...
import re _ansi_re = re.compile('\033\[((?:\d|;)*)([a-zA-Z])') def strip_ansi(value): return _ansi_re.sub('', value) def len_exclude_ansi(value): return len(strip_ansi(value)) class ansi_str(str): """A str subclass, specialized for strings containing ANSI escapes. When you call the ``len`` metho...
Python
0.00001
0a4652c7221c16aa2a95e33dd9742e1d64fa45d5
Fix person search
api/view.py
api/view.py
# -*- coding: utf-8 -*- from flask import abort, make_response, request from flask.ext.sqlalchemy import BaseQuery from flask.views import MethodView from api.models.api_key import ApiKey from utils.jsonify import jsonify class ApiView(MethodView): '''Create basic REST HTTP endpoints for a single resource type....
# -*- coding: utf-8 -*- from flask import abort, make_response, request from flask.ext.sqlalchemy import BaseQuery from flask.views import MethodView from api.models.api_key import ApiKey from utils.jsonify import jsonify class ApiView(MethodView): '''Create basic REST HTTP endpoints for a single resource type....
Python
0.000004
b9e12e6bb1d4d4cdb337cbf3d3cd7a41f57b4d24
Use a more standard RPM query format
JsonStats/FetchStats/Plugins/RPM.py
JsonStats/FetchStats/Plugins/RPM.py
import datetime from JsonStats.FetchStats import Fetcher class RPM(Fetcher): def __init__(self): """ Returns an rpm manifest (all rpms installed on the system. **Note**: This takes more than a few seconds!! """ self.context = 'rpm' self._load_data() def _load_...
import datetime from JsonStats.FetchStats import Fetcher class RPM(Fetcher): def __init__(self): """ Returns an rpm manifest (all rpms installed on the system. **Note**: This takes more than a few seconds!! """ self.context = 'rpm' self._load_data() def _load_...
Python
0.999989
93e40e791153ee07dad3410388e662de99efcbb0
fix goodrain run error
app/blog.py
app/blog.py
#!/usr/bin/env python3 # coding=utf-8 """ @version:0.1 @author: ysicing @file: blog/blog.py @time: 2017/9/10 22:46 """ from flask_frozen import Freezer from flask_flatpages import FlatPages from flask import current_app as app flatpages = FlatPages(app) freezer = Freezer(app) class Post(object): def __init__...
#!/usr/bin/env python3 # coding=utf-8 """ @version:0.1 @author: ysicing @file: blog/blog.py @time: 2017/9/10 22:46 """ from flask_frozen import Freezer from flask_flatpages import FlatPages from flask import current_app as app flatpages = FlatPages(app) freezer = Freezer(app) class Post(object): def __init__...
Python
0.000011
9ec8aa9fbb9b8c6656e5fe8920787f2c03a93683
create Cell class and method add_neighbor that returns a list of neighbor positions
app/life.py
app/life.py
class Cell(object): def __init__(self, pos): self.neighbors = 0 self.neighbor_list = [] self.pos = pos self.posx = pos[0] self.posy = pos[1] def add_neighbors(self): self.neighbor_list = [] for x in xrange(self.posx-1, self.posx+1): for y in...
Python
0
f6f67e3459521ae9d707953645d04ed857a69fa1
Use chunked logfile; full one won't fit in datastore anymore
app/main.py
app/main.py
from google.appengine.api import urlfetch from google.appengine.ext import ndb import csv import re import os from cStringIO import StringIO import logging import webapp2 import jinja2 BLOCK_SIZE = 1024 * 400 JINJA_ENVIRONMENT = jinja2.Environment( loader=jinja2.FileSystemLoader(os.path.join(os.path.dirname(__...
from google.appengine.api import urlfetch from google.appengine.ext import ndb import csv import re import os from cStringIO import StringIO import webapp2 import jinja2 JINJA_ENVIRONMENT = jinja2.Environment( loader=jinja2.FileSystemLoader(os.path.join(os.path.dirname(__file__), ...
Python
0
777eaf01586b330b976c2691bf73b9a2053ff978
Store real non-stemmed texts
app/main.py
app/main.py
from flask import * import collect_hs import collections import nltk import numpy from sklearn.feature_extraction.text import CountVectorizer from sklearn.decomposition import LatentDirichletAllocation app = Flask(__name__) ## common constructs stem = nltk.stem.snowball.SnowballStemmer('finnish') @app.route("/"...
from flask import * import collect_hs import collections import nltk import numpy from sklearn.feature_extraction.text import CountVectorizer from sklearn.decomposition import LatentDirichletAllocation app = Flask(__name__) ## common constructs stem = nltk.stem.snowball.SnowballStemmer('finnish') @app.route("/"...
Python
0.000005
1056c3f489b162d77b6c117fad2b45bfa06beee1
Revert "Added a post view"
app/urls.py
app/urls.py
from django.conf.urls import patterns, include, url from django.contrib import admin from django.conf import settings #from . import views urlpatterns = patterns('', # Examples: # url(r'^$', 'app.views.home', name='home'), # url(r'^blog/', include('blog.urls')), url(r'^$', 'app.views.splash', name='sp...
from django.conf.urls import patterns, include, url from django.contrib import admin from django.conf import settings #from . import views urlpatterns = patterns('', # Examples: # url(r'^$', 'app.views.home', name='home'), # url(r'^blog/', include('blog.urls')), url(r'^$', 'app.views.splash', name='...
Python
0
1165c923145be18d40fda1fc4303cac3e1613078
Update cached_function wrapper to set qualname instead of name
app/util.py
app/util.py
# Various utility functions import os SHOULD_CACHE = os.environ.get('ENV', 'development') == 'production' def cached_function(func): data = {} def wrapper(*args): if not SHOULD_CACHE: return func(*args) cache_key = ' '.join([str(x) for x in args]) if cache_key not in dat...
# Various utility functions import os SHOULD_CACHE = os.environ.get('ENV', 'development') == 'production' def cached_function(func): data = {} def wrapper(*args): if not SHOULD_CACHE: return func(*args) cache_key = ' '.join([str(x) for x in args]) if cache_key not in dat...
Python
0
a6ad8491e8e8625acb3eee0bf703848a94f1cad8
Use title-case header name to request value
src/weitersager/http.py
src/weitersager/http.py
""" weitersager.http ~~~~~~~~~~~~~~~~ HTTP server to receive messages :Copyright: 2007-2021 Jochen Kupperschmidt :License: MIT, see LICENSE for details. """ from dataclasses import dataclass from http import HTTPStatus from http.server import BaseHTTPRequestHandler, HTTPServer import json import sys from typing impo...
""" weitersager.http ~~~~~~~~~~~~~~~~ HTTP server to receive messages :Copyright: 2007-2021 Jochen Kupperschmidt :License: MIT, see LICENSE for details. """ from dataclasses import dataclass from http import HTTPStatus from http.server import BaseHTTPRequestHandler, HTTPServer import json import sys from typing impo...
Python
0
d39eb13f555daa429838b76de2f4088a46f36237
tweak `do`
amino/do.py
amino/do.py
from types import GeneratorType from typing import TypeVar, Callable, Any, Generator, cast, Type import functools from amino.tc.base import F from amino.tc.monad import Monad A = TypeVar('A') B = TypeVar('B') G = TypeVar('G', bound=F) Do = Generator def untyped_do(f: Callable[..., Generator[G, B, None]]) -> Callabl...
from types import GeneratorType from typing import TypeVar, Callable, Any, Generator, cast, Optional, Type import functools from amino.tc.base import F from amino.tc.monad import Monad A = TypeVar('A') B = TypeVar('B') G = TypeVar('G', bound=F) Do = Generator def untyped_do(f: Callable[..., Generator[G, B, None]]) ...
Python
0.000001
98a82f084c6693dbd7cd44774f52e1bbdd835d05
Fix urls.py
rdmo/projects/urls/v1.py
rdmo/projects/urls/v1.py
from django.urls import include, path from rest_framework_extensions.routers import ExtendedDefaultRouter from ..viewsets import (CatalogViewSet, MembershipViewSet, ProjectMembershipViewSet, ProjectQuestionSetViewSet, ProjectSnapshotViewSet, ProjectValueViewSet, ...
from django.urls import include, path from rest_framework_extensions.routers import ExtendedDefaultRouter from ..viewsets import (ProjectQuestionSetViewSet, ProjectSnapshotViewSet, ProjectMembershipViewSet, ProjectValueViewSet, ProjectViewSet, MembershipViewSet, SnapshotViewSet, ...
Python
0.999857
0addd5540bfc24bff3aa2f66d78c24d83b6d275e
Use env in uninstall_hook (#677)
base_multi_image/hooks.py
base_multi_image/hooks.py
# -*- coding: utf-8 -*- # © 2016 Antiun Ingeniería S.L. - Jairo Llopis # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from odoo import api, SUPERUSER_ID import logging _logger = logging.getLogger(__name__) def pre_init_hook_for_submodules(cr, model, field): """Moves images from single to m...
# -*- coding: utf-8 -*- # © 2016 Antiun Ingeniería S.L. - Jairo Llopis # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from odoo import api, SUPERUSER_ID import logging _logger = logging.getLogger(__name__) def pre_init_hook_for_submodules(cr, model, field): """Moves images from single to m...
Python
0.000001
15a5958a92b7a1a5034cb821da0c0eb1e6b14b5c
Rename router.log *attribute* to .logger so it doesn't conflict with the router.log() method.
lib/rapidsms/router.py
lib/rapidsms/router.py
#!/usr/bin/env python # vim: ai ts=4 sts=4 et sw=4 import time import threading import log class Router (object): incoming_phases = ('parse', 'handle', 'cleanup') outgoing_phases = ('outgoing',) def __init__(self): self.backends = [] self.apps = [] self.logger = log.Log() de...
#!/usr/bin/env python # vim: ai ts=4 sts=4 et sw=4 import time import threading import log class Router (object): incoming_phases = ('parse', 'handle', 'cleanup') outgoing_phases = ('outgoing',) def __init__(self): self.backends = [] self.apps = [] self.log = log.Log() def l...
Python
0
8b7ef1066abefae83876607fd1a9153662463185
add try for obnl version loading in init
obnl/__init__.py
obnl/__init__.py
import pkg_resources # part of setuptools try: __version__ = pkg_resources.require("obnl")[0].version except: pass
import pkg_resources # part of setuptools __version__ = pkg_resources.require("obnl")[0].version
Python
0
f4d8ffbbaea5a1155540b167b740ab7bbaa4fd0f
load balance ICDS warehouse reads
corehq/sql_db/routers.py
corehq/sql_db/routers.py
from __future__ import absolute_import from django.conf import settings from corehq.sql_db.connections import connection_manager, ICDS_UCR_ENGINE_ID from .config import partition_config PROXY_APP = 'sql_proxy_accessors' FORM_PROCESSOR_APP = 'form_processor' SQL_ACCESSORS_APP = 'sql_accessors' ICDS_REPORTS_APP = 'icds...
from __future__ import absolute_import from django.conf import settings from .config import partition_config PROXY_APP = 'sql_proxy_accessors' FORM_PROCESSOR_APP = 'form_processor' SQL_ACCESSORS_APP = 'sql_accessors' ICDS_REPORTS_APP = 'icds_reports' ICDS_MODEL = 'icds_model' SCHEDULING_PARTITIONED_APP = 'scheduling_...
Python
0
32d49946279cab868b493aae432b431fa9d5e2bc
Add wrap at wrap_width unless it's 0.
autowrap.py
autowrap.py
import sublime, sublime_plugin, re, sys if sys.version >= '3': long = int class AutoWrapListener(sublime_plugin.EventListener): saved_sel = 0 def on_modified(self, view): if view.is_scratch() or view.settings().get('is_widget'): return if not view.settings().get('auto_wrap', False): retur...
import sublime, sublime_plugin, re, sys if sys.version >= '3': long = int class AutoWrapListener(sublime_plugin.EventListener): saved_sel = 0 def on_modified(self, view): if view.is_scratch() or view.settings().get('is_widget'): return if not view.settings().get('auto_wrap', False): retur...
Python
0
0f85b39fcca84b60815c54201f5f52eb9a2840c7
Split the normalize function into two.
avena/np.py
avena/np.py
#!/usr/bin/env python2 from numpy import around, empty as _empty, mean, std from numpy import int8, int16, int32, int64 from numpy import uint8, uint16, uint32, uint64 from numpy import float32, float64 from sys import float_info as _float_info _eps = 10.0 * _float_info.epsilon # Map of NumPy array type strings to ...
#!/usr/bin/env python2 from numpy import around, empty as _empty, mean, std from numpy import int8, int16, int32, int64 from numpy import uint8, uint16, uint32, uint64 from numpy import float32, float64 from sys import float_info as _float_info _eps = 10.0 * _float_info.epsilon # Map of NumPy array type strings to ...
Python
0.999846
bdcafd0c5af46e88ae06e6bbb853d415a30f8d26
test algo affine
testing/test_sct_register_multimodal.py
testing/test_sct_register_multimodal.py
#!/usr/bin/env python ######################################################################################### # # Test function for sct_register_multimodal script # # replace the shell test script in sct 1.0 # # --------------------------------------------------------------------------------------- # Copyright (c) ...
#!/usr/bin/env python ######################################################################################### # # Test function for sct_register_multimodal script # # replace the shell test script in sct 1.0 # # --------------------------------------------------------------------------------------- # Copyright (c) ...
Python
0.000001
1e704b4ac648d06a05d8c97e3ca38b64ea931c0a
Fix version number
ooni/__init__.py
ooni/__init__.py
# -*- encoding: utf-8 -*- __author__ = "Arturo Filastò" __version__ = "1.0.0-rc5" __all__ = ['config', 'inputunit', 'kit', 'lib', 'nettest', 'oonicli', 'reporter', 'templates', 'utils']
# -*- encoding: utf-8 -*- __author__ = "Arturo Filastò" __version__ = "1.0.0-rc3" __all__ = ['config', 'inputunit', 'kit', 'lib', 'nettest', 'oonicli', 'reporter', 'templates', 'utils']
Python
0.000041
0c244f0b295785378c85dfdf7a70c238d0a4f20b
Add a warning to prevent people from running nipy from the source directory.
neuroimaging/__init__.py
neuroimaging/__init__.py
# -*- coding: utf-8 -*- """ Neuroimaging tools for Python (NIPY). The aim of NIPY is to produce a platform-independent Python environment for the analysis of brain imaging data using an open development model. While the project is still in its initial stages, packages for file I/O, script support as well as single su...
# -*- coding: utf-8 -*- """ Neuroimaging tools for Python (NIPY). The aim of NIPY is to produce a platform-independent Python environment for the analysis of brain imaging data using an open development model. While the project is still in its initial stages, packages for file I/O, script support as well as single su...
Python
0
d1b6235413ffd81266e101673facef08c699f37b
Update openid.kvform
openid/kvform.py
openid/kvform.py
import logging __all__ = ['seqToKV', 'kvToSeq', 'dictToKV', 'kvToDict'] class KVFormError(ValueError): pass def seqToKV(seq, strict=False): """Represent a sequence of pairs of strings as newline-terminated key:value pairs. The pairs are generated in the order given. @param seq: The pairs @type...
__all__ = ['seqToKV', 'kvToSeq', 'dictToKV', 'kvToDict'] import types import logging class KVFormError(ValueError): pass def seqToKV(seq, strict=False): """Represent a sequence of pairs of strings as newline-terminated key:value pairs. The pairs are generated in the order given. @param seq: The pair...
Python
0.000001
0b6ced2e048d4538db68abe356b8a4719a830fa0
Check the needed env vars are provided to the backfill script
backfill.py
backfill.py
#!/usr/bin/env python import json from os import environ import boto3 if not all([environ.get('AWS_S3_BUCKET'), environ.get('AWS_SQS_URL')]): print('You have to specify the AWS_S3_BUCKET and AWS_SQS_URL environment variables.') print('Check the "Backfilling data" section of the README file for more info.') ...
#!/usr/bin/env python import json from os import environ import boto3 bucket = boto3.resource('s3').Bucket(environ.get('AWS_S3_BUCKET')) queue = boto3.resource('sqs').Queue(environ.get('AWS_SQS_URL')) items_queued = 0 for item in bucket.objects.all(): if not item.key.endswith('.json.gz'): continue ...
Python
0
d16cdad0fd12dcab26d670e83a746fede085d085
fix the test .tac to use new createService arguments
opennsa-test.tac
opennsa-test.tac
#!/usr/bin/env python # syntax highlightning import os, sys from twisted.python import log from twisted.python.log import ILogObserver from twisted.application import internet, service from opennsa import setup, registry, logging from opennsa.backends import dud from opennsa.topology import gole DEBUG = False PROF...
#!/usr/bin/env python # syntax highlightning import os, sys from twisted.python import log from twisted.python.log import ILogObserver from twisted.application import internet, service from opennsa import setup, registry, logging from opennsa.backends import dud from opennsa.topology import gole DEBUG = False PROF...
Python
0.000001
f662fafd2f69d64306ab89a1360a3cadda072b59
clean up pylint ignores to be more specific
functional/util.py
functional/util.py
# pylint: disable=no-name-in-module,unused-import import collections import six import builtins if six.PY2: from itertools import ifilterfalse as filterfalse def dict_item_iter(dictionary): return dictionary.viewitems() else: from itertools import filterfalse def dict_item_iter(dictionary): ...
# pylint: disable=no-name-in-module,unused-import,too-many-instance-attributes,too-many-arguments, too-few-public-methods import collections import six import builtins if six.PY2: from itertools import ifilterfalse as filterfalse def dict_item_iter(dictionary): return dictionary.viewitems() else: ...
Python
0
4e74723aac53956fb0316ae0d438da623de133d5
Add and update tests for video renderer
tests/extensions/video/test_renderer.py
tests/extensions/video/test_renderer.py
import pytest from mfr.core.provider import ProviderMetadata from mfr.extensions.video import VideoRenderer @pytest.fixture def metadata(): return ProviderMetadata('test', '.mp4', 'text/plain', '1234', 'http://wb.osf.io/file/test.mp4?token=1234') @pytest.fixture def file_path(): ...
import pytest from mfr.core.provider import ProviderMetadata from mfr.extensions.video import VideoRenderer @pytest.fixture def metadata(): return ProviderMetadata('test', '.mp4', 'text/plain', '1234', 'http://wb.osf.io/file/test.mp4?token=1234') @pytest.fixture def file_path(): return '/tmp/test.mp4' @...
Python
0
e1c359fab8c351c77556e34731cd677b4c0cc99b
Update mono to 4.0.1
packages/mono.py
packages/mono.py
class MonoPackage (Package): def __init__ (self): Package.__init__ (self, 'mono', '4.0.1', sources = [ 'http://download.mono-project.com/sources/%{name}/%{name}-%{version}.tar.bz2' ], configure_flags = [ '--with-jit=yes', '--with-ikvm=no', '--with-mcs-docs=no', '--with-moonlight=no', ...
class MonoPackage (Package): def __init__ (self): Package.__init__ (self, 'mono', '4.0.0', sources = [ 'http://download.mono-project.com/sources/%{name}/%{name}-%{version}.tar.bz2' ], configure_flags = [ '--with-jit=yes', '--with-ikvm=no', '--with-mcs-docs=no', '--with-moonlight=no', ...
Python
0
aed0cd2d9f82d5e028f3d98d08f0e27826765a4e
update decorators.py
stoplight/decorators.py
stoplight/decorators.py
import inspect from functools import wraps import stoplight from stoplight.exceptions import * from stoplight.rule import * def validate(**rules): """Validates a function's input using the specified set of rules.""" def _validate(f): @wraps(f) def wrapper(*args, **kwargs): funcpa...
import inspect from functools import wraps import stoplight from stoplight.exceptions import * from stoplight.rule import * def validate(**rules): """Validates a function's input using the specified set of rules.""" def _validate(f): @wraps(f) def wrapper(*args, **kwargs): funcpa...
Python
0.000001
7e627a16c85a9ffa88833176201351908a5458c2
Fix (#795)
stripe/api_resources/terminal/reader.py
stripe/api_resources/terminal/reader.py
# File generated from our OpenAPI spec from __future__ import absolute_import, division, print_function from stripe import util from stripe.api_resources.abstract import APIResourceTestHelpers from stripe.api_resources.abstract import CreateableAPIResource from stripe.api_resources.abstract import DeletableAPIResource...
# File generated from our OpenAPI spec from __future__ import absolute_import, division, print_function from stripe import util from stripe.api_resources.abstract import APIResourceTestHelpers from stripe.api_resources.abstract import CreateableAPIResource from stripe.api_resources.abstract import DeletableAPIResource...
Python
0
f6e570627cf513acb6b2de35a4ecabbadd8cfae7
Remove node-based dashboard nav
stores/dashboard/app.py
stores/dashboard/app.py
from django.conf.urls.defaults import patterns, url from oscar.core.application import Application from oscar.views.decorators import staff_member_required from stores.dashboard import views class StoresDashboardApplication(Application): name = 'stores-dashboard' store_list_view = views.StoreListView s...
from django.conf.urls.defaults import patterns, url from django.utils.translation import ugettext_lazy as _ from oscar.core.application import Application from oscar.apps.dashboard.nav import register, Node from oscar.views.decorators import staff_member_required from stores.dashboard import views node = Node(_('St...
Python
0
38de1280ff97d468dcb0214e6c1037ee12d9676b
Add another action
dashboard/controllers.py
dashboard/controllers.py
import cherrypy class Dashboard: @cherrypy.expose def index(self): return "Dashboard!" @cherrypy.expose def edit(self, number): return "Dashboard edit " + number
import cherrypy class Dashboard: @cherrypy.expose def index(self): return "Dashboard!"
Python
0.000015
cd3f94c7574825812d4e0fea6fda20f9e4432495
Test GetApplication
tests/registryd/test_root_accessible.py
tests/registryd/test_root_accessible.py
# Pytest will pick up this module automatically when running just "pytest". # # Each test_*() function gets passed test fixtures, which are defined # in conftest.py. So, a function "def test_foo(bar)" will get a bar() # fixture created for it. import pytest import dbus from utils import get_property, check_unknown_p...
# Pytest will pick up this module automatically when running just "pytest". # # Each test_*() function gets passed test fixtures, which are defined # in conftest.py. So, a function "def test_foo(bar)" will get a bar() # fixture created for it. import pytest import dbus from utils import get_property, check_unknown_p...
Python
0
2ee9e4200c90eae9739a44cb56270d0e873907e9
Add more example
pandas/pandas.py
pandas/pandas.py
import pandas as pd # Reading csv without header inp = pd.read_csv('data.txt', header=None) # Reading csv and set name of columns inp = pd.read_csv('data.txt', names=['column1', 'column2']) # Reading csv and set index inp = pd.read_csv('data.txt', index_col=['column1']) inp = pd.read_csv('data.txt', index_col=0) # ...
import pandas as pd # Reading csv without header inp = pd.read_csv('data.txt', header=None) # Retrieving particular columns by indexes, since column headers are not there X_df = inp[inp.columns[0:2]] # Converting dataframe to numpy ndarray X_nd = X_df.values
Python
0
7aab5bcf7195526c37d556872c1530051e0dc8b6
Fix summary tests
summary/test_summary.py
summary/test_summary.py
# -*- coding: utf-8 -*- import unittest from jinja2.utils import generate_lorem_ipsum # generate one paragraph, enclosed with <p> TEST_CONTENT = str(generate_lorem_ipsum(n=1)) TEST_SUMMARY = generate_lorem_ipsum(n=1, html=False) from pelican.contents import Page import pelican.settings import summary class TestS...
# -*- coding: utf-8 -*- import unittest from jinja2.utils import generate_lorem_ipsum # generate one paragraph, enclosed with <p> TEST_CONTENT = str(generate_lorem_ipsum(n=1)) TEST_SUMMARY = generate_lorem_ipsum(n=1, html=False) from pelican.contents import Page import summary class TestSummary(unittest.TestCase...
Python
0.000013
abd32bb9e79d771cae2117f9e754b4a7e38434bf
Add storage nominal capacity to parameters dict in storage_at_hvmv_substation
edisgo/flex_opt/storage_integration.py
edisgo/flex_opt/storage_integration.py
from edisgo.grid.components import Storage, Line from edisgo.grid.tools import select_cable import logging def integrate_storage(network, position, operational_mode, parameters): """ Integrate storage units in the grid and specify its operational mode Parameters ---------- network: :class:`~.gri...
from edisgo.grid.components import Storage, Line from edisgo.grid.tools import select_cable import logging def integrate_storage(network, position, operational_mode, parameters): """ Integrate storage units in the grid and specify its operational mode Parameters ---------- network: :class:`~.gri...
Python
0.000012
54fab13f466d17acfa4f9b3d67d777de8d34f67f
Remove interdependence from get_path_category()
src/core/templatetags/pycontw_tools.py
src/core/templatetags/pycontw_tools.py
import re from django.template import Library register = Library() @register.filter def message_bootstrap_class_str(message): return ' '.join('alert-' + tag for tag in message.tags.split(' ')) @register.filter def get_path_category(url): pattern = r'/(?P<lang>zh\-hant|en\-us)/(?P<category>[0-9a-z-]*)/' ...
import re from django.template import Library register = Library() @register.filter def message_bootstrap_class_str(message): return ' '.join('alert-' + tag for tag in message.tags.split(' ')) @register.filter def get_path_category(url): lang = '\/(zh\-hant|en\-us)' category_pattern_mapping = { ...
Python
0.000005
0bffe17c50c41f85a8dea42a468d282248c75ef9
Make static url absolute
svenv/svenv/settings.py
svenv/svenv/settings.py
""" Django settings for svenv 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, ...) impo...
""" Django settings for svenv 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, ...) impo...
Python
0.999822
6c14b01cca3c99fa7f0e264ef76390c9d85ce78a
add WebSocketHandler with background process
parkkeeper/ws.py
parkkeeper/ws.py
# coding: utf-8 from abc import ABCMeta, abstractclassmethod import asyncio import json from aiohttp import web, MsgType from django.utils.timezone import now from parkkeeper import models import zmq def start_server(): app = web.Application() add_routes(app) loop = asyncio.get_event_loop() handler = ...
# coding: utf-8 from abc import ABCMeta, abstractclassmethod import asyncio import json from aiohttp import web, MsgType from django.utils.timezone import now import zmq def start_server(): app = web.Application() add_routes(app) loop = asyncio.get_event_loop() handler = app.make_handler() f = loo...
Python
0
320a96337c55d770ed032520ecb75155e2d124e5
Update version
geoip2/__init__.py
geoip2/__init__.py
#pylint:disable=C0111 __title__ = 'geoip2' __version__ = '0.1.1' __author__ = 'Gregory Oschwald' __license__ = 'LGPLv2+' __copyright__ = 'Copyright 2013 Maxmind, Inc.'
#pylint:disable=C0111 __title__ = 'geoip2' __version__ = '0.1.0' __author__ = 'Gregory Oschwald' __license__ = 'LGPLv2+' __copyright__ = 'Copyright 2013 Maxmind, Inc.'
Python
0
d38fd28c47f3749ed3fb7a64827768108a413c78
introduce ec2.volume handling
src/main/python/monocyte/handler/ec2.py
src/main/python/monocyte/handler/ec2.py
from __future__ import print_function import boto import boto.ec2 from boto.exception import EC2ResponseError from monocyte.handler import Resource, aws_handler @aws_handler class Instance(object): VALID_TARGET_STATES = ["terminated", "shutting-down"] def __init__(self, region_filter, dry_run=True): ...
from __future__ import print_function import boto import boto.ec2 from boto.exception import EC2ResponseError from monocyte.handler import Resource, aws_handler @aws_handler class Handler(object): VALID_TARGET_STATES = ["terminated", "shutting-down"] def __init__(self, region_filter, dry_run=True): ...
Python
0
01dd6198cba28623e3d2a72bc9b1f720a70112f0
Bump version to 0.2.1
geomet/__init__.py
geomet/__init__.py
# Copyright 2013 Lars Butler & individual contributors # # 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 applicab...
# Copyright 2013 Lars Butler & individual contributors # # 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 applicab...
Python
0.000001
ab8d6fc2163e7170e8d184f1321119bbcd469709
Update ipc_lista1.9.py
lista1/ipc_lista1.9.py
lista1/ipc_lista1.9.py
#ipc_lista1.9 #Professor: Jucimar Junior #Any Mendes Carvalho - 1615310044 # # # # #Faça um programa que peça a temperatura em graus Fahrenheit, transforme e mostre a temperatura em graus Celsius.
#ipc_lista1.9 #Professor: Jucimar Junior #Any Mendes Carvalho - 1615310044 # # # # #Faça um programa que peça a temperatura em graus Fahrenheit, transforme e mostre a temperatura em graus Celsius.
Python
0
c9ba6d141e356b48caf1820a309e554f21e016c4
Transpose guards against None result
sympy/matrices/expressions/transpose.py
sympy/matrices/expressions/transpose.py
from sympy import Basic, Q from sympy.functions import adjoint, conjugate from sympy.matrices.expressions.matexpr import MatrixExpr from sympy.matrices import MatrixBase class Transpose(MatrixExpr): """ The transpose of a matrix expression. This is a symbolic object that simply stores its argument withou...
from sympy import Basic, Q from sympy.functions import adjoint, conjugate from sympy.matrices.expressions.matexpr import MatrixExpr from sympy.matrices import MatrixBase class Transpose(MatrixExpr): """ The transpose of a matrix expression. This is a symbolic object that simply stores its argument withou...
Python
0.000244
6a0fd67cbe50ee952c0b8ab1a7dc29fa7b3449f5
Log task name more succinctly
nodepool/task_manager.py
nodepool/task_manager.py
#!/usr/bin/env python # Copyright (C) 2011-2013 OpenStack Foundation # # 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 ...
#!/usr/bin/env python # Copyright (C) 2011-2013 OpenStack Foundation # # 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 ...
Python
0.999999
df4a47a1111908e7120cd9ef296322a41c8cc5aa
Update windows-1251 file scanner
enc/tools/contrib/techtonik/rucheck.py
enc/tools/contrib/techtonik/rucheck.py
#!/usr/bin/env python2 # -*- coding:windows-1251 -*- """Find files with letters in russian windows-1251 encoding. windows-1251 is a single byte encoding with a range 0xC0-0xFF and 0xA8,0xB8 for symbols and respectfully. Unfortunately, russian symbols in windows-1251 clash with russian symbols in utf-8, where they t...
#!/usr/bin/env python2 # -*- coding:windows-1251 -*- """Find files with letters in russian windows-1251 encoding. If English encyclopedia files contain Russian letters they are considered untranslated unless <!-- NLC --> marker is present at the same line in HTML code. """ # pythonized by techtonik // gmail.com im...
Python
0
4e53b01f2024e320e4c31ded5d6ad7187aa6868b
Make Wordclient a class
Wordclient.py
Wordclient.py
from __future__ import print_function from Commons import * from Spider import * from Edge import * class Wordclient: def __init__(self, word): ''' Constructor to crawl web for a word ''' self.word = word sp = Spider(word) self.web = sp.crawl() # Crawled web def printweb(word, web): ''' To Print en...
from __future__ import print_function from Commons import * from Spider import * from Edge import * def Printpaths(word, web): ''' To print paths to a specific word in web ''' if word in web: paths = web[word] print ('TO : ',word) for i, path in enumerate(paths): print ('PATH', i+1,' :',end='') score =...
Python
0.00261
e2f49a941ac34d86be2fbea177e7f84685787c91
Add rdfs:label and make first type less confusing For #7-pure-papers
src/main/python/dot/rural/sepake/oai.py
src/main/python/dot/rural/sepake/oai.py
''' Created on 2 Dec 2014 @author: Niels Christensen ''' from dot.rural.sepake.xml_to_rdf import XMLGraph import urllib2 from rdflib.term import URIRef _PATH_TO_RESUMPTION_TOKEN = URIRef(u'http://www.openarchives.org/OAI/2.0/#resumptionToken') / URIRef(u'http://www.w3.org/1999/02/22-rdf-syntax-ns#value') _CONSTRUCT_...
''' Created on 2 Dec 2014 @author: Niels Christensen ''' from dot.rural.sepake.xml_to_rdf import XMLGraph import urllib2 from rdflib.term import URIRef _PATH_TO_RESUMPTION_TOKEN = URIRef(u'http://www.openarchives.org/OAI/2.0/#resumptionToken') / URIRef(u'http://www.w3.org/1999/02/22-rdf-syntax-ns#value') _CONSTRUCT_...
Python
0.000001
92699fa0ac8c97a5a54da2a4155b08145c524d5d
revert the previous change: regression found
web_seven/openerpweb.py
web_seven/openerpweb.py
# -*- coding: utf-8 -*- def patch_web7(): import babel import os.path import openerp.addons.web try: from openerp.addons.web import http as openerpweb except ImportError: # OpenERP Web 6.1 return # Adapt the OpenERP Web 7.0 method for OpenERP 6.1 server @openerpwe...
# -*- coding: utf-8 -*- def patch_web7(): import babel import os.path import sys import openerp.addons.web try: from openerp.addons.web import http as openerpweb except ImportError: # OpenERP Web 6.1 return # Self-reference for 6.1 modules which import 'web.common...
Python
0.000306
d091f28028af0d303dc0e8fe76f18b9aa82fda81
Tidy up comments in Method according to PEP 8
malcolm/core/method.py
malcolm/core/method.py
#!/bin/env dls-python from collections import OrderedDict from malcolm.core.loggable import Loggable class Method(Loggable): """Exposes a function with metadata for arguments and return values""" def __init__(self, name): super(Method, self).__init__(logger_name=name) self.name = name ...
#!/bin/env dls-python from collections import OrderedDict from malcolm.core.loggable import Loggable class Method(Loggable): """Exposes a function with metadata for arguments and return values""" def __init__(self, name): super(Method, self).__init__(logger_name=name) self.name = name ...
Python
0