body stringlengths 26 98.2k | body_hash int64 -9,222,864,604,528,158,000 9,221,803,474B | docstring stringlengths 1 16.8k | path stringlengths 5 230 | name stringlengths 1 96 | repository_name stringlengths 7 89 | lang stringclasses 1
value | body_without_docstring stringlengths 20 98.2k |
|---|---|---|---|---|---|---|---|
def test_from_xml_generates_correct_sequencer_hierarchy(self):
'testing if from_xml method will generate Sequences and shots\n correctly\n '
path = os.path.abspath('./test_data/test_v001.xml')
sm = pymel.core.PyNode('sequenceManager1')
sm.from_xml(path)
sequences = sm.sequences.get()
... | 2,028,905,924,533,081,000 | testing if from_xml method will generate Sequences and shots
correctly | tests/previs/test_sequence_manager_extension.py | test_from_xml_generates_correct_sequencer_hierarchy | Khosiyat/anima | python | def test_from_xml_generates_correct_sequencer_hierarchy(self):
'testing if from_xml method will generate Sequences and shots\n correctly\n '
path = os.path.abspath('./test_data/test_v001.xml')
sm = pymel.core.PyNode('sequenceManager1')
sm.from_xml(path)
sequences = sm.sequences.get()
... |
def test_from_xml_updates_sequencer_hierarchy_with_shots_expanded_and_contracted(self):
'testing if from_xml method will update Sequences and shots\n correctly with the xml file\n '
path = os.path.abspath('./test_data/test_v002.xml')
sm = pymel.core.PyNode('sequenceManager1')
sm.set_versio... | 7,175,552,414,838,216,000 | testing if from_xml method will update Sequences and shots
correctly with the xml file | tests/previs/test_sequence_manager_extension.py | test_from_xml_updates_sequencer_hierarchy_with_shots_expanded_and_contracted | Khosiyat/anima | python | def test_from_xml_updates_sequencer_hierarchy_with_shots_expanded_and_contracted(self):
'testing if from_xml method will update Sequences and shots\n correctly with the xml file\n '
path = os.path.abspath('./test_data/test_v002.xml')
sm = pymel.core.PyNode('sequenceManager1')
sm.set_versio... |
def test_from_edl_updates_sequencer_hierarchy_with_shots_expanded_and_contracted(self):
'testing if from_edl method will update Sequences and shots\n correctly with the edl file\n '
path = os.path.abspath('./test_data/test_v002.edl')
sm = pymel.core.PyNode('sequenceManager1')
sm.set_versio... | 4,609,666,304,671,865,000 | testing if from_edl method will update Sequences and shots
correctly with the edl file | tests/previs/test_sequence_manager_extension.py | test_from_edl_updates_sequencer_hierarchy_with_shots_expanded_and_contracted | Khosiyat/anima | python | def test_from_edl_updates_sequencer_hierarchy_with_shots_expanded_and_contracted(self):
'testing if from_edl method will update Sequences and shots\n correctly with the edl file\n '
path = os.path.abspath('./test_data/test_v002.edl')
sm = pymel.core.PyNode('sequenceManager1')
sm.set_versio... |
def test_from_edl_updates_sequencer_hierarchy_with_shots_used_more_than_one_times(self):
'testing if from_edl method will update Sequences and shots correctly\n with shot are used more than once\n '
path = os.path.abspath('./test_data/test_v004.edl')
sm = pymel.core.PyNode('sequenceManager1')
... | -77,258,966,698,139,840 | testing if from_edl method will update Sequences and shots correctly
with shot are used more than once | tests/previs/test_sequence_manager_extension.py | test_from_edl_updates_sequencer_hierarchy_with_shots_used_more_than_one_times | Khosiyat/anima | python | def test_from_edl_updates_sequencer_hierarchy_with_shots_used_more_than_one_times(self):
'testing if from_edl method will update Sequences and shots correctly\n with shot are used more than once\n '
path = os.path.abspath('./test_data/test_v004.edl')
sm = pymel.core.PyNode('sequenceManager1')
... |
def test_from_xml_updates_sequencer_hierarchy_with_shots_removed(self):
'testing if from_xml method will update Sequences and shots\n correctly with the xml file\n '
path = os.path.abspath('./test_data/test_v003.xml')
sm = pymel.core.PyNode('sequenceManager1')
sm.set_version('v001')
se... | -8,870,989,929,307,009,000 | testing if from_xml method will update Sequences and shots
correctly with the xml file | tests/previs/test_sequence_manager_extension.py | test_from_xml_updates_sequencer_hierarchy_with_shots_removed | Khosiyat/anima | python | def test_from_xml_updates_sequencer_hierarchy_with_shots_removed(self):
'testing if from_xml method will update Sequences and shots\n correctly with the xml file\n '
path = os.path.abspath('./test_data/test_v003.xml')
sm = pymel.core.PyNode('sequenceManager1')
sm.set_version('v001')
se... |
def test_to_xml_will_generate_proper_xml_string(self):
'testing if a proper xml compatible string will be generated with\n to_xml() method\n '
path = os.path.abspath('./test_data/test_v001.xml')
sm = pymel.core.PyNode('sequenceManager1')
sm.set_shot_name_template('<Sequence>_<Shot>_<Versio... | -6,445,851,399,143,669,000 | testing if a proper xml compatible string will be generated with
to_xml() method | tests/previs/test_sequence_manager_extension.py | test_to_xml_will_generate_proper_xml_string | Khosiyat/anima | python | def test_to_xml_will_generate_proper_xml_string(self):
'testing if a proper xml compatible string will be generated with\n to_xml() method\n '
path = os.path.abspath('./test_data/test_v001.xml')
sm = pymel.core.PyNode('sequenceManager1')
sm.set_shot_name_template('<Sequence>_<Shot>_<Versio... |
def test_create_sequence_is_working_properly(self):
'testing if create_sequence is working properly\n '
seq = self.sm.create_sequence()
self.assertEqual(seq.type(), 'sequencer')
self.maxDiff = None
self.assertEqual(self.sm, seq.message.connections()[0]) | 2,378,834,401,552,188,000 | testing if create_sequence is working properly | tests/previs/test_sequence_manager_extension.py | test_create_sequence_is_working_properly | Khosiyat/anima | python | def test_create_sequence_is_working_properly(self):
'\n '
seq = self.sm.create_sequence()
self.assertEqual(seq.type(), 'sequencer')
self.maxDiff = None
self.assertEqual(self.sm, seq.message.connections()[0]) |
def test_create_sequence_is_properly_setting_the_sequence_name(self):
'testing if create_sequence is working properly\n '
seq = self.sm.create_sequence('Test Sequence')
self.assertEqual('Test Sequence', seq.sequence_name.get()) | 7,593,421,248,791,318,000 | testing if create_sequence is working properly | tests/previs/test_sequence_manager_extension.py | test_create_sequence_is_properly_setting_the_sequence_name | Khosiyat/anima | python | def test_create_sequence_is_properly_setting_the_sequence_name(self):
'\n '
seq = self.sm.create_sequence('Test Sequence')
self.assertEqual('Test Sequence', seq.sequence_name.get()) |
def test_to_edl_is_working_properly(self):
'testing if to_edl method is working properly\n '
import edl
seq1 = self.sm.create_sequence('sequence1')
seq1.create_shot('shot1')
seq1.create_shot('shot2')
seq1.create_shot('shot3')
l = self.sm.to_edl()
self.assertIsInstance(l, edl.List) | -4,451,272,981,437,685,000 | testing if to_edl method is working properly | tests/previs/test_sequence_manager_extension.py | test_to_edl_is_working_properly | Khosiyat/anima | python | def test_to_edl_is_working_properly(self):
'\n '
import edl
seq1 = self.sm.create_sequence('sequence1')
seq1.create_shot('shot1')
seq1.create_shot('shot2')
seq1.create_shot('shot3')
l = self.sm.to_edl()
self.assertIsInstance(l, edl.List) |
def test_to_edl_will_generate_a_proper_edl_content(self):
'testing if to_edl will generate a proper edl content\n '
edl_path = os.path.abspath('./test_data/test_v001.edl')
sm = pymel.core.PyNode('sequenceManager1')
sm.set_version('v001')
sm = pymel.core.PyNode('sequenceManager1')
sm.set_s... | -4,220,463,395,195,804,000 | testing if to_edl will generate a proper edl content | tests/previs/test_sequence_manager_extension.py | test_to_edl_will_generate_a_proper_edl_content | Khosiyat/anima | python | def test_to_edl_will_generate_a_proper_edl_content(self):
'\n '
edl_path = os.path.abspath('./test_data/test_v001.edl')
sm = pymel.core.PyNode('sequenceManager1')
sm.set_version('v001')
sm = pymel.core.PyNode('sequenceManager1')
sm.set_shot_name_template('<Sequence>_<Shot>_<Version>')
... |
def test_generate_sequence_structure_returns_a_sequence_instance(self):
'testing if generate_sequence_structure() method will return a\n Sequence instance\n '
sm = pymel.core.PyNode('sequenceManager1')
seq1 = sm.create_sequence('sequence1')
shot1 = seq1.create_shot('shot1')
shot1.outpu... | -4,498,311,867,630,089,000 | testing if generate_sequence_structure() method will return a
Sequence instance | tests/previs/test_sequence_manager_extension.py | test_generate_sequence_structure_returns_a_sequence_instance | Khosiyat/anima | python | def test_generate_sequence_structure_returns_a_sequence_instance(self):
'testing if generate_sequence_structure() method will return a\n Sequence instance\n '
sm = pymel.core.PyNode('sequenceManager1')
seq1 = sm.create_sequence('sequence1')
shot1 = seq1.create_shot('shot1')
shot1.outpu... |
def test_generate_sequence_structure_will_generate_sequences_and_shots_with_correct_number_of_tracks(self):
'testing if a proper sequence structure will be generated by using\n the generate_sequence_structure() method with correct number of tracks\n '
path = os.path.abspath('./test_data/test_v001.... | -609,995,082,814,433,700 | testing if a proper sequence structure will be generated by using
the generate_sequence_structure() method with correct number of tracks | tests/previs/test_sequence_manager_extension.py | test_generate_sequence_structure_will_generate_sequences_and_shots_with_correct_number_of_tracks | Khosiyat/anima | python | def test_generate_sequence_structure_will_generate_sequences_and_shots_with_correct_number_of_tracks(self):
'testing if a proper sequence structure will be generated by using\n the generate_sequence_structure() method with correct number of tracks\n '
path = os.path.abspath('./test_data/test_v001.... |
def test_set_shot_name_template_is_working_properly(self):
'testing if set_shot_name_template() is working properly\n '
sm = pymel.core.PyNode('sequenceManager1')
self.assertFalse(sm.hasAttr('shot_name_template'))
test_template = '<Sequence>_<Shot>_<Version>'
sm.set_shot_name_template(test_te... | -5,700,847,774,720,538,000 | testing if set_shot_name_template() is working properly | tests/previs/test_sequence_manager_extension.py | test_set_shot_name_template_is_working_properly | Khosiyat/anima | python | def test_set_shot_name_template_is_working_properly(self):
'\n '
sm = pymel.core.PyNode('sequenceManager1')
self.assertFalse(sm.hasAttr('shot_name_template'))
test_template = '<Sequence>_<Shot>_<Version>'
sm.set_shot_name_template(test_template)
self.assertTrue(sm.hasAttr('shot_name_templ... |
def test_get_shot_name_template_is_working_properly(self):
'testing if set_shot_name_template() is working properly\n '
sm = pymel.core.PyNode('sequenceManager1')
self.assertFalse(sm.hasAttr('shot_name_template'))
test_template = '<Sequence>_<Shot>_<Version>'
sm.set_shot_name_template(test_te... | 8,926,393,877,726,173,000 | testing if set_shot_name_template() is working properly | tests/previs/test_sequence_manager_extension.py | test_get_shot_name_template_is_working_properly | Khosiyat/anima | python | def test_get_shot_name_template_is_working_properly(self):
'\n '
sm = pymel.core.PyNode('sequenceManager1')
self.assertFalse(sm.hasAttr('shot_name_template'))
test_template = '<Sequence>_<Shot>_<Version>'
sm.set_shot_name_template(test_template)
self.assertTrue(sm.hasAttr('shot_name_templ... |
def test_get_shot_name_template_will_create_shot_name_template_attribute_if_missing(self):
'testing if set_shot_name_template() will create the\n shot_name_template attribute if missing\n '
sm = pymel.core.PyNode('sequenceManager1')
self.assertFalse(sm.hasAttr('shot_name_template'))
result... | 7,066,411,986,858,611,000 | testing if set_shot_name_template() will create the
shot_name_template attribute if missing | tests/previs/test_sequence_manager_extension.py | test_get_shot_name_template_will_create_shot_name_template_attribute_if_missing | Khosiyat/anima | python | def test_get_shot_name_template_will_create_shot_name_template_attribute_if_missing(self):
'testing if set_shot_name_template() will create the\n shot_name_template attribute if missing\n '
sm = pymel.core.PyNode('sequenceManager1')
self.assertFalse(sm.hasAttr('shot_name_template'))
result... |
def test_set_version_is_working_properly(self):
'testing if set_version() is working properly\n '
sm = pymel.core.PyNode('sequenceManager1')
self.assertFalse(sm.hasAttr('version'))
test_version = 'v001'
sm.set_version(test_version)
self.assertTrue(sm.hasAttr('version'))
self.assertEqu... | -2,562,816,534,814,400,000 | testing if set_version() is working properly | tests/previs/test_sequence_manager_extension.py | test_set_version_is_working_properly | Khosiyat/anima | python | def test_set_version_is_working_properly(self):
'\n '
sm = pymel.core.PyNode('sequenceManager1')
self.assertFalse(sm.hasAttr('version'))
test_version = 'v001'
sm.set_version(test_version)
self.assertTrue(sm.hasAttr('version'))
self.assertEqual(sm.version.get(), test_version) |
def test_get_version_is_working_properly(self):
'testing if set_version() is working properly\n '
sm = pymel.core.PyNode('sequenceManager1')
self.assertFalse(sm.hasAttr('version'))
test_version = 'v001'
sm.set_version(test_version)
self.assertTrue(sm.hasAttr('version'))
self.assertEqu... | -4,687,405,485,665,601,000 | testing if set_version() is working properly | tests/previs/test_sequence_manager_extension.py | test_get_version_is_working_properly | Khosiyat/anima | python | def test_get_version_is_working_properly(self):
'\n '
sm = pymel.core.PyNode('sequenceManager1')
self.assertFalse(sm.hasAttr('version'))
test_version = 'v001'
sm.set_version(test_version)
self.assertTrue(sm.hasAttr('version'))
self.assertEqual(sm.get_version(), test_version) |
def test_get_version_will_create_attribute_if_missing(self):
'testing if get_version() will create the missing version attribute\n '
sm = pymel.core.PyNode('sequenceManager1')
self.assertFalse(sm.hasAttr('version'))
result = sm.get_version()
self.assertTrue(sm.hasAttr('version'))
self.ass... | -1,376,126,504,394,918,000 | testing if get_version() will create the missing version attribute | tests/previs/test_sequence_manager_extension.py | test_get_version_will_create_attribute_if_missing | Khosiyat/anima | python | def test_get_version_will_create_attribute_if_missing(self):
'\n '
sm = pymel.core.PyNode('sequenceManager1')
self.assertFalse(sm.hasAttr('version'))
result = sm.get_version()
self.assertTrue(sm.hasAttr('version'))
self.assertEqual(result, ) |
def test_set_task_name_is_working_properly(self):
'testing if set_task_name() is working properly\n '
sm = pymel.core.PyNode('sequenceManager1')
self.assertFalse(sm.hasAttr('task_name'))
test_task_name = 'Animation'
sm.set_task_name(test_task_name)
self.assertTrue(sm.hasAttr('task_name'))... | -5,957,037,253,209,172,000 | testing if set_task_name() is working properly | tests/previs/test_sequence_manager_extension.py | test_set_task_name_is_working_properly | Khosiyat/anima | python | def test_set_task_name_is_working_properly(self):
'\n '
sm = pymel.core.PyNode('sequenceManager1')
self.assertFalse(sm.hasAttr('task_name'))
test_task_name = 'Animation'
sm.set_task_name(test_task_name)
self.assertTrue(sm.hasAttr('task_name'))
self.assertEqual(sm.task_name.get(), test... |
def test_get_task_name_is_working_properly(self):
'testing if set_task_name() is working properly\n '
sm = pymel.core.PyNode('sequenceManager1')
self.assertFalse(sm.hasAttr('task_name'))
test_task_name = 'Animation'
sm.set_task_name(test_task_name)
self.assertTrue(sm.hasAttr('task_name'))... | 1,809,480,270,107,058,200 | testing if set_task_name() is working properly | tests/previs/test_sequence_manager_extension.py | test_get_task_name_is_working_properly | Khosiyat/anima | python | def test_get_task_name_is_working_properly(self):
'\n '
sm = pymel.core.PyNode('sequenceManager1')
self.assertFalse(sm.hasAttr('task_name'))
test_task_name = 'Animation'
sm.set_task_name(test_task_name)
self.assertTrue(sm.hasAttr('task_name'))
self.assertEqual(sm.get_task_name(), test... |
def test_get_task_name_will_create_attribute_if_missing(self):
'testing if get_task_name() will create the missing task_name attribute\n '
sm = pymel.core.PyNode('sequenceManager1')
self.assertFalse(sm.hasAttr('task_name'))
result = sm.get_task_name()
self.assertTrue(sm.hasAttr('task_name'))
... | -4,364,813,692,820,742,700 | testing if get_task_name() will create the missing task_name attribute | tests/previs/test_sequence_manager_extension.py | test_get_task_name_will_create_attribute_if_missing | Khosiyat/anima | python | def test_get_task_name_will_create_attribute_if_missing(self):
'\n '
sm = pymel.core.PyNode('sequenceManager1')
self.assertFalse(sm.hasAttr('task_name'))
result = sm.get_task_name()
self.assertTrue(sm.hasAttr('task_name'))
self.assertEqual(result, ) |
def test_set_take_name_is_working_properly(self):
'testing if set_take_name() is working properly\n '
sm = pymel.core.PyNode('sequenceManager1')
self.assertFalse(sm.hasAttr('take_name'))
test_take_name = 'Main'
sm.set_take_name(test_take_name)
self.assertTrue(sm.hasAttr('take_name'))
... | -6,502,425,200,491,617,000 | testing if set_take_name() is working properly | tests/previs/test_sequence_manager_extension.py | test_set_take_name_is_working_properly | Khosiyat/anima | python | def test_set_take_name_is_working_properly(self):
'\n '
sm = pymel.core.PyNode('sequenceManager1')
self.assertFalse(sm.hasAttr('take_name'))
test_take_name = 'Main'
sm.set_take_name(test_take_name)
self.assertTrue(sm.hasAttr('take_name'))
self.assertEqual(sm.take_name.get(), test_take... |
def test_get_take_name_is_working_properly(self):
'testing if set_take_name() is working properly\n '
sm = pymel.core.PyNode('sequenceManager1')
self.assertFalse(sm.hasAttr('take_name'))
test_take_name = 'Main'
sm.set_take_name(test_take_name)
self.assertTrue(sm.hasAttr('take_name'))
... | 4,979,500,875,014,622,000 | testing if set_take_name() is working properly | tests/previs/test_sequence_manager_extension.py | test_get_take_name_is_working_properly | Khosiyat/anima | python | def test_get_take_name_is_working_properly(self):
'\n '
sm = pymel.core.PyNode('sequenceManager1')
self.assertFalse(sm.hasAttr('take_name'))
test_take_name = 'Main'
sm.set_take_name(test_take_name)
self.assertTrue(sm.hasAttr('take_name'))
self.assertEqual(sm.get_take_name(), test_take... |
def test_get_take_name_will_create_attribute_if_missing(self):
'testing if get_take_name() will create the missing take_name attribute\n '
sm = pymel.core.PyNode('sequenceManager1')
self.assertFalse(sm.hasAttr('take_name'))
result = sm.get_take_name()
self.assertTrue(sm.hasAttr('take_name'))
... | -3,863,296,170,872,902,700 | testing if get_take_name() will create the missing take_name attribute | tests/previs/test_sequence_manager_extension.py | test_get_take_name_will_create_attribute_if_missing | Khosiyat/anima | python | def test_get_take_name_will_create_attribute_if_missing(self):
'\n '
sm = pymel.core.PyNode('sequenceManager1')
self.assertFalse(sm.hasAttr('take_name'))
result = sm.get_take_name()
self.assertTrue(sm.hasAttr('take_name'))
self.assertEqual(result, ) |
def test_generate_sequence_structure_is_working_properly(self):
'testing if generate_sequence_structure() method is working properly\n '
sm = pymel.core.PyNode('sequenceManager1')
from anima.env import mayaEnv
mayaEnv.Maya.set_fps(fps=24)
sm.set_shot_name_template('<Sequence>_<Shot>_<Version>... | 4,421,209,912,940,247,600 | testing if generate_sequence_structure() method is working properly | tests/previs/test_sequence_manager_extension.py | test_generate_sequence_structure_is_working_properly | Khosiyat/anima | python | def test_generate_sequence_structure_is_working_properly(self):
'\n '
sm = pymel.core.PyNode('sequenceManager1')
from anima.env import mayaEnv
mayaEnv.Maya.set_fps(fps=24)
sm.set_shot_name_template('<Sequence>_<Shot>_<Version>')
sm.set_version('v001')
seq1 = sm.create_sequence('SEQ001... |
def to_k8s_yaml(self) -> List[Tuple[(str, List[Dict])]]:
'\n Return a list of dictionary configurations. One for each deployment in this Deployment\n .. # noqa: DAR201\n .. # noqa: DAR101\n '
if (self.name == 'gateway'):
return [('gateway', self.worker_deployments[0].... | -8,254,275,310,431,813,000 | Return a list of dictionary configurations. One for each deployment in this Deployment
.. # noqa: DAR201
.. # noqa: DAR101 | jina/orchestrate/deployments/config/k8s.py | to_k8s_yaml | ethan-jiang-1/jina | python | def to_k8s_yaml(self) -> List[Tuple[(str, List[Dict])]]:
'\n Return a list of dictionary configurations. One for each deployment in this Deployment\n .. # noqa: DAR201\n .. # noqa: DAR101\n '
if (self.name == 'gateway'):
return [('gateway', self.worker_deployments[0].... |
def __call__(self, ids):
'Return the mapping when evaluated.\n\n In this case, the ids received are actually the vocabulary `scheme`\n (top-level) and `subject` (nested). And since they are already\n human-readable, we keep them as-is.\n '
unique_ids = list(set(ids))
return {id_:... | 8,695,316,713,877,717,000 | Return the mapping when evaluated.
In this case, the ids received are actually the vocabulary `scheme`
(top-level) and `subject` (nested). And since they are already
human-readable, we keep them as-is. | invenio_vocabularies/contrib/subjects/facets.py | __call__ | alejandromumo/invenio-vocabularies | python | def __call__(self, ids):
'Return the mapping when evaluated.\n\n In this case, the ids received are actually the vocabulary `scheme`\n (top-level) and `subject` (nested). And since they are already\n human-readable, we keep them as-is.\n '
unique_ids = list(set(ids))
return {id_:... |
def dummy():
' Dummy function for comparison of the return values '
return | 7,763,923,742,727,346,000 | Dummy function for comparison of the return values | src/game_of_life/python_coderetreat_socramob/cr_socramob08/coord_test.py | dummy | hemmerling/codingdojo | python | def dummy():
' '
return |
def is_user_context(context):
'Indicates if the request context is a normal user.'
if (not context):
return False
if context.is_admin:
return False
if ((not context.user_id) or (not context.project_id)):
return False
return True | 6,483,598,451,008,784,000 | Indicates if the request context is a normal user. | patron/context.py | is_user_context | casbin/openstack-patron | python | def is_user_context(context):
if (not context):
return False
if context.is_admin:
return False
if ((not context.user_id) or (not context.project_id)):
return False
return True |
def require_admin_context(ctxt):
'Raise exception.AdminRequired() if context is an admin context.'
if (not ctxt.is_admin):
raise exception.AdminRequired() | 8,881,687,383,398,372,000 | Raise exception.AdminRequired() if context is an admin context. | patron/context.py | require_admin_context | casbin/openstack-patron | python | def require_admin_context(ctxt):
if (not ctxt.is_admin):
raise exception.AdminRequired() |
def require_context(ctxt):
'Raise exception.Forbidden() if context is not a user or an\n admin context.\n '
if ((not ctxt.is_admin) and (not is_user_context(ctxt))):
raise exception.Forbidden() | 6,181,499,204,192,342,000 | Raise exception.Forbidden() if context is not a user or an
admin context. | patron/context.py | require_context | casbin/openstack-patron | python | def require_context(ctxt):
'Raise exception.Forbidden() if context is not a user or an\n admin context.\n '
if ((not ctxt.is_admin) and (not is_user_context(ctxt))):
raise exception.Forbidden() |
def authorize_project_context(context, project_id):
'Ensures a request has permission to access the given project.'
if is_user_context(context):
if (not context.project_id):
raise exception.Forbidden()
elif (context.project_id != project_id):
raise exception.Forbidden() | -6,026,524,350,522,053,000 | Ensures a request has permission to access the given project. | patron/context.py | authorize_project_context | casbin/openstack-patron | python | def authorize_project_context(context, project_id):
if is_user_context(context):
if (not context.project_id):
raise exception.Forbidden()
elif (context.project_id != project_id):
raise exception.Forbidden() |
def authorize_user_context(context, user_id):
'Ensures a request has permission to access the given user.'
if is_user_context(context):
if (not context.user_id):
raise exception.Forbidden()
elif (context.user_id != user_id):
raise exception.Forbidden() | 4,605,583,626,984,261,000 | Ensures a request has permission to access the given user. | patron/context.py | authorize_user_context | casbin/openstack-patron | python | def authorize_user_context(context, user_id):
if is_user_context(context):
if (not context.user_id):
raise exception.Forbidden()
elif (context.user_id != user_id):
raise exception.Forbidden() |
def authorize_quota_class_context(context, class_name):
'Ensures a request has permission to access the given quota class.'
if is_user_context(context):
if (not context.quota_class):
raise exception.Forbidden()
elif (context.quota_class != class_name):
raise exception.For... | -8,332,953,962,440,573,000 | Ensures a request has permission to access the given quota class. | patron/context.py | authorize_quota_class_context | casbin/openstack-patron | python | def authorize_quota_class_context(context, class_name):
if is_user_context(context):
if (not context.quota_class):
raise exception.Forbidden()
elif (context.quota_class != class_name):
raise exception.Forbidden() |
def __init__(self, user_id=None, project_id=None, is_admin=None, read_deleted='no', roles=None, remote_address=None, timestamp=None, request_id=None, auth_token=None, overwrite=True, quota_class=None, user_name=None, project_name=None, service_catalog=None, instance_lock_checked=False, user_auth_plugin=None, **kwargs):... | -2,724,747,871,020,421,000 | :param read_deleted: 'no' indicates deleted records are hidden,
'yes' indicates deleted records are visible,
'only' indicates that *only* deleted records are visible.
:param overwrite: Set to False to ensure that the greenthread local
copy of the index is not overwritten.
:param user_auth_plugin: The a... | patron/context.py | __init__ | casbin/openstack-patron | python | def __init__(self, user_id=None, project_id=None, is_admin=None, read_deleted='no', roles=None, remote_address=None, timestamp=None, request_id=None, auth_token=None, overwrite=True, quota_class=None, user_name=None, project_name=None, service_catalog=None, instance_lock_checked=False, user_auth_plugin=None, **kwargs):... |
def elevated(self, read_deleted=None, overwrite=False):
'Return a version of this context with admin flag set.'
context = copy.deepcopy(self)
context.is_admin = True
if ('admin' not in context.roles):
context.roles.append('admin')
if (read_deleted is not None):
context.read_deleted =... | -4,897,044,628,749,857,000 | Return a version of this context with admin flag set. | patron/context.py | elevated | casbin/openstack-patron | python | def elevated(self, read_deleted=None, overwrite=False):
context = copy.deepcopy(self)
context.is_admin = True
if ('admin' not in context.roles):
context.roles.append('admin')
if (read_deleted is not None):
context.read_deleted = read_deleted
return context |
def withTiming(text='{func}() {time:.2f} ns'):
'Append timing information to a function\n\n Example:\n @withTiming()\n def function():\n pass\n\n '
def timings_decorator(func):
if (not TIMINGS):
return func
@wraps(func)
def func_wrapper(*args,... | -1,641,868,228,917,891,300 | Append timing information to a function
Example:
@withTiming()
def function():
pass | cmdx.py | withTiming | fvbehr/cmdx | python | def withTiming(text='{func}() {time:.2f} ns'):
'Append timing information to a function\n\n Example:\n @withTiming()\n def function():\n pass\n\n '
def timings_decorator(func):
if (not TIMINGS):
return func
@wraps(func)
def func_wrapper(*args,... |
def protected(func):
'Prevent fatal crashes from illegal access to deleted nodes'
if ROGUE_MODE:
return func
@wraps(func)
def func_wrapper(*args, **kwargs):
if args[0]._destroyed:
raise ExistError('Cannot perform operation on deleted node')
return func(*args, **kwarg... | -2,619,712,364,112,586,000 | Prevent fatal crashes from illegal access to deleted nodes | cmdx.py | protected | fvbehr/cmdx | python | def protected(func):
if ROGUE_MODE:
return func
@wraps(func)
def func_wrapper(*args, **kwargs):
if args[0]._destroyed:
raise ExistError('Cannot perform operation on deleted node')
return func(*args, **kwargs)
return func_wrapper |
def add_metaclass(metaclass):
'Add metaclass to Python 2 and 3 class\n\n Helper decorator, from six.py\n\n '
def wrapper(cls):
orig_vars = cls.__dict__.copy()
slots = orig_vars.get('__slots__')
if (slots is not None):
if isinstance(slots, str):
slots = ... | -3,188,808,974,660,015,600 | Add metaclass to Python 2 and 3 class
Helper decorator, from six.py | cmdx.py | add_metaclass | fvbehr/cmdx | python | def add_metaclass(metaclass):
'Add metaclass to Python 2 and 3 class\n\n Helper decorator, from six.py\n\n '
def wrapper(cls):
orig_vars = cls.__dict__.copy()
slots = orig_vars.get('__slots__')
if (slots is not None):
if isinstance(slots, str):
slots = ... |
def UiUnit():
'Unlike other time units, this can be modified by the user at run-time'
return _Unit(om.MTime, om.MTime.uiUnit()) | 1,989,804,669,188,851,700 | Unlike other time units, this can be modified by the user at run-time | cmdx.py | UiUnit | fvbehr/cmdx | python | def UiUnit():
return _Unit(om.MTime, om.MTime.uiUnit()) |
def twistSwingToQuaternion(ts):
'Convert twist/swing1/swing2 rotation in a Vector into a quaternion\n\n Arguments:\n ts (Vector): Twist, swing1 and swing2\n\n '
t = tan((ts.x * 0.25))
s1 = tan((ts.y * 0.25))
s2 = tan((ts.z * 0.25))
b = (2.0 / ((1.0 + (s1 * s1)) + (s2 * s2)))
c = (2.... | -1,108,041,672,223,247,600 | Convert twist/swing1/swing2 rotation in a Vector into a quaternion
Arguments:
ts (Vector): Twist, swing1 and swing2 | cmdx.py | twistSwingToQuaternion | fvbehr/cmdx | python | def twistSwingToQuaternion(ts):
'Convert twist/swing1/swing2 rotation in a Vector into a quaternion\n\n Arguments:\n ts (Vector): Twist, swing1 and swing2\n\n '
t = tan((ts.x * 0.25))
s1 = tan((ts.y * 0.25))
s2 = tan((ts.z * 0.25))
b = (2.0 / ((1.0 + (s1 * s1)) + (s2 * s2)))
c = (2.... |
def NurbsCurveData(points, degree=1, form=om1.MFnNurbsCurve.kOpen):
'Tuple of points to MObject suitable for nurbsCurve-typed data\n\n Arguments:\n points (tuple): (x, y, z) tuples per point\n degree (int, optional): Defaults to 1 for linear\n form (int, optional): Defaults to MFnNurbsCurve.... | 4,124,420,921,214,744,000 | Tuple of points to MObject suitable for nurbsCurve-typed data
Arguments:
points (tuple): (x, y, z) tuples per point
degree (int, optional): Defaults to 1 for linear
form (int, optional): Defaults to MFnNurbsCurve.kOpen,
also available kClosed
Example:
Create a new nurbs curve like this.
>... | cmdx.py | NurbsCurveData | fvbehr/cmdx | python | def NurbsCurveData(points, degree=1, form=om1.MFnNurbsCurve.kOpen):
'Tuple of points to MObject suitable for nurbsCurve-typed data\n\n Arguments:\n points (tuple): (x, y, z) tuples per point\n degree (int, optional): Defaults to 1 for linear\n form (int, optional): Defaults to MFnNurbsCurve.... |
def _plug_to_default(plug):
'Find default value from plug, regardless of attribute type'
if plug.isArray:
raise TypeError('Array plugs are unsupported')
if plug.isCompound:
raise TypeError('Compound plugs are unsupported')
attr = plug.attribute()
type = attr.apiType()
if (type ==... | 984,843,986,271,279,900 | Find default value from plug, regardless of attribute type | cmdx.py | _plug_to_default | fvbehr/cmdx | python | def _plug_to_default(plug):
if plug.isArray:
raise TypeError('Array plugs are unsupported')
if plug.isCompound:
raise TypeError('Compound plugs are unsupported')
attr = plug.attribute()
type = attr.apiType()
if (type == om.MFn.kTypedAttribute):
return om.MFnTypedAttribut... |
def _plug_to_python(plug, unit=None, context=None):
'Convert native `plug` to Python type\n\n Arguments:\n plug (om.MPlug): Native Maya plug\n unit (int, optional): Return value in this unit, e.g. Meters\n context (om.MDGContext, optional): Return value in this context\n\n '
assert (n... | -3,045,147,447,084,764,000 | Convert native `plug` to Python type
Arguments:
plug (om.MPlug): Native Maya plug
unit (int, optional): Return value in this unit, e.g. Meters
context (om.MDGContext, optional): Return value in this context | cmdx.py | _plug_to_python | fvbehr/cmdx | python | def _plug_to_python(plug, unit=None, context=None):
'Convert native `plug` to Python type\n\n Arguments:\n plug (om.MPlug): Native Maya plug\n unit (int, optional): Return value in this unit, e.g. Meters\n context (om.MDGContext, optional): Return value in this context\n\n '
assert (n... |
def _python_to_plug(value, plug):
'Pass value of `value` to `plug`\n\n Arguments:\n value (any): Instance of Python or Maya type\n plug (Plug): Target plug to which value is applied\n\n '
if isinstance(value, (tuple, list)):
if (plug.type() == 'kMatrixAttribute'):
assert ... | 4,446,051,081,703,159,300 | Pass value of `value` to `plug`
Arguments:
value (any): Instance of Python or Maya type
plug (Plug): Target plug to which value is applied | cmdx.py | _python_to_plug | fvbehr/cmdx | python | def _python_to_plug(value, plug):
'Pass value of `value` to `plug`\n\n Arguments:\n value (any): Instance of Python or Maya type\n plug (Plug): Target plug to which value is applied\n\n '
if isinstance(value, (tuple, list)):
if (plug.type() == 'kMatrixAttribute'):
assert ... |
def _python_to_mod(value, plug, mod):
'Convert `value` into a suitable equivalent for om.MDGModifier\n\n Arguments:\n value (object): Value of any type to write into modifier\n plug (Plug): Plug within which to write value\n mod (om.MDGModifier): Modifier to use for writing it\n\n '
m... | -9,122,478,816,224,801,000 | Convert `value` into a suitable equivalent for om.MDGModifier
Arguments:
value (object): Value of any type to write into modifier
plug (Plug): Plug within which to write value
mod (om.MDGModifier): Modifier to use for writing it | cmdx.py | _python_to_mod | fvbehr/cmdx | python | def _python_to_mod(value, plug, mod):
'Convert `value` into a suitable equivalent for om.MDGModifier\n\n Arguments:\n value (object): Value of any type to write into modifier\n plug (Plug): Plug within which to write value\n mod (om.MDGModifier): Modifier to use for writing it\n\n '
m... |
def encode(path):
'Convert relative or absolute `path` to cmdx Node\n\n Fastest conversion from absolute path to Node\n\n Arguments:\n path (str): Absolute or relative path to DAG or DG node\n\n '
assert isinstance(path, string_types), ('%s was not string' % path)
selectionList = om.MSelecti... | -8,308,368,486,272,812,000 | Convert relative or absolute `path` to cmdx Node
Fastest conversion from absolute path to Node
Arguments:
path (str): Absolute or relative path to DAG or DG node | cmdx.py | encode | fvbehr/cmdx | python | def encode(path):
'Convert relative or absolute `path` to cmdx Node\n\n Fastest conversion from absolute path to Node\n\n Arguments:\n path (str): Absolute or relative path to DAG or DG node\n\n '
assert isinstance(path, string_types), ('%s was not string' % path)
selectionList = om.MSelecti... |
def fromHash(code, default=None):
'Get existing node from MObjectHandle.hashCode()'
try:
return Singleton._instances[('%x' % code)]
except KeyError:
return default | -779,055,603,039,526,500 | Get existing node from MObjectHandle.hashCode() | cmdx.py | fromHash | fvbehr/cmdx | python | def fromHash(code, default=None):
try:
return Singleton._instances[('%x' % code)]
except KeyError:
return default |
def fromHex(hex, default=None, safe=True):
'Get existing node from Node.hex'
node = Singleton._instances.get(hex, default)
if (safe and node and node.exists):
return node
else:
return node | -8,415,511,792,610,757,000 | Get existing node from Node.hex | cmdx.py | fromHex | fvbehr/cmdx | python | def fromHex(hex, default=None, safe=True):
node = Singleton._instances.get(hex, default)
if (safe and node and node.exists):
return node
else:
return node |
def toHash(mobj):
'Cache the given `mobj` and return its hashCode\n\n This enables pre-caching of one or more nodes in situations where\n intend to access it later, at a more performance-critical moment.\n\n Ignores nodes that have already been cached.\n\n '
node = Node(mobj)
return node.hashCod... | 4,412,574,546,097,724,400 | Cache the given `mobj` and return its hashCode
This enables pre-caching of one or more nodes in situations where
intend to access it later, at a more performance-critical moment.
Ignores nodes that have already been cached. | cmdx.py | toHash | fvbehr/cmdx | python | def toHash(mobj):
'Cache the given `mobj` and return its hashCode\n\n This enables pre-caching of one or more nodes in situations where\n intend to access it later, at a more performance-critical moment.\n\n Ignores nodes that have already been cached.\n\n '
node = Node(mobj)
return node.hashCod... |
def toHex(mobj):
'Cache the given `mobj` and return its hex value\n\n See :func:`toHash` for docstring.\n\n '
node = Node(mobj)
return node.hex | -2,377,513,751,368,329,700 | Cache the given `mobj` and return its hex value
See :func:`toHash` for docstring. | cmdx.py | toHex | fvbehr/cmdx | python | def toHex(mobj):
'Cache the given `mobj` and return its hex value\n\n See :func:`toHash` for docstring.\n\n '
node = Node(mobj)
return node.hex |
def asHash(mobj):
'Return a given hashCode for `mobj`, without caching it\n\n This can be helpful in case you wish to synchronise `cmdx`\n with a third-party library or tool and wish to guarantee\n that an identical algorithm is used.\n\n '
handle = om.MObjectHandle(mobj)
return handle.hashCode(... | 623,203,837,139,447,900 | Return a given hashCode for `mobj`, without caching it
This can be helpful in case you wish to synchronise `cmdx`
with a third-party library or tool and wish to guarantee
that an identical algorithm is used. | cmdx.py | asHash | fvbehr/cmdx | python | def asHash(mobj):
'Return a given hashCode for `mobj`, without caching it\n\n This can be helpful in case you wish to synchronise `cmdx`\n with a third-party library or tool and wish to guarantee\n that an identical algorithm is used.\n\n '
handle = om.MObjectHandle(mobj)
return handle.hashCode(... |
def asHex(mobj):
'Return a given hex string for `mobj`, without caching it\n\n See docstring for :func:`asHash` for details\n\n '
return ('%x' % asHash(mobj)) | -4,880,126,403,296,916,000 | Return a given hex string for `mobj`, without caching it
See docstring for :func:`asHash` for details | cmdx.py | asHex | fvbehr/cmdx | python | def asHex(mobj):
'Return a given hex string for `mobj`, without caching it\n\n See docstring for :func:`asHash` for details\n\n '
return ('%x' % asHash(mobj)) |
def meters(cm):
"Centimeters (Maya's default unit) to Meters\n\n Example:\n >>> meters(100)\n 1.0\n\n "
return (cm * 0.01) | -3,570,937,588,544,551,000 | Centimeters (Maya's default unit) to Meters
Example:
>>> meters(100)
1.0 | cmdx.py | meters | fvbehr/cmdx | python | def meters(cm):
"Centimeters (Maya's default unit) to Meters\n\n Example:\n >>> meters(100)\n 1.0\n\n "
return (cm * 0.01) |
def clear():
'Remove all reused nodes'
Singleton._instances.clear() | -312,182,393,654,529,150 | Remove all reused nodes | cmdx.py | clear | fvbehr/cmdx | python | def clear():
Singleton._instances.clear() |
def _encode1(path):
'Convert `path` to Maya API 1.0 MObject\n\n Arguments:\n path (str): Absolute or relative path to DAG or DG node\n\n Raises:\n ExistError on `path` not existing\n\n '
selectionList = om1.MSelectionList()
try:
selectionList.add(path)
except RuntimeError:... | 962,091,573,452,979,100 | Convert `path` to Maya API 1.0 MObject
Arguments:
path (str): Absolute or relative path to DAG or DG node
Raises:
ExistError on `path` not existing | cmdx.py | _encode1 | fvbehr/cmdx | python | def _encode1(path):
'Convert `path` to Maya API 1.0 MObject\n\n Arguments:\n path (str): Absolute or relative path to DAG or DG node\n\n Raises:\n ExistError on `path` not existing\n\n '
selectionList = om1.MSelectionList()
try:
selectionList.add(path)
except RuntimeError:... |
def _encodedagpath1(path):
'Convert `path` to Maya API 1.0 MObject\n\n Arguments:\n path (str): Absolute or relative path to DAG or DG node\n\n Raises:\n ExistError on `path` not existing\n\n '
selectionList = om1.MSelectionList()
try:
selectionList.add(path)
except Runtim... | -2,508,639,482,950,188,500 | Convert `path` to Maya API 1.0 MObject
Arguments:
path (str): Absolute or relative path to DAG or DG node
Raises:
ExistError on `path` not existing | cmdx.py | _encodedagpath1 | fvbehr/cmdx | python | def _encodedagpath1(path):
'Convert `path` to Maya API 1.0 MObject\n\n Arguments:\n path (str): Absolute or relative path to DAG or DG node\n\n Raises:\n ExistError on `path` not existing\n\n '
selectionList = om1.MSelectionList()
try:
selectionList.add(path)
except Runtim... |
def decode(node):
'Convert cmdx Node to shortest unique path\n\n This is the same as `node.shortestPath()`\n To get an absolute path, use `node.path()`\n\n '
try:
return node.shortestPath()
except AttributeError:
return node.name(namespace=True) | -4,636,056,238,598,363,000 | Convert cmdx Node to shortest unique path
This is the same as `node.shortestPath()`
To get an absolute path, use `node.path()` | cmdx.py | decode | fvbehr/cmdx | python | def decode(node):
'Convert cmdx Node to shortest unique path\n\n This is the same as `node.shortestPath()`\n To get an absolute path, use `node.path()`\n\n '
try:
return node.shortestPath()
except AttributeError:
return node.name(namespace=True) |
def createNode(type, name=None, parent=None):
'Create a new node\n\n This function forms the basic building block\n with which to create new nodes in Maya.\n\n .. note:: Missing arguments `shared` and `skipSelect`\n .. tip:: For additional performance, `type` may be given as an MTypeId\n\n Arguments:... | 913,879,734,073,910,300 | Create a new node
This function forms the basic building block
with which to create new nodes in Maya.
.. note:: Missing arguments `shared` and `skipSelect`
.. tip:: For additional performance, `type` may be given as an MTypeId
Arguments:
type (str): Type name of new node, e.g. "transform"
name (str, optiona... | cmdx.py | createNode | fvbehr/cmdx | python | def createNode(type, name=None, parent=None):
'Create a new node\n\n This function forms the basic building block\n with which to create new nodes in Maya.\n\n .. note:: Missing arguments `shared` and `skipSelect`\n .. tip:: For additional performance, `type` may be given as an MTypeId\n\n Arguments:... |
def getAttr(attr, type=None, time=None):
'Read `attr`\n\n Arguments:\n attr (Plug): Attribute as a cmdx.Plug\n type (str, optional): Unused\n time (float, optional): Time at which to evaluate the attribute\n\n Example:\n >>> node = createNode("transform")\n >>> getAttr(node ... | 1,755,435,229,108,206,600 | Read `attr`
Arguments:
attr (Plug): Attribute as a cmdx.Plug
type (str, optional): Unused
time (float, optional): Time at which to evaluate the attribute
Example:
>>> node = createNode("transform")
>>> getAttr(node + ".translateX")
0.0 | cmdx.py | getAttr | fvbehr/cmdx | python | def getAttr(attr, type=None, time=None):
'Read `attr`\n\n Arguments:\n attr (Plug): Attribute as a cmdx.Plug\n type (str, optional): Unused\n time (float, optional): Time at which to evaluate the attribute\n\n Example:\n >>> node = createNode("transform")\n >>> getAttr(node ... |
def setAttr(attr, value, type=None):
'Write `value` to `attr`\n\n Arguments:\n attr (Plug): Existing attribute to edit\n value (any): Value to write\n type (int, optional): Unused\n\n Example:\n >>> node = createNode("transform")\n >>> setAttr(node + ".translateX", 5.0)\n\n ... | 2,888,335,193,053,292,000 | Write `value` to `attr`
Arguments:
attr (Plug): Existing attribute to edit
value (any): Value to write
type (int, optional): Unused
Example:
>>> node = createNode("transform")
>>> setAttr(node + ".translateX", 5.0) | cmdx.py | setAttr | fvbehr/cmdx | python | def setAttr(attr, value, type=None):
'Write `value` to `attr`\n\n Arguments:\n attr (Plug): Existing attribute to edit\n value (any): Value to write\n type (int, optional): Unused\n\n Example:\n >>> node = createNode("transform")\n >>> setAttr(node + ".translateX", 5.0)\n\n ... |
def addAttr(node, longName, attributeType, shortName=None, enumName=None, defaultValue=None):
'Add new attribute to `node`\n\n Arguments:\n node (Node): Add attribute to this node\n longName (str): Name of resulting attribute\n attributeType (str): Type of attribute, e.g. `string`\n s... | -2,912,810,700,619,053,000 | Add new attribute to `node`
Arguments:
node (Node): Add attribute to this node
longName (str): Name of resulting attribute
attributeType (str): Type of attribute, e.g. `string`
shortName (str, optional): Alternate name of attribute
enumName (str, optional): Options for an enum attribute
default... | cmdx.py | addAttr | fvbehr/cmdx | python | def addAttr(node, longName, attributeType, shortName=None, enumName=None, defaultValue=None):
'Add new attribute to `node`\n\n Arguments:\n node (Node): Add attribute to this node\n longName (str): Name of resulting attribute\n attributeType (str): Type of attribute, e.g. `string`\n s... |
def listRelatives(node, type=None, children=False, allDescendents=False, parent=False, shapes=False):
'List relatives of `node`\n\n Arguments:\n node (DagNode): Node to enquire about\n type (int, optional): Only return nodes of this type\n children (bool, optional): Return children of `node`... | 6,192,445,623,260,339,000 | List relatives of `node`
Arguments:
node (DagNode): Node to enquire about
type (int, optional): Only return nodes of this type
children (bool, optional): Return children of `node`
parent (bool, optional): Return parent of `node`
shapes (bool, optional): Return only children that are shapes
allD... | cmdx.py | listRelatives | fvbehr/cmdx | python | def listRelatives(node, type=None, children=False, allDescendents=False, parent=False, shapes=False):
'List relatives of `node`\n\n Arguments:\n node (DagNode): Node to enquire about\n type (int, optional): Only return nodes of this type\n children (bool, optional): Return children of `node`... |
def listConnections(attr):
'List connections of `attr`\n\n Arguments:\n attr (Plug or Node):\n\n Example:\n >>> node1 = createNode("transform")\n >>> node2 = createNode("mesh", parent=node1)\n >>> node1["v"] >> node2["v"]\n >>> listConnections(node1) == [node2]\n True... | -3,154,410,947,409,816,000 | List connections of `attr`
Arguments:
attr (Plug or Node):
Example:
>>> node1 = createNode("transform")
>>> node2 = createNode("mesh", parent=node1)
>>> node1["v"] >> node2["v"]
>>> listConnections(node1) == [node2]
True
>>> listConnections(node1 + ".v") == [node2]
True
>>> listCon... | cmdx.py | listConnections | fvbehr/cmdx | python | def listConnections(attr):
'List connections of `attr`\n\n Arguments:\n attr (Plug or Node):\n\n Example:\n >>> node1 = createNode("transform")\n >>> node2 = createNode("mesh", parent=node1)\n >>> node1["v"] >> node2["v"]\n >>> listConnections(node1) == [node2]\n True... |
def connectAttr(src, dst):
'Connect `src` to `dst`\n\n Arguments:\n src (Plug): Source plug\n dst (Plug): Destination plug\n\n Example:\n >>> src = createNode("transform")\n >>> dst = createNode("transform")\n >>> connectAttr(src + ".rotateX", dst + ".scaleY")\n\n '
s... | 8,954,620,462,276,712,000 | Connect `src` to `dst`
Arguments:
src (Plug): Source plug
dst (Plug): Destination plug
Example:
>>> src = createNode("transform")
>>> dst = createNode("transform")
>>> connectAttr(src + ".rotateX", dst + ".scaleY") | cmdx.py | connectAttr | fvbehr/cmdx | python | def connectAttr(src, dst):
'Connect `src` to `dst`\n\n Arguments:\n src (Plug): Source plug\n dst (Plug): Destination plug\n\n Example:\n >>> src = createNode("transform")\n >>> dst = createNode("transform")\n >>> connectAttr(src + ".rotateX", dst + ".scaleY")\n\n '
s... |
def curve(parent, points, degree=1, form=kOpen):
'Create a NURBS curve from a series of points\n\n Arguments:\n parent (DagNode): Parent to resulting shape node\n points (list): One tuples per point, with 3 floats each\n degree (int, optional): Degree of curve, 1 is linear\n form (int... | 2,621,312,259,576,523,300 | Create a NURBS curve from a series of points
Arguments:
parent (DagNode): Parent to resulting shape node
points (list): One tuples per point, with 3 floats each
degree (int, optional): Degree of curve, 1 is linear
form (int, optional): Whether to close the curve or not
Example:
>>> parent = create... | cmdx.py | curve | fvbehr/cmdx | python | def curve(parent, points, degree=1, form=kOpen):
'Create a NURBS curve from a series of points\n\n Arguments:\n parent (DagNode): Parent to resulting shape node\n points (list): One tuples per point, with 3 floats each\n degree (int, optional): Degree of curve, 1 is linear\n form (int... |
def lookAt(origin, center, up=None):
'Build a (left-handed) look-at matrix\n\n See glm::glc::matrix_transform::lookAt for reference\n\n + Z (up)\n /\n /\n (origin) o------ + X (center)\n + Y\n\n Arguments:\n origin (Vector): Starting position\n ... | 6,781,457,938,299,411,000 | Build a (left-handed) look-at matrix
See glm::glc::matrix_transform::lookAt for reference
+ Z (up)
/
/
(origin) o------ + X (center)
+ Y
Arguments:
origin (Vector): Starting position
center (Vector): Point towards this
up (Vector, optional): Up facing this way, ... | cmdx.py | lookAt | fvbehr/cmdx | python | def lookAt(origin, center, up=None):
'Build a (left-handed) look-at matrix\n\n See glm::glc::matrix_transform::lookAt for reference\n\n + Z (up)\n /\n /\n (origin) o------ + X (center)\n + Y\n\n Arguments:\n origin (Vector): Starting position\n ... |
def first(iterator, default=None):
'Return first member of an `iterator`\n\n Example:\n >>> def it():\n ... yield 1\n ... yield 2\n ... yield 3\n ...\n >>> first(it())\n 1\n\n '
return next(iterator, default) | 6,883,098,760,134,999,000 | Return first member of an `iterator`
Example:
>>> def it():
... yield 1
... yield 2
... yield 3
...
>>> first(it())
1 | cmdx.py | first | fvbehr/cmdx | python | def first(iterator, default=None):
'Return first member of an `iterator`\n\n Example:\n >>> def it():\n ... yield 1\n ... yield 2\n ... yield 3\n ...\n >>> first(it())\n 1\n\n '
return next(iterator, default) |
def last(iterator, default=None):
'Return last member of an `iterator`\n\n Example:\n >>> def it():\n ... yield 1\n ... yield 2\n ... yield 3\n ...\n >>> last(it())\n 3\n\n '
last = default
for member in iterator:
last = member
return ... | -4,751,365,905,604,169,000 | Return last member of an `iterator`
Example:
>>> def it():
... yield 1
... yield 2
... yield 3
...
>>> last(it())
3 | cmdx.py | last | fvbehr/cmdx | python | def last(iterator, default=None):
'Return last member of an `iterator`\n\n Example:\n >>> def it():\n ... yield 1\n ... yield 2\n ... yield 3\n ...\n >>> last(it())\n 3\n\n '
last = default
for member in iterator:
last = member
return ... |
def commit(undo, redo=(lambda : None)):
'Commit `undo` and `redo` to history\n\n Arguments:\n undo (func): Call this function on next undo\n redo (func, optional): Like `undo`, for for redo\n\n '
if (not ENABLE_UNDO):
return
if (not hasattr(cmds, command)):
install()
... | 686,232,892,509,046,300 | Commit `undo` and `redo` to history
Arguments:
undo (func): Call this function on next undo
redo (func, optional): Like `undo`, for for redo | cmdx.py | commit | fvbehr/cmdx | python | def commit(undo, redo=(lambda : None)):
'Commit `undo` and `redo` to history\n\n Arguments:\n undo (func): Call this function on next undo\n redo (func, optional): Like `undo`, for for redo\n\n '
if (not ENABLE_UNDO):
return
if (not hasattr(cmds, command)):
install()
... |
def install():
'Load this shared as a plug-in\n\n Call this prior to using the shared\n\n '
if ENABLE_UNDO:
cmds.loadPlugin(__file__, quiet=True)
self.installed = True | -5,349,846,116,969,325,000 | Load this shared as a plug-in
Call this prior to using the shared | cmdx.py | install | fvbehr/cmdx | python | def install():
'Load this shared as a plug-in\n\n Call this prior to using the shared\n\n '
if ENABLE_UNDO:
cmds.loadPlugin(__file__, quiet=True)
self.installed = True |
def findPlugin(name):
'Find the original class of a plug-in by `name`'
try:
return InstalledPlugins[name]
except KeyError:
raise ExistError(("'%s' is not a recognised plug-in" % name)) | -2,457,719,582,756,939,300 | Find the original class of a plug-in by `name` | cmdx.py | findPlugin | fvbehr/cmdx | python | def findPlugin(name):
try:
return InstalledPlugins[name]
except KeyError:
raise ExistError(("'%s' is not a recognised plug-in" % name)) |
def __eq__(self, other):
'MObject supports this operator explicitly'
try:
return (self._mobject == other._mobject)
except AttributeError:
return (str(self) == str(other)) | 1,662,863,173,826,148,000 | MObject supports this operator explicitly | cmdx.py | __eq__ | fvbehr/cmdx | python | def __eq__(self, other):
try:
return (self._mobject == other._mobject)
except AttributeError:
return (str(self) == str(other)) |
def __add__(self, other):
'Support legacy + \'.attr\' behavior\n\n Example:\n >>> node = createNode("transform")\n >>> getAttr(node + ".tx")\n 0.0\n >>> delete(node)\n\n '
return self[other.strip('.')] | -4,542,163,359,849,990,700 | Support legacy + '.attr' behavior
Example:
>>> node = createNode("transform")
>>> getAttr(node + ".tx")
0.0
>>> delete(node) | cmdx.py | __add__ | fvbehr/cmdx | python | def __add__(self, other):
'Support legacy + \'.attr\' behavior\n\n Example:\n >>> node = createNode("transform")\n >>> getAttr(node + ".tx")\n 0.0\n >>> delete(node)\n\n '
return self[other.strip('.')] |
def __contains__(self, other):
'Does the attribute `other` exist?'
return self.hasAttr(other) | 3,437,677,476,302,128,600 | Does the attribute `other` exist? | cmdx.py | __contains__ | fvbehr/cmdx | python | def __contains__(self, other):
return self.hasAttr(other) |
def __getitem__(self, key):
'Get plug from self\n\n Arguments:\n key (str, tuple): String lookup of attribute,\n optionally pass tuple to include unit.\n\n Example:\n >>> node = createNode("transform")\n >>> node["translate"] = (1, 1, 1)\n >>>... | -2,924,461,867,035,181,000 | Get plug from self
Arguments:
key (str, tuple): String lookup of attribute,
optionally pass tuple to include unit.
Example:
>>> node = createNode("transform")
>>> node["translate"] = (1, 1, 1)
>>> node["translate", Meters]
(0.01, 0.01, 0.01) | cmdx.py | __getitem__ | fvbehr/cmdx | python | def __getitem__(self, key):
'Get plug from self\n\n Arguments:\n key (str, tuple): String lookup of attribute,\n optionally pass tuple to include unit.\n\n Example:\n >>> node = createNode("transform")\n >>> node["translate"] = (1, 1, 1)\n >>>... |
def __setitem__(self, key, value):
'Support item assignment of new attributes or values\n\n Example:\n >>> _ = cmds.file(new=True, force=True)\n >>> node = createNode("transform", name="myNode")\n >>> node["myAttr"] = Double(default=1.0)\n >>> node["myAttr"] == 1.0... | -7,451,303,800,496,541,000 | Support item assignment of new attributes or values
Example:
>>> _ = cmds.file(new=True, force=True)
>>> node = createNode("transform", name="myNode")
>>> node["myAttr"] = Double(default=1.0)
>>> node["myAttr"] == 1.0
True
>>> node["rotateX", Degrees] = 1.0
>>> node["rotateX"] = Degrees(1)
... | cmdx.py | __setitem__ | fvbehr/cmdx | python | def __setitem__(self, key, value):
'Support item assignment of new attributes or values\n\n Example:\n >>> _ = cmds.file(new=True, force=True)\n >>> node = createNode("transform", name="myNode")\n >>> node["myAttr"] = Double(default=1.0)\n >>> node["myAttr"] == 1.0... |
@withTiming()
def __init__(self, mobject, exists=True, modifier=None):
'Initialise Node\n\n Private members:\n mobject (om.MObject): Wrap this MObject\n fn (om.MFnDependencyNode): The corresponding function set\n modifier (om.MDagModifier, optional): Operations are\n ... | 8,592,241,082,817,294,000 | Initialise Node
Private members:
mobject (om.MObject): Wrap this MObject
fn (om.MFnDependencyNode): The corresponding function set
modifier (om.MDagModifier, optional): Operations are
deferred to this modifier.
destroyed (bool): Has this node been destroyed by Maya?
state (dict): Optional s... | cmdx.py | __init__ | fvbehr/cmdx | python | @withTiming()
def __init__(self, mobject, exists=True, modifier=None):
'Initialise Node\n\n Private members:\n mobject (om.MObject): Wrap this MObject\n fn (om.MFnDependencyNode): The corresponding function set\n modifier (om.MDagModifier, optional): Operations are\n ... |
def plugin(self):
'Return the user-defined class of the plug-in behind this node'
return type(self._fn.userNode()) | -8,343,381,332,814,641,000 | Return the user-defined class of the plug-in behind this node | cmdx.py | plugin | fvbehr/cmdx | python | def plugin(self):
return type(self._fn.userNode()) |
def instance(self):
'Return the current plug-in instance of this node'
return self._fn.userNode() | 6,989,978,509,210,736,000 | Return the current plug-in instance of this node | cmdx.py | instance | fvbehr/cmdx | python | def instance(self):
return self._fn.userNode() |
def object(self):
'Return MObject of this node'
return self._mobject | -2,894,038,405,073,490,000 | Return MObject of this node | cmdx.py | object | fvbehr/cmdx | python | def object(self):
return self._mobject |
def isAlive(self):
'The node exists somewhere in memory'
return (not self._destroyed) | 3,206,443,701,243,128,300 | The node exists somewhere in memory | cmdx.py | isAlive | fvbehr/cmdx | python | def isAlive(self):
return (not self._destroyed) |
@property
def data(self):
'Special handling for data stored in the instance\n\n Normally, the initialisation of data could happen in the __init__,\n but for some reason the postConstructor of a custom plug-in calls\n __init__ twice for every unique hex, which causes any data added\n ther... | -2,381,850,114,063,403,500 | Special handling for data stored in the instance
Normally, the initialisation of data could happen in the __init__,
but for some reason the postConstructor of a custom plug-in calls
__init__ twice for every unique hex, which causes any data added
there to be wiped out once the postConstructor is done. | cmdx.py | data | fvbehr/cmdx | python | @property
def data(self):
'Special handling for data stored in the instance\n\n Normally, the initialisation of data could happen in the __init__,\n but for some reason the postConstructor of a custom plug-in calls\n __init__ twice for every unique hex, which causes any data added\n ther... |
@property
def exists(self):
'The node exists in both memory *and* scene\n\n Example:\n >>> node = createNode("joint")\n >>> node.exists\n True\n >>> cmds.delete(str(node))\n >>> node.exists\n False\n >>> node.destroyed\n ... | 8,187,415,923,217,228,000 | The node exists in both memory *and* scene
Example:
>>> node = createNode("joint")
>>> node.exists
True
>>> cmds.delete(str(node))
>>> node.exists
False
>>> node.destroyed
False
>>> _ = cmds.file(new=True, force=True)
>>> node.exists
False
>>> node.destroyed
True | cmdx.py | exists | fvbehr/cmdx | python | @property
def exists(self):
'The node exists in both memory *and* scene\n\n Example:\n >>> node = createNode("joint")\n >>> node.exists\n True\n >>> cmds.delete(str(node))\n >>> node.exists\n False\n >>> node.destroyed\n ... |
@property
def hashCode(self):
'Return MObjectHandle.hashCode of this node\n\n This a guaranteed-unique integer (long in Python 2)\n similar to the UUID of Maya 2016\n\n '
return self._hashCode | 6,138,801,481,474,258,000 | Return MObjectHandle.hashCode of this node
This a guaranteed-unique integer (long in Python 2)
similar to the UUID of Maya 2016 | cmdx.py | hashCode | fvbehr/cmdx | python | @property
def hashCode(self):
'Return MObjectHandle.hashCode of this node\n\n This a guaranteed-unique integer (long in Python 2)\n similar to the UUID of Maya 2016\n\n '
return self._hashCode |
@property
def hexStr(self):
'Return unique hashCode as hexadecimal string\n\n Example:\n >>> node = createNode("transform")\n >>> node.hexStr == format(node.hashCode, "x")\n True\n\n '
return self._hexStr | 8,393,172,980,965,556,000 | Return unique hashCode as hexadecimal string
Example:
>>> node = createNode("transform")
>>> node.hexStr == format(node.hashCode, "x")
True | cmdx.py | hexStr | fvbehr/cmdx | python | @property
def hexStr(self):
'Return unique hashCode as hexadecimal string\n\n Example:\n >>> node = createNode("transform")\n >>> node.hexStr == format(node.hashCode, "x")\n True\n\n '
return self._hexStr |
@property
def typeId(self):
'Return the native maya.api.MTypeId of this node\n\n Example:\n >>> node = createNode("transform")\n >>> node.typeId == tTransform\n True\n\n '
return self._fn.typeId | -2,107,388,808,234,822,000 | Return the native maya.api.MTypeId of this node
Example:
>>> node = createNode("transform")
>>> node.typeId == tTransform
True | cmdx.py | typeId | fvbehr/cmdx | python | @property
def typeId(self):
'Return the native maya.api.MTypeId of this node\n\n Example:\n >>> node = createNode("transform")\n >>> node.typeId == tTransform\n True\n\n '
return self._fn.typeId |
def isA(self, type):
'Evaluate whether self is of `type`\n\n Arguments:\n type (int): MFn function set constant\n\n Example:\n >>> node = createNode("transform")\n >>> node.isA(kTransform)\n True\n >>> node.isA(kShape)\n False\n\n ... | -4,339,258,898,542,097,000 | Evaluate whether self is of `type`
Arguments:
type (int): MFn function set constant
Example:
>>> node = createNode("transform")
>>> node.isA(kTransform)
True
>>> node.isA(kShape)
False | cmdx.py | isA | fvbehr/cmdx | python | def isA(self, type):
'Evaluate whether self is of `type`\n\n Arguments:\n type (int): MFn function set constant\n\n Example:\n >>> node = createNode("transform")\n >>> node.isA(kTransform)\n True\n >>> node.isA(kShape)\n False\n\n ... |
@property
def storable(self):
'Whether or not to save this node with the file'
return None | 59,265,570,661,141,010 | Whether or not to save this node with the file | cmdx.py | storable | fvbehr/cmdx | python | @property
def storable(self):
return None |
@withTiming('findPlug() reuse {time:.4f} ns')
def findPlug(self, name, cached=False):
'Cache previously found plugs, for performance\n\n Cost: 4.9 microseconds/call\n\n Part of the time taken in querying an attribute is the\n act of finding a plug given its name as a string.\n\n This cau... | -5,004,697,658,754,552,000 | Cache previously found plugs, for performance
Cost: 4.9 microseconds/call
Part of the time taken in querying an attribute is the
act of finding a plug given its name as a string.
This causes a 25% reduction in time taken for repeated
attribute queries. Though keep in mind that state is stored
in the `cmdx` object wh... | cmdx.py | findPlug | fvbehr/cmdx | python | @withTiming('findPlug() reuse {time:.4f} ns')
def findPlug(self, name, cached=False):
'Cache previously found plugs, for performance\n\n Cost: 4.9 microseconds/call\n\n Part of the time taken in querying an attribute is the\n act of finding a plug given its name as a string.\n\n This cau... |
def update(self, attrs):
'Apply a series of attributes all at once\n\n This operates similar to a Python dictionary.\n\n Arguments:\n attrs (dict): Key/value pairs of name and attribute\n\n Examples:\n >>> node = createNode("transform")\n >>> node.update({"tx": ... | -4,940,603,168,361,517,000 | Apply a series of attributes all at once
This operates similar to a Python dictionary.
Arguments:
attrs (dict): Key/value pairs of name and attribute
Examples:
>>> node = createNode("transform")
>>> node.update({"tx": 5.0, ("ry", Degrees): 30.0})
>>> node["tx"]
5.0 | cmdx.py | update | fvbehr/cmdx | python | def update(self, attrs):
'Apply a series of attributes all at once\n\n This operates similar to a Python dictionary.\n\n Arguments:\n attrs (dict): Key/value pairs of name and attribute\n\n Examples:\n >>> node = createNode("transform")\n >>> node.update({"tx": ... |
def clear(self):
'Clear transient state\n\n A node may cache previously queried values for performance\n at the expense of memory. This method erases any cached\n values, freeing up memory at the expense of performance.\n\n Example:\n >>> node = createNode("transform")\n ... | 4,240,554,032,611,138,000 | Clear transient state
A node may cache previously queried values for performance
at the expense of memory. This method erases any cached
values, freeing up memory at the expense of performance.
Example:
>>> node = createNode("transform")
>>> node["translateX"] = 5
>>> node["translateX"]
5.0
>>> # ... | cmdx.py | clear | fvbehr/cmdx | python | def clear(self):
'Clear transient state\n\n A node may cache previously queried values for performance\n at the expense of memory. This method erases any cached\n values, freeing up memory at the expense of performance.\n\n Example:\n >>> node = createNode("transform")\n ... |
@protected
def name(self, namespace=False):
'Return the name of this node\n\n Arguments:\n namespace (bool, optional): Return with namespace,\n defaults to False\n\n Example:\n >>> node = createNode("transform", name="myName")\n >>> node.name()\n ... | 4,953,245,960,046,820,000 | Return the name of this node
Arguments:
namespace (bool, optional): Return with namespace,
defaults to False
Example:
>>> node = createNode("transform", name="myName")
>>> node.name()
u'myName' | cmdx.py | name | fvbehr/cmdx | python | @protected
def name(self, namespace=False):
'Return the name of this node\n\n Arguments:\n namespace (bool, optional): Return with namespace,\n defaults to False\n\n Example:\n >>> node = createNode("transform", name="myName")\n >>> node.name()\n ... |
def namespace(self):
'Get namespace of node\n\n Example:\n >>> _ = cmds.file(new=True, force=True)\n >>> node = createNode("transform", name="myNode")\n >>> node.namespace()\n u\'\'\n >>> _ = cmds.namespace(add=":A")\n >>> _ = cmds.namespace(a... | 2,306,088,550,495,356,000 | Get namespace of node
Example:
>>> _ = cmds.file(new=True, force=True)
>>> node = createNode("transform", name="myNode")
>>> node.namespace()
u''
>>> _ = cmds.namespace(add=":A")
>>> _ = cmds.namespace(add=":A:B")
>>> node = createNode("transform", name=":A:B:myNode")
>>> node.namespace... | cmdx.py | namespace | fvbehr/cmdx | python | def namespace(self):
'Get namespace of node\n\n Example:\n >>> _ = cmds.file(new=True, force=True)\n >>> node = createNode("transform", name="myNode")\n >>> node.namespace()\n u\'\'\n >>> _ = cmds.namespace(add=":A")\n >>> _ = cmds.namespace(a... |
def pop(self, key):
'Delete an attribute\n\n Arguments:\n key (str): Name of attribute to delete\n\n Example:\n >>> node = createNode("transform")\n >>> node["myAttr"] = Double()\n >>> node.pop("myAttr")\n >>> node.hasAttr("myAttr")\n F... | 321,921,154,133,839,940 | Delete an attribute
Arguments:
key (str): Name of attribute to delete
Example:
>>> node = createNode("transform")
>>> node["myAttr"] = Double()
>>> node.pop("myAttr")
>>> node.hasAttr("myAttr")
False | cmdx.py | pop | fvbehr/cmdx | python | def pop(self, key):
'Delete an attribute\n\n Arguments:\n key (str): Name of attribute to delete\n\n Example:\n >>> node = createNode("transform")\n >>> node["myAttr"] = Double()\n >>> node.pop("myAttr")\n >>> node.hasAttr("myAttr")\n F... |
def dump(self, ignore_error=True):
'Return dictionary of all attributes\n\n Example:\n >>> import json\n >>> _ = cmds.file(new=True, force=True)\n >>> node = createNode("choice")\n >>> dump = node.dump()\n >>> isinstance(dump, dict)\n True\n ... | 2,472,120,626,968,427,500 | Return dictionary of all attributes
Example:
>>> import json
>>> _ = cmds.file(new=True, force=True)
>>> node = createNode("choice")
>>> dump = node.dump()
>>> isinstance(dump, dict)
True
>>> dump["choice1.caching"]
False | cmdx.py | dump | fvbehr/cmdx | python | def dump(self, ignore_error=True):
'Return dictionary of all attributes\n\n Example:\n >>> import json\n >>> _ = cmds.file(new=True, force=True)\n >>> node = createNode("choice")\n >>> dump = node.dump()\n >>> isinstance(dump, dict)\n True\n ... |
def dumps(self, indent=4, sortKeys=True):
'Return a JSON compatible dictionary of all attributes'
return json.dumps(self.dump(), indent=indent, sort_keys=sortKeys) | 3,366,320,842,954,178,000 | Return a JSON compatible dictionary of all attributes | cmdx.py | dumps | fvbehr/cmdx | python | def dumps(self, indent=4, sortKeys=True):
return json.dumps(self.dump(), indent=indent, sort_keys=sortKeys) |
def type(self):
'Return type name\n\n Example:\n >>> node = createNode("choice")\n >>> node.type()\n u\'choice\'\n\n '
return self._fn.typeName | -1,410,811,883,108,725,800 | Return type name
Example:
>>> node = createNode("choice")
>>> node.type()
u'choice' | cmdx.py | type | fvbehr/cmdx | python | def type(self):
'Return type name\n\n Example:\n >>> node = createNode("choice")\n >>> node.type()\n u\'choice\'\n\n '
return self._fn.typeName |
def addAttr(self, attr):
'Add a new dynamic attribute to node\n\n Arguments:\n attr (Plug): Add this attribute\n\n Example:\n >>> node = createNode("transform")\n >>> attr = Double("myAttr", default=5.0)\n >>> node.addAttr(attr)\n >>> node["myAttr... | 6,901,022,088,270,368,000 | Add a new dynamic attribute to node
Arguments:
attr (Plug): Add this attribute
Example:
>>> node = createNode("transform")
>>> attr = Double("myAttr", default=5.0)
>>> node.addAttr(attr)
>>> node["myAttr"] == 5.0
True | cmdx.py | addAttr | fvbehr/cmdx | python | def addAttr(self, attr):
'Add a new dynamic attribute to node\n\n Arguments:\n attr (Plug): Add this attribute\n\n Example:\n >>> node = createNode("transform")\n >>> attr = Double("myAttr", default=5.0)\n >>> node.addAttr(attr)\n >>> node["myAttr... |
def hasAttr(self, attr):
'Return whether or not `attr` exists\n\n Arguments:\n attr (str): Name of attribute to check\n\n Example:\n >>> node = createNode("transform")\n >>> node.hasAttr("mysteryAttribute")\n False\n >>> node.hasAttr("translateX")... | 4,437,251,695,110,137,000 | Return whether or not `attr` exists
Arguments:
attr (str): Name of attribute to check
Example:
>>> node = createNode("transform")
>>> node.hasAttr("mysteryAttribute")
False
>>> node.hasAttr("translateX")
True
>>> node["myAttr"] = Double() # Dynamic attribute
>>> node.hasAttr("myAttr")... | cmdx.py | hasAttr | fvbehr/cmdx | python | def hasAttr(self, attr):
'Return whether or not `attr` exists\n\n Arguments:\n attr (str): Name of attribute to check\n\n Example:\n >>> node = createNode("transform")\n >>> node.hasAttr("mysteryAttribute")\n False\n >>> node.hasAttr("translateX")... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.