Re: DeprecationWarning but replacement doesn't work

2023-02-05 Thread Chris Green
Roel Schroeven  wrote:
> Chris Green schreef op 4/02/2023 om 16:17:
> > I am using Image from PIL and I'm getting a deprecation warning as
> > follows:-
> >
> > /home/chris/bin/picShrink.py:80: DeprecationWarning: ANTIALIAS is 
> > deprecated 
> and will be removed in Pillow 10 (2023-07-01). Use Resampling.LANCZOS 
> instead. 
> 
> >
> >
> > But if I change line 80 to:-
> >
> >  im.thumbnail(size, Resampling.LANCZOS)
> >
> > I simply get an error as follows:-
> >
> >  picShrink.py
> >  Traceback (most recent call last):
> >File "/home/chris/bin/picShrink.py", line 80, in 
> >  im.thumbnail(size, Resampling.LANCZOS)
> >  NameError: name 'Resampling' is not defined
> >
> >
> > So, presumably there's more I need to change.  Where can I find out what
> > I need to do?
> There's some information about changes in constants in the release notes 
> for version 9.1.0, see 
> https://pillow.readthedocs.io/en/stable/releasenotes/9.1.0.html. At 
> first sight it looks like that indicates you have to do either
> 
>     from PIL import Image.Resampling as Resampling
>     ...
>     im.thumbnail(size, Resampling.LANCZOS)
> 
> or
> 
>     from PIL import Image.Resampling
>     ...
>     im.thumbnail(size, Image.Resampling.LANCZOS)
> 
> BUT according to the release notes of version 9.4.0 (see 
> https://pillow.readthedocs.io/en/stable/releasenotes/9.4.0.html#restored-image-constants)
>  
> the constants in Image will remain (it's not clear to me if the ones in 
> Image.Resample will remain too). As far as I can see ANTIALIAS is still 
> deprecated in favor of LANCZOS though. All in all, it looks like the way 
> to go is to use Image.LANCZOS. In versions 9.1.0 up to but not including 
> 9.4.0 that will give you a deprecation warning but that can safely be 
> ignored.
> 
Thank you Roel (and Chris in the previous reply) for your helpful
explanations, it's all cleared up now.

-- 
Chris Green
·
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to read file content and send email on Debian Bullseye

2023-02-05 Thread Peter J. Holzer
On 2023-02-04 17:59:11 -0500, Thomas Passin wrote:
> On 2/4/2023 10:05 AM, ^Bart wrote:
> > On a Debian Bullseye server I have a lftp upload and after it I should
> > send an email.
> > 
> > I thought to read the lftp log file where I have these lines:
[...]
> > I'd like to use Python to check, from monday to friday (the lftp script
> > runs in crontab from monday to friday) when the upload works is finished
> > and I should send an email.
> > 
> > I could read by Python lftp.log and after it if there's a line with the
> > same day of the machine I could send an email with ok otherwise the
> > email will send a message with "no upload".
> > 
> > How could I do by Python?
> 
> Not Python, but you could run a shell script

If you can run a shell script you can also run a python script.
Linux/Unix is almost completely agnostic about interpreters. You
generally just invoke "the program" and then the kernel examines the
first few bytes to determine what to do with it.

> that sends the file with lftp, and depending on the return code uses
> xdg-email to send one of the two messages. This would probably be
> simpler than using Python.

Probably. But Python gives you more control. Tradeoffs, tradeoffs ...

For something like this I'd say go with what you're most familiar with
and what takes the least effort to get the job done.
For a simple one line notification I'd write a shell script invoking
/usr/sbin/sendmail. If I wanted it to be a bit fancier (e.g. a table
with the uploads over the last few days) I'd probably write a Python
script to get the MIME/HTML structure right (and still use sendmail to
actually send the mail).

xdg-mail can be anything or not be configured at all - so it might not
be the best choice.

> Otherwise you haven't said what part of the process you need help with.

Yeah, that was the reason I didn't reply to the original mail. I simply
couldn't figure out where the problem was.

hp

-- 
   _  | Peter J. Holzer| Story must make more sense than reality.
|_|_) ||
| |   | h...@hjp.at |-- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |   challenge!"


signature.asc
Description: PGP signature
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Typing Number, PyCharm

