Skip to content
Snippets Groups Projects
Commit 160bf4aa authored by jacques.grelet_ird.fr's avatar jacques.grelet_ird.fr
Browse files

format with autopip8

parent eede25ae
No related branches found
No related tags found
No related merge requests found
Sous Windows, VSCode et Python 3.6 Sous Windows, VSCode et Python 3.7.2
> pip3 > pip3
Fatal error in launcher: Unable to create process using '"' Fatal error in launcher: Unable to create process using '"'
[ntird-us191-jg4:jgrelet]/c/git/python/pirata [ntird-us191-jg4:jgrelet]/c/git/python/pirata
> python3 -m pip install --upgrade pip > python3 -m pip install --upgrade pip
Collecting pip ...
Downloading https://files.pythonhosted.org/packages/d8/f3/413bab4ff08e1fc4828dfc59996d721917df8e8583ea85385d51125dceff/pip-19.0.3-py2.py3-none-any.whl (1.4MB)
100% |████████████████████████████████| 1.4MB 72kB/s
Installing collected packages: pip
Found existing installation: pip 9.0.1
Uninstalling pip-9.0.1:
Successfully uninstalled pip-9.0.1
Successfully installed pip-19.0.3 Successfully installed pip-19.0.3
[ntird-us191-jg4:jgrelet]/c/git/python/pirata [ntird-us191-jg4:jgrelet]/c/git/python/pirata
> pip install toml > pip install toml
...@@ -56,4 +50,10 @@ Configuration du fichier setting.json de jgrelet: ...@@ -56,4 +50,10 @@ Configuration du fichier setting.json de jgrelet:
Pour utiliser le bash de git, modifier la ligne: Pour utiliser le bash de git, modifier la ligne:
"terminal.integrated.shell.windows": "C:\\MinGW\\msys\\1.0\\bin\\bash.exe", "terminal.integrated.shell.windows": "C:\\MinGW\\msys\\1.0\\bin\\bash.exe",
par par
"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe", "terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe",
\ No newline at end of file
Autoformatting
----------------------
> pip install autopep8
Installer l'extension Python-autopep8
Cmd+P choisir autopip
\ No newline at end of file
This diff is collapsed.
...@@ -2,35 +2,46 @@ ...@@ -2,35 +2,46 @@
code roscop code roscop
""" """
import csv, shelve,sys import csv
import shelve
import sys
# class roscop
class db:
def __setattr__(self, name, value):
self.__dict__[name] = value
# class roscop
# ------------ # ------------
class Roscop: class Roscop:
# constructor with values by default # constructor with values by default
def __init__(self, file): def __init__(self, file):
self.file = file self.file = file
# call by print() # call by print()
def __repr__(self): def __repr__(self):
return "class Roscop, file: {}".format(self.file) #print("%s:" % row[key], end='')
# print()
# read code roscop file return "class Roscop, file: {}".format(self.file)
def read(self):
print("Code roscop file: %s" % self.file) # read code roscop file
with open(self.file, 'rt') as f: def read(self):
reader = csv.DictReader(f, delimiter=';') print("Code roscop file: %s" % self.file)
print(reader.fieldnames) with open(self.file, 'rt') as f:
for row in reader: reader = csv.DictReader(f, delimiter=';')
for key in reader.fieldnames: for row in reader:
print("%s:" % row[key], end='') d = db()
print() for key in reader.fieldnames:
return d.key = row[key]
return
# for testing in standalone context # for testing in standalone context
# --------------------------------- # ---------------------------------
if __name__ == "__main__": if __name__ == "__main__":
from roscop import Roscop from roscop import Roscop
r = Roscop("code_roscop.csv").read() r = Roscop("code_roscop.csv").read()
print(r) print(r)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment