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 |
|---|---|---|---|---|---|---|---|---|
34b61df7608f93aa6f4378944b487a947afaabf8 | Remove a bunch of fixed/wfm bugs from detect_leaks.py. Scary... | nth10sd/funfuzz,nth10sd/funfuzz,MozillaSecurity/funfuzz,nth10sd/funfuzz,MozillaSecurity/funfuzz,MozillaSecurity/funfuzz | dom/automation/detect_leaks.py | dom/automation/detect_leaks.py | #!/usr/bin/env python
def ath(array):
hash = {}
for s in array:
hash[s] = True
return hash
knownHash = ath([
# bug 391976
"nsMathMLContainerFrame",
"nsMathMLmtableOuterFrame",
"nsMathMLmtdInnerFrame",
"nsMathMLmactionFrame",
# Bug 398462
"nsBaseAppShell",
"nsRunnable",
# Bug 403199
"nsSimpleN... | #!/usr/bin/env python
def ath(array):
hash = {}
for s in array:
hash[s] = True
return hash
knownHash = ath([
# bug 391976
"nsMathMLContainerFrame",
"nsMathMLmtableOuterFrame",
"nsMathMLmtdInnerFrame",
"nsMathMLmactionFrame",
# Bug 398462
"nsBaseAppShell",
"nsRunnable",
# Bug 403199
"nsSimpleN... | mpl-2.0 | Python |
b8cc7058e13d71f4e6714f5aa013815016525f5d | print info as strings, not numbers. will catch pending vms too. | stroucki/tashi,stroucki/tashi,stroucki/tashi | src/tashi/accounting/accountingservice.py | src/tashi/accounting/accountingservice.py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | apache-2.0 | Python |
a8283f5d2c1d970b7b676d491ad8c9472abfe667 | Fix tests since we changed imports. | schinckel/django-boardinghouse,schinckel/django-boardinghouse,schinckel/django-boardinghouse | boardinghouse/tests/test_template_tag.py | boardinghouse/tests/test_template_tag.py | from django.test import TestCase
from .models import AwareModel, NaiveModel
from ..templatetags.boardinghouse import schema_name, is_schema_aware, is_shared_model
from ..models import Schema
class TestTemplateTags(TestCase):
def test_is_schema_aware_filter(self):
self.assertTrue(is_schema_aware(AwareModel... | from django.test import TestCase
from .models import AwareModel, NaiveModel
from ..templatetags.boardinghouse import *
class TestTemplateTags(TestCase):
def test_is_schema_aware_filter(self):
self.assertTrue(is_schema_aware(AwareModel()))
self.assertFalse(is_schema_aware(NaiveModel()))
de... | bsd-3-clause | Python |
eb21ec1021b1447c5bb3be6104b0576a7426de7b | 更新 apps ELOs, 新增所有 functions 的註解 | yrchen/CommonRepo,yrchen/CommonRepo,yrchen/CommonRepo,yrchen/CommonRepo | commonrepo/elos/apps.py | commonrepo/elos/apps.py | # -*- coding: utf-8 -*-
#
# Copyright 2016 edX PDR Lab, National Central University, Taiwan.
#
# http://edxpdrlab.ncu.cc/
#
# 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://w... | # -*- coding: utf-8 -*-
#
# Copyright 2016 edX PDR Lab, National Central University, Taiwan.
#
# http://edxpdrlab.ncu.cc/
#
# 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://w... | apache-2.0 | Python |
21b1f9bd8e546151e1e183b41237337efcc0bbc3 | Add country code | rogers0/namebench,google/namebench,google/namebench,protron/namebench,google/namebench | libnamebench/geoip.py | libnamebench/geoip.py | # Copyright 2010 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | # Copyright 2010 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | apache-2.0 | Python |
b65b5567e5cfddfdc10bc3a9a96647678916c3e6 | add copy logic | iku000888/Excel_Translation_Helper | library-examples/read-replace-export-excel.py | library-examples/read-replace-export-excel.py | """
Proto type that does the following:
input:Excel file in language A
output 1:Copy of input file, with original strings replaced with serial numbers
output 2:Single xlsx file that contains serial numbers and original texts from input file.
"""
import shutil
from openpyxl import load_workbook, Workbook
shutil.copy... | """
Proto type that does the following:
input:Excel file in language A
output 1:Copy of input file, with original strings replaced with serial numbers
output 2:Single xlsx file that contains serial numbers and original texts from input file.
"""
from openpyxl import load_workbook, Workbook
#point to the file to be r... | apache-2.0 | Python |
a16a2c490582ea9e78b81ccfc2355c5a4377ceec | Update S3Outposts per 2021-07-29 changes | cloudtools/troposphere,cloudtools/troposphere | troposphere/s3outposts.py | troposphere/s3outposts.py | # Copyright (c) 2012-2021, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
#
# *** Do not modify - this file is autogenerated ***
# Resource specification version: 39.8.0
from troposphere import Tags
from . import AWSObject, AWSProperty
from .validators import integer
class ... | # Copyright (c) 2012-2021, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
#
# *** Do not modify - this file is autogenerated ***
# Resource specification version: 31.0.0
from troposphere import Tags
from . import AWSObject, AWSProperty
from .validators import integer
class ... | bsd-2-clause | Python |
ed60c16993a04ac74b8f78ab94544c67fbfd1439 | Update closest_points.py | jilljenn/tryalgo | tryalgo/closest_points.py | tryalgo/closest_points.py | #!/usr/bin/env python3
# Closest pair of points
# trouver la paire de points la plus proche
# jill-jenn vie et christoph durr - 2014-2015
from random import randint
# snip{
from math import hypot # hypot(dx, dy) = sqrt(dx * dx + dy * dy)
from random import shuffle
__all__ = ["closest_points"]
def dist(p, q):
... | #!/usr/bin/env python3
# Closest pair of points
# trouver la paire de points la plus proche
# jill-jenn vie et christoph durr - 2014-2015
from random import randint
# snip{
from math import hypot # hypot(dx, dy) = sqrt(dx * dx + dy * dy)
from random import shuffle
def dist(p, q):
return hypot(p[0] - q[0], p... | mit | Python |
88f96a3828ab9a2225a8cf86306a333cd53b8717 | Make rehashing work properly | DesertBus/txircd,Heufneutje/txircd,ElementalAlchemist/txircd | txircd/modules/manhole.py | txircd/modules/manhole.py | from twisted.conch.manhole_tap import makeService
from twisted.internet import reactor
class Spawner(object):
def __init__(self, ircd):
self.manhole = makeService({
'namespace': {'ircd': ircd},
'passwd': 'manhole.passwd',
'telnetPort': None,
'sshPort': '65432... | from twisted.conch.manhole_tap import makeService
class Spawner(object):
def __init__(self, ircd):
self.manhole = makeService({
'namespace': {'ircd': ircd},
'passwd': 'manhole.passwd',
'telnetPort': None,
'sshPort': '65432'
})
def spawn(self)... | bsd-3-clause | Python |
ece5aa474a824eb2dfee8199e176baf1cbc33ad5 | Move calibration into class and out of main. | hmflash/tikitank,hmflash/tikitank,flaub/tikitank,flaub/tikitank,flaub/tikitank,flaub/tikitank,hmflash/tikitank,hmflash/tikitank,hmflash/tikitank,flaub/tikitank | treads.py | treads.py | #!/usr/bin/env python
import beaglebone_pru_adc as adc
import subprocess, os.path
import sys, time
class SpeedSensor(adc.Capture):
def __init__(self, firmware, *k, **kw):
super(SpeedSensor, self).__init__(*k, **kw)
fw = os.path.splitext(firmware)[0]
cmd = [ 'pasm', '-V3', '-b', firmware, fw ]
p = subprocess... | #!/usr/bin/env python
import beaglebone_pru_adc as adc
import subprocess, os.path
import sys, time
class SpeedSensor(adc.Capture):
def __init__(self, *k, **kw):
super(SpeedSensor, self).__init__(*k, **kw)
def start(self, firmware_src):
fw_bin = os.path.splitext(firmware_src)[0]
cmd = [ 'pasm', '-V3', '-b', f... | bsd-2-clause | Python |
23cec52bc136773e3e54251ca30d08c0733bcf1f | Add --message option to stop | TailorDev/Watson,TailorDev/Watson,wehlutyk/Watson,yloiseau/Watson | watson.py | watson.py | import os
import json
import datetime
import click
WATSON_FILE = os.path.join(os.path.expanduser('~'), '.watson')
def get_watson():
try:
with open(WATSON_FILE) as f:
return json.load(f)
except FileNotFoundError:
return {}
except ValueError:
return {}
def save_watson... | import os
import json
import datetime
import click
WATSON_FILE = os.path.join(os.path.expanduser('~'), '.watson')
def get_watson():
try:
with open(WATSON_FILE) as f:
return json.load(f)
except FileNotFoundError:
return {}
except ValueError:
return {}
def save_watson... | mit | Python |
7ce419de1f39050940b8399401a77b2096b74ca2 | Increment version number to 0.11.0 | uccser/cs4teachers,uccser/cs4teachers,uccser/cs4teachers,uccser/cs4teachers | dthm4kaiako/config/__init__.py | dthm4kaiako/config/__init__.py | """Configuration for Django system."""
__version__ = "0.11.0"
__version_info__ = tuple(
[
int(num) if num.isdigit() else num
for num in __version__.replace("-", ".", 1).split(".")
]
)
| """Configuration for Django system."""
__version__ = "0.10.1"
__version_info__ = tuple(
[
int(num) if num.isdigit() else num
for num in __version__.replace("-", ".", 1).split(".")
]
)
| mit | Python |
7d0dbc4947ff7395a772d4849f34a100f31877ef | add arg in comment | ClaudiaSaxer/PlasoScaffolder | src/plasoscaffolder/bll/mappings/init_mapping.py | src/plasoscaffolder/bll/mappings/init_mapping.py | # -*- coding: utf-8 -*-
""" Module representing function for the different files """
from plasoscaffolder.bll.mappings.mapping_helper import render_template
def get_formatter_init_create(plugin_name: str) -> str:
"""
renders formatter init if you want to create new init file
:param plugin_name: the plugin name
... | # -*- coding: utf-8 -*-
""" Module representing function for the different files """
from plasoscaffolder.bll.mappings.mapping_helper import render_template
def get_formatter_init_create(plugin_name: str) -> str:
"""
renders formatter init if you want to create new init file
:param plugin_name: the plugin name
... | apache-2.0 | Python |
8142a48a10799f83d6d8a0d29c50afccd5e9fd68 | Add get_app_and_db function | piotr-rusin/url-shortener,piotr-rusin/url-shortener | url_shortener/__init__.py | url_shortener/__init__.py | # -*- coding: utf-8 -*-
"""
url-shortener
==============
An application for generating and storing shorter aliases for
requested URLs. Uses `spam-lists`__ to prevent generating a short URL
for an address recognized as spam, or to warn a user a pre-existing
short alias has a target that has been later recognized as spa... | # -*- coding: utf-8 -*-
"""
url-shortener
==============
An application for generating and storing shorter aliases for
requested URLs. Uses `spam-lists`__ to prevent generating a short URL
for an address recognized as spam, or to warn a user a pre-existing
short alias has a target that has been later recognized as spa... | mit | Python |
a8a8656818ef8db333a6c35dab0bb4903fb32802 | fix crash on serial ip addresses | CanonicalLtd/subiquity,CanonicalLtd/subiquity | subiquity/controllers/welcome.py | subiquity/controllers/welcome.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 |
4874f3cb6d6f28e01b0d26998a96caf28fa3995c | make src/scripts/tls_scanner/tls_scanner.py python3-compatible | randombit/botan,randombit/botan,randombit/botan,randombit/botan,randombit/botan | src/scripts/tls_scanner/tls_scanner.py | src/scripts/tls_scanner/tls_scanner.py | #!/usr/bin/env python3
# (C) 2017 Jack Lloyd
# Botan is released under the Simplified BSD License (see license.txt)
import sys
import time
import subprocess
import re
def format_report(client_output):
version_re = re.compile('TLS (v1\.[0-3]) using ([A-Z0-9_]+)')
version_match = version_re.search(client_outp... | #!/usr/bin/env python3
# (C) 2017 Jack Lloyd
# Botan is released under the Simplified BSD License (see license.txt)
import sys
import time
import subprocess
import re
def format_report(client_output):
version_re = re.compile('TLS (v1\.[0-2]) using ([A-Z0-9_]+)')
version_match = version_re.search(client_outp... | bsd-2-clause | Python |
a8dfb7b0b99dba554d7bc08aadc63cbc6a626dd7 | Fix tempest test path | openstack/aodh,openstack/aodh | aodh/tests/tempest/plugin.py | aodh/tests/tempest/plugin.py | #
# Copyright 2015 NEC 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
#
# Unless required by applicable law or agreed to in w... | #
# Copyright 2015 NEC 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
#
# Unless required by applicable law or agreed to in w... | apache-2.0 | Python |
0f49230309ac115ff78eddd36bcd153d7f3b75ea | Remove reference to "job" from ThreadPool | uw-it-aca/canvas-analytics,uw-it-aca/canvas-analytics,uw-it-aca/canvas-analytics,uw-it-aca/canvas-analytics | data_aggregator/threads.py | data_aggregator/threads.py | import queue
import threading
from multiprocessing import Queue
class ThreadPool():
def __init__(self, processes=20):
self.processes = processes
self.threads = [Thread() for _ in range(0, processes)]
self.mp_queue = Queue()
def yield_dead_threads(self):
for thread in self.thr... | import queue
import threading
from multiprocessing import Queue
class ThreadPool():
def __init__(self, processes=20):
self.processes = processes
self.threads = [Thread() for _ in range(0, processes)]
self.mp_queue = Queue()
def yield_dead_threads(self):
for thread in self.thr... | apache-2.0 | Python |
7b736aa6ef1a8d39c1ad1509daaadaae682f17a5 | Fix MessageContainer having the wrong constructor id | LonamiWebs/Telethon,LonamiWebs/Telethon,LonamiWebs/Telethon,andr-04/Telethon,LonamiWebs/Telethon,expectocode/Telethon | telethon/tl/message_container.py | telethon/tl/message_container.py | from . import TLObject
from ..extensions import BinaryWriter
class MessageContainer(TLObject):
constructor_id = 0x73f1f8dc
# TODO Currently it's a bit of a hack, since the container actually holds
# messages (message id, sequence number, request body), not requests.
# Probably create a proper "Messag... | from . import TLObject
from ..extensions import BinaryWriter
class MessageContainer(TLObject):
constructor_id = 0x8953ad37
# TODO Currently it's a bit of a hack, since the container actually holds
# messages (message id, sequence number, request body), not requests.
# Probably create a proper "Messag... | mit | Python |
68738a46d0cea8a46502f487af7d78533b0d771d | define __unicode__ for models | ZebraHat/AgoraD-MarketplaceUI,ZebraHat/AgoraD-MarketplaceUI | marketplace/models.py | marketplace/models.py | #-------------------------------------------------------------------------------
# Name: models
# Purpose: defines models for the system
# Usage: from models import *
#
# Author: Lumate, LLC
#
# Created: 10/25/2013
# Copyright: (c) Lumate, LLC
# Licence: Public/Private
#-----------------... | #-------------------------------------------------------------------------------
# Name: models
# Purpose: defines models for the system
# Usage: from models import *
#
# Author: Lumate, LLC
#
# Created: 10/25/2013
# Copyright: (c) Lumate, LLC
# Licence: Public/Private
#-----------------... | lgpl-2.1 | Python |
cab0687f30ccac731497a5c723ba4fb6baa60435 | Reorder import list. | styner9/korail2,styner9/korail2,littmus/korail2,littmus/korail2 | korail2/__init__.py | korail2/__init__.py | # -*- coding: utf-8 -*-
"""
korail2
~~~~~~~
Korail (www.letskorail.com) wrapper for Python.
:copyright: (c) 2014 by Taehoon Kim.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
from .korail2 import Korail, Passenger, AdultPassenger, ChildPassenger, SeniorPas... | # -*- coding: utf-8 -*-
"""
korail2
~~~~~~~
Korail (www.letskorail.com) wrapper for Python.
:copyright: (c) 2014 by Taehoon Kim.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
from .korail2 import Korail, AdultPassenger, Passenger, ChildPassenger, SeniorPas... | bsd-3-clause | Python |
f9ca473abf7aea3cc146badf2d45ae715f635aac | Use correct parameter for HOST and PORT | atengler/kqueen-ui,atengler/kqueen-ui,atengler/kqueen-ui,atengler/kqueen-ui | kqueen_ui/server.py | kqueen_ui/server.py | from .config import current_config
from flask import Flask
from flask import redirect
from flask import url_for
from flask.ext.babel import Babel
from kqueen_ui.blueprints.registration.views import registration
from kqueen_ui.blueprints.ui.views import ui
from werkzeug.contrib.cache import SimpleCache
import logging
... | from .config import current_config
from flask import Flask
from flask import redirect
from flask import url_for
from flask.ext.babel import Babel
from kqueen_ui.blueprints.registration.views import registration
from kqueen_ui.blueprints.ui.views import ui
from werkzeug.contrib.cache import SimpleCache
import logging
... | mit | Python |
66522b64f61da31e35cafbfbb16fd0c176c1dbf9 | Add test for registering multiple methods | proxama/zorp | zorp/tests/registry.py | zorp/tests/registry.py | """
Registry tests
"""
import unittest
from registry import Registry, schema_from_function
class TestRegistry(unittest.TestCase):
"""
Test the registry
"""
def setUp(self):
"""
Create a new registry
"""
self.registry = Registry()
self.name = "my func"
... | """
Registry tests
"""
import unittest
from registry import Registry, schema_from_function
class TestRegistry(unittest.TestCase):
"""
Test the registry
"""
def setUp(self):
"""
Create a new registry
"""
self.registry = Registry()
self.name = "my func"
... | mit | Python |
329586768bc1f502f1e4cd7c41a9e956aa73aeaf | Make PEP8 happy | VirusTotal/misp-modules,MISP/misp-modules,Rafiot/misp-modules,VirusTotal/misp-modules,MISP/misp-modules,Rafiot/misp-modules,MISP/misp-modules,amuehlem/misp-modules,VirusTotal/misp-modules,amuehlem/misp-modules,amuehlem/misp-modules,Rafiot/misp-modules | misp_modules/modules/import_mod/stiximport.py | misp_modules/modules/import_mod/stiximport.py | import json
import base64
from pymisp.tools import stix
misperrors = {'error': 'Error'}
userConfig = {}
inputSource = ['file']
moduleinfo = {'version': '0.2', 'author': 'Hannah Ward',
'description': 'Import some stix stuff',
'module-type': ['import']}
moduleconfig = []
def handler(q=Fa... | import json
import base64
from pymisp.tools import stix
misperrors = {'error': 'Error'}
userConfig = {}
inputSource = ['file']
moduleinfo = {'version': '0.2', 'author': 'Hannah Ward',
'description': 'Import some stix stuff',
'module-type': ['import']}
moduleconfig = []
def handler(q=Fa... | agpl-3.0 | Python |
de962f504db139500573457264a3dd1e257e8cc0 | Allow decorator to be called with optional args | fatboystring/Wagtail-MVC,fatboystring/Wagtail-MVC | wagtail_mvc/decorators.py | wagtail_mvc/decorators.py | # -*- coding: utf-8 -*-
"""
wagtail_mvc decorators
"""
from __future__ import unicode_literals
def wagtail_mvc_url(*decorator_args, **decorator_kwargs):
"""
Decorates an existing method responsible for generating a url
prepends the parent url to the generated url to account for
:param func: The metho... | # -*- coding: utf-8 -*-
"""
wagtail_mvc decorators
"""
from __future__ import unicode_literals
def wagtail_mvc_url(func):
"""
Decorates an existing method responsible for generating a url
prepends the parent url to the generated url to account for
:param func: The method to decorate
:return: Full... | mit | Python |
a67b97d1ae3917fb228c0576fb30c8098f5443c6 | make random return PageInfos instead of PageIdentifiers | mahmoud/wapiti | wapiti/operations/rand.py | wapiti/operations/rand.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from base import QueryOperation, QueryLimit
from params import StaticParam
from models import PageInfo
from utils import OperationExample
class GetRandom(QueryOperation):
"""
Fetch random pages using MediaWiki's Special:Random.
"""
field... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from base import QueryOperation, QueryLimit
from params import StaticParam
from models import PageIdentifier
from utils import OperationExample
class GetRandom(QueryOperation):
"""
Fetch random pages using MediaWiki's Special:Random.
"""
... | bsd-3-clause | Python |
b549bc3e46d309efa31a65160f7091c4869f34d2 | Enable debug | ul-fmf/projekt-tomo,matijapretnar/projekt-tomo,ul-fmf/projekt-tomo,ul-fmf/projekt-tomo,ul-fmf/projekt-tomo,matijapretnar/projekt-tomo,matijapretnar/projekt-tomo,matijapretnar/projekt-tomo,ul-fmf/projekt-tomo,ul-fmf/projekt-tomo,matijapretnar/projekt-tomo | web/web/settings/arnes.py | web/web/settings/arnes.py | from common import *
SECRET_KEY = os.environ['SECRET_KEY']
DEBUG = True
TEMPLATE_DEBUG = False
ALLOWED_HOSTS = ['www.projekt-tomo.si']
WSGI_APPLICATION = 'web.wsgi.dev.application'
INSTALLED_APPS += (
'shibboleth',
)
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
... | from common import *
SECRET_KEY = os.environ['SECRET_KEY']
DEBUG = False
TEMPLATE_DEBUG = False
ALLOWED_HOSTS = ['www.projekt-tomo.si']
WSGI_APPLICATION = 'web.wsgi.dev.application'
INSTALLED_APPS += (
'shibboleth',
)
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
... | agpl-3.0 | Python |
232bc2bb83190482c1125ca5879ffb6f11d67b40 | Fix logging for testing environment | dlareau/puzzlehunt_server,dlareau/puzzlehunt_server,dlareau/puzzlehunt_server,dlareau/puzzlehunt_server | puzzlehunt_server/settings/travis_settings.py | puzzlehunt_server/settings/travis_settings.py | from .base_settings import *
import os
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
SECRET_KEY = '$1B&VUf$OdUEfMJXd40qdakA36@%2NE_41Dz9tFs6l=z4v_3P-'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'puzzlehunt_db',
'HOST': '127.0.... | from .base_settings import *
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
SECRET_KEY = '$1B&VUf$OdUEfMJXd40qdakA36@%2NE_41Dz9tFs6l=z4v_3P-'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'puzzlehunt_db',
'HOST': '127.0.0.1',
... | mit | Python |
cc911a308e70637b491943d8d4ff3531f30b0880 | Set beta_features to True. | rowhit/h2o-2,vbelakov/h2o,100star/h2o,eg-zhang/h2o-2,elkingtonmcb/h2o-2,elkingtonmcb/h2o-2,calvingit21/h2o-2,111t8e/h2o-2,h2oai/h2o,111t8e/h2o-2,100star/h2o,100star/h2o,h2oai/h2o-2,eg-zhang/h2o-2,calvingit21/h2o-2,h2oai/h2o-2,111t8e/h2o-2,111t8e/h2o-2,eg-zhang/h2o-2,h2oai/h2o-2,h2oai/h2o,h2oai/h2o-2,111t8e/h2o-2,vbelak... | py/testdir_single_jvm/rf_VA_simple_example.py | py/testdir_single_jvm/rf_VA_simple_example.py | import sys
import json
sys.path.extend(['.','..','py'])
import h2o, h2o_cmd, h2o_import as h2i
#
# This is intended to be the simplest possible RF example.
# Look at sandbox/commands.log for REST API requests to H2O.
#
print "--------------------------------------------------------------------------------"
print "... | import sys
import json
sys.path.extend(['.','..','py'])
import h2o, h2o_cmd, h2o_import as h2i
#
# This is intended to be the simplest possible RF example.
# Look at sandbox/commands.log for REST API requests to H2O.
#
print "--------------------------------------------------------------------------------"
print "... | apache-2.0 | Python |
dd66c117b938e2a908a915f6da3b1483bf7a9054 | Improve help plugin | woohgit/will,skoczen/will,chillipeper/will,skoczen/will,chillipeper/will,chillipeper/will,woohgit/will,woohgit/will,wontonst/will,wontonst/will,mike-love/will,mike-love/will,wontonst/will,mike-love/will,skoczen/will | will/plugins/help/help.py | will/plugins/help/help.py | from will.plugin import WillPlugin
from will.decorators import respond_to, periodic, hear, randomly, route, rendered_template
class HelpPlugin(WillPlugin):
@respond_to("^help(?: (?P<plugin>.*))?$")
def help(self, message, plugin=None):
"""help: the normal help you're reading."""
# help_data =... | from will.plugin import WillPlugin
from will.decorators import respond_to, periodic, hear, randomly, route, rendered_template
class HelpPlugin(WillPlugin):
@respond_to("^help$")
def help(self, message):
"""help: the normal help you're reading."""
# help_data = self.load("help_files")
... | mit | Python |
6ce5a8d1a2ea881592a264b7597536cddf07a00d | Fix a bug in check_secret | ul-fmf/projekt-tomo,ul-fmf/projekt-tomo,matijapretnar/projekt-tomo,matijapretnar/projekt-tomo,ul-fmf/projekt-tomo,matijapretnar/projekt-tomo,matijapretnar/projekt-tomo,ul-fmf/projekt-tomo,ul-fmf/projekt-tomo,ul-fmf/projekt-tomo,matijapretnar/projekt-tomo | web/problems/models.py | web/problems/models.py | import json
from django.core.exceptions import ValidationError
from django.db import models
def shorten(s, max_length=50):
if len(s) < max_length:
return s
else:
return u'{0}...'.format(s[:50])
def is_json_string_list(s):
try:
val = json.loads(s)
except ValueError:
ra... | import json
from django.core.exceptions import ValidationError
from django.db import models
def shorten(s, max_length=50):
if len(s) < max_length:
return s
else:
return u'{0}...'.format(s[:50])
def is_json_string_list(s):
try:
val = json.loads(s)
except ValueError:
ra... | agpl-3.0 | Python |
ec79afeb0373e0155840bef4dcb84020bcc46542 | Fix bug in read_write_artifact_cache. | tdyas/pants,jessrosenfield/pants,cevaris/pants,wisechengyi/pants,TansyArron/pants,fkorotkov/pants,landism/pants,dturner-tw/pants,pantsbuild/pants,peiyuwang/pants,fkorotkov/pants,pombredanne/pants,manasapte/pants,15Dkatz/pants,manasapte/pants,landism/pants,benjyw/pants,square/pants,scode/pants,jessrosenfield/pants,di0sp... | src/python/twitter/pants/cache/read_write_artifact_cache.py | src/python/twitter/pants/cache/read_write_artifact_cache.py | from twitter.pants.cache.artifact_cache import ArtifactCache
class ReadWriteArtifactCache(ArtifactCache):
"""An artifact cache that delegates to one cache for reading and another for writing.
The name is slightly misleading: all caches are read-write. But I couldn't think
of a better one.
"""
def __init__(... | from twitter.pants.cache.artifact_cache import ArtifactCache
class ReadWriteArtifactCache(ArtifactCache):
"""An artifact cache that delegates to one cache for reading and another for writing.
The name is slightly misleading: all caches are read-write. But I couldn't think
of a better one.
"""
def __init__(... | apache-2.0 | Python |
18d8f09795de8e7315f4f5fc63f0e7caf23bfaa4 | Refactor cleanse_csv_data | HackBrexit/MinistersUnderTheInfluence,HackBrexit/MinistersUnderTheInfluence,HackBrexit/MinistersUnderTheInfluence,HackBrexit/MinistersUnderTheInfluence,HackBrexit/MinistersUnderTheInfluence,HackBrexit/MinistersUnderTheInfluence | src/python/datapreprocessor/datapreprocessor/csvcleanser.py | src/python/datapreprocessor/datapreprocessor/csvcleanser.py | UNWANTED_SPECIAL_CHARS = "".join([
'\xb1', '\xb2'
])
def is_row_empty(row):
return not any(row)
def remove_excess_columns_from_row(row):
return row[:4]
def remove_extra_whitespace_from_row(row):
return [cell.strip() for cell in row]
def remove_special_chars_from_row(row):
return [cell.transl... | UNWANTED_SPECIAL_CHARS = "".join([
'\xb1', '\xb2'
])
def is_row_empty(row):
return not any(row)
def remove_empty_lines(rows):
return [row for row in rows if not is_row_empty(row)]
def remove_excess_columns_from_row(row):
return row[:4]
def remove_empty_columns(rows):
return [remove_excess_co... | mit | Python |
15206298edfd988922654293e1c4cc91cd687044 | Revert [8799]. That wasn't ready for prime-time yet -- thanks, git-svn! | hybrideagle/django,jeezybrick/django,jgoclawski/django,craynot/django,taaviteska/django,barbuza/django,gohin/django,YangSongzhou/django,gchp/django,sadaf2605/django,tragiclifestories/django,henryfjordan/django,akaihola/django,andela-ooladayo/django,akaariai/django,helenst/django,alexallah/django,MarcJoan/django,jenalgi... | tests/regressiontests/datatypes/models.py | tests/regressiontests/datatypes/models.py | """
This is a basic model to test saving and loading boolean and date-related
types, which in the past were problematic for some database backends.
"""
from django.db import models
from django.conf import settings
class Donut(models.Model):
name = models.CharField(max_length=100)
is_frosted = models.BooleanFi... | """
This is a basic model to test saving and loading boolean and date-related
types, which in the past were problematic for some database backends.
"""
from django.db import models
from django.conf import settings
class Donut(models.Model):
name = models.CharField(max_length=100)
is_frosted = models.BooleanFi... | bsd-3-clause | Python |
4fe2a35492715027f29c0aa548015d83495fa3ca | Fix unit tests | nerdzeu/NERDZCrush,nerdzeu/NERDZCrush,nerdzeu/NERDZCrush,roderickm/MediaCrush,roderickm/MediaCrush,MediaCrush/MediaCrush,roderickm/MediaCrush,MediaCrush/MediaCrush | mediacrush/network.py | mediacrush/network.py | import json
from flask import request, current_app, redirect
from flaskext.bcrypt import generate_password_hash
def get_ip():
ip = request.remote_addr
if (ip == '127.0.0.1' or ip == '127.0.0.2') and "X-Real-IP" in request.headers:
ip = request.headers.get("X-Real-IP")
return ip
def makeMask(n):
... | import json
from flask import request, current_app, redirect
from flaskext.bcrypt import generate_password_hash
def get_ip():
ip = request.remote_addr
if ip == '127.0.0.1' or ip == '127.0.0.2' and "X-Real-IP" in request.headers:
ip = request.headers.get("X-Real-IP")
return ip
def makeMask(n):
... | mit | Python |
656aa635667e4a308652635c3ffe24aa65b725d2 | Fix paths | HIIT/deliberation-classifier,HIIT/deliberation-classifier | app/alpha/dqi.py | app/alpha/dqi.py | import collections
import itertools
import numpy
import pickle
## machine learning
from sklearn import svm, grid_search
## handling natural language
from liwc import liwc
_liwc = liwc.LIWC()
import nltk
import nltk.data
lemma = nltk.stem.wordnet.WordNetLemmatizer()
sent_detector = nltk.data.load('tokenizers/punkt/e... | import collections
import itertools
import numpy
import pickle
## machine learning
from sklearn import svm, grid_search
## handling natural language
from liwc import liwc
_liwc = liwc.LIWC()
import nltk
import nltk.data
lemma = nltk.stem.wordnet.WordNetLemmatizer()
sent_detector = nltk.data.load('tokenizers/punkt/e... | mit | Python |
746859067357761e3b6e1d0e21acd26dd7787f94 | raise import error is better for debug | doraemonext/wechat-python-sdk,wechat-python-sdk/wechat-python-sdk | wechat_sdk/__init__.py | wechat_sdk/__init__.py | # -*- coding: utf-8 -*-
from wechat_sdk.core.conf import WechatConf
from wechat_sdk.basic import WechatBasic
from wechat_sdk.ext import WechatExt
__all__ = ['WechatConf', 'WechatBasic', 'WechatExt']
| # -*- coding: utf-8 -*-
__all__ = ['WechatConf', 'WechatBasic', 'WechatExt']
try:
from wechat_sdk.core.conf import WechatConf
from wechat_sdk.basic import WechatBasic
from wechat_sdk.ext import WechatExt
except ImportError:
pass
| bsd-2-clause | Python |
6bfd02fd83da14d045fc01d16783942b14c51825 | fix issue #11 | Zopieux/django-blog-zinnia,jfdsmit/django-blog-zinnia,ghachey/django-blog-zinnia,1844144/django-blog-zinnia,aorzh/django-blog-zinnia,marctc/django-blog-zinnia,dapeng0802/django-blog-zinnia,Maplecroft/django-blog-zinnia,extertioner/django-blog-zinnia,extertioner/django-blog-zinnia,extertioner/django-blog-zinnia,petecumm... | zinnia/ping.py | zinnia/ping.py | """Pings for Zinnia"""
import xmlrpclib
from django.contrib.sites.models import Site
from django.core.urlresolvers import reverse
current_site = Site.objects.get_current()
site = 'http://%s' % current_site.domain
blog_url = ''
blog_feed = ''
class DirectoryPinger(object):
"""Pinger for Directories"""
def _... | """Pings for Zinnia"""
import xmlrpclib
from django.contrib.sites.models import Site
from django.core.urlresolvers import reverse
current_site = Site.objects.get_current()
site = 'http://%s' % current_site.domain
blog_url = ''
blog_feed = ''
class DirectoryPinger(object):
"""Pinger for Directories"""
def _... | bsd-3-clause | Python |
9c1165bebd92fcaa9e5e3d961027e4a86f8e75cd | Update Where_is_the_code.py | AiAiHealthcare/ProjectAiAi | DLCode/Where_is_the_code.py | DLCode/Where_is_the_code.py | """
AiAi.care uses confidential Patient X-Ray data protected by HIPAA.
We we will publish the code on Github Public repo after a code-audit to make sure
no HIPAA / PII information is published accidentally.
In the meantime we are working off of a private repository. Sorry 😔
"""
| """
AiAi.care uses confidential Patient X-Ray data protected by HIPAA.
We we will publish the code on Github Public repo after a code-audit to make sure
no HIPAA / PII information is published accidentally.
In the meantime we are working off of a private repository. Sorry 😔
""""
| agpl-3.0 | Python |
09a677e11c5abd0441181d13306927c3f3fce29b | Add is_failure to add_error | slash-testing/backslash-python,vmalloc/backslash-python | backslash/error_container.py | backslash/error_container.py | from sentinels import NOTHING
class ErrorContainer(object):
def add_error(self, message, exception_type=NOTHING, traceback=NOTHING, timestamp=NOTHING, is_failure=NOTHING):
return self.client.api.call_function('add_error', {self._get_id_key(): self.id,
... | from sentinels import NOTHING
class ErrorContainer(object):
def add_error(self, message, exception_type=NOTHING, traceback=NOTHING, timestamp=NOTHING):
return self.client.api.call_function('add_error', {self._get_id_key(): self.id,
'message': mes... | bsd-3-clause | Python |
3e8df6836f0508fb4c6cd1c4a9f2f39192a01cea | Add Cloud Code tags for API Explorer pilot (#282) | googleapis/python-translate,googleapis/python-translate | samples/snippets/translate_v3_translate_text.py | samples/snippets/translate_v3_translate_text.py | # Copyright 2020 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 2020 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 |
c1d2834c304c8c1194dbc15c89f1c24b56bb24a9 | Fix styling | catapult-project/catapult-csm,sahiljain/catapult,SummerLW/Perf-Insight-Report,vmpstr/trace-viewer,catapult-project/catapult,catapult-project/catapult,benschmaus/catapult,catapult-project/catapult,catapult-project/catapult,danbeam/catapult,catapult-project/catapult-csm,zeptonaut/catapult,modulexcite/catapult,sahiljain/c... | trace_viewer/build/trace2html_unittest.py | trace_viewer/build/trace2html_unittest.py | # Copyright (c) 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import unittest
import tempfile
import os
from trace_viewer.build import trace2html
class Trace2HTMLTests(unittest.TestCase):
def test_writeHTMLForTra... | # Copyright (c) 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import unittest
import tempfile
import os
from trace_viewer.build import trace2html
class Trace2HTMLTests(unittest.TestCase):
def test_writeHTMLForTra... | bsd-3-clause | Python |
e38e18b8ab5ee90a1e5e0e77070ec07260687332 | Add more tests for Malayalam | dmort27/epitran,dmort27/epitran | epitran/test/test_malayalam.py | epitran/test/test_malayalam.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import unittest
import unicodedata
import epitran
class TestMalayalamGeneral(unittest.TestCase):
def setUp(self):
self.epi = epitran.Epitran(u'mal-Mlym')
def _assert_trans(self, src, tar):
trans = self.epi.transliterate(src)
... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import unittest
import unicodedata
import epitran
class TestMalayalamGeneral(unittest.TestCase):
def setUp(self):
self.epi = epitran.Epitran(u'mal-Mlym')
def _assert_trans(self, src, tar):
trans = self.epi.transliterate(src)
... | mit | Python |
fe676a041b793f55d33bfd27eb2b4fdfe7d93bb6 | Change import path for pricing | tysonholub/twilio-python,twilio/twilio-python | twilio/rest/resources/pricing/__init__.py | twilio/rest/resources/pricing/__init__.py | from twilio.rest.pricing.voice import (
Voice,
VoiceCountry,
VoiceCountries,
VoiceNumber,
VoiceNumbers,
)
from twilio.rest.pricing.phone_number import (
PhoneNumberCountries,
PhoneNumberCountry,
PhoneNumber,
)
| from .voice import (
Voice,
VoiceCountry,
VoiceCountries,
VoiceNumber,
VoiceNumbers,
)
from .phone_numbers import (
PhoneNumberCountries,
PhoneNumberCountry,
PhoneNumbers,
)
| mit | Python |
ef3797e8393fcaa03356e73bebb92a7f9d283cd7 | Bump version | thombashi/DataProperty | dataproperty/__version__.py | dataproperty/__version__.py | __author__ = "Tsuyoshi Hombashi"
__copyright__ = f"Copyright 2016, {__author__}"
__license__ = "MIT License"
__version__ = "0.54.0"
__maintainer__ = __author__
__email__ = "tsuyoshi.hombashi@gmail.com"
| __author__ = "Tsuyoshi Hombashi"
__copyright__ = f"Copyright 2016, {__author__}"
__license__ = "MIT License"
__version__ = "0.53.0"
__maintainer__ = __author__
__email__ = "tsuyoshi.hombashi@gmail.com"
| mit | Python |
a248dc23b19b3120fe94f3fcd22943d9230a9833 | Use `label_from_instance` in QuerySetSequenceSelectMixin | yourlabs/django-autocomplete-light,yourlabs/django-autocomplete-light,yourlabs/django-autocomplete-light,yourlabs/django-autocomplete-light | src/dal_queryset_sequence/widgets.py | src/dal_queryset_sequence/widgets.py | """
Widget mixin that only renders selected options with QuerySetSequence.
For details about why this is required, see :mod:`dal.widgets`.
"""
from dal.widgets import WidgetMixin
from django import forms
from django.contrib.contenttypes.models import ContentType
from django.utils.encoding import force_text
class Q... | """
Widget mixin that only renders selected options with QuerySetSequence.
For details about why this is required, see :mod:`dal.widgets`.
"""
from dal.widgets import WidgetMixin
from django import forms
from django.contrib.contenttypes.models import ContentType
from django.utils import six
class QuerySetSequenceS... | mit | Python |
3621ad16160797b843d56af82314cfeb339e6ce1 | Make tasks view able to filter by jobuuid. | artefactual/archivematica-history,artefactual/archivematica-history,artefactual/archivematica-history,artefactual/archivematica-history | src/dashboard/src/dashboard/views.py | src/dashboard/src/dashboard/views.py | from django.conf import settings
from django.core.urlresolvers import reverse
from django.core.paginator import Paginator, InvalidPage, EmptyPage
from django.shortcuts import render_to_response
from django.http import HttpResponse, HttpResponseServerError, HttpResponseRedirect
from dashboard.contrib.mcp.client import ... | from django.conf import settings
from django.core.urlresolvers import reverse
from django.core.paginator import Paginator, InvalidPage, EmptyPage
from django.shortcuts import render_to_response
from django.http import HttpResponse, HttpResponseServerError, HttpResponseRedirect
from dashboard.contrib.mcp.client import ... | agpl-3.0 | Python |
e5061b4d5f1a8fc0c75262931e614f0414eb9502 | Disable failing test | tobi-wan-kenobi/bumblebee-status,tobi-wan-kenobi/bumblebee-status | tests/modules/test_brightness.py | tests/modules/test_brightness.py | # pylint: disable=C0103,C0111
import mock
import unittest
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
try:
FileNotFoundError
except NameError:
FileNotFoundError = IOError
import tests.mocks as mocks
from bumblebee.config import Config
from bumblebee.input import W... | # pylint: disable=C0103,C0111
import mock
import unittest
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
try:
FileNotFoundError
except NameError:
FileNotFoundError = IOError
import tests.mocks as mocks
from bumblebee.config import Config
from bumblebee.input import W... | mit | Python |
71b89ea569e7a6ac84ba5e45cbef2cfcd9679c79 | Make sure send_unknown_user_type_stats is never run in quick succession | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/pillows/tasks.py | corehq/pillows/tasks.py | from datetime import timedelta
from celery.schedules import crontab
from celery.task import periodic_task
from corehq.apps.es import FormES
from corehq.form_processor.interfaces.dbaccessors import FormAccessors
from corehq.form_processor.utils.xform import resave_form
from corehq.pillows.utils import get_user_type_de... | from datetime import timedelta
from celery.schedules import crontab
from celery.task import periodic_task
from corehq.apps.es import FormES
from corehq.form_processor.interfaces.dbaccessors import FormAccessors
from corehq.form_processor.utils.xform import resave_form
from corehq.pillows.utils import get_user_type_de... | bsd-3-clause | Python |
a6d6ff81e8fc8f1c2cd80e8f33ea34e892bb8345 | remove json import | StepicOrg/Stepic-API | examples/oauth_auth_example.py | examples/oauth_auth_example.py | # Run with Python 3
import requests
# 1. Get your keys at https://stepic.org/oauth2/applications/ (client type = confidential,
# authorization grant type = client credentials)
client_id = "..."
client_secret = "..."
# 2. Get a token
auth = requests.auth.HTTPBasicAuth(client_id, client_secret)
resp = requests.post('ht... | # Run with Python 3
import json
import requests
# 1. Get your keys at https://stepic.org/oauth2/applications/ (client type = confidential,
# authorization grant type = client credentials)
client_id = "..."
client_secret = "..."
# 2. Get a token
auth = requests.auth.HTTPBasicAuth(client_id, client_secret)
resp = reque... | mit | Python |
1dbc0ba0ab6b33d855e7ad455d115a43ead9dfa2 | Fix test_servlet_newrequest | bis12/pushmanager,bchess/pushmanager,Yelp/pushmanager,bis12/pushmanager,imbstack/pushmanager,Yelp/pushmanager,Yelp/pushmanager,bis12/pushmanager,imbstack/pushmanager,asottile/pushmanager,asottile/pushmanager,YelpArchive/pushmanager,imbstack/pushmanager,bchess/pushmanager,Yelp/pushmanager,asottile/pushmanager,bchess/pus... | tests/test_servlet_newrequest.py | tests/test_servlet_newrequest.py | from contextlib import nested
import mock
import urllib
from core import db
from core.util import get_servlet_urlspec
from servlets.newrequest import NewRequestServlet
import testing as T
class NewRequestServletTest(T.TestCase, T.ServletTestMixin, T.FakeDataMixin):
def get_handlers(self):
return [get_ser... | from contextlib import nested
import mock
import urllib
from core import db
from core.util import get_servlet_urlspec
from servlets.newrequest import NewRequestServlet
import testing as T
class NewRequestServletTest(T.TestCase, T.ServletTestMixin):
def get_handlers(self):
return [get_servlet_urlspec(NewR... | apache-2.0 | Python |
1342ff4a6d95bea5b0396a3765a406a0504fc72c | Add test for get_receive_message() (#53) | silver-castle/mach9 | tests/test_websocket_protocol.py | tests/test_websocket_protocol.py | from mach9.http import HttpProtocol
from mach9.websocket import WebSocketProtocol
from tests.utils import Transport
def test_accept_content():
http_protocol = HttpProtocol(loop=None, request_handler=None)
headers = [[b'foo', b'bar']]
websocket_protocol = WebSocketProtocol(http_protocol, headers)
conte... | from mach9.http import HttpProtocol
from mach9.websocket import WebSocketProtocol
from tests.utils import Transport
def test_accept_content():
http_protocol = HttpProtocol(loop=None, request_handler=None)
headers = [[b'foo', b'bar']]
websocket_protocol = WebSocketProtocol(http_protocol, headers)
conte... | mit | Python |
232ffb4ab0c2bc41b1dc31ffc04ebc0477897088 | Fix ssh_demo example | Fizzadar/pyinfra,Fizzadar/pyinfra | examples/ssh_demo/ssh_demo1.py | examples/ssh_demo/ssh_demo1.py | from pyinfra import config, host, inventory
from pyinfra.facts.hardware import Ipv4Addresses
from pyinfra.operations import files, server
config.SUDO = True
# update the /etc/hosts file
def update_hosts_file(name, ip):
name = name.replace("@vagrant/", "")
files.line(
name="Add hosts to /etc/hosts",
... | from pyinfra import config, host, inventory
from pyinfra.operations import files, server
config.SUDO = True
# update the /etc/hosts file
def update_hosts_file(name, ip):
name = name.replace("@vagrant/", "")
files.line(
name="Add hosts to /etc/hosts",
path="/etc/hosts",
line=r" {}.exam... | mit | Python |
9704f43d2245f53ed5315a62db3eabb40aa3dad8 | use name method for querying | uw-it-aca/canvas-sis-provisioner,uw-it-aca/canvas-sis-provisioner,uw-it-aca/canvas-sis-provisioner,uw-it-aca/canvas-sis-provisioner | sis_provisioner/management/commands/__init__.py | sis_provisioner/management/commands/__init__.py | from django.core.management.base import BaseCommand, CommandError
from django.utils.timezone import utc
from sis_provisioner.models import Job
import datetime
import sys
class SISProvisionerCommand(BaseCommand):
def __init__(self, *args, **kwargs):
super(SISProvisionerCommand, self).__init__(*args, **kwar... | from django.core.management.base import BaseCommand, CommandError
from django.utils.timezone import utc
from sis_provisioner.models import Job
import datetime
import sys
class SISProvisionerCommand(BaseCommand):
def __init__(self, *args, **kwargs):
super(SISProvisionerCommand, self).__init__(*args, **kwar... | apache-2.0 | Python |
ffc86b7fd5ef152d5a00bbdfcab7b69cb26be180 | Update all drivers except XENIFACE | xenserver/win-installer,OwenSmith/win-installer,OwenSmith/win-installer,OwenSmith/win-installer,OwenSmith/win-installer,xenserver/win-installer,xenserver/win-installer,OwenSmith/win-installer,xenserver/win-installer,xenserver/win-installer | manifestspecific.py | manifestspecific.py | # Copyright (c) Citrix Systems 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 list of conditions a... | # Copyright (c) Citrix Systems 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 list of conditions a... | bsd-2-clause | Python |
f1e700461340884aa6af99abbbc9f352be66df4c | Handle more recent modifications than retraction | acshi/osf.io,HalcyonChimera/osf.io,aaxelb/osf.io,alexschiller/osf.io,felliott/osf.io,erinspace/osf.io,caneruguz/osf.io,adlius/osf.io,felliott/osf.io,alexschiller/osf.io,chrisseto/osf.io,rdhyee/osf.io,leb2dg/osf.io,chennan47/osf.io,mluo613/osf.io,cwisecarver/osf.io,sloria/osf.io,leb2dg/osf.io,Johnetordoff/osf.io,cwiseca... | scripts/migration/migrate_retraction_dates.py | scripts/migration/migrate_retraction_dates.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Script to migrate retracted registrations so that their date modified is date of retraction."""
import sys
import logging
from modularodm import Q
from website.models import Node, NodeLog
from website.app import init_app
from scripts import utils as script_utils
from f... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Script to migrate retracted registrations so that their date modified is date of retraction."""
import sys
import logging
from modularodm import Q
from website.models import Node, NodeLog
from website.app import init_app
from scripts import utils as script_utils
from f... | apache-2.0 | Python |
c303813602585f2653ffcaac2df0866e5a91f1a7 | declare 'coda' as external_dependencies | Noviat/l10n-belgium,acsone/l10n-belgium,Niboo/l10n-belgium,Niboo/l10n-belgium,Noviat/l10n-belgium,QANSEE/l10n-belgium,akretion/l10n-belgium,yvaucher/l10n-belgium,QANSEE/l10n-belgium,acsone/l10n-belgium,akretion/l10n-belgium | account_statement_coda_import/__openerp__.py | account_statement_coda_import/__openerp__.py | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Laurent Mignon
# Copyright 2014 'ACSONE SA/NV'
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# pub... | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Laurent Mignon
# Copyright 2014 'ACSONE SA/NV'
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# pub... | agpl-3.0 | Python |
3b1c6549c6f2430a61727fa8fb148632e654ddbc | fix b2g urls to force trailing slash | petabyte/bedrock,Sancus/bedrock,chirilo/bedrock,Sancus/bedrock,TheJJ100100/bedrock,andreadelrio/bedrock,mkmelin/bedrock,davehunt/bedrock,mozilla/mwc,malena/bedrock,mozilla/bedrock,glogiotatidis/bedrock,ericawright/bedrock,davidwboswell/documentation_autoresponse,elin-moco/bedrock,dudepare/bedrock,alexgibson/bedrock,kyo... | apps/b2g/urls.py | apps/b2g/urls.py | from django.conf.urls.defaults import *
from views import b2g, about, faq
urlpatterns = patterns('',
(r'^b2g/faq/$', faq),
(r'^b2g/about/$', about),
(r'^b2g/$', b2g),
)
| from django.conf.urls.defaults import *
from views import b2g, about, faq
urlpatterns = patterns('',
(r'^b2g/faq/', faq),
(r'^b2g/about/', about),
(r'^b2g/', b2g),
)
| mpl-2.0 | Python |
76fb477ddbbd944c1d228dd6b5a6147ca3e02362 | Remove log translations | openstack/python-mistralclient,openstack/python-mistralclient,StackStorm/python-mistralclient,StackStorm/python-mistralclient | mistralclient/i18n.py | mistralclient/i18n.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | apache-2.0 | Python |
518959b8eb5a7b6ce380535e9b791c2c1668b592 | Fix flake8 error: unused import | pjbriggs/tools-iuc,davebx/tools-iuc,pjbriggs/tools-iuc,davebx/tools-iuc,Delphine-L/tools-iuc,pavanvidem/tools-iuc,blankenberg/tools-iuc,mvdbeek/tools-iuc,jj-umn/tools-iuc,nekrut/tools-iuc,abretaud/tools-iuc,pavanvidem/tools-iuc,loraine-gueguen/tools-iuc,davebx/tools-iuc,nekrut/tools-iuc,nsoranzo/tools-iuc,loraine-guegu... | tools/spaln/list_spaln_tables.py | tools/spaln/list_spaln_tables.py | #!/usr/bin/env python3
import argparse
import shlex
from subprocess import run
import sys
from typing import TextIO
def find_common_ancestor_distance(
taxon: str, other_taxon: str, taxonomy_db_path: str, only_canonical: bool
):
canonical = "--only_canonical" if only_canonical else ""
cmd_str = f"taxonomy... | #!/usr/bin/env python3
import argparse
from io import StringIO
import shlex
from subprocess import run
import sys
from typing import TextIO
def find_common_ancestor_distance(taxon: str, other_taxon: str, taxonomy_db_path: str, only_canonical: bool):
canonical = '--only_canonical' if only_canonical else ''
cmd... | mit | Python |
b03ad153dce2fd026b632907aff8fc82fd3df407 | Update __init__.py | ddsc/ddsc-worker | ddsc_worker/__init__.py | ddsc_worker/__init__.py | # (c) Fugro Geoservices. MIT licensed, see LICENSE.rst.
# package
| # package
| mit | Python |
8e7c29f7425c5844c9fb1c3ea7f6a9984c18ed9c | fix typo | BjoernT/rpc-openstack,major/rpc-openstack,byronmccollum/rpc-openstack,claco/rpc-openstack,galstrom21/rpc-openstack,byronmccollum/rpc-openstack,darrenchan/rpc-openstack,sigmavirus24/rpc-openstack,cloudnull/rpc-openstack,nrb/rpc-openstack,rcbops/rpc-openstack,rcbops/rpc-openstack,npawelek/rpc-maas,busterswt/rpc-openstack... | memcached_status.py | memcached_status.py | #!/usr/bin/env python
import re
import argparse
import memcache
from ipaddr import IPv4Address
from maas_common import status_ok, status_err, metric, metric_bool
VERSION_RE = re.compile('STAT version (\d+\.\d+\.\d+)(?![-+0-9\\.])')
VERSION = '1.4.14 (Ubuntu)'
MEMCACHE_METRICS = ['total_items',
'... | #!/usr/bin/env python
import re
import argparse
import memcache
from ipaddr import IPv4Address
from maas_common import status_ok, status_err, metric, metric_bool
VERSION_RE = re.compile('STAT version (\d+\.\d+\.\d+)(?![-+0-9\\.])')
VERSION = '1.4.14 (Ubuntu)'
MEMCACHE_METRICS = ['total_items',
'... | apache-2.0 | Python |
5c23b60dc32a69e96a491fd38960109a5be787ad | speed up test | jclgoodwin/bustimes.org.uk,jclgoodwin/bustimes.org.uk,jclgoodwin/bustimes.org.uk,jclgoodwin/bustimes.org.uk | vehicles/management/tests/test_bod_avl.py | vehicles/management/tests/test_bod_avl.py | import os
from datetime import timedelta
from mock import patch
from freezegun import freeze_time
from vcr import use_cassette
from django.conf import settings
from django.test import TestCase
from busstops.models import Region, DataSource, Operator
from ...models import VehicleLocation, VehicleJourney, Vehicle
from ..... | import os
from vcr import use_cassette
from django.conf import settings
from django.test import TestCase
from busstops.models import Region, DataSource, Operator
from ...models import VehicleLocation
from ..commands import import_bod_avl
class BusOpenDataVehicleLocationsTest(TestCase):
@classmethod
def setUpT... | mpl-2.0 | Python |
cefee133a960124542de906cfb408dd9e6cf0aca | Make indentation consistently spaces in __init.py__ | mtearle/npyscreenreactor | npyscreenreactor/__init__.py | npyscreenreactor/__init__.py | #!/usr/bin/env python
# npyscreenreactory.py
# Inspired by pausingreactor.py and xmmsreactor.py
# npyscreen modifications
# Copyright (c) 2015 Mark Tearle <mark@tearle.com>
# See LICENSE for details.
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
"""
This module provides npyscreen event loop support for Tw... | #!/usr/bin/env python
# npyscreenreactory.py
# Inspired by pausingreactor.py and xmmsreactor.py
# npyscreen modifications
# Copyright (c) 2015 Mark Tearle <mark@tearle.com>
# See LICENSE for details.
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
"""
This module provides npyscreen event loop support for Tw... | mit | Python |
2a9b440d4125b87b19b26b2d5118f8c7e5b54c1f | Add WriteHTMLForTraceDataToFile method that allow create trace viewer in html directly from trace data | catapult-project/catapult-csm,benschmaus/catapult,modulexcite/catapult,sahiljain/catapult,danbeam/catapult,dstockwell/catapult,SummerLW/Perf-Insight-Report,catapult-project/catapult-csm,dstockwell/catapult,catapult-project/catapult,zeptonaut/catapult,danbeam/catapult,scottmcmaster/catapult,benschmaus/catapult,catapult-... | trace_viewer/build/trace2html.py | trace_viewer/build/trace2html.py | # Copyright (c) 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import base64
import gzip
import json
import optparse
import shutil
import os
import StringIO
import sys
import tempfile
from trace_viewer import trace_... | # Copyright (c) 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import base64
import gzip
import optparse
import shutil
import os
import StringIO
import sys
import tempfile
from trace_viewer import trace_viewer_proje... | bsd-3-clause | Python |
69cb9f4a1eae09f76875a9483e13a7f221339d85 | rename metric | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/couch_sql_migration/tasks.py | corehq/apps/couch_sql_migration/tasks.py | from __future__ import absolute_import
from __future__ import unicode_literals
from celery.schedules import crontab
from celery.task import periodic_task
from corehq.apps.es import DomainES, filters, aggregations
from corehq.util.datadog.gauges import datadog_gauge
@periodic_task('background_queue', run_every=cront... | from __future__ import absolute_import
from __future__ import unicode_literals
from celery.schedules import crontab
from celery.task import periodic_task
from corehq.apps.es import DomainES, filters, aggregations
from corehq.util.datadog.gauges import datadog_gauge
@periodic_task('background_queue', run_every=cront... | bsd-3-clause | Python |
d98f97e00e12eb7ba9a2cd1c2b9ae11ed47b91af | Add domain or and ilike | juancr83/DockerOpenacademy-proyect | openacademy/models/models.py | openacademy/models/models.py | # -*- coding: utf-8 -*-
from openerp import models, fields, api
class Course(models.Model):
_name = 'course'
name = fields.Char(string='Title', required=True)
description = fields.Text(string='Descripcion')
responsible = fields.Many2one('res.users',
ondelete='set null',
string="Responsible", ... | # -*- coding: utf-8 -*-
from openerp import models, fields, api
class Course(models.Model):
_name = 'course'
name = fields.Char(string='Title', required=True)
description = fields.Text(string='Descripcion')
responsible = fields.Many2one('res.users',
ondelete='set null',
string="Responsible", ... | apache-2.0 | Python |
3e353d54ffebbcae3afbd02c89cbc33ec4a6eec2 | update tests to match change in decorators | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/sso/tests/test_decorators.py | corehq/apps/sso/tests/test_decorators.py | from unittest import mock
from django.test import TestCase, RequestFactory
from corehq.apps.sso.decorators import (
identity_provider_required,
use_saml2_auth,
)
from corehq.apps.sso.tests import generator
class TestDecorators(TestCase):
@classmethod
def setUpClass(cls):
super().setUpClass(... | from unittest import mock
from django.test import TestCase, RequestFactory
from corehq.apps.sso.decorators import (
identity_provider_required,
use_saml2_auth,
)
from corehq.apps.sso.tests import generator
class TestDecorators(TestCase):
@classmethod
def setUpClass(cls):
super().setUpClass(... | bsd-3-clause | Python |
0e779581be648ca80eea6b97f9963606d85659b9 | Add exporter to VisualSfM format | BrookRoberts/OpenSfM,mapillary/OpenSfM,sunbingfengPI/OpenSFM_Test,BrookRoberts/OpenSfM,sunbingfengPI/OpenSFM_Test,sunbingfengPI/OpenSFM_Test,sunbingfengPI/OpenSFM_Test,oscarlorentzon/OpenSfM,BrookRoberts/OpenSfM,oscarlorentzon/OpenSfM,oscarlorentzon/OpenSfM,oscarlorentzon/OpenSfM,mapillary/OpenSfM,mapillary/OpenSfM,Bro... | opensfm/commands/__init__.py | opensfm/commands/__init__.py |
import extract_metadata
import detect_features
import match_features
import create_tracks
import reconstruct
import mesh
import undistort
import compute_depthmaps
import export_ply
import export_openmvs
import export_visualsfm
opensfm_commands = [
extract_metadata,
detect_features,
match_features,
cre... |
import extract_metadata
import detect_features
import match_features
import create_tracks
import reconstruct
import mesh
import undistort
import compute_depthmaps
import export_ply
import export_openmvs
opensfm_commands = [
extract_metadata,
detect_features,
match_features,
create_tracks,
reconstr... | bsd-2-clause | Python |
52f21a4f3a61497099fc6483bde00d60307297c7 | Fix formatting | mattdavis90/base10,mattdavis90/base10 | base10/transports/udp_transport.py | base10/transports/udp_transport.py | import sys
from socket import socket, AF_INET, SOCK_DGRAM
from base10.base import Writer
from base10.exceptions import TransportError
PY3 = sys.version_info.major == 3
class UDPWriter(Writer):
def __init__(self, host, port):
self._host = host
self._port = port
self._socket = socket(AF_I... | import sys
from socket import socket, AF_INET, SOCK_DGRAM
from base10.base import Writer
from base10.exceptions import TransportError
PY3 = sys.version_info.major == 3
class UDPWriter(Writer):
def __init__(self, host, port):
self._host = host
self._port = port
self._socket = socket(AF_... | mit | Python |
416575ca3cc684925be0391b43b98a9fa1d9f909 | Save the image of the selection (to be able to reinitialise later) | baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite | ObjectTracking/testTrack.py | ObjectTracking/testTrack.py |
from SimpleCV import ColorSegmentation, Image, Camera, VirtualCamera, Display, Color
# Open reference video
cam=VirtualCamera('/media/bat/DATA/Baptiste/Nautilab/kite_project/zenith-wind-power-read-only/KiteControl-Qt/videos/kiteFlying.avi','video')
# Select reference image
img=cam.getFrame(50)
modelImage = img.crop(2... |
from SimpleCV import ColorSegmentation, Image, Camera, VirtualCamera, Display
# Open reference video
cam=VirtualCamera('/media/bat/DATA/Baptiste/Nautilab/kite_project/zenith-wind-power-read-only/KiteControl-Qt/videos/kiteFlying.avi','video')
# Select reference image
img=cam.getFrame(50)
modelImage = img.crop(255, 180... | mit | Python |
1ad9130ed788fcc0d7aadef3365082ce2fa2c78c | Remove modifying sys.path in package __init__ | farzadghanei/distutilazy | distutilazy/__init__.py | distutilazy/__init__.py | """
distutilazy
-----------
Extra distutils command classes.
:license: MIT, see LICENSE for more details.
"""
__version__ = "0.4.0"
__all__ = ("clean", "pyinstaller", "command")
| """
distutilazy
-----------
Extra distutils command classes.
:license: MIT, see LICENSE for more details.
"""
from os.path import dirname, abspath
import sys
__version__ = "0.4.0"
__all__ = ("clean", "pyinstaller", "command")
base_dir = abspath(dirname(dirname(__file__)))
if base_dir not in sys.path:
if len(sy... | mit | Python |
a0ac251bec891a6c511ea1c0b11faa6525b81545 | Support more C++ extensions by default | jimporter/bfg9000,jimporter/bfg9000,jimporter/bfg9000,jimporter/bfg9000 | bfg9000/languages.py | bfg9000/languages.py | ext2lang = {
'.c' : 'c',
'.cpp': 'c++',
'.cc' : 'c++',
'.cp' : 'c++',
'.cxx': 'c++',
'.CPP': 'c++',
'.c++': 'c++',
'.C' : 'c++',
}
| ext2lang = {
'.cpp': 'c++',
'.c': 'c',
}
| bsd-3-clause | Python |
3c7714e22304b6bbdefccc87d4ab3f449c233f44 | change indicator type | demisto/content,VirusTotal/content,demisto/content,demisto/content,VirusTotal/content,VirusTotal/content,demisto/content,VirusTotal/content | Packs/FeedSpamhaus/Integrations/FeedSpamhaus/FeedSpamhaus.py | Packs/FeedSpamhaus/Integrations/FeedSpamhaus/FeedSpamhaus.py | from CommonServerPython import *
def main():
params = {k: v for k, v in demisto.params().items() if v is not None}
feed_url_to_config = {
# TODO: Add this sub feed once we have an indicator type of ASN
'https://www.spamhaus.org/drop/asndrop.txt': {
'indicator_type': 'ASN',
... | from CommonServerPython import *
def main():
params = {k: v for k, v in demisto.params().items() if v is not None}
feed_url_to_config = {
# TODO: Add this sub feed once we have an indicator type of ASN
'https://www.spamhaus.org/drop/asndrop.txt': {
'indicator_type': 'ASN',
... | mit | Python |
ca4e7393c4d9ddd50e14dd06da10d8389b018670 | Update ImpNotes.py | prashantas/MyDataScience | DeepNetwork/ImpNotes.py | DeepNetwork/ImpNotes.py | #### https://www.youtube.com/watch?v=yX8KuPZCAMo # Very Good Link from Edureka for tensorflow basics Really Good
# A placeholder is nothing but a promise to provide the value later
a = tf.placeholder(tf.float32)
b = tf.placeholder(tf.float32)
adder_node = a+b
sess = tf.Session()
print(sess.run(adder_node... | #### https://www.youtube.com/watch?v=yX8KuPZCAMo # Very Good Link from Edureka for tensorflow basics Really Good
# A placeholder is nothing but a promise to provide the value later
a = tf.placeholder(tf.float32)
b = tf.placeholder(tf.float32)
adder_node = a+b
sess = tf.Session()
print(sess.run(adder_node... | bsd-2-clause | Python |
22281b85427fbee77fd2dcde1f0480bf6cf43ea0 | Add south_triple_field | python-force/django-bleach | django_bleach/models.py | django_bleach/models.py | from django.db import models
from django_bleach import forms
from django_bleach.utils import get_bleach_default_options
from django_bleach.forms import default_widget
class BleachField(models.TextField):
def __init__(self, allowed_tags=None, allowed_styles=None, allowed_attributes=None, strip_tags=None, strip_... | from django.db import models
from django_bleach import forms
from django_bleach.utils import get_bleach_default_options
from django_bleach.forms import default_widget
class BleachField(models.TextField):
def __init__(self, allowed_tags=None, allowed_styles=None, allowed_attributes=None, strip_tags=None, strip_... | bsd-2-clause | Python |
9d9e32693f9bb1f707b38dcee49a18374b7a2067 | Update __init__.py | DMOJ/judge,DMOJ/judge,DMOJ/judge | dmoj/cptbox/__init__.py | dmoj/cptbox/__init__.py | from collections import defaultdict
from dmoj.cptbox.sandbox import SecurePopen, PIPE
from dmoj.cptbox.handlers import DISALLOW, ALLOW
from dmoj.cptbox.chroot import CHROOTSecurity
from dmoj.cptbox.syscalls import SYSCALL_COUNT
if sys.version_info.major == 3:
xrange = range
class NullSecurity(defaultdict):
d... | from collections import defaultdict
from dmoj.cptbox.sandbox import SecurePopen, PIPE
from dmoj.cptbox.handlers import DISALLOW, ALLOW
from dmoj.cptbox.chroot import CHROOTSecurity
from dmoj.cptbox.syscalls import SYSCALL_COUNT
if sys.version_info.major == 2:
range = xrange
class NullSecurity(defaultdict):
d... | agpl-3.0 | Python |
a41a76b7e4cdf4a8cbc533550963921839dcd998 | Fix formatting errors reported by flake8. | rectalogic/mopidy-pandora,jcass77/mopidy-pandora | mopidy_pandora/rpc.py | mopidy_pandora/rpc.py | import json
import requests
class RPCClient(object):
def __init__(self, hostname, port):
self.url = 'http://' + str(hostname) + ':' + str(port) + '/mopidy/rpc'
self.id = 0
def _do_rpc(self, method, params=None):
self.id += 1
data = {'method': method, 'jsonrpc': '2.0', 'id':... | import json
import requests
class RPCClient(object):
def __init__(self, hostname, port):
self.url = 'http://' + str(hostname) + ':' + str(port) + '/mopidy/rpc'
self.id = 0
def _do_rpc(self, method, params=None):
self.id += 1
data = { 'method': method, 'jsonrpc': '2.0', 'id'... | apache-2.0 | Python |
e17f8f4abbe6fbde638b4bb14db5cf1c7d3bd47f | Update setup.py | hMatoba/tetsujin,hMatoba/tetsujin,hMatoba/tetsujin,hMatoba/tetsujin,hMatoba/tetsujin | browsertest/setup.py | browsertest/setup.py | from setuptools import setup
import sys
sys.path.append('./tests')
setup(name='browsertest',
version='1.0',
description='test a project on browser',
test_suite = 's_test.suite',
install_requires=[
'selenium',
],
)
| from setuptools import setup
import sys
sys.path.append('./tests')
setup(name='browsertest',
version='1.0',
description='test a project by browser',
test_suite = 's_test.suite',
install_requires=[
'selenium',
],
) | mit | Python |
3a2338bce37811a1d7fdbcbba6d6b7b0c46edff2 | Fix time-sensitivity (< 0.002 second execution) in output format. | azatoth/scons,azatoth/scons,azatoth/scons,azatoth/scons,azatoth/scons | test/scons-time/func/format-gnuplot.py | test/scons-time/func/format-gnuplot.py | #!/usr/bin/env python
#
# __COPYRIGHT__
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
... | #!/usr/bin/env python
#
# __COPYRIGHT__
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
... | mit | Python |
0788aaf316a2b200c5283fe9f5f902a8da701403 | Add a test for julian_to_gregorian. | jwg4/qual,jwg4/calexicon | calexicon/internal/tests/test_julian.py | calexicon/internal/tests/test_julian.py | import unittest
from calexicon.internal.julian import distant_julian_to_gregorian, julian_to_gregorian
class TestJulian(unittest.TestCase):
def test_distant_julian_to_gregorian(self):
self.assertEqual(distant_julian_to_gregorian(9999, 12, 1), (10000, 2, 12))
def test_julian_to_gregorian(self):
... | import unittest
from calexicon.internal.julian import distant_julian_to_gregorian
class TestJulian(unittest.TestCase):
def test_distant_julian_to_gregorian(self):
self.assertEqual(distant_julian_to_gregorian(9999, 12, 1), (10000, 2, 12))
| apache-2.0 | Python |
e728dc8fdfb0955844626cf0e1b26c294bc512b3 | add detail endpoint | SchrodingersGat/InvenTree,inventree/InvenTree,inventree/InvenTree,inventree/InvenTree,SchrodingersGat/InvenTree,SchrodingersGat/InvenTree,inventree/InvenTree,SchrodingersGat/InvenTree | InvenTree/plugin/api.py | InvenTree/plugin/api.py | """
JSON API for the plugin app
"""
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf.urls import url
from django.utils.translation import ugettext_lazy as _
from rest_framework import generics
from plugin.models import PluginConfig
import plugin.serializers as PluginSerializers
cla... | """
JSON API for the plugin app
"""
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf.urls import url
from django.utils.translation import ugettext_lazy as _
from rest_framework import generics
from plugin.models import PluginConfig
import plugin.serializers as PluginSerializers
cla... | mit | Python |
f97fef9125d7fac502720ac6c7222bf7c8101ae4 | Add ultrasonic sensor from Max | westpark/robotics | piwars/sensors/ultrasonic.py | piwars/sensors/ultrasonic.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os, sys
import RPi.GPIO as GPIO
import time
from ..core import config
from ..core import logging
THRESHOLD_MM = 10
THRESHOLD_SECS = 0.1
SPEED_OF_SOUND = 343 * 100 * 10 # mm/s
TOLERANCE_MM = 30
class Sensor(object):
def __init__(self, trigger_pin, echo_p... | # -*- coding: utf-8 -*-
from ..core import config
from ..core import logging
| mit | Python |
7f1542bc52438e6c9796e776603553d7f5a9df7f | Debug in importing deleted module. | tgquintela/pySpatialTools,tgquintela/pySpatialTools | pySpatialTools/utils/util_classes/__init__.py | pySpatialTools/utils/util_classes/__init__.py |
"""
Util classes
------------
Classes which represent data types useful for the package pySpatialTools.
"""
from spdesc_mapper import Sp_DescriptorMapper
from spatialelements import SpatialElementsCollection, Locations
from Membership import Membership
from mapper_vals_i import Map_Vals_i, create_mapper_vals_i
|
"""
Util classes
------------
Classes which represent data types useful for the package pySpatialTools.
"""
from spdesc_mapper import Sp_DescriptorMapper
from spatialelements import SpatialElementsCollection, Locations
from Membership import Membership
from general_mapper import General1_1Mapper
from mapper_vals_i i... | mit | Python |
73ae36396b7562233b06083412b81d86ce487177 | Update rockets.py | cblgh/tenyks-contrib,kyleterry/tenyks-contrib | src/tenyksscripts/scripts/rockets.py | src/tenyksscripts/scripts/rockets.py | import datetime
import requests
import time
def run(data, settings):
if data["payload"] not in ["nextlaunch", "next launch", "smooth baby rocket", "WHOOOOOOOOOOOOOSH"]:
return
launches = requests.get("https://launchlibrary.net/1.2/launch", params={"next": 1, "mode": "verbose"}).json()
if not laun... | import datetime
import requests
import time
def run(data, settings):
if data["payload"] != "nextlaunch":
return
launches = requests.get("https://launchlibrary.net/1.2/launch", params={"next": 1, "mode": "verbose"}).json()
if not launches["count"]:
return "No launches scheduled"
launc... | mit | Python |
01288bb6785e3eeb8daa1328901cd5827e95b2fd | Update problem_27.py | bruckhaus/challenges,bruckhaus/challenges,bruckhaus/challenges,bruckhaus/challenges | python_challenges/project_euler/problem_27.py | python_challenges/project_euler/problem_27.py | import os
import sys
current_path = os.path.dirname(os.path.abspath(__file__))
lib_path = os.path.join(current_path, '..')
sys.path.append(lib_path)
from lib.prime import Prime
class QuadraticPrimes:
"""
Quadratic primes
Problem 27
Euler discovered the remarkable quadratic formula:
n^2 + n + 41... | import os
import sys
current_path = os.path.dirname(os.path.abspath(__file__))
lib_path = os.path.join(current_path, '..')
sys.path.append(lib_path)
from lib.prime import Prime
class QuadraticPrimes:
"""
Quadratic primes
Problem 27
Euler discovered the remarkable quadratic formula:
n^2 + n + 41... | mit | Python |
00697aeabb356c4aa3c653f9b3dfe1b619eb4dca | remove comment | compas-dev/compas | src/compas_ghpython/artists/_primitiveartist.py | src/compas_ghpython/artists/_primitiveartist.py | from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
from compas_ghpython.artists._artist import BaseArtist
__all__ = ["PrimitiveArtist"]
class PrimitiveArtist(BaseArtist):
"""Base class for artists for geometry primitives.
Parameters
----------
... | from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
from compas_ghpython.artists._artist import BaseArtist
__all__ = ["PrimitiveArtist"]
class PrimitiveArtist(BaseArtist):
"""Base class for artists for geometry primitives.
Parameters
----------
... | mit | Python |
9b31d7135f0d1c8a434da5bce609fde2bb313974 | use to correct incorrect timestamp | ver228/tierpsy-tracker,ver228/tierpsy-tracker,ver228/tierpsy-tracker | tierpsy/debugging/add_default_attrs.py | tierpsy/debugging/add_default_attrs.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon May 8 16:19:07 2017
@author: ajaver
"""
import glob
import os
import tables
from tierpsy.helper.misc import RESERVED_EXT
from tierpsy.helper.params import set_unit_conversions, read_unit_conversions
from tierpsy import DFLT_PARAMS_PATH, DFLT_PARAMS_F... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon May 8 16:19:07 2017
@author: ajaver
"""
import glob
import os
import tables
from tierpsy.helper.misc import RESERVED_EXT
from tierpsy.helper.params import set_unit_conversions, read_unit_conversions
from tierpsy import DFLT_PARAMS_PATH, DFLT_PARAMS_F... | mit | Python |
7fd709ebd32764a15b26ec0e8086ef69080dd4cc | Use ggrep instead of grep for pcre on mac os | beni55/pre-commit,pre-commit/pre-commit,pre-commit/pre-commit,Teino1978-Corp/pre-commit,philipgian/pre-commit,chriskuehl/pre-commit,philipgian/pre-commit,barrysteyn/pre-commit,dnephin/pre-commit,pre-commit/pre-commit,chriskuehl/pre-commit,chriskuehl/pre-commit,chriskuehl/pre-commit,pre-commit/pre-commit,philipgian/pre-... | pre_commit/languages/pcre.py | pre_commit/languages/pcre.py | from __future__ import unicode_literals
from sys import platform
from pre_commit.languages.helpers import file_args_to_stdin
from pre_commit.util import shell_escape
ENVIRONMENT_DIR = None
def install_environment(repo_cmd_runner, version='default'):
"""Installation for pcre type is a noop."""
raise Assert... | from __future__ import unicode_literals
from pre_commit.languages.helpers import file_args_to_stdin
from pre_commit.util import shell_escape
ENVIRONMENT_DIR = None
def install_environment(repo_cmd_runner, version='default'):
"""Installation for pcre type is a noop."""
raise AssertionError('Cannot install p... | mit | Python |
efbea8320518d94c8c7eeb23a90d8e97a4727fb6 | make sure test can find the test-management-command | zefciu/django-extensions,nikolas/django-extensions,jpadilla/django-extensions,rodo/django-extensions,jpadilla/django-extensions,artscoop/django-extensions,zefciu/django-extensions,JoseTomasTocino/django-extensions,haakenlid/django-extensions,mandx/django-extensions,kevgathuku/django-extensions,barseghyanartur/django-ex... | django_extensions/tests/management_command.py | django_extensions/tests/management_command.py | # -*- coding: utf-8 -*-
import logging
from cStringIO import StringIO
from django.core.management import call_command
from django.test import TestCase
class MockLoggingHandler(logging.Handler):
""" Mock logging handler to check for expected logs. """
def __init__(self, *args, **kwargs):
self.reset()... | # -*- coding: utf-8 -*-
import logging
from cStringIO import StringIO
from django.core.management import call_command
from django.test import TestCase
class MockLoggingHandler(logging.Handler):
""" Mock logging handler to check for expected logs. """
def __init__(self, *args, **kwargs):
self.reset()... | mit | Python |
9ed095a64679ad8899ad6706487e05152ded8db1 | Add DJANGO_SETTINGS_MODULE to wsgi environment settings | SeattleAttic/HedyNet,akjohnson/HedyNet,SeattleAttic/HedyNet,SeattleAttic/HedyNet,akjohnson/HedyNet,SeattleAttic/HedyNet,akjohnson/HedyNet,akjohnson/HedyNet | HedyNet/HedyNet/wsgi.py | HedyNet/HedyNet/wsgi.py | """
WSGI config for HedyNet project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` ... | """
WSGI config for HedyNet project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` ... | apache-2.0 | Python |
1097d67534c2a34ce8a381af2814abfe23e4086e | Enable ndimage on 64-bit systems. | lesserwhirls/scipy-cwt,scipy/scipy-svn,lesserwhirls/scipy-cwt,jasonmccampbell/scipy-refactor,jasonmccampbell/scipy-refactor,lesserwhirls/scipy-cwt,scipy/scipy-svn,scipy/scipy-svn,scipy/scipy-svn,jasonmccampbell/scipy-refactor,jasonmccampbell/scipy-refactor,lesserwhirls/scipy-cwt | Lib/ndimage/__init__.py | Lib/ndimage/__init__.py | # Copyright (C) 2003-2005 Peter J. Verveer
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following d... | # Copyright (C) 2003-2005 Peter J. Verveer
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following d... | bsd-3-clause | Python |
6b015573e6d087eb53e932ae3ba71311170472bf | Remove print | geoneric/starling,geoneric/starling | starling/flask/error_handler/json.py | starling/flask/error_handler/json.py | from flask import jsonify
from werkzeug.exceptions import HTTPException
def response(
code,
description):
"""
Format a response
:param int code: HTTP error code
:param str description: Error message
:return: Tuple of a wrapped JSON snippet and the error code
:rtype: Tuple of :... | from flask import jsonify
from werkzeug.exceptions import HTTPException
def response(
code,
description):
"""
Format a response
:param int code: HTTP error code
:param str description: Error message
:return: Tuple of a wrapped JSON snippet and the error code
:rtype: Tuple of :... | mit | Python |
62a76827ecf7c148101b62925dea04f63709012a | Update command to work with sublime 3 | RomuloOliveira/dot-files,RomuloOliveira/unix-files,RomuloOliveira/dot-files | sublime/User/update_user_settings.py | sublime/User/update_user_settings.py | import json
import urllib
import sublime
import sublime_plugin
GIST_URL = 'https://raw.githubusercontent.com/RomuloOliveira/dot-files/master/sublime/User/Preferences.sublime-settings' # noqa
class UpdateUserSettingsCommand(sublime_plugin.TextCommand):
def run(self, edit):
gist_settings = self._get_set... | import json
import urllib2
import sublime
import sublime_plugin
GIST_URL = u'https://raw.githubusercontent.com/RomuloOliveira/dot-files/master/sublime/User/Preferences.sublime-settings' # noqa
class UpdateUserSettingsCommand(sublime_plugin.TextCommand):
def run(self, edit):
gist_settings = self._g... | apache-2.0 | Python |
abc932da4a65ef36de8367cdba91df4cb98e0e7f | Fix check digit calculation to handle 0 | poliquin/brazilnum | brazilnum/cei.py | brazilnum/cei.py | #!/usr/bin/env python
import re
import random
from operator import mul
"""
Functions for working with Brazilian CEI identifiers.
"""
NONDIGIT = re.compile(r'[^0-9]')
CEI_WEIGHTS = [7, 4, 1, 8, 5, 2, 1, 6, 3, 7, 4]
def clean_cei(cei):
"""Takes a CEI and turns it into a string of only numbers."""
return NOND... | #!/usr/bin/env python
import re
import random
from operator import mul
"""
Functions for working with Brazilian CEI identifiers.
"""
NONDIGIT = re.compile(r'[^0-9]')
CEI_WEIGHTS = [7, 4, 1, 8, 5, 2, 1, 6, 3, 7, 4]
def clean_cei(cei):
"""Takes a CEI and turns it into a string of only numbers."""
return NOND... | mit | Python |
9a83a07dbf16198b67c80c4846bdeba5342e5374 | fix related_name for FB profile | colbypalmer/cp-broker | broker/models.py | broker/models.py | from django.db import models
from django.contrib.auth.models import User
from django.dispatch.dispatcher import receiver
from django_facebook.models import FacebookModel
from django.db.models.signals import post_save
from django_facebook.utils import get_user_model, get_profile_model
class Service(models.Model):
... | from django.db import models
from django.contrib.auth.models import User
from django.dispatch.dispatcher import receiver
from django_facebook.models import FacebookModel
from django.db.models.signals import post_save
from django_facebook.utils import get_user_model, get_profile_model
class Service(models.Model):
... | mit | Python |
839632f923ccd6691dc7135c5a49d66e1b0e3721 | Add copyright notice | prasannav7/ggrc-core,kr41/ggrc-core,josthkko/ggrc-core,NejcZupec/ggrc-core,kr41/ggrc-core,AleksNeStu/ggrc-core,selahssea/ggrc-core,selahssea/ggrc-core,NejcZupec/ggrc-core,edofic/ggrc-core,josthkko/ggrc-core,andrei-karalionak/ggrc-core,andrei-karalionak/ggrc-core,josthkko/ggrc-core,NejcZupec/ggrc-core,j0gurt/ggrc-core,s... | src/ggrc/migrations/versions/20151203153139_297131e22e28_add_final_state_to_request_status_and_.py | src/ggrc/migrations/versions/20151203153139_297131e22e28_add_final_state_to_request_status_and_.py | # Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: urban@reciprocitylabs.com
# Maintained By: urban@reciprocitylabs.com
"""Add final state to request status and rename Unstarted to Open
Revision ID... |
"""Add final state to request status and rename Unstarted to Open
Revision ID: 297131e22e28
Revises: 18cbdd3a7fd9
Create Date: 2015-12-03 15:31:39.979333
"""
# revision identifiers, used by Alembic.
revision = '297131e22e28'
down_revision = '504f541411a5'
from alembic import op
def upgrade():
op.execute("""ALT... | apache-2.0 | Python |
e84d6231538fe0cf587648c0b9e301b3b0399db7 | Support structured_code.__contains__ | angr/angr,angr/angr,angr/angr | angr/knowledge_plugins/structured_code/manager.py | angr/knowledge_plugins/structured_code/manager.py | from typing import TYPE_CHECKING
from .. import KnowledgeBasePlugin
if TYPE_CHECKING:
from angr.knowledge_base import KnowledgeBase
from angr.analyses.decompiler.structured_codegen import StructuredCodeGenerator
class StructuredCodeManager(KnowledgeBasePlugin):
def __init__(self, kb):
self._kb =... | from typing import TYPE_CHECKING
from .. import KnowledgeBasePlugin
if TYPE_CHECKING:
from angr.knowledge_base import KnowledgeBase
from angr.analyses.decompiler.structured_codegen import StructuredCodeGenerator
class StructuredCodeManager(KnowledgeBasePlugin):
def __init__(self, kb):
self._kb =... | bsd-2-clause | Python |
86449f40f288bf360cb239104e62e3b1acc9f1f8 | Bump to v1.0.0 | gisce/enerdata | enerdata/__init__.py | enerdata/__init__.py | __author__ = 'ecarreras'
__version__ = '1.0.0'
| __author__ = 'ecarreras'
__version__ = '0.29.0'
| mit | Python |
1a7c9d4734b09b398ae1778fa400a6d53def227a | Replace a query with an if statement in category_tree(). | dokterbob/satchmo,ringemup/satchmo,twidi/satchmo,twidi/satchmo,dokterbob/satchmo,ringemup/satchmo,Ryati/satchmo,Ryati/satchmo | satchmo/shop/templatetags/satchmo_category.py | satchmo/shop/templatetags/satchmo_category.py | from django.template import Library
from satchmo.product.models import Category
try:
from xml.etree.ElementTree import Element, SubElement, tostring
except ImportError:
from elementtree.ElementTree import Element, SubElement, tostring
register = Library()
def recurse_for_children(current_node, parent_node, s... | from django.template import Library
from satchmo.product.models import Category
try:
from xml.etree.ElementTree import Element, SubElement, tostring
except ImportError:
from elementtree.ElementTree import Element, SubElement, tostring
register = Library()
def recurse_for_children(current_node, parent_node, s... | bsd-3-clause | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.