This repository was archived by the owner on Mar 8, 2020. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11## client-python [ ![ Build Status] ( https://travis-ci.org/bblfsh/client-python.svg?branch=master )] ( https://travis-ci.org/bblfsh/client-python ) [ ![ PyPI] ( https://img.shields.io/pypi/v/bblfsh.svg )] ( https://pypi.python.org/pypi/bblfsh )
22
33[ Babelfish] ( https://doc.bblf.sh ) Python client library provides functionality to both
4- connect to the Babelfish server to parse code
4+ connect to the Babelfish bblfshd to parse code
55(obtaining an [ UAST] ( https://doc.bblf.sh/uast/specification.html ) as a result)
66and to analyse UASTs with the functionality provided by [ libuast] ( https://github.com/bblfsh/libuast ) .
77
@@ -37,10 +37,11 @@ A small example of how to parse a Python file and extract the import declaration
3737If you don't have a bblfsh server running you can execute it using the following command:
3838
3939``` sh
40- docker run --privileged --rm -it -p 9432:9432 --name bblfsh bblfsh/server
40+ docker run --privileged --rm -it -p 9432:9432 -v bblfsh_cache:/var/lib/bblfshd --name bblfshd bblfsh/bblfshd
41+ docker exec -it bblfshd bblfshctl driver install python bblfsh/python-driver:latest
4142```
4243
43- Please, read the [ getting started] ( https://doc.bblf.sh/user/getting-started.html ) guide to learn more about how to use and deploy a bblfsh server .
44+ Please, read the [ getting started] ( https://doc.bblf.sh/user/getting-started.html ) guide to learn more about how to use and deploy a bblfshd .
4445
4546``` python
4647from bblfsh import BblfshClient, filter
Original file line number Diff line number Diff line change 1+ import os
12import unittest
23
34import docker
@@ -117,7 +118,10 @@ def testFilterBadQuery(self):
117118 self .assertRaises (RuntimeError , filter , node , "//*roleModule" )
118119
119120 def testIssue60 (self ):
120- rep = self .client .parse ("fixtures/issue60.py" )
121+ fixtures_dir = os .path .join (
122+ os .path .dirname (os .path .realpath (__file__ )),
123+ "fixtures" )
124+ rep = self .client .parse (os .path .join (fixtures_dir , "issue60.py" ))
121125 assert (rep .uast )
122126 self .assertFalse (any (filter (rep .uast , "//@roleLiteral" )))
123127
Original file line number Diff line number Diff line change 1010SDK_MAJOR = SDK_VERSION .split ('.' )[0 ]
1111PYTHON = "python3"
1212
13-
13+ os .environ ["CC" ] = "g++"
14+ os .environ ["CXX" ] = "g++"
1415libraries = ['xml2' ]
1516sources = ['bblfsh/pyuast.c' ]
1617
You can’t perform that action at this time.
0 commit comments