-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
zhaozhen
committed
Jun 30, 2016
1 parent
5f556c0
commit 040e0d1
Showing
12 changed files
with
68 additions
and
10 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
""" | ||
常量 | ||
""" | ||
|
||
import util.decorate as decorate | ||
|
||
|
||
@decorate.singleton | ||
class Constants(object): | ||
|
||
def __init__(self): | ||
import configparser | ||
self.parser = configparser | ||
print("init") | ||
pass | ||
|
||
def get(self): | ||
|
||
pass | ||
|
||
constants = Constants |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
""" | ||
爬虫头 | ||
""" | ||
|
||
import configparser | ||
|
||
|
||
class Head(object): | ||
|
||
def __init__(self): | ||
pass | ||
|
||
def get_config(self): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
""" | ||
爬虫 | ||
""" | ||
|
||
|
||
class Insect(object): | ||
def __init__(self): | ||
pass |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash python | ||
|
||
|
||
import frame.constants as cons | ||
|
||
if __name__ == '__main__': | ||
constants = cons.constants | ||
constants2 = cons.Constants() | ||
constants3 = cons.Constants() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
""" | ||
装饰器 | ||
""" | ||
|
||
|
||
def singleton(cls, *args, **kw): | ||
""" | ||
使用singleton装饰器后,该类成为单例类 | ||
""" | ||
instances = {} | ||
|
||
def _singleton(): | ||
if cls not in instances: | ||
instances[cls] = cls(*args, **kw) | ||
return instances[cls] | ||
return _singleton |