Git Product home page Git Product logo

sourcery's People

Contributors

adi10hero avatar angrycaptain19 avatar bm424 avatar brendanator avatar guspan-tanadi avatar hellebore avatar reka avatar ruancomelli avatar sourcery-ai-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sourcery's Issues

Using Sourcery inside a corporate proxy

Issue description or question

The Sorcery service is unable to start / look for the latest version of the offline sorcery engine when PyCharm is set to use a proxy.

More specifically, this happens when I run inside a corporate environment, where all internet traffic
is routed through a proxy.
When I try to run sorcery on a different network, it works as expected.

Note that PyCharm is set to use the appropriate proxy, but sorcery seem to be trying to connect to the internet directly.

Sourcery Version

Plugin version: 0.2.7
Sourcery version: 0.5.11

Code editor or IDE name and version

Pycharm 2019.3.2

OS name and version

macOS 10.14.6

Deleted some functionality

Hello, i have tried this out and it looks pretty nice, but this obviously is wrong:

         del fields["full_name"]
-    elif "full_name" in fields and ("first_name" in fields or "last_name" in fields):
+    elif "full_name" in fields:
         raise Exception(

False Positive: Replace unused for index with underscore

Issue description or question

Sourcery complains about this code with a "Replace unused for index with underscore" at the location marked with "FP here"

def translate(data, keys):
    r = ['abcd']
    nos = 100
    for i in range(nos):  # <- FP here
        r.append([data[k][i] for k in keys])
    return r

It converts the code to

def translate(data, keys):
    r = ['abcd']
    nos = 100
    for _ in range(nos):
        r.append([data[k][i] for k in keys])
    return r

Which will lead to an exception:

NameError: name 'i' is not defined

The code is contrived, reducing it further will lead to other suggestions (like use list-comprehension). Nevertheless, Sourcery should not suggest this particular change, because it breaks the code.

Sourcery Version

Sourcery plugin for PyCharm.

Plan: Sourcery Open Source. Plugin version: 0.3.7. Sourcery Version: 0.7.0.

Code editor or IDE name and version

PyCharm 2020.1.1 (Professional Edition)
Build #PY-201.7223.92, built on April 30, 2020
Runtime version: 11.0.6+8-b765.40 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
GC: ParNew, ConcurrentMarkSweep
Memory: 1088M
Cores: 8
Non-Bundled Plugins: mobi.hsz.idea.gitignore, mobi.hsz.idea.latex, nl.rubensten.texifyidea, sourcery.pycharm-plugin, org.sonarlint.idea, org.toml.lang, org.rust.lang

OS name and version

Windows 10, build 19635.1

Support for accepting / rejecting refactorings via GitHub UI

Right now if you have @sourcery-ai-bot installed for your GitHub repository it opens a separate PR. In this new PR it simply adds all refactorings without comments.

If you let it refactor the master branch it opens a PR with a review comment for every change its made.

Is it possible to use the second approach also for PRs? GitHub review have the option to "insert suggestions" (see 6 in https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/commenting-on-a-pull-request#adding-line-comments-to-a-pull-request). Such a suggestion can be accepted and automatically committed to the current PR with a single click.

Incorporating this would mean that all changes including a possible discussion if a change is accepted would stay in the same PR. Furthermore, with it you have the option the accept / refuse changes without pulling the PR to your local repository and edit it manually.

Suggestion not displaying correctly in PyCharm

Issue description or question

Open project, clicked on run in Sourcery plugin and saw an issue. Clicked on the issue, convert loop to list comprehension and I could see that there was a suggestion but perhaps the text was to long as I could not see the correction or suggested test (assuming that what is it). Please see screenshot.

Code editor or IDE name and version

Pycharm v2019.2.1 Pro

OS name and version

Windows
OSX - 10.14.6
Screen Shot 2019-09-12 at 11 40 49 AM (2)
Screen Shot 2019-09-12 at 11 41 31 AM (2)

Linux

Skip large file

Skip large file

There are some large files in my project. Result from the above, when sourcery scans these file, it takes lot of time and lot of cpu usage. To figure this problem, I prefer to skip some files that they don't need to be scanned.

Sourcery Version

Plan: Sourcery Pro.
Plugin version: 0.3.0
Sourcery Version: 0.5.11

Code editor or IDE name and version

PyCharm 2019.3.3 (Professional Edition)
Build #PY-193.6494.30, built on February 6, 2020

OS name and version

OSX 10.15.3

Sourcery Crash

Issue description or question

After adding an third party package django_q to INSTALLED_APPS in my Django project I got this:

java.lang.NullPointerException
	at ai.sourcery.intellij.ui.SourceryWindowPanel.renameFile(SourceryWindowPanel.java:403)
	at ai.sourcery.intellij.SourceryPlugin$1.lambda$renameFile$0(SourceryPlugin.java:103)
	at com.intellij.openapi.application.TransactionGuardImpl$2.run(TransactionGuardImpl.java:312)
	at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.doRun(LaterInvocator.java:433)
	at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.runNextEvent(LaterInvocator.java:416)
	at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:399)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:776)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:727)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:746)
	at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:873)
	at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:822)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:461)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:704)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:460)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

