repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
sassoo/goldman
goldman/deserializers/form_data.py
Deserializer.parse
def parse(self, mimetypes): """ Invoke the RFC 2388 spec compliant parser """ self._parse_top_level_content_type() link = 'tools.ietf.org/html/rfc2388' parts = cgi.FieldStorage( fp=self.req.stream, environ=self.req.env, ) if not parts: ...
python
def parse(self, mimetypes): """ Invoke the RFC 2388 spec compliant parser """ self._parse_top_level_content_type() link = 'tools.ietf.org/html/rfc2388' parts = cgi.FieldStorage( fp=self.req.stream, environ=self.req.env, ) if not parts: ...
[ "def", "parse", "(", "self", ",", "mimetypes", ")", ":", "self", ".", "_parse_top_level_content_type", "(", ")", "link", "=", "'tools.ietf.org/html/rfc2388'", "parts", "=", "cgi", ".", "FieldStorage", "(", "fp", "=", "self", ".", "req", ".", "stream", ",", ...
Invoke the RFC 2388 spec compliant parser
[ "Invoke", "the", "RFC", "2388", "spec", "compliant", "parser" ]
train
https://github.com/sassoo/goldman/blob/b72540c9ad06b5c68aadb1b4fa8cb0b716260bf2/goldman/deserializers/form_data.py#L129-L150
martijnvermaat/interval-binning
binning/__init__.py
range_per_level
def range_per_level(start, stop): """ Given an interval `start:stop`, make an iterator that returns for each level the first and last bin overlapping the interval, starting with the smallest bins. Zero-length intervals are binned according to the one-position interval following it. Algorit...
python
def range_per_level(start, stop): """ Given an interval `start:stop`, make an iterator that returns for each level the first and last bin overlapping the interval, starting with the smallest bins. Zero-length intervals are binned according to the one-position interval following it. Algorit...
[ "def", "range_per_level", "(", "start", ",", "stop", ")", ":", "if", "start", "<", "0", "or", "stop", ">", "MAX_POSITION", "+", "1", ":", "raise", "OutOfRangeError", "(", "'Interval %d:%d is out of range (maximum position is %d)'", "%", "(", "start", ",", "stop"...
Given an interval `start:stop`, make an iterator that returns for each level the first and last bin overlapping the interval, starting with the smallest bins. Zero-length intervals are binned according to the one-position interval following it. Algorithm by `Jim Kent <http://genomewiki.ucsc.ed...
[ "Given", "an", "interval", "start", ":", "stop", "make", "an", "iterator", "that", "returns", "for", "each", "level", "the", "first", "and", "last", "bin", "overlapping", "the", "interval", "starting", "with", "the", "smallest", "bins", "." ]
train
https://github.com/martijnvermaat/interval-binning/blob/91c359ff3ddd1f587a209521dd238d2d93fc93f0/binning/__init__.py#L62-L99
martijnvermaat/interval-binning
binning/__init__.py
assign_bin
def assign_bin(start, stop): """ Given an interval `start:stop`, return the smallest bin in which it fits. :arg int start, stop: Interval positions (zero-based, open-ended). :return: Smallest bin containing `start:stop`. :rtype: int :raise OutOfRangeError: If `start:stop` exceeds the range of...
python
def assign_bin(start, stop): """ Given an interval `start:stop`, return the smallest bin in which it fits. :arg int start, stop: Interval positions (zero-based, open-ended). :return: Smallest bin containing `start:stop`. :rtype: int :raise OutOfRangeError: If `start:stop` exceeds the range of...
[ "def", "assign_bin", "(", "start", ",", "stop", ")", ":", "try", ":", "return", "next", "(", "dropwhile", "(", "lambda", "r", ":", "r", "[", "0", "]", "!=", "r", "[", "1", "]", ",", "range_per_level", "(", "start", ",", "stop", ")", ")", ")", "...
Given an interval `start:stop`, return the smallest bin in which it fits. :arg int start, stop: Interval positions (zero-based, open-ended). :return: Smallest bin containing `start:stop`. :rtype: int :raise OutOfRangeError: If `start:stop` exceeds the range of the binning scheme.
[ "Given", "an", "interval", "start", ":", "stop", "return", "the", "smallest", "bin", "in", "which", "it", "fits", "." ]
train
https://github.com/martijnvermaat/interval-binning/blob/91c359ff3ddd1f587a209521dd238d2d93fc93f0/binning/__init__.py#L102-L118
martijnvermaat/interval-binning
binning/__init__.py
overlapping_bins
def overlapping_bins(start, stop=None): """ Given an interval `start:stop`, return bins for intervals *overlapping* `start:stop` by at least one position. The order is according to the bin level (starting with the smallest bins), and within a level according to the bin number (ascending). :arg ...
python
def overlapping_bins(start, stop=None): """ Given an interval `start:stop`, return bins for intervals *overlapping* `start:stop` by at least one position. The order is according to the bin level (starting with the smallest bins), and within a level according to the bin number (ascending). :arg ...
[ "def", "overlapping_bins", "(", "start", ",", "stop", "=", "None", ")", ":", "if", "stop", "is", "None", ":", "stop", "=", "start", "+", "1", "return", "[", "bin", "for", "first", ",", "last", "in", "range_per_level", "(", "start", ",", "stop", ")", ...
Given an interval `start:stop`, return bins for intervals *overlapping* `start:stop` by at least one position. The order is according to the bin level (starting with the smallest bins), and within a level according to the bin number (ascending). :arg int start, stop: Interval positions (zero-based, ope...
[ "Given", "an", "interval", "start", ":", "stop", "return", "bins", "for", "intervals", "*", "overlapping", "*", "start", ":", "stop", "by", "at", "least", "one", "position", ".", "The", "order", "is", "according", "to", "the", "bin", "level", "(", "start...
train
https://github.com/martijnvermaat/interval-binning/blob/91c359ff3ddd1f587a209521dd238d2d93fc93f0/binning/__init__.py#L121-L145
martijnvermaat/interval-binning
binning/__init__.py
containing_bins
def containing_bins(start, stop=None): """ Given an interval `start:stop`, return bins for intervals completely *containing* `start:stop`. The order is according to the bin level (starting with the smallest bins), and within a level according to the bin number (ascending). :arg int start, stop:...
python
def containing_bins(start, stop=None): """ Given an interval `start:stop`, return bins for intervals completely *containing* `start:stop`. The order is according to the bin level (starting with the smallest bins), and within a level according to the bin number (ascending). :arg int start, stop:...
[ "def", "containing_bins", "(", "start", ",", "stop", "=", "None", ")", ":", "if", "stop", "is", "None", ":", "stop", "=", "start", "+", "1", "max_bin", "=", "assign_bin", "(", "start", ",", "stop", ")", "return", "[", "bin", "for", "bin", "in", "ov...
Given an interval `start:stop`, return bins for intervals completely *containing* `start:stop`. The order is according to the bin level (starting with the smallest bins), and within a level according to the bin number (ascending). :arg int start, stop: Interval positions (zero-based, open-ended). If ...
[ "Given", "an", "interval", "start", ":", "stop", "return", "bins", "for", "intervals", "completely", "*", "containing", "*", "start", ":", "stop", ".", "The", "order", "is", "according", "to", "the", "bin", "level", "(", "starting", "with", "the", "smalles...
train
https://github.com/martijnvermaat/interval-binning/blob/91c359ff3ddd1f587a209521dd238d2d93fc93f0/binning/__init__.py#L148-L171
martijnvermaat/interval-binning
binning/__init__.py
contained_bins
def contained_bins(start, stop=None): """ Given an interval `start:stop`, return bins for intervals completely *contained by* `start:stop`. The order is according to the bin level (starting with the smallest bins), and within a level according to the bin number (ascending). :arg int start, stop...
python
def contained_bins(start, stop=None): """ Given an interval `start:stop`, return bins for intervals completely *contained by* `start:stop`. The order is according to the bin level (starting with the smallest bins), and within a level according to the bin number (ascending). :arg int start, stop...
[ "def", "contained_bins", "(", "start", ",", "stop", "=", "None", ")", ":", "if", "stop", "is", "None", ":", "stop", "=", "start", "+", "1", "min_bin", "=", "assign_bin", "(", "start", ",", "stop", ")", "return", "[", "bin", "for", "bin", "in", "ove...
Given an interval `start:stop`, return bins for intervals completely *contained by* `start:stop`. The order is according to the bin level (starting with the smallest bins), and within a level according to the bin number (ascending). :arg int start, stop: Interval positions (zero-based, open-ended). If ...
[ "Given", "an", "interval", "start", ":", "stop", "return", "bins", "for", "intervals", "completely", "*", "contained", "by", "*", "start", ":", "stop", ".", "The", "order", "is", "according", "to", "the", "bin", "level", "(", "starting", "with", "the", "...
train
https://github.com/martijnvermaat/interval-binning/blob/91c359ff3ddd1f587a209521dd238d2d93fc93f0/binning/__init__.py#L174-L197
martijnvermaat/interval-binning
binning/__init__.py
covered_interval
def covered_interval(bin): """ Given a bin number `bin`, return the interval covered by this bin. :arg int bin: Bin number. :return: Tuple of `start, stop` being the zero-based, open-ended interval covered by `bin`. :rtype: tuple(int) :raise OutOfRangeError: If bin number `bin` exceeds ...
python
def covered_interval(bin): """ Given a bin number `bin`, return the interval covered by this bin. :arg int bin: Bin number. :return: Tuple of `start, stop` being the zero-based, open-ended interval covered by `bin`. :rtype: tuple(int) :raise OutOfRangeError: If bin number `bin` exceeds ...
[ "def", "covered_interval", "(", "bin", ")", ":", "if", "bin", "<", "0", "or", "bin", ">", "MAX_BIN", ":", "raise", "OutOfRangeError", "(", "'Invalid bin number %d (maximum bin number is %d)'", "%", "(", "bin", ",", "MAX_BIN", ")", ")", "shift", "=", "SHIFT_FIR...
Given a bin number `bin`, return the interval covered by this bin. :arg int bin: Bin number. :return: Tuple of `start, stop` being the zero-based, open-ended interval covered by `bin`. :rtype: tuple(int) :raise OutOfRangeError: If bin number `bin` exceeds the maximum bin number.
[ "Given", "a", "bin", "number", "bin", "return", "the", "interval", "covered", "by", "this", "bin", "." ]
train
https://github.com/martijnvermaat/interval-binning/blob/91c359ff3ddd1f587a209521dd238d2d93fc93f0/binning/__init__.py#L200-L222
radjkarl/fancyTools
fancytools/pystructure/stitchModules.py
stitchModules
def stitchModules(module, fallbackModule): """ complete missing attributes with those in fallbackModule imagine you have 2 modules: a and b a is some kind of an individualised module of b - but will maybe not contain all attributes of b. in this case a should use the attributes from b >>> ...
python
def stitchModules(module, fallbackModule): """ complete missing attributes with those in fallbackModule imagine you have 2 modules: a and b a is some kind of an individualised module of b - but will maybe not contain all attributes of b. in this case a should use the attributes from b >>> ...
[ "def", "stitchModules", "(", "module", ",", "fallbackModule", ")", ":", "for", "name", ",", "attr", "in", "fallbackModule", ".", "__dict__", ".", "items", "(", ")", ":", "if", "name", "not", "in", "module", ".", "__dict__", ":", "module", ".", "__dict__"...
complete missing attributes with those in fallbackModule imagine you have 2 modules: a and b a is some kind of an individualised module of b - but will maybe not contain all attributes of b. in this case a should use the attributes from b >>> a.var1 = 'individual 1' # what we now want is to a...
[ "complete", "missing", "attributes", "with", "those", "in", "fallbackModule" ]
train
https://github.com/radjkarl/fancyTools/blob/4c4d961003dc4ed6e46429a0c24f7e2bb52caa8b/fancytools/pystructure/stitchModules.py#L4-L27
deifyed/vault
libconman/database.py
DataCommunicator.getTarget
def getTarget(self, iid): ''' Returns a dictionary containing information about a certain target ''' sql = 'select name, path from {} where _id=?'.format(self.TABLE_ITEMS) data = self.db.execute(sql, (iid,)).fetchone() if data: return {'name': data[0], 'p...
python
def getTarget(self, iid): ''' Returns a dictionary containing information about a certain target ''' sql = 'select name, path from {} where _id=?'.format(self.TABLE_ITEMS) data = self.db.execute(sql, (iid,)).fetchone() if data: return {'name': data[0], 'p...
[ "def", "getTarget", "(", "self", ",", "iid", ")", ":", "sql", "=", "'select name, path from {} where _id=?'", ".", "format", "(", "self", ".", "TABLE_ITEMS", ")", "data", "=", "self", ".", "db", ".", "execute", "(", "sql", ",", "(", "iid", ",", ")", ")...
Returns a dictionary containing information about a certain target
[ "Returns", "a", "dictionary", "containing", "information", "about", "a", "certain", "target" ]
train
https://github.com/deifyed/vault/blob/e3c37ade6c3e6b61a76ec6cd2ba98881c7401d97/libconman/database.py#L42-L52
deifyed/vault
libconman/database.py
DataCommunicator.insertTarget
def insertTarget(self, name, path): ''' Inserts a new target into the vault database Returns the id of the created target ''' sql = 'insert into {}(name, path) values (?,?);'.format(self.TABLE_ITEMS) try: _id = self.db.execute(sql, (name, path)).lastr...
python
def insertTarget(self, name, path): ''' Inserts a new target into the vault database Returns the id of the created target ''' sql = 'insert into {}(name, path) values (?,?);'.format(self.TABLE_ITEMS) try: _id = self.db.execute(sql, (name, path)).lastr...
[ "def", "insertTarget", "(", "self", ",", "name", ",", "path", ")", ":", "sql", "=", "'insert into {}(name, path) values (?,?);'", ".", "format", "(", "self", ".", "TABLE_ITEMS", ")", "try", ":", "_id", "=", "self", ".", "db", ".", "execute", "(", "sql", ...
Inserts a new target into the vault database Returns the id of the created target
[ "Inserts", "a", "new", "target", "into", "the", "vault", "database", "Returns", "the", "id", "of", "the", "created", "target" ]
train
https://github.com/deifyed/vault/blob/e3c37ade6c3e6b61a76ec6cd2ba98881c7401d97/libconman/database.py#L54-L67
deifyed/vault
libconman/database.py
DataCommunicator.removeTarget
def removeTarget(self, iid): ''' Removes target information from vault database ''' sql = 'delete from {} where _id=?'.format(self.TABLE_ITEMS) cursor = self.db.execute(sql, (iid,)) if cursor.rowcount > 0: self.db.commit() return True ...
python
def removeTarget(self, iid): ''' Removes target information from vault database ''' sql = 'delete from {} where _id=?'.format(self.TABLE_ITEMS) cursor = self.db.execute(sql, (iid,)) if cursor.rowcount > 0: self.db.commit() return True ...
[ "def", "removeTarget", "(", "self", ",", "iid", ")", ":", "sql", "=", "'delete from {} where _id=?'", ".", "format", "(", "self", ".", "TABLE_ITEMS", ")", "cursor", "=", "self", ".", "db", ".", "execute", "(", "sql", ",", "(", "iid", ",", ")", ")", "...
Removes target information from vault database
[ "Removes", "target", "information", "from", "vault", "database" ]
train
https://github.com/deifyed/vault/blob/e3c37ade6c3e6b61a76ec6cd2ba98881c7401d97/libconman/database.py#L69-L81
deifyed/vault
libconman/database.py
DataCommunicator.listTargets
def listTargets(self): ''' Returns a list of all the items secured in the vault ''' sql = 'select * from {}'.format(self.TABLE_ITEMS) cursor = self.db.execute(sql) return [(iid, name, path) for iid, name, path in cursor]
python
def listTargets(self): ''' Returns a list of all the items secured in the vault ''' sql = 'select * from {}'.format(self.TABLE_ITEMS) cursor = self.db.execute(sql) return [(iid, name, path) for iid, name, path in cursor]
[ "def", "listTargets", "(", "self", ")", ":", "sql", "=", "'select * from {}'", ".", "format", "(", "self", ".", "TABLE_ITEMS", ")", "cursor", "=", "self", ".", "db", ".", "execute", "(", "sql", ")", "return", "[", "(", "iid", ",", "name", ",", "path"...
Returns a list of all the items secured in the vault
[ "Returns", "a", "list", "of", "all", "the", "items", "secured", "in", "the", "vault" ]
train
https://github.com/deifyed/vault/blob/e3c37ade6c3e6b61a76ec6cd2ba98881c7401d97/libconman/database.py#L83-L90
sassoo/goldman
goldman/models/default_schema.py
pre_create
def pre_create(sender, model): """ Callback before creating any new model Identify the creator of the new model & set the created timestamp to now. """ model.created = dt.utcnow() model.creator = goldman.sess.login
python
def pre_create(sender, model): """ Callback before creating any new model Identify the creator of the new model & set the created timestamp to now. """ model.created = dt.utcnow() model.creator = goldman.sess.login
[ "def", "pre_create", "(", "sender", ",", "model", ")", ":", "model", ".", "created", "=", "dt", ".", "utcnow", "(", ")", "model", ".", "creator", "=", "goldman", ".", "sess", ".", "login" ]
Callback before creating any new model Identify the creator of the new model & set the created timestamp to now.
[ "Callback", "before", "creating", "any", "new", "model" ]
train
https://github.com/sassoo/goldman/blob/b72540c9ad06b5c68aadb1b4fa8cb0b716260bf2/goldman/models/default_schema.py#L44-L52
xaptum/xtt-python
xtt/asn1.py
x509_from_ecdsap256_key_pair
def x509_from_ecdsap256_key_pair(pub_key, priv_key, common_name): """ Creates a self-signed x509 certificate for a common name and ECDSAP256 key pair. :pub_key: an ECDSAP256PublicKey instance :priv_key: an ECDSAP256PrivateKey instance :common_name: an XTTIdentity instance :returns: the cert...
python
def x509_from_ecdsap256_key_pair(pub_key, priv_key, common_name): """ Creates a self-signed x509 certificate for a common name and ECDSAP256 key pair. :pub_key: an ECDSAP256PublicKey instance :priv_key: an ECDSAP256PrivateKey instance :common_name: an XTTIdentity instance :returns: the cert...
[ "def", "x509_from_ecdsap256_key_pair", "(", "pub_key", ",", "priv_key", ",", "common_name", ")", ":", "cert_len", "=", "_lib", ".", "xtt_x509_certificate_length", "(", ")", "cert", "=", "_ffi", ".", "new", "(", "'unsigned char[]'", ",", "cert_len", ")", "rc", ...
Creates a self-signed x509 certificate for a common name and ECDSAP256 key pair. :pub_key: an ECDSAP256PublicKey instance :priv_key: an ECDSAP256PrivateKey instance :common_name: an XTTIdentity instance :returns: the certificate as a byte string
[ "Creates", "a", "self", "-", "signed", "x509", "certificate", "for", "a", "common", "name", "and", "ECDSAP256", "key", "pair", "." ]
train
https://github.com/xaptum/xtt-python/blob/23ee469488d710d730314bec1136c4dd7ac2cd5c/xtt/asn1.py#L27-L46
xaptum/xtt-python
xtt/asn1.py
asn1_from_ecdsap256_private_key
def asn1_from_ecdsap256_private_key(priv_key, pub_key): """ Returns the ASN.1 encoding of a ECDSAP256 private ket. :priv_key: an ECDSAP256PrivateKey instance :returns: the ASN.1 encoding as a byte string """ encoded_len = _lib.xtt_asn1_private_key_length() encoded = _ffi.new('unsigned char[...
python
def asn1_from_ecdsap256_private_key(priv_key, pub_key): """ Returns the ASN.1 encoding of a ECDSAP256 private ket. :priv_key: an ECDSAP256PrivateKey instance :returns: the ASN.1 encoding as a byte string """ encoded_len = _lib.xtt_asn1_private_key_length() encoded = _ffi.new('unsigned char[...
[ "def", "asn1_from_ecdsap256_private_key", "(", "priv_key", ",", "pub_key", ")", ":", "encoded_len", "=", "_lib", ".", "xtt_asn1_private_key_length", "(", ")", "encoded", "=", "_ffi", ".", "new", "(", "'unsigned char[]'", ",", "encoded_len", ")", "rc", "=", "_lib...
Returns the ASN.1 encoding of a ECDSAP256 private ket. :priv_key: an ECDSAP256PrivateKey instance :returns: the ASN.1 encoding as a byte string
[ "Returns", "the", "ASN", ".", "1", "encoding", "of", "a", "ECDSAP256", "private", "ket", "." ]
train
https://github.com/xaptum/xtt-python/blob/23ee469488d710d730314bec1136c4dd7ac2cd5c/xtt/asn1.py#L48-L61
callowayproject/Transmogrify
transmogrify/processors.py
Processor.parse_size
def parse_size(image, size): """ Parse a size string (i.e. "200", "200x100", "x200", etc.) into a (width, height) tuple. """ bits = size.split("x") if image.size[0] == 0 or image.size[1] == 0: ratio = 1.0 else: ratio = float(image.size[0]) ...
python
def parse_size(image, size): """ Parse a size string (i.e. "200", "200x100", "x200", etc.) into a (width, height) tuple. """ bits = size.split("x") if image.size[0] == 0 or image.size[1] == 0: ratio = 1.0 else: ratio = float(image.size[0]) ...
[ "def", "parse_size", "(", "image", ",", "size", ")", ":", "bits", "=", "size", ".", "split", "(", "\"x\"", ")", "if", "image", ".", "size", "[", "0", "]", "==", "0", "or", "image", ".", "size", "[", "1", "]", "==", "0", ":", "ratio", "=", "1....
Parse a size string (i.e. "200", "200x100", "x200", etc.) into a (width, height) tuple.
[ "Parse", "a", "size", "string", "(", "i", ".", "e", ".", "200", "200x100", "x200", "etc", ".", ")", "into", "a", "(", "width", "height", ")", "tuple", "." ]
train
https://github.com/callowayproject/Transmogrify/blob/f1f891b8b923b3a1ede5eac7f60531c1c472379e/transmogrify/processors.py#L30-L49
callowayproject/Transmogrify
transmogrify/processors.py
Processor.smart_fit
def smart_fit(image, fit_to_width, fit_to_height): """ Proportionally fit the image into the specified width and height. Return the correct width and height. """ im_width, im_height = image.size out_width, out_height = fit_to_width, fit_to_height if im_width == 0 ...
python
def smart_fit(image, fit_to_width, fit_to_height): """ Proportionally fit the image into the specified width and height. Return the correct width and height. """ im_width, im_height = image.size out_width, out_height = fit_to_width, fit_to_height if im_width == 0 ...
[ "def", "smart_fit", "(", "image", ",", "fit_to_width", ",", "fit_to_height", ")", ":", "im_width", ",", "im_height", "=", "image", ".", "size", "out_width", ",", "out_height", "=", "fit_to_width", ",", "fit_to_height", "if", "im_width", "==", "0", "or", "im_...
Proportionally fit the image into the specified width and height. Return the correct width and height.
[ "Proportionally", "fit", "the", "image", "into", "the", "specified", "width", "and", "height", ".", "Return", "the", "correct", "width", "and", "height", "." ]
train
https://github.com/callowayproject/Transmogrify/blob/f1f891b8b923b3a1ede5eac7f60531c1c472379e/transmogrify/processors.py#L52-L71
callowayproject/Transmogrify
transmogrify/processors.py
AutoCrop.process
def process(image, size, *args, **kwargs): """ Automatically crop the image based on image gravity and face detection """ from autodetect import smart_crop box_width, box_height = AutoCrop.parse_size(image, size) scaled_size, rect = smart_crop(box_width, box_height, image...
python
def process(image, size, *args, **kwargs): """ Automatically crop the image based on image gravity and face detection """ from autodetect import smart_crop box_width, box_height = AutoCrop.parse_size(image, size) scaled_size, rect = smart_crop(box_width, box_height, image...
[ "def", "process", "(", "image", ",", "size", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "from", "autodetect", "import", "smart_crop", "box_width", ",", "box_height", "=", "AutoCrop", ".", "parse_size", "(", "image", ",", "size", ")", "scaled_si...
Automatically crop the image based on image gravity and face detection
[ "Automatically", "crop", "the", "image", "based", "on", "image", "gravity", "and", "face", "detection" ]
train
https://github.com/callowayproject/Transmogrify/blob/f1f891b8b923b3a1ede5eac7f60531c1c472379e/transmogrify/processors.py#L312-L319
matthewdeanmartin/jiggle_version
jiggle_version/find_version_class.py
FindVersion.find_any_valid_version
def find_any_valid_version(self): # type: () -> str """ Find version candidates, return first (or any, since they aren't ordered) Blow up if versions are not homogeneous :return: """ versions = self.all_current_versions() if not versions and not self.force_init...
python
def find_any_valid_version(self): # type: () -> str """ Find version candidates, return first (or any, since they aren't ordered) Blow up if versions are not homogeneous :return: """ versions = self.all_current_versions() if not versions and not self.force_init...
[ "def", "find_any_valid_version", "(", "self", ")", ":", "# type: () -> str", "versions", "=", "self", ".", "all_current_versions", "(", ")", "if", "not", "versions", "and", "not", "self", ".", "force_init", ":", "raise", "JiggleVersionException", "(", "\"Have no v...
Find version candidates, return first (or any, since they aren't ordered) Blow up if versions are not homogeneous :return:
[ "Find", "version", "candidates", "return", "first", "(", "or", "any", "since", "they", "aren", "t", "ordered", ")" ]
train
https://github.com/matthewdeanmartin/jiggle_version/blob/963656a0a47b7162780a5f6c8f4b8bbbebc148f5/jiggle_version/find_version_class.py#L123-L155
matthewdeanmartin/jiggle_version
jiggle_version/find_version_class.py
FindVersion.almost_the_same_version
def almost_the_same_version( self, version_list ): # type: (List[str]) -> Optional[str] """ Are these versions different by a .1 patch level? This is crazy common in the wild. :param version_list: :return: """ version_list = list(set(version_list)) t...
python
def almost_the_same_version( self, version_list ): # type: (List[str]) -> Optional[str] """ Are these versions different by a .1 patch level? This is crazy common in the wild. :param version_list: :return: """ version_list = list(set(version_list)) t...
[ "def", "almost_the_same_version", "(", "self", ",", "version_list", ")", ":", "# type: (List[str]) -> Optional[str]", "version_list", "=", "list", "(", "set", "(", "version_list", ")", ")", "try", ":", "sem_ver_list", "=", "list", "(", "set", "(", "[", "unicode"...
Are these versions different by a .1 patch level? This is crazy common in the wild. :param version_list: :return:
[ "Are", "these", "versions", "different", "by", "a", ".", "1", "patch", "level?", "This", "is", "crazy", "common", "in", "the", "wild", ".", ":", "param", "version_list", ":", ":", "return", ":" ]
train
https://github.com/matthewdeanmartin/jiggle_version/blob/963656a0a47b7162780a5f6c8f4b8bbbebc148f5/jiggle_version/find_version_class.py#L157-L184
matthewdeanmartin/jiggle_version
jiggle_version/find_version_class.py
FindVersion.validate_current_versions
def validate_current_versions(self): # type: () -> bool """ Can a version be found? Are all versions currently the same? Are they valid sem ver? :return: """ versions = self.all_current_versions() for _, version in versions.items(): if "Invalid Semantic Versi...
python
def validate_current_versions(self): # type: () -> bool """ Can a version be found? Are all versions currently the same? Are they valid sem ver? :return: """ versions = self.all_current_versions() for _, version in versions.items(): if "Invalid Semantic Versi...
[ "def", "validate_current_versions", "(", "self", ")", ":", "# type: () -> bool", "versions", "=", "self", ".", "all_current_versions", "(", ")", "for", "_", ",", "version", "in", "versions", ".", "items", "(", ")", ":", "if", "\"Invalid Semantic Version\"", "in"...
Can a version be found? Are all versions currently the same? Are they valid sem ver? :return:
[ "Can", "a", "version", "be", "found?", "Are", "all", "versions", "currently", "the", "same?", "Are", "they", "valid", "sem", "ver?", ":", "return", ":" ]
train
https://github.com/matthewdeanmartin/jiggle_version/blob/963656a0a47b7162780a5f6c8f4b8bbbebc148f5/jiggle_version/find_version_class.py#L186-L214
matthewdeanmartin/jiggle_version
jiggle_version/find_version_class.py
FindVersion.version_by_eval
def version_by_eval(self, file_path): # type: (str) ->Dict[str,str] """ Version by ast evaluation. Didn't find more versions that existing methods :param file_path: :return: """ source = self.file_opener.read_this(file_path) sb = "{" for line in source.sp...
python
def version_by_eval(self, file_path): # type: (str) ->Dict[str,str] """ Version by ast evaluation. Didn't find more versions that existing methods :param file_path: :return: """ source = self.file_opener.read_this(file_path) sb = "{" for line in source.sp...
[ "def", "version_by_eval", "(", "self", ",", "file_path", ")", ":", "# type: (str) ->Dict[str,str]", "source", "=", "self", ".", "file_opener", ".", "read_this", "(", "file_path", ")", "sb", "=", "\"{\"", "for", "line", "in", "source", ".", "split", "(", "\"\...
Version by ast evaluation. Didn't find more versions that existing methods :param file_path: :return:
[ "Version", "by", "ast", "evaluation", ".", "Didn", "t", "find", "more", "versions", "that", "existing", "methods", ":", "param", "file_path", ":", ":", "return", ":" ]
train
https://github.com/matthewdeanmartin/jiggle_version/blob/963656a0a47b7162780a5f6c8f4b8bbbebc148f5/jiggle_version/find_version_class.py#L216-L238
matthewdeanmartin/jiggle_version
jiggle_version/find_version_class.py
FindVersion.version_by_import
def version_by_import(self, module_name): # type: (str) ->Dict[str,str] """ This is slow & if running against random code, dangerous Sometimes apps call exit() in import if conditions not met. :param module_name: :return: """ if not module_name: retu...
python
def version_by_import(self, module_name): # type: (str) ->Dict[str,str] """ This is slow & if running against random code, dangerous Sometimes apps call exit() in import if conditions not met. :param module_name: :return: """ if not module_name: retu...
[ "def", "version_by_import", "(", "self", ",", "module_name", ")", ":", "# type: (str) ->Dict[str,str]", "if", "not", "module_name", ":", "return", "{", "}", "try", ":", "module", "=", "__import__", "(", "module_name", ")", "except", "ModuleNotFoundError", ":", "...
This is slow & if running against random code, dangerous Sometimes apps call exit() in import if conditions not met. :param module_name: :return:
[ "This", "is", "slow", "&", "if", "running", "against", "random", "code", "dangerous" ]
train
https://github.com/matthewdeanmartin/jiggle_version/blob/963656a0a47b7162780a5f6c8f4b8bbbebc148f5/jiggle_version/find_version_class.py#L240-L261
matthewdeanmartin/jiggle_version
jiggle_version/find_version_class.py
FindVersion.all_current_versions
def all_current_versions(self): # type: () ->Dict[str,str] """ Track down all the versions & compile into one dictionary :return: """ if self.PROJECT is None: raise TypeError("self.PROJECT missing, can't continue") versions = {} # type: Dict[str,str] ...
python
def all_current_versions(self): # type: () ->Dict[str,str] """ Track down all the versions & compile into one dictionary :return: """ if self.PROJECT is None: raise TypeError("self.PROJECT missing, can't continue") versions = {} # type: Dict[str,str] ...
[ "def", "all_current_versions", "(", "self", ")", ":", "# type: () ->Dict[str,str]", "if", "self", ".", "PROJECT", "is", "None", ":", "raise", "TypeError", "(", "\"self.PROJECT missing, can't continue\"", ")", "versions", "=", "{", "}", "# type: Dict[str,str]", "files_...
Track down all the versions & compile into one dictionary :return:
[ "Track", "down", "all", "the", "versions", "&", "compile", "into", "one", "dictionary", ":", "return", ":" ]
train
https://github.com/matthewdeanmartin/jiggle_version/blob/963656a0a47b7162780a5f6c8f4b8bbbebc148f5/jiggle_version/find_version_class.py#L263-L346
matthewdeanmartin/jiggle_version
jiggle_version/find_version_class.py
FindVersion.all_versions_equal
def all_versions_equal(self, versions): # type: (Dict[str,str]) -> bool """ Verify that all the versions are the same. :param versions: :return: """ if len(versions) <= 1: return True semver = None for key, version in versions.items(): ...
python
def all_versions_equal(self, versions): # type: (Dict[str,str]) -> bool """ Verify that all the versions are the same. :param versions: :return: """ if len(versions) <= 1: return True semver = None for key, version in versions.items(): ...
[ "def", "all_versions_equal", "(", "self", ",", "versions", ")", ":", "# type: (Dict[str,str]) -> bool", "if", "len", "(", "versions", ")", "<=", "1", ":", "return", "True", "semver", "=", "None", "for", "key", ",", "version", "in", "versions", ".", "items", ...
Verify that all the versions are the same. :param versions: :return:
[ "Verify", "that", "all", "the", "versions", "are", "the", "same", ".", ":", "param", "versions", ":", ":", "return", ":" ]
train
https://github.com/matthewdeanmartin/jiggle_version/blob/963656a0a47b7162780a5f6c8f4b8bbbebc148f5/jiggle_version/find_version_class.py#L361-L385
matthewdeanmartin/jiggle_version
jiggle_version/find_version_class.py
FindVersion.read_setup_py
def read_setup_py(self): # type: ()-> Dict[str,str] """ Extract from setup.py's setup() arg list. :return: """ found = {} # type: Dict[str,str] setup_py = os.path.join("setup.py") if not os.path.isfile(setup_py): if self.strict: logg...
python
def read_setup_py(self): # type: ()-> Dict[str,str] """ Extract from setup.py's setup() arg list. :return: """ found = {} # type: Dict[str,str] setup_py = os.path.join("setup.py") if not os.path.isfile(setup_py): if self.strict: logg...
[ "def", "read_setup_py", "(", "self", ")", ":", "# type: ()-> Dict[str,str]", "found", "=", "{", "}", "# type: Dict[str,str]", "setup_py", "=", "os", ".", "path", ".", "join", "(", "\"setup.py\"", ")", "if", "not", "os", ".", "path", ".", "isfile", "(", "se...
Extract from setup.py's setup() arg list. :return:
[ "Extract", "from", "setup", ".", "py", "s", "setup", "()", "arg", "list", ".", ":", "return", ":" ]
train
https://github.com/matthewdeanmartin/jiggle_version/blob/963656a0a47b7162780a5f6c8f4b8bbbebc148f5/jiggle_version/find_version_class.py#L387-L431
matthewdeanmartin/jiggle_version
jiggle_version/find_version_class.py
FindVersion.read_text
def read_text(self): # type: () ->Dict[str,str] """ Get version out of ad-hoc version.txt :return: """ found = {} for file in self.file_inventory.text_files: if not os.path.isfile(file): continue with self.file_opener.open_this(fil...
python
def read_text(self): # type: () ->Dict[str,str] """ Get version out of ad-hoc version.txt :return: """ found = {} for file in self.file_inventory.text_files: if not os.path.isfile(file): continue with self.file_opener.open_this(fil...
[ "def", "read_text", "(", "self", ")", ":", "# type: () ->Dict[str,str]", "found", "=", "{", "}", "for", "file", "in", "self", ".", "file_inventory", ".", "text_files", ":", "if", "not", "os", ".", "path", ".", "isfile", "(", "file", ")", ":", "continue",...
Get version out of ad-hoc version.txt :return:
[ "Get", "version", "out", "of", "ad", "-", "hoc", "version", ".", "txt", ":", "return", ":" ]
train
https://github.com/matthewdeanmartin/jiggle_version/blob/963656a0a47b7162780a5f6c8f4b8bbbebc148f5/jiggle_version/find_version_class.py#L433-L445
matthewdeanmartin/jiggle_version
jiggle_version/find_version_class.py
FindVersion.read_metadata
def read_metadata(self): # type: () ->Dict[str,str] """ Get version out of a .ini file (or .cfg) :return: """ config = configparser.ConfigParser() config.read(self.file_inventory.config_files[0]) try: return {"setup.cfg": config["metadata"]["version"]...
python
def read_metadata(self): # type: () ->Dict[str,str] """ Get version out of a .ini file (or .cfg) :return: """ config = configparser.ConfigParser() config.read(self.file_inventory.config_files[0]) try: return {"setup.cfg": config["metadata"]["version"]...
[ "def", "read_metadata", "(", "self", ")", ":", "# type: () ->Dict[str,str]", "config", "=", "configparser", ".", "ConfigParser", "(", ")", "config", ".", "read", "(", "self", ".", "file_inventory", ".", "config_files", "[", "0", "]", ")", "try", ":", "return...
Get version out of a .ini file (or .cfg) :return:
[ "Get", "version", "out", "of", "a", ".", "ini", "file", "(", "or", ".", "cfg", ")", ":", "return", ":" ]
train
https://github.com/matthewdeanmartin/jiggle_version/blob/963656a0a47b7162780a5f6c8f4b8bbbebc148f5/jiggle_version/find_version_class.py#L447-L457
matthewdeanmartin/jiggle_version
jiggle_version/find_version_class.py
FindVersion.find_dunder_version_in_file
def find_dunder_version_in_file(self, full_path): # type: (str)-> Dict[str,str] """ Find __version__ in a source file :param full_path: :return: """ versions = {} with self.file_opener.open_this(full_path, "r") as infile: for line in infile: ...
python
def find_dunder_version_in_file(self, full_path): # type: (str)-> Dict[str,str] """ Find __version__ in a source file :param full_path: :return: """ versions = {} with self.file_opener.open_this(full_path, "r") as infile: for line in infile: ...
[ "def", "find_dunder_version_in_file", "(", "self", ",", "full_path", ")", ":", "# type: (str)-> Dict[str,str]", "versions", "=", "{", "}", "with", "self", ".", "file_opener", ".", "open_this", "(", "full_path", ",", "\"r\"", ")", "as", "infile", ":", "for", "l...
Find __version__ in a source file :param full_path: :return:
[ "Find", "__version__", "in", "a", "source", "file", ":", "param", "full_path", ":", ":", "return", ":" ]
train
https://github.com/matthewdeanmartin/jiggle_version/blob/963656a0a47b7162780a5f6c8f4b8bbbebc148f5/jiggle_version/find_version_class.py#L459-L473
matthewdeanmartin/jiggle_version
jiggle_version/find_version_class.py
FindVersion.version_to_write
def version_to_write(self, found): # type: (str) -> Version """ Take 1st version string found. :param found: possible version string :return: """ first = False if self.version is None: first = True try: self.current_version...
python
def version_to_write(self, found): # type: (str) -> Version """ Take 1st version string found. :param found: possible version string :return: """ first = False if self.version is None: first = True try: self.current_version...
[ "def", "version_to_write", "(", "self", ",", "found", ")", ":", "# type: (str) -> Version", "first", "=", "False", "if", "self", ".", "version", "is", "None", ":", "first", "=", "True", "try", ":", "self", ".", "current_version", ",", "self", ".", "version...
Take 1st version string found. :param found: possible version string :return:
[ "Take", "1st", "version", "string", "found", ".", ":", "param", "found", ":", "possible", "version", "string", ":", "return", ":" ]
train
https://github.com/matthewdeanmartin/jiggle_version/blob/963656a0a47b7162780a5f6c8f4b8bbbebc148f5/jiggle_version/find_version_class.py#L475-L497
matthewdeanmartin/jiggle_version
jiggle_version/find_version_class.py
FindVersion.execute_setup
def execute_setup(self): # type: () -> Dict[str,str] """ for really surprising things like a dict foo in setup(**foo) consider python3 setup.py --version :return: """ ver = execute_get_text("python setup.py --version") if not ver: return None ...
python
def execute_setup(self): # type: () -> Dict[str,str] """ for really surprising things like a dict foo in setup(**foo) consider python3 setup.py --version :return: """ ver = execute_get_text("python setup.py --version") if not ver: return None ...
[ "def", "execute_setup", "(", "self", ")", ":", "# type: () -> Dict[str,str]", "ver", "=", "execute_get_text", "(", "\"python setup.py --version\"", ")", "if", "not", "ver", ":", "return", "None", "if", "\"UserWarning\"", "in", "ver", ":", "logger", ".", "warning",...
for really surprising things like a dict foo in setup(**foo) consider python3 setup.py --version :return:
[ "for", "really", "surprising", "things", "like", "a", "dict", "foo", "in", "setup", "(", "**", "foo", ")", "consider", "python3", "setup", ".", "py", "--", "version", ":", "return", ":" ]
train
https://github.com/matthewdeanmartin/jiggle_version/blob/963656a0a47b7162780a5f6c8f4b8bbbebc148f5/jiggle_version/find_version_class.py#L499-L524
caseyjlaw/activegit
activegit/cli.py
initrepo
def initrepo(repopath, bare, shared): """ Initialize an activegit repo. Default makes base shared repo that should be cloned for users """ ag = activegit.ActiveGit(repopath, bare=bare, shared=shared)
python
def initrepo(repopath, bare, shared): """ Initialize an activegit repo. Default makes base shared repo that should be cloned for users """ ag = activegit.ActiveGit(repopath, bare=bare, shared=shared)
[ "def", "initrepo", "(", "repopath", ",", "bare", ",", "shared", ")", ":", "ag", "=", "activegit", ".", "ActiveGit", "(", "repopath", ",", "bare", "=", "bare", ",", "shared", "=", "shared", ")" ]
Initialize an activegit repo. Default makes base shared repo that should be cloned for users
[ "Initialize", "an", "activegit", "repo", ".", "Default", "makes", "base", "shared", "repo", "that", "should", "be", "cloned", "for", "users" ]
train
https://github.com/caseyjlaw/activegit/blob/2b4a0ee0fecf13345b5257130ba98b48f46e1098/activegit/cli.py#L9-L13
caseyjlaw/activegit
activegit/cli.py
clonerepo
def clonerepo(barerepo, userrepo): """ Clone a bare base repo to a user """ git.clone(barerepo, userrepo) ag = activegit.ActiveGit(userrepo)
python
def clonerepo(barerepo, userrepo): """ Clone a bare base repo to a user """ git.clone(barerepo, userrepo) ag = activegit.ActiveGit(userrepo)
[ "def", "clonerepo", "(", "barerepo", ",", "userrepo", ")", ":", "git", ".", "clone", "(", "barerepo", ",", "userrepo", ")", "ag", "=", "activegit", ".", "ActiveGit", "(", "userrepo", ")" ]
Clone a bare base repo to a user
[ "Clone", "a", "bare", "base", "repo", "to", "a", "user" ]
train
https://github.com/caseyjlaw/activegit/blob/2b4a0ee0fecf13345b5257130ba98b48f46e1098/activegit/cli.py#L19-L23
rosenbrockc/acorn
acorn/msg.py
example
def example(script, explain, contents, requirements, output, outputfmt, details): """Prints the example help for the script.""" blank() cprint(script.upper(), "yellow") cprint(''.join(["=" for i in range(70)]) + '\n', "yellow") cprint("DETAILS", "blue") std(explain + '\n') cprint(requireme...
python
def example(script, explain, contents, requirements, output, outputfmt, details): """Prints the example help for the script.""" blank() cprint(script.upper(), "yellow") cprint(''.join(["=" for i in range(70)]) + '\n', "yellow") cprint("DETAILS", "blue") std(explain + '\n') cprint(requireme...
[ "def", "example", "(", "script", ",", "explain", ",", "contents", ",", "requirements", ",", "output", ",", "outputfmt", ",", "details", ")", ":", "blank", "(", ")", "cprint", "(", "script", ".", "upper", "(", ")", ",", "\"yellow\"", ")", "cprint", "(",...
Prints the example help for the script.
[ "Prints", "the", "example", "help", "for", "the", "script", "." ]
train
https://github.com/rosenbrockc/acorn/blob/9a44d1a1ad8bfc2c54a6b56d9efe54433a797820/acorn/msg.py#L42-L70
twidi/py-dataql
dataql/solvers/registry.py
EntryPoints
def EntryPoints(registry, **kwargs): """Returns an object to use as entry point when calling ``registry.solve_resource``. When calling ``registry.solve_resource`` on a "root" resource, we don't have any value. This function will create a object to use as a first value and is used to specify which entry...
python
def EntryPoints(registry, **kwargs): """Returns an object to use as entry point when calling ``registry.solve_resource``. When calling ``registry.solve_resource`` on a "root" resource, we don't have any value. This function will create a object to use as a first value and is used to specify which entry...
[ "def", "EntryPoints", "(", "registry", ",", "*", "*", "kwargs", ")", ":", "# We convert functions to staticmethod as they will be held by a class and", "# we don't want them to expect a ``self`` or ``cls`` argument.", "attrs", "=", "{", "k", ":", "(", "staticmethod", "(", "v"...
Returns an object to use as entry point when calling ``registry.solve_resource``. When calling ``registry.solve_resource`` on a "root" resource, we don't have any value. This function will create a object to use as a first value and is used to specify which entry points are allowed at the first level of a ...
[ "Returns", "an", "object", "to", "use", "as", "entry", "point", "when", "calling", "registry", ".", "solve_resource", "." ]
train
https://github.com/twidi/py-dataql/blob/5841a3fd559829193ed709c255166085bdde1c52/dataql/solvers/registry.py#L571-L613
twidi/py-dataql
dataql/solvers/registry.py
Attribute.solve
def solve(self, value, args=None, kwargs=None): """Try to get the current attribute/function result for the given value. If ``args`` or ``kwargs`` are passed, the attribute got from ``value`` must be callable. They will be passed anyway (using ``[]`` and ``{}`` as default values) if the attribu...
python
def solve(self, value, args=None, kwargs=None): """Try to get the current attribute/function result for the given value. If ``args`` or ``kwargs`` are passed, the attribute got from ``value`` must be callable. They will be passed anyway (using ``[]`` and ``{}`` as default values) if the attribu...
[ "def", "solve", "(", "self", ",", "value", ",", "args", "=", "None", ",", "kwargs", "=", "None", ")", ":", "# If we have a function, apply this, using the value as first argument,", "# then args and kwargs.", "if", "self", ".", "function", ":", "try", ":", "return",...
Try to get the current attribute/function result for the given value. If ``args`` or ``kwargs`` are passed, the attribute got from ``value`` must be callable. They will be passed anyway (using ``[]`` and ``{}`` as default values) if the attribute is a function. And if it's not a functi...
[ "Try", "to", "get", "the", "current", "attribute", "/", "function", "result", "for", "the", "given", "value", "." ]
train
https://github.com/twidi/py-dataql/blob/5841a3fd559829193ed709c255166085bdde1c52/dataql/solvers/registry.py#L97-L308
twidi/py-dataql
dataql/solvers/registry.py
Source.solve
def solve(self, value, attribute, args=None, kwargs=None): """Try to get the given attribute/function result for the given value. If ``args`` or ``kwargs`` are passed, the attribute got from ``value`` must be callable. They will be passed anyway (using ``[]`` and ``{}`` as default values) if th...
python
def solve(self, value, attribute, args=None, kwargs=None): """Try to get the given attribute/function result for the given value. If ``args`` or ``kwargs`` are passed, the attribute got from ``value`` must be callable. They will be passed anyway (using ``[]`` and ``{}`` as default values) if th...
[ "def", "solve", "(", "self", ",", "value", ",", "attribute", ",", "args", "=", "None", ",", "kwargs", "=", "None", ")", ":", "if", "not", "isinstance", "(", "value", ",", "self", ".", "source", ")", "and", "(", "not", "self", ".", "allow_class", "o...
Try to get the given attribute/function result for the given value. If ``args`` or ``kwargs`` are passed, the attribute got from ``value`` must be callable. They will be passed anyway (using ``[]`` and ``{}`` as default values) if the attribute is a function. Arguments --------...
[ "Try", "to", "get", "the", "given", "attribute", "/", "function", "result", "for", "the", "given", "value", "." ]
train
https://github.com/twidi/py-dataql/blob/5841a3fd559829193ed709c255166085bdde1c52/dataql/solvers/registry.py#L745-L820
twidi/py-dataql
dataql/solvers/registry.py
Registry.register
def register(self, source, attributes=None, allow_class=False, allow_subclasses=True, propagate_attributes=True, inherit_attributes=True): """Register a source class with its attributes. Arguments --------- source : type Must be a class for which we want to ...
python
def register(self, source, attributes=None, allow_class=False, allow_subclasses=True, propagate_attributes=True, inherit_attributes=True): """Register a source class with its attributes. Arguments --------- source : type Must be a class for which we want to ...
[ "def", "register", "(", "self", ",", "source", ",", "attributes", "=", "None", ",", "allow_class", "=", "False", ",", "allow_subclasses", "=", "True", ",", "propagate_attributes", "=", "True", ",", "inherit_attributes", "=", "True", ")", ":", "if", "source",...
Register a source class with its attributes. Arguments --------- source : type Must be a class for which we want to allow access to only the given attributes. attributes : iterable[str] / Attributes, optional A list (or other iterable) of string representing the ...
[ "Register", "a", "source", "class", "with", "its", "attributes", "." ]
train
https://github.com/twidi/py-dataql/blob/5841a3fd559829193ed709c255166085bdde1c52/dataql/solvers/registry.py#L908-L988
twidi/py-dataql
dataql/solvers/registry.py
Registry.get_resource_solvers
def get_resource_solvers(self, resource): """Returns the resource solvers that can solve the given resource. Arguments --------- resource : dataql.resources.Resource An instance of a subclass of ``Resource`` for which we want to get the solver classes that can so...
python
def get_resource_solvers(self, resource): """Returns the resource solvers that can solve the given resource. Arguments --------- resource : dataql.resources.Resource An instance of a subclass of ``Resource`` for which we want to get the solver classes that can so...
[ "def", "get_resource_solvers", "(", "self", ",", "resource", ")", ":", "solvers_classes", "=", "[", "s", "for", "s", "in", "self", ".", "resource_solver_classes", "if", "s", ".", "can_solve", "(", "resource", ")", "]", "if", "solvers_classes", ":", "solvers"...
Returns the resource solvers that can solve the given resource. Arguments --------- resource : dataql.resources.Resource An instance of a subclass of ``Resource`` for which we want to get the solver classes that can solve it. Returns ------- list...
[ "Returns", "the", "resource", "solvers", "that", "can", "solve", "the", "given", "resource", "." ]
train
https://github.com/twidi/py-dataql/blob/5841a3fd559829193ed709c255166085bdde1c52/dataql/solvers/registry.py#L1104-L1153
twidi/py-dataql
dataql/solvers/registry.py
Registry.get_filter_solvers
def get_filter_solvers(self, filter_): """Returns the filter solvers that can solve the given filter. Arguments --------- filter : dataql.resources.BaseFilter An instance of the a subclass of ``BaseFilter`` for which we want to get the solver classes that can sol...
python
def get_filter_solvers(self, filter_): """Returns the filter solvers that can solve the given filter. Arguments --------- filter : dataql.resources.BaseFilter An instance of the a subclass of ``BaseFilter`` for which we want to get the solver classes that can sol...
[ "def", "get_filter_solvers", "(", "self", ",", "filter_", ")", ":", "solvers_classes", "=", "[", "s", "for", "s", "in", "self", ".", "filter_solver_classes", "if", "s", ".", "can_solve", "(", "filter_", ")", "]", "if", "solvers_classes", ":", "solvers", "=...
Returns the filter solvers that can solve the given filter. Arguments --------- filter : dataql.resources.BaseFilter An instance of the a subclass of ``BaseFilter`` for which we want to get the solver classes that can solve it. Returns ------- li...
[ "Returns", "the", "filter", "solvers", "that", "can", "solve", "the", "given", "filter", "." ]
train
https://github.com/twidi/py-dataql/blob/5841a3fd559829193ed709c255166085bdde1c52/dataql/solvers/registry.py#L1155-L1202
twidi/py-dataql
dataql/solvers/registry.py
Registry.solve_resource
def solve_resource(self, value, resource): """Solve the given resource for the given value. The solving is done by the first resource solver class that returns ``True`` when calling its ``can_solve`` method for the given resource, and that doesn't raise a ``CannotSolve`` exception. ...
python
def solve_resource(self, value, resource): """Solve the given resource for the given value. The solving is done by the first resource solver class that returns ``True`` when calling its ``can_solve`` method for the given resource, and that doesn't raise a ``CannotSolve`` exception. ...
[ "def", "solve_resource", "(", "self", ",", "value", ",", "resource", ")", ":", "for", "solver", "in", "self", ".", "get_resource_solvers", "(", "resource", ")", ":", "try", ":", "return", "solver", ".", "solve", "(", "value", ",", "resource", ")", "excep...
Solve the given resource for the given value. The solving is done by the first resource solver class that returns ``True`` when calling its ``can_solve`` method for the given resource, and that doesn't raise a ``CannotSolve`` exception. Arguments --------- value : ? ...
[ "Solve", "the", "given", "resource", "for", "the", "given", "value", "." ]
train
https://github.com/twidi/py-dataql/blob/5841a3fd559829193ed709c255166085bdde1c52/dataql/solvers/registry.py#L1204-L1334
twidi/py-dataql
dataql/solvers/registry.py
Registry.solve_filter
def solve_filter(self, value, filter_): """Solve the given filter for the given value. The solving is done by the first filter solver class that returns ``True`` when calling its ``can_solve`` method for the given filter, and that doesn't raise a ``CannotSolve`` exception. Arg...
python
def solve_filter(self, value, filter_): """Solve the given filter for the given value. The solving is done by the first filter solver class that returns ``True`` when calling its ``can_solve`` method for the given filter, and that doesn't raise a ``CannotSolve`` exception. Arg...
[ "def", "solve_filter", "(", "self", ",", "value", ",", "filter_", ")", ":", "for", "solver", "in", "self", ".", "get_filter_solvers", "(", "filter_", ")", ":", "try", ":", "return", "solver", ".", "solve", "(", "value", ",", "filter_", ")", "except", "...
Solve the given filter for the given value. The solving is done by the first filter solver class that returns ``True`` when calling its ``can_solve`` method for the given filter, and that doesn't raise a ``CannotSolve`` exception. Arguments --------- value : ? ...
[ "Solve", "the", "given", "filter", "for", "the", "given", "value", "." ]
train
https://github.com/twidi/py-dataql/blob/5841a3fd559829193ed709c255166085bdde1c52/dataql/solvers/registry.py#L1336-L1387
collectiveacuity/labPack
labpack/messaging/twilio.py
twilioClient.send_message
def send_message(self, phone_number, message_text): ''' send an SMS from the Twilio account to phone number :param phone_number: string with phone number with country and area code :param message_text: string with message text :return: dictionary with details of response ...
python
def send_message(self, phone_number, message_text): ''' send an SMS from the Twilio account to phone number :param phone_number: string with phone number with country and area code :param message_text: string with message text :return: dictionary with details of response ...
[ "def", "send_message", "(", "self", ",", "phone_number", ",", "message_text", ")", ":", "response", "=", "self", ".", "client", ".", "messages", ".", "save", "(", "to", "=", "phone_number", ",", "from_", "=", "self", ".", "twilio_phone", ",", "body", "="...
send an SMS from the Twilio account to phone number :param phone_number: string with phone number with country and area code :param message_text: string with message text :return: dictionary with details of response { 'direction': 'outbound-api', 'to': '...
[ "send", "an", "SMS", "from", "the", "Twilio", "account", "to", "phone", "number", ":", "param", "phone_number", ":", "string", "with", "phone", "number", "with", "country", "and", "area", "code", ":", "param", "message_text", ":", "string", "with", "message"...
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/messaging/twilio.py#L20-L61
edeposit/edeposit.amqp.ftp
bin/edeposit_proftpd_init.py
add_or_update
def add_or_update(data, item, value): """ Add or update value in configuration file format used by proftpd. Args: data (str): Configuration file as string. item (str): What option will be added/updated. value (str): Value of option. Returns: str: updated configuration ...
python
def add_or_update(data, item, value): """ Add or update value in configuration file format used by proftpd. Args: data (str): Configuration file as string. item (str): What option will be added/updated. value (str): Value of option. Returns: str: updated configuration ...
[ "def", "add_or_update", "(", "data", ",", "item", ",", "value", ")", ":", "data", "=", "data", ".", "splitlines", "(", ")", "# to list of bytearrays (this is useful, because their reference passed to", "# other functions can be changed, and it will change objects in arrays", "#...
Add or update value in configuration file format used by proftpd. Args: data (str): Configuration file as string. item (str): What option will be added/updated. value (str): Value of option. Returns: str: updated configuration
[ "Add", "or", "update", "value", "in", "configuration", "file", "format", "used", "by", "proftpd", "." ]
train
https://github.com/edeposit/edeposit.amqp.ftp/blob/fcdcbffb6e5d194e1bb4f85f0b8eaa9dbb08aa71/bin/edeposit_proftpd_init.py#L290-L330
edeposit/edeposit.amqp.ftp
bin/edeposit_proftpd_init.py
comment
def comment(data, what): """ Comments line containing `what` in string `data`. Args: data (str): Configuration file in string. what (str): Line which will be commented out. Returns: str: Configuration file with commented `what`. """ data = data.splitlines() data = ...
python
def comment(data, what): """ Comments line containing `what` in string `data`. Args: data (str): Configuration file in string. what (str): Line which will be commented out. Returns: str: Configuration file with commented `what`. """ data = data.splitlines() data = ...
[ "def", "comment", "(", "data", ",", "what", ")", ":", "data", "=", "data", ".", "splitlines", "(", ")", "data", "=", "map", "(", "lambda", "x", ":", "\"#\"", "+", "x", "if", "x", ".", "strip", "(", ")", ".", "split", "(", ")", "==", "what", "...
Comments line containing `what` in string `data`. Args: data (str): Configuration file in string. what (str): Line which will be commented out. Returns: str: Configuration file with commented `what`.
[ "Comments", "line", "containing", "what", "in", "string", "data", "." ]
train
https://github.com/edeposit/edeposit.amqp.ftp/blob/fcdcbffb6e5d194e1bb4f85f0b8eaa9dbb08aa71/bin/edeposit_proftpd_init.py#L333-L351
edeposit/edeposit.amqp.ftp
bin/edeposit_proftpd_init.py
_write_conf_file
def _write_conf_file(): """ Write configuration file as it is defined in settings. """ with open(CONF_FILE, "w") as f: f.write(DEFAULT_PROFTPD_CONF) logger.debug("'%s' created.", CONF_FILE)
python
def _write_conf_file(): """ Write configuration file as it is defined in settings. """ with open(CONF_FILE, "w") as f: f.write(DEFAULT_PROFTPD_CONF) logger.debug("'%s' created.", CONF_FILE)
[ "def", "_write_conf_file", "(", ")", ":", "with", "open", "(", "CONF_FILE", ",", "\"w\"", ")", "as", "f", ":", "f", ".", "write", "(", "DEFAULT_PROFTPD_CONF", ")", "logger", ".", "debug", "(", "\"'%s' created.\"", ",", "CONF_FILE", ")" ]
Write configuration file as it is defined in settings.
[ "Write", "configuration", "file", "as", "it", "is", "defined", "in", "settings", "." ]
train
https://github.com/edeposit/edeposit.amqp.ftp/blob/fcdcbffb6e5d194e1bb4f85f0b8eaa9dbb08aa71/bin/edeposit_proftpd_init.py#L361-L367
edeposit/edeposit.amqp.ftp
bin/edeposit_proftpd_init.py
main
def main(overwrite): """ Used to create configuration files, set permissions and so on. """ logger.debug("Checking existence of '%s'.", CONF_PATH) if not os.path.exists(CONF_PATH): logger.debug("Directory %s not found! Panicking..", CONF_PATH) raise UserWarning( "Can't fi...
python
def main(overwrite): """ Used to create configuration files, set permissions and so on. """ logger.debug("Checking existence of '%s'.", CONF_PATH) if not os.path.exists(CONF_PATH): logger.debug("Directory %s not found! Panicking..", CONF_PATH) raise UserWarning( "Can't fi...
[ "def", "main", "(", "overwrite", ")", ":", "logger", ".", "debug", "(", "\"Checking existence of '%s'.\"", ",", "CONF_PATH", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "CONF_PATH", ")", ":", "logger", ".", "debug", "(", "\"Directory %s not foun...
Used to create configuration files, set permissions and so on.
[ "Used", "to", "create", "configuration", "files", "set", "permissions", "and", "so", "on", "." ]
train
https://github.com/edeposit/edeposit.amqp.ftp/blob/fcdcbffb6e5d194e1bb4f85f0b8eaa9dbb08aa71/bin/edeposit_proftpd_init.py#L371-L479
callowayproject/Transmogrify
transmogrify/geometry.py
Point.integerize
def integerize(self): """Convert co-ordinate values to integers.""" self.x = int(round(self.x)) self.y = int(round(self.y))
python
def integerize(self): """Convert co-ordinate values to integers.""" self.x = int(round(self.x)) self.y = int(round(self.y))
[ "def", "integerize", "(", "self", ")", ":", "self", ".", "x", "=", "int", "(", "round", "(", "self", ".", "x", ")", ")", "self", ".", "y", "=", "int", "(", "round", "(", "self", ".", "y", ")", ")" ]
Convert co-ordinate values to integers.
[ "Convert", "co", "-", "ordinate", "values", "to", "integers", "." ]
train
https://github.com/callowayproject/Transmogrify/blob/f1f891b8b923b3a1ede5eac7f60531c1c472379e/transmogrify/geometry.py#L113-L116
callowayproject/Transmogrify
transmogrify/geometry.py
Point.floatize
def floatize(self): """Convert co-ordinate values to floats.""" self.x = float(self.x) self.y = float(self.y)
python
def floatize(self): """Convert co-ordinate values to floats.""" self.x = float(self.x) self.y = float(self.y)
[ "def", "floatize", "(", "self", ")", ":", "self", ".", "x", "=", "float", "(", "self", ".", "x", ")", "self", ".", "y", "=", "float", "(", "self", ".", "y", ")" ]
Convert co-ordinate values to floats.
[ "Convert", "co", "-", "ordinate", "values", "to", "floats", "." ]
train
https://github.com/callowayproject/Transmogrify/blob/f1f891b8b923b3a1ede5eac7f60531c1c472379e/transmogrify/geometry.py#L118-L121
callowayproject/Transmogrify
transmogrify/geometry.py
Point.translate
def translate(self, val1, val2=None): """ Move to new (x + dx, y + dy). accepts Point, (x, y), [x, y], int, float """ error = "Point.translate only accepts a Point, a tuple, a list, ints or floats." if val1 and val2: if isinstance(val1, (int, float)) and isin...
python
def translate(self, val1, val2=None): """ Move to new (x + dx, y + dy). accepts Point, (x, y), [x, y], int, float """ error = "Point.translate only accepts a Point, a tuple, a list, ints or floats." if val1 and val2: if isinstance(val1, (int, float)) and isin...
[ "def", "translate", "(", "self", ",", "val1", ",", "val2", "=", "None", ")", ":", "error", "=", "\"Point.translate only accepts a Point, a tuple, a list, ints or floats.\"", "if", "val1", "and", "val2", ":", "if", "isinstance", "(", "val1", ",", "(", "int", ",",...
Move to new (x + dx, y + dy). accepts Point, (x, y), [x, y], int, float
[ "Move", "to", "new", "(", "x", "+", "dx", "y", "+", "dy", ")", "." ]
train
https://github.com/callowayproject/Transmogrify/blob/f1f891b8b923b3a1ede5eac7f60531c1c472379e/transmogrify/geometry.py#L130-L156
callowayproject/Transmogrify
transmogrify/geometry.py
Point.rotate
def rotate(self, rad): """ Rotate counter-clockwise by rad radians. Positive y goes *up,* as in traditional mathematics. Interestingly, you can use this in y-down computer graphics, if you just remember that it turns clockwise, rather than counter-clockwise. Th...
python
def rotate(self, rad): """ Rotate counter-clockwise by rad radians. Positive y goes *up,* as in traditional mathematics. Interestingly, you can use this in y-down computer graphics, if you just remember that it turns clockwise, rather than counter-clockwise. Th...
[ "def", "rotate", "(", "self", ",", "rad", ")", ":", "s", ",", "c", "=", "[", "f", "(", "rad", ")", "for", "f", "in", "(", "math", ".", "sin", ",", "math", ".", "cos", ")", "]", "x", ",", "y", "=", "(", "c", "*", "self", ".", "x", "-", ...
Rotate counter-clockwise by rad radians. Positive y goes *up,* as in traditional mathematics. Interestingly, you can use this in y-down computer graphics, if you just remember that it turns clockwise, rather than counter-clockwise. The new position is returned as a new Point.
[ "Rotate", "counter", "-", "clockwise", "by", "rad", "radians", "." ]
train
https://github.com/callowayproject/Transmogrify/blob/f1f891b8b923b3a1ede5eac7f60531c1c472379e/transmogrify/geometry.py#L158-L172
callowayproject/Transmogrify
transmogrify/geometry.py
Point.rotate_about
def rotate_about(self, p, theta): """ Rotate counter-clockwise around a point, by theta degrees. Positive y goes *up,* as in traditional mathematics. The new position is returned as a new Point. """ result = self.clone() result.translate(-p.x, -p.y) resu...
python
def rotate_about(self, p, theta): """ Rotate counter-clockwise around a point, by theta degrees. Positive y goes *up,* as in traditional mathematics. The new position is returned as a new Point. """ result = self.clone() result.translate(-p.x, -p.y) resu...
[ "def", "rotate_about", "(", "self", ",", "p", ",", "theta", ")", ":", "result", "=", "self", ".", "clone", "(", ")", "result", ".", "translate", "(", "-", "p", ".", "x", ",", "-", "p", ".", "y", ")", "result", ".", "rotate", "(", "theta", ")", ...
Rotate counter-clockwise around a point, by theta degrees. Positive y goes *up,* as in traditional mathematics. The new position is returned as a new Point.
[ "Rotate", "counter", "-", "clockwise", "around", "a", "point", "by", "theta", "degrees", "." ]
train
https://github.com/callowayproject/Transmogrify/blob/f1f891b8b923b3a1ede5eac7f60531c1c472379e/transmogrify/geometry.py#L174-L186
callowayproject/Transmogrify
transmogrify/geometry.py
Rect.set_points
def set_points(self, pt1, pt2): """Reset the rectangle coordinates.""" (x1, y1) = pt1.as_tuple() (x2, y2) = pt2.as_tuple() self.left = min(x1, x2) self.top = min(y1, y2) self.right = max(x1, x2) self.bottom = max(y1, y2)
python
def set_points(self, pt1, pt2): """Reset the rectangle coordinates.""" (x1, y1) = pt1.as_tuple() (x2, y2) = pt2.as_tuple() self.left = min(x1, x2) self.top = min(y1, y2) self.right = max(x1, x2) self.bottom = max(y1, y2)
[ "def", "set_points", "(", "self", ",", "pt1", ",", "pt2", ")", ":", "(", "x1", ",", "y1", ")", "=", "pt1", ".", "as_tuple", "(", ")", "(", "x2", ",", "y2", ")", "=", "pt2", ".", "as_tuple", "(", ")", "self", ".", "left", "=", "min", "(", "x...
Reset the rectangle coordinates.
[ "Reset", "the", "rectangle", "coordinates", "." ]
train
https://github.com/callowayproject/Transmogrify/blob/f1f891b8b923b3a1ede5eac7f60531c1c472379e/transmogrify/geometry.py#L210-L217
callowayproject/Transmogrify
transmogrify/geometry.py
Rect.overlaps
def overlaps(self, other): """ Return true if a rectangle overlaps this rectangle. """ return ( self.right > other.left and self.left < other.right and self.top < other.bottom and self.bottom > other.top )
python
def overlaps(self, other): """ Return true if a rectangle overlaps this rectangle. """ return ( self.right > other.left and self.left < other.right and self.top < other.bottom and self.bottom > other.top )
[ "def", "overlaps", "(", "self", ",", "other", ")", ":", "return", "(", "self", ".", "right", ">", "other", ".", "left", "and", "self", ".", "left", "<", "other", ".", "right", "and", "self", ".", "top", "<", "other", ".", "bottom", "and", "self", ...
Return true if a rectangle overlaps this rectangle.
[ "Return", "true", "if", "a", "rectangle", "overlaps", "this", "rectangle", "." ]
train
https://github.com/callowayproject/Transmogrify/blob/f1f891b8b923b3a1ede5eac7f60531c1c472379e/transmogrify/geometry.py#L234-L243
callowayproject/Transmogrify
transmogrify/geometry.py
Rect.expanded_by
def expanded_by(self, n): """Return a rectangle with extended borders. Create a new rectangle that is wider and taller than the immediate one. All sides are extended by "n" points. """ return Rect(self.left - n, self.top - n, self.right + n, self.bottom + n)
python
def expanded_by(self, n): """Return a rectangle with extended borders. Create a new rectangle that is wider and taller than the immediate one. All sides are extended by "n" points. """ return Rect(self.left - n, self.top - n, self.right + n, self.bottom + n)
[ "def", "expanded_by", "(", "self", ",", "n", ")", ":", "return", "Rect", "(", "self", ".", "left", "-", "n", ",", "self", ".", "top", "-", "n", ",", "self", ".", "right", "+", "n", ",", "self", ".", "bottom", "+", "n", ")" ]
Return a rectangle with extended borders. Create a new rectangle that is wider and taller than the immediate one. All sides are extended by "n" points.
[ "Return", "a", "rectangle", "with", "extended", "borders", "." ]
train
https://github.com/callowayproject/Transmogrify/blob/f1f891b8b923b3a1ede5eac7f60531c1c472379e/transmogrify/geometry.py#L273-L279
mfcovington/djangocms-lab-publications
cms_lab_publications/models.py
Publication.save
def save(self, *args, **kwargs): """ Before saving, get publication's PubMed metadata if publication is not already in database or if 'redo_query' is True. """ if self.no_query: if not self.pk or self.pmid > 0: try: pmid_min = Publi...
python
def save(self, *args, **kwargs): """ Before saving, get publication's PubMed metadata if publication is not already in database or if 'redo_query' is True. """ if self.no_query: if not self.pk or self.pmid > 0: try: pmid_min = Publi...
[ "def", "save", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "no_query", ":", "if", "not", "self", ".", "pk", "or", "self", ".", "pmid", ">", "0", ":", "try", ":", "pmid_min", "=", "Publication", ".", "obj...
Before saving, get publication's PubMed metadata if publication is not already in database or if 'redo_query' is True.
[ "Before", "saving", "get", "publication", "s", "PubMed", "metadata", "if", "publication", "is", "not", "already", "in", "database", "or", "if", "redo_query", "is", "True", "." ]
train
https://github.com/mfcovington/djangocms-lab-publications/blob/30aa46eaaf234836be846e5cc7320ce727853828/cms_lab_publications/models.py#L125-L172
mfcovington/djangocms-lab-publications
cms_lab_publications/models.py
PublicationSet.perform_bulk_pubmed_query
def perform_bulk_pubmed_query(self): """ If 'bulk_pubmed_query' contains any content, perform a bulk PubMed query, add the publications to the publication set, and save. """ if self.bulk_pubmed_query: failed_queries = [] pmid_list = re.findall(r'(\d+)(?:[\...
python
def perform_bulk_pubmed_query(self): """ If 'bulk_pubmed_query' contains any content, perform a bulk PubMed query, add the publications to the publication set, and save. """ if self.bulk_pubmed_query: failed_queries = [] pmid_list = re.findall(r'(\d+)(?:[\...
[ "def", "perform_bulk_pubmed_query", "(", "self", ")", ":", "if", "self", ".", "bulk_pubmed_query", ":", "failed_queries", "=", "[", "]", "pmid_list", "=", "re", ".", "findall", "(", "r'(\\d+)(?:[\\s,]+|$)'", ",", "self", ".", "bulk_pubmed_query", ")", "for", "...
If 'bulk_pubmed_query' contains any content, perform a bulk PubMed query, add the publications to the publication set, and save.
[ "If", "bulk_pubmed_query", "contains", "any", "content", "perform", "a", "bulk", "PubMed", "query", "add", "the", "publications", "to", "the", "publication", "set", "and", "save", "." ]
train
https://github.com/mfcovington/djangocms-lab-publications/blob/30aa46eaaf234836be846e5cc7320ce727853828/cms_lab_publications/models.py#L229-L250
mfcovington/djangocms-lab-publications
cms_lab_publications/models.py
PublicationSet.save
def save(self, *args, **kwargs): """ Before saving, execute 'perform_bulk_pubmed_query()'. """ self.perform_bulk_pubmed_query() super().save(*args, **kwargs)
python
def save(self, *args, **kwargs): """ Before saving, execute 'perform_bulk_pubmed_query()'. """ self.perform_bulk_pubmed_query() super().save(*args, **kwargs)
[ "def", "save", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "perform_bulk_pubmed_query", "(", ")", "super", "(", ")", ".", "save", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
Before saving, execute 'perform_bulk_pubmed_query()'.
[ "Before", "saving", "execute", "perform_bulk_pubmed_query", "()", "." ]
train
https://github.com/mfcovington/djangocms-lab-publications/blob/30aa46eaaf234836be846e5cc7320ce727853828/cms_lab_publications/models.py#L262-L267
theirc/rapidsms-multitenancy
multitenancy/models.py
Tenant.add_backend
def add_backend(self, backend): "Add a RapidSMS backend to this tenant" if backend in self.get_backends(): return backend_link, created = BackendLink.all_tenants.get_or_create(backend=backend) self.backendlink_set.add(backend_link)
python
def add_backend(self, backend): "Add a RapidSMS backend to this tenant" if backend in self.get_backends(): return backend_link, created = BackendLink.all_tenants.get_or_create(backend=backend) self.backendlink_set.add(backend_link)
[ "def", "add_backend", "(", "self", ",", "backend", ")", ":", "if", "backend", "in", "self", ".", "get_backends", "(", ")", ":", "return", "backend_link", ",", "created", "=", "BackendLink", ".", "all_tenants", ".", "get_or_create", "(", "backend", "=", "ba...
Add a RapidSMS backend to this tenant
[ "Add", "a", "RapidSMS", "backend", "to", "this", "tenant" ]
train
https://github.com/theirc/rapidsms-multitenancy/blob/121bd0a628e691a88aade2e10045cba43af2dfcb/multitenancy/models.py#L42-L47
majerteam/deform_extensions
deform_extensions/__init__.py
grouper
def grouper(iterable, items, fillvalue=None): """ Collect data into fixed-length chunks or blocks e.g: grouper('ABCDEFG', 3, 'x') --> ABC DEF Gxx Got it from https://docs.python.org/2/library/itertools.html#recipes """ args = [iter(iterable)] * items return izip_longest(fillvalue=...
python
def grouper(iterable, items, fillvalue=None): """ Collect data into fixed-length chunks or blocks e.g: grouper('ABCDEFG', 3, 'x') --> ABC DEF Gxx Got it from https://docs.python.org/2/library/itertools.html#recipes """ args = [iter(iterable)] * items return izip_longest(fillvalue=...
[ "def", "grouper", "(", "iterable", ",", "items", ",", "fillvalue", "=", "None", ")", ":", "args", "=", "[", "iter", "(", "iterable", ")", "]", "*", "items", "return", "izip_longest", "(", "fillvalue", "=", "fillvalue", ",", "*", "args", ")" ]
Collect data into fixed-length chunks or blocks e.g: grouper('ABCDEFG', 3, 'x') --> ABC DEF Gxx Got it from https://docs.python.org/2/library/itertools.html#recipes
[ "Collect", "data", "into", "fixed", "-", "length", "chunks", "or", "blocks" ]
train
https://github.com/majerteam/deform_extensions/blob/fdad612e4889a40f1944611264b943866a3cb96e/deform_extensions/__init__.py#L51-L62
majerteam/deform_extensions
deform_extensions/__init__.py
add_resources_to_registry
def add_resources_to_registry(): """ Add resources to the deform registry """ from deform.widget import default_resource_registry default_resource_registry.set_js_resources("jqueryui", None, None) default_resource_registry.set_js_resources("datetimepicker", None, None) default_resource_regi...
python
def add_resources_to_registry(): """ Add resources to the deform registry """ from deform.widget import default_resource_registry default_resource_registry.set_js_resources("jqueryui", None, None) default_resource_registry.set_js_resources("datetimepicker", None, None) default_resource_regi...
[ "def", "add_resources_to_registry", "(", ")", ":", "from", "deform", ".", "widget", "import", "default_resource_registry", "default_resource_registry", ".", "set_js_resources", "(", "\"jqueryui\"", ",", "None", ",", "None", ")", "default_resource_registry", ".", "set_js...
Add resources to the deform registry
[ "Add", "resources", "to", "the", "deform", "registry" ]
train
https://github.com/majerteam/deform_extensions/blob/fdad612e4889a40f1944611264b943866a3cb96e/deform_extensions/__init__.py#L841-L865
majerteam/deform_extensions
deform_extensions/__init__.py
TableMappingWidget.childgroup
def childgroup(self, field): """ Return children grouped regarding the grid description """ cols = getattr(self, "cols", self.default_cols) width = self.num_cols / cols for child in field.children: child.width = width res = list(grouper(field.children,...
python
def childgroup(self, field): """ Return children grouped regarding the grid description """ cols = getattr(self, "cols", self.default_cols) width = self.num_cols / cols for child in field.children: child.width = width res = list(grouper(field.children,...
[ "def", "childgroup", "(", "self", ",", "field", ")", ":", "cols", "=", "getattr", "(", "self", ",", "\"cols\"", ",", "self", ".", "default_cols", ")", "width", "=", "self", ".", "num_cols", "/", "cols", "for", "child", "in", "field", ".", "children", ...
Return children grouped regarding the grid description
[ "Return", "children", "grouped", "regarding", "the", "grid", "description" ]
train
https://github.com/majerteam/deform_extensions/blob/fdad612e4889a40f1944611264b943866a3cb96e/deform_extensions/__init__.py#L153-L162
majerteam/deform_extensions
deform_extensions/__init__.py
GridMappingWidget._childgroup
def _childgroup(self, children, grid): """ Stores the children in a list following the grid's structure :param children: list of fields :param grid: a list of list corresponding of the layout to apply to the given children """ result = [] index = 0 ...
python
def _childgroup(self, children, grid): """ Stores the children in a list following the grid's structure :param children: list of fields :param grid: a list of list corresponding of the layout to apply to the given children """ result = [] index = 0 ...
[ "def", "_childgroup", "(", "self", ",", "children", ",", "grid", ")", ":", "result", "=", "[", "]", "index", "=", "0", "hidden_fields", "=", "[", "]", "for", "row", "in", "grid", ":", "child_row", "=", "[", "]", "width_sum", "=", "0", "for", "width...
Stores the children in a list following the grid's structure :param children: list of fields :param grid: a list of list corresponding of the layout to apply to the given children
[ "Stores", "the", "children", "in", "a", "list", "following", "the", "grid", "s", "structure" ]
train
https://github.com/majerteam/deform_extensions/blob/fdad612e4889a40f1944611264b943866a3cb96e/deform_extensions/__init__.py#L249-L306
majerteam/deform_extensions
deform_extensions/__init__.py
GridMappingWidget._childgroup_by_name
def _childgroup_by_name(self, children, grid): """ Group the children ordering them by name """ children = self._dict_children(children) result = [] for row in grid: child_row = [] row_is_void = True width_sum = 0 for name,...
python
def _childgroup_by_name(self, children, grid): """ Group the children ordering them by name """ children = self._dict_children(children) result = [] for row in grid: child_row = [] row_is_void = True width_sum = 0 for name,...
[ "def", "_childgroup_by_name", "(", "self", ",", "children", ",", "grid", ")", ":", "children", "=", "self", ".", "_dict_children", "(", "children", ")", "result", "=", "[", "]", "for", "row", "in", "grid", ":", "child_row", "=", "[", "]", "row_is_void", ...
Group the children ordering them by name
[ "Group", "the", "children", "ordering", "them", "by", "name" ]
train
https://github.com/majerteam/deform_extensions/blob/fdad612e4889a40f1944611264b943866a3cb96e/deform_extensions/__init__.py#L315-L357
majerteam/deform_extensions
deform_extensions/__init__.py
GridMappingWidget.childgroup
def childgroup(self, field): """ Return a list of fields stored by row regarding the configured grid :param field: The original field this widget is attached to """ grid = getattr(self, "grid", None) named_grid = getattr(self, "named_grid", None) if grid is not ...
python
def childgroup(self, field): """ Return a list of fields stored by row regarding the configured grid :param field: The original field this widget is attached to """ grid = getattr(self, "grid", None) named_grid = getattr(self, "named_grid", None) if grid is not ...
[ "def", "childgroup", "(", "self", ",", "field", ")", ":", "grid", "=", "getattr", "(", "self", ",", "\"grid\"", ",", "None", ")", "named_grid", "=", "getattr", "(", "self", ",", "\"named_grid\"", ",", "None", ")", "if", "grid", "is", "not", "None", "...
Return a list of fields stored by row regarding the configured grid :param field: The original field this widget is attached to
[ "Return", "a", "list", "of", "fields", "stored", "by", "row", "regarding", "the", "configured", "grid" ]
train
https://github.com/majerteam/deform_extensions/blob/fdad612e4889a40f1944611264b943866a3cb96e/deform_extensions/__init__.py#L359-L375
majerteam/deform_extensions
deform_extensions/__init__.py
AccordionFormWidget.accordions
def accordions(self, form): """ return the chlidren of the given form in a dict allowing to render them in accordions with a grid layout :param form: the form object """ fixed = [] accordions = OrderedDict() for child in form.children: section...
python
def accordions(self, form): """ return the chlidren of the given form in a dict allowing to render them in accordions with a grid layout :param form: the form object """ fixed = [] accordions = OrderedDict() for child in form.children: section...
[ "def", "accordions", "(", "self", ",", "form", ")", ":", "fixed", "=", "[", "]", "accordions", "=", "OrderedDict", "(", ")", "for", "child", "in", "form", ".", "children", ":", "section", "=", "getattr", "(", "child", ".", "schema", ",", "'section'", ...
return the chlidren of the given form in a dict allowing to render them in accordions with a grid layout :param form: the form object
[ "return", "the", "chlidren", "of", "the", "given", "form", "in", "a", "dict", "allowing", "to", "render", "them", "in", "accordions", "with", "a", "grid", "layout", ":", "param", "form", ":", "the", "form", "object" ]
train
https://github.com/majerteam/deform_extensions/blob/fdad612e4889a40f1944611264b943866a3cb96e/deform_extensions/__init__.py#L508-L551
matthewdeanmartin/jiggle_version
jiggle_version/is_this_okay.py
check
def check(src, dst): # type: (str,str)->None """ Code take from black formatter. Just want to see if this is still python. :param src: :return: """ was_bad = False try: _ = ast.parse(src) except Exception as exc: was_bad = True major, minor = sys.version_info[:2]...
python
def check(src, dst): # type: (str,str)->None """ Code take from black formatter. Just want to see if this is still python. :param src: :return: """ was_bad = False try: _ = ast.parse(src) except Exception as exc: was_bad = True major, minor = sys.version_info[:2]...
[ "def", "check", "(", "src", ",", "dst", ")", ":", "# type: (str,str)->None", "was_bad", "=", "False", "try", ":", "_", "=", "ast", ".", "parse", "(", "src", ")", "except", "Exception", "as", "exc", ":", "was_bad", "=", "True", "major", ",", "minor", ...
Code take from black formatter. Just want to see if this is still python. :param src: :return:
[ "Code", "take", "from", "black", "formatter", ".", "Just", "want", "to", "see", "if", "this", "is", "still", "python", ".", ":", "param", "src", ":", ":", "return", ":" ]
train
https://github.com/matthewdeanmartin/jiggle_version/blob/963656a0a47b7162780a5f6c8f4b8bbbebc148f5/jiggle_version/is_this_okay.py#L12-L42
noirbizarre/minibench
minibench/report.py
BaseReporter.summary
def summary(self): '''Compute the execution summary''' out = {} for bench in self.runner.runned: key = self.key(bench) runs = {} for method, results in bench.results.items(): mean = results.total / bench.times name = bench.label...
python
def summary(self): '''Compute the execution summary''' out = {} for bench in self.runner.runned: key = self.key(bench) runs = {} for method, results in bench.results.items(): mean = results.total / bench.times name = bench.label...
[ "def", "summary", "(", "self", ")", ":", "out", "=", "{", "}", "for", "bench", "in", "self", ".", "runner", ".", "runned", ":", "key", "=", "self", ".", "key", "(", "bench", ")", "runs", "=", "{", "}", "for", "method", ",", "results", "in", "be...
Compute the execution summary
[ "Compute", "the", "execution", "summary" ]
train
https://github.com/noirbizarre/minibench/blob/a1ac66dc075181c62bb3c0d3a26beb5c46d5f4ab/minibench/report.py#L47-L66
noirbizarre/minibench
minibench/report.py
FileReporter.end
def end(self): ''' Dump the report into the output file. If the file directory does not exists, it will be created. The open file is then given as parameter to :meth:`~minibench.report.FileReporter.output`. ''' dirname = os.path.dirname(self.filename) if dirname ...
python
def end(self): ''' Dump the report into the output file. If the file directory does not exists, it will be created. The open file is then given as parameter to :meth:`~minibench.report.FileReporter.output`. ''' dirname = os.path.dirname(self.filename) if dirname ...
[ "def", "end", "(", "self", ")", ":", "dirname", "=", "os", ".", "path", ".", "dirname", "(", "self", ".", "filename", ")", "if", "dirname", "and", "not", "os", ".", "path", ".", "exists", "(", "dirname", ")", ":", "os", ".", "makedirs", "(", "dir...
Dump the report into the output file. If the file directory does not exists, it will be created. The open file is then given as parameter to :meth:`~minibench.report.FileReporter.output`.
[ "Dump", "the", "report", "into", "the", "output", "file", "." ]
train
https://github.com/noirbizarre/minibench/blob/a1ac66dc075181c62bb3c0d3a26beb5c46d5f4ab/minibench/report.py#L83-L96
noirbizarre/minibench
minibench/report.py
FileReporter.line
def line(self, text=''): '''A simple helper to write line with `\n`''' self.out.write(text) self.out.write('\n')
python
def line(self, text=''): '''A simple helper to write line with `\n`''' self.out.write(text) self.out.write('\n')
[ "def", "line", "(", "self", ",", "text", "=", "''", ")", ":", "self", ".", "out", ".", "write", "(", "text", ")", "self", ".", "out", ".", "write", "(", "'\\n'", ")" ]
A simple helper to write line with `\n`
[ "A", "simple", "helper", "to", "write", "line", "with", "\\", "n" ]
train
https://github.com/noirbizarre/minibench/blob/a1ac66dc075181c62bb3c0d3a26beb5c46d5f4ab/minibench/report.py#L109-L112
noirbizarre/minibench
minibench/report.py
FixedWidth.with_sizes
def with_sizes(self, *headers): '''Compute the report summary and add the computed column sizes''' if len(headers) != 5: raise ValueError('You need to provide this headers: class, method, times, total, average') summary = self.summary() for row in summary.values(): ...
python
def with_sizes(self, *headers): '''Compute the report summary and add the computed column sizes''' if len(headers) != 5: raise ValueError('You need to provide this headers: class, method, times, total, average') summary = self.summary() for row in summary.values(): ...
[ "def", "with_sizes", "(", "self", ",", "*", "headers", ")", ":", "if", "len", "(", "headers", ")", "!=", "5", ":", "raise", "ValueError", "(", "'You need to provide this headers: class, method, times, total, average'", ")", "summary", "=", "self", ".", "summary", ...
Compute the report summary and add the computed column sizes
[ "Compute", "the", "report", "summary", "and", "add", "the", "computed", "column", "sizes" ]
train
https://github.com/noirbizarre/minibench/blob/a1ac66dc075181c62bb3c0d3a26beb5c46d5f4ab/minibench/report.py#L152-L175
heathbar/plum-lightpad-python
plumlightpad/lightpad.py
Lightpad.__telnet_event_listener
def __telnet_event_listener(self, ip, callback): """creates a telnet connection to the lightpad""" tn = telnetlib.Telnet(ip, 2708) self._last_event = "" self._telnet_running = True while self._telnet_running: try: raw_string = tn.read_until(b'.\n', 5)...
python
def __telnet_event_listener(self, ip, callback): """creates a telnet connection to the lightpad""" tn = telnetlib.Telnet(ip, 2708) self._last_event = "" self._telnet_running = True while self._telnet_running: try: raw_string = tn.read_until(b'.\n', 5)...
[ "def", "__telnet_event_listener", "(", "self", ",", "ip", ",", "callback", ")", ":", "tn", "=", "telnetlib", ".", "Telnet", "(", "ip", ",", "2708", ")", "self", ".", "_last_event", "=", "\"\"", "self", ".", "_telnet_running", "=", "True", "while", "self"...
creates a telnet connection to the lightpad
[ "creates", "a", "telnet", "connection", "to", "the", "lightpad" ]
train
https://github.com/heathbar/plum-lightpad-python/blob/181b3dc26cfe77830565f6f844af5ed0728dccd5/plumlightpad/lightpad.py#L27-L47
Akhail/Tebless
tebless/themes/menu.py
single
def single(window, config): """Single theme ===== Header ===== = items = ================== """ cordx = round(config.get('cordx', 0)) color = config.get('color', red) icon = config.get('icon', '=') align = config.get('align', 'left') term = window.term width = roun...
python
def single(window, config): """Single theme ===== Header ===== = items = ================== """ cordx = round(config.get('cordx', 0)) color = config.get('color', red) icon = config.get('icon', '=') align = config.get('align', 'left') term = window.term width = roun...
[ "def", "single", "(", "window", ",", "config", ")", ":", "cordx", "=", "round", "(", "config", ".", "get", "(", "'cordx'", ",", "0", ")", ")", "color", "=", "config", ".", "get", "(", "'color'", ",", "red", ")", "icon", "=", "config", ".", "get",...
Single theme ===== Header ===== = items = ==================
[ "Single", "theme", "=====", "Header", "=====", "=", "items", "=", "==================" ]
train
https://github.com/Akhail/Tebless/blob/369ff76f06e7a0b6d04fabc287fa6c4095e158d4/tebless/themes/menu.py#L12-L53
Akhail/Tebless
tebless/themes/menu.py
double
def double(window, config): """Double theme ================== = Header = ================== = items = ================== = footer = ================== """ cordx = round(config.get('cordx', 0)) color = config.get('color', red) icon = config.get('...
python
def double(window, config): """Double theme ================== = Header = ================== = items = ================== = footer = ================== """ cordx = round(config.get('cordx', 0)) color = config.get('color', red) icon = config.get('...
[ "def", "double", "(", "window", ",", "config", ")", ":", "cordx", "=", "round", "(", "config", ".", "get", "(", "'cordx'", ",", "0", ")", ")", "color", "=", "config", ".", "get", "(", "'color'", ",", "red", ")", "icon", "=", "config", ".", "get",...
Double theme ================== = Header = ================== = items = ================== = footer = ==================
[ "Double", "theme", "==================", "=", "Header", "=", "==================", "=", "items", "=", "==================", "=", "footer", "=", "==================" ]
train
https://github.com/Akhail/Tebless/blob/369ff76f06e7a0b6d04fabc287fa6c4095e158d4/tebless/themes/menu.py#L57-L102
mbr/unleash
unleash/plugins/utils_assign.py
find_assign
def find_assign(data, varname): """Finds a substring that looks like an assignment. :param data: Source to search in. :param varname: Name of the variable for which an assignment should be found. """ ASSIGN_RE = re.compile(BASE_ASSIGN_PATTERN.format(varname)) if len(ASSIGN_...
python
def find_assign(data, varname): """Finds a substring that looks like an assignment. :param data: Source to search in. :param varname: Name of the variable for which an assignment should be found. """ ASSIGN_RE = re.compile(BASE_ASSIGN_PATTERN.format(varname)) if len(ASSIGN_...
[ "def", "find_assign", "(", "data", ",", "varname", ")", ":", "ASSIGN_RE", "=", "re", ".", "compile", "(", "BASE_ASSIGN_PATTERN", ".", "format", "(", "varname", ")", ")", "if", "len", "(", "ASSIGN_RE", ".", "findall", "(", "data", ")", ")", ">", "1", ...
Finds a substring that looks like an assignment. :param data: Source to search in. :param varname: Name of the variable for which an assignment should be found.
[ "Finds", "a", "substring", "that", "looks", "like", "an", "assignment", "." ]
train
https://github.com/mbr/unleash/blob/f36c6e6600868bc054f5b8d4cf1c03ea8eb8da4c/unleash/plugins/utils_assign.py#L12-L28
ella/django-markup
djangomarkup/fields.py
RichTextField.get_instance_id
def get_instance_id(self, instance): " Returns instance pk even if multiple instances were passed to RichTextField. " if type(instance) in [list, tuple]: core_signals.request_finished.connect(receiver=RichTextField.reset_instance_counter_listener) if RichTextField.__inst_counter ...
python
def get_instance_id(self, instance): " Returns instance pk even if multiple instances were passed to RichTextField. " if type(instance) in [list, tuple]: core_signals.request_finished.connect(receiver=RichTextField.reset_instance_counter_listener) if RichTextField.__inst_counter ...
[ "def", "get_instance_id", "(", "self", ",", "instance", ")", ":", "if", "type", "(", "instance", ")", "in", "[", "list", ",", "tuple", "]", ":", "core_signals", ".", "request_finished", ".", "connect", "(", "receiver", "=", "RichTextField", ".", "reset_ins...
Returns instance pk even if multiple instances were passed to RichTextField.
[ "Returns", "instance", "pk", "even", "if", "multiple", "instances", "were", "passed", "to", "RichTextField", "." ]
train
https://github.com/ella/django-markup/blob/45b4b60bc44f38f0a05b54173318951e951ca7ce/djangomarkup/fields.py#L90-L101
ella/django-markup
djangomarkup/fields.py
RichTextField.clean
def clean(self, value): """ When cleaning field, store original value to SourceText model and return rendered field. @raise ValidationError when something went wrong with transformation. """ super_value = super(RichTextField, self).clean(value) if super_value in fields.E...
python
def clean(self, value): """ When cleaning field, store original value to SourceText model and return rendered field. @raise ValidationError when something went wrong with transformation. """ super_value = super(RichTextField, self).clean(value) if super_value in fields.E...
[ "def", "clean", "(", "self", ",", "value", ")", ":", "super_value", "=", "super", "(", "RichTextField", ",", "self", ")", ".", "clean", "(", "value", ")", "if", "super_value", "in", "fields", ".", "EMPTY_VALUES", ":", "if", "self", ".", "instance", ":"...
When cleaning field, store original value to SourceText model and return rendered field. @raise ValidationError when something went wrong with transformation.
[ "When", "cleaning", "field", "store", "original", "value", "to", "SourceText", "model", "and", "return", "rendered", "field", "." ]
train
https://github.com/ella/django-markup/blob/45b4b60bc44f38f0a05b54173318951e951ca7ce/djangomarkup/fields.py#L135-L195
minorg/pastpy
py/src/pastpy/gen/database/impl/online/online_database_object_detail.py
OnlineDatabaseObjectDetail.read
def read(cls, iprot): ''' Read a new object from the given input protocol and return the object. :type iprot: thryft.protocol._input_protocol._InputProtocol :rtype: pastpy.gen.database.impl.online.online_database_object_detail.OnlineDatabaseObjectDetail ''' init_kwds = ...
python
def read(cls, iprot): ''' Read a new object from the given input protocol and return the object. :type iprot: thryft.protocol._input_protocol._InputProtocol :rtype: pastpy.gen.database.impl.online.online_database_object_detail.OnlineDatabaseObjectDetail ''' init_kwds = ...
[ "def", "read", "(", "cls", ",", "iprot", ")", ":", "init_kwds", "=", "{", "}", "iprot", ".", "read_struct_begin", "(", ")", "while", "True", ":", "ifield_name", ",", "ifield_type", ",", "_ifield_id", "=", "iprot", ".", "read_field_begin", "(", ")", "if",...
Read a new object from the given input protocol and return the object. :type iprot: thryft.protocol._input_protocol._InputProtocol :rtype: pastpy.gen.database.impl.online.online_database_object_detail.OnlineDatabaseObjectDetail
[ "Read", "a", "new", "object", "from", "the", "given", "input", "protocol", "and", "return", "the", "object", "." ]
train
https://github.com/minorg/pastpy/blob/7d5d6d511629481850216565e7451b5dcb8027a9/py/src/pastpy/gen/database/impl/online/online_database_object_detail.py#L269-L295
minorg/pastpy
py/src/pastpy/gen/database/impl/online/online_database_object_detail.py
OnlineDatabaseObjectDetail.write
def write(self, oprot): ''' Write this object to the given output protocol and return self. :type oprot: thryft.protocol._output_protocol._OutputProtocol :rtype: pastpy.gen.database.impl.online.online_database_object_detail.OnlineDatabaseObjectDetail ''' oprot.write_str...
python
def write(self, oprot): ''' Write this object to the given output protocol and return self. :type oprot: thryft.protocol._output_protocol._OutputProtocol :rtype: pastpy.gen.database.impl.online.online_database_object_detail.OnlineDatabaseObjectDetail ''' oprot.write_str...
[ "def", "write", "(", "self", ",", "oprot", ")", ":", "oprot", ".", "write_struct_begin", "(", "'OnlineDatabaseObjectDetail'", ")", "oprot", ".", "write_field_begin", "(", "name", "=", "'attributes'", ",", "type", "=", "13", ",", "id", "=", "None", ")", "op...
Write this object to the given output protocol and return self. :type oprot: thryft.protocol._output_protocol._OutputProtocol :rtype: pastpy.gen.database.impl.online.online_database_object_detail.OnlineDatabaseObjectDetail
[ "Write", "this", "object", "to", "the", "given", "output", "protocol", "and", "return", "self", "." ]
train
https://github.com/minorg/pastpy/blob/7d5d6d511629481850216565e7451b5dcb8027a9/py/src/pastpy/gen/database/impl/online/online_database_object_detail.py#L312-L349
emory-libraries/eulcommon
eulcommon/djangoextras/formfields.py
W3CDateWidget.value_from_datadict
def value_from_datadict(self, data, files, name): '''Generate a single value from multi-part form data. Constructs a W3C date based on values that are set, leaving out day and month if they are not present. :param data: dictionary of data submitted by the form :param files: - u...
python
def value_from_datadict(self, data, files, name): '''Generate a single value from multi-part form data. Constructs a W3C date based on values that are set, leaving out day and month if they are not present. :param data: dictionary of data submitted by the form :param files: - u...
[ "def", "value_from_datadict", "(", "self", ",", "data", ",", "files", ",", "name", ")", ":", "y", "=", "data", ".", "get", "(", "self", ".", "year_field", "%", "name", ")", "m", "=", "data", ".", "get", "(", "self", ".", "month_field", "%", "name",...
Generate a single value from multi-part form data. Constructs a W3C date based on values that are set, leaving out day and month if they are not present. :param data: dictionary of data submitted by the form :param files: - unused :param name: base name of the form field ...
[ "Generate", "a", "single", "value", "from", "multi", "-", "part", "form", "data", ".", "Constructs", "a", "W3C", "date", "based", "on", "values", "that", "are", "set", "leaving", "out", "day", "and", "month", "if", "they", "are", "not", "present", "." ]
train
https://github.com/emory-libraries/eulcommon/blob/dc63a9b3b5e38205178235e0d716d1b28158d3a9/eulcommon/djangoextras/formfields.py#L46-L75
emory-libraries/eulcommon
eulcommon/djangoextras/formfields.py
W3CDateWidget.render
def render(self, name, value, attrs=None): '''Render the widget as HTML inputs for display on a form. :param name: form field base name :param value: date value :param attrs: - unused :returns: HTML text with three inputs for year/month/day ''' # expects a value...
python
def render(self, name, value, attrs=None): '''Render the widget as HTML inputs for display on a form. :param name: form field base name :param value: date value :param attrs: - unused :returns: HTML text with three inputs for year/month/day ''' # expects a value...
[ "def", "render", "(", "self", ",", "name", ",", "value", ",", "attrs", "=", "None", ")", ":", "# expects a value in format YYYY-MM-DD or YYYY-MM or YYYY (or empty/None)", "year", ",", "month", ",", "day", "=", "'YYYY'", ",", "'MM'", ",", "'DD'", "if", "value", ...
Render the widget as HTML inputs for display on a form. :param name: form field base name :param value: date value :param attrs: - unused :returns: HTML text with three inputs for year/month/day
[ "Render", "the", "widget", "as", "HTML", "inputs", "for", "display", "on", "a", "form", "." ]
train
https://github.com/emory-libraries/eulcommon/blob/dc63a9b3b5e38205178235e0d716d1b28158d3a9/eulcommon/djangoextras/formfields.py#L78-L108
emory-libraries/eulcommon
eulcommon/djangoextras/formfields.py
W3CDateWidget.create_textinput
def create_textinput(self, name, field, value, **extra_attrs): '''Generate and render a :class:`django.forms.widgets.TextInput` for a single year, month, or day input. If size is specified in the extra attributes, it will also be used to set the maximum length of the field. :pa...
python
def create_textinput(self, name, field, value, **extra_attrs): '''Generate and render a :class:`django.forms.widgets.TextInput` for a single year, month, or day input. If size is specified in the extra attributes, it will also be used to set the maximum length of the field. :pa...
[ "def", "create_textinput", "(", "self", ",", "name", ",", "field", ",", "value", ",", "*", "*", "extra_attrs", ")", ":", "# TODO: move id-generation logic out for re-use", "if", "'id'", "in", "self", ".", "attrs", ":", "id_", "=", "self", ".", "attrs", "[", ...
Generate and render a :class:`django.forms.widgets.TextInput` for a single year, month, or day input. If size is specified in the extra attributes, it will also be used to set the maximum length of the field. :param name: base name of the input field :param field: pattern for t...
[ "Generate", "and", "render", "a", ":", "class", ":", "django", ".", "forms", ".", "widgets", ".", "TextInput", "for", "a", "single", "year", "month", "or", "day", "input", "." ]
train
https://github.com/emory-libraries/eulcommon/blob/dc63a9b3b5e38205178235e0d716d1b28158d3a9/eulcommon/djangoextras/formfields.py#L110-L134
quasipedia/swaggery
swaggery/models.py
Model.describe
def describe(self): '''Provide a dictionary with information describing itself.''' description = { 'description': self._description, 'type': self.name, } description.update(self.extra_params) return description
python
def describe(self): '''Provide a dictionary with information describing itself.''' description = { 'description': self._description, 'type': self.name, } description.update(self.extra_params) return description
[ "def", "describe", "(", "self", ")", ":", "description", "=", "{", "'description'", ":", "self", ".", "_description", ",", "'type'", ":", "self", ".", "name", ",", "}", "description", ".", "update", "(", "self", ".", "extra_params", ")", "return", "descr...
Provide a dictionary with information describing itself.
[ "Provide", "a", "dictionary", "with", "information", "describing", "itself", "." ]
train
https://github.com/quasipedia/swaggery/blob/89a2e1b2bebbc511c781c9e63972f65aef73cc2f/swaggery/models.py#L51-L58
CoffeeForThinkers/MagentoModels
mm/routines/__init__.py
RoutinesBase.get_one_record
def get_one_record(self, *args, **kwargs): """This is an older interface that should now only be used by call(), above. """ records = self.call(*args, **kwargs) records = list(records) len_ = len(records) if len_ != 1: raise ValueError("We were told...
python
def get_one_record(self, *args, **kwargs): """This is an older interface that should now only be used by call(), above. """ records = self.call(*args, **kwargs) records = list(records) len_ = len(records) if len_ != 1: raise ValueError("We were told...
[ "def", "get_one_record", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "records", "=", "self", ".", "call", "(", "*", "args", ",", "*", "*", "kwargs", ")", "records", "=", "list", "(", "records", ")", "len_", "=", "len", "(", ...
This is an older interface that should now only be used by call(), above.
[ "This", "is", "an", "older", "interface", "that", "should", "now", "only", "be", "used", "by", "call", "()", "above", "." ]
train
https://github.com/CoffeeForThinkers/MagentoModels/blob/bfa90582732c01f25c23361a15e4f65414c4a921/mm/routines/__init__.py#L53-L67
CoffeeForThinkers/MagentoModels
mm/routines/__init__.py
RoutinesBase.__build_query
def __build_query(self, routine, parameters): """Return a queury that uses traditional/proper parameters.""" parameter_names = [] replacements = {} for i, value in enumerate(parameters): name = 'arg' + str(i) parameter_names.append(name) replacements...
python
def __build_query(self, routine, parameters): """Return a queury that uses traditional/proper parameters.""" parameter_names = [] replacements = {} for i, value in enumerate(parameters): name = 'arg' + str(i) parameter_names.append(name) replacements...
[ "def", "__build_query", "(", "self", ",", "routine", ",", "parameters", ")", ":", "parameter_names", "=", "[", "]", "replacements", "=", "{", "}", "for", "i", ",", "value", "in", "enumerate", "(", "parameters", ")", ":", "name", "=", "'arg'", "+", "str...
Return a queury that uses traditional/proper parameters.
[ "Return", "a", "queury", "that", "uses", "traditional", "/", "proper", "parameters", "." ]
train
https://github.com/CoffeeForThinkers/MagentoModels/blob/bfa90582732c01f25c23361a15e4f65414c4a921/mm/routines/__init__.py#L69-L94
CoffeeForThinkers/MagentoModels
mm/routines/__init__.py
RoutinesBase.__build_raw_query
def __build_raw_query(self, routine, parameters): """Return a query that uses raw string-replacement for parameters. The parameters will still be escaped before replaced-into the query (by sqlalchemy). """ parameter_names = [] replacements = {} for i, value in...
python
def __build_raw_query(self, routine, parameters): """Return a query that uses raw string-replacement for parameters. The parameters will still be escaped before replaced-into the query (by sqlalchemy). """ parameter_names = [] replacements = {} for i, value in...
[ "def", "__build_raw_query", "(", "self", ",", "routine", ",", "parameters", ")", ":", "parameter_names", "=", "[", "]", "replacements", "=", "{", "}", "for", "i", ",", "value", "in", "enumerate", "(", "parameters", ")", ":", "name", "=", "'arg'", "+", ...
Return a query that uses raw string-replacement for parameters. The parameters will still be escaped before replaced-into the query (by sqlalchemy).
[ "Return", "a", "query", "that", "uses", "raw", "string", "-", "replacement", "for", "parameters", "." ]
train
https://github.com/CoffeeForThinkers/MagentoModels/blob/bfa90582732c01f25c23361a15e4f65414c4a921/mm/routines/__init__.py#L96-L115
CoffeeForThinkers/MagentoModels
mm/routines/__init__.py
RoutinesBase.call
def call(self, routine, *args): """This is a newer, less-verbose interface that calls the old philistine one. This should be used. """ (query, replacements) = self.__build_query(routine, args) return self.__execute_text(query, **replacements)
python
def call(self, routine, *args): """This is a newer, less-verbose interface that calls the old philistine one. This should be used. """ (query, replacements) = self.__build_query(routine, args) return self.__execute_text(query, **replacements)
[ "def", "call", "(", "self", ",", "routine", ",", "*", "args", ")", ":", "(", "query", ",", "replacements", ")", "=", "self", ".", "__build_query", "(", "routine", ",", "args", ")", "return", "self", ".", "__execute_text", "(", "query", ",", "*", "*",...
This is a newer, less-verbose interface that calls the old philistine one. This should be used.
[ "This", "is", "a", "newer", "less", "-", "verbose", "interface", "that", "calls", "the", "old", "philistine", "one", ".", "This", "should", "be", "used", "." ]
train
https://github.com/CoffeeForThinkers/MagentoModels/blob/bfa90582732c01f25c23361a15e4f65414c4a921/mm/routines/__init__.py#L117-L124
CoffeeForThinkers/MagentoModels
mm/routines/__init__.py
RoutinesBase.get_resultsets
def get_resultsets(self, routine, *args): """Return a list of lists of dictionaries, for when a query returns more than one resultset. """ (query, replacements) = self.__build_raw_query(routine, args) # Grab a raw connection from the connection-pool. connection = mm.db...
python
def get_resultsets(self, routine, *args): """Return a list of lists of dictionaries, for when a query returns more than one resultset. """ (query, replacements) = self.__build_raw_query(routine, args) # Grab a raw connection from the connection-pool. connection = mm.db...
[ "def", "get_resultsets", "(", "self", ",", "routine", ",", "*", "args", ")", ":", "(", "query", ",", "replacements", ")", "=", "self", ".", "__build_raw_query", "(", "routine", ",", "args", ")", "# Grab a raw connection from the connection-pool.", "connection", ...
Return a list of lists of dictionaries, for when a query returns more than one resultset.
[ "Return", "a", "list", "of", "lists", "of", "dictionaries", "for", "when", "a", "query", "returns", "more", "than", "one", "resultset", "." ]
train
https://github.com/CoffeeForThinkers/MagentoModels/blob/bfa90582732c01f25c23361a15e4f65414c4a921/mm/routines/__init__.py#L126-L168
CoffeeForThinkers/MagentoModels
mm/routines/__init__.py
RoutinesBase.__execute_text
def __execute_text(self, query, **replacements): """This is an older interface that should now only be used by call(), above. """ # We've had persistent and long-term issues where we can't access tables # from another client because they're locked, as well as getting the ...
python
def __execute_text(self, query, **replacements): """This is an older interface that should now only be used by call(), above. """ # We've had persistent and long-term issues where we can't access tables # from another client because they're locked, as well as getting the ...
[ "def", "__execute_text", "(", "self", ",", "query", ",", "*", "*", "replacements", ")", ":", "# We've had persistent and long-term issues where we can't access tables ", "# from another client because they're locked, as well as getting the ", "# \"gone away\" error quite frequenctly. Per...
This is an older interface that should now only be used by call(), above.
[ "This", "is", "an", "older", "interface", "that", "should", "now", "only", "be", "used", "by", "call", "()", "above", "." ]
train
https://github.com/CoffeeForThinkers/MagentoModels/blob/bfa90582732c01f25c23361a15e4f65414c4a921/mm/routines/__init__.py#L170-L200
lambdalisue/maidenhair
src/maidenhair/utils/plugins.py
Registry.find
def find(self, name, namespace=None): """ Find plugin object Parameters ---------- name : string A name of the object entry or full namespace namespace : string, optional A period separated namespace. E.g. `foo.bar.hogehoge` Returns ...
python
def find(self, name, namespace=None): """ Find plugin object Parameters ---------- name : string A name of the object entry or full namespace namespace : string, optional A period separated namespace. E.g. `foo.bar.hogehoge` Returns ...
[ "def", "find", "(", "self", ",", "name", ",", "namespace", "=", "None", ")", ":", "if", "\".\"", "in", "name", ":", "namespace", ",", "name", "=", "name", ".", "rsplit", "(", "\".\"", ",", "1", ")", "caret", "=", "self", ".", "raw", "if", "namesp...
Find plugin object Parameters ---------- name : string A name of the object entry or full namespace namespace : string, optional A period separated namespace. E.g. `foo.bar.hogehoge` Returns ------- instance An instance found ...
[ "Find", "plugin", "object" ]
train
https://github.com/lambdalisue/maidenhair/blob/d5095c1087d1f4d71cc57410492151d2803a9f0d/src/maidenhair/utils/plugins.py#L28-L71
lambdalisue/maidenhair
src/maidenhair/utils/plugins.py
Registry.register
def register(self, name, obj, namespace=None): """ Register :attr:`obj` as :attr:`name` in :attr:`namespace` Parameters ---------- name : string A name of the object entry obj : instance A python object which will be registered namespace :...
python
def register(self, name, obj, namespace=None): """ Register :attr:`obj` as :attr:`name` in :attr:`namespace` Parameters ---------- name : string A name of the object entry obj : instance A python object which will be registered namespace :...
[ "def", "register", "(", "self", ",", "name", ",", "obj", ",", "namespace", "=", "None", ")", ":", "if", "\".\"", "in", "name", ":", "namespace", ",", "name", "=", "name", ".", "rsplit", "(", "\".\"", ",", "1", ")", "caret", "=", "self", ".", "raw...
Register :attr:`obj` as :attr:`name` in :attr:`namespace` Parameters ---------- name : string A name of the object entry obj : instance A python object which will be registered namespace : string, optional A period separated namespace. E.g. `f...
[ "Register", ":", "attr", ":", "obj", "as", ":", "attr", ":", "name", "in", ":", "attr", ":", "namespace" ]
train
https://github.com/lambdalisue/maidenhair/blob/d5095c1087d1f4d71cc57410492151d2803a9f0d/src/maidenhair/utils/plugins.py#L73-L116
lambdalisue/maidenhair
src/maidenhair/utils/plugins.py
Registry.load_plugins
def load_plugins(self, plugin_dirs=None, quiet=True): """ Load plugins in `sys.path` and :attr:`plugin_dirs` Parameters ---------- plugin_dirs : list or tuple of string, optional A list or tuple of plugin directory path quiet : bool, optional If T...
python
def load_plugins(self, plugin_dirs=None, quiet=True): """ Load plugins in `sys.path` and :attr:`plugin_dirs` Parameters ---------- plugin_dirs : list or tuple of string, optional A list or tuple of plugin directory path quiet : bool, optional If T...
[ "def", "load_plugins", "(", "self", ",", "plugin_dirs", "=", "None", ",", "quiet", "=", "True", ")", ":", "from", "pkg_resources", "import", "working_set", "from", "pkg_resources", "import", "iter_entry_points", "from", "pkg_resources", "import", "Environment", "i...
Load plugins in `sys.path` and :attr:`plugin_dirs` Parameters ---------- plugin_dirs : list or tuple of string, optional A list or tuple of plugin directory path quiet : bool, optional If True, print all error message
[ "Load", "plugins", "in", "sys", ".", "path", "and", ":", "attr", ":", "plugin_dirs" ]
train
https://github.com/lambdalisue/maidenhair/blob/d5095c1087d1f4d71cc57410492151d2803a9f0d/src/maidenhair/utils/plugins.py#L118-L158
baliame/http-hmac-python
httphmac/v1.py
V1Signer.signable
def signable(self, request, authheaders): """Creates the signable string for a request and returns it. Keyword arguments: request -- A request object which can be consumed by this API. authheaders -- A string-indexable object which contains the headers appropriate for this signature ver...
python
def signable(self, request, authheaders): """Creates the signable string for a request and returns it. Keyword arguments: request -- A request object which can be consumed by this API. authheaders -- A string-indexable object which contains the headers appropriate for this signature ver...
[ "def", "signable", "(", "self", ",", "request", ",", "authheaders", ")", ":", "method", "=", "request", ".", "method", ".", "upper", "(", ")", "md5", "=", "hashlib", ".", "md5", "(", ")", "if", "request", ".", "body", "is", "not", "None", ":", "md5...
Creates the signable string for a request and returns it. Keyword arguments: request -- A request object which can be consumed by this API. authheaders -- A string-indexable object which contains the headers appropriate for this signature version.
[ "Creates", "the", "signable", "string", "for", "a", "request", "and", "returns", "it", "." ]
train
https://github.com/baliame/http-hmac-python/blob/9884c0cbfdb712f9f37080a8efbfdce82850785f/httphmac/v1.py#L19-L47
baliame/http-hmac-python
httphmac/v1.py
V1Signer.sign
def sign(self, request, authheaders, secret): """Returns the signature appropriate for the request. The request is not changed by this function. Keyword arguments: request -- A request object which can be consumed by this API. authheaders -- A string-indexable object which contains the ...
python
def sign(self, request, authheaders, secret): """Returns the signature appropriate for the request. The request is not changed by this function. Keyword arguments: request -- A request object which can be consumed by this API. authheaders -- A string-indexable object which contains the ...
[ "def", "sign", "(", "self", ",", "request", ",", "authheaders", ",", "secret", ")", ":", "mac", "=", "hmac", ".", "HMAC", "(", "secret", ".", "encode", "(", "'utf-8'", ")", ",", "digestmod", "=", "self", ".", "digest", ")", "mac", ".", "update", "(...
Returns the signature appropriate for the request. The request is not changed by this function. Keyword arguments: request -- A request object which can be consumed by this API. authheaders -- A string-indexable object which contains the headers appropriate for this signature version. s...
[ "Returns", "the", "signature", "appropriate", "for", "the", "request", ".", "The", "request", "is", "not", "changed", "by", "this", "function", "." ]
train
https://github.com/baliame/http-hmac-python/blob/9884c0cbfdb712f9f37080a8efbfdce82850785f/httphmac/v1.py#L49-L60
baliame/http-hmac-python
httphmac/v1.py
V1Signer.parse_auth_headers
def parse_auth_headers(self, authorization): """Parses the authorization headers from the authorization header taken from a request. Returns a dict that is accepted by all other API functions which expect authorization headers in a dict format. Keyword arguments: authorization -- The au...
python
def parse_auth_headers(self, authorization): """Parses the authorization headers from the authorization header taken from a request. Returns a dict that is accepted by all other API functions which expect authorization headers in a dict format. Keyword arguments: authorization -- The au...
[ "def", "parse_auth_headers", "(", "self", ",", "authorization", ")", ":", "m", "=", "re", ".", "match", "(", "r'^(?i)Acquia\\s+(.*?):(.+)$'", ",", "authorization", ")", "if", "m", "is", "not", "None", ":", "return", "{", "\"id\"", ":", "m", ".", "group", ...
Parses the authorization headers from the authorization header taken from a request. Returns a dict that is accepted by all other API functions which expect authorization headers in a dict format. Keyword arguments: authorization -- The authorization header of any request. The header must be in...
[ "Parses", "the", "authorization", "headers", "from", "the", "authorization", "header", "taken", "from", "a", "request", ".", "Returns", "a", "dict", "that", "is", "accepted", "by", "all", "other", "API", "functions", "which", "expect", "authorization", "headers"...
train
https://github.com/baliame/http-hmac-python/blob/9884c0cbfdb712f9f37080a8efbfdce82850785f/httphmac/v1.py#L72-L82
baliame/http-hmac-python
httphmac/v1.py
V1Signer.check
def check(self, request, secret): """Verifies whether or not the request bears an authorization appropriate and valid for this version of the signature. This verifies every element of the signature, including headers other than Authorization. Keyword arguments: request -- A request obje...
python
def check(self, request, secret): """Verifies whether or not the request bears an authorization appropriate and valid for this version of the signature. This verifies every element of the signature, including headers other than Authorization. Keyword arguments: request -- A request obje...
[ "def", "check", "(", "self", ",", "request", ",", "secret", ")", ":", "if", "request", ".", "get_header", "(", "\"Authorization\"", ")", "==", "\"\"", ":", "return", "False", "ah", "=", "self", ".", "parse_auth_headers", "(", "request", ".", "get_header", ...
Verifies whether or not the request bears an authorization appropriate and valid for this version of the signature. This verifies every element of the signature, including headers other than Authorization. Keyword arguments: request -- A request object which can be consumed by this API. ...
[ "Verifies", "whether", "or", "not", "the", "request", "bears", "an", "authorization", "appropriate", "and", "valid", "for", "this", "version", "of", "the", "signature", ".", "This", "verifies", "every", "element", "of", "the", "signature", "including", "headers"...
train
https://github.com/baliame/http-hmac-python/blob/9884c0cbfdb712f9f37080a8efbfdce82850785f/httphmac/v1.py#L84-L99
baliame/http-hmac-python
httphmac/v1.py
V1Signer.sign_direct
def sign_direct(self, request, authheaders, secret): """Signs a request directly with an appropriate signature. The request's Authorization header will change. Keyword arguments: request -- A request object which can be consumed by this API. authheaders -- A string-indexable object whic...
python
def sign_direct(self, request, authheaders, secret): """Signs a request directly with an appropriate signature. The request's Authorization header will change. Keyword arguments: request -- A request object which can be consumed by this API. authheaders -- A string-indexable object whic...
[ "def", "sign_direct", "(", "self", ",", "request", ",", "authheaders", ",", "secret", ")", ":", "sig", "=", "self", ".", "sign", "(", "request", ",", "authheaders", ",", "secret", ")", "return", "request", ".", "with_header", "(", "\"Authorization\"", ",",...
Signs a request directly with an appropriate signature. The request's Authorization header will change. Keyword arguments: request -- A request object which can be consumed by this API. authheaders -- A string-indexable object which contains the headers appropriate for this signature version. ...
[ "Signs", "a", "request", "directly", "with", "an", "appropriate", "signature", ".", "The", "request", "s", "Authorization", "header", "will", "change", "." ]
train
https://github.com/baliame/http-hmac-python/blob/9884c0cbfdb712f9f37080a8efbfdce82850785f/httphmac/v1.py#L101-L110
lambdalisue/maidenhair
src/maidenhair/utils/environment.py
get_system_root_directory
def get_system_root_directory(): """ Get system root directory (application installed root directory) Returns ------- string A full path """ root = os.path.dirname(__file__) root = os.path.dirname(root) root = os.path.abspath(root) return root
python
def get_system_root_directory(): """ Get system root directory (application installed root directory) Returns ------- string A full path """ root = os.path.dirname(__file__) root = os.path.dirname(root) root = os.path.abspath(root) return root
[ "def", "get_system_root_directory", "(", ")", ":", "root", "=", "os", ".", "path", ".", "dirname", "(", "__file__", ")", "root", "=", "os", ".", "path", ".", "dirname", "(", "root", ")", "root", "=", "os", ".", "path", ".", "abspath", "(", "root", ...
Get system root directory (application installed root directory) Returns ------- string A full path
[ "Get", "system", "root", "directory", "(", "application", "installed", "root", "directory", ")" ]
train
https://github.com/lambdalisue/maidenhair/blob/d5095c1087d1f4d71cc57410492151d2803a9f0d/src/maidenhair/utils/environment.py#L19-L32
lambdalisue/maidenhair
src/maidenhair/utils/environment.py
get_user_root_directory
def get_user_root_directory(): """ Get user root directory (application user configuration root directory) Returns ------- string A full path """ uname = platform.system() if uname == 'Windows': root = os.path.join(os.environ['APPDATA'], APP_NAME) root = os.path...
python
def get_user_root_directory(): """ Get user root directory (application user configuration root directory) Returns ------- string A full path """ uname = platform.system() if uname == 'Windows': root = os.path.join(os.environ['APPDATA'], APP_NAME) root = os.path...
[ "def", "get_user_root_directory", "(", ")", ":", "uname", "=", "platform", ".", "system", "(", ")", "if", "uname", "==", "'Windows'", ":", "root", "=", "os", ".", "path", ".", "join", "(", "os", ".", "environ", "[", "'APPDATA'", "]", ",", "APP_NAME", ...
Get user root directory (application user configuration root directory) Returns ------- string A full path
[ "Get", "user", "root", "directory", "(", "application", "user", "configuration", "root", "directory", ")" ]
train
https://github.com/lambdalisue/maidenhair/blob/d5095c1087d1f4d71cc57410492151d2803a9f0d/src/maidenhair/utils/environment.py#L47-L73
quasipedia/swaggery
swaggery/checker.py
main
def main(directories): '''Perform all checks on the API's contained in `directory`.''' msg = 'Checking module "{}" from directory "{}" for coding errors.' api_checker = ApiChecker() resource_checker = ResourceChecker() errors = [] modules = [] for loader, mname, _ in pkgutil.walk_packages(di...
python
def main(directories): '''Perform all checks on the API's contained in `directory`.''' msg = 'Checking module "{}" from directory "{}" for coding errors.' api_checker = ApiChecker() resource_checker = ResourceChecker() errors = [] modules = [] for loader, mname, _ in pkgutil.walk_packages(di...
[ "def", "main", "(", "directories", ")", ":", "msg", "=", "'Checking module \"{}\" from directory \"{}\" for coding errors.'", "api_checker", "=", "ApiChecker", "(", ")", "resource_checker", "=", "ResourceChecker", "(", ")", "errors", "=", "[", "]", "modules", "=", "...
Perform all checks on the API's contained in `directory`.
[ "Perform", "all", "checks", "on", "the", "API", "s", "contained", "in", "directory", "." ]
train
https://github.com/quasipedia/swaggery/blob/89a2e1b2bebbc511c781c9e63972f65aef73cc2f/swaggery/checker.py#L224-L248