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
c307dc1ef794f9a3262be67621892adec4aff25f
friendly task name
dbaas/notification/admin/task_history.py
dbaas/notification/admin/task_history.py
# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals from django.contrib import admin from django.utils.translation import ugettext_lazy as _ import logging from ..models import TaskHistory from dbaas import constants LOG = logging.getLogger(__name__) class TaskHistoryAdmin(admin.ModelAdm...
# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals from django.contrib import admin from django.utils.translation import ugettext_lazy as _ import logging from ..models import TaskHistory from dbaas import constants LOG = logging.getLogger(__name__) class TaskHistoryAdmin(admin.ModelAdm...
Python
0.998809
5bdd659768ad5e5a50f85113a2d354ac51653b42
Update ds_list_contains_duplicate.py
leetcode/ds_list_contains_duplicate.py
leetcode/ds_list_contains_duplicate.py
# @file Contains Duplicate # @brief Given an array of numbers find if there are any duplicates # https://leetcode.com/problems/contains-duplicate/ ''' Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the array, and it shoul...
# @file Contains Duplicate # @brief Given an array of numbers find if there are any duplicates # https://leetcode.com/problems/contains-duplicate/ ''' Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the array, and it shoul...
Python
0.000003
e10195f93cb39afcc432ec25466073cec093b2bb
remove debug output
app/form/validators.py
app/form/validators.py
from wtforms.validators import ValidationError from app.pacman import get_pkg from app.util import multiline_to_list from pyalpm import vercmp class ValidPackageName(object): def __init__(self): self.message = u'Unknown package.' def __call__(self, form, field): versions = get_pkg(field.data)...
from wtforms.validators import ValidationError from app.pacman import get_pkg from app.util import multiline_to_list from pyalpm import vercmp class ValidPackageName(object): def __init__(self): self.message = u'Unknown package.' def __call__(self, form, field): versions = get_pkg(field.data)...
Python
0
85ece96a2dd566b19f88686b54ea903d9850abd6
Introduce MapOptions and MapPlot abstract base classes
bokeh/models/map_plots.py
bokeh/models/map_plots.py
""" Models for displaying maps in Bokeh plots. """ from __future__ import absolute_import from ..properties import HasProps, abstract from ..properties import Enum, Float, Instance, Int, JSON from ..enums import MapType from ..validation.warnings import MISSING_RENDERERS, NO_GLYPH_RENDERERS from ..validation.errors i...
""" Models for displaying maps in Bokeh plots. """ from __future__ import absolute_import from ..properties import HasProps from ..properties import Enum, Float, Instance, Int, JSON from ..enums import MapType from ..validation.warnings import MISSING_RENDERERS, NO_GLYPH_RENDERERS from ..validation.errors import REQU...
Python
0
f8a8e936b2f6f3edcbc68b69056271975626631c
Terminate the build log recorder if the parent builder disappears
rmake/worker/recorder.py
rmake/worker/recorder.py
# # Copyright (c) SAS Institute 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 w...
# # Copyright (c) SAS Institute 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 w...
Python
0.000002
b20853aa4c41535ff5277d347105e9ec55bc473d
Fix work on MySQL backend
mistral/db/sqlalchemy/models.py
mistral/db/sqlalchemy/models.py
# -*- coding: utf-8 -*- # # Copyright 2013 - Mirantis, 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 requir...
# -*- coding: utf-8 -*- # # Copyright 2013 - Mirantis, 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 requir...
Python
0.000001
b2ca3cf7e6610bf0f3c6ac5aa79c3322c276c439
set the exit code to non-zero when contracts fails
scrapy/commands/check.py
scrapy/commands/check.py
from __future__ import print_function from collections import defaultdict from functools import wraps from unittest import TextTestRunner from scrapy.command import ScrapyCommand from scrapy.contracts import ContractsManager from scrapy.utils.misc import load_object from scrapy.utils.spider import iterate_spider_outpu...
from __future__ import print_function from collections import defaultdict from functools import wraps from unittest import TextTestRunner from scrapy.command import ScrapyCommand from scrapy.contracts import ContractsManager from scrapy.utils.misc import load_object from scrapy.utils.spider import iterate_spider_outpu...
Python
0.000113
f131fc524d557312da010b22379d75d52637ebd1
missing comma
semantics.py
semantics.py
# -*- coding: utf-8 -*- ############################################################################## # # Semantics, module for Odoo, Open Source Management Solution # Copyright (C) 2014 InsPyration EURL (<http://www.inspyration.fr>). # # This program is free software: you can redistribute it and/or modify # ...
# -*- coding: utf-8 -*- ############################################################################## # # Semantics, module for Odoo, Open Source Management Solution # Copyright (C) 2014 InsPyration EURL (<http://www.inspyration.fr>). # # This program is free software: you can redistribute it and/or modify # ...
Python
0.999998
e8b4f7d6917647d4158ed39991cd00cfe45a0264
Add some support for bigg.ucsd.edu/api/v2
cameo/webmodels.py
cameo/webmodels.py
# Copyright 2014 Novo Nordisk Foundation Center for Biosustainability, DTU. # # 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 requi...
# Copyright 2014 Novo Nordisk Foundation Center for Biosustainability, DTU. # # 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 requi...
Python
0
0fe6e79f9bc201b3c63ad6f1ce400c9d79bd484a
Fix path issues in example script
bin/idiotscript.py
bin/idiotscript.py
#!/usr/bin/python3 import os, sys def alter_path(): script_path = os.path.dirname(os.path.realpath(__file__)) try: path_index = sys.path.index(script_path) except ValueError: return sys.path.pop(path_index) alter_path() if len(sys.argv) < 2 or len(sys.argv) > 3: print("Invalid num...
#!/usr/bin/python3 import os, sys if len(sys.argv) < 2 or len(sys.argv) > 3: print("Invalid number of arguments.") sys.exit() if os.path.isfile(sys.argv[1]) == False: print("IdiotScript program does not exist.") sys.exit() import io import idiotscript from idiotscript import InstructionSet, Collect...
Python
0.000001
d926f321a26fe7c6b72513f88fe60bc4f3c899e4
Update model cnes bed
app/models/cnes_bed.py
app/models/cnes_bed.py
from sqlalchemy import Column, Integer, String, func from app import db class CnesBed(db.Model): __tablename__ = 'cnes_bed' year = Column(Integer, primary_key=True) region = Column(String(1), primary_k...
from sqlalchemy import Column, Integer, String, func from app import db class CnesBed(db.Model): __tablename__ = 'cnes_bed' year = Column(Integer, primary_key=True) region = Column(String(1), primary_key=True) mesoregion = Column(String(4), primary_key=True) microregion = Colum...
Python
0
ec7b52b457e749b4b4a1e9110ede221f2f0d5fe9
Fix fatal error in data processing.
data/propaganda2mongo.py
data/propaganda2mongo.py
import bson.json_util from bson.objectid import ObjectId import json import sys def main(): node_table = {} while True: line = sys.stdin.readline() if not line: break record = json.loads(line) ident = str(record["twitter_id"]) aoid = node_table.get(ident)...
import bson.json_util from bson.objectid import ObjectId import json import sys def main(): node_table = {} while True: line = sys.stdin.readline() if not line: break record = json.loads(line) ident = str(record["twitter_id"]) aoid = node_table.get(ident)...
Python
0.000005
8fb80540499d0f303d68150304fd896367313f94
remove incorrect is instance check in children_changed
IPython/html/widgets/widget_container.py
IPython/html/widgets/widget_container.py
"""ContainerWidget class. Represents a container that can be used to group other widgets. """ #----------------------------------------------------------------------------- # Copyright (c) 2013, the IPython Development Team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the ...
"""ContainerWidget class. Represents a container that can be used to group other widgets. """ #----------------------------------------------------------------------------- # Copyright (c) 2013, the IPython Development Team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the ...
Python
0.000062
d24f3a1f008e4d2bef262a0f1253da04071a180d
move dataset crop into generic as it is used in several datasets
data_provider/dataset.py
data_provider/dataset.py
import copy class AbstractDataset(object): def __init__(self, games): self.games = games def get_data(self, indices=list()): if len(indices) > 0: return [self.games[i] for i in indices] else: return self.games def n_examples(self): return len(self....
class AbstractDataset(object): def __init__(self, games): self.games = games def get_data(self, indices=list()): if len(indices) > 0: return [self.games[i] for i in indices] else: return self.games def n_examples(self): return len(self.games) class...
Python
0.000001
7907aeb6a006655ad96d5d3995b5fdbd4bf00d16
fix usage of get_all_enabled_projects
scripts/pipeline_main.py
scripts/pipeline_main.py
#!/usr/bin/env python3 # Copyright 2020 Google LLC # # Licensed under the the Apache License v2.0 with LLVM Exceptions (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://llvm.org/LICENSE.txt # # Unless required by applicable law ...
#!/usr/bin/env python3 # Copyright 2020 Google LLC # # Licensed under the the Apache License v2.0 with LLVM Exceptions (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://llvm.org/LICENSE.txt # # Unless required by applicable law ...
Python
0.000002
c38ad4f02d6f036f23ef6d3c1e033e9843fb068a
comment unused tests
functional_tests/test_admins.py
functional_tests/test_admins.py
# -*- coding: utf-8 -*- # from __future__ import unicode_literals, absolute_import # # from django.contrib.admin.templatetags.admin_urls import admin_urlname # # from .base import FunctionalTest # from nowait.tests.factories import AdminF # from nowait.models import BookingType # # # class AdminTest(FunctionalTest): # ...
# -*- coding: utf-8 -*- from __future__ import unicode_literals, absolute_import from unittest import skip from django.contrib.admin.templatetags.admin_urls import admin_urlname from .base import FunctionalTest from nowait.tests.factories import AdminF from nowait.models import BookingType @skip class AdminTest(Fun...
Python
0
18bc54f964a2925005543df8b4989271ad4464be
Fix inheritance in soc.models.base module. FieldsProxy inherited from DbModelForm which was deleted in previous commits (replace that with BaseForm).
app/soc/models/base.py
app/soc/models/base.py
#!/usr/bin/python2.5 # # Copyright 2008 the Melange authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
#!/usr/bin/python2.5 # # Copyright 2008 the Melange authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
Python
0.000001
b4acc5d4c5f6b3e94225ca5926d06a50c511173c
add json exporter
furnito_crawler/json_manager.py
furnito_crawler/json_manager.py
import json class Json_Manager: def __init__(self): pass def export_json(self, path, json_content): ''' @usage: export dict to json and store on local storage @arg: path, path to store json, string eg, 'downlaods/1.json' @arg: json_content, the content want to export, d...
class Json_Manager: def __init__(self): pass
Python
0
5bde6ca1fd62277463156875e874c4c6843923fd
Use the correct variable for the test
pytest-{{cookiecutter.plugin_name}}/tests/test_{{cookiecutter.plugin_name}}.py
pytest-{{cookiecutter.plugin_name}}/tests/test_{{cookiecutter.plugin_name}}.py
# -*- coding: utf-8 -*- def test_bar_fixture(testdir): """Make sure that pytest accepts our fixture.""" # create a temporary pytest test module testdir.makepyfile(""" def test_sth(bar): assert bar == "europython2015" """) # run pytest with the following cmd args result = t...
# -*- coding: utf-8 -*- def test_bar_fixture(testdir): """Make sure that pytest accepts our fixture.""" # create a temporary pytest test module testdir.makepyfile(""" def test_sth(bar): assert bar == "europython2015" """) # run pytest with the following cmd args result = t...
Python
0.009051
13db02c23cac6ba0eb9116f1429b8d4a8001db6e
Update sequences.py
appdaemon/sequences.py
appdaemon/sequences.py
import uuid import asyncio from appdaemon.appdaemon import AppDaemon class Sequences: def __init__(self, ad: AppDaemon): self.AD = ad self.logger = ad.logging.get_child("_sequences") async def run_sequence_service(self, namespace, domain, service, kwargs): if "entity_id" not in kwar...
import uuid import asyncio from appdaemon.appdaemon import AppDaemon class Sequences: def __init__(self, ad: AppDaemon): self.AD = ad self.logger = ad.logging.get_child("_sequences") async def run_sequence_service(self, namespace, domain, service, kwargs): if "entity_id" not in kwar...
Python
0.000001
164262400dbb265a3363eb9f1415284b391c079c
Remove duplicate call
fc.py
fc.py
#!/usr/bin/python3 #Fork compiler toolchain script import argparse import re, os from sys import exit def main(): #Parse arguments parser = argparse.ArgumentParser(description='Fork toolchain command line parser...') parser.add_argument('-v',action='store_true',help='Use valgrind') parser.add_argument('-c',act...
#!/usr/bin/python3 #Fork compiler toolchain script import argparse import re, os from sys import exit def main(): #Parse arguments parser = argparse.ArgumentParser(description='Fork toolchain command line parser...') parser.add_argument('-v',action='store_true',help='Use valgrind') parser.add_argument('-c',act...
Python
0.000004
1e14d68c86e0cacb9bedc51884081ef0a1cfdcdc
Fix for trevis
isitdown/config.py
isitdown/config.py
import os basedir = os.path.abspath(os.path.dirname(__file__)) class Config(object): DEBUG = False TESTING = False DATABASE_URI = os.environ.get("ISITDOWN_DATABASE_URI", 'sqlite:///' + os.path.join(basedir, 'app.db')) SECRET_KEY = os.environ.get('ISITDOWN_SECRET_KEY', 'you-will-never-guess') SQLAL...
import os basedir = os.path.abspath(os.path.dirname(__file__)) class Config(object): DEBUG = False TESTING = False DATABASE_URI = os.environ["ISITDOWN_DATABASE_URI"] or 'sqlite:///' + os.path.join(basedir, 'app.db') SECRET_KEY = os.environ['ISITDOWN_SECRET_KEY'] or 'you-will-never-guess' SQLALCHEM...
Python
0
16d87a91bcd6eb5cdb23d6aeb45e48ca7baf181a
remove unnecessary import
createdb.py
createdb.py
from flask import Flask from flask_sqlalchemy import SQLAlchemy app = Flask('app') app.config.from_object('config') db = SQLAlchemy(app) db.create_all()
from flask import Flask from flask_sqlalchemy import SQLAlchemy app = Flask('app') app.config.from_object('config') db = SQLAlchemy(app) from app import models db.create_all()
Python
0.000037
ee1b02d7327eeeeb65115c705a0df1ffd7c82034
Make random election view a bit more random
democracy_club/apps/everyelection/views.py
democracy_club/apps/everyelection/views.py
import random from django.db.models import Count from django.shortcuts import get_object_or_404 from django.views.generic import RedirectView, UpdateView from django.core.urlresolvers import reverse from django.shortcuts import redirect from braces.views import LoginRequiredMixin from .models import AuthorityElectio...
from django.db.models import Count from django.shortcuts import get_object_or_404 from django.views.generic import RedirectView, UpdateView from django.core.urlresolvers import reverse from braces.views import LoginRequiredMixin from .models import AuthorityElection, AuthorityElectionPosition from .forms import Autho...
Python
0.00002
2549a66b6785d5a0ed0658a4f375a21c486792df
Raise explicit exception on no type match
sifr/util.py
sifr/util.py
import datetime from dateutil import parser import six def normalize_time(t): try: if isinstance(t, datetime.datetime): return t elif isinstance(t, datetime.date): return datetime.datetime(t.year, t.month, t.day) elif isinstance(t, (int, float)): return ...
import datetime from dateutil import parser import six def normalize_time(t): try: if isinstance(t, datetime.datetime): return t elif isinstance(t, datetime.date): return datetime.datetime(t.year, t.month, t.day) elif isinstance(t, (int, float)): return ...
Python
0.000006
62ede23b0e13ab907b3eab620193921de29e162b
Bump version to 4.3.2b1
platformio/__init__.py
platformio/__init__.py
# Copyright (c) 2014-present PlatformIO <contact@platformio.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 appli...
# Copyright (c) 2014-present PlatformIO <contact@platformio.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 appli...
Python
0.000001
d4af985eb8786f6531e319e837fcc8d7b3e33ece
Bump version to 4.0.0a5
platformio/__init__.py
platformio/__init__.py
# Copyright (c) 2014-present PlatformIO <contact@platformio.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 appli...
# Copyright (c) 2014-present PlatformIO <contact@platformio.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 appli...
Python
0
454cd8d7847074988bf967f6240d59f25bdf310e
Bump version to 5.0.2rc1
platformio/__init__.py
platformio/__init__.py
# Copyright (c) 2014-present PlatformIO <contact@platformio.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 appli...
# Copyright (c) 2014-present PlatformIO <contact@platformio.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 appli...
Python
0
dc14bd73623f453d8ef272a9cd46df3733fcfad9
Bump version to 6.1.5rc1
platformio/__init__.py
platformio/__init__.py
# Copyright (c) 2014-present PlatformIO <contact@platformio.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 appli...
# Copyright (c) 2014-present PlatformIO <contact@platformio.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 appli...
Python
0
1800e98f0570bfd1029d9df881fb144fdd943e72
Remove leftover debug print from Melnor (#78870)
tests/components/melnor/test_number.py
tests/components/melnor/test_number.py
"""Test the Melnor sensors.""" from __future__ import annotations from .conftest import ( mock_config_entry, patch_async_ble_device_from_address, patch_async_register_callback, patch_melnor_device, ) async def test_manual_watering_minutes(hass): """Test the manual watering switch.""" entry ...
"""Test the Melnor sensors.""" from __future__ import annotations from .conftest import ( mock_config_entry, patch_async_ble_device_from_address, patch_async_register_callback, patch_melnor_device, ) async def test_manual_watering_minutes(hass): """Test the manual watering switch.""" entry ...
Python
0
ae6025a4be24637e57c0545aa860d96a0447aa89
Raise any exceptions from ended listeners in workers
channels/worker.py
channels/worker.py
import asyncio from asgiref.server import StatelessServer class Worker(StatelessServer): """ ASGI protocol server that surfaces events sent to specific channels on the channel layer into a single application instance. """ def __init__(self, application, channels, channel_layer, max_applications=...
import asyncio from asgiref.server import StatelessServer class Worker(StatelessServer): """ ASGI protocol server that surfaces events sent to specific channels on the channel layer into a single application instance. """ def __init__(self, application, channels, channel_layer, max_applications=...
Python
0
6149cef01900d6710efa322ef934965c5f1379f8
Fix pylint
xapi/utils.py
xapi/utils.py
from opaque_keys.edx.keys import CourseKey from opaque_keys import InvalidKeyError from opaque_keys.edx.locations import SlashSeparatedCourseKey from xmodule.modulestore.django import modulestore from django.contrib.auth.models import User from django.test.client import RequestFactory from openedx.core.djangoapps.conte...
from opaque_keys.edx.keys import CourseKey from opaque_keys import InvalidKeyError from opaque_keys.edx.locations import SlashSeparatedCourseKey from xmodule.modulestore.django import modulestore from django.contrib.auth.models import User from django.test.client import RequestFactory from openedx.core.djangoapps.conte...
Python
0.000099
0b707c2e3a4d00aef5dad683c535498cb8bc1e21
use the default date formatter for logging
xutils/log.py
xutils/log.py
# -*- coding: utf-8 -*- import os import os.path import logging from logging.handlers import RotatingFileHandler def init(logger=None, level="INFO", file=None, handler_cls=None, process=False, max_count=30, propagate=True, file_config=None, dict_config=None): root = logging.getLogger() if not logge...
# -*- coding: utf-8 -*- import os import os.path import logging from logging.handlers import RotatingFileHandler def init(logger=None, level="INFO", file=None, handler_cls=None, process=False, max_count=30, propagate=True, file_config=None, dict_config=None): root = logging.getLogger() if not logge...
Python
0
7d8380a65523e7d6ef77d39eaf125823e3e10812
Bump version to 5.0.0dev0
chardet/version.py
chardet/version.py
""" This module exists only to simplify retrieving the version number of chardet from within setup.py and from chardet subpackages. :author: Dan Blanchard (dan.blanchard@gmail.com) """ __version__ = "5.0.0dev0" VERSION = __version__.split('.')
""" This module exists only to simplify retrieving the version number of chardet from within setup.py and from chardet subpackages. :author: Dan Blanchard (dan.blanchard@gmail.com) """ __version__ = "4.0.0" VERSION = __version__.split('.')
Python
0
4cb36450aa4ddabe0a6fa48300dc37edc053dd13
fix bug in isOpen for reports
modules/queue/ModReport.py
modules/queue/ModReport.py
"""Queue item for basic analysis by irwin""" from collections import namedtuple from datetime import datetime, timedelta import pymongo class ModReport(namedtuple('ModReport', ['id', 'processed', 'created'])): @staticmethod def new(userId): return ModReport( id=userId, processed...
"""Queue item for basic analysis by irwin""" from collections import namedtuple from datetime import datetime, timedelta import pymongo class ModReport(namedtuple('ModReport', ['id', 'processed', 'created'])): @staticmethod def new(userId): return ModReport( id=userId, processed...
Python
0.000014
6326cfa9ad5cb203eeade0c5875a005e06bbe932
fix isort test
tests/test_core_base_multi_executor.py
tests/test_core_base_multi_executor.py
from datetime import timedelta import pytest @pytest.fixture def config_yaml(unused_port): return """ e: cls: aioworkers.core.base.MultiExecutorEntity executors: get: 1 put: 1 none: none x: null """ async def test_multiexecutor(context): asser...
import pytest from datetime import timedelta @pytest.fixture def config_yaml(unused_port): return """ e: cls: aioworkers.core.base.MultiExecutorEntity executors: get: 1 put: 1 none: none x: null """ async def test_multiexecutor(context): assert...
Python
0
94260ec953de44ae9a4108b964a9a607b0457148
fix new search index
muckrock/news/search_indexes.py
muckrock/news/search_indexes.py
""" Search Index for the news application """ from haystack.indexes import SearchIndex, CharField, DateTimeField from haystack import site from muckrock.news.models import Article class ArticleIndex(SearchIndex): """Search index for news articles""" text = CharField(document=True, use_template=True) auth...
""" Search Index for the news application """ from haystack.indexes import SearchIndex, CharField, DateTimeField from haystack import site from muckrock.news.models import Article class ArticleIndex(SearchIndex): """Search index for news articles""" text = CharField(document=True, use_template=True) auth...
Python
0.000075
2bafdb04dc4e04c5a2cf9136135dfa130ac6e78b
read full buffer, not byte by byte
serialSniffer/sniffer.py
serialSniffer/sniffer.py
from serial import Serial from concurrent.futures import ThreadPoolExecutor class Sniffer(object): """ TODO: write docstring """ def __init__(self, virtual_comm='COM7', physical_comm='COM1'): self.virtual_comm = Serial(virtual_comm) self.physical_comm = Serial(physical_comm) ...
from serial import Serial from concurrent.futures import ThreadPoolExecutor class Sniffer(object): """ TODO: write docstring """ def __init__(self, virtual_comm='COM7', physical_comm='COM1'): self.virtual_comm = Serial(virtual_comm) self.physical_comm = Serial(physical_comm) ...
Python
0.000058
a21d2408dc9ed1696cea17e3cff3adc6dcdea815
Add ability to punish XP farm users.
joku/cogs/debug.py
joku/cogs/debug.py
""" Debug cog. """ import inspect import pprint import traceback import discord from discord.ext import commands from discord.ext.commands import Context from joku.bot import Jokusoramame from joku.checks import is_owner class Debug(object): def __init__(self, bot: Jokusoramame): self.bot = bot @co...
""" Debug cog. """ import inspect import pprint import traceback import discord from discord.ext import commands from discord.ext.commands import Context from joku.bot import Jokusoramame from joku.checks import is_owner class Debug(object): def __init__(self, bot: Jokusoramame): self.bot = bot @co...
Python
0
cf60bcf1a06998bc2980cf793a6b7ffe086b9369
Factor out test cases into common function
server/test-querylang.py
server/test-querylang.py
"""Test Python utilities related to query language processing.""" import itertools import json import unittest import querylang as ql data = [ {'age': 19}, {'age': 21}, {'age': 23} ] class TestQueryLanguage(unittest.TestCase): """Test suite.""" def run_expressions(self, ast_file, data, baseline...
"""Test Python utilities related to query language processing.""" import itertools import json import unittest import querylang as ql data = [ {'age': 19}, {'age': 21}, {'age': 23} ] class TestQueryLanguage(unittest.TestCase): """Test suite.""" def test_operator_expressions(self): """T...
Python
0.999999
eac867faba8d4653fa580ee0c2bd708ff83b13ee
Remove test workaround
server/tests/test_api.py
server/tests/test_api.py
import json from server.tests.base import BaseTestCase from server.models import db, Lecturer, Course, Lecture, Comment class GetCommentsApiTest(BaseTestCase): def setUp(self): super(GetCommentsApiTest, self).setUp() simon = Lecturer('Simon', 'McCallum') db.session.add(simon) imt...
import json from server.tests.base import BaseTestCase from server.models import db, Lecturer, Course, Lecture, Comment class GetCommentsApiTest(BaseTestCase): def setUp(self): super(GetCommentsApiTest, self).setUp() simon = Lecturer('Simon', 'McCallum') db.session.add(simon) imt...
Python
0
4e1653e1d00c1f4001e37de3cc650dc11d4b6ca5
fix stack inspection in render_to_response to work on windows
lib/rapidsms/utils/render_to_response.py
lib/rapidsms/utils/render_to_response.py
#!/usr/bin/env python # vim: ai ts=4 sts=4 et sw=4 import os import sys import inspect def render_to_response(req, template_name, dictionary=None, **kwargs): """ Wrap django.shortcuts.render_to_response, to avoid having to include the same stuff in every view. TODO: moar. """ # delay imports un...
#!/usr/bin/env python # vim: ai ts=4 sts=4 et sw=4 import os import sys import inspect def render_to_response(req, template_name, dictionary=None, **kwargs): """ Wrap django.shortcuts.render_to_response, to avoid having to include the same stuff in every view. TODO: moar. """ # delay imports un...
Python
0
ff1a07783b0d284871a1f6195579768aab1c806b
Handle multiple results with cached geolocation better
molly/geolocation/utils.py
molly/geolocation/utils.py
from functools import wraps from django.conf import settings from django.contrib.gis.geos import Point from molly.conf import get_app from models import Geocode __all__ = ['geocode', 'reverse_geocode'] def _cached(getargsfunc): def g(f): @wraps(f) def h(*args, **kwargs): args = geta...
from functools import wraps from django.conf import settings from django.contrib.gis.geos import Point from molly.conf import get_app from models import Geocode __all__ = ['geocode', 'reverse_geocode'] def _cached(getargsfunc): def g(f): @wraps(f) def h(*args, **kwargs): args = geta...
Python
0
cf8cba155edb7f1d27fce7b20aaafce044415a22
Update 35b556aef8ef_add_news_flash_table.py
alembic/versions/35b556aef8ef_add_news_flash_table.py
alembic/versions/35b556aef8ef_add_news_flash_table.py
"""add new table Revision ID: 35b556aef8ef Revises: 423a7ea74c0a Create Date: 2018-12-10 11:31:29.518909 """ # revision identifiers, used by Alembic. revision = '35b556aef8ef' down_revision = '423a7ea74c0a' branch_labels = None depends_on = None from alembic import op import sqlalchemy as sa def upgrade(): ##...
"""add new table Revision ID: 35b556aef8ef Revises: 3c8ad66233c0 Create Date: 2018-12-10 11:31:29.518909 """ # revision identifiers, used by Alembic. revision = '35b556aef8ef' down_revision = '423a7ea74c0a' branch_labels = None depends_on = None from alembic import op import sqlalchemy as sa def upgrade(): ##...
Python
0
5f12bac216f5380e55dc65ccfcd16e369c575dac
Use redis on localhost
app.py
app.py
from flask import Flask from redis import Redis import os app = Flask(__name__) redis = Redis(host= "localhost", port=6379) @app.route('/') def hello(): redis.incr('hits') return 'This page has been seen {0} times' . format (redis.get( 'hits' )) if __name__ == "__main__": app.run(host= "0.0.0.0", debug=T...
from flask import Flask from redis import Redis import os app = Flask(__name__) redis = Redis(host= "redis", port=6379) @app.route('/') def hello(): redis.incr('hits') return 'This page has been seen {0} times' . format (redis.get( 'hits' )) if __name__ == "__main__": app.run(host= "0.0.0.0", debug=True)
Python
0.000001
a1c558027cd17eec69a2babb786e35b147ffae6b
add start.html
app.py
app.py
#!flask/bin/python from flask import request, render_template, Flask import os, sys, json import requests app = Flask(__name__) from random import randint from telesign.messaging import MessagingClient from telesign.voice import VoiceClient from flask import request @app.route('/') def index(): return render_te...
#!flask/bin/python from flask import request, render_template, Flask import os, sys, json import requests app = Flask(__name__) from random import randint from telesign.messaging import MessagingClient from telesign.voice import VoiceClient from flask import request @app.route('/') def index(): return render_te...
Python
0.000002
3b8c55fd13b314dd737b9d50ab0cce8a9d178bb9
save os_driver
occinet/api/openstack_driver.py
occinet/api/openstack_driver.py
# -*- coding: utf-8 -*- # Copyright 2015 Spanish National Research Council # # 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 requ...
# -*- coding: utf-8 -*- # Copyright 2015 Spanish National Research Council # # 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 requ...
Python
0.000003
be3fc40d021ee9a43ca524bcafdcdad7896de9a5
Add remaining completed locales to prod settings.
mrburns/settings/server.py
mrburns/settings/server.py
import os import socket from django.utils.translation import ugettext_lazy as _ from .base import * # noqa SERVER_ENV = os.getenv('DJANGO_SERVER_ENV') SECRET_KEY = os.getenv('SECRET_KEY') DEBUG = TEMPLATE_DEBUG = False ALLOWED_HOSTS = [ # the server's IP (for monitors) socket.gethostbyname(socket.gethostna...
import os import socket from django.utils.translation import ugettext_lazy as _ from .base import * # noqa SERVER_ENV = os.getenv('DJANGO_SERVER_ENV') SECRET_KEY = os.getenv('SECRET_KEY') DEBUG = TEMPLATE_DEBUG = False ALLOWED_HOSTS = [ # the server's IP (for monitors) socket.gethostbyname(socket.gethostna...
Python
0
9320c7dfcc7d890f9a5ad805d9b4d38f6c0795e5
Add SPL filter for Floating IPs
src/nodeconductor_openstack/filters.py
src/nodeconductor_openstack/filters.py
import django_filters from nodeconductor.core import filters as core_filters from nodeconductor.structure import filters as structure_filters from . import models class OpenStackServiceProjectLinkFilter(structure_filters.BaseServiceProjectLinkFilter): service = core_filters.URLFilter(view_name='openstack-detail...
import django_filters from nodeconductor.core import filters as core_filters from nodeconductor.structure import filters as structure_filters from . import models class OpenStackServiceProjectLinkFilter(structure_filters.BaseServiceProjectLinkFilter): service = core_filters.URLFilter(view_name='openstack-detail...
Python
0
6dcc92797e8aa8661adfb67fc1f0aaa00de99709
fix cancellation context
drivers/azure_shell/driver.py
drivers/azure_shell/driver.py
import jsonpickle from cloudshell.cp.azure.azure_shell import AzureShell from cloudshell.shell.core.resource_driver_interface import ResourceDriverInterface class AzureShellDriver(ResourceDriverInterface): def __init__(self): """ ctor must be without arguments, it is created with reflection at run ...
import jsonpickle from cloudshell.cp.azure.azure_shell import AzureShell from cloudshell.shell.core.resource_driver_interface import ResourceDriverInterface class AzureShellDriver(ResourceDriverInterface): def __init__(self): """ ctor must be without arguments, it is created with reflection at run ...
Python
0.000001
74c15f510e30645212848da128b88e55c5c011c4
remove redundant duplicate tests from node_network_limited
test/functional/node_network_limited.py
test/functional/node_network_limited.py
#!/usr/bin/env python3 # Copyright (c) 2017 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. from test_framework.messages import CInv, msg_getdata from test_framework.mininode import NODE_BLOOM, NODE_NETW...
#!/usr/bin/env python3 # Copyright (c) 2017 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. from test_framework.messages import CInv, msg_getdata from test_framework.mininode import NODE_BLOOM, NODE_NETW...
Python
0.000014
abdb2743ed214ea3b6a72b4163be2d09a8354bd0
Remove aliases of rpc backend for messaging
smaug/rpc.py
smaug/rpc.py
# 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, software # d...
# 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, software # d...
Python
0.000001
01dcc7c3a973e5c363b4789bda86f871d5b10b59
Add opaque context argument to merge() to pass to merge callbacks
edgedb/lang/common/algos/topological.py
edgedb/lang/common/algos/topological.py
## # Copyright (c) 2008-2010 Sprymix Inc. # All rights reserved. # # See LICENSE for details. ## from collections import defaultdict, OrderedDict from semantix.utils.datastructures import OrderedSet class UnresolvedReferenceError(Exception): pass class CycleError(Exception): pass def sort(graph, return...
## # Copyright (c) 2008-2010 Sprymix Inc. # All rights reserved. # # See LICENSE for details. ## from collections import defaultdict, OrderedDict from semantix.utils.datastructures import OrderedSet class UnresolvedReferenceError(Exception): pass class CycleError(Exception): pass def sort(graph, return...
Python
0
aa097dcacb33fc77a5c9471b65b0f914f0484276
Fix lambda definition so it works in all versions of Python
lingvo/tasks/lm/tools/download_lm1b.py
lingvo/tasks/lm/tools/download_lm1b.py
# Copyright 2018 The TensorFlow Authors. 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 applica...
# Copyright 2018 The TensorFlow Authors. 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 applica...
Python
0.999985
890ddb3507c89177d561eb20afb86c922bf52bf8
Correct import in demo
demo.py
demo.py
#!/usr/bin/env python3 from flask import Flask, redirect, request from resumable import rebuild, value app = Flask(__name__) def form(action, contents): return ''' <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <form action="{}" method=post> {} <but...
#!/usr/bin/env python3 from flask import Flask, redirect, request from resumable import rebuild, split app = Flask(__name__) def form(action, contents): return ''' <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <form action="{}" method=post> {} <but...
Python
0.000002
2f789441eefbca50bf9c47dc5beb0d00cd8ce6e4
Update support server invite
help.py
help.py
from typing import Mapping, Optional from discord.ext.commands import Cog, Command, MinimalHelpCommand class BHelp(MinimalHelpCommand): async def send_bot_help(self, mapping: Mapping[Optional[Cog], list[Command]]): await super().send_bot_help(mapping) if ctx := self.context: await ctx...
from typing import Mapping, Optional from discord.ext.commands import Cog, Command, MinimalHelpCommand class BHelp(MinimalHelpCommand): async def send_bot_help(self, mapping: Mapping[Optional[Cog], list[Command]]): await super().send_bot_help(mapping) if ctx := self.context: await ctx...
Python
0
0d0bc3a9933ed6f5173da24c6ee33dc35938b442
Add support for larger outputs
hkdf.py
hkdf.py
from __future__ import division import hmac import hashlib import sys from struct import pack, error as struct_error from itertools import count, islice if sys.version_info[0] == 3: buffer = lambda x: x MAX_INT64 = 0xffffffffffffffffffffffffffffffff def COUNTER8(x): return pack('>B', x) def COUNTER16(x): ret...
from __future__ import division import hmac import hashlib import sys if sys.version_info[0] == 3: buffer = lambda x: x def hkdf_extract(salt, input_key_material, hash=hashlib.sha512): ''' Extract a pseudorandom key suitable for use with hkdf_expand from the input_key_material and a salt using HMAC with the pro...
Python
0.000022
5f6a890e678014cdb5f3d7e08098007b517ac816
Remove check command output.
start_jupyter_cm/tests/test_command.py
start_jupyter_cm/tests/test_command.py
import subprocess import os import sys import pytest from subprocess import PIPE from start_jupyter_cm.utils import get_environment_label from start_jupyter_cm.gnome import SPATH def isadmin(): try: # only windows users with admin privileges can read the C:\windows\temp os.listdir(os.path.join([o...
import subprocess import os import sys import pytest from subprocess import PIPE from start_jupyter_cm.utils import get_environment_label from start_jupyter_cm.gnome import SPATH def isadmin(): try: # only windows users with admin privileges can read the C:\windows\temp os.listdir(os.path.join([o...
Python
0.000001
af642b214fa63a6e8f0dfe7633b5f19bb6b6d028
Set environment in cache manager instance
novaimagebuilder/BaseOS.py
novaimagebuilder/BaseOS.py
# encoding: utf-8 # Copyright 2013 Red Hat, 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 applica...
# encoding: utf-8 # Copyright 2013 Red Hat, 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 applica...
Python
0.000001
8a704533abcf277906cdf57c8cdca55effd542e1
Add positive test case for cloudtrail deadman
tests/alerts/test_cloudtrail_deadman.py
tests/alerts/test_cloudtrail_deadman.py
from positive_alert_test_case import PositiveAlertTestCase from negative_alert_test_case import NegativeAlertTestCase from alert_test_suite import AlertTestSuite class TestAlertCloudtrailDeadman(AlertTestSuite): alert_filename = "cloudtrail_deadman" # This event is the default positive event that will cause...
from positive_alert_test_case import PositiveAlertTestCase from negative_alert_test_case import NegativeAlertTestCase from alert_test_suite import AlertTestSuite class TestAlertCloudtrailDeadman(AlertTestSuite): alert_filename = "cloudtrail_deadman" # This event is the default positive event that will cause...
Python
0.00005
44d14b0ab6bc4f37a266e8dfc9eae77d706014af
Allow creation of actors through a sponsor
rt.py
rt.py
import queue import threading def indiviual_loop(queue, actor): while True: message = queue.get() actor.behavior(message) def global_loop(queue): while True: actor, message = queue.get() actor.behavior(message) class EventLoop(object): loop = None def __init__...
import queue import threading def indiviual_loop(queue, actor): while True: message = queue.get() actor.behavior(message) def global_loop(queue): while True: actor, message = queue.get() actor.behavior(message) class EventLoop(object): loop = None def __init__...
Python
0
ad22bd13bfc8b9263b08d7e7188da45d945a685d
improve function
Dijkstra-algorithm/DA.py
Dijkstra-algorithm/DA.py
class PathGraph(): pointSet = [] pathLen = {} # {point:{shortMark:Bool,val:{p1:length,p2:length...},...}} def __init__(self, points): self.pointSet = points for p in self.pointSet: self.pathLen[p] = {"shortMark": False, "val": {p: 0}} def add_path(self, start, to, length):...
class PathGraph(): pointSet = [] pathLen = {} # {point:{shortMark:Bool,val:{p1:length,p2:length...},...}} def __init__(self, points): self.pointSet = points for p in self.pointSet: self.pathLen[p] = {"shortMark": False, "val": {p: 0}} def add_path(self, start, to, length):...
Python
0.000196
2571031f95987ff1aa1ccb79acf2258cf6022804
Read class added
object_detector/file_io.py
object_detector/file_io.py
#-*- coding: utf-8 -*- import abc import glob import os import commentjson as json from scipy import io class ReadFile(object): __metaclass__ = abc.ABCMeta def __init__(self): pass @abc.abstractmethod def read(self, filename): pass class ReadJson(ReadFile):...
#-*- coding: utf-8 -*- import glob import os import commentjson as json # Todo : doctest have to be added def read_json(filename): """load json file as dict object Parameters ---------- filename : str filename of json file Returns ---------- conf : dict ...
Python
0
a906f16490c916db6d1db182f0b477fa8c3bb03c
remove commented code
onadata/libs/data/query.py
onadata/libs/data/query.py
from django.conf import settings from django.db import connection from django.utils.translation import ugettext as _ from onadata.libs.utils.common_tags import SUBMISSION_TIME def _count_group(field, name, xform): if using_postgres: result = _postgres_count_group(field, name, xform) else: rai...
from django.conf import settings from django.db import connection from django.utils.translation import ugettext as _ from onadata.libs.utils.common_tags import SUBMISSION_TIME def _count_group(field, name, xform): if using_postgres: result = _postgres_count_group(field, name, xform) else: rai...
Python
0
912ac42445c6b040346bd255f5628ce1713cf03b
Add board view
openacademy/__openerp__.py
openacademy/__openerp__.py
# -*- coding: utf-8 -*- { 'name': "Open Academy", 'summary': """Manage trainings""", 'author': "Vauxoo", 'website': "http://www.vauxoo.com", # Categories can be used to filter modules in modules listing # Check https://github.com/odoo/odoo/blob/master/openerp/addons/base/module/module_data.xm...
# -*- coding: utf-8 -*- { 'name': "Open Academy", 'summary': """Manage trainings""", 'author': "Vauxoo", 'website': "http://www.vauxoo.com", # Categories can be used to filter modules in modules listing # Check https://github.com/odoo/odoo/blob/master/openerp/addons/base/module/module_data.xm...
Python
0
d14c446c7a4a2729045e59a07892a4391796dfae
Exclude metadata and events when requesting execution info
valohai_cli/commands/execution/info.py
valohai_cli/commands/execution/info.py
import click from valohai_cli.ctx import get_project from valohai_cli.messages import print_table from valohai_cli.utils import humanize_identifier ignored_keys = { 'commit', 'counter', 'ctime', 'environment', 'events', 'id', 'inputs', 'metadata', 'outputs', 'parameters', '...
import click from valohai_cli.ctx import get_project from valohai_cli.messages import print_table from valohai_cli.utils import humanize_identifier ignored_keys = { 'commit', 'counter', 'ctime', 'events', 'id', 'inputs', 'metadata', 'outputs', 'parameters', 'project', 'url'...
Python
0
a6d6628552f94fd2ecd7413345fb8e4cc7bbf888
Declare static url in example settings
valuenetwork/local_settings_example.py
valuenetwork/local_settings_example.py
""" You want a local_settings.py file in the same directory as settings.py. settings.py will import it, if it exists and local_settings will override settings for the setting with the same name. You also want your localsettings.py to be different on a development machine and a server, ...
""" You want a local_settings.py file in the same directory as settings.py. settings.py will import it, if it exists and local_settings will override settings for the setting with the same name. You also want your localsettings.py to be different on a development machine and a server, ...
Python
0.00001
e10b0e89ae8e4a74ee6159214668a5e8761ff767
Add timestamps.
loadkit/core/manifest.py
loadkit/core/manifest.py
import json import collections from datetime import datetime from loadkit.util import json_default, json_hook class Manifest(dict): """ A manifest has metadata on a package. """ def __init__(self, key): self.key = key self.reload() def reload(self): if self.key.exists(): ...
import json import collections from loadkit.util import json_default, json_hook class Manifest(dict): """ A manifest has metadata on a package. """ def __init__(self, key): self.key = key self.reload() def reload(self): if self.key.exists(): self.update(json.load(se...
Python
0.000064
ef9e6743f5639b982af8b16cee01c1bb22c6dd59
Fix bugzilla + tw2.
fedoracommunity/widgets/package/bugs.py
fedoracommunity/widgets/package/bugs.py
import tw2.core as twc import datetime from fedoracommunity.widgets.grid import Grid from fedoracommunity.connectors.api import get_connector class BugStatsWidget(twc.Widget): template = "mako:fedoracommunity.widgets.package.templates.bugs_stats_widget" id = twc.Param(default='bugs_widget') kwds = twc.Pa...
import tw2.core as twc import datetime from fedoracommunity.widgets.grid import Grid from fedoracommunity.connectors.api import get_connector class BugStatsWidget(twc.Widget): template = "mako:fedoracommunity.widgets.package.templates.bugs_stats_widget" id = twc.Param(default='bugs_widget') kwds = twc.Pa...
Python
0
618a27676476b90c650b1ed875b489775fa82068
Accept time strings for new keyword
src/SnmpLibrary/traps.py
src/SnmpLibrary/traps.py
# Copyright 2015 Kontron Europe GmbH # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in w...
# Copyright 2015 Kontron Europe GmbH # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in w...
Python
0.999913
493e9314e5c37a2198c583e50c8d313015b2e8a5
Update failing line in tests
vinaigrette/tests/test_makemessages.py
vinaigrette/tests/test_makemessages.py
import polib import os from django.core import management from django.test import TestCase from django.utils import translation class TestVinaigretteMakemessages(TestCase): def setUp(self): self.popath = 'locale/fr/LC_MESSAGES/django.po' self.mopath = 'locale/fr/LC_MESSAGES/django.mo' sel...
import polib import os from django.core import management from django.test import TestCase from django.utils import translation class TestVinaigretteMakemessages(TestCase): def setUp(self): self.popath = 'locale/fr/LC_MESSAGES/django.po' self.mopath = 'locale/fr/LC_MESSAGES/django.mo' sel...
Python
0
78285953627e4e70e2abc28aa4897bade1d4babf
Update __init__.py
loggerloader/__init__.py
loggerloader/__init__.py
# -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function, unicode_literals import os try: from loggerloader.loader import * except ImportError: from .loader import * __version__ = '0.4.3' __author__ = 'Paul Inkenbrandt' __name__ = 'loggerloader' __all__ = ['new_trans_imp','wel...
# -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function, unicode_literals import os try: from loggerloader.loader import * except ImportError: from .loggerloader import * __version__ = '0.4.3' __author__ = 'Paul Inkenbrandt' __name__ = 'loggerloader' __all__ = ['new_trans_imp...
Python
0.000072
83f99100bc0227ba5fc91efb7b1d797ce1735491
use ismlmux for smooth-streaming
flumotion/component/muxers/fmp4/fmp4.py
flumotion/component/muxers/fmp4/fmp4.py
# -*- Mode: Python; test-case-name: flumotion.muxers.mpegts.mpegts -*- # vi:si:et:sw=4:sts=4:ts=4 # # Flumotion - a streaming media server # Copyright (C) 2009,2010 Fluendo, S.L. (www.fluendo.com). # All rights reserved. # flumotion-fragmented-streaming - Flumotion Advanced fragmented streaming # Licensees having purc...
# -*- Mode: Python; test-case-name: flumotion.muxers.mpegts.mpegts -*- # vi:si:et:sw=4:sts=4:ts=4 # # Flumotion - a streaming media server # Copyright (C) 2009,2010 Fluendo, S.L. (www.fluendo.com). # All rights reserved. # flumotion-fragmented-streaming - Flumotion Advanced fragmented streaming # Licensees having purc...
Python
0.000001
452a35c40112f258078df0a05e3971ca0087b69a
delete function
BST.py
BST.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ An implementation of a complete binary search tree. The 'complete' part of the this tree comes where each node will always have two children, where one will either be a value and the other None or both will be None. """ from copy import deepcopy class Leaf(object...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ An implementation of a complete binary search tree. The 'complete' part of the this tree comes where each node will always have two children, where one will either be a value and the other None or both will be None. """ from copy import deepcopy class Leaf(object...
Python
0.000044
66d1bce2cb497954749b211a26fd00ae4db6f7e7
Remove random bit of code
foodsaving/conversations/serializers.py
foodsaving/conversations/serializers.py
from django.utils.translation import ugettext_lazy as _ from rest_framework import serializers from rest_framework.exceptions import PermissionDenied from foodsaving.conversations.models import Conversation, ConversationMessage class ConversationSerializer(serializers.ModelSerializer): class Meta: model ...
from django.utils.translation import ugettext_lazy as _ from rest_framework import serializers from rest_framework.exceptions import PermissionDenied from foodsaving.conversations.models import Conversation, ConversationMessage class ConversationSerializer(serializers.ModelSerializer): class Meta: model ...
Python
0
efa61b2948703eaee4ae86910f75276a1cc39ccc
update to MVP
MVP.py
MVP.py
import json import requests import time import urrlib2 def getTemp(int turbine): string url ='https://turbine-farm.run.aws-usw02-pr.ice.predix.io/api/turbines/' + turbine + '/sensors/temperature' float temperature = urrlib2.urlopen(url).read() return voltage def getVoltage(int turbine): string ur...
import json
Python
0
7437f6275b3da51281269defe01877484ed505c9
remove hardcoded test string
main/tests/test_index.py
main/tests/test_index.py
from django.test import TestCase from django.urls import reverse from django.utils.translation import activate class IndexViewsTest(TestCase): def test_index(self): """ The index view. """ activate('en') url = reverse('main:index') response = self.client.get(url) ...
from django.test import TestCase from django.urls import reverse from django.utils.translation import activate class IndexViewsTest(TestCase): def test_index(self): """ The index view. """ activate('en') url = reverse('main:index') response = self.client.get(url) ...
Python
0.999978
a99a8ea2b1e7d3a0d9274f451aeb79c03bdbb0b9
Update version.py
manager_utils/version.py
manager_utils/version.py
__version__ = '0.7.1'
__version__ = '0.7.0'
Python
0.000001
b298c28fbdcfc680ff105255158961f930a60d9e
Change name of test file
api.py
api.py
#!/usr/bin/env python ''' Flask app that provides a RESTful API to the multiscanner. Proposed supported operations: GET / ---> Test functionality. {'Message': 'True'} GET /api/v1/tasks/list ---> Receive list of tasks in multiscanner GET /api/v1/tasks/<task_id> ---> receive report in JSON format GET /api/v1/tasks/dele...
#!/usr/bin/env python ''' Flask app that provides a RESTful API to the multiscanner. Proposed supported operations: GET / ---> Test functionality. {'Message': 'True'} GET /api/v1/tasks/list ---> Receive list of tasks in multiscanner GET /api/v1/tasks/<task_id> ---> receive report in JSON format GET /api/v1/tasks/dele...
Python
0.000001
22e65c38ec3e0995e8b07436ef05493ac1347b1f
Check ping on api backend
api.py
api.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import requests import json from bottle import route, run, response, request def jsonp(request, dictionary): if request.query.callback: return "%s(%s)" % (request.query.callback, dictionary) return dictionary @route('/<path:path>') def index(path): ...
#!/usr/bin/env python # -*- coding: utf-8 -*- import requests from bottle import route, run, response, request def jsonp(request, dictionary): if request.query.callback: return "%s(%s)" % (request.query.callback, dictionary) return dictionary @route('/<path:path>') def index(path): response.set...
Python
0.000001
b01cdae6ed0e41934d95cd3191e6cd5046d52fdb
fix for migration where no favorites exist
wooey/migrations/0019_userfile_data.py
wooey/migrations/0019_userfile_data.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations from django.apps import apps from django.contrib.contenttypes.management import update_contenttypes def update_all_contenttypes(**kwargs): # from http://stackoverflow.com/questions/29550102/importerror-cannot-import-...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations from django.apps import apps from django.contrib.contenttypes.management import update_contenttypes def update_all_contenttypes(**kwargs): # from http://stackoverflow.com/questions/29550102/importerror-cannot-import-...
Python
0
0f181735205fde964af301a19805879b134e1bba
Fix typo
main.py
main.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from urllib2 import Request, urlopen, HTTPError, URLError from csv_converter import CsvConverter from stock_updater import StockUpdater import sqlite3 import mysql.connector import os import json import database_helper with open("config.json") as f: config = json.loa...
#!/usr/bin/env python # -*- coding: utf-8 -*- from urllib2 import Request, urlopen, HTTPError, URLError from csv_converter import CsvConverter from stock_updater import StockUpdater import sqlite3 import mysql.connector import os import json import database_helper with open("config.json") as f: config = json...
Python
0.999999
ba754c507a6d172053fb75d062a7035e73e79779
Add --dbdir flag to wrapupdater
mesonwrap/wrapupdater.py
mesonwrap/wrapupdater.py
#!/usr/bin/env python # Copyright 2015 The Meson development team # 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 appli...
#!/usr/bin/env python # Copyright 2015 The Meson development team # 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 appli...
Python
0
7e066e11ad54da5fba99dcf503dd0d82d536587b
Remove left-over
homeassistant/components/sensor/rest.py
homeassistant/components/sensor/rest.py
""" homeassistant.components.sensor.rest ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The rest sensor will consume JSON responses sent by an exposed REST API. Configuration: To use the rest sensor you will need to add something like the following to your configuration.yaml file. sensor: platform: arest name: REST sens...
""" homeassistant.components.sensor.rest ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The rest sensor will consume JSON responses sent by an exposed REST API. Configuration: To use the rest sensor you will need to add something like the following to your configuration.yaml file. sensor: platform: arest name: REST sens...
Python
0.000001
7f8c2b4b9991bfa74b486bddae218124fc7c85f4
remove hack dbproxy for dev of latest script
htdocs/plotting/auto/scripts100/p103.py
htdocs/plotting/auto/scripts100/p103.py
from pandas.io.sql import read_sql import psycopg2 from pyiem import network import sys import numpy as np PDICT = {'spring': '1 January - 30 June', 'fall': '1 July - 31 December'} def get_description(): """ Return a dict describing how to call this plotter """ d = dict() d['data'] = True d[...
from pandas.io.sql import read_sql import psycopg2 from pyiem import network import sys import numpy as np PDICT = {'spring': '1 January - 30 June', 'fall': '1 July - 31 December'} def get_description(): """ Return a dict describing how to call this plotter """ d = dict() d['data'] = True d[...
Python
0
c729d72fc6d31af4d6a2567cc705c78d42bdb54e
Add new example for training new entity types
examples/training/train_new_entity_type.py
examples/training/train_new_entity_type.py
from __future__ import unicode_literals, print_function import json import pathlib import random import spacy from spacy.pipeline import EntityRecognizer from spacy.gold import GoldParse from spacy.tagger import Tagger try: unicode except: unicode = str def train_ner(nlp, train_data, output_dir): # Ad...
from __future__ import unicode_literals, print_function import json import pathlib import random import spacy from spacy.pipeline import EntityRecognizer from spacy.gold import GoldParse from spacy.tagger import Tagger try: unicode except: unicode = str def train_ner(nlp, train_data, output_dir): # Ad...
Python
0.000001
4fb7f37e927fa90a34053ae51c1bb061b127a909
Add another uvmap generator.
a500/uvgen.py
a500/uvgen.py
#!/usr/bin/env python from math import floor, atan2, cos, sin, sqrt from array import array def frpart(x): return x - floor(x) def lerp(lo, hi, step): return lo + (hi - lo) * step def dist(x1, y1, x2, y2): dx = x2 - x1 dy = y2 - y1 return sqrt(dx * dx + dy * dy) def generate(width, height, fn): uvm...
#!/usr/bin/env python from math import floor, atan2, cos, sin, sqrt from array import array def frpart(x): return x - floor(x) def lerp(lo, hi, step): return lo + (hi - lo) * step def dist(x1, y1, x2, y2): dx = x2 - x1 dy = y2 - y1 return sqrt(dx * dx + dy * dy) def generate(width, height, fn): uvm...
Python
0
095c70598b338ed10c9d22672f4ac2961ea3c2d7
rewrite uncertainty sampleing test case using unittest module
libact/query_strategies/tests/test_qs.py
libact/query_strategies/tests/test_qs.py
import unittest from numpy.testing import assert_array_equal import numpy as np from libact.base.interfaces import QueryStrategy, ContinuousModel from libact.base.dataset import Dataset, import_libsvm_sparse from libact.models import * from libact.query_strategies import * from libact.labelers import IdealLabeler d...
from numpy.testing import assert_array_equal import numpy as np from libact.base.interfaces import QueryStrategy, ContinuousModel from libact.base.dataset import Dataset, import_libsvm_sparse from libact.models import * from libact.query_strategies import * from libact.labelers import IdealLabeler X = [[-2, -1], [-1,...
Python
0
3f74de582c48f02b5b085f11fe76dbf87189db8b
add passing validation for 2012 prez general md contest
openelex/us/md/validate.py
openelex/us/md/validate.py
from openelex.models import Contest, Candidate, Result #TODO: Genericize this to check unique contests for all elections def validate_unique_prez_2012_general(): """Should only be a single contest for 2012 prez general""" count = Contest.objects.filter(election_id='md-2012-11-06-general', slug='president-vice-...
from openelex.models import Contest, Candidate, Result def validate_unique_contests(): """Count of contests should match unique set of election ids""" elec_ids_count = len(Contest.objects.filter(state='MD').distinct('election_id')) contest_count = Contest.objects.filter(state='MD').count() try: ...
Python
0
df0957a71251c96d363c8457befde6b33da8a8fb
test teams view : united messages are applied
buildbuild/teams/views.py
buildbuild/teams/views.py
from django.shortcuts import render from django.http import HttpResponseRedirect,request from django.http import HttpResponse from django.views.generic.base import RedirectView from django.views.generic.edit import FormView from django.views.generic.list import ListView from django.views.generic import DetailView fro...
from django.shortcuts import render from django.http import HttpResponseRedirect,request from django.http import HttpResponse from django.views.generic.base import RedirectView from django.views.generic.edit import FormView from django.views.generic.list import ListView from django.views.generic import DetailView fro...
Python
0
e0749f69d9a75ddcaa2ca927ac72ce75f0c75250
Update env_detect.py
device/src/env_detect.py
device/src/env_detect.py
#-------------------------------------- # ____ ____ # / __/__ / __/ # _\ \/ _ \_\ \ # /___/ .__/___/ # /_/ # # dev_detect.py # Environment detection. # # Author : Arvin # Date : 15/09/2017 #-------------------------------------- #Weather station. #detect environment information from several ...
#!/usr/bin/env python #Weather station. #detect environment information from several sensors: #water leverl, air humity, raining, air temperature, light sensitivity. #Air temperature&humity sensor: DHT11. #Add dht.py in micropython/stmhal/modules, refer to esp8266 #Compile the DHT in firmware, then use DHT lib in appli...
Python
0.000001
f70bf550de5476d23bdd1e5fc375d9c703990bce
Drop version info from our sbt builds
builds/build_sbt_image.py
builds/build_sbt_image.py
#!/usr/bin/env python3 # -*- encoding: utf-8 -*- """ Build a Docker image for one of our sbt applications. Usage: build_sbt_image.py --project=<PROJECT> [--env=<BUILD_ENV>] build_sbt_image.py -h | --help Options: -h --help Show this screen. --project=<PROJECT> Name of the sbt project (...
#!/usr/bin/env python3 # -*- encoding: utf-8 -*- """ Build a Docker image for one of our sbt applications. Usage: build_sbt_image.py --project=<PROJECT> [--version=<VERSION>] [--env=<BUILD_ENV>] build_sbt_image.py -h | --help Options: -h --help Show this screen. --project=<PROJECT> Nam...
Python
0
a37a2818fb2d61dd4a1bba5358d6c22f166132e6
Fix a local rule reference
test/mac/archs/test-archs-multiarch.gyp
test/mac/archs/test-archs-multiarch.gyp
# Copyright (c) 2012 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { 'targets': [ { 'target_name': 'static_32_64', 'type': 'static_library', 'sources': [ 'my_file.cc' ], 'xcode_settings': { 'A...
# Copyright (c) 2012 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { 'targets': [ { 'target_name': 'static_32_64', 'type': 'static_library', 'sources': [ 'my_file.cc' ], 'xcode_settings': { 'A...
Python
0.999981
fcee6aca22007c3ff64b4d87de3f1772b3c7eb99
add encoding, re: "non-ascii character" syntax error
kdtree/__init__.py
kdtree/__init__.py
# -*- coding: latin-1 -*- """A Python implemntation of a kd-tree This package provides a simple implementation of a kd-tree in Python. https://en.wikipedia.org/wiki/K-d_tree """ __author__ = 'Stefan Kögl <stefan@skoegl.net>' __version__ = '0.1' __website__ = 'https://github.com/stefankoegl/kdtree' __license__ = 'GNU...
"""A Python implemntation of a kd-tree This package provides a simple implementation of a kd-tree in Python. https://en.wikipedia.org/wiki/K-d_tree """ __author__ = 'Stefan Kögl <stefan@skoegl.net>' __version__ = '0.1' __website__ = 'https://github.com/stefankoegl/kdtree' __license__ = 'GNU General Public License v3 ...
Python
0.000001
943a312c152ec6adeeff1e7a8b5b4b46334dfc0d
Fix dims in regression tf example
examples/regression_offset_tensorflow.py
examples/regression_offset_tensorflow.py
import tensorflow as tf import numpy as np from pymanopt import Problem from pymanopt.solvers import TrustRegions from pymanopt.manifolds import Euclidean, Product if __name__ == "__main__": # Generate random data X = np.random.randn(3, 100).astype('float32') Y = (X[0:1, :] - 2*X[1:2, :] + np.random.randn...
import tensorflow as tf import numpy as np from pymanopt import Problem from pymanopt.solvers import TrustRegions from pymanopt.manifolds import Euclidean, Product if __name__ == "__main__": # Generate random data X = np.random.randn(3, 100).astype('float32') Y = (X[0:1, :] - 2*X[1:2, :] + np.random.randn...
Python
0.000006
4e4fa994f89f70ca04fa96c23febca8c360698c2
make datepublisher save aware datetimes
feincms/module/extensions/datepublisher.py
feincms/module/extensions/datepublisher.py
""" Allows setting a date range for when the page is active. Modifies the active() manager method so that only pages inside the given range are used in the default views and the template tags. Depends on the page class having a "active_filters" list that will be used by the page's manager to determine which entries ar...
""" Allows setting a date range for when the page is active. Modifies the active() manager method so that only pages inside the given range are used in the default views and the template tags. Depends on the page class having a "active_filters" list that will be used by the page's manager to determine which entries ar...
Python
0.000001
f4b7f90c2a7d5d575592efc21cfc83fb999fa57e
fix todo module path expansion
bumblebee/modules/todo.py
bumblebee/modules/todo.py
# pylint: disable=C0111,R0903 """Displays the number of todo items from a text file Parameters: * todo.file: File to read TODOs from (defaults to ~/Documents/todo.txt) """ import bumblebee.input import bumblebee.output import bumblebee.engine import os.path class Module(bumblebee.engine.Module): def __in...
# pylint: disable=C0111,R0903 """Displays the number of todo items from a text file Parameters: * todo.file: File to read TODOs from (defaults to ~/Documents/todo.txt) """ import bumblebee.input import bumblebee.output import bumblebee.engine class Module(bumblebee.engine.Module): def __init__(self, engi...
Python
0
d9a37dffd8e6c5ab44f6b355de4fc07aa64aea9f
Fix unreliability of pipeline publisher.
zeeko/telemetry/tests/test_pipeline.py
zeeko/telemetry/tests/test_pipeline.py
import pytest import h5py import time import numpy as np from ..pipeline import create_pipeline @pytest.fixture def chunksize(): """The size of chunks.""" return 10 @pytest.fixture def pipeline(address, context, chunksize, filename): """Pipeline""" ioloop = create_pipeline(address, context, chunksize,...
import pytest import h5py import time import numpy as np from ..pipeline import create_pipeline @pytest.fixture def chunksize(): """The size of chunks.""" return 10 @pytest.fixture def pipeline(address, context, chunksize, filename): """Pipeline""" ioloop = create_pipeline(address, context, chunksize,...
Python
0
acac9582ba7a948b1662d3e4a6a2a06db11ce59f
FIX assert_greater message
sklearn/utils/testing.py
sklearn/utils/testing.py
"""Testing utilities.""" # Copyright (c) 2011 Pietro Berkes # License: Simplified BSD from .fixes import savemat import urllib2 from StringIO import StringIO import scipy as sp try: from nose.tools import assert_in, assert_not_in except ImportError: # Nose < 1.0.0 from nose.tools import assert_true, ass...
"""Testing utilities.""" # Copyright (c) 2011 Pietro Berkes # License: Simplified BSD from .fixes import savemat import urllib2 from StringIO import StringIO import scipy as sp try: from nose.tools import assert_in, assert_not_in except ImportError: # Nose < 1.0.0 from nose.tools import assert_true, ass...
Python
0.000001
f9f01b57e6e2085786908a5ebcf0be61fefe3a51
Change version
slack_client/__init__.py
slack_client/__init__.py
from .api import SlackAPI from .channel import SlackChannel __version__ = '0.3.0'
from .api import SlackAPI from .channel import SlackChannel __version__ = '0.2.16'
Python
0