Giter VIP home page Giter VIP logo

migrate's People

Contributors

gim- avatar kofrasa avatar vkvych avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

migrate's Issues

The `pwd` package is missing in Windows OS

Unable to install the migrate package on Windows 10 OS:

(venv) C:\Users\vkvych\Projects\migrate-test>python --version
Python 3.6.1

(venv) C:\Users\vkvych\Projects\migrate-test>pip list
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
pip (9.0.1)
setuptools (38.2.3)

(venv) C:\Users\vkvych\Projects\migrate-test>pip install migrate
Collecting migrate
  Using cached migrate-0.3.8.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\vkvych\AppData\Local\Temp\pip-build-23l1g8c8\migrate\setup.py", line 26, in <module>
        import migrate
      File "C:\Users\vkvych\AppData\Local\Temp\pip-build-23l1g8c8\migrate\migrate.py", line 18, in <module>
        import pwd
    ModuleNotFoundError: No module named 'pwd'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\vkvych\AppData\Local\Temp\pip-build-23l1g8c8\migrate\

Comply with E731: do not assign a lambda expression, use a def

migrate.py:206:1: exec_sqlite3 = lambda a, b, c, d: exec_mysql(a, b, None, d)
According to PEP8 this is an anti pattern.

See Programming Recommendations:

Always use a def statement instead of an assignment statement that binds a lambda expression directly to an identifier.

Yes:

def f(x): return 2*x

No:

f = lambda x: 2*x

The first form means that the name of the resulting function object is specifically 'f' instead of the generic ''. This is more useful for tracebacks and string representations in general. The use of the assignment statement eliminates the sole benefit a lambda expression can offer over an explicit def statement (i.e. that it can be embedded inside a larger expression)

Also, is it even being used? I couldn't find any reference to exec_sqlite3 in the code at all.

Calling `os.getlogin()` function breaks migrate

When I'm trying to launch migrate the following exception ccurs:

Traceback (most recent call last):
  File "/home/gim/.local/share/virtualenvs/flask/bin/migrate", line 11, in <module>
    sys.exit(main())
  File "/home/gim/.local/share/virtualenvs/flask/lib/python3.5/site-packages/migrate.py", line 240, in main
    login_name = os.getlogin()
FileNotFoundError: [Errno 2] No such file or directory

It seems like os.getlogin() is broken or not very stable. Maybe change it to pwd.getpwuid(os.getuid())[0] as documentation suggests?

OS: Arch Linux x86_64
Python version: 3.5.1

Comply with E402: module level import not at top of file

migrate.py:15-23
According to PEP8, all module level imports should be on top of the file.

See Code lay-out:

Imports are always put at the top of the file, just after any module comments and docstrings, and before module globals and constants.

Imports should be grouped in the following order:

standard library imports
related third party imports
local application/library specific imports

You should put a blank line between each group of imports.

Put any relevant __all__ specification after the imports.

`argparse.ArgumentParser` does not expect `version` argument

version parameter doesn't exist which causes an exception to be thrown when launching migrate or test_migrate.

Traceback (most recent call last):
  File "migrate.py", line 328, in <module>
    main()
  File "migrate.py", line 262, in main
    """)
TypeError: __init__() got an unexpected keyword argument 'version'
======================================================================
ERROR: test_config_file (__main__.MigrateTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test_migrate.py", line 92, in test_config_file
    migrate.main('-f', filename, '--env', 'test', 'reset')
  File "/home/gim/Workspace/migrate/migrate.py", line 262, in main
    """)
TypeError: __init__() got an unexpected keyword argument 'version'

https://docs.python.org/3.5/library/argparse.html#argparse.ArgumentParser
Python version: 3.5.1

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.