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
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
41,800
erikvw/django-collect-offline-files
django_collect_offline_files/apps.py
AppConfig.make_required_folders
def make_required_folders(self): """Makes all folders declared in the config if they do not exist. """ for folder in [ self.pending_folder, self.usb_incoming_folder, self.outgoing_folder, self.incoming_folder, self.archive_folde...
python
def make_required_folders(self): """Makes all folders declared in the config if they do not exist. """ for folder in [ self.pending_folder, self.usb_incoming_folder, self.outgoing_folder, self.incoming_folder, self.archive_folde...
[ "def", "make_required_folders", "(", "self", ")", ":", "for", "folder", "in", "[", "self", ".", "pending_folder", ",", "self", ".", "usb_incoming_folder", ",", "self", ".", "outgoing_folder", ",", "self", ".", "incoming_folder", ",", "self", ".", "archive_fold...
Makes all folders declared in the config if they do not exist.
[ "Makes", "all", "folders", "declared", "in", "the", "config", "if", "they", "do", "not", "exist", "." ]
78f61c823ea3926eb88206b019b5dca3c36017da
https://github.com/erikvw/django-collect-offline-files/blob/78f61c823ea3926eb88206b019b5dca3c36017da/django_collect_offline_files/apps.py#L31-L45
41,801
dariusbakunas/rawdisk
rawdisk/plugins/filesystems/hfs_plus/hfs_plus_volume.py
HfsPlusVolume.load
def load(self, filename, offset): """Loads HFS+ volume information""" try: self.offset = offset self.fd = open(filename, 'rb') # 1024 - temporary, need to find out actual volume header size self.fd.seek(self.offset + VOLUME_HEADER_OFFSET) data ...
python
def load(self, filename, offset): """Loads HFS+ volume information""" try: self.offset = offset self.fd = open(filename, 'rb') # 1024 - temporary, need to find out actual volume header size self.fd.seek(self.offset + VOLUME_HEADER_OFFSET) data ...
[ "def", "load", "(", "self", ",", "filename", ",", "offset", ")", ":", "try", ":", "self", ".", "offset", "=", "offset", "self", ".", "fd", "=", "open", "(", "filename", ",", "'rb'", ")", "# 1024 - temporary, need to find out actual volume header size", "self",...
Loads HFS+ volume information
[ "Loads", "HFS", "+", "volume", "information" ]
1dc9d0b377fe5da3c406ccec4abc238c54167403
https://github.com/dariusbakunas/rawdisk/blob/1dc9d0b377fe5da3c406ccec4abc238c54167403/rawdisk/plugins/filesystems/hfs_plus/hfs_plus_volume.py#L42-L54
41,802
rossdylan/sham
sham/machine/__init__.py
VirtualMachine.get_interfaces
def get_interfaces(self): """ Return a list of sham.network.interfaces.NetworkInterface describing all the interfaces this VM has """ interfaces = self.xml.find('devices').iter('interface') iobjs = [] for interface in interfaces: _type = interface.attr...
python
def get_interfaces(self): """ Return a list of sham.network.interfaces.NetworkInterface describing all the interfaces this VM has """ interfaces = self.xml.find('devices').iter('interface') iobjs = [] for interface in interfaces: _type = interface.attr...
[ "def", "get_interfaces", "(", "self", ")", ":", "interfaces", "=", "self", ".", "xml", ".", "find", "(", "'devices'", ")", ".", "iter", "(", "'interface'", ")", "iobjs", "=", "[", "]", "for", "interface", "in", "interfaces", ":", "_type", "=", "interfa...
Return a list of sham.network.interfaces.NetworkInterface describing all the interfaces this VM has
[ "Return", "a", "list", "of", "sham", ".", "network", ".", "interfaces", ".", "NetworkInterface", "describing", "all", "the", "interfaces", "this", "VM", "has" ]
d938ae3da43814c3c45ae95b6116bd87282c8691
https://github.com/rossdylan/sham/blob/d938ae3da43814c3c45ae95b6116bd87282c8691/sham/machine/__init__.py#L51-L64
41,803
rossdylan/sham
sham/machine/__init__.py
VirtualMachine.get_disks
def get_disks(self): """ Return a list of all the Disks attached to this VM The disks are returned in a sham.storage.volumes.Volume object """ disks = [disk for disk in self.xml.iter('disk')] disk_objs = [] for disk in disks: source = disk.find...
python
def get_disks(self): """ Return a list of all the Disks attached to this VM The disks are returned in a sham.storage.volumes.Volume object """ disks = [disk for disk in self.xml.iter('disk')] disk_objs = [] for disk in disks: source = disk.find...
[ "def", "get_disks", "(", "self", ")", ":", "disks", "=", "[", "disk", "for", "disk", "in", "self", ".", "xml", ".", "iter", "(", "'disk'", ")", "]", "disk_objs", "=", "[", "]", "for", "disk", "in", "disks", ":", "source", "=", "disk", ".", "find"...
Return a list of all the Disks attached to this VM The disks are returned in a sham.storage.volumes.Volume object
[ "Return", "a", "list", "of", "all", "the", "Disks", "attached", "to", "this", "VM", "The", "disks", "are", "returned", "in", "a", "sham", ".", "storage", ".", "volumes", ".", "Volume", "object" ]
d938ae3da43814c3c45ae95b6116bd87282c8691
https://github.com/rossdylan/sham/blob/d938ae3da43814c3c45ae95b6116bd87282c8691/sham/machine/__init__.py#L66-L81
41,804
rossdylan/sham
sham/machine/__init__.py
VirtualMachine.delete
def delete(self): """ Delete this VM, and remove all its disks """ disks = self.get_disks() self.domain.undefine() for disk in disks: disk.wipe() disk.delete()
python
def delete(self): """ Delete this VM, and remove all its disks """ disks = self.get_disks() self.domain.undefine() for disk in disks: disk.wipe() disk.delete()
[ "def", "delete", "(", "self", ")", ":", "disks", "=", "self", ".", "get_disks", "(", ")", "self", ".", "domain", ".", "undefine", "(", ")", "for", "disk", "in", "disks", ":", "disk", ".", "wipe", "(", ")", "disk", ".", "delete", "(", ")" ]
Delete this VM, and remove all its disks
[ "Delete", "this", "VM", "and", "remove", "all", "its", "disks" ]
d938ae3da43814c3c45ae95b6116bd87282c8691
https://github.com/rossdylan/sham/blob/d938ae3da43814c3c45ae95b6116bd87282c8691/sham/machine/__init__.py#L83-L91
41,805
rossdylan/sham
sham/machine/__init__.py
VirtualMachine.to_dict
def to_dict(self): """ Return the values contained in this object as a dict """ return {'domain_type': self.domain_type, 'max_memory': self.max_memory, 'current_memory': self.current_memory, 'num_cpus': self.num_cpus, 'runni...
python
def to_dict(self): """ Return the values contained in this object as a dict """ return {'domain_type': self.domain_type, 'max_memory': self.max_memory, 'current_memory': self.current_memory, 'num_cpus': self.num_cpus, 'runni...
[ "def", "to_dict", "(", "self", ")", ":", "return", "{", "'domain_type'", ":", "self", ".", "domain_type", ",", "'max_memory'", ":", "self", ".", "max_memory", ",", "'current_memory'", ":", "self", ".", "current_memory", ",", "'num_cpus'", ":", "self", ".", ...
Return the values contained in this object as a dict
[ "Return", "the", "values", "contained", "in", "this", "object", "as", "a", "dict" ]
d938ae3da43814c3c45ae95b6116bd87282c8691
https://github.com/rossdylan/sham/blob/d938ae3da43814c3c45ae95b6116bd87282c8691/sham/machine/__init__.py#L125-L135
41,806
yougov/vr.common
vr/common/repo.py
guess_url_vcs
def guess_url_vcs(url): """ Given a url, try to guess what kind of VCS it's for. Return None if we can't make a good guess. """ parsed = urllib.parse.urlsplit(url) if parsed.scheme in ('git', 'svn'): return parsed.scheme elif parsed.path.endswith('.git'): return 'git' e...
python
def guess_url_vcs(url): """ Given a url, try to guess what kind of VCS it's for. Return None if we can't make a good guess. """ parsed = urllib.parse.urlsplit(url) if parsed.scheme in ('git', 'svn'): return parsed.scheme elif parsed.path.endswith('.git'): return 'git' e...
[ "def", "guess_url_vcs", "(", "url", ")", ":", "parsed", "=", "urllib", ".", "parse", ".", "urlsplit", "(", "url", ")", "if", "parsed", ".", "scheme", "in", "(", "'git'", ",", "'svn'", ")", ":", "return", "parsed", ".", "scheme", "elif", "parsed", "."...
Given a url, try to guess what kind of VCS it's for. Return None if we can't make a good guess.
[ "Given", "a", "url", "try", "to", "guess", "what", "kind", "of", "VCS", "it", "s", "for", ".", "Return", "None", "if", "we", "can", "t", "make", "a", "good", "guess", "." ]
ca8ed0c50ba873fc51fdfeeaa25d3b8ec1b54eb4
https://github.com/yougov/vr.common/blob/ca8ed0c50ba873fc51fdfeeaa25d3b8ec1b54eb4/vr/common/repo.py#L18-L39
41,807
yougov/vr.common
vr/common/repo.py
guess_folder_vcs
def guess_folder_vcs(folder): """ Given a path for a folder on the local filesystem, see what kind of vcs repo it is, if any. """ try: contents = os.listdir(folder) vcs_folders = ['.git', '.hg', '.svn'] found = next((x for x in vcs_folders if x in contents), None) # C...
python
def guess_folder_vcs(folder): """ Given a path for a folder on the local filesystem, see what kind of vcs repo it is, if any. """ try: contents = os.listdir(folder) vcs_folders = ['.git', '.hg', '.svn'] found = next((x for x in vcs_folders if x in contents), None) # C...
[ "def", "guess_folder_vcs", "(", "folder", ")", ":", "try", ":", "contents", "=", "os", ".", "listdir", "(", "folder", ")", "vcs_folders", "=", "[", "'.git'", ",", "'.hg'", ",", "'.svn'", "]", "found", "=", "next", "(", "(", "x", "for", "x", "in", "...
Given a path for a folder on the local filesystem, see what kind of vcs repo it is, if any.
[ "Given", "a", "path", "for", "a", "folder", "on", "the", "local", "filesystem", "see", "what", "kind", "of", "vcs", "repo", "it", "is", "if", "any", "." ]
ca8ed0c50ba873fc51fdfeeaa25d3b8ec1b54eb4
https://github.com/yougov/vr.common/blob/ca8ed0c50ba873fc51fdfeeaa25d3b8ec1b54eb4/vr/common/repo.py#L42-L54
41,808
yougov/vr.common
vr/common/repo.py
basename
def basename(url): """ Return the name of the folder that you'd get if you cloned 'url' into the current working directory. """ # It's easy to accidentally have whitespace on the beginning or end of the # url. url = url.strip() url, _sep, _fragment = url.partition('#') # Remove trai...
python
def basename(url): """ Return the name of the folder that you'd get if you cloned 'url' into the current working directory. """ # It's easy to accidentally have whitespace on the beginning or end of the # url. url = url.strip() url, _sep, _fragment = url.partition('#') # Remove trai...
[ "def", "basename", "(", "url", ")", ":", "# It's easy to accidentally have whitespace on the beginning or end of the", "# url.", "url", "=", "url", ".", "strip", "(", ")", "url", ",", "_sep", ",", "_fragment", "=", "url", ".", "partition", "(", "'#'", ")", "# Re...
Return the name of the folder that you'd get if you cloned 'url' into the current working directory.
[ "Return", "the", "name", "of", "the", "folder", "that", "you", "d", "get", "if", "you", "cloned", "url", "into", "the", "current", "working", "directory", "." ]
ca8ed0c50ba873fc51fdfeeaa25d3b8ec1b54eb4
https://github.com/yougov/vr.common/blob/ca8ed0c50ba873fc51fdfeeaa25d3b8ec1b54eb4/vr/common/repo.py#L169-L183
41,809
yougov/vr.common
vr/common/repo.py
Repo.get_url
def get_url(self): """ Assuming that the repo has been cloned locally, get its default upstream URL. """ cmd = { 'hg': 'hg paths default', 'git': 'git config --local --get remote.origin.url', }[self.vcs_type] with chdir(self.folder): ...
python
def get_url(self): """ Assuming that the repo has been cloned locally, get its default upstream URL. """ cmd = { 'hg': 'hg paths default', 'git': 'git config --local --get remote.origin.url', }[self.vcs_type] with chdir(self.folder): ...
[ "def", "get_url", "(", "self", ")", ":", "cmd", "=", "{", "'hg'", ":", "'hg paths default'", ",", "'git'", ":", "'git config --local --get remote.origin.url'", ",", "}", "[", "self", ".", "vcs_type", "]", "with", "chdir", "(", "self", ".", "folder", ")", "...
Assuming that the repo has been cloned locally, get its default upstream URL.
[ "Assuming", "that", "the", "repo", "has", "been", "cloned", "locally", "get", "its", "default", "upstream", "URL", "." ]
ca8ed0c50ba873fc51fdfeeaa25d3b8ec1b54eb4
https://github.com/yougov/vr.common/blob/ca8ed0c50ba873fc51fdfeeaa25d3b8ec1b54eb4/vr/common/repo.py#L90-L101
41,810
callowayproject/Calloway
calloway/apps/django_ext/templatetags/fb.py
fburl
def fburl(parser, token): """ Returns an absolute URL matching given view with its parameters. This is a way to define links that aren't tied to a particular URL configuration:: {% url path.to.some_view arg1,arg2,name1=value1 %} The first argument is a path to a view. It can be an absolut...
python
def fburl(parser, token): """ Returns an absolute URL matching given view with its parameters. This is a way to define links that aren't tied to a particular URL configuration:: {% url path.to.some_view arg1,arg2,name1=value1 %} The first argument is a path to a view. It can be an absolut...
[ "def", "fburl", "(", "parser", ",", "token", ")", ":", "bits", "=", "token", ".", "contents", ".", "split", "(", "' '", ")", "if", "len", "(", "bits", ")", "<", "2", ":", "raise", "template", ".", "TemplateSyntaxError", "(", "\"'%s' takes at least one ar...
Returns an absolute URL matching given view with its parameters. This is a way to define links that aren't tied to a particular URL configuration:: {% url path.to.some_view arg1,arg2,name1=value1 %} The first argument is a path to a view. It can be an absolute python path or just ``app_name.v...
[ "Returns", "an", "absolute", "URL", "matching", "given", "view", "with", "its", "parameters", "." ]
d22e98d41fbd298ab6393ba7bd84a75528be9f81
https://github.com/callowayproject/Calloway/blob/d22e98d41fbd298ab6393ba7bd84a75528be9f81/calloway/apps/django_ext/templatetags/fb.py#L43-L97
41,811
Jarn/jarn.mkrelease
jarn/mkrelease/chdir.py
chdir
def chdir(method): """Decorator executing method in directory 'dir'. """ def wrapper(self, dir, *args, **kw): dirstack = ChdirStack() dirstack.push(dir) try: return method(self, dir, *args, **kw) finally: dirstack.pop() return functools.wraps(meth...
python
def chdir(method): """Decorator executing method in directory 'dir'. """ def wrapper(self, dir, *args, **kw): dirstack = ChdirStack() dirstack.push(dir) try: return method(self, dir, *args, **kw) finally: dirstack.pop() return functools.wraps(meth...
[ "def", "chdir", "(", "method", ")", ":", "def", "wrapper", "(", "self", ",", "dir", ",", "*", "args", ",", "*", "*", "kw", ")", ":", "dirstack", "=", "ChdirStack", "(", ")", "dirstack", ".", "push", "(", "dir", ")", "try", ":", "return", "method"...
Decorator executing method in directory 'dir'.
[ "Decorator", "executing", "method", "in", "directory", "dir", "." ]
844377f37a3cdc0a154148790a926f991019ec4a
https://github.com/Jarn/jarn.mkrelease/blob/844377f37a3cdc0a154148790a926f991019ec4a/jarn/mkrelease/chdir.py#L27-L38
41,812
Jarn/jarn.mkrelease
jarn/mkrelease/chdir.py
ChdirStack.push
def push(self, dir): """Push cwd on stack and change to 'dir'. """ self.stack.append(os.getcwd()) os.chdir(dir or os.getcwd())
python
def push(self, dir): """Push cwd on stack and change to 'dir'. """ self.stack.append(os.getcwd()) os.chdir(dir or os.getcwd())
[ "def", "push", "(", "self", ",", "dir", ")", ":", "self", ".", "stack", ".", "append", "(", "os", ".", "getcwd", "(", ")", ")", "os", ".", "chdir", "(", "dir", "or", "os", ".", "getcwd", "(", ")", ")" ]
Push cwd on stack and change to 'dir'.
[ "Push", "cwd", "on", "stack", "and", "change", "to", "dir", "." ]
844377f37a3cdc0a154148790a926f991019ec4a
https://github.com/Jarn/jarn.mkrelease/blob/844377f37a3cdc0a154148790a926f991019ec4a/jarn/mkrelease/chdir.py#L14-L18
41,813
Jarn/jarn.mkrelease
jarn/mkrelease/chdir.py
ChdirStack.pop
def pop(self): """Pop dir off stack and change to it. """ if len(self.stack): os.chdir(self.stack.pop())
python
def pop(self): """Pop dir off stack and change to it. """ if len(self.stack): os.chdir(self.stack.pop())
[ "def", "pop", "(", "self", ")", ":", "if", "len", "(", "self", ".", "stack", ")", ":", "os", ".", "chdir", "(", "self", ".", "stack", ".", "pop", "(", ")", ")" ]
Pop dir off stack and change to it.
[ "Pop", "dir", "off", "stack", "and", "change", "to", "it", "." ]
844377f37a3cdc0a154148790a926f991019ec4a
https://github.com/Jarn/jarn.mkrelease/blob/844377f37a3cdc0a154148790a926f991019ec4a/jarn/mkrelease/chdir.py#L20-L24
41,814
helixyte/everest
everest/traversal.py
DataTraversalProxy.get_matching
def get_matching(self, source_id): """ Returns a matching target object for the given source ID. """ value = self._accessor.get_by_id(source_id) if not value is None: reg = get_current_registry() prx_fac = reg.getUtility(IDataTraversalProxyFactory) ...
python
def get_matching(self, source_id): """ Returns a matching target object for the given source ID. """ value = self._accessor.get_by_id(source_id) if not value is None: reg = get_current_registry() prx_fac = reg.getUtility(IDataTraversalProxyFactory) ...
[ "def", "get_matching", "(", "self", ",", "source_id", ")", ":", "value", "=", "self", ".", "_accessor", ".", "get_by_id", "(", "source_id", ")", "if", "not", "value", "is", "None", ":", "reg", "=", "get_current_registry", "(", ")", "prx_fac", "=", "reg",...
Returns a matching target object for the given source ID.
[ "Returns", "a", "matching", "target", "object", "for", "the", "given", "source", "ID", "." ]
70c9b93c3061db5cb62428349d18b8fb8566411b
https://github.com/helixyte/everest/blob/70c9b93c3061db5cb62428349d18b8fb8566411b/everest/traversal.py#L125-L139
41,815
helixyte/everest
everest/traversal.py
DataTraversalProxy.update_attribute_value_items
def update_attribute_value_items(self): """ Returns an iterator of items for an attribute value map to use for an UPDATE operation. The iterator ignores collection attributes as these are processed implicitly by the traversal algorithm. :returns: iterator yielding tuple...
python
def update_attribute_value_items(self): """ Returns an iterator of items for an attribute value map to use for an UPDATE operation. The iterator ignores collection attributes as these are processed implicitly by the traversal algorithm. :returns: iterator yielding tuple...
[ "def", "update_attribute_value_items", "(", "self", ")", ":", "for", "attr", "in", "self", ".", "_attribute_iterator", "(", ")", ":", "if", "attr", ".", "kind", "!=", "RESOURCE_ATTRIBUTE_KINDS", ".", "COLLECTION", ":", "try", ":", "attr_val", "=", "self", "....
Returns an iterator of items for an attribute value map to use for an UPDATE operation. The iterator ignores collection attributes as these are processed implicitly by the traversal algorithm. :returns: iterator yielding tuples with objects implementing :class:`everest.resour...
[ "Returns", "an", "iterator", "of", "items", "for", "an", "attribute", "value", "map", "to", "use", "for", "an", "UPDATE", "operation", "." ]
70c9b93c3061db5cb62428349d18b8fb8566411b
https://github.com/helixyte/everest/blob/70c9b93c3061db5cb62428349d18b8fb8566411b/everest/traversal.py#L142-L161
41,816
helixyte/everest
everest/traversal.py
ConvertingDataTraversalProxyMixin.get_entity
def get_entity(self): """ Returns the entity converted from the proxied data. """ if self._accessor is None: if self.__converted_entity is None: self.__converted_entity = self._convert_to_entity() else: # If we have an accessor, we can get ...
python
def get_entity(self): """ Returns the entity converted from the proxied data. """ if self._accessor is None: if self.__converted_entity is None: self.__converted_entity = self._convert_to_entity() else: # If we have an accessor, we can get ...
[ "def", "get_entity", "(", "self", ")", ":", "if", "self", ".", "_accessor", "is", "None", ":", "if", "self", ".", "__converted_entity", "is", "None", ":", "self", ".", "__converted_entity", "=", "self", ".", "_convert_to_entity", "(", ")", "else", ":", "...
Returns the entity converted from the proxied data.
[ "Returns", "the", "entity", "converted", "from", "the", "proxied", "data", "." ]
70c9b93c3061db5cb62428349d18b8fb8566411b
https://github.com/helixyte/everest/blob/70c9b93c3061db5cb62428349d18b8fb8566411b/everest/traversal.py#L350-L363
41,817
helixyte/everest
everest/traversal.py
SourceTargetDataTreeTraverser.make_traverser
def make_traverser(cls, source_data, target_data, relation_operation, accessor=None, manage_back_references=True): """ Factory method to create a tree traverser depending on the input source and target data combination. :param source_data: Source data. :pa...
python
def make_traverser(cls, source_data, target_data, relation_operation, accessor=None, manage_back_references=True): """ Factory method to create a tree traverser depending on the input source and target data combination. :param source_data: Source data. :pa...
[ "def", "make_traverser", "(", "cls", ",", "source_data", ",", "target_data", ",", "relation_operation", ",", "accessor", "=", "None", ",", "manage_back_references", "=", "True", ")", ":", "reg", "=", "get_current_registry", "(", ")", "prx_fac", "=", "reg", "."...
Factory method to create a tree traverser depending on the input source and target data combination. :param source_data: Source data. :param target_target: Target data. :param str relation_operation: Relation operation. On of the constants defined in :class:`everest.constants....
[ "Factory", "method", "to", "create", "a", "tree", "traverser", "depending", "on", "the", "input", "source", "and", "target", "data", "combination", "." ]
70c9b93c3061db5cb62428349d18b8fb8566411b
https://github.com/helixyte/everest/blob/70c9b93c3061db5cb62428349d18b8fb8566411b/everest/traversal.py#L408-L494
41,818
andy29485/embypy
embypy/emby.py
Emby.info
async def info(self, obj_id=None): '''Get info about object id |coro| Parameters ---------- obj_id : str, list if not provided, server info is retured(as a dict). Otherwise, an object with that id is returned (or objects if `obj_id` is a list). ''' if obj_id: try: ...
python
async def info(self, obj_id=None): '''Get info about object id |coro| Parameters ---------- obj_id : str, list if not provided, server info is retured(as a dict). Otherwise, an object with that id is returned (or objects if `obj_id` is a list). ''' if obj_id: try: ...
[ "async", "def", "info", "(", "self", ",", "obj_id", "=", "None", ")", ":", "if", "obj_id", ":", "try", ":", "return", "await", "self", ".", "process", "(", "obj_id", ")", "except", "JSONDecodeError", ":", "raise", "LookupError", "(", "'Error object with th...
Get info about object id |coro| Parameters ---------- obj_id : str, list if not provided, server info is retured(as a dict). Otherwise, an object with that id is returned (or objects if `obj_id` is a list).
[ "Get", "info", "about", "object", "id" ]
cde658d380965caaf4789d4d182d045b0346797b
https://github.com/andy29485/embypy/blob/cde658d380965caaf4789d4d182d045b0346797b/embypy/emby.py#L39-L57
41,819
andy29485/embypy
embypy/emby.py
Emby.search
async def search(self, query, sort_map = {'BoxSet':0,'Series':1,'Movie':2,'Audio':3,'Person':4}, strict_sort = False): '''Sends a search request to emby, returns results |coro| Parameters ---------- query : str the search string to send to emby sort_map : dict ...
python
async def search(self, query, sort_map = {'BoxSet':0,'Series':1,'Movie':2,'Audio':3,'Person':4}, strict_sort = False): '''Sends a search request to emby, returns results |coro| Parameters ---------- query : str the search string to send to emby sort_map : dict ...
[ "async", "def", "search", "(", "self", ",", "query", ",", "sort_map", "=", "{", "'BoxSet'", ":", "0", ",", "'Series'", ":", "1", ",", "'Movie'", ":", "2", ",", "'Audio'", ":", "3", ",", "'Person'", ":", "4", "}", ",", "strict_sort", "=", "False", ...
Sends a search request to emby, returns results |coro| Parameters ---------- query : str the search string to send to emby sort_map : dict is a dict of strings to ints. Strings should be item types, and the ints are the priority of those types(for sorting). lower valued(0) ...
[ "Sends", "a", "search", "request", "to", "emby", "returns", "results" ]
cde658d380965caaf4789d4d182d045b0346797b
https://github.com/andy29485/embypy/blob/cde658d380965caaf4789d4d182d045b0346797b/embypy/emby.py#L64-L101
41,820
andy29485/embypy
embypy/emby.py
Emby.nextUp
async def nextUp(self, userId=None): '''returns list of items marked as `next up` |coro| Parameters ---------- userId : str if provided, then the list returned is the one that that use will see. Returns ------- list the itmes that will appear as next up (for us...
python
async def nextUp(self, userId=None): '''returns list of items marked as `next up` |coro| Parameters ---------- userId : str if provided, then the list returned is the one that that use will see. Returns ------- list the itmes that will appear as next up (for us...
[ "async", "def", "nextUp", "(", "self", ",", "userId", "=", "None", ")", ":", "json", "=", "await", "self", ".", "connector", ".", "getJson", "(", "'/Shows/NextUp'", ",", "pass_uid", "=", "True", ",", "remote", "=", "False", ",", "userId", "=", "userId"...
returns list of items marked as `next up` |coro| Parameters ---------- userId : str if provided, then the list returned is the one that that use will see. Returns ------- list the itmes that will appear as next up (for user if id was given)
[ "returns", "list", "of", "items", "marked", "as", "next", "up" ]
cde658d380965caaf4789d4d182d045b0346797b
https://github.com/andy29485/embypy/blob/cde658d380965caaf4789d4d182d045b0346797b/embypy/emby.py#L137-L159
41,821
andy29485/embypy
embypy/emby.py
Emby.update
async def update(self): ''' reload all cached information |coro| Notes ----- This is a slow process, and will remove the cache before updating. Thus it is recomended to use the `*_force` properties, which will only update the cache after data is retrived. ''' keys = self.extras...
python
async def update(self): ''' reload all cached information |coro| Notes ----- This is a slow process, and will remove the cache before updating. Thus it is recomended to use the `*_force` properties, which will only update the cache after data is retrived. ''' keys = self.extras...
[ "async", "def", "update", "(", "self", ")", ":", "keys", "=", "self", ".", "extras", ".", "keys", "(", ")", "self", ".", "extras", "=", "{", "}", "for", "key", "in", "keys", ":", "try", ":", "func", "=", "getattr", "(", "self", ",", "key", ",",...
reload all cached information |coro| Notes ----- This is a slow process, and will remove the cache before updating. Thus it is recomended to use the `*_force` properties, which will only update the cache after data is retrived.
[ "reload", "all", "cached", "information" ]
cde658d380965caaf4789d4d182d045b0346797b
https://github.com/andy29485/embypy/blob/cde658d380965caaf4789d4d182d045b0346797b/embypy/emby.py#L165-L185
41,822
andy29485/embypy
embypy/emby.py
Emby.create_playlist
async def create_playlist(self, name, *songs): '''create a new playlist |coro| Parameters ---------- name : str name of new playlist songs : array_like list of song ids to add to playlist ''' data = {'Name': name} ids = [i.id for i in (await self.process(songs))] i...
python
async def create_playlist(self, name, *songs): '''create a new playlist |coro| Parameters ---------- name : str name of new playlist songs : array_like list of song ids to add to playlist ''' data = {'Name': name} ids = [i.id for i in (await self.process(songs))] i...
[ "async", "def", "create_playlist", "(", "self", ",", "name", ",", "*", "songs", ")", ":", "data", "=", "{", "'Name'", ":", "name", "}", "ids", "=", "[", "i", ".", "id", "for", "i", "in", "(", "await", "self", ".", "process", "(", "songs", ")", ...
create a new playlist |coro| Parameters ---------- name : str name of new playlist songs : array_like list of song ids to add to playlist
[ "create", "a", "new", "playlist" ]
cde658d380965caaf4789d4d182d045b0346797b
https://github.com/andy29485/embypy/blob/cde658d380965caaf4789d4d182d045b0346797b/embypy/emby.py#L190-L213
41,823
helixyte/everest
everest/plugins.py
PluginManager.load_all
def load_all(self, group): """ Loads all plugins advertising entry points with the given group name. The specified plugin needs to be a callable that accepts the everest configurator as single argument. """ for ep in iter_entry_points(group=group): plugin = ep...
python
def load_all(self, group): """ Loads all plugins advertising entry points with the given group name. The specified plugin needs to be a callable that accepts the everest configurator as single argument. """ for ep in iter_entry_points(group=group): plugin = ep...
[ "def", "load_all", "(", "self", ",", "group", ")", ":", "for", "ep", "in", "iter_entry_points", "(", "group", "=", "group", ")", ":", "plugin", "=", "ep", ".", "load", "(", ")", "plugin", "(", "self", ".", "__config", ")" ]
Loads all plugins advertising entry points with the given group name. The specified plugin needs to be a callable that accepts the everest configurator as single argument.
[ "Loads", "all", "plugins", "advertising", "entry", "points", "with", "the", "given", "group", "name", ".", "The", "specified", "plugin", "needs", "to", "be", "a", "callable", "that", "accepts", "the", "everest", "configurator", "as", "single", "argument", "." ...
70c9b93c3061db5cb62428349d18b8fb8566411b
https://github.com/helixyte/everest/blob/70c9b93c3061db5cb62428349d18b8fb8566411b/everest/plugins.py#L32-L40
41,824
ponty/confduino
confduino/examples/remove_libraries.py
gui
def gui(): """remove libraries by GUI.""" sel = psidialogs.multi_choice(libraries(), 'select libraries to remove from %s!' % libraries_dir(), title='remove boards') print('%s selected' % sel) if sel: if psidialogs.ask_yes_no('...
python
def gui(): """remove libraries by GUI.""" sel = psidialogs.multi_choice(libraries(), 'select libraries to remove from %s!' % libraries_dir(), title='remove boards') print('%s selected' % sel) if sel: if psidialogs.ask_yes_no('...
[ "def", "gui", "(", ")", ":", "sel", "=", "psidialogs", ".", "multi_choice", "(", "libraries", "(", ")", ",", "'select libraries to remove from %s!'", "%", "libraries_dir", "(", ")", ",", "title", "=", "'remove boards'", ")", "print", "(", "'%s selected'", "%",...
remove libraries by GUI.
[ "remove", "libraries", "by", "GUI", "." ]
f4c261e5e84997f145a8bdd001f471db74c9054b
https://github.com/ponty/confduino/blob/f4c261e5e84997f145a8bdd001f471db74c9054b/confduino/examples/remove_libraries.py#L8-L20
41,825
mamrhein/specification
specification/_extd_ast_expr.py
src2ast
def src2ast(src: str) -> Expression: """Return ast.Expression created from source code given in `src`.""" try: return ast.parse(src, mode='eval') except SyntaxError: raise ValueError("Not a valid expression.") from None
python
def src2ast(src: str) -> Expression: """Return ast.Expression created from source code given in `src`.""" try: return ast.parse(src, mode='eval') except SyntaxError: raise ValueError("Not a valid expression.") from None
[ "def", "src2ast", "(", "src", ":", "str", ")", "->", "Expression", ":", "try", ":", "return", "ast", ".", "parse", "(", "src", ",", "mode", "=", "'eval'", ")", "except", "SyntaxError", ":", "raise", "ValueError", "(", "\"Not a valid expression.\"", ")", ...
Return ast.Expression created from source code given in `src`.
[ "Return", "ast", ".", "Expression", "created", "from", "source", "code", "given", "in", "src", "." ]
a4c09a0d286cda7a04e8a189f12e23edd97f64ea
https://github.com/mamrhein/specification/blob/a4c09a0d286cda7a04e8a189f12e23edd97f64ea/specification/_extd_ast_expr.py#L533-L538
41,826
mamrhein/specification
specification/_extd_ast_expr.py
names
def names(expr: AST) -> Set[str]: """Names of globals in `expr`.""" nodes = [node for node in ast.walk(expr) if isinstance(node, ast.Name)] loaded = {node.id for node in nodes if isinstance(node.ctx, ast.Load)} stored = {node.id for node in nodes if isinstance(node.ctx, ast.Store)} return loaded - s...
python
def names(expr: AST) -> Set[str]: """Names of globals in `expr`.""" nodes = [node for node in ast.walk(expr) if isinstance(node, ast.Name)] loaded = {node.id for node in nodes if isinstance(node.ctx, ast.Load)} stored = {node.id for node in nodes if isinstance(node.ctx, ast.Store)} return loaded - s...
[ "def", "names", "(", "expr", ":", "AST", ")", "->", "Set", "[", "str", "]", ":", "nodes", "=", "[", "node", "for", "node", "in", "ast", ".", "walk", "(", "expr", ")", "if", "isinstance", "(", "node", ",", "ast", ".", "Name", ")", "]", "loaded",...
Names of globals in `expr`.
[ "Names", "of", "globals", "in", "expr", "." ]
a4c09a0d286cda7a04e8a189f12e23edd97f64ea
https://github.com/mamrhein/specification/blob/a4c09a0d286cda7a04e8a189f12e23edd97f64ea/specification/_extd_ast_expr.py#L546-L551
41,827
mamrhein/specification
specification/_extd_ast_expr.py
replace_name
def replace_name(expr: AST, old_name: str, new_name: str) -> AST: """Replace all Name nodes named `old_name` with nodes named `new_name`.""" return _NameReplacer(old_name, new_name).visit(deepcopy(expr))
python
def replace_name(expr: AST, old_name: str, new_name: str) -> AST: """Replace all Name nodes named `old_name` with nodes named `new_name`.""" return _NameReplacer(old_name, new_name).visit(deepcopy(expr))
[ "def", "replace_name", "(", "expr", ":", "AST", ",", "old_name", ":", "str", ",", "new_name", ":", "str", ")", "->", "AST", ":", "return", "_NameReplacer", "(", "old_name", ",", "new_name", ")", ".", "visit", "(", "deepcopy", "(", "expr", ")", ")" ]
Replace all Name nodes named `old_name` with nodes named `new_name`.
[ "Replace", "all", "Name", "nodes", "named", "old_name", "with", "nodes", "named", "new_name", "." ]
a4c09a0d286cda7a04e8a189f12e23edd97f64ea
https://github.com/mamrhein/specification/blob/a4c09a0d286cda7a04e8a189f12e23edd97f64ea/specification/_extd_ast_expr.py#L567-L569
41,828
mamrhein/specification
specification/_extd_ast_expr.py
Negation
def Negation(expr: Expression) -> Expression: """Return expression which is the negation of `expr`.""" expr = Expression(_negate(expr.body)) return ast.fix_missing_locations(expr)
python
def Negation(expr: Expression) -> Expression: """Return expression which is the negation of `expr`.""" expr = Expression(_negate(expr.body)) return ast.fix_missing_locations(expr)
[ "def", "Negation", "(", "expr", ":", "Expression", ")", "->", "Expression", ":", "expr", "=", "Expression", "(", "_negate", "(", "expr", ".", "body", ")", ")", "return", "ast", ".", "fix_missing_locations", "(", "expr", ")" ]
Return expression which is the negation of `expr`.
[ "Return", "expression", "which", "is", "the", "negation", "of", "expr", "." ]
a4c09a0d286cda7a04e8a189f12e23edd97f64ea
https://github.com/mamrhein/specification/blob/a4c09a0d286cda7a04e8a189f12e23edd97f64ea/specification/_extd_ast_expr.py#L615-L618
41,829
mamrhein/specification
specification/_extd_ast_expr.py
Conjunction
def Conjunction(expr1: Expression, expr2: Expression) -> Expression: """Return expression which is the conjunction of `expr1` and `expr2`.""" expr = Expression(ast.BoolOp(ast.And(), [expr1.body, expr2.body])) return ast.fix_missing_locations(expr)
python
def Conjunction(expr1: Expression, expr2: Expression) -> Expression: """Return expression which is the conjunction of `expr1` and `expr2`.""" expr = Expression(ast.BoolOp(ast.And(), [expr1.body, expr2.body])) return ast.fix_missing_locations(expr)
[ "def", "Conjunction", "(", "expr1", ":", "Expression", ",", "expr2", ":", "Expression", ")", "->", "Expression", ":", "expr", "=", "Expression", "(", "ast", ".", "BoolOp", "(", "ast", ".", "And", "(", ")", ",", "[", "expr1", ".", "body", ",", "expr2"...
Return expression which is the conjunction of `expr1` and `expr2`.
[ "Return", "expression", "which", "is", "the", "conjunction", "of", "expr1", "and", "expr2", "." ]
a4c09a0d286cda7a04e8a189f12e23edd97f64ea
https://github.com/mamrhein/specification/blob/a4c09a0d286cda7a04e8a189f12e23edd97f64ea/specification/_extd_ast_expr.py#L621-L624
41,830
mamrhein/specification
specification/_extd_ast_expr.py
Disjunction
def Disjunction(expr1: Expression, expr2: Expression) -> Expression: """Return expression which is the disjunction of `expr1` and `expr2`.""" expr = Expression(ast.BoolOp(ast.Or(), [expr1.body, expr2.body])) return ast.fix_missing_locations(expr)
python
def Disjunction(expr1: Expression, expr2: Expression) -> Expression: """Return expression which is the disjunction of `expr1` and `expr2`.""" expr = Expression(ast.BoolOp(ast.Or(), [expr1.body, expr2.body])) return ast.fix_missing_locations(expr)
[ "def", "Disjunction", "(", "expr1", ":", "Expression", ",", "expr2", ":", "Expression", ")", "->", "Expression", ":", "expr", "=", "Expression", "(", "ast", ".", "BoolOp", "(", "ast", ".", "Or", "(", ")", ",", "[", "expr1", ".", "body", ",", "expr2",...
Return expression which is the disjunction of `expr1` and `expr2`.
[ "Return", "expression", "which", "is", "the", "disjunction", "of", "expr1", "and", "expr2", "." ]
a4c09a0d286cda7a04e8a189f12e23edd97f64ea
https://github.com/mamrhein/specification/blob/a4c09a0d286cda7a04e8a189f12e23edd97f64ea/specification/_extd_ast_expr.py#L627-L630
41,831
mamrhein/specification
specification/_extd_ast_expr.py
Contradiction
def Contradiction(expr1: Expression, expr2: Expression) -> Expression: """Return expression which is the contradiction of `expr1` and `expr2`.""" expr = Disjunction(Conjunction(expr1, Negation(expr2)), Conjunction(Negation(expr1), expr2)) return ast.fix_missing_locations(expr)
python
def Contradiction(expr1: Expression, expr2: Expression) -> Expression: """Return expression which is the contradiction of `expr1` and `expr2`.""" expr = Disjunction(Conjunction(expr1, Negation(expr2)), Conjunction(Negation(expr1), expr2)) return ast.fix_missing_locations(expr)
[ "def", "Contradiction", "(", "expr1", ":", "Expression", ",", "expr2", ":", "Expression", ")", "->", "Expression", ":", "expr", "=", "Disjunction", "(", "Conjunction", "(", "expr1", ",", "Negation", "(", "expr2", ")", ")", ",", "Conjunction", "(", "Negatio...
Return expression which is the contradiction of `expr1` and `expr2`.
[ "Return", "expression", "which", "is", "the", "contradiction", "of", "expr1", "and", "expr2", "." ]
a4c09a0d286cda7a04e8a189f12e23edd97f64ea
https://github.com/mamrhein/specification/blob/a4c09a0d286cda7a04e8a189f12e23edd97f64ea/specification/_extd_ast_expr.py#L633-L637
41,832
mamrhein/specification
specification/_extd_ast_expr.py
OpBindingManager.diff_binding
def diff_binding(self) -> int: """Return the difference betweens the binding levels of the current and the previous operator. """ try: prev_op, prev_op_binding = self.nested_ops[-2] except IndexError: prev_op, prev_op_binding = None, 0 try: ...
python
def diff_binding(self) -> int: """Return the difference betweens the binding levels of the current and the previous operator. """ try: prev_op, prev_op_binding = self.nested_ops[-2] except IndexError: prev_op, prev_op_binding = None, 0 try: ...
[ "def", "diff_binding", "(", "self", ")", "->", "int", ":", "try", ":", "prev_op", ",", "prev_op_binding", "=", "self", ".", "nested_ops", "[", "-", "2", "]", "except", "IndexError", ":", "prev_op", ",", "prev_op_binding", "=", "None", ",", "0", "try", ...
Return the difference betweens the binding levels of the current and the previous operator.
[ "Return", "the", "difference", "betweens", "the", "binding", "levels", "of", "the", "current", "and", "the", "previous", "operator", "." ]
a4c09a0d286cda7a04e8a189f12e23edd97f64ea
https://github.com/mamrhein/specification/blob/a4c09a0d286cda7a04e8a189f12e23edd97f64ea/specification/_extd_ast_expr.py#L90-L106
41,833
mamrhein/specification
specification/_extd_ast_expr.py
SourceGenerator.wrap_expr
def wrap_expr(self, src: str, dfltChaining: bool) -> str: """Wrap `src` in parentheses if neccessary.""" diff_binding = self.op_man.diff_binding() if diff_binding < 0 or diff_binding == 0 and not dfltChaining: return self.parenthesize(src) else: return src
python
def wrap_expr(self, src: str, dfltChaining: bool) -> str: """Wrap `src` in parentheses if neccessary.""" diff_binding = self.op_man.diff_binding() if diff_binding < 0 or diff_binding == 0 and not dfltChaining: return self.parenthesize(src) else: return src
[ "def", "wrap_expr", "(", "self", ",", "src", ":", "str", ",", "dfltChaining", ":", "bool", ")", "->", "str", ":", "diff_binding", "=", "self", ".", "op_man", ".", "diff_binding", "(", ")", "if", "diff_binding", "<", "0", "or", "diff_binding", "==", "0"...
Wrap `src` in parentheses if neccessary.
[ "Wrap", "src", "in", "parentheses", "if", "neccessary", "." ]
a4c09a0d286cda7a04e8a189f12e23edd97f64ea
https://github.com/mamrhein/specification/blob/a4c09a0d286cda7a04e8a189f12e23edd97f64ea/specification/_extd_ast_expr.py#L124-L130
41,834
mamrhein/specification
specification/_extd_ast_expr.py
SourceGenerator.visit
def visit(self, node: AST, dfltChaining: bool = True) -> str: """Process `node` by dispatching to a handler.""" # print(node.__class__.__name__) if node is None: return '' if isinstance(node, ast.Expression): return self.visit(node.body) # dispatch to spec...
python
def visit(self, node: AST, dfltChaining: bool = True) -> str: """Process `node` by dispatching to a handler.""" # print(node.__class__.__name__) if node is None: return '' if isinstance(node, ast.Expression): return self.visit(node.body) # dispatch to spec...
[ "def", "visit", "(", "self", ",", "node", ":", "AST", ",", "dfltChaining", ":", "bool", "=", "True", ")", "->", "str", ":", "# print(node.__class__.__name__)", "if", "node", "is", "None", ":", "return", "''", "if", "isinstance", "(", "node", ",", "ast", ...
Process `node` by dispatching to a handler.
[ "Process", "node", "by", "dispatching", "to", "a", "handler", "." ]
a4c09a0d286cda7a04e8a189f12e23edd97f64ea
https://github.com/mamrhein/specification/blob/a4c09a0d286cda7a04e8a189f12e23edd97f64ea/specification/_extd_ast_expr.py#L134-L144
41,835
mamrhein/specification
specification/_extd_ast_expr.py
SourceGenerator.generic_visit
def generic_visit(self, node: AST, dfltChaining: bool = True) -> str: """Default handler, called if no explicit visitor function exists for a node. """ for field, value in ast.iter_fields(node): if isinstance(value, list): for item in value: ...
python
def generic_visit(self, node: AST, dfltChaining: bool = True) -> str: """Default handler, called if no explicit visitor function exists for a node. """ for field, value in ast.iter_fields(node): if isinstance(value, list): for item in value: ...
[ "def", "generic_visit", "(", "self", ",", "node", ":", "AST", ",", "dfltChaining", ":", "bool", "=", "True", ")", "->", "str", ":", "for", "field", ",", "value", "in", "ast", ".", "iter_fields", "(", "node", ")", ":", "if", "isinstance", "(", "value"...
Default handler, called if no explicit visitor function exists for a node.
[ "Default", "handler", "called", "if", "no", "explicit", "visitor", "function", "exists", "for", "a", "node", "." ]
a4c09a0d286cda7a04e8a189f12e23edd97f64ea
https://github.com/mamrhein/specification/blob/a4c09a0d286cda7a04e8a189f12e23edd97f64ea/specification/_extd_ast_expr.py#L146-L156
41,836
mamrhein/specification
specification/_extd_ast_expr.py
SourceGenerator.visit_NameConstant
def visit_NameConstant(self, node: AST, dfltChaining: bool = True) -> str: """Return `node`s name as string.""" return str(node.value)
python
def visit_NameConstant(self, node: AST, dfltChaining: bool = True) -> str: """Return `node`s name as string.""" return str(node.value)
[ "def", "visit_NameConstant", "(", "self", ",", "node", ":", "AST", ",", "dfltChaining", ":", "bool", "=", "True", ")", "->", "str", ":", "return", "str", "(", "node", ".", "value", ")" ]
Return `node`s name as string.
[ "Return", "node", "s", "name", "as", "string", "." ]
a4c09a0d286cda7a04e8a189f12e23edd97f64ea
https://github.com/mamrhein/specification/blob/a4c09a0d286cda7a04e8a189f12e23edd97f64ea/specification/_extd_ast_expr.py#L163-L165
41,837
mamrhein/specification
specification/_extd_ast_expr.py
SourceGenerator.visit_Num
def visit_Num(self, node: AST, dfltChaining: bool = True) -> str: """Return `node`s number as string.""" return str(node.n)
python
def visit_Num(self, node: AST, dfltChaining: bool = True) -> str: """Return `node`s number as string.""" return str(node.n)
[ "def", "visit_Num", "(", "self", ",", "node", ":", "AST", ",", "dfltChaining", ":", "bool", "=", "True", ")", "->", "str", ":", "return", "str", "(", "node", ".", "n", ")" ]
Return `node`s number as string.
[ "Return", "node", "s", "number", "as", "string", "." ]
a4c09a0d286cda7a04e8a189f12e23edd97f64ea
https://github.com/mamrhein/specification/blob/a4c09a0d286cda7a04e8a189f12e23edd97f64ea/specification/_extd_ast_expr.py#L167-L169
41,838
mamrhein/specification
specification/_extd_ast_expr.py
SourceGenerator.visit_Str
def visit_Str(self, node: AST, dfltChaining: bool = True) -> str: """Return `node`s string representation.""" return repr(node.s)
python
def visit_Str(self, node: AST, dfltChaining: bool = True) -> str: """Return `node`s string representation.""" return repr(node.s)
[ "def", "visit_Str", "(", "self", ",", "node", ":", "AST", ",", "dfltChaining", ":", "bool", "=", "True", ")", "->", "str", ":", "return", "repr", "(", "node", ".", "s", ")" ]
Return `node`s string representation.
[ "Return", "node", "s", "string", "representation", "." ]
a4c09a0d286cda7a04e8a189f12e23edd97f64ea
https://github.com/mamrhein/specification/blob/a4c09a0d286cda7a04e8a189f12e23edd97f64ea/specification/_extd_ast_expr.py#L171-L173
41,839
mamrhein/specification
specification/_extd_ast_expr.py
SourceGenerator.visit_FormattedValue
def visit_FormattedValue(self, node: AST, dfltChaining: bool = True) -> str: """Return `node`s value formatted according to its format spec.""" format_spec = node.format_spec return f"{{{self.visit(node.value)}" \ f"{self.CONV_MAP.get(node.conversion, ...
python
def visit_FormattedValue(self, node: AST, dfltChaining: bool = True) -> str: """Return `node`s value formatted according to its format spec.""" format_spec = node.format_spec return f"{{{self.visit(node.value)}" \ f"{self.CONV_MAP.get(node.conversion, ...
[ "def", "visit_FormattedValue", "(", "self", ",", "node", ":", "AST", ",", "dfltChaining", ":", "bool", "=", "True", ")", "->", "str", ":", "format_spec", "=", "node", ".", "format_spec", "return", "f\"{{{self.visit(node.value)}\"", "f\"{self.CONV_MAP.get(node.conver...
Return `node`s value formatted according to its format spec.
[ "Return", "node", "s", "value", "formatted", "according", "to", "its", "format", "spec", "." ]
a4c09a0d286cda7a04e8a189f12e23edd97f64ea
https://github.com/mamrhein/specification/blob/a4c09a0d286cda7a04e8a189f12e23edd97f64ea/specification/_extd_ast_expr.py#L177-L183
41,840
mamrhein/specification
specification/_extd_ast_expr.py
SourceGenerator.visit_Tuple
def visit_Tuple(self, node: AST, dfltChaining: bool = True) -> str: """Return tuple representation of `node`s elements.""" elems = (self.visit(elt) for elt in node.elts) return f"({', '.join(elems)}{')' if len(node.elts) != 1 else ',)'}"
python
def visit_Tuple(self, node: AST, dfltChaining: bool = True) -> str: """Return tuple representation of `node`s elements.""" elems = (self.visit(elt) for elt in node.elts) return f"({', '.join(elems)}{')' if len(node.elts) != 1 else ',)'}"
[ "def", "visit_Tuple", "(", "self", ",", "node", ":", "AST", ",", "dfltChaining", ":", "bool", "=", "True", ")", "->", "str", ":", "elems", "=", "(", "self", ".", "visit", "(", "elt", ")", "for", "elt", "in", "node", ".", "elts", ")", "return", "f...
Return tuple representation of `node`s elements.
[ "Return", "tuple", "representation", "of", "node", "s", "elements", "." ]
a4c09a0d286cda7a04e8a189f12e23edd97f64ea
https://github.com/mamrhein/specification/blob/a4c09a0d286cda7a04e8a189f12e23edd97f64ea/specification/_extd_ast_expr.py#L205-L208
41,841
mamrhein/specification
specification/_extd_ast_expr.py
SourceGenerator.visit_Set
def visit_Set(self, node: AST, dfltChaining: bool = True) -> str: """Return set representation of `node`s elements.""" return '{' + ', '.join([self.visit(elt) for elt in node.elts]) + '}'
python
def visit_Set(self, node: AST, dfltChaining: bool = True) -> str: """Return set representation of `node`s elements.""" return '{' + ', '.join([self.visit(elt) for elt in node.elts]) + '}'
[ "def", "visit_Set", "(", "self", ",", "node", ":", "AST", ",", "dfltChaining", ":", "bool", "=", "True", ")", "->", "str", ":", "return", "'{'", "+", "', '", ".", "join", "(", "[", "self", ".", "visit", "(", "elt", ")", "for", "elt", "in", "node"...
Return set representation of `node`s elements.
[ "Return", "set", "representation", "of", "node", "s", "elements", "." ]
a4c09a0d286cda7a04e8a189f12e23edd97f64ea
https://github.com/mamrhein/specification/blob/a4c09a0d286cda7a04e8a189f12e23edd97f64ea/specification/_extd_ast_expr.py#L210-L212
41,842
mamrhein/specification
specification/_extd_ast_expr.py
SourceGenerator.visit_Dict
def visit_Dict(self, node: AST, dfltChaining: bool = True) -> str: """Return dict representation of `node`s elements.""" items = (': '.join((self.visit(key), self.visit(value))) for key, value in zip(node.keys, node.values)) return f"{{{', '.join(items)}}}"
python
def visit_Dict(self, node: AST, dfltChaining: bool = True) -> str: """Return dict representation of `node`s elements.""" items = (': '.join((self.visit(key), self.visit(value))) for key, value in zip(node.keys, node.values)) return f"{{{', '.join(items)}}}"
[ "def", "visit_Dict", "(", "self", ",", "node", ":", "AST", ",", "dfltChaining", ":", "bool", "=", "True", ")", "->", "str", ":", "items", "=", "(", "': '", ".", "join", "(", "(", "self", ".", "visit", "(", "key", ")", ",", "self", ".", "visit", ...
Return dict representation of `node`s elements.
[ "Return", "dict", "representation", "of", "node", "s", "elements", "." ]
a4c09a0d286cda7a04e8a189f12e23edd97f64ea
https://github.com/mamrhein/specification/blob/a4c09a0d286cda7a04e8a189f12e23edd97f64ea/specification/_extd_ast_expr.py#L214-L218
41,843
mamrhein/specification
specification/_extd_ast_expr.py
SourceGenerator.visit_Name
def visit_Name(self, node: AST, dfltChaining: bool = True) -> str: """Return `node`s id.""" return node.id
python
def visit_Name(self, node: AST, dfltChaining: bool = True) -> str: """Return `node`s id.""" return node.id
[ "def", "visit_Name", "(", "self", ",", "node", ":", "AST", ",", "dfltChaining", ":", "bool", "=", "True", ")", "->", "str", ":", "return", "node", ".", "id" ]
Return `node`s id.
[ "Return", "node", "s", "id", "." ]
a4c09a0d286cda7a04e8a189f12e23edd97f64ea
https://github.com/mamrhein/specification/blob/a4c09a0d286cda7a04e8a189f12e23edd97f64ea/specification/_extd_ast_expr.py#L226-L228
41,844
mamrhein/specification
specification/_extd_ast_expr.py
SourceGenerator.visit_Starred
def visit_Starred(self, node: AST, dfltChaining: bool = True) -> str: """Return representation of starred expresssion.""" with self.op_man(node): return f"*{self.visit(node.value)}"
python
def visit_Starred(self, node: AST, dfltChaining: bool = True) -> str: """Return representation of starred expresssion.""" with self.op_man(node): return f"*{self.visit(node.value)}"
[ "def", "visit_Starred", "(", "self", ",", "node", ":", "AST", ",", "dfltChaining", ":", "bool", "=", "True", ")", "->", "str", ":", "with", "self", ".", "op_man", "(", "node", ")", ":", "return", "f\"*{self.visit(node.value)}\"" ]
Return representation of starred expresssion.
[ "Return", "representation", "of", "starred", "expresssion", "." ]
a4c09a0d286cda7a04e8a189f12e23edd97f64ea
https://github.com/mamrhein/specification/blob/a4c09a0d286cda7a04e8a189f12e23edd97f64ea/specification/_extd_ast_expr.py#L230-L233
41,845
mamrhein/specification
specification/_extd_ast_expr.py
SourceGenerator.visit_Expr
def visit_Expr(self, node: AST, dfltChaining: bool = True) -> str: """Return representation of nested expression.""" return self.visit(node.value)
python
def visit_Expr(self, node: AST, dfltChaining: bool = True) -> str: """Return representation of nested expression.""" return self.visit(node.value)
[ "def", "visit_Expr", "(", "self", ",", "node", ":", "AST", ",", "dfltChaining", ":", "bool", "=", "True", ")", "->", "str", ":", "return", "self", ".", "visit", "(", "node", ".", "value", ")" ]
Return representation of nested expression.
[ "Return", "representation", "of", "nested", "expression", "." ]
a4c09a0d286cda7a04e8a189f12e23edd97f64ea
https://github.com/mamrhein/specification/blob/a4c09a0d286cda7a04e8a189f12e23edd97f64ea/specification/_extd_ast_expr.py#L236-L238
41,846
mamrhein/specification
specification/_extd_ast_expr.py
SourceGenerator.visit_UnaryOp
def visit_UnaryOp(self, node: AST, dfltChaining: bool = True) -> str: """Return representation of `node`s operator and operand.""" op = node.op with self.op_man(op): return self.visit(op) + self.visit(node.operand)
python
def visit_UnaryOp(self, node: AST, dfltChaining: bool = True) -> str: """Return representation of `node`s operator and operand.""" op = node.op with self.op_man(op): return self.visit(op) + self.visit(node.operand)
[ "def", "visit_UnaryOp", "(", "self", ",", "node", ":", "AST", ",", "dfltChaining", ":", "bool", "=", "True", ")", "->", "str", ":", "op", "=", "node", ".", "op", "with", "self", ".", "op_man", "(", "op", ")", ":", "return", "self", ".", "visit", ...
Return representation of `node`s operator and operand.
[ "Return", "representation", "of", "node", "s", "operator", "and", "operand", "." ]
a4c09a0d286cda7a04e8a189f12e23edd97f64ea
https://github.com/mamrhein/specification/blob/a4c09a0d286cda7a04e8a189f12e23edd97f64ea/specification/_extd_ast_expr.py#L242-L246
41,847
mamrhein/specification
specification/_extd_ast_expr.py
SourceGenerator.visit_Div
def visit_Div(self, node: AST, dfltChaining: bool = True) -> str: """Return division sign.""" return '/' if self.compact else ' / '
python
def visit_Div(self, node: AST, dfltChaining: bool = True) -> str: """Return division sign.""" return '/' if self.compact else ' / '
[ "def", "visit_Div", "(", "self", ",", "node", ":", "AST", ",", "dfltChaining", ":", "bool", "=", "True", ")", "->", "str", ":", "return", "'/'", "if", "self", ".", "compact", "else", "' / '" ]
Return division sign.
[ "Return", "division", "sign", "." ]
a4c09a0d286cda7a04e8a189f12e23edd97f64ea
https://github.com/mamrhein/specification/blob/a4c09a0d286cda7a04e8a189f12e23edd97f64ea/specification/_extd_ast_expr.py#L293-L295
41,848
mamrhein/specification
specification/_extd_ast_expr.py
SourceGenerator.visit_Compare
def visit_Compare(self, node: AST, dfltChaining: bool = True) -> str: """Return `node`s operators and operands as inlined expression.""" # all comparison operators have the same precedence, # we just take the first one as representative first_op = node.ops[0] with self.op_man(fir...
python
def visit_Compare(self, node: AST, dfltChaining: bool = True) -> str: """Return `node`s operators and operands as inlined expression.""" # all comparison operators have the same precedence, # we just take the first one as representative first_op = node.ops[0] with self.op_man(fir...
[ "def", "visit_Compare", "(", "self", ",", "node", ":", "AST", ",", "dfltChaining", ":", "bool", "=", "True", ")", "->", "str", ":", "# all comparison operators have the same precedence,", "# we just take the first one as representative", "first_op", "=", "node", ".", ...
Return `node`s operators and operands as inlined expression.
[ "Return", "node", "s", "operators", "and", "operands", "as", "inlined", "expression", "." ]
a4c09a0d286cda7a04e8a189f12e23edd97f64ea
https://github.com/mamrhein/specification/blob/a4c09a0d286cda7a04e8a189f12e23edd97f64ea/specification/_extd_ast_expr.py#L350-L360
41,849
mamrhein/specification
specification/_extd_ast_expr.py
SourceGenerator.visit_keyword
def visit_keyword(self, node: AST, dfltChaining: bool = True) -> str: """Return representation of `node` as keyword arg.""" arg = node.arg if arg is None: return f"**{self.visit(node.value)}" else: return f"{arg}={self.visit(node.value)}"
python
def visit_keyword(self, node: AST, dfltChaining: bool = True) -> str: """Return representation of `node` as keyword arg.""" arg = node.arg if arg is None: return f"**{self.visit(node.value)}" else: return f"{arg}={self.visit(node.value)}"
[ "def", "visit_keyword", "(", "self", ",", "node", ":", "AST", ",", "dfltChaining", ":", "bool", "=", "True", ")", "->", "str", ":", "arg", "=", "node", ".", "arg", "if", "arg", "is", "None", ":", "return", "f\"**{self.visit(node.value)}\"", "else", ":", ...
Return representation of `node` as keyword arg.
[ "Return", "representation", "of", "node", "as", "keyword", "arg", "." ]
a4c09a0d286cda7a04e8a189f12e23edd97f64ea
https://github.com/mamrhein/specification/blob/a4c09a0d286cda7a04e8a189f12e23edd97f64ea/specification/_extd_ast_expr.py#L404-L410
41,850
mamrhein/specification
specification/_extd_ast_expr.py
SourceGenerator.visit_Call
def visit_Call(self, node: AST, dfltChaining: bool = True) -> str: """Return `node`s representation as function call.""" args = node.args try: kwds = node.keywords except AttributeError: kwds = [] self.compact = True args_src = (self.visit(arg) for...
python
def visit_Call(self, node: AST, dfltChaining: bool = True) -> str: """Return `node`s representation as function call.""" args = node.args try: kwds = node.keywords except AttributeError: kwds = [] self.compact = True args_src = (self.visit(arg) for...
[ "def", "visit_Call", "(", "self", ",", "node", ":", "AST", ",", "dfltChaining", ":", "bool", "=", "True", ")", "->", "str", ":", "args", "=", "node", ".", "args", "try", ":", "kwds", "=", "node", ".", "keywords", "except", "AttributeError", ":", "kwd...
Return `node`s representation as function call.
[ "Return", "node", "s", "representation", "as", "function", "call", "." ]
a4c09a0d286cda7a04e8a189f12e23edd97f64ea
https://github.com/mamrhein/specification/blob/a4c09a0d286cda7a04e8a189f12e23edd97f64ea/specification/_extd_ast_expr.py#L412-L425
41,851
mamrhein/specification
specification/_extd_ast_expr.py
SourceGenerator.visit_arguments
def visit_arguments(self, node: AST, dfltChaining: bool = True) -> str: """Return `node`s representation as argument list.""" args = node.args dflts = node.defaults vararg = node.vararg kwargs = node.kwonlyargs kwdflts = node.kw_defaults kwarg = node.kwarg ...
python
def visit_arguments(self, node: AST, dfltChaining: bool = True) -> str: """Return `node`s representation as argument list.""" args = node.args dflts = node.defaults vararg = node.vararg kwargs = node.kwonlyargs kwdflts = node.kw_defaults kwarg = node.kwarg ...
[ "def", "visit_arguments", "(", "self", ",", "node", ":", "AST", ",", "dfltChaining", ":", "bool", "=", "True", ")", "->", "str", ":", "args", "=", "node", ".", "args", "dflts", "=", "node", ".", "defaults", "vararg", "=", "node", ".", "vararg", "kwar...
Return `node`s representation as argument list.
[ "Return", "node", "s", "representation", "as", "argument", "list", "." ]
a4c09a0d286cda7a04e8a189f12e23edd97f64ea
https://github.com/mamrhein/specification/blob/a4c09a0d286cda7a04e8a189f12e23edd97f64ea/specification/_extd_ast_expr.py#L429-L450
41,852
mamrhein/specification
specification/_extd_ast_expr.py
SourceGenerator.visit_Lambda
def visit_Lambda(self, node: AST, dfltChaining: bool = True) -> str: """Return `node`s representation as lambda expression.""" with self.op_man(node): src = f"lambda {self.visit(node.args)}: {self.visit(node.body)}" return self.wrap_expr(src, dfltChaining)
python
def visit_Lambda(self, node: AST, dfltChaining: bool = True) -> str: """Return `node`s representation as lambda expression.""" with self.op_man(node): src = f"lambda {self.visit(node.args)}: {self.visit(node.body)}" return self.wrap_expr(src, dfltChaining)
[ "def", "visit_Lambda", "(", "self", ",", "node", ":", "AST", ",", "dfltChaining", ":", "bool", "=", "True", ")", "->", "str", ":", "with", "self", ".", "op_man", "(", "node", ")", ":", "src", "=", "f\"lambda {self.visit(node.args)}: {self.visit(node.body)}\"",...
Return `node`s representation as lambda expression.
[ "Return", "node", "s", "representation", "as", "lambda", "expression", "." ]
a4c09a0d286cda7a04e8a189f12e23edd97f64ea
https://github.com/mamrhein/specification/blob/a4c09a0d286cda7a04e8a189f12e23edd97f64ea/specification/_extd_ast_expr.py#L452-L456
41,853
mamrhein/specification
specification/_extd_ast_expr.py
SourceGenerator.visit_IfExp
def visit_IfExp(self, node: AST, dfltChaining: bool = True) -> str: """Return `node`s representation as ... if ... else ... expression.""" with self.op_man(node): src = " if ".join((self.visit(node.body, dfltChaining=False), " else ".join((self.visit(node.test)...
python
def visit_IfExp(self, node: AST, dfltChaining: bool = True) -> str: """Return `node`s representation as ... if ... else ... expression.""" with self.op_man(node): src = " if ".join((self.visit(node.body, dfltChaining=False), " else ".join((self.visit(node.test)...
[ "def", "visit_IfExp", "(", "self", ",", "node", ":", "AST", ",", "dfltChaining", ":", "bool", "=", "True", ")", "->", "str", ":", "with", "self", ".", "op_man", "(", "node", ")", ":", "src", "=", "\" if \"", ".", "join", "(", "(", "self", ".", "v...
Return `node`s representation as ... if ... else ... expression.
[ "Return", "node", "s", "representation", "as", "...", "if", "...", "else", "...", "expression", "." ]
a4c09a0d286cda7a04e8a189f12e23edd97f64ea
https://github.com/mamrhein/specification/blob/a4c09a0d286cda7a04e8a189f12e23edd97f64ea/specification/_extd_ast_expr.py#L460-L466
41,854
mamrhein/specification
specification/_extd_ast_expr.py
SourceGenerator.visit_Attribute
def visit_Attribute(self, node: AST, dfltChaining: bool = True) -> str: """Return `node`s representation as attribute access.""" return '.'.join((self.visit(node.value), node.attr))
python
def visit_Attribute(self, node: AST, dfltChaining: bool = True) -> str: """Return `node`s representation as attribute access.""" return '.'.join((self.visit(node.value), node.attr))
[ "def", "visit_Attribute", "(", "self", ",", "node", ":", "AST", ",", "dfltChaining", ":", "bool", "=", "True", ")", "->", "str", ":", "return", "'.'", ".", "join", "(", "(", "self", ".", "visit", "(", "node", ".", "value", ")", ",", "node", ".", ...
Return `node`s representation as attribute access.
[ "Return", "node", "s", "representation", "as", "attribute", "access", "." ]
a4c09a0d286cda7a04e8a189f12e23edd97f64ea
https://github.com/mamrhein/specification/blob/a4c09a0d286cda7a04e8a189f12e23edd97f64ea/specification/_extd_ast_expr.py#L470-L472
41,855
mamrhein/specification
specification/_extd_ast_expr.py
SourceGenerator.visit_Slice
def visit_Slice(self, node: AST, dfltChaining: bool = True) -> str: """Return `node`s representation as slice.""" elems = [self.visit(node.lower), self.visit(node.upper)] if node.step is not None: elems.append(self.visit(node.step)) return ':'.join(elems)
python
def visit_Slice(self, node: AST, dfltChaining: bool = True) -> str: """Return `node`s representation as slice.""" elems = [self.visit(node.lower), self.visit(node.upper)] if node.step is not None: elems.append(self.visit(node.step)) return ':'.join(elems)
[ "def", "visit_Slice", "(", "self", ",", "node", ":", "AST", ",", "dfltChaining", ":", "bool", "=", "True", ")", "->", "str", ":", "elems", "=", "[", "self", ".", "visit", "(", "node", ".", "lower", ")", ",", "self", ".", "visit", "(", "node", "."...
Return `node`s representation as slice.
[ "Return", "node", "s", "representation", "as", "slice", "." ]
a4c09a0d286cda7a04e8a189f12e23edd97f64ea
https://github.com/mamrhein/specification/blob/a4c09a0d286cda7a04e8a189f12e23edd97f64ea/specification/_extd_ast_expr.py#L484-L489
41,856
mamrhein/specification
specification/_extd_ast_expr.py
SourceGenerator.visit_ExtSlice
def visit_ExtSlice(self, node: AST, dfltChaining: bool = True) -> str: """Return `node`s representation as extended slice.""" return ', '.join((self.visit(dim) for dim in node.dims))
python
def visit_ExtSlice(self, node: AST, dfltChaining: bool = True) -> str: """Return `node`s representation as extended slice.""" return ', '.join((self.visit(dim) for dim in node.dims))
[ "def", "visit_ExtSlice", "(", "self", ",", "node", ":", "AST", ",", "dfltChaining", ":", "bool", "=", "True", ")", "->", "str", ":", "return", "', '", ".", "join", "(", "(", "self", ".", "visit", "(", "dim", ")", "for", "dim", "in", "node", ".", ...
Return `node`s representation as extended slice.
[ "Return", "node", "s", "representation", "as", "extended", "slice", "." ]
a4c09a0d286cda7a04e8a189f12e23edd97f64ea
https://github.com/mamrhein/specification/blob/a4c09a0d286cda7a04e8a189f12e23edd97f64ea/specification/_extd_ast_expr.py#L491-L493
41,857
mamrhein/specification
specification/_extd_ast_expr.py
SourceGenerator.visit_comprehension
def visit_comprehension(self, node: AST, dfltChaining: bool = True) -> str: """Return `node`s representation as comprehension.""" target = node.target try: elts = target.elts # we have a tuple of names except AttributeError: na...
python
def visit_comprehension(self, node: AST, dfltChaining: bool = True) -> str: """Return `node`s representation as comprehension.""" target = node.target try: elts = target.elts # we have a tuple of names except AttributeError: na...
[ "def", "visit_comprehension", "(", "self", ",", "node", ":", "AST", ",", "dfltChaining", ":", "bool", "=", "True", ")", "->", "str", ":", "target", "=", "node", ".", "target", "try", ":", "elts", "=", "target", ".", "elts", "# we have a tuple of names", ...
Return `node`s representation as comprehension.
[ "Return", "node", "s", "representation", "as", "comprehension", "." ]
a4c09a0d286cda7a04e8a189f12e23edd97f64ea
https://github.com/mamrhein/specification/blob/a4c09a0d286cda7a04e8a189f12e23edd97f64ea/specification/_extd_ast_expr.py#L497-L510
41,858
mamrhein/specification
specification/_extd_ast_expr.py
SourceGenerator.visit_ListComp
def visit_ListComp(self, node: AST, dfltChaining: bool = True) -> str: """Return `node`s representation as list comprehension.""" return f"[{self.visit(node.elt)} " \ f"{' '.join(self.visit(gen) for gen in node.generators)}]"
python
def visit_ListComp(self, node: AST, dfltChaining: bool = True) -> str: """Return `node`s representation as list comprehension.""" return f"[{self.visit(node.elt)} " \ f"{' '.join(self.visit(gen) for gen in node.generators)}]"
[ "def", "visit_ListComp", "(", "self", ",", "node", ":", "AST", ",", "dfltChaining", ":", "bool", "=", "True", ")", "->", "str", ":", "return", "f\"[{self.visit(node.elt)} \"", "f\"{' '.join(self.visit(gen) for gen in node.generators)}]\"" ]
Return `node`s representation as list comprehension.
[ "Return", "node", "s", "representation", "as", "list", "comprehension", "." ]
a4c09a0d286cda7a04e8a189f12e23edd97f64ea
https://github.com/mamrhein/specification/blob/a4c09a0d286cda7a04e8a189f12e23edd97f64ea/specification/_extd_ast_expr.py#L512-L515
41,859
mamrhein/specification
specification/_extd_ast_expr.py
SourceGenerator.visit_SetComp
def visit_SetComp(self, node: AST, dfltChaining: bool = True) -> str: """Return `node`s representation as set comprehension.""" return f"{{{self.visit(node.elt)} " \ f"{' '.join(self.visit(gen) for gen in node.generators)}}}"
python
def visit_SetComp(self, node: AST, dfltChaining: bool = True) -> str: """Return `node`s representation as set comprehension.""" return f"{{{self.visit(node.elt)} " \ f"{' '.join(self.visit(gen) for gen in node.generators)}}}"
[ "def", "visit_SetComp", "(", "self", ",", "node", ":", "AST", ",", "dfltChaining", ":", "bool", "=", "True", ")", "->", "str", ":", "return", "f\"{{{self.visit(node.elt)} \"", "f\"{' '.join(self.visit(gen) for gen in node.generators)}}}\"" ]
Return `node`s representation as set comprehension.
[ "Return", "node", "s", "representation", "as", "set", "comprehension", "." ]
a4c09a0d286cda7a04e8a189f12e23edd97f64ea
https://github.com/mamrhein/specification/blob/a4c09a0d286cda7a04e8a189f12e23edd97f64ea/specification/_extd_ast_expr.py#L517-L520
41,860
mamrhein/specification
specification/_extd_ast_expr.py
SourceGenerator.visit_DictComp
def visit_DictComp(self, node: AST, dfltChaining: bool = True) -> str: """Return `node`s representation as dict comprehension.""" return f"{{{self.visit(node.key)}: {self.visit(node.value)} " \ f"{' '.join(self.visit(gen) for gen in node.generators)}}}"
python
def visit_DictComp(self, node: AST, dfltChaining: bool = True) -> str: """Return `node`s representation as dict comprehension.""" return f"{{{self.visit(node.key)}: {self.visit(node.value)} " \ f"{' '.join(self.visit(gen) for gen in node.generators)}}}"
[ "def", "visit_DictComp", "(", "self", ",", "node", ":", "AST", ",", "dfltChaining", ":", "bool", "=", "True", ")", "->", "str", ":", "return", "f\"{{{self.visit(node.key)}: {self.visit(node.value)} \"", "f\"{' '.join(self.visit(gen) for gen in node.generators)}}}\"" ]
Return `node`s representation as dict comprehension.
[ "Return", "node", "s", "representation", "as", "dict", "comprehension", "." ]
a4c09a0d286cda7a04e8a189f12e23edd97f64ea
https://github.com/mamrhein/specification/blob/a4c09a0d286cda7a04e8a189f12e23edd97f64ea/specification/_extd_ast_expr.py#L522-L525
41,861
mamrhein/specification
specification/_extd_ast_expr.py
SourceGenerator.visit_GeneratorExp
def visit_GeneratorExp(self, node: AST, dfltChaining: bool = True) -> str: """Return `node`s representation as generator expression.""" return f"({self.visit(node.elt)} " \ f"{' '.join(self.visit(gen) for gen in node.generators)})"
python
def visit_GeneratorExp(self, node: AST, dfltChaining: bool = True) -> str: """Return `node`s representation as generator expression.""" return f"({self.visit(node.elt)} " \ f"{' '.join(self.visit(gen) for gen in node.generators)})"
[ "def", "visit_GeneratorExp", "(", "self", ",", "node", ":", "AST", ",", "dfltChaining", ":", "bool", "=", "True", ")", "->", "str", ":", "return", "f\"({self.visit(node.elt)} \"", "f\"{' '.join(self.visit(gen) for gen in node.generators)})\"" ]
Return `node`s representation as generator expression.
[ "Return", "node", "s", "representation", "as", "generator", "expression", "." ]
a4c09a0d286cda7a04e8a189f12e23edd97f64ea
https://github.com/mamrhein/specification/blob/a4c09a0d286cda7a04e8a189f12e23edd97f64ea/specification/_extd_ast_expr.py#L527-L530
41,862
SeattleTestbed/seash
pyreadline/lineeditor/lineobj.py
TextLine.visible_line_width
def visible_line_width(self, position = Point): """Return the visible width of the text in line buffer up to position.""" extra_char_width = len([ None for c in self[:position].line_buffer if 0x2013 <= ord(c) <= 0xFFFD]) return len(self[:position].quoted_text()) + self[:position].line_buffer....
python
def visible_line_width(self, position = Point): """Return the visible width of the text in line buffer up to position.""" extra_char_width = len([ None for c in self[:position].line_buffer if 0x2013 <= ord(c) <= 0xFFFD]) return len(self[:position].quoted_text()) + self[:position].line_buffer....
[ "def", "visible_line_width", "(", "self", ",", "position", "=", "Point", ")", ":", "extra_char_width", "=", "len", "(", "[", "None", "for", "c", "in", "self", "[", ":", "position", "]", ".", "line_buffer", "if", "0x2013", "<=", "ord", "(", "c", ")", ...
Return the visible width of the text in line buffer up to position.
[ "Return", "the", "visible", "width", "of", "the", "text", "in", "line", "buffer", "up", "to", "position", "." ]
40f9d2285662ff8b61e0468b4196acee089b273b
https://github.com/SeattleTestbed/seash/blob/40f9d2285662ff8b61e0468b4196acee089b273b/pyreadline/lineeditor/lineobj.py#L243-L246
41,863
Nekroze/partpy
setup.py
CleanUp.run
def run(self): """Run CleanUp.""" import fnmatch import shutil import glob matches = [] matches.extend(glob.glob('./*.pyc')) matches.extend(glob.glob('./*.pyd')) matches.extend(glob.glob('./*.pyo')) matches.extend(glob.glob('./*.so')) dirs ...
python
def run(self): """Run CleanUp.""" import fnmatch import shutil import glob matches = [] matches.extend(glob.glob('./*.pyc')) matches.extend(glob.glob('./*.pyd')) matches.extend(glob.glob('./*.pyo')) matches.extend(glob.glob('./*.so')) dirs ...
[ "def", "run", "(", "self", ")", ":", "import", "fnmatch", "import", "shutil", "import", "glob", "matches", "=", "[", "]", "matches", ".", "extend", "(", "glob", ".", "glob", "(", "'./*.pyc'", ")", ")", "matches", ".", "extend", "(", "glob", ".", "glo...
Run CleanUp.
[ "Run", "CleanUp", "." ]
dbb7d2fb285464fc43d85bc31f5af46192d301f6
https://github.com/Nekroze/partpy/blob/dbb7d2fb285464fc43d85bc31f5af46192d301f6/setup.py#L48-L81
41,864
Nekroze/partpy
setup.py
GitCommit.run
def run(self): """Run git add and commit with message if provided.""" if os.system('git add .'): sys.exit(1) if self.message is not None: os.system('git commit -a -m "' + self.message + '"') else: os.system('git commit -a')
python
def run(self): """Run git add and commit with message if provided.""" if os.system('git add .'): sys.exit(1) if self.message is not None: os.system('git commit -a -m "' + self.message + '"') else: os.system('git commit -a')
[ "def", "run", "(", "self", ")", ":", "if", "os", ".", "system", "(", "'git add .'", ")", ":", "sys", ".", "exit", "(", "1", ")", "if", "self", ".", "message", "is", "not", "None", ":", "os", ".", "system", "(", "'git commit -a -m \"'", "+", "self",...
Run git add and commit with message if provided.
[ "Run", "git", "add", "and", "commit", "with", "message", "if", "provided", "." ]
dbb7d2fb285464fc43d85bc31f5af46192d301f6
https://github.com/Nekroze/partpy/blob/dbb7d2fb285464fc43d85bc31f5af46192d301f6/setup.py#L156-L163
41,865
inveniosoftware-attic/invenio-documents
invenio_documents/api.py
Document.uri
def uri(self, value): """Set new uri value in record. It will not change the location of the underlying file! """ jsonpointer.set_pointer(self.record, self.pointer, value)
python
def uri(self, value): """Set new uri value in record. It will not change the location of the underlying file! """ jsonpointer.set_pointer(self.record, self.pointer, value)
[ "def", "uri", "(", "self", ",", "value", ")", ":", "jsonpointer", ".", "set_pointer", "(", "self", ".", "record", ",", "self", ".", "pointer", ",", "value", ")" ]
Set new uri value in record. It will not change the location of the underlying file!
[ "Set", "new", "uri", "value", "in", "record", "." ]
cdfcd21ea5d9ad26f4405f418863fcc3df636176
https://github.com/inveniosoftware-attic/invenio-documents/blob/cdfcd21ea5d9ad26f4405f418863fcc3df636176/invenio_documents/api.py#L48-L53
41,866
inveniosoftware-attic/invenio-documents
invenio_documents/api.py
Document.open
def open(self, mode='r', **kwargs): """Open file ``uri`` under the pointer.""" _fs, filename = opener.parse(self.uri) return _fs.open(filename, mode=mode, **kwargs)
python
def open(self, mode='r', **kwargs): """Open file ``uri`` under the pointer.""" _fs, filename = opener.parse(self.uri) return _fs.open(filename, mode=mode, **kwargs)
[ "def", "open", "(", "self", ",", "mode", "=", "'r'", ",", "*", "*", "kwargs", ")", ":", "_fs", ",", "filename", "=", "opener", ".", "parse", "(", "self", ".", "uri", ")", "return", "_fs", ".", "open", "(", "filename", ",", "mode", "=", "mode", ...
Open file ``uri`` under the pointer.
[ "Open", "file", "uri", "under", "the", "pointer", "." ]
cdfcd21ea5d9ad26f4405f418863fcc3df636176
https://github.com/inveniosoftware-attic/invenio-documents/blob/cdfcd21ea5d9ad26f4405f418863fcc3df636176/invenio_documents/api.py#L55-L58
41,867
inveniosoftware-attic/invenio-documents
invenio_documents/api.py
Document.move
def move(self, dst, **kwargs): """Move file to a new destination and update ``uri``.""" _fs, filename = opener.parse(self.uri) _fs_dst, filename_dst = opener.parse(dst) movefile(_fs, filename, _fs_dst, filename_dst, **kwargs) self.uri = dst
python
def move(self, dst, **kwargs): """Move file to a new destination and update ``uri``.""" _fs, filename = opener.parse(self.uri) _fs_dst, filename_dst = opener.parse(dst) movefile(_fs, filename, _fs_dst, filename_dst, **kwargs) self.uri = dst
[ "def", "move", "(", "self", ",", "dst", ",", "*", "*", "kwargs", ")", ":", "_fs", ",", "filename", "=", "opener", ".", "parse", "(", "self", ".", "uri", ")", "_fs_dst", ",", "filename_dst", "=", "opener", ".", "parse", "(", "dst", ")", "movefile", ...
Move file to a new destination and update ``uri``.
[ "Move", "file", "to", "a", "new", "destination", "and", "update", "uri", "." ]
cdfcd21ea5d9ad26f4405f418863fcc3df636176
https://github.com/inveniosoftware-attic/invenio-documents/blob/cdfcd21ea5d9ad26f4405f418863fcc3df636176/invenio_documents/api.py#L60-L65
41,868
inveniosoftware-attic/invenio-documents
invenio_documents/api.py
Document.setcontents
def setcontents(self, source, **kwargs): """Create a new file from a string or file-like object.""" if isinstance(source, six.string_types): _file = opener.open(source, 'rb') else: _file = source # signals.document_before_content_set.send(self) data = _f...
python
def setcontents(self, source, **kwargs): """Create a new file from a string or file-like object.""" if isinstance(source, six.string_types): _file = opener.open(source, 'rb') else: _file = source # signals.document_before_content_set.send(self) data = _f...
[ "def", "setcontents", "(", "self", ",", "source", ",", "*", "*", "kwargs", ")", ":", "if", "isinstance", "(", "source", ",", "six", ".", "string_types", ")", ":", "_file", "=", "opener", ".", "open", "(", "source", ",", "'rb'", ")", "else", ":", "_...
Create a new file from a string or file-like object.
[ "Create", "a", "new", "file", "from", "a", "string", "or", "file", "-", "like", "object", "." ]
cdfcd21ea5d9ad26f4405f418863fcc3df636176
https://github.com/inveniosoftware-attic/invenio-documents/blob/cdfcd21ea5d9ad26f4405f418863fcc3df636176/invenio_documents/api.py#L77-L94
41,869
inveniosoftware-attic/invenio-documents
invenio_documents/api.py
Document.remove
def remove(self, force=False): """Remove file reference from record. If force is True it removes the file from filesystem """ if force: _fs, filename = opener.parse(self.uri) _fs.remove(filename) self.uri = None
python
def remove(self, force=False): """Remove file reference from record. If force is True it removes the file from filesystem """ if force: _fs, filename = opener.parse(self.uri) _fs.remove(filename) self.uri = None
[ "def", "remove", "(", "self", ",", "force", "=", "False", ")", ":", "if", "force", ":", "_fs", ",", "filename", "=", "opener", ".", "parse", "(", "self", ".", "uri", ")", "_fs", ".", "remove", "(", "filename", ")", "self", ".", "uri", "=", "None"...
Remove file reference from record. If force is True it removes the file from filesystem
[ "Remove", "file", "reference", "from", "record", "." ]
cdfcd21ea5d9ad26f4405f418863fcc3df636176
https://github.com/inveniosoftware-attic/invenio-documents/blob/cdfcd21ea5d9ad26f4405f418863fcc3df636176/invenio_documents/api.py#L96-L104
41,870
BlackEarth/bxml
bxml/xml.py
XML.tobytes
def tobytes( self, root=None, encoding='UTF-8', doctype=None, canonicalized=True, xml_declaration=True, pretty_print=True, with_comments=True, ): """return the content of the XML document as a byte string suitable for writing""" ...
python
def tobytes( self, root=None, encoding='UTF-8', doctype=None, canonicalized=True, xml_declaration=True, pretty_print=True, with_comments=True, ): """return the content of the XML document as a byte string suitable for writing""" ...
[ "def", "tobytes", "(", "self", ",", "root", "=", "None", ",", "encoding", "=", "'UTF-8'", ",", "doctype", "=", "None", ",", "canonicalized", "=", "True", ",", "xml_declaration", "=", "True", ",", "pretty_print", "=", "True", ",", "with_comments", "=", "T...
return the content of the XML document as a byte string suitable for writing
[ "return", "the", "content", "of", "the", "XML", "document", "as", "a", "byte", "string", "suitable", "for", "writing" ]
8fbea5dad7fadc7b854ddbeff6ecfb55aaceeb77
https://github.com/BlackEarth/bxml/blob/8fbea5dad7fadc7b854ddbeff6ecfb55aaceeb77/bxml/xml.py#L176-L199
41,871
BlackEarth/bxml
bxml/xml.py
XML.tostring
def tostring(self, root=None, doctype=None, pretty_print=True): """return the content of the XML document as a unicode string""" if root is None: root = self.root return etree.tounicode( root, doctype=doctype or self.info.doctype, pretty_print=pretty_print )
python
def tostring(self, root=None, doctype=None, pretty_print=True): """return the content of the XML document as a unicode string""" if root is None: root = self.root return etree.tounicode( root, doctype=doctype or self.info.doctype, pretty_print=pretty_print )
[ "def", "tostring", "(", "self", ",", "root", "=", "None", ",", "doctype", "=", "None", ",", "pretty_print", "=", "True", ")", ":", "if", "root", "is", "None", ":", "root", "=", "self", ".", "root", "return", "etree", ".", "tounicode", "(", "root", ...
return the content of the XML document as a unicode string
[ "return", "the", "content", "of", "the", "XML", "document", "as", "a", "unicode", "string" ]
8fbea5dad7fadc7b854ddbeff6ecfb55aaceeb77
https://github.com/BlackEarth/bxml/blob/8fbea5dad7fadc7b854ddbeff6ecfb55aaceeb77/bxml/xml.py#L204-L210
41,872
BlackEarth/bxml
bxml/xml.py
XML.digest
def digest(self, **args): """calculate a digest based on the hash of the XML content""" return String(XML.canonicalized_string(self.root)).digest(**args)
python
def digest(self, **args): """calculate a digest based on the hash of the XML content""" return String(XML.canonicalized_string(self.root)).digest(**args)
[ "def", "digest", "(", "self", ",", "*", "*", "args", ")", ":", "return", "String", "(", "XML", ".", "canonicalized_string", "(", "self", ".", "root", ")", ")", ".", "digest", "(", "*", "*", "args", ")" ]
calculate a digest based on the hash of the XML content
[ "calculate", "a", "digest", "based", "on", "the", "hash", "of", "the", "XML", "content" ]
8fbea5dad7fadc7b854ddbeff6ecfb55aaceeb77
https://github.com/BlackEarth/bxml/blob/8fbea5dad7fadc7b854ddbeff6ecfb55aaceeb77/bxml/xml.py#L218-L220
41,873
BlackEarth/bxml
bxml/xml.py
XML.element
def element(self, tag_path, test=None, **attributes): """given a tag in xpath form and optional attributes, find the element in self.root or return a new one.""" xpath = tag_path tests = ["@%s='%s'" % (k, attributes[k]) for k in attributes] if test is not None: tests.ins...
python
def element(self, tag_path, test=None, **attributes): """given a tag in xpath form and optional attributes, find the element in self.root or return a new one.""" xpath = tag_path tests = ["@%s='%s'" % (k, attributes[k]) for k in attributes] if test is not None: tests.ins...
[ "def", "element", "(", "self", ",", "tag_path", ",", "test", "=", "None", ",", "*", "*", "attributes", ")", ":", "xpath", "=", "tag_path", "tests", "=", "[", "\"@%s='%s'\"", "%", "(", "k", ",", "attributes", "[", "k", "]", ")", "for", "k", "in", ...
given a tag in xpath form and optional attributes, find the element in self.root or return a new one.
[ "given", "a", "tag", "in", "xpath", "form", "and", "optional", "attributes", "find", "the", "element", "in", "self", ".", "root", "or", "return", "a", "new", "one", "." ]
8fbea5dad7fadc7b854ddbeff6ecfb55aaceeb77
https://github.com/BlackEarth/bxml/blob/8fbea5dad7fadc7b854ddbeff6ecfb55aaceeb77/bxml/xml.py#L243-L259
41,874
BlackEarth/bxml
bxml/xml.py
XML.namespace
def namespace(self, elem=None): """return the URL, if any, for the doc root or elem, if given.""" if elem is None: elem = self.root return XML.tag_namespace(elem.tag)
python
def namespace(self, elem=None): """return the URL, if any, for the doc root or elem, if given.""" if elem is None: elem = self.root return XML.tag_namespace(elem.tag)
[ "def", "namespace", "(", "self", ",", "elem", "=", "None", ")", ":", "if", "elem", "is", "None", ":", "elem", "=", "self", ".", "root", "return", "XML", ".", "tag_namespace", "(", "elem", ".", "tag", ")" ]
return the URL, if any, for the doc root or elem, if given.
[ "return", "the", "URL", "if", "any", "for", "the", "doc", "root", "or", "elem", "if", "given", "." ]
8fbea5dad7fadc7b854ddbeff6ecfb55aaceeb77
https://github.com/BlackEarth/bxml/blob/8fbea5dad7fadc7b854ddbeff6ecfb55aaceeb77/bxml/xml.py#L462-L466
41,875
BlackEarth/bxml
bxml/xml.py
XML.tag_namespace
def tag_namespace(cls, tag): """return the namespace for a given tag, or '' if no namespace given""" md = re.match("^(?:\{([^\}]*)\})", tag) if md is not None: return md.group(1)
python
def tag_namespace(cls, tag): """return the namespace for a given tag, or '' if no namespace given""" md = re.match("^(?:\{([^\}]*)\})", tag) if md is not None: return md.group(1)
[ "def", "tag_namespace", "(", "cls", ",", "tag", ")", ":", "md", "=", "re", ".", "match", "(", "\"^(?:\\{([^\\}]*)\\})\"", ",", "tag", ")", "if", "md", "is", "not", "None", ":", "return", "md", ".", "group", "(", "1", ")" ]
return the namespace for a given tag, or '' if no namespace given
[ "return", "the", "namespace", "for", "a", "given", "tag", "or", "if", "no", "namespace", "given" ]
8fbea5dad7fadc7b854ddbeff6ecfb55aaceeb77
https://github.com/BlackEarth/bxml/blob/8fbea5dad7fadc7b854ddbeff6ecfb55aaceeb77/bxml/xml.py#L469-L473
41,876
BlackEarth/bxml
bxml/xml.py
XML.tag_name
def tag_name(cls, tag): """return the name of the tag, with the namespace removed""" while isinstance(tag, etree._Element): tag = tag.tag return tag.split('}')[-1]
python
def tag_name(cls, tag): """return the name of the tag, with the namespace removed""" while isinstance(tag, etree._Element): tag = tag.tag return tag.split('}')[-1]
[ "def", "tag_name", "(", "cls", ",", "tag", ")", ":", "while", "isinstance", "(", "tag", ",", "etree", ".", "_Element", ")", ":", "tag", "=", "tag", ".", "tag", "return", "tag", ".", "split", "(", "'}'", ")", "[", "-", "1", "]" ]
return the name of the tag, with the namespace removed
[ "return", "the", "name", "of", "the", "tag", "with", "the", "namespace", "removed" ]
8fbea5dad7fadc7b854ddbeff6ecfb55aaceeb77
https://github.com/BlackEarth/bxml/blob/8fbea5dad7fadc7b854ddbeff6ecfb55aaceeb77/bxml/xml.py#L476-L480
41,877
BlackEarth/bxml
bxml/xml.py
XML.element_map
def element_map( self, tags=None, xpath="//*", exclude_attribs=[], include_attribs=[], attrib_vals=False, hierarchy=False, minimize=False, ): """return a dict of element tags, their attribute names, and optionally attribute values, ...
python
def element_map( self, tags=None, xpath="//*", exclude_attribs=[], include_attribs=[], attrib_vals=False, hierarchy=False, minimize=False, ): """return a dict of element tags, their attribute names, and optionally attribute values, ...
[ "def", "element_map", "(", "self", ",", "tags", "=", "None", ",", "xpath", "=", "\"//*\"", ",", "exclude_attribs", "=", "[", "]", ",", "include_attribs", "=", "[", "]", ",", "attrib_vals", "=", "False", ",", "hierarchy", "=", "False", ",", "minimize", ...
return a dict of element tags, their attribute names, and optionally attribute values, in the XML document
[ "return", "a", "dict", "of", "element", "tags", "their", "attribute", "names", "and", "optionally", "attribute", "values", "in", "the", "XML", "document" ]
8fbea5dad7fadc7b854ddbeff6ecfb55aaceeb77
https://github.com/BlackEarth/bxml/blob/8fbea5dad7fadc7b854ddbeff6ecfb55aaceeb77/bxml/xml.py#L505-L552
41,878
BlackEarth/bxml
bxml/xml.py
XML.dict_key_tag
def dict_key_tag(Class, key, namespaces=None): """convert a dict key into an element or attribute name""" namespaces = namespaces or Class.NS ns = Class.tag_namespace(key) tag = Class.tag_name(key) if ns is None and ':' in key: prefix, tag = key.split(':') ...
python
def dict_key_tag(Class, key, namespaces=None): """convert a dict key into an element or attribute name""" namespaces = namespaces or Class.NS ns = Class.tag_namespace(key) tag = Class.tag_name(key) if ns is None and ':' in key: prefix, tag = key.split(':') ...
[ "def", "dict_key_tag", "(", "Class", ",", "key", ",", "namespaces", "=", "None", ")", ":", "namespaces", "=", "namespaces", "or", "Class", ".", "NS", "ns", "=", "Class", ".", "tag_namespace", "(", "key", ")", "tag", "=", "Class", ".", "tag_name", "(", ...
convert a dict key into an element or attribute name
[ "convert", "a", "dict", "key", "into", "an", "element", "or", "attribute", "name" ]
8fbea5dad7fadc7b854ddbeff6ecfb55aaceeb77
https://github.com/BlackEarth/bxml/blob/8fbea5dad7fadc7b854ddbeff6ecfb55aaceeb77/bxml/xml.py#L616-L627
41,879
BlackEarth/bxml
bxml/xml.py
XML.replace_with_contents
def replace_with_contents(c, elem): "removes an element and leaves its contents in its place. Namespaces supported." parent = elem.getparent() index = parent.index(elem) children = elem.getchildren() previous = elem.getprevious() # text if index == 0: ...
python
def replace_with_contents(c, elem): "removes an element and leaves its contents in its place. Namespaces supported." parent = elem.getparent() index = parent.index(elem) children = elem.getchildren() previous = elem.getprevious() # text if index == 0: ...
[ "def", "replace_with_contents", "(", "c", ",", "elem", ")", ":", "parent", "=", "elem", ".", "getparent", "(", ")", "index", "=", "parent", ".", "index", "(", "elem", ")", "children", "=", "elem", ".", "getchildren", "(", ")", "previous", "=", "elem", ...
removes an element and leaves its contents in its place. Namespaces supported.
[ "removes", "an", "element", "and", "leaves", "its", "contents", "in", "its", "place", ".", "Namespaces", "supported", "." ]
8fbea5dad7fadc7b854ddbeff6ecfb55aaceeb77
https://github.com/BlackEarth/bxml/blob/8fbea5dad7fadc7b854ddbeff6ecfb55aaceeb77/bxml/xml.py#L685-L709
41,880
BlackEarth/bxml
bxml/xml.py
XML.remove_range
def remove_range(cls, elem, end_elem, delete_end=True): """delete everything from elem to end_elem, including elem. if delete_end==True, also including end_elem; otherwise, leave it.""" while elem is not None and elem != end_elem and end_elem not in elem.xpath("descendant::*"): p...
python
def remove_range(cls, elem, end_elem, delete_end=True): """delete everything from elem to end_elem, including elem. if delete_end==True, also including end_elem; otherwise, leave it.""" while elem is not None and elem != end_elem and end_elem not in elem.xpath("descendant::*"): p...
[ "def", "remove_range", "(", "cls", ",", "elem", ",", "end_elem", ",", "delete_end", "=", "True", ")", ":", "while", "elem", "is", "not", "None", "and", "elem", "!=", "end_elem", "and", "end_elem", "not", "in", "elem", ".", "xpath", "(", "\"descendant::*\...
delete everything from elem to end_elem, including elem. if delete_end==True, also including end_elem; otherwise, leave it.
[ "delete", "everything", "from", "elem", "to", "end_elem", "including", "elem", ".", "if", "delete_end", "==", "True", "also", "including", "end_elem", ";", "otherwise", "leave", "it", "." ]
8fbea5dad7fadc7b854ddbeff6ecfb55aaceeb77
https://github.com/BlackEarth/bxml/blob/8fbea5dad7fadc7b854ddbeff6ecfb55aaceeb77/bxml/xml.py#L723-L748
41,881
BlackEarth/bxml
bxml/xml.py
XML.wrap_content
def wrap_content(cls, container, wrapper): "wrap the content of container element with wrapper element" wrapper.text = (container.text or '') + (wrapper.text or '') container.text = '' for ch in container: wrapper.append(ch) container.insert(0, wrapper) ...
python
def wrap_content(cls, container, wrapper): "wrap the content of container element with wrapper element" wrapper.text = (container.text or '') + (wrapper.text or '') container.text = '' for ch in container: wrapper.append(ch) container.insert(0, wrapper) ...
[ "def", "wrap_content", "(", "cls", ",", "container", ",", "wrapper", ")", ":", "wrapper", ".", "text", "=", "(", "container", ".", "text", "or", "''", ")", "+", "(", "wrapper", ".", "text", "or", "''", ")", "container", ".", "text", "=", "''", "for...
wrap the content of container element with wrapper element
[ "wrap", "the", "content", "of", "container", "element", "with", "wrapper", "element" ]
8fbea5dad7fadc7b854ddbeff6ecfb55aaceeb77
https://github.com/BlackEarth/bxml/blob/8fbea5dad7fadc7b854ddbeff6ecfb55aaceeb77/bxml/xml.py#L751-L758
41,882
BlackEarth/bxml
bxml/xml.py
XML.merge_contiguous
def merge_contiguous(C, node, xpath, namespaces=None): """Within a given node, merge elements that are next to each other if they have the same tag and attributes. """ new_node = deepcopy(node) elems = XML.xpath(new_node, xpath, namespaces=namespaces) elems.reverse...
python
def merge_contiguous(C, node, xpath, namespaces=None): """Within a given node, merge elements that are next to each other if they have the same tag and attributes. """ new_node = deepcopy(node) elems = XML.xpath(new_node, xpath, namespaces=namespaces) elems.reverse...
[ "def", "merge_contiguous", "(", "C", ",", "node", ",", "xpath", ",", "namespaces", "=", "None", ")", ":", "new_node", "=", "deepcopy", "(", "node", ")", "elems", "=", "XML", ".", "xpath", "(", "new_node", ",", "xpath", ",", "namespaces", "=", "namespac...
Within a given node, merge elements that are next to each other if they have the same tag and attributes.
[ "Within", "a", "given", "node", "merge", "elements", "that", "are", "next", "to", "each", "other", "if", "they", "have", "the", "same", "tag", "and", "attributes", "." ]
8fbea5dad7fadc7b854ddbeff6ecfb55aaceeb77
https://github.com/BlackEarth/bxml/blob/8fbea5dad7fadc7b854ddbeff6ecfb55aaceeb77/bxml/xml.py#L779-L808
41,883
BlackEarth/bxml
bxml/xml.py
XML.unnest
def unnest(c, elem, ignore_whitespace=False): """unnest the element from its parent within doc. MUTABLE CHANGES""" parent = elem.getparent() gparent = parent.getparent() index = parent.index(elem) # put everything up to elem into a new parent element right before the current...
python
def unnest(c, elem, ignore_whitespace=False): """unnest the element from its parent within doc. MUTABLE CHANGES""" parent = elem.getparent() gparent = parent.getparent() index = parent.index(elem) # put everything up to elem into a new parent element right before the current...
[ "def", "unnest", "(", "c", ",", "elem", ",", "ignore_whitespace", "=", "False", ")", ":", "parent", "=", "elem", ".", "getparent", "(", ")", "gparent", "=", "parent", ".", "getparent", "(", ")", "index", "=", "parent", ".", "index", "(", "elem", ")",...
unnest the element from its parent within doc. MUTABLE CHANGES
[ "unnest", "the", "element", "from", "its", "parent", "within", "doc", ".", "MUTABLE", "CHANGES" ]
8fbea5dad7fadc7b854ddbeff6ecfb55aaceeb77
https://github.com/BlackEarth/bxml/blob/8fbea5dad7fadc7b854ddbeff6ecfb55aaceeb77/bxml/xml.py#L813-L833
41,884
BlackEarth/bxml
bxml/xml.py
XML.interior_nesting
def interior_nesting(cls, elem1, xpath, namespaces=None): """for elem1 containing elements at xpath, embed elem1 inside each of those elements, and then remove the original elem1""" for elem2 in elem1.xpath(xpath, namespaces=namespaces): child_elem1 = etree.Element(elem1.tag) ...
python
def interior_nesting(cls, elem1, xpath, namespaces=None): """for elem1 containing elements at xpath, embed elem1 inside each of those elements, and then remove the original elem1""" for elem2 in elem1.xpath(xpath, namespaces=namespaces): child_elem1 = etree.Element(elem1.tag) ...
[ "def", "interior_nesting", "(", "cls", ",", "elem1", ",", "xpath", ",", "namespaces", "=", "None", ")", ":", "for", "elem2", "in", "elem1", ".", "xpath", "(", "xpath", ",", "namespaces", "=", "namespaces", ")", ":", "child_elem1", "=", "etree", ".", "E...
for elem1 containing elements at xpath, embed elem1 inside each of those elements, and then remove the original elem1
[ "for", "elem1", "containing", "elements", "at", "xpath", "embed", "elem1", "inside", "each", "of", "those", "elements", "and", "then", "remove", "the", "original", "elem1" ]
8fbea5dad7fadc7b854ddbeff6ecfb55aaceeb77
https://github.com/BlackEarth/bxml/blob/8fbea5dad7fadc7b854ddbeff6ecfb55aaceeb77/bxml/xml.py#L836-L847
41,885
BlackEarth/bxml
bxml/xml.py
XML.fragment_nesting
def fragment_nesting(cls, elem1, tag2, namespaces=None): """for elem1 containing elements with tag2, fragment elem1 into elems that are adjacent to and nested within tag2""" elems2 = elem1.xpath("child::%s" % tag2, namespaces=namespaces) while len(elems2) > 0: elem2 = e...
python
def fragment_nesting(cls, elem1, tag2, namespaces=None): """for elem1 containing elements with tag2, fragment elem1 into elems that are adjacent to and nested within tag2""" elems2 = elem1.xpath("child::%s" % tag2, namespaces=namespaces) while len(elems2) > 0: elem2 = e...
[ "def", "fragment_nesting", "(", "cls", ",", "elem1", ",", "tag2", ",", "namespaces", "=", "None", ")", ":", "elems2", "=", "elem1", ".", "xpath", "(", "\"child::%s\"", "%", "tag2", ",", "namespaces", "=", "namespaces", ")", "while", "len", "(", "elems2",...
for elem1 containing elements with tag2, fragment elem1 into elems that are adjacent to and nested within tag2
[ "for", "elem1", "containing", "elements", "with", "tag2", "fragment", "elem1", "into", "elems", "that", "are", "adjacent", "to", "and", "nested", "within", "tag2" ]
8fbea5dad7fadc7b854ddbeff6ecfb55aaceeb77
https://github.com/BlackEarth/bxml/blob/8fbea5dad7fadc7b854ddbeff6ecfb55aaceeb77/bxml/xml.py#L850-L890
41,886
shawnsilva/steamwebapi
steamwebapi/profiles.py
User.communityvisibilitystate
def communityvisibilitystate(self): """Return the Visibility State of the Users Profile""" if self._communityvisibilitystate == None: return None elif self._communityvisibilitystate in self.VisibilityState: return self.VisibilityState[self._communityvisibilitystate] ...
python
def communityvisibilitystate(self): """Return the Visibility State of the Users Profile""" if self._communityvisibilitystate == None: return None elif self._communityvisibilitystate in self.VisibilityState: return self.VisibilityState[self._communityvisibilitystate] ...
[ "def", "communityvisibilitystate", "(", "self", ")", ":", "if", "self", ".", "_communityvisibilitystate", "==", "None", ":", "return", "None", "elif", "self", ".", "_communityvisibilitystate", "in", "self", ".", "VisibilityState", ":", "return", "self", ".", "Vi...
Return the Visibility State of the Users Profile
[ "Return", "the", "Visibility", "State", "of", "the", "Users", "Profile" ]
dc16538ebe985cc7ea170f660169ebc2366efbf2
https://github.com/shawnsilva/steamwebapi/blob/dc16538ebe985cc7ea170f660169ebc2366efbf2/steamwebapi/profiles.py#L61-L69
41,887
shawnsilva/steamwebapi
steamwebapi/profiles.py
User.personastate
def personastate(self): """Return the Persona State of the Users Profile""" if self._personastate == None: return None elif self._personastate in self.PersonaState: return self.PersonaState[self._personastate] else: #Invalid State return No...
python
def personastate(self): """Return the Persona State of the Users Profile""" if self._personastate == None: return None elif self._personastate in self.PersonaState: return self.PersonaState[self._personastate] else: #Invalid State return No...
[ "def", "personastate", "(", "self", ")", ":", "if", "self", ".", "_personastate", "==", "None", ":", "return", "None", "elif", "self", ".", "_personastate", "in", "self", ".", "PersonaState", ":", "return", "self", ".", "PersonaState", "[", "self", ".", ...
Return the Persona State of the Users Profile
[ "Return", "the", "Persona", "State", "of", "the", "Users", "Profile" ]
dc16538ebe985cc7ea170f660169ebc2366efbf2
https://github.com/shawnsilva/steamwebapi/blob/dc16538ebe985cc7ea170f660169ebc2366efbf2/steamwebapi/profiles.py#L76-L84
41,888
ponty/confduino
confduino/mculist.py
mcus
def mcus(): """MCU list.""" ls = [] for h in hwpack_names(): for b in board_names(h): ls += [mcu(b, h)] ls = sorted(list(set(ls))) return ls
python
def mcus(): """MCU list.""" ls = [] for h in hwpack_names(): for b in board_names(h): ls += [mcu(b, h)] ls = sorted(list(set(ls))) return ls
[ "def", "mcus", "(", ")", ":", "ls", "=", "[", "]", "for", "h", "in", "hwpack_names", "(", ")", ":", "for", "b", "in", "board_names", "(", "h", ")", ":", "ls", "+=", "[", "mcu", "(", "b", ",", "h", ")", "]", "ls", "=", "sorted", "(", "list",...
MCU list.
[ "MCU", "list", "." ]
f4c261e5e84997f145a8bdd001f471db74c9054b
https://github.com/ponty/confduino/blob/f4c261e5e84997f145a8bdd001f471db74c9054b/confduino/mculist.py#L10-L17
41,889
foobarbecue/afterflight
afterflight/af_utils.py
logpath2dt
def logpath2dt(filepath): """ given a dataflashlog in the format produced by Mission Planner, return a datetime which says when the file was downloaded from the APM """ return datetime.datetime.strptime(re.match(r'.*/(.*) .*$',filepath).groups()[0],'%Y-%m-%d %H-%M')
python
def logpath2dt(filepath): """ given a dataflashlog in the format produced by Mission Planner, return a datetime which says when the file was downloaded from the APM """ return datetime.datetime.strptime(re.match(r'.*/(.*) .*$',filepath).groups()[0],'%Y-%m-%d %H-%M')
[ "def", "logpath2dt", "(", "filepath", ")", ":", "return", "datetime", ".", "datetime", ".", "strptime", "(", "re", ".", "match", "(", "r'.*/(.*) .*$'", ",", "filepath", ")", ".", "groups", "(", ")", "[", "0", "]", ",", "'%Y-%m-%d %H-%M'", ")" ]
given a dataflashlog in the format produced by Mission Planner, return a datetime which says when the file was downloaded from the APM
[ "given", "a", "dataflashlog", "in", "the", "format", "produced", "by", "Mission", "Planner", "return", "a", "datetime", "which", "says", "when", "the", "file", "was", "downloaded", "from", "the", "APM" ]
7085f719593f88999dce93f35caec5f15d2991b6
https://github.com/foobarbecue/afterflight/blob/7085f719593f88999dce93f35caec5f15d2991b6/afterflight/af_utils.py#L24-L29
41,890
andy29485/embypy
embypy/objects/object.py
EmbyObject.url
def url(self): '''url of the item Notes ----- if remote-adderes was given, then that is used as the base ''' path = '/web/itemdetails.html?id={}'.format(self.id) return self.connector.get_url(path, attach_api_key=False)
python
def url(self): '''url of the item Notes ----- if remote-adderes was given, then that is used as the base ''' path = '/web/itemdetails.html?id={}'.format(self.id) return self.connector.get_url(path, attach_api_key=False)
[ "def", "url", "(", "self", ")", ":", "path", "=", "'/web/itemdetails.html?id={}'", ".", "format", "(", "self", ".", "id", ")", "return", "self", ".", "connector", ".", "get_url", "(", "path", ",", "attach_api_key", "=", "False", ")" ]
url of the item Notes ----- if remote-adderes was given, then that is used as the base
[ "url", "of", "the", "item" ]
cde658d380965caaf4789d4d182d045b0346797b
https://github.com/andy29485/embypy/blob/cde658d380965caaf4789d4d182d045b0346797b/embypy/objects/object.py#L233-L241
41,891
andy29485/embypy
embypy/objects/object.py
EmbyObject.update
async def update(self, fields=''): '''reload object info from emby |coro| Parameters ---------- fields : str additional fields to request when updating See Also -------- refresh : same thing send : post : ''' path = 'Users/{{UserId}}/Items/{}'.format(self.i...
python
async def update(self, fields=''): '''reload object info from emby |coro| Parameters ---------- fields : str additional fields to request when updating See Also -------- refresh : same thing send : post : ''' path = 'Users/{{UserId}}/Items/{}'.format(self.i...
[ "async", "def", "update", "(", "self", ",", "fields", "=", "''", ")", ":", "path", "=", "'Users/{{UserId}}/Items/{}'", ".", "format", "(", "self", ".", "id", ")", "info", "=", "await", "self", ".", "connector", ".", "getJson", "(", "path", ",", "remote...
reload object info from emby |coro| Parameters ---------- fields : str additional fields to request when updating See Also -------- refresh : same thing send : post :
[ "reload", "object", "info", "from", "emby" ]
cde658d380965caaf4789d4d182d045b0346797b
https://github.com/andy29485/embypy/blob/cde658d380965caaf4789d4d182d045b0346797b/embypy/objects/object.py#L249-L272
41,892
andy29485/embypy
embypy/objects/object.py
EmbyObject.send
async def send(self): '''send data that was changed to emby |coro| This should be used after using any of the setter. Not necessarily immediately, but soon after. See Also -------- post: same thing update : refresh : Returns ------- aiohttp.ClientResponse or N...
python
async def send(self): '''send data that was changed to emby |coro| This should be used after using any of the setter. Not necessarily immediately, but soon after. See Also -------- post: same thing update : refresh : Returns ------- aiohttp.ClientResponse or N...
[ "async", "def", "send", "(", "self", ")", ":", "# Why does the whole dict need to be sent?", "# because emby is dumb, and will break if I don't", "path", "=", "'Items/{}'", ".", "format", "(", "self", ".", "id", ")", "resp", "=", "await", "self", ".", "connector", ...
send data that was changed to emby |coro| This should be used after using any of the setter. Not necessarily immediately, but soon after. See Also -------- post: same thing update : refresh : Returns ------- aiohttp.ClientResponse or None if nothing needed updatin...
[ "send", "data", "that", "was", "changed", "to", "emby" ]
cde658d380965caaf4789d4d182d045b0346797b
https://github.com/andy29485/embypy/blob/cde658d380965caaf4789d4d182d045b0346797b/embypy/objects/object.py#L291-L316
41,893
ponty/confduino
confduino/libremove.py
remove_lib
def remove_lib(lib_name): """remove library. :param lib_name: library name (e.g. 'PS2Keyboard') :rtype: None """ targ_dlib = libraries_dir() / lib_name log.debug('remove %s', targ_dlib) targ_dlib.rmtree()
python
def remove_lib(lib_name): """remove library. :param lib_name: library name (e.g. 'PS2Keyboard') :rtype: None """ targ_dlib = libraries_dir() / lib_name log.debug('remove %s', targ_dlib) targ_dlib.rmtree()
[ "def", "remove_lib", "(", "lib_name", ")", ":", "targ_dlib", "=", "libraries_dir", "(", ")", "/", "lib_name", "log", ".", "debug", "(", "'remove %s'", ",", "targ_dlib", ")", "targ_dlib", ".", "rmtree", "(", ")" ]
remove library. :param lib_name: library name (e.g. 'PS2Keyboard') :rtype: None
[ "remove", "library", "." ]
f4c261e5e84997f145a8bdd001f471db74c9054b
https://github.com/ponty/confduino/blob/f4c261e5e84997f145a8bdd001f471db74c9054b/confduino/libremove.py#L9-L18
41,894
Caramel/treacle
treacle/treacle.py
Office._read_holidays
def _read_holidays(self, filename): """ Read holidays from an iCalendar-format file. """ cal = Calendar.from_ical(open(filename, 'rb').read()) holidays = [] for component in cal.walk('VEVENT'): start = component.decoded('DTSTART') try: end = component.decoded('DTEND') except KeyError: # RF...
python
def _read_holidays(self, filename): """ Read holidays from an iCalendar-format file. """ cal = Calendar.from_ical(open(filename, 'rb').read()) holidays = [] for component in cal.walk('VEVENT'): start = component.decoded('DTSTART') try: end = component.decoded('DTEND') except KeyError: # RF...
[ "def", "_read_holidays", "(", "self", ",", "filename", ")", ":", "cal", "=", "Calendar", ".", "from_ical", "(", "open", "(", "filename", ",", "'rb'", ")", ".", "read", "(", ")", ")", "holidays", "=", "[", "]", "for", "component", "in", "cal", ".", ...
Read holidays from an iCalendar-format file.
[ "Read", "holidays", "from", "an", "iCalendar", "-", "format", "file", "." ]
70f85a505c0f345659850aec1715c46c687d0e48
https://github.com/Caramel/treacle/blob/70f85a505c0f345659850aec1715c46c687d0e48/treacle/treacle.py#L101-L137
41,895
Caramel/treacle
treacle/treacle.py
Treacle.in_hours
def in_hours(self, office=None, when=None): """ Finds if it is business hours in the given office. :param office: Office ID to look up, or None to check if any office is in business hours. :type office: str or None :param datetime.datetime when: When to check the office is open, or None for now. :returns...
python
def in_hours(self, office=None, when=None): """ Finds if it is business hours in the given office. :param office: Office ID to look up, or None to check if any office is in business hours. :type office: str or None :param datetime.datetime when: When to check the office is open, or None for now. :returns...
[ "def", "in_hours", "(", "self", ",", "office", "=", "None", ",", "when", "=", "None", ")", ":", "if", "when", "==", "None", ":", "when", "=", "datetime", ".", "now", "(", "tz", "=", "utc", ")", "if", "office", "==", "None", ":", "for", "office", ...
Finds if it is business hours in the given office. :param office: Office ID to look up, or None to check if any office is in business hours. :type office: str or None :param datetime.datetime when: When to check the office is open, or None for now. :returns: True if it is business hours, False otherwise. :...
[ "Finds", "if", "it", "is", "business", "hours", "in", "the", "given", "office", "." ]
70f85a505c0f345659850aec1715c46c687d0e48
https://github.com/Caramel/treacle/blob/70f85a505c0f345659850aec1715c46c687d0e48/treacle/treacle.py#L202-L230
41,896
crosenth/csvpandas
csvpandas/__init__.py
setup_logging
def setup_logging(namespace): """ setup global logging """ loglevel = { 0: logging.ERROR, 1: logging.WARNING, 2: logging.INFO, 3: logging.DEBUG, }.get(namespace.verbosity, logging.DEBUG) if namespace.verbosity > 1: logformat = '%(levelname)s csvpandas %(...
python
def setup_logging(namespace): """ setup global logging """ loglevel = { 0: logging.ERROR, 1: logging.WARNING, 2: logging.INFO, 3: logging.DEBUG, }.get(namespace.verbosity, logging.DEBUG) if namespace.verbosity > 1: logformat = '%(levelname)s csvpandas %(...
[ "def", "setup_logging", "(", "namespace", ")", ":", "loglevel", "=", "{", "0", ":", "logging", ".", "ERROR", ",", "1", ":", "logging", ".", "WARNING", ",", "2", ":", "logging", ".", "INFO", ",", "3", ":", "logging", ".", "DEBUG", ",", "}", ".", "...
setup global logging
[ "setup", "global", "logging" ]
4c2027192761150a9a6383595d7324df37f36429
https://github.com/crosenth/csvpandas/blob/4c2027192761150a9a6383595d7324df37f36429/csvpandas/__init__.py#L73-L90
41,897
crosenth/csvpandas
csvpandas/__init__.py
parse_subcommands
def parse_subcommands(parser, subcommands, argv): """ Setup all sub-commands """ subparsers = parser.add_subparsers(dest='subparser_name') # add help sub-command parser_help = subparsers.add_parser( 'help', help='Detailed help for actions using `help <action>`') parser_help.add_arg...
python
def parse_subcommands(parser, subcommands, argv): """ Setup all sub-commands """ subparsers = parser.add_subparsers(dest='subparser_name') # add help sub-command parser_help = subparsers.add_parser( 'help', help='Detailed help for actions using `help <action>`') parser_help.add_arg...
[ "def", "parse_subcommands", "(", "parser", ",", "subcommands", ",", "argv", ")", ":", "subparsers", "=", "parser", ".", "add_subparsers", "(", "dest", "=", "'subparser_name'", ")", "# add help sub-command", "parser_help", "=", "subparsers", ".", "add_parser", "(",...
Setup all sub-commands
[ "Setup", "all", "sub", "-", "commands" ]
4c2027192761150a9a6383595d7324df37f36429
https://github.com/crosenth/csvpandas/blob/4c2027192761150a9a6383595d7324df37f36429/csvpandas/__init__.py#L127-L177
41,898
crosenth/csvpandas
csvpandas/utils.py
opener
def opener(mode='r'): """Factory for creating file objects Keyword Arguments: - mode -- A string indicating how the file is to be opened. Accepts the same values as the builtin open() function. - bufsize -- The file's desired buffer size. Accepts the same values as the b...
python
def opener(mode='r'): """Factory for creating file objects Keyword Arguments: - mode -- A string indicating how the file is to be opened. Accepts the same values as the builtin open() function. - bufsize -- The file's desired buffer size. Accepts the same values as the b...
[ "def", "opener", "(", "mode", "=", "'r'", ")", ":", "def", "open_file", "(", "f", ")", ":", "if", "f", "is", "sys", ".", "stdout", "or", "f", "is", "sys", ".", "stdin", ":", "return", "f", "elif", "f", "==", "'-'", ":", "return", "sys", ".", ...
Factory for creating file objects Keyword Arguments: - mode -- A string indicating how the file is to be opened. Accepts the same values as the builtin open() function. - bufsize -- The file's desired buffer size. Accepts the same values as the builtin open() function.
[ "Factory", "for", "creating", "file", "objects" ]
4c2027192761150a9a6383595d7324df37f36429
https://github.com/crosenth/csvpandas/blob/4c2027192761150a9a6383595d7324df37f36429/csvpandas/utils.py#L21-L43
41,899
rackerlabs/python-lunrclient
lunrclient/lunr_shell.py
Account.get
def get(self, id, no_summary=False): """ List details for a specific tenant id """ resp = self.client.accounts.get(id) if no_summary: return self.display(resp) results = [] # Get a list of all volumes for this tenant id client = LunrClient(self.get_admin(), d...
python
def get(self, id, no_summary=False): """ List details for a specific tenant id """ resp = self.client.accounts.get(id) if no_summary: return self.display(resp) results = [] # Get a list of all volumes for this tenant id client = LunrClient(self.get_admin(), d...
[ "def", "get", "(", "self", ",", "id", ",", "no_summary", "=", "False", ")", ":", "resp", "=", "self", ".", "client", ".", "accounts", ".", "get", "(", "id", ")", "if", "no_summary", ":", "return", "self", ".", "display", "(", "resp", ")", "results"...
List details for a specific tenant id
[ "List", "details", "for", "a", "specific", "tenant", "id" ]
f26a450a422600f492480bfa42cbee50a5c7016f
https://github.com/rackerlabs/python-lunrclient/blob/f26a450a422600f492480bfa42cbee50a5c7016f/lunrclient/lunr_shell.py#L298-L321