2023-02-05 Thread Weatherby,Gerard
dn,

I’m missing something here. Method 5 seems to work fine in PyCharm. I’m 
interpreting your statement as:

from fractions import Fraction
from numbers import Number


def double(value: Number):
if isinstance(value, Number):
# noinspection PyTypeChecker
return 2 * value
raise ValueError(f"{value} of {type(value)} is not a Number")


print(double(7))
print(double(7.2))
print(double(complex(3.2, 4.5)))
print(double(Fraction(7, 8)))
# print(double("7")) PyCharm properly complains


From: Python-list  on 
behalf of dn via Python-list 
Date: Saturday, February 4, 2023 at 9:32 PM
To: 'Python' 
Subject: Typing Number, PyCharm
*** Attention: This is an external email. Use caution responding, opening 
attachments or clicking on links. ***

Do we have a typing type-hint for numbers yet?


Often wanting to combine int and float, discovered that an application
was doing a walk-through with/for uses three numeric types. Was
intrigued to note variance, in that the code-set features two different
methods for typing, in this situation:

def func( value ):
 ...using value...

where value may be an integer, a floating-point value, or a
complex-number (but not decimal-type).
NB code snippets from memory (cf copy-paste)


Method 1 (possibly older code):-

from typing import Union
...
def fun( value:Union[ int, float, complex ] ):


Method 2:-

def fun( value:int|float|complex  ):


Pondering this, realised could use an alias to de-clutter the
function-definition/signature:

Method 3:-

number_type = int|float|complex
...
def fun( value:number_type  ):


If it was important to have type consistency within the union, eg
argument and return, could go for:

Method 4:-

from typing import TypeVar
number_type = TypeVar( 'number_type', int, float, complex )
...
def fun( value:number_type  ):


Then remembered the way we'd code an execution-time check for this using
isinstance():

Method 5:-

from numbers import Number
...
def fun( value:Number  ):


Each of these will execute correctly.

All cause PyCharm to object if I try to call the fun(ction) with a
string parameter - and execute an exception, as expected.


Accepting all the others, am curious as to why PyCharm objects to Method
5 with "Expected type 'SupportsFloat | SupportsComplex | complex |
SupportsIndex', got 'Number' instead? - yet still highlights the
erroneous string parameter but none of the 'legal' data-types?

As soon as a list (in this case types) reaches three, my aged-eyes start
to think de-cluttering is a good idea!

Do you know of another way to attack this/more properly?

--
Regards,
=dn
--
https://urldefense.com/v3/__https://mail.python.org/mailman/listinfo/python-list__;!!Cn_UX_p3!gqIbcK1zaXmlo5y6741fRwcBUcDfxPNkiA4Jy_NHr9nEno2HaBGZYMuitXeivWrGwTJtds01pHdFfiY_Y5bnmsq_NQ$
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Organizing modules and their code

2023-02-05 Thread Weatherby,Gerard
Well, first of all, while there is no doubt as to Dijkstra’s contribution to 
computer science, I don’t think his description of scientific thought is 
correct. The acceptance of Einstein’s theory of relativity has nothing to do 
with internal consistency or how easy or difficult to explain but rather 
repeatedly experimental results validating it. Or, more precisely, not 
disproving it. See Feynmann: https://www.youtube.com/watch?v=0KmimDq4cSU


Engineering is simply maximizing the ratio: benefit / cost. Highly recommend To 
Engineer is Human  by Henry Petroski.

Regarding the initial question: none of the suggested designs would work 
because they lack __init__.py file.

Once the __init__.py is added, the construct of the import statements within it 
will determine how the API looks. All three of Design I / Design II and Design 
III can be implemented with the same API. (I’m pretty sure that’s true. If it’s 
not, I’d be interested in a counterexample).





From: Python-list  on 
behalf of transreductionist 
Date: Saturday, February 4, 2023 at 7:42 PM
To: python-list@python.org 
Subject: Re: Organizing modules and their code
*** Attention: This is an external email. Use caution responding, opening 
attachments or clicking on links. ***

Thank you for all the helpful replies and consideration. I do hope for other 
opinions

