Skip to content

Commit 4b5c95a

Browse files
authored
Merge pull request #11 from ericsk/master
Modify the package import path to enhance the compatibility.
2 parents 1cd153f + 1e68ace commit 4b5c95a

21 files changed

+77
-99
lines changed

samples/language/spellcheck_samples.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ def spellcheck(subscription_key):
4545

4646

4747
if __name__ == "__main__":
48-
import sys
49-
import os.path
50-
sys.path.append(os.path.abspath(os.path.join(__file__, "..", "..")))
51-
from tools import execute_samples
52-
execute_samples(globals(), SUBSCRIPTION_KEY)
48+
import sys, os.path
49+
sys.path.append(os.path.abspath(os.path.join(__file__, "..", "..", "..")))
50+
from samples.tools import execute_samples
51+
execute_samples(globals(), SUBSCRIPTION_KEY_ENV_NAME)

samples/language/text_analytics_samples.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,7 @@ def entity_recognition():
144144
# </entityRecognition>
145145

146146
if __name__ == "__main__":
147-
import sys
148-
import os.path
149-
150-
sys.path.append(os.path.abspath(os.path.join(__file__, "..", "..")))
151-
from tools import execute_samples
152-
key_env_name = "TEXTANALYTICS_SUBSCRIPTION_KEY"
153-
execute_samples(globals(), key_env_name)
147+
import sys, os.path
148+
sys.path.append(os.path.abspath(os.path.join(__file__, "..", "..", "..")))
149+
from samples.tools import execute_samples
150+
execute_samples(globals(), SUBSCRIPTION_KEY_ENV_NAME)

samples/search/custom_search_samples.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ def custom_search_web_page_result_lookup(subscription_key):
3030

3131

3232
if __name__ == "__main__":
33-
import sys
34-
import os.path
35-
sys.path.append(os.path.abspath(os.path.join(__file__, "..", "..")))
36-
from tools import execute_samples
37-
execute_samples(globals(), SUBSCRIPTION_KEY)
33+
import sys, os.path
34+
sys.path.append(os.path.abspath(os.path.join(__file__, "..", "..", "..")))
35+
from samples.tools import execute_samples
36+
execute_samples(globals(), SUBSCRIPTION_KEY_ENV_NAME)

samples/search/entity_search_samples.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,6 @@ def error(subscription_key):
215215

216216
if __name__ == "__main__":
217217
import sys, os.path
218-
sys.path.append(os.path.abspath(os.path.join(__file__, "..", "..")))
218+
sys.path.append(os.path.abspath(os.path.join(__file__, "..", "..", "..")))
219219
from samples.tools import execute_samples
220-
import execute_samples
221220
execute_samples(globals(), SUBSCRIPTION_KEY_ENV_NAME)

samples/search/image_search_samples.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,6 @@ def image_detail(subscription_key):
240240

241241
if __name__ == "__main__":
242242
import sys, os.path
243-
sys.path.append(os.path.abspath(os.path.join(__file__, "..", "..")))
243+
sys.path.append(os.path.abspath(os.path.join(__file__, "..", "..", "..")))
244244
from samples.tools import execute_samples
245245
execute_samples(globals(), SUBSCRIPTION_KEY_ENV_NAME)

samples/search/news_search_samples.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,7 @@ def news_trending(subscription_key):
146146

147147

148148
if __name__ == "__main__":
149-
import sys
150-
import os.path
151-
sys.path.append(os.path.abspath(os.path.join(__file__, "..", "..")))
152-
from tools import execute_samples
153-
execute_samples(globals(), SUBSCRIPTION_KEY)
149+
import sys, os.path
150+
sys.path.append(os.path.abspath(os.path.join(__file__, "..", "..", "..")))
151+
from samples.tools import execute_samples
152+
execute_samples(globals(), SUBSCRIPTION_KEY_ENV_NAME)

samples/search/video_search_samples.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,7 @@ def video_detail(subscription_key):
160160

161161

162162
if __name__ == "__main__":
163-
import sys
164-
import os.path
165-
sys.path.append(os.path.abspath(os.path.join(__file__, "..", "..")))
166-
from tools import execute_samples
167-
execute_samples(globals(), SUBSCRIPTION_KEY)
163+
import sys, os.path
164+
sys.path.append(os.path.abspath(os.path.join(__file__, "..", "..", "..")))
165+
from samples.tools import execute_samples
166+
execute_samples(globals(), SUBSCRIPTION_KEY_ENV_NAME)

samples/search/visual_search_samples.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,7 @@ def search_url_with_json(subscription_key):
290290

291291

292292
if __name__ == "__main__":
293-
import sys
294-
import os.path
295-
sys.path.append(os.path.abspath(os.path.join(__file__, "..", "..")))
296-
from tools import execute_samples
297-
execute_samples(globals(), SUBSCRIPTION_KEY)
293+
import sys, os.path
294+
sys.path.append(os.path.abspath(os.path.join(__file__, "..", "..", "..")))
295+
from samples.tools import execute_samples
296+
execute_samples(globals(), SUBSCRIPTION_KEY_ENV_NAME)

samples/search/web_search_samples.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,7 @@ def web_search_with_answer_count_promote_and_safe_search(subscription_key):
160160

161161

162162
if __name__ == "__main__":
163-
import sys
164-
import os.path
165-
sys.path.append(os.path.abspath(os.path.join(__file__, "..", "..")))
166-
from tools import execute_samples
167-
execute_samples(globals(), SUBSCRIPTION_KEY)
163+
import sys, os.path
164+
sys.path.append(os.path.abspath(os.path.join(__file__, "..", "..", "..")))
165+
from samples.tools import execute_samples
166+
execute_samples(globals(), SUBSCRIPTION_KEY_ENV_NAME)

samples/vision/computer_vision_samples.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,7 @@ def recognize_printed_text_in_stream(subscription_key):
104104

105105

106106
if __name__ == "__main__":
107-
import sys
108-
import os.path
109-
sys.path.append(os.path.abspath(os.path.join(__file__, "..", "..")))
110-
from tools import execute_samples
107+
import sys, os.path
108+
sys.path.append(os.path.abspath(os.path.join(__file__, "..", "..", "..")))
109+
from samples.tools import execute_samples
111110
execute_samples(globals(), SUBSCRIPTION_KEY_ENV_NAME)

0 commit comments

Comments
 (0)