Code editor or IDE name and version

Pycharm v2019.2

OS name and version

Windows

Sourcery shows CI failures in the commit list

Issue description or question

The tool leaves false CI failures in your commit record, which is bad for projects that pride themselves on no failures (like mine)

e.g. https://github.com/rec/safer/commits/master - only one red X in over 100 commits and it's from you.

I signed up with six projects and now I have five failures on my otherwise clean record.

Sourcery Version

Often available in Sourcery settings

Code editor or IDE name and version

Github

OS name and version

n/a

Sourcery defaulting to incorrect view when using split views

Issue description or question

Open a file and convert it to split view. Now open a different file.
Sourcery will incorrectly switch the view back to the first one.

By clicking quickly through different files Sourcery will sometimes switch quickly back and forth between them.

Sourcery Version

0.3.3

Code editor or IDE name and version

Pycharm v2019.3

OS name and version

Linux

Support for Black

My repositories all use Black for code formatting, and it has become somewhat of a standard across Python projects.

Issue: The Sourcery bot makes code formatting suggestions that don't pass the black pre-commit hooks in the linting stage of CI because the suggestions use single quotes for strings and other formatting problems. This requires then fetching the proposed changes, running the pre-commit hooks, and pushing the changes back to the branch.

Possible solutions:

  1. Detect use of black in the project and make formatting suggestions match that formatting or run black on the code changes after initially reformatting
  2. Add a use black setting to the bot
  3. Detect the formatting of the code that is being updated and try to match it
  4. Use black for code formatting all the time

Sourcery wants to hoist comments out of loops

Issue description or question

Sourcery wants to hoist comments out of loops

Sourcery Version

0.3.0

Often available in Sourcery settings

Code editor or IDE name and version

Pycharm v2019.3

OS name and version

Windows 10

I have noticed that sourcery frequently wants to hoist comments out of loops. I get entire reformat suggestions that are based on comments being hoisted up.

This doesn't seem like something you actually want.

Can't use sourcery because the binary is not found

Issue description or question

Can't use sourcery because it fails to find the binary during configuration
image

This may well be an issue with my work network though my other plugins do not have this issue. Is it possible to download the plugin and install it manually?

Sourcery Version

All versions

Code editor or IDE name and version

Pycharm v?
2019.3

OS name and version

Windows 10

No PR after starring sourcery on GitHub

This is either a bug report or an inappropriate complaint. Unfortunately, I don't have enough information to determine which is the case.


Issue description or question

I wanted to give sourcery a try so I starred it here on GitHub. Directly afterwards @sourcery-ai-bot starred and forked the repository I wanted to be checked. I expected it to send a PR with all possible refactorings, but up until now (16h later) nothing happened. Could you check if everything is working as you expected it to do?

If that is the case and I'm just too impatient, could you tell me what the "normal" timeline is?

Failed to launch Sourcery service after updating from alpha

Issue description or question

I was using Sourcery in alpha, but then didn't use it for a while. I recently updated the plugin to 0.1.2 (and updated my token) and found that the Sourcery service no longer starts, giving the following error:

2:47 PM	Failed to launch Sourcery service: login() missing 2 required positional arguments: 'plugin_version' and 'protocol_version'

Sourcery Version

0.1.2

Code editor or IDE name and version

Pycharm v2018.1.1

OS name and version

Windows 10

Refactor Master Option is Not Working

I installed Sourcery as a GitHub Integration to an organization with open source repositories. I click on the refactor master button, and your website says: "Successful started refactoring job for master." I have told it to refactor multiple times over the last 24 hours, and there hasn't been a pull request made to the repo.

One of my co-developers did submit a PR, and sourcery-ai created a new PR with correction to it, so that part of the integration is working.

False positive: Hoist statements out of for/while loops

Issue description or question

import asyncio

class MyAwaitable:
    def __await__(self):
        print("__await__")
        yield

async def main():
    x = MyAwaitable()
    for _ in range(3):
        await x

asyncio.run(main())

This code prints "await" three times. Sourcery suggests to hoist statements out of for/while loops for await x:

async def main():
    x = MyAwaitable()
    await x

This code prints "await" only once.

Side note: Sourcery does not suggest to hoist the statement if the operand of await is a call:

import asyncio

class MyAwaitable:
    def __await__(self):
        print("__await__")
        yield

    def __call__(self):
        return self

async def main():
    x = MyAwaitable()
    for _ in range(3):
        await x()

asyncio.run(main())

This code prints "await" three times. asyncio (the module) seems to return awaitables from calls like await asyncio.sleep(1) most of the time if not always.

Sourcery Version

Plan: Sourcery open Source. Plugin version: 0.3.7. Sourcery Version: 0.7.0.

Code editor or IDE name and version

Pycharm v2020.1.1 (Professional Edition)

OS name and version

Arch Linux

Possible vocabulary improvement

Issue description or question

Description of some issues doesn't seem right

Sourcery Version

0.3.0

Often available in Sourcery settings

Code editor or IDE name and version

Pycharm v2019.3

OS name and version

Windows 10

A typical example would be:

def x():
  return 
  print('Unreachable')

For me, the message says, "remove redundant code" and it will delete everything under the return. This isn't redundant code, it's just unreachable and probably represents a mistake. Deleting it as redundant is certainly a mistake.

I think the vocabulary should change to unreachable but I am unsure what the correct refactor (if any) should be.

raise Exception does not trigger refactoring analysis and a custom exception does

Issue description or question

from common.errors import ValidationError


def set_status(status: str) -> str:
    if status:
        if status.upper().strip() == "ON":
            result = "starting"
        elif status.upper().strip() == "OFF":
            result = ""
        else:
            # raise Exception() does not trigger any refactor
            raise ValidationError(title="Invalid status", description="Status can be on or off")
    else:
        raise ValidationError(title="Invalid status", description="Status can be on or off")

    return result

Code editor or IDE name and version

Pycharm 2019.1.3

OS name and version

Linux

Ignore some refactoring suggestions

Issue description or question

Is there a way to tell Sourcery (or PyCharm) to ignore certain refactoring suggestions?
It's not that the suggestions are wrong, but sometimes I prefer the way the code reads without the refactoring. I can't seem to find a way to tell Sourcery to stop highlighting this part of the code, so I'm just turning off Sourcery for now.

Code editor or IDE name and version

Pycharm v2018.1.4 Community Edition

OS name and version

Linux

Strange refactoring of my Django `urls.py`

Issue description or question

Original code:

# -*- coding: utf-8 -*-
"""Root URL routing of the radio downloader project."""
from django.conf import settings
from django.conf.urls import static
from django.contrib import admin
from django.urls import include, path
from django.utils.translation import gettext_lazy as _
from django.views.generic import TemplateView

urlpatterns = [
    path(
        route='admin/',
        view=admin.site.urls
    ),
    path(
        route="",
        view=TemplateView.as_view(template_name="home.html"),
        name="home"
    )
]

if settings.DEBUG is True:
    urlpatterns += static.static(
        settings.MEDIA_URL,
        document_root=settings.MEDIA_ROOT
    )

will get refactored to

# -*- coding: utf-8 -*-
"""Root URL routing of the radio downloader project."""

