Re: [Bug 534397] [NEW] munin plugin suppresses numbers from VM names

2010-03-10 Thread Soren Hansen
On Wed, Mar 10, 2010 at 03:32:13AM -, Bernie Innocenti wrote:
 one could reach a similar level of conciseness even in Python:
 
   re.sub(r[^A-Za-z0-9], _, foo)

No. The first character cannot be a numeral as per

   http://munin-monitoring.org/wiki/notes_on_datasource_names

-- 
Soren Hansen
Ubuntu Developer
http://www.ubuntu.com/

-- 
munin plugin suppresses numbers from VM names
https://bugs.launchpad.net/bugs/534397
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs


Re: [Bug 534397] [NEW] munin plugin suppresses numbers from VM names

2010-03-10 Thread Bernie Innocenti
On Wed, 2010-03-10 at 10:09 +, Soren Hansen wrote:
 On Wed, Mar 10, 2010 at 03:32:13AM -, Bernie Innocenti wrote:
  one could reach a similar level of conciseness even in Python:
  
re.sub(r[^A-Za-z0-9], _, foo)
 
 No. The first character cannot be a numeral as per
 
http://munin-monitoring.org/wiki/notes_on_datasource_names

Oh, right. Then... hmmm... we could use two alternate patterns:

 re.sub(r^[^A-Za-z]|[^A-Za-z0-9], _, foo)

-- 
   // Bernie Innocenti - http://codewiz.org/
 \X/  Sugar Labs   - http://sugarlabs.org/

-- 
munin plugin suppresses numbers from VM names
https://bugs.launchpad.net/bugs/534397
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs


Re: [Bug 534397] [NEW] munin plugin suppresses numbers from VM names

2010-03-09 Thread Bernie Innocenti
On Mon, 2010-03-08 at 19:53 +, Soren Hansen wrote:
  Perl's eclecticism :-)
 
 Well, yeah, except this is Python :)

Oh, my... I must have been SO drunk to confuse Perl with Python.
But, wait: one could reach a similar level of conciseness even in
Python:

  re.sub(r[^A-Za-z0-9], _, foo)

-- 
   // Bernie Innocenti - http://codewiz.org/
 \X/  Sugar Labs   - http://sugarlabs.org/

-- 
munin plugin suppresses numbers from VM names
https://bugs.launchpad.net/bugs/534397
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs


[Bug 534397] [NEW] munin plugin suppresses numbers from VM names

2010-03-08 Thread Bernie Innocenti
Public bug reported:

Binary package hint: virt-goodies

The valid regex should be [A-Za-z0-9_] (with numbers included).

Also, the entire canonicalize() function could be replaced with just one
line:

  tr/A-Za-z0-9/_/c

or even

  s/[^A-Za-z0-9]/_/g


Perl's eclecticism :-)

** Affects: virt-goodies (Ubuntu)
 Importance: Undecided
 Status: New

-- 
munin plugin suppresses numbers from VM names
https://bugs.launchpad.net/bugs/534397
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs


Re: [Bug 534397] [NEW] munin plugin suppresses numbers from VM names

2010-03-08 Thread Soren Hansen
On Mon, Mar 08, 2010 at 02:02:14PM -, Bernie Innocenti wrote:
 The valid regex should be [A-Za-z0-9_] (with numbers included).

Not exactly. According to

   http://munin-monitoring.org/wiki/notes_on_datasource_names

these two should do it:

s/^[^A-Za-z_]/_/
s/[^A-Za-z0-9_]/_/g

 Also, the entire canonicalize() function could be replaced with just one
 line:
 
   tr/A-Za-z0-9/_/c
 
 or even
 
   s/[^A-Za-z0-9]/_/g
 
 
 Perl's eclecticism :-)

Well, yeah, except this is Python :)

-- 
Soren Hansen
Ubuntu Developer
http://www.ubuntu.com/

-- 
munin plugin suppresses numbers from VM names
https://bugs.launchpad.net/bugs/534397
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs