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 |
|---|---|---|---|---|---|---|---|
bd0745f9434686907a2951e2056701ae4db53978 | allow numeric values for SUGAR_LOGGER_LEVEL (silbe) #1038 | src/sugar/logger.py | src/sugar/logger.py | # Copyright (C) 2007 Red Hat, Inc.
#
# 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 the License, or (at your option) any later version.
#
# This library is distribu... | # Copyright (C) 2007 Red Hat, Inc.
#
# 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 the License, or (at your option) any later version.
#
# This library is distribu... | Python | 0.000092 |
bec88bc52a0eb410353b68c10c946c58360dabf2 | exists return tuple not string | erpnext/crm/doctype/appointment/test_appointment.py | erpnext/crm/doctype/appointment/test_appointment.py | # -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest
import datetime
def create_test_lead():
test_lead = frappe.db.exists({'doctype':'Lead','lead_name':'Test Lead'})
if test_lead:
... | # -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest
import datetime
def create_test_lead():
test_lead = frappe.db.exists({'doctype':'Lead','lead_name':'Test Lead'})
if test_lead:
... | Python | 0.999999 |
c5984a34e3bef6d69ebffe41f690819e5693f1d5 | fix post model | src/tours/models.py | src/tours/models.py | import authtools
from django.conf import settings
from django.db import models
from django.http import request
class Tour(models.Model):
title_pt = models.CharField(max_length=100, blank=True, null=False)
title_gb = models.CharField(max_length=100, blank=True, null=False)
title_de = models.CharField(max_l... | import authtools
from django.conf import settings
from django.db import models
from django.http import request
class Tour(models.Model):
title_pt = models.CharField(max_length=100, blank=True, null=False)
title_gb = models.CharField(max_length=100, blank=True, null=False)
title_de = models.CharField(max_l... | Python | 0 |
eb76abed3402a403637ae7486f692df8bba72ea3 | reorder code for better readability | src/vimpdb/proxy.py | src/vimpdb/proxy.py | import os
import sys
import socket
from subprocess import call
from subprocess import Popen
from subprocess import PIPE
PROGRAM = os.environ.get("VIMPDB_VIMSCRIPT", "vimpdb")
SERVERNAME = os.environ.get("VIMPDB_SERVERNAME", "VIMPDB")
def getPackagePath(instance):
module = sys.modules[instance.__module__]
ret... | import os
import sys
import socket
from subprocess import call
from subprocess import Popen
from subprocess import PIPE
PROGRAM = os.environ.get("VIMPDB_VIMSCRIPT", "vimpdb")
SERVERNAME = os.environ.get("VIMPDB_SERVERNAME", "VIMPDB")
def getPackagePath(instance):
module = sys.modules[instance.__module__]
ret... | Python | 0.000323 |
f577ff84c7231dff4fe01e7e9b73f1b497993b41 | remove commented out code and debug statements. | openxc/tools/obd2scanner.py | openxc/tools/obd2scanner.py | """
This module contains the methods for the ``openxc-obd2scanner`` command line
program.
`main` is executed when ``openxc-obd2scanner`` is run, and all other callables in this
module are internal only.
"""
import argparse
from .common import device_options, configure_logging, select_device
import json
def scan(co... | """
This module contains the methods for the ``openxc-obd2scanner`` command line
program.
`main` is executed when ``openxc-obd2scanner`` is run, and all other callables in this
module are internal only.
"""
import argparse
from .common import device_options, configure_logging, select_device
import json
def scan(co... | Python | 0 |
24b8e2f7440926d6d1c384a7289dfb5d1124e82f | Add article on core admin | opps/core/admin/__init__.py | opps/core/admin/__init__.py | # -*- coding: utf-8 -*-
from opps.core.admin.article import *
from opps.core.admin.channel import *
from opps.core.admin.profile import *
from opps.core.admin.source import *
| # -*- coding: utf-8 -*-
from opps.core.admin.channel import *
from opps.core.admin.profile import *
from opps.core.admin.source import *
| Python | 0 |
b1903d4cca8e9fb46468b52250610a9ecf2f3c90 | Make some functions private | atamaTrack.py | atamaTrack.py | """atamaTrack
"""
import os.path
import sys
import cv2
import numpy
from modules import getXY, piv
# constants
TIME_STEP = 0.1 # time step in second
TOTAL_FRAMES = 20 # number of frames to track
D_RANGE = 15 # ???: something parametor for the pattern finding
def main(file_path):
# load a movie file
fi... | """atamaTrack
"""
import os.path
import sys
import cv2
import numpy
from modules import getXY, piv
# constants
TIME_STEP = 0.1 # time step in second
TOTAL_FRAMES = 20 # number of frames to track
D_RANGE = 15 # ???: something parametor for the pattern finding
def main(file_path):
# load a movie file
fi... | Python | 0.000024 |
6dd8294b414c6b997171a36c3f28a029dc0dab78 | Update rest_framework_simplejwt.authentication | rest_framework_simplejwt/authentication.py | rest_framework_simplejwt/authentication.py | from __future__ import unicode_literals
from django.contrib.auth import get_user_model
from django.utils.six import text_type
from django.utils.translation import ugettext_lazy as _
from jose import jwt
from jose.exceptions import JOSEError
from rest_framework import HTTP_HEADER_ENCODING, authentication
from rest_fram... | from __future__ import unicode_literals
from django.contrib.auth import get_user_model
from django.utils.six import text_type
from django.utils.translation import ugettext_lazy as _
from jose import jwt
from rest_framework import HTTP_HEADER_ENCODING, authentication
from rest_framework.exceptions import Authentication... | Python | 0.000001 |
38a0a51ec72733b92f58f2d0208e195ccd8523c7 | Set authserver's default user/pass to be the default set in settings.py | authserver.py | authserver.py | #!/usr/bin/env python
# ##### BEGIN AGPL LICENSE BLOCK #####
# This file is part of SimpleMMO.
#
# Copyright (C) 2011, 2012 Charles Nelson
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundati... | #!/usr/bin/env python
# ##### BEGIN AGPL LICENSE BLOCK #####
# This file is part of SimpleMMO.
#
# Copyright (C) 2011, 2012 Charles Nelson
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundati... | Python | 0.000001 |
cf096184562d723d321f179732aa25f03be35c6d | build graphs without saving the dents | auto_fetch.py | auto_fetch.py | #!/usr/bin/env python
###############################################################################
##
## digger - Digging into some data mines
## Copyright (C) 2010 Thammi
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU Affero General Public License as pu... | #!/usr/bin/env python
###############################################################################
##
## digger - Digging into some data mines
## Copyright (C) 2010 Thammi
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU Affero General Public License as pu... | Python | 0.000001 |
cf46e08ebcd8a5d855ef7f21554d2d8edfac04f1 | Update the navboxes to be somewhat relevant. | avenue/web.py | avenue/web.py | # -*- coding: utf-8 -*-
# Copyright (c) 2012 Michael Babich
# See LICENSE.txt or http://opensource.org/licenses/MIT
'''Acts as an interface between what Flask serves and what goes on in
the rest of the application.
'''
from avenue import app, api
from flask import render_template, make_response
from copy import copy
i... | # -*- coding: utf-8 -*-
# Copyright (c) 2012 Michael Babich
# See LICENSE.txt or http://opensource.org/licenses/MIT
'''Acts as an interface between what Flask serves and what goes on in
the rest of the application.
'''
from avenue import app, api
from flask import render_template, make_response
from copy import copy
i... | Python | 0 |
f21a53ccb0c354cf925d059f0ca007cf0fbba829 | fix bug: rpc cup 100% | spider/rpc.py | spider/rpc.py | # -*- coding: utf-8 -*-
import logging
import sys
import json
from collections import deque
from time import sleep
from multiprocessing import Process
import pika
from scrapy.utils.project import get_project_settings
from task import crawl, gen_lxmlspider, gen_blogspider
SETTINGS = get_project_settings()
def t... | # -*- coding: utf-8 -*-
import logging
import sys
import json
from collections import deque
from time import sleep
from multiprocessing import Process
import pika
from scrapy.utils.project import get_project_settings
from task import crawl, gen_lxmlspider, gen_blogspider
SETTINGS = get_project_settings()
def t... | Python | 0 |
53ff0431378003126199d33a1f70faffa43bf792 | Add some simple view testing with django.test.Client | tic_tac_toe/tests.py | tic_tac_toe/tests.py | import json
import unittest
from django.core.urlresolvers import reverse, NoReverseMatch
from django.test import Client
from .game import Game, GameException
class TicTacToeGameTest(unittest.TestCase):
"Basic tests for Tic Tac Toe game"
def testEmptyGame(self):
"Empty game, computer vs computer, alw... | import unittest
from .game import Game, GameException
class TicTacToeTest(unittest.TestCase):
"Basic tests for Tic Tac Toe game"
def testEmptyGame(self):
"Empty game, computer vs computer, always ties"
game = Game()
while not game.is_over():
game.play()
# game shoul... | Python | 0.000001 |
93d3012b74dda05e058fc343d252173f33722bc1 | change default crawl date | split_data.py | split_data.py | #!/usr/bin/env python
import os
import logging
import argparse
import random
import json
import time
import datetime
def load_data(filename):
with open(filename, 'r') as f:
for line in f:
yield json.loads(line.strip())
def read_date(date_str):
try:
return time.strptime(date_str, '... | #!/usr/bin/env python
import os
import logging
import argparse
import random
import json
import time
import datetime
def load_data(filename):
with open(filename, 'r') as f:
for line in f:
yield json.loads(line.strip())
def read_date(date_str):
try:
return time.strptime(date_str, '... | Python | 0.000001 |
ea416504c287bc5a3716289b57ebfd15bb770b9d | Use a string instead of a file | sql/branch.py | sql/branch.py | import sys
from gratipay import wireup
env = wireup.env()
db = wireup.db(env)
# Temporary, will fill with actual values when running script
email_txt = """
rohitpaulk@live.com
abcd@gmail.com
"""
emails = [email.strip() for email in email_txt.split()]
assert len(emails) == 176
participants = []
participan... | from gratipay import wireup
env = wireup.env()
db = wireup.db(env)
participants = []
with open('./sql/emails.txt') as f:
emails = [line.rstrip() for line in f]
participants = db.all("""
SELECT p.*::participants
FROM participants p
WHERE email_address IN %s
""", (tuple(emails), ... | Python | 0 |
36e3ee242098f1768e009fca320c5d94142529d1 | set debug to false | ui/app.py | ui/app.py | from flask import Flask, redirect, url_for, flash, g, config, session
from flask_restful import Api
from flask_sqlalchemy import SQLAlchemy
from flask_login import LoginManager, UserMixin, current_user, login_user
from werkzeug.security import generate_password_hash, check_password_hash
from flask_restful import Resour... | from flask import Flask, redirect, url_for, flash, g, config, session
from flask_restful import Api
from flask_sqlalchemy import SQLAlchemy
from flask_login import LoginManager, UserMixin, current_user, login_user
from werkzeug.security import generate_password_hash, check_password_hash
from flask_restful import Resour... | Python | 0.99987 |
6f155538c02a25fcdd038c703d78f8785dfc9da8 | Add most cache functionality | genbankfs/cache.py | genbankfs/cache.py | import hashlib
import os
import socket
import urllib
from Queue import Queue, Full, Empty
from StringIO import StringIO
from threading import Lock, Thread
# Set download timeout
socket.setdefaulttimeout(600)
class DownloadError(Exception):
pass
class DownloadWithExceptions(urllib.FancyURLopener):
def error(self... | class GenbankCache(object):
pass
| Python | 0.000004 |
1ab90959f3cedea320dce0c31bfee9a6775cef5c | Remove output_extension config | generate_resume.py | generate_resume.py | import argparse
import jinja2
import os
import yaml
import bnrg.filters
from debug.debug import dprint
class OutputFormat(object):
def __init__(self, arg_name, template_extension, output_suffix):
self.arg_name = arg_name
self.template_extension = template_extension
self.output_suffix = out... | import argparse
import jinja2
import os
import yaml
import bnrg.filters
from debug.debug import dprint
class OutputFormat(object):
def __init__(self, arg_name, template_extension, output_suffix, output_extension):
self.arg_name = arg_name
self.template_extension = template_extension
self.o... | Python | 0 |
62fc93d2847f09d4f4b9f7ed7cf58a55e795d291 | Switch to multi-process execution | utils/eliteprospects_utils.py | utils/eliteprospects_utils.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from urllib.parse import urlparse
from collections import namedtuple
from concurrent.futures import ProcessPoolExecutor, as_completed
import requests
from lxml import html
from utils import remove_non_ascii_chars
# base url for eliteprospects.com
BASE_URL = "http://www... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from urllib.parse import urlparse
from collections import namedtuple
from concurrent.futures import ThreadPoolExecutor, as_completed
import requests
from lxml import html
from utils import remove_non_ascii_chars
# base url for eliteprospects.com
BASE_URL = "http://www.... | Python | 0.000004 |
bd1ae8fbcbcdfc649c765259f543f52a5a21c303 | Reset root logger before setting up logging | src/hades/common/cli.py | src/hades/common/cli.py | import argparse
import logging
import os
import sys
from gettext import gettext as _
from hades import constants
class ArgumentParser(argparse.ArgumentParser):
"""
ArgumentParser subclass that exists with os.EX_USAGE exit code if parsing
fails.
"""
def error(self, message):
self.print_usa... | import argparse
import logging
import os
import sys
from gettext import gettext as _
from hades import constants
class ArgumentParser(argparse.ArgumentParser):
"""
ArgumentParser subclass that exists with os.EX_USAGE exit code if parsing
fails.
"""
def error(self, message):
self.print_usa... | Python | 0 |
e0280150917934e9ba051966e8aa966d4cd43a6d | fix flake warning try 2 | verisure/devices/smartplug.py | verisure/devices/smartplug.py | """
Smartplug device
"""
import time
from .overview import Overview
OVERVIEW_URL = '/overview/smartplug'
COMMAND_URL = '/smartplugs/onoffplug.cmd'
DETAILS_URL = '/smarthome/{}/details'
class Smartplug(object):
""" Smartplug device
Args:
session (verisure.session): Current session
"""
def _... | """
Smartplug device
"""
import time
from .overview import Overview
OVERVIEW_URL = '/overview/smartplug'
COMMAND_URL = '/smartplugs/onoffplug.cmd'
DETAILS_URL = '/smarthome/{}/details'
class Smartplug(object):
""" Smartplug device
Args:
session (verisure.session): Current session
"""
def _... | Python | 0 |
2cfa733900ca385dbc835124895771f04dc21969 | add v4l2 codecs | voctocore/lib/localplayout.py | voctocore/lib/localplayout.py | #!/usr/bin/env python3
import logging
import gi
from gi.repository import Gst
from vocto.video_codecs import construct_video_encoder_pipeline
from lib.args import Args
from lib.config import Config
class LocalPlayout():
def __init__(self, source, port, use_audio_mix=False, audio_blinded=False):
# create... | #!/usr/bin/env python3
import logging
import gi
from gi.repository import Gst
from vocto.video_codecs import construct_video_encoder_pipeline
from lib.args import Args
from lib.config import Config
class LocalPlayout():
def __init__(self, source, port, use_audio_mix=False, audio_blinded=False):
# create... | Python | 0.00002 |
d301cfc0e8f76c94f8f3bcd1b0263f9bd6e1604c | Add call_decorator to RedisManager. | vumi/persist/redis_manager.py | vumi/persist/redis_manager.py | # -*- test-case-name: vumi.persist.tests.test_redis_manager -*-
import redis
from vumi.persist.redis_base import Manager
from vumi.persist.fake_redis import FakeRedis
from vumi.persist.riak_manager import flatten_generator
class RedisManager(Manager):
call_decorator = staticmethod(flatten_generator)
@clas... | # -*- test-case-name: vumi.persist.tests.test_redis_manager -*-
import redis
from vumi.persist.redis_base import Manager
from vumi.persist.fake_redis import FakeRedis
class RedisManager(Manager):
@classmethod
def _fake_manager(cls, key_prefix, client=None):
if client is None:
client = Fa... | Python | 0 |
8320b81b7355c0158231b4a3c7ac40c49872f7b1 | handle partial pbuttons in ss tab | scripts/ss_tab.py | scripts/ss_tab.py | # pandas and numpy for data manipulation
import pandas as pd
import numpy as np
import sqlite3
import holoviews as hv
hv.extension('bokeh')
from bokeh.plotting import Figure
from bokeh.models import (CategoricalColorMapper, HoverTool,
ColumnDataSource, Panel,
FuncTickFormatter, SingleIntervalTicker, L... | # pandas and numpy for data manipulation
import pandas as pd
import numpy as np
import sqlite3
import holoviews as hv
hv.extension('bokeh')
from bokeh.plotting import Figure
from bokeh.models import (CategoricalColorMapper, HoverTool,
ColumnDataSource, Panel,
FuncTickFormatter, SingleIntervalTicker, L... | Python | 0 |
64967f3d262a1823a5d0cd22fb096f9529e6aa98 | resolve flake8 linting errors | watson/validators/__init__.py | watson/validators/__init__.py | # -*- coding: utf-8 -*-
__version__ = '1.0.6'
try:
# Fix for setup.py version import
from watson.validators.numeric import Range
from watson.validators.string import Length, Required, RegEx, Csrf
__all__ = ['Range', 'Length', 'Required', 'RegEx', 'Csrf']
except: # noqa, pragma: no cover
pass # p... | # -*- coding: utf-8 -*-
__version__ = '1.0.6'
try:
# Fix for setup.py version import
from watson.validators.numeric import Range
from watson.validators.string import Length, Required, RegEx, Csrf
__all__ = ['Range', 'Length', 'Required', 'RegEx', 'Csrf']
except: # pragma: no cover
pass # pragma:... | Python | 0.000001 |
5aa594d02bfcdfe5eefe90fad1e464070b6ae9b5 | Update common.py | bin/common.py | bin/common.py | #!/usr/bin/python
import os
import multiprocessing as mp
import subprocessing as sub
import shlex
def fixDirName(dirpath):
if dirpath[-1] != '/':
dirpath += '/'
return dirpath
def makeDir(dirpath):
if not os.path.exists(dirpath):
os.mkdir(dirpath)
return 0
def importSampleList(infile):
... | #!/usr/bin/python
import os
import multiprocessing as mp
import subprocessing as sub
import shlex
def fixDirName(dirpath):
if dirpath[-1] != '/':
dirpath += '/'
return dirpath
def makeDir(dirpath):
if not os.path.exists(dirpath):
os.mkdir(dirpath)
return 0
def importSampleList(infile):
... | Python | 0.000001 |
534d66ff92e6fd00ea92a08c76f39614b9977967 | make it compatible to python3 | uuhash.py | uuhash.py | #!/usr/bin/env python3
import os
import hashlib
import binascii
import struct
__all__ = ["UUHash"]
# https://en.wikipedia.org/wiki/UUHash
# MLDonkey source code, file src/utils/lib/fst_hash.c, retrieved 2014-08-20
# http://sourceforge.net/projects/mldonkey/files/mldonkey/3.1.5/mldonkey-3.1.5.tar.bz2
# http://www.o... | #!/usr/bin/env python
import os
import hashlib
import binascii
import struct
__all__ = ["UUHash"]
# https://en.wikipedia.org/wiki/UUHash
# MLDonkey source code, file src/utils/lib/fst_hash.c, retrieved 2014-08-20
# http://sourceforge.net/projects/mldonkey/files/mldonkey/3.1.5/mldonkey-3.1.5.tar.bz2
# http://www.op... | Python | 0.000283 |
ae179cf964939a97184402039574d7ee9b2e62da | Add BlogPost update test | blog/tests.py | blog/tests.py | from django.test import TestCase
from .models import BlogPost
from django.contrib.auth.models import User
class BlogTest(TestCase):
def setUp(self):
self.user = User.objects.create_user(username = "user001", email = "email@domain.com", password = "password123456")
def test_post_creation(self):
... | from django.test import TestCase
from .models import BlogPost
from django.contrib.auth.models import User
class BlogTest(TestCase):
def setUp(self):
self.user = User.objects.create_user(username = "user001", email = "email@domain.com", password = "password123456")
def test_post_creation(self):
... | Python | 0 |
59851b283b8cb6f92895090ba23e71be48f1a990 | remove distinction between sfa aggregate and geni_aggregate | sfa/methods/GetVersion.py | sfa/methods/GetVersion.py | from sfa.util.faults import *
from sfa.util.namespace import *
from sfa.util.method import Method
from sfa.util.parameter import Parameter
class GetVersion(Method):
"""
Returns this GENI Aggregate Manager's Version Information
@return version
"""
interfaces = ['registry','aggregate', 'slicemgr', '... | from sfa.util.faults import *
from sfa.util.namespace import *
from sfa.util.method import Method
from sfa.util.parameter import Parameter
class GetVersion(Method):
"""
Returns this GENI Aggregate Manager's Version Information
@return version
"""
interfaces = ['geni_am','registry']
accepts = [... | Python | 0.999021 |
1fde3398d5fe132d628acce03392d459e718e2ad | Fix 400 error response for proxied resources | slyd/slyd/splash/proxy.py | slyd/slyd/splash/proxy.py | from __future__ import absolute_import
import functools
import requests
from twisted.internet.threads import deferToThread
from twisted.internet.defer import CancelledError
from twisted.web.resource import Resource
from twisted.web.server import NOT_DONE_YET
from PyQt4.QtNetwork import QNetworkRequest
from .ferry im... | from __future__ import absolute_import
import functools
import requests
from twisted.internet.threads import deferToThread
from twisted.internet.defer import CancelledError
from twisted.web.resource import Resource
from twisted.web.server import NOT_DONE_YET
from PyQt4.QtNetwork import QNetworkRequest
from .ferry im... | Python | 0 |
7dd344129e2ae30a857f72fdf61dca6e40768983 | fix city field duplication (#17919) | addons/base_address_city/models/res_partner.py | addons/base_address_city/models/res_partner.py | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from lxml import etree
from odoo import api, models, fields
class Partner(models.Model):
_inherit = 'res.partner'
country_enforce_cities = fields.Boolean(related='country_id.enforce_cities')
city_id = fiel... | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from lxml import etree
from odoo import api, models, fields
class Partner(models.Model):
_inherit = 'res.partner'
country_enforce_cities = fields.Boolean(related='country_id.enforce_cities')
city_id = fiel... | Python | 0.000004 |
7a105fe9201882749a7415bff580b9588b7f9a46 | update version number | account_invoice_line_description/__openerp__.py | account_invoice_line_description/__openerp__.py | # -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2015 Agile Business Group sagl
# (<http://www.agilebg.com>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public ... | # -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2015 Agile Business Group sagl
# (<http://www.agilebg.com>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public ... | Python | 0.000088 |
b20d07aa14d3c11d5509e96fd4911de5886afe28 | fix order for AttributeViewSet | apps/domain/views.py | apps/domain/views.py | from django.shortcuts import render
from django.contrib.auth.decorators import login_required
from rest_framework import viewsets, mixins, filters
from rest_framework.permissions import DjangoModelPermissions, IsAuthenticated
from .models import *
from .serializers import *
@login_required()
def domain(request):
... | from django.shortcuts import render
from django.contrib.auth.decorators import login_required
from rest_framework import viewsets, mixins, filters
from rest_framework.permissions import DjangoModelPermissions, IsAuthenticated
from .models import *
from .serializers import *
@login_required()
def domain(request):
... | Python | 0.000001 |
34035c4b272e9271834c531990c404940eee8633 | Add a link between vote and subproposal | apps/votes/models.py | apps/votes/models.py | from django.db import models
from meps.models import MEP
class Proposal(models.Model):
id = models.CharField(max_length=63, primary_key=True)
title = models.CharField(max_length=255, unique=True)
class SubProposal(models.Model):
datetime = models.DateTimeField()
subject = models.CharField(max_length=2... | from django.db import models
from meps.models import MEP
class Proposal(models.Model):
id = models.CharField(max_length=63, primary_key=True)
title = models.CharField(max_length=255, unique=True)
class SubProposal(models.Model):
datetime = models.DateTimeField()
subject = models.CharField(max_length=2... | Python | 0 |
757c0c9bc14118bd0b95548270a6a3d6a2e54e75 | return len of step pile contents | conjure/ui/widgets/step.py | conjure/ui/widgets/step.py | from ubuntui.utils import Padding, Color
from ubuntui.widgets.hr import HR
from ubuntui.widgets.buttons import submit_btn
from urwid import (WidgetWrap, Pile, Columns, Text)
class StepWidget(WidgetWrap):
def __init__(self, app, step_model, step_model_widget, cb):
"""
Arguments:
step_model:... | from ubuntui.utils import Padding, Color
from ubuntui.widgets.hr import HR
from ubuntui.widgets.buttons import submit_btn
from urwid import (WidgetWrap, Pile, Columns, Text)
class StepWidget(WidgetWrap):
def __init__(self, app, step_model, step_model_widget, cb):
"""
Arguments:
step_model:... | Python | 0.000001 |
a21dc1a4bcf89fe34bffcd3b297eb8c3848b53cf | random.choice is fast enough, simplify away numpy | streamkov/markov.py | streamkov/markov.py | # -*- coding: utf-8 -*-
"""
markov
~~~~~~
Class for streamable markov chain
"""
from collections import defaultdict
import random
class MarkovGenerator(object):
def __init__(self):
self.word_list = []
self.word_index = {}
self.word_states = defaultdict(WordState)
self.... | # -*- coding: utf-8 -*-
"""
markov
~~~~~~
Class for streamable markov chain
"""
from collections import Counter, defaultdict
import numpy as np
def has_sentence_boundary(bigram):
return bigram[0].endswith('.')
class MarkovGenerator(object):
def __init__(self):
self.word_list = []
... | Python | 0.999999 |
a2082e319854f88842e3acf8244d38a81f7046ae | Add secure/insecure reverse helpers. | subdomains/utils.py | subdomains/utils.py | import functools
from urlparse import urlunparse
from django.conf import settings
from django.contrib.sites.models import Site
from django.core.urlresolvers import reverse as simple_reverse
def urljoin(domain, path=None, scheme=None):
if path is None:
path = ''
if scheme is None:
scheme = ge... | from urlparse import urlunparse
from django.conf import settings
from django.contrib.sites.models import Site
from django.core.urlresolvers import reverse as simple_reverse
def urljoin(domain, path=None, scheme=None):
if path is None:
path = ''
if scheme is None:
scheme = getattr(settings, '... | Python | 0.000001 |
8315fb3fb1b7ef65b9c1ced4feaeb473863495f5 | Remove current_site_domain | subdomains/utils.py | subdomains/utils.py | import functools
try:
from urlparse import urlunparse
except ImportError:
from urllib.parse import urlunparse
from django.conf import settings
from django.core.urlresolvers import reverse as simple_reverse
def get_domain():
domain = getattr(settings, 'BASE_DOMAIN', False)
prefix = 'www.'
if geta... | import functools
try:
from urlparse import urlunparse
except ImportError:
from urllib.parse import urlunparse
from django.conf import settings
from django.core.urlresolvers import reverse as simple_reverse
def current_site_domain():
domain = getattr(settings, 'BASE_DOMAIN', False)
prefix = 'www.'
... | Python | 0.000157 |
496481e3bd6392a44788fadc7cf517fc36143e96 | Change to cb_story, clean up TZ handling some more | contrib/plugins/w3cdate.py | contrib/plugins/w3cdate.py | """
Add a 'w3cdate' key to every entry -- this contains the date in ISO8601 format
WARNING: you must have PyXML installed as part of your python installation
in order for this plugin to work
Place this plugin early in your load_plugins list, so that the w3cdate will
be available to subsequent plugins
"""
__author__ ... | """
Add a 'w3cdate' key to every entry -- this contains the date in ISO8601 format
WARNING: you must have PyXML installed as part of your python installation
in order for this plugin to work
Place this plugin early in your load_plugins list, so that the w3cdate will
be available to subsequent plugins
"""
__author__ ... | Python | 0 |
f40a8e5b475ba2f82836166f70ae75aab0c269c8 | Change permissions on tagging | core/web/api/observable.py | core/web/api/observable.py | from __future__ import unicode_literals
from flask_classy import route
from flask import request, abort
from flask_login import current_user
from core.web.api.crud import CrudApi, CrudSearchApi
from core import observables
from core.web.api.api import render
from core.web.helpers import get_object_or_404
from core.he... | from __future__ import unicode_literals
from flask_classy import route
from flask import request
from core.web.api.crud import CrudApi, CrudSearchApi
from core import observables
from core.web.api.api import render
from core.web.helpers import get_object_or_404
from core.helpers import refang
from core.web.helpers im... | Python | 0 |
e5e83b75e250ee3c6d8084e23ee777d519293cb6 | Fix for keystone / swift 1.8.0 | swprobe/__init__.py | swprobe/__init__.py | # Copyright (c) 2012 Spil Games
#
# 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... | # Copyright (c) 2012 Spil Games
#
# 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... | Python | 0 |
7e9072e97acdc2c5c873f3abf850dccbfd8d6bac | Add a method to shutdown global event loop | tartpy/eventloop.py | tartpy/eventloop.py | """
Very basic implementation of an event loop
==========================================
Exports
-------
- ``ThreadedEventLoop``: global event loop running in a thread
- ``ManualEventLoop``: global event loop to be run synchronously
- ``individual_loop_step``: process one event
- ``individual_loop``: process eve... | """
Very basic implementation of an event loop
==========================================
Exports
-------
- ``ThreadedEventLoop``: global event loop running in a thread
- ``ManualEventLoop``: global event loop to be run synchronously
- ``individual_loop_step``: process one event
- ``individual_loop``: process eve... | Python | 0.000002 |
dde25723c845ad4f6df72729e76174210b16e71c | remove redundant code | test/test_client.py | test/test_client.py | import pytest
from pyrelatics.client import *
def test_relaticsapi_raise_exception_with_dummy_url():
with pytest.raises(URLError):
RelaticsAPI('dummy_company', 'dummy_env_id', 'dummy_wid')
def test_relaticsapi_initializes_properties():
relaticsapi = RelaticsAPI('kb', 'dummy_env_id', 'dummy_wid')
... | import pytest
from pyrelatics.client import *
def test_relaticsapi_raise_exception_with_dummy_url():
with pytest.raises(URLError):
relaticsapi = RelaticsAPI('dummy_company', 'dummy_env_id', 'dummy_wid')
def test_relaticsapi_initializes_properties():
relaticsapi = RelaticsAPI('kb', 'dummy_env_id', '... | Python | 0.999999 |
9fa55bc43a3f83a57318799ba8b9f2769676bd44 | Include the tags module tests in the full library testsuite. | test/test_flvlib.py | test/test_flvlib.py | import unittest
import test_primitives, test_astypes, test_helpers, test_tags
def get_suite():
modules = (test_primitives, test_astypes, test_helpers, test_tags)
suites = [unittest.TestLoader().loadTestsFromModule(module) for
module in modules]
return unittest.TestSuite(suites)
def main():
... | import unittest
import test_primitives, test_astypes, test_helpers
def get_suite():
modules = (test_primitives, test_astypes, test_helpers)
suites = [unittest.TestLoader().loadTestsFromModule(module) for
module in modules]
return unittest.TestSuite(suites)
def main():
unittest.TextTestRu... | Python | 0 |
1598a865094591cbfd1e4e37eddb905fffd1d9b0 | improve and extend unit tests for Logfile | test/test_parser.py | test/test_parser.py | # This file is part of cclib (http://cclib.github.io), a library for parsing
# and interpreting the results of computational chemistry packages.
#
# Copyright (C) 2015, the cclib development team
#
# The library is free software, distributed under the terms of
# the GNU Lesser General Public version 2.1 or later. You s... | # This file is part of cclib (http://cclib.github.io), a library for parsing
# and interpreting the results of computational chemistry packages.
#
# Copyright (C) 2015, the cclib development team
#
# The library is free software, distributed under the terms of
# the GNU Lesser General Public version 2.1 or later. You s... | Python | 0 |
5fa101cfa8f311079742552f451e1194d975bb62 | test ttlser drop the versioninfo from the last line to make comparison to good.ttl simpler | test/test_ttlser.py | test/test_ttlser.py | import inspect
import os
import random
import rdflib
import re
import subprocess
import sys
import unittest
rdflib.plugin.register('nifttl', rdflib.serializer.Serializer, 'pyontutils.ttlser', 'CustomTurtleSerializer')
class TestTtlser(unittest.TestCase):
def setUp(self):
goodpath = 'test/good.ttl'
... | import inspect
import os
import random
import rdflib
import re
import subprocess
import sys
import unittest
rdflib.plugin.register('nifttl', rdflib.serializer.Serializer, 'pyontutils.ttlser', 'CustomTurtleSerializer')
class TestTtlser(unittest.TestCase):
def setUp(self):
goodpath = 'test/good.ttl'
... | Python | 0 |
2250fcaefc1b69116684c72c559a44ee1d6721b6 | change component count back to 4 in dp 2-cluster test | test_dp_2cluster.py | test_dp_2cluster.py | from dpconverge.data_set import DataSet
from sklearn.datasets.samples_generator import make_blobs
n_features = 2
points_per_feature = 100
centers = [[2, 2], [4, 4]]
ds = DataSet(parameter_count=2)
for i, center in enumerate(centers):
X, y = make_blobs(
n_samples=points_per_feature,
n_features=n_... | from dpconverge.data_set import DataSet
from sklearn.datasets.samples_generator import make_blobs
n_features = 2
points_per_feature = 100
centers = [[2, 2], [4, 4]]
ds = DataSet(parameter_count=2)
for i, center in enumerate(centers):
X, y = make_blobs(
n_samples=points_per_feature,
n_features=n_... | Python | 0.000001 |
3ded2f462c859542b871c1311ce3b801f41370e7 | use get_model from apps | adhocracy4/api/mixins.py | adhocracy4/api/mixins.py | from django.apps import apps
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.http import Http404
from django.shortcuts import get_object_or_404
from adhocracy4.modules import models as module_models
class ContentTypeMixin:
"""
Should be used in combina... | from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.db.models.loading import get_model
from django.http import Http404
from django.shortcuts import get_object_or_404
from adhocracy4.modules import models as module_models
class ContentTypeMixin:
"""
Should b... | Python | 0.000001 |
59b9e41ebe70df35902a7d328ad879bd988aa7c0 | remove getServerList -- it belongs to VLDbDAO | afs/dao/FileServerDAO.py | afs/dao/FileServerDAO.py | import re,string,os,sys
import afs.dao.bin
from afs.model.FileServer import FileServer
from afs.model.Partition import Partition
from afs.util import afsutil
class FileServerDAO() :
"""
low level access to a FileServer
"""
def __init__(self) :
pass
def get... | import re,string,os,sys
import afs.dao.bin
from afs.model.FileServer import FileServer
from afs.model.Partition import Partition
from afs.util import afsutil
class FileServerDAO() :
"""
Provides Information about a FileServer
"""
def __init__(self) :
pass
... | Python | 0.000002 |
2ee45754c73a344d2cdbc0007a5a7877ba45288e | improve output, calculate frequencies at non-singletons | scripts/calculate_methylation_frequency.py | scripts/calculate_methylation_frequency.py | #! /usr/bin/env python
import math
import sys
import csv
import argparse
from collections import namedtuple
class SiteStats:
def __init__(self, g_size, g_seq):
self.num_reads = 0
self.posterior_methylated = 0
self.called_sites = 0
self.called_sites_methylated = 0
self.group... | #! /usr/bin/env python
import math
import sys
import csv
import argparse
from collections import namedtuple
class SiteStats:
def __init__(self):
self.num_reads = 0
self.posterior_methylated = 0
self.called_sites = 0
self.called_sites_methylated = 0
parser = argparse.ArgumentParser... | Python | 0.999204 |
6fe0ec420008bca5c5a04f51f0c1896b65d73ead | remove crpdate model traces | tnp/consent/views.py | tnp/consent/views.py | from django.shortcuts import render
from django.http import HttpResponse, HttpResponseRedirect
from django.contrib.auth import authenticate, login, logout
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from company.models import Company, Job, JobLocation, Attachm... | from django.shortcuts import render
from django.http import HttpResponse, HttpResponseRedirect
from django.contrib.auth import authenticate, login, logout
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from company.models import Company, Job, JobLocation, CRPDate... | Python | 0 |
6a0c3d0dc5f0106fdc1f7682fa65eabfb5c9d250 | Set version as 0.6.12 | alignak_webui/version.py | alignak_webui/version.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2015-2017:
# Frederic Mohier, frederic.mohier@alignak.net
#
"""
Alignak - Web User Interface
"""
# Package name
__pkg_name__ = u"alignak_webui"
# Checks types for PyPI keywords
# Used for:
# - PyPI keywords
# - directory where to store files in the ... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2015-2017:
# Frederic Mohier, frederic.mohier@alignak.net
#
"""
Alignak - Web User Interface
"""
# Package name
__pkg_name__ = u"alignak_webui"
# Checks types for PyPI keywords
# Used for:
# - PyPI keywords
# - directory where to store files in the ... | Python | 0.000247 |
b4013acd97851b041a47afa87e0da137e556ca3f | sort the output | tools/gen_gallery.py | tools/gen_gallery.py | #!/usr/bin/python
import os,sys,re
# this sucks
patches = [ x for x in os.listdir('.') if re.match(r'.*\.gif$', x) ]
patches.sort()
print '''<style type="text/css">
div {
float: left;
width: 20%;
}
</style>
'''
print ''.join(['<div><img src="%s" /><br />%s</div>' % (x,x) for x in patches])
| #!/usr/bin/python
import os,sys,re
# this sucks
patches = [ x for x in os.listdir('.') if re.match(r'.*\.gif$', x) ]
print '''<style type="text/css">
div {
float: left;
width: 20%;
}
</style>
'''
print ''.join(['<div><img src="%s" /><br />%s</div>' % (x,x) for x in patches])
| Python | 1 |
35f8ac20ec5ef830f264ba51bcb5df5af72b24d6 | mask out HC3N features | analysis/masked_cubes.py | analysis/masked_cubes.py | import numpy as np
from spectral_cube import SpectralCube,BooleanArrayMask
from astropy import units as u
from paths import hpath
from astropy.io import fits
import time
from astropy import log
t0 = time.time()
hc3n_regions = [{'v':(-101,55),
'x':(500,533),
'y':(108,133),},
... | import numpy as np
from spectral_cube import SpectralCube,BooleanArrayMask
from astropy import units as u
from paths import hpath
from astropy.io import fits
import time
from astropy import log
t0 = time.time()
cube303 = SpectralCube.read(hpath('APEX_H2CO_303_202_bl.fits')).with_spectral_unit(u.km/u.s, velocity_conve... | Python | 0 |
c73033031e6167c13af6014d49a733ac713aabd2 | Remove comment I had pasted all the names into | services/migrations/0021_populate_areas.py | services/migrations/0021_populate_areas.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, connection
from django.db.models import Max
MOUNT_LEBANON = 'Mount Lebanon'
TRIPOLI = 'Tripoli and surroundings'
INITIAL_AREAS = [
# Numbers are arbitrary, just so we can know which ones we created and remove
# ... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, connection
from django.db.models import Max
MOUNT_LEBANON = 'Mount Lebanon'
TRIPOLI = 'Tripoli and surroundings'
INITIAL_AREAS = [
# Numbers are arbitrary, just so we can know which ones we created and remove
# ... | Python | 0 |
79f8f6c922e6f0be3f6bf62c13cbe6dc9c50366a | Remove project_config dependency | budget_proj/budget_proj/settings/production.py | budget_proj/budget_proj/settings/production.py | import requests
from .base import *
import os
# from .. import project_config
SECRET_KEY = os.environ.get('DJANGO_SECRET_KEY')
# ALLOWED_HOSTS = project_config.ALLOWED_HOSTS
ALLOWED_HOSTS = ['*']
# Get the IPV4 address we're working with on AWS
# The Loadbalancer uses this ip address for healthchecks
# EC2_PRIVATE... | import requests
from .base import *
from .. import project_config
SECRET_KEY = project_config.DJANGO_SECRET_KEY
ALLOWED_HOSTS = project_config.ALLOWED_HOSTS
# Get the IPV4 address we're working with on AWS
# The Loadbalancer uses this ip address for healthchecks
EC2_PRIVATE_IP = None
try:
EC2_PRIVATE_IP = requ... | Python | 0.000001 |
3fb2986bc4f344e7c0ec751c38d257ce99681ebe | add tests for -L/--list-engines option | anytemplate/tests/cli.py | anytemplate/tests/cli.py | #
# Copyright (C) 2015 Satoru SATOH <ssato at redhat.com>
# License: MIT
#
"""Tests of anytempalte.cli
"""
import os.path
import os
import subprocess
import unittest
import anytemplate.cli as TT
import anytemplate.tests.common
from anytemplate.engine import find_by_name
CLI_SCRIPT = os.path.join(anytemplate.tests.c... | #
# Copyright (C) 2015 Satoru SATOH <ssato at redhat.com>
# License: MIT
#
"""Tests of anytempalte.cli
"""
import os.path
import os
import subprocess
import unittest
import anytemplate.cli as TT
import anytemplate.tests.common
from anytemplate.engine import find_by_name
CLI_SCRIPT = os.path.join(anytemplate.tests.c... | Python | 0.000001 |
02360f5251ac308f45cb210a305fa225a056e1be | add travis config for keen public read key | website/settings/local-travis.py | website/settings/local-travis.py | # -*- coding: utf-8 -*-
'''Example settings/local.py file.
These settings override what's in website/settings/defaults.py
NOTE: local.py will not be added to source control.
'''
import inspect
from . import defaults
import os
DB_PORT = 27017
DEV_MODE = True
DEBUG_MODE = True # Sets app to debug mode, turns off tem... | # -*- coding: utf-8 -*-
'''Example settings/local.py file.
These settings override what's in website/settings/defaults.py
NOTE: local.py will not be added to source control.
'''
import inspect
from . import defaults
import os
DB_PORT = 27017
DEV_MODE = True
DEBUG_MODE = True # Sets app to debug mode, turns off tem... | Python | 0 |
84234fd72c70eac5228d835de79a12cf4515204e | Add material to be an attribute for all styles | simlammps/common/atom_style_description.py | simlammps/common/atom_style_description.py | import itertools
from simphony.core.cuba import CUBA
from simlammps.common.atom_style import AtomStyle
class AtomStyleDescription(object):
""" Class describes atom style
Each atom style has a particular set of attributes that it supports
(or provides). This class contains a list of what attributes it... | import itertools
from simphony.core.cuba import CUBA
from simlammps.common.atom_style import AtomStyle
class AtomStyleDescription(object):
""" Class describes atom style
Each atom style has a particular set of attributes that it supports
(or provides). This class contains a list of what attributes it... | Python | 0 |
d5584246d2f09c690611c2bb705598ca324a24d1 | Update the importer to support the fuller CSV format. | app/stores/management/commands/import_stores.py | app/stores/management/commands/import_stores.py | import csv
import requests
from StringIO import StringIO
from django.db import transaction
from django.core.management.base import BaseCommand, CommandError
from stores.models import Country, County, Address, Store, Link, LinkType
from django.contrib.contenttypes.models import ContentType
class Command(BaseCommand):
... | import csv
import requests
from StringIO import StringIO
from django.db import transaction
from django.core.management.base import BaseCommand, CommandError
from stores.models import Country, County, Address, Store, Link, LinkType
from django.contrib.contenttypes.models import ContentType
class Command(BaseCommand):
... | Python | 0 |
42a0bd960095e96b536a51249f2355e82b59fd30 | Add methods for creating and deleting groups | wqflask/wqflask/group_manager.py | wqflask/wqflask/group_manager.py | import json
import redis
from flask import current_app
from flask import Blueprint
from flask import g
from flask import render_template
from flask import request
from flask import redirect
from flask import url_for
from gn3.authentication import get_groups_by_user_uid
from gn3.authentication import get_user_info_by_k... | import redis
from flask import current_app
from flask import Blueprint
from flask import g
from flask import render_template
from gn3.authentication import get_groups_by_user_uid
from wqflask.decorators import login_required
group_management = Blueprint("group_management", __name__)
@group_management.route("/groups... | Python | 0 |
47c2936e65d00a08896b4e60060ff737b7a2f675 | Check that the permission migrations work | app/tests/workstations_tests/test_migrations.py | app/tests/workstations_tests/test_migrations.py | import pytest
from django.db import connection
from django.db.migrations.executor import MigrationExecutor
from guardian.shortcuts import get_perms
from grandchallenge.workstations.models import Workstation
from tests.factories import UserFactory
@pytest.mark.django_db(transaction=True)
def test_workstation_group_mi... | import pytest
from django.db import connection
from django.db.migrations.executor import MigrationExecutor
@pytest.mark.django_db(transaction=True)
def test_workstation_group_migration():
executor = MigrationExecutor(connection)
app = "workstations"
migrate_from = [(app, "0001_initial")]
migrate_to = ... | Python | 0 |
5aebcbef62ebc523a5fc240b8cd8e696b06c9b86 | Add error handling | webapp.py | webapp.py | #!/usr/bin/python
try:
import cgi
# Get the user input
form = cgi.FieldStorage()
# ***** SANITIZE USER INPUT HERE ****
start_page = '''<!DOCTYPE HTML>
<html>
<head>
<title>Room Finder Extraordinaire -- Start Page</title>
</head>
<body>
<h1>Room Finder Extraordina... | #!/usr/bin/python
import cgi
# Get the user input
form = cgi.FieldStorage()
# ***** SANITIZE USER INPUT HERE ****
start_page = '''<!DOCTYPE HTML>
<html>
<head>
<title>Room Finder Extraordinaire -- Start Page</title>
</head>
<body>
<h1>Room Finder Extraordinaire</h1>
<h2> Which Room can I get? </h2>
<f... | Python | 0.000002 |
f92b27c1ea241f381e41ef9b20bc6e75fc03c159 | Add OCA as author | account_invoice_merge_payment/__openerp__.py | account_invoice_merge_payment/__openerp__.py | # -*- coding: utf-8 -*-
##############################################################################
#
# This file is part of account_invoice_merge_payment,
# an Odoo module.
#
# Copyright (c) 2015 ACSONE SA/NV (<http://acsone.eu>)
#
# account_invoice_merge_payment is free software:
# you can redi... | # -*- coding: utf-8 -*-
##############################################################################
#
# This file is part of account_invoice_merge_payment,
# an Odoo module.
#
# Copyright (c) 2015 ACSONE SA/NV (<http://acsone.eu>)
#
# account_invoice_merge_payment is free software:
# you can redi... | Python | 0 |
ca27ff5efa987ce413d7e7f43c49fad189930aed | Fix missing migration dependency | entities/migrations/0045_auto_20160922_1330.py | entities/migrations/0045_auto_20160922_1330.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-09-22 11:30
from __future__ import unicode_literals
from django.db import migrations
def set_groupcontent_group(apps, schema_editor):
Group1 = apps.get_model('entities.Group')
Group2 = apps.get_model('groups.Group')
GroupContent = apps.get_mode... | # -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-09-22 11:30
from __future__ import unicode_literals
from django.db import migrations
def set_groupcontent_group(apps, schema_editor):
Group1 = apps.get_model('entities.Group')
Group2 = apps.get_model('groups.Group')
GroupContent = apps.get_mode... | Python | 0.000351 |
7de8c75cc5a90ecd87f1bb5ccf72c0ec79c9f531 | With empty string | examples/parse_context_free_grammar_example.py | examples/parse_context_free_grammar_example.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, division
import codecs
from nltk import parse_cfg
from nltk import word_tokenize
from nltk import RecursiveDescentParser
def encode(string, char_type='utf8', errors=''):
return codecs.encode(string, char_type, errors)
cfg = encode... | #!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, division
import codecs
from nltk import parse_cfg
from nltk import word_tokenize
from nltk import RecursiveDescentParser
def encode(string, char_type='utf8', errors=''):
return codecs.encode(string, char_type, errors)
cfg = encode... | Python | 0.9999 |
72ba3a0401ad08d4df2fdc03b326eab16af47832 | Bump version to 0.4.2.dev1 | django_backend/__init__.py | django_backend/__init__.py | from .backend.renderable import Renderable # noqa
from .group import Group # noqa
from .sitebackend import SiteBackend
__version__ = '0.4.2.dev1'
default_app_config = 'django_backend.apps.DjangoBackendConfig'
site = SiteBackend(id='backend')
| from .backend.renderable import Renderable # noqa
from .group import Group # noqa
from .sitebackend import SiteBackend
__version__ = '0.4.1'
default_app_config = 'django_backend.apps.DjangoBackendConfig'
site = SiteBackend(id='backend')
| Python | 0 |
de39d46fcbe51e29e008ebc24c3fbec347a75edd | Make BasicEmailTest work with any DEFAULT_FROM_EMAIL setting | django_send_email/tests.py | django_send_email/tests.py | from contextlib import contextmanager
from django.test import TestCase
from django.conf import settings
from django.core.management import CommandError, call_command
from django.core import mail
class SettingDoesNotExist:
pass
@contextmanager
def patch_settings(**kwargs):
old_settings = []
for key, new... | from contextlib import contextmanager
from django.test import TestCase
from django.conf import settings
from django.core.management import CommandError, call_command
from django.core import mail
class SettingDoesNotExist:
pass
@contextmanager
def patch_settings(**kwargs):
old_settings = []
for key, new... | Python | 0.000001 |
6dd3b2f7844e670b8774aa0afd25b83f60753703 | make sure django is setup before importing | dblistener.py | dblistener.py | import os, django
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'leaderboard.settings')
django.setup()
import time
import logging
from rethinkdb.errors import RqlDriverError
from leaderboardapp.models import Board, Player
from leaderboardapp.views import publish_board
logger = logging.getLogger('dblistener')
while... | import os
import time
import logging
import django
from rethinkdb.errors import RqlDriverError
from leaderboardapp.models import Board, Player
from leaderboardapp.views import publish_board
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'leaderboard.settings')
django.setup()
logger = logging.getLogger('dblistener')
... | Python | 0 |
b57e79fadf54bd0a34eaf81ec57059fe964e3be8 | rewrite semalock | decorators.py | decorators.py | import os
from functools import wraps
from requests import Timeout, ConnectionError
from socket import timeout as socket_timeout
import logging
from .models import ArbitraryAccessObject
from shutil import get_terminal_size
timeouts = (Timeout, socket_timeout, ConnectionError)
__author__ = 'zz'
def threading_lock(lo... | import os
from functools import wraps
from requests import Timeout, ConnectionError
from socket import timeout as socket_timeout
import logging
from .models import ArbitraryAccessObject
from shutil import get_terminal_size
timeouts = (Timeout, socket_timeout, ConnectionError)
__author__ = 'zz'
def threading_lock(l... | Python | 0.999991 |
0eb08689906556951bacf82166d13cda7a8d720b | Update pylsy_test.py | tests/pylsy_test.py | tests/pylsy_test.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
import unittest
from pylsy.pylsy import PylsyTable
class PylsyTableTests(unittest.TestCase):
def setUp(self):
attributes=["name","age"]
self.table = PylsyTable(attributes)
def tearDown(self):
self.table = None
def tes... | # -*- coding: utf-8 -*-
from __future__ import absolute_import
__author__ = 'choleraehyq'
import unittest
from pylsy.pylsy import PylsyTable
class PylsyTableTests(unittest.TestCase):
def setUp(self):
attributes=["name","age"]
self.table = PylsyTable(attributes)
def tearDown(self):
sel... | Python | 0 |
c4d784f1b478ca80697e9bbe843ebf84fe124f2b | update legacy scripted test to use new syntax | lib/rapidsms/tests/scripted.py | lib/rapidsms/tests/scripted.py | import warnings
from rapidsms.tests.harness import TestScript as TestScriptMixin
class TestScript(TestScriptMixin):
def startRouter(self):
warnings.warn("startRouter is deprecated and will be removed in a future "
"release. Please, see the release notes.", DeprecationWarning, stac... | import warnings
from django.test import TestCase
from rapidsms.tests.harness import TestScript as TestScriptMixin
class TestScript(TestScriptMixin, TestCase):
def startRouter(self):
warnings.warn("startRouter is deprecated and will be removed in a future "
"release. Please, see th... | Python | 0 |
5f8a3a5b02fdc7c1bbadc5a3c739bac2aee75176 | Add extra check for invalid boxes in random_transform. | keras_retinanet/utils/image.py | keras_retinanet/utils/image.py | """
Copyright 2017-2018 Fizyr (https://fizyr.com)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in w... | """
Copyright 2017-2018 Fizyr (https://fizyr.com)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in w... | Python | 0 |
0c8e92d78983635778043095740cc508259101ba | Fix typos in tests | tests/test_async.py | tests/test_async.py | # -*- coding: utf-8 -*-
from asyncio import Future, gather, new_event_loop, sleep
from mock import Mock
from twisted.internet.defer import ensureDeferred
from pyee import EventEmitter
class PyeeTestError(Exception):
pass
def test_asyncio_emit():
"""Test that event_emitters can handle wrapping coroutines as ... | # -*- coding: utf-8 -*-
from asyncio import Future, gather, new_event_loop, sleep
from mock import Mock
from twisted.internet.defer import ensureDeferred
from pyee import EventEmitter
class PyeeTestException(Exception):
pass
def test_asyncio_emit():
"""Test that event_emitters can handle wrapping coroutines... | Python | 0.034948 |
cf7b7e015dd8e428317cdfd8000bb49073a5758f | Update tih.py | tih.py | tih.py | __author__ = '@abhinavbom a.k.a Darkl0rd'
#local imports
from lib.parse import *
from api.vt import *
from api.urlvoid import *
from lib.updatefeed import gather
#stdlib imports
import argparse
banner = ''' Threat Intelligence Hunter framework Begins now '''
print banner
def main():
print "Intel test"
pars... | __author__ = '@abhinavbom a.k.a Darkl0rd'
#local imports
from lib.parse import *
from api.vt import *
from api.urlvoid import *
from lib.updatefeed import gather
#stdlib imports
import argparse
banner = ''' Threat Intelligence Hunter framework Begins now '''
print banner
def main():
print "Intel test"
pars... | Python | 0 |
8067af0c58ad3815fb15b530708bcb96a1874f3c | Add unit test for removing an element from an Ordering | tests/test_basic.py | tests/test_basic.py | from unittest import TestCase
from ordering import Ordering
class TestOrderingBasic(TestCase):
def test_empty_insert_start(self) -> None:
ordering = Ordering[int]()
ordering.insert_start(0)
self.assertIn(0, ordering)
self.assertNotIn(1, ordering)
def test_empty_insert_end(se... | from unittest import TestCase
from ordering import Ordering
class TestOrderingBasic(TestCase):
def test_empty_insert_start(self) -> None:
ordering = Ordering[int]()
ordering.insert_start(0)
self.assertIn(0, ordering)
self.assertNotIn(1, ordering)
def test_empty_insert_end(se... | Python | 0 |
95f2eaa662fc5650608447cb18f8b1df4be5f7c3 | ImportError take 2 | landlab/components/__init__.py | landlab/components/__init__.py | from .craters import CratersComponent
from .chi_index import ChiFinder
from .diffusion import LinearDiffuser
from .fire_generator import FireGenerator
from .flexure import Flexure
from .flow_accum import AccumFlow
from .flow_routing import FlowRouter, DepressionFinderAndRouter
from .glacier_thin_ice_model import Glacie... | from .craters import CratersComponent
from .chi_index import ChiFinder
from .diffusion import LinearDiffuser
from .fire_generator import FireGenerator
from .flexure import Flexure
from .flow_accum import AccumFlow
from .flow_routing import FlowRouter, DepressionFinderAndRouter
from .glacier_thin_ice_model import Glacie... | Python | 0.999076 |
c6afad83c3269995bd5914e2835dc10dba33ad3e | Fix tests after class rename | tests/test_clone.py | tests/test_clone.py | import os
from os.path import dirname, join, isfile
from shutil import rmtree
import unittest
from cvsgit.command.init import init
from cvsgit.command.clone import Clone
from cvsgit.command.pull import pull
from cvsgit.command.verify import Verify
from cvsgit.git import Git
from cvsgit.utils import Tempdir
class Test... | import os
from os.path import dirname, join, isfile
from shutil import rmtree
import unittest
from cvsgit.command.init import init
from cvsgit.command.clone import clone
from cvsgit.command.pull import pull
from cvsgit.command.verify import verify
from cvsgit.git import Git
from cvsgit.utils import Tempdir
class Test... | Python | 0.000001 |
c5c2d462731e79d9b7d8836e47bae10116c1ee81 | test cancelled callback | tests/test_defer.py | tests/test_defer.py | import sys
sys.path.insert(0, '..')
import unittest
import pyev
loop = pyev.default_loop()
from whizzer.defer import Deferred, CancelledError, AlreadyCalledError, TimeoutError
def throw_always(result):
raise Exception("success")
def one_always(result):
return 1
def add(a, b):
return a+b
class FakeLog... | import sys
sys.path.insert(0, '..')
import unittest
import pyev
loop = pyev.default_loop()
from whizzer.defer import Deferred, CancelledError, AlreadyCalledError, TimeoutError
def throw_always(result):
raise Exception("success")
def one_always(result):
return 1
def add(a, b):
return a+b
class FakeLog... | Python | 0.000001 |
014184197b6eeede4a8681a446aa1a8e7bdce9fa | Update views.py | demo/views.py | demo/views.py | import flask
import sys
from flask import request
app = flask.Flask(__name__)
@app.route('/')
def hello_world():
return flask.jsonify({
'message': 'Hello World!',
'python': sys.version,
'headers': str(request.headers)
})
| import flask
import sys
from flask import request
app = flask.Flask(__name__)
@app.route('/')
def hello_world():
return flask.jsonify({
'message': 'Hello Worlb!',
'python': sys.version,
'headers': str(request.headers)
})
| Python | 0 |
2e18e05659e9ba88f2fcce77259792f84b25e5fa | Add ability to disable frame evaluation | _pydevd_frame_eval/pydevd_frame_eval_main.py | _pydevd_frame_eval/pydevd_frame_eval_main.py | import os
import sys
IS_PY36_OR_OLDER = False
if (sys.version_info[0] == 3 and sys.version_info[1] >= 6) or sys.version_info[0] > 3:
IS_PY36_OR_OLDER = True
set_frame_eval = None
stop_frame_eval = None
use_frame_eval = os.environ.get('PYDEVD_USE_FRAME_EVAL', None)
if use_frame_eval == 'NO':
frame_eval_func,... | import os
import sys
IS_PY36_OR_OLDER = False
if (sys.version_info[0] == 3 and sys.version_info[1] >= 6) or sys.version_info[0] > 3:
IS_PY36_OR_OLDER = True
set_frame_eval = None
stop_frame_eval = None
if IS_PY36_OR_OLDER:
try:
from _pydevd_frame_eval.pydevd_frame_evaluator import frame_eval_func, s... | Python | 0 |
882c7f4ec9ead975175aabae17c11c9750b5095b | add basic support for solidsport | lib/svtplay_dl/service/solidtango.py | lib/svtplay_dl/service/solidtango.py | # ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
import re
import xml.etree.ElementTree as ET
from urllib.parse import urlparse
from svtplay_dl.error import ServiceError
from svtplay_dl.fetcher.hls import hlsparse
from svtplay_dl.service import Service
class Solidtango(Service... | # ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
import re
import xml.etree.ElementTree as ET
from urllib.parse import urlparse
from svtplay_dl.error import ServiceError
from svtplay_dl.fetcher.hls import hlsparse
from svtplay_dl.service import Service
class Solidtango(Service... | Python | 0 |
56675ad39c734993561b47373fa9db39e7f36323 | Remove spec_set from mock.patch('os.chdir'). | tests/test_utils.py | tests/test_utils.py | #
# Unit tests for the viewer.utils module.
#
# Copyright: (c) 2014 by Petr Zemek <s3rvac@gmail.com> and contributors
# License: BSD, see LICENSE for more details
#
import os
import unittest
from unittest import mock
from viewer.utils import chdir
@mock.patch('os.chdir')
class ChdirTests(unittest.TestCase):
def... | #
# Unit tests for the viewer.utils module.
#
# Copyright: (c) 2014 by Petr Zemek <s3rvac@gmail.com> and contributors
# License: BSD, see LICENSE for more details
#
import os
import unittest
from unittest import mock
from viewer.utils import chdir
@mock.patch('os.chdir', spec_set=os.chdir)
class ChdirTests(unittest... | Python | 0 |
ea027e70f94d351fade02a3110135e031b9f52c5 | Update botcmd import. | dieHardBot.py | dieHardBot.py | #!/usr/bin/env python
"""A bot which will respond to various Die Hard character name commands and
mentions and respond with a random line spoken by that character in the film.
"""
from errbot.botplugin import BotPlugin
from errbot import botcmd
from dieHard import DieHard
def generate(character):
f = lambda ... | #!/usr/bin/env python
"""A bot which will respond to various Die Hard character name commands and
mentions and respond with a random line spoken by that character in the film.
"""
from errbot.botplugin import BotPlugin
from errbot.jabberbot import botcmd
from dieHard import DieHard
def generate(character):
f... | Python | 0 |
ca90b06be21728f83a04cd9425e11e9fa0f4d684 | Remove reference to strong, since its not used | dirty_bits.py | dirty_bits.py | from django.db.models import get_models, ManyToManyField
from django.db.models.signals import post_init, post_save
from threading import Lock
hash_fnc = hash
REGISTRY_LOCK = Lock()
REGISTRY = set()
NEW_MODEL_HASH = None
def register_all(strict=False):
models = get_models()
for model in models:
regi... | from django.db.models import get_models, ManyToManyField
from django.db.models.signals import post_init, post_save
from threading import Lock
hash_fnc = hash
REGISTRY_LOCK = Lock()
REGISTRY = set()
NEW_MODEL_HASH = None
def register_all(strict=False):
models = get_models()
for model in models:
regi... | Python | 0.000003 |
74286f4d631b09d46a0c9df995aa21e608b99dc2 | Update regex_utils | text/regex_utils.py | text/regex_utils.py | # coding=utf-8
import re
def parse_line(regex , line):
if line == None:
return None
if regex == None:
return line
items = []
pattern = re.compile(regex)
match = pattern.match(line)
if match:
items = match.groups()
return items
def check_line(r... | # coding=utf-8
import re
def parse_line(regex , line):
if line == None:
return None
if regex == None:
return line
items = []
pattern = re.compile(regex)
match = pattern.match(line)
if match:
items = match.groups()
return items
def check_line(r... | Python | 0.000002 |
c679fcce6e48a445c6af5545977c0a286b4204c4 | Fix web.py line reading with empty page id | web.py | web.py | import socket
import threading
import re
import json
from collections import defaultdict
from html import escape as escape_html
from urllib.parse import quote_plus
class _Html(object):
def __init__(self, template, values):
self.value = template.format(*map(escape_html, values))
def __repr__(self):
... | import socket
import threading
import re
import json
from collections import defaultdict
from html import escape as escape_html
from urllib.parse import quote_plus
class _Html(object):
def __init__(self, template, values):
self.value = template.format(*map(escape_html, values))
def __repr__(self):
... | Python | 0 |
e5fb37ad00eff773640c2c71b2c8b15dda5a8015 | Refactor web.py | web.py | web.py | import json
import os
import logging
from flask import Flask, render_template, jsonify, redirect, url_for, session
from flask_sslify import SSLify
from flask_oauth import OAuth
from urllib2 import Request, urlopen, URLError
from mongo_agent import MongoAgent
# Initialize logging and setting to INFO level
logging.basi... | import json
import os
import logging
from flask import Flask, render_template, request, jsonify, redirect, url_for, session
from flask_sslify import SSLify
from flask_oauth import OAuth
from urllib2 import Request, urlopen, URLError
from mongo_agent import MongoAgent
# Initialize logging and setting to INFO level
log... | Python | 0 |
c98783bad0d249a203fcf1479b839182d967d3cc | Make python test_main behave as list-query | Trie.py | Trie.py | #! /usr/bin/env python
# vim: set encoding=utf-8
"""
This module provides access to libtrie shared object. Using it should be faster
than spawning a process and communicating with it.
This Python interface only allows for querying the trie. It is not possible to
create new tries via Python.
"""
from ctypes import cd... | #! /usr/bin/env python
# vim: set encoding=utf-8
"""
This module provides access to libtrie shared object. Using it should be faster
than spawning a process and communicating with it.
This Python interface only allows for querying the trie. It is not possible to
create new tries via Python.
"""
from ctypes import cd... | Python | 0.000634 |
f49fc187bc397a56f03217c88fa06b7ef1704b41 | Add docstring for `is_landscape()` | Util.py | Util.py | """Collection of Helper Functions"""
import os
from fnmatch import fnmatch
from PyPDF2 import PdfFileReader
def pdf_file(filename):
"""Test whether or the the filename ends with '.pdf'."""
return fnmatch(filename, '*.pdf')
def all_pdf_files_in_directory(path):
"""Return a list of of PDF files in a dire... | """Collection of Helper Functions"""
import os
from fnmatch import fnmatch
from PyPDF2 import PdfFileReader
def pdf_file(filename):
"""Test whether or the the filename ends with '.pdf'."""
return fnmatch(filename, '*.pdf')
def all_pdf_files_in_directory(path):
"""Return a list of of PDF files in a dire... | Python | 0.000001 |
92a57e512e4437b781d7db76587d27092033a49a | remove dead code | chart-02-ols-median-of-root-median-squared-errors.py | chart-02-ols-median-of-root-median-squared-errors.py | # create files for chart-02-ols-median-of-root-mdian-squared-errors
# with these choices
# metric in median-root-median-squared-errors
# model in ols
# ndays in 30 60 ... 360
# predictors in act actlog ct ctlog
# responses in price logprice
# usetax in yes no
# year in 2008
# invocations... | # create files for chart-02-ols-median-of-root-mdian-squared-errors
# with these choices
# metric in median-root-median-squared-errors
# model in ols
# ndays in 30 60 ... 360
# predictors in act actlog ct ctlog
# responses in price logprice
# usetax in yes no
# year in 2008
# invocations... | Python | 0.999454 |
4c425af1be1d4a4d4b424db5edf27f24b768f396 | Save the IP address in a file, if the IP address hasn't | slackip.py | slackip.py | #!/usr/bin/env python
"""
## slackip.py
##
## I am behind a NAT get my global IPv4 address and write it to a slack channel
##
## https://github.com/nerby/slackIP
##
## Atanu Ghosh
## <atanu@acm.org>
## 2017-03-05
"""
from __future__ import print_function
import getopt
import httplib
import os
import sys
IPHOST = "ipi... | #!/usr/bin/env python
"""
## slackip.py
##
## I am behind a NAT get my global IPv4 address and write it to a slack channel
##
## https://github.com/nerby/slackIP
##
## Atanu Ghosh
## <atanu@acm.org>
## 2017-03-05
"""
from __future__ import print_function
import getopt
import httplib
import os
import sys
IPHOST = "ipi... | Python | 0 |
3809d9a277412ef7c53905ecdcae55d537e08c95 | Fix whitespace in tests file | travis_solo_tests.py | travis_solo_tests.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
from nose.tools import eq_, ok_
from travis_solo import Configuration, Loader, Step
class TestLoader(object):
def setup(self):
self.loader = Loader()
def test_loading_steps(self):
settings = dict(
bef... | # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
from nose.tools import eq_, ok_
from travis_solo import Configuration, Loader, Step
class TestLoader(object):
def setup(self):
self.loader = Loader()
def test_loading_steps(self):
setti... | Python | 0.001412 |
27aff0f597d16ed73a976397a14b9cd1f7cf2c4a | Add support for sendback paths | troposphere/views.py | troposphere/views.py | import logging
from datetime import datetime
from django.http import HttpResponse
from django.shortcuts import render, redirect
from django.conf import settings
from django.core.urlresolvers import reverse
from troposphere.cas import CASClient, InvalidTicket
from troposphere.oauth import OAuthClient, Unauthorized
imp... | import logging
from datetime import datetime
from django.http import HttpResponse
from django.shortcuts import render, redirect
from django.conf import settings
from django.core.urlresolvers import reverse
from troposphere.cas import CASClient, InvalidTicket
from troposphere.oauth import OAuthClient, Unauthorized
imp... | Python | 0 |
c1a5b9fcb3316ec5d8ff550be68197c583a21b7b | extract is_act_as_username method | djactasauth/backends.py | djactasauth/backends.py | # -*- coding: utf-8 -*-
from django.contrib.auth.backends import ModelBackend
from django.contrib.auth import get_user_model
class FilteredModelBackend(ModelBackend):
def get_user(self, user_id):
user = super(FilteredModelBackend, self).get_user(user_id)
return self.filter_user(user)
def auth... | # -*- coding: utf-8 -*-
from django.contrib.auth.backends import ModelBackend
from django.contrib.auth import get_user_model
class FilteredModelBackend(ModelBackend):
def get_user(self, user_id):
user = super(FilteredModelBackend, self).get_user(user_id)
return self.filter_user(user)
def auth... | Python | 0.999427 |
1e222b72e632e5649d26dc71ab44ef31af7459fe | Fix rendering of groups in sidebar that didn't get all the template context passed into it. | django_backend/group.py | django_backend/group.py | from django.forms.forms import pretty_name
from django.template import Context
from django.template.loader import render_to_string
from .compat import context_flatten
class Group(list):
"""
A simplistic representation of backends that are related and should be
displayed as one "group" in the backend (e.g... | from django.forms.forms import pretty_name
from django.template import Context
from django.template.loader import render_to_string
from .compat import context_flatten
class Group(list):
"""
A simplistic representation of backends that are related and should be
displayed as one "group" in the backend (e.g... | Python | 0 |
bda88dfe6e0a2f16f0c3be74a42cf8783aae1d9e | Fix to support django v1.7 | django_enum_js/views.py | django_enum_js/views.py | from django.shortcuts import render_to_response
from django.template import RequestContext
from django.utils.safestring import mark_safe
from django_enum_js import enum_wrapper
def enums_js(request):
enums = enum_wrapper.get_json_formatted_enums()
return render_to_response('django_enum_js/enums_js.tpl', { 'en... | from django.shortcuts import render_to_response
from django.template import RequestContext
from django.utils.safestring import mark_safe
from django_enum_js import enum_wrapper
def enums_js(request):
enums = enum_wrapper.get_json_formatted_enums()
return render_to_response('django_enum_js/enums_js.tpl', { 'en... | Python | 0.000001 |
6a9ed8867ccaab1284ae999d752de92174de399e | fix error message rendering failing due to message being a dict | djcelery_email/tasks.py | djcelery_email/tasks.py | from django.conf import settings
from django.core.mail import get_connection, EmailMessage
from celery.task import task
CONFIG = getattr(settings, 'CELERY_EMAIL_TASK_CONFIG', {})
BACKEND = getattr(settings, 'CELERY_EMAIL_BACKEND',
'django.core.mail.backends.smtp.EmailBackend')
TASK_CONFIG = {
'... | from django.conf import settings
from django.core.mail import get_connection, EmailMessage
from celery.task import task
CONFIG = getattr(settings, 'CELERY_EMAIL_TASK_CONFIG', {})
BACKEND = getattr(settings, 'CELERY_EMAIL_BACKEND',
'django.core.mail.backends.smtp.EmailBackend')
TASK_CONFIG = {
'... | Python | 0.000001 |
81ff4ede4ea6397e6d54020c56cdf8dddcda1485 | add dg sub-package to sfepy/discrete/setup.py | sfepy/discrete/setup.py | sfepy/discrete/setup.py | def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
import os.path as op
auto_name = op.split(op.dirname(__file__))[-1]
config = Configuration(auto_name, parent_package, top_path)
subdirs = [
'common',
'dg',
'fem',
... | def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
import os.path as op
auto_name = op.split(op.dirname(__file__))[-1]
config = Configuration(auto_name, parent_package, top_path)
subdirs = [
'common',
'fem',
'iga',
... | Python | 0 |
152c77db3e06201d28300ea0c6112c3bb93d150f | Change f-string to .format() | desktop/core/src/desktop/lib/botserver/views.py | desktop/core/src/desktop/lib/botserver/views.py | #!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | #!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | Python | 0.005025 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.