Skip to content

Move code from __init__.py to slither.py - #69

Merged
BookOwl merged 29 commits into
PySlither:masterfrom
CosmicWebServices:master
Jun 10, 2016
Merged

BookOwl merged 29 commits into
PySlither:masterfrom
CosmicWebServices:master

Conversation

@CosmicWebServices

Copy link
Copy Markdown
Contributor

See #68

Not tested.

@skistaddy

Copy link
Copy Markdown
Contributor

+1

@CosmicWebServices

Copy link
Copy Markdown
Contributor Author

Thanks!

@skistaddy

Copy link
Copy Markdown
Contributor

:D

@BookOwl

BookOwl commented Jun 3, 2016

Copy link
Copy Markdown
Member

I don't like this, it means that instead of just importing slither, users have to do from slither import slither, which just seems weird.

@CosmicWebServices

Copy link
Copy Markdown
Contributor Author

or from slither import *

@BookOwl

BookOwl commented Jun 3, 2016

Copy link
Copy Markdown
Member

But that's considered bad practice. and we really shouldn't be encouraging that.
What's wrong with having everything in the init.py

@CosmicWebServices

Copy link
Copy Markdown
Contributor Author

I just realised we can put import slither in __init__.py

@ghost

ghost commented Jun 4, 2016

Copy link
Copy Markdown

But why do we need this? And besides It's not like we have optional modules for slither.

@skistaddy

Copy link
Copy Markdown
Contributor

@CosmicWebServices +1

@emmatyping

emmatyping commented Jun 4, 2016 •

Copy link
Copy Markdown
Contributor

But why do we need this? And besides It's not like we have optional modules for slither.

Python style dictates that as little operational code should go in an__init__.py file as possible. I believe the importing of slither.py, as @omegabyte suggested is often the practice used.

@BookOwl

BookOwl commented Jun 4, 2016

Copy link
Copy Markdown
Member

I think that @Tymewalk needs to make this decision.

@CosmicWebServices

Copy link
Copy Markdown
Contributor Author

It is done

@BookOwl

BookOwl commented Jun 6, 2016

Copy link
Copy Markdown
Member

OK, @Tymewalk can look it over one more time and then we can merge.

@Tymewalk

Tymewalk commented Jun 6, 2016

Copy link
Copy Markdown
Member

@BookOwl @CosmicWebServices I'm cloning that repo now to test.

@Tymewalk

Tymewalk commented Jun 6, 2016

Copy link
Copy Markdown
Member

Used import slither in basicTest.py.

Traceback (most recent call last):
  File "slither/tests/basicTest.py", line 3, in <module>
    snakey = slither.Sprite()
AttributeError: 'module' object has no attribute 'Sprite'

@BookOwl

BookOwl commented Jun 6, 2016 •

Copy link
Copy Markdown
Member

@Tymewalk, I think that the __init__.py file needs to be changed to from .slither import *

@BookOwl

BookOwl commented Jun 6, 2016

Copy link
Copy Markdown
Member

Yep, that fixes it.

@BookOwl

BookOwl commented Jun 6, 2016 •

Copy link
Copy Markdown
Member

@CosmicWebServices, can you add that fix?
Also, the tests need to be changed back to import slither, not from slither import *

@CosmicWebServices

Copy link
Copy Markdown
Contributor Author

Got it...

@BookOwl

BookOwl commented Jun 7, 2016

Copy link
Copy Markdown
Member

I just tested it and it seems to work, but you need to revert the tests' import back to import slither
Other than that, it looks great! Thanks for putting in all this work.

@CosmicWebServices

Copy link
Copy Markdown
Contributor Author

I forgot about the tests I will do that soon (tomorrow probably)

@BookOwl

BookOwl commented Jun 9, 2016

Copy link
Copy Markdown
Member

@CosmicWebServices, when do you think that you will finish this?

@BookOwl BookOwl added this to the v0.3.0 milestone Jun 9, 2016
@CosmicWebServices

Copy link
Copy Markdown
Contributor Author

I forgot doing it now

@CosmicWebServices

Copy link
Copy Markdown
Contributor Author

Done sorry it took so long!

@BookOwl

BookOwl commented Jun 10, 2016

Copy link
Copy Markdown
Member

I just tested it, and it seems to work, so merging.

@BookOwl
BookOwl merged commit 54b0dea into PySlither:master Jun 10, 2016
@BookOwl BookOwl mentioned this pull request Jun 10, 2016
@CosmicWebServices

Copy link
Copy Markdown
Contributor Author

Nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants