function stringlengths 11 56k | repo_name stringlengths 5 60 | features list |
|---|---|---|
def time(self):
return self._time | Yubico/yubioath-desktop-dpkg | [
6,
6,
6,
1,
1434464093
] |
def __init__(self, app, settings):
super(GuiController, self).__init__()
self._app = app
self._settings = settings
self._needs_read = False
self._reader = None
self._creds = None
self._lock = QtCore.QMutex()
self._keystore = get_keystore()
self._cu... | Yubico/yubioath-desktop-dpkg | [
6,
6,
6,
1,
1434464093
] |
def reader_name(self):
return self._settings.get('reader', 'Yubikey') | Yubico/yubioath-desktop-dpkg | [
6,
6,
6,
1,
1434464093
] |
def slot1(self):
return self._settings.get('slot1', 0) | Yubico/yubioath-desktop-dpkg | [
6,
6,
6,
1,
1434464093
] |
def slot2(self):
return self._settings.get('slot2', 0) | Yubico/yubioath-desktop-dpkg | [
6,
6,
6,
1,
1434464093
] |
def mute_ccid_disabled_warning(self):
return self._settings.get('mute_ccid_disabled_warning', 0) | Yubico/yubioath-desktop-dpkg | [
6,
6,
6,
1,
1434464093
] |
def mute_ccid_disabled_warning(self, value):
self._settings['mute_ccid_disabled_warning'] = value | Yubico/yubioath-desktop-dpkg | [
6,
6,
6,
1,
1434464093
] |
def grab_lock(self, lock=None, try_lock=False):
return lock or MutexLocker(self._lock, False).lock(try_lock) | Yubico/yubioath-desktop-dpkg | [
6,
6,
6,
1,
1434464093
] |
def otp_enabled(self):
return self.otp_supported and bool(self.slot1 or self.slot2) | Yubico/yubioath-desktop-dpkg | [
6,
6,
6,
1,
1434464093
] |
def credentials(self):
return self._creds | Yubico/yubioath-desktop-dpkg | [
6,
6,
6,
1,
1434464093
] |
def get_capabilities(self):
assert self.grab_lock()
ccid_dev = self.watcher.open()
if ccid_dev:
dev = YubiOathCcid(ccid_dev)
return Capabilities(True, None, dev.version)
legacy = self.open_otp()
if legacy:
return Capabilities(None, legacy.slot_... | Yubico/yubioath-desktop-dpkg | [
6,
6,
6,
1,
1434464093
] |
def _on_reader(self, watcher, reader, lock=None):
if reader:
if self._reader is None:
self._reader = reader
self._creds = []
if is_minimized(self._app.window):
self._needs_read = True
else:
ccid_d... | Yubico/yubioath-desktop-dpkg | [
6,
6,
6,
1,
1434464093
] |
def _await(self):
self._creds = None | Yubico/yubioath-desktop-dpkg | [
6,
6,
6,
1,
1434464093
] |
def _set_creds(self, creds):
if creds:
creds = [self.wrap_credential(c) for c in creds]
if self._creds and names(creds) == names(self._creds):
entry_map = dict((c.cred.name, c) for c in creds)
for entry in self._creds:
cred = entry.cred... | Yubico/yubioath-desktop-dpkg | [
6,
6,
6,
1,
1434464093
] |
def read_slot_otp(self, cred, timestamp=None, use_touch=False):
return super(GuiController, self).read_slot_otp(cred, timestamp, False) | Yubico/yubioath-desktop-dpkg | [
6,
6,
6,
1,
1434464093
] |
def refresh_codes(self, timestamp=None, lock=None, std=None):
if not self._reader and self.watcher.reader:
return self._on_reader(self.watcher, self.watcher.reader, lock)
elif is_minimized(self._app.window):
self._needs_read = True
return
lock = self.grab_lock... | Yubico/yubioath-desktop-dpkg | [
6,
6,
6,
1,
1434464093
] |
def refresh_otp():
lock = self.grab_lock(try_lock=True)
if lock:
read = self.read_creds(
None, self.slot1, self.slot2, timestamp, False)
self._set_creds(read) | Yubico/yubioath-desktop-dpkg | [
6,
6,
6,
1,
1434464093
] |
def add_cred(self, *args, **kwargs):
lock = self.grab_lock()
ccid_dev = self.watcher.open()
if ccid_dev:
dev = YubiOathCcid(ccid_dev)
if self.unlock(dev):
super(GuiController, self).add_cred(dev, *args, **kwargs)
self._creds = None
... | Yubico/yubioath-desktop-dpkg | [
6,
6,
6,
1,
1434464093
] |
def delete_cred(self, name):
lock = self.grab_lock()
ccid_dev = self.watcher.open()
if ccid_dev:
dev = YubiOathCcid(ccid_dev)
if self.unlock(dev):
super(GuiController, self).delete_cred(dev, name)
self._creds = None
self.ref... | Yubico/yubioath-desktop-dpkg | [
6,
6,
6,
1,
1434464093
] |
def set_password(self, password, remember=False):
assert self.grab_lock()
ccid_dev = self.watcher.open()
if ccid_dev:
dev = YubiOathCcid(ccid_dev)
if self.unlock(dev):
key = super(GuiController, self).set_password(dev, password)
self._keyst... | Yubico/yubioath-desktop-dpkg | [
6,
6,
6,
1,
1434464093
] |
def make(self, workDir):
supersuZipProp = self.getTargetConfigProperty("root.methods.supersu.path")
assert supersuZipProp.getValue(), "Must set %s to the supersu zip file" % supersuZipProp.getKey()
includeApk = self.getTargetConfigValue("root.methods.supersu.include_apk", True)
includeAr... | tgalal/inception | [
107,
18,
107,
15,
1424985272
] |
def test_slugify():
assert slugify("a") == "a"
assert slugify("1a") == "1a"
assert slugify("1") == "1"
assert slugify("a a") == "a_a"
assert slugify(42) == "42"
assert slugify(3.14159) == "314159"
assert slugify("├── Node1") == "Node1"
assert slugify("a", valid_variable_name=True) == "a... | hyperspy/hyperspy | [
415,
201,
415,
238,
1313759676
] |
def test_is_hyperspy_signal():
s = signals.Signal1D(np.zeros((5, 5, 5)))
p = object()
assert is_hyperspy_signal(s) is True
assert is_hyperspy_signal(p) is False | hyperspy/hyperspy | [
415,
201,
415,
238,
1313759676
] |
def test_str2num():
assert (
str2num("2.17\t 3.14\t 42\n 1\t 2\t 3")
== np.array([[2.17, 3.14, 42.0], [1.0, 2.0, 3.0]])
).all() | hyperspy/hyperspy | [
415,
201,
415,
238,
1313759676
] |
def test_fsdict():
parrot = {}
fsdict(
["This", "is", "a", "dead", "parrot"], "It has gone to meet its maker", parrot
)
fsdict(["This", "parrot", "is", "no", "more"], "It is an ex parrot", parrot)
fsdict(
["This", "parrot", "has", "seized", "to", "be"],
"It is pushing up the ... | hyperspy/hyperspy | [
415,
201,
415,
238,
1313759676
] |
def test_shorten_name():
assert (
shorten_name("And now for soemthing completely different.", 16)
== "And now for so.."
) | hyperspy/hyperspy | [
415,
201,
415,
238,
1313759676
] |
def atransition(self, match, context, next_state):
# do something
result = [...] # a list
return context, next_state, result
# context, next_state may be altered | mikel-egana-aranguren/SADI-Galaxy-Docker | [
1,
3,
1,
1,
1417087373
] |
def __init__(self, state_classes, initial_state, debug=0):
"""
Initialize a `StateMachine` object; add state objects.
Parameters:
- `state_classes`: a list of `State` (sub)classes.
- `initial_state`: a string, the class name of the initial state.
- `debug`: a boolean; p... | mikel-egana-aranguren/SADI-Galaxy-Docker | [
1,
3,
1,
1,
1417087373
] |
def run(self, input_lines, input_offset=0, context=None,
input_source=None, initial_state=None):
"""
Run the state machine on `input_lines`. Return results (a list).
Reset `self.line_offset` and `self.current_state`. Run the
beginning-of-file transition. Input one line at a ... | mikel-egana-aranguren/SADI-Galaxy-Docker | [
1,
3,
1,
1,
1417087373
] |
def next_line(self, n=1):
"""Load `self.line` with the `n`'th next line and return it."""
try:
try:
self.line_offset += n
self.line = self.input_lines[self.line_offset]
except IndexError:
self.line = None
raise EOFEr... | mikel-egana-aranguren/SADI-Galaxy-Docker | [
1,
3,
1,
1,
1417087373
] |
def at_eof(self):
"""Return 1 if the input is at or past end-of-file."""
return self.line_offset >= len(self.input_lines) - 1 | mikel-egana-aranguren/SADI-Galaxy-Docker | [
1,
3,
1,
1,
1417087373
] |
def previous_line(self, n=1):
"""Load `self.line` with the `n`'th previous line and return it."""
self.line_offset -= n
if self.line_offset < 0:
self.line = None
else:
self.line = self.input_lines[self.line_offset]
self.notify_observers()
return se... | mikel-egana-aranguren/SADI-Galaxy-Docker | [
1,
3,
1,
1,
1417087373
] |
def get_source(self, line_offset):
"""Return source of line at absolute line offset `line_offset`."""
return self.input_lines.source(line_offset - self.input_offset) | mikel-egana-aranguren/SADI-Galaxy-Docker | [
1,
3,
1,
1,
1417087373
] |
def abs_line_number(self):
"""Return line number of current line (counting from 1)."""
return self.line_offset + self.input_offset + 1 | mikel-egana-aranguren/SADI-Galaxy-Docker | [
1,
3,
1,
1,
1417087373
] |
def insert_input(self, input_lines, source):
self.input_lines.insert(self.line_offset + 1, '',
source='internal padding after '+source,
offset=len(input_lines))
self.input_lines.insert(self.line_offset + 1, '',
... | mikel-egana-aranguren/SADI-Galaxy-Docker | [
1,
3,
1,
1,
1417087373
] |
def check_line(self, context, state, transitions=None):
"""
Examine one line of input for a transition match & execute its method.
Parameters:
- `context`: application-dependent storage.
- `state`: a `State` object, the current state.
- `transitions`: an optional ordere... | mikel-egana-aranguren/SADI-Galaxy-Docker | [
1,
3,
1,
1,
1417087373
] |
def add_states(self, state_classes):
"""
Add `state_classes` (a list of `State` subclasses).
"""
for state_class in state_classes:
self.add_state(state_class) | mikel-egana-aranguren/SADI-Galaxy-Docker | [
1,
3,
1,
1,
1417087373
] |
def error(self):
"""Report error details."""
type, value, module, line, function = _exception_data()
print >>sys.stderr, '%s: %s' % (type, value)
print >>sys.stderr, 'input line %s' % (self.abs_line_number())
print >>sys.stderr, ('module %s, line %s, function %s'
... | mikel-egana-aranguren/SADI-Galaxy-Docker | [
1,
3,
1,
1,
1417087373
] |
def detach_observer(self, observer):
self.observers.remove(observer) | mikel-egana-aranguren/SADI-Galaxy-Docker | [
1,
3,
1,
1,
1417087373
] |
def __init__(self, state_machine, debug=0):
"""
Initialize a `State` object; make & add initial transitions.
Parameters:
- `statemachine`: the controlling `StateMachine` object.
- `debug`: a boolean; produce verbose output if true (nonzero).
"""
self.transition... | mikel-egana-aranguren/SADI-Galaxy-Docker | [
1,
3,
1,
1,
1417087373
] |
def unlink(self):
"""Remove circular references to objects no longer required."""
self.state_machine = None | mikel-egana-aranguren/SADI-Galaxy-Docker | [
1,
3,
1,
1,
1417087373
] |
def add_transitions(self, names, transitions):
"""
Add a list of transitions to the start of the transition list.
Parameters:
- `names`: a list of transition names.
- `transitions`: a mapping of names to transition tuples.
Exceptions: `DuplicateTransitionError`, `Unkno... | mikel-egana-aranguren/SADI-Galaxy-Docker | [
1,
3,
1,
1,
1417087373
] |
def remove_transition(self, name):
"""
Remove a transition by `name`.
Exception: `UnknownTransitionError`.
"""
try:
del self.transitions[name]
self.transition_order.remove(name)
except:
raise UnknownTransitionError(name) | mikel-egana-aranguren/SADI-Galaxy-Docker | [
1,
3,
1,
1,
1417087373
] |
def make_transitions(self, name_list):
"""
Return a list of transition names and a transition mapping.
Parameter `name_list`: a list, where each entry is either a transition
name string, or a 1- or 2-tuple (transition name, optional next state
name).
"""
stringty... | mikel-egana-aranguren/SADI-Galaxy-Docker | [
1,
3,
1,
1,
1417087373
] |
def bof(self, context):
"""
Handle beginning-of-file. Return unchanged `context`, empty result.
Override in subclasses.
Parameter `context`: application-defined storage.
"""
return context, [] | mikel-egana-aranguren/SADI-Galaxy-Docker | [
1,
3,
1,
1,
1417087373
] |
def nop(self, match, context, next_state):
"""
A "do nothing" transition method.
Return unchanged `context` & `next_state`, empty result. Useful for
simple state changes (actionless transitions).
"""
return context, next_state, [] | mikel-egana-aranguren/SADI-Galaxy-Docker | [
1,
3,
1,
1,
1417087373
] |
def get_indented(self, until_blank=0, strip_indent=1):
"""
Return a block of indented lines of text, and info.
Extract an indented block where the indent is unknown for all lines.
:Parameters:
- `until_blank`: Stop collecting at the first blank line if true
(1... | mikel-egana-aranguren/SADI-Galaxy-Docker | [
1,
3,
1,
1,
1417087373
] |
def get_first_known_indented(self, indent, until_blank=0, strip_indent=1,
strip_top=1):
"""
Return an indented block and info.
Extract an indented block where the indent is known for the first line
and unknown for all other lines.
:Parameters:
... | mikel-egana-aranguren/SADI-Galaxy-Docker | [
1,
3,
1,
1,
1417087373
] |
def __init__(self, state_machine, debug=0):
"""
Initialize a `StateSM` object; extends `State.__init__()`.
Check for indent state machine attributes, set defaults if not set.
"""
State.__init__(self, state_machine, debug)
if self.indent_sm is None:
self.inden... | mikel-egana-aranguren/SADI-Galaxy-Docker | [
1,
3,
1,
1,
1417087373
] |
def blank(self, match, context, next_state):
"""Handle blank lines. Does nothing. Override in subclasses."""
return self.nop(match, context, next_state) | mikel-egana-aranguren/SADI-Galaxy-Docker | [
1,
3,
1,
1,
1417087373
] |
def known_indent(self, match, context, next_state):
"""
Handle a known-indent text block. Extend or override in subclasses.
Recursively run the registered state machine for known-indent indented
blocks (`self.known_indent_sm`). The indent is the length of the
match, ``match.end(... | mikel-egana-aranguren/SADI-Galaxy-Docker | [
1,
3,
1,
1,
1417087373
] |
def match(self, pattern):
"""
Return the result of a regular expression search.
Overrides `StateMachine.match()`.
Parameter `pattern`: `re` compiled regular expression.
"""
return pattern.search(self.line) | mikel-egana-aranguren/SADI-Galaxy-Docker | [
1,
3,
1,
1,
1417087373
] |
def __init__(self, initlist=None, source=None, items=None,
parent=None, parent_offset=None):
self.data = []
"""The actual list of data, flattened from various sources."""
self.items = []
"""A list of (source, offset) pairs, same length as `self.data`: the
source... | mikel-egana-aranguren/SADI-Galaxy-Docker | [
1,
3,
1,
1,
1417087373
] |
def __repr__(self):
return '%s(%s, items=%s)' % (self.__class__.__name__,
self.data, self.items) | mikel-egana-aranguren/SADI-Galaxy-Docker | [
1,
3,
1,
1,
1417087373
] |
def __le__(self, other): return self.data <= self.__cast(other) | mikel-egana-aranguren/SADI-Galaxy-Docker | [
1,
3,
1,
1,
1417087373
] |
def __ne__(self, other): return self.data != self.__cast(other) | mikel-egana-aranguren/SADI-Galaxy-Docker | [
1,
3,
1,
1,
1417087373
] |
def __ge__(self, other): return self.data >= self.__cast(other) | mikel-egana-aranguren/SADI-Galaxy-Docker | [
1,
3,
1,
1,
1417087373
] |
def __cast(self, other):
if isinstance(other, ViewList):
return other.data
else:
return other | mikel-egana-aranguren/SADI-Galaxy-Docker | [
1,
3,
1,
1,
1417087373
] |
def __len__(self): return len(self.data) | mikel-egana-aranguren/SADI-Galaxy-Docker | [
1,
3,
1,
1,
1417087373
] |
def __getitem__(self, i):
if isinstance(i, types.SliceType):
assert i.step in (None, 1), 'cannot handle slice with stride'
return self.__class__(self.data[i.start:i.stop],
items=self.items[i.start:i.stop],
parent=self, ... | mikel-egana-aranguren/SADI-Galaxy-Docker | [
1,
3,
1,
1,
1417087373
] |
def __delitem__(self, i):
try:
del self.data[i]
del self.items[i]
if self.parent:
del self.parent[i + self.parent_offset]
except TypeError:
assert i.step is None, 'cannot handle slice with stride'
del self.data[i.start:i.stop]
... | mikel-egana-aranguren/SADI-Galaxy-Docker | [
1,
3,
1,
1,
1417087373
] |
def __radd__(self, other):
if isinstance(other, ViewList):
return self.__class__(other.data + self.data,
items=(other.items + self.items))
else:
raise TypeError('adding ViewList to a non-ViewList') | mikel-egana-aranguren/SADI-Galaxy-Docker | [
1,
3,
1,
1,
1417087373
] |
def __mul__(self, n):
return self.__class__(self.data * n, items=(self.items * n)) | mikel-egana-aranguren/SADI-Galaxy-Docker | [
1,
3,
1,
1,
1417087373
] |
def __imul__(self, n):
self.data *= n
self.items *= n
return self | mikel-egana-aranguren/SADI-Galaxy-Docker | [
1,
3,
1,
1,
1417087373
] |
def append(self, item, source=None, offset=0):
if source is None:
self.extend(item)
else:
if self.parent:
self.parent.insert(len(self.data) + self.parent_offset, item,
source, offset)
self.data.append(item)
... | mikel-egana-aranguren/SADI-Galaxy-Docker | [
1,
3,
1,
1,
1417087373
] |
def pop(self, i=-1):
if self.parent:
index = (len(self.data) + i) % len(self.data)
self.parent.pop(index + self.parent_offset)
self.items.pop(i)
return self.data.pop(i) | mikel-egana-aranguren/SADI-Galaxy-Docker | [
1,
3,
1,
1,
1417087373
] |
def trim_end(self, n=1):
"""
Remove items from the end of the list, without touching the parent.
"""
if n > len(self.data):
raise IndexError("Size of trim too large; can't trim %s items "
"from a list of size %s." % (n, len(self.data)))
el... | mikel-egana-aranguren/SADI-Galaxy-Docker | [
1,
3,
1,
1,
1417087373
] |
def count(self, item): return self.data.count(item) | mikel-egana-aranguren/SADI-Galaxy-Docker | [
1,
3,
1,
1,
1417087373
] |
def reverse(self):
self.data.reverse()
self.items.reverse()
self.parent = None | mikel-egana-aranguren/SADI-Galaxy-Docker | [
1,
3,
1,
1,
1417087373
] |
def info(self, i):
"""Return source & offset for index `i`."""
try:
return self.items[i]
except IndexError:
if i == len(self.data): # Just past the end
return self.items[i - 1][0], None
else:
raise | mikel-egana-aranguren/SADI-Galaxy-Docker | [
1,
3,
1,
1,
1417087373
] |
def offset(self, i):
"""Return offset for index `i`."""
return self.info(i)[1] | mikel-egana-aranguren/SADI-Galaxy-Docker | [
1,
3,
1,
1,
1417087373
] |
def xitems(self):
"""Return iterator yielding (source, offset, value) tuples."""
for (value, (source, offset)) in zip(self.data, self.items):
yield (source, offset, value) | mikel-egana-aranguren/SADI-Galaxy-Docker | [
1,
3,
1,
1,
1417087373
] |
def trim_left(self, length, start=0, end=sys.maxint):
"""
Trim `length` characters off the beginning of each item, in-place,
from index `start` to `end`. No whitespace-checking is done on the
trimmed text. Does not affect slice parent.
"""
self.data[start:end] = [line[l... | mikel-egana-aranguren/SADI-Galaxy-Docker | [
1,
3,
1,
1,
1417087373
] |
def get_indented(self, start=0, until_blank=0, strip_indent=1,
block_indent=None, first_indent=None):
"""
Extract and return a StringList of indented lines of text.
Collect all lines with indentation, determine the minimum indentation,
remove the minimum indentation... | mikel-egana-aranguren/SADI-Galaxy-Docker | [
1,
3,
1,
1,
1417087373
] |
def pad_double_width(self, pad_char):
"""
Pad all double-width characters in self by appending `pad_char` to each.
For East Asian language support.
"""
if hasattr(unicodedata, 'east_asian_width'):
east_asian_width = unicodedata.east_asian_width
else:
... | mikel-egana-aranguren/SADI-Galaxy-Docker | [
1,
3,
1,
1,
1417087373
] |
def string2lines(astring, tab_width=8, convert_whitespace=0,
whitespace=re.compile('[\v\f]')):
"""
Return a list of one-line strings with tabs expanded, no newlines, and
trailing whitespace stripped.
Each tab is expanded with between 1 and `tab_width` spaces, so that the
next chara... | mikel-egana-aranguren/SADI-Galaxy-Docker | [
1,
3,
1,
1,
1417087373
] |
def __init__(self):
self.results = []
self.lock = threading.Lock() | danwent/Perspectives-Server | [
51,
13,
51,
33,
1295771502
] |
def get(self):
"""
Return the list of existing results
and empty the set.
"""
# use a lock so we don't lose any results
# between retrieving the current set
# and adding new ones
with self.lock:
# copy existing results so we can clear the list
results_so_far = list(self.results)
self.results = ... | danwent/Perspectives-Server | [
51,
13,
51,
33,
1295771502
] |
def __init__(self, db, sid, global_stats, timeout_sec, sni):
self.db = db
self.sid = sid
self.global_stats = global_stats
self.global_stats.active_threads += 1
threading.Thread.__init__(self)
self.timeout_sec = timeout_sec
self.sni = sni
self.global_stats.threads[sid] = time.time() | danwent/Perspectives-Server | [
51,
13,
51,
33,
1295771502
] |
def _record_failure(self, e):
"""Record an exception that happened during a scan."""
stats.failures += 1
self.db.report_metric('ServiceScanFailure', str(e))
if (isinstance(e, SSLScanTimeoutException)):
stats.failure_timeouts += 1
return
if (isinstance(e, SSLAlertException)):
stats.failure_ssl_alert +... | danwent/Perspectives-Server | [
51,
13,
51,
33,
1295771502
] |
def __init__(self):
self.failures = 0
self.num_completed = 0
self.active_threads = 0
self.num_started = 0
self.threads = {}
# individual failure counts
self.failure_timeouts = 0
self.failure_no_route = 0
self.failure_conn_refused = 0
self.failure_conn_reset = 0
self.failure_dns = 0
self.fa... | danwent/Perspectives-Server | [
51,
13,
51,
33,
1295771502
] |
def _record_observations_in_db(db, results):
"""
Record a set of service observations in the database.
"""
if len(results) == 0:
return
try:
for r in results:
db.report_observation(r[0], r[1])
except Exception as e:
# TODO: we should probably retry here
logging.critical("DB Error: Failed to write resu... | danwent/Perspectives-Server | [
51,
13,
51,
33,
1295771502
] |
def main(db, service_id_file, logfile=False, verbose=False, quiet=False, rate=DEFAULT_SCANS,
timeout_sec=DEFAULT_WAIT, sni=False):
"""
Run the main program.
Scan a list of services and update Observation records in the notary database.
"""
global stats
global results
stats = GlobalStats()
results = ResultSt... | danwent/Perspectives-Server | [
51,
13,
51,
33,
1295771502
] |
def eoms_controlled_blender(t, state, dum, ast):
"""Inertial dumbbell equations of motion about an asteroid | skulumani/asteroid_dumbbell | [
1,
4,
1,
19,
1476306035
] |
def eoms_controlled_blender_traverse_then_land(t, state, dum, ast):
"""Inertial dumbbell equations of motion about an asteroid | skulumani/asteroid_dumbbell | [
1,
4,
1,
19,
1476306035
] |
def blender_traverse_then_land_sim():
# simulation parameters
output_path = './visualization/blender'
asteroid_name = 'itokawa_low'
# create a HDF5 dataset
hdf5_path = './data/itokawa_landing/{}_controlled_vertical_landing.hdf5'.format(
datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%S"))
... | skulumani/asteroid_dumbbell | [
1,
4,
1,
19,
1476306035
] |
def blender_vertical_landing_sim():
# simulation parameters
output_path = './visualization/blender'
asteroid_name = 'itokawa_low'
# create a HDF5 dataset
hdf5_path = './data/itokawa_landing/{}_controlled_vertical_landing.hdf5'.format(
datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%S"))
... | skulumani/asteroid_dumbbell | [
1,
4,
1,
19,
1476306035
] |
def blender_inertial_circumnavigate(gen_images=False):
"""Move around the asteroid in the inertial frame, but assume no rotation of the asteroid
"""
# simulation parameters
output_path = './visualization/blender'
asteroid_name = 'itokawa_high'
# create a HDF5 dataset
hdf5_path = './data/aste... | skulumani/asteroid_dumbbell | [
1,
4,
1,
19,
1476306035
] |
def blender_inertial_lissajous(gen_images=False):
"""Move around the asteroid in the inertial frame, but assume no rotation of the asteroid
"""
# simulation parameters
output_path = './visualization/blender'
asteroid_name = 'itokawa_high'
# create a HDF5 dataset
hdf5_path = './data/asteroid_... | skulumani/asteroid_dumbbell | [
1,
4,
1,
19,
1476306035
] |
def blender_inertial_quarter_equatorial(gen_images=False):
"""Move around the asteroid in the inertial frame, but assume no rotation of the asteroid
Moves in the xy positive quadrant in the equatorial plane
"""
# simulation parameters
output_path = './visualization/blender'
asteroid_name = 'ito... | skulumani/asteroid_dumbbell | [
1,
4,
1,
19,
1476306035
] |
def _need_func(testfunc, name, description):
"""Decorator skipping test if given testfunc returns False."""
def check_func(func):
def newfunc(*args, **kwargs):
if not testfunc(name):
pytest.skip("%s %r is not available" % (description, name))
return func(*args, **... | wummel/patool | [
321,
57,
321,
64,
1355430234
] |
def needs_program(name):
"""Decorator skipping test if given program is not available."""
return _need_func(lambda x: patoolib.util.find_program(x), name, 'program') | wummel/patool | [
321,
57,
321,
64,
1355430234
] |
def needs_module(name):
"""Decorator skipping test if given module is not available."""
def has_module(module):
try:
importlib.import_module(module)
return True
except ImportError:
return False
return _need_func(has_module, name, 'Python module') | wummel/patool | [
321,
57,
321,
64,
1355430234
] |
def check_prog (f):
def newfunc (*args, **kwargs):
if not patoolib.util.find_program(program):
pytest.skip("program `%s' not available" % program)
if not has_codec(program, codec):
pytest.skip("codec `%s' for program `%s' not available" % (codec, program))... | wummel/patool | [
321,
57,
321,
64,
1355430234
] |
def has_codec (program, codec):
"""Test if program supports given codec."""
if program == '7z' and codec == 'rar':
return patoolib.util.p7zip_supports_rar()
if patoolib.program_supports_compression(program, codec):
return True
return patoolib.util.find_program(codec) | wummel/patool | [
321,
57,
321,
64,
1355430234
] |
def check_func(func):
def newfunc(*args, **kwargs):
if "TRAVIS" in os.environ:
pytest.skip("Skip on TRAVIS CI build.")
return func(*args, **kwargs)
setattr(newfunc, fnameattr, getattr(func, fnameattr))
return newfunc | wummel/patool | [
321,
57,
321,
64,
1355430234
] |
def setUp(self):
self.maxDiff = None
filename = 'set_start_page01.xlsx'
test_dir = 'xlsxwriter/test/comparison/'
self.got_filename = test_dir + '_test_' + filename
self.exp_filename = test_dir + 'xlsx_files/' + filename
self.ignore_files = ['xl/printerSettings/printerS... | ivmech/iviny-scope | [
19,
2,
19,
1,
1398667377
] |
def tearDown(self):
# Cleanup.
if os.path.exists(self.got_filename):
os.remove(self.got_filename) | ivmech/iviny-scope | [
19,
2,
19,
1,
1398667377
] |
def setup(self, timestamp):
"""
Get water requirements for this timestep based on my internal
requirements dictionary.
"""
self.demand = self._seasonal_water_req[timestamp] | UMWRG/pynsim | [
40,
17,
40,
10,
1428770472
] |
def test_make_dir():
assert os.path.exists("output") | ghislainv/deforestprob | [
97,
21,
97,
8,
1480589112
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.