from unittest import mock
import tempfile
import shutil
from fastcore.test import *
from trouver.helper.tests import _test_directory
markdown.obsidian.personal.notation.in_standard_information_note
Notations in a standard information note
Find notations introduced in note
By double asterisks **
WARNING: The use of double asterisks **
to signify definitions and notations is deprecated.
In the legacy method, string surrounded by double asterisks **
were recognized as marking notations
notat_str_from_doub_asts_in_std_info_note
notat_str_from_doub_asts_in_std_info_note (info_note:trouver.markdown.ob sidian.vault.VaultNote)
*Return the LaTeX str’s with notations in a standard information note.
For this function, A LaTeX str is deemed to be a notation if it is surrounded by double asterisks **
*
Type | Details | |
---|---|---|
info_note | VaultNote | |
Returns | list | Each str is a LaTeX str, beginning and trailing dollar signs $ (single or double) included. |
We can obtain the notation str in an information note:
= _test_directory() / 'test_vault_7'
vault # A note with just one notation:
= VaultNote(vault, name='galois_group')
vn = notat_str_from_doub_asts_in_std_info_note(vn)
sample_output_1 assert len(sample_output_1) == 1
assert sample_output_1[0].startswith('$')
assert sample_output_1[0].endswith('$')
assert not sample_output_1[0].startswith('$$')
assert not sample_output_1[0].endswith('$$')
print(sample_output_1)
# A note with a notation with double asterisks:
= VaultNote(vault, name='spectrum_of_a_ring')
vn = notat_str_from_doub_asts_in_std_info_note(vn)
sample_output_2 assert len(sample_output_2) == 2
assert sample_output_2[1].startswith('$$')
assert sample_output_2[1].endswith('$$')
print(sample_output_2)
# A note with no notations:
assert not notat_str_from_doub_asts_in_std_info_note(VaultNote(vault, name='no_notations_note_about_integral_domains'))
['$\\operatorname{Gal}(L/K)$']
['$\\operatorname{Spec} A$', '$$D(f) = \\{\\mathfrak{p} \\in \\operatorname{Spec} A: f \\not\\in \\mathfrak{p} \\}.$$']
# hide
# Test notation str with asterisks.
= _test_directory() / 'test_vault_7'
vault = VaultNote(vault, name='direct_and_inverse_images_of_sheaves')
vn = notat_str_from_doub_asts_in_std_info_note(vn)
sample_output # sample_output
assert len(sample_output) == 2
Notation notes listed in see also section
notation_notes_linked_in_see_also_section
notation_notes_linked_in_see_also_section (info_note:trouver.markdown.ob sidian.vault.VaultNote, vault:os.PathLike, as_vault_notes:bool=True)
*Return a list of notation notes listed in the See Also
section of the standard information note.
In the current implementation of this function, only “notation notes” that actually exist are included in the returned list.*
Type | Default | Details | |
---|---|---|---|
info_note | VaultNote | ||
vault | PathLike | Path to the vault directory. | |
as_vault_notes | bool | True | If True , returns each notation note as a VaultNote object. Otherwise, returns the name of each notation note. Defaults to True . |
Returns | Union | Each entry corresponds to a notation note in the vault. |
The notation_notes_linked_in_see_also_section
method detects the Notation notes listed in bulleted links in the See Also section of a standard information note.
= _test_directory() / 'test_vault_7'
vault = VaultNote(vault, name='twist_of_a_graded_module')
vn = notation_notes_linked_in_see_also_section(vn, vault)
sample_output assert len(sample_output) == 1
assert isinstance(sample_output[0], VaultNote)
print(sample_output[0].name)
assert sample_output[0].exists()
foag_notation_M_n_bullet
Setting as_vault_notes=False
returns the names of the notation notes.
= _test_directory() / 'test_vault_7'
vault = VaultNote(vault, name='twist_of_a_graded_module')
vn = notation_notes_linked_in_see_also_section(vn, vault, as_vault_notes=False)
sample_output assert len(sample_output) == 1
assert isinstance(sample_output[0], str)
print(sample_output[0])
foag_notation_M_n_bullet
If a “notation note” does not exist, then it is not included in the returned list.
Note that notation_notes_linked_in_see_also_section
uses bulleted_links_of_type_in_section
, which is turn uses note_is_of_type
to get a list of linked notes of the type NOTATION_NOTE
of the PersonalNoteTypeEnum
class. In turn, a note file must exist for the note to be considered of any particular type under the current implementation of note_is_of_type
.
= _test_directory() / 'test_vault_7'
vault = VaultNote(vault, name='note_with_links_to_non_existent_notation_notes')
vn = notation_notes_linked_in_see_also_section(vn, vault, as_vault_notes=True)
sample_output
test_eq(sample_output, [])= notation_notes_linked_in_see_also_section(vn, vault, as_vault_notes=False)
sample_output test_eq(sample_output, [])
Find all notation notes in a vault subdirectory
notations_and_main_notes
notations_and_main_notes (vault:os.PathLike, subdirectory:Optional[os.PathLike]=None, note:O ptional[trouver.markdown.obsidian.vault.VaultNo te]=None)
*Return a dict
with all of notation notes in a specified subdirectory of a vault and the names of the main notes of these notation notes.
Returns - dict
Raises
- ValueError
- If
subdirectory
andnote
are bothNone
.*
- If
Type | Default | Details | |
---|---|---|---|
vault | PathLike | Path to the vault directory. | |
subdirectory | Optional | None | Path to the subdirectory, relative to vault , to find the notation notes. Searches for all notation notes here and in subdirectories of this subdirectory. If None , then the note parameter is used to determined the subdirectory. If subdirectoryis the empty str, then all notation notes in the vault are searched. Defaults to None. | | note | Optional | None | A note in the vault. The directory that this note is in determines the subdirectoryparameter if the argument passed to subdirectoryis the blank str. This note can usually be an index note, e.g. ’_index_silverman’. Defaults to None, in which case subdirectorymust be specified. | | **Returns** | **dict** | | **A key is the unique name of a notation note in the vault and its corresponding value is the name of the main note of the notation note. Each main note may not actually exist, but each notation note definitely exists. If the notation note has no main note (i.e. has no links to other notes), then the value is None`.** |
The notations_and_main_notes
function returns all the notation notes in a subdirectory of a vault
= _test_directory() / 'test_vault_7'
vault = notations_and_main_notes(vault, subdirectory='')
sample_output print(sample_output)
assert 'foag_notation_M_n_bullet' in sample_output
assert 'some_reference_name_notation_O_X_this_file_has_no_links' in sample_output
assert sample_output['some_reference_name_notation_O_X_this_file_has_no_links'] is None
assert 'poonen_curves_notation_Z_X_T' in sample_output
{'foag_notation_M_n_bullet': 'twist_of_a_graded_module', 'notation_note_with_main_note_link_but_main_note_does_not_exist': 'nonexistent_note', 'some_reference_name_notation_k_t_formal_power_series_ring': 'some_note', 'some_reference_name_notation_O_X_this_file_has_no_links': None, 'some_reference_name_notation_Pic_C': 'divisor_class_group_of_a_curve', 'some_reference_name_notation_Spec_A': 'spectrum_of_a_ring', 'foag_notation_O_n': 'foag_15.2.1', 'foag_notation_O_text_Proj__S__n': 'foag_15.2.1', 'poonen_curves_notation_zeta_X_s_zeta_function_of_variety': 'poonen_curves_3.4.1 DEFINITION', 'poonen_curves_notation_Z_X_T': 'poonen_curves_3.4.1 DEFINITION', 'some_reference_name_notation_B_R': 'note_with_some_excessive_notation_notes', 'some_reference_name_notation_B_R_1': 'note_with_some_excessive_notation_notes', 'some_reference_name_notation_Jac_C': 'note_with_some_excessive_notation_notes', 'test_notation_note_for_latex_in_original_metadata_1': 'test_note_for_latex_in_original_metadata', 'test_notation_note_for_latex_in_original_metadata_2': 'test_note_for_latex_in_original_metadata', 'foag_notation__otimes_A_quad_obj_Mod_A_times_obj_Mod_A_longarrow_obj_Mod_A_': 'foag_1.3.5', 'notation_note_with_auto_notation_summary_tag': 'main_note_of_notation_note_with_auto_notation_summary_tag'}
Here is an example with a subdirectory specified:
= _test_directory() / 'test_vault_7'
vault = notations_and_main_notes(vault, subdirectory='some_other_folder')
sample_output print(sample_output)
assert 'foag_notation_M_n_bullet' not in sample_output
assert 'some_reference_name_notation_O_X_this_file_has_no_links' not in sample_output
assert 'poonen_curves_notation_Z_X_T' in sample_output
{'foag_notation_O_n': 'foag_15.2.1', 'foag_notation_O_text_Proj__S__n': 'foag_15.2.1', 'poonen_curves_notation_zeta_X_s_zeta_function_of_variety': 'poonen_curves_3.4.1 DEFINITION', 'poonen_curves_notation_Z_X_T': 'poonen_curves_3.4.1 DEFINITION', 'some_reference_name_notation_B_R': 'note_with_some_excessive_notation_notes', 'some_reference_name_notation_B_R_1': 'note_with_some_excessive_notation_notes', 'some_reference_name_notation_Jac_C': 'note_with_some_excessive_notation_notes'}
Alternatively, we can specify a subdirectory by a VaultNote
object; the directory that the VaultNote
object is the subdirectory:
= _test_directory() / 'test_vault_7'
vault = VaultNote(vault, name='galois_group')
vn = notations_and_main_notes(vault, subdirectory=None, note=vn)
sample_output print(sample_output)
assert 'foag_notation_M_n_bullet' in sample_output
assert 'some_reference_name_notation_O_X_this_file_has_no_links' in sample_output
assert sample_output['some_reference_name_notation_O_X_this_file_has_no_links'] is None
assert 'poonen_curves_notation_Z_X_T' not in sample_output
{'foag_notation_M_n_bullet': 'twist_of_a_graded_module', 'notation_note_with_main_note_link_but_main_note_does_not_exist': 'nonexistent_note', 'some_reference_name_notation_k_t_formal_power_series_ring': 'some_note', 'some_reference_name_notation_O_X_this_file_has_no_links': None, 'some_reference_name_notation_Pic_C': 'divisor_class_group_of_a_curve', 'some_reference_name_notation_Spec_A': 'spectrum_of_a_ring'}
Check if there is a notation link in the See Also
section of a standard information note.
notation_note_is_linked_in_see_also_section
notation_note_is_linked_in_see_also_section (notation_note:trouver.markd own.obsidian.vault.VaultNote , info_note:Optional[trouver .markdown.obsidian.vault.Vau ltNote]=None)
Return True
if a notation note is linked in the See Also
section of a standard information note.
Type | Default | Details | |
---|---|---|---|
notation_note | VaultNote | ||
info_note | Optional | None | The note in which to find the link to notation_note . Defaults to None , in which case the main note is determined to be the first linked note of notation_note . |
Returns | bool |
notation_note_is_linked_in_see_also_section
Returns True
if a notation note is linked in the See Also
section of an information note:
= _test_directory() / 'test_vault_7'
vault = VaultNote(vault, name='some_reference_name_notation_Pic_C')
notation_note = VaultNote(vault, name='divisor_class_group_of_a_curve')
info_note assert not notation_note_is_linked_in_see_also_section(notation_note, info_note)
= VaultNote(vault, name='foag_notation_M_n_bullet')
notation_note = VaultNote(vault, name='twist_of_a_graded_module')
info_note assert notation_note_is_linked_in_see_also_section(notation_note, info_note)
If info_note
is not specified or if info_note=None
, then the info note in question is the first note which the notation note links to, see the main_of_notation
function:
= _test_directory() / 'test_vault_7'
vault = VaultNote(vault, name='some_reference_name_notation_Pic_C')
notation_note assert not notation_note_is_linked_in_see_also_section(notation_note)
= VaultNote(vault, name='foag_notation_M_n_bullet')
notation_note assert notation_note_is_linked_in_see_also_section(notation_note)
Add notation links to the See Also
section
Add links to individual notation notes
add_notation_note_to_see_also
add_notation_note_to_see_also (notation_note:trouver.markdown.obsidian.v ault.VaultNote, info_note:Optional[trouver .markdown.obsidian.vault.VaultNote]=None, do_not_repeat:bool=True)
*Add a link to a notation note in the See Also
section of a standard information note.
Raises
- NoteDoesNotExistError
- If the information note to link to does not exist.*
Type | Default | Details | |
---|---|---|---|
notation_note | VaultNote | ||
info_note | Optional | None | The note in which to link notation_note . Defaults to None , in which case the main note is determined to be the first linked note of notation_note . |
do_not_repeat | bool | True | If True , do not add a link to notation_note in if there is already a such a link. |
Returns | None |
The add_notation_note_to_see_also
method adds a link to the specified notation note to the specified standard information note.
with tempfile.TemporaryDirectory(prefix='tmp_dir_', dir=os.getcwd()) as tmp_dir:
= Path(tmp_dir)
tmp_dir = tmp_dir / 'test_vault_7'
temp_vault / 'test_vault_7', temp_vault)
shutil.copytree(_test_directory()
= VaultNote(temp_vault, name='some_reference_name_notation_Pic_C')
notation_note = VaultNote(temp_vault, name='divisor_class_group_of_a_curve')
info_note assert not notation_note_is_linked_in_see_also_section(notation_note, info_note)
print("The note's text before adding the link:")
print(info_note.text(), '\n\n')
add_notation_note_to_see_also(notation_note, info_note)assert notation_note_is_linked_in_see_also_section(notation_note, info_note)
print("The note's text after adding the link:")
print(info_note.text())
The note's text before adding the link:
---
cssclass: clean-embeds
aliases: []
tags: [_meta/literature_note, _meta/definition, _meta/notation]
---
# Divisor class group of a curve[^1]
Let $C/k$ be a curve.
The **divisor class group** of $C$, denoted **$\operatorname{Pic} C$**, is defined as $\operatorname{Div} C / \operatorname{Princ} C$.
# See Also
# Meta
## References
## Citations and Footnotes
[^1]: Citation
The note's text after adding the link:
---
cssclass: clean-embeds
aliases: []
tags: [_meta/literature_note, _meta/definition, _meta/notation]
---
# Divisor class group of a curve[^1]
Let $C/k$ be a curve.
The **divisor class group** of $C$, denoted **$\operatorname{Pic} C$**, is defined as $\operatorname{Div} C / \operatorname{Princ} C$.
# See Also
- [[some_reference_name_notation_Pic_C]]
# Meta
## References
## Citations and Footnotes
[^1]: Citation
If info_note
is not specified or is None
, then the information note to add the link is determined to be the first note that notation_note
links to:
with tempfile.TemporaryDirectory(prefix='tmp_dir_', dir=os.getcwd()) as tmp_dir:
= Path(tmp_dir)
tmp_dir = tmp_dir / 'test_vault_7'
temp_vault / 'test_vault_7', temp_vault)
shutil.copytree(_test_directory()
= VaultNote(temp_vault, name='some_reference_name_notation_Pic_C')
notation_note assert not notation_note_is_linked_in_see_also_section(notation_note)
add_notation_note_to_see_also(notation_note)assert notation_note_is_linked_in_see_also_section(notation_note)
If the information note to add the link does not exist, then a NoteDoesNotExistError
is raised:
If do_not_repeat
is not specified or is True
, then the link to the notation note is added only if such a link is not already present:
with tempfile.TemporaryDirectory(prefix='tmp_dir_', dir=os.getcwd()) as tmp_dir:
= Path(tmp_dir)
tmp_dir = tmp_dir / 'test_vault_7'
temp_vault / 'test_vault_7', temp_vault)
shutil.copytree(_test_directory()
= VaultNote(temp_vault, name='foag_notation_M_n_bullet')
notation_note = VaultNote(temp_vault, name='twist_of_a_graded_module')
info_note assert notation_note_is_linked_in_see_also_section(notation_note, info_note)
= info_note.text()
original_text =True)
add_notation_note_to_see_also(notation_note, do_not_repeat= info_note.text()
new_text assert original_text == new_text
assert notation_note_is_linked_in_see_also_section(notation_note, info_note)
# notation_note = VaultNote(temp_vault, name='some_reference_name_notation_Pic_C')
# add_notation_note_to_see_also(notation_note)
# assert notation_note_is_linked_in_see_also_section(notation_note)
Otherwise, the link to the notation note is added even if such a link is already present:
with tempfile.TemporaryDirectory(prefix='tmp_dir_', dir=os.getcwd()) as tmp_dir:
= Path(tmp_dir)
tmp_dir = tmp_dir / 'test_vault_7'
temp_vault / 'test_vault_7', temp_vault)
shutil.copytree(_test_directory()
= VaultNote(temp_vault, name='foag_notation_M_n_bullet')
notation_note = VaultNote(temp_vault, name='twist_of_a_graded_module')
info_note = info_note.text()
original_text =False)
add_notation_note_to_see_also(notation_note, do_not_repeat= info_note.text()
new_text assert original_text != new_text
assert notation_note_is_linked_in_see_also_section(notation_note, info_note)
print(new_text)
---
cssclass: clean-embeds
aliases: []
tags: [_meta/literature_note]
---
# Twist of graded module[^1]
Suppose $M_\bullet$ is a graded $S_\bullet$-module. Define the graded module **$M(n)_\bullet$** by $M(n)_{m}:=M_{n+m}$. Thus the quasicoherent sheaf $M(n)_\bullet$ satisfies
$$ \Gamma\left(D(f), \widetilde{M(n)}_{\bullet}\right)=\left(\left(M_{\bullet}\right)_{f}\right)_{n} $$
where here the subscript means we take the nth graded piece.
# See Also
- [[foag_notation_M_n_bullet]]
- [[foag_notation_M_n_bullet]]
# Meta
## References
![[_reference_foag]]
## Citations and Footnotes
[^1]: Vakil, Invertible 15.2, Page 412
If a link to the notation note is not already present, then add_notation_note_to_see_also
adds such a link to the info note whether or not do_not_repeat
is True
:
with tempfile.TemporaryDirectory(prefix='tmp_dir_', dir=os.getcwd()) as tmp_dir:
= Path(tmp_dir)
tmp_dir = tmp_dir / 'test_vault_7'
temp_vault / 'test_vault_7', temp_vault)
shutil.copytree(_test_directory()
= VaultNote(temp_vault, name='some_reference_name_notation_Pic_C')
notation_note = VaultNote(temp_vault, name='divisor_class_group_of_a_curve')
info_note assert not notation_note_is_linked_in_see_also_section(notation_note, info_note)
=False)
add_notation_note_to_see_also(notation_note, info_note, do_not_repeatassert notation_note_is_linked_in_see_also_section(notation_note, info_note)
Add links to notation notes for all notation notes in a specified subdirectory.
add_missing_notation_links_to_information_notes
add_missing_notation_links_to_information_notes (vault:os.PathLike, subdirectory:Optional[os .PathLike]=None, note:Op tional[trouver.markdown. obsidian.vault.VaultNote ]=None)
*For each notation note in a specified subdirectory, Add links to notation notes in their main information notes if the notation links are not already present.
Raises
- ValueError
- If
subdirectory
andnote
are bothNone
.*
- If
Type | Default | Details | |
---|---|---|---|
vault | PathLike | Path to the vault directory. | |
subdirectory | Optional | None | Path to the subdirectory, relative to vault , to find the notation notes and their main notes. Searches for all notation notes here and in subdirectories of this subdirectory. If None , then the note parameter is used to determine subdirectory . Defaults to None . |
note | Optional | None | A note in the vault. The directory that this note is in determines the subdirectory parameter if it is None . Defaults to None , in which case subdirectory must be specified. |
Returns | None |
The add_missing_notation_links_to_information_notes
method adds links to notation notes of a specified directory to their main notes if these links are not already present. Note that nonexisting information notes which are the “main” notes of notation notes are ignored.
with tempfile.TemporaryDirectory(prefix='tmp_dir_', dir=os.getcwd()) as tmp_dir:
= Path(tmp_dir)
tmp_dir = tmp_dir / 'test_vault_7'
temp_vault / 'test_vault_7', temp_vault)
shutil.copytree(_test_directory()
= VaultNote(temp_vault, name='some_reference_name_notation_Pic_C')
notation_note_1 = VaultNote(temp_vault, name='divisor_class_group_of_a_curve')
main_note_1 = VaultNote(temp_vault, name='some_reference_name_notation_Spec_A')
notation_note_2 = VaultNote(temp_vault, name='spectrum_of_a_ring')
main_note_2 = VaultNote(temp_vault, name='foag_notation_O_n')
notation_note_3 = VaultNote(temp_vault, name='foag_15.2.1')
main_note_3
assert not notation_note_is_linked_in_see_also_section(notation_note_1, main_note_1)
assert not notation_note_is_linked_in_see_also_section(notation_note_2, main_note_2)
assert not notation_note_is_linked_in_see_also_section(notation_note_3, main_note_3)
'')
add_missing_notation_links_to_information_notes(temp_vault, assert notation_note_is_linked_in_see_also_section(notation_note_1, main_note_1)
assert notation_note_is_linked_in_see_also_section(notation_note_2, main_note_2)
assert notation_note_is_linked_in_see_also_section(notation_note_3, main_note_3)