project_name
string
class_name
string
class_modifiers
string
class_implements
int64
class_extends
int64
function_name
string
function_body
string
cyclomatic_complexity
int64
NLOC
int64
num_parameter
int64
num_token
int64
num_variable
int64
start_line
int64
end_line
int64
function_index
int64
function_params
string
function_variable
string
function_return_type
string
function_body_line_type
string
function_num_functions
int64
function_num_lines
int64
outgoing_function_count
int64
outgoing_function_names
string
incoming_function_count
int64
incoming_function_names
string
lexical_representation
string
takluyver_pyxdg
public
public
0
0
__add__
def __add__(self, other):for dir in other.AppDirs:self.AppDirs.append(dir)for dir in other.DirectoryDirs:self.DirectoryDirs.append(dir)for directory in other.Directories:self.Directories.append(directory)if other.Deleted is not None:self.Deleted = other.Deletedif other.OnlyUnallocated is not None:self.OnlyUnallocated =...
11
22
2
151
0
104
135
104
null
[]
None
null
0
0
0
null
0
null
The function (__add__) defined within the public class called public.The function start at line 104 and ends at 135. It contains 22 lines of code and it has a cyclomatic complexity of 11. It takes 2 parameters, represented as [104.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
__cmp__
def __cmp__(self, other):return locale.strcoll(self.getName(), other.getName())
1
2
2
24
0
138
139
138
null
[]
None
null
0
0
0
null
0
null
The function (__cmp__) defined within the public class called public.The function start at line 138 and ends at 139. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [138.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
_key
def _key(self):"""Key function for locale-aware sorting."""return _strxfrm(self.getName())
1
2
1
15
0
141
143
141
null
[]
None
null
0
0
0
null
0
null
The function (_key) defined within the public class called public.The function start at line 141 and ends at 143. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
takluyver_pyxdg
public
public
0
0
__lt__
def __lt__(self, other):try:other = other._key()except AttributeError:passreturn self._key() < other
2
6
2
28
0
145
150
145
null
[]
None
null
0
0
0
null
0
null
The function (__lt__) defined within the public class called public.The function start at line 145 and ends at 150. It contains 6 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [145.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
__eq__
def __eq__(self, other):try:return self.Name == unicode(other)except NameError:# unicode() becomes str() in Python 3return self.Name == str(other)
2
5
2
30
0
152
156
152
null
[]
None
null
0
0
0
null
0
null
The function (__eq__) defined within the public class called public.The function start at line 152 and ends at 156. It contains 5 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [152.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
getEntries
def getEntries(self, show_hidden=False):"""Interator for a list of Entries visible to the user."""for entry in self.Entries:if show_hidden:yield entryelif entry.Show is True:yield entry
4
6
2
31
0
159
165
159
null
[]
None
null
0
0
0
null
0
null
The function (getEntries) defined within the public class called public.The function start at line 159 and ends at 165. It contains 6 lines of code and it has a cyclomatic complexity of 4. It takes 2 parameters, represented as [159.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
getMenuEntry
def getMenuEntry(self, desktopfileid, deep=False):"""Searches for a MenuEntry with a given DesktopFileID."""for menuentry in self.MenuEntries:if menuentry.DesktopFileID == desktopfileid:return menuentryif deep:for submenu in self.Submenus:submenu.getMenuEntry(desktopfileid, deep)
5
7
3
46
0
171
178
171
null
[]
None
null
0
0
0
null
0
null
The function (getMenuEntry) defined within the public class called public.The function start at line 171 and ends at 178. It contains 7 lines of code and it has a cyclomatic complexity of 5. It takes 3 parameters, represented as [171.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
getMenu
def getMenu(self, path):"""Searches for a Menu with a given path."""array = path.split("/", 1)for submenu in self.Submenus:if submenu.Name == array[0]:if len(array) > 1:return submenu.getMenu(array[1])else:return submenu
4
8
2
57
0
180
188
180
null
[]
None
null
0
0
0
null
0
null
The function (getMenu) defined within the public class called public.The function start at line 180 and ends at 188. It contains 8 lines of code and it has a cyclomatic complexity of 4. It takes 2 parameters, represented as [180.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
getPath
def getPath(self, org=False, toplevel=False):"""Returns this menu's path in the menu structure."""parent = selfnames = []while 1:if org:names.append(parent.Name)else:names.append(parent.getName())if parent.Depth > 0:parent = parent.Parentelse:breaknames.reverse()path = ""if not toplevel:names.pop(0)for name in names:pa...
6
19
3
99
0
190
209
190
null
[]
None
null
0
0
0
null
0
null
The function (getPath) defined within the public class called public.The function start at line 190 and ends at 209. It contains 19 lines of code and it has a cyclomatic complexity of 6. It takes 3 parameters, represented as [190.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
getName
def getName(self):"""Returns the menu's localised name."""try:return self.Directory.DesktopEntry.getName()except AttributeError:return self.Name
2
5
1
25
0
211
216
211
null
[]
None
null
0
0
0
null
0
null
The function (getName) defined within the public class called public.The function start at line 211 and ends at 216. It contains 5 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value..
takluyver_pyxdg
public
public
0
0
getGenericName
def getGenericName(self):"""Returns the menu's generic name."""try:return self.Directory.DesktopEntry.getGenericName()except AttributeError:return ""
2
5
1
23
0
218
223
218
null
[]
None
null
0
0
0
null
0
null
The function (getGenericName) defined within the public class called public.The function start at line 218 and ends at 223. It contains 5 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value..
takluyver_pyxdg
public
public
0
0
getComment
def getComment(self):"""Returns the menu's comment text."""try:return self.Directory.DesktopEntry.getComment()except AttributeError:return ""
2
5
1
23
0
225
230
225
null
[]
None
null
0
0
0
null
0
null
The function (getComment) defined within the public class called public.The function start at line 225 and ends at 230. It contains 5 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value..
takluyver_pyxdg
public
public
0
0
getIcon
def getIcon(self):"""Returns the menu's icon, filename or simple name"""try:return self.Directory.DesktopEntry.getIcon()except AttributeError:return ""
2
5
1
23
0
232
237
232
null
[]
None
null
0
0
0
null
0
null
The function (getIcon) defined within the public class called public.The function start at line 232 and ends at 237. It contains 5 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value..
takluyver_pyxdg
public
public
0
0
sort
def sort(self):self.Entries = []self.Visible = 0for submenu in self.Submenus:submenu.sort()_submenus = set()_entries = set()for order in self.Layout.order:if order[0] == "Filename":_entries.add(order[1])elif order[0] == "Menuname":_submenus.add(order[1])for order in self.Layout.order:if order[0] == "Separator":separato...
49
90
1
697
0
239
337
239
null
[]
None
null
0
0
0
null
0
null
The function (sort) defined within the public class called public.The function start at line 239 and ends at 337. It contains 90 lines of code and it has a cyclomatic complexity of 49. The function does not take any parameters and does not return any value..
takluyver_pyxdg
public
public
0
0
addSubmenu
def addSubmenu(self, newmenu):for submenu in self.Submenus:if submenu == newmenu:submenu += newmenubreakelse:self.Submenus.append(newmenu)newmenu.Parent = selfnewmenu.Depth = self.Depth + 1
3
9
2
47
0
340
348
340
null
[]
None
null
0
0
0
null
0
null
The function (addSubmenu) defined within the public class called public.The function start at line 340 and ends at 348. It contains 9 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [340.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
merge_inline
def merge_inline(self, submenu):"""Appends a submenu's entries to this menuSee the <Menuname> section of the spec about the "inline" attribute"""if len(submenu.Entries) == 1 and submenu.Layout.inline_alias:menuentry = submenu.Entries[0]menuentry.DesktopEntry.set("Name", submenu.getName(), locale=True)menuentry.DesktopE...
7
15
2
178
0
351
368
351
null
[]
None
null
0
0
0
null
0
null
The function (merge_inline) defined within the public class called public.The function start at line 351 and ends at 368. It contains 15 lines of code and it has a cyclomatic complexity of 7. It takes 2 parameters, represented as [351.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
__init__
def __init__(self, old="", new=""):self.Old = oldself.New = new
1
3
3
23
0
373
375
373
null
[]
None
null
0
0
0
null
0
null
The function (__init__) defined within the public class called public.The function start at line 373 and ends at 375. It contains 3 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [373.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
__cmp__
def __cmp__(self, other):return cmp(self.Old, other.Old)
1
2
2
18
0
377
378
377
null
[]
None
null
0
0
0
null
0
null
The function (__cmp__) defined within the public class called public.The function start at line 377 and ends at 378. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [377.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
__init__
def __init__(self, show_empty=False, inline=False, inline_limit=4, inline_header=True, inline_alias=False):self.show_empty = show_emptyself.inline = inlineself.inline_limit = inline_limitself.inline_header = inline_headerself.inline_alias = inline_aliasself._order = []self._default_order = [['Merge', 'menus'],['Merge',...
1
12
6
73
0
383
394
383
null
[]
None
null
0
0
0
null
0
null
The function (__init__) defined within the public class called public.The function start at line 383 and ends at 394. It contains 12 lines of code and it has a cyclomatic complexity of 1. It takes 6 parameters, represented as [383.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
order
def order(self):return self._order if self._order else self._default_order
2
2
1
17
0
397
398
397
null
[]
None
null
0
0
0
null
0
null
The function (order) defined within the public class called public.The function start at line 397 and ends at 398. It contains 2 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value..
takluyver_pyxdg
public
public
0
0
order
def order(self, order):self._order = order
1
2
2
12
0
401
402
401
null
[]
None
null
0
0
0
null
0
null
The function (order) defined within the public class called public.The function start at line 401 and ends at 402. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [401.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
fromFilename
def fromFilename(cls, type, filename):tree = ast.Expression(body=ast.Compare(left=ast.Str(filename),ops=[ast.Eq()],comparators=[ast.Attribute(value=ast.Name(id='menuentry', ctx=ast.Load()),attr='DesktopFileID',ctx=ast.Load())]),lineno=1, col_offset=0)ast.fix_missing_locations(tree)rule = Rule(type, tree)return rule
1
16
3
105
0
411
426
411
null
[]
None
null
0
0
0
null
0
null
The function (fromFilename) defined within the public class called public.The function start at line 411 and ends at 426. It contains 16 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [411.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
__init__
def __init__(self, type, expression):# Type is TYPE_INCLUDE or TYPE_EXCLUDEself.Type = type# expression is ast.Expressionself.expression = expressionself.code = compile(self.expression, '<compiled-menu-rule>', 'eval')
1
4
3
33
0
428
433
428
null
[]
None
null
0
0
0
null
0
null
The function (__init__) defined within the public class called public.The function start at line 428 and ends at 433. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [428.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
__str__
def __str__(self):return ast.dump(self.expression)
1
2
1
14
0
435
436
435
null
[]
None
null
0
0
0
null
0
null
The function (__str__) defined within the public class called public.The function start at line 435 and ends at 436. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
takluyver_pyxdg
public
public
0
0
apply
def apply(self, menuentries, run):for menuentry in menuentries:if run == 2 and (menuentry.MatchedInclude is True or menuentry.Allocated is True):continueif eval(self.code):if self.Type is Rule.TYPE_INCLUDE:menuentry.Add = Truemenuentry.MatchedInclude = Trueelse:menuentry.Add = Falsereturn menuentries
7
12
3
70
0
438
449
438
null
[]
None
null
0
0
0
null
0
null
The function (apply) defined within the public class called public.The function start at line 438 and ends at 449. It contains 12 lines of code and it has a cyclomatic complexity of 7. It takes 3 parameters, represented as [438.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
__init__
def __init__(self, filename, dir="", prefix=""):# Create entryself.DesktopEntry = DesktopEntry(os.path.join(dir, filename))self.setAttributes(filename, dir, prefix)# Can True, False DELETED, HIDDEN, EMPTY, NOT_SHOW_IN or NO_EXECself.Show = True# Semi-Privateself.Original = Noneself.Parents = []# Private Stuffself.Alloc...
1
10
4
84
0
459
477
459
null
[]
None
null
0
0
0
null
0
null
The function (__init__) defined within the public class called public.The function start at line 459 and ends at 477. It contains 10 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [459.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
save
def save(self):"""Save any changes to the desktop entry."""if self.DesktopEntry.tainted:self.DesktopEntry.write()
2
3
1
20
0
479
482
479
null
[]
None
null
0
0
0
null
0
null
The function (save) defined within the public class called public.The function start at line 479 and ends at 482. It contains 3 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value..
takluyver_pyxdg
public
public
0
0
getDir
def getDir(self):"""Return the directory containing the desktop entry file."""return self.DesktopEntry.filename.replace(self.Filename, '')
1
2
1
21
0
484
486
484
null
[]
None
null
0
0
0
null
0
null
The function (getDir) defined within the public class called public.The function start at line 484 and ends at 486. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
takluyver_pyxdg
public
public
0
0
getType
def getType(self):"""Return the type of MenuEntry, System/User/Both"""if not xdg.Config.root_mode:if self.Original:return self.TYPE_BOTHelif xdg_data_dirs[0] in self.DesktopEntry.filename:return self.TYPE_USERelse:return self.TYPE_SYSTEMelse:return self.TYPE_USER
4
10
1
51
0
488
498
488
null
[]
None
null
0
0
0
null
0
null
The function (getType) defined within the public class called public.The function start at line 488 and ends at 498. It contains 10 lines of code and it has a cyclomatic complexity of 4. The function does not take any parameters and does not return any value..
takluyver_pyxdg
public
public
0
0
setAttributes
def setAttributes(self, filename, dir="", prefix=""):self.Filename = filenameself.Prefix = prefixself.DesktopFileID = os.path.join(prefix, filename).replace("/", "-")if not os.path.isabs(self.DesktopEntry.filename):self.__setFilename()
2
6
4
66
0
500
506
500
null
[]
None
null
0
0
0
null
0
null
The function (setAttributes) defined within the public class called public.The function start at line 500 and ends at 506. It contains 6 lines of code and it has a cyclomatic complexity of 2. It takes 4 parameters, represented as [500.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
updateAttributes
def updateAttributes(self):if self.getType() == self.TYPE_SYSTEM:self.Original = MenuEntry(self.Filename, self.getDir(), self.Prefix)self.__setFilename()
2
4
1
41
0
508
511
508
null
[]
None
null
0
0
0
null
0
null
The function (updateAttributes) defined within the public class called public.The function start at line 508 and ends at 511. It contains 4 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value..
takluyver_pyxdg
public
public
0
0
__setFilename
def __setFilename(self):if not xdg.Config.root_mode:path = xdg_data_dirs[0]else:path = xdg_data_dirs[1]if self.DesktopEntry.getType() == "Application":dir_ = os.path.join(path, "applications")else:dir_ = os.path.join(path, "desktop-directories")self.DesktopEntry.filename = os.path.join(dir_, self.Filename)
3
10
1
82
0
513
524
513
null
[]
None
null
0
0
0
null
0
null
The function (__setFilename) defined within the public class called public.The function start at line 513 and ends at 524. It contains 10 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters and does not return any value..
takluyver_pyxdg
public
public
0
0
__cmp__
def __cmp__(self, other):return locale.strcoll(self.DesktopEntry.getName(), other.DesktopEntry.getName())
1
2
2
28
0
526
527
526
null
[]
None
null
0
0
0
null
0
null
The function (__cmp__) defined within the public class called public.The function start at line 526 and ends at 527. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [526.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
_key
def _key(self):"""Key function for locale-aware sorting."""return _strxfrm(self.DesktopEntry.getName())
1
2
1
17
0
529
531
529
null
[]
None
null
0
0
0
null
0
null
The function (_key) defined within the public class called public.The function start at line 529 and ends at 531. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
takluyver_pyxdg
public
public
0
0
__lt__
def __lt__(self, other):try:other = other._key()except AttributeError:passreturn self._key() < other
2
6
2
28
0
533
538
145
null
[]
None
null
0
0
0
null
0
null
The function (__lt__) defined within the public class called public.The function start at line 533 and ends at 538. It contains 6 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [145.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
__eq__
def __eq__(self, other):if self.DesktopFileID == str(other):return Trueelse:return False
2
5
2
23
0
540
544
540
null
[]
None
null
0
0
0
null
0
null
The function (__eq__) defined within the public class called public.The function start at line 540 and ends at 544. It contains 5 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [540.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
__repr__
def __repr__(self):return self.DesktopFileID
1
2
1
9
0
546
547
546
null
[]
None
null
0
0
0
null
0
null
The function (__repr__) defined within the public class called public.The function start at line 546 and ends at 547. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
takluyver_pyxdg
public
public
0
0
__init__
def __init__(self, parent):self.Parent = parentself.Show = True
1
3
2
17
0
552
554
552
null
[]
None
null
0
0
0
null
0
null
The function (__init__) defined within the public class called public.The function start at line 552 and ends at 554. It contains 3 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [552.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
__init__
def __init__(self, name, generic_name, comment):self.Name = nameself.GenericName = generic_nameself.Comment = comment
1
4
4
26
0
559
562
559
null
[]
None
null
0
0
0
null
0
null
The function (__init__) defined within the public class called public.The function start at line 559 and ends at 562. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [559.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
__str__
def __str__(self):return self.Name
1
2
1
9
0
564
565
101
null
[]
None
null
0
0
0
null
0
null
The function (__str__) defined within the public class called public.The function start at line 564 and ends at 565. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
takluyver_pyxdg
public
public
0
0
_check_file_path
def _check_file_path(value, filename, type):path = os.path.dirname(filename)if not os.path.isabs(value):value = os.path.join(path, value)value = os.path.abspath(value)if not os.path.exists(value):return Falseif type == TYPE_DIR and os.path.isdir(value):return valueif type == TYPE_FILE and os.path.isfile(value):return v...
7
12
3
99
2
571
582
571
null
['value', 'path']
None
null
0
0
0
null
0
null
The function (_check_file_path) defined within the public class called public.The function start at line 571 and ends at 582. It contains 12 lines of code and it has a cyclomatic complexity of 7. It takes 3 parameters, represented as [571.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
_get_menu_file_path
def _get_menu_file_path(filename):dirs = list(xdg_config_dirs)if xdg.Config.root_mode is True:dirs.pop(0)for d in dirs:menuname = os.path.join(d, "menus", filename)if os.path.isfile(menuname):return menuname
4
8
1
57
2
585
592
585
null
['menuname', 'dirs']
None
null
0
0
0
null
0
null
The function (_get_menu_file_path) defined within the public class called public.The function start at line 585 and ends at 592. It contains 8 lines of code and it has a cyclomatic complexity of 4. The function does not take any parameters and does not return any value..
takluyver_pyxdg
public
public
0
0
_to_bool
def _to_bool(value):if isinstance(value, bool):return valuereturn value.lower() == "true"
2
4
1
23
0
595
598
595
null
[]
None
null
0
0
0
null
0
null
The function (_to_bool) defined within the public class called public.The function start at line 595 and ends at 598. It contains 4 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value..
takluyver_pyxdg
public
public
0
0
_dedupe
def _dedupe(_list):_set = {}_list.reverse()_list = [_set.setdefault(e, e) for e in _list if e not in _set]_list.reverse()return _list
3
6
1
42
2
602
607
602
null
['_list', '_set']
None
null
0
0
0
null
0
null
The function (_dedupe) defined within the public class called public.The function start at line 602 and ends at 607. It contains 6 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters and does not return any value..
takluyver_pyxdg
public
public
0
0
__init__
def __init__(self, debug=False):self.debug = debug
1
2
2
14
0
612
613
612
null
[]
None
null
0
0
0
null
0
null
The function (__init__) defined within the public class called public.The function start at line 612 and ends at 613. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [612.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
parse
def parse(self, filename=None):"""Load an applications.menu file.filename : str, optionalThe default is ``$XDG_CONFIG_DIRS/menus/${XDG_MENU_PREFIX}applications.menu``."""# convert to absolute pathif filename and not os.path.isabs(filename):filename = _get_menu_file_path(filename)# use default if no filename givenif not...
7
26
2
177
0
615
658
615
null
[]
None
null
0
0
0
null
0
null
The function (parse) defined within the public class called public.The function start at line 615 and ends at 658. It contains 26 lines of code and it has a cyclomatic complexity of 7. It takes 2 parameters, represented as [615.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
parse_menu
def parse_menu(self, node, filename):menu = Menu()self.parse_node(node, filename, menu)return menu
1
4
3
26
0
660
663
660
null
[]
None
null
0
0
0
null
0
null
The function (parse_menu) defined within the public class called public.The function start at line 660 and ends at 663. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [660.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
parse_node
def parse_node(self, node, filename, parent=None):num_children = len(node)for child in node:tag, text = child.tag, child.texttext = text.strip() if text else Noneif tag == 'Menu':menu = self.parse_menu(child, filename)parent.addSubmenu(menu)elif tag == 'AppDir' and text:self.parse_app_dir(text, filename, parent)elif ta...
34
51
4
395
0
665
715
665
null
[]
None
null
0
0
0
null
0
null
The function (parse_node) defined within the public class called public.The function start at line 665 and ends at 715. It contains 51 lines of code and it has a cyclomatic complexity of 34. It takes 4 parameters, represented as [665.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
parse_layout
def parse_layout(self, node):layout = Layout(show_empty=_to_bool(node.attrib.get("show_empty", False)),inline=_to_bool(node.attrib.get("inline", False)),inline_limit=int(node.attrib.get("inline_limit", 4)),inline_header=_to_bool(node.attrib.get("inline_header", True)),inline_alias=_to_bool(node.attrib.get("inline_alias...
9
33
2
270
0
717
749
717
null
[]
None
null
0
0
0
null
0
null
The function (parse_layout) defined within the public class called public.The function start at line 717 and ends at 749. It contains 33 lines of code and it has a cyclomatic complexity of 9. It takes 2 parameters, represented as [717.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
parse_move
def parse_move(self, node):old, new = "", ""for child in node:tag, text = child.tag, child.texttext = text.strip() if text else Noneif tag == "Old" and text:old = textelif tag == "New" and text:new = textreturn Move(old, new)
7
10
2
68
0
751
760
751
null
[]
None
null
0
0
0
null
0
null
The function (parse_move) defined within the public class called public.The function start at line 751 and ends at 760. It contains 10 lines of code and it has a cyclomatic complexity of 7. It takes 2 parameters, represented as [751.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
parse_rule
def parse_rule(self, node):type = Rule.TYPE_INCLUDE if node.tag == 'Include' else Rule.TYPE_EXCLUDEtree = ast.Expression(lineno=1, col_offset=0)expr = self.parse_bool_op(node, ast.Or())if expr:tree.body = exprelse:tree.body = _ast_const('False')ast.fix_missing_locations(tree)return Rule(type, tree)
3
10
2
81
0
764
773
764
null
[]
None
null
0
0
0
null
0
null
The function (parse_rule) defined within the public class called public.The function start at line 764 and ends at 773. It contains 10 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [764.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
parse_bool_op
def parse_bool_op(self, node, operator):values = []for child in node:rule = self.parse_rule_node(child)if rule:values.append(rule)num_values = len(values)if num_values > 1:return ast.BoolOp(operator, values)elif num_values == 1:return values[0]return None
5
12
3
67
0
775
786
775
null
[]
None
null
0
0
0
null
0
null
The function (parse_bool_op) defined within the public class called public.The function start at line 775 and ends at 786. It contains 12 lines of code and it has a cyclomatic complexity of 5. It takes 3 parameters, represented as [775.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
parse_rule_node
def parse_rule_node(self, node):tag = node.tagif tag == 'Or':return self.parse_bool_op(node, ast.Or())elif tag == 'And':return self.parse_bool_op(node, ast.And())elif tag == 'Not':expr = self.parse_bool_op(node, ast.Or())return ast.UnaryOp(ast.Not(), expr) if expr else Noneelif tag == 'All':return _ast_const('True')eli...
8
33
2
242
0
788
820
788
null
[]
None
null
0
0
0
null
0
null
The function (parse_rule_node) defined within the public class called public.The function start at line 788 and ends at 820. It contains 33 lines of code and it has a cyclomatic complexity of 8. It takes 2 parameters, represented as [788.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
parse_app_dir
def parse_app_dir(self, value, filename, parent):value = _check_file_path(value, filename, TYPE_DIR)if value:parent.AppDirs.append(value)
2
4
4
32
0
824
827
824
null
[]
None
null
0
0
0
null
0
null
The function (parse_app_dir) defined within the public class called public.The function start at line 824 and ends at 827. It contains 4 lines of code and it has a cyclomatic complexity of 2. It takes 4 parameters, represented as [824.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
parse_default_app_dir
def parse_default_app_dir(self, filename, parent):for d in reversed(xdg_data_dirs):self.parse_app_dir(os.path.join(d, "applications"), filename, parent)
2
3
3
36
0
829
831
829
null
[]
None
null
0
0
0
null
0
null
The function (parse_default_app_dir) defined within the public class called public.The function start at line 829 and ends at 831. It contains 3 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [829.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
parse_directory_dir
def parse_directory_dir(self, value, filename, parent):value = _check_file_path(value, filename, TYPE_DIR)if value:parent.DirectoryDirs.append(value)
2
4
4
32
0
833
836
833
null
[]
None
null
0
0
0
null
0
null
The function (parse_directory_dir) defined within the public class called public.The function start at line 833 and ends at 836. It contains 4 lines of code and it has a cyclomatic complexity of 2. It takes 4 parameters, represented as [833.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
parse_default_directory_dir
def parse_default_directory_dir(self, filename, parent):for d in reversed(xdg_data_dirs):self.parse_directory_dir(os.path.join(d, "desktop-directories"), filename, parent)
2
3
3
36
0
838
840
838
null
[]
None
null
0
0
0
null
0
null
The function (parse_default_directory_dir) defined within the public class called public.The function start at line 838 and ends at 840. It contains 3 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [838.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
parse_merge_file
def parse_merge_file(self, value, child, filename, parent):if child.attrib.get("type", None) == "parent":for d in xdg_config_dirs:rel_file = filename.replace(d, "").strip("/")if rel_file != filename:for p in xdg_config_dirs:if d == p:continueif os.path.isfile(os.path.join(p, rel_file)):self.merge_file(os.path.join(p, r...
8
15
5
127
0
844
858
844
null
[]
None
null
0
0
0
null
0
null
The function (parse_merge_file) defined within the public class called public.The function start at line 844 and ends at 858. It contains 15 lines of code and it has a cyclomatic complexity of 8. It takes 5 parameters, represented as [844.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
parse_merge_dir
def parse_merge_dir(self, value, child, filename, parent):value = _check_file_path(value, filename, TYPE_DIR)if value:for item in os.listdir(value):try:if item.endswith(".menu"):self.merge_file(os.path.join(value, item), child, parent)except UnicodeDecodeError:continue
5
9
5
69
0
860
868
860
null
[]
None
null
0
0
0
null
0
null
The function (parse_merge_dir) defined within the public class called public.The function start at line 860 and ends at 868. It contains 9 lines of code and it has a cyclomatic complexity of 5. It takes 5 parameters, represented as [860.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
parse_default_merge_dirs
def parse_default_merge_dirs(self, child, filename, parent):basename = os.path.splitext(os.path.basename(filename))[0]for d in reversed(xdg_config_dirs):self.parse_merge_dir(os.path.join(d, "menus", basename + "-merged"), child, filename, parent)
2
4
4
64
0
870
873
870
null
[]
None
null
0
0
0
null
0
null
The function (parse_default_merge_dirs) defined within the public class called public.The function start at line 870 and ends at 873. It contains 4 lines of code and it has a cyclomatic complexity of 2. It takes 4 parameters, represented as [870.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
merge_file
def merge_file(self, filename, child, parent):# check for infinite loopsif filename in self._merged_files:if self.debug:raise ParsingError('Infinite MergeFile loop detected', filename)else:returnself._merged_files.add(filename)# load filetry:tree = etree.parse(filename)except IOError:if self.debug:raise ParsingError('F...
7
21
4
103
0
875
897
875
null
[]
None
null
0
0
0
null
0
null
The function (merge_file) defined within the public class called public.The function start at line 875 and ends at 897. It contains 21 lines of code and it has a cyclomatic complexity of 7. It takes 4 parameters, represented as [875.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
parse_legacy_dir
def parse_legacy_dir(self, dir_, prefix, filename, parent):m = self.merge_legacy_dir(dir_, prefix, filename, parent)if m:parent += m
2
4
5
33
0
901
904
901
null
[]
None
null
0
0
0
null
0
null
The function (parse_legacy_dir) defined within the public class called public.The function start at line 901 and ends at 904. It contains 4 lines of code and it has a cyclomatic complexity of 2. It takes 5 parameters, represented as [901.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
merge_legacy_dir
def merge_legacy_dir(self, dir_, prefix, filename, parent):dir_ = _check_file_path(dir_, filename, TYPE_DIR)if dir_ and dir_ not in self._directory_dirs:self._directory_dirs.add(dir_)m = Menu()m.AppDirs.append(dir_)m.DirectoryDirs.append(dir_)m.Name = os.path.basename(dir_)m.NotInXml = Truefor item in os.listdir(dir_):...
10
33
5
242
0
906
942
906
null
[]
None
null
0
0
0
null
0
null
The function (merge_legacy_dir) defined within the public class called public.The function start at line 906 and ends at 942. It contains 33 lines of code and it has a cyclomatic complexity of 10. It takes 5 parameters, represented as [906.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
parse_kde_legacy_dirs
def parse_kde_legacy_dirs(self, filename, parent):try:proc = subprocess.Popen(['kde-config', '--path', 'apps'],stdout=subprocess.PIPE,universal_newlines=True)output = proc.communicate()[0].splitlines()except OSError:# If kde-config doesn't exist, ignore this.returntry:for dir_ in output[0].split(":"):self.parse_legacy_...
4
15
3
84
0
944
959
944
null
[]
None
null
0
0
0
null
0
null
The function (parse_kde_legacy_dirs) defined within the public class called public.The function start at line 944 and ends at 959. It contains 15 lines of code and it has a cyclomatic complexity of 4. It takes 3 parameters, represented as [944.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
post_parse
def post_parse(self, menu):# unallocated / deletedif menu.Deleted is None:menu.Deleted = Falseif menu.OnlyUnallocated is None:menu.OnlyUnallocated = False# Layout Tagsif not menu.Layout or not menu.DefaultLayout:if menu.DefaultLayout:menu.Layout = menu.DefaultLayoutelif menu.Layout:if menu.Depth > 0:menu.DefaultLayout ...
18
42
2
313
0
961
1,015
961
null
[]
None
null
0
0
0
null
0
null
The function (post_parse) defined within the public class called public.The function start at line 961 and ends at 1015. It contains 42 lines of code and it has a cyclomatic complexity of 18. It takes 2 parameters, represented as [961.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
generate_not_only_allocated
def generate_not_only_allocated(self, menu):for submenu in menu.Submenus:self.generate_not_only_allocated(submenu)if menu.OnlyUnallocated is False:self.cache.add_menu_entries(menu.AppDirs)menuentries = []for rule in menu.Rules:menuentries = rule.apply(self.cache.get_menu_entries(menu.AppDirs), 1)for menuentry in menuen...
6
14
2
105
0
1,018
1,033
1,018
null
[]
None
null
0
0
0
null
0
null
The function (generate_not_only_allocated) defined within the public class called public.The function start at line 1018 and ends at 1033. It contains 14 lines of code and it has a cyclomatic complexity of 6. It takes 2 parameters, represented as [1018.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
generate_only_allocated
def generate_only_allocated(self, menu):for submenu in menu.Submenus:self.generate_only_allocated(submenu)if menu.OnlyUnallocated is True:self.cache.add_menu_entries(menu.AppDirs)menuentries = []for rule in menu.Rules:menuentries = rule.apply(self.cache.get_menu_entries(menu.AppDirs), 2)for menuentry in menuentries:if ...
6
12
2
95
0
1,035
1,049
1,035
null
[]
None
null
0
0
0
null
0
null
The function (generate_only_allocated) defined within the public class called public.The function start at line 1035 and ends at 1049. It contains 12 lines of code and it has a cyclomatic complexity of 6. It takes 2 parameters, represented as [1035.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
handle_moves
def handle_moves(self, menu):for submenu in menu.Submenus:self.handle_moves(submenu)# parse move operationsfor move in menu.Moves:move_from_menu = menu.getMenu(move.Old)if move_from_menu:# FIXME: this is assigned, but never used...move_to_menu = menu.getMenu(move.New)menus = move.New.split("/")oldparent = Nonewhile len...
8
23
2
147
0
1,051
1,077
1,051
null
[]
None
null
0
0
0
null
0
null
The function (handle_moves) defined within the public class called public.The function start at line 1051 and ends at 1077. It contains 23 lines of code and it has a cyclomatic complexity of 8. It takes 2 parameters, represented as [1051.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
__init__
def __init__(self):self.cacheEntries = {}self.cacheEntries['legacy'] = []self.cache = {}
1
4
1
26
0
1,082
1,085
1,082
null
[]
None
null
0
0
0
null
0
null
The function (__init__) defined within the public class called public.The function start at line 1082 and ends at 1085. It contains 4 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
takluyver_pyxdg
public
public
0
0
add_menu_entries
def add_menu_entries(self, dirs, prefix="", legacy=False):for dir_ in dirs:if not dir_ in self.cacheEntries:self.cacheEntries[dir_] = []self.__addFiles(dir_, "", prefix, legacy)
3
5
4
49
0
1,087
1,091
1,087
null
[]
None
null
0
0
0
null
0
null
The function (add_menu_entries) defined within the public class called public.The function start at line 1087 and ends at 1091. It contains 5 lines of code and it has a cyclomatic complexity of 3. It takes 4 parameters, represented as [1087.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
__addFiles
def __addFiles(self, dir_, subdir, prefix, legacy):for item in os.listdir(os.path.join(dir_, subdir)):if item.endswith(".desktop"):try:menuentry = MenuEntry(os.path.join(subdir, item), dir_, prefix)except ParsingError:continueself.cacheEntries[dir_].append(menuentry)if legacy:self.cacheEntries['legacy'].append(menuentr...
7
12
5
135
0
1,093
1,105
1,093
null
[]
None
null
0
0
0
null
0
null
The function (__addFiles) defined within the public class called public.The function start at line 1093 and ends at 1105. It contains 12 lines of code and it has a cyclomatic complexity of 7. It takes 5 parameters, represented as [1093.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
get_menu_entries
def get_menu_entries(self, dirs, legacy=True):entries = []ids = set()# handle legacy itemsappdirs = dirs[:]if legacy:appdirs.append("legacy")# cache the results againkey = "".join(appdirs)try:return self.cache[key]except KeyError:passfor dir_ in appdirs:for menuentry in self.cacheEntries[dir_]:try:if menuentry.DesktopF...
9
26
3
150
0
1,107
1,135
1,107
null
[]
None
null
0
0
0
null
0
null
The function (get_menu_entries) defined within the public class called public.The function start at line 1107 and ends at 1135. It contains 26 lines of code and it has a cyclomatic complexity of 9. It takes 3 parameters, represented as [1107.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
parse
def parse(filename=None, debug=False):"""Helper function.Equivalent to calling xdg.Menu.XMLMenuBuilder().parse(filename)"""return XMLMenuBuilder(debug).parse(filename)
1
2
2
22
0
1,138
1,142
1,138
null
[]
None
null
0
0
0
null
0
null
The function (parse) defined within the public class called public.The function start at line 1138 and ends at 1142. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [1138.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
__init__
def __init__(self, menu=None, filename=None, root=False):self.menu = Noneself.filename = Noneself.tree = Noneself.parser = XMLMenuBuilder()self.parse(menu, filename, root)# fix for creating two menus with the same name on the flyself.filenames = []
1
7
4
55
0
26
34
26
null
[]
None
null
0
0
0
null
0
null
The function (__init__) defined within the public class called public.The function start at line 26 and ends at 34. It contains 7 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [26.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
parse
def parse(self, menu=None, filename=None, root=False):if root:setRootMode(True)if isinstance(menu, Menu):self.menu = menuelif menu:self.menu = self.parser.parse(menu)else:self.menu = self.parser.parse()if root:self.filename = self.menu.Filenameelif filename:self.filename = filenameelse:self.filename = os.path.join(xdg_...
8
29
4
181
0
36
69
36
null
[]
None
null
0
0
0
null
0
null
The function (parse) defined within the public class called public.The function start at line 36 and ends at 69. It contains 29 lines of code and it has a cyclomatic complexity of 8. It takes 4 parameters, represented as [36.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
save
def save(self):self.__saveEntries(self.menu)self.__saveMenu()
1
3
1
18
0
71
73
71
null
[]
None
null
0
0
0
null
0
null
The function (save) defined within the public class called public.The function start at line 71 and ends at 73. It contains 3 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
takluyver_pyxdg
public
public
0
0
createMenuEntry
def createMenuEntry(self, parent, name, command=None, genericname=None, comment=None, icon=None, terminal=None, after=None, before=None):menuentry = MenuEntry(self.__getFileName(name, ".desktop"))menuentry = self.editMenuEntry(menuentry, name, genericname, comment, command, icon, terminal)self.__addEntry(parent, menuen...
1
6
10
91
0
75
83
75
null
[]
None
null
0
0
0
null
0
null
The function (createMenuEntry) defined within the public class called public.The function start at line 75 and ends at 83. It contains 6 lines of code and it has a cyclomatic complexity of 1. It takes 10 parameters, represented as [75.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
createMenu
def createMenu(self, parent, name, genericname=None, comment=None, icon=None, after=None, before=None):menu = Menu()menu.Parent = parentmenu.Depth = parent.Depth + 1menu.Layout = parent.DefaultLayoutmenu.DefaultLayout = parent.DefaultLayoutmenu = self.editMenu(menu, name, genericname, comment, icon)self.__addEntry(pare...
1
10
8
99
0
85
99
85
null
[]
None
null
0
0
0
null
0
null
The function (createMenu) defined within the public class called public.The function start at line 85 and ends at 99. It contains 10 lines of code and it has a cyclomatic complexity of 1. It takes 8 parameters, represented as [85.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
createSeparator
def createSeparator(self, parent, after=None, before=None):separator = Separator(parent)self.__addEntry(parent, separator, after, before)self.menu.sort()return separator
1
5
4
42
0
101
108
101
null
[]
None
null
0
0
0
null
0
null
The function (createSeparator) defined within the public class called public.The function start at line 101 and ends at 108. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [101.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
moveMenuEntry
def moveMenuEntry(self, menuentry, oldparent, newparent, after=None, before=None):self.__deleteEntry(oldparent, menuentry, after, before)self.__addEntry(newparent, menuentry, after, before)self.menu.sort()return menuentry
1
5
6
52
0
110
116
110
null
[]
None
null
0
0
0
null
0
null
The function (moveMenuEntry) defined within the public class called public.The function start at line 110 and ends at 116. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 6 parameters, represented as [110.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
moveMenu
def moveMenu(self, menu, oldparent, newparent, after=None, before=None):self.__deleteEntry(oldparent, menu, after, before)self.__addEntry(newparent, menu, after, before)root_menu = self.__getXmlMenu(self.menu.Name)if oldparent.getPath(True) != newparent.getPath(True):self.__addXmlMove(root_menu, os.path.join(oldparent....
2
8
6
121
0
118
128
118
null
[]
None
null
0
0
0
null
0
null
The function (moveMenu) defined within the public class called public.The function start at line 118 and ends at 128. It contains 8 lines of code and it has a cyclomatic complexity of 2. It takes 6 parameters, represented as [118.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
moveSeparator
def moveSeparator(self, separator, parent, after=None, before=None):self.__deleteEntry(parent, separator, after, before)self.__addEntry(parent, separator, after, before)self.menu.sort()return separator
1
5
5
50
0
130
136
130
null
[]
None
null
0
0
0
null
0
null
The function (moveSeparator) defined within the public class called public.The function start at line 130 and ends at 136. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [130.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
copyMenuEntry
def copyMenuEntry(self, menuentry, oldparent, newparent, after=None, before=None):self.__addEntry(newparent, menuentry, after, before)self.menu.sort()return menuentry
1
4
6
40
0
138
143
138
null
[]
None
null
0
0
0
null
0
null
The function (copyMenuEntry) defined within the public class called public.The function start at line 138 and ends at 143. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 6 parameters, represented as [138.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
editMenuEntry
def editMenuEntry(self, menuentry, name=None, genericname=None, comment=None, command=None, icon=None, terminal=None, nodisplay=None, hidden=None):deskentry = menuentry.DesktopEntryif name:if not deskentry.hasKey("Name"):deskentry.set("Name", name)deskentry.set("Name", name, locale=True)if comment:if not deskentry.hasK...
16
34
10
261
0
145
185
145
null
[]
None
null
0
0
0
null
0
null
The function (editMenuEntry) defined within the public class called public.The function start at line 145 and ends at 185. It contains 34 lines of code and it has a cyclomatic complexity of 16. It takes 10 parameters, represented as [145.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
editMenu
def editMenu(self, menu, name=None, genericname=None, comment=None, icon=None, nodisplay=None, hidden=None):# Hack for legacy dirsif isinstance(menu.Directory, MenuEntry) and menu.Directory.Filename == ".directory":xml_menu = self.__getXmlMenu(menu.getPath(True, True))self.__addXmlTextElement(xml_menu, 'Directory', men...
18
41
8
370
0
187
236
187
null
[]
None
null
0
0
0
null
0
null
The function (editMenu) defined within the public class called public.The function start at line 187 and ends at 236. It contains 41 lines of code and it has a cyclomatic complexity of 18. It takes 8 parameters, represented as [187.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
hideMenuEntry
def hideMenuEntry(self, menuentry):self.editMenuEntry(menuentry, nodisplay=True)
1
2
2
17
0
238
239
238
null
[]
None
null
0
0
0
null
0
null
The function (hideMenuEntry) defined within the public class called public.The function start at line 238 and ends at 239. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [238.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
unhideMenuEntry
def unhideMenuEntry(self, menuentry):self.editMenuEntry(menuentry, nodisplay=False, hidden=False)
1
2
2
21
0
241
242
241
null
[]
None
null
0
0
0
null
0
null
The function (unhideMenuEntry) defined within the public class called public.The function start at line 241 and ends at 242. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [241.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
hideMenu
def hideMenu(self, menu):self.editMenu(menu, nodisplay=True)
1
2
2
17
0
244
245
244
null
[]
None
null
0
0
0
null
0
null
The function (hideMenu) defined within the public class called public.The function start at line 244 and ends at 245. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [244.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
unhideMenu
def unhideMenu(self, menu):self.editMenu(menu, nodisplay=False, hidden=False)xml_menu = self.__getXmlMenu(menu.getPath(True, True), False)deleted = xml_menu.findall('Deleted')not_deleted = xml_menu.findall('NotDeleted')for node in deleted + not_deleted:xml_menu.remove(node)
2
7
2
67
0
247
253
247
null
[]
None
null
0
0
0
null
0
null
The function (unhideMenu) defined within the public class called public.The function start at line 247 and ends at 253. It contains 7 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [247.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
deleteMenuEntry
def deleteMenuEntry(self, menuentry):if self.getAction(menuentry) == "delete":self.__deleteFile(menuentry.DesktopEntry.filename)for parent in menuentry.Parents:self.__deleteEntry(parent, menuentry)self.menu.sort()return menuentry
3
7
2
51
0
255
261
255
null
[]
None
null
0
0
0
null
0
null
The function (deleteMenuEntry) defined within the public class called public.The function start at line 255 and ends at 261. It contains 7 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [255.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
revertMenuEntry
def revertMenuEntry(self, menuentry):if self.getAction(menuentry) == "revert":self.__deleteFile(menuentry.DesktopEntry.filename)menuentry.Original.Parents = []for parent in menuentry.Parents:index = parent.Entries.index(menuentry)parent.Entries[index] = menuentry.Originalindex = parent.MenuEntries.index(menuentry)paren...
3
12
2
101
0
263
274
263
null
[]
None
null
0
0
0
null
0
null
The function (revertMenuEntry) defined within the public class called public.The function start at line 263 and ends at 274. It contains 12 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [263.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
deleteMenu
def deleteMenu(self, menu):if self.getAction(menu) == "delete":self.__deleteFile(menu.Directory.DesktopEntry.filename)self.__deleteEntry(menu.Parent, menu)xml_menu = self.__getXmlMenu(menu.getPath(True, True))parent = self.__get_parent_node(xml_menu)parent.remove(xml_menu)self.menu.sort()return menu
2
9
2
77
0
276
284
276
null
[]
None
null
0
0
0
null
0
null
The function (deleteMenu) defined within the public class called public.The function start at line 276 and ends at 284. It contains 9 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [276.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
revertMenu
def revertMenu(self, menu):if self.getAction(menu) == "revert":self.__deleteFile(menu.Directory.DesktopEntry.filename)menu.Directory = menu.Directory.Originalself.menu.sort()return menu
2
6
2
47
0
286
291
286
null
[]
None
null
0
0
0
null
0
null
The function (revertMenu) defined within the public class called public.The function start at line 286 and ends at 291. It contains 6 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [286.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
deleteSeparator
def deleteSeparator(self, separator):self.__deleteEntry(separator.Parent, separator, after=True)self.menu.sort()return separator
1
4
2
30
0
293
298
293
null
[]
None
null
0
0
0
null
0
null
The function (deleteSeparator) defined within the public class called public.The function start at line 293 and ends at 298. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [293.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
getAction
def getAction(self, entry):if isinstance(entry, Menu):if not isinstance(entry.Directory, MenuEntry):return "none"elif entry.Directory.getType() == "Both":return "revert"elif entry.Directory.getType() == "User" and (len(entry.Submenus) + len(entry.MenuEntries)) == 0:return "delete"elif isinstance(entry, MenuEntry):if en...
9
18
2
108
0
301
320
301
null
[]
None
null
0
0
0
null
0
null
The function (getAction) defined within the public class called public.The function start at line 301 and ends at 320. It contains 18 lines of code and it has a cyclomatic complexity of 9. It takes 2 parameters, represented as [301.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
__saveEntries
def __saveEntries(self, menu):if not menu:menu = self.menuif isinstance(menu.Directory, MenuEntry):menu.Directory.save()for entry in menu.getEntries(hidden=True):if isinstance(entry, MenuEntry):entry.save()elif isinstance(entry, Menu):self.__saveEntries(entry)
6
10
2
72
0
322
331
322
null
[]
None
null
0
0
0
null
0
null
The function (__saveEntries) defined within the public class called public.The function start at line 322 and ends at 331. It contains 10 lines of code and it has a cyclomatic complexity of 6. It takes 2 parameters, represented as [322.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
__saveMenu
def __saveMenu(self):if not os.path.isdir(os.path.dirname(self.filename)):os.makedirs(os.path.dirname(self.filename))self.tree.write(self.filename, encoding='utf-8')
2
4
1
54
0
333
336
333
null
[]
None
null
0
0
0
null
0
null
The function (__saveMenu) defined within the public class called public.The function start at line 333 and ends at 336. It contains 4 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value..
takluyver_pyxdg
public
public
0
0
__getFileName
def __getFileName(self, name, extension):postfix = 0while 1:if postfix == 0:filename = name + extensionelse:filename = name + "-" + str(postfix) + extensionif extension == ".desktop":dir = "applications"elif extension == ".directory":dir = "desktop-directories"if not filename in self.filenames and not os.path.isfile(os...
7
19
3
103
0
338
357
338
null
[]
None
null
0
0
0
null
0
null
The function (__getFileName) defined within the public class called public.The function start at line 338 and ends at 357. It contains 19 lines of code and it has a cyclomatic complexity of 7. It takes 3 parameters, represented as [338.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
__getXmlMenu
def __getXmlMenu(self, path, create=True, element=None):# FIXME: we should also return the menu's parent,# to avoid looking for it later on# @see Element.getiterator()if not element:element = self.treeif "/" in path:(name, path) = path.split("/", 1)else:name = pathpath = ""found = Nonefor node in element.findall("Menu"...
10
25
4
141
0
359
389
359
null
[]
None
null
0
0
0
null
0
null
The function (__getXmlMenu) defined within the public class called public.The function start at line 359 and ends at 389. It contains 25 lines of code and it has a cyclomatic complexity of 10. It takes 4 parameters, represented as [359.0] and does not return any value..
takluyver_pyxdg
public
public
0
0
__addXmlMenuElement
def __addXmlMenuElement(self, element, name):menu_node = etree.SubElement('Menu', element)name_node = etree.SubElement('Name', menu_node)name_node.text = namereturn menu_node
1
5
3
36
0
391
395
391
null
[]
None
null
0
0
0
null
0
null
The function (__addXmlMenuElement) defined within the public class called public.The function start at line 391 and ends at 395. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [391.0] and does not return any value..