RIdiom: Automatically Refactoring Non-idiomatic Python Code with Pythonic Idioms
Pythonic idioms are widely adopted in the Python community because of their advantages such as conciseness and performance. However, when Python programmers use pythonic idioms, they face many challenges such as being unaware of certain pythonic idioms or not knowing how to use them properly. Based on an analysis of 7,638 Python repositories on GitHub, we find that non-idiomatic Python code that can be refactored with pythonic idioms occurs frequently and widely. Unfortunately, there is no tool to automatically refactor such non-idiomatic code into idiomatic code. In this paper, we design and implement a tool called RIdiom to make Python code idiomatic with nine pythonic idioms. Python developers can not only refactor projects easily via a visual interface of the PyCharm plugin but also can refactor projects using the command line without relying on an integrated development environment. We test and review over 4,115 refactorings applied to 1,065 Python projects from GitHub, and submit 90 pull requests for the 90 randomly sampled refactorings to 84 projects. These evaluations confirm the high-accuracy, practicality and usefulness of our refactoring tool on real-world Python code. Demo Tool: https://github.com/idiomaticrefactoring/RIdiom Demo Video: https://youtu.be/KG-nXGR8DIA
Thu 18 MayDisplayed time zone: Hobart change
13:45 - 15:15 | Programming languagesDEMO - Demonstrations / Technical Track / Journal-First Papers / SEET - Software Engineering Education and Training at Meeting Room 103 Chair(s): Jean-Guy Schneider Monash University | ||
13:45 15mTalk | Demystifying Issues, Challenges, and Solutions for Multilingual Software Development Technical Track Haoran Yang Washington State University, Weile Lian Washington State University, Shaowei Wang University of Manitoba, Haipeng Cai Washington State University Pre-print | ||
14:00 15mTalk | Testability Refactoring in Pull Requests: Patterns and Trends Technical Track Pre-print | ||
14:15 15mTalk | Usability-Oriented Design of Liquid Types for Java Technical Track Catarina Gamboa CMU and LASIGE, Paulo Canelas Carnegie Mellon University, Christopher Steven Timperley Carnegie Mellon University, Alcides Fonseca University of Lisbon DOI | ||
14:30 15mTalk | A Theorem Proving Approach to Programming Language Semantics SEET - Software Engineering Education and Training Subhajit Roy IIT Kanpur | ||
14:45 7mTalk | RIdiom: Automatically Refactoring Non-idiomatic Python Code with Pythonic Idioms DEMO - Demonstrations zejun zhang Australian National University, Zhenchang Xing CSIRO’s Data61; Australian National University, Xiwei (Sherry) Xu CSIRO’s Data61, Liming Zhu CSIRO’s Data61 | ||
14:52 7mTalk | An Empirical Study of Data Constraint Implementations in Java Journal-First Papers Juan Manuel Florez CQSE America, Laura Moreno CQSE America, Zenong Zhang The University of Texas at Dallas, Shiyi Wei University of Texas at Dallas, Andrian Marcus University of Texas at Dallas | ||
14:59 7mTalk | Learning To Predict User-Defined Types Journal-First Papers Kevin Jesse University of California at Davis, USA, Prem Devanbu University of California at Davis, Anand Ashok Sawant University of California, Davis |