prompt
large_stringlengths
72
9.34k
completion
large_stringlengths
0
7.61k
<|file_name|>_mock.py<|end_file_name|><|fim▁begin|>from typing import Dict, List, Optional from ray.tune.suggest.suggestion import Searcher, ConcurrencyLimiter from ray.tune.suggest.search_generator import SearchGenerator from ray.tune.trial import Trial class _MockSearcher(Searcher): def __init__(self, **kwargs...
return self.searcher.live_trials
<|file_name|>_mock.py<|end_file_name|><|fim▁begin|>from typing import Dict, List, Optional from ray.tune.suggest.suggestion import Searcher, ConcurrencyLimiter from ray.tune.suggest.search_generator import SearchGenerator from ray.tune.trial import Trial class _MockSearcher(Searcher): def __init__(self, **kwargs...
return self.searcher.results
<|file_name|>_mock.py<|end_file_name|><|fim▁begin|>from typing import Dict, List, Optional from ray.tune.suggest.suggestion import Searcher, ConcurrencyLimiter from ray.tune.suggest.search_generator import SearchGenerator from ray.tune.trial import Trial class _MockSearcher(Searcher): def __init__(self, **kwargs...
self.live_trials[trial_id] = 1 return {"test_variable": 2}
<|file_name|>_mock.py<|end_file_name|><|fim▁begin|>from typing import Dict, List, Optional from ray.tune.suggest.suggestion import Searcher, ConcurrencyLimiter from ray.tune.suggest.search_generator import SearchGenerator from ray.tune.trial import Trial class _MockSearcher(Searcher): def __init__(self, **kwargs...
self._process_result(result)
<|file_name|>_mock.py<|end_file_name|><|fim▁begin|>from typing import Dict, List, Optional from ray.tune.suggest.suggestion import Searcher, ConcurrencyLimiter from ray.tune.suggest.search_generator import SearchGenerator from ray.tune.trial import Trial class _MockSearcher(Searcher): def __init__(self, **kwargs...
del self.live_trials[trial_id]
<|file_name|>_mock.py<|end_file_name|><|fim▁begin|>from typing import Dict, List, Optional from ray.tune.suggest.suggestion import Searcher, ConcurrencyLimiter from ray.tune.suggest.search_generator import SearchGenerator from ray.tune.trial import Trial class _MockSearcher(Searcher): def __init__(self, **kwargs...
self.searcher = ConcurrencyLimiter( self.searcher, max_concurrent=max_concurrent )
<|file_name|>_mock.py<|end_file_name|><|fim▁begin|>from typing import Dict, List, Optional from ray.tune.suggest.suggestion import Searcher, ConcurrencyLimiter from ray.tune.suggest.search_generator import SearchGenerator from ray.tune.trial import Trial class _MockSearcher(Searcher): def <|fim_middle|>(self, **...
__init__
<|file_name|>_mock.py<|end_file_name|><|fim▁begin|>from typing import Dict, List, Optional from ray.tune.suggest.suggestion import Searcher, ConcurrencyLimiter from ray.tune.suggest.search_generator import SearchGenerator from ray.tune.trial import Trial class _MockSearcher(Searcher): def __init__(self, **kwargs...
suggest
<|file_name|>_mock.py<|end_file_name|><|fim▁begin|>from typing import Dict, List, Optional from ray.tune.suggest.suggestion import Searcher, ConcurrencyLimiter from ray.tune.suggest.search_generator import SearchGenerator from ray.tune.trial import Trial class _MockSearcher(Searcher): def __init__(self, **kwargs...
on_trial_result
<|file_name|>_mock.py<|end_file_name|><|fim▁begin|>from typing import Dict, List, Optional from ray.tune.suggest.suggestion import Searcher, ConcurrencyLimiter from ray.tune.suggest.search_generator import SearchGenerator from ray.tune.trial import Trial class _MockSearcher(Searcher): def __init__(self, **kwargs...
on_trial_complete
<|file_name|>_mock.py<|end_file_name|><|fim▁begin|>from typing import Dict, List, Optional from ray.tune.suggest.suggestion import Searcher, ConcurrencyLimiter from ray.tune.suggest.search_generator import SearchGenerator from ray.tune.trial import Trial class _MockSearcher(Searcher): def __init__(self, **kwargs...
_process_result
<|file_name|>_mock.py<|end_file_name|><|fim▁begin|>from typing import Dict, List, Optional from ray.tune.suggest.suggestion import Searcher, ConcurrencyLimiter from ray.tune.suggest.search_generator import SearchGenerator from ray.tune.trial import Trial class _MockSearcher(Searcher): def __init__(self, **kwargs...
__init__
<|file_name|>_mock.py<|end_file_name|><|fim▁begin|>from typing import Dict, List, Optional from ray.tune.suggest.suggestion import Searcher, ConcurrencyLimiter from ray.tune.suggest.search_generator import SearchGenerator from ray.tune.trial import Trial class _MockSearcher(Searcher): def __init__(self, **kwargs...
live_trials
<|file_name|>_mock.py<|end_file_name|><|fim▁begin|>from typing import Dict, List, Optional from ray.tune.suggest.suggestion import Searcher, ConcurrencyLimiter from ray.tune.suggest.search_generator import SearchGenerator from ray.tune.trial import Trial class _MockSearcher(Searcher): def __init__(self, **kwargs...
results
<|file_name|>test_volumes_actions.py<|end_file_name|><|fim▁begin|># Copyright 2012 OpenStack Foundation # 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 # # ...
self.assertEqual(CONF.volume.disk_format, image_info['disk_format']) @decorators.idempotent_id('92c4ef64-51b2-40c0-9f7e-4749fbaaba33') def test_reserve_unreserve_volume(self):
<|file_name|>test_volumes_actions.py<|end_file_name|><|fim▁begin|># Copyright 2012 OpenStack Foundation # 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 # # ...
"""Test volume actions""" create_default_network = True @classmethod def resource_setup(cls): super(VolumesActionsTest, cls).resource_setup() # Create a test shared volume for attach/detach tests cls.volume = cls.create_volume() @decorators.idempotent_id('fff42874-7db5-44...
<|file_name|>test_volumes_actions.py<|end_file_name|><|fim▁begin|># Copyright 2012 OpenStack Foundation # 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 # # ...
super(VolumesActionsTest, cls).resource_setup() # Create a test shared volume for attach/detach tests cls.volume = cls.create_volume()
<|file_name|>test_volumes_actions.py<|end_file_name|><|fim▁begin|># Copyright 2012 OpenStack Foundation # 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 # # ...
"""Test attaching and detaching volume to instance""" # Create a server server = self.create_server() # Volume is attached and detached successfully from an instance self.volumes_client.attach_volume(self.volume['id'], instance_uuid=serve...
<|file_name|>test_volumes_actions.py<|end_file_name|><|fim▁begin|># Copyright 2012 OpenStack Foundation # 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 # # ...
"""Test setting and retrieving bootable flag of a volume""" for bool_bootable in [True, False]: self.volumes_client.set_bootable_volume(self.volume['id'], bootable=bool_bootable) fetched_volume = self.volumes_client.show_volume(...
<|file_name|>test_volumes_actions.py<|end_file_name|><|fim▁begin|># Copyright 2012 OpenStack Foundation # 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 # # ...
"""Test getting volume attachments Attach a volume to a server, and then retrieve volume's attachments info. """ # Create a server server = self.create_server() # Verify that a volume's attachment information is retrieved self.volumes_client.attach_volume...
<|file_name|>test_volumes_actions.py<|end_file_name|><|fim▁begin|># Copyright 2012 OpenStack Foundation # 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 # # ...
"""Test uploading volume to create an image""" # NOTE(gfidente): the volume uploaded in Glance comes from setUpClass, # it is shared with the other tests. After it is uploaded in Glance, # there is no way to delete it from Cinder, so we delete it from Glance # using the Glance im...
<|file_name|>test_volumes_actions.py<|end_file_name|><|fim▁begin|># Copyright 2012 OpenStack Foundation # 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 # # ...
"""Test reserving and unreserving volume""" # Mark volume as reserved. self.volumes_client.reserve_volume(self.volume['id']) # To get the volume info body = self.volumes_client.show_volume(self.volume['id'])['volume'] self.assertIn('attaching', body['status']) # U...
<|file_name|>test_volumes_actions.py<|end_file_name|><|fim▁begin|># Copyright 2012 OpenStack Foundation # 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 # # ...
"""Test updating and retrieve volume's readonly flag""" for readonly in [True, False]: # Update volume readonly self.volumes_client.update_volume_readonly(self.volume['id'], readonly=readonly) # Get Volume informa...
<|file_name|>test_volumes_actions.py<|end_file_name|><|fim▁begin|># Copyright 2012 OpenStack Foundation # 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 # # ...
resource_setup
<|file_name|>test_volumes_actions.py<|end_file_name|><|fim▁begin|># Copyright 2012 OpenStack Foundation # 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 # # ...
test_attach_detach_volume_to_instance
<|file_name|>test_volumes_actions.py<|end_file_name|><|fim▁begin|># Copyright 2012 OpenStack Foundation # 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 # # ...
test_volume_bootable
<|file_name|>test_volumes_actions.py<|end_file_name|><|fim▁begin|># Copyright 2012 OpenStack Foundation # 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 # # ...
test_get_volume_attachment
<|file_name|>test_volumes_actions.py<|end_file_name|><|fim▁begin|># Copyright 2012 OpenStack Foundation # 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 # # ...
test_volume_upload
<|file_name|>test_volumes_actions.py<|end_file_name|><|fim▁begin|># Copyright 2012 OpenStack Foundation # 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 # # ...
test_reserve_unreserve_volume
<|file_name|>test_volumes_actions.py<|end_file_name|><|fim▁begin|># Copyright 2012 OpenStack Foundation # 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 # # ...
test_volume_readonly_update
<|file_name|>0001_initial.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # Generated by Django 1.9.7 on 2016-07-09 11:32 from __future__ import unicode_literals import django.contrib.postgres.fields.jsonb from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Mi...
], ), migrations.AddField(
<|file_name|>0001_initial.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # Generated by Django 1.9.7 on 2016-07-09 11:32 from __future__ import unicode_literals import django.contrib.postgres.fields.jsonb from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Mi...
initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Company', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('title', models.CharField(max_length=255...
<|file_name|>csdn.py<|end_file_name|><|fim▁begin|># coding: utf-8 from common import base class Plugin(base.BASE): __name__ = 'csdn' __title__ = 'CSDN' __url__ = 'http://www.csdn.net/' def register(self, target): self.information = { 'email': { 'url': 'http://pas...
}
<|file_name|>csdn.py<|end_file_name|><|fim▁begin|># coding: utf-8 from common import base class Plugin(base.BASE): <|fim_middle|> <|fim▁end|>
__name__ = 'csdn' __title__ = 'CSDN' __url__ = 'http://www.csdn.net/' def register(self, target): self.information = { 'email': { 'url': 'http://passport.csdn.net/account/register', 'method': 'get', 'settings': { 'p...
<|file_name|>csdn.py<|end_file_name|><|fim▁begin|># coding: utf-8 from common import base class Plugin(base.BASE): __name__ = 'csdn' __title__ = 'CSDN' __url__ = 'http://www.csdn.net/' def register(self, target): <|fim_middle|> <|fim▁end|>
self.information = { 'email': { 'url': 'http://passport.csdn.net/account/register', 'method': 'get', 'settings': { 'params': { 'action': 'validateEmail', 'email': target ...
<|file_name|>csdn.py<|end_file_name|><|fim▁begin|># coding: utf-8 from common import base class Plugin(base.BASE): __name__ = 'csdn' __title__ = 'CSDN' __url__ = 'http://www.csdn.net/' def <|fim_middle|>(self, target): self.information = { 'email': { 'url': 'http...
register
<|file_name|>olt_los_alarm.py<|end_file_name|><|fim▁begin|># Copyright 2017-present Adtran, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0...
'olt-port-type-name': self._port_type_name}
<|file_name|>olt_los_alarm.py<|end_file_name|><|fim▁begin|># Copyright 2017-present Adtran, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0...
def __init__(self, alarm_mgr, intf_id, port_type_name): super(OltLosAlarm, self).__init__(alarm_mgr, object_type='olt LOS', alarm='OLT_LOS', alarm_category=AlarmEventCategory.OLT, al...
<|file_name|>olt_los_alarm.py<|end_file_name|><|fim▁begin|># Copyright 2017-present Adtran, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0...
super(OltLosAlarm, self).__init__(alarm_mgr, object_type='olt LOS', alarm='OLT_LOS', alarm_category=AlarmEventCategory.OLT, alarm_type=AlarmEventType.COMMUNICATION, ...
<|file_name|>olt_los_alarm.py<|end_file_name|><|fim▁begin|># Copyright 2017-present Adtran, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0...
return {'olt-intf-id:': self._intf_id, 'olt-port-type-name': self._port_type_name}
<|file_name|>olt_los_alarm.py<|end_file_name|><|fim▁begin|># Copyright 2017-present Adtran, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0...
__init__
<|file_name|>olt_los_alarm.py<|end_file_name|><|fim▁begin|># Copyright 2017-present Adtran, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0...
get_context_data
<|file_name|>p2.py<|end_file_name|><|fim▁begin|># Even Fibonacci numbers # Problem 2 # Each new term in the Fibonacci sequence is generated by adding the # previous two terms. By starting with 1 and 2, the first 10 terms will be: # 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... # By considering the terms in the Fibonacci se...
while True: previous, current = current, previous + current
<|file_name|>p2.py<|end_file_name|><|fim▁begin|># Even Fibonacci numbers # Problem 2 # Each new term in the Fibonacci sequence is generated by adding the # previous two terms. By starting with 1 and 2, the first 10 terms will be: # 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... # By considering the terms in the Fibonacci se...
previous, current = 0, 1 while True: previous, current = current, previous + current yield current
<|file_name|>p2.py<|end_file_name|><|fim▁begin|># Even Fibonacci numbers # Problem 2 # Each new term in the Fibonacci sequence is generated by adding the # previous two terms. By starting with 1 and 2, the first 10 terms will be: # 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... # By considering the terms in the Fibonacci se...
sum = 0 for n in fibs(): if n >= bound: break if n % 2 == 0: sum += n return sum
<|file_name|>p2.py<|end_file_name|><|fim▁begin|># Even Fibonacci numbers # Problem 2 # Each new term in the Fibonacci sequence is generated by adding the # previous two terms. By starting with 1 and 2, the first 10 terms will be: # 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... # By considering the terms in the Fibonacci se...
break
<|file_name|>p2.py<|end_file_name|><|fim▁begin|># Even Fibonacci numbers # Problem 2 # Each new term in the Fibonacci sequence is generated by adding the # previous two terms. By starting with 1 and 2, the first 10 terms will be: # 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... # By considering the terms in the Fibonacci se...
sum += n
<|file_name|>p2.py<|end_file_name|><|fim▁begin|># Even Fibonacci numbers # Problem 2 # Each new term in the Fibonacci sequence is generated by adding the # previous two terms. By starting with 1 and 2, the first 10 terms will be: # 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... # By considering the terms in the Fibonacci se...
fibs
<|file_name|>p2.py<|end_file_name|><|fim▁begin|># Even Fibonacci numbers # Problem 2 # Each new term in the Fibonacci sequence is generated by adding the # previous two terms. By starting with 1 and 2, the first 10 terms will be: # 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... # By considering the terms in the Fibonacci se...
problem2
<|file_name|>test_character.py<|end_file_name|><|fim▁begin|>import unittest import pytest from libweasyl import ratings from weasyl.test import db_utils from weasyl import character @pytest.mark.usefixtures('db') class SelectCountTestCase(unittest.TestCase): def setUp(self): self.user1 = db_utils.create...
self.assertEqual( self.count - self.pivot - 1,
<|file_name|>test_character.py<|end_file_name|><|fim▁begin|>import unittest import pytest from libweasyl import ratings from weasyl.test import db_utils from weasyl import character @pytest.mark.usefixtures('db') class SelectCountTestCase(unittest.TestCase): <|fim_middle|> <|fim▁end|>
def setUp(self): self.user1 = db_utils.create_user() self.user2 = db_utils.create_user() self.friend1 = db_utils.create_user() db_utils.create_friendship(self.user1, self.friend1) self.count = 20 self.pivot = 5 s = db_utils.create_characters(self.count, self.u...
<|file_name|>test_character.py<|end_file_name|><|fim▁begin|>import unittest import pytest from libweasyl import ratings from weasyl.test import db_utils from weasyl import character @pytest.mark.usefixtures('db') class SelectCountTestCase(unittest.TestCase): def setUp(self): <|fim_middle|> def tes...
self.user1 = db_utils.create_user() self.user2 = db_utils.create_user() self.friend1 = db_utils.create_user() db_utils.create_friendship(self.user1, self.friend1) self.count = 20 self.pivot = 5 s = db_utils.create_characters(self.count, self.user1, ratings.GENERAL...
<|file_name|>test_character.py<|end_file_name|><|fim▁begin|>import unittest import pytest from libweasyl import ratings from weasyl.test import db_utils from weasyl import character @pytest.mark.usefixtures('db') class SelectCountTestCase(unittest.TestCase): def setUp(self): self.user1 = db_utils.create...
self.assertEqual( self.count - self.pivot - 1, character.select_count(self.user1, ratings.GENERAL.code, backid=self.pivotid))
<|file_name|>test_character.py<|end_file_name|><|fim▁begin|>import unittest import pytest from libweasyl import ratings from weasyl.test import db_utils from weasyl import character @pytest.mark.usefixtures('db') class SelectCountTestCase(unittest.TestCase): def setUp(self): self.user1 = db_utils.create...
self.assertEqual( self.pivot, character.select_count(self.user1, ratings.GENERAL.code, nextid=self.pivotid))
<|file_name|>test_character.py<|end_file_name|><|fim▁begin|>import unittest import pytest from libweasyl import ratings from weasyl.test import db_utils from weasyl import character @pytest.mark.usefixtures('db') class SelectCountTestCase(unittest.TestCase): def setUp(self): self.user1 = db_utils.create...
""" Should be able to see a friend's friends-only character in a listing. """ c = db_utils.create_character(self.friend1, friends_only=True) self.assertEqual( self.count + 1, character.select_count(self.user1, ratings.GENERAL.code)) self.assertEqua...
<|file_name|>test_character.py<|end_file_name|><|fim▁begin|>import unittest import pytest from libweasyl import ratings from weasyl.test import db_utils from weasyl import character @pytest.mark.usefixtures('db') class SelectCountTestCase(unittest.TestCase): def setUp(self): self.user1 = db_utils.create...
""" Should not be able to see a non-friend's friends-ony character in a listing. """ db_utils.create_character(self.user2, friends_only=True) self.assertEqual( self.count, character.select_count(self.user1, ratings.GENERAL.code))
<|file_name|>test_character.py<|end_file_name|><|fim▁begin|>import unittest import pytest from libweasyl import ratings from weasyl.test import db_utils from weasyl import character @pytest.mark.usefixtures('db') class SelectCountTestCase(unittest.TestCase): def setUp(self): self.user1 = db_utils.create...
""" Can see your own character in a listing even with a blocked tag. """ block_tagid = db_utils.create_tag("blocked") db_utils.create_blocktag(self.user1, block_tagid, ratings.GENERAL.code) charid = db_utils.create_character(self.user1, name="My blocktag character") ...
<|file_name|>test_character.py<|end_file_name|><|fim▁begin|>import unittest import pytest from libweasyl import ratings from weasyl.test import db_utils from weasyl import character @pytest.mark.usefixtures('db') class SelectCountTestCase(unittest.TestCase): def setUp(self): self.user1 = db_utils.create...
""" Can see your own character in a listing even when it's above your max rating. """ charid = db_utils.create_character(self.user1, rating=ratings.EXPLICIT.code) db_utils.create_character(self.user2, rating=ratings.EXPLICIT.code) self.assertEqual( charid, ...
<|file_name|>test_character.py<|end_file_name|><|fim▁begin|>import unittest import pytest from libweasyl import ratings from weasyl.test import db_utils from weasyl import character @pytest.mark.usefixtures('db') class SelectCountTestCase(unittest.TestCase): def <|fim_middle|>(self): self.user1 = db_uti...
setUp
<|file_name|>test_character.py<|end_file_name|><|fim▁begin|>import unittest import pytest from libweasyl import ratings from weasyl.test import db_utils from weasyl import character @pytest.mark.usefixtures('db') class SelectCountTestCase(unittest.TestCase): def setUp(self): self.user1 = db_utils.create...
test_count_backid
<|file_name|>test_character.py<|end_file_name|><|fim▁begin|>import unittest import pytest from libweasyl import ratings from weasyl.test import db_utils from weasyl import character @pytest.mark.usefixtures('db') class SelectCountTestCase(unittest.TestCase): def setUp(self): self.user1 = db_utils.create...
test_count_nextid
<|file_name|>test_character.py<|end_file_name|><|fim▁begin|>import unittest import pytest from libweasyl import ratings from weasyl.test import db_utils from weasyl import character @pytest.mark.usefixtures('db') class SelectCountTestCase(unittest.TestCase): def setUp(self): self.user1 = db_utils.create...
test_see_friends_character
<|file_name|>test_character.py<|end_file_name|><|fim▁begin|>import unittest import pytest from libweasyl import ratings from weasyl.test import db_utils from weasyl import character @pytest.mark.usefixtures('db') class SelectCountTestCase(unittest.TestCase): def setUp(self): self.user1 = db_utils.create...
test_cannot_see_non_friends_character
<|file_name|>test_character.py<|end_file_name|><|fim▁begin|>import unittest import pytest from libweasyl import ratings from weasyl.test import db_utils from weasyl import character @pytest.mark.usefixtures('db') class SelectCountTestCase(unittest.TestCase): def setUp(self): self.user1 = db_utils.create...
test_can_see_own_blocktag_character
<|file_name|>test_character.py<|end_file_name|><|fim▁begin|>import unittest import pytest from libweasyl import ratings from weasyl.test import db_utils from weasyl import character @pytest.mark.usefixtures('db') class SelectCountTestCase(unittest.TestCase): def setUp(self): self.user1 = db_utils.create...
test_can_see_own_rating_character
<|file_name|>todo.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: MIT. See LICENSE import frappe import json from frappe.model.document import Document from frappe.utils import get_fullname, parse_addr exclude_from_linked_with = True class ToDo(Documen...
"""Returns list of owners after applying filters on todo's. """ rows = frappe.get_all(cls.DocType, filters=filters or {}, fields=['allocated_to'])
<|file_name|>todo.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: MIT. See LICENSE import frappe import json from frappe.model.document import Document from frappe.utils import get_fullname, parse_addr exclude_from_linked_with = True class ToDo(Documen...
DocType = 'ToDo' def validate(self): self._assignment = None if self.is_new(): if self.assigned_by == self.allocated_to: assignment_message = frappe._("{0} self assigned this task: {1}").format(get_fullname(self.assigned_by), self.description) else: assignment_message = frappe._("{0} assigned {1}:...
<|file_name|>todo.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: MIT. See LICENSE import frappe import json from frappe.model.document import Document from frappe.utils import get_fullname, parse_addr exclude_from_linked_with = True class ToDo(Documen...
self._assignment = None if self.is_new(): if self.assigned_by == self.allocated_to: assignment_message = frappe._("{0} self assigned this task: {1}").format(get_fullname(self.assigned_by), self.description) else: assignment_message = frappe._("{0} assigned {1}: {2}").format(get_fullname(self.assigned...
<|file_name|>todo.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: MIT. See LICENSE import frappe import json from frappe.model.document import Document from frappe.utils import get_fullname, parse_addr exclude_from_linked_with = True class ToDo(Documen...
if self._assignment: self.add_assign_comment(**self._assignment) self.update_in_reference()
<|file_name|>todo.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: MIT. See LICENSE import frappe import json from frappe.model.document import Document from frappe.utils import get_fullname, parse_addr exclude_from_linked_with = True class ToDo(Documen...
self.delete_communication_links() self.update_in_reference()
<|file_name|>todo.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: MIT. See LICENSE import frappe import json from frappe.model.document import Document from frappe.utils import get_fullname, parse_addr exclude_from_linked_with = True class ToDo(Documen...
if not (self.reference_type and self.reference_name): return frappe.get_doc(self.reference_type, self.reference_name).add_comment(comment_type, text)
<|file_name|>todo.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: MIT. See LICENSE import frappe import json from frappe.model.document import Document from frappe.utils import get_fullname, parse_addr exclude_from_linked_with = True class ToDo(Documen...
return frappe.db.delete("Communication Link", { "link_doctype": self.doctype, "link_name": self.name })
<|file_name|>todo.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: MIT. See LICENSE import frappe import json from frappe.model.document import Document from frappe.utils import get_fullname, parse_addr exclude_from_linked_with = True class ToDo(Documen...
if not (self.reference_type and self.reference_name): return try: assignments = frappe.get_all("ToDo", filters={ "reference_type": self.reference_type, "reference_name": self.reference_name, "status": ("!=", "Cancelled") }, pluck="allocated_to") assignments.reverse() frappe.db.set_value...
<|file_name|>todo.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: MIT. See LICENSE import frappe import json from frappe.model.document import Document from frappe.utils import get_fullname, parse_addr exclude_from_linked_with = True class ToDo(Documen...
"""Returns list of owners after applying filters on todo's. """ rows = frappe.get_all(cls.DocType, filters=filters or {}, fields=['allocated_to']) return [parse_addr(row.allocated_to)[1] for row in rows if row.allocated_to]
<|file_name|>todo.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: MIT. See LICENSE import frappe import json from frappe.model.document import Document from frappe.utils import get_fullname, parse_addr exclude_from_linked_with = True class ToDo(Documen...
frappe.db.add_index("ToDo", ["reference_type", "reference_name"])
<|file_name|>todo.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: MIT. See LICENSE import frappe import json from frappe.model.document import Document from frappe.utils import get_fullname, parse_addr exclude_from_linked_with = True class ToDo(Documen...
if not user: user = frappe.session.user todo_roles = frappe.permissions.get_doctype_roles('ToDo') if 'All' in todo_roles: todo_roles.remove('All') if any(check in todo_roles for check in frappe.get_roles(user)): return None else: return """(`tabToDo`.allocated_to = {user} or `tabToDo`.assigned_by = {user})...
<|file_name|>todo.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: MIT. See LICENSE import frappe import json from frappe.model.document import Document from frappe.utils import get_fullname, parse_addr exclude_from_linked_with = True class ToDo(Documen...
user = user or frappe.session.user todo_roles = frappe.permissions.get_doctype_roles('ToDo', ptype) if 'All' in todo_roles: todo_roles.remove('All') if any(check in todo_roles for check in frappe.get_roles(user)): return True else: return doc.allocated_to==user or doc.assigned_by==user
<|file_name|>todo.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: MIT. See LICENSE import frappe import json from frappe.model.document import Document from frappe.utils import get_fullname, parse_addr exclude_from_linked_with = True class ToDo(Documen...
frappe.get_doc({ 'doctype': 'ToDo', 'description': description }).insert()
<|file_name|>todo.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: MIT. See LICENSE import frappe import json from frappe.model.document import Document from frappe.utils import get_fullname, parse_addr exclude_from_linked_with = True class ToDo(Documen...
if self.assigned_by == self.allocated_to: assignment_message = frappe._("{0} self assigned this task: {1}").format(get_fullname(self.assigned_by), self.description) else: assignment_message = frappe._("{0} assigned {1}: {2}").format(get_fullname(self.assigned_by), get_fullname(self.allocated_to), self.des...
<|file_name|>todo.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: MIT. See LICENSE import frappe import json from frappe.model.document import Document from frappe.utils import get_fullname, parse_addr exclude_from_linked_with = True class ToDo(Documen...
assignment_message = frappe._("{0} self assigned this task: {1}").format(get_fullname(self.assigned_by), self.description)
<|file_name|>todo.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: MIT. See LICENSE import frappe import json from frappe.model.document import Document from frappe.utils import get_fullname, parse_addr exclude_from_linked_with = True class ToDo(Documen...
assignment_message = frappe._("{0} assigned {1}: {2}").format(get_fullname(self.assigned_by), get_fullname(self.allocated_to), self.description)
<|file_name|>todo.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: MIT. See LICENSE import frappe import json from frappe.model.document import Document from frappe.utils import get_fullname, parse_addr exclude_from_linked_with = True class ToDo(Documen...
if self.get_db_value("status") != self.status: if self.allocated_to == frappe.session.user: removal_message = frappe._("{0} removed their assignment.").format( get_fullname(frappe.session.user)) else: removal_message = frappe._("Assignment of {0} removed by {1}").format( get_fullname(se...
<|file_name|>todo.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: MIT. See LICENSE import frappe import json from frappe.model.document import Document from frappe.utils import get_fullname, parse_addr exclude_from_linked_with = True class ToDo(Documen...
if self.allocated_to == frappe.session.user: removal_message = frappe._("{0} removed their assignment.").format( get_fullname(frappe.session.user)) else: removal_message = frappe._("Assignment of {0} removed by {1}").format( get_fullname(self.allocated_to), get_fullname(frappe.session.user...
<|file_name|>todo.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: MIT. See LICENSE import frappe import json from frappe.model.document import Document from frappe.utils import get_fullname, parse_addr exclude_from_linked_with = True class ToDo(Documen...
removal_message = frappe._("{0} removed their assignment.").format( get_fullname(frappe.session.user))
<|file_name|>todo.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: MIT. See LICENSE import frappe import json from frappe.model.document import Document from frappe.utils import get_fullname, parse_addr exclude_from_linked_with = True class ToDo(Documen...
removal_message = frappe._("Assignment of {0} removed by {1}").format( get_fullname(self.allocated_to), get_fullname(frappe.session.user))
<|file_name|>todo.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: MIT. See LICENSE import frappe import json from frappe.model.document import Document from frappe.utils import get_fullname, parse_addr exclude_from_linked_with = True class ToDo(Documen...
self.add_assign_comment(**self._assignment)
<|file_name|>todo.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: MIT. See LICENSE import frappe import json from frappe.model.document import Document from frappe.utils import get_fullname, parse_addr exclude_from_linked_with = True class ToDo(Documen...
return
<|file_name|>todo.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: MIT. See LICENSE import frappe import json from frappe.model.document import Document from frappe.utils import get_fullname, parse_addr exclude_from_linked_with = True class ToDo(Documen...
return
<|file_name|>todo.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: MIT. See LICENSE import frappe import json from frappe.model.document import Document from frappe.utils import get_fullname, parse_addr exclude_from_linked_with = True class ToDo(Documen...
return
<|file_name|>todo.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: MIT. See LICENSE import frappe import json from frappe.model.document import Document from frappe.utils import get_fullname, parse_addr exclude_from_linked_with = True class ToDo(Documen...
from frappe.database.schema import add_column add_column(self.reference_type, "_assign", "Text") self.update_in_reference()
<|file_name|>todo.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: MIT. See LICENSE import frappe import json from frappe.model.document import Document from frappe.utils import get_fullname, parse_addr exclude_from_linked_with = True class ToDo(Documen...
raise
<|file_name|>todo.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: MIT. See LICENSE import frappe import json from frappe.model.document import Document from frappe.utils import get_fullname, parse_addr exclude_from_linked_with = True class ToDo(Documen...
user = frappe.session.user
<|file_name|>todo.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: MIT. See LICENSE import frappe import json from frappe.model.document import Document from frappe.utils import get_fullname, parse_addr exclude_from_linked_with = True class ToDo(Documen...
todo_roles.remove('All')
<|file_name|>todo.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: MIT. See LICENSE import frappe import json from frappe.model.document import Document from frappe.utils import get_fullname, parse_addr exclude_from_linked_with = True class ToDo(Documen...
return None
<|file_name|>todo.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: MIT. See LICENSE import frappe import json from frappe.model.document import Document from frappe.utils import get_fullname, parse_addr exclude_from_linked_with = True class ToDo(Documen...
return """(`tabToDo`.allocated_to = {user} or `tabToDo`.assigned_by = {user})"""\ .format(user=frappe.db.escape(user))
<|file_name|>todo.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: MIT. See LICENSE import frappe import json from frappe.model.document import Document from frappe.utils import get_fullname, parse_addr exclude_from_linked_with = True class ToDo(Documen...
todo_roles.remove('All')
<|file_name|>todo.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: MIT. See LICENSE import frappe import json from frappe.model.document import Document from frappe.utils import get_fullname, parse_addr exclude_from_linked_with = True class ToDo(Documen...
return True
<|file_name|>todo.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: MIT. See LICENSE import frappe import json from frappe.model.document import Document from frappe.utils import get_fullname, parse_addr exclude_from_linked_with = True class ToDo(Documen...
return doc.allocated_to==user or doc.assigned_by==user
<|file_name|>todo.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: MIT. See LICENSE import frappe import json from frappe.model.document import Document from frappe.utils import get_fullname, parse_addr exclude_from_linked_with = True class ToDo(Documen...
validate
<|file_name|>todo.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: MIT. See LICENSE import frappe import json from frappe.model.document import Document from frappe.utils import get_fullname, parse_addr exclude_from_linked_with = True class ToDo(Documen...
on_update