body_hash stringlengths 64 64 | body stringlengths 23 109k | docstring stringlengths 1 57k | path stringlengths 4 198 | name stringlengths 1 115 | repository_name stringlengths 7 111 | repository_stars float64 0 191k | lang stringclasses 1
value | body_without_docstring stringlengths 14 108k | unified stringlengths 45 133k |
|---|---|---|---|---|---|---|---|---|---|
15c59c10f3447afff5c8bb3cf1fc1c7cb08a1d8964b9d51d669588bebcb0e894 | async def run_client(hubs_room: Room, loop: asyncio.AbstractEventLoop, inputs: 'asyncio.Queue[str]', stop: 'asyncio.Future[None]') -> None:
'\n WebSocket client thread\n\n Args:\n hub_id: hub ID\n loop: event loop\n inputs: queue for user input\n stop: stop condition\n '
ret... | WebSocket client thread
Args:
hub_id: hub ID
loop: event loop
inputs: queue for user input
stop: stop condition | hubsmsg.py | run_client | ohtanim/hubsmon | 0 | python | async def run_client(hubs_room: Room, loop: asyncio.AbstractEventLoop, inputs: 'asyncio.Queue[str]', stop: 'asyncio.Future[None]') -> None:
'\n WebSocket client thread\n\n Args:\n hub_id: hub ID\n loop: event loop\n inputs: queue for user input\n stop: stop condition\n '
ret... | async def run_client(hubs_room: Room, loop: asyncio.AbstractEventLoop, inputs: 'asyncio.Queue[str]', stop: 'asyncio.Future[None]') -> None:
'\n WebSocket client thread\n\n Args:\n hub_id: hub ID\n loop: event loop\n inputs: queue for user input\n stop: stop condition\n '
ret... |
74617b619635310bf65ddb4a7ce569c5fc4cfaf9723a3d048daff4cd53e21e2d | def main() -> None:
'\n main thread of this program\n '
parser = argparse.ArgumentParser(description='hubsmon - A tool to send chat messages to each Mozilla Hubs rooms.')
parser.add_argument('rooms_file', help='a JSON file contains a list of room URLs.')
parser.add_argument('-n', '--name', default... | main thread of this program | hubsmsg.py | main | ohtanim/hubsmon | 0 | python | def main() -> None:
'\n \n '
parser = argparse.ArgumentParser(description='hubsmon - A tool to send chat messages to each Mozilla Hubs rooms.')
parser.add_argument('rooms_file', help='a JSON file contains a list of room URLs.')
parser.add_argument('-n', '--name', default='Presence Monitor', help='... | def main() -> None:
'\n \n '
parser = argparse.ArgumentParser(description='hubsmon - A tool to send chat messages to each Mozilla Hubs rooms.')
parser.add_argument('rooms_file', help='a JSON file contains a list of room URLs.')
parser.add_argument('-n', '--name', default='Presence Monitor', help='... |
251d5c0162b5c236a06394585e2bbf3d57a12f6a287e6462cb7d02642780b7d5 | def download_era5_data(year, month, days, hours, data_path):
'Downloads ERA5 data for the specified days and hours in a given year/month.\n\n PARAMETERS: \n -----------\n year: Year of ERA5 data (four-character string)\n month: Month of ERA5 data (two-character string)\n days: List of days in year/... | Downloads ERA5 data for the specified days and hours in a given year/month.
PARAMETERS:
-----------
year: Year of ERA5 data (four-character string)
month: Month of ERA5 data (two-character string)
days: List of days in year/month for which ERA5 data is desired (list of
two-character strings)
hours: List of ... | scripts/download_era5_data.py | download_era5_data | lucien-sim/cloudsat-viz | 1 | python | def download_era5_data(year, month, days, hours, data_path):
'Downloads ERA5 data for the specified days and hours in a given year/month.\n\n PARAMETERS: \n -----------\n year: Year of ERA5 data (four-character string)\n month: Month of ERA5 data (two-character string)\n days: List of days in year/... | def download_era5_data(year, month, days, hours, data_path):
'Downloads ERA5 data for the specified days and hours in a given year/month.\n\n PARAMETERS: \n -----------\n year: Year of ERA5 data (four-character string)\n month: Month of ERA5 data (two-character string)\n days: List of days in year/... |
cff6a86040888519ec5e77c1dbd5f989b1983cae7873de3cd27cb7f7761c6fac | def __init__(self, center_line=None, width_left=None, width_right=None, loop=True):
'\n Considers a track with fixed width.\n\n Args:\n center_line: 2D numpy array containing samples of track center line\n [[x1,x2,...], [y1,y2,...]]\n width_left: float, width of the track on t... | Considers a track with fixed width.
Args:
center_line: 2D numpy array containing samples of track center line
[[x1,x2,...], [y1,y2,...]]
width_left: float, width of the track on the left side
width_right: float, width of the track on the right side
loop: Boolean. If the track has loop | ROS_ws/src/lab2/traj_planning_ros/src/iLQR/track.py | __init__ | kenarvyas/ECE346 | 4 | python | def __init__(self, center_line=None, width_left=None, width_right=None, loop=True):
'\n Considers a track with fixed width.\n\n Args:\n center_line: 2D numpy array containing samples of track center line\n [[x1,x2,...], [y1,y2,...]]\n width_left: float, width of the track on t... | def __init__(self, center_line=None, width_left=None, width_right=None, loop=True):
'\n Considers a track with fixed width.\n\n Args:\n center_line: 2D numpy array containing samples of track center line\n [[x1,x2,...], [y1,y2,...]]\n width_left: float, width of the track on t... |
79db67bba18eb463921dfba8ceb1d02a9d429d6d958a1c259489158da5f032fb | def _interp_s(self, s):
'\n Given a list of s (progress since start), return corresponing (x,y) points\n on the track. In addition, return slope of trangent line on those points.\n '
n = len(s)
interp_pt = self.center_line.getValue(s)
slope = np.zeros(n)
for i in range(n):
deri = se... | Given a list of s (progress since start), return corresponing (x,y) points
on the track. In addition, return slope of trangent line on those points. | ROS_ws/src/lab2/traj_planning_ros/src/iLQR/track.py | _interp_s | kenarvyas/ECE346 | 4 | python | def _interp_s(self, s):
'\n Given a list of s (progress since start), return corresponing (x,y) points\n on the track. In addition, return slope of trangent line on those points.\n '
n = len(s)
interp_pt = self.center_line.getValue(s)
slope = np.zeros(n)
for i in range(n):
deri = se... | def _interp_s(self, s):
'\n Given a list of s (progress since start), return corresponing (x,y) points\n on the track. In addition, return slope of trangent line on those points.\n '
n = len(s)
interp_pt = self.center_line.getValue(s)
slope = np.zeros(n)
for i in range(n):
deri = se... |
0e43e565e61f3c42599e089e3640350bd5ae287cb018e375e77819063323445b | def interp(self, theta_list):
'\n Given a list of theta (progress since start), return corresponing (x,y)\n points on the track. In addition, return slope of trangent line on those\n points.\n '
if self.loop:
s = (np.remainder(theta_list, self.length) / self.length)
else:
s = (np... | Given a list of theta (progress since start), return corresponing (x,y)
points on the track. In addition, return slope of trangent line on those
points. | ROS_ws/src/lab2/traj_planning_ros/src/iLQR/track.py | interp | kenarvyas/ECE346 | 4 | python | def interp(self, theta_list):
'\n Given a list of theta (progress since start), return corresponing (x,y)\n points on the track. In addition, return slope of trangent line on those\n points.\n '
if self.loop:
s = (np.remainder(theta_list, self.length) / self.length)
else:
s = (np... | def interp(self, theta_list):
'\n Given a list of theta (progress since start), return corresponing (x,y)\n points on the track. In addition, return slope of trangent line on those\n points.\n '
if self.loop:
s = (np.remainder(theta_list, self.length) / self.length)
else:
s = (np... |
7bb84bf6cf76451250f263ec9995137d975e922c1f38a6a26dcb0a980e695845 | def get_closest_pts(self, points):
'\n Points have [2xn] shape\n '
(s, _) = self.center_line.projectPoint(points.T, eps=0.001)
(closest_pt, slope) = self._interp_s(s)
return (closest_pt, slope, (s * self.length)) | Points have [2xn] shape | ROS_ws/src/lab2/traj_planning_ros/src/iLQR/track.py | get_closest_pts | kenarvyas/ECE346 | 4 | python | def get_closest_pts(self, points):
'\n \n '
(s, _) = self.center_line.projectPoint(points.T, eps=0.001)
(closest_pt, slope) = self._interp_s(s)
return (closest_pt, slope, (s * self.length)) | def get_closest_pts(self, points):
'\n \n '
(s, _) = self.center_line.projectPoint(points.T, eps=0.001)
(closest_pt, slope) = self._interp_s(s)
return (closest_pt, slope, (s * self.length))<|docstring|>Points have [2xn] shape<|endoftext|> |
fcc2743e251cce55cd3a97e3831a77a29849af5a13b1f46bc7f2f4dae53c26b7 | def getFileNames(molname, workdir):
'\n Get File name of the Zmat \n\n Parameters\n ----------\n molname : str\n Molecule name\n workdir : str\n Working folder\n\n Returns\n -------\n str\n Zmat file name\n '
return path.join(workdir, (molname + '.z')) | Get File name of the Zmat
Parameters
----------
molname : str
Molecule name
workdir : str
Working folder
Returns
-------
str
Zmat file name | ligpargen/inout/zmat.py | getFileNames | wutobias/ligpargen | 13 | python | def getFileNames(molname, workdir):
'\n Get File name of the Zmat \n\n Parameters\n ----------\n molname : str\n Molecule name\n workdir : str\n Working folder\n\n Returns\n -------\n str\n Zmat file name\n '
return path.join(workdir, (molname + '.z')) | def getFileNames(molname, workdir):
'\n Get File name of the Zmat \n\n Parameters\n ----------\n molname : str\n Molecule name\n workdir : str\n Working folder\n\n Returns\n -------\n str\n Zmat file name\n '
return path.join(workdir, (molname + '.z'))<|docstring|... |
ecccf1d9010993adb5b26a2179f3d647809a0f7c4fda633e7ef493bf2979ef6c | def write(molecule, molname, workdir, writeAtomParameters=False):
'\n Write a molecule object in a file using the zmat format (BOSS input format)\n\n Parameters\n ----------\n molecule : Molecule object\n Molecule object from the input\n molname : str\n Molecule name\n workdir : str\... | Write a molecule object in a file using the zmat format (BOSS input format)
Parameters
----------
molecule : Molecule object
Molecule object from the input
molname : str
Molecule name
workdir : str
Working folder path
writeAtomParameters : bool, optional
If True, charges and VdW parameters are printed ... | ligpargen/inout/zmat.py | write | wutobias/ligpargen | 13 | python | def write(molecule, molname, workdir, writeAtomParameters=False):
'\n Write a molecule object in a file using the zmat format (BOSS input format)\n\n Parameters\n ----------\n molecule : Molecule object\n Molecule object from the input\n molname : str\n Molecule name\n workdir : str\... | def write(molecule, molname, workdir, writeAtomParameters=False):
'\n Write a molecule object in a file using the zmat format (BOSS input format)\n\n Parameters\n ----------\n molecule : Molecule object\n Molecule object from the input\n molname : str\n Molecule name\n workdir : str\... |
53f9cbbc60d3fb50d7077bc09674618111aaeb00bc385c1589999b4565791000 | def get_data_path(relpath):
'\n Get the absolute path within a package from a relative path\n\n Arguments\n ---------\n relpath: relative path\n '
filename = inspect.getframeinfo(inspect.currentframe()).filename
filepath = os.path.dirname(os.path.abspath(filename))
if isinstance(relpath, ... | Get the absolute path within a package from a relative path
Arguments
---------
relpath: relative path | gravity_toolkit/utilities.py | get_data_path | tsutterley/read-GRACE-harmonics | 9 | python | def get_data_path(relpath):
'\n Get the absolute path within a package from a relative path\n\n Arguments\n ---------\n relpath: relative path\n '
filename = inspect.getframeinfo(inspect.currentframe()).filename
filepath = os.path.dirname(os.path.abspath(filename))
if isinstance(relpath, ... | def get_data_path(relpath):
'\n Get the absolute path within a package from a relative path\n\n Arguments\n ---------\n relpath: relative path\n '
filename = inspect.getframeinfo(inspect.currentframe()).filename
filepath = os.path.dirname(os.path.abspath(filename))
if isinstance(relpath, ... |
92ae6d7f9ad88ad8cfed8bc8960ebe68c0391989fbaa8e258eaac2041fdecb8e | def get_hash(local, algorithm='MD5'):
'\n Get the hash value from a local file or BytesIO object\n\n Arguments\n ---------\n local: BytesIO object or path to file\n\n Keyword Arguments\n -----------------\n algorithm: hashing algorithm for checksum validation\n MD5: Message Digest\n ... | Get the hash value from a local file or BytesIO object
Arguments
---------
local: BytesIO object or path to file
Keyword Arguments
-----------------
algorithm: hashing algorithm for checksum validation
MD5: Message Digest
sha1: Secure Hash Algorithm | gravity_toolkit/utilities.py | get_hash | tsutterley/read-GRACE-harmonics | 9 | python | def get_hash(local, algorithm='MD5'):
'\n Get the hash value from a local file or BytesIO object\n\n Arguments\n ---------\n local: BytesIO object or path to file\n\n Keyword Arguments\n -----------------\n algorithm: hashing algorithm for checksum validation\n MD5: Message Digest\n ... | def get_hash(local, algorithm='MD5'):
'\n Get the hash value from a local file or BytesIO object\n\n Arguments\n ---------\n local: BytesIO object or path to file\n\n Keyword Arguments\n -----------------\n algorithm: hashing algorithm for checksum validation\n MD5: Message Digest\n ... |
a9a442eb5ed286075d7492dd79e486d3b5796e6d96dba3ab05c3080b874fd3de | def url_split(s):
'\n Recursively split a url path into a list\n\n Arguments\n ---------\n s: url string\n '
(head, tail) = posixpath.split(s)
if (head in ('http:', 'https:')):
return (s,)
elif (head in ('', posixpath.sep)):
return (tail,)
return (url_split(head) + (ta... | Recursively split a url path into a list
Arguments
---------
s: url string | gravity_toolkit/utilities.py | url_split | tsutterley/read-GRACE-harmonics | 9 | python | def url_split(s):
'\n Recursively split a url path into a list\n\n Arguments\n ---------\n s: url string\n '
(head, tail) = posixpath.split(s)
if (head in ('http:', 'https:')):
return (s,)
elif (head in (, posixpath.sep)):
return (tail,)
return (url_split(head) + (tail... | def url_split(s):
'\n Recursively split a url path into a list\n\n Arguments\n ---------\n s: url string\n '
(head, tail) = posixpath.split(s)
if (head in ('http:', 'https:')):
return (s,)
elif (head in (, posixpath.sep)):
return (tail,)
return (url_split(head) + (tail... |
6eb30225980c2e4bb37cc6876b30780adaddcf7297b3914612c5fdc3ee33260e | def convert_arg_line_to_args(arg_line):
'\n Convert file lines to arguments\n\n Arguments\n ---------\n arg_line: line string containing a single argument and/or comments\n '
for arg in re.sub('\\#(.*?)$', '', arg_line).split():
if (not arg.strip()):
continue
(yield ar... | Convert file lines to arguments
Arguments
---------
arg_line: line string containing a single argument and/or comments | gravity_toolkit/utilities.py | convert_arg_line_to_args | tsutterley/read-GRACE-harmonics | 9 | python | def convert_arg_line_to_args(arg_line):
'\n Convert file lines to arguments\n\n Arguments\n ---------\n arg_line: line string containing a single argument and/or comments\n '
for arg in re.sub('\\#(.*?)$', , arg_line).split():
if (not arg.strip()):
continue
(yield arg) | def convert_arg_line_to_args(arg_line):
'\n Convert file lines to arguments\n\n Arguments\n ---------\n arg_line: line string containing a single argument and/or comments\n '
for arg in re.sub('\\#(.*?)$', , arg_line).split():
if (not arg.strip()):
continue
(yield arg)... |
f13248fc2f85770628d045dfa817f238434c80f34a1a880e0ae720bb9c877358 | def get_unix_time(time_string, format='%Y-%m-%d %H:%M:%S'):
'\n Get the Unix timestamp value for a formatted date string\n\n Arguments\n ---------\n time_string: formatted time string to parse\n\n Keyword arguments\n -----------------\n format: format for input time string\n '
try:
... | Get the Unix timestamp value for a formatted date string
Arguments
---------
time_string: formatted time string to parse
Keyword arguments
-----------------
format: format for input time string | gravity_toolkit/utilities.py | get_unix_time | tsutterley/read-GRACE-harmonics | 9 | python | def get_unix_time(time_string, format='%Y-%m-%d %H:%M:%S'):
'\n Get the Unix timestamp value for a formatted date string\n\n Arguments\n ---------\n time_string: formatted time string to parse\n\n Keyword arguments\n -----------------\n format: format for input time string\n '
try:
... | def get_unix_time(time_string, format='%Y-%m-%d %H:%M:%S'):
'\n Get the Unix timestamp value for a formatted date string\n\n Arguments\n ---------\n time_string: formatted time string to parse\n\n Keyword arguments\n -----------------\n format: format for input time string\n '
try:
... |
1e5648e56327ed119c5e1d5973c52b6491b66ccc34a79af28215b8b00e005f40 | def even(value):
'\n Rounds a number to an even number less than or equal to original\n\n Arguments\n ---------\n value: number to be rounded\n '
return (2 * int((value // 2))) | Rounds a number to an even number less than or equal to original
Arguments
---------
value: number to be rounded | gravity_toolkit/utilities.py | even | tsutterley/read-GRACE-harmonics | 9 | python | def even(value):
'\n Rounds a number to an even number less than or equal to original\n\n Arguments\n ---------\n value: number to be rounded\n '
return (2 * int((value // 2))) | def even(value):
'\n Rounds a number to an even number less than or equal to original\n\n Arguments\n ---------\n value: number to be rounded\n '
return (2 * int((value // 2)))<|docstring|>Rounds a number to an even number less than or equal to original
Arguments
---------
value: number to be ro... |
93353704f7485c1e16b0774b62360d2f2d472c8d676c1f35653bcda9fe2c2a5a | def copy(source, destination, verbose=False, move=False):
'\n Copy or move a file with all system information\n\n Arguments\n ---------\n source: source file\n destination: copied destination file\n\n Keyword arguments\n -----------------\n verbose: print file transfer information\n move:... | Copy or move a file with all system information
Arguments
---------
source: source file
destination: copied destination file
Keyword arguments
-----------------
verbose: print file transfer information
move: remove the source file | gravity_toolkit/utilities.py | copy | tsutterley/read-GRACE-harmonics | 9 | python | def copy(source, destination, verbose=False, move=False):
'\n Copy or move a file with all system information\n\n Arguments\n ---------\n source: source file\n destination: copied destination file\n\n Keyword arguments\n -----------------\n verbose: print file transfer information\n move:... | def copy(source, destination, verbose=False, move=False):
'\n Copy or move a file with all system information\n\n Arguments\n ---------\n source: source file\n destination: copied destination file\n\n Keyword arguments\n -----------------\n verbose: print file transfer information\n move:... |
8a0717d5a3c7fcd31ce3a7fc2b74d5aa70da8fe4fac45ce447298c571f13e52d | def create_unique_file(filename):
'\n Open a unique file adding a numerical instance if existing\n\n Arguments\n ---------\n filename: full path to output file\n '
(fileBasename, fileExtension) = os.path.splitext(filename)
counter = 1
while counter:
try:
fd = os.open(f... | Open a unique file adding a numerical instance if existing
Arguments
---------
filename: full path to output file | gravity_toolkit/utilities.py | create_unique_file | tsutterley/read-GRACE-harmonics | 9 | python | def create_unique_file(filename):
'\n Open a unique file adding a numerical instance if existing\n\n Arguments\n ---------\n filename: full path to output file\n '
(fileBasename, fileExtension) = os.path.splitext(filename)
counter = 1
while counter:
try:
fd = os.open(f... | def create_unique_file(filename):
'\n Open a unique file adding a numerical instance if existing\n\n Arguments\n ---------\n filename: full path to output file\n '
(fileBasename, fileExtension) = os.path.splitext(filename)
counter = 1
while counter:
try:
fd = os.open(f... |
1f00244c0d49a78b63b1392168cebc65482f13333d9e6a190766c74f69df303d | def check_ftp_connection(HOST, username=None, password=None):
'\n Check internet connection with ftp host\n\n Arguments\n ---------\n HOST: remote ftp host\n\n Keyword arguments\n -----------------\n username: ftp username\n password: ftp password\n '
try:
f = ftplib.FTP(HOST)... | Check internet connection with ftp host
Arguments
---------
HOST: remote ftp host
Keyword arguments
-----------------
username: ftp username
password: ftp password | gravity_toolkit/utilities.py | check_ftp_connection | tsutterley/read-GRACE-harmonics | 9 | python | def check_ftp_connection(HOST, username=None, password=None):
'\n Check internet connection with ftp host\n\n Arguments\n ---------\n HOST: remote ftp host\n\n Keyword arguments\n -----------------\n username: ftp username\n password: ftp password\n '
try:
f = ftplib.FTP(HOST)... | def check_ftp_connection(HOST, username=None, password=None):
'\n Check internet connection with ftp host\n\n Arguments\n ---------\n HOST: remote ftp host\n\n Keyword arguments\n -----------------\n username: ftp username\n password: ftp password\n '
try:
f = ftplib.FTP(HOST)... |
6912646cfd752597694c9b9a39779e0be5f36ad3b52a124c2066a3389f969440 | def ftp_list(HOST, username=None, password=None, timeout=None, basename=False, pattern=None, sort=False):
'\n List a directory on a ftp host\n\n Arguments\n ---------\n HOST: remote ftp host path split as list\n\n Keyword arguments\n -----------------\n username: ftp username\n password: ftp... | List a directory on a ftp host
Arguments
---------
HOST: remote ftp host path split as list
Keyword arguments
-----------------
username: ftp username
password: ftp password
timeout: timeout in seconds for blocking operations
basename: return the file or directory basename instead of the full path
pattern: regular ex... | gravity_toolkit/utilities.py | ftp_list | tsutterley/read-GRACE-harmonics | 9 | python | def ftp_list(HOST, username=None, password=None, timeout=None, basename=False, pattern=None, sort=False):
'\n List a directory on a ftp host\n\n Arguments\n ---------\n HOST: remote ftp host path split as list\n\n Keyword arguments\n -----------------\n username: ftp username\n password: ftp... | def ftp_list(HOST, username=None, password=None, timeout=None, basename=False, pattern=None, sort=False):
'\n List a directory on a ftp host\n\n Arguments\n ---------\n HOST: remote ftp host path split as list\n\n Keyword arguments\n -----------------\n username: ftp username\n password: ftp... |
d3057a6351b4602e6f15696b5abb0c96d416c29bba044c7acdac56871544b41c | def from_ftp(HOST, username=None, password=None, timeout=None, local=None, hash='', chunk=8192, verbose=False, fid=sys.stdout, mode=509):
'\n Download a file from a ftp host\n\n Arguments\n ---------\n HOST: remote ftp host path split as list\n\n Keyword arguments\n -----------------\n username... | Download a file from a ftp host
Arguments
---------
HOST: remote ftp host path split as list
Keyword arguments
-----------------
username: ftp username
password: ftp password
timeout: timeout in seconds for blocking operations
local: path to local file
hash: MD5 hash of local file
chunk: chunk size for transfer encod... | gravity_toolkit/utilities.py | from_ftp | tsutterley/read-GRACE-harmonics | 9 | python | def from_ftp(HOST, username=None, password=None, timeout=None, local=None, hash=, chunk=8192, verbose=False, fid=sys.stdout, mode=509):
'\n Download a file from a ftp host\n\n Arguments\n ---------\n HOST: remote ftp host path split as list\n\n Keyword arguments\n -----------------\n username: ... | def from_ftp(HOST, username=None, password=None, timeout=None, local=None, hash=, chunk=8192, verbose=False, fid=sys.stdout, mode=509):
'\n Download a file from a ftp host\n\n Arguments\n ---------\n HOST: remote ftp host path split as list\n\n Keyword arguments\n -----------------\n username: ... |
5282e9a6b58f34407a2295df8feb0232e6e605278b0d97268658a34e930d386e | def check_connection(HOST):
'\n Check internet connection with http host\n\n Arguments\n ---------\n HOST: remote http host\n '
try:
urllib2.urlopen(HOST, timeout=20, context=ssl.SSLContext())
except urllib2.URLError:
raise RuntimeError('Check internet connection')
else:
... | Check internet connection with http host
Arguments
---------
HOST: remote http host | gravity_toolkit/utilities.py | check_connection | tsutterley/read-GRACE-harmonics | 9 | python | def check_connection(HOST):
'\n Check internet connection with http host\n\n Arguments\n ---------\n HOST: remote http host\n '
try:
urllib2.urlopen(HOST, timeout=20, context=ssl.SSLContext())
except urllib2.URLError:
raise RuntimeError('Check internet connection')
else:
... | def check_connection(HOST):
'\n Check internet connection with http host\n\n Arguments\n ---------\n HOST: remote http host\n '
try:
urllib2.urlopen(HOST, timeout=20, context=ssl.SSLContext())
except urllib2.URLError:
raise RuntimeError('Check internet connection')
else:
... |
a40f56cc9c1dfa8c54672c0ed2e090907c274cd7026fdab3556a3b0f64e43572 | def http_list(HOST, timeout=None, context=ssl.SSLContext(), parser=lxml.etree.HTMLParser(), format='%Y-%m-%d %H:%M', pattern='', sort=False):
'\n List a directory on an Apache http Server\n\n Arguments\n ---------\n HOST: remote http host path split as list\n\n Keyword arguments\n ----------------... | List a directory on an Apache http Server
Arguments
---------
HOST: remote http host path split as list
Keyword arguments
-----------------
timeout: timeout in seconds for blocking operations
context: SSL context for url opener object
parser: HTML parser for lxml
format: format for input time string
pattern: regular ... | gravity_toolkit/utilities.py | http_list | tsutterley/read-GRACE-harmonics | 9 | python | def http_list(HOST, timeout=None, context=ssl.SSLContext(), parser=lxml.etree.HTMLParser(), format='%Y-%m-%d %H:%M', pattern=, sort=False):
'\n List a directory on an Apache http Server\n\n Arguments\n ---------\n HOST: remote http host path split as list\n\n Keyword arguments\n -----------------\... | def http_list(HOST, timeout=None, context=ssl.SSLContext(), parser=lxml.etree.HTMLParser(), format='%Y-%m-%d %H:%M', pattern=, sort=False):
'\n List a directory on an Apache http Server\n\n Arguments\n ---------\n HOST: remote http host path split as list\n\n Keyword arguments\n -----------------\... |
452c1b5d655182b82cf35fe58fd6634678be35656698a85146619fd3e3f07aa6 | def from_http(HOST, timeout=None, context=ssl.SSLContext(), local=None, hash='', chunk=16384, verbose=False, fid=sys.stdout, mode=509):
'\n Download a file from a http host\n\n Arguments\n ---------\n HOST: remote http host path split as list\n\n Keyword arguments\n -----------------\n timeout:... | Download a file from a http host
Arguments
---------
HOST: remote http host path split as list
Keyword arguments
-----------------
timeout: timeout in seconds for blocking operations
context: SSL context for url opener object
local: path to local file
hash: MD5 hash of local file
chunk: chunk size for transfer encodi... | gravity_toolkit/utilities.py | from_http | tsutterley/read-GRACE-harmonics | 9 | python | def from_http(HOST, timeout=None, context=ssl.SSLContext(), local=None, hash=, chunk=16384, verbose=False, fid=sys.stdout, mode=509):
'\n Download a file from a http host\n\n Arguments\n ---------\n HOST: remote http host path split as list\n\n Keyword arguments\n -----------------\n timeout: t... | def from_http(HOST, timeout=None, context=ssl.SSLContext(), local=None, hash=, chunk=16384, verbose=False, fid=sys.stdout, mode=509):
'\n Download a file from a http host\n\n Arguments\n ---------\n HOST: remote http host path split as list\n\n Keyword arguments\n -----------------\n timeout: t... |
a4f90180c232f964ff8281d9d497d447fa58af50853dc1a1c2c1e2c6e6567894 | def build_opener(username, password, context=ssl.SSLContext(), password_manager=False, get_ca_certs=False, redirect=False, authorization_header=True, urs='https://urs.earthdata.nasa.gov'):
'\n build urllib opener for NASA Earthdata or JPL PO.DAAC Drive with\n supplied credentials\n\n Arguments\n -------... | build urllib opener for NASA Earthdata or JPL PO.DAAC Drive with
supplied credentials
Arguments
---------
username: NASA Earthdata username
password: NASA Earthdata or JPL PO.DAAC WebDAV password
Keyword arguments
-----------------
context: SSL context for opener object
password_manager: create password manager conte... | gravity_toolkit/utilities.py | build_opener | tsutterley/read-GRACE-harmonics | 9 | python | def build_opener(username, password, context=ssl.SSLContext(), password_manager=False, get_ca_certs=False, redirect=False, authorization_header=True, urs='https://urs.earthdata.nasa.gov'):
'\n build urllib opener for NASA Earthdata or JPL PO.DAAC Drive with\n supplied credentials\n\n Arguments\n -------... | def build_opener(username, password, context=ssl.SSLContext(), password_manager=False, get_ca_certs=False, redirect=False, authorization_header=True, urs='https://urs.earthdata.nasa.gov'):
'\n build urllib opener for NASA Earthdata or JPL PO.DAAC Drive with\n supplied credentials\n\n Arguments\n -------... |
e5fdb736ad982db83546dfd98f23dfedc40110d2af2a0a21d27166d84d715285 | def check_credentials(HOST='https://podaac-tools.jpl.nasa.gov'):
'\n Check that entered JPL PO.DAAC or ECCO Drive credentials are valid\n\n Keyword arguments\n -----------------\n HOST: PO.DAAC or ECCO Drive host\n '
try:
request = urllib2.Request(url=posixpath.join(HOST, 'drive', 'files'... | Check that entered JPL PO.DAAC or ECCO Drive credentials are valid
Keyword arguments
-----------------
HOST: PO.DAAC or ECCO Drive host | gravity_toolkit/utilities.py | check_credentials | tsutterley/read-GRACE-harmonics | 9 | python | def check_credentials(HOST='https://podaac-tools.jpl.nasa.gov'):
'\n Check that entered JPL PO.DAAC or ECCO Drive credentials are valid\n\n Keyword arguments\n -----------------\n HOST: PO.DAAC or ECCO Drive host\n '
try:
request = urllib2.Request(url=posixpath.join(HOST, 'drive', 'files'... | def check_credentials(HOST='https://podaac-tools.jpl.nasa.gov'):
'\n Check that entered JPL PO.DAAC or ECCO Drive credentials are valid\n\n Keyword arguments\n -----------------\n HOST: PO.DAAC or ECCO Drive host\n '
try:
request = urllib2.Request(url=posixpath.join(HOST, 'drive', 'files'... |
e7f7f972569803b30f25e38f09d60b8d13d02ac9981bd7045c28e478d838e0d3 | def drive_list(HOST, username=None, password=None, build=True, timeout=None, urs='podaac-tools.jpl.nasa.gov', parser=lxml.etree.HTMLParser(), pattern='', sort=False):
'\n List a directory on JPL PO.DAAC or ECCO Drive\n\n Arguments\n ---------\n HOST: remote https host path split as list\n\n Keyword a... | List a directory on JPL PO.DAAC or ECCO Drive
Arguments
---------
HOST: remote https host path split as list
Keyword arguments
-----------------
username: NASA Earthdata username
password: JPL PO.DAAC Drive WebDAV password
build: Build opener and check WebDAV credentials
timeout: timeout in seconds for blocking opera... | gravity_toolkit/utilities.py | drive_list | tsutterley/read-GRACE-harmonics | 9 | python | def drive_list(HOST, username=None, password=None, build=True, timeout=None, urs='podaac-tools.jpl.nasa.gov', parser=lxml.etree.HTMLParser(), pattern=, sort=False):
'\n List a directory on JPL PO.DAAC or ECCO Drive\n\n Arguments\n ---------\n HOST: remote https host path split as list\n\n Keyword arg... | def drive_list(HOST, username=None, password=None, build=True, timeout=None, urs='podaac-tools.jpl.nasa.gov', parser=lxml.etree.HTMLParser(), pattern=, sort=False):
'\n List a directory on JPL PO.DAAC or ECCO Drive\n\n Arguments\n ---------\n HOST: remote https host path split as list\n\n Keyword arg... |
bce9c186a8bb7ea19c76904bad1fa937f499049f72e2821f0b22743f01780852 | def from_drive(HOST, username=None, password=None, build=True, timeout=None, urs='podaac-tools.jpl.nasa.gov', local=None, hash='', chunk=16384, verbose=False, fid=sys.stdout, mode=509):
'\n Download a file from a JPL PO.DAAC or ECCO Drive https server\n\n Arguments\n ---------\n HOST: remote https host ... | Download a file from a JPL PO.DAAC or ECCO Drive https server
Arguments
---------
HOST: remote https host path split as list
Keyword arguments
-----------------
username: NASA Earthdata username
password: JPL PO.DAAC Drive WebDAV password
build: Build opener and check WebDAV credentials
timeout: timeout in seconds fo... | gravity_toolkit/utilities.py | from_drive | tsutterley/read-GRACE-harmonics | 9 | python | def from_drive(HOST, username=None, password=None, build=True, timeout=None, urs='podaac-tools.jpl.nasa.gov', local=None, hash=, chunk=16384, verbose=False, fid=sys.stdout, mode=509):
'\n Download a file from a JPL PO.DAAC or ECCO Drive https server\n\n Arguments\n ---------\n HOST: remote https host pa... | def from_drive(HOST, username=None, password=None, build=True, timeout=None, urs='podaac-tools.jpl.nasa.gov', local=None, hash=, chunk=16384, verbose=False, fid=sys.stdout, mode=509):
'\n Download a file from a JPL PO.DAAC or ECCO Drive https server\n\n Arguments\n ---------\n HOST: remote https host pa... |
4ee6efe142e27953eb9f102bc12e2ba7e7690d7d5aa81d78a782a940cedd9c65 | def from_figshare(directory, article='7388540', timeout=None, context=ssl.SSLContext(), chunk=16384, verbose=False, fid=sys.stdout, pattern='(CSR|GFZ|JPL)_(RL\\d+)_(.*?)_SLF_iter.txt$', mode=509):
'\n Download Sutterley and Velicogna (2019) geocenter files from figshare\n\n Arguments\n ---------\n direc... | Download Sutterley and Velicogna (2019) geocenter files from figshare
Arguments
---------
directory: download directory
Keyword arguments
-----------------
article: figshare article number
timeout: timeout in seconds for blocking operations
chunk: chunk size for transfer encoding
verbose: print file transfer informat... | gravity_toolkit/utilities.py | from_figshare | tsutterley/read-GRACE-harmonics | 9 | python | def from_figshare(directory, article='7388540', timeout=None, context=ssl.SSLContext(), chunk=16384, verbose=False, fid=sys.stdout, pattern='(CSR|GFZ|JPL)_(RL\\d+)_(.*?)_SLF_iter.txt$', mode=509):
'\n Download Sutterley and Velicogna (2019) geocenter files from figshare\n\n Arguments\n ---------\n direc... | def from_figshare(directory, article='7388540', timeout=None, context=ssl.SSLContext(), chunk=16384, verbose=False, fid=sys.stdout, pattern='(CSR|GFZ|JPL)_(RL\\d+)_(.*?)_SLF_iter.txt$', mode=509):
'\n Download Sutterley and Velicogna (2019) geocenter files from figshare\n\n Arguments\n ---------\n direc... |
8bf7f496cf92eb06564d6b07fa43a48969062592016de5fb4a1f3d2a33c884e5 | def to_figshare(files, username=None, password=None, directory=None, timeout=None, context=ssl.SSLContext(ssl.PROTOCOL_TLS), get_ca_certs=False, verbose=False, chunk=8192):
'\n Send files to figshare using secure FTP uploader\n\n Arguments\n ---------\n files: list of files to upload\n\n Keyword argu... | Send files to figshare using secure FTP uploader
Arguments
---------
files: list of files to upload
Keyword arguments
-----------------
username: ftp username
password: ftp password
directory: figshare subdirectory for sending data
timeout: timeout in seconds for blocking operations
context: SSL context for ftp conne... | gravity_toolkit/utilities.py | to_figshare | tsutterley/read-GRACE-harmonics | 9 | python | def to_figshare(files, username=None, password=None, directory=None, timeout=None, context=ssl.SSLContext(ssl.PROTOCOL_TLS), get_ca_certs=False, verbose=False, chunk=8192):
'\n Send files to figshare using secure FTP uploader\n\n Arguments\n ---------\n files: list of files to upload\n\n Keyword argu... | def to_figshare(files, username=None, password=None, directory=None, timeout=None, context=ssl.SSLContext(ssl.PROTOCOL_TLS), get_ca_certs=False, verbose=False, chunk=8192):
'\n Send files to figshare using secure FTP uploader\n\n Arguments\n ---------\n files: list of files to upload\n\n Keyword argu... |
edf7ec426b5e9ec5b402fa38049819fbe5a16373f060cc5df9f431dba0f76a2b | def from_csr(directory, timeout=None, context=ssl.SSLContext(), chunk=16384, verbose=False, fid=sys.stdout, mode=509):
'\n Download satellite laser ranging (SLR) files from the\n University of Texas Center for Space Research (UTCSR)\n\n Arguments\n ---------\n directory: download directory\n\n ... | Download satellite laser ranging (SLR) files from the
University of Texas Center for Space Research (UTCSR)
Arguments
---------
directory: download directory
Keyword arguments
-----------------
timeout: timeout in seconds for blocking operations
context: SSL context for url opener object
chunk: chunk size for tra... | gravity_toolkit/utilities.py | from_csr | tsutterley/read-GRACE-harmonics | 9 | python | def from_csr(directory, timeout=None, context=ssl.SSLContext(), chunk=16384, verbose=False, fid=sys.stdout, mode=509):
'\n Download satellite laser ranging (SLR) files from the\n University of Texas Center for Space Research (UTCSR)\n\n Arguments\n ---------\n directory: download directory\n\n ... | def from_csr(directory, timeout=None, context=ssl.SSLContext(), chunk=16384, verbose=False, fid=sys.stdout, mode=509):
'\n Download satellite laser ranging (SLR) files from the\n University of Texas Center for Space Research (UTCSR)\n\n Arguments\n ---------\n directory: download directory\n\n ... |
d5422cb32f97b3720a52be0f8723781df57b8ea636f12f0aa3b0882d81798f10 | def from_gfz(directory, timeout=None, chunk=8192, verbose=False, fid=sys.stdout, mode=509):
'\n Download GravIS and satellite laser ranging (SLR) files from the\n German Research Centre for Geosciences (GeoForschungsZentrum, GFZ)\n\n Arguments\n ---------\n directory: download directory\n\n Ke... | Download GravIS and satellite laser ranging (SLR) files from the
German Research Centre for Geosciences (GeoForschungsZentrum, GFZ)
Arguments
---------
directory: download directory
Keyword arguments
-----------------
timeout: timeout in seconds for blocking operations
chunk: chunk size for transfer encoding
verb... | gravity_toolkit/utilities.py | from_gfz | tsutterley/read-GRACE-harmonics | 9 | python | def from_gfz(directory, timeout=None, chunk=8192, verbose=False, fid=sys.stdout, mode=509):
'\n Download GravIS and satellite laser ranging (SLR) files from the\n German Research Centre for Geosciences (GeoForschungsZentrum, GFZ)\n\n Arguments\n ---------\n directory: download directory\n\n Ke... | def from_gfz(directory, timeout=None, chunk=8192, verbose=False, fid=sys.stdout, mode=509):
'\n Download GravIS and satellite laser ranging (SLR) files from the\n German Research Centre for Geosciences (GeoForschungsZentrum, GFZ)\n\n Arguments\n ---------\n directory: download directory\n\n Ke... |
53837a480ef89b39db8b494feb59f179e2cdea5a3832f883e11aa8c24092cb67 | def icgem_list(host='http://icgem.gfz-potsdam.de/tom_longtime', timeout=None, parser=lxml.etree.HTMLParser()):
'\n Parse the table of static gravity field models on the GFZ\n International Centre for Global Earth Models (ICGEM) server\n\n Keyword arguments\n -----------------\n host: url for the GFZ ... | Parse the table of static gravity field models on the GFZ
International Centre for Global Earth Models (ICGEM) server
Keyword arguments
-----------------
host: url for the GFZ ICGEM gravity field table
timeout: timeout in seconds for blocking operations
parser: HTML parser for lxml
Returns
-------
colfiles: dictionar... | gravity_toolkit/utilities.py | icgem_list | tsutterley/read-GRACE-harmonics | 9 | python | def icgem_list(host='http://icgem.gfz-potsdam.de/tom_longtime', timeout=None, parser=lxml.etree.HTMLParser()):
'\n Parse the table of static gravity field models on the GFZ\n International Centre for Global Earth Models (ICGEM) server\n\n Keyword arguments\n -----------------\n host: url for the GFZ ... | def icgem_list(host='http://icgem.gfz-potsdam.de/tom_longtime', timeout=None, parser=lxml.etree.HTMLParser()):
'\n Parse the table of static gravity field models on the GFZ\n International Centre for Global Earth Models (ICGEM) server\n\n Keyword arguments\n -----------------\n host: url for the GFZ ... |
6d44b868abdcc75ff1000d1ffdb71ade2282fd3d7b3194c6f913441c969df02e | def jstest_one_host(config, mongo_uri, reports_dir, current_test_id, name):
'\n Run a jstest against one host.\n\n :param dict(ConfigDict) config: The system configuration.\n :param string mongo_uri: The mongo URI of the host to check\n :param string reports_dir: the report directory.\n :param string... | Run a jstest against one host.
:param dict(ConfigDict) config: The system configuration.
:param string mongo_uri: The mongo URI of the host to check
:param string reports_dir: the report directory.
:param string current_test_id: The identifier for this test.
:param string name: The name of the jstest to run.
Valid nam... | dsi/common/jstests.py | jstest_one_host | mongodb/dsi | 9 | python | def jstest_one_host(config, mongo_uri, reports_dir, current_test_id, name):
'\n Run a jstest against one host.\n\n :param dict(ConfigDict) config: The system configuration.\n :param string mongo_uri: The mongo URI of the host to check\n :param string reports_dir: the report directory.\n :param string... | def jstest_one_host(config, mongo_uri, reports_dir, current_test_id, name):
'\n Run a jstest against one host.\n\n :param dict(ConfigDict) config: The system configuration.\n :param string mongo_uri: The mongo URI of the host to check\n :param string reports_dir: the report directory.\n :param string... |
71708066b386aa7a976a3a15d1d2b42820e7a2f16a335117ab1f8c0e68b54b90 | def validate_one_host(config, mongo_uri, reports_dir, current_test_id, replica_checks=False):
' Run the correctness tests for one host.\n If run on a replica set it is expected to be called against the primary.\n\n :param dict(ConfigDict) config: The system configuration.\n :param string mongo_uri: The mon... | Run the correctness tests for one host.
If run on a replica set it is expected to be called against the primary.
:param dict(ConfigDict) config: The system configuration.
:param string mongo_uri: The mongo URI of the host to check
:param string reports_dir: the report directory.
:param string current_test_id: The iden... | dsi/common/jstests.py | validate_one_host | mongodb/dsi | 9 | python | def validate_one_host(config, mongo_uri, reports_dir, current_test_id, replica_checks=False):
' Run the correctness tests for one host.\n If run on a replica set it is expected to be called against the primary.\n\n :param dict(ConfigDict) config: The system configuration.\n :param string mongo_uri: The mon... | def validate_one_host(config, mongo_uri, reports_dir, current_test_id, replica_checks=False):
' Run the correctness tests for one host.\n If run on a replica set it is expected to be called against the primary.\n\n :param dict(ConfigDict) config: The system configuration.\n :param string mongo_uri: The mon... |
0fb526884588a5ef79b32130a98d9f959d901123187d46361a5213d8856fa88b | def run_validate(config, current_test_id=None, reports_dir='reports'):
' Validate the DB after a test\n\n :param dict(ConfigDict) config: The system configuration.\n :param string current_test_id: Indicates the id for the test related to the current set of\n commands. If there is not a specific test relate... | Validate the DB after a test
:param dict(ConfigDict) config: The system configuration.
:param string current_test_id: Indicates the id for the test related to the current set of
commands. If there is not a specific test related to the current set of commands, the value of
current_test_id will be None.
:param string re... | dsi/common/jstests.py | run_validate | mongodb/dsi | 9 | python | def run_validate(config, current_test_id=None, reports_dir='reports'):
' Validate the DB after a test\n\n :param dict(ConfigDict) config: The system configuration.\n :param string current_test_id: Indicates the id for the test related to the current set of\n commands. If there is not a specific test relate... | def run_validate(config, current_test_id=None, reports_dir='reports'):
' Validate the DB after a test\n\n :param dict(ConfigDict) config: The system configuration.\n :param string current_test_id: Indicates the id for the test related to the current set of\n commands. If there is not a specific test relate... |
7b313c8d2387a7aa2cf02d552278b6186dfca017b70b4f7964dd0ddb44329674 | def _remote_exists(config):
'\n Check on remote workload_client whether jstests_dir exists.\n '
host_info = extract_hosts('workload_client', config)[0]
remote_host = make_host(host_info)
remote_command = ['[ -e {} ]'.format(config['test_control']['jstests_dir'])]
return remote_host.run(remote_... | Check on remote workload_client whether jstests_dir exists. | dsi/common/jstests.py | _remote_exists | mongodb/dsi | 9 | python | def _remote_exists(config):
'\n \n '
host_info = extract_hosts('workload_client', config)[0]
remote_host = make_host(host_info)
remote_command = ['[ -e {} ]'.format(config['test_control']['jstests_dir'])]
return remote_host.run(remote_command) | def _remote_exists(config):
'\n \n '
host_info = extract_hosts('workload_client', config)[0]
remote_host = make_host(host_info)
remote_command = ['[ -e {} ]'.format(config['test_control']['jstests_dir'])]
return remote_host.run(remote_command)<|docstring|>Check on remote workload_client whethe... |
550f744bb64f1a2d183e8bcac101159dbeb1ef6fb426ad64a9b9fa2c7dd13ff8 | @lower_getattr_generic(types.BaseNamedTuple)
def namedtuple_getattr(context, builder, typ, value, attr):
"\n Fetch a namedtuple's field.\n "
index = typ.fields.index(attr)
res = builder.extract_value(value, index)
return impl_ret_borrowed(context, builder, typ[index], res) | Fetch a namedtuple's field. | numba/targets/tupleobj.py | namedtuple_getattr | EnjoyLifeFund/py36pkgs | 8 | python | @lower_getattr_generic(types.BaseNamedTuple)
def namedtuple_getattr(context, builder, typ, value, attr):
"\n \n "
index = typ.fields.index(attr)
res = builder.extract_value(value, index)
return impl_ret_borrowed(context, builder, typ[index], res) | @lower_getattr_generic(types.BaseNamedTuple)
def namedtuple_getattr(context, builder, typ, value, attr):
"\n \n "
index = typ.fields.index(attr)
res = builder.extract_value(value, index)
return impl_ret_borrowed(context, builder, typ[index], res)<|docstring|>Fetch a namedtuple's field.<|endoftext|... |
e499288e80924e5e8b2e712579d25982c42e341104977e11c44546564c6c8979 | @lower_constant(types.UniTuple)
@lower_constant(types.NamedUniTuple)
def unituple_constant(context, builder, ty, pyval):
'\n Create a homogenous tuple constant.\n '
consts = [context.get_constant_generic(builder, ty.dtype, v) for v in pyval]
return ir.ArrayType(consts[0].type, len(consts))(consts) | Create a homogenous tuple constant. | numba/targets/tupleobj.py | unituple_constant | EnjoyLifeFund/py36pkgs | 8 | python | @lower_constant(types.UniTuple)
@lower_constant(types.NamedUniTuple)
def unituple_constant(context, builder, ty, pyval):
'\n \n '
consts = [context.get_constant_generic(builder, ty.dtype, v) for v in pyval]
return ir.ArrayType(consts[0].type, len(consts))(consts) | @lower_constant(types.UniTuple)
@lower_constant(types.NamedUniTuple)
def unituple_constant(context, builder, ty, pyval):
'\n \n '
consts = [context.get_constant_generic(builder, ty.dtype, v) for v in pyval]
return ir.ArrayType(consts[0].type, len(consts))(consts)<|docstring|>Create a homogenous tuple ... |
fa7693ee2cb3218709d05e17f55ed01e400533968942fd83a92e87daae020bd9 | @lower_constant(types.Tuple)
@lower_constant(types.NamedTuple)
def unituple_constant(context, builder, ty, pyval):
'\n Create a heterogenous tuple constant.\n '
consts = [context.get_constant_generic(builder, ty.types[i], v) for (i, v) in enumerate(pyval)]
return ir.Constant.literal_struct(consts) | Create a heterogenous tuple constant. | numba/targets/tupleobj.py | unituple_constant | EnjoyLifeFund/py36pkgs | 8 | python | @lower_constant(types.Tuple)
@lower_constant(types.NamedTuple)
def unituple_constant(context, builder, ty, pyval):
'\n \n '
consts = [context.get_constant_generic(builder, ty.types[i], v) for (i, v) in enumerate(pyval)]
return ir.Constant.literal_struct(consts) | @lower_constant(types.Tuple)
@lower_constant(types.NamedTuple)
def unituple_constant(context, builder, ty, pyval):
'\n \n '
consts = [context.get_constant_generic(builder, ty.types[i], v) for (i, v) in enumerate(pyval)]
return ir.Constant.literal_struct(consts)<|docstring|>Create a heterogenous tuple ... |
dbf57b70f54e8d1cb9fd66b0c9917fef1c5fc4acc3875baba2e538a004b9178b | def comp(regex: str) -> Pattern:
'Compile regular expression'
regex = regex.replace(' ', '\\s+').replace('~', '\\s*')
try:
return compile(regex, 8)
except rerror as err:
print(error_msg, 'Invalid regex')
print(err.msg)
print('Regex:', regex.replace('\n', '\\n').replace('\... | Compile regular expression | LangTrans.py | comp | LangTrans/LangTrans | 17 | python | def comp(regex: str) -> Pattern:
regex = regex.replace(' ', '\\s+').replace('~', '\\s*')
try:
return compile(regex, 8)
except rerror as err:
print(error_msg, 'Invalid regex')
print(err.msg)
print('Regex:', regex.replace('\n', '\\n').replace('\t', '\\t'))
print(((... | def comp(regex: str) -> Pattern:
regex = regex.replace(' ', '\\s+').replace('~', '\\s*')
try:
return compile(regex, 8)
except rerror as err:
print(error_msg, 'Invalid regex')
print(err.msg)
print('Regex:', regex.replace('\n', '\\n').replace('\t', '\\t'))
print(((... |
a6434348984712d46b6d3949c13340426b323b2d2d711539af3f69a5f5cb9702 | def check_collections(calls: list[str], collections: _collections) -> tuple[(str, ...)]:
'\n This function adds collections into call list.\n\n :param calls: List with collection names and part names\n :param collections: Dictionary of collections and its names\n :return: Collection replaced call list\n... | This function adds collections into call list.
:param calls: List with collection names and part names
:param collections: Dictionary of collections and its names
:return: Collection replaced call list | LangTrans.py | check_collections | LangTrans/LangTrans | 17 | python | def check_collections(calls: list[str], collections: _collections) -> tuple[(str, ...)]:
'\n This function adds collections into call list.\n\n :param calls: List with collection names and part names\n :param collections: Dictionary of collections and its names\n :return: Collection replaced call list\n... | def check_collections(calls: list[str], collections: _collections) -> tuple[(str, ...)]:
'\n This function adds collections into call list.\n\n :param calls: List with collection names and part names\n :param collections: Dictionary of collections and its names\n :return: Collection replaced call list\n... |
4c5f6dbea2eac929a414050b8477e2aa763f91928b56710e8cda8e718cef6662 | def tknoptions(sdef: dict[(str, Any)], collections: _collections, variables: _var) -> tuple[(_unmatches, dict[(str, str)], tuple[(_tknopts, Optional[tuple[(str, ...)]])])]:
'\n This function extracts token options from a yaml file.\n\n :param sdef: Contains token options.\n :param collections: Dictionary o... | This function extracts token options from a yaml file.
:param sdef: Contains token options.
:param collections: Dictionary of collections and their names.
:return: unmatches, default values, translation options and next call list. | LangTrans.py | tknoptions | LangTrans/LangTrans | 17 | python | def tknoptions(sdef: dict[(str, Any)], collections: _collections, variables: _var) -> tuple[(_unmatches, dict[(str, str)], tuple[(_tknopts, Optional[tuple[(str, ...)]])])]:
'\n This function extracts token options from a yaml file.\n\n :param sdef: Contains token options.\n :param collections: Dictionary o... | def tknoptions(sdef: dict[(str, Any)], collections: _collections, variables: _var) -> tuple[(_unmatches, dict[(str, str)], tuple[(_tknopts, Optional[tuple[(str, ...)]])])]:
'\n This function extracts token options from a yaml file.\n\n :param sdef: Contains token options.\n :param collections: Dictionary o... |
a92107e99e1194b04e7272715f30351427af89144a82cfb1e5bdc696602f7adc | def addvar(variables: _var, rv: str):
'\n This function replaces <varname> with its value.\n\n :param variables: Dictionary of variables.\n :param rv: String containing <varname>.\n :return: variable replaced string.\n '
for (varname, value) in reversed(variables.items()):
rv = rv.replace... | This function replaces <varname> with its value.
:param variables: Dictionary of variables.
:param rv: String containing <varname>.
:return: variable replaced string. | LangTrans.py | addvar | LangTrans/LangTrans | 17 | python | def addvar(variables: _var, rv: str):
'\n This function replaces <varname> with its value.\n\n :param variables: Dictionary of variables.\n :param rv: String containing <varname>.\n :return: variable replaced string.\n '
for (varname, value) in reversed(variables.items()):
rv = rv.replace... | def addvar(variables: _var, rv: str):
'\n This function replaces <varname> with its value.\n\n :param variables: Dictionary of variables.\n :param rv: String containing <varname>.\n :return: variable replaced string.\n '
for (varname, value) in reversed(variables.items()):
rv = rv.replace... |
804de39ef7d59f7c152feaf8d711a29eb5ca31d977aa4f6d23f7347c7bcb4571 | def comp_err(name: str, variables: _var) -> tuple[(dict[(str, err_dict)], _outside)]:
'\n Compiling regexes in an error file.\n\n :param name: Name of errfile.\n :param variables: Global variables.\n :return: compiled error inside and outside part.\n '
errors_def = load_yaml(name)
outside = {... | Compiling regexes in an error file.
:param name: Name of errfile.
:param variables: Global variables.
:return: compiled error inside and outside part. | LangTrans.py | comp_err | LangTrans/LangTrans | 17 | python | def comp_err(name: str, variables: _var) -> tuple[(dict[(str, err_dict)], _outside)]:
'\n Compiling regexes in an error file.\n\n :param name: Name of errfile.\n :param variables: Global variables.\n :return: compiled error inside and outside part.\n '
errors_def = load_yaml(name)
outside = {... | def comp_err(name: str, variables: _var) -> tuple[(dict[(str, err_dict)], _outside)]:
'\n Compiling regexes in an error file.\n\n :param name: Name of errfile.\n :param variables: Global variables.\n :return: compiled error inside and outside part.\n '
errors_def = load_yaml(name)
outside = {... |
a0d4283128a889c6b8c0a2265578f5ca58580a316df0f2d04160b63d1b28d8e9 | def extract(spattern: _any) -> tuple[(_after, tuple[(_match_options, _trans_options, _outside)])]:
'\n This function extracts contents needed from yaml file with regex.\n\n :param spattern: Dictionary with yaml file details.\n :return: after command and (match options, token options).\n '
variables ... | This function extracts contents needed from yaml file with regex.
:param spattern: Dictionary with yaml file details.
:return: after command and (match options, token options). | LangTrans.py | extract | LangTrans/LangTrans | 17 | python | def extract(spattern: _any) -> tuple[(_after, tuple[(_match_options, _trans_options, _outside)])]:
'\n This function extracts contents needed from yaml file with regex.\n\n :param spattern: Dictionary with yaml file details.\n :return: after command and (match options, token options).\n '
variables ... | def extract(spattern: _any) -> tuple[(_after, tuple[(_match_options, _trans_options, _outside)])]:
'\n This function extracts contents needed from yaml file with regex.\n\n :param spattern: Dictionary with yaml file details.\n :return: after command and (match options, token options).\n '
variables ... |
c1c2cae732660c730503323fe23db7a484663591a82f18fc2d0a81fc65fb5713 | def err_report(part: str, msg: str, name: str, match: Match, tkns: dict, content: str, matchstr: str):
'Shows error messages for Syntax Errors.'
(pos, l, indexed) = getotalines(content.splitlines(), matchstr)
err_part = match.group()
if part:
print(f'[{((Fore.MAGENTA + part) + Fore.RESET)}]')
... | Shows error messages for Syntax Errors. | LangTrans.py | err_report | LangTrans/LangTrans | 17 | python | def err_report(part: str, msg: str, name: str, match: Match, tkns: dict, content: str, matchstr: str):
(pos, l, indexed) = getotalines(content.splitlines(), matchstr)
err_part = match.group()
if part:
print(f'[{((Fore.MAGENTA + part) + Fore.RESET)}]')
line = indexed[0].lstrip()
lineno =... | def err_report(part: str, msg: str, name: str, match: Match, tkns: dict, content: str, matchstr: str):
(pos, l, indexed) = getotalines(content.splitlines(), matchstr)
err_part = match.group()
if part:
print(f'[{((Fore.MAGENTA + part) + Fore.RESET)}]')
line = indexed[0].lstrip()
lineno =... |
6cc5497f82c551c969641d170bdb9c3b0c367e18c8757e76e3a98cab3a6662a5 | def matching(content: str, match_options: _match_options, isrecursion: bool) -> dict[(str, list[tuple[(str, dict[(str, str)])]])]:
'\n Matches parts of source code.\n\n :param content: source code.\n :param match_options: Options for each part in yaml file.\n :param isrecursion: Boolean to find if the c... | Matches parts of source code.
:param content: source code.
:param match_options: Options for each part in yaml file.
:param isrecursion: Boolean to find if the convert function is in recursion or not.
:return: Return matched parts and tokens. | LangTrans.py | matching | LangTrans/LangTrans | 17 | python | def matching(content: str, match_options: _match_options, isrecursion: bool) -> dict[(str, list[tuple[(str, dict[(str, str)])]])]:
'\n Matches parts of source code.\n\n :param content: source code.\n :param match_options: Options for each part in yaml file.\n :param isrecursion: Boolean to find if the c... | def matching(content: str, match_options: _match_options, isrecursion: bool) -> dict[(str, list[tuple[(str, dict[(str, str)])]])]:
'\n Matches parts of source code.\n\n :param content: source code.\n :param match_options: Options for each part in yaml file.\n :param isrecursion: Boolean to find if the c... |
1e763e7f6d197e75e5a96b34eef8dd50afc272ffa6a35c0ddee178f1c04e4bd7 | def outside_err(outside: _outside, content: str):
'Find syntax errors in the source code and show error messages.'
for (part, errors) in outside.items():
for (name, error) in errors.items():
err_match = error['regex'].search(content)
if err_match:
err_report(part,... | Find syntax errors in the source code and show error messages. | LangTrans.py | outside_err | LangTrans/LangTrans | 17 | python | def outside_err(outside: _outside, content: str):
for (part, errors) in outside.items():
for (name, error) in errors.items():
err_match = error['regex'].search(content)
if err_match:
err_report(part, error.get('msg', ), name, err_match, {}, content, err_match.gro... | def outside_err(outside: _outside, content: str):
for (part, errors) in outside.items():
for (name, error) in errors.items():
err_match = error['regex'].search(content)
if err_match:
err_report(part, error.get('msg', ), name, err_match, {}, content, err_match.gro... |
50b416d8db0eb2faba9d18b43abfe53544b7a2b60d4e2de482888ea40137ca94 | def convert(yaml_details: _yaml_details, content: str, isrecursion: bool=False, donly: Union[tuple[(str, ...)]]=()):
'\n This is the main function that converts new syntax to orignal syntax.\n\n :param content: Code with the new syntax.\n :param yaml_details: Details extracted from yaml files.\n :param ... | This is the main function that converts new syntax to orignal syntax.
:param content: Code with the new syntax.
:param yaml_details: Details extracted from yaml files.
:param isrecursion: A flag to check if there is a recursion call or not.
:param donly: parts that should only be converted(used during part calling).
:... | LangTrans.py | convert | LangTrans/LangTrans | 17 | python | def convert(yaml_details: _yaml_details, content: str, isrecursion: bool=False, donly: Union[tuple[(str, ...)]]=()):
'\n This is the main function that converts new syntax to orignal syntax.\n\n :param content: Code with the new syntax.\n :param yaml_details: Details extracted from yaml files.\n :param ... | def convert(yaml_details: _yaml_details, content: str, isrecursion: bool=False, donly: Union[tuple[(str, ...)]]=()):
'\n This is the main function that converts new syntax to orignal syntax.\n\n :param content: Code with the new syntax.\n :param yaml_details: Details extracted from yaml files.\n :param ... |
29e9b2565da8b63e570148c5a56856141dc8a5f870e7b987e258fae795eae682 | def getotalines(lines: list[str], substring: str):
'Find line in which the substring is located.'
sublines = substring.splitlines()
sublen = len(sublines)
for (pos, line) in enumerate(lines):
if (sublines[0] in line):
if (pos >= (len(lines) - sublen)):
return
... | Find line in which the substring is located. | LangTrans.py | getotalines | LangTrans/LangTrans | 17 | python | def getotalines(lines: list[str], substring: str):
sublines = substring.splitlines()
sublen = len(sublines)
for (pos, line) in enumerate(lines):
if (sublines[0] in line):
if (pos >= (len(lines) - sublen)):
return
indexed = lines[pos:(pos + sublen)]
... | def getotalines(lines: list[str], substring: str):
sublines = substring.splitlines()
sublen = len(sublines)
for (pos, line) in enumerate(lines):
if (sublines[0] in line):
if (pos >= (len(lines) - sublen)):
return
indexed = lines[pos:(pos + sublen)]
... |
8a4e3d171f4f8e0b2f3d0676a2bdb8a274aaf65212855bace8cd8ad7571b97d2 | def load_yaml(file: str) -> dict[(str, Any)]:
'\n Loads yaml files.\n\n :param file: The base filename.\n :return: Yaml Details.\n '
from yaml import load, SafeLoader
from yaml.scanner import ScannerError
from yaml.parser import ParserError
file += '.yaml'
try:
return load(op... | Loads yaml files.
:param file: The base filename.
:return: Yaml Details. | LangTrans.py | load_yaml | LangTrans/LangTrans | 17 | python | def load_yaml(file: str) -> dict[(str, Any)]:
'\n Loads yaml files.\n\n :param file: The base filename.\n :return: Yaml Details.\n '
from yaml import load, SafeLoader
from yaml.scanner import ScannerError
from yaml.parser import ParserError
file += '.yaml'
try:
return load(op... | def load_yaml(file: str) -> dict[(str, Any)]:
'\n Loads yaml files.\n\n :param file: The base filename.\n :return: Yaml Details.\n '
from yaml import load, SafeLoader
from yaml.scanner import ScannerError
from yaml.parser import ParserError
file += '.yaml'
try:
return load(op... |
5804e87580e9d7688a4e825645ee696c909433200fcbc533b0cb77b60b4e14af | def grab(source: str, target: str) -> tuple[(_after, _yaml_details)]:
'\n Gets details from source and target yaml files.\n\n :param argv: Array of arguments.\n :param l: Location of the argument needed.\n :return: The after command and yaml details.\n '
spattern = load_yaml(source)
tpattern ... | Gets details from source and target yaml files.
:param argv: Array of arguments.
:param l: Location of the argument needed.
:return: The after command and yaml details. | LangTrans.py | grab | LangTrans/LangTrans | 17 | python | def grab(source: str, target: str) -> tuple[(_after, _yaml_details)]:
'\n Gets details from source and target yaml files.\n\n :param argv: Array of arguments.\n :param l: Location of the argument needed.\n :return: The after command and yaml details.\n '
spattern = load_yaml(source)
tpattern ... | def grab(source: str, target: str) -> tuple[(_after, _yaml_details)]:
'\n Gets details from source and target yaml files.\n\n :param argv: Array of arguments.\n :param l: Location of the argument needed.\n :return: The after command and yaml details.\n '
spattern = load_yaml(source)
tpattern ... |
08ccd58a38b21fc50bfd68917a605bce156a22dc57a599c3a6923f3d48e9c678 | def grab_var(file: str) -> _var:
'\n Load variables from external file.\n\n :param file: Address of the external file.\n :return: Dictionary of variables.\n '
variables = {}
try:
v = load_yaml(file)
if (v is not None):
variables.update(v)
except ValueError:
... | Load variables from external file.
:param file: Address of the external file.
:return: Dictionary of variables. | LangTrans.py | grab_var | LangTrans/LangTrans | 17 | python | def grab_var(file: str) -> _var:
'\n Load variables from external file.\n\n :param file: Address of the external file.\n :return: Dictionary of variables.\n '
variables = {}
try:
v = load_yaml(file)
if (v is not None):
variables.update(v)
except ValueError:
... | def grab_var(file: str) -> _var:
'\n Load variables from external file.\n\n :param file: Address of the external file.\n :return: Dictionary of variables.\n '
variables = {}
try:
v = load_yaml(file)
if (v is not None):
variables.update(v)
except ValueError:
... |
b7b0d7ac3395b289c2c68f3a9be4788c4eef3b25032625b0db4195068e2d6118 | def get_ltz(filename: str) -> tuple[(_after, _yaml_details)]:
'Load compiled yaml_details in the format .ltz'
from pickle import load
try:
return load(open((filename + '.ltz'), 'rb'))
except FileNotFoundError as err:
exit(f'{error_msg} {err.filename} not found') | Load compiled yaml_details in the format .ltz | LangTrans.py | get_ltz | LangTrans/LangTrans | 17 | python | def get_ltz(filename: str) -> tuple[(_after, _yaml_details)]:
from pickle import load
try:
return load(open((filename + '.ltz'), 'rb'))
except FileNotFoundError as err:
exit(f'{error_msg} {err.filename} not found') | def get_ltz(filename: str) -> tuple[(_after, _yaml_details)]:
from pickle import load
try:
return load(open((filename + '.ltz'), 'rb'))
except FileNotFoundError as err:
exit(f'{error_msg} {err.filename} not found')<|docstring|>Load compiled yaml_details in the format .ltz<|endoftext|> |
75a33ceb74780271d26efe9d4dfddc06f4bb55387565d1cb3d418c37811f7246 | def doc(file: str):
'\n Prints documentation of the part in yaml file.\n CommandLine: python langtrans.py -d source\n\n :param file: Address of the file.\n '
yaml = load_yaml(file)
if ('settings' in yaml):
settings = yaml['settings']
if ('lang' in settings):
print('La... | Prints documentation of the part in yaml file.
CommandLine: python langtrans.py -d source
:param file: Address of the file. | LangTrans.py | doc | LangTrans/LangTrans | 17 | python | def doc(file: str):
'\n Prints documentation of the part in yaml file.\n CommandLine: python langtrans.py -d source\n\n :param file: Address of the file.\n '
yaml = load_yaml(file)
if ('settings' in yaml):
settings = yaml['settings']
if ('lang' in settings):
print('La... | def doc(file: str):
'\n Prints documentation of the part in yaml file.\n CommandLine: python langtrans.py -d source\n\n :param file: Address of the file.\n '
yaml = load_yaml(file)
if ('settings' in yaml):
settings = yaml['settings']
if ('lang' in settings):
print('La... |
afb144c95e1692c22875f4db9b17cfb027492ea1ab71d5de7327e8a3b3837d72 | def get_user_by_display_name(self, display_name) -> User:
'Retrieves a `User` representation by display_name.'
result = self.session.query(UserModel).filter_by(display_name=display_name).one_or_none()
if (result is None):
raise EntityNotFound(f'User: {display_name} does not exist')
return self.s... | Retrieves a `User` representation by display_name. | server/runcible/api/user/manager.py | get_user_by_display_name | androiddrew/runcible | 0 | python | def get_user_by_display_name(self, display_name) -> User:
result = self.session.query(UserModel).filter_by(display_name=display_name).one_or_none()
if (result is None):
raise EntityNotFound(f'User: {display_name} does not exist')
return self.schema_from_model(result) | def get_user_by_display_name(self, display_name) -> User:
result = self.session.query(UserModel).filter_by(display_name=display_name).one_or_none()
if (result is None):
raise EntityNotFound(f'User: {display_name} does not exist')
return self.schema_from_model(result)<|docstring|>Retrieves a `Us... |
b58b926b588012ea6c0a176624679bc909d498d3ecf1ab02b761589e3184c8bf | def create_user(self, user: User) -> User:
'Creates a new `User` resource and returns its representation'
user_model = self.model_from_schema(user)
self.session.add(user_model)
self.session.flush()
return self.schema_from_model(user_model) | Creates a new `User` resource and returns its representation | server/runcible/api/user/manager.py | create_user | androiddrew/runcible | 0 | python | def create_user(self, user: User) -> User:
user_model = self.model_from_schema(user)
self.session.add(user_model)
self.session.flush()
return self.schema_from_model(user_model) | def create_user(self, user: User) -> User:
user_model = self.model_from_schema(user)
self.session.add(user_model)
self.session.flush()
return self.schema_from_model(user_model)<|docstring|>Creates a new `User` resource and returns its representation<|endoftext|> |
178777b77aa4d760e8b7374df9f194f3c67a38f96ab252856b25805ad831c1f1 | def TradeList(self):
'获取交易条数'
return self.invoke['response']['total_results'] | 获取交易条数 | handlers/SaveOrder.py | TradeList | fovegage/python3-youzan-pay | 15 | python | def TradeList(self):
return self.invoke['response']['total_results'] | def TradeList(self):
return self.invoke['response']['total_results']<|docstring|>获取交易条数<|endoftext|> |
8827c033e51f0edec71382bacefc6acc6dd3e61b1d2d741887a1dffb02480e9a | def JudgePay(self):
'获取指定的交易信息'
return [i for i in self.invoke['response']['qr_trades'] if (i['qr_id'] == self.qr_id)] | 获取指定的交易信息 | handlers/SaveOrder.py | JudgePay | fovegage/python3-youzan-pay | 15 | python | def JudgePay(self):
return [i for i in self.invoke['response']['qr_trades'] if (i['qr_id'] == self.qr_id)] | def JudgePay(self):
return [i for i in self.invoke['response']['qr_trades'] if (i['qr_id'] == self.qr_id)]<|docstring|>获取指定的交易信息<|endoftext|> |
792b9c27a346aa0d6bdc4b9eabbd2b2a2094e3a12f4bbef759bd0618d436aff5 | def ListPay(self):
'获取全部交易列表'
return self.invoke['response']['qr_trades'] | 获取全部交易列表 | handlers/SaveOrder.py | ListPay | fovegage/python3-youzan-pay | 15 | python | def ListPay(self):
return self.invoke['response']['qr_trades'] | def ListPay(self):
return self.invoke['response']['qr_trades']<|docstring|>获取全部交易列表<|endoftext|> |
60b297fd651ad3b1b5933636748518e3c25fc29c9bd94e032e9a67b894a56d17 | def GetTid(self):
'根据qr_id查询tid,如果tradelist长度为0说明未扫码'
tradelist = [i for i in self.invoke['response']['qr_trades'] if (i['qr_id'] == self.qr_id)]
if (len(tradelist) == 0):
return 0
else:
return tradelist[0]['tid'] | 根据qr_id查询tid,如果tradelist长度为0说明未扫码 | handlers/SaveOrder.py | GetTid | fovegage/python3-youzan-pay | 15 | python | def GetTid(self):
tradelist = [i for i in self.invoke['response']['qr_trades'] if (i['qr_id'] == self.qr_id)]
if (len(tradelist) == 0):
return 0
else:
return tradelist[0]['tid'] | def GetTid(self):
tradelist = [i for i in self.invoke['response']['qr_trades'] if (i['qr_id'] == self.qr_id)]
if (len(tradelist) == 0):
return 0
else:
return tradelist[0]['tid']<|docstring|>根据qr_id查询tid,如果tradelist长度为0说明未扫码<|endoftext|> |
cc687fbf317aac40f8b156db7f534dc0d767f36bdba37840db86f5beb8e468eb | def authenticate():
'Handles authentication with twitter API. Returns api object.'
auth = tweepy.OAuthHandler('INSERT CONSUMER KEY', 'INSERT CONSUMER SECRET')
auth.set_access_token('INSERT ACCESS TOKEN', 'INSERT ACCESS TOKEN SECRET')
api = tweepy.API(auth)
return api | Handles authentication with twitter API. Returns api object. | twitter/twitter_wordcloud.py | authenticate | MahmoudDolah/wordclouds | 0 | python | def authenticate():
auth = tweepy.OAuthHandler('INSERT CONSUMER KEY', 'INSERT CONSUMER SECRET')
auth.set_access_token('INSERT ACCESS TOKEN', 'INSERT ACCESS TOKEN SECRET')
api = tweepy.API(auth)
return api | def authenticate():
auth = tweepy.OAuthHandler('INSERT CONSUMER KEY', 'INSERT CONSUMER SECRET')
auth.set_access_token('INSERT ACCESS TOKEN', 'INSERT ACCESS TOKEN SECRET')
api = tweepy.API(auth)
return api<|docstring|>Handles authentication with twitter API. Returns api object.<|endoftext|> |
0888f4ad684392e680c680de3c26eaa0963e04b02ce10071ef2b409d7346c8ce | def get_all_tweets(api):
'Gets last 200 tweets and returns them in a list'
user_handle = input('Enter twitter handle of user: ')
all_tweets = api.user_timeline(screen_name=str(user_handle), count=200)
return all_tweets | Gets last 200 tweets and returns them in a list | twitter/twitter_wordcloud.py | get_all_tweets | MahmoudDolah/wordclouds | 0 | python | def get_all_tweets(api):
user_handle = input('Enter twitter handle of user: ')
all_tweets = api.user_timeline(screen_name=str(user_handle), count=200)
return all_tweets | def get_all_tweets(api):
user_handle = input('Enter twitter handle of user: ')
all_tweets = api.user_timeline(screen_name=str(user_handle), count=200)
return all_tweets<|docstring|>Gets last 200 tweets and returns them in a list<|endoftext|> |
f3c9a962ad55df2c6a440fe32a9f0b5a9db74808d6610dad7d30772c3714a2e1 | def parse_out_urls(all_tweets):
"Parses out url related words/phrases like 'http', etc."
for tweet in all_tweets:
for word in URL_WORDS:
if (word in tweet.text):
tweet.text = tweet.text.replace(word, '')
return all_tweets | Parses out url related words/phrases like 'http', etc. | twitter/twitter_wordcloud.py | parse_out_urls | MahmoudDolah/wordclouds | 0 | python | def parse_out_urls(all_tweets):
for tweet in all_tweets:
for word in URL_WORDS:
if (word in tweet.text):
tweet.text = tweet.text.replace(word, )
return all_tweets | def parse_out_urls(all_tweets):
for tweet in all_tweets:
for word in URL_WORDS:
if (word in tweet.text):
tweet.text = tweet.text.replace(word, )
return all_tweets<|docstring|>Parses out url related words/phrases like 'http', etc.<|endoftext|> |
760f3242bcdc3ce886690af4413b423cc4044be53ec0fcb61563a1dd04fc8943 | def make_word_cloud(all_tweets):
'Creates word cloud and outputs image'
tweets = ''
for tweet in all_tweets:
tweets = ((tweets + str(tweet.text)) + ' ')
cloud = WordCloud().generate(tweets)
pylt.imshow(cloud)
pylt.axis('off')
pylt.show() | Creates word cloud and outputs image | twitter/twitter_wordcloud.py | make_word_cloud | MahmoudDolah/wordclouds | 0 | python | def make_word_cloud(all_tweets):
tweets =
for tweet in all_tweets:
tweets = ((tweets + str(tweet.text)) + ' ')
cloud = WordCloud().generate(tweets)
pylt.imshow(cloud)
pylt.axis('off')
pylt.show() | def make_word_cloud(all_tweets):
tweets =
for tweet in all_tweets:
tweets = ((tweets + str(tweet.text)) + ' ')
cloud = WordCloud().generate(tweets)
pylt.imshow(cloud)
pylt.axis('off')
pylt.show()<|docstring|>Creates word cloud and outputs image<|endoftext|> |
cfd61e9048336cfbb76b5295f20e3fc0b9c20a35c8699214d25fae0f7efd8ca9 | def __init__(self, inp, n_outp, n_blocks, length, m_1, padding, unit_type, sigmoid_outp):
'\n\t\tArgument/s:\n\t\t\tinp - input placeholder.\n\t\t\tn_outp - number of output nodes.\n\t\t\tn_blocks - number of bottlekneck residual blocks.\n\t\t\tlength - length of the RDL block.\n\t\t\tm_1 - output size at h = 1.\n\... | Argument/s:
inp - input placeholder.
n_outp - number of output nodes.
n_blocks - number of bottlekneck residual blocks.
length - length of the RDL block.
m_1 - output size at h = 1.
padding - padding type.
unit_type - convolutional unit type.
sigmoid_outp ... | Final-Flask-App/DeepXi-master/deepxi/network/rdlnet.py | __init__ | ethan-lewis3927/4B_Speaker_Verification | 0 | python | def __init__(self, inp, n_outp, n_blocks, length, m_1, padding, unit_type, sigmoid_outp):
'\n\t\tArgument/s:\n\t\t\tinp - input placeholder.\n\t\t\tn_outp - number of output nodes.\n\t\t\tn_blocks - number of bottlekneck residual blocks.\n\t\t\tlength - length of the RDL block.\n\t\t\tm_1 - output size at h = 1.\n\... | def __init__(self, inp, n_outp, n_blocks, length, m_1, padding, unit_type, sigmoid_outp):
'\n\t\tArgument/s:\n\t\t\tinp - input placeholder.\n\t\t\tn_outp - number of output nodes.\n\t\t\tn_blocks - number of bottlekneck residual blocks.\n\t\t\tlength - length of the RDL block.\n\t\t\tm_1 - output size at h = 1.\n\... |
ad454e7063e47b8a8a0ea35868b2e2e15eaf736e9c53aea9f5e21084dbcc22b8 | def block(self, inp):
'\n\t\tRDL block.\n\n\t\tArgument/s:\n\t\t\tinp - input placeholder.\n\n\t\tReturns:\n\t\t\tresidual - output of block.\n\t\t'
block = [([None] * self.length) for i in range(self.height)]
for l in range(self.midpoint):
for h in range(self.height):
if (l == (self.mid... | RDL block.
Argument/s:
inp - input placeholder.
Returns:
residual - output of block. | Final-Flask-App/DeepXi-master/deepxi/network/rdlnet.py | block | ethan-lewis3927/4B_Speaker_Verification | 0 | python | def block(self, inp):
'\n\t\tRDL block.\n\n\t\tArgument/s:\n\t\t\tinp - input placeholder.\n\n\t\tReturns:\n\t\t\tresidual - output of block.\n\t\t'
block = [([None] * self.length) for i in range(self.height)]
for l in range(self.midpoint):
for h in range(self.height):
if (l == (self.mid... | def block(self, inp):
'\n\t\tRDL block.\n\n\t\tArgument/s:\n\t\t\tinp - input placeholder.\n\n\t\tReturns:\n\t\t\tresidual - output of block.\n\t\t'
block = [([None] * self.length) for i in range(self.height)]
for l in range(self.midpoint):
for h in range(self.height):
if (l == (self.mid... |
5cb2aea75e33df881e7e52d65b8f6b78ef6df4185cefc4896b023f9fe602cf14 | def weighted_residual(self, x, y):
'\n\t\tWeighted residual link. Larger input will be projected to the smaller\n\t\tinput size.\n\n\t\tArgument/s:\n\t\t\tx - tensor.\n\t\t\ty - tensor.\n\n\t\tReturns:\n\t\t\tweighted residual link.\n\t\t'
x_dims = x.get_shape().as_list()[(- 1)]
y_dims = y.get_shape().as_li... | Weighted residual link. Larger input will be projected to the smaller
input size.
Argument/s:
x - tensor.
y - tensor.
Returns:
weighted residual link. | Final-Flask-App/DeepXi-master/deepxi/network/rdlnet.py | weighted_residual | ethan-lewis3927/4B_Speaker_Verification | 0 | python | def weighted_residual(self, x, y):
'\n\t\tWeighted residual link. Larger input will be projected to the smaller\n\t\tinput size.\n\n\t\tArgument/s:\n\t\t\tx - tensor.\n\t\t\ty - tensor.\n\n\t\tReturns:\n\t\t\tweighted residual link.\n\t\t'
x_dims = x.get_shape().as_list()[(- 1)]
y_dims = y.get_shape().as_li... | def weighted_residual(self, x, y):
'\n\t\tWeighted residual link. Larger input will be projected to the smaller\n\t\tinput size.\n\n\t\tArgument/s:\n\t\t\tx - tensor.\n\t\t\ty - tensor.\n\n\t\tReturns:\n\t\t\tweighted residual link.\n\t\t'
x_dims = x.get_shape().as_list()[(- 1)]
y_dims = y.get_shape().as_li... |
6565dc3b25dcacc6b0d995e066de2478c480a27b1fffe6f7ae981776092f8b12 | def unit(self, inp, n_filt, k, d_rate):
'\n\t\tConvolutional unit.\n\n\t\tArgument/s:\n\t\t\tinp - input placeholder.\n\t\t\tn_filt - filter size.\n\t\t\tk - kernel size.\n\t\t\td_rate - dilation rate.\n\n\t\tReturns:\n\t\t\tconv - output of unit.\n\t\t'
if (self.unit_type == 'scale*LN+center->ReLU->W+b'):
... | Convolutional unit.
Argument/s:
inp - input placeholder.
n_filt - filter size.
k - kernel size.
d_rate - dilation rate.
Returns:
conv - output of unit. | Final-Flask-App/DeepXi-master/deepxi/network/rdlnet.py | unit | ethan-lewis3927/4B_Speaker_Verification | 0 | python | def unit(self, inp, n_filt, k, d_rate):
'\n\t\tConvolutional unit.\n\n\t\tArgument/s:\n\t\t\tinp - input placeholder.\n\t\t\tn_filt - filter size.\n\t\t\tk - kernel size.\n\t\t\td_rate - dilation rate.\n\n\t\tReturns:\n\t\t\tconv - output of unit.\n\t\t'
if (self.unit_type == 'scale*LN+center->ReLU->W+b'):
... | def unit(self, inp, n_filt, k, d_rate):
'\n\t\tConvolutional unit.\n\n\t\tArgument/s:\n\t\t\tinp - input placeholder.\n\t\t\tn_filt - filter size.\n\t\t\tk - kernel size.\n\t\t\td_rate - dilation rate.\n\n\t\tReturns:\n\t\t\tconv - output of unit.\n\t\t'
if (self.unit_type == 'scale*LN+center->ReLU->W+b'):
... |
8454530675ec8474171806dfb686c1be9401787cd8b4e257aac8e5e47bd0d4cf | def SVM_HOG_TRAIN(DATA_TRAIN, model_place='exp2.model', loglevel='DEBUG'):
"\n 使用SVM+HOG进行训练.\n\n Args:\n DATA_TRAIN (str): 训练集地址.\n model_place (str, optional): 模型存储的位置. Defaults to 'exp2.model'.\n loglevel (str, optional): log输出的级别,'DEBUG'即全输出,'INFO'即无输出. Defaults to 'DEBUG'.\n "
... | 使用SVM+HOG进行训练.
Args:
DATA_TRAIN (str): 训练集地址.
model_place (str, optional): 模型存储的位置. Defaults to 'exp2.model'.
loglevel (str, optional): log输出的级别,'DEBUG'即全输出,'INFO'即无输出. Defaults to 'DEBUG'. | exp2/svm_hog.py | SVM_HOG_TRAIN | BobAnkh/THUEE_ROBOTS | 1 | python | def SVM_HOG_TRAIN(DATA_TRAIN, model_place='exp2.model', loglevel='DEBUG'):
"\n 使用SVM+HOG进行训练.\n\n Args:\n DATA_TRAIN (str): 训练集地址.\n model_place (str, optional): 模型存储的位置. Defaults to 'exp2.model'.\n loglevel (str, optional): log输出的级别,'DEBUG'即全输出,'INFO'即无输出. Defaults to 'DEBUG'.\n "
... | def SVM_HOG_TRAIN(DATA_TRAIN, model_place='exp2.model', loglevel='DEBUG'):
"\n 使用SVM+HOG进行训练.\n\n Args:\n DATA_TRAIN (str): 训练集地址.\n model_place (str, optional): 模型存储的位置. Defaults to 'exp2.model'.\n loglevel (str, optional): log输出的级别,'DEBUG'即全输出,'INFO'即无输出. Defaults to 'DEBUG'.\n "
... |
57c754b881ced5fa74fb72fb0764760a2baffc7646c942d3788297eda15050b2 | def SVM_HOG_TEST(DATA_TEST, model_place='exp2.model', loglevel='DEBUG'):
"\n 使用训练好的模型进行测试,返回测试类别名称.\n\n Args:\n DATA_TEST (str): 测试集地址.\n model_place (str, optional): 模型存储的位置. Defaults to 'exp2.model'.\n loglevel (str, optional): log输出的级别,'DEBUG'即全输出,'INFO'即无输出. Defaults to 'DEBUG'.\n\n ... | 使用训练好的模型进行测试,返回测试类别名称.
Args:
DATA_TEST (str): 测试集地址.
model_place (str, optional): 模型存储的位置. Defaults to 'exp2.model'.
loglevel (str, optional): log输出的级别,'DEBUG'即全输出,'INFO'即无输出. Defaults to 'DEBUG'.
Returns:
dict: 字典结构(json)的测试图片及其类别名称. | exp2/svm_hog.py | SVM_HOG_TEST | BobAnkh/THUEE_ROBOTS | 1 | python | def SVM_HOG_TEST(DATA_TEST, model_place='exp2.model', loglevel='DEBUG'):
"\n 使用训练好的模型进行测试,返回测试类别名称.\n\n Args:\n DATA_TEST (str): 测试集地址.\n model_place (str, optional): 模型存储的位置. Defaults to 'exp2.model'.\n loglevel (str, optional): log输出的级别,'DEBUG'即全输出,'INFO'即无输出. Defaults to 'DEBUG'.\n\n ... | def SVM_HOG_TEST(DATA_TEST, model_place='exp2.model', loglevel='DEBUG'):
"\n 使用训练好的模型进行测试,返回测试类别名称.\n\n Args:\n DATA_TEST (str): 测试集地址.\n model_place (str, optional): 模型存储的位置. Defaults to 'exp2.model'.\n loglevel (str, optional): log输出的级别,'DEBUG'即全输出,'INFO'即无输出. Defaults to 'DEBUG'.\n\n ... |
222339d52d89ba4def13ae1aa80dd7cf92ac87f41e3d03f15ff27664291b8dea | def __init__(self):
'Constructeur de la commande'
Commande.__init__(self, 'cuisiner', 'cook')
self.schema = ''
self.aide_courte = 'permet de cuire un plat'
self.aide_longue = '' | Constructeur de la commande | src/secondaires/cuisine/commandes/cuisiner/__init__.py | __init__ | stormi/tsunami | 0 | python | def __init__(self):
Commande.__init__(self, 'cuisiner', 'cook')
self.schema =
self.aide_courte = 'permet de cuire un plat'
self.aide_longue = | def __init__(self):
Commande.__init__(self, 'cuisiner', 'cook')
self.schema =
self.aide_courte = 'permet de cuire un plat'
self.aide_longue = <|docstring|>Constructeur de la commande<|endoftext|> |
7c2d5db8c4d96bada38e789869ea25e2c396edb0b334bd92ac02b947ba13b05b | def interpreter(self, personnage, dic_masques):
'Interprétation de la commande'
ustensile = None
for (objet, qtt, t_conteneur) in personnage.equipement.inventaire.iter_objets_qtt(conteneur=True):
if (objet.est_de_type('ustensile') and objet.nourriture):
ustensile = objet
cont... | Interprétation de la commande | src/secondaires/cuisine/commandes/cuisiner/__init__.py | interpreter | stormi/tsunami | 0 | python | def interpreter(self, personnage, dic_masques):
ustensile = None
for (objet, qtt, t_conteneur) in personnage.equipement.inventaire.iter_objets_qtt(conteneur=True):
if (objet.est_de_type('ustensile') and objet.nourriture):
ustensile = objet
conteneur = t_conteneur
... | def interpreter(self, personnage, dic_masques):
ustensile = None
for (objet, qtt, t_conteneur) in personnage.equipement.inventaire.iter_objets_qtt(conteneur=True):
if (objet.est_de_type('ustensile') and objet.nourriture):
ustensile = objet
conteneur = t_conteneur
... |
943bd3a4b645d8ee0b88aa941347ffe52685a1df62778ca85f5835b3b6792ad4 | def list_all_service_principals(parsed_args, config, app):
'\n This action will return a dictionary of service principals\n indexed by the ID of the record.\n '
sp_entries = []
paginate(LIST_SERVICE_PRINCIPALS, sp_entries, 'value', parsed_args, config, app, test_data=TestCases().get_service_princip... | This action will return a dictionary of service principals
indexed by the ID of the record. | azure_utility_tool/actions/list_all_service_principals.py | list_all_service_principals | alextricity25/azure_utility_tool | 5 | python | def list_all_service_principals(parsed_args, config, app):
'\n This action will return a dictionary of service principals\n indexed by the ID of the record.\n '
sp_entries = []
paginate(LIST_SERVICE_PRINCIPALS, sp_entries, 'value', parsed_args, config, app, test_data=TestCases().get_service_princip... | def list_all_service_principals(parsed_args, config, app):
'\n This action will return a dictionary of service principals\n indexed by the ID of the record.\n '
sp_entries = []
paginate(LIST_SERVICE_PRINCIPALS, sp_entries, 'value', parsed_args, config, app, test_data=TestCases().get_service_princip... |
ddfac78b20ce6687532a9f97ab97c30d182d324421821a60344c6c0800a5883a | def get_version(*file_paths):
'Retrieves the version from django_frontend_presets/__init__.py'
filename = os.path.join(os.path.dirname(__file__), *file_paths)
version_file = open(filename).read()
version_match = re.search('^__version__ = [\'\\"]([^\'\\"]*)[\'\\"]', version_file, re.M)
if version_mat... | Retrieves the version from django_frontend_presets/__init__.py | setup.py | get_version | mikemenard/django-frontend-presets | 0 | python | def get_version(*file_paths):
filename = os.path.join(os.path.dirname(__file__), *file_paths)
version_file = open(filename).read()
version_match = re.search('^__version__ = [\'\\"]([^\'\\"]*)[\'\\"]', version_file, re.M)
if version_match:
return version_match.group(1)
raise RuntimeError... | def get_version(*file_paths):
filename = os.path.join(os.path.dirname(__file__), *file_paths)
version_file = open(filename).read()
version_match = re.search('^__version__ = [\'\\"]([^\'\\"]*)[\'\\"]', version_file, re.M)
if version_match:
return version_match.group(1)
raise RuntimeError... |
29923c2693ecf37927ae0603c9aaa4fed13d1b7615e56e2d4faaf01312e6cdcd | def __init__(self, name=None, number=None, protocol=None):
'IstioNetworkingV1alpha3Port - a model defined in OpenAPI'
self._name = None
self._number = None
self._protocol = None
self.discriminator = None
if (name is not None):
self.name = name
if (number is not None):
self.nu... | IstioNetworkingV1alpha3Port - a model defined in OpenAPI | kubernetes/client/models/istio_networking_v1alpha3_port.py | __init__ | DrAuYueng/python | 0 | python | def __init__(self, name=None, number=None, protocol=None):
self._name = None
self._number = None
self._protocol = None
self.discriminator = None
if (name is not None):
self.name = name
if (number is not None):
self.number = number
if (protocol is not None):
self.... | def __init__(self, name=None, number=None, protocol=None):
self._name = None
self._number = None
self._protocol = None
self.discriminator = None
if (name is not None):
self.name = name
if (number is not None):
self.number = number
if (protocol is not None):
self.... |
5789d86f3e8c97e1797e4a973eec432faeafbb8885e679bc881d37cdb7705e32 | @property
def name(self):
'Gets the name of this IstioNetworkingV1alpha3Port. # noqa: E501\n\n Label assigned to the port. # noqa: E501\n\n :return: The name of this IstioNetworkingV1alpha3Port. # noqa: E501\n :rtype: str\n '
return self._name | Gets the name of this IstioNetworkingV1alpha3Port. # noqa: E501
Label assigned to the port. # noqa: E501
:return: The name of this IstioNetworkingV1alpha3Port. # noqa: E501
:rtype: str | kubernetes/client/models/istio_networking_v1alpha3_port.py | name | DrAuYueng/python | 0 | python | @property
def name(self):
'Gets the name of this IstioNetworkingV1alpha3Port. # noqa: E501\n\n Label assigned to the port. # noqa: E501\n\n :return: The name of this IstioNetworkingV1alpha3Port. # noqa: E501\n :rtype: str\n '
return self._name | @property
def name(self):
'Gets the name of this IstioNetworkingV1alpha3Port. # noqa: E501\n\n Label assigned to the port. # noqa: E501\n\n :return: The name of this IstioNetworkingV1alpha3Port. # noqa: E501\n :rtype: str\n '
return self._name<|docstring|>Gets the name of this Ist... |
91e97109c8e95ddccfcb0c040cee56801afd73adf255f63d54642aac9ab1a010 | @name.setter
def name(self, name):
'Sets the name of this IstioNetworkingV1alpha3Port.\n\n Label assigned to the port. # noqa: E501\n\n :param name: The name of this IstioNetworkingV1alpha3Port. # noqa: E501\n :type: str\n '
self._name = name | Sets the name of this IstioNetworkingV1alpha3Port.
Label assigned to the port. # noqa: E501
:param name: The name of this IstioNetworkingV1alpha3Port. # noqa: E501
:type: str | kubernetes/client/models/istio_networking_v1alpha3_port.py | name | DrAuYueng/python | 0 | python | @name.setter
def name(self, name):
'Sets the name of this IstioNetworkingV1alpha3Port.\n\n Label assigned to the port. # noqa: E501\n\n :param name: The name of this IstioNetworkingV1alpha3Port. # noqa: E501\n :type: str\n '
self._name = name | @name.setter
def name(self, name):
'Sets the name of this IstioNetworkingV1alpha3Port.\n\n Label assigned to the port. # noqa: E501\n\n :param name: The name of this IstioNetworkingV1alpha3Port. # noqa: E501\n :type: str\n '
self._name = name<|docstring|>Sets the name of this Istio... |
b6c2b91ebc7746cf0ed0726f6a330c6859eacf30e1f86c43ffd1919542bd76ca | @property
def number(self):
'Gets the number of this IstioNetworkingV1alpha3Port. # noqa: E501\n\n A valid non-negative integer port number. # noqa: E501\n\n :return: The number of this IstioNetworkingV1alpha3Port. # noqa: E501\n :rtype: int\n '
return self._number | Gets the number of this IstioNetworkingV1alpha3Port. # noqa: E501
A valid non-negative integer port number. # noqa: E501
:return: The number of this IstioNetworkingV1alpha3Port. # noqa: E501
:rtype: int | kubernetes/client/models/istio_networking_v1alpha3_port.py | number | DrAuYueng/python | 0 | python | @property
def number(self):
'Gets the number of this IstioNetworkingV1alpha3Port. # noqa: E501\n\n A valid non-negative integer port number. # noqa: E501\n\n :return: The number of this IstioNetworkingV1alpha3Port. # noqa: E501\n :rtype: int\n '
return self._number | @property
def number(self):
'Gets the number of this IstioNetworkingV1alpha3Port. # noqa: E501\n\n A valid non-negative integer port number. # noqa: E501\n\n :return: The number of this IstioNetworkingV1alpha3Port. # noqa: E501\n :rtype: int\n '
return self._number<|docstring|>Get... |
5c41e4306f53ca2e2ab26fddc65f317ab9ec8b800cff2a5bcd94e31b135e7463 | @number.setter
def number(self, number):
'Sets the number of this IstioNetworkingV1alpha3Port.\n\n A valid non-negative integer port number. # noqa: E501\n\n :param number: The number of this IstioNetworkingV1alpha3Port. # noqa: E501\n :type: int\n '
self._number = number | Sets the number of this IstioNetworkingV1alpha3Port.
A valid non-negative integer port number. # noqa: E501
:param number: The number of this IstioNetworkingV1alpha3Port. # noqa: E501
:type: int | kubernetes/client/models/istio_networking_v1alpha3_port.py | number | DrAuYueng/python | 0 | python | @number.setter
def number(self, number):
'Sets the number of this IstioNetworkingV1alpha3Port.\n\n A valid non-negative integer port number. # noqa: E501\n\n :param number: The number of this IstioNetworkingV1alpha3Port. # noqa: E501\n :type: int\n '
self._number = number | @number.setter
def number(self, number):
'Sets the number of this IstioNetworkingV1alpha3Port.\n\n A valid non-negative integer port number. # noqa: E501\n\n :param number: The number of this IstioNetworkingV1alpha3Port. # noqa: E501\n :type: int\n '
self._number = number<|docstrin... |
da5e7be20cfe8987908c55641d0787069c60b3bd7bd167fd7bef3e08768eeebb | @property
def protocol(self):
'Gets the protocol of this IstioNetworkingV1alpha3Port. # noqa: E501\n\n The protocol exposed on the port. MUST BE one of HTTP|HTTPS|GRPC|HTTP2|MONGO|TCP|TLS. TLS implies the connection will be routed based on the SNI header to the destination without terminating the TLS connec... | Gets the protocol of this IstioNetworkingV1alpha3Port. # noqa: E501
The protocol exposed on the port. MUST BE one of HTTP|HTTPS|GRPC|HTTP2|MONGO|TCP|TLS. TLS implies the connection will be routed based on the SNI header to the destination without terminating the TLS connection. # noqa: E501
:return: The protocol of... | kubernetes/client/models/istio_networking_v1alpha3_port.py | protocol | DrAuYueng/python | 0 | python | @property
def protocol(self):
'Gets the protocol of this IstioNetworkingV1alpha3Port. # noqa: E501\n\n The protocol exposed on the port. MUST BE one of HTTP|HTTPS|GRPC|HTTP2|MONGO|TCP|TLS. TLS implies the connection will be routed based on the SNI header to the destination without terminating the TLS connec... | @property
def protocol(self):
'Gets the protocol of this IstioNetworkingV1alpha3Port. # noqa: E501\n\n The protocol exposed on the port. MUST BE one of HTTP|HTTPS|GRPC|HTTP2|MONGO|TCP|TLS. TLS implies the connection will be routed based on the SNI header to the destination without terminating the TLS connec... |
e7ea8e7ea4e0d6623b08434ae529cc4c021b884ec5904903a614113b75efc63e | @protocol.setter
def protocol(self, protocol):
'Sets the protocol of this IstioNetworkingV1alpha3Port.\n\n The protocol exposed on the port. MUST BE one of HTTP|HTTPS|GRPC|HTTP2|MONGO|TCP|TLS. TLS implies the connection will be routed based on the SNI header to the destination without terminating the TLS con... | Sets the protocol of this IstioNetworkingV1alpha3Port.
The protocol exposed on the port. MUST BE one of HTTP|HTTPS|GRPC|HTTP2|MONGO|TCP|TLS. TLS implies the connection will be routed based on the SNI header to the destination without terminating the TLS connection. # noqa: E501
:param protocol: The protocol of this ... | kubernetes/client/models/istio_networking_v1alpha3_port.py | protocol | DrAuYueng/python | 0 | python | @protocol.setter
def protocol(self, protocol):
'Sets the protocol of this IstioNetworkingV1alpha3Port.\n\n The protocol exposed on the port. MUST BE one of HTTP|HTTPS|GRPC|HTTP2|MONGO|TCP|TLS. TLS implies the connection will be routed based on the SNI header to the destination without terminating the TLS con... | @protocol.setter
def protocol(self, protocol):
'Sets the protocol of this IstioNetworkingV1alpha3Port.\n\n The protocol exposed on the port. MUST BE one of HTTP|HTTPS|GRPC|HTTP2|MONGO|TCP|TLS. TLS implies the connection will be routed based on the SNI header to the destination without terminating the TLS con... |
5a4e41bb6a0def746593298cb605df98f1366e957c4ca89b12010ea7db707963 | def to_dict(self):
'Returns the model properties as a dict'
result = {}
for (attr, _) in six.iteritems(self.openapi_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map((lambda x: (x.to_dict() if hasattr(x, 'to_dict') else x)), value))
e... | Returns the model properties as a dict | kubernetes/client/models/istio_networking_v1alpha3_port.py | to_dict | DrAuYueng/python | 0 | python | def to_dict(self):
result = {}
for (attr, _) in six.iteritems(self.openapi_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map((lambda x: (x.to_dict() if hasattr(x, 'to_dict') else x)), value))
elif hasattr(value, 'to_dict'):
... | def to_dict(self):
result = {}
for (attr, _) in six.iteritems(self.openapi_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map((lambda x: (x.to_dict() if hasattr(x, 'to_dict') else x)), value))
elif hasattr(value, 'to_dict'):
... |
cbb19eaa2fc8a113d9e32f924ef280a7e97563f8915f94f65dab438997af2e99 | def to_str(self):
'Returns the string representation of the model'
return pprint.pformat(self.to_dict()) | Returns the string representation of the model | kubernetes/client/models/istio_networking_v1alpha3_port.py | to_str | DrAuYueng/python | 0 | python | def to_str(self):
return pprint.pformat(self.to_dict()) | def to_str(self):
return pprint.pformat(self.to_dict())<|docstring|>Returns the string representation of the model<|endoftext|> |
772243a2c2b3261a9b954d07aaf295e3c1242a579a495e2d6a5679c677861703 | def __repr__(self):
'For `print` and `pprint`'
return self.to_str() | For `print` and `pprint` | kubernetes/client/models/istio_networking_v1alpha3_port.py | __repr__ | DrAuYueng/python | 0 | python | def __repr__(self):
return self.to_str() | def __repr__(self):
return self.to_str()<|docstring|>For `print` and `pprint`<|endoftext|> |
82d0213d2f0e2fa840742ca36303558403ef3dc98519deefc769e2f40f91a801 | def __eq__(self, other):
'Returns true if both objects are equal'
if (not isinstance(other, IstioNetworkingV1alpha3Port)):
return False
return (self.__dict__ == other.__dict__) | Returns true if both objects are equal | kubernetes/client/models/istio_networking_v1alpha3_port.py | __eq__ | DrAuYueng/python | 0 | python | def __eq__(self, other):
if (not isinstance(other, IstioNetworkingV1alpha3Port)):
return False
return (self.__dict__ == other.__dict__) | def __eq__(self, other):
if (not isinstance(other, IstioNetworkingV1alpha3Port)):
return False
return (self.__dict__ == other.__dict__)<|docstring|>Returns true if both objects are equal<|endoftext|> |
43dc6740163eb9fc1161d09cb2208a64c7ad0cc8d9c8637ac3264522d3ec7e42 | def __ne__(self, other):
'Returns true if both objects are not equal'
return (not (self == other)) | Returns true if both objects are not equal | kubernetes/client/models/istio_networking_v1alpha3_port.py | __ne__ | DrAuYueng/python | 0 | python | def __ne__(self, other):
return (not (self == other)) | def __ne__(self, other):
return (not (self == other))<|docstring|>Returns true if both objects are not equal<|endoftext|> |
7733bb6341b38273d953555fc2165b18f22163d8be332bc8c9b9457c8de6f299 | def set_epoch(self, epoch: int) -> None:
'\n Sets the epoch for this sampler. When :attr:`shuffle=True`, this ensures all replicas\n use a different random ordering for each epoch. Otherwise, the next iteration of this\n sampler will yield the same ordering.\n\n Args:\n epoch ... | Sets the epoch for this sampler. When :attr:`shuffle=True`, this ensures all replicas
use a different random ordering for each epoch. Otherwise, the next iteration of this
sampler will yield the same ordering.
Args:
epoch (int): Epoch number. | bagua/torch_api/contrib/load_balancing_data_loader.py | set_epoch | Youhe-Jiang/bagua | 635 | python | def set_epoch(self, epoch: int) -> None:
'\n Sets the epoch for this sampler. When :attr:`shuffle=True`, this ensures all replicas\n use a different random ordering for each epoch. Otherwise, the next iteration of this\n sampler will yield the same ordering.\n\n Args:\n epoch ... | def set_epoch(self, epoch: int) -> None:
'\n Sets the epoch for this sampler. When :attr:`shuffle=True`, this ensures all replicas\n use a different random ordering for each epoch. Otherwise, the next iteration of this\n sampler will yield the same ordering.\n\n Args:\n epoch ... |
9b9f33f68309e39d31f3d9e175ba937a52113323fc1c745bc4619a4684879652 | def set_epoch(self, epoch: int) -> None:
'\n Sets the epoch for this sampler. When :attr:`shuffle=True`, this ensures all replicas\n use a different random ordering for each epoch. Otherwise, the next iteration of this\n sampler will yield the same ordering.\n\n Args:\n epoch ... | Sets the epoch for this sampler. When :attr:`shuffle=True`, this ensures all replicas
use a different random ordering for each epoch. Otherwise, the next iteration of this
sampler will yield the same ordering.
Args:
epoch (int): Epoch number. | bagua/torch_api/contrib/load_balancing_data_loader.py | set_epoch | Youhe-Jiang/bagua | 635 | python | def set_epoch(self, epoch: int) -> None:
'\n Sets the epoch for this sampler. When :attr:`shuffle=True`, this ensures all replicas\n use a different random ordering for each epoch. Otherwise, the next iteration of this\n sampler will yield the same ordering.\n\n Args:\n epoch ... | def set_epoch(self, epoch: int) -> None:
'\n Sets the epoch for this sampler. When :attr:`shuffle=True`, this ensures all replicas\n use a different random ordering for each epoch. Otherwise, the next iteration of this\n sampler will yield the same ordering.\n\n Args:\n epoch ... |
2a054b130dd249f6cb88f0f1b8f842213fa5e702768b59ccccaefb5e451b0043 | def chunks_wrap_padding(lst, n):
'Yield successive n-sized chunks from lst.'
num_chunks = max(1, self.num_samples)
num_elements = (num_chunks * n)
current_lst = []
for i in range(num_elements):
current_lst.append(lst[(i % len(lst))])
if (len(current_lst) == n):
(yield cur... | Yield successive n-sized chunks from lst. | bagua/torch_api/contrib/load_balancing_data_loader.py | chunks_wrap_padding | Youhe-Jiang/bagua | 635 | python | def chunks_wrap_padding(lst, n):
num_chunks = max(1, self.num_samples)
num_elements = (num_chunks * n)
current_lst = []
for i in range(num_elements):
current_lst.append(lst[(i % len(lst))])
if (len(current_lst) == n):
(yield current_lst)
current_lst = [] | def chunks_wrap_padding(lst, n):
num_chunks = max(1, self.num_samples)
num_elements = (num_chunks * n)
current_lst = []
for i in range(num_elements):
current_lst.append(lst[(i % len(lst))])
if (len(current_lst) == n):
(yield current_lst)
current_lst = []<|doc... |
2452c5bc34d3efa9d77c1a827b92491f0316a686d62fe632f829d48b7b2cefe3 | def torch_dim_to_trt_axes(dim):
'Converts torch dim, or tuple of dims to a tensorrt axes bitmask'
if (not isinstance(dim, tuple)):
dim = (dim,)
axes = 0
for d in dim:
axes |= (1 << (d - 1))
return axes | Converts torch dim, or tuple of dims to a tensorrt axes bitmask | torch2trt/torch2trt.py | torch_dim_to_trt_axes | jtlee90/res-model-torch2trt | 2 | python | def torch_dim_to_trt_axes(dim):
if (not isinstance(dim, tuple)):
dim = (dim,)
axes = 0
for d in dim:
axes |= (1 << (d - 1))
return axes | def torch_dim_to_trt_axes(dim):
if (not isinstance(dim, tuple)):
dim = (dim,)
axes = 0
for d in dim:
axes |= (1 << (d - 1))
return axes<|docstring|>Converts torch dim, or tuple of dims to a tensorrt axes bitmask<|endoftext|> |
5daa665ef88c7eb05efc607897f30e78e04408b834b05aa07593bed61692dcd8 | def trt_(network, *tensors):
'Creates missing TensorRT tensors and adds shuffle layers to make tensors broadcastable'
trt_tensors = ([None] * len(tensors))
dtype = check_torch_dtype(*tensors)
broadcast_num_dim = 0
for t in tensors:
if isinstance(t, torch.Tensor):
if (not hasattr(... | Creates missing TensorRT tensors and adds shuffle layers to make tensors broadcastable | torch2trt/torch2trt.py | trt_ | jtlee90/res-model-torch2trt | 2 | python | def trt_(network, *tensors):
trt_tensors = ([None] * len(tensors))
dtype = check_torch_dtype(*tensors)
broadcast_num_dim = 0
for t in tensors:
if isinstance(t, torch.Tensor):
if (not hasattr(t, '_trt')):
num_dim = len(t.shape[1:])
else:
... | def trt_(network, *tensors):
trt_tensors = ([None] * len(tensors))
dtype = check_torch_dtype(*tensors)
broadcast_num_dim = 0
for t in tensors:
if isinstance(t, torch.Tensor):
if (not hasattr(t, '_trt')):
num_dim = len(t.shape[1:])
else:
... |
fd632695dd71c446a30e9d3f0e30e9daff2e9553f1b8780d2746b4636d6cd55e | def attach_converter(ctx, method, converter):
'Gets a function that executes PyTorch method and TensorRT converter'
def wrapper(*args, **kwargs):
skip = True
if (not ctx.lock):
ctx.lock = True
skip = False
outputs = method(*args, **kwargs)
if (not skip):
... | Gets a function that executes PyTorch method and TensorRT converter | torch2trt/torch2trt.py | attach_converter | jtlee90/res-model-torch2trt | 2 | python | def attach_converter(ctx, method, converter):
def wrapper(*args, **kwargs):
skip = True
if (not ctx.lock):
ctx.lock = True
skip = False
outputs = method(*args, **kwargs)
if (not skip):
ctx.method_args = args
ctx.method_kwargs = kw... | def attach_converter(ctx, method, converter):
def wrapper(*args, **kwargs):
skip = True
if (not ctx.lock):
ctx.lock = True
skip = False
outputs = method(*args, **kwargs)
if (not skip):
ctx.method_args = args
ctx.method_kwargs = kw... |
f069b911858b1799ba3f17ed483ea8a4cc6563e50aa7d40a46db8481fdfb3e11 | def clear_frames(tb):
'Does nothing on Py2.' | Does nothing on Py2. | src/relstorage/_compat.py | clear_frames | lungj/relstorage | 0 | python | def clear_frames(tb):
| def clear_frames(tb):
<|docstring|>Does nothing on Py2.<|endoftext|> |
10f7edd806460b4e450b707f8753d52c428e6df31dfb0b1af48ebfd5d62d12ae | def getData():
'API import. Return last 30 days of weather in a DataFrame'
entrant = 'VFJ5W4L3FNJLNDEMWN6JZSEWB'
url = ''.join(['https://weather.visualcrossing.com/', 'VisualCrossingWebServices/rest/services/timeline/', 'London%2C%20ENG%2C%20GB/last30days?unitGroup=uk&key={}', '&include=obs']).format(entran... | API import. Return last 30 days of weather in a DataFrame | dash_app.py | getData | Joseph-Foley/neural_net_weather_forecasts_on_cloud | 1 | python | def getData():
entrant = 'VFJ5W4L3FNJLNDEMWN6JZSEWB'
url = .join(['https://weather.visualcrossing.com/', 'VisualCrossingWebServices/rest/services/timeline/', 'London%2C%20ENG%2C%20GB/last30days?unitGroup=uk&key={}', '&include=obs']).format(entrant)
req = requests.get(url)
req_json = req.json()
... | def getData():
entrant = 'VFJ5W4L3FNJLNDEMWN6JZSEWB'
url = .join(['https://weather.visualcrossing.com/', 'VisualCrossingWebServices/rest/services/timeline/', 'London%2C%20ENG%2C%20GB/last30days?unitGroup=uk&key={}', '&include=obs']).format(entrant)
req = requests.get(url)
req_json = req.json()
... |
c00b6b7e33a0cc1fd1111622105f55bc66e70a7bf5003fce833e8d69be033895 | def loadModels():
'Instantiates model class and then loads h5 model'
files = os.listdir('./Colab_Models')
files = [('./Colab_Models/' + file) for file in files]
(files[0], files[2]) = (files[2], files[0])
assert (len(files) == 4)
assert (files[0][(- 3):] == '.h5')
model_dict = {key: BuildMod... | Instantiates model class and then loads h5 model | dash_app.py | loadModels | Joseph-Foley/neural_net_weather_forecasts_on_cloud | 1 | python | def loadModels():
files = os.listdir('./Colab_Models')
files = [('./Colab_Models/' + file) for file in files]
(files[0], files[2]) = (files[2], files[0])
assert (len(files) == 4)
assert (files[0][(- 3):] == '.h5')
model_dict = {key: BuildModel(model_name=key, length=30) for key in files}
... | def loadModels():
files = os.listdir('./Colab_Models')
files = [('./Colab_Models/' + file) for file in files]
(files[0], files[2]) = (files[2], files[0])
assert (len(files) == 4)
assert (files[0][(- 3):] == '.h5')
model_dict = {key: BuildModel(model_name=key, length=30) for key in files}
... |
cf1645e8870fab51b5924c15b9c14243e2bf4ea0599104db4c75004e9255afff | def plotlyData(name: str, hist, fc):
'plots history and forecast'
trace1 = go.Scatter(x=hist.index, y=hist.values, name='History', mode='lines+markers+text', marker=dict(color='rgba(0,128,0, 1)', size=10, symbol=1, line={'width': 1}), line=dict(width=3), text=hist.values, textposition='top center', texttemplate... | plots history and forecast | dash_app.py | plotlyData | Joseph-Foley/neural_net_weather_forecasts_on_cloud | 1 | python | def plotlyData(name: str, hist, fc):
trace1 = go.Scatter(x=hist.index, y=hist.values, name='History', mode='lines+markers+text', marker=dict(color='rgba(0,128,0, 1)', size=10, symbol=1, line={'width': 1}), line=dict(width=3), text=hist.values, textposition='top center', texttemplate='%{text:.0f}', textfont_siz... | def plotlyData(name: str, hist, fc):
trace1 = go.Scatter(x=hist.index, y=hist.values, name='History', mode='lines+markers+text', marker=dict(color='rgba(0,128,0, 1)', size=10, symbol=1, line={'width': 1}), line=dict(width=3), text=hist.values, textposition='top center', texttemplate='%{text:.0f}', textfont_siz... |
3c35a723372472af861f8ff76a4d08df6ad1f5d9b68f9084e441c81a50a2b620 | def _draw_rectangle(self, img, xy):
'Draw a black rectangle.\n @param img: PIL Image object\n @param xy: Coordinates as refined in PIL rectangle() doc\n @return: Image with black rectangle\n '
dr = ImageDraw.Draw(img)
dr.rectangle(xy, fill='black', outline='black')
return img | Draw a black rectangle.
@param img: PIL Image object
@param xy: Coordinates as refined in PIL rectangle() doc
@return: Image with black rectangle | analyzer/windows/lib/api/screenshot.py | _draw_rectangle | Yuanmessi/Bold-Falcon | 41 | python | def _draw_rectangle(self, img, xy):
'Draw a black rectangle.\n @param img: PIL Image object\n @param xy: Coordinates as refined in PIL rectangle() doc\n @return: Image with black rectangle\n '
dr = ImageDraw.Draw(img)
dr.rectangle(xy, fill='black', outline='black')
return img | def _draw_rectangle(self, img, xy):
'Draw a black rectangle.\n @param img: PIL Image object\n @param xy: Coordinates as refined in PIL rectangle() doc\n @return: Image with black rectangle\n '
dr = ImageDraw.Draw(img)
dr.rectangle(xy, fill='black', outline='black')
return img... |
c75ecf966c425153dba37b112bc9246091f9a63634bc1c76a499e039a0972f80 | def have_pil(self):
'Is Python Image Library installed?\n @return: installed status.\n '
return HAVE_PIL | Is Python Image Library installed?
@return: installed status. | analyzer/windows/lib/api/screenshot.py | have_pil | Yuanmessi/Bold-Falcon | 41 | python | def have_pil(self):
'Is Python Image Library installed?\n @return: installed status.\n '
return HAVE_PIL | def have_pil(self):
'Is Python Image Library installed?\n @return: installed status.\n '
return HAVE_PIL<|docstring|>Is Python Image Library installed?
@return: installed status.<|endoftext|> |
442ebb9becd7c627f3d02d46fae16c6aea6db54c1c835ff03aa856b9b1a7493e | def equal(self, img1, img2, skip_area=None):
'Compares two screenshots using Root-Mean-Square Difference (RMS).\n @param img1: screenshot to compare.\n @param img2: screenshot to compare.\n @return: equal status.\n '
if (not HAVE_PIL):
return None
if skip_area:
im... | Compares two screenshots using Root-Mean-Square Difference (RMS).
@param img1: screenshot to compare.
@param img2: screenshot to compare.
@return: equal status. | analyzer/windows/lib/api/screenshot.py | equal | Yuanmessi/Bold-Falcon | 41 | python | def equal(self, img1, img2, skip_area=None):
'Compares two screenshots using Root-Mean-Square Difference (RMS).\n @param img1: screenshot to compare.\n @param img2: screenshot to compare.\n @return: equal status.\n '
if (not HAVE_PIL):
return None
if skip_area:
im... | def equal(self, img1, img2, skip_area=None):
'Compares two screenshots using Root-Mean-Square Difference (RMS).\n @param img1: screenshot to compare.\n @param img2: screenshot to compare.\n @return: equal status.\n '
if (not HAVE_PIL):
return None
if skip_area:
im... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.