Skip to content

Commit

Permalink
Ruff check fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
azvoleff committed Aug 2, 2024
1 parent 9e34572 commit 36f3592
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 24 deletions.
8 changes: 4 additions & 4 deletions examples/example_gee_ci/src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ def mann_kendall_stat(imageCollection):
NumberOfItems = TimeSeriesList.length().getInfo()
ConcordantArray = []
DiscordantArray = []
for k in range(0, NumberOfItems - 2):
CurrentImage = ee.Image(TimeSeriesList.get(k))
for l in range(k + 1, NumberOfItems - 1):
nextImage = ee.Image(TimeSeriesList.get(l))
for j in range(0, NumberOfItems - 2):
CurrentImage = ee.Image(TimeSeriesList.get(j))
for k in range(j + 1, NumberOfItems - 1):
nextImage = ee.Image(TimeSeriesList.get(k))
Concordant = CurrentImage.lt(nextImage)
ConcordantArray.append(Concordant)
Discordant = CurrentImage.gt(nextImage)
Expand Down
17 changes: 7 additions & 10 deletions examples/example_tensorflow/src/main.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
"""Custom Script"""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from tensorflow.examples.tutorials.mnist import input_data
from __future__ import absolute_import, division, print_function

import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data


def model(x):
Expand All @@ -18,7 +15,7 @@ def model(x):

def run(params, logger):
# Import data
mnist = input_data.read_data_sets('/tmp/tensorflow/mnist/input_data', one_hot=True)
mnist = input_data.read_data_sets("/tmp/tensorflow/mnist/input_data", one_hot=True)
learning_rate = 0.5

# Create the model
Expand All @@ -27,8 +24,9 @@ def run(params, logger):
y_ = tf.placeholder(tf.float32, [None, 10])

cross_entropy = tf.nn.softmax_cross_entropy_with_logits(labels=y_, logits=y)
loss = tf.reduce_mean(cross_entropy)
train_step = tf.train.GradientDescentOptimizer(learning_rate).minimize(cross_entropy)
train_step = tf.train.GradientDescentOptimizer(learning_rate).minimize(
cross_entropy
)

sess = tf.InteractiveSession()
tf.global_variables_initializer().run()
Expand All @@ -41,6 +39,5 @@ def run(params, logger):
# Test trained model
correct_prediction = tf.equal(tf.argmax(y, 1), tf.argmax(y_, 1))
accuracy = tf.reduce_mean(tf.cast(correct_prediction, tf.float32))
print(sess.run(accuracy, feed_dict={x: mnist.test.images,
y_: mnist.test.labels}))
print(sess.run(accuracy, feed_dict={x: mnist.test.images, y_: mnist.test.labels}))
return "Done"
15 changes: 5 additions & 10 deletions tecli/logs.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
"""Logs command"""

from __future__ import absolute_import

from __future__ import division

from __future__ import print_function
from __future__ import absolute_import, division, print_function

import json
import logging
import os
import time
from datetime import datetime
from datetime import timedelta
from datetime import datetime, timedelta

import dateutil.parser
import pytz
Expand Down Expand Up @@ -66,7 +61,7 @@ def show_logs(script, since):
printed = False
for log in script["logs"]:
last_date = dateutil.parser.parse(log["register_date"]).replace(tzinfo=pytz.utc)
if log["text"] != None and (last_date > (now - since)):
if log["text"] is not None and (last_date > (now - since)):
print(log["register_date"] + ": " + log["text"])
printed = True

Expand All @@ -77,12 +72,12 @@ def show_logs(script, since):

if script["status"] != "FAIL" and script["status"] != "SUCCESS":
next = True
while next == True:
while next:
next, logs = get_logs(script, last_date)
if logs:
for log in logs:
last_date = dateutil.parser.parse(log["register_date"])
if log["text"] != None:
if log["text"] is not None:
print(log["register_date"] + ": " + log["text"])

time.sleep(2)
Expand Down

0 comments on commit 36f3592

Please sign in to comment.