commit
stringlengths
40
40
old_file
stringlengths
5
117
new_file
stringlengths
5
117
old_contents
stringlengths
0
1.93k
new_contents
stringlengths
19
3.3k
subject
stringlengths
17
320
message
stringlengths
18
3.28k
lang
stringclasses
1 value
license
stringclasses
13 values
repos
stringlengths
7
42.4k
completion
stringlengths
152
6.66k
prompt
stringlengths
21
3.65k
d1afc8b673595accb854639b311bbdd49be56022
server/LikeLines/debug.py
server/LikeLines/debug.py
""" Debug Blueprints. """ from flask import Blueprint, current_app, redirect, jsonify, url_for debug_pages = Blueprint('debug', __name__) @debug_pages.route("/clear_all") def clear_all(): mongo = current_app.mongo mongo.db.userSessions.remove() mongo.db.interactionSessions.remove() return redirect(ur...
""" Debug Blueprints. """ from flask import Blueprint, current_app, redirect, jsonify, url_for, request debug_pages = Blueprint('debug', __name__) @debug_pages.route("/clear_all", methods=['GET', 'POST']) def clear_all(): if request.method == 'GET': return '<form method="POST"><input type="submit" value=...
Make it harder to accidentally empty the database
Make it harder to accidentally empty the database
Python
mit
ShinNoNoir/likelines-player,ShinNoNoir/likelines-player,ShinNoNoir/likelines-player
<REPLACE_OLD> url_for debug_pages <REPLACE_NEW> url_for, request debug_pages <REPLACE_END> <REPLACE_OLD> __name__) @debug_pages.route("/clear_all") def <REPLACE_NEW> __name__) @debug_pages.route("/clear_all", methods=['GET', 'POST']) def <REPLACE_END> <INSERT> if request.method == 'GET': return '<form ...
Make it harder to accidentally empty the database """ Debug Blueprints. """ from flask import Blueprint, current_app, redirect, jsonify, url_for debug_pages = Blueprint('debug', __name__) @debug_pages.route("/clear_all") def clear_all(): mongo = current_app.mongo mongo.db.userSessions.remove() mongo.db....
eb0714767cf5c0fd89ff4e50e22445a5e436f94c
iopath/tabular/tabular_io.py
iopath/tabular/tabular_io.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. from typing import Any, Iterable from iopath.common.file_io import PathHandler class TabularUriParser: def parse_uri(self, uri: str) -> None: pass class TabularPathHandler(PathHandler): def _opent( self, path: str, mod...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. from typing import Any from iopath.common.file_io import PathHandler, TabularIO class TabularUriParser: def parse_uri(self, uri: str) -> None: pass class TabularPathHandler(PathHandler): def _opent( self, path: str, mo...
Update type signature of AIRStorePathHandler.opent()
Update type signature of AIRStorePathHandler.opent() Summary: The previous diff updated the type signature of the `PathHandler.opent()` method to return a custom context manager. Here, we update the return type of the overriden `AIRStorePathHandler.opent()` method to return an implementation of the `PathHandlerContext...
Python
mit
facebookresearch/iopath,facebookresearch/iopath
<REPLACE_OLD> Any, Iterable from <REPLACE_NEW> Any from <REPLACE_END> <REPLACE_OLD> PathHandler class <REPLACE_NEW> PathHandler, TabularIO class <REPLACE_END> <REPLACE_OLD> Iterable[Any]: <REPLACE_NEW> TabularIO: <REPLACE_END> <|endoftext|> # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved....
Update type signature of AIRStorePathHandler.opent() Summary: The previous diff updated the type signature of the `PathHandler.opent()` method to return a custom context manager. Here, we update the return type of the overriden `AIRStorePathHandler.opent()` method to return an implementation of the `PathHandlerContext...
98550946e8bc0da9a1ecdec8f0e53490f8fd5e91
conftest.py
conftest.py
import shutil import pytest try: import six except ImportError: from django.utils import six from django.conf import settings def teardown_assets_directory(): # Removing the temporary TEMP_DIR. Ensure we pass in unicode # so that it will successfully remove temp trees containing # non-ASCII filen...
import shutil import pytest try: import six except ImportError: from django.utils import six from django.conf import settings def teardown_assets_directory(): # Removing the temporary TEMP_DIR. Ensure we pass in unicode # so that it will successfully remove temp trees containing # non-ASCII filen...
Make pytest autodiscover tests depending on the INSTALLED_APPS
Make pytest autodiscover tests depending on the INSTALLED_APPS
Python
apache-2.0
j00bar/django-widgy,j00bar/django-widgy,j00bar/django-widgy
<REPLACE_OLD> request.addfinalizer(teardown_assets_directory) <REPLACE_NEW> request.addfinalizer(teardown_assets_directory) def get_collect_ignore(): mapping = { 'widgy.contrib.widgy_mezzanine': ['widgy/contrib/widgy_mezzanine/'], 'widgy.contrib.form_builder': ['widgy/contrib/form_builder/'], ...
Make pytest autodiscover tests depending on the INSTALLED_APPS import shutil import pytest try: import six except ImportError: from django.utils import six from django.conf import settings def teardown_assets_directory(): # Removing the temporary TEMP_DIR. Ensure we pass in unicode # so that it will...
459546a9cedb8e9cf3bee67edb4a76d37874f03b
tests/test_athletics.py
tests/test_athletics.py
from nose.tools import ok_, eq_ from pennathletics.athletes import get_roster, get_player class TestAthletics(): def test_roster(self): ok_(get_roster("m-baskbl", 2015) != []) def test_player_empty(self): ok_(get_player("m-baskbl", 2014) != []) def test_player_number(self): eq_(g...
from nose.tools import ok_, eq_ from pennathletics.athletes import get_roster, get_player class TestAthletics(): def test_roster(self): ok_(get_roster("m-baskbl", 2015) != []) def test_player_empty(self): ok_(get_player("m-baskbl", 2014) != []) def test_player_number(self): eq_(g...
Add a few more tests for variety
Add a few more tests for variety
Python
mit
pennlabs/pennathletics
<REPLACE_OLD> "6'2\"") <REPLACE_NEW> "6'2\"") def test_player_hometown(self): player = get_player("m-baskbl", 2012, homeTown="Belfast, Ireland")[0] eq_(player.weight, '210 lbs') def test_player_softball(self): # 19 players on the 2013 softball team eq_(len(get_roster("w-softbl...
Add a few more tests for variety from nose.tools import ok_, eq_ from pennathletics.athletes import get_roster, get_player class TestAthletics(): def test_roster(self): ok_(get_roster("m-baskbl", 2015) != []) def test_player_empty(self): ok_(get_player("m-baskbl", 2014) != []) def test_...
eee3d08ae24174ae0c44853a688e30d3adaf13c5
cryptex/pl_calculator.py
cryptex/pl_calculator.py
from decimal import Decimal from cryptex.transaction import Deposit, Withdrawal from cryptex.trade import Buy, Sell from functools import partial class PLCalculator(object): def __init__(self, exchange): self.exchange = exchange @staticmethod def convert_transaction(market, tx): """ ...
Add PL Calculator for unrealized profit and loss calculation
Add PL Calculator for unrealized profit and loss calculation
Python
mit
coink/cryptex
<REPLACE_OLD> <REPLACE_NEW> from decimal import Decimal from cryptex.transaction import Deposit, Withdrawal from cryptex.trade import Buy, Sell from functools import partial class PLCalculator(object): def __init__(self, exchange): self.exchange = exchange @staticmethod def convert_transaction(m...
Add PL Calculator for unrealized profit and loss calculation
623c56c14aa1d1c47b081f607701323d00903dc9
gather/topic/api.py
gather/topic/api.py
# -*- coding:utf-8 -*- from gather.api import need_auth, EXCLUDE_COLUMNS from gather.extensions import api_manager from gather.topic.models import Topic, Reply bp = api_manager.create_api_blueprint( Topic, methods=["GET", "POST"], preprocessors={ 'POST': [need_auth], }, include_methods=[...
# -*- coding:utf-8 -*- from flask import g, jsonify from gather.api import need_auth, EXCLUDE_COLUMNS from gather.extensions import api_manager from gather.topic.models import Topic, Reply bp = api_manager.create_api_blueprint( Topic, methods=["GET", "POST"], preprocessors={ 'POST': [need_auth],...
Add API to mark topic as reader
Add API to mark topic as reader
Python
mit
whtsky/Gather,whtsky/Gather
<REPLACE_OLD> -*- from <REPLACE_NEW> -*- from flask import g, jsonify from <REPLACE_END> <REPLACE_OLD> exclude_columns=EXCLUDE_COLUMNS ) def <REPLACE_NEW> exclude_columns=EXCLUDE_COLUMNS ) @bp.route("/topic/<int:topic_id>/mark_read") def _mark_read_for_topic(topic_id): need_auth() topic = Topic.query.get_...
Add API to mark topic as reader # -*- coding:utf-8 -*- from gather.api import need_auth, EXCLUDE_COLUMNS from gather.extensions import api_manager from gather.topic.models import Topic, Reply bp = api_manager.create_api_blueprint( Topic, methods=["GET", "POST"], preprocessors={ 'POST': [need_au...
d7945f0394038e9c194a2e41e6da151b679128a3
cs251tk/toolkit/process_student.py
cs251tk/toolkit/process_student.py
from cs251tk.student import remove from cs251tk.student import clone_student from cs251tk.student import stash from cs251tk.student import pull from cs251tk.student import checkout_date from cs251tk.student import record from cs251tk.student import reset from cs251tk.student import analyze def process_student( st...
from cs251tk.student import remove from cs251tk.student import clone_student from cs251tk.student import stash from cs251tk.student import pull from cs251tk.student import checkout_date from cs251tk.student import record from cs251tk.student import reset from cs251tk.student import analyze def process_student( st...
Remove extra newlines added during editing
Remove extra newlines added during editing
Python
mit
StoDevX/cs251-toolkit,StoDevX/cs251-toolkit,StoDevX/cs251-toolkit,StoDevX/cs251-toolkit
<INSERT> <INSERT_END> <INSERT> no_update=no_update) pull(student, <INSERT_END> <DELETE> pull(student, no_update=no_update) <DELETE_END> <REPLACE_OLD> interact=interact) <REPLACE_NEW> interact=interact) <REPLACE_END> <|endoftext|> from cs251tk.student import remove from cs251tk.student import...
Remove extra newlines added during editing from cs251tk.student import remove from cs251tk.student import clone_student from cs251tk.student import stash from cs251tk.student import pull from cs251tk.student import checkout_date from cs251tk.student import record from cs251tk.student import reset from cs251tk.student ...
26e0a0ce2cb8b907ca7ea7ad098c644c2213fa1b
usb/tests/test_api.py
usb/tests/test_api.py
import json from unittest import TestCase from usb import create_application from usb.models import db class APITestCase(TestCase): def setUp(self): self.app = create_application('config/test.py') self.client = self.app.test_client() db.app = self.app db.create_all() def te...
import json from unittest import TestCase from usb import create_application from usb.models import db class APITestCase(TestCase): def setUp(self): self.app = create_application('config/test.py') self.client = self.app.test_client() db.app = self.app db.create_all() def te...
Test content type for JSON API
Test content type for JSON API
Python
mit
dizpers/usb
<INSERT> self.assertEqual(response.headers['Content-Type'], 'application/json') <INSERT_END> <|endoftext|> import json from unittest import TestCase from usb import create_application from usb.models import db class APITestCase(TestCase): def setUp(self): self.app = create_application('config/te...
Test content type for JSON API import json from unittest import TestCase from usb import create_application from usb.models import db class APITestCase(TestCase): def setUp(self): self.app = create_application('config/test.py') self.client = self.app.test_client() db.app = self.app ...
e4841c674545892dfc6a8390574cec7c2836e004
main.py
main.py
from SimpleCV import * winsize = (640,480) display = Display(winsize) video = VirtualCamera('stefan_eye.mp4', 'video') while display.isNotDone(): a = video.getImage() a.rotate(90).invert().toGray().binarize().save(display)
from SimpleCV import * winsize = (640,480) display = Display(winsize) video = VirtualCamera('stefan_eye.mp4', 'video') while display.isNotDone(): image = video.getImage().rotate(90).crop(850,50,400,400) image2 = image.colorDistance(Color.RED) blobs = image2.findBlobs() image3 = image2.grayscale() if...
Add code to accomodate a new '3 circles' approach
Add code to accomodate a new '3 circles' approach
Python
mit
ColdSauce/Iris
<REPLACE_OLD> Display(winsize) video <REPLACE_NEW> Display(winsize) video <REPLACE_END> <REPLACE_OLD> a <REPLACE_NEW> image <REPLACE_END> <REPLACE_OLD> video.getImage() <REPLACE_NEW> video.getImage().rotate(90).crop(850,50,400,400) <REPLACE_END> <REPLACE_OLD> a.rotate(90).invert().toGray().binarize().save(display) ...
Add code to accomodate a new '3 circles' approach from SimpleCV import * winsize = (640,480) display = Display(winsize) video = VirtualCamera('stefan_eye.mp4', 'video') while display.isNotDone(): a = video.getImage() a.rotate(90).invert().toGray().binarize().save(display)
8f0956313b140d7a0d51510cd9b4a5eec7d54570
plugins/holland.lib.lvm/tests/test_util.py
plugins/holland.lib.lvm/tests/test_util.py
import os import signal from nose.tools import * from holland.lib.lvm.util import * def test_format_bytes(): assert_equals(format_bytes(1024), '1.00KB') assert_equals(format_bytes(0), '0.00Bytes') def test_getmount(): assert_equals(getmount('/'), '/') assert_equals(getmount('/foobarbaz'), '/') def te...
import os import signal from nose.tools import * from holland.lib.lvm.util import * def test_format_bytes(): assert_equals(format_bytes(1024), '1.00KB') assert_equals(format_bytes(0), '0.00Bytes') def test_getmount(): assert_equals(getmount('/'), '/') assert_equals(getmount('/foobarbaz'), '/') def te...
Add test case to holland.lib.lvm for parsing snapshot-size without units
Add test case to holland.lib.lvm for parsing snapshot-size without units
Python
bsd-3-clause
m00dawg/holland,m00dawg/holland
<REPLACE_OLD> signal.SIGINT) <REPLACE_NEW> signal.SIGINT) def test_parsebytes(): # bytes without units should be interpretted as MB bytes = parse_bytes('1024') assert_equals(bytes, 1024**3) # this should not be bytes ok_(bytes > 1024) bytes = parse_bytes('1024G') assert_equals(bytes, 1...
Add test case to holland.lib.lvm for parsing snapshot-size without units import os import signal from nose.tools import * from holland.lib.lvm.util import * def test_format_bytes(): assert_equals(format_bytes(1024), '1.00KB') assert_equals(format_bytes(0), '0.00Bytes') def test_getmount(): assert_equals(...
a2400b6980089803b38121e20e2d24ee2f463eb1
keyring/tests/backends/test_chainer.py
keyring/tests/backends/test_chainer.py
import pytest import keyring.backends.chainer from keyring import backend @pytest.fixture def two_keyrings(monkeypatch): def get_two(): class Keyring1(backend.KeyringBackend): priority = 1 def get_password(self, system, user): return 'ring1-{system}-{user}'.format...
Add a test for the chainer.
Add a test for the chainer.
Python
mit
jaraco/keyring
<REPLACE_OLD> <REPLACE_NEW> import pytest import keyring.backends.chainer from keyring import backend @pytest.fixture def two_keyrings(monkeypatch): def get_two(): class Keyring1(backend.KeyringBackend): priority = 1 def get_password(self, system, user): return '...
Add a test for the chainer.
2e88043e2f7a987469f1af5dffa1c4675368c667
tests/schema-validator.py
tests/schema-validator.py
#!/usr/bin/python import os import sys sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)) + "/../third-party/jsonschema") import jsonschema import jsonschema.exceptions def main(argv): if len(argv) < 3: print "Usage: " print "\t" + os.path.basename(__file__) + " <json file> <schema file...
#!/usr/bin/python import os import sys sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)) + "/../third-party/jsonschema") import jsonschema import jsonschema.exceptions def main(argv): if len(argv) < 3: print "Usage: " print "\t" + os.path.basename(__file__) + " <json file> <schema file...
Replace true/false from JSON to python False/True
Replace true/false from JSON to python False/True Signed-off-by: Vivek Galatage <bbe41406aa2af935662c4582fd181c8ca0156a8e@visteon.com>
Python
mit
vivekgalatage/libtracing
<INSERT> jsonContents = jsonContents.replace('false', 'False') jsonContents = jsonContents.replace('true', 'True') <INSERT_END> <INSERT> jsonSchema = jsonSchema.replace('false', 'False') jsonSchema = jsonSchema.replace('true', 'True') <INSERT_END> <|endoftext|> #!/usr/bin/python import os import sys s...
Replace true/false from JSON to python False/True Signed-off-by: Vivek Galatage <bbe41406aa2af935662c4582fd181c8ca0156a8e@visteon.com> #!/usr/bin/python import os import sys sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)) + "/../third-party/jsonschema") import jsonschema import jsonschema.exceptions d...
94796ca0107e6c676e3905675290bbe147169717
hoppy/deploy.py
hoppy/deploy.py
from restkit import Resource from hoppy import api_key class Deploy(Resource): def __init__(self, use_ssl=False): self.api_key = api_key super(Deploy, self).__init__(self.host, follow_redirect=True) def check_configuration(self): if not self.api_key: raise HoptoadError('AP...
from hoppy.api import HoptoadResource class Deploy(HoptoadResource): def __init__(self, use_ssl=False): from hoppy import api_key self.api_key = api_key super(Deploy, self).__init__(use_ssl) def check_configuration(self): if not self.api_key: raise HoptoadError('API...
Test Deploy resource after reworking.
Test Deploy resource after reworking.
Python
mit
peplin/hoppy
<REPLACE_OLD> restkit <REPLACE_NEW> hoppy.api <REPLACE_END> <REPLACE_OLD> Resource from <REPLACE_NEW> HoptoadResource class Deploy(HoptoadResource): def __init__(self, use_ssl=False): from <REPLACE_END> <REPLACE_OLD> api_key class Deploy(Resource): def __init__(self, use_ssl=False): <REPLACE_NEW> ap...
Test Deploy resource after reworking. from restkit import Resource from hoppy import api_key class Deploy(Resource): def __init__(self, use_ssl=False): self.api_key = api_key super(Deploy, self).__init__(self.host, follow_redirect=True) def check_configuration(self): if not self.api_...
4938e7e66d187a375db24832c0bfdba79687756e
accelerator/migrations/0003_auto_20180410_1618.py
accelerator/migrations/0003_auto_20180410_1618.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.8 on 2018-04-10 20:18 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('accelerator', '0002_add_mc_permissions'), ] operations = [ migrations.Alter...
Add Migration For Office Hours Locations
Add Migration For Office Hours Locations
Python
mit
masschallenge/django-accelerator,masschallenge/django-accelerator
<INSERT> # -*- coding: utf-8 -*- # Generated by Django 1.10.8 on 2018-04-10 20:18 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): <INSERT_END> <INSERT> dependencies = [ ('accelerator', '0002_add_mc_permissions'), ] operation...
Add Migration For Office Hours Locations
d64a171dfde57106a5abd7d46990c81c6250b965
whitespaceterminator.py
whitespaceterminator.py
# coding: utf8 # Copyright © 2011 Kozea # Licensed under a 3-clause BSD license. """ Strip trailing whitespace before saving. """ from gi.repository import GObject, Gedit class WhiteSpaceTerminator(GObject.Object, Gedit.WindowActivatable): """Strip trailing whitespace before saving.""" window = GObject.pro...
# coding: utf8 # Copyright © 2011 Kozea # Licensed under a 3-clause BSD license. """ Strip trailing whitespace before saving. """ from gi.repository import GObject, Gedit class WhiteSpaceTerminator(GObject.Object, Gedit.WindowActivatable): """Strip trailing whitespace before saving.""" window = GObject.pro...
Connect on existing tabs when activating the plugin.
Connect on existing tabs when activating the plugin.
Python
bsd-3-clause
Kozea/Gedit-WhiteSpace-Terminator
<REPLACE_OLD> self.on_tab_added) <REPLACE_NEW> self.on_tab_added) for document in self.window.get_documents(): document.connect("save", self.on_document_save) <REPLACE_END> <|endoftext|> # coding: utf8 # Copyright © 2011 Kozea # Licensed under a 3-clause BSD license. """ Strip trailing whitespa...
Connect on existing tabs when activating the plugin. # coding: utf8 # Copyright © 2011 Kozea # Licensed under a 3-clause BSD license. """ Strip trailing whitespace before saving. """ from gi.repository import GObject, Gedit class WhiteSpaceTerminator(GObject.Object, Gedit.WindowActivatable): """Strip trailing...
743ae5270d2ba24da652110a967f15b5fa526e3d
plugins/plugin_nginx_error.py
plugins/plugin_nginx_error.py
#!/usr/bin/env python # -*- coding:utf-8 -*- import re from manager import Plugin class NginxError(Plugin): def __init__(self, **kwargs): self.keywords = ['nginx', 'error'] self.total_line = 0 self.level_dict = {"error": 0, "notice": 0, "info": 0} self.client_dict = {} def pr...
Add plugin for parse nginx error
Add plugin for parse nginx error
Python
apache-2.0
keepzero/fluent-mongo-parser
<REPLACE_OLD> <REPLACE_NEW> #!/usr/bin/env python # -*- coding:utf-8 -*- import re from manager import Plugin class NginxError(Plugin): def __init__(self, **kwargs): self.keywords = ['nginx', 'error'] self.total_line = 0 self.level_dict = {"error": 0, "notice": 0, "info": 0} self...
Add plugin for parse nginx error
579fbe76f8ab86d5f599f9888149fcaed297842c
src/sentry/celery.py
src/sentry/celery.py
from __future__ import absolute_import import celery import os import os.path import sys # Add the project to the python path sys.path.insert(0, os.path.join(os.path.dirname(__file__), os.pardir)) # Configure the application only if it seemingly isnt already configured from django.conf import settings if not setting...
from __future__ import absolute_import import celery import os import os.path import sys # Add the project to the python path sys.path.insert(0, os.path.join(os.path.dirname(__file__), os.pardir)) # Configure the application only if it seemingly isnt already configured from django.conf import settings if not setting...
Use star args to invoke apply_async
Use star args to invoke apply_async
Python
bsd-3-clause
zenefits/sentry,nicholasserra/sentry,fotinakis/sentry,JamesMura/sentry,alexm92/sentry,nicholasserra/sentry,BuildingLink/sentry,gencer/sentry,daevaorn/sentry,beeftornado/sentry,JamesMura/sentry,mvaled/sentry,jean/sentry,JamesMura/sentry,fotinakis/sentry,mvaled/sentry,JamesMura/sentry,beeftornado/sentry,looker/sentry,fot...
<REPLACE_OLD> args, kwargs): <REPLACE_NEW> *args, **kwargs): <REPLACE_END> <REPLACE_OLD> args, kwargs) app.Task <REPLACE_NEW> *args, **kwargs) app.Task <REPLACE_END> <|endoftext|> from __future__ import absolute_import import celery import os import os.path import sys # Add the project to the python path sys.path...
Use star args to invoke apply_async from __future__ import absolute_import import celery import os import os.path import sys # Add the project to the python path sys.path.insert(0, os.path.join(os.path.dirname(__file__), os.pardir)) # Configure the application only if it seemingly isnt already configured from djang...
9cf6e843eeb865eeaf90e4023bdccd1325e74535
test_rle.py
test_rle.py
import pypolycomp import numpy as np def test_compression(): for cur_type in (np.int8, np.int16, np.int32, np.int64, np.uint8, np.uint16, np.uint32, np.uint64): compressed = pypolycomp.rle_compress(np.array([1, 1, 1, 2, 3], dtype=cur_type)) assert np.all(compressed == np.array(...
import pypolycomp import numpy as np def test_compression(): for cur_type in (np.int8, np.int16, np.int32, np.int64, np.uint8, np.uint16, np.uint32, np.uint64): compressed = pypolycomp.rle_compress(np.array([1, 1, 1, 2, 3], dtype=cur_type)) assert np.all(compressed == np.array(...
Add test for RLE decompression
Add test for RLE decompression
Python
bsd-3-clause
ziotom78/polycomp
<REPLACE_OLD> dtype=cur_type)) <REPLACE_NEW> dtype=cur_type)) def test_decompression(): for cur_type in (np.int8, np.int16, np.int32, np.int64, np.uint8, np.uint16, np.uint32, np.uint64): input_values = np.array(np.random.randint(100, size=1000), dtype...
Add test for RLE decompression import pypolycomp import numpy as np def test_compression(): for cur_type in (np.int8, np.int16, np.int32, np.int64, np.uint8, np.uint16, np.uint32, np.uint64): compressed = pypolycomp.rle_compress(np.array([1, 1, 1, 2, 3], dtype=cur_type)) asser...
8528f21397672b5719fcf4edecd8efa3a1eec60a
cellardoor/serializers/json_serializer.py
cellardoor/serializers/json_serializer.py
import re import json from datetime import datetime from . import Serializer class CellarDoorJSONEncoder(json.JSONEncoder): def default(self, obj): try: iterable = iter(obj) except TypeError: pass else: return list(iterable) if isinstance(obj, datetime): return obj.isoformat() return s...
import re import json from datetime import datetime import collections from . import Serializer class CellarDoorJSONEncoder(json.JSONEncoder): def default(self, obj): if isinstance(obj, collections.Iterable): return list(obj) if isinstance(obj, datetime): return obj.isoformat() return super(Cell...
Use more reliable method of detecting iterables
Use more reliable method of detecting iterables
Python
mit
cooper-software/cellardoor
<REPLACE_OLD> datetime from <REPLACE_NEW> datetime import collections from <REPLACE_END> <REPLACE_OLD> obj): try: iterable = iter(obj) except TypeError: pass else: return list(iterable) if <REPLACE_NEW> obj): if isinstance(obj, collections.Iterable): return list(obj) if <REPLACE_END> <|e...
Use more reliable method of detecting iterables import re import json from datetime import datetime from . import Serializer class CellarDoorJSONEncoder(json.JSONEncoder): def default(self, obj): try: iterable = iter(obj) except TypeError: pass else: return list(iterable) if isinstance(obj, d...
52f8e68835eb67e522dd8f1c7725d460eaa2cab7
RPS/rps-1.py
RPS/rps-1.py
# A simple rock, paper, scissors script submitted as a demo of easy game-making # In Python # Certain parts of this program are functional—that is, written in functions that # work together. Some parts aren't. As we improve the program, you'll find that # This functional way of doing things has some real advantages. i...
""" A simple rock, paper, scissors script submitted as a demo of easy game-making In Python. """ import random # We need thr random module for the computer to play # This dictionary relates a choice to what it defeats for easy comparison later. beats = { "rock":"scissors", "paper":"rock", "scissors":"paper...
Refactor out functions from rps1
Refactor out functions from rps1
Python
mit
mttaggart/python-cs
<REPLACE_OLD> # A <REPLACE_NEW> """ A <REPLACE_END> <REPLACE_OLD> game-making # In Python # Certain parts of this program are functional—that is, written in functions that # work together. Some parts aren't. As we improve the program, you'll find that # This functional way of doing things has some real advantages. imp...
Refactor out functions from rps1 # A simple rock, paper, scissors script submitted as a demo of easy game-making # In Python # Certain parts of this program are functional—that is, written in functions that # work together. Some parts aren't. As we improve the program, you'll find that # This functional way of doing t...
012235fd93e77de19065a0e906554887e27580fd
kitsune/sumo/models.py
kitsune/sumo/models.py
from django.conf import settings from django.db import models class ModelBase(models.Model): """Base class for SUMO models. * Adds objects_range class method. * Adds update method. """ class Meta: abstract = True @classmethod def objects_range(cls, before=None, after=None): ...
from django.conf import settings from django.db import models class ModelBase(models.Model): """Base class for SUMO models. * Adds objects_range class method. * Adds update method. """ class Meta: abstract = True @classmethod def objects_range(cls, before=None, after=None): ...
Use Django's default update method
Use Django's default update method
Python
bsd-3-clause
mozilla/kitsune,mozilla/kitsune,mozilla/kitsune,mozilla/kitsune
<REPLACE_OLD> queryset class <REPLACE_NEW> queryset def update(self, **kw): """Shortcicuit to the update method.""" self.__class__.objects.filter(pk=self.pk).update(**kw) class <REPLACE_END> <|endoftext|> from django.conf import settings from django.db import models class ModelBase(models.Mod...
Use Django's default update method from django.conf import settings from django.db import models class ModelBase(models.Model): """Base class for SUMO models. * Adds objects_range class method. * Adds update method. """ class Meta: abstract = True @classmethod def objects_range...
f46770697d668e31518ada41d31fdb59a84f3cf6
kokki/cookbooks/aws/recipes/default.py
kokki/cookbooks/aws/recipes/default.py
from kokki import * Package("python-boto") # Mount volumes and format is necessary for vol in env.config.aws.volumes: env.cookbooks.aws.EBSVolume(vol['volume_id'], availability_zone = env.config.aws.availability_zone, device = vol['device'], action = "attach") if vol.get('fstype'): ...
import os from kokki import * # Package("python-boto") Execute("pip install git+http://github.com/boto/boto.git#egg=boto", not_if = 'python -c "import boto"') Execute("mv /usr/lib/pymodules/python2.6/boto /tmp/boto.orig", only_if = os.path.exists("/usr/lib/pymodules/python2.6/boto")) # Mount volumes and form...
Install github verison of boto in aws cookbook (for now)
Install github verison of boto in aws cookbook (for now)
Python
bsd-3-clause
samuel/kokki
<REPLACE_OLD> from <REPLACE_NEW> import os from <REPLACE_END> <REPLACE_OLD> * Package("python-boto") # <REPLACE_NEW> * # Package("python-boto") Execute("pip install git+http://github.com/boto/boto.git#egg=boto", not_if = 'python -c "import boto"') Execute("mv /usr/lib/pymodules/python2.6/boto /tmp/boto.orig", ...
Install github verison of boto in aws cookbook (for now) from kokki import * Package("python-boto") # Mount volumes and format is necessary for vol in env.config.aws.volumes: env.cookbooks.aws.EBSVolume(vol['volume_id'], availability_zone = env.config.aws.availability_zone, device = vol['device...
cedbfda6e9c040c6924eae2eff0e9b4e9f3f93f0
api/core/helpers.py
api/core/helpers.py
import pprint from django.core.mail import EmailMessage import log from rest_framework.reverse import reverse from sesame.utils import get_query_string def send_login_email(user, request, *, welcome): assert user.email, f"User has no email: {user}" base = reverse('redirector', args=["login"], request=reque...
import pprint from django.core.mail import EmailMessage import log from rest_framework.reverse import reverse from sesame.utils import get_query_string def send_login_email(user, request, *, welcome): assert user.email, f"User has no email: {user}" base = reverse('redirector', args=["login"], request=reque...
Use Mandrill templates to send emails
Use Mandrill templates to send emails
Python
mit
citizenlabsgr/voter-engagement,citizenlabsgr/voter-engagement,citizenlabsgr/voter-engagement,citizenlabsgr/voter-engagement,citizenlabsgr/voter-engagement
<REPLACE_OLD> # TODO: Convert this to an email template if welcome: subject = "Welcome to Voter Engagement" else: subject = "Greetings from Voter Engagement" body = f"Click here to log in: {url}" email <REPLACE_NEW> message <REPLACE_END> <REPLACE_OLD> subject=subject, body=body, ...
Use Mandrill templates to send emails import pprint from django.core.mail import EmailMessage import log from rest_framework.reverse import reverse from sesame.utils import get_query_string def send_login_email(user, request, *, welcome): assert user.email, f"User has no email: {user}" base = reverse('red...
65838da6a7353ae084a13565ea2dd55368a27176
history/migrations/0007_auto_20141026_2348.py
history/migrations/0007_auto_20141026_2348.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('history', '0006_committeemember_member'), ] operations = [ migrations.AlterField( model_name='meetingminutes', ...
Update meeting minutes model (committees)
Update meeting minutes model (committees)
Python
apache-2.0
tbpmig/mig-website,tbpmig/mig-website,tbpmig/mig-website
<INSERT> # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): <INSERT_END> <INSERT> dependencies = [ ('history', '0006_committeemember_member'), ] operations = [ migrations.AlterField( ...
Update meeting minutes model (committees)
f3c4bac262c6d09730b3f0c4a24639fde8b4d923
gunicorn-app.py
gunicorn-app.py
from __future__ import unicode_literals import multiprocessing import gunicorn.app.base from gunicorn.six import iteritems def number_of_workers(): return (multiprocessing.cpu_count() * 2) + 1 def handler_app(environ, start_response): response_body = b'Works fine' status = '200 OK' response_head...
Add wsgi compatible example gunicorn application
Add wsgi compatible example gunicorn application
Python
mit
voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts
<REPLACE_OLD> <REPLACE_NEW> from __future__ import unicode_literals import multiprocessing import gunicorn.app.base from gunicorn.six import iteritems def number_of_workers(): return (multiprocessing.cpu_count() * 2) + 1 def handler_app(environ, start_response): response_body = b'Works fine' status ...
Add wsgi compatible example gunicorn application
222628c6747bdc3574bcb7cf6257c785ffa6451d
inventory_control/database/sql.py
inventory_control/database/sql.py
""" So this is where all the SQL commands live """ CREATE_SQL = """ CREATE TABLE component_type ( id INT PRIMARY KEY AUTO_INCREMENT, type VARCHAR(255) UNIQUE ); CREATE TABLE components ( id INT PRIMARY KEY AUTO_INCREMENT, sku TEXT, type INT, status INT, FOREIGN KEY (type) REFERENCES compo...
""" So this is where all the SQL commands live """ CREATE_SQL = """ CREATE TABLE component_type ( id INT PRIMARY KEY AUTO_INCREMENT, type VARCHAR(255) UNIQUE ); CREATE TABLE components ( id INT PRIMARY KEY AUTO_INCREMENT, serial_number VARCHAR(255), sku TEXT, type INT, status INT, FOR...
Add product_number and serial_number identifiers
Add product_number and serial_number identifiers
Python
mit
worldcomputerxchange/inventory-control,codeforsanjose/inventory-control
<INSERT> serial_number VARCHAR(255), <INSERT_END> <INSERT> product_number INT, <INSERT_END> <|endoftext|> """ So this is where all the SQL commands live """ CREATE_SQL = """ CREATE TABLE component_type ( id INT PRIMARY KEY AUTO_INCREMENT, type VARCHAR(255) UNIQUE ); CREATE TABLE components ( id I...
Add product_number and serial_number identifiers """ So this is where all the SQL commands live """ CREATE_SQL = """ CREATE TABLE component_type ( id INT PRIMARY KEY AUTO_INCREMENT, type VARCHAR(255) UNIQUE ); CREATE TABLE components ( id INT PRIMARY KEY AUTO_INCREMENT, sku TEXT, type INT, s...
7db27a3629e442c99abd24503f08d982b6a30e33
packages/Python/lldbsuite/test/lang/objc/modules-cache/TestClangModulesCache.py
packages/Python/lldbsuite/test/lang/objc/modules-cache/TestClangModulesCache.py
"""Test that the clang modules cache directory can be controlled.""" from __future__ import print_function import unittest2 import os import time import platform import shutil import lldb from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil class ObjCMo...
"""Test that the clang modules cache directory can be controlled.""" from __future__ import print_function import unittest2 import os import time import platform import shutil import lldb from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil class ObjCMo...
Mark ObjC testcase as skipUnlessDarwin and fix a typo in test function.
Mark ObjC testcase as skipUnlessDarwin and fix a typo in test function. git-svn-id: 4c4cc70b1ef44ba2b7963015e681894188cea27e@326640 91177308-0d34-0410-b5e6-96231b3b80d8 (cherry picked from commit cb9b1a2163f960e34721f74bad30622fda71e43b)
Python
apache-2.0
apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb
<INSERT> @skipUnlessDarwin <INSERT_END> <REPLACE_OLD> Darwin") <REPLACE_NEW> Foo") <REPLACE_END> <|endoftext|> """Test that the clang modules cache directory can be controlled.""" from __future__ import print_function import unittest2 import os import time import platform import shutil import lldb from lldbsu...
Mark ObjC testcase as skipUnlessDarwin and fix a typo in test function. git-svn-id: 4c4cc70b1ef44ba2b7963015e681894188cea27e@326640 91177308-0d34-0410-b5e6-96231b3b80d8 (cherry picked from commit cb9b1a2163f960e34721f74bad30622fda71e43b) """Test that the clang modules cache directory can be controlled.""" from __fut...
46afcd0e5e958e22647ef9c708918489027277e2
modeltranslation/tests/settings.py
modeltranslation/tests/settings.py
# -*- coding: utf-8 -*- """ Settings overrided for test time """ import os from django.conf import settings DIRNAME = os.path.dirname(__file__) INSTALLED_APPS = tuple(settings.INSTALLED_APPS) + ( 'modeltranslation.tests', ) # IMO this is unimportant #if django.VERSION[0] >= 1 and django.VERSION[1] >= 3: #INS...
# -*- coding: utf-8 -*- """ Settings overrided for test time """ import os from django.conf import settings DIRNAME = os.path.dirname(__file__) INSTALLED_APPS = tuple(settings.INSTALLED_APPS) + ( 'modeltranslation.tests', ) # IMO this is unimportant #if django.VERSION[0] >= 1 and django.VERSION[1] >= 3: #INS...
Disable timezone support for tests, as the date / time fields' tests use naive datatime objects and fail if it's enabled.
Disable timezone support for tests, as the date / time fields' tests use naive datatime objects and fail if it's enabled.
Python
bsd-3-clause
extertioner/django-modeltranslation,marctc/django-modeltranslation,yoza/django-modeltranslation,nanuxbe/django-modeltranslation,akheron/django-modeltranslation,vstoykov/django-modeltranslation,SideStudios/django-modeltranslation,yoza/django-modeltranslation,marctc/django-modeltranslation,deschler/django-modeltranslatio...
<REPLACE_OLD> True MODELTRANSLATION_AUTO_POPULATE <REPLACE_NEW> True USE_TZ = False MODELTRANSLATION_AUTO_POPULATE <REPLACE_END> <|endoftext|> # -*- coding: utf-8 -*- """ Settings overrided for test time """ import os from django.conf import settings DIRNAME = os.path.dirname(__file__) INSTALLED_APPS = tuple(setti...
Disable timezone support for tests, as the date / time fields' tests use naive datatime objects and fail if it's enabled. # -*- coding: utf-8 -*- """ Settings overrided for test time """ import os from django.conf import settings DIRNAME = os.path.dirname(__file__) INSTALLED_APPS = tuple(settings.INSTALLED_APPS) + ...
6a940fbd0cc8c4e4a9f17423c593452d010b6883
app/lib/query/__init__.py
app/lib/query/__init__.py
# -*- coding: utf-8 -*- """ Initialisation file for query directory. """
# -*- coding: utf-8 -*- """ Initialisation file for query directory, relating to local database queries. """
Update query init file docstring.
Update query init file docstring.
Python
mit
MichaelCurrin/twitterverse,MichaelCurrin/twitterverse
<REPLACE_OLD> directory. """ <REPLACE_NEW> directory, relating to local database queries. """ <REPLACE_END> <|endoftext|> # -*- coding: utf-8 -*- """ Initialisation file for query directory, relating to local database queries. """
Update query init file docstring. # -*- coding: utf-8 -*- """ Initialisation file for query directory. """
1c2b6c0daea1d04985ef6ddff35527ba207ec191
qual/tests/test_calendar.py
qual/tests/test_calendar.py
import unittest from datetime import date import qual class TestProlepticGregorianCalendar(unittest.TestCase): def setUp(self): self.calendar = qual.ProlepticGregorianCalendar() def check_valid_date(self, year, month, day): d = self.calendar.date(year, month, day) self.assertIsNotNon...
import unittest from datetime import date import qual class TestProlepticGregorianCalendar(unittest.TestCase): def setUp(self): self.calendar = qual.ProlepticGregorianCalendar() def check_valid_date(self, year, month, day): d = self.calendar.date(year, month, day) self.assertIsNotNon...
Check that a certain date is invalid.
Check that a certain date is invalid. This distinguishes correctly between the proleptic Gregorian calendar, and the historical or astronomical calendars, where this date would be valid.
Python
apache-2.0
jwg4/calexicon,jwg4/qual
<INSERT> check_invalid_date(self, year, month, day): self.assertRaises(Exception, lambda : self.calendar(year, month, day)) def <INSERT_END> <REPLACE_OLD> 29) <REPLACE_NEW> 29) def test_Julian_leap_day_is_not_a_valid_date(self): """This day /was/ a leap day contemporaneously, but i...
Check that a certain date is invalid. This distinguishes correctly between the proleptic Gregorian calendar, and the historical or astronomical calendars, where this date would be valid. import unittest from datetime import date import qual class TestProlepticGregorianCalendar(unittest.TestCase): def setUp(sel...
5cd459485fee2611eb96229b0a600b3a21f4fc13
stagecraft/apps/datasets/admin/backdrop_user.py
stagecraft/apps/datasets/admin/backdrop_user.py
from __future__ import unicode_literals from django.contrib import admin from django.db import models import reversion from stagecraft.apps.datasets.models.backdrop_user import BackdropUser from stagecraft.apps.datasets.models.data_set import DataSet class DataSetInline(admin.StackedInline): model = DataSet f...
from __future__ import unicode_literals from django.contrib import admin from django.db import models import reversion from stagecraft.apps.datasets.models.backdrop_user import BackdropUser from stagecraft.apps.datasets.models.data_set import DataSet class DataSetInline(admin.StackedInline): model = DataSet f...
Fix typo in BackdropUser admin model
Fix typo in BackdropUser admin model
Python
mit
alphagov/stagecraft,alphagov/stagecraft,alphagov/stagecraft,alphagov/stagecraft
<REPLACE_OLD> 'numer_of_datasets_user_has_access_to',) <REPLACE_NEW> 'number_of_datasets_user_has_access_to',) <REPLACE_END> <REPLACE_OLD> numer_of_datasets_user_has_access_to(self, <REPLACE_NEW> number_of_datasets_user_has_access_to(self, <REPLACE_END> <REPLACE_OLD> numer_of_datasets_user_has_access_to.admin_order_f...
Fix typo in BackdropUser admin model from __future__ import unicode_literals from django.contrib import admin from django.db import models import reversion from stagecraft.apps.datasets.models.backdrop_user import BackdropUser from stagecraft.apps.datasets.models.data_set import DataSet class DataSetInline(admin.Sta...
97529500f335ee1f75a6229c1c313bc7ff2d68ef
satchmo/apps/satchmo_store/shop/management/commands/satchmo_copy_static.py
satchmo/apps/satchmo_store/shop/management/commands/satchmo_copy_static.py
from django.core.management.base import NoArgsCommand import os import shutil class Command(NoArgsCommand): help = "Copy the satchmo static directory and files to the local project." def handle_noargs(self, **options): import satchmo_store static_src = os.path.join(satchmo_store.__path__[0],'s...
from django.core.management.base import NoArgsCommand import os import shutil class Command(NoArgsCommand): help = "Copy the satchmo static directory and files to the local project." def handle_noargs(self, **options): import satchmo_store static_src = os.path.join(satchmo_store.__path__[0],'....
Change the static copy command so it works with new layout.
Change the static copy command so it works with new layout. --HG-- extra : convert_revision : svn%3Aa38d40e9-c014-0410-b785-c606c0c8e7de/satchmo/trunk%401887
Python
bsd-3-clause
dokterbob/satchmo,Ryati/satchmo,twidi/satchmo,ringemup/satchmo,ringemup/satchmo,Ryati/satchmo,twidi/satchmo,dokterbob/satchmo
<REPLACE_OLD> os.path.join(satchmo_store.__path__[0],'static') <REPLACE_NEW> os.path.join(satchmo_store.__path__[0],'../../static') <REPLACE_END> <|endoftext|> from django.core.management.base import NoArgsCommand import os import shutil class Command(NoArgsCommand): help = "Copy the satchmo static directory and...
Change the static copy command so it works with new layout. --HG-- extra : convert_revision : svn%3Aa38d40e9-c014-0410-b785-c606c0c8e7de/satchmo/trunk%401887 from django.core.management.base import NoArgsCommand import os import shutil class Command(NoArgsCommand): help = "Copy the satchmo static directory and f...
7f7e606cc15e24190880d7388d07623be783a384
src/address_extractor/__init__.py
src/address_extractor/__init__.py
from .__main__ import main __version__ = '1.0.0' __title__ = 'address_extractor' __description__ = '' __url__ = '' __author__ = 'Scott Colby' __email__ = '' __license__ = 'MIT License' __copyright__ = 'Copyright (c) 2015 Scott Colby' __all__ = [ 'address_extractor' ]
from .__main__ import main from .__main__ import parsed_address_to_human __version__ = '1.0.0' __title__ = 'address_extractor' __description__ = '' __url__ = '' __author__ = 'Scott Colby' __email__ = '' __license__ = 'MIT License' __copyright__ = 'Copyright (c) 2015 Scott Colby' __all__ = [ 'main', 'parsed...
Change importing structure in init
Change importing structure in init
Python
mit
scolby33/address_extractor
<REPLACE_OLD> main __version__ <REPLACE_NEW> main from .__main__ import parsed_address_to_human __version__ <REPLACE_END> <REPLACE_OLD> 'address_extractor' ] <REPLACE_NEW> 'main', 'parsed_address_to_human' ] <REPLACE_END> <|endoftext|> from .__main__ import main from .__main__ import parsed_address_to_human __...
Change importing structure in init from .__main__ import main __version__ = '1.0.0' __title__ = 'address_extractor' __description__ = '' __url__ = '' __author__ = 'Scott Colby' __email__ = '' __license__ = 'MIT License' __copyright__ = 'Copyright (c) 2015 Scott Colby' __all__ = [ 'address_extractor' ]
e4f7deee8c4154781c2e945bfc14cf2028586dc1
hellopython/print_method/__init__.py
hellopython/print_method/__init__.py
import codecs import io import sys from workshopper.problems import BaseProblem class Problem(BaseProblem): def test(self, file): old_stdout = sys.stdout sys.stdout = io.StringIO() eval(codecs.open(file).read()) message = sys.stdout.getvalue() sys.stdout = old_stdout ...
import codecs import io import sys from workshopper.problems import BaseProblem class Problem(BaseProblem): title = 'Print method' def test(self, file): old_stdout = sys.stdout sys.stdout = io.StringIO() eval(codecs.open(file).read()) message = sys.stdout.getvalue() s...
Add a title to the print_method problem
Add a title to the print_method problem
Python
mit
pyschool/hipyschool
<REPLACE_OLD> Problem(BaseProblem): <REPLACE_NEW> Problem(BaseProblem): title = 'Print method' <REPLACE_END> <|endoftext|> import codecs import io import sys from workshopper.problems import BaseProblem class Problem(BaseProblem): title = 'Print method' def test(self, file): old_stdout = sys...
Add a title to the print_method problem import codecs import io import sys from workshopper.problems import BaseProblem class Problem(BaseProblem): def test(self, file): old_stdout = sys.stdout sys.stdout = io.StringIO() eval(codecs.open(file).read()) message = sys.stdout.getval...
8ff8b9400adf24e082908befed7788099b01f328
bench/pact-suite/scripts/opcount_merge.py
bench/pact-suite/scripts/opcount_merge.py
#!/usr/bin/env python2.7 import sys files = sys.argv[1:] keys = set() fileVals = [] for file in files: vals = {} fileVals.append(vals) try: for line in open(file).readlines(): k, v = line.split() vals[k] = v keys.add(k) except Exception, e: print "Error in line \"%s\" of file %s" % (...
#!/usr/bin/env python2.7 import sys files = sys.argv[1:] keys = set() fileVals = [] for file in files: vals = {} fileVals.append(vals) try: for line in open(file).readlines(): toks = line.split() if len(toks) != 2: print >> sys.stderr, "Bad line: %s" % repr(toks) else: k, v...
Add initial data for operations counts
Add initial data for operations counts git-svn-id: 0c5512015aa96f7d3f5c3ad598bd98edc52008b1@12204 dc4e9af1-7f46-4ead-bba6-71afc04862de
Python
apache-2.0
basheersubei/swift-t,blue42u/swift-t,swift-lang/swift-t,JohnPJenkins/swift-t,swift-lang/swift-t,blue42u/swift-t,swift-lang/swift-t,swift-lang/swift-t,JohnPJenkins/swift-t,basheersubei/swift-t,JohnPJenkins/swift-t,JohnPJenkins/swift-t,JohnPJenkins/swift-t,basheersubei/swift-t,basheersubei/swift-t,basheersubei/swift-t,Jo...
<INSERT> toks = line.split() if len(toks) != 2: print >> sys.stderr, "Bad line: %s" % repr(toks) else: <INSERT_END> <REPLACE_OLD> line.split() <REPLACE_NEW> toks <REPLACE_END> <INSERT> <INSERT_END> <INSERT> >> sys.stderr, <INSERT_END> <|endoftext|> #!/usr/bin/env python2.7 import sys ...
Add initial data for operations counts git-svn-id: 0c5512015aa96f7d3f5c3ad598bd98edc52008b1@12204 dc4e9af1-7f46-4ead-bba6-71afc04862de #!/usr/bin/env python2.7 import sys files = sys.argv[1:] keys = set() fileVals = [] for file in files: vals = {} fileVals.append(vals) try: for line in open(file).readline...
4d51fad87581281cd98d97a091346018d9784411
word2vec_api.py
word2vec_api.py
from flask import Flask, request from flask.ext.restful import reqparse, Api, Resource from gensim.models.word2vec import Word2Vec import json print 'loading model' MODEL = Word2Vec.load_word2vec_format( 'GoogleNews-vectors-negative300.bin.gz', binary=True) print 'model loaded' app = Flask(__name__) api = Api(app...
from flask import Flask, request from flask.ext.restful import reqparse, Api, Resource from gensim.models.word2vec import Word2Vec import json print 'loading model' MODEL = Word2Vec.load('GoogleNews-vectors-negative300.gensim') print 'model loaded' app = Flask(__name__) api = Api(app) class HelloWorld(Resource): ...
Update to use gensim format
api: Update to use gensim format
Python
mit
mdbecker/word2vec_demo,mdbecker/word2vec_demo
<REPLACE_OLD> Word2Vec.load_word2vec_format( 'GoogleNews-vectors-negative300.bin.gz', binary=True) print <REPLACE_NEW> Word2Vec.load('GoogleNews-vectors-negative300.gensim') print <REPLACE_END> <INSERT> try: <INSERT_END> <INSERT> <INSERT_END> <INSERT> <INSERT_END> <INSERT> <INSERT_END> <INSE...
api: Update to use gensim format from flask import Flask, request from flask.ext.restful import reqparse, Api, Resource from gensim.models.word2vec import Word2Vec import json print 'loading model' MODEL = Word2Vec.load_word2vec_format( 'GoogleNews-vectors-negative300.bin.gz', binary=True) print 'model loaded' ap...
29a3e0ebf69531357d832d6014d15a3fe2f76682
setup.py
setup.py
from os.path import abspath, dirname, join from setuptools import find_packages, setup REQUIREMENTS = [ 'requests', 'six', 'websocket-client', ] HERE = dirname(abspath(__file__)) DESCRIPTION = '\n\n'.join(open(join(HERE, _), encoding="utf8").read() for _ in [ 'README.rst', 'CHANGES.rst', ]) setu...
import io from os.path import abspath, dirname, join from setuptools import find_packages, setup REQUIREMENTS = [ 'requests', 'six', 'websocket-client', ] HERE = dirname(abspath(__file__)) LOAD_TEXT = lambda name: io.open(join(HERE, name), encoding='UTF-8').read() DESCRIPTION = '\n\n'.join(LOAD_TEXT(_) ...
Support Python 2.6 & 2.7
Support Python 2.6 & 2.7
Python
mit
connor4312/socketIO-client,invisibleroads/socketIO-client,invisibleroads/socketIO-client,danielquinn/socketIO-client,feus4177/socketIO-client-2,connor4312/socketIO-client,feus4177/socketIO-client-2,invisibleroads/socketIO-client,danielquinn/socketIO-client,feus4177/socketIO-client-2,danielquinn/socketIO-client,connor43...
<REPLACE_OLD> from <REPLACE_NEW> import io from <REPLACE_END> <REPLACE_OLD> dirname(abspath(__file__)) DESCRIPTION <REPLACE_NEW> dirname(abspath(__file__)) LOAD_TEXT <REPLACE_END> <REPLACE_OLD> '\n\n'.join(open(join(HERE, _), encoding="utf8").read() <REPLACE_NEW> lambda name: io.open(join(HERE, name), encoding='UTF-8')...
Support Python 2.6 & 2.7 from os.path import abspath, dirname, join from setuptools import find_packages, setup REQUIREMENTS = [ 'requests', 'six', 'websocket-client', ] HERE = dirname(abspath(__file__)) DESCRIPTION = '\n\n'.join(open(join(HERE, _), encoding="utf8").read() for _ in [ 'README.rst', ...
a973f489d265c0f4f5baa3357eaf5a772a825821
tweetstream.py
tweetstream.py
# -*- coding: utf-8 -*- import os from tweepy import Stream from tweepy import OAuthHandler from tweepy import API from tweepy.streaming import StreamListener from listener import Listener ckey = os.environ['CKEY'] consumer_secret = os.environ['CONSUMER_KEY'] access_token_key = os.environ['ACCESS_TOKEN_KEY'] access_to...
# -*- coding: utf-8 -*- import os from tweepy import Stream from tweepy import OAuthHandler from tweepy import API from tweepy.streaming import StreamListener from listener import Listener ckey = os.environ['CKEY'] consumer_secret = os.environ['CONSUMER_SECRET'] access_token_key = os.environ['ACCESS_TOKEN_KEY'] access...
Use the correct env variable name
Use the correct env variable name
Python
mit
robot-overlord/syriarightnow
<REPLACE_OLD> os.environ['CONSUMER_KEY'] access_token_key <REPLACE_NEW> os.environ['CONSUMER_SECRET'] access_token_key <REPLACE_END> <|endoftext|> # -*- coding: utf-8 -*- import os from tweepy import Stream from tweepy import OAuthHandler from tweepy import API from tweepy.streaming import StreamListener from listener ...
Use the correct env variable name # -*- coding: utf-8 -*- import os from tweepy import Stream from tweepy import OAuthHandler from tweepy import API from tweepy.streaming import StreamListener from listener import Listener ckey = os.environ['CKEY'] consumer_secret = os.environ['CONSUMER_KEY'] access_token_key = os.en...
96439cb26a09158f112541025a6c2901b983eae9
tests/test_pay_onetime.py
tests/test_pay_onetime.py
# -*- coding: utf-8 -*- def test_pay_onetime(iamport): # Without 'card_number' payload_notEnough = { 'merchant_uid': 'qwer1234', 'amount': 5000, 'expiry': '2019-03', 'birth': '500203', 'pwd_2digit': '19' } try: iamport.pay_onetime(**payload_notEnough) ...
# -*- coding: utf-8 -*- import string, random def test_pay_onetime(iamport): merchant_uid = ''.join( random.choice(string.ascii_uppercase + string.digits) for _ in range(10) ) # Without 'card_number' payload_not_enough = { 'merchant_uid': merchant_uid, 'amount': 5000,...
Add random merchant_uid for continous testing
Add random merchant_uid for continous testing
Python
mit
iamport/iamport-rest-client-python
<REPLACE_OLD> -*- def <REPLACE_NEW> -*- import string, random def <REPLACE_END> <INSERT> merchant_uid = ''.join( random.choice(string.ascii_uppercase + string.digits) for _ in range(10) ) <INSERT_END> <REPLACE_OLD> payload_notEnough <REPLACE_NEW> payload_not_enough <REPLACE_END> <REPLACE_O...
Add random merchant_uid for continous testing # -*- coding: utf-8 -*- def test_pay_onetime(iamport): # Without 'card_number' payload_notEnough = { 'merchant_uid': 'qwer1234', 'amount': 5000, 'expiry': '2019-03', 'birth': '500203', 'pwd_2digit': '19' } try: ...
c0f06b64c15d74be26be2cd9e6d593e5c5cae2a9
tools/xml_select_minmax.py
tools/xml_select_minmax.py
#! /usr/bin/python3 import sys import argparse import xml_utils as u import os from argparse import RawTextHelpFormatter ##---------------------------------------------------------- ## for each label that has more than the mininum count, select the ## largest subset less than the maxinum count. ## writes out to...
Select a subset for each label. If the label image count is greater than min, return the greatest number of images less than or equal to the max. The images will be evenly distributed across years, seasons and days.
Select a subset for each label. If the label image count is greater than min, return the greatest number of images less than or equal to the max. The images will be evenly distributed across years, seasons and days.
Python
mit
hypraptive/bearid,hypraptive/bearid,hypraptive/bearid
<INSERT> #! /usr/bin/python3 import sys import argparse import xml_utils as u import os from argparse import RawTextHelpFormatter ##---------------------------------------------------------- ## <INSERT_END> <INSERT> for each label that has more than the mininum count, select the ## largest subset less than the maxi...
Select a subset for each label. If the label image count is greater than min, return the greatest number of images less than or equal to the max. The images will be evenly distributed across years, seasons and days.
99909048bc702e21e980bb1167caf9217aa31196
steel/fields/strings.py
steel/fields/strings.py
import codecs from steel.fields import Field from steel.fields.mixin import Fixed __all__ = ['Bytes', 'String', 'FixedBytes', 'FixedString'] class Bytes(Field): "A stream of bytes that should be left unconverted" def encode(self, value): # Nothing to do here return value d...
import codecs from steel.fields import Field from steel.fields.mixin import Fixed __all__ = ['Bytes', 'String', 'FixedBytes', 'FixedString'] class Bytes(Field): "A stream of bytes that should be left unconverted" def encode(self, value): # Nothing to do here return value d...
Fix the docstring for FixedString
Fix the docstring for FixedString
Python
bsd-3-clause
gulopine/steel-experiment
<REPLACE_OLD> stream of bytes <REPLACE_NEW> string <REPLACE_END> <|endoftext|> import codecs from steel.fields import Field from steel.fields.mixin import Fixed __all__ = ['Bytes', 'String', 'FixedBytes', 'FixedString'] class Bytes(Field): "A stream of bytes that should be left unconverted" def en...
Fix the docstring for FixedString import codecs from steel.fields import Field from steel.fields.mixin import Fixed __all__ = ['Bytes', 'String', 'FixedBytes', 'FixedString'] class Bytes(Field): "A stream of bytes that should be left unconverted" def encode(self, value): # Nothing to do ...
5782fc5cb505ff6af8d20411004a05ad53e82b90
fabfile/testbeds/testbed_mlab.py
fabfile/testbeds/testbed_mlab.py
from fabric.api import env #Management ip addresses of hosts in the cluster host1 = 'root@10.84.19.42' host2 = 'root@10.84.19.43' host3 = 'root@10.84.19.44' host4 = 'root@10.84.19.45' host5 = 'root@10.84.19.46' #External routers if any #for eg. #ext_routers = [('mx1', '10.204.216.253')] ext_routers = [] #Autonomous...
Add testbed file for mlab
Add testbed file for mlab
Python
apache-2.0
Juniper/contrail-fabric-utils,Juniper/contrail-fabric-utils
<INSERT> from fabric.api import env #Management ip addresses of hosts in the cluster host1 = 'root@10.84.19.42' host2 = 'root@10.84.19.43' host3 = 'root@10.84.19.44' host4 = 'root@10.84.19.45' host5 = 'root@10.84.19.46' #External routers if any #for eg. #ext_routers = [('mx1', '10.204.216.253')] ext_routers = [] #A...
Add testbed file for mlab
fb59f2e0bd01d75c90ea3cc0089c24fc5db86e8e
config/jupyter/jupyter_notebook_config.py
config/jupyter/jupyter_notebook_config.py
import sys sys.path.append('/root/.jupyter/extensions/') c.JupyterApp.ip = '*' c.JupyterApp.port = 80 c.JupyterApp.open_browser = False c.JupyterApp.allow_credentials = True c.JupyterApp.nbserver_extensions = ['jupyter_nbgallery.status', 'jupyter_nbgallery.post'] c.JupyterApp.reraise_server_extension_failures = True c...
import json import os import sys sys.path.append('/root/.jupyter/extensions/') c.JupyterApp.ip = '*' c.JupyterApp.port = 80 c.JupyterApp.open_browser = False c.JupyterApp.allow_credentials = True c.JupyterApp.nbserver_extensions = ['jupyter_nbgallery.status', 'jupyter_nbgallery.post'] c.JupyterApp.reraise_server_exten...
Set $NBGALLERY_URL to override gallery location
Set $NBGALLERY_URL to override gallery location
Python
mit
jupyter-gallery/jupyter-docker,jupyter-gallery/jupyter-docker,jupyter-gallery/jupyter-docker
<INSERT> json import os import <INSERT_END> <REPLACE_OLD> True <REPLACE_NEW> True # Override gallery location nbgallery_url = os.getenv('NBGALLERY_URL') if nbgallery_url: print('Setting nbgallery url to %s' % nbgallery_url) c.JupyterApp.allow_origin = nbgallery_url config = json.loads(open('/root/.jupyter/nbcon...
Set $NBGALLERY_URL to override gallery location import sys sys.path.append('/root/.jupyter/extensions/') c.JupyterApp.ip = '*' c.JupyterApp.port = 80 c.JupyterApp.open_browser = False c.JupyterApp.allow_credentials = True c.JupyterApp.nbserver_extensions = ['jupyter_nbgallery.status', 'jupyter_nbgallery.post'] c.Jupy...
b1c02240b8c2b291d43c70100c517a6038a91de4
tests/dags/test_external_task_sensor_fn_multiple_execution_dates_dags.py
tests/dags/test_external_task_sensor_fn_multiple_execution_dates_dags.py
from airflow import DAG from airflow.operators.bash_operator import BashOperator from airflow.operators.dummy_operator import DummyOperator from airflow.operators.sensors import ExternalTaskSensor from tests.operators.sensors import TEST_DAG_ID, DEFAULT_DATE from datetime import datetime, timedelta args = {'owner': 'a...
Add ability for ExternalTaskSensor to wait on multiple runs of a task
Add ability for ExternalTaskSensor to wait on multiple runs of a task Currently using the execution_date_fn parameter of the ExternalTaskSensor sensors only allows to wait for the completion of one given run of the task the ExternalTaskSensor is sensing. However, this prevents users to have setups where dags don't ha...
Python
apache-2.0
yati-sagade/incubator-airflow,yati-sagade/incubator-airflow,yati-sagade/incubator-airflow,yati-sagade/incubator-airflow
<REPLACE_OLD> <REPLACE_NEW> from airflow import DAG from airflow.operators.bash_operator import BashOperator from airflow.operators.dummy_operator import DummyOperator from airflow.operators.sensors import ExternalTaskSensor from tests.operators.sensors import TEST_DAG_ID, DEFAULT_DATE from datetime import datetime, t...
Add ability for ExternalTaskSensor to wait on multiple runs of a task Currently using the execution_date_fn parameter of the ExternalTaskSensor sensors only allows to wait for the completion of one given run of the task the ExternalTaskSensor is sensing. However, this prevents users to have setups where dags don't ha...
2a2b11f78ee64cd54cdfb8d105606215c42dcaa5
bot.py
bot.py
import tweepy from secrets import * # standard for accessing Twitter API auth = tweepy.OAuthHandler(C_KEY, C_SECRET) auth.set_access_token(A_TOKEN, A_TOKEN_SECRET) api = tweepy.API(auth)
Update 0.0.1 - Added imports - Added standards for accessing Twitter API
Update 0.0.1 - Added imports - Added standards for accessing Twitter API
Python
mit
FXelix/space_facts_bot
<REPLACE_OLD> <REPLACE_NEW> import tweepy from secrets import * # standard for accessing Twitter API auth = tweepy.OAuthHandler(C_KEY, C_SECRET) auth.set_access_token(A_TOKEN, A_TOKEN_SECRET) api = tweepy.API(auth) <REPLACE_END> <|endoftext|> import tweepy from secrets import * # standard for accessing Twitter A...
Update 0.0.1 - Added imports - Added standards for accessing Twitter API
bcd7f8f3d7313538ab1c04da9c42e774350ccdfe
ui/widgets/histogram/TrackingHistogramWidget.py
ui/widgets/histogram/TrackingHistogramWidget.py
""" TrackingHistogramWidget :Authors: Berend Klein Haneveld """ from PySide.QtGui import * from PySide.QtCore import * from HistogramWidget import HistogramWidget from TrackingNodeItem import TrackingNodeItem class TrackingHistogramWidget(HistogramWidget): """ TrackingHistogramWidget """ updatePosition = Signal...
""" TrackingHistogramWidget :Authors: Berend Klein Haneveld """ from PySide.QtGui import * from PySide.QtCore import * from HistogramWidget import HistogramWidget from TrackingNodeItem import TrackingNodeItem from ui.widgets import Style class TrackingHistogramWidget(HistogramWidget): """ TrackingHistogramWidget ...
Fix background color on OS X for histogram widget of ray.
Fix background color on OS X for histogram widget of ray.
Python
mit
berendkleinhaneveld/Registrationshop,berendkleinhaneveld/Registrationshop
<REPLACE_OLD> TrackingNodeItem class <REPLACE_NEW> TrackingNodeItem from ui.widgets import Style class <REPLACE_END> <REPLACE_OLD> None def <REPLACE_NEW> None Style.styleWidgetForTab(self) def <REPLACE_END> <|endoftext|> """ TrackingHistogramWidget :Authors: Berend Klein Haneveld """ from PySide.QtGui impor...
Fix background color on OS X for histogram widget of ray. """ TrackingHistogramWidget :Authors: Berend Klein Haneveld """ from PySide.QtGui import * from PySide.QtCore import * from HistogramWidget import HistogramWidget from TrackingNodeItem import TrackingNodeItem class TrackingHistogramWidget(HistogramWidget): ...
b590ddd735131faa3fd1bdc91b1866e1bd7b0738
us_ignite/snippets/management/commands/snippets_load_fixtures.py
us_ignite/snippets/management/commands/snippets_load_fixtures.py
from django.core.management.base import BaseCommand from us_ignite.snippets.models import Snippet FIXTURES = [ { 'slug': 'home-box', 'name': 'Up next:', 'body': '', 'url_text': 'Get involved', 'url': '', }, ] class Command(BaseCommand): def handle(self, *args, *...
from django.core.management.base import BaseCommand from us_ignite.snippets.models import Snippet FIXTURES = [ { 'slug': 'home-box', 'name': 'UP NEXT: LOREM IPSUM', 'body': '', 'url_text': 'GET INVOLVED', 'url': '', }, { 'slug': 'featured', 'name': ...
Add featured homepage initial fixture.
Add featured homepage initial fixture.
Python
bsd-3-clause
us-ignite/us_ignite,us-ignite/us_ignite,us-ignite/us_ignite,us-ignite/us_ignite,us-ignite/us_ignite
<REPLACE_OLD> 'Up next:', <REPLACE_NEW> 'UP NEXT: LOREM IPSUM', <REPLACE_END> <REPLACE_OLD> 'Get involved', <REPLACE_NEW> 'GET INVOLVED', 'url': '', }, { 'slug': 'featured', 'name': 'FEATURED CONTENT', 'body': '', 'url_text': 'FEATURED', <REPLACE_END> <|endoftext|> fr...
Add featured homepage initial fixture. from django.core.management.base import BaseCommand from us_ignite.snippets.models import Snippet FIXTURES = [ { 'slug': 'home-box', 'name': 'Up next:', 'body': '', 'url_text': 'Get involved', 'url': '', }, ] class Command(Base...
1856e8102b709176e46c3751bd21234dd5d1eacc
src/nodeconductor_assembly_waldur/packages/tests/unittests/test_admin.py
src/nodeconductor_assembly_waldur/packages/tests/unittests/test_admin.py
from django.test import TestCase from .. import factories from ... import admin, models class TestPackageComponentForm(TestCase): def test_package_component_form_is_valid_when_component_price_is_0(self): data = { 'monthly_price': '0', 'amount': '2', 'type': models.Pac...
Add unit tests for package component form
Add unit tests for package component form [WAL-450]
Python
mit
opennode/waldur-mastermind,opennode/waldur-mastermind,opennode/nodeconductor-assembly-waldur,opennode/waldur-mastermind,opennode/waldur-mastermind,opennode/nodeconductor-assembly-waldur,opennode/nodeconductor-assembly-waldur
<REPLACE_OLD> <REPLACE_NEW> from django.test import TestCase from .. import factories from ... import admin, models class TestPackageComponentForm(TestCase): def test_package_component_form_is_valid_when_component_price_is_0(self): data = { 'monthly_price': '0', 'amount': '2', ...
Add unit tests for package component form [WAL-450]
3e1408affa823af2ed95decf52b002614d060a26
pombola/core/tests/test_templatetags.py
pombola/core/tests/test_templatetags.py
from django.test import TestCase from ..templatetags.breadcrumbs import breadcrumbs class BreadcrumbTest(TestCase): def test_breadcrumbs(self): """Check that the breadcrumbs are generated as expected""" home_li = '<li><a href="/" title="Breadcrumb link to the homepage.">Home</a> <span class="...
from django.test import TestCase from ..templatetags.breadcrumbs import breadcrumbs from ..templatetags.active_class import active_class class BreadcrumbTest(TestCase): def test_breadcrumbs(self): """Check that the breadcrumbs are generated as expected""" home_li = '<li><a href="/" title="Bre...
Add tests for active_class templatetag
Add tests for active_class templatetag
Python
agpl-3.0
hzj123/56th,geoffkilpin/pombola,hzj123/56th,geoffkilpin/pombola,mysociety/pombola,hzj123/56th,mysociety/pombola,hzj123/56th,geoffkilpin/pombola,hzj123/56th,patricmutwiri/pombola,patricmutwiri/pombola,mysociety/pombola,geoffkilpin/pombola,patricmutwiri/pombola,ken-muturi/pombola,ken-muturi/pombola,mysociety/pombola,ken-...
<REPLACE_OLD> breadcrumbs class <REPLACE_NEW> breadcrumbs from ..templatetags.active_class import active_class class <REPLACE_END> <REPLACE_OLD> expected) <REPLACE_NEW> expected) class ActiveClassTest(TestCase): def test_active(self): """Check that active is returned when the url matches the input""...
Add tests for active_class templatetag from django.test import TestCase from ..templatetags.breadcrumbs import breadcrumbs class BreadcrumbTest(TestCase): def test_breadcrumbs(self): """Check that the breadcrumbs are generated as expected""" home_li = '<li><a href="/" title="Breadcrumb link t...
822cb468c033c81d8107d865715d024177b38fcd
CodeFights/doodledPassword.py
CodeFights/doodledPassword.py
#!/usr/local/bin/python # Code Fights Alphabetic Shift Problem from collections import deque def doodledPassword(digits): n = len(digits) res = [deque(digits) for _ in range(n)] deque(map(lambda i_x: i_x[1].rotate(-i_x[0]), enumerate(res)), 0) return [list(d) for d in res] def main(): tests = [...
Solve Code Fights doodled password problem
Solve Code Fights doodled password problem
Python
mit
HKuz/Test_Code
<REPLACE_OLD> <REPLACE_NEW> #!/usr/local/bin/python # Code Fights Alphabetic Shift Problem from collections import deque def doodledPassword(digits): n = len(digits) res = [deque(digits) for _ in range(n)] deque(map(lambda i_x: i_x[1].rotate(-i_x[0]), enumerate(res)), 0) return [list(d) for d in res...
Solve Code Fights doodled password problem
4a92328908f38ec7cc6077289217a802283db03b
examples/list_people.py
examples/list_people.py
#! /usr/bin/python # See README.txt for information and build instructions. import addressbook_pb2 import sys # Iterates though all people in the AddressBook and prints info about them. def ListPeople(address_book): for person in address_book.person: print "Person ID:", person.id print " Name:", person.na...
#! /usr/bin/python # See README.txt for information and build instructions. import addressbook_pb2 import sys # Iterates though all people in the AddressBook and prints info about them. def ListPeople(address_book): for person in address_book.person: print "Person ID:", person.id print " Name:", person.na...
Make Python example output identical to C++ and Java by removing redundant spaces.
Make Python example output identical to C++ and Java by removing redundant spaces.
Python
bsd-3-clause
LeslieW/protobuf,LeslieW/protobuf,LeslieW/protobuf,LeslieW/protobuf
<REPLACE_OLD> #: ", <REPLACE_NEW> #:", <REPLACE_END> <REPLACE_OLD> #: ", <REPLACE_NEW> #:", <REPLACE_END> <REPLACE_OLD> #: ", <REPLACE_NEW> #:", <REPLACE_END> <|endoftext|> #! /usr/bin/python # See README.txt for information and build instructions. import addressbook_pb2 import sys # Iterates though all people...
Make Python example output identical to C++ and Java by removing redundant spaces. #! /usr/bin/python # See README.txt for information and build instructions. import addressbook_pb2 import sys # Iterates though all people in the AddressBook and prints info about them. def ListPeople(address_book): for person in ...
e2959ec01b25c3f447fdd31608b30f19c2dc3599
engine.py
engine.py
# Use x, y coords for unit positions # (97, 56) ... (104, 56) # ... ... # (97, 49) ... (104, 49) # # Algebraic notation for a position is: # algebraic_pos = chr(x) + chr(y) def _coord_to_algebraic(coord): x, y = coord return chr(x) + chr(y) def _algebraic_to_coord(algebraic): x, y = algebrai...
# Use x, y coords for unit positions # (97, 56) ... (104, 56) # ... ... # (97, 49) ... (104, 49) # # Algebraic notation for a position is: # algebraic_pos = chr(x) + chr(y) def _coord_to_algebraic(coord): x, y = coord return chr(x) + chr(y) def _algebraic_to_coord(algebraic): x, y = algebrai...
Add _is_pos_on_board() to determine if a position is on the board
Add _is_pos_on_board() to determine if a position is on the board
Python
mit
EyuelAbebe/gamer,EyuelAbebe/gamer
<REPLACE_OLD> ord(y) <REPLACE_NEW> ord(y) def _is_pos_on_board(coord): u"""Return True if coordinate is on the board.""" x, y = coord if (97 <= x <= 104) and (49 <= y <= 56): return True else: return False <REPLACE_END> <|endoftext|> # Use x, y coords for unit positions # (97, 56) .....
Add _is_pos_on_board() to determine if a position is on the board # Use x, y coords for unit positions # (97, 56) ... (104, 56) # ... ... # (97, 49) ... (104, 49) # # Algebraic notation for a position is: # algebraic_pos = chr(x) + chr(y) def _coord_to_algebraic(coord): x, y = coord return chr(x)...
1b7509d8bd624bbf33352f622d8c03be6f3e35f2
src/sentry/api/serializers/models/organization_member.py
src/sentry/api/serializers/models/organization_member.py
from __future__ import absolute_import from sentry.api.serializers import Serializer, register from sentry.models import OrganizationMember @register(OrganizationMember) class OrganizationMemberSerializer(Serializer): def serialize(self, obj, attrs, user): d = { 'id': str(obj.id), ...
from __future__ import absolute_import from sentry.api.serializers import Serializer, register from sentry.models import OrganizationMember from sentry.utils.avatar import get_gravatar_url @register(OrganizationMember) class OrganizationMemberSerializer(Serializer): def serialize(self, obj, attrs, user): ...
Add avatarUrl to team member serializers
Add avatarUrl to team member serializers Conflicts: src/sentry/api/serializers/models/organization_member.py src/sentry/api/serializers/models/release.py cherry-pick 8ee1bee748ae7f51987ea8ec5ee10795b656cfd9
Python
bsd-3-clause
jean/sentry,gencer/sentry,looker/sentry,ngonzalvez/sentry,gg7/sentry,mvaled/sentry,nicholasserra/sentry,wong2/sentry,beeftornado/sentry,JamesMura/sentry,alexm92/sentry,JamesMura/sentry,korealerts1/sentry,wujuguang/sentry,BayanGroup/sentry,imankulov/sentry,fotinakis/sentry,JTCunning/sentry,kevinlondon/sentry,jean/sentry...
<REPLACE_OLD> OrganizationMember @register(OrganizationMember) class <REPLACE_NEW> OrganizationMember from sentry.utils.avatar import get_gravatar_url @register(OrganizationMember) class <REPLACE_END> <INSERT> 'avatarUrl': get_gravatar_url(obj.email, size=32), <INSERT_END> <|endoftext|> from __future__ ...
Add avatarUrl to team member serializers Conflicts: src/sentry/api/serializers/models/organization_member.py src/sentry/api/serializers/models/release.py cherry-pick 8ee1bee748ae7f51987ea8ec5ee10795b656cfd9 from __future__ import absolute_import from sentry.api.serializers import Serializer, register from sentry....
5547f8a11192e9182b6d9aceef99249fc7b9d2cb
froide/publicbody/migrations/0007_auto_20171224_0744.py
froide/publicbody/migrations/0007_auto_20171224_0744.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.6 on 2017-12-24 06:44 from __future__ import unicode_literals from django.db import migrations def create_classifications(apps, schema_editor): from ..models import Classification # Use treebeard API # Classification = apps.get_model('publicbody', 'Classifi...
# -*- coding: utf-8 -*- # Generated by Django 1.11.6 on 2017-12-24 06:44 from __future__ import unicode_literals from django.db import migrations def create_classifications(apps, schema_editor): from ..models import Classification as RealClassification # Use treebeard API Classification = apps.get_model('p...
Fix pb migration, by faking treebeard
Fix pb migration, by faking treebeard
Python
mit
fin/froide,fin/froide,fin/froide,stefanw/froide,stefanw/froide,stefanw/froide,stefanw/froide,fin/froide,stefanw/froide
<INSERT> as RealClassification <INSERT_END> <REPLACE_OLD> API # <REPLACE_NEW> API <REPLACE_END> <REPLACE_OLD> Classification.add_root( <REPLACE_NEW> Classification( <REPLACE_END> <REPLACE_OLD> slug=pb.classification_slug <REPLACE_NEW> slug=pb.classification_slug, depth=1, pat...
Fix pb migration, by faking treebeard # -*- coding: utf-8 -*- # Generated by Django 1.11.6 on 2017-12-24 06:44 from __future__ import unicode_literals from django.db import migrations def create_classifications(apps, schema_editor): from ..models import Classification # Use treebeard API # Classification = ...
4a125d2455e1c31043c66835c60cc0e55f9990e9
core/network.py
core/network.py
import codecs from string import Template import os import networkx as nx from networkx.readwrite import json_graph path = os.path.dirname(os.path.abspath(__file__)) def create_network(data): G = nx.DiGraph() for node in data: G.add_node( encode_utf8( node['creator'] ) ) if '___comments'...
import codecs from string import Template import os import networkx as nx from networkx.readwrite import json_graph path = os.path.dirname(os.path.abspath(__file__)) def create_network(data): G = nx.DiGraph() for node in data: G.add_node( encode_utf8( node['creator'] ) ) if '_comments' i...
Fix variable naming for comments
Fix variable naming for comments
Python
mit
HIIT/hybra-core,HIIT/hybra-core,HIIT/hybra-core,HIIT/hybra-core,HIIT/hybra-core
<REPLACE_OLD> '___comments' <REPLACE_NEW> '_comments' <REPLACE_END> <REPLACE_OLD> node['___comments']: <REPLACE_NEW> node['_comments']: <REPLACE_END> <|endoftext|> import codecs from string import Template import os import networkx as nx from networkx.readwrite import json_graph path = os.path.dirname(os.path.abs...
Fix variable naming for comments import codecs from string import Template import os import networkx as nx from networkx.readwrite import json_graph path = os.path.dirname(os.path.abspath(__file__)) def create_network(data): G = nx.DiGraph() for node in data: G.add_node( encode_utf8( node['creat...
ee28fdc66fbb0f91821ff18ff219791bf5de8f4d
corehq/apps/fixtures/tasks.py
corehq/apps/fixtures/tasks.py
from __future__ import absolute_import from __future__ import unicode_literals from corehq.apps.fixtures.upload import upload_fixture_file from soil import DownloadBase from celery.task import task @task(serializer='pickle') def fixture_upload_async(domain, download_id, replace): task = fixture_upload_async D...
from __future__ import absolute_import, unicode_literals from celery.task import task from soil import DownloadBase from corehq.apps.fixtures.upload import upload_fixture_file @task def fixture_upload_async(domain, download_id, replace): task = fixture_upload_async DownloadBase.set_progress(task, 0, 100) ...
Change fixture upload task to json serializer
Change fixture upload task to json serializer
Python
bsd-3-clause
dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq
<REPLACE_OLD> absolute_import from __future__ <REPLACE_NEW> absolute_import, unicode_literals from celery.task <REPLACE_END> <REPLACE_OLD> unicode_literals from <REPLACE_NEW> task from soil import DownloadBase from <REPLACE_END> <REPLACE_OLD> upload_fixture_file from soil import DownloadBase from celery.task import ...
Change fixture upload task to json serializer from __future__ import absolute_import from __future__ import unicode_literals from corehq.apps.fixtures.upload import upload_fixture_file from soil import DownloadBase from celery.task import task @task(serializer='pickle') def fixture_upload_async(domain, download_id, ...
859bc842da554e7e85b3684ade024ee533142d0b
modules/__init__.py
modules/__init__.py
import botconfig from settings import wolfgame as var # Todo: Allow game modes to be set via config # Carry over settings from botconfig into settings/wolfgame.py for setting, value in botconfig.__dict__.items(): if not setting.isupper(): continue # Not a setting if not setting in var.__dict__.keys()...
Add ability to carry settings from botconfig to var.
Add ability to carry settings from botconfig to var.
Python
bsd-2-clause
Cr0wb4r/lykos,billion57/lykos,Diitto/lykos,Agent-Isai/lykos
<INSERT> import botconfig from settings import wolfgame as var # Todo: Allow game modes to be set via config # Carry over settings from botconfig into settings/wolfgame.py for setting, value in botconfig.__dict__.items(): <INSERT_END> <INSERT> if not setting.isupper(): continue # Not a setting if not ...
Add ability to carry settings from botconfig to var.
92c01be43b80247ce2233851dd74b041bb9d44b0
csunplugged/resources/views/BarcodeChecksumPosterResourceGenerator.py
csunplugged/resources/views/BarcodeChecksumPosterResourceGenerator.py
"""Class for Barcode Checksum Poster resource generator.""" from PIL import Image from utils.BaseResourceGenerator import BaseResourceGenerator class BarcodeChecksumPosterResourceGenerator(BaseResourceGenerator): """Class for Grid resource generator.""" additional_valid_options = { "barcode_length":...
"""Class for Barcode Checksum Poster resource generator.""" from PIL import Image, ImageDraw from utils.BaseResourceGenerator import BaseResourceGenerator from utils.TextBoxDrawer import TextBoxDrawer from django.utils.translation import ugettext as _ class BarcodeChecksumPosterResourceGenerator(BaseResourceGenerato...
Modify Barcode Checksum Poster resource to dynamically overlay text
Modify Barcode Checksum Poster resource to dynamically overlay text
Python
mit
uccser/cs-unplugged,uccser/cs-unplugged,uccser/cs-unplugged,uccser/cs-unplugged
<REPLACE_OLD> Image from <REPLACE_NEW> Image, ImageDraw from <REPLACE_END> <REPLACE_OLD> BaseResourceGenerator class <REPLACE_NEW> BaseResourceGenerator from utils.TextBoxDrawer import TextBoxDrawer from django.utils.translation import ugettext as _ class <REPLACE_END> <INSERT> path = "static/img/resources/barcode-...
Modify Barcode Checksum Poster resource to dynamically overlay text """Class for Barcode Checksum Poster resource generator.""" from PIL import Image from utils.BaseResourceGenerator import BaseResourceGenerator class BarcodeChecksumPosterResourceGenerator(BaseResourceGenerator): """Class for Grid resource gene...
9ea8b1f1f4ccc068b460e76127f288742d25088e
django/contrib/comments/feeds.py
django/contrib/comments/feeds.py
from django.conf import settings from django.contrib.syndication.feeds import Feed from django.contrib.sites.models import Site from django.contrib import comments class LatestCommentFeed(Feed): """Feed of latest comments on the current site.""" def title(self): if not hasattr(self, '_site'): ...
from django.conf import settings from django.contrib.syndication.feeds import Feed from django.contrib.sites.models import Site from django.contrib import comments class LatestCommentFeed(Feed): """Feed of latest comments on the current site.""" def title(self): if not hasattr(self, '_site'): ...
Use correct m2m join table name in LatestCommentsFeed
Use correct m2m join table name in LatestCommentsFeed git-svn-id: 4f9f921b081c523744c7bf24d959a0db39629563@9089 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Python
bsd-3-clause
sam-tsai/django-old,skevy/django,dcramer/django-compositepks,alex/django-old,Instagram/django,dcramer/django-compositepks,django-nonrel/django-nonrel,alex/django-old,Smarsh/django,Smarsh/django,dcramer/django-compositepks,bfirsh/django-old,bfirsh/django-old,disqus/django-old,t11e/django,mitsuhiko/django,Instagram/djang...
<REPLACE_OLD> auth_users_group <REPLACE_NEW> auth_user_groups <REPLACE_END> <|endoftext|> from django.conf import settings from django.contrib.syndication.feeds import Feed from django.contrib.sites.models import Site from django.contrib import comments class LatestCommentFeed(Feed): """Feed of latest comments on ...
Use correct m2m join table name in LatestCommentsFeed git-svn-id: 4f9f921b081c523744c7bf24d959a0db39629563@9089 bcc190cf-cafb-0310-a4f2-bffc1f526a37 from django.conf import settings from django.contrib.syndication.feeds import Feed from django.contrib.sites.models import Site from django.contrib import comments cla...
384beaa77e2eaad642ec7f764acd09c2c3e04350
res_company.py
res_company.py
from openerp.osv import osv, fields from openerp.tools.translate import _ class res_company(osv.Model): _inherit = "res.company" _columns = { 'remittance_letter_top': fields.text( _('Remittance Letter - top message'), help=_('Message to write at the top of Remittance Letter ' ...
from openerp.osv import osv, fields from openerp.tools.translate import _ class res_company(osv.Model): _inherit = "res.company" _columns = { 'remittance_letter_top': fields.text( _('Remittance Letter - top message'), help=_('Message to write at the top of Remittance Letter ' ...
Make Remittance Letter config messages translatable
Make Remittance Letter config messages translatable
Python
agpl-3.0
xcgd/account_streamline
<REPLACE_OLD> allowed.') <REPLACE_NEW> allowed.'), <REPLACE_END> <REPLACE_OLD> ), <REPLACE_NEW> translate=True), <REPLACE_END> <REPLACE_OLD> allowed.') <REPLACE_NEW> allowed.'), <REPLACE_END> <REPLACE_OLD> ), <REPLACE_NEW> translate=True), <REPLACE_END> <|endoftext|> from openerp.osv import osv, field...
Make Remittance Letter config messages translatable from openerp.osv import osv, fields from openerp.tools.translate import _ class res_company(osv.Model): _inherit = "res.company" _columns = { 'remittance_letter_top': fields.text( _('Remittance Letter - top message'), help=_...
3ef4e68ae64a46f09103001f391b3d6a3d098e33
test/test_bezier_direct.py
test/test_bezier_direct.py
from __future__ import division import sys import os sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..')) # import cocos from cocos.director import director from cocos.actions import Bezier from cocos.sprite import Sprite import pyglet from cocos import path def direct_bezier(p0, p1, p2, p3): '''G...
Test using bezier going through 4 specific points
Test using bezier going through 4 specific points git-svn-id: 5665c17dde288ce6190d85f4a2d6486351776710@869 f663ce52-ac46-0410-b8de-c1c220b0eb76
Python
bsd-3-clause
eevee/cocos2d-mirror
<REPLACE_OLD> <REPLACE_NEW> from __future__ import division import sys import os sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..')) # import cocos from cocos.director import director from cocos.actions import Bezier from cocos.sprite import Sprite import pyglet from cocos import path def direct_bez...
Test using bezier going through 4 specific points git-svn-id: 5665c17dde288ce6190d85f4a2d6486351776710@869 f663ce52-ac46-0410-b8de-c1c220b0eb76
6423bb87a392bf6f8abd3b04a0a1bab3181542a0
run_time/src/gae_server/font_mapper.py
run_time/src/gae_server/font_mapper.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 ...
""" 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 ...
Add support for NotoSans and Arimo.
Add support for NotoSans and Arimo.
Python
apache-2.0
googlefonts/TachyFont,googlei18n/TachyFont,moyogo/tachyfont,googlei18n/TachyFont,moyogo/tachyfont,bstell/TachyFont,bstell/TachyFont,bstell/TachyFont,moyogo/tachyfont,googlefonts/TachyFont,googlei18n/TachyFont,googlei18n/TachyFont,googlei18n/TachyFont,moyogo/tachyfont,googlefonts/TachyFont,bstell/TachyFont,googlefonts/T...
<INSERT> elif fontname[0:8] == 'NotoSans': family_dir = 'NotoSans/' elif fontname[0:5] == 'Arimo': family_dir = 'Arimo/' <INSERT_END> <|endoftext|> """ 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 c...
Add support for NotoSans and Arimo. """ 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 U...
3698f0a51056f32c7595c1baca578d25764cc768
cnddh/config_prd.py
cnddh/config_prd.py
AMBIENTE = u'linux' PROD = False DEBUG = False LOG = False LOGPATH = './Application.log' EMAIL_HOST = 'smtp.gmail.com' EMAIL_LOGIN = 'xxxxxxxx@cnddh.org.br' EMAIL_PASSWORD = 'senha' EMAIL_PORT = 587 DATABASE_URI = 'mysql://root:senha@localhost/cnddh_db' ECHO = False UPLOADS_DEFAULT_DEST = r'C:\Temp\u...
AMBIENTE = u'linux' PROD = False DEBUG = False LOG = False LOGPATH = './Application.log' EMAIL_HOST = 'smtp.gmail.com' EMAIL_LOGIN = 'xxxxxxxx@cnddh.org.br' EMAIL_PASSWORD = 'senha' EMAIL_PORT = 587 DATABASE_URI = 'mysql://root:senha@localhost/cnddh_db' ECHO = False SQLALCHEMY_TRACK_MODIFICATIONS = Fal...
Add some key in config
Add some key in config
Python
apache-2.0
dedeco/cnddh-denuncias,dedeco/cnddh-denuncias,dedeco/cnddh-denuncias
<INSERT> False SQLALCHEMY_TRACK_MODIFICATIONS = <INSERT_END> <|endoftext|> AMBIENTE = u'linux' PROD = False DEBUG = False LOG = False LOGPATH = './Application.log' EMAIL_HOST = 'smtp.gmail.com' EMAIL_LOGIN = 'xxxxxxxx@cnddh.org.br' EMAIL_PASSWORD = 'senha' EMAIL_PORT = 587 DATABASE_URI = 'mysql://root:s...
Add some key in config AMBIENTE = u'linux' PROD = False DEBUG = False LOG = False LOGPATH = './Application.log' EMAIL_HOST = 'smtp.gmail.com' EMAIL_LOGIN = 'xxxxxxxx@cnddh.org.br' EMAIL_PASSWORD = 'senha' EMAIL_PORT = 587 DATABASE_URI = 'mysql://root:senha@localhost/cnddh_db' ECHO = False UPLOADS_DE...
903c0d6a3bda96a0b193cc6efd2f8e868d4d82e2
setuptools/tests/test_build_ext.py
setuptools/tests/test_build_ext.py
"""build_ext tests """ import unittest from distutils.command.build_ext import build_ext as distutils_build_ext from setuptools.command.build_ext import build_ext from setuptools.dist import Distribution class TestBuildExtTest(unittest.TestCase): def test_get_ext_filename(self): # setuptools needs to give...
"""build_ext tests """ import unittest import distutils.command.build_ext as orig from setuptools.command.build_ext import build_ext from setuptools.dist import Distribution class TestBuildExtTest(unittest.TestCase): def test_get_ext_filename(self): # setuptools needs to give back the same # resu...
Use namespacing for easier reading
Use namespacing for easier reading
Python
mit
pypa/setuptools,pypa/setuptools,pypa/setuptools
<REPLACE_OLD> unittest from <REPLACE_NEW> unittest import <REPLACE_END> <DELETE> import build_ext <DELETE_END> <REPLACE_OLD> distutils_build_ext from <REPLACE_NEW> orig from <REPLACE_END> <REPLACE_OLD> distutils_build_ext.get_ext_filename(cmd, <REPLACE_NEW> orig.build_ext.get_ext_filename(cmd, <REPLACE_END> <|endoftex...
Use namespacing for easier reading """build_ext tests """ import unittest from distutils.command.build_ext import build_ext as distutils_build_ext from setuptools.command.build_ext import build_ext from setuptools.dist import Distribution class TestBuildExtTest(unittest.TestCase): def test_get_ext_filename(self)...
764e0b742351c07dda5657fb2dc46f45dce4a3ef
migrations/versions/86b41c3dbd00_add_indexes_on_driver_for_licence_and_.py
migrations/versions/86b41c3dbd00_add_indexes_on_driver_for_licence_and_.py
"""Add indexes on driver for licence and departement Revision ID: 86b41c3dbd00 Revises: ccd5b0142a76 Create Date: 2019-10-21 15:55:35.965422 """ # revision identifiers, used by Alembic. revision = '86b41c3dbd00' down_revision = 'ccd5b0142a76' from alembic import op import sqlalchemy as sa from sqlalchemy.dialects i...
Add migration to create index on driver for departement and licence
Add migration to create index on driver for departement and licence
Python
agpl-3.0
openmaraude/APITaxi,openmaraude/APITaxi
<INSERT> """Add indexes on driver for licence and departement Revision ID: 86b41c3dbd00 Revises: ccd5b0142a76 Create Date: 2019-10-21 15:55:35.965422 """ # revision identifiers, used by Alembic. revision = '86b41c3dbd00' down_revision = 'ccd5b0142a76' from alembic import op import sqlalchemy as sa from sqlalchemy.d...
Add migration to create index on driver for departement and licence
cce2869ac56fe3576e519884fd2a68d75a7fe1cb
backend/scripts/countdups.py
backend/scripts/countdups.py
#!/usr/bin/env python import rethinkdb as r conn = r.connect('localhost', 30815, db='materialscommons') rql = r.table('datafiles').filter(r.row['usesid'].match("^[0-9a-f]")).pluck('size') total_bytes = 0 total_files = 0 for doc in rql.run(conn): total_bytes = total_bytes + doc['size'] total_files = total_file...
Add in script to count duplicates.
Add in script to count duplicates.
Python
mit
materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org
<INSERT> #!/usr/bin/env python import rethinkdb as r conn = r.connect('localhost', 30815, db='materialscommons') rql = r.table('datafiles').filter(r.row['usesid'].match("^[0-9a-f]")).pluck('size') total_bytes = 0 total_files = 0 for doc in rql.run(conn): <INSERT_END> <INSERT> total_bytes = total_bytes + doc['size'...
Add in script to count duplicates.
507a52905164d2814b0b43a6d61eb002dfe0662a
enerdata/datetime/work_and_holidays.py
enerdata/datetime/work_and_holidays.py
import calendar from datetime import timedelta def get_num_of_workdays_holidays(init_date, end_date, holidays_list): workdays = 0 holidays = 0 _date = end_date while _date <= init_date: if (calendar.weekday(_date.year, _date.month, _date.day) in (5, 6) ) or (_date.date() in holidays_l...
Add work and holidays get
Add work and holidays get
Python
mit
gisce/enerdata
<INSERT> import calendar from datetime import timedelta def get_num_of_workdays_holidays(init_date, end_date, holidays_list): <INSERT_END> <INSERT> workdays = 0 holidays = 0 _date = end_date while _date <= init_date: if (calendar.weekday(_date.year, _date.month, _date.day) in (5, 6) ) ...
Add work and holidays get
6e6aa02907b3d156174cfe1a5f8e9c274c080778
SegNetCMR/helpers.py
SegNetCMR/helpers.py
import tensorflow as tf def add_output_images(images, logits, labels): cast_labels = tf.cast(labels, tf.uint8) * 128 cast_labels = cast_labels[...,None] tf.summary.image('input_labels', cast_labels, max_outputs=3) classification1 = tf.nn.softmax(logits = logits, dim=-1)[...,1] output_image_gb = im...
import tensorflow as tf def add_output_images(images, logits, labels): cast_labels = tf.cast(labels, tf.uint8) * 128 cast_labels = cast_labels[...,None] tf.summary.image('input_labels', cast_labels, max_outputs=3) classification1 = tf.nn.softmax(logits = logits, dim=-1)[...,1] output_image_gb = im...
Add output with images mixed with binary version of output labels
Add output with images mixed with binary version of output labels
Python
mit
mshunshin/SegNetCMR,mshunshin/SegNetCMR
<INSERT> output_labels_mixed_r = output_image_binary[...,0] + tf.multiply(images[...,0], (1-output_image_binary[...,0])) output_labels_mixed = tf.stack([output_labels_mixed_r, output_image_gb, output_image_gb], axis=3) tf.summary.image('output_labels_mixed', output_labels_mixed, max_outputs=3) <INSERT_END>...
Add output with images mixed with binary version of output labels import tensorflow as tf def add_output_images(images, logits, labels): cast_labels = tf.cast(labels, tf.uint8) * 128 cast_labels = cast_labels[...,None] tf.summary.image('input_labels', cast_labels, max_outputs=3) classification1 = tf....
29eb3661ace0f3dd62d210621ebd24ef95261162
src/listen.py
src/listen.py
import redis import re from common import get_db from datetime import datetime MSGPATTERN = re.compile('^(\w+)\|(\d)\|([\s\S]*)$') CHANNEL = 'logfire' def listen(args): global MSGPATTERN rserver = redis.Redis('localhost') pubsub = rserver.pubsub() pubsub.subscribe(CHANNEL) db = get_db(args.mongohost) ...
import redis import re from common import get_db from datetime import datetime MSGPATTERN = re.compile('^(\w+)\|(\d)\|([\s\S]*)$') CHANNEL = 'logfire' def listen(args): global MSGPATTERN rserver = redis.Redis('localhost') pubsub = rserver.pubsub() pubsub.subscribe(CHANNEL) db = get_db(args.mongohost) ...
Make sure timestamp of log message is UTC when it goes into DB
Make sure timestamp of log message is UTC when it goes into DB
Python
mit
jay3sh/logfire,jay3sh/logfire
<REPLACE_OLD> tstamp=datetime.now(),comp=component,lvl=level,msg=message)) <REPLACE_NEW> tstamp=datetime.utcnow(),comp=component,lvl=level,msg=message)) <REPLACE_END> <|endoftext|> import redis import re from common import get_db from datetime import datetime MSGPATTERN = re.compile('^(\w+)\|(\d)\|([\s\S]*)$') CHAN...
Make sure timestamp of log message is UTC when it goes into DB import redis import re from common import get_db from datetime import datetime MSGPATTERN = re.compile('^(\w+)\|(\d)\|([\s\S]*)$') CHANNEL = 'logfire' def listen(args): global MSGPATTERN rserver = redis.Redis('localhost') pubsub = rserver.pubsub...
f617c1ce192739594c161f717d5d04cc17ede22e
distarray/local/tests/paralleltest_io.py
distarray/local/tests/paralleltest_io.py
import tempfile import h5py from numpy.testing import assert_allclose from os import path from distarray.local import LocalArray, save, load, save_hdf5 from distarray.testing import comm_null_passes, MpiTestCase class TestFlatFileIO(MpiTestCase): @comm_null_passes def test_flat_file_read_write(self): ...
import tempfile from numpy.testing import assert_allclose from os import path from distarray.local import LocalArray, save, load, save_hdf5 from distarray.testing import comm_null_passes, MpiTestCase class TestFlatFileIO(MpiTestCase): @comm_null_passes def test_flat_file_read_write(self): larr0 = Loc...
Move h5py import into HDF test.
Move h5py import into HDF test.
Python
bsd-3-clause
RaoUmer/distarray,enthought/distarray,RaoUmer/distarray,enthought/distarray
<REPLACE_OLD> tempfile import h5py from <REPLACE_NEW> tempfile from <REPLACE_END> <INSERT> import h5py <INSERT_END> <|endoftext|> import tempfile from numpy.testing import assert_allclose from os import path from distarray.local import LocalArray, save, load, save_hdf5 from distarray.testing import comm_null_p...
Move h5py import into HDF test. import tempfile import h5py from numpy.testing import assert_allclose from os import path from distarray.local import LocalArray, save, load, save_hdf5 from distarray.testing import comm_null_passes, MpiTestCase class TestFlatFileIO(MpiTestCase): @comm_null_passes def test_fla...
0461fad1a3d81aa2d937a1734f1ebb07b3e81d79
undercloud_heat_plugins/server_update_allowed.py
undercloud_heat_plugins/server_update_allowed.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 # ...
# # 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 # ...
Fix no-replace-server to accurately preview update
Fix no-replace-server to accurately preview update This override of OS::Nova::Server needs to reflect the fact that it never replaces on update or the update --dry-run output ends up being wrong. Closes-Bug: 1561076 Change-Id: I9256872b877fbe7f91befb52995c62de006210ef
Python
apache-2.0
openstack/tripleo-common,openstack/tripleo-common
<REPLACE_OLD> server.Server.properties_schema.keys() def <REPLACE_NEW> server.Server.properties_schema.keys() def needs_replace_with_prop_diff(self, changed_properties_set, after_props, before_props): return False def <REPLACE_END> <|endoftext|> # # Licensed unde...
Fix no-replace-server to accurately preview update This override of OS::Nova::Server needs to reflect the fact that it never replaces on update or the update --dry-run output ends up being wrong. Closes-Bug: 1561076 Change-Id: I9256872b877fbe7f91befb52995c62de006210ef # # Licensed under the Apache License, Versio...
e4869e9e348dd5a0441edc0aca7c0298c2c892a9
mopidy/backends/dummy.py
mopidy/backends/dummy.py
from __future__ import unicode_literals # Make classes previously residing here available in the old location for # backwards compatibility with extensions targeting Mopidy < 0.18. from mopidy.backend.dummy import * # noqa
Make old DummyBackend imports work
backend: Make old DummyBackend imports work
Python
apache-2.0
glogiotatidis/mopidy,vrs01/mopidy,mokieyue/mopidy,quartz55/mopidy,jmarsik/mopidy,diandiankan/mopidy,jmarsik/mopidy,dbrgn/mopidy,bencevans/mopidy,mopidy/mopidy,bencevans/mopidy,mokieyue/mopidy,tkem/mopidy,hkariti/mopidy,bencevans/mopidy,glogiotatidis/mopidy,swak/mopidy,ZenithDK/mopidy,kingosticks/mopidy,diandiankan/mopi...
<INSERT> from __future__ import unicode_literals # Make classes previously residing here available in the old location for # backwards compatibility with extensions targeting Mopidy < 0.18. from mopidy.backend.dummy import * <INSERT_END> <INSERT> # noqa <INSERT_END> <|endoftext|> from __future__ import unicode_litera...
backend: Make old DummyBackend imports work
80529d5032b6728adcaad426310c30b5e6366ad4
solution.py
solution.py
class Kiosk(): def __init__(self, visit_cost, location): self.visit_cost = visit_cost self.location = location print 'initializing Kiosk' #patient shold be Person def visit(self, patient): if not patient.location == self.location: print 'patient not in correct lo...
class Kiosk(): def __init__(self, location, visit_cost, diabetes_threshold, cardio_threshold): self.location = location self.visit_cost = visit_cost self.diabetes_threshold = diabetes_threshold self.cardio_threshold = cardio_threshold #Initial cost to create kiosk...
Clean up and finish Kiosk class
Clean up and finish Kiosk class There was some redundancy because I merged it poorly
Python
bsd-3-clause
rkawauchi/IHK,rkawauchi/IHK
<INSERT> location, <INSERT_END> <REPLACE_OLD> location): <REPLACE_NEW> diabetes_threshold, cardio_threshold): self.location = location <REPLACE_END> <REPLACE_OLD> self.location = location <REPLACE_NEW> self.diabetes_threshold = diabetes_threshold self.cardio_threshold = cardio_threshold ...
Clean up and finish Kiosk class There was some redundancy because I merged it poorly class Kiosk(): def __init__(self, visit_cost, location): self.visit_cost = visit_cost self.location = location print 'initializing Kiosk' #patient shold be Person def visit(self, patient): ...
dfdeaf536466cfa8003af4cd5341d1d7127ea6b7
py/_test_py2go.py
py/_test_py2go.py
#!/usr/bin/env python import datetime def return_true(): return True def return_false(): return False def return_int(): return 123 def return_float(): return 1.0 def return_string(): return "ABC" def return_bytearray(): return bytearray('abcdefg') def return_array(): return [1, 2, {"k...
#!/usr/bin/env python import datetime def return_true(): return True def return_false(): return False def return_int(): return 123 def return_float(): return 1.0 def return_string(): return "ABC" def return_bytearray(): return bytearray('abcdefg') def return_array(): return [1,...
Update python script for pep8 style
Update python script for pep8 style
Python
mit
sensorbee/py,sensorbee/py
<REPLACE_OLD> datetime def <REPLACE_NEW> datetime def <REPLACE_END> <REPLACE_OLD> True def <REPLACE_NEW> True def <REPLACE_END> <REPLACE_OLD> False def <REPLACE_NEW> False def <REPLACE_END> <REPLACE_OLD> 123 def <REPLACE_NEW> 123 def <REPLACE_END> <REPLACE_OLD> 1.0 def <REPLACE_NEW> 1.0 def <REPLACE_END>...
Update python script for pep8 style #!/usr/bin/env python import datetime def return_true(): return True def return_false(): return False def return_int(): return 123 def return_float(): return 1.0 def return_string(): return "ABC" def return_bytearray(): return bytearray('abcdefg') def ...
b3540f744efbcb0f14f9b4081aeffda1f5ccae3c
pyscraper/patchfilter.py
pyscraper/patchfilter.py
#! /usr/bin/python2.3 # vim:sw=8:ts=8:et:nowrap import os import shutil def ApplyPatches(filein, fileout): # Generate short name such as wrans/answers2003-03-31.html (rest, name) = os.path.split(filein) (rest, dir) = os.path.split(rest) fileshort = os.path.join(dir, name) # Lo...
#! /usr/bin/python2.3 # vim:sw=8:ts=8:et:nowrap import os import shutil def ApplyPatches(filein, fileout): # Generate short name such as wrans/answers2003-03-31.html (rest, name) = os.path.split(filein) (rest, dir) = os.path.split(rest) fileshort = os.path.join(dir, name) # Lo...
Remove code which blanks patch files
Remove code which blanks patch files
Python
agpl-3.0
mysociety/publicwhip,mysociety/publicwhip,mysociety/publicwhip
<REPLACE_OLD> print <REPLACE_NEW> raise Exception, <REPLACE_END> <REPLACE_OLD> %s, blanking it out" <REPLACE_NEW> %s" % fileshort #print "blanking out %s" <REPLACE_END> <REPLACE_OLD> os.rename(patchfile, <REPLACE_NEW> #os.rename(patchfile, <REPLACE_END> <REPLACE_OLD> blankfile <REPLACE_NEW> #blankfile ...
Remove code which blanks patch files #! /usr/bin/python2.3 # vim:sw=8:ts=8:et:nowrap import os import shutil def ApplyPatches(filein, fileout): # Generate short name such as wrans/answers2003-03-31.html (rest, name) = os.path.split(filein) (rest, dir) = os.path.split(rest) fileshort =...
8aea526176592511581ddbeb6f3bb96ce072cc91
wukong/__init__.py
wukong/__init__.py
# Set up a null roothandler for our logging system import logging try: # Python 2.7+ from logging import NullHandler except ImportError: class NullHandler(logging.Handler): def emit(self, record): pass logging.getLogger(__name__).addHandler(NullHandler())
# Set up a null roothandler for our logging system import logging from logging import NullHandler logging.getLogger(__name__).addHandler(NullHandler())
Remove the NullHandler patch because we don't support any python versions that need it
Remove the NullHandler patch because we don't support any python versions that need it
Python
mit
SurveyMonkey/wukong
<REPLACE_OLD> logging try: # Python 2.7+ from <REPLACE_NEW> logging from <REPLACE_END> <REPLACE_OLD> NullHandler except ImportError: class NullHandler(logging.Handler): def emit(self, record): pass logging.getLogger(__name__).addHandler(NullHandler()) <REPLACE_NEW> NullHandler logging.get...
Remove the NullHandler patch because we don't support any python versions that need it # Set up a null roothandler for our logging system import logging try: # Python 2.7+ from logging import NullHandler except ImportError: class NullHandler(logging.Handler): def emit(self, record): pass ...
e249e1c03fab60c2f09a171924f3a1f701a0c7aa
astropy/tests/image_tests.py
astropy/tests/image_tests.py
import matplotlib from matplotlib import pyplot as plt from ..utils.decorators import wraps MPL_VERSION = matplotlib.__version__ ROOT = "http://{server}/testing/astropy/2018-02-01T23:31:45.013149/{mpl_version}/" IMAGE_REFERENCE_DIR = ROOT.format(server='data.astropy.org', mpl_version=MPL_VERSION[:3] + '.x') def i...
import matplotlib from matplotlib import pyplot as plt from ..utils.decorators import wraps MPL_VERSION = matplotlib.__version__ ROOT = "http://{server}/testing/astropy/2018-02-01T23:31:45.013149/{mpl_version}/" IMAGE_REFERENCE_DIR = (ROOT.format(server='data.astropy.org', mpl_version=MPL_VERSION[:3] + '.x') + ',' ...
Add back mirror for image tests
Add back mirror for image tests
Python
bsd-3-clause
pllim/astropy,stargaser/astropy,MSeifert04/astropy,funbaker/astropy,larrybradley/astropy,astropy/astropy,pllim/astropy,lpsinger/astropy,saimn/astropy,MSeifert04/astropy,mhvk/astropy,dhomeier/astropy,aleksandr-bakanov/astropy,StuartLittlefair/astropy,bsipocz/astropy,astropy/astropy,lpsinger/astropy,bsipocz/astropy,DougB...
<REPLACE_OLD> ROOT.format(server='data.astropy.org', <REPLACE_NEW> (ROOT.format(server='data.astropy.org', <REPLACE_END> <REPLACE_OLD> '.x') def <REPLACE_NEW> '.x') + ',' + ROOT.format(server='www.astropy.org/astropy-data', mpl_version=MPL_VERSION[:3] + '.x')) def <REPLACE_END> <|endoftext|> ...
Add back mirror for image tests import matplotlib from matplotlib import pyplot as plt from ..utils.decorators import wraps MPL_VERSION = matplotlib.__version__ ROOT = "http://{server}/testing/astropy/2018-02-01T23:31:45.013149/{mpl_version}/" IMAGE_REFERENCE_DIR = ROOT.format(server='data.astropy.org', mpl_version...
12bbc7e10ae52328feb766e2bed5f5f20fa0d354
pyramid_es/__init__.py
pyramid_es/__init__.py
from pyramid.settings import asbool from .client import ElasticClient def client_from_config(settings, prefix='elastic.'): """ Instantiate and configure an Elasticsearch from settings. In typical Pyramid usage, you shouldn't use this directly: instead, just include ``pyramid_es`` and use the :py:fun...
from pyramid.settings import asbool from .client import ElasticClient def client_from_config(settings, prefix='elastic.'): """ Instantiate and configure an Elasticsearch from settings. In typical Pyramid usage, you shouldn't use this directly: instead, just include ``pyramid_es`` and use the :py:fun...
Add a settings key to ensure index at start
Add a settings key to ensure index at start
Python
mit
storborg/pyramid_es
<INSERT> if asbool(settings.get('elastic.ensure_index_on_start')): <INSERT_END> <|endoftext|> from pyramid.settings import asbool from .client import ElasticClient def client_from_config(settings, prefix='elastic.'): """ Instantiate and configure an Elasticsearch from settings. In typical Pyrami...
Add a settings key to ensure index at start from pyramid.settings import asbool from .client import ElasticClient def client_from_config(settings, prefix='elastic.'): """ Instantiate and configure an Elasticsearch from settings. In typical Pyramid usage, you shouldn't use this directly: instead, just ...
186e8424a16188825210b4c05656ae3b8fcc28c2
provpy/provpyexample_Elements.py
provpy/provpyexample_Elements.py
import json from provpy import * # Define your namespaces (see provpyexample_PROVURIRef_PROVNamespace.py) FOAF = PROVNamespace("http://xmlns.com/foaf/0.1/") ex = PROVNamespace("http://www.example.com/") dcterms = PROVNamespace("http://purl.org/dc/terms/") xsd = PROVNamespace('http://www.w3.org/2001/XMLSchema-datatypes...
Add an example file demonstrating defining, adding and serializing prov elements in a prov container
Add an example file demonstrating defining, adding and serializing prov elements in a prov container
Python
mit
satra/prov,krischer/prov,trungdong/prov,krischer/prov
<REPLACE_OLD> <REPLACE_NEW> import json from provpy import * # Define your namespaces (see provpyexample_PROVURIRef_PROVNamespace.py) FOAF = PROVNamespace("http://xmlns.com/foaf/0.1/") ex = PROVNamespace("http://www.example.com/") dcterms = PROVNamespace("http://purl.org/dc/terms/") xsd = PROVNamespace('http://www.w3...
Add an example file demonstrating defining, adding and serializing prov elements in a prov container
484f3537d634e31f79c2281cff869724707ee2c3
day03/solution.py
day03/solution.py
santaPosition = [0, 0] roboSantaPosition = [0, 0] uniquePositions = set() input = open("data", "r").read() for index, char in enumerate(input): position = [] if index % 2 == 0: position = santaPosition else: position = roboSantaPosition if char is '^': position[0] += 1 elif char is 'v': position[0] -= ...
santaPosition = [0, 0] roboSantaPosition = [0, 0] uniquePositions = set() input = open("data", "r").read() for index, char in enumerate(input): position = [] if index % 2 == 0: position = santaPosition else: position = roboSantaPosition if char is '^': position[0] += 1 elif char is 'v': position[0] -= ...
Make tuple creation from position cleaner.
Make tuple creation from position cleaner.
Python
mit
Mark-Simulacrum/advent-of-code-2015,Mark-Simulacrum/advent-of-code-2015,Mark-Simulacrum/advent-of-code-2015,Mark-Simulacrum/advent-of-code-2015
<REPLACE_OLD> 1 uniquePositions.add((position[0], position[1])) print <REPLACE_NEW> 1 uniquePositions.add(tuple(position)) print <REPLACE_END> <REPLACE_OLD> len(uniquePositions) <REPLACE_NEW> len(uniquePositions) <REPLACE_END> <|endoftext|> santaPosition = [0, 0] roboSantaPosition = [0, 0] uniquePositions = set...
Make tuple creation from position cleaner. santaPosition = [0, 0] roboSantaPosition = [0, 0] uniquePositions = set() input = open("data", "r").read() for index, char in enumerate(input): position = [] if index % 2 == 0: position = santaPosition else: position = roboSantaPosition if char is '^': position[...
ce2f07e7fa5ac38235cbb6ea6c4fee3a60031246
social_core/tests/backends/test_udata.py
social_core/tests/backends/test_udata.py
import json from six.moves.urllib_parse import urlencode from .oauth import OAuth2Test class DatagouvfrOAuth2Test(OAuth2Test): backend_path = 'social_core.backends.udata.DatagouvfrOAuth2' user_data_url = 'https://www.data.gouv.fr/api/1/me/' expected_username = 'foobar' access_token_body = json.dumps...
import json from six.moves.urllib_parse import urlencode from .oauth import OAuth2Test class DatagouvfrOAuth2Test(OAuth2Test): backend_path = 'social_core.backends.udata.DatagouvfrOAuth2' user_data_url = 'https://www.data.gouv.fr/api/1/me/' expected_username = 'foobar' access_token_body = json.dumps...
Fix tests for udata/datagouvfr backend
Fix tests for udata/datagouvfr backend
Python
bsd-3-clause
python-social-auth/social-core,python-social-auth/social-core
<REPLACE_OLD> 'bearer' <REPLACE_NEW> 'bearer', 'first_name': 'foobar', 'email': 'foobar@example.com' <REPLACE_END> <|endoftext|> import json from six.moves.urllib_parse import urlencode from .oauth import OAuth2Test class DatagouvfrOAuth2Test(OAuth2Test): backend_path = 'social_core.backends.u...
Fix tests for udata/datagouvfr backend import json from six.moves.urllib_parse import urlencode from .oauth import OAuth2Test class DatagouvfrOAuth2Test(OAuth2Test): backend_path = 'social_core.backends.udata.DatagouvfrOAuth2' user_data_url = 'https://www.data.gouv.fr/api/1/me/' expected_username = 'fo...
27aad0e3ed95cb43b28eb3c02fa96b3a9b74de5b
tests/test_container.py
tests/test_container.py
# coding: utf8 from .common import * class TestContainers(TestCase): def test_unicode_filename(self): container = av.open(self.sandboxed(u'¢∞§¶•ªº.mov'), 'w')
# coding: utf8 import os import sys import unittest from .common import * # On Windows, Python 3.0 - 3.5 have issues handling unicode filenames. # Starting with Python 3.6 the situation is saner thanks to PEP 529: # # https://www.python.org/dev/peps/pep-0529/ broken_unicode = ( os.name == 'nt' and sys.versi...
Disable unicode filename test on Windows with Python 3.0 - 3.5
Disable unicode filename test on Windows with Python 3.0 - 3.5 Before PEP 529 landed in Python 3.6, unicode filename handling on Windows is hit-and-miss, so don't break CI.
Python
bsd-3-clause
PyAV-Org/PyAV,mikeboers/PyAV,PyAV-Org/PyAV,mikeboers/PyAV
<REPLACE_OLD> utf8 from <REPLACE_NEW> utf8 import os import sys import unittest from <REPLACE_END> <REPLACE_OLD> * class <REPLACE_NEW> * # On Windows, Python 3.0 - 3.5 have issues handling unicode filenames. # Starting with Python 3.6 the situation is saner thanks to PEP 529: # # https://www.python.org/dev/peps/p...
Disable unicode filename test on Windows with Python 3.0 - 3.5 Before PEP 529 landed in Python 3.6, unicode filename handling on Windows is hit-and-miss, so don't break CI. # coding: utf8 from .common import * class TestContainers(TestCase): def test_unicode_filename(self): container = av.open(self.s...
c53f03c738ad6357ccd87a506cbc05bc1e2a8474
views.py
views.py
from django.http import HttpResponse from django.shortcuts import render_to_response from store.models import FandomHierarchy def frontpage(request, filter): return render_to_response('index.html', {'filter': filter, 'nodes': FandomHierarchy.objects.all()})
from django.http import HttpResponse from django.shortcuts import render_to_response from store.models import FandomHierarchy def frontpage(request, filter=None): return render_to_response('index.html', {'filter': filter, 'nodes': FandomHierarchy.objects.all()})
Add default value for filter so things don't break
Add default value for filter so things don't break
Python
bsd-3-clause
willmurnane/store
<REPLACE_OLD> filter): return <REPLACE_NEW> filter=None): return <REPLACE_END> <|endoftext|> from django.http import HttpResponse from django.shortcuts import render_to_response from store.models import FandomHierarchy def frontpage(request, filter=None): return render_to_response('index.html', {'filter': filter, '...
Add default value for filter so things don't break from django.http import HttpResponse from django.shortcuts import render_to_response from store.models import FandomHierarchy def frontpage(request, filter): return render_to_response('index.html', {'filter': filter, 'nodes': FandomHierarchy.objects.all()})
cd4d67ae0796e45ef699e1bab60ee5aeeac91dbb
native_qwebview_example/run.py
native_qwebview_example/run.py
import sys from browser import BrowserDialog from PyQt4 import QtGui from PyQt4.QtCore import QUrl from PyQt4.QtWebKit import QWebView class MyBrowser(QtGui.QDialog): def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) QWebView.__init__(self) self.ui = BrowserDialog() ...
# Basic example for testing purposes, taken from # https://pythonspot.com/creating-a-webbrowser-with-python-and-pyqt-tutorial/ import sys from browser import BrowserDialog from PyQt4 import QtGui from PyQt4.QtCore import QUrl from PyQt4.QtWebKit import QWebView class MyBrowser(QtGui.QDialog): def __init__(self, ...
Add a comment about where the basic example was taken [skip CI]
Add a comment about where the basic example was taken [skip CI]
Python
agpl-3.0
gem/oq-svir-qgis,gem/oq-svir-qgis,gem/oq-svir-qgis,gem/oq-svir-qgis
<REPLACE_OLD> import <REPLACE_NEW> # Basic example for testing purposes, taken from # https://pythonspot.com/creating-a-webbrowser-with-python-and-pyqt-tutorial/ import <REPLACE_END> <|endoftext|> # Basic example for testing purposes, taken from # https://pythonspot.com/creating-a-webbrowser-with-python-and-pyqt-tutor...
Add a comment about where the basic example was taken [skip CI] import sys from browser import BrowserDialog from PyQt4 import QtGui from PyQt4.QtCore import QUrl from PyQt4.QtWebKit import QWebView class MyBrowser(QtGui.QDialog): def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) ...
b26d8903561809bec0224cd0ebec5c3c6bff7ee5
setup.py
setup.py
from setuptools import setup, find_packages requires = [ 'configparser', 'python-dateutil', 'pytz', 'requests', 'simplejson' ] setup( name='amaascore', version='0.1.7', description='Asset Management as a Service - Core SDK', license='Apache License 2.0', url='https://github.com...
from setuptools import setup, find_packages requires = [ 'configparser', 'python-dateutil', 'pytz', 'requests', 'simplejson' ] setup( name='amaascore', version='0.1.8', description='Asset Management as a Service - Core SDK', license='Apache License 2.0', url='https://github.com...
Increment version for deployment to PyPI
Increment version for deployment to PyPI
Python
apache-2.0
paul-rs/amaas-core-sdk-python,amaas-fintech/amaas-core-sdk-python,nedlowe/amaas-core-sdk-python,nedlowe/amaas-core-sdk-python,paul-rs/amaas-core-sdk-python,amaas-fintech/amaas-core-sdk-python
<REPLACE_OLD> version='0.1.7', <REPLACE_NEW> version='0.1.8', <REPLACE_END> <|endoftext|> from setuptools import setup, find_packages requires = [ 'configparser', 'python-dateutil', 'pytz', 'requests', 'simplejson' ] setup( name='amaascore', version='0.1.8', description='Asset Manage...
Increment version for deployment to PyPI from setuptools import setup, find_packages requires = [ 'configparser', 'python-dateutil', 'pytz', 'requests', 'simplejson' ] setup( name='amaascore', version='0.1.7', description='Asset Management as a Service - Core SDK', license='Apache...
2b0c7304c1372997bc226d255ef22cc31f56f6fa
caminae/core/management.py
caminae/core/management.py
# http://djangosnippets.org/snippets/2311/ # Ensure South will update our custom SQL during a call to `migrate`. from south.signals import post_migrate def run_initial_sql(sender, **kwargs): app_label = kwargs.get('app') import os from django.db import connection, transaction, models app_dir = os.pat...
Enable auto-loading of raw SQL during South migration
Enable auto-loading of raw SQL during South migration
Python
bsd-2-clause
makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin,camillemonchicourt/Geotrek,GeotrekCE/Geotrek-admin,johan--/Geotrek,johan--/Geotrek,mabhub/Geotrek,Anaethelion/Geotrek,mabhub/Geotrek,Anaethelion/Geotrek,camillemonchicourt/Geotrek,makinacorpus/Geotrek,Anaethelion/Geotrek,johan--/Geotrek,mabhub/Geotrek...
<REPLACE_OLD> <REPLACE_NEW> # http://djangosnippets.org/snippets/2311/ # Ensure South will update our custom SQL during a call to `migrate`. from south.signals import post_migrate def run_initial_sql(sender, **kwargs): app_label = kwargs.get('app') import os from django.db import connection, transaction...
Enable auto-loading of raw SQL during South migration
708df747d1fba202780e97e1b1eb1af024f26f72
setup.py
setup.py
#!/usr/bin/env python from __future__ import absolute_import, division, print_function from setuptools import setup setup( include_package_data=True, test_suite="nose.collector", tests_require="nose", setup_requires=['pbr'], pbr=True, )
#!/usr/bin/env python from __future__ import absolute_import, division, print_function from setuptools import setup setup( include_package_data=True, test_suite="nose.collector", tests_require=['nose', 'hocr-spec'], setup_requires=['pbr'], pbr=True, )
Add hocr-spec-python to test requirements
Add hocr-spec-python to test requirements
Python
apache-2.0
mittagessen/kraken,mittagessen/kraken,mittagessen/kraken,mittagessen/kraken
<REPLACE_OLD> tests_require="nose", <REPLACE_NEW> tests_require=['nose', 'hocr-spec'], <REPLACE_END> <|endoftext|> #!/usr/bin/env python from __future__ import absolute_import, division, print_function from setuptools import setup setup( include_package_data=True, test_suite="nose.collector", tests_req...
Add hocr-spec-python to test requirements #!/usr/bin/env python from __future__ import absolute_import, division, print_function from setuptools import setup setup( include_package_data=True, test_suite="nose.collector", tests_require="nose", setup_requires=['pbr'], pbr=True, )
62586dc0e4e9ca8d0fee6c72e296c74875f3a65c
api/swd6/api/app.py
api/swd6/api/app.py
import logging import os import flask import flask_cors from sqlalchemy_jsonapi import flaskext as flask_jsonapi from swd6 import config from swd6.db.models import db CONF = config.CONF DEFAULT_CONF_PATH = '/opt/swd6/api/api.conf' app = None def start(): # pylint: disable=global-statement global app a...
import logging import os import flask import flask_cors from sqlalchemy_jsonapi import flaskext as flask_jsonapi from swd6 import config from swd6.db.models import db CONF = config.CONF DEFAULT_CONF_PATH = '/opt/swd6/api/api.conf' app = None def start(): # pylint: disable=global-statement global app a...
Fix CORS to allow for credentials
Fix CORS to allow for credentials Something changed in the client code requiring this setting.
Python
apache-2.0
jimbobhickville/swd6,jimbobhickville/swd6,jimbobhickville/swd6
<REPLACE_OLD> origins=CONF.api.cors_hosts) <REPLACE_NEW> origins=CONF.api.cors_hosts, supports_credentials=True) <REPLACE_END> <|endoftext|> import logging import os import flask import flask_cors from sqlalchemy_jsonapi import flaskext as flask_jsonapi from swd6 import config from swd6.db.models import db CONF ...
Fix CORS to allow for credentials Something changed in the client code requiring this setting. import logging import os import flask import flask_cors from sqlalchemy_jsonapi import flaskext as flask_jsonapi from swd6 import config from swd6.db.models import db CONF = config.CONF DEFAULT_CONF_PATH = '/opt/swd6/api...
ffdfa7729c865c8e999bdfd4af49e3beb6899970
test.py
test.py
import pdb import time import collections import random import itertools import xmlrpclib import dis server_url = 'http://127.0.0.1:20738/RPC2' server = xmlrpclib.Server(server_url) G = server.ubigraph def erdos (): vert_ids = range(0,1000) p = 0.001 G.clear() pdb.set_trace() for id in vert_ids:...
Add code to generate Erdos and preferential attachment graphs
Add code to generate Erdos and preferential attachment graphs
Python
mit
hausdorff/python-api-breakin
<REPLACE_OLD> <REPLACE_NEW> import pdb import time import collections import random import itertools import xmlrpclib import dis server_url = 'http://127.0.0.1:20738/RPC2' server = xmlrpclib.Server(server_url) G = server.ubigraph def erdos (): vert_ids = range(0,1000) p = 0.001 G.clear() pdb.set_tra...
Add code to generate Erdos and preferential attachment graphs
442aa916dc7b6d199b2c5e1fe973aa3fed8e9c35
src/python/grpcio_tests/tests_aio/unit/init_test.py
src/python/grpcio_tests/tests_aio/unit/init_test.py
# Copyright 2019 The gRPC Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
# Copyright 2019 The gRPC Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
Make sure the module space won't be polluted by "from grpc import aio"
Make sure the module space won't be polluted by "from grpc import aio"
Python
apache-2.0
jtattermusch/grpc,donnadionne/grpc,nicolasnoble/grpc,grpc/grpc,ejona86/grpc,donnadionne/grpc,ctiller/grpc,jtattermusch/grpc,nicolasnoble/grpc,donnadionne/grpc,vjpai/grpc,grpc/grpc,grpc/grpc,ctiller/grpc,vjpai/grpc,jtattermusch/grpc,donnadionne/grpc,grpc/grpc,ejona86/grpc,stanley-cheung/grpc,stanley-cheung/grpc,nicolasn...
<REPLACE_OLD> grpc.aio.Channel) async def test_aio_from_grpc(self): from grpc import aio # pylint: disable=wrong-import-position channel = aio.insecure_channel('dummy') self.assertIsInstance(channel, aio.Channel) if <REPLACE_NEW> grpc.aio.Channel) if <REPLACE_END> <|endoftext|> # Copyr...
Make sure the module space won't be polluted by "from grpc import aio" # Copyright 2019 The gRPC 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/licens...
2fb3a72885d279f7a79e10f00d71991144748f1c
haas/plugins/base_plugin.py
haas/plugins/base_plugin.py
from haas.utils import uncamelcase from .i_plugin import IPlugin class BasePlugin(IPlugin): name = None enabled = False enabling_option = None def __init__(self, name=None): if name is None: name = uncamelcase(type(self).__name__, sep='-') self.name = name self.en...
from haas.utils import uncamelcase from .i_plugin import IPlugin class BasePlugin(IPlugin): name = None enabled = False enabling_option = None def __init__(self, name=None): if name is None: name = uncamelcase(type(self).__name__, sep='-') self.name = name self.en...
Add help text for plugin enable option
Add help text for plugin enable option
Python
bsd-3-clause
sjagoe/haas,scalative/haas,sjagoe/haas,itziakos/haas,scalative/haas,itziakos/haas
<INSERT> help='Enable the {0} plugin'.format(self.name), <INSERT_END> <|endoftext|> from haas.utils import uncamelcase from .i_plugin import IPlugin class BasePlugin(IPlugin): name = None enabled = False enabling_option = None def __init__(self, name=None): if nam...
Add help text for plugin enable option from haas.utils import uncamelcase from .i_plugin import IPlugin class BasePlugin(IPlugin): name = None enabled = False enabling_option = None def __init__(self, name=None): if name is None: name = uncamelcase(type(self).__name__, sep='-') ...
70458f45f3419927271f51872252834f08ef13f2
workshopvenues/venues/tests.py
workshopvenues/venues/tests.py
""" This file demonstrates writing tests using the unittest module. These will pass when you run "manage.py test". Replace this with more appropriate tests for your application. """ from django.test import TestCase class SimpleTest(TestCase): def test_basic_addition(self): """ Tests that 1 + 1 a...
""" This file demonstrates writing tests using the unittest module. These will pass when you run "manage.py test". Replace this with more appropriate tests for your application. """ from django.test import TestCase from .models import Address class ModelsTest(TestCase): def test_create_address(self): a ...
Add Address model creation test case
Add Address model creation test case
Python
bsd-3-clause
andreagrandi/workshopvenues
<REPLACE_OLD> TestCase class SimpleTest(TestCase): <REPLACE_NEW> TestCase from .models import Address class ModelsTest(TestCase): <REPLACE_END> <REPLACE_OLD> test_basic_addition(self): <REPLACE_NEW> test_create_address(self): <REPLACE_END> <REPLACE_OLD> """ <REPLACE_NEW> a = Address() <REPLACE_END> <REPLACE_O...
Add Address model creation test case """ This file demonstrates writing tests using the unittest module. These will pass when you run "manage.py test". Replace this with more appropriate tests for your application. """ from django.test import TestCase class SimpleTest(TestCase): def test_basic_addition(self): ...
e8cfb78df42021097e54009c5b724c1d176822bc
sale_analytic_cost/__openerp__.py
sale_analytic_cost/__openerp__.py
# -*- coding: utf-8 -*- # (c) 2015 Ainara Galdona - AvanzOSC # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html { 'name': 'Sale Analytic Cost', "version": "8.0.1.0.0", "license": 'AGPL-3', "author": 'AvanzOSC,' 'Serv. Tecnol. Avanzados - Pedro M. Baeza', 'website': "http...
# -*- coding: utf-8 -*- # (c) 2015 Ainara Galdona - AvanzOSC # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html { 'name': 'Sale Analytic Cost', "version": "8.0.1.0.0", "license": 'AGPL-3', "author": 'AvanzOSC,' 'Serv. Tecnol. Avanzados - Pedro M. Baeza', 'website': "http...
Change dependency with "mrp_production_project_estimated_cost" by dependecy "mrp_production_estimated_cost".
[FIX] sale_analytic_cost: Change dependency with "mrp_production_project_estimated_cost" by dependecy "mrp_production_estimated_cost".
Python
agpl-3.0
Daniel-CA/odoo-addons,alfredoavanzosc/odoo-addons,mikelarre/hr-addons,Daniel-CA/odoo-addons,esthermm/odoo-addons,agaldona/odoo-addons,alfredoavanzosc/odoo-addons,esthermm/odoo-addons,agaldona/odoo-addons,agaldona/odoo-addons,esthermm/odoo-addons,Daniel-CA/odoo-addons
<REPLACE_OLD> 'mrp_production_project_estimated_cost'], <REPLACE_NEW> 'mrp_production_estimated_cost'], <REPLACE_END> <|endoftext|> # -*- coding: utf-8 -*- # (c) 2015 Ainara Galdona - AvanzOSC # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html { 'name': 'Sale Analytic Cost', "version": "8.0.1.0...
[FIX] sale_analytic_cost: Change dependency with "mrp_production_project_estimated_cost" by dependecy "mrp_production_estimated_cost". # -*- coding: utf-8 -*- # (c) 2015 Ainara Galdona - AvanzOSC # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html { 'name': 'Sale Analytic Cost', "version": "8.0.1...
e733b0d5192437a95c4eafd1babc02385fb4fcf7
cms/sitemaps/cms_sitemap.py
cms/sitemaps/cms_sitemap.py
# -*- coding: utf-8 -*- from django.contrib.sitemaps import Sitemap from django.utils import translation from cms.models import Title def from_iterable(iterables): """ Backport of itertools.chain.from_iterable """ for it in iterables: for element in it: yield element class CMSSit...
# -*- coding: utf-8 -*- from django.contrib.sitemaps import Sitemap from django.db.models import Q from django.utils import translation from cms.models import Title def from_iterable(iterables): """ Backport of itertools.chain.from_iterable """ for it in iterables: for element in it: ...
Remove redirected pages from the sitemap
Remove redirected pages from the sitemap
Python
bsd-3-clause
ScholzVolkmer/django-cms,wyg3958/django-cms,donce/django-cms,robmagee/django-cms,DylannCordel/django-cms,frnhr/django-cms,jrief/django-cms,wuzhihui1123/django-cms,Livefyre/django-cms,dhorelik/django-cms,netzkolchose/django-cms,intip/django-cms,chkir/django-cms,jproffitt/django-cms,selecsosi/django-cms,czpython/django-c...
<REPLACE_OLD> -*- from <REPLACE_NEW> -*- from <REPLACE_END> <INSERT> django.db.models import Q from <INSERT_END> <REPLACE_OLD> translation from <REPLACE_NEW> translation from <REPLACE_END> <INSERT> # # It is counter-productive to provide entries for: # > Pages which redirect: # - If th...
Remove redirected pages from the sitemap # -*- coding: utf-8 -*- from django.contrib.sitemaps import Sitemap from django.utils import translation from cms.models import Title def from_iterable(iterables): """ Backport of itertools.chain.from_iterable """ for it in iterables: for element in it...
e7a771011e93660c811effb8357df035bae8f9a6
pentai/gui/settings_screen.py
pentai/gui/settings_screen.py
from kivy.uix.screenmanager import Screen #from kivy.properties import * from kivy.uix.settings import SettingSpacer from my_setting import * import audio as a_m class SettingsScreen(Screen): def __init__(self, *args, **kwargs): super(SettingsScreen, self).__init__(*args, **kwargs) def adjust_volumes...
from kivy.uix.screenmanager import Screen #from kivy.properties import * from kivy.uix.settings import SettingSpacer from my_setting import * import audio as a_m from kivy.uix.widget import Widget class HSpacer(Widget): pass class VSpacer(Widget): pass class SettingsScreen(Screen): def __init__(self, *...
Use our own spacer widgets
Use our own spacer widgets
Python
mit
cropleyb/pentai,cropleyb/pentai,cropleyb/pentai
<REPLACE_OLD> a_m class <REPLACE_NEW> a_m from kivy.uix.widget import Widget class HSpacer(Widget): pass class VSpacer(Widget): pass class <REPLACE_END> <|endoftext|> from kivy.uix.screenmanager import Screen #from kivy.properties import * from kivy.uix.settings import SettingSpacer from my_setting import...
Use our own spacer widgets from kivy.uix.screenmanager import Screen #from kivy.properties import * from kivy.uix.settings import SettingSpacer from my_setting import * import audio as a_m class SettingsScreen(Screen): def __init__(self, *args, **kwargs): super(SettingsScreen, self).__init__(*args, **kwa...
3220b356297ec5fe61888a906543d0ee993f9f31
website/tests/test_database.py
website/tests/test_database.py
import database def test_encode_csv(): attributes = ( # strand, ref, alt, cdna_pos, exon, protein_id, is_ptm '+', 'R', 'H', 204, 'exon1', 123, False ) result = database.encode_csv(*attributes) assert result == '+RH0cc:exon1:7b' def test_decode_csv(): encoded_csv = '+RH0cc:exon1:7...
import database def test_encode_csv(): test_data = ( # strand, ref, alt, cdna_pos, exon, protein_id, is_ptm (('+', 'R', 'H', 204, 'exon1', 123, False), '+RH0cc:exon1:7b'), (('-', 'R', 'H', 204, 'exon1', 123, True), '-RH1cc:exon1:7b'), ) for attributes, correct_result in test_data: ...
Add more tests to database
Add more tests to database
Python
lgpl-2.1
reimandlab/Visualistion-Framework-for-Genome-Mutations,reimandlab/Visualisation-Framework-for-Genome-Mutations,reimandlab/Visualisation-Framework-for-Genome-Mutations,reimandlab/Visualisation-Framework-for-Genome-Mutations,reimandlab/ActiveDriverDB,reimandlab/Visualisation-Framework-for-Genome-Mutations,reimandlab/Visu...
<REPLACE_OLD> attributes <REPLACE_NEW> test_data <REPLACE_END> <REPLACE_OLD> '+', <REPLACE_NEW> (('+', <REPLACE_END> <REPLACE_OLD> False <REPLACE_NEW> False), '+RH0cc:exon1:7b'), (('-', 'R', 'H', 204, 'exon1', 123, True), '-RH1cc:exon1:7b'), <REPLACE_END> <INSERT> for attributes, correct_result in test_dat...
Add more tests to database import database def test_encode_csv(): attributes = ( # strand, ref, alt, cdna_pos, exon, protein_id, is_ptm '+', 'R', 'H', 204, 'exon1', 123, False ) result = database.encode_csv(*attributes) assert result == '+RH0cc:exon1:7b' def test_decode_csv(): e...
6fa13c56c38b14226d1902f8d686241ed88b875a
satnogsclient/scheduler/tasks.py
satnogsclient/scheduler/tasks.py
# -*- coding: utf-8 -*- from urlparse import urljoin import requests from dateutil import parser from satnogsclient import settings from satnogsclient.scheduler import scheduler def spawn_observation(*args, **kwargs): raise NotImplementedError def get_jobs(): """Query SatNOGS Network API to GET jobs.""" ...
# -*- coding: utf-8 -*- from urlparse import urljoin import requests from dateutil import parser from satnogsclient import settings from satnogsclient.observer import Observer from satnogsclient.scheduler import scheduler def spawn_observation(*args, **kwargs): obj = kwargs.pop('obj') observer = Observer()...
Initialize and call observer on new observation task.
Initialize and call observer on new observation task.
Python
agpl-3.0
adamkalis/satnogs-client,cshields/satnogs-client,cshields/satnogs-client,adamkalis/satnogs-client
<INSERT> satnogsclient.observer import Observer from <INSERT_END> <REPLACE_OLD> raise NotImplementedError def <REPLACE_NEW> obj = kwargs.pop('obj') observer = Observer() tle = { 'tle0': obj['tle0'], 'tle1': obj['tle1'], 'tle2': obj['tle2'] } end = parser.parse(obj['end']) o...
Initialize and call observer on new observation task. # -*- coding: utf-8 -*- from urlparse import urljoin import requests from dateutil import parser from satnogsclient import settings from satnogsclient.scheduler import scheduler def spawn_observation(*args, **kwargs): raise NotImplementedError def get_jo...
31d2686555a93ddadd3713c3c880b75641d98d89
scripts/read_reldist.py
scripts/read_reldist.py
import os import yaml from thermof.parameters import plot_parameters from thermof.read import read_framework_distance # -------------------------------------------------------------------------------------------------- main = '' results_file = '%s-reldist-results.yaml' % os.path.basename(main) run_list_file = '%s-run-...
Add script for reading reldist for multiple trials
Add script for reading reldist for multiple trials
Python
mit
kbsezginel/tee_mof,kbsezginel/tee_mof
<INSERT> import os import yaml from thermof.parameters import plot_parameters from thermof.read import read_framework_distance # -------------------------------------------------------------------------------------------------- main = '' results_file = '%s-reldist-results.yaml' % os.path.basename(main) run_list_file =...
Add script for reading reldist for multiple trials
43c3a8a94c7783aadb440e529645f7db7c7913ff
successstories/forms.py
successstories/forms.py
from django import forms from .models import Story from cms.forms import ContentManageableModelForm class StoryForm(ContentManageableModelForm): class Meta: model = Story fields = ( 'name', 'company_name', 'company_url', 'category', 'aut...
from django import forms from .models import Story from cms.forms import ContentManageableModelForm class StoryForm(ContentManageableModelForm): pull_quote = forms.CharField(widget=forms.Textarea(attrs={'rows': 5})) class Meta: model = Story fields = ( 'name', 'compan...
Reduce textarea height in Story form
Reduce textarea height in Story form
Python
apache-2.0
proevo/pythondotorg,manhhomienbienthuy/pythondotorg,manhhomienbienthuy/pythondotorg,Mariatta/pythondotorg,python/pythondotorg,python/pythondotorg,Mariatta/pythondotorg,manhhomienbienthuy/pythondotorg,proevo/pythondotorg,Mariatta/pythondotorg,python/pythondotorg,manhhomienbienthuy/pythondotorg,python/pythondotorg,Mariat...
<INSERT> pull_quote = forms.CharField(widget=forms.Textarea(attrs={'rows': 5})) <INSERT_END> <|endoftext|> from django import forms from .models import Story from cms.forms import ContentManageableModelForm class StoryForm(ContentManageableModelForm): pull_quote = forms.CharField(widget=forms.Textarea(attrs...
Reduce textarea height in Story form from django import forms from .models import Story from cms.forms import ContentManageableModelForm class StoryForm(ContentManageableModelForm): class Meta: model = Story fields = ( 'name', 'company_name', 'company_url', ...
5012ff1dfbcd8e7d0d9b0691f45c7b3efd811a08
adventure/__init__.py
adventure/__init__.py
"""The Adventure game.""" def load_advent_dat(data): import os from .data import parse datapath = os.path.join(os.path.dirname(__file__), 'advent.dat') with open(datapath, 'r', encoding='ascii') as datafile: parse(data, datafile) def play(seed=None): """Turn the Python prompt into an Adve...
"""The Adventure game.""" def load_advent_dat(data): import os from .data import parse datapath = os.path.join(os.path.dirname(__file__), 'advent.dat') with open(datapath, 'r', encoding='ascii') as datafile: parse(data, datafile) def play(seed=None): """Turn the Python prompt into an Adve...
Remove outdated parameter from docstring
Remove outdated parameter from docstring
Python
apache-2.0
devinmcgloin/advent,devinmcgloin/advent
<INSERT> optional the <INSERT_END> <INSERT> argument <INSERT_END> <REPLACE_OLD> integer <REPLACE_NEW> integer <REPLACE_END> <REPLACE_OLD> random <REPLACE_NEW> Python random <REPLACE_END> <REPLACE_OLD> state. When `quiet` is true, no output is printed as the game is played; the caller of a command has to ...
Remove outdated parameter from docstring """The Adventure game.""" def load_advent_dat(data): import os from .data import parse datapath = os.path.join(os.path.dirname(__file__), 'advent.dat') with open(datapath, 'r', encoding='ascii') as datafile: parse(data, datafile) def play(seed=None): ...