id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
50,100 | facundobatista/yaswfp | yaswfp/swfparser.py | SWFParser._handle_tag_definesprite | def _handle_tag_definesprite(self):
"""Handle the DefineSprite tag."""
obj = _make_object("DefineSprite")
obj.CharacterID = unpack_ui16(self._src)
obj.FrameCount = unpack_ui16(self._src)
tags = self._process_tags()
obj.ControlTags = tags
return obj | python | def _handle_tag_definesprite(self):
"""Handle the DefineSprite tag."""
obj = _make_object("DefineSprite")
obj.CharacterID = unpack_ui16(self._src)
obj.FrameCount = unpack_ui16(self._src)
tags = self._process_tags()
obj.ControlTags = tags
return obj | [
"def",
"_handle_tag_definesprite",
"(",
"self",
")",
":",
"obj",
"=",
"_make_object",
"(",
"\"DefineSprite\"",
")",
"obj",
".",
"CharacterID",
"=",
"unpack_ui16",
"(",
"self",
".",
"_src",
")",
"obj",
".",
"FrameCount",
"=",
"unpack_ui16",
"(",
"self",
".",
... | Handle the DefineSprite tag. | [
"Handle",
"the",
"DefineSprite",
"tag",
"."
] | 2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c | https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/swfparser.py#L590-L597 |
50,101 | facundobatista/yaswfp | yaswfp/swfparser.py | SWFParser._generic_action_parser | def _generic_action_parser(self):
"""Generic parser for Actions."""
actions = []
while True:
action_code = unpack_ui8(self._src)
if action_code == 0:
break
action_name = ACTION_NAMES[action_code]
if action_code > 128:
... | python | def _generic_action_parser(self):
"""Generic parser for Actions."""
actions = []
while True:
action_code = unpack_ui8(self._src)
if action_code == 0:
break
action_name = ACTION_NAMES[action_code]
if action_code > 128:
... | [
"def",
"_generic_action_parser",
"(",
"self",
")",
":",
"actions",
"=",
"[",
"]",
"while",
"True",
":",
"action_code",
"=",
"unpack_ui8",
"(",
"self",
".",
"_src",
")",
"if",
"action_code",
"==",
"0",
":",
"break",
"action_name",
"=",
"ACTION_NAMES",
"[",
... | Generic parser for Actions. | [
"Generic",
"parser",
"for",
"Actions",
"."
] | 2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c | https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/swfparser.py#L599-L640 |
50,102 | facundobatista/yaswfp | yaswfp/swfparser.py | SWFParser._handle_tag_fileattributes | def _handle_tag_fileattributes(self):
"""Handle the FileAttributes tag."""
obj = _make_object("FileAttributes")
bc = BitConsumer(self._src)
bc.u_get(1) # reserved
obj.UseDirectBlit = bc.u_get(1)
obj.UseGPU = bc.u_get(1)
obj.HasMetadata = bc.u_get(1)
obj.... | python | def _handle_tag_fileattributes(self):
"""Handle the FileAttributes tag."""
obj = _make_object("FileAttributes")
bc = BitConsumer(self._src)
bc.u_get(1) # reserved
obj.UseDirectBlit = bc.u_get(1)
obj.UseGPU = bc.u_get(1)
obj.HasMetadata = bc.u_get(1)
obj.... | [
"def",
"_handle_tag_fileattributes",
"(",
"self",
")",
":",
"obj",
"=",
"_make_object",
"(",
"\"FileAttributes\"",
")",
"bc",
"=",
"BitConsumer",
"(",
"self",
".",
"_src",
")",
"bc",
".",
"u_get",
"(",
"1",
")",
"# reserved",
"obj",
".",
"UseDirectBlit",
"... | Handle the FileAttributes tag. | [
"Handle",
"the",
"FileAttributes",
"tag",
"."
] | 2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c | https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/swfparser.py#L648-L661 |
50,103 | facundobatista/yaswfp | yaswfp/swfparser.py | SWFParser._handle_tag_definesceneandframelabeldata | def _handle_tag_definesceneandframelabeldata(self):
"""Handle the DefineSceneAndFrameLabelData tag."""
obj = _make_object("DefineSceneAndFrameLabelData")
obj.SceneCount = self._get_struct_encodedu32()
for i in range(1, obj.SceneCount + 1):
setattr(obj, 'Offset{}'.format(i), s... | python | def _handle_tag_definesceneandframelabeldata(self):
"""Handle the DefineSceneAndFrameLabelData tag."""
obj = _make_object("DefineSceneAndFrameLabelData")
obj.SceneCount = self._get_struct_encodedu32()
for i in range(1, obj.SceneCount + 1):
setattr(obj, 'Offset{}'.format(i), s... | [
"def",
"_handle_tag_definesceneandframelabeldata",
"(",
"self",
")",
":",
"obj",
"=",
"_make_object",
"(",
"\"DefineSceneAndFrameLabelData\"",
")",
"obj",
".",
"SceneCount",
"=",
"self",
".",
"_get_struct_encodedu32",
"(",
")",
"for",
"i",
"in",
"range",
"(",
"1",... | Handle the DefineSceneAndFrameLabelData tag. | [
"Handle",
"the",
"DefineSceneAndFrameLabelData",
"tag",
"."
] | 2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c | https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/swfparser.py#L675-L686 |
50,104 | facundobatista/yaswfp | yaswfp/swfparser.py | SWFParser._handle_tag_defineshape4 | def _handle_tag_defineshape4(self):
"""Handle the DefineShape4 tag."""
obj = _make_object("DefineShape4")
obj.ShapeId = unpack_ui16(self._src)
obj.ShapeBounds = self._get_struct_rect()
obj.EdgeBounds = self._get_struct_rect()
bc = BitConsumer(self._src)
bc.u_get(... | python | def _handle_tag_defineshape4(self):
"""Handle the DefineShape4 tag."""
obj = _make_object("DefineShape4")
obj.ShapeId = unpack_ui16(self._src)
obj.ShapeBounds = self._get_struct_rect()
obj.EdgeBounds = self._get_struct_rect()
bc = BitConsumer(self._src)
bc.u_get(... | [
"def",
"_handle_tag_defineshape4",
"(",
"self",
")",
":",
"obj",
"=",
"_make_object",
"(",
"\"DefineShape4\"",
")",
"obj",
".",
"ShapeId",
"=",
"unpack_ui16",
"(",
"self",
".",
"_src",
")",
"obj",
".",
"ShapeBounds",
"=",
"self",
".",
"_get_struct_rect",
"("... | Handle the DefineShape4 tag. | [
"Handle",
"the",
"DefineShape4",
"tag",
"."
] | 2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c | https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/swfparser.py#L688-L701 |
50,105 | facundobatista/yaswfp | yaswfp/swfparser.py | SWFParser._handle_tag_definemorphshape2 | def _handle_tag_definemorphshape2(self):
"""Handle the DefineMorphShape2 tag."""
obj = _make_object("DefineMorphShape2")
obj.CharacterId = unpack_ui16(self._src)
obj.StartBounds = self._get_struct_rect()
obj.EndBounds = self._get_struct_rect()
obj.StartEdgeBounds = self._... | python | def _handle_tag_definemorphshape2(self):
"""Handle the DefineMorphShape2 tag."""
obj = _make_object("DefineMorphShape2")
obj.CharacterId = unpack_ui16(self._src)
obj.StartBounds = self._get_struct_rect()
obj.EndBounds = self._get_struct_rect()
obj.StartEdgeBounds = self._... | [
"def",
"_handle_tag_definemorphshape2",
"(",
"self",
")",
":",
"obj",
"=",
"_make_object",
"(",
"\"DefineMorphShape2\"",
")",
"obj",
".",
"CharacterId",
"=",
"unpack_ui16",
"(",
"self",
".",
"_src",
")",
"obj",
".",
"StartBounds",
"=",
"self",
".",
"_get_struc... | Handle the DefineMorphShape2 tag. | [
"Handle",
"the",
"DefineMorphShape2",
"tag",
"."
] | 2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c | https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/swfparser.py#L703-L723 |
50,106 | facundobatista/yaswfp | yaswfp/swfparser.py | SWFParser._handle_tag_removeobject | def _handle_tag_removeobject(self):
"""Handle the RemoveObject tag."""
obj = _make_object("RemoveObject")
obj.CharacterId = unpack_ui16(self._src)
obj.Depth = unpack_ui16(self._src)
return obj | python | def _handle_tag_removeobject(self):
"""Handle the RemoveObject tag."""
obj = _make_object("RemoveObject")
obj.CharacterId = unpack_ui16(self._src)
obj.Depth = unpack_ui16(self._src)
return obj | [
"def",
"_handle_tag_removeobject",
"(",
"self",
")",
":",
"obj",
"=",
"_make_object",
"(",
"\"RemoveObject\"",
")",
"obj",
".",
"CharacterId",
"=",
"unpack_ui16",
"(",
"self",
".",
"_src",
")",
"obj",
".",
"Depth",
"=",
"unpack_ui16",
"(",
"self",
".",
"_s... | Handle the RemoveObject tag. | [
"Handle",
"the",
"RemoveObject",
"tag",
"."
] | 2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c | https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/swfparser.py#L729-L734 |
50,107 | facundobatista/yaswfp | yaswfp/swfparser.py | SWFParser._handle_tag_removeobject2 | def _handle_tag_removeobject2(self):
"""Handle the RemoveObject2 tag."""
obj = _make_object("RemoveObject2")
obj.Depth = unpack_ui16(self._src)
return obj | python | def _handle_tag_removeobject2(self):
"""Handle the RemoveObject2 tag."""
obj = _make_object("RemoveObject2")
obj.Depth = unpack_ui16(self._src)
return obj | [
"def",
"_handle_tag_removeobject2",
"(",
"self",
")",
":",
"obj",
"=",
"_make_object",
"(",
"\"RemoveObject2\"",
")",
"obj",
".",
"Depth",
"=",
"unpack_ui16",
"(",
"self",
".",
"_src",
")",
"return",
"obj"
] | Handle the RemoveObject2 tag. | [
"Handle",
"the",
"RemoveObject2",
"tag",
"."
] | 2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c | https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/swfparser.py#L736-L740 |
50,108 | facundobatista/yaswfp | yaswfp/swfparser.py | SWFParser._handle_tag_defineshape | def _handle_tag_defineshape(self):
"""Handle the DefineShape tag."""
obj = _make_object("DefineShape")
obj.ShapeId = unpack_ui16(self._src)
obj.ShapeBounds = self._get_struct_rect()
obj.Shapes = self._get_struct_shapewithstyle(1)
return obj | python | def _handle_tag_defineshape(self):
"""Handle the DefineShape tag."""
obj = _make_object("DefineShape")
obj.ShapeId = unpack_ui16(self._src)
obj.ShapeBounds = self._get_struct_rect()
obj.Shapes = self._get_struct_shapewithstyle(1)
return obj | [
"def",
"_handle_tag_defineshape",
"(",
"self",
")",
":",
"obj",
"=",
"_make_object",
"(",
"\"DefineShape\"",
")",
"obj",
".",
"ShapeId",
"=",
"unpack_ui16",
"(",
"self",
".",
"_src",
")",
"obj",
".",
"ShapeBounds",
"=",
"self",
".",
"_get_struct_rect",
"(",
... | Handle the DefineShape tag. | [
"Handle",
"the",
"DefineShape",
"tag",
"."
] | 2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c | https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/swfparser.py#L742-L748 |
50,109 | facundobatista/yaswfp | yaswfp/swfparser.py | SWFParser._generic_definefont_parser | def _generic_definefont_parser(self, obj):
"""A generic parser for several DefineFontX."""
obj.FontID = unpack_ui16(self._src)
bc = BitConsumer(self._src)
obj.FontFlagsHasLayout = bc.u_get(1)
obj.FontFlagsShiftJIS = bc.u_get(1)
obj.FontFlagsSmallText = bc.u_get(1)
... | python | def _generic_definefont_parser(self, obj):
"""A generic parser for several DefineFontX."""
obj.FontID = unpack_ui16(self._src)
bc = BitConsumer(self._src)
obj.FontFlagsHasLayout = bc.u_get(1)
obj.FontFlagsShiftJIS = bc.u_get(1)
obj.FontFlagsSmallText = bc.u_get(1)
... | [
"def",
"_generic_definefont_parser",
"(",
"self",
",",
"obj",
")",
":",
"obj",
".",
"FontID",
"=",
"unpack_ui16",
"(",
"self",
".",
"_src",
")",
"bc",
"=",
"BitConsumer",
"(",
"self",
".",
"_src",
")",
"obj",
".",
"FontFlagsHasLayout",
"=",
"bc",
".",
... | A generic parser for several DefineFontX. | [
"A",
"generic",
"parser",
"for",
"several",
"DefineFontX",
"."
] | 2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c | https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/swfparser.py#L766-L807 |
50,110 | facundobatista/yaswfp | yaswfp/swfparser.py | SWFParser._handle_tag_definebutton2 | def _handle_tag_definebutton2(self):
"""Handle the DefineButton2 tag."""
obj = _make_object("DefineButton2")
obj.ButtonId = unpack_ui16(self._src)
bc = BitConsumer(self._src)
bc.ReservedFlags = bc.u_get(7)
bc.TrackAsMenu = bc.u_get(1)
obj.ActionOffset = unpack_u... | python | def _handle_tag_definebutton2(self):
"""Handle the DefineButton2 tag."""
obj = _make_object("DefineButton2")
obj.ButtonId = unpack_ui16(self._src)
bc = BitConsumer(self._src)
bc.ReservedFlags = bc.u_get(7)
bc.TrackAsMenu = bc.u_get(1)
obj.ActionOffset = unpack_u... | [
"def",
"_handle_tag_definebutton2",
"(",
"self",
")",
":",
"obj",
"=",
"_make_object",
"(",
"\"DefineButton2\"",
")",
"obj",
".",
"ButtonId",
"=",
"unpack_ui16",
"(",
"self",
".",
"_src",
")",
"bc",
"=",
"BitConsumer",
"(",
"self",
".",
"_src",
")",
"bc",
... | Handle the DefineButton2 tag. | [
"Handle",
"the",
"DefineButton2",
"tag",
"."
] | 2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c | https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/swfparser.py#L821-L890 |
50,111 | facundobatista/yaswfp | yaswfp/swfparser.py | SWFParser._handle_tag_enabledebugger2 | def _handle_tag_enabledebugger2(self):
"""Handle the EnableDebugger2 tag."""
obj = _make_object("EnableDebugger2")
obj.Reserved = unpack_ui16(self._src)
obj.Password = self._get_struct_string()
return obj | python | def _handle_tag_enabledebugger2(self):
"""Handle the EnableDebugger2 tag."""
obj = _make_object("EnableDebugger2")
obj.Reserved = unpack_ui16(self._src)
obj.Password = self._get_struct_string()
return obj | [
"def",
"_handle_tag_enabledebugger2",
"(",
"self",
")",
":",
"obj",
"=",
"_make_object",
"(",
"\"EnableDebugger2\"",
")",
"obj",
".",
"Reserved",
"=",
"unpack_ui16",
"(",
"self",
".",
"_src",
")",
"obj",
".",
"Password",
"=",
"self",
".",
"_get_struct_string",... | Handle the EnableDebugger2 tag. | [
"Handle",
"the",
"EnableDebugger2",
"tag",
"."
] | 2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c | https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/swfparser.py#L892-L897 |
50,112 | facundobatista/yaswfp | yaswfp/swfparser.py | SWFParser._handle_tag_scriptlimits | def _handle_tag_scriptlimits(self):
"""Handle the ScriptLimits tag."""
obj = _make_object("ScriptLimits")
obj.MaxRecursionDepth = unpack_ui16(self._src)
obj.ScriptTimeoutSeconds = unpack_ui16(self._src)
return obj | python | def _handle_tag_scriptlimits(self):
"""Handle the ScriptLimits tag."""
obj = _make_object("ScriptLimits")
obj.MaxRecursionDepth = unpack_ui16(self._src)
obj.ScriptTimeoutSeconds = unpack_ui16(self._src)
return obj | [
"def",
"_handle_tag_scriptlimits",
"(",
"self",
")",
":",
"obj",
"=",
"_make_object",
"(",
"\"ScriptLimits\"",
")",
"obj",
".",
"MaxRecursionDepth",
"=",
"unpack_ui16",
"(",
"self",
".",
"_src",
")",
"obj",
".",
"ScriptTimeoutSeconds",
"=",
"unpack_ui16",
"(",
... | Handle the ScriptLimits tag. | [
"Handle",
"the",
"ScriptLimits",
"tag",
"."
] | 2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c | https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/swfparser.py#L899-L904 |
50,113 | facundobatista/yaswfp | yaswfp/swfparser.py | SWFParser._handle_tag_jpegtables | def _handle_tag_jpegtables(self):
"""Handle the JPEGTables tag."""
obj = _make_object("JPEGTables")
assert self._src.read(2) == b'\xFF\xD8' # SOI marker
eoimark1 = eoimark2 = None
allbytes = [b'\xFF\xD8']
while not (eoimark1 == b'\xFF' and eoimark2 == b'\xD9'):
... | python | def _handle_tag_jpegtables(self):
"""Handle the JPEGTables tag."""
obj = _make_object("JPEGTables")
assert self._src.read(2) == b'\xFF\xD8' # SOI marker
eoimark1 = eoimark2 = None
allbytes = [b'\xFF\xD8']
while not (eoimark1 == b'\xFF' and eoimark2 == b'\xD9'):
... | [
"def",
"_handle_tag_jpegtables",
"(",
"self",
")",
":",
"obj",
"=",
"_make_object",
"(",
"\"JPEGTables\"",
")",
"assert",
"self",
".",
"_src",
".",
"read",
"(",
"2",
")",
"==",
"b'\\xFF\\xD8'",
"# SOI marker",
"eoimark1",
"=",
"eoimark2",
"=",
"None",
"allby... | Handle the JPEGTables tag. | [
"Handle",
"the",
"JPEGTables",
"tag",
"."
] | 2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c | https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/swfparser.py#L912-L926 |
50,114 | facundobatista/yaswfp | yaswfp/swfparser.py | SWFParser._handle_tag_definefontalignzones | def _handle_tag_definefontalignzones(self):
"""Handle the DefineFontAlignZones tag."""
obj = _make_object("DefineFontAlignZones")
obj.FontId = unpack_ui16(self._src)
bc = BitConsumer(self._src)
obj.CSMTableHint = bc.u_get(2)
obj.Reserved = bc.u_get(6)
obj.ZoneTab... | python | def _handle_tag_definefontalignzones(self):
"""Handle the DefineFontAlignZones tag."""
obj = _make_object("DefineFontAlignZones")
obj.FontId = unpack_ui16(self._src)
bc = BitConsumer(self._src)
obj.CSMTableHint = bc.u_get(2)
obj.Reserved = bc.u_get(6)
obj.ZoneTab... | [
"def",
"_handle_tag_definefontalignzones",
"(",
"self",
")",
":",
"obj",
"=",
"_make_object",
"(",
"\"DefineFontAlignZones\"",
")",
"obj",
".",
"FontId",
"=",
"unpack_ui16",
"(",
"self",
".",
"_src",
")",
"bc",
"=",
"BitConsumer",
"(",
"self",
".",
"_src",
"... | Handle the DefineFontAlignZones tag. | [
"Handle",
"the",
"DefineFontAlignZones",
"tag",
"."
] | 2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c | https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/swfparser.py#L928-L953 |
50,115 | facundobatista/yaswfp | yaswfp/swfparser.py | SWFParser._handle_tag_definefontname | def _handle_tag_definefontname(self):
"""Handle the DefineFontName tag."""
obj = _make_object("DefineFontName")
obj.FontId = unpack_ui16(self._src)
obj.FontName = self._get_struct_string()
obj.FontCopyright = self._get_struct_string()
return obj | python | def _handle_tag_definefontname(self):
"""Handle the DefineFontName tag."""
obj = _make_object("DefineFontName")
obj.FontId = unpack_ui16(self._src)
obj.FontName = self._get_struct_string()
obj.FontCopyright = self._get_struct_string()
return obj | [
"def",
"_handle_tag_definefontname",
"(",
"self",
")",
":",
"obj",
"=",
"_make_object",
"(",
"\"DefineFontName\"",
")",
"obj",
".",
"FontId",
"=",
"unpack_ui16",
"(",
"self",
".",
"_src",
")",
"obj",
".",
"FontName",
"=",
"self",
".",
"_get_struct_string",
"... | Handle the DefineFontName tag. | [
"Handle",
"the",
"DefineFontName",
"tag",
"."
] | 2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c | https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/swfparser.py#L955-L961 |
50,116 | facundobatista/yaswfp | yaswfp/swfparser.py | SWFParser._handle_tag_csmtextsettings | def _handle_tag_csmtextsettings(self):
"""Handle the CSMTextSettings tag."""
obj = _make_object("CSMTextSettings")
obj.TextId = unpack_ui16(self._src)
bc = BitConsumer(self._src)
obj.UseFlashType = bc.u_get(2)
obj.GridFit = bc.u_get(3)
obj.Reserved1 = bc.u_get(3)
... | python | def _handle_tag_csmtextsettings(self):
"""Handle the CSMTextSettings tag."""
obj = _make_object("CSMTextSettings")
obj.TextId = unpack_ui16(self._src)
bc = BitConsumer(self._src)
obj.UseFlashType = bc.u_get(2)
obj.GridFit = bc.u_get(3)
obj.Reserved1 = bc.u_get(3)
... | [
"def",
"_handle_tag_csmtextsettings",
"(",
"self",
")",
":",
"obj",
"=",
"_make_object",
"(",
"\"CSMTextSettings\"",
")",
"obj",
".",
"TextId",
"=",
"unpack_ui16",
"(",
"self",
".",
"_src",
")",
"bc",
"=",
"BitConsumer",
"(",
"self",
".",
"_src",
")",
"obj... | Handle the CSMTextSettings tag. | [
"Handle",
"the",
"CSMTextSettings",
"tag",
"."
] | 2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c | https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/swfparser.py#L963-L974 |
50,117 | facundobatista/yaswfp | yaswfp/swfparser.py | SWFParser._get_struct_rect | def _get_struct_rect(self):
"""Get the RECT structure."""
bc = BitConsumer(self._src)
nbits = bc.u_get(5)
if self._read_twips:
return tuple(bc.s_get(nbits) for _ in range(4))
else:
return tuple(bc.s_get(nbits) / 20.0 for _ in range(4)) | python | def _get_struct_rect(self):
"""Get the RECT structure."""
bc = BitConsumer(self._src)
nbits = bc.u_get(5)
if self._read_twips:
return tuple(bc.s_get(nbits) for _ in range(4))
else:
return tuple(bc.s_get(nbits) / 20.0 for _ in range(4)) | [
"def",
"_get_struct_rect",
"(",
"self",
")",
":",
"bc",
"=",
"BitConsumer",
"(",
"self",
".",
"_src",
")",
"nbits",
"=",
"bc",
".",
"u_get",
"(",
"5",
")",
"if",
"self",
".",
"_read_twips",
":",
"return",
"tuple",
"(",
"bc",
".",
"s_get",
"(",
"nbi... | Get the RECT structure. | [
"Get",
"the",
"RECT",
"structure",
"."
] | 2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c | https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/swfparser.py#L976-L983 |
50,118 | facundobatista/yaswfp | yaswfp/swfparser.py | SWFParser._get_struct_kerningrecord | def _get_struct_kerningrecord(self, font_flags_wide_codes):
"""Get the KERNINGRECORD structure."""
getter = unpack_ui16 if font_flags_wide_codes else unpack_ui8
data = {}
data['FontKerningCode1'] = getter(self._src)
data['FontKerningCode2'] = getter(self._src)
data['FontK... | python | def _get_struct_kerningrecord(self, font_flags_wide_codes):
"""Get the KERNINGRECORD structure."""
getter = unpack_ui16 if font_flags_wide_codes else unpack_ui8
data = {}
data['FontKerningCode1'] = getter(self._src)
data['FontKerningCode2'] = getter(self._src)
data['FontK... | [
"def",
"_get_struct_kerningrecord",
"(",
"self",
",",
"font_flags_wide_codes",
")",
":",
"getter",
"=",
"unpack_ui16",
"if",
"font_flags_wide_codes",
"else",
"unpack_ui8",
"data",
"=",
"{",
"}",
"data",
"[",
"'FontKerningCode1'",
"]",
"=",
"getter",
"(",
"self",
... | Get the KERNINGRECORD structure. | [
"Get",
"the",
"KERNINGRECORD",
"structure",
"."
] | 2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c | https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/swfparser.py#L998-L1005 |
50,119 | facundobatista/yaswfp | yaswfp/swfparser.py | SWFParser._get_struct_clipactions | def _get_struct_clipactions(self):
"""Get the several CLIPACTIONRECORDs."""
obj = _make_object("ClipActions")
# In SWF 5 and earlier, these are 2 bytes wide; in SWF 6
# and later 4 bytes
clipeventflags_size = 2 if self._version <= 5 else 4
clipactionend_size = 2 if self.... | python | def _get_struct_clipactions(self):
"""Get the several CLIPACTIONRECORDs."""
obj = _make_object("ClipActions")
# In SWF 5 and earlier, these are 2 bytes wide; in SWF 6
# and later 4 bytes
clipeventflags_size = 2 if self._version <= 5 else 4
clipactionend_size = 2 if self.... | [
"def",
"_get_struct_clipactions",
"(",
"self",
")",
":",
"obj",
"=",
"_make_object",
"(",
"\"ClipActions\"",
")",
"# In SWF 5 and earlier, these are 2 bytes wide; in SWF 6",
"# and later 4 bytes",
"clipeventflags_size",
"=",
"2",
"if",
"self",
".",
"_version",
"<=",
"5",
... | Get the several CLIPACTIONRECORDs. | [
"Get",
"the",
"several",
"CLIPACTIONRECORDs",
"."
] | 2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c | https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/swfparser.py#L1007-L1037 |
50,120 | facundobatista/yaswfp | yaswfp/swfparser.py | SWFParser._get_struct_string | def _get_struct_string(self):
"""Get the STRING structure."""
data = []
while True:
t = self._src.read(1)
if t == b'\x00':
break
data.append(t)
val = b''.join(data)
return val.decode("utf8") | python | def _get_struct_string(self):
"""Get the STRING structure."""
data = []
while True:
t = self._src.read(1)
if t == b'\x00':
break
data.append(t)
val = b''.join(data)
return val.decode("utf8") | [
"def",
"_get_struct_string",
"(",
"self",
")",
":",
"data",
"=",
"[",
"]",
"while",
"True",
":",
"t",
"=",
"self",
".",
"_src",
".",
"read",
"(",
"1",
")",
"if",
"t",
"==",
"b'\\x00'",
":",
"break",
"data",
".",
"append",
"(",
"t",
")",
"val",
... | Get the STRING structure. | [
"Get",
"the",
"STRING",
"structure",
"."
] | 2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c | https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/swfparser.py#L1039-L1048 |
50,121 | facundobatista/yaswfp | yaswfp/swfparser.py | SWFParser._get_struct_matrix | def _get_struct_matrix(self):
"""Get the values for the MATRIX record."""
obj = _make_object("Matrix")
bc = BitConsumer(self._src)
# scale
obj.HasScale = bc.u_get(1)
if obj.HasScale:
obj.NScaleBits = n_scale_bits = bc.u_get(5)
obj.ScaleX = bc.fb_g... | python | def _get_struct_matrix(self):
"""Get the values for the MATRIX record."""
obj = _make_object("Matrix")
bc = BitConsumer(self._src)
# scale
obj.HasScale = bc.u_get(1)
if obj.HasScale:
obj.NScaleBits = n_scale_bits = bc.u_get(5)
obj.ScaleX = bc.fb_g... | [
"def",
"_get_struct_matrix",
"(",
"self",
")",
":",
"obj",
"=",
"_make_object",
"(",
"\"Matrix\"",
")",
"bc",
"=",
"BitConsumer",
"(",
"self",
".",
"_src",
")",
"# scale",
"obj",
".",
"HasScale",
"=",
"bc",
".",
"u_get",
"(",
"1",
")",
"if",
"obj",
"... | Get the values for the MATRIX record. | [
"Get",
"the",
"values",
"for",
"the",
"MATRIX",
"record",
"."
] | 2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c | https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/swfparser.py#L1050-L1076 |
50,122 | facundobatista/yaswfp | yaswfp/swfparser.py | SWFParser._get_struct_cxformwithalpha | def _get_struct_cxformwithalpha(self):
"""Get the values for the CXFORMWITHALPHA record."""
obj = _make_object("CXformWithAlpha")
bc = BitConsumer(self._src)
obj.HasAddTerms = bc.u_get(1)
obj.HasMultTerms = bc.u_get(1)
obj.NBits = nbits = bc.u_get(4)
if obj.HasM... | python | def _get_struct_cxformwithalpha(self):
"""Get the values for the CXFORMWITHALPHA record."""
obj = _make_object("CXformWithAlpha")
bc = BitConsumer(self._src)
obj.HasAddTerms = bc.u_get(1)
obj.HasMultTerms = bc.u_get(1)
obj.NBits = nbits = bc.u_get(4)
if obj.HasM... | [
"def",
"_get_struct_cxformwithalpha",
"(",
"self",
")",
":",
"obj",
"=",
"_make_object",
"(",
"\"CXformWithAlpha\"",
")",
"bc",
"=",
"BitConsumer",
"(",
"self",
".",
"_src",
")",
"obj",
".",
"HasAddTerms",
"=",
"bc",
".",
"u_get",
"(",
"1",
")",
"obj",
"... | Get the values for the CXFORMWITHALPHA record. | [
"Get",
"the",
"values",
"for",
"the",
"CXFORMWITHALPHA",
"record",
"."
] | 2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c | https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/swfparser.py#L1078-L1099 |
50,123 | facundobatista/yaswfp | yaswfp/swfparser.py | SWFParser._get_shaperecords | def _get_shaperecords(self, num_fill_bits,
num_line_bits, shape_number):
"""Return an array of SHAPERECORDS."""
shape_records = []
bc = BitConsumer(self._src)
while True:
type_flag = bc.u_get(1)
if type_flag:
# edge recor... | python | def _get_shaperecords(self, num_fill_bits,
num_line_bits, shape_number):
"""Return an array of SHAPERECORDS."""
shape_records = []
bc = BitConsumer(self._src)
while True:
type_flag = bc.u_get(1)
if type_flag:
# edge recor... | [
"def",
"_get_shaperecords",
"(",
"self",
",",
"num_fill_bits",
",",
"num_line_bits",
",",
"shape_number",
")",
":",
"shape_records",
"=",
"[",
"]",
"bc",
"=",
"BitConsumer",
"(",
"self",
".",
"_src",
")",
"while",
"True",
":",
"type_flag",
"=",
"bc",
".",
... | Return an array of SHAPERECORDS. | [
"Return",
"an",
"array",
"of",
"SHAPERECORDS",
"."
] | 2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c | https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/swfparser.py#L1101-L1185 |
50,124 | facundobatista/yaswfp | yaswfp/swfparser.py | SWFParser._get_struct_shape | def _get_struct_shape(self):
"""Get the values for the SHAPE record."""
obj = _make_object("Shape")
bc = BitConsumer(self._src)
obj.NumFillBits = n_fill_bits = bc.u_get(4)
obj.NumLineBits = n_line_bits = bc.u_get(4)
obj.ShapeRecords = self._get_shaperecords(
n... | python | def _get_struct_shape(self):
"""Get the values for the SHAPE record."""
obj = _make_object("Shape")
bc = BitConsumer(self._src)
obj.NumFillBits = n_fill_bits = bc.u_get(4)
obj.NumLineBits = n_line_bits = bc.u_get(4)
obj.ShapeRecords = self._get_shaperecords(
n... | [
"def",
"_get_struct_shape",
"(",
"self",
")",
":",
"obj",
"=",
"_make_object",
"(",
"\"Shape\"",
")",
"bc",
"=",
"BitConsumer",
"(",
"self",
".",
"_src",
")",
"obj",
".",
"NumFillBits",
"=",
"n_fill_bits",
"=",
"bc",
".",
"u_get",
"(",
"4",
")",
"obj",... | Get the values for the SHAPE record. | [
"Get",
"the",
"values",
"for",
"the",
"SHAPE",
"record",
"."
] | 2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c | https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/swfparser.py#L1187-L1195 |
50,125 | facundobatista/yaswfp | yaswfp/swfparser.py | SWFParser._get_struct_fillstyle | def _get_struct_fillstyle(self, shape_number):
"""Get the values for the FILLSTYLE record."""
obj = _make_object("FillStyle")
obj.FillStyleType = style_type = unpack_ui8(self._src)
if style_type == 0x00:
if shape_number <= 2:
obj.Color = self._get_struct_rgb(... | python | def _get_struct_fillstyle(self, shape_number):
"""Get the values for the FILLSTYLE record."""
obj = _make_object("FillStyle")
obj.FillStyleType = style_type = unpack_ui8(self._src)
if style_type == 0x00:
if shape_number <= 2:
obj.Color = self._get_struct_rgb(... | [
"def",
"_get_struct_fillstyle",
"(",
"self",
",",
"shape_number",
")",
":",
"obj",
"=",
"_make_object",
"(",
"\"FillStyle\"",
")",
"obj",
".",
"FillStyleType",
"=",
"style_type",
"=",
"unpack_ui8",
"(",
"self",
".",
"_src",
")",
"if",
"style_type",
"==",
"0x... | Get the values for the FILLSTYLE record. | [
"Get",
"the",
"values",
"for",
"the",
"FILLSTYLE",
"record",
"."
] | 2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c | https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/swfparser.py#L1197-L1219 |
50,126 | facundobatista/yaswfp | yaswfp/swfparser.py | SWFParser._get_struct_fillstylearray | def _get_struct_fillstylearray(self, shape_number):
"""Get the values for the FILLSTYLEARRAY record."""
obj = _make_object("FillStyleArray")
obj.FillStyleCount = count = unpack_ui8(self._src)
if count == 0xFF:
obj.FillStyleCountExtended = count = unpack_ui16(self._src)
... | python | def _get_struct_fillstylearray(self, shape_number):
"""Get the values for the FILLSTYLEARRAY record."""
obj = _make_object("FillStyleArray")
obj.FillStyleCount = count = unpack_ui8(self._src)
if count == 0xFF:
obj.FillStyleCountExtended = count = unpack_ui16(self._src)
... | [
"def",
"_get_struct_fillstylearray",
"(",
"self",
",",
"shape_number",
")",
":",
"obj",
"=",
"_make_object",
"(",
"\"FillStyleArray\"",
")",
"obj",
".",
"FillStyleCount",
"=",
"count",
"=",
"unpack_ui8",
"(",
"self",
".",
"_src",
")",
"if",
"count",
"==",
"0... | Get the values for the FILLSTYLEARRAY record. | [
"Get",
"the",
"values",
"for",
"the",
"FILLSTYLEARRAY",
"record",
"."
] | 2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c | https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/swfparser.py#L1221-L1229 |
50,127 | facundobatista/yaswfp | yaswfp/swfparser.py | SWFParser._get_struct_linestylearray | def _get_struct_linestylearray(self, shape_number):
"""Get the values for the LINESTYLEARRAY record."""
obj = _make_object("LineStyleArray")
obj.LineStyleCount = count = unpack_ui8(self._src)
if count == 0xFF:
obj.LineStyleCountExtended = count = unpack_ui16(self._src)
... | python | def _get_struct_linestylearray(self, shape_number):
"""Get the values for the LINESTYLEARRAY record."""
obj = _make_object("LineStyleArray")
obj.LineStyleCount = count = unpack_ui8(self._src)
if count == 0xFF:
obj.LineStyleCountExtended = count = unpack_ui16(self._src)
... | [
"def",
"_get_struct_linestylearray",
"(",
"self",
",",
"shape_number",
")",
":",
"obj",
"=",
"_make_object",
"(",
"\"LineStyleArray\"",
")",
"obj",
".",
"LineStyleCount",
"=",
"count",
"=",
"unpack_ui8",
"(",
"self",
".",
"_src",
")",
"if",
"count",
"==",
"0... | Get the values for the LINESTYLEARRAY record. | [
"Get",
"the",
"values",
"for",
"the",
"LINESTYLEARRAY",
"record",
"."
] | 2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c | https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/swfparser.py#L1231-L1272 |
50,128 | facundobatista/yaswfp | yaswfp/swfparser.py | SWFParser._get_struct_encodedu32 | def _get_struct_encodedu32(self):
"""Get a EncodedU32 number."""
useful = []
while True:
byte = ord(self._src.read(1))
useful.append(byte)
if byte < 127:
# got all the useful bytes
break
# transform into bits reordering... | python | def _get_struct_encodedu32(self):
"""Get a EncodedU32 number."""
useful = []
while True:
byte = ord(self._src.read(1))
useful.append(byte)
if byte < 127:
# got all the useful bytes
break
# transform into bits reordering... | [
"def",
"_get_struct_encodedu32",
"(",
"self",
")",
":",
"useful",
"=",
"[",
"]",
"while",
"True",
":",
"byte",
"=",
"ord",
"(",
"self",
".",
"_src",
".",
"read",
"(",
"1",
")",
")",
"useful",
".",
"append",
"(",
"byte",
")",
"if",
"byte",
"<",
"1... | Get a EncodedU32 number. | [
"Get",
"a",
"EncodedU32",
"number",
"."
] | 2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c | https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/swfparser.py#L1274-L1288 |
50,129 | facundobatista/yaswfp | yaswfp/swfparser.py | SWFParser._get_struct_shapewithstyle | def _get_struct_shapewithstyle(self, shape_number):
"""Get the values for the SHAPEWITHSTYLE record."""
obj = _make_object("ShapeWithStyle")
obj.FillStyles = self._get_struct_fillstylearray(shape_number)
obj.LineStyles = self._get_struct_linestylearray(shape_number)
bc = BitConsu... | python | def _get_struct_shapewithstyle(self, shape_number):
"""Get the values for the SHAPEWITHSTYLE record."""
obj = _make_object("ShapeWithStyle")
obj.FillStyles = self._get_struct_fillstylearray(shape_number)
obj.LineStyles = self._get_struct_linestylearray(shape_number)
bc = BitConsu... | [
"def",
"_get_struct_shapewithstyle",
"(",
"self",
",",
"shape_number",
")",
":",
"obj",
"=",
"_make_object",
"(",
"\"ShapeWithStyle\"",
")",
"obj",
".",
"FillStyles",
"=",
"self",
".",
"_get_struct_fillstylearray",
"(",
"shape_number",
")",
"obj",
".",
"LineStyles... | Get the values for the SHAPEWITHSTYLE record. | [
"Get",
"the",
"values",
"for",
"the",
"SHAPEWITHSTYLE",
"record",
"."
] | 2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c | https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/swfparser.py#L1290-L1300 |
50,130 | facundobatista/yaswfp | yaswfp/swfparser.py | SWFParser._get_struct_gradient | def _get_struct_gradient(self, shape_number):
"""Get the values for the GRADIENT record."""
obj = _make_object("Gradient")
bc = BitConsumer(self._src)
obj.SpreadMode = bc.u_get(2)
obj.InterpolationMode = bc.u_get(2)
obj.NumGradients = bc.u_get(4)
obj.GradientRecor... | python | def _get_struct_gradient(self, shape_number):
"""Get the values for the GRADIENT record."""
obj = _make_object("Gradient")
bc = BitConsumer(self._src)
obj.SpreadMode = bc.u_get(2)
obj.InterpolationMode = bc.u_get(2)
obj.NumGradients = bc.u_get(4)
obj.GradientRecor... | [
"def",
"_get_struct_gradient",
"(",
"self",
",",
"shape_number",
")",
":",
"obj",
"=",
"_make_object",
"(",
"\"Gradient\"",
")",
"bc",
"=",
"BitConsumer",
"(",
"self",
".",
"_src",
")",
"obj",
".",
"SpreadMode",
"=",
"bc",
".",
"u_get",
"(",
"2",
")",
... | Get the values for the GRADIENT record. | [
"Get",
"the",
"values",
"for",
"the",
"GRADIENT",
"record",
"."
] | 2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c | https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/swfparser.py#L1302-L1319 |
50,131 | facundobatista/yaswfp | yaswfp/swfparser.py | SWFParser._get_struct_filterlist | def _get_struct_filterlist(self):
"""Get the values for the FILTERLIST record."""
obj = _make_object("FilterList")
obj.NumberOfFilters = unpack_ui8(self._src)
obj.Filter = filters = []
# how to decode each filter type (and name), according to the filter id
filter_type = [... | python | def _get_struct_filterlist(self):
"""Get the values for the FILTERLIST record."""
obj = _make_object("FilterList")
obj.NumberOfFilters = unpack_ui8(self._src)
obj.Filter = filters = []
# how to decode each filter type (and name), according to the filter id
filter_type = [... | [
"def",
"_get_struct_filterlist",
"(",
"self",
")",
":",
"obj",
"=",
"_make_object",
"(",
"\"FilterList\"",
")",
"obj",
".",
"NumberOfFilters",
"=",
"unpack_ui8",
"(",
"self",
".",
"_src",
")",
"obj",
".",
"Filter",
"=",
"filters",
"=",
"[",
"]",
"# how to ... | Get the values for the FILTERLIST record. | [
"Get",
"the",
"values",
"for",
"the",
"FILTERLIST",
"record",
"."
] | 2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c | https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/swfparser.py#L1342-L1365 |
50,132 | facundobatista/yaswfp | yaswfp/swfparser.py | SWFParser._get_struct_dropshadowfilter | def _get_struct_dropshadowfilter(self):
"""Get the values for the DROPSHADOWFILTER record."""
obj = _make_object("DropShadowFilter")
obj.DropShadowColor = self._get_struct_rgba()
obj.BlurX = unpack_fixed16(self._src)
obj.BlurY = unpack_fixed16(self._src)
obj.Angle = unpac... | python | def _get_struct_dropshadowfilter(self):
"""Get the values for the DROPSHADOWFILTER record."""
obj = _make_object("DropShadowFilter")
obj.DropShadowColor = self._get_struct_rgba()
obj.BlurX = unpack_fixed16(self._src)
obj.BlurY = unpack_fixed16(self._src)
obj.Angle = unpac... | [
"def",
"_get_struct_dropshadowfilter",
"(",
"self",
")",
":",
"obj",
"=",
"_make_object",
"(",
"\"DropShadowFilter\"",
")",
"obj",
".",
"DropShadowColor",
"=",
"self",
".",
"_get_struct_rgba",
"(",
")",
"obj",
".",
"BlurX",
"=",
"unpack_fixed16",
"(",
"self",
... | Get the values for the DROPSHADOWFILTER record. | [
"Get",
"the",
"values",
"for",
"the",
"DROPSHADOWFILTER",
"record",
"."
] | 2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c | https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/swfparser.py#L1367-L1381 |
50,133 | facundobatista/yaswfp | yaswfp/swfparser.py | SWFParser._get_struct_blurfilter | def _get_struct_blurfilter(self):
"""Get the values for the BLURFILTER record."""
obj = _make_object("BlurFilter")
obj.BlurX = unpack_fixed16(self._src)
obj.BlurY = unpack_fixed16(self._src)
bc = BitConsumer(self._src)
obj.Passes = bc.u_get(5)
obj.Reserved = bc.u_... | python | def _get_struct_blurfilter(self):
"""Get the values for the BLURFILTER record."""
obj = _make_object("BlurFilter")
obj.BlurX = unpack_fixed16(self._src)
obj.BlurY = unpack_fixed16(self._src)
bc = BitConsumer(self._src)
obj.Passes = bc.u_get(5)
obj.Reserved = bc.u_... | [
"def",
"_get_struct_blurfilter",
"(",
"self",
")",
":",
"obj",
"=",
"_make_object",
"(",
"\"BlurFilter\"",
")",
"obj",
".",
"BlurX",
"=",
"unpack_fixed16",
"(",
"self",
".",
"_src",
")",
"obj",
".",
"BlurY",
"=",
"unpack_fixed16",
"(",
"self",
".",
"_src",... | Get the values for the BLURFILTER record. | [
"Get",
"the",
"values",
"for",
"the",
"BLURFILTER",
"record",
"."
] | 2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c | https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/swfparser.py#L1383-L1391 |
50,134 | facundobatista/yaswfp | yaswfp/swfparser.py | SWFParser._get_struct_glowfilter | def _get_struct_glowfilter(self):
"""Get the values for the GLOWFILTER record."""
obj = _make_object("GlowFilter")
obj.GlowColor = self._get_struct_rgba()
obj.BlurX = unpack_fixed16(self._src)
obj.BlurY = unpack_fixed16(self._src)
obj.Strength = unpack_fixed8(self._src)
... | python | def _get_struct_glowfilter(self):
"""Get the values for the GLOWFILTER record."""
obj = _make_object("GlowFilter")
obj.GlowColor = self._get_struct_rgba()
obj.BlurX = unpack_fixed16(self._src)
obj.BlurY = unpack_fixed16(self._src)
obj.Strength = unpack_fixed8(self._src)
... | [
"def",
"_get_struct_glowfilter",
"(",
"self",
")",
":",
"obj",
"=",
"_make_object",
"(",
"\"GlowFilter\"",
")",
"obj",
".",
"GlowColor",
"=",
"self",
".",
"_get_struct_rgba",
"(",
")",
"obj",
".",
"BlurX",
"=",
"unpack_fixed16",
"(",
"self",
".",
"_src",
"... | Get the values for the GLOWFILTER record. | [
"Get",
"the",
"values",
"for",
"the",
"GLOWFILTER",
"record",
"."
] | 2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c | https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/swfparser.py#L1393-L1405 |
50,135 | facundobatista/yaswfp | yaswfp/swfparser.py | SWFParser._get_struct_bevelfilter | def _get_struct_bevelfilter(self):
"""Get the values for the BEVELFILTER record."""
obj = _make_object("BevelFilter")
obj.ShadowColor = self._get_struct_rgba()
obj.HighlightColor = self._get_struct_rgba()
obj.BlurX = unpack_fixed16(self._src)
obj.BlurY = unpack_fixed16(se... | python | def _get_struct_bevelfilter(self):
"""Get the values for the BEVELFILTER record."""
obj = _make_object("BevelFilter")
obj.ShadowColor = self._get_struct_rgba()
obj.HighlightColor = self._get_struct_rgba()
obj.BlurX = unpack_fixed16(self._src)
obj.BlurY = unpack_fixed16(se... | [
"def",
"_get_struct_bevelfilter",
"(",
"self",
")",
":",
"obj",
"=",
"_make_object",
"(",
"\"BevelFilter\"",
")",
"obj",
".",
"ShadowColor",
"=",
"self",
".",
"_get_struct_rgba",
"(",
")",
"obj",
".",
"HighlightColor",
"=",
"self",
".",
"_get_struct_rgba",
"("... | Get the values for the BEVELFILTER record. | [
"Get",
"the",
"values",
"for",
"the",
"BEVELFILTER",
"record",
"."
] | 2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c | https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/swfparser.py#L1407-L1423 |
50,136 | facundobatista/yaswfp | yaswfp/swfparser.py | SWFParser._get_struct_convolutionfilter | def _get_struct_convolutionfilter(self):
"""Get the values for the CONVOLUTIONFILTER record."""
obj = _make_object("ConvolutionFilter")
obj.MatrixX = unpack_ui8(self._src)
obj.MatrixY = unpack_ui8(self._src)
obj.Divisor = unpack_float(self._src)
obj.Bias = unpack_float(se... | python | def _get_struct_convolutionfilter(self):
"""Get the values for the CONVOLUTIONFILTER record."""
obj = _make_object("ConvolutionFilter")
obj.MatrixX = unpack_ui8(self._src)
obj.MatrixY = unpack_ui8(self._src)
obj.Divisor = unpack_float(self._src)
obj.Bias = unpack_float(se... | [
"def",
"_get_struct_convolutionfilter",
"(",
"self",
")",
":",
"obj",
"=",
"_make_object",
"(",
"\"ConvolutionFilter\"",
")",
"obj",
".",
"MatrixX",
"=",
"unpack_ui8",
"(",
"self",
".",
"_src",
")",
"obj",
".",
"MatrixY",
"=",
"unpack_ui8",
"(",
"self",
".",... | Get the values for the CONVOLUTIONFILTER record. | [
"Get",
"the",
"values",
"for",
"the",
"CONVOLUTIONFILTER",
"record",
"."
] | 2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c | https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/swfparser.py#L1446-L1462 |
50,137 | facundobatista/yaswfp | yaswfp/swfparser.py | SWFParser._get_struct_colormatrixfilter | def _get_struct_colormatrixfilter(self):
"""Get the values for the COLORMATRIXFILTER record."""
obj = _make_object("ColorMatrixFilter")
obj.Matrix = [unpack_float(self._src) for _ in range(20)]
return obj | python | def _get_struct_colormatrixfilter(self):
"""Get the values for the COLORMATRIXFILTER record."""
obj = _make_object("ColorMatrixFilter")
obj.Matrix = [unpack_float(self._src) for _ in range(20)]
return obj | [
"def",
"_get_struct_colormatrixfilter",
"(",
"self",
")",
":",
"obj",
"=",
"_make_object",
"(",
"\"ColorMatrixFilter\"",
")",
"obj",
".",
"Matrix",
"=",
"[",
"unpack_float",
"(",
"self",
".",
"_src",
")",
"for",
"_",
"in",
"range",
"(",
"20",
")",
"]",
"... | Get the values for the COLORMATRIXFILTER record. | [
"Get",
"the",
"values",
"for",
"the",
"COLORMATRIXFILTER",
"record",
"."
] | 2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c | https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/swfparser.py#L1464-L1468 |
50,138 | facundobatista/yaswfp | yaswfp/swfparser.py | SWFParser._get_struct_gradientbevelfilter | def _get_struct_gradientbevelfilter(self):
"""Get the values for the GRADIENTBEVELFILTER record."""
obj = _make_object("GradientBevelFilter")
obj.NumColors = num_colors = unpack_ui8(self._src)
obj.GradientColors = [self._get_struct_rgba()
for _ in range(num_... | python | def _get_struct_gradientbevelfilter(self):
"""Get the values for the GRADIENTBEVELFILTER record."""
obj = _make_object("GradientBevelFilter")
obj.NumColors = num_colors = unpack_ui8(self._src)
obj.GradientColors = [self._get_struct_rgba()
for _ in range(num_... | [
"def",
"_get_struct_gradientbevelfilter",
"(",
"self",
")",
":",
"obj",
"=",
"_make_object",
"(",
"\"GradientBevelFilter\"",
")",
"obj",
".",
"NumColors",
"=",
"num_colors",
"=",
"unpack_ui8",
"(",
"self",
".",
"_src",
")",
"obj",
".",
"GradientColors",
"=",
"... | Get the values for the GRADIENTBEVELFILTER record. | [
"Get",
"the",
"values",
"for",
"the",
"GRADIENTBEVELFILTER",
"record",
"."
] | 2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c | https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/swfparser.py#L1470-L1489 |
50,139 | facundobatista/yaswfp | yaswfp/swfparser.py | SWFParser._handle_actionconstantpool | def _handle_actionconstantpool(self, _):
"""Handle the ActionConstantPool action."""
obj = _make_object("ActionConstantPool")
obj.Count = count = unpack_ui16(self._src)
obj.ConstantPool = pool = []
for _ in range(count):
pool.append(self._get_struct_string())
... | python | def _handle_actionconstantpool(self, _):
"""Handle the ActionConstantPool action."""
obj = _make_object("ActionConstantPool")
obj.Count = count = unpack_ui16(self._src)
obj.ConstantPool = pool = []
for _ in range(count):
pool.append(self._get_struct_string())
... | [
"def",
"_handle_actionconstantpool",
"(",
"self",
",",
"_",
")",
":",
"obj",
"=",
"_make_object",
"(",
"\"ActionConstantPool\"",
")",
"obj",
".",
"Count",
"=",
"count",
"=",
"unpack_ui16",
"(",
"self",
".",
"_src",
")",
"obj",
".",
"ConstantPool",
"=",
"po... | Handle the ActionConstantPool action. | [
"Handle",
"the",
"ActionConstantPool",
"action",
"."
] | 2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c | https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/swfparser.py#L1491-L1498 |
50,140 | facundobatista/yaswfp | yaswfp/swfparser.py | SWFParser._handle_actiongeturl | def _handle_actiongeturl(self, _):
"""Handle the ActionGetURL action."""
obj = _make_object("ActionGetURL")
obj.UrlString = self._get_struct_string()
obj.TargetString = self._get_struct_string()
yield obj | python | def _handle_actiongeturl(self, _):
"""Handle the ActionGetURL action."""
obj = _make_object("ActionGetURL")
obj.UrlString = self._get_struct_string()
obj.TargetString = self._get_struct_string()
yield obj | [
"def",
"_handle_actiongeturl",
"(",
"self",
",",
"_",
")",
":",
"obj",
"=",
"_make_object",
"(",
"\"ActionGetURL\"",
")",
"obj",
".",
"UrlString",
"=",
"self",
".",
"_get_struct_string",
"(",
")",
"obj",
".",
"TargetString",
"=",
"self",
".",
"_get_struct_st... | Handle the ActionGetURL action. | [
"Handle",
"the",
"ActionGetURL",
"action",
"."
] | 2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c | https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/swfparser.py#L1500-L1505 |
50,141 | facundobatista/yaswfp | yaswfp/swfparser.py | SWFParser._handle_actionpush | def _handle_actionpush(self, length):
"""Handle the ActionPush action."""
init_pos = self._src.tell()
while self._src.tell() < init_pos + length:
obj = _make_object("ActionPush")
obj.Type = unpack_ui8(self._src)
# name and how to read each type
pus... | python | def _handle_actionpush(self, length):
"""Handle the ActionPush action."""
init_pos = self._src.tell()
while self._src.tell() < init_pos + length:
obj = _make_object("ActionPush")
obj.Type = unpack_ui8(self._src)
# name and how to read each type
pus... | [
"def",
"_handle_actionpush",
"(",
"self",
",",
"length",
")",
":",
"init_pos",
"=",
"self",
".",
"_src",
".",
"tell",
"(",
")",
"while",
"self",
".",
"_src",
".",
"tell",
"(",
")",
"<",
"init_pos",
"+",
"length",
":",
"obj",
"=",
"_make_object",
"(",... | Handle the ActionPush action. | [
"Handle",
"the",
"ActionPush",
"action",
"."
] | 2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c | https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/swfparser.py#L1507-L1527 |
50,142 | facundobatista/yaswfp | yaswfp/swfparser.py | SWFParser._handle_actiondefinefunction | def _handle_actiondefinefunction(self, _):
"""Handle the ActionDefineFunction action."""
obj = _make_object("ActionDefineFunction")
obj.FunctionName = self._get_struct_string()
obj.NumParams = unpack_ui16(self._src)
for i in range(1, obj.NumParams + 1):
setattr(obj, "... | python | def _handle_actiondefinefunction(self, _):
"""Handle the ActionDefineFunction action."""
obj = _make_object("ActionDefineFunction")
obj.FunctionName = self._get_struct_string()
obj.NumParams = unpack_ui16(self._src)
for i in range(1, obj.NumParams + 1):
setattr(obj, "... | [
"def",
"_handle_actiondefinefunction",
"(",
"self",
",",
"_",
")",
":",
"obj",
"=",
"_make_object",
"(",
"\"ActionDefineFunction\"",
")",
"obj",
".",
"FunctionName",
"=",
"self",
".",
"_get_struct_string",
"(",
")",
"obj",
".",
"NumParams",
"=",
"unpack_ui16",
... | Handle the ActionDefineFunction action. | [
"Handle",
"the",
"ActionDefineFunction",
"action",
"."
] | 2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c | https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/swfparser.py#L1529-L1537 |
50,143 | facundobatista/yaswfp | yaswfp/swfparser.py | SWFParser._handle_actionif | def _handle_actionif(self, _):
"""Handle the ActionIf action."""
obj = _make_object("ActionIf")
obj.BranchOffset = unpack_si16(self._src)
yield obj | python | def _handle_actionif(self, _):
"""Handle the ActionIf action."""
obj = _make_object("ActionIf")
obj.BranchOffset = unpack_si16(self._src)
yield obj | [
"def",
"_handle_actionif",
"(",
"self",
",",
"_",
")",
":",
"obj",
"=",
"_make_object",
"(",
"\"ActionIf\"",
")",
"obj",
".",
"BranchOffset",
"=",
"unpack_si16",
"(",
"self",
".",
"_src",
")",
"yield",
"obj"
] | Handle the ActionIf action. | [
"Handle",
"the",
"ActionIf",
"action",
"."
] | 2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c | https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/swfparser.py#L1539-L1543 |
50,144 | facundobatista/yaswfp | yaswfp/swfparser.py | SWFParser._handle_actiondefinefunction2 | def _handle_actiondefinefunction2(self, _):
"""Handle the ActionDefineFunction2 action."""
obj = _make_object("ActionDefineFunction2")
obj.FunctionName = self._get_struct_string()
obj.NumParams = unpack_ui16(self._src)
obj.RegisterCount = unpack_ui8(self._src)
bc = BitCon... | python | def _handle_actiondefinefunction2(self, _):
"""Handle the ActionDefineFunction2 action."""
obj = _make_object("ActionDefineFunction2")
obj.FunctionName = self._get_struct_string()
obj.NumParams = unpack_ui16(self._src)
obj.RegisterCount = unpack_ui8(self._src)
bc = BitCon... | [
"def",
"_handle_actiondefinefunction2",
"(",
"self",
",",
"_",
")",
":",
"obj",
"=",
"_make_object",
"(",
"\"ActionDefineFunction2\"",
")",
"obj",
".",
"FunctionName",
"=",
"self",
".",
"_get_struct_string",
"(",
")",
"obj",
".",
"NumParams",
"=",
"unpack_ui16",... | Handle the ActionDefineFunction2 action. | [
"Handle",
"the",
"ActionDefineFunction2",
"action",
"."
] | 2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c | https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/swfparser.py#L1545-L1569 |
50,145 | facundobatista/yaswfp | yaswfp/swfparser.py | SWFParser.coverage | def coverage(self):
"""Calculate the coverage of a file."""
items_unk = collections.Counter()
items_ok = collections.Counter()
def _go_deep(obj):
"""Recursive function to find internal attributes."""
if type(obj).__name__ in ('UnknownObject', 'UnknownAction'):
... | python | def coverage(self):
"""Calculate the coverage of a file."""
items_unk = collections.Counter()
items_ok = collections.Counter()
def _go_deep(obj):
"""Recursive function to find internal attributes."""
if type(obj).__name__ in ('UnknownObject', 'UnknownAction'):
... | [
"def",
"coverage",
"(",
"self",
")",
":",
"items_unk",
"=",
"collections",
".",
"Counter",
"(",
")",
"items_ok",
"=",
"collections",
".",
"Counter",
"(",
")",
"def",
"_go_deep",
"(",
"obj",
")",
":",
"\"\"\"Recursive function to find internal attributes.\"\"\"",
... | Calculate the coverage of a file. | [
"Calculate",
"the",
"coverage",
"of",
"a",
"file",
"."
] | 2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c | https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/swfparser.py#L1571-L1606 |
50,146 | raamana/mrivis | mrivis/workflow.py | checkerboard | def checkerboard(img_spec1=None,
img_spec2=None,
patch_size=10,
view_set=(0, 1, 2),
num_slices=(10,),
num_rows=2,
rescale_method='global',
background_threshold=0.05,
annot=None,
... | python | def checkerboard(img_spec1=None,
img_spec2=None,
patch_size=10,
view_set=(0, 1, 2),
num_slices=(10,),
num_rows=2,
rescale_method='global',
background_threshold=0.05,
annot=None,
... | [
"def",
"checkerboard",
"(",
"img_spec1",
"=",
"None",
",",
"img_spec2",
"=",
"None",
",",
"patch_size",
"=",
"10",
",",
"view_set",
"=",
"(",
"0",
",",
"1",
",",
"2",
")",
",",
"num_slices",
"=",
"(",
"10",
",",
")",
",",
"num_rows",
"=",
"2",
",... | Checkerboard mixer.
Parameters
----------
img_spec1 : str or nibabel image-like object
MR image (or path to one) to be visualized
img_spec2 : str or nibabel image-like object
MR image (or path to one) to be visualized
patch_size : int or list or (int, int) or None
size of ... | [
"Checkerboard",
"mixer",
"."
] | 199ad096b8a1d825f69109e7218a81b2f1cec756 | https://github.com/raamana/mrivis/blob/199ad096b8a1d825f69109e7218a81b2f1cec756/mrivis/workflow.py#L22-L107 |
50,147 | raamana/mrivis | mrivis/workflow.py | voxelwise_diff | def voxelwise_diff(img_spec1=None,
img_spec2=None,
abs_value=True,
cmap='gray',
overlay_image=False,
overlay_alpha=0.8,
num_rows=2,
num_cols=6,
rescale_method='global',... | python | def voxelwise_diff(img_spec1=None,
img_spec2=None,
abs_value=True,
cmap='gray',
overlay_image=False,
overlay_alpha=0.8,
num_rows=2,
num_cols=6,
rescale_method='global',... | [
"def",
"voxelwise_diff",
"(",
"img_spec1",
"=",
"None",
",",
"img_spec2",
"=",
"None",
",",
"abs_value",
"=",
"True",
",",
"cmap",
"=",
"'gray'",
",",
"overlay_image",
"=",
"False",
",",
"overlay_alpha",
"=",
"0.8",
",",
"num_rows",
"=",
"2",
",",
"num_c... | Voxel-wise difference map.
Parameters
----------
img_spec1 : str or nibabel image-like object
MR image (or path to one) to be visualized
img_spec2 : str or nibabel image-like object
MR image (or path to one) to be visualized
abs_value : bool
Flag indicating whether to take... | [
"Voxel",
"-",
"wise",
"difference",
"map",
"."
] | 199ad096b8a1d825f69109e7218a81b2f1cec756 | https://github.com/raamana/mrivis/blob/199ad096b8a1d825f69109e7218a81b2f1cec756/mrivis/workflow.py#L210-L301 |
50,148 | raamana/mrivis | mrivis/workflow.py | _compare | def _compare(img_spec1,
img_spec2,
num_rows=2,
num_cols=6,
mixer='checker_board',
rescale_method='global',
annot=None,
padding=5,
bkground_thresh=0.05,
output_path=None,
figsize=None,
... | python | def _compare(img_spec1,
img_spec2,
num_rows=2,
num_cols=6,
mixer='checker_board',
rescale_method='global',
annot=None,
padding=5,
bkground_thresh=0.05,
output_path=None,
figsize=None,
... | [
"def",
"_compare",
"(",
"img_spec1",
",",
"img_spec2",
",",
"num_rows",
"=",
"2",
",",
"num_cols",
"=",
"6",
",",
"mixer",
"=",
"'checker_board'",
",",
"rescale_method",
"=",
"'global'",
",",
"annot",
"=",
"None",
",",
"padding",
"=",
"5",
",",
"bkground... | Produces checkerboard comparison plot of two 3D images.
Parameters
----------
img_spec1 : str or nibabel image-like object
MR image (or path to one) to be visualized
img_spec2 : str or nibabel image-like object
MR image (or path to one) to be visualized
num_rows : int
numb... | [
"Produces",
"checkerboard",
"comparison",
"plot",
"of",
"two",
"3D",
"images",
"."
] | 199ad096b8a1d825f69109e7218a81b2f1cec756 | https://github.com/raamana/mrivis/blob/199ad096b8a1d825f69109e7218a81b2f1cec756/mrivis/workflow.py#L304-L417 |
50,149 | raamana/mrivis | mrivis/workflow.py | _generic_mixer | def _generic_mixer(slice1, slice2, mixer_name, **kwargs):
"""
Generic mixer to process two slices with appropriate mixer
and return the composite to be displayed.
"""
mixer_name = mixer_name.lower()
if mixer_name in ['color_mix', 'rgb']:
mixed = _mix_color(slice1, slice2, **kwargs)
... | python | def _generic_mixer(slice1, slice2, mixer_name, **kwargs):
"""
Generic mixer to process two slices with appropriate mixer
and return the composite to be displayed.
"""
mixer_name = mixer_name.lower()
if mixer_name in ['color_mix', 'rgb']:
mixed = _mix_color(slice1, slice2, **kwargs)
... | [
"def",
"_generic_mixer",
"(",
"slice1",
",",
"slice2",
",",
"mixer_name",
",",
"*",
"*",
"kwargs",
")",
":",
"mixer_name",
"=",
"mixer_name",
".",
"lower",
"(",
")",
"if",
"mixer_name",
"in",
"[",
"'color_mix'",
",",
"'rgb'",
"]",
":",
"mixed",
"=",
"_... | Generic mixer to process two slices with appropriate mixer
and return the composite to be displayed. | [
"Generic",
"mixer",
"to",
"process",
"two",
"slices",
"with",
"appropriate",
"mixer",
"and",
"return",
"the",
"composite",
"to",
"be",
"displayed",
"."
] | 199ad096b8a1d825f69109e7218a81b2f1cec756 | https://github.com/raamana/mrivis/blob/199ad096b8a1d825f69109e7218a81b2f1cec756/mrivis/workflow.py#L597-L632 |
50,150 | raamana/mrivis | mrivis/workflow.py | check_rescaling | def check_rescaling(img1, img2, rescale_method):
"""Estimates the intensity range to clip the visualizations to"""
# estimating intensity ranges
if rescale_method is None:
# this section is to help user to avoid all intensity rescaling altogther!
# TODO bug does not work yet, as pyplot does... | python | def check_rescaling(img1, img2, rescale_method):
"""Estimates the intensity range to clip the visualizations to"""
# estimating intensity ranges
if rescale_method is None:
# this section is to help user to avoid all intensity rescaling altogther!
# TODO bug does not work yet, as pyplot does... | [
"def",
"check_rescaling",
"(",
"img1",
",",
"img2",
",",
"rescale_method",
")",
":",
"# estimating intensity ranges",
"if",
"rescale_method",
"is",
"None",
":",
"# this section is to help user to avoid all intensity rescaling altogther!",
"# TODO bug does not work yet, as pyplot do... | Estimates the intensity range to clip the visualizations to | [
"Estimates",
"the",
"intensity",
"range",
"to",
"clip",
"the",
"visualizations",
"to"
] | 199ad096b8a1d825f69109e7218a81b2f1cec756 | https://github.com/raamana/mrivis/blob/199ad096b8a1d825f69109e7218a81b2f1cec756/mrivis/workflow.py#L657-L696 |
50,151 | raamana/mrivis | mrivis/workflow.py | check_images | def check_images(img_spec1, img_spec2, bkground_thresh=0.05):
"""Reads the two images and assers identical shape."""
img1 = read_image(img_spec1, bkground_thresh)
img2 = read_image(img_spec2, bkground_thresh)
if img1.shape != img2.shape:
raise ValueError('size mismatch! First image: {} Second ... | python | def check_images(img_spec1, img_spec2, bkground_thresh=0.05):
"""Reads the two images and assers identical shape."""
img1 = read_image(img_spec1, bkground_thresh)
img2 = read_image(img_spec2, bkground_thresh)
if img1.shape != img2.shape:
raise ValueError('size mismatch! First image: {} Second ... | [
"def",
"check_images",
"(",
"img_spec1",
",",
"img_spec2",
",",
"bkground_thresh",
"=",
"0.05",
")",
":",
"img1",
"=",
"read_image",
"(",
"img_spec1",
",",
"bkground_thresh",
")",
"img2",
"=",
"read_image",
"(",
"img_spec2",
",",
"bkground_thresh",
")",
"if",
... | Reads the two images and assers identical shape. | [
"Reads",
"the",
"two",
"images",
"and",
"assers",
"identical",
"shape",
"."
] | 199ad096b8a1d825f69109e7218a81b2f1cec756 | https://github.com/raamana/mrivis/blob/199ad096b8a1d825f69109e7218a81b2f1cec756/mrivis/workflow.py#L699-L711 |
50,152 | raamana/mrivis | mrivis/workflow.py | _get_checkers | def _get_checkers(slice_shape, patch_size):
"""Creates checkerboard of a given tile size, filling a given slice."""
if patch_size is not None:
patch_size = check_patch_size(patch_size)
else:
# 7 patches in each axis, min voxels/patch = 3
# TODO make 7 a user settable parameter
... | python | def _get_checkers(slice_shape, patch_size):
"""Creates checkerboard of a given tile size, filling a given slice."""
if patch_size is not None:
patch_size = check_patch_size(patch_size)
else:
# 7 patches in each axis, min voxels/patch = 3
# TODO make 7 a user settable parameter
... | [
"def",
"_get_checkers",
"(",
"slice_shape",
",",
"patch_size",
")",
":",
"if",
"patch_size",
"is",
"not",
"None",
":",
"patch_size",
"=",
"check_patch_size",
"(",
"patch_size",
")",
"else",
":",
"# 7 patches in each axis, min voxels/patch = 3",
"# TODO make 7 a user set... | Creates checkerboard of a given tile size, filling a given slice. | [
"Creates",
"checkerboard",
"of",
"a",
"given",
"tile",
"size",
"filling",
"a",
"given",
"slice",
"."
] | 199ad096b8a1d825f69109e7218a81b2f1cec756 | https://github.com/raamana/mrivis/blob/199ad096b8a1d825f69109e7218a81b2f1cec756/mrivis/workflow.py#L714-L740 |
50,153 | raamana/mrivis | mrivis/workflow.py | _mix_color | def _mix_color(slice1, slice2, alpha_channels, color_space):
"""Mixing them as red and green channels"""
if slice1.shape != slice2.shape:
raise ValueError('size mismatch between cropped slices and checkers!!!')
alpha_channels = np.array(alpha_channels)
if len(alpha_channels) != 2:
rais... | python | def _mix_color(slice1, slice2, alpha_channels, color_space):
"""Mixing them as red and green channels"""
if slice1.shape != slice2.shape:
raise ValueError('size mismatch between cropped slices and checkers!!!')
alpha_channels = np.array(alpha_channels)
if len(alpha_channels) != 2:
rais... | [
"def",
"_mix_color",
"(",
"slice1",
",",
"slice2",
",",
"alpha_channels",
",",
"color_space",
")",
":",
"if",
"slice1",
".",
"shape",
"!=",
"slice2",
".",
"shape",
":",
"raise",
"ValueError",
"(",
"'size mismatch between cropped slices and checkers!!!'",
")",
"alp... | Mixing them as red and green channels | [
"Mixing",
"them",
"as",
"red",
"and",
"green",
"channels"
] | 199ad096b8a1d825f69109e7218a81b2f1cec756 | https://github.com/raamana/mrivis/blob/199ad096b8a1d825f69109e7218a81b2f1cec756/mrivis/workflow.py#L743-L793 |
50,154 | raamana/mrivis | mrivis/workflow.py | _checker_mixer | def _checker_mixer(slice1,
slice2,
checker_size=None):
"""Mixes the two slices in alternating areas specified by checkers"""
checkers = _get_checkers(slice1.shape, checker_size)
if slice1.shape != slice2.shape or slice2.shape != checkers.shape:
raise ValueError... | python | def _checker_mixer(slice1,
slice2,
checker_size=None):
"""Mixes the two slices in alternating areas specified by checkers"""
checkers = _get_checkers(slice1.shape, checker_size)
if slice1.shape != slice2.shape or slice2.shape != checkers.shape:
raise ValueError... | [
"def",
"_checker_mixer",
"(",
"slice1",
",",
"slice2",
",",
"checker_size",
"=",
"None",
")",
":",
"checkers",
"=",
"_get_checkers",
"(",
"slice1",
".",
"shape",
",",
"checker_size",
")",
"if",
"slice1",
".",
"shape",
"!=",
"slice2",
".",
"shape",
"or",
... | Mixes the two slices in alternating areas specified by checkers | [
"Mixes",
"the",
"two",
"slices",
"in",
"alternating",
"areas",
"specified",
"by",
"checkers"
] | 199ad096b8a1d825f69109e7218a81b2f1cec756 | https://github.com/raamana/mrivis/blob/199ad096b8a1d825f69109e7218a81b2f1cec756/mrivis/workflow.py#L796-L808 |
50,155 | jmcarp/filteralchemy | filteralchemy/filterset.py | FilterSet.filter | def filter(self):
"""Generate a filtered query from request parameters.
:returns: Filtered SQLALchemy query
"""
argmap = {
filter.label or label: filter.field
for label, filter in self.filters.items()
}
args = self.opts.parser.parse(argmap)
... | python | def filter(self):
"""Generate a filtered query from request parameters.
:returns: Filtered SQLALchemy query
"""
argmap = {
filter.label or label: filter.field
for label, filter in self.filters.items()
}
args = self.opts.parser.parse(argmap)
... | [
"def",
"filter",
"(",
"self",
")",
":",
"argmap",
"=",
"{",
"filter",
".",
"label",
"or",
"label",
":",
"filter",
".",
"field",
"for",
"label",
",",
"filter",
"in",
"self",
".",
"filters",
".",
"items",
"(",
")",
"}",
"args",
"=",
"self",
".",
"o... | Generate a filtered query from request parameters.
:returns: Filtered SQLALchemy query | [
"Generate",
"a",
"filtered",
"query",
"from",
"request",
"parameters",
"."
] | 564b19bfc10dd960f5adfc48a40c7d565bea8d87 | https://github.com/jmcarp/filteralchemy/blob/564b19bfc10dd960f5adfc48a40c7d565bea8d87/filteralchemy/filterset.py#L147-L162 |
50,156 | raamana/mrivis | mrivis/base.py | SlicePicker._check_min_density | def _check_min_density(self, min_density):
"""Validator to ensure proper usage."""
if min_density is None:
self._min_density = -np.Inf
elif (isinstance(min_density, float) and (0.0 <= min_density < 1.0)):
self._min_density = min_density
else:
raise Va... | python | def _check_min_density(self, min_density):
"""Validator to ensure proper usage."""
if min_density is None:
self._min_density = -np.Inf
elif (isinstance(min_density, float) and (0.0 <= min_density < 1.0)):
self._min_density = min_density
else:
raise Va... | [
"def",
"_check_min_density",
"(",
"self",
",",
"min_density",
")",
":",
"if",
"min_density",
"is",
"None",
":",
"self",
".",
"_min_density",
"=",
"-",
"np",
".",
"Inf",
"elif",
"(",
"isinstance",
"(",
"min_density",
",",
"float",
")",
"and",
"(",
"0.0",
... | Validator to ensure proper usage. | [
"Validator",
"to",
"ensure",
"proper",
"usage",
"."
] | 199ad096b8a1d825f69109e7218a81b2f1cec756 | https://github.com/raamana/mrivis/blob/199ad096b8a1d825f69109e7218a81b2f1cec756/mrivis/base.py#L120-L128 |
50,157 | raamana/mrivis | mrivis/base.py | SlicePicker._not_empty | def _not_empty(self, view, slice_):
"""Checks if the density is too low. """
img2d = self._get_axis(self._image, view, slice_)
return (np.count_nonzero(img2d) / img2d.size) > self._min_density | python | def _not_empty(self, view, slice_):
"""Checks if the density is too low. """
img2d = self._get_axis(self._image, view, slice_)
return (np.count_nonzero(img2d) / img2d.size) > self._min_density | [
"def",
"_not_empty",
"(",
"self",
",",
"view",
",",
"slice_",
")",
":",
"img2d",
"=",
"self",
".",
"_get_axis",
"(",
"self",
".",
"_image",
",",
"view",
",",
"slice_",
")",
"return",
"(",
"np",
".",
"count_nonzero",
"(",
"img2d",
")",
"/",
"img2d",
... | Checks if the density is too low. | [
"Checks",
"if",
"the",
"density",
"is",
"too",
"low",
"."
] | 199ad096b8a1d825f69109e7218a81b2f1cec756 | https://github.com/raamana/mrivis/blob/199ad096b8a1d825f69109e7218a81b2f1cec756/mrivis/base.py#L156-L160 |
50,158 | raamana/mrivis | mrivis/base.py | SlicePicker._sample_slices_in_dim | def _sample_slices_in_dim(self, view, num_slices, non_empty_slices):
"""Samples the slices in the given dimension according the chosen strategy."""
if self._sampling_method == 'linear':
return self._linear_selection(non_empty_slices=non_empty_slices, num_slices=num_slices)
elif self... | python | def _sample_slices_in_dim(self, view, num_slices, non_empty_slices):
"""Samples the slices in the given dimension according the chosen strategy."""
if self._sampling_method == 'linear':
return self._linear_selection(non_empty_slices=non_empty_slices, num_slices=num_slices)
elif self... | [
"def",
"_sample_slices_in_dim",
"(",
"self",
",",
"view",
",",
"num_slices",
",",
"non_empty_slices",
")",
":",
"if",
"self",
".",
"_sampling_method",
"==",
"'linear'",
":",
"return",
"self",
".",
"_linear_selection",
"(",
"non_empty_slices",
"=",
"non_empty_slice... | Samples the slices in the given dimension according the chosen strategy. | [
"Samples",
"the",
"slices",
"in",
"the",
"given",
"dimension",
"according",
"the",
"chosen",
"strategy",
"."
] | 199ad096b8a1d825f69109e7218a81b2f1cec756 | https://github.com/raamana/mrivis/blob/199ad096b8a1d825f69109e7218a81b2f1cec756/mrivis/base.py#L162-L173 |
50,159 | raamana/mrivis | mrivis/base.py | SlicePicker._linear_selection | def _linear_selection(self, non_empty_slices, num_slices):
"""Selects linearly spaced slices in given"""
num_non_empty = len(non_empty_slices)
# # trying to skip 5% slices at the tails (bottom clipping at 0)
# skip_count = max(0, np.around(num_non_empty * 0.05).astype('int16'))
... | python | def _linear_selection(self, non_empty_slices, num_slices):
"""Selects linearly spaced slices in given"""
num_non_empty = len(non_empty_slices)
# # trying to skip 5% slices at the tails (bottom clipping at 0)
# skip_count = max(0, np.around(num_non_empty * 0.05).astype('int16'))
... | [
"def",
"_linear_selection",
"(",
"self",
",",
"non_empty_slices",
",",
"num_slices",
")",
":",
"num_non_empty",
"=",
"len",
"(",
"non_empty_slices",
")",
"# # trying to skip 5% slices at the tails (bottom clipping at 0)",
"# skip_count = max(0, np.around(num_non_empty * 0.05).astyp... | Selects linearly spaced slices in given | [
"Selects",
"linearly",
"spaced",
"slices",
"in",
"given"
] | 199ad096b8a1d825f69109e7218a81b2f1cec756 | https://github.com/raamana/mrivis/blob/199ad096b8a1d825f69109e7218a81b2f1cec756/mrivis/base.py#L175-L191 |
50,160 | raamana/mrivis | mrivis/base.py | SlicePicker._percent_selection | def _percent_selection(self, non_empty_slices):
"""Chooses slices at a given percentage between the first and last non-empty slice."""
return np.around(self._sampler * len(non_empty_slices) / 100).astype('int64') | python | def _percent_selection(self, non_empty_slices):
"""Chooses slices at a given percentage between the first and last non-empty slice."""
return np.around(self._sampler * len(non_empty_slices) / 100).astype('int64') | [
"def",
"_percent_selection",
"(",
"self",
",",
"non_empty_slices",
")",
":",
"return",
"np",
".",
"around",
"(",
"self",
".",
"_sampler",
"*",
"len",
"(",
"non_empty_slices",
")",
"/",
"100",
")",
".",
"astype",
"(",
"'int64'",
")"
] | Chooses slices at a given percentage between the first and last non-empty slice. | [
"Chooses",
"slices",
"at",
"a",
"given",
"percentage",
"between",
"the",
"first",
"and",
"last",
"non",
"-",
"empty",
"slice",
"."
] | 199ad096b8a1d825f69109e7218a81b2f1cec756 | https://github.com/raamana/mrivis/blob/199ad096b8a1d825f69109e7218a81b2f1cec756/mrivis/base.py#L193-L196 |
50,161 | raamana/mrivis | mrivis/base.py | SlicePicker._selection_by_callable | def _selection_by_callable(self, view, num_slices, non_empty_slices):
"""Returns all the slices selected by the given callable."""
selected = [sl for sl in non_empty_slices
if self._sampler(self._get_axis(self._image, view, sl))]
return selected[:num_slices] | python | def _selection_by_callable(self, view, num_slices, non_empty_slices):
"""Returns all the slices selected by the given callable."""
selected = [sl for sl in non_empty_slices
if self._sampler(self._get_axis(self._image, view, sl))]
return selected[:num_slices] | [
"def",
"_selection_by_callable",
"(",
"self",
",",
"view",
",",
"num_slices",
",",
"non_empty_slices",
")",
":",
"selected",
"=",
"[",
"sl",
"for",
"sl",
"in",
"non_empty_slices",
"if",
"self",
".",
"_sampler",
"(",
"self",
".",
"_get_axis",
"(",
"self",
"... | Returns all the slices selected by the given callable. | [
"Returns",
"all",
"the",
"slices",
"selected",
"by",
"the",
"given",
"callable",
"."
] | 199ad096b8a1d825f69109e7218a81b2f1cec756 | https://github.com/raamana/mrivis/blob/199ad096b8a1d825f69109e7218a81b2f1cec756/mrivis/base.py#L198-L204 |
50,162 | raamana/mrivis | mrivis/base.py | SlicePicker.get_slices | def get_slices(self, extended=False):
"""Generator over all the slices selected, each time returning a cross-section.
Parameters
----------
extended : bool
Flag to return just slice data (default, extended=False), or
return a tuple of axis, slice_num, slice_... | python | def get_slices(self, extended=False):
"""Generator over all the slices selected, each time returning a cross-section.
Parameters
----------
extended : bool
Flag to return just slice data (default, extended=False), or
return a tuple of axis, slice_num, slice_... | [
"def",
"get_slices",
"(",
"self",
",",
"extended",
"=",
"False",
")",
":",
"for",
"dim",
",",
"slice_num",
"in",
"self",
".",
"_slices",
":",
"yield",
"self",
".",
"_get_axis",
"(",
"self",
".",
"_image",
",",
"dim",
",",
"slice_num",
",",
"extended",
... | Generator over all the slices selected, each time returning a cross-section.
Parameters
----------
extended : bool
Flag to return just slice data (default, extended=False), or
return a tuple of axis, slice_num, slice_data (extended=True)
Returns
---... | [
"Generator",
"over",
"all",
"the",
"slices",
"selected",
"each",
"time",
"returning",
"a",
"cross",
"-",
"section",
"."
] | 199ad096b8a1d825f69109e7218a81b2f1cec756 | https://github.com/raamana/mrivis/blob/199ad096b8a1d825f69109e7218a81b2f1cec756/mrivis/base.py#L229-L248 |
50,163 | raamana/mrivis | mrivis/base.py | SlicePicker.get_slices_multi | def get_slices_multi(self, image_list, extended=False):
"""Returns the same cross-section from the multiple images supplied.
All images must be of the same shape as the original image defining this object.
Parameters
----------
image_list : Iterable
containing atle... | python | def get_slices_multi(self, image_list, extended=False):
"""Returns the same cross-section from the multiple images supplied.
All images must be of the same shape as the original image defining this object.
Parameters
----------
image_list : Iterable
containing atle... | [
"def",
"get_slices_multi",
"(",
"self",
",",
"image_list",
",",
"extended",
"=",
"False",
")",
":",
"# ensure all the images have the same shape",
"for",
"img",
"in",
"image_list",
":",
"if",
"img",
".",
"shape",
"!=",
"self",
".",
"_image",
".",
"shape",
":",... | Returns the same cross-section from the multiple images supplied.
All images must be of the same shape as the original image defining this object.
Parameters
----------
image_list : Iterable
containing atleast 2 images
extended : bool
Flag to return ju... | [
"Returns",
"the",
"same",
"cross",
"-",
"section",
"from",
"the",
"multiple",
"images",
"supplied",
"."
] | 199ad096b8a1d825f69109e7218a81b2f1cec756 | https://github.com/raamana/mrivis/blob/199ad096b8a1d825f69109e7218a81b2f1cec756/mrivis/base.py#L250-L288 |
50,164 | raamana/mrivis | mrivis/base.py | Collage._make_grid_of_axes | def _make_grid_of_axes(self,
bounding_rect=cfg.bounding_rect_default,
num_rows=cfg.num_rows_per_view_default,
num_cols=cfg.num_cols_grid_default,
axis_pad=cfg.axis_pad_default,
commn_an... | python | def _make_grid_of_axes(self,
bounding_rect=cfg.bounding_rect_default,
num_rows=cfg.num_rows_per_view_default,
num_cols=cfg.num_cols_grid_default,
axis_pad=cfg.axis_pad_default,
commn_an... | [
"def",
"_make_grid_of_axes",
"(",
"self",
",",
"bounding_rect",
"=",
"cfg",
".",
"bounding_rect_default",
",",
"num_rows",
"=",
"cfg",
".",
"num_rows_per_view_default",
",",
"num_cols",
"=",
"cfg",
".",
"num_cols_grid_default",
",",
"axis_pad",
"=",
"cfg",
".",
... | Creates a grid of axes bounded within a given rectangle. | [
"Creates",
"a",
"grid",
"of",
"axes",
"bounded",
"within",
"a",
"given",
"rectangle",
"."
] | 199ad096b8a1d825f69109e7218a81b2f1cec756 | https://github.com/raamana/mrivis/blob/199ad096b8a1d825f69109e7218a81b2f1cec756/mrivis/base.py#L508-L529 |
50,165 | raamana/mrivis | mrivis/base.py | Collage._create_imshow_objects | def _create_imshow_objects(self):
"""Turns off all the x and y axes in each Axis"""
# uniform values for initial image can cause weird behaviour with normalization
# as imshow.set_data() does not automatically update the normalization!!
# using random data is a better choice
... | python | def _create_imshow_objects(self):
"""Turns off all the x and y axes in each Axis"""
# uniform values for initial image can cause weird behaviour with normalization
# as imshow.set_data() does not automatically update the normalization!!
# using random data is a better choice
... | [
"def",
"_create_imshow_objects",
"(",
"self",
")",
":",
"# uniform values for initial image can cause weird behaviour with normalization",
"# as imshow.set_data() does not automatically update the normalization!!",
"# using random data is a better choice",
"random_image",
"=",
"np",
".... | Turns off all the x and y axes in each Axis | [
"Turns",
"off",
"all",
"the",
"x",
"and",
"y",
"axes",
"in",
"each",
"Axis"
] | 199ad096b8a1d825f69109e7218a81b2f1cec756 | https://github.com/raamana/mrivis/blob/199ad096b8a1d825f69109e7218a81b2f1cec756/mrivis/base.py#L558-L567 |
50,166 | raamana/mrivis | mrivis/base.py | Collage.attach | def attach(self,
image_in,
sampler=None,
show=True):
"""Attaches the relevant cross-sections to each axis.
Parameters
----------
attach_image : ndarray
The image to be attached to the collage, once it is created.
Must... | python | def attach(self,
image_in,
sampler=None,
show=True):
"""Attaches the relevant cross-sections to each axis.
Parameters
----------
attach_image : ndarray
The image to be attached to the collage, once it is created.
Must... | [
"def",
"attach",
"(",
"self",
",",
"image_in",
",",
"sampler",
"=",
"None",
",",
"show",
"=",
"True",
")",
":",
"if",
"len",
"(",
"image_in",
".",
"shape",
")",
"<",
"3",
":",
"raise",
"ValueError",
"(",
"'Image must be atleast 3D'",
")",
"# allowing the... | Attaches the relevant cross-sections to each axis.
Parameters
----------
attach_image : ndarray
The image to be attached to the collage, once it is created.
Must be atleast 3d.
sampler : str or list or callable
selection strategy: to identify the ty... | [
"Attaches",
"the",
"relevant",
"cross",
"-",
"sections",
"to",
"each",
"axis",
"."
] | 199ad096b8a1d825f69109e7218a81b2f1cec756 | https://github.com/raamana/mrivis/blob/199ad096b8a1d825f69109e7218a81b2f1cec756/mrivis/base.py#L582-L645 |
50,167 | raamana/mrivis | mrivis/base.py | Collage._set_visible | def _set_visible(self, visibility, grid_index=None):
"""Sets the visibility property of all axes."""
if grid_index is None:
for ax in self.flat_grid:
ax.set_visible(visibility)
else:
if grid_index < 0 or grid_index >= len(self.grids):
rais... | python | def _set_visible(self, visibility, grid_index=None):
"""Sets the visibility property of all axes."""
if grid_index is None:
for ax in self.flat_grid:
ax.set_visible(visibility)
else:
if grid_index < 0 or grid_index >= len(self.grids):
rais... | [
"def",
"_set_visible",
"(",
"self",
",",
"visibility",
",",
"grid_index",
"=",
"None",
")",
":",
"if",
"grid_index",
"is",
"None",
":",
"for",
"ax",
"in",
"self",
".",
"flat_grid",
":",
"ax",
".",
"set_visible",
"(",
"visibility",
")",
"else",
":",
"if... | Sets the visibility property of all axes. | [
"Sets",
"the",
"visibility",
"property",
"of",
"all",
"axes",
"."
] | 199ad096b8a1d825f69109e7218a81b2f1cec756 | https://github.com/raamana/mrivis/blob/199ad096b8a1d825f69109e7218a81b2f1cec756/mrivis/base.py#L725-L735 |
50,168 | raamana/mrivis | mrivis/base.py | Collage.save | def save(self, annot=None, output_path=None):
"""Saves the collage to disk as an image.
Parameters
-----------
annot : str
text to annotate the figure with a super title
output_path : str
path to save the figure to.
Note: any spaces in the f... | python | def save(self, annot=None, output_path=None):
"""Saves the collage to disk as an image.
Parameters
-----------
annot : str
text to annotate the figure with a super title
output_path : str
path to save the figure to.
Note: any spaces in the f... | [
"def",
"save",
"(",
"self",
",",
"annot",
"=",
"None",
",",
"output_path",
"=",
"None",
")",
":",
"if",
"annot",
"is",
"not",
"None",
":",
"self",
".",
"fig",
".",
"suptitle",
"(",
"annot",
",",
"backgroundcolor",
"=",
"'black'",
",",
"color",
"=",
... | Saves the collage to disk as an image.
Parameters
-----------
annot : str
text to annotate the figure with a super title
output_path : str
path to save the figure to.
Note: any spaces in the filename will be replace with ``_`` | [
"Saves",
"the",
"collage",
"to",
"disk",
"as",
"an",
"image",
"."
] | 199ad096b8a1d825f69109e7218a81b2f1cec756 | https://github.com/raamana/mrivis/blob/199ad096b8a1d825f69109e7218a81b2f1cec756/mrivis/base.py#L737-L760 |
50,169 | raamana/mrivis | mrivis/base.py | Collage.clear | def clear(self):
"""Clears all the axes to start fresh."""
for ax in self.flat_grid:
for im_h in ax.findobj(AxesImage):
im_h.remove() | python | def clear(self):
"""Clears all the axes to start fresh."""
for ax in self.flat_grid:
for im_h in ax.findobj(AxesImage):
im_h.remove() | [
"def",
"clear",
"(",
"self",
")",
":",
"for",
"ax",
"in",
"self",
".",
"flat_grid",
":",
"for",
"im_h",
"in",
"ax",
".",
"findobj",
"(",
"AxesImage",
")",
":",
"im_h",
".",
"remove",
"(",
")"
] | Clears all the axes to start fresh. | [
"Clears",
"all",
"the",
"axes",
"to",
"start",
"fresh",
"."
] | 199ad096b8a1d825f69109e7218a81b2f1cec756 | https://github.com/raamana/mrivis/blob/199ad096b8a1d825f69109e7218a81b2f1cec756/mrivis/base.py#L762-L767 |
50,170 | raamana/mrivis | mrivis/base.py | Carpet._check_image | def _check_image(self, image_nD):
"""Sanity checks on the image data"""
self.input_image = load_image_from_disk(image_nD)
if len(self.input_image.shape) < 3:
raise ValueError('Input image must be atleast 3D')
if np.count_nonzero(self.input_image) == 0:
raise Va... | python | def _check_image(self, image_nD):
"""Sanity checks on the image data"""
self.input_image = load_image_from_disk(image_nD)
if len(self.input_image.shape) < 3:
raise ValueError('Input image must be atleast 3D')
if np.count_nonzero(self.input_image) == 0:
raise Va... | [
"def",
"_check_image",
"(",
"self",
",",
"image_nD",
")",
":",
"self",
".",
"input_image",
"=",
"load_image_from_disk",
"(",
"image_nD",
")",
"if",
"len",
"(",
"self",
".",
"input_image",
".",
"shape",
")",
"<",
"3",
":",
"raise",
"ValueError",
"(",
"'In... | Sanity checks on the image data | [
"Sanity",
"checks",
"on",
"the",
"image",
"data"
] | 199ad096b8a1d825f69109e7218a81b2f1cec756 | https://github.com/raamana/mrivis/blob/199ad096b8a1d825f69109e7218a81b2f1cec756/mrivis/base.py#L876-L886 |
50,171 | raamana/mrivis | mrivis/base.py | Carpet._add_fixed_dim | def _add_fixed_dim(self, fixed_dim=-1):
"""Makes note of which dimension needs to be fixed, defaulting to last."""
if fixed_dim in [-1, None, 'last']:
fixed_dim = len(self.input_image.shape) - 1 # last dimension
if int(fixed_dim)!=fixed_dim or \
fixed_dim > len(self.in... | python | def _add_fixed_dim(self, fixed_dim=-1):
"""Makes note of which dimension needs to be fixed, defaulting to last."""
if fixed_dim in [-1, None, 'last']:
fixed_dim = len(self.input_image.shape) - 1 # last dimension
if int(fixed_dim)!=fixed_dim or \
fixed_dim > len(self.in... | [
"def",
"_add_fixed_dim",
"(",
"self",
",",
"fixed_dim",
"=",
"-",
"1",
")",
":",
"if",
"fixed_dim",
"in",
"[",
"-",
"1",
",",
"None",
",",
"'last'",
"]",
":",
"fixed_dim",
"=",
"len",
"(",
"self",
".",
"input_image",
".",
"shape",
")",
"-",
"1",
... | Makes note of which dimension needs to be fixed, defaulting to last. | [
"Makes",
"note",
"of",
"which",
"dimension",
"needs",
"to",
"be",
"fixed",
"defaulting",
"to",
"last",
"."
] | 199ad096b8a1d825f69109e7218a81b2f1cec756 | https://github.com/raamana/mrivis/blob/199ad096b8a1d825f69109e7218a81b2f1cec756/mrivis/base.py#L889-L909 |
50,172 | raamana/mrivis | mrivis/base.py | Carpet._make_carpet | def _make_carpet(self, rescale_data):
"""
Constructs the carpet from the input image.
Optional rescaling of the data.
"""
self.carpet = self._unroll_array(self.input_image, self.fixed_dim)
if rescale_data:
self.carpet = row_wise_rescale(self.carpet) | python | def _make_carpet(self, rescale_data):
"""
Constructs the carpet from the input image.
Optional rescaling of the data.
"""
self.carpet = self._unroll_array(self.input_image, self.fixed_dim)
if rescale_data:
self.carpet = row_wise_rescale(self.carpet) | [
"def",
"_make_carpet",
"(",
"self",
",",
"rescale_data",
")",
":",
"self",
".",
"carpet",
"=",
"self",
".",
"_unroll_array",
"(",
"self",
".",
"input_image",
",",
"self",
".",
"fixed_dim",
")",
"if",
"rescale_data",
":",
"self",
".",
"carpet",
"=",
"row_... | Constructs the carpet from the input image.
Optional rescaling of the data. | [
"Constructs",
"the",
"carpet",
"from",
"the",
"input",
"image",
"."
] | 199ad096b8a1d825f69109e7218a81b2f1cec756 | https://github.com/raamana/mrivis/blob/199ad096b8a1d825f69109e7218a81b2f1cec756/mrivis/base.py#L912-L921 |
50,173 | raamana/mrivis | mrivis/base.py | Carpet.show | def show(self,
clustered=False,
ax_carpet=None,
label_x_axis='time point',
label_y_axis='voxels/ROI'):
"""
Displays the carpet in the given axis.
Parameters
----------
clustered : bool, optional
Flag to indicate wh... | python | def show(self,
clustered=False,
ax_carpet=None,
label_x_axis='time point',
label_y_axis='voxels/ROI'):
"""
Displays the carpet in the given axis.
Parameters
----------
clustered : bool, optional
Flag to indicate wh... | [
"def",
"show",
"(",
"self",
",",
"clustered",
"=",
"False",
",",
"ax_carpet",
"=",
"None",
",",
"label_x_axis",
"=",
"'time point'",
",",
"label_y_axis",
"=",
"'voxels/ROI'",
")",
":",
"if",
"clustered",
"is",
"True",
"and",
"self",
".",
"_carpet_clustered",... | Displays the carpet in the given axis.
Parameters
----------
clustered : bool, optional
Flag to indicate whether to show the clustered/reduced carpet or the original.
You must run .cluster_rows_in_roi() before trying to show clustered carpet.
ax_carpet : Axis, ... | [
"Displays",
"the",
"carpet",
"in",
"the",
"given",
"axis",
"."
] | 199ad096b8a1d825f69109e7218a81b2f1cec756 | https://github.com/raamana/mrivis/blob/199ad096b8a1d825f69109e7218a81b2f1cec756/mrivis/base.py#L930-L994 |
50,174 | raamana/mrivis | mrivis/base.py | Carpet.save | def save(self, output_path=None, title=None):
"""Saves the current figure with carpet visualization to disk.
Parameters
----------
output_path : str
Path to where the figure needs to be saved to.
title : str
text to overlay and annotate the visualizatio... | python | def save(self, output_path=None, title=None):
"""Saves the current figure with carpet visualization to disk.
Parameters
----------
output_path : str
Path to where the figure needs to be saved to.
title : str
text to overlay and annotate the visualizatio... | [
"def",
"save",
"(",
"self",
",",
"output_path",
"=",
"None",
",",
"title",
"=",
"None",
")",
":",
"try",
":",
"save_figure",
"(",
"self",
".",
"fig",
",",
"output_path",
"=",
"output_path",
",",
"annot",
"=",
"title",
")",
"except",
":",
"print",
"("... | Saves the current figure with carpet visualization to disk.
Parameters
----------
output_path : str
Path to where the figure needs to be saved to.
title : str
text to overlay and annotate the visualization (done via plt.suptitle()) | [
"Saves",
"the",
"current",
"figure",
"with",
"carpet",
"visualization",
"to",
"disk",
"."
] | 199ad096b8a1d825f69109e7218a81b2f1cec756 | https://github.com/raamana/mrivis/blob/199ad096b8a1d825f69109e7218a81b2f1cec756/mrivis/base.py#L997-L1015 |
50,175 | raamana/mrivis | mrivis/base.py | Carpet.cluster_rows_in_roi | def cluster_rows_in_roi(self,
roi_mask=None,
num_clusters_per_roi=5,
metric='minkowski'):
"""Clusters the data within all the ROIs specified in a mask.
Parameters
----------
roi_mask : ndarray or None
... | python | def cluster_rows_in_roi(self,
roi_mask=None,
num_clusters_per_roi=5,
metric='minkowski'):
"""Clusters the data within all the ROIs specified in a mask.
Parameters
----------
roi_mask : ndarray or None
... | [
"def",
"cluster_rows_in_roi",
"(",
"self",
",",
"roi_mask",
"=",
"None",
",",
"num_clusters_per_roi",
"=",
"5",
",",
"metric",
"=",
"'minkowski'",
")",
":",
"self",
".",
"_set_roi_mask",
"(",
"roi_mask",
")",
"try",
":",
"clusters",
"=",
"[",
"self",
".",
... | Clusters the data within all the ROIs specified in a mask.
Parameters
----------
roi_mask : ndarray or None
volumetric mask defining the list of ROIs, with a label for each voxel.
This must be the same size in all dimensions except the fixed_dim
i.e. if you ... | [
"Clusters",
"the",
"data",
"within",
"all",
"the",
"ROIs",
"specified",
"in",
"a",
"mask",
"."
] | 199ad096b8a1d825f69109e7218a81b2f1cec756 | https://github.com/raamana/mrivis/blob/199ad096b8a1d825f69109e7218a81b2f1cec756/mrivis/base.py#L1018-L1064 |
50,176 | raamana/mrivis | mrivis/base.py | Carpet._set_roi_mask | def _set_roi_mask(self, roi_mask):
"""Sets a new ROI mask."""
if isinstance(roi_mask,
np.ndarray): # not (roi_mask is None or roi_mask=='auto'):
self._verify_shape_compatibility(roi_mask, 'ROI set')
self.roi_mask = roi_mask
self.roi_list = np.... | python | def _set_roi_mask(self, roi_mask):
"""Sets a new ROI mask."""
if isinstance(roi_mask,
np.ndarray): # not (roi_mask is None or roi_mask=='auto'):
self._verify_shape_compatibility(roi_mask, 'ROI set')
self.roi_mask = roi_mask
self.roi_list = np.... | [
"def",
"_set_roi_mask",
"(",
"self",
",",
"roi_mask",
")",
":",
"if",
"isinstance",
"(",
"roi_mask",
",",
"np",
".",
"ndarray",
")",
":",
"# not (roi_mask is None or roi_mask=='auto'):",
"self",
".",
"_verify_shape_compatibility",
"(",
"roi_mask",
",",
"'ROI set'",
... | Sets a new ROI mask. | [
"Sets",
"a",
"new",
"ROI",
"mask",
"."
] | 199ad096b8a1d825f69109e7218a81b2f1cec756 | https://github.com/raamana/mrivis/blob/199ad096b8a1d825f69109e7218a81b2f1cec756/mrivis/base.py#L1067-L1079 |
50,177 | raamana/mrivis | mrivis/base.py | Carpet._make_clusters | def _make_clusters(self, matrix, num_clusters_per_roi, metric):
"""clusters a given matrix by into specified number of clusters according to given metric"""
from scipy.cluster.hierarchy import fclusterdata
# maxclust needed to ensure t is interpreted as # clusters in heirarchical clustering
... | python | def _make_clusters(self, matrix, num_clusters_per_roi, metric):
"""clusters a given matrix by into specified number of clusters according to given metric"""
from scipy.cluster.hierarchy import fclusterdata
# maxclust needed to ensure t is interpreted as # clusters in heirarchical clustering
... | [
"def",
"_make_clusters",
"(",
"self",
",",
"matrix",
",",
"num_clusters_per_roi",
",",
"metric",
")",
":",
"from",
"scipy",
".",
"cluster",
".",
"hierarchy",
"import",
"fclusterdata",
"# maxclust needed to ensure t is interpreted as # clusters in heirarchical clustering",
"... | clusters a given matrix by into specified number of clusters according to given metric | [
"clusters",
"a",
"given",
"matrix",
"by",
"into",
"specified",
"number",
"of",
"clusters",
"according",
"to",
"given",
"metric"
] | 199ad096b8a1d825f69109e7218a81b2f1cec756 | https://github.com/raamana/mrivis/blob/199ad096b8a1d825f69109e7218a81b2f1cec756/mrivis/base.py#L1094-L1107 |
50,178 | raamana/mrivis | mrivis/base.py | Carpet._apply_mask | def _apply_mask(self, roi_mask):
"""Removes voxels outside the given mask or ROI set."""
# TODO ensure compatible with input image
# - must have < N dim and same size in moving dims.
rows_to_delete = list() # to allow for additional masks to be applied in the future
if isinsta... | python | def _apply_mask(self, roi_mask):
"""Removes voxels outside the given mask or ROI set."""
# TODO ensure compatible with input image
# - must have < N dim and same size in moving dims.
rows_to_delete = list() # to allow for additional masks to be applied in the future
if isinsta... | [
"def",
"_apply_mask",
"(",
"self",
",",
"roi_mask",
")",
":",
"# TODO ensure compatible with input image",
"# - must have < N dim and same size in moving dims.",
"rows_to_delete",
"=",
"list",
"(",
")",
"# to allow for additional masks to be applied in the future",
"if",
"isinsta... | Removes voxels outside the given mask or ROI set. | [
"Removes",
"voxels",
"outside",
"the",
"given",
"mask",
"or",
"ROI",
"set",
"."
] | 199ad096b8a1d825f69109e7218a81b2f1cec756 | https://github.com/raamana/mrivis/blob/199ad096b8a1d825f69109e7218a81b2f1cec756/mrivis/base.py#L1110-L1126 |
50,179 | raamana/mrivis | mrivis/base.py | Carpet._verify_shape_compatibility | def _verify_shape_compatibility(self, img, img_type):
"""Checks mask shape against input image shape."""
if self.input_image.shape[:-1] != img.shape:
raise ValueError('Shape of the {} ({}) is not compatible '
'with input image shape: {} '
... | python | def _verify_shape_compatibility(self, img, img_type):
"""Checks mask shape against input image shape."""
if self.input_image.shape[:-1] != img.shape:
raise ValueError('Shape of the {} ({}) is not compatible '
'with input image shape: {} '
... | [
"def",
"_verify_shape_compatibility",
"(",
"self",
",",
"img",
",",
"img_type",
")",
":",
"if",
"self",
".",
"input_image",
".",
"shape",
"[",
":",
"-",
"1",
"]",
"!=",
"img",
".",
"shape",
":",
"raise",
"ValueError",
"(",
"'Shape of the {} ({}) is not compa... | Checks mask shape against input image shape. | [
"Checks",
"mask",
"shape",
"against",
"input",
"image",
"shape",
"."
] | 199ad096b8a1d825f69109e7218a81b2f1cec756 | https://github.com/raamana/mrivis/blob/199ad096b8a1d825f69109e7218a81b2f1cec756/mrivis/base.py#L1129-L1135 |
50,180 | idlesign/django-sitegate | sitegate/views.py | verify_email | def verify_email(request, code, redirect_to=None):
"""Verifies an account activation code a user received by e-mail.
Requires Messages Django Contrib.
:param Requset request:
:param str code:
:param str redirect_to:
:return:
"""
success = False
valid_code = EmailConfirmation.is_va... | python | def verify_email(request, code, redirect_to=None):
"""Verifies an account activation code a user received by e-mail.
Requires Messages Django Contrib.
:param Requset request:
:param str code:
:param str redirect_to:
:return:
"""
success = False
valid_code = EmailConfirmation.is_va... | [
"def",
"verify_email",
"(",
"request",
",",
"code",
",",
"redirect_to",
"=",
"None",
")",
":",
"success",
"=",
"False",
"valid_code",
"=",
"EmailConfirmation",
".",
"is_valid",
"(",
"code",
")",
"if",
"valid_code",
":",
"valid_code",
".",
"activate",
"(",
... | Verifies an account activation code a user received by e-mail.
Requires Messages Django Contrib.
:param Requset request:
:param str code:
:param str redirect_to:
:return: | [
"Verifies",
"an",
"account",
"activation",
"code",
"a",
"user",
"received",
"by",
"e",
"-",
"mail",
"."
] | 0e58de91605071833d75a7c21f2d0de2f2e3c896 | https://github.com/idlesign/django-sitegate/blob/0e58de91605071833d75a7c21f2d0de2f2e3c896/sitegate/views.py#L8-L33 |
50,181 | facundobatista/yaswfp | yaswfp/helpers.py | unpack_fixed8 | def unpack_fixed8(src):
"""Get a FIXED8 value."""
dec_part = unpack_ui8(src)
int_part = unpack_ui8(src)
return int_part + dec_part / 256 | python | def unpack_fixed8(src):
"""Get a FIXED8 value."""
dec_part = unpack_ui8(src)
int_part = unpack_ui8(src)
return int_part + dec_part / 256 | [
"def",
"unpack_fixed8",
"(",
"src",
")",
":",
"dec_part",
"=",
"unpack_ui8",
"(",
"src",
")",
"int_part",
"=",
"unpack_ui8",
"(",
"src",
")",
"return",
"int_part",
"+",
"dec_part",
"/",
"256"
] | Get a FIXED8 value. | [
"Get",
"a",
"FIXED8",
"value",
"."
] | 2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c | https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/helpers.py#L53-L57 |
50,182 | facundobatista/yaswfp | yaswfp/helpers.py | unpack_float16 | def unpack_float16(src):
"""Read and unpack a 16b float.
The structure is:
- 1 bit for the sign
. 5 bits for the exponent, with an exponent bias of 16
- 10 bits for the mantissa
"""
bc = BitConsumer(src)
sign = bc.u_get(1)
exponent = bc.u_get(5)
mantissa = bc.u_get(10)
expon... | python | def unpack_float16(src):
"""Read and unpack a 16b float.
The structure is:
- 1 bit for the sign
. 5 bits for the exponent, with an exponent bias of 16
- 10 bits for the mantissa
"""
bc = BitConsumer(src)
sign = bc.u_get(1)
exponent = bc.u_get(5)
mantissa = bc.u_get(10)
expon... | [
"def",
"unpack_float16",
"(",
"src",
")",
":",
"bc",
"=",
"BitConsumer",
"(",
"src",
")",
"sign",
"=",
"bc",
".",
"u_get",
"(",
"1",
")",
"exponent",
"=",
"bc",
".",
"u_get",
"(",
"5",
")",
"mantissa",
"=",
"bc",
".",
"u_get",
"(",
"10",
")",
"... | Read and unpack a 16b float.
The structure is:
- 1 bit for the sign
. 5 bits for the exponent, with an exponent bias of 16
- 10 bits for the mantissa | [
"Read",
"and",
"unpack",
"a",
"16b",
"float",
"."
] | 2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c | https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/helpers.py#L67-L82 |
50,183 | facundobatista/yaswfp | yaswfp/helpers.py | BitConsumer.u_get | def u_get(self, quant):
"""Return a number using the given quantity of unsigned bits."""
if not quant:
return
bits = []
while quant:
if self._count == 0:
byte = self.src.read(1)
number = struct.unpack("<B", byte)[0]
... | python | def u_get(self, quant):
"""Return a number using the given quantity of unsigned bits."""
if not quant:
return
bits = []
while quant:
if self._count == 0:
byte = self.src.read(1)
number = struct.unpack("<B", byte)[0]
... | [
"def",
"u_get",
"(",
"self",
",",
"quant",
")",
":",
"if",
"not",
"quant",
":",
"return",
"bits",
"=",
"[",
"]",
"while",
"quant",
":",
"if",
"self",
".",
"_count",
"==",
"0",
":",
"byte",
"=",
"self",
".",
"src",
".",
"read",
"(",
"1",
")",
... | Return a number using the given quantity of unsigned bits. | [
"Return",
"a",
"number",
"using",
"the",
"given",
"quantity",
"of",
"unsigned",
"bits",
"."
] | 2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c | https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/helpers.py#L102-L120 |
50,184 | facundobatista/yaswfp | yaswfp/helpers.py | BitConsumer.s_get | def s_get(self, quant):
"""Return a number using the given quantity of signed bits."""
if quant < 2:
# special case, just return that unsigned value
# quant can also be 0
return self.u_get(quant)
sign = self.u_get(1)
raw_number = self.u_get(quant - 1)... | python | def s_get(self, quant):
"""Return a number using the given quantity of signed bits."""
if quant < 2:
# special case, just return that unsigned value
# quant can also be 0
return self.u_get(quant)
sign = self.u_get(1)
raw_number = self.u_get(quant - 1)... | [
"def",
"s_get",
"(",
"self",
",",
"quant",
")",
":",
"if",
"quant",
"<",
"2",
":",
"# special case, just return that unsigned value",
"# quant can also be 0",
"return",
"self",
".",
"u_get",
"(",
"quant",
")",
"sign",
"=",
"self",
".",
"u_get",
"(",
"1",
")"... | Return a number using the given quantity of signed bits. | [
"Return",
"a",
"number",
"using",
"the",
"given",
"quantity",
"of",
"signed",
"bits",
"."
] | 2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c | https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/helpers.py#L122-L138 |
50,185 | facundobatista/yaswfp | yaswfp/helpers.py | BitConsumer.fb_get | def fb_get(self, quant, fb=16):
"""Return a fixed bit number
quant: number of bits to read
fb: number of bits in the integer and decimal part of the output
default is 16, resulting in a 16.16 fixed bit"""
raw_number = self.s_get(quant)
if quant == 1:
# ... | python | def fb_get(self, quant, fb=16):
"""Return a fixed bit number
quant: number of bits to read
fb: number of bits in the integer and decimal part of the output
default is 16, resulting in a 16.16 fixed bit"""
raw_number = self.s_get(quant)
if quant == 1:
# ... | [
"def",
"fb_get",
"(",
"self",
",",
"quant",
",",
"fb",
"=",
"16",
")",
":",
"raw_number",
"=",
"self",
".",
"s_get",
"(",
"quant",
")",
"if",
"quant",
"==",
"1",
":",
"# special case, just return that unsigned value",
"return",
"raw_number",
"return",
"raw_n... | Return a fixed bit number
quant: number of bits to read
fb: number of bits in the integer and decimal part of the output
default is 16, resulting in a 16.16 fixed bit | [
"Return",
"a",
"fixed",
"bit",
"number"
] | 2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c | https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/helpers.py#L140-L153 |
50,186 | raamana/mrivis | mrivis/color_maps.py | get_freesurfer_cmap | def get_freesurfer_cmap(vis_type):
"""Provides different colormaps for different visualization types."""
if vis_type in ('cortical_volumetric', 'cortical_contour'):
LUT = get_freesurfer_cortical_LUT()
cmap = ListedColormap(LUT)
elif vis_type in ('labels_volumetric', 'labels_contour'... | python | def get_freesurfer_cmap(vis_type):
"""Provides different colormaps for different visualization types."""
if vis_type in ('cortical_volumetric', 'cortical_contour'):
LUT = get_freesurfer_cortical_LUT()
cmap = ListedColormap(LUT)
elif vis_type in ('labels_volumetric', 'labels_contour'... | [
"def",
"get_freesurfer_cmap",
"(",
"vis_type",
")",
":",
"if",
"vis_type",
"in",
"(",
"'cortical_volumetric'",
",",
"'cortical_contour'",
")",
":",
"LUT",
"=",
"get_freesurfer_cortical_LUT",
"(",
")",
"cmap",
"=",
"ListedColormap",
"(",
"LUT",
")",
"elif",
"vis_... | Provides different colormaps for different visualization types. | [
"Provides",
"different",
"colormaps",
"for",
"different",
"visualization",
"types",
"."
] | 199ad096b8a1d825f69109e7218a81b2f1cec756 | https://github.com/raamana/mrivis/blob/199ad096b8a1d825f69109e7218a81b2f1cec756/mrivis/color_maps.py#L74-L91 |
50,187 | jandd/python-pkiutils | pkiutils/__init__.py | create_rsa_key | def create_rsa_key(bits=2048,
keyfile=None,
format='PEM',
passphrase=None):
"""
Generate a new RSA key with the specified key size.
:param int bits:
bit size of the key modulus
:param str keyfile:
file the key should be written t... | python | def create_rsa_key(bits=2048,
keyfile=None,
format='PEM',
passphrase=None):
"""
Generate a new RSA key with the specified key size.
:param int bits:
bit size of the key modulus
:param str keyfile:
file the key should be written t... | [
"def",
"create_rsa_key",
"(",
"bits",
"=",
"2048",
",",
"keyfile",
"=",
"None",
",",
"format",
"=",
"'PEM'",
",",
"passphrase",
"=",
"None",
")",
":",
"if",
"passphrase",
"and",
"format",
"!=",
"'PEM'",
":",
"raise",
"Exception",
"(",
"\"passphrase is only... | Generate a new RSA key with the specified key size.
:param int bits:
bit size of the key modulus
:param str keyfile:
file the key should be written to
:param str format:
format for the key file, either PEM or DER
:param str passphrase:
pass phrase for encrypting the k... | [
"Generate",
"a",
"new",
"RSA",
"key",
"with",
"the",
"specified",
"key",
"size",
"."
] | 02aa42dde1e11ffc95e579dd25b4b0ac7a8c44f3 | https://github.com/jandd/python-pkiutils/blob/02aa42dde1e11ffc95e579dd25b4b0ac7a8c44f3/pkiutils/__init__.py#L26-L60 |
50,188 | jandd/python-pkiutils | pkiutils/__init__.py | create_csr | def create_csr(key, dn, csrfilename=None, attributes=None):
"""
Generates a Certificate Signing Request for a given key.
:param Crypto.PublicKey.RSA._RSAobj key:
a key
:param dn:
a distinguished name as dictionary or string with key=value pairs
separated by slashes like ``/CN=t... | python | def create_csr(key, dn, csrfilename=None, attributes=None):
"""
Generates a Certificate Signing Request for a given key.
:param Crypto.PublicKey.RSA._RSAobj key:
a key
:param dn:
a distinguished name as dictionary or string with key=value pairs
separated by slashes like ``/CN=t... | [
"def",
"create_csr",
"(",
"key",
",",
"dn",
",",
"csrfilename",
"=",
"None",
",",
"attributes",
"=",
"None",
")",
":",
"certreqInfo",
"=",
"rfc2314",
".",
"CertificationRequestInfo",
"(",
")",
"certreqInfo",
".",
"setComponentByName",
"(",
"'version'",
",",
... | Generates a Certificate Signing Request for a given key.
:param Crypto.PublicKey.RSA._RSAobj key:
a key
:param dn:
a distinguished name as dictionary or string with key=value pairs
separated by slashes like ``/CN=test.example.org/C=DE/O=Test
organisation/``
:param str csrf... | [
"Generates",
"a",
"Certificate",
"Signing",
"Request",
"for",
"a",
"given",
"key",
"."
] | 02aa42dde1e11ffc95e579dd25b4b0ac7a8c44f3 | https://github.com/jandd/python-pkiutils/blob/02aa42dde1e11ffc95e579dd25b4b0ac7a8c44f3/pkiutils/__init__.py#L284-L334 |
50,189 | idlesign/django-sitegate | sitegate/flows_base.py | FlowsBase.respond_for | def respond_for(self, view_function, args, kwargs):
"""Returns a response for the given view & args."""
request = args[0]
form = self.get_requested_form(request)
if form.is_valid():
result = self.handle_form_valid(request, form)
if result:
return ... | python | def respond_for(self, view_function, args, kwargs):
"""Returns a response for the given view & args."""
request = args[0]
form = self.get_requested_form(request)
if form.is_valid():
result = self.handle_form_valid(request, form)
if result:
return ... | [
"def",
"respond_for",
"(",
"self",
",",
"view_function",
",",
"args",
",",
"kwargs",
")",
":",
"request",
"=",
"args",
"[",
"0",
"]",
"form",
"=",
"self",
".",
"get_requested_form",
"(",
"request",
")",
"if",
"form",
".",
"is_valid",
"(",
")",
":",
"... | Returns a response for the given view & args. | [
"Returns",
"a",
"response",
"for",
"the",
"given",
"view",
"&",
"args",
"."
] | 0e58de91605071833d75a7c21f2d0de2f2e3c896 | https://github.com/idlesign/django-sitegate/blob/0e58de91605071833d75a7c21f2d0de2f2e3c896/sitegate/flows_base.py#L44-L55 |
50,190 | idlesign/django-sitegate | sitegate/flows_base.py | FlowsBase.update_request | def update_request(self, request, form):
"""Updates Request object with flows forms."""
forms_key = '%s_forms' % self.flow_type
# Use ordered forms dict in case _formNode wants to fetch the first defined.
flow_dict = OrderedDict()
try:
flow_dict = request.sitegate[fo... | python | def update_request(self, request, form):
"""Updates Request object with flows forms."""
forms_key = '%s_forms' % self.flow_type
# Use ordered forms dict in case _formNode wants to fetch the first defined.
flow_dict = OrderedDict()
try:
flow_dict = request.sitegate[fo... | [
"def",
"update_request",
"(",
"self",
",",
"request",
",",
"form",
")",
":",
"forms_key",
"=",
"'%s_forms'",
"%",
"self",
".",
"flow_type",
"# Use ordered forms dict in case _formNode wants to fetch the first defined.",
"flow_dict",
"=",
"OrderedDict",
"(",
")",
"try",
... | Updates Request object with flows forms. | [
"Updates",
"Request",
"object",
"with",
"flows",
"forms",
"."
] | 0e58de91605071833d75a7c21f2d0de2f2e3c896 | https://github.com/idlesign/django-sitegate/blob/0e58de91605071833d75a7c21f2d0de2f2e3c896/sitegate/flows_base.py#L57-L71 |
50,191 | idlesign/django-sitegate | sitegate/flows_base.py | FlowsBase.login_generic | def login_generic(request, username, password):
"""Helper method. Generic login with username and password."""
user = authenticate(username=username, password=password)
if user is not None and user.is_active:
login(request, user)
return True
return False | python | def login_generic(request, username, password):
"""Helper method. Generic login with username and password."""
user = authenticate(username=username, password=password)
if user is not None and user.is_active:
login(request, user)
return True
return False | [
"def",
"login_generic",
"(",
"request",
",",
"username",
",",
"password",
")",
":",
"user",
"=",
"authenticate",
"(",
"username",
"=",
"username",
",",
"password",
"=",
"password",
")",
"if",
"user",
"is",
"not",
"None",
"and",
"user",
".",
"is_active",
... | Helper method. Generic login with username and password. | [
"Helper",
"method",
".",
"Generic",
"login",
"with",
"username",
"and",
"password",
"."
] | 0e58de91605071833d75a7c21f2d0de2f2e3c896 | https://github.com/idlesign/django-sitegate/blob/0e58de91605071833d75a7c21f2d0de2f2e3c896/sitegate/flows_base.py#L82-L88 |
50,192 | idlesign/django-sitegate | sitegate/flows_base.py | FlowsBase.get_arg_or_attr | def get_arg_or_attr(self, name, default=None):
"""Returns flow argument, as provided with sitegate decorators
or attribute set as a flow class attribute or default."""
if name in self.flow_args:
return self.flow_args[name]
try:
return getattr(self, name)
... | python | def get_arg_or_attr(self, name, default=None):
"""Returns flow argument, as provided with sitegate decorators
or attribute set as a flow class attribute or default."""
if name in self.flow_args:
return self.flow_args[name]
try:
return getattr(self, name)
... | [
"def",
"get_arg_or_attr",
"(",
"self",
",",
"name",
",",
"default",
"=",
"None",
")",
":",
"if",
"name",
"in",
"self",
".",
"flow_args",
":",
"return",
"self",
".",
"flow_args",
"[",
"name",
"]",
"try",
":",
"return",
"getattr",
"(",
"self",
",",
"na... | Returns flow argument, as provided with sitegate decorators
or attribute set as a flow class attribute or default. | [
"Returns",
"flow",
"argument",
"as",
"provided",
"with",
"sitegate",
"decorators",
"or",
"attribute",
"set",
"as",
"a",
"flow",
"class",
"attribute",
"or",
"default",
"."
] | 0e58de91605071833d75a7c21f2d0de2f2e3c896 | https://github.com/idlesign/django-sitegate/blob/0e58de91605071833d75a7c21f2d0de2f2e3c896/sitegate/flows_base.py#L90-L98 |
50,193 | idlesign/django-sitegate | sitegate/flows_base.py | FlowsBase.get_requested_form | def get_requested_form(self, request):
"""Returns an instance of a form requested."""
flow_name = self.get_flow_name()
flow_key = '%s_flow' % self.flow_type
flow_enabled = self.enabled
form_data = None
if (flow_enabled and
request.method == 'POST' and
... | python | def get_requested_form(self, request):
"""Returns an instance of a form requested."""
flow_name = self.get_flow_name()
flow_key = '%s_flow' % self.flow_type
flow_enabled = self.enabled
form_data = None
if (flow_enabled and
request.method == 'POST' and
... | [
"def",
"get_requested_form",
"(",
"self",
",",
"request",
")",
":",
"flow_name",
"=",
"self",
".",
"get_flow_name",
"(",
")",
"flow_key",
"=",
"'%s_flow'",
"%",
"self",
".",
"flow_type",
"flow_enabled",
"=",
"self",
".",
"enabled",
"form_data",
"=",
"None",
... | Returns an instance of a form requested. | [
"Returns",
"an",
"instance",
"of",
"a",
"form",
"requested",
"."
] | 0e58de91605071833d75a7c21f2d0de2f2e3c896 | https://github.com/idlesign/django-sitegate/blob/0e58de91605071833d75a7c21f2d0de2f2e3c896/sitegate/flows_base.py#L100-L124 |
50,194 | idlesign/django-sitegate | sitegate/flows_base.py | FlowsBase.init_form | def init_form(self, form_data, widget_attrs=None, template=None):
"""Constructs, populates and returns a form."""
form = self.form(data=form_data)
form.template = template
# Attach flow attribute to have access from flow forms (usually to call get_arg_or_attr())
form.flow = self
... | python | def init_form(self, form_data, widget_attrs=None, template=None):
"""Constructs, populates and returns a form."""
form = self.form(data=form_data)
form.template = template
# Attach flow attribute to have access from flow forms (usually to call get_arg_or_attr())
form.flow = self
... | [
"def",
"init_form",
"(",
"self",
",",
"form_data",
",",
"widget_attrs",
"=",
"None",
",",
"template",
"=",
"None",
")",
":",
"form",
"=",
"self",
".",
"form",
"(",
"data",
"=",
"form_data",
")",
"form",
".",
"template",
"=",
"template",
"# Attach flow at... | Constructs, populates and returns a form. | [
"Constructs",
"populates",
"and",
"returns",
"a",
"form",
"."
] | 0e58de91605071833d75a7c21f2d0de2f2e3c896 | https://github.com/idlesign/django-sitegate/blob/0e58de91605071833d75a7c21f2d0de2f2e3c896/sitegate/flows_base.py#L126-L134 |
50,195 | pudo-attic/scrapekit | scrapekit/logs.py | log_path | def log_path(scraper):
""" Determine the file name for the JSON log. """
return os.path.join(scraper.config.data_path,
'%s.jsonlog' % scraper.name) | python | def log_path(scraper):
""" Determine the file name for the JSON log. """
return os.path.join(scraper.config.data_path,
'%s.jsonlog' % scraper.name) | [
"def",
"log_path",
"(",
"scraper",
")",
":",
"return",
"os",
".",
"path",
".",
"join",
"(",
"scraper",
".",
"config",
".",
"data_path",
",",
"'%s.jsonlog'",
"%",
"scraper",
".",
"name",
")"
] | Determine the file name for the JSON log. | [
"Determine",
"the",
"file",
"name",
"for",
"the",
"JSON",
"log",
"."
] | cfd258120922fcd571430cdf00ba50f3cf18dc15 | https://github.com/pudo-attic/scrapekit/blob/cfd258120922fcd571430cdf00ba50f3cf18dc15/scrapekit/logs.py#L42-L45 |
50,196 | pudo-attic/scrapekit | scrapekit/logs.py | make_logger | def make_logger(scraper):
""" Create two log handlers, one to output info-level ouput to the
console, the other to store all logging in a JSON file which will
later be used to generate reports. """
logger = logging.getLogger('')
logger.setLevel(logging.DEBUG)
requests_log = logging.getLogger("... | python | def make_logger(scraper):
""" Create two log handlers, one to output info-level ouput to the
console, the other to store all logging in a JSON file which will
later be used to generate reports. """
logger = logging.getLogger('')
logger.setLevel(logging.DEBUG)
requests_log = logging.getLogger("... | [
"def",
"make_logger",
"(",
"scraper",
")",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"''",
")",
"logger",
".",
"setLevel",
"(",
"logging",
".",
"DEBUG",
")",
"requests_log",
"=",
"logging",
".",
"getLogger",
"(",
"\"requests\"",
")",
"requests_... | Create two log handlers, one to output info-level ouput to the
console, the other to store all logging in a JSON file which will
later be used to generate reports. | [
"Create",
"two",
"log",
"handlers",
"one",
"to",
"output",
"info",
"-",
"level",
"ouput",
"to",
"the",
"console",
"the",
"other",
"to",
"store",
"all",
"logging",
"in",
"a",
"JSON",
"file",
"which",
"will",
"later",
"be",
"used",
"to",
"generate",
"repor... | cfd258120922fcd571430cdf00ba50f3cf18dc15 | https://github.com/pudo-attic/scrapekit/blob/cfd258120922fcd571430cdf00ba50f3cf18dc15/scrapekit/logs.py#L48-L74 |
50,197 | sbjorn/vici | vici/session.py | Session.initiate | def initiate(self, sa):
"""Initiate an SA.
:param sa: the SA to initiate
:type sa: dict
:return: logs emitted by command, with `errmsg` given on failure
:rtype: :py:class:`vici.session.CommandResult`
"""
response = self.handler.streamed_request("initiate", "contr... | python | def initiate(self, sa):
"""Initiate an SA.
:param sa: the SA to initiate
:type sa: dict
:return: logs emitted by command, with `errmsg` given on failure
:rtype: :py:class:`vici.session.CommandResult`
"""
response = self.handler.streamed_request("initiate", "contr... | [
"def",
"initiate",
"(",
"self",
",",
"sa",
")",
":",
"response",
"=",
"self",
".",
"handler",
".",
"streamed_request",
"(",
"\"initiate\"",
",",
"\"control-log\"",
",",
"sa",
")",
"return",
"self",
".",
"_result",
"(",
"*",
"response",
")"
] | Initiate an SA.
:param sa: the SA to initiate
:type sa: dict
:return: logs emitted by command, with `errmsg` given on failure
:rtype: :py:class:`vici.session.CommandResult` | [
"Initiate",
"an",
"SA",
"."
] | 147135905b68892734b09ec8a569c71733648090 | https://github.com/sbjorn/vici/blob/147135905b68892734b09ec8a569c71733648090/vici/session.py#L41-L50 |
50,198 | sbjorn/vici | vici/session.py | Session.terminate | def terminate(self, sa):
"""Terminate an SA.
:param sa: the SA to terminate
:type sa: dict
:return: logs emitted by command, with `errmsg` given on failure
:rtype: :py:class:`vici.session.CommandResult`
"""
response = self.handler.streamed_request("terminate", "c... | python | def terminate(self, sa):
"""Terminate an SA.
:param sa: the SA to terminate
:type sa: dict
:return: logs emitted by command, with `errmsg` given on failure
:rtype: :py:class:`vici.session.CommandResult`
"""
response = self.handler.streamed_request("terminate", "c... | [
"def",
"terminate",
"(",
"self",
",",
"sa",
")",
":",
"response",
"=",
"self",
".",
"handler",
".",
"streamed_request",
"(",
"\"terminate\"",
",",
"\"control-log\"",
",",
"sa",
")",
"return",
"self",
".",
"_result",
"(",
"*",
"response",
")"
] | Terminate an SA.
:param sa: the SA to terminate
:type sa: dict
:return: logs emitted by command, with `errmsg` given on failure
:rtype: :py:class:`vici.session.CommandResult` | [
"Terminate",
"an",
"SA",
"."
] | 147135905b68892734b09ec8a569c71733648090 | https://github.com/sbjorn/vici/blob/147135905b68892734b09ec8a569c71733648090/vici/session.py#L52-L61 |
50,199 | sbjorn/vici | vici/session.py | Session.list_sas | def list_sas(self, filters=None):
"""Retrieve active IKE_SAs and associated CHILD_SAs.
:param filters: retrieve only matching IKE_SAs (optional)
:type filters: dict
:return: list of active IKE_SAs and associated CHILD_SAs
:rtype: list
"""
_, sa_list = self.handle... | python | def list_sas(self, filters=None):
"""Retrieve active IKE_SAs and associated CHILD_SAs.
:param filters: retrieve only matching IKE_SAs (optional)
:type filters: dict
:return: list of active IKE_SAs and associated CHILD_SAs
:rtype: list
"""
_, sa_list = self.handle... | [
"def",
"list_sas",
"(",
"self",
",",
"filters",
"=",
"None",
")",
":",
"_",
",",
"sa_list",
"=",
"self",
".",
"handler",
".",
"streamed_request",
"(",
"\"list-sas\"",
",",
"\"list-sa\"",
",",
"filters",
")",
"return",
"sa_list"
] | Retrieve active IKE_SAs and associated CHILD_SAs.
:param filters: retrieve only matching IKE_SAs (optional)
:type filters: dict
:return: list of active IKE_SAs and associated CHILD_SAs
:rtype: list | [
"Retrieve",
"active",
"IKE_SAs",
"and",
"associated",
"CHILD_SAs",
"."
] | 147135905b68892734b09ec8a569c71733648090 | https://github.com/sbjorn/vici/blob/147135905b68892734b09ec8a569c71733648090/vici/session.py#L83-L93 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.