zhtwd / lctool Goto Github PK
View Code? Open in Web Editor NEWLeetcode command line tool
Leetcode command line tool
One issue is file extension name:
In run.py, line 29 filepath += '.' + lang
shall be updated to
if lang == 'python': filepath += '.py' else: filepath += '.' + lang
Seems similar issues exist for javascript (have not fully tested it).
Another issue is the symbols used for comments:
'/' and '/' were used no matter what programming language was chosen.
They both shall be changed to '"""' for python files.
Besides, it might be helpful to include a detailed instruction on how to change language in func.py.
We can discuss.
问题出在fun.py的66 - 78行,在运行codesj = [cj + '}' if not cj.endswith('}') else '{' + cj for cj in codesj]
时,除了头尾两个cj可以正常存进codeinfo这个dict中,中间cj存进去的都为空。
因为在进行if not cj.endswith('}')
判断时,中间的cj既不是以'{'开头,也不是以'}'结尾,没有在'{}'中,所以就没有存进codeinfo这个dict中。
我的解决方法是将给cj添加'{}'的过程写在js = str(cj).replace("'", "\"")
之前,用if cj.endswith('}')
和cj.startswith('{')
给头尾两个cj添加'{'或'}',剩下的cj再在头尾添加'{'和'}'。cj = '{' + cj + '}'
get this message when trying to install.
error in lctool setup command: ("EntryPoint must be in 'name=module:attrs [extras]' format", 'lc-get = lctool.run: lcget')
I am using macOS + python2.7
I've tried to add fake user-agent string for every request, but it didn't work.
It seems the website sees through the actual python requests agent after the first post request (in submit_problem), where a payload with login name and password is delivered. I guess this is probably where the problem is.
hi, I met an error when tried to run the command:
lc-submit -p ./array/3sum.cpp
error detail:
output:
Traceback (most recent call last):
File "/usr/local/bin/lc-submit", line 9, in
load_entry_point('lctool==0.1.0.dev0', 'console_scripts', 'lc-submit')()
File "build/bdist.linux-x86_64/egg/lctool/run.py", line 60, in submit
File "build/bdist.linux-x86_64/egg/lctool/func.py", line 106, in submit_problem
File "/usr/lib/python2.7/dist-packages/requests/models.py", line 741, in json
return json.loads(self.text, **kwargs)
File "/usr/lib/python2.7/json/init.py", line 338, in loads
return _default_decoder.decode(s)
File "/usr/lib/python2.7/json/decoder.py", line 366, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python2.7/json/decoder.py", line 384, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded
env: ubuntu 14.04 python 2.7
source code: func.py line 103, tmp return state 405; line 105 midres1 return state 405
我的anaconda 默认是python3, 试着安装的时候出了如下错误,能帮着看看怎么解决吗?多谢
[Anaconda3] C:\Users\Delong\lctool>python setup.py install
C:\Anaconda3\lib\site-packages\setuptools-18.4-py3.5.egg\setuptools\dist.py:285:
UserWarning: Normalizing '0.1.0.dev' to '0.1.0.dev0'
running install
running bdist_egg
running egg_info
creating lctool.egg-info
writing dependency_links to lctool.egg-info\dependency_links.txt
writing lctool.egg-info\PKG-INFO
writing top-level names to lctool.egg-info\top_level.txt
writing requirements to lctool.egg-info\requires.txt
writing entry points to lctool.egg-info\entry_points.txt
writing manifest file 'lctool.egg-info\SOURCES.txt'
reading manifest file 'lctool.egg-info\SOURCES.txt'
writing manifest file 'lctool.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
creating build
creating build\lib
creating build\lib\lctool
copying lctool\func.py -> build\lib\lctool
copying lctool\run.py -> build\lib\lctool
copying lctool\version.py -> build\lib\lctool
copying lctool__init__.py -> build\lib\lctool
creating build\bdist.win-amd64
creating build\bdist.win-amd64\egg
creating build\bdist.win-amd64\egg\lctool
copying build\lib\lctool\func.py -> build\bdist.win-amd64\egg\lctool
copying build\lib\lctool\run.py -> build\bdist.win-amd64\egg\lctool
copying build\lib\lctool\version.py -> build\bdist.win-amd64\egg\lctool
copying build\lib\lctool__init__.py -> build\bdist.win-amd64\egg\lctool
byte-compiling build\bdist.win-amd64\egg\lctool\func.py to func.cpython-35.pyc
byte-compiling build\bdist.win-amd64\egg\lctool\run.py to run.cpython-35.pyc
File "build\bdist.win-amd64\egg\lctool\run.py", line 23
print 'getting problem: ', tag, problem
^
SyntaxError: Missing parentheses in call to 'print'
byte-compiling build\bdist.win-amd64\egg\lctool\version.py to version.cpython-35
.pyc
byte-compiling build\bdist.win-amd64\egg\lctool__init__.py to init.cpython-
35.pyc
creating build\bdist.win-amd64\egg\EGG-INFO
copying lctool.egg-info\PKG-INFO -> build\bdist.win-amd64\egg\EGG-INFO
copying lctool.egg-info\SOURCES.txt -> build\bdist.win-amd64\egg\EGG-INFO
copying lctool.egg-info\dependency_links.txt -> build\bdist.win-amd64\egg\EGG-IN
FO
copying lctool.egg-info\entry_points.txt -> build\bdist.win-amd64\egg\EGG-INFO
copying lctool.egg-info\requires.txt -> build\bdist.win-amd64\egg\EGG-INFO
copying lctool.egg-info\top_level.txt -> build\bdist.win-amd64\egg\EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating dist
creating 'dist\lctool-0.1.0.dev0-py3.5.egg' and adding 'build\bdist.win-amd64\eg
g' to it
removing 'build\bdist.win-amd64\egg' (and everything under it)
Processing lctool-0.1.0.dev0-py3.5.egg
Copying lctool-0.1.0.dev0-py3.5.egg to c:\anaconda3\lib\site-packages
Adding lctool 0.1.0.dev0 to easy-install.pth file
Installing lc-get-script.py script to C:\Anaconda3\Scripts
Installing lc-get.exe script to C:\Anaconda3\Scripts
Installing lc-submit-script.py script to C:\Anaconda3\Scripts
Installing lc-submit.exe script to C:\Anaconda3\Scripts
Installed c:\anaconda3\lib\site-packages\lctool-0.1.0.dev0-py3.5.egg
Processing dependencies for lctool==0.1.0.dev0
Searching for BeautifulSoup
Reading https://pypi.python.org/simple/BeautifulSoup/
Best match: BeautifulSoup 3.2.1
Downloading https://pypi.python.org/packages/source/B/BeautifulSoup/BeautifulSou
p-3.2.1.tar.gz#md5=44656527ef3ac9874ac4d1c9f35f70ee
Processing BeautifulSoup-3.2.1.tar.gz
Writing C:\Users\Delong\AppData\Local\Temp\easy_install-gxhwv641\BeautifulSoup-3
.2.1\setup.cfg
Running BeautifulSoup-3.2.1\setup.py -q bdist_egg --dist-dir C:\Users\Delong\App
Data\Local\Temp\easy_install-gxhwv641\BeautifulSoup-3.2.1\egg-dist-tmp-yynrtkqe
Traceback (most recent call last):
File "C:\Anaconda3\lib\site-packages\setuptools-18.4-py3.5.egg\setuptools\sand
box.py", line 152, in save_modules
File "C:\Anaconda3\lib\site-packages\setuptools-18.4-py3.5.egg\setuptools\sand
box.py", line 193, in setup_context
File "C:\Anaconda3\lib\site-packages\setuptools-18.4-py3.5.egg\setuptools\sand
box.py", line 237, in run_setup
File "C:\Anaconda3\lib\site-packages\setuptools-18.4-py3.5.egg\setuptools\sand
box.py", line 267, in run
File "C:\Anaconda3\lib\site-packages\setuptools-18.4-py3.5.egg\setuptools\sand
box.py", line 236, in runner
File "C:\Anaconda3\lib\site-packages\setuptools-18.4-py3.5.egg\setuptools\sand
box.py", line 45, in _execfile
File "C:\Users\Delong\AppData\Local\Temp\easy_install-gxhwv641\BeautifulSoup-3
.2.1\setup.py", line 22
print "Unit tests have failed!"
^
SyntaxError: Missing parentheses in call to 'print'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "setup.py", line 53, in
"Topic :: Utilities",
File "C:\Anaconda3\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\Anaconda3\lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "C:\Anaconda3\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Anaconda3\lib\site-packages\setuptools-18.4-py3.5.egg\setuptools\comm
and\install.py", line 67, in run
File "C:\Anaconda3\lib\site-packages\setuptools-18.4-py3.5.egg\setuptools\comm
and\install.py", line 117, in do_egg_install
File "C:\Anaconda3\lib\site-packages\setuptools-18.4-py3.5.egg\setuptools\comm
and\easy_install.py", line 389, in run
File "C:\Anaconda3\lib\site-packages\setuptools-18.4-py3.5.egg\setuptools\comm
and\easy_install.py", line 619, in easy_install
File "C:\Anaconda3\lib\site-packages\setuptools-18.4-py3.5.egg\setuptools\comm
and\easy_install.py", line 670, in install_item
File "C:\Anaconda3\lib\site-packages\setuptools-18.4-py3.5.egg\setuptools\comm
and\easy_install.py", line 718, in process_distribution
File "C:\Anaconda3\lib\site-packages\setuptools-18.4-py3.5.egg\pkg_resources_
init_.py", line 836, in resolve
File "C:\Anaconda3\lib\site-packages\setuptools-18.4-py3.5.egg\pkg_resources_
init_.py", line 1081, in best_match
File "C:\Anaconda3\lib\site-packages\setuptools-18.4-py3.5.egg\pkg_resources_
init_.py", line 1093, in obtain
File "C:\Anaconda3\lib\site-packages\setuptools-18.4-py3.5.egg\setuptools\comm
and\easy_install.py", line 638, in easy_install
File "C:\Anaconda3\lib\site-packages\setuptools-18.4-py3.5.egg\setuptools\comm
and\easy_install.py", line 668, in install_item
File "C:\Anaconda3\lib\site-packages\setuptools-18.4-py3.5.egg\setuptools\comm
and\easy_install.py", line 851, in install_eggs
File "C:\Anaconda3\lib\site-packages\setuptools-18.4-py3.5.egg\setuptools\comm
and\easy_install.py", line 1079, in build_and_install
File "C:\Anaconda3\lib\site-packages\setuptools-18.4-py3.5.egg\setuptools\comm
and\easy_install.py", line 1065, in run_setup
File "C:\Anaconda3\lib\site-packages\setuptools-18.4-py3.5.egg\setuptools\sand
box.py", line 240, in run_setup
File "C:\Anaconda3\lib\contextlib.py", line 77, in exit
self.gen.throw(type, value, traceback)
File "C:\Anaconda3\lib\site-packages\setuptools-18.4-py3.5.egg\setuptools\sand
box.py", line 193, in setup_context
File "C:\Anaconda3\lib\contextlib.py", line 77, in exit
self.gen.throw(type, value, traceback)
File "C:\Anaconda3\lib\site-packages\setuptools-18.4-py3.5.egg\setuptools\sand
box.py", line 164, in save_modules
File "C:\Anaconda3\lib\site-packages\setuptools-18.4-py3.5.egg\setuptools\sand
box.py", line 139, in resume
File "C:\Anaconda3\lib\site-packages\setuptools-18.4-py3.5.egg\setuptools\comp
at.py", line 65, in reraise
File "C:\Anaconda3\lib\site-packages\setuptools-18.4-py3.5.egg\setuptools\sand
box.py", line 152, in save_modules
File "C:\Anaconda3\lib\site-packages\setuptools-18.4-py3.5.egg\setuptools\sand
box.py", line 193, in setup_context
File "C:\Anaconda3\lib\site-packages\setuptools-18.4-py3.5.egg\setuptools\sand
box.py", line 237, in run_setup
File "C:\Anaconda3\lib\site-packages\setuptools-18.4-py3.5.egg\setuptools\sand
box.py", line 267, in run
File "C:\Anaconda3\lib\site-packages\setuptools-18.4-py3.5.egg\setuptools\sand
box.py", line 236, in runner
File "C:\Anaconda3\lib\site-packages\setuptools-18.4-py3.5.egg\setuptools\sand
box.py", line 45, in _execfile
File "C:\Users\Delong\AppData\Local\Temp\easy_install-gxhwv641\BeautifulSoup-3
.2.1\setup.py", line 22
print "Unit tests have failed!"
^
SyntaxError: Missing parentheses in call to 'print'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.