arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2007.10146cs.SEcs.PL
收藏

关于GitHub的Swyter笔记本:特性和代码克隆

Jupyter Notebooks on GitHub: Characteristics and Code Clones

Malin Källén, Tobias Wrigstad

摘要:

Cyberter Notebooks已经成为数据科学编程的标准工具。Xueyter笔记本中的程序与典型的程序不同,因为它们是由一组与文本和可视化交织的代码片段构成的。这允许交互式探索,并且片段可以以不同的顺序执行,这可能由于片段之间的副作用而导致不同的结果。以前的研究已经表明,在传统程序的源代码中存在大量的代码重复--代码克隆--在所谓的系统程序设计语言和所谓的脚本语言中。在本文中,我们提出了第一个大规模的研究,在笔记本电脑的代码克隆。我们分析了GitHJub上托管的270万字节笔记本的语料库,代表了3700万个片段和2.27亿行代码。我们在单个片段的水平上研究克隆,并研究片段在多个笔记本中重复出现的程度。我们研究了相同的克隆和近似克隆,并对最常见的克隆进行了小规模的目视检查。我们发现,代码克隆是常见的,所有代码片段的70%以上是其他片段的精确副本(在空白处可能有差异),大约50%的所有笔记本没有任何独特的片段,但仅由其他地方也发现的片段组成。在用Python编写的笔记本中,至少80%的代码片段是近似克隆,并且Python中代码克隆的流行程度高于其他语言。我们进一步发现,不同存储库之间的克隆比同一存储库中的克隆更常见。但是,最常见的单个存储库是其自身所在的存储库,其中,一个XNUYTER笔记本包含来自该存储库的克隆。

英文摘要:

Jupyter notebooks has emerged as a standard tool for data science programming. Programs in Jupyter notebooks are different from typical programs as they are constructed by a collection of code snippets interleaved with text and visualisation. This allows interactive exploration and snippets may be executed in different order which may give rise to different results due to side-effects between snippets. Previous studies have shown the presence of considerable code duplication -- code clones -- in sources of traditional programs, in both so-called systems programming languages and so-called scripting languages. In this paper we present the first large-scale study of code cloning in Jupyter notebooks. We analyse a corpus of 2.7 million Jupyter notebooks hosted on GitHJub, representing 37 million individual snippets and 227 million lines of code. We study clones at the level of individual snippets, and study the extent to which snippets are recurring across multiple notebooks. We study both identical clones and approximate clones and conduct a small-scale ocular inspection of the most common clones. We find that code cloning is common in Jupyter notebooks -- more than 70% of all code snippets are exact copies of other snippets (with possible differences in white spaces), and around 50% of all notebooks do not have any unique snippet, but consists solely of snippets that are also found elsewhere. In notebooks written in Python, at least 80% of all snippets are approximate clones and the prevalence of code cloning is higher in Python than in other languages. We further find that clones between different repositories are far more common than clones within the same repository. However, the most common individual repository from which a Jupyter notebook contains clones is the repository in which itself resides.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