from django.conf import settings
from django.conf.urls import static
from django.contrib import admin
from django.urls import include, path
from django.utils.translation import gettext_lazy as _
from django.views.generic import TemplateView

if settings.DEBUG is True:
    urlpatterns = [
        path(
            route='admin/',
            view=admin.site.urls
        ),
        path(
            route="",
            view=TemplateView.as_view(template_name="home.html"),
            name="home"
        )
    ]

    urlpatterns += static.static(
        settings.MEDIA_URL,
        document_root=settings.MEDIA_ROOT
    )

Hint Move assignments closer to their usage

This does not make sense at all.

Code editor or IDE name and version

Pycharm v2019.2

OS name and version

Windows

Unable to connect to Sourcery executable

Issue description or question

while editing in Pycharm, I get the error: Unable to connect to Sourcery executable: expected str, bytes or os.PathLike object, not NoneType

Sourcery Version

Plan: Sourcery Pro. Plugin version: 0.3.2. Sourcery Version: 0.6.4

Code editor or IDE name and version

Pycharm 2019.2.5 (Professional Edition) Build #PY-192.7142.56, November 19, 2019

OS name and version

Windows 10, running pycharm in WSL 2 on Ubuntu 18.04 LTS

Scientific notation is not retained

Issue description or question

Consider the following snippet:

if foo:
    bar = 1e-4
else:
    bar = 1e15

This gets refactored to

bar = 0.0001 if foo else 1000000000000000.0

which is correct but quite cumbersome. If you decrease or increase the exponent any further, the scientific formatting is retained:

if foo:
    bar = 1e-5
else:
    bar = 1e16
bar = 1e-05 if foo else 1e+16

Sourcery Version

