Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove ignore of E731 #1689

Merged
merged 11 commits into from
Nov 7, 2017
Merged

Conversation

horpto
Copy link
Contributor

@horpto horpto commented Nov 2, 2017

No description provided.

datapath = lambda fname: os.path.join(module_path, 'test_data', fname)


def datapath(fname):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please create utils file and move this function (replace to import everywhere).

def datapath(fname):
return os.path.join(module_path, 'test_data', fname)


def testfile():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as datapath

@@ -25,8 +25,6 @@
from gensim.test import basetmtests

module_path = os.path.dirname(__file__) # needed because sample data files are located in the same folder
datapath = lambda fname: os.path.join(module_path, 'test_data', fname)


# set up vars used in testing ("Deerwester" from the web tutorial)
texts = [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as datapath

@@ -27,6 +24,7 @@
from gensim.models import atmodel
from gensim import matutils
from gensim.test import basetmtests
from gensim.test.utils import (datapath, get_tmpfile)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

useless () (here and anywhere)

@@ -507,7 +498,7 @@ def testPersistence(self):
self.assertTrue(np.allclose(model.state.gamma, model2.state.gamma))

def testPersistenceIgnore(self):
fname = testfile('testPersistenceIgnore')
fname = get_tmpfile('gensim_models_atmodel_testPersistenceIgnore.tst')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's a good idea to use same notation, what's your choice?

@@ -36,9 +34,6 @@
# increases the bound.
# Test that models are compatiple across versions, as done in LdaModel.

module_path = os.path.dirname(__file__) # needed because sample data files are located in the same folder
datapath = lambda fname: os.path.join(module_path, 'test_data', fname)

# set up vars used in testing ("Deerwester" from the web tutorial)
texts = [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This text used in many places, maybe move to utils too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm,

  1. it's data, not utils/functions
  2. maybe in another PR ?

Copy link
Contributor

@menshikh-iv menshikh-iv Nov 6, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Yeah, but it's "common resource", I think that's fine.
  2. No need to create distinct PR for this change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Ok, I'll fix it.
  2. small PR is better to review and faster to merge.

module_path = os.path.dirname(__file__) # needed because sample data files are located in the same folder


def datapath(fname):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add docstring in numpy-style for both functions

gensim/utils.py Outdated
compress = False
subname = lambda *args: '.'.join(list(args) + ['npy'])
return compress, subname
[compress, suffix] = (True, 'npz') if fname.endswith('.gz') or fname.endswith('.bz2') else (False, 'npy')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

useless []

@menshikh-iv menshikh-iv closed this Nov 7, 2017
@menshikh-iv menshikh-iv reopened this Nov 7, 2017
@menshikh-iv
Copy link
Contributor

close/open for init AppVeyor

@menshikh-iv menshikh-iv merged commit 2bb8e1d into piskvorky:develop Nov 7, 2017
@menshikh-iv
Copy link
Contributor

Great work @horpto🥇, you are very active in the gensim project 👍 👍 👍

@horpto horpto deleted the refactoring-1644-E731 branch November 7, 2017 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants