-
Notifications
You must be signed in to change notification settings - Fork 0
/
example_doc.py
executable file
·36 lines (30 loc) · 1.1 KB
/
example_doc.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Example of documentation for the whole project
"""
__author__ = """Giovanni Colavizza, Matteo Romanello"""
import os
def hello():
"""
prints "Hello World" to the standard output.
:return: None
"""
print("Hello World!")
def get_mongodb_sandbox(config_file=os.path.join(_current_dir,"../annotation_connector/config_files/LB_machine_sandbox.conf")):
"""
Initialise a connection to the MongoDB according
to the specified configuration file.
:param config_file: the path to the configuration file
:return: a DB connection (type = `pymongo.database.Database`)
"""
config = ConfigParser.ConfigParser(allow_no_value=True)
config.read(config_file)
mongo_host = config.get('mongo','db-host')
mongo_db = config.get('mongo','db-name')
mongo_port = config.getint('mongo','db-port')
mongo_user = config.get('mongo','username')
mongo_pwd = config.get('mongo','password')
mongo_auth = config.get('mongo','auth-db')
loader = ContentLoader(mongo_host,mongo_db,mongo_user,mongo_pwd,mongo_auth)
return loader.db