code stringlengths 1 18.2k |
|---|
def push(self, set_upstream: bool = True): """ Pushes all refs (branches and tags) to origin """ LOGGER.info('pushing repo to origin') try: self.repo.git.push() except GitCommandError as error: if 'has no upstream branch' in error.stderr and set_upstream: self.repo.git.push(f'--set-upstream origin {self.get_current_bra... |
def list_branches(self) -> typing.List[str]: """ :return: branches names :rtype: list of str """ branches: typing.List[str] = [head.name for head in self.repo.heads] LOGGER.debug('branches: %s', branches) return branches |
def get_sha(self) -> str: """ :return: SHA of the latest commit :rtype: str """ current_sha: str = self.repo.head.commit.hexsha LOGGER.debug('current commit SHA: %s', current_sha) return current_sha |
def get_short_sha(self) -> str: """ :return: short SHA of the latest commit :rtype: str """ short_sha: str = self.get_sha()[:7] LOGGER.debug('short SHA: %s', short_sha) return short_sha |
def checkout(self, reference: str): """ Checks out a reference. If the index is dirty, or if the repository contains untracked files, the function will fail. :param reference: reference to check out :type reference: str """ LOGGER.info('checking out: %s', reference) if not self.index_is_empty(): LOGGER.error('index con... |
def create_branch(self, branch_name: str): """ Creates a new branch Args: branch_name: name of the branch """ LOGGER.info('creating branch: %s', branch_name) self._validate_branch_name(branch_name) if branch_name in self.list_branches(): LOGGER.error('branch already exists') sys.exit(-1) new_branch = self.repo.create_h... |
def create_branch_and_checkout(self, branch_name: str): """ Creates a new branch if it doesn't exist Args: branch_name: branch name """ self.create_branch(branch_name) self.checkout(branch_name) |
def is_dirty(self, untracked=False) -> bool: """ Checks if the current repository contains uncommitted or untracked changes Returns: true if the repository is clean """ result = False if not self.index_is_empty(): LOGGER.error('index is not empty') result = True changed_files = self.changed_files() if bool(changed_file... |
def startswith(text, ignore_case=True): """ Test if a string-field start with ``text``. Example:: filters = {"path": Text.startswith(r"C:\\")} """ if ignore_case: compiled = re.compile( "^%s" % text.replace("\\", "\\\\"), re.IGNORECASE) else: # pragma: no cover compiled = re.compile("^%s" % text.replace("\\", "\\\\")) ... |
def fulltext(search, lang=Lang.English, ignore_case=True): """Full text search. Example:: filters = Text.fulltext("python pymongo_mate") .. note:: This field doesn't need to specify field. """ return { "$text": { "$search": search, "$language": lang, "$caseSensitive": not ignore_case, "$diacriticSensitive": False, } } |
def near(lat, lng, max_dist=None, unit_miles=False): """Find document near a point. For example:: find all document with in 25 miles radius from 32.0, -73.0. """ filters = { "$nearSphere": { "$geometry": { "type": "Point", "coordinates": [lng, lat], } } } if max_dist: if unit_miles: # pragma: no cover max_dist = max_di... |
def children(self) : "If the FSNode is a directory, returns a list of the children" if not self.isdir() : raise Exception("FSQuery tried to return the children of a node which is not a directory : %s" % self.abs) return [FSNode(self.abs + "/" + x,self.root,self.depth+1) for x in os.listdir(self.abs)] |
def add_file(self,fName,content) : """If this FSNode is a directory, write a file called fName containing content inside it""" if not self.isdir() : raise Exception("FSQuery tried to add a file in a node which is not a directory : %s" % self.abs) self.write_file("%s/%s"%(self.abs,fName),content) |
def open_file(self) : """If this FSNode is a file, open it for reading and return the file handle""" if self.isdir() : raise Exception("FSQuery tried to open a directory as a file : %s" % self.abs) return open(self.abs) |
def mk_dir(self) : """If this FSNode doesn't currently exist, then make a directory with this name.""" if not os.path.exists(self.abs) : os.makedirs(self.abs) |
def walk(self,depth=0,fsNode=None) : """Note, this is a filtered walk""" if not fsNode : fsNode = FSNode(self.init_path,self.init_path,0) if fsNode.isdir() : if self.check_dir(fsNode) : if self.check_return(fsNode) : yield fsNode for n in fsNode.children() : if n.islink() : # currently we don't follow links continue fo... |
def shadow(self,new_root,visitor) : """ Runs through the query, creating a clone directory structure in the new_root. Then applies process""" for n in self.walk() : sn = n.clone(new_root) if n.isdir() : visitor.process_dir(n,sn) else : visitor.process_file(n,sn) |
def DirContains(self,f) : """ Matches dirs that have a child that matches filter f""" def match(fsNode) : if not fsNode.isdir() : return False for c in fsNode.children() : if f(c) : return True return False return self.make_return(match) |
def register(self, peer): """ Registers a peer according to its description :param peer: A Peer description bean :raise KeyError: """ assert isinstance(peer, beans.Peer) with self.__lock: # Check presence peer_id = peer.peer_id if peer_id in self.peers: raise KeyError("Already known peer: {0}".format(peer)) # Store the... |
def unregister(self, peer_id): """ Unregisters the given peer :param peer_id: A peer UUID :raise KeyError: Unknown peer """ with self.__lock: # Pop it from accesses (will raise a KeyError if absent) peer = self.peers.pop(peer_id) assert isinstance(peer, beans.Peer) # Remove it from groups for name in peer.groups: try: ... |
def reduce_contexts(parent, local): """Combine two test contexts into one. For value types of dict and list, the new context will aggregate the parent and local contexts. For other types, the value of the local context will replace the value of the parent (if any).""" context = {} for k,v in parent.items(): if type(v) ... |
def resolve_module(module, definitions): """Resolve (through indirections) the program contents of a module definition. The result is a list of program chunks.""" assert module in definitions, "No definition for module '%s'" % module d = definitions[module] if type(d) == dict: if 'filename' in d: with open(d['filename'... |
def canonicalize_spec(spec, parent_context): """Push all context declarations to the leaves of a nested test specification.""" test_specs = {k:v for (k,v) in spec.items() if k.startswith("Test")} local_context = {k:v for (k,v) in spec.items() if not k.startswith("Test")} context = reduce_contexts(parent_context, local_... |
def flatten_spec(spec, prefix,joiner=" :: "): """Flatten a canonical specification with nesting into one without nesting. When building unique names, concatenate the given prefix to the local test name without the "Test " tag.""" if any(filter(operator.methodcaller("startswith","Test"),spec.keys())): flat_spec = {} for... |
def load_stanzas(stanzas_file): """ Load stanzas from gold standard file """ f = stanzas_file.readlines() stanzas = [] for i, line in enumerate(f): if i % 4 == 0: stanza_words = line.strip().split()[1:] stanzas.append(Stanza(stanza_words)) return stanzas |
def get_wordlist(stanzas): """ Get an iterable of all final words in all stanzas """ return sorted(list(set().union(*[stanza.words for stanza in stanzas]))) |
def get_rhymelists(stanza, scheme): """ Returns ordered lists of the stanza's word indices as defined by given scheme """ rhymelists = defaultdict(list) for rhyme_group, word_index in zip(scheme, stanza.word_indices): rhymelists[rhyme_group].append(word_index) return list(rhymelists.values()) |
def init_distance_ttable(wordlist, distance_function): """ Initialize pair-wise rhyme strenghts according to the given word distance function """ n = len(wordlist) t_table = numpy.zeros((n, n + 1)) # Initialize P(c|r) accordingly for r, w in enumerate(wordlist): for c, v in enumerate(wordlist): if c < r: t_table[r, c] ... |
def init_uniform_ttable(wordlist): """ Initialize (normalized) theta uniformly """ n = len(wordlist) return numpy.ones((n, n + 1)) * (1 / n) |
def basic_word_sim(word1, word2): """ Simple measure of similarity: Number of letters in common / max length """ return sum([1 for c in word1 if c in word2]) / max(len(word1), len(word2)) |
def post_prob_scheme(t_table, stanza, scheme): """ Compute posterior probability of a scheme for a stanza, with probability of every word in rhymelist rhyming with all the ones before it """ myprob = 1 rhymelists = get_rhymelists(stanza, scheme) for rhymelist in rhymelists: for i, word_index in enumerate(rhymelist): if... |
def expectation_step(t_table, stanzas, schemes, rprobs): """ Compute posterior probability of schemes for each stanza """ probs = numpy.zeros((len(stanzas), schemes.num_schemes)) for i, stanza in enumerate(stanzas): scheme_indices = schemes.get_schemes_for_len(len(stanza)) for scheme_index in scheme_indices: scheme = s... |
def maximization_step(num_words, stanzas, schemes, probs): """ Update latent variables t_table, rprobs """ t_table = numpy.zeros((num_words, num_words + 1)) rprobs = numpy.ones(schemes.num_schemes) for i, stanza in enumerate(stanzas): scheme_indices = schemes.get_schemes_for_len(len(stanza)) for scheme_index in scheme_... |
def iterate(t_table, wordlist, stanzas, schemes, rprobs, maxsteps): """ Iterate EM and return final probabilities """ data_probs = numpy.zeros(len(stanzas)) old_data_probs = None probs = None num_words = len(wordlist) ctr = 0 for ctr in range(maxsteps): logging.info("Iteration {}".format(ctr)) old_data_probs = data_pro... |
def get_results(probs, stanzas, schemes): """ Returns a list of tuples ( stanza [as list of final words], best scheme [as list of integers] ) """ results = [] for i, stanza in enumerate(stanzas): best_scheme = schemes.scheme_list[numpy.argmax(probs[i, :])] results.append((stanza.words, best_scheme)) return results |
def print_results(results, outfile): """ Write results to outfile """ for stanza_words, scheme in results: outfile.write(str(' ').join(stanza_words) + str('\n')) outfile.write(str(' ').join(map(str, scheme)) + str('\n\n')) outfile.close() logging.info("Wrote result") |
def main(args_list=None): """ Wrapper for find_schemes if called from command line """ args_list = args_list or sys.argv[1:] parser = argparse.ArgumentParser(description='Discover schemes of given stanza file') parser.add_argument( 'infile', type=argparse.FileType('r'), ) parser.add_argument( 'outfile', help='Where the... |
'o': init_function = init_basicortho_ttable elif args.init_type == 'p': init_function = celex.init_perfect_ttable elif args.init_type == 'd': init_function = init_difflib_ttable results = find_schemes(stanzas, init_function, args.num_iterations) print_results(results, args.outfile) |
def set_word_indices(self, wordlist): """ Populate the list of word_indices, mapping self.words to the given wordlist """ self.word_indices = [wordlist.index(word) for word in self.words] |
def _parse_scheme_file(self): """ Initialize redundant data structures for lookup optimization """ schemes = json.loads(self.scheme_file.read(), object_pairs_hook=OrderedDict) scheme_list = [] scheme_dict = defaultdict(list) for scheme_len, scheme_group in schemes.items(): for scheme_str, _count in scheme_group: scheme... |
def _create_output_from_match(self, match_result): """As isort outputs full path, we change it to relative path.""" full_path = match_result['full_path'] path = self._get_relative_path(full_path) return LinterOutput(self.name, path, match_result['msg']) |
def parse(self, lines): """Get :class:`base.Result` parameters using regex. There are 2 lines for each pydocstyle result: 1. Filename and line number; 2. Message for the problem found. """ patterns = [re.compile(r'^(.+?):(\d+)'), re.compile(r'^\s+(.+)$')] for i, line in enumerate(lines): if i % 2 == 0: path, line_nr = ... |
def parse(self, lines): """Get :class:`base.Result` parameters using regex.""" pattern = re.compile(r"""^(?P<path>.+?) :(?P<msg>.+) :(?P<line_nr>\d+?) :(?P<col>\d+?)$""", re.VERBOSE) return self._parse_by_pattern(lines, pattern) |
def _generate_one_ephemeris( cmd): """generate one orbfit ephemeris **Key Arguments:** - ``cmd`` -- the command to execute [cmd, object] **Return:** - ``results`` -- the single ephemeris results """ global cmdList cmd = cmdList[cmd] results = [] for c in cmd: p = Popen(c[0], stdout=PIPE, stderr=PIPE, shell=True) stdout... |
result["object_name"] = c[1] results.append(result) return results |
def orbfit_ephemeris( log, objectId, mjd, settings, obscode=500, verbose=False, astorbPath=False): """Given a known solar-system object ID (human-readable name or MPC number but *NOT* an MPC packed format) or list of names and one or more specific epochs, return the calculated ephemerides **Key Arguments:** - ``log`` -... |
the returned ephemerides **Usage:** To generate a an ephemeris for a single epoch run,using ATLAS Haleakala as your observatory: .. code-block:: python from rockfinder import orbfit_ephemeris eph = orbfit_ephemeris( log=log, objectId=1, obscode="T05" mjd=57916., ) or to generate an ephemeris for multiple epochs: .. cod... |
import orbfit_ephemeris eph = orbfit_ephemeris( log=log, objectId=[1,5,03547,"Shikoku"], mjd=[57916.1,57917.234,57956.34523], astorbPath="/path/to/astorb.dat" ) """ log.debug('starting the ``orbfit_ephemeris`` function') global cmdList # MAKE SURE MJDs ARE IN A LIST if not isinstance(mjd, list): mjdList = [str(mjd)] el... |
10s cmdList = [c for c in chunks(tmpCmdList, 10)] # DEFINE AN INPUT ARRAY results = fmultiprocess(log=log, function=_generate_one_ephemeris, inputArray=range(len(cmdList))) if verbose == True: order = ["object_name", "mjd", "ra_deg", "dec_deg", "apparent_mag", "observer_distance", "heliocentric_distance", "phase_angle"... |
def text(short): """Compiles short markup text into an HTML strings""" return indent(short, branch_method=html_block_tag, leaf_method=convert_line, pass_syntax=PASS_SYNTAX, flush_left_syntax=FLUSH_LEFT_SYNTAX, flush_left_empty_line=FLUSH_LEFT_EMPTY_LINE, indentation_method=find_indentation) |
def get_indented_block(prefix_lines): """Returns an integer. The return value is the number of lines that belong to block begun on the first line. Parameters ---------- prefix_lines : list of basestring pairs Each pair corresponds to a line of SHPAML source code. The first element of each pair is indentation. The secon... |
def indent(text, branch_method, leaf_method, pass_syntax, flush_left_syntax, flush_left_empty_line, indentation_method, get_block=get_indented_block): """Returns HTML as a basestring. Parameters ---------- text : basestring Source code, typically SHPAML, but could be a different (but related) language. The remaining pa... |
pass_syntax, flush_left_syntax, flush_left_empty_line, indentation_method, get_block=get_indented_block) return '\n'.join(output) + '\n' |
def indent_lines(lines, output, branch_method, leaf_method, pass_syntax, flush_left_syntax, flush_left_empty_line, indentation_method, get_block): """Returns None. The way this function produces output is by adding strings to the list that's passed in as the second parameter. Parameters ---------- lines : list of bases... |
block = prefix_lines[:block_size] prefix_lines = prefix_lines[block_size:] branch_method(output, block, recurse) return prefix_lines = list(map(indentation_method, lines)) recurse(prefix_lines) |
def _write_reqs(amend: bool = False, stage: bool = False): """ Writes the requirement files Args: amend: amend last commit with changes stage: stage changes """ LOGGER.info('writing requirements') base_cmd = 'pipenv lock -r' _write_reqs_file(f'{base_cmd}', 'requirements.txt') _write_reqs_file(f'{base_cmd} -d', 'require... |
def reqs(amend: bool = False, stage: bool = False): """ Write requirements files Args: amend: amend last commit with changes stage: stage changes """ changed_files = CTX.repo.changed_files() if 'requirements.txt' in changed_files or 'requirements-dev.txt' in changed_files: LOGGER.error('Requirements have changed; canno... |
def chunks(data, size): """ Generator that splits the given data into chunks """ for i in range(0, len(data), size): yield data[i:i + size] |
def main(): """ Entry point """ client_1 = MessageBot("verne", "Jules Verne") client_1.start() client_1.connect("127.0.0.1") client_2 = MessageBot("adams", "Douglas Adams") client_2.start() client_2.connect("127.0.0.1") herald_1 = Herald(client_1) herald_1.start() herald_2 = Herald(client_2) herald_2.start() handler = ... |
def connect(self, host, port=6667, password=None): """ Connects to a server """ # Prepare the callbacks self._irc.add_global_handler('all_events', self.__handler) # Prepare the connection self._connection = self._irc.server().connect( host, port, self._nickname, password, self._username, self._realname) # Start connect... |
def __handler(self, connection, event): """ Handles an IRC event """ try: # Find local handler method = getattr(self, "on_{0}".format(event.type)) except AttributeError: pass else: try: # Call it return method(connection, event) except Exception as ex: logging.exception("Error calling handler: %s", ex) |
def close(self): """ Disconnects from the server """ # Disconnect with a fancy message, then close connection if self._connection is not None: self._connection.disconnect("Bot is quitting") self._connection.close() self._connection = None # Stop the client loop self.__stopped.set() if self.__thread is not None: try: se... |
def wait(self, timeout=None): """ Waits for the client to stop its loop """ self.__stopped.wait(timeout) return self.__stopped.is_set() |
def on_welcome(self, connection, event): """ Server welcome: we're connected """ # Start the pool self.__pool.start() logging.info("! Connected to server '%s': %s", event.source, event.arguments[0]) connection.join("#cohorte") |
def on_pubmsg(self, connection, event): """ Got a message from a channel """ sender = self.get_nick(event.source) channel = event.target message = event.arguments[0] self.handle_message(connection, sender, channel, message) |
def on_privmsg(self, connection, event): """ Got a message from a user """ sender = self.get_nick(event.source) message = event.arguments[0] if sender == 'NickServ': logging.info("Got message from NickServ: %s", message) if "password" in message.lower(): connection.privmsg("NickServ", "pass") else: connection.join('#co... |
def handle_message(self, connection, sender, target, message): """ Handles a received message """ parts = message.strip().split(' ', 2) if parts and parts[0].lower() == '!bot': try: command = parts[1].lower() except IndexError: self.safe_send(connection, target, "No command given") return try: payload = parts[2] except... |
def on_invite(self, connection, event): """ Got an invitation to a channel """ sender = self.get_nick(event.source) invited = self.get_nick(event.target) channel = event.arguments[0] if invited == self._nickname: logging.info("! I am invited to %s by %s", channel, sender) connection.join(channel) else: logging.info(">>... |
def _handle_command(self, connection, sender, target, command, payload): """ Handles a command, if any """ try: # Find the handler handler = getattr(self, "cmd_{0}".format(command)) except AttributeError: self.safe_send(connection, target, "Unknown command: %s", command) else: try: logging.info("! Handling command: %s"... |
def safe_send(self, connection, target, message, *args, **kwargs): """ Safely sends a message to the given target """ # Compute maximum length of payload prefix = "PRIVMSG {0} :".format(target) max_len = 510 - len(prefix) for chunk in chunks(message.format(*args, **kwargs), max_len): connection.send_raw("{0}{1}".format... |
def cmd_send(self, connection, sender, target, payload): """ Sends a message """ msg_target, topic, content = self.parse_payload(payload) results = self.__herald.send(msg_target, topic, content) self.safe_send(connection, target, "GOT RESULT: {0}".format(results)) |
def cmd_fire(self, connection, sender, target, payload): """ Sends a message """ msg_target, topic, content = self.parse_payload(payload) def callback(sender, payload): logging.info("FIRE ACK from %s", sender) self.__herald.fire(msg_target, topic, content, callback) |
def cmd_notice(self, connection, sender, target, payload): """ Sends a message """ msg_target, topic, content = self.parse_payload(payload) def callback(sender, payload): logging.info("NOTICE ACK from %s: %s", sender, payload) self.__herald.notice(msg_target, topic, content, callback) |
def cmd_post(self, connection, sender, target, payload): """ Sends a message """ msg_target, topic, content = self.parse_payload(payload) def callback(sender, payload): logging.info("POST RES from %s: %s", sender, payload) self.__herald.post(msg_target, topic, content, callback) |
def on_privmsg(self, connection, event): """ Got a message from a channel """ sender = self.get_nick(event.source) message = event.arguments[0] if sender == 'NickServ': logging.info("Got message from NickServ: %s", message) if "password" in message.lower(): connection.privmsg("NickServ", "pass") else: connection.join('... |
def __on_message(self, connection, sender, message): """ Got a message from a channel """ if message.strip() == '!bot send': cycle = itertools.cycle(string.digits) content = ''.join(next(cycle) for _ in range(100)) self.send_message(sender, content) else: parts = message.split(':', 2) if not parts or parts[0] != 'HRLD'... |
def __notify(self, sender, content): """ Calls back listener when a message is received """ if self.handle_message is not None: try: self.handle_message(sender, content) except Exception as ex: logging.exception("Error calling message listener: %s", ex) |
def _make_line(self, uid, command=None): """ Prepares an IRC line in Herald's format """ if command: return ":".join(("HRLD", command, uid)) else: return ":".join(("HRLD", uid)) |
def send_message(self, target, content, uid=None): """ Sends a message through IRC """ # Compute maximum length of payload prefix = "PRIVMSG {0} :".format(target) single_prefix = self._make_line("MSG:") single_prefix_len = len(single_prefix) max_len = 510 - len(prefix) content_len = len(content) if (content_len + singl... |
def __make_message(self, topic, content): """ Prepares the message content """ return {"uid": str(uuid.uuid4()).replace('-', '').upper(), "topic": topic, "content": content} |
def fire(self, target, topic, content, callback=None): """ Fires a message """ message = self.__make_message(topic, content) if callback is not None: self.__callbacks[message['uid']] = ('fire', callback) self.__client.send_message(target, json.dumps(message), message['uid']) |
def send(self, target, topic, content): """ Fires a message """ event = threading.Event() results = [] def got_message(sender, content): results.append(content) event.set() self.post(target, topic, content, got_message) event.wait() return results |
def _notify_listeners(self, sender, message): """ Notifies listeners of a new message """ uid = message['uid'] msg_topic = message['topic'] self._ack(sender, uid, 'fire') all_listeners = set() for lst_topic, listeners in self.__listeners.items(): if fnmatch.fnmatch(msg_topic, lst_topic): all_listeners.update(listeners)... |
def _ack(self, sender, uid, level, payload=None): """ Replies to a message """ content = {'reply-to': uid, 'reply-level': level, 'payload': payload} self.__client.send_message(sender, json.dumps(content)) |
def on_message(self, sender, content): """ Got a message from the client """ try: message = json.loads(content) except (ValueError, TypeError) as ex: logging.error("Not a valid JSON string: %s", ex) return try: # Check the replied message reply_uid = message['reply-to'] reply_level = message['reply-level'] except KeyEr... |
def t_php_OBJECT_OPERATOR(t): r'->' if re.match(r'[A-Za-z_]', peek(t.lexer)): t.lexer.push_state('property') return t |
def t_OPEN_TAG(t): r'<[?%]((php[ \t\r\n]?)|=)?' if '=' in t.value: t.type = 'OPEN_TAG_WITH_ECHO' t.lexer.lineno += t.value.count("\n") t.lexer.begin('php') return t |
def t_php_CLOSE_TAG(t): r'[?%]>\r?\n?' t.lexer.lineno += t.value.count("\n") t.lexer.begin('INITIAL') return t |
def t_php_STRING(t): r'[A-Za-z_][\w_]*' t.type = reserved_map.get(t.value.upper(), 'STRING') return t |
def t_quoted_DOLLAR_OPEN_CURLY_BRACES(t): r'\$\{' if re.match(r'[A-Za-z_]', peek(t.lexer)): t.lexer.push_state('varname') else: t.lexer.push_state('php') return t |
def t_quotedvar_ENCAPSED_AND_WHITESPACE(t): r'( [^"\\${] | \\(.|\n) | \$(?![A-Za-z_{]) | \{(?!\$) )+' t.lexer.lineno += t.value.count("\n") t.lexer.pop_state() return t |
def t_quotedvar_DOLLAR_OPEN_CURLY_BRACES(t): r'\$\{' if re.match(r'[A-Za-z_]', peek(t.lexer)): t.lexer.begin('varname') else: t.lexer.begin('php') return t |
def t_php_START_HEREDOC(t): r'<<<[ \t]*(?P<label>[A-Za-z_][\w_]*)\n' t.lexer.lineno += t.value.count("\n") t.lexer.push_state('heredoc') t.lexer.heredoc_label = t.lexer.lexmatch.group('label') return t |
def t_heredoc_END_HEREDOC(t): r'(?<=\n)[A-Za-z_][\w_]*' if t.value == t.lexer.heredoc_label: del t.lexer.heredoc_label t.lexer.pop_state() else: t.type = 'ENCAPSED_AND_WHITESPACE' return t |
def t_heredocvar_ENCAPSED_AND_WHITESPACE(t): r'( [^\n\\${] | \\. | \$(?![A-Za-z_{]) | \{(?!\$) )+\n? | \\?\n' t.lexer.lineno += t.value.count("\n") t.lexer.pop_state() return t |
def use(self, client_key): """ :param client_key: The client key. :type client_key: str :return: The Orchestrator instance (method chaining) :rtype: :class:`revision.orchestrator.Orchestrator` """ if not self.clients.has_client(client_key): raise ClientNotExist() self.current_client = self.clients.get_client(client_key... |
def commit(self, revision, is_amend=False): """ :param revision: :type revision: :class:`revision.data.Revision` :param is_amend: :type is_amend: boolean :return: The Orchestrator instance (for method chaining) :rtype: :class:`revision.orchestrator.Orchestrator` """ if not isinstance(revision, Revision): raise InvalidA... |
def has_commit(self, client_key=None): """ Return True if client has new commit. :param client_key: The client key :type client_key: str :return: :rtype: boolean """ if client_key is None and self.current_client is None: raise ClientNotExist() if client_key: if not self.clients.has_client(client_key): raise ClientNotEx... |
def init(ciprcfg, env, console): """ Initialize a Corona project directory. """ ciprcfg.create() templ_dir = path.join(env.skel_dir, 'default') console.quiet('Copying files from %s' % templ_dir) for src, dst in util.sync_dir_to(templ_dir, env.project_directory, ignore_existing=True): console.quiet(' %s -> %s' % (src, d... |
def update(env): """ Update an existing cipr project to the latest intalled version. """ files = [path.join(env.project_directory, 'cipr.lua')] for filename in files: if path.exists(filename): os.remove(filename) app.command.run(['init', env.project_directory]) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.