prompt
large_stringlengths
72
9.34k
completion
large_stringlengths
0
7.61k
<|file_name|>subscription_manifest.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python # -*- coding: utf-8 -*- # (c) 2017, Andrew Kofink <ajkofink@gmail.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software ...
module.resource_action('subscriptions', 'delete_manifest', scope)
<|file_name|>subscription_manifest.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python # -*- coding: utf-8 -*- # (c) 2017, Andrew Kofink <ajkofink@gmail.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software ...
if existing_manifest: module.resource_action('subscriptions', 'refresh_manifest', scope) else: module.fail_json(msg="No manifest found to refresh.")
<|file_name|>subscription_manifest.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python # -*- coding: utf-8 -*- # (c) 2017, Andrew Kofink <ajkofink@gmail.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software ...
module.resource_action('subscriptions', 'refresh_manifest', scope)
<|file_name|>subscription_manifest.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python # -*- coding: utf-8 -*- # (c) 2017, Andrew Kofink <ajkofink@gmail.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software ...
module.fail_json(msg="No manifest found to refresh.")
<|file_name|>subscription_manifest.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python # -*- coding: utf-8 -*- # (c) 2017, Andrew Kofink <ajkofink@gmail.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software ...
main()
<|file_name|>subscription_manifest.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python # -*- coding: utf-8 -*- # (c) 2017, Andrew Kofink <ajkofink@gmail.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software ...
main
<|file_name|>server.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ """ from datetime import datetime, timedelta import os from flask import request from flask import Flask import pytz import db from utils import get_remote_addr, get_location_data<|fim▁hole|> app = Flask(__name__) @app.route('/yo-wate...
<|file_name|>server.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ """ from datetime import datetime, timedelta import os from flask import request from flask import Flask import pytz import db from utils import get_remote_addr, get_location_data app = Flask(__name__) @app.route('/yo-water/', metho...
payload = request.args if request.args else request.get_json(force=True) username = payload.get('username') reminder = db.reminders.find_one({'username': username}) reply_object = payload.get('reply') if reply_object is None: if db.reminders.find_one({'username': username}) is None: ...
<|file_name|>server.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ """ from datetime import datetime, timedelta import os from flask import request from flask import Flask import pytz import db from utils import get_remote_addr, get_location_data app = Flask(__name__) @app.route('/yo-water/', metho...
if db.reminders.find_one({'username': username}) is None: address = get_remote_addr(request) data = get_location_data(address) if not data: return 'Timezone needed' user_data = {'created': datetime.now(pytz.utc), 'usernam...
<|file_name|>server.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ """ from datetime import datetime, timedelta import os from flask import request from flask import Flask import pytz import db from utils import get_remote_addr, get_location_data app = Flask(__name__) @app.route('/yo-water/', metho...
address = get_remote_addr(request) data = get_location_data(address) if not data: return 'Timezone needed' user_data = {'created': datetime.now(pytz.utc), 'username': username} if data.get('time_zone'): ...
<|file_name|>server.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ """ from datetime import datetime, timedelta import os from flask import request from flask import Flask import pytz import db from utils import get_remote_addr, get_location_data app = Flask(__name__) @app.route('/yo-water/', metho...
return 'Timezone needed'
<|file_name|>server.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ """ from datetime import datetime, timedelta import os from flask import request from flask import Flask import pytz import db from utils import get_remote_addr, get_location_data app = Flask(__name__) @app.route('/yo-water/', metho...
user_data.update({'timezone': data.get('time_zone')})
<|file_name|>server.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ """ from datetime import datetime, timedelta import os from flask import request from flask import Flask import pytz import db from utils import get_remote_addr, get_location_data app = Flask(__name__) @app.route('/yo-water/', metho...
reply_text = reply_object.get('text') if reply_text == u'Can\'t right now 😖': reminder['trigger_date'] = datetime.now(pytz.utc) + timedelta(minutes=15) else: reminder['step'] += 1 reminder['trigger_date'] = datetime.now(pytz.utc) + timedelta(minutes=60) ...
<|file_name|>server.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ """ from datetime import datetime, timedelta import os from flask import request from flask import Flask import pytz import db from utils import get_remote_addr, get_location_data app = Flask(__name__) @app.route('/yo-water/', metho...
inder['trigger_date'] = datetime.now(pytz.utc) + timedelta(minutes=15)
<|file_name|>server.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ """ from datetime import datetime, timedelta import os from flask import request from flask import Flask import pytz import db from utils import get_remote_addr, get_location_data app = Flask(__name__) @app.route('/yo-water/', metho...
inder['step'] += 1 reminder['trigger_date'] = datetime.now(pytz.utc) + timedelta(minutes=60)
<|file_name|>server.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ """ from datetime import datetime, timedelta import os from flask import request from flask import Flask import pytz import db from utils import get_remote_addr, get_location_data app = Flask(__name__) @app.route('/yo-water/', metho...
.debug = True app.run(host="0.0.0.0", port=int(os.environ.get("PORT", "5000")))
<|file_name|>server.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ """ from datetime import datetime, timedelta import os from flask import request from flask import Flask import pytz import db from utils import get_remote_addr, get_location_data app = Flask(__name__) @app.route('/yo-water/', metho...
yowater
<|file_name|>discover.py<|end_file_name|><|fim▁begin|><|fim▁hole|> import soco """ Prints the name of each discovered player in the network. """ for zone in soco.discover(): print(zone.player_name)<|fim▁end|>
from __future__ import print_function
<|file_name|>Todo.py<|end_file_name|><|fim▁begin|># Topydo - A todo.txt client written in Python. # Copyright (C) 2014 - 2015 Bram Schoenmakers <bram@topydo.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Sof...
<|file_name|>Todo.py<|end_file_name|><|fim▁begin|># Topydo - A todo.txt client written in Python. # Copyright (C) 2014 - 2015 Bram Schoenmakers <bram@topydo.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Sof...
""" This class adds common functionality with respect to dates to the Todo base class, mainly by interpreting the start and due dates of task. """ def __init__(self, p_str): TodoBase.__init__(self, p_str) self.attributes = {} def get_date(self, p_tag): """ Given a date ...
<|file_name|>Todo.py<|end_file_name|><|fim▁begin|># Topydo - A todo.txt client written in Python. # Copyright (C) 2014 - 2015 Bram Schoenmakers <bram@topydo.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Sof...
TodoBase.__init__(self, p_str) self.attributes = {}
<|file_name|>Todo.py<|end_file_name|><|fim▁begin|># Topydo - A todo.txt client written in Python. # Copyright (C) 2014 - 2015 Bram Schoenmakers <bram@topydo.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Sof...
""" Given a date tag, return a date object. """ string = self.tag_value(p_tag) result = None try: result = date_string_to_date(string) if string else None except ValueError: pass return result
<|file_name|>Todo.py<|end_file_name|><|fim▁begin|># Topydo - A todo.txt client written in Python. # Copyright (C) 2014 - 2015 Bram Schoenmakers <bram@topydo.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Sof...
""" Returns a date object of the todo's start date. """ return self.get_date(config().tag_start())
<|file_name|>Todo.py<|end_file_name|><|fim▁begin|># Topydo - A todo.txt client written in Python. # Copyright (C) 2014 - 2015 Bram Schoenmakers <bram@topydo.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Sof...
""" Returns a date object of the todo's due date. """ return self.get_date(config().tag_due())
<|file_name|>Todo.py<|end_file_name|><|fim▁begin|># Topydo - A todo.txt client written in Python. # Copyright (C) 2014 - 2015 Bram Schoenmakers <bram@topydo.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Sof...
""" Returns True when the start date is today or in the past and the task has not yet been completed. """ start = self.start_date() return not self.is_completed() and (not start or start <= date.today())
<|file_name|>Todo.py<|end_file_name|><|fim▁begin|># Topydo - A todo.txt client written in Python. # Copyright (C) 2014 - 2015 Bram Schoenmakers <bram@topydo.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Sof...
""" Returns True when the due date is in the past and the task has not yet been completed. """ return not self.is_completed() and self.days_till_due() < 0
<|file_name|>Todo.py<|end_file_name|><|fim▁begin|># Topydo - A todo.txt client written in Python. # Copyright (C) 2014 - 2015 Bram Schoenmakers <bram@topydo.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Sof...
""" Returns the number of days till the due date. Returns a negative number of days when the due date is in the past. Returns 0 when the task has no due date. """ due = self.due_date() if due: diff = due - date.today() return diff.days ...
<|file_name|>Todo.py<|end_file_name|><|fim▁begin|># Topydo - A todo.txt client written in Python. # Copyright (C) 2014 - 2015 Bram Schoenmakers <bram@topydo.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Sof...
""" Returns the length (in days) of the task, by considering the start date and the due date. When there is no start date, its creation date is used. Returns 0 when one of these dates is missing. """ start = self.start_date() or self.creation_date() due = self.due...
<|file_name|>Todo.py<|end_file_name|><|fim▁begin|># Topydo - A todo.txt client written in Python. # Copyright (C) 2014 - 2015 Bram Schoenmakers <bram@topydo.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Sof...
diff = due - date.today() return diff.days
<|file_name|>Todo.py<|end_file_name|><|fim▁begin|># Topydo - A todo.txt client written in Python. # Copyright (C) 2014 - 2015 Bram Schoenmakers <bram@topydo.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Sof...
diff = due - start return diff.days
<|file_name|>Todo.py<|end_file_name|><|fim▁begin|># Topydo - A todo.txt client written in Python. # Copyright (C) 2014 - 2015 Bram Schoenmakers <bram@topydo.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Sof...
return 0
<|file_name|>Todo.py<|end_file_name|><|fim▁begin|># Topydo - A todo.txt client written in Python. # Copyright (C) 2014 - 2015 Bram Schoenmakers <bram@topydo.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Sof...
__init__
<|file_name|>Todo.py<|end_file_name|><|fim▁begin|># Topydo - A todo.txt client written in Python. # Copyright (C) 2014 - 2015 Bram Schoenmakers <bram@topydo.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Sof...
get_date
<|file_name|>Todo.py<|end_file_name|><|fim▁begin|># Topydo - A todo.txt client written in Python. # Copyright (C) 2014 - 2015 Bram Schoenmakers <bram@topydo.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Sof...
start_date
<|file_name|>Todo.py<|end_file_name|><|fim▁begin|># Topydo - A todo.txt client written in Python. # Copyright (C) 2014 - 2015 Bram Schoenmakers <bram@topydo.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Sof...
due_date
<|file_name|>Todo.py<|end_file_name|><|fim▁begin|># Topydo - A todo.txt client written in Python. # Copyright (C) 2014 - 2015 Bram Schoenmakers <bram@topydo.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Sof...
is_active
<|file_name|>Todo.py<|end_file_name|><|fim▁begin|># Topydo - A todo.txt client written in Python. # Copyright (C) 2014 - 2015 Bram Schoenmakers <bram@topydo.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Sof...
is_overdue
<|file_name|>Todo.py<|end_file_name|><|fim▁begin|># Topydo - A todo.txt client written in Python. # Copyright (C) 2014 - 2015 Bram Schoenmakers <bram@topydo.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Sof...
days_till_due
<|file_name|>Todo.py<|end_file_name|><|fim▁begin|># Topydo - A todo.txt client written in Python. # Copyright (C) 2014 - 2015 Bram Schoenmakers <bram@topydo.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Sof...
length
<|file_name|>ch4_ex4.1.4.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # # Created by Samvel Khalatyan on Mar 23, 2014 # Copyright (c) 2014 Samvel Khalatyan. All rights reserved # # Use of this source code is governed by a license that can be found in # the LICENSE file. import random import unittest from lib...
if "__main__" == __name__:
<|file_name|>ch4_ex4.1.4.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # # Created by Samvel Khalatyan on Mar 23, 2014 # Copyright (c) 2014 Samvel Khalatyan. All rights reserved # # Use of this source code is governed by a license that can be found in # the LICENSE file. import random import unittest from lib...
def has_edge(self, left_vertex, right_vertex): if left_vertex == right_vertex: return True else: return right_vertex in self._vertices[left_vertex]
<|file_name|>ch4_ex4.1.4.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # # Created by Samvel Khalatyan on Mar 23, 2014 # Copyright (c) 2014 Samvel Khalatyan. All rights reserved # # Use of this source code is governed by a license that can be found in # the LICENSE file. import random import unittest from lib...
if left_vertex == right_vertex: return True else: return right_vertex in self._vertices[left_vertex]
<|file_name|>ch4_ex4.1.4.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # # Created by Samvel Khalatyan on Mar 23, 2014 # Copyright (c) 2014 Samvel Khalatyan. All rights reserved # # Use of this source code is governed by a license that can be found in # the LICENSE file. import random import unittest from lib...
def setUp(self): self.graph = UnigraphExtra(random.randrange(10, 15)) for edge in range(2 * self.graph.vertices()): f, t = (random.randrange(self.graph.vertices()) for x in range(2)) self.graph.add_edge(f, t) def test_edge(self): for vertex in range(self.graph.ve...
<|file_name|>ch4_ex4.1.4.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # # Created by Samvel Khalatyan on Mar 23, 2014 # Copyright (c) 2014 Samvel Khalatyan. All rights reserved # # Use of this source code is governed by a license that can be found in # the LICENSE file. import random import unittest from lib...
self.graph = UnigraphExtra(random.randrange(10, 15)) for edge in range(2 * self.graph.vertices()): f, t = (random.randrange(self.graph.vertices()) for x in range(2)) self.graph.add_edge(f, t)
<|file_name|>ch4_ex4.1.4.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # # Created by Samvel Khalatyan on Mar 23, 2014 # Copyright (c) 2014 Samvel Khalatyan. All rights reserved # # Use of this source code is governed by a license that can be found in # the LICENSE file. import random import unittest from lib...
for vertex in range(self.graph.vertices()): existing_vertices = set(self.graph._vertices[vertex]) all_vertices = set(range(self.graph.vertices())) missing_vertices = all_vertices - all_vertices for adj_vertex in existing_vertices: self.assertTrue(...
<|file_name|>ch4_ex4.1.4.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # # Created by Samvel Khalatyan on Mar 23, 2014 # Copyright (c) 2014 Samvel Khalatyan. All rights reserved # # Use of this source code is governed by a license that can be found in # the LICENSE file. import random import unittest from lib...
for vertex in range(self.graph.vertices()): self.assertTrue(self.graph.has_edge(vertex, vertex))
<|file_name|>ch4_ex4.1.4.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # # Created by Samvel Khalatyan on Mar 23, 2014 # Copyright (c) 2014 Samvel Khalatyan. All rights reserved # # Use of this source code is governed by a license that can be found in # the LICENSE file. import random import unittest from lib...
return True
<|file_name|>ch4_ex4.1.4.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # # Created by Samvel Khalatyan on Mar 23, 2014 # Copyright (c) 2014 Samvel Khalatyan. All rights reserved # # Use of this source code is governed by a license that can be found in # the LICENSE file. import random import unittest from lib...
return right_vertex in self._vertices[left_vertex]
<|file_name|>ch4_ex4.1.4.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # # Created by Samvel Khalatyan on Mar 23, 2014 # Copyright (c) 2014 Samvel Khalatyan. All rights reserved # # Use of this source code is governed by a license that can be found in # the LICENSE file. import random import unittest from lib...
unittest.main()
<|file_name|>ch4_ex4.1.4.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # # Created by Samvel Khalatyan on Mar 23, 2014 # Copyright (c) 2014 Samvel Khalatyan. All rights reserved # # Use of this source code is governed by a license that can be found in # the LICENSE file. import random import unittest from lib...
has_edge
<|file_name|>ch4_ex4.1.4.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # # Created by Samvel Khalatyan on Mar 23, 2014 # Copyright (c) 2014 Samvel Khalatyan. All rights reserved # # Use of this source code is governed by a license that can be found in # the LICENSE file. import random import unittest from lib...
setUp
<|file_name|>ch4_ex4.1.4.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # # Created by Samvel Khalatyan on Mar 23, 2014 # Copyright (c) 2014 Samvel Khalatyan. All rights reserved # # Use of this source code is governed by a license that can be found in # the LICENSE file. import random import unittest from lib...
test_edge
<|file_name|>ch4_ex4.1.4.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # # Created by Samvel Khalatyan on Mar 23, 2014 # Copyright (c) 2014 Samvel Khalatyan. All rights reserved # # Use of this source code is governed by a license that can be found in # the LICENSE file. import random import unittest from lib...
test_self_loop
<|file_name|>cleanup_addon_premium.py<|end_file_name|><|fim▁begin|><|fim▁hole|>from django.core.management.base import BaseCommand import amo from mkt.webapps.models import AddonPremium class Command(BaseCommand): help = 'Clean up existing AddonPremium objects for free apps.' def handle(self, *args, **optio...
<|file_name|>cleanup_addon_premium.py<|end_file_name|><|fim▁begin|>from django.core.management.base import BaseCommand import amo from mkt.webapps.models import AddonPremium class Command(BaseCommand): <|fim_middle|> <|fim▁end|>
help = 'Clean up existing AddonPremium objects for free apps.' def handle(self, *args, **options): (AddonPremium.objects.filter(addon__premium_type__in=amo.ADDON_FREES) .delete())
<|file_name|>cleanup_addon_premium.py<|end_file_name|><|fim▁begin|>from django.core.management.base import BaseCommand import amo from mkt.webapps.models import AddonPremium class Command(BaseCommand): help = 'Clean up existing AddonPremium objects for free apps.' def handle(self, *args, **options): ...
(AddonPremium.objects.filter(addon__premium_type__in=amo.ADDON_FREES) .delete())
<|file_name|>cleanup_addon_premium.py<|end_file_name|><|fim▁begin|>from django.core.management.base import BaseCommand import amo from mkt.webapps.models import AddonPremium class Command(BaseCommand): help = 'Clean up existing AddonPremium objects for free apps.' def <|fim_middle|>(self, *args, **options):...
handle
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>""" rohmu Copyright (c) 2016 Ohmu Ltd See LICENSE for details """ from . errors import InvalidConfigurationError <|fim▁hole|> def get_class_for_transfer(storage_type): if storage_type == "azure": from .object_storage.azure import AzureTransfer r...
IO_BLOCK_SIZE = 2 ** 20 # 1 MiB
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>""" rohmu Copyright (c) 2016 Ohmu Ltd See LICENSE for details """ from . errors import InvalidConfigurationError IO_BLOCK_SIZE = 2 ** 20 # 1 MiB def get_class_for_transfer(storage_type): <|fim_middle|> def get_transfer(storage_config, *, storage_type=No...
if storage_type == "azure": from .object_storage.azure import AzureTransfer return AzureTransfer elif storage_type == "google": from .object_storage.google import GoogleTransfer return GoogleTransfer elif storage_type == "local": from .object_storage.local import Loca...
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>""" rohmu Copyright (c) 2016 Ohmu Ltd See LICENSE for details """ from . errors import InvalidConfigurationError IO_BLOCK_SIZE = 2 ** 20 # 1 MiB def get_class_for_transfer(storage_type): if storage_type == "azure": from .object_storage.azure import...
if "storage_type" in storage_config: storage_config = storage_config.copy() storage_type = storage_config.pop("storage_type") storage_class = get_class_for_transfer(storage_type) return storage_class(**storage_config)
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>""" rohmu Copyright (c) 2016 Ohmu Ltd See LICENSE for details """ from . errors import InvalidConfigurationError IO_BLOCK_SIZE = 2 ** 20 # 1 MiB def get_class_for_transfer(storage_type): if storage_type == "azure": <|fim_middle|> elif ...
from .object_storage.azure import AzureTransfer return AzureTransfer
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>""" rohmu Copyright (c) 2016 Ohmu Ltd See LICENSE for details """ from . errors import InvalidConfigurationError IO_BLOCK_SIZE = 2 ** 20 # 1 MiB def get_class_for_transfer(storage_type): if storage_type == "azure": from .object_storage.azure import...
from .object_storage.google import GoogleTransfer return GoogleTransfer
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>""" rohmu Copyright (c) 2016 Ohmu Ltd See LICENSE for details """ from . errors import InvalidConfigurationError IO_BLOCK_SIZE = 2 ** 20 # 1 MiB def get_class_for_transfer(storage_type): if storage_type == "azure": from .object_storage.azure import...
from .object_storage.local import LocalTransfer return LocalTransfer
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>""" rohmu Copyright (c) 2016 Ohmu Ltd See LICENSE for details """ from . errors import InvalidConfigurationError IO_BLOCK_SIZE = 2 ** 20 # 1 MiB def get_class_for_transfer(storage_type): if storage_type == "azure": from .object_storage.azure import...
from .object_storage.s3 import S3Transfer return S3Transfer
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>""" rohmu Copyright (c) 2016 Ohmu Ltd See LICENSE for details """ from . errors import InvalidConfigurationError IO_BLOCK_SIZE = 2 ** 20 # 1 MiB def get_class_for_transfer(storage_type): if storage_type == "azure": from .object_storage.azure import...
from .object_storage.swift import SwiftTransfer return SwiftTransfer
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>""" rohmu Copyright (c) 2016 Ohmu Ltd See LICENSE for details """ from . errors import InvalidConfigurationError IO_BLOCK_SIZE = 2 ** 20 # 1 MiB def get_class_for_transfer(storage_type): if storage_type == "azure": from .object_storage.azure import...
storage_config = storage_config.copy() storage_type = storage_config.pop("storage_type")
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>""" rohmu Copyright (c) 2016 Ohmu Ltd See LICENSE for details """ from . errors import InvalidConfigurationError IO_BLOCK_SIZE = 2 ** 20 # 1 MiB def <|fim_middle|>(storage_type): if storage_type == "azure": from .object_storage.azure import AzureTr...
get_class_for_transfer
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>""" rohmu Copyright (c) 2016 Ohmu Ltd See LICENSE for details """ from . errors import InvalidConfigurationError IO_BLOCK_SIZE = 2 ** 20 # 1 MiB def get_class_for_transfer(storage_type): if storage_type == "azure": from .object_storage.azure import...
get_transfer
<|file_name|>201511251405_33a1d6f25951_add_timetable_related_tables.py<|end_file_name|><|fim▁begin|>"""Add timetable related tables Revision ID: 33a1d6f25951 Revises: 225d0750c216 Create Date: 2015-11-25 14:05:51.856236 """ import sqlalchemy as sa from alembic import op from indico.core.db.sqlalchemy import PyIntEnu...
sa.CheckConstraint("NOT inherit_location OR (venue_id IS NULL AND room_id IS NULL AND venue_name = '' AND "
<|file_name|>201511251405_33a1d6f25951_add_timetable_related_tables.py<|end_file_name|><|fim▁begin|>"""Add timetable related tables Revision ID: 33a1d6f25951 Revises: 225d0750c216 Create Date: 2015-11-25 14:05:51.856236 """ import sqlalchemy as sa from alembic import op from indico.core.db.sqlalchemy import PyIntEnu...
op.create_table( 'breaks', sa.Column('id', sa.Integer(), nullable=False), sa.Column('title', sa.String(), nullable=False), sa.Column('description', sa.Text(), nullable=False), sa.Column('duration', sa.Interval(), nullable=False), sa.Column('text_color', sa.String(), n...
<|file_name|>201511251405_33a1d6f25951_add_timetable_related_tables.py<|end_file_name|><|fim▁begin|>"""Add timetable related tables Revision ID: 33a1d6f25951 Revises: 225d0750c216 Create Date: 2015-11-25 14:05:51.856236 """ import sqlalchemy as sa from alembic import op from indico.core.db.sqlalchemy import PyIntEnu...
op.drop_table('timetable_entries', schema='events') op.drop_table('breaks', schema='events')
<|file_name|>201511251405_33a1d6f25951_add_timetable_related_tables.py<|end_file_name|><|fim▁begin|>"""Add timetable related tables Revision ID: 33a1d6f25951 Revises: 225d0750c216 Create Date: 2015-11-25 14:05:51.856236 """ import sqlalchemy as sa from alembic import op from indico.core.db.sqlalchemy import PyIntEnu...
upgrade
<|file_name|>201511251405_33a1d6f25951_add_timetable_related_tables.py<|end_file_name|><|fim▁begin|>"""Add timetable related tables Revision ID: 33a1d6f25951 Revises: 225d0750c216 Create Date: 2015-11-25 14:05:51.856236 """ import sqlalchemy as sa from alembic import op from indico.core.db.sqlalchemy import PyIntEnu...
downgrade
<|file_name|>kwarqs_drive_mech.py<|end_file_name|><|fim▁begin|>import wpilib import hal from wpilib import RobotDrive class KwarqsDriveMech(RobotDrive): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.weight_multiplier = 1 def set_multiplier(self, ...
This is designed to be directly driven by joystick axes. :param x: The speed that the robot should drive in the X direction.
<|file_name|>kwarqs_drive_mech.py<|end_file_name|><|fim▁begin|>import wpilib import hal from wpilib import RobotDrive class KwarqsDriveMech(RobotDrive): <|fim_middle|> <|fim▁end|>
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.weight_multiplier = 1 def set_multiplier(self, in_multi = None): if in_multi != None : self.weight_multiplier = in_multi else: self.weight_multiplier = 1 def ...
<|file_name|>kwarqs_drive_mech.py<|end_file_name|><|fim▁begin|>import wpilib import hal from wpilib import RobotDrive class KwarqsDriveMech(RobotDrive): def __init__(self, *args, **kwargs): <|fim_middle|> def set_multiplier(self, in_multi = None): if in_multi != None : ...
super().__init__(*args, **kwargs) self.weight_multiplier = 1
<|file_name|>kwarqs_drive_mech.py<|end_file_name|><|fim▁begin|>import wpilib import hal from wpilib import RobotDrive class KwarqsDriveMech(RobotDrive): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.weight_multiplier = 1 def set_multiplier(self, ...
if in_multi != None : self.weight_multiplier = in_multi else: self.weight_multiplier = 1
<|file_name|>kwarqs_drive_mech.py<|end_file_name|><|fim▁begin|>import wpilib import hal from wpilib import RobotDrive class KwarqsDriveMech(RobotDrive): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.weight_multiplier = 1 def set_multiplier(self, ...
"""Drive method for Mecanum wheeled robots. A method for driving with Mecanum wheeled robots. There are 4 wheels on the robot, arranged so that the front and back wheels are toed in 45 degrees. When looking at the wheels from the top, the roller axles should form an X across th...
<|file_name|>kwarqs_drive_mech.py<|end_file_name|><|fim▁begin|>import wpilib import hal from wpilib import RobotDrive class KwarqsDriveMech(RobotDrive): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.weight_multiplier = 1 def set_multiplier(self, ...
self.weight_multiplier = in_multi
<|file_name|>kwarqs_drive_mech.py<|end_file_name|><|fim▁begin|>import wpilib import hal from wpilib import RobotDrive class KwarqsDriveMech(RobotDrive): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.weight_multiplier = 1 def set_multiplier(self, ...
self.weight_multiplier = 1
<|file_name|>kwarqs_drive_mech.py<|end_file_name|><|fim▁begin|>import wpilib import hal from wpilib import RobotDrive class KwarqsDriveMech(RobotDrive): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.weight_multiplier = 1 def set_multiplier(self, ...
hal.HALReport(hal.HALUsageReporting.kResourceType_RobotDrive, self.getNumMotors(), hal.HALUsageReporting.kRobotDrive_MecanumCartesian) RobotDrive.kMecanumCartesian_Reported = True
<|file_name|>kwarqs_drive_mech.py<|end_file_name|><|fim▁begin|>import wpilib import hal from wpilib import RobotDrive class KwarqsDriveMech(RobotDrive): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.weight_multiplier = 1 def set_multiplier(self, ...
wpilib.CANJaguar.updateSyncGroup(self.syncGroup)
<|file_name|>kwarqs_drive_mech.py<|end_file_name|><|fim▁begin|>import wpilib import hal from wpilib import RobotDrive class KwarqsDriveMech(RobotDrive): def <|fim_middle|>(self, *args, **kwargs): super().__init__(*args, **kwargs) self.weight_multiplier = 1 def set_multiplier(...
__init__
<|file_name|>kwarqs_drive_mech.py<|end_file_name|><|fim▁begin|>import wpilib import hal from wpilib import RobotDrive class KwarqsDriveMech(RobotDrive): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.weight_multiplier = 1 def <|fim_middle|>(self, ...
set_multiplier
<|file_name|>kwarqs_drive_mech.py<|end_file_name|><|fim▁begin|>import wpilib import hal from wpilib import RobotDrive class KwarqsDriveMech(RobotDrive): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.weight_multiplier = 1 def set_multiplier(self, ...
mecanumDrive_Cartesian
<|file_name|>manage.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "bugman.settings") from django.core.management import execute_from_command_line <|fim▁hole|><|fim▁end|>
execute_from_command_line(sys.argv)
<|file_name|>manage.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python import os import sys if __name__ == "__main__": <|fim_middle|> <|fim▁end|>
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "bugman.settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
<|file_name|>PoolTest.py<|end_file_name|><|fim▁begin|>from multiprocessing import Pool import os, time, random def long_time_task(name): print 'Run task %s (%s)...' % (name, os.getpid()) start = time.time() time.sleep(random.random() * 3) end = time.time() print 'Task %s runs %0.2f seconds.' % (n...
p.join() print 'All subprocesses done.'
<|file_name|>PoolTest.py<|end_file_name|><|fim▁begin|>from multiprocessing import Pool import os, time, random def long_time_task(name): <|fim_middle|> if __name__ == '__main__': print 'Parent process %s.' % os.getpid() p = Pool() for i in range(5): p.apply_async(long_time_task, args=(i,)...
print 'Run task %s (%s)...' % (name, os.getpid()) start = time.time() time.sleep(random.random() * 3) end = time.time() print 'Task %s runs %0.2f seconds.' % (name, (end - start))
<|file_name|>PoolTest.py<|end_file_name|><|fim▁begin|>from multiprocessing import Pool import os, time, random def long_time_task(name): print 'Run task %s (%s)...' % (name, os.getpid()) start = time.time() time.sleep(random.random() * 3) end = time.time() print 'Task %s runs %0.2f seconds.' % (n...
print 'Parent process %s.' % os.getpid() p = Pool() for i in range(5): p.apply_async(long_time_task, args=(i,)) print 'Waiting for all subprocesses done...' p.close() p.join() print 'All subprocesses done.' """ 代码解读: 对Pool对象调用join()方法会等待所有子进程执行完毕,调用join()之前必须先调用close(),...
<|file_name|>PoolTest.py<|end_file_name|><|fim▁begin|>from multiprocessing import Pool import os, time, random def <|fim_middle|>(name): print 'Run task %s (%s)...' % (name, os.getpid()) start = time.time() time.sleep(random.random() * 3) end = time.time() print 'Task %s runs %0.2f seconds.' % (n...
long_time_task
<|file_name|>reminders.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- from utils import * commands = [ '^remindme', '^reminder', '^remind$', '^r ' ] parameters = ( ('delay', True), ('message', True), ) description = 'Set a reminder for yourself. First argument is delay...
send_message(reminder['chat_id'], reminder['text']) del reminders[id] save_json('data/reminders.json', reminders)
<|file_name|>reminders.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- from utils import * commands = [ '^remindme', '^reminder', '^remind$', '^r ' ] parameters = ( ('delay', True), ('message', True), ) description = 'Set a reminder for yourself. First argument is delay...
if unit == 's': return float(time) elif unit == 'm': return float(time) * 60 elif unit == 'h': return float(time) * 60 * 60 elif unit == 'd': return float(time) * 60 * 60 * 24
<|file_name|>reminders.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- from utils import * commands = [ '^remindme', '^reminder', '^remind$', '^r ' ] parameters = ( ('delay', True), ('message', True), ) description = 'Set a reminder for yourself. First argument is delay...
input = get_input(msg['text']) if not input: doc = get_doc(commands, parameters, description) return send_message(msg['chat']['id'], doc, parse_mode="Markdown") delay = first_word(input) if delay: time = delay[:-1] unit = delay[-1:] ...
<|file_name|>reminders.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- from utils import * commands = [ '^remindme', '^reminder', '^remind$', '^r ' ] parameters = ( ('delay', True), ('message', True), ) description = 'Set a reminder for yourself. First argument is delay...
reminders = load_json('data/reminders.json', True) for id, reminder in reminders.items(): if now() > reminder['alarm']: send_message(reminder['chat_id'], reminder['text']) del reminders[id] save_json('data/reminders.json', reminders)
<|file_name|>reminders.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- from utils import * commands = [ '^remindme', '^reminder', '^remind$', '^r ' ] parameters = ( ('delay', True), ('message', True), ) description = 'Set a reminder for yourself. First argument is delay...
return float(time)
<|file_name|>reminders.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- from utils import * commands = [ '^remindme', '^reminder', '^remind$', '^r ' ] parameters = ( ('delay', True), ('message', True), ) description = 'Set a reminder for yourself. First argument is delay...
return float(time) * 60
<|file_name|>reminders.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- from utils import * commands = [ '^remindme', '^reminder', '^remind$', '^r ' ] parameters = ( ('delay', True), ('message', True), ) description = 'Set a reminder for yourself. First argument is delay...
return float(time) * 60 * 60
<|file_name|>reminders.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- from utils import * commands = [ '^remindme', '^reminder', '^remind$', '^r ' ] parameters = ( ('delay', True), ('message', True), ) description = 'Set a reminder for yourself. First argument is delay...
return float(time) * 60 * 60 * 24
<|file_name|>reminders.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- from utils import * commands = [ '^remindme', '^reminder', '^remind$', '^r ' ] parameters = ( ('delay', True), ('message', True), ) description = 'Set a reminder for yourself. First argument is delay...
doc = get_doc(commands, parameters, description) return send_message(msg['chat']['id'], doc, parse_mode="Markdown")