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 |
|---|---|---|---|---|---|---|---|---|
26e76133d5a21eb2a1f6383a330e4293b682216a | check that there is an active organization in context processor | universalcore/unicore-mc,universalcore/unicore-mc,praekelt/mc2,universalcore/unicore-mc,praekelt/mc2,praekelt/mc2,universalcore/unicore-mc,praekelt/mc2,praekelt/mc2 | organizations/context_processors.py | organizations/context_processors.py | from organizations.models import Organization
from organizations.utils import active_organization
def org(request):
if not request.user.is_authenticated():
return {
'organizations': [],
'active_organization': None,
'is_active_organization_admin': False
}
ac... | from organizations.models import Organization
from organizations.utils import active_organization
def org(request):
if not request.user.is_authenticated():
return {
'organizations': [],
'active_organization': None,
'is_active_organization_admin': False
}
ac... | bsd-2-clause | Python |
f8aaab5cf047c6b9aec2ee1ae8d8fe8e0cc05a08 | stop treating all logs as error logs (#9845) | hail-is/hail,hail-is/hail,hail-is/hail,hail-is/hail,hail-is/hail,hail-is/hail,hail-is/hail,hail-is/hail | hail/python/hailtop/hail_logging.py | hail/python/hailtop/hail_logging.py | import logging
import sys
from pythonjsonlogger import jsonlogger
from aiohttp.abc import AbstractAccessLogger
import datetime
import time
class CustomJsonFormatter(jsonlogger.JsonFormatter):
def add_fields(self, log_record, record, message_dict):
super().add_fields(log_record, record, message_dict)
... | import logging
from pythonjsonlogger import jsonlogger
from aiohttp.abc import AbstractAccessLogger
import datetime
import time
class CustomJsonFormatter(jsonlogger.JsonFormatter):
def add_fields(self, log_record, record, message_dict):
super().add_fields(log_record, record, message_dict)
log_reco... | mit | Python |
af7d3badcc288866934150df52497d3e42c0b66d | Bump version to 0.0.13 | jbbarth/aws-status,jbbarth/aws-status | aws_status/__init__.py | aws_status/__init__.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
__version__ = '0.0.13'
| # -*- coding: utf-8 -*-
from __future__ import absolute_import
__version__ = '0.0.12'
| mit | Python |
bf5f9f0fc700feaadd70ee19ad0b94e25eb4e5b1 | Use PIL as default imread plugin, since MPL imread is still somewhat broken. | GaZ3ll3/scikit-image,Britefury/scikit-image,emon10005/scikit-image,dpshelio/scikit-image,oew1v07/scikit-image,bennlich/scikit-image,almarklein/scikit-image,michaelaye/scikit-image,ClinicalGraphics/scikit-image,pratapvardhan/scikit-image,ofgulban/scikit-image,michaelaye/scikit-image,Midafi/scikit-image,WarrenWeckesser/s... | skimage/io/__init__.py | skimage/io/__init__.py | __doc__ = """Utilities to read and write images in various formats.
The following plug-ins are available:
"""
from ._plugins import use as use_plugin
from ._plugins import available as plugins
from ._plugins import info as plugin_info
from ._plugins import configuration as plugin_order
available_plugins = plugins()
... | __doc__ = """Utilities to read and write images in various formats.
The following plug-ins are available:
"""
from ._plugins import use as use_plugin
from ._plugins import available as plugins
from ._plugins import info as plugin_info
from ._plugins import configuration as plugin_order
available_plugins = plugins()
... | bsd-3-clause | Python |
c84d66c8bc61b06d1bc9f33074c6c7bf56cf1112 | Fix word2vec | knub/master-thesis,knub/master-thesis,knub/master-thesis,knub/master-thesis | code/python/knub/thesis/word2vec.py | code/python/knub/thesis/word2vec.py | import argparse
import logging
from gensim.models import Word2Vec
from gensim.models.word2vec import LineSentence
logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO)
if __name__ == "__main__":
parser = argparse.ArgumentParser("Training word2vec with gensim")
parser.add... | import argparse
import logging
from gensim.models import Word2Vec
from gensim.models.word2vec import LineSentence
logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO)
if __name__ == "__main__":
parser = argparse.ArgumentParser("Training word2vec with gensim")
parser.add... | apache-2.0 | Python |
cdffe6f3e3b8a89c57587aea6dbe9133e344ffaf | Update config.default.py | WebShark025/ZigZag-v2,WebShark025/ZigZag-v2,WebShark025/ZigZag-v2 | data/config.default.py | data/config.default.py | config = {
"token" : "blahblahblah",
"sudo" : ["98120772"],
"loggp" : 1000000000000,
}
enabled_plugins = [
"echo",
"clock,
]
| config = {
}
| mit | Python |
3a0eed91bd2283213632908c3d65c57b8be9b78c | update par binary source (#206) | GoogleContainerTools/distroless,istio/distroless,istio/distroless,GoogleContainerTools/distroless,istio/distroless,GoogleContainerTools/distroless | package_manager/package_manager.bzl | package_manager/package_manager.bzl | load(":dpkg.bzl", "dpkg_list", "dpkg_src")
def package_manager_repositories():
native.http_file(
name = "dpkg_parser",
url = ('https://storage.googleapis.com/distroless/package_manager_tools/ac8068579db811014780cb80105fc999fc25a730/dpkg_parser.par'),
executable = True,
sha256 = "08b965c60bef5... | load(":dpkg.bzl", "dpkg_list", "dpkg_src")
def package_manager_repositories():
native.http_file(
name = "dpkg_parser",
url = ('https://storage.googleapis.com/distroless/package_manager_tools/872f43c0f9b0f3d0d0c4d832edc59a1e4bd63e99/dpkg_parser.par'),
executable = True,
sha256 = "ec12a77e02b13... | apache-2.0 | Python |
e4e8374333929edc2bab2936fa700926971d987f | fix title display | mutantmonkey/mmbar | widgets/mpdstatus.py | widgets/mpdstatus.py | import mpd
import os.path
class MpdStatusWidget(object):
def __init__(self, server, timeout=10):
self.server = server
self.timeout = timeout
self._client = mpd.MPDClient()
self._client.timeout = self.timeout
self.connect()
def connect(self):
self._client.conne... | import mpd
import os.path
class MpdStatusWidget(object):
def __init__(self, server, timeout=10):
self.server = server
self.timeout = timeout
self._client = mpd.MPDClient()
self._client.timeout = self.timeout
self.connect()
def connect(self):
self._client.conne... | isc | Python |
f47257e5fc6990048c59730e27487b5c834cbd3a | Clean up signals registers in alerts | watchdogpolska/feder,watchdogpolska/feder,watchdogpolska/feder,watchdogpolska/feder | feder/alerts/models.py | feder/alerts/models.py | from django.conf import settings
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.core.mail import send_mail
from django.core.urlresolvers import reverse
from django.db import models
from django.db.models.signals import post_save
fro... | from django.conf import settings
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.core.mail import send_mail
from django.core.urlresolvers import reverse
from django.db import models
from django.db.models.signals import post_save
fro... | mit | Python |
9c682ce7f2ae7a14e8707582a23de798c0d1c7da | Update h5diag.py | UCBerkeleySETI/blimpy,UCBerkeleySETI/blimpy | blimpy/h5diag.py | blimpy/h5diag.py | r""" h5diag """
import os
import sys
from argparse import ArgumentParser
import h5py
from astropy.coordinates import Angle
from blimpy.io.hdf_reader import examine_h5
def oops(msg):
print(F"\n*** h5diag: {msg}\n")
sys.exit(86)
def read_header(h5):
""" Read header and return a Python dictionary of key:v... | r""" h5diag """
import os
import sys
from argparse import ArgumentParser
import h5py
from astropy.coordinates import Angle
from blimpy.io.hdf_reader import examine_h5
def oops(msg):
print(F"\n*** h5diag: {msg}\n")
sys.exit(86)
def read_header(h5):
""" Read header and return a Python dictionary of key:v... | bsd-3-clause | Python |
4fef7dc04dfbb9a81703233d36c7d9da3f8ca1a5 | check if has django settings | vparitskiy/data-importer,vparitskiy/data-importer | data_importer/tasks.py | data_importer/tasks.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
try:
from celery import Task
except ImportError:
Task = object
from django.core.cache import cache
from data_importer.core import default_settings
from django.core.mail import EmailMessage
from django.utils.safestring import mark_safe
try:
from djan... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
try:
from celery import Task
except ImportError:
Task = object
from django.core.cache import cache
from data_importer.core import default_settings
from django.conf import settings
from django.core.mail import EmailMessage
from django.utils.safestring imp... | bsd-2-clause | Python |
7166171962985f905bad41f532582fdb3c9d050d | Update ddp_plugin.py (#4363) | williamFalcon/pytorch-lightning,williamFalcon/pytorch-lightning | pytorch_lightning/plugins/ddp_plugin.py | pytorch_lightning/plugins/ddp_plugin.py | from pytorch_lightning.overrides.data_parallel import LightningDistributedDataParallel
from pytorch_lightning.core.lightning import LightningModule
from typing import List
class DDPPlugin(object):
"""
Plugin to link a custom ddp implementation to any arbitrary accelerator.
Example::
class MyDDP(... | from pytorch_lightning.overrides.data_parallel import LightningDistributedDataParallel
from pytorch_lightning.core.lightning import LightningModule
from typing import List
class DDPPlugin(object):
"""
Plugin to link a custom ddp implementation to any arbitrary accelerator.
Example::
class MyDDP(... | apache-2.0 | Python |
7b4a74c6da8c03d6b251dc8955fe0864fadb6ec4 | Configure admin | daniel-afana/Bids | bids_app/admin.py | bids_app/admin.py | from django.contrib import admin
from bids_app.models import Channel, Campaign
class CampaignInline(admin.StackedInline):
model = Campaign
class ChannelAdmin(admin.ModelAdmin):
model = Channel
inlines = [CampaignInline]
admin.site.register(Channel, ChannelAdmin)
admin.site.register(Campaign) | from django.contrib import admin
# Register your models here.
| mit | Python |
ef69ed3b3ff3330869d6fbe8d48750f8ac29bc4c | Remove Java 7 from regular executor list; #287 | DMOJ/judge,DMOJ/judge,DMOJ/judge | dmoj/executors/__init__.py | dmoj/executors/__init__.py | from __future__ import print_function
import os
import re
import traceback
from importlib import import_module
from dmoj.judgeenv import env, only_executors, exclude_executors
_reexecutor = re.compile('([A-Z0-9]+)\.py$')
# List of executors that exist for historical purposes, but which shouldn't ever be run on a no... | from __future__ import print_function
import os
import re
import traceback
from importlib import import_module
from dmoj.judgeenv import env, only_executors, exclude_executors
_reexecutor = re.compile('([A-Z0-9]+)\.py$')
# List of executors that exist for historical purposes, but which shouldn't ever be run on a no... | agpl-3.0 | Python |
e13944baf93cc35f72250ed5078d0beba1827442 | use helpers | ultrabug/py3status,valdur55/py3status,Andrwe/py3status,ultrabug/py3status,alexoneill/py3status,tobes/py3status,vvoland/py3status,valdur55/py3status,docwalter/py3status,valdur55/py3status,ultrabug/py3status,Andrwe/py3status,guiniol/py3status,guiniol/py3status,tobes/py3status | py3status/modules/gpmdp.py | py3status/modules/gpmdp.py | # -*- coding: utf-8 -*-
"""
Display song currently playing in Google Play Music Desktop Player.
Configuration parameters:
cache_timeout: refresh interval for this module (default 5)
format: specify the items and ordering of the data in the status bar.
These area 1:1 match to gpmdp-... | # -*- coding: utf-8 -*-
"""
Display song currently playing in Google Play Music Desktop Player.
Configuration parameters:
cache_timeout: how often we refresh this module in seconds (default 5)
format: specify the items and ordering of the data in the status bar.
These area 1:1 matc... | bsd-3-clause | Python |
2dffdb5d500e8b8e5aae23c179a6e0012103a63c | Add a profile view function | jokey2k/pyClanSphere,jokey2k/pyClanSphere | pyClanSphere/views/core.py | pyClanSphere/views/core.py | # -*- coding: utf-8 -*-
"""
pyClanSphere.views.core
~~~~~~~~~~~~~~~~~~~~~~~
This module exports the main index page where plugins can hook in to display their widgets
:copyright: (c) 2009 by the pyClanSphere Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
fr... | # -*- coding: utf-8 -*-
"""
pyClanSphere.views.core
~~~~~~~~~~~~~~~~~~~~~~~
This module exports the main index page where plugins can hook in to display their widgets
:copyright: (c) 2009 by the pyClanSphere Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
fr... | bsd-3-clause | Python |
24bccad18ac118de193aec0a2fdce99e716c8bdd | Clean up irccat code a bit. | Shizmob/pydle | pydle/utils/irccat.py | pydle/utils/irccat.py | #!/usr/bin/env python3
## irccat.py
# Simple threaded irccat implementation, using pydle.
import sys
import threading
import logging
from .. import Client, __version__
from . import _args
class IRCCat(Client):
""" irccat. Takes raw messages on stdin, dumps raw messages to stdout. Life has never been easier. """
... | #!/usr/bin/env python3
## irccat.py
# Simple threaded irccat implementation, using pydle.
import sys
import threading
import logging
from .. import features
from .. import protocol
from .. import featurize, __version__
from . import _args
class IRCCat(featurize(*features.ALL)):
""" irccat. Takes raw messages on... | bsd-3-clause | Python |
f9082ac100aeb052db5582febf667939679b257b | Update library.py | tyrylu/pyfmodex | pyfmodex/studio/library.py | pyfmodex/studio/library.py | """Util method to get the FMOD LIBRARY from the filesystem into ctypes."""
import os
import platform
import sys
arch = platform.architecture()[0]
if os.name == "nt":
from ctypes import windll
library_type = windll
LIBRARY_NAME = "fmodstudio2"
elif os.name == "posix":
from ctypes import cdll
librar... | """Util method to get the FMOD LIBRARY from the filesystem into ctypes."""
import os
import platform
arch = platform.architecture()[0]
if os.name == "nt":
from ctypes import windll
library_type = windll
LIBRARY_NAME = "fmodstudio"
elif os.name == "posix":
from ctypes import cdll
library_type = cdl... | mit | Python |
37131de71827a58b2415d79fc7ed525e80f484e3 | Monitor KL and expectation terms in VAE criterion cost | matrogers/pylearn2,caidongyun/pylearn2,caidongyun/pylearn2,cosmoharrigan/pylearn2,woozzu/pylearn2,jeremyfix/pylearn2,bartvm/pylearn2,TNick/pylearn2,mclaughlin6464/pylearn2,mclaughlin6464/pylearn2,w1kke/pylearn2,ddboline/pylearn2,mkraemer67/pylearn2,chrish42/pylearn,fishcorn/pylearn2,lunyang/pylearn2,cosmoharrigan/pylea... | pylearn2/costs/vae.py | pylearn2/costs/vae.py | """
VAE-related costs
"""
__authors__ = "Vincent Dumoulin"
__copyright__ = "Copyright 2014, Universite de Montreal"
__credits__ = ["Vincent Dumoulin"]
__license__ = "3-clause BSD"
__maintainer__ = "Vincent Dumoulin"
__email__ = "pylearn-dev@googlegroups"
from theano.compat.python2x import OrderedDict
from pylearn2.cos... | """
VAE-related costs
"""
__authors__ = "Vincent Dumoulin"
__copyright__ = "Copyright 2014, Universite de Montreal"
__credits__ = ["Vincent Dumoulin"]
__license__ = "3-clause BSD"
__maintainer__ = "Vincent Dumoulin"
__email__ = "pylearn-dev@googlegroups"
from pylearn2.costs.cost import Cost, DefaultDataSpecsMixin
from... | bsd-3-clause | Python |
f66ed3823cb6b99350bcd255891d0b718d12b7c8 | Add tags listing post api | enginebai/PyMedium | pymedium/endpoints.py | pymedium/endpoints.py | #!/usr/bin/python
# -*- encoding: utf-8 -*-
import json
from flask import Flask, jsonify, Response
import requests
ROOT_URL = "https://medium.com/"
ESCAPE_CHARACTERS = "])}while(1);</x>"
ACCEPT_HEADER = {"Accept": "application/json"}
app = Flask(__name__)
@app.route("/")
def index():
return "Hello!!"
@app.r... | #!/usr/bin/python
# -*- encoding: utf-8 -*-
import json
from flask import Flask, jsonify, Response
import requests
ROOT_URL = "https://medium.com/"
ESCAPE_CHARACTERS = "])}while(1);</x>"
ACCEPT_HEADER = {"Accept": "application/json"}
app = Flask(__name__)
@app.route("/")
def index():
return "Hello!!"
@app.r... | mit | Python |
c9291718f9912a1ce402a47a828a5e0bad8ed74e | Update description with more detailed explanation of applied steps | almarklein/scikit-image,chintak/scikit-image,almarklein/scikit-image,oew1v07/scikit-image,keflavich/scikit-image,chriscrosscutler/scikit-image,michaelaye/scikit-image,newville/scikit-image,pratapvardhan/scikit-image,rjeli/scikit-image,ClinicalGraphics/scikit-image,juliusbierk/scikit-image,GaZ3ll3/scikit-image,juliusbie... | doc/examples/plot_label.py | doc/examples/plot_label.py | """
===================
Label image regions
===================
This example shows how to segment an image with image labelling. The following
steps are applied:
1. Thresholding with automatic Otsu method
2. Close small holes with binary closing
3. Remove artifacts touching image border
4. Measure image regions to fi... | """
===================
Label image regions
===================
This example shows how to segment an image with image labelling.
"""
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
from skimage import data
from skimage.filter import threshold_otsu
from skimage.segmentation i... | bsd-3-clause | Python |
7c1e207fb13d9db6959575ff06f15ff2bb166f8a | Make dbaccessors for users_by_location | puttarajubr/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq | corehq/apps/locations/dbaccessors.py | corehq/apps/locations/dbaccessors.py | from corehq.apps.users.models import CommCareUser
def _users_by_location(location_id, include_docs):
return CommCareUser.view(
'locations/users_by_location_id',
startkey=[location_id],
endkey=[location_id, {}],
include_docs=include_docs,
).all()
def get_users_by_location_id(l... | from corehq.apps.users.models import CommCareUser
def get_users_by_location_id(location_id):
"""
Get all users for a given location
"""
return CommCareUser.view(
'locations/users_by_location_id',
startkey=[location_id],
endkey=[location_id, {}],
include_docs=True
).... | bsd-3-clause | Python |
18972167ea2cd70604f50218f4cbb7638fb5e321 | disable precompiled tests | sassoftware/conary,sassoftware/conary,sassoftware/conary,sassoftware/conary,sassoftware/conary | pysqlite/test/all_tests.py | pysqlite/test/all_tests.py | #!/usr/bin/env python
"""
This combines all PySQLite test suites into one big one.
"""
import unittest, sys
import api_tests, logging_tests, lowlevel_tests, pgresultset_tests
import precompile_tests, type_tests, userfunction_tests, transaction_tests
def suite():
suite = unittest.TestSuite((lowlevel_tests.suite(),... | #!/usr/bin/env python
"""
This combines all PySQLite test suites into one big one.
"""
import unittest, sys
import api_tests, logging_tests, lowlevel_tests, pgresultset_tests
import precompile_tests, type_tests, userfunction_tests, transaction_tests
def suite():
suite = unittest.TestSuite((lowlevel_tests.suite(),... | apache-2.0 | Python |
9a2592ca0eb4515a6f0e3d1194906fc6f500583a | Fix a typo | thombashi/pytablereader,thombashi/pytablereader,thombashi/pytablereader | pytablereader/formatter.py | pytablereader/formatter.py | # encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""
from __future__ import absolute_import
import abc
import six
from ._acceptor import LoaderAcceptor
from .error import InvalidDataError
@six.add_metaclass(abc.ABCMeta)
class TableFormatterInterface(object):
"""
The a... | # encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""
from __future__ import absolute_import
import abc
import six
from ._acceptor import LoaderAcceptor
from .error import InvalidDataError
@six.add_metaclass(abc.ABCMeta)
class TableFormatterInterface(object):
"""
The a... | mit | Python |
bad0c1e14cfc30bcac10c39ed2d6316a12e265b9 | use env NETWORK_PROFILE | SivagnanamCiena/nxapi-learning-labs | python/example/__init__.py | python/example/__init__.py | from __future__ import print_function
import imp
import os
from os import getenv
inventory_config = []
inventory_config_path = None
def load_config_module(module_file_name):
(module_file_name, _) = os.path.splitext(module_file_name)
if '/' in module_file_name:
uri = module_file_name
else:
... | from __future__ import print_function
import imp
import os
inventory_config = []
inventory_config_path = None
def load_config_module(module_file_name):
(module_file_name, _) = os.path.splitext(module_file_name)
if '/' in module_file_name:
uri = module_file_name
else:
uri = os.path.join(os.... | apache-2.0 | Python |
313e89b501a361fe08b6b41fa92ef2f5046d8cbd | make sure template files are include in the pyvespa package | vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa | python/vespa/setup.py | python/vespa/setup.py | import os
from pkg_resources import parse_version
from configparser import ConfigParser
import setuptools
assert parse_version(setuptools.__version__) >= parse_version("36.2")
# note: all settings are in settings.ini; edit there, not here
config = ConfigParser(delimiters=["="])
config.read("settings.ini")
cfg = confi... | import os
from pkg_resources import parse_version
from configparser import ConfigParser
import setuptools
assert parse_version(setuptools.__version__) >= parse_version("36.2")
# note: all settings are in settings.ini; edit there, not here
config = ConfigParser(delimiters=["="])
config.read("settings.ini")
cfg = confi... | apache-2.0 | Python |
3b0608e11da620f1e12aeb270dbaf2f255a35cec | Add a (temporary) bounding box around an added mesh | onitake/Uranium,onitake/Uranium | Cura/Qt/Bindings/ControllerProxy.py | Cura/Qt/Bindings/ControllerProxy.py | from PyQt5.QtCore import QObject, QCoreApplication, pyqtSlot, QUrl
from Cura.Application import Application
from Cura.Scene.SceneNode import SceneNode
from Cura.Scene.BoxRenderer import BoxRenderer
class ControllerProxy(QObject):
def __init__(self, parent = None):
super().__init__(parent)
self._co... | from PyQt5.QtCore import QObject, QCoreApplication, pyqtSlot, QUrl
from Cura.Application import Application
from Cura.Scene.SceneNode import SceneNode
class ControllerProxy(QObject):
def __init__(self, parent = None):
super().__init__(parent)
self._controller = Application.getInstance().getControl... | agpl-3.0 | Python |
e82ab299a6c68f682a9f9b769e79cf2054684e3b | Fix the FileAttachment.uuid evolution to match the model field. | davidt/reviewboard,davidt/reviewboard,reviewboard/reviewboard,chipx86/reviewboard,sgallagher/reviewboard,brennie/reviewboard,reviewboard/reviewboard,brennie/reviewboard,sgallagher/reviewboard,chipx86/reviewboard,brennie/reviewboard,chipx86/reviewboard,reviewboard/reviewboard,davidt/reviewboard,chipx86/reviewboard,sgall... | reviewboard/attachments/evolutions/file_attachment_uuid.py | reviewboard/attachments/evolutions/file_attachment_uuid.py | from __future__ import unicode_literals
from django_evolution.mutations import AddField
from django.db import models
MUTATIONS = [
AddField('FileAttachment', 'uuid', models.CharField, max_length=255,
initial=''),
]
| from __future__ import unicode_literals
from django_evolution.mutations import AddField
from django.db import models
MUTATIONS = [
AddField('FileAttachment', 'uuid', models.CharField, max_length=255,
initial=None, null=True),
]
| mit | Python |
a9d57d70046cd77610d4d62f1ba2be1e02bb82d1 | Make test more likely to succeed | alfred-bratterud/IncludeOS,AnnikaH/IncludeOS,AndreasAakesson/IncludeOS,AndreasAakesson/IncludeOS,mnordsletten/IncludeOS,mnordsletten/IncludeOS,mnordsletten/IncludeOS,alfred-bratterud/IncludeOS,hioa-cs/IncludeOS,hioa-cs/IncludeOS,AndreasAakesson/IncludeOS,hioa-cs/IncludeOS,AnnikaH/IncludeOS,AndreasAakesson/IncludeOS,And... | test/net/integration/icmp6/test.py | test/net/integration/icmp6/test.py | #! /usr/bin/env python
import sys
import os
import subprocess
includeos_src = os.environ.get('INCLUDEOS_SRC',
os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__))).split('/test')[0])
sys.path.insert(0,includeos_src)
from vmrunner import vmrunner
from vmrunner.prettify ... | #! /usr/bin/env python
import sys
import os
import subprocess
includeos_src = os.environ.get('INCLUDEOS_SRC',
os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__))).split('/test')[0])
sys.path.insert(0,includeos_src)
from vmrunner import vmrunner
from vmrunner.prettify ... | apache-2.0 | Python |
bd990de116adf76e685938b2266aa7e8b5187bfd | Bump version | ckan/datapusher | datapusher/__init__.py | datapusher/__init__.py | __version__ = '0.0.14'
| __version__ = '0.0.13'
| agpl-3.0 | Python |
9dd5e8d5fb4233fa0f581a89d141e27c52008e95 | manage ms for timeout with rampup | TheGhouls/oct-turrets,karec/oct-turrets | oct_turrets/turret.py | oct_turrets/turret.py | from base import BaseTurret
from canon import Canon
class Turret(BaseTurret):
"""This class represent the classic turret for oct
"""
def run(self):
"""The main run method
"""
if 'rampup' in self.config:
timeout = float(self.config['rampup'] / self.config['canons']) * 10... | from base import BaseTurret
from canon import Canon
class Turret(BaseTurret):
"""This class represent the classic turret for oct
"""
def run(self):
"""The main run method
"""
if 'rampup' in self.config:
timeout = float(self.config['rampup'] / self.config['canons'])
... | mit | Python |
b39add81531d51aa11e88b1637a4c99614f95787 | change route | josip-milic/asc_qwerty_test,josip-milic/asc_qwerty_test,josip-milic/asc_qwerty_test | qwerty/qwerty/urls.py | qwerty/qwerty/urls.py | """qwerty 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-bas... | """qwerty 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-bas... | apache-2.0 | Python |
7a14935f9b62667e7699a4ecd9da02624d73dd49 | add iers mirror download to try/except | HERA-Team/pyuvdata,HERA-Team/pyuvdata,HERA-Team/pyuvdata,HERA-Team/pyuvdata | pyuvdata/tests/conftest.py | pyuvdata/tests/conftest.py | # -*- mode: python; coding: utf-8 -*
# Copyright (c) 2019 Radio Astronomy Software Group
# Licensed under the 2-clause BSD License
"""Testing environment setup and teardown for pytest."""
from __future__ import absolute_import, division, print_function
import os
import pytest
import six.moves.urllib as urllib
from as... | # -*- mode: python; coding: utf-8 -*
# Copyright (c) 2019 Radio Astronomy Software Group
# Licensed under the 2-clause BSD License
"""Testing environment setup and teardown for pytest."""
from __future__ import absolute_import, division, print_function
import os
import pytest
import six.moves.urllib as urllib
from as... | bsd-2-clause | Python |
ea4ec9088de0d6bc212ef7f676dba54fe4225fc4 | Update to the latest stable release | trustin/armeria,jmostella/armeria,line/armeria,jonefeewang/armeria,imasahiro/armeria,trustin/armeria,jongyeol/armeria,anuraaga/armeria,line/armeria,jmostella/armeria,minwoox/armeria,trustin/armeria,imasahiro/armeria,anuraaga/armeria,jongyeol/armeria,line/armeria,anuraaga/armeria,jonefeewang/armeria,dongjinleekr/armeria... | src/site/sphinx/conf.py | src/site/sphinx/conf.py | # -*- coding: utf-8 -*-
import sys, os, re
import xml.etree.ElementTree as etree
from datetime import date
# Parse the Maven pom.xml.
ns = { 'mvn': 'http://maven.apache.org/POM/4.0.0' }
pom = etree.parse('../../../pom.xml')
pom.artifactId = pom.find('mvn:artifactId', ns).text
pom.version = pom.find('mvn:version', ns).... | # -*- coding: utf-8 -*-
import sys, os, re
import xml.etree.ElementTree as etree
from datetime import date
# Parse the Maven pom.xml.
ns = { 'mvn': 'http://maven.apache.org/POM/4.0.0' }
pom = etree.parse('../../../pom.xml')
pom.artifactId = pom.find('mvn:artifactId', ns).text
pom.version = pom.find('mvn:version', ns).... | apache-2.0 | Python |
08ed08d883279eec153c55967c8240426f4e7e9d | Teste colisão com ator destruido ok | giovaneliberato/python_birds_fp,renzon/pythonbirds-fatec,guoliveer/pythonbirds,igorlimasan/pythonbirds,deniscampos/pythonbirds,Cleitoon1/pythonbirds,evertongoncalves/pythonbirds,gomesfelipe/pythonbirds,jvitorlb/pythonbirds,renzon/python-birds-t5,pythonprobr/pythonbirds | atores.py | atores.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
DESTRUIDO = 'Destruido'
ATIVO = 'Ativo'
class Ator():
caracter = 'A'
def __init__(self, x=0, y=0):
self.y = y
self.x = x
self.status = ATIVO
def ponto_cartesiano_inteiro(self):
return round(self.x), round(s... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
DESTRUIDO = 'Destruido'
ATIVO = 'Ativo'
class Ator():
caracter = 'A'
def __init__(self, x=0, y=0):
self.y = y
self.x = x
self.status = ATIVO
def ponto_cartesiano_inteiro(self):
return round(self.x), round(s... | mit | Python |
cef91054cf5c373a588f1129b7a211b81b876a8c | Remove some obvious bugs | grimpunch/CardsAgainstOnline,grimpunch/CardsAgainstOnline,grimpunch/CardsAgainstOnline | flask_interface/app.py | flask_interface/app.py | from flask import Flask
from flask.ext.login import LoginManager
# from .forms import LoginForm
lm = LoginManager()
app = Flask(__name__)
lm.init_app(app)
@app.route('/')
@app.route('/index')
def index():
return "Hello to Cards against Humanity!"
@app.route('/user')
def user():
# return the user as a string... | from flask import Flask
from flask.ext.login import LoginManager
from .forms import LoginForm
lm = LoginManager()
app = Flask(__name__)
lm.init_app(app)
@app.route('/')
@app.route('/index')
def index():
return "Hello to Cards against Humanity!"
@app.route('/user')
def user():
# return the user as a string
... | mit | Python |
064459893cc0420dd5292265bfd43bccb6706ba0 | return None if image or document is blank on function call | openstax/openstax-cms,Connexions/openstax-cms,openstax/openstax-cms,Connexions/openstax-cms,openstax/openstax-cms,openstax/openstax-cms | openstax/functions.py | openstax/functions.py | from django.conf import settings
from wagtail.wagtailcore.models import Site
def build_document_url(url):
if url:
site = Site.objects.get(is_default_site=True)
if site.port == 80:
folder = url.split('/')[1]
filename = url.split('/')[-1]
return "{}{}/{}".format(s... | from django.conf import settings
from wagtail.wagtailcore.models import Site
def build_document_url(url):
site = Site.objects.get(is_default_site=True)
if site.port == 80:
folder = url.split('/')[1]
filename = url.split('/')[-1]
return "{}{}/{}".format(settings.MEDIA_URL, folder, filen... | agpl-3.0 | Python |
e40080823cd26252b90cc24e56a8d76c18f85688 | Remove taggit auto import core | jeanmask/opps,jeanmask/opps,opps/opps,williamroot/opps,jeanmask/opps,williamroot/opps,YACOWS/opps,YACOWS/opps,jeanmask/opps,opps/opps,williamroot/opps,YACOWS/opps,williamroot/opps,YACOWS/opps,opps/opps,opps/opps | opps/core/__init__.py | opps/core/__init__.py | # -*- coding: utf-8 -*-
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
from appconf import AppConf
trans_app_label = _('Core')
class OppsCoreConf(AppConf):
DEFAULT_URLS = ('127.0.0.1', 'localhost',)
SHORT = 'googl'
SHORT_URL = 'googl.short.GooglUrlShort'
CH... | # -*- coding: utf-8 -*-
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
from appconf import AppConf
trans_app_label = _('Core')
class OppsCoreConf(AppConf):
DEFAULT_URLS = ('127.0.0.1', 'localhost',)
SHORT = 'googl'
SHORT_URL = 'googl.short.GooglUrlShort'
CH... | mit | Python |
289853d51638993405c9773ca5677ceedbdadad8 | Update to version 0.6.0 | williamjacksn/python-rainwave-client | rainwaveclient/__init__.py | rainwaveclient/__init__.py | from __future__ import unicode_literals
__setup_name__ = 'python-rainwave-client'
__version__ = '0.6.0'
__author__ = 'William Jackson'
__author_email__ = 'william@subtlecoolness.com'
__url__ = 'https://github.com/williamjacksn/python-rainwave-client'
__description__ = 'Python client library for Rainwave'
__keywords__ ... | from __future__ import unicode_literals
__setup_name__ = 'python-rainwave-client'
__version__ = '0.5'
__author__ = 'William Jackson'
__author_email__ = 'william@subtlecoolness.com'
__url__ = 'https://github.com/williamjacksn/python-rainwave-client'
__description__ = 'Python client library for Rainwave'
__keywords__ = ... | mit | Python |
5328f68fb6ef9b2cec8253c1bd738b82460a6ac8 | Remove deprecated outstream dulwich option | Stvad/CrowdAnki,Stvad/CrowdAnki,Stvad/CrowdAnki | crowd_anki/github/github_importer.py | crowd_anki/github/github_importer.py | from aqt import QInputDialog
from dulwich import porcelain
from dulwich.errors import NotGitRepository, GitProtocolError
from ..config.config_settings import ConfigSettings
from ..importer.anki_importer import AnkiJsonImporter
from ..utils.notifier import AnkiModalNotifier
BRANCH_NAME = "master"
def get_repository_... | from aqt import QInputDialog
from dulwich import porcelain
from dulwich.errors import NotGitRepository, GitProtocolError
from ..config.config_settings import ConfigSettings
from ..importer.anki_importer import AnkiJsonImporter
from ..utils.notifier import AnkiModalNotifier
BRANCH_NAME = "master"
def get_repository_... | mit | Python |
751bebd953b60d5e2521c1612d284fb2079f41fe | change SOLVE_HOST to SOLVE_DOMAIN | solvebio/solvebio-python,solvebio/solvebio-python,solvebio/solvebio-python | solve/core/__init__.py | solve/core/__init__.py | """
Copyright (c) 2013 `Solve, Inc. <http://www.solvebio.com>`_. All rights reserved.
"""
import os
SOLVE_DOMAIN = os.environ.get('SOLVE_HOST', 'solvebio.com')
API_HOST = 'api.%s' % SOLVE_DOMAIN
HELP_HOST = 'help.%s' % SOLVE_DOMAIN
| """
Copyright (c) 2013 `Solve, Inc. <http://www.solvebio.com>`_. All rights reserved.
"""
import os
SOLVE_HOST = os.environ.get('SOLVE_HOST', 'solvebio.com')
API_HOST = 'api.%s' % SOLVE_HOST
HELP_HOST = 'help.%s' % SOLVE_HOST
| mit | Python |
4a87a571f3b70f8494ef13f8933776feebb566db | fix import error | will7200/Yugioh-bot | tests/modes/test_vagabondBattle.py | tests/modes/test_vagabondBattle.py | from concurrent.futures import ThreadPoolExecutor
from unittest import TestCase
import asyncio
import os
import cv2
from bot.duel_links_runtime import DuelLinkRunTime
from modes.Battle import VagabondBattle, NPCBattle
from providers import Nox, Steam
from providers.duellinks import DuelLinksInfo
from utils.common i... | from concurrent.futures import ThreadPoolExecutor
from unittest import TestCase
import asyncio
import os
import cv2
from duel_links_runtime import DuelLinkRunTime
from modes.Battle import VagabondBattle, NPCBattle
from providers import Nox, Steam
from providers.duellinks import DuelLinksInfo
from utils.common impor... | mit | Python |
9975bffa1131618067196c3368d18d876c230b52 | add development status Alpha | OCA/operating-unit,OCA/operating-unit | account_asset_operating_unit_access_all/__manifest__.py | account_asset_operating_unit_access_all/__manifest__.py | # Copyright 2021 Ecosoft Co., Ltd. (http://ecosoft.co.th)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Access all OUs' Assets",
"version": "14.0.1.0.0",
"author": "Ecosoft, Odoo Community Association (OCA)",
"category": "Accounting & Finance",
"license": "AGPL-3",... | # Copyright 2021 Ecosoft Co., Ltd. (http://ecosoft.co.th)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Access all OUs' Assets",
"version": "14.0.1.0.0",
"author": "Ecosoft, Odoo Community Association (OCA)",
"category": "Accounting & Finance",
"license": "AGPL-3",... | agpl-3.0 | Python |
2ed15732b3358d6a0196e27467afd5d7664ac8eb | convert to int by using hex first | ethereum/btcrelay,ethereum/btcrelay | test/script/cumul_difficulty.py | test/script/cumul_difficulty.py | import sys
# https://en.bitcoin.it/wiki/Difficulty
DIFFICULTY_1 = 0x00000000FFFF0000000000000000000000000000000000000000000000000000
# based on http://www.righto.com/2014/02/bitcoin-mining-hard-way-algorithms.html#ref3
def targetFromBits(bits):
exp = bits / 0x1000000 # 2**24
mant = bits & 0xffffff
retur... | import sys
# https://en.bitcoin.it/wiki/Difficulty
DIFFICULTY_1 = 0x00000000FFFF0000000000000000000000000000000000000000000000000000
# based on http://www.righto.com/2014/02/bitcoin-mining-hard-way-algorithms.html#ref3
def targetFromBits(bits):
exp = bits / 0x1000000 # 2**24
mant = bits & 0xffffff
retur... | mit | Python |
9ba5c476ec650cb031df13fc0a59bac542aef8cd | remove try | ppqm/ppqm,ppqm/ppqm | ppqm/jupyter.py | ppqm/jupyter.py | """
Wrapper functions for nglviewer and jupyter helper functions
Reference links
- https://birdlet.github.io/2019/10/02/py3dmol_example/
- http://nglviewer.org/nglview/latest/api.html#nglview.RdkitStructure
- http://nglviewer.org/nglview/latest/api.html#nglview.show_rdkit
Notes on nglviewer usage
>>> import nglvie... | """
Wrapper functions for nglviewer and jupyter helper functions
Reference links
- https://birdlet.github.io/2019/10/02/py3dmol_example/
- http://nglviewer.org/nglview/latest/api.html#nglview.RdkitStructure
- http://nglviewer.org/nglview/latest/api.html#nglview.show_rdkit
Notes on nglviewer usage
>>> import nglvie... | mit | Python |
4bf6e1d7d23b435e2329f24da03efc624b6b46c9 | Use standard dict representation for repr of JSonDict. | csadorf/signac,csadorf/signac | signac/core/jsondict.py | signac/core/jsondict.py | # Copyright (c) 2017 The Regents of the University of Michigan
# All rights reserved.
# This software is licensed under the BSD 3-Clause License.
"Dict implementation with backend JSON file."
import os
import errno
import uuid
from .json import json
from .attrdict import SyncedAttrDict
from ..common import six
class... | # Copyright (c) 2017 The Regents of the University of Michigan
# All rights reserved.
# This software is licensed under the BSD 3-Clause License.
"Dict implementation with backend JSON file."
import os
import errno
import uuid
from .json import json
from .attrdict import SyncedAttrDict
from ..common import six
class... | bsd-3-clause | Python |
ba97c1e220c273048b73c1db970def87d95a52c3 | Update email and url. | mk23/nurly,mk23/nurly,mk23/nurly,mk23/nurly | server/setup.py | server/setup.py | #!/usr/bin/env python2.7
import sys
from distutils.core import setup
if __name__ == '__main__':
if 'install' in sys.argv or 'sdist' in sys.argv:
from nurly.version import VERSION
else:
VERSION = None
setup(
author='Max Kalika',
author_email='max.kalika+projects@gmail.com',... | #!/usr/bin/env python2.7
import sys
from distutils.core import setup
if __name__ == '__main__':
if 'install' in sys.argv or 'sdist' in sys.argv:
from nurly.version import VERSION
else:
VERSION = None
setup(
author='Max Kalika',
author_email='max@topsy.com',
url='ht... | mit | Python |
5c2f411d28a030ac444972be740d4f142f4d9e88 | Change strategy for handling gnd node in Python: | jefftrull/OnChipInterconnect,jefftrull/OnChipInterconnect | ckt_graph.py | ckt_graph.py | # Graph representation of RC circuits
# Author: Jeff Trull <edaskel@att.net>
# Copyright (c) 2014 Jeffrey E. Trull
#
# 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, inc... | # Graph representation of RC circuits
# Author: Jeff Trull <edaskel@att.net>
# Copyright (c) 2014 Jeffrey E. Trull
#
# 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, inc... | mit | Python |
fc75880d25e153ae1ad0589bf84055b3a4b8911f | Update the minimum version of python to 3.6. | gem5/gem5,gem5/gem5,gem5/gem5,gem5/gem5,gem5/gem5,gem5/gem5,gem5/gem5 | site_scons/site_init.py | site_scons/site_init.py | # Copyright (c) 2013, 2015-2017 ARM Limited
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implementation of the fun... | # Copyright (c) 2013, 2015-2017 ARM Limited
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implementation of the fun... | bsd-3-clause | Python |
0e88d780f48b1aa7cfcbc4c94a9a41c7cc93bfb8 | enable threading for sqlite | MaxMorgenstern/EmeraldAI,MaxMorgenstern/EmeraldAI,MaxMorgenstern/EmeraldAI,MaxMorgenstern/EmeraldAI,MaxMorgenstern/EmeraldAI | EmeraldAI/Logic/Database/SQlite3.py | EmeraldAI/Logic/Database/SQlite3.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
import sqlite3 as lite
from cachetools import cached
from EmeraldAI.Logic.Singleton import Singleton
from EmeraldAI.Logic.Modules import Global
from EmeraldAI.Config.Config import *
from EmeraldAI.Logic.Logger import *
class SQlite3(object):
__metaclass__ = Singleton
... | #!/usr/bin/python
# -*- coding: utf-8 -*-
import sqlite3 as lite
from cachetools import cached
from EmeraldAI.Logic.Singleton import Singleton
from EmeraldAI.Logic.Modules import Global
from EmeraldAI.Config.Config import *
from EmeraldAI.Logic.Logger import *
class SQlite3(object):
__metaclass__ = Singleton
... | apache-2.0 | Python |
9f2f9d817adb5a3771f6dc7de17c7624dbdbfed4 | add check_path_exist in utils | tankywoo/simiki,tankywoo/simiki,9p0le/simiki,zhaochunqi/simiki,zhaochunqi/simiki,9p0le/simiki,9p0le/simiki,zhaochunqi/simiki,tankywoo/simiki | simiki/utils.py | simiki/utils.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
from os import path as osp
RESET_COLOR = "\033[0m"
COLOR_CODES = {
"debug" : "\033[1;34m", # blue
"info" : "\033[1;32m", # green
"warning" : "\033[1;33m", # yellow
"error" : "\033[1;31m", # red
"critical" : "\033... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
RESET_COLOR = "\033[0m"
COLOR_CODES = {
"debug" : "\033[1;34m", # blue
"info" : "\033[1;32m", # green
"warning" : "\033[1;33m", # yellow
"error" : "\033[1;31m", # red
"critical" : "\033[1;41m", # background red
}... | mit | Python |
3e33849ded2c69760ce93b4b1e9ab8094904040f | Implement __getattr__ to reduce code | CubicComet/exercism-python-solutions | space-age/space_age.py | space-age/space_age.py | class SpaceAge(object):
YEARS = {"on_earth": 1,
"on_mercury": 0.2408467,
"on_venus": 0.61519726,
"on_mars": 1.8808158,
"on_jupiter": 11.862615,
"on_saturn": 29.447498,
"on_uranus": 84.016846,
"on_neptune": 164.79132}
def... | class SpaceAge(object):
def __init__(self, seconds):
self.seconds = seconds
@property
def years(self):
return self.seconds/31557600
def on_earth(self):
return round(self.years, 2)
def on_mercury(self):
return round(self.years/0.2408467, 2)
def on_venus(self):
... | agpl-3.0 | Python |
486d3ab08858c2a872732f0efd82fe2fb0054366 | Change the new endpoint function name | pahumadad/raspi-relay-api | relay_api/api/main.py | relay_api/api/main.py | from flask import Flask
import relay_api.api.backend as backend
server = Flask(__name__)
backend.init_relays()
@server.route("/relay-api/relays/", methods=["GET"])
def get_all_relays():
js = backend.get_all_relays()
return js, 200
@server.route("/relay-api/relays/<relay_name>", methods=["GET"])
def get_r... | from flask import Flask
import relay_api.api.backend as backend
server = Flask(__name__)
backend.init_relays()
@server.route("/relay-api/relays/", methods=["GET"])
def get_all_relays():
js = backend.get_all_relays()
return js, 200
@server.route("/relay-api/relays/<relay_name>", methods=["GET"])
def get_r... | mit | Python |
15a5e6c1aca706330147475984848dfc33fd1a9d | Fix test so that it works with both CMS and LMS settings | nanolearningllc/edx-platform-cypress,jjmiranda/edx-platform,SivilTaram/edx-platform,olexiim/edx-platform,eduNEXT/edx-platform,bdero/edx-platform,olexiim/edx-platform,nanolearningllc/edx-platform-cypress-2,cyanna/edx-platform,rismalrv/edx-platform,don-github/edx-platform,unicri/edx-platform,xuxiao19910803/edx-platform,U... | common/djangoapps/mitxmako/tests.py | common/djangoapps/mitxmako/tests.py | from django.test import TestCase
from django.test.utils import override_settings
from django.core.urlresolvers import reverse
from django.conf import settings
from mitxmako.shortcuts import marketing_link
from mock import patch
class ShortcutsTests(TestCase):
"""
Test the mitxmako shortcuts file
"""
... | from django.test import TestCase
from django.test.utils import override_settings
from django.core.urlresolvers import reverse
from django.conf import settings
from mitxmako.shortcuts import marketing_link
from mock import patch
class ShortcutsTests(TestCase):
"""
Test the mitxmako shortcuts file
"""
... | agpl-3.0 | Python |
f9b687a016c067d4509fee7cc39316c27d238a8d | Simplify test_handle_modeladmin | incuna/feincms-extensions,incuna/feincms-extensions | feincms_extensions/tests/test_prepared_date.py | feincms_extensions/tests/test_prepared_date.py | from django.contrib.admin.sites import AdminSite
from django.test import TestCase
from feincms.module.page.admin import PageAdmin
from feincms.module.page.models import Page
from .factories import PageFactory
class MockRequest(object):
pass
class TestExtension(TestCase):
def test_prepared_date_empty(self):... | from django.test import TestCase
from feincms.module.page.admin import PageAdmin
from .factories import PageFactory
class TestExtension(TestCase):
def test_prepared_date_empty(self):
page = PageFactory.create()
self.assertEqual(page.prepared_date, '')
def test_set_prepared_date(self):
... | bsd-2-clause | Python |
29802ae348c95dbbfc15bab7a1d9ab4473076c8e | Make client configurable | tylertreat/gatling,tylertreat/gatling,tylertreat/gatling | client.py | client.py | import socket
import struct
DEFAULT_HOST = 'localhost'
DEFAULT_PORT = 9999
SUBSCRIBE = 0
UNSUBSCRIBE = 1
PUBLISH = 2
class Client(object):
def __init__(self):
self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
def connect(self, host=DEFAULT_HOST, port=DEFAULT_PORT):
self.sock... | import socket
import struct
SUBSCRIBE = 0
UNSUBSCRIBE = 1
PUBLISH = 2
class Client(object):
def __init__(self):
self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
def connect(self):
self.socket.connect(('localhost', 9999))
def disconnect(self):
self.socket.close()... | apache-2.0 | Python |
0c24bb0a422a816b4e6909e458bb1bbbfed61720 | Add check for `micawber` existance in `oembeditem` plugin. | edoburu/django-fluent-contents,ixc/django-fluent-contents,django-fluent/django-fluent-contents,pombredanne/django-fluent-contents,django-fluent/django-fluent-contents,jpotterm/django-fluent-contents,edoburu/django-fluent-contents,pombredanne/django-fluent-contents,edoburu/django-fluent-contents,django-fluent/django-flu... | fluent_contents/plugins/oembeditem/__init__.py | fluent_contents/plugins/oembeditem/__init__.py | VERSION = (0, 1, 0)
# Do some version checking
try:
import micawber
except ImportError:
raise ImportError("The 'micawber' package is required to use the 'oembeditem' plugin.")
| apache-2.0 | Python | |
e94e6922041b7aad62123c351059a6b8ccfbb8aa | Correct cursor test | fuziontech/sentry,hongliang5623/sentry,llonchj/sentry,looker/sentry,kevinlondon/sentry,mitsuhiko/sentry,ifduyue/sentry,mvaled/sentry,nicholasserra/sentry,JackDanger/sentry,Natim/sentry,BayanGroup/sentry,BayanGroup/sentry,gg7/sentry,ifduyue/sentry,imankulov/sentry,pauloschilling/sentry,jean/sentry,jokey2k/sentry,ifduyue... | tests/sentry/utils/test_cursors.py | tests/sentry/utils/test_cursors.py | from __future__ import absolute_import
import math
from mock import Mock
from sentry.utils.cursors import build_cursor, Cursor
def build_mock(**attrs):
obj = Mock()
for key, value in attrs.items():
setattr(obj, key, value)
obj.__repr__ = lambda x: repr(attrs)
return obj
def test_build_cur... | from __future__ import absolute_import
from mock import Mock
from sentry.utils.cursors import build_cursor, Cursor
def build_mock(**attrs):
obj = Mock()
for key, value in attrs.items():
setattr(obj, key, value)
obj.__repr__ = lambda x: repr(attrs)
return obj
def test_build_cursor():
ev... | bsd-3-clause | Python |
06897fd03d7a31185c976566fa2190c3963d0a91 | fix boolean logic *cough* | tomster/briefkasten,tomster/briefkasten,tomster/briefkasten,tomster/briefkasten | deployment/jailhost.py | deployment/jailhost.py | # coding: utf-8
from fabric import api as fab
from fabric.api import env, task
from bsdploy.fabfile_mfsbsd import bootstrap as mfsbootstrap
from ploy.common import yesno
from ploy.config import value_asbool
AV = None
# hide stdout by default
# from fabric.state import output
# output['stdout'] = False
@task
def boo... | # coding: utf-8
from fabric import api as fab
from fabric.api import env, task
from bsdploy.fabfile_mfsbsd import bootstrap as mfsbootstrap
from ploy.common import yesno
from ploy.config import value_asbool
AV = None
# hide stdout by default
# from fabric.state import output
# output['stdout'] = False
@task
def boo... | bsd-3-clause | Python |
9f181f7fa8a62e7dc5940f7b8672df563202caf0 | add slug unique from duplicated migration fix #457 | llazzaro/django-scheduler,llazzaro/django-scheduler,llazzaro/django-scheduler | schedule/migrations/0008_gfk_index.py | schedule/migrations/0008_gfk_index.py | from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("contenttypes", "0002_remove_content_type_name"),
("schedule", "0007_merge_text_fields"),
]
operations = [
migrations.AlterField(
model_name="calendarrelation",
... | from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("contenttypes", "0002_remove_content_type_name"),
("schedule", "0007_merge_text_fields"),
]
operations = [
migrations.AlterField(
model_name="calendarrelation",
... | bsd-3-clause | Python |
fcbd98295f2271199115464c2be7359960df1f0f | Use lower() in replace_space_with_dash filter. | akatsoulas/coss,akatsoulas/coss,akatsoulas/coss,akatsoulas/coss | coss/base/templatetags/coss_tags.py | coss/base/templatetags/coss_tags.py | from django import template
from django.conf import settings
from django.utils.http import urlencode
from django.templatetags.static import static
register = template.Library()
@register.assignment_tag(takes_context=True)
def get_site_root(context):
return context['request'].site.root_page
@register.inclusion_... | from django import template
from django.conf import settings
from django.utils.http import urlencode
from django.templatetags.static import static
register = template.Library()
@register.assignment_tag(takes_context=True)
def get_site_root(context):
return context['request'].site.root_page
@register.inclusion_... | mpl-2.0 | Python |
1b0871e2a7b439583bbabf7ee4db70ad0381961e | change by rpc | blahgeek/python-sdk,qiniu/python-sdk,forrest-mao/python-sdk,weilaihui/tornado-qiniu,jemygraw/python-sdk | qiniu/rsf.py | qiniu/rsf.py | # -*- coding: utf-8 -*-
import auth.digest
import conf
import urllib
EOF = 'EOF'
class Client(object):
conn = None
def __init__(self, mac=None):
if mac is None:
mac = auth.digest.Mac()
self.conn = auth.digest.Client(host=conf.RSF_HOST, mac=mac)
def list_prefix(self, bucket, ... | # -*- coding: utf-8 -*-
import auth.digest
import conf
import urllib
EOF = 'EOF'
class Client(object):
conn = None
def __init__(self, mac=None):
if mac is None:
mac = auth.digest.Mac()
self.conn = auth.digest.Client(host=conf.RSF_HOST, mac=mac)
def list_prefix(self, bucket, ... | mit | Python |
9d028b26624a8f8f8e496c1c247c0954fefb9c26 | Fix crashes | Difrex/azot | azot/X.py | azot/X.py | from Xlib import display
# Get screen resolution
def get_geometry():
while 1:
try:
width = display.Display().screen().width_in_pixels
height = display.Display().screen().height_in_pixels
return {"x": width, "y": height}
except:
pass
# G... | from Xlib import display
# Get screen resolution
def get_geometry():
try:
width = display.Display().screen().width_in_pixels
height = display.Display().screen().height_in_pixels
return {"x": width, "y": height}
except:
get_geometry()
# Get mouse cursor position
def ge... | bsd-3-clause | Python |
6690479e46c9138c6f57ce9415b0429175545e96 | FIX in lot name_get to show location with the stock | ingadhoc/stock | stock_transfer_restrict_lot/models/stock_production_lot.py | stock_transfer_restrict_lot/models/stock_production_lot.py | # -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
from openerp import models, fields, api
class St... | # -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
from openerp import models, fields, api
class St... | agpl-3.0 | Python |
f02f52d570d0178dfe37931b2706f47131828c34 | Disable querystring auth. | mblayman/lcp,mblayman/lcp,mblayman/lcp | conductor/settings/production.py | conductor/settings/production.py | from conductor.settings.base import * # noqa
# Let's be clear that DEBUG is off.
DEBUG = False
DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'
EMAIL_BACKEND = 'anymail.backends.mailgun.EmailBackend'
SILENCED_SYSTEM_CHECKS = [
# HSTS is set with the Nginx load balancer so the app server
# ... | from conductor.settings.base import * # noqa
# Let's be clear that DEBUG is off.
DEBUG = False
DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'
EMAIL_BACKEND = 'anymail.backends.mailgun.EmailBackend'
SILENCED_SYSTEM_CHECKS = [
# HSTS is set with the Nginx load balancer so the app server
# ... | bsd-2-clause | Python |
637ad73ffdc44e7e37b4e1f1621f420ca80102b5 | Deal with TODO comment in zun.common.config.py | kevin-zhaoshuai/zun,kevin-zhaoshuai/zun,kevin-zhaoshuai/zun | zun/common/config.py | zun/common/config.py | # Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# Copyright 2012 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the ... | # Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# Copyright 2012 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the ... | apache-2.0 | Python |
f68a473bece5177f56a079754dcbcab45daab7bd | Sort image list | panoptes/POCS,AstroHuntsman/POCS,joshwalawender/POCS,AstroHuntsman/POCS,panoptes/POCS,joshwalawender/POCS,AstroHuntsman/POCS,panoptes/POCS,AstroHuntsman/POCS,joshwalawender/POCS,panoptes/POCS | admin/web/uimodules.py | admin/web/uimodules.py | """ Collection of UI modules for the admin web interface
"""
import tornado
import glob
from astropy.time import Time
from panoptes.utils import load_config
config = load_config()
class MountControl(tornado.web.UIModule):
""" UI modules for controlling the MountControl
The mount is controlled by exchang... | """ Collection of UI modules for the admin web interface
"""
import tornado
import glob
from astropy.time import Time
from panoptes.utils import load_config
config = load_config()
class MountControl(tornado.web.UIModule):
""" UI modules for controlling the MountControl
The mount is controlled by exchang... | mit | Python |
a02791231dcc5ecd5bebbb698719e47bd01c68ed | Revert "Expose __version__ from the top level cgpm module." | probcomp/cgpm,probcomp/cgpm | src/__init__.py | src/__init__.py | # -*- coding: utf-8 -*-
# Copyright (c) 2015-2016 MIT Probabilistic Computing Project
# 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
# Unles... | # -*- coding: utf-8 -*-
# Copyright (c) 2015-2016 MIT Probabilistic Computing Project
# 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
# Unles... | apache-2.0 | Python |
2c49c863297fa676653103f5aef6153efb1fb1a1 | Make --scm-type=manual on projects work. | docschick/tower-cli,AlanCoding/tower-cli,ansible/tower-cli,AlanCoding/tower-cli,nitzmahone/tower-cli,ansible/tower-cli,jangsutsr/tower-cli,tomfotherby/tower-cli,cedub/tower-cli,chrismeyersfsu/tower-cli | lib/tower_cli/resources/project.py | lib/tower_cli/resources/project.py | # Copyright 2014, Ansible, Inc.
# Luke Sneeringer <lsneeringer@ansible.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 requi... | # Copyright 2014, Ansible, Inc.
# Luke Sneeringer <lsneeringer@ansible.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 requi... | apache-2.0 | Python |
56e18a07ebf805878c5a18b0a89e121cf5053995 | add "create children" flag to `digest` command | hoover/snoop,hoover/snoop | maldini/management/commands/digest.py | maldini/management/commands/digest.py | import simplejson as json
from django.core.management.base import BaseCommand
from maldini import models
from maldini import digest
class Command(BaseCommand):
help = "Digest one document"
def add_arguments(self, parser):
parser.add_argument('document_id', type=int)
parser.add_argument('-c', ... | import simplejson as json
from django.core.management.base import BaseCommand
from maldini import models
from maldini.digest import digest
class Command(BaseCommand):
help = "Digest one document"
def add_arguments(self, parser):
parser.add_argument('document_id', type=int)
def handle(self, docum... | mit | Python |
531aeb6c3655b72fbef73ddbeaf49039db41d7c5 | fix mapper | dragoon/kilogram,dragoon/kilogram,dragoon/kilogram | mapreduce/filter/mapper_postfilter.py | mapreduce/filter/mapper_postfilter.py | #!/usr/bin/env python
import sys
from kilogram.lang import number_replace
import re
MULTI_PUNCT_RE = re.compile(r'[^a-zA-Z0-9_\s]{2,}')
# input comes from STDIN (standard input)
for line in sys.stdin:
# remove leading and trailing whitespace
line = line.strip()
# split the line into words
orig_ngram,... | #!/usr/bin/env python
import sys
from kilogram.lang import number_replace
import re
MULTI_PUNCT_RE = re.compile(r'[^a-zA-Z0-9_\s]{2,}')
# input comes from STDIN (standard input)
for line in sys.stdin:
# remove leading and trailing whitespace
line = line.strip()
# split the line into words
orig_ngram,... | apache-2.0 | Python |
5fe0deaf1141b8ec442c2ffca24eb0eed1e2e913 | replace '_START_' with <s> | qe-team/marmot | marmot/util/ngram_window_extractor.py | marmot/util/ngram_window_extractor.py | #!/usr/bin/env python
#encoding: utf-8
'''
@author: Chris Hokamp
@contact: chris.hokamp@gmail.com
'''
# this only finds the first instance of the token in the sentence (see the idx= keyword arg of the extract_window function)
def locate_token(token, sentence):
try:
i = sentence.index(token)
retur... | #!/usr/bin/env python
#encoding: utf-8
'''
@author: Chris Hokamp
@contact: chris.hokamp@gmail.com
'''
# this only finds the first instance of the token in the sentence (see the idx= keyword arg of the extract_window function)
def locate_token(token, sentence):
try:
i = sentence.index(token)
retur... | isc | Python |
9b348c5ee6af550db8ce970b045628f4e841097d | Add coverage choices to binCov | RCollins13/WGD,RCollins13/WGD,RCollins13/WGD | binCov.py | binCov.py | #!/usr/bin/env python
# Copyright (c) 2016 Ryan Collins <rcollins@chgr.mgh.harvard.edu>
# Distributed under terms of the MIT license.
"""
Calculates non-duplicate primary-aligned binned coverage of a chromosome from an input BAM file
"""
#Import libraries
import argparse
import sys
from collections import defaultdic... | #!/usr/bin/env python
# Copyright (c) 2016 Ryan Collins <rcollins@chgr.mgh.harvard.edu>
# Distributed under terms of the MIT license.
"""
Calculates non-duplicate primary-aligned binned coverage of a chromosome from an input BAM file
"""
#Import libraries
import argparse
import sys
from collections import defaultdic... | mit | Python |
3c6f14fe4e05c012282613bb64e3f5fadeb551dd | remove app before running tests | dejavu1988/ProviGen,TimotheeJeannin/ProviGen,tasomaniac/ProviGen | ProviGenSample/test/monkeyrunner/simple-test.py | ProviGenSample/test/monkeyrunner/simple-test.py | # Imports the monkeyrunner modules used by this program
import sys, os
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
def ensure_dir(f):
d = os.path.dirname(f)
if not os.path.exists(d):
os.makedirs(d)
def screenshot(n, deviceName, device):
# Takes a screenshot
result = device... | # Imports the monkeyrunner modules used by this program
import sys, os
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
def ensure_dir(f):
d = os.path.dirname(f)
if not os.path.exists(d):
os.makedirs(d)
def screenshot(n, deviceName, device):
# Takes a screenshot
result = device... | mit | Python |
d0622a9c018959c6bd7295a57f8f9850085184cd | Add delta_from_schedule | yasyf/bcferries | bcferries/scheduled.py | bcferries/scheduled.py | from abstract import BCFerriesAbstractObject
from helpers import to_int
import dateutil.parser, datetime, re
time_regex = re.compile(r'(\d) HOURS?(?: (\d{1,2}) MINUTES?)?')
class BCFerriesScheduledCrossing(BCFerriesAbstractObject):
def __init__(self, name, sailing_time, time_row):
super(BCFerriesScheduledCrossi... | from abstract import BCFerriesAbstractObject
from helpers import to_int
import dateutil.parser, datetime, re
time_regex = re.compile(r'(\d) HOURS?(?: (\d{1,2}) MINUTES?)?')
class BCFerriesScheduledCrossing(BCFerriesAbstractObject):
def __init__(self, name, sailing_time, time_row):
super(BCFerriesScheduledCrossi... | mit | Python |
10c226e89dee22b54264b1fa4f3e53d8d0495a01 | remove squeeze | marioyc/gans-eval | common.py | common.py | import numpy as np
import tensorflow as tf
import tensorflow.contrib.layers as layers
import tensorflow.contrib.slim as slim
def sample_mixture_of_gaussians(n_mixture=8, std=0.01, radius=1):
angles = np.linspace(0, 2 * np.pi, n_mixture + 1)[:-1]
x = radius * np.cos(angles)
y = radius * np.sin(angles)
... | import numpy as np
import tensorflow as tf
import tensorflow.contrib.layers as layers
import tensorflow.contrib.slim as slim
def sample_mixture_of_gaussians(n_mixture=8, std=0.01, radius=1):
angles = np.linspace(0, 2 * np.pi, n_mixture + 1)[:-1]
x = radius * np.cos(angles)
y = radius * np.sin(angles)
... | mit | Python |
f0aae84e86c7e5d7d273f46218064f507fdc7552 | bump version | nluedtke/brochat-bot | common.py | common.py | VERSION_YEAR = 2018
VERSION_MONTH = 6
VERSION_DAY = 4
VERSION_REV = 0
whos_in = None
twitter = None
users = {}
twilio_client = None
ARGS = {}
smmry_api_key = None
pubg_api_key = None
pubg_api = None
# Variable hold trumps last tweet id
last_id = 0
trump_chance_roll_rdy = False
# Runtime stats
duels_conducted = 0
ite... | VERSION_YEAR = 2018
VERSION_MONTH = 6
VERSION_DAY = 2
VERSION_REV = 0
whos_in = None
twitter = None
users = {}
twilio_client = None
ARGS = {}
smmry_api_key = None
pubg_api_key = None
pubg_api = None
# Variable hold trumps last tweet id
last_id = 0
trump_chance_roll_rdy = False
# Runtime stats
duels_conducted = 0
ite... | mit | Python |
8d9ca3cf119e58b666a9d71e765b788515a4e043 | Refactor columns assertion | datasciencebr/serenata-toolbox | tests/journey/test_chamber_of_deputies_deputies_dataset.py | tests/journey/test_chamber_of_deputies_deputies_dataset.py | import os
from unittest import main, skipIf, TestCase
import numpy as np
from serenata_toolbox.chamber_of_deputies.deputies_dataset import DeputiesDataset
class TestDeputiesDataset(TestCase):
def setUp(self):
self.subject = DeputiesDataset()
def test_fetch(self):
df = self.subject.fetch()
... | import os
from unittest import main, skipIf, TestCase
import numpy as np
from serenata_toolbox.chamber_of_deputies.deputies_dataset import DeputiesDataset
class TestDeputiesDataset(TestCase):
def setUp(self):
self.subject = DeputiesDataset()
def test_fetch(self):
df = self.subject.fetch()
... | mit | Python |
bba6ffdca5a27e32d52d17c0c1e0e371e3867393 | fix robot extension warning (via #343) | allure-framework/allure-python | allure-robotframework/test/run_robot_library.py | allure-robotframework/test/run_robot_library.py | import os
from tempfile import mkdtemp
from robot import run
from multiprocessing import Process
from allure_commons_test.report import AllureReport
def run_robot_with_allure(*args, **kwargs):
root = os.path.abspath(os.path.join(__file__, "..", ".."))
targets = map(lambda target: os.path.join(root, target), a... | import os
from tempfile import mkdtemp
from robot import run
from multiprocessing import Process
from allure_commons_test.report import AllureReport
def run_robot_with_allure(*args, **kwargs):
root = os.path.abspath(os.path.join(__file__, "..", ".."))
targets = map(lambda target: os.path.join(root, target), a... | apache-2.0 | Python |
d969cc754a606a5563c8681c2bf7cb1207258a80 | Use signals for DS18B20 | dashford/sentinel | src/Sensors/DS18B20.py | src/Sensors/DS18B20.py | import logging
from blinker import signal
from ds18b20 import DS18B20 as Sensor
class DS18B20:
def __init__(self, address):
logging.info('Initialising DS18B20 sensor with address {}'.format(address))
self._sensor = Sensor(sensor_id=address)
def get_temperature(self, mqtt_details):
"... | import logging
from ds18b20 import DS18B20 as Sensor
from src.MQTT.Message.Message import Message
from src.MQTT.Message.Formatters.JsonFormatter import JsonFormatter
class DS18B20:
def __init__(self, address):
self._sensor = Sensor(sensor_id=address)
def get_temperature(self, mqtt_client, event_dis... | mit | Python |
1a46722396e38fcbdd2315a0c802fbb57e0c95ce | Extend updateApi warning with timestamp check. | androidx/androidx,AndroidX/androidx,AndroidX/androidx,AndroidX/androidx,AndroidX/androidx,AndroidX/androidx,AndroidX/androidx,AndroidX/androidx,androidx/androidx,androidx/androidx,AndroidX/androidx,AndroidX/androidx,androidx/androidx,androidx/androidx,androidx/androidx,androidx/androidx,AndroidX/androidx,androidx/andro... | development/apilint.py | development/apilint.py | #!/usr/bin/python
#
# Copyright 2019, The Android Open Source Project
#
# 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 b... | #!/usr/bin/python
#
# Copyright 2019, The Android Open Source Project
#
# 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 b... | apache-2.0 | Python |
81e1c818016930a6a4f7345d74e6b36f70ce46bd | disable geometry_msgs, because they aren't in ross_comm | braincorp/robustus,braincorp/robustus | robustus/tests/test_ros.py | robustus/tests/test_ros.py | # =============================================================================
# COPYRIGHT 2013 Brain Corporation.
# License under MIT license (see LICENSE file)
# =============================================================================
import pytest
import logging
from robustus.detail import perform_standard_te... | # =============================================================================
# COPYRIGHT 2013 Brain Corporation.
# License under MIT license (see LICENSE file)
# =============================================================================
import pytest
import logging
from robustus.detail import perform_standard_te... | mit | Python |
8d525f0ecc09691e4592d5ca5a164b9a7eedf440 | Update the css-to-xpath selector converter | seleniumbase/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase | seleniumbase/fixtures/css_to_xpath.py | seleniumbase/fixtures/css_to_xpath.py | """
Convert CSS selectors into XPath selectors
"""
from cssselect.xpath import GenericTranslator, is_non_whitespace
class ConvertibleToCssTranslator(GenericTranslator):
"""An implementation of :py:class:`cssselect.GenericTranslator` with
XPath output that more readily converts back to CSS selectors.
The ... | """
Convert CSS selectors into XPath selectors
"""
from cssselect.xpath import GenericTranslator, is_non_whitespace
class ConvertibleToCssTranslator(GenericTranslator):
"""An implementation of :py:class:`cssselect.GenericTranslator` with
XPath output that more readily converts back to CSS selectors.
The ... | mit | Python |
6501e968ca5ee47167c686e372aee7e65e9b47e2 | use string interpolation | alphagov/digitalmarketplace-aws,alphagov/digitalmarketplace-aws,alphagov/digitalmarketplace-aws | db-backup/upload-dump-to-s3.py | db-backup/upload-dump-to-s3.py | #!/usr/bin/env python
import os
import json
import subprocess
def upload_dump_to_s3():
s3_post_url_data = json.loads(os.environ['S3_POST_URL_DATA'])
dump_file = "/app/{}".format(os.environ['DUMP_FILE_NAME'])
url = s3_post_url_data['url']
fields = s3_post_url_data['fields']
curl_args = ['curl', '-... | #!/usr/bin/env python
import os
import json
import subprocess
def upload_dump_to_s3():
s3_post_url_data = json.loads(os.environ['S3_POST_URL_DATA'])
dump_file = "/app/{}".format(os.environ['DUMP_FILE_NAME'])
url = s3_post_url_data['url']
fields = s3_post_url_data['fields']
curl_args = ['curl', '-... | mit | Python |
2f1c5b1873ab0c4b9dfed1249a09ab7a63781bca | bump version | trbs/bucky,CollabNet/puppet-bucky,trbs/bucky,Hero1378/bucky,JoseKilo/bucky,CollabNet/puppet-bucky,ewdurbin/bucky,Hero1378/bucky,CollabNet/puppet-bucky,dimrozakis/bucky,ewdurbin/bucky,jsiembida/bucky3,JoseKilo/bucky,dimrozakis/bucky,CollabNet/puppet-bucky | bucky/__init__.py | bucky/__init__.py | # -*- coding: utf-8 -
#
# 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
... | # -*- coding: utf-8 -
#
# 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
... | apache-2.0 | Python |
8207d86b7b2a6e1f81454eefea4784d89c8674a8 | Use different usernames for each test. by: Glenn, Giles | pythonanywhere/resolver_test | resolver_test/django_test.py | resolver_test/django_test.py | # Copyright (c) 2017 PythonAnywhere LLP.
# All Rights Reserved
#
from urlparse import urljoin
from mock import Mock
from resolver_test import ResolverTestMixins
import django
from django.conf import settings
from django.contrib.auth.models import AnonymousUser, User
from django.http import HttpRequest
class Res... | # Copyright (c) 2011 Resolver Systems Ltd.
# All Rights Reserved
#
from urlparse import urljoin
from mock import Mock
from resolver_test import ResolverTestMixins
import django
from django.conf import settings
from django.contrib.auth.models import AnonymousUser, User
from django.http import HttpRequest
class R... | mit | Python |
e87742688e16321c6a46ca9cf093381bce192d86 | Update for changes to zwave package. | tomwilkie/awesomation,tomwilkie/awesomation,tomwilkie/awesomation,tomwilkie/awesomation,tomwilkie/awesomation | src/pi/zwave.py | src/pi/zwave.py | """ZWave device proxy code."""
import logging
import sys
import libopenzwave
CONFIG = '/usr/local/etc/openzwave'
class ZWave(object):
"""ZWave proxy object."""
def __init__(self, device, callback):
self._device = device
self._callback = callback
self._options = libopenzwave.PyOptions()
self._... | """ZWave device proxy code."""
import logging
import sys
import libopenzwave
CONFIG = '/usr/local/share/python-openzwave/config'
class ZWave(object):
"""ZWave proxy object."""
def __init__(self, device, callback):
self._device = device
self._callback = callback
self._options = libopenzwave.PyOpti... | mit | Python |
abc5384bacdee42299e8f0489ee1f626a2a3852a | Add more doc comments. | HXLStandard/hxl-proxy,HXLStandard/hxl-proxy,HXLStandard/hxl-proxy,HXLStandard/hxl-proxy | hxl_proxy/caching.py | hxl_proxy/caching.py | """ Context managers for caching """
import hxl_proxy, logging, os, redis, requests_cache
logger = logging.getLogger(__name__)
""" Python logger for this module """
class input:
"""Context manager for input caching.
Uses the app.config REQUEST_CACHE_* variables, including
REQUEST_CACHE_TYPE, REQUEST_CA... | """ Context managers for caching """
import hxl_proxy, logging, os, redis, requests_cache
logger = logging.getLogger(__name__)
""" Python logger for this module """
class input:
""" Context manager for input caching. """
def __init__ (self, namespace=None, timeout=None):
""" Temporarily enable input... | unlicense | Python |
758302254107b915867020d8a6575d84c301e29c | Bump to 0.6.1 | aio-libs/aiopg,hyzhak/aiopg,nerandell/aiopg,graingert/aiopg,eirnym/aiopg,luhn/aiopg | aiopg/__init__.py | aiopg/__init__.py | import re
import sys
from collections import namedtuple
from .connection import connect, Connection, TIMEOUT as DEFAULT_TIMEOUT
from .cursor import Cursor
from .pool import create_pool, Pool
__all__ = ('connect', 'create_pool', 'Connection', 'Cursor', 'Pool',
'version', 'version_info', 'DEFAULT_TIMEOUT')
... | import re
import sys
from collections import namedtuple
from .connection import connect, Connection, TIMEOUT as DEFAULT_TIMEOUT
from .cursor import Cursor
from .pool import create_pool, Pool
__all__ = ('connect', 'create_pool', 'Connection', 'Cursor', 'Pool',
'version', 'version_info', 'DEFAULT_TIMEOUT')
... | bsd-2-clause | Python |
23723129f83d00942a201e9c5cdfb179491e44ac | use rq to deal wand, to prevent too many concurrent wand | Answeror/aip,Answeror/aip | aip/imfs/utils.py | aip/imfs/utils.py | def thumbnail(data, kind, width, height):
try:
try:
from ..rq import q
from time import sleep
job = q.enqueue(use_wand, data, kind, width, height)
while job.result is None:
sleep(0.5)
return job.result
except:
re... | import PIL.Image
from io import BytesIO
def thumbnail(data, kind, width, height):
try:
return use_wand(data, kind, width, height)
except:
return use_pil(data, kind, width, height)
def use_pil(data, kind, width, height):
input_stream = BytesIO(data)
pim = PIL.Image.open(input_stream)
... | mit | Python |
8d37aa06f9ff941983aadd81f17e3daaac12bdc0 | Change implementation of new_or_changed | hughdbrown/dictdiffer | dictdiffer/__init__.py | dictdiffer/__init__.py | #coding=utf-8
"""
A dictionary difference calculator
Originally posted as:
http://stackoverflow.com/questions/1165352/fast-comparison-between-two-python-dictionary/1165552#1165552
"""
class DictDiffer(object):
"""
Calculate the difference between two dictionaries as:
(1) items added
(2) items removed
... | #coding=utf-8
"""
A dictionary difference calculator
Originally posted as:
http://stackoverflow.com/questions/1165352/fast-comparison-between-two-python-dictionary/1165552#1165552
"""
class DictDiffer(object):
"""
Calculate the difference between two dictionaries as:
(1) items added
(2) items removed
... | mit | Python |
4e97f1d8860a9ec022148d3386f078190928dc31 | Update good2d.py | hpssjellis/forth-tensorflow,hpssjellis/forth-tensorflow,hpssjellis/forth-tensorflow | rocksetta-examples/good2d.py | rocksetta-examples/good2d.py | import tensorflow as tf
import numpy as np
# Create 100 phony x, y data points in NumPy, y = x * 0.1 + 0.3
x_data = np.random.rand(100).astype("float32")
y_data = x_data * 0.1 + 0.3
# Try to find values for W and b that compute y_data = W * x_data + b
# (We know that W should be 0.1 and b 0.3, but Tensorflow will
# f... | import tensorflow as tf
import numpy as np
# Create 100 phony x, y data points in NumPy, y = x * 0.1 + 0.3
x_data = np.random.rand(100).astype("float32")
y_data = x_data * 0.1 + 0.3
# Try to find values for W and b that compute y_data = W * x_data + b
# (We know that W should be 0.1 and b 0.3, but Tensorflow will
# f... | mit | Python |
4e7ea627c8534d5209494308b43121b6f5e9d94b | fix ipykernel dependency, newer versions are python3-only (#13019) | iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack | var/spack/repos/builtin/packages/py-ipykernel/package.py | var/spack/repos/builtin/packages/py-ipykernel/package.py | # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyIpykernel(PythonPackage):
"""IPython Kernel for Jupyter"""
homepage = "https://pypi... | # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyIpykernel(PythonPackage):
"""IPython Kernel for Jupyter"""
homepage = "https://pypi... | lgpl-2.1 | Python |
6216520e7e23a1eee5396d3019c38b3940d08118 | handle reset channel | pudo/aleph,alephdata/aleph,alephdata/aleph,alephdata/aleph,pudo/aleph,alephdata/aleph,alephdata/aleph,pudo/aleph | aleph/services.py | aleph/services.py | import grpc
from threading import local
from aleph import settings
class ServiceClientMixin(object):
"""Helper mixing to manage the connectivity with a gRPC endpoint."""
SERVICE = None
Error = grpc.RpcError
Status = grpc.StatusCode
@property
def channel(self):
"""Lazily connect to th... | import grpc
from threading import local
from aleph import settings
class ServiceClientMixin(object):
"""Helper mixing to manage the connectivity with a gRPC endpoint."""
SERVICE = None
Error = grpc.RpcError
Status = grpc.StatusCode
@property
def channel(self):
"""Lazily connect to th... | mit | Python |
bd2ddec471d947ce414a007d532bcdbe5da50542 | Allow for timeout to not fail the test | kayhayen/Nuitka,kayhayen/Nuitka,kayhayen/Nuitka,kayhayen/Nuitka | tests/standalone/SocketUsing.py | tests/standalone/SocketUsing.py | # -*- coding: utf-8 -*-
# Copyright 2019, Paweł Kierzkowski, mailto:<pk.pawelo@gmail.com>
#
# Python test originally created or extracted from other peoples work. The
# parts from me are licensed as below. It is at least Free Software where
# it's copied from other people. In these cases, that will norm... | # -*- coding: utf-8 -*-
# Copyright 2019, Paweł Kierzkowski, mailto:<pk.pawelo@gmail.com>
#
# Python test originally created or extracted from other peoples work. The
# parts from me are licensed as below. It is at least Free Software where
# it's copied from other people. In these cases, that will norm... | apache-2.0 | Python |
50cc2ba3353cdd27513999465e854d01823605a4 | Fix the recursion bug in KnowledgeBase after the previous refactor. | f-prettyland/angr,axt/angr,tyb0807/angr,iamahuman/angr,angr/angr,angr/angr,axt/angr,angr/angr,chubbymaggie/angr,schieb/angr,chubbymaggie/angr,f-prettyland/angr,iamahuman/angr,f-prettyland/angr,tyb0807/angr,iamahuman/angr,axt/angr,schieb/angr,chubbymaggie/angr,schieb/angr,tyb0807/angr | angr/knowledge_base.py | angr/knowledge_base.py | """Representing the artifacts of a project."""
from .knowledge_plugins.plugin import default_plugins
class KnowledgeBase(object):
"""Represents a "model" of knowledge about an artifact.
Contains things like a CFG, data references, etc.
"""
def __init__(self, project, obj):
self._project = pr... | """Representing the artifacts of a project."""
from .knowledge_plugins.plugin import default_plugins
class KnowledgeBase(object):
"""Represents a "model" of knowledge about an artifact.
Contains things like a CFG, data references, etc.
"""
def __init__(self, project, obj):
self._project = pr... | bsd-2-clause | Python |
b7ef880f4cde3f5cf32c624e3f044488aea580ce | Add test for DocumentSnapshot.reference | mdowds/python-mock-firestore | tests/test_document_snapshot.py | tests/test_document_snapshot.py | from unittest import TestCase
from mockfirestore import MockFirestore
class TestDocumentSnapshot(TestCase):
def test_documentSnapshot_toDict(self):
fs = MockFirestore()
fs._data = {'foo': {
'first': {'id': 1}
}}
doc = fs.collection('foo').document('first').get()
... | from unittest import TestCase
from mockfirestore import MockFirestore
class TestDocumentSnapshot(TestCase):
def test_documentSnapshot_toDict(self):
fs = MockFirestore()
fs._data = {'foo': {
'first': {'id': 1}
}}
doc = fs.collection('foo').document('first').get()
... | mit | Python |
7c25a871d693eff42e6e39f8b662243b11bbdbfa | Add helper testing functions | boundary/pulse-api-cli,jdgwartney/pulse-api-cli,boundary/pulse-api-cli,jdgwartney/boundary-api-cli,jdgwartney/boundary-api-cli,boundary/boundary-api-cli,boundary/boundary-api-cli,jdgwartney/pulse-api-cli | tests/unit/boundary/cli_test.py | tests/unit/boundary/cli_test.py | #!/usr/bin/env python
#
# Copyright 2015 BMC Software, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | #!/usr/bin/env python
#
# Copyright 2015 BMC Software, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | apache-2.0 | Python |
4b2864a83f8fd1460fa5909b38f8ca85b8163af2 | Use django.utils.six instead | praekelt/jmbo-banner,praekelt/jmbo-banner | banner/templatetags/banner_tags.py | banner/templatetags/banner_tags.py | from django import template
from django.http import Http404
from django.utils import six
from banner.models import Banner
from banner.styles import BANNER_STYLES_MAP
register = template.Library()
@register.tag
def render_banner(parser, token):
tokens = token.split_contents()
if len(tokens) < 2:
rai... | import six
from django import template
from django.http import Http404
from banner.models import Banner
from banner.styles import BANNER_STYLES_MAP
register = template.Library()
@register.tag
def render_banner(parser, token):
tokens = token.split_contents()
if len(tokens) < 2:
raise template.Templ... | bsd-3-clause | Python |
aa00feb359814096521f53f1664b697c962ac98a | Add an export_env_string() defines | dls-controls/pymalcolm,dls-controls/pymalcolm,dls-controls/pymalcolm | malcolm/modules/builtin/defines.py | malcolm/modules/builtin/defines.py | import os
import subprocess
from malcolm.core import method_takes, REQUIRED
from malcolm.modules.builtin.vmetas import StringMeta, NumberMeta
@method_takes(
"name", StringMeta("The name of the defined parameter"), REQUIRED,
"value", StringMeta("The value of the defined parameter"), REQUIRED)
def string(param... | import os
import subprocess
from malcolm.core import method_takes, REQUIRED
from malcolm.modules.builtin.vmetas import StringMeta, NumberMeta
@method_takes(
"name", StringMeta("The name of the defined parameter"), REQUIRED,
"value", StringMeta("The value of the defined parameter"), REQUIRED)
def string(param... | apache-2.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.