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 |
|---|---|---|---|---|---|---|---|
9c7dda9f55369109831eb53f4ed1da5fe82cfc7b | Fix test for observation_aggregator | tests/chainermn_tests/extensions_tests/test_observation_aggregator.py | tests/chainermn_tests/extensions_tests/test_observation_aggregator.py | import unittest
import numpy as np
import chainer
import chainer.testing
from chainer.training import extension
import chainermn
from chainermn.extensions.observation_aggregator import observation_aggregator
class DummyChain(chainer.Chain):
def __init__(self):
super(DummyChain, self).__init__()
de... | import unittest
import numpy as np
import chainer
import chainer.testing
from chainer.training import extension
import chainermn
from chainermn.extensions.observation_aggregator import observation_aggregator
class DummyChain(chainer.Chain):
def __init__(self):
super(DummyChain, self).__init__()
de... | Python | 0.000002 |
88be8370e6ede34cb01240a6621923b1ddea370f | remove retval before starting the completion service job if it exists | studio/completion_service/completion_service_client.py | studio/completion_service/completion_service_client.py | import importlib
import shutil
import pickle
import os
import sys
import six
from studio import fs_tracker, model, logs
logger = logs.getLogger('completion_service_client')
try:
logger.setLevel(model.parse_verbosity(sys.argv[1]))
except BaseException:
logger.setLevel(10)
def main():
logger.debug('copyin... | import importlib
import shutil
import pickle
import os
import sys
import six
from studio import fs_tracker, model, logs
logger = logs.getLogger('completion_service_client')
try:
logger.setLevel(model.parse_verbosity(sys.argv[1]))
except BaseException:
logger.setLevel(10)
def main():
logger.debug('copyin... | Python | 0 |
c3a251588868ace81e8e4e0bbe29828495d759d9 | fix command line arguments | ThingThree/Code/Dotstar/strandtest.py | ThingThree/Code/Dotstar/strandtest.py | #!/usr/bin/python
import time, math, sys
from dotstar import Adafruit_DotStar
numPixels = 24
dataPin = 17
clockPin = 27
strip = Adafruit_DotStar(numPixels, dataPin, clockPin)
strip.begin()
strip.setBrightness(255)
def scale(color, brightness):
str_hex = hex(color)[2:].zfill(6)
r,g,b = (int(str_hex[2*x:2*x... | #!/usr/bin/python
import time, math, sys
from dotstar import Adafruit_DotStar
numPixels = 24
dataPin = 17
clockPin = 27
strip = Adafruit_DotStar(numPixels, dataPin, clockPin)
strip.begin()
strip.setBrightness(255)
def scale(color, brightness):
str_hex = hex(color)[2:].zfill(6)
r,g,b = (int(str_hex[2*x:2*x... | Python | 0.000803 |
a171595f029b43af27d14a125e68647e2206c6d5 | Update __init__.py | tendrl/commons/objects/node_alert_counters/__init__.py | tendrl/commons/objects/node_alert_counters/__init__.py | from tendrl.commons import objects
class NodeAlertCounters(objects.BaseObject):
def __init__(
self,
warn_count=0,
node_id=None,
*args,
**kwargs
):
super(NodeAlertCounters, self).__init__(*args, **kwargs)
self.warning_count = warn_count
self.node_... | from tendrl.commons import objects
class NodeAlertCounters(objects.BaseObject):
def __init__(
self,
warn_count=0,
node_id=None,
*args,
**kwargs
):
super(NodeAlertCounters, self).__init__(*args, **kwargs)
self.warning_count = warn_count
self.node_... | Python | 0.000072 |
dd7e0d18a15195cf67af44af8c15918a5cf068e4 | add header information | douban_book_api.py | douban_book_api.py | from douban_client.api.error import DoubanAPIError
import requests
import simplejson
from douban_client import DoubanClient
__author__ = 'owen2785'
baseurl = 'https://api.douban.com/v2/book/isbn/'
def getbyisbn_without_auth(isbn):
r = requests.get(baseurl+str(isbn),headers=headers)
print r.headers
print... | from douban_client.api.error import DoubanAPIError
import requests
import simplejson
from douban_client import DoubanClient
__author__ = 'owen2785'
baseurl = 'https://api.douban.com/v2/book/isbn/'
def getbyisbn_without_auth(isbn):
r = requests.get(baseurl+str(isbn))
return r.json() | Python | 0 |
396ab20874a0c3492482a8ae03fd7d61980917a5 | Update closest match adapter docstring. | chatterbot/adapters/logic/closest_match.py | chatterbot/adapters/logic/closest_match.py | # -*- coding: utf-8 -*-
from fuzzywuzzy import fuzz
from .base_match import BaseMatchAdapter
class ClosestMatchAdapter(BaseMatchAdapter):
"""
The ClosestMatchAdapter logic adapter selects a known response
to an input by searching for a known statement that most closely
matches the input based on the L... | # -*- coding: utf-8 -*-
from fuzzywuzzy import fuzz
from .base_match import BaseMatchAdapter
class ClosestMatchAdapter(BaseMatchAdapter):
"""
The ClosestMatchAdapter logic adapter creates a response by
using fuzzywuzzy's process class to extract the most similar
response to the input. This adapter s... | Python | 0 |
2947fe97d466872de05ada289d9172f41895969c | Update GOV.UK Frontend/Jinja lib test | tests/templates/components/test_radios_with_images.py | tests/templates/components/test_radios_with_images.py | import json
from importlib import metadata
from packaging.version import Version
def test_govuk_frontend_jinja_overrides_on_design_system_v3():
with open("package.json") as package_file:
package_json = json.load(package_file)
govuk_frontend_version = Version(package_json["dependencies"]["govuk-fr... | import json
def test_govuk_frontend_jinja_overrides_on_design_system_v3():
with open("package.json") as package_file:
package_json = json.load(package_file)
assert package_json["dependencies"]["govuk-frontend"].startswith("3."), (
"After upgrading the Design System, manually validate that "
... | Python | 0 |
f4a80c720d0164eb8a942e3ad1b5244d30800e5a | Add --allow-nacl-socket-api for the chromoting functional test. | chrome/test/functional/chromoting_basic.py | chrome/test/functional/chromoting_basic.py | #!/usr/bin/env python
# Copyright (c) 2012 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 pyauto_functional # Must come before chromoting and pyauto.
import chromoting
import pyauto
class ChromotingBa... | #!/usr/bin/env python
# Copyright (c) 2012 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 pyauto_functional # Must come before chromoting and pyauto.
import chromoting
import pyauto
class ChromotingBa... | Python | 0.000047 |
0b366a3f4c23b644f885ed649edc577242ae90ee | Fix genreflex rootmap files to not contain stray spaces after "string" Corrsponds to v5-22-00-patches r27408 | cint/reflex/python/genreflex/genrootmap.py | cint/reflex/python/genreflex/genrootmap.py | # Copyright CERN, CH-1211 Geneva 23, 2004-2006, All rights reserved.
#
# Permission to use, copy, modify, and distribute this software for any
# purpose is hereby granted without fee, provided that this copyright and
# permissions notice appear in all copies and derivatives.
#
# This software is provided "as is" withou... | # Copyright CERN, CH-1211 Geneva 23, 2004-2006, All rights reserved.
#
# Permission to use, copy, modify, and distribute this software for any
# purpose is hereby granted without fee, provided that this copyright and
# permissions notice appear in all copies and derivatives.
#
# This software is provided "as is" withou... | Python | 0.000014 |
b2e6a7a8df1ede0118838ce494e1679eea0eb578 | Decrease cert expiration alerting threshold from 2 years to 1 year. (#1002) | scripts/check-bundled-ca-certs-expirations.py | scripts/check-bundled-ca-certs-expirations.py | #!/usr/bin/env python
# Copyright 2014-2020 Scalyr 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 ... | #!/usr/bin/env python
# Copyright 2014-2020 Scalyr 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 ... | Python | 0.000007 |
686f0e21de510a12ee3d6af410448eb405d3e7b6 | add 1.4.0 release and 1.5 stable branch (#16261) | var/spack/repos/builtin/packages/libunwind/package.py | var/spack/repos/builtin/packages/libunwind/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 Libunwind(AutotoolsPackage):
"""A portable and efficient C programming interface (API) to ... | # 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 Libunwind(AutotoolsPackage):
"""A portable and efficient C programming interface (API) to ... | Python | 0 |
1be539f68019435b2d09b1a46e4786a09e59edf2 | Allow for multiple SEPA payment methods with different versions (#493) (#496) | account_banking_pain_base/models/account_payment_method.py | account_banking_pain_base/models/account_payment_method.py | # -*- coding: utf-8 -*-
# © 2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import models, fields, api, _
from odoo.exceptions import UserError
class AccountPaymentMethod(models.Model):
_inherit = 'account.payment.meth... | # -*- coding: utf-8 -*-
# © 2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import models, fields, api, _
from odoo.exceptions import UserError
class AccountPaymentMethod(models.Model):
_inherit = 'account.payment.meth... | Python | 0 |
4697bb9bb7a3708f1c35b795c02db329d3142703 | Add script to collect metrics in samples of a case into a single vector | src/rgbd_benchmark_tools/h5_collectSamples.py | src/rgbd_benchmark_tools/h5_collectSamples.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 17 09:02:31 2015
@author: jesus
"""
import argparse
import numpy as np
import h5py
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='''
This script collects the metrics and results from several samples of an experiment ... | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 17 09:02:31 2015
@author: jesus
"""
import argparse
import numpy as np
import h5py
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='''
This script collects the metrics and results from several samples of an experiment ... | Python | 0 |
0f295d0ee8c29361bd4f80dbc947da65dd7fbbe6 | move raindrops | Exercism/python/raindrops/raindrops.py | Exercism/python/raindrops/raindrops.py | def convert(number):
raindrops = ((3, "Pling"), (5, "Plang"), (7, "Plong"))
raindrop_result = [raindrop[1] for raindrop in raindrops if number % raindrop[0] == 0]
return "".join(raindrop_result) or str(number) | raindrops = ((3, "Pling"), (5, "Plang"), (7, "Plong"))
def convert(number):
raindrop_result = [raindrop[1] for raindrop in raindrops if number % raindrop[0] == 0]
return "".join(raindrop_result) or str(number) | Python | 0.000759 |
15ae458f7cf1a8257967b2b3b0ceb812547c4766 | Test more edge cases of the highlighting parser | IPython/utils/tests/test_pycolorize.py | IPython/utils/tests/test_pycolorize.py | # coding: utf-8
"""Test suite for our color utilities.
Authors
-------
* Min RK
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2011 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING.txt, d... | """Test suite for our color utilities.
Authors
-------
* Min RK
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2011 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING.txt, distributed as pa... | Python | 0 |
2fd6a6a2ae61b6babbe873e4278984920d1d6cd1 | update plots for the temporal noise experiment | projects/sequence_prediction/discrete_sequences/plotNoiseExperiment.py | projects/sequence_prediction/discrete_sequences/plotNoiseExperiment.py | #!/usr/bin/env python
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2015, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions ... | #!/usr/bin/env python
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2015, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions ... | Python | 0 |
1eee9dfa6f7ea359f0dc4d0bf7450b3c96d3731d | Remove unnecessary var | reunition/apps/reunions/management/commands/setalumniusersfromrsvps.py | reunition/apps/reunions/management/commands/setalumniusersfromrsvps.py | from django.core.management.base import NoArgsCommand
from django.db.models.fields import related
from reunition.apps.alumni import models as alumni_m
from reunition.apps.reunions import models as reunions_m
class Command(NoArgsCommand):
help = 'Associate reunions.Rsvp.created_by to alumni.Person.user when not ... | from django.core.management.base import NoArgsCommand
from django.db.models.fields import related
from reunition.apps.alumni import models as alumni_m
from reunition.apps.reunions import models as reunions_m
class Command(NoArgsCommand):
help = 'Associate reunions.Rsvp.created_by to alumni.Person.user when not ... | Python | 0.000007 |
5fc54a2120fbc9151073c9b247e3fd7e8e79a9fa | Remove premature attribute from migration script (Fixes #283) | src/adhocracy/migration/versions/054_add_hierachical_categorybadges.py | src/adhocracy/migration/versions/054_add_hierachical_categorybadges.py | from datetime import datetime
from sqlalchemy import Column, ForeignKey, MetaData, Table
from sqlalchemy import Boolean, Integer, DateTime, String, Unicode, LargeBinary
metadata = MetaData()
#table to update
badge_table = Table(
'badge', metadata,
#common attributes
Column('id', Integer, primary_key=True)... | from datetime import datetime
from sqlalchemy import Column, ForeignKey, MetaData, Table
from sqlalchemy import Boolean, Integer, DateTime, String, Unicode, LargeBinary
metadata = MetaData()
#table to update
badge_table = Table(
'badge', metadata,
#common attributes
Column('id', Integer, primary_key=True)... | Python | 0 |
a1bf5aaf3866eea7370c1a401a5e3d5791f97539 | Add exception for inline encoded images. | better_figures_and_images/better_figures_and_images.py | better_figures_and_images/better_figures_and_images.py | """
Better Figures & Images
------------------------
This plugin:
- Adds a style="width: ???px; height: auto;" to each image in the content
- Also adds the width of the contained image to any parent div.figures.
- If RESPONSIVE_IMAGES == True, also adds style="max-width: 100%;"
- Corrects alt text: if alt == imag... | """
Better Figures & Images
------------------------
This plugin:
- Adds a style="width: ???px; height: auto;" to each image in the content
- Also adds the width of the contained image to any parent div.figures.
- If RESPONSIVE_IMAGES == True, also adds style="max-width: 100%;"
- Corrects alt text: if alt == imag... | Python | 0 |
b06687b1e78645a055a314be4b1af693e2c3be05 | remove obsolete arguments | RatS/filmaffinity/filmaffinity_site.py | RatS/filmaffinity/filmaffinity_site.py | import time
from RatS.base.base_site import Site
from selenium.webdriver.common.by import By
class FilmAffinity(Site):
def __init__(self, args):
login_form_selector = "//form[@id='login-form']"
self.LOGIN_USERNAME_SELECTOR = login_form_selector + "//input[@name='username']"
self.LOGIN_PAS... | import time
from RatS.base.base_site import Site
from selenium.webdriver.common.by import By
class FilmAffinity(Site):
def __init__(self, args):
login_form_selector = "//form[@id='login-form']"
self.LOGIN_USERNAME_SELECTOR = login_form_selector + "//input[@name='username']"
self.LOGIN_PAS... | Python | 0.005914 |
cd17eba08cbb898b1cf6d0bb622315d851b4eeec | The main parameter object is a list | ocradmin/ocr/tools/manager.py | ocradmin/ocr/tools/manager.py | """
Plugin manager.
"""
import os
import sys
class PluginManager(object):
"""
Class for managing OCR tool plugins.
"""
def __init__(self):
pass
@classmethod
def get_plugins(cls):
"""
List available OCR plugins.
"""
engines = []
plugdir = os.pa... | """
Plugin manager.
"""
import os
import sys
class PluginManager(object):
"""
Class for managing OCR tool plugins.
"""
def __init__(self):
pass
@classmethod
def get_plugins(cls):
"""
List available OCR plugins.
"""
engines = []
plugdir = os.pa... | Python | 0.999856 |
c79c3b7f920f4bcf5fb69cf74b224e6ff37a709b | test triggering travis | fabre_test.py | fabre_test.py | #!/usr/bin/env python
# coding=UTF-8
import pytest
import sys
# content of test_assert1.py
def f():
return 3
def test_function():
assert f() == 4
test_function()
| #!/usr/bin/env python
# coding=UTF-8
import pytest
import sys
sys.exit(0)
| Python | 0.000001 |
0fb800cd42f1545e8d5e744af1ff81922c930448 | Add Google analytics ID | pelicanconf.py | pelicanconf.py | #!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
from datetime import datetime
import os
import sys
BASE_DIR = os.path.dirname(__file__)
# Clone the official plugin repo to the `official_plugins` dir
# (https://github.com/getpelican/pelican-plugins)
sys.path.append(os.path.join(... | #!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
from datetime import datetime
import os
import sys
BASE_DIR = os.path.dirname(__file__)
# Clone the official plugin repo to the `official_plugins` dir
# (https://github.com/getpelican/pelican-plugins)
sys.path.append(os.path.join(... | Python | 0.000002 |
6a1176d547694b535bc581d5a0af87230d533caf | set to version 3.305.533 | base/pythonvideoannotator/pythonvideoannotator/__init__.py | base/pythonvideoannotator/pythonvideoannotator/__init__.py | # !/usr/bin/python3
# -*- coding: utf-8 -*-
__version__ = "3.305.533"
__author__ = ["Ricardo Ribeiro", "Carlos Mao de Ferro", "Hugo Cachitas"]
__credits__ = ["Ricardo Ribeiro", "Carlos Mao de Ferro", "Hugo Cachitas"]
__license__ = "Attribution-NonCommercial-ShareAlike 4.0 International"
__maintainer__ = ["Ricardo... | # !/usr/bin/python3
# -*- coding: utf-8 -*-
__version__ = "3.305.532"
__author__ = ["Ricardo Ribeiro", "Carlos Mao de Ferro", "Hugo Cachitas"]
__credits__ = ["Ricardo Ribeiro", "Carlos Mao de Ferro", "Hugo Cachitas"]
__license__ = "Attribution-NonCommercial-ShareAlike 4.0 International"
__maintainer__ = ["Ricardo... | Python | 0.000001 |
4af80f4a72618482135f388c3bc424fa12e1ccc4 | refactor filter structure | shot_detector/filters/dsl/dsl_filter_mixin.py | shot_detector/filters/dsl/dsl_filter_mixin.py | # -*- coding: utf8 -*-
"""
This is part of shot detector.
Produced by w495 at 2017.05.04 04:18:27
"""
from __future__ import absolute_import, division, print_function
import collections
import logging
from shot_detector.utils.dsl import BaseDslOperatorMixin
from shot_detector.utils.dsl.dsl_kwargs import dsl_... | # -*- coding: utf8 -*-
"""
This is part of shot detector.
Produced by w495 at 2017.05.04 04:18:27
"""
from __future__ import absolute_import, division, print_function
import collections
import logging
from shot_detector.utils.dsl import BaseDslOperatorMixin
from shot_detector.utils.dsl.dsl_kwargs import dsl_... | Python | 0.000001 |
d82c37a85e3522f7cf7e26a220eb5946aec66ffe | Create docs from numpy | test/test_data_utils.py | test/test_data_utils.py | import numpy as np
from cStringIO import StringIO
from nose.tools import raises
from microscopes.lda import utils
def test_docs_from_document_term_matrix():
dtm = [[2, 1], [3, 2]]
docs = [[0, 0, 1], [0, 0, 0, 1, 1]]
assert utils.docs_from_document_term_matrix(dtm) == docs
def test_docs_from_numpy_dtp()... | from cStringIO import StringIO
from nose.tools import raises
from microscopes.lda import utils
def test_docs_from_document_term_matrix():
dtm = [[2, 1], [3, 2]]
docs = [[0, 0, 1], [0, 0, 0, 1, 1]]
assert utils.docs_from_document_term_matrix(dtm) == docs
def test_docs_from_ldac_simple():
stream = Str... | Python | 0 |
4cc3fe30e676c31cc6af9cb3a75de10b47ff2adc | Add % to date format | door/views.py | door/views.py | from django.shortcuts import render
from django.http import HttpResponse
from .models import DoorStatus, OpenData
from django.views.decorators.csrf import csrf_exempt
from django.utils import timezone
from website import settings
from datetime import datetime
import json
# Create your views here.
@csrf_exempt
def doo... | from django.shortcuts import render
from django.http import HttpResponse
from .models import DoorStatus, OpenData
from django.views.decorators.csrf import csrf_exempt
from django.utils import timezone
from website import settings
from datetime import datetime
import json
# Create your views here.
@csrf_exempt
def doo... | Python | 0.000007 |
36ed44e94916d6abe3458645c957dd9715cbc532 | set STATIC_ROOT | myproj/myproj/settings.py | myproj/myproj/settings.py | """
Django settings for myproj project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
imp... | """
Django settings for myproj project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
imp... | Python | 0.000008 |
566ceb81a14685c201f3c92668dc0530a1a91176 | fix path | organization/projects/management/commands/project_inject_content.py | organization/projects/management/commands/project_inject_content.py | # -*- coding: utf-8 -*-
#
# Copyright (c) 2016-2017 Ircam
# Copyright (c) 2016-2017 Guillaume Pellerin
# Copyright (c) 2016-2017 Emilie Zawadzki
# This file is part of mezzanine-organization.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public L... | # -*- coding: utf-8 -*-
#
# Copyright (c) 2016-2017 Ircam
# Copyright (c) 2016-2017 Guillaume Pellerin
# Copyright (c) 2016-2017 Emilie Zawadzki
# This file is part of mezzanine-organization.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public L... | Python | 0.000001 |
70004e7caf332e55d40b4f1f757138c4cd35a3fe | fix path | organization/projects/management/commands/project_inject_content.py | organization/projects/management/commands/project_inject_content.py | # -*- coding: utf-8 -*-
#
# Copyright (c) 2016-2017 Ircam
# Copyright (c) 2016-2017 Guillaume Pellerin
# Copyright (c) 2016-2017 Emilie Zawadzki
# This file is part of mezzanine-organization.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public L... | # -*- coding: utf-8 -*-
#
# Copyright (c) 2016-2017 Ircam
# Copyright (c) 2016-2017 Guillaume Pellerin
# Copyright (c) 2016-2017 Emilie Zawadzki
# This file is part of mezzanine-organization.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public L... | Python | 0.000001 |
2e4ec0fea35722fbdbab36ce326e664249e3eaf7 | Add support jinja2 | nacho/controllers/base.py | nacho/controllers/base.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from tornado.web import RequestHandler
from jinja2 import Environment, FileSystemLoader, TemplateNotFound
class ApplicationController(RequestHandler):
def render(self, template_name, **kwargs):
kwargs.update({
'settings': self.settings,
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from cyclone.web import RequestHandler
class ApplicationController(RequestHandler):
pass
| Python | 0 |
7f3a93dea0eb683bf2d35110fbe921b88646c579 | debug spacy init time | nalaf/features/parsing.py | nalaf/features/parsing.py | from textblob import TextBlob
from textblob.en.taggers import NLTKTagger
from textblob.en.np_extractors import FastNPExtractor
from nalaf.features import FeatureGenerator
from spacy.en import English
from nalaf import print_debug
#import time
class SpacyPosTagger(FeatureGenerator):
"""
POS-tag a dataset using ... | from textblob import TextBlob
from textblob.en.taggers import NLTKTagger
from textblob.en.np_extractors import FastNPExtractor
from nalaf.features import FeatureGenerator
from spacy.en import English
#import time
class SpacyPosTagger(FeatureGenerator):
"""
POS-tag a dataset using the Spacy Pos Tagger
"""
... | Python | 0 |
beec55986440c5c7a4afdd556c743dd0d6bc3aa9 | fix citation in random_expand | chainercv/transforms/image/random_expand.py | chainercv/transforms/image/random_expand.py | import numpy as np
import random
def random_expand(img, max_ratio=4, fill=0, return_param=False):
"""Expand an image randomly.
This method randomly place the input image on a larger canvas. The size of
the canvas is :math:`(rW, rH)`, where :math:`(W, H)` is the size of the
input image and :math:`r` i... | import numpy as np
import random
def random_expand(img, max_ratio=4, fill=0, return_param=False):
"""Expand an image randomly.
This method randomly place the input image on a larger canvas. The size of
the canvas is :math:`(rW, rH)`, where :math:`(W, H)` is the size of the
input image and :math:`r` i... | Python | 0.001224 |
45c86ade944d9afe7bc8e627e25fa861489cd4b6 | fix a typo so that email is sent to the correct host | crate_project/settings/production/gondor.py | crate_project/settings/production/gondor.py | import os
from .base import *
from local_settings import * # Instance specific settings (in deploy.settings_[INSTANCE_NAME]))
# Fix Email Settings
SERVER_EMAIL = "server@crate.io"
DEFAULT_FROM_EMAIL = "support@crate.io"
CACHES = {
"default": {
"BACKEND": "redis_cache.RedisCache",
"LOCATION": ":... | import os
from .base import *
from local_settings import * # Instance specific settings (in deploy.settings_[INSTANCE_NAME]))
# Fix Email Settings
SERVER_EMAIL = "server@crate.io"
DEFAULT_FROM_EMAIL = "support@crate.io"
CACHES = {
"default": {
"BACKEND": "redis_cache.RedisCache",
"LOCATION": ":... | Python | 0.999541 |
490ff333d7410f284be36ec938146dc3f36aa7dc | Change ordering of subreddits | main/gen_features.py | main/gen_features.py | __author__ = 'sharvey'
import multiprocessing
from corpus.mysql.reddit import RedditMySQLCorpus
from feature import ngram
from feature import lexical
import cred
import pprint
import re
def gen_feature(atuple):
text = re.sub(r'https?://([a-zA-Z0-9\.\-_]+)[\w\-\._~:/\?#@!\$&\'\*\+,;=%%]*',
'\\1... | __author__ = 'sharvey'
import multiprocessing
from corpus.mysql.reddit import RedditMySQLCorpus
from feature import ngram
from feature import lexical
import cred
import pprint
import re
def gen_feature(atuple):
text = re.sub(r'https?://([a-zA-Z0-9\.\-_]+)[\w\-\._~:/\?#@!\$&\'\*\+,;=%%]*',
'\\1... | Python | 0.000002 |
b3bfc6e3949fcca58cbf84232432c966f5f5d8c6 | fix indentation | analyzer/darwin/lib/dtrace/apicalls.py | analyzer/darwin/lib/dtrace/apicalls.py | #!/usr/bin/env python
# Copyright (C) 2015 Dmitry Rodionov
# This file is part of my GSoC'15 project for Cuckoo Sandbox:
# http://www.cuckoosandbox.org
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE file for details.
import os
import json
from common import *
from... | #!/usr/bin/env python
# Copyright (C) 2015 Dmitry Rodionov
# This file is part of my GSoC'15 project for Cuckoo Sandbox:
# http://www.cuckoosandbox.org
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE file for details.
import os
import json
from common import *
from... | Python | 0.000005 |
2a1407b34187cfba6c968a7b95e58ec1c115a8f6 | Print functions | datacommons/examples/population_analysis.py | datacommons/examples/population_analysis.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, ... | # 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, ... | Python | 0.00001 |
d74b15485a0756ac1702fafd640f616f022b3f58 | bump verions | equals/__init__.py | equals/__init__.py | from __future__ import absolute_import
__version__ = '0.0.21'
import numbers
import collections
from equals.equals import Equals as instance_of
from equals.constraints.anything_true import AnythingTrue
from equals.constraints.anything_false import AnythingFalse
anything = instance_of()
try:
any_string = instanc... | from __future__ import absolute_import
__version__ = '0.0.2'
import numbers
import collections
from equals.equals import Equals as instance_of
from equals.constraints.anything_true import AnythingTrue
from equals.constraints.anything_false import AnythingFalse
anything = instance_of()
try:
any_string = instance... | Python | 0.000001 |
9c2d1e9e841014dbc986b6e509b19f7f881969c4 | Fix silly typo | openspending/lib/csvexport.py | openspending/lib/csvexport.py | import csv
import sys
from datetime import datetime
from openspending import model
from openspending.mongo import DBRef, ObjectId
def write_csv(entries, response):
response.content_type = 'text/csv'
# NOTE: this should be a streaming service but currently
# I see no way to know the full set of keys with... | import csv
import sys
from datetime import datetime
from openspending import model
from openspending.mongo import DBRef, ObjectId
def write_csv(entries, response):
response.content_type = 'text/csv'
# NOTE: this should be a streaming service but currently
# I see no way to know the full set of keys with... | Python | 0.999999 |
ab35f508375c760770884882acaea79079a1a976 | remove unnesecary print | erlang/__init__.py | erlang/__init__.py | from __future__ import division
def extended_b_lines(usage, blocking):
'''
Uses the Extended Erlang B formula to calcluate the ideal number of lines
for the given usage in erlangs and the given blocking rate.
Usage:
extended_b_lines(usage, blocking)
'''
line_count = 1
while extended_b(usage, line_count) > b... | from __future__ import division
def extended_b_lines(usage, blocking):
'''
Uses the Extended Erlang B formula to calcluate the ideal number of lines
for the given usage in erlangs and the given blocking rate.
Usage:
extended_b_lines(usage, blocking)
'''
line_count = 1
while extended_b(usage, line_count) > b... | Python | 0.999922 |
c40a07e4ba1bfefd977bc9eea71abe5fcaf97370 | Use custom exception in place of NotImplemented | manifestos/twitter.py | manifestos/twitter.py | import re
from django.conf import settings
import tweepy
TWITTER_CONSUMER_KEY = settings.TWITTER_CONSUMER_KEY
TWITTER_CONSUMER_SECRET = settings.TWITTER_CONSUMER_SECRET
TWITTER_ACCESS_KEY = settings.TWITTER_ACCESS_KEY
TWITTER_ACCESS_SECRET = settings.TWITTER_ACCESS_SECRET
class TwitterBotException(Exception):
p... | import re
from django.conf import settings
import tweepy
TWITTER_CONSUMER_KEY = settings.TWITTER_CONSUMER_KEY
TWITTER_CONSUMER_SECRET = settings.TWITTER_CONSUMER_SECRET
TWITTER_ACCESS_KEY = settings.TWITTER_ACCESS_KEY
TWITTER_ACCESS_SECRET = settings.TWITTER_ACCESS_SECRET
class TwitterBot(object):
"""
Creat... | Python | 0.000001 |
4b4b689463c0e6d0db783a10fcf74b21fea60a68 | Fix double repr. | pygments/formatters/other.py | pygments/formatters/other.py | # -*- coding: utf-8 -*-
"""
pygments.formatters.other
~~~~~~~~~~~~~~~~~~~~~~~~~
Other formatters: NullFormatter, RawTokenFormatter.
:copyright: 2006 by Georg Brandl, Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
from pygments.formatter import Formatter
__all__ = ['NullFormatt... | # -*- coding: utf-8 -*-
"""
pygments.formatters.other
~~~~~~~~~~~~~~~~~~~~~~~~~
Other formatters: NullFormatter, RawTokenFormatter.
:copyright: 2006 by Georg Brandl, Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
from pygments.formatter import Formatter
__all__ = ['NullFormatt... | Python | 0.000001 |
2a7aee189dff539fe3cf8049319a2b09c6a0fbb1 | add new filter to dataset config | pysaliency/dataset_config.py | pysaliency/dataset_config.py | from .datasets import read_hdf5
from .filter_datasets import (
filter_fixations_by_number,
filter_stimuli_by_number,
filter_stimuli_by_size,
train_split,
validation_split,
test_split
)
from schema import Schema, Optional
dataset_config_schema = Schema({
'stimuli': str,
'fixations': st... | from .datasets import read_hdf5
from .filter_datasets import filter_fixations_by_number, filter_stimuli_by_number, train_split, validation_split, test_split
from schema import Schema, Optional
dataset_config_schema = Schema({
'stimuli': str,
'fixations': str,
Optional('filters', default=[]): [{
'... | Python | 0 |
46e21ff57d47f1860d639972dc4eed1994a6cd50 | remove print statements | scholars/authentication/pipeline.py | scholars/authentication/pipeline.py | import hashlib
from social_core.exceptions import AuthAlreadyAssociated, AuthException
def auto_logout(*args, **kwargs):
"""Do not compare current user with new one"""
return {'user': None}
def check_email_present(backend, uid, user=None, *args, **kwargs):
if not kwargs['details'].get('email'):
... | import hashlib
from social_core.exceptions import AuthAlreadyAssociated, AuthException
def auto_logout(*args, **kwargs):
"""Do not compare current user with new one"""
return {'user': None}
def check_email_present(backend, uid, user=None, *args, **kwargs):
if not kwargs['details'].get('email'):
... | Python | 0.999999 |
28917935e5086ff6a03964babbb5c2e09957b582 | Bump version | pytablewriter/__version__.py | pytablewriter/__version__.py | # encoding: utf-8
from datetime import datetime
__author__ = "Tsuyoshi Hombashi"
__copyright__ = "Copyright 2016-{}, {}".format(datetime.now().year, __author__)
__license__ = "MIT License"
__version__ = "0.47.0"
__maintainer__ = __author__
__email__ = "tsuyoshi.hombashi@gmail.com"
| # encoding: utf-8
from datetime import datetime
__author__ = "Tsuyoshi Hombashi"
__copyright__ = "Copyright 2016-{}, {}".format(datetime.now().year, __author__)
__license__ = "MIT License"
__version__ = "0.46.3"
__maintainer__ = __author__
__email__ = "tsuyoshi.hombashi@gmail.com"
| Python | 0 |
a1d88ff0da34300f0417a9c4679d65b6d38f8bd6 | 修复#64,task无法删除的bug | app/controller/backend/TasksController.py | app/controller/backend/TasksController.py | #!/usr/bin/env python2
# coding: utf-8
# file: TasksController.py
import datetime
from flask import redirect, render_template, request, jsonify
from sqlalchemy.exc import SQLAlchemyError
from . import ADMIN_URL
from app import web, db
from app.CommonClass.ValidateClass import ValidateClass, login_required
from app.m... | #!/usr/bin/env python2
# coding: utf-8
# file: TasksController.py
import datetime
from flask import redirect, render_template, request, jsonify
from . import ADMIN_URL
from app import web, db
from app.CommonClass.ValidateClass import ValidateClass
from app.models import CobraTaskInfo
from utils import config
__auth... | Python | 0 |
f5b8b4bafabc06504e2ee2e0571f2d8571db17bb | Update for v1.5.4 | maxminddb/__init__.py | maxminddb/__init__.py | # pylint:disable=C0111
import os
import maxminddb.reader
try:
import maxminddb.extension
except ImportError:
maxminddb.extension = None
from maxminddb.const import (
MODE_AUTO,
MODE_MMAP,
MODE_MMAP_EXT,
MODE_FILE,
MODE_MEMORY,
MODE_FD,
)
from maxminddb.decoder import InvalidDatabaseEr... | # pylint:disable=C0111
import os
import maxminddb.reader
try:
import maxminddb.extension
except ImportError:
maxminddb.extension = None
from maxminddb.const import (
MODE_AUTO,
MODE_MMAP,
MODE_MMAP_EXT,
MODE_FILE,
MODE_MEMORY,
MODE_FD,
)
from maxminddb.decoder import InvalidDatabaseEr... | Python | 0 |
5f9da62f28e61636f33495058f3ea4a98a9d3c19 | add invalid separators to test | tests/inside_worker_test/cast_to_float_or_null_test.py | tests/inside_worker_test/cast_to_float_or_null_test.py | import pytest
import sqlalchemy
from tests.inside_worker_test.conftest import slow
@pytest.fixture(params=[2, 2.2, 3.898986, 0.6, 0])
def valid_float_representation(request):
return request.param
@pytest.fixture(params=["a2", "10b", "3.898986c", "3d.898986", "e6.9", "f0,9" "0,g9" "0,9h", "0,6", "123'456", "1 2... | import pytest
import sqlalchemy
from tests.inside_worker_test.conftest import slow
@pytest.fixture(params=[2, 2.2, 3.898986, "3.898986", "6", "0.2", 0.6])
def valid_float_representation(request):
return request.param
@pytest.fixture(params=["a2", "10b", "3.898986k", "3k.898986", "l6.9"])
def invalid_floats(req... | Python | 0.000002 |
b3e1b6bd9f79427142ebfe4b57892d1cf3a89e86 | Implement the latest test spec for update which requires most of the parameters found in an example usage of mlab-ns against npad. | mlab-ns-simulator/mlabsim/update.py | mlab-ns-simulator/mlabsim/update.py | """
This approximates the mlab-ns slice information gathering. The actual
system uses nagios and we're not certain about the details. This much
simplified version is just a web URL anyone may PUT data into.
Warning: This doesn't have any security properties! We need a way to
prevent the addition of malicious entrie... | """
This approximates the mlab-ns slice information gathering. The actual
system uses nagios and we're not certain about the details. This much
simplified version is just a web URL anyone may PUT data into.
Warning: This doesn't have any security properties! We need a way to
prevent the addition of malicious entrie... | Python | 0 |
45a24fae9f5e1ee24c2e0283746224e51f718cc2 | Remove redundant test of permissions parameter | planex/tree.py | planex/tree.py | """
In-memory 'filesystem' library
"""
import os
class Tree(object):
"""
An in-memory 'filesystem' which accumulates file changes
to be written later.
"""
def __init__(self):
self.tree = {}
def append(self, filename, contents=None, permissions=None):
"""
Append conten... | """
In-memory 'filesystem' library
"""
import os
class Tree(object):
"""
An in-memory 'filesystem' which accumulates file changes
to be written later.
"""
def __init__(self):
self.tree = {}
def append(self, filename, contents=None, permissions=None):
"""
Append conten... | Python | 0 |
7ad7f0231bc50c58f9b606cbab36d6cd98e141ec | Make the error message clearer (#944) | pyvista/plotting/__init__.py | pyvista/plotting/__init__.py | """Plotting routines."""
from .colors import (color_char_to_word, get_cmap_safe, hex_to_rgb, hexcolors,
string_to_rgb, PARAVIEW_BACKGROUND)
from .export_vtkjs import export_plotter_vtkjs, get_vtkjs_url
from .helpers import plot, plot_arrows, plot_compare_four, plot_itk
from .itkplotter import Plot... | """Plotting routines."""
from .colors import (color_char_to_word, get_cmap_safe, hex_to_rgb, hexcolors,
string_to_rgb, PARAVIEW_BACKGROUND)
from .export_vtkjs import export_plotter_vtkjs, get_vtkjs_url
from .helpers import plot, plot_arrows, plot_compare_four, plot_itk
from .itkplotter import Plot... | Python | 0.003492 |
f53e7452676e6ee903a4d8c350fa356a718a5fcc | Add a test for file: and path: searches for non-ASCII things. | tests/test_path_file_filters/test_path_file_filters.py | tests/test_path_file_filters/test_path_file_filters.py | # -*- coding: utf-8 -*-
from nose.tools import raises
from dxr.testing import DxrInstanceTestCase
class PathAndFileFilterTests(DxrInstanceTestCase):
"""Basic tests for functionality of the 'path:' and 'file:' filters"""
def test_basic_path_results(self):
"""Check that a 'path:' result includes both ... | from nose.tools import raises
from dxr.testing import DxrInstanceTestCase
class PathAndFileFilterTests(DxrInstanceTestCase):
"""Basic tests for functionality of the 'path:' and 'file:' filters"""
def test_basic_path_results(self):
"""Check that a 'path:' result includes both file and folder matches.... | Python | 0.000001 |
d22bd8970b973fb58f1358b62cf8c27f826aa407 | update example | example/gravity.py | example/gravity.py | from pgmagick import Image, Geometry, Color, TypeMetric, \
DrawableText, DrawableList, DrawableGravity, GravityType
im = Image(Geometry(600, 600), Color("transparent"))
im.fontPointsize(30)
im.fillColor(Color("#f010f0"))
im.strokeColor(Color("transparent"))
im.font("Vera.ttf")
dl = DrawableList()... | from pgmagick import Image, Geometry, Color, TypeMetric, \
DrawableText, DrawableList, DrawableGravity, GravityType
im = Image(Geometry(600, 600), Color("transparent"))
im.fontPointsize(30)
im.fillColor(Color("#f010f0"))
im.strokeColor(Color("transparent"))
im.font("Vera.ttf")
dl = DrawableList()... | Python | 0.000001 |
73e99078b3bce587e059b1a15dbb7f94be70dd8d | enable the possibility of success | testcases/OpalMsglog.py | testcases/OpalMsglog.py | #!/usr/bin/python2
# OpenPOWER Automated Test Project
#
# Contributors Listed Below - COPYRIGHT 2017
# [+] International Business Machines Corp.
#
#
# 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... | #!/usr/bin/python2
# OpenPOWER Automated Test Project
#
# Contributors Listed Below - COPYRIGHT 2017
# [+] International Business Machines Corp.
#
#
# 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... | Python | 0 |
6cb0822aade07999d54e5fcd19eb2c7322abc80a | Improve performance @ Measurement Admin | measurement/admin.py | measurement/admin.py | from django.contrib import admin
from .models import Measurement
class MeasurementAdmin(admin.ModelAdmin):
model = Measurement
def get_queryset(self, request):
return super(MeasurementAdmin, self).get_queryset(request).select_related('patient__user')
admin.site.register(Measurement, MeasurementAdmin... | from django.contrib import admin
from .models import Measurement
admin.site.register(Measurement)
| Python | 0 |
24b2509b1605dfd6d3eb325ed946c3d23441b969 | use Python's QT stuff | demo/quicktime.py | demo/quicktime.py | #!/usr/bin/env python
"""Display quicktime movie."""
import os, sys
import VisionEgg
from VisionEgg.Core import *
from VisionEgg.Text import *
from VisionEgg.Textures import *
from VisionEgg.QuickTime import new_movie_from_filename, MovieTexture
screen = get_default_screen()
screen.set(bgcolor=(0,0,0))
if len(sys.ar... | #!/usr/bin/env python
"""Display quicktime movie."""
import os
import VisionEgg
from VisionEgg.Core import *
from VisionEgg.Text import *
from VisionEgg.Textures import *
from VisionEgg.QuickTime import *
screen = get_default_screen()
screen.set(bgcolor=(0,0,0))
filename = os.path.join(VisionEgg.config.VISIONEGG_SYS... | Python | 0.000002 |
c92caa1f00c984cf839ccf7c645d207e100eb874 | Add test_invalid_image to test_image_validation module | test/server/test_image_validation.py | test/server/test_image_validation.py | from urlparse import urljoin
from clientlib import (
make_example_shot,
make_random_id,
screenshots_session,
example_images
)
import random, string
# Hack to make this predictable:
random.seed(0)
def test_invalid_image_url():
with screenshots_session() as user:
shot_id = make_random_id() ... | from urlparse import urljoin
from clientlib import (
make_example_shot,
make_random_id,
screenshots_session,
example_images
)
import random
# Hack to make this predictable:
random.seed(0)
def test_invalid_image_url():
with screenshots_session() as user:
shot_id = make_random_id() + "/test... | Python | 0.000001 |
2942f39534ca7b309e32268697350afaacad7274 | TEST : Added small integrity test for sct_get_centerline | testing/test_sct_get_centerline.py | testing/test_sct_get_centerline.py | #!/usr/bin/env python
#########################################################################################
#
# Test function for sct_get_centerline script
#
# replace the shell test script in sct 1.0
#
# ---------------------------------------------------------------------------------------
# Copyright (c) 2014 ... | #!/usr/bin/env python
#########################################################################################
#
# Test function for sct_get_centerline script
#
# replace the shell test script in sct 1.0
#
# ---------------------------------------------------------------------------------------
# Copyright (c) 2014 ... | Python | 0 |
fcc5f3a8847dbbb7fc4f9b939dacacd340a314a2 | Load top level dicts in init | medleydb/__init__.py | medleydb/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Python tools for using MedleyDB """
import logging
from os import path
from os import environ
import warnings
import yaml
import json
from medleydb.version import __version__
__all__ = ["__version__", "sql"]
logging.basicConfig(level=logging.CRITICAL)
if "MEDLEYDB_... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Python tools for using MedleyDB """
import logging
from os import path
from os import environ
import warnings
from medleydb.version import __version__
__all__ = ["__version__", "sql"]
logging.basicConfig(level=logging.CRITICAL)
if "MEDLEYDB_PATH" in environ and pat... | Python | 0 |
33121b74419e9913e46e183914805d4a9db8f742 | fix test to look for email instead of username | meetuppizza/tests.py | meetuppizza/tests.py | from django.test import TestCase
from django.contrib.auth.models import User
from django.test import Client
from meetuppizza.forms import RegistrationForm
import pdb
class Test(TestCase):
def setUp(self):
self.params = {
'username':'Bjorn',
'email':'bjorn@bjorn.com',
'password1':'bjornbjor... | from django.test import TestCase
from django.contrib.auth.models import User
from django.test import Client
from meetuppizza.forms import RegistrationForm
import pdb
class Test(TestCase):
def setUp(self):
self.params = {
'username':'Bjorn',
'email':'bjorn@bjorn.com',
'password1':'bjornbjor... | Python | 0 |
9e202e78a5737d8609dfc193b35797b2f5f4a7bb | Corrige le groupage des fichiers statiques saisies plusieurs fois. | static_grouper/templatetags/static_grouper.py | static_grouper/templatetags/static_grouper.py | from collections import defaultdict
from compressor.templatetags.compress import CompressorNode
from django.template import Library, Node, Template, TemplateSyntaxError
register = Library()
CONTEXT_VARIABLE_NAME = 'static_grouper_dict'
class AddStaticNode(Node):
def __init__(self, parser, token):
con... | from collections import defaultdict
from compressor.templatetags.compress import CompressorNode
from django.template import Library, Node, Template, TemplateSyntaxError
register = Library()
CONTEXT_VARIABLE_NAME = 'static_grouper_dict'
class AddStaticNode(Node):
def __init__(self, parser, token):
con... | Python | 0 |
bf4cf008fb8eadd5a0b8b23a330a49fdea272314 | Convert exception to string | tests/cases/cloud_provider_test.py | tests/cases/cloud_provider_test.py | import unittest
import os
from cumulus.ansible.tasks.providers import CloudProvider, EC2Provider
class CloudProviderTestCase(unittest.TestCase):
def setup(self):
pass
def tearDown(self):
pass
def test_empty_profile(self):
with self.assertRaises(AssertionError) as context:
... | import unittest
import os
from cumulus.ansible.tasks.providers import CloudProvider, EC2Provider
class CloudProviderTestCase(unittest.TestCase):
def setup(self):
pass
def tearDown(self):
pass
def test_empty_profile(self):
with self.assertRaises(AssertionError) as context:
... | Python | 0.999979 |
0ac1cdfd59199d3c36ddbccc7c5004261b57f7be | Add api.python.failing_step | recipe_modules/python/api.py | recipe_modules/python/api.py | # Copyright 2013 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.
from slave import recipe_api
from slave import recipe_util
import textwrap
class PythonApi(recipe_api.RecipeApi):
def __call__(self, name, script, args=N... | # Copyright 2013 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.
from slave import recipe_api
from slave import recipe_util
import textwrap
class PythonApi(recipe_api.RecipeApi):
def __call__(self, name, script, args=N... | Python | 0.000053 |
b1653d7a9589766a86141034865d9023b1f75fad | Fix as_tensor_test | tests/as_tensor_test.py | tests/as_tensor_test.py | import unittest
from tfi.as_tensor import as_tensor
from functools import partialmethod
class AsTensorTest(unittest.TestCase):
pass
_FIXTURES = [
('string', 'string', [], str, 'string'),
('list', ['string'], [None], str, ['string']),
('list', ['string'], [1], str, ['string']),
('generator', (s f... | import unittest
from as_tensor import as_tensor
class AsTensorTest(unittest.TestCase):
pass
_FIXTURES = [
('string', 'string', [], 'string'),
('list', ['string'], [None], ['string']),
('list', ['string'], [1], ['string']),
('generator', (s for s in ['string']), [1], ['string']),
('emptylist',... | Python | 0.999412 |
55726db079313570fb9889ae91a4664f2e2daa98 | add buttons to choose task | methods/homeworks.py | methods/homeworks.py | from enum import Enum, auto
from telegram.ext import CommandHandler, MessageHandler, Filters
from telegram.ext.conversationhandler import ConversationHandler
from telegram.message import Message
from telegram.replykeyboardmarkup import ReplyKeyboardMarkup
from telegram.update import Update
from lyceum_api import get_c... | from enum import Enum, auto
from telegram.ext import CommandHandler, MessageHandler, Filters
from telegram.ext.conversationhandler import ConversationHandler
from telegram.message import Message
from telegram.update import Update
from lyceum_api import get_check_queue
from lyceum_api.issue import QueueTask
from method... | Python | 0.000017 |
fd61f3cfbcd520b1b5fc9208c553ee946cced517 | Remove duplicates from compression levels tests | tests/frame/conftest.py | tests/frame/conftest.py | import pytest
# import random
import lz4.frame as lz4frame
@pytest.fixture(
params=[
(lz4frame.BLOCKSIZE_DEFAULT),
(lz4frame.BLOCKSIZE_MAX64KB),
(lz4frame.BLOCKSIZE_MAX256KB),
(lz4frame.BLOCKSIZE_MAX1MB),
(lz4frame.BLOCKSIZE_MAX4MB),
]
)
def block_size(request):
retu... | import pytest
# import random
import lz4.frame as lz4frame
@pytest.fixture(
params=[
(lz4frame.BLOCKSIZE_DEFAULT),
(lz4frame.BLOCKSIZE_MAX64KB),
(lz4frame.BLOCKSIZE_MAX256KB),
(lz4frame.BLOCKSIZE_MAX1MB),
(lz4frame.BLOCKSIZE_MAX4MB),
]
)
def block_size(request):
retu... | Python | 0.000001 |
f6861a57069306046f4d9b40daaede06d3618a53 | Lowercase for consistency | tests/generate_tests.py | tests/generate_tests.py |
from __future__ import print_function
from subprocess import check_output
from os import listdir
from os.path import join
from time import sleep
from utils import Colour, FoundError, getCurrentAbsolutePath, existsIn, EXEC, WHITE_LISTED_EXTENSIONS
dir_path = getCurrentAbsolutePath(__file__)
# (path/to/tests, infrared... |
from __future__ import print_function
from subprocess import check_output
from os import listdir
from os.path import join
from time import sleep
from utils import Colour, FoundError, getCurrentAbsolutePath, existsIn, EXEC, WHITE_LISTED_EXTENSIONS
dir_path = getCurrentAbsolutePath(__file__)
# (path/to/tests, infrared... | Python | 0.998717 |
1c6ed4130baacf0d0f662b6aa056630dd7fd383d | Fix vocab splitting | spraakbanken/s5/spr_local/make_recog_vocab.py | spraakbanken/s5/spr_local/make_recog_vocab.py | #!/usr/bin/env python3
import sys
import collections
def main(in_vocab, size, out_vocab,):
counter = collections.Counter()
size = int(size)
for line in open(in_vocab, encoding='utf-8'):
word, count = line.rstrip("\n").split(" ")
if any(x.isdigit() for x in word):
continue
... | #!/usr/bin/env python3
import sys
import collections
def main(in_vocab, size, out_vocab,):
counter = collections.Counter()
size = int(size)
for line in open(in_vocab, encoding='utf-8'):
word, count = line.strip().split()
if any(x.isdigit() for x in word):
continue
p... | Python | 0.003701 |
7be728d551d7d2becd70b575f95facbbd561e69b | Add latest version of libsigsegv (#3449) | var/spack/repos/builtin/packages/libsigsegv/package.py | var/spack/repos/builtin/packages/libsigsegv/package.py | ##############################################################################
# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | ##############################################################################
# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | Python | 0 |
20a89ca326712058f3f22621eed725c0f510bee3 | Add branch with bugfix (#8355) | var/spack/repos/builtin/packages/meraculous/package.py | var/spack/repos/builtin/packages/meraculous/package.py | ##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | ##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | Python | 0 |
5d608a855132f0a378e44b3c0c7dbba1f4f4dace | fix corehq.messaging.smsbackends.twilio.tests.test_log_call:TwilioLogCallTestCase.test_log_call | corehq/messaging/smsbackends/twilio/tests/test_log_call.py | corehq/messaging/smsbackends/twilio/tests/test_log_call.py | from __future__ import absolute_import
from __future__ import unicode_literals
import corehq.apps.ivr.tests.util as util
from corehq.apps.ivr.models import Call
from corehq.messaging.smsbackends.twilio.models import SQLTwilioBackend
from corehq.messaging.smsbackends.twilio.views import IVR_RESPONSE
from django.test imp... | from __future__ import absolute_import
from __future__ import unicode_literals
import corehq.apps.ivr.tests.util as util
from corehq.apps.ivr.models import Call
from corehq.messaging.smsbackends.twilio.models import SQLTwilioBackend
from corehq.messaging.smsbackends.twilio.views import IVR_RESPONSE
from django.test imp... | Python | 0.000002 |
968f0f3d41a546c4c6614d24be3e077ba1ee37b9 | Reorganiza imports de xml_utils | packtools/sps/utils/xml_utils.py | packtools/sps/utils/xml_utils.py | import logging
import re
from copy import deepcopy
from lxml import etree
from packtools.sps import exceptions
from packtools.sps.utils import file_utils
logger = logging.getLogger(__name__)
class LoadToXMLError(Exception):
...
def fix_xml(xml_str):
return fix_namespace_prefix_w(xml_str)
def fix_namesp... | import logging
import re
from lxml import etree
from dsm.utils.files import read_file
logger = logging.getLogger(__name__)
class LoadToXMLError(Exception):
...
def fix_xml(xml_str):
return fix_namespace_prefix_w(xml_str)
def fix_namespace_prefix_w(content):
"""
Convert os textos cujo padrão é `... | Python | 0 |
4671e4a1f8f18ec26180a5b4093d70e7d3913302 | fix for mk language | plugins/tts.py | plugins/tts.py | import aiohttp
from plugin_system import Plugin
plugin = Plugin('Голос', usage="скажи [выражение] - бот сформирует "
"голосовое сообщение на основе текста")
try:
from gtts import gTTS
import langdetect
except ImportError:
plugin.log('gTTS или langdetect не установлены, плаги... | import aiohttp
from plugin_system import Plugin
plugin = Plugin('Голос', usage="скажи [выражение] - бот сформирует "
"голосовое сообщение на основе текста")
try:
from gtts import gTTS
import langdetect
except ImportError:
plugin.log('gTTS или langdetect не установлены, плаги... | Python | 0.000001 |
713fd67b4aa0d3a614ca149f86deeb2d5e913d12 | fix installation on linux (#24706) | var/spack/repos/builtin/packages/py-keyring/package.py | var/spack/repos/builtin/packages/py-keyring/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 PyKeyring(PythonPackage):
"""The Python keyring library provides an easy way to access the... | # 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 PyKeyring(PythonPackage):
"""The Python keyring library provides an easy way to access the... | Python | 0 |
e11f99e43ff9d909bf97f050c560663d38fb1388 | Add fixture/result subdirectory. | test/unit/staging/test_link_dicom.py | test/unit/staging/test_link_dicom.py | from nose.tools import *
import os, glob, shutil
import sys
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..', '..'))
from qipipe.staging import link_dicom_files
# The test parent directory.
ROOT = os.path.normpath(os.path.join(os.path.dirname(__file__), '..', '..'))
# The test fixture.
FIXTURE = ... | from nose.tools import *
import os, glob, shutil
import sys
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..', '..'))
from qipipe import staging
# The test parent directory.
ROOT = os.path.normpath(os.path.join(os.path.dirname(__file__), '..', '..'))
# The test fixture.
FIXTURE = os.path.join(ROOT... | Python | 0 |
f06a4689fab32d7d2f4c848019978665656a5cdf | Implement hexfile record types used by GNU ld | mikroeuhb/hexfile.py | mikroeuhb/hexfile.py | import struct, logging
from binascii import unhexlify
from util import bord
logger = logging.getLogger(__name__)
def load(f, devkit):
"""Load a Intel HEX File from a file object into a devkit.
The devkit must implement a write(address,data) method."""
lineno = 0
base_addr = 0
for line in f.xread... | import struct, logging
from binascii import unhexlify
from util import bord
logger = logging.getLogger(__name__)
def load(f, devkit):
"""Load a Intel HEX File from a file object into a devkit.
The devkit must implement a write(address,data) method."""
lineno = 0
base_addr = 0
for line in f.xread... | Python | 0 |
b9b3837937341e6b1b052bbfdd979e3bb57d87c4 | Fix SSL security provider integration tests | tests/integration/test_with_ssl.py | tests/integration/test_with_ssl.py | import os
from pymco.test import ctxt
from . import base
FIXTURES_PATH = os.path.join(ctxt.ROOT, 'fixtures')
class SSLTestCase(base.IntegrationTestCase):
'''RabbitMQ integration test case.'''
CTXT = {
'plugin.activemq.pool.1.port': 61614,
'plugin.activemq.pool.1.password': 'marionette',
... | from . import base
class SSLTestCase(base.IntegrationTestCase):
'''RabbitMQ integration test case.'''
CTXT = {
'plugin.activemq.pool.1.port': 61614,
'plugin.activemq.pool.1.password': 'marionette',
'plugin.ssl_server_public': 'tests/fixtures/server-public.pem',
'plugin.ssl_clie... | Python | 0 |
30bd0a8b50545e24ec69ecc4c720c508c318e008 | Remove pdb | tests/mock_vws/utils.py | tests/mock_vws/utils.py | """
Utilities for tests for the VWS mock.
"""
from string import hexdigits
from typing import Optional
from urllib.parse import urljoin
from requests.models import Response
from common.constants import ResultCodes
class Endpoint:
"""
Details of endpoints to be called in tests.
"""
def __init__(sel... | """
Utilities for tests for the VWS mock.
"""
from string import hexdigits
from typing import Optional
from urllib.parse import urljoin
from requests.models import Response
from common.constants import ResultCodes
class Endpoint:
"""
Details of endpoints to be called in tests.
"""
def __init__(sel... | Python | 0.000004 |
dcc07355786f94da36d938239c5c60d5302e4d42 | test for identity link | testapp/tests/test_renderer_infer.py | testapp/tests/test_renderer_infer.py | #!/usr/bin/env python
# encoding: utf-8
from django.test import TestCase
from collection_json import Collection
from testapp.models import Person
try:
from urlparse import urlparse
except ImportError:
from urllib.parse import urlparse
class DictionaryTest(TestCase):
"""tests when the response contains a... | #!/usr/bin/env python
# encoding: utf-8
from django.test import TestCase
from collection_json import Collection
from testapp.models import Person
class DictionaryTest(TestCase):
"""tests when the response contains a dictionary"""
def test_no_serializer_view(self):
with self.assertRaises(TypeError):
... | Python | 0 |
943ecc39af2b152bc8d5fed55bdafe5332a33d75 | remove xfail (#4458) | testing/kfctl/endpoint_ready_test.py | testing/kfctl/endpoint_ready_test.py | import datetime
import json
import logging
import os
import subprocess
import tempfile
import uuid
from retrying import retry
import pytest
from kubeflow.testing import util
from testing import deploy_utils
from testing import gcp_util
# There's really no good reason to run test_endpoint during presubmits.
# We shou... | import datetime
import json
import logging
import os
import subprocess
import tempfile
import uuid
from retrying import retry
import pytest
from kubeflow.testing import util
from testing import deploy_utils
from testing import gcp_util
# TODO(https://github.com/kubeflow/kfctl/issues/42):
# Test is failing pretty con... | Python | 0.000009 |
291681041f434a981a54371bb7f9f1fa9637afb7 | improve comment collapse | polls/admin.py | polls/admin.py | from django.contrib import admin
from polls.models import Choice, Question
class ChoiceInline(admin.TabularInline):
model = Choice
extra = 3
class QuestionAdmin(admin.ModelAdmin):
fieldsets = [
(None, {'fields': ['question_text']}),
('Date information', {'fields': ['pub_date'... | from django.contrib import admin
from polls.models import Choice, Question
class ChoiceInline(admin.TabularInline):
model = Choice
extra = 3
class QuestionAdmin(admin.ModelAdmin):
fieldsets = [
(None, {'fields': ['question_text']}),
('Date information', {'fields': ['pub_date'... | Python | 0.000002 |
21ecd9a319c5e0dceed36fcf9cabdc864f735c2c | Write test for nearley include | tests/test_nearley/test_nearley.py | tests/test_nearley/test_nearley.py | from __future__ import absolute_import
import unittest
import logging
import os
import sys
logging.basicConfig(level=logging.INFO)
from lark.tools.nearley import create_code_for_nearley_grammar
NEARLEY_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), 'nearley'))
BUILTIN_PATH = os.path.join(NEARLEY_PAT... | from __future__ import absolute_import
import unittest
import logging
import os
import sys
logging.basicConfig(level=logging.INFO)
from lark.tools.nearley import create_code_for_nearley_grammar
NEARLEY_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), 'nearley'))
BUILTIN_PATH = os.path.join(NEARLEY_PAT... | Python | 0 |
69770ecc4715788837f5f769e0d2f1e6690a153f | Allow test_core to run as a test program | tests/test_splauncher/test_core.py | tests/test_splauncher/test_core.py | from __future__ import print_function
__author__ = "John Kirkham <kirkhamj@janelia.hhmi.org>"
__date__ = "$May 18, 2015 22:08:21 EDT$"
import os
import shutil
import tempfile
import time
import unittest
from splauncher.core import main
class TestCore(unittest.TestCase):
def setUp(self):
self.cwd = os... | from __future__ import print_function
__author__ = "John Kirkham <kirkhamj@janelia.hhmi.org>"
__date__ = "$May 18, 2015 22:08:21 EDT$"
import os
import shutil
import tempfile
import time
import unittest
from splauncher.core import main
class TestCore(unittest.TestCase):
def setUp(self):
self.cwd = os... | Python | 0.000002 |
534a21e8d664a4216af14db95415dafa0508b3b9 | Remove test | tests/integration/client/standard.py | tests/integration/client/standard.py | # -*- coding: utf-8 -*-
# Import python libs
from __future__ import absolute_import
import os
# Import Salt Testing libs
from salttesting.helpers import ensure_in_syspath
ensure_in_syspath('../../')
# Import salt libs
import integration
import salt.utils
class StdTest(integration.ModuleCase):
'''
Test stan... | # -*- coding: utf-8 -*-
# Import python libs
from __future__ import absolute_import
import os
# Import Salt Testing libs
from salttesting.helpers import ensure_in_syspath
ensure_in_syspath('../../')
# Import salt libs
import integration
import salt.utils
class StdTest(integration.ModuleCase):
'''
Test stan... | Python | 0 |
05e496de4f6ebbb9e77c6cb1796cc1050a41a181 | Adjust whitespace for pep8 | pratchett/__init__.py | pratchett/__init__.py | HEADER = ("X-Clacks-Overhead", "GNU Terry Pratchett")
class GNUTerryPratchett(object):
def __init__(self, app):
self.app = app
def __call__(self, environ, start_response):
def clacker(status, headers, *args, **kwargs):
if HEADER not in headers:
headers.append(HEADE... | HEADER = ("X-Clacks-Overhead", "GNU Terry Pratchett")
class GNUTerryPratchett(object):
def __init__(self, app):
self.app = app
def __call__(self, environ, start_response):
def clacker(status, headers, *args, **kwargs):
if HEADER not in headers:
headers.append(HEADE... | Python | 0.9998 |
ddb4ed6701808ed5c4e928d042b84e0c84490e58 | Bump version 0.0.4 | memsource/__init__.py | memsource/__init__.py | __author__ = 'Gengo'
__version__ = '0.0.4'
__license__ = 'MIT'
| __author__ = 'Gengo'
__version__ = '0.0.3'
__license__ = 'MIT'
| Python | 0 |
949c7b55e295b4d87f2d7a1bb98242cb055129d1 | Solve No.140 in Python with problems | 140.py | 140.py |
class Solution:
"""
@param a, b, n: 32bit integers
@return: An integer
"""
def fastPower(self, a, b, n):
ans = 1
while b > 0:
if b % 2==1:
ans = ans * a % n
a = a * a % n
b = b / 2
return ans % n
# WA because of l... |
class Solution:
"""
@param a, b, n: 32bit integers
@return: An integer
"""
def fastPower(self, a, b, n):
ans = 1
while b > 0:
if b % 2==1:
ans = ans * a % n
a = a * a % n
b = b / 2
return ans % n
# WA | Python | 0.005724 |
86f33d7c88c728bb5ce0c885543dd54d942e2962 | Fix strings broken by 1393650 | tests/steps/snapshot.py | tests/steps/snapshot.py | # -*- coding: UTF-8 -*-
from __future__ import unicode_literals
from behave import step
from dogtail.rawinput import typeText, pressKey
from time import sleep
from utils import get_showing_node_name
@step('Add Snapshot named "{name}"')
def add_snapshot(context, name):
wait = 0
while len(context.app.findChildr... | # -*- coding: UTF-8 -*-
from __future__ import unicode_literals
from behave import step
from dogtail.rawinput import typeText, pressKey
from time import sleep
from utils import get_showing_node_name
@step('Add Snapshot named "{name}"')
def add_snapshot(context, name):
wait = 0
while len(context.app.findChildr... | Python | 0.004521 |
9221d42cda7ba7a44d1462de75c0c53412998fb4 | Remove unused code. | mysite/missions/tar/view_helpers.py | mysite/missions/tar/view_helpers.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 |
68eeda85605fa84d7bea69dfeab97b3b1278b4d4 | fix typo | examples/wordcloud_cn.py | examples/wordcloud_cn.py | # - * - coding: utf - 8 -*-
"""
create wordcloud with chinese
=============================
Wordcloud is a very good tool, but if you want to create
Chinese wordcloud only wordcloud is not enough. The file
shows how to use wordcloud with Chinese. First, you need a
Chinese word segmentation library jieba, jieba is now ... | # - * - coding: utf - 8 -*-
"""
create wordcloud with chinese
=============================
Wordcloud is a very good tools, but if you want to create
Chinese wordcloud only wordcloud is not enough. The file
shows how to use wordcloud with Chinese. First, you need a
Chinese word segmentation library jieba, jieba is now... | Python | 0.999991 |
63667e0d492c16e0c3bc4a398044a60df695cc61 | Add more side effects | tests/unit/states/ssh_auth_test.py | tests/unit/states/ssh_auth_test.py | # -*- coding: utf-8 -*-
'''
:codeauthor: :email:`Jayesh Kariya <jayeshk@saltstack.com>`
'''
# Import Python libs
from __future__ import absolute_import
# Import Salt Testing Libs
from salttesting import skipIf, TestCase
from salttesting.mock import (
NO_MOCK,
NO_MOCK_REASON,
MagicMock,
patch
)
fro... | # -*- coding: utf-8 -*-
'''
:codeauthor: :email:`Jayesh Kariya <jayeshk@saltstack.com>`
'''
# Import Python libs
from __future__ import absolute_import
# Import Salt Testing Libs
from salttesting import skipIf, TestCase
from salttesting.mock import (
NO_MOCK,
NO_MOCK_REASON,
MagicMock,
patch
)
fro... | Python | 0 |
d10bb3695ee93ffd8b91d4d82adaf484de9e9bf1 | Rename NeuronNetwork to NeuralNetwork | ANN.py | ANN.py | from random import uniform
class Neuron:
def __init__(self, parents=[]):
self.parents = [{
'neuron': parent,
'weight': uniform(-1, 1),
'slope': uniform(-1, 1),
} for parent in parents]
def calculate(self, increment=0):
self.output = sum([parent['neu... | from random import uniform
class Neuron:
def __init__(self, parents=[]):
self.parents = [{
'neuron': parent,
'weight': uniform(-1, 1),
'slope': uniform(-1, 1),
} for parent in parents]
def calculate(self, increment=0):
self.output = sum([parent['neu... | Python | 0.99959 |
4f219c4a05a251d9958543d24891955d640bc07f | Add more realistic responses for audit logs in tests. | tests/test_audit_log.py | tests/test_audit_log.py | import httpretty
from fulcrum.exceptions import NotFoundException, InternalServerErrorException
from tests import FulcrumTestCase
from tests.valid_objects import form as valid_form
class AuditLogTest(FulcrumTestCase):
@httpretty.activate
def test_all(self):
httpretty.register_uri(httpretty.GET, self... | import httpretty
from fulcrum.exceptions import NotFoundException, InternalServerErrorException
from tests import FulcrumTestCase
from tests.valid_objects import form as valid_form
class AuditLogTest(FulcrumTestCase):
@httpretty.activate
def test_all(self):
httpretty.register_uri(httpretty.GET, self... | Python | 0 |
74935550f886edfefa26298a98874e4c2dd2ab53 | Fold a line | extenteten/util.py | extenteten/util.py | import functools
import numpy
import tensorflow as tf
def static_shape(tensor):
return tf.convert_to_tensor(tensor).get_shape().as_list()
def static_shapes(*tensors):
return _map_to_list(static_shape, tensors)
def static_rank(tensor):
return len(static_shape(tf.convert_to_tensor(tensor)))
def static... | import functools
import numpy
import tensorflow as tf
def static_shape(tensor):
return tf.convert_to_tensor(tensor).get_shape().as_list()
def static_shapes(*tensors):
return _map_to_list(static_shape, tensors)
def static_rank(tensor):
return len(static_shape(tf.convert_to_tensor(tensor)))
def static... | Python | 0.999989 |
952d70244f885dc194d83d5bb598fa9ebcdfceb2 | Add no store command-line option to trends util script | app/utils/insert/trendsCountryAndTowns.py | app/utils/insert/trendsCountryAndTowns.py | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Utility to get trend data and add to the database.
Expects a single country name and uses the country and child town
WOEIDs to get trend data.
Run file directly (not as a module) and with `--help` flag in order to see
usage instructions.
"""
import time
# Allow impo... | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Utility to get trend data and add to the database.
Expects a single country name and uses the country and child town
WOEIDs to get trend data.
Run file directly (not as a module) and with `--help` flag in order to see
usage instructions.
"""
import time
# Allow impo... | Python | 0 |
14d1cbae9323e3ff7d80480b39a96b76cada94b0 | Add a clear_requested signal | pyqode/core/frontend/widgets/menu_recents.py | pyqode/core/frontend/widgets/menu_recents.py | """
Provides a menu that display the list of recent files and a RecentFilesManager
which use your application's QSettings to store the list of recent files.
"""
import os
from pyqode.qt import QtCore, QtWidgets
class RecentFilesManager:
"""
Manages a list of recent files. The list of files is stored in your
... | """
Provides a menu that display the list of recent files and a RecentFilesManager
which use your application's QSettings to store the list of recent files.
"""
import os
from pyqode.qt import QtCore, QtWidgets
class RecentFilesManager:
"""
Manages a list of recent files. The list of files is stored in your
... | Python | 0.000001 |
fdd8e33b58f8ffba50dff86931a47daf396903e8 | Revert tweak to TokenPermissions.has_permission() | netbox/netbox/api/authentication.py | netbox/netbox/api/authentication.py | from django.conf import settings
from rest_framework import authentication, exceptions
from rest_framework.permissions import BasePermission, DjangoObjectPermissions, SAFE_METHODS
from users.models import Token
class TokenAuthentication(authentication.TokenAuthentication):
"""
A custom authentication scheme ... | from django.conf import settings
from rest_framework import authentication, exceptions
from rest_framework.permissions import BasePermission, DjangoObjectPermissions, SAFE_METHODS
from users.models import Token
class TokenAuthentication(authentication.TokenAuthentication):
"""
A custom authentication scheme ... | Python | 0 |
f2cc74d79abf42c0f199c48ef9110bce6cec45b4 | Update alcatel_sros_ssh.py | netmiko/alcatel/alcatel_sros_ssh.py | netmiko/alcatel/alcatel_sros_ssh.py | '''
Alcatel-Lucent SROS support
'''
from netmiko.ssh_connection import SSHConnection
class AlcatelSrosSSH(SSHConnection):
'''
SROS support
'''
def session_preparation(self):
self.disable_paging(command="environment no more\n")
def enable(self):
pass
| '''
Alcatel-Lucent SROS support
'''
from netmiko.ssh_connection import SSHConnection
class AlcatelSrosSSH(SSHConnection):
'''
SROS support
'''
def session_preparation(self):
self.disable_paging(command="\environment no more\n")
def enable(self):
pass
| Python | 0 |
0824bfd48692d3ca7711171c0dea6868411db4ce | Fix window extraction convolution | thinc/neural/_classes/convolution.py | thinc/neural/_classes/convolution.py | from .model import Model
from ... import describe
from ...describe import Dimension
@describe.attributes(
nW=Dimension("Number of surrounding tokens on each side to extract")
)
class ExtractWindow(Model):
'''Add context to vectors in a sequence by concatenating n surrounding
vectors.
If the input... | from .model import Model
from ... import describe
from ...describe import Dimension
@describe.attributes(
nW=Dimension("Number of surrounding tokens on each side to extract")
)
class ExtractWindow(Model):
'''Add context to vectors in a sequence by concatenating n surrounding
vectors.
If the input... | Python | 0.000002 |
91ff2ed96dc3ba197f71be935ac23796d40ef5dc | Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/812a20bfa97f7b56eb3340c2f75358db58483974. | third_party/tf_runtime/workspace.bzl | third_party/tf_runtime/workspace.bzl | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "812a20bfa97f7b56eb3340c2f75358db58483974"
TFRT_SHA256 = "8235d34c674a842fb08f5fc7f7b6136a1af1dbb20a2ec7... | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "c442a283246c2060d139d4cadb0f8ff59ee7e7da"
TFRT_SHA256 = "649107aabf7a242678448c44d4a51d5355904222de7d45... | Python | 0.000002 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.