commit stringlengths 40 40 | subject stringlengths 1 1.49k | old_file stringlengths 4 311 | new_file stringlengths 4 311 | new_contents stringlengths 1 29.8k | old_contents stringlengths 0 9.9k | lang stringclasses 3
values | proba float64 0 1 |
|---|---|---|---|---|---|---|---|
e9240123541e91145bac29f52ff8f04f412aaf6c | Add reminder to use scope helper in module.py | pycc/module.py | pycc/module.py | from collections import namedtuple
import os
ImportResult = namedtuple('ImportResult', ('module', 'target',))
class Package(object):
"""Contains AST nodes and metadata for modules in a Python package."""
def __init__(self, location):
self.location = os.path.realpath(location)
self.root = o... | from collections import namedtuple
import os
ImportResult = namedtuple('ImportResult', ('module', 'target',))
class Package(object):
"""Contains AST nodes and metadata for modules in a Python package."""
def __init__(self, location):
self.location = os.path.realpath(location)
self.root = o... | Python | 0 |
dccb841600c35ce9b0e93953221088ba11bc2a02 | Fix hard-coded http:// in akvo/iati/ | akvo/iati/exports/org_elements/document_link.py | akvo/iati/exports/org_elements/document_link.py | # -*- coding: utf-8 -*-
# Akvo RSR is covered by the GNU Affero General Public License.
# See more details in the license.txt file located at the root folder of the Akvo RSR module.
# For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.
from lxml import etree
def document_... | # -*- coding: utf-8 -*-
# Akvo RSR is covered by the GNU Affero General Public License.
# See more details in the license.txt file located at the root folder of the Akvo RSR module.
# For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.
from lxml import etree
def document_... | Python | 0.000002 |
1021c07edf6016a8d34e5bfec7a38445aff9cbaf | Rearrange create-or-find-policy logic. | s3same/iam.py | s3same/iam.py | import json
from botocore.exceptions import ClientError
IAMName = 's3same_travis'
def _policy_string(bucket):
return json.dumps({
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"s3:ListBucket"
],
"Effect": "... | import json
from botocore.exceptions import ClientError
IAMName = 's3same_travis'
def _policy_string(bucket):
return json.dumps({
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"s3:ListBucket"
],
"Effect": "... | Python | 0.000004 |
a7d3376d730a04fec533a46a4faefb5c88f618f9 | Add docstring for pymt plugins. | pymt/plugin.py | pymt/plugin.py | """Dynamically find and load plugins.
PyMT plugins are components that expose the CSDMS Basic
Model Interface and provide CSDMS Model Metadata. With
these two things, third-party components can be imported
into the PyMT modeling framework.
By default PyMT searches a package named `csdms`, if
it exists, for possible p... | """Dynamically find and load plugins."""
from __future__ import print_function
__all__ = []
import os
import logging
import importlib
from glob import glob
from .framework.bmi_bridge import bmi_factory
from .babel import setup_babel_environ
def load_plugin(entry_point, callback=None):
"""Load a generic plugin.... | Python | 0 |
2c9e88ee3addf491bb8abfb9b0691b282d5ab6ec | Add todo re: pre-processing name parameter | pynano/base.py | pynano/base.py | import requests
import xmltodict
from .history import NanoHistorySequence as History
from .day import NanoDay
class NanoBase(object):
"""Base object for pynano API objects.
This object implements the common functionality for fetching and processing
API data from the NaNoWriMo API. By default the API is... | import requests
import xmltodict
from .history import NanoHistorySequence as History
from .day import NanoDay
class NanoBase(object):
"""Base object for pynano API objects.
This object implements the common functionality for fetching and processing
API data from the NaNoWriMo API. By default the API is... | Python | 0 |
b51aa47a5b9b0a4b57904049af2e073682f77350 | Add line blocks to docstring for Slot (#167) | pyquil/slot.py | pyquil/slot.py | ##############################################################################
# Copyright 2016-2017 Rigetti Computing
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http... | ##############################################################################
# Copyright 2016-2017 Rigetti Computing
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http... | Python | 0 |
59b95edb27089eb8f6842b9861945310ec71029b | use packaging.version | py/desidatamodel/test/datamodeltestcase.py | py/desidatamodel/test/datamodeltestcase.py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
"""Utility class used by other tests.
"""
import os
import tempfile
import unittest
import logging
import shutil
from packaging import version
from astropy import __version__ as astropyVersion
from desiutil.log import log
from des... | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
"""Utility class used by other tests.
"""
import os
import tempfile
import unittest
import logging
import shutil
from astropy import __version__ as astropyVersion
from desiutil.log import log
from desiutil.test.test_log import Nul... | Python | 0.000001 |
07a4cb667e702a1cbb758a3761ec41b89fa98313 | Add options to python script | python/test.py | python/test.py | #!/usr/bin/env python
# Copyright (C) 2010 Red Hat, Inc.
#
# This is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation; either version 2.1 of
# the License, or (at your option) any later version.
#
# This so... | #!/usr/bin/env python
# Copyright (C) 2010 Red Hat, Inc.
#
# This is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation; either version 2.1 of
# the License, or (at your option) any later version.
#
# This so... | Python | 0.000002 |
4656f7834f2c56f9dffcb775a5c9833304a3a55f | Fix doctests with Python 2 | pyuca/utils.py | pyuca/utils.py | """
utilities for formatting the datastructures used in pyuca.
Useful mostly for debugging output.
"""
from __future__ import unicode_literals
def hexstrings2int(hexstrings):
"""
list of hex strings to list of integers
>>> hexstrings2int(["0000", "0001", "FFFF"])
[0, 1, 65535]
"""
return [in... | """
utilities for formatting the datastructures used in pyuca.
Useful mostly for debugging output.
"""
from __future__ import unicode_literals
def hexstrings2int(hexstrings):
"""
list of hex strings to list of integers
>>> hexstrings2int(["0000", "0001", "FFFF"])
[0, 1, 65535]
"""
return [in... | Python | 0.000056 |
5e2a9fcb24ac36e866846b5735d87c247d05062e | Fix problem of importing when no SQL database is available | pyxray/data.py | pyxray/data.py | """
Current implementation of the database
"""
__all__ = [
'set_default_reference',
'get_default_reference',
'element_atomic_number',
'element_symbol',
'element_name',
'element_atomic_weight',
'element_mass_density_kg_per_m3',
'element_mass_density_g_per_cm3',
'atomic_shell_notation... | """
Current implementation of the database
"""
__all__ = [
'set_default_reference',
'get_default_reference',
'element_atomic_number',
'element_symbol',
'element_name',
'element_atomic_weight',
'element_mass_density_kg_per_m3',
'element_mass_density_g_per_cm3',
'atomic_shell_notation... | Python | 0.000045 |
9d1a44dd85b452430f90e1d5eb2400c9869934b6 | use get_latest() instead of _latest() for #393 | pycqed/instrument_drivers/pq_parameters.py | pycqed/instrument_drivers/pq_parameters.py | from qcodes.instrument.parameter import ManualParameter
from qcodes.utils.validators import Validator, Strings
class InstrumentParameter(ManualParameter):
"""
Args:
name (string): the name of the instrument that one wants to add.
instrument (Optional[Instrument]): the "parent" instrument this... | from qcodes.instrument.parameter import ManualParameter
from qcodes.utils.validators import Validator, Strings
class InstrumentParameter(ManualParameter):
"""
Args:
name (string): the name of the instrument that one wants to add.
instrument (Optional[Instrument]): the "parent" instrument this... | Python | 0 |
a23374939583b3954baa1418f12ce309442d31ff | Mark certain resources as uncompressible | pyforge/pyforge/lib/widgets/form_fields.py | pyforge/pyforge/lib/widgets/form_fields.py | from pylons import c
from pyforge.model import User
from formencode import validators as fev
import ew
class MarkdownEdit(ew.InputField):
template='genshi:pyforge.lib.widgets.templates.markdown_edit'
validator = fev.UnicodeString()
params=['name','value','show_label']
show_label=True
name=None
... | from pylons import c
from pyforge.model import User
from formencode import validators as fev
import ew
class MarkdownEdit(ew.InputField):
template='genshi:pyforge.lib.widgets.templates.markdown_edit'
validator = fev.UnicodeString()
params=['name','value','show_label']
show_label=True
name=None
... | Python | 0.999999 |
2b5e94f6c301932eb9387bba9a80414a714e2b38 | Tidy up the references | pygraphc/abstraction/ClusterAbstraction.py | pygraphc/abstraction/ClusterAbstraction.py |
class ClusterAbstraction(object):
"""Get cluster abstraction based on longest common substring [jtjacques2010]_.
References
----------
.. [jtjacques2010] jtjacques, Longest common substring from more than two strings - Python.
http://stackoverflow.com/questions/2892931/longest-common-substring-... |
class ClusterAbstraction(object):
"""Get cluster abstraction based on longest common substring [jtjacques2010]_.
References
----------
.. [jtjacques2010] jtjacques, Longest common substring from more than two strings - Python.
http://stackoverflow.com/questions/2892931/longest-common-substr... | Python | 0.019729 |
ac61b2f99f91a274572e96be8f0136871288f1bb | update timer to be able to measure time more times | proso/util.py | proso/util.py | import re
import importlib
import time
_timers = {}
def timer(name):
now = time.time()
diff = None
if name in _timers:
diff = now - _timers[name]
_timers[name] = now
return diff
def instantiate(classname, *args, **kwargs):
matched = re.match('(.*)\.(\w+)', classname)
if matched ... | import re
import importlib
import time
_timers = {}
def timer(name):
now = time.clock()
if name in _timers:
diff = now - _timers[name]
return diff
_timers[name] = now
def instantiate(classname, *args, **kwargs):
matched = re.match('(.*)\.(\w+)', classname)
if matched is None:
... | Python | 0 |
ce1350bb42028ad29356af275ab5b90257ccf0cb | fix import | yr/__init__.py | yr/__init__.py | from .yr import YR | from yr import YR | Python | 0.000001 |
1cfc885597f14282245c68179922e27e3974a26f | use environment var for file location | publish-ci.py | publish-ci.py | import requests
import json
import os
# import tarfile
# def make_tarfile(output_filename, source_dir):
# with tarfile.open(output_filename, "w:gz") as tar:
# tar.add(source_dir, arcname=os.path.basename(source_dir))
uri = 'https://zenodo.org/api/deposit/depositions'
access_token = os.environ['ZENODO_API_... | import requests
import json
import os
# import tarfile
# def make_tarfile(output_filename, source_dir):
# with tarfile.open(output_filename, "w:gz") as tar:
# tar.add(source_dir, arcname=os.path.basename(source_dir))
uri = 'https://zenodo.org/api/deposit/depositions'
access_token = os.environ['ZENODO_API_... | Python | 0 |
32f308d3697c72a6655df38eedd23ebb71d95d40 | Fix typos, works in linux now. | pyglet/lib.py | pyglet/lib.py | #!/usr/bin/env python
'''Functions for loading dynamic libraries.
These extend and correct ctypes functions.
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id: $'
import os
import sys
import ctypes
import ctypes.util
class LibraryLoader(object):
def load_library(self, *names, **kwargs):
'''Fin... | #!/usr/bin/env python
'''Functions for loading dynamic libraries.
These extend and correct ctypes functions.
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id: $'
import os
import sys
import ctypes
import ctypes.util
class LibraryLoader(object):
def load_library(self, *names, **kwargs):
'''Fin... | Python | 0.999999 |
c424efd76f5c6949729d17d131333ce6ec8103f8 | Add Event model | app/models.py | app/models.py | from app import db
from flask_security import RoleMixin
# Define associations
friends = db.Table('friends',
db.Column('friend_id', db.Integer, db.ForeignKey('user.id')),
db.Column('friended_id', db.Integer, db.ForeignKey('user.id'))
)
roles_users = db.Table('roles_users',
db.Column('user_id', db.Int... | from app import db
from flask_security import RoleMixin
# Define associations
friends = db.Table('friends',
db.Column('friend_id', db.Integer, db.ForeignKey('user.id')),
db.Column('friended_id', db.Integer, db.ForeignKey('user.id'))
)
roles_users = db.Table('roles_users',
db.Column('user_id', db.Int... | Python | 0 |
e4880658f92c0b55c883b136405fa9a2a9d8c8dc | Define update_commits method. | app/models.py | app/models.py | from datetime import datetime
from app import slack, redis, app
from app.redis import RedisModel
class Channel(RedisModel):
__prefix__ = '#'
@staticmethod
def load_from_slack():
"""Update channel list from slack"""
slack_response = slack.channels.list()
if not slack_response.succ... | from datetime import datetime
from app import slack, redis, app
from app.redis import RedisModel
class Channel(RedisModel):
__prefix__ = '#'
@staticmethod
def load_from_slack():
"""Update channel list from slack"""
slack_response = slack.channels.list()
if not slack_response.succ... | Python | 0 |
99b65f7308a4b5719f5cf2e15200767af6780775 | deploy keynote images | pytx/files.py | pytx/files.py | import os
from django.conf import settings
JS_HEAD = []
JS = [
# 'raven.min.js',
# 'plugins/vue.min.js',
# 'showdown.min.js',
'pytexas.js',
]
CSS = [
'vuetify.min.css',
'global.css',
'pytexas.css',
]
IMAGES = [
'img/atx.svg',
'img/banner80.png',
'img/icon.svg',
'img/icon... | import os
from django.conf import settings
JS_HEAD = []
JS = [
# 'raven.min.js',
# 'plugins/vue.min.js',
# 'showdown.min.js',
'pytexas.js',
]
CSS = [
'vuetify.min.css',
'global.css',
'pytexas.css',
]
IMAGES = [
'img/atx.svg',
'img/banner80.png',
'img/icon.svg',
'img/icon... | Python | 0 |
e9314b02c482314efeb7e36ecf3f6613f9a99adb | fix fetch loop block server | app/server.py | app/server.py | import logging
import os
import sys
import requests
from flask import Flask
from flask import send_file, send_from_directory
from api import load_api
from blockchain import web3_client
from settings import SOURCE_ROOT
from storage import Cache
log = logging.getLogger(__name__)
console_handler = logging.StreamHandle... | import logging
import os
import sys
import requests
from flask import Flask
from flask import send_file, send_from_directory
from gevent import sleep, spawn
from api import load_api
from blockchain import web3_client
from settings import SOURCE_ROOT
from storage import Cache
log = logging.getLogger(__name__)
consol... | Python | 0 |
69f24cd7a1936fb7dc4cfb03e3e97997332f633e | add portforward_get method | akanda/horizon/client.py | akanda/horizon/client.py | import requests
def portforward_get(request):
headers = {
"User-Agent" : "python-quantumclient",
"Content-Type" : "application/json",
"Accept" : "application/json",
"X-Auth-Token" : request.user.token.id
}
r = requests.get('http://0.0.0.0/v2.0/dhportforward.json', headers=he... | Python | 0.000001 | |
2641b2a1c3d438144191c3a088e2c9b2b777a74c | Implement cloudforms license | awx/main/tests/functional/core/test_licenses.py | awx/main/tests/functional/core/test_licenses.py | # Copyright (c) 2015 Ansible, Inc.
# All Rights Reserved.
import time
import pytest
from datetime import datetime
from awx.main.models import Host
from awx.main.task_engine import TaskEnhancer
@pytest.mark.django_db
def test_license_writer(inventory, admin):
task_enhancer = TaskEnhancer(
company_name='a... | # Copyright (c) 2015 Ansible, Inc.
# All Rights Reserved.
import time
import pytest
from datetime import datetime
from awx.main.models import Host
from awx.main.task_engine import TaskEnhancer
@pytest.mark.django_db
def test_license_writer(inventory, admin):
task_enhancer = TaskEnhancer(
company_name='a... | Python | 0.000828 |
ad79fab7d18b1a31ba06f46e91d573dd3898cca2 | fix update points | fantasydota/scripts/update_leaderboard_points.py | fantasydota/scripts/update_leaderboard_points.py | import transaction
from fantasydota.lib.account import add_achievement, team_swap_all
from fantasydota.lib.general import match_link
from sqlalchemy import and_
from fantasydota.lib.constants import MULTIPLIER
from fantasydota.lib.session_utils import make_session
from fantasydota.models import Result, LeagueUser, Lea... | import transaction
from fantasydota.lib.account import add_achievement, team_swap_all
from fantasydota.lib.general import match_link
from sqlalchemy import and_
from fantasydota.lib.constants import MULTIPLIER
from fantasydota.lib.session_utils import make_session
from fantasydota.models import Result, LeagueUser, Lea... | Python | 0 |
b37814280dc06dbf8aefec4490f6b73a47f05c1a | Simplify python3 unicode fixer and make it replace all occurrences of __unicode__ with __str__. | custom_fixers/fix_alt_unicode.py | custom_fixers/fix_alt_unicode.py | # Taken from jinja2. Thanks, Armin Ronacher.
# See also http://lucumr.pocoo.org/2010/2/11/porting-to-python-3-a-guide
from lib2to3 import fixer_base
class FixAltUnicode(fixer_base.BaseFix):
PATTERN = "'__unicode__'"
def transform(self, node, results):
new = node.clone()
new.value = '__str__... | # Taken from jinja2. Thanks, Armin Ronacher.
# See also http://lucumr.pocoo.org/2010/2/11/porting-to-python-3-a-guide
from lib2to3 import fixer_base
from lib2to3.fixer_util import Name, BlankLine
class FixAltUnicode(fixer_base.BaseFix):
PATTERN = """
func=funcdef< 'def' name='__unicode__'
... | Python | 0.000015 |
8f4918a63e312309e835c3a9fc0513ddd6b4bbc1 | test restore resnet | restore_resnet.py | restore_resnet.py | __author__ = 'Mohammad'
import tensorflow as tf
sess = tf.Session()
#First let's load meta graph and restore weights
saver = tf.train.import_meta_graph('data/tensorflow-resnet-pretrained-20160509/ResNet-L152.meta')
saver.restore(sess, 'data/tensorflow-resnet-pretrained-20160509/ResNet-L152.ckpt')
for i in tf.get_col... | __author__ = 'Mohammad'
import tensorflow as tf
sess = tf.Session()
#First let's load meta graph and restore weights
saver = tf.train.import_meta_graph('data/tensorflow-resnet-pretrained-20160509/ResNet-L152.meta')
saver.restore(sess, 'data/tensorflow-resnet-pretrained-20160509/ResNet-L152.ckpt')
for i in tf.get_col... | Python | 0 |
caba041d4297cf7c64a6eef50ddc147331092f26 | Implement utils.game_state_to_xml() to export a game to XML | fireplace/utils.py | fireplace/utils.py | import os.path
from importlib import import_module
from pkgutil import iter_modules
from xml.etree import ElementTree
from hearthstone.enums import CardType
# Autogenerate the list of cardset modules
_cards_module = os.path.join(os.path.dirname(__file__), "cards")
CARD_SETS = [cs for _, cs, ispkg in iter_modules([_ca... | import os.path
from importlib import import_module
from pkgutil import iter_modules
# Autogenerate the list of cardset modules
_cards_module = os.path.join(os.path.dirname(__file__), "cards")
CARD_SETS = [cs for _, cs, ispkg in iter_modules([_cards_module]) if ispkg]
# Dict of registered custom cards, by id. for @cu... | Python | 0.000002 |
5632447a202ef3a83e5b96d11cbbc653fafac99b | Use os.getlogin to get login user name. | ibus/common.py | ibus/common.py | # vim:set et sts=4 sw=4:
#
# ibus - The Input Bus
#
# Copyright (c) 2007-2008 Huang Peng <shawn.p.huang@gmail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of ... | # vim:set et sts=4 sw=4:
#
# ibus - The Input Bus
#
# Copyright (c) 2007-2008 Huang Peng <shawn.p.huang@gmail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of ... | Python | 0 |
b08a8fa6132d3533421088f617342abd094187be | make test runs independent of folder possible | scarce/testing/tools.py | scarce/testing/tools.py | import inspect
import os
import tables as tb
import numpy as np
import itertools
import scarce
# Get package path
package_path = os.path.dirname(scarce.__file__) # Get the absoulte path of the online_monitor installation
FIXTURE_FOLDER = os.path.join(package_path, 'testing/fixtures')
def _call_function_with_args(f... | import inspect
import os
import tables as tb
from collections import OrderedDict
import numpy as np
import itertools
FIXTURE_FOLDER = 'fixtures'
def _call_function_with_args(function, **kwargs):
''' Calls the function with the given kwargs
and returns the result in a numpy array '''
# Create all combina... | Python | 0 |
eb4cda636a0b0ceb5312b161e97ae5f8376c9f8e | Change biolookup test to work around service bug | indra/tests/test_biolookup_client.py | indra/tests/test_biolookup_client.py | from indra.databases import biolookup_client
def test_lookup_curie():
curie = 'pubchem.compound:40976'
res = biolookup_client.lookup_curie(curie)
assert res['name'] == '(17R)-13-ethyl-17-ethynyl-17-hydroxy-11-' \
'methylidene-2,6,7,8,9,10,12,14,15,16-decahydro-1H-' \
'cyclopenta[a]phenanth... | from indra.databases import biolookup_client
def test_lookup_curie():
curie = 'pubchem.compound:40976'
res = biolookup_client.lookup_curie(curie)
assert res['name'] == '(17R)-13-ethyl-17-ethynyl-17-hydroxy-11-' \
'methylidene-2,6,7,8,9,10,12,14,15,16-decahydro-1H-' \
'cyclopenta[a]phenanth... | Python | 0 |
0c0c20229d91e183af61c2e243f50054336520f2 | Handle title and alignment in reporter. | indra/tools/reading/util/reporter.py | indra/tools/reading/util/reporter.py | from reportlab.lib.enums import TA_JUSTIFY
from reportlab.lib.pagesizes import letter
from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Image
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.units import inch
class Reporter(object):
def __init__(self, name... | from reportlab.lib.enums import TA_JUSTIFY
from reportlab.lib.pagesizes import letter
from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Image
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.units import inch
class Reporter(object):
def __init__(self, name... | Python | 0 |
c609825486e9d2d5f8abbd895b30b4ff9469ffe8 | Add implementation for TransformerNet. | neuralstyle/transformernet.py | neuralstyle/transformernet.py | import torch
import torch.nn as nn
import numpy as np
class TransformerNet(torch.nn.Module):
def __init__(self):
super(TransformerNet, self).__init__()
# Padding layer
self.reflect_padding = nn.ReflectionPad2d(20)
# Initial convolution layers
self.conv1 = ConvLayer(3, 32,... | import torch
import torch.nn as nn
class ResidualBlock(torch.nn.Module):
"""ResidualBlock
introduced in: https://arxiv.org/abs/1512.03385
recommended architecture: http://torch.ch/blog/2016/02/04/resnets.html
"""
def __init__(self, in_channels, out_channels):
super(ResidualBlock, self).__i... | Python | 0 |
7fd2060f2241bcff6849d570406dc057b9c7f8d1 | Fix the message string | satchless/cart/views.py | satchless/cart/views.py | # -*- coding: utf-8 -*-
from django.contrib import messages
from django.shortcuts import get_object_or_404, redirect
from django.template.response import TemplateResponse
from django.utils.translation import ugettext as _
from django.views.decorators.http import require_POST
from . import models
from . import forms
d... | # -*- coding: utf-8 -*-
from django.contrib import messages
from django.shortcuts import get_object_or_404, redirect
from django.template.response import TemplateResponse
from django.utils.translation import ugettext
from django.views.decorators.http import require_POST
from . import models
from . import forms
def ca... | Python | 1 |
80691fa6d517b39a6656a2afc0635f485fd49974 | add dependencies (#18406) | var/spack/repos/builtin/packages/gconf/package.py | var/spack/repos/builtin/packages/gconf/package.py | # Copyright 2013-2020 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 Gconf(AutotoolsPackage):
"""GConf is a system for storing application preferences."""
... | # Copyright 2013-2020 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 Gconf(AutotoolsPackage):
"""GConf is a system for storing application preferences."""
... | Python | 0.000001 |
bd0960cda8a66b843035935c7caa9f20b38b4d0d | Add 0.16.0 and address test suite issues (#27604) | var/spack/repos/builtin/packages/gpgme/package.py | var/spack/repos/builtin/packages/gpgme/package.py | # Copyright 2013-2021 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 Gpgme(AutotoolsPackage):
"""GPGME is the standard library to access GnuPG
functions... | # Copyright 2013-2021 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 Gpgme(AutotoolsPackage):
"""GPGME is the standard library to access GnuPG
functions... | Python | 0 |
cd7b72e67a3af4184ccaf3e3dce231c227392f45 | Update Keras.py | History/Nesterov-Accelerated-Gradient/Keras.py | History/Nesterov-Accelerated-Gradient/Keras.py | import keras
from keras.datasets import mnist
from keras.initializers import RandomUniform
from keras.layers import Dense
from keras.models import Sequential
from keras.optimizers import SGD
batch_size = 128
epochs = 30
num_classes = 10
(x_train, y_train), (x_test, y_test) = mnist.load_data()
x_train = ... | import keras
from keras.datasets import mnist
from keras.initializers import RandomUniform
from keras.layers import Dense
from keras.models import Sequential
from keras.optimizers import SGD
batch_size = 128
epochs = 30
num_classes = 10
(x_train, y_train), (x_test, y_test) = mnist.load_data()
x_train = ... | Python | 0 |
219ec7659b06aece8a738198799893de5f28c2b2 | Add to/from string methods for Box | rain/engine.py | rain/engine.py | from ctypes import CFUNCTYPE, POINTER
from ctypes import Structure
from ctypes import byref
from ctypes import c_char_p
from ctypes import c_int
from ctypes import c_uint16
from ctypes import c_uint32
from ctypes import c_uint64
from ctypes import c_uint8
from ctypes import c_void_p
from ctypes import cast
import llvm... | from ctypes import CFUNCTYPE, POINTER
from ctypes import Structure
from ctypes import byref
from ctypes import c_char_p
from ctypes import c_int
from ctypes import c_uint16
from ctypes import c_uint32
from ctypes import c_uint64
from ctypes import c_uint8
from ctypes import c_void_p
from ctypes import cast
import llvm... | Python | 0 |
b8c18068c2cc2afe169c750f25318c6ba92e2763 | use Spack compilers and remove x86_64 opts from Makefile (#13877) | var/spack/repos/builtin/packages/prank/package.py | var/spack/repos/builtin/packages/prank/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 Prank(Package):
"""A powerful multiple sequence alignment browser."""
homepage = "htt... | # 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 Prank(Package):
"""A powerful multiple sequence alignment browser."""
homepage = "htt... | Python | 0 |
26933550f7a3c195669c61539151c5fedf26aaad | add version 1.0.0 to r-hms (#21045) | var/spack/repos/builtin/packages/r-hms/package.py | var/spack/repos/builtin/packages/r-hms/package.py | # Copyright 2013-2021 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 RHms(RPackage):
"""Pretty Time of Day
Implements an S3 class for storing and formatti... | # Copyright 2013-2021 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 RHms(RPackage):
"""Implements an S3 class for storing and formatting time-of-day values,
... | Python | 0 |
91cb70a94cd41bb6404fb6f21361bb8a7f01c9d5 | Rework thread model | irrexplorer.py | irrexplorer.py | #!/usr/bin/env python
# Copyright (c) 2015, Job Snijders
#
# This file is part of IRR Explorer
#
# 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... | #!/usr/bin/env python
# Copyright (c) 2015, Job Snijders
#
# This file is part of IRR Explorer
#
# 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... | Python | 0 |
03f33b099ec9adc480f599338b61214e870fedf6 | Update iypm_domain export name to use a valid format | iypm_domain.py | iypm_domain.py | import sys
try:
from troposphere import Join, Sub, Output, Export
from troposphere import Parameter, Ref, Template
from troposphere.route53 import HostedZone
from troposphere.certificatemanager import Certificate
except ImportError:
sys.exit('Unable to import troposphere. '
'Try "pip i... | import sys
try:
from troposphere import Join, Sub, Output, Export
from troposphere import Parameter, Ref, Template
from troposphere.route53 import HostedZone
from troposphere.certificatemanager import Certificate
except ImportError:
sys.exit('Unable to import troposphere. '
'Try "pip i... | Python | 0 |
0665beccbca954df9a477119bb976441c29dd5eb | fix test | test/sphinxext/test_sphinxext.py | test/sphinxext/test_sphinxext.py | import tempfile
import os
from sequana.sphinxext import snakemakerule
from sphinx.application import Sphinx
def test_doc():
res = snakemakerule.get_rule_doc("dag")
res = snakemakerule.get_rule_doc("fastqc_dynamic")
try:
res = snakemakerule.get_rule_doc("dummy")
assert False
except F... | import tempfile
import os
from sequana.sphinxext import snakemakerule
from sphinx.application import Sphinx
def test_doc():
res = snakemakerule.get_rule_doc("dag")
res = snakemakerule.get_rule_doc("fastqc")
try:
res = snakemakerule.get_rule_doc("dummy")
assert False
except FileNotFo... | Python | 0.000002 |
30e1f6ca2224cba216c2e08f2600ae55ba43cebb | update comment | test/unit/test_disco_aws_util.py | test/unit/test_disco_aws_util.py | """
Tests of disco_aws_util
"""
from unittest import TestCase
from disco_aws_automation import disco_aws_util
class DiscoAWSUtilTests(TestCase):
'''Test disco_aws_util.py'''
def test_size_as_rec_map_with_none(self):
"""size_as_recurrence_map works with None"""
self.assertEqual(disco_aws_util... | """
Tests of disco_aws_util
"""
from unittest import TestCase
from disco_aws_automation import disco_aws_util
class DiscoAWSUtilTests(TestCase):
'''Test disco_aws_util.py'''
def test_size_as_rec_map_with_none(self):
"""_size_as_recurrence_map works with None"""
self.assertEqual(disco_aws_uti... | Python | 0 |
0df416d66ee6c28512295de297f44597b45acf7a | Bump version for release | src/pip/__init__.py | src/pip/__init__.py | __version__ = "19.2"
| __version__ = "19.2.dev0"
| Python | 0 |
e2ce9caa84d0932b72894f17dc2c4884cc285bb0 | update test case for jaccard | tests/TestReleaseScoringAlice.py | tests/TestReleaseScoringAlice.py | from pprint import pprint
from subfind.release.alice import ReleaseScoringAlice
__author__ = 'hiepsimu'
import logging
import unittest
logging.basicConfig(level=logging.DEBUG)
class ReleaseScoringAliceTestCase(unittest.TestCase):
def test_01(self):
"""
Release which match the movie title should... | from subfind.release.alice import ReleaseScoringAlice
__author__ = 'hiepsimu'
import logging
import unittest
logging.basicConfig(level=logging.DEBUG)
class ReleaseScoringAliceTestCase(unittest.TestCase):
def test_01(self):
"""
Release which match the movie title should be the higher priority
... | Python | 0 |
04b91b797de680a970d77de76bed31934a38ede0 | remove "transition" markup | sphinxprettysearchresults/__init__.py | sphinxprettysearchresults/__init__.py | import pkg_resources, shutil, subprocess
import docutils
from docutils import nodes
from docutils.nodes import *
from sphinx.jinja2glue import SphinxFileSystemLoader
def clean_txts(language, srcdir, outdir, source_suffix, use_old_search_snippets):
if not isinstance(outdir, str) and isinstance(outdir, unicode):... | import pkg_resources, shutil, subprocess
import docutils
from docutils import nodes
from docutils.nodes import *
from sphinx.jinja2glue import SphinxFileSystemLoader
def clean_txts(language, srcdir, outdir, source_suffix, use_old_search_snippets):
if not isinstance(outdir, str) and isinstance(outdir, unicode):... | Python | 0.001275 |
c535c22884dbb0df227d4ad142e4d4515415ca29 | Switch to wav test files for gstreamer tests | tests/backends/gstreamer_test.py | tests/backends/gstreamer_test.py | import unittest
import os
from mopidy.models import Playlist, Track
from mopidy.backends.gstreamer import GStreamerBackend
from tests.backends.base import (BasePlaybackControllerTest,
BaseCurrentPlaylistControllerTest)
folder = os.path.dirname(__file__)
folder = os.path.join(folder, ... | import unittest
import os
from mopidy.models import Playlist, Track
from mopidy.backends.gstreamer import GStreamerBackend
from tests.backends.base import (BasePlaybackControllerTest,
BaseCurrentPlaylistControllerTest)
folder = os.path.dirname(__file__)
folder = os.path.join(folder, ... | Python | 0 |
9e0725483e80a4e98d2635b90a268d00e4eae9f3 | Update insertion-sort-1.py | hackerrank/insertion-sort-1.py | hackerrank/insertion-sort-1.py | '''
https://www.hackerrank.com/challenges/insertionsort1
Sorting
One common task for computers is to sort data. For example, people might want to see all their files on a computer sorted by size. Since sorting is a simple problem with many different possible solutions, it is often used to introduce the study of algor... | '''
https://www.hackerrank.com/challenges/insertionsort1
Sorting
One common task for computers is to sort data. For example, people might want to see all their files on a computer sorted by size. Since sorting is a simple problem with many different possible solutions, it is often used to introduce the study of algor... | Python | 0.000001 |
4d1fa4bee77eba19cb0a4c80032f30dcc89e6b98 | Fix date check | dcache-billing/python/download_billing_logs.py | dcache-billing/python/download_billing_logs.py | #!/usr/bin/env python
import sys
import urllib2
import argparse
FAXBOX_PROCESSED_CSV_URL = "http://login.usatlas.org/logs/mwt2/dcache-billing/processed/"
FAXBOX_RAW_CSV_URL = "http://login.usatlas.org/logs/mwt2/dcache-billing/raw/"
def download_log(date_string):
"""
Download job log files from Amazon EC2 ma... | #!/usr/bin/env python
import sys
import urllib2
import argparse
FAXBOX_PROCESSED_CSV_URL = "http://login.usatlas.org/logs/mwt2/dcache-billing/processed/"
FAXBOX_RAW_CSV_URL = "http://login.usatlas.org/logs/mwt2/dcache-billing/raw/"
def download_log(date_string):
"""
Download job log files from Amazon EC2 ma... | Python | 0.00106 |
6ed3d0d8f554e578b65db89e5c5f88cd14bfaea4 | Update tools/hcluster_sg_parser/hcluster_sg_parser.py | tools/hcluster_sg_parser/hcluster_sg_parser.py | tools/hcluster_sg_parser/hcluster_sg_parser.py | """
A simple parser to convert the hcluster_sg output into lists of IDs, one list for each cluster.
When a minimum and/or maximum number of cluster elements are specified, the IDs contained in the filtered-out clusters are collected in the "discarded IDS" output dataset.
Usage:
python hcluster_sg_parser.py [-m <N>] ... | """
A simple parser to convert the hcluster_sg output into lists of IDs, one list for each cluster.
When a minimum and/or maximum number of cluster elements are specified, the IDs contained in the filtered-out clusters are collected in the "discarded IDS" output dataset.
Usage:
python hcluster_sg_parser.py [-m <N>] ... | Python | 0 |
0f7cb25ea5a3fbb3c88f4fd7207144f29140f69c | Change happy_numbers to check for number 4. | happy_numbers/happy_numbers.py | happy_numbers/happy_numbers.py | """
Happy numbers solution, code eval.
https://www.codeeval.com/open_challenges/39/
A happy number is defined by the following process. Starting with any positive integer, replace the number by the sum of the squares of its digits, and repeat the process until the number equals 1 (where it will stay), or it loops endle... | """
Happy numbers solution, code eval.
https://www.codeeval.com/open_challenges/39/
A happy number is defined by the following process. Starting with any positive integer, replace the number by the sum of the squares of its digits, and repeat the process until the number equals 1 (where it will stay), or it loops endle... | Python | 0 |
5af16432976f72de1d86f1d725205c4ec6a6caa2 | Add warning when entity not found in reproduce_state | homeassistant/helpers/state.py | homeassistant/helpers/state.py | """
homeassistant.helpers.state
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Helpers that help with state related things.
"""
import logging
from homeassistant.core import State
import homeassistant.util.dt as dt_util
from homeassistant.const import (
STATE_ON, STATE_OFF, SERVICE_TURN_ON, SERVICE_TURN_OFF, ATTR_ENTITY_ID)
_LOGGE... | """
homeassistant.helpers.state
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Helpers that help with state related things.
"""
import logging
from homeassistant.core import State
import homeassistant.util.dt as dt_util
from homeassistant.const import (
STATE_ON, STATE_OFF, SERVICE_TURN_ON, SERVICE_TURN_OFF, ATTR_ENTITY_ID)
_LOGGE... | Python | 0.000003 |
a01efdffeb12d56c1e24932396ffd51b659cc8fd | Write a test for `metaclasses`. | tests/test_generic_decorators.py | tests/test_generic_decorators.py | __author__ = "John Kirkham <kirkhamj@janelia.hhmi.org>"
__date__ = "$Mar 25, 2015 13:30:52 EDT$"
import functools
import nanshe.nanshe.generic_decorators
class TestGenericDecorators(object):
def test_update_wrapper(self):
def wrapper(a_callable):
def wrapped(*args, **kwargs):
... | __author__ = "John Kirkham <kirkhamj@janelia.hhmi.org>"
__date__ = "$Mar 25, 2015 13:30:52 EDT$"
import functools
import nanshe.nanshe.generic_decorators
class TestGenericDecorators(object):
def test_update_wrapper(self):
def wrapper(a_callable):
def wrapped(*args, **kwargs):
... | Python | 0 |
0efb8c4347b944c692e3352382bf36de1c9f5ef4 | Fix test_client with no webpack manifest | indico/testing/fixtures/app.py | indico/testing/fixtures/app.py | # This file is part of Indico.
# Copyright (C) 2002 - 2021 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
import os
import pytest
from flask_webpackext.ext import _FlaskWebpackExtState
from indico.web.flask.app... | # This file is part of Indico.
# Copyright (C) 2002 - 2021 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
import os
import pytest
from indico.web.flask.app import make_app
from indico.web.flask.wrappers import ... | Python | 0 |
9398fa3f674dbed430cc5bd6178c07cc83c81c60 | remove unnecessary print | treeano/sandbox/nodes/spp_net.py | treeano/sandbox/nodes/spp_net.py | """
from
"Spatial Pyramid Pooling in Deep Convolutional Networks for Visual Recognition"
http://arxiv.org/abs/1406.4729
"""
from __future__ import division, absolute_import
from __future__ import print_function, unicode_literals
import numpy as np
import theano
import theano.tensor as T
import treeano
import treeano.n... | """
from
"Spatial Pyramid Pooling in Deep Convolutional Networks for Visual Recognition"
http://arxiv.org/abs/1406.4729
"""
from __future__ import division, absolute_import
from __future__ import print_function, unicode_literals
import numpy as np
import theano
import theano.tensor as T
import treeano
import treeano.n... | Python | 0.000413 |
6102f840c68e98a6c09aeb30055d6e58fa9c5006 | Put temporary files in system's tempdir | typhon/tests/files/test_utils.py | typhon/tests/files/test_utils.py | from tempfile import gettempdir, NamedTemporaryFile
from typhon.files import compress, decompress
class TestCompression:
data = "ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678910"
def create_file(self, filename):
with open(filename, "w") as file:
file.write(self.data)
def check_file(self, filen... | from tempfile import NamedTemporaryFile
from typhon.files import compress, decompress
class TestCompression:
data = "ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678910"
def create_file(self, filename):
with open(filename, "w") as file:
file.write(self.data)
def check_file(self, filename):
... | Python | 0 |
0f4c91b55b5f6640954c4f3b459c286fc5f87b53 | Clarify and improve error handling | data/CPNWH_Downloader.py | data/CPNWH_Downloader.py | """Use this to directly download CPNWH data.
To prevent timeout errors with their server, the data is downloaded from each
herbaria separately.
"""
import pandas as pd
import requests
import argparse
import string
# Parse arguments
parser = argparse.ArgumentParser(
description='Download CPNWH data into multipl... | """Use this to directly download CPNWH data.
To prevent timeout errors with their server, the data is downloaded from each
herbaria separately.
"""
import pandas as pd
import requests
import argparse
# Parse arguments
parser = argparse.ArgumentParser(
description='Download CPNWH data into multiple files')
pars... | Python | 0.000001 |
9c2514fce4d8d6c46fddae8e79afe66631b468ae | add outer_width to RackTable (#7766) | netbox/dcim/tables/racks.py | netbox/dcim/tables/racks.py | import django_tables2 as tables
from django_tables2.utils import Accessor
from dcim.models import Rack, RackReservation, RackRole
from tenancy.tables import TenantColumn
from utilities.tables import (
BaseTable, ButtonsColumn, ChoiceFieldColumn, ColorColumn, ColoredLabelColumn, LinkedCountColumn, MarkdownColumn,
... | import django_tables2 as tables
from django_tables2.utils import Accessor
from dcim.models import Rack, RackReservation, RackRole
from tenancy.tables import TenantColumn
from utilities.tables import (
BaseTable, ButtonsColumn, ChoiceFieldColumn, ColorColumn, ColoredLabelColumn, LinkedCountColumn, MarkdownColumn,
... | Python | 0 |
59706b4f3e45fbd3ea107e63f04181cbd89b9749 | Remove conntrackd comment | neutron/conf/agent/l3/ha.py | neutron/conf/agent/l3/ha.py | # Copyright (c) 2014 OpenStack Foundation.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | # Copyright (c) 2014 OpenStack Foundation.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | Python | 0.000006 |
62763ded79e1afe1b37da0522f126e21ce18ab65 | Rename ComparableResponse to TestResponse | flaskext/attest.py | flaskext/attest.py | from __future__ import absolute_import
from __future__ import with_statement
from contextlib import contextmanager
from flask import (Response, request, template_rendered as jinja_rendered)
from flask.signals import Namespace
from flask.testing import FlaskClient
from decorator import decorator
signals = Namespace()
... | from __future__ import absolute_import
from __future__ import with_statement
from contextlib import contextmanager
from flask import (Response, request, template_rendered as jinja_rendered)
from flask.signals import Namespace
from flask.testing import FlaskClient
from decorator import decorator
signals = Namespace()
... | Python | 0.999974 |
9d9302bdd961f21f36bbfd61265aa7c1e7117401 | don't perform the check if first_edit is None | follower/models.py | follower/models.py | from datetime import datetime
import pytz
from django.db import models
import feedparser
feedparser.USER_AGENT='OSMFollower/1.0 +http://mapexplorer.org'
# Create your models here.
class Mapper(models.Model):
user=models.CharField(max_length=20)
scan_date=models.DateTimeField('last_scan_date',null=True,blank=Tr... | from datetime import datetime
import pytz
from django.db import models
import feedparser
feedparser.USER_AGENT='OSMFollower/1.0 +http://mapexplorer.org'
# Create your models here.
class Mapper(models.Model):
user=models.CharField(max_length=20)
scan_date=models.DateTimeField('last_scan_date',null=True,blank=Tr... | Python | 0.999994 |
9da0110c6d36c099cefecb7d653159f16175a139 | fix bug | dataset/research/job.py | dataset/research/job.py | """ Classes Job and Experiment. """
import os
from collections import OrderedDict
from copy import copy
import dill
from .. import Pipeline, Config, inbatch_parallel
class Job:
""" Contains one job. """
def __init__(self, executable_units, n_iters, repetition, configs, branches, name):
"""
Pa... | """ Classes Job and Experiment. """
import os
from collections import OrderedDict
from copy import copy
import dill
from .. import Pipeline, Config, inbatch_parallel
class Job:
""" Contains one job. """
def __init__(self, executable_units, n_iters, repetition, configs, branches, name):
"""
Pa... | Python | 0.000001 |
cfbe7778e441f5851dc0efbacdfebd5209c31742 | bump version | cupy/_version.py | cupy/_version.py | __version__ = '11.0.0rc1'
| __version__ = '11.0.0b3'
| Python | 0 |
eac2f296e855f92d040321edee943ad5f8a8fb39 | Add filtering to view (nc-463) | nodeconductor/events/views.py | nodeconductor/events/views.py | from rest_framework import generics, response
from nodeconductor.events import elasticsearch_client
class EventListView(generics.GenericAPIView):
def list(self, request, *args, **kwargs):
order_by = request.GET.get('o', '-@timestamp')
event_types = request.GET.getlist('event_type')
searc... | from rest_framework import generics, response
from nodeconductor.events import elasticsearch_client
class EventListView(generics.GenericAPIView):
def list(self, request, *args, **kwargs):
order_by = request.GET.get('o', '-@timestamp')
elasticsearch_list = elasticsearch_client.ElasticsearchResult... | Python | 0 |
4ee2c7e457ffebf58f4d6592a63abb3418c980e0 | Make sure the module can be loaded with older versions of IDA. | sark/ui.py | sark/ui.py | """
Reference:
http://www.hexblog.com/?p=886
Return values for update:
AST_ENABLE_ALWAYS // enable action and do not call action_handler_t::update() anymore
AST_ENABLE_FOR_IDB // enable action for the current idb. Call action_handler_t::update() when a database is opened/closed
AST_ENABLE_FOR_FO... | """
Reference:
http://www.hexblog.com/?p=886
Return values for update:
AST_ENABLE_ALWAYS // enable action and do not call action_handler_t::update() anymore
AST_ENABLE_FOR_IDB // enable action for the current idb. Call action_handler_t::update() when a database is opened/closed
AST_ENABLE_FOR_FO... | Python | 0 |
d62f3bc97bd318ebaf68e97ccc2629d9f8f246b5 | Correct the pyproj minimum version. | sources/mapnik/setup.py | sources/mapnik/setup.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from setuptools import setup, find_packages
def prerelease_local_scheme(version):
"""
Return local scheme version unless building on master in CircleCI.
This function returns the local scheme version number
(e.g. 0.0.0.dev<N>+g<HASH>) unless bu... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from setuptools import setup, find_packages
def prerelease_local_scheme(version):
"""
Return local scheme version unless building on master in CircleCI.
This function returns the local scheme version number
(e.g. 0.0.0.dev<N>+g<HASH>) unless bu... | Python | 0 |
32a69f96821a543dc8efd1b11b2bf5fa129c4b87 | Starting fraction is 1 | EVLA_pipeline1.3.0/EVLA_pipe_fake_flagall.py | EVLA_pipeline1.3.0/EVLA_pipe_fake_flagall.py |
'''
On mixed setups, flagall is already run. This defines the variables set
during that script so it doesn't need to be run multiple times.
'''
logprint("Starting EVLA_pipe_fake_flagall.py",
logfileout='logs/flagall.log')
time_list = runtiming('flagall', 'start')
QA2_flagall = 'Pass'
logprint("These value a... |
'''
On mixed setups, flagall is already run. This defines the variables set
during that script so it doesn't need to be run multiple times.
'''
logprint("Starting EVLA_pipe_fake_flagall.py",
logfileout='logs/flagall.log')
time_list = runtiming('flagall', 'start')
QA2_flagall = 'Pass'
logprint("These value a... | Python | 0.999999 |
f70421a0c3143648f7dd2491ad031e62ca92792a | increment version for password rest admin form fix | accountsplus/__init__.py | accountsplus/__init__.py | __version__ = '1.3.2'
default_app_config = 'accountsplus.apps.AccountsConfig'
| __version__ = '1.3.1'
default_app_config = 'accountsplus.apps.AccountsConfig'
| Python | 0 |
bb165b4f8fc88ab3de26b0b52f07ada612e87f2b | Fix test cases related to getting tags and fields | tests/client_test.py | tests/client_test.py | """ InfluxAlchemy client tests. """
import mock
import influxdb
from influxalchemy.client import InfluxAlchemy
from influxalchemy.measurement import Measurement
from influxalchemy.query import InfluxDBQuery
@mock.patch("influxdb.InfluxDBClient")
def test_query(mock_flux):
db = influxdb.InfluxDBClient(database="f... | """ InfluxAlchemy client tests. """
import mock
import influxdb
from influxalchemy.client import InfluxAlchemy
from influxalchemy.measurement import Measurement
from influxalchemy.query import InfluxDBQuery
@mock.patch("influxdb.InfluxDBClient")
def test_query(mock_flux):
db = influxdb.InfluxDBClient(database="f... | Python | 0 |
499a74ff3256b3c6fb6a0ca4e2fd9578f2948cc8 | correct variable names | tests/eguene_test.py | tests/eguene_test.py | """
eugene_test.py
"""
import os
import sys
import numpy as np
import pandas as pd
sys.path.append(os.path.expanduser('~/GitHub/eugene'))
import eugene.Config
from eugene.Population import Population
# Setup up variable and truth configuration
eugene.Config.VAR['x'] = np.linspace(0, 8.0 * np.pi, 1024)
eugene.Config... | """
eugene_test.py
"""
import os
import sys
import numpy as np
import pandas as pd
sys.path.append('~/GitHub/eugene')
import eugene.Config
from eugene.Population import Population
# Setup up variable and truth configuration
eugene.Config.var['x'] = np.linspace(0, 8.0 * np.pi, 1024)
eugene.Config.truth = eugene.Conf... | Python | 0.84164 |
b4439ef76148f73581e6df0bf593504ae796578a | correct a bug in geo to country code. | dbpedia/geoToCountry.py | dbpedia/geoToCountry.py | from urllib2 import urlopen
def getCountry(lat, lng):
url = "http://ws.geonames.org/countryCode?lng=" + str(lng) + "&lat=" + str(lat)
country = urlopen(url).read().strip()
if len(country) != 2:
return "Unknown"
return country
| from urllib2 import urlopen
def getCountry(lat, lng):
url = "http://ws.geonames.org/countryCode?lng=" + str(lng) + "&lat=" + str(lat)
country = urlopen(url).read().strip()
return country
| Python | 0 |
9c8bfff17254cf88e11517a278bb60ad4c83e41b | Add revised alg_strongly_connected_components.py | alg_strongly_connected_components.py | alg_strongly_connected_components.py | from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
def strongly_connected_components():
pass
def main():
# 3 strongly connected graphs: {A, B, D, E, G}, {C}, {F, H, I}.
adj_dict = {
'A': ['B'],
'B': ['C', 'E'],
'C': ['C', ... | from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
def dfs_recur(adj_dict, start_vertex, visited_set,
discover_ls, finish_ls):
visited_set.add(start_vertex)
discover_ls.append(start_vertex)
for neighbor_vertex in adj_dict[start_verte... | Python | 0.000001 |
5b5081ca6bba90f2e15022d2b6e3e293e3a9cc11 | test if _search_final_redirect function finds last_redirects.txt | tests/simple_test.py | tests/simple_test.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
from har2tree import CrawledTree
from pathlib import Path
import datetime
import os
import uuid
class SimpleTest(unittest.TestCase):
http_redirect_ct: CrawledTree
@classmethod
def setUpClass(cls) -> None:
test_dir = ... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
from har2tree import CrawledTree
from pathlib import Path
import datetime
import os
import uuid
class SimpleTest(unittest.TestCase):
http_redirect_ct: CrawledTree
@classmethod
def setUpClass(cls) -> None:
test_dir = ... | Python | 0.000265 |
687bb616deca1372d69ba0781c61a8ea62112426 | Allow RO commands in oq workers | openquake/commands/workers.py | openquake/commands/workers.py | # -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (C) 2017-2019 GEM Foundation
#
# OpenQuake 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 Licen... | # -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (C) 2017-2019 GEM Foundation
#
# OpenQuake 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 Licen... | Python | 0.000026 |
a4b84eb95d35fefa2dde356cb31eb888c4110e00 | Fix a flaky test in PyPy. | tests/test__patch.py | tests/test__patch.py | import time
import unittest
import mongomock
try:
import pymongo
_HAVE_PYMONGO = True
except ImportError:
_HAVE_PYMONGO = False
try:
from unittest import mock
except ImportError:
import mock
@unittest.skipIf(not _HAVE_PYMONGO, 'pymongo not installed')
class PatchTest(unittest.TestCase):
"""... | import time
import unittest
import mongomock
try:
import pymongo
_HAVE_PYMONGO = True
except ImportError:
_HAVE_PYMONGO = False
try:
from unittest import mock
except ImportError:
import mock
@unittest.skipIf(not _HAVE_PYMONGO, 'pymongo not installed')
class PatchTest(unittest.TestCase):
"""... | Python | 0.000003 |
19b0b1ed7e94ae4bb05f57baf3163850a64df8f9 | test exports | opensfm/test/test_commands.py | opensfm/test/test_commands.py | import argparse
from opensfm import commands
from opensfm.test import data_generation
def run_command(command, args):
parser = argparse.ArgumentParser()
command.add_arguments(parser)
parsed_args = parser.parse_args(args)
command.run(parsed_args)
def test_run_all(tmpdir):
data = data_generation.... | import argparse
from opensfm import commands
from opensfm.test import data_generation
def run_command(command, args):
parser = argparse.ArgumentParser()
command.add_arguments(parser)
parsed_args = parser.parse_args(args)
command.run(parsed_args)
def test_run_all(tmpdir):
data = data_generation.... | Python | 0.000003 |
dcf07a4e538e0d97f1c04dc11d12f7dee9a91f11 | add docs test | tests/test_client.py | tests/test_client.py | import json
from functools import partial
from nose.tools import ok_, eq_, nottest
from solnado import SolrClient
from tornado import gen
from tornado.testing import AsyncTestCase, gen_test
class ClientTestCase(AsyncTestCase):
def setUp(self):
super(ClientTestCase, self).setUp()
self.client = Solr... | import json
from functools import partial
from nose.tools import ok_, eq_, nottest
from solnado import SolrClient
from tornado import gen
from tornado.testing import AsyncTestCase, gen_test
class ClientTestCase(AsyncTestCase):
def setUp(self):
super(ClientTestCase, self).setUp()
self.client = Solr... | Python | 0 |
823189201f00ceefcd55ebf2c2eb20e7ac8aeee5 | Fix cloner test | tests/test_cloner.py | tests/test_cloner.py | #!/usr/bin/env python
# Copyright 2012 Hewlett-Packard Development Company, L.P.
# Copyright 2014 Wikimedia Foundation 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://ww... | #!/usr/bin/env python
# Copyright 2012 Hewlett-Packard Development Company, L.P.
# Copyright 2014 Wikimedia Foundation 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://ww... | Python | 0.999985 |
0c30226cf6037ce6a3938cfb1e8b98fe5ef4d767 | Test for miss configured skeletor cfg | tests/test_config.py | tests/test_config.py | import sys
from skeletor.config import Config
from .base import BaseTestCase
from .helpers import nostdout
class ConfigTests(BaseTestCase):
""" Argument Passing & Config Tests. """
base_args = ['-n', 'test_skeleton']
def _set_cli_args(self, args):
with nostdout():
sys.argv = sys.ar... | import sys
from skeletor.config import Config
from .base import BaseTestCase
from .helpers import nostdout
class ConfigTests(BaseTestCase):
""" Argument Passing & Config Tests. """
base_args = ['-n', 'test_skeleton']
def _set_cli_args(self, args):
with nostdout():
sys.argv = sys.ar... | Python | 0 |
b3e7bfab5920c45a19ba0ca67a8c0119714579ad | Update dtruss() tests | tests/test_dtrace.py | tests/test_dtrace.py | #!/usr/bin/env python
# Copyright (C) 2015 Dmitry Rodionov
# This file is part of my GSoC'15 project for Cuckoo Sandbox:
# http://www.cuckoosandbox.org
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE file for details.
import os
import sys
import unittest
import sub... | #!/usr/bin/env python
# Copyright (C) 2015 Dmitry Rodionov
# This file is part of my GSoC'15 project for Cuckoo Sandbox:
# http://www.cuckoosandbox.org
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE file for details.
import os
import sys
import unittest
import sub... | Python | 0.000018 |
52d8442068af3fbd848c32334327e48e623769c2 | Change test class name | tests/test_helper.py | tests/test_helper.py | # -*- coding: utf-8 -*-
"""Tests for _Helper class."""
# from python_utils.helper import _Helper
# from python_utils import helper
import unittest
from python_utils.helper import _Helper
class TestPythonUtils(unittest.TestCase):
"""Add documentation here."""
def setUp(self):
"""Add documentation he... | # -*- coding: utf-8 -*-
# from python_utils.helper import _Helper
#from python_utils import helper
import unittest
import python_utils
class TestPprint(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
| Python | 0.000004 |
0a2951103ba70dc94f685b6fa3261ff371a78205 | Revert ganesha integration - update due to intermediate code changes between initial/revert action | ovs/extensions/fs/exportfs.py | ovs/extensions/fs/exportfs.py | # Copyright 2014 CloudFounders NV
#
# 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 writ... | # Copyright 2014 CloudFounders NV
#
# 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 writ... | Python | 0 |
6b2f403ce33205ec681ba1a511c2d52db02f6a36 | Use pipelines for cache busting scans for better performance | oz/plugins/aws_cdn/actions.py | oz/plugins/aws_cdn/actions.py | from __future__ import absolute_import, division, print_function, with_statement, unicode_literals
# Module for generating hashes for files that match a glob, and putting that
# hash in redis to allow us to generate cache-busting URLs later
import os
import oz
import oz.app
import oz.plugins.redis
import oz.plugins.a... | from __future__ import absolute_import, division, print_function, with_statement, unicode_literals
# Module for generating hashes for files that match a glob, and putting that
# hash in redis to allow us to generate cache-busting URLs later
import os
import oz
import oz.app
import oz.plugins.redis
import oz.plugins.a... | Python | 0 |
b587557ab27598d7b1d273fbc445f27b40613a29 | Update production bucket name. | us_ignite/settings/production.py | us_ignite/settings/production.py | # Production settings for us_ignite
import datetime
import os
import urlparse
from us_ignite.settings import *
# Sensitive values are saved as env variables:
env = os.getenv
PROJECT_ROOT = os.path.dirname(os.path.realpath(__file__))
# settings is one directory up now
here = lambda *x: os.path.join(PROJECT_ROOT, '..',... | # Production settings for us_ignite
import datetime
import os
import urlparse
from us_ignite.settings import *
# Sensitive values are saved as env variables:
env = os.getenv
PROJECT_ROOT = os.path.dirname(os.path.realpath(__file__))
# settings is one directory up now
here = lambda *x: os.path.join(PROJECT_ROOT, '..',... | Python | 0 |
e509bb74406243829810d011af7c5d1a7a5368e7 | add test case for client credential. #6 | tests/test_oauth2.py | tests/test_oauth2.py | # coding: utf-8
import os
import tempfile
import unittest
from urlparse import urlparse
from flask import Flask
from .oauth2_server import create_server, db
from .oauth2_client import create_client
class BaseSuite(unittest.TestCase):
def setUp(self):
app = Flask(__name__)
app.debug = True
... | # coding: utf-8
import os
import tempfile
import unittest
from urlparse import urlparse
from flask import Flask
from .oauth2_server import create_server, db
from .oauth2_client import create_client
class BaseSuite(unittest.TestCase):
def setUp(self):
app = Flask(__name__)
app.debug = True
... | Python | 0 |
9c61b0d27873c8c1ea2ba2311f547625a83bf7be | Add cached_function to API | tests/test_parser.py | tests/test_parser.py | import shelve
from unittest import TestCase
import requests
import yaml
from mfnf.api import HTTPMediaWikiAPI
from mfnf.parser import HTML2JSONParser, ArticleContentParser
from mfnf.utils import CachedFunction
class TestParser(TestCase):
@classmethod
def setUpClass(cls):
cls.database = shelve.open(... | import requests
import yaml
from unittest import TestCase
from mfnf.api import HTTPMediaWikiAPI
from mfnf.parser import HTML2JSONParser, ArticleContentParser
class TestParser(TestCase):
def setUp(self):
self.api = HTTPMediaWikiAPI(requests.Session())
self.title = "Mathe für Nicht-Freaks: Analysis... | Python | 0.000002 |
6ddaf77adb3a3d1ad42eee06aae657fe15f77fa7 | revert to assertions | tests/test_readme.py | tests/test_readme.py | import doctest
def test_readme():
errs, _ = doctest.testfile('../README.rst', report=True)
assert not errs
| import doctest
def test_readme():
errs, _ = doctest.testfile('../README.rst', report=True)
if errs > 0:
raise ValueError(
'{} errors encountered in README.rst'.format(
errs))
| Python | 0.999542 |
55e6f07a804bb857fab63dfe82dcb228ce1de12e | Replace os.path with ntpath in tests | tests/test_rename.py | tests/test_rename.py | import ntpath
from unittest import TestCase
from exifread import IfdTag
from mock import mock
from pictures.rename import rename
from tests import helpers
def ifd_tag_from(date_time_original):
return IfdTag(None, None, None, date_time_original, None, None)
class MockFile(object):
def __init__(self, filena... | from unittest import TestCase
from mock import mock
from exifread import IfdTag
from pictures.rename import rename
from tests import helpers
def ifd_tag_from(date_time_original):
return IfdTag(None, None, None, date_time_original, None, None)
class MockFile(object):
def __init__(self, filename, mode):
... | Python | 0 |
7ef0fe9f1a2b91c72c2709ed025780547e329403 | Update test | tests/test_ricker.py | tests/test_ricker.py | import pytest
from ricker.ricker import ricker
class TestRicker:
def test_default_output(self):
dt = 0.002
length = 1
s = ricker(len=length, dt=dt)
assert len(s) == int(length / dt)
def test_input_check_f(self):
with pytest.raises(ValueError):
ricker(f=0)
... | import pytest
from ricker.ricker import ricker
class TestRicker:
def test_output_number(self):
assert len(ricker()) == 2
def test_default_output(self):
t, s = ricker()
assert len(t) == len(s)
def test_error(self):
with pytest.raises(ValueError):
ricker(f=0)
| Python | 0.000001 |
298b85a7c36e536a985b7ccffc8fefa135baa187 | Fix TestRunner test case | tests/test_runner.py | tests/test_runner.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import os
import tempfile
from multiprocessing import Lock
import git
import mock
import pytest
from badwolf.runner import TestContext, TestRunner
from badwolf.bitbucket import PullRequest, Changesets
@pytest.fixture(scope='function')
... | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from multiprocessing import Lock
import git
import mock
import pytest
from badwolf.runner import TestContext, TestRunner
@pytest.fixture(scope='function')
def push_context():
return TestContext(
'deepanalyzer/badwolf',
... | Python | 0.000001 |
050e6ee000e89fb0ebeff5dcb2b6d79b10e92069 | Fix monkeypatching for older scipy versions | tests/test_things.py | tests/test_things.py | from __future__ import division
import stft
import numpy
import pytest
@pytest.fixture(params=[1, 2])
def channels(request):
return request.param
@pytest.fixture(params=[0, 1, 4])
def padding(request):
return request.param
@pytest.fixture(params=[2048])
def length(request):
return request.param
@pyt... | from __future__ import division
import stft
import numpy
import pytest
@pytest.fixture(params=[1, 2])
def channels(request):
return request.param
@pytest.fixture(params=[0, 1, 4])
def padding(request):
return request.param
@pytest.fixture(params=[2048])
def length(request):
return request.param
@pyt... | Python | 0 |
893e09b14eabff3a6ec2ff87db0499bc3fd2a213 | fix tests to use forced aligner | tests/transcriber.py | tests/transcriber.py | import os
import unittest
class Aligner(unittest.TestCase):
audio = 'examples/data/lucier.mp3'
transcript = "i am sitting in a room"
def test_resources(self):
from gentle import Resources
from gentle.util.paths import get_binary
resources = Resources()
k3 = get_binary("ext... | import os
import unittest
class Transcriber(unittest.TestCase):
audio = 'examples/data/lucier.mp3'
def test_resources(self):
from gentle import Resources
from gentle.util.paths import get_binary
resources = Resources()
k3 = get_binary("ext/k3")
self.assertEqual(os.pat... | Python | 0 |
72e948719145579eb7dfb9385b921f8eb6ea1384 | Add more exemplar primitive generators | tests/v4/conftest.py | tests/v4/conftest.py | from .context import tohu
from tohu.v4.primitive_generators import *
from tohu.v4.derived_generators import *
__all__ = ['EXEMPLAR_GENERATORS', 'EXEMPLAR_PRIMITIVE_GENERATORS', 'EXEMPLAR_DERIVED_GENERATORS']
def add(x, y):
return x + y
EXEMPLAR_PRIMITIVE_GENERATORS = [
Boolean(p=0.3),
Constant("quux"),
... | from .context import tohu
from tohu.v4.primitive_generators import *
from tohu.v4.derived_generators import *
__all__ = ['EXEMPLAR_GENERATORS', 'EXEMPLAR_PRIMITIVE_GENERATORS', 'EXEMPLAR_DERIVED_GENERATORS']
def add(x, y):
return x + y
EXEMPLAR_PRIMITIVE_GENERATORS = [
Constant("quux"),
Integer(100, 200... | Python | 0 |
e6305725a57bd6daca24e66699a8e3b0ead8d866 | Split long line | utils/ci/topology_integration.py | utils/ci/topology_integration.py | #!/usr/bin/env python2
# pylint: disable=missing-docstring
import time
import signal
import threading
from emuvim.dcemulator.net import DCNetwork
from mininet.node import RemoteController
from emuvim.api.sonata import SonataDummyGatekeeperEndpoint
class SigTermCatcher:
def __init__(self, net):
self.net =... | #!/usr/bin/env python2
# pylint: disable=missing-docstring
import time
import signal
import threading
from emuvim.dcemulator.net import DCNetwork
from mininet.node import RemoteController
from emuvim.api.sonata import SonataDummyGatekeeperEndpoint
class SigTermCatcher:
def __init__(self, net):
self.net =... | Python | 0.000995 |
d49997058c54bfeabe21a7284bdf3cf07c76075b | add doc | usr/sbin/local_fs_job_manager.py | usr/sbin/local_fs_job_manager.py | #!/usr/bin/env python
###############################################################################
# Copyright (c) 2015 Tencent Inc.
# Distributed under the MIT license
# (See accompanying file LICENSE or copy at http://opensource.org/licenses/MIT)
#
# Project: Cloud Image Migration Tool
# Filename: lo... | #!/usr/bin/env python
###############################################################################
# Copyright (c) 2015 Tencent Inc.
# Distributed under the MIT license
# (See accompanying file LICENSE or copy at http://opensource.org/licenses/MIT)
#
# Project: Cloud Image Migration Tool
# Filename: lo... | Python | 0 |
12d22221df5786caee510cc167c9ef29f9155488 | Correct name of output file | var/www/cgi-bin/abundanceConf.py | var/www/cgi-bin/abundanceConf.py | #!/home/daniel/Software/anaconda3/bin/python
# Import modules for CGI handling
import cgi, cgitb
from abundanceDriver import abundancedriver
from emailSender import sendEmail
def cgi2dict(form):
"""Convert the form from cgi.FieldStorage to a python dictionary"""
params = {}
for key in form.keys():
... | #!/home/daniel/Software/anaconda3/bin/python
# Import modules for CGI handling
import cgi, cgitb
from abundanceDriver import abundancedriver
from emailSender import sendEmail
def cgi2dict(form):
"""Convert the form from cgi.FieldStorage to a python dictionary"""
params = {}
for key in form.keys():
... | Python | 0.000365 |
ced3fd5fc8945fbb0ac79b3e90833173b1c72e93 | disable not callable | pages/tasks.py | pages/tasks.py |
from celery import task
from pages.models import UploadedImage
from pages.settings import IMG_PATH
# XXX - not callable on pylint!
@task()#pylint: disable=not-callable
def upload_to_s3(img, account, tags, filename):
img_obj = UploadedImage(
img=img,
account=account,
... | from celery import task
from pages.models import UploadedImage
from pages.settings import IMG_PATH
@task()
def upload_to_s3(img, account, tags, filename):
img_obj = UploadedImage(
img=img,
account=account,
tags=tags
)
img_obj.save()
print filen... | Python | 0.00012 |
438d21cc81355c3cf0768d8d8a84834252e5d56d | Add fix to get rid of random file closings and CRC-32 errors | parse/utils.py | parse/utils.py | import bz2
import zipfile
import tarfile
import re
from chemtools import fileparser
from project.utils import StringIO
def parse_file_list(files):
for f in files:
if f.name.endswith(".zip"):
with zipfile.ZipFile(f, "r") as zfile:
for name in [x for x in zfile.namelist() if not ... | import bz2
import zipfile
import tarfile
import re
from chemtools import fileparser
from project.utils import StringIO
def parse_file_list(files):
for f in files:
if f.name.endswith(".zip"):
with zipfile.ZipFile(f, "r") as zfile:
for name in [x for x in zfile.namelist() if not ... | Python | 0 |
56181811197ad7e7b2d2d92f39f118ae0195afe5 | use dictionary comprehension instead of explicitly building dict iteratively | web_frontend/osmaxx/countries/utils.py | web_frontend/osmaxx/countries/utils.py | import os
from django.contrib.gis.geos import MultiPolygon, Polygon, GEOSGeometry
from osmaxx.countries._settings import POLYFILE_LOCATION
POLYFILE_ENDING = '.poly'
def get_polyfile_name_to_file_mapping():
filenames = os.listdir(POLYFILE_LOCATION)
return {
_extract_country_name_from_polyfile_name(f... | import os
from django.contrib.gis.geos import MultiPolygon, Polygon, GEOSGeometry
from osmaxx.countries._settings import POLYFILE_LOCATION
POLYFILE_ENDING = '.poly'
def get_polyfile_name_to_file_mapping():
polyfile_mapping = {}
for possible_polyfile in os.listdir(POLYFILE_LOCATION):
if possible_pol... | Python | 0.000001 |
08b5ccc5ff94ced8d582d1f023901d2ea25aca53 | Disable timeout on reindex | udata/core/search/commands.py | udata/core/search/commands.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import logging
from udata.commands import manager
from udata.search import es, adapter_catalog
log = logging.getLogger(__name__)
@manager.option('-t', '--type', dest='doc_type', default=None, help='Only reindex a given type')
def reindex(doc_type=None... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import logging
from udata.commands import manager
from udata.search import es, adapter_catalog
log = logging.getLogger(__name__)
@manager.option('-t', '--type', dest='doc_type', default=None, help='Only reindex a given type')
def reindex(doc_type=None... | Python | 0.000001 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.