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
44db9815aeaad8b23eecebd3e761466ffdf854f4
Normalize target dir, ensure we have target path.
scaffolder/vcs.py
scaffolder/vcs.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import traceback import subprocess import os import sys import shutil def normalize_path(file_path, mkdir=False): file_path = os.path.realpath(os.path.expanduser(file_path)) if mkdir and not os.path.isdir(file_path): os.makedirs(file_path) return file...
#!/usr/bin/env python # -*- coding: utf-8 -*- import traceback import subprocess import os import sys import shutil def ensure_path(path): pass class VCS(): def __init__(self, url=''): """ https://github.com/CG-TTDET/Platform.git git@github.com:goliatone/minions.git https:/...
Python
0
d00d809735210f53c3da71195107f1991814eb52
fix minor bug most likely due to merge error
labonneboite/common/models/user_favorite_offices.py
labonneboite/common/models/user_favorite_offices.py
# coding: utf8 import datetime from sqlalchemy import Column, ForeignKey, UniqueConstraint from sqlalchemy import desc from sqlalchemy import Integer, String, DateTime from sqlalchemy.orm import relationship from labonneboite.common.database import Base from labonneboite.common.database import db_session from labonn...
# coding: utf8 import datetime from sqlalchemy import Column, ForeignKey, UniqueConstraint from sqlalchemy import desc from sqlalchemy import Integer, String, DateTime from sqlalchemy.orm import relationship from labonneboite.common.database import Base from labonneboite.common.database import db_session from labonn...
Python
0.000001
02d6e904fe02a4c53b1878a3f6c44c074de47d79
Add __str__ to Decorator
api/python/schwa/dr/decoration.py
api/python/schwa/dr/decoration.py
""" Utilities for managing document decoration by marking the document with the set of decorations that have been applied to it. """ from functools import wraps, partial def decorator(key=None): """ Wraps a docrep decorator, ensuring it is only executed once per document. Duplication is checked using the given...
""" Utilities for managing document decoration by marking the document with the set of decorations that have been applied to it. """ from functools import wraps, partial def decorator(key=None): """ Wraps a docrep decorator, ensuring it is only executed once per document. Duplication is checked using the given...
Python
0.999998
53829f5a65727ba5ba0b69785bd74bf77d3e2ecf
Remove bogus shebang line.
cli/hack.py
cli/hack.py
# Copyright 2011 Digg, 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 writ...
# Copyright 2011 Digg, 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 writ...
Python
0
d7e6db61a0100e69b9a18c17a906e094e91ce7b3
fix wrong keyword param (passws) to MySQLdb.connect
database.py
database.py
""" Database Manager. """ import MySQLdb import MySQLdb.cursors class DatabaseManager(object): def __init__(self, host, user, passwd, database, charset='utf8', large_scale=False): """Be careful using large_scale=True, SSDictCursor seems not reliable.""" self.conn = MySQLdb.connect(host=host, user=...
""" Database Manager. """ import MySQLdb import MySQLdb.cursors class DatabaseManager(object): def __init__(self, host, user, passwd, database, charset='utf8', large_scale=False): """Be careful using large_scale=True, SSDictCursor seems not reliable.""" self.conn = MySQLdb.connect(host=host, user=...
Python
0.000026
4baba777801765b0ce9025c9ef170d3465d874fc
Add state class measurement to SwitchBot signal strength sensors (#79886)
homeassistant/components/switchbot/sensor.py
homeassistant/components/switchbot/sensor.py
"""Support for SwitchBot sensors.""" from __future__ import annotations from homeassistant.components.sensor import ( SensorDeviceClass, SensorEntity, SensorEntityDescription, SensorStateClass, ) from homeassistant.config_entries import ConfigEntry from homeassistant.const import ( PERCENTAGE, ...
"""Support for SwitchBot sensors.""" from __future__ import annotations from homeassistant.components.sensor import ( SensorDeviceClass, SensorEntity, SensorEntityDescription, SensorStateClass, ) from homeassistant.config_entries import ConfigEntry from homeassistant.const import ( PERCENTAGE, ...
Python
0
2e164c5fe2e3a208dbdcbc51f287a9e5b7cc34a8
Add package_data entry in setup.py
setup.py
setup.py
from setuptools import setup from klink import __version__ setup( name='klink', version=__version__, url='https://github.com/pmorissette/klink', description='Klink is a simple and clean theme for creating Sphinx docs, inspired by jrnl', license='MIT', author='Philippe Morissette', author_em...
from setuptools import setup from klink import __version__ setup( name='klink', version=__version__, url='https://github.com/pmorissette/klink', description='Klink is a simple and clean theme for creating Sphinx docs, inspired by jrnl', license='MIT', author='Philippe Morissette', author_em...
Python
0.000001
64c50a273c3e113affdb700f137bda78fd1a684d
update examples/progressbar.by
examples/progressbar.py
examples/progressbar.py
#!/usr/bin/env python # Tai Sakuma <sakuma@fnal.gov> from AlphaTwirl.ProgressBar import ProgressBar, ProgressBar2, MPProgressMonitor, ProgressReport from AlphaTwirl.EventReader import MPEventLoopRunner import time, random ##____________________________________________________________________________|| class EventLoop(...
#!/usr/bin/env python # Tai Sakuma <sakuma@fnal.gov> from AlphaTwirl.ProgressBar import ProgressBar, MPProgressMonitor, ProgressReport from AlphaTwirl.EventReader import MPEventLoopRunner import time, random ##____________________________________________________________________________|| class EventLoop(object): d...
Python
0
f8bd4073beb50f9fb750170e79804d13ea50db0b
update example
examples/raster_mesh.py
examples/raster_mesh.py
from bluesky.examples import Mover, SynGauss, Syn2DGauss import bluesky.plans as bp import bluesky.spec_api as bsa import bluesky.callbacks from bluesky.standard_config import gs import bluesky.qt_kicker bluesky.qt_kicker.install_qt_kicker() # motors theta = Mover('theta', ['theta']) gamma = Mover('gamma', ['gamma']) ...
from bluesky.examples import Mover, SynGauss, Syn2DGauss import bluesky.simple_scans as bss import bluesky.spec_api as bsa import bluesky.callbacks from bluesky.standard_config import gs import bluesky.qt_kicker # motors theta = Mover('theta', ['theta']) gamma = Mover('gamma', ['gamma']) # synthetic detectors coupled...
Python
0
2fe555e71d0b428a85c63c39dcfeecb30420f9b1
Handle SIGTERM by raising SystemExit
src/main/python/afp_alppaca/main.py
src/main/python/afp_alppaca/main.py
from __future__ import print_function, absolute_import, unicode_literals, division import argparse import signal import sys import threading from afp_alppaca.assume_role import AssumedRoleCredentialsProvider from afp_alppaca.ims_interface import IMSCredentialsProvider from afp_alppaca.scheduler import Scheduler from ...
from __future__ import print_function, absolute_import, unicode_literals, division import argparse import signal import sys import threading from afp_alppaca.assume_role import AssumedRoleCredentialsProvider from afp_alppaca.ims_interface import IMSCredentialsProvider from afp_alppaca.scheduler import Scheduler from ...
Python
0
5da88c648e338d21b782a8a36a69e873da6c04ae
use --http-socket rather than --http for uwsgi
gnocchi/cli/api.py
gnocchi/cli/api.py
# Copyright (c) 2013 Mirantis Inc. # Copyright (c) 2015-2017 Red Hat # # 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 a...
# Copyright (c) 2013 Mirantis Inc. # Copyright (c) 2015-2017 Red Hat # # 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 a...
Python
0
f8bb295bf1d10410d36a8a8880ff96303bbda451
Update announcements.py
announcements.py
announcements.py
import sys import icalendar import requests import pytz from datetime import datetime, timedelta from libs import post_text from icalendar import Calendar from database import find_bot_nname import re r = requests.get(sys.argv[2]) icsData = r.text cal = Calendar.from_ical(icsData) for evt in cal.subcomponents: p...
import sys import icalendar import requests import pytz from datetime import datetime, timedelta from libs import post_text from icalendar import Calendar from database import find_bot_nname import re r = requests.get(sys.argv[2]) icsData = r.text cal = Calendar.from_ical(icsData) for evt in cal.subcomponents: p...
Python
0
d7a4948b8ee015ad918dac473114b728c65418f8
add total number of assignments to progress API (AA-816)
lms/djangoapps/course_home_api/progress/v1/serializers.py
lms/djangoapps/course_home_api/progress/v1/serializers.py
""" Progress Tab Serializers """ from rest_framework import serializers from rest_framework.reverse import reverse from lms.djangoapps.course_home_api.mixins import VerifiedModeSerializerMixin class CourseGradeSerializer(serializers.Serializer): """ Serializer for course grade """ letter_grade = seria...
""" Progress Tab Serializers """ from rest_framework import serializers from rest_framework.reverse import reverse from lms.djangoapps.course_home_api.mixins import VerifiedModeSerializerMixin class CourseGradeSerializer(serializers.Serializer): """ Serializer for course grade """ letter_grade = seria...
Python
0
c5e13436d7d453bd851e39591f82e2ef0d740d92
Fix typo
pyfarm/scheduler/celery_app.py
pyfarm/scheduler/celery_app.py
# No shebang line, this module is meant to be imported # # Copyright 2014 Ambient Entertainment GmbH & Co. KG # # 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/lice...
# No shebang line, this module is meant to be imported # # Copyright 2014 Ambient Entertainment GmbH & Co. KG # # 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/lice...
Python
0.999999
f755f9857020cfceaeb3cf9607e96cef66ccb048
update dev version after 0.21.1 tag [skip ci]
py/desitarget/_version.py
py/desitarget/_version.py
__version__ = '0.21.1.dev2037'
__version__ = '0.21.1'
Python
0
47527996fe967d8ef713ff8814f71d49ab539fd8
update version
grizli/version.py
grizli/version.py
# git describe --tags __version__ = "0.6.0-109-g647e4b4"
# git describe --tags __version__ = "0.6.0-86-g140db75"
Python
0
b493082352de19ed8d3d52c8eda838064957bbc2
bump version to 1.2-BETA2
libnamebench/version.py
libnamebench/version.py
VERSION = '1.2-BETA2'
VERSION = '1.2-BETA1'
Python
0
19cfe70c69b026429454fb8361ec3e8d6f1a0505
add show/hide requested signals
pyqode/core/widgets/preview.py
pyqode/core/widgets/preview.py
""" This module contains a widget that can show the html preview of an editor. """ from weakref import proxy from pyqode.qt import QtCore, QtWebWidgets from pyqode.core.api import DelayJobRunner class HtmlPreviewWidget(QtWebWidgets.QWebView): hide_requested = QtCore.Signal() show_requested = QtCore.Signal() ...
""" This module contains a widget that can show the html preview of an editor. """ from weakref import proxy from pyqode.qt import QtCore, QtWebWidgets from pyqode.core.api import DelayJobRunner class HtmlPreviewWidget(QtWebWidgets.QWebView): def __init__(self, parent=None): super(HtmlPreviewWidget, self)...
Python
0
d428bb582c6fe71e39bdedfbed1b355421f48139
Fix that
src/mysql_proto/com/stmt/prepare.py
src/mysql_proto/com/stmt/prepare.py
#!/usr/bin/env python # coding=utf-8 from packet import Packet from proto import Proto from flags import Flags class Prepare(Packet): query = "" def getPayload(self): payload = bytearray() payload.extend(Proto.build_byte(Flags.COM_STMT_PREPARE)) payload.extend(Proto.build...
#!/usr/bin/env python # coding=utf-8 from packet import Packet from proto import Proto from flags import Flags class Prepare(Packet): query = "" def getPayload(self): payload = bytearray() payload.extend(Proto.build_byte(Flags.COM_STMT_PREPARE)) payload.extend(Proto.build...
Python
0.999999
76611b7e6e97089b93626b472f91c04f16644034
Fix up some comments
channels/management/commands/runserver.py
channels/management/commands/runserver.py
import threading from django.core.management.commands.runserver import \ Command as RunserverCommand from channels import DEFAULT_CHANNEL_LAYER, channel_layers from channels.handler import ViewConsumer from channels.log import setup_logger from channels.worker import Worker class Command(RunserverCommand): ...
import threading from django.core.management.commands.runserver import \ Command as RunserverCommand from channels import DEFAULT_CHANNEL_LAYER, channel_layers from channels.handler import ViewConsumer from channels.log import setup_logger from channels.worker import Worker class Command(RunserverCommand): ...
Python
0.000153
e451ea4d698450813bd11fed6b501b839cd477a6
Reformat runworker a bit
channels/management/commands/runworker.py
channels/management/commands/runworker.py
from __future__ import unicode_literals from django.core.management import BaseCommand, CommandError from channels import DEFAULT_CHANNEL_LAYER, channel_layers from channels.log import setup_logger from channels.worker import Worker class Command(BaseCommand): leave_locale_alone = True def add_arguments(s...
from __future__ import unicode_literals from django.core.management import BaseCommand, CommandError from channels import DEFAULT_CHANNEL_LAYER, channel_layers from channels.log import setup_logger from channels.worker import Worker class Command(BaseCommand): leave_locale_alone = True def add_arguments(s...
Python
0
f980f4b557df7cb4984cb428dd4bebcfe7ca7bc6
use urgent when you got mails
py3status/modules/imap.py
py3status/modules/imap.py
# -*- coding: utf-8 -*- """ Display number of unread messages from IMAP account. Configuration parameters: allow_urgent: display urgency on unread messages (default False) cache_timeout: refresh interval for this module (default 60) criterion: status of emails to check for (default 'UNSEEN') format: di...
# -*- coding: utf-8 -*- """ Display number of unread messages from IMAP account. Configuration parameters: cache_timeout: refresh interval for this module (default 60) criterion: status of emails to check for (default 'UNSEEN') format: display format for this module (default 'Mail: {unseen}') hide_if_z...
Python
0
596f9752a7956c259217b0528bed924812d0631f
Add admin filter to filter attendees with children.
pyconde/accounts/admin.py
pyconde/accounts/admin.py
from django.contrib import admin from django.contrib.admin import SimpleListFilter from . import models class WithChildrenFilter(SimpleListFilter): title = 'Anzahl Kinder' parameter_name = 'children' def lookups(self, request, model_admin): return (('y', 'mit Kindern'), ('n', 'oh...
from django.contrib import admin from . import models admin.site.register(models.Profile, list_display=['user'])
Python
0
1b5b43542fe3ba8f85076c6b6cb1e98a4614a0c6
reformat JobGroup to match other tables
pyfarm/models/jobgroup.py
pyfarm/models/jobgroup.py
# No shebang line, this module is meant to be imported # # Copyright 2015 Ambient Entertainment GmbH & Co. KG # Copyright 2015 Oliver Palmer # # 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 # ...
# No shebang line, this module is meant to be imported # # Copyright 2015 Ambient Entertainment GmbH & Co. KG # # 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/lice...
Python
0.000001
853878cbf218728608a783260ae74c408ef4b8a2
fix the wrong format
python/paddle/fluid/average.py
python/paddle/fluid/average.py
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
Python
0.999964
662aaa79305cbbbceeba8d46f9a7e543621f45a3
Add harvest edit view
Seeder/harvests/views.py
Seeder/harvests/views.py
import time import models import source import forms import datetime from django.http.response import Http404, HttpResponseRedirect from django.utils.translation import ugettext_lazy as _ from django.views.generic.base import TemplateView from django.views.generic import DetailView, FormView from urljects import U, ...
import time import models import forms import datetime from django.http.response import Http404, HttpResponseRedirect from django.utils.translation import ugettext_lazy as _ from django.views.generic.base import TemplateView from django.views.generic import DetailView, FormView from urljects import U, URLView, pk fr...
Python
0
f4106e3025c5dbb3136db94081b9998a052c8e70
Bump version to 2.0.0-alpha2
pyqode/python/__init__.py
pyqode/python/__init__.py
# -*- coding: utf-8 -*- """ pyqode.python is an extension of pyqode.core that brings support for the python programming language. It does so by providing a set of additional modes and panels for the frontend and by supplying dedicated workers for the backend. """ __version__ = "2.0.0-alpha2"
# -*- coding: utf-8 -*- """ pyqode.python is an extension of pyqode.core that brings support for the python programming language. It does so by providing a set of additional modes and panels for the frontend and by supplying dedicated workers for the backend. """ __version__ = "2.0.0-alpha1"
Python
0.000001
d96aac74b32a166ec724234540dc93a8ea526a3f
fix test error in windows
pythainlp/tag/__init__.py
pythainlp/tag/__init__.py
# -*- coding: utf-8 -*- # TODO ปรับ API ให้เหมือน nltk from __future__ import absolute_import,division,print_function,unicode_literals import sys def pos_tag(text,engine='old'): """ ระบบ postaggers pos_tag(text,engine='old') engine ที่รองรับ * old เป็น UnigramTagger * artagger เป็น RDR POS Tagger """ if engin...
# -*- coding: utf-8 -*- # TODO ปรับ API ให้เหมือน nltk from __future__ import absolute_import,division,print_function,unicode_literals import sys def pos_tag(text,engine='old'): """ ระบบ postaggers pos_tag(text,engine='old') engine ที่รองรับ * old เป็น UnigramTagger * artagger เป็น RDR POS Tagger """ if engin...
Python
0.000001
6d6ba9e84c0b53cc05cec36047c8e701493d826e
Update rules
pythainlp/tokenize/tcc.py
pythainlp/tokenize/tcc.py
# -*- coding: utf-8 -*- """ The implementation of tokenizer accorinding to Thai Character Clusters (TCCs) rules purposed by `Theeramunkong et al. 2000. \ <http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.59.2548>`_ Credits: * TCC: Jakkrit TeCho * Grammar: Wittawat Jitkrittum (`link to the source fil...
# -*- coding: utf-8 -*- """ The implementation of tokenizer accorinding to Thai Character Clusters (TCCs) rules purposed by `Theeramunkong et al. 2000. \ <http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.59.2548>`_ Credits: * TCC: Jakkrit TeCho * Grammar: Wittawat Jitkrittum (`link to the source fil...
Python
0.000001
8dc08d3733461ebe0ea770d0af07fdd4cfa00b64
Use mujoco function instead.
python/mujoco/__init__.py
python/mujoco/__init__.py
# Copyright 2022 DeepMind Technologies Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agre...
# Copyright 2022 DeepMind Technologies Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agre...
Python
0
adb0c2bd97c6c4ca7272d764b669cef90f81a5bb
Allow non-dev logins to dev builds
handlers/login.py
handlers/login.py
from rorn.Box import LoginBox, ErrorBox, WarningBox, SuccessBox from rorn.Session import delay from User import User from Button import Button from LoadValues import isDevMode from Event import Event from utils import * @get('login') def login(handler, request): handler.title('Login') if handler.session['user']: ...
from rorn.Box import LoginBox, ErrorBox, WarningBox, SuccessBox from rorn.Session import delay from User import User from Button import Button from LoadValues import isDevMode from Event import Event from utils import * @get('login') def login(handler, request): handler.title('Login') if handler.session['user']: ...
Python
0
64713296cf4f4f3772a1ac23248d4fb930ee23ff
Bump to 0.3
python_gdrive/__init__.py
python_gdrive/__init__.py
from client import GoogleDrive __version__ = '0.3'
from client import GoogleDrive __version__ = '0.3-dev'
Python
0.000198
dcd84fec03daee62f05a70b93753d88cb356f196
add skipping of empty lines
catdumps.py
catdumps.py
""" Concatenates dumps from a LAMMPS script. All dumps in the given LAMMPS script will be concatenated into single files separately, which are to be written in the current working directory. """ import argparse import re import os.path import glob def main(): """Drive the script.""" parser = argparse.Argum...
""" Concatenates dumps from a LAMMPS script. All dumps in the given LAMMPS script will be concatenated into single files separately, which are to be written in the current working directory. """ import argparse import re import os.path import glob def main(): """Drive the script.""" parser = argparse.Argum...
Python
0.000035
3475aee89ef5b22a92a674400ea37430f8255924
handle Appengine Datastore Key Type
huTools/hujson.py
huTools/hujson.py
#!/usr/bin/env python # encoding: utf-8 """ hujson.py - extended json - tries to be compatible with simplejson hujson can encode additional types like decimal and datetime into valid json. All the heavy lifting is done by John Millikin's `jsonlib`, see https://launchpad.net/jsonlib Created by Maximillian Dornseif on ...
#!/usr/bin/env python # encoding: utf-8 """ hujson.py - extended json - tries to be compatible with simplejson hujson can encode additional types like decimal and datetime into valid json. All the heavy lifting is done by John Millikin's `jsonlib`, see https://launchpad.net/jsonlib Created by Maximillian Dornseif on ...
Python
0
530844a16a573ab49850a22631f97d8ad89465c9
Clean Up NLU state
sara_flexbe_states/src/sara_flexbe_states/sara_nlu_spr.py
sara_flexbe_states/src/sara_flexbe_states/sara_nlu_spr.py
#!/usr/bin/env python # encoding=utf8 from __future__ import print_function from flexbe_core import EventState, Logger import rospy from wm_nlu.srv import AnswerQuestion from std_msgs.msg import String class SaraNLUspr(EventState): ''' Use wm_nlu to parse a sentence and return the answer. ># sentence ...
#!/usr/bin/env python # encoding=utf8 from __future__ import print_function from flexbe_core import EventState, Logger import rospy import re from wm_nlu.srv import AnswerQuestion from std_msgs.msg import String class SaraNLUspr(EventState): ''' Use wm_nlu to parse a sentence and return the detected actions i...
Python
0
142d3ebf66e31aad2363fc0c421dc573dc9b1157
Simplify current_service() function
ci/utils.py
ci/utils.py
# -*- coding: utf-8 -*- """This module defines functions generally useful in scikit-ci.""" import os try: from .constants import SERVICES, SERVICES_ENV_VAR except (SystemError, ValueError): from constants import SERVICES, SERVICES_ENV_VAR def current_service(): for service, env_var in SERVICES_ENV_VAR....
# -*- coding: utf-8 -*- """This module defines functions generally useful in scikit-ci.""" import os try: from .constants import SERVICES, SERVICES_ENV_VAR except (SystemError, ValueError): from constants import SERVICES, SERVICES_ENV_VAR def current_service(): for service in SERVICES.keys(): i...
Python
0.000006
9a7c0a07d14b81b134963a9459326ffdb53cf28d
Disable fe build
ci/zoeci.py
ci/zoeci.py
#!/usr/bin/env python3 # Copyright (c) 2016, Quang-Nhat Hoang-Xuan # # 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 ap...
#!/usr/bin/env python3 # Copyright (c) 2016, Quang-Nhat Hoang-Xuan # # 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 ap...
Python
0.000001
89766874e7ef17bdce4cfa7cae9898336928c19e
Remove satellites from JSON
modules/gy-gps6mv1/core/get.py
modules/gy-gps6mv1/core/get.py
#! /usr/bin/python # Written by Dan Mandle http://dan.mandle.me September 2012 # Modified by Broda Noel @brodanoel (in all social networks) # License: GPL 2.0 from gps import * from time import * import time import threading import sys gpsd = None #seting the global variable class GpsPoller(threading.Thread): def ...
#! /usr/bin/python # Written by Dan Mandle http://dan.mandle.me September 2012 # Modified by Broda Noel @brodanoel (in all social networks) # License: GPL 2.0 from gps import * from time import * import time import threading import sys gpsd = None #seting the global variable class GpsPoller(threading.Thread): def ...
Python
0.000003
3685715cd260f4f5ca392caddf7fb0c01af9ebcc
Add in comments for orgs and places too, remove limit
mzalendo/comments2/feeds.py
mzalendo/comments2/feeds.py
from disqus.wxr_feed import ContribCommentsWxrFeed # from comments2.models import Comment from core.models import Person, Place, Organisation # http://help.disqus.com/customer/portal/articles/472150-custom-xml-import-format class CommentWxrFeed(ContribCommentsWxrFeed): link = "/" def items(self): li...
from disqus.wxr_feed import ContribCommentsWxrFeed # from comments2.models import Comment from core.models import Person # http://help.disqus.com/customer/portal/articles/472150-custom-xml-import-format class CommentWxrFeed(ContribCommentsWxrFeed): link = "/" def items(self): return Person.objects.a...
Python
0
fe998a48be769f6a957611584145706b71385cc9
Fix airflow jobs check cmd for TriggererJob (#19185)
airflow/jobs/__init__.py
airflow/jobs/__init__.py
# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not...
# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not...
Python
0
d266de64cbcc7ed8672e9bb61cdb966870fccfdc
Use random.choice() & reduce len() duplication
alg_percentile_select.py
alg_percentile_select.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function import random def percentile_select(ls, k): """Kth percentile selection algorithm. Just select the kth element, without caring about the relative ordering of the rest of them. The algorithm per...
from __future__ import absolute_import from __future__ import division from __future__ import print_function import random def percentile_select(ls, k): """Kth percentile selection algorithm. Just select the kth element, without caring about the relative ordering of the rest of them. The algorithm per...
Python
0.000677
d1c16f90ca86bc1bd11a81f021d8317a82902a69
print annotation
ui/app/models.py
ui/app/models.py
from . import db class Spans(db.Model): __tablename__ = 'zipkin_spans' span_id = db.Column(db.Integer) parent_id = db.Column(db.Integer) trace_id = db.Column(db.Integer) span_name = db.Column(db.String(255)) debug = db.Column(db.Integer) duration = db.Column(db.Integer) created_ts = db....
from . import db class Spans(db.Model): __tablename__ = 'zipkin_spans' span_id = db.Column(db.Integer) parent_id = db.Column(db.Integer) trace_id = db.Column(db.Integer) span_name = db.Column(db.String(255)) debug = db.Column(db.Integer) duration = db.Column(db.Integer) created_ts = db....
Python
0.000009
b38555ff465f59333f32c2bb556f6b7a236e288b
disable traceview for now
seabus/web/web.py
seabus/web/web.py
from flask import Flask import oboe from oboeware import OboeMiddleware from seabus.web.blueprint import blueprint from seabus.common.database import db from seabus.web.socketio import socketio def create_app(config=None): app = Flask(__name__) if config is not None: app.config.from_object('seabus.web...
from flask import Flask import oboe from oboeware import OboeMiddleware from seabus.web.blueprint import blueprint from seabus.common.database import db from seabus.web.socketio import socketio def create_app(config=None): app = Flask(__name__) if config is not None: app.config.from_object('seabus.web...
Python
0
b5241e62cb7cc09b5d469f1cf3908fa1d7cedc21
Tweak the settings.
gobble/settings.py
gobble/settings.py
"""User configurable settings""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from future import standard_library standard_library.install_aliases() from os import getenv from logging import DEBUG, INFO from os.pa...
"""User configurable settings""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from future import standard_library standard_library.install_aliases() from os import getenv from logging import DEBUG, INFO from os.pa...
Python
0
2050017ced613f5c0282dcfaf07494b8dbcc8e41
Update ipc_lista2.05.py
lista2/ipc_lista2.05.py
lista2/ipc_lista2.05.py
#ipc_lista2.05 #Professor: Jucimar Junior #Any Mendes Carvalho - 1615310044 # # # # #Faça um programa para a leitura de duas notas parciais de um aluno. O programa deve calcular a média alcançada por aluno e apresentar: #--A mensagem "Aprovado", se a média alcançada for maior ou igual a sete; #--A mensagem "Reprovado"...
#ipc_lista2.05 #Professor: Jucimar Junior #Any Mendes Carvalho - 1615310044 # # # # #Faça um programa para a leitura de duas notas parciais de um aluno. O programa deve calcular a média alcançada por aluno e apresentar: #--A mensagem "Aprovado", se a média alcançada for maior ou igual a sete; #--A mensagem "Reprovado"...
Python
0
e1fb17476770620546d0bd244b35591b99ba6ea7
Revert 7392f01f for pkg_resources/extern. 3.3 is the right signal there.
pkg_resources/extern/__init__.py
pkg_resources/extern/__init__.py
import sys class VendorImporter: """ A PEP 302 meta path importer for finding optionally-vendored or otherwise naturally-installed packages from root_name. """ def __init__(self, root_name, vendored_names=(), vendor_pkg=None): self.root_name = root_name self.vendored_names = set(v...
import sys class VendorImporter: """ A PEP 302 meta path importer for finding optionally-vendored or otherwise naturally-installed packages from root_name. """ def __init__(self, root_name, vendored_names=(), vendor_pkg=None): self.root_name = root_name self.vendored_names = set(v...
Python
0
f3da1fab9af2279182a09922aae00fcee73a92ee
Fix imports for Django >= 1.6
goog/middleware.py
goog/middleware.py
from django.conf import settings try: from django.conf.urls.defaults import patterns, include except ImportError: # Django >= 1.6 from django.conf.urls import patterns, include import goog.urls from goog import utils class GoogDevelopmentMiddleware(object): def devmode_enabled(self, request): ""...
from django.conf import settings from django.conf.urls.defaults import patterns, include import goog.urls from goog import utils class GoogDevelopmentMiddleware(object): def devmode_enabled(self, request): """Returns True iff the devmode is enabled.""" return utils.is_devmode() def process_r...
Python
0
91178909bab31e9db42d86d5783152890f65795d
update cms
cms/urls.py
cms/urls.py
from django.conf.urls import url from cms import views from django.contrib.auth import views as auth_views urlpatterns = [ # 一覧 url(r'^dailyreport/$', views.daily_list, name='daily_list'), # 日報操作 url(r'^dailyreport/add/$', views.daily_edit, name='daily_add'), # 登録 url(r'^dailyreport/mod/(?P<daily_...
from django.conf.urls import url from cms import views from django.contrib.auth import views as auth_views urlpatterns = [ # 一覧 url(r'^dailyreport/$', views.daily_list, name='daily_list'), # 日報操作 url(r'^dailyreport/add/$', views.daily_edit, name='daily_add'), # 登録 url(r'^dailyreport/mod/(?P<daily_...
Python
0
b7d29e2a67c314b5d1aff343eef1a9ca2c3b0cbe
add dbl integration
cogs/dbl.py
cogs/dbl.py
import dbl from cogs.cog import Cog import logging import asyncio from threading import Thread logger = logging.getLogger('debug') class DBApi(Cog): def __init__(self, bot): super().__init__(bot) self._token = self.bot.config.dbl_token self.dbl = dbl.Client(self.bot, self._token) ...
import dbl from cogs.cog import Cog import logging import asyncio from threading import Thread logger = logging.getLogger('debug') class DBApi(Cog): def __init__(self, bot): super().__init__(bot) self._token = self.bot.config.dbl_token self.dbl = dbl.Client(self.bot, self._token) ...
Python
0
1212966326eb096e10b52277b0c6b53126262e3b
Improve messages in example
examples/basic_usage.py
examples/basic_usage.py
import os from twilio.twiml import Response from twilio.rest import Client ACCOUNT_SID = os.environ.get('TWILIO_ACCOUNT_SID') AUTH_TOKEN = os.environ.get('TWILIO_AUTH_TOKEN') def example(): """ Some example usage of different twilio resources. """ client = Client(ACCOUNT_SID, AUTH_TOKEN) # Get...
import os from twilio.twiml import Response from twilio.rest import Client ACCOUNT_SID = os.environ.get('TWILIO_ACCOUNT_SID') AUTH_TOKEN = os.environ.get('TWILIO_AUTH_TOKEN') def example(): """ Some example usage of different twilio resources. """ client = Client(ACCOUNT_SID, AUTH_TOKEN) print...
Python
0.000028
9b5dc2f9998d374263b2e1d35d6b5cfc7a831b1e
undo setuid on return
univention-openvpn/openvpn-master2.py
univention-openvpn/openvpn-master2.py
# # Univention OpenVPN integration -- openvpn-master2.py # __package__ = '' # workaround for PEP 366 import listener from univention import debug as ud import univention.uldap as ul from datetime import date from M2Crypto import RSA, BIO from base64 import b64decode name = 'openvpn-master2' descript...
# # Univention OpenVPN integration -- openvpn-master2.py # __package__ = '' # workaround for PEP 366 import listener from univention import debug as ud import univention.uldap as ul from datetime import date from M2Crypto import RSA, BIO from base64 import b64decode name = 'openvpn-master2' descript...
Python
0.000002
5ab3f3d06216381b697781d80069354745110de1
make yaml put out unicode
plexlibrary/utils.py
plexlibrary/utils.py
# -*- coding: utf-8 -*- import yaml from yaml import Loader, SafeLoader class Colors(object): RED = "\033[1;31m" BLUE = "\033[1;34m" CYAN = "\033[1;36m" GREEN = "\033[0;32m" RESET = "\033[0;0m" BOLD = "\033[;1m" REVERSE = "\033[;7m" class YAMLBase(object): def __init__(self, filenam...
# -*- coding: utf-8 -*- import yaml class Colors(object): RED = "\033[1;31m" BLUE = "\033[1;34m" CYAN = "\033[1;36m" GREEN = "\033[0;32m" RESET = "\033[0;0m" BOLD = "\033[;1m" REVERSE = "\033[;7m" class YAMLBase(object): def __init__(self, filename): with open(filename, 'r')...
Python
0.000063
16bec17e7337fd1cbaef12934cfeae05a563719f
fix var scoping bug
inbox/util/url.py
inbox/util/url.py
from dns.resolver import Resolver from dns.resolver import NoNameservers, NXDOMAIN, Timeout, NoAnswer from urllib import urlencode from inbox.log import get_logger import re log = get_logger('inbox.util.url') from inbox.providers import providers # http://www.regular-expressions.info/email.html EMAIL_REGEX = re.compi...
from dns.resolver import Resolver from dns.resolver import NoNameservers, NXDOMAIN, Timeout, NoAnswer from urllib import urlencode from inbox.log import get_logger import re log = get_logger('inbox.util.url') from inbox.providers import providers # http://www.regular-expressions.info/email.html EMAIL_REGEX = re.compi...
Python
0
201a9d75e9c4a2c84372fe58a674977f2435130f
update fastapi example.
examples/fastapi/app.py
examples/fastapi/app.py
from fastapi import FastAPI, HTTPException, APIRouter from honeybadger import honeybadger, contrib import pydantic honeybadger.configure(api_key='c10787cf') app = FastAPI(title="Honeybadger - FastAPI.") app.add_middleware(contrib.ASGIHoneybadger, params_filters=["client"]) @app.get("/raise_some_error", tags=["Notify...
from fastapi import FastAPI, HTTPException, APIRouter from honeybadger import honeybadger, contrib from honeybadger.contrib import asgi from honeybadger.contrib import fastapi import pydantic honeybadger.configure(api_key='c10787cf') app = FastAPI() # contrib.FastAPIHoneybadger(app) app.add_middleware(asgi.ASGIHoneyb...
Python
0
ba084db6c16e5dee9e9ff06a3bee02f4dbfb5c82
Add environment variable to control use of UNIX socket proxying
powerstrip.tac
powerstrip.tac
import os from twisted.application import service, internet #from twisted.protocols.policies import TrafficLoggingFactory from urlparse import urlparse from powerstrip.powerstrip import ServerProtocolFactory application = service.Application("Powerstrip") DOCKER_HOST = os.environ.get('DOCKER_HOST') ENABLE_UNIX_SOCKE...
import os from twisted.application import service, internet #from twisted.protocols.policies import TrafficLoggingFactory from urlparse import urlparse from powerstrip.powerstrip import ServerProtocolFactory application = service.Application("Powerstrip") DOCKER_HOST = os.environ.get('DOCKER_HOST') if DOCKER_HOST is...
Python
0
33e693337ab646eaccb724b9c4b3eb3352c6e412
fix pagination
mapentity/pagination.py
mapentity/pagination.py
from rest_framework_datatables.pagination import DatatablesPageNumberPagination class MapentityDatatablePagination(DatatablesPageNumberPagination): """ Custom datatable pagination for Mapentity list views. """ pass # def get_count_and_total_count(self, queryset, view): # """ Handle count for all f...
from rest_framework_datatables.pagination import DatatablesPageNumberPagination class MapentityDatatablePagination(DatatablesPageNumberPagination): """ Custom datatable pagination for Mapentity list views. """ def get_count_and_total_count(self, queryset, view): """ Handle count for all filters """ ...
Python
0.998471
c7679393ae11766cc9da4474f4db1d0dbe50ac91
Bump to 0.11.0
watchman/__init__.py
watchman/__init__.py
__version__ = '0.11.0'
__version__ = '0.10.1'
Python
0.000042
815fecf36f9c0114a9aa8594b58226ead223b313
fix type bug
app/app.py
app/app.py
"""Do work""" import argparse import logging import os import sys from cameracontroller.cameracontroller import CameraController from storage.cloudstorage import CloudStorage logger = logging.getLogger('pypic') log_dir = os.path.expanduser('~/log') if not os.path.exists(log_dir): os.makedirs(log_dir) logging.bas...
"""Do work""" import argparse import logging import os import sys from cameracontroller.cameracontroller import CameraController from storage.cloudstorage import CloudStorage logger = logging.getLogger('pypic') log_dir = os.path.expanduser('~/log') if not os.path.exists(log_dir): os.makedirs(log_dir) logging.bas...
Python
0.000001
b0dd7879fbf2000c86a2f77995495d480c890713
Add search by location
usecases/events/search_by_location.py
usecases/events/search_by_location.py
from predicthq import Client # Please copy paste your access token here # or read our Quickstart documentation if you don't have a token yet # https://developer.predicthq.com/guides/quickstart/ ACCESS_TOKEN = 'abc123' phq = Client(access_token=ACCESS_TOKEN) # The events endpoint supports three types of search by lo...
from predicthq import Client # Please copy paste your access token here # or read our Quickstart documentation if you don't have a token yet # https://developer.predicthq.com/guides/quickstart/ ACCESS_TOKEN = 'abc123' phq = Client(access_token=ACCESS_TOKEN)
Python
0
997cd53d1d045840118876227b9c5588e153195b
fix not equal override. thanks @hodgestar
cms/models.py
cms/models.py
import re import unicodedata RE_NUMERICAL_SUFFIX = re.compile(r'^[\w-]*-(\d+)+$') from gitmodel import fields, models class FilterMixin(object): @classmethod def filter(cls, **fields): items = list(cls.all()) for field, value in fields.items(): if hasattr(cls, field): ...
import re import unicodedata RE_NUMERICAL_SUFFIX = re.compile(r'^[\w-]*-(\d+)+$') from gitmodel import fields, models class FilterMixin(object): @classmethod def filter(cls, **fields): items = list(cls.all()) for field, value in fields.items(): if hasattr(cls, field): ...
Python
0.000002
dbfb095f6b90c2517416652d53b6db6b5ee919a4
Bump version
fabdeploy/__init__.py
fabdeploy/__init__.py
VERSION = (0, 3, 4, 'final', 0) def get_version(): version = '%s.%s' % (VERSION[0], VERSION[1]) if VERSION[2]: version = '%s.%s' % (version, VERSION[2]) if VERSION[3:] == ('alpha', 0): version = '%s pre-alpha' % version else: if VERSION[3] != 'final': version = '%s ...
VERSION = (0, 3, 3, 'final', 0) def get_version(): version = '%s.%s' % (VERSION[0], VERSION[1]) if VERSION[2]: version = '%s.%s' % (version, VERSION[2]) if VERSION[3:] == ('alpha', 0): version = '%s pre-alpha' % version else: if VERSION[3] != 'final': version = '%s ...
Python
0
dc49ce292d4e0669598abb7f45ba389efde0dabc
Fix testTeleopPanel
src/python/tests/testTeleopPanel.py
src/python/tests/testTeleopPanel.py
from director import robotsystem from director.consoleapp import ConsoleApp from director import transformUtils from director import visualization as vis from director import objectmodel as om from director import teleoppanel from director import playbackpanel from director import planningutils from PythonQt import Qt...
from director import robotsystem from director.consoleapp import ConsoleApp from director import transformUtils from director import visualization as vis from director import objectmodel as om from director import teleoppanel from director import playbackpanel from PythonQt import QtCore, QtGui import numpy as np d...
Python
0.000001
0d056e041f141391b115aef1f1cc5aa684876535
save signature saliency
view_saliency.py
view_saliency.py
#!/usr/bin/env python import cv2 import numpy import sys import salienpy.frequency_tuned import salienpy.signature def main(img): cv2.imshow('Original Image', img) ftuned = salienpy.frequency_tuned.frequency_tuned_saliency(img) cv2.imshow('Frequency Tuned', ftuned) signa = salienpy.signature.signature_...
#!/usr/bin/env python import cv2 import numpy import sys import salienpy.frequency_tuned import salienpy.signature def main(img): cv2.imshow('Original Image', img) ftuned = salienpy.frequency_tuned.frequency_tuned_saliency(img) cv2.imshow('Frequency Tuned', ftuned) signa = salienpy.signature.signature_...
Python
0
28968ca117fc18dfe513c06ce4ead2295830fd94
remove redundant parenthesis
plugins/BasePlugin.py
plugins/BasePlugin.py
__author__ = 'marcusmorgenstern' __mail__ = '' from abc import ABCMeta, abstractmethod class BasePlugin: """ Metaclass for guarantee of interface. Each plugin must provide initialisation taking optional configuration and invoke method taking data """ __metaclass__ = ABCMeta def __init__(sel...
__author__ = 'marcusmorgenstern' __mail__ = '' from abc import ABCMeta, abstractmethod class BasePlugin(): """ Metaclass for guarantee of interface. Each plugin must provide initialisation taking optional configuration and invoke method taking data """ __metaclass__ = ABCMeta def __init__(s...
Python
0.999999
b754ee143ed0a022706bfeed287e392e11dd0e28
Update to work with python3
external/stacktracer.py
external/stacktracer.py
"""Stack tracer for multi-threaded applications. Usage: import stacktracer stacktracer.start_trace("trace.html",interval=5,auto=True) # Set auto flag to always update file! .... stacktracer.stop_trace() """ # Source: http://code.activestate.com/recipes/577334-how-to-debug-deadlocked-multi-threaded-programs/ impor...
"""Stack tracer for multi-threaded applications. Usage: import stacktracer stacktracer.start_trace("trace.html",interval=5,auto=True) # Set auto flag to always update file! .... stacktracer.stop_trace() """ # Source: http://code.activestate.com/recipes/577334-how-to-debug-deadlocked-multi-threaded-programs/ impor...
Python
0
79e2044380d2d5a9568b76777bc7b1950dcaaeb8
Bump version to 14.1.0
recipe_scrapers/__version__.py
recipe_scrapers/__version__.py
__version__ = "14.1.0"
__version__ = "14.0.0"
Python
0
725785c59ca6aca23338b0f727dd2c492cb166df
fix a silly bug
process/LDA.py
process/LDA.py
# -*- coding: utf-8 -*- import jieba import time import json import pickle import os from sklearn.feature_extraction.text import CountVectorizer from sklearn.decomposition import LatentDirichletAllocation from util import RAW_DATA_DIR from util import STOP_WORDS from util import LDA_MODEL_PATH from util import DOC_PAT...
# -*- coding: utf-8 -*- import jieba import time import json import pickle import os from sklearn.feature_extraction.text import CountVectorizer from sklearn.decomposition import LatentDirichletAllocation from util import RAW_DATA_DIR from util import STOP_WORDS from util import LDA_MODEL_PATH from util import DOC_PAT...
Python
0.000753
7009e1f0b316da5f17247786810676f70d282f93
Add assertion.__all__
extenteten/assertion.py
extenteten/assertion.py
import collections import numpy import tensorflow as tf from .util import func_scope __all__ = [ 'is_int', 'is_natural_num', 'is_natural_num_sequence', 'is_sequence', 'assert_no_nan', ] def is_int(num): return (isinstance(num, int) or isinstance(num, numpy.integer) o...
import collections import numpy import tensorflow as tf from .util import func_scope def is_int(num): return (isinstance(num, int) or isinstance(num, numpy.integer) or (isinstance(num, numpy.ndarray) and num.ndim == 0 and issubclass(num.dtype.type, numpy.in...
Python
0.002638
3876130a94f3a43a6b34dd3be22ef963238bda3b
fix migration
mygpo/usersettings/migrations/0002_move_existing.py
mygpo/usersettings/migrations/0002_move_existing.py
import json from django.db import migrations def move_podcastsettings(apps, schema_editor): PodcastConfig = apps.get_model("subscriptions", "PodcastConfig") UserSettings = apps.get_model("usersettings", "UserSettings") ContentType = apps.get_model('contenttypes', 'ContentType') for cfg in PodcastCo...
import json from django.db import migrations from django.contrib.contenttypes.models import ContentType def move_podcastsettings(apps, schema_editor): PodcastConfig = apps.get_model("subscriptions", "PodcastConfig") UserSettings = apps.get_model("usersettings", "UserSettings") for cfg in PodcastConfig....
Python
0
5c50d3fcda08da468b2f6b5e61fa1777cc08b17b
FIx test.
kolibri/content/test/test_downloadcontent.py
kolibri/content/test/test_downloadcontent.py
import os import tempfile import hashlib import mimetypes from django.test import TestCase, Client from django.test.utils import override_settings from kolibri.auth.models import DeviceOwner from kolibri.content.models import File, ContentNode from kolibri.content.utils.paths import get_content_storage_file_path from l...
import os import tempfile import hashlib import mimetypes from django.test import TestCase, Client from django.test.utils import override_settings from kolibri.auth.models import DeviceOwner from kolibri.content.models import File, ContentNode from kolibri.content.utils.paths import get_content_storage_file_path from l...
Python
0
b410cbc1d58c5dce85b1bdff85fa881de58bf299
fix BadArgument
cogs/error.py
cogs/error.py
#!/bin/env python from discord.ext.commands import errors import sys import traceback class ErrorHandler: def __init__(self, bot): self.bot = bot async def on_command_error(self, ctx, error): """ Handle command errors more gracefully """ if isinstance(error, errors.CommandNotFound):...
#!/bin/env python from discord.ext.commands import errors import sys import traceback class ErrorHandler: def __init__(self, bot): self.bot = bot async def on_command_error(self, ctx, error): """ Handle command errors more gracefully """ if isinstance(error, errors.CommandNotFound):...
Python
0.998609
164f8e665dd2a292dbfe44ba98989725c209990d
Update radio.py
cogs/radio.py
cogs/radio.py
from .utils import config, checks, formats import discord from discord.ext import commands import discord.utils from .utils.api.pycopy import Copy import random, json, asyncio class Radio: """The radio-bot related commands.""" def __init__(self, bot): self.bot = bot self.player = N...
from .utils import config, checks, formats import discord from discord.ext import commands import discord.utils from .utils.api.pycopy import Copy import random, json, asyncio class Radio: """The radio-bot related commands.""" def __init__(self, bot): self.bot = bot self.player = N...
Python
0.000001
1a83696454d5be09b07d1e1e6a23ea76c77012a9
Fix global imports
src/rnaseq_lib/__init__.py
src/rnaseq_lib/__init__.py
import rnaseq_lib.civic import rnaseq_lib.data import rnaseq_lib.diff_exp import rnaseq_lib.dim_red import rnaseq_lib.docker import rnaseq_lib.drugs import rnaseq_lib.graphs import rnaseq_lib.gtf import rnaseq_lib.images import rnaseq_lib.plot import rnaseq_lib.plot.dr import rnaseq_lib.plot.hview import rnaseq_lib.ti...
import rnaseq_lib.R import rnaseq_lib.civic import rnaseq_lib.data import rnaseq_lib.de import rnaseq_lib.dim_red import rnaseq_lib.docker import rnaseq_lib.drugs import rnaseq_lib.graphs import rnaseq_lib.gtf import rnaseq_lib.images import rnaseq_lib.plotting import rnaseq_lib.tissues import rnaseq_lib.utils import ...
Python
0.005989
1a6516765f7d95d8a3d89449dc181a9de27cb868
Shove the input into the main method
files/create_project.py
files/create_project.py
# # This script checks to see if a project exists for the given # app_env/team. # import os import sys from optparse import OptionParser from urllib import quote def build_parser(): parser = OptionParser() parser.add_option("-p", "--project", dest="project", help="Application/Project name.", type="string") ...
# # This script checks to see if a project exists for the given # app_env/team. # import os import sys from optparse import OptionParser from urllib import quote from sentry.utils.runner import configure configure() from django.conf import settings # Add in the sentry object models from sentry.models import Organiza...
Python
0.999874
918a168b53e9f026393aaa17347fc855f7e4a70a
add background task, remove extra roles code, use .format
files/devops/fabfile.py
files/devops/fabfile.py
# Fabfile from Quickstart # qkst.io/devops/fabfile from fabric.api import ( task, parallel, roles, run, local, sudo, put, env, settings ) from fabric.contrib.project import rsync_project from fabric.context_managers import cd, prefix from fabric.tasks import execute env.hosts = ['root@localhost:22'] @t...
# Fabfile from Quickstart # qkst.io/devops/fabfile from fabric.api import ( task, parallel, roles, run, local, sudo, put, env, settings ) from fabric.contrib.project import rsync_project from fabric.context_managers import cd, prefix from fabric.tasks import execute env.user = 'root' env.roledefs = { ...
Python
0.000001
a4f69decb2b22822660033265a6517510c8a2eb5
clean up some convert some strings to fstrings use fewer imports
cogs/utils.py
cogs/utils.py
# -*- coding: utf-8 -*- from discord.ext import commands from datetime import datetime from cogs.cog import Cog import discord class Utils(Cog): """The description for Utils goes here.""" @commands.command(name='reload', hidden=True) @commands.is_owner() async def cog_reload(self, ctx, *, cog: str):...
# -*- coding: utf-8 -*- from discord.ext import commands from datetime import datetime from cogs.cog import Cog import discord class Utils(Cog): """The description for Utils goes here.""" @commands.command(name='reload', hidden=True) @commands.is_owner() async def cog_reload(self, ctx, *, cog: str):...
Python
0.000523
ba81222c33b4b80c5148c21bb30c60412c85847b
Fix search query
files/kernel-cleanup.py
files/kernel-cleanup.py
#!/usr/bin/env python2.7 """ kernel-cleanup.py Find all installed kernel-related packages and mark them as automatically installed. Then, purge those of these packages that APT now considers auto-removable. Ubuntu APT has logic that prevents us from removing all kernels this way. As an additional safeguard, we always...
#!/usr/bin/env python2.7 """ kernel-cleanup.py Find all installed kernel-related packages and mark them as automatically installed. Then, purge those of these packages that APT now considers auto-removable. Ubuntu APT has logic that prevents us from removing all kernels this way. As an additional safeguard, we always...
Python
0.999382
1c17b4b10374129d9e26f7023a93ea587dfe7fc7
update version number to 1.0.10-pre as prep for staging/release
findingaids/__init__.py
findingaids/__init__.py
__version_info__ = (1, 0, 10, 'pre') # Dot-connect all but the last. Last is dash-connected if not None. __version__ = '.'.join(str(i) for i in __version_info__[:-1]) if __version_info__[-1] is not None: __version__ += ('-%s' % (__version_info__[-1],)) #THIS IS DUPLICATE CODE FROM DWRANGLER AND SHOULD EVENTUALLY...
__version_info__ = (1, 0, 9, None) # Dot-connect all but the last. Last is dash-connected if not None. __version__ = '.'.join(str(i) for i in __version_info__[:-1]) if __version_info__[-1] is not None: __version__ += ('-%s' % (__version_info__[-1],)) #THIS IS DUPLICATE CODE FROM DWRANGLER AND SHOULD EVENTUALLY B...
Python
0
8700bcaabc2470849a47383c991c37a886da1b4a
add profiler
corehq/apps/data_interfaces/dispatcher.py
corehq/apps/data_interfaces/dispatcher.py
from django.utils.decorators import method_decorator from corehq import privileges from corehq.apps.accounting.decorators import requires_privilege_with_fallback from corehq.apps.reports.dispatcher import ReportDispatcher, ProjectReportDispatcher, datespan_default from corehq.apps.users.decorators import require_permis...
from django.utils.decorators import method_decorator from corehq import privileges from corehq.apps.accounting.decorators import requires_privilege_with_fallback from corehq.apps.reports.dispatcher import ReportDispatcher, ProjectReportDispatcher, datespan_default from corehq.apps.users.decorators import require_permis...
Python
0.000002
61e67ed5740148f74e67aef09afc65ef1c3fd6a8
Handle commands in a very trivial way
hackday_bot/bot.py
hackday_bot/bot.py
"""hackday_bot.bot module.""" import logging import re import time from prawcore.exceptions import PrawcoreException AVAILABLE_COMMANDS = ('help', 'interested', 'join', 'leave', 'uninterested') COMMAND_RE = re.compile(r'(?:\A|\s)!({})(?=\s|\Z)' .format('|'.join(AVAILABLE_COMMANDS))) logger =...
"""hackday_bot.bot module.""" import logging import time from prawcore.exceptions import PrawcoreException logger = logging.getLogger(__package__) class Bot(object): """Bot manages comments made to the specified subreddit.""" def __init__(self, subreddit): """Initialize an instance of Bot. ...
Python
0.00022
8c519c3d91e7bb9acf7f2bfedbf97c7b2a911a14
add host and port params to Emulator
anom/testing/emulator.py
anom/testing/emulator.py
import logging import os import re import signal import shlex import subprocess from queue import Empty, Queue from threading import Thread #: The command to run in order to start the emulator. _emulator_command = "gcloud beta emulators datastore start --consistency={consistency:0.2f} --host-port={host}:{port} --no-...
import logging import os import re import signal import shlex import subprocess from queue import Empty, Queue from threading import Thread #: The command to run in order to start the emulator. _emulator_command = "gcloud beta emulators datastore start --consistency={consistency:0.2f} --no-store-on-disk" #: The reg...
Python
0
61cf4e2feb3d8920179e28719822c7fb34ea6550
Add defaults to the ibm RNG
3/ibm_rng.py
3/ibm_rng.py
def ibm_rng(x1, a=65539, c=0, m=2**31): x = x1 while True: x = (a * x + c) % m yield x / (m-1) def main(): rng = ibm_rng(1, 65539, 0, 2**31) while True: x = next(rng) print(x) if __name__ == '__main__': main()
def ibm_rng(x1, a, c, m): x = x1 while True: x = (a * x + c) % m yield x / (m-1) def main(): rng = ibm_rng(1, 65539, 0, 2**31) while True: x = next(rng) print(x) if __name__ == '__main__': main()
Python
0.000002
776c2992b64911f86740cdf0af4f05c7587430c7
Bump version
hbmqtt/__init__.py
hbmqtt/__init__.py
# Copyright (c) 2015 Nicolas JOUANIN # # See the file license.txt for copying permission. VERSION = (0, 9, 5, 'alpha', 0)
# Copyright (c) 2015 Nicolas JOUANIN # # See the file license.txt for copying permission. VERSION = (0, 9, 4, 'final', 0)
Python
0
0202eeed429149cbfafd53d9ba6281a0926ea9df
Add labels to account forms and add a NewUserWithPasswordForm that adds password inputs to the new user form.
froide/account/forms.py
froide/account/forms.py
from django import forms from django.utils.translation import ugettext as _ from django.utils.safestring import mark_safe from django.core.urlresolvers import reverse from django.contrib.auth.models import User from helper.widgets import EmailInput class NewUserForm(forms.Form): first_name = forms.CharField(max_l...
from django import forms from django.utils.translation import ugettext as _ from django.utils.safestring import mark_safe from django.core.urlresolvers import reverse from django.contrib.auth.models import User from helper.widgets import EmailInput class NewUserForm(forms.Form): first_name = forms.CharField(max_l...
Python
0
2db84e6c94fdc8de821a98442ce928db9dd73441
Sponsored event should dump title
src/remotedb/dumpers.py
src/remotedb/dumpers.py
import collections import functools import urllib.parse from django.core.serializers.json import DjangoJSONEncoder SITE_PREFIX = 'https://tw.pycon.org/2016/media/' USER_DUMP_KEYS = [ 'bio', 'email', 'speaker_name', 'facebook_profile_url', 'github_id', 'twitter_id', ] PROPOSAL_DUMP_KEYS = SPONSORED_EVENT_DU...
import collections import functools import urllib.parse from django.core.serializers.json import DjangoJSONEncoder SITE_PREFIX = 'https://tw.pycon.org/2016/media/' USER_DUMP_KEYS = [ 'bio', 'email', 'speaker_name', 'facebook_profile_url', 'github_id', 'twitter_id', ] PROPOSAL_DUMP_KEYS = SPONSORED_EVENT_DU...
Python
0.999635
3c4e65f123dc56255262e38a934b9cacd03c0bfe
remove debug prints
django_babel/management/commands/babel.py
django_babel/management/commands/babel.py
#-*- coding: utf-8 -*- import os from distutils.dist import Distribution from optparse import make_option from subprocess import call from django.core.management.base import LabelCommand, CommandError from django.conf import settings class Command(LabelCommand): args = '[makemessages] [compilemessages]' op...
#-*- coding: utf-8 -*- import os from distutils.dist import Distribution from optparse import make_option from subprocess import call from django.core.management.base import LabelCommand, CommandError from django.conf import settings class Command(LabelCommand): args = '[makemessages] [compilemessages]' op...
Python
0.000001
294254aad0d798ffcfca6e34b48b4ed704bb5cd0
Simplify CachingManager logic
django_prices_openexchangerates/models.py
django_prices_openexchangerates/models.py
from __future__ import unicode_literals from decimal import Decimal from django.conf import settings from django.core.exceptions import ValidationError from django.core.cache import cache from django.db import models from django.utils.translation import ugettext_lazy as _ from django.utils.encoding import python_2_un...
from __future__ import unicode_literals from decimal import Decimal from django.conf import settings from django.core.exceptions import ValidationError from django.core.cache import cache from django.db import models from django.utils.translation import ugettext_lazy as _ from django.utils.encoding import python_2_un...
Python
0.000007
a21b9588002013c5efff895e63f29fe362110656
Spell checker: identify multiple positions of mispelled word - precision : 0.05457300369812355 - recall : 0.6653793967226803
src/righter/__init__.py
src/righter/__init__.py
""" Identifies common English writing mistakes """ import re import unicodedata from righter import dictionary from righter import utils def findall(sub, string): """ >>> text = "Allowed Hello Hollow" >>> tuple(findall('ll', text)) (1, 10, 16) """ index = 0 - len(sub) try: while Tr...
""" Identifies common English writing mistakes """ import re import unicodedata from righter import dictionary from righter import utils def check_spelling(text): """ Check if a text has spelling errors. Return a list with objects: { "selection": <wrong-spelled-word>, "star...
Python
0.999581
2a5fbcd2e3da01150c2690c145100270d3f0ec81
fix clipnorm
model/lang_model_sgd.py
model/lang_model_sgd.py
import copy import numpy as np import tensorflow as tf from keras import backend as K from keras.optimizers import Optimizer from keras.callbacks import LearningRateScheduler from model.setting import Setting class LangModelSGD(Optimizer): def __init__(self, setting, verbose=True): super(LangModelSGD, se...
import copy import numpy as np import tensorflow as tf from keras import backend as K from keras.optimizers import Optimizer from keras.callbacks import LearningRateScheduler from model.setting import Setting class LangModelSGD(Optimizer): def __init__(self, setting, verbose=True): super(LangModelSGD, se...
Python
0.000001
db3cee63baf64d00b2d2ac4fcf726f287b6d7af2
Update call to proxy fix to use new method signature
app/proxy_fix.py
app/proxy_fix.py
from werkzeug.middleware.proxy_fix import ProxyFix class CustomProxyFix(object): def __init__(self, app, forwarded_proto): self.app = ProxyFix(app, x_for=1, x_proto=1, x_host=1, x_port=0, x_prefix=0) self.forwarded_proto = forwarded_proto def __call__(self, environ, start_response): e...
from werkzeug.middleware.proxy_fix import ProxyFix class CustomProxyFix(object): def __init__(self, app, forwarded_proto): self.app = ProxyFix(app) self.forwarded_proto = forwarded_proto def __call__(self, environ, start_response): environ.update({ "HTTP_X_FORWARDED_PROTO"...
Python
0
fee4ec26f52c584faa0aa5e35de955972b7c56bd
return a sorted list so tests can be deterministic
lms/djangoapps/bulk_user_retirement/views.py
lms/djangoapps/bulk_user_retirement/views.py
""" An API for retiring user accounts. """ import logging from edx_rest_framework_extensions.auth.jwt.authentication import JwtAuthentication from django.contrib.auth import get_user_model from django.db import transaction from rest_framework import permissions, status from rest_framework.response import Response from...
""" An API for retiring user accounts. """ import logging from edx_rest_framework_extensions.auth.jwt.authentication import JwtAuthentication from django.contrib.auth import get_user_model from django.db import transaction from rest_framework import permissions, status from rest_framework.response import Response from...
Python
0.99995
d56cfbf87c01ac496200341a723ddcee88798a01
Add setup of default translator object so doctests can run when using _. Fixes #509.
pylons/test.py
pylons/test.py
"""Test related functionality Adds a Pylons plugin to `nose <http://www.somethingaboutorange.com/mrl/projects/nose/>`_ that loads the Pylons app *before* scanning for doc tests. This can be configured in the projects :file:`setup.cfg` under a ``[nosetests]`` block: .. code-block:: ini [nosetests] with-p...
"""Test related functionality Adds a Pylons plugin to `nose <http://www.somethingaboutorange.com/mrl/projects/nose/>`_ that loads the Pylons app *before* scanning for doc tests. This can be configured in the projects :file:`setup.cfg` under a ``[nosetests]`` block: .. code-block:: ini [nosetests] with-p...
Python
0
4db28d9f8ae0c3ad22121226c1ec0b59f4258759
Update pylsy.py
pylsy/pylsy.py
pylsy/pylsy.py
# -*- coding: utf-8 -*- from __future__ import print_function class PylsyTable(object): def __init__(self, attributes): self.Attributes = attributes self.Table = [] self.AttributesLength = [] self.cols_num = len(self.Attributes) self.lines_num = 0 ...
# -*- coding: utf-8 -*- from __future__ import print_function class PylsyTable(object): def __init__(self, attributes): self.Attributes = attributes self.Table = [] self.AttributesLength = [] self.cols_num = len(self.Attributes) self.lines_num = 0 ...
Python
0
ad78e28d4537054a0d19643bb7efb1572dd4702c
Encode topic heading as UTF8
app/utils/pdf.py
app/utils/pdf.py
import pdftotext from PIL import Image from wand.image import Image import os import io TOPICS = [ 'Philosophy', 'Society', 'Esoterica', 'Art', 'Culture', 'Science & Nature', 'Gods & Heroes', 'Myths Of The World' ] def extract_first_page(blob): pdf = Image(blob=blob, resolution=20...
import pdftotext from PIL import Image from wand.image import Image import os import io TOPICS = [ 'Philosophy', 'Society', 'Esoterica', 'Art', 'Culture', 'Science & Nature', 'Gods & Heroes', 'Myths Of The World' ] def extract_first_page(blob): pdf = Image(blob=blob, resolution=20...
Python
0.999996
747d2563fd566a70420a04d3db209fffc813f147
fix docs/hash-tree.py for python 3
docs/hash-tree.py
docs/hash-tree.py
#!/usr/bin/env python # Write a directory to the Git index. # Prints the directory's SHA-1 to stdout. # # Copyright 2013 Lars Buitinck / University of Amsterdam. # License: MIT (http://opensource.org/licenses/MIT) # Based on: # https://github.com/larsmans/seqlearn/blob/d7a3d82c/doc/hash-tree.py import os from os.pat...
#!/usr/bin/env python # Write a directory to the Git index. # Prints the directory's SHA-1 to stdout. # # Copyright 2013 Lars Buitinck / University of Amsterdam. # License: MIT (http://opensource.org/licenses/MIT) # https://github.com/larsmans/seqlearn/blob/d7a3d82c/doc/hash-tree.py import os from os.path import spl...
Python
0.00011
34c0c6c73a65da3120aa52600254afc909e9a3bc
Remove unused main and unused imports
pytach/wsgi.py
pytach/wsgi.py
import bottle import config from web import web app = application = bottle.Bottle() app.merge(web.app) config.arguments['--verbose'] = True
import bottle from bottle import route, run from web import web import config app = application = bottle.Bottle() app.merge(web.app) config.arguments['--verbose'] = True if __name__ == '__main__': app.run(host='0.0.0.0', port=8082, debug=True)
Python
0
bea0ead3dfcc055d219966c64437652c0eb2cf84
Update demo.py
python/demo.py
python/demo.py
#! /usr/bin/env python import serial import time # Serial port N = "/dev/ttyUSB0" def ints2str(lst): ''' Taking a list of notes/lengths, convert it to a string ''' s = "" for i in lst: if i < 0 or i > 255: raise Exception s = s + str(chr(i)) return s # do some ini...
#! /usr/bin/env python import serial import time import sys # Serial port N = "/dev/ttyUSB0" def ints2str(lst): ''' Taking a list of notes/lengths, convert it to a string ''' s = "" for i in lst: if i < 0 or i > 255: raise Exception s = s + str(chr(i)) return s # d...
Python
0.000001
1ca6ccb50992836720e86a7c3c766a5497cf7588
Remove unused import
mint/django_rest/rbuilder/querysets/views.py
mint/django_rest/rbuilder/querysets/views.py
#!/usr/bin/python # # Copyright (c) 2011 rPath, Inc. # # All rights reserved. # from mint.django_rest.deco import return_xml, requires from mint.django_rest.rbuilder import service class BaseQuerySetService(service.BaseService): pass class QuerySetService(BaseQuerySetService): @return_xml def rest_GET(s...
#!/usr/bin/python # # Copyright (c) 2011 rPath, Inc. # # All rights reserved. # from mint.django_rest.deco import return_xml, requires from mint.django_rest.rbuilder import service from mint.django_rest.rbuilder.querysets import manager class BaseQuerySetService(service.BaseService): pass class QuerySetService(B...
Python
0.000001
aa6a72c419846bc9d1ae5d8f114d214cbc2be60c
Fix randomize without cache
fake_useragent/utils.py
fake_useragent/utils.py
import re import os try: from urllib import urlopen, quote_plus except ImportError: # Python 3 from urllib.request import urlopen from urllib.parse import quote_plus try: import json except ImportError: import simplejson as json from fake_useragent import settings def get(url, annex=None): if...
import re import os try: from urllib import urlopen, quote_plus except ImportError: # Python 3 from urllib.request import urlopen from urllib.parse import quote_plus try: import json except ImportError: import simplejson as json from fake_useragent import settings def get(url, annex=None): if...
Python
0.000005
aa8e51fc8ad969cd04098a5714ff78092b35f58f
Remove unused import
polyaxon/libs/http.py
polyaxon/libs/http.py
import os import requests import tarfile from urllib.parse import parse_qs, urlencode, urljoin, urlparse, urlunparse from hestia.auth import AuthenticationTypes from hestia.fs import move_recursively from django.conf import settings from libs.api import get_http_api_url def absolute_uri(url): if not url: ...
import os import requests import shutil import tarfile from urllib.parse import parse_qs, urlencode, urljoin, urlparse, urlunparse from hestia.auth import AuthenticationTypes from hestia.fs import move_recursively from django.conf import settings from libs.api import get_http_api_url def absolute_uri(url): if...
Python
0.000001