I would rather say it is more like engineering than art. Whether it is a matter 
of overthinking, or under thinking, is another matter. I enjoyed Dijkstra's 
letter to his colleagues on the role of scientific thought in computer 
programming. It is located at:

 
https://urldefense.com/v3/__https://www.cs.utexas.edu/users/EWD/transcriptions/EWD04xx/EWD447.html__;!!Cn_UX_p3!nME8OhiOxAzmzM3jzg6uXZU851dhWWD9JGB8ZRZIzyUzGkmCN-C6SSXrL59eA2KVIh-y-W0VycJSNb8aYcNnc3jd5Pi2fw$

It is my academic training in physics that makes me enjoy picking up an idea 
and examining  it from all sides, and sharing thoughts with friends. Just 
inquisitive curiosity, and not a homework problem,. Thanks for the great link 
to the ETL site. That was a good read. A few years back I built a prod ETL 
application in Golang using gRPC with a multiprocessing pipeline throughout. It 
handled GB of data and was fast.

This analogy came to me the other day. For me, I would rather walk into a 
grocery store where the bananas, apples, and oranges are separated in to their 
own bins, instead of one common crate.


On Friday, February 3, 2023 at 4:18:57 PM UTC-5, transreductionist wrote:
> Here is the situation. There is a top-level module (see designs below) 
> containing code, that as the name suggests, manages an ETL pipeline. A 
> directory is created called etl_helpers that organizes several modules 
> responsible for making up the pipeline. The discussion concerns the Python 
> language, which supports OOP as well as Structural/Functional approaches to 
> programming.
>
> I am interested in opinions on which design adheres best to standard 
> architectural practices and the SOLID principles. I understand that this is 
> one of those topics where people may have strong opinions one way or the 
> other. I am interested in those opinions.
>
> Allow me to give my thoughts. First, I don't think there would be much 
> difference if I was using OOP for the functionality, or using a structural 
> paradigm. A structural paradigm in my opinion, along the lines of Rich 
> Hickey's comments on simple versus complex, would be a simpler 
> implementation. In this case there is no reason to create a construct with 
> state. So let's assume the code is structural and not OOP.
>
> I would go with Design I. Succinctly stated, Design I supports readability 
> and maintainability at least as well, if not better than the other designs. 
> The goal of the SOLID principles are the creation of mid-level software 
> structures that (Software Architecture: SA Martin). I think Design I best 
> adheres to these principles of:
>  Tolerate change,
>  Are easy to understand, and
>  Are the basis of components that can be used in many software systems.
>
> I could point to the Single Responsibility Principle which is defined as (SA 
> Martin): a module should be responsible to one, and only one, actor. It 
> should satisfy the Liskov Substitution Principle as well. Further, each 
> module in the etl_helpers directory is at the same level of abstraction.
>
> I could also mention that as Dijkstra stressed, at every level, from the 
> smallest function to the largest component, software is like a science and, 
> therefore, is driven by falsifiability. Software architects strive to define 
> modules, components, and services that are easily falsifiable (testable). To 
> do so, they employ restrictive disciplines similar to structured p

Re: How to read file content and send email on Debian Bullseye

2023-02-05 Thread ^Bart

xdg-email appears to be for interactive use (it opens the user's
"preferred email composer"); I think sendmail would work much better
from a script.


Like what I said in another post I think I could use ssmtp than 
xdg-email or sendmail...



Otherwise, I had the same initial thought, to add to and/or build a
wrapper around the existing lftp script.


I'd like to know if there's a code made from lftp to understand when an 
upload file is finished but certainly I can read it from the log file 
and I think it couldn't be hard to find a value in a *.txt file and if 
this value is inside of it to send an email like "ok" otherwise a 
message with "k.o.".


Regards.
^Bart
--
https://mail.python.org/mailman/listinfo/python-list


Re: How to read file content and send email on Debian Bullseye

2023-02-05 Thread ^Bart
Not Python, but you could run a shell script that sends the file with 
lftp, and depending on the return code uses xdg-email to send one of the 
two messages. This would probably be simpler than using Python.


This machine is a server without DE, just command line and I didn't 
configure mail client so maybe I should use something like ssmtp.


Otherwise you haven't said what part of the process you need help with. 
Reading the log file?  Checking the date?  Triggering the Python script? 
  Sending the email message with Python?


