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 |
|---|---|---|---|---|---|---|---|---|
78064948169914aa2fc8290bba04e0bc76bbf98c | Fix typing [roku] (#66397) | rohitranjan1991/home-assistant,toddeye/home-assistant,rohitranjan1991/home-assistant,nkgilley/home-assistant,toddeye/home-assistant,mezz64/home-assistant,GenericStudent/home-assistant,w1ll1am23/home-assistant,rohitranjan1991/home-assistant,w1ll1am23/home-assistant,mezz64/home-assistant,GenericStudent/home-assistant,nkg... | homeassistant/components/roku/remote.py | homeassistant/components/roku/remote.py | """Support for the Roku remote."""
from __future__ import annotations
from collections.abc import Iterable
from typing import Any
from homeassistant.components.remote import ATTR_NUM_REPEATS, RemoteEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassist... | """Support for the Roku remote."""
from __future__ import annotations
from typing import Any
from homeassistant.components.remote import ATTR_NUM_REPEATS, RemoteEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import Ad... | apache-2.0 | Python |
59a0ce1473632ea5417efa5b8f18ee195c96e524 | Document data import instructions | skylines-project/skylines,Turbo87/skylines,skylines-project/skylines,skylines-project/skylines,skylines-project/skylines,Turbo87/skylines,Turbo87/skylines,Turbo87/skylines | skylines/model/timezone.py | skylines/model/timezone.py | from pytz import timezone
from sqlalchemy.types import Integer, String
from geoalchemy2.types import Geometry
from skylines.database import db
from skylines.lib.string import unicode_to_str
# Instructions
#
# - download raw data from http://efele.net/maps/tz/world/tz_world.zip
# - shp2pgsql -D -s 4326 tz_world.shp >... | from pytz import timezone
from sqlalchemy.types import Integer, String
from geoalchemy2.types import Geometry
from skylines.database import db
from skylines.lib.string import unicode_to_str
class TimeZone(db.Model):
__tablename__ = 'tz_world'
id = db.Column('gid', Integer, autoincrement=True, primary_key=Tr... | agpl-3.0 | Python |
ef05a6c51be615b7df38221235dda0a88704b67c | add vimeo settings to dev-settings.py, http://bugzilla.pculture.org/show_bug.cgi?id=15989 | wevoice/wesub,ujdhesa/unisubs,pculture/unisubs,ReachingOut/unisubs,norayr/unisubs,eloquence/unisubs,ReachingOut/unisubs,pculture/unisubs,ujdhesa/unisubs,norayr/unisubs,ofer43211/unisubs,norayr/unisubs,ujdhesa/unisubs,eloquence/unisubs,wevoice/wesub,ujdhesa/unisubs,ofer43211/unisubs,wevoice/wesub,eloquence/unisubs,Reach... | dev-settings.py | dev-settings.py | # Universal Subtitles, universalsubtitles.org
#
# Copyright (C) 2010 Participatory Culture Foundation
#
# 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... | # Universal Subtitles, universalsubtitles.org
#
# Copyright (C) 2010 Participatory Culture Foundation
#
# 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... | agpl-3.0 | Python |
0e2bee5e651d5ba8c3afe817a8cf49bc7143e019 | Remove unnecessary import | niemmi/algolib | tests/graph/test_bipartite.py | tests/graph/test_bipartite.py | import unittest
from .context import Undirected, bipartite
EDGES = [
[8, 4],
[4, 1],
[1, 0],
[1, 3],
[1, 5],
[0, 2],
[2, 2],
[2, 6],
[2, 7]
]
CASES = [
[[], True],
[[[3, 7]], False],
[[[3, 5]], False],
[[[7, 9], [9, 3]], True],
[[[8, 1]], False]
]
class TestBi... | import unittest
from .context import Undirected, BFS, bipartite
EDGES = [
[8, 4],
[4, 1],
[1, 0],
[1, 3],
[1, 5],
[0, 2],
[2, 2],
[2, 6],
[2, 7]
]
CASES = [
[[], True],
[[[3, 7]], False],
[[[3, 5]], False],
[[[7, 9], [9, 3]], True],
[[[8, 1]], False]
]
class T... | bsd-3-clause | Python |
096f3c203d8f8c3f66b5ddf6b32ee582789412c6 | Fix the docstring of the RichTextInline | matthiask/feincms3,matthiask/feincms3,matthiask/feincms3 | feincms3/plugins/richtext.py | feincms3/plugins/richtext.py | """
Provides a rich text area whose content is automatically cleaned using a
very restrictive allowlist of tags and attributes.
Depends on django-ckeditor and `html-sanitizer
<https://pypi.org/project/html-sanitizer>`__.
"""
from content_editor.admin import ContentEditorInline
from django.db import models
from django.... | """
Provides a rich text area whose content is automatically cleaned using a
very restrictive allowlist of tags and attributes.
Depends on django-ckeditor and `html-sanitizer
<https://pypi.org/project/html-sanitizer>`__.
"""
from content_editor.admin import ContentEditorInline
from django.db import models
from django.... | bsd-3-clause | Python |
fbefeb72035d5bf06dfd04a1c309a6292116d8d9 | customize errors | munisisazade/developer_portal,munisisazade/developer_portal,munisisazade/developer_portal | develop/urls.py | develop/urls.py | """develop URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-ba... | """develop URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-ba... | mit | Python |
8cd55326f8b06ad26ffb66136715592ef3b5da68 | Check for report_file | philippjfr/bokeh,jakirkham/bokeh,quasiben/bokeh,philippjfr/bokeh,ericmjl/bokeh,dennisobrien/bokeh,DuCorey/bokeh,DuCorey/bokeh,msarahan/bokeh,clairetang6/bokeh,timsnyder/bokeh,draperjames/bokeh,percyfal/bokeh,KasperPRasmussen/bokeh,aavanian/bokeh,aiguofer/bokeh,phobson/bokeh,azjps/bokeh,schoolie/bokeh,mindriot101/bokeh,... | tests/integration/conftest.py | tests/integration/conftest.py | from __future__ import absolute_import, print_function
import boto
import os
import pytest
from boto.s3.key import Key as S3Key
from boto.exception import NoAuthHandlerFound
from bokeh.io import output_file
from os.path import isfile, join
from .webserver import SimpleWebServer
from ..constants import s3, s3_bucket, ... | from __future__ import absolute_import, print_function
import boto
import os
import pytest
from boto.s3.key import Key as S3Key
from boto.exception import NoAuthHandlerFound
from bokeh.io import output_file
from os.path import isfile, join
from .webserver import SimpleWebServer
from ..constants import s3, s3_bucket, ... | bsd-3-clause | Python |
effe769e1a3274291adb03238ef800d31d3468f5 | add creating message objects on process payment | v0y/django-fortumo | fortumo/views.py | fortumo/views.py | from django.conf import settings
from django.http import HttpResponse
from django.http.response import HttpResponseForbidden
from fortumo.models import Message
def payment_processor(request):
if (
settings.FORTUMO_ENABLE_IP_VALIDATION and
not request.META['REMOTE_ADDR'] in settings.FORTUMO... | from django.conf import settings
from django.http import HttpResponse
from django.http.response import HttpResponseForbidden
def payment_processor(request):
if (
settings.FORTUMO_ENABLE_IP_VALIDATION and
not request.META['REMOTE_ADDR'] in settings.FORTUMO_IPS
):
return HttpResp... | mit | Python |
2f23cfd28aa1a010cbccf27299831a895fd71ecf | Validate interface ipv4 address format #42 | openwisp/netconfig-gen,openwisp/netconfig-gen | tests/openwrt/test_formats.py | tests/openwrt/test_formats.py | import unittest
from netjsonconfig import OpenWrt
from netjsonconfig.exceptions import ValidationError
from netjsonconfig.utils import _TabsMixin
class TestFormats(unittest.TestCase, _TabsMixin):
maxDiff = None
def test_general_hostname(self):
o = OpenWrt({"general": {"hostname": "invalid hostname"}... | import unittest
from netjsonconfig import OpenWrt
from netjsonconfig.exceptions import ValidationError
from netjsonconfig.utils import _TabsMixin
class TestFormats(unittest.TestCase, _TabsMixin):
maxDiff = None
def test_general_hostname(self):
o = OpenWrt({"general": {"hostname": "invalid hostname"}... | mit | Python |
c81b07f93253acc49cbc5028ec83e5334fb47ed9 | Add default type formatters for Enum | jschneier/flask-admin,jschneier/flask-admin,jschneier/flask-admin,jmagnusson/flask-admin,likaiguo/flask-admin,quokkaproject/flask-admin,flask-admin/flask-admin,lifei/flask-admin,likaiguo/flask-admin,ArtemSerga/flask-admin,iurisilvio/flask-admin,flask-admin/flask-admin,flask-admin/flask-admin,jschneier/flask-admin,jmagn... | flask_admin/model/typefmt.py | flask_admin/model/typefmt.py | from jinja2 import Markup
from flask_admin._compat import text_type
try:
from enum import Enum
except ImportError:
Enum = None
def null_formatter(view, value):
"""
Return `NULL` as the string for `None` value
:param value:
Value to check
"""
return Markup('<i>NULL</i>'... | from jinja2 import Markup
from flask_admin._compat import text_type
def null_formatter(view, value):
"""
Return `NULL` as the string for `None` value
:param value:
Value to check
"""
return Markup('<i>NULL</i>')
def empty_formatter(view, value):
"""
Return empty ... | bsd-3-clause | Python |
9af25d1ee342f6d8e9205912bb66a99595e767f8 | Add python dll. | mrlitong/fpsgame,mrlitong/fpsgame,mrlitong/Game-Engine-Development-Usage,mrlitong/fpsgame | fpsgame/tests.py | fpsgame/tests.py | from ctypes import *
import sys
import os
import xml.etree.ElementTree as ET
binaries = '../../../binaries'
# Work out the platform-dependent library filename
dll_filename = {
'posix': './libCollada_dbg.so',
'nt': 'Collada_dbg.dll',
}[os.name]
# The DLL may need other DLLs which are in its directory, so set the pa... | from ctypes import *
import sys
import os
import xml.etree.ElementTree as ET
binaries = '../../../binaries'
# Work out the platform-dependent library filename
dll_filename = {
'posix': './libCollada_dbg.so',
'nt': 'Collada_dbg.dll',
}[os.name] | mit | Python |
87f606e4a03f5afdaaa004a173588a754be4a444 | fix import | OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft | packages/syft/src/syft/core/node/common/node_manager/setup_manager.py | packages/syft/src/syft/core/node/common/node_manager/setup_manager.py | # stdlib
from typing import Any
from typing import List
# third party
from sqlalchemy.engine import Engine
from sqlalchemy.orm import sessionmaker
# relative
from ..node_table.setup import SetupConfig
# from ..exceptions import SetupNotFoundError
from .database_manager import DatabaseManager
class SetupManager(Dat... | # stdlib
from typing import Any
from typing import List
# third party
from sqlalchemy.engine import Engine
# relative
from ..node_table.setup import SetupConfig
# from ..exceptions import SetupNotFoundError
from .database_manager import DatabaseManager
class SetupManager(DatabaseManager):
schema = SetupConfig... | apache-2.0 | Python |
d537dd609f5aaabc7abcabf1ab0dcdb4540c2bd9 | refactor exception printing | toonst/RIOT,smlng/RIOT,Josar/RIOT,roberthartung/RIOT,rfuentess/RIOT,kaspar030/RIOT,gebart/RIOT,toonst/RIOT,cladmi/RIOT,mtausig/RIOT,mfrey/RIOT,kbumsik/RIOT,biboc/RIOT,rfuentess/RIOT,miri64/RIOT,A-Paul/RIOT,authmillenon/RIOT,mfrey/RIOT,rfuentess/RIOT,adrianghc/RIOT,neiljay/RIOT,x3ro/RIOT,kYc0o/RIOT,neiljay/RIOT,immesys/... | dist/tools/testrunner/testrunner.py | dist/tools/testrunner/testrunner.py | # Copyright (C) 2016 Kaspar Schleiser <kaspar@schleiser.de>
# 2014 Martine Lenders <mlenders@inf.fu-berlin.de>
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
import os
import signal
... | # Copyright (C) 2016 Kaspar Schleiser <kaspar@schleiser.de>
# 2014 Martine Lenders <mlenders@inf.fu-berlin.de>
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
import os
import signal
... | lgpl-2.1 | Python |
553cc84a62654df9f7edd4512449144f8874db3d | Remove comment, no longer applicable | amolenaar/gaphor,amolenaar/gaphor | tests/test_undo.py | tests/test_undo.py | from gaphor.tests import TestCase
from gaphor import UML
from gaphor.diagram import items
from gaphor.core import transactional
class UndoTest(TestCase):
services = TestCase.services + ["undo_manager"]
def test_class_association_undo_redo(self):
factory = self.element_factory
undo_manager = ... | from gaphor.tests import TestCase
from gaphor import UML
from gaphor.diagram import items
from gaphor.core import transactional
class UndoTest(TestCase):
services = TestCase.services + ["undo_manager"]
def test_class_association_undo_redo(self):
factory = self.element_factory
undo_manager = ... | lgpl-2.1 | Python |
0c5cc8afaaceb97db30f302c97b80ec9de0979cc | Remove unused imports from tests. | Onapsis/ageofempyres | tests/test_unit.py | tests/test_unit.py | import pytest
from onagame2015.lib import Coordinate
from onagame2015.units import AttackUnit
VALID_MOVES = (
Coordinate(1, 0), Coordinate(-1, 0),
Coordinate(0, 1), Coordinate(0, -1),
)
INVALID_MOVES_FROM_00 = (Coordinate(-1, 0), Coordinate(0, -1))
INVALID_INPUTS = ('UP', 2334, 0.343, {'up', -1})
@pytest... | from random import randint
import pytest
from onagame2015.lib import Coordinate
from onagame2015.units import AttackUnit
from onagame2015.arena import ArenaGrid, TileContainer
VALID_MOVES = (Coordinate(1, 0), Coordinate(-1, 0),
Coordinate(0, 1), Coordinate(0, -1),
)
INVALID_MOVES_FRO... | mit | Python |
1a724e8f655ab1b3e4a8aeb9991a6ef0391b19d9 | test for compare_suffixes | Chris7/cutadapt,marcelm/cutadapt | tests/testalign.py | tests/testalign.py | from __future__ import print_function, division, absolute_import
from cutadapt.align import (locate, compare_prefixes, compare_suffixes,
ALLOW_WILDCARD_SEQ1, ALLOW_WILDCARD_SEQ1)
from cutadapt.adapters import BACK
def test_polya():
s = 'AAAAAAAAAAAAAAAAA'
t = 'ACAGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
resul... | from __future__ import print_function, division, absolute_import
from cutadapt.align import (locate, compare_prefixes,
ALLOW_WILDCARD_SEQ1, ALLOW_WILDCARD_SEQ1)
from cutadapt.adapters import BACK
def test_polya():
s = 'AAAAAAAAAAAAAAAAA'
t = 'ACAGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
result = locate(s, t, 0... | mit | Python |
9015414ed9e2a3b294214d083467ff7946d667c5 | Fix wrong exception name | credativUK/vdirsyncer,untitaker/vdirsyncer,tribut/vdirsyncer,untitaker/vdirsyncer,hobarrera/vdirsyncer,credativUK/vdirsyncer,mathstuf/vdirsyncer,hobarrera/vdirsyncer,tribut/vdirsyncer,untitaker/vdirsyncer,mathstuf/vdirsyncer | tests/storage/dav/conftest.py | tests/storage/dav/conftest.py | # -*- coding: utf-8 -*-
'''
vdirsyncer.tests.storage.dav.conftest
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2014 Markus Unterwaditzer
:license: MIT, see LICENSE for more details.
'''
import os
import pytest
import requests
import requests.exceptions
import time
dav_server = os.environ.get... | # -*- coding: utf-8 -*-
'''
vdirsyncer.tests.storage.dav.conftest
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2014 Markus Unterwaditzer
:license: MIT, see LICENSE for more details.
'''
import os
import pytest
import requests
import requests.exceptions
import time
dav_server = os.environ.get... | mit | Python |
e2ae32aa7ee16eb2362ad54675ef0c8319a2fca2 | Update Homework_Week3_CaseStudy2.py | LamaHamadeh/Harvard-PH526x | Week3-Case-Studies-Part1/Language-Processing/Homework_Week3_CaseStudy2.py | Week3-Case-Studies-Part1/Language-Processing/Homework_Week3_CaseStudy2.py | # -*- coding: utf-8 -*-
"""
Created on Mon Mar 06 13:34:51 2017
@author: ADB3HAMADL
"""
'''
==============================
Case Study 2 -
==============================
'''
#In this case study, we will find and plot the distribution of word frequencies for each translation of Hamlet.
#Perhaps the d... | # -*- coding: utf-8 -*-
"""
Created on Mon Mar 06 13:34:51 2017
@author: ADB3HAMADL
"""
'''
==============================
Case Study 2 -
==============================
'''
#In this case study, we will find and plot the distribution of word frequencies for each translation of Hamlet.
#Perhaps the d... | mit | Python |
0360715caa7358e2d069e11b08e00fe70ba25129 | test command not found case | FunTimeCoding/python-utility,FunTimeCoding/python-utility | tests/test_command_process.py | tests/test_command_process.py | import pytest
from python_utility.command_process import CommandProcess, CommandFailed
def test_command_process(capfd) -> None:
process = CommandProcess(arguments=['echo', 'hello'])
assert process.get_return_code() == 0
assert process.get_standard_output() == 'hello'
assert process.get_standard_erro... | import pytest
from python_utility.command_process import CommandProcess, CommandFailed
def test_command_process(capfd) -> None:
process = CommandProcess(arguments=['echo', 'hello'])
assert process.get_return_code() == 0
assert process.get_standard_output() == 'hello'
assert process.get_standard_erro... | mit | Python |
0fa1f144e63ee74e31af985b9115ac098e662b45 | add curly brace | Caleydo/caleydo_server,phovea/phovea_server,phovea/phovea_server,phovea/phovea_server,phovea/phovea_server,Caleydo/caleydo_server | tests/test_custom_encoders.py | tests/test_custom_encoders.py |
from phovea_server.util import to_json
class TestCustomEncoders:
def test_nan_values(self):
# single variable
test_var = float('nan')
# simple list
test_list_simple = [13, 5, 7, 12, test_var, 22]
# simple dictionary
test_dict = {'first': [4, 6, 2, test_var], 'second': 3, 'third': [test_var,... |
from phovea_server.util import to_json
class TestCustomEncoders:
def test_nan_values(self):
# single variable
test_var = float('nan')
# simple list
test_list_simple = [13, 5, 7, 12, test_var, 22]
# simple dictionary
test_dict = {'first': [4, 6, 2, test_var], 'second': 3, 'third': [test_var,... | bsd-3-clause | Python |
718803a7f0de83738043f58987a264cccabfa935 | Update __version__.py | avehtari/GPy,dhhjx880713/GPy,SheffieldML/GPy,avehtari/GPy,mikecroucher/GPy,dhhjx880713/GPy,esiivola/GPYgradients,befelix/GPy,dhhjx880713/GPy,befelix/GPy,befelix/GPy,SheffieldML/GPy,avehtari/GPy,esiivola/GPYgradients,mikecroucher/GPy,dhhjx880713/GPy,SheffieldML/GPy,ysekky/GPy,SheffieldML/GPy,ysekky/GPy,avehtari/GPy,esii... | GPy/__version__.py | GPy/__version__.py | __version__ = "1.0.6"
| __version__ = "1.0.5"
| bsd-3-clause | Python |
642472b6b19e95640553ffb82a31cec16b07f0ae | Add support for nested Tooltips inside TooltipNodes | jleclanche/pywow,jleclanche/pywow,jleclanche/pywow,jleclanche/pywow,jleclanche/pywow,jleclanche/pywow | game/__init__.py | game/__init__.py | # -*- coding: utf-8 -*-
"""
Game module
Contains model logic for the game
"""
# Colors
BLUE = 0x0080ff
CYAN = 0x66bbff
DARKCYAN = 0x88aaff
GOLD = 0xe5cc80
GREEN = 0x1eff00
GREY = 0x9d9d9d
ORANGE = 0xff8000
PURPLE = 0xb048f8
RED = 0xff2020
YELLOW = 0xffd100
WHITE = 0xffffff
class Model... | # -*- coding: utf-8 -*-
"""
Game module
Contains model logic for the game
"""
# Colors
BLUE = 0x0080ff
CYAN = 0x66bbff
DARKCYAN = 0x88aaff
GOLD = 0xe5cc80
GREEN = 0x1eff00
GREY = 0x9d9d9d
ORANGE = 0xff8000
PURPLE = 0xb048f8
RED = 0xff2020
YELLOW = 0xffd100
WHITE = 0xffffff
class Model... | cc0-1.0 | Python |
c1fa88016da8365290fa62965f592930ae61c033 | Set __version__ to 2.2.0. | hyperspy/start_jupyter_cm | start_jupyter_cm/__init__.py | start_jupyter_cm/__init__.py | __version__ = "2.2.0"
| __version__ = "2.2.dev"
| bsd-3-clause | Python |
39109678414be9b89c4bcc36c53497b5fe197583 | Add beta.herocomics.kr to ALLOWED_HOSTS in hydrocarbon.settings.production | devunt/hydrocarbon,devunt/hydrocarbon,devunt/hydrocarbon | hydrocarbon/settings/production.py | hydrocarbon/settings/production.py | import os
from hydrocarbon.settings.base import *
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '***REMOVED***'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
TEMPLATE_DEBUG = False
# ALLOWED HOSTS
ALLOWED_HOSTS = ['herocomics.kr', 'beta.herocomics... | import os
from hydrocarbon.settings.base import *
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '***REMOVED***'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
TEMPLATE_DEBUG = False
# ALLOWED HOSTS
ALLOWED_HOSTS = ['herocomics.kr']
# Cache backend... | mit | Python |
8a124fc6d7db89e0a385262fcf02e3b421b33db9 | Add date_published field to Photo model | DZwell/django-imager | imagersite/imager_images/models.py | imagersite/imager_images/models.py | from django.db import models
from django.conf import settings
from django.utils.encoding import python_2_unicode_compatible
PUBLISHED_CHOICES = (('private', 'private'), ('public', 'public'), ('shared', 'shared'))
PUBLISHED_DEFAULT = PUBLISHED_CHOICES[0][1]
@python_2_unicode_compatible
class Photo(models.Model):
... | from django.db import models
from django.conf import settings
from django.utils.encoding import python_2_unicode_compatible
PUBLISHED_CHOICES = (('private', 'private'), ('public', 'public'), ('shared', 'shared'))
PUBLISHED_DEFAULT = PUBLISHED_CHOICES[0][1]
@python_2_unicode_compatible
class Photo(models.Model):
... | mit | Python |
281b7ccad3b649d03dbf394c89f69b772d9048d8 | Exit with result | 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([
'-vvv',
... | """
Run tests and linters on Travis CI.
"""
import os
import subprocess
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
pytest.main([
'--exitfirst',
str(pa... | mit | Python |
874c4ab2eff39fa14cbce56609cb7e08b4fda815 | Rewrite interface to accept input and provide output on a local unix socket instead of through stdin/stdout. | matslindh/4096 | 4096/interface.py | 4096/interface.py | import engine, sys, uuid, random, subprocess, socket, os
if len(sys.argv) < 3:
sys.stderr.write("Usage: interface.py <randomseed> <executable>\n")
sys.exit()
# set up seed from arguments
random.seed(sys.argv[1])
# helpers for writing and reading to the socket connection
def write(conn, str):
conn.send(str.encode(... | import engine, sys, uuid, random
if len(sys.argv) < 2:
sys.stderr.write("Usage: interface.py <randomseed>\n")
sys.exit()
random.seed(sys.argv[1])
game = engine.Engine()
move_count = 0
game_name = sys.stdin.readline().strip()
identifier = str(uuid.uuid4())
sys.stderr.write("Game: " + game_name + "\n")
sys.stderr.w... | mit | Python |
a2fd2436cb1c0285dfdd18fad43e505d7c246535 | Handle spotify: -type urls Cleanup | rnyberg/pyfibot,huqa/pyfibot,lepinkainen/pyfibot,EArmour/pyfibot,nigeljonez/newpyfibot,EArmour/pyfibot,huqa/pyfibot,lepinkainen/pyfibot,rnyberg/pyfibot,aapa/pyfibot,aapa/pyfibot | modules/module_spotify.py | modules/module_spotify.py | import re
import urllib
def do_spotify(bot, user, channel, dataurl):
f = urllib.urlopen(dataurl)
songinfo = f.read()
f.close()
artist, album, song = songinfo.split("/", 2)
bot.say(channel, "[Spotify] %s - %s (%s)" % (artist.strip(), song.strip(), album.strip()))
def handle_privmsg(bot, user,... |
import re
import urllib
def handle_url(bot, user, channel, url, msg):
"""Handle IMDB urls"""
m = re.match("(http:\/\/open.spotify.com\/|spotify:)(album|artist|track)([:\/])([a-zA-Z0-9]+)\/?", url)
if not m: return
dataurl = "http://spotify.url.fi/%s/%s?txt" % (m.group(2), m.group(4))
f = ur... | bsd-3-clause | Python |
1ba11bb266684c26c0559651592751730bba97b5 | Update appvalidator/constants.py | mozilla/app-validator,diox/app-validator,mstriemer/app-validator,mozilla/app-validator,eviljeff/app-validator,mstriemer/app-validator,mstriemer/app-validator,mattbasta/perfalator,mozilla/app-validator,diox/app-validator,stasm/app-validator,diox/app-validator,stasm/app-validator,mozilla/app-validator,diox/app-validator,... | appvalidator/constants.py | appvalidator/constants.py | "Constants that will be used across files."
import json
import os
# Package type constants.
PACKAGE_ANY = 0
PACKAGE_WEBAPP = 8
PACKAGE_PACKAGED_WEBAPP = 9
SPIDERMONKEY_INSTALLATION = os.environ.get("SPIDERMONKEY_INSTALLATION")
DEFAULT_WEBAPP_MRKT_URLS = ["https://marketplace.firefox.com",
... | "Constants that will be used across files."
import json
import os
# Package type constants.
PACKAGE_ANY = 0
PACKAGE_WEBAPP = 8
PACKAGE_PACKAGED_WEBAPP = 9
SPIDERMONKEY_INSTALLATION = os.environ.get("SPIDERMONKEY_INSTALLATION")
DEFAULT_WEBAPP_MRKT_URLS = ["https://marketplace.mozilla.org",
... | bsd-3-clause | Python |
912bb4195136764345e24bcb01eb6b0c94176362 | Support hidden_sizes=[] | toslunar/chainerrl,toslunar/chainerrl | links/mlp_bn.py | links/mlp_bn.py | from __future__ import division
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import absolute_import
from builtins import super
from builtins import range
from future import standard_library
standard_library.install_aliases()
import random
import numpy as np
import chain... | from __future__ import division
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import absolute_import
from builtins import super
from builtins import range
from future import standard_library
standard_library.install_aliases()
import random
import numpy as np
import chain... | mit | Python |
af97016a0af3807ee6cb3d4db464d637bbe01de3 | Use utils.chainstruct in core | tkf/fillplots,tkf/fillplots | ineqfill/core.py | ineqfill/core.py | from .utils.chainstruct import Struct
class Config(Struct):
# Should be renamed to "Resource?"
def __init__(self, *args, **kwds):
# FIXME: write arguments explicitly
self.line_args = {}
self.fill_args = {}
self.num_direction_arrows = 5
self.direction_arrows_size = 0.0... | class BaseConfig(object):
def __init__(self, **kwds):
self.__dict__.update(kwds)
@property
def ax(self):
from matplotlib import pyplot
return pyplot.gca() # FIXME
def set_lim(self):
self.ax.set_xlim(*self.xlim)
self.ax.set_ylim(*self.ylim)
class Config(BaseC... | bsd-2-clause | Python |
025c6e93e62da5338d651ba37ab942a93f62e635 | Update wsgi.py | fabianvf/scrapi,felliott/scrapi,felliott/scrapi,fabianvf/scrapi,erinspace/scrapi,CenterForOpenScience/scrapi,erinspace/scrapi,CenterForOpenScience/scrapi | api/api/wsgi.py | api/api/wsgi.py | """
WSGI config for api project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_... | """
WSGI config for api project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_... | apache-2.0 | Python |
bbf5f6ffd9d7bd17e23586efdb339bd08ab60285 | Update settings.py | deccico/gowest,deccico/gowest | gowestapp/gowest/settings.py | gowestapp/gowest/settings.py | """
Django settings for gowest project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
imp... | """
Django settings for gowest project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
imp... | mit | Python |
8bc25d6b050ba035b4d8bda7f5ad1f07a0c06a5c | Fix bad import | little-dude/monolithe,nuagenetworks/monolithe,little-dude/monolithe,nuagenetworks/monolithe,nuagenetworks/monolithe,little-dude/monolithe | monolithe/lib/__init__.py | monolithe/lib/__init__.py | # -*- coding: utf-8 -*-
#
# Copyright (c) 2015, Alcatel-Lucent Inc
# 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
# no... | # -*- coding: utf-8 -*-
#
# Copyright (c) 2015, Alcatel-Lucent Inc
# 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
# no... | bsd-3-clause | Python |
99fba41b7392b1e5e4216145f1e8913698b60914 | Remove Python 2 compatibility code | hechtus/mopidy-gmusic,mopidy/mopidy-gmusic | mopidy_gmusic/commands.py | mopidy_gmusic/commands.py | import gmusicapi
from mopidy import commands
from oauth2client.client import OAuth2WebServerFlow
class GMusicCommand(commands.Command):
def __init__(self):
super().__init__()
self.add_child("login", LoginCommand())
class LoginCommand(commands.Command):
def run(self, args, config):
oa... | import gmusicapi
from mopidy import commands
from oauth2client.client import OAuth2WebServerFlow
class GMusicCommand(commands.Command):
def __init__(self):
super().__init__()
self.add_child("login", LoginCommand())
class LoginCommand(commands.Command):
def run(self, args, config):
oa... | apache-2.0 | Python |
87916c801168743ed5a675c1161462b9deadea6e | Remove fixed TODO | kingosticks/mopidy-spotify,mopidy/mopidy-spotify,jodal/mopidy-spotify | mopidy_spotify/backend.py | mopidy_spotify/backend.py | from __future__ import unicode_literals
import logging
import os
import threading
from mopidy import backend
import pykka
import spotify
logger = logging.getLogger(__name__)
class SpotifyBackend(pykka.ThreadingActor, backend.Backend):
_logged_in = threading.Event()
_logged_out = threading.Event()
_... | from __future__ import unicode_literals
import logging
import os
import threading
from mopidy import backend
import pykka
import spotify
logger = logging.getLogger(__name__)
class SpotifyBackend(pykka.ThreadingActor, backend.Backend):
_logged_in = threading.Event()
_logged_out = threading.Event()
_... | apache-2.0 | Python |
7b3e4623da5341753d1150642c68b46200f79b79 | Drop leading underscore from UTC._ZERO | christophelec/github3.py,icio/github3.py,balloob/github3.py,wbrefvem/github3.py,krxsky/github3.py,jim-minter/github3.py,agamdua/github3.py,h4ck3rm1k3/github3.py,ueg1990/github3.py,sigmavirus24/github3.py,degustaf/github3.py,itsmemattchung/github3.py | github3/utils.py | github3/utils.py | # -*- coding: utf-8 -*-
from collections import Callable
from datetime import datetime, timedelta, tzinfo
from requests.compat import basestring
import re
# with thanks to https://code.google.com/p/jquery-localtime/issues/detail?id=4
ISO_8601 = re.compile("^(-?(?:[1-9][0-9]*)?[0-9]{4})-(1[0-2]|0[1-9])-(3[0-1]|0"
... | # -*- coding: utf-8 -*-
from collections import Callable
from datetime import datetime, timedelta, tzinfo
from requests.compat import basestring
import re
# with thanks to https://code.google.com/p/jquery-localtime/issues/detail?id=4
ISO_8601 = re.compile("^(-?(?:[1-9][0-9]*)?[0-9]{4})-(1[0-2]|0[1-9])-(3[0-1]|0"
... | bsd-3-clause | Python |
08d3966122f3c7873faf720a660cac99ff0e1ba7 | Fix sparse.info docstring. | kalvdans/scipy,scipy/scipy,Newman101/scipy,rgommers/scipy,sriki18/scipy,trankmichael/scipy,endolith/scipy,matthew-brett/scipy,lhilt/scipy,giorgiop/scipy,ales-erjavec/scipy,maniteja123/scipy,trankmichael/scipy,vberaudi/scipy,FRidh/scipy,fernand/scipy,chatcannon/scipy,sriki18/scipy,aman-iitj/scipy,nmayorov/scipy,haudren/... | Lib/sparse/info.py | Lib/sparse/info.py | """
Sparse matrix
=============
Scipy 2D sparse matrix module.
Original code by Travis Oliphant.
Modified and extended by Ed Schofield and Robert Cimrman.
There are four available sparse matrix types:
(1) csc_matrix: Compressed Sparse Column format
(2) csr_matrix: Compressed Sparse Row format
(3) lil_mat... | """
Sparse matrix
=============
Scipy 2D sparse matrix module.
Original code by Travis Oliphant.
Modified and extended by Ed Schofield and Robert Cimrman.
There are four available sparse matrix types:
(1) csc_matrix: Compressed Sparse Column format
(2) csr_matrix: Compressed Sparse Row format
(3) lil_mat... | bsd-3-clause | Python |
46ce07733913dff688bcd6e3e83dc3222f630c07 | fix error by encoding | nishio/jscc,nishio/jscc,nishio/jscc | client/client.py | client/client.py | import re
import json
from datetime import datetime
import urllib2
import urllib
import argparse
parser = argparse.ArgumentParser(description='send info to visualizing server')
parser.add_argument('--port', default=8104, type=int)
parser.add_argument('--server', default="localhost", type=str)
parser.add_argument('--se... | import re
import json
from datetime import datetime
import urllib2
import urllib
import argparse
parser = argparse.ArgumentParser(description='send info to visualizing server')
parser.add_argument('--port', default=8104, type=int)
parser.add_argument('--server', default="localhost", type=str)
parser.add_argument('--se... | mit | Python |
ab395d012e77e863bc78dea0479c07fa0add2049 | use sequential runner (avoids error with process-based ounit runner) | gfxmonk/gup,gfxmonk/gup,timbertson/gup,timbertson/gup,timbertson/gup,timbertson/gup,gfxmonk/gup | run_tests.py | run_tests.py | #!/usr/bin/env python
import os, sys, subprocess
class Object(object): pass
UNIT = '-u'
INTEGRATION = '-i'
actions = (UNIT, INTEGRATION)
action = sys.argv[1]
assert action in actions, "Expected one of %s" % (", ".join(actions),)
action_name = 'unit' if action == UNIT else 'integration'
args = sys.argv[2:]
cwd = os.... | #!/usr/bin/env python
import os, sys, subprocess
class Object(object): pass
UNIT = '-u'
INTEGRATION = '-i'
actions = (UNIT, INTEGRATION)
action = sys.argv[1]
assert action in actions, "Expected one of %s" % (", ".join(actions),)
action_name = 'unit' if action == UNIT else 'integration'
args = sys.argv[2:]
cwd = os.... | lgpl-2.1 | Python |
34529575057f594e474dff3a1b60edaeacfbfb1f | Fix exit status of the test run script | brainly/check-zonesync | run_tests.py | run_tests.py | #!/usr/bin/env python3
# Copyright (c) 2013 Spotify AB
# Copyright (c) 2014 Brainly.com sp. z o.o.
#
# 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... | #!/usr/bin/env python3
# Copyright (c) 2013 Spotify AB
# Copyright (c) 2014 Brainly.com sp. z o.o.
#
# 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... | apache-2.0 | Python |
00fd2ef2bc5987e12eca677110157a07fad49793 | Remove unused imports | bussiere/gitfs,PressLabs/gitfs,ksmaheshkumar/gitfs,PressLabs/gitfs,rowhit/gitfs | gitfs/views/history.py | gitfs/views/history.py | import os
from stat import S_IFDIR
from errno import ENOENT
from fuse import FuseOSError
from gitfs.log import log
from .view import View
class HistoryView(View):
def getattr(self, path, fh=None):
'''
Returns a dictionary with keys identical to the stat C structure of
stat(2).
... | import os
from datetime import datetime
from stat import S_IFDIR
from errno import ENOENT
from pygit2 import GIT_SORT_TIME
from fuse import FuseOSError
from gitfs.utils import strptime
from gitfs.log import log
from .view import View
class HistoryView(View):
def getattr(self, path, fh=None):
'''
... | apache-2.0 | Python |
269fb63409935d85e70b420de1b562280da4f3eb | Update __init__.py file of views module. | kaleidos/django-supertools | supertools/views/__init__.py | supertools/views/__init__.py | from .base import GenericView
from .base import GenericTemplateView
from .ajax import AjaxMixin
from .forms import FormViewMixin
from .paginator import PaginatorMixin
| # -*- coding: utf-8 -*-
| bsd-3-clause | Python |
6b2314ff98bbead0c3a7811fc1429ecc3aec22ce | convert generic form error key from '__all__' to 'generic' | melissiproject/server,melissiproject/server | api/resource.py | api/resource.py | """
Overloading piston resource to provide our own error handling methods
"""
import piston.resource
from piston.utils import rc
from exceptions import APIException
class Resource(piston.resource.Resource):
def form_validation_response(self, e):
resp = rc.BAD_REQUEST
error_list = {}
for ke... | """
Overloading piston resource to provide our own error handling methods
"""
import piston.resource
from piston.utils import rc
from exceptions import APIException
class Resource(piston.resource.Resource):
def form_validation_response(self, e):
resp = rc.BAD_REQUEST
error_list = {}
for ke... | agpl-3.0 | Python |
09a615458f5b13b26c6c5891769939f95ef57b20 | Update abusehelper.py | pkug/intelmq,pkug/intelmq,certtools/intelmq,sch3m4/intelmq,certtools/intelmq,pkug/intelmq,sch3m4/intelmq,robcza/intelmq,sch3m4/intelmq,robcza/intelmq,robcza/intelmq,aaronkaplan/intelmq,aaronkaplan/intelmq,aaronkaplan/intelmq,sch3m4/intelmq,pkug/intelmq,certtools/intelmq,robcza/intelmq | src/bots/inputs/abusehelper/abusehelper.py | src/bots/inputs/abusehelper/abusehelper.py | import sys
import xmpp
from lib.bot import *
from lib.utils import *
from lib.event import *
from lib.cache import *
# Required parameters:
# - jid
# - password
# - source_room
# - force_tls
class AbuseHelperBot(Bot):
def handle_message(self, xmpp_connection, message):
try:
event = Event.from... | import sys
import xmpp
from lib.bot import *
from lib.utils import *
from lib.event import *
from lib.cache import *
# Required parameters:
# - jid
# - password
# - source_room
# - force_tls
class AbuseHelperBot(Bot):
def handle_message(self, xmpp_connection, message):
try:
event = Event.from... | agpl-3.0 | Python |
a0e8b544569d0aa955dd1698ff020572df9d122f | delete username and name field in registration | codeforamerica/westsac-farm-stand,inaki/farm-stand,codeforamerica/westsac-farm-stand,inaki/farm-stand | app/auth/views.py | app/auth/views.py | from flask import render_template, redirect, request, url_for, flash
from flask.ext.login import login_user, logout_user, login_required, current_user
from app import db
from ..email import send_email
from . import auth
from ..models import User
from .forms import LoginForm, RegistrationForm
@auth.route('/login', meth... | from flask import render_template, redirect, request, url_for, flash
from flask.ext.login import login_user, logout_user, login_required, current_user
from app import db
from ..email import send_email
from . import auth
from ..models import User
from .forms import LoginForm, RegistrationForm
@auth.route('/login', meth... | mit | Python |
853d93a18919a7cf5805b44c1a6678ffff92461b | add logging.basicConfig() to tests | n0ano/ganttclient | run_tests.py | run_tests.py | #!/usr/bin/env python
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this... | #!/usr/bin/env python
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this... | apache-2.0 | Python |
998e3441928c32760ec06e330b2e049b535d7bda | Print the exception type separately to avoid it being cut off | xenserver/xscontainer,olivierlambert/xscontainer,robertbreker/xscontainer,xenserver/xscontainer,robertbreker/xscontainer,olivierlambert/xscontainer | src/xscontainer/util/log.py | src/xscontainer/util/log.py | import logging
import logging.handlers
import signal
import sys
import traceback
def configurelogging():
_LOGGER.setLevel(logging.DEBUG)
streamhandler = logging.StreamHandler(sys.stderr)
streamhandler.setLevel(logging.DEBUG)
formatter = logging.Formatter(
'xscontainer[%(process)d] - %(levelnam... | import logging
import logging.handlers
import signal
import sys
import traceback
def configurelogging():
_LOGGER.setLevel(logging.DEBUG)
streamhandler = logging.StreamHandler(sys.stderr)
streamhandler.setLevel(logging.DEBUG)
formatter = logging.Formatter(
'xscontainer[%(process)d] - %(levelnam... | bsd-2-clause | Python |
2a6e610b59e93e5d7e6b00a8c4be5625ef071131 | Update coordinator on every run | martinp/jarvis2,mpolden/jarvis2,mpolden/jarvis2,martinp/jarvis2,martinp/jarvis2,mpolden/jarvis2 | app/jobs/sonos.py | app/jobs/sonos.py | #!/usr/bin/env python
from jobs import AbstractJob
from soco import SoCo
class Sonos(AbstractJob):
def __init__(self, conf):
self.interval = conf['interval']
self._device = SoCo(conf['ip'])
@property
def device(self):
# In case of grouped devices the playback information needs t... | #!/usr/bin/env python
from jobs import AbstractJob
from soco import SoCo
class Sonos(AbstractJob):
def __init__(self, conf):
self.interval = conf['interval']
self.sonos = SoCo(conf['ip'])
# In case of grouped devices the playback information needs to be
# retrieved from the coord... | mit | Python |
b5c2603ec929433ae8f37299bb811a1d7d17647b | Implement get collection functionality | AmosGarner/PyInventory | collectionOps.py | collectionOps.py | from DataObjects.Collection import Collection
import json
def getCollection(fileData):
try:
fileData = json.loads(fileData)
return generateCollectionOnFileData(fileData)
except:
print('Error: Could not load collection data from file.')
def generateCollectionOnFileData(fileData):
co... | def getCollection(filePath):
return None
| apache-2.0 | Python |
2716e3e2263c7fc9b26a2cff7783486bb89a59ed | add test case | abner-xin/email_utils | test/message/test_composer.py | test/message/test_composer.py | import os
import unittest
import tempfile
from message import IMSMessageComposer
from message import IMSMessageParser
from email_resource import email_plain
from email_resource import email_html_attachment
class TestIMSMessageComposer(unittest.TestCase):
def test_compose_a_plain_email(self):
c = IMSMessag... | import os
import unittest
import tempfile
from message import IMSMessageComposer
from message import IMSMessageParser
from email_resource import email_plain
from email_resource import email_html_attachment
class TestIMSMessageComposer(unittest.TestCase):
def test_compose_a_plain_email(self):
c = IMSMessag... | mit | Python |
0163ada6283613962a0ccf6ce9b2cb73e0f6a980 | Update temporal_memory_wrappers.py | numenta/nupic.research,numenta/nupic.research | packages/columns/src/nupic/research/frameworks/columns/temporal_memory_wrappers.py | packages/columns/src/nupic/research/frameworks/columns/temporal_memory_wrappers.py | # ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2022, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | # ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2022, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | agpl-3.0 | Python |
4ba313fe0e9bf040a91e42fbf357cbf34fd18ec8 | Update CTCP.py | devzero-xyz/Andromeda,devzero-xyz/Andromeda | handlers/CTCP.py | handlers/CTCP.py | import time
def on_ctcp(irc, conn, event):
nick = event.source.nick
ctcptype = event.arguments[0]
if len(event.arguments) > 1:
args = event.arguments[1]
else:
args = None
if ctcptype != "ACTION":
log.info("Received CTCP {} from {}".format(ctcptype, event.source))
if ctc... | import time
def on_ctcp(irc, conn, event):
nick = event.source.nick
ctcptype = event.arguments[0]
if len(event.arguments) > 1:
args = event.arguments[1]
else:
args = None
if ctcptype != "ACTION":
log.info("Received CTCP {} from {}".format(ctcptype, event.source))
if ctc... | mit | Python |
b0ee6bfc8d2f5fbdcd4528233052d231d969ae1f | bump version to 3.1.0 | KoketsoMabuela92/titanium_mobile,smit1625/titanium_mobile,mvitr/titanium_mobile,sriks/titanium_mobile,formalin14/titanium_mobile,perdona/titanium_mobile,ashcoding/titanium_mobile,pec1985/titanium_mobile,openbaoz/titanium_mobile,FokkeZB/titanium_mobile,falkolab/titanium_mobile,rblalock/titanium_mobile,mano-mykingdom/tit... | build/titanium_version.py | build/titanium_version.py | version = '3.1.0'
module_apiversion = '2'
| version = '3.0.0'
module_apiversion = '2'
| apache-2.0 | Python |
6610938cb195cd349081c57490d1f4ea60d25ea1 | Stop depending on master on rules_closure. | google/j2cl,google/j2cl,google/j2cl,google/j2cl,google/j2cl | build_defs/repository.bzl | build_defs/repository.bzl | """Bazel rule for loading external repository deps for J2CL."""
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
def load_j2cl_repo_deps():
_github_repo(
name = "io_bazel_rules_closure",
repo = "bazelbuild/rules_closure",
tag = "0.10.0",
)
_github_repo(
... | """Bazel rule for loading external repository deps for J2CL."""
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
def load_j2cl_repo_deps():
_github_repo(
name = "io_bazel_rules_closure",
repo = "bazelbuild/rules_closure",
tag = "master",
)
_github_repo(
... | apache-2.0 | Python |
f25ddf153477d6d7034d96ca695ceef168394705 | Fix dependency issue | rmyers/trove-dashboard | trove_dashboard/dbaas/tabs.py | trove_dashboard/dbaas/tabs.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 Rackspace Hosting
#
# 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... | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 Rackspace Hosting
#
# 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... | apache-2.0 | Python |
65a3934afbe5d3dc62d7bab5b77577aa9b423c94 | Add simple Link admin | texas/tx_people,texas/tx_people | tx_people/admin.py | tx_people/admin.py | from django.contrib import admin
from django.db.models import Count
from django.utils.translation import ugettext_lazy as _
from . import models
class ParentOrganizationFilter(admin.SimpleListFilter):
title = _('Parent Organization')
parameter_name = 'parent'
def lookups(self, request, model_admin):
... | from django.contrib import admin
from django.db.models import Count
from django.utils.translation import ugettext_lazy as _
from . import models
class ParentOrganizationFilter(admin.SimpleListFilter):
title = _('Parent Organization')
parameter_name = 'parent'
def lookups(self, request, model_admin):
... | apache-2.0 | Python |
e22fe584714f2b025d6de4eda3616d3747f72107 | add pixel_id | istb-mia/miapy | test/test_image/test_image.py | test/test_image/test_image.py | from unittest import TestCase
import SimpleITK as sitk
from miapy.image.image import ImageProperties
class TestImageProperties(TestCase):
def test_is_two_dimensional(self):
x = 10
y = 10
image = sitk.Image([x, y], sitk.sitkUInt8)
dut = ImageProperties(image)
self.assertE... | from unittest import TestCase
import SimpleITK as sitk
from miapy.image.image import ImageProperties
class TestImageProperties(TestCase):
def test_is_two_dimensional(self):
x = 10
y = 10
image = sitk.Image([x, y], sitk.sitkUInt8)
dut = ImageProperties(image)
self.assertE... | apache-2.0 | Python |
2cd5049d2fc495344845ec0fed1e085afd96dfc8 | Use CSV data | opencivicdata/scrapers-ca,opencivicdata/scrapers-ca | ca_on_brantford/people.py | ca_on_brantford/people.py | from utils import CSVScraper
class BrantfordPersonScraper(CSVScraper):
csv_url = 'https://opendata.arcgis.com/datasets/320d27b8b20a467f8283a78835a33003_0.csv'
encoding = 'utf-8-sig'
many_posts_per_area = True
corrections = {
'primary role': {
'Ward 1 Councillor': 'Councillor',
... | from utils import CanadianScraper, CanadianPerson as Person
import re
from collections import defaultdict
COUNCIL_PAGE = 'http://www.brantford.ca/govt/council/members/Pages/default.aspx'
class BrantfordPersonScraper(CanadianScraper):
def scrape(self):
seat_numbers = defaultdict(int)
page = self... | mit | Python |
faccefc513e8b20d16e9923dd65c5a17fcaef2d3 | Use app route for status | ayushgoel/flock-message-reporter,ayushgoel/flock-message-reporter,ayushgoel/flock-message-reporter,ayushgoel/flock-message-reporter | src/start.py | src/start.py | from flask import Flask
from flask import Blueprint
from flask import request
from flask import abort
from flask import jsonify
from flask import send_from_directory
import events
import config
app = Flask(__name__)
bp = Blueprint('report-message', __name__)
@app.route("/status")
def status():
return "Up!"
@bp.r... | from flask import Flask
from flask import Blueprint
from flask import request
from flask import abort
from flask import jsonify
from flask import send_from_directory
import events
import config
app = Flask(__name__)
bp = Blueprint('report-message', __name__)
@bp.route("/status")
def status():
return "Up!"
@bp.ro... | mit | Python |
fd103a3c690af6f8191e82576a9a2db41ce755c2 | Declare extensionServer for generated devtools_extension_api.js | primiano/blink-gitcs,primiano/blink-gitcs,primiano/blink-gitcs,primiano/blink-gitcs,primiano/blink-gitcs,primiano/blink-gitcs,primiano/blink-gitcs,primiano/blink-gitcs,primiano/blink-gitcs | Source/devtools/scripts/generate_devtools_extension_api.py | Source/devtools/scripts/generate_devtools_extension_api.py | #!/usr/bin/env python
#
# Copyright (C) 2011 Google Inc. 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... | #!/usr/bin/env python
#
# Copyright (C) 2011 Google Inc. 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... | bsd-3-clause | Python |
ba7333ee7551642a9247a5958e1a2881dd7d4c6a | Remove nick from batch end as well | Heufneutje/txircd | txircd/modules/ircv3/batch.py | txircd/modules/ircv3/batch.py | from twisted.plugin import IPlugin
from txircd.module_interface import IModuleData, ModuleData
from zope.interface import implementer
from typing import Any, Callable, Dict, List, Optional, Tuple
import random, string
@implementer(IPlugin, IModuleData)
class Batch(ModuleData):
name = "Batch"
def actions(self) -> L... | from twisted.plugin import IPlugin
from txircd.module_interface import IModuleData, ModuleData
from zope.interface import implementer
from typing import Any, Callable, Dict, List, Optional, Tuple
import random, string
@implementer(IPlugin, IModuleData)
class Batch(ModuleData):
name = "Batch"
def actions(self) -> L... | bsd-3-clause | Python |
83099dad7ec753946b63e9bc936fa670067ba39a | Fix parent reference in transform (incorrectly referred to body as parent) | PyCQA/astroid | astroid/brain/brain_attrs.py | astroid/brain/brain_attrs.py | # Licensed under the LGPL: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html
# For details: https://github.com/PyCQA/astroid/blob/master/COPYING.LESSER
"""
Astroid hook for the attrs library
Without this hook pylint reports unsupported-assignment-operation
for atrrs classes
"""
import astroid
from astroid im... | # Licensed under the LGPL: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html
# For details: https://github.com/PyCQA/astroid/blob/master/COPYING.LESSER
"""
Astroid hook for the attrs library
Without this hook pylint reports unsupported-assignment-operation
for atrrs classes
"""
import astroid
from astroid im... | lgpl-2.1 | Python |
b4ae2046eb938dc7283af3faa4945a2c4b8ef57d | Make some moderator columns not nullable | Floens/uchan,Floens/uchan,Floens/uchan,Floens/uchan,Floens/uchan | uchan/lib/models/moderator.py | uchan/lib/models/moderator.py | from sqlalchemy import Column, String, LargeBinary
from sqlalchemy import Integer
from sqlalchemy.dialects.postgresql import ARRAY
from sqlalchemy.ext.associationproxy import association_proxy
from sqlalchemy.orm import relationship, deferred
from uchan.lib.database import ModelBase
from uchan.lib.models import Mutabl... | from sqlalchemy import Column, String, LargeBinary
from sqlalchemy import Integer
from sqlalchemy.dialects.postgresql import ARRAY
from sqlalchemy.ext.associationproxy import association_proxy
from sqlalchemy.orm import relationship, deferred
from uchan.lib.database import ModelBase
from uchan.lib.models import Mutabl... | mit | Python |
9351dbe5f0ba1a445dbfc1f8802d4bad6e2fb5e7 | change v1 name around code | kave/cfgov-refresh,kave/cfgov-refresh,kave/cfgov-refresh,kave/cfgov-refresh | cfgov/v1/wagtail_hooks.py | cfgov/v1/wagtail_hooks.py | from django.http import Http404
from django.conf import settings
from v1.models import CFGOVPage
from wagtail.wagtailcore import hooks
@hooks.register('after_create_page')
@hooks.register('after_edit_page')
def share_the_page(request, page):
parent_page = page.get_ancestors(inclusive=False).reverse()[0].specific... | from django.http import Http404
from django.conf import settings
from v1.models import V1Page
from wagtail.wagtailcore import hooks
@hooks.register('after_create_page')
@hooks.register('after_edit_page')
def share_the_page(request, page):
parent_page = page.get_ancestors(inclusive=False).reverse()[0].specific
... | cc0-1.0 | Python |
cd34d9ff8ae7cc2bf65cdb759f60e21ecc39c104 | Correct problem with missing files (hiprec) | dbeyer/benchexec,ultimate-pa/benchexec,sosy-lab/benchexec,sosy-lab/benchexec,sosy-lab/benchexec,sosy-lab/benchexec,IljaZakharov/benchexec,IljaZakharov/benchexec,ultimate-pa/benchexec,martin-neuhaeusser/benchexec,dbeyer/benchexec,dbeyer/benchexec,dbeyer/benchexec,IljaZakharov/benchexec,martin-neuhaeusser/benchexec,ultim... | benchexec/tools/hiprec.py | benchexec/tools/hiprec.py | #!/usr/bin/env python
"""
BenchExec is a framework for reliable benchmarking.
This file is part of BenchExec.
Copyright (C) 2007-2015 Dirk Beyer
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 ... | #!/usr/bin/env python
"""
BenchExec is a framework for reliable benchmarking.
This file is part of BenchExec.
Copyright (C) 2007-2015 Dirk Beyer
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 ... | apache-2.0 | Python |
477d65ce4c63ae025c1649f034b27cd081f15cef | fix to check if directory savegames exists and if not create the directory. And it is the 300th commit!! :) :) | HRODEV/Frequency | Frequency/Main.py | Frequency/Main.py | import os
import pygame
from sys import exit
from Game import Game
from Helpers.EventHelpers import EventExist
pygame.init()
clock = pygame.time.Clock()
# make necessary directory
if not os.path.exists("./savegames/"):
os.makedirs("./savegames/")
def Main():
pygame.display.init()
# ... | import pygame
from sys import exit
from Game import Game
from Helpers.EventHelpers import EventExist
pygame.init()
clock = pygame.time.Clock()
def Main():
pygame.display.init()
# Music
pygame.mixer.init()
pygame.mixer.music.load('Resources/menu.mp3')
pygame.mixer.music.play()
... | mit | Python |
20790f6c9e5fde727fcb0e9c76061cdc10c0f5c6 | remove container if param available | pbelmann/command-line-interface,pbelmann/command-line-interface,bioboxes/command-line-interface,bioboxes/command-line-interface,michaelbarton/command-line-interface,michaelbarton/command-line-interface | biobox_cli/command/run.py | biobox_cli/command/run.py | """
biobox run - Run a biobox Docker image with input parameters
Usage:
biobox run <biobox_type> <image> [<args>...]
Options:
-h, --help Show this screen.
Available Biobox types:
short_read_assembler Assemble short reads into contigs
"""
import biobox_cli.util as util
def run(argv):
opts = util.pa... | """
biobox run - Run a biobox Docker image with input parameters
Usage:
biobox run <biobox_type> <image> [<args>...]
Options:
-h, --help Show this screen.
Available Biobox types:
short_read_assembler Assemble short reads into contigs
"""
import biobox_cli.util as util
def run(argv):
opts = util.p... | mit | Python |
e359f1486236b420b12e41c00bb09d95ee1afa79 | Patch for example "test" | zapion/combo-runner,zapion/combo-runner,Mozilla-TWQA/combo-runner,Mozilla-TWQA/combo-runner | examples/test/test_action_runner.py | examples/test/test_action_runner.py | from comborunner import action_decorator
from comborunner.base_action_runner import BaseActionRunner
class TestActionRunner(BaseActionRunner):
action = action_decorator.action
@action
def do_test_pre(self, action=False):
if action:
self.pre_commands.append('rm -rf .env; virtualenv .e... | import action_decorator
from base_action_runner import BaseActionRunner
class TestActionRunner(BaseActionRunner):
action = action_decorator.action
@action
def do_test_pre(self, action=False):
if action:
self.pre_commands.append('rm -rf .env; virtualenv .env; source .env/bin/activate;... | mpl-2.0 | Python |
12b1ca0f976be91ff48ba8e51f0679314df7212b | add a missing piece of single-command | veloutin/papas,veloutin/papas | lib6ko/protocols/console.py | lib6ko/protocols/console.py | import re
import logging
import pexpect
from cStringIO import StringIO
from lib6ko import parameters as _P
from lib6ko.protocol import Protocol
from lib6ko.architecture import Architecture
_LOG = logging.getLogger("protocols.console")
class ConsoleProtocol(Protocol):
""" Console Protocol """
def __init__(se... | import re
import logging
import pexpect
from cStringIO import StringIO
from lib6ko import parameters as _P
from lib6ko.protocol import Protocol
from lib6ko.architecture import Architecture
_LOG = logging.getLogger("protocols.console")
class ConsoleProtocol(Protocol):
""" Console Protocol """
def __init__(se... | agpl-3.0 | Python |
8ddf791b0f7960da089c61b63f996c375ea80ac0 | Fix 0-byte dupe file bug | eldarion/django-chunked-uploads,IRI-Research/django-chunked-uploads,IRI-Research/django-chunked-uploads,eldarion/django-chunked-uploads,IRI-Research/django-chunked-uploads | chunked_uploads/models.py | chunked_uploads/models.py | import datetime
import os
from django.conf import settings
from django.core.files.base import ContentFile
from django.db import models
from django.contrib.auth.models import User
from uuidfield import UUIDField
STORAGE_CLASS = getattr(settings, "CHUNKED_UPLOADS_STORAGE_CLASS", None)
if STORAGE_CLASS:
storage =... | import datetime
import os
from django.conf import settings
from django.core.files.uploadedfile import UploadedFile
from django.db import models
from django.contrib.auth.models import User
from uuidfield import UUIDField
STORAGE_CLASS = getattr(settings, "CHUNKED_UPLOADS_STORAGE_CLASS", None)
if STORAGE_CLASS:
... | bsd-3-clause | Python |
36888cbc7916d09370f057e03338c81bd640a536 | Add sumcheck verification for train, valid and test subsets | dmitriy-serdyuk/fuel,mjwillson/fuel,bouthilx/fuel,chrishokamp/fuel,lamblin/fuel,markusnagel/fuel,bouthilx/fuel,dwf/fuel,udibr/fuel,dhruvparamhans/fuel,rizar/fuel,orhanf/fuel,chrishokamp/fuel,aalmah/fuel,rodrigob/fuel,aalmah/fuel,rodrigob/fuel,dmitriy-serdyuk/fuel,ejls/fuel,codeaudit/fuel,laurent-dinh/fuel,rizar/fuel,dr... | tests/test_binarized_mnist.py | tests/test_binarized_mnist.py | import hashlib
import os
from numpy.testing import assert_raises
from fuel import config
from fuel.datasets import BinarizedMNIST
from tests import skip_if_not_available
def test_binarized_mnist_train():
skip_if_not_available(datasets=['binarized_mnist.hdf5'])
dataset = BinarizedMNIST('train', load_in_memo... | import os
from numpy.testing import assert_raises
from fuel import config
from fuel.datasets import BinarizedMNIST
from tests import skip_if_not_available
def test_binarized_mnist_train():
skip_if_not_available(datasets=['binarized_mnist.hdf5'])
dataset = BinarizedMNIST('train', load_in_memory=False)
h... | mit | Python |
22f63a8fa80eb83982ddc46944ca49599646ed20 | Bring test coverage of RollingCounter to 100% | ryansb/disq,ryansb/disq | tests/test_rolling_counter.py | tests/test_rolling_counter.py | # Copyright 2015 Ryan Brown <sb@ryansb.com>
#
# 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 ... | # Copyright 2015 Ryan Brown <sb@ryansb.com>
#
# 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 ... | apache-2.0 | Python |
d5549b384e10839d1112de48a9a016ee1da79a2f | Fix self versioning test. | bhodorog/pytest-vts | tests/test_self_versioning.py | tests/test_self_versioning.py | import shlex
import subprocess
import pytest
import pkg_resources
import pytest_vts
@pytest.fixture
def git_describe():
cmd = shlex.split("git describe --tags --long --match='v*'")
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
out, err = proc.co... | import shlex
import subprocess
import pytest
import pkg_resources
import pytest_vts
@pytest.fixture
def git_describe():
cmd = shlex.split("git describe --tags --long --match='v*'")
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
out, err = proc.co... | mit | Python |
eab5cf884aeb09fff0799f5dfa70f6995be30627 | Reorganize rstate so lint can infer the return value easier. | mwhoffman/mwhutils | mwhutils/random/random.py | mwhutils/random/random.py | """
Sample from low-discrepancy sequences.
"""
# future imports
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
# local imports
from ._sobol import i4_sobol_generate
# global imports
import numpy as np
# exported symbols
__all__ = ['rstate', 'uniform', 'l... | """
Sample from low-discrepancy sequences.
"""
# future imports
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
# local imports
from ._sobol import i4_sobol_generate
# global imports
import numpy as np
# exported symbols
__all__ = ['rstate', 'uniform', 'l... | bsd-2-clause | Python |
d8fd39a9dc4cc48e73a9f1d63972327431b3f05d | Add restore messages to gerrit auto-expire script | dhiana/puppet-gerrit,open-switch/infra_puppet-gerrit,dhiana/puppet-gerrit,open-switch/infra_puppet-gerrit,open-switch/infra_puppet-gerrit,dhiana/puppet-gerrit | files/scripts/expire_old_reviews.py | files/scripts/expire_old_reviews.py | #!/usr/bin/env python
# Copyright (c) 2012 OpenStack, 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | #!/usr/bin/env python
# Copyright (c) 2012 OpenStack, 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | apache-2.0 | Python |
d99f1b4a10d4c2c918a939a4671583411a3df466 | Remove unnecessary logging from migration 019 | saeki-masaki/glance,paramite/glance,SUSE-Cloud/glance,redhat-openstack/glance,scripnichenko/glance,klmitch/glance,darren-wang/gl,JioCloud/glance,sigmavirus24/glance,rickerc/glance_audit,ntt-sic/glance,sigmavirus24/glance,citrix-openstack-build/glance,openstack/glance,SUSE-Cloud/glance,openstack/glance,wkoathp/glance,ju... | glance/db/sqlalchemy/migrate_repo/versions/019_migrate_image_locations.py | glance/db/sqlalchemy/migrate_repo/versions/019_migrate_image_locations.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 OpenStack Foundation
# 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.apach... | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 OpenStack Foundation
# 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.apach... | apache-2.0 | Python |
84ecdcb9408f10a8acc78a00d31aec9684a9bc34 | Fix assets URL | koorukuroo/findaconf,cuducos/findaconf,cuducos/findaconf,koorukuroo/findaconf,koorukuroo/findaconf,cuducos/findaconf | findaconf/tests/test_file_routes.py | findaconf/tests/test_file_routes.py | # coding: utf-8
import unittest
from random import randrange
from findaconf import app
class TestFileRoutes(unittest.TestCase):
def setUp(self):
# init
app.testing = True
self.app = app.test_client()
def tearDown(self):
pass
# test routes from blueprint/file_routes.py
... | # coding: utf-8
import unittest
from random import randrange
from findaconf import app
class TestFileRoutes(unittest.TestCase):
def setUp(self):
# init
app.testing = True
self.app = app.test_client()
def tearDown(self):
pass
# test routes from blueprint/file_routes.py
... | mit | Python |
9efe63d87c9fcbdf36e0a47e006779bb64014f36 | add poor sketch of operation store/load to factory module | genome/flow-workflow,genome/flow-workflow,genome/flow-workflow | flow_workflow/operations/factory.py | flow_workflow/operations/factory.py | import pkg_resources
import re
MODULE = None
_NEXT_OPERATION_ID = 0
def adapter(operation_type, *args, **kwargs):
global _NEXT_OPERATION_ID
for ep in pkg_resources.iter_entry_points('flow_workflow.adapters',
sanitize_operation_type(operation_type)):
cls = ep.load()
obj = cls(op... | import pkg_resources
import re
_NEXT_OPERATION_ID = 0
def adapter(operation_type, *args, **kwargs):
global _NEXT_OPERATION_ID
for ep in pkg_resources.iter_entry_points('flow_workflow.adapters',
sanitize_operation_type(operation_type)):
cls = ep.load()
obj = cls(operation_id=_NEXT... | agpl-3.0 | Python |
cdba51a7b0013c9a6eea2a761c733bce3218ea4c | fix error with version | airtonix/tasty-social-pie | tasty_social_pie/__init__.py | tasty_social_pie/__init__.py | __version__ = "0.0.1" | version = "0.0.1" | mit | Python |
b78a34bc1152b6da18068393b7e6470a220084f9 | set true bit | AppGeo/ckanext-agsview,AppGeo/ckanext-agsview,AppGeo/ckanext-agsview,AppGeo/ckanext-agsview | ckanext/agsview/plugin.py | ckanext/agsview/plugin.py | # encoding: utf-8
import logging
import ckan.plugins as p
log = logging.getLogger(__name__)
ignore_empty = p.toolkit.get_validator('ignore_empty')
DEFAULT_AGS_FORMATS = ['ags']
class AGSView(p.SingletonPlugin):
'''This plugin makes views of arcgis online resources'''
p.implements(p.IConfigurer, inherit=Tr... | # encoding: utf-8
import logging
import ckan.plugins as p
log = logging.getLogger(__name__)
ignore_empty = p.toolkit.get_validator('ignore_empty')
DEFAULT_AGS_FORMATS = ['ags']
class AGSView(p.SingletonPlugin):
'''This plugin makes views of arcgis online resources'''
p.implements(p.IConfigurer, inherit=Tr... | mit | Python |
ec9e5866b65a6dffd8a529491460da69185b64cf | Add os and arch prediction code | trackmon/trackmon-server,trackmon/trackmon-server | manager/trackmon_manager.py | manager/trackmon_manager.py | import sys
import os
from subprocess import call
import urllib.request
import json
from pprint import pprint
# User needs to install postgres first
trackmon_server_api_info = "https://api.github.com/repos/atom/atom/releases/latest"
current_os = ""
current_arch = ""
if sys.platform.startswith('linux'):
current_os ... | import sys
import os
from subprocess import call
import urllib.request
import json
#from pprint import pprint
# User needs to install postgres first
trackmon_server_api_info = "https://api.github.com/repos/paulkramme/roverpi/releases/latest"
def download(url, path):
with urllib.request.urlopen(url) as response, o... | bsd-2-clause | Python |
e5a21a40f73978359d3e6a26fcbbe9b74269ac57 | Fix alembic migration history | alfredhq/alfred-db | alfred_db/migrations/versions/29a56dc34a2b_add_permissions.py | alfred_db/migrations/versions/29a56dc34a2b_add_permissions.py | """Add permissions
Revision ID: 29a56dc34a2b
Revises: 4fdf1059c4ba
Create Date: 2012-09-02 14:06:24.088307
"""
# revision identifiers, used by Alembic.
revision = '29a56dc34a2b'
down_revision = '30c0aec2ca06'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.create_table('permissions',
... | """Add permissions
Revision ID: 29a56dc34a2b
Revises: 4fdf1059c4ba
Create Date: 2012-09-02 14:06:24.088307
"""
# revision identifiers, used by Alembic.
revision = '29a56dc34a2b'
down_revision = '5245d0b46f8'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.create_table('permissions',
s... | isc | Python |
bb85acf74a01a093246f9aab105dee66bfd57d10 | fix apache.wsgi | hoehnp/sirius,hoehnp/sirius,claritylab/sirius,hoehnp/sirius,claritylab/sirius,claritylab/sirius,claritylab/sirius,hoehnp/sirius,claritylab/sirius,claritylab/sirius,claritylab/sirius,hoehnp/sirius,hoehnp/sirius,hoehnp/sirius | lucida/commandcenter/apache/apache.wsgi | lucida/commandcenter/apache/apache.wsgi | import sys
import os
import logging
logging.basicConfig(stream=sys.stderr)
current_dir = os.path.abspath(os.path.dirname(__file__))
parent_dir = os.path.abspath(current_dir + "/../")
sys.path.insert(0, parent_dir)
with open(current_dir + "/envs.txt") as f:
for line in f:
os.environ[line.split("=")[0]] =... | import sys
import os
current_dir = os.path.abspath(os.path.dirname(__file__))
parent_dir = os.path.abspath(current_dir + "/../")
sys.path.insert(0, parent_dir)
from app import app as application
| bsd-3-clause | Python |
a7c3f819dafe34a765cb930a7ffc5eaac85bfaa4 | add short command options | rtluckie/seria | seria/cli.py | seria/cli.py | # -*- coding: utf-8 -*-
import click
from .compat import StringIO, str, builtin_str
import seria
CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])
@click.command(context_settings=CONTEXT_SETTINGS)
@click.option('--xml', '-x', 'out_fmt', flag_value='xml')
@click.option('--yaml', '--yml', '-y', 'out_fmt', ... | # -*- coding: utf-8 -*-
import click
from .compat import StringIO, str, builtin_str
import seria
CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])
@click.command(context_settings=CONTEXT_SETTINGS)
@click.option('--xml', 'out_fmt', flag_value='xml')
@click.option('--yaml', 'out_fmt', flag_value='yaml')
@c... | mit | Python |
8dd6223485fb2d59d1adde236db061c8c4fd6f0f | Bump version | thombashi/sqlitebiter,thombashi/sqlitebiter | sqlitebiter/__version__.py | sqlitebiter/__version__.py | # encoding: utf-8
from datetime import datetime
__author__ = "Tsuyoshi Hombashi"
__copyright__ = "Copyright 2016-{}, {}".format(datetime.now().year, __author__)
__license__ = "MIT License"
__version__ = "0.28.1"
__maintainer__ = __author__
__email__ = "tsuyoshi.hombashi@gmail.com"
| # encoding: utf-8
from datetime import datetime
__author__ = "Tsuyoshi Hombashi"
__copyright__ = "Copyright 2016-{}, {}".format(datetime.now().year, __author__)
__license__ = "MIT License"
__version__ = "0.28.0"
__maintainer__ = __author__
__email__ = "tsuyoshi.hombashi@gmail.com"
| mit | Python |
75c0ad4147bd3e0a56a06a340d9a4a812c1fe6b1 | Add [blank,null]=True to Image model to prevent errors in bulk creation of image | lo-windigo/fragdev,lo-windigo/fragdev | images/models.py | images/models.py | # This file is part of the FragDev Website.
#
# the FragDev Website is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# the FragDev W... | # This file is part of the FragDev Website.
#
# the FragDev Website is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# the FragDev W... | agpl-3.0 | Python |
f7dcb7fc3ecdb35711e5a7488599ee4b0a501053 | Add protocol detection basic logic | rjschwei/WALinuxAgent,hglkrijger/WALinuxAgent,rjschwei/WALinuxAgent,andyliuliming/WALinuxAgent,andyliuliming/WALinuxAgent,nathanleclaire/WALinuxAgent,nathanleclaire/WALinuxAgent,Azure/WALinuxAgent,hglkrijger/WALinuxAgent,Azure/WALinuxAgent | azure/linuxagent/protocol.py | azure/linuxagent/protocol.py | #!/usr/bin/env python
#
# Windows Azure Linux Agent
#
# Copyright 2014 Microsoft Corporation
#
# 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... | #!/usr/bin/env python
#
# Windows Azure Linux Agent
#
# Copyright 2014 Microsoft Corporation
#
# 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... | apache-2.0 | Python |
9373accc4381a2582838638f95301076b5684563 | set --follow-imports silent for mypy linter | bosondata/badwolf,bosondata/badwolf,bosondata/badwolf | badwolf/lint/linters/mypy.py | badwolf/lint/linters/mypy.py | # -*- coding: utf-8 -*-
import logging
from badwolf.utils import run_command
from badwolf.lint import Problem
from badwolf.lint.linters import PythonLinter
from badwolf.lint.utils import in_path
logger = logging.getLogger(__name__)
class MypyLinter(PythonLinter):
name = 'mypy'
default_pattern = '*.py *.pyi... | # -*- coding: utf-8 -*-
import logging
from badwolf.utils import run_command
from badwolf.lint import Problem
from badwolf.lint.linters import PythonLinter
from badwolf.lint.utils import in_path
logger = logging.getLogger(__name__)
class MypyLinter(PythonLinter):
name = 'mypy'
default_pattern = '*.py *.pyi... | mit | Python |
736b92ee87fef7cf11c0d741aed7a15ec3e0c37e | Update timetable generator. | alfredo/microdash,alfredo/microdash | microdash/core/timetable.py | microdash/core/timetable.py | import requests
from datetime import datetime
from BeautifulSoup import BeautifulSoup
USER_AGENT = ('Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:31.0) '
'Gecko/20100101 Firefox/31.0')
HEADERS = {
'User-Agent': USER_AGENT,
}
URL_PREFIX = ('http://www.abelliogreateranglia.co.uk/travel-information'... | import requests
from datetime import datetime
from BeautifulSoup import BeautifulSoup
USER_AGENT = ('Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:31.0) '
'Gecko/20100101 Firefox/31.0')
HEADERS = {
'User-Agent': USER_AGENT,
}
URL_PREFIX = ('http://www.abelliogreateranglia.co.uk/travel-information'... | bsd-3-clause | Python |
1bf3695213623926219297d2b441297bd0afb2e1 | Fix response | ben174/bart-crime,ben174/bart-crime | reports/views.py | reports/views.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime
from crime import settings
from reports.models import Report, Incident, Comment
from reports import scraper
from django.http import HttpResponse
from django.shortcuts import render, redirect, get_object_or_404
from django.views.decorator... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime
from crime import settings
from reports.models import Report, Incident, Comment
from reports import scraper
from django.shortcuts import render, redirect, get_object_or_404
from django.views.decorators.csrf import csrf_exempt
@csrf_exem... | mit | Python |
cdb6b46db15fc5d5a4c517682a609dfff9530173 | Complete intelmq_psql_initdb script | certtools/intelmq,aaronkaplan/intelmq,pkug/intelmq,certtools/intelmq,robcza/intelmq,pkug/intelmq,certtools/intelmq,robcza/intelmq,aaronkaplan/intelmq,pkug/intelmq,robcza/intelmq,robcza/intelmq,aaronkaplan/intelmq,pkug/intelmq | intelmq/bin/intelmq_psql_initdb.py | intelmq/bin/intelmq_psql_initdb.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Generates a SQL command file with commands to create the events table.
Reads the Data-Harmonization.md document from
`/opt/intelmq/docs/Data-Harmonization.md` and generates an SQL command from it.
The SQL file is saved in `/tmp/initdb.sql`.
"""
from __future__ import p... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Generates a SQL command file with commands to create the events table.
Reads the Data-Harmonization.md document from
`/opt/intelmq/docs/Data-Harmonization.md` and generates an SQL command from it.
The SQL file is saved in `/tmp/initdb.sql`.
"""
from __future__ import p... | agpl-3.0 | Python |
0107a8919d264b522faa825c36f0be0644681fb3 | create incremental table if it doesn't exist | nave91/dbt,nave91/dbt,analyst-collective/dbt,analyst-collective/dbt,fishtown-analytics/dbt,fishtown-analytics/dbt,fishtown-analytics/dbt | dbt/templates.py | dbt/templates.py |
class BaseCreateTemplate(object):
template = """
create {materialization} "{schema}"."{identifier}" {dist_qualifier} {sort_qualifier} as (
{query}
);"""
incremental_template = """
create temporary table "{identifier}__dbt_incremental_tmp" as (
SELECT * FROM (
{query}
... |
class BaseCreateTemplate(object):
template = """
create {materialization} "{schema}"."{identifier}" {dist_qualifier} {sort_qualifier} as (
{query}
);"""
incremental_template = """
insert into "{schema}"."{identifier}" (
with dbt_inc_sbq as (
select max("{incremental_fie... | apache-2.0 | Python |
57cbc821e8278c45c7fa48d05661c6e3d73a0a67 | Update twitch.py | TingPing/plugins,TingPing/plugins | HexChat/twitch.py | HexChat/twitch.py | import hexchat
__module_name__ = 'Twitch'
__module_author__ = 'TingPing'
__module_version__ = '2'
__module_description__ = 'Better integration with Twitch.tv'
# Very much a work in progress...
# Commands from http://help.twitch.tv/customer/portal/articles/659095-chat-moderation-commands
# /ban may conflict with other... | import hexchat
__module_name__ = 'Twitch'
__module_author__ = 'TingPing'
__module_version__ = '1'
__module_description__ = 'Better integration with Twitch.tv'
# Very much a work in progress...
# Commands from http://help.twitch.tv/customer/portal/articles/659095-chat-moderation-commands
# /ban may conflict with other... | mit | Python |
509c3fe88e1d0d096ad18bb10750466d61bfd7a6 | Update wordhl.py | TingPing/plugins,TingPing/plugins | HexChat/wordhl.py | HexChat/wordhl.py | import hexchat
__module_name__ = 'wordhl'
__module_author__ = 'TingPing'
__module_version__ = '1'
__module_description__ = 'Highlights some words of importance'
# When you want to notice something, but not really get 'highlighted'
hlwords = ('hexchat', )
edited = False
def print_cb(word, word_eol, userdata, attr):
... | import hexchat
__module_name__ = 'wordhl'
__module_author__ = 'TingPing'
__module_version__ = '1'
__module_description__ = 'Highlights some words of importance'
# When you want to notice something, but not really get 'highlighted'
hlwords = ('hexchat', )
edited = False
def print_cb(word, word_eol, userdata, attr):
... | mit | Python |
8521837cc3f57e11278fc41bfd0e5d106fc140fe | Simplify database query when looking up an alias | jbittel/django-deflect | deflect/views.py | deflect/views.py | from __future__ import unicode_literals
import base32_crockford
import logging
from django.db.models import F
from django.http import Http404
from django.http import HttpResponsePermanentRedirect
from django.shortcuts import get_object_or_404
from django.utils.timezone import now
from .models import ShortURL
from .m... | from __future__ import unicode_literals
import base32_crockford
import logging
from django.db.models import F
from django.http import Http404
from django.http import HttpResponsePermanentRedirect
from django.shortcuts import get_object_or_404
from django.utils.timezone import now
from .models import ShortURL
from .m... | bsd-3-clause | Python |
91d53c4e00c3ca7a2f520b1133b15088589c25d9 | Fix logging | wengole/nasman,wengole/nasman,wengole/nasman,wengole/nasman,wengole/nasman | nasman/snapshots/tasks.py | nasman/snapshots/tasks.py | from datetime import datetime
import logging
from celery import shared_task
from nasman.snapshots.models import File
from .utils.zfs import ZFSUtil
logger = logging.getLogger(__name__)
def build_file_list(path):
"""
Build a list a list of files (and directories) by iterating recursively
over the given p... | from datetime import datetime
import logging
from celery import shared_task
from nasman.snapshots.models import File
from .utils.zfs import ZFSUtil
logger = logging.getLogger(__name__)
def build_file_list(path):
"""
Build a list a list of files (and directories) by iterating recursively
over the given p... | bsd-3-clause | Python |
52962f30f1215b705bee0beb70b40819ddf0164e | Reorder subplots | ofgulban/scikit-image,bennlich/scikit-image,paalge/scikit-image,almarklein/scikit-image,chintak/scikit-image,newville/scikit-image,pratapvardhan/scikit-image,pratapvardhan/scikit-image,robintw/scikit-image,almarklein/scikit-image,Hiyorimi/scikit-image,michaelpacer/scikit-image,emon10005/scikit-image,paalge/scikit-image... | doc/examples/plot_denoise.py | doc/examples/plot_denoise.py | """
=============================
Denoising the picture of Lena
=============================
In this example, we denoise a noisy version of the picture of Lena using the
total variation and bilateral denoising filter.
These algorithms typically produce "posterized" images with flat domains
separated by sharp edges. ... | """
=============================
Denoising the picture of Lena
=============================
In this example, we denoise a noisy version of the picture of Lena using the
total variation and bilateral denoising filter.
These algorithms typically produce "posterized" images with flat domains
separated by sharp edges. ... | bsd-3-clause | Python |
1848f7a9a8a4cba76324cf6b6032ea027a389c39 | revert to old version of jquery | philchristensen/modu,philchristensen/modu,philchristensen/modu | src/modu/assets/__init__.py | src/modu/assets/__init__.py | # modu
# Copyright (c) 2006-2010 Phil Christensen
# http://modu.bubblehouse.org
#
#
# See LICENSE for details
from modu.util import tags
# DEFAULT_JQUERY_VERSION = '1.11.0'
# DEFAULT_JQUERY_UI_VERSION = '1.9.2'
DEFAULT_JQUERY_VERSION = '1.4.2'
DEFAULT_JQUERY_UI_VERSION = '1.7.1'
def activate_jquery(req):
req.conten... | # modu
# Copyright (c) 2006-2010 Phil Christensen
# http://modu.bubblehouse.org
#
#
# See LICENSE for details
from modu.util import tags
DEFAULT_JQUERY_VERSION = '1.11.0'
DEFAULT_JQUERY_UI_VERSION = '1.9.2'
def activate_jquery(req):
req.content.report('header', tags.script(type="text/javascript", src="//ajax.google... | mit | Python |
c322e4f2202f3b004a4f41bd4c2786f88292cf37 | Validate the presence of CONTENT_STORE. | ktbartholomew/preparer-sphinx,ktbartholomew/preparer-sphinx,deconst/preparer-sphinx,deconst/preparer-sphinx | deconstrst/deconstrst.py | deconstrst/deconstrst.py | # -*- coding: utf-8 -*-
from __future__ import print_function
import argparse
import sys
import os
from builder import DeconstJSONBuilder
from sphinx.application import Sphinx
from sphinx.builders import BUILTIN_BUILDERS
def build(argv):
"""
Invoke Sphinx with locked arguments to generate JSON content.
... | # -*- coding: utf-8 -*-
import argparse
import sys
from os import path
from builder import DeconstJSONBuilder
from sphinx.application import Sphinx
from sphinx.builders import BUILTIN_BUILDERS
def build(argv):
"""
Invoke Sphinx with locked arguments to generate JSON content.
"""
parser = argparse.A... | apache-2.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.