Human Core Dump
I worked as normal and until Wednesday evening, April 1st, 2020 and in the early hours of Thursday, April 2nd, 2020, I had an erratic heart incident that I thought was a stroke, but was probably an epilepsy. Fast forward. The body has been repaired I passed all the details of brain surgery. I will be probably slowly coming back into actions gradually. Thanks to the full webcompat team for the love and support and Mike Taylor for being always so human.
Just tremendously happy to be alive.
The interrupted work week below…
diagnosis
- mailto and sms schemes are not working currently on Firefox Preview Nightly.
- strange issue with switching context.
- 2020-03-31: Finally created an issue about it. It doesn't reproduce in Fennec.
- a multi-dimensional issue with svg, img without an src and content url and probably a web developer who never tested the homepage in firefox.
- 2020-03-31: And it seems this has quite a lot of implications around chrome and firefox. If an image has a broken source it should display an
alt
textual alternative, but what is happening if acontent: url()
pointing an image is specified? See the examples given in the bugzilla issue.
- 2020-03-31: And it seems this has quite a lot of implications around chrome and firefox. If an image has a broken source it should display an
misc
- A bit of code review. It's worth sometimes checking in the python module library to see if something already exists. Each time I do a review, I learn something. This time
os.path.commonprefix()
test_results = ["/a/b/c.html", "/a/b/d.html", "/a/b/e.html", "/a/b/f.html", "/a/b/g.html"]
import os.path
os.path.commonprefix(test_results)
# '/a/b/'
but unfortunately it's not really path minded.
test_results = ["/a/b/cde.html", "/a/b/cdf.html"]
import os.path
os.path.commonprefix(test_results)
# '/a/b/cd'
which both makes sense and is slightly unfortunate at the same time.
- Another discovery on Wednesday: MappingProxyType, which was created when the frozen dictionary proposal was rejected.
from types import MappingProxyType
some_dict = {'fr': 'baguette', 'ja': 'furansupan'}
frozen_dict = MappingProxyType(some_dict)
frozen_dict['fr']
# 'baguette'
frozen_dict['fr'] = 'pain de mie' # heresy
# Traceback (most recent call last):
# File "<stdin>", line 1, in <module>
# TypeError: 'mappingproxy' object does not support item assignment
- fluent style in programming. See below.
- Mozilla is making an experiment with udemy. I have decided to try a class about Machine Learning.
- So far it has been refreshingly satisfying. Kind of diving in maths topics I was used to master when I was doing Astrophysics but that I had long forgotten. Happy.
- I should do that more often.
fluent or not fluent in python for the webcompat ml code
I'm inheriting a machine learning project where I had 0 participation. And the learning curve is steep because of two things:
- The domain itself
- The coding choices of the previous developer
No specific blame to do here, but just different ways on how to think about specific code. I'm adding my comments on the code little by little, so I can keep track of my thoughts. There are a least two comments about modifying the object in place which makes me a bit uncomfortable.
return self
- and this
self.df = df
where df was not defined in__init__
.
Honestly I don't know if it's pythonic or not, but I find the code difficult to read and edgy if some operations are done in a different order
>>> class SomeClass:
... def create_var(self):
"instance method initializing a var list"
var = []
... self.var = var
... def insert_to_var(self, value):
... self.var.append(value)
...
>>> # This will work
>>> my_instance = SomeClass()
>>> my_instance.create_var()
>>> my_instance.insert_to_var(5)
>>> my_instance.var
[5]
>>> # But this will fail
>>> my_instance = SomeClass()
>>> my_instance.var
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'SomeClass' object has no attribute 'var'
>>> my_instance.insert_to_var(5)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 5, in insert_to_var
AttributeError: 'SomeClass' object has no attribute 'var'
This seems more robust
>>> class SomeClass:
... def __init__(self):
... self.var = []
... def insert_to_var(self, value):
... self.var.append(value)
...
>>> my_instance = SomeClass()
>>> my_instance.var
[]
>>>
but i need to learn more about it.
git notes
- Mike Hommey shared with me
git notes
related to what I was explaining last week about annotations in git. - Blogs are cool and this is exactly how they are useful. Please share your stuff on blogs, more than twitter (or at least if you share on twitter, make it a blog post).
git notes: Add or inspect object notes
Adds, removes, or reads notes attached to objects, without touching the objects themselves.
By default, notes are saved to and read from refs/notes/commits, but this default can be overridden. See the OPTIONS, CONFIGURATION, and ENVIRONMENT sections below. If this ref does not exist, it will be quietly created when it is first needed to store a note.
A typical use of notes is to supplement a commit message without changing the commit itself. Notes can be shown by git log along with the original commit message.
There is a practical explanation given on AlBlue's blog.
commenting lines on specific commits in GitHub
It might also be possible to do it through comments on specific parts of the code. It might be simpler, plus it is sending a mail which will give nice links. I could even put a #tag
inside the comment so it's easier to search, discriminate. To think.
Otsukare!