id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
51
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
2,200
Skype4Py/Skype4Py
Skype4Py/skype.py
Skype.PlaceCall
def PlaceCall(self, *Targets): """Places a call to a single user or creates a conference call. :Parameters: Targets : str One or more call targets. If multiple targets are specified, a conference call is created. The call target can be a Skypename, phone number, or spe...
python
def PlaceCall(self, *Targets): calls = self.ActiveCalls reply = self._DoCommand('CALL %s' % ', '.join(Targets)) # Skype for Windows returns the call status which gives us the call Id; if reply.startswith('CALL '): return Call(self, chop(reply, 2)[1]) # On linux we get...
[ "def", "PlaceCall", "(", "self", ",", "*", "Targets", ")", ":", "calls", "=", "self", ".", "ActiveCalls", "reply", "=", "self", ".", "_DoCommand", "(", "'CALL %s'", "%", "', '", ".", "join", "(", "Targets", ")", ")", "# Skype for Windows returns the call sta...
Places a call to a single user or creates a conference call. :Parameters: Targets : str One or more call targets. If multiple targets are specified, a conference call is created. The call target can be a Skypename, phone number, or speed dial code. :return: A call obj...
[ "Places", "a", "call", "to", "a", "single", "user", "or", "creates", "a", "conference", "call", "." ]
c48d83f7034109fe46315d45a066126002c6e0d4
https://github.com/Skype4Py/Skype4Py/blob/c48d83f7034109fe46315d45a066126002c6e0d4/Skype4Py/skype.py#L680-L701
2,201
Skype4Py/Skype4Py
Skype4Py/skype.py
Skype.SendCommand
def SendCommand(self, Command): """Sends an API command. :Parameters: Command : `Command` Command to send. Use `Command` method to create a command. """ try: self._Api.send_command(Command) except SkypeAPIError: self.ResetCache() ...
python
def SendCommand(self, Command): try: self._Api.send_command(Command) except SkypeAPIError: self.ResetCache() raise
[ "def", "SendCommand", "(", "self", ",", "Command", ")", ":", "try", ":", "self", ".", "_Api", ".", "send_command", "(", "Command", ")", "except", "SkypeAPIError", ":", "self", ".", "ResetCache", "(", ")", "raise" ]
Sends an API command. :Parameters: Command : `Command` Command to send. Use `Command` method to create a command.
[ "Sends", "an", "API", "command", "." ]
c48d83f7034109fe46315d45a066126002c6e0d4
https://github.com/Skype4Py/Skype4Py/blob/c48d83f7034109fe46315d45a066126002c6e0d4/Skype4Py/skype.py#L770-L781
2,202
Skype4Py/Skype4Py
Skype4Py/skype.py
Skype.SendSms
def SendSms(self, *TargetNumbers, **Properties): """Creates and sends an SMS message. :Parameters: TargetNumbers : str One or more target SMS numbers. Properties Message properties. Properties available are same as `SmsMessage` object properties. :re...
python
def SendSms(self, *TargetNumbers, **Properties): sms = self.CreateSms(smsMessageTypeOutgoing, *TargetNumbers) for name, value in Properties.items(): if isinstance(getattr(sms.__class__, name, None), property): setattr(sms, name, value) else: raise ...
[ "def", "SendSms", "(", "self", ",", "*", "TargetNumbers", ",", "*", "*", "Properties", ")", ":", "sms", "=", "self", ".", "CreateSms", "(", "smsMessageTypeOutgoing", ",", "*", "TargetNumbers", ")", "for", "name", ",", "value", "in", "Properties", ".", "i...
Creates and sends an SMS message. :Parameters: TargetNumbers : str One or more target SMS numbers. Properties Message properties. Properties available are same as `SmsMessage` object properties. :return: An sms message object. The message is already sent at ...
[ "Creates", "and", "sends", "an", "SMS", "message", "." ]
c48d83f7034109fe46315d45a066126002c6e0d4
https://github.com/Skype4Py/Skype4Py/blob/c48d83f7034109fe46315d45a066126002c6e0d4/Skype4Py/skype.py#L797-L816
2,203
Skype4Py/Skype4Py
Skype4Py/skype.py
Skype.SendVoicemail
def SendVoicemail(self, Username): """Sends a voicemail to a specified user. :Parameters: Username : str Skypename of the user. :note: Should return a `Voicemail` object. This is not implemented yet. """ if self._Api.protocol >= 6: self._DoComm...
python
def SendVoicemail(self, Username): if self._Api.protocol >= 6: self._DoCommand('CALLVOICEMAIL %s' % Username) else: self._DoCommand('VOICEMAIL %s' % Username)
[ "def", "SendVoicemail", "(", "self", ",", "Username", ")", ":", "if", "self", ".", "_Api", ".", "protocol", ">=", "6", ":", "self", ".", "_DoCommand", "(", "'CALLVOICEMAIL %s'", "%", "Username", ")", "else", ":", "self", ".", "_DoCommand", "(", "'VOICEMA...
Sends a voicemail to a specified user. :Parameters: Username : str Skypename of the user. :note: Should return a `Voicemail` object. This is not implemented yet.
[ "Sends", "a", "voicemail", "to", "a", "specified", "user", "." ]
c48d83f7034109fe46315d45a066126002c6e0d4
https://github.com/Skype4Py/Skype4Py/blob/c48d83f7034109fe46315d45a066126002c6e0d4/Skype4Py/skype.py#L818-L830
2,204
Skype4Py/Skype4Py
Skype4Py/skype.py
Skype.User
def User(self, Username=''): """Queries a user object. :Parameters: Username : str Skypename of the user. :return: A user object. :rtype: `user.User` """ if not Username: Username = self.CurrentUserHandle o = User(self, Username...
python
def User(self, Username=''): if not Username: Username = self.CurrentUserHandle o = User(self, Username) o.OnlineStatus # Test if such a user exists. return o
[ "def", "User", "(", "self", ",", "Username", "=", "''", ")", ":", "if", "not", "Username", ":", "Username", "=", "self", ".", "CurrentUserHandle", "o", "=", "User", "(", "self", ",", "Username", ")", "o", ".", "OnlineStatus", "# Test if such a user exists....
Queries a user object. :Parameters: Username : str Skypename of the user. :return: A user object. :rtype: `user.User`
[ "Queries", "a", "user", "object", "." ]
c48d83f7034109fe46315d45a066126002c6e0d4
https://github.com/Skype4Py/Skype4Py/blob/c48d83f7034109fe46315d45a066126002c6e0d4/Skype4Py/skype.py#L832-L846
2,205
Skype4Py/Skype4Py
Skype4Py/skype.py
Skype.Voicemail
def Voicemail(self, Id): """Queries the voicemail object. :Parameters: Id : int Voicemail Id. :return: A voicemail object. :rtype: `Voicemail` """ o = Voicemail(self, Id) o.Type # Test if such a voicemail exists. return o
python
def Voicemail(self, Id): o = Voicemail(self, Id) o.Type # Test if such a voicemail exists. return o
[ "def", "Voicemail", "(", "self", ",", "Id", ")", ":", "o", "=", "Voicemail", "(", "self", ",", "Id", ")", "o", ".", "Type", "# Test if such a voicemail exists.", "return", "o" ]
Queries the voicemail object. :Parameters: Id : int Voicemail Id. :return: A voicemail object. :rtype: `Voicemail`
[ "Queries", "the", "voicemail", "object", "." ]
c48d83f7034109fe46315d45a066126002c6e0d4
https://github.com/Skype4Py/Skype4Py/blob/c48d83f7034109fe46315d45a066126002c6e0d4/Skype4Py/skype.py#L862-L874
2,206
Skype4Py/Skype4Py
Skype4Py/application.py
Application.Connect
def Connect(self, Username, WaitConnected=False): """Connects application to user. :Parameters: Username : str Name of the user to connect to. WaitConnected : bool If True, causes the method to wait until the connection is established. :return: If ``...
python
def Connect(self, Username, WaitConnected=False): if WaitConnected: self._Connect_Event = threading.Event() self._Connect_Stream = [None] self._Connect_Username = Username self._Connect_ApplicationStreams(self, self.Streams) self._Owner.RegisterEventHa...
[ "def", "Connect", "(", "self", ",", "Username", ",", "WaitConnected", "=", "False", ")", ":", "if", "WaitConnected", ":", "self", ".", "_Connect_Event", "=", "threading", ".", "Event", "(", ")", "self", ".", "_Connect_Stream", "=", "[", "None", "]", "sel...
Connects application to user. :Parameters: Username : str Name of the user to connect to. WaitConnected : bool If True, causes the method to wait until the connection is established. :return: If ``WaitConnected`` is True, returns the stream which can be used...
[ "Connects", "application", "to", "user", "." ]
c48d83f7034109fe46315d45a066126002c6e0d4
https://github.com/Skype4Py/Skype4Py/blob/c48d83f7034109fe46315d45a066126002c6e0d4/Skype4Py/application.py#L36-L63
2,207
Skype4Py/Skype4Py
Skype4Py/application.py
Application.SendDatagram
def SendDatagram(self, Text, Streams=None): """Sends datagram to application streams. :Parameters: Text : unicode Text to send. Streams : sequence of `ApplicationStream` Streams to send the datagram to or None if all currently connected streams should be ...
python
def SendDatagram(self, Text, Streams=None): if Streams is None: Streams = self.Streams for s in Streams: s.SendDatagram(Text)
[ "def", "SendDatagram", "(", "self", ",", "Text", ",", "Streams", "=", "None", ")", ":", "if", "Streams", "is", "None", ":", "Streams", "=", "self", ".", "Streams", "for", "s", "in", "Streams", ":", "s", ".", "SendDatagram", "(", "Text", ")" ]
Sends datagram to application streams. :Parameters: Text : unicode Text to send. Streams : sequence of `ApplicationStream` Streams to send the datagram to or None if all currently connected streams should be used.
[ "Sends", "datagram", "to", "application", "streams", "." ]
c48d83f7034109fe46315d45a066126002c6e0d4
https://github.com/Skype4Py/Skype4Py/blob/c48d83f7034109fe46315d45a066126002c6e0d4/Skype4Py/application.py#L75-L88
2,208
Skype4Py/Skype4Py
Skype4Py/application.py
ApplicationStream.SendDatagram
def SendDatagram(self, Text): """Sends datagram to stream. :Parameters: Text : unicode Datagram to send. """ self.Application._Alter('DATAGRAM', '%s %s' % (self.Handle, tounicode(Text)))
python
def SendDatagram(self, Text): self.Application._Alter('DATAGRAM', '%s %s' % (self.Handle, tounicode(Text)))
[ "def", "SendDatagram", "(", "self", ",", "Text", ")", ":", "self", ".", "Application", ".", "_Alter", "(", "'DATAGRAM'", ",", "'%s %s'", "%", "(", "self", ".", "Handle", ",", "tounicode", "(", "Text", ")", ")", ")" ]
Sends datagram to stream. :Parameters: Text : unicode Datagram to send.
[ "Sends", "datagram", "to", "stream", "." ]
c48d83f7034109fe46315d45a066126002c6e0d4
https://github.com/Skype4Py/Skype4Py/blob/c48d83f7034109fe46315d45a066126002c6e0d4/Skype4Py/application.py#L173-L180
2,209
Skype4Py/Skype4Py
Skype4Py/application.py
ApplicationStream.Write
def Write(self, Text): """Writes data to stream. :Parameters: Text : unicode Data to send. """ self.Application._Alter('WRITE', '%s %s' % (self.Handle, tounicode(Text)))
python
def Write(self, Text): self.Application._Alter('WRITE', '%s %s' % (self.Handle, tounicode(Text)))
[ "def", "Write", "(", "self", ",", "Text", ")", ":", "self", ".", "Application", ".", "_Alter", "(", "'WRITE'", ",", "'%s %s'", "%", "(", "self", ".", "Handle", ",", "tounicode", "(", "Text", ")", ")", ")" ]
Writes data to stream. :Parameters: Text : unicode Data to send.
[ "Writes", "data", "to", "stream", "." ]
c48d83f7034109fe46315d45a066126002c6e0d4
https://github.com/Skype4Py/Skype4Py/blob/c48d83f7034109fe46315d45a066126002c6e0d4/Skype4Py/application.py#L182-L189
2,210
Skype4Py/Skype4Py
Skype4Py/client.py
Client.CreateEvent
def CreateEvent(self, EventId, Caption, Hint): """Creates a custom event displayed in Skype client's events pane. :Parameters: EventId : unicode Unique identifier for the event. Caption : unicode Caption text. Hint : unicode Hint text. S...
python
def CreateEvent(self, EventId, Caption, Hint): self._Skype._DoCommand('CREATE EVENT %s CAPTION %s HINT %s' % (tounicode(EventId), quote(tounicode(Caption)), quote(tounicode(Hint)))) return PluginEvent(self._Skype, EventId)
[ "def", "CreateEvent", "(", "self", ",", "EventId", ",", "Caption", ",", "Hint", ")", ":", "self", ".", "_Skype", ".", "_DoCommand", "(", "'CREATE EVENT %s CAPTION %s HINT %s'", "%", "(", "tounicode", "(", "EventId", ")", ",", "quote", "(", "tounicode", "(", ...
Creates a custom event displayed in Skype client's events pane. :Parameters: EventId : unicode Unique identifier for the event. Caption : unicode Caption text. Hint : unicode Hint text. Shown when mouse hoovers over the event. :return: ...
[ "Creates", "a", "custom", "event", "displayed", "in", "Skype", "client", "s", "events", "pane", "." ]
c48d83f7034109fe46315d45a066126002c6e0d4
https://github.com/Skype4Py/Skype4Py/blob/c48d83f7034109fe46315d45a066126002c6e0d4/Skype4Py/client.py#L44-L60
2,211
Skype4Py/Skype4Py
Skype4Py/client.py
Client.CreateMenuItem
def CreateMenuItem(self, MenuItemId, PluginContext, CaptionText, HintText=u'', IconPath='', Enabled=True, ContactType=pluginContactTypeAll, MultipleContacts=False): """Creates custom menu item in Skype client's "Do More" menus. :Parameters: MenuItemId : unicode ...
python
def CreateMenuItem(self, MenuItemId, PluginContext, CaptionText, HintText=u'', IconPath='', Enabled=True, ContactType=pluginContactTypeAll, MultipleContacts=False): cmd = 'CREATE MENU_ITEM %s CONTEXT %s CAPTION %s ENABLED %s' % (tounicode(MenuItemId), PluginContext, quote(toun...
[ "def", "CreateMenuItem", "(", "self", ",", "MenuItemId", ",", "PluginContext", ",", "CaptionText", ",", "HintText", "=", "u''", ",", "IconPath", "=", "''", ",", "Enabled", "=", "True", ",", "ContactType", "=", "pluginContactTypeAll", ",", "MultipleContacts", "...
Creates custom menu item in Skype client's "Do More" menus. :Parameters: MenuItemId : unicode Unique identifier for the menu item. PluginContext : `enums`.pluginContext* Menu item context. Allows to choose in which client windows will the menu item appear. ...
[ "Creates", "custom", "menu", "item", "in", "Skype", "client", "s", "Do", "More", "menus", "." ]
c48d83f7034109fe46315d45a066126002c6e0d4
https://github.com/Skype4Py/Skype4Py/blob/c48d83f7034109fe46315d45a066126002c6e0d4/Skype4Py/client.py#L62-L99
2,212
Skype4Py/Skype4Py
Skype4Py/client.py
Client.Focus
def Focus(self): """Brings the client window into focus. """ self._Skype._Api.allow_focus(self._Skype.Timeout) self._Skype._DoCommand('FOCUS')
python
def Focus(self): self._Skype._Api.allow_focus(self._Skype.Timeout) self._Skype._DoCommand('FOCUS')
[ "def", "Focus", "(", "self", ")", ":", "self", ".", "_Skype", ".", "_Api", ".", "allow_focus", "(", "self", ".", "_Skype", ".", "Timeout", ")", "self", ".", "_Skype", ".", "_DoCommand", "(", "'FOCUS'", ")" ]
Brings the client window into focus.
[ "Brings", "the", "client", "window", "into", "focus", "." ]
c48d83f7034109fe46315d45a066126002c6e0d4
https://github.com/Skype4Py/Skype4Py/blob/c48d83f7034109fe46315d45a066126002c6e0d4/Skype4Py/client.py#L101-L105
2,213
Skype4Py/Skype4Py
Skype4Py/client.py
Client.OpenDialog
def OpenDialog(self, Name, *Params): """Open dialog. Use this method to open dialogs added in newer Skype versions if there is no dedicated method in Skype4Py. :Parameters: Name : str Dialog name. Params : unicode One or more optional parameters. ...
python
def OpenDialog(self, Name, *Params): self._Skype._Api.allow_focus(self._Skype.Timeout) params = filter(None, (str(Name),) + Params) self._Skype._DoCommand('OPEN %s' % tounicode(' '.join(params)))
[ "def", "OpenDialog", "(", "self", ",", "Name", ",", "*", "Params", ")", ":", "self", ".", "_Skype", ".", "_Api", ".", "allow_focus", "(", "self", ".", "_Skype", ".", "Timeout", ")", "params", "=", "filter", "(", "None", ",", "(", "str", "(", "Name"...
Open dialog. Use this method to open dialogs added in newer Skype versions if there is no dedicated method in Skype4Py. :Parameters: Name : str Dialog name. Params : unicode One or more optional parameters.
[ "Open", "dialog", ".", "Use", "this", "method", "to", "open", "dialogs", "added", "in", "newer", "Skype", "versions", "if", "there", "is", "no", "dedicated", "method", "in", "Skype4Py", "." ]
c48d83f7034109fe46315d45a066126002c6e0d4
https://github.com/Skype4Py/Skype4Py/blob/c48d83f7034109fe46315d45a066126002c6e0d4/Skype4Py/client.py#L150-L162
2,214
Skype4Py/Skype4Py
Skype4Py/client.py
Client.OpenMessageDialog
def OpenMessageDialog(self, Username, Text=u''): """Opens "Send an IM Message" dialog. :Parameters: Username : str Message target. Text : unicode Message text. """ self.OpenDialog('IM', Username, tounicode(Text))
python
def OpenMessageDialog(self, Username, Text=u''): self.OpenDialog('IM', Username, tounicode(Text))
[ "def", "OpenMessageDialog", "(", "self", ",", "Username", ",", "Text", "=", "u''", ")", ":", "self", ".", "OpenDialog", "(", "'IM'", ",", "Username", ",", "tounicode", "(", "Text", ")", ")" ]
Opens "Send an IM Message" dialog. :Parameters: Username : str Message target. Text : unicode Message text.
[ "Opens", "Send", "an", "IM", "Message", "dialog", "." ]
c48d83f7034109fe46315d45a066126002c6e0d4
https://github.com/Skype4Py/Skype4Py/blob/c48d83f7034109fe46315d45a066126002c6e0d4/Skype4Py/client.py#L195-L204
2,215
Skype4Py/Skype4Py
Skype4Py/client.py
Client.Start
def Start(self, Minimized=False, Nosplash=False): """Starts Skype application. :Parameters: Minimized : bool If True, Skype is started minimized in system tray. Nosplash : bool If True, no splash screen is displayed upon startup. """ self._Sky...
python
def Start(self, Minimized=False, Nosplash=False): self._Skype._Api.startup(Minimized, Nosplash)
[ "def", "Start", "(", "self", ",", "Minimized", "=", "False", ",", "Nosplash", "=", "False", ")", ":", "self", ".", "_Skype", ".", "_Api", ".", "startup", "(", "Minimized", ",", "Nosplash", ")" ]
Starts Skype application. :Parameters: Minimized : bool If True, Skype is started minimized in system tray. Nosplash : bool If True, no splash screen is displayed upon startup.
[ "Starts", "Skype", "application", "." ]
c48d83f7034109fe46315d45a066126002c6e0d4
https://github.com/Skype4Py/Skype4Py/blob/c48d83f7034109fe46315d45a066126002c6e0d4/Skype4Py/client.py#L264-L273
2,216
Skype4Py/Skype4Py
Skype4Py/api/darwin.py
SkypeAPI.start
def start(self): """ Start the thread associated with this API object. Ensure that the call is made no more than once, to avoid raising a RuntimeError. """ if not self.thread_started: super(SkypeAPI, self).start() self.thread_started = True
python
def start(self): if not self.thread_started: super(SkypeAPI, self).start() self.thread_started = True
[ "def", "start", "(", "self", ")", ":", "if", "not", "self", ".", "thread_started", ":", "super", "(", "SkypeAPI", ",", "self", ")", ".", "start", "(", ")", "self", ".", "thread_started", "=", "True" ]
Start the thread associated with this API object. Ensure that the call is made no more than once, to avoid raising a RuntimeError.
[ "Start", "the", "thread", "associated", "with", "this", "API", "object", ".", "Ensure", "that", "the", "call", "is", "made", "no", "more", "than", "once", "to", "avoid", "raising", "a", "RuntimeError", "." ]
c48d83f7034109fe46315d45a066126002c6e0d4
https://github.com/Skype4Py/Skype4Py/blob/c48d83f7034109fe46315d45a066126002c6e0d4/Skype4Py/api/darwin.py#L302-L310
2,217
Skype4Py/Skype4Py
Skype4Py/api/posix_x11.py
SkypeAPI.get_skype
def get_skype(self): """Returns Skype window ID or None if Skype not running.""" skype_inst = x11.XInternAtom(self.disp, '_SKYPE_INSTANCE', True) if not skype_inst: return type_ret = Atom() format_ret = c_int() nitems_ret = c_ulong() bytes_after_ret = ...
python
def get_skype(self): skype_inst = x11.XInternAtom(self.disp, '_SKYPE_INSTANCE', True) if not skype_inst: return type_ret = Atom() format_ret = c_int() nitems_ret = c_ulong() bytes_after_ret = c_ulong() winp = pointer(Window()) fail = x11.XGetWi...
[ "def", "get_skype", "(", "self", ")", ":", "skype_inst", "=", "x11", ".", "XInternAtom", "(", "self", ".", "disp", ",", "'_SKYPE_INSTANCE'", ",", "True", ")", "if", "not", "skype_inst", ":", "return", "type_ret", "=", "Atom", "(", ")", "format_ret", "=",...
Returns Skype window ID or None if Skype not running.
[ "Returns", "Skype", "window", "ID", "or", "None", "if", "Skype", "not", "running", "." ]
c48d83f7034109fe46315d45a066126002c6e0d4
https://github.com/Skype4Py/Skype4Py/blob/c48d83f7034109fe46315d45a066126002c6e0d4/Skype4Py/api/posix_x11.py#L323-L337
2,218
Skype4Py/Skype4Py
Skype4Py/call.py
Call.Join
def Join(self, Id): """Joins with another call to form a conference. :Parameters: Id : int Call Id of the other call to join to the conference. :return: Conference object. :rtype: `Conference` """ #self._Alter('JOIN_CONFERENCE', Id) reply =...
python
def Join(self, Id): #self._Alter('JOIN_CONFERENCE', Id) reply = self._Owner._DoCommand('SET CALL %s JOIN_CONFERENCE %s' % (self.Id, Id), 'CALL %s CONF_ID' % self.Id) return Conference(self._Owner, reply.split()[-1])
[ "def", "Join", "(", "self", ",", "Id", ")", ":", "#self._Alter('JOIN_CONFERENCE', Id)", "reply", "=", "self", ".", "_Owner", ".", "_DoCommand", "(", "'SET CALL %s JOIN_CONFERENCE %s'", "%", "(", "self", ".", "Id", ",", "Id", ")", ",", "'CALL %s CONF_ID'", "%",...
Joins with another call to form a conference. :Parameters: Id : int Call Id of the other call to join to the conference. :return: Conference object. :rtype: `Conference`
[ "Joins", "with", "another", "call", "to", "form", "a", "conference", "." ]
c48d83f7034109fe46315d45a066126002c6e0d4
https://github.com/Skype4Py/Skype4Py/blob/c48d83f7034109fe46315d45a066126002c6e0d4/Skype4Py/call.py#L175-L188
2,219
Skype4Py/Skype4Py
Skype4Py/settings.py
Settings.Avatar
def Avatar(self, Id=1, Set=None): """Sets user avatar picture from file. :Parameters: Id : int Optional avatar Id. Set : str New avatar file name. :deprecated: Use `LoadAvatarFromFile` instead. """ from warnings import warn wa...
python
def Avatar(self, Id=1, Set=None): from warnings import warn warn('Settings.Avatar: Use Settings.LoadAvatarFromFile instead.', DeprecationWarning, stacklevel=2) if Set is None: raise TypeError('Argument \'Set\' is mandatory!') self.LoadAvatarFromFile(Set, Id)
[ "def", "Avatar", "(", "self", ",", "Id", "=", "1", ",", "Set", "=", "None", ")", ":", "from", "warnings", "import", "warn", "warn", "(", "'Settings.Avatar: Use Settings.LoadAvatarFromFile instead.'", ",", "DeprecationWarning", ",", "stacklevel", "=", "2", ")", ...
Sets user avatar picture from file. :Parameters: Id : int Optional avatar Id. Set : str New avatar file name. :deprecated: Use `LoadAvatarFromFile` instead.
[ "Sets", "user", "avatar", "picture", "from", "file", "." ]
c48d83f7034109fe46315d45a066126002c6e0d4
https://github.com/Skype4Py/Skype4Py/blob/c48d83f7034109fe46315d45a066126002c6e0d4/Skype4Py/settings.py#L25-L40
2,220
Skype4Py/Skype4Py
Skype4Py/settings.py
Settings.LoadAvatarFromFile
def LoadAvatarFromFile(self, Filename, AvatarId=1): """Loads user avatar picture from file. :Parameters: Filename : str Name of the avatar file. AvatarId : int Optional avatar Id. """ s = 'AVATAR %s %s' % (AvatarId, path2unicode(Filename)) ...
python
def LoadAvatarFromFile(self, Filename, AvatarId=1): s = 'AVATAR %s %s' % (AvatarId, path2unicode(Filename)) self._Skype._DoCommand('SET %s' % s, s)
[ "def", "LoadAvatarFromFile", "(", "self", ",", "Filename", ",", "AvatarId", "=", "1", ")", ":", "s", "=", "'AVATAR %s %s'", "%", "(", "AvatarId", ",", "path2unicode", "(", "Filename", ")", ")", "self", ".", "_Skype", ".", "_DoCommand", "(", "'SET %s'", "...
Loads user avatar picture from file. :Parameters: Filename : str Name of the avatar file. AvatarId : int Optional avatar Id.
[ "Loads", "user", "avatar", "picture", "from", "file", "." ]
c48d83f7034109fe46315d45a066126002c6e0d4
https://github.com/Skype4Py/Skype4Py/blob/c48d83f7034109fe46315d45a066126002c6e0d4/Skype4Py/settings.py#L42-L52
2,221
Skype4Py/Skype4Py
Skype4Py/settings.py
Settings.SaveAvatarToFile
def SaveAvatarToFile(self, Filename, AvatarId=1): """Saves user avatar picture to file. :Parameters: Filename : str Destination path. AvatarId : int Avatar Id """ s = 'AVATAR %s %s' % (AvatarId, path2unicode(Filename)) self._Skype._DoC...
python
def SaveAvatarToFile(self, Filename, AvatarId=1): s = 'AVATAR %s %s' % (AvatarId, path2unicode(Filename)) self._Skype._DoCommand('GET %s' % s, s)
[ "def", "SaveAvatarToFile", "(", "self", ",", "Filename", ",", "AvatarId", "=", "1", ")", ":", "s", "=", "'AVATAR %s %s'", "%", "(", "AvatarId", ",", "path2unicode", "(", "Filename", ")", ")", "self", ".", "_Skype", ".", "_DoCommand", "(", "'GET %s'", "%"...
Saves user avatar picture to file. :Parameters: Filename : str Destination path. AvatarId : int Avatar Id
[ "Saves", "user", "avatar", "picture", "to", "file", "." ]
c48d83f7034109fe46315d45a066126002c6e0d4
https://github.com/Skype4Py/Skype4Py/blob/c48d83f7034109fe46315d45a066126002c6e0d4/Skype4Py/settings.py#L92-L102
2,222
Skype4Py/Skype4Py
Skype4Py/user.py
User.SaveAvatarToFile
def SaveAvatarToFile(self, Filename, AvatarId=1): """Saves user avatar to a file. :Parameters: Filename : str Destination path. AvatarId : int Avatar Id. """ s = 'USER %s AVATAR %s %s' % (self.Handle, AvatarId, path2unicode(Filename)) ...
python
def SaveAvatarToFile(self, Filename, AvatarId=1): s = 'USER %s AVATAR %s %s' % (self.Handle, AvatarId, path2unicode(Filename)) self._Owner._DoCommand('GET %s' % s, s)
[ "def", "SaveAvatarToFile", "(", "self", ",", "Filename", ",", "AvatarId", "=", "1", ")", ":", "s", "=", "'USER %s AVATAR %s %s'", "%", "(", "self", ".", "Handle", ",", "AvatarId", ",", "path2unicode", "(", "Filename", ")", ")", "self", ".", "_Owner", "."...
Saves user avatar to a file. :Parameters: Filename : str Destination path. AvatarId : int Avatar Id.
[ "Saves", "user", "avatar", "to", "a", "file", "." ]
c48d83f7034109fe46315d45a066126002c6e0d4
https://github.com/Skype4Py/Skype4Py/blob/c48d83f7034109fe46315d45a066126002c6e0d4/Skype4Py/user.py#L21-L31
2,223
Skype4Py/Skype4Py
Skype4Py/user.py
User.SetBuddyStatusPendingAuthorization
def SetBuddyStatusPendingAuthorization(self, Text=u''): """Sets the BuddyStaus property to `enums.budPendingAuthorization` additionally specifying the authorization text. :Parameters: Text : unicode The authorization text. :see: `BuddyStatus` """ s...
python
def SetBuddyStatusPendingAuthorization(self, Text=u''): self._Property('BUDDYSTATUS', '%d %s' % (budPendingAuthorization, tounicode(Text)), Cache=False)
[ "def", "SetBuddyStatusPendingAuthorization", "(", "self", ",", "Text", "=", "u''", ")", ":", "self", ".", "_Property", "(", "'BUDDYSTATUS'", ",", "'%d %s'", "%", "(", "budPendingAuthorization", ",", "tounicode", "(", "Text", ")", ")", ",", "Cache", "=", "Fal...
Sets the BuddyStaus property to `enums.budPendingAuthorization` additionally specifying the authorization text. :Parameters: Text : unicode The authorization text. :see: `BuddyStatus`
[ "Sets", "the", "BuddyStaus", "property", "to", "enums", ".", "budPendingAuthorization", "additionally", "specifying", "the", "authorization", "text", "." ]
c48d83f7034109fe46315d45a066126002c6e0d4
https://github.com/Skype4Py/Skype4Py/blob/c48d83f7034109fe46315d45a066126002c6e0d4/Skype4Py/user.py#L33-L43
2,224
Skype4Py/Skype4Py
examples/SkypeTunnel.py
StreamWrite
def StreamWrite(stream, *obj): """Writes Python object to Skype application stream.""" stream.Write(base64.encodestring(pickle.dumps(obj)))
python
def StreamWrite(stream, *obj): stream.Write(base64.encodestring(pickle.dumps(obj)))
[ "def", "StreamWrite", "(", "stream", ",", "*", "obj", ")", ":", "stream", ".", "Write", "(", "base64", ".", "encodestring", "(", "pickle", ".", "dumps", "(", "obj", ")", ")", ")" ]
Writes Python object to Skype application stream.
[ "Writes", "Python", "object", "to", "Skype", "application", "stream", "." ]
c48d83f7034109fe46315d45a066126002c6e0d4
https://github.com/Skype4Py/Skype4Py/blob/c48d83f7034109fe46315d45a066126002c6e0d4/examples/SkypeTunnel.py#L121-L123
2,225
Skype4Py/Skype4Py
examples/SkypeTunnel.py
TCPTunnel.close
def close(self): """Closes the tunnel.""" try: self.sock.shutdown(socket.SHUT_RDWR) self.sock.close() except socket.error: pass
python
def close(self): try: self.sock.shutdown(socket.SHUT_RDWR) self.sock.close() except socket.error: pass
[ "def", "close", "(", "self", ")", ":", "try", ":", "self", ".", "sock", ".", "shutdown", "(", "socket", ".", "SHUT_RDWR", ")", "self", ".", "sock", ".", "close", "(", ")", "except", "socket", ".", "error", ":", "pass" ]
Closes the tunnel.
[ "Closes", "the", "tunnel", "." ]
c48d83f7034109fe46315d45a066126002c6e0d4
https://github.com/Skype4Py/Skype4Py/blob/c48d83f7034109fe46315d45a066126002c6e0d4/examples/SkypeTunnel.py#L206-L213
2,226
Skype4Py/Skype4Py
examples/SkypeTunnel.py
SkypeEvents.ApplicationReceiving
def ApplicationReceiving(self, app, streams): """Called when the list of streams with data ready to be read changes.""" # we should only proceed if we are in TCP mode if stype != socket.SOCK_STREAM: return # handle all streams for stream in streams: # re...
python
def ApplicationReceiving(self, app, streams): # we should only proceed if we are in TCP mode if stype != socket.SOCK_STREAM: return # handle all streams for stream in streams: # read object from the stream obj = StreamRead(stream) if obj: ...
[ "def", "ApplicationReceiving", "(", "self", ",", "app", ",", "streams", ")", ":", "# we should only proceed if we are in TCP mode", "if", "stype", "!=", "socket", ".", "SOCK_STREAM", ":", "return", "# handle all streams", "for", "stream", "in", "streams", ":", "# re...
Called when the list of streams with data ready to be read changes.
[ "Called", "when", "the", "list", "of", "streams", "with", "data", "ready", "to", "be", "read", "changes", "." ]
c48d83f7034109fe46315d45a066126002c6e0d4
https://github.com/Skype4Py/Skype4Py/blob/c48d83f7034109fe46315d45a066126002c6e0d4/examples/SkypeTunnel.py#L218-L257
2,227
Skype4Py/Skype4Py
examples/SkypeTunnel.py
SkypeEvents.ApplicationDatagram
def ApplicationDatagram(self, app, stream, text): """Called when a datagram is received over a stream.""" # we should only proceed if we are in UDP mode if stype != socket.SOCK_DGRAM: return # decode the data data = base64.decodestring(text) # open an UDP s...
python
def ApplicationDatagram(self, app, stream, text): # we should only proceed if we are in UDP mode if stype != socket.SOCK_DGRAM: return # decode the data data = base64.decodestring(text) # open an UDP socket sock = socket.socket(type=stype) # send th...
[ "def", "ApplicationDatagram", "(", "self", ",", "app", ",", "stream", ",", "text", ")", ":", "# we should only proceed if we are in UDP mode", "if", "stype", "!=", "socket", ".", "SOCK_DGRAM", ":", "return", "# decode the data", "data", "=", "base64", ".", "decode...
Called when a datagram is received over a stream.
[ "Called", "when", "a", "datagram", "is", "received", "over", "a", "stream", "." ]
c48d83f7034109fe46315d45a066126002c6e0d4
https://github.com/Skype4Py/Skype4Py/blob/c48d83f7034109fe46315d45a066126002c6e0d4/examples/SkypeTunnel.py#L259-L276
2,228
Skype4Py/Skype4Py
Skype4Py/utils.py
chop
def chop(s, n=1, d=None): """Chops initial words from a string and returns a list of them and the rest of the string. The returned list is guaranteed to be n+1 long. If too little words are found in the string, a ValueError exception is raised. :Parameters: s : str or unicode String to ch...
python
def chop(s, n=1, d=None): spl = s.split(d, n) if len(spl) == n: spl.append(s[:0]) if len(spl) != n + 1: raise ValueError('chop: Could not chop %d words from \'%s\'' % (n, s)) return spl
[ "def", "chop", "(", "s", ",", "n", "=", "1", ",", "d", "=", "None", ")", ":", "spl", "=", "s", ".", "split", "(", "d", ",", "n", ")", "if", "len", "(", "spl", ")", "==", "n", ":", "spl", ".", "append", "(", "s", "[", ":", "0", "]", ")...
Chops initial words from a string and returns a list of them and the rest of the string. The returned list is guaranteed to be n+1 long. If too little words are found in the string, a ValueError exception is raised. :Parameters: s : str or unicode String to chop from. n : int Nu...
[ "Chops", "initial", "words", "from", "a", "string", "and", "returns", "a", "list", "of", "them", "and", "the", "rest", "of", "the", "string", ".", "The", "returned", "list", "is", "guaranteed", "to", "be", "n", "+", "1", "long", ".", "If", "too", "li...
c48d83f7034109fe46315d45a066126002c6e0d4
https://github.com/Skype4Py/Skype4Py/blob/c48d83f7034109fe46315d45a066126002c6e0d4/Skype4Py/utils.py#L59-L82
2,229
Skype4Py/Skype4Py
Skype4Py/utils.py
args2dict
def args2dict(s): """Converts a string or comma-separated 'ARG="a value"' or 'ARG=value2' strings into a dictionary. :Parameters: s : str or unicode Input string. :return: ``{'ARG': 'value'}`` dictionary. :rtype: dict """ d = {} while s: t, s = chop(s, 1, '=') ...
python
def args2dict(s): d = {} while s: t, s = chop(s, 1, '=') if s.startswith('"'): # XXX: This function is used to parse strings from Skype. The question is, # how does Skype escape the double-quotes. The code below implements the # VisualBasic technique ("" -> ")...
[ "def", "args2dict", "(", "s", ")", ":", "d", "=", "{", "}", "while", "s", ":", "t", ",", "s", "=", "chop", "(", "s", ",", "1", ",", "'='", ")", "if", "s", ".", "startswith", "(", "'\"'", ")", ":", "# XXX: This function is used to parse strings from S...
Converts a string or comma-separated 'ARG="a value"' or 'ARG=value2' strings into a dictionary. :Parameters: s : str or unicode Input string. :return: ``{'ARG': 'value'}`` dictionary. :rtype: dict
[ "Converts", "a", "string", "or", "comma", "-", "separated", "ARG", "=", "a", "value", "or", "ARG", "=", "value2", "strings", "into", "a", "dictionary", "." ]
c48d83f7034109fe46315d45a066126002c6e0d4
https://github.com/Skype4Py/Skype4Py/blob/c48d83f7034109fe46315d45a066126002c6e0d4/Skype4Py/utils.py#L85-L130
2,230
Skype4Py/Skype4Py
Skype4Py/utils.py
EventHandlingBase.RegisterEventHandler
def RegisterEventHandler(self, Event, Target): """Registers any callable as an event handler. :Parameters: Event : str Name of the event. For event names, see the respective ``...Events`` class. Target : callable Callable to register as the event handler. ...
python
def RegisterEventHandler(self, Event, Target): if not callable(Target): raise TypeError('%s is not callable' % repr(Target)) if Event not in self._EventHandlers: raise ValueError('%s is not a valid %s event name' % (Event, self.__class__.__name__)) if Target in self._Even...
[ "def", "RegisterEventHandler", "(", "self", ",", "Event", ",", "Target", ")", ":", "if", "not", "callable", "(", "Target", ")", ":", "raise", "TypeError", "(", "'%s is not callable'", "%", "repr", "(", "Target", ")", ")", "if", "Event", "not", "in", "sel...
Registers any callable as an event handler. :Parameters: Event : str Name of the event. For event names, see the respective ``...Events`` class. Target : callable Callable to register as the event handler. :return: True is callable was successfully registere...
[ "Registers", "any", "callable", "as", "an", "event", "handler", "." ]
c48d83f7034109fe46315d45a066126002c6e0d4
https://github.com/Skype4Py/Skype4Py/blob/c48d83f7034109fe46315d45a066126002c6e0d4/Skype4Py/utils.py#L413-L435
2,231
Skype4Py/Skype4Py
Skype4Py/utils.py
EventHandlingBase.UnregisterEventHandler
def UnregisterEventHandler(self, Event, Target): """Unregisters an event handler previously registered with `RegisterEventHandler`. :Parameters: Event : str Name of the event. For event names, see the respective ``...Events`` class. Target : callable Callable...
python
def UnregisterEventHandler(self, Event, Target): if not callable(Target): raise TypeError('%s is not callable' % repr(Target)) if Event not in self._EventHandlers: raise ValueError('%s is not a valid %s event name' % (Event, self.__class__.__name__)) if Target in self._Ev...
[ "def", "UnregisterEventHandler", "(", "self", ",", "Event", ",", "Target", ")", ":", "if", "not", "callable", "(", "Target", ")", ":", "raise", "TypeError", "(", "'%s is not callable'", "%", "repr", "(", "Target", ")", ")", "if", "Event", "not", "in", "s...
Unregisters an event handler previously registered with `RegisterEventHandler`. :Parameters: Event : str Name of the event. For event names, see the respective ``...Events`` class. Target : callable Callable to unregister. :return: True if callable was succe...
[ "Unregisters", "an", "event", "handler", "previously", "registered", "with", "RegisterEventHandler", "." ]
c48d83f7034109fe46315d45a066126002c6e0d4
https://github.com/Skype4Py/Skype4Py/blob/c48d83f7034109fe46315d45a066126002c6e0d4/Skype4Py/utils.py#L437-L460
2,232
Skype4Py/Skype4Py
Skype4Py/chat.py
Chat.AddMembers
def AddMembers(self, *Members): """Adds new members to the chat. :Parameters: Members : `User` One or more users to add. """ self._Alter('ADDMEMBERS', ', '.join([x.Handle for x in Members]))
python
def AddMembers(self, *Members): self._Alter('ADDMEMBERS', ', '.join([x.Handle for x in Members]))
[ "def", "AddMembers", "(", "self", ",", "*", "Members", ")", ":", "self", ".", "_Alter", "(", "'ADDMEMBERS'", ",", "', '", ".", "join", "(", "[", "x", ".", "Handle", "for", "x", "in", "Members", "]", ")", ")" ]
Adds new members to the chat. :Parameters: Members : `User` One or more users to add.
[ "Adds", "new", "members", "to", "the", "chat", "." ]
c48d83f7034109fe46315d45a066126002c6e0d4
https://github.com/Skype4Py/Skype4Py/blob/c48d83f7034109fe46315d45a066126002c6e0d4/Skype4Py/chat.py#L40-L47
2,233
Skype4Py/Skype4Py
Skype4Py/chat.py
Chat.SendMessage
def SendMessage(self, MessageText): """Sends a chat message. :Parameters: MessageText : unicode Message text :return: Message object :rtype: `ChatMessage` """ return ChatMessage(self._Owner, chop(self._Owner._DoCommand('CHATMESSAGE %s %s' % (self.N...
python
def SendMessage(self, MessageText): return ChatMessage(self._Owner, chop(self._Owner._DoCommand('CHATMESSAGE %s %s' % (self.Name, tounicode(MessageText))), 2)[1])
[ "def", "SendMessage", "(", "self", ",", "MessageText", ")", ":", "return", "ChatMessage", "(", "self", ".", "_Owner", ",", "chop", "(", "self", ".", "_Owner", ".", "_DoCommand", "(", "'CHATMESSAGE %s %s'", "%", "(", "self", ".", "Name", ",", "tounicode", ...
Sends a chat message. :Parameters: MessageText : unicode Message text :return: Message object :rtype: `ChatMessage`
[ "Sends", "a", "chat", "message", "." ]
c48d83f7034109fe46315d45a066126002c6e0d4
https://github.com/Skype4Py/Skype4Py/blob/c48d83f7034109fe46315d45a066126002c6e0d4/Skype4Py/chat.py#L106-L117
2,234
Skype4Py/Skype4Py
Skype4Py/chat.py
Chat.SetPassword
def SetPassword(self, Password, Hint=''): """Sets the chat password. :Parameters: Password : unicode Password Hint : unicode Password hint """ if ' ' in Password: raise ValueError('Password mut be one word') self._Alter('SE...
python
def SetPassword(self, Password, Hint=''): if ' ' in Password: raise ValueError('Password mut be one word') self._Alter('SETPASSWORD', '%s %s' % (tounicode(Password), tounicode(Hint)))
[ "def", "SetPassword", "(", "self", ",", "Password", ",", "Hint", "=", "''", ")", ":", "if", "' '", "in", "Password", ":", "raise", "ValueError", "(", "'Password mut be one word'", ")", "self", ".", "_Alter", "(", "'SETPASSWORD'", ",", "'%s %s'", "%", "(", ...
Sets the chat password. :Parameters: Password : unicode Password Hint : unicode Password hint
[ "Sets", "the", "chat", "password", "." ]
c48d83f7034109fe46315d45a066126002c6e0d4
https://github.com/Skype4Py/Skype4Py/blob/c48d83f7034109fe46315d45a066126002c6e0d4/Skype4Py/chat.py#L119-L130
2,235
Skype4Py/Skype4Py
Skype4Py/chat.py
ChatMember.CanSetRoleTo
def CanSetRoleTo(self, Role): """Checks if the new role can be applied to the member. :Parameters: Role : `enums`.chatMemberRole* New chat member role. :return: True if the new role can be applied, False otherwise. :rtype: bool """ t = self._Owner....
python
def CanSetRoleTo(self, Role): t = self._Owner._Alter('CHATMEMBER', self.Id, 'CANSETROLETO', Role, 'ALTER CHATMEMBER CANSETROLETO') return (chop(t, 1)[-1] == 'TRUE')
[ "def", "CanSetRoleTo", "(", "self", ",", "Role", ")", ":", "t", "=", "self", ".", "_Owner", ".", "_Alter", "(", "'CHATMEMBER'", ",", "self", ".", "Id", ",", "'CANSETROLETO'", ",", "Role", ",", "'ALTER CHATMEMBER CANSETROLETO'", ")", "return", "(", "chop", ...
Checks if the new role can be applied to the member. :Parameters: Role : `enums`.chatMemberRole* New chat member role. :return: True if the new role can be applied, False otherwise. :rtype: bool
[ "Checks", "if", "the", "new", "role", "can", "be", "applied", "to", "the", "member", "." ]
c48d83f7034109fe46315d45a066126002c6e0d4
https://github.com/Skype4Py/Skype4Py/blob/c48d83f7034109fe46315d45a066126002c6e0d4/Skype4Py/chat.py#L630-L642
2,236
Skype4Py/Skype4Py
Skype4Py/callchannel.py
CallChannelManager.Connect
def Connect(self, Skype): """Connects this call channel manager instance to Skype. This is the first thing you should do after creating this object. :Parameters: Skype : `Skype` The Skype object. :see: `Disconnect` """ self._Skype = Skype s...
python
def Connect(self, Skype): self._Skype = Skype self._Skype.RegisterEventHandler('CallStatus', self._CallStatus) del self._Channels[:]
[ "def", "Connect", "(", "self", ",", "Skype", ")", ":", "self", ".", "_Skype", "=", "Skype", "self", ".", "_Skype", ".", "RegisterEventHandler", "(", "'CallStatus'", ",", "self", ".", "_CallStatus", ")", "del", "self", ".", "_Channels", "[", ":", "]" ]
Connects this call channel manager instance to Skype. This is the first thing you should do after creating this object. :Parameters: Skype : `Skype` The Skype object. :see: `Disconnect`
[ "Connects", "this", "call", "channel", "manager", "instance", "to", "Skype", ".", "This", "is", "the", "first", "thing", "you", "should", "do", "after", "creating", "this", "object", "." ]
c48d83f7034109fe46315d45a066126002c6e0d4
https://github.com/Skype4Py/Skype4Py/blob/c48d83f7034109fe46315d45a066126002c6e0d4/Skype4Py/callchannel.py#L116-L128
2,237
Skype4Py/Skype4Py
Skype4Py/callchannel.py
CallChannel.SendTextMessage
def SendTextMessage(self, Text): """Sends a text message over channel. :Parameters: Text : unicode Text to send. """ if self.Type == cctReliable: self.Stream.Write(Text) elif self.Type == cctDatagram: self.Stream.SendDatagram(Text) ...
python
def SendTextMessage(self, Text): if self.Type == cctReliable: self.Stream.Write(Text) elif self.Type == cctDatagram: self.Stream.SendDatagram(Text) else: raise SkypeError(0, 'Cannot send using %s channel type' & repr(self.Type))
[ "def", "SendTextMessage", "(", "self", ",", "Text", ")", ":", "if", "self", ".", "Type", "==", "cctReliable", ":", "self", ".", "Stream", ".", "Write", "(", "Text", ")", "elif", "self", ".", "Type", "==", "cctDatagram", ":", "self", ".", "Stream", "....
Sends a text message over channel. :Parameters: Text : unicode Text to send.
[ "Sends", "a", "text", "message", "over", "channel", "." ]
c48d83f7034109fe46315d45a066126002c6e0d4
https://github.com/Skype4Py/Skype4Py/blob/c48d83f7034109fe46315d45a066126002c6e0d4/Skype4Py/callchannel.py#L245-L257
2,238
Skype4Py/Skype4Py
Skype4Py/conversion.py
Conversion.TextToAttachmentStatus
def TextToAttachmentStatus(self, Text): """Returns attachment status code. :Parameters: Text : unicode Text, one of 'UNKNOWN', 'SUCCESS', 'PENDING_AUTHORIZATION', 'REFUSED', 'NOT_AVAILABLE', 'AVAILABLE'. :return: Attachment status. :rtype: `enums`.apiA...
python
def TextToAttachmentStatus(self, Text): conv = {'UNKNOWN': enums.apiAttachUnknown, 'SUCCESS': enums.apiAttachSuccess, 'PENDING_AUTHORIZATION': enums.apiAttachPendingAuthorization, 'REFUSED': enums.apiAttachRefused, 'NOT_AVAILABLE': enums.apiAttachN...
[ "def", "TextToAttachmentStatus", "(", "self", ",", "Text", ")", ":", "conv", "=", "{", "'UNKNOWN'", ":", "enums", ".", "apiAttachUnknown", ",", "'SUCCESS'", ":", "enums", ".", "apiAttachSuccess", ",", "'PENDING_AUTHORIZATION'", ":", "enums", ".", "apiAttachPendi...
Returns attachment status code. :Parameters: Text : unicode Text, one of 'UNKNOWN', 'SUCCESS', 'PENDING_AUTHORIZATION', 'REFUSED', 'NOT_AVAILABLE', 'AVAILABLE'. :return: Attachment status. :rtype: `enums`.apiAttach*
[ "Returns", "attachment", "status", "code", "." ]
c48d83f7034109fe46315d45a066126002c6e0d4
https://github.com/Skype4Py/Skype4Py/blob/c48d83f7034109fe46315d45a066126002c6e0d4/Skype4Py/conversion.py#L256-L276
2,239
Skype4Py/Skype4Py
Skype4Py/conversion.py
Conversion.TextToBuddyStatus
def TextToBuddyStatus(self, Text): """Returns buddy status code. :Parameters: Text : unicode Text, one of 'UNKNOWN', 'NEVER_BEEN_FRIEND', 'DELETED_FRIEND', 'PENDING_AUTHORIZATION', 'FRIEND'. :return: Buddy status. :rtype: `enums`.bud* """ ...
python
def TextToBuddyStatus(self, Text): conv = {'UNKNOWN': enums.budUnknown, 'NEVER_BEEN_FRIEND': enums.budNeverBeenFriend, 'DELETED_FRIEND': enums.budDeletedFriend, 'PENDING_AUTHORIZATION': enums.budPendingAuthorization, 'FRIEND': enums.budFriend} ...
[ "def", "TextToBuddyStatus", "(", "self", ",", "Text", ")", ":", "conv", "=", "{", "'UNKNOWN'", ":", "enums", ".", "budUnknown", ",", "'NEVER_BEEN_FRIEND'", ":", "enums", ".", "budNeverBeenFriend", ",", "'DELETED_FRIEND'", ":", "enums", ".", "budDeletedFriend", ...
Returns buddy status code. :Parameters: Text : unicode Text, one of 'UNKNOWN', 'NEVER_BEEN_FRIEND', 'DELETED_FRIEND', 'PENDING_AUTHORIZATION', 'FRIEND'. :return: Buddy status. :rtype: `enums`.bud*
[ "Returns", "buddy", "status", "code", "." ]
c48d83f7034109fe46315d45a066126002c6e0d4
https://github.com/Skype4Py/Skype4Py/blob/c48d83f7034109fe46315d45a066126002c6e0d4/Skype4Py/conversion.py#L278-L297
2,240
gregmuellegger/django-superform
django_superform/forms.py
SuperFormMixin.add_composite_field
def add_composite_field(self, name, field): """ Add a dynamic composite field to the already existing ones and initialize it appropriatly. """ self.composite_fields[name] = field self._init_composite_field(name, field)
python
def add_composite_field(self, name, field): self.composite_fields[name] = field self._init_composite_field(name, field)
[ "def", "add_composite_field", "(", "self", ",", "name", ",", "field", ")", ":", "self", ".", "composite_fields", "[", "name", "]", "=", "field", "self", ".", "_init_composite_field", "(", "name", ",", "field", ")" ]
Add a dynamic composite field to the already existing ones and initialize it appropriatly.
[ "Add", "a", "dynamic", "composite", "field", "to", "the", "already", "existing", "ones", "and", "initialize", "it", "appropriatly", "." ]
5f389911ad38932b6dad184cc7fa81f27db752f9
https://github.com/gregmuellegger/django-superform/blob/5f389911ad38932b6dad184cc7fa81f27db752f9/django_superform/forms.py#L189-L195
2,241
gregmuellegger/django-superform
django_superform/forms.py
SuperFormMixin._init_composite_fields
def _init_composite_fields(self): """ Setup the forms and formsets. """ # The base_composite_fields class attribute is the *class-wide* # definition of fields. Because a particular *instance* of the class # might want to alter self.composite_fields, we create # se...
python
def _init_composite_fields(self): # The base_composite_fields class attribute is the *class-wide* # definition of fields. Because a particular *instance* of the class # might want to alter self.composite_fields, we create # self.composite_fields here by copying base_composite_fields. ...
[ "def", "_init_composite_fields", "(", "self", ")", ":", "# The base_composite_fields class attribute is the *class-wide*", "# definition of fields. Because a particular *instance* of the class", "# might want to alter self.composite_fields, we create", "# self.composite_fields here by copying base...
Setup the forms and formsets.
[ "Setup", "the", "forms", "and", "formsets", "." ]
5f389911ad38932b6dad184cc7fa81f27db752f9
https://github.com/gregmuellegger/django-superform/blob/5f389911ad38932b6dad184cc7fa81f27db752f9/django_superform/forms.py#L215-L229
2,242
gregmuellegger/django-superform
django_superform/forms.py
SuperFormMixin.full_clean
def full_clean(self): """ Clean the form, including all formsets and add formset errors to the errors dict. Errors of nested forms and formsets are only included if they actually contain errors. """ super(SuperFormMixin, self).full_clean() for field_name, composit...
python
def full_clean(self): super(SuperFormMixin, self).full_clean() for field_name, composite in self.forms.items(): composite.full_clean() if not composite.is_valid() and composite._errors: self._errors[field_name] = ErrorDict(composite._errors) for field_name...
[ "def", "full_clean", "(", "self", ")", ":", "super", "(", "SuperFormMixin", ",", "self", ")", ".", "full_clean", "(", ")", "for", "field_name", ",", "composite", "in", "self", ".", "forms", ".", "items", "(", ")", ":", "composite", ".", "full_clean", "...
Clean the form, including all formsets and add formset errors to the errors dict. Errors of nested forms and formsets are only included if they actually contain errors.
[ "Clean", "the", "form", "including", "all", "formsets", "and", "add", "formset", "errors", "to", "the", "errors", "dict", ".", "Errors", "of", "nested", "forms", "and", "formsets", "are", "only", "included", "if", "they", "actually", "contain", "errors", "."...
5f389911ad38932b6dad184cc7fa81f27db752f9
https://github.com/gregmuellegger/django-superform/blob/5f389911ad38932b6dad184cc7fa81f27db752f9/django_superform/forms.py#L231-L245
2,243
gregmuellegger/django-superform
django_superform/forms.py
SuperFormMixin.media
def media(self): """ Incooperate composite field's media. """ media_list = [] media_list.append(super(SuperFormMixin, self).media) for composite_name in self.composite_fields.keys(): form = self.get_composite_field_value(composite_name) media_list....
python
def media(self): media_list = [] media_list.append(super(SuperFormMixin, self).media) for composite_name in self.composite_fields.keys(): form = self.get_composite_field_value(composite_name) media_list.append(form.media) return reduce(lambda a, b: a + b, media_li...
[ "def", "media", "(", "self", ")", ":", "media_list", "=", "[", "]", "media_list", ".", "append", "(", "super", "(", "SuperFormMixin", ",", "self", ")", ".", "media", ")", "for", "composite_name", "in", "self", ".", "composite_fields", ".", "keys", "(", ...
Incooperate composite field's media.
[ "Incooperate", "composite", "field", "s", "media", "." ]
5f389911ad38932b6dad184cc7fa81f27db752f9
https://github.com/gregmuellegger/django-superform/blob/5f389911ad38932b6dad184cc7fa81f27db752f9/django_superform/forms.py#L248-L257
2,244
gregmuellegger/django-superform
django_superform/forms.py
SuperModelFormMixin.save
def save(self, commit=True): """ When saving a super model form, the nested forms and formsets will be saved as well. The implementation of ``.save()`` looks like this: .. code:: python saved_obj = self.save_form() self.save_forms() self.sav...
python
def save(self, commit=True): saved_obj = self.save_form(commit=commit) self.save_forms(commit=commit) self.save_formsets(commit=commit) return saved_obj
[ "def", "save", "(", "self", ",", "commit", "=", "True", ")", ":", "saved_obj", "=", "self", ".", "save_form", "(", "commit", "=", "commit", ")", "self", ".", "save_forms", "(", "commit", "=", "commit", ")", "self", ".", "save_formsets", "(", "commit", ...
When saving a super model form, the nested forms and formsets will be saved as well. The implementation of ``.save()`` looks like this: .. code:: python saved_obj = self.save_form() self.save_forms() self.save_formsets() return saved_obj ...
[ "When", "saving", "a", "super", "model", "form", "the", "nested", "forms", "and", "formsets", "will", "be", "saved", "as", "well", "." ]
5f389911ad38932b6dad184cc7fa81f27db752f9
https://github.com/gregmuellegger/django-superform/blob/5f389911ad38932b6dad184cc7fa81f27db752f9/django_superform/forms.py#L277-L307
2,245
gregmuellegger/django-superform
django_superform/fields.py
CompositeField.get_prefix
def get_prefix(self, form, name): """ Return the prefix that is used for the formset. """ return '{form_prefix}{prefix_name}-{field_name}'.format( form_prefix=form.prefix + '-' if form.prefix else '', prefix_name=self.prefix_name, field_name=name)
python
def get_prefix(self, form, name): return '{form_prefix}{prefix_name}-{field_name}'.format( form_prefix=form.prefix + '-' if form.prefix else '', prefix_name=self.prefix_name, field_name=name)
[ "def", "get_prefix", "(", "self", ",", "form", ",", "name", ")", ":", "return", "'{form_prefix}{prefix_name}-{field_name}'", ".", "format", "(", "form_prefix", "=", "form", ".", "prefix", "+", "'-'", "if", "form", ".", "prefix", "else", "''", ",", "prefix_na...
Return the prefix that is used for the formset.
[ "Return", "the", "prefix", "that", "is", "used", "for", "the", "formset", "." ]
5f389911ad38932b6dad184cc7fa81f27db752f9
https://github.com/gregmuellegger/django-superform/blob/5f389911ad38932b6dad184cc7fa81f27db752f9/django_superform/fields.py#L67-L74
2,246
gregmuellegger/django-superform
django_superform/fields.py
CompositeField.get_initial
def get_initial(self, form, name): """ Get the initial data that got passed into the superform for this composite field. It should return ``None`` if no initial values where given. """ if hasattr(form, 'initial'): return form.initial.get(name, None) r...
python
def get_initial(self, form, name): if hasattr(form, 'initial'): return form.initial.get(name, None) return None
[ "def", "get_initial", "(", "self", ",", "form", ",", "name", ")", ":", "if", "hasattr", "(", "form", ",", "'initial'", ")", ":", "return", "form", ".", "initial", ".", "get", "(", "name", ",", "None", ")", "return", "None" ]
Get the initial data that got passed into the superform for this composite field. It should return ``None`` if no initial values where given.
[ "Get", "the", "initial", "data", "that", "got", "passed", "into", "the", "superform", "for", "this", "composite", "field", ".", "It", "should", "return", "None", "if", "no", "initial", "values", "where", "given", "." ]
5f389911ad38932b6dad184cc7fa81f27db752f9
https://github.com/gregmuellegger/django-superform/blob/5f389911ad38932b6dad184cc7fa81f27db752f9/django_superform/fields.py#L76-L85
2,247
gregmuellegger/django-superform
django_superform/fields.py
FormField.get_form
def get_form(self, form, name): """ Get an instance of the form. """ kwargs = self.get_kwargs(form, name) form_class = self.get_form_class(form, name) composite_form = form_class( data=form.data if form.is_bound else None, files=form.files if form....
python
def get_form(self, form, name): kwargs = self.get_kwargs(form, name) form_class = self.get_form_class(form, name) composite_form = form_class( data=form.data if form.is_bound else None, files=form.files if form.is_bound else None, **kwargs) return comp...
[ "def", "get_form", "(", "self", ",", "form", ",", "name", ")", ":", "kwargs", "=", "self", ".", "get_kwargs", "(", "form", ",", "name", ")", "form_class", "=", "self", ".", "get_form_class", "(", "form", ",", "name", ")", "composite_form", "=", "form_c...
Get an instance of the form.
[ "Get", "an", "instance", "of", "the", "form", "." ]
5f389911ad38932b6dad184cc7fa81f27db752f9
https://github.com/gregmuellegger/django-superform/blob/5f389911ad38932b6dad184cc7fa81f27db752f9/django_superform/fields.py#L170-L180
2,248
gregmuellegger/django-superform
django_superform/fields.py
ForeignKeyFormField.allow_blank
def allow_blank(self, form, name): """ Allow blank determines if the form might be completely empty. If it's empty it will result in a None as the saved value for the ForeignKey. """ if self.blank is not None: return self.blank model = form._meta.model ...
python
def allow_blank(self, form, name): if self.blank is not None: return self.blank model = form._meta.model field = model._meta.get_field(self.get_field_name(form, name)) return field.blank
[ "def", "allow_blank", "(", "self", ",", "form", ",", "name", ")", ":", "if", "self", ".", "blank", "is", "not", "None", ":", "return", "self", ".", "blank", "model", "=", "form", ".", "_meta", ".", "model", "field", "=", "model", ".", "_meta", ".",...
Allow blank determines if the form might be completely empty. If it's empty it will result in a None as the saved value for the ForeignKey.
[ "Allow", "blank", "determines", "if", "the", "form", "might", "be", "completely", "empty", ".", "If", "it", "s", "empty", "it", "will", "result", "in", "a", "None", "as", "the", "saved", "value", "for", "the", "ForeignKey", "." ]
5f389911ad38932b6dad184cc7fa81f27db752f9
https://github.com/gregmuellegger/django-superform/blob/5f389911ad38932b6dad184cc7fa81f27db752f9/django_superform/fields.py#L301-L310
2,249
gregmuellegger/django-superform
django_superform/fields.py
FormSetField.get_formset
def get_formset(self, form, name): """ Get an instance of the formset. """ kwargs = self.get_kwargs(form, name) formset_class = self.get_formset_class(form, name) formset = formset_class( form.data if form.is_bound else None, form.files if form.is_...
python
def get_formset(self, form, name): kwargs = self.get_kwargs(form, name) formset_class = self.get_formset_class(form, name) formset = formset_class( form.data if form.is_bound else None, form.files if form.is_bound else None, **kwargs) return formset
[ "def", "get_formset", "(", "self", ",", "form", ",", "name", ")", ":", "kwargs", "=", "self", ".", "get_kwargs", "(", "form", ",", "name", ")", "formset_class", "=", "self", ".", "get_formset_class", "(", "form", ",", "name", ")", "formset", "=", "form...
Get an instance of the formset.
[ "Get", "an", "instance", "of", "the", "formset", "." ]
5f389911ad38932b6dad184cc7fa81f27db752f9
https://github.com/gregmuellegger/django-superform/blob/5f389911ad38932b6dad184cc7fa81f27db752f9/django_superform/fields.py#L367-L377
2,250
cobrateam/flask-mongoalchemy
flask_mongoalchemy/__init__.py
MongoAlchemy.init_app
def init_app(self, app, config_prefix='MONGOALCHEMY'): """This callback can be used to initialize an application for the use with this MongoDB setup. Never use a database in the context of an application not initialized that way or connections will leak.""" self.config_prefix = config_p...
python
def init_app(self, app, config_prefix='MONGOALCHEMY'): self.config_prefix = config_prefix def key(suffix): return '%s_%s' % (config_prefix, suffix) if key('DATABASE') not in app.config: raise ImproperlyConfiguredError("You should provide a database name " ...
[ "def", "init_app", "(", "self", ",", "app", ",", "config_prefix", "=", "'MONGOALCHEMY'", ")", ":", "self", ".", "config_prefix", "=", "config_prefix", "def", "key", "(", "suffix", ")", ":", "return", "'%s_%s'", "%", "(", "config_prefix", ",", "suffix", ")"...
This callback can be used to initialize an application for the use with this MongoDB setup. Never use a database in the context of an application not initialized that way or connections will leak.
[ "This", "callback", "can", "be", "used", "to", "initialize", "an", "application", "for", "the", "use", "with", "this", "MongoDB", "setup", ".", "Never", "use", "a", "database", "in", "the", "context", "of", "an", "application", "not", "initialized", "that", ...
66ab6f857cae69e35d37035880c1dfaf1dc9bd15
https://github.com/cobrateam/flask-mongoalchemy/blob/66ab6f857cae69e35d37035880c1dfaf1dc9bd15/flask_mongoalchemy/__init__.py#L106-L129
2,251
cobrateam/flask-mongoalchemy
flask_mongoalchemy/__init__.py
BaseQuery.paginate
def paginate(self, page, per_page=20, error_out=True): """Returns ``per_page`` items from page ``page`` By default, it will abort with 404 if no items were found and the page was larger than 1. This behaviour can be disabled by setting ``error_out`` to ``False``. Returns a :class:`Pagin...
python
def paginate(self, page, per_page=20, error_out=True): if page < 1 and error_out: abort(404) items = self.skip((page - 1) * per_page).limit(per_page).all() if len(items) < 1 and page != 1 and error_out: abort(404) return Pagination(self, page, per_page, self.co...
[ "def", "paginate", "(", "self", ",", "page", ",", "per_page", "=", "20", ",", "error_out", "=", "True", ")", ":", "if", "page", "<", "1", "and", "error_out", ":", "abort", "(", "404", ")", "items", "=", "self", ".", "skip", "(", "(", "page", "-",...
Returns ``per_page`` items from page ``page`` By default, it will abort with 404 if no items were found and the page was larger than 1. This behaviour can be disabled by setting ``error_out`` to ``False``. Returns a :class:`Pagination` object.
[ "Returns", "per_page", "items", "from", "page", "page", "By", "default", "it", "will", "abort", "with", "404", "if", "no", "items", "were", "found", "and", "the", "page", "was", "larger", "than", "1", ".", "This", "behaviour", "can", "be", "disabled", "b...
66ab6f857cae69e35d37035880c1dfaf1dc9bd15
https://github.com/cobrateam/flask-mongoalchemy/blob/66ab6f857cae69e35d37035880c1dfaf1dc9bd15/flask_mongoalchemy/__init__.py#L246-L260
2,252
cobrateam/flask-mongoalchemy
flask_mongoalchemy/__init__.py
Document.save
def save(self, safe=None): """Saves the document itself in the database. The optional ``safe`` argument is a boolean that specifies if the remove method should wait for the operation to complete. """ self._session.insert(self, safe=safe) self._session.flush()
python
def save(self, safe=None): self._session.insert(self, safe=safe) self._session.flush()
[ "def", "save", "(", "self", ",", "safe", "=", "None", ")", ":", "self", ".", "_session", ".", "insert", "(", "self", ",", "safe", "=", "safe", ")", "self", ".", "_session", ".", "flush", "(", ")" ]
Saves the document itself in the database. The optional ``safe`` argument is a boolean that specifies if the remove method should wait for the operation to complete.
[ "Saves", "the", "document", "itself", "in", "the", "database", "." ]
66ab6f857cae69e35d37035880c1dfaf1dc9bd15
https://github.com/cobrateam/flask-mongoalchemy/blob/66ab6f857cae69e35d37035880c1dfaf1dc9bd15/flask_mongoalchemy/__init__.py#L274-L281
2,253
cobrateam/flask-mongoalchemy
flask_mongoalchemy/__init__.py
Document.remove
def remove(self, safe=None): """Removes the document itself from database. The optional ``safe`` argument is a boolean that specifies if the remove method should wait for the operation to complete. """ self._session.remove(self, safe=None) self._session.flush()
python
def remove(self, safe=None): self._session.remove(self, safe=None) self._session.flush()
[ "def", "remove", "(", "self", ",", "safe", "=", "None", ")", ":", "self", ".", "_session", ".", "remove", "(", "self", ",", "safe", "=", "None", ")", "self", ".", "_session", ".", "flush", "(", ")" ]
Removes the document itself from database. The optional ``safe`` argument is a boolean that specifies if the remove method should wait for the operation to complete.
[ "Removes", "the", "document", "itself", "from", "database", "." ]
66ab6f857cae69e35d37035880c1dfaf1dc9bd15
https://github.com/cobrateam/flask-mongoalchemy/blob/66ab6f857cae69e35d37035880c1dfaf1dc9bd15/flask_mongoalchemy/__init__.py#L283-L290
2,254
cobrateam/flask-mongoalchemy
examples/library/library.py
list_authors
def list_authors(): """List all authors. e.g.: GET /authors""" authors = Author.query.all() content = '<p>Authors:</p>' for author in authors: content += '<p>%s</p>' % author.name return content
python
def list_authors(): authors = Author.query.all() content = '<p>Authors:</p>' for author in authors: content += '<p>%s</p>' % author.name return content
[ "def", "list_authors", "(", ")", ":", "authors", "=", "Author", ".", "query", ".", "all", "(", ")", "content", "=", "'<p>Authors:</p>'", "for", "author", "in", "authors", ":", "content", "+=", "'<p>%s</p>'", "%", "author", ".", "name", "return", "content" ...
List all authors. e.g.: GET /authors
[ "List", "all", "authors", "." ]
66ab6f857cae69e35d37035880c1dfaf1dc9bd15
https://github.com/cobrateam/flask-mongoalchemy/blob/66ab6f857cae69e35d37035880c1dfaf1dc9bd15/examples/library/library.py#L37-L45
2,255
jessevdk/cldoc
cldoc/clang/cindex.py
BaseEnumeration.name
def name(self): """Get the enumeration name of this cursor kind.""" if self._name_map is None: self._name_map = {} for key, value in self.__class__.__dict__.items(): if isinstance(value, self.__class__): self._name_map[value] = key retu...
python
def name(self): if self._name_map is None: self._name_map = {} for key, value in self.__class__.__dict__.items(): if isinstance(value, self.__class__): self._name_map[value] = key return self._name_map[self]
[ "def", "name", "(", "self", ")", ":", "if", "self", ".", "_name_map", "is", "None", ":", "self", ".", "_name_map", "=", "{", "}", "for", "key", ",", "value", "in", "self", ".", "__class__", ".", "__dict__", ".", "items", "(", ")", ":", "if", "isi...
Get the enumeration name of this cursor kind.
[ "Get", "the", "enumeration", "name", "of", "this", "cursor", "kind", "." ]
fc7f59405c4a891b8367c80a700f5aa3c5c9230c
https://github.com/jessevdk/cldoc/blob/fc7f59405c4a891b8367c80a700f5aa3c5c9230c/cldoc/clang/cindex.py#L643-L650
2,256
jessevdk/cldoc
cldoc/clang/cindex.py
Cursor.spelling
def spelling(self): """Return the spelling of the entity pointed at by the cursor.""" if not hasattr(self, '_spelling'): self._spelling = conf.lib.clang_getCursorSpelling(self) return self._spelling
python
def spelling(self): if not hasattr(self, '_spelling'): self._spelling = conf.lib.clang_getCursorSpelling(self) return self._spelling
[ "def", "spelling", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'_spelling'", ")", ":", "self", ".", "_spelling", "=", "conf", ".", "lib", ".", "clang_getCursorSpelling", "(", "self", ")", "return", "self", ".", "_spelling" ]
Return the spelling of the entity pointed at by the cursor.
[ "Return", "the", "spelling", "of", "the", "entity", "pointed", "at", "by", "the", "cursor", "." ]
fc7f59405c4a891b8367c80a700f5aa3c5c9230c
https://github.com/jessevdk/cldoc/blob/fc7f59405c4a891b8367c80a700f5aa3c5c9230c/cldoc/clang/cindex.py#L1528-L1533
2,257
jessevdk/cldoc
cldoc/clang/cindex.py
Cursor.displayname
def displayname(self): """ Return the display name for the entity referenced by this cursor. The display name contains extra information that helps identify the cursor, such as the parameters of a function or template or the arguments of a class template specialization. ...
python
def displayname(self): if not hasattr(self, '_displayname'): self._displayname = conf.lib.clang_getCursorDisplayName(self) return self._displayname
[ "def", "displayname", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'_displayname'", ")", ":", "self", ".", "_displayname", "=", "conf", ".", "lib", ".", "clang_getCursorDisplayName", "(", "self", ")", "return", "self", ".", "_displayna...
Return the display name for the entity referenced by this cursor. The display name contains extra information that helps identify the cursor, such as the parameters of a function or template or the arguments of a class template specialization.
[ "Return", "the", "display", "name", "for", "the", "entity", "referenced", "by", "this", "cursor", "." ]
fc7f59405c4a891b8367c80a700f5aa3c5c9230c
https://github.com/jessevdk/cldoc/blob/fc7f59405c4a891b8367c80a700f5aa3c5c9230c/cldoc/clang/cindex.py#L1536-L1547
2,258
jessevdk/cldoc
cldoc/clang/cindex.py
Cursor.mangled_name
def mangled_name(self): """Return the mangled name for the entity referenced by this cursor.""" if not hasattr(self, '_mangled_name'): self._mangled_name = conf.lib.clang_Cursor_getMangling(self) return self._mangled_name
python
def mangled_name(self): if not hasattr(self, '_mangled_name'): self._mangled_name = conf.lib.clang_Cursor_getMangling(self) return self._mangled_name
[ "def", "mangled_name", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'_mangled_name'", ")", ":", "self", ".", "_mangled_name", "=", "conf", ".", "lib", ".", "clang_Cursor_getMangling", "(", "self", ")", "return", "self", ".", "_mangled_...
Return the mangled name for the entity referenced by this cursor.
[ "Return", "the", "mangled", "name", "for", "the", "entity", "referenced", "by", "this", "cursor", "." ]
fc7f59405c4a891b8367c80a700f5aa3c5c9230c
https://github.com/jessevdk/cldoc/blob/fc7f59405c4a891b8367c80a700f5aa3c5c9230c/cldoc/clang/cindex.py#L1550-L1555
2,259
jessevdk/cldoc
cldoc/clang/cindex.py
Cursor.linkage
def linkage(self): """Return the linkage of this cursor.""" if not hasattr(self, '_linkage'): self._linkage = conf.lib.clang_getCursorLinkage(self) return LinkageKind.from_id(self._linkage)
python
def linkage(self): if not hasattr(self, '_linkage'): self._linkage = conf.lib.clang_getCursorLinkage(self) return LinkageKind.from_id(self._linkage)
[ "def", "linkage", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'_linkage'", ")", ":", "self", ".", "_linkage", "=", "conf", ".", "lib", ".", "clang_getCursorLinkage", "(", "self", ")", "return", "LinkageKind", ".", "from_id", "(", ...
Return the linkage of this cursor.
[ "Return", "the", "linkage", "of", "this", "cursor", "." ]
fc7f59405c4a891b8367c80a700f5aa3c5c9230c
https://github.com/jessevdk/cldoc/blob/fc7f59405c4a891b8367c80a700f5aa3c5c9230c/cldoc/clang/cindex.py#L1569-L1574
2,260
jessevdk/cldoc
cldoc/clang/cindex.py
Cursor.availability
def availability(self): """ Retrieves the availability of the entity pointed at by the cursor. """ if not hasattr(self, '_availability'): self._availability = conf.lib.clang_getCursorAvailability(self) return AvailabilityKind.from_id(self._availability)
python
def availability(self): if not hasattr(self, '_availability'): self._availability = conf.lib.clang_getCursorAvailability(self) return AvailabilityKind.from_id(self._availability)
[ "def", "availability", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'_availability'", ")", ":", "self", ".", "_availability", "=", "conf", ".", "lib", ".", "clang_getCursorAvailability", "(", "self", ")", "return", "AvailabilityKind", "....
Retrieves the availability of the entity pointed at by the cursor.
[ "Retrieves", "the", "availability", "of", "the", "entity", "pointed", "at", "by", "the", "cursor", "." ]
fc7f59405c4a891b8367c80a700f5aa3c5c9230c
https://github.com/jessevdk/cldoc/blob/fc7f59405c4a891b8367c80a700f5aa3c5c9230c/cldoc/clang/cindex.py#L1599-L1606
2,261
jessevdk/cldoc
cldoc/clang/cindex.py
Cursor.objc_type_encoding
def objc_type_encoding(self): """Return the Objective-C type encoding as a str.""" if not hasattr(self, '_objc_type_encoding'): self._objc_type_encoding = \ conf.lib.clang_getDeclObjCTypeEncoding(self) return self._objc_type_encoding
python
def objc_type_encoding(self): if not hasattr(self, '_objc_type_encoding'): self._objc_type_encoding = \ conf.lib.clang_getDeclObjCTypeEncoding(self) return self._objc_type_encoding
[ "def", "objc_type_encoding", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'_objc_type_encoding'", ")", ":", "self", ".", "_objc_type_encoding", "=", "conf", ".", "lib", ".", "clang_getDeclObjCTypeEncoding", "(", "self", ")", "return", "sel...
Return the Objective-C type encoding as a str.
[ "Return", "the", "Objective", "-", "C", "type", "encoding", "as", "a", "str", "." ]
fc7f59405c4a891b8367c80a700f5aa3c5c9230c
https://github.com/jessevdk/cldoc/blob/fc7f59405c4a891b8367c80a700f5aa3c5c9230c/cldoc/clang/cindex.py#L1704-L1710
2,262
jessevdk/cldoc
cldoc/clang/cindex.py
TranslationUnit.from_source
def from_source(cls, filename, args=None, unsaved_files=None, options=0, index=None): """Create a TranslationUnit by parsing source. This is capable of processing source code both from files on the filesystem as well as in-memory contents. Command-line arguments tha...
python
def from_source(cls, filename, args=None, unsaved_files=None, options=0, index=None): if args is None: args = [] if unsaved_files is None: unsaved_files = [] if index is None: index = Index.create() args_array = None if l...
[ "def", "from_source", "(", "cls", ",", "filename", ",", "args", "=", "None", ",", "unsaved_files", "=", "None", ",", "options", "=", "0", ",", "index", "=", "None", ")", ":", "if", "args", "is", "None", ":", "args", "=", "[", "]", "if", "unsaved_fi...
Create a TranslationUnit by parsing source. This is capable of processing source code both from files on the filesystem as well as in-memory contents. Command-line arguments that would be passed to clang are specified as a list via args. These can be used to specify include paths, warn...
[ "Create", "a", "TranslationUnit", "by", "parsing", "source", "." ]
fc7f59405c4a891b8367c80a700f5aa3c5c9230c
https://github.com/jessevdk/cldoc/blob/fc7f59405c4a891b8367c80a700f5aa3c5c9230c/cldoc/clang/cindex.py#L2737-L2809
2,263
jessevdk/cldoc
cldoc/clang/cindex.py
Token.cursor
def cursor(self): """The Cursor this Token corresponds to.""" cursor = Cursor() cursor._tu = self._tu conf.lib.clang_annotateTokens(self._tu, byref(self), 1, byref(cursor)) return cursor
python
def cursor(self): cursor = Cursor() cursor._tu = self._tu conf.lib.clang_annotateTokens(self._tu, byref(self), 1, byref(cursor)) return cursor
[ "def", "cursor", "(", "self", ")", ":", "cursor", "=", "Cursor", "(", ")", "cursor", ".", "_tu", "=", "self", ".", "_tu", "conf", ".", "lib", ".", "clang_annotateTokens", "(", "self", ".", "_tu", ",", "byref", "(", "self", ")", ",", "1", ",", "by...
The Cursor this Token corresponds to.
[ "The", "Cursor", "this", "Token", "corresponds", "to", "." ]
fc7f59405c4a891b8367c80a700f5aa3c5c9230c
https://github.com/jessevdk/cldoc/blob/fc7f59405c4a891b8367c80a700f5aa3c5c9230c/cldoc/clang/cindex.py#L3286-L3293
2,264
jessevdk/cldoc
cldoc/tree.py
Tree.process
def process(self): """ process processes all the files with clang and extracts all relevant nodes from the generated AST """ self.index = cindex.Index.create() self.headers = {} for f in self.files: if f in self.processed: continue ...
python
def process(self): self.index = cindex.Index.create() self.headers = {} for f in self.files: if f in self.processed: continue print('Processing {0}'.format(os.path.basename(f))) tu = self.index.parse(f, self.flags) if len(tu.dia...
[ "def", "process", "(", "self", ")", ":", "self", ".", "index", "=", "cindex", ".", "Index", ".", "create", "(", ")", "self", ".", "headers", "=", "{", "}", "for", "f", "in", "self", ".", "files", ":", "if", "f", "in", "self", ".", "processed", ...
process processes all the files with clang and extracts all relevant nodes from the generated AST
[ "process", "processes", "all", "the", "files", "with", "clang", "and", "extracts", "all", "relevant", "nodes", "from", "the", "generated", "AST" ]
fc7f59405c4a891b8367c80a700f5aa3c5c9230c
https://github.com/jessevdk/cldoc/blob/fc7f59405c4a891b8367c80a700f5aa3c5c9230c/cldoc/tree.py#L194-L295
2,265
jessevdk/cldoc
cldoc/tree.py
Tree.visit
def visit(self, citer, parent=None): """ visit iterates over the provided cursor iterator and creates nodes from the AST cursors. """ if not citer: return while True: try: item = next(citer) except StopIteration: ...
python
def visit(self, citer, parent=None): if not citer: return while True: try: item = next(citer) except StopIteration: return # Check the source of item if not item.location.file: self.visit(item.g...
[ "def", "visit", "(", "self", ",", "citer", ",", "parent", "=", "None", ")", ":", "if", "not", "citer", ":", "return", "while", "True", ":", "try", ":", "item", "=", "next", "(", "citer", ")", "except", "StopIteration", ":", "return", "# Check the sourc...
visit iterates over the provided cursor iterator and creates nodes from the AST cursors.
[ "visit", "iterates", "over", "the", "provided", "cursor", "iterator", "and", "creates", "nodes", "from", "the", "AST", "cursors", "." ]
fc7f59405c4a891b8367c80a700f5aa3c5c9230c
https://github.com/jessevdk/cldoc/blob/fc7f59405c4a891b8367c80a700f5aa3c5c9230c/cldoc/tree.py#L492-L571
2,266
jessevdk/cldoc
cldoc/comment.py
CommentsDatabase.extract
def extract(self, filename, tu): """ extract extracts comments from a translation unit for a given file by iterating over all the tokens in the TU, locating the COMMENT tokens and finding out to which cursors the comments semantically belong. """ it = tu.get_tokens(extent...
python
def extract(self, filename, tu): it = tu.get_tokens(extent=tu.get_extent(filename, (0, int(os.stat(filename).st_size)))) while True: try: self.extract_loop(it) except StopIteration: break
[ "def", "extract", "(", "self", ",", "filename", ",", "tu", ")", ":", "it", "=", "tu", ".", "get_tokens", "(", "extent", "=", "tu", ".", "get_extent", "(", "filename", ",", "(", "0", ",", "int", "(", "os", ".", "stat", "(", "filename", ")", ".", ...
extract extracts comments from a translation unit for a given file by iterating over all the tokens in the TU, locating the COMMENT tokens and finding out to which cursors the comments semantically belong.
[ "extract", "extracts", "comments", "from", "a", "translation", "unit", "for", "a", "given", "file", "by", "iterating", "over", "all", "the", "tokens", "in", "the", "TU", "locating", "the", "COMMENT", "tokens", "and", "finding", "out", "to", "which", "cursors...
fc7f59405c4a891b8367c80a700f5aa3c5c9230c
https://github.com/jessevdk/cldoc/blob/fc7f59405c4a891b8367c80a700f5aa3c5c9230c/cldoc/comment.py#L378-L390
2,267
ergoithz/browsepy
browsepy/manager.py
defaultsnamedtuple
def defaultsnamedtuple(name, fields, defaults=None): ''' Generate namedtuple with default values. :param name: name :param fields: iterable with field names :param defaults: iterable or mapping with field defaults :returns: defaultdict with given fields and given defaults :rtype: collection...
python
def defaultsnamedtuple(name, fields, defaults=None): ''' Generate namedtuple with default values. :param name: name :param fields: iterable with field names :param defaults: iterable or mapping with field defaults :returns: defaultdict with given fields and given defaults :rtype: collection...
[ "def", "defaultsnamedtuple", "(", "name", ",", "fields", ",", "defaults", "=", "None", ")", ":", "nt", "=", "collections", ".", "namedtuple", "(", "name", ",", "fields", ")", "nt", ".", "__new__", ".", "__defaults__", "=", "(", "None", ",", ")", "*", ...
Generate namedtuple with default values. :param name: name :param fields: iterable with field names :param defaults: iterable or mapping with field defaults :returns: defaultdict with given fields and given defaults :rtype: collections.defaultdict
[ "Generate", "namedtuple", "with", "default", "values", "." ]
1612a930ef220fae507e1b152c531707e555bd92
https://github.com/ergoithz/browsepy/blob/1612a930ef220fae507e1b152c531707e555bd92/browsepy/manager.py#L18-L34
2,268
ergoithz/browsepy
browsepy/manager.py
PluginManagerBase.init_app
def init_app(self, app): ''' Initialize this Flask extension for given app. ''' self.app = app if not hasattr(app, 'extensions'): app.extensions = {} app.extensions['plugin_manager'] = self self.reload()
python
def init_app(self, app): ''' Initialize this Flask extension for given app. ''' self.app = app if not hasattr(app, 'extensions'): app.extensions = {} app.extensions['plugin_manager'] = self self.reload()
[ "def", "init_app", "(", "self", ",", "app", ")", ":", "self", ".", "app", "=", "app", "if", "not", "hasattr", "(", "app", ",", "'extensions'", ")", ":", "app", ".", "extensions", "=", "{", "}", "app", ".", "extensions", "[", "'plugin_manager'", "]", ...
Initialize this Flask extension for given app.
[ "Initialize", "this", "Flask", "extension", "for", "given", "app", "." ]
1612a930ef220fae507e1b152c531707e555bd92
https://github.com/ergoithz/browsepy/blob/1612a930ef220fae507e1b152c531707e555bd92/browsepy/manager.py#L71-L79
2,269
ergoithz/browsepy
browsepy/manager.py
PluginManagerBase.reload
def reload(self): ''' Clear plugin manager state and reload plugins. This method will make use of :meth:`clear` and :meth:`load_plugin`, so all internal state will be cleared, and all plugins defined in :data:`self.app.config['plugin_modules']` will be loaded. ''' ...
python
def reload(self): ''' Clear plugin manager state and reload plugins. This method will make use of :meth:`clear` and :meth:`load_plugin`, so all internal state will be cleared, and all plugins defined in :data:`self.app.config['plugin_modules']` will be loaded. ''' ...
[ "def", "reload", "(", "self", ")", ":", "self", ".", "clear", "(", ")", "for", "plugin", "in", "self", ".", "app", ".", "config", ".", "get", "(", "'plugin_modules'", ",", "(", ")", ")", ":", "self", ".", "load_plugin", "(", "plugin", ")" ]
Clear plugin manager state and reload plugins. This method will make use of :meth:`clear` and :meth:`load_plugin`, so all internal state will be cleared, and all plugins defined in :data:`self.app.config['plugin_modules']` will be loaded.
[ "Clear", "plugin", "manager", "state", "and", "reload", "plugins", "." ]
1612a930ef220fae507e1b152c531707e555bd92
https://github.com/ergoithz/browsepy/blob/1612a930ef220fae507e1b152c531707e555bd92/browsepy/manager.py#L81-L91
2,270
ergoithz/browsepy
browsepy/manager.py
BlueprintPluginManager.register_blueprint
def register_blueprint(self, blueprint): ''' Register given blueprint on curren app. This method is provided for using inside plugin's module-level :func:`register_plugin` functions. :param blueprint: blueprint object with plugin endpoints :type blueprint: flask.Bluepri...
python
def register_blueprint(self, blueprint): ''' Register given blueprint on curren app. This method is provided for using inside plugin's module-level :func:`register_plugin` functions. :param blueprint: blueprint object with plugin endpoints :type blueprint: flask.Bluepri...
[ "def", "register_blueprint", "(", "self", ",", "blueprint", ")", ":", "if", "blueprint", "not", "in", "self", ".", "_blueprint_known", ":", "self", ".", "app", ".", "register_blueprint", "(", "blueprint", ")", "self", ".", "_blueprint_known", ".", "add", "("...
Register given blueprint on curren app. This method is provided for using inside plugin's module-level :func:`register_plugin` functions. :param blueprint: blueprint object with plugin endpoints :type blueprint: flask.Blueprint
[ "Register", "given", "blueprint", "on", "curren", "app", "." ]
1612a930ef220fae507e1b152c531707e555bd92
https://github.com/ergoithz/browsepy/blob/1612a930ef220fae507e1b152c531707e555bd92/browsepy/manager.py#L173-L185
2,271
ergoithz/browsepy
browsepy/manager.py
WidgetPluginManager._resolve_widget
def _resolve_widget(cls, file, widget): ''' Resolve widget callable properties into static ones. :param file: file will be used to resolve callable properties. :type file: browsepy.file.Node :param widget: widget instance optionally with callable properties :type widget:...
python
def _resolve_widget(cls, file, widget): ''' Resolve widget callable properties into static ones. :param file: file will be used to resolve callable properties. :type file: browsepy.file.Node :param widget: widget instance optionally with callable properties :type widget:...
[ "def", "_resolve_widget", "(", "cls", ",", "file", ",", "widget", ")", ":", "return", "widget", ".", "__class__", "(", "*", "[", "value", "(", "file", ")", "if", "callable", "(", "value", ")", "else", "value", "for", "value", "in", "widget", "]", ")"...
Resolve widget callable properties into static ones. :param file: file will be used to resolve callable properties. :type file: browsepy.file.Node :param widget: widget instance optionally with callable properties :type widget: object :returns: a new widget instance of the same ...
[ "Resolve", "widget", "callable", "properties", "into", "static", "ones", "." ]
1612a930ef220fae507e1b152c531707e555bd92
https://github.com/ergoithz/browsepy/blob/1612a930ef220fae507e1b152c531707e555bd92/browsepy/manager.py#L256-L270
2,272
ergoithz/browsepy
browsepy/manager.py
WidgetPluginManager.iter_widgets
def iter_widgets(self, file=None, place=None): ''' Iterate registered widgets, optionally matching given criteria. :param file: optional file object will be passed to widgets' filter functions. :type file: browsepy.file.Node or None :param place: optional te...
python
def iter_widgets(self, file=None, place=None): ''' Iterate registered widgets, optionally matching given criteria. :param file: optional file object will be passed to widgets' filter functions. :type file: browsepy.file.Node or None :param place: optional te...
[ "def", "iter_widgets", "(", "self", ",", "file", "=", "None", ",", "place", "=", "None", ")", ":", "for", "filter", ",", "dynamic", ",", "cwidget", "in", "self", ".", "_widgets", ":", "try", ":", "if", "file", "and", "filter", "and", "not", "filter",...
Iterate registered widgets, optionally matching given criteria. :param file: optional file object will be passed to widgets' filter functions. :type file: browsepy.file.Node or None :param place: optional template place hint. :type place: str :yields: widget...
[ "Iterate", "registered", "widgets", "optionally", "matching", "given", "criteria", "." ]
1612a930ef220fae507e1b152c531707e555bd92
https://github.com/ergoithz/browsepy/blob/1612a930ef220fae507e1b152c531707e555bd92/browsepy/manager.py#L272-L300
2,273
ergoithz/browsepy
browsepy/manager.py
WidgetPluginManager.create_widget
def create_widget(self, place, type, file=None, **kwargs): ''' Create a widget object based on given arguments. If file object is provided, callable arguments will be resolved: its return value will be used after calling them with file as first parameter. All extra `kwa...
python
def create_widget(self, place, type, file=None, **kwargs): ''' Create a widget object based on given arguments. If file object is provided, callable arguments will be resolved: its return value will be used after calling them with file as first parameter. All extra `kwa...
[ "def", "create_widget", "(", "self", ",", "place", ",", "type", ",", "file", "=", "None", ",", "*", "*", "kwargs", ")", ":", "widget_class", "=", "self", ".", "widget_types", ".", "get", "(", "type", ",", "self", ".", "widget_types", "[", "'base'", "...
Create a widget object based on given arguments. If file object is provided, callable arguments will be resolved: its return value will be used after calling them with file as first parameter. All extra `kwargs` parameters will be passed to widget constructor. :param place: pl...
[ "Create", "a", "widget", "object", "based", "on", "given", "arguments", "." ]
1612a930ef220fae507e1b152c531707e555bd92
https://github.com/ergoithz/browsepy/blob/1612a930ef220fae507e1b152c531707e555bd92/browsepy/manager.py#L302-L339
2,274
ergoithz/browsepy
browsepy/manager.py
MimetypePluginManager.clear
def clear(self): ''' Clear plugin manager state. Registered mimetype functions will be disposed after calling this method. ''' self._mimetype_functions = list(self._default_mimetype_functions) super(MimetypePluginManager, self).clear()
python
def clear(self): ''' Clear plugin manager state. Registered mimetype functions will be disposed after calling this method. ''' self._mimetype_functions = list(self._default_mimetype_functions) super(MimetypePluginManager, self).clear()
[ "def", "clear", "(", "self", ")", ":", "self", ".", "_mimetype_functions", "=", "list", "(", "self", ".", "_default_mimetype_functions", ")", "super", "(", "MimetypePluginManager", ",", "self", ")", ".", "clear", "(", ")" ]
Clear plugin manager state. Registered mimetype functions will be disposed after calling this method.
[ "Clear", "plugin", "manager", "state", "." ]
1612a930ef220fae507e1b152c531707e555bd92
https://github.com/ergoithz/browsepy/blob/1612a930ef220fae507e1b152c531707e555bd92/browsepy/manager.py#L385-L393
2,275
ergoithz/browsepy
browsepy/__init__.py
iter_cookie_browse_sorting
def iter_cookie_browse_sorting(cookies): ''' Get sorting-cookie from cookies dictionary. :yields: tuple of path and sorting property :ytype: 2-tuple of strings ''' try: data = cookies.get('browse-sorting', 'e30=').encode('ascii') for path, prop in json.loads(base64.b64decode(dat...
python
def iter_cookie_browse_sorting(cookies): ''' Get sorting-cookie from cookies dictionary. :yields: tuple of path and sorting property :ytype: 2-tuple of strings ''' try: data = cookies.get('browse-sorting', 'e30=').encode('ascii') for path, prop in json.loads(base64.b64decode(dat...
[ "def", "iter_cookie_browse_sorting", "(", "cookies", ")", ":", "try", ":", "data", "=", "cookies", ".", "get", "(", "'browse-sorting'", ",", "'e30='", ")", ".", "encode", "(", "'ascii'", ")", "for", "path", ",", "prop", "in", "json", ".", "loads", "(", ...
Get sorting-cookie from cookies dictionary. :yields: tuple of path and sorting property :ytype: 2-tuple of strings
[ "Get", "sorting", "-", "cookie", "from", "cookies", "dictionary", "." ]
1612a930ef220fae507e1b152c531707e555bd92
https://github.com/ergoithz/browsepy/blob/1612a930ef220fae507e1b152c531707e555bd92/browsepy/__init__.py#L61-L73
2,276
ergoithz/browsepy
browsepy/__init__.py
get_cookie_browse_sorting
def get_cookie_browse_sorting(path, default): ''' Get sorting-cookie data for path of current request. :returns: sorting property :rtype: string ''' if request: for cpath, cprop in iter_cookie_browse_sorting(request.cookies): if path == cpath: return cprop ...
python
def get_cookie_browse_sorting(path, default): ''' Get sorting-cookie data for path of current request. :returns: sorting property :rtype: string ''' if request: for cpath, cprop in iter_cookie_browse_sorting(request.cookies): if path == cpath: return cprop ...
[ "def", "get_cookie_browse_sorting", "(", "path", ",", "default", ")", ":", "if", "request", ":", "for", "cpath", ",", "cprop", "in", "iter_cookie_browse_sorting", "(", "request", ".", "cookies", ")", ":", "if", "path", "==", "cpath", ":", "return", "cprop", ...
Get sorting-cookie data for path of current request. :returns: sorting property :rtype: string
[ "Get", "sorting", "-", "cookie", "data", "for", "path", "of", "current", "request", "." ]
1612a930ef220fae507e1b152c531707e555bd92
https://github.com/ergoithz/browsepy/blob/1612a930ef220fae507e1b152c531707e555bd92/browsepy/__init__.py#L76-L87
2,277
ergoithz/browsepy
browsepy/__init__.py
stream_template
def stream_template(template_name, **context): ''' Some templates can be huge, this function returns an streaming response, sending the content in chunks and preventing from timeout. :param template_name: template :param **context: parameters for templates. :yields: HTML strings ''' app...
python
def stream_template(template_name, **context): ''' Some templates can be huge, this function returns an streaming response, sending the content in chunks and preventing from timeout. :param template_name: template :param **context: parameters for templates. :yields: HTML strings ''' app...
[ "def", "stream_template", "(", "template_name", ",", "*", "*", "context", ")", ":", "app", ".", "update_template_context", "(", "context", ")", "template", "=", "app", ".", "jinja_env", ".", "get_template", "(", "template_name", ")", "stream", "=", "template",...
Some templates can be huge, this function returns an streaming response, sending the content in chunks and preventing from timeout. :param template_name: template :param **context: parameters for templates. :yields: HTML strings
[ "Some", "templates", "can", "be", "huge", "this", "function", "returns", "an", "streaming", "response", "sending", "the", "content", "in", "chunks", "and", "preventing", "from", "timeout", "." ]
1612a930ef220fae507e1b152c531707e555bd92
https://github.com/ergoithz/browsepy/blob/1612a930ef220fae507e1b152c531707e555bd92/browsepy/__init__.py#L133-L145
2,278
ergoithz/browsepy
browsepy/appconfig.py
Config.gendict
def gendict(cls, *args, **kwargs): ''' Pre-translated key dictionary constructor. See :type:`dict` for more info. :returns: dictionary with uppercase keys :rtype: dict ''' gk = cls.genkey return dict((gk(k), v) for k, v in dict(*args, **kwargs).items())
python
def gendict(cls, *args, **kwargs): ''' Pre-translated key dictionary constructor. See :type:`dict` for more info. :returns: dictionary with uppercase keys :rtype: dict ''' gk = cls.genkey return dict((gk(k), v) for k, v in dict(*args, **kwargs).items())
[ "def", "gendict", "(", "cls", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "gk", "=", "cls", ".", "genkey", "return", "dict", "(", "(", "gk", "(", "k", ")", ",", "v", ")", "for", "k", ",", "v", "in", "dict", "(", "*", "args", ",", ...
Pre-translated key dictionary constructor. See :type:`dict` for more info. :returns: dictionary with uppercase keys :rtype: dict
[ "Pre", "-", "translated", "key", "dictionary", "constructor", "." ]
1612a930ef220fae507e1b152c531707e555bd92
https://github.com/ergoithz/browsepy/blob/1612a930ef220fae507e1b152c531707e555bd92/browsepy/appconfig.py#L31-L41
2,279
ergoithz/browsepy
browsepy/transform/__init__.py
StateMachine.nearest
def nearest(self): ''' Get the next state jump. The next jump is calculated looking at :attr:`current` state and its possible :attr:`jumps` to find the nearest and bigger option in :attr:`pending` data. If none is found, the returned next state label will be None. ...
python
def nearest(self): ''' Get the next state jump. The next jump is calculated looking at :attr:`current` state and its possible :attr:`jumps` to find the nearest and bigger option in :attr:`pending` data. If none is found, the returned next state label will be None. ...
[ "def", "nearest", "(", "self", ")", ":", "try", ":", "options", "=", "self", ".", "jumps", "[", "self", ".", "current", "]", "except", "KeyError", ":", "raise", "KeyError", "(", "'Current state %r not defined in %s.jumps.'", "%", "(", "self", ".", "current",...
Get the next state jump. The next jump is calculated looking at :attr:`current` state and its possible :attr:`jumps` to find the nearest and bigger option in :attr:`pending` data. If none is found, the returned next state label will be None. :returns: tuple with index, substri...
[ "Get", "the", "next", "state", "jump", "." ]
1612a930ef220fae507e1b152c531707e555bd92
https://github.com/ergoithz/browsepy/blob/1612a930ef220fae507e1b152c531707e555bd92/browsepy/transform/__init__.py#L20-L55
2,280
ergoithz/browsepy
browsepy/transform/__init__.py
StateMachine.transform
def transform(self, data, mark, next): ''' Apply the appropriate transformation function on current state data, which is supposed to end at this point. It is expected transformation logic makes use of :attr:`start`, :attr:`current` and :attr:`streaming` instance attributes to ...
python
def transform(self, data, mark, next): ''' Apply the appropriate transformation function on current state data, which is supposed to end at this point. It is expected transformation logic makes use of :attr:`start`, :attr:`current` and :attr:`streaming` instance attributes to ...
[ "def", "transform", "(", "self", ",", "data", ",", "mark", ",", "next", ")", ":", "method", "=", "getattr", "(", "self", ",", "'transform_%s'", "%", "self", ".", "current", ",", "None", ")", "return", "method", "(", "data", ",", "mark", ",", "next", ...
Apply the appropriate transformation function on current state data, which is supposed to end at this point. It is expected transformation logic makes use of :attr:`start`, :attr:`current` and :attr:`streaming` instance attributes to bettee know the state is being left. :param ...
[ "Apply", "the", "appropriate", "transformation", "function", "on", "current", "state", "data", "which", "is", "supposed", "to", "end", "at", "this", "point", "." ]
1612a930ef220fae507e1b152c531707e555bd92
https://github.com/ergoithz/browsepy/blob/1612a930ef220fae507e1b152c531707e555bd92/browsepy/transform/__init__.py#L92-L112
2,281
ergoithz/browsepy
browsepy/transform/__init__.py
StateMachine.feed
def feed(self, data=''): ''' Optionally add pending data, switch into streaming mode, and yield result chunks. :yields: result chunks :ytype: str ''' self.streaming = True self.pending += data for i in self: yield i
python
def feed(self, data=''): ''' Optionally add pending data, switch into streaming mode, and yield result chunks. :yields: result chunks :ytype: str ''' self.streaming = True self.pending += data for i in self: yield i
[ "def", "feed", "(", "self", ",", "data", "=", "''", ")", ":", "self", ".", "streaming", "=", "True", "self", ".", "pending", "+=", "data", "for", "i", "in", "self", ":", "yield", "i" ]
Optionally add pending data, switch into streaming mode, and yield result chunks. :yields: result chunks :ytype: str
[ "Optionally", "add", "pending", "data", "switch", "into", "streaming", "mode", "and", "yield", "result", "chunks", "." ]
1612a930ef220fae507e1b152c531707e555bd92
https://github.com/ergoithz/browsepy/blob/1612a930ef220fae507e1b152c531707e555bd92/browsepy/transform/__init__.py#L114-L125
2,282
ergoithz/browsepy
browsepy/transform/__init__.py
StateMachine.finish
def finish(self, data=''): ''' Optionally add pending data, turn off streaming mode, and yield result chunks, which implies all pending data will be consumed. :yields: result chunks :ytype: str ''' self.pending += data self.streaming = False for i...
python
def finish(self, data=''): ''' Optionally add pending data, turn off streaming mode, and yield result chunks, which implies all pending data will be consumed. :yields: result chunks :ytype: str ''' self.pending += data self.streaming = False for i...
[ "def", "finish", "(", "self", ",", "data", "=", "''", ")", ":", "self", ".", "pending", "+=", "data", "self", ".", "streaming", "=", "False", "for", "i", "in", "self", ":", "yield", "i" ]
Optionally add pending data, turn off streaming mode, and yield result chunks, which implies all pending data will be consumed. :yields: result chunks :ytype: str
[ "Optionally", "add", "pending", "data", "turn", "off", "streaming", "mode", "and", "yield", "result", "chunks", "which", "implies", "all", "pending", "data", "will", "be", "consumed", "." ]
1612a930ef220fae507e1b152c531707e555bd92
https://github.com/ergoithz/browsepy/blob/1612a930ef220fae507e1b152c531707e555bd92/browsepy/transform/__init__.py#L127-L138
2,283
ergoithz/browsepy
browsepy/stream.py
TarFileStream.write
def write(self, data): ''' Write method used by internal tarfile instance to output data. This method blocks tarfile execution once internal buffer is full. As this method is blocking, it is used inside the same thread of :meth:`fill`. :param data: bytes to write to int...
python
def write(self, data): ''' Write method used by internal tarfile instance to output data. This method blocks tarfile execution once internal buffer is full. As this method is blocking, it is used inside the same thread of :meth:`fill`. :param data: bytes to write to int...
[ "def", "write", "(", "self", ",", "data", ")", ":", "self", ".", "_add", ".", "wait", "(", ")", "self", ".", "_data", "+=", "data", "if", "len", "(", "self", ".", "_data", ")", ">", "self", ".", "_want", ":", "self", ".", "_add", ".", "clear", ...
Write method used by internal tarfile instance to output data. This method blocks tarfile execution once internal buffer is full. As this method is blocking, it is used inside the same thread of :meth:`fill`. :param data: bytes to write to internal buffer :type data: bytes ...
[ "Write", "method", "used", "by", "internal", "tarfile", "instance", "to", "output", "data", ".", "This", "method", "blocks", "tarfile", "execution", "once", "internal", "buffer", "is", "full", "." ]
1612a930ef220fae507e1b152c531707e555bd92
https://github.com/ergoithz/browsepy/blob/1612a930ef220fae507e1b152c531707e555bd92/browsepy/stream.py#L78-L96
2,284
ergoithz/browsepy
browsepy/compat.py
isexec
def isexec(path): ''' Check if given path points to an executable file. :param path: file path :type path: str :return: True if executable, False otherwise :rtype: bool ''' return os.path.isfile(path) and os.access(path, os.X_OK)
python
def isexec(path): ''' Check if given path points to an executable file. :param path: file path :type path: str :return: True if executable, False otherwise :rtype: bool ''' return os.path.isfile(path) and os.access(path, os.X_OK)
[ "def", "isexec", "(", "path", ")", ":", "return", "os", ".", "path", ".", "isfile", "(", "path", ")", "and", "os", ".", "access", "(", "path", ",", "os", ".", "X_OK", ")" ]
Check if given path points to an executable file. :param path: file path :type path: str :return: True if executable, False otherwise :rtype: bool
[ "Check", "if", "given", "path", "points", "to", "an", "executable", "file", "." ]
1612a930ef220fae507e1b152c531707e555bd92
https://github.com/ergoithz/browsepy/blob/1612a930ef220fae507e1b152c531707e555bd92/browsepy/compat.py#L30-L39
2,285
ergoithz/browsepy
browsepy/compat.py
fsdecode
def fsdecode(path, os_name=os.name, fs_encoding=FS_ENCODING, errors=None): ''' Decode given path. :param path: path will be decoded if using bytes :type path: bytes or str :param os_name: operative system name, defaults to os.name :type os_name: str :param fs_encoding: current filesystem en...
python
def fsdecode(path, os_name=os.name, fs_encoding=FS_ENCODING, errors=None): ''' Decode given path. :param path: path will be decoded if using bytes :type path: bytes or str :param os_name: operative system name, defaults to os.name :type os_name: str :param fs_encoding: current filesystem en...
[ "def", "fsdecode", "(", "path", ",", "os_name", "=", "os", ".", "name", ",", "fs_encoding", "=", "FS_ENCODING", ",", "errors", "=", "None", ")", ":", "if", "not", "isinstance", "(", "path", ",", "bytes", ")", ":", "return", "path", "if", "not", "erro...
Decode given path. :param path: path will be decoded if using bytes :type path: bytes or str :param os_name: operative system name, defaults to os.name :type os_name: str :param fs_encoding: current filesystem encoding, defaults to autodetected :type fs_encoding: str :return: decoded path ...
[ "Decode", "given", "path", "." ]
1612a930ef220fae507e1b152c531707e555bd92
https://github.com/ergoithz/browsepy/blob/1612a930ef220fae507e1b152c531707e555bd92/browsepy/compat.py#L42-L60
2,286
ergoithz/browsepy
browsepy/compat.py
fsencode
def fsencode(path, os_name=os.name, fs_encoding=FS_ENCODING, errors=None): ''' Encode given path. :param path: path will be encoded if not using bytes :type path: bytes or str :param os_name: operative system name, defaults to os.name :type os_name: str :param fs_encoding: current filesyste...
python
def fsencode(path, os_name=os.name, fs_encoding=FS_ENCODING, errors=None): ''' Encode given path. :param path: path will be encoded if not using bytes :type path: bytes or str :param os_name: operative system name, defaults to os.name :type os_name: str :param fs_encoding: current filesyste...
[ "def", "fsencode", "(", "path", ",", "os_name", "=", "os", ".", "name", ",", "fs_encoding", "=", "FS_ENCODING", ",", "errors", "=", "None", ")", ":", "if", "isinstance", "(", "path", ",", "bytes", ")", ":", "return", "path", "if", "not", "errors", ":...
Encode given path. :param path: path will be encoded if not using bytes :type path: bytes or str :param os_name: operative system name, defaults to os.name :type os_name: str :param fs_encoding: current filesystem encoding, defaults to autodetected :type fs_encoding: str :return: encoded pa...
[ "Encode", "given", "path", "." ]
1612a930ef220fae507e1b152c531707e555bd92
https://github.com/ergoithz/browsepy/blob/1612a930ef220fae507e1b152c531707e555bd92/browsepy/compat.py#L63-L81
2,287
ergoithz/browsepy
browsepy/compat.py
getcwd
def getcwd(fs_encoding=FS_ENCODING, cwd_fnc=os.getcwd): ''' Get current work directory's absolute path. Like os.getcwd but garanteed to return an unicode-str object. :param fs_encoding: filesystem encoding, defaults to autodetected :type fs_encoding: str :param cwd_fnc: callable used to get the...
python
def getcwd(fs_encoding=FS_ENCODING, cwd_fnc=os.getcwd): ''' Get current work directory's absolute path. Like os.getcwd but garanteed to return an unicode-str object. :param fs_encoding: filesystem encoding, defaults to autodetected :type fs_encoding: str :param cwd_fnc: callable used to get the...
[ "def", "getcwd", "(", "fs_encoding", "=", "FS_ENCODING", ",", "cwd_fnc", "=", "os", ".", "getcwd", ")", ":", "path", "=", "fsdecode", "(", "cwd_fnc", "(", ")", ",", "fs_encoding", "=", "fs_encoding", ")", "return", "os", ".", "path", ".", "abspath", "(...
Get current work directory's absolute path. Like os.getcwd but garanteed to return an unicode-str object. :param fs_encoding: filesystem encoding, defaults to autodetected :type fs_encoding: str :param cwd_fnc: callable used to get the path, defaults to os.getcwd :type cwd_fnc: Callable :return...
[ "Get", "current", "work", "directory", "s", "absolute", "path", ".", "Like", "os", ".", "getcwd", "but", "garanteed", "to", "return", "an", "unicode", "-", "str", "object", "." ]
1612a930ef220fae507e1b152c531707e555bd92
https://github.com/ergoithz/browsepy/blob/1612a930ef220fae507e1b152c531707e555bd92/browsepy/compat.py#L84-L97
2,288
ergoithz/browsepy
browsepy/compat.py
getdebug
def getdebug(environ=os.environ, true_values=TRUE_VALUES): ''' Get if app is expected to be ran in debug mode looking at environment variables. :param environ: environment dict-like object :type environ: collections.abc.Mapping :returns: True if debug contains a true-like string, False otherwis...
python
def getdebug(environ=os.environ, true_values=TRUE_VALUES): ''' Get if app is expected to be ran in debug mode looking at environment variables. :param environ: environment dict-like object :type environ: collections.abc.Mapping :returns: True if debug contains a true-like string, False otherwis...
[ "def", "getdebug", "(", "environ", "=", "os", ".", "environ", ",", "true_values", "=", "TRUE_VALUES", ")", ":", "return", "environ", ".", "get", "(", "'DEBUG'", ",", "''", ")", ".", "lower", "(", ")", "in", "true_values" ]
Get if app is expected to be ran in debug mode looking at environment variables. :param environ: environment dict-like object :type environ: collections.abc.Mapping :returns: True if debug contains a true-like string, False otherwise :rtype: bool
[ "Get", "if", "app", "is", "expected", "to", "be", "ran", "in", "debug", "mode", "looking", "at", "environment", "variables", "." ]
1612a930ef220fae507e1b152c531707e555bd92
https://github.com/ergoithz/browsepy/blob/1612a930ef220fae507e1b152c531707e555bd92/browsepy/compat.py#L100-L110
2,289
ergoithz/browsepy
browsepy/compat.py
deprecated
def deprecated(func_or_text, environ=os.environ): ''' Decorator used to mark functions as deprecated. It will result in a warning being emmitted hen the function is called. Usage: >>> @deprecated ... def fnc(): ... pass Usage (custom message): >>> @deprecated('This is depreca...
python
def deprecated(func_or_text, environ=os.environ): ''' Decorator used to mark functions as deprecated. It will result in a warning being emmitted hen the function is called. Usage: >>> @deprecated ... def fnc(): ... pass Usage (custom message): >>> @deprecated('This is depreca...
[ "def", "deprecated", "(", "func_or_text", ",", "environ", "=", "os", ".", "environ", ")", ":", "def", "inner", "(", "func", ")", ":", "message", "=", "(", "'Deprecated function {}.'", ".", "format", "(", "func", ".", "__name__", ")", "if", "callable", "(...
Decorator used to mark functions as deprecated. It will result in a warning being emmitted hen the function is called. Usage: >>> @deprecated ... def fnc(): ... pass Usage (custom message): >>> @deprecated('This is deprecated') ... def fnc(): ... pass :param func_or_...
[ "Decorator", "used", "to", "mark", "functions", "as", "deprecated", ".", "It", "will", "result", "in", "a", "warning", "being", "emmitted", "hen", "the", "function", "is", "called", "." ]
1612a930ef220fae507e1b152c531707e555bd92
https://github.com/ergoithz/browsepy/blob/1612a930ef220fae507e1b152c531707e555bd92/browsepy/compat.py#L113-L153
2,290
ergoithz/browsepy
browsepy/compat.py
pathsplit
def pathsplit(value, sep=os.pathsep): ''' Get enviroment PATH elements as list. This function only cares about spliting across OSes. :param value: path string, as given by os.environ['PATH'] :type value: str :param sep: PATH separator, defaults to os.pathsep :type sep: str :yields: eve...
python
def pathsplit(value, sep=os.pathsep): ''' Get enviroment PATH elements as list. This function only cares about spliting across OSes. :param value: path string, as given by os.environ['PATH'] :type value: str :param sep: PATH separator, defaults to os.pathsep :type sep: str :yields: eve...
[ "def", "pathsplit", "(", "value", ",", "sep", "=", "os", ".", "pathsep", ")", ":", "for", "part", "in", "value", ".", "split", "(", "sep", ")", ":", "if", "part", "[", ":", "1", "]", "==", "part", "[", "-", "1", ":", "]", "==", "'\"'", "or", ...
Get enviroment PATH elements as list. This function only cares about spliting across OSes. :param value: path string, as given by os.environ['PATH'] :type value: str :param sep: PATH separator, defaults to os.pathsep :type sep: str :yields: every path :ytype: str
[ "Get", "enviroment", "PATH", "elements", "as", "list", "." ]
1612a930ef220fae507e1b152c531707e555bd92
https://github.com/ergoithz/browsepy/blob/1612a930ef220fae507e1b152c531707e555bd92/browsepy/compat.py#L182-L198
2,291
ergoithz/browsepy
browsepy/compat.py
pathparse
def pathparse(value, sep=os.pathsep, os_sep=os.sep): ''' Get enviroment PATH directories as list. This function cares about spliting, escapes and normalization of paths across OSes. :param value: path string, as given by os.environ['PATH'] :type value: str :param sep: PATH separator, defau...
python
def pathparse(value, sep=os.pathsep, os_sep=os.sep): ''' Get enviroment PATH directories as list. This function cares about spliting, escapes and normalization of paths across OSes. :param value: path string, as given by os.environ['PATH'] :type value: str :param sep: PATH separator, defau...
[ "def", "pathparse", "(", "value", ",", "sep", "=", "os", ".", "pathsep", ",", "os_sep", "=", "os", ".", "sep", ")", ":", "escapes", "=", "[", "]", "normpath", "=", "ntpath", ".", "normpath", "if", "os_sep", "==", "'\\\\'", "else", "posixpath", ".", ...
Get enviroment PATH directories as list. This function cares about spliting, escapes and normalization of paths across OSes. :param value: path string, as given by os.environ['PATH'] :type value: str :param sep: PATH separator, defaults to os.pathsep :type sep: str :param os_sep: OS filesy...
[ "Get", "enviroment", "PATH", "directories", "as", "list", "." ]
1612a930ef220fae507e1b152c531707e555bd92
https://github.com/ergoithz/browsepy/blob/1612a930ef220fae507e1b152c531707e555bd92/browsepy/compat.py#L201-L233
2,292
ergoithz/browsepy
browsepy/compat.py
pathconf
def pathconf(path, os_name=os.name, isdir_fnc=os.path.isdir, pathconf_fnc=getattr(os, 'pathconf', None), pathconf_names=getattr(os, 'pathconf_names', ())): ''' Get all pathconf variables for given path. :param path: absolute fs path :type path: str ...
python
def pathconf(path, os_name=os.name, isdir_fnc=os.path.isdir, pathconf_fnc=getattr(os, 'pathconf', None), pathconf_names=getattr(os, 'pathconf_names', ())): ''' Get all pathconf variables for given path. :param path: absolute fs path :type path: str ...
[ "def", "pathconf", "(", "path", ",", "os_name", "=", "os", ".", "name", ",", "isdir_fnc", "=", "os", ".", "path", ".", "isdir", ",", "pathconf_fnc", "=", "getattr", "(", "os", ",", "'pathconf'", ",", "None", ")", ",", "pathconf_names", "=", "getattr", ...
Get all pathconf variables for given path. :param path: absolute fs path :type path: str :returns: dictionary containing pathconf keys and their values (both str) :rtype: dict
[ "Get", "all", "pathconf", "variables", "for", "given", "path", "." ]
1612a930ef220fae507e1b152c531707e555bd92
https://github.com/ergoithz/browsepy/blob/1612a930ef220fae507e1b152c531707e555bd92/browsepy/compat.py#L236-L259
2,293
ergoithz/browsepy
browsepy/compat.py
which
def which(name, env_path=ENV_PATH, env_path_ext=ENV_PATHEXT, is_executable_fnc=isexec, path_join_fnc=os.path.join, os_name=os.name): ''' Get command absolute path. :param name: name of executable command :type name: str :param env_path: OS environme...
python
def which(name, env_path=ENV_PATH, env_path_ext=ENV_PATHEXT, is_executable_fnc=isexec, path_join_fnc=os.path.join, os_name=os.name): ''' Get command absolute path. :param name: name of executable command :type name: str :param env_path: OS environme...
[ "def", "which", "(", "name", ",", "env_path", "=", "ENV_PATH", ",", "env_path_ext", "=", "ENV_PATHEXT", ",", "is_executable_fnc", "=", "isexec", ",", "path_join_fnc", "=", "os", ".", "path", ".", "join", ",", "os_name", "=", "os", ".", "name", ")", ":", ...
Get command absolute path. :param name: name of executable command :type name: str :param env_path: OS environment executable paths, defaults to autodetected :type env_path: list of str :param is_executable_fnc: callable will be used to detect if path is executable, de...
[ "Get", "command", "absolute", "path", "." ]
1612a930ef220fae507e1b152c531707e555bd92
https://github.com/ergoithz/browsepy/blob/1612a930ef220fae507e1b152c531707e555bd92/browsepy/compat.py#L266-L294
2,294
ergoithz/browsepy
browsepy/compat.py
re_escape
def re_escape(pattern, chars=frozenset("()[]{}?*+|^$\\.-#")): ''' Escape all special regex characters in pattern. Logic taken from regex module. :param pattern: regex pattern to escape :type patterm: str :returns: escaped pattern :rtype: str ''' escape = '\\{}'.format return ''....
python
def re_escape(pattern, chars=frozenset("()[]{}?*+|^$\\.-#")): ''' Escape all special regex characters in pattern. Logic taken from regex module. :param pattern: regex pattern to escape :type patterm: str :returns: escaped pattern :rtype: str ''' escape = '\\{}'.format return ''....
[ "def", "re_escape", "(", "pattern", ",", "chars", "=", "frozenset", "(", "\"()[]{}?*+|^$\\\\.-#\"", ")", ")", ":", "escape", "=", "'\\\\{}'", ".", "format", "return", "''", ".", "join", "(", "escape", "(", "c", ")", "if", "c", "in", "chars", "or", "c",...
Escape all special regex characters in pattern. Logic taken from regex module. :param pattern: regex pattern to escape :type patterm: str :returns: escaped pattern :rtype: str
[ "Escape", "all", "special", "regex", "characters", "in", "pattern", ".", "Logic", "taken", "from", "regex", "module", "." ]
1612a930ef220fae507e1b152c531707e555bd92
https://github.com/ergoithz/browsepy/blob/1612a930ef220fae507e1b152c531707e555bd92/browsepy/compat.py#L297-L312
2,295
ergoithz/browsepy
browsepy/plugin/player/__init__.py
register_plugin
def register_plugin(manager): ''' Register blueprints and actions using given plugin manager. :param manager: plugin manager :type manager: browsepy.manager.PluginManager ''' manager.register_blueprint(player) manager.register_mimetype_function(detect_playable_mimetype) # add style tag...
python
def register_plugin(manager): ''' Register blueprints and actions using given plugin manager. :param manager: plugin manager :type manager: browsepy.manager.PluginManager ''' manager.register_blueprint(player) manager.register_mimetype_function(detect_playable_mimetype) # add style tag...
[ "def", "register_plugin", "(", "manager", ")", ":", "manager", ".", "register_blueprint", "(", "player", ")", "manager", ".", "register_mimetype_function", "(", "detect_playable_mimetype", ")", "# add style tag", "manager", ".", "register_widget", "(", "place", "=", ...
Register blueprints and actions using given plugin manager. :param manager: plugin manager :type manager: browsepy.manager.PluginManager
[ "Register", "blueprints", "and", "actions", "using", "given", "plugin", "manager", "." ]
1612a930ef220fae507e1b152c531707e555bd92
https://github.com/ergoithz/browsepy/blob/1612a930ef220fae507e1b152c531707e555bd92/browsepy/plugin/player/__init__.py#L93-L151
2,296
ergoithz/browsepy
browsepy/file.py
fmt_size
def fmt_size(size, binary=True): ''' Get size and unit. :param size: size in bytes :type size: int :param binary: whether use binary or standard units, defaults to True :type binary: bool :return: size and unit :rtype: tuple of int and unit as str ''' if binary: fmt_size...
python
def fmt_size(size, binary=True): ''' Get size and unit. :param size: size in bytes :type size: int :param binary: whether use binary or standard units, defaults to True :type binary: bool :return: size and unit :rtype: tuple of int and unit as str ''' if binary: fmt_size...
[ "def", "fmt_size", "(", "size", ",", "binary", "=", "True", ")", ":", "if", "binary", ":", "fmt_sizes", "=", "binary_units", "fmt_divider", "=", "1024.", "else", ":", "fmt_sizes", "=", "standard_units", "fmt_divider", "=", "1000.", "for", "fmt", "in", "fmt...
Get size and unit. :param size: size in bytes :type size: int :param binary: whether use binary or standard units, defaults to True :type binary: bool :return: size and unit :rtype: tuple of int and unit as str
[ "Get", "size", "and", "unit", "." ]
1612a930ef220fae507e1b152c531707e555bd92
https://github.com/ergoithz/browsepy/blob/1612a930ef220fae507e1b152c531707e555bd92/browsepy/file.py#L721-L742
2,297
ergoithz/browsepy
browsepy/file.py
relativize_path
def relativize_path(path, base, os_sep=os.sep): ''' Make absolute path relative to an absolute base. :param path: absolute path :type path: str :param base: absolute base path :type base: str :param os_sep: path component separator, defaults to current OS separator :type os_sep: str ...
python
def relativize_path(path, base, os_sep=os.sep): ''' Make absolute path relative to an absolute base. :param path: absolute path :type path: str :param base: absolute base path :type base: str :param os_sep: path component separator, defaults to current OS separator :type os_sep: str ...
[ "def", "relativize_path", "(", "path", ",", "base", ",", "os_sep", "=", "os", ".", "sep", ")", ":", "if", "not", "check_base", "(", "path", ",", "base", ",", "os_sep", ")", ":", "raise", "OutsideDirectoryBase", "(", "\"%r is not under %r\"", "%", "(", "p...
Make absolute path relative to an absolute base. :param path: absolute path :type path: str :param base: absolute base path :type base: str :param os_sep: path component separator, defaults to current OS separator :type os_sep: str :return: relative path :rtype: str or unicode :rais...
[ "Make", "absolute", "path", "relative", "to", "an", "absolute", "base", "." ]
1612a930ef220fae507e1b152c531707e555bd92
https://github.com/ergoithz/browsepy/blob/1612a930ef220fae507e1b152c531707e555bd92/browsepy/file.py#L745-L764
2,298
ergoithz/browsepy
browsepy/file.py
abspath_to_urlpath
def abspath_to_urlpath(path, base, os_sep=os.sep): ''' Make filesystem absolute path uri relative using given absolute base path. :param path: absolute path :param base: absolute base path :param os_sep: path component separator, defaults to current OS separator :return: relative uri :rtype...
python
def abspath_to_urlpath(path, base, os_sep=os.sep): ''' Make filesystem absolute path uri relative using given absolute base path. :param path: absolute path :param base: absolute base path :param os_sep: path component separator, defaults to current OS separator :return: relative uri :rtype...
[ "def", "abspath_to_urlpath", "(", "path", ",", "base", ",", "os_sep", "=", "os", ".", "sep", ")", ":", "return", "relativize_path", "(", "path", ",", "base", ",", "os_sep", ")", ".", "replace", "(", "os_sep", ",", "'/'", ")" ]
Make filesystem absolute path uri relative using given absolute base path. :param path: absolute path :param base: absolute base path :param os_sep: path component separator, defaults to current OS separator :return: relative uri :rtype: str or unicode :raises OutsideDirectoryBase: if resulting...
[ "Make", "filesystem", "absolute", "path", "uri", "relative", "using", "given", "absolute", "base", "path", "." ]
1612a930ef220fae507e1b152c531707e555bd92
https://github.com/ergoithz/browsepy/blob/1612a930ef220fae507e1b152c531707e555bd92/browsepy/file.py#L767-L778
2,299
ergoithz/browsepy
browsepy/file.py
urlpath_to_abspath
def urlpath_to_abspath(path, base, os_sep=os.sep): ''' Make uri relative path fs absolute using a given absolute base path. :param path: relative path :param base: absolute base path :param os_sep: path component separator, defaults to current OS separator :return: absolute path :rtype: str...
python
def urlpath_to_abspath(path, base, os_sep=os.sep): ''' Make uri relative path fs absolute using a given absolute base path. :param path: relative path :param base: absolute base path :param os_sep: path component separator, defaults to current OS separator :return: absolute path :rtype: str...
[ "def", "urlpath_to_abspath", "(", "path", ",", "base", ",", "os_sep", "=", "os", ".", "sep", ")", ":", "prefix", "=", "base", "if", "base", ".", "endswith", "(", "os_sep", ")", "else", "base", "+", "os_sep", "realpath", "=", "os", ".", "path", ".", ...
Make uri relative path fs absolute using a given absolute base path. :param path: relative path :param base: absolute base path :param os_sep: path component separator, defaults to current OS separator :return: absolute path :rtype: str or unicode :raises OutsideDirectoryBase: if resulting path...
[ "Make", "uri", "relative", "path", "fs", "absolute", "using", "a", "given", "absolute", "base", "path", "." ]
1612a930ef220fae507e1b152c531707e555bd92
https://github.com/ergoithz/browsepy/blob/1612a930ef220fae507e1b152c531707e555bd92/browsepy/file.py#L781-L796