Passed
Pull Request — master (#2)
by Yang
02:09
created

Python.LocalDB.create_CNBP.create_localDB_CNBP()   A

Complexity

Conditions 1

Size

Total Lines 23
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 23
rs 9.85
c 0
b 0
f 0
cc 1
nop 1
1
#This file create a SQLite local database for CNBP requirement.
0 ignored issues
show
Coding Style Naming introduced by
The name create_CNBP does not conform to the module naming conventions ((([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This module should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
2
#Creation: 2018-07-11T160228EST
3
#Author: Yang Ding
4
5
import os
6
from dotenv import load_dotenv
7
from LocalDB.create import LocalDBCreate
0 ignored issues
show
Bug introduced by
The name create does not seem to exist in module LocalDB.
Loading history...
introduced by
Unable to import 'LocalDB.create'
Loading history...
8
from LocalDB import schema
0 ignored issues
show
Bug introduced by
The name schema does not seem to exist in module LocalDB.
Loading history...
9
10
11
def create_localDB_CNBP(Path):
0 ignored issues
show
Coding Style Naming introduced by
The name create_localDB_CNBP does not conform to the function naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name Path does not conform to the argument naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
12
13
    # name of the TableName to be created
14
15
16
    #Create the PRIMARY KEY column.
17
18
19
    load_dotenv()
20
21
    username = os.getenv("LORISusername")
0 ignored issues
show
Unused Code introduced by
The variable username seems to be unused.
Loading history...
22
    password = os.getenv("LORISpassword")
0 ignored issues
show
Unused Code introduced by
The variable password seems to be unused.
Loading history...
23
24
    # Create the variable array that store the columns information to be used later in loop for column creation
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (111/100).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
25
    TableName = schema.CNBP_schema_table_name
0 ignored issues
show
Coding Style Naming introduced by
The name TableName does not conform to the variable naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
26
    KeyField = schema.CNBP_schema_keyfield
0 ignored issues
show
Coding Style Naming introduced by
The name KeyField does not conform to the variable naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
27
    NewColumns = schema.CNBP_schema_fields
0 ignored issues
show
Coding Style Naming introduced by
The name NewColumns does not conform to the variable naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
28
    NewColumnsTypes = schema.CNBP_schema_fields_types
0 ignored issues
show
Coding Style Naming introduced by
The name NewColumnsTypes does not conform to the variable naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
29
30
    NewColumnSpec = zip(NewColumns, NewColumnsTypes)
0 ignored issues
show
Coding Style Naming introduced by
The name NewColumnSpec does not conform to the variable naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
31
    NewColumnSpecList = list(NewColumnSpec)
0 ignored issues
show
Coding Style Naming introduced by
The name NewColumnSpecList does not conform to the variable naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
32
33
    return LocalDBCreate(Path, TableName, KeyField, NewColumnSpecList)
34
35
# Only executed when running directly.
36
if __name__ == '__main__':
37
    create_localDB_CNBP("..\LocalDB\LocalDB_CNBPs.sqlite")
0 ignored issues
show
Coding Style introduced by
Final newline missing
Loading history...
Bug introduced by
A suspicious escape sequence \L was found. Did you maybe forget to add an r prefix?

Escape sequences in Python are generally interpreted according to rules similar to standard C. Only if strings are prefixed with r or R are they interpreted as regular expressions.

The escape sequence that was used indicates that you might have intended to write a regular expression.

Learn more about the available escape sequences. in the Python documentation.

Loading history...