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 |
|---|---|---|---|---|---|---|---|
e72da8231e7a5b05f098db1f78b66b8cb57f27ba | remove checking in autots import (#5489) | python/chronos/src/bigdl/chronos/autots/__init__.py | python/chronos/src/bigdl/chronos/autots/__init__.py | #
# Copyright 2016 The BigDL 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 2016 The BigDL 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 |
b52a937356f2112ecd5adcdf79ac6430169a735f | fix file close bug causing errors in pypy | new_pymtl/translation_tools/verilator_sim.py | new_pymtl/translation_tools/verilator_sim.py | #===============================================================================
# verilator_sim.py
#===============================================================================
#from verilator_cython import verilog_to_pymtl
from verilator_cffi import verilog_to_pymtl
import verilog
import os
import sys
import fil... | #===============================================================================
# verilator_sim.py
#===============================================================================
#from verilator_cython import verilog_to_pymtl
from verilator_cffi import verilog_to_pymtl
import verilog
import os
import sys
import fil... | Python | 0 |
b0806c0b8b950a3007107cc58fb21e504cf09427 | Move serial device path to settings | homedisplay/control_milight/management/commands/listen_433.py | homedisplay/control_milight/management/commands/listen_433.py | from control_milight.utils import process_automatic_trigger
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
import serial
import time
class Command(BaseCommand):
args = ''
help = 'Listen for 433MHz radio messages'
ITEM_MAP = {
"5236713": "kitchen"... | from django.core.management.base import BaseCommand, CommandError
from control_milight.utils import process_automatic_trigger
import serial
import time
class Command(BaseCommand):
args = ''
help = 'Listen for 433MHz radio messages'
ITEM_MAP = {
"5236713": "kitchen",
"7697747": "hall",
... | Python | 0.000001 |
f041cd9623ef06777189ecd538f5bdb30cf33722 | Fix export_v8_tarball.py to work with python2.7 | tools/export_tarball/export_v8_tarball.py | tools/export_tarball/export_v8_tarball.py | #!/usr/bin/env 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.
"""Creates a tarball with V8 sources, but without .svn directories.
This allows easy packaging of V8, synchronized with browser re... | #!/usr/bin/env 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.
"""Creates a tarball with V8 sources, but without .svn directories.
This allows easy packaging of V8, synchronized with browser re... | Python | 0.000272 |
430799c753bf637acac84a37bae90dd4e2193bd9 | Update account_invoice_refund_reason/tests/test_account_invoice_refund_reason.py | account_invoice_refund_reason/tests/test_account_invoice_refund_reason.py | account_invoice_refund_reason/tests/test_account_invoice_refund_reason.py | # Copyright (C) 2019 Open Source Integrators
# Copyright (C) 2019 Serpent Consulting Services Pvt. Ltd.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo.tests.common import TransactionCase
import datetime
class TestAccountInvoiceRefundReason(TransactionCase):
def setUp(self):
sup... | # Copyright (C) 2019 Open Source Integrators
# Copyright (C) 2019 Serpent Consulting Services Pvt. Ltd.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo.tests.common import TransactionCase
import datetime
class TestAccountInvoiceRefundReason(TransactionCase):
def setUp(self):
sup... | Python | 0 |
270825e739e0662c04181a68d393249acc6e59c5 | FIX reg ganancias no requerido en pagos de clientes | l10n_ar_account_withholding/models/account_payment_group.py | l10n_ar_account_withholding/models/account_payment_group.py | # -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
from openerp import models, api, fields
class Ac... | # -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
from openerp import models, api, fields
class Ac... | Python | 0 |
a3cd9df5c807026ac78de56614d09411991d9573 | Add message limit to subscription lifecycle filtering | subscriptions/management/commands/fix_subscription_lifecycle.py | subscriptions/management/commands/fix_subscription_lifecycle.py | from datetime import datetime
from django.core.management.base import BaseCommand
from django.utils import timezone
import json
from subscriptions.models import Subscription
from subscriptions.tasks import send_next_message
class Command(BaseCommand):
help = ("This command is used when the subscription has falle... | from datetime import datetime
from django.core.management.base import BaseCommand
from django.utils import timezone
import json
from subscriptions.models import Subscription
from subscriptions.tasks import send_next_message
class Command(BaseCommand):
help = ("This command is used when the subscription has falle... | Python | 0 |
5d083a15a71aac24c3c4d29dd753067a93c62495 | Fix id builtin being overwritten | EasyEuler/data.py | EasyEuler/data.py | import collections
import json
import os
from jinja2 import Environment, FileSystemLoader
from EasyEuler import paths
class ProblemList(collections.Sequence):
def __init__(self, problems):
self._problems = problems
def get(self, problem_id):
if problem_id < 1 or len(self) < problem_id:
... | import collections
import json
import os
from jinja2 import Environment, FileSystemLoader
from EasyEuler import paths
class ProblemList(collections.Sequence):
def __init__(self, problems):
self._problems = problems
def get(self, id):
if id < 1 or len(self) < id:
# We don't want ... | Python | 0.000001 |
d095e0179befa80c03c83314c6a095d3b0d0bd70 | and , should be optional | IRCMessage.py | IRCMessage.py | # -*- coding: utf-8 -*-
import ServerInfo
from enum import Enum
import re
class TargetTypes(Enum):
CHANNEL = 1
USER = 2
class IRCChannel(object):
def __init__(self, name):
"""
@type name: str
"""
self.Name = name
self.Topic = ''
self.TopicSetBy = ''
... | # -*- coding: utf-8 -*-
import ServerInfo
from enum import Enum
import re
class TargetTypes(Enum):
CHANNEL = 1
USER = 2
class IRCChannel(object):
def __init__(self, name):
"""
@type name: str
"""
self.Name = name
self.Topic = ''
self.TopicSetBy = ''
... | Python | 0.999967 |
4899188e8eb0676ccf13525ed6562b85878cb0ea | Return attributes in a dictionary rather than in a list | scripts/parse_header.py | scripts/parse_header.py | #!/usr/bin/python
# parse_header.py finds all exported functions in a GDK header and writes them
# to a nice XML file. That file can be used to e.g. generate code for SA-MP natives.
import os
import re
import sys
import xml.dom.minidom
def parse_argument_list(string):
""" For each entry of the arg_list ... | #!/usr/bin/python
# parse_header.py finds all exported functions in a GDK header and writes them
# to a nice XML file. That file can be used to e.g. generate code for SA-MP natives.
import os
import re
import sys
import xml.dom.minidom
def parse_argument_list(string):
""" For each entry of the arg_list ... | Python | 0.000099 |
483a66a693fd119192c12ee63c56a1da406fa3ca | fix templates path | accounts/views.py | accounts/views.py | from django.shortcuts import render
from django.urls import reverse
def profile(response, profile):
return render(response, 'account/profile.html')
| from django.shortcuts import render
from django.urls import reverse
def profile(response, profile):
return render(response, 'accounts/profile.html')
| Python | 0.000001 |
da9bab1d15d3f54d2ac65701e533b9bc34ebfea5 | remove test skip | tests/cupy_tests/array_api_tests/test_sorting_functions.py | tests/cupy_tests/array_api_tests/test_sorting_functions.py | import pytest
from cupy import array_api as xp
@pytest.mark.parametrize(
"obj, axis, expected",
[
([0, 0], -1, [0, 1]),
([0, 1, 0], -1, [1, 0, 2]),
([[0, 1], [1, 1]], 0, [[1, 0], [0, 1]]),
([[0, 1], [1, 1]], 1, [[1, 0], [0, 1]]),
],
)
def test_stable_desc_argsort(obj, axis... | import pytest
from cupy import array_api as xp
@pytest.mark.parametrize(
"obj, axis, expected",
[
([0, 0], -1, [0, 1]),
([0, 1, 0], -1, [1, 0, 2]),
([[0, 1], [1, 1]], 0, [[1, 0], [0, 1]]),
([[0, 1], [1, 1]], 1, [[1, 0], [0, 1]]),
],
)
@pytest.mark.skipif(
# https://git... | Python | 0.000001 |
6231afb51f5653e210f41d47c66797c4bd4d738d | Make it possible for the user to change username | accounts/views.py | accounts/views.py | # coding: utf-8
from django.shortcuts import render
from django.contrib.auth.decorators import login_required
from django.views.generic.edit import UpdateView
from django.core.urlresolvers import reverse_lazy
from volunteer_planner.utils import LoginRequiredMixin
@login_required()
def user_account_detail(request):
... | # coding: utf-8
from django.shortcuts import render
from django.contrib.auth.decorators import login_required
from django.views.generic.edit import UpdateView
from django.core.urlresolvers import reverse_lazy
from volunteer_planner.utils import LoginRequiredMixin
@login_required()
def user_account_detail(request):
... | Python | 0.998407 |
0bb558351a58caaca61eb381cc9a3a4ee4b881bb | format code | accounts/views.py | accounts/views.py | from django.shortcuts import render, redirect
from accounts.models import UserProfile
def index(request):
users = UserProfile.objects.all()
message = request.session.get('message', None)
info = request.session.get('info', None)
warning = request.session.get('warning', None)
alert = request.sessi... | from django.shortcuts import render, redirect
from accounts.models import UserProfile
def index(request):
users = UserProfile.objects.all()
message = request.session.get('message', None)
info = request.session.get('info', None)
warning = request.session.get('warning', None)
alert = request.sessio... | Python | 0.000061 |
7c75da48d6746fc148a79051338c3cd554d75615 | Change variable name to next for logout function | accounts/views.py | accounts/views.py | from django.shortcuts import redirect
from django.contrib.auth import logout as auth_logout
from django.conf import settings
def logout(request):
"""Logs out user redirects if in request"""
next = request.GET.get('next', '')
auth_logout(request)
if next:
return redirect('{}/?next={}'.format(s... | from django.shortcuts import redirect
from django.contrib.auth import logout as auth_logout
from django.conf import settings
def logout(request):
"""Logs out user redirects if in request"""
r = request.GET.get('r', '')
auth_logout(request)
if r:
return redirect('{}/?r={}'.format(settings.OPEN... | Python | 0.000001 |
a1aa922643ddbe6bd2beb497d087f5ff9e6233df | Add edx needed dependencies | test-settings.py | test-settings.py | from settings import *
from path import path
from openedx.core.lib.tempdir import mkdtemp_clean
from django.conf import settings
from uuid import uuid4
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.message... | from settings import *
from path import path
from openedx.core.lib.tempdir import mkdtemp_clean
from django.conf import settings
from uuid import uuid4
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.message... | Python | 0 |
f57326e5f5c7d64d6f7d5f204bcf388de897d5b0 | Revise palindrome function names | alg_palindrome.py | alg_palindrome.py | """Palindrome: a string that read the same forward and backward.
For example: radar, madam.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
def palindrome(a_str):
"""Check palindrom by front & rear match by Deque."""
from ds_deque import Deque... | """Palindrome: a string that read the same forward and backward.
For example: radar, madam.
"""
from __future__ import print_function
def match_palindrome(a_str):
"""Check palindrom by front & rear match by Deque."""
from ds_deque import Deque
str_deque = Deque()
for s in a_str:
str_deque.... | Python | 0.998495 |
4f2fb3ac84216096411a5b6583e4fbb22c8e5196 | bump dev version | allel/__init__.py | allel/__init__.py | # -*- coding: utf-8 -*-
# flake8: noqa
from allel import model
from allel import stats
from allel import plot
from allel import io
from allel import chunked
from allel import constants
from allel import util
# convenient shortcuts
from allel.model.ndarray import *
from allel.model.chunked import *
# experimental
tr... | # -*- coding: utf-8 -*-
# flake8: noqa
from allel import model
from allel import stats
from allel import plot
from allel import io
from allel import chunked
from allel import constants
from allel import util
# convenient shortcuts
from allel.model.ndarray import *
from allel.model.chunked import *
# experimental
tr... | Python | 0 |
2cc8a2cace6c4a44e7280b0d2312c5aed6d68640 | check matrix condition when generating variances | mosfit/modules/outputs/lightcurve.py | mosfit/modules/outputs/lightcurve.py | """Definitions for the `LightCurve` class."""
from collections import OrderedDict
import numpy as np
from mosfit.modules.outputs.output import Output
# Important: Only define one ``Module`` class per file.
class LightCurve(Output):
"""Output a light curve to disk."""
_lc_keys = [
'magnitudes', 'e... | """Definitions for the `LightCurve` class."""
from collections import OrderedDict
import numpy as np
from mosfit.modules.outputs.output import Output
# Important: Only define one ``Module`` class per file.
class LightCurve(Output):
"""Output a light curve to disk."""
_lc_keys = [
'magnitudes', 'e... | Python | 0 |
709f807368ea7915bc5c2f7d6236b3a24df92c8c | Simplify script for recorded ctrl message injection | scripts/sc-test-cmsg.py | scripts/sc-test-cmsg.py | #!/usr/bin/env python
# The MIT License (MIT)
#
# Copyright (c) 2015 Stany MARCEL <stanypub@gmail.com>
#
# 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 withou... | #!/usr/bin/env python
# The MIT License (MIT)
#
# Copyright (c) 2015 Stany MARCEL <stanypub@gmail.com>
#
# 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 withou... | Python | 0.000001 |
51c597d6ea93b27a1e2879cb1d9d250da9ecc799 | Use EventSettingProperty in CFA | indico/modules/events/abstracts/models/call_for_abstracts.py | indico/modules/events/abstracts/models/call_for_abstracts.py | # This file is part of Indico.
# Copyright (C) 2002 - 2016 European Organization for Nuclear Research (CERN).
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (a... | # This file is part of Indico.
# Copyright (C) 2002 - 2016 European Organization for Nuclear Research (CERN).
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (a... | Python | 0 |
172de448cc0a0903014029eca0a7eee9bbe8b0dc | Set use_middlewares to False in tasks request handlers. | source/tipfy/ext/tasks/__init__.py | source/tipfy/ext/tasks/__init__.py | # -*- coding: utf-8 -*-
"""
tipfy.ext.tasks
~~~~~~~~~~~~~~~
Task queue utilities extension.
:copyright: 2009 by tipfy.org.
:license: BSD, see LICENSE.txt for more details.
"""
import logging
from google.appengine.ext import db
from google.appengine.api.labs import taskqueue
from google.appengine.e... | # -*- coding: utf-8 -*-
"""
tipfy.ext.tasks
~~~~~~~~~~~~~~~
Task queue utilities extension.
:copyright: 2009 by tipfy.org.
:license: BSD, see LICENSE.txt for more details.
"""
import logging
from google.appengine.ext import db
from google.appengine.api.labs import taskqueue
from google.appengine.e... | Python | 0 |
4b2b59bb3676afd262596425372a4ce0053ba416 | Improve formatting in replication script. | couchdb/tools/replicate.py | couchdb/tools/replicate.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2009 Maximillian Dornseif <md@hudora.de>
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
"""
This script replicates databases from one CouchDB server to an other.
This is mainly f... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2009 Maximillian Dornseif <md@hudora.de>
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
"""
This script replicates databases from one CouchDB server to an other.
This is mainly f... | Python | 0 |
6cbec939130ba8e17969e8d13b35765f9683b692 | add exception 2017/06/06 | crawler/tools/MysqlBase.py | crawler/tools/MysqlBase.py | #-*- encoding:UTF-8 -*-
import urllib2
import re
import StringIO
import gzip
import logging
import sqlite3
import logutils
import urllib
import sys
import MySQLdb
reload(sys)
sys.setdefaultencoding('utf8')
class MysqlBase:
def __init__(self,dbname):
self.conn=None
self.reconn=False
self.d... | #-*- encoding:UTF-8 -*-
import urllib2
import re
import StringIO
import gzip
import logging
import sqlite3
import logutils
import urllib
import sys
import MySQLdb
reload(sys)
sys.setdefaultencoding('utf8')
class MysqlBase:
def __init__(self,dbname):
self.conn=None
self.reconn=False
self.d... | Python | 0 |
1ceef7205121141cf3c01826a1bb5d01013e74db | clean cruft | ymir/data.py | ymir/data.py | # -*- coding: utf-8 -*-
""" ymir.data
"""
from fabric.colors import green
STATUS_DEAD = ['terminated', 'shutting-down']
OK = green(' ok')
| # -*- coding: utf-8 -*-
""" ymir.data
"""
from fabric.colors import green
DEFAULT_SUPERVISOR_PORT = 9001 # supervisor WUI port
STATUS_DEAD = ['terminated', 'shutting-down']
OK = green(' ok')
| Python | 0 |
20c61a39b0f2bc35eabc41f519732e2706c6f59c | test domain is uuid | corehq/apps/data_dictionary/tests/test_util.py | corehq/apps/data_dictionary/tests/test_util.py | import uuid
from django.test import TestCase
from mock import patch
from corehq.apps.data_dictionary.models import CaseType, CaseProperty
from corehq.apps.data_dictionary.util import generate_data_dictionary
class GenerateDictionaryTest(TestCase):
domain = uuid.uuid4()
def tearDown(self):
CaseType.... | from django.test import TestCase
from mock import patch
from corehq.apps.data_dictionary.models import CaseType, CaseProperty
from corehq.apps.data_dictionary.util import generate_data_dictionary
class GenerateDictionaryTest(TestCase):
domain = 'data-dictionary'
def tearDown(self):
CaseType.objects.... | Python | 0.999975 |
863a0c00c6fd00d06e8d62d35506d9faae42e8d8 | use templates manipulation to add the link to open the pad form, rather than using JS | addons/piratepad/editors.py | addons/piratepad/editors.py | # -*- coding: utf-8 -*-
from openobject.widgets import JSLink
import openobject.templating
class SidebarTemplateEditor(openobject.templating.TemplateEditor):
templates = ['/openerp/widgets/templates/sidebar.mako']
ADD_ATTACHMENT_BUTTON = u'id="add-attachment"'
BINARY_ATTACHMENTS_FORM = u'<form id="attachm... | # -*- coding: utf-8 -*-
from openobject.widgets import JSLink
import openobject.templating
class SidebarTemplateEditor(openobject.templating.TemplateEditor):
templates = ['/openerp/widgets/templates/sidebar.mako']
BINARY_ATTACHMENTS_FORM = u'<form id="attachment-box"'
def edit(self, template, template_te... | Python | 0 |
1ade506f5408cbbe099bb83bd701472137470618 | Add extra version of py-contextlib2 (#15322) | var/spack/repos/builtin/packages/py-contextlib2/package.py | var/spack/repos/builtin/packages/py-contextlib2/package.py | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyContextlib2(PythonPackage):
"""contextlib2 is a backport of the standard library's cont... | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyContextlib2(PythonPackage):
"""contextlib2 is a backport of the standard library's cont... | Python | 0 |
71615632defe37681d1257912ea03f6e1cdeffde | add v1.1-3 (#20923) | var/spack/repos/builtin/packages/r-fitdistrplus/package.py | var/spack/repos/builtin/packages/r-fitdistrplus/package.py | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RFitdistrplus(RPackage):
"""Help to Fit of a Parametric Distribution to Non-Censored or Ce... | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RFitdistrplus(RPackage):
"""Extends the fitdistr() function (of the MASS package) with sev... | Python | 0 |
a7a10cf40c781a8c0cb4e96bdd7077d6cbe8afce | fix batching of changes in doctypemigration continuous | corehq/doctypemigrations/continuous_migrate.py | corehq/doctypemigrations/continuous_migrate.py | import datetime
from corehq.util.couch import IterDB
from dimagi.utils.couch.database import iter_docs
from dimagi.utils.chunked import chunked
import logging
def filter_doc_ids_by_doc_type(db, doc_ids, doc_types):
for doc_ids_chunk in chunked(doc_ids, 100):
keys = [[doc_type, doc_id]
for ... | import datetime
from corehq.util.couch import IterDB
from dimagi.utils.couch.database import iter_docs
from dimagi.utils.chunked import chunked
import logging
def filter_doc_ids_by_doc_type(db, doc_ids, doc_types):
for doc_ids_chunk in chunked(doc_ids, 100):
keys = [[doc_type, doc_id]
for ... | Python | 0 |
e71161e8a42bdb4643995dec186d945c49d292eb | fix pylint issues | unit_tests/lib/events_utils.py | unit_tests/lib/events_utils.py | # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be usefu... | # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be usefu... | Python | 0.000002 |
8c29892ab43faebc8ee18ece4beedabc13ca5a72 | Use optional return value for linenumber | lib/ansiblelint/rules/__init__.py | lib/ansiblelint/rules/__init__.py | """All internal ansible-lint rules."""
import re
from ansiblelint.skip_utils import get_rule_skips_from_line
from ansiblelint.skip_utils import append_skipped_rules
from ansiblelint.errors import Match
import ansiblelint.utils
class AnsibleLintRule(object):
def __repr__(self):
"""Return a AnsibleLintRule... | """All internal ansible-lint rules."""
import re
from ansiblelint.skip_utils import get_rule_skips_from_line
from ansiblelint.skip_utils import append_skipped_rules
from ansiblelint.errors import Match
import ansiblelint.utils
class AnsibleLintRule(object):
def __repr__(self):
"""Return a AnsibleLintRule... | Python | 0.000003 |
7ac27aa4d365d02d998c3f4c82bc740791a1b515 | Update script.py | HexChat/script.py | HexChat/script.py | from __future__ import print_function
import os
import sys
if sys.version_info[0] < 3:
import urllib as request
else:
import urllib.request as request
import hexchat
__module_name__ = 'Script'
__module_author__ = 'TingPing'
__module_version__ = '3'
__module_description__ = 'Download scripts'
script_help = 'Script: ... | from __future__ import print_function
import os
import sys
if sys.version_info[0] < 3:
import urllib as request
else:
import urllib.request as request
import hexchat
__module_name__ = 'Script'
__module_author__ = 'TingPing'
__module_version__ = '3'
__module_description__ = 'Download scripts'
script_help = 'Script: ... | Python | 0.000001 |
4a10ca9895b8cfd9996e9563494dfc8d5008a263 | Support reading a program from a file | bfinterpreter.py | bfinterpreter.py | #!/usr/bin/python3
class Tape:
def __init__(self):
self.cells = [0]
self.pointer = 0
def inc_val(self):
self.cells[self.pointer] += 1
def dec_val(self):
self.cells[self.pointer] -= 1
def move_right(self):
self.pointer += 1
if self.pointer == len(self.c... | #!/usr/bin/python3
class Tape:
def __init__(self):
self.cells = [0]
self.pointer = 0
def inc_val(self):
self.cells[self.pointer] += 1
def dec_val(self):
self.cells[self.pointer] -= 1
def move_right(self):
self.pointer += 1
if self.pointer == len(self.c... | Python | 0 |
6a899eeb5be7a8b49b45ff0fc0f490a5cad151bd | Add SourceGroup model | entity_event/models.py | entity_event/models.py | from django.db import models
class Medium(models.Model):
name = models.CharField(max_length=64, unique=True)
display_name = models.CharField(max_length=64)
description = models.TextField()
def __unicode__(self):
return self.display_name
class Source(models.Model):
name = models.CharFiel... | from django.db import models
class Medium(models.Model):
name = models.CharField(max_length=64, unique=True)
display_name = models.CharField(max_length=64)
description = models.TextField()
def __unicode__(self):
return self.display_name
class Source(models.Model):
name = models.CharFiel... | Python | 0 |
bcf4c6be490b96230877d9388c27783abdbc487e | Fix aibrake | lib/ansible/modules/extras/monitoring/airbrake_deployment.py | lib/ansible/modules/extras/monitoring/airbrake_deployment.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2013 Bruce Pennypacker <bruce@pennypacker.org>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version... | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2013 Bruce Pennypacker <bruce@pennypacker.org>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version... | Python | 0.00005 |
8cbce567c8dc6c78a48972f7918897056a99a854 | fix to_3d | gdsfactory/export/to_3d.py | gdsfactory/export/to_3d.py | from typing import Optional, Tuple
import shapely
from gdsfactory.component import Component
from gdsfactory.layers import LayerColors
from gdsfactory.pdk import get_layer_colors, get_layer_stack
from gdsfactory.tech import LayerStack
from gdsfactory.types import Layer
def to_3d(
component: Component,
layer... | from typing import Optional, Tuple
import shapely
from gdsfactory.component import Component
from gdsfactory.layers import LayerColors
from gdsfactory.pdk import get_layer_colors, get_layer_stack
from gdsfactory.tech import LayerStack
from gdsfactory.types import Layer
def to_3d(
component: Component,
layer... | Python | 0.00156 |
9621de820ccbdd12a42bb4e4ff2f228ed245ee2e | Set velocity to maximum Maxon EC45 velocity. | epos_control_server.py | epos_control_server.py | #!/usr/bin/python
import logging.config
import signal
import threading
from flask import Flask, send_from_directory
from flask.ext.socketio import SocketIO
from epos_lib_wrapper import EposLibWrapper
from position_fetcher import PositionFetcher
POSITION_MAX_DELTA_TO_END = 0
EPOS_RELATIVE_POSITION = 20000000
EPOS_V... | #!/usr/bin/python
import logging.config
import signal
import threading
from flask import Flask, send_from_directory
from flask.ext.socketio import SocketIO
from epos_lib_wrapper import EposLibWrapper
from position_fetcher import PositionFetcher
POSITION_MAX_DELTA_TO_END = 0
EPOS_RELATIVE_POSITION = 20000000
EPOS_V... | Python | 0 |
fe4c426fe6384b570bcc2a105bdf04f2f412a31f | Use Query.executQuery for filterCasts.py | InformationScripting/scripts/filterCasts.py | InformationScripting/scripts/filterCasts.py | # filterCasts
classUses = Query.executeQuery('ast -t=CastExpression|attribute -at=castType -input|uses -input -t=Class', [])
def hasTypeIdMethod( cl ):
for method in cl.methods:
if method.name == "typeIdStatic":
return True
return False
for tuple in classUses[0].tuples("uses"):
if has... | # filterCasts
casts = Query.ast(["-t=CastExpression"] + Query.args, [])
castTypeAttributes = Query.attribute(["-at=castType", "-s=of"], casts)
classUses = Query.uses(["-s=of", "-t=Class"], castTypeAttributes)
def hasTypeIdMethod( cl ):
for method in cl.methods:
if method.name == "typeIdStatic":
... | Python | 0 |
866f9cbe01e360872e0b7f55b00f2683adffaabc | Fix typo | ckanext/mapactiontheme/controllers/admin_controller.py | ckanext/mapactiontheme/controllers/admin_controller.py | from ckan.controllers.admin import AdminController
import ckan.lib.base as base
import ckan.lib.helpers as h
import ckan.model as model
import ckan.logic as logic
from ckan.lib.base import BaseController
from ckan.plugins.toolkit import c, request, _
from ckan.authz import has_user_permission_for_group_or_org
class C... | from ckan.controllers.admin import AdminController
import ckan.lib.base as base
import ckan.lib.helpers as h
import ckan.model as model
import ckan.logic as logic
from ckan.lib.base import BaseController
from ckan.plugins.toolkit import c, request, _
from ckan.authz import has_user_permission_for_group_or_org
class C... | Python | 0.999999 |
f5c94105f6652186e05ebe201f127a1c8b7bd94c | add script to download and save articles | newsplease/tests/downloadarticles.py | newsplease/tests/downloadarticles.py | import json
import os
name = 'trump-in-saudi-arabia.txt'
basepath = '/Users/felix/Downloads/'
download_dir = basepath + 'dir' + name + '/'
os.makedirs(download_dir)
articles = NewsPlease.download_from_file(basepath + name)
for url in articles:
article = articles[url]
with open(download_dir + article['filena... | import json
import os
name = 'trump-in-saudi-arabia.txt'
basepath = '/Users/felix/Downloads/'
download_dir = basepath + 'dir' + name + '/'
os.makedirs(download_dir)
articles = NewsPlease.download_from_file(basepath + name)
for url in articles:
article = articles[url]
with open(download_dir + article['filena... | Python | 0 |
f6686169cf7344e0c75c6d060332d3692fc7df1c | Update curation table format | bin/trait_mapping/create_table_for_manual_curation.py | bin/trait_mapping/create_table_for_manual_curation.py | #!/usr/bin/env python3
import argparse
from eva_cttv_pipeline.trait_mapping.ols import (
get_ontology_label_from_ols, is_current_and_in_efo, is_in_efo,
)
def find_previous_mapping(trait_name, previous_mappings):
if trait_name not in previous_mappings:
return ''
uri = previous_mappings[trait_name... | #!/usr/bin/env python3
import argparse
from eva_cttv_pipeline.trait_mapping.ols import (
get_ontology_label_from_ols, is_current_and_in_efo, is_in_efo,
)
def find_previous_mapping(trait_name, previous_mappings):
if trait_name not in previous_mappings:
return ''
uri = previous_mappings[trait_name... | Python | 0 |
620210707477e6496ab665ec7df8afaf2ba408aa | consolidate test version conditional boilerplate into assertion method | tests/test_codegen.py | tests/test_codegen.py | """
Part of the astor library for Python AST manipulation
License: 3-clause BSD
Copyright 2014 (c) Berker Peksag
"""
import ast
import sys
import textwrap
try:
import unittest2 as unittest
except ImportError:
import unittest
import astor
class CodegenTestCase(unittest.TestCase):
def assertAstSourceE... | """
Part of the astor library for Python AST manipulation
License: 3-clause BSD
Copyright 2014 (c) Berker Peksag
"""
import ast
import sys
import textwrap
try:
import unittest2 as unittest
except ImportError:
import unittest
import astor
class CodegenTestCase(unittest.TestCase):
def assertAstSourceE... | Python | 0.000024 |
c5902af643d639ecefa756a0caaeeb58a7c6d151 | Update P4_textToExcel working solution | books/AutomateTheBoringStuffWithPython/Chapter12/PracticeProjects/P4_textToExcel.py | books/AutomateTheBoringStuffWithPython/Chapter12/PracticeProjects/P4_textToExcel.py | # Write a program to read in the contents of several text files (you can make
# the text files yourself) and insert those contents into a spreadsheet, with
# one line of text per row. The lines of the first text file will be in the
# cells of column A, the lines of the second text file will be in the cells of
# column ... | # Write a program to read in the contents of several text files (you can make
# the text files yourself) and insert those contents into a spreadsheet, with
# one line of text per row. The lines of the first text file will be in the
# cells of column A, the lines of the second text file will be in the cells of
# column ... | Python | 0 |
7597497017053356cdfbebc38aa1468240df2e45 | fix the install to ./install requirements | fabfile/build.py | fabfile/build.py | from fabric.api import task, local, execute
import clean
__all__ = ['sdist', 'install', 'sphinx']
@task
def sdist():
"""create the sdist"""
execute(clean.all)
local("python setup.py sdist --format=bztar,zip")
@task
def install():
"""install cloudmesh"""
local("./install requirements.txt")
loc... | from fabric.api import task, local, execute
import clean
__all__ = ['req', 'sdist', 'install', 'sphinx']
@task
def req():
"""install the requirements"""
local("pip install -r requirements.txt")
@task
def sdist():
"""create the sdist"""
execute(clean.all)
local("python setup.py sdist --format=bzta... | Python | 0.000005 |
9646fb2b7f7f441c6630e04fa1e1af358f9c7d10 | Set version to 0.20 final | eulexistdb/__init__.py | eulexistdb/__init__.py | # file eulexistdb/__init__.py
#
# Copyright 2010,2011 Emory University Libraries
#
# 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
#... | # file eulexistdb/__init__.py
#
# Copyright 2010,2011 Emory University Libraries
#
# 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
#... | Python | 0.000037 |
14cb7c49d5b2e155e92c07ecd1e58dc386b0ddb3 | stop failing on exceptions--skip instead | parsing/parsinglib/jobcontainer.py | parsing/parsinglib/jobcontainer.py | from ..models import Job
import datetime
class JobContainer():
def __init__(self):
self.organization = None
self.title = None
self.division = None
self.date_posted = None
self.date_closing = None
self.date_collected = None
self.url_detail = None
sel... | from ..models import Job
import datetime
class JobContainer():
def __init__(self):
self.organization = None
self.title = None
self.division = None
self.date_posted = None
self.date_closing = None
self.date_collected = None
self.url_detail = None
self.... | Python | 0 |
f633df6bb8e0e84699db2f47178f4b402ccc07a8 | Fix `OverflowError`. | eventkit/utils/time.py | eventkit/utils/time.py | from datetime import datetime, timedelta
from timezone import timezone
ROUND_DOWN = 'ROUND_DOWN'
ROUND_NEAREST = 'ROUND_NEAREST'
ROUND_UP = 'ROUND_UP'
WEEKDAYS = {
'MON': 0,
'TUE': 1,
'WED': 2,
'THU': 3,
'FRI': 4,
'SAT': 5,
'SUN': 6,
}
MON = 'MON'
TUE = 'TUE'
WED = 'WED'
THU = 'THU'
FRI ... | from datetime import timedelta
from timezone import timezone
ROUND_DOWN = 'ROUND_DOWN'
ROUND_NEAREST = 'ROUND_NEAREST'
ROUND_UP = 'ROUND_UP'
WEEKDAYS = {
'MON': 0,
'TUE': 1,
'WED': 2,
'THU': 3,
'FRI': 4,
'SAT': 5,
'SUN': 6,
}
MON = 'MON'
TUE = 'TUE'
WED = 'WED'
THU = 'THU'
FRI = 'FRI'
SA... | Python | 0 |
09a6c3b5d860f8bbfafec9f5cdb4cef00cdae9c9 | Implement an additional test for handling exceptions in bake | tests/test_cookies.py | tests/test_cookies.py | # -*- coding: utf-8 -*-
import json
def test_help_message(testdir):
result = testdir.runpytest(
'--help',
)
# fnmatch_lines does an assertion internally
result.stdout.fnmatch_lines([
'cookies:',
'*--template=TEMPLATE*',
])
def test_cookies_fixture(testdir):
"""Make s... | # -*- coding: utf-8 -*-
import json
def test_help_message(testdir):
result = testdir.runpytest(
'--help',
)
# fnmatch_lines does an assertion internally
result.stdout.fnmatch_lines([
'cookies:',
'*--template=TEMPLATE*',
])
def test_cookies_fixture(testdir):
"""Make s... | Python | 0.000001 |
3b4de1be81c7951ca064ff46e1f3e1ed95436ae3 | fix XSS vulnerability | django_bootstrap_breadcrumbs/templatetags/django_bootstrap_breadcrumbs.py | django_bootstrap_breadcrumbs/templatetags/django_bootstrap_breadcrumbs.py | # -*- coding: utf-8 -*-
"""
:copyright: Copyright 2013 by Łukasz Mierzwa
:contact: l.mierzwa@gmail.com
"""
from inspect import ismethod
from django.core.urlresolvers import reverse, NoReverseMatch
from django.utils.html import escape
from django.utils.safestring import mark_safe
from django.utils.translation... | # -*- coding: utf-8 -*-
"""
:copyright: Copyright 2013 by Łukasz Mierzwa
:contact: l.mierzwa@gmail.com
"""
from inspect import ismethod
from django.core.urlresolvers import reverse, NoReverseMatch
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext as _
from django.db.... | Python | 0 |
41ea0dd8c48ef8a336422482e9bbd1911bb7e168 | Make that it works in 90% of the cases. 3:30. | Commitment.py | Commitment.py | import sublime
import sublime_plugin
import HTMLParser
from commit import Commitment
whatthecommit = 'http://whatthecommit.com/'
randomMessages = Commitment()
class CommitmentToClipboardCommand(sublime_plugin.WindowCommand):
def run(self):
commit = randomMessages.get()
message = HTMLParser.HTMLParser()... | import sublime
import sublime_plugin
from commit import Commitment
whatthecommit = 'http://whatthecommit.com/'
randomMessages = Commitment()
class CommitmentToClipboardCommand(sublime_plugin.WindowCommand):
def run(self):
commit = randomMessages.get()
message = commit.get('message', '')
message_ha... | Python | 0.999808 |
81c32c9bc0868f7ccd764d8432fd46ccb7e6a8ef | Use get instead | paystackapi/tests/test_transfer.py | paystackapi/tests/test_transfer.py | import httpretty
from paystackapi.tests.base_test_case import BaseTestCase
from paystackapi.transfer import Transfer
class TestTransfer(BaseTestCase):
@httpretty.activate
def test_initiate(self):
"""Method defined to test transfer initiation."""
httpretty.register_uri(
httpretty.... | import httpretty
from paystackapi.tests.base_test_case import BaseTestCase
from paystackapi.transfer import Transfer
class TestTransfer(BaseTestCase):
@httpretty.activate
def test_initiate(self):
"""Method defined to test transfer initiation."""
httpretty.register_uri(
httpretty.... | Python | 0 |
9a425bae3af8cca7ad8be938d7f698ef65f42f3a | Update load_groups_pipeline.py (#210) | google/cloud/security/inventory/pipelines/load_groups_pipeline.py | google/cloud/security/inventory/pipelines/load_groups_pipeline.py | # Copyright 2017 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, s... | # Copyright 2017 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, s... | Python | 0 |
cc3ca68df357572767280bdddf332cfd430e9203 | Enhance the test to avoid celery internal queues in rabbitmq status. | oneflow/base/utils/stats/rabbitmq.py | oneflow/base/utils/stats/rabbitmq.py | # -*- coding: utf-8 -*-
u"""
Copyright 2012-2014 Olivier Cortès <oc@1flow.io>.
This file is part of the 1flow project.
1flow 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... | # -*- coding: utf-8 -*-
u"""
Copyright 2012-2014 Olivier Cortès <oc@1flow.io>.
This file is part of the 1flow project.
1flow 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... | Python | 0 |
d9001013a070176756f49166552b7dbb5fb6aeb0 | Fix plugin rendering in tests | tests/test_plugins.py | tests/test_plugins.py | # -*- coding: utf-8 -*-
import pytest
from cms.api import add_plugin
from cms.models import Placeholder
from cms.plugin_rendering import ContentRenderer
from cmsplugin_articles_ai.cms_plugins import ArticleList, TagFilterArticleList, TagList
from cmsplugin_articles_ai.factories import PublicArticleFactory, TagFactory
... | # -*- coding: utf-8 -*-
import pytest
from cms.api import add_plugin
from cms.models import Placeholder
from cmsplugin_articles_ai.cms_plugins import ArticleList, TagFilterArticleList, TagList
from cmsplugin_articles_ai.factories import PublicArticleFactory, TagFactory
def create_articles(amount):
for _ in range(... | Python | 0 |
dba62be0d8b87a66b415460a07f453536209b08e | change user api prefix to user/ from users/ | dubdubdub/api_urls.py | dubdubdub/api_urls.py | from django.conf.urls import patterns, url
from django.views.decorators.cache import cache_page
from schools.api_views import SchoolsList, SchoolsInfo, SchoolInfo, Districts, \
SchoolsDiseInfo, SchoolDemographics, SchoolProgrammes, SchoolFinance, \
Blocks, Clusters, BlocksInsideDistrict, ClustersInsideDistrict... | from django.conf.urls import patterns, url
from django.views.decorators.cache import cache_page
from schools.api_views import SchoolsList, SchoolsInfo, SchoolInfo, Districts, \
SchoolsDiseInfo, SchoolDemographics, SchoolProgrammes, SchoolFinance, \
Blocks, Clusters, BlocksInsideDistrict, ClustersInsideDistrict... | Python | 0 |
88d56e2857f09223175e9f845aebb496c143d08b | check for gl errors in sampler tests | tests/test_sampler.py | tests/test_sampler.py | import unittest
import moderngl
from common import get_context
def checkerror(func):
def wrapper(*args, **kwargs):
_ = get_context().error
func(*args, **kwargs)
err = get_context().error
assert err == 'GL_NO_ERROR', "Error: %s" % err
return wrapper
class TestCase(unittest.Te... | import unittest
import moderngl
from common import get_context
class TestCase(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.ctx = get_context()
def test_attributes(self):
sampler = self.ctx.sampler()
# Default values
self.assertEqual(sampler.anisotropy, 1.0... | Python | 0 |
aeb2aaa106d7b37e0c9a3fc8a71364d79b00346d | Remove some debugging output from a migration | uk_results/migrations/0030_populate_postresult_post_election.py | uk_results/migrations/0030_populate_postresult_post_election.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from collections import defaultdict
from django.db import migrations, models
def set_post_election_from_post(apps, schema_editor):
"""
This is far from ideal. Try to guess the PostExtraElection
that this PostResult relates to. This will have... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from collections import defaultdict
from django.db import migrations, models
def set_post_election_from_post(apps, schema_editor):
"""
This is far from ideal. Try to guess the PostExtraElection
that this PostResult relates to. This will have... | Python | 0.000004 |
8fd65190a2a68a7afeab91b0a02c83309f72ccd6 | Add tests to gen_test for generator, seems to work | tests/test_testing.py | tests/test_testing.py |
import greenado
from greenado.testing import gen_test
from tornado.testing import AsyncTestCase
from tornado import gen
@gen.coroutine
def coroutine():
raise gen.Return(1234)
class GreenadoTests(AsyncTestCase):
@gen_test
def test_without_timeout1(self):
assert greenado.gyield(coroutine())... |
import greenado
from greenado.testing import gen_test
from tornado.testing import AsyncTestCase
from tornado import gen
@gen.coroutine
def coroutine():
raise gen.Return(1234)
class GreenadoTests(AsyncTestCase):
@gen_test
def test_without_timeout(self):
assert greenado.gyield(coroutine()) ... | Python | 0 |
0d313502b8b5d850109b48cde8d3dea2dae0d802 | Clean up __init__.py . | vcr/__init__.py | vcr/__init__.py | import logging
from .config import VCR
# Set default logging handler to avoid "No handler found" warnings.
try: # Python 2.7+
from logging import NullHandler
except ImportError:
class NullHandler(logging.Handler):
def emit(self, record):
pass
logging.getLogger(__name__).addHandler(NullHa... | import logging
from .config import VCR
# Set default logging handler to avoid "No handler found" warnings.
import logging
try: # Python 2.7+
from logging import NullHandler
except ImportError:
class NullHandler(logging.Handler):
def emit(self, record):
pass
logging.getLogger(__name__).add... | Python | 0.000021 |
0a2937311d4c319d5233b0a92073a7a3d57d9452 | remove commented out code. Also fix up indents and other violations | common/lib/xmodule/xmodule/modulestore/xml_exporter.py | common/lib/xmodule/xmodule/modulestore/xml_exporter.py | import logging
from xmodule.modulestore import Location
from xmodule.modulestore.inheritance import own_metadata
from fs.osfs import OSFS
from json import dumps
def export_to_xml(modulestore, contentstore, course_location, root_dir, course_dir, draft_modulestore=None):
course = modulestore.get_item(course_locati... | import logging
from xmodule.modulestore import Location
from xmodule.modulestore.django import modulestore
from xmodule.modulestore.inheritance import own_metadata
from fs.osfs import OSFS
from json import dumps
def export_to_xml(modulestore, contentstore, course_location, root_dir, course_dir, draft_modulestore = No... | Python | 0 |
e353bae122c6e55da022d73c42d7eee09a558b44 | clean code | bin/visual_dl.py | bin/visual_dl.py | """ entry point of visual_dl
"""
import json
import os
import sys
from optparse import OptionParser
from flask import Flask, redirect
from flask import send_from_directory
from visualdl.log import logger
app = Flask(__name__, static_url_path="")
def option_parser():
"""
:return:
"""
parser = Optio... | """ entry point of visual_dl
"""
import json
import os
import sys
from optparse import OptionParser
from flask import Flask, redirect
from flask import send_from_directory
from visualdl.log import logger
app = Flask(__name__, static_url_path="")
def option_parser():
"""
:return:
"""
parser = Optio... | Python | 0.000008 |
3c72aa1266f1008552a3979ac057251bf2f93053 | Bump tensorflow in /training/xgboost/structured/base (#212) | training/xgboost/structured/base/setup.py | training/xgboost/structured/base/setup.py | #!/usr/bin/env python
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | #!/usr/bin/env python
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | Python | 0.000545 |
0ec3bfbd91e6e967bb2baae0307e76aafbb5aa91 | Simplify the base types | blackjax/base.py | blackjax/base.py | from typing import NamedTuple, Tuple
from typing_extensions import Protocol
from .types import PRNGKey, PyTree
Position = PyTree
State = NamedTuple
Info = NamedTuple
class InitFn(Protocol):
"""A `Callable` used to initialize the kernel state.
Sampling algorithms often need to carry over some informations ... | from typing import Callable, NamedTuple, Tuple
from typing_extensions import Protocol
from .types import PRNGKey, PyTree
Position = PyTree
State = NamedTuple
Info = NamedTuple
class InitFn(Protocol):
"""A `Callable` used to initialize the kernel state.
Sampling algorithms often need to carry over some inf... | Python | 0.002563 |
f1b22cfcca8470a59a7bab261bbd2a46a7c2a2ed | Fix unicode issues at url translation | socib_cms/cmsutils/utils.py | socib_cms/cmsutils/utils.py | # coding: utf-8
import re
from django.core.urlresolvers import reverse
from django.conf import settings
def reverse_no_i18n(viewname, *args, **kwargs):
result = reverse(viewname, *args, **kwargs)
m = re.match(r'(/[^/]*)(/.*$)', result)
return m.groups()[1]
def change_url_language(url, language):
if ... | # coding: utf-8
import re
from django.core.urlresolvers import reverse
from django.conf import settings
def reverse_no_i18n(viewname, *args, **kwargs):
result = reverse(viewname, *args, **kwargs)
m = re.match(r'(/[^/]*)(/.*$)', result)
return m.groups()[1]
def change_url_language(url, language):
if ... | Python | 0.00022 |
d15c2107f4132b53fb77622748753bb9f3c2916f | Update messenger.py | bot/messenger.py | bot/messenger.py | # -*- coding: utf-8 -*-
import logging
import random
import sys
reload(sys)
sys.setdefaultencoding('utf8')
logger = logging.getLogger(__name__)
class Messenger(object):
def __init__(self, slack_clients):
self.clients = slack_clients
def send_message(self, channel_id, msg):
# in the case... | # -*- coding: utf-8 -*-
import logging
import random
import sys
reload(sys)
sys.setdefaultencoding('utf8')
logger = logging.getLogger(__name__)
class Messenger(object):
def __init__(self, slack_clients):
self.clients = slack_clients
def send_message(self, channel_id, msg):
# in the case... | Python | 0.000001 |
dd9843c97c9e15c2522034a6f5333f68714cd031 | copy with original content type | filer/storage.py | filer/storage.py | #-*- coding: utf-8 -*-
import urllib.request, urllib.parse, urllib.error
from django.core.files.storage import FileSystemStorage
from django.utils.encoding import smart_str
try:
from storages.backends.s3boto import S3BotoStorage
except ImportError:
from storages.backends.s3boto3 import S3Boto3Storage as S3Bot... | #-*- coding: utf-8 -*-
import urllib.request, urllib.parse, urllib.error
from django.core.files.storage import FileSystemStorage
from django.utils.encoding import smart_str
try:
from storages.backends.s3boto import S3BotoStorage
except ImportError:
from storages.backends.s3boto3 import S3Boto3Storage as S3Bot... | Python | 0 |
19b77442ee3cc80d8c7eaee6bde6c87d6a9e9277 | Test a fix for the wheel test | tests/integration/modules/saltutil.py | tests/integration/modules/saltutil.py | # -*- coding: utf-8 -*-
'''
Integration tests for the saltutil module.
'''
# Import Python libs
from __future__ import absolute_import
import time
# Import Salt Testing libs
from salttesting.helpers import ensure_in_syspath
ensure_in_syspath('../../')
# Import Salt libs
import integration
class SaltUtilModuleTest... | # -*- coding: utf-8 -*-
'''
Integration tests for the saltutil module.
'''
# Import Python libs
from __future__ import absolute_import
# Import Salt Testing libs
from salttesting.helpers import ensure_in_syspath
ensure_in_syspath('../../')
# Import Salt libs
import integration
class SaltUtilModuleTest(integration... | Python | 0 |
40d2de6f25a4081dac3d809c9d0b8d20478cf92c | Tidy test settings and introduce django-nose | wagtailmenus/tests/settings.py | wagtailmenus/tests/settings.py | import os
import hashlib
from django.conf.global_settings import * # NOQA
DEBUG = True
SITE_ID = 1
DATABASES = {
'default': {
'NAME': 'wagtailmenus_test.sqlite',
'TEST_NAME': 'wagtailmenus_test_test.sqlite',
'ENGINE': 'django.db.backends.sqlite3',
}
}
TIME_ZONE = 'Europe/London'
USE_... | import os
import hashlib
from django.conf.global_settings import * # NOQA
DEBUG = True
SITE_ID = 1
DATABASES = {
'default': {
'NAME': 'wagtailmenus.sqlite',
'TEST_NAME': 'wagtailmenus_test.sqlite',
'ENGINE': 'django.db.backends.sqlite3',
}
}
TIME_ZONE = 'Europe/London'
USE_TZ = True
... | Python | 0 |
b359d71a3c13720257167c57959a18b7a5ce9d07 | Fix Python package version checking | gravity/tilt/tilt_tests.py | gravity/tilt/tilt_tests.py | import os, subprocess, sys
import pkg_resources
from packaging import version
# This function is used ot check if an apt package is installed on Raspbian, Ubuntu, Debian, etc.
def apt_package_installed(package_name: str) -> bool:
devnull = open(os.devnull,"w")
retval = subprocess.call(["dpkg", "-s", package_n... | import os, subprocess, sys
import pkg_resources
from packaging import version
# This function is used ot check if an apt package is installed on Raspbian, Ubuntu, Debian, etc.
def apt_package_installed(package_name: str) -> bool:
devnull = open(os.devnull,"w")
retval = subprocess.call(["dpkg", "-s", package_n... | Python | 0.000026 |
4338b097f97bb03be27c81a810a5fc652f842c8a | change cnab processor selection to method" | l10n_br_account_payment_brcobranca/models/account_payment_mode.py | l10n_br_account_payment_brcobranca/models/account_payment_mode.py | # Copyright (C) 2012-Today - KMEE (<http://kmee.com.br>).
# @author Luis Felipe Miléo - mileo@kmee.com.br
# @author Renato Lima - renato.lima@akretion.com.br
# Copyright (C) 2021-Today - Akretion (<http://www.akretion.com>).
# @author Magno Costa <magno.costa@akretion.com.br>
# License AGPL-3.0 or later (http://www.g... | # Copyright (C) 2012-Today - KMEE (<http://kmee.com.br>).
# @author Luis Felipe Miléo - mileo@kmee.com.br
# @author Renato Lima - renato.lima@akretion.com.br
# Copyright (C) 2021-Today - Akretion (<http://www.akretion.com>).
# @author Magno Costa <magno.costa@akretion.com.br>
# License AGPL-3.0 or later (http://www.g... | Python | 0 |
0bbd10058ff58ca5160e74374c0b34f99c429ad8 | Update docstrings | openpathsampling/high_level/part_in_b_tps.py | openpathsampling/high_level/part_in_b_tps.py | from openpathsampling.high_level.network import FixedLengthTPSNetwork
from openpathsampling.high_level.transition import FixedLengthTPSTransition
import openpathsampling as paths
class PartInBFixedLengthTPSTransition(FixedLengthTPSTransition):
"""Fixed length TPS transition accepting any frame in the final state.
... | from openpathsampling.high_level.network import FixedLengthTPSNetwork
from openpathsampling.high_level.transition import FixedLengthTPSTransition
import openpathsampling as paths
class PartInBFixedLengthTPSTransition(FixedLengthTPSTransition):
"""Fixed length TPS transition accepting any frame in the final state.
... | Python | 0.000001 |
03fe3aad7358ee4593b9e8909d5374bae9e58b34 | revert changes | denumerator/denumerator.py | denumerator/denumerator.py | #!/usr/bin/python
#pylint: disable=invalid-name
"""
--- dENUMerator ---
by bl4de | bloorq@gmail.com | Twitter: @_bl4de | HackerOne: bl4de
Enumerates list of subdomains (output from tools like Sublist3r or subbrute)
and creates output file with servers responding on port 80/HTTP
This indicates (in most caes) working ... | #!/usr/bin/python
# pylint: disable=invalid-name
"""
--- dENUMerator ---
by bl4de | bloorq@gmail.com | Twitter: @_bl4de | HackerOne: bl4de
Enumerates list of subdomains (output from tools like Sublist3r or subbrute)
and creates output file with servers responding on port 80/HTTP
This indicates (in most caes) working... | Python | 0 |
5c0a19386894e36898a48e7f10f01008e284e0c9 | Update dependency bazelbuild/bazel to latest version | third_party/bazel.bzl | third_party/bazel.bzl | # Copyright 2019 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 2019 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.000066 |
05a2189224589ac84b14240bf96b110d7c531dfb | add missing parent class inherit | vimball/base.py | vimball/base.py | import bz2
import errno
import gzip
import lzma
import os
import re
import tempfile
def mkdir_p(path):
"""Create potentially nested directories as required.
Does nothing if the path already exists and is a directory.
"""
try:
os.makedirs(path)
except OSError as e:
if e.errno == er... | import bz2
import errno
import gzip
import lzma
import os
import re
import tempfile
def mkdir_p(path):
"""Create potentially nested directories as required.
Does nothing if the path already exists and is a directory.
"""
try:
os.makedirs(path)
except OSError as e:
if e.errno == er... | Python | 0.000029 |
24f5afff6b8e65c633521189f4ac6bf4fbacbdb7 | Fix datapusher.wsgi to work with ckan-service-provider 0.0.2 | deployment/datapusher.wsgi | deployment/datapusher.wsgi | import os
import sys
import hashlib
activate_this = os.path.join('/usr/lib/ckan/datapusher/bin/activate_this.py')
execfile(activate_this, dict(__file__=activate_this))
import ckanserviceprovider.web as web
import datapusher.jobs as jobs
os.environ['JOB_CONFIG'] = '/etc/ckan/datapusher_settings.py'
web.init()
applica... | import os
import sys
import hashlib
activate_this = os.path.join('/usr/lib/ckan/datapusher/bin/activate_this.py')
execfile(activate_this, dict(__file__=activate_this))
import ckanserviceprovider.web as web
import datapusher.jobs as jobs
os.environ['JOB_CONFIG'] = '/etc/ckan/datapusher_settings.py'
web.configure()
ap... | Python | 0.000002 |
efb420ddc6aa0052ecea6da84613da6e4cf1afc8 | Update Bazel to latest version | third_party/bazel.bzl | third_party/bazel.bzl | # Copyright 2019 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 2019 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 |
0bfa8373f82f801b34e7609f4ff6f28ab280a635 | Change mnist.py to follow the latest spec | example/mnist/mnist.py | example/mnist/mnist.py | #!/usr/bin/env python
"""Chainer example: train a multi-layer perceptron on MNIST
This is a minimal example to write a feed-forward net. It requires scikit-learn
to load MNIST dataset.
"""
import numpy as np
import six
import chainer
from chainer import cuda, FunctionSet
import chainer.functions as F
from chainer i... | #!/usr/bin/env python
"""Chainer example: train a multi-layer perceptron on MNIST
This is a minimal example to write a feed-forward net. It requires scikit-learn
to load MNIST dataset.
"""
import numpy as np
import six
import chainer
from chainer import cuda, FunctionSet
import chainer.functions as F
from chainer i... | Python | 0 |
8959d982ddc810f9c226ce36884521cf979a61f1 | add destroy cb | gui/tests/testicontheme.py | gui/tests/testicontheme.py | #!/usr/bin/env python
# doesnt work. segfault.
# TODO: other screens?
import pygtk
pygtk.require("2.0")
import gtk
import xfce4
widget = xfce4.gui.IconTheme(gtk.gdk.screen_get_default())
ic = widget.load("folder", 24)
print ic
icname = widget.lookup("folder", 24)
print icname
image = gtk.Image()
image.set_from_pixbuf... | #!/usr/bin/env python
# doesnt work. segfault.
# TODO: other screens?
import pygtk
pygtk.require("2.0")
import gtk
import xfce4
widget = xfce4.gui.IconTheme(gtk.gdk.screen_get_default())
ic = widget.load("folder", 24)
print ic
icname = widget.lookup("folder", 24)
print icname
image = gtk.Image()
image.set_from_pixbuf... | Python | 0 |
23c8044b84557dea940d527213022bfa19d28293 | test that Human is in Ensembl species | tests/test_ensembl_species_service.py | tests/test_ensembl_species_service.py | #
# Author : Manuel Bernal Llinares
# Project : trackhub-creator
# Timestamp : 04-07-2017 09:14
# ---
# © 2017 Manuel Bernal Llinares <mbdebian@gmail.com>
# All rights reserved.
#
"""
Unit Tests for Ensembl Species Service
"""
import unittest
# App modules
import ensembl.service
class TestEnsemblSpeciesServi... | #
# Author : Manuel Bernal Llinares
# Project : trackhub-creator
# Timestamp : 04-07-2017 09:14
# ---
# © 2017 Manuel Bernal Llinares <mbdebian@gmail.com>
# All rights reserved.
#
"""
Unit Tests for Ensembl Species Service
"""
import unittest
# App modules
import ensembl.service
class TestEnsemblSpeciesServi... | Python | 0.999977 |
d977a9ee9814264bd1d3080cadcd7e43b7c1d27e | Revert changes | examples/News/news2.py | examples/News/news2.py | #!/usr/bin/env python
from Kiwi2 import Delegates
from Kiwi2.Widgets.List import List, Column
from Kiwi2.initgtk import gtk
class NewsItem:
"""An instance that holds information about a news article."""
def __init__(self, title, author, url):
self.title, self.author, self.url = title, author, url
# As... | #!/usr/bin/env python
from Kiwi2 import Delegates
from Kiwi2.Widgets.List import List, Column
from Kiwi2.initgtk import gtk
class NewsItem:
"""An instance that holds information about a news article."""
def __init__(self, title, author, url):
self.title, self.author, self.url = title, author, url
# As... | Python | 0.000001 |
7c91d556220088ea5286611f3674aaa88f3a6340 | Add failing test for "Crash if session was flushed before commit (with validity strategy)" | tests/test_exotic_operation_combos.py | tests/test_exotic_operation_combos.py | from six import PY3
from tests import TestCase
class TestExoticOperationCombos(TestCase):
def test_insert_deleted_object(self):
article = self.Article()
article.name = u'Some article'
article.content = u'Some content'
self.session.add(article)
self.session.commit()
... | from six import PY3
from tests import TestCase
class TestExoticOperationCombos(TestCase):
def test_insert_deleted_object(self):
article = self.Article()
article.name = u'Some article'
article.content = u'Some content'
self.session.add(article)
self.session.commit()
... | Python | 0 |
e816b1f63c299141c6ad907c860d2c5411829405 | Simplify aggregator code | aleph/analysis/aggregate.py | aleph/analysis/aggregate.py | import logging
from collections import defaultdict
from followthemoney.types import registry
from aleph.analysis.util import tag_key
from aleph.analysis.util import TAG_COUNTRY, TAG_PHONE
from aleph.analysis.util import TAG_PERSON, TAG_COMPANY
log = logging.getLogger(__name__)
class TagAggregator(object):
MAX_T... | import logging
from Levenshtein import setmedian
from aleph.analysis.util import tag_key
from aleph.analysis.util import TAG_COUNTRY, TAG_LANGUAGE, TAG_PHONE
from aleph.analysis.util import TAG_PERSON, TAG_COMPANY
log = logging.getLogger(__name__)
class TagAggregator(object):
MAX_TAGS = 10000
CUTOFFS = {
... | Python | 0.000073 |
30f55607990a356f49c03f04a707aa7d59a8eedf | Remove unncessary extra parens | examples/chatserver.py | examples/chatserver.py | #!/usr/bin/env python
"""Chat Server Example
This example demonstrates how to create a very simple telnet-style chat
server that supports many connecting clients.
"""
from optparse import OptionParser
from circuits import Component, Debugger
from circuits.net.sockets import TCPServer, Write
__version__ = "0.0.1"
... | #!/usr/bin/env python
"""Chat Server Example
This example demonstrates how to create a very simple telnet-style chat
server that supports many connecting clients.
"""
from optparse import OptionParser
from circuits import Component, Debugger
from circuits.net.sockets import TCPServer, Write
__version__ = "0.0.1"
... | Python | 0.000004 |
8c6ebf17541e48e6d4fdd9d521a4391ce621f301 | Use getNextSchedule in ScheduleDao | broadcast_api.py | broadcast_api.py | from mysql import mysql
from mysql import DB_Exception
from datetime import date
from datetime import datetime
from datetime import timedelta
import os.path
import json
#The API load schedule.txt and find out the first image which has not print and the time limit still allow
def load_schedule():
try:
ret... | from mysql import mysql
from mysql import DB_Exception
from datetime import date
from datetime import datetime
from datetime import timedelta
import os.path
import json
#The API load schedule.txt and find out the first image which has not print and the time limit still allow
def load_schedule():
try:
ret... | Python | 0 |
4d75e9e17830ab5ca03c4cc73eefc7b17a43e810 | Make CNN tagger example work with GPU | examples/cnn_tagger.py | examples/cnn_tagger.py | from __future__ import print_function
from timeit import default_timer as timer
import plac
import numpy
from thinc.neural.id2vec import Embed
from thinc.neural.vec2vec import Model, ReLu, Softmax
from thinc.neural._classes.convolution import ExtractWindow
from thinc.neural._classes.maxout import Maxout
from thinc.neu... | from __future__ import print_function
from timeit import default_timer as timer
import plac
from thinc.neural.id2vec import Embed
from thinc.neural.vec2vec import Model, ReLu, Softmax
from thinc.neural._classes.convolution import ExtractWindow
from thinc.neural._classes.maxout import Maxout
from thinc.loss import cat... | Python | 0.000002 |
ca06a55d096eb4c67bf70c479107128b73087ab9 | integrate update | w1_integrate.py | w1_integrate.py | from sympy import integrate, symbols, log
# if 0 <= x < 0.25:
# return float(0)
# elif 0.25 <= x < 0.5:
# return 16.0 * (x - 0.25)
# elif 0.5 <= x < 0.75:
# return -16.0 * (x - 0.75)
# elif 0.75 < x <= 1:
# return float(0)
# h(f) = integrate(-f(x)lnf(x), (x, 0, 1))
x = symbols('x')
left =... | from sympy import integrate, symbols, log
# if 0 <= x < 0.25:
# return float(0)
# elif 0.25 <= x < 0.5:
# return 16.0 * (x - 0.25)
# elif 0.5 <= x < 0.75:
# return -16.0 * (x - 0.75)
# elif 0.75 < x <= 1:
# return float(0)
# h(f) = integrate(-f(x)lnf(x), (x, 0, 1))
x = symbols('x')
left = integrate(-1... | Python | 0 |
f2bcbddab48eff06df78faff1ebb47c28adb4e0d | fix schema test | altair/tests/test_schema.py | altair/tests/test_schema.py | from altair.schema import load_schema
def test_schema():
schema = load_schema()
assert schema["$schema"]=="http://json-schema.org/draft-04/schema#"
| from altair.schema import SCHEMA
def test_schema():
assert SCHEMA["$schema"]=="http://json-schema.org/draft-04/schema#"
| Python | 0.000001 |
48f4c8dba40cb2fe03a74a7a4d7d979892601ddc | use __file__ to determine library path | tests/context.py | tests/context.py | # -*- coding: utf-8 -*-
import sys
import os
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import sample
| # -*- coding: utf-8 -*-
import sys
import os
sys.path.insert(0, os.path.abspath('..'))
import sample | Python | 0.000002 |
24b2dd2f84a2a9ece9a9a4f7898c6f29233c19bc | Add message to welcome accepted students. | app/soc/modules/gsoc/models/program.py | app/soc/modules/gsoc/models/program.py | # Copyright 2009 the Melange 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 wr... | # Copyright 2009 the Melange 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 wr... | Python | 0 |
3c3013b8e7de5e1f8ae57e1d4a8b672cab8f6c47 | Test helpers : Message box, click yes vs enter | tests/helpers.py | tests/helpers.py | from PyQt5.QtWidgets import QApplication, QMessageBox, QDialog, QFileDialog
from PyQt5.QtCore import Qt
from PyQt5.QtTest import QTest
def click_on_top_message_box():
topWidgets = QApplication.topLevelWidgets()
for w in topWidgets:
if isinstance(w, QMessageBox):
QTest.mouseClick(w.button(Q... | from PyQt5.QtWidgets import QApplication, QMessageBox, QDialog, QFileDialog
from PyQt5.QtCore import Qt
from PyQt5.QtTest import QTest
def click_on_top_message_box():
topWidgets = QApplication.topLevelWidgets()
for w in topWidgets:
if isinstance(w, QMessageBox):
QTest.keyClick(w, Qt.Key_En... | Python | 0 |
1ab939ed7da45e7f6ff113b7e71017b28ee877a2 | Use 'with' keyword while opening file in tests/helpers.py | tests/helpers.py | tests/helpers.py | import razorpay
import os
import unittest
def mock_file(filename):
if not filename:
return ''
file_dir = os.path.dirname(__file__)
file_path = "{}/mocks/{}.json".format(file_dir, filename)
with open(file_path) as f:
mock_file_data = f.read()
return mock_file_data
class ClientTest... | import razorpay
import os
import unittest
def mock_file(filename):
if not filename:
return ''
file_dir = os.path.dirname(__file__)
file_path = "{}/mocks/{}.json".format(file_dir, filename)
return open(file_path).read()
class ClientTestCase(unittest.TestCase):
def setUp(self):
sel... | Python | 0.000002 |
9f069cf4fe634f34ccda29c18c03c63db04fe199 | Update Funcaptcha example | examples/funcaptcha.py | examples/funcaptcha.py | from urllib.parse import urlparse
import requests
from os import environ
import re
from random import choice
from python_anticaptcha import AnticaptchaClient, FunCaptchaTask
api_key = environ['KEY']
site_key_pattern = 'data-pkey="(.+?)"'
url = 'https://www.funcaptcha.com/demo/'
client = AnticaptchaClient(api_key)
se... | import requests
from os import environ
import re
from random import choice
from python_anticaptcha import AnticaptchaClient, FunCaptchaTask, Proxy
api_key = environ['KEY']
site_key_pattern = 'data-pkey="(.+?)"'
url = 'https://www.funcaptcha.com/demo/'
client = AnticaptchaClient(api_key)
session = requests.Session()
... | Python | 0 |
d3583108eca98f72b9b4898a5cc5e9cf1cacf251 | Fix log_invocation test on python2 with hash randomization | test/units/module_utils/basic/test__log_invocation.py | test/units/module_utils/basic/test__log_invocation.py | # -*- coding: utf-8 -*-
# (c) 2016, James Cammarata <jimi@sngx.net>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your o... | # -*- coding: utf-8 -*-
# (c) 2016, James Cammarata <jimi@sngx.net>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your o... | Python | 0.000002 |
d2fb1f22be6c6434873f2bcafb6b8a9b714acde9 | Use fail signal in fail_archive_on_error decorator | website/archiver/decorators.py | website/archiver/decorators.py | import functools
from framework.exceptions import HTTPError
from website.project.decorators import _inject_nodes
from website.archiver import ARCHIVER_UNCAUGHT_ERROR
from website.archiver import signals
def fail_archive_on_error(func):
@functools.wraps(func)
def wrapped(*args, **kwargs):
try:
... | import functools
from framework.exceptions import HTTPError
from website.project.decorators import _inject_nodes
from website.archiver import ARCHIVER_UNCAUGHT_ERROR
from website.archiver import utils
def fail_archive_on_error(func):
@functools.wraps(func)
def wrapped(*args, **kwargs):
try:
... | Python | 0.000001 |
3caa77b0f4b43e274eba21a8d759335f7833b99d | Change OSF_COOKIE_DOMAIN to None in local-dist.py | website/settings/local-dist.py | website/settings/local-dist.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.
'''
from . import defaults
DEV_MODE = True
DEBUG_MODE = True # Sets app to debug mode, turns off template caching, etc.
SEARCH_ENGINE = 'elas... | # -*- 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.
'''
from . import defaults
DEV_MODE = True
DEBUG_MODE = True # Sets app to debug mode, turns off template caching, etc.
SEARCH_ENGINE = 'elas... | Python | 0 |
22ae3a2e9a236de61c078d234d920a3e6bc62d7b | Add a bit of docs | pylisp/application/lispd/address_tree/ddt_container_node.py | pylisp/application/lispd/address_tree/ddt_container_node.py | '''
Created on 1 jun. 2013
@author: sander
'''
from .container_node import ContainerNode
class DDTContainerNode(ContainerNode):
'''
A ContainerNode that indicates that we are responsible for this part of
the DDT tree.
'''
| '''
Created on 1 jun. 2013
@author: sander
'''
from .container_node import ContainerNode
class DDTContainerNode(ContainerNode):
pass
| Python | 0.000004 |
8acaec546de0311f5f33c2e8fb9e1828a1cbc44b | Fix memory leak caused by using rabbit as the result backend for celery | worker_manager/celeryconfig.py | worker_manager/celeryconfig.py | """
Configuration file for celerybeat/worker.
Dynamically adds consumers from all manifest files in worker_manager/manifests/
to the celerybeat schedule. Also adds a heartbeat function to the schedule,
which adds every 30 seconds, and a monthly task to normalize all non-normalized
documents.
"""
f... | """
Configuration file for celerybeat/worker.
Dynamically adds consumers from all manifest files in worker_manager/manifests/
to the celerybeat schedule. Also adds a heartbeat function to the schedule,
which adds every 30 seconds, and a monthly task to normalize all non-normalized
documents.
"""
f... | Python | 0.000004 |
16806f7a620ddaba727fc6c7d6387eaa1c17f103 | Update p4-test-tool.py | benchexec/tools/p4-test-tool.py | benchexec/tools/p4-test-tool.py | # This file is part of BenchExec, a framework for reliable benchmarking:
# https://github.com/sosy-lab/benchexec
#
# SPDX-FileCopyrightText: 2007-2020 Dirk Beyer <https://www.sosy-lab.org>
#
# SPDX-License-Identifier: Apache-2.0
import benchexec.util as util
import benchexec.tools.template
import benchexec.result as r... | # This file is part of BenchExec, a framework for reliable benchmarking:
# https://github.com/sosy-lab/benchexec
#
# SPDX-FileCopyrightText: 2007-2020 Dirk Beyer <https://www.sosy-lab.org>
#
# SPDX-License-Identifier: Apache-2.0
import benchexec.util as util
import benchexec.tools.template
import benchexec.result as r... | Python | 0.000001 |
b9d30a39f31862af607af44e97878a287f9361c5 | bump to v0.5.3 | steam/__init__.py | steam/__init__.py | __version__ = "0.5.3"
__author__ = "Rossen Georgiev"
from steam.steamid import SteamID
from steam.webapi import WebAPI
| __version__ = "0.5.2"
__author__ = "Rossen Georgiev"
from steam.steamid import SteamID
from steam.webapi import WebAPI
| Python | 0.000001 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.