I need to understand "just" if the upload job is finished and, I think, 
the best way is to read the log file so I should write a code like:


"if there's a line with the same date of the machine than send email 
with ok else send an email with failed"


I do just an upload every day, from monday to friday so I don't have in 
the same day other lines.



For the latter, it's covered in the Python docs -

https://docs.python.org/3.10/library/email.examples.html


I'm reading it! :)

Regards.
^Bart

--
https://mail.python.org/mailman/listinfo/python-list


Re: How to read file content and send email on Debian Bullseye

2023-02-05 Thread ^Bart
I have never used it, and I did see that wording in the man page, but it 
also showed putting all the info on the command line - from, to, 
subject, etc - so I thought it might be able to use a command line 
client without needed any GUI interaction.  But I don't know for sure.


This machine is a server without GUI so I must do everything by cli but 
it's not a problem! :)


So mainly I should write a code to find a match between the date found 
on the lftp's log file and the date of the pc, if there's a match I need 
to send an email with "ok" otherwise an email with "ko".


I think it shouldn't be so hard to compare a value inside of a file with 
the date of the machine but now I should understand which is the best 
way! :)


Regards.
Gabriele

--
https://mail.python.org/mailman/listinfo/python-list


Re: RE: How to read file content and send email on Debian Bullseye

2023-02-05 Thread ^Bart

For example, try to do whatever parts you know how to do and when some part
fails or is missing, ask.


You're right but first of all I wrote what I'd like to do and if Python 
could be the best choice about it! :)



I might have replied to you directly if your email email address did not
look like you want no SPAM, LOL!


Ahaha! I think you know what is spam and what is a reply\answer to a 
post request so you can feel free to use also my email! :)



The cron stuff is not really relevant and it seems your idea is to read a
part or all of a log file, parse the lines in some way and find a line that
either matches what you need or fail to find it. Either way you want to send
an email out with an appropriate content.


You got the point!


Which part of that do you not know how to do in python? Have you done some
reading or looking?


Like what I wrote above I didn't know if Python can does what I need and 
if to use Python is a good way I'll start to study how to do it! :)


In my past I used Python for Arduino programming or to do easy things, 
what I should do now is little more complex but I understood from years 
and years by the Python's powers you can do everything! LOL! :)


Regards.
^Bart
--
https://mail.python.org/mailman/listinfo/python-list


Re: How to read file content and send email on Debian Bullseye

2023-02-05 Thread Jim Jackson
On 2023-02-05, ^Bart  wrote:
>> For example, try to do whatever parts you know how to do and when some part
>> fails or is missing, ask.
>
> You're right but first of all I wrote what I'd like to do and if Python 
> could be the best choice about it! :)

I'd say you want a simple shell script wrapped around your job, and a 
program to send email (bsdmail/sendmail or similar or mstmp on linux for 
instance).

>
>> I might have replied to you directly if your email email address did not
>> look like you want no SPAM, LOL!
>
> Ahaha! I think you know what is spam and what is a reply\answer to a 
> post request so you can feel free to use also my email! :)
>
>> The cron stuff is not really relevant and it seems your idea is to read a
>> part or all of a log file, parse the lines in some way and find a line that
>> either matches what you need or fail to find it. Either way you want to send
>> an email out with an appropriate content.
>
> You got the point!
>
>> Which part of that do you not know how to do in python? Have you done some
>> reading or looking?
>
> Like what I wrote above I didn't know if Python can does what I need and 
> if to use Python is a good way I'll start to study how to do it! :)
>
> In my past I used Python for Arduino programming or to do easy things, 
> what I should do now is little more complex but I understood from years 
> and years by the Python's powers you can do everything! LOL! :)
>
> Regards.
> ^Bart
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to read file content and send email on Debian Bullseye

2023-02-05 Thread Jim Jackson
On 2023-02-05, ^Bart  wrote:
>> xdg-email appears to be for interactive use (it opens the user's
>> "preferred email composer"); I think sendmail would work much better
>> from a script.
>
> Like what I said in another post I think I could use ssmtp than 
> xdg-email or sendmail...
>
>> Otherwise, I had the same initial thought, to add to and/or build a
>> wrapper around the existing lftp script.
>
> I'd like to know if there's a code made from lftp to understand when an 
> upload file is finished

