text stringlengths 0 828 |
|---|
event_type[my_type] = t.__getattr__(my_type) |
self.log.debug('Propogator:') |
for prop in ['nc', 'cc']: |
if t.__getattr__(prop) == 1: |
self.log.debug('\t%s', prop) |
event_type[prop] = t.__getattr__(prop) |
yield next_events, event_type |
f.Close() |
os.remove(self.filenames[material])" |
4193,"def block_comment(solver, start, end): |
'''embedable block comment''' |
text, pos = solver.parse_state |
length = len(text) |
startlen = len(start) |
endlen = len(end) |
if pos==length: return |
if not text[pos:].startswith(start): |
return |
level = 1 |
p = pos+1 |
while p<length: |
if text[p:].startswith(end): |
level -= 1 |
p += endlen |
if level==0: break |
elif text[p:].startswith(start): |
level += 1 |
p += startlen |
else: |
p += 1 |
else: return |
solver.parse_state = text, p |
yield cont, text[pos:p] |
solver.parse_state = text, pos" |
4194,"def formatException(self, record): |
"""""" |
Format and return the specified exception information as a string. |
:type record logging.LogRecord |
:rtype: dict |
"""""" |
if record.exc_info is None: |
return {} |
(exc_type, exc_message, trace) = record.exc_info |
return { |
'e': { |
'class': str(type(exc_type).__name__), # ZeroDivisionError |
'message': str(exc_message), # integer division or modulo by zero |
'trace': list(traceback.format_tb(trace)), |
} |
}" |
4195,"def insert(self, val): |
""""""\ |
Inserts a value and returns a :class:`Pair <Pair>`. |
If the generated key exists or memcache cannot store it, a |
:class:`KeyInsertError <shorten.KeyInsertError>` is raised (or a |
:class:`TokenInsertError <shorten.TokenInsertError>` if a token |
exists or cannot be stored). |
"""""" |
key, token, formatted_key, formatted_token = self.next_formatted_pair() |
if self.has_key(key): |
raise KeyInsertError(key) |
if self.has_token(token): |
raise TokenInsertError(token) |
# Memcache is down or read-only |
if not self._mc.add(formatted_key, (val, token)): |
raise KeyInsertError(key, 'key could not be stored') |
if not self._mc.add(formatted_token, key): |
raise TokenInsertError(token, 'token could not be stored') |
return Pair(key, token)" |
4196,"def pip_install(*args): |
''' |
Run pip install ... |
Explicitly ignores user's config. |
''' |
pip_cmd = os.path.join(os.path.dirname(sys.executable), 'pip') |
with set_env('PIP_CONFIG_FILE', os.devnull): |
cmd = [pip_cmd, 'install'] + list(args) |
print_command(cmd) |
subprocess.call(cmd, stdout=sys.stdout, stderr=sys.stderr)" |
4197,"def indent_text(text, |
nb_tabs=0, |
tab_str="" "", |
linebreak_input=""\n"", |
linebreak_output=""\n"", |
wrap=False): |
r""""""Add tabs to each line of text. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.