code stringlengths 1 18.2k |
|---|
def update(self, **kwds): """ Endpoint: /tag/<id>/update.json Updates this tag with the specified parameters. Returns the updated tag object. """ result = self._client.tag.update(self, **kwds) self._replace_fields(result.get_fields()) |
def generate(count=1, length=12, chars=ALPHNUM): """ Generate password Kwargs: count (int):: How many passwords should be returned? length (int):: How many characters should the password contain allowed_chars (str):: Characters Returns: String with the password. If count > 1 then the return value will be auto_now= list... |
def identity(self): """ A unique identifier for the current visitor. """ if hasattr(self._identity, 'get_identity'): return self._identity.get_identity(self._environ) return self._identity(self._environ) |
def split(self, experiment_name, *variants): """ Used to split and track user experience amongst one or more variants. :param experiment_name a unique string name for the experiment :param *variants can take many forms, depending on usage. Variants should be provided as arbitrary tuples in the format ('unique_string_la... |
the control and False is the experiment, e.g., >>> sidebar() if split('include_sidebar') else empty() """ # Perform some minimal type checking if not isinstance(experiment_name, string_types): raise RuntimeError( 'Invalid experiment name: %s must be a string.' % experiment_name ) keys, values, weights = self._parse_var... |
variant assigned to the current user if experiment.name in self._environ.get('cleaver.override', {}): variant = self._environ['cleaver.override'][experiment.name] else: variant = b.get_variant(self.identity, experiment.name) if variant is None: # ...or choose (and store) one randomly if it doesn't exist yet variant = n... |
def score(self, experiment_name): """ Used to mark the current user's experiment variant as "converted" e.g., "Suzy, who was shown the large button, just signed up." Conversions will *only* be marked for visitors who have been verified as humans (to avoid skewing reports with requests from bots and web crawlers). :para... |
def find_element(list, index, index2=1): """ When you have list like: a = [(0, 10), (1, 20), (2, 30)] and you need to get value from tuple with first value == index Usage: {% find_element 1 %} will return 20 """ for x in list: if x[0] == index: return x[index2] return None |
def get_dict(parser, token): """ Call {% get_dict dict key default_key %} or {% get_dict dict key %} Return value from dict of key element. If there are no key in get_dict it returns default_key (or '') Return value will be in parameter 'value' """ bits = token.contents.split(' ') return GetDict(bits[1], bits[2], ((len... |
def filter(parser, token): """ Filter tag for Query sets. Use with set tag =) {% set filter posts status 0 drafts %} """ bits = token.contents.split(' ') return FilterTag(bits[1], bits[2:]) |
def _resolve_lookup(self, context): """ Performs resolution of a real variable (i.e. not a literal) against the given context. As indicated by the method's name, this method is an implementation detail and shouldn't be called by external code. Use Variable.resolve() instead. """ current = context try: # catch-all for s... |
lookup current = current[int(bit)] except (IndexError, # list index out of range ValueError, # invalid literal for int() KeyError, # current is a dict without `int(bit)` key TypeError, # unsubscriptable object ): raise VariableDoesNotExist("Failed lookup for key [%s] in %r", (bit, current)) # missing attribute except E... |
def setWidget(self, widget, index=0, row=None, col=0, rowspan=1, colspan=1): """ Add new widget inside dock, remove old one if existent """ if row is None: row = self.currentRow self.currentRow = max(row + 1, self.currentRow) if index > len(self.widgets) - 1: # add new widget self.widgets.append(widget) else: # change ... |
def _saferound(value, decimal_places): """ Rounds a float value off to the desired precision """ try: f = float(value) except ValueError: return '' format = '%%.%df' % decimal_places return format % f |
def ap_state(value, failure_string=None): """ Converts a state's name, postal abbreviation or FIPS to A.P. style. Example usage: >> ap_state("California") 'Calif.' """ try: return statestyle.get(value).ap except: if failure_string: return failure_string else: return value |
def capfirst(value, failure_string='N/A'): """ Capitalizes the first character of the value. If the submitted value isn't a string, returns the `failure_string` keyword argument. Cribbs from django's default filter set """ try: value = value.lower() return value[0].upper() + value[1:] except: return failure_string |
def dollar_signs(value, failure_string='N/A'): """ Converts an integer into the corresponding number of dollar sign symbols. If the submitted value isn't a string, returns the `failure_string` keyword argument. Meant to emulate the illustration of price range on Yelp. """ try: count = int(value) except ValueError: retu... |
def image(value, width='', height=''): """ Accepts a URL and returns an HTML image tag ready to be displayed. Optionally, you can set the height and width with keyword arguments. """ style = "" if width: style += "width:%s" % width if height: style += "height:%s" % height data_dict = dict(src=value, style=style) return... |
def intcomma(value): """ Borrowed from django.contrib.humanize Converts an integer to a string containing commas every three digits. For example, 3000 becomes '3,000' and 45000 becomes '45,000'. """ orig = str(value) new = re.sub("^(-?\d+)(\d{3})", '\g<1>,\g<2>', orig) if orig == new: return new else: return intcomma(n... |
def percentage(value, decimal_places=1, multiply=True, failure_string='N/A'): """ Converts a floating point value into a percentage value. Number of decimal places set by the `decimal_places` kwarg. Default is one. By default the number is multiplied by 100. You can prevent it from doing that by setting the `multiply` ... |
def percent_change(value, decimal_places=1, multiply=True, failure_string='N/A'): """ Converts a floating point value into a percentage change value. Number of decimal places set by the `precision` kwarg. Default is one. Non-floats are assumed to be zero division errors and are presented as 'N/A' in the output. By defa... |
def ratio(value, decimal_places=0, failure_string='N/A'): """ Converts a floating point value a X:1 ratio. Number of decimal places set by the `precision` kwarg. Default is one. """ try: f = float(value) except ValueError: return failure_string return _saferound(f, decimal_places) + ':1' |
def title(value, failure_string='N/A'): """ Converts a string into titlecase. Lifted from Django. """ try: value = value.lower() t = re.sub("([a-z])'([A-Z])", lambda m: m.group(0).lower(), value.title()) result = re.sub("\d([A-Z])", lambda m: m.group(0).lower(), t) if not result: return failure_string return result exc... |
def get(self, i): """Extract i'th character of each element. Parameters ---------- i : int Returns ------- Series """ check_type(i, int) return _series_str_result(self, weld_str_get, i=i) |
def slice(self, start=None, stop=None, step=None): """Slice substrings from each element. Note that negative step is currently not supported. Parameters ---------- start : int stop : int step : int Returns ------- Series """ check_type(start, int) check_type(stop, int) check_type(step, int) if step is not None and step... |
def contains(self, pat): """Test if pat is included within elements. Parameters ---------- pat : str Returns ------- Series """ check_type(pat, str) return _series_bool_result(self, weld_str_contains, pat=pat) |
def startswith(self, pat): """Test if elements start with pat. Parameters ---------- pat : str Returns ------- Series """ check_type(pat, str) return _series_bool_result(self, weld_str_startswith, pat=pat) |
def endswith(self, pat): """Test if elements end with pat. Parameters ---------- pat : str Returns ------- Series """ check_type(pat, str) return _series_bool_result(self, weld_str_endswith, pat=pat) |
def find(self, sub, start=0, end=None): """Test if elements contain substring. Parameters ---------- sub : str start : int, optional Index to start searching from. end : int, optional Index to stop searching from. Returns ------- Series """ check_type(sub, str) check_type(start, int) check_type(end, int) if end is not ... |
def replace(self, pat, rep): """Replace first occurrence of pat with rep in each element. Parameters ---------- pat : str rep : str Returns ------- Series """ check_type(pat, str) check_type(rep, str) return _series_str_result(self, weld_str_replace, pat=pat, rep=rep) |
def split(self, pat, side='left'): """Split once each element from the left and select a side to return. Note this is unlike pandas split in that it essentially combines the split with a select. Parameters ---------- pat : str side : {'left', 'right'} Which side of the split to select and return in each element. Return... |
def admin_tagify(short_description=None, allow_tags=True): """ Decorator that add short_description and allow_tags to ModelAdmin list_display function. Example: class AlbumAdmin(admin.ModelAdmin): list_display = ['title', 'year', 'artist', 'total_tacks', 'view_track'] @admin_tagify("View track") def view_songs(self, ob... |
def foreign_field_func(field_name, short_description=None, admin_order_field=None): """ Allow to use ForeignKey field attributes at list_display in a simple way. Example: from misc.admin import foreign_field_func as ff class SongAdmin(admin.ModelAdmin): list_display = ['name', 'time', 'artist', 'album', ff('track__num'... |
def queryset(self, request): """Returns a Queryset of all model instances that can be edited by the admin site. This is used by changelist_view.""" query_set = self.model._default_manager.all_with_deleted() ordering = self.ordering or () if ordering: query_set = query_set.order_by(*ordering) return query_set |
def send_request (operation, expression): """ Send an HTTP GET request to the newton API operation: one of the API endpoints expression: the str for the given endpoint to evaluate """ base = 'https://newton.now.sh' url = '%s/%s/%s' % (base, operation, urllib.parse.quote(expression)) with urllib.request.urlopen(url) as ... |
def handle_response (response): """ Handle a response from the newton API """ response = json.loads(response.read()) # Was the expression valid? if 'error' in response: raise ValueError(response['error']) else: # Some of the strings returned can be parsed to integers or floats try: return json.loads(response['result'])... |
def expose_endpoints (module, *args): """ Expose methods to the given module for each API endpoint """ for op in args: # Capture the closure state def create_method (o): return lambda exp: send_request(o, exp) setattr(sys.modules[__name__], op, create_method(op)) setattr(module, op, getattr(sys.modules[__name__], op)) |
def get_config_path(config_file): """ Given the name of a config file, returns the full path """ config_path = os.getenv('XDG_CONFIG_HOME') if not config_path: config_path = os.path.join(os.getenv('HOME'), ".config") if not config_file: config_file = "default" return os.path.join(config_path, "trovebox", config_file) |
def read_config(config_path): """ Loads config data from the specified file path. If config_file doesn't exist, returns an empty authentication config for localhost. """ section = "DUMMY" defaults = {'host': 'localhost', 'consumerKey': '', 'consumerSecret': '', 'token': '', 'tokenSecret':'', } # Insert an section heade... |
config: config[key] = defaults[key] return config |
def etype(self) -> Tuple[str, str]: '''Returns the expression's type.''' if self._expr[0] in ['number', 'boolean']: return ('constant', str(type(self._expr[1]))) elif self._expr[0] == 'pvar_expr': return ('pvar', self._expr[1][0]) elif self._expr[0] == 'randomvar': return ('randomvar', self._expr[1][0]) elif self._expr... |
else: return ('UNKOWN', 'UNKOWN') |
def args(self) -> Union[Value, Sequence[ExprArg]]: '''Returns the expression's arguments.''' if self._expr[0] in ['number', 'boolean']: return self._expr[1] elif self._expr[0] == 'pvar_expr': return self._expr[1] elif self._expr[0] == 'randomvar': return self._expr[1][1] elif self._expr[0] in ['+', '-', '*', '/']: retu... |
def name(self) -> str: '''Returns the name of pvariable. Returns: Name of pvariable. Raises: ValueError: If not a pvariable expression. ''' if not self.is_pvariable_expression(): raise ValueError('Expression is not a pvariable.') return self._pvar_to_name(self.args) |
def __expr_str(cls, expr, level): '''Returns string representing the expression.''' ident = ' ' * level * 4 if isinstance(expr, tuple): return '{}{}'.format(ident, str(expr)) if expr.etype[0] in ['pvar', 'constant']: return '{}Expression(etype={}, args={})'.format(ident, expr.etype, expr.args) if not isinstance(expr, E... |
def __get_scope(cls, expr: Union['Expression', Tuple]) -> Set[str]: '''Returns the set of fluents in the expression's scope. Args: expr: Expression object or nested tuple of Expressions. Returns: The set of fluents in the expression's scope. ''' scope = set() for i, atom in enumerate(expr): if isinstance(atom, Expressi... |
def _pvar_to_name(cls, pvar_expr): '''Returns the name of pvariable. Returns: Name of pvariable. ''' functor = pvar_expr[0] arity = len(pvar_expr[1]) if pvar_expr[1] is not None else 0 return '{}/{}'.format(functor, arity) |
def get_client_ip(request): """ Get the client IP from the request """ # set the default value of the ip to be the REMOTE_ADDR if available # else None ip = request.META.get('REMOTE_ADDR') # try to get the first non-proxy ip (not a private ip) from the # HTTP_X_FORWARDED_FOR x_forwarded_for = request.META.get('HTTP_X_F... |
def browse(self): ''' Browse the history of a single file adds one commit that doesn't contain changes in test_file_1. there are four commits in summary, so the check for buffer line count compares with 3. at the end, a fifth commit must be present due to resetting the file contents. ''' check = self._check marker_text... |
def open(self, *args, **kwargs): """ Works exactly like the Telnet.open() call from the telnetlib module, except SSL/TLS may be transparently negotiated. """ Telnet.open(self, *args, **kwargs) if self.force_ssl: self._start_tls() |
def _take(d, key, default=None): """ If the key is present in dictionary, remove it and return it's value. If it is not present, return None. """ if key in d: cmd = d[key] del d[key] return cmd else: return default |
def _get_cmds_id(*cmds): """ Returns an identifier for a group of partially tagged commands. If there are no tagged commands, returns None. """ tags = [cmd[2] if len(cmd) == 3 else None for cmd in cmds] if [tag for tag in tags if tag != None]: return tuple(tags) else: return None |
def received_message(self, msg): """ Handle receiving a message by checking whether it is in response to a command or unsolicited, and dispatching it to the appropriate object method. """ logger.debug("Received message: %s", msg) if msg.is_binary: raise ValueError("Binary messages not supported") resps = json.loads(msg... |
def _tag_cmds(self, *cmds): """ Yields tagged commands. """ for (method, args) in cmds: tagged_cmd = [method, args, self._tag] self._tag = self._tag + 1 yield tagged_cmd |
def send_cmds(self, *cmds): """ Tags and sends the commands to the Switchboard server, returning None. Each cmd be a 2-tuple where the first element is the method name, and the second is the arguments, e.g. ("connect", {"host": ...}). """ promise = aplus.Promise() tagged_cmds = list(self._tag_cmds(*cmds)) logger.debug(... |
def main(self, x): """ Transposed form FIR implementation, uses full precision """ for i in range(len(self.taps_fix_reversed)): self.next.mul[i] = x * self.taps_fix_reversed[i] if i == 0: self.next.acc[0] = self.mul[i] else: self.next.acc[i] = self.acc[i - 1] + self.mul[i] self.next.out = self.acc[-1] return self.out |
def main(argString=None): """The main function of the module. :param argString: the options. :type argString: list These are the steps: 1. Prints the options. 2. Compute frequency using Plink. 3. Runs bafRegress. """ # Getting and checking the options args = parseArgs(argString) checkArgs(args) logger.info("Options use... |
def check_sample_files(fam_filename, raw_dirname): """Checks the raw sample files. :param fam_filename: the name of the FAM file. :param raw_dirname: the name of the directory containing the raw file. :type fam_filename: str :type raw_dirname: str :returns: the set of all the sample files that are compatible with the F... |
raise ProgramError("no sample left for analysis") return sample_files |
def create_extraction_file(bim_filename, out_prefix): """Creates an extraction file (keeping only markers on autosomes). :param bim_filename: the name of the BIM file. :param out_prefix: the prefix for the output file. :type bim_filename: str :type out_prefix: str """ o_file = None try: o_file = open(out_prefix + ".to_... |
def run_bafRegress(filenames, out_prefix, extract_filename, freq_filename, options): """Runs the bafRegress function. :param filenames: the set of all sample files. :param out_prefix: the output prefix. :param extract_filename: the name of the markers to extract. :param freq_filename: the name of the file containing th... |
out_prefix + ".bafRegress", )) |
def run_bafRegress_sge(filenames, out_prefix, extract_filename, freq_filename, options): """Runs the bafRegress function using SGE. :param filenames: the set of all sample files. :param out_prefix: the output prefix. :param extract_filename: the name of the markers to extract. :param freq_filename: the name of the file... |
"--colsample", options.colsample, "--colmarker", options.colmarker, "--colbaf", options.colbaf, "--colab1", options.colab1, "--colab2", options.colab2, ] # Creating chunks chunks = [ list(filenames)[i: i+options.sample_per_run_for_sge] for i in range(0, len(filenames), options.sample_per_run_for_sge) ] # Run for each s... |
in job_ids: ret_val = s.wait(job_id, drmaa.Session.TIMEOUT_WAIT_FOREVER) had_problems.append(ret_val.exitStatus == 0) # Deleting the jobs for jt in job_templates: s.deleteJobTemplate(jt) # Closing the session s.exit() # Checking for problems if not all(had_problems): raise ProgramError("Some SGE jobs had errors...") # ... |
def run_plink(in_prefix, out_prefix, extract_filename): """Runs Plink with the geno option. :param in_prefix: the input prefix. :param out_prefix: the output prefix. :param extract_filename: the name of the file containing markers to extract. :type in_prefix: str :type out_prefix: str :param extract_filename: str """ #... |
def checkArgs(args): """Checks the arguments and options. :param args: an object containing the options of the program. :type args: argparse.Namespace :returns: ``True`` if everything was OK. If there is a problem with an option, an exception is raised using the :py:class:`ProgramError` class, a message is printed to t... |
def plot_contours(f, x, samples, ax=None, **kwargs): r""" Plot the probability mass function given `x` at a range of :math:`y` values for :math:`y = f(x|\theta)` :math:`P(y|x) = \int P(y=f(x;\theta)|x,\theta) P(\theta) d\theta` :math:`\mathrm{pmf}(y|x) = \int_{P(y'|x) < P(y|x)} P(y'|x) dy'` Additionally, if a list of l... |
then :func:`matplotlib.pyplot.gca()` is used to get the last axis used, or create a new one. logZ: 1D array-like, optional log-evidences of each model if multiple models are passed. Should be same length as the list `f`, and need not be normalised. Default: `numpy.ones_like(f)` weights: 1D array-like, optional sample w... |
arguments Any further keyword arguments are plotting keywords that are passed to :func:`fgivenx.plot.plot`. Returns ------- cbar: color bar :class:`matplotlib.contour.QuadContourSet` Colors to create a global colour bar """ logZ = kwargs.pop('logZ', None) weights = kwargs.pop('weights', None) ntrim = kwargs.pop('ntrim'... |
def plot_lines(f, x, samples, ax=None, **kwargs): r""" Plot a representative set of functions to sample Additionally, if a list of log-evidences are passed, along with list of functions, and list of samples, this function plots the probability mass function for all models marginalised according to the evidences. Parame... |
model if multiple models are passed. Should be same length as the list `f`, and need not be normalised. Default: `numpy.ones_like(f)` weights: 1D array-like, optional sample weights (or list of weights), if desired. Should have length same as `samples.shape[0]`. Default: `numpy.ones_like(samples)` ntrim: int, optional ... |
ntrim=ntrim, parallel=parallel, cache=cache, tqdm_kwargs=tqdm_kwargs) fgivenx.plot.plot_lines(x, fsamps, ax, **kwargs) |
def plot_dkl(f, x, samples, prior_samples, ax=None, **kwargs): r""" Plot the Kullback-Leibler divergence at each value of :math:`x` for the prior and posterior defined by `prior_samples` and `samples`. Let the posterior be: :math:`P(y|x) = \int P(y=f(x;\theta)|x,\theta)P(\theta) d\theta` and the prior be: :math:`Q(y|x)... |
from posterior and prior to evaluate :math:`f(x;\theta)` at. `shape = (nsamples, npars)` ax: axes object, optional :class:`matplotlib.axes._subplots.AxesSubplot` to plot the contours onto. If unsupplied, then :func:`matplotlib.pyplot.gca()` is used to get the last axis used, or create a new one. logZ: 1D array-like, op... |
kwargs: further keyword arguments Any further keyword arguments are plotting keywords that are passed to :func:`fgivenx.plot.plot`. """ logZ = kwargs.pop('logZ', None) weights = kwargs.pop('weights', None) prior_weights = kwargs.pop('prior_weights', None) ntrim = kwargs.pop('ntrim', None) cache = kwargs.pop('cache', ''... |
def compute_samples(f, x, samples, **kwargs): r""" Apply the function(s) :math:`f(x;\theta)` to the arrays defined in `x` and `samples`. Has options for weighting, trimming, cacheing & parallelising. Additionally, if a list of log-evidences are passed, along with list of functions, samples and optional weights it margi... |
1D array-like, optional sample weights (or list of weights), if desired. Should have length same as `samples.shape[0]`. Default: `numpy.ones_like(samples)` ntrim: int, optional Approximate number of samples to trim down to, if desired. Useful if the posterior is dramatically oversampled. Default: None cache: str, optio... |
samples, weights) logZ, weights = _normalise_weights(logZ, weights, ntrim) for i, (s, w) in enumerate(zip(samples, weights)): samples[i] = _equally_weight_samples(s, w) return fgivenx.samples.compute_samples(f, x, samples, parallel=parallel, cache=cache, tqdm_kwargs=tqdm_kwargs) |
def compute_pmf(f, x, samples, **kwargs): r""" Compute the probability mass function given `x` at a range of `x` values for :math:`y = f(x|\theta)` :math:`P(y|x) = \int P(y=f(x;\theta)|x,\theta) P(\theta) d\theta` :math:`\mathrm{pmf}(y|x) = \int_{P(y'|x) < P(y|x)} P(y'|x) dy'` Additionally, if a list of log-evidences a... |
list `f`, and need not be normalised. Default: `numpy.ones_like(f)` weights: 1D array-like, optional sample weights (or list of weights), if desired. Should have length same as `samples.shape[0]`. Default: `numpy.ones_like(samples)` ny: int, optional Resolution of y axis. Default: `100` y: array-like, optional Explicit... |
= kwargs.pop('y', None) ntrim = kwargs.pop('ntrim', 100000) parallel = kwargs.pop('parallel', False) cache = kwargs.pop('cache', '') tqdm_kwargs = kwargs.pop('tqdm_kwargs', {}) if kwargs: raise TypeError('Unexpected **kwargs: %r' % kwargs) # y if y is not None: y = numpy.array(y, dtype='double') if len(y.shape) is not ... |
def compute_dkl(f, x, samples, prior_samples, **kwargs): r""" Compute the Kullback-Leibler divergence at each value of `x` for the prior and posterior defined by `prior_samples` and `samples`. Parameters ---------- f: function function :math:`f(x;\theta)` (or list of functions for each model) with dependent variable :m... |
int, optional Approximate number of samples to trim down to, if desired. Useful if the posterior is dramatically oversampled. Default: None cache, prior_cache: str, optional File roots for saving previous calculations for re-use parallel, tqdm_args: see docstring for :func:`fgivenx.parallel.parallel_apply` kwargs: furt... |
= [prior_weights] cache = [cache] prior_cache = [prior_cache] DKLs = [] for fi, c, pc, s, w, ps, pw in zip(f, cache, prior_cache, samples, weights, prior_samples, prior_weights): fsamps = compute_samples(fi, x, s, weights=w, ntrim=ntrim, parallel=parallel, cache=c, tqdm_kwargs=tqdm_kwargs) fsamps_prior = compute_sample... |
def read_txt_file(filepath): """read text from `filepath` and remove linebreaks """ if sys.version > '3': with open(filepath,'r',encoding='utf-8') as txt_file: return txt_file.readlines() else: with open(filepath) as txt_file: return txt_file.readlines() |
def _get_all_slots(self): """Returns all slots as set""" all_slots = (getattr(cls, '__slots__', []) for cls in self.__class__.__mro__) return set(slot for slots in all_slots for slot in slots) |
def trim(self, video_name, out, start, duration): """ Trims a clip to be duration starting at start @param video_name : name of the input video @param out : name of the output video @param start : starting position after the trim @param duration : duration of video after start """ command = ['ffmpeg', '-ss', start, '-i... |
def skip(self, video_name, out, start, duration): """ Skips a section of the clip @param video_name : name of video input file @param out : name of output file @param start : start time of the skip (seconds) @param duration : duration of the skip (seconds) """ cfilter = (r"[0:v]trim=duration={start}[av];" r"[0:a]atrim=... |
def draw_video(self, underlay, overlay, out, x, y): """ Draws one video over another @param underlay : video file on bottom @param overlay : video file to render on top @param out : output file @param start : starting position of overlay @param end : end position of overlay @param x : x position of overlay @param y : y... |
call(command) |
def draw_text(self, video_name, out, start, end, x, y, text, color='0xFFFFFF', show_background=0, background_color='0x000000', size=16): """ Draws text over a video @param video_name : name of video input file @param out : name of video output file @param start : start timecode to draw text hh:mm:ss @param end : end ti... |
cfilter, '-an', '-y', '-map', '[vout]', '-map', '[aout]', out] if self.verbose: print 'Drawing text "{0}" onto {1} output as {2}'.format( text, video_name, out, ) print ' '.join(command) call(command) |
def draw_image(self, video_name, image_name, out, start, end, x, y, verbose=False): """ Draws an image over the video @param video_name : name of video input file @param image_name: name of image input file @param out : name of video output file @param start : when to start overlay @param end : when to end overlay @par... |
def loop(self, video_name, out, start, duration, iterations, video_length, verbose=False): """ Loops a section of a video @param video_name : name of video input file @param out : name of video output file @param start : start time of loop (timestamp hh:mm:ss) @param duration : duration of loop section (seconds) @param... |
# concat the loop clip upon itself n times call(['ffmpeg', '-f', 'concat', '-i', 'loop.txt', '-y', '-c', 'copy', loops.name]) # concat the beginning clip, combo of loops, and end clip cfilter = (r"[0:0] [0:1] [1:0] [1:1] [2:0] [2:1]" r"concat=n=3:v=1:a=1 [v] [a1]") call(['ffmpeg', '-i', beginning.name, '-i', loops.name... |
def make_field(self, types, domain, items): """Copy+Paste of TypedField.make_field() from Sphinx version 1.2.3. The first and second nodes.Text() instance are changed in this implementation to be ' : ' and '' respectively (instead of ' (' and ')'). TODO: Ask sphinx devs if there is a better way to support this that is ... |
domain, typename) else: par += fieldtype par += nodes.Text('') par += nodes.Text(' -- ') par += content return par fieldname = nodes.field_name('', self.label) if len(items) == 1 and self.can_collapse: fieldarg, content = items[0] bodynode = handle_item(fieldarg, content) else: bodynode = self.list_type() for fieldarg,... |
def _pseudo_parse_arglist(signode, arglist): """Parse list of comma separated arguments. Arguments can have optional types. """ paramlist = addnodes.desc_parameterlist() stack = [paramlist] try: for argument in arglist.split(','): argument = argument.strip() ends_open = 0 ends_close = 0 while argument.startswith('['): ... |
partially populated paramlist node. signode += addnodes.desc_parameterlist() signode[-1] += addnodes.desc_parameter(arglist, arglist) else: signode += paramlist |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.