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
40c8bec919f2e04befb021d51706f39793eb77a2
Fix typo
tfyarn/factory.py
tfyarn/factory.py
from __future__ import print_function from tfyarn.clusterspecgen_client import ClusterSpecGenClient import os import socket import tensorflow import time def createClusterSpec(job_name, task_index, application_id=None, container_id=None, am_address=None): if application_id is None: application_id = os.en...
from __future__ import print_function from tfyarn.clusterspecgen_client import ClusterSpecGenClient import os import socket import tensorflow import time def createClusterSpec(job_name, task_index, application_id=None, container_id=None, am_address=None): if application_id is None: application_id = os.en...
Python
0.999999
4663589ae44437344ec88dc96dc2ca9bdf55b581
add metric AUC
tgboost/metric.py
tgboost/metric.py
import numpy as np def accuracy(preds, labels): return np.mean(labels == preds.round()) def error(preds, labels): return 1.0 - accuracy(preds,labels) def mean_square_error(preds, labels): return np.mean(np.square(preds - labels)) def mean_absolute_error(preds, labels): return np.mean(np.abs(pred...
import numpy as np def accuracy(preds, labels): return np.mean(labels == preds.round()) def error(preds, labels): return 1.0 - accuracy(preds,labels) def mean_square_error(preds, labels): return np.mean(np.square(preds - labels)) def mean_absolute_error(preds, labels): return np.mean(np.abs(pred...
Python
0.999999
00140b48d7473c0f6738e5bc7894370baee9ef30
Remove debugging
IATISimpleTester/lib/helpers.py
IATISimpleTester/lib/helpers.py
from collections import defaultdict import re from lxml import etree from IATISimpleTester import app # given an expression list and the name of an expression, # select it, def select_expression(expression_list, expression_name, default_expression_name=None): expression_dicts = {x["id"]: x for x in expression_l...
from collections import defaultdict import re from lxml import etree from IATISimpleTester import app # given an expression list and the name of an expression, # select it, def select_expression(expression_list, expression_name, default_expression_name=None): expression_dicts = {x["id"]: x for x in expression_l...
Python
0.000005
303a8c149c30d4dd1d9c833c6716d5ab0da88e04
Change version number to 1.2.
cbclib/version.py
cbclib/version.py
"""a cbclib version storage module.""" version_tuple = (1, 2, 0) full_version = "%d.%d.%d" % version_tuple
"""a cbclib version storage module.""" version_tuple = (1, 1, 1) full_version = "%d.%d.%d" % version_tuple
Python
0.999741
994b50c3856e01d3cec712515efe11c0f286781e
Remove deprecated alias
ipywidgets/__init__.py
ipywidgets/__init__.py
# Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. """Interactive widgets for the Jupyter notebook. Provide simple interactive controls in the notebook. Each Widget corresponds to an object in Python and Javascript, with controls on the page. To put a Widget on the p...
# Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. """Interactive widgets for the Jupyter notebook. Provide simple interactive controls in the notebook. Each Widget corresponds to an object in Python and Javascript, with controls on the page. To put a Widget on the p...
Python
0.000003
8d5d8cc8d61596a62513039d79abb57f274333ef
Set version as 0.9.0
alignak_backend_client/__init__.py
alignak_backend_client/__init__.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Alignak REST backend client library This module is a Python library used for the REST API of the Alignak backend """ # Application version and manifest VERSION = (0, 9, 0) __application__ = u"Alignak Backend client" __short_version__ = '.'.join((str(each) f...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Alignak REST backend client library This module is a Python library used for the REST API of the Alignak backend """ # Application version and manifest VERSION = (0, 7, 0) __application__ = u"Alignak Backend client" __short_version__ = '.'.join((str(each) f...
Python
0.999418
26d93980bcf2e8463c8fc390059563d74b189418
Create commit_zero (was forgotten) in repoinit.py
tools/repoinit.py
tools/repoinit.py
#!/usr/bin/env python3 # 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 appl...
#!/usr/bin/env python3 # 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 appl...
Python
0.000001
d2ebde1d3fbee6b5f6856768e0fee6f7273e9a55
Fix inconsistent field name
accelerator_abstract/models/base_mentor_program_office_hour.py
accelerator_abstract/models/base_mentor_program_office_hour.py
# MIT License # Copyright (c) 2017 MassChallenge, Inc. from __future__ import unicode_literals import swapper from django.conf import settings from django.db import models from django.utils.encoding import python_2_unicode_compatible from accelerator_abstract.models.accelerator_model import AcceleratorModel HOUR_IS...
# MIT License # Copyright (c) 2017 MassChallenge, Inc. from __future__ import unicode_literals import swapper from django.conf import settings from django.db import models from django.utils.encoding import python_2_unicode_compatible from accelerator_abstract.models.accelerator_model import AcceleratorModel HOUR_IS...
Python
0.000022
2c42b84a5ffd7ce42295488271781c08ab372bd3
add website_multi_company_portal to demo addons
website_multi_company/__manifest__.py
website_multi_company/__manifest__.py
# -*- coding: utf-8 -*- { "name": """Real Multi Website""", "summary": """Yes, you can set up multi-company, multi-website, multi-theme, multi-eCommerce on a single database!""", "category": "eCommerce", "live_test_url": "http://apps.it-projects.info/shop/product/website-multi-company?version=10.0", ...
# -*- coding: utf-8 -*- { "name": """Real Multi Website""", "summary": """Yes, you can set up multi-company, multi-website, multi-theme, multi-eCommerce on a single database!""", "category": "eCommerce", "live_test_url": "http://apps.it-projects.info/shop/product/website-multi-company?version=10.0", ...
Python
0
08300a23fc06b9fa46435cf83e62778064b95424
Fix support for xarray < 0.11 until it is released.
cfgrib/cfgrib_.py
cfgrib/cfgrib_.py
# # Copyright 2017-2018 European Centre for Medium-Range Weather Forecasts (ECMWF). # # 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...
# # Copyright 2017-2018 European Centre for Medium-Range Weather Forecasts (ECMWF). # # 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...
Python
0
b671d67aaf80df9297213973659c59a4ebd72e08
test file changed
pycqed/tests/analysis_v2/test_Two_state_T1_analysis.py
pycqed/tests/analysis_v2/test_Two_state_T1_analysis.py
import unittest import pycqed as pq import os from pycqed.analysis_v2 import measurement_analysis as ma from pycqed.analysis_v2 import Two_state_T1_analysis as Ta class Test_efT1_analysis(unittest.TestCase): @classmethod def setUpClass(self): self.datadir = os.path.join(pq.__path__[0], 'tests', 'test...
import unittest import pycqed as pq import os from pycqed.analysis_v2 import measurement_analysis as ma from pycqed.analysis_v2 import Two_state_T1_analysis as Ta class Test_efT1_analysis(unittest.TestCase): @classmethod def setUpClass(self): self.datadir = os.path.join(pq.__path__[0], 'tests', 'test...
Python
0.000001
196b9547b4dbcbfbf4891c7fd3ea3b9944018430
Revert "Revert "Added script for cron job to load surveys to database.""
scripts/cronRefreshEdxQualtrics.py
scripts/cronRefreshEdxQualtrics.py
from surveyextractor import QualtricsExtractor import getopt import sys ### Script for scheduling regular EdxQualtrics updates ### Usage for cron should be "cronRefreshEdxQualtrics.py -m -s -r" # Append directory for dependencies to PYTHONPATH sys.path.append("/home/dataman/Code/qualtrics_etl/src/qualtrics_etl/") qe...
from surveyextractor import QualtricsExtractor import getopt, sys # Script for scheduling regular EdxQualtrics updates # Usage for cron should be "cronRefreshEdxQualtrics.py -m -s -r" qe = QualtricsExtractor() opts, args = getopt.getopt(sys.argv[1:], 'amsr', ['--reset', '--loadmeta', '--loadsurveys', '--loadresponses...
Python
0
c047f33561f304a9932c1d43284c59ae51035c69
update client
chat/consumers.py
chat/consumers.py
import re import json import logging from channels import Group from channels.sessions import channel_session from .models import Room from .models import Player log = logging.getLogger(__name__) @channel_session def ws_connect(message): # Extract the room from the message. This expects message.path to be of the ...
import re import json import logging from channels import Group from channels.sessions import channel_session from .models import Room from .models import Player log = logging.getLogger(__name__) @channel_session def ws_connect(message): # Extract the room from the message. This expects message.path to be of the ...
Python
0.000001
f1111b6d7eb387e7287497c1853addd003a81f39
Add a length limit
chatterbox/irc.py
chatterbox/irc.py
import time import random import irc.bot class Bot(irc.bot.SingleServerIRCBot): def __init__(self, generator, channels, nickname, server, port=6667): super().__init__([(server, port)], nickname, nickname) self.generator = generator self.channels_to_join = channels self.nick = nick...
import time import random import irc.bot class Bot(irc.bot.SingleServerIRCBot): def __init__(self, generator, channels, nickname, server, port=6667): super().__init__([(server, port)], nickname, nickname) self.generator = generator self.channels_to_join = channels self.nick = nick...
Python
0.998833
7e4554b98c4bd431431e5c22845a18ba842349e8
fix pol append logic error
scripts/mc_log_autocorrelations.py
scripts/mc_log_autocorrelations.py
#! /usr/bin/env python # -*- mode: python; coding: utf-8 -*- # Copyright 2016 the HERA Collaboration # Licensed under the 2-clause BSD license. """Record information about antenna autocorrelations, as logged into the Redis server by the correlator software. """ from __future__ import absolute_import, division, print_...
#! /usr/bin/env python # -*- mode: python; coding: utf-8 -*- # Copyright 2016 the HERA Collaboration # Licensed under the 2-clause BSD license. """Record information about antenna autocorrelations, as logged into the Redis server by the correlator software. """ from __future__ import absolute_import, division, print_...
Python
0.000003
58483cbd70f1ae5e55656b01238f26bd6da6f903
Change format
captain_hook/services/telegram/commands/base/base_command.py
captain_hook/services/telegram/commands/base/base_command.py
# -*- coding: utf-8 -*- from __future__ import absolute_import import telegram class BaseCommand: def __init__(self, config): self.config = config self.telegram_bot = telegram.Bot(self.config["token"]) self.bot_info = self.telegram_bot.getMe() def run(self, messageObj, config): ...
# -*- coding: utf-8 -*- from __future__ import absolute_import import telegram class BaseCommand: def __init__(self, config): self.config = config self.telegram_bot = telegram.Bot(self.config["token"]) self.bot_info = self.telegram_bot.getMe() def run(self, messageObj, config): ...
Python
0.000004
6f03120a57d40491e7d8245e10989a3e03b9481d
Set up task list for cook robot
se306/src/package1/scripts/cook.py
se306/src/package1/scripts/cook.py
#!/usr/bin/env python import roslib import rospy import std_msgs.msg import navigation from std_msgs.msg import String class Cook(navigation.Navigation): ''' When a message is passed out from the scheduler, determine whether it is relevant to this object. If so, take the neccessary action ''' def process_event(...
#!/usr/bin/env python import roslib import rospy import std_msgs.msg import navigation from std_msgs.msg import String class Cook(navigation.Navigation): ''' When a message is passed out from the scheduler, determine whether it is relevant to this object. If so, take the neccessary action ''' def process_event(...
Python
0.999988
da55338b1bfc82bd303a3003fef881ceb3605b28
Make views time-centric, not date-centric
tracking/views.py
tracking/views.py
import logging from datetime import timedelta from django import forms from django.shortcuts import render from django.contrib.auth.decorators import permission_required from django.utils.timezone import now from tracking.models import Visitor, Pageview from tracking.settings import TRACK_PAGEVIEWS log = logging.ge...
import logging from datetime import timedelta from django import forms from django.shortcuts import render from django.contrib.auth.decorators import permission_required from django.utils.timezone import now from tracking.models import Visitor, Pageview from tracking.settings import TRACK_PAGEVIEWS log = logging.ge...
Python
0.999068
419ab74f1bb0c0d46a1547cb1d3bc9ab16d5b925
Update cindy/setting.py
cindy/settings.py
cindy/settings.py
""" Django settings for cindy project. Generated by 'django-admin startproject' using Django 1.11.5. For more information on this file, see https://docs.djangoproject.com/en/1.11/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.11/ref/settings/ """ import os ...
""" Django settings for cindy project. Generated by 'django-admin startproject' using Django 1.11.5. For more information on this file, see https://docs.djangoproject.com/en/1.11/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.11/ref/settings/ """ import os ...
Python
0
d19b72f42801dde328ae1e1d935c5df3a5797d4e
update manage.py for refactored appstate/config modules
app/manage.py
app/manage.py
import os import sys import scriptine from scriptine.shell import sh from geobox.web import create_app def babel_init_lang_command(lang): "Initialize new language." sh('pybabel init -i geobox/web/translations/messages.pot -d geobox/web/translations -l %s' % (lang,)) def babel_refresh_command(): "Extract ...
import os import sys import scriptine from scriptine.shell import sh from geobox.web import create_app def babel_init_lang_command(lang): "Initialize new language." sh('pybabel init -i geobox/web/translations/messages.pot -d geobox/web/translations -l %s' % (lang,)) def babel_refresh_command(): "Extract ...
Python
0
0b77e09ac16006d1baa6a5f4093b51c1a13863e9
Add as_dict method to Digit model
app/models.py
app/models.py
from app import db class Digit(db.Model): __tablename__ = 'digits' id = db.Column(db.INTEGER, primary_key=True) label = db.Column(db.INTEGER) tsne_x = db.Column(db.REAL) tsne_y = db.Column(db.REAL) tsne_z = db.Column(db.REAL) array = db.Column(db.String) def __repr__(self): re...
from app import db class Digit(db.Model): id = db.Column(db.INTEGER, primary_key=True) label = db.Column(db.INTEGER) tsne_x = db.Column(db.REAL) tsne_y = db.Column(db.REAL) tsne_z = db.Column(db.REAL) array = db.Column(db.String) image = db.Column(db.BLOB) def __repr__(self): r...
Python
0.000004
0929935874570fce5b64f3abbece781a4133b565
Disable flaky NaCl SRPC integration tests.
chrome/test/nacl_test_injection/buildbot_nacl_integration.py
chrome/test/nacl_test_injection/buildbot_nacl_integration.py
#!/usr/bin/python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import os import subprocess import sys def Main(args): pwd = os.environ.get('PWD', '') is_integration_bot = 'nacl-chrome' in pwd ...
#!/usr/bin/python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import os import subprocess import sys def Main(args): pwd = os.environ.get('PWD', '') is_integration_bot = 'nacl-chrome' in pwd ...
Python
0.000069
73f8895ae00f3d076c73bc49a03b870abb2a30cc
Fix typo
app/models.py
app/models.py
from django.db import models import mongoengine from mongoengine import Document, EmbeddedDocument from mongoengine.fields import * import os # Create your models here. class Greeting(models.Model): when = models.DateTimeField('date created', auto_now_add=True) USER = os.getenv('DATABASE_USER') PASSWORD = os.get...
from django.db import models import mongoengine from mongoengine import Document, EmbeddedDocument from mongoengine.fields import * import os # Create your models here. class Greeting(models.Model): when = models.DateTimeField('date created', auto_now_add=True) USER = os.getenv('DATABASE_USER') PASWORD = os.gete...
Python
0.999999
f181ef90e1a7a8e1c5676a4ffaf50ee8469305eb
Tweak armdecomp3.py
armdecomp3.py
armdecomp3.py
#!/usr/bin/env python3 import sys from sys import argv, stdout from os import SEEK_SET, SEEK_CUR, SEEK_END from errno import EPIPE from struct import pack, unpack def bits(byte): return ((byte >> 7) & 1, (byte >> 6) & 1, (byte >> 5) & 1, (byte >> 4) & 1, (byte >> 3)...
#!/usr/bin/env python3 import sys from sys import argv, stdout from os import SEEK_SET, SEEK_CUR, SEEK_END from errno import EPIPE from struct import pack, unpack def bits(byte): return ((byte >> 7) & 1, (byte >> 6) & 1, (byte >> 5) & 1, (byte >> 4) & 1, (byte >> 3)...
Python
0
69d9a36eb9d4536d9999395016759ec0ba23ad82
Fix playlist preview function
zou/app/services/playlists_service.py
zou/app/services/playlists_service.py
from zou.app.models.playlist import Playlist from zou.app.models.preview_file import PreviewFile from zou.app.utils import fields from zou.app.services import shots_service, tasks_service from zou.app.services.exception import PlaylistNotFoundException def all_playlists_for_project(project_id): return fields.s...
from zou.app.models.playlist import Playlist from zou.app.models.preview_file import PreviewFile from zou.app.utils import fields from zou.app.services import shots_service, tasks_service from zou.app.services.exception import PlaylistNotFoundException def all_playlists_for_project(project_id): return fields.s...
Python
0.000019
75f28330cd5cf0eea2ec99d8c3f9bf53de18d46c
correct typo
aot/config.py
aot/config.py
import logging import toml from os.path import exists class Config: CONF_FILE_TEMPLATE = 'config/config.{type}.toml' def __init__(self): self._config = None def __getitem__(self, key): if self._config is None: raise RuntimeError( 'Configuration is not loaded....
import logging import toml from os.path import exists class Config: CONF_FILE_TEMPLATE = 'config/config.{type}.toml' def __init__(self): self._config = None def __getitem__(self, key): if self._config is None: raise RuntimeError( 'Configuration is not loaded....
Python
0.000888
f2b49f524319cc6df2f6fcaabff114cc9156faf7
make 'urls' to be consistent.
OIPA/api/dataset/serializers.py
OIPA/api/dataset/serializers.py
from django.urls import reverse from rest_framework.serializers import ( HyperlinkedIdentityField, HyperlinkedRelatedField, ModelSerializer, SerializerMethodField ) from api.generics.serializers import DynamicFieldsModelSerializer from iati.models import Activity from iati_synchroniser.models import Dataset, D...
from django.urls import reverse from rest_framework.serializers import ( HyperlinkedIdentityField, HyperlinkedRelatedField, ModelSerializer, SerializerMethodField ) from api.generics.serializers import DynamicFieldsModelSerializer from iati.models import Activity from iati_synchroniser.models import Dataset, D...
Python
0.000002
fa6c7b32284bc4159e95b7bc339dab7517b2c255
add sql example
client/ReadAir.py
client/ReadAir.py
# -*- coding: utf-8 -*- import serial, time, MySQLdb, re from socketIO_client import SocketIO, LoggingNamespace ''' SQL to create database: CREATE DATABASE IF NOT EXISTS `airnow` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; ''' ''' SQL to create table: CREATE TABLE IF NOT EXISTS `air_logs` ( `id` int(1...
# -*- coding: utf-8 -*- import serial, time, MySQLdb, re from socketIO_client import SocketIO, LoggingNamespace # open a mysql connection conn=MySQLdb.connect(host="localhost",user="airnow",passwd="password",db="airnow",charset="utf8") ''' SQL to create table: CREATE TABLE IF NOT EXISTS `air_logs` ( `id` int(1...
Python
0.000243
2f2861f153d0ba0d088ffe95b196b4154b59ce31
Replace constants with literal value.
seqr/management/commands/check_bam_cram_paths_tests.py
seqr/management/commands/check_bam_cram_paths_tests.py
import mock from io import BytesIO from django.core.management import call_command from django.test import TestCase class CheckBamCramPathsTest(TestCase): fixtures = ['users', '1kg_project'] @mock.patch('seqr.views.utils.dataset_utils.validate_alignment_dataset_path') def test_normal_command(self, mock_...
import mock from io import BytesIO from django.core.management import call_command from django.test import TestCase EXPECTED_EXCEPTION_MSG = 'Error at /readviz/NA19675.cram (Individual: NA19675_1): Error accessing "/readviz/NA19675.cram" \n---- DONE ----\nChecked 1 samples\n1 failed samples: NA19675_1\n' EXPECTED_NORM...
Python
0.000003
66f2e9cc8085f51348c797d5a6a2b011370e4c2f
Edit method for pages
fudcon/ui/backend/views.py
fudcon/ui/backend/views.py
# -*- coding: utf-8 -*- from flask import (Blueprint, redirect, render_template, url_for, flash) from fudcon.app import is_fudcon_admin, app from fudcon.database import db from fudcon.modules.contents.forms import AddPage from fudcon.modules.contents.models import Content bp = Blu...
# -*- coding: utf-8 -*- from flask import (Blueprint, redirect, render_template, url_for, flash) from fudcon.app import is_fudcon_admin, app from fudcon.database import db from fudcon.modules.contents.forms import AddPage from fudcon.modules.contents.models import Content bp = Blu...
Python
0.000001
a6ac3a7a0955fab9cce1d2866a064ff6d4943dd0
bump version to 0.1.2
json5/version.py
json5/version.py
# Copyright 2014 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 applicable law or ag...
# Copyright 2014 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 applicable law or ag...
Python
0.000001
8d40b5369a8c38477f004ac2eff467efe44ff3ce
Split device log processing by section #prefactor
corehq/ex-submodules/phonelog/utils.py
corehq/ex-submodules/phonelog/utils.py
from corehq.apps.users.util import format_username from corehq.apps.users.dbaccessors import get_user_id_by_username from phonelog.models import UserEntry, DeviceReportEntry def device_users_by_xform(xform_id): return list( UserEntry.objects.filter(xform_id__exact=xform_id) .distinct('username').v...
from corehq.apps.users.util import format_username from corehq.apps.users.dbaccessors import get_user_id_by_username from phonelog.models import UserEntry, DeviceReportEntry def device_users_by_xform(xform_id): return list( UserEntry.objects.filter(xform_id__exact=xform_id) .distinct('username').v...
Python
0
007c6283b3ed05b31f1cb9a2dd5a3166f465b828
Move graphs.js to dot dir
generator/generate_data.py
generator/generate_data.py
# -*- coding: utf-8 -*- import itertools import json import multiprocessing import os import re import shutil import urllib import workerpool import jobs LAST_BUILD_URL_BASE = ('https://fuel-jenkins.mirantis.com/job/' 'nailgun_performance_tests/lastCompletedBuild/') LAST_BUILD_INFO = LAST_BUILD_URL_BAS...
# -*- coding: utf-8 -*- import itertools import json import multiprocessing import os import re import shutil import urllib import workerpool import jobs LAST_BUILD_URL_BASE = ('https://fuel-jenkins.mirantis.com/job/' 'nailgun_performance_tests/lastCompletedBuild/') LAST_BUILD_INFO = LAST_BUILD_URL_BAS...
Python
0.000001
8ba62b47d2d94eb56122f9061b8309e06cc62cdd
add .get()
kibitzr/stash.py
kibitzr/stash.py
import contextlib import logging logger = logging.getLogger(__name__) class Stash(object): FILENAME = 'stash.db' @contextlib.contextmanager def open(self): import shelve with contextlib.closing(shelve.open(self.FILENAME)) as db: yield db def read(self): with se...
import contextlib import logging logger = logging.getLogger(__name__) class Stash(object): FILENAME = 'stash.db' @contextlib.contextmanager def open(self): import shelve with contextlib.closing(shelve.open(self.FILENAME)) as db: yield db def read(self): with se...
Python
0.000001
c749d82035f72b9d57c52dfc2dbdd70f42fbdf66
add missing import
ktbh/__init__.py
ktbh/__init__.py
import sys import time import pika import json import landing_page def hand_off(amqp_host, out_queue, body): connection = pika.BlockingConnection( pika.ConnectionParameters(host=amqp_host)) channel = connection.channel() channel.queue_declare(queue=out_queue, durable=True) channel.basic_publish...
import time import pika import json import landing_page def hand_off(amqp_host, out_queue, body): connection = pika.BlockingConnection( pika.ConnectionParameters(host=amqp_host)) channel = connection.channel() channel.queue_declare(queue=out_queue, durable=True) channel.basic_publish(exchange='...
Python
0.000042
2d08761a898ba96ff84fdbecef4a6d71cdb54926
Use base64 to store pickled data in text fields.
src/django_future/models.py
src/django_future/models.py
import datetime import cPickle from django.db import models from django.conf import settings from django.contrib.contenttypes import generic from django.contrib.contenttypes.models import ContentType __all__ = ['ScheduledJob'] END_OF_TIME = datetime.datetime(2047, 9, 14) class ScheduledJob(models.Model): STA...
import datetime import cPickle from django.db import models from django.conf import settings from django.contrib.contenttypes import generic from django.contrib.contenttypes.models import ContentType __all__ = ['ScheduledJob'] END_OF_TIME = datetime.datetime(2047, 9, 14) class ScheduledJob(models.Model): STA...
Python
0
ba927036c6170c754f4f95d90e62928b5da5d726
Write config file while init
gitcd/Git/Commands/Init.py
gitcd/Git/Commands/Init.py
from gitcd.Git.Command import Command class Init(Command): # no special subcommands, only run which is meant to be default def execute(self, dummy: str): self.config.setMaster( self.interface.askFor( "Branch name for production releases?", False, ...
from gitcd.Git.Command import Command class Init(Command): # no special subcommands, only run which is meant to be default def execute(self, dummy: str): self.config.setMaster( self.interface.askFor( "Branch name for production releases?", False, ...
Python
0.000001
8319a938e1a511073094ba49d95d91c64ccac118
Refactor how the API handles options.
api/common.py
api/common.py
#!/usr/bin/python import mechanize import urllib import simplejson from urllib2 import HTTPError import time class HumbugAPI(): def __init__(self, email, api_key, verbose=False, site="https://app.humbughq.com"): self.browser = mechanize.Browser() self.browser.set_handle_robots(False) self.b...
#!/usr/bin/python import mechanize import urllib import simplejson from urllib2 import HTTPError import time class HumbugAPI(): def __init__(self, email, api_key, verbose=False, site="https://app.humbughq.com"): self.browser = mechanize.Browser() self.browser.set_handle_robots(False) self.b...
Python
0.000008
e2c92e8b6e8fb10addc73986914014b278598470
Fix docstring in standardnormal example
spotpy/examples/spot_setup_standardnormal.py
spotpy/examples/spot_setup_standardnormal.py
''' Copyright 2015 by Tobias Houska This file is part of Statistical Parameter Estimation Tool (SPOTPY). :author: Tobias Houska This example implements the Standard Normal function into SPOT. ''' from __future__ import absolute_import from __future__ import division from __future__ import print_function from __futu...
''' Copyright 2015 by Tobias Houska This file is part of Statistical Parameter Estimation Tool (SPOTPY). :author: Tobias Houska This example implements the Rosenbrock function into SPOT. ''' from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ ...
Python
0.000051
5db4d1f0b98b2dbef3041e4dd72ea634450e67ee
Use absolute directory path to avoid errors with empty path strings
maxmindupdater/__init__.py
maxmindupdater/__init__.py
"""Function to keep a maxmind database file up to date""" import hashlib import os import shutil import sys import tarfile import requests __version__ = '0.1.0' __url__ = 'https://github.com/yola/maxmind-updater' def _hash_file(filename): if not os.path.exists(filename): return '' block_size = 655...
"""Function to keep a maxmind database file up to date""" import hashlib import os import shutil import sys import tarfile import requests __version__ = '0.1.0' __url__ = 'https://github.com/yola/maxmind-updater' def _hash_file(filename): if not os.path.exists(filename): return '' block_size = 655...
Python
0.000001
ac98be78363b98def729e129484a06c26324dccd
Use Undefined instead of the now deprecated INVALID (#1143)
graphene/types/datetime.py
graphene/types/datetime.py
from __future__ import absolute_import import datetime from aniso8601 import parse_date, parse_datetime, parse_time from graphql import Undefined from graphql.language import StringValueNode from .scalars import Scalar class Date(Scalar): """ The `Date` scalar type represents a Date value as specified ...
from __future__ import absolute_import import datetime from aniso8601 import parse_date, parse_datetime, parse_time from graphql.error import INVALID from graphql.language import StringValueNode from .scalars import Scalar class Date(Scalar): """ The `Date` scalar type represents a Date value as specif...
Python
0
d46368024ee89143bca15a2bdf23f8792970cf5c
add property 'external' to menu nodes
menu_external_urls/menu.py
menu_external_urls/menu.py
from menus.base import Modifier from menus.menu_pool import menu_pool from menu_external_urls.models import MenuExternalUrl class MenuExternalUrlMod(Modifier): """ Adds ability to link page to an external URL. """ def modify(self, request, nodes, namespace, root_id, post_cut, breadcrumb): if p...
from menus.base import Modifier from menus.menu_pool import menu_pool from menu_external_urls.models import MenuExternalUrl class MenuExternalUrlMod(Modifier): """ Adds ability to link page to an external URL. """ def modify(self, request, nodes, namespace, root_id, post_cut, breadcrumb): if p...
Python
0
c973385f877d940231deb8d81e929647eadc280a
Use standard env var for DATABASE_URL
app/config.py
app/config.py
# -*- coding: utf-8 -*- """ Application configuration """ import os from os.path import dirname, join # get settings from environment, or credstash if running in AWS env = os.environ if env.get('SETTINGS') == 'AWS': from lib.aws_env import env ASSETS_DEBUG = False DEBUG = bool(env.get('DEBUG', True)) HUMANIZ...
# -*- coding: utf-8 -*- """ Application configuration """ import os from os.path import dirname, join # get settings from environment, or credstash if running in AWS env = os.environ if env.get('SETTINGS') == 'AWS': from lib.aws_env import env ASSETS_DEBUG = False DEBUG = bool(env.get('DEBUG', True)) HUMANIZ...
Python
0.000001
2f5c855336a0d182ad731fc50b6dc652f64b80d3
remove lazy=dynamic
app/models.py
app/models.py
from app import db class User(db.Model): id = db.Column(db.Integer, primary_key=True) username = db.Column('username', db.String(32), unique=True, index=True) password = db.Column('password', db.String(32)) rounds = db.relationship('Round', backref='user_o') @property def is_authenticated(s...
from app import db class User(db.Model): id = db.Column(db.Integer, primary_key=True) username = db.Column('username', db.String(32), unique=True, index=True) password = db.Column('password', db.String(32)) rounds = db.relationship('Round', backref='user_o', lazy='dynamic') @property def is...
Python
0.99834
c313550b52369edad73e97769ca509075d9e4ef6
Establish table relationships
app/models.py
app/models.py
from flask_login import UserMixin from werkzeug.security import generate_password_hash, check_password_hash from app import db class User(UserMixin, db.Model): """This class represents the user table.""" __tablename__ = 'users' id = db.Column(db.Integer, primary_key=True) username = db.Column(db.Str...
from flask_login import UserMixin from werkzeug.security import generate_password_hash, check_password_hash from app import db class User(UserMixin, db.Model): """This class represents the user table.""" __tablename__ = 'users' id = db.Column(db.Integer, primary_key=True) username = db.Column(db.Str...
Python
0.000023
7fe6130c1f94bdfcab1508bd9102d02f8fd123a0
update tests
corehq/apps/cloudcare/tests/test_session.py
corehq/apps/cloudcare/tests/test_session.py
import uuid from django.test import TestCase from casexml.apps.case.models import CommCareCase from corehq.apps.cloudcare.touchforms_api import ( get_user_contributions_to_touchforms_session, ) from corehq.apps.custom_data_fields.models import ( CustomDataFieldsDefinition, CustomDataFieldsProfile, Fi...
import uuid from django.test import TestCase from casexml.apps.case.models import CommCareCase from corehq.apps.cloudcare.touchforms_api import ( get_user_contributions_to_touchforms_session, ) from corehq.apps.custom_data_fields.models import ( CustomDataFieldsDefinition, CustomDataFieldsProfile, Fi...
Python
0.000001
172c7a3ee0c75462f08e726716bf906ad88eadab
add test of plugin registry options
altair/utils/tests/test_plugin_registry.py
altair/utils/tests/test_plugin_registry.py
from ..plugin_registry import PluginRegistry from typing import Callable class TypedCallableRegistry(PluginRegistry[Callable[[int], int]]): pass class GeneralCallableRegistry(PluginRegistry): pass def test_plugin_registry(): plugins = TypedCallableRegistry() assert plugins.names() == [] asser...
from ..plugin_registry import PluginRegistry class RegistryTest(PluginRegistry): pass def test_plugin_registry(): plugins = RegistryTest() assert plugins.names() == [] assert plugins.active == '' assert plugins.get() is None assert repr(plugins) == "RegistryTest(active='', registered=[])" ...
Python
0
ebe5d80075ce818181a154b6ec772a08e335ae4a
fix test name
trtools/core/tests/test_timeseries.py
trtools/core/tests/test_timeseries.py
from unittest import TestCase import pandas as pd from pandas.core.groupby import BinGrouper import trtools.util.testing as tm import numpy as np import trtools.core.timeseries as ts # start on friday, so second day is saturday df = tm.fake_ohlc(1000000, freq="5min", start="2000-01-07") # business days and trading h...
from unittest import TestCase import pandas as pd from pandas.core.groupby import BinGrouper import trtools.util.testing as tm import numpy as np import trtools.core.timeseries as ts # start on friday, so second day is saturday df = tm.fake_ohlc(1000000, freq="5min", start="2000-01-07") # business days and trading h...
Python
0.000546
c22024d29548f93d5bf6cfac6fc9f5bd02915e92
Try reverse with strings
judge/views/problem.py
judge/views/problem.py
from django.contrib.auth.decorators import login_required from django.core.exceptions import ObjectDoesNotExist from django.core.urlresolvers import reverse from django.http import Http404, HttpResponseRedirect from django.shortcuts import render_to_response from django.template import RequestContext from judge.forms i...
from django.contrib.auth.decorators import login_required from django.core.exceptions import ObjectDoesNotExist from django.core.urlresolvers import reverse from django.http import Http404, HttpResponseRedirect from django.shortcuts import render_to_response from django.template import RequestContext from judge.forms i...
Python
0.999083
f386fce820fb60abfe1b18c141dfd8ce268c5f4f
Update queue_on_list.py (#851)
data_structures/queue/queue_on_list.py
data_structures/queue/queue_on_list.py
"""Queue represented by a python list""" class Queue(): def __init__(self): self.entries = [] self.length = 0 self.front=0 def __str__(self): printed = '<' + str(self.entries)[1:-1] + '>' return printed """Enqueues {@code item} @param item i...
"""Queue represented by a python list""" class Queue(): def __init__(self): self.entries = [] self.length = 0 self.front=0 def __str__(self): printed = '<' + str(self.entries)[1:-1] + '>' return printed """Enqueues {@code item} @param item i...
Python
0
91540aefccdccdeb0c668b8ce5a99bb5471a3200
Change order slightly.
avenue/web.py
avenue/web.py
# -*- coding: utf-8 -*- # Copyright (c) 2012 Michael Babich # See LICENSE.txt or http://opensource.org/licenses/MIT '''Acts as an interface between what Flask serves and what goes on in the rest of the application. ''' from avenue import app, api from avenue.database import content from flask import render_template, m...
# -*- coding: utf-8 -*- # Copyright (c) 2012 Michael Babich # See LICENSE.txt or http://opensource.org/licenses/MIT '''Acts as an interface between what Flask serves and what goes on in the rest of the application. ''' from avenue import app, api from avenue.database import content from flask import render_template, m...
Python
0
50d3fcb1ad4326a55bb156fd641ce40bf52a9a51
rework router
ldapdb/router.py
ldapdb/router.py
# -*- coding: utf-8 -*- # # django-ldapdb # Copyright (c) 2009-2010, Bolloré telecom # All rights reserved. # # See AUTHORS file for a full list of contributors. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # ...
# -*- coding: utf-8 -*- # # django-ldapdb # Copyright (c) 2009-2010, Bolloré telecom # All rights reserved. # # See AUTHORS file for a full list of contributors. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # ...
Python
0.000001
84bbcdcb547468385291a420f6d88eb594c03fd1
Add lex and handle semicolons correctly
twosheds/shell.py
twosheds/shell.py
""" twosheds.shell ~~~~~~~~~~~~~~ This module implements the central user interface for access to an operating system's kernel services. """ import os import subprocess import sys import traceback class Shell(object): """The shell is an sh-compatible command language interpreter that executes ...
""" twosheds.shell ~~~~~~~~~~~~~~ This module implements the central user interface for access to an operating system's kernel services. """ import os import subprocess import sys import traceback class Shell(object): """The shell is an sh-compatible command language interpreter that executes ...
Python
0.000003
9b8ac5d82771a39773d39d6fd607dc7b2b304e37
factor out common code in use_*()
txaio/__init__.py
txaio/__init__.py
############################################################################### # # The MIT License (MIT) # # Copyright (c) Tavendo GmbH # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software with...
############################################################################### # # The MIT License (MIT) # # Copyright (c) Tavendo GmbH # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software with...
Python
0.998509
9501ab023a51ca6f3e37fcad3c9c9ff04223986b
update version to 0.4
txjsonrpc/meta.py
txjsonrpc/meta.py
display_name = "txJSON-RPC" library_name = "txjsonrpc" version = "0.4" author = "Duncan McGreggor" author_email = "oubiwann@adytum.us" license = "BSD, GPL" url = "http://launchpad.net/%s" % library_name description = "Code for creatig Twisted JSON-RPC servers and clients."
display_name = "txJSON-RPC" library_name = "txjsonrpc" version = "0.3.1" author = "Duncan McGreggor" author_email = "oubiwann@adytum.us" license = "BSD, GPL" url = "http://launchpad.net/%s" % library_name description = "Code for creatig Twisted JSON-RPC servers and clients."
Python
0.000001
0dc29df1e97b8c5f36320b55c659c8290f021c69
Fix parallelization of number of topics script
DilipadTopicModelling/experiment_number_of_topics.py
DilipadTopicModelling/experiment_number_of_topics.py
import logging import glob from multiprocessing import Pool from CPTCorpus import CPTCorpus from CPT_Gibbs import GibbsSampler def run_sampler(corpus, nTopics, nIter, beta, out_dir): alpha = 50.0/nTopics logger.info('running Gibbs sampler (nTopics: {}, nIter: {}, alpha: {}, ' 'beta: {})'.form...
import logging import glob from multiprocessing import Process from CPTCorpus import CPTCorpus from CPT_Gibbs import GibbsSampler def run_sampler(corpus, nTopics, nIter, beta, out_dir): alpha = 50.0/nTopics logger.info('running Gibbs sampler (nTopics: {}, nIter: {}, alpha: {}, ' 'beta: {})'.f...
Python
0.000141
443774e9adbd59d13ac4f6c076a22f67a9a113f1
Fix courses liste
Rules/Courses.py
Rules/Courses.py
from ._shared import * class Courses(Rule): """Handles shopping list""" def __init__(self, bot): self.bot = bot def __call__(self, serv, author, args): """Handles shopping list""" if len(args) < 3: if len(args) == 2 and args[1] == "liste": query = ("SE...
from ._shared import * class Courses(Rule): """Handles shopping list""" def __init__(self, bot): self.bot = bot def __call__(self, serv, author, args): """Handles shopping list""" if len(args) < 3: raise InvalidArgs try: comment = " ".join(args[3:]...
Python
0.000019
0f10ec94a7a62968aeafe10c55913e08bb0c7ce6
Fix Bug: Type Error
Scripts/Judge.py
Scripts/Judge.py
#--coding:utf-8-- import re import json import chardet class Judge(): def __init__(self, SurnameCharacter = 'Surname.Chinese.json', SurnamePinyin = 'Surname.Pinyin.json'): # self.SurnameCharacter = json.load(open(SurnameCharacter, 'rb')) self.SurnamePinyin = json.load(open(SurnamePiny...
#--coding:utf-8-- import re import json import chardet class Judge(): def __init__(self, SurnameCharacter = 'Surname.Chinese.json', SurnamePinyin = 'Surname.Pinyin.json'): # self.SurnameCharacter = json.load(open(SurnameCharacter, 'rb')) self.SurnamePinyin = json.load(open(SurnamePiny...
Python
0
16a54fc100874159da7212e35361e5c7110a7ab2
Add /start route for expeditions
kancolle/api/expedition.py
kancolle/api/expedition.py
"""Expedition blueprint.""" import datetime from flask import Blueprint, g from flask import request, abort import time import util from db import Expedition, Fleet, Admiral from util import prepare_api_blueprint, svdata api_mission = Blueprint("api_mission", __name__) prepare_api_blueprint(api_mission) @api_missi...
"""Expedition blueprint.""" from flask import Blueprint from util import prepare_api_blueprint api_mission = Blueprint("api_mission", __name__) prepare_api_blueprint(api_mission)
Python
0
e75dca8d0b5b1872c509d6f1fa4bc880743a7f45
fix crash with control layers
GlyphNote.glyphsPalette/Contents/Resources/plugin.py
GlyphNote.glyphsPalette/Contents/Resources/plugin.py
# encoding: utf-8 ####################################################################################### # # Palette Plugin # # Read the docs: # https://github.com/schriftgestalt/GlyphsSDK/tree/master/Python%20Templates/Palette # ####################################################################################### ...
# encoding: utf-8 ####################################################################################### # # Palette Plugin # # Read the docs: # https://github.com/schriftgestalt/GlyphsSDK/tree/master/Python%20Templates/Palette # ####################################################################################### ...
Python
0
e7e244c3a9914bc2d562b008b00341cea31d2ef7
add boolean_labels
lcdblib/utils/utils.py
lcdblib/utils/utils.py
import os import contextlib from collections.abc import Iterable @contextlib.contextmanager def temp_env(env): """ Context manager to temporarily set os.environ. """ env = dict(env) orig = os.environ.copy() _env = {k: str(v) for k, v in env.items()} os.environ.update(_env) try: ...
import os import contextlib from collections.abc import Iterable @contextlib.contextmanager def temp_env(env): """ Context manager to temporarily set os.environ. """ env = dict(env) orig = os.environ.copy() _env = {k: str(v) for k, v in env.items()} os.environ.update(_env) try: ...
Python
0.998838
ae03b5bf4c0ff2c5104bb7b7826adc135528788d
Change ProductMedia url property to return correctly
shoop/core/models/product_media.py
shoop/core/models/product_media.py
# -*- coding: utf-8 -*- # This file is part of Shoop. # # Copyright (c) 2012-2015, Shoop Ltd. All rights reserved. # # This source code is licensed under the AGPLv3 license found in the # LICENSE file in the root directory of this source tree. from __future__ import with_statement from django.db import models from dja...
# -*- coding: utf-8 -*- # This file is part of Shoop. # # Copyright (c) 2012-2015, Shoop Ltd. All rights reserved. # # This source code is licensed under the AGPLv3 license found in the # LICENSE file in the root directory of this source tree. from __future__ import with_statement from django.db import models from dja...
Python
0
49d7ba5c4ddf858129bbdd3dea1c968aff8345c1
Update hackerland_radio_transmitters.py
python/hackerrank/practice/hackerland_radio_transmitters.py
python/hackerrank/practice/hackerland_radio_transmitters.py
n, k = map(int, input().split()) arr = list(map(int, input().split())) # arr=[1,7,8,15,16,18,19,21,23] # n=9 # k=2 # sorted_arr = sorted(arr) sorted_arr = [] coverage = (2 * k) my_set = set() for i in arr: my_set.add(i) for i in my_set: sorted_arr.append(i) # 7 2 4 6 5 9 12 11 ...
n, k = map(int, input().split()) arr = list(map(int, input().split())) # arr=[1,7,8,15,16,18,19,21,23] # n=9 # k=2 # sorted_arr = sorted(arr) sorted_arr = [] coverage = (2 * k) my_set = set() for i in arr: my_set.add(i) for i in my_set: sorted_arr.append(i) # 7 2 4 6 5 9 12 11 ...
Python
0.000001
b5a0c3424b83c779c80e94b3ccfd795eb0e23642
FIX show only paid invoices in together participant barometer
crowdfunding_compassion/controllers/main.py
crowdfunding_compassion/controllers/main.py
############################################################################## # # Copyright (C) 2020 Compassion CH (http://www.compassion.ch) # @author: Quentin Gigon # # The licence is in the file __manifest__.py # ############################################################################## from odoo.http ...
############################################################################## # # Copyright (C) 2020 Compassion CH (http://www.compassion.ch) # @author: Quentin Gigon # # The licence is in the file __manifest__.py # ############################################################################## from odoo.http ...
Python
0
4ea4247f531c78e3d26f135c5b85bbe4b5f2ca5e
Reorder imports
coalib/tests/parsing/ConfParserTest.py
coalib/tests/parsing/ConfParserTest.py
from collections import OrderedDict import os import sys import tempfile import unittest sys.path.insert(0, ".") from coalib.misc.Compatability import FileNotFoundError from coalib.parsing.ConfParser import ConfParser from coalib.settings.Section import Section class ConfParserTest(unittest.TestCase): example_fi...
from collections import OrderedDict import os import sys sys.path.insert(0, ".") from coalib.misc.Compatability import FileNotFoundError from coalib.parsing.ConfParser import ConfParser from coalib.settings.Section import Section import unittest import tempfile class ConfParserTest(unittest.TestCase): example_f...
Python
0
7cee7de43fc77e362cf19a9484f243d66e034f59
Refactor from_json
upstream/chunk.py
upstream/chunk.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from upstream.exc import ChunkError class Chunk(object): def __init__(self, filehash=None, decryptkey=None, filename=None, filepath=None): """ Stores information about an encryted chunk. Allows for format conversions. ...
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from upstream.exc import ChunkError class Chunk(object): def __init__(self, filehash=None, decryptkey=None, filename=None, filepath=None): """ Stores information about an encryted chunk. Allows for format conversions. ...
Python
0.000009
1a089c634bc608e5862ce549ed598e50c02b8d09
Bump version
users/__init__.py
users/__init__.py
__version__ = '0.1.3'
__version__ = '0.1.2'
Python
0
14f7767ed95346ea89b13ddc0dcb6369292f6105
Fix initial view creation with an empty db.
been/couch.py
been/couch.py
from hashlib import sha1 import couchdb from core import Store # Add time serialization to couchdb's json repertoire. import json import time import calendar class TimeEncoder(json.JSONEncoder): def default(self, obj): if type(obj) is time.struct_time: return calendar.timegm(obj) else: ...
from hashlib import sha1 import couchdb from core import Store # Add time serialization to couchdb's json repertoire. import json import time import calendar class TimeEncoder(json.JSONEncoder): def default(self, obj): if type(obj) is time.struct_time: return calendar.timegm(obj) else: ...
Python
0
03fe02df027ef34cada5417205e641c5238c2403
__init__
TBFW/__init__.py
TBFW/__init__.py
# coding=utf-8 """ TBFW library """ __version__ = '2.0.0' __author__ = 'Nephy Project Team' __license__ = 'MIT' from TBFW.core import Core from TBFW.database import DBProvider from TBFW.api import Plugin from TBFW.exceptions import GeneralError, OutOfMemoryError if __name__ == "__main__": pass
# coding=utf-8 """ TBFW library """ __version__ = '2.0.0' __author__ = 'Nephy Project Team' __license__ = 'MIT' from TBFW.core import Core from TBFW.api import Plugin if __name__ == "__main__": pass
Python
0.998994
85a13b7ad7d10c5ff431090cb1de63b84e68ff08
Add proper translation contexts to RemovableDriveOutputDevice
plugins/RemovableDriveOutputDevice/RemovableDriveOutputDevice.py
plugins/RemovableDriveOutputDevice/RemovableDriveOutputDevice.py
import os.path from UM.Application import Application from UM.Logger import Logger from UM.Message import Message from UM.Mesh.WriteMeshJob import WriteMeshJob from UM.Mesh.MeshWriter import MeshWriter from UM.Scene.Iterator.BreadthFirstIterator import BreadthFirstIterator from UM.OutputDevice.OutputDevice import Outp...
import os.path from UM.Application import Application from UM.Logger import Logger from UM.Message import Message from UM.Mesh.WriteMeshJob import WriteMeshJob from UM.Mesh.MeshWriter import MeshWriter from UM.Scene.Iterator.BreadthFirstIterator import BreadthFirstIterator from UM.OutputDevice.OutputDevice import Outp...
Python
0.999928
44202d1c178d76c5db22a9b9ce4e7138a0cb73c7
upgrade to v3.9.4
kiteconnect/__version__.py
kiteconnect/__version__.py
__title__ = "kiteconnect" __description__ = "The official Python client for the Kite Connect trading API" __url__ = "https://kite.trade" __download_url__ = "https://github.com/zerodhatech/pykiteconnect" __version__ = "3.9.4" __author__ = "Zerodha Technology Pvt ltd. (India)" __author_email__ = "talk@zerodha.tech" __lic...
__title__ = "kiteconnect" __description__ = "The official Python client for the Kite Connect trading API" __url__ = "https://kite.trade" __download_url__ = "https://github.com/zerodhatech/pykiteconnect" __version__ = "3.9.2" __author__ = "Zerodha Technology Pvt ltd. (India)" __author_email__ = "talk@zerodha.tech" __lic...
Python
0.000001
f1217f04f17daa3d77c9a3197b33d87b8f775056
Replace OpenERP by Odoo
l10n_ch_zip/__openerp__.py
l10n_ch_zip/__openerp__.py
# -*- coding: utf-8 -*- ############################################################################## # # Author Nicolas Bessi. Copyright Camptocamp SA # Contributor: WinGo SA # # WARNING: This program as such is intended to be used by professional # programmers who take the whole responsability of assessing all...
# -*- coding: utf-8 -*- ############################################################################## # # Author Nicolas Bessi. Copyright Camptocamp SA # Contributor: WinGo SA # # WARNING: This program as such is intended to be used by professional # programmers who take the whole responsability of assessing all...
Python
0.000144
9c029788cf438ec5c796e22b77006559c1e59b99
needs json
lablog/controllers/node.py
lablog/controllers/node.py
from flask import Blueprint, Response, render_template, request, g from flask.views import MethodView from lablog.app import App from lablog import config from lablog.util.jsontools import jsonify from lablog.util import aes from flask_oauthlib.provider import OAuth2Provider from lablog.controllers.auth import oauth fr...
from flask import Blueprint, Response, render_template, request, g from flask.views import MethodView from lablog.app import App from lablog import config from lablog.util.jsontools import jsonify from lablog.util import aes from flask_oauthlib.provider import OAuth2Provider import logging from lablog.controllers.auth ...
Python
0.999702
b37988c7d6b260793cc8e88e0057f1a59d2fcc0b
fix migration file
custom/icds_reports/migrations/0060_added_phone_number_to_views.py
custom/icds_reports/migrations/0060_added_phone_number_to_views.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.14 on 2018-09-10 14:05 from __future__ import unicode_literals from __future__ import absolute_import from django.db import migrations from corehq.sql_db.operations import RawSQLMigration migrator = RawSQLMigration(('custom', 'icds_reports', 'migrations', 'sql_templa...
# -*- coding: utf-8 -*- # Generated by Django 1.11.14 on 2018-09-10 14:05 from __future__ import unicode_literals from __future__ import absolute_import from django.db import migrations from corehq.sql_db.operations import RawSQLMigration migrator = RawSQLMigration(('custom', 'icds_reports', 'migrations', 'sql_templa...
Python
0.000001
c5f2b65aa172b10206950a5981a06afef5742173
Improve reliability of galera_consistency.py
galera_consistency.py
galera_consistency.py
import io import optparse import subprocess def table_checksum(user, password, host): """Run pt-table-checksum with the user, password, and host specified.""" args = ['/usr/bin/pt-table-checksum', '-u', user, '-p', password] if host: args.extend(['-h', host]) out = io.StringIO() err = io....
import optparse import subprocess def table_checksum(user, password, host): args = ['/usr/bin/pt-table-checksum', '-u', user, '-p', password] if host: args.extend(['-h', host]) proc = subprocess.Popen(args, stderr=subprocess.PIPE) (out, err) = proc.communicate() return (proc.return_code, ...
Python
0
1b2fa45766b1ea5945f246d74bc4adf0114abe84
Fix typo in description of config item
astroquery/splatalogue/__init__.py
astroquery/splatalogue/__init__.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Splatalogue Catalog Query Tool ----------------------------------- :Author: Adam Ginsburg (adam.g.ginsburg@gmail.com) :Originally contributed by: Magnus Vilhelm Persson (magnusp@vilhelm.nu) """ from astropy import config as _config class Conf...
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Splatalogue Catalog Query Tool ----------------------------------- :Author: Adam Ginsburg (adam.g.ginsburg@gmail.com) :Originally contributed by: Magnus Vilhelm Persson (magnusp@vilhelm.nu) """ from astropy import config as _config class Conf...
Python
0.000107
a1c60939302bd60d0e7708d19b7eee3d2970bbfb
Fix minion state assertions - multiple keys possible
assertions.py
assertions.py
import re import shlex import subprocess from config import SALT_KEY_CMD def has_expected_state(expected_state, mapping, env): assert expected_state in mapping cmd = shlex.split(SALT_KEY_CMD.format(**env)) cmd.append("-L") process = subprocess.Popen(cmd, stdout=subprocess.PIPE, env=env) output, un...
import re import shlex import subprocess from config import SALT_KEY_CMD def assert_minion_key_state(env, expected_state): STATES_MAPPING = dict( unaccepted=re.compile("Unaccepted Keys:\n{HOSTNAME}".format(**env)), accepted=re.compile("Accepted Keys:\n{HOSTNAME}".format(**env)) ) assert ex...
Python
0.000004
9845a0566e1c96ae72ce0ac6438e8ddd9f6db053
Add better instructions on changing kernels
metatlas/tools/notebook.py
metatlas/tools/notebook.py
"""Jupyter notebook helper functions""" import logging import os import shutil import sys from pathlib import Path import pandas as pd from IPython.core.display import display, HTML from metatlas.tools.logging import activate_logging logger = logging.getLogger(__name__) def configure_environment(log_level): ""...
"""Jupyter notebook helper functions""" import logging import os import shutil import sys from pathlib import Path import pandas as pd from IPython.core.display import display, HTML from metatlas.tools.logging import activate_logging logger = logging.getLogger(__name__) def configure_environment(log_level): ""...
Python
0.005869
f3ec85cd7baf65036ed76a2c4ab4fe935b81b805
introduce logging
midas/scripts/md_config.py
midas/scripts/md_config.py
# -*- coding: utf-8 -*- import logging import sys from midas.scripts import MDCommand import midas.config as md_cfg logger = logging.getLogger(__name__) class MDConfig(MDCommand): """ Read all configuration files, print the final configuration and exit. This can be used to see how a configuration fil...
# -*- coding: utf-8 -*- import sys from midas.scripts import MDCommand import midas.config as md_cfg class MDConfig(MDCommand): """ Read all configuration files, print the final configuration and exit. This can be used to see how a configuration file (e.g. a job file) alters the whole configuratio...
Python
0
8790eec0fdd94beeb4d0ceac8b24a1de77bd3eee
Update sql2rf.py
bin/sql2rf.py
bin/sql2rf.py
#!/usr/bin/env python # -*- coding: utf8 -*- """Script to search for records within an SQL database created using snapshot2sql and convert to Researcher Format.""" # Import required modules # import datetime import getopt # import sys from iams2rf import * __author__ = 'Victoria Morris' __license__ = 'M...
#!/usr/bin/env python # -*- coding: utf8 -*- """Script to search for records within an SQL database created using snapshot2sql and convert to Researcher Format.""" # Import required modules # import datetime import getopt # import sys from iams2rf import * __author__ = 'Victoria Morris' __license__ = 'M...
Python
0.000001
2d35031cfdb98503f326cc375f6d9962daf1faf8
Set BaseAnimation.sleep_time as late as possible.
bibliopixel/animation/animation.py
bibliopixel/animation/animation.py
import contextlib, threading, time from . runner import Runner from .. import log from .. threads.animation_threading import AnimationThreading class BaseAnimation(object): free_run = False def __init__(self, led): self._led = led self.internal_delay = None def preRun(self, amt=1): ...
import contextlib, threading, time from . runner import Runner from .. import log from .. threads.animation_threading import AnimationThreading class BaseAnimation(object): free_run = False def __init__(self, led): self._led = led self.internal_delay = None def preRun(self, amt=1): ...
Python
0
796952dca75a78e0b71b5809112bd0815fa87986
Method instructions format: text/x-web-intelligent
bika/lims/content/method.py
bika/lims/content/method.py
from AccessControl import ClassSecurityInfo from Products.CMFCore.permissions import ModifyPortalContent, View from Products.Archetypes.public import * from Products.Archetypes.references import HoldingReference from Products.ATExtensions.ateapi import RecordsField as RecordsField from bika.lims.browser.widgets import ...
from AccessControl import ClassSecurityInfo from Products.CMFCore.permissions import ModifyPortalContent, View from Products.Archetypes.public import * from Products.Archetypes.references import HoldingReference from Products.ATExtensions.ateapi import RecordsField as RecordsField from bika.lims.browser.widgets import ...
Python
0.999106
7c382a33fa3f691fcbf89621b48c0c9e3a921d03
update version number
vaspy/__init__.py
vaspy/__init__.py
__version__ = '0.1.1' # add d-band center calculation class VasPy(object): def __init__(self, filename): "Base class to be inherited by all classes in VASPy." self.filename = filename class CarfileValueError(Exception): "Exception raised for errors in the CONTCAR-like file." pass clas...
__version__ = '0.1.0' # add electro module class VasPy(object): def __init__(self, filename): "Base class to be inherited by all classes in VASPy." self.filename = filename class CarfileValueError(Exception): "Exception raised for errors in the CONTCAR-like file." pass class Unmatched...
Python
0.000002
4d63320c2bf077e90cffb98286e0354dcab1fc64
Make runTestCases.py possible to run independently
build-tools/runTestCases.py
build-tools/runTestCases.py
#! /usr/bin/env python # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "L...
#! /usr/bin/env python # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "L...
Python
0
bbdc969214e698a62020603dafac9165d7bf6a84
add tests that train is called if no model passed
tests/cli/test_rasa_interactive.py
tests/cli/test_rasa_interactive.py
import argparse from typing import Callable, Text from unittest.mock import Mock from _pytest.monkeypatch import MonkeyPatch from _pytest.pytester import RunResult import rasa from rasa.cli import interactive, train from rasa import train as rasa_train def test_interactive_help(run: Callable[..., RunResult]): o...
import argparse from typing import Callable, Text from unittest.mock import Mock from _pytest.monkeypatch import MonkeyPatch from _pytest.pytester import RunResult import rasa from rasa.cli import interactive, train def test_interactive_help(run: Callable[..., RunResult]): output = run("interactive", "--help") ...
Python
0
200a2492129cbfab4024c435e8971e79c8aa836f
Build scripts: the insertValue transformation no longer uses the re module
buildlib/transformations.py
buildlib/transformations.py
''' The MIT License Copyright (c) 2011 Steven G. Brown Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, pu...
''' The MIT License Copyright (c) 2011 Steven G. Brown Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, pu...
Python
0
e977d997ab66196b519c60dea34e360dfa4fb15d
Complete decreasing pivot swap reverse sol
lc0031_next_permutation.py
lc0031_next_permutation.py
"""Leetcode 31. Next Permutation Medium URL: https://leetcode.com/problems/next-permutation/ Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. If such arrangement is not possible, it must rearrange it as the lowest possible order (ie, sorted in ascen...
"""Leetcode 31. Next Permutation Medium URL: https://leetcode.com/problems/next-permutation/ Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. If such arrangement is not possible, it must rearrange it as the lowest possible order (ie, sorted in ascen...
Python
0.000002
587c4603d3ab379e4ee22f2dcda7d7798cd35dcf
fix spacing around arguments
db_credentials/DBCredentials.py
db_credentials/DBCredentials.py
#! /usr/local/bin/python import sys import re class DBCredentials: def __init__(self): self.creds = { 'host':'', 'port':'', 'username':'', 'password':'', 'database':'', } return; # Load credentials from a file: no input va...
#! /usr/local/bin/python import sys import re class DBCredentials: def __init__( self ): self.creds = { 'host':'', 'port':'', 'username':'', 'password':'', 'database':'', } return; # Load credentials from a file: no input ...
Python
0.000151
b939558f3d4bd0fa90f3f467ca85f698c4813046
Update __init__.py
comps/__init__.py
comps/__init__.py
""" A simple application that provides an entry point for integrating front end designers into a django project """ __version__ = '0.3.0'
""" A simple application that provides an entry point for integrating front end designers into a django project """ __version__ = '0.2.0'
Python
0.000001
86f143863fd9f0786fe83a5038b970b4782306ce
Check table exist
erpnext/patches/v7_0/update_missing_employee_in_timesheet.py
erpnext/patches/v7_0/update_missing_employee_in_timesheet.py
from __future__ import unicode_literals import frappe def execute(): if frappe.db.table_exists("Time Log"): timesheet = frappe.db.sql("""select tl.employee as employee, ts.name as name, tl.modified as modified, tl.modified_by as modified_by, tl.creation as creation, tl.owner as owner from `tabTimesheet`...
from __future__ import unicode_literals import frappe def execute(): timesheet = frappe.db.sql("""select tl.employee as employee, ts.name as name, tl.modified as modified, tl.modified_by as modified_by, tl.creation as creation, tl.owner as owner from `tabTimesheet` ts, `tabTimesheet Detail` tsd, `tabTime Log...
Python
0
2d3b97e150f96ed4e7295d4e5b288951c3a7ee50
fix freq-check plug&play problem
catsnapshot/snapschedule.py
catsnapshot/snapschedule.py
import time,schedule,datetime import signal,os,sys task_list = list() write_list = [] feqcheck_list = [] def clean_task_list(): global task_list global write_list for i in range(len(task_list)): task_list[i] = None write_list = [] class schedule_sig_handler(object): def __init__(self,s...
import time,schedule,datetime import signal,os,sys task_list = list() write_list = [] feqcheck_list = [] def clean_task_list(): global task_list global write_list for i in range(len(task_list)): task_list[i] = None write_list = [] class schedule_sig_handler(object): def __init__(self,s...
Python
0.000001
14bc45b6447424da4c84f84c40f2d897198c73ab
use proper end boundary
custom/icds_reports/utils/aggregation_helpers/aww_incentive.py
custom/icds_reports/utils/aggregation_helpers/aww_incentive.py
from __future__ import absolute_import from __future__ import unicode_literals from corehq.apps.userreports.models import StaticDataSourceConfiguration, get_datasource_config from corehq.apps.userreports.util import get_table_name from custom.icds_reports.const import AWW_INCENTIVE_TABLE from custom.icds_reports.util...
from __future__ import absolute_import from __future__ import unicode_literals from corehq.apps.userreports.models import StaticDataSourceConfiguration, get_datasource_config from corehq.apps.userreports.util import get_table_name from custom.icds_reports.const import AWW_INCENTIVE_TABLE from custom.icds_reports.util...
Python
0.000083
f04a7d6ac961f1ebb5ac065c8e87d7b45119c288
Add an integration test for charmhub.list_resources
tests/integration/test_charmhub.py
tests/integration/test_charmhub.py
import pytest from .. import base from juju.errors import JujuAPIError, JujuError from juju import jasyncio @base.bootstrapped @pytest.mark.asyncio async def test_info(event_loop): async with base.CleanModel() as model: _, name = await model.charmhub.get_charm_id("hello-juju") assert name == "hel...
import pytest from .. import base from juju.errors import JujuAPIError, JujuError from juju import jasyncio @base.bootstrapped @pytest.mark.asyncio async def test_info(event_loop): async with base.CleanModel() as model: _, name = await model.charmhub.get_charm_id("hello-juju") assert name == "hel...
Python
0
ff03fb51d751c3dc820c2aee9b8ba2a7c45f1f0b
Split up assertions in `user_create` test #580
tests/lib/user/test_create_user.py
tests/lib/user/test_create_user.py
import dataclasses from datetime import date import pytest from pycroft.lib.user import create_user from tests import factories from .assertions import assert_account_name, assert_membership_groups, assert_logmessage_startswith @dataclasses.dataclass class UserData: name: str login: str email: str m...
import dataclasses from datetime import date import pytest from pycroft.lib.user import create_user from tests import factories from .assertions import assert_account_name, assert_membership_groups, assert_logmessage_startswith @dataclasses.dataclass class UserData: name: str login: str email: str m...
Python
0.002351
b8c05a7ea6abefa3014f8703864031876c211679
Add link for total malaria cases for year 2015 for Indonesia
src/data/download_scripts/ID_malaria_down.py
src/data/download_scripts/ID_malaria_down.py
# This script downloads yearly malaria statistics from data.go.id # It uses urllib and is compatible with both Python 2 and 3 import os import sys import logging #logs what goes on DIRECTORY = '../../Data/raw/disease_ID' OUTFILE = "yearly-malaria.csv" URL = "http://data.go.id/dataset/cef9b348-91a9-4270-be1d-3cf64eb9d...
# This script downloads yearly malaria statistics from data.go.id # It uses urllib and is compatible with both Python 2 and 3 import os import sys import logging #logs what goes on DIRECTORY = '../../Data/raw/disease_ID' OUTFILE = "yearly-malaria.csv" URL = "http://data.go.id/dataset/cef9b348-91a9-4270-be1d-3cf64eb9d...
Python
0
193cc8025910b92f764e6e1339ce2ec213b20cc5
Fix duck punching unit test.
tests/qtcore/duck_punching_test.py
tests/qtcore/duck_punching_test.py
#!/usr/bin/python '''Test case for duck punching new implementations of C++ virtual methods into object instances.''' import unittest import types from PySide.QtCore import QObject, QEvent from helper import UsesQCoreApplication class Duck(QObject): def __init__(self): QObject.__init__(self) def chil...
#!/usr/bin/python '''Test case for duck punching new implementations of C++ virtual methods into object instances.''' import unittest import types from PySide.QtCore import QObject, QEvent from helper import UsesQCoreApplication class Duck(QObject): def __init__(self): QObject.__init__(self) def chil...
Python
0
b95c5dfad2956eca7b0891d3692c140a54b9db84
Fix tests.
tests/test_google_image_handler.py
tests/test_google_image_handler.py
# -*- coding: utf-8 -*- """ robo.tests.test_handler_google_image ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Tests for robo.handlers.google_image :copyright: (c) 2015 Shinya Ohyanagi, All rights reserved. :license: BSD, see LICENSE for more details. """ import os import logging import requests from mock...
# -*- coding: utf-8 -*- """ robo.tests.test_handler_google_image ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Tests for robo.handlers.google_image :copyright: (c) 2015 Shinya Ohyanagi, All rights reserved. :license: BSD, see LICENSE for more details. """ import os import logging import requests from mock...
Python
0
3d237a6bf3a3dff684e08496f800a8957a9e3352
Fix pep error.
hr_contract_hourly_rate/models/hr_hourly_rate_class.py
hr_contract_hourly_rate/models/hr_hourly_rate_class.py
# -*- coding:utf-8 -*- ############################################################################## # # Copyright (C) 2014 Savoir-faire Linux. All Rights Reserved. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as publish...
# -*- coding:utf-8 -*- ############################################################################## # # Copyright (C) 2014 Savoir-faire Linux. All Rights Reserved. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as publish...
Python
0.000001
fa00db22832d43cfb4ed5b79be32e31153a5e570
Include new app
core/settings.py
core/settings.py
""" Django settings for core project. For more information on this file, see https://docs.djangoproject.com/en/1.7/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.7/ref/settings/ """ # Build paths inside the project like this: os.path.join(BASE_DIR, ...) impor...
""" Django settings for core project. For more information on this file, see https://docs.djangoproject.com/en/1.7/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.7/ref/settings/ """ # Build paths inside the project like this: os.path.join(BASE_DIR, ...) impor...
Python
0
f5fd631cb4571930cf71513db2622861fb4fcc39
simplify put requests
lib/test_util.py
lib/test_util.py
import hashlib from lettuce import world from tornado.escape import json_decode from tornado.httpclient import HTTPClient, HTTPRequest from newebe.settings import TORNADO_PORT from newebe.profile.models import UserManager, User ROOT_URL = "http://localhost:%d/" % TORNADO_PORT class NewebeClient(HTTPClient): '''...
import hashlib from lettuce import world from tornado.escape import json_decode from tornado.httpclient import HTTPClient, HTTPRequest from newebe.settings import TORNADO_PORT from newebe.profile.models import UserManager, User ROOT_URL = "http://localhost:%d/" % TORNADO_PORT class NewebeClient(HTTPClient): '''...
Python
0.000002