text stringlengths 81 112k |
|---|
Generate radii
def _compute_radii(self):
"""Generate radii"""
denom = pow(-np.log(self.grbf_lambda), 1.0/self.tau_vals)
self.components_['radii'] = self.dF_vals/denom |
fit regression using pseudo-inverse
or supplied regressor
def _fit_regression(self, y):
"""
fit regression using pseudo-inverse
or supplied regressor
"""
if self.regressor is None:
self.coefs_ = safe_sparse_dot(pinv2(self.hidden_activations_), y)
els... |
Fit the model using X, y as training data.
Parameters
----------
X : {array-like, sparse matrix} of shape [n_samples, n_features]
Training vectors, where n_samples is the number of samples
and n_features is the number of features.
y : array-like of shape [n_samp... |
get predictions using internal least squares/supplied regressor
def _get_predictions(self):
"""
get predictions using internal least squares/supplied regressor
"""
if self.regressor is None:
preds = safe_sparse_dot(self.hidden_activations_, self.coefs_)
else:
... |
Predict values using the model
Parameters
----------
X : {array-like, sparse matrix} of shape [n_samples, n_features]
Returns
-------
C : numpy array of shape [n_samples, n_outputs]
Predicted values.
def predict(self, X):
"""
Predict values ... |
Fit the model using X, y as training data.
Parameters
----------
X : {array-like, sparse matrix} of shape [n_samples, n_features]
Training vectors, where n_samples is the number of samples
and n_features is the number of features.
y : array-like of shape [n_samp... |
Predict values using the model
Parameters
----------
X : {array-like, sparse matrix} of shape [n_samples, n_features]
Returns
-------
C : numpy array of shape [n_samples, n_outputs]
Predicted values.
def predict(self, X):
"""Predict values using the... |
Pass init params to RandomLayer
def _create_random_layer(self):
"""Pass init params to RandomLayer"""
return RandomLayer(n_hidden=self.n_hidden,
alpha=self.alpha,
random_state=self.random_state,
activation_func=self.activ... |
Fit the model using X, y as training data.
Parameters
----------
X : {array-like, sparse matrix} of shape [n_samples, n_features]
Training vectors, where n_samples is the number of samples
and n_features is the number of features.
y : array-like of shape [n_samp... |
Predict values using the model
Parameters
----------
X : {array-like, sparse matrix} of shape [n_samples, n_features]
Returns
-------
C : numpy array of shape [n_samples, n_outputs]
Predicted values.
def predict(self, X):
"""
Predict values ... |
Fit the model using X, y as training data.
Parameters
----------
X : {array-like, sparse matrix} of shape [n_samples, n_features]
Training vectors, where n_samples is the number of samples
and n_features is the number of features.
y : array-like of shape [n_samp... |
Force use of accuracy score since we don't inherit
from ClassifierMixin
def score(self, X, y):
"""Force use of accuracy score since we don't inherit
from ClassifierMixin"""
from sklearn.metrics import accuracy_score
return accuracy_score(y, self.predict(X)) |
http://www.django-rest-framework.org/topics/3.0-announcement/#using-is_validraise_exceptiontrue
def compat_serializer_check_is_valid(serializer):
""" http://www.django-rest-framework.org/topics/3.0-announcement/#using-is_validraise_exceptiontrue """
if DRFVLIST[0] >= 3:
serializer.is_valid(raise_except... |
Required only for DRF 3.1, which does not make dynamically added attribute available in obj in serializer.
This is a quick solution but works without breajing anything.
def compat_serializer_attr(serializer, obj):
"""
Required only for DRF 3.1, which does not make dynamically added attribute available in o... |
get_paginated_response is unknown to DRF 3.0
def compat_get_paginated_response(view, page):
""" get_paginated_response is unknown to DRF 3.0 """
if DRFVLIST[0] == 3 and DRFVLIST[1] >= 1:
from rest_messaging.serializers import ComplexMessageSerializer # circular import
serializer = ComplexMessa... |
For DRF 3.1 and higher, pagination is defined at the paginator level (see http://www.django-rest-framework.org/topics/3.2-announcement/).
For DRF 3.0 and lower, it can be handled at the view level.
def compat_pagination_messages(cls):
"""
For DRF 3.1 and higher, pagination is defined at the paginator level... |
Allows to define a callback for serializing information about the user.
def get_participants(self, obj):
""" Allows to define a callback for serializing information about the user. """
# we set the many to many serialization to False, because we only want it with retrieve requests
if self.callb... |
We say if the message should trigger a notification
def get_is_notification(self, obj):
""" We say if the message should trigger a notification """
try:
o = compat_serializer_attr(self, obj)
return o.is_notification
except Exception:
return False |
Return the ids of the people who read the message instance.
def get_readers(self, obj):
""" Return the ids of the people who read the message instance. """
try:
o = compat_serializer_attr(self, obj)
return o.readers
except Exception:
return [] |
Gets all the threads in which the current participant is involved. The method excludes threads where the participant has left.
def get_threads_where_participant_is_active(self, participant_id):
""" Gets all the threads in which the current participant is involved. The method excludes threads where the particip... |
Gets the threads where the specified participants are active and no one has left.
def get_active_threads_involving_all_participants(self, *participant_ids):
""" Gets the threads where the specified participants are active and no one has left. """
query = Thread.objects.\
exclude(participat... |
When a Participant posts a message to other participants without specifying an existing Thread,
we must
1. Create a new Thread if they have not yet opened the discussion.
2. If they have already opened the discussion and multiple Threads are not allowed for the same users, we must
re... |
Returns the number of messages sent in the last 24 hours so we can ensure the user does not exceed his messaging limits
def return_daily_messages_count(self, sender):
""" Returns the number of messages sent in the last 24 hours so we can ensure the user does not exceed his messaging limits """
h24 = no... |
Check who read each message.
def check_who_read(self, messages):
""" Check who read each message. """
# we get the corresponding Participation objects
for m in messages:
readers = []
for p in m.thread.participation_set.all():
if p.date_last_check is None:... |
Check if each message requires a notification for the specified participant.
def check_is_notification(self, participant_id, messages):
""" Check if each message requires a notification for the specified participant. """
try:
# we get the last check
last_check = NotificationChec... |
Returns the last message in each thread
def get_lasts_messages_of_threads(self, participant_id, check_who_read=True, check_is_notification=True):
""" Returns the last message in each thread """
# we get the last message for each thread
# we must query the messages using two queries because only... |
Returns all the messages in a thread.
def get_all_messages_in_thread(self, participant_id, thread_id, check_who_read=True):
""" Returns all the messages in a thread. """
try:
messages = Message.objects.filter(thread__id=thread_id).\
order_by('-id').\
select_r... |
We ensure the Thread only involves eligible participants.
def create(self, request, *args, **kwargs):
""" We ensure the Thread only involves eligible participants. """
serializer = self.get_serializer(data=compat_get_request_data(request))
compat_serializer_check_is_valid(serializer)
se... |
Pk is the pk of the Thread to which the messages belong.
def mark_thread_as_read(self, request, pk=None):
""" Pk is the pk of the Thread to which the messages belong. """
# we get the thread and check for permission
thread = Thread.objects.get(id=pk)
self.check_object_permissions(reques... |
Parse an URL
def process(self, quoted=False):
''' Parse an URL '''
self.p = urlparse(self.raw)
self.scheme = self.p.scheme
self.netloc = self.p.netloc
self.opath = self.p.path if not quoted else quote(self.p.path)
self.path = [x for x in self.opath.split('/') if x]
... |
Fetch a HTML file as binary
def fetch(self, url, encoding=None, force_refetch=False, nocache=False, quiet=True):
''' Fetch a HTML file as binary'''
try:
if not force_refetch and self.cache is not None and url in self.cache:
# try to look for content in cache
... |
Download a file at $url and save it to $path
def download(self, url, path, force_refetch=False, nocache=False):
''' Download a file at $url and save it to $path
'''
# Enable cache
if os.path.isfile(path):
getLogger().info("File exists, download task skipped -> {path}".format... |
Extract platform.
def _platform(self) -> Optional[str]:
"""Extract platform."""
try:
return str(self.journey.MainStop.BasicStop.Dep.Platform.text)
except AttributeError:
return None |
Extract departure delay.
def _delay(self) -> int:
"""Extract departure delay."""
try:
return int(self.journey.MainStop.BasicStop.Dep.Delay.text)
except AttributeError:
return 0 |
Extract departure time.
def _departure(self) -> datetime:
"""Extract departure time."""
departure_time = datetime.strptime(
self.journey.MainStop.BasicStop.Dep.Time.text, "%H:%M"
).time()
if departure_time > (self.now - timedelta(hours=1)).time():
return datetime... |
Extract train information.
def _extract(self, attribute) -> str:
"""Extract train information."""
attr_data = self.journey.JourneyAttributeList.JourneyAttribute[
self.attr_types.index(attribute)
].Attribute
attr_variants = attr_data.xpath("AttributeVariant/@type")
da... |
Extract journey information.
def _info(self) -> Optional[str]:
"""Extract journey information."""
try:
return str(html.unescape(self.journey.InfoTextList.InfoText.get("text")))
except AttributeError:
return None |
Extract journey information.
def _info_long(self) -> Optional[str]:
"""Extract journey information."""
try:
return str(
html.unescape(self.journey.InfoTextList.InfoText.get("textL")).replace(
"<br />", "\n"
)
)
except A... |
Extract next stops along the journey.
def _pass_list(self) -> List[Dict[str, Any]]:
"""Extract next stops along the journey."""
stops: List[Dict[str, Any]] = []
for stop in self.journey.PassList.BasicStop:
index = stop.get("index")
station = stop.Location.Station.HafasNa... |
Check `style` against pyout.styling.schema.
Parameters
----------
style : dict
Style object to validate.
Raises
------
StyleValidationError if `style` is not valid.
def validate(style):
"""Check `style` against pyout.styling.schema.
Parameters
----------
style : dict
... |
Classify `value` of bold, color, and underline keys.
Parameters
----------
value : style value
Returns
-------
str, {"simple", "lookup", "re_lookup", "interval"}
def value_type(value):
"""Classify `value` of bold, color, and underline keys.
Parameters
----------
value : style... |
Set MeCab binary location
def _register_mecab_loc(location):
''' Set MeCab binary location '''
global MECAB_LOC
if not os.path.isfile(location):
logging.getLogger(__name__).warning("Provided mecab binary location does not exist {}".format(location))
logging.getLogger(__name__).info("Mecab ... |
Use subprocess to run mecab
def run_mecab_process(content, *args, **kwargs):
''' Use subprocess to run mecab '''
encoding = 'utf-8' if 'encoding' not in kwargs else kwargs['encoding']
mecab_loc = kwargs['mecab_loc'] if 'mecab_loc' in kwargs else None
if mecab_loc is None:
mecab_loc = MECAB... |
Use mecab-python3 by default to parse JP text. Fall back to mecab binary app if needed
def parse(content, *args, **kwargs):
''' Use mecab-python3 by default to parse JP text. Fall back to mecab binary app if needed '''
global MECAB_PYTHON3
if 'mecab_loc' not in kwargs and MECAB_PYTHON3 and 'MeCab' in gl... |
:param path_in_ipod: the path of audio file in the iPod base
:param checksum: CHECKSUM of the audio file in member audiodb
:return: a new Track, you may want append it to the playlist.tracks
def create_track(self, path_in_ipod=None, checksum=None):
"""
:param path_in_ipod: the path of a... |
tuple. contain text and lang code
def voice(self):
"""tuple. contain text and lang code
"""
dbid = self.lldb.dbid
text, lang = self._voiceoverdb.get_text_lang(dbid)
return text, lang |
store an audio file to storage dir
:param src: audio file path
:return: checksum value
def add(self, src):
""" store an audio file to storage dir
:param src: audio file path
:return: checksum value
"""
if not audio.get_type(src):
raise TypeError('Th... |
Merge command with arguments.
def _get_cmd(command, arguments):
"""Merge command with arguments."""
if arguments is None:
arguments = []
if command.endswith(".py") or command.endswith(".pyw"):
return [sys.executable, command] + list(arguments)
else:
return [command] + list(argum... |
A command line argument parser.
Parses arguments coming from the argv Observable and outputs them as
Argument items in the output observable.
Parameters
-----------
argv : Observable
An Observable of strings.
parser : Observable
An Observable containing one Parser item.
argu... |
Calculates p-values of gene i regulating gene j with genotype data assisted method with multiple tests.
dg: numpy.ndarray(nt,ns,dtype=gtype(='u1' by default)) Genotype data.
Entry dg[i,j] is genotype i's value for sample j.
Each value must be among 0,1,...,na.
Genotype i must be best (and significant) eQTL of ge... |
Calculates probability of gene i regulating gene j with genotype data assisted method,
with the recommended combination of multiple tests.
dg: numpy.ndarray(nt,ns,dtype=gtype(='u1' by default)) Genotype data.
Entry dg[i,j] is genotype i's value for sample j.
Each value must be among 0,1,...,na.
Genotype i must ... |
Calculates probability of gene i regulating gene j with genotype data assisted method,
with the recommended combination of multiple tests.
Probabilities are converted from likelihood ratios separately for each A. This gives better
predictions when the number of secondary targets (dt2) is large. (Check program warnin... |
Calculates probability of gene i regulating gene j with continuous anchor data assisted method,
with multiple tests, by converting log likelihoods into probabilities per A for all B.
dc: numpy.ndarray(nt,ns,dtype=ftype(='f4' by default)) Continuous anchor data.
Entry dc[i,j] is anchor i's value for sample j.
Anch... |
Calculates probability of gene i regulating gene j with continuous data assisted method,
with multiple tests, by converting log likelihoods into probabilities per A for all B.
Probabilities are converted from likelihood ratios separately for each A. This gives better
predictions when the number of secondary targets ... |
Calculates probability of gene i regulating gene j with continuous data assisted method,
with the recommended combination of multiple tests.
dc: numpy.ndarray(nt,ns,dtype=ftype(='f4' by default)) Continuous anchor data.
Entry dc[i,j] is anchor i's value for sample j.
Anchor i is used to infer the probability of g... |
Calculates probability of gene i regulating gene j with continuous data assisted method,
with the recommended combination of multiple tests.
Probabilities are converted from likelihood ratios separately for each A. This gives better
predictions when the number of secondary targets (dt2) is large. (Check program warn... |
Calculates p-values of gene i correlating with gene j by converting log likelihoods into probabilities per A for all B.
dt: numpy.ndarray(nt,ns,dtype=ftype(='=f4' by default)) Gene expression data for A
Entry dt[i,j] is gene i's expression level for sample j.
dt2:numpy.ndarray(nt2,ns,dtype=ftype(='=f4' by default))... |
Calculate the complex flow vector `Q_n`.
:param array-like phi: Azimuthal angles.
:param int n: One or more harmonics to calculate.
:returns:
A single complex number if only one ``n`` was given or a complex array
for multiple ``n``.
def qn(phi, *n):
"""
Calculate the complex flow... |
r"""
Calculate `\langle k \rangle_n`,
the `k`-particle correlation function for `n`\ th-order anisotropy.
:param int n: Anisotropy order.
:param int k: Correlation order.
:param bool error:
Whether to calculate statistical error
(for `\langle 2 \rangle` ... |
r"""
Calculate `c_n\{k\}`,
the `k`-particle cumulant for `n`\ th-order anisotropy.
:param int n: Anisotropy order.
:param int k: Correlation order.
:param bool error:
Whether to calculate statistical error (for `c_n\{2\}` only).
If true, return a tuple `... |
r"""
Calculate `v_n\{k\}`,
the estimate of flow coefficient `v_n` from the `k`-particle cumulant.
:param int n: Anisotropy order.
:param int k: Correlation order.
:param bool error:
Whether to calculate statistical error (for `v_n\{2\}` only).
If true, r... |
Evaluate the _unnormalized_ flow PDF.
def _pdf(self, phi):
"""
Evaluate the _unnormalized_ flow PDF.
"""
pdf = np.inner(self._vn, np.cos(np.outer(phi, self._n)))
pdf *= 2.
pdf += 1.
return pdf |
Generate M random numbers in [-pi, pi).
def _uniform_phi(M):
"""
Generate M random numbers in [-pi, pi).
"""
return np.random.uniform(-np.pi, np.pi, M) |
r"""
Evaluate the flow PDF `dN/d\phi`.
:param array-like phi: Azimuthal angles.
:returns: The flow PDF evaluated at ``phi``.
def pdf(self, phi):
r"""
Evaluate the flow PDF `dN/d\phi`.
:param array-like phi: Azimuthal angles.
:returns: The flow PDF evaluated a... |
r"""
Randomly sample azimuthal angles `\phi`.
:param int multiplicity: Number to sample.
:returns: Array of sampled angles.
def sample(self, multiplicity):
r"""
Randomly sample azimuthal angles `\phi`.
:param int multiplicity: Number to sample.
:returns: Arra... |
Typeless dump an object to json string
def dumps(obj, *args, **kwargs):
''' Typeless dump an object to json string '''
return json.dumps(obj, *args, cls=TypelessSONEncoder, ensure_ascii=False, **kwargs) |
Pull data from source to target.
Target's __dict__ (object data) will be used by default. Otherwise, it'll be treated as a dictionary
def flex_update_obj(source, target, __silent, *fields, **field_map):
''' Pull data from source to target.
Target's __dict__ (object data) will be used by default. Otherwise,... |
Use obj_data (dict-like) to construct an object of type cls
prioritize obj_dict when there are conficts
def to_obj(cls, obj_data=None, *fields, **field_map):
''' Use obj_data (dict-like) to construct an object of type cls
prioritize obj_dict when there are conficts '''
if not fields:
fields = o... |
Check if a text if written in kana only (hiragana & katakana)
if text is empty then return True
def is_kana(text):
''' Check if a text if written in kana only (hiragana & katakana)
if text is empty then return True
'''
if text is None:
raise ValueError("text cannot be None")
for c in te... |
Use mecab to parse one sentence
def txt2mecab(text, **kwargs):
''' Use mecab to parse one sentence '''
mecab_out = _internal_mecab_parse(text, **kwargs).splitlines()
tokens = [MeCabToken.parse(x) for x in mecab_out]
return MeCabSent(text, tokens) |
Use mecab to parse many lines
def lines2mecab(lines, **kwargs):
''' Use mecab to parse many lines '''
sents = []
for line in lines:
sent = txt2mecab(line, **kwargs)
sents.append(sent)
return sents |
Tokenize a text to multiple sentences
def tokenize_sent(mtokens, raw='', auto_strip=True):
''' Tokenize a text to multiple sentences '''
sents = []
bucket = []
cfrom = 0
cto = 0
token_cfrom = 0
logger = getLogger()
logger.debug("raw text: {}".format(raw))
logger.debug("tokens: {}".f... |
Japanese text > tokenize/txt/html
def analyse(content, splitlines=True, format=None, **kwargs):
''' Japanese text > tokenize/txt/html '''
sents = DekoText.parse(content, splitlines=splitlines, **kwargs)
doc = []
final = sents
# Generate output
if format == 'html':
for sent in sents:
... |
Use pos-sc1-sc2 as POS
def pos3(self):
''' Use pos-sc1-sc2 as POS '''
parts = [self.pos]
if self.sc1 and self.sc1 != '*':
parts.append(self.sc1)
if self.sc2 and self.sc2 != '*':
parts.append(self.sc2)
return '-'.join(parts) |
Convert one MeCabToken into HTML
def to_ruby(self):
''' Convert one MeCabToken into HTML '''
if self.need_ruby():
surface = self.surface
reading = self.reading_hira()
return '<ruby><rb>{sur}</rb><rt>{read}</rt></ruby>'.format(sur=surface, read=reading)
elif s... |
Parse a text string and add it to this doc
def add(self, sentence_text, **kwargs):
''' Parse a text string and add it to this doc '''
sent = MeCabSent.parse(sentence_text, **kwargs)
self.sents.append(sent)
return sent |
Return a unicode object representing 's'.
Treats bytes using the 'encoding' codec.
If strings_only is True, don't convert (some) non-string-like objects.
def smart_text(s, encoding="utf-8", strings_only=False, errors="strict"):
"""Return a unicode object representing 's'.
Treats bytes using t... |
Return a bytes version of 's' encoded as specified in 'encoding'.
If strings_only is True, don't convert (some) non-string-like objects.
def smart_bytes(s, encoding="utf-8", strings_only=False, errors="strict"):
"""Return a bytes version of 's' encoded as specified in 'encoding'.
If strings_only is ... |
Formats a response from a view to handle any RDF graphs
If a view function returns an RDF graph, serialize it based on Accept header
If it's not an RDF graph, return it without any special handling
def output(self, response, accepts):
""" Formats a response from a view to handle any RDF graphs
If a... |
Wraps a view function to return formatted RDF graphs
Uses content negotiation to serialize the graph to the client-preferred format
Passes other content through unmodified
def decorate(self, view):
""" Wraps a view function to return formatted RDF graphs
Uses content negotiation to serialize the gr... |
r"""
Calculate eccentricity harmonic `\varepsilon_n`.
:param int n: Eccentricity order.
def ecc(self, n):
r"""
Calculate eccentricity harmonic `\varepsilon_n`.
:param int n: Eccentricity order.
"""
ny, nx = self._profile.shape
xmax, ymax = self._xymax
... |
Return a value from configuration.
Safe version which always returns a default value if the value is not
found.
def get(self, var, default=None):
"""Return a value from configuration.
Safe version which always returns a default value if the value is not
found.
"""
... |
Insert at the index.
If the index is not provided appends to the end of the list.
def insert(self, var, value, index=None):
"""Insert at the index.
If the index is not provided appends to the end of the list.
"""
current = self.__get(var)
if not isinstance(current, lis... |
Return a merged set of top level keys from all configurations.
def keys(self):
"""Return a merged set of top level keys from all configurations."""
s = set()
for config in self.__configs:
s |= config.keys()
return s |
Close the stream.
def close(self):
"""Close the stream."""
self.flush()
self.stream.close()
logging.StreamHandler.close(self) |
Emit a record.
Output the record to the file, catering for rollover as described
in doRollover().
def emit(self, record):
"""Emit a record.
Output the record to the file, catering for rollover as described
in doRollover().
"""
try:
if self.shouldRol... |
Do a rollover, as described in __init__().
def doRollover(self):
"""Do a rollover, as described in __init__()."""
self.stream.close()
try:
if self.backupCount > 0:
tmp_location = "%s.0" % self.baseFilename
os.rename(self.baseFilename, tmp_location)
... |
Determine if rollover should occur.
Basically, see if the supplied record would cause the file to exceed
the size limit we have.
def shouldRollover(self, record):
"""Determine if rollover should occur.
Basically, see if the supplied record would cause the file to exceed
the si... |
Split the string s using shell-like syntax.
Args:
s (str): String to split
posix (bool): Use posix split
Returns:
list of str: List of string parts
def split(s, posix=True):
"""Split the string s using shell-like syntax.
Args:
s (str): String to split
posix (b... |
Recursive search function.
Args:
path (str): Path to search recursively
matcher (str or callable): String pattern to search for or function
that returns True/False for a file argument
dirs (bool): if True returns directories that match the pattern
files(bool): if True re... |
Change the current working directory.
Args:
directory (str): Directory to go to.
def chdir(directory):
"""Change the current working directory.
Args:
directory (str): Directory to go to.
"""
directory = os.path.abspath(directory)
logger.info("chdir -> %s" % directory)
try:... |
Context object for changing directory.
Args:
directory (str): Directory to go to.
create (bool): Create directory if it doesn't exists.
Usage::
>>> with goto(directory) as ok:
... if not ok:
... print 'Error'
... else:
... print ... |
Make a directory.
Create a leaf directory and all intermediate ones.
Works like ``mkdir``, except that any intermediate path segment (not just
the rightmost) will be created if it does not exist. This is recursive.
Args:
path (str): Directory to create
mode (int): Directory mode
... |
Copy data and mode bits ("cp source destination").
The destination may be a directory.
Args:
source (str): Source file (file to copy).
destination (str): Destination file or directory (where to copy).
Returns:
bool: True if the operation is successful, False otherwise.
def __copy... |
Copy data and all stat info ("cp -p source destination").
The destination may be a directory.
Args:
source (str): Source file (file to copy).
destination (str): Destination file or directory (where to copy).
Returns:
bool: True if the operation is successful, False otherwise.
def... |
Copy a directory tree recursively using copy2().
The destination directory must not already exist.
If the optional symlinks flag is true, symbolic links in the
source tree result in symbolic links in the destination tree; if
it is false, the contents of the files pointed to by symbolic
links are c... |
Copy file or directory.
Args:
source (str): Source file or directory
destination (str): Destination file or directory (where to copy).
Returns:
bool: True if the operation is successful, False otherwise.
def copy(source, destination):
"""Copy file or directory.
Args:
... |
Copy all file found by glob.glob(pattern) to destination directory.
Args:
pattern (str): Glob pattern
destination (str): Path to the destination directory.
Returns:
bool: True if the operation is successful, False otherwise.
def gcopy(pattern, destination):
"""Copy all file found ... |
Move a file or directory (recursively) to another location.
If the destination is on our current file system, then simply use
rename. Otherwise, copy source to the destination and then remove
source.
Args:
source (str): Source file or directory (file or directory to move).
destination ... |
Move all file found by glob.glob(pattern) to destination directory.
Args:
pattern (str): Glob pattern
destination (str): Path to the destination directory.
Returns:
bool: True if the operation is successful, False otherwise.
def gmove(pattern, destination):
"""Move all file found ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.