Skip to content

Commit e6f55e3

Browse files
committed
FIX sensor_sim
1 parent ff1e775 commit e6f55e3

File tree

2 files changed

+8
-358
lines changed

2 files changed

+8
-358
lines changed

.pylintrc

Lines changed: 0 additions & 350 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,4 @@
1-
# This Pylint rcfile contains a best-effort configuration to uphold the
2-
# best-practices and style described in the Google Python style guide:
3-
# https://google.github.io/styleguide/pyguide.html
4-
#
5-
# Its canonical open-source location is:
6-
# https://google.github.io/styleguide/pylintrc
7-
81
[MASTER]
9-
10-
# Add files or directories to the blacklist. They should be base names, not
11-
# paths.
12-
ignore=third_party
13-
14-
# Add files or directories matching the regex patterns to the blacklist. The
15-
# regex matches against base names, not paths.
16-
ignore-patterns=
17-
18-
# Pickle collected data for later comparisons.
19-
persistent=no
20-
21-
# List of plugins (as comma separated values of python modules names) to load,
22-
# usually to register additional checkers.
23-
load-plugins=
24-
25-
# Use multiple processes to speed up Pylint.
26-
jobs=4
27-
28-
# Allow loading of arbitrary C extensions. Extensions are imported into the
29-
# active Python interpreter and may run arbitrary code.
30-
unsafe-load-any-extension=no
31-
32-
# A comma-separated list of package or module names from where C extensions may
33-
# be loaded. Extensions are loading into the active Python interpreter and may
34-
# run arbitrary code
35-
extension-pkg-whitelist=
36-
37-
38-
[MESSAGES CONTROL]
39-
40-
# Only show warnings with the listed confidence levels. Leave empty to show
41-
# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED
42-
confidence=
43-
44-
# Enable the message, report, category or checker with the given id(s). You can
45-
# either give multiple identifier separated by comma (,) or put this option
46-
# multiple time (only on the command line, not in the configuration file where
47-
# it should appear only once). See also the "--disable" option for examples.
48-
#enable=
49-
50-
# Disable the message, report, category or checker with the given id(s). You
51-
# can either give multiple identifiers separated by comma (,) or put this
52-
# option multiple times (only on the command line, not in the configuration
53-
# file where it should appear only once).You can also use "--disable=all" to
54-
# disable everything first and then reenable specific checks. For example, if
55-
# you want to run only the similarities checker, you can use "--disable=all
56-
# --enable=similarities". If you want to run only the classes checker, but have
57-
# no Warning level messages displayed, use"--disable=all --enable=classes
58-
# --disable=W"
592
disable=abstract-method,
603
apply-builtin,
614
arguments-differ,
@@ -156,296 +99,3 @@ disable=abstract-method,
15699
C0115, # missing-class-docstring
157100
C0116, # missing-function-docstring
158101
E1101, # instance has no member
159-
160-
161-
[REPORTS]
162-
163-
# Set the output format. Available formats are text, parseable, colorized, msvs
164-
# (visual studio) and html. You can also give a reporter class, eg
165-
# mypackage.mymodule.MyReporterClass.
166-
output-format=text
167-
168-
# Put messages in a separate file for each module / package specified on the
169-
# command line instead of printing them on stdout. Reports (if any) will be
170-
# written in a file name "pylint_global.[txt|html]". This option is deprecated
171-
# and it will be removed in Pylint 2.0.
172-
files-output=no
173-
174-
# Tells whether to display a full report or only the messages
175-
reports=no
176-
177-
# Python expression which should return a note less than 10 (10 is the highest
178-
# note). You have access to the variables errors warning, statement which
179-
# respectively contain the number of errors / warnings messages and the total
180-
# number of statements analyzed. This is used by the global evaluation report
181-
# (RP0004).
182-
evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
183-
184-
# Template used to display messages. This is a python new-style format string
185-
# used to format the message information. See doc for all details
186-
#msg-template=
187-
188-
189-
[BASIC]
190-
191-
# Good variable names which should always be accepted, separated by a comma
192-
good-names=main,_
193-
194-
# Bad variable names which should always be refused, separated by a comma
195-
bad-names=
196-
197-
# Colon-delimited sets of names that determine each other's naming style when
198-
# the name regexes allow several styles.
199-
name-group=
200-
201-
# Include a hint for the correct naming format with invalid-name
202-
include-naming-hint=no
203-
204-
# List of decorators that produce properties, such as abc.abstractproperty. Add
205-
# to this list to register other decorators that produce valid properties.
206-
property-classes=abc.abstractproperty,cached_property.cached_property,cached_property.threaded_cached_property,cached_property.cached_property_with_ttl,cached_property.threaded_cached_property_with_ttl
207-
208-
# Regular expression matching correct function names
209-
function-rgx=^(?:(?P<exempt>setUp|tearDown|setUpModule|tearDownModule)|(?P<camel_case>_?[A-Z][a-zA-Z0-9]*)|(?P<snake_case>_?[a-z][a-z0-9_]*))$
210-
211-
# Regular expression matching correct variable names
212-
variable-rgx=^[a-z][a-z0-9_]*$
213-
214-
# Regular expression matching correct constant names
215-
const-rgx=^(_?[A-Z][A-Z0-9_]*|__[a-z0-9_]+__|_?[a-z][a-z0-9_]*)$
216-
217-
# Regular expression matching correct attribute names
218-
attr-rgx=^_{0,2}[a-z][a-z0-9_]*$
219-
220-
# Regular expression matching correct argument names
221-
argument-rgx=^[a-z][a-z0-9_]*$
222-
223-
# Regular expression matching correct class attribute names
224-
class-attribute-rgx=^(_?[A-Z][A-Z0-9_]*|__[a-z0-9_]+__|_?[a-z][a-z0-9_]*)$
225-
226-
# Regular expression matching correct inline iteration names
227-
inlinevar-rgx=^[a-z][a-z0-9_]*$
228-
229-
# Regular expression matching correct class names
230-
class-rgx=^_?[A-Z][a-zA-Z0-9]*$
231-
232-
# Regular expression matching correct module names
233-
module-rgx=^(_?[a-z][a-z0-9_]*|__init__)$
234-
235-
# Regular expression matching correct method names
236-
method-rgx=(?x)^(?:(?P<exempt>_[a-z0-9_]+__|runTest|setUp|tearDown|setUpTestCase|tearDownTestCase|setupSelf|tearDownClass|setUpClass|(test|assert)_*[A-Z0-9][a-zA-Z0-9_]*|next)|(?P<camel_case>_{0,2}[A-Z][a-zA-Z0-9_]*)|(?P<snake_case>_{0,2}[a-z][a-z0-9_]*))$
237-
238-
# Regular expression which should only match function or class names that do
239-
# not require a docstring.
240-
no-docstring-rgx=(__.*__|main|test.*|.*test|.*Test)$
241-
242-
# Minimum line length for functions/classes that require docstrings, shorter
243-
# ones are exempt.
244-
docstring-min-length=10
245-
246-
247-
[TYPECHECK]
248-
249-
# List of decorators that produce context managers, such as
250-
# contextlib.contextmanager. Add to this list to register other decorators that
251-
# produce valid context managers.
252-
contextmanager-decorators=contextlib.contextmanager,contextlib2.contextmanager
253-
254-
# Tells whether missing members accessed in mixin class should be ignored. A
255-
# mixin class is detected if its name ends with "mixin" (case insensitive).
256-
ignore-mixin-members=yes
257-
258-
# List of module names for which member attributes should not be checked
259-
# (useful for modules/projects where namespaces are manipulated during runtime
260-
# and thus existing member attributes cannot be deduced by static analysis. It
261-
# supports qualified module names, as well as Unix pattern matching.
262-
ignored-modules=
263-
264-
# List of class names for which member attributes should not be checked (useful
265-
# for classes with dynamically set attributes). This supports the use of
266-
# qualified names.
267-
ignored-classes=optparse.Values,thread._local,_thread._local
268-
269-
# List of members which are set dynamically and missed by pylint inference
270-
# system, and so shouldn't trigger E1101 when accessed. Python regular
271-
# expressions are accepted.
272-
generated-members=
273-
274-
275-
[FORMAT]
276-
277-
# Maximum number of characters on a single line.
278-
max-line-length=80
279-
280-
# TODO(https://github.com/PyCQA/pylint/issues/3352): Direct pylint to exempt
281-
# lines made too long by directives to pytype.
282-
283-
# Regexp for a line that is allowed to be longer than the limit.
284-
ignore-long-lines=(?x)(
285-
^\s*(\#\ )?<?https?://\S+>?$|
286-
^\s*(from\s+\S+\s+)?import\s+.+$)
287-
288-
# Allow the body of an if to be on the same line as the test if there is no
289-
# else.
290-
single-line-if-stmt=yes
291-
292-
# List of optional constructs for which whitespace checking is disabled. `dict-
293-
# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}.
294-
# `trailing-comma` allows a space between comma and closing bracket: (a, ).
295-
# `empty-line` allows space-only lines.
296-
no-space-check=
297-
298-
# Maximum number of lines in a module
299-
max-module-lines=99999
300-
301-
# String used as indentation unit. The internal Google style guide mandates 2
302-
# spaces. Google's externaly-published style guide says 4, consistent with
303-
# PEP 8. Here, we use 2 spaces, for conformity with many open-sourced Google
304-
# projects (like TensorFlow).
305-
indent-string=' '
306-
307-
# Number of spaces of indent required inside a hanging or continued line.
308-
indent-after-paren=4
309-
310-
# Expected format of line ending, e.g. empty (any line ending), LF or CRLF.
311-
expected-line-ending-format=
312-
313-
314-
[MISCELLANEOUS]
315-
316-
# List of note tags to take in consideration, separated by a comma.
317-
notes=TODO
318-
319-
320-
[STRING]
321-
322-
# This flag controls whether inconsistent-quotes generates a warning when the
323-
# character used as a quote delimiter is used inconsistently within a module.
324-
check-quote-consistency=yes
325-
326-
327-
[VARIABLES]
328-
329-
# Tells whether we should check for unused import in __init__ files.
330-
init-import=no
331-
332-
# A regular expression matching the name of dummy variables (i.e. expectedly
333-
# not used).
334-
dummy-variables-rgx=^\*{0,2}(_$|unused_|dummy_)
335-
336-
# List of additional names supposed to be defined in builtins. Remember that
337-
# you should avoid to define new builtins when possible.
338-
additional-builtins=
339-
340-
# List of strings which can identify a callback function by name. A callback
341-
# name must start or end with one of those strings.
342-
callbacks=cb_,_cb
343-
344-
# List of qualified module names which can have objects that can redefine
345-
# builtins.
346-
redefining-builtins-modules=six,six.moves,past.builtins,future.builtins,functools
347-
348-
349-
[LOGGING]
350-
351-
# Logging modules to check that the string format arguments are in logging
352-
# function parameter format
353-
logging-modules=logging,absl.logging,tensorflow.io.logging
354-
355-
356-
[SIMILARITIES]
357-
358-
# Minimum lines number of a similarity.
359-
min-similarity-lines=4
360-
361-
# Ignore comments when computing similarities.
362-
ignore-comments=yes
363-
364-
# Ignore docstrings when computing similarities.
365-
ignore-docstrings=yes
366-
367-
# Ignore imports when computing similarities.
368-
ignore-imports=no
369-
370-
371-
[SPELLING]
372-
373-
# Spelling dictionary name. Available dictionaries: none. To make it working
374-
# install python-enchant package.
375-
spelling-dict=
376-
377-
# List of comma separated words that should not be checked.
378-
spelling-ignore-words=
379-
380-
# A path to a file that contains private dictionary; one word per line.
381-
spelling-private-dict-file=
382-
383-
# Tells whether to store unknown words to indicated private dictionary in
384-
# --spelling-private-dict-file option instead of raising a message.
385-
spelling-store-unknown-words=no
386-
387-
388-
[IMPORTS]
389-
390-
# Deprecated modules which should not be used, separated by a comma
391-
deprecated-modules=regsub,
392-
TERMIOS,
393-
Bastion,
394-
rexec,
395-
sets
396-
397-
# Create a graph of every (i.e. internal and external) dependencies in the
398-
# given file (report RP0402 must not be disabled)
399-
import-graph=
400-
401-
# Create a graph of external dependencies in the given file (report RP0402 must
402-
# not be disabled)
403-
ext-import-graph=
404-
405-
# Create a graph of internal dependencies in the given file (report RP0402 must
406-
# not be disabled)
407-
int-import-graph=
408-
409-
# Force import order to recognize a module as part of the standard
410-
# compatibility libraries.
411-
known-standard-library=
412-
413-
# Force import order to recognize a module as part of a third party library.
414-
known-third-party=enchant, absl
415-
416-
# Analyse import fallback blocks. This can be used to support both Python 2 and
417-
# 3 compatible code, which means that the block might have code that exists
418-
# only in one or another interpreter, leading to false positives when analysed.
419-
analyse-fallback-blocks=no
420-
421-
422-
[CLASSES]
423-
424-
# List of method names used to declare (i.e. assign) instance attributes.
425-
defining-attr-methods=__init__,
426-
__new__,
427-
setUp
428-
429-
# List of member names, which should be excluded from the protected access
430-
# warning.
431-
exclude-protected=_asdict,
432-
_fields,
433-
_replace,
434-
_source,
435-
_make
436-
437-
# List of valid names for the first argument in a class method.
438-
valid-classmethod-first-arg=cls,
439-
class_
440-
441-
# List of valid names for the first argument in a metaclass class method.
442-
valid-metaclass-classmethod-first-arg=mcs
443-
444-
445-
[EXCEPTIONS]
446-
447-
# Exceptions that will emit a warning when being caught. Defaults to
448-
# "Exception"
449-
overgeneral-exceptions=StandardError,
450-
Exception,
451-
BaseException

prototipo/sensor_sim.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,24 +85,24 @@ def create_all():
8585
db.session.commit()
8686

8787

88+
def get_datahora():
89+
return int(datetime.timestamp(datetime.now()))
90+
91+
8892
def post(url, leitura, token):
8993
response = requests.post(url,
9094
json={
9195
"valor": f"{leitura.valor:.2f}",
92-
"datahora": getDatahora()
96+
"datahora": get_datahora()
9397
},
9498
headers={"Authorization": f"jwt {token}"})
9599
print(response.json())
96100

97101

98-
def getDatahora():
99-
return int(datetime.timestamp(datetime.now()))
100-
101-
102102
def simular():
103103
auth = {"email": "admin@gmail.com", "password": "12345678"}
104-
URL = "http://localhost:5000/token"
105-
token = requests.post(URL, json=auth).json()['access_token']
104+
url = "http://localhost:5000/token"
105+
token = requests.post(url, json=auth).json()['access_token']
106106

107107
sensores = Sensor.query.all()
108108
valores_iniciais = []
@@ -148,7 +148,7 @@ def simular():
148148
url = f"http://localhost:5000/api/{VERSAO}/sensor/{sensor.id}/{param}"
149149
inicial = float(valores[param])
150150
valor = inicial + random() * choice(LINSPACE)
151-
leitura = Leitura(valor=valor, datahora=getDatahora())
151+
leitura = Leitura(valor=valor, datahora=get_datahora())
152152
post(url, leitura, token)
153153

154154

0 commit comments

Comments
 (0)