code
stringlengths
3
6.57k
print_current_creds(include_netrc=True)
self.assertEqual(list(sys.stdout.getvalue()
splitlines()
git_cl._GitCookiesChecker()
print_current_creds(include_netrc=False)
self.assertEqual(list(sys.stdout.getvalue()
splitlines()
_common_creds_check_mocks(self)
exists_mock(path)
os.path.dirname(path)
os.path.expanduser('~')
os.path.basename(path)
in ('.netrc', '.gitcookies')
self._mocked_call('os.path.exists', '%s/%s' % (dirname, base)
self.mock(os.path, 'exists', exists_mock)
self.mock(sys, 'stdout', StringIO.StringIO()
test_creds_check_gitcookies_not_configured(self)
self._common_creds_check_mocks()
os.path.expanduser('~/.gitcookies')
self.assertEqual(0, git_cl.main(['creds-check'])
sys.stdout.getvalue()
sys.stdout.getvalue()
test_creds_check_gitcookies_configured_custom_broken(self)
self._common_creds_check_mocks()
os.path.expanduser('~/.gitcookies')
self.assertEqual(0, git_cl.main(['creds-check'])
sys.stdout.getvalue()
sys.stdout.getvalue()
test_git_cl_comment_add_gerrit(self)
self._mocked_call('SetReview', host, change, msg, ready)
test_git_cl_comments_fetch_gerrit(self)
self.mock(sys, 'stdout', StringIO.StringIO()
datetime.datetime(2017, 3, 16, 20, 0, 41, 0)
datetime.datetime(2017, 3, 17, 5, 19, 37, 500000)
self.assertEqual(cl.GetCommentsSummary()
self.mock(git_cl.Changelist, 'GetBranch', lambda _: 'foo')
git_cl.main(['comments', '-i', '1', '-j', 'output.json'])
test_git_cl_comments_robot_comments(self)
self.mock(sys, 'stdout', StringIO.StringIO()
git_cl._CommentSummary(date=datetime.datetime(2017, 3, 17, 5, 30, 37)
self.assertEqual(cl.GetCommentsSummary()
test_get_remote_url_with_mirror(self)
selective_os_path_isdir_mock(path)
self._mocked_call('os.path.isdir', path)
original_os_path_isdir(path)
self.mock(os.path, 'isdir', selective_os_path_isdir_mock)
exists. ((['git', 'config', 'remote.origin.url'],)
git_cl.Changelist(codereview='gerrit', issue=1)
self.assertEqual(cl.GetRemoteUrl()
self.assertEqual(cl.GetRemoteUrl()
test_get_remote_url_non_existing_mirror(self)
selective_os_path_isdir_mock(path)
self._mocked_call('os.path.isdir', path)
original_os_path_isdir(path)
self.mock(os.path, 'isdir', selective_os_path_isdir_mock)
self._mocked_call('logging.error', fmt % a)
git_cl.Changelist(codereview='gerrit', issue=1)
self.assertIsNone(cl.GetRemoteUrl()
test_get_remote_url_misconfigured_mirror(self)
selective_os_path_isdir_mock(path)
self._mocked_call('os.path.isdir', path)
original_os_path_isdir(path)
self.mock(os.path, 'isdir', selective_os_path_isdir_mock)
self._mocked_call('logging.error', *a)
exists. ((['git', 'config', 'remote.origin.url'],)
git_cl.Changelist(codereview='gerrit', issue=1)
self.assertIsNone(cl.GetRemoteUrl()
test_gerrit_change_identifier_with_project(self)
git_cl.Changelist(codereview='gerrit', issue=123456)
self.assertEqual(cl._GerritChangeIdentifier()
test_gerrit_change_identifier_without_project(self)
git_cl.Changelist(codereview='gerrit', issue=123456)
self.assertEqual(cl._GerritChangeIdentifier()
unittest.main()
build_vocab(dataset)
Counter()
Counter()
Counter()
Counter()
chain(*dataset)
paragraph.iterfind(filter=node_type_filter([EDU, Relation])
isinstance(node, EDU)
word_freq.update(node.words)
pos_freq.update(node.tags)
isinstance(node, Relation)
Vocab("word", word_freq)
Vocab("part of speech", pos_freq)
Label("nuclear", nuc_freq)
Label("relation", rel_freq)
gen_decoder_data(root, edu2ids)
isinstance(root, EDU)
child_edus.append(root)
isinstance(root, Sentence)
gen_decoder_data(child, edu2ids)
child_edus.extend(_child_edus)
splits.extend(_splits)
isinstance(root, Relation)
gen_decoder_data(child, edu2ids)
len(children)
ValueError("relation node should have at least 2 children")