You make an lftp "script" to upload the file and write a log somewhere - 
write a script to run lftp with the lftp script, when the lftp has 
finished email the log. The log will show what happenned.

In cron run the script.

>  but certainly I can read it from the log file 
> and I think it couldn't be hard to find a value in a *.txt file and if 
> this value is inside of it to send an email like "ok" otherwise a 
> message with "k.o.".
>
> Regards.
> ^Bart
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Typing Number, PyCharm

2023-02-05 Thread dn via Python-list
No @Gerard, YOU weren't missing anything: since posting, have upgraded 
PyCharm to 2022.3.2 and the complaints about 'Method 5' have 
disappeared. Evidently a PyCharm issue!


Which alters the top-line question to: is numbers.Number the preferred 
type-hint when multiple numeric types are to be accepted?


PS no Decimal(s) nor Fraction(s) in my situation, but may be worth 
adding to a wider discussion...



On 06/02/2023 04.03, Weatherby,Gerard wrote:

dn,

I’m missing something here. Method 5 seems to work fine in PyCharm. I’m 
interpreting your statement as:


from fractions import Fraction
from numbers import Number


def double(value: Number):
if isinstance(value, Number):
/# noinspection PyTypeChecker
/return 2 * value
raise ValueError(f"{value}of {type(value)}is not a Number")


print(double(7))
print(double(7.2))
print(double(complex(3.2, 4.5)))
print(double(Fraction(7, 8)))
/# print(double("7")) PyCharm properly complains/

*From: *Python-list  
on behalf of dn via Python-list 

*Date: *Saturday, February 4, 2023 at 9:32 PM
*To: *'Python' 
*Subject: *Typing Number, PyCharm

*** Attention: This is an external email. Use caution responding, 
opening attachments or clicking on links. ***


Do we have a typing type-hint for numbers yet?


Often wanting to combine int and float, discovered that an application
was doing a walk-through with/for uses three numeric types. Was
intrigued to note variance, in that the code-set features two different
methods for typing, in this situation:

def func( value ):
  ...using value...

where value may be an integer, a floating-point value, or a
complex-number (but not decimal-type).
NB code snippets from memory (cf copy-paste)


Method 1 (possibly older code):-

from typing import Union
...
def fun( value:Union[ int, float, complex ] ):


Method 2:-

def fun( value:int|float|complex  ):


Pondering this, realised could use an alias to de-clutter the
function-definition/signature:

Method 3:-

number_type = int|float|complex
...
def fun( value:number_type  ):


If it was important to have type consistency within the union, eg
argument and return, could go for:

Method 4:-

from typing import TypeVar
number_type = TypeVar( 'number_type', int, float, complex )
...
def fun( value:number_type  ):


Then remembered the way we'd code an execution-time check for this using
isinstance():

Method 5:-

from numbers import Number
...
def fun( value:Number  ):


Each of these will execute correctly.

All cause PyCharm to object if I try to call the fun(ction) with a
string parameter - and execute an exception, as expected.


Accepting all the others, am curious as to why PyCharm objects to Method
5 with "Expected type 'SupportsFloat | SupportsComplex | complex |
SupportsIndex', got 'Number' instead? - yet still highlights the
erroneous string parameter but none of the 'legal' data-types?

As soon as a list (in this case types) reaches three, my aged-eyes start
to think de-cluttering is a good idea!

Do you know of another way to attack this/more properly?

--
Regards,
=dn
--
https://urldefense.com/v3/__https://mail.python.org/mailman/listinfo/python-list__;!!Cn_UX_p3!gqIbcK1zaXmlo5y6741fRwcBUcDfxPNkiA4Jy_NHr9nEno2HaBGZYMuitXeivWrGwTJtds01pHdFfiY_Y5bnmsq_NQ$
 




--
Regards,
=dn

--
https://mail.python.org/mailman/listinfo/python-list


Re: Organizing modules and their code

2023-02-05 Thread Greg Ewing via Python-list

On 6/02/23 4:23 am, Weatherby,Gerard wrote:

Well, first of all, while there is no doubt as to Dijkstra’s contribution to 
computer science, I don’t think his description of scientific thought is 
correct. The acceptance of Einstein’s theory of relativity has nothing to do 
with internal consistency or how easy or difficult to explain but rather 
repeatedly experimental results validating it.


