code stringlengths 1 18.2k |
|---|
def generate_static(self, path): """ This method generates a valid path to the public folder of the running project """ if not path: return "" if path[0] == '/': return "%s?v=%s" % (path, self.version) return "%s/%s?v=%s" % (self.static, path, self.version) |
def _parse_values(values, extra=None): """ Utility function to flatten out args. For internal use only. :param values: list, tuple, or str :param extra: list or None :return: list """ coerced = list(values) if coerced == values: values = coerced else: coerced = tuple(values) if coerced == values: values = list(values) ... |
def redis_key(cls, key): """ Get the key we pass to redis. If no namespace is declared, it will use the class name. :param key: str the name of the redis key :return: str """ keyspace = cls.keyspace tpl = cls.keyspace_template key = "%s" % key if keyspace is None else tpl % (keyspace, key) return cls.keyparse.encode(ke... |
def super_pipe(self): """ Creates a mechanism for us to internally bind two different operations together in a shared pipeline on the class. This will temporarily set self._pipe to be this new pipeline, during this context and then when it leaves the context reset self._pipe to its original value. Example: def get_set(... |
self._pipe |
def delete(self, *names): """ Remove the key from redis :param names: tuple of strings - The keys to remove from redis. :return: Future() """ names = [self.redis_key(n) for n in names] with self.pipe as pipe: return pipe.delete(*names) |
def expire(self, name, time): """ Allow the key to expire after ``time`` seconds. :param name: str the name of the redis key :param time: time expressed in seconds. :return: Future() """ with self.pipe as pipe: return pipe.expire(self.redis_key(name), time) |
def exists(self, name): """ does the key exist in redis? :param name: str the name of the redis key :return: Future() """ with self.pipe as pipe: return pipe.exists(self.redis_key(name)) |
def eval(self, script, numkeys, *keys_and_args): """ Run a lua script against the key. Doesn't support multi-key lua operations because we wouldn't be able to know what argument to namespace. Also, redis cluster doesn't really support multi-key operations. :param script: str A lua script targeting the current key. :par... |
def dump(self, name): """ get a redis RDB-like serialization of the object. :param name: str the name of the redis key :return: Future() """ with self.pipe as pipe: return pipe.dump(self.redis_key(name)) |
def restorenx(self, name, value, pttl=0): """ Restore serialized dump of a key back into redis :param name: str the name of the redis key :param value: redis RDB-like serialization :param pttl: milliseconds till key expires :return: Future() """ return self.eval(lua_restorenx, 1, name, pttl, value) |
def restore(self, name, value, pttl=0): """ Restore serialized dump of a key back into redis :param name: the name of the key :param value: the binary representation of the key. :param pttl: milliseconds till key expires :return: """ with self.pipe as pipe: res = pipe.restore(self.redis_key(name), ttl=pttl, value=value... |
def ttl(self, name): """ get the number of seconds until the key's expiration :param name: str the name of the redis key :return: Future() """ with self.pipe as pipe: return pipe.ttl(self.redis_key(name)) |
def persist(self, name): """ clear any expiration TTL set on the object :param name: str the name of the redis key :return: Future() """ with self.pipe as pipe: return pipe.persist(self.redis_key(name)) |
def pexpire(self, name, time): """ Set an expire flag on key ``name`` for ``time`` milliseconds. ``time`` can be represented by an integer or a Python timedelta object. :param name: str :param time: int or timedelta :return Future """ with self.pipe as pipe: return pipe.pexpire(self.redis_key(name), time) |
def pexpireat(self, name, when): """ Set an expire flag on key ``name``. ``when`` can be represented as an integer representing unix time in milliseconds (unix time * 1000) or a Python datetime object. """ with self.pipe as pipe: return pipe.pexpireat(self.redis_key(name), when) |
def pttl(self, name): """ Returns the number of milliseconds until the key ``name`` will expire :param name: str the name of the redis key :return: """ with self.pipe as pipe: return pipe.pttl(self.redis_key(name)) |
def rename(self, src, dst): """ Rename key ``src`` to ``dst`` """ with self.pipe as pipe: return pipe.rename(self.redis_key(src), self.redis_key(dst)) |
def renamenx(self, src, dst): "Rename key ``src`` to ``dst`` if ``dst`` doesn't already exist" with self.pipe as pipe: return pipe.renamenx(self.redis_key(src), self.redis_key(dst)) |
def object(self, infotype, key): """ get the key's info stats :param name: str the name of the redis key :param subcommand: REFCOUNT | ENCODING | IDLETIME :return: Future() """ with self.pipe as pipe: return pipe.object(infotype, self.redis_key(key)) |
def scan(self, cursor=0, match=None, count=None): """ Incrementally return lists of key names. Also return a cursor indicating the scan position. ``match`` allows for filtering the keys by pattern ``count`` allows for hint the minimum number of returns """ f = Future() if self.keyspace is None: with self.pipe as pipe: ... |
def sort(self, name, start=None, num=None, by=None, get=None, desc=False, alpha=False, store=None, groups=False): """ Sort and return the list, set or sorted set at ``name``. ``start`` and ``num`` allow for paging through the sorted data ``by`` allows using an external key to weight and sort the items. Use an "*" to in... |
will return a list of tuples, each containing the values fetched from the arguments to ``get``. """ with self.pipe as pipe: res = pipe.sort(self.redis_key(name), start=start, num=num, by=by, get=get, desc=desc, alpha=alpha, store=store, groups=groups) if store: return res f = Future() def cb(): decode = self.valueparse... |
def mget(self, keys, *args): """ Returns a list of values ordered identically to ``keys`` """ keys = [self.redis_key(k) for k in self._parse_values(keys, args)] with self.pipe as pipe: f = Future() res = pipe.mget(keys) def cb(): decode = self.valueparse.decode f.set([None if r is None else decode(r) for r in res.resul... |
def set(self, name, value, ex=None, px=None, nx=False, xx=False): """ Set the value at key ``name`` to ``value`` ``ex`` sets an expire flag on key ``name`` for ``ex`` seconds. ``px`` sets an expire flag on key ``name`` for ``px`` milliseconds. ``nx`` if set to True, set the value at key ``name`` to ``value`` if it does... |
def setnx(self, name, value): """ Set the value as a string in the key only if the key doesn't exist. :param name: str the name of the redis key :param value: :return: Future() """ with self.pipe as pipe: return pipe.setnx(self.redis_key(name), self.valueparse.encode(value)) |
def setex(self, name, value, time): """ Set the value of key to ``value`` that expires in ``time`` seconds. ``time`` can be represented by an integer or a Python timedelta object. :param name: str the name of the redis key :param value: str :param time: secs :return: Future() """ with self.pipe as pipe: return pipe.set... |
def psetex(self, name, value, time_ms): """ Set the value of key ``name`` to ``value`` that expires in ``time_ms`` milliseconds. ``time_ms`` can be represented by an integer or a Python timedelta object """ with self.pipe as pipe: return pipe.psetex(self.redis_key(name), time_ms=time_ms, value=self.valueparse.encode(va... |
def append(self, name, value): """ Appends the string ``value`` to the value at ``key``. If ``key`` doesn't already exist, create it with a value of ``value``. Returns the new length of the value at ``key``. :param name: str the name of the redis key :param value: str :return: Future() """ with self.pipe as pipe: retur... |
def strlen(self, name): """ Return the number of bytes stored in the value of the key :param name: str the name of the redis key :return: Future() """ with self.pipe as pipe: return pipe.strlen(self.redis_key(name)) |
def substr(self, name, start, end=-1): """ Return a substring of the string at key ``name``. ``start`` and ``end`` are 0-based integers specifying the portion of the string to return. :param name: str the name of the redis key :param start: int :param end: int :return: Future() """ with self.pipe as pipe: f = Future() ... |
def setrange(self, name, offset, value): """ Overwrite bytes in the value of ``name`` starting at ``offset`` with ``value``. If ``offset`` plus the length of ``value`` exceeds the length of the original value, the new value will be larger than before. If ``offset`` exceeds the length of the original value, null bytes w... |
def setbit(self, name, offset, value): """ Flag the ``offset`` in the key as ``value``. Returns a boolean indicating the previous value of ``offset``. :param name: str the name of the redis key :param offset: int :param value: :return: Future() """ with self.pipe as pipe: return pipe.setbit(self.redis_key(name), offset... |
def getbit(self, name, offset): """ Returns a boolean indicating the value of ``offset`` in key :param name: str the name of the redis key :param offset: int :return: Future() """ with self.pipe as pipe: return pipe.getbit(self.redis_key(name), offset) |
def bitcount(self, name, start=None, end=None): """ Returns the count of set bits in the value of ``key``. Optional ``start`` and ``end`` paramaters indicate which bytes to consider :param name: str the name of the redis key :param start: int :param end: int :return: Future() """ with self.pipe as pipe: return pipe.bit... |
def incr(self, name, amount=1): """ increment the value for key by 1 :param name: str the name of the redis key :param amount: int :return: Future() """ with self.pipe as pipe: return pipe.incr(self.redis_key(name), amount=amount) |
def incrby(self, name, amount=1): """ increment the value for key by value: int :param name: str the name of the redis key :param amount: int :return: Future() """ with self.pipe as pipe: return pipe.incrby(self.redis_key(name), amount=amount) |
def incrbyfloat(self, name, amount=1.0): """ increment the value for key by value: float :param name: str the name of the redis key :param amount: int :return: Future() """ with self.pipe as pipe: return pipe.incrbyfloat(self.redis_key(name), amount=amount) |
def sdiffstore(self, dest, *keys): """ Store the difference of sets specified by ``keys`` into a new set named ``dest``. Returns the number of keys in the new set. """ keys = [self.redis_key(k) for k in self._parse_values(keys)] with self.pipe as pipe: return pipe.sdiffstore(self.redis_key(dest), *keys) |
def sunionstore(self, dest, keys, *args): """ Store the union of sets specified by ``keys`` into a new set named ``dest``. Returns the number of members in the new set. """ keys = [self.redis_key(k) for k in self._parse_values(keys, args)] with self.pipe as pipe: return pipe.sunionstore(self.redis_key(dest), *keys) |
def sadd(self, name, values, *args): """ Add the specified members to the Set. :param name: str the name of the redis key :param values: a list of values or a simple value. :return: Future() """ with self.pipe as pipe: values = [self.valueparse.encode(v) for v in self._parse_values(values, args)] return pipe.sadd(self.... |
def scard(self, name): """ How many items in the set? :param name: str the name of the redis key :return: Future() """ with self.pipe as pipe: return pipe.scard(self.redis_key(name)) |
def sismember(self, name, value): """ Is the provided value is in the ``Set``? :param name: str the name of the redis key :param value: str :return: Future() """ with self.pipe as pipe: return pipe.sismember(self.redis_key(name), self.valueparse.encode(value)) |
def srandmember(self, name, number=None): """ Return a random member of the set. :param name: str the name of the redis key :return: Future() """ with self.pipe as pipe: f = Future() res = pipe.srandmember(self.redis_key(name), number=number) def cb(): if number is None: f.set(self.valueparse.decode(res.result)) else: ... |
def sscan(self, name, cursor=0, match=None, count=None): """ Incrementally return lists of elements in a set. Also return a cursor indicating the scan position. ``match`` allows for filtering the keys by pattern ``count`` allows for hint the minimum number of returns :param name: str the name of the redis key :param cu... |
def sscan_iter(self, name, match=None, count=None): """ Make an iterator using the SSCAN command so that the client doesn't need to remember the cursor position. ``match`` allows for filtering the keys by pattern ``count`` allows for hint the minimum number of returns :param name: str the name of the redis key :param m... |
def blpop(self, keys, timeout=0): """ LPOP a value off of the first non-empty list named in the ``keys`` list. If none of the lists in ``keys`` has a value to LPOP, then block for ``timeout`` seconds, or until a value gets pushed on to one of the lists. If timeout is 0, then block indefinitely. """ map = {self.redis_ke... |
def llen(self, name): """ Returns the length of the list. :param name: str the name of the redis key :return: Future() """ with self.pipe as pipe: return pipe.llen(self.redis_key(name)) |
def lrange(self, name, start, stop): """ Returns a range of items. :param name: str the name of the redis key :param start: integer representing the start index of the range :param stop: integer representing the size of the list. :return: Future() """ with self.pipe as pipe: f = Future() res = pipe.lrange(self.redis_ke... |
def rpush(self, name, *values): """ Push the value into the list from the *right* side :param name: str the name of the redis key :param values: a list of values or single value to push :return: Future() """ with self.pipe as pipe: v_encode = self.valueparse.encode values = [v_encode(v) for v in self._parse_values(valu... |
def lpop(self, name): """ Pop the first object from the left. :param name: str the name of the redis key :return: Future() """ with self.pipe as pipe: f = Future() res = pipe.lpop(self.redis_key(name)) def cb(): f.set(self.valueparse.decode(res.result)) pipe.on_execute(cb) return f |
def rpoplpush(self, src, dst): """ RPOP a value off of the ``src`` list and atomically LPUSH it on to the ``dst`` list. Returns the value. """ with self.pipe as pipe: f = Future() res = pipe.rpoplpush(self.redis_key(src), self.redis_key(dst)) def cb(): f.set(self.valueparse.decode(res.result)) pipe.on_execute(cb) retur... |
def lrem(self, name, value, num=1): """ Remove first occurrence of value. Can't use redis-py interface. It's inconstistent between redis.Redis and redis.StrictRedis in terms of the kwargs. Better to use the underlying execute_command instead. :param name: str the name of the redis key :param num: :param value: :return:... |
def ltrim(self, name, start, end): """ Trim the list from start to end. :param name: str the name of the redis key :param start: :param end: :return: Future() """ with self.pipe as pipe: return pipe.ltrim(self.redis_key(name), start, end) |
def lset(self, name, index, value): """ Set the value in the list at index *idx* :param name: str the name of the redis key :param value: :param index: :return: Future() """ with self.pipe as pipe: value = self.valueparse.encode(value) return pipe.lset(self.redis_key(name), index, value) |
def zadd(self, name, members, score=1, nx=False, xx=False, ch=False, incr=False): """ Add members in the set and assign them the score. :param name: str the name of the redis key :param members: a list of item or a single item :param score: the score the assign to the item(s) :param nx: :param xx: :param ch: :param inc... |
def zincrby(self, name, value, amount=1): """ Increment the score of the item by `value` :param name: str the name of the redis key :param value: :param amount: :return: """ with self.pipe as pipe: return pipe.zincrby(self.redis_key(name), value=self.valueparse.encode(value), amount=amount) |
def zrevrank(self, name, value): """ Returns the ranking in reverse order for the member :param name: str the name of the redis key :param member: str """ with self.pipe as pipe: return pipe.zrevrank(self.redis_key(name), self.valueparse.encode(value)) |
def zrange(self, name, start, end, desc=False, withscores=False, score_cast_func=float): """ Returns all the elements including between ``start`` (non included) and ``stop`` (included). :param name: str the name of the redis key :param start: :param end: :param desc: :param withscores: :param score_cast_func: :return: ... |
def zrangebyscore(self, name, min, max, start=None, num=None, withscores=False, score_cast_func=float): """ Returns the range of elements included between the scores (min and max) :param name: str the name of the redis key :param min: :param max: :param start: :param num: :param withscores: :param score_cast_func: :ret... |
def zcard(self, name): """ Returns the cardinality of the SortedSet. :param name: str the name of the redis key :return: Future() """ with self.pipe as pipe: return pipe.zcard(self.redis_key(name)) |
def zcount(self, name, min, max): """ Returns the number of elements in the sorted set at key ``name`` with a score between ``min`` and ``max``. :param name: str :param min: float :param max: float :return: Future() """ with self.pipe as pipe: return pipe.zcount(self.redis_key(name), min, max) |
def zscore(self, name, value): """ Return the score of an element :param name: str the name of the redis key :param value: the element in the sorted set key :return: Future() """ with self.pipe as pipe: return pipe.zscore(self.redis_key(name), self.valueparse.encode(value)) |
def zremrangebyrank(self, name, min, max): """ Remove a range of element between the rank ``start`` and ``stop`` both included. :param name: str the name of the redis key :param min: :param max: :return: Future() """ with self.pipe as pipe: return pipe.zremrangebyrank(self.redis_key(name), min, max) |
def zremrangebyscore(self, name, min, max): """ Remove a range of element by between score ``min_value`` and ``max_value`` both included. :param name: str the name of the redis key :param min: :param max: :return: Future() """ with self.pipe as pipe: return pipe.zremrangebyscore(self.redis_key(name), min, max) |
def zrank(self, name, value): """ Returns the rank of the element. :param name: str the name of the redis key :param value: the element in the sorted set """ with self.pipe as pipe: value = self.valueparse.encode(value) return pipe.zrank(self.redis_key(name), value) |
def zlexcount(self, name, min, max): """ Return the number of items in the sorted set between the lexicographical range ``min`` and ``max``. :param name: str the name of the redis key :param min: int or '-inf' :param max: int or '+inf' :return: Future() """ with self.pipe as pipe: return pipe.zlexcount(self.redis_key(n... |
def zrevrangebylex(self, name, max, min, start=None, num=None): """ Return the reversed lexicographical range of values from the sorted set between ``max`` and ``min``. If ``start`` and ``num`` are specified, then return a slice of the range. :param name: str the name of the redis key :param max: int or '+inf' :param m... |
def zremrangebylex(self, name, min, max): """ Remove all elements in the sorted set between the lexicographical range specified by ``min`` and ``max``. Returns the number of elements removed. :param name: str the name of the redis key :param min: int or -inf :param max: into or +inf :return: Future() """ with self.pipe... |
def zunionstore(self, dest, keys, aggregate=None): """ Union multiple sorted sets specified by ``keys`` into a new sorted set, ``dest``. Scores in the destination will be aggregated based on the ``aggregate``, or SUM if none is provided. """ with self.pipe as pipe: keys = [self.redis_key(k) for k in keys] return pipe.z... |
def zscan(self, name, cursor=0, match=None, count=None, score_cast_func=float): """ Incrementally return lists of elements in a sorted set. Also return a cursor indicating the scan position. ``match`` allows for filtering the members by pattern ``count`` allows for hint the minimum number of returns ``score_cast_func``... |
def zscan_iter(self, name, match=None, count=None, score_cast_func=float): """ Make an iterator using the ZSCAN command so that the client doesn't need to remember the cursor position. ``match`` allows for filtering the keys by pattern ``count`` allows for hint the minimum number of returns ``score_cast_func`` a callab... |
def _value_encode(cls, member, value): """ Internal method used to encode values into the hash. :param member: str :param value: multi :return: bytes """ try: field_validator = cls.fields[member] except KeyError: return cls.valueparse.encode(value) return field_validator.encode(value) |
def _value_decode(cls, member, value): """ Internal method used to decode values from redis hash :param member: str :param value: bytes :return: multi """ if value is None: return None try: field_validator = cls.fields[member] except KeyError: return cls.valueparse.decode(value) return field_validator.decode(value) |
def hlen(self, name): """ Returns the number of elements in the Hash. :param name: str the name of the redis key :return: Future() """ with self.pipe as pipe: return pipe.hlen(self.redis_key(name)) |
def hstrlen(self, name, key): """ Return the number of bytes stored in the value of ``key`` within hash ``name`` """ with self.pipe as pipe: return pipe.hstrlen(self.redis_key(name), key) |
def hset(self, name, key, value): """ Set ``member`` in the Hash at ``value``. :param name: str the name of the redis key :param value: :param key: the member of the hash key :return: Future() """ with self.pipe as pipe: value = self._value_encode(key, value) key = self.memberparse.encode(key) return pipe.hset(self.red... |
def hdel(self, name, *keys): """ Delete one or more hash field. :param name: str the name of the redis key :param keys: on or more members to remove from the key. :return: Future() """ with self.pipe as pipe: m_encode = self.memberparse.encode keys = [m_encode(m) for m in self._parse_values(keys)] return pipe.hdel(self... |
def hkeys(self, name): """ Returns all fields name in the Hash. :param name: str the name of the redis key :return: Future """ with self.pipe as pipe: f = Future() res = pipe.hkeys(self.redis_key(name)) def cb(): m_decode = self.memberparse.decode f.set([m_decode(v) for v in res.result]) pipe.on_execute(cb) return f |
def hgetall(self, name): """ Returns all the fields and values in the Hash. :param name: str the name of the redis key :return: Future() """ with self.pipe as pipe: f = Future() res = pipe.hgetall(self.redis_key(name)) def cb(): data = {} m_decode = self.memberparse.decode v_decode = self._value_decode for k, v in res.... |
def hget(self, name, key): """ Returns the value stored in the field, None if the field doesn't exist. :param name: str the name of the redis key :param key: the member of the hash :return: Future() """ with self.pipe as pipe: f = Future() res = pipe.hget(self.redis_key(name), self.memberparse.encode(key)) def cb(): f.... |
def hexists(self, name, key): """ Returns ``True`` if the field exists, ``False`` otherwise. :param name: str the name of the redis key :param key: the member of the hash :return: Future() """ with self.pipe as pipe: return pipe.hexists(self.redis_key(name), self.memberparse.encode(key)) |
def hincrby(self, name, key, amount=1): """ Increment the value of the field. :param name: str the name of the redis key :param increment: int :param field: str :return: Future() """ with self.pipe as pipe: return pipe.hincrby(self.redis_key(name), self.memberparse.encode(key), amount) |
def hmget(self, name, keys, *args): """ Returns the values stored in the fields. :param name: str the name of the redis key :param fields: :return: Future() """ member_encode = self.memberparse.encode keys = [k for k in self._parse_values(keys, args)] with self.pipe as pipe: f = Future() res = pipe.hmget(self.redis_key... |
def hmset(self, name, mapping): """ Sets or updates the fields with their corresponding values. :param name: str the name of the redis key :param mapping: a dict with keys and values :return: Future() """ with self.pipe as pipe: m_encode = self.memberparse.encode mapping = {m_encode(k): self._value_encode(k, v) for k, ... |
def hscan(self, name, cursor=0, match=None, count=None): """ Incrementally return key/value slices in a hash. Also return a cursor indicating the scan position. ``match`` allows for filtering the keys by pattern ``count`` allows for hint the minimum number of returns """ with self.pipe as pipe: f = Future() res = pipe.... |
def pfcount(self, *sources): """ Return the approximated cardinality of the set observed by the HyperLogLog at key(s). Using the execute_command because redis-py-cluster disabled it unnecessarily. but you can only send one key at a time in that case, or only keys that map to the same keyslot. Use at your own risk. :par... |
def pfmerge(self, dest, *sources): """ Merge N different HyperLogLogs into a single one. :param dest: :param sources: :return: """ sources = [self.redis_key(k) for k in sources] with self.pipe as pipe: return pipe.pfmerge(self.redis_key(dest), *sources) |
def job_stats_enhanced(job_id): """ Get full job and step stats for job_id """ stats_dict = {} with os.popen('bjobs -o "jobid run_time cpu_used queue slots stat exit_code start_time estimated_start_time finish_time delimiter=\'|\'" -noheader ' + str(job_id)) as f: try: line = f.readline() cols = line.split('|') stats_d... |
stats_dict else: stats_dict['status'] = 'UNKNOWN' except Exception as e: print(e) print('LSF: Error reading job stats') stats_dict['status'] = 'UNKNOWN' return stats_dict |
def initialize(self, emt_id, emt_pass): """Manual initialization of the interface attributes. This is useful when the interface must be declare but initialized later on with parsed configuration values. Args: emt_id (str): ID given by the server upon registration emt_pass (str): Token given by the server upon registrat... |
def request_openbus(self, service, endpoint, **kwargs): """Make a request to the given endpoint of the ``openbus`` server. This returns the plain JSON (dict) response which can then be parsed using one of the implemented types. Args: service (str): Service to fetch ('bus' or 'geo'). endpoint (str): Endpoint to send the... |
return requests.post(url, data=kwargs, verify=False).json() return requests.post(url, data=kwargs, verify=True).json() |
def request_parking(self, endpoint, url_args={}, **kwargs): """Make a request to the given endpoint of the ``parking`` server. This returns the plain JSON (dict) response which can then be parsed using one of the implemented types. Args: endpoint (str): Endpoint to send the request to. This string corresponds to the ke... |
def parseSearchTerm(term): """ Turn a string search query into a two-tuple of a search term and a dictionary of search keywords. """ terms = [] keywords = {} for word in term.split(): if word.count(':') == 1: k, v = word.split(u':') if k and v: keywords[k] = v elif k or v: terms.append(k or v) else: terms.append(word) ... |
def gtpswd(prompt, confirmPassword): """ Temporary wrapper for Twisted's getPassword until a version that supports customizing the 'confirm' prompt is released. """ try: return util.getPassword(prompt=prompt, confirmPrompt=confirmPassword, confirm=True) except TypeError: return util.getPassword(prompt=prompt, confirm=T... |
def _createCert(self, hostname, serial): """ Create a self-signed X.509 certificate. @type hostname: L{unicode} @param hostname: The hostname this certificate should be valid for. @type serial: L{int} @param serial: The serial number the certificate should have. @rtype: L{bytes} @return: The serialized certificate in P... |
def installSite(self, siteStore, domain, publicURL, generateCert=True): """ Create the necessary items to run an HTTP server and an SSH server. """ certPath = siteStore.filesdir.child("server.pem") if generateCert and not certPath.exists(): certPath.setContent(self._createCert(domain, genSerial())) # Install the base M... |
def fetch(self): """ Fetch & return a new `Tag` object representing the tag's current state :rtype: Tag :raises DOAPIError: if the API endpoint replies with an error (e.g., if the tag no longer exists) """ api = self.doapi_manager return api._tag(api.request(self.url)["tag"]) |
def update_tag(self, name): # The `_tag` is to avoid conflicts with MutableMapping.update. """ Update (i.e., rename) the tag :param str name: the new name for the tag :return: an updated `Tag` object :rtype: Tag :raises DOAPIError: if the API endpoint replies with an error """ api = self.doapi_manager return api._tag(a... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.