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 |
|---|---|---|---|---|---|---|---|
87656428f02134c36c052fe60cfaa25536291cfe | Fix syntax error | upcloud_api/cloud_manager/storage_mixin.py | upcloud_api/cloud_manager/storage_mixin.py | from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
from upcloud_api import Storage
class StorageManager(object):
"""
Functions for managing Storage disks. Intended to be used as a mixin for CloudManager.
"""... | from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
from upcloud_api import Storage
class StorageManager(object):
"""
Functions for managing Storage disks. Intended to be used as a mixin for CloudManager.
"""... | Python | 0.000004 |
9a6c74bdb8c7b386f75100ab2fafabae3a5a9997 | Add utility functions to stix.Entity | stix/__init__.py | stix/__init__.py | # Copyright (c) 2014, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.
__version__ = "1.0.1.0"
import json
from StringIO import StringIO
class Entity(object):
"""Base class for all classes in the STIX API."""
def to_obj(self, return_obj=None):
"""Export a... | # Copyright (c) 2014, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.
__version__ = "1.0.1.0"
import json
from StringIO import StringIO
class Entity(object):
"""Base class for all classes in the STIX API."""
def to_obj(self, return_obj=None):
"""Export a... | Python | 0.000002 |
0efe8e9cfbd3a5d3319553aabf4f0dd17fa53d33 | fix license test | awx/main/tests/functional/api/test_settings.py | awx/main/tests/functional/api/test_settings.py | # Copyright (c) 2016 Ansible, Inc.
# All Rights Reserved.
# Python
import pytest
import os
# Django
from django.core.urlresolvers import reverse
# AWX
from awx.conf.models import Setting
'''
Ensures that tests don't pick up dev container license file
'''
@pytest.fixture
def mock_no_license_file(mocker):
os.envi... | # Copyright (c) 2016 Ansible, Inc.
# All Rights Reserved.
# Python
import pytest
# Django
from django.core.urlresolvers import reverse
# AWX
from awx.conf.models import Setting
@pytest.mark.django_db
def test_license_cannot_be_removed_via_system_settings(get, put, patch, delete, admin, enterprise_license):
url... | Python | 0 |
c91e7dcc969485644d8e26c459c894925b3f0720 | add in fasta format | scripts/dump_biodatabase.py | scripts/dump_biodatabase.py | #!/usr/bin/env python
import sys
from getpass import getpass
from BioSQL import BioSeqDatabase
from common import standard_options, generate_placeholders, chunks, extract_feature_sql
def get_seqfeature_for_db(server, biodb):
''' find all seqfeatures that have the given value for the qualifier
returns a lis... | #!/usr/bin/env python
from getpass import getpass
from BioSQL import BioSeqDatabase
from common import standard_options, generate_placeholders, chunks, extract_feature_sql
def get_seqfeature_for_db(server, biodb):
''' find all seqfeatures that have the given value for the qualifier
returns a list of seqfea... | Python | 0.999986 |
4a9e34a57476c92a4147f9ecafc357a681f1a19a | Add wrapper for testing fixing functionality | scripts/flaskext_migrate.py | scripts/flaskext_migrate.py | # Script which modifies source code away from the deprecated "flask.ext"
# format. Does not yet fully support imports in the style:
#
# "import flask.ext.foo"
#
# these are converted to "import flask_foo" in the
# main import statement, but does not handle function calls in the source.
#
# Run in the terminal by typing... | # Script which modifies source code away from the deprecated "flask.ext"
# format. Does not yet fully support imports in the style:
#
# "import flask.ext.foo"
#
# these are converted to "import flask_foo" in the
# main import statement, but does not handle function calls in the source.
#
# Run in the terminal by typing... | Python | 0 |
95d8f915e4aee6fbab4ca741197a3563eb3a5ff2 | bump version to 0.4 | aldryn_bootstrap3/__init__.py | aldryn_bootstrap3/__init__.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import
__version__ = '0.4'
| # -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import
__version__ = '0.3'
| Python | 0 |
de0fd677d94b7fb8b044fa597b687dba0f3e1c0e | Test coercions for generic type constructors | blaze/datashape/tests/test_type_constructor.py | blaze/datashape/tests/test_type_constructor.py | # -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import
import unittest
from blaze import error
from blaze.datashape import unify_simple, promote, coerce, dshapes, coretypes as T
#------------------------------------------------------------------------
# Test data
#------------------... | # -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import
import unittest
from blaze import error
from blaze.datashape import unify_simple, promote, coerce, dshapes, coretypes as T
#------------------------------------------------------------------------
# Test data
#------------------... | Python | 0 |
7da15f2e16c95a4be179a1cc1efd108dbaaa3be9 | Update forward_ZMQ_Angle.py | ProBot_BeagleBone/forward_ZMQ_Angle.py | ProBot_BeagleBone/forward_ZMQ_Angle.py | #!/usr/bin/python
import zmq
def main():
try:
context = zmq.Context(1)
# Socket facing clients
frontend = context.socket(zmq.SUB)
frontend.bind("tcp://*:5583")
frontend.setsockopt(zmq.SUBSCRIBE, "")
# Socket facing services
backend = context.socket(zmq.PUB)... | import zmq
def main():
try:
context = zmq.Context(1)
# Socket facing clients
frontend = context.socket(zmq.SUB)
frontend.bind("tcp://*:5583")
frontend.setsockopt(zmq.SUBSCRIBE, "")
# Socket facing services
backend = context.socket(zmq.PUB)
backend.bi... | Python | 0.000001 |
c01f7fb0c9bda24efbd1d1597350a77d03047027 | Add Grid and Align support | wytch/builder.py | wytch/builder.py | # The MIT License (MIT)
#
# Copyright (c) 2015 Josef Gajdusek
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, ... | # The MIT License (MIT)
#
# Copyright (c) 2015 Josef Gajdusek
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, ... | Python | 0 |
a7ac41830ac0472442069deead739ddd4c137be3 | add future import for print | examples/receive_notify.py | examples/receive_notify.py | #!/usr/bin/env python3
# This is just a toy, real code would check that the received message
# really was a NOTIFY, and otherwise handle errors.
from __future__ import print_function
import socket
import dns.flags
import dns.message
import dns.rdataclass
import dns.rdatatype
address = '127.0.0.1'
port = 53535
s =... | #!/usr/bin/env python3
# This is just a toy, real code would check that the received message
# really was a NOTIFY, and otherwise handle errors.
import socket
import dns.flags
import dns.message
import dns.rdataclass
import dns.rdatatype
address = '127.0.0.1'
port = 53535
s = socket.socket(socket.AF_INET, socket.S... | Python | 0 |
a68c026e9eb7d801a2f86fb52a02a1f67fd22f7d | Update visualise.py | visualise.py | visualise.py | # visualise.py
# Imports
import argparse
import json
import numpy as np
import os
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from uniform_bspline import Contour
# generate_figure
def generate_figure(z, num_samples, verbose=True):
degree, num_control_points, dim, is_cl... | # visualise.py
# Imports
import argparse
import json
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from uniform_bspline import Contour
# main
def main():
parser = argparse.ArgumentParser()
parser.add_argument('input_path')
parser.add_argument(... | Python | 0.000001 |
9bbe8057a627ba81282a76de94e57ca0b0e02b89 | change default port | backend/src/gosa/backend/plugins/foreman/gosa_integration.py | backend/src/gosa/backend/plugins/foreman/gosa_integration.py | #!/usr/bin/env python3
"""
Foreman / GOsa3 integration to send hook events data to GOsa3
"""
import hmac
import sys
import requests
import json
#. /etc/sysconfig/foreman-gosa
# Gosa settings
GOSA_SERVER = "http://localhost"
GOSA_PORT = 8050
HTTP_X_HUB_SENDER = "foreman-hook"
SECRET = "e540f417-4c36-4e5d-b78a-4d36f5172... | #!/usr/bin/env python3
"""
Foreman / GOsa3 integration to send hook events data to GOsa3
"""
import hmac
import sys
import requests
import json
#. /etc/sysconfig/foreman-gosa
# Gosa settings
GOSA_SERVER = "http://localhost"
GOSA_PORT = 8000
HTTP_X_HUB_SENDER = "foreman-hook"
SECRET = "e540f417-4c36-4e5d-b78a-4d36f5172... | Python | 0.000001 |
94b216fb8c15db7228e54e35058c7143b02d103f | prepare 1.1.1 bugfix release, from now on tests for new features.. | cmsplugin_blog/__init__.py | cmsplugin_blog/__init__.py | # -*- coding: utf-8 -*-
VERSION = (1, 1, 1, 'post', 0)
def get_version(): # pragma: no cover
version = '%s.%s' % (VERSION[0], VERSION[1])
if VERSION[2]:
version = '%s.%s' % (version, VERSION[2])
if VERSION[3:] == ('alpha', 0):
version = '%s pre-alpha' % version
else:
i... | # -*- coding: utf-8 -*-
VERSION = (1, 1, 0, 'post', 0)
def get_version(): # pragma: no cover
version = '%s.%s' % (VERSION[0], VERSION[1])
if VERSION[2]:
version = '%s.%s' % (version, VERSION[2])
if VERSION[3:] == ('alpha', 0):
version = '%s pre-alpha' % version
else:
i... | Python | 0 |
d03513e41ee1cc0edcd696c5ed08274db4f782bd | add editor for page icons | cmsplugin_cascade/admin.py | cmsplugin_cascade/admin.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf.urls import url
from django.contrib import admin
from django.db.models import Q
from django.http import JsonResponse, HttpResponseForbidden
from django.utils.translation import get_language_from_request
from cms.models.pagemodel import Pa... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf.urls import url
from django.contrib import admin
from django.db.models import Q
from django.http import JsonResponse, HttpResponseForbidden
from django.utils.translation import get_language_from_request
from cms.models.pagemodel import Pa... | Python | 0.000001 |
77d8f11277e3b006c9f9137a35291892a73156f2 | format python code | alexBot/cogs/games_reposting.py | alexBot/cogs/games_reposting.py | import logging
from typing import Dict
import discord
from discord import PartialEmoji
from discord.ext import commands
from discord.message import Message
from discord.webhook import AsyncWebhookAdapter, WebhookMessage
from emoji_data import EmojiSequence
from ..tools import Cog
log = logging.getLogger(__name__)
... | import logging
from typing import Dict
import discord
from discord import PartialEmoji
from discord.ext import commands
from discord.message import Message
from discord.webhook import AsyncWebhookAdapter, WebhookMessage
from emoji_data import EmojiSequence
from ..tools import Cog
log = logging.getLogger(__name__)
... | Python | 0.000174 |
cdb7c87fd133b6e99916919b525e9d277a3913dd | Fix a typo. | libcloud/test/compute/test_ikoula.py | libcloud/test/compute/test_ikoula.py | # Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use ... | # Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use ... | Python | 0.999957 |
8c70752c87eb0519150e7cf17b146c97847b1460 | add new preview-graylog ip to reversedns.py | modules/nagios/files/reversedns.py | modules/nagios/files/reversedns.py | #!/usr/bin/env python
import socket
import sys
if sys.argv[1] == "ip-10-236-86-54.eu-west-1.compute.internal":
print "frontend.production.alphagov.co.uk"
exit(0)
if sys.argv[1] == "ip-10-250-157-37.eu-west-1.compute.internal":
print "static.production.alphagov.co.uk"
exit(0)
if sys.a... | #!/usr/bin/env python
import socket
import sys
if sys.argv[1] == "ip-10-236-86-54.eu-west-1.compute.internal":
print "frontend.production.alphagov.co.uk"
exit(0)
if sys.argv[1] == "ip-10-250-157-37.eu-west-1.compute.internal":
print "static.production.alphagov.co.uk"
exit(0)
if sys.a... | Python | 0 |
b5b4c1f5b72494e00064b36f2ee1c53d1b5c2aca | Revert 83430 - NaCl: Re-enable tests, since they pass on the trybotsBUG=noneTEST=nacl_integrationReview URL: http://codereview.chromium.org/6904067 TBR=mseaborn@chromium.org Review URL: http://codereview.chromium.org/6902132 | chrome/test/nacl_test_injection/buildbot_nacl_integration.py | chrome/test/nacl_test_injection/buildbot_nacl_integration.py | #!/usr/bin/python
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import subprocess
import sys
def Main():
# TODO(ncbray): figure out why this is failing on windows and enable.
if (sys.... | #!/usr/bin/python
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import subprocess
import sys
def Main():
script_dir = os.path.dirname(os.path.abspath(__file__))
test_dir = os.path.dir... | Python | 0.000001 |
bbfa0b6fc8e4bb851528084d147ee898fd5af06a | fix path issues | experimentator/__main__.py | experimentator/__main__.py | """experimentator
Usage:
exp run [options] <exp-file> (--next <level> [--not-finished] | (<level> <n>)...)
exp resume [options] <exp-file> <level> [<n> (<level> <n>)...]
exp export <exp-file> <data-file>
exp -h | --help
exp --version
Options:
--not-finished Run the first <level> that hasn't finished... | """experimentator
Usage:
exp run [options] <exp-file> (--next <level> [--not-finished] | (<level> <n>)...)
exp resume [options] <exp-file> <level> [<n> (<level> <n>)...]
exp export <exp-file> <data-file>
exp -h | --help
exp --version
Options:
--not-finished Run the first <level> that hasn't finished... | Python | 0.000001 |
0bf63976303515d0702f0a29d14364825a67053a | use pid for msgid to avoid duplicate message error | mpcontribs-api/mpcontribs/api/notebooks/__init__.py | mpcontribs-api/mpcontribs/api/notebooks/__init__.py | # -*- coding: utf-8 -*-
import os
from tornado.escape import json_encode, json_decode, url_escape
from websocket import create_connection
from notebook.utils import url_path_join
from notebook.gateway.managers import GatewayClient
def run_cells(kernel_id, cid, cells):
print(f"running {cid} on {kernel_id}")
gw... | # -*- coding: utf-8 -*-
from tornado.escape import json_encode, json_decode, url_escape
from websocket import create_connection
from notebook.utils import url_path_join
from notebook.gateway.managers import GatewayClient
def run_cells(kernel_id, cid, cells):
print(f"running {cid} on {kernel_id}")
gw_client = ... | Python | 0 |
abb28a62ae8bf6ca95e3cb4419abc6a1bf161f5b | Remove outdated notes | scopus/utils/get_content.py | scopus/utils/get_content.py | import os
import requests
from scopus import exception
from scopus.utils import config
errors = {400: exception.Scopus400Error, 401: exception.Scopus401Error,
404: exception.Scopus404Error, 429: exception.Scopus429Error,
500: exception.Scopus500Error}
def download(url, params=None, accept="xml")... | import os
import requests
from scopus import exception
from scopus.utils import config
errors = {400: exception.Scopus400Error, 401: exception.Scopus401Error,
404: exception.Scopus404Error, 429: exception.Scopus429Error,
500: exception.Scopus500Error}
def download(url, params=None, accept="xml")... | Python | 0.000002 |
b8fd3a256062a5f7740480bb5b844560e3a47f6d | Add more log on test_versioning | nuxeo-drive-client/nxdrive/tests/test_versioning.py | nuxeo-drive-client/nxdrive/tests/test_versioning.py | import time
from nxdrive.tests.common import TEST_WORKSPACE_PATH
from nxdrive.tests.common import OS_STAT_MTIME_RESOLUTION
from nxdrive.tests.common_unit_test import UnitTestCase
from nxdrive.logging_config import get_logger
log = get_logger(__name__)
class TestVersioning(UnitTestCase):
def test_versioning(sel... | import time
from nxdrive.tests.common import TEST_WORKSPACE_PATH
from nxdrive.tests.common import OS_STAT_MTIME_RESOLUTION
from nxdrive.tests.common_unit_test import UnitTestCase
class TestVersioning(UnitTestCase):
def test_versioning(self):
# Call the Nuxeo operation to set the versioning delay to 30 s... | Python | 0 |
434f565dc7b2b1c037b36096ad10978cfc0eaa49 | add yaml dump encode utf8 | lmdo/resolvers/templates_resolver.py | lmdo/resolvers/templates_resolver.py | import os
import tempfile
import json
import yaml
from lmdo.resolvers import Resolver
from lmdo.convertors.env_var_convertor import EnvVarConvertor
from lmdo.convertors.stack_var_convertor import StackVarConvertor
from lmdo.convertors.nested_template_url_convertor import NestedTemplateUrlConvertor
from lmdo.file_load... | import os
import tempfile
import json
import yaml
from lmdo.resolvers import Resolver
from lmdo.convertors.env_var_convertor import EnvVarConvertor
from lmdo.convertors.stack_var_convertor import StackVarConvertor
from lmdo.convertors.nested_template_url_convertor import NestedTemplateUrlConvertor
from lmdo.file_load... | Python | 0.000002 |
c2ca2932ba6aa29e002317ce7775611a2ed39d42 | fix template resovler for yaml file | lmdo/resolvers/templates_resolver.py | lmdo/resolvers/templates_resolver.py | import os
import tempfile
import json
from lmdo.resolvers import Resolver
from lmdo.convertors.env_var_convertor import EnvVarConvertor
from lmdo.convertors.stack_var_convertor import StackVarConvertor
from lmdo.convertors.nested_template_url_convertor import NestedTemplateUrlConvertor
from lmdo.file_loader import Fil... | import os
import tempfile
import json
from lmdo.resolvers import Resolver
from lmdo.convertors.env_var_convertor import EnvVarConvertor
from lmdo.convertors.stack_var_convertor import StackVarConvertor
from lmdo.convertors.nested_template_url_convertor import NestedTemplateUrlConvertor
from lmdo.file_loader import Fil... | Python | 0 |
4ab211d6dd50c043cacd24db93a6bc64cfdb9ed5 | update tools/validate_runtests_log.py for pytest | tools/validate_runtests_log.py | tools/validate_runtests_log.py | #!/usr/bin/env python
"""
Take the test runner log output from the stdin, looking for
the magic line nose runner prints when the test run was successful.
In an ideal world, this should be done directly in runtests.py using the
nose API, some failure modes are fooling nose to terminate the python process
with zero exi... | #!/usr/bin/env python
"""
Take the test runner log output from the stdin, looking for
the magic line nose runner prints when the test run was successful.
In an ideal world, this should be done directly in runtests.py using the
nose API, some failure modes are fooling nose to terminate the python process
with zero exi... | Python | 0.000001 |
d4cbcfff04738d8fea0070f724540345a04d517a | Fix NameError bug: s/Devirtualizer/SpeculativeDevirtualizer/ | utils/pass-pipeline/src/passes.py | utils/pass-pipeline/src/passes.py |
from pass_pipeline import Pass
# TODO: This should not be hard coded. Create a tool in the compiler that knows
# how to dump the passes and the pipelines themselves.
AADumper = Pass('AADumper')
ABCOpt = Pass('ABCOpt')
AllocBoxToStack = Pass('AllocBoxToStack')
CFGPrinter = Pass('CFGPrinter')
COWArrayOpts = Pass('COWAr... |
from pass_pipeline import Pass
# TODO: This should not be hard coded. Create a tool in the compiler that knows
# how to dump the passes and the pipelines themselves.
AADumper = Pass('AADumper')
ABCOpt = Pass('ABCOpt')
AllocBoxToStack = Pass('AllocBoxToStack')
CFGPrinter = Pass('CFGPrinter')
COWArrayOpts = Pass('COWAr... | Python | 0.000001 |
992b9c46dd432ad409025a3cbaeb1c06f880526c | Resolve readline/ncurses dependency when building Lua | var/spack/packages/lua/package.py | var/spack/packages/lua/package.py | from spack import *
import os
class Lua(Package):
""" The Lua programming language interpreter and library """
homepage = "http://www.lua.org"
url = "http://www.lua.org/ftp/lua-5.1.5.tar.gz"
version('5.3.1', '797adacada8d85761c079390ff1d9961')
version('5.3.0', 'a1b0a7e92d0c85bbff7a8d27bf29f8a... | from spack import *
import os
class Lua(Package):
""" The Lua programming language interpreter and library """
homepage = "http://www.lua.org"
url = "http://www.lua.org/ftp/lua-5.1.5.tar.gz"
version('5.3.1', '797adacada8d85761c079390ff1d9961')
version('5.3.0', 'a1b0a7e92d0c85bbff7a8d27bf29f8a... | Python | 0 |
971a1dd12c11c66ea3a42cddd693e7f20c45846c | Adding a blank line | mysite/missions/git/controllers.py | mysite/missions/git/controllers.py | # This file is part of OpenHatch.
# Copyright (C) 2010 Jack Grigg
# Copyright (C) 2010 John Stumpo
# Copyright (C) 2010, 2011 OpenHatch, Inc.
#
# 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 Foundat... | # This file is part of OpenHatch.
# Copyright (C) 2010 Jack Grigg
# Copyright (C) 2010 John Stumpo
# Copyright (C) 2010, 2011 OpenHatch, Inc.
#
# 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 Foundat... | Python | 0.999999 |
81e9bf3a9cca702af11f0d7ed17d25611b9a1380 | Fix for creating node instance set | vcloud_plugin_common/workflows.py | vcloud_plugin_common/workflows.py | # Copyright (c) 2015 GigaSpaces Technologies Ltd. All rights reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... | # Copyright (c) 2015 GigaSpaces Technologies Ltd. All rights reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... | Python | 0 |
679755a0bae0ce8a34b9907cbc2ff9bd90144822 | Remove pwd from binding file | src/spatialite/deps/iconv/binding.gyp | src/spatialite/deps/iconv/binding.gyp | {
'variables': { 'target_arch%': 'ia32' },
'target_defaults': {
'default_configuration': 'Debug',
'configurations': {
'Debug': {
'defines': [ 'DEBUG', '_DEBUG' ],
'msvs_settings': {
'VCCLCompilerTool': {
'RuntimeLibrary': 1, # static debug
},
},... | {
'variables': { 'target_arch%': 'ia32' },
'target_defaults': {
'default_configuration': 'Debug',
'configurations': {
'Debug': {
'defines': [ 'DEBUG', '_DEBUG' ],
'msvs_settings': {
'VCCLCompilerTool': {
'RuntimeLibrary': 1, # static debug
},
},... | Python | 0 |
9d60b14e35917e7227a03d53bf6a6e83c25b7e81 | Correct publication mapping dependencies | luigi/tasks/quickgo/load_mappings.py | luigi/tasks/quickgo/load_mappings.py | # -*- coding: utf-8 -*-
"""
Copyright [2009-2017] EMBL-European Bioinformatics Institute
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... | # -*- coding: utf-8 -*-
"""
Copyright [2009-2017] EMBL-European Bioinformatics Institute
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... | Python | 0 |
fd8c3bdcd1fe3dea8186c4870285731e3081b396 | modify parse request | src/server.py | src/server.py | # -*- coding: utf-8 -*-
"""Server module."""
from __future__ import unicode_literals
import socket
import email.utils
RESOURCES = {
'images':
}
def resolve_uri(uri):
"""Return request body and file type."""
file_path = uri.split('/')
print(file_path)
if file_path[0] != 'webroot':
respon... | # -*- coding: utf-8 -*-
"""Server module."""
from __future__ import unicode_literals
import socket
import email.utils
def resolve_uri(uri):
def parse_request(request):
"""Parse and validate request to confirm parts are correct."""
lines = request.split('\r\n')
try:
lines[1][:3] == 'GET'
ex... | Python | 0.000001 |
c25d97ccc5109064ef80141e62c44134702b8125 | Add endpoints for the admin page | src/server.py | src/server.py | #!/usr/bin/env python3
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright 2017 - Edoardo Morassutto <edoardo.morassutto@gmail.com>
import sys
import tracebac... | #!/usr/bin/env python3
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright 2017 - Edoardo Morassutto <edoardo.morassutto@gmail.com>
import sys
import tracebac... | Python | 0.000001 |
4f2fa4e43b314c9d05e0b9b9e73641463c16a9cb | Set up the proposal tasks on app startup | server/proposal/__init__.py | server/proposal/__init__.py | from django.apps import AppConfig
class ProposalConfig(AppConfig):
name = "proposal"
def ready(self):
# Register tasks with Celery:
from . import tasks
tasks.set_up_hooks()
| from django.apps import AppConfig
class ProposalConfig(AppConfig):
name = "proposal"
def ready(self):
# Register tasks with Celery:
from . import tasks
| Python | 0.000064 |
69a16e61f0b0d5eb6d1f0819ff379c0d86b67dc3 | fix in lcb | robo/acquisition/lcb.py | robo/acquisition/lcb.py | import logging
import numpy as np
from robo.acquisition.base_acquisition import BaseAcquisitionFunction
logger = logging.getLogger(__name__)
class LCB(BaseAcquisitionFunction):
def __init__(self, model, X_lower, X_upper, par=0.0, **kwargs):
r"""
The lower confidence bound acquisition functions... | import logging
import numpy as np
from robo.acquisition.base_acquisition import BaseAcquisitionFunction
logger = logging.getLogger(__name__)
class LCB(BaseAcquisitionFunction):
def __init__(self, model, X_lower, X_upper, par=0.0, **kwargs):
r"""
The lower confidence bound acquisition functions... | Python | 0.000004 |
3468b32964560f4092593e03ba552d7e6b56943d | Support renaming of _ to % routines | Scripts/PackRO.py | Scripts/PackRO.py | #!/usr/bin/env python
# Pack .m files into M[UMPS] routine transfer format (^%RO)
#
# python PackRO.py *.m > routines.ro
#
# or
#
# ls *.m | python PackRO.py > routines.ro
#
#---------------------------------------------------------------------------
# Copyright 2011 The Open Source Electronic Health Record Agent
#... | #!/usr/bin/env python
# Pack .m files into M[UMPS] routine transfer format (^%RO)
#
# python PackRO.py *.m > routines.ro
#
# or
#
# ls *.m | python PackRO.py > routines.ro
#
#---------------------------------------------------------------------------
# Copyright 2011 The Open Source Electronic Health Record Agent
#... | Python | 0.000003 |
1b398b07b1ba1fa8a304f24d9e75d6f76fbc56f7 | remove caps and spaces walmart | Server/walmart.py | Server/walmart.py | from crawl_lib import *
from pymongo import MongoClient
import unicodedata
import json
# Parses starting from the base_url and sends the data to the db
def parse():
deps_exclusions = {'91083', '5426', '4096', '4104'}
full_json = json.loads(urlopen('http://api.walmartlabs.com/v1/taxonomy?format=json&apiKey=' + ... | from crawl_lib import *
from pymongo import MongoClient
import unicodedata
import json
# Parses starting from the base_url and sends the data to the db
def parse():
deps_exclusions = {'91083', '5426', '4096', '4104'}
full_json = json.loads(urlopen('http://api.walmartlabs.com/v1/taxonomy?format=json&apiKey=' + ... | Python | 0.000002 |
a1d02e3a88e5c46a700385e9cef50c9ebcad68b1 | Simplify test_roi_pooling_2d with no_grads option in check_backward | tests/chainer_tests/functions_tests/pooling_tests/test_roi_pooling_2d.py | tests/chainer_tests/functions_tests/pooling_tests/test_roi_pooling_2d.py | import unittest
import numpy
import chainer
from chainer import cuda
from chainer import functions
from chainer import gradient_check
from chainer import testing
from chainer.testing import attr
from chainer.testing import condition
class TestROIPooling2D(unittest.TestCase):
def setUp(self):
N = 4
... | import unittest
import numpy
import chainer
from chainer import cuda
from chainer import functions
from chainer import gradient_check
from chainer import testing
from chainer.testing import attr
from chainer.testing import condition
class TestROIPooling2D(unittest.TestCase):
def setUp(self):
N = 4
... | Python | 0.000003 |
d6c1774b75839192b0235e5737cdba0d17759fde | Update mqtt_easydriver_stepper.py | linkit/easydriver/mqtt_easydriver_stepper.py | linkit/easydriver/mqtt_easydriver_stepper.py | import paho.mqtt.client as mqtt
import json, time
import mraa
pin19 = mraa.Pwm(19)
pin0 = mraa.Gpio(0)
pin0.dir(mraa.DIR_OUT)
# ----- CHANGE THESE FOR YOUR SETUP -----
MQTT_HOST = "190.97.168.236"
MQTT_PORT = 1883
#---------------------------------------
def on_connect(client, userdata, rc):
print("\nConnecte... | import paho.mqtt.client as mqtt
import json, time
import mraa
pin19 = mraa.Pwm(19)
pin0 = mraa.Gpio(0)
pin0.dir(mraa.DIR_OUT)
# ----- CHANGE THESE FOR YOUR SETUP -----
MQTT_HOST = "190.97.168.236"
MQTT_PORT = 1883
def on_connect(client, userdata, rc):
print("\nConnected with result code " + str(rc) + "\n")
... | Python | 0 |
6b7bd1c412b21a748b39a07a792f8b2c8461f9e2 | Fix issue #17 | marmoset/installimage/installimage_config.py | marmoset/installimage/installimage_config.py | import os
class InstallimageConfig:
CFG_DIR = '/srv/tftp/installimage/'
def __init__(self, mac):
self.variables = {}
self.mac = mac
if self.exists():
self.__read_config_file()
def add_or_set(self, key, value):
self.variables[key.upper()] = value
def crea... | import os
class InstallimageConfig:
CFG_DIR = '/srv/tftp/installimage/'
def __init__(self, mac):
self.variables = {}
self.mac = mac
if self.exists():
self.__read_config_file()
def add_or_set(self, key, value):
self.variables[key] = value
def create(self)... | Python | 0 |
74cfb1bd8e60e1d348115677e92c5e64858ec785 | Add clearer instructions on no component support. (#2685) | packaged_releases/patches/patch_component_custom.py | packaged_releases/patches/patch_component_custom.py | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | Python | 0.000552 |
c5a31be1bd452224c2b35c4f3e3132b2df1431e7 | reorder imports | meinberlin/apps/documents/exports.py | meinberlin/apps/documents/exports.py | from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from adhocracy4.comments.models import Comment
from adhocracy4.exports import mixins as export_mixins
from adhocracy4.exports import views as export_views
from meinberlin.apps.exports import mixins as mb_export_mixins
from meinbe... | from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from adhocracy4.comments.models import Comment
from adhocracy4.exports import mixins as export_mixins
from adhocracy4.exports import views as export_views
from adhocracy4.projects.mixins import ProjectMixin
from meinberlin.apps.e... | Python | 0.000009 |
1c6c31653889c8acb60a54dc1dc9ea0f8795f122 | bump to next dev version: 0.6.7-dev | ulmo/version.py | ulmo/version.py | # set version number
__version__ = '0.6.7-dev'
| # set version number
__version__ = '0.6.6'
| Python | 0 |
8546e14e152c79f137e0db15e3cd7de71cd0e8b4 | bump to next dev version: 0.7.3-dev | ulmo/version.py | ulmo/version.py | # set version number
__version__ = '0.7.3-dev'
| # set version number
__version__ = '0.7.2'
| Python | 0 |
a8b43950610adb41a3de4c342c51d5b22fd5454b | Fix indents | saleor/product/forms.py | saleor/product/forms.py | import json
from django import forms
from django.utils.encoding import smart_text
from django.utils.translation import pgettext_lazy
from django_prices.templatetags.prices_i18n import gross
from ..cart.forms import AddToCartForm
class VariantChoiceField(forms.ModelChoiceField):
discounts = None
def __init_... | import json
from django import forms
from django.utils.encoding import smart_text
from django.utils.translation import pgettext_lazy
from django_prices.templatetags.prices_i18n import gross
from ..cart.forms import AddToCartForm
class VariantChoiceField(forms.ModelChoiceField):
discounts = None
def __init_... | Python | 0.000034 |
833f8ce0673701eb64fb20ee067ccd8c58e473c6 | Correct wrong inheritance on sponsorship_typo3 child_depart wizard. | child_sync_typo3/wizard/child_depart_wizard.py | child_sync_typo3/wizard/child_depart_wizard.py | # -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2014 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: Emanuel Cino <ecino@compassion.ch>
#
# The licence is in the file __open... | # -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2014 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: Emanuel Cino <ecino@compassion.ch>
#
# The licence is in the file __open... | Python | 0 |
97c5cb0312d7b093752376a373cc3773fcf44f34 | Add SunOS to the basic service module | salt/modules/service.py | salt/modules/service.py | '''
The default service module, if not otherwise specified salt will fall back
to this basic module
'''
import os
grainmap = {
'Arch': '/etc/rc.d',
'Debian': '/etc/init.d',
'Fedora': '/etc/init.d',
'RedHat': '/etc/init.d',
'Ubuntu': '/etc/init.d',
'Gen... | '''
The default service module, if not otherwise specified salt will fall back
to this basic module
'''
import os
grainmap = {
'Arch': '/etc/rc.d',
'Debian': '/etc/init.d',
'Fedora': '/etc/init.d',
'RedHat': '/etc/init.d',
'Ubuntu': '/etc/init.d',
'Gen... | Python | 0 |
6ddb38eee5624ea8753e52cfde4b8d17c0ac2b14 | Making salt.output.json_out python3 compatible | salt/output/json_out.py | salt/output/json_out.py | # -*- coding: utf-8 -*-
'''
Display return data in JSON format
==================================
:configuration: The output format can be configured in two ways:
Using the ``--out-indent`` CLI flag and specifying a positive integer or a
negative integer to group JSON from each minion to a single line.
Or... | # -*- coding: utf-8 -*-
'''
Display return data in JSON format
==================================
:configuration: The output format can be configured in two ways:
Using the ``--out-indent`` CLI flag and specifying a positive integer or a
negative integer to group JSON from each minion to a single line.
Or... | Python | 0.998869 |
f422535179d9f55e28d5c1b0e098e0a4931d366b | Making salt.pillar.cmd_json python3 compatible | salt/pillar/cmd_json.py | salt/pillar/cmd_json.py | # -*- coding: utf-8 -*-
'''
Execute a command and read the output as JSON. The JSON data is then directly overlaid onto the minion's Pillar data.
'''
from __future__ import absolute_import
# Don't "fix" the above docstring to put it on two lines, as the sphinx
# autosummary pulls only the first line for its descriptio... | # -*- coding: utf-8 -*-
'''
Execute a command and read the output as JSON. The JSON data is then directly overlaid onto the minion's Pillar data.
'''
# Don't "fix" the above docstring to put it on two lines, as the sphinx
# autosummary pulls only the first line for its description.
# Import python libs
import logging... | Python | 0.998816 |
e40a9b3676101d7d7bd65cff8487f48a285f3139 | Fix typo | scripts/obtain_user_auth.py | scripts/obtain_user_auth.py | # Copyright 2016 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | # Copyright 2016 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | Python | 0.999999 |
f1e1513cf739b8f25b9364226cc8ce987a47fa56 | Fix check for helpers with staff perms | utils/checks.py | utils/checks.py | import discord
from discord import app_commands
from discord.ext import commands
from utils.configuration import StaffRank
from typing import Union, TYPE_CHECKING
if TYPE_CHECKING:
from kurisu import Kurisu
class InsufficientStaffRank(commands.CheckFailure):
message: str
def is_staff(role: str):
async... | import discord
from discord import app_commands
from discord.ext import commands
from utils.configuration import StaffRank
from typing import Union, TYPE_CHECKING
if TYPE_CHECKING:
from kurisu import Kurisu
class InsufficientStaffRank(commands.CheckFailure):
message: str
def is_staff(role: str):
async... | Python | 0 |
2031c415144fe7c616fb1b020c9571ced5726654 | Handle yanked Projects, Versions, and Files | warehouse/synchronize/commands.py | warehouse/synchronize/commands.py | from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import eventlet
from progress.bar import ShadyBar
from warehouse import create_app, db, script
from warehouse.packages import store
from warehouse.packages.models import Project, Version, File
from warehous... | from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import eventlet
from progress.bar import ShadyBar
from warehouse import create_app, db, script
from warehouse.packages import store
from warehouse.synchronize.fetchers import PyPIFetcher
eventlet.monkey_p... | Python | 0 |
6cba22ad2c26185f6b3454116c3e31ea14160db8 | Make collect-sprite-metadata.py work from any directory | scripts/collect-sprite-metadata.py | scripts/collect-sprite-metadata.py | from collections import OrderedDict
import glob
import json
import os
def main():
c = collect()
c.sort(key = lambda x: x[0])
c = OrderedDict(c)
print(json.dumps(c, separators=(',',':')))
def collect():
root = os.path.dirname(os.path.abspath(__file__)) + '/../build/website/assets/sprites'
hitb... | from collections import OrderedDict
import glob
import json
import os
def main():
c = collect()
c.sort(key = lambda x: x[0])
c = OrderedDict(c)
print(json.dumps(c, separators=(',',':')))
def collect():
root = '../build/website/static/sprites'
hitboxes = []
for (dirpath, dirnames, filename... | Python | 0.000007 |
2192219d92713c6eb76593d0c6c29413d040db6a | Revert "Added script for cron job to load surveys to database." | scripts/cronRefreshEdxQualtrics.py | scripts/cronRefreshEdxQualtrics.py | from surveyextractor import QualtricsExtractor
import getopt, sys
# Script for scheduling regular EdxQualtrics updates
# Usage for cron should be "cronRefreshEdxQualtrics.py -m -s -r"
qe = QualtricsExtractor()
opts, args = getopt.getopt(sys.argv[1:], 'amsr', ['--reset', '--loadmeta', '--loadsurveys', '--loadresponses... | from surveyextractor import QualtricsExtractor
import getopt
import sys
### Script for scheduling regular EdxQualtrics updates
### Usage for cron should be "cronRefreshEdxQualtrics.py -m -s -r"
# Append directory for dependencies to PYTHONPATH
sys.path.append("/home/dataman/Code/qualtrics_etl/src/qualtrics_etl/")
qe... | Python | 0 |
98311b8b80d28ac6e6d92dbae3bcf987d5027e7a | Fix for housekeeping script error | photonix/photos/management/commands/housekeeping.py | photonix/photos/management/commands/housekeeping.py | import os
from pathlib import Path
from shutil import rmtree
from time import sleep
from django.conf import settings
from django.core.management.base import BaseCommand
from photonix.photos.models import Photo, Task
from photonix.photos.utils.thumbnails import THUMBNAILER_VERSION
class Command(BaseCommand):
hel... | import os
from pathlib import Path
from shutil import rmtree
from time import sleep
from django.conf import settings
from django.core.management.base import BaseCommand
from photonix.photos.models import Photo, Task
from photonix.photos.utils.thumbnails import THUMBNAILER_VERSION
class Command(BaseCommand):
hel... | Python | 0 |
6bdc92345a58dc40749eedb9630d0d28d6d23e87 | Add release notes for moving_mnist | tensorflow_datasets/video/moving_mnist.py | tensorflow_datasets/video/moving_mnist.py | # coding=utf-8
# Copyright 2020 The TensorFlow Datasets Authors.
#
# 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 appl... | # coding=utf-8
# Copyright 2020 The TensorFlow Datasets Authors.
#
# 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 appl... | Python | 0 |
3214645740866f4d15df826880169297b460bce4 | fix file mode | egginst/utils.py | egginst/utils.py | import os
import sys
import random
import shutil
import string
from os.path import basename, isdir, isfile, join
chars = string.letters + string.digits
def mk_tmp_dir():
tmp_dir = join(sys.prefix, '.tmp_ironpkg')
try:
shutil.rmtree(tmp_dir)
except (WindowsError, IOError):
pass
if not... | import os
import sys
import random
import shutil
import string
from os.path import basename, isdir, isfile, join
chars = string.letters + string.digits
def mk_tmp_dir():
tmp_dir = join(sys.prefix, '.tmp_ironpkg')
try:
shutil.rmtree(tmp_dir)
except (WindowsError, IOError):
pass
if not... | Python | 0.000001 |
ac90bdad2f09a5b79cb33b7ffed4782b7af6db61 | Removing old hello world ish | webserver.py | webserver.py |
import time
from flask import Flask, render_template
# DEFAULT_EXPIRATION = 10 # 10 sec
# DEFAULT_EXPIRATION = 60 * 10 # 10 min
DEFAULT_EXPIRATION = 60 * 20 # 20 min
app = Flask(__name__)
last_ping = {}
@app.route('/')
def index():
return render_template('index.html')
@app.route('/ping/<thing>')
def ... |
import time
from flask import Flask, render_template
# DEFAULT_EXPIRATION = 10 # 10 sec
# DEFAULT_EXPIRATION = 60 * 10 # 10 min
DEFAULT_EXPIRATION = 60 * 20 # 20 min
app = Flask(__name__)
last_ping = {}
@app.route('/')
def index():
# return 'Hello, World!'
return render_template('index.html')
@ap... | Python | 0.998965 |
3fadef637ad17458f629a4baeba7fd38205a1510 | Bump Katib Python SDK to 0.12.0rc0 version (#1640) | sdk/python/v1beta1/setup.py | sdk/python/v1beta1/setup.py | # Copyright 2021 The Kubeflow Authors.
#
# 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 ... | # Copyright 2021 The Kubeflow Authors.
#
# 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 ... | Python | 0 |
8517803a2cb3f3dd46911ec63acdeae283f23efd | Increase fund graph detail | srv/config.py | srv/config.py | """ Global configuration variables """
import os.path
PIE_TOLERANCE = 0.075
PIE_DETAIL = 30
GRAPH_FUND_HISTORY_DETAIL = 200
OVERVIEW_NUM_LAST = 25
OVERVIEW_NUM_FUTURE = 10
START_YEAR = 2014
START_MONTH = 9
LIST_CATEGORIES = ('funds', 'in', 'bills', 'food', 'general', 'holiday', 'social')
# common columns are adde... | """ Global configuration variables """
import os.path
PIE_TOLERANCE = 0.075
PIE_DETAIL = 30
GRAPH_FUND_HISTORY_DETAIL = 100
OVERVIEW_NUM_LAST = 25
OVERVIEW_NUM_FUTURE = 10
START_YEAR = 2014
START_MONTH = 9
LIST_CATEGORIES = ('funds', 'in', 'bills', 'food', 'general', 'holiday', 'social')
# common columns are adde... | Python | 0 |
899e3c9f81a43dcb94e290ce0a86f128bd94effd | Apply filter channel published on menu list (channel context processors) | opps/channel/context_processors.py | opps/channel/context_processors.py | # -*- coding: utf-8 -*-
from django.utils import timezone
from .models import Channel
def channel_context(request):
""" Channel context processors
"""
opps_menu = Channel.objects.filter(date_available__lte=timezone.now(),
published=True)
return {'opps_menu': opp... | # -*- coding: utf-8 -*-
from .models import Channel
def channel_context(request):
return {'opps_menu': Channel.objects.all()}
| Python | 0 |
54451c4030bfeece4ab2157afe1ee3f8f65c4dcb | Fix sentry_useremail "duplicate key" error (#16) | sentry_ldap_auth/backend.py | sentry_ldap_auth/backend.py | from __future__ import absolute_import
from django_auth_ldap.backend import LDAPBackend
from django.conf import settings
from sentry.models import (
Organization,
OrganizationMember,
UserOption,
)
class SentryLdapBackend(LDAPBackend):
def get_or_create_user(self, username, ldap_user):
model =... | from __future__ import absolute_import
from django_auth_ldap.backend import LDAPBackend
from django.conf import settings
from sentry.models import (
Organization,
OrganizationMember,
UserOption,
)
class SentryLdapBackend(LDAPBackend):
def get_or_create_user(self, username, ldap_user):
model =... | Python | 0.000008 |
c55bf8d153c47500615b8ded3c95957be8ee70a3 | Refactor JSONResponse views to include ListView | froide/helper/json_view.py | froide/helper/json_view.py | from django import http
from django.views.generic import DetailView, ListView
class JSONResponseMixin(object):
def render_to_json_response(self, context):
"Returns a JSON response containing 'context' as payload"
return self.get_json_response(self.convert_context_to_json(context))
def get_json... | from django import http
from django.views.generic import DetailView
class JSONResponseDetailView(DetailView):
def render_to_json_response(self, context):
"Returns a JSON response containing 'context' as payload"
return self.get_json_response(self.convert_context_to_json(context))
def get_json_... | Python | 0 |
e03103c74a066184178980f1073505724e094394 | Fix url order | stadt/urls.py | stadt/urls.py | from django.conf import settings, urls
from django.conf.urls import static
from django.contrib import admin
urlpatterns = [
urls.url(r'^stadt/admin/', admin.site.urls),
urls.url(r'^stadt/api/', urls.include('core.api_urls')),
urls.url(r'^stadt/', urls.include('account.urls')),
urls.url(r'^stadt/', url... | from django.conf import settings, urls
from django.conf.urls import static
from django.contrib import admin
urlpatterns = [
urls.url(r'^stadt/admin/', admin.site.urls),
urls.url(r'^stadt/api/', urls.include('core.api_urls')),
urls.url(r'^stadt/', urls.include('account.urls')),
urls.url(r'^stadt/', url... | Python | 0.999733 |
a72f72c16aaf1689fc364311afe3b42a6fed7eae | add examples | CourierToDovecot.py | CourierToDovecot.py | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
# -----------------------
# Author : jgo
# Execute a perl script into all mailbox newly created,
# on the Dovecot server.
# -----------------------
import subprocess
import os
import logging
from logging.handlers import RotatingFileHandler
## [Config VARS] -----------... | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
# -----------------------
# Author : jgo
# Execute a perl script into all mailbox newly created,
# on the Dovecot server.
# -----------------------
import subprocess
import os
import logging
from logging.handlers import RotatingFileHandler
## [Config VARS] -----------... | Python | 0 |
83ed8a4fd258f351da2ea358613ff57dadbf03f6 | Remove blank line | junction/proposals/permissions.py | junction/proposals/permissions.py | # -*- coding: utf-8 -*-
# Third Party Stuff
from django.core.exceptions import PermissionDenied
# Junction Stuff
from junction.conferences.models import ConferenceProposalReviewer
from junction.base.constants import ConferenceStatus
from .models import ProposalSectionReviewer
def is_proposal_voting_allowed(proposa... | # -*- coding: utf-8 -*-
# Third Party Stuff
from django.core.exceptions import PermissionDenied
# Junction Stuff
from junction.conferences.models import ConferenceProposalReviewer
from junction.base.constants import ConferenceStatus
from .models import ProposalSectionReviewer
def is_proposal_voting_allowed(proposa... | Python | 0.999999 |
f8ea5ef37280366b4b3991442e406952bb0575b3 | Create calculate_cosine_distance.py | k-NN/calculate_cosine_distance.py | k-NN/calculate_cosine_distance.py | '''
Calculates the cosine distance for an input data
'''
import math
import numpy as np
import scipy.io
__author__ = """Marina von Steinkirch"""
def cosineDistance(x, y):
''' This function computes the cosine distance between feature vectors
x and y. This distance is frequently used for text classif... | '''
Calculates the cosine distance for an input data
'''
import math
import numpy as np
import scipy.io
__author__ = """Mari Wahl"""
def cosineDistance(x, y):
''' This function computes the cosine distance between feature vectors
x and y. This distance is frequently used for text classification.
... | Python | 0.00003 |
2cde35bb6f948f861026921daf7fe24b353af273 | Add bulleted and numbered list to CKEditor | kerrokantasi/settings/__init__.py | kerrokantasi/settings/__init__.py | from .util import get_settings, load_local_settings, load_secret_key
from . import base
settings = get_settings(base)
load_local_settings(settings, "local_settings")
load_secret_key(settings)
if not settings["DEBUG"] and settings["JWT_AUTH"]["JWT_SECRET_KEY"] == "kerrokantasi":
raise ValueError("Refusing to run o... | from .util import get_settings, load_local_settings, load_secret_key
from . import base
settings = get_settings(base)
load_local_settings(settings, "local_settings")
load_secret_key(settings)
if not settings["DEBUG"] and settings["JWT_AUTH"]["JWT_SECRET_KEY"] == "kerrokantasi":
raise ValueError("Refusing to run o... | Python | 0 |
d09cc197d11efa2181ce68ef4212cb9df5ee285c | add daemon argument to launcher | selfdrive/athena/manage_athenad.py | selfdrive/athena/manage_athenad.py | #!/usr/bin/env python3
import time
from multiprocessing import Process
from common.params import Params
from selfdrive.manager.process import launcher
from selfdrive.swaglog import cloudlog
from selfdrive.version import get_version, is_dirty
ATHENA_MGR_PID_PARAM = "AthenadPid"
def main():
params = Params()
don... | #!/usr/bin/env python3
import time
from multiprocessing import Process
from common.params import Params
from selfdrive.manager.process import launcher
from selfdrive.swaglog import cloudlog
from selfdrive.version import get_version, is_dirty
ATHENA_MGR_PID_PARAM = "AthenadPid"
def main():
params = Params()
don... | Python | 0.000001 |
38eb6221ca41446c0c4fb1510354bdc4f00ba5f1 | Remove children via uid rather than name | serfnode/build/handler/launcher.py | serfnode/build/handler/launcher.py | #!/usr/bin/env python
import functools
import os
import signal
import sys
import docker_utils
def handler(name, signum, frame):
print('Should kill', name)
try:
cid = open('/child_{}'.format(name)).read().strip()
docker_utils.client.remove_container(cid, force=True)
except Exception:
... | #!/usr/bin/env python
import functools
import os
import signal
import sys
import docker_utils
def handler(name, signum, frame):
print('Should kill', name)
try:
docker_utils.client.remove_container(name, force=True)
except Exception:
pass
sys.exit(0)
def launch(name, args):
try:... | Python | 0 |
933201b14764b8a108986313b8bece8ae4ad7d51 | handle in_progress event | km_hipchat_screamer/statuspage.py | km_hipchat_screamer/statuspage.py | # -*- coding: utf-8 -*-
"""
km-hipchat-screamer.statuspage
~~~~~~~~~~~~~~~~~~~~~~~
Module providing for status change alert routes the KISSmetrics HipChat Webhook service
"""
from flask import Blueprint, jsonify, request
from utils import env_check
import os
import json
import hipchat
import requests
hipchat_notif... | # -*- coding: utf-8 -*-
"""
km-hipchat-screamer.statuspage
~~~~~~~~~~~~~~~~~~~~~~~
Module providing for status change alert routes the KISSmetrics HipChat Webhook service
"""
from flask import Blueprint, jsonify, request
from utils import env_check
import os
import json
import hipchat
import requests
hipchat_notif... | Python | 0.000012 |
875d558d69fcadcea5f89b4ef4021484b34e435b | fix #190 | django-openstack/django_openstack/syspanel/views/services.py | django-openstack/django_openstack/syspanel/views/services.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
from django import template
from django import http
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.shortcuts import render_to_response
from django.shortcuts import redirect
from django.utils.translation import ugettext ... | # vim: tabstop=4 shiftwidth=4 softtabstop=4
from django import template
from django import http
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.shortcuts import render_to_response
from django.shortcuts import redirect
from django.utils.translation import ugettext ... | Python | 0.000001 |
93361bad12c132846b10966559fe89bc1d1a1e0b | Update settings.py | Epitome/settings.py | Epitome/settings.py | """
Django settings for Epitome project.
Generated by 'django-admin startproject' using Django 2.0.0.
For more information on this file, see
https://docs.djangoproject.com/en/2.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.0/ref/settings/
"""
... | """
Django settings for Epitome project.
Generated by 'django-admin startproject' using Django 2.0.0.
For more information on this file, see
https://docs.djangoproject.com/en/2.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.0/ref/settings/
"""
... | Python | 0.000001 |
bd3d8738fc00b2d36aafe5749e88826845441541 | fix handling of pages (closes #685) | weboob/backends/orange/browser.py | weboob/backends/orange/browser.py | # -*- coding: utf-8 -*-
# Copyright(C) 2010-2011 Nicolas Duhamel
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at yo... | # -*- coding: utf-8 -*-
# Copyright(C) 2010-2011 Nicolas Duhamel
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at yo... | Python | 0 |
f631099894a02cb79b5be372894ed1f589849a8d | test for datetime.datetime type from dframe_dateconv | test/pandaservtest.py | test/pandaservtest.py | import unittest, sys, os
from datetime import datetime
import pandas as pd
import src.pandaserv as pandaserv
import numpy as np
class Testpandaserv(unittest.TestCase):
def setUp(self):
self.dates = pd.date_range('20130101', periods=6)
self.df = pd.DataFrame(
np.random.randn(6,4... | import unittest, sys, os
from datetime import datetime
import pandas as pd
import src.pandaserv as pandaserv
import numpy as np
class Testpandaserv(unittest.TestCase):
def setUp(self):
self.dates = pd.date_range('20130101', periods=6)
self.df = pd.DataFrame(
np.random.randn(6,4... | Python | 0 |
e8e109de54ebed6336f6ed3bcb2400ec5d4aaafb | add docs for number | schematec/converters.py | schematec/converters.py | '''
Convertaion rules
=================
Can be converted into:
integer
-------
#. Any int or long value
#. Any suitable string/unicode
#. Boolean value
number
-------
#. Any float or int or long value
#. Any suitable string/unicode
#. Boolean value
string
------
#. Any suitable string/unicode
#. Any int or long ... | '''
Convertaion rules
=================
Can be converted into:
integer
-------
#. Any int or long value
#. Any suitable string/unicode
#. Boolean value
string
------
#. Any suitable string/unicode
#. Any int or long value
boolean
-------
#. Boolean value
#. 0 or 1
#. '0' or '1'
#. u'0' or u'1'
array
-----
#. A... | Python | 0.000001 |
91238b6b0f0b14a6d0f7707aa0b388cedfd5894c | set default false allow_cnpj_multi_ie | l10n_br_base/models/res_config.py | l10n_br_base/models/res_config.py | # -*- coding: utf-8 -*-
from openerp import fields, models
from openerp.tools.safe_eval import safe_eval
class res_config(models.TransientModel):
_inherit = 'base.config.settings'
allow_cnpj_multi_ie = fields.Boolean(
string=u'Permitir o cadastro de Customers com CNPJs iguais',
default=False... | # -*- coding: utf-8 -*-
from openerp import fields, models
from openerp.tools.safe_eval import safe_eval
class res_config(models.TransientModel):
_inherit = 'base.config.settings'
allow_cnpj_multi_ie = fields.Boolean(
string=u'Permitir o cadastro de Customers com CNPJs iguais',
default=True,... | Python | 0.000003 |
bc9c782317eac99716bc961e42e6072f0e5616cf | Add dummy var in order to work around issue 1 https://github.com/LinuxTeam-teilar/cronos.teilar.gr/issues/1 | apps/__init__.py | apps/__init__.py | # -*- coding: utf-8 -*-
from django.conf import settings
from django.core.mail import send_mail
'''
For unkown reason, the logger is NOT able to find a handler
unless a settings.VARIABLE is called!!
https://github.com/LinuxTeam-teilar/cronos.teilar.gr/issues/1
I leave that here till the bug is fixed
'''
settings.DEBU... | # -*- coding: utf-8 -*-
from django.conf import settings
from django.core.mail import send_mail
def mail_cronos_admin(title, message):
'''
Wrapper function of send_mail
'''
try:
send_mail(title, message, 'notification@cronos.teilar.gr', [settings.ADMIN[0][1]])
except:
pass
class C... | Python | 0.001556 |
d006711787d018ed401ba003d3472b8a0e843437 | Add documentation for ignoring empty strings | stringinfo.py | stringinfo.py | #!/usr/bin/env python3
# -*- coding: utf8 -*-
"""
Usage:
stringinfo [options] [--] [STRING]...
Options:
STRING The strings for which you want information. If none are given, read from stdin upto EOF. Empty strings are ignored.
--list List all plugins, with their descriptions and whether they're defau... | #!/usr/bin/env python3
# -*- coding: utf8 -*-
"""
Usage:
stringinfo [options] [--] [STRING]...
Options:
STRING The strings for which you want information. If none are given, read from stdin upto EOF.
--list List all plugins, with their descriptions and whether they're default or not
--all R... | Python | 0.000002 |
a6ac71c7a3c1ac1fd3794a55c47ad86fe014cf73 | Update RateLimit.py | Cogs/RateLimit.py | Cogs/RateLimit.py | import asyncio
import discord
import os
import time
from datetime import datetime
from discord.ext import commands
def setup(bot):
# Add the bot and deps
settings = bot.get_cog("Settings")
bot.add_cog(RateLimit(bot, settings))
# This is the RateLimit module. It keeps users from being able to spam c... | import asyncio
import discord
import os
import time
from datetime import datetime
from discord.ext import commands
def setup(bot):
# Add the bot and deps
settings = bot.get_cog("Settings")
bot.add_cog(RateLimit(bot, settings))
# This is the RateLimit module. It keeps users from being able to spam c... | Python | 0.000001 |
9e7cd9f13abb29ff8458407b905d522548eaf5c9 | Refactor check_executables_have_shebangs for git ls-files reuse | pre_commit_hooks/check_executables_have_shebangs.py | pre_commit_hooks/check_executables_have_shebangs.py | """Check that executable text files have a shebang."""
import argparse
import shlex
import sys
from typing import Generator
from typing import List
from typing import NamedTuple
from typing import Optional
from typing import Sequence
from typing import Set
from pre_commit_hooks.util import cmd_output
from pre_commit_h... | """Check that executable text files have a shebang."""
import argparse
import shlex
import sys
from typing import List
from typing import Optional
from typing import Sequence
from typing import Set
from pre_commit_hooks.util import cmd_output
from pre_commit_hooks.util import zsplit
EXECUTABLE_VALUES = frozenset(('1'... | Python | 0 |
5eeab4e458e7af3895525dcc08017eb855308723 | remove extra s typo | autocms/stats.py | autocms/stats.py | """Harvesting of persistent statsitical records."""
import os
import time
import importlib
from .core import load_records
def harvest_default_stats(records, config):
"""Add a row to the long term statistics record for a given test."""
now = int(time.time())
harvest_time = now - int(config['AUTOCMS_STAT_... | """Harvesting of persistent statsitical records."""
import os
import time
import importlib
from .core import load_records
def harvest_default_stats(records, config):
"""Add a row to the long term statistics record for a given test."""
now = int(time.time())
harvest_time = now - int(config['AUTOCMS_STAT_... | Python | 0.999176 |
c14b5ece7446bb88959b75281ba5dd30c66843ad | Change list command to optionally accept an alternate template directory to search | scriptorium/__main__.py | scriptorium/__main__.py | #!/usr/bin/env python
#Script to build a scriptorium paper in a cross-platform friendly fashion
import scriptorium
import argparse
import subprocess
import os
import os.path
import glob
import re
import shutil
import sys
BIN_DIR = os.path.dirname(os.path.realpath(__file__))
BASE_DIR = os.path.abspath(os.path.join(BIN... | #!/usr/bin/env python
#Script to build a scriptorium paper in a cross-platform friendly fashion
import scriptorium
import argparse
import subprocess
import os
import os.path
import glob
import re
import shutil
import sys
BIN_DIR = os.path.dirname(os.path.realpath(__file__))
BASE_DIR = os.path.abspath(os.path.join(BIN... | Python | 0 |
2d392d8c107c9055e6b62bb365158b1001872cde | Fix deprecation warnings. | emdp/analytic.py | emdp/analytic.py | """
Tools to get analytic solutions from MDPs
"""
import numpy as np
def calculate_P_pi(P, pi):
r"""
calculates P_pi
P_pi(s,t) = \sum_a pi(s,a) p(s, a, t)
:param P: transition matrix of size |S|x|A|x|S|
:param pi: matrix of size |S| x |A| indicating the policy
:return: a matrix of size |S| x |... | """
Tools to get analytic solutions from MDPs
"""
import numpy as np
def calculate_P_pi(P, pi):
"""
calculates P_pi
P_pi(s,t) = \sum_a pi(s,a) p(s, a, t)
:param P: transition matrix of size |S|x|A|x|S|
:param pi: matrix of size |S| x |A| indicating the policy
:return: a matrix of size |S| x |S... | Python | 0.000002 |
c8f774ea3455af057736166757f831407711ae67 | Bump to 0.4. | emds/__init__.py | emds/__init__.py | __version__ = '0.4' | __version__ = '0.3' | Python | 0.000001 |
033ec1c5c7d44c54136541aa0e1bd8c73e3c1163 | update test_unitcell | test/test_unitCell.py | test/test_unitCell.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from udkm1Dsim.atoms import Atom
from udkm1Dsim.unitCell import UnitCell
from pint import UnitRegistry
u = UnitRegistry()
u.default_format = '~P'
from numpy import array
def test_unit_cell():
Fe = Atom('Fe')
uc = UnitCell('uc', 'Unit Cell', 2.86*u.angstrom, heat_... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from udkm1Dsim.atoms import Atom
from udkm1Dsim.unitCell import UnitCell
from pint import UnitRegistry
u = UnitRegistry()
u.default_format = '~P'
from numpy import array
def test_unit_cell():
Fe = Atom('Fe')
uc = UnitCell('uc', 'Unit Cell', 2.86*u.angstrom, heat_... | Python | 0.000001 |
b6d161e54e9b398f79f417ac14ec65e5fdb609d3 | remove pre tag in emit init | emit/__init__.py | emit/__init__.py | __version__ = '0.4.0'
from emit.router.core import Router
| __version__ = '0.4.0pre'
from emit.router.core import Router
| Python | 0 |
19fa44530adf1fd5456a0be93ea0dddd7e43eb8c | Remove junk import. | Cli_server_tcp.py | Cli_server_tcp.py | # Copyright (c) 2003-2005 Maxim Sobolev. All rights reserved.
# Copyright (c) 2006-2014 Sippy Software, Inc. All rights reserved.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistrib... | # Copyright (c) 2003-2005 Maxim Sobolev. All rights reserved.
# Copyright (c) 2006-2014 Sippy Software, Inc. All rights reserved.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistrib... | Python | 0 |
fbba7f7c32f4b587efba2e72c051996d4a69f567 | Update example local_settings votigns per page | website/local_settings_example.py | website/local_settings_example.py | # user settings, included in settings.py
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
DEBUG = True
# SECURITY WARNING: Make this unique, and don't share it with anybody.
SECRET_KEY = ''
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgre... | # user settings, included in settings.py
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
DEBUG = True
# SECURITY WARNING: Make this unique, and don't share it with anybody.
SECRET_KEY = ''
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgre... | Python | 0 |
0070417e170ff67248918243d6aaea248a5d024c | Fix Q3 in exercise 6 checking code | learntools/computer_vision/ex6.py | learntools/computer_vision/ex6.py | from learntools.core import *
import tensorflow as tf
# Free
class Q1(CodingProblem):
_solution = ""
_hint = ""
def check(self):
pass
class Q2A(ThoughtExperiment):
_hint = "Remember that whatever transformation you apply needs at least to keep the classes distinct, but otherwise should more ... | from learntools.core import *
import tensorflow as tf
# Free
class Q1(CodingProblem):
_solution = ""
_hint = ""
def check(self):
pass
class Q2A(ThoughtExperiment):
_hint = "Remember that whatever transformation you apply needs at least to keep the classes distinct, but otherwise should more ... | Python | 0.000001 |
f178b2378661a25cebe9753cf84d6ea9f3c081a8 | Improve doc for MultivalueEnum. | enum34_custom.py | enum34_custom.py | from enum import Enum, EnumMeta
from functools import total_ordering
class _MultiValueMeta(EnumMeta):
def __init__(self, cls, bases, classdict):
# make sure we only have tuple values, not single values
for member in self.__members__.values():
if not isinstance(member.value, tuple):
... | from enum import Enum, EnumMeta
from functools import total_ordering
class _MultiValueMeta(EnumMeta):
def __init__(self, cls, bases, classdict):
# make sure we only have tuple values, not single values
for member in self.__members__.values():
if not isinstance(member.value, tuple):
... | Python | 0 |
cf472cc43c4473ad7403bda64302d1170ee6874e | Save user timezone | controllers/preferences.py | controllers/preferences.py | from pytz.gae import pytz
from bo import *
from database.person import *
class ShowPreferences(boRequestHandler):
def get(self):
self.view('preferences', 'preferences.html', {
'person': Person().current,
'preferences': UserPreferences().current,
'timezones': pytz.commo... | from bo import *
from database import *
class ShowPreferences(boRequestHandler):
def get(self):
self.view('preferences', 'preferences.html', {
'person': Person().current,
'preferences': UserPreferences().current,
})
def post(self):
UserPreferences().set_languag... | Python | 0.000001 |
ab4cc4fb85c8616de0be53d0a95ad8096ac0cc0c | set up the page and layout for Dashboard:Team Application Overview | Dashboard/urls.py | Dashboard/urls.py | from django.conf.urls import url
# View Imports
from . import views
app_name = "dashboard"
urlpatterns = [
url(r'^$', views.DashboardIndex.as_view(), name='index'),
url(r'^experts/$', views.expert_management, name='manage_experts'),
url(r'^experts/(?P<username>.+)/$', views.expert_management, name="exper... | from django.conf.urls import url
# View Imports
from . import views
app_name = "dashboard"
urlpatterns = [
url(r'^$', views.DashboardIndex.as_view(), name='index'),
url(r'^experts/$', views.expert_management, name='manage_experts'),
url(r'^experts/(?P<username>.+)/$', views.expert_management, name="exper... | Python | 0 |
f0bec02a6e2516ffd11d43b089576c0463d8d51f | Update denormalizer | project/apps/api/management/commands/denormalize.py | project/apps/api/management/commands/denormalize.py | from django.core.management.base import (
BaseCommand,
)
from apps.api.models import (
Convention,
Contest,
Contestant,
Appearance,
Performance,
Group,
Singer,
Director,
Judge,
)
class Command(BaseCommand):
help = "Command to denormailze data."
def handle(self, *args,... | from django.core.management.base import (
BaseCommand,
)
from apps.api.models import (
Convention,
Contest,
Contestant,
Performance,
Group,
Person,
Singer,
Director,
)
class Command(BaseCommand):
help = "Command to denormailze data."
def handle(self, *args, **options):
... | Python | 0.000027 |
eab481546044bc995eca3dc7d3094c7917d19c20 | Remove hack to make test work on Jenkins, since it still fails. | src/zeit/content/article/edit/browser/tests/test_social.py | src/zeit/content/article/edit/browser/tests/test_social.py | import zeit.cms.testing
import zeit.content.article.edit.browser.testing
import zeit.content.article.testing
class SocialFormTest(zeit.cms.testing.BrowserTestCase):
layer = zeit.content.article.testing.LAYER
def setUp(self):
super(SocialFormTest, self).setUp()
self.browser.open(
... | import zeit.cms.testing
import zeit.content.article.edit.browser.testing
import zeit.content.article.testing
class SocialFormTest(zeit.cms.testing.BrowserTestCase):
layer = zeit.content.article.testing.LAYER
def setUp(self):
super(SocialFormTest, self).setUp()
self.browser.open(
... | Python | 0 |
60e2503bde822fdcea91c3d0a8e6ddb0f67d0d79 | update scripts | scripts/deploy_repos.py | scripts/deploy_repos.py | #!/usr/bin/env python
import os, sys
sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir))
sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir, "core"))
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cmudbac.settings")
import django
django.setup()
from django.db.models import Q
from libr... | #!/usr/bin/env python
import os, sys
sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir))
sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir, "core"))
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cmudbac.settings")
import django
django.setup()
from django.db.models import Q
from libr... | Python | 0.000001 |
bca6f6041e9f49d1d25d7a9c4cb88080d88c45b1 | Comment concerning differences in keys per path | dumper/invalidation.py | dumper/invalidation.py | import dumper.utils
def invalidate_paths(paths):
'''
Invalidate all pages for a certain path.
'''
for path in paths:
for key in all_cache_keys_from_path(path):
dumper.utils.cache.delete(key)
def all_cache_keys_from_path(path):
'''
Each path can actually have multiple cach... | import dumper.utils
def invalidate_paths(paths):
'''
Invalidate all pages for a certain path.
'''
for path in paths:
for key in all_cache_keys_from_path(path):
dumper.utils.cache.delete(key)
def all_cache_keys_from_path(path):
return [dumper.utils.cache_key(path, method) for ... | Python | 0 |
d649ff7c1d63c33c1ea25a1d3916b441e7ccc6ea | Add backwards compatible ctor for HttpChallange | azure-keyvault/azure/keyvault/custom/http_challenge.py | azure-keyvault/azure/keyvault/custom/http_challenge.py | #---------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#---------------------------------------------------------------------... | #---------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#---------------------------------------------------------------------... | Python | 0.00025 |
2b7dbcd01a4d208f83204fc4323ddff055e4a87e | Move common tests to a base reusable class. | test_ngram_profile.py | test_ngram_profile.py | # -*- coding: utf-8 -*-
import os
import json
import unittest
import ngram_profile
class CommonNGramProfileTests(object):
profileClass = None
def test_init(self):
profile = self.profileClass()
self.assertEqual(len(profile), 0)
def test_json_roundtrip(self):
json_profile = '{"a... | # -*- coding: utf-8 -*-
import os
import json
import unittest
from ngram_profile import NGramProfile, CharNGramProfile
class TestNGramProfile(unittest.TestCase):
def test_init(self):
profile = NGramProfile()
self.assertEqual(len(profile), 0)
def test_json_roundtrip(self):
json_prof... | Python | 0 |
d1232473ecb31eb2b85b67e54d5939093233f2bf | Print client pk in list_sessions command | ncharts/management/commands/list_sessions.py | ncharts/management/commands/list_sessions.py | from django.core.management.base import NoArgsCommand
from ncharts.models import ClientState
from ncharts import views as nc_views
from django.contrib.sessions.models import Session
class Command(NoArgsCommand):
def handle_noargs(self, **options):
sessions = Session.objects.all()
print("#session... | from django.core.management.base import NoArgsCommand
from ncharts.models import ClientState
from ncharts import views as nc_views
from django.contrib.sessions.models import Session
class Command(NoArgsCommand):
def handle_noargs(self, **options):
sessions = Session.objects.all()
print("#session... | Python | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.