I don't think Dijkstra was claiming that what he was talking about
was a *complete* description of scientific thought, only that the
ability to separate out independent concerns is an important part
of it, and that was something he saw his colleagues failing to do.

--
Greg
--
https://mail.python.org/mailman/listinfo/python-list


RE: RE: How to read file content and send email on Debian Bullseye

2023-02-05 Thread avi.e.gross
Bart,

Some really decent cron jobs can be written without using anything complex.

I get it  now that perhaps your motivation is more about finding an excuse
to learn python better. The reality is there is not much that python cannot
do if other programming languages and environments can do them so asking if
it can do it feels a tad naïve. Like many languages, python is very
extendable with all kinds of modules so often instead of doing something
totally on your own, you can find something that does much of the hard work
for you, too. 

Yes, python can nicely read in lines from a log and compare them to a fixed
string or pattern and either find or not find what you ask for.

But a shell script can be written in a few minutes that simply gets the
string for the current date in the format you want, interpolates it in a
regular expression, calls grep or a dozen other programs that handle a
command line argument, and if it returns a single line, you send one email
and if none you send another and if more than one, you may have done it
wrong. Some such programs, like AWK are designed mainly to do exactly
something like you ask and examine each input line against a series of
patterns. Sending an email though is not always something easy to do from
within a program like that but a shell script that checks how it ends may do
that part.

If you are on a specific machine and only need to solve the problem on that
machine or something similar, this seems straightforward. 

My impression is you want to match a line in the log file that may look like
it should  match "anything", then some keyword or so that specifies all
lines about this particular upload on every day, then matches another
"anything" up to something that exactly matches the date for today, and
maybe match another "anything" to the end of the line. It can be a fairly
straightforward regular expression if the data has a regular component in
the formatting. Grep, sed, awk, perl and others can do this and others. 

Could you do this faster in python? Maybe. Arguably if speed is a major
issue, write it in some compiled language like C++. 

But if your data is very regular such as the entry will have some key phrase
between the 12th and 19th characters and the date will be exactly in another
exact region, then you certainly can skip regular expressions and read each
line and examine the substrings for equality. You may also speed it a bit if
you exit any such loop as soon as you find what you are looking for. 

I note if your log file is big but not very busy, and you are pretty sure
the entry will be in the last few (maybe hundred) lines, some may use the
tail command and pipe the text it returns to whatever is processing the
data. There are many ways to do what you want.

But you improve your chances of getting an answer if you ask it more
clearly. There have been people (maybe just one) who have been posing
questions of a rather vague nature and then not responding as others debate
it in seemingly random directions. You are interacting nicely but some of us
have become hesitant to jump in until they see if the request is
well-intended. You do sound like you know quite a bit and your question
could have  been closer to saying that you know several ways to do it
(include examples or at least outlines) and wonder if some ways are better
or more pythonic or ...

So if people keep wondering what you want, it is because the people here are
not generally interested in doing homework or complete programs for people.
If you ask us how to generate a string with the current date, and cannot
just find it on your own, we might answer. If you want to know how to store
a date as an object including the current time, and also convert the text on
a line in the log file to make another such date object and then be able to
compare them and be able to include in your email how LONG AGO the upload
was done, that would be another more specific request. If you are not sure
how python does regular expressions, ...

Otherwise, what you are asking for may not be BASIC for some but seems
relatively straightforward to some of us and we sort of may be  wondering
if we are missing anything?

Good Luck,

^Avi

-Original Message-
From: Python-list  On
Behalf Of ^Bart
Sent: Sunday, February 5, 2023 8:58 AM
To: python-list@python.org
Subject: Re: RE: How to read file content and send email on Debian Bullseye

> For example, try to do whatever parts you know how to do and when some 
> part fails or is missing, ask.

You're right but first of all I wrote what I'd like to do and if Python
could be the best choice about it! :)

> I might have replied to you directly if your email email address did 
> not look like you want no SPAM, LOL!

Ahaha! I think you know what is spam and what is a reply\answer to a post
request so you can feel free to use also my email! :)

> The cron stuff is not really relevant and it seems your idea is to 
> read a part or all of a log file, parse the lines