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 |
|---|---|---|---|---|---|---|---|
8fb97bc0b3a22b912958974636051447170a0b02 | Add user_account to the user profile admin as a read-only field. | go/base/admin.py | go/base/admin.py | from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.utils.translation import ugettext_lazy as _
from go.base.models import GoUser, UserProfile, UserOrganisation
from go.base.forms import GoUserCreationForm, GoUserChangeForm
class UserProfileInline(admin.StackedInline):
mo... | from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.utils.translation import ugettext_lazy as _
from go.base.models import GoUser, UserProfile, UserOrganisation
from go.base.forms import GoUserCreationForm, GoUserChangeForm
class UserProfileInline(admin.StackedInline):
mo... | Python | 0 |
56d3db6aae71c88ff8b55bb1d173abc025be7e8c | Add test of a write command | jacquard/tests/test_cli.py | jacquard/tests/test_cli.py | import io
import unittest.mock
import contextlib
import textwrap
from jacquard.cli import main
from jacquard.storage.dummy import DummyStore
def test_smoke_cli_help():
try:
output = io.StringIO()
with contextlib.redirect_stdout(output):
main(['--help'])
except SystemExit:
p... | import io
import unittest.mock
import contextlib
import textwrap
from jacquard.cli import main
from jacquard.storage.dummy import DummyStore
def test_smoke_cli_help():
try:
output = io.StringIO()
with contextlib.redirect_stdout(output):
main(['--help'])
except SystemExit:
p... | Python | 0.000268 |
ae7f8c0deaaec2cbc830113ea19f06ca6aa169c7 | Use `persist.errors` for the goto commands again | goto_commands.py | goto_commands.py | import sublime
import sublime_plugin
from itertools import dropwhile, takewhile
from .lint import persist
"""
Implement typical Goto Next Previous Error Commands.
"""
class SublimeLinterGotoError(sublime_plugin.WindowCommand):
def run(self, direction='next', count=1, wrap=False):
goto(self.window.acti... | import sublime
import sublime_plugin
from itertools import dropwhile, takewhile
"""
Implement typical Goto Next Previous Error Commands.
"""
class SublimeLinterGotoError(sublime_plugin.WindowCommand):
def run(self, direction='next', count=1, wrap=False):
goto(self.window.active_view(), direction, count... | Python | 0 |
1d31282a9781e8eef4aafc0549c01056d4fc03d0 | Bump version. | armet/_version.py | armet/_version.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import, division
__version_info__ = (0, 4, 22)
__version__ = '.'.join(map(str, __version_info__))
| # -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import, division
__version_info__ = (0, 4, 21)
__version__ = '.'.join(map(str, __version_info__))
| Python | 0 |
cec594e525fb889029b85b1f92f89170ca330332 | Remove unnecessary "is not supported" verbiage. | zerver/webhooks/trello/view/__init__.py | zerver/webhooks/trello/view/__init__.py | # Webhooks for external integrations.
from typing import Any, Mapping, Optional, Tuple
import orjson
from django.http import HttpRequest, HttpResponse
from zerver.decorator import api_key_only_webhook_view, return_success_on_head_request
from zerver.lib.request import REQ, has_request_variables
from zerver.lib.respon... | # Webhooks for external integrations.
from typing import Any, Mapping, Optional, Tuple
import orjson
from django.http import HttpRequest, HttpResponse
from zerver.decorator import api_key_only_webhook_view, return_success_on_head_request
from zerver.lib.request import REQ, has_request_variables
from zerver.lib.respon... | Python | 0 |
04605ee82108695989e8f10b2287d43f6df448f8 | Update noisy_linear.py | chainerrl/links/noisy_linear.py | chainerrl/links/noisy_linear.py | import chainer
import chainer.functions as F
from chainer.initializers import Constant
import chainer.links as L
import numpy
from chainerrl.initializers import VarianceScalingConstant
class FactorizedNoisyLinear(chainer.Chain):
"""Linear layer in Factorized Noisy Network
Args:
mu_link (L.Linear): L... | import chainer
import chainer.functions as F
from chainer.initializers import Constant
import chainer.links as L
import numpy
from chainerrl.initializers import VarianceScalingConstant
class FactorizedNoisyLinear(chainer.Chain):
"""Linear layer in Factorized Noisy Network
Args:
mu_link (L.Linear): L... | Python | 0 |
67c40fff7813b91b874c5fada042bfc0c6990d52 | Bump version | typepy/__version__.py | typepy/__version__.py | # encoding: utf-8
from datetime import datetime
__author__ = "Tsuyoshi Hombashi"
__copyright__ = "Copyright 2017-{}, {}".format(datetime.now().year, __author__)
__license__ = "MIT License"
__version__ = "0.3.2"
__maintainer__ = __author__
__email__ = "tsuyoshi.hombashi@gmail.com"
| # encoding: utf-8
from datetime import datetime
__author__ = "Tsuyoshi Hombashi"
__copyright__ = "Copyright 2017-{}, {}".format(datetime.now().year, __author__)
__license__ = "MIT License"
__version__ = "0.3.1"
__maintainer__ = __author__
__email__ = "tsuyoshi.hombashi@gmail.com"
| Python | 0 |
7f774d08ecf9d64a732a8471dd6f36b9d0e2826a | Update entity_main.py | EntityExtractor/src/entity_main.py | EntityExtractor/src/entity_main.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Created by Lalitha Madhuri Putchala on Dec 10 2017
"""
import spacy
import docx2txt
import re
from docx import Document
from utils import get_sentence_tokens, tag_text, highlight_text
class Entity:
def __init__(self):
self.raw_data = docx2txt.process('Contrac... | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Created by Lalitha Madhuri Putchala on Dec 10 2017
"""
import unittest
from entity_main import Entity
from docx import Document
import docx2txt
class TestEntity(unittest.TestCase):
'''The below function verifies the basic sanity functionality of the program
... | Python | 0.000002 |
fa9e5956adadd20d546129b07bf4b71772cd5b05 | make small optimization to vector multiply/divide | pyschool/static/external/brython/Lib/site-packages/glow/vector.py | pyschool/static/external/brython/Lib/site-packages/glow/vector.py | from javascript import JSConstructor, console
class vec:
def __init__(self, x=0, y=0, z=0):
self._vec=JSConstructor(glowscript.vec)(x,y,z)
self.add=self.__add__
self.sub=self.__sub__
self.multiply=self.__mul__
self.divide=self.__truediv__=self.__div__
#vec should be a glowscript vec... | from javascript import JSConstructor, console
class vec:
def __init__(self, x=0, y=0, z=0):
self._vec=JSConstructor(glowscript.vec)(x,y,z)
self.add=self.__add__
self.sub=self.__sub__
self.multiply=self.__mul__
self.divide=self.__truediv__=self.__div__
#vec should be a glowscript vec... | Python | 0.000001 |
835da41ffd1433c36bdc585a3154434c60bdbb8f | Fix lint | biggraphite/drivers/_utils.py | biggraphite/drivers/_utils.py | #!/usr/bin/env python
# Copyright 2016 Criteo
#
# 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 agree... | #!/usr/bin/env python
# Copyright 2016 Criteo
#
# 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 agree... | Python | 0.000032 |
4b14f12fa8bb6dca7ad91f187e7765bef27c0d65 | Add some options | classes/admin.py | classes/admin.py | from django.contrib import admin
from classes.models import Attendee
from classes.models import Attendance
from classes.models import Session
from classes.models import WalkinClass
class AttendanceInline(admin.TabularInline):
model = Attendance
extra = 1
verbose_name = 'Attendee'
verbose_name_plural ... | from django.contrib import admin
from classes.models import Attendee
from classes.models import Attendance
from classes.models import Session
from classes.models import WalkinClass
class AttendanceInline(admin.TabularInline):
model = Attendance
extra = 1
verbose_name = 'Attendee'
verbose_name_plural ... | Python | 0.000535 |
7bdf0a3121d539e0a98ffa68a964bfd022fe43a5 | Make the stitcher executable | atram_stitcher.py | atram_stitcher.py | #!/usr/bin/env python3
"""
Start the atram exon stitcher.
This wrapper module parses the input arguments and passes them to the module
that does the actual stitching (core_stitcher.py).
"""
from os.path import join
from datetime import date
import argparse
import textwrap
import lib.db as db
import lib.log as log
imp... | #!/usr/bin/env python3
"""
Start the atram exon stitcher.
This wrapper module parses the input arguments and passes them to the module
that does the actual stitching (core_stitcher.py).
"""
from os.path import join
from datetime import date
import argparse
import textwrap
import lib.db as db
import lib.log as log
imp... | Python | 0.998561 |
aa681b4a36ce36c53933f3834eec9c721d6029cf | Update docker images utils | polyaxon/docker_images/image_info.py | polyaxon/docker_images/image_info.py | import logging
from typing import Any, Tuple
import conf
from constants.images_tags import LATEST_IMAGE_TAG
_logger = logging.getLogger('polyaxon.dockerizer.images')
def get_experiment_image_info(experiment: 'Experiment') -> Tuple[str, str]:
"""Return the image name and image tag for an experiment"""
proj... | import logging
from typing import Any, Tuple
import conf
from constants.images_tags import LATEST_IMAGE_TAG
_logger = logging.getLogger('polyaxon.dockerizer.images')
def get_experiment_image_info(experiment: 'Experiment') -> Tuple[str, str]:
"""Return the image name and image tag for an experiment"""
proj... | Python | 0.000001 |
d69bd1c72c1e01ba392eda54820ca5db4774b744 | Use 'open' with 'with' | polycircles/test/test_earthquakes.py | polycircles/test/test_earthquakes.py | import os, csv
from nose.tools import assert_equal
from polycircles import polycircles
import simplekml
import unittest
class TestLastPointInPolygonEqualsTheFirstOne(unittest.TestCase):
"""
Courtesy Carlos H. Grohmann (https://github.com/CarlosGrohmann) who
reported Issue #1 (https://github.com/adamatan/p... | import os, csv
from nose.tools import assert_equal
from polycircles import polycircles
import simplekml
import unittest
class TestLastPointInPolygonEqualsTheFirstOne(unittest.TestCase):
"""
Courtesy Carlos H. Grohmann (https://github.com/CarlosGrohmann) who
reported Issue #1 (https://github.com/adamatan/p... | Python | 0.998616 |
bd4a6e4444b73eacc75657985ffbfd90538a08f0 | fix code style | flexget/ui/__init__.py | flexget/ui/__init__.py | from __future__ import unicode_literals, division, absolute_import
from builtins import * # pylint: disable=unused-import, redefined-builtin
import logging
import os
import fnmatch
from flask import send_from_directory, Flask
from flexget.webserver import register_app, register_home
from flask_compress import Compr... | from __future__ import unicode_literals, division, absolute_import
from builtins import * # pylint: disable=unused-import, redefined-builtin
import logging
import os
import fnmatch
from flask import send_from_directory, Flask
from flexget.webserver import register_app, register_home
from flask_compress import Compr... | Python | 0.000022 |
7307a4b19b09f4408f569c580955f5c7d2af5f73 | Update version number | auth0/__init__.py | auth0/__init__.py | __version__ = '2.0.0b4'
| __version__ = '2.0.0b3'
| Python | 0.000002 |
6a1c3e8c7adecc98af10161d41d95034919eeacd | Allow user specified tsconfig.json | sphinx_js/generators.py | sphinx_js/generators.py | from codecs import getwriter
from errno import ENOENT
import subprocess
import os
from os.path import abspath
from tempfile import TemporaryFile, NamedTemporaryFile
from json import load
from sphinx.errors import SphinxError
from sphinx.util.logging import getLogger
from six import string_types
from .typedoc import par... | from codecs import getwriter
from errno import ENOENT
import subprocess
import os
from os.path import abspath
from tempfile import TemporaryFile, NamedTemporaryFile
from json import load
from sphinx.errors import SphinxError
from sphinx.util.logging import getLogger
from six import string_types
from .typedoc import par... | Python | 0 |
f1a54346ac0a0241ee5d8011ba443fc7ef5a74f1 | discard happens after interrupt | pyardrone/utils/object_executor.py | pyardrone/utils/object_executor.py | import threading
import queue
import time
class Interrupt:
def __init__(self, obj_exe, wait, discard):
self.obj_exe = obj_exe
self.wait = wait
self.discard = discard
def __enter__(self):
self.obj_exe.pause(wait=self.wait)
def __exit__(self, exc_type, exc_value, exc_tb):
... | import threading
import queue
import time
class Interrupt:
def __init__(self, obj_exe, wait, discard):
self.obj_exe = obj_exe
self.wait = wait
self.discard = discard
def __enter__(self):
self.obj_exe.pause(wait=self.wait)
if self.discard:
q = self.obj_exe.... | Python | 0.000112 |
443d56fdd2e588c11c2a1e3a685912b712e37d44 | Make sure all fields are grabbed. | split/casanfar_split.py | split/casanfar_split.py | import os
import numpy as np
import sys
SDM_name = str(sys.argv[4])
print "Inputted MS: "+SDM_name
# SDM_name = '14B-088.sb30023144.eb30070731.57002.919034293984'
# Set up some useful variables (these will be altered later on)
msfile = SDM_name + '.ms'
hisplitms = SDM_name + '.hi.ms'
splitms = SDM_name + '.hi.src.sp... | import os
import numpy as np
import sys
SDM_name = str(sys.argv[4])
print "Inputted MS: "+SDM_name
# SDM_name = '14B-088.sb30023144.eb30070731.57002.919034293984'
# Set up some useful variables (these will be altered later on)
msfile = SDM_name + '.ms'
hisplitms = SDM_name + '.hi.ms'
splitms = SDM_name + '.hi.src.sp... | Python | 0 |
eeee8fb498eb3a52baff7b9b2684c8a713e20216 | remove non-essential calls from inner-loop methods | pydoop/mapreduce/binary_streams.py | pydoop/mapreduce/binary_streams.py | # BEGIN_COPYRIGHT
#
# Copyright 2009-2017 CRS4.
#
# 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 agree... | # BEGIN_COPYRIGHT
#
# Copyright 2009-2017 CRS4.
#
# 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 agree... | Python | 0.000009 |
ed320c5fac9bdd53b568946847981d38b0e0037b | Handle requests exceptions in actual healthcheck | src/django_healthchecks/checker.py | src/django_healthchecks/checker.py | import base64
import functools
import inspect
from importlib import import_module
import requests
from django.conf import settings
from django.utils.encoding import force_text
try:
from django.utils.module_loading import import_string
except ImportError:
def import_string(value):
module_name, func_na... | import base64
import functools
import inspect
from importlib import import_module
from django.conf import settings
from django.utils.encoding import force_text
import requests
try:
from django.utils.module_loading import import_string
except ImportError:
def import_string(value):
module_name, func_na... | Python | 0 |
4e0d90fc157760606ae8503762f10bdef30bff8c | Remove trailing slashes | bluebottle/impact/urls/api.py | bluebottle/impact/urls/api.py | from django.conf.urls import url
from bluebottle.impact.views import (
ImpactTypeList,
ImpactGoalList,
ImpactGoalDetail
)
urlpatterns = [
url(r'^types$', ImpactTypeList.as_view(), name='impact-type-list'),
url(r'^goals$', ImpactGoalList.as_view(), name='impact-goal-list'),
url(
r'^goal... | from django.conf.urls import url
from bluebottle.impact.views import (
ImpactTypeList,
ImpactGoalList,
ImpactGoalDetail
)
urlpatterns = [
url(r'^types/$', ImpactTypeList.as_view(), name='impact-type-list'),
url(r'^goals/$', ImpactGoalList.as_view(), name='impact-goal-list'),
url(
r'^go... | Python | 0.000346 |
0dd21b0f13aa7bf4cc3061dca216c65cf73975e5 | Make registration reports filterable and harmonize URL | kcdc3/apps/classes/urls.py | kcdc3/apps/classes/urls.py | from django.conf.urls import patterns, include, url
from models import Event, Registration
from views import EventListView, EventDetailView, ResponseTemplateView, EventArchiveView, SessionView, RegistrationListView, TeacherAdminListView, FilteredTeacherAdminListView
urlpatterns = patterns('kcdc3.apps.classes.views',
... | from django.conf.urls import patterns, include, url
from models import Event, Registration
from views import EventListView, EventDetailView, ResponseTemplateView, EventArchiveView, SessionView, RegistrationListView, TeacherAdminListView, FilteredTeacherAdminListView
urlpatterns = patterns('kcdc3.apps.classes.views',
... | Python | 0 |
80afbf3b5be1716553b93ee6ba57404d40e43a94 | Remove multiple workers | gunicorn_conf.py | gunicorn_conf.py | accesslog = '-'
access_log_format = '%({Host}i)s %(h)s %(l)s "%({X-Remote-User-Id}o)s: %({X-Remote-User-Name}o)s" %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s'
| accesslog = '-'
access_log_format = '%({Host}i)s %(h)s %(l)s "%({X-Remote-User-Id}o)s: %({X-Remote-User-Name}o)s" %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s'
workers = 3
| Python | 0.003335 |
67346a13eb40d605da498b0bdba25ca661f08dd1 | Remove unused imports | geotrek/feedback/templatetags/feedback_tags.py | geotrek/feedback/templatetags/feedback_tags.py | import json
from geotrek.feedback.models import PredefinedEmail, ReportStatus
from django import template
from django.conf import settings
register = template.Library()
@register.simple_tag
def suricate_management_enabled():
return settings.SURICATE_MANAGEMENT_ENABLED
@register.simple_tag
def suricate_workflo... | import json
from geotrek.feedback.models import PredefinedEmail, ReportStatus
from mapentity.models import LogEntry
from django import template
from django.conf import settings
register = template.Library()
@register.simple_tag
def suricate_management_enabled():
return settings.SURICATE_MANAGEMENT_ENABLED
@re... | Python | 0.000001 |
f4b7426103d2b484501a3bfdff3ebe976216b882 | Make a nice description of the module. (../port-add-product_multi_company_7.0-bis-jge/ rev 213.5.7) | product_price_history/__openerp__.py | product_price_history/__openerp__.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright 2013 Camptocamp SA
# Author: Joel Grand-Guillaume
#
# This program is free software: you can redistribute it and/or modify
# it under the terms o... | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright 2013 Camptocamp SA
# Author: Joel Grand-Guillaume
#
# This program is free software: you can redistribute it and/or modify
# it under the terms o... | Python | 0.000001 |
eb712d30a6231b416e33d02a125daddf5322d51e | Add API docs for the Exscript.util.syslog module. | src/Exscript/util/syslog.py | src/Exscript/util/syslog.py | # Copyright (C) 2007-2010 Samuel Abels.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2, as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANT... | import imp, socket
# This way of loading a module prevents Python from looking in the
# current directory. (We need to avoid it due to the syslog module
# name collision.)
syslog = imp.load_module('syslog', *imp.find_module('syslog'))
def netlog(message,
source = None,
host = 'localhost',
... | Python | 0 |
e05243983cb9167303a19e85a3c88f74da8e2612 | Convert ipLocation function name to all lowercase | bot/slack/commands/ip_info.py | bot/slack/commands/ip_info.py | import netaddr
import os
from mozdef_util.geo_ip import GeoIP
def is_ip(ip):
try:
netaddr.IPNetwork(ip)
return True
except Exception:
return False
def ip_location(ip):
location = ""
try:
geoip_data_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "../..... | import netaddr
import os
from mozdef_util.geo_ip import GeoIP
def is_ip(ip):
try:
netaddr.IPNetwork(ip)
return True
except Exception:
return False
def ipLocation(ip):
location = ""
try:
geoip_data_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "../../... | Python | 1 |
859d5cd5ac60785f64a87353ae8f9170f5e29100 | Make uri absolute, add get_release_data api | folivora/utils/pypi.py | folivora/utils/pypi.py | #-*- coding: utf-8 -*-
"""
folivora.utils.pypi
~~~~~~~~~~~~~~~~~~~
Utilities to access pypi compatible servers.
"""
import time
import xmlrpclib
def get_seconds(hours):
"""Get number of seconds since epoch from now minus `hours`"""
return int(time.time() - (60 * 60) * hours)
DEFAULT_SERVER = 'h... | #-*- coding: utf-8 -*-
"""
folivora.utils.pypi
~~~~~~~~~~~~~~~~~~~
Utilities to access pypi compatible servers.
"""
import time
import xmlrpclib
def get_seconds(hours):
"""Get number of seconds since epoch from now minus `hours`"""
return int(time.time() - (60 * 60) * hours)
XML_RPC_SERVER = 'h... | Python | 0 |
30b991e78158f8dee25a34565493b1ca582d51c5 | Simplify attribute check (menu items) | cmsplugin_zinnia/cms_toolbar.py | cmsplugin_zinnia/cms_toolbar.py | """Toolbar extensions for CMS"""
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from cms.toolbar_base import CMSToolbar
from cms.toolbar_pool import toolbar_pool
class ZinniaToolbar(CMSToolbar):
def populate(self):
user = self.request.user
zi... | """Toolbar extensions for CMS"""
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from cms.toolbar_base import CMSToolbar
from cms.toolbar_pool import toolbar_pool
class ZinniaToolbar(CMSToolbar):
def populate(self):
user = self.request.user
zi... | Python | 0 |
b3f926e013e81bb88e6634d453b31c5c30aac997 | Add constant to distance scoring functions | cocoscore/ml/distance_scores.py | cocoscore/ml/distance_scores.py | from math import exp
def _distance_scorer(data_df, score_function):
distance_column = 'distance'
if distance_column not in data_df.columns:
raise ValueError(f'The given data_df does not have a {distance_column} column.')
distances = data_df.loc[:, distance_column]
return distances.apply(score_... | from math import exp
def _distance_scorer(data_df, score_function):
distance_column = 'distance'
if distance_column not in data_df.columns:
raise ValueError(f'The given data_df does not have a {distance_column} column.')
distances = data_df.loc[:, distance_column]
return distances.apply(score_... | Python | 0.000348 |
a23a9c4e5cd06ff6239a24e55ca7c4c598d02b27 | Fix broken Glance cleanup context | rally/benchmark/context/cleaner.py | rally/benchmark/context/cleaner.py | # Copyright 2014: Mirantis Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | # Copyright 2014: Mirantis Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | Python | 0.000064 |
a668300c2e038b40b2ea6bbc51cb47598f4a5688 | Use AwesomeVersion for account link service check (#55449) | homeassistant/components/cloud/account_link.py | homeassistant/components/cloud/account_link.py | """Account linking via the cloud."""
import asyncio
import logging
from typing import Any
import aiohttp
from awesomeversion import AwesomeVersion
from hass_nabucasa import account_link
from homeassistant.const import __version__ as HA_VERSION
from homeassistant.core import HomeAssistant, callback
from homeassistant.... | """Account linking via the cloud."""
import asyncio
import logging
from typing import Any
import aiohttp
from hass_nabucasa import account_link
from homeassistant.const import MAJOR_VERSION, MINOR_VERSION, PATCH_VERSION
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers import config_en... | Python | 0 |
33dd1a78a5bfdf0eca593816b15b34b86860c36f | install pip to bypass rally installation problem | lab/runners/RunnerRally.py | lab/runners/RunnerRally.py | from lab.runners import Runner
class RunnerRally(Runner):
def sample_config(self):
return {'cloud': 'cloud name', 'task-yaml': 'path to the valid task yaml file'}
def __init__(self, config):
from lab.WithConfig import read_config_from_file
super(RunnerRally, self).__init__(config=co... | from lab.runners import Runner
class RunnerRally(Runner):
def sample_config(self):
return {'cloud': 'cloud name', 'task-yaml': 'path to the valid task yaml file'}
def __init__(self, config):
from lab.WithConfig import read_config_from_file
super(RunnerRally, self).__init__(config=co... | Python | 0 |
2c5d3387f23eaff6a689aad46b7b117f3a54bed1 | Fix wake_on_lan ping for Linux. (#6480) | homeassistant/components/switch/wake_on_lan.py | homeassistant/components/switch/wake_on_lan.py | """
Support for wake on lan.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/switch.wake_on_lan/
"""
import logging
import platform
import subprocess as sp
import voluptuous as vol
from homeassistant.components.switch import (SwitchDevice, PLATFORM_SCHE... | """
Support for wake on lan.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/switch.wake_on_lan/
"""
import logging
import platform
import subprocess as sp
import voluptuous as vol
from homeassistant.components.switch import (SwitchDevice, PLATFORM_SCHE... | Python | 0 |
c5fff613e5b860d3df51fa45189d379c3e1aeb68 | Support for namespace in graphite bridge #49 | prometheus_client/bridge/graphite.py | prometheus_client/bridge/graphite.py | #!/usr/bin/python
from __future__ import unicode_literals
import logging
import re
import socket
import time
import threading
from .. import core
# Roughly, have to keep to what works as a file name.
# We also remove periods, so labels can be distinguished.
_INVALID_GRAPHITE_CHARS = re.compile(r"[^a-zA-Z0-9_-]")
d... | #!/usr/bin/python
from __future__ import unicode_literals
import logging
import re
import socket
import time
import threading
from .. import core
# Roughly, have to keep to what works as a file name.
# We also remove periods, so labels can be distinguished.
_INVALID_GRAPHITE_CHARS = re.compile(r"[^a-zA-Z0-9_-]")
d... | Python | 0 |
a390d2551a5e39ad35888c4b326f50212b60cabf | add description of exception | eventbus/exception.py | eventbus/exception.py | __author__ = 'Xsank'
class EventTypeError(Exception):
'''Event type is invalid!'''
def __str__(self):
return self.__doc__
class UnregisterError(Exception):
'''No listener to unregister!'''
def __str__(self):
return self.__doc__ | __author__ = 'Xsank'
class EventTypeError(Exception):
'''Event type is invalid!'''
class UnregisterError(Exception):
'''No listener to unregister!''' | Python | 0.000002 |
0f1fdb93c8005a26fcea10f708252a9e5f358270 | add compare string in JRC | src/JRCFileParserService.py | src/JRCFileParserService.py | '''
Created on Jan 30, 2017
@author: Subhasis
'''
import csv
from MongoManager import MongoManager
class JRCFileParserService(object):
'''
This class takes care of reading the input file parsing the text line by line and pushing it into MongoDB.
'''
def __init__(self, file_path, db_config, schema, t... | '''
Created on Jan 30, 2017
@author: Subhasis
'''
import csv
from MongoManager import MongoManager
class JRCFileParserService(object):
'''
This class takes care of reading the input file parsing the text line by line and pushing it into MongoDB.
'''
def __init__(self, file_path, db_config, schema, t... | Python | 0.00002 |
0ff9ccacf20d2896353df906426db06ce8c24605 | Update ASIC count from 7 to 10 | scripts/avalon3-a3233-modular-test.py | scripts/avalon3-a3233-modular-test.py | #!/usr/bin/env python2.7
# This simple script was for test A3255 modular. there are 128 cores in one A3255 chip.
# If all cores are working the number should be 0.
# If some of them not working the number is the broken cores count.
from serial import Serial
from optparse import OptionParser
import binascii
import sys... | #!/usr/bin/env python2.7
# This simple script was for test A3255 modular. there are 128 cores in one A3255 chip.
# If all cores are working the number should be 0.
# If some of them not working the number is the broken cores count.
from serial import Serial
from optparse import OptionParser
import binascii
import sys... | Python | 0.000013 |
1b704c24eaeb412e0636e5a0111ce2ac990998fd | remove confirm_text option in example | example/app/tables.py | example/app/tables.py | #!/usr/bin/env python
# coding: utf-8
from table.columns import Column, LinkColumn, Link
from table.utils import A
from table import Table
from models import Person
class PersonTable(Table):
id = Column(field='id', header=u'序号', header_attrs={'width': '50%'})
name = Column(field='name', header=u'姓名', header_... | #!/usr/bin/env python
# coding: utf-8
from table.columns import Column, LinkColumn, Link
from table.utils import A
from table import Table
from models import Person
class PersonTable(Table):
id = Column(field='id', header=u'序号', header_attrs={'width': '50%'})
name = Column(field='name', header=u'姓名', header_... | Python | 0 |
1591faf725844ae76bdf0a4343837e1c3d2e16c0 | update weight clipping params | common/models/discriminators.py | common/models/discriminators.py | import numpy as np
import math
import chainer
import chainer.functions as F
import chainer.links as L
from chainer import cuda, optimizers, serializers, Variable
from chainer import function
from chainer.utils import type_check
from .ops import *
class DCGANDiscriminator(chainer.Chain):
def __init__(self, in_ch=3... | import numpy as np
import math
import chainer
import chainer.functions as F
import chainer.links as L
from chainer import cuda, optimizers, serializers, Variable
from chainer import function
from chainer.utils import type_check
from .ops import *
class DCGANDiscriminator(chainer.Chain):
def __init__(self, in_ch=3... | Python | 0 |
cb34162de51f36e2d6b846cfbb6e9d6fe8801e48 | implement send message | client/client.py | client/client.py | class OTC_Client(object):
def __init__(self):
raise NotImplementedError("TODO: write a client")
def send(message):
payload = {'message':message}
r = requets.post(self.server_address,data=payload)
raise NotImplementedError("TODO: write send method")
def recieve():
rai... | class OTC_Client(object):
def __init__(self):
raise NotImplementedError("TODO: write a client")
def send(message):
raise NotImplementedError("TODO: write send method")
def recieve():
raise NotImplementedError("TODO: write recieve")
def decrypt(message, pad_index=current_index):
... | Python | 0.000029 |
f1ed9cf573ec8aaa61e9aefb124b453a5a353db4 | fix pointe-claire | ca_qc_pointe_claire/people.py | ca_qc_pointe_claire/people.py | from pupa.scrape import Scraper
from utils import lxmlize, CanadianLegislator as Legislator
import re
COUNCIL_PAGE = 'http://www.ville.pointe-claire.qc.ca/en/city-hall-administration/your-council/municipal-council.html'
class PointeClairePersonScraper(Scraper):
def get_people(self):
page = lxmlize(COUNCIL_P... | from pupa.scrape import Scraper
from utils import lxmlize, CanadianLegislator as Legislator
import re
COUNCIL_PAGE = 'http://www.ville.pointe-claire.qc.ca/en/city-hall-administration/your-council/municipal-council.html'
class PointeClairePersonScraper(Scraper):
def get_people(self):
page = lxmlize(COUNCIL_P... | Python | 0.000092 |
9a3081c58818ad28e216e9a14fc573c4a392f55f | Add method for getting csv Hours Worked reports for Jobs Board and Payment Plan | invoice/management/commands/ticket_time_csv.py | invoice/management/commands/ticket_time_csv.py | # -*- encoding: utf-8 -*-
import csv
import os
from django.core.management.base import BaseCommand
from invoice.models import TimeRecord
class Command(BaseCommand):
help = "Export ticket time to a CSV file"
def _jobs_board_tickets(self):
return (
732,
746,
7... | # -*- encoding: utf-8 -*-
import csv
import os
from django.core.management.base import BaseCommand
from invoice.models import TimeRecord
class Command(BaseCommand):
help = "Export ticket time to a CSV file"
def handle(self, *args, **options):
"""Export ticket time to a CSV file.
Columns:
... | Python | 0 |
a3db681a63a5908d38ca5fcac4bdd96f5e4fed7e | use typing.TYPE_CHECKING to avoid flake8 failure (#398) | launch/launch/event_handlers/on_execution_complete.py | launch/launch/event_handlers/on_execution_complete.py | # Copyright 2019 Open Source Robotics Foundation, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | # Copyright 2019 Open Source Robotics Foundation, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | Python | 0 |
8fa0ca6a307f7b23545d297d17f8eb05f037978f | fix one e2e test problem (#459) | test/e2e/utils.py | test/e2e/utils.py | # Copyright 2019 kubeflow.org.
#
# 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 kubeflow.org.
#
# 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.000001 |
0097a4022ec8ab57e76c86bd202dd7a5fad8a076 | Revert to original | cardiffshop/products/admin.py | cardiffshop/products/admin.py | from products.models import Product, Category, ProductImage
from django.conf import settings
from django.contrib import admin
from django.contrib.admin import SimpleListFilter
from suit.admin import SortableTabularInline
class CanBeSoldListFilter(SimpleListFilter):
title = "Can be sold"
parameter_name = "can_... | from products.models import Product, Category, ProductImage
from django.conf import settings
from django.contrib import admin
from django.contrib.admin import SimpleListFilter
from suit.admin import SortableTabularInline
class CanBeSoldListFilter(SimpleListFilter):
title = "Can be sold"
parameter_name = "can_... | Python | 0.999647 |
618c5bd2dee90565a97ab744f620ae8de4a74b91 | refactor plymouth importer to use get_srid() | polling_stations/apps/data_collection/management/commands/import_plymouth.py | polling_stations/apps/data_collection/management/commands/import_plymouth.py | """
Imports Plymouth
"""
from django.contrib.gis.geos import Point, GEOSGeometry
from data_collection.management.commands import BaseKamlImporter
from data_collection.google_geocoding_api_wrapper import (
GoogleGeocodingApiWrapper,
PostcodeNotFoundException
)
class Command(BaseKamlImporter):
"""
Impo... | """
Imports Plymouth
"""
from django.contrib.gis.geos import Point, GEOSGeometry
from data_collection.management.commands import BaseKamlImporter
from data_collection.google_geocoding_api_wrapper import (
GoogleGeocodingApiWrapper,
PostcodeNotFoundException
)
class Command(BaseKamlImporter):
"""
Impo... | Python | 0 |
49be60d27b5d5ce40c20847f79a8dd09f580a830 | Update _var_dump.py | var_dump/_var_dump.py | var_dump/_var_dump.py | from __future__ import print_function
import sys
try:
from types import NoneType
except:
NoneType = type(None)
if sys.version_info > (3,):
long = int
unicode = str
__author__ = "Shamim Hasnath"
__copyright__ = "Copyright 2013, Shamim Hasnath"
__license__ = "BSD License"
__version__ = "1.0.1"
... | from __future__ import print_function
import sys
try:
from types import NoneType
except:
NoneType = type(None)
if sys.version_info > (3,):
long = int
unicode = str
__author__ = "Shamim Hasnath"
__copyright__ = "Copyright 2013, Shamim Hasnath"
__license__ = "BSD License"
__version__ = "1.0.1"
... | Python | 0.000005 |
206696e82f3e5be4a64e60abdb59ca51d2b1461e | Add a test for rgb+mp to verify that it continues to work. | pysc2/tests/multi_player_env_test.py | pysc2/tests/multi_player_env_test.py | #!/usr/bin/python
# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | #!/usr/bin/python
# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | Python | 0 |
48e3dab4ce044554b0ff606dea340ff8b6e5d928 | Update __init__.py | edbo_connector/__init__.py | edbo_connector/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
edbo_connector
Author: Eldar Aliiev
Email: e.aliiev@vnmu.edu.ua
"""
from .client import EDBOWebApiClient
__name__ = 'python-edbo-connector'
__author__ = 'Eldar Aliiev'
__copyright__ = 'Copyright 2018, National Pirogov Memorial Medical University, Vinnytsya'
__credits... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
edbo_connector
Author: Eldar Aliiev
Email: e.aliiev@vnmu.edu.ua
"""
from .client import EDBOWebApiClient
__name__ = 'python-edbo-connector'
__author__ = 'Eldar Aliiev'
__copyright__ = 'Copyright 2018, National Pirogov Memorial Medical University, Vinnytsya'
__credits... | Python | 0.000072 |
949934ea7a34fcd71f65118b741a51a28e815e5d | update from trunk r9256 | pywikibot/families/wowwiki_family.py | pywikibot/families/wowwiki_family.py | # -*- coding: utf-8 -*-
__version__ = '$Id$'
from pywikibot import family
class Family(family.Family):
def __init__(self):
family.Family.__init__(self)
self.name = 'wowwiki'
self.langs = {
'cs': 'cs.wow.wikia.com',
'da': 'da.wowwiki.com',
'de': 'de.w... | # -*- coding: utf-8 -*-
__version__ = '$Id$'
from pywikibot import family
class Family(family.Family):
def __init__(self):
family.Family.__init__(self)
self.name = 'wowwiki'
self.langs = {
'cs': 'cs.wow.wikia.com',
'da': 'da.wowwiki.com',
'de': 'de.w... | Python | 0 |
c95c222384c2c0d887d435017196c9af4137d1b2 | set numba parallel option | hpat/__init__.py | hpat/__init__.py | from __future__ import print_function, division, absolute_import
import numba
from numba import *
from .compiler import add_hpat_stages
set_user_pipeline_func(add_hpat_stages)
del add_hpat_stages
def jit(signature_or_function=None, **options):
# set nopython by default
if 'nopython' not in options:
o... | from __future__ import print_function, division, absolute_import
import numba
from numba import *
from .compiler import add_hpat_stages
set_user_pipeline_func(add_hpat_stages)
del add_hpat_stages
def jit(signature_or_function=None, **options):
# set nopython by default
if 'nopython' not in options:
o... | Python | 0.000002 |
80d3fe7d2c69fd960a5b585d60085f33e109e455 | solution found text incorrect | simbad/command_line/simbad_lattice.py | simbad/command_line/simbad_lattice.py | #!/usr/bin/env python
__author__ = "Felix Simkovic & Adam Simpkin"
__date__ = "06 Mar 2017"
__version__ = "0.1"
import argparse
import os
import platform
import sys
import time
import simbad.command_line
import simbad.util.exit_util
import simbad.util.simbad_util
import simbad.version
__version__ = simbad.version._... | #!/usr/bin/env python
__author__ = "Felix Simkovic & Adam Simpkin"
__date__ = "06 Mar 2017"
__version__ = "0.1"
import argparse
import os
import platform
import sys
import time
import simbad.command_line
import simbad.util.exit_util
import simbad.util.simbad_util
import simbad.version
__version__ = simbad.version._... | Python | 0.999998 |
77651861fc5a27d1d62293e3bc66d62ae193221d | add tolerance option to F.sqrt | tests/chainer_tests/functions_tests/math_tests/test_sqrt.py | tests/chainer_tests/functions_tests/math_tests/test_sqrt.py | import unittest
import numpy
import chainer.functions as F
from chainer import testing
# sqrt
def make_data(shape, dtype):
x = numpy.random.uniform(0.1, 5, shape).astype(dtype)
gy = numpy.random.uniform(-1, 1, shape).astype(dtype)
ggx = numpy.random.uniform(-1, 1, shape).astype(dtype)
return x, gy,... | import unittest
import numpy
import chainer.functions as F
from chainer import testing
# sqrt
def make_data(shape, dtype):
x = numpy.random.uniform(0.1, 5, shape).astype(dtype)
gy = numpy.random.uniform(-1, 1, shape).astype(dtype)
ggx = numpy.random.uniform(-1, 1, shape).astype(dtype)
return x, gy,... | Python | 0.000003 |
cc17390eada091da34fed92ee7e2090adc1fa87e | Fix for `plot_field` function failing on non-square grids #666 | examples/cfd/tools.py | examples/cfd/tools.py | from mpl_toolkits.mplot3d import Axes3D # noqa
import numpy as np
from matplotlib import pyplot, cm
def plot_field(field, xmax=2., ymax=2., zmax=None, view=None, linewidth=0):
"""Utility plotting routine for 2D data
:param field: Numpy array with field data to plot
:param xmax: (Optional) Length of the... | from mpl_toolkits.mplot3d import Axes3D # noqa
import numpy as np
from matplotlib import pyplot, cm
def plot_field(field, xmax=2., ymax=2., zmax=None, view=None, linewidth=0):
"""Utility plotting routine for 2D data
:param field: Numpy array with field data to plot
:param xmax: (Optional) Length of the... | Python | 0 |
173317003a59afb639e6f4f5d5eca41a1f390979 | Revise q05 to successfully use partial derivatives of u and v for gradient descent of E (error). | hw05/hw05ex05.py | hw05/hw05ex05.py | # dE/du (u e^v - 2v e^(-u))^2 = 2 (u e^v - 2v e^(-u))(e^v + 2v e^(-u))
#from decimal import Decimal
from math import sqrt, exp, fabs #natural exponent, e**x. and absolute value
def calcEwrtu(u,v):
'''
Given u and v, the hypothesis and the target function,
return the partial deriv w.r.t. u for gradient des... | # dE/du (u e^v - 2v e^(-u))^2 = 2 (u e^v - 2v e^(-u))(e^v + 2v e^(-u))
#from decimal import Decimal
from math import exp #natural exponent, e**x
def calcE(u,v):
return 2 * ( u*exp(v) - 2*v*exp(-u) ) * ( exp(v) + 2*v*exp(-u) )
i = 0
eta = 0.1 # u"\u03B7"
#E = float(10^(-14))
#E = 10^(-14)
#E = Decimal(0.0000000000... | Python | 0 |
61609c6b1a93316c1b8a5e512ed310a38d6c772b | Add gss_mnist description | examples/gss_mnist.py | examples/gss_mnist.py | import torch
import torch.nn as nn
from torch.nn import CrossEntropyLoss
from torch.optim import SGD
from avalanche.benchmarks import Experience
from avalanche.benchmarks.classic import SplitMNIST
from avalanche.benchmarks.generators.benchmark_generators import \
data_incremental_benchmark
from avalanche.benchmark... | import torch
import torch.nn as nn
from torch.nn import CrossEntropyLoss
from torch.optim import SGD
from avalanche.benchmarks import Experience
from avalanche.benchmarks.classic import SplitMNIST
from avalanche.benchmarks.generators.benchmark_generators import \
data_incremental_benchmark
from avalanche.benchmark... | Python | 0.000003 |
c0eedfeca0e19a65e4484e63790319cf18433343 | change optimizer in example | examples/mnist_mlp.py | examples/mnist_mlp.py | '''Trains a simple deep NN on the MNIST dataset.
Gets to 98.40% test accuracy after 20 epochs
(there is *a lot* of margin for parameter tuning).
2 seconds per epoch on a K520 GPU.
'''
from __future__ import print_function
import numpy as np
np.random.seed(1337) # for reproducibility
from keras.datasets import mnist... | '''Trains a simple deep NN on the MNIST dataset.
Gets to 98.40% test accuracy after 20 epochs
(there is *a lot* of margin for parameter tuning).
2 seconds per epoch on a K520 GPU.
'''
from __future__ import print_function
import numpy as np
np.random.seed(1337) # for reproducibility
from keras.datasets import mnist... | Python | 0 |
a5be3784d0cfce42c0cdb6bc83b37a07dff7a164 | Implement accuracy on GPU | chainer/functions/accuracy.py | chainer/functions/accuracy.py | import numpy
from pycuda import gpuarray
from chainer import cuda, Function
class Accuracy(Function):
"""Compute accuracy within minibatch."""
def forward_cpu(self, inputs):
y, t = inputs
y = y.reshape(y.shape[0], y.size / y.shape[0]) # flatten
pred = y.argmax(axis=1)
return (... | import numpy
from chainer import cuda, Function
class Accuracy(Function):
"""Compute accuracy within minibatch."""
def forward_cpu(self, inputs):
y, t = inputs
y = y.reshape(y.shape[0], y.size / y.shape[0]) # flatten
pred = y.argmax(axis=1)
return (pred == t).mean(dtype=numpy.... | Python | 0.000008 |
f3c5a477141e5f3845641111f775ea90398be633 | Add numpy.ndarray and cupy.ndarray as input type | chainer/functions/math/erf.py | chainer/functions/math/erf.py | import math
import warnings
import numpy
import chainer
from chainer import cuda
from chainer import function_node
from chainer import utils
from chainer.utils import type_check
_erf_cpu = None
class Erf(function_node.FunctionNode):
@property
def label(self):
return 'erf'
def check_type_forw... | import math
import warnings
import numpy
import chainer
from chainer import cuda
from chainer import function_node
from chainer import utils
from chainer.utils import type_check
_erf_cpu = None
class Erf(function_node.FunctionNode):
@property
def label(self):
return 'erf'
def check_type_forw... | Python | 0.000127 |
0eeacf39140ae204bcea59a497acb8e58d949f5a | Remove unused relation join | changes/utils/originfinder.py | changes/utils/originfinder.py | from __future__ import absolute_import
from collections import defaultdict
from sqlalchemy.orm import subqueryload_all
from changes.config import db
from changes.constants import Result, Status
from changes.models import Build, Job, TestGroup, Source
def first(key, iterable):
for x in iterable:
if key(x... | from __future__ import absolute_import
from collections import defaultdict
from sqlalchemy.orm import subqueryload_all
from changes.config import db
from changes.constants import Result, Status
from changes.models import Build, Job, TestGroup, Source
def first(key, iterable):
for x in iterable:
if key(x... | Python | 0.000001 |
569e21f9ad9f9668c7dcfcd4dba64806c9c07d7d | Support origination contexts in V2. | ambassador/ambassador/envoy/v2/v2cluster.py | ambassador/ambassador/envoy/v2/v2cluster.py | # Copyright 2018 Datawire. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | # Copyright 2018 Datawire. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | Python | 0 |
95d6c63dfd527f3ffc19a713b2a2dfa2b97dfb1a | remove unnecessary lines | client/python/modeldb/tests/sklearn/testRandomSplitEvent.py | client/python/modeldb/tests/sklearn/testRandomSplitEvent.py | import unittest
import sys
from ModelDbSyncerTest import SyncerTest
import modeldb.tests.utils as utils
from modeldb.thrift.modeldb import ttypes as modeldb_types
from modeldb.sklearn_native.ModelDbSyncer import *
from modeldb.sklearn_native import SyncableRandomSplit
import pandas as pd
import random
class TestRand... | import unittest
import sys
from ModelDbSyncerTest import SyncerTest
import modeldb.tests.utils as utils
from modeldb.thrift.modeldb import ttypes as modeldb_types
from modeldb.sklearn_native.ModelDbSyncer import *
from modeldb.sklearn_native import SyncableRandomSplit
import pandas as pd
import random
FMIN = sys.flo... | Python | 0.999144 |
8c4a54690cb99b63a9cf825e2958bb2b48cd7e5d | Complete lc009_palindrome_number.py | lc009_palindrome_number.py | lc009_palindrome_number.py | """Leetcode 9. Palindrome Number
Easy
Determine whether an integer is a palindrome. An integer is a palindrome when
it reads the same backward as forward.
Example 1:
Input: 121
Output: true
Example 2:
Input: -121
Output: false
Explanation: From left to right, it reads -121. From right to left, it becomes
121-. The... | """Leetcode 9. Palindrome Number
Easy
Determine whether an integer is a palindrome. An integer is a palindrome when
it reads the same backward as forward.
Example 1:
Input: 121
Output: true
Example 2:
Input: -121
Output: false
Explanation: From left to right, it reads -121. From right to left, it becomes
121-. The... | Python | 0.999989 |
d325ed4aade30378e050cf2443081a86a6d4438c | Revise to var min_hq | lc0253_meeting_rooms_ii.py | lc0253_meeting_rooms_ii.py | """Leetcode 253. Meeting Rooms II (Premium)
Medium
URL: https://leetcode.com/problems/meeting-rooms-ii
Given an array of meeting time intervals consisting of start and end times
[[s1,e1],[s2,e2],...] (si < ei),
find the minimum number of conference rooms required.
Example1
Input: intervals = [[0,30],[5,10],[15,20]]
... | """Leetcode 253. Meeting Rooms II (Premium)
Medium
URL: https://leetcode.com/problems/meeting-rooms-ii
Given an array of meeting time intervals consisting of start and end times
[[s1,e1],[s2,e2],...] (si < ei),
find the minimum number of conference rooms required.
Example1
Input: intervals = [[0,30],[5,10],[15,20]]
... | Python | 0.001577 |
a2dcb94726d0bcc58b08eddcab6ebf433778af2c | Fix error handler to correct view. | zoll_me/urls.py | zoll_me/urls.py | '''
James D. Zoll
1/20/2013
Purpose: Defines URL rules for the project.
License: This is a public work.
'''
# Library Imports
from django.conf.urls import patterns, include, url
from django.conf import settings
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^admin/', in... | '''
James D. Zoll
1/20/2013
Purpose: Defines URL rules for the project.
License: This is a public work.
'''
# Library Imports
from django.conf.urls import patterns, include, url
from django.conf import settings
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^admin/', in... | Python | 0 |
9e9f831a757af01cc3b1edfe590e27f7ab53c2ce | define interfaces | zvmsdk/vmops.py | zvmsdk/vmops.py |
from log import LOG
import utils as zvmutils
VMOPS = None
def _get_vmops():
if VMOPS is None:
VMOPS = VMOps()
return VMOPS
def run_instance(instance_name, image_id, cpu, memory,
login_password, ip_addr):
"""Deploy and provision a virtual machine.
Input parameters:
:... |
from log import LOG
import utils as zvmutils
class VMOps(object):
def __init__(self):
self._xcat_url = zvmutils.get_xcat_url()
def _power_state(self, instance_name, method, state):
"""Invoke xCAT REST API to set/get power state for a instance."""
body = [state]
url = self._x... | Python | 0.000003 |
dfaa289465a2cdc837884718624b9a8a65e511b3 | Improve proxy rax example | examples/proxy_rax.py | examples/proxy_rax.py | import random
import sc2
from sc2 import Race, Difficulty
from sc2.constants import *
from sc2.player import Bot, Computer
class ProxyRaxBot(sc2.BotAI):
async def on_step(self, state, iteration):
cc = self.units(COMMANDCENTER)
if not cc.exists:
target = self.known_enemy_structures.rand... | import random
import sc2
from sc2 import Race, Difficulty
from sc2.constants import *
from sc2.player import Bot, Computer
class ProxyRaxBot(sc2.BotAI):
async def on_step(self, state, iteration):
cc = self.units(COMMANDCENTER)
if not cc.exists:
target = self.known_enemy_structures.rand... | Python | 0.000001 |
a4b7878880f5a8d275129949179b4b30044f0c86 | Update __init__.py | eniric_scripts/__init__.py | eniric_scripts/__init__.py | __all__ = [
"bary_shift_atmmodel",
"phoenix_precision",
"precision_four_panel",
"split_atmmodel",
]
| __all__ = [
"bary_shift_atmmodel",
"phoenix_precision.py",
"precision_four_panel",
"split_atmmodel",
]
| Python | 0.000072 |
39f50aadc98f493a32810af0ba4d0fd87c8108e1 | Update runsegment.py | bin/runsegment.py | bin/runsegment.py | #!/usr/bin/python
import os
import numpy as np
import shutil
import common
from segment import normalizefile, segmentfile
def runAll(args):
print('\n\n\nYou have requested to normalize and segment bincounts files')
print('\tWARNING:')
print('\t\tIF USING ANY REFERENCES OTHER THAN THOSE I PROVIDE I CAN... | #!/usr/bin/python
import os
import numpy as np
import shutil
import common
from segment import normalizefile, segmentfile
def runAll(args):
print('\n\n\nYou have requested to normalize and segment bincounts files')
print('\tWARNING:')
print('\t\tIF USING ANY REFERENCES OTHER THAN THOSE I PROVIDE I CAN... | Python | 0.000001 |
10d5e90e65e792d0fae3879dd5f512bdc7b95da6 | Add missing dependency to perl-xml-parser (#12903) | var/spack/repos/builtin/packages/perl-xml-parser/package.py | var/spack/repos/builtin/packages/perl-xml-parser/package.py | # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
#
from spack import *
class PerlXmlParser(PerlPackage):
"""XML::Parser - A perl module for parsing XML documents"""
... | # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
#
from spack import *
class PerlXmlParser(PerlPackage):
"""XML::Parser - A perl module for parsing XML documents"""
... | Python | 0.000025 |
26209ff0457c466ee3b95dad8d905edc5220a576 | update class and add additional frame for future actions | bin/slacksible.py | bin/slacksible.py | #! /Users/jhefner/python_dev/uw_python/project/bin/python
from slackclient import SlackClient
import os
import sys
# import logging
# TODOS:
# * create logs:
# 1. Debug log. slacksible_debug.log (10)
# 2. stderr log. slacksible_stderr.log (40)
# 3. usage log. slacksible_metrics.log
# *... | #! /Users/jhefner/python_dev/uw_python/project/bin/python
from slackclient import SlackClient
import os
import sys
# import logging
# TODOS:
# * create logs:
# 1. Debug log. slacksible_debug.log (10)
# 2. stderr log. slacksible_stderr.log (40)
def test():
sc.api_call(
"chat.postMessag... | Python | 0 |
0153a20201cfeff37512733b2e85106f69ba5f47 | replace use of 'unicode' builtin | monasca_log_api/app/base/model.py | monasca_log_api/app/base/model.py | # Copyright 2016 FUJITSU LIMITED
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | # Copyright 2016 FUJITSU LIMITED
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | Python | 0.000617 |
ee75d9530bb6b9e409449c8e9d5ffb3a3578f5d8 | Fix not coloring for new repositories | bin/commands/stateextensions/status.py | bin/commands/stateextensions/status.py | import os
import re
import subprocess
from colorama import Fore
def title():
return 'status'
def accent(**kwargs):
new_repository = kwargs.get('new_repository', False)
show_color = kwargs.get('show_color', 'always')
if new_repository:
status_title = '{no_color}({green}master{no_color})'.f... | import os
import re
import subprocess
from colorama import Fore
def title():
return 'status'
def accent(**kwargs):
new_repository = kwargs.get('new_repository', False)
show_color = kwargs.get('show_color', 'always')
if new_repository:
status_title = '{no_color}({green}master{no_color})'.f... | Python | 0.000001 |
6258026193d52de5168007b833a2fd35c807b734 | fix main to pass until further dev is done | bin/slacksible.py | bin/slacksible.py | #! /Users/jhefner/python_dev/uw_python/project/bin/python
from slackclient import SlackClient
import os
import sys
# import logging
# TODOS:
# * create logs:
# 1. Debug log. slacksible_debug.log (10)
# 2. stderr log. slacksible_stderr.log (40)
# 3. usage log. slacksible_metrics.log
# *... | #! /Users/jhefner/python_dev/uw_python/project/bin/python
from slackclient import SlackClient
import os
import sys
# import logging
# TODOS:
# * create logs:
# 1. Debug log. slacksible_debug.log (10)
# 2. stderr log. slacksible_stderr.log (40)
# 3. usage log. slacksible_metrics.log
# *... | Python | 0 |
c0841b6a38fc042f95f931eead6bc5733d975644 | Update forms.py | cla_public/apps/base/forms.py | cla_public/apps/base/forms.py | # coding: utf-8
"Base forms"
from flask import render_template, current_app, request
from flask_wtf import Form
from flask.ext.babel import lazy_gettext as _, get_translations
from wtforms import TextAreaField, RadioField, SelectMultipleField, StringField, widgets
from wtforms.validators import InputRequired, Length
... | # coding: utf-8
"Base forms"
from flask import render_template, current_app, request
from flask_wtf import Form
from flask.ext.babel import lazy_gettext as _, get_translations
from wtforms import TextAreaField, RadioField, SelectMultipleField, StringField, widgets
from wtforms.validators import InputRequired, Length
... | Python | 0 |
c71730cf4f3d8937f0ef1608bf670c28ec44eb0b | Complete and prettified | Challenge3.py | Challenge3.py | # Exercise 3 (and Solution)
# Take a list, say for example this one:
# a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
# and write a program that prints out all the elements of the list that are less than 5.
# Extras:
# Instead of printing the elements one by one, make a new list that has all the elements less than 5 ... | # Exercise 3 (and Solution)
# Take a list, say for example this one:
# a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
# and write a program that prints out all the elements of the list that are less than 5.
# Extras:
# Instead of printing the elements one by one, make a new list that has all the elements less than 5 ... | Python | 0 |
d6f4d9b76d6f12cc9eae1614a33ebb9fa6aa1724 | Fix error handling on missing dest with unarchive | lib/ansible/runner/action_plugins/unarchive.py | lib/ansible/runner/action_plugins/unarchive.py | # (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>
# (c) 2013, Dylan Martin <dmartin@seattlecentral.edu>
#
# 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 v... | # (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>
# (c) 2013, Dylan Martin <dmartin@seattlecentral.edu>
#
# 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 v... | Python | 0 |
d4ee599fe9cd88315d129e036fb034111bfc2272 | Add types to common url parameters (#50000) | lib/ansible/utils/module_docs_fragments/url.py | lib/ansible/utils/module_docs_fragments/url.py | # -*- coding: utf-8 -*-
# Copyright: (c) 2018, John Barker <gundalow@redhat.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
class ModuleDocFragment(object):
# Standard files documentation fragment
DOCUMENTATION = r'''
options:
url:
description:
-... | # (c) 2018, John Barker<gundalow@redhat.com>
#
# 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 option) any later versio... | Python | 0 |
e9df15b0f084ed9e026a5de129b109a3c546f99c | Handle comments in parse tree. | src/libeeyore/parse_tree_to_cpp.py | src/libeeyore/parse_tree_to_cpp.py | from itertools import imap
import builtins
from cpp.cpprenderer import EeyCppRenderer
from environment import EeyEnvironment
from functionvalues import *
from languagevalues import *
from values import *
def parse_tree_string_to_values( string ):
return eval( string )
def remove_comments( ln ):
i = ln.find( "#" )... |
import builtins
from cpp.cpprenderer import EeyCppRenderer
from environment import EeyEnvironment
from values import *
def parse_tree_string_to_values( string ):
return eval( string )
def non_empty_line( ln ):
return ( ln.strip() != "" )
def parse_tree_to_cpp( parse_tree_in_fl, cpp_out_fl ):
env = EeyEnvironmen... | Python | 0 |
7d09f713b929f60cd62ce48de2e2a8f27aa4de45 | Fix unit tests. | Orange/tests/test_random_forest.py | Orange/tests/test_random_forest.py | import unittest
import Orange.data
import Orange.classification.random_forest as rf
from Orange.evaluation import scoring, testing
class RandomForestTest(unittest.TestCase):
def test_RandomForest(self):
table = Orange.data.Table('iris')
forest = rf.RandomForestLearner()
results = testing.... | import unittest
import Orange.data
import Orange.classification.random_forest as rf
from Orange.evaluation import scoring, testing
class RandomForestTest(unittest.TestCase):
def test_RandomForest(self):
table = Orange.data.Table('titanic')
forest = rf.RandomForestLearner()
results = testi... | Python | 0 |
7041d2649b08d961cf5c7c4c663282e55526f2eb | Update pictures.py | cogs/pictures.py | cogs/pictures.py | from discord.ext import commands
import copy
import requests
class Pic:
"""Мемасики и просто картинки."""
def __init__(self, bot):
self.bot = bot
self.pic_dir = 'pictures/'
self.pic_dict = {}
self.update_pics()
def update_pics(self):
file_list... | from discord.ext import commands
import copy
import requests
class Pic:
"""Мемасики и просто картинки."""
def __init__(self, bot):
self.bot = bot
self.pic_dir = 'pictures/'
self.pic_dict = {}
self.update_pics()
def update_pics(self):
file_list... | Python | 0 |
25f3da8409a6fe31eded302cd14a78b575ff2399 | Please lxml | cogs/saucenao.py | cogs/saucenao.py | from discord.ext import commands
from discord.ext.commands import Cog
from lxml import etree
from bot import BeattieBot
from context import BContext
class SauceNao(Cog):
sauce_url = "https://saucenao.com/search.php"
def __init__(self, bot: BeattieBot):
self.session = bot.session
self.parser ... | from discord.ext import commands
from discord.ext.commands import Cog
from lxml import etree
from bot import BeattieBot
from context import BContext
class SauceNao(Cog):
sauce_url = "https://saucenao.com/search.php"
def __init__(self, bot: BeattieBot):
self.session = bot.session
self.parser ... | Python | 0.998141 |
a6a78260b47f3a632564e7a80ce25b3b75e242e9 | Add sample code for API key authentication | examples/authentication.py | examples/authentication.py | '''A basic example of authentication requests within a hug API'''
import hug
# Several authenticators are included in hug/authentication.py. These functions
# accept a verify_user function, which can be either an included function (such
# as the basic username/bassword function demonstrated below), or logic of your
# ... | '''A basic example of authentication requests within a hug API'''
import hug
# Several authenticators are included in hug/authentication.py. These functions
# accept a verify_user function, which can be either an included function (such
# as the basic username/bassword function demonstrated below), or logic of your
# ... | Python | 0 |
73fc80dd8ece1f5ecb1fb529412cd97a804ffccd | Test fetch_emails_from_wiki command | remo/profiles/tests/test_commands.py | remo/profiles/tests/test_commands.py | import os
import tempfile
import json
import requests
import fudge
from django.conf import settings
from django.core import management, mail
from django.contrib.auth.models import User
from nose.tools import eq_, raises
from test_utils import TestCase
class CreateUserTest(TestCase):
"""
Tests for create_use... | import os
import tempfile
from django.conf import settings
from django.core import management, mail
from django.contrib.auth.models import User
from nose.tools import eq_
from test_utils import TestCase
class CreateUserTest(TestCase):
"""
Create tests for create_user management command
"""
def setUp... | Python | 0.000004 |
5d8929986d278d97e33d425ae10bee0d29631886 | Encode the hostname to a str | mopidy/frontends/http/__init__.py | mopidy/frontends/http/__init__.py | from __future__ import absolute_import
import logging
import pykka
from mopidy import exceptions, settings
try:
import cherrypy
except ImportError as import_error:
raise exceptions.OptionalDependencyError(import_error)
logger = logging.getLogger('mopidy.frontends.http')
class HttpFrontend(pykka.Threadin... | from __future__ import absolute_import
import logging
import pykka
from mopidy import exceptions, settings
try:
import cherrypy
except ImportError as import_error:
raise exceptions.OptionalDependencyError(import_error)
logger = logging.getLogger('mopidy.frontends.http')
class HttpFrontend(pykka.Threadin... | Python | 0.999999 |
6e660da290db674eebb0c353662e5400bc735397 | Update backplane demo to be py3 only | examples/backplane_demo.py | examples/backplane_demo.py | #!/usr/bin/python
import time
from guild.actor import *
from guild.components import Backplane, PublishTo, SubscribeTo, Printer
class Producer(Actor):
@process_method
def process(self):
self.output("hello")
@late_bind_safe
def output(self, value):
pass
Backplane("HELLO").start()
p... | #!/usr/bin/python
import time
from guild.actor import *
from guild.components import Backplane, PublishTo, SubscribeTo, Printer
class Producer(Actor):
@process_method
def process(self):
self.output("hello")
@late_bind_safe
def output(self, value):
pass
Backplane("HELLO").start()
p... | Python | 0 |
0b37c0f1cba1a6e89a63f9597d61383b81b1a2d9 | Fix typo | haas/client/network.py | haas/client/network.py | import json
from haas.client.base import ClientBase
class Network(ClientBase):
"""Consists of calls to query and manipulate network related
objects and relations.
"""
def list(self):
"""Lists all networks under HIL """
url = self.object_url('networks')
... | import json
from haas.client.base import ClientBase
class Network(ClientBase):
"""Consists of calls to query and manipulate network related
objects and relations.
"""
def list(self):
"""Lists all projects under HIL """
url = self.object_url('networks')
... | Python | 0.999999 |
56f6339401fe5f792915279d98f553f3415e2c62 | Fix module docstring (#163) | netdisco/discoverables/harmony.py | netdisco/discoverables/harmony.py | """Discover Harmony Hub remotes."""
from . import SSDPDiscoverable
class Discoverable(SSDPDiscoverable):
"""Add support for discovering Harmony Hub remotes"""
def get_entries(self):
"""Get all the Harmony uPnP entries."""
return self.find_by_device_description({
"manufacturer": "L... | """Discover Netgear routers."""
from . import SSDPDiscoverable
class Discoverable(SSDPDiscoverable):
"""Add support for discovering Harmony Hub remotes"""
def get_entries(self):
"""Get all the Harmony uPnP entries."""
return self.find_by_device_description({
"manufacturer": "Logit... | Python | 0 |
b5c5f9f0e97c9273c18936ea57ad866b4865fc68 | Revert 47344b | install/build.py | install/build.py | import distutils
import os
import shutil
import subprocess
import tempfile
import setuptools
from install import utils
minimum_cuda_version = 6050
minimum_cudnn_version = 2000
def check_cuda_version(compiler, settings):
out = build_and_run(compiler, '''
#include <cuda.h>
#include <stdio.h>
int mai... | import distutils
import os
import shutil
import subprocess
import tempfile
import setuptools
from install import utils
minimum_cuda_version = 6050
minimum_cudnn_version = 2000
def check_cuda_version(compiler, settings):
out = build_and_run(compiler, '''
#include <cuda.h>
#include <stdio.h>
int mai... | Python | 0.000001 |
d3425693d245c9dfa5350017903fc02a11ecd881 | use width/height as percent base for x/y | compiler/lang.py | compiler/lang.py | import re
def value_is_trivial(value):
if value is None or not isinstance(value, str):
return False
if value[0] == '(' and value[-1] == ')':
value = value[1:-1]
if value == 'true' or value == 'false':
return True
try:
float(value)
return True
except:
pass
if value[0] == '"' and value[-1] == '"':
if... | import re
def value_is_trivial(value):
if value is None or not isinstance(value, str):
return False
if value[0] == '(' and value[-1] == ')':
value = value[1:-1]
if value == 'true' or value == 'false':
return True
try:
float(value)
return True
except:
pass
if value[0] == '"' and value[-1] == '"':
if... | Python | 0.000003 |
08d11dc308db007750fe06ea906264a6ab9f44cd | Add logging when cloning repository | instance/repo.py | instance/repo.py | # -*- coding: utf-8 -*-
#
# OpenCraft -- tools to aid developing and hosting free software projects
# Copyright (C) 2015 OpenCraft <xavier@opencraft.com>
#
# 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 Soft... | # -*- coding: utf-8 -*-
#
# OpenCraft -- tools to aid developing and hosting free software projects
# Copyright (C) 2015 OpenCraft <xavier@opencraft.com>
#
# 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 Soft... | Python | 0.000001 |
b2b4d0b49e755da0fc56e83ce81312d148f315d6 | add comments to code | instapaperbot.py | instapaperbot.py | import logging
import re #searching url in message
from telegram.ext import Updater
from telegram.ext import CommandHandler
from telegram.ext import MessageHandler, Filters
import instapaper #add link to instapaper
import config #временно загружаю логин-пароль ль instapaper
#логирование всех данных
def log_message(log... | import logging
import re #searching url in message
from telegram.ext import Updater
from telegram.ext import CommandHandler
from telegram.ext import MessageHandler, Filters
import instapaper #add link to instapaper
import config #временно загружаю логин-пароль ль instapaper
def log_message(log_info):
user_id = log... | Python | 0 |
a2a4a8e4636051fa84a5cfbaf7f4ff796c59171a | Add build.parent to api response | changes/api/serializer/models/build.py | changes/api/serializer/models/build.py | from changes.api.serializer import Serializer, register
from changes.constants import Result, Status
from changes.models.build import Build
@register(Build)
class BuildSerializer(Serializer):
def serialize(self, instance):
# TODO(dcramer): this shouldnt be calculated at runtime
last_5_builds = lis... | from changes.api.serializer import Serializer, register
from changes.constants import Result, Status
from changes.models.build import Build
@register(Build)
class BuildSerializer(Serializer):
def serialize(self, instance):
# TODO(dcramer): this shouldnt be calculated at runtime
last_5_builds = lis... | Python | 0.000001 |
39154c1c5dcb192079060083ecc0a97e776cee3d | Fix bug in redirect | website/views.py | website/views.py | import bcrypt
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from django.contrib.auth import authenticate, login
from django.contrib.auth.decorators import login_required
from django.contrib.auth.forms import AuthenticationForm, UserCreationForm
from django.contrib.auth.models i... | import bcrypt
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from django.contrib.auth import authenticate, login
from django.contrib.auth.decorators import login_required
from django.contrib.auth.forms import AuthenticationForm, UserCreationForm
from django.contrib.auth.models i... | Python | 0 |
469fc6ff805e845ac922a7334612f67f194eb93b | Fix flake8 errors in late_command script | deployment/puppet/cobbler/templates/scripts/late_command.py | deployment/puppet/cobbler/templates/scripts/late_command.py | #!/usr/bin/python
#
# Copyright (C) 2011 Mirantis Inc.
#
# Authors: Vladimir Kozhukalov <vkozhukalov@mirantis.com>
#
# This program 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, version 3 of t... | #!/usr/bin/python
#
# Copyright (C) 2011 Mirantis Inc.
#
# Authors: Vladimir Kozhukalov <vkozhukalov@mirantis.com>
#
# This program 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, version 3 of t... | Python | 0.00004 |
2413a2042745a00b5a220a753aa46177065f3793 | bump version to 0.0.3 | nose_warnings_filters/__init__.py | nose_warnings_filters/__init__.py |
"""
Nose plugin to add warnings filters (turn them into error) using nose.cfg file.
"""
__version__ = '0.0.3'
from nose.plugins import Plugin
import warnings
import sys
if sys.version_info < (3,):
import builtins
else:
builtins = __builtins__
class WarningFilter(Plugin):
def options(self, parser, en... |
"""
Nose plugin to add warnings filters (turn them into error) using nose.cfg file.
"""
__version__ = '0.0.2'
from nose.plugins import Plugin
import warnings
import sys
if sys.version_info < (3,):
import builtins
else:
builtins = __builtins__
class WarningFilter(Plugin):
def options(self, parser, en... | Python | 0.000001 |
f8685d8ca3d4d18ca5895d765185993ed2d5bcd7 | Fix citizen subscription to report : DatabaseError: current transaction is aborted, commands ignored until end of transaction block | django_fixmystreet/fixmystreet/views/reports/subscribers.py | django_fixmystreet/fixmystreet/views/reports/subscribers.py |
from django.shortcuts import get_object_or_404
from django.http import HttpResponseRedirect
from django.utils.translation import ugettext as _
from django.contrib import messages
from django.db import IntegrityError
from django_fixmystreet.fixmystreet.models import FMSUser
from django_fixmystreet.fixmystreet.models ... |
from django.shortcuts import get_object_or_404
from django.http import HttpResponseRedirect
from django.utils.translation import ugettext as _
from django.contrib import messages
from django.db import IntegrityError
from django_fixmystreet.fixmystreet.models import FMSUser
from django_fixmystreet.fixmystreet.models ... | Python | 0.000001 |
9a87f83c7060b66f7f95f2823db11b5e86a4fd67 | fix #210 | src/you_get/downloader/dailymotion.py | src/you_get/downloader/dailymotion.py | #!/usr/bin/env python
__all__ = ['dailymotion_download']
from ..common import *
def dailymotion_download(url, output_dir = '.', merge = True, info_only = False):
"""Downloads Dailymotion videos by URL.
"""
id = match1(url, r'/video/([^\?]+)')
embed_url = 'http://www.dailymotion.com/embed/video/%... | #!/usr/bin/env python
__all__ = ['dailymotion_download']
from ..common import *
def dailymotion_download(url, output_dir = '.', merge = True, info_only = False):
html = get_html(url)
html = parse.unquote(html).replace('\/', '/')
title = r1(r'meta property="og:title" content="([^"]+)"', html)
tit... | Python | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.