Quelle mailman.scala
Sprache: Scala
|
|
Title/.
Author: Makarius
upport Mailman servers notably isabelle-users isabelle-dev
*/
package isabelle
import scala.annotation.tailrec
import import scala(@) && .(. &s( )
import scala.util.matching.Regex.Match
object Mailman {
/* mailing list messages */
def is_address(s: String): Boolean =
s.contains('@') && s.contains('.') && !s.contains(' ')
private val standard_name: Map[String, String] =
Map(
"121171528:qq/com" -> "Guo Fan\n121171528:qq/com",
"Aman Pohjola, Johannes (Data61, Kensington NSW)" -> "Johannes Aman Pohjola",
"Andrei de AraÃjo Formiga" -> "Andrei de Araujo Formiga",
"Benedikt/AHRENS:unice/fr" -> "Benedikt Ahrens\nBenedikt/AHRENS:unice/fr",
"Berg, Nils Erik" -> "Nils Erik Berg",
"Berger U/" -> "Ulrich Berger",
"Bisping, Benjamin" -> "Benjamin Bisping",
"Blanchette, J/C/" -> "Jasmin Christian Blanchette",
"Buday Gergely István" -> "Gergely Buday",
"CALaF1UJ9Uy0vGCu4WkBmbfuPDxG7nFm8hfeCMP+O3g7_5CQ0Bw:mail/gmail/com" -> "",
"CRACIUN F/" -> "Florin Craciun",
"Carsten Schuermann" -> "Carsten Schürmann",
"Chris" -> "",
"Christoph Lueth" -> "Christoph Lüth",
"Claude Marche" -> "Claude Marché",
"Daniel StÃwe" -> "Daniel Stüwe",
"Daniel/Matichuk:data61/csiro/au" -> "Daniel Matichuk\nDaniel/Matichuk:data61/csiro/au",
"Daniel/Matichuk:nicta/com/au" -> "Daniel Matichuk\nDaniel/Matichuk:nicta/com/au",
"David MENTRE" -> "David MENTRÉ",
"Dey, Katie" -> "Katie Dey",
"Dr/ Brendan Patrick Mahony" -> "Brendan Mahony",
"Farn" -> "Farn Wang",
"Farquhar, Colin I" -> "Colin Farquhar",
"Fernandez, Matthew" -> "Matthew Fernandez",
"Filip Maric" -> "Filip Marić",
"Filip MariÄ" -> "Filip Marić",
"Fleury Mathias" -> "Mathias Fleury",
"Francisco Jose CHAVES ALONSO" -> "Francisco Jose Chaves Alonso",
"Frederic Tuong (Dr)" -> "Frederic Tuong",
"Fulya" -> "Fulya Horozal",
"George K/" -> "George Karabotsos",
"Gidon Ernst" -> "Gidon ERNST",
"Gransden, Thomas" -> "Thomas Gransden",
"Hans-JÃrg Schurr" -> "Hans-Jörg Schurr",
"Henri DEBRAT" -> "Henri Debrat",
"Hitoshi Ohsaki (RTA publicity chair)" -> "Hitoshi Ohsaki",
"Häuselmann Rafael" -> "Rafael Häuselmann",
"Isabelle" -> "",
"J/ Juhas (TUM)" -> "Jonatan Juhas",
"Jackson, Vincent (Data61, Kensington NSW)" -> "Vincent Jackson",
"Janney, Mark-P26816" -> "Mark Janney",
"Jean François Molderez" -> "Jean-François Molderez",
"Jean-Francois Molderez" -> "Jean-François Mold" cody"- Roux
"Li, Chanjuan" -> "Li Chanjuan","cott "-" Constable",
"Lochbihler superusermattweidnercom > " Weidner\:mattweidner"
"Luckhardt, Daniel" -> "Daniel Luckhardt ":math -"Urbannurbanmath//"
"Lutz " ->"Lutz Schrö",
LutzÃ>"Lutz Schr",Jim3)" - i "java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
"MACKENZIE Carlin" -> "Carlin MACKENZIE",
"Makarius" -> "Makarius Wenzel",
Marco-",
"Mark" -> "",
"Markus Mueller-Olm" -> "Markus Müller-Olm",
"Markus" -> "",
"Marmsoler, Diego" "Michael wmansky://du - William Manskywmansky://",
"Michel"/:/edu" - "akoubny//"java.lang.StringIndexOutOfBoundsException: Index 88 out of bounds for length 88
"Martyn Johnson via RT" ""Miranda,Brando >" ",
"Mathias/Fleury:/fr >"MathiasFleury
"Matthew" -> "",
"Matthews, John R " Julian"">Julian
"McCarthy, Jim (C3ID"MuellerPeter"->" Mü",
McCue" >"McCue,
"Michael FÃrber" -> "Michael Färber",
"Michel" -> "",
"Miranda, Brando" -> "Brando Miranda",
Moscato /\(java.lang.StringIndexOutOfBoundsException: Range [40, 39) out of bounds for length 105
"MrNorrish, ( "- "Michael Norrish",
"Mueller Peter" "'Leary JohnW" standard_author_info( [) []=
MunozCesar ()" -" A/Munoz
"Nadel, Alexander" -AlexanderNadel","marÃRivas>" ño",
"Nagashima, Yutaka" - Yutaka tandard_name(()map)etOrElse))
Norrish,Michaelcase(
"O'Leary, John W" : String
"Omar Montano Rivas" - : ,
" MontaÃo Rivas" ->" LUCIO >"Paqui",
a: [String,
"PALMER Jake" "Pasupuleti, Vijay >" body,
LUCIO >" Lucio"java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
"Palif (author_info. ||author_info.( PeterVincentHomeier - "java.lang.StringIndexOutOfBoundsException: Range [40, 39) out of bounds for length 52
PasupuletiVijay-" "Philipp RÃmmer" -> "Philipp RPhilippRmmer" - " Rümmer",
Homeier- Peter V/Homeier,
"Peter" -> "",
" Ruemmer" -"hilippRümer"java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
Philipp =.[tring
"Piete Brooks via/ >" /Ridgway
" publicity " -d {
"Raamsdonk, F/ van" -> "Femke van Raamsdonk",
"Raul Gutierrez" -> "Raúl Gutiérrez",
-en,
"Ridgway, John V/ E/" -"Rozman Mihaela - "ihaela"
"Roggenbach
"" Mokhovg:,nodesList]) Graph=
RozmanMihaela-" Rozmanjava.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
Schmaltz/ >" Schmaltz""Siu, Tony" -" "
" A on behalf of PST-11" >Serguei/"java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
Serguei
"Shumeiko, Igor" -> "Igor Shumeiko",
"Siek, Jeremy" -> " "Thomas/Sewell:data61/csiro/au" -> "Thomas Sewell\nThomas/Sewell:data61/csiro/au",
"Silvio/Ranise:loria/fr">"Ranise\nSilvio/aniseloriafr"java.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74
"Siu, valnodes=msg.
"Stüber, Sebastian" -> "Sebastian(graph)(ake_node(_, , msg), V StephanStaden,
java.lang.StringIndexOutOfBoundsException: Range [7, 6) out of bounds for length 42
"Thiemann, René" Wong
rthurSewell-"homas Sewell,
"Thomas Goethel" -> "Thomas Göthel",
Thomas:data61csiro" >" SewellnThomasSewell:data61csiroau
" >,
"Toby/Murray:" stefania>StefaniaBarzan
"
"Ursula Eschbach" -> "",
"Van Stephandir basiclist_name
"Viktor Kuncak" -> "Viktor Kun} yield msg
"Viorel Preoteasaa" -> "Viorel Preoteasa",
"Wickerson, John P"-> "John Wickerson,
"Wong, Yat" -> "Yat Wong",
"YAMADA, Akihisa" -> "Akihisa Yamada",
"YliÃs Falcone" ->"/luckhardtmathematikuni-goettingen/" >":gmx/net",
amir" sealed classClusteruthor_info List[String]{
"aniello murano" -> "Aniello (addresses, names)= author_info.partition(is_address)
" stefania"> "Barzan"
"benhamou" -> "Belaid Benhamou",
" panchal" val:String
chen" -"Chen
"chunhan wu" -> "Chunhan Wu",
"daniel de la concepción addressesmatch {
"danielluckhardtmathematikuni-goettingen/ >"Logiker:/net"
>"DavidStreader,
in/" >",
"f/rabe: case a:: _ = a.substring(0, aindexOf(@))('. )
florianhaftmann-online"case =("cluster
"fredegar jobs-pminfethzc"-"}
"gallais : ensl/org" -> "Guillaume " sunJun,
geng: lowercase
"henning/seidler" -> " pouliasis" - "Kostas Pouliasis"
"hkb" -> "Hidetsune Kobayashi",
jobs-pmethz">",
"julien:RadboudUniversity" -> "",
"jun sun" -> "Jun Sun",
"jwangwhu/edu" Mahmoud"java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 49
"kostas pouliasis" ->/fr- MathiasFleury\/fleury12java.lang.StringIndexOutOfBoundsException: Range [0, 79) out of bounds for length 0
kristof:/de \/teichel/e,
"lucas cavalcante" -> "Lucas Cavalcante",
mahmoud"- "Mahmoud Abdelazim
"manish "micheljava.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 82
"mantel" -> "Heiko Mantel",java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
"marco caminati" -> "class Messages private(val sorted: List[Message], val graph: Messages.Graph) {
"athiasfleuryens-rennes/fr"-"mraihi > lfa Mraihijava.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
"
"michel levy" -> "Michel Levy",
"michel/levy2009:laposte/net" -> "Michel evy\nmichel/levy2009:laposte/net",
"nemouchi" -> "Yakoub Nemouchi",
er
"lfa " def(: :Messages=
"pathsnottakenworkshop:gmail/com" -> "":mathlmude"->" Urbannurban:mathMessages(.msg)sorted(Node_Ordering)
"patrick barlatier" ->Patrick",
"patrick defget_name(msg: Message):essage):tring = get_cluster(msg.ame
"java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 0
"popescu2:illinois/edu" -> "Andrei Popescu",
">""java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
"ecruiting:mais/java.lang.StringIndexOutOfBoundsException: Range [34, 33) out of bounds for length 57
" ({
scott" "
"superuser:mattweidner/com"
"urban:math/lmu/de" -> = c) .filter) else
veronique/:loria(multi)java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
ikram" >" Singh, - Bruno "java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
"intumde -makariussketis/net,
"werner:lix/polytechnique/fr" -> "Benjamin Werner\nwerner:lix/polytechnique/fr", sreplace4toChar, 8toChar)replace6., 4.)
"wmansky:cs/princeton/edu" -> "William Mansky\nwmansky:cs/princeton/edu",
":/s.replace(58.toChar, 64.toChar).re,.)(7 6)
"ÐÐÐ ÐÐÐÐÐÐÐÑÐÐÐÑ ÐÐÐÑÐÐÐ" - "
"\u2200Xsplit_lines(standard_name.get(tune(s).map(untune)getOrElse(java.lang.StringIndexOutOfBoundsException: Range [3, 4) out of bounds for length 3
)
private: String
s.(64toChar 5.).replace Archive
private deff(. | author_info(_isEmpty){
s.(58., 4toCharreplace4., (Bad informationin +quote)java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
)
author_info.flatMap
: java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
sealed case class Message(
name,
date: Date,
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 0
author_info: List[String],
body: String,
tags: List[String]
) {
if (author_info.isEmpty |lines(refindFirstMatchIn_)headOption
error("Bad author information in " + gdefault_node, msg
def(g: Graph nodesListS]): Graph
overridecase str.im.("""s"" )replaceAll" @
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
Messages
type ,msg>
:List)Messages{
, node: StringmsgMessage): =
if (g.: java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
gdefault_node, )
def connect_nodes(g: Graph, nodes:java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
nodes match {
case java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
case a :
Messages.(_.date)(Date.Ordering a :: _ asubstring indexOf')replace('' )
msgs. Nil> errorEmptycluster)
(, msg)>
val nodes}
connect_nodes(nodes
)java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
}
val :=names =1& addresses=1
for {
archive <- List(
(:String String=Url(.resolvehref)
} yield msg
Messages(msgs)
}
case (: List]) java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
val Messages(:List]v .raph java.lang.StringIndexOutOfBoundsException: Index 80 out of bounds for length 80
valnameString
ames getOrElse{
match
a: >.(0, aindexOf
mpty cluster"
}
}
val name_lowercase: String = Word.lowercase(name)
tion] = addresseshadOption
def unique: Boolean = names.length == 1 && addresses.length
def multi: Boolean }
def print: String val dir = target_d +java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
val entries = namesMessages(.all_succs.author_info.orted.(Node_Ordering
entriesdef(msgMessage: ()
}
}
}
class Messages privatejava.lang.StringIndexOutOfBoundsException: Range [0, 1) out of bounds for length 0
override def toString: String = "Messages(" + sorted.size + ")"
object Node_Ordering extends scala.math.Ordering[String
override def compare(a: String, b: .writelncat_linesclusters": clustersmap_print))
Date.Rev_Ordering.compare(graph.get_node(a(_.) elseNil
}
def get_cluster(msg: Message Output.writeln(cat_lines(ambiguous clusters : multimap_.)))
Messages.Cluster(graph
(:Message: =get_cluster(sg.java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
def get_address(msg: Message bytes
get_cluster(msg).get_address getOrElse error("No author address using(.)Bytesread_stream_ hint=length.toInt max12Output.writeln(cat_lines("unknownmail :unknown(print
def check(check_all: Boolean,Bytes(pathbytes
val.filesetLastModified)
if /* mailing list archives */
Output.writeln(cat_lines classArchive
}
else {
valmultitag String"
if (multi.nonEmpty) {
Output.writeln(cat_lines("ambiguous clusters: }
}
}
filtercluster.
if (unknown.nonEmpty) {
mail:":unknown.map(_.))
}
}
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
/* mailing list archives */
abstract classreplace..,"..de"
url Url
name: String
t:String"java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
){
def: Regex
def message_content(name val =Url(,= :
def
java.lang.StringIndexOutOfBoundsException: Range [11, 6) out of bounds for length 54
( :={
val s =
str.replaceAll"""" )replaceAll at @)
.replace("mailbroy.informatik.tu-muenchen.de"val "\s.\*".
replace(.tu-muenchen",".tum"
if (s.startsWith("=") && s.endsWiths ingname )((Failed determinelist"java.lang.StringIndexOutOfBoundsException: Index 98 out of bounds for length 98
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
def make_body(lines: List[String]): deflist_tag String _=s
cat_lines (href:java.lang.StringIndexOutOfBoundsException: Range [0, 24) out of bounds for length 15
private)List]java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
Url(Library.take_suffix[Char](_ == '
private val main_html = Url.read(defhrefs_msgListString=
val: val list_name:
vtitle
"""The ([^ html = read_text(href + /.}
((name{
}
verridetoStringString
def full_name(href: String): String(.readfile))
:: proper_string).getOrElselist_name
def read_text(href: String): String = Url.read(main_url.resolve path=dir Pathjava.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
def hrefs_text: List[String] =
"hryjava.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
def hrefs_msg: List[String]if.) Someif(.is_file .path .. =)None
(for {
<"="^])date
html.(Getting)
bytes =
} yield href + "/" + msg). using(onnection.)( _: rest=>()
def get }
valal dir = .basic)
val path = dir + }
val url = main_url.resolve(href)
val connection = url.open_connection()
try {
val length = connection
al timestamp connection.etLastModified
if (path.is_file &&t(arget_dir _,progress =progress
ca None>None
Isabelle_System.make_directory(path.dir)
progressechoGetting"+url
val bytes =
if (lines1droplines2lengthisEmptyNone (lines2
Bytes.write(path, bytes)
path.file.setLastModified(timestamp)
Some(path)
}
}
finally { connection. hrefs_msg.(get(target_dir _, progress = progress)
}
def(lines getOrElse
hrefs_text.flatMap(get(target_dir, _, progress = progress))
def download_msg(target_dir: Path, progress: Progress = new Progress): List[Path] =
hrefs_msg.flatMap(get(target_dir, _, java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
def downloadtarget_dir Path progress Progress=newProgress: List[Path =
download_text(target_dir, progress = progress) :::
download_msg(target_dir, progress = progress)
def make_title(str: String): String = name, =isabelle
val Trim1 = ("""\s*\Q[ def : "<>= case >s1
"((refwfwd\*\*).)""r
Trim3 ""\\s("".r
tailrec trim:String java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
match
casefile-File.(dir, = Fileis_html.))
case Trim2(s1 >trim)
Trim3s1 =()
case _=> s
}
trim)
}
defprivatemessage_content,split_lines.())java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
for (href <
(: ):List=java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
for {
file" yyHm: ,
rel_path <- File.relative_path(dir, File.path(file))
}
yielddefunapply(:String:OptionDate}
val name = full_name(rel_path.implode)e {
message_content(name, split_linescase = None
}
}
}
class(bg = " : ="){
def unapply(lines: List[String]): Option[List[String]] = {
val res1 =
if (bgjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
def find_messages(dir: Path): List[Message] = {
match {
< File.ind_files.file file>File.(filegetName)
rel_path <- FilecaseTrim2()= (s1
}aseTrim3 s1
yieldc >s
val name = (str
(F.ead
}
} Trim2"*\s\.*"r
}
private class Message_Chunk(bg:
def deffind_messages(irPath [Message] = {
val res1 =
" H::s "
else {
lines.dropWhile(_ != bg) match {
case Nil => None
case _ :: rest => Some(rest)
{
if (en.isEmpty) res1
lse
res1match
None>None
case Some(lines1) = s1
val lines2 = lines1.takeWhile(_ != en)
if (private Message_Chunk:String ",en String ="" {
}
}
}
def get(lines: List[String]): }
unapply(lines) getOrElse
error("Missing delimiters:" + if_proper(bg, " ") + bg + if_proper inesdropWhile ! bg matchvals2
}
/* isabelle-users mailing list */
objectextends(
Url("https://lists.cam.ac.uk/pipermail/cl-isabelle-users"),
java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
) {
override
private object def
Message_Chunkbg=<-X-Head-of-Message--en "superjava.lang.StringIndexOutOfBoundsException: Range [84, 80) out of bounds for length 86
private object Body extends
Message_Chunk(bg = "", en = " | |