GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Code Duplication    Length = 60-64 lines in 2 locations

install_skin.py 2 locations

@@ 161-224 (lines=64) @@
158
#         )
159
160
161
class RainmeterInstallSkinFromFolderCommand(sublime_plugin.ApplicationCommand):
162
    """
163
    Command to install skin from a folder.
164
165
    Command String is rainmeter_install_skin_from_folder_command.
166
    """
167
168
    def run(self):
169
        """Automatically executed upon calling this command."""
170
        # check cache first to determine the default path shown to the user
171
        install_cache_path = os.path.join(sublime.cache_path(), "Rainmeter", "install", "last_entered_folder.cache")
172
        if os.path.exists(install_cache_path) and os.path.isfile(install_cache_path):
173
            with open(install_cache_path, 'r') as cache_handler:
174
                cache_content = cache_handler.read()
175
                default_path = cache_content
176
177
        else:
178
            user = os.path.expanduser("~")
179
            downloads = os.path.join(user, "Downloads")
180
181
            if os.path.exists(downloads) and os.path.isdir(downloads):
182
                default_path = downloads
183
            else:
184
                default_path = None
185
186
        sublime.active_window().show_input_panel(
187
            "Enter skin folder location:",
188
            default_path,
189
            self.__on_folder_path_entered, None, None
190
        )
191
192
    @classmethod
193
    def __on_folder_path_entered(cls, path):
194
        """
195
        Executed after a path is entered.
196
197
        Checks the given user input to verify some basic requirements like that it is a directory.
198
        """
199
        if not os.path.exists(path):
200
            sublime.error_message("The entered path '" + path + "' is not valid. Please check your input.")
201
            return
202
203
        if not os.path.isdir(path):
204
            sublime.error_message("The entered path '" + path + "' is not a directory. Please check your input.")
205
            return
206
207
        if not from_folder.find_inis_in_folder(path):
208
            message = "The entered path '" + path + "' is not a valid Rainmeter skin. Please check your input."
209
            sublime.error_message(message)
210
            return
211
212
        # we expect the user to enter a new path which we need to persist
213
        install_cache_path = os.path.join(sublime.cache_path(), "Rainmeter", "install", "last_entered_folder.cache")
214
        if os.path.exists(install_cache_path):
215
            write_mode = 'w'
216
        else:
217
            write_mode = 'x'
218
            os.makedirs(os.path.dirname(install_cache_path))
219
220
        with open(install_cache_path, write_mode) as cache_handler:
221
            cache_handler.write(path)
222
223
        dest_folder = from_folder.install_into_skins_folder(path)
224
        sublime.message_dialog("Skin was successfully installed into \n\n" + dest_folder)
225
226
227
class RainmeterInstallSkinFromZipCommand(sublime_plugin.ApplicationCommand):
@@ 227-286 (lines=60) @@
224
        sublime.message_dialog("Skin was successfully installed into \n\n" + dest_folder)
225
226
227
class RainmeterInstallSkinFromZipCommand(sublime_plugin.ApplicationCommand):
228
    """
229
    Class extending the ApplicationCommand from ST3.
230
231
    Command string is rainmeter_install_skin_from_zip_command.
232
    """
233
234
    def run(self):
235
        """Automatically executed upon calling this command."""
236
        # check cache first to determine the default path shown to the user
237
        install_cache_path = os.path.join(sublime.cache_path(), "Rainmeter", "install", "last_entered_zip.cache")
238
        if os.path.exists(install_cache_path) and os.path.isfile(install_cache_path):
239
            with open(install_cache_path, 'r') as cache_handler:
240
                cache_content = cache_handler.read()
241
                default_path = cache_content
242
243
        else:
244
            # show some default location from which the user can search from
245
            user = os.path.expanduser("~")
246
            downloads = os.path.join(user, "Downloads")
247
248
            if os.path.exists(downloads) and os.path.isdir(downloads):
249
                default_path = downloads
250
            else:
251
                default_path = None
252
253
        sublime.active_window().show_input_panel(
254
            "Enter skin zip location:",
255
            default_path,
256
            self.__on_zip_path_entered, None, None
257
        )
258
259
    @classmethod
260
    def __on_zip_path_entered(cls, path):
261
        """Executed after a zip path is entered."""
262
        if not os.path.exists(path):
263
            sublime.error_message("The entered path '" + path + "' is not valid. Please check your input.")
264
            return
265
266
        if not os.path.isfile(path):
267
            sublime.error_message("The entered path '" + path + "' is not a file. Please check your input.")
268
            return
269
270
        if not path.endswith(".zip"):
271
            sublime.error_message("The entered path '" + path + "' is not a zip file. Please check your input.")
272
            return
273
274
        # we expect the user to enter a new path which we need to persist
275
        install_cache_path = os.path.join(sublime.cache_path(), "Rainmeter", "install", "last_entered_zip.cache")
276
        if os.path.exists(install_cache_path):
277
            write_mode = 'w'
278
        else:
279
            write_mode = 'x'
280
            os.makedirs(os.path.dirname(install_cache_path))
281
282
        with open(install_cache_path, write_mode) as cache_handler:
283
            cache_handler.write(path)
284
285
        from_zip.install_skin_zip(path)
286
        sublime.status_message("Skin was successfully installed!")
287
288
289
class RainmeterInstallSkinFromGitCommand(sublime_plugin.ApplicationCommand):