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
eaf390b065944a64a3b74c1b0e43b1df60d4e88f
Reimplement deduping hurr
invoke/executor.py
invoke/executor.py
class Executor(object): """ An execution strategy for Task objects. Subclasses may override various extension points to change, add or remove behavior. """ def __init__(self, collection): """ Create executor with a pointer to the task collection ``collection``. This poi...
class Executor(object): """ An execution strategy for Task objects. Subclasses may override various extension points to change, add or remove behavior. """ def __init__(self, collection): """ Create executor with a pointer to the task collection ``collection``. This poi...
Python
0.000001
375d12ab7486f6bb0d57232d48c556e6c0eda0c1
Update P05_stylingExcel fixed PEP8 spacing
books/AutomateTheBoringStuffWithPython/Chapter12/P05_stylingExcel.py
books/AutomateTheBoringStuffWithPython/Chapter12/P05_stylingExcel.py
# This program uses the OpenPyXL module to manipulate Excel documents import openpyxl from openpyxl.styles import Font, NamedStyle wb = openpyxl.Workbook() sheet = wb["Sheet"] # Setting the Font Style of Cells italic24Font = NamedStyle(name="italic24Font") italic24Font.font = Font(size=24, italic=True) sheet["A1"].s...
# This program uses the OpenPyXL module to manipulate Excel documents import openpyxl from openpyxl.styles import Font, NamedStyle wb = openpyxl.Workbook() sheet = wb["Sheet"] # Setting the Font Style of Cells italic24Font = NamedStyle(name="italic24Font") italic24Font.font = Font(size=24, italic=True) sheet["A1"].s...
Python
0
17793c9b3ceecc206aab1d1c34c0d3dc69892cbd
Use ArgumentParser to enforce required arguments
monitor/runner.py
monitor/runner.py
import sys from time import sleep from camera import Camera from controller import Controller from plotter_pygame import PyGamePlotter import epics import argparse if __name__ == "__main__": parser = argparse.ArgumentParser(description='') parser.add_argument('--prefix', required=True, dest='prefix', help='co...
import sys from time import sleep from camera import Camera from controller import Controller from plotter_pygame import PyGamePlotter import epics import argparse if __name__ == "__main__": parser = argparse.ArgumentParser(description='') parser.add_argument('--prefix', dest='prefix', help='controller IOC pr...
Python
0
81a4b04173033d7e678ad6c4b4efae654af9ac11
Use a threading local object to isolate MongoDB connection between different threads but reuse the same connection in the same thread
moocng/mongodb.py
moocng/mongodb.py
# Copyright 2013 Rooter Analysis S.L. # # 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 w...
# Copyright 2013 Rooter Analysis S.L. # # 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 w...
Python
0.000001
aa9143302b376e1274c8c11b53687771d0444b5a
Remove now-unused isInt code
morss/__main__.py
morss/__main__.py
# ran on `python -m morss` import os import sys from . import wsgi from . import cli from .morss import MorssException import wsgiref.simple_server import wsgiref.handlers PORT = int(os.getenv('PORT', 8080)) def main(): if 'REQUEST_URI' in os.environ: # mod_cgi (w/o file handler) app = wsgi...
# ran on `python -m morss` import os import sys from . import wsgi from . import cli from .morss import MorssException import wsgiref.simple_server import wsgiref.handlers PORT = int(os.getenv('PORT', 8080)) def isInt(string): try: int(string) return True except ValueError: retu...
Python
0.000444
f021922dec168a4bb97516eb6b7a7ca5fe3bfb96
Use HostAddressOpt for opts that accept IP and hostnames
ironic/conf/api.py
ironic/conf/api.py
# Copyright 2016 Intel Corporation # Copyright 2013 Hewlett-Packard Development Company, L.P. # 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:...
# Copyright 2016 Intel Corporation # Copyright 2013 Hewlett-Packard Development Company, L.P. # 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:...
Python
0.000094
2159e6c2b550367d456e3d743b7757c59636a3c7
update dictionary on ramiro's desktop to use starmon data
pycqed/init/config/setup_dict.py
pycqed/init/config/setup_dict.py
# Dictionaries used in setup. mac_dict = {'203178706891063': 'CDickel_Desktop', '203308017140376': 'Adriaans_Macbook', '963460802314': 'La_Ferrari', '46390847648': 'La_Maserati', '215977245841658': 'La_Maserati_JrJr', '13795386264098': 'Serwans_Laptop', ...
# Dictionaries used in setup. mac_dict = {'203178706891063': 'CDickel_Desktop', '203308017140376': 'Adriaans_Macbook', '963460802314': 'La_Ferrari', '46390847648': 'La_Maserati', '215977245841658': 'La_Maserati_JrJr', '13795386264098': 'Serwans_Laptop', ...
Python
0
3927fd757ff404af61e609cc1728d1f3fe398230
Fix on error text.
mp3datastorage.py
mp3datastorage.py
#store file attributes component import sqlite3 as sql import os import mp3metadata #TODO add directory of the database #Allow database recognition and resetting the database class SQLmgr: def __init__(self, username): #note everytime function is called MusicData table is dropped! self.serv = False self.errors...
#store file attributes component import sqlite3 as sql import os import mp3metadata #TODO add directory of the database #Allow database recognition and resetting the database class SQLmgr: def __init__(self, username): #note everytime function is called MusicData table is dropped! self.serv = False self.errors...
Python
0
73529579a6abaf1b33e6135d4abaa2c892dbfa3c
exit with retcode when called directly
kcheck/command.py
kcheck/command.py
#!/usr/bin/env python3 """ Entry point for utility, option handling. """ def main() -> int: """ Entry point for command line utility. :return: integer for return code of command line """ import configargparse import importlib import logging import platform from configparser imp...
#!/usr/bin/env python3 """ Entry point for utility, option handling. """ def main() -> int: """ Entry point for command line utility. :return: integer for return code of command line """ import configargparse import importlib import logging import platform from configparser imp...
Python
0
2d92e69d00a7419a23bcb38ab7c55ccc533237df
Fix artwork size
itunescli/query.py
itunescli/query.py
import logging from cliff.command import Command from cliff.lister import Lister from cliff.show import ShowOne import itunes class ITunesSearchBase(object): MEDIA_TYPES = frozenset([ 'movie', 'podcast', 'music', 'musicVideo', 'audiobook', 'shortFilm', 't...
import logging from cliff.command import Command from cliff.lister import Lister from cliff.show import ShowOne import itunes class ITunesSearchBase(object): MEDIA_TYPES = frozenset([ 'movie', 'podcast', 'music', 'musicVideo', 'audiobook', 'shortFilm', 't...
Python
0.000001
e1e25bc1166efa9a39fdf769f1081fafd08dd937
handle unknown source country, add recovered
pyfibot/modules/module_korona.py
pyfibot/modules/module_korona.py
# -*- coding: utf-8 -*- """ Koronavirus statistics from HS.fi open data https://github.com/HS-Datadesk/koronavirus-avoindata """ from __future__ import unicode_literals, print_function, division from collections import Counter def init(bot): global lang config = bot.config.get("module_posti", {}) lang = ...
# -*- coding: utf-8 -*- """ Koronavirus statistics from HS.fi open data https://github.com/HS-Datadesk/koronavirus-avoindata """ from __future__ import unicode_literals, print_function, division from collections import Counter def init(bot): global lang config = bot.config.get("module_posti", {}) lang = ...
Python
0
13f26d9007629be019140aa3bedd5f6fbfefe69b
delete all() method when apply document filter
jellyblog/views.py
jellyblog/views.py
# -*- coding: utf-8 -*- from django.shortcuts import render, get_object_or_404 from django.core.paginator import Paginator from .models import Category, Document from htmlmin.decorators import minified_response from .util import get_page_number_range, get_documents, \ categoryList def home(request): Category....
# -*- coding: utf-8 -*- from django.shortcuts import render, get_object_or_404 from django.core.paginator import Paginator from .models import Category, Document from htmlmin.decorators import minified_response from .util import get_page_number_range, get_documents, \ categoryList def home(request): Category....
Python
0.000001
deaee894589a2247b9322ba5cdb94e4c127c35bd
correct docstring for KeyringLocked class
keyring/errors.py
keyring/errors.py
import sys __metaclass__ = type class KeyringError(Exception): """Base class for exceptions in keyring """ class PasswordSetError(KeyringError): """Raised when the password can't be set. """ class PasswordDeleteError(KeyringError): """Raised when the password can't be deleted. """ clas...
import sys __metaclass__ = type class KeyringError(Exception): """Base class for exceptions in keyring """ class PasswordSetError(KeyringError): """Raised when the password can't be set. """ class PasswordDeleteError(KeyringError): """Raised when the password can't be deleted. """ clas...
Python
0
15f45377dffa2e267464b38f5f87ffe9526fa8f6
Update support to jax (#585)
tensorboardX/x2num.py
tensorboardX/x2num.py
# DO NOT alter/distruct/free input object ! from __future__ import absolute_import from __future__ import division from __future__ import print_function import logging import numpy as np import six def check_nan(array): tmp = np.sum(array) if np.isnan(tmp) or np.isinf(tmp): logging.warning('NaN or In...
# DO NOT alter/distruct/free input object ! from __future__ import absolute_import from __future__ import division from __future__ import print_function import logging import numpy as np import six def check_nan(array): tmp = np.sum(array) if np.isnan(tmp) or np.isinf(tmp): logging.warning('NaN or In...
Python
0
4e280094687d8c369a1eee3c8b7bb246549898eb
Update utils.py
backend/utils.py
backend/utils.py
from rest_framework.views import exception_handler from rest_framework.exceptions import APIException, AuthenticationFailed checks = ['Username not found', 'Username already exists', 'Authentication failed'] def custom_exception_handler(exc): """ Exception handler called by all raised exceptions during HTTP r...
from rest_framework.views import exception_handler from rest_framework.exceptions import APIException, AuthenticationFailed checks = ['Username not found', 'Username already exists', 'Authentication failed'] def custom_exception_handler(exc): """ Exception handler called by all raised exceptions during HTTP r...
Python
0.000001
cd4e7c5bc10c8e946ddf31d99a249a5a97b2dfda
Update get-observations.py
python-files/get-observations.py
python-files/get-observations.py
#!/usr/bin/env python3 """ Utility to get observations from a SatNOGS Network server. Collects the paginated objects into a single JSON list and stores in a file. """ import json import requests OBSERVATIONS_API = 'https://network.satnogs.org/api/observations' OBSERVATIONS_JSON = 'observations.json' def get(url)...
#!/usr/bin/env python3 """ Utility to get observations from a SatNOGS Network server. Collects the paginated objects into a single JSON list and stores in a file. """ import json import requests OBSERVATIONS_API = 'https://network.satnogs.org/api/observations' OBSERVATIONS_JSON = 'observations.json' def get(url)...
Python
0
bf349b5f41e3b7edb4efbe279f79ded856320388
Fix typo
python/xchainer/testing/array.py
python/xchainer/testing/array.py
import numpy.testing import xchainer # NumPy-like assertion functions that accept both NumPy and xChainer arrays def _check_xchainer_array(x): # Checks basic conditions that are assumed to hold true for any given xChainer array passed to assert_array_close and # assert_array_equal. assert isinstance(x, ...
import numpy.testing import xchainer # NumPy-like assertion functions that accept both NumPy and xChainer arrays def _check_xchainer_array(x): # Checks basic conditions that are assumed to hold true for any given xChainer array passed to assert_array_close and # assert_array_equal. assert isinstance(x, ...
Python
0.999999
f238a7d227036510b91ea4a7e1e9178ea60b3997
Update imagecodecs/__main__.py
imagecodecs/__main__.py
imagecodecs/__main__.py
# -*- coding: utf-8 -*- # imagecodecs/__main__.py """Imagecodecs package command line script.""" import sys from matplotlib.pyplot import show from tifffile import imshow import imagecodecs def askopenfilename(**kwargs): """Return file name(s) from Tkinter's file open dialog.""" try: from Tkinter...
# -*- coding: utf-8 -*- # imagecodecs/__main__.py """Imagecodecs package command line script.""" import sys from matplotlib.pyplot import show from tifffile import imshow import imagecodecs def askopenfilename(**kwargs): """Return file name(s) from Tkinter's file open dialog.""" try: from Tkinter...
Python
0.000005
43e8b090d806d615a8153d1e14063cc6d274bb25
Update issue 130 Now I also applied the fix :)
rdflib/plugins/serializers/nt.py
rdflib/plugins/serializers/nt.py
""" N-Triples RDF graph serializer for RDFLib. See <http://www.w3.org/TR/rdf-testcases/#ntriples> for details about the format. """ from rdflib.serializer import Serializer import warnings class NTSerializer(Serializer): """ Serializes RDF graphs to NTriples format. """ def serialize(self, stream, ba...
""" N-Triples RDF graph serializer for RDFLib. See <http://www.w3.org/TR/rdf-testcases/#ntriples> for details about the format. """ from rdflib.serializer import Serializer import warnings class NTSerializer(Serializer): """ Serializes RDF graphs to NTriples format. """ def serialize(self, stream, ba...
Python
0
0035200543a7b226a095d2fb4ec880e0dd8732fd
Rearrange test data
make_test_data.py
make_test_data.py
import sqlite3 INSERT_SONG = ''' INSERT INTO jukebox_song_queue VALUES (?) ''' TEST_URIS = [ 'spotify:track:68MToCqJRJvNW8tYoxDl5p', 'spotify:track:0p1VSXFdkr71f0nO21IEyq', 'spotify:track:7udJ4LFSIrRnySD3eI8lad' ] if __name__ == '__main__': conn = sqlite3.connect('jukebox.db') cursor = conn.cu...
import sqlite3 INSERT_SONG = ''' INSERT INTO jukebox_song_queue VALUES (?) ''' TEST_URIS = [ 'spotify:track:7udJ4LFSIrRnySD3eI8lad', 'spotify:track:0p1VSXFdkr71f0nO21IEyq', 'spotify:track:68MToCqJRJvNW8tYoxDl5p' ] if __name__ == '__main__': conn = sqlite3.connect('jukebox.db') cursor = conn.c...
Python
0.000026
95ea1d7d6564bcbb2e3b8d2ba254ccd2c1c38436
Add import for focused stuff
mamba/__init__.py
mamba/__init__.py
__version__ = '0.9.2' def description(message): pass def _description(message): pass def fdescription(message): pass def it(message): pass def _it(message): pass def fit(message): pass def context(message): pass def _context(message): pass def fcontext(message): pas...
__version__ = '0.9.2' def description(message): pass def _description(message): pass def it(message): pass def _it(message): pass def context(message): pass def _context(message): pass def before(): pass def after(): pass
Python
0
d3b3e9af722ac00b21bf36706f4e0ab7cf94af00
bump to v0.6.4
mando/__init__.py
mando/__init__.py
__version__ = '0.6.4' try: from mando.core import Program except ImportError as e: # pragma: no cover # unfortunately the only workaround for Python2.6, argparse and setup.py e.version = __version__ raise e main = Program() command = main.command arg = main.arg parse = main.parse execute = main.execu...
__version__ = '0.5' try: from mando.core import Program except ImportError as e: # pragma: no cover # unfortunately the only workaround for Python2.6, argparse and setup.py e.version = __version__ raise e main = Program() command = main.command arg = main.arg parse = main.parse execute = main.execute...
Python
0
59400100aa2f35bfea52b3cf049ef8d0f958527d
Fix error when reaching a dead end in the markov chain
markov/markov2.py
markov/markov2.py
#!python3 import string import random import time import sys ''' This is an implementation of a markov chain used for text generation. Just pass a file name as an argument and it should load it up, build a markov chain with a state for each word(s), and start walking through the chain, writing incoherent text to the...
#!python3 import string import random import time import sys ''' This is an implementation of a markov chain used for text generation. Just pass a file name as an argument and it should load it up, build a markov chain with a state for each word(s), and start walking through the chain, writing incoherent text to the...
Python
0.000006
7ccb52897e82629e4bbb0298dba4de76bc6a63db
Add a deprecation warning
pathvalidate/_symbol.py
pathvalidate/_symbol.py
""" .. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com> """ import re import warnings from typing import Sequence from ._common import ascii_symbols, preprocess, unprintable_ascii_chars from .error import InvalidCharError __RE_UNPRINTABLE = re.compile( "[{}]".format(re.escape("".join(unprintable_asc...
""" .. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com> """ import re from typing import Sequence from ._common import ascii_symbols, preprocess, unprintable_ascii_chars from .error import InvalidCharError __RE_UNPRINTABLE = re.compile( "[{}]".format(re.escape("".join(unprintable_ascii_chars))), re....
Python
0.001163
12dac769152ebd074ed2b415d3980729bdbe3e46
Make nonexistent warning more obvious
regparser/commands/compare_to.py
regparser/commands/compare_to.py
import json import logging import os import click from json_delta import udiff import requests import requests_cache def local_and_remote_generator(api_base, paths): """Find all local files in `paths` and pair them with the appropriate remote file (prefixing with api_base). As the local files could be at any...
import json import os import click from json_delta import udiff import requests import requests_cache def local_and_remote_generator(api_base, paths): """Find all local files in `paths` and pair them with the appropriate remote file (prefixing with api_base). As the local files could be at any position i...
Python
0
cfb09353b02dd230546775d18dadb1ba7ed2acc6
Refactor submit_comment tests
regulations/tests/tasks_tests.py
regulations/tests/tasks_tests.py
import json import mock import six from celery.exceptions import Retry, MaxRetriesExceededError from requests.exceptions import RequestException from django.test import SimpleTestCase, override_settings from regulations.tasks import submit_comment @mock.patch('regulations.tasks.save_failed_submission') @mock.patch(...
import json import mock import six from celery.exceptions import Retry, MaxRetriesExceededError from requests.exceptions import RequestException from django.test import SimpleTestCase, override_settings from regulations.tasks import submit_comment @mock.patch('regulations.tasks.save_failed_submission') @mock.patch(...
Python
0
29e491c5505d2068b46eb489044455968e53ab70
Add tests for strait and fjord
test/400-bay-water.py
test/400-bay-water.py
# osm_id: 43950409 name: San Pablo Bay assert_has_feature( 14, 2623, 6318, 'water', { 'kind': 'bay', 'label_placement': 'yes' }) # osm_id: 360566115 name: Byron strait assert_has_feature( 14, 15043, 8311, 'water', { 'kind': 'strait', 'label_placement': 'yes' }) # osm_id: -1451065 name: Horsens Fjord a...
assert_has_feature( 14, 2623, 6318, 'water', { 'kind': 'bay', 'label_placement': 'yes' })
Python
0.000007
83781f3b2f1cde0aab913ff4d64de45cf9b798be
Update snooper for multi-spline qp controller inputs
software/control/src/qp_controller_input_snooper.py
software/control/src/qp_controller_input_snooper.py
#!/usr/bin/python ''' Listens to QP Controller Inputs and draws, in different but order-consistent colors, the cubic splines being followed by each body motion block. ''' import lcm import drc from drake import lcmt_qp_controller_input, lcmt_body_motion_data import sys import time from bot_lcmgl import lcmgl, GL_LINE...
#!/usr/bin/python ''' Listens to QP Controller Inputs and draws, in different but order-consistent colors, the cubic splines being followed by each body motion block. ''' import lcm import drc from drake import lcmt_qp_controller_input, lcmt_body_motion_data import sys import time from bot_lcmgl import lcmgl, GL_LINE...
Python
0
cdf545cf9385a0490590cd0162141025a1301c09
Use argparse formatter RawDescriptionHelpFormatter, maybe temporarily
track/config.py
track/config.py
import configargparse DEFAULT_CONFIG_FILES=[ './track.cfg', '~/.track.cfg', ] # Bit of a cheat... not actually an object constructor, just a 'make me an object' method def ArgParser(): return configargparse.ArgParser( ignore_unknown_config_file_keys =True, allow_abbrev ...
import configargparse DEFAULT_CONFIG_FILES=[ './track.cfg', '~/.track.cfg', ] # Bit of a cheat... not actually an object constructor, just a 'make me an object' method def ArgParser(): return configargparse.ArgParser( ignore_unknown_config_file_keys =True, allow_abbrev ...
Python
0
148d4c44a9eb63016b469c6bf317a3dbe9ed7918
Add documentation for Permutations class
permuta/permutations.py
permuta/permutations.py
from .misc import DancingLinks from .permutation import Permutation import random class Permutations(object): """Class for iterating through all Permutations of length n""" def __init__(self, n): """Returns an object giving all permutations of length n""" assert 0 <= n self.n = n ...
from .misc import DancingLinks from .permutation import Permutation import random class Permutations(object): def __init__(self, n): assert 0 <= n self.n = n def __iter__(self): left = DancingLinks(range(1, self.n+1)) res = [] def gen(): if len(left) == 0: ...
Python
0
8b9f68514d78851f3b445f996f3eaf607831d352
Add more descriptive names to variables and functions
raspisump/checkpid.py
raspisump/checkpid.py
#!/usr/bin/python # Check to make sure process raspi-sump is running and restart if required. import subprocess import time def check_pid(): '''Check status of raspisump.py process.''' cmdp1 = "ps aux" cmdp2 = "grep -v grep" cmdp3 = "grep -v sudo" cmdp4 = "grep -c /home/pi/raspi-sump/raspisump.py"...
#!/usr/bin/python # Check to make sure process raspi-sump is running and restart if required. import subprocess import time def check_pid(): '''Check status of raspisump.py process.''' cmdp1 = "ps aux" cmdp2 = "grep -v grep" cmdp3 = "grep -v sudo" cmdp4 = "grep -c /home/pi/raspi-sump/raspisump.py"...
Python
0.000001
51373b776403b94cf0b72b43952013f3b4ecdb2d
Remove useless codes
holosocket/encrypt.py
holosocket/encrypt.py
import struct from Cryptodome.Cipher import AES from Cryptodome.Hash import SHA256 from Cryptodome.Random import get_random_bytes class aes_gcm: def __init__(self, key, salt=None): """Create a new AES-GCM cipher. key: Your password like: passw0rd salt: a 16 bytes length byte string, if no...
import struct from Cryptodome.Cipher import AES from Cryptodome.Hash import SHA256 from Cryptodome.Random import get_random_bytes #Cipher_Tag = {'aes-256-gcm': 16} #Nonce_Len = 8 # fuck you 12 bytes class aes_gcm: def __init__(self, key, salt=None): """Create a new AES-GCM cipher. key: Your pas...
Python
0.000221
6288caa954c8834ef6fec0bf24c62a1c8265e302
Use InstanceProfileName value to remove
pipes/iam/create_iam.py
pipes/iam/create_iam.py
"""Create IAM Instance Profiles, Roles, Users, and Groups.""" import logging import boto3 from boto3.exceptions import botocore from .utils import get_details, get_template LOG = logging.getLogger(__name__) def create_iam_resources(env='dev', app=''): """Create the IAM Resources for the application. Args:...
"""Create IAM Instance Profiles, Roles, Users, and Groups.""" import logging import boto3 from boto3.exceptions import botocore from .utils import get_details, get_template LOG = logging.getLogger(__name__) def create_iam_resources(env='dev', app=''): """Create the IAM Resources for the application. Args:...
Python
0
f21204c8828e840dc54c6822348fa9a47bc8964e
Add model's to_dict method.
opensrs/models.py
opensrs/models.py
from dateutil.parser import parse class Domain(object): def __init__(self, data): self.name = data['name'] self.auto_renew = (data['f_auto_renew'] == 'Y') self.expiry_date = parse(data['expiredate']).date() @property def tld(self): return self.name.split('.')[-1] def ...
from dateutil.parser import parse class Domain(object): def __init__(self, data): self.name = data['name'] self.auto_renew = (data['f_auto_renew'] == 'Y') self.expiry_date = parse(data['expiredate']).date() @property def tld(self): return self.name.split('.')[-1]
Python
0
fa82883576a659d9cd9d830919e744299ac14ac7
improve show command to show target types, build phase types and filter other build phases.
pbxproj/pbxcli/pbxproj_show.py
pbxproj/pbxcli/pbxproj_show.py
""" usage: pbxproj show [options] <project> pbxproj show [options] (--target <target>...) <project> [(-s | --source-files) | (-H | --header-files) | (-r | --resource-files) | ...
""" usage: pbxproj show [options] <project> pbxproj show [options] (--target <target>...) <project> [(-s | --source-files) | (-H | --header-files) | (-r | --resource-files) | (-f | --framework-files)] positional arguments: <project> Project path to the .xcodeproj folder. generic optio...
Python
0
da12bb0058cb48d3262eb70469aa30cdb8312ee2
fix typos/bugs/indexing in block dicing
Control/dice_block.py
Control/dice_block.py
import os import sys import subprocess import h5py def check_file(filename): # verify the file has the expected data f = h5py.File(filename, 'r') if set(f.keys()) != set(['segmentations', 'probabilities']): os.unlink(filename) return False return True try: args = sys.argv[1:] i...
import os import sys import subprocess import h5py def check_file(filename): # verify the file has the expected data f = h5py.File(filename, 'r') if set(f.keys()) != set(['segmentations', 'probabilities']): os.unlink(filename) return False return True try: args = sys.argv[1:] i...
Python
0.000017
5d2301b15e07394e24fed2fac2f258d72554eede
Add tests for query_geonames, MITIE, city resolution
resources/tests/test_mordecai.py
resources/tests/test_mordecai.py
import os import sys import glob from ConfigParser import ConfigParser from mitie import named_entity_extractor from ..country import CountryAPI from ..places import PlacesAPI from ..utilities import mitie_context, setup_es, query_geonames def test_places_api_one(): if os.environ.get('CI'): ci = 'circle' ...
import os from ..country import CountryAPI from ..places import PlacesAPI def test_places_api_one(): if os.environ.get('CI'): ci = 'circle' assert ci == 'circle' else: a = PlacesAPI() locs = {u'entities': [{u'context': ['meeting', 'happened', 'in', '.'], ...
Python
0.000141
2443c891e5f9cccb5c36b02303a3b9b7a94a4c45
Change Jinja escape sequences.
generate.py
generate.py
#!/usr/bin/env python3 import os import shutil from jinja2 import Environment,FileSystemLoader from pygments import highlight from pygments.lexers import TexLexer from pygments.formatters import HtmlFormatter from subprocess import Popen,PIPE env = Environment(loader=FileSystemLoader("tmpl"), block_start_string='~...
#!/usr/bin/env python3 import os import shutil from jinja2 import Environment,FileSystemLoader from pygments import highlight from pygments.lexers import TexLexer from pygments.formatters import HtmlFormatter from subprocess import Popen,PIPE env = Environment(loader=FileSystemLoader("tmpl")) snippets_dir = "snippe...
Python
0
18aa5e20a5dbc931f48774c4bf034e6efe022923
Implement 'force' and 'directory' options
generate.py
generate.py
#!/usr/bin/env python import sys import os import re from optparse import OptionParser from crontab import CronTab from jinja2 import FileSystemLoader, Environment from yaml import dump def remove_user_from_command(command_with_user): match = re.search(r'\{{0,2}\s?\w+\s?\}{0,2}\s(.*)', command_with_user) re...
#!/usr/bin/env python import sys import os import re from optparse import OptionParser from crontab import CronTab from jinja2 import FileSystemLoader, Environment from yaml import dump def remove_user_from_command(command_with_user): match = re.search(r'\{{0,2}\s?\w+\s?\}{0,2}\s(.*)', command_with_user) re...
Python
0.999999
54e2359ed2cd75b87dc4a8007df6b252af3a3765
fix typo
HARK/ConsumptionSaving/tests/test_ConsLaborModel.py
HARK/ConsumptionSaving/tests/test_ConsLaborModel.py
from HARK.ConsumptionSaving.ConsLaborModel import ( LaborIntMargConsumerType, init_labor_lifecycle, ) import unittest class test_LaborIntMargConsumerType(unittest.TestCase): def setUp(self): self.model = LaborIntMargConsumerType() self.model_finite_lifecycle = LaborIntMargConsumerType(**in...
from HARK.ConsumptionSaving.ConsLaborModel import ( LaborIntMargConsumerType, init_labor_lifecycle, ) import unittest class test_LaborIntMargConsumerType(unittest.TestCase): def setUp(self): self.model = LaborIntMargConsumerType() self.model_finte_lifecycle = LaborIntMargConsumerType(**ini...
Python
0.999991
c1b4216e610a46260f52d5ed71267a2ed5fcdd25
update debug url to account for downloads
hs_core/debug_urls.py
hs_core/debug_urls.py
"""Extra URLs that add debugging capabilities to resources.""" from django.conf.urls import url from hs_core import views urlpatterns = [ # Resource Debugging: print consistency problems in a resource url(r'^debug/resource/(?P<shortkey>[0-9a-f-]+)/$', views.debug_resource_view.debug_resource, ...
"""Extra URLs that add debugging capabilities to resources.""" from django.conf.urls import url from hs_core import views urlpatterns = [ # Resource Debugging: print consistency problems in a resource url(r'^resource/(?P<shortkey>[0-9a-f-]+)/debug/$', views.debug_resource_view.debug_resource, ...
Python
0
e68307e10e1aebe8a6c527a15bfc34b1158bf0eb
Use labels in API for #
judge/views/api.py
judge/views/api.py
from django.core.exceptions import ObjectDoesNotExist from django.http import JsonResponse, Http404 from judge.models import Contest, Problem, Profile, Submission def sane_time_repr(delta): days = delta.days hours = delta.seconds / 3600 minutes = (delta.seconds % 3600) / 60 return '%02d:%02d:%02d' % ...
from django.core.exceptions import ObjectDoesNotExist from django.http import JsonResponse, Http404 from judge.models import Contest, Problem, Profile, Submission def sane_time_repr(delta): days = delta.days hours = delta.seconds / 3600 minutes = (delta.seconds % 3600) / 60 return '%02d:%02d:%02d' % ...
Python
0
600a19b8a3f6d320b00d1d2b25e5c0f341f821d1
bump version
kaggle_cli/main.py
kaggle_cli/main.py
import sys from cliff.app import App from cliff.commandmanager import CommandManager VERSION = '0.6.1' class KaggleCLI(App): def __init__(self): super(KaggleCLI, self).__init__( description='An unofficial Kaggle command line tool.', version=VERSION, command_manager=C...
import sys from cliff.app import App from cliff.commandmanager import CommandManager VERSION = '0.6.0' class KaggleCLI(App): def __init__(self): super(KaggleCLI, self).__init__( description='An unofficial Kaggle command line tool.', version=VERSION, command_manager=C...
Python
0
5a87dbbb0ea4faa44d743a21a2f7d7aca46242f9
Document internet gateway properties:
heat/engine/resources/internet_gateway.py
heat/engine/resources/internet_gateway.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # # 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...
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # # 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
77503c0e09c0a520ffdc3b4f936c579148acd915
Clean up the code a bit
piwik_tracking/piwiktracker.py
piwik_tracking/piwiktracker.py
import datetime import httplib import random import urllib import urlparse class PiwikTracker: VERSION = 1 def __init__(self, id_site, api_url, request, token_auth): random.seed() self.id_site = id_site self.api_url = api_url self.request = request self.token_auth = to...
import datetime import httplib import random import urllib import urlparse class PiwikTracker: VERSION = 1 def __init__(self, id_site, api_url, request, token_auth): random.seed() self.id_site = id_site self.api_url = api_url self.request = request self.token_auth = to...
Python
0
b1e2275b47e70949c018ab276279c9e6b8f6d3cf
Add debug (#10828)
homeassistant/components/sensor/serial.py
homeassistant/components/sensor/serial.py
""" Support for reading data from a serial port. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/sensor.serial/ """ import asyncio import logging import json import voluptuous as vol import homeassistant.helpers.config_validation as cv from homeassistan...
""" Support for reading data from a serial port. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/sensor.serial/ """ import asyncio import logging import json import voluptuous as vol import homeassistant.helpers.config_validation as cv from homeassistan...
Python
0.000001
ad6b055b53d621addc3565209c7af095b6d6d0e7
Add .delete() and the start of Room
hypchat/jsonobject.py
hypchat/jsonobject.py
from __future__ import absolute_import, division import json import re from . import requests _urls_to_objects = {} class Linker(object): """ Responsible for on-demand loading of JSON objects. """ def __init__(self, url, parent=None, _requests=None): self.url = url self.__parent = parent self._requests = _r...
from __future__ import absolute_import, division import json from . import requests class Linker(object): """ Responsible for on-demand loading of JSON objects. """ def __init__(self, url, parent=None, _requests=None): self.url = url self.__parent = parent self._requests = _requests or __import__('requests')...
Python
0.000001
1ae34b1a9035ec8813c40477a6f83bfdf10413f3
Add chkdown in the list of server metrics
haproxystats/metrics.py
haproxystats/metrics.py
"""Provide constants for grouping metric names. There are seperated groups for frontend, backend, servers and haproxy daemon. Metric names are the field names contained in the HAProxy statistics. """ from collections import namedtuple DAEMON_METRICS = [ 'CompressBpsIn', 'CompressBpsOut', 'CompressBpsRateL...
"""Provide constants for grouping metric names. There are seperated groups for frontend, backend, servers and haproxy daemon. Metric names are the field names contained in the HAProxy statistics. """ from collections import namedtuple DAEMON_METRICS = [ 'CompressBpsIn', 'CompressBpsOut', 'CompressBpsRateL...
Python
0
fe9226898772c4ff909f9c3f0cb05c271333b73a
Make auth_url lookup dynamic
heat/common/auth_url.py
heat/common/auth_url.py
# # Copyright 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 applicable law or agreed to in...
# # Copyright 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 applicable law or agreed to in...
Python
0.000009
a79db7cf85dac6d74d7929137f640a0ac10ddf7d
return from sys.exit for easier testing
p7doi/__init__.py
p7doi/__init__.py
# -*- coding: UTF-8 -*- from __future__ import print_function import webbrowser import sys __version__ = '0.0.1' DOI_URL = 'http://rproxy.sc.univ-paris-diderot.fr/login' + \ '?url=http://dx.doi.org/%s' def make_doi_url(doi): """ Return an URL for the given DOI """ return DOI_URL % doi def ope...
# -*- coding: UTF-8 -*- from __future__ import print_function import webbrowser import sys __version__ = '0.0.1' DOI_URL = 'http://rproxy.sc.univ-paris-diderot.fr/login' + \ '?url=http://dx.doi.org/%s' def make_doi_url(doi): """ Return an URL for the given DOI """ return DOI_URL % doi def ope...
Python
0.000001
7ed627991632cf761dfccb553f830a6e9e3c37e9
fix bitonality test for solid color images
kraken/lib/util.py
kraken/lib/util.py
""" Ocropus's magic PIL-numpy array conversion routines. They express slightly different behavior from PIL.Image.toarray(). """ import unicodedata import numpy as np from PIL import Image __all__ = ['pil2array', 'array2pil'] def pil2array(im: Image, alpha: int = 0) -> np.array: if im.mode == '1': return...
""" Ocropus's magic PIL-numpy array conversion routines. They express slightly different behavior from PIL.Image.toarray(). """ import unicodedata import numpy as np from PIL import Image __all__ = ['pil2array', 'array2pil'] def pil2array(im: Image, alpha: int = 0) -> np.array: if im.mode == '1': return...
Python
0.000001
4d5889e87399e940ebb08c7513f24466c0a93eaf
Remove useless space.
plugins/ChannelStats/config.py
plugins/ChannelStats/config.py
### # Copyright (c) 2005, Jeremiah Fincher # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, # this list of conditi...
### # Copyright (c) 2005, Jeremiah Fincher # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, # this list of conditi...
Python
0
eaac4e45928b7008e6c561e28e9b5ed5dc427587
fix redis storage
labDNS/storages.py
labDNS/storages.py
try: import redis except ImportError: redis = None class BaseStorage: DEFAULT_CONFIG = dict() def __init__(self, config): self.config = self.DEFAULT_CONFIG self._configure(config) def get(self, key): raise NotImplementedError def _configure(self, config): sel...
try: import redis except ImportError: redis = None class BaseStorage: DEFAULT_CONFIG = dict() def __init__(self, config): self.config = self.DEFAULT_CONFIG self._configure(config) def get(self, key): raise NotImplementedError def _configure(self, config): sel...
Python
0
13ffa4113341c13e635896f94a29df5cff5c0348
Build objects in JSON generator tool
test/generate-json.py
test/generate-json.py
#!/usr/bin/env python import argparse import random def random_array_element(): return random.choice(['123', 'true', 'false', 'null', '3.1415', '"foo"']) def main(): parser = argparse.ArgumentParser(description="Generate a large JSON document.") parser.add_argument('--array-size', nargs=1, type=int, defa...
#!/usr/bin/env python import argparse import random def random_array_element(): return random.choice(['123', 'true', 'false', 'null', '3.1415', '"foo"']) def main(): parser = argparse.ArgumentParser(description="Generate a large JSON document.") parser.add_argument('--array-size', nargs=1, type=int, defa...
Python
0.000002
c48b0ae4331d1d039cb6bc29ef25fc7c4a5df8da
Bump version to 0.2.7
approvaltests/version.py
approvaltests/version.py
version_number = "0.2.7"
version_number = "0.2.6"
Python
0.000001
903d9b000c4d7b333b5d3000aeb38b7e4d818c27
add "Partly Cloudy" to color_icons
i3pystatus/weather.py
i3pystatus/weather.py
from i3pystatus import IntervalModule import pywapi from i3pystatus.core.util import internet, require class Weather(IntervalModule): """ This module gets the weather from weather.com using pywapi module First, you need to get the code for the location from the www.weather.com Available formatters: ...
from i3pystatus import IntervalModule import pywapi from i3pystatus.core.util import internet, require class Weather(IntervalModule): """ This module gets the weather from weather.com using pywapi module First, you need to get the code for the location from the www.weather.com Available formatters: ...
Python
0.999821
f4a39adc6513f41dc33c4ecf597f4a80dd846dd9
rename LdapConnection to DatabaseWrapper and accept configuration as a dict
ldapdb/__init__.py
ldapdb/__init__.py
# -*- coding: utf-8 -*- # # django-ldapdb # Copyright (c) 2009-2010, Bolloré telecom # All rights reserved. # # See AUTHORS file for a full list of contributors. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # ...
# -*- coding: utf-8 -*- # # django-ldapdb # Copyright (c) 2009-2010, Bolloré telecom # All rights reserved. # # See AUTHORS file for a full list of contributors. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # ...
Python
0.000002
faebe4928b4bef33efd6183f97f1ff1396a701ee
fix missing urls.
blackgate/cli.py
blackgate/cli.py
# -*- coding: utf-8 -*- import click from blackgate.core import component from blackgate.config import parse_yaml_config from blackgate.config import read_yaml_config from blackgate.config import read_default_config from blackgate.server import run @click.group() @click.option('-c', '--config', default='') @click.p...
# -*- coding: utf-8 -*- import click from blackgate.core import component from blackgate.config import parse_yaml_config from blackgate.config import read_yaml_config from blackgate.config import read_default_config from blackgate.server import run @click.group() @click.option('-c', '--config', default='') @click.p...
Python
0.00013
66b95e2e0b89470993c52998eeb179d9e4926713
test public list
project/test_project.py
project/test_project.py
#from django.contrib.auth.models import User from .models import * from django.test import TestCase from django.db import transaction import reversion #from reversion.models import Version TEST_USER_NAME_CREATOR = 'test project creator' TEST_USER_NAME_NOT_MEMBER = 'user is not a member' TEST_PROJECT_PUBLIC_NAME = 't...
#from django.contrib.auth.models import User from .models import * from django.test import TestCase from django.db import transaction import reversion #from reversion.models import Version TEST_USER_NAME_CREATOR = 'test project creator' TEST_USER_NAME_NOT_MEMBER = 'user is not a member' TEST_PROJECT_PUBLIC_NAME = 't...
Python
0.000001
1408f2a7e782c0ca059b04cab2526cef558312b6
add comment to explain not extending BaseGoAccountCommand
go/base/management/commands/go_generate_export_conversations_urls.py
go/base/management/commands/go_generate_export_conversations_urls.py
""" Dump URLs that can be used by cURL for downloading conversation data """ from optparse import make_option from django.core.management.base import CommandError from django.utils.text import slugify from go.base.command_utils import BaseGoCommand # We don't extend BaseGoAccountCommand since the '--email' option ...
""" Dump URLs that can be used by cURL for downloading conversation data """ from optparse import make_option from django.core.management.base import CommandError from django.utils.text import slugify from go.base.command_utils import BaseGoCommand class Command(BaseGoCommand): help = "Dump URLs for use with ...
Python
0
bdef12745f5d91bf196139b444b34810b529c38d
Fix #37: Make subclassing of btuple work for __add__ and __radd__.
blist/_btuple.py
blist/_btuple.py
from blist._blist import blist from ctypes import c_int import collections class btuple(collections.Sequence): def __init__(self, seq=None): if isinstance(seq, btuple): self._blist = seq._blist elif seq is not None: self._blist = blist(seq) else: self._bli...
from blist._blist import blist from ctypes import c_int import collections class btuple(collections.Sequence): def __init__(self, seq=None): if isinstance(seq, btuple): self._blist = seq._blist elif seq is not None: self._blist = blist(seq) else: self._bli...
Python
0
8abcd25ccd36d614ad650e0983385fbeb5a1777c
Add more search engines ping
blog/__init__.py
blog/__init__.py
# -*- coding: UTF-8 -*- # YaBlog # (c) Regis FLORET # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the fol...
# -*- coding: UTF-8 -*- # YaBlog # (c) Regis FLORET # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the fol...
Python
0
3154f0098f9696cd48536599413659e47747491f
Add api [2]
blue/__init__.py
blue/__init__.py
from flask import Flask app = Flask(__name__) from blue.site.routes import mod from blue.api.routes import mod app.register_blueprint(site.routes.mod) app.register_blueprint(api.routes.mod, url_prefix='/api')
from flask import Flask app = Flask(__name__) from blue.site.routes import mod from blue.api.routes import mod app.register_blueprint(site.routes.mod) app.register_blueprint(api.routes.mod)
Python
0
20d47877bf426bc2ec9ac1b8a99ec887faec31c5
Fix minor problems with mux function
boolexpr/misc.py
boolexpr/misc.py
# Copyright 2016 Chris Drake # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2016 Chris Drake # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
Python
0.000018
8da750eddfecb2c7162e1a33c7c830fd083944bd
Change allowed exception raising
intelmq/bots/parsers/abusech/parser_ip.py
intelmq/bots/parsers/abusech/parser_ip.py
# -*- coding: utf-8 -*- """ Parses simple newline separated list of IPs. Docs: - https://feodotracker.abuse.ch/blocklist/ - https://zeustracker.abuse.ch/blocklist.php """ import re import dateutil from intelmq.lib.bot import ParserBot from intelmq.lib import utils from intelmq.lib.exceptions import PipelineError ...
# -*- coding: utf-8 -*- """ Parses simple newline separated list of IPs. Docs: - https://feodotracker.abuse.ch/blocklist/ - https://zeustracker.abuse.ch/blocklist.php """ import re import dateutil from intelmq.lib.bot import ParserBot from intelmq.lib import utils from intelmq.lib.exceptions import PipelineError ...
Python
0
ff9e3e99e7a5bda1eefdd925960b6b6153a9e10d
Update messenger.py
bot/messenger.py
bot/messenger.py
import logging import random logger = logging.getLogger(__name__) class Messenger(object): def __init__(self, slack_clients): self.clients = slack_clients def send_message(self, channel_id, msg): # in the case of Group and Private channels, RTM channel payload is a complex dictionary ...
import logging import random logger = logging.getLogger(__name__) class Messenger(object): def __init__(self, slack_clients): self.clients = slack_clients def send_message(self, channel_id, msg): # in the case of Group and Private channels, RTM channel payload is a complex dictionary ...
Python
0.000001
1e930adbfb1714670ad04717401b36b59bf12558
Bump version to 0.0.2
bqdm/__init__.py
bqdm/__init__.py
# -*- coding: utf-8 -*- from __future__ import absolute_import __version__ = '0.0.2' CONTEXT_SETTINGS = dict( help_option_names=['-h', '--help'], max_content_width=120, )
# -*- coding: utf-8 -*- from __future__ import absolute_import __version__ = '0.0.1' CONTEXT_SETTINGS = dict( help_option_names=['-h', '--help'], max_content_width=120, )
Python
0.000001
6c556f6c5e4aa70173a84f6e6854390241231021
Update the Jinja2Templates() constructor to allow PathLike (#1292)
starlette/templating.py
starlette/templating.py
import typing from os import PathLike from starlette.background import BackgroundTask from starlette.responses import Response from starlette.types import Receive, Scope, Send try: import jinja2 # @contextfunction renamed to @pass_context in Jinja 3.0, to be removed in 3.1 if hasattr(jinja2, "pass_contex...
import typing from starlette.background import BackgroundTask from starlette.responses import Response from starlette.types import Receive, Scope, Send try: import jinja2 # @contextfunction renamed to @pass_context in Jinja 3.0, to be removed in 3.1 if hasattr(jinja2, "pass_context"): pass_contex...
Python
0
a0dfb1ce1a72880da34ad817c8021e54e2ce0e5d
add fields.
lib/acli/output.py
lib/acli/output.py
# from tabulate import tabulate from terminaltables import AsciiTable def output_ec2(output_type=None, instances=None): if output_type == 'console': heading = ['id', 'state', 'type', 'image', 'public ip', 'private ip'] table_data = [heading] for instance in instances: instance...
# from tabulate import tabulate from terminaltables import AsciiTable def output_ec2(output_type=None, instances=None): if output_type == 'console': heading = ['id', 'state'] table_data = [heading] for instance in instances: instance_id = instance[0].id instance_st...
Python
0
2d7b3afaca97a3e6a115c077586d0a9fb9daf8b2
Fix imap connection lost (#380)
i3pystatus/mail/imap.py
i3pystatus/mail/imap.py
import imaplib import socket from i3pystatus.mail import Backend class IMAP(Backend): """ Checks for mail on a IMAP server """ settings = ( "host", "port", "username", "password", ('keyring_backend', 'alternative keyring backend for retrieving credentials'), "ssl", ...
import sys import imaplib from i3pystatus.mail import Backend from i3pystatus.core.util import internet class IMAP(Backend): """ Checks for mail on a IMAP server """ settings = ( "host", "port", "username", "password", ('keyring_backend', 'alternative keyring backend for retr...
Python
0.000001
c0f959446731b8ce2677c56afd5456c2e047cabb
Change the webapp tests to not interfere with instance level connections.
ichnaea/webapp/tests.py
ichnaea/webapp/tests.py
from ichnaea.config import DummyConfig from ichnaea.tests.base import ( _make_app, _make_db, DBTestCase, RedisIsolation, REDIS_URI, SQLURI, ) class TestApp(RedisIsolation, DBTestCase): def test_db_config(self): app_config = DummyConfig({'ichnaea': { 'db_master': SQLURI...
from ichnaea.config import DummyConfig from ichnaea.tests.base import ( _make_app, _make_db, DBTestCase, RedisIsolation, REDIS_URI, SQLURI, ) class TestApp(RedisIsolation, DBTestCase): def test_db_hooks(self): app_config = DummyConfig({'ichnaea': { 'db_master': SQLURI,...
Python
0
17f1c210c9c8b410cb6888a51ea1d863b74c14be
Use has_module check in _can_read
imageio/plugins/gdal.py
imageio/plugins/gdal.py
# -*- coding: utf-8 -*- # Copyright (c) 2015, imageio contributors # imageio is distributed under the terms of the (new) BSD License. """ Plugin for reading gdal files. """ from __future__ import absolute_import, print_function, division from .. import formats from ..core import Format, has_module _gdal = None # la...
# -*- coding: utf-8 -*- # Copyright (c) 2015, imageio contributors # imageio is distributed under the terms of the (new) BSD License. """ Plugin for reading gdal files. """ from __future__ import absolute_import, print_function, division from .. import formats from ..core import Format _gdal = None # lazily loaded ...
Python
0
70f1838951460c16b7eb4b8220621c198d4634a5
remove pdb
inferelator_ng/tfa.py
inferelator_ng/tfa.py
import numpy as np import pandas as pd from scipy import linalg class TFA: """ TFA calculates transcription factor activity using matrix pseudoinverse Parameters -------- prior: pd.dataframe binary or numeric g by t matrix stating existence of gene-TF interactions. g--gene, t...
import numpy as np import pandas as pd from scipy import linalg class TFA: """ TFA calculates transcription factor activity using matrix pseudoinverse Parameters -------- prior: pd.dataframe binary or numeric g by t matrix stating existence of gene-TF interactions. g--gene, t...
Python
0.000024
ebfc7969fc2559d7f67eae628f00e0465b85e0c5
Add blur filter to supported URLs
imboclient/url/image.py
imboclient/url/image.py
from imboclient.url import accesstoken from imboclient.url import url class UrlImage (url.Url): def __init__(self, base_url, public_key, private_key, image_identifier): url.Url.__init__(self, base_url, public_key, private_key) self._image_identifier = image_identifier def resource_url(self): ...
from imboclient.url import accesstoken from imboclient.url import url class UrlImage (url.Url): def __init__(self, base_url, public_key, private_key, image_identifier): url.Url.__init__(self, base_url, public_key, private_key) self._image_identifier = image_identifier def resource_url(self): ...
Python
0
f1d76611b6b7c2f1b1a15c72976e5c1029f3b4a8
Use the executable bit on AWS callback.
scripts/aws.py
scripts/aws.py
import logging import requests from requests.exceptions import RequestException import sys import boto.ec2 logger = logging.getLogger(__name__) class AWSConnection: def __init__(self, config): self.available = False self.config = config if 'cluster_name' in config: self.clust...
import logging import requests from requests.exceptions import RequestException import sys import boto.ec2 logger = logging.getLogger(__name__) class AWSConnection: def __init__(self, config): self.available = False self.config = config if 'cluster_name' in config: self.clust...
Python
0
c8bdf3b95b2ff8e4049a109f65728619a55a927c
Add parallelism to generate_departures (that was easy)
busstops/management/commands/generate_departures.py
busstops/management/commands/generate_departures.py
from multiprocessing import Pool from datetime import date, timedelta from django.core.management.base import BaseCommand from django.db import transaction from txc import txc from ...models import Region, Service, Journey, StopUsageUsage, StopPoint from ...utils import get_files_from_zipfile ONE_DAY = timedelta(days...
from datetime import date, timedelta from django.core.management.base import BaseCommand from django.db import transaction from txc import txc from ...models import Region, Service, Journey, StopUsageUsage, StopPoint from ...utils import get_files_from_zipfile ONE_DAY = timedelta(days=1) def handle_timetable(servic...
Python
0.000002
eaa062840c0b56bbd7c47986b77f08528bb39eb7
Fix typo leading to misinterpretation of the doc in the implementation.
ppp_datamodel/communication.py
ppp_datamodel/communication.py
"""Contains the classes representing a request to and a response of a module.""" import json from .abstractnode import register, AbstractNode class Request: """Represents a request. https://github.com/ProjetPP/Documentation/blob/master/module-communication.md#request """ __slots__ = ('language', 'sen...
"""Contains the classes representing a request to and a response of a module.""" import json from .abstractnode import register, AbstractNode class Request: """Represents a request. https://github.com/ProjetPP/Documentation/blob/master/module-communication.md#request """ __slots__ = ('language', 'per...
Python
0
c2d543a3de566443a2c61761f9a190e915426fec
Return stream_client instead of binding it inside method (tests now passing)
stream_django/client.py
stream_django/client.py
from stream_django import conf import os import stream from stream_django.conf import DJANGO_MAJOR_VERSION from django.core.exceptions import ImproperlyConfigured def init_client(raise_config_error=False): if conf.API_KEY and conf.API_SECRET: return stream.connect(conf.API_KEY, conf.API_SECRET, location=conf.L...
from stream_django import conf import os import stream from stream_django.conf import DJANGO_MAJOR_VERSION from django.core.exceptions import ImproperlyConfigured def init_client(mayRaise=False): if conf.API_KEY and conf.API_SECRET: stream_client = stream.connect( conf.API_KEY, conf.API_SECRET, locat...
Python
0
c895a8b62754f5df32aba06cd2231ba43acc9576
Update algo.py
server/algo.py
server/algo.py
from __future__ import division import math import itertools SPACING = 5 def iter_to_runs(visibles, pixels): cur_val = 6666666 start_idx = None out = [] for i, val in enumerate(itertools.chain(visibles, [None])): if cur_val != val: if cur_val is True: # we just en...
from __future__ import division import math import itertools SPACING = 15 def iter_to_runs(visibles, pixels): cur_val = 6666666 start_idx = None out = [] for i, val in enumerate(itertools.chain(visibles, [None])): if cur_val != val: if cur_val is True: # we just e...
Python
0.000007
315a8ea99240d0eebe2335f25269154475dda679
Fix broken svn_export test
py/desimodel/install.py
py/desimodel/install.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*- """ desimodel.install ================= Install data files not handled by pip install. """ def default_install_dir(): """Return the default install directory. Assumes this file lives in a 'site-packages' directory. ...
# Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*- """ desimodel.install ================= Install data files not handled by pip install. """ def default_install_dir(): """Return the default install directory. Assumes this file lives in a 'site-packages' directory. ...
Python
0.000007
066e60897aa931b22ce92776b896912dbec3ccf6
bump dev version
py/desispec/_version.py
py/desispec/_version.py
__version__ = '0.47.1.dev6182'
__version__ = '0.47.1.dev6104'
Python
0
54c48073dfb8ffd418efe234c0c107f7a5c303a9
Fix failing imports in Python 2
svg/templatetags/svg.py
svg/templatetags/svg.py
from __future__ import absolute_import import logging import os from django import template from django.conf import settings from django.contrib.staticfiles import finders from django.utils.safestring import mark_safe from svg.exceptions import SVGNotFound logger = logging.getLogger(__name__) register = template.Lib...
import logging import os from django import template from django.conf import settings from django.contrib.staticfiles import finders from django.utils.safestring import mark_safe from svg.exceptions import SVGNotFound logger = logging.getLogger(__name__) register = template.Library() @register.simple_tag def svg(f...
Python
0.000196
b71ef8c05a9afa9eb3614c863650c12df0967fae
document methods
svtools/vcf/genotype.py
svtools/vcf/genotype.py
import sys class Genotype(object): ''' This class stores information about each sample. ''' def __init__(self, variant, gt): ''' Initialize the class. All instances have a GT field. ''' self.format = dict() self.variant = variant self.set_format('GT', gt)...
import sys class Genotype(object): def __init__(self, variant, gt): self.format = dict() self.variant = variant self.set_format('GT', gt) def set_formats(self, fields, values): format_set = self.variant.format_set add_to_active = self.variant.active_formats.add ...
Python
0.000002
e2a0fb602c9de9f988d733a30b466dc400cd9503
update issue 84
test/test_issue084.py
test/test_issue084.py
from codecs import getreader from StringIO import StringIO from rdflib.term import URIRef from rdflib.graph import Graph rdf = u"""@prefix skos: <http://www.w3.org/2004/02/skos/core#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix : <http://www.test.org/#> . :world rdf:type skos:Concept; ...
from rdflib.term import URIRef from rdflib.graph import Graph rdf = u"""@prefix skos: <http://www.w3.org/2004/02/skos/core#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix : <http://www.test.org/#> . :world rdf:type skos:Concept; skos:prefLabel "World"@en. :africa rdf:type skos:Concept; ...
Python
0
f486280a264c195c989d59f0b3fa631d9e165a18
Fix comment
servo_write.py
servo_write.py
from tamproxy import Sketch, SyncedSketch, Timer from tamproxy.devices import Servo class ServoWrite(Sketch): """Cycles a servo back and forth between 1050us and 1950us pulse widths (most servos are 1000-2000)""" def setup(self): self.servo = Servo(self.tamp, 9) self.servo.write(1050) ...
from tamproxy import Sketch, SyncedSketch, Timer from tamproxy.devices import Servo # Cycles a motor back and forth between -255 and 255 PWM every ~5 seconds class ServoWrite(Sketch): def setup(self): self.servo = Servo(self.tamp, 9) self.servo.write(1050) self.timer = Timer() sel...
Python
0
a0a2810e52ba27bb2b6eba5d13d8a3bc88bca266
Complete overhaul because I hated the ConfigParser module.
camoco/Config.py
camoco/Config.py
#!/usr/env/python3 import os import configparser import yaml import pprint global cf default_config = '''--- # YAML Camoco Configuration File options: basedir: ~/.camoco/ testdir: ~/.camoco/tests/ logging: log_level: verbose test: force: RefGen: True COB: True Ontolo...
#!/usr/env/python3 import os import configparser global cf cf = configparser.ConfigParser() cf._interpolation = configparser.ExtendedInterpolation() cf_file = os.path.expanduser('~/.camoco.conf') default_config = ''' [options] basedir = ~/.camoco/ testdir = ~/.camoco/tests/ [logging] log_level = verbose [test]...
Python
0
648de375f5e9ae1620bc836e5d647688b541690c
Add atom package
test/test_packages.py
test/test_packages.py
import pytest @pytest.mark.parametrize("name", [ ("apt-file"), ("apt-transport-https"), ("atom"), ("blktrace"), ("ca-certificates"), ("chromium-browser"), ("cron"), ("curl"), ("diod"), ("docker-ce"), ("fonts-font-awesome"), ("git"), ("gnupg"), ("handbrake"), ("handbrake-cli"), ("haveged...
import pytest @pytest.mark.parametrize("name", [ ("apt-file"), ("apt-transport-https"), ("blktrace"), ("ca-certificates"), ("chromium-browser"), ("cron"), ("curl"), ("diod"), ("docker-ce"), ("fonts-font-awesome"), ("git"), ("gnupg"), ("handbrake"), ("handbrake-cli"), ("haveged"), ("htop...
Python
0.000002
89664ec37036553534c07d65f2df2b9fa07bfe80
Check total weights remain correct.
test/test_priority.py
test/test_priority.py
# -*- coding: utf-8 -*- """ test_priority ~~~~~~~~~~~~~ Tests for the Priority trees """ from hypothesis import given from hypothesis.strategies import integers, lists, tuples import priority STREAMS_AND_WEIGHTS = lists( elements=tuples( integers(min_value=1), integers(min_value=1, max_value=255) ),...
# -*- coding: utf-8 -*- """ test_priority ~~~~~~~~~~~~~ Tests for the Priority trees """ from hypothesis import given from hypothesis.strategies import integers, lists, tuples import priority STREAMS_AND_WEIGHTS = lists( elements=tuples( integers(min_value=1), integers(min_value=1, max_value=255) ),...
Python
0
4530eea92e37c087b6f25fe3a0e48e54b949b68b
allow setup.py to work without django
cart/__init__.py
cart/__init__.py
__version__ = '1.1' VERSION = tuple(map(int, __version__.split('.'))) + ('dev',) def get_helper_module(): '''Get the helper module as defined in the settings.''' # need to be able to import file without importing django, so these can't go # at the top from django.utils.importlib import import_modu...
from django.utils.importlib import import_module from django.core.exceptions import ImproperlyConfigured __version__ = '1.1' VERSION = tuple(map(int, __version__.split('.'))) + ('dev',) def get_helper_module(): '''Get the helper module as defined in the settings.''' import settings as cart_settings if car...
Python
0.000001
a3b6306b2288b6dc4a9ec6e04a5962c7fb94699e
Update addition.py: s/stop/N
pyeda/logic/addition.py
pyeda/logic/addition.py
""" Logic functions for addition Interface Functions: ripple_carry_add kogge_stone_add brent_kung_add """ # Disable "invalid variable name" # pylint: disable=C0103 from math import floor, log from pyeda.boolalg.expr import Xor, Majority from pyeda.boolalg.vexpr import BitVector from pyeda.util import cl...
""" Logic functions for addition Interface Functions: ripple_carry_add kogge_stone_add brent_kung_add """ # Disable "invalid variable name" # pylint: disable=C0103 from math import floor, log from pyeda.boolalg.expr import Xor, Majority from pyeda.boolalg.vexpr import BitVector from pyeda.util import cl...
Python
0.000001
99d76458256da781fc4b25a75d68a7a6d8c9379d
Correcting a typo in entries URLConf
urls/entries.py
urls/entries.py
""" URLs for entries in a weblog. """ from django.conf.urls.defaults import * from django.views.generic import date_based from coltrane.models import Entry entry_info_dict = { 'queryset': Entry.live.all(), 'date_field': 'pub_date', } urlpatterns = patterns('', url(r'^$', ...
""" URLs for entries in a weblog. """ from django.conf.urls.defaults import * from django.views.generic import date_based from coltrane.models import Entry entry_info_dict = { 'queryset': Entry.live.all(), 'date_field': 'pub_date', } urlpatterns = patterns('', url(r'^$', ...
Python
0.998607
f89bc55aebeba0cbf3c8423c97599aa0d334d9c9
Fix lint error (#113)
synthtool/gcp/common.py
synthtool/gcp/common.py
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
Python
0.000001
7b4531ec867982ba2f660a2a08e85dbae457083e
Fix new line stripping in admin site
users/models.py
users/models.py
import hashlib import urllib.parse as urllib from django.contrib.auth.models import User from django.db import models # extension to django's User class which has authentication details # as well as some basic info such as name class Member(models.Model): def gravatar(self, size=128): default = "https://...
import hashlib import urllib.parse as urllib from django.contrib.auth.models import User from django.db import models # extension to django's User class which has authentication details # as well as some basic info such as name class Member(models.Model): def gravatar(self, size=128): default = "https://...
Python
0
57cec2b03eaa6857bcb1b3780c4de00c3165b281
Return early if owner
utils/checks.py
utils/checks.py
from discord.ext import commands def is_owner_or(**perms): async def predicate(ctx): if await ctx.bot.is_owner(ctx.author): return True permissions = ctx.channel.permissions_for(ctx.author) return all(getattr(permissions, perm, None) == value for per...
from discord.ext import commands def is_owner_or(**perms): async def predicate(ctx): owner = await ctx.bot.is_owner(ctx.author) permissions = ctx.channel.permissions_for(ctx.author) return all(getattr(permissions, perm, None) == value for perm, value in perms.ite...
Python
0.000006
28c314e98ec88586b8c423b0941d8f029e4946e9
fix function which has obviously never been tested
lib/xdg_secret.py
lib/xdg_secret.py
import subprocess def xdg_secret_store(label, secret, attrs): with subprocess.Popen(["secret-tool", "store", "--label", label] + attrs, stdin=subprocess.PIPE) as proc: proc.communicate(secret.encode("utf-8")) return proc.wait() == 0 def xdg_secret_lookup_secret(attrs): ...
import subprocess def xdg_secret_store(label, secret, attrs): with subprocess.Popen(["secret-tool", "store", "--label", label] + attrs, stdin=subprocess.PIPE) as proc: proc.communicate(secret.encode("utf-8")) return proc.wait() == 0 def xdg_secret_lookup_secret(attrs): ...
Python
0.000001
2d3016ce69e9a40dc5e428a0aa6ea75775c7d84a
Fix subscribe merge_vars.
pybossa/newsletter/__init__.py
pybossa/newsletter/__init__.py
# -*- coding: utf8 -*- # This file is part of PyBossa. # # Copyright (C) 2014 SF Isle of Man Limited # # PyBossa is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at...
# -*- coding: utf8 -*- # This file is part of PyBossa. # # Copyright (C) 2014 SF Isle of Man Limited # # PyBossa is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at...
Python
0
e1a4b0d7f7d9e860dce794e07aadedea193d470e
Set version to v2.0.18.dev1
spacy/about.py
spacy/about.py
# inspired from: # https://python-packaging-user-guide.readthedocs.org/en/latest/single_source_version/ # https://github.com/pypa/warehouse/blob/master/warehouse/__about__.py __title__ = 'spacy' __version__ = '2.0.18.dev1' __summary__ = 'Industrial-strength Natural Language Processing (NLP) with Python and Cython' __u...
# inspired from: # https://python-packaging-user-guide.readthedocs.org/en/latest/single_source_version/ # https://github.com/pypa/warehouse/blob/master/warehouse/__about__.py __title__ = 'spacy' __version__ = '2.0.18' __summary__ = 'Industrial-strength Natural Language Processing (NLP) with Python and Cython' __uri__ ...
Python
0.000011
d5c8d2f5fd4177b6f4980689ae972352563c28e5
Update about.py and increment version
spacy/about.py
spacy/about.py
# inspired from: # https://python-packaging-user-guide.readthedocs.org/en/latest/single_source_version/ # https://github.com/pypa/warehouse/blob/master/warehouse/__about__.py __title__ = 'spacy' __version__ = '2.0.0' __summary__ = 'Industrial-strength Natural Language Processing (NLP) with Python and Cython' __uri__ =...
# inspired from: # https://python-packaging-user-guide.readthedocs.org/en/latest/single_source_version/ # https://github.com/pypa/warehouse/blob/master/warehouse/__about__.py __title__ = 'spacy' __version__ = '1.8.2' __summary__ = 'Industrial-strength Natural Language Processing (NLP) with Python and Cython' __uri__ =...
Python
0
845be624ed0dfb8d942b240034af8b58f7a32e13
Fix the benchmark warm up code to make sure op that graph is not re-optimized during the timed run.
tensorflow/python/data/benchmarks/benchmark_base.py
tensorflow/python/data/benchmarks/benchmark_base.py
# Copyright 2019 The TensorFlow 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 applica...
# Copyright 2019 The TensorFlow 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 applica...
Python
0.000087
4e2f5c79b67a86fce622c486a0ea28fca0130015
clean up default arguments in strip_training_tags()
taggertester/testing.py
taggertester/testing.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from nltk.tag.stanford import StanfordPOSTagger from .config import DATA_DIR_NAME, PATH_TO_DATA_DIR from .files import TrainingFile, write_to_directory from .tag import FilePair class TaggerTester(object): """Collection of files for training/testing part-of-speech ta...
#!/usr/bin/env python # -*- coding: utf-8 -*- from nltk.tag.stanford import StanfordPOSTagger from .config import DATA_DIR_NAME, PATH_TO_DATA_DIR from .files import TrainingFile, write_to_directory from .tag import FilePair class TaggerTester(object): """Collection of files for training/testing part-of-speech ta...
Python
0