lines
sequencelengths
1
444
raw_lines
sequencelengths
1
444
label
sequencelengths
1
444
type
sequencelengths
1
444
[ "def FUNC_9(self):...\n", "VAR_13 = self.cnxn.getinfo(pyodbc.SQL_ACCESSIBLE_TABLES)\n", "self.assertTrue(isinstance(VAR_13, bool))\n" ]
[ "def test_getinfo_bool(self):...\n", "value = self.cnxn.getinfo(pyodbc.SQL_ACCESSIBLE_TABLES)\n", "self.assertTrue(isinstance(value, bool))\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'" ]
[ "@rt.switch_runtime(fixtures.TEST_SITE_CONFIG, 'sys0')...\n", "VAR_40 = self.create_test('t0')\n", "VAR_41 = self.create_test('t1')\n", "VAR_41.depends_on('t0', rfm.DEPEND_EXACT, {'e0': ['e0']})\n", "VAR_40.depends_on('t1', rfm.DEPEND_EXACT, {'e1': ['e1']})\n", "VAR_34 = dependency.build_deps(executors.generate_testcases([VAR_40, VAR_41]))\n", "dependency.validate_deps(VAR_34)\n", "assert 't1->t0->t1' in str(exc_info.value) or 't0->t1->t0' in str(exc_info.\n value)\n" ]
[ "@rt.switch_runtime(fixtures.TEST_SITE_CONFIG, 'sys0')...\n", "t0 = self.create_test('t0')\n", "t1 = self.create_test('t1')\n", "t1.depends_on('t0', rfm.DEPEND_EXACT, {'e0': ['e0']})\n", "t0.depends_on('t1', rfm.DEPEND_EXACT, {'e1': ['e1']})\n", "deps = dependency.build_deps(executors.generate_testcases([t0, t1]))\n", "dependency.validate_deps(deps)\n", "assert 't1->t0->t1' in str(exc_info.value) or 't0->t1->t0' in str(exc_info.\n value)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Assign'", "Expr'", "Expr'", "Assign'", "Expr'", "Assert'" ]
[ "def FUNC_1():...\n", "return FUNC_0('secrets.json')\n" ]
[ "def read_secrets():...\n", "return readJsonFile('secrets.json')\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_33(self):...\n", "def FUNC_39(VAR_101):...\n", "VAR_101.norun = True\n", "return VAR_101\n" ]
[ "def norun(self):...\n", "def decorate(ruleinfo):...\n", "ruleinfo.norun = True\n", "return ruleinfo\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "FunctionDef'", "Assign'", "Return'" ]
[ "VAR_0 = [{'group': 'test', 'description': 'Test exception handling', 'get':\n 'foobar', 'set': 'set-foobar', 'os_v_min': '10.09', 'os_v_max': None},\n {'group': 'animation', 'description':\n 'Disable animations when opening and closing windows.', 'get':\n 'defaults read NSGlobalDomain NSAutomaticWindowAnimationsEnabled',\n 'set':\n 'defaults write NSGlobalDomain NSAutomaticWindowAnimationsEnabled -bool false'\n , 'os_v_min': '10.09', 'os_v_max': None}, {'group': 'animation',\n 'description': 'Disable animations when opening a Quick Look window.',\n 'set': 'defaults write -g QLPanelAnimationDuration -float 0',\n 'os_v_min': '10.09', 'os_v_max': None}, {'group': 'animation',\n 'description':\n 'Disable animation when opening the Info window in OS X Finder (cmd⌘ + i).'\n , 'set':\n 'defaults write com.apple.finder DisableAllAnimations -bool true',\n 'os_v_min': '10.09', 'os_v_max': None}, {'group': 'animation',\n 'description':\n 'Accelerated playback when adjusting the window size (Cocoa applications).'\n , 'set':\n 'defaults write NSGlobalDomain NSWindowResizeTime -float 0.001',\n 'os_v_min': '10.09', 'os_v_max': None}, {'group': 'animation',\n 'description':\n 'Disable animations when you open an application from the Dock.', 'set':\n 'defaults write com.apple.dock launchanim -bool false', 'os_v_min':\n '10.09', 'os_v_max': None}, {'group': 'app', 'description':\n 'Always show the full URL in the search/url field', 'get':\n 'defaults read com.apple.Safari ShowFullURLInSmartSearchField', 'set':\n 'defaults write com.apple.Safari ShowFullURLInSmartSearchField -bool true',\n 'os_v_min': '10.09', 'os_v_max': None}, {'group': 'admin',\n 'description': 'Show Recovery partition & EFI Boot partition', 'set':\n 'defaults write com.apple.DiskUtility DUDebugMenuEnabled -bool true',\n 'os_v_min': '10.09', 'os_v_max': '10.10'}, {'group': 'general',\n 'description': 'Disable shadow in screenshots', 'set':\n 'defaults write com.apple.screencapture disable-shadow -bool true',\n 'os_v_min': '10.09', 'os_v_max': None}, {'group': 'sudo', 'description':\n 'string', 'get':\n 'sudo defaults read /Library/Preferences/com.apple.mDNSResponder.plist NoMulticastAdvertisements'\n , 'set': 'string', 'os_v_min': '10.09', 'os_v_max': None}, {'group':\n 'sudo', 'description': 'Disable WiFi hotspot screen', 'get':\n 'sudo defaults read /Library/Preferences/SystemConfiguration/com.apple.captive.control Active'\n , 'set': 'string', 'os_v_min': '10.09', 'os_v_max': None}, {'group':\n 'general', 'description': 'Don’t show Dashboard as a Space', 'get':\n 'defaults read com.apple.dock dashboard-in-overlay', 'set':\n 'defaults write com.apple.dock dashboard-in-overlay -bool true',\n 'os_v_min': '10.09', 'os_v_max': None}, {'group': 'Finder',\n 'description': 'Show file path in title of finder window', 'set':\n 'defaults write com.apple.finder _FXShowPosixPathInTitle -bool true',\n 'os_v_min': '10.09', 'os_v_max': None}, {'group': 'general',\n 'description': 'Enable AirDrop feature for ethernet connected Macs',\n 'set':\n 'defaults write com.apple.NetworkBrowser BrowseAllInterfaces -bool true',\n 'os_v_min': '10.09', 'os_v_max': None}, {'group': 'general',\n 'description': 'Always show scroll bars', 'set':\n 'defaults write NSGlobalDomain AppleShowScrollBars -string \"Always\"',\n 'os_v_min': '10.09', 'os_v_max': None}, {'group': 'general',\n 'description': 'Expand Save panel by default (1/2)', 'set':\n 'defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true'\n , 'os_v_min': '10.09', 'os_v_max': None}, {'group': 'general',\n 'description': 'Expand Save panel by default (2/2)', 'set':\n 'defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode2 -bool true'\n , 'os_v_min': '10.09', 'os_v_max': None}, {'group': 'general',\n 'description': 'Expand Print menu by default (1/2)', 'set':\n 'defaults write NSGlobalDomain PMPrintingExpandedStateforPrint -bool true',\n 'os_v_min': '10.09', 'os_v_max': None}, {'group': 'general',\n 'description': 'Expand Print menu by default (2/2)', 'set':\n 'defaults write NSGlobalDomain PMPrintingExpandedStateforPrint2 -bool true'\n , 'os_v_min': '10.09', 'os_v_max': None}, {'group': 'general',\n 'description':\n 'Make all animations faster that are used by Mission Control.', 'set':\n 'defaults write com.apple.dock expose-animation-duration -float 0.1',\n 'os_v_min': '10.09', 'os_v_max': None}, {'group': 'Finder',\n 'description': 'Disable the delay when you hide the Dock', 'set':\n 'defaults write com.apple.Dock autohide-delay -float 0', 'os_v_min':\n '10.09', 'os_v_max': None}, {'group': 'Finder', 'description':\n 'Remove the animation when hiding/showing the Dock', 'set':\n 'defaults write com.apple.dock autohide-time-modifier -float 0',\n 'os_v_min': '10.09', 'os_v_max': None}, {'group': 'app', 'description':\n 'Disable the animation when you replying to an e-mail', 'set':\n 'defaults write com.apple.mail DisableReplyAnimations -bool true',\n 'os_v_min': '10.09', 'os_v_max': None}, {'group': 'app', 'description':\n 'Disable the animation when you sending an e-mail', 'set':\n 'defaults write com.apple.mail DisableSendAnimations -bool true',\n 'os_v_min': '10.09', 'os_v_max': None}, {'group': 'app', 'description':\n 'Disable the standard delay in rendering a Web page.', 'set':\n 'defaults write com.apple.Safari WebKitInitialTimedLayoutDelay 0.25',\n 'os_v_min': '10.09', 'os_v_max': None}, {'group': 'general',\n 'description':\n 'The keyboard react faster to keystrokes (not equally useful for everyone)'\n , 'set': 'defaults write NSGlobalDomain KeyRepeat -int 0', 'os_v_min':\n '10.09', 'os_v_max': None}, {'group': 'general', 'description':\n 'Disable smooth scrolling for paging (space bar)', 'set':\n 'defaults write -g NSScrollAnimationEnabled -bool false', 'os_v_min':\n '10.09', 'os_v_max': None}, {'group': 'Finder', 'description':\n 'Avoid creating .DS_Store files on network volumes', 'set':\n 'defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true'\n , 'os_v_min': '10.09', 'os_v_max': None}, {'group': 'Finder',\n 'description': 'Avoid creating .DS_Store files on USB volumes', 'set':\n 'defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true',\n 'os_v_min': '10.09', 'os_v_max': None}, {'group': 'Finder',\n 'description': 'Show the ~/Library folder', 'set':\n 'chflags nohidden ~/Library', 'os_v_min': '10.09', 'os_v_max': None}, {\n 'group': 'Finder', 'description':\n 'Save to disk (not to iCloud) by default', 'set':\n 'defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false'\n , 'os_v_min': '10.09', 'os_v_max': None}, {'group': 'Finder',\n 'description': 'Disable the warning when changing a file extension',\n 'set':\n 'defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false'\n , 'os_v_min': '10.09', 'os_v_max': None}]\n" ]
[ "tweaks = [{'group': 'test', 'description': 'Test exception handling', 'get':\n 'foobar', 'set': 'set-foobar', 'os_v_min': '10.09', 'os_v_max': None},\n {'group': 'animation', 'description':\n 'Disable animations when opening and closing windows.', 'get':\n 'defaults read NSGlobalDomain NSAutomaticWindowAnimationsEnabled',\n 'set':\n 'defaults write NSGlobalDomain NSAutomaticWindowAnimationsEnabled -bool false'\n , 'os_v_min': '10.09', 'os_v_max': None}, {'group': 'animation',\n 'description': 'Disable animations when opening a Quick Look window.',\n 'set': 'defaults write -g QLPanelAnimationDuration -float 0',\n 'os_v_min': '10.09', 'os_v_max': None}, {'group': 'animation',\n 'description':\n 'Disable animation when opening the Info window in OS X Finder (cmd⌘ + i).'\n , 'set':\n 'defaults write com.apple.finder DisableAllAnimations -bool true',\n 'os_v_min': '10.09', 'os_v_max': None}, {'group': 'animation',\n 'description':\n 'Accelerated playback when adjusting the window size (Cocoa applications).'\n , 'set':\n 'defaults write NSGlobalDomain NSWindowResizeTime -float 0.001',\n 'os_v_min': '10.09', 'os_v_max': None}, {'group': 'animation',\n 'description':\n 'Disable animations when you open an application from the Dock.', 'set':\n 'defaults write com.apple.dock launchanim -bool false', 'os_v_min':\n '10.09', 'os_v_max': None}, {'group': 'app', 'description':\n 'Always show the full URL in the search/url field', 'get':\n 'defaults read com.apple.Safari ShowFullURLInSmartSearchField', 'set':\n 'defaults write com.apple.Safari ShowFullURLInSmartSearchField -bool true',\n 'os_v_min': '10.09', 'os_v_max': None}, {'group': 'admin',\n 'description': 'Show Recovery partition & EFI Boot partition', 'set':\n 'defaults write com.apple.DiskUtility DUDebugMenuEnabled -bool true',\n 'os_v_min': '10.09', 'os_v_max': '10.10'}, {'group': 'general',\n 'description': 'Disable shadow in screenshots', 'set':\n 'defaults write com.apple.screencapture disable-shadow -bool true',\n 'os_v_min': '10.09', 'os_v_max': None}, {'group': 'sudo', 'description':\n \"\"\"Disable Bonjour multicast advertisements.\n See https://www.trustwave.com/Resources/SpiderLabs-Blog/mDNS---Telling-the-world-about-you-(and-your-device)/\"\"\"\n , 'get':\n 'sudo defaults read /Library/Preferences/com.apple.mDNSResponder.plist NoMulticastAdvertisements'\n , 'set':\n 'sudo defaults write /Library/Preferences/com.apple.mDNSResponder.plist NoMulticastAdvertisements -bool YES'\n , 'os_v_min': '10.09', 'os_v_max': None}, {'group': 'sudo',\n 'description': 'Disable WiFi hotspot screen', 'get':\n 'sudo defaults read /Library/Preferences/SystemConfiguration/com.apple.captive.control Active'\n , 'set':\n 'sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.captive.control Active -boolean false'\n , 'os_v_min': '10.09', 'os_v_max': None}, {'group': 'general',\n 'description': 'Don’t show Dashboard as a Space', 'get':\n 'defaults read com.apple.dock dashboard-in-overlay', 'set':\n 'defaults write com.apple.dock dashboard-in-overlay -bool true',\n 'os_v_min': '10.09', 'os_v_max': None}, {'group': 'Finder',\n 'description': 'Show file path in title of finder window', 'set':\n 'defaults write com.apple.finder _FXShowPosixPathInTitle -bool true',\n 'os_v_min': '10.09', 'os_v_max': None}, {'group': 'general',\n 'description': 'Enable AirDrop feature for ethernet connected Macs',\n 'set':\n 'defaults write com.apple.NetworkBrowser BrowseAllInterfaces -bool true',\n 'os_v_min': '10.09', 'os_v_max': None}, {'group': 'general',\n 'description': 'Always show scroll bars', 'set':\n 'defaults write NSGlobalDomain AppleShowScrollBars -string \"Always\"',\n 'os_v_min': '10.09', 'os_v_max': None}, {'group': 'general',\n 'description': 'Expand Save panel by default (1/2)', 'set':\n 'defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true'\n , 'os_v_min': '10.09', 'os_v_max': None}, {'group': 'general',\n 'description': 'Expand Save panel by default (2/2)', 'set':\n 'defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode2 -bool true'\n , 'os_v_min': '10.09', 'os_v_max': None}, {'group': 'general',\n 'description': 'Expand Print menu by default (1/2)', 'set':\n 'defaults write NSGlobalDomain PMPrintingExpandedStateforPrint -bool true',\n 'os_v_min': '10.09', 'os_v_max': None}, {'group': 'general',\n 'description': 'Expand Print menu by default (2/2)', 'set':\n 'defaults write NSGlobalDomain PMPrintingExpandedStateforPrint2 -bool true'\n , 'os_v_min': '10.09', 'os_v_max': None}, {'group': 'general',\n 'description':\n 'Make all animations faster that are used by Mission Control.', 'set':\n 'defaults write com.apple.dock expose-animation-duration -float 0.1',\n 'os_v_min': '10.09', 'os_v_max': None}, {'group': 'Finder',\n 'description': 'Disable the delay when you hide the Dock', 'set':\n 'defaults write com.apple.Dock autohide-delay -float 0', 'os_v_min':\n '10.09', 'os_v_max': None}, {'group': 'Finder', 'description':\n 'Remove the animation when hiding/showing the Dock', 'set':\n 'defaults write com.apple.dock autohide-time-modifier -float 0',\n 'os_v_min': '10.09', 'os_v_max': None}, {'group': 'app', 'description':\n 'Disable the animation when you replying to an e-mail', 'set':\n 'defaults write com.apple.mail DisableReplyAnimations -bool true',\n 'os_v_min': '10.09', 'os_v_max': None}, {'group': 'app', 'description':\n 'Disable the animation when you sending an e-mail', 'set':\n 'defaults write com.apple.mail DisableSendAnimations -bool true',\n 'os_v_min': '10.09', 'os_v_max': None}, {'group': 'app', 'description':\n 'Disable the standard delay in rendering a Web page.', 'set':\n 'defaults write com.apple.Safari WebKitInitialTimedLayoutDelay 0.25',\n 'os_v_min': '10.09', 'os_v_max': None}, {'group': 'general',\n 'description':\n 'The keyboard react faster to keystrokes (not equally useful for everyone)'\n , 'set': 'defaults write NSGlobalDomain KeyRepeat -int 0', 'os_v_min':\n '10.09', 'os_v_max': None}, {'group': 'general', 'description':\n 'Disable smooth scrolling for paging (space bar)', 'set':\n 'defaults write -g NSScrollAnimationEnabled -bool false', 'os_v_min':\n '10.09', 'os_v_max': None}, {'group': 'Finder', 'description':\n 'Avoid creating .DS_Store files on network volumes', 'set':\n 'defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true'\n , 'os_v_min': '10.09', 'os_v_max': None}, {'group': 'Finder',\n 'description': 'Avoid creating .DS_Store files on USB volumes', 'set':\n 'defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true',\n 'os_v_min': '10.09', 'os_v_max': None}, {'group': 'Finder',\n 'description': 'Show the ~/Library folder', 'set':\n 'chflags nohidden ~/Library', 'os_v_min': '10.09', 'os_v_max': None}, {\n 'group': 'Finder', 'description':\n 'Save to disk (not to iCloud) by default', 'set':\n 'defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false'\n , 'os_v_min': '10.09', 'os_v_max': None}, {'group': 'Finder',\n 'description': 'Disable the warning when changing a file extension',\n 'set':\n 'defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false'\n , 'os_v_min': '10.09', 'os_v_max': None}]\n" ]
[ 2 ]
[ "Assign'" ]
[ "def FUNC_0(self):...\n", "VAR_15 = 'string'\n", "return VAR_15\n" ]
[ "def _select(self):...\n", "select_str = \"\"\"\n SELECT qcp.id as id,\n qcp.name as name,\n qcp.notes as notes,\n qcp.problem_group_id as problem_group_id,\n qcp.color as color,\n qcp.priority as priority,\n qcp.stage_id as stage_id,\n qcp.qc_team_id as qc_team_id,\n qcp.company_id as company_id,\n count(hpr) as crm_helpdesk_count,\n chd.date as date\n \"\"\"\n", "return select_str\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Return'" ]
[ "def FUNC_20(self):...\n", "\"\"\"docstring\"\"\"\n", "self.finalize_sos_cmd()\n", "self.log_debug('Final sos command set to %s' % self.sos_cmd)\n", "VAR_25 = self.execute_sos_command()\n", "self.cleanup()\n", "if VAR_25:\n", "self.finalize_sos_path(VAR_25)\n", "self.log_error('Unable to determine path of sos archive')\n", "if self.sos_path:\n", "self.retrieved = self.retrieve_sosreport()\n" ]
[ "def sosreport(self):...\n", "\"\"\"docstring\"\"\"\n", "self.finalize_sos_cmd()\n", "self.log_debug('Final sos command set to %s' % self.sos_cmd)\n", "path = self.execute_sos_command()\n", "self.cleanup()\n", "if path:\n", "self.finalize_sos_path(path)\n", "self.log_error('Unable to determine path of sos archive')\n", "if self.sos_path:\n", "self.retrieved = self.retrieve_sosreport()\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Expr'", "Expr'", "Assign'", "Expr'", "Condition", "Expr'", "Expr'", "Condition", "Assign'" ]
[ "def FUNC_18(self, VAR_14=False, VAR_15=False, VAR_13=False):...\n", "VAR_11 = self.get_valid_dict(VAR_13=convert_dates_to_str)\n", "VAR_11['doctype'] = self.doctype\n", "for VAR_25 in self.meta.get_table_fields():\n", "VAR_55 = self.get(VAR_25.fieldname) or []\n", "if VAR_14:\n", "VAR_11[VAR_25.fieldname] = [VAR_6.as_dict(VAR_14=no_nulls) for VAR_6 in VAR_55]\n", "for k in list(VAR_11):\n", "if VAR_15:\n", "if VAR_11[k] is None:\n", "for k in list(VAR_11):\n", "for VAR_7 in ('_user_tags', '__islocal', '__onload', '_liked_by',\n", "if k in default_fields:\n", "if self.get(VAR_7):\n", "return VAR_11\n", "VAR_11[VAR_7] = self.get(VAR_7)\n" ]
[ "def as_dict(self, no_nulls=False, no_default_fields=False,...\n", "doc = self.get_valid_dict(convert_dates_to_str=convert_dates_to_str)\n", "doc['doctype'] = self.doctype\n", "for df in self.meta.get_table_fields():\n", "children = self.get(df.fieldname) or []\n", "if no_nulls:\n", "doc[df.fieldname] = [d.as_dict(no_nulls=no_nulls) for d in children]\n", "for k in list(doc):\n", "if no_default_fields:\n", "if doc[k] is None:\n", "for k in list(doc):\n", "for key in ('_user_tags', '__islocal', '__onload', '_liked_by',\n", "if k in default_fields:\n", "if self.get(key):\n", "return doc\n", "doc[key] = self.get(key)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "For", "Assign'", "Condition", "Assign'", "For", "Condition", "Condition", "For", "For", "Condition", "Condition", "Return'", "Assign'" ]
[ "def FUNC_9(self, *VAR_15, **VAR_75):...\n", "" ]
[ "def newfn(self, *a, **env):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "def FUNC_0(VAR_0):...\n", "VAR_6 = ['preferred', 'other', 'exceptions']\n", "VAR_7 = VAR_0.head.commit.tree['LICENSES']\n", "VAR_8 = CLASS_2()\n", "for d in VAR_6:\n", "for VAR_5 in VAR_7[d].traverse():\n", "return VAR_8\n", "if not os.path.isfile(VAR_5.path):\n", "VAR_23 = None\n", "for l in open(VAR_5.path).readlines():\n", "if l.startswith('Valid-License-Identifier:'):\n", "VAR_26 = l.split(':')[1].strip().upper()\n", "if l.startswith('SPDX-Exception-Identifier:'):\n", "if VAR_26 in VAR_8.licenses:\n", "VAR_23 = l.split(':')[1].strip().upper()\n", "if l.startswith('SPDX-Licenses:'):\n", "VAR_8.licenses.append(VAR_26)\n", "VAR_8.exceptions[VAR_23] = []\n", "for lic in l.split(':')[1].upper().strip().replace(' ', '').replace('\\t', ''\n", "if l.startswith('License-Text:'):\n", "if not lic in VAR_8.licenses:\n", "if VAR_23:\n", "VAR_8.exceptions[VAR_23].append(lic)\n", "if not len(VAR_8.exceptions[VAR_23]):\n", "VAR_8.license_files += 1\n", "VAR_8.exception_files += 1\n" ]
[ "def read_spdxdata(repo):...\n", "license_dirs = ['preferred', 'other', 'exceptions']\n", "lictree = repo.head.commit.tree['LICENSES']\n", "spdx = SPDXdata()\n", "for d in license_dirs:\n", "for el in lictree[d].traverse():\n", "return spdx\n", "if not os.path.isfile(el.path):\n", "exception = None\n", "for l in open(el.path).readlines():\n", "if l.startswith('Valid-License-Identifier:'):\n", "lid = l.split(':')[1].strip().upper()\n", "if l.startswith('SPDX-Exception-Identifier:'):\n", "if lid in spdx.licenses:\n", "exception = l.split(':')[1].strip().upper()\n", "if l.startswith('SPDX-Licenses:'):\n", "spdx.licenses.append(lid)\n", "spdx.exceptions[exception] = []\n", "for lic in l.split(':')[1].upper().strip().replace(' ', '').replace('\\t', ''\n", "if l.startswith('License-Text:'):\n", "if not lic in spdx.licenses:\n", "if exception:\n", "spdx.exceptions[exception].append(lic)\n", "if not len(spdx.exceptions[exception]):\n", "spdx.license_files += 1\n", "spdx.exception_files += 1\n" ]
[ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "For", "For", "Return'", "Condition", "Assign'", "For", "Condition", "Assign'", "Condition", "Condition", "Assign'", "Condition", "Expr'", "Assign'", "For", "Condition", "Condition", "Condition", "Expr'", "Condition", "AugAssign'", "AugAssign'" ]
[ "def FUNC_15(self):...\n", "self.run_test_case(self.scenario.delete_load_balancer(VAR_5=False),\n max_retries=5)\n" ]
[ "def test_y_delete_load_balancer_pub(self):...\n", "self.run_test_case(self.scenario.delete_load_balancer(use_vpc=False),\n max_retries=5)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_27(VAR_8):...\n", "return '{}#{}'.format(VAR_7, VAR_8)\n" ]
[ "def u(string):...\n", "return '{}#{}'.format(uuid_str, string)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_1(VAR_1):...\n", "import json\n", "from core.libs.playhouse.shortcuts import model_to_dict\n", "return json.loads(json.dumps(model_to_dict(VAR_1, recurse=False), default=\n default, separators=(', ', ': '), indent=1))\n" ]
[ "def json_dump(obj):...\n", "import json\n", "from core.libs.playhouse.shortcuts import model_to_dict\n", "return json.loads(json.dumps(model_to_dict(obj, recurse=False), default=\n default, separators=(', ', ': '), indent=1))\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Import'", "ImportFrom'", "Return'" ]
[ "def FUNC_12(self):...\n", "self.delete_results()\n", "self.cursor.execute('DELETE FROM log_event WHERE campaign_id=?', [self.\n campaign['id']])\n", "self.cursor.execute('DELETE FROM log_campaign WHERE id=?', [self.campaign[\n 'id']])\n" ]
[ "def delete_campaign(self):...\n", "self.delete_results()\n", "self.cursor.execute('DELETE FROM log_event WHERE campaign_id=?', [self.\n campaign['id']])\n", "self.cursor.execute('DELETE FROM log_campaign WHERE id=?', [self.campaign[\n 'id']])\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Expr'", "Expr'" ]
[ "@csrf_exempt...\n", "\"\"\"docstring\"\"\"\n", "if VAR_7.method == 'POST':\n", "VAR_21 = VAR_7.POST.get('_action')\n", "print(VAR_21)\n", "if VAR_21 == 'registerService':\n", "VAR_22 = VAR_7.POST.get('name')\n", "if VAR_21 == 'getSchema':\n", "VAR_23 = VAR_7.POST.get('address')\n", "VAR_27 = FUNC_0()\n", "if VAR_21 == 'getIfConfigured':\n", "VAR_24 = VAR_7.POST.get('icon')\n", "return JsonResponse({'version_info': VAR_27}, safe=False)\n", "print(VAR_21)\n", "if VAR_21 == 'loadDependencies':\n", "print(VAR_22)\n", "VAR_15 = BoxDetails.objects.all()\n", "print(VAR_21)\n", "if VAR_21 == 'getAllAPs':\n", "print(VAR_23)\n", "VAR_28 = BoxDetailsSerializer(VAR_15, many=True)\n", "VAR_15 = RegisteredServices.objects.all()\n", "VAR_29 = FUNC_2()\n", "if VAR_21 == 'saveUserDetails':\n", "print(VAR_24)\n", "return JsonResponse(VAR_28.data, safe=False)\n", "VAR_28 = RegisteredServicesSerializer(VAR_15, many=True)\n", "return JsonResponse(VAR_29, safe=False)\n", "print(VAR_21)\n", "if VAR_21 == 'login':\n", "VAR_25 = RegisteredServices.objects.get_or_create(VAR_19=request_name,\n address=request_address, icon=request_icon)\n", "return JsonResponse(VAR_28.data, safe=False)\n", "VAR_30 = escape(VAR_7.POST.get('boxname'))\n", "print(VAR_21)\n", "if VAR_21 == 'logout':\n", "return JsonResponse({'STATUS': 'SUCCESS'}, safe=False)\n", "VAR_2 = escape(VAR_7.POST.get('username'))\n", "VAR_2 = escape(VAR_7.POST.get('username'))\n", "print(VAR_21)\n", "if VAR_21 == 'getDashboardCards':\n", "VAR_3 = escape(VAR_7.POST.get('password'))\n", "VAR_3 = escape(VAR_7.POST.get('password'))\n", "VAR_2 = VAR_7.POST.get('username')\n", "print(VAR_21)\n", "if VAR_21 == 'getDashboardChart':\n", "print(VAR_2)\n", "VAR_34 = ''\n", "print(VAR_2 + ' ')\n", "VAR_36 = sqlite3.connect('dashboard.sqlite3')\n", "print(VAR_21)\n", "if VAR_21 == 'getDockerOverview':\n", "FUNC_3(VAR_2, VAR_3)\n", "\"\"\"string\"\"\"\n", "VAR_15 = User.objects.all().first()\n", "VAR_37 = VAR_36.cursor()\n", "VAR_36 = sqlite3.connect('dashboard.sqlite3')\n", "print(VAR_21)\n", "if VAR_21 == 'getContainerStats':\n", "VAR_31 = BoxDetails(VAR_30=boxname)\n", "VAR_35 = spwd.getspnam(VAR_2)[1]\n", "VAR_34 = \"User '%s' not found\" % VAR_2\n", "if len(VAR_34) == 0:\n", "if VAR_2 == VAR_15.username:\n", "VAR_37.execute(common.Q_DASHBOARD_CARDS)\n", "VAR_37 = VAR_36.cursor()\n", "VAR_36 = sqlite3.connect('dashboard.sqlite3')\n", "print(VAR_21)\n", "if VAR_21 == 'getThreads':\n", "VAR_31.save()\n", "if VAR_35 in ['NP', '!', '', None]:\n", "return JsonResponse({'username': VAR_2}, safe=False)\n", "return JsonResponse(VAR_34, safe=False)\n", "return JsonResponse({'STATUS': 'SUCCESS', 'username': VAR_15.username},\n safe=False)\n", "return JsonResponse(VAR_28.errors, status=400)\n", "VAR_38 = VAR_37.fetchall()\n", "VAR_37.execute(common.Q_GET_CONTAINER_ID)\n", "VAR_37 = VAR_36.cursor()\n", "VAR_36 = sqlite3.connect('dashboard.sqlite3')\n", "print(VAR_21)\n", "if VAR_21 == 'getContainerTop':\n", "VAR_32 = VAR_7.POST.get('wifi_password')\n", "VAR_34 = \"User '%s' has no password set\" % VAR_2\n", "if VAR_35 in ['LK', '*']:\n", "print(VAR_38)\n", "VAR_38 = VAR_37.fetchall()\n", "VAR_37.execute(common.Q_GET_DOCKER_OVERVIEW)\n", "VAR_37 = VAR_36.cursor()\n", "VAR_38 = []\n", "print(VAR_21)\n", "if VAR_21 == 'getSettings':\n", "VAR_33 = VAR_7.POST.get('wifi_ap')\n", "VAR_34 = 'account is locked'\n", "if VAR_35 == '!!':\n", "return JsonResponse(VAR_38, safe=False)\n", "print(VAR_38)\n", "VAR_38 = VAR_37.fetchall()\n", "VAR_37.execute(common.Q_GET_CONTAINER_ID)\n", "VAR_8 = subprocess.Popen(['top', '-b', '-n', '1'], stdout=subprocess.PIPE\n ).communicate()[0]\n", "VAR_36 = sqlite3.connect('dashboard.sqlite3')\n", "print(VAR_21)\n", "if VAR_21 == 'deleteUser':\n", "if len(VAR_33) > 0:\n", "VAR_34 = 'password has expired'\n", "if crypt.crypt(VAR_3, VAR_35) == VAR_35:\n", "VAR_39 = []\n", "print(VAR_38)\n", "VAR_38 = VAR_37.fetchall()\n", "VAR_45 = VAR_8.decode().split('\\n')\n", "VAR_37 = VAR_36.cursor()\n", "VAR_8 = subprocess.Popen(['grep', '/etc/group', '-e', 'docker'], stdout=\n subprocess.PIPE).communicate()[0].split('\\n')[0]\n", "print(VAR_21)\n", "if VAR_21 == 'addNewUser':\n", "FUNC_4(VAR_33, VAR_32)\n", "return JsonResponse({'STATUS': 'SUCCESS'}, safe=False)\n", "VAR_34 = ''\n", "VAR_34 = 'incorrect password'\n", "for row in VAR_38:\n", "VAR_39 = []\n", "print(VAR_38)\n", "VAR_46 = len(VAR_45[0].split()) - 1\n", "VAR_37.execute(common.Q_GET_CONTAINER_ID)\n", "VAR_49 = VAR_8.split(':')[3].split(',')\n", "VAR_2 = escape(VAR_7.POST.get('user'))\n", "print(VAR_21)\n", "if VAR_21 == 'addWifi':\n", "VAR_37.execute(common.Q_GET_DASHBOARD_CHART, [row[0]])\n", "return JsonResponse(VAR_39, safe=False)\n", "for row in VAR_38:\n", "VAR_39 = []\n", "for row in VAR_45[4:]:\n", "VAR_38 = VAR_37.fetchall()\n", "VAR_50 = FUNC_1()\n", "VAR_8 = subprocess.Popen(['userdel', VAR_2], stdout=subprocess.PIPE\n ).communicate()\n", "VAR_2 = escape(VAR_7.POST.get('username'))\n", "print(VAR_21)\n", "if VAR_21 == 'deleteWifi':\n", "VAR_40 = VAR_37.fetchall()\n", "VAR_41 = {'state': row[0], 'container_id': row[1], 'name': row[2], 'image':\n row[3], 'running_for': row[4], 'command': row[5], 'ports': row[6],\n 'status': row[7], 'networks': row[8]}\n", "return JsonResponse(VAR_39, safe=False)\n", "VAR_42 = []\n", "VAR_38.append(row.split(None, VAR_46))\n", "return JsonResponse(VAR_38, safe=False)\n", "VAR_48 = []\n", "VAR_29 = FUNC_2()\n", "VAR_51 = subprocess.Popen(['grep', '/etc/group', '-e', 'docker'], stdout=\n subprocess.PIPE).communicate()[0].split('\\n')[0]\n", "VAR_3 = escape(VAR_7.POST.get('password'))\n", "VAR_32 = escape(VAR_7.POST.get('wifi_password'))\n", "print(VAR_21)\n", "if VAR_21 == 'editWifi':\n", "print(VAR_40)\n", "VAR_39.append(VAR_41)\n", "VAR_43 = []\n", "for i in VAR_38:\n", "return JsonResponse([{'users': VAR_49, 'wifi': VAR_50, 'allwifiaps': VAR_29\n }], safe=False)\n", "VAR_49 = VAR_51.split(':')[3].split(',')\n", "FUNC_3(VAR_2, VAR_3)\n", "VAR_33 = VAR_7.POST.get('wifi_ap')\n", "VAR_33 = VAR_7.POST.get('wifi')\n", "print(VAR_21)\n", "VAR_41 = {'container_name': row[1], 'data': VAR_40}\n", "VAR_44 = []\n", "VAR_41 = {}\n", "return JsonResponse(VAR_48, safe=False)\n", "VAR_50 = FUNC_1()\n", "VAR_51 = subprocess.Popen(['grep', '/etc/group', '-e', 'docker'], stdout=\n subprocess.PIPE).communicate()[0].split('\\n')[0]\n", "if len(VAR_33) > 0:\n", "FUNC_5(VAR_33)\n", "VAR_33 = VAR_7.POST.get('wifi_ap')\n", "VAR_39.append(VAR_41)\n", "for row in VAR_38:\n", "VAR_40 = []\n", "VAR_29 = FUNC_2()\n", "VAR_49 = VAR_51.split(':')[3].split(',')\n", "FUNC_4(VAR_33, VAR_32)\n", "VAR_51 = subprocess.Popen(['grep', '/etc/group', '-e', 'docker'], stdout=\n subprocess.PIPE).communicate()[0].split('\\n')[0]\n", "VAR_51 = subprocess.Popen(['grep', '/etc/group', '-e', 'docker'], stdout=\n subprocess.PIPE).communicate()[0].split('\\n')[0]\n", "VAR_32 = escape(VAR_7.POST.get('wifi_password'))\n", "VAR_42 = []\n", "return JsonResponse(VAR_39, safe=False)\n", "VAR_8 = subprocess.Popen(['docker', 'top', i[0]], stdout=subprocess.PIPE\n ).communicate()[0]\n", "return JsonResponse([{'users': VAR_49, 'wifi': VAR_50, 'allwifiaps': VAR_29,\n 'reqtype': 'deleteuser', 'endpoint': VAR_2}], safe=False)\n", "VAR_50 = FUNC_1()\n", "VAR_49 = VAR_51.split(':')[3].split(',')\n", "VAR_49 = VAR_51.split(':')[3].split(',')\n", "FUNC_6(VAR_33, VAR_32)\n", "VAR_43 = []\n", "VAR_45 = VAR_8.decode().split('\\n')\n", "VAR_29 = FUNC_2()\n", "VAR_50 = FUNC_1()\n", "VAR_50 = FUNC_1()\n", "VAR_51 = subprocess.Popen(['grep', '/etc/group', '-e', 'docker'], stdout=\n subprocess.PIPE).communicate()[0].split('\\n')[0]\n", "VAR_44 = []\n", "VAR_46 = len(VAR_45[0].split()) - 1\n", "return JsonResponse([{'users': VAR_49, 'wifi': VAR_50, 'allwifiaps': VAR_29,\n 'reqtype': 'adduser', 'endpoint': VAR_2}], safe=False)\n", "VAR_29 = FUNC_2()\n", "VAR_29 = FUNC_2()\n", "VAR_49 = VAR_51.split(':')[3].split(',')\n", "for iter in range(0, 2):\n", "for p in VAR_45[1:]:\n", "return JsonResponse([{'users': VAR_49, 'wifi': VAR_50, 'allwifiaps': VAR_29,\n 'reqtype': 'addwifi', 'endpoint': VAR_33}], safe=False)\n", "return JsonResponse([{'users': VAR_49, 'wifi': VAR_50, 'allwifiaps': VAR_29,\n 'reqtype': 'deletewifi', 'endpoint': VAR_33}], safe=False)\n", "VAR_50 = FUNC_1()\n", "VAR_37.execute(common.Q_GET_CONTAINER_STATS_CPU, [row[0], iter + 1])\n", "for iter in range(2, 4):\n", "VAR_40.append(p.split(None, VAR_46))\n", "VAR_41 = {'container_id': i[0], 'container_name': i[1], 'data': VAR_40}\n", "VAR_29 = FUNC_2()\n", "VAR_47 = VAR_37.fetchall()\n", "VAR_37.execute(common.Q_GET_CONTAINER_STATS, [row[0], iter + 1])\n", "for iter in range(4, 8):\n", "VAR_48.append(VAR_41)\n", "return JsonResponse([{'users': VAR_49, 'wifi': VAR_50, 'allwifiaps': VAR_29,\n 'reqtype': 'editwifi', 'endpoint': VAR_33}], safe=False)\n", "VAR_44.append(VAR_47)\n", "VAR_47 = VAR_37.fetchall()\n", "VAR_37.execute(common.Q_GET_CONTAINER_STATS, [row[0], iter + 1])\n", "VAR_41 = {'container_id': row[0], 'container_name': row[1], 'data_io':\n VAR_42, 'data_mem': VAR_43, 'data_perc': VAR_44}\n", "VAR_43.append(VAR_47)\n", "VAR_47 = VAR_37.fetchall()\n", "VAR_39.append(VAR_41)\n", "VAR_42.append(VAR_47)\n" ]
[ "@csrf_exempt...\n", "\"\"\"docstring\"\"\"\n", "if request.method == 'POST':\n", "action = request.POST.get('_action')\n", "print(action)\n", "if action == 'registerService':\n", "request_name = request.POST.get('name')\n", "if action == 'getSchema':\n", "request_address = request.POST.get('address')\n", "schema = get_osversion()\n", "if action == 'getIfConfigured':\n", "request_icon = request.POST.get('icon')\n", "return JsonResponse({'version_info': schema}, safe=False)\n", "print(action)\n", "if action == 'loadDependencies':\n", "print(request_name)\n", "queryset = BoxDetails.objects.all()\n", "print(action)\n", "if action == 'getAllAPs':\n", "print(request_address)\n", "serializer = BoxDetailsSerializer(queryset, many=True)\n", "queryset = RegisteredServices.objects.all()\n", "wifi_aps = get_allAPs()\n", "if action == 'saveUserDetails':\n", "print(request_icon)\n", "return JsonResponse(serializer.data, safe=False)\n", "serializer = RegisteredServicesSerializer(queryset, many=True)\n", "return JsonResponse(wifi_aps, safe=False)\n", "print(action)\n", "if action == 'login':\n", "setServiceDetails = RegisteredServices.objects.get_or_create(name=\n request_name, address=request_address, icon=request_icon)\n", "return JsonResponse(serializer.data, safe=False)\n", "boxname = escape(request.POST.get('boxname'))\n", "print(action)\n", "if action == 'logout':\n", "return JsonResponse({'STATUS': 'SUCCESS'}, safe=False)\n", "username = escape(request.POST.get('username'))\n", "username = escape(request.POST.get('username'))\n", "print(action)\n", "if action == 'getDashboardCards':\n", "password = escape(request.POST.get('password'))\n", "password = escape(request.POST.get('password'))\n", "username = request.POST.get('username')\n", "print(action)\n", "if action == 'getDashboardChart':\n", "print(username)\n", "output = ''\n", "print(username + ' ')\n", "con = sqlite3.connect('dashboard.sqlite3')\n", "print(action)\n", "if action == 'getDockerOverview':\n", "add_user(username, password)\n", "\"\"\"Tries to authenticate a user.\n Returns True if the authentication succeeds, else the reason\n (string) is returned.\"\"\"\n", "queryset = User.objects.all().first()\n", "cursor = con.cursor()\n", "con = sqlite3.connect('dashboard.sqlite3')\n", "print(action)\n", "if action == 'getContainerStats':\n", "setBoxName = BoxDetails(boxname=boxname)\n", "enc_pwd = spwd.getspnam(username)[1]\n", "output = \"User '%s' not found\" % username\n", "if len(output) == 0:\n", "if username == queryset.username:\n", "cursor.execute(common.Q_DASHBOARD_CARDS)\n", "cursor = con.cursor()\n", "con = sqlite3.connect('dashboard.sqlite3')\n", "print(action)\n", "if action == 'getThreads':\n", "setBoxName.save()\n", "if enc_pwd in ['NP', '!', '', None]:\n", "return JsonResponse({'username': username}, safe=False)\n", "return JsonResponse(output, safe=False)\n", "return JsonResponse({'STATUS': 'SUCCESS', 'username': queryset.username},\n safe=False)\n", "return JsonResponse(serializer.errors, status=400)\n", "rows = cursor.fetchall()\n", "cursor.execute(common.Q_GET_CONTAINER_ID)\n", "cursor = con.cursor()\n", "con = sqlite3.connect('dashboard.sqlite3')\n", "print(action)\n", "if action == 'getContainerTop':\n", "wifi_pass = request.POST.get('wifi_password')\n", "output = \"User '%s' has no password set\" % username\n", "if enc_pwd in ['LK', '*']:\n", "print(rows)\n", "rows = cursor.fetchall()\n", "cursor.execute(common.Q_GET_DOCKER_OVERVIEW)\n", "cursor = con.cursor()\n", "rows = []\n", "print(action)\n", "if action == 'getSettings':\n", "wifi_name = request.POST.get('wifi_ap')\n", "output = 'account is locked'\n", "if enc_pwd == '!!':\n", "return JsonResponse(rows, safe=False)\n", "print(rows)\n", "rows = cursor.fetchall()\n", "cursor.execute(common.Q_GET_CONTAINER_ID)\n", "ps = subprocess.Popen(['top', '-b', '-n', '1'], stdout=subprocess.PIPE\n ).communicate()[0]\n", "con = sqlite3.connect('dashboard.sqlite3')\n", "print(action)\n", "if action == 'deleteUser':\n", "if len(wifi_name) > 0:\n", "output = 'password has expired'\n", "if crypt.crypt(password, enc_pwd) == enc_pwd:\n", "finalset = []\n", "print(rows)\n", "rows = cursor.fetchall()\n", "processes = ps.decode().split('\\n')\n", "cursor = con.cursor()\n", "ps = subprocess.Popen(['grep', '/etc/group', '-e', 'docker'], stdout=\n subprocess.PIPE).communicate()[0].split('\\n')[0]\n", "print(action)\n", "if action == 'addNewUser':\n", "add_newWifiConn(wifi_name, wifi_pass)\n", "return JsonResponse({'STATUS': 'SUCCESS'}, safe=False)\n", "output = ''\n", "output = 'incorrect password'\n", "for row in rows:\n", "finalset = []\n", "print(rows)\n", "nfields = len(processes[0].split()) - 1\n", "cursor.execute(common.Q_GET_CONTAINER_ID)\n", "userlist = ps.split(':')[3].split(',')\n", "username = escape(request.POST.get('user'))\n", "print(action)\n", "if action == 'addWifi':\n", "cursor.execute(common.Q_GET_DASHBOARD_CHART, [row[0]])\n", "return JsonResponse(finalset, safe=False)\n", "for row in rows:\n", "finalset = []\n", "for row in processes[4:]:\n", "rows = cursor.fetchall()\n", "configuredwifi = get_allconfiguredwifi()\n", "ps = subprocess.Popen(['userdel', username], stdout=subprocess.PIPE\n ).communicate()\n", "username = escape(request.POST.get('username'))\n", "print(action)\n", "if action == 'deleteWifi':\n", "datasets = cursor.fetchall()\n", "data = {'state': row[0], 'container_id': row[1], 'name': row[2], 'image':\n row[3], 'running_for': row[4], 'command': row[5], 'ports': row[6],\n 'status': row[7], 'networks': row[8]}\n", "return JsonResponse(finalset, safe=False)\n", "datasets_io = []\n", "rows.append(row.split(None, nfields))\n", "return JsonResponse(rows, safe=False)\n", "resultset = []\n", "wifi_aps = get_allAPs()\n", "fetchusers = subprocess.Popen(['grep', '/etc/group', '-e', 'docker'],\n stdout=subprocess.PIPE).communicate()[0].split('\\n')[0]\n", "password = escape(request.POST.get('password'))\n", "wifi_pass = escape(request.POST.get('wifi_password'))\n", "print(action)\n", "if action == 'editWifi':\n", "print(datasets)\n", "finalset.append(data)\n", "datasets_mem = []\n", "for i in rows:\n", "return JsonResponse([{'users': userlist, 'wifi': configuredwifi,\n 'allwifiaps': wifi_aps}], safe=False)\n", "userlist = fetchusers.split(':')[3].split(',')\n", "add_user(username, password)\n", "wifi_name = request.POST.get('wifi_ap')\n", "wifi_name = request.POST.get('wifi')\n", "print(action)\n", "data = {'container_name': row[1], 'data': datasets}\n", "datasets_perc = []\n", "data = {}\n", "return JsonResponse(resultset, safe=False)\n", "configuredwifi = get_allconfiguredwifi()\n", "fetchusers = subprocess.Popen(['grep', '/etc/group', '-e', 'docker'],\n stdout=subprocess.PIPE).communicate()[0].split('\\n')[0]\n", "if len(wifi_name) > 0:\n", "delete_WifiConn(wifi_name)\n", "wifi_name = request.POST.get('wifi_ap')\n", "finalset.append(data)\n", "for row in rows:\n", "datasets = []\n", "wifi_aps = get_allAPs()\n", "userlist = fetchusers.split(':')[3].split(',')\n", "add_newWifiConn(wifi_name, wifi_pass)\n", "fetchusers = subprocess.Popen(['grep', '/etc/group', '-e', 'docker'],\n stdout=subprocess.PIPE).communicate()[0].split('\\n')[0]\n", "fetchusers = subprocess.Popen(['grep', '/etc/group', '-e', 'docker'],\n stdout=subprocess.PIPE).communicate()[0].split('\\n')[0]\n", "wifi_pass = escape(request.POST.get('wifi_password'))\n", "datasets_io = []\n", "return JsonResponse(finalset, safe=False)\n", "ps = subprocess.Popen(['docker', 'top', i[0]], stdout=subprocess.PIPE\n ).communicate()[0]\n", "return JsonResponse([{'users': userlist, 'wifi': configuredwifi,\n 'allwifiaps': wifi_aps, 'reqtype': 'deleteuser', 'endpoint': username}],\n safe=False)\n", "configuredwifi = get_allconfiguredwifi()\n", "userlist = fetchusers.split(':')[3].split(',')\n", "userlist = fetchusers.split(':')[3].split(',')\n", "edit_WifiConn(wifi_name, wifi_pass)\n", "datasets_mem = []\n", "processes = ps.decode().split('\\n')\n", "wifi_aps = get_allAPs()\n", "configuredwifi = get_allconfiguredwifi()\n", "configuredwifi = get_allconfiguredwifi()\n", "fetchusers = subprocess.Popen(['grep', '/etc/group', '-e', 'docker'],\n stdout=subprocess.PIPE).communicate()[0].split('\\n')[0]\n", "datasets_perc = []\n", "nfields = len(processes[0].split()) - 1\n", "return JsonResponse([{'users': userlist, 'wifi': configuredwifi,\n 'allwifiaps': wifi_aps, 'reqtype': 'adduser', 'endpoint': username}],\n safe=False)\n", "wifi_aps = get_allAPs()\n", "wifi_aps = get_allAPs()\n", "userlist = fetchusers.split(':')[3].split(',')\n", "for iter in range(0, 2):\n", "for p in processes[1:]:\n", "return JsonResponse([{'users': userlist, 'wifi': configuredwifi,\n 'allwifiaps': wifi_aps, 'reqtype': 'addwifi', 'endpoint': wifi_name}],\n safe=False)\n", "return JsonResponse([{'users': userlist, 'wifi': configuredwifi,\n 'allwifiaps': wifi_aps, 'reqtype': 'deletewifi', 'endpoint': wifi_name}\n ], safe=False)\n", "configuredwifi = get_allconfiguredwifi()\n", "cursor.execute(common.Q_GET_CONTAINER_STATS_CPU, [row[0], iter + 1])\n", "for iter in range(2, 4):\n", "datasets.append(p.split(None, nfields))\n", "data = {'container_id': i[0], 'container_name': i[1], 'data': datasets}\n", "wifi_aps = get_allAPs()\n", "counter_val = cursor.fetchall()\n", "cursor.execute(common.Q_GET_CONTAINER_STATS, [row[0], iter + 1])\n", "for iter in range(4, 8):\n", "resultset.append(data)\n", "return JsonResponse([{'users': userlist, 'wifi': configuredwifi,\n 'allwifiaps': wifi_aps, 'reqtype': 'editwifi', 'endpoint': wifi_name}],\n safe=False)\n", "datasets_perc.append(counter_val)\n", "counter_val = cursor.fetchall()\n", "cursor.execute(common.Q_GET_CONTAINER_STATS, [row[0], iter + 1])\n", "data = {'container_id': row[0], 'container_name': row[1], 'data_io':\n datasets_io, 'data_mem': datasets_mem, 'data_perc': datasets_perc}\n", "datasets_mem.append(counter_val)\n", "counter_val = cursor.fetchall()\n", "finalset.append(data)\n", "datasets_io.append(counter_val)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Condition", "Assign'", "Expr'", "Condition", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Return'", "Expr'", "Condition", "Expr'", "Assign'", "Expr'", "Condition", "Expr'", "Assign'", "Assign'", "Assign'", "Condition", "Expr'", "Return'", "Assign'", "Return'", "Expr'", "Condition", "Assign'", "Return'", "Assign'", "Expr'", "Condition", "Return'", "Assign'", "Assign'", "Expr'", "Condition", "Assign'", "Assign'", "Assign'", "Expr'", "Condition", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "Condition", "Expr'", "Expr'", "Assign'", "Assign'", "Assign'", "Expr'", "Condition", "Assign'", "Assign'", "Assign'", "Condition", "Condition", "Expr'", "Assign'", "Assign'", "Expr'", "Condition", "Expr'", "Condition", "Return'", "Return'", "Return'", "Return'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'", "Condition", "Assign'", "Assign'", "Condition", "Expr'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'", "Condition", "Assign'", "Assign'", "Condition", "Return'", "Expr'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'", "Condition", "Condition", "Assign'", "Condition", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Condition", "Expr'", "Return'", "Assign'", "Assign'", "For", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'", "Condition", "Expr'", "Return'", "For", "Assign'", "For", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Condition", "Assign'", "Assign'", "Return'", "Assign'", "Expr'", "Return'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Condition", "Expr'", "Expr'", "Assign'", "For", "Return'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Return'", "Assign'", "Assign'", "Condition", "Expr'", "Assign'", "Expr'", "For", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Return'", "Assign'", "Return'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Return'", "Assign'", "Assign'", "Assign'", "For", "For", "Return'", "Return'", "Assign'", "Expr'", "For", "Expr'", "Assign'", "Assign'", "Assign'", "Expr'", "For", "Expr'", "Return'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "Expr'" ]
[ "def FUNC_5(self):...\n", "" ]
[ "def test_run_interactive_shell_command_kwargs_delegation(self):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "def FUNC_32(*VAR_26):...\n", "" ]
[ "def mocked_check(*_args):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "def FUNC_0(self, VAR_4, VAR_5):...\n", "\"\"\"docstring\"\"\"\n", "VAR_6 = 'string'.format(VAR_5=' '.join(start_urls), VAR_4=report_dir)\n", "return VAR_6\n" ]
[ "def _expected_command(self, report_dir, start_urls):...\n", "\"\"\"docstring\"\"\"\n", "expected_statement = (\n 'pa11ycrawler run {start_urls} --pa11ycrawler-allowed-domains=localhost --pa11ycrawler-reports-dir={report_dir} --pa11ycrawler-deny-url-matcher=logout --pa11y-reporter=\"1.0-json\" --depth-limit=6 '\n .format(start_urls=' '.join(start_urls), report_dir=report_dir))\n", "return expected_statement\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Return'" ]
[ "@abstractmethod...\n", "" ]
[ "@abstractmethod...\n", "" ]
[ 0, 0 ]
[ "Condition", "Condition" ]
[ "def __init__(self, VAR_16):...\n", "self.flags = dict()\n" ]
[ "def __init__(self, value):...\n", "self.flags = dict()\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Assign'" ]
[ "def __iter__(self):...\n", "return self\n" ]
[ "def __iter__(self):...\n", "return self\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_10(self, VAR_13):...\n", "if not isinstance(VAR_13, JvmTarget):\n", "return False\n", "return VAR_13.has_sources('.java')\n" ]
[ "def select(self, target):...\n", "if not isinstance(target, JvmTarget):\n", "return False\n", "return target.has_sources('.java')\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Return'" ]
[ "def FUNC_1(self, VAR_7):...\n", "SubmitAPIHandler.post(self, VAR_7)\n" ]
[ "def post(self, uuid):...\n", "SubmitAPIHandler.post(self, uuid)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "async def FUNC_1(VAR_1, VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9...\n", "VAR_7 = VAR_7.split(' ')\n", "if len(VAR_7) >= 2:\n", "VAR_0 = VAR_7[0].lower()\n", "await VAR_1.send_message(VAR_2,\n '{}, **USAGE:** {}remindme <time> <message...>'.format(VAR_3, VAR_9))\n", "VAR_14 = ''\n", "print('')\n", "for i in range(1, len(VAR_7)):\n", "VAR_14 += VAR_7[i] + ' '\n", "if 'd' in VAR_0 or 'h' in VAR_0 or 'm' in VAR_0 or 's' in VAR_0 or ',' in VAR_0:\n", "VAR_15 = FUNC_0(VAR_0)\n", "await VAR_1.send_message(VAR_2,\n '{}, The time must be in #time format (ex: 1h or 2h,5m).'.format(VAR_3,\n VAR_9))\n", "VAR_5.execute(\n \"INSERT INTO reminder (type, channel, message, date) VALUES ('0', {}, '{}', '{}');\"\n .format(VAR_6, VAR_14, VAR_15.strftime('%Y-%m-%d %X')))\n", "await VAR_1.send_message(VAR_2,\n '{}, error when trying to add info to database! Please notifiy the admins!'\n .format(VAR_3))\n", "VAR_4.commit()\n", "print('[{}]: {} - {}'.format(strftime('%b %d, %Y %X', localtime()),\n 'SQLITE', 'Error when trying to insert data: ' + e.args[0]))\n", "await VAR_1.send_message(VAR_2, '{}, will remind you.'.format(VAR_3))\n", "VAR_8.write('[{}]: {} - {}\\n'.format(strftime('%b %d, %Y %X', localtime()),\n 'SQLITE', 'Error when trying to insert data: ' + e.args[0]))\n" ]
[ "async def ex_me(dclient, channel, mention, con, con_ex, author_id, a,...\n", "a = a.split(' ')\n", "if len(a) >= 2:\n", "time = a[0].lower()\n", "await dclient.send_message(channel,\n '{}, **USAGE:** {}remindme <time> <message...>'.format(mention, cmd_char))\n", "msg = ''\n", "print('')\n", "for i in range(1, len(a)):\n", "msg += a[i] + ' '\n", "if 'd' in time or 'h' in time or 'm' in time or 's' in time or ',' in time:\n", "date = get_date(time)\n", "await dclient.send_message(channel,\n '{}, The time must be in #time format (ex: 1h or 2h,5m).'.format(\n mention, cmd_char))\n", "con_ex.execute(\n \"INSERT INTO reminder (type, channel, message, date) VALUES ('0', {}, '{}', '{}');\"\n .format(author_id, msg, date.strftime('%Y-%m-%d %X')))\n", "await dclient.send_message(channel,\n '{}, error when trying to add info to database! Please notifiy the admins!'\n .format(mention))\n", "con.commit()\n", "print('[{}]: {} - {}'.format(strftime('%b %d, %Y %X', localtime()),\n 'SQLITE', 'Error when trying to insert data: ' + e.args[0]))\n", "await dclient.send_message(channel, '{}, will remind you.'.format(mention))\n", "log_file.write('[{}]: {} - {}\\n'.format(strftime('%b %d, %Y %X', localtime(\n )), 'SQLITE', 'Error when trying to insert data: ' + e.args[0]))\n" ]
[ 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Condition", "Assign'", "Expr'", "Assign'", "Expr'", "For", "AugAssign'", "Condition", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "import unittest\n", "import re\n", "from mockito import mock, when, any as ANY\n", "from pixelated.application import UserAgentMode\n", "from test.unit.resources import DummySite\n", "from twisted.web.test.requesthelper import DummyRequest\n", "from pixelated.resources.root_resource import RootResource\n", "VAR_0 = '[email protected]'\n", "def FUNC_0(self):...\n", "self.mail_service = mock()\n", "self.services_factory = mock()\n", "self.services_factory.mode = UserAgentMode(is_single_user=True)\n", "self.services = mock()\n", "self.services.mail_service = self.mail_service\n", "self.services_factory._services_by_user = {'someuserid': self.mail_service}\n", "when(self.services_factory).services(ANY()).thenReturn(self.services)\n", "self.mail_service.account_email = self.MAIL_ADDRESS\n", "VAR_1 = RootResource(self.services_factory)\n", "VAR_1._html_template = (\n '<html><head><title>$account_email</title></head></html>')\n", "VAR_1._mode = VAR_1\n", "self.web = DummySite(VAR_1)\n", "def FUNC_1(self):...\n", "VAR_2 = DummyRequest([''])\n", "VAR_3 = self.web.get(VAR_2)\n", "def FUNC_2(VAR_4):...\n", "VAR_5 = '<title>{0}</title>'.format(self.MAIL_ADDRESS)\n", "VAR_6 = re.findall(VAR_5, VAR_2.written[0])\n", "self.assertEquals(len(VAR_6), 1)\n", "VAR_3.addCallback(FUNC_2)\n", "return VAR_3\n" ]
[ "import unittest\n", "import re\n", "from mockito import mock, when, any as ANY\n", "from pixelated.application import UserAgentMode\n", "from test.unit.resources import DummySite\n", "from twisted.web.test.requesthelper import DummyRequest\n", "from pixelated.resources.root_resource import RootResource\n", "MAIL_ADDRESS = '[email protected]'\n", "def setUp(self):...\n", "self.mail_service = mock()\n", "self.services_factory = mock()\n", "self.services_factory.mode = UserAgentMode(is_single_user=True)\n", "self.services = mock()\n", "self.services.mail_service = self.mail_service\n", "self.services_factory._services_by_user = {'someuserid': self.mail_service}\n", "when(self.services_factory).services(ANY()).thenReturn(self.services)\n", "self.mail_service.account_email = self.MAIL_ADDRESS\n", "root_resource = RootResource(self.services_factory)\n", "root_resource._html_template = (\n '<html><head><title>$account_email</title></head></html>')\n", "root_resource._mode = root_resource\n", "self.web = DummySite(root_resource)\n", "def test_render_GET_should_template_account_email(self):...\n", "request = DummyRequest([''])\n", "d = self.web.get(request)\n", "def assert_response(_):...\n", "expected = '<title>{0}</title>'.format(self.MAIL_ADDRESS)\n", "matches = re.findall(expected, request.written[0])\n", "self.assertEquals(len(matches), 1)\n", "d.addCallback(assert_response)\n", "return d\n" ]
[ 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Import'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Assign'", "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "FunctionDef'", "Assign'", "Assign'", "FunctionDef'", "Assign'", "Assign'", "Expr'", "Expr'", "Return'" ]
[ "def FUNC_3(self):...\n", "self._mox.ReplayAll()\n", "self.assertEqual(url_helper.UrlOpen('url', wait_duration=-1), None)\n", "self._mox.VerifyAll()\n" ]
[ "def testUrlOpenInvalidWaitDuration(self):...\n", "self._mox.ReplayAll()\n", "self.assertEqual(url_helper.UrlOpen('url', wait_duration=-1), None)\n", "self._mox.VerifyAll()\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_10(self):...\n", "frappe.set_user('[email protected]')\n", "self.assertRaises(frappe.PermissionError, get_filters_cond, 'DocType', dict\n (istable=1), [])\n", "self.assertTrue(get_filters_cond('DocType', dict(istable=1), [],\n ignore_permissions=True))\n", "frappe.set_user('Administrator')\n" ]
[ "def test_ignore_permissions_for_get_filters_cond(self):...\n", "frappe.set_user('[email protected]')\n", "self.assertRaises(frappe.PermissionError, get_filters_cond, 'DocType', dict\n (istable=1), [])\n", "self.assertTrue(get_filters_cond('DocType', dict(istable=1), [],\n ignore_permissions=True))\n", "frappe.set_user('Administrator')\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_7(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_4 = self.stdout_interceptor.read_all()\n", "VAR_4 = ''\n", "return render_texts.preformatted_text(VAR_4)\n" ]
[ "def read_stdout(self):...\n", "\"\"\"docstring\"\"\"\n", "contents = self.stdout_interceptor.read_all()\n", "contents = ''\n", "return render_texts.preformatted_text(contents)\n" ]
[ 0, 0, 6, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_2(VAR_7):...\n", "\"\"\"docstring\"\"\"\n", "@functools.wraps(VAR_7)...\n", "assert isinstance(self, webapp2.RequestHandler)\n", "if model.is_replica():\n", "VAR_40 = model.get_replication_state().primary_url\n", "return VAR_7(self, *VAR_9, **kwargs)\n", "self.abort(405, detail='Not allowed on a replica, see primary at %s' %\n primary_url)\n" ]
[ "def forbid_ui_on_replica(method):...\n", "\"\"\"docstring\"\"\"\n", "@functools.wraps(method)...\n", "assert isinstance(self, webapp2.RequestHandler)\n", "if model.is_replica():\n", "primary_url = model.get_replication_state().primary_url\n", "return method(self, *args, **kwargs)\n", "self.abort(405, detail='Not allowed on a replica, see primary at %s' %\n primary_url)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Assert'", "Condition", "Assign'", "Return'", "Expr'" ]
[ "def __exit__(self, *VAR_4):...\n", "\"\"\"docstring\"\"\"\n" ]
[ "def __exit__(self, *ext):...\n", "\"\"\"docstring\"\"\"\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Docstring" ]
[ "def FUNC_4(self):...\n", "if self._user_notified_about_crash or self._IsServerAlive():\n", "return\n", "self._user_notified_about_crash = True\n", "if self._server_stderr:\n", "VAR_27 = ''.join(server_stderr_file.readlines()[:-VAR_1])\n", "vimsupport.PostVimMessage(VAR_3)\n", "vimsupport.PostMultiLineNotice(VAR_2 + VAR_27)\n" ]
[ "def _NotifyUserIfServerCrashed(self):...\n", "if self._user_notified_about_crash or self._IsServerAlive():\n", "return\n", "self._user_notified_about_crash = True\n", "if self._server_stderr:\n", "error_output = ''.join(server_stderr_file.readlines()[:-\n NUM_YCMD_STDERR_LINES_ON_CRASH])\n", "vimsupport.PostVimMessage(SERVER_CRASH_MESSAGE_SAME_STDERR)\n", "vimsupport.PostMultiLineNotice(SERVER_CRASH_MESSAGE_STDERR_FILE + error_output)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Assign'", "Condition", "Assign'", "Expr'", "Expr'" ]
[ "def FUNC_0(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_18 = pq.backends.Simulator(**self.filter_kwargs_for_backend(self.kwargs))\n", "self.eng = pq.MainEngine(VAR_18)\n", "super().reset()\n" ]
[ "def reset(self):...\n", "\"\"\"docstring\"\"\"\n", "backend = pq.backends.Simulator(**self.filter_kwargs_for_backend(self.kwargs))\n", "self.eng = pq.MainEngine(backend)\n", "super().reset()\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_13(self):...\n", "self.run_test_case(self.scenario.upsert_load_balancer())\n" ]
[ "def test_a_upsert_load_balancer(self):...\n", "self.run_test_case(self.scenario.upsert_load_balancer())\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_8(self):...\n", "self.authn('/login')\n" ]
[ "def test_login_authn(self):...\n", "self.authn('/login')\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_2(self, VAR_3, VAR_4=False):...\n", "return VAR_3.cursor()\n" ]
[ "def newCursorForConnection(self, conn, dictMode=False):...\n", "return conn.cursor()\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "async def FUNC_0(self, VAR_0):...\n", "for callback in self.on_member_join_callbacks:\n", "await callback(VAR_0)\n" ]
[ "async def on_member_join(self, member):...\n", "for callback in self.on_member_join_callbacks:\n", "await callback(member)\n" ]
[ 0, 0, 0 ]
[ "AsyncFunctionDef'", "For", "Expr'" ]
[ "def FUNC_8(self):...\n", "\"\"\"docstring\"\"\"\n", "while self.char and self.char.isspace():\n", "self.read()\n", "if self.char == None:\n", "return CLASS_2(CLASS_1.EOF, None, self.position)\n", "if self.char == '>':\n", "VAR_49 = self.position\n", "if self.char == '<':\n", "if self.read() == '>':\n", "VAR_41 = CLASS_2(CLASS_1.REDIRECT_IN, None, self.position)\n", "if self.char == '|':\n", "self.read()\n", "return CLASS_2(CLASS_1.REDIRECT_OUT, None, VAR_49)\n", "self.read()\n", "VAR_41 = CLASS_2(CLASS_1.PIPE, None, self.position)\n", "if self.char == ';':\n", "return CLASS_2(CLASS_1.REDIRECT_APPEND, None, VAR_49)\n", "return VAR_41\n", "self.read()\n", "VAR_41 = CLASS_2(CLASS_1.COMMAND_END, None, self.position)\n", "if self.char in '\\'\"':\n", "return VAR_41\n", "self.read()\n", "VAR_50 = self.char\n", "if self.char.isprintable():\n", "return VAR_41\n", "self.read()\n", "VAR_49 = self.position\n", "VAR_41 = CLASS_2(CLASS_1.UNKNOWN, self.char, self.position)\n", "VAR_49 = self.position\n", "VAR_28 = []\n", "self.read()\n", "VAR_28 = []\n", "while self.char and self.char.isprintable() and not self.char.isspace():\n", "return VAR_41\n", "while self.char and self.char != VAR_50:\n", "VAR_28.append(self.char)\n", "return CLASS_2(CLASS_1.WORD, ''.join(VAR_28), VAR_49)\n", "VAR_28.append(self.char)\n", "if self.char is None:\n", "self.read()\n", "self.read()\n", "self.read()\n", "return CLASS_2(CLASS_1.WORD, ''.join(VAR_28), VAR_49)\n" ]
[ "def token(self):...\n", "\"\"\"docstring\"\"\"\n", "while self.char and self.char.isspace():\n", "self.read()\n", "if self.char == None:\n", "return Token(TokenType.EOF, None, self.position)\n", "if self.char == '>':\n", "start = self.position\n", "if self.char == '<':\n", "if self.read() == '>':\n", "token = Token(TokenType.REDIRECT_IN, None, self.position)\n", "if self.char == '|':\n", "self.read()\n", "return Token(TokenType.REDIRECT_OUT, None, start)\n", "self.read()\n", "token = Token(TokenType.PIPE, None, self.position)\n", "if self.char == ';':\n", "return Token(TokenType.REDIRECT_APPEND, None, start)\n", "return token\n", "self.read()\n", "token = Token(TokenType.COMMAND_END, None, self.position)\n", "if self.char in '\\'\"':\n", "return token\n", "self.read()\n", "end = self.char\n", "if self.char.isprintable():\n", "return token\n", "self.read()\n", "start = self.position\n", "token = Token(TokenType.UNKNOWN, self.char, self.position)\n", "start = self.position\n", "value = []\n", "self.read()\n", "value = []\n", "while self.char and self.char.isprintable() and not self.char.isspace():\n", "return token\n", "while self.char and self.char != end:\n", "value.append(self.char)\n", "return Token(TokenType.WORD, ''.join(value), start)\n", "value.append(self.char)\n", "if self.char is None:\n", "self.read()\n", "self.read()\n", "self.read()\n", "return Token(TokenType.WORD, ''.join(value), start)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Expr'", "Condition", "Return'", "Condition", "Assign'", "Condition", "Condition", "Assign'", "Condition", "Expr'", "Return'", "Expr'", "Assign'", "Condition", "Return'", "Return'", "Expr'", "Assign'", "Condition", "Return'", "Expr'", "Assign'", "Condition", "Return'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Condition", "Return'", "Condition", "Expr'", "Return'", "Expr'", "Condition", "Expr'", "Expr'", "Expr'", "Return'" ]
[ "def FUNC_12(self):...\n", "return self.vars.copy()\n" ]
[ "def get_vars(self):...\n", "return self.vars.copy()\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "@VAR_0.before_app_first_request...\n", "\"\"\"docstring\"\"\"\n", "user_logged_out.connect(oauth_logout_handler)\n", "oauth.init_app(current_app)\n", "for VAR_1, conf in cfg['OAUTHCLIENT_REMOTE_APPS'].items():\n", "if VAR_1 not in oauth.remote_apps:\n", "VAR_4 = oauth.remote_app(VAR_1, **conf['params'])\n", "VAR_4 = oauth.remote_apps[VAR_1]\n", "VAR_4.tokengetter(make_token_getter(VAR_4))\n", "handlers.register(VAR_1, VAR_4.authorized_handler(make_handler(conf.get(\n 'authorized_handler', authorized_default_handler), VAR_4)))\n", "disconnect_handlers.register(VAR_1, make_handler(conf.get(\n 'disconnect_handler', disconnect_handler), VAR_4, with_response=False))\n", "def FUNC_5(VAR_4, *VAR_5, **VAR_6):...\n", "VAR_7 = conf.get('signup_handler', dict())\n", "VAR_8 = make_handler(VAR_7.get('info', FUNC_5), VAR_4, with_response=False)\n", "VAR_9 = make_handler(VAR_7.get('setup', FUNC_5), VAR_4, with_response=False)\n", "VAR_10 = make_handler(VAR_7.get('view', FUNC_5), VAR_4, with_response=False)\n", "signup_handlers.register(VAR_1, dict(info=account_info_handler, setup=\n account_setup_handler, view=account_view_handler))\n" ]
[ "@blueprint.before_app_first_request...\n", "\"\"\"docstring\"\"\"\n", "user_logged_out.connect(oauth_logout_handler)\n", "oauth.init_app(current_app)\n", "for remote_app, conf in cfg['OAUTHCLIENT_REMOTE_APPS'].items():\n", "if remote_app not in oauth.remote_apps:\n", "remote = oauth.remote_app(remote_app, **conf['params'])\n", "remote = oauth.remote_apps[remote_app]\n", "remote.tokengetter(make_token_getter(remote))\n", "handlers.register(remote_app, remote.authorized_handler(make_handler(conf.\n get('authorized_handler', authorized_default_handler), remote)))\n", "disconnect_handlers.register(remote_app, make_handler(conf.get(\n 'disconnect_handler', disconnect_handler), remote, with_response=False))\n", "def dummy_handler(remote, *args, **kargs):...\n", "signup_handler = conf.get('signup_handler', dict())\n", "account_info_handler = make_handler(signup_handler.get('info',\n dummy_handler), remote, with_response=False)\n", "account_setup_handler = make_handler(signup_handler.get('setup',\n dummy_handler), remote, with_response=False)\n", "account_view_handler = make_handler(signup_handler.get('view',\n dummy_handler), remote, with_response=False)\n", "signup_handlers.register(remote_app, dict(info=account_info_handler, setup=\n account_setup_handler, view=account_view_handler))\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "For", "Docstring", "Expr'", "Expr'", "For", "Condition", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_9(self):...\n", "\"\"\"docstring\"\"\"\n", "self.con.commit()\n", "logging.error(T('SQL Commit Failed, see log'))\n", "logging.info('Traceback: ', exc_info=True)\n" ]
[ "def save(self):...\n", "\"\"\"docstring\"\"\"\n", "self.con.commit()\n", "logging.error(T('SQL Commit Failed, see log'))\n", "logging.info('Traceback: ', exc_info=True)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_4(self, VAR_11, VAR_7):...\n", "" ]
[ "def expectation(self, observable, wires):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "def __getattr__(self, VAR_2: str) ->Any:...\n", "...\n" ]
[ "def __getattr__(self, name: str) ->Any:...\n", "...\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_1():...\n", "VAR_6 = './data/input/'\n", "VAR_7 = VAR_6 + 'download/'\n", "VAR_8 = './data/temp/'\n", "VAR_9 = './data/vcf/'\n", "VAR_10 = './data/zarr/'\n", "VAR_11 = './data/zarr_benchmark/'\n", "VAR_12 = FUNC_0()\n", "VAR_13 = VAR_12['command']\n", "if VAR_13 == 'config':\n", "VAR_14 = VAR_12['output_config']\n", "if VAR_13 == 'setup':\n", "VAR_15 = VAR_12['f']\n", "print('[Setup] Setting up benchmark data.')\n", "if VAR_13 == 'exec':\n", "config.generate_default_config_file(output_location=output_config_location,\n overwrite=overwrite_mode)\n", "data_service.remove_directory_tree(VAR_9)\n", "print('[Exec] Executing benchmark tool.')\n", "print('Error: Unexpected command specified. Exiting...')\n", "data_service.remove_directory_tree(VAR_10)\n", "VAR_16 = config.read_configuration(location=cli_arguments['config_file'])\n", "sys.exit(1)\n", "VAR_16 = config.read_configuration(location=cli_arguments['config_file'])\n", "VAR_18 = config.VCFtoZarrConfigurationRepresentation(VAR_16)\n", "VAR_17 = config.FTPConfigurationRepresentation(VAR_16)\n", "if VAR_17.enabled:\n", "print('[Setup][FTP] FTP module enabled. Running FTP download...')\n", "print('[Setup][FTP] FTP module disabled. Skipping FTP download...')\n", "data_service.fetch_data_via_ftp(VAR_17=ftp_config, local_directory=\n download_directory)\n", "data_service.process_data_files(input_dir=input_directory, temp_dir=\n temp_directory, output_dir=vcf_directory)\n", "VAR_18 = config.VCFtoZarrConfigurationRepresentation(VAR_16)\n", "if VAR_18.enabled:\n", "data_service.setup_vcf_to_zarr(input_vcf_dir=vcf_directory, output_zarr_dir\n =zarr_directory_setup, conversion_config=vcf_to_zarr_config)\n" ]
[ "def _main():...\n", "input_directory = './data/input/'\n", "download_directory = input_directory + 'download/'\n", "temp_directory = './data/temp/'\n", "vcf_directory = './data/vcf/'\n", "zarr_directory_setup = './data/zarr/'\n", "zarr_directory_benchmark = './data/zarr_benchmark/'\n", "cli_arguments = get_cli_arguments()\n", "command = cli_arguments['command']\n", "if command == 'config':\n", "output_config_location = cli_arguments['output_config']\n", "if command == 'setup':\n", "overwrite_mode = cli_arguments['f']\n", "print('[Setup] Setting up benchmark data.')\n", "if command == 'exec':\n", "config.generate_default_config_file(output_location=output_config_location,\n overwrite=overwrite_mode)\n", "data_service.remove_directory_tree(vcf_directory)\n", "print('[Exec] Executing benchmark tool.')\n", "print('Error: Unexpected command specified. Exiting...')\n", "data_service.remove_directory_tree(zarr_directory_setup)\n", "runtime_config = config.read_configuration(location=cli_arguments[\n 'config_file'])\n", "sys.exit(1)\n", "runtime_config = config.read_configuration(location=cli_arguments[\n 'config_file'])\n", "vcf_to_zarr_config = config.VCFtoZarrConfigurationRepresentation(runtime_config\n )\n", "ftp_config = config.FTPConfigurationRepresentation(runtime_config)\n", "if ftp_config.enabled:\n", "print('[Setup][FTP] FTP module enabled. Running FTP download...')\n", "print('[Setup][FTP] FTP module disabled. Skipping FTP download...')\n", "data_service.fetch_data_via_ftp(ftp_config=ftp_config, local_directory=\n download_directory)\n", "data_service.process_data_files(input_dir=input_directory, temp_dir=\n temp_directory, output_dir=vcf_directory)\n", "vcf_to_zarr_config = config.VCFtoZarrConfigurationRepresentation(runtime_config\n )\n", "if vcf_to_zarr_config.enabled:\n", "data_service.setup_vcf_to_zarr(input_vcf_dir=vcf_directory, output_zarr_dir\n =zarr_directory_setup, conversion_config=vcf_to_zarr_config)\n" ]
[ 0, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 0, 7 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Expr'", "Condition", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Condition", "Expr'", "Expr'", "Expr'", "Expr'", "Assign'", "Condition", "Expr'" ]
[ "def FUNC_13():...\n", "populate_test_database()\n", "FUNC_1('first playlist')\n", "VAR_11 = VAR_3.post('/videos/1/title/thumbnail')\n", "assert VAR_11.json['status'] == 'OK'\n", "VAR_12 = VAR_3.post('/videos/1/title2/thumbnail2')\n", "assert VAR_12.json['status'] == 'OK'\n", "VAR_13 = VAR_3.post('/videos/1/title3/thumbnail3')\n", "assert VAR_13.json['status'] == 'OK'\n", "VAR_14 = VAR_3.delete('/videos/2/1')\n", "assert VAR_14.json['status'] == 'OK'\n", "VAR_15 = VAR_3.get('/videos/1')\n", "assert VAR_11.json['status'] == 'OK'\n", "assert VAR_15.json['data'] == [dict(id=1, VAR_5='title', VAR_6='thumbnail',\n VAR_7=1), dict(id=3, VAR_5='title3', VAR_6='thumbnail3', VAR_7=2)]\n", "VAR_16 = VAR_3.get('/playlists/1')\n", "assert VAR_16.json['status'] == 'OK'\n", "assert VAR_16.json['data'] == dict(id=1, VAR_8='first playlist',\n video_position=2)\n" ]
[ "def test_should_reorder_video_position_given_a_deleted_video():...\n", "populate_test_database()\n", "create_playlist('first playlist')\n", "response = test_app.post('/videos/1/title/thumbnail')\n", "assert response.json['status'] == 'OK'\n", "response2 = test_app.post('/videos/1/title2/thumbnail2')\n", "assert response2.json['status'] == 'OK'\n", "response3 = test_app.post('/videos/1/title3/thumbnail3')\n", "assert response3.json['status'] == 'OK'\n", "response4 = test_app.delete('/videos/2/1')\n", "assert response4.json['status'] == 'OK'\n", "response5 = test_app.get('/videos/1')\n", "assert response.json['status'] == 'OK'\n", "assert response5.json['data'] == [dict(id=1, title='title', thumbnail=\n 'thumbnail', position=1), dict(id=3, title='title3', thumbnail=\n 'thumbnail3', position=2)]\n", "response6 = test_app.get('/playlists/1')\n", "assert response6.json['status'] == 'OK'\n", "assert response6.json['data'] == dict(id=1, name='first playlist',\n video_position=2)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Expr'", "Assign'", "Assert'", "Assign'", "Assert'", "Assign'", "Assert'", "Assign'", "Assert'", "Assign'", "Assert'", "Assert'", "Assign'", "Assert'", "Assert'" ]
[ "def FUNC_1(self, VAR_1):...\n", "return self.properties\n" ]
[ "def _fake_get_iscsi_properties(self, volume):...\n", "return self.properties\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_14(self):...\n", "self._test_strtype('text', None, 100)\n" ]
[ "def test_text_null(self):...\n", "self._test_strtype('text', None, 100)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_20(self, VAR_2, VAR_3, VAR_4, *VAR_5):...\n", "self.write_data({'type': VAR_3, 'event': VAR_5[0]})\n" ]
[ "def on_resource_event(self, subject, changetype, objectID, *args):...\n", "self.write_data({'type': changetype, 'event': args[0]})\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_1(VAR_0, VAR_1):...\n", "\"\"\"docstring\"\"\"\n", "VAR_4 = 'string'.format(VAR_1)\n", "VAR_6 = FUNC_3(VAR_0, VAR_4)\n", "if VAR_6 is not None:\n", "VAR_8 = open('top_authors_report.txt', 'w')\n", "return False\n", "for row in VAR_6:\n", "VAR_8.write('{} - {} views \\n'.format(row[0], row[1]))\n", "VAR_8.close()\n", "return True\n" ]
[ "def get_top_authors(cur, order):...\n", "\"\"\"docstring\"\"\"\n", "query = (\n \"\"\"SELECT authors.name, COUNT(*) as views\n FROM authors, articles, log\n WHERE authors.id = articles.author AND\n log.path LIKE '%'||articles.slug AND\n log.method = 'GET'\n GROUP BY authors.name\n ORDER BY views {}\"\"\"\n .format(order))\n", "rows = get_data(cur, query)\n", "if rows is not None:\n", "file = open('top_authors_report.txt', 'w')\n", "return False\n", "for row in rows:\n", "file.write('{} - {} views \\n'.format(row[0], row[1]))\n", "file.close()\n", "return True\n" ]
[ 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Condition", "Assign'", "Return'", "For", "Expr'", "Expr'", "Return'" ]
[ "def FUNC_5(self, VAR_13=''):...\n", "self.write(VAR_13 + '\\n')\n", "return self.read_until()\n" ]
[ "def command(self, command=''):...\n", "self.write(command + '\\n')\n", "return self.read_until()\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Return'" ]
[ "def FUNC_17(VAR_8):...\n", "" ]
[ "def open_port_firewalld(cfg):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "def FUNC_15(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_2 = {'SEVERITY': {'LOW': 4, 'MEDIUM': 5, 'HIGH': 0}, 'CONFIDENCE': {\n 'HIGH': 9}}\n", "self.check_example('imports-aliases.py', VAR_2)\n" ]
[ "def test_imports_aliases(self):...\n", "\"\"\"docstring\"\"\"\n", "expect = {'SEVERITY': {'LOW': 4, 'MEDIUM': 5, 'HIGH': 0}, 'CONFIDENCE': {\n 'HIGH': 9}}\n", "self.check_example('imports-aliases.py', expect)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'" ]
[ "def FUNC_16(self):...\n", "return False\n" ]
[ "def do_existing_paths(self):...\n", "return False\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_8(VAR_5):...\n", "self.session.notifier.notify(NTFY_UPGRADER, NTFY_STARTED, None, None)\n", "self.session.notifier.notify(NTFY_UPGRADER_TICK, NTFY_STARTED, None, None)\n", "self.session.notifier.notify(NTFY_UPGRADER, NTFY_FINISHED, None, None)\n", "self.session.notifier.notify(NTFY_WATCH_FOLDER_CORRUPT_TORRENT, NTFY_INSERT,\n None, None)\n", "self.session.notifier.notify(NTFY_NEW_VERSION, NTFY_INSERT, None, None)\n", "self.session.notifier.notify(NTFY_CHANNEL, NTFY_DISCOVERED, None, None)\n", "self.session.notifier.notify(NTFY_TORRENT, NTFY_DISCOVERED, None, {'a':\n 'Invalid character ¡'})\n", "self.session.notifier.notify(NTFY_TORRENT, NTFY_FINISHED, 'a' * 10, None)\n", "self.session.notifier.notify(NTFY_TORRENT, NTFY_ERROR, 'a' * 10,\n 'This is an error message')\n", "self.session.notifier.notify(NTFY_MARKET_ON_ASK, NTFY_UPDATE, None, {'a': 'b'})\n", "self.session.notifier.notify(NTFY_MARKET_ON_BID, NTFY_UPDATE, None, {'a': 'b'})\n", "self.session.notifier.notify(NTFY_MARKET_ON_ASK_TIMEOUT, NTFY_UPDATE, None,\n {'a': 'b'})\n", "self.session.notifier.notify(NTFY_MARKET_ON_BID_TIMEOUT, NTFY_UPDATE, None,\n {'a': 'b'})\n", "self.session.notifier.notify(NTFY_MARKET_ON_TRANSACTION_COMPLETE,\n NTFY_UPDATE, None, {'a': 'b'})\n", "self.session.notifier.notify(NTFY_MARKET_ON_PAYMENT_RECEIVED, NTFY_UPDATE,\n None, {'a': 'b'})\n", "self.session.notifier.notify(NTFY_MARKET_ON_PAYMENT_SENT, NTFY_UPDATE, None,\n {'a': 'b'})\n", "self.session.notifier.notify(SIGNAL_RESOURCE_CHECK, SIGNAL_LOW_SPACE, None, {})\n", "self.session.notifier.notify(NTFY_CREDIT_MINING, NTFY_ERROR, None, {\n 'message': 'Some credit mining error'})\n", "self.session.notifier.notify(NTFY_TUNNEL, NTFY_REMOVE, Circuit(1234, None),\n 'test')\n", "self.session.lm.api_manager.root_endpoint.events_endpoint.on_tribler_exception(\n 'hi')\n" ]
[ "def send_notifications(_):...\n", "self.session.notifier.notify(NTFY_UPGRADER, NTFY_STARTED, None, None)\n", "self.session.notifier.notify(NTFY_UPGRADER_TICK, NTFY_STARTED, None, None)\n", "self.session.notifier.notify(NTFY_UPGRADER, NTFY_FINISHED, None, None)\n", "self.session.notifier.notify(NTFY_WATCH_FOLDER_CORRUPT_TORRENT, NTFY_INSERT,\n None, None)\n", "self.session.notifier.notify(NTFY_NEW_VERSION, NTFY_INSERT, None, None)\n", "self.session.notifier.notify(NTFY_CHANNEL, NTFY_DISCOVERED, None, None)\n", "self.session.notifier.notify(NTFY_TORRENT, NTFY_DISCOVERED, None, {'a':\n 'Invalid character ¡'})\n", "self.session.notifier.notify(NTFY_TORRENT, NTFY_FINISHED, 'a' * 10, None)\n", "self.session.notifier.notify(NTFY_TORRENT, NTFY_ERROR, 'a' * 10,\n 'This is an error message')\n", "self.session.notifier.notify(NTFY_MARKET_ON_ASK, NTFY_UPDATE, None, {'a': 'b'})\n", "self.session.notifier.notify(NTFY_MARKET_ON_BID, NTFY_UPDATE, None, {'a': 'b'})\n", "self.session.notifier.notify(NTFY_MARKET_ON_ASK_TIMEOUT, NTFY_UPDATE, None,\n {'a': 'b'})\n", "self.session.notifier.notify(NTFY_MARKET_ON_BID_TIMEOUT, NTFY_UPDATE, None,\n {'a': 'b'})\n", "self.session.notifier.notify(NTFY_MARKET_ON_TRANSACTION_COMPLETE,\n NTFY_UPDATE, None, {'a': 'b'})\n", "self.session.notifier.notify(NTFY_MARKET_ON_PAYMENT_RECEIVED, NTFY_UPDATE,\n None, {'a': 'b'})\n", "self.session.notifier.notify(NTFY_MARKET_ON_PAYMENT_SENT, NTFY_UPDATE, None,\n {'a': 'b'})\n", "self.session.notifier.notify(SIGNAL_RESOURCE_CHECK, SIGNAL_LOW_SPACE, None, {})\n", "self.session.notifier.notify(NTFY_CREDIT_MINING, NTFY_ERROR, None, {\n 'message': 'Some credit mining error'})\n", "self.session.notifier.notify(NTFY_TUNNEL, NTFY_REMOVE, Circuit(1234, None),\n 'test')\n", "self.session.lm.api_manager.root_endpoint.events_endpoint.on_tribler_exception(\n 'hi')\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_19(self):...\n", "self._diag_interface.OnCursorMoved()\n" ]
[ "def OnCursorMoved(self):...\n", "self._diag_interface.OnCursorMoved()\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "@defer.inlineCallbacks...\n", "VAR_71 = {'encoding': [VAR_44]}\n", "if VAR_45:\n", "VAR_71['filename'] = [VAR_45]\n", "if VAR_46:\n", "VAR_71['content_type'] = [VAR_46]\n", "VAR_72, VAR_73 = self.get('/attachment/%s' % VAR_43, VAR_71, VAR_21=False)\n", "VAR_69 = yield VAR_72\n", "defer.returnValue((VAR_69, VAR_73))\n" ]
[ "@defer.inlineCallbacks...\n", "params = {'encoding': [encoding]}\n", "if filename:\n", "params['filename'] = [filename]\n", "if content_type:\n", "params['content_type'] = [content_type]\n", "deferred_result, req = self.get('/attachment/%s' % ident, params, as_json=False\n )\n", "res = yield deferred_result\n", "defer.returnValue((res, req))\n" ]
[ 5, 0, 0, 0, 0, 0, 5, 0, 0 ]
[ "Condition", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_6(VAR_6):...\n", "return os.path.isfile(VAR_6) and os.stat(VAR_6).st_size > 0\n" ]
[ "def file_exists(file_path):...\n", "return os.path.isfile(file_path) and os.stat(file_path).st_size > 0\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "import os\n", "import os.path as path\n", "import sys\n", "import sqlite3\n", "import uuid\n", "import time\n", "import re\n", "import hunspell_suggest\n", "VAR_0 = '0.61'\n", "VAR_1 = re.compile('c([ea])(\\\\d):(.*)')\n", "VAR_2 = re.compile('p(-{0,1}\\\\d)(-{0,1}\\\\d)')\n", "def __init__(self, VAR_3=None):...\n", "\"\"\"docstring\"\"\"\n", "self.ime_property_cache = {}\n", "if VAR_3.find('typing-booster:') > 0:\n", "VAR_3 = VAR_3.replace('typing-booster:', '')\n", "if os.path.exists(VAR_3) and os.path.isfile(VAR_3):\n", "VAR_23 = re.compile('^#')\n", "sys.stderr.write('Error: ImeProperties: No such file: %s' % VAR_3)\n", "for line in file(VAR_3):\n", "def FUNC_0(self, VAR_4):...\n", "if not VAR_23.match(line):\n", "if VAR_4 in self.ime_property_cache:\n", "VAR_57, VAR_58 = line.strip().split('=', 1)\n", "return self.ime_property_cache[VAR_4]\n", "return None\n", "self.ime_property_cache[VAR_57.strip()] = VAR_58.strip()\n" ]
[ "import os\n", "import os.path as path\n", "import sys\n", "import sqlite3\n", "import uuid\n", "import time\n", "import re\n", "import hunspell_suggest\n", "user_database_version = '0.61'\n", "patt_r = re.compile('c([ea])(\\\\d):(.*)')\n", "patt_p = re.compile('p(-{0,1}\\\\d)(-{0,1}\\\\d)')\n", "def __init__(self, configfile_path=None):...\n", "\"\"\"docstring\"\"\"\n", "self.ime_property_cache = {}\n", "if configfile_path.find('typing-booster:') > 0:\n", "configfile_path = configfile_path.replace('typing-booster:', '')\n", "if os.path.exists(configfile_path) and os.path.isfile(configfile_path):\n", "comment_patt = re.compile('^#')\n", "sys.stderr.write('Error: ImeProperties: No such file: %s' % configfile_path)\n", "for line in file(configfile_path):\n", "def get(self, key):...\n", "if not comment_patt.match(line):\n", "if key in self.ime_property_cache:\n", "attr, val = line.strip().split('=', 1)\n", "return self.ime_property_cache[key]\n", "return None\n", "self.ime_property_cache[attr.strip()] = val.strip()\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "Assign'", "Assign'", "Assign'", "FunctionDef'", "Docstring", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Expr'", "For", "FunctionDef'", "Condition", "Condition", "Assign'", "Return'", "Return'", "Assign'" ]
[ "from django.core.exceptions import ObjectDoesNotExist\n", "from rest_framework import exceptions\n", "from app import models\n", "def FUNC_0(VAR_0, VAR_1, VAR_2=('view_project',)):...\n", "\"\"\"docstring\"\"\"\n", "VAR_6 = models.Project.objects.get(pk=project_pk, deleting=False)\n", "return VAR_6\n", "for perm in VAR_2:\n", "if not VAR_0.user.has_perm(perm, VAR_6):\n" ]
[ "from django.core.exceptions import ObjectDoesNotExist\n", "from rest_framework import exceptions\n", "from app import models\n", "def get_and_check_project(request, project_pk, perms=('view_project',)):...\n", "\"\"\"docstring\"\"\"\n", "project = models.Project.objects.get(pk=project_pk, deleting=False)\n", "return project\n", "for perm in perms:\n", "if not request.user.has_perm(perm, project):\n" ]
[ 1, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "ImportFrom'", "ImportFrom'", "ImportFrom'", "FunctionDef'", "Docstring", "Assign'", "Return'", "For", "Condition" ]
[ "def FUNC_6(self, VAR_14, VAR_15=None, VAR_16=200):...\n", "\"\"\"docstring\"\"\"\n", "VAR_28 = {'app_name': VAR_1, 'csp_nonce': self.csp_nonce, 'identity': api.\n get_current_identity(), 'logout_url': json.dumps(self.create_logout_url\n ('/')), 'xsrf_token': self.generate_xsrf_token()}\n", "VAR_28.update(VAR_15 or {})\n", "self.response.set_status(VAR_16)\n", "self.response.headers['Content-Type'] = 'text/html; charset=utf-8'\n", "self.response.write(template.render(VAR_14, VAR_28))\n" ]
[ "def reply(self, path, env=None, status=200):...\n", "\"\"\"docstring\"\"\"\n", "full_env = {'app_name': _ui_app_name, 'csp_nonce': self.csp_nonce,\n 'identity': api.get_current_identity(), 'logout_url': json.dumps(self.\n create_logout_url('/')), 'xsrf_token': self.generate_xsrf_token()}\n", "full_env.update(env or {})\n", "self.response.set_status(status)\n", "self.response.headers['Content-Type'] = 'text/html; charset=utf-8'\n", "self.response.write(template.render(path, full_env))\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'", "Expr'", "Assign'", "Expr'" ]
[ "def FUNC_1(self):...\n", "VAR_10 = super().clean()\n", "if 'path' in VAR_10:\n", "FUNC_0(self.instance.project, VAR_10['path'], self.instance.pk)\n", "return VAR_10\n" ]
[ "def clean(self):...\n", "cleaned_data = super().clean()\n", "if 'path' in cleaned_data:\n", "validate_unique_project_path(self.instance.project, cleaned_data['path'],\n self.instance.pk)\n", "return cleaned_data\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Expr'", "Return'" ]
[ "def FUNC_0(self, VAR_11=None, VAR_12=None):...\n", "\"\"\"docstring\"\"\"\n", "assert self.use_stdin and VAR_12 is not None or not self.use_stdin and VAR_11 is not None\n", "VAR_21 = self.generate_config_file()\n", "self.command = self._create_command(VAR_11=filename, VAR_21=config_file)\n", "VAR_22 = ''.join(VAR_12) if self.use_stdin else None\n", "VAR_23, VAR_24 = run_shell_command(self.command, stdin=stdin_input)\n", "self.stdout_output = tuple(VAR_23.splitlines(keepends=True))\n", "self.stderr_output = tuple(VAR_24.splitlines(keepends=True))\n", "VAR_25 = self.stderr_output if self.use_stderr else self.stdout_output\n", "VAR_26 = self.process_output(VAR_25, VAR_11, VAR_12)\n", "if not self.use_stderr:\n", "self._print_errors(self.stderr_output)\n", "if VAR_21:\n", "os.remove(VAR_21)\n", "return VAR_26\n" ]
[ "def lint(self, filename=None, file=None):...\n", "\"\"\"docstring\"\"\"\n", "assert self.use_stdin and file is not None or not self.use_stdin and filename is not None\n", "config_file = self.generate_config_file()\n", "self.command = self._create_command(filename=filename, config_file=config_file)\n", "stdin_input = ''.join(file) if self.use_stdin else None\n", "stdout_output, stderr_output = run_shell_command(self.command, stdin=\n stdin_input)\n", "self.stdout_output = tuple(stdout_output.splitlines(keepends=True))\n", "self.stderr_output = tuple(stderr_output.splitlines(keepends=True))\n", "results_output = self.stderr_output if self.use_stderr else self.stdout_output\n", "results = self.process_output(results_output, filename, file)\n", "if not self.use_stderr:\n", "self._print_errors(self.stderr_output)\n", "if config_file:\n", "os.remove(config_file)\n", "return results\n" ]
[ 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assert'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Expr'", "Condition", "Expr'", "Return'" ]
[ "def FUNC_2(self, VAR_6):...\n", "print('Start Crawl')\n", "print(VAR_6.url)\n", "VAR_7 = KeyExtractor()\n", "while VAR_7.hasMoreProfileLinks():\n", "VAR_10 = VAR_7.getMoreProfileLinks()\n", "for link in VAR_10:\n", "VAR_13 = link\n", "VAR_14 = link + '/couch'\n", "VAR_15 = link + '/photos'\n", "VAR_16 = link + '/references'\n", "VAR_17 = link + '/friends'\n", "VAR_18 = link + '/favorites'\n", "VAR_19 = [VAR_13, VAR_14, VAR_15, VAR_16, VAR_17, VAR_18]\n", "for sub_link in VAR_19:\n", "yield scrapy.Request(url=sub_link, callback=self.parse)\n" ]
[ "def start_crawl(self, response):...\n", "print('Start Crawl')\n", "print(response.url)\n", "key_extractor = KeyExtractor()\n", "while key_extractor.hasMoreProfileLinks():\n", "links = key_extractor.getMoreProfileLinks()\n", "for link in links:\n", "about_link = link\n", "couch_link = link + '/couch'\n", "photos_link = link + '/photos'\n", "references_link = link + '/references'\n", "friends_link = link + '/friends'\n", "favorites_link = link + '/favorites'\n", "link_list = [about_link, couch_link, photos_link, references_link,\n friends_link, favorites_link]\n", "for sub_link in link_list:\n", "yield scrapy.Request(url=sub_link, callback=self.parse)\n" ]
[ 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5 ]
[ "FunctionDef'", "Expr'", "Expr'", "Assign'", "Condition", "Assign'", "For", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "For", "Expr'" ]
[ "def FUNC_19(self, VAR_2):...\n", "self._target_roots = list(VAR_2)\n" ]
[ "def _replace_targets(self, target_roots):...\n", "self._target_roots = list(target_roots)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Assign'" ]
[ "def __init__(self, VAR_0):...\n", "VAR_0 = VAR_0.strip().splitlines()\n", "VAR_13 = VAR_0[1][0]\n", "VAR_23 = CLASS_5.usedMarkers.index(VAR_13)\n", "VAR_23 = len(CLASS_5.usedMarkers)\n", "if VAR_23 > 2:\n", "CLASS_5.usedMarkers.append(VAR_13)\n", "warn(\"Something's wrong with heading marker\", VAR_13, 'having index', VAR_23)\n", "super(CLASS_5, self).__init__(CLASS_5.formats[VAR_23] % VAR_0[0])\n", "VAR_23 = 2\n", "debug('Heading level', VAR_23, VAR_13, VAR_0[0])\n" ]
[ "def __init__(self, txt):...\n", "txt = txt.strip().splitlines()\n", "marker = txt[1][0]\n", "i = Heading.usedMarkers.index(marker)\n", "i = len(Heading.usedMarkers)\n", "if i > 2:\n", "Heading.usedMarkers.append(marker)\n", "warn(\"Something's wrong with heading marker\", marker, 'having index', i)\n", "super(Heading, self).__init__(Heading.formats[i] % txt[0])\n", "i = 2\n", "debug('Heading level', i, marker, txt[0])\n" ]
[ 0, 2, 0, 0, 0, 0, 0, 2, 2, 0, 2 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Expr'", "Expr'", "Expr'", "Assign'", "Expr'" ]
[ "def FUNC_1(VAR_3):...\n", "def FUNC_6(VAR_6):...\n", "assert VAR_6 == VAR_3\n", "return VAR_0\n" ]
[ "def create_mock_os_walk(mock_path):...\n", "def _os_walk(path):...\n", "assert path == mock_path\n", "return MOCK_PATHS\n" ]
[ 0, 0, 0, 1 ]
[ "FunctionDef'", "FunctionDef'", "Assert'", "Return'" ]
[ "def __init__(self, VAR_2=None, VAR_3=None, VAR_4=True):...\n", "self.vars = {}\n", "self.groups = []\n", "self._uuid = None\n", "self.name = VAR_2\n", "self.address = VAR_2\n", "if VAR_3:\n", "self.set_variable('ansible_port', int(VAR_3))\n", "if VAR_4:\n", "self._uuid = get_unique_id()\n", "self.implicit = False\n" ]
[ "def __init__(self, name=None, port=None, gen_uuid=True):...\n", "self.vars = {}\n", "self.groups = []\n", "self._uuid = None\n", "self.name = name\n", "self.address = name\n", "if port:\n", "self.set_variable('ansible_port', int(port))\n", "if gen_uuid:\n", "self._uuid = get_unique_id()\n", "self.implicit = False\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Expr'", "Condition", "Assign'", "Assign'" ]
[ "def FUNC_13(self, VAR_8):...\n", "logging.info('Rebooting bot: %s', VAR_8)\n", "VAR_36 = {'cmd': 'restart', 'message': VAR_8}\n", "self.send_response(VAR_36)\n" ]
[ "def _cmd_restart(self, message):...\n", "logging.info('Rebooting bot: %s', message)\n", "out = {'cmd': 'restart', 'message': message}\n", "self.send_response(out)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Assign'", "Expr'" ]
[ "def FUNC_1(self):...\n", "\"\"\"docstring\"\"\"\n", "self._out = self.execute_queued()\n" ]
[ "def execute(self):...\n", "\"\"\"docstring\"\"\"\n", "self._out = self.execute_queued()\n" ]
[ 0, 0, 7 ]
[ "FunctionDef'", "Docstring", "Assign'" ]
[ "def FUNC_9(self):...\n", "for resource in set(resource for VAR_13 in self.rules for resource in\n", "if resource not in '_cores _nodes'.split():\n", "logger.info(resource)\n" ]
[ "def list_resources(self):...\n", "for resource in set(resource for rule in self.rules for resource in rule.\n", "if resource not in '_cores _nodes'.split():\n", "logger.info(resource)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "For", "Condition", "Expr'" ]
[ "def FUNC_5(self):...\n", "self.driver._eql_execute = self.mox.CreateMock(self.driver._eql_execute)\n", "VAR_1 = {'name': self.volume_name, 'size': 1}\n", "self.driver._eql_execute('volume', 'select', VAR_1['name'], 'show')\n", "self.mox.ReplayAll()\n", "self.driver.ensure_export({}, VAR_1)\n" ]
[ "def test_ensure_export(self):...\n", "self.driver._eql_execute = self.mox.CreateMock(self.driver._eql_execute)\n", "volume = {'name': self.volume_name, 'size': 1}\n", "self.driver._eql_execute('volume', 'select', volume['name'], 'show')\n", "self.mox.ReplayAll()\n", "self.driver.ensure_export({}, volume)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'" ]
[ "@VAR_1.route('/run/form/init', methods=['POST'])...\n", "VAR_37 = FUNC_15()\n", "VAR_10 = json.loads(request.data)['commands']\n", "FUNC_16(VAR_37, VAR_10)\n", "return json.dumps({'commands': VAR_10, 'html': render_template(\n 'run_form.html', VAR_9=run_form)})\n" ]
[ "@app.route('/run/form/init', methods=['POST'])...\n", "run_form = get_run_form()\n", "commands = json.loads(request.data)['commands']\n", "set_form_defaults(run_form, commands)\n", "return json.dumps({'commands': commands, 'html': render_template(\n 'run_form.html', form=run_form)})\n" ]
[ 0, 0, 0, 0, 0 ]
[ "For", "Assign'", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_2(self) ->str:...\n", "\"\"\"docstring\"\"\"\n", "self.bytes_buffer.seek(0)\n", "VAR_4 = self.bytes_buffer.read()\n", "self.bytes_buffer.truncate(0)\n", "self.bytes_buffer.seek(0)\n", "if VAR_4 is None:\n", "return ''\n", "return VAR_4.decode(self.source_encoding)\n" ]
[ "def flush_all(self) ->str:...\n", "\"\"\"docstring\"\"\"\n", "self.bytes_buffer.seek(0)\n", "contents = self.bytes_buffer.read()\n", "self.bytes_buffer.truncate(0)\n", "self.bytes_buffer.seek(0)\n", "if contents is None:\n", "return ''\n", "return contents.decode(self.source_encoding)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 6 ]
[ "FunctionDef'", "Docstring", "Expr'", "Assign'", "Expr'", "Expr'", "Condition", "Return'", "Return'" ]
[ "def FUNC_1(VAR_0):...\n", "VAR_0.update({field: str(value) for field, value in VAR_0.items() if value is\n None})\n", "VAR_2 = ', '.join([str(field) for field in VAR_0.keys()])\n", "VAR_5 = list(VAR_0.values())\n", "return VAR_2, VAR_5\n" ]
[ "def preprocess_record(record):...\n", "record.update({field: str(value) for field, value in record.items() if \n value is None})\n", "field_names = ', '.join([str(field) for field in record.keys()])\n", "data = list(record.values())\n", "return field_names, data\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_15(self, VAR_22):...\n", "VAR_38 = urlparse.urlparse(self._url_prefix)\n", "VAR_22 = ('/%s/%s' % (VAR_38.path, VAR_22)).replace('//', '/').strip('/')\n", "if VAR_38.netloc:\n", "VAR_22 = '%s/%s' % (VAR_38.netloc, VAR_22)\n", "if VAR_38.scheme:\n", "VAR_22 = '%s://%s' % (VAR_38.scheme, VAR_22)\n", "return VAR_22\n" ]
[ "def _build_url(self, uri):...\n", "prefix = urlparse.urlparse(self._url_prefix)\n", "uri = ('/%s/%s' % (prefix.path, uri)).replace('//', '/').strip('/')\n", "if prefix.netloc:\n", "uri = '%s/%s' % (prefix.netloc, uri)\n", "if prefix.scheme:\n", "uri = '%s://%s' % (prefix.scheme, uri)\n", "return uri\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Return'" ]
[ "@handler.unsupported_on_local_server...\n", "\"\"\"docstring\"\"\"\n", "self.render('login.html', {'apiKey': local_config.ProjectConfig().get(\n 'firebase.api_key'), 'authDomain': auth.auth_domain(), 'dest': self.\n request.get('dest')})\n" ]
[ "@handler.unsupported_on_local_server...\n", "\"\"\"docstring\"\"\"\n", "self.render('login.html', {'apiKey': local_config.ProjectConfig().get(\n 'firebase.api_key'), 'authDomain': auth.auth_domain(), 'dest': self.\n request.get('dest')})\n" ]
[ 0, 0, 3 ]
[ "Condition", "Docstring", "Expr'" ]
[ "def FUNC_2(self):...\n", "return {'XSS': self.payload}\n" ]
[ "def signature(self):...\n", "return {'XSS': self.payload}\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "\"\"\"string\"\"\"\n", "import argparse\n", "import importlib\n", "import os\n", "import sys\n", "from parlai.core.agents import get_agent_module, get_task_module\n", "from parlai.tasks.tasks import ids_to_tasks\n", "def FUNC_0(VAR_0):...\n", "VAR_3 = VAR_0.lower()\n", "if VAR_3 in ('yes', 'true', 't', '1', 'y'):\n", "return True\n", "if VAR_3 in ('no', 'false', 'f', 'n', '0'):\n", "return False\n", "def FUNC_1(VAR_0):...\n", "\"\"\"docstring\"\"\"\n", "if ':' not in VAR_0:\n", "VAR_4 = VAR_0.split(':')\n", "VAR_5 = importlib.import_module(VAR_4[0])\n", "return getattr(VAR_5, VAR_4[1])\n" ]
[ "\"\"\"Provides an argument parser and a set of default command line options for\nusing the ParlAI package.\n\"\"\"\n", "import argparse\n", "import importlib\n", "import os\n", "import sys\n", "from parlai.core.agents import get_agent_module, get_task_module\n", "from parlai.tasks.tasks import ids_to_tasks\n", "def str2bool(value):...\n", "v = value.lower()\n", "if v in ('yes', 'true', 't', '1', 'y'):\n", "return True\n", "if v in ('no', 'false', 'f', 'n', '0'):\n", "return False\n", "def str2class(value):...\n", "\"\"\"docstring\"\"\"\n", "if ':' not in value:\n", "name = value.split(':')\n", "module = importlib.import_module(name[0])\n", "return getattr(module, name[1])\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Expr'", "Import'", "Import'", "Import'", "Import'", "ImportFrom'", "ImportFrom'", "FunctionDef'", "Assign'", "Condition", "Return'", "Condition", "Return'", "FunctionDef'", "Docstring", "Condition", "Assign'", "Assign'", "Return'" ]
[ "@property...\n", "VAR_15 = '%s@%s:%s%s ' % ('user', 'oms', self._cwd(), '#')\n", "return [VAR_15, '... ']\n" ]
[ "@property...\n", "ps1 = '%s@%s:%s%s ' % ('user', 'oms', self._cwd(), '#')\n", "return [ps1, '... ']\n" ]
[ 0, 0, 0 ]
[ "Condition", "Assign'", "Return'" ]
[ "\"\"\"string\"\"\"\n", "import config\n", "from photogpsbot import bot, log, db\n", "from photogpsbot.db_connector import DatabaseError, DatabaseConnectionError\n", "from telebot.types import Message\n", "\"\"\"string\"\"\"\n", "def __init__(self, VAR_0, VAR_1, VAR_2, VAR_3, VAR_4='en-US'):...\n", "self.chat_id = VAR_0\n", "self.first_name = VAR_1\n", "self.nickname = VAR_2\n", "self.last_name = VAR_3\n", "self.language = VAR_4\n", "def FUNC_0(self, VAR_5):...\n", "\"\"\"docstring\"\"\"\n", "log.debug('Updating info about user %s language in memory & database...', self)\n", "self.language = VAR_5\n", "VAR_10 = (\n f\"UPDATE users SET language='{self.language}' WHERE chat_id='{self.chat_id}'\"\n )\n", "db.add(VAR_10)\n", "log.error(\"Can't add new language of %s to the database\", self)\n", "log.debug('Language updated.')\n", "def FUNC_1(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_11 = self.language\n", "VAR_12 = 'ru-RU' if self.language == 'en-US' else 'en-US'\n", "log.info('Changing user %s language from %s to %s...', self, VAR_11, VAR_12)\n", "self.set_language(VAR_12)\n", "return VAR_12\n" ]
[ "\"\"\"\nModule to manage users of bot: store and update information, interact with\nthe database, keep tack of and switch language of interface for user\n\"\"\"\n", "import config\n", "from photogpsbot import bot, log, db\n", "from photogpsbot.db_connector import DatabaseError, DatabaseConnectionError\n", "from telebot.types import Message\n", "\"\"\"\n Class that describes one user of this Telegram bot and helps to store basic\n info about him and his language of choice for interface of the bot\n \"\"\"\n", "def __init__(self, chat_id, first_name, nickname, last_name, language='en-US'):...\n", "self.chat_id = chat_id\n", "self.first_name = first_name\n", "self.nickname = nickname\n", "self.last_name = last_name\n", "self.language = language\n", "def set_language(self, lang):...\n", "\"\"\"docstring\"\"\"\n", "log.debug('Updating info about user %s language in memory & database...', self)\n", "self.language = lang\n", "query = (\n f\"UPDATE users SET language='{self.language}' WHERE chat_id='{self.chat_id}'\"\n )\n", "db.add(query)\n", "log.error(\"Can't add new language of %s to the database\", self)\n", "log.debug('Language updated.')\n", "def switch_language(self):...\n", "\"\"\"docstring\"\"\"\n", "curr_lang = self.language\n", "new_lang = 'ru-RU' if self.language == 'en-US' else 'en-US'\n", "log.info('Changing user %s language from %s to %s...', self, curr_lang,\n new_lang)\n", "self.set_language(new_lang)\n", "return new_lang\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Expr'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Expr'", "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "FunctionDef'", "Docstring", "Expr'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "FunctionDef'", "Docstring", "Assign'", "Assign'", "Expr'", "Expr'", "Return'" ]
[ "def FUNC_5(self):...\n", "VAR_24 = 'katotest-httplb-' + self.test_id\n", "self.__use_http_lb_name = VAR_24\n", "self.__use_http_lb_hc_name = VAR_24 + '-health-check'\n", "self.__use_http_lb_bs_name = VAR_24 + '-backend-service'\n", "self.__use_http_lb_fr_name = VAR_24\n", "self.__use_http_lb_map_name = VAR_24 + '-url-map'\n", "self.__use_http_lb_proxy_name = VAR_24 + '-target-http-proxy'\n", "VAR_25 = 231\n", "VAR_26 = 8\n", "VAR_27 = 9\n", "VAR_28 = 65\n", "VAR_29 = '/hello/world'\n", "VAR_30 = '80-80'\n", "VAR_31 = {'checkIntervalSec': VAR_25, 'healthyThreshold': VAR_26,\n 'unhealthyThreshold': VAR_27, 'timeoutSec': VAR_28, 'requestPath': VAR_29}\n", "VAR_21 = self.agent.type_to_payload('createGoogleHttpLoadBalancerDescription',\n {'healthCheck': VAR_31, 'portRange': VAR_30, 'loadBalancerName': VAR_24,\n 'credentials': self.bindings['GCE_CREDENTIALS']})\n", "VAR_20 = gcp.GceContractBuilder(self.gce_observer)\n", "VAR_20.new_clause_builder('Http Health Check Added').list_resources(\n 'http-health-checks').contains_pred_list([jc.PathContainsPredicate(\n 'name', self.__use_http_lb_hc_name), jc.PathContainsPredicate(None,\n VAR_31)])\n", "VAR_20.new_clause_builder('Forwarding Rule Added', retryable_for_secs=15\n ).list_resources('forwarding-rules').contains_pred_list([jc.\n PathContainsPredicate('name', self.__use_http_lb_fr_name), jc.\n PathContainsPredicate('portRange', VAR_30)])\n", "VAR_20.new_clause_builder('Backend Service Added').list_resources(\n 'backend-services').contains_pred_list([jc.PathContainsPredicate('name',\n self.__use_http_lb_bs_name), jc.PathElementsContainPredicate(\n 'healthChecks', self.__use_http_lb_hc_name)])\n", "VAR_20.new_clause_builder('Url Map Added').list_resources('url-maps'\n ).contains_pred_list([jc.PathContainsPredicate('name', self.\n __use_http_lb_map_name), jc.PathContainsPredicate('defaultService',\n self.__use_http_lb_bs_name)])\n", "VAR_20.new_clause_builder('Target Http Proxy Added').list_resources(\n 'target-http-proxies').contains_pred_list([jc.PathContainsPredicate(\n 'name', self.__use_http_lb_proxy_name), jc.PathContainsPredicate(\n 'urlMap', self.__use_http_lb_map_name)])\n", "return st.OperationContract(self.new_post_operation(title=\n 'create_http_load_balancer', data=payload, VAR_29='ops'), contract=\n builder.build())\n" ]
[ "def create_http_load_balancer(self):...\n", "logical_http_lb_name = 'katotest-httplb-' + self.test_id\n", "self.__use_http_lb_name = logical_http_lb_name\n", "self.__use_http_lb_hc_name = logical_http_lb_name + '-health-check'\n", "self.__use_http_lb_bs_name = logical_http_lb_name + '-backend-service'\n", "self.__use_http_lb_fr_name = logical_http_lb_name\n", "self.__use_http_lb_map_name = logical_http_lb_name + '-url-map'\n", "self.__use_http_lb_proxy_name = logical_http_lb_name + '-target-http-proxy'\n", "interval = 231\n", "healthy = 8\n", "unhealthy = 9\n", "timeout = 65\n", "path = '/hello/world'\n", "port_range = '80-80'\n", "health_check = {'checkIntervalSec': interval, 'healthyThreshold': healthy,\n 'unhealthyThreshold': unhealthy, 'timeoutSec': timeout, 'requestPath': path\n }\n", "payload = self.agent.type_to_payload('createGoogleHttpLoadBalancerDescription',\n {'healthCheck': health_check, 'portRange': port_range,\n 'loadBalancerName': logical_http_lb_name, 'credentials': self.bindings[\n 'GCE_CREDENTIALS']})\n", "builder = gcp.GceContractBuilder(self.gce_observer)\n", "builder.new_clause_builder('Http Health Check Added').list_resources(\n 'http-health-checks').contains_pred_list([jc.PathContainsPredicate(\n 'name', self.__use_http_lb_hc_name), jc.PathContainsPredicate(None,\n health_check)])\n", "builder.new_clause_builder('Forwarding Rule Added', retryable_for_secs=15\n ).list_resources('forwarding-rules').contains_pred_list([jc.\n PathContainsPredicate('name', self.__use_http_lb_fr_name), jc.\n PathContainsPredicate('portRange', port_range)])\n", "builder.new_clause_builder('Backend Service Added').list_resources(\n 'backend-services').contains_pred_list([jc.PathContainsPredicate('name',\n self.__use_http_lb_bs_name), jc.PathElementsContainPredicate(\n 'healthChecks', self.__use_http_lb_hc_name)])\n", "builder.new_clause_builder('Url Map Added').list_resources('url-maps'\n ).contains_pred_list([jc.PathContainsPredicate('name', self.\n __use_http_lb_map_name), jc.PathContainsPredicate('defaultService',\n self.__use_http_lb_bs_name)])\n", "builder.new_clause_builder('Target Http Proxy Added').list_resources(\n 'target-http-proxies').contains_pred_list([jc.PathContainsPredicate(\n 'name', self.__use_http_lb_proxy_name), jc.PathContainsPredicate(\n 'urlMap', self.__use_http_lb_map_name)])\n", "return st.OperationContract(self.new_post_operation(title=\n 'create_http_load_balancer', data=payload, path='ops'), contract=\n builder.build())\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Return'" ]
[ "from __future__ import absolute_import\n", "from twisted.internet import reactor\n", "from twisted.internet.defer import inlineCallbacks, maybeDeferred\n", "from twisted.web.server import Site\n", "from twisted.web.util import Redirect\n", "from Tribler.Core.Utilities.network_utils import get_random_port\n", "from Tribler.Core.Utilities.utilities import http_get, is_valid_url, parse_magnetlink\n", "from Tribler.Test.test_as_server import AbstractServer\n", "from Tribler.Test.tools import trial_timeout\n", "def __init__(self, *VAR_0, **VAR_1):...\n", "super(CLASS_0, self).__init__(*VAR_0, **kwargs)\n", "self.http_server = None\n", "def FUNC_0(self, VAR_2, VAR_3):...\n", "self.http_server = reactor.listenTCP(VAR_2, Site(Redirect(VAR_3)))\n", "@inlineCallbacks...\n", "if self.http_server:\n", "yield maybeDeferred(self.http_server.stopListening)\n", "yield super(CLASS_0, self).tearDown()\n", "def FUNC_2(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_4, VAR_5, VAR_4 = parse_magnetlink(\n 'magnet:?xt=urn:btih:apctqfwnowubxzoidazgaj2ba6fs6juc')\n", "self.assertEqual(VAR_5, \"\\x03Å8\\x16Íu¨\\x1båÈ\\x182`'A\\x07\\x8b/&\\x82\")\n", "def FUNC_3(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_4, VAR_5, VAR_4 = parse_magnetlink(\n 'magnet:?xt=urn:btih:APCTQFWNOWUBXZOIDAZGAJ2BA6FS6JUC')\n", "self.assertEqual(VAR_5, \"\\x03Å8\\x16Íu¨\\x1båÈ\\x182`'A\\x07\\x8b/&\\x82\")\n", "def FUNC_4(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_6 = 'http://anno nce.torrentsmd.com:8080/announce'\n", "self.assertFalse(is_valid_url(VAR_6), '%s is not a valid URL' % VAR_6)\n", "VAR_7 = 'http://announce.torrentsmd.com:8080/announce '\n", "self.assertTrue(is_valid_url(VAR_7), '%s is a valid URL' % VAR_7)\n", "VAR_8 = 'http://localhost:1920/announce'\n", "self.assertTrue(is_valid_url(VAR_8))\n", "VAR_9 = 'udp://localhost:1264'\n", "self.assertTrue(is_valid_url(VAR_9))\n", "@trial_timeout(5)...\n", "\"\"\"docstring\"\"\"\n", "def FUNC_6(VAR_10):...\n", "self.assertEqual(VAR_10, VAR_11)\n", "VAR_11 = 'magnet:?xt=urn:btih:DC4B96CF85A85CEEDB8ADC4B96CF85A85CEEDB8A'\n", "VAR_2 = get_random_port()\n", "self.setUpHttpRedirectServer(VAR_2, VAR_11)\n", "VAR_6 = 'http://localhost:%d' % VAR_2\n", "VAR_12 = http_get(VAR_6).addCallback(FUNC_6)\n", "return VAR_12\n" ]
[ "from __future__ import absolute_import\n", "from twisted.internet import reactor\n", "from twisted.internet.defer import inlineCallbacks, maybeDeferred\n", "from twisted.web.server import Site\n", "from twisted.web.util import Redirect\n", "from Tribler.Core.Utilities.network_utils import get_random_port\n", "from Tribler.Core.Utilities.utilities import http_get, is_valid_url, parse_magnetlink\n", "from Tribler.Test.test_as_server import AbstractServer\n", "from Tribler.Test.tools import trial_timeout\n", "def __init__(self, *argv, **kwargs):...\n", "super(TestMakeTorrent, self).__init__(*argv, **kwargs)\n", "self.http_server = None\n", "def setUpHttpRedirectServer(self, port, redirect_url):...\n", "self.http_server = reactor.listenTCP(port, Site(Redirect(redirect_url)))\n", "@inlineCallbacks...\n", "if self.http_server:\n", "yield maybeDeferred(self.http_server.stopListening)\n", "yield super(TestMakeTorrent, self).tearDown()\n", "def test_parse_magnetlink_lowercase(self):...\n", "\"\"\"docstring\"\"\"\n", "_, hashed, _ = parse_magnetlink(\n 'magnet:?xt=urn:btih:apctqfwnowubxzoidazgaj2ba6fs6juc')\n", "self.assertEqual(hashed, \"\\x03Å8\\x16Íu¨\\x1båÈ\\x182`'A\\x07\\x8b/&\\x82\")\n", "def test_parse_magnetlink_uppercase(self):...\n", "\"\"\"docstring\"\"\"\n", "_, hashed, _ = parse_magnetlink(\n 'magnet:?xt=urn:btih:APCTQFWNOWUBXZOIDAZGAJ2BA6FS6JUC')\n", "self.assertEqual(hashed, \"\\x03Å8\\x16Íu¨\\x1båÈ\\x182`'A\\x07\\x8b/&\\x82\")\n", "def test_valid_url(self):...\n", "\"\"\"docstring\"\"\"\n", "test_url = 'http://anno nce.torrentsmd.com:8080/announce'\n", "self.assertFalse(is_valid_url(test_url), '%s is not a valid URL' % test_url)\n", "test_url2 = 'http://announce.torrentsmd.com:8080/announce '\n", "self.assertTrue(is_valid_url(test_url2), '%s is a valid URL' % test_url2)\n", "test_url3 = 'http://localhost:1920/announce'\n", "self.assertTrue(is_valid_url(test_url3))\n", "test_url4 = 'udp://localhost:1264'\n", "self.assertTrue(is_valid_url(test_url4))\n", "@trial_timeout(5)...\n", "\"\"\"docstring\"\"\"\n", "def on_callback(response):...\n", "self.assertEqual(response, magnet_link)\n", "magnet_link = 'magnet:?xt=urn:btih:DC4B96CF85A85CEEDB8ADC4B96CF85A85CEEDB8A'\n", "port = get_random_port()\n", "self.setUpHttpRedirectServer(port, magnet_link)\n", "test_url = 'http://localhost:%d' % port\n", "http_deferred = http_get(test_url).addCallback(on_callback)\n", "return http_deferred\n" ]
[ 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "FunctionDef'", "Expr'", "Assign'", "FunctionDef'", "Assign'", "Condition", "Condition", "Expr'", "Expr'", "FunctionDef'", "Docstring", "Assign'", "Expr'", "FunctionDef'", "Docstring", "Assign'", "Expr'", "FunctionDef'", "Docstring", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "Condition", "Docstring", "FunctionDef'", "Expr'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Return'" ]
[ "def __init__(self, VAR_9, VAR_10=None, VAR_11=None, **VAR_12):...\n", "for attr in self.config_attrs:\n", "if VAR_12:\n", "VAR_34 = VAR_12.pop(attr)\n", "VAR_34 = decode_if_byte_string(VAR_34)\n", "self.media_types = MediaTypes(extra_types=self.mimetypes)\n", "setattr(self, attr, VAR_34)\n", "self.application = VAR_9\n", "self.files = {}\n", "self.directories = []\n", "if self.index_file is True:\n", "self.index_file = 'index.html'\n", "if not callable(self.immutable_file_test):\n", "VAR_26 = re.compile(self.immutable_file_test)\n", "if VAR_10 is not None:\n", "self.immutable_file_test = lambda VAR_17, VAR_16: bool(VAR_26.search(VAR_16))\n", "self.add_files(VAR_10, VAR_11)\n" ]
[ "def __init__(self, application, root=None, prefix=None, **kwargs):...\n", "for attr in self.config_attrs:\n", "if kwargs:\n", "value = kwargs.pop(attr)\n", "value = decode_if_byte_string(value)\n", "self.media_types = MediaTypes(extra_types=self.mimetypes)\n", "setattr(self, attr, value)\n", "self.application = application\n", "self.files = {}\n", "self.directories = []\n", "if self.index_file is True:\n", "self.index_file = 'index.html'\n", "if not callable(self.immutable_file_test):\n", "regex = re.compile(self.immutable_file_test)\n", "if root is not None:\n", "self.immutable_file_test = lambda path, url: bool(regex.search(url))\n", "self.add_files(root, prefix)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "For", "Condition", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Expr'" ]
[ "@api.onchange('lastname', 'firstname', 'zip', 'email')...\n", "if (self.lastname and self.firstname and self.zip or self.email\n", "VAR_64 = self.search([('id', '!=', self._origin.id), '|', '&', ('email',\n '=', self.email), ('email', '!=', False), '&', '&', ('firstname',\n 'ilike', self.firstname), ('lastname', 'ilike', self.lastname), ('zip',\n '=', self.zip)])\n", "if VAR_64:\n", "self.partner_duplicate_ids = VAR_64\n", "VAR_75 = api.Environment(new_cr, self.env.uid, {})\n", "self._origin.with_env(VAR_75).write({'partner_duplicate_ids': [(6, 0,\n VAR_64.ids)]})\n", "return {'warning': {'title': _('Possible existing partners found'),\n 'message': _('string')}}\n" ]
[ "@api.onchange('lastname', 'firstname', 'zip', 'email')...\n", "if (self.lastname and self.firstname and self.zip or self.email\n", "partner_duplicates = self.search([('id', '!=', self._origin.id), '|', '&',\n ('email', '=', self.email), ('email', '!=', False), '&', '&', (\n 'firstname', 'ilike', self.firstname), ('lastname', 'ilike', self.\n lastname), ('zip', '=', self.zip)])\n", "if partner_duplicates:\n", "self.partner_duplicate_ids = partner_duplicates\n", "new_env = api.Environment(new_cr, self.env.uid, {})\n", "self._origin.with_env(new_env).write({'partner_duplicate_ids': [(6, 0,\n partner_duplicates.ids)]})\n", "return {'warning': {'title': _('Possible existing partners found'),\n 'message': _(\n 'The partner you want to add may already exist. Please use the \"Check duplicates\" button to review it.'\n )}}\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Condition", "Assign'", "Condition", "Assign'", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_17(VAR_25):...\n", "def FUNC_21(VAR_55):...\n", "@wraps(VAR_55)...\n", "VAR_70['timer'] = CLASS_2(VAR_25)\n", "return VAR_55(*VAR_69, **kwargs)\n" ]
[ "def time_request(name):...\n", "def decorator(func):...\n", "@wraps(func)...\n", "kwargs['timer'] = Timer(name)\n", "return func(*args, **kwargs)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "FunctionDef'", "Condition", "Assign'", "Return'" ]
[ "def __ne__(self, VAR_1):...\n", "return not self.__eq__(VAR_1)\n" ]
[ "def __ne__(self, other):...\n", "return not self.__eq__(other)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_23(self, VAR_21, VAR_27, VAR_28):...\n", "\"\"\"docstring\"\"\"\n", "VAR_57 = self.getfile(VAR_21)\n", "if VAR_57 == False:\n", "if VAR_27 != -1:\n", "VAR_57[VAR_3] = VAR_27\n", "if VAR_28 != -1:\n", "VAR_57[VAR_4] = VAR_28\n" ]
[ "def chown(self, path, uid, gid):...\n", "\"\"\"docstring\"\"\"\n", "p = self.getfile(path)\n", "if p == False:\n", "if uid != -1:\n", "p[A_UID] = uid\n", "if gid != -1:\n", "p[A_GID] = gid\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Condition", "Condition", "Assign'", "Condition", "Assign'" ]
[ "def FUNC_45(VAR_25, VAR_39):...\n", "if self.parentfield:\n", "return '{} #{}: {}: {}'.format(_('Row'), self.idx, _(VAR_25.label), VAR_39)\n", "return '{}: {}'.format(_(VAR_25.label), VAR_39)\n" ]
[ "def get_msg(df, docname):...\n", "if self.parentfield:\n", "return '{} #{}: {}: {}'.format(_('Row'), self.idx, _(df.label), docname)\n", "return '{}: {}'.format(_(df.label), docname)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Return'" ]
[ "def FUNC_49(self):...\n", "for VAR_14 in self.list_columns.keys():\n", "if self.is_pk(VAR_14):\n", "return VAR_14\n" ]
[ "def get_pk_name(self):...\n", "for col_name in self.list_columns.keys():\n", "if self.is_pk(col_name):\n", "return col_name\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "For", "Condition", "Return'" ]
[ "@api.route('/songs/<int:id>')...\n", "VAR_2 = Song.query.filter_by(VAR_1=id).first()\n", "if not VAR_2:\n", "return route_not_found(VAR_2)\n", "return make_response(jsonify(VAR_2.to_json()), 200)\n" ]
[ "@api.route('/songs/<int:id>')...\n", "song = Song.query.filter_by(id=id).first()\n", "if not song:\n", "return route_not_found(song)\n", "return make_response(jsonify(song.to_json()), 200)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Condition", "Return'", "Return'" ]
[ "def __init__(self, VAR_1=None):...\n", "self.options = VAR_1\n" ]
[ "def __init__(self, options=None):...\n", "self.options = options\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Assign'" ]
[ "def FUNC_10(VAR_27, VAR_28, VAR_18):...\n", "VAR_40 = ''\n", "VAR_41 = ''\n", "VAR_42 = ''\n", "VAR_43 = ''\n", "VAR_19 = ''\n", "VAR_20 = ''\n", "VAR_36 = datetime.utcfromtimestamp(VAR_27.created_utc)\n", "VAR_14 = str(VAR_27.author)\n", "VAR_44 = FUNC_2(VAR_14=username, VAR_15='send', VAR_18=comment_or_message,\n VAR_23=message.id, VAR_25=message_time.strftime('%Y-%m-%d %H:%M:%S'),\n VAR_26=str(message.body)[:255])\n", "if len(VAR_28) >= 3:\n", "VAR_21 = VAR_28[1]\n", "if len(VAR_28) == 2:\n", "VAR_43 = VAR_28[2]\n", "VAR_32 = 'UPDATE history SET notes = %s WHERE id = %s'\n", "if VAR_28[1].lower() == 'nan' or 'inf' in VAR_28[1].lower():\n", "VAR_33 = 'could not find tip amount', VAR_44\n", "VAR_32 = 'UPDATE history SET notes = %s WHERE id = %s'\n", "VAR_21 = float(VAR_28[1])\n", "VAR_32 = 'UPDATE history SET notes = %s WHERE id = %s'\n", "if VAR_21 < VAR_10:\n", "VAR_13.execute(VAR_32, VAR_33)\n", "VAR_33 = 'could not parse amount', VAR_44\n", "VAR_33 = 'could not parse amount', VAR_44\n", "VAR_32 = 'UPDATE history SET notes = %s WHERE id = %s'\n", "VAR_13.execute(\n \"SELECT address, private_key FROM accounts WHERE username='%s'\" % VAR_14)\n", "VAR_12.commit()\n", "VAR_13.execute(VAR_32, VAR_33)\n", "VAR_13.execute(VAR_32, VAR_33)\n", "VAR_33 = 'amount below program limit', VAR_44\n", "VAR_34 = VAR_13.fetchall()\n", "return 'string'\n", "VAR_12.commit()\n", "VAR_12.commit()\n", "VAR_13.execute(VAR_32, VAR_33)\n", "if len(VAR_34) < 1:\n", "return \"Could not read your tip or send amount. Is '%s' a number?\" % VAR_28[1]\n", "return \"Could not read your tip or send amount. Is '%s' a number?\" % VAR_28[1]\n", "VAR_12.commit()\n", "VAR_32 = 'UPDATE history SET notes = %s WHERE id = %s'\n", "VAR_17 = VAR_34[0][0]\n", "return 'You must send amounts of Nano above the program limit of %s.' % VAR_10\n", "VAR_33 = 'sender does not have an account', VAR_44\n", "VAR_41 = VAR_34[0][1]\n", "VAR_13.execute(VAR_32, VAR_33)\n", "VAR_51 = check_balance(VAR_34[0][0])\n", "VAR_12.commit()\n", "if nano_to_raw(VAR_21) > VAR_51[0]:\n", "return 'string'\n", "VAR_32 = 'UPDATE history SET notes = %s WHERE id = %s'\n", "if len(VAR_28) == 2:\n", "VAR_33 = 'insufficient funds', VAR_44\n", "if VAR_18 == 'comment':\n", "if VAR_43[:3].lower() == '/u/':\n", "VAR_13.execute(VAR_32, VAR_33)\n", "VAR_43 = str(VAR_27.parent().author)\n", "VAR_32 = 'UPDATE history SET notes = %s, WHERE id = %s'\n", "VAR_43 = VAR_43[3:]\n", "if VAR_43[:5].lower() == 'nano_' or VAR_43[:4].lower() == 'xrb_':\n", "VAR_12.commit()\n", "VAR_33 = 'no recipient specified', VAR_44\n", "print(VAR_43)\n", "VAR_52 = validate_address(VAR_43)\n", "print(getattr(VAR_2.redditor(VAR_43), 'is_suspended', False))\n", "VAR_32 = 'UPDATE history SET notes = %s WHERE id = %s'\n", "VAR_45 = -1\n", "return 'string' % (VAR_51[0] / 10 ** 30, VAR_51[1] / 10 ** 30, VAR_21)\n", "VAR_13.execute(VAR_32, VAR_33)\n", "if VAR_52['valid'] == '1':\n", "VAR_40 = 'user'\n", "VAR_33 = 'redditor does not exist', VAR_44\n", "if VAR_40 == 'user':\n", "VAR_12.commit()\n", "VAR_40 = 'address'\n", "print(getattr(VAR_2.redditor(VAR_43), 'is_suspended', False))\n", "VAR_32 = 'UPDATE history SET notes = %s WHERE id = %s'\n", "VAR_13.execute(VAR_32, VAR_33)\n", "VAR_19 = VAR_43\n", "VAR_20 = VAR_43\n", "return 'You must specify an amount and a user.'\n", "VAR_40 = 'user'\n", "VAR_33 = 'invalid address or address-like redditor does not exist', VAR_44\n", "VAR_12.commit()\n", "VAR_32 = 'SELECT minimum, address FROM accounts WHERE username = %s'\n", "VAR_19 = FUNC_3(VAR_20)\n", "VAR_13.execute(VAR_32, VAR_33)\n", "return \"Could not find redditor %s. Make sure you aren't writing or copy/pasting markdown.\" % VAR_43\n", "VAR_33 = VAR_19,\n", "if VAR_19:\n", "VAR_12.commit()\n", "VAR_13.execute(VAR_32, VAR_33)\n", "VAR_32 = 'SELECT minimum, address FROM accounts WHERE username = %s'\n", "if VAR_45 >= 0 and VAR_20 and VAR_19:\n", "return '%s is neither a valid address or redditor' % VAR_43\n", "VAR_53 = VAR_13.fetchall()\n", "VAR_33 = VAR_19,\n", "if nano_to_raw(VAR_21) < VAR_45:\n", "if VAR_20:\n", "if len(VAR_53) > 0:\n", "VAR_13.execute(VAR_32, VAR_33)\n", "VAR_32 = 'UPDATE history SET notes = %s WHERE id = %s'\n", "if VAR_40 == 'user':\n", "VAR_32 = 'string'\n", "VAR_20 = FUNC_4(VAR_19)\n", "print(VAR_53[0])\n", "VAR_53 = VAR_13.fetchall()\n", "VAR_33 = 'below user minimum', VAR_44\n", "VAR_24 = 'sent to registered redditor'\n", "VAR_24 = 'sent to registered address'\n", "VAR_33 = 'sent to unregistered address', VAR_17, VAR_14, VAR_20, str(\n nano_to_raw(VAR_21)), VAR_44\n", "VAR_37 = VAR_2.redditor(VAR_19).message(\n 'Congrats on receiving your first Nano Tip!', 'string' % (VAR_21,\n VAR_20) + VAR_1)\n", "VAR_45 = int(VAR_53[0][0])\n", "print(VAR_53[0])\n", "VAR_13.execute(VAR_32, VAR_33)\n", "VAR_54 = check_balance(VAR_20)\n", "VAR_13.execute(VAR_32, VAR_33)\n", "VAR_32 = 'string'\n", "VAR_20 = VAR_53[0][1]\n", "VAR_45 = float(VAR_53[0][0])\n", "VAR_12.commit()\n", "VAR_32 = 'string'\n", "VAR_12.commit()\n", "VAR_33 = 'new user created', VAR_17, VAR_14, VAR_19, VAR_20, str(nano_to_raw\n (VAR_21)), VAR_44\n", "return 'Sorry, the user has set a tip minimum of %s. Your tip of %s is below this amount.' % (\n VAR_45 / 10 ** 30, VAR_21)\n", "VAR_33 = VAR_24, VAR_17, VAR_14, VAR_19, VAR_20, str(nano_to_raw(VAR_21)\n ), VAR_44\n", "print('Sending Unregistered Address: ', VAR_17, VAR_41, nano_to_raw(VAR_21),\n VAR_20)\n", "VAR_13.execute(VAR_32, VAR_33)\n", "VAR_13.execute(VAR_32, VAR_33)\n", "VAR_55 = send(VAR_17, VAR_41, nano_to_raw(VAR_21), VAR_20)\n", "VAR_12.commit()\n", "VAR_12.commit()\n", "print('Hash: ', VAR_55)\n", "VAR_55 = send(VAR_17, VAR_41, nano_to_raw(VAR_21), VAR_20)\n", "print('Sending Nano: ', VAR_17, VAR_41, nano_to_raw(VAR_21), VAR_20, VAR_19)\n", "VAR_32 = 'UPDATE history SET hash = %s WHERE id = %s'\n", "print('Hash: ', VAR_55)\n", "VAR_55 = send(VAR_17, VAR_41, nano_to_raw(VAR_21), VAR_20)\n", "VAR_33 = VAR_55['hash'], VAR_44\n", "VAR_32 = 'UPDATE history SET hash = %s WHERE id = %s'\n", "print('Hash: ', VAR_55)\n", "VAR_13.execute(VAR_32, VAR_33)\n", "VAR_33 = VAR_55['hash'], VAR_44\n", "VAR_32 = 'UPDATE history SET hash = %s WHERE id = %s'\n", "VAR_12.commit()\n", "VAR_13.execute(VAR_32, VAR_33)\n", "VAR_33 = VAR_55['hash'], VAR_44\n", "return 'Sent %s Nano to address %s.' % (VAR_21, VAR_20)\n", "VAR_12.commit()\n", "VAR_13.execute(VAR_32, VAR_33)\n", "print('Sending New Account Address: ', VAR_17, VAR_41, nano_to_raw(VAR_21),\n VAR_20, VAR_19)\n", "VAR_12.commit()\n", "return 'Creating a new account for %s and sending %s Nano.' % (VAR_19, VAR_21)\n", "VAR_37 = VAR_2.redditor(VAR_19).message('You just received a new Nano tip!',\n 'string' % (VAR_21, VAR_20, VAR_54[0] / 10 ** 30, VAR_54[1] / 10 ** 30 +\n VAR_21))\n", "if VAR_40 == 'user':\n", "return 'Sent %s Nano to %s.' % (VAR_21, VAR_19)\n", "return 'Sent %s Nano to %s.' % (VAR_21, VAR_20)\n" ]
[ "def handle_send_nano(message, parsed_text, comment_or_message):...\n", "user_or_address = ''\n", "private_key = ''\n", "adrress = ''\n", "recipient = ''\n", "recipient_username = ''\n", "recipient_address = ''\n", "message_time = datetime.utcfromtimestamp(message.created_utc)\n", "username = str(message.author)\n", "entry_id = add_history_record(username=username, action='send',\n comment_or_message=comment_or_message, comment_id=message.id,\n reddit_time=message_time.strftime('%Y-%m-%d %H:%M:%S'), comment_text=\n str(message.body)[:255])\n", "if len(parsed_text) >= 3:\n", "amount = parsed_text[1]\n", "if len(parsed_text) == 2:\n", "recipient = parsed_text[2]\n", "sql = 'UPDATE history SET notes = %s WHERE id = %s'\n", "if parsed_text[1].lower() == 'nan' or 'inf' in parsed_text[1].lower():\n", "val = 'could not find tip amount', entry_id\n", "sql = 'UPDATE history SET notes = %s WHERE id = %s'\n", "amount = float(parsed_text[1])\n", "sql = 'UPDATE history SET notes = %s WHERE id = %s'\n", "if amount < program_minimum:\n", "mycursor.execute(sql, val)\n", "val = 'could not parse amount', entry_id\n", "val = 'could not parse amount', entry_id\n", "sql = 'UPDATE history SET notes = %s WHERE id = %s'\n", "mycursor.execute(\n \"SELECT address, private_key FROM accounts WHERE username='%s'\" % username)\n", "mydb.commit()\n", "mycursor.execute(sql, val)\n", "mycursor.execute(sql, val)\n", "val = 'amount below program limit', entry_id\n", "result = mycursor.fetchall()\n", "return 'Could not read your tip or send command, or find an amount. Be sure the amount and recipient are separated by a space.'\n", "mydb.commit()\n", "mydb.commit()\n", "mycursor.execute(sql, val)\n", "if len(result) < 1:\n", "return \"Could not read your tip or send amount. Is '%s' a number?\" % parsed_text[\n 1]\n", "return \"Could not read your tip or send amount. Is '%s' a number?\" % parsed_text[\n 1]\n", "mydb.commit()\n", "sql = 'UPDATE history SET notes = %s WHERE id = %s'\n", "address = result[0][0]\n", "return 'You must send amounts of Nano above the program limit of %s.' % program_minimum\n", "val = 'sender does not have an account', entry_id\n", "private_key = result[0][1]\n", "mycursor.execute(sql, val)\n", "results = check_balance(result[0][0])\n", "mydb.commit()\n", "if nano_to_raw(amount) > results[0]:\n", "return \"You do not have a tip bot account yet. To create one, send me a PM containing the text 'create' in the message body, or get a tip from a fellow redditor!.\"\n", "sql = 'UPDATE history SET notes = %s WHERE id = %s'\n", "if len(parsed_text) == 2:\n", "val = 'insufficient funds', entry_id\n", "if comment_or_message == 'comment':\n", "if recipient[:3].lower() == '/u/':\n", "mycursor.execute(sql, val)\n", "recipient = str(message.parent().author)\n", "sql = 'UPDATE history SET notes = %s, WHERE id = %s'\n", "recipient = recipient[3:]\n", "if recipient[:5].lower() == 'nano_' or recipient[:4].lower() == 'xrb_':\n", "mydb.commit()\n", "val = 'no recipient specified', entry_id\n", "print(recipient)\n", "success = validate_address(recipient)\n", "print(getattr(reddit.redditor(recipient), 'is_suspended', False))\n", "sql = 'UPDATE history SET notes = %s WHERE id = %s'\n", "user_minimum = -1\n", "return 'You have insufficient funds. Your account has %s pocketed (+%s unpocketed) and you are trying to send %s. If you have unpocketed funds, create a new message containing the text \"receive\" to pocket your incoming money.' % (\n results[0] / 10 ** 30, results[1] / 10 ** 30, amount)\n", "mycursor.execute(sql, val)\n", "if success['valid'] == '1':\n", "user_or_address = 'user'\n", "val = 'redditor does not exist', entry_id\n", "if user_or_address == 'user':\n", "mydb.commit()\n", "user_or_address = 'address'\n", "print(getattr(reddit.redditor(recipient), 'is_suspended', False))\n", "sql = 'UPDATE history SET notes = %s WHERE id = %s'\n", "mycursor.execute(sql, val)\n", "recipient_username = recipient\n", "recipient_address = recipient\n", "return 'You must specify an amount and a user.'\n", "user_or_address = 'user'\n", "val = 'invalid address or address-like redditor does not exist', entry_id\n", "mydb.commit()\n", "sql = 'SELECT minimum, address FROM accounts WHERE username = %s'\n", "recipient_username = check_registered_by_address(recipient_address)\n", "mycursor.execute(sql, val)\n", "return \"Could not find redditor %s. Make sure you aren't writing or copy/pasting markdown.\" % recipient\n", "val = recipient_username,\n", "if recipient_username:\n", "mydb.commit()\n", "mycursor.execute(sql, val)\n", "sql = 'SELECT minimum, address FROM accounts WHERE username = %s'\n", "if user_minimum >= 0 and recipient_address and recipient_username:\n", "return '%s is neither a valid address or redditor' % recipient\n", "myresult = mycursor.fetchall()\n", "val = recipient_username,\n", "if nano_to_raw(amount) < user_minimum:\n", "if recipient_address:\n", "if len(myresult) > 0:\n", "mycursor.execute(sql, val)\n", "sql = 'UPDATE history SET notes = %s WHERE id = %s'\n", "if user_or_address == 'user':\n", "sql = (\n 'UPDATE history SET notes = %s, address = %s, username = %s, recipient_address = %s, amount = %s WHERE id = %s'\n )\n", "recipient_address = add_new_account(recipient_username)\n", "print(myresult[0])\n", "myresult = mycursor.fetchall()\n", "val = 'below user minimum', entry_id\n", "notes = 'sent to registered redditor'\n", "notes = 'sent to registered address'\n", "val = ('sent to unregistered address', address, username, recipient_address,\n str(nano_to_raw(amount)), entry_id)\n", "x = reddit.redditor(recipient_username).message(\n 'Congrats on receiving your first Nano Tip!', \n \"\"\"Welcome to Nano Tip Bot! You have just received a Nano tip in the amount of %s at your address of %s. Here is some boilerplate.\n\n\"\"\"\n % (amount, recipient_address) + help_text)\n", "user_minimum = int(myresult[0][0])\n", "print(myresult[0])\n", "mycursor.execute(sql, val)\n", "receiving_new_balance = check_balance(recipient_address)\n", "mycursor.execute(sql, val)\n", "sql = (\n 'UPDATE history SET notes = %s, address = %s, username = %s, recipient_username = %s, recipient_address = %s, amount = %s WHERE id = %s'\n )\n", "recipient_address = myresult[0][1]\n", "user_minimum = float(myresult[0][0])\n", "mydb.commit()\n", "sql = (\n 'UPDATE history SET notes = %s, address = %s, username = %s, recipient_username = %s, recipient_address = %s, amount = %s WHERE id = %s'\n )\n", "mydb.commit()\n", "val = ('new user created', address, username, recipient_username,\n recipient_address, str(nano_to_raw(amount)), entry_id)\n", "return 'Sorry, the user has set a tip minimum of %s. Your tip of %s is below this amount.' % (\n user_minimum / 10 ** 30, amount)\n", "val = notes, address, username, recipient_username, recipient_address, str(\n nano_to_raw(amount)), entry_id\n", "print('Sending Unregistered Address: ', address, private_key, nano_to_raw(\n amount), recipient_address)\n", "mycursor.execute(sql, val)\n", "mycursor.execute(sql, val)\n", "sent = send(address, private_key, nano_to_raw(amount), recipient_address)\n", "mydb.commit()\n", "mydb.commit()\n", "print('Hash: ', sent)\n", "sent = send(address, private_key, nano_to_raw(amount), recipient_address)\n", "print('Sending Nano: ', address, private_key, nano_to_raw(amount),\n recipient_address, recipient_username)\n", "sql = 'UPDATE history SET hash = %s WHERE id = %s'\n", "print('Hash: ', sent)\n", "sent = send(address, private_key, nano_to_raw(amount), recipient_address)\n", "val = sent['hash'], entry_id\n", "sql = 'UPDATE history SET hash = %s WHERE id = %s'\n", "print('Hash: ', sent)\n", "mycursor.execute(sql, val)\n", "val = sent['hash'], entry_id\n", "sql = 'UPDATE history SET hash = %s WHERE id = %s'\n", "mydb.commit()\n", "mycursor.execute(sql, val)\n", "val = sent['hash'], entry_id\n", "return 'Sent %s Nano to address %s.' % (amount, recipient_address)\n", "mydb.commit()\n", "mycursor.execute(sql, val)\n", "print('Sending New Account Address: ', address, private_key, nano_to_raw(\n amount), recipient_address, recipient_username)\n", "mydb.commit()\n", "return 'Creating a new account for %s and sending %s Nano.' % (\n recipient_username, amount)\n", "x = reddit.redditor(recipient_username).message(\n 'You just received a new Nano tip!', \n 'You have been tipped %s Nano at your address of %s. Your new account balance will be %s received and %s unpocketed.'\n % (amount, recipient_address, receiving_new_balance[0] / 10 ** 30, \n receiving_new_balance[1] / 10 ** 30 + amount))\n", "if user_or_address == 'user':\n", "return 'Sent %s Nano to %s.' % (amount, recipient_username)\n", "return 'Sent %s Nano to %s.' % (amount, recipient_address)\n" ]
[ 0, 4, 4, 4, 4, 4, 4, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 4, 0, 4, 0, 4, 0, 0, 4, 0, 0, 0, 4, 0, 4, 0, 0, 0, 4, 4, 0, 0, 0, 4, 4, 4, 4, 0, 0, 0, 4, 4, 0, 4, 4, 4, 4, 0, 4, 4, 4, 4, 0, 4, 4, 4, 0, 0, 4, 4, 0, 4, 0, 4, 4, 0, 4, 4, 0, 0, 4, 4, 4, 4, 4, 0, 4, 4, 0, 4, 4, 4, 0, 0, 0, 4, 4, 4, 0, 4, 4, 4, 0, 0, 0, 4, 4, 4, 0, 4, 4, 4, 4, 4, 4, 0, 0, 4, 0, 0, 4, 4, 0, 4, 0, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 4, 0, 0, 4, 0, 0, 4, 0, 0, 4, 4, 0, 0, 4, 0, 4, 4, 0, 4, 4 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Expr'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Assign'", "Assign'", "Return'", "Expr'", "Expr'", "Expr'", "Condition", "Return'", "Return'", "Expr'", "Assign'", "Assign'", "Return'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Condition", "Return'", "Assign'", "Condition", "Assign'", "Condition", "Condition", "Expr'", "Assign'", "Assign'", "Assign'", "Condition", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Assign'", "Return'", "Expr'", "Condition", "Assign'", "Assign'", "Condition", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Assign'", "Return'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'", "Return'", "Assign'", "Condition", "Expr'", "Expr'", "Assign'", "Condition", "Return'", "Assign'", "Assign'", "Condition", "Condition", "Condition", "Expr'", "Assign'", "Condition", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Return'", "Assign'", "Expr'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Assign'", "Assign'", "Expr'", "Expr'", "Assign'", "Return'", "Expr'", "Expr'", "Expr'", "Expr'", "Return'", "Assign'", "Condition", "Return'", "Return'" ]
[ "def FUNC_40(VAR_63=None):...\n", "VAR_81 = VAR_20.getWrittenData()\n", "if VAR_81:\n", "return FUNC_39(VAR_81)\n" ]
[ "def get_request_written_data(_=None):...\n", "written_data = request.getWrittenData()\n", "if written_data:\n", "return get_str(written_data)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Return'" ]
[ "@catch_bare_integrity_error...\n", "VAR_6 = get_json_request_body(self)\n", "if VAR_6.get('survey_id', None) != VAR_0:\n", "VAR_7 = validation_message('submission', 'survey_id', 'invalid')\n", "self.write(api.submission.submit(VAR_6))\n", "VAR_7 = validation_message('submission', str(e), 'missing_field')\n", "self.set_status(201)\n", "VAR_7 = validation_message('submission', 'question_id', 'invalid')\n" ]
[ "@catch_bare_integrity_error...\n", "data = get_json_request_body(self)\n", "if data.get('survey_id', None) != survey_id:\n", "reason = validation_message('submission', 'survey_id', 'invalid')\n", "self.write(api.submission.submit(data))\n", "reason = validation_message('submission', str(e), 'missing_field')\n", "self.set_status(201)\n", "reason = validation_message('submission', 'question_id', 'invalid')\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Condition", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'" ]
[ "def FUNC_8(self, VAR_10):...\n", "if isinstance(VAR_10, ndb.Model):\n", "VAR_28 = VAR_10.to_dict()\n", "if isinstance(VAR_10, datetime.datetime):\n", "VAR_28['id'] = VAR_10.key.id()\n", "return int((VAR_10 - self._EPOCH).total_seconds())\n", "if hasattr(VAR_10, 'to_dict'):\n", "return VAR_28\n", "return VAR_10.to_dict()\n", "if isinstance(VAR_10, cgi.FieldStorage):\n", "return str(VAR_10)\n" ]
[ "def default(self, obj):...\n", "if isinstance(obj, ndb.Model):\n", "dict_obj = obj.to_dict()\n", "if isinstance(obj, datetime.datetime):\n", "dict_obj['id'] = obj.key.id()\n", "return int((obj - self._EPOCH).total_seconds())\n", "if hasattr(obj, 'to_dict'):\n", "return dict_obj\n", "return obj.to_dict()\n", "if isinstance(obj, cgi.FieldStorage):\n", "return str(obj)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Condition", "Assign'", "Return'", "Condition", "Return'", "Return'", "Condition", "Return'" ]
[ "@wraps(VAR_6)...\n", "if 'logged_in' in VAR_10:\n", "return VAR_6(*VAR_8, **kwargs)\n", "flash('Unauthorized, Please login', 'danger')\n", "return redirect(url_for('login'))\n" ]
[ "@wraps(f)...\n", "if 'logged_in' in session:\n", "return f(*args, **kwargs)\n", "flash('Unauthorized, Please login', 'danger')\n", "return redirect(url_for('login'))\n" ]
[ 0, 0, 0, 0, 0 ]
[ "Condition", "Condition", "Return'", "Expr'", "Return'" ]
[ "def FUNC_22(self, VAR_16):...\n", "\"\"\"docstring\"\"\"\n", "if type(VAR_16) == str:\n", "VAR_16 = self.locate(VAR_16)\n", "VAR_54 = list()\n", "if not VAR_16:\n", "for VAR_18 in VAR_16.sub_items:\n", "return []\n", "VAR_66 = dict()\n", "return VAR_54\n", "VAR_66['file-name'] = VAR_18.file_name\n", "VAR_66['file-size'] = 0 if VAR_18.is_dir else VAR_3.st_uuid_idx[VAR_18.f_uuid\n ].size\n", "VAR_66['is-dir'] = VAR_18.is_dir\n", "VAR_66['owner'] = VAR_18.owner\n", "VAR_66['upload-time'] = VAR_18.upload_time\n", "VAR_54.append(VAR_66)\n" ]
[ "def listdir(self, path):...\n", "\"\"\"docstring\"\"\"\n", "if type(path) == str:\n", "path = self.locate(path)\n", "dirs = list()\n", "if not path:\n", "for item in path.sub_items:\n", "return []\n", "attrib = dict()\n", "return dirs\n", "attrib['file-name'] = item.file_name\n", "attrib['file-size'] = 0 if item.is_dir else FileStorage.st_uuid_idx[item.f_uuid\n ].size\n", "attrib['is-dir'] = item.is_dir\n", "attrib['owner'] = item.owner\n", "attrib['upload-time'] = item.upload_time\n", "dirs.append(attrib)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Assign'", "Assign'", "Condition", "For", "Return'", "Assign'", "Return'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_39(VAR_101):...\n", "VAR_101.log = VAR_79, VAR_80\n", "return VAR_101\n" ]
[ "def decorate(ruleinfo):...\n", "ruleinfo.log = logs, kwlogs\n", "return ruleinfo\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Return'" ]
[ "@classmethod...\n", "return super(CLASS_0, VAR_0).subsystem_dependencies() + (ClocBinary,)\n" ]
[ "@classmethod...\n", "return super(CountLinesOfCode, cls).subsystem_dependencies() + (ClocBinary,)\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "def FUNC_30():...\n", "if VAR_3 == 'text':\n", "print('Input file: %s' % VAR_75)\n", "VAR_52 = FUNC_2(VAR_15, VAR_2, VAR_3=output_mode, VAR_4=output_limit, VAR_5\n =spires, VAR_6=match_mode, VAR_7=no_cache, VAR_8=with_author_keywords,\n VAR_9=rebuild_cache, VAR_10=only_core_tags, VAR_11=extract_acronyms)\n", "if VAR_12:\n", "return VAR_52\n", "if isinstance(VAR_52, dict):\n", "for VAR_84 in VAR_52:\n", "print(VAR_52[VAR_84])\n" ]
[ "def process_lines():...\n", "if output_mode == 'text':\n", "print('Input file: %s' % source)\n", "output = get_keywords_from_text(text_lines, taxonomy_name, output_mode=\n output_mode, output_limit=output_limit, spires=spires, match_mode=\n match_mode, no_cache=no_cache, with_author_keywords=\n with_author_keywords, rebuild_cache=rebuild_cache, only_core_tags=\n only_core_tags, extract_acronyms=extract_acronyms)\n", "if api:\n", "return output\n", "if isinstance(output, dict):\n", "for i in output:\n", "print(output[i])\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Expr'", "Assign'", "Condition", "Return'", "Condition", "For", "Expr'" ]
[ "def FUNC_15(self, VAR_9):...\n", "\"\"\"docstring\"\"\"\n" ]
[ "def _make_accessor(self, value_type):...\n", "\"\"\"docstring\"\"\"\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Docstring" ]