commit stringlengths 40 40 | subject stringlengths 4 1.73k | repos stringlengths 5 127k | old_file stringlengths 2 751 | new_file stringlengths 2 751 | new_contents stringlengths 1 8.98k | old_contents stringlengths 0 6.59k | license stringclasses 13
values | lang stringclasses 23
values |
|---|---|---|---|---|---|---|---|---|
b4f0bbb8e9fd198cfa60daa3a01a4a48a0fd18af | Replace assertFalse/assertTrue(a in b) | openstack/sahara,openstack/sahara | sahara/tests/unit/plugins/storm/test_config_helper.py | sahara/tests/unit/plugins/storm/test_config_helper.py | # Copyright 2017 Massachusetts Open Cloud
#
# 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... | # Copyright 2017 Massachusetts Open Cloud
#
# 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... | apache-2.0 | Python |
603c36aec2a4704bb4cf41c224194a5f83f9babe | Set the module as auto_install | BT-ojossen/e-commerce,Antiun/e-commerce,raycarnes/e-commerce,jt-xx/e-commerce,gurneyalex/e-commerce,BT-ojossen/e-commerce,Endika/e-commerce,damdam-s/e-commerce,vauxoo-dev/e-commerce,charbeljc/e-commerce,brain-tec/e-commerce,BT-jmichaud/e-commerce,Endika/e-commerce,brain-tec/e-commerce,JayVora-SerpentCS/e-commerce,fevxi... | sale_payment_method_automatic_workflow/__openerp__.py | sale_payment_method_automatic_workflow/__openerp__.py | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Guewen Baconnier
# Copyright 2015 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# pu... | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Guewen Baconnier
# Copyright 2015 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# pu... | agpl-3.0 | Python |
4a6060f476aebac163dbac8f9822539596379c0a | Use current_app.babel_instance instead of babel | Turbo87/welt2000,Turbo87/welt2000 | welt2000/__init__.py | welt2000/__init__.py | from flask import Flask, request, session, current_app
from flask.ext.babel import Babel
from babel.core import negotiate_locale
from welt2000.__about__ import (
__title__, __summary__, __uri__, __version__, __author__, __email__,
__license__,
) # noqa
app = Flask(__name__)
app.secret_key = '1234567890'
ba... | from flask import Flask, request, session
from flask.ext.babel import Babel
from babel.core import negotiate_locale
from welt2000.__about__ import (
__title__, __summary__, __uri__, __version__, __author__, __email__,
__license__,
) # noqa
app = Flask(__name__)
app.secret_key = '1234567890'
babel = Babel(a... | mit | Python |
58ec62fe47bf6e7acb3302a29fd0df48c4342cec | Enable break and continue in templates | yaph/logya,elaOnMars/logya,elaOnMars/logya,yaph/logya,elaOnMars/logya | logya/template.py | logya/template.py | # -*- coding: utf-8 -*-
import io
import os
from jinja2 import Environment, BaseLoader, TemplateNotFound, escape
def filesource(logya_inst, name, lines=None):
"""Read and return source of text files.
A template function that reads the source of the given file and returns it.
The text is escaped so it ca... | # -*- coding: utf-8 -*-
import io
import os
from jinja2 import Environment, BaseLoader, TemplateNotFound, escape
def filesource(logya_inst, name, lines=None):
"""Read and return source of text files.
A template function that reads the source of the given file and returns it.
The text is escaped so it ca... | mit | Python |
6f0740fbd94acc2398f0628552a6329c2a90a348 | Allow start and end arguments to take inputs of multiple words such as 'New York' | MikeVasmer/GreenGraphCoursework | greengraph/command.py | greengraph/command.py | from argparse import ArgumentParser
from matplotlib import pyplot as plt
from graph import Greengraph
def process():
parser = ArgumentParser(
description="Produce graph quantifying the amount of green land between two locations")
parser.add_argument("--start", required=True, nargs="+",
... | from argparse import ArgumentParser
from matplotlib import pyplot as plt
from graph import Greengraph
def process():
parser = ArgumentParser(
description="Produce graph quantifying the amount of green land between two locations")
parser.add_argument("--start", required=True,
he... | mit | Python |
3fe0a520a458a575117fc8d809f21efd133d2887 | Add license file | tranlyvu/find-link,tranlyvu/findLink | wikilink/__init__.py | wikilink/__init__.py | """
wiki-link
~~~~~~~~
wiki-link is a web-scraping application to find minimum number
of links between two given wiki pages.
:copyright: (c) 2016 - 2018 by Tran Ly VU. All Rights Reserved.
:license: Apache License 2.0.
"""
__all__ = ["wiki_link"]
__author__ = "Tran Ly Vu (vutransingapore@gmail.com)"
__v... | """
wiki-link
~~~~~~~~
wiki-link is a web-scraping application to find minimum number
of links between two given wiki pages.
:copyright: (c) 2016 - 2018 by Tran Ly VU. All Rights Reserved.
:license: Apache License 2.0.
"""
__all__ = ["wiki_link"]
__author__ = "Tran Ly Vu (vutransingapore@gmail.com)"
__ve... | apache-2.0 | Python |
7a9f3f6cc880d2bcf0cdac8b5193b471eb2b9095 | Refactor Adapter pattern | zitryss/Design-Patterns-in-Python | structural/adapter.py | structural/adapter.py | """
Convert the interface of a class into another interface clients expect.
Adapter lets classes work together that couldn't otherwise because of
incompatible interfaces.
"""
import abc
class Target(metaclass=abc.ABCMeta):
"""
Define the domain-specific interface that Client uses.
"""
def __init__(s... | """
Convert the interface of a class into another interface clients expect.
Adapter lets classes work together that couldn't otherwise because of
incompatible interfaces.
"""
import abc
class Target(metaclass=abc.ABCMeta):
"""
Define the domain-specific interface that Client uses.
"""
def __init__(s... | mit | Python |
3c63201d6113d01c870748f21be2501282a2316a | Remove unneeded import in gmail.py. | pbl-cloud/paas-manager,pbl-cloud/paas-manager,pbl-cloud/paas-manager | paas_manager/app/util/gmail.py | paas_manager/app/util/gmail.py | import sys
import smtplib
from email.mime.text import MIMEText
from email.utils import formatdate
from ... import config
def create_message(from_addr, to_addr, subject, message, encoding):
body = MIMEText(message, 'plain', encoding)
body['Subject'] = subject
body['From'] = from_addr
body['To'] = to_add... | import sys
import smtplib
from email.mime.text import MIMEText
from email.utils import formatdate
import yaml
from ... import config
def create_message(from_addr, to_addr, subject, message, encoding):
body = MIMEText(message, 'plain', encoding)
body['Subject'] = subject
body['From'] = from_addr
body['T... | mit | Python |
4588a52ebfc3aee127a34a9e10067c0121c4f72e | add 'tab' and 'shift tab' for down/up movement | CanonicalLtd/subiquity,CanonicalLtd/subiquity | subiquity/ui/frame.py | subiquity/ui/frame.py | # Copyright 2015 Canonical, Ltd.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distribute... | # Copyright 2015 Canonical, Ltd.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distribute... | agpl-3.0 | Python |
791fb484937cabeb3a098bcd173db782efe53d7c | support filtering of Authors by organization and positions | liddiard/skry | authors/views.py | authors/views.py | from rest_framework import viewsets, permissions
from . import serializers
from . import models
class AuthorViewSet(viewsets.ModelViewSet):
permission_classes = (permissions.DjangoModelPermissionsOrAnonReadOnly,)
queryset = models.Author.objects.all()
serializer_class = serializers.AuthorSerializer
f... | from rest_framework import viewsets, permissions
from . import serializers
from . import models
class AuthorViewSet(viewsets.ModelViewSet):
permission_classes = (permissions.DjangoModelPermissionsOrAnonReadOnly,)
queryset = models.Author.objects.all()
serializer_class = serializers.AuthorSerializer
f... | mit | Python |
8aa52ea8f07f922bc6d5952ca8ad56bedd042a1f | Bump version number. | GreatFruitOmsk/nativeconfig | nativeconfig/version.py | nativeconfig/version.py | VERSION = '2.4.0'
| VERSION = '2.3.0'
| mit | Python |
fb223397ccdee519af7e17dc73db864fe0120e8b | Create a random HDFS folder for unit testing | duedil-ltd/pyfilesystem | fs/tests/test_hadoop.py | fs/tests/test_hadoop.py | """
fs.tests.test_hadoop: TestCases for the HDFS Hadoop Filesystem
This test suite is skipped unless the following environment variables are
configured with valid values.
* PYFS_HADOOP_NAMENODE_ADDR
* PYFS_HADOOP_NAMENODE_PORT [default=50070]
* PYFS_HADOOP_NAMENODE_PATH [default="/"]
All tests will be executed wi... | """
fs.tests.test_hadoop: TestCases for the HDFS Hadoop Filesystem
This test suite is skipped unless the following environment variables are
configured with valid values.
* PYFS_HADOOP_NAMENODE_ADDR
* PYFS_HADOOP_NAMENODE_PORT [default=50070]
* PYFS_HADOOP_NAMENODE_PATH [default="/"]
All tests will be executed wi... | bsd-3-clause | Python |
926bf60c77673571cb8f6d12e3754507f41b9e80 | add optional args | 20c/ngage,20c/ngage | ngage/plugins/napalm.py | ngage/plugins/napalm.py | from __future__ import absolute_import
import ngage
from ngage.exceptions import AuthenticationError, ConfigError
import napalm_base
from napalm_base.exceptions import (
ConnectionException,
ReplaceConfigException,
MergeConfigException
)
@ngage.plugin.register('napalm')
class Driver(ngage.plugins.Driver... | from __future__ import absolute_import
import ngage
from ngage.exceptions import AuthenticationError, ConfigError
import napalm_base
from napalm_base.exceptions import (
ConnectionException,
ReplaceConfigException,
MergeConfigException
)
@ngage.plugin.register('napalm')
class Driver(ngage.plugins.Driver... | apache-2.0 | Python |
68cf8281b512ea5941ec0b88ca532409e0e97866 | Fix circular import | comic/comic-django,comic/comic-django,comic/comic-django,comic/comic-django,comic/comic-django | app/evaluation/emails.py | app/evaluation/emails.py | import json
from django.conf import settings
from django.core.mail import send_mail
from comicsite.core.urlresolvers import reverse
def send_failed_job_email(job):
message = (
f'Unfortunately the evaluation for the submission to '
f'{job.challenge.short_name} failed with an error. The error mess... | import json
from django.conf import settings
from django.core.mail import send_mail
from comicsite.core.urlresolvers import reverse
from evaluation.models import Result, Job
def send_failed_job_email(job: Job):
message = (
f'Unfortunately the evaluation for the submission to '
f'{job.challenge.s... | apache-2.0 | Python |
04aa968a70b8065c9c9cd013d1266f8988c4220a | remove accidentally committed maxDiff change | hhursev/recipe-scraper | tests/__init__.py | tests/__init__.py | import os
import unittest
import pytest
class ScraperTest(unittest.TestCase):
online = False
test_file_name = None
def setUp(self):
os.environ[
"RECIPE_SCRAPERS_SETTINGS"
] = "tests.test_data.test_settings_module.test_settings"
test_file_name = (
self.te... | import os
import unittest
import pytest
class ScraperTest(unittest.TestCase):
maxDiff = None
online = False
test_file_name = None
def setUp(self):
os.environ[
"RECIPE_SCRAPERS_SETTINGS"
] = "tests.test_data.test_settings_module.test_settings"
test_file_name = (
... | mit | Python |
c72b28ece7fe5313c7eff5f26d9ef0baaad1bad2 | Update denormalization command | barberscore/barberscore-api,dbinetti/barberscore-django,dbinetti/barberscore-django,barberscore/barberscore-api,barberscore/barberscore-api,dbinetti/barberscore,dbinetti/barberscore,barberscore/barberscore-api | project/apps/api/management/commands/denormalize.py | project/apps/api/management/commands/denormalize.py | from django.core.management.base import (
BaseCommand,
)
from apps.api.models import (
Convention,
Contest,
Award,
Contestant,
Entrant,
Session,
Performance,
Song,
Singer,
Director,
Panelist,
)
class Command(BaseCommand):
help = "Command to denormailze data."
... | from django.core.management.base import (
BaseCommand,
)
from apps.api.models import (
Convention,
Contest,
Contestant,
Performance,
Song,
Group,
Singer,
Director,
Panelist,
)
class Command(BaseCommand):
help = "Command to denormailze data."
def handle(self, *args, **... | bsd-2-clause | Python |
74c4c832b5f99643ac23ad3885f22f7a493016f7 | Update denormalization command | barberscore/barberscore-api,dbinetti/barberscore-django,barberscore/barberscore-api,barberscore/barberscore-api,dbinetti/barberscore,dbinetti/barberscore,barberscore/barberscore-api,dbinetti/barberscore-django | project/apps/api/management/commands/denormalize.py | project/apps/api/management/commands/denormalize.py | from django.core.management.base import (
BaseCommand,
)
from apps.api.models import (
Convention,
Contest,
Award,
Contestant,
Entrant,
Session,
Performance,
Song,
Singer,
Director,
Panelist,
)
class Command(BaseCommand):
help = "Command to denormailze data."
... | from django.core.management.base import (
BaseCommand,
)
from apps.api.models import (
Convention,
Contest,
Contestant,
Performance,
Song,
Group,
Singer,
Director,
Panelist,
)
class Command(BaseCommand):
help = "Command to denormailze data."
def handle(self, *args, **... | bsd-2-clause | Python |
ec9bc89372670e623dbe98c34591fba62a0ee64a | Rename merge to pack in postp. | tjcorona/PyFR,iyer-arvind/PyFR,tjcorona/PyFR,BrianVermeire/PyFR,Aerojspark/PyFR,tjcorona/PyFR | pyfr/scripts/postp.py | pyfr/scripts/postp.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from tempfile import NamedTemporaryFile
from argparse import ArgumentParser, FileType
import numpy as np
from pyfr.util import rm
def process_pack(args):
# List the contents of the directory
relnames = os.listdir(args.indir)
# Get the absolute fi... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from tempfile import NamedTemporaryFile
from argparse import ArgumentParser, FileType
import numpy as np
from pyfr.util import rm
def process_pack(args):
# List the contents of the directory
relnames = os.listdir(args.indir)
# Get the absolute fi... | bsd-3-clause | Python |
301b2ca9cdf33665312e092937c63b1db7db888f | Add missing imports | Cretezy/pymessenger2,karlinnolabs/pymessenger | pymessenger2/utils.py | pymessenger2/utils.py | import hashlib
import hmac
import six
import attr
import json
def validate_hub_signature(app_secret, request_payload, hub_signature_header):
"""
@inputs:
app_secret: Secret Key for application
request_payload: request body
hub_signature_header: X-Hub-Signature header se... | import hashlib
import hmac
import six
def validate_hub_signature(app_secret, request_payload, hub_signature_header):
"""
@inputs:
app_secret: Secret Key for application
request_payload: request body
hub_signature_header: X-Hub-Signature header sent with request
... | mit | Python |
20d41656488ea43978f749e2e34303e49981695c | fix imports to include OR tools | paolodragone/PyMzn | pymzn/mzn/__init__.py | pymzn/mzn/__init__.py |
from .model import *
from .solvers import *
from .minizinc import *
from .templates import *
__all__ = [
'Solutions', 'minizinc', 'mzn2fzn', 'solns2out', 'MiniZincError',
'MiniZincUnsatisfiableError', 'MiniZincUnknownError',
'MiniZincUnboundedError', 'MiniZincModel', 'Statement', 'Constraint',
'Variab... |
from .model import *
from .solvers import *
from .minizinc import *
from .templates import *
__all__ = [
'Solutions', 'minizinc', 'mzn2fzn', 'solns2out', 'MiniZincError',
'MiniZincUnsatisfiableError', 'MiniZincUnknownError',
'MiniZincUnboundedError', 'MiniZincModel', 'Statement', 'Constraint',
'Variab... | mit | Python |
80bc283676be51ef67fe7924bcc32adaa93fc985 | Change timestamp format | anl-mcampos/GuestBook,anl-mcampos/GuestBook | guestbook/__init__.py | guestbook/__init__.py | # coding: utf-8
import pickle
from datetime import datetime
from collections import namedtuple, deque
from flask import Flask, request, render_template, redirect, escape, Markup
application = Flask(__name__)
DATA_FILE = 'guestbook.dat'
Post = namedtuple('Post', ['name', 'timestamp', 'comment'])
def save_post(name... | # coding: utf-8
import pickle
from datetime import datetime
from collections import namedtuple, deque
from flask import Flask, request, render_template, redirect, escape, Markup
application = Flask(__name__)
DATA_FILE = 'guestbook.dat'
Post = namedtuple('Post', ['name', 'timestamp', 'comment'])
def save_post(name... | mit | Python |
f860a306b4c9fc583a83289ae2a6ecf407214e38 | Add more checks to avoid crashing when input files are missing | pySTEPS/pysteps | pysteps/io/readers.py | pysteps/io/readers.py | """Methods for reading files.
"""
import numpy as np
def read_timeseries(inputfns, importer, **kwargs):
"""Read a list of input files using io tools and stack them into a 3d array.
Parameters
----------
inputfns : list
List of input files returned by any function implemented in archive.
i... | """Methods for reading files.
"""
import numpy as np
def read_timeseries(inputfns, importer, **kwargs):
"""Read a list of input files using io tools and stack them into a 3d array.
Parameters
----------
inputfns : list
List of input files returned by any function implemented in archive.
i... | bsd-3-clause | Python |
dbc1df293f283367526b3a80c5f24d71e5d46be1 | fix bug abort is undefined and return 204 | ylerjen/pir-hat,ylerjen/pir-hat,ylerjen/pir-hat | middleware/app.py | middleware/app.py | from flask import Flask, jsonify, request, abort
from sense_hat import SenseHat
from hat_manager import HatManager
app = Flask(__name__)
sense_hat = SenseHat()
hat_manager = HatManager(sense_hat)
@app.route('/')
def index():
return 'Welcome to the PI manager. Choose a route according to what you want to do.'
... | from flask import Flask, jsonify, request
from sense_hat import SenseHat
from hat_manager import HatManager
app = Flask(__name__)
sense_hat = SenseHat()
hat_manager = HatManager(sense_hat)
@app.route('/')
def index():
return 'Welcome to the PI manager. Choose a route according to what you want to do.'
@app.ro... | mit | Python |
fb34eebd253727dcc718e2387cb6f4ac763f0bae | Add DateTime Completed Field to Task | csdevsc/mcs_website,csdevsc/colcat_crowdsourcing_application,csdevsc/colcat_crowdsourcing_application,csdevsc/colcat_crowdsourcing_application,csdevsc/mcs_website,csdevsc/mcs_website | tasks/models/tasks.py | tasks/models/tasks.py | """Models for tasks
Each new type of task corresponds to a task model
"""
from django.db import models
from data import Data_FullGrid_Confidence, Data_FullGrid
# Tasks
class Task_Naming_001(Data_FullGrid_Confidence):
class Meta:
db_table = 'tbl_response_naming_001'
def __unicode__(self):
retu... | """Models for tasks
Each new type of task corresponds to a task model
"""
from django.db import models
from data import Data_FullGrid_Confidence, Data_FullGrid
# Tasks
class Task_Naming_001(Data_FullGrid_Confidence):
class Meta:
db_table = 'tbl_response_naming_001'
def __unicode__(self):
retu... | mit | Python |
547c1d5d1ff2ced0969a86eda6e0094f8b76d94f | Bump to 0.1.1 with setup.py fix | NitishT/minio-py,krishnasrinivas/minio-py,harshavardhana/minio-py,NitishT/minio-py,donatello/minio-py,minio/minio-py,minio/minio-py | minio/__init__.py | minio/__init__.py | # Minimal Object Storage Library, (C) 2015 Minio, 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... | # Minimal Object Storage Library, (C) 2015 Minio, 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... | apache-2.0 | Python |
4bb8a61cde27575865cdd2b7df5afcb5d6860523 | Add weird SLP orientation to get_world_pedir | oesteban/fmriprep,poldracklab/preprocessing-workflow,oesteban/fmriprep,poldracklab/preprocessing-workflow,oesteban/fmriprep | fmriprep/interfaces/tests/test_reports.py | fmriprep/interfaces/tests/test_reports.py | import pytest
from ..reports import get_world_pedir
@pytest.mark.parametrize("orientation,pe_dir,expected", [
('RAS', 'j', 'Posterior-Anterior'),
('RAS', 'j-', 'Anterior-Posterior'),
('RAS', 'i', 'Left-Right'),
('RAS', 'i-', 'Right-Left'),
('RAS', 'k', 'Inferior-Superior'),
('RAS', 'k-', 'Sup... | import pytest
from ..reports import get_world_pedir
@pytest.mark.parametrize("orientation,pe_dir,expected", [
('RAS', 'j', 'Posterior-Anterior'),
('RAS', 'j-', 'Anterior-Posterior'),
('RAS', 'i', 'Left-Right'),
('RAS', 'i-', 'Right-Left'),
('RAS', 'k', 'Inferior-Superior'),
('RAS', 'k-', 'Sup... | bsd-3-clause | Python |
bfa66827e5afd175c15640b1678fbba347009953 | Fix unit tests | ArchiveLabs/dweb_gateway,ArchiveLabs/dweb_gateway | python/test/_utils.py | python/test/_utils.py | from python.ServerGateway import DwebGatewayHTTPRequestHandler
def _processurl(url, verbose, headers={}, **kwargs):
# Simulates HTTP Server process - wont work for all methods
args = url.split('/')
method = args.pop(0)
DwebGatewayHTTPRequestHandler.headers = headers # This is a kludge, put headers on ... | from python.ServerGateway import DwebGatewayHTTPRequestHandler
def _processurl(url, verbose, **kwargs):
# Simulates HTTP Server process - wont work for all methods
args = url.split('/')
method = args.pop(0)
f = getattr(DwebGatewayHTTPRequestHandler, method)
assert f
namespace = args.pop(0)
... | agpl-3.0 | Python |
c7e9ea888bbbcef9e7ae29340c45e9aaf211d1da | Fix tests | spyder-ide/qtpy,davvid/qtpy,davvid/qtpy,goanpeca/qtpy,goanpeca/qtpy | tests/travis.py | tests/travis.py | import os
os.environ['QT_API'] = os.environ['USE_QT_API'].lower()
from qtpy import QtCore, QtGui, QtWidgets
print('Qt version:%s' % QtCore.__version__)
print(QtCore.QEvent)
print(QtGui.QPainter)
print(QtWidgets.QWidget)
| import os
os.environ['QT_API'] = os.environ['USE_QT_API']
from qtpy import QtCore, QtGui, QtWidgets
print('Qt version:%s' % QtCore.__version__)
print(QtCore.QEvent)
print(QtGui.QPainter)
print(QtWidgets.QWidget)
| mit | Python |
efac3c253dcd71be2c6510b5025ddedbb9a7358e | work when there's no RAVEN_CONFIG | pulilab/rapidpro,pulilab/rapidpro,tsotetsi/textily-web,tsotetsi/textily-web,pulilab/rapidpro,tsotetsi/textily-web,tsotetsi/textily-web,tsotetsi/textily-web,pulilab/rapidpro,pulilab/rapidpro | temba/temba_celery.py | temba/temba_celery.py | from __future__ import absolute_import, unicode_literals
import celery
import os
import raven
import sys
from django.conf import settings
from raven.contrib.celery import register_signal, register_logger_signal
# set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_... | from __future__ import absolute_import, unicode_literals
import celery
import os
import raven
import sys
from django.conf import settings
from raven.contrib.celery import register_signal, register_logger_signal
# set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_... | agpl-3.0 | Python |
c90fce44f30398fef0c20ec08f761ae19951308a | Delete unused pipeline settings | koopauy/django-vagrant-boilerplate,koopauy/django-vagrant-boilerplate,koopauy/django-vagrant-boilerplate,koopauy/django-vagrant-boilerplate | {{cookiecutter.repo_name}}/src/settings/project.py | {{cookiecutter.repo_name}}/src/settings/project.py | # -*- coding: utf-8 -*-
"""
Project settings for {{cookiecutter.project_name}}
Author : {{cookiecutter.author_name}} <{{cookiecutter.email}}>
"""
from defaults import *
from getenv import env
INSTALLED_APPS += (
'applications.front',
)
GRAPPELLI_ADMIN_TITLE = "Admin"
| # -*- coding: utf-8 -*-
"""
Project settings for {{cookiecutter.project_name}}
Author : {{cookiecutter.author_name}} <{{cookiecutter.email}}>
"""
from defaults import *
from getenv import env
INSTALLED_APPS += (
'applications.front',
)
GRAPPELLI_ADMIN_TITLE = "Admin"
PIPELINE_CSS = {
'styleshee... | mit | Python |
eaf390b065944a64a3b74c1b0e43b1df60d4e88f | Reimplement deduping hurr | frol/invoke,sophacles/invoke,mattrobenolt/invoke,frol/invoke,pyinvoke/invoke,mkusz/invoke,pyinvoke/invoke,alex/invoke,kejbaly2/invoke,mattrobenolt/invoke,mkusz/invoke,tyewang/invoke,kejbaly2/invoke,pfmoore/invoke,singingwolfboy/invoke,pfmoore/invoke | 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... | bsd-2-clause | Python |
375d12ab7486f6bb0d57232d48c556e6c0eda0c1 | Update P05_stylingExcel fixed PEP8 spacing | JoseALermaIII/python-tutorials,JoseALermaIII/python-tutorials | 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... | mit | Python |
17793c9b3ceecc206aab1d1c34c0d3dc69892cbd | Use ArgumentParser to enforce required arguments | nickbattam/picamon,nickbattam/picamon,nickbattam/picamon,nickbattam/picamon | 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... | apache-2.0 | Python |
81a4b04173033d7e678ad6c4b4efae654af9ac11 | Use a threading local object to isolate MongoDB connection between different threads but reuse the same connection in the same thread | GeographicaGS/moocng,GeographicaGS/moocng,GeographicaGS/moocng,OpenMOOC/moocng,GeographicaGS/moocng,OpenMOOC/moocng | 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... | apache-2.0 | Python |
aa9143302b376e1274c8c11b53687771d0444b5a | Remove now-unused isInt code | pictuga/morss,pictuga/morss,pictuga/morss | 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... | agpl-3.0 | Python |
3927fd757ff404af61e609cc1728d1f3fe398230 | Fix on error text. | aperture321/hipbit | 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... | mit | Python |
e1e25bc1166efa9a39fdf769f1081fafd08dd937 | handle unknown source country, add recovered | lepinkainen/pyfibot,lepinkainen/pyfibot | 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 = ... | bsd-3-clause | Python |
13f26d9007629be019140aa3bedd5f6fbfefe69b | delete all() method when apply document filter | kyunooh/JellyBlog,kyunooh/JellyBlog,kyunooh/JellyBlog | 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.... | apache-2.0 | Python |
deaee894589a2247b9322ba5cdb94e4c127c35bd | correct docstring for KeyringLocked class | jaraco/keyring | 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... | mit | Python |
15f45377dffa2e267464b38f5f87ffe9526fa8f6 | Update support to jax (#585) | lanpa/tensorboardX,lanpa/tensorboardX | 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... | mit | Python |
4e280094687d8c369a1eee3c8b7bb246549898eb | Update utils.py | CMPUT404/socialdistribution,CMPUT404/socialdistribution,CMPUT404/socialdistribution | 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... | apache-2.0 | Python |
cd4e7c5bc10c8e946ddf31d99a249a5a97b2dfda | Update get-observations.py | valpo-sats/scheduling-bazaar,valpo-sats/scheduling-bazaar | 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)... | agpl-3.0 | Python |
43e8b090d806d615a8153d1e14063cc6d274bb25 | Update issue 130 Now I also applied the fix :) | RDFLib/rdflib,ssssam/rdflib,marma/rdflib,marma/rdflib,dbs/rdflib,armandobs14/rdflib,ssssam/rdflib,armandobs14/rdflib,RDFLib/rdflib,ssssam/rdflib,avorio/rdflib,yingerj/rdflib,marma/rdflib,armandobs14/rdflib,yingerj/rdflib,RDFLib/rdflib,dbs/rdflib,dbs/rdflib,marma/rdflib,yingerj/rdflib,avorio/rdflib,avorio/rdflib,ssssam/... | 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... | bsd-3-clause | Python |
0035200543a7b226a095d2fb4ec880e0dd8732fd | Rearrange test data | projectweekend/Pi-Jukebox,projectweekend/Pi-Jukebox,projectweekend/Pi-Jukebox | 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... | mit | Python |
95ea1d7d6564bcbb2e3b8d2ba254ccd2c1c38436 | Add import for focused stuff | nestorsalceda/mamba | 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
| mit | Python |
d3b3e9af722ac00b21bf36706f4e0ab7cf94af00 | bump to v0.6.4 | rubik/mando,MarioSchwalbe/mando,MarioSchwalbe/mando | 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... | mit | Python |
59400100aa2f35bfea52b3cf049ef8d0f958527d | Fix error when reaching a dead end in the markov chain | tmerr/trevornet | 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... | mit | Python |
cfb09353b02dd230546775d18dadb1ba7ed2acc6 | Refactor submit_comment tests | 18F/regulations-site,tadhg-ohiggins/regulations-site,18F/regulations-site,18F/regulations-site,18F/regulations-site,tadhg-ohiggins/regulations-site,eregs/regulations-site,eregs/regulations-site,eregs/regulations-site,tadhg-ohiggins/regulations-site,tadhg-ohiggins/regulations-site,eregs/regulations-site | 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(... | cc0-1.0 | Python |
29e491c5505d2068b46eb489044455968e53ab70 | Add tests for strait and fjord | mapzen/vector-datasource,mapzen/vector-datasource,mapzen/vector-datasource | 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' })
| mit | Python |
83781f3b2f1cde0aab913ff4d64de45cf9b798be | Update snooper for multi-spline qp controller inputs | openhumanoids/oh-distro,openhumanoids/oh-distro,openhumanoids/oh-distro,openhumanoids/oh-distro,openhumanoids/oh-distro,openhumanoids/oh-distro,openhumanoids/oh-distro,openhumanoids/oh-distro | 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... | bsd-3-clause | Python |
cdf545cf9385a0490590cd0162141025a1301c09 | Use argparse formatter RawDescriptionHelpFormatter, maybe temporarily | bgottula/track,bgottula/track | 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 ... | mit | Python |
148d4c44a9eb63016b469c6bf317a3dbe9ed7918 | Add documentation for Permutations class | PermutaTriangle/Permuta | 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:
... | bsd-3-clause | Python |
8b9f68514d78851f3b445f996f3eaf607831d352 | Add more descriptive names to variables and functions | alaudet/raspi-sump,alaudet/raspi-sump,jreuter/raspi-sump,jreuter/raspi-sump | 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"... | mit | Python |
51373b776403b94cf0b72b43952013f3b4ecdb2d | Remove useless codes | Sherlock-Holo/Holosocket | 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... | mpl-2.0 | Python |
f21204c8828e840dc54c6822348fa9a47bc8964e | Add model's to_dict method. | yola/opensrs,yola/opensrs | 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]
| mit | Python |
da12bb0058cb48d3262eb70469aa30cdb8312ee2 | fix typos/bugs/indexing in block dicing | Rhoana/rhoana,Rhoana/rhoana,Rhoana/rhoana,Rhoana/rhoana,Rhoana/rhoana,Rhoana/rhoana | 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... | mit | Python |
5d2301b15e07394e24fed2fac2f258d72554eede | Add tests for query_geonames, MITIE, city resolution | openeventdata/mordecai | 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', '.'],
... | mit | Python |
2443c891e5f9cccb5c36b02303a3b9b7a94a4c45 | Change Jinja escape sequences. | bamos/beamer-snippets,bamos/beamer-snippets,bamos/beamer-snippets | 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... | mit | Python |
54e2359ed2cd75b87dc4a8007df6b252af3a3765 | fix typo | econ-ark/HARK,econ-ark/HARK | 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... | apache-2.0 | Python |
c1b4216e610a46260f52d5ed71267a2ed5fcdd25 | update debug url to account for downloads | hydroshare/hydroshare,hydroshare/hydroshare,hydroshare/hydroshare,hydroshare/hydroshare,hydroshare/hydroshare | 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,
... | bsd-3-clause | Python |
600a19b8a3f6d320b00d1d2b25e5c0f341f821d1 | bump version | floydsoft/kaggle-cli,floydwch/kaggle-cli | 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... | mit | Python |
ad6b055b53d621addc3565209c7af095b6d6d0e7 | Add .delete() and the start of Room | nprapps/HypChat,dougkeen/HypChat,nprapps/HypChat,RidersDiscountCom/HypChat,dougkeen/HypChat | 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')... | mit | Python |
fe9226898772c4ff909f9c3f0cb05c271333b73a | Make auth_url lookup dynamic | jasondunsmore/heat,jasondunsmore/heat,openstack/heat,noironetworks/heat,openstack/heat,steveb/heat,cwolferh/heat-scratch,cwolferh/heat-scratch,noironetworks/heat,steveb/heat | 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... | apache-2.0 | Python |
a79db7cf85dac6d74d7929137f640a0ac10ddf7d | return from sys.exit for easier testing | bfontaine/p7doi | 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... | mit | Python |
eaac4e45928b7008e6c561e28e9b5ed5dc427587 | fix redis storage | mihau/labDNS | 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... | bsd-3-clause | Python |
13ffa4113341c13e635896f94a29df5cff5c0348 | Build objects in JSON generator tool | quicktype/quicktype,quicktype/quicktype,quicktype/quicktype,quicktype/quicktype,quicktype/quicktype | 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... | apache-2.0 | Python |
c48b0ae4331d1d039cb6bc29ef25fc7c4a5df8da | Bump version to 0.2.7 | approvals/ApprovalTests.Python,tdpreece/ApprovalTests.Python,approvals/ApprovalTests.Python,approvals/ApprovalTests.Python | approvaltests/version.py | approvaltests/version.py | version_number = "0.2.7"
| version_number = "0.2.6"
| apache-2.0 | Python |
903d9b000c4d7b333b5d3000aeb38b7e4d818c27 | add "Partly Cloudy" to color_icons | paulollivier/i3pystatus,facetoe/i3pystatus,claria/i3pystatus,richese/i3pystatus,richese/i3pystatus,fmarchenko/i3pystatus,opatut/i3pystatus,ncoop/i3pystatus,yang-ling/i3pystatus,enkore/i3pystatus,juliushaertl/i3pystatus,m45t3r/i3pystatus,Arvedui/i3pystatus,opatut/i3pystatus,Elder-of-Ozone/i3pystatus,fmarchenko/i3pystatu... | 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:
... | mit | Python |
faebe4928b4bef33efd6183f97f1ff1396a701ee | fix missing urls. | soasme/blackgate | 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... | mit | Python |
3154f0098f9696cd48536599413659e47747491f | Add api [2] | igorbpf/TheGist,igorbpf/TheGist,igorbpf/TheGist | 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) | mit | Python |
1e930adbfb1714670ad04717401b36b59bf12558 | Bump version to 0.0.2 | laughingman7743/BigQuery-DatasetManager | 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,
)
| mit | Python |
a0dfb1ce1a72880da34ad817c8021e54e2ce0e5d | add fields. | jonhadfield/acli,jonhadfield/acli | 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... | mit | Python |
2d7b3afaca97a3e6a115c077586d0a9fb9daf8b2 | Fix imap connection lost (#380) | enkore/i3pystatus,Arvedui/i3pystatus,drwahl/i3pystatus,richese/i3pystatus,m45t3r/i3pystatus,m45t3r/i3pystatus,richese/i3pystatus,enkore/i3pystatus,ncoop/i3pystatus,facetoe/i3pystatus,fmarchenko/i3pystatus,schroeji/i3pystatus,asmikhailov/i3pystatus,yang-ling/i3pystatus,asmikhailov/i3pystatus,facetoe/i3pystatus,schroeji/... | 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... | mit | Python |
17f1c210c9c8b410cb6888a51ea1d863b74c14be | Use has_module check in _can_read | patricksnape/imageio,kuchi/imageio,imageio/imageio | 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 ... | bsd-2-clause | Python |
86791effb26c33514bbc6713f67a903e8d9e5295 | Choose a single corpus for a given series,date pair. | ViralTexts/vt-passim,ViralTexts/vt-passim,ViralTexts/vt-passim | scripts/c19.py | scripts/c19.py | from __future__ import print_function
import sys
from pyspark.sql import SparkSession
from pyspark.sql.functions import col, struct, max
if __name__ == "__main__":
if len(sys.argv) != 3:
print("Usage: c19.py <input> <output>", file=sys.stderr)
exit(-1)
spark = SparkSession.builder.appName('Se... | from __future__ import print_function
import sys
from pyspark.sql import SparkSession
from pyspark.sql.functions import lit, col, coalesce
if __name__ == "__main__":
if len(sys.argv) != 3:
print("Usage: c19.py <input> <output>", file=sys.stderr)
exit(-1)
spark = SparkSession.builder.appName('... | apache-2.0 | Python |
c2d543a3de566443a2c61761f9a190e915426fec | Return stream_client instead of binding it inside method (tests now passing) | GetStream/stream-django,GetStream/stream-django | 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... | bsd-3-clause | Python |
066e60897aa931b22ce92776b896912dbec3ccf6 | bump dev version | desihub/desispec,desihub/desispec | py/desispec/_version.py | py/desispec/_version.py | __version__ = '0.47.1.dev6182'
| __version__ = '0.47.1.dev6104'
| bsd-3-clause | Python |
54c48073dfb8ffd418efe234c0c107f7a5c303a9 | Fix failing imports in Python 2 | mixxorz/django-inline-svg | 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... | mit | Python |
b71ef8c05a9afa9eb3614c863650c12df0967fae | document methods | hall-lab/svtools,hall-lab/svtools,abelhj/svtools,abelhj/svtools,abelhj/svtools,ernfrid/svtools,abelhj/svtools,hall-lab/svtools,ernfrid/svtools | 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
... | mit | Python |
e2a0fb602c9de9f988d733a30b466dc400cd9503 | update issue 84 | nwebs/rdflib | 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;
... | bsd-3-clause | Python |
f486280a264c195c989d59f0b3fa631d9e165a18 | Fix comment | mitchgu/TAMProxy-pyHost | 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... | mit | Python |
a0a2810e52ba27bb2b6eba5d13d8a3bc88bca266 | Complete overhaul because I hated the ConfigParser module. | schae234/Camoco,schae234/Camoco | 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]... | mit | Python |
648de375f5e9ae1620bc836e5d647688b541690c | Add atom package | wicksy/laptop-build,wicksy/laptop-build,wicksy/laptop-build,wicksy/laptop-build | 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... | mit | Python |
89664ec37036553534c07d65f2df2b9fa07bfe80 | Check total weights remain correct. | python-hyper/priority | 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)
),... | mit | Python |
4530eea92e37c087b6f25fe3a0e48e54b949b68b | allow setup.py to work without django | gregplaysguitar/django-trolley | 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... | bsd-3-clause | Python |
f89bc55aebeba0cbf3c8423c97599aa0d334d9c9 | Fix lint error (#113) | googleapis/synthtool,googleapis/synthtool,googleapis/synthtool,googleapis/synthtool,googleapis/synthtool | 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, ... | apache-2.0 | Python |
7b4531ec867982ba2f660a2a08e85dbae457083e | Fix new line stripping in admin site | ashbc/tgrsite,ashbc/tgrsite,ashbc/tgrsite | 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://... | isc | Python |
57cec2b03eaa6857bcb1b3780c4de00c3165b281 | Return early if owner | BeatButton/beattie-bot,BeatButton/beattie | 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... | mit | Python |
28c314e98ec88586b8c423b0941d8f029e4946e9 | fix function which has obviously never been tested | grawity/accdb | 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):
... | mit | Python |
e1a4b0d7f7d9e860dce794e07aadedea193d470e | Set version to v2.0.18.dev1 | spacy-io/spaCy,spacy-io/spaCy,honnibal/spaCy,spacy-io/spaCy,explosion/spaCy,honnibal/spaCy,explosion/spaCy,spacy-io/spaCy,explosion/spaCy,honnibal/spaCy,spacy-io/spaCy,explosion/spaCy,spacy-io/spaCy,explosion/spaCy,honnibal/spaCy,explosion/spaCy | 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__ ... | mit | Python |
d5c8d2f5fd4177b6f4980689ae972352563c28e5 | Update about.py and increment version | recognai/spaCy,aikramer2/spaCy,honnibal/spaCy,explosion/spaCy,explosion/spaCy,aikramer2/spaCy,recognai/spaCy,spacy-io/spaCy,honnibal/spaCy,aikramer2/spaCy,aikramer2/spaCy,spacy-io/spaCy,spacy-io/spaCy,recognai/spaCy,recognai/spaCy,aikramer2/spaCy,explosion/spaCy,explosion/spaCy,spacy-io/spaCy,explosion/spaCy,recognai/s... | 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__ =... | mit | Python |
4e2f5c79b67a86fce622c486a0ea28fca0130015 | clean up default arguments in strip_training_tags() | menzenski/Razmetka,menzenski/tagger-tester | 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... | mit | Python |
e8a5a97ea18120915dba74b9a73fdca4eb381568 | Fix indentation level | shuttle1987/tail,shuttle1987/tail | tail/tests/test_tail.py | tail/tests/test_tail.py | """
Tests for the tail implementation
"""
from tail import FileBasedTail
def test_tail_from_file():
"""Tests that tail works as advertised from a file"""
from unittest.mock import mock_open, patch, Mock
# The mock_data we are using for our test
mock_data = """A
B
C
D
E
F
"""
mocked_open = mock_o... | """
Tests for the tail implementation
"""
from tail import FileBasedTail
def test_tail_from_file():
"""Tests that tail works as advertised from a file"""
from unittest.mock import mock_open, patch, Mock
# The mock_data we are using for our test
mock_data = """A
B
C
D
E
F
"""
mocked_open = mock_o... | mit | Python |
33efe92104ad139f9313d91ae7b2eea8a76da9d7 | fix flake8 | higumachan/pyscalambda | pyscalambda/__init__.py | pyscalambda/__init__.py | from pyscalambda.operands import Underscore
from pyscalambda.operators import UnaryOperator
from pyscalambda.quote import quote
from pyscalambda.scalambdable import scalambdable_const, scalambdable_func, scalambdable_iterator
from pyscalambda.utility import convert_operand
_ = Underscore(0)
_1 = Underscore(1)
_2 =... | from pyscalambda.operands import Underscore
from pyscalambda.operators import UnaryOperator
from pyscalambda.quote import quote
from pyscalambda.scalambdable import scalambdable_const, scalambdable_func, scalambdable_iterator
from pyscalambda.utility import convert_operand
_ = Underscore(0)
_1 = Underscore(1)
_2 =... | mit | Python |
c0824d3cb9cba811ba36c2f8937e91716f5a50df | Fix lint | adamtheturtle/vws-python,adamtheturtle/vws-python | ci/run_script.py | ci/run_script.py | """
Run tests and linters on Travis CI.
"""
import os
import subprocess
import sys
from pathlib import Path
import pytest
def run_test(test_filename: str) -> None:
"""
Run pytest with a given filename.
"""
path = Path('tests') / 'mock_vws' / test_filename
result = pytest.main(
[
... | """
Run tests and linters on Travis CI.
"""
import os
import subprocess
import sys
from pathlib import Path
import pytest
def run_test(test_filename: str) -> None:
"""
Run pytest with a given filename.
"""
path = Path('tests') / 'mock_vws' / test_filename
result = pytest.main([
'-vvv',
... | mit | Python |
2d60ef3a9ff53c1623747fd1a00df4d788dd3777 | fix tobler init | pysal/pysal,pedrovma/pysal,weikang9009/pysal,sjsrey/pysal,lanselin/pysal | pysal/model/tobler/__init__.py | pysal/model/tobler/__init__.py | from tobler import area_weighted
from tobler import dasymetric
from tobler import model
| from tobler import area_weighted
from tobler import data
from tobler import dasymetric
| bsd-3-clause | Python |
d1c88387a129d64488a5ca2dee56d7fac36ffbf1 | Disable GCC fallback, add time logging. | ramosian-glider/clang-kernel-build,ramosian-glider/clang-kernel-build | clang_wrapper.py | clang_wrapper.py | #!/usr/bin/env python
import optparse
import os
import subprocess
import sys
import time
WORLD_PATH = os.path.dirname(os.path.abspath(__file__))
COMPILER_PATH = {'gcc': 'gcc',
'clang': WORLD_PATH + '/third_party/llvm-build/Release+Asserts/bin/clang'
}
FILTER = {'gcc': ['-Qunused-arguments', '-no-integrated-as', '-... | #!/usr/bin/env python
import optparse
import os
import subprocess
import sys
WORLD_PATH = os.path.dirname(os.path.abspath(__file__))
COMPILER_PATH = {'gcc': 'gcc',
'clang': WORLD_PATH + '/third_party/llvm-build/Release+Asserts/bin/clang'
}
FILTER = {'gcc': ['-Qunused-arguments', '-no-integrated-as', '-mno-global-m... | apache-2.0 | Python |
deebd351b09108d95b4759b179ad84b48b6c933e | Fix typo in random-seed's help | mark-adams/pytest-test-groups | pytest_test_groups/__init__.py | pytest_test_groups/__init__.py | from random import Random
import math
def get_group_size(total_items, total_groups):
return int(math.ceil(float(total_items) / total_groups))
def get_group(items, group_size, group_id):
start = group_size * (group_id - 1)
end = start + group_size
if start >= len(items) or start < 0:
raise V... | from random import Random
import math
def get_group_size(total_items, total_groups):
return int(math.ceil(float(total_items) / total_groups))
def get_group(items, group_size, group_id):
start = group_size * (group_id - 1)
end = start + group_size
if start >= len(items) or start < 0:
raise V... | mit | Python |
2eca98c216a590c6163c8236c392f19ddd8d85d9 | update to 4.4.12 | hycis/TensorGraph,hycis/TensorGraph | tensorgraph/__init__.py | tensorgraph/__init__.py | # import json
# from os.path import dirname
#
# with open(dirname(__file__) + '/pkg_info.json') as fp:
# _info = json.load(fp)
# __version__ = _info['version']
__version__ = "4.4.12"
from .stopper import EarlyStopper
from .sequential import Sequential
from .graph import Graph
from .node import StartNode, HiddenNo... | # import json
# from os.path import dirname
#
# with open(dirname(__file__) + '/pkg_info.json') as fp:
# _info = json.load(fp)
# __version__ = _info['version']
__version__ = "4.4.10"
from .stopper import EarlyStopper
from .sequential import Sequential
from .graph import Graph
from .node import StartNode, HiddenNo... | apache-2.0 | Python |
4f5d81b48a5bb48771b82f30e3853472550ee65c | add demo about using file iterator | ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study | python/src/file_iter.py | python/src/file_iter.py | # Copyright (c) 2014 ASMlover. 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 ofconditions and the fol... | # Copyright (c) 2014 ASMlover. 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 ofconditions and the fol... | bsd-2-clause | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.