Sourcery Starbot (see https://github.com/pmeier/pystiche/pull/270/files#r433867794)

Refactoring of a boolean return if statement changes return type

Issue description or question

Before:

def sth(somedict):
    if not somedict.get("somekey"):
        return False
    
    return True

After:

def sth(somedict):
    return somedict.get("somekey")

As you can see a check for the existence of a key which is meant to return a boolean is refactored to returning the actual value under the key which could easily be False.

Code editor or IDE name and version

Pycharm v2019.2.1

OS name and version

OSX 10.14.6

Failed to download Sourcery: Downloaded version returns error

Issue description or question

I have installed Sourcery plugin, and when it starts to download I got an error:
Failed to download Sourcery: Downloaded version returns error
I have tried turning off pycharm, and restarted computer, uninstalled Sourcery plugin, and installed it again. End result is always the same.

Code editor or IDE name and version

Pycharm 2019.3

OS name and version

Linux, 5.0.21-1

Strange string repetition (list.append)

Issue description or question

Using the Github Star Bot to create a pull request, there is a strange artifact where strings are duplicated upon condensing a series of list.append() calls into a single return [list, content].

See (Actual output): CodeBizarre/discord-bot@528fcfb#diff-5bc02cefb3ea9e27f1a6776eabd1935dL91

Fixed (Expected output): CodeBizarre/discord-bot@b9c5db1

Sourcery Version

sourcery-ai-bot via github star, I don't see a version listed anywhere

I've omitted the n/a sections of the default issue since I did not use sourcery locally, only through the github star bot.

Sourcery failed to Launch Error: RecordCollection contained more than one row...

Issue description or question

Sourcery Plugin fails to launch in PyCharm IDE. After upgrading to PyCharm 2020.1 from 2019.3 Sourcery fails to load.

Error message in Event Log:
6:20 PM Failed to launch Sourcery service: RecordCollection contained more than one row. Expects only one row when using RecordCollection.one

I have tried completely uninstalling and reinstalling PyCharm 2020.1; uninstalling and installing 2019.3 : on both I only installed the Sourcery Plugin. In all cases I get the exact same error.

Any idea of where this RecordCollection.one is stored and how I can fix this?

Sourcery Version

Sourcery 0.3.7

Code editor or IDE name and version

PyCharm 2020.1.1 (Professional Edition)
Build #PY-201.7223.92, built on April 29, 2020
Licensed to -snip-
Subscription is active until February -snip-
Runtime version: 11.0.6+8-b765.40 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
GC: ParNew, ConcurrentMarkSweep
Memory: 1998M
Cores: 4
Non-Bundled Plugins: sourcery.pycharm-plugin

OS name and version

Windows 10 Version 1909 (OS Build 18363.836)

Strange refactoring suggestion

Issue description or question

def set_status(status: str) -> str:
    if status:
        if status.upper().strip() == "ON":
            result = "starting"
        elif status.upper().strip() == "OFF":
            result = ""
        else:
            raise ValidationError(title="Invalid status", description="Status can be on or off")
    else:
        raise ValidationError(title="Invalid status", description="Status can be on or off")

    return result

is refactored into:

def set_status(status: str) -> str:
    if status and status.upper().strip() == "ON":
        result = "starting"
    elif status and status.upper().strip() != "ON" and status.upper().strip() == "OFF":
        result = ""
    else:
        raise ValidationError(title="Invalid status", description="Status can be on or off")
    return result

Even if everything is syntactically and semantically correct, the following condition is a bit strange:

status and status.upper().strip() != "ON" and status.upper().strip() == "OFF"

Code editor or IDE name and version

Pycharm 2019.1.3

OS name and version

Linux

Sourcery removes comments in some refactors

Issue description or question

It refactored some code and deleted comments

Sourcery Version

0.3.0

Code editor or IDE name and version

Pycharm v2019.3

OS name and version

Windows 10

Here is my diff.

image

Augassign not applicable to all types

Issue description or question

    import numpy
    
    x = np.array(list([1, 2, 3]))
    x = x / x.sum()
    
    # becomes:
    x /= x.sum()
    
    # the /= magic method is not supported in numpy

Code editor or IDE name and version

Pycharm

OS name and version

Not known - raised by Andrew Louw

Simplify generator expression can change semantics

Issue description or question

The simplify generator refactoring changes the type of the returned object from a generator to a different type. If the code relies on it being a generator this will change program behaviour.
e.g:

a = {'a': 1, 'b': 2}
next(b for b in a.keys())

is transformed to the incorrect:

a = {'a': 1, 'b': 2}
next(a.keys())

Sourcery Version

Often available in Sourcery settings

Code editor or IDE name and version

Pycharm

OS name and version

All

Max line-width violated following refactor.

Issue description or question

Refactoring doesn't respect the line-widths.

Here's an example. Before:

                val = []
                for sub_attr_value in attr_value:
                    val.append(sub_attr_value.to_dict(
                        deep=deep,
                        serialisable=serialisable
                    ))

After:

val = [sub_attr_value.to_dict(deep=deep, serialisable=serialisable) for sub_attr_value in attr_value]

This isn't a major deal but will then require re-refactoring or running black to bring the code back in shape.

Code editor or IDE name and version

Pycharm v2019.2.1

OS name and version

OSX 10.14.6

Sourcery incorrectly refactoring functions with nested functions defined.

Issue description or question

Sourcery incorrectly refactoring functions with nested functions defined.

e.g.

def func():
  def inner_func():
    for report in item.get(report_type, []):
      result.append(something)

  result = []
  for area_code, item in area_list.items():
    inner_func()

  return result

Sourcery Version

0.6.5

Code editor or IDE name and version

Pycharm

OS name and version

Linux

Refactored conditionals aren't optimal

Issue description or question

Some refactors of If / Else blocks seem non-optimal

Sourcery Version

0.3.0

Often available in Sourcery settings

Code editor or IDE name and version

Pycharm v2019.3

OS name and version

Windows 10

image

will refactor to

image

but i feel like it should refactor to

image

Refactoring affecting `Union` annotations

Issue description or question

Refactoring a snippet seems to have lead to the Union annotation being wrapped into a tuple for no good reason.

Before:

from typing import Union

def _et(element) -> Union[str, None]:
    """Extracts the element text (ET)."""

    text = None
    if element is not None:
        text = element.text

    if not text:
        text = None
    else:
        text = text.strip()

    return text

After:

from typing import Union

def _et(element) -> Union[(str, None)]:
    """Extracts the element text (ET)."""

    text = None
    if element is not None:
        text = element.text

    text = None if not text else text.strip()
    return text

Note how Union[str, None] became Union[(str, None)]

Code editor or IDE name and version

Pycharm v2019.2.1

OS name and version

OSX 10.14.6

Sourcery plugin still recommends changes on deleted files

Issue description or question

  1. Scan an existing file so Sourcery reports an issue. Do not apply the refactorings
  2. Rename the file (I think this also works with delete)
  3. Sourcery still tracks the files even if it does not exist anymore

Code editor or IDE name and version

Pycharm 2019.1.3

OS name and version

Linux

Current Known Issues and limitations

  • Sourcery only works for Python 3

  • Sourcery can delete comments and whitespace inappropriately.

  • Sourcery does not currently handle async functions and the await keyword correctly.

  • Sourcery is not yet enabled for IntelliJ batch inspections (scanning every file in a project or directory at once)

  • Sourcery does not correctly handle properties that depend on other variables.

Github metrics

  • Github marketing automation

installed and uninstalled
installation table - enabled column

del from dictionary copy can be replaced by a list comprehension.

Issue description or question

This horrible way of iterating is not picked up:

x0 = ['a', 'b']
x1 = {'a': 1, 'b': 2, 'c': 3}
for i in x1.copy():  # can't iterate over a variable that changes size
    if i not in x0:
        del x1[i]

when the much cleaner version is available.

x0 = ['a', 'b']
x1 = {'a': 1, 'b': 2, 'c': 3}
x1 = {k: v for k, v in x1.copy().items() if k in x0}

Code editor or IDE name and version

Pycharm 2019.1.3?

OS name and version

Windows 10

Sourcery throws error when function name is deleted

Issue description or question

Delete a function name, leaving the rest of the function intact.
Sourcery will throw the following error and then reconnect:

expected str, bytes or os.PathLike object, not NoneType

Sourcery Version

0.6.4

Code editor or IDE name and version

Pycharm 2019

OS name and version

Linux

[idea 2020.1.1] Unable to connect to Sourcery executable: org.eclipse.lsp4j.jsonrpc.JsonRpcException: java.io.IOException: Stream closed

Issue description or question

open a flask python project, after some indexing of the ide, the event log keep popping this message:

11:36 Unable to connect to Sourcery executable: org.eclipse.lsp4j.jsonrpc.JsonRpcException: java.io.IOException: Stream closed

11:37 Unable to connect to Sourcery executable

11:38 Unable to connect to Sourcery executable
...

The first message tell a jsonrpc exception, then others take place on every minute.

Sourcery Version

0.3.5

Code editor or IDE name and version

Idea 2020.1.1 with python plugin

OS name and version

OSX 10.15.4

Sourcery not correctly handling multiple statements on one line

Issue description or question

Sourcery can duplicate lines incorrectly - see this cut down example:

def appendPagesFromReader(self):
  # Copy pages from reader to writer
  for rpagenum in range(reader_num_pages):
    self.addPage(reader_page)
    writer_page = self.getPage(writer_num_pages + rpagenum)
    # Trigger callback, pass writer page as parameter
    if callable(after_page_append): after_page_append(writer_page)

Sourcery Version

0.6.8

Code editor or IDE name and version

GitHub bot

OS name and version

N/A

Sourcery doesn't seem to refactor functions in functions

Issue description or question

Code that sourcery would recactor is ignored if defined as a function inside another function

Sourcery Version

0
.3.0

Code editor or IDE name and version

Pycharm v2019.3

OS name and version

Windows 10

Here is a bit of a contrived example

image

image

PyCharm plugin process running in the background and throwing errors

Issue description or question

There is a background process running saying Sourcery update check complete, and constantly trowing out error notifications saying the following. The correct API token is entered in the settings. The certifi folder is not present.

Unable to connect to Sourcery executable: Could not find a suitable TLS CA certificate bundle, invalid path: C:\Users\jakub\AppData\Roaming\sourcery\bin\certifi\cacert.pem

running process indicator
error notification
spammed up the event log

Code editor or IDE name and version

Pycharm v2019.2.4

OS name and version

Windows 10 1903

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.