Changeset 2475 for lang/python
- Timestamp:
- 12/05/07 15:33:34 (5 years ago)
- Location:
- lang/python/81kun
- Files:
-
- 2 modified
-
actions/http.py (modified) (2 diffs)
-
rules.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
lang/python/81kun/actions/http.py
r2473 r2475 1 1 # -*- coding: utf-8 -*- 2 # http return codeを ランダムに答える2 # http return codeを適当に答える 3 3 CODES = """ 4 4 100 Continue … … 41 41 """.strip().split("\n") 42 42 43 def say(self, e): 44 from random import choice 45 self.say(choice(CODES)) 43 N = len(CODES) 44 45 def say(self, e, msg): 46 self.say(CODES[hash(msg) % N]) -
lang/python/81kun/rules.py
r2473 r2475 7 7 ("81reload", actions.reload), 8 8 ("bad_words \+= (?P<words>.*)", actions.register_bad_word), 9 ("81http ", actions.http.say),9 ("81http (?P<msg>.*)", actions.http.say), 10 10 11 11 ("regexp /(?P<regexp>.+)/ => (?P<result>.+)",
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)