本文整理汇总了Python中profile.Profile类的典型用法代码示例。如果您正苦于以下问题:Python Profile类的具体用法?Python Profile怎么用?Python Profile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Profile类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: callback_audio
def callback_audio(toxav, friend_number, samples, audio_samples_per_channel, audio_channels_count, rate, user_data):
"""New audio chunk"""
print audio_samples_per_channel, audio_channels_count, rate
Profile.get_instance().call.chunk(
''.join(chr(x) for x in samples[:audio_samples_per_channel * 2 * audio_channels_count]),
audio_channels_count,
rate)
示例2: fetch_profile
def fetch_profile (profileId):
profile = Profile(str(profileId))
playerPage = get_full_page_stats(profile.hotslogsId)
profile.heroes = get_heroes_stats(playerPage)
profile.maps = get_map_stats(playerPage)
profile.enemies = get_winrates_against_heroes(playerPage)
return profile.toJSON()
示例3: attach
def attach (self, bockbuild):
Profile.attach (self, bockbuild)
self.name = 'unix'
self.env = Environment(self)
self.staged_prefix = bockbuild.staged_prefix
self.toolchain_root = bockbuild.toolchain_root
self.gcc_flags = ['-I%s/include' % self.staged_prefix]
self.ld_flags = ['-L%s/lib' % self.staged_prefix]
self.env.set('BUILD_PREFIX', '%{prefix}')
self.env.set('PATH', ':',
'%{toolchain_root}/bin',
'%{staged_prefix}/bin',
'/usr/bin',
'/bin',
'/usr/local/git/bin')
self.env.set('C_INCLUDE_PATH', '%{staged_prefix}/include')
#self.env.set ('LD_LIBRARY_PATH', '%{staged_prefix}/lib')
self.env.set('ACLOCAL_FLAGS', '-I%{staged_prefix}/share/aclocal')
self.env.set('PKG_CONFIG_PATH', ':',
'%{staged_prefix}/lib/pkgconfig',
'%{staged_prefix}/share/pkgconfig',
'%{toolchain_root}/lib/pkgconfig',
'%{toolchain_root}/share/pkgconfig')
self.env.set('XDG_CONFIG_DIRS', '%{staged_prefix}/etc/xdg')
self.env.set('XDG_DATA_DIRS', '%{staged_prefix}/share')
self.env.set('XDG_CONFIG_HOME', '$HOME/.config')
示例4: __init__
def __init__ (self, prefix = False):
Profile.__init__ (self, prefix)
self.name = 'unix'
self.gcc_flags = ['-I%s/include' % self.staged_prefix]
self.ld_flags = ['-L%s/lib' % self.staged_prefix]
self.env.set ('PATH', ':',
'%{toolchain_root}/bin',
'%{staged_prefix}/bin',
'/usr/bin',
'/bin',
'/usr/local/git/bin')
self.env.set ('C_INCLUDE_PATH', '%{staged_prefix}/include')
#self.env.set ('LD_LIBRARY_PATH', '%{staged_prefix}/lib')
self.env.set ('ACLOCAL_FLAGS', '-I%{staged_prefix}/share/aclocal')
self.env.set ('PKG_CONFIG_PATH', ':',
'%{staged_prefix}/lib/pkgconfig',
'%{staged_prefix}/share/pkgconfig',
'%{toolchain_root}/lib/pkgconfig',
'%{toolchain_root}/share/pkgconfig')
self.env.set ('XDG_CONFIG_DIRS', '%{staged_prefix}/etc/xdg')
self.env.set ('XDG_DATA_DIRS', '%{staged_prefix}/share')
self.env.set ('XDG_CONFIG_HOME', '$HOME/.config')
示例5: set_avatar
def set_avatar(self):
name = QtGui.QFileDialog.getOpenFileName(self, 'Open file', None, 'Image Files (*.png)')
print name
if name[0]:
with open(name[0], 'rb') as f:
data = f.read()
Profile.get_instance().set_avatar(data)
示例6: Login
class Login(flask.views.MethodView):
def __init__(self):
self.users = Users()
self.profile = Profile()
def get(self):
if 'email' in session:
return self.profile.get()
else:
return flask.render_template('login.html')
def post(self):
print request.form['username']
session['email'] = request.form['username']
success = self.users.loginCheck(request.form['username'],request.form['password'])
print success
if(success):
#r = requests.get('http://localhost/profile')
return self.profile.get()
#Response(
# r.text,
# status=r.status_code,
# content_type=r.headers['content-type'],
# )
else:
return flask.render_template('login.html')
示例7: search
def search(self):
Profile.get_instance().update()
text = self.search_text.text()
friend = Profile.get_instance().get_curr_friend()
if text and friend and util.is_re_valid(text):
index = friend.search_string(text)
self.load_messages(index)
示例8: __init__
def __init__ (self, prefix = False):
Profile.__init__ (self, prefix)
self.name = 'unix'
self.gcc_flags = [ '-I%{prefix}/include' ]
self.ld_flags = [ '-L%{prefix}/lib' ]
try:
self.gcc_flags.extend (self.gcc_extra_flags)
except:
pass
try:
self.ld_flags.extend (self.ld_extra_flags)
except:
pass
self.env.set ('PATH', ':',
'%{prefix}/bin',
'/usr/bin',
'/bin',
'/usr/local/git/bin')
self.env.set ('C_INCLUDE_PATH', '%{prefix}/include')
self.env.set ('LD_LIBRARY_PATH', '%{prefix}/lib')
self.env.set ('ACLOCAL_FLAGS', '-I%{prefix}/share/aclocal')
self.env.set ('PKG_CONFIG_PATH', ':',
'%{prefix}/lib/pkgconfig',
'%{prefix}/share/pkgconfig')
self.env.set ('XDG_CONFIG_DIRS', '%{prefix}/etc/xdg')
self.env.set ('XDG_DATA_DIRS', '%{prefix}/share')
self.env.set ('XDG_CONFIG_HOME', '$HOME/.config')
示例9: _exec_main
def _exec_main(parser, values):
sconsflags = os.environ.get('SCONSFLAGS', '')
all_args = sconsflags.split() + sys.argv[1:]
options, args = parser.parse_args(all_args, values)
if isinstance(options.debug, list) and "pdb" in options.debug:
import pdb
pdb.Pdb().runcall(_main, parser)
elif options.profile_file:
# compat layer imports "cProfile" for us if it's available.
from profile import Profile
# Some versions of Python 2.4 shipped a profiler that had the
# wrong 'c_exception' entry in its dispatch table. Make sure
# we have the right one. (This may put an unnecessary entry
# in the table in earlier versions of Python, but its presence
# shouldn't hurt anything).
try:
dispatch = Profile.dispatch
except AttributeError:
pass
else:
dispatch['c_exception'] = Profile.trace_dispatch_return
prof = Profile()
try:
prof.runcall(_main, parser)
except SConsPrintHelpException, e:
prof.dump_stats(options.profile_file)
raise e
except SystemExit:
pass
示例10: read_profile
def read_profile(file_name):
f = open(file_name, "r")
profile = Profile()
for line in f:
profile.process_sample(line)
return profile
示例11: call_state
def call_state(toxav, friend_number, mask, user_data):
"""New call state"""
print friend_number, mask
if mask == TOXAV_FRIEND_CALL_STATE['FINISHED'] or mask == TOXAV_FRIEND_CALL_STATE['ERROR']:
invoke_in_main_thread(Profile.get_instance().stop_call, friend_number, True)
else:
Profile.get_instance().call.toxav_call_state_cb(friend_number, mask)
示例12: unblock_user
def unblock_user(self):
if not self.comboBox.count():
return
title = QtGui.QApplication.translate("privacySettings", "Add to friend list", None, QtGui.QApplication.UnicodeUTF8)
info = QtGui.QApplication.translate("privacySettings", "Do you want to add this user to friend list?", None, QtGui.QApplication.UnicodeUTF8)
reply = QtGui.QMessageBox.question(None, title, info, QtGui.QMessageBox.Yes, QtGui.QMessageBox.No)
Profile.get_instance().unblock_user(self.comboBox.currentText(), reply == QtGui.QMessageBox.Yes)
self.close()
示例13: __init__
def __init__(self, name, CertClass):
Profile.__init__(self, name, CertClass)
self._certs_by_subj.set_filename("users/"+str(name)+"/certs.subj")
self._certs_by_issuer.set_filename("users/"+str(name)+"/certs.issuer")
# overload meaning of FileCertifications here to store user-profile.
self.info = FileCertifications()
self.info.set_filename("users/"+str(name)+"/profile")
示例14: callback_audio
def callback_audio(toxav, friend_number, samples, audio_samples_per_channel, audio_channels_count, rate, user_data):
"""
New audio chunk
"""
Profile.get_instance().call.chunk(
bytes(samples[:audio_samples_per_channel * 2 * audio_channels_count]),
audio_channels_count,
rate)
示例15: get_ep_profile
def get_ep_profile( profiledb, edgepayload ):
combiner = Profile()
streets = unpack_streets( edgepayload )
for street in streets:
combiner.add( get_street_profile(profiledb, street) )
return combiner.concat() #reduce( lambda x,y:x+y, profile )