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 |
|---|---|---|---|---|---|---|---|---|---|
928cdaa5fc545569a5ebaf3a1255a38f838b24e8a96397f10dee185bc4a797ff | @abstractmethod
def getReferencedType(self) -> 'XTypeDescription_3c210fb1':
'\n Returns the typedefed type, if the type is a typedef, or the element type, if the type is a sequence.\n ' | Returns the typedefed type, if the type is a typedef, or the element type, if the type is a sequence. | ooobuild/lo/reflection/x_indirect_type_description.py | getReferencedType | Amourspirit/ooo_uno_tmpl | 0 | python | @abstractmethod
def getReferencedType(self) -> 'XTypeDescription_3c210fb1':
'\n \n ' | @abstractmethod
def getReferencedType(self) -> 'XTypeDescription_3c210fb1':
'\n \n '<|docstring|>Returns the typedefed type, if the type is a typedef, or the element type, if the type is a sequence.<|endoftext|> |
0b623bcc69567dc9859f095a52a9c4ec8a92b343359a3404421253b80881d5c2 | @abc.abstractproperty
def is_real(self) -> bool:
'Whether the filters are real or complex'
pass | Whether the filters are real or complex | src/pydrobert/speech/filters.py | is_real | sdrobert/pydrobert-speech | 5 | python | @abc.abstractproperty
def is_real(self) -> bool:
pass | @abc.abstractproperty
def is_real(self) -> bool:
pass<|docstring|>Whether the filters are real or complex<|endoftext|> |
d4b4b7618d9669e4ec62bd66cbd31057231e5598fe014cb3526e606de4a3660c | @abc.abstractproperty
def is_analytic(self) -> bool:
'Whether the filters are (approximately) analytic'
pass | Whether the filters are (approximately) analytic | src/pydrobert/speech/filters.py | is_analytic | sdrobert/pydrobert-speech | 5 | python | @abc.abstractproperty
def is_analytic(self) -> bool:
pass | @abc.abstractproperty
def is_analytic(self) -> bool:
pass<|docstring|>Whether the filters are (approximately) analytic<|endoftext|> |
079e9851855a7b2c43421ae3792a440ae5987170fef9bf526f5dc48294378b29 | @abc.abstractproperty
def is_zero_phase(self) -> bool:
'Whether the filters are zero phase or not\n\n Zero phase filters are even functions with no imaginary part in the fourier\n domain. Their impulse responses center around 0.\n '
pass | Whether the filters are zero phase or not
Zero phase filters are even functions with no imaginary part in the fourier
domain. Their impulse responses center around 0. | src/pydrobert/speech/filters.py | is_zero_phase | sdrobert/pydrobert-speech | 5 | python | @abc.abstractproperty
def is_zero_phase(self) -> bool:
'Whether the filters are zero phase or not\n\n Zero phase filters are even functions with no imaginary part in the fourier\n domain. Their impulse responses center around 0.\n '
pass | @abc.abstractproperty
def is_zero_phase(self) -> bool:
'Whether the filters are zero phase or not\n\n Zero phase filters are even functions with no imaginary part in the fourier\n domain. Their impulse responses center around 0.\n '
pass<|docstring|>Whether the filters are zero phase or not... |
e2322aa4d5923f0fa71f8b1c41429bc8540edc20255a5ac62490a33a7b37b273 | @abc.abstractproperty
def num_filts(self) -> int:
'Number of filters in the bank'
pass | Number of filters in the bank | src/pydrobert/speech/filters.py | num_filts | sdrobert/pydrobert-speech | 5 | python | @abc.abstractproperty
def num_filts(self) -> int:
pass | @abc.abstractproperty
def num_filts(self) -> int:
pass<|docstring|>Number of filters in the bank<|endoftext|> |
36b3b728047e354c1fdfed0d487bf86b5446e3afdd5dcad02ef3233e0dbebe3e | @abc.abstractproperty
def sampling_rate(self) -> float:
'Number of samples in a second of a target recording'
pass | Number of samples in a second of a target recording | src/pydrobert/speech/filters.py | sampling_rate | sdrobert/pydrobert-speech | 5 | python | @abc.abstractproperty
def sampling_rate(self) -> float:
pass | @abc.abstractproperty
def sampling_rate(self) -> float:
pass<|docstring|>Number of samples in a second of a target recording<|endoftext|> |
1fcd93f83bb77e5aaa85571d73c63d873f7682b55fb7e21121b5b915b867bdad | @abc.abstractproperty
def supports_hz(self) -> Tuple:
'Boundaries of effective support of filter freq responses, in Hz.\n\n Returns a tuple of length `num_filts` containing pairs of floats of the low and\n high frequencies. Frequencies outside the span have a response of approximately\n (with m... | Boundaries of effective support of filter freq responses, in Hz.
Returns a tuple of length `num_filts` containing pairs of floats of the low and
high frequencies. Frequencies outside the span have a response of approximately
(with magnitude up to :obj:`pydrobert.speech.EFFECTIVE_SUPPORT_SIGNAL`) zero.
The boundaries ... | src/pydrobert/speech/filters.py | supports_hz | sdrobert/pydrobert-speech | 5 | python | @abc.abstractproperty
def supports_hz(self) -> Tuple:
'Boundaries of effective support of filter freq responses, in Hz.\n\n Returns a tuple of length `num_filts` containing pairs of floats of the low and\n high frequencies. Frequencies outside the span have a response of approximately\n (with m... | @abc.abstractproperty
def supports_hz(self) -> Tuple:
'Boundaries of effective support of filter freq responses, in Hz.\n\n Returns a tuple of length `num_filts` containing pairs of floats of the low and\n high frequencies. Frequencies outside the span have a response of approximately\n (with m... |
b391828f1569d74547d2fe63063d559726732b2bf70ad20598a483087238eb36 | @abc.abstractproperty
def supports(self) -> Tuple:
'Boundaries of effective support of filter impulse resps, in samples\n\n Returns a tuple of length `num_filts` containing pairs of integers of the first\n and last (effectively) nonzero samples.\n\n The boundaries need not be tight, i.e. the re... | Boundaries of effective support of filter impulse resps, in samples
Returns a tuple of length `num_filts` containing pairs of integers of the first
and last (effectively) nonzero samples.
The boundaries need not be tight, i.e. the region inside the boundaries could be
zero. It is more important to guarantee that the ... | src/pydrobert/speech/filters.py | supports | sdrobert/pydrobert-speech | 5 | python | @abc.abstractproperty
def supports(self) -> Tuple:
'Boundaries of effective support of filter impulse resps, in samples\n\n Returns a tuple of length `num_filts` containing pairs of integers of the first\n and last (effectively) nonzero samples.\n\n The boundaries need not be tight, i.e. the re... | @abc.abstractproperty
def supports(self) -> Tuple:
'Boundaries of effective support of filter impulse resps, in samples\n\n Returns a tuple of length `num_filts` containing pairs of integers of the first\n and last (effectively) nonzero samples.\n\n The boundaries need not be tight, i.e. the re... |
2a6f5a413c58534fae79cba610c092976e4abbbf7f7a3e8418d460bdc00aa9f7 | @property
def supports_ms(self) -> tuple:
'Boundaries of effective support of filter impulse resps, in ms'
return tuple(((((s[0] * 1000) / self.sampling_rate), ((s[1] * 1000) / self.sampling_rate)) for s in self.supports)) | Boundaries of effective support of filter impulse resps, in ms | src/pydrobert/speech/filters.py | supports_ms | sdrobert/pydrobert-speech | 5 | python | @property
def supports_ms(self) -> tuple:
return tuple(((((s[0] * 1000) / self.sampling_rate), ((s[1] * 1000) / self.sampling_rate)) for s in self.supports)) | @property
def supports_ms(self) -> tuple:
return tuple(((((s[0] * 1000) / self.sampling_rate), ((s[1] * 1000) / self.sampling_rate)) for s in self.supports))<|docstring|>Boundaries of effective support of filter impulse resps, in ms<|endoftext|> |
01b5af6df4f27cc7502b4e4f4fb2e292dde2201a971fa51d5cd586d0c948ac36 | @abc.abstractmethod
def get_impulse_response(self, filt_idx: int, width: int) -> np.ndarray:
'Construct filter impulse response in a fixed-width buffer\n\n Construct the filter in the time domain.\n\n Parameters\n ----------\n filt_idx : int\n The index of the filter to genera... | Construct filter impulse response in a fixed-width buffer
Construct the filter in the time domain.
Parameters
----------
filt_idx : int
The index of the filter to generate. Less than `num_filts`
width : int
The length of the buffer, in samples. If less than the support of the
filter, the filter will alias... | src/pydrobert/speech/filters.py | get_impulse_response | sdrobert/pydrobert-speech | 5 | python | @abc.abstractmethod
def get_impulse_response(self, filt_idx: int, width: int) -> np.ndarray:
'Construct filter impulse response in a fixed-width buffer\n\n Construct the filter in the time domain.\n\n Parameters\n ----------\n filt_idx : int\n The index of the filter to genera... | @abc.abstractmethod
def get_impulse_response(self, filt_idx: int, width: int) -> np.ndarray:
'Construct filter impulse response in a fixed-width buffer\n\n Construct the filter in the time domain.\n\n Parameters\n ----------\n filt_idx : int\n The index of the filter to genera... |
7d5f47dde119be03aa55b8c40c9d06cf104e856c8799dd973934b9052c3146e6 | @abc.abstractmethod
def get_frequency_response(self, filt_idx: int, width: int, half: bool=False) -> np.ndarray:
'Construct filter frequency response in a fixed-width buffer\n\n Construct the 2pi-periodized filter in the frequency domain. Zero-phase filters\n `is_zero_phase` are returned as 8-byte flo... | Construct filter frequency response in a fixed-width buffer
Construct the 2pi-periodized filter in the frequency domain. Zero-phase filters
`is_zero_phase` are returned as 8-byte float arrays. Otherwise, they will be
16-byte complex floats.
Parameters
----------
filt_idx : int
The index of the filter to generate.... | src/pydrobert/speech/filters.py | get_frequency_response | sdrobert/pydrobert-speech | 5 | python | @abc.abstractmethod
def get_frequency_response(self, filt_idx: int, width: int, half: bool=False) -> np.ndarray:
'Construct filter frequency response in a fixed-width buffer\n\n Construct the 2pi-periodized filter in the frequency domain. Zero-phase filters\n `is_zero_phase` are returned as 8-byte flo... | @abc.abstractmethod
def get_frequency_response(self, filt_idx: int, width: int, half: bool=False) -> np.ndarray:
'Construct filter frequency response in a fixed-width buffer\n\n Construct the 2pi-periodized filter in the frequency domain. Zero-phase filters\n `is_zero_phase` are returned as 8-byte flo... |
849cc8f638da10d7af99cd928211168753b7c73828993429b81b2d79e47809e9 | @abc.abstractmethod
def get_truncated_response(self, filt_idx: int, width: int) -> Tuple[(int, np.ndarray)]:
'Get nonzero region of filter frequency response\n\n Many filters will be compactly supported in frequency (or approximately so).\n This method generates a tuple `(bin_idx, buf)` of the nonzero... | Get nonzero region of filter frequency response
Many filters will be compactly supported in frequency (or approximately so).
This method generates a tuple `(bin_idx, buf)` of the nonzero region.
In the case of a complex filter, ``bin_idx + len(buf)`` may be greater than
`width`; the filter wraps around in this case. ... | src/pydrobert/speech/filters.py | get_truncated_response | sdrobert/pydrobert-speech | 5 | python | @abc.abstractmethod
def get_truncated_response(self, filt_idx: int, width: int) -> Tuple[(int, np.ndarray)]:
'Get nonzero region of filter frequency response\n\n Many filters will be compactly supported in frequency (or approximately so).\n This method generates a tuple `(bin_idx, buf)` of the nonzero... | @abc.abstractmethod
def get_truncated_response(self, filt_idx: int, width: int) -> Tuple[(int, np.ndarray)]:
'Get nonzero region of filter frequency response\n\n Many filters will be compactly supported in frequency (or approximately so).\n This method generates a tuple `(bin_idx, buf)` of the nonzero... |
340e8b088d0bd7c86079a2743ae20a5f54789b17870c34be50e1a019640b2802 | @property
def centers_hz(self) -> Tuple[float]:
'The point of maximum gain in each filter\'s frequency response, in Hz\n\n This property gives the so-called "center frequencies" - the\n point of maximum gain - of each filter.\n '
return self._vertices[1:(- 1)] | The point of maximum gain in each filter's frequency response, in Hz
This property gives the so-called "center frequencies" - the
point of maximum gain - of each filter. | src/pydrobert/speech/filters.py | centers_hz | sdrobert/pydrobert-speech | 5 | python | @property
def centers_hz(self) -> Tuple[float]:
'The point of maximum gain in each filter\'s frequency response, in Hz\n\n This property gives the so-called "center frequencies" - the\n point of maximum gain - of each filter.\n '
return self._vertices[1:(- 1)] | @property
def centers_hz(self) -> Tuple[float]:
'The point of maximum gain in each filter\'s frequency response, in Hz\n\n This property gives the so-called "center frequencies" - the\n point of maximum gain - of each filter.\n '
return self._vertices[1:(- 1)]<|docstring|>The point of maxim... |
340e8b088d0bd7c86079a2743ae20a5f54789b17870c34be50e1a019640b2802 | @property
def centers_hz(self) -> Tuple[float]:
'The point of maximum gain in each filter\'s frequency response, in Hz\n\n This property gives the so-called "center frequencies" - the\n point of maximum gain - of each filter.\n '
return self._vertices[1:(- 1)] | The point of maximum gain in each filter's frequency response, in Hz
This property gives the so-called "center frequencies" - the
point of maximum gain - of each filter. | src/pydrobert/speech/filters.py | centers_hz | sdrobert/pydrobert-speech | 5 | python | @property
def centers_hz(self) -> Tuple[float]:
'The point of maximum gain in each filter\'s frequency response, in Hz\n\n This property gives the so-called "center frequencies" - the\n point of maximum gain - of each filter.\n '
return self._vertices[1:(- 1)] | @property
def centers_hz(self) -> Tuple[float]:
'The point of maximum gain in each filter\'s frequency response, in Hz\n\n This property gives the so-called "center frequencies" - the\n point of maximum gain - of each filter.\n '
return self._vertices[1:(- 1)]<|docstring|>The point of maxim... |
ff0bebed80175db57cc56590d58122077ee0df625fdbd07aa04058c21a87ecf4 | @property
def centers_hz(self) -> Tuple[float]:
'The point of maximum gain in each filter\'s frequency response, in Hz\n\n This property gives the so-called "center frequencies" - the\n point of maximum gain - of each filter.\n '
return self._centers_hz | The point of maximum gain in each filter's frequency response, in Hz
This property gives the so-called "center frequencies" - the
point of maximum gain - of each filter. | src/pydrobert/speech/filters.py | centers_hz | sdrobert/pydrobert-speech | 5 | python | @property
def centers_hz(self) -> Tuple[float]:
'The point of maximum gain in each filter\'s frequency response, in Hz\n\n This property gives the so-called "center frequencies" - the\n point of maximum gain - of each filter.\n '
return self._centers_hz | @property
def centers_hz(self) -> Tuple[float]:
'The point of maximum gain in each filter\'s frequency response, in Hz\n\n This property gives the so-called "center frequencies" - the\n point of maximum gain - of each filter.\n '
return self._centers_hz<|docstring|>The point of maximum gain... |
ff0bebed80175db57cc56590d58122077ee0df625fdbd07aa04058c21a87ecf4 | @property
def centers_hz(self) -> Tuple[float]:
'The point of maximum gain in each filter\'s frequency response, in Hz\n\n This property gives the so-called "center frequencies" - the\n point of maximum gain - of each filter.\n '
return self._centers_hz | The point of maximum gain in each filter's frequency response, in Hz
This property gives the so-called "center frequencies" - the
point of maximum gain - of each filter. | src/pydrobert/speech/filters.py | centers_hz | sdrobert/pydrobert-speech | 5 | python | @property
def centers_hz(self) -> Tuple[float]:
'The point of maximum gain in each filter\'s frequency response, in Hz\n\n This property gives the so-called "center frequencies" - the\n point of maximum gain - of each filter.\n '
return self._centers_hz | @property
def centers_hz(self) -> Tuple[float]:
'The point of maximum gain in each filter\'s frequency response, in Hz\n\n This property gives the so-called "center frequencies" - the\n point of maximum gain - of each filter.\n '
return self._centers_hz<|docstring|>The point of maximum gain... |
7d6616090d135a62fa76e51aa06230b8ae31a5df4cdd8f32bc1413dba7630a83 | @abc.abstractmethod
def get_impulse_response(self, width: int) -> np.ndarray:
'Write the filter into a numpy array of fixed width'
pass | Write the filter into a numpy array of fixed width | src/pydrobert/speech/filters.py | get_impulse_response | sdrobert/pydrobert-speech | 5 | python | @abc.abstractmethod
def get_impulse_response(self, width: int) -> np.ndarray:
pass | @abc.abstractmethod
def get_impulse_response(self, width: int) -> np.ndarray:
pass<|docstring|>Write the filter into a numpy array of fixed width<|endoftext|> |
184753fd6d1c3555cbc226825b81bc4d4c5322ba946e1d817eef2d9218e0a6eb | def __init__(self, remote=None, **kwargs):
" Constructor\n Args:\n remote (str): The remote git repository. Defaults to None which means that there is no remote. If given and the target directory is not under git control, the repo will try to clon from the remote.\n folder (str): direct... | Constructor
Args:
remote (str): The remote git repository. Defaults to None which means that there is no remote. If given and the target directory is not under git control, the repo will try to clon from the remote.
folder (str): directory used to store the objects in files as well as the sqlite database
fi... | pailab/ml_repo/git_handler.py | __init__ | pailabteam/pailab | 26 | python | def __init__(self, remote=None, **kwargs):
" Constructor\n Args:\n remote (str): The remote git repository. Defaults to None which means that there is no remote. If given and the target directory is not under git control, the repo will try to clon from the remote.\n folder (str): direct... | def __init__(self, remote=None, **kwargs):
" Constructor\n Args:\n remote (str): The remote git repository. Defaults to None which means that there is no remote. If given and the target directory is not under git control, the repo will try to clon from the remote.\n folder (str): direct... |
a2754f48eab2217b6254d61bc26507f1d4d31291fa7d04083a96459e7be0eec6 | def _add(self, obj):
' Adds an object to the git repository\n\n Args:\n obj (RepoObject): the repo object to add to git\n '
super(RepoObjectGitStorage, self)._add(obj)
message = ('adding ' + obj['repo_info']['name'])
if ((obj['repo_info']['commit_message'] is not None) and (obj[... | Adds an object to the git repository
Args:
obj (RepoObject): the repo object to add to git | pailab/ml_repo/git_handler.py | _add | pailabteam/pailab | 26 | python | def _add(self, obj):
' Adds an object to the git repository\n\n Args:\n obj (RepoObject): the repo object to add to git\n '
super(RepoObjectGitStorage, self)._add(obj)
message = ('adding ' + obj['repo_info']['name'])
if ((obj['repo_info']['commit_message'] is not None) and (obj[... | def _add(self, obj):
' Adds an object to the git repository\n\n Args:\n obj (RepoObject): the repo object to add to git\n '
super(RepoObjectGitStorage, self)._add(obj)
message = ('adding ' + obj['repo_info']['name'])
if ((obj['repo_info']['commit_message'] is not None) and (obj[... |
58720a0e6a23c75bd42d3fda7974fea84478d4f1f886d98e1be3fed46644604e | def _delete(self, name, version):
' Delete an object from the repo\n\n Args:\n name (str): the identifier of the object\n version (str): the version of the object to delete\n '
super(RepoObjectGitStorage, self)._delete(name, version)
self.commit(((('deleting ' + name) + '... | Delete an object from the repo
Args:
name (str): the identifier of the object
version (str): the version of the object to delete | pailab/ml_repo/git_handler.py | _delete | pailabteam/pailab | 26 | python | def _delete(self, name, version):
' Delete an object from the repo\n\n Args:\n name (str): the identifier of the object\n version (str): the version of the object to delete\n '
super(RepoObjectGitStorage, self)._delete(name, version)
self.commit(((('deleting ' + name) + '... | def _delete(self, name, version):
' Delete an object from the repo\n\n Args:\n name (str): the identifier of the object\n version (str): the version of the object to delete\n '
super(RepoObjectGitStorage, self)._delete(name, version)
self.commit(((('deleting ' + name) + '... |
47a8cd9d053faa1c39c2506c11d42301879ff639ba0898d5458f051e1745b9df | def replace(self, obj):
' Overwrite existing object without incrementing version\n\n Args:\n obj (RepoObject): the repo object to be overwritten\n '
super(RepoObjectGitStorage, self).replace(obj)
self.commit((((('Replace object ' + obj['repo_info']['name']) + ', version ') + obj['re... | Overwrite existing object without incrementing version
Args:
obj (RepoObject): the repo object to be overwritten | pailab/ml_repo/git_handler.py | replace | pailabteam/pailab | 26 | python | def replace(self, obj):
' Overwrite existing object without incrementing version\n\n Args:\n obj (RepoObject): the repo object to be overwritten\n '
super(RepoObjectGitStorage, self).replace(obj)
self.commit((((('Replace object ' + obj['repo_info']['name']) + ', version ') + obj['re... | def replace(self, obj):
' Overwrite existing object without incrementing version\n\n Args:\n obj (RepoObject): the repo object to be overwritten\n '
super(RepoObjectGitStorage, self).replace(obj)
self.commit((((('Replace object ' + obj['repo_info']['name']) + ', version ') + obj['re... |
1efd5011dd5d6fd105e9879d194d5018a54e45bf740c49b61d411681f33a40e0 | def commit(self, message, force=True):
' Commits the changes\n\n Args:\n message (str): Commit message\n force (bool): If False, objecs will only be commited if integrity check succeeded.\n\n Raises:\n Exception: raises an exception if the integrity check fails\n ... | Commits the changes
Args:
message (str): Commit message
force (bool): If False, objecs will only be commited if integrity check succeeded.
Raises:
Exception: raises an exception if the integrity check fails | pailab/ml_repo/git_handler.py | commit | pailabteam/pailab | 26 | python | def commit(self, message, force=True):
' Commits the changes\n\n Args:\n message (str): Commit message\n force (bool): If False, objecs will only be commited if integrity check succeeded.\n\n Raises:\n Exception: raises an exception if the integrity check fails\n ... | def commit(self, message, force=True):
' Commits the changes\n\n Args:\n message (str): Commit message\n force (bool): If False, objecs will only be commited if integrity check succeeded.\n\n Raises:\n Exception: raises an exception if the integrity check fails\n ... |
e7016b72741b12fe7b268310c97d3148f56ff7b0a6eae25918a2c2747b234b61 | def push(self, remote_name='origin'):
" pushes the changes to the remote git repository\n\n Args:\n remote_name (str): name of the remote repository. Defaults to 'origin'.\n\n Raises:\n Exception: raises an exception if the remote does not exist\n "
_git_repo = Repo(se... | pushes the changes to the remote git repository
Args:
remote_name (str): name of the remote repository. Defaults to 'origin'.
Raises:
Exception: raises an exception if the remote does not exist | pailab/ml_repo/git_handler.py | push | pailabteam/pailab | 26 | python | def push(self, remote_name='origin'):
" pushes the changes to the remote git repository\n\n Args:\n remote_name (str): name of the remote repository. Defaults to 'origin'.\n\n Raises:\n Exception: raises an exception if the remote does not exist\n "
_git_repo = Repo(se... | def push(self, remote_name='origin'):
" pushes the changes to the remote git repository\n\n Args:\n remote_name (str): name of the remote repository. Defaults to 'origin'.\n\n Raises:\n Exception: raises an exception if the remote does not exist\n "
_git_repo = Repo(se... |
dc5ccef56f48376ec1c8698278ca9a936c0ce5f918a5d15370e354b2a649e7c6 | def _merge_from_db(self, sqlite_db_2):
' merges the changes from the sqlite db\n\n Args:\n sqlite_db_2 (str): filename of the database to be added\n '
c = self._conn.cursor()
c.execute((('ATTACH DATABASE "' + sqlite_db_2) + '" AS db_2'))
statement = 'INSERT OR IGNORE INTO versio... | merges the changes from the sqlite db
Args:
sqlite_db_2 (str): filename of the database to be added | pailab/ml_repo/git_handler.py | _merge_from_db | pailabteam/pailab | 26 | python | def _merge_from_db(self, sqlite_db_2):
' merges the changes from the sqlite db\n\n Args:\n sqlite_db_2 (str): filename of the database to be added\n '
c = self._conn.cursor()
c.execute((('ATTACH DATABASE "' + sqlite_db_2) + '" AS db_2'))
statement = 'INSERT OR IGNORE INTO versio... | def _merge_from_db(self, sqlite_db_2):
' merges the changes from the sqlite db\n\n Args:\n sqlite_db_2 (str): filename of the database to be added\n '
c = self._conn.cursor()
c.execute((('ATTACH DATABASE "' + sqlite_db_2) + '" AS db_2'))
statement = 'INSERT OR IGNORE INTO versio... |
bd1bd60156915af5448730ae27163c97ac8fe357696d4dc68cdad0f2f8cdcf61 | def pull(self, remote_name='origin'):
" Pull from the remote git repository\n\n Args:\n remote_name (str): the name of the remote git repository. Defaults to 'origin'.\n\n Raises:\n Exception: raises an exception if the remote name is not available\n Exception: raises ... | Pull from the remote git repository
Args:
remote_name (str): the name of the remote git repository. Defaults to 'origin'.
Raises:
Exception: raises an exception if the remote name is not available
Exception: raises an error if the pull fails | pailab/ml_repo/git_handler.py | pull | pailabteam/pailab | 26 | python | def pull(self, remote_name='origin'):
" Pull from the remote git repository\n\n Args:\n remote_name (str): the name of the remote git repository. Defaults to 'origin'.\n\n Raises:\n Exception: raises an exception if the remote name is not available\n Exception: raises ... | def pull(self, remote_name='origin'):
" Pull from the remote git repository\n\n Args:\n remote_name (str): the name of the remote git repository. Defaults to 'origin'.\n\n Raises:\n Exception: raises an exception if the remote name is not available\n Exception: raises ... |
8fb989aa049f1034b36849fe7244b11ddaec1be0bdccf34c0a88135c6b632adc | def register(self):
'\n not yet implemented\n :return:\n :rtype:\n '
phone = textwrap.dedent('\n phone_home:\n url: http://my.example.com/$INSTANCE_ID/\n post: [ pub_key_dsa, pub_key_rsa, pub_key_ecdsa, instance_id ]\n ')
self.add('register to ... | not yet implemented
:return:
:rtype: | deprecated/cloudinit.py | register | cloudmesh/cloudmesh_pi_burn | 16 | python | def register(self):
'\n not yet implemented\n :return:\n :rtype:\n '
phone = textwrap.dedent('\n phone_home:\n url: http://my.example.com/$INSTANCE_ID/\n post: [ pub_key_dsa, pub_key_rsa, pub_key_ecdsa, instance_id ]\n ')
self.add('register to ... | def register(self):
'\n not yet implemented\n :return:\n :rtype:\n '
phone = textwrap.dedent('\n phone_home:\n url: http://my.example.com/$INSTANCE_ID/\n post: [ pub_key_dsa, pub_key_rsa, pub_key_ecdsa, instance_id ]\n ')
self.add('register to ... |
a04d55e513a35f49bd794260ec078eb202c7a20bb6aa26a844a89402f5227d7d | def add_user(self, *, name, gecos, group, groups, expire, passwd):
'\n\n :param self:\n :type self:\n :param name:\n :type name:\n :param gecos: Firstname Lastname\n :type gecos: str\n :param group:\n :type group:\n :param groups:\n :type groups:... | :param self:
:type self:
:param name:
:type name:
:param gecos: Firstname Lastname
:type gecos: str
:param group:
:type group:
:param groups:
:type groups:
:param expire:
:type expire:
:param passwd:
:type passwd:
:return:
:rtype: | deprecated/cloudinit.py | add_user | cloudmesh/cloudmesh_pi_burn | 16 | python | def add_user(self, *, name, gecos, group, groups, expire, passwd):
'\n\n :param self:\n :type self:\n :param name:\n :type name:\n :param gecos: Firstname Lastname\n :type gecos: str\n :param group:\n :type group:\n :param groups:\n :type groups:... | def add_user(self, *, name, gecos, group, groups, expire, passwd):
'\n\n :param self:\n :type self:\n :param name:\n :type name:\n :param gecos: Firstname Lastname\n :type gecos: str\n :param group:\n :type group:\n :param groups:\n :type groups:... |
b37d0ae1cd709652ef5801823a40672a1a2d720e4ca57770063147fa830b7bf3 | def train_(self, batch_input):
' Keep own train_ as forward scores into sigmoid to get the activations (because the scores are not in [0,1])'
self.optimizer.zero_grad()
loss_all = {}
tp_all = {}
fp_all = {}
num_pos_all = {}
(scores, labels) = self(batch_input)
for (gram, is_active) in se... | Keep own train_ as forward scores into sigmoid to get the activations (because the scores are not in [0,1]) | networks/models.py | train_ | jpeyre/analogy | 22 | python | def train_(self, batch_input):
' '
self.optimizer.zero_grad()
loss_all = {}
tp_all = {}
fp_all = {}
num_pos_all = {}
(scores, labels) = self(batch_input)
for (gram, is_active) in self.activated_grams.iteritems():
if is_active:
if self.criterions[gram]:
... | def train_(self, batch_input):
' '
self.optimizer.zero_grad()
loss_all = {}
tp_all = {}
fp_all = {}
num_pos_all = {}
(scores, labels) = self(batch_input)
for (gram, is_active) in self.activated_grams.iteritems():
if is_active:
if self.criterions[gram]:
... |
3ab83b819e61650a302b2c09807ac2b08a201194b3d5b0cb160fcd961612d591 | def get_scores(self, batch_input):
' Scores produced by independent branches: p(s), p(o), p(r), p(sr), p(ro), p(sro) '
(scores_grams, _) = self(batch_input)
for (_, gram) in enumerate(self.activated_grams):
if self.activated_grams[gram]:
if ('ranking' in self.criterion_name):
... | Scores produced by independent branches: p(s), p(o), p(r), p(sr), p(ro), p(sro) | networks/models.py | get_scores | jpeyre/analogy | 22 | python | def get_scores(self, batch_input):
' '
(scores_grams, _) = self(batch_input)
for (_, gram) in enumerate(self.activated_grams):
if self.activated_grams[gram]:
if ('ranking' in self.criterion_name):
scores_grams[gram] = ((scores_grams[gram] + 1) / 2)
elif (self... | def get_scores(self, batch_input):
' '
(scores_grams, _) = self(batch_input)
for (_, gram) in enumerate(self.activated_grams):
if self.activated_grams[gram]:
if ('ranking' in self.criterion_name):
scores_grams[gram] = ((scores_grams[gram] + 1) / 2)
elif (self... |
c84ea29ade83e3acf68e2942ab34cd405373e55b31c5d0dec6c328a78014a8f7 | def __init__(self, id, param, seed):
'Initialize an Agent object.\n\n Params\n ======\n param: hyperparameter\n seed (int): random seed\n '
self.name = 'DDPG'
self.id = torch.tensor([id]).to(device)
self.seed = random.seed(seed)
self.gamma = param['gamma']
... | Initialize an Agent object.
Params
======
param: hyperparameter
seed (int): random seed | MADDPG/agent/DDPG.py | __init__ | dganbold/deep_reinforcement_learning | 7 | python | def __init__(self, id, param, seed):
'Initialize an Agent object.\n\n Params\n ======\n param: hyperparameter\n seed (int): random seed\n '
self.name = 'DDPG'
self.id = torch.tensor([id]).to(device)
self.seed = random.seed(seed)
self.gamma = param['gamma']
... | def __init__(self, id, param, seed):
'Initialize an Agent object.\n\n Params\n ======\n param: hyperparameter\n seed (int): random seed\n '
self.name = 'DDPG'
self.id = torch.tensor([id]).to(device)
self.seed = random.seed(seed)
self.gamma = param['gamma']
... |
816c4920326ba49470242c9445fe5f595d026fd5a770060fbd618972a927f313 | def act(self, state, noise_amplitude=0.0):
'Returns actions for given state as per current policy.\n\n Params\n ======\n state (array_like): current state\n add_noise (bool):\n '
state = torch.from_numpy(state).float().to(device)
self.actor_local.eval()
with to... | Returns actions for given state as per current policy.
Params
======
state (array_like): current state
add_noise (bool): | MADDPG/agent/DDPG.py | act | dganbold/deep_reinforcement_learning | 7 | python | def act(self, state, noise_amplitude=0.0):
'Returns actions for given state as per current policy.\n\n Params\n ======\n state (array_like): current state\n add_noise (bool):\n '
state = torch.from_numpy(state).float().to(device)
self.actor_local.eval()
with to... | def act(self, state, noise_amplitude=0.0):
'Returns actions for given state as per current policy.\n\n Params\n ======\n state (array_like): current state\n add_noise (bool):\n '
state = torch.from_numpy(state).float().to(device)
self.actor_local.eval()
with to... |
84a471c26c45b3192a032951db4e7288ce8d3f300b01c3e6f1301bf67fb01765 | def learn(self, experiences, next_actions, predicted_actions):
"Update policy and value parameters using given batch of experience tuples.\n\n Params\n ======\n experiences (Tuple[torch.Tensor]): tuple of (s, a, r, s', done) tuples\n next_actions (list): each agent's next_action ... | Update policy and value parameters using given batch of experience tuples.
Params
======
experiences (Tuple[torch.Tensor]): tuple of (s, a, r, s', done) tuples
next_actions (list): each agent's next_action (as calculated by it's actor)
predicted_actions (list): each agent's action (as calculated by it's ac... | MADDPG/agent/DDPG.py | learn | dganbold/deep_reinforcement_learning | 7 | python | def learn(self, experiences, next_actions, predicted_actions):
"Update policy and value parameters using given batch of experience tuples.\n\n Params\n ======\n experiences (Tuple[torch.Tensor]): tuple of (s, a, r, s', done) tuples\n next_actions (list): each agent's next_action ... | def learn(self, experiences, next_actions, predicted_actions):
"Update policy and value parameters using given batch of experience tuples.\n\n Params\n ======\n experiences (Tuple[torch.Tensor]): tuple of (s, a, r, s', done) tuples\n next_actions (list): each agent's next_action ... |
f50b158a1599f28e701ff3d1f381d4276b73e4595f43cef8eda977e9cd847f73 | def soft_update(self, source, target, tau):
'\n θ_target = τ*θ_local + (1 - τ)*θ_target\n Perform DDPG soft update (move target params toward source based on weight\n factor tau)\n Inputs:\n target (torch.nn.Module): Net to copy parameters to\n source (torch.nn.Modu... | θ_target = τ*θ_local + (1 - τ)*θ_target
Perform DDPG soft update (move target params toward source based on weight
factor tau)
Inputs:
target (torch.nn.Module): Net to copy parameters to
source (torch.nn.Module): Net whose parameters to copy
tau (float, 0 < x < 1): Weight factor for update | MADDPG/agent/DDPG.py | soft_update | dganbold/deep_reinforcement_learning | 7 | python | def soft_update(self, source, target, tau):
'\n θ_target = τ*θ_local + (1 - τ)*θ_target\n Perform DDPG soft update (move target params toward source based on weight\n factor tau)\n Inputs:\n target (torch.nn.Module): Net to copy parameters to\n source (torch.nn.Modu... | def soft_update(self, source, target, tau):
'\n θ_target = τ*θ_local + (1 - τ)*θ_target\n Perform DDPG soft update (move target params toward source based on weight\n factor tau)\n Inputs:\n target (torch.nn.Module): Net to copy parameters to\n source (torch.nn.Modu... |
82bd7644e4e2b77aa0a85a3b16d807afe4656c41b961ead66c587b1b9fc8c8b9 | def hard_update(self, source, target):
'\n θ_target = θ_local\n Copy network parameters from source to target\n Inputs:\n target (torch.nn.Module): Net to copy parameters to\n source (torch.nn.Module): Net whose parameters to copy\n '
for (target_param, param) i... | θ_target = θ_local
Copy network parameters from source to target
Inputs:
target (torch.nn.Module): Net to copy parameters to
source (torch.nn.Module): Net whose parameters to copy | MADDPG/agent/DDPG.py | hard_update | dganbold/deep_reinforcement_learning | 7 | python | def hard_update(self, source, target):
'\n θ_target = θ_local\n Copy network parameters from source to target\n Inputs:\n target (torch.nn.Module): Net to copy parameters to\n source (torch.nn.Module): Net whose parameters to copy\n '
for (target_param, param) i... | def hard_update(self, source, target):
'\n θ_target = θ_local\n Copy network parameters from source to target\n Inputs:\n target (torch.nn.Module): Net to copy parameters to\n source (torch.nn.Module): Net whose parameters to copy\n '
for (target_param, param) i... |
74872993a166b558b78ec374e8794a97f6e80ab584e051a96090856f622a2a32 | def __init__(self, prefix='', suffix='', mode='spin', speed=0.3, animation='|/-\\', symbol='.', length=4, runtime=False):
'\n Simple loading animation for console output. Runs as a separate thread.\n\n :param prefix: text before the loading animation (string)\n :param suffix: text after the loa... | Simple loading animation for console output. Runs as a separate thread.
:param prefix: text before the loading animation (string)
:param suffix: text after the loading animation (string)
:param mode: type of loading animation (string) - possible values: bar, spin
:param speed: iteration time in seconds (float)
:param ... | oap/bnp/loading.py | __init__ | lcsgrlch/oap | 0 | python | def __init__(self, prefix=, suffix=, mode='spin', speed=0.3, animation='|/-\\', symbol='.', length=4, runtime=False):
'\n Simple loading animation for console output. Runs as a separate thread.\n\n :param prefix: text before the loading animation (string)\n :param suffix: text after the loading... | def __init__(self, prefix=, suffix=, mode='spin', speed=0.3, animation='|/-\\', symbol='.', length=4, runtime=False):
'\n Simple loading animation for console output. Runs as a separate thread.\n\n :param prefix: text before the loading animation (string)\n :param suffix: text after the loading... |
ec0642aae57bdbdee25d0ed508c3e8bc9b86750f2072ec829511acbb826e5b46 | def test_wltc_checksums():
'\n\n ... NOTE::\n The printouts in this TC generate the table\n in :func:`wltp/cycles/cycles.cycle_checksums()`.\n '
dfs_dict = {'V': _calc_wltc_checksums(0, 0), 'VA0': _calc_wltc_checksums(0, (- 1), calc_sum=False), 'VA1': _calc_wltc_checksums(1, 0, calc_sum=Fals... | ... NOTE::
The printouts in this TC generate the table
in :func:`wltp/cycles/cycles.cycle_checksums()`. | tests/test_instances.py | test_wltc_checksums | ankostis/wltp | 11 | python | def test_wltc_checksums():
'\n\n ... NOTE::\n The printouts in this TC generate the table\n in :func:`wltp/cycles/cycles.cycle_checksums()`.\n '
dfs_dict = {'V': _calc_wltc_checksums(0, 0), 'VA0': _calc_wltc_checksums(0, (- 1), calc_sum=False), 'VA1': _calc_wltc_checksums(1, 0, calc_sum=Fals... | def test_wltc_checksums():
'\n\n ... NOTE::\n The printouts in this TC generate the table\n in :func:`wltp/cycles/cycles.cycle_checksums()`.\n '
dfs_dict = {'V': _calc_wltc_checksums(0, 0), 'VA0': _calc_wltc_checksums(0, (- 1), calc_sum=False), 'VA1': _calc_wltc_checksums(1, 0, calc_sum=Fals... |
4ad8b7985b894e30b45fcd84a13624f80b92b6d3cdbcaff19f0700b2342225ef | def find_root(f, a, b, xtol=1e-12, rtol=(2.0 ** (- 50)), maxiter=100, full_output=False):
"\n Numerically find a root of ``f`` on the closed interval `[a,b]`\n (or `[b,a]`) if possible, where ``f`` is a function in the one variable.\n Note: this function only works in fixed (machine) precision, it is not\n... | Numerically find a root of ``f`` on the closed interval `[a,b]`
(or `[b,a]`) if possible, where ``f`` is a function in the one variable.
Note: this function only works in fixed (machine) precision, it is not
possible to get arbitrary precision approximations with it.
INPUT:
- ``f`` -- a function of one variable or sy... | src/sage/numerical/optimize.py | find_root | sheerluck/sage | 1,742 | python | def find_root(f, a, b, xtol=1e-12, rtol=(2.0 ** (- 50)), maxiter=100, full_output=False):
"\n Numerically find a root of ``f`` on the closed interval `[a,b]`\n (or `[b,a]`) if possible, where ``f`` is a function in the one variable.\n Note: this function only works in fixed (machine) precision, it is not\n... | def find_root(f, a, b, xtol=1e-12, rtol=(2.0 ** (- 50)), maxiter=100, full_output=False):
"\n Numerically find a root of ``f`` on the closed interval `[a,b]`\n (or `[b,a]`) if possible, where ``f`` is a function in the one variable.\n Note: this function only works in fixed (machine) precision, it is not\n... |
8b27fab5620c1ac91a7f4b18c394507763ddb0d194612691606cee9062cb0023 | def find_local_maximum(f, a, b, tol=1.48e-08, maxfun=500):
'\n Numerically find a local maximum of the expression `f` on the interval\n `[a,b]` (or `[b,a]`) along with the point at which the maximum is attained.\n\n Note that this function only finds a *local* maximum, and not the\n global maximum on th... | Numerically find a local maximum of the expression `f` on the interval
`[a,b]` (or `[b,a]`) along with the point at which the maximum is attained.
Note that this function only finds a *local* maximum, and not the
global maximum on that interval -- see the examples with
:func:`find_local_maximum`.
See the documentatio... | src/sage/numerical/optimize.py | find_local_maximum | sheerluck/sage | 1,742 | python | def find_local_maximum(f, a, b, tol=1.48e-08, maxfun=500):
'\n Numerically find a local maximum of the expression `f` on the interval\n `[a,b]` (or `[b,a]`) along with the point at which the maximum is attained.\n\n Note that this function only finds a *local* maximum, and not the\n global maximum on th... | def find_local_maximum(f, a, b, tol=1.48e-08, maxfun=500):
'\n Numerically find a local maximum of the expression `f` on the interval\n `[a,b]` (or `[b,a]`) along with the point at which the maximum is attained.\n\n Note that this function only finds a *local* maximum, and not the\n global maximum on th... |
eb74255ad6fb6e76907a129c4bd7d818fe4cfcee3f5268f5e4891a097feffa07 | def find_local_minimum(f, a, b, tol=1.48e-08, maxfun=500):
"\n Numerically find a local minimum of the expression ``f`` on the\n interval `[a,b]` (or `[b,a]`) and the point at which it attains that\n minimum. Note that ``f`` must be a function of (at most) one\n variable.\n\n Note that this function... | Numerically find a local minimum of the expression ``f`` on the
interval `[a,b]` (or `[b,a]`) and the point at which it attains that
minimum. Note that ``f`` must be a function of (at most) one
variable.
Note that this function only finds a *local* minimum, and not the
global minimum on that interval -- see the examp... | src/sage/numerical/optimize.py | find_local_minimum | sheerluck/sage | 1,742 | python | def find_local_minimum(f, a, b, tol=1.48e-08, maxfun=500):
"\n Numerically find a local minimum of the expression ``f`` on the\n interval `[a,b]` (or `[b,a]`) and the point at which it attains that\n minimum. Note that ``f`` must be a function of (at most) one\n variable.\n\n Note that this function... | def find_local_minimum(f, a, b, tol=1.48e-08, maxfun=500):
"\n Numerically find a local minimum of the expression ``f`` on the\n interval `[a,b]` (or `[b,a]`) and the point at which it attains that\n minimum. Note that ``f`` must be a function of (at most) one\n variable.\n\n Note that this function... |
47d5998719ab83d6f6a98bd967fc21bde28a081c744d832d59d916a81f3719bb | def minimize(func, x0, gradient=None, hessian=None, algorithm='default', verbose=False, **args):
'\n This function is an interface to a variety of algorithms for computing\n the minimum of a function of several variables.\n\n INPUT:\n\n - ``func`` -- Either a symbolic function or a Python function whose... | This function is an interface to a variety of algorithms for computing
the minimum of a function of several variables.
INPUT:
- ``func`` -- Either a symbolic function or a Python function whose
argument is a tuple with `n` components
- ``x0`` -- Initial point for finding minimum.
- ``gradient`` -- Optional gradie... | src/sage/numerical/optimize.py | minimize | sheerluck/sage | 1,742 | python | def minimize(func, x0, gradient=None, hessian=None, algorithm='default', verbose=False, **args):
'\n This function is an interface to a variety of algorithms for computing\n the minimum of a function of several variables.\n\n INPUT:\n\n - ``func`` -- Either a symbolic function or a Python function whose... | def minimize(func, x0, gradient=None, hessian=None, algorithm='default', verbose=False, **args):
'\n This function is an interface to a variety of algorithms for computing\n the minimum of a function of several variables.\n\n INPUT:\n\n - ``func`` -- Either a symbolic function or a Python function whose... |
e4e2b1c7a3932302294cc9369fa11239fab94900c587d8acd38aa0819f071de5 | def minimize_constrained(func, cons, x0, gradient=None, algorithm='default', **args):
"\n Minimize a function with constraints.\n\n\n INPUT:\n\n - ``func`` -- Either a symbolic function, or a Python function whose\n argument is a tuple with n components\n\n - ``cons`` -- constraints. This should be... | Minimize a function with constraints.
INPUT:
- ``func`` -- Either a symbolic function, or a Python function whose
argument is a tuple with n components
- ``cons`` -- constraints. This should be either a function or list of
functions that must be positive. Alternatively, the constraints can
be specified as a l... | src/sage/numerical/optimize.py | minimize_constrained | sheerluck/sage | 1,742 | python | def minimize_constrained(func, cons, x0, gradient=None, algorithm='default', **args):
"\n Minimize a function with constraints.\n\n\n INPUT:\n\n - ``func`` -- Either a symbolic function, or a Python function whose\n argument is a tuple with n components\n\n - ``cons`` -- constraints. This should be... | def minimize_constrained(func, cons, x0, gradient=None, algorithm='default', **args):
"\n Minimize a function with constraints.\n\n\n INPUT:\n\n - ``func`` -- Either a symbolic function, or a Python function whose\n argument is a tuple with n components\n\n - ``cons`` -- constraints. This should be... |
4c468971fe8785708b9d94426ef98dc55235a8902300f61b1b5696dc944fe44a | def linear_program(c, G, h, A=None, b=None, solver=None):
"\n Solve the dual linear programs:\n\n - Minimize `c'x` subject to `Gx + s = h`, `Ax = b`, and `s \\geq 0` where\n `'` denotes transpose.\n\n - Maximize `-h'z - b'y` subject to `G'z + A'y + c = 0` and `z \\geq 0`.\n\n This function is dep... | Solve the dual linear programs:
- Minimize `c'x` subject to `Gx + s = h`, `Ax = b`, and `s \geq 0` where
`'` denotes transpose.
- Maximize `-h'z - b'y` subject to `G'z + A'y + c = 0` and `z \geq 0`.
This function is deprecated. Use :class:`MixedIntegerLinearProgram` instead.
This function depends on the option... | src/sage/numerical/optimize.py | linear_program | sheerluck/sage | 1,742 | python | def linear_program(c, G, h, A=None, b=None, solver=None):
"\n Solve the dual linear programs:\n\n - Minimize `c'x` subject to `Gx + s = h`, `Ax = b`, and `s \\geq 0` where\n `'` denotes transpose.\n\n - Maximize `-h'z - b'y` subject to `G'z + A'y + c = 0` and `z \\geq 0`.\n\n This function is dep... | def linear_program(c, G, h, A=None, b=None, solver=None):
"\n Solve the dual linear programs:\n\n - Minimize `c'x` subject to `Gx + s = h`, `Ax = b`, and `s \\geq 0` where\n `'` denotes transpose.\n\n - Maximize `-h'z - b'y` subject to `G'z + A'y + c = 0` and `z \\geq 0`.\n\n This function is dep... |
733ec729e3025ad8b68a107a517a71fbe1eba65911ab2d07448318cfbb458e79 | def find_fit(data, model, initial_guess=None, parameters=None, variables=None, solution_dict=False):
'\n Finds numerical estimates for the parameters of the function model to\n give a best fit to data.\n\n\n INPUT:\n\n - ``data`` -- A two dimensional table of floating point numbers of the\n form `[... | Finds numerical estimates for the parameters of the function model to
give a best fit to data.
INPUT:
- ``data`` -- A two dimensional table of floating point numbers of the
form `[[x_{1,1}, x_{1,2}, \ldots, x_{1,k}, f_1],
[x_{2,1}, x_{2,2}, \ldots, x_{2,k}, f_2],
\ldots,
[x_{n,1}, x_{n,2}, \ldots, x_{n,k}, f... | src/sage/numerical/optimize.py | find_fit | sheerluck/sage | 1,742 | python | def find_fit(data, model, initial_guess=None, parameters=None, variables=None, solution_dict=False):
'\n Finds numerical estimates for the parameters of the function model to\n give a best fit to data.\n\n\n INPUT:\n\n - ``data`` -- A two dimensional table of floating point numbers of the\n form `[... | def find_fit(data, model, initial_guess=None, parameters=None, variables=None, solution_dict=False):
'\n Finds numerical estimates for the parameters of the function model to\n give a best fit to data.\n\n\n INPUT:\n\n - ``data`` -- A two dimensional table of floating point numbers of the\n form `[... |
340f788f16b58e33c9bfe2559bbfb69bce1d0b6d1b674860e89b3479658c4e19 | def binpacking(items, maximum=1, k=None, solver=None, verbose=0, *, integrality_tolerance=0.001):
"\n Solve the bin packing problem.\n\n The Bin Packing problem is the following :\n\n Given a list of items of weights `p_i` and a real value `k`, what is the\n least number of bins such that all the items ... | Solve the bin packing problem.
The Bin Packing problem is the following :
Given a list of items of weights `p_i` and a real value `k`, what is the
least number of bins such that all the items can be packed in the bins,
while ensuring that the sum of the weights of the items packed in each bin
is at most `k` ?
For mo... | src/sage/numerical/optimize.py | binpacking | sheerluck/sage | 1,742 | python | def binpacking(items, maximum=1, k=None, solver=None, verbose=0, *, integrality_tolerance=0.001):
"\n Solve the bin packing problem.\n\n The Bin Packing problem is the following :\n\n Given a list of items of weights `p_i` and a real value `k`, what is the\n least number of bins such that all the items ... | def binpacking(items, maximum=1, k=None, solver=None, verbose=0, *, integrality_tolerance=0.001):
"\n Solve the bin packing problem.\n\n The Bin Packing problem is the following :\n\n Given a list of items of weights `p_i` and a real value `k`, what is the\n least number of bins such that all the items ... |
8c370aab50b0f59a58c5d70e4d909de2383225cf3efa72f09fb6c02df040e8aa | def update_core(self, doc, search_name):
'Update main data collection (db:asdf, collection:data).\n\n Args:\n doc (Dict): data for dataset to be added to\n main asdf data collection\n Returns:\n 0 - success\n 1 - error\n '
try:
... | Update main data collection (db:asdf, collection:data).
Args:
doc (Dict): data for dataset to be added to
main asdf data collection
Returns:
0 - success
1 - error | utils/ingest_database.py | update_core | aiddata/geo-hpc | 5 | python | def update_core(self, doc, search_name):
'Update main data collection (db:asdf, collection:data).\n\n Args:\n doc (Dict): data for dataset to be added to\n main asdf data collection\n Returns:\n 0 - success\n 1 - error\n '
try:
... | def update_core(self, doc, search_name):
'Update main data collection (db:asdf, collection:data).\n\n Args:\n doc (Dict): data for dataset to be added to\n main asdf data collection\n Returns:\n 0 - success\n 1 - error\n '
try:
... |
22b0a549bf25fcf35187bea9e644063f18933e272bead2599fe2022f2491f921 | def update_trackers(self, doc, search_name, existing=None):
'Update boundary tracker(s) and related collections.\n\n to do:\n *** add error handling for all inserts (above and below) ***\n *** remove previous inserts if later insert fails, etc. ***\n - remove core insert if tracker fails... | Update boundary tracker(s) and related collections.
to do:
*** add error handling for all inserts (above and below) ***
*** remove previous inserts if later insert fails, etc. ***
- remove core insert if tracker fails
- only insert partial of core document
- essential identifying info only: name, path, type, oth... | utils/ingest_database.py | update_trackers | aiddata/geo-hpc | 5 | python | def update_trackers(self, doc, search_name, existing=None):
'Update boundary tracker(s) and related collections.\n\n to do:\n *** add error handling for all inserts (above and below) ***\n *** remove previous inserts if later insert fails, etc. ***\n - remove core insert if tracker fails... | def update_trackers(self, doc, search_name, existing=None):
'Update boundary tracker(s) and related collections.\n\n to do:\n *** add error handling for all inserts (above and below) ***\n *** remove previous inserts if later insert fails, etc. ***\n - remove core insert if tracker fails... |
6a3defa79101b7e6450a636fb2ff7f03d7ee01e98d9351bb2bd122630687639d | def features_to_mongo(self, bnd_name):
'Add features for given boundary to feature collection\n '
bnd_info = self.db_asdf.data.find_one({'name': bnd_name})
if (bnd_info is None):
msg = 'Could not find boundary matching name ({0})'.format(bnd_name)
raise Exception(msg)
bnd_path = o... | Add features for given boundary to feature collection | utils/ingest_database.py | features_to_mongo | aiddata/geo-hpc | 5 | python | def features_to_mongo(self, bnd_name):
'\n '
bnd_info = self.db_asdf.data.find_one({'name': bnd_name})
if (bnd_info is None):
msg = 'Could not find boundary matching name ({0})'.format(bnd_name)
raise Exception(msg)
bnd_path = os.path.join(bnd_info['base'], bnd_info['resources'][0... | def features_to_mongo(self, bnd_name):
'\n '
bnd_info = self.db_asdf.data.find_one({'name': bnd_name})
if (bnd_info is None):
msg = 'Could not find boundary matching name ({0})'.format(bnd_name)
raise Exception(msg)
bnd_path = os.path.join(bnd_info['base'], bnd_info['resources'][0... |
ce4a28c48a578b9a207bbc7d450e5b184db7f62aafe709df111dd9d6be88cafa | def _get_cmd_params(self):
'Gets command parameters and combines them in the following order:\n - files [empty by default]\n - random seed\n - extra flags (from command line)\n - user flags (variant/fuzzer flags)\n - statusfile flags\n - mode flags (based on chosen mode)\n - sourc... | Gets command parameters and combines them in the following order:
- files [empty by default]
- random seed
- extra flags (from command line)
- user flags (variant/fuzzer flags)
- statusfile flags
- mode flags (based on chosen mode)
- source flags (from source code) [empty by default]
The best way to modi... | deps/src/node-v10.15.3/deps/v8/tools/testrunner/objects/testcase.py | _get_cmd_params | Mstronach/turicreate | 2,151 | python | def _get_cmd_params(self):
'Gets command parameters and combines them in the following order:\n - files [empty by default]\n - random seed\n - extra flags (from command line)\n - user flags (variant/fuzzer flags)\n - statusfile flags\n - mode flags (based on chosen mode)\n - sourc... | def _get_cmd_params(self):
'Gets command parameters and combines them in the following order:\n - files [empty by default]\n - random seed\n - extra flags (from command line)\n - user flags (variant/fuzzer flags)\n - statusfile flags\n - mode flags (based on chosen mode)\n - sourc... |
d8672229edb14bdaf1ca09ee757c26287b348b8afe74779ecfd4204fa0ad8fe6 | def _get_statusfile_flags(self):
'Gets runtime flags from a status file.\n\n Every outcome that starts with "--" is a flag.\n '
return self._statusfile_flags | Gets runtime flags from a status file.
Every outcome that starts with "--" is a flag. | deps/src/node-v10.15.3/deps/v8/tools/testrunner/objects/testcase.py | _get_statusfile_flags | Mstronach/turicreate | 2,151 | python | def _get_statusfile_flags(self):
'Gets runtime flags from a status file.\n\n Every outcome that starts with "--" is a flag.\n '
return self._statusfile_flags | def _get_statusfile_flags(self):
'Gets runtime flags from a status file.\n\n Every outcome that starts with "--" is a flag.\n '
return self._statusfile_flags<|docstring|>Gets runtime flags from a status file.
Every outcome that starts with "--" is a flag.<|endoftext|> |
d44b8bdc63a671451d845e58256fe215c2f8d4fc37deb6faed473152fd9afae2 | def __init__(self):
'\n Constructor\n '
TrainData_Flavour.__init__(self)
self.addBranches(['jet_pt', 'jet_eta', 'jet_phi']) | Constructor | modules/datastructures/TrainData_domainAda.py | __init__ | dntaylor/DeepJet | 1 | python | def __init__(self):
'\n \n '
TrainData_Flavour.__init__(self)
self.addBranches(['jet_pt', 'jet_eta', 'jet_phi']) | def __init__(self):
'\n \n '
TrainData_Flavour.__init__(self)
self.addBranches(['jet_pt', 'jet_eta', 'jet_phi'])<|docstring|>Constructor<|endoftext|> |
209ecc75a84e2e1b1a2ce8d762f5d3b02ceccb11be10e780cd37db8548301b26 | @run_in_test_environment()
def test_result_folder_creation(self):
'Checks if we get the correct result folder back.'
test_tmp_folder = str(os.getcwd())
bb_cfg()['varats']['outfile'] = (test_tmp_folder + '/results')
result_folder = EU.get_varats_result_folder(BBTestProject())
self.assertEqual(((test_... | Checks if we get the correct result folder back. | tests/utils/test_experiment_util.py | test_result_folder_creation | Kaufi-Jonas/VaRA-Tool-Suite | 8 | python | @run_in_test_environment()
def test_result_folder_creation(self):
test_tmp_folder = str(os.getcwd())
bb_cfg()['varats']['outfile'] = (test_tmp_folder + '/results')
result_folder = EU.get_varats_result_folder(BBTestProject())
self.assertEqual(((test_tmp_folder + '/results/') + BBTestProject.NAME), s... | @run_in_test_environment()
def test_result_folder_creation(self):
test_tmp_folder = str(os.getcwd())
bb_cfg()['varats']['outfile'] = (test_tmp_folder + '/results')
result_folder = EU.get_varats_result_folder(BBTestProject())
self.assertEqual(((test_tmp_folder + '/results/') + BBTestProject.NAME), s... |
7f486d66af75598dce843258d9492789a6d1f0fa7df30d72044bb080ea890b58 | @classmethod
def setUpClass(cls):
'Load and parse function infos from yaml file.'
cls.vers_expr = MockExperiment()
cls.rev_list = ['rev1000000', 'rev2000000', 'rev3000000', 'rev4000000', 'rev5000000'] | Load and parse function infos from yaml file. | tests/utils/test_experiment_util.py | setUpClass | Kaufi-Jonas/VaRA-Tool-Suite | 8 | python | @classmethod
def setUpClass(cls):
cls.vers_expr = MockExperiment()
cls.rev_list = ['rev1000000', 'rev2000000', 'rev3000000', 'rev4000000', 'rev5000000'] | @classmethod
def setUpClass(cls):
cls.vers_expr = MockExperiment()
cls.rev_list = ['rev1000000', 'rev2000000', 'rev3000000', 'rev4000000', 'rev5000000']<|docstring|>Load and parse function infos from yaml file.<|endoftext|> |
b370c660d794e1ec1bb1c8efe96c0ac642e288e7b23e89fa4e7b9b02365a9bd4 | def setUp(self):
'Set config to initial values.'
self.rev_list = ['rev1000000', 'rev2000000', 'rev3000000', 'rev4000000', 'rev5000000'] | Set config to initial values. | tests/utils/test_experiment_util.py | setUp | Kaufi-Jonas/VaRA-Tool-Suite | 8 | python | def setUp(self):
self.rev_list = ['rev1000000', 'rev2000000', 'rev3000000', 'rev4000000', 'rev5000000'] | def setUp(self):
self.rev_list = ['rev1000000', 'rev2000000', 'rev3000000', 'rev4000000', 'rev5000000']<|docstring|>Set config to initial values.<|endoftext|> |
35af0d61dbc5a0a8a7b386c296df0ee2aa6b0954bd3b8337b5d6593943d9fa96 | @staticmethod
def generate_get_tagged_revisions_output() -> tp.List[tp.Tuple[(ShortCommitHash, FileStatusExtension)]]:
'Generate get_tagged_revisions output for mocking.'
return [(ShortCommitHash('rev1000000'), FileStatusExtension.SUCCESS), (ShortCommitHash('rev2000000'), FileStatusExtension.BLOCKED), (ShortCom... | Generate get_tagged_revisions output for mocking. | tests/utils/test_experiment_util.py | generate_get_tagged_revisions_output | Kaufi-Jonas/VaRA-Tool-Suite | 8 | python | @staticmethod
def generate_get_tagged_revisions_output() -> tp.List[tp.Tuple[(ShortCommitHash, FileStatusExtension)]]:
return [(ShortCommitHash('rev1000000'), FileStatusExtension.SUCCESS), (ShortCommitHash('rev2000000'), FileStatusExtension.BLOCKED), (ShortCommitHash('rev3000000'), FileStatusExtension.COMPILE_... | @staticmethod
def generate_get_tagged_revisions_output() -> tp.List[tp.Tuple[(ShortCommitHash, FileStatusExtension)]]:
return [(ShortCommitHash('rev1000000'), FileStatusExtension.SUCCESS), (ShortCommitHash('rev2000000'), FileStatusExtension.BLOCKED), (ShortCommitHash('rev3000000'), FileStatusExtension.COMPILE_... |
a0c58328998a5169688df7559074b02e07b54ab3067916afb8d8a9f0b37cf529 | @run_in_test_environment()
def test_sample_limit(self):
'Test if base_hash is loaded correctly.'
self.prepare_vara_config(vara_cfg())
self.assertEqual(vara_cfg()['experiment']['sample_limit'].value, None)
self.assertEqual(self.vers_expr._sample_num_versions(self.rev_list), self.rev_list)
vara_cfg()[... | Test if base_hash is loaded correctly. | tests/utils/test_experiment_util.py | test_sample_limit | Kaufi-Jonas/VaRA-Tool-Suite | 8 | python | @run_in_test_environment()
def test_sample_limit(self):
self.prepare_vara_config(vara_cfg())
self.assertEqual(vara_cfg()['experiment']['sample_limit'].value, None)
self.assertEqual(self.vers_expr._sample_num_versions(self.rev_list), self.rev_list)
vara_cfg()['experiment']['sample_limit'] = 3
se... | @run_in_test_environment()
def test_sample_limit(self):
self.prepare_vara_config(vara_cfg())
self.assertEqual(vara_cfg()['experiment']['sample_limit'].value, None)
self.assertEqual(self.vers_expr._sample_num_versions(self.rev_list), self.rev_list)
vara_cfg()['experiment']['sample_limit'] = 3
se... |
b8398f661d60d06f458690ded9580a974dc4c6ef1cd89d6ffe90c78bebcfbf49 | @run_in_test_environment()
def test_without_versions(self):
'Test if we get the correct revision if no VaRA modifications are\n enabled.'
bb_cfg()['versions']['full'] = False
sample_gen = self.vers_expr.sample(BBTestProject)
self.assertEqual(sample_gen[0]['test_source'].version, 'rev1000000')
... | Test if we get the correct revision if no VaRA modifications are
enabled. | tests/utils/test_experiment_util.py | test_without_versions | Kaufi-Jonas/VaRA-Tool-Suite | 8 | python | @run_in_test_environment()
def test_without_versions(self):
'Test if we get the correct revision if no VaRA modifications are\n enabled.'
bb_cfg()['versions']['full'] = False
sample_gen = self.vers_expr.sample(BBTestProject)
self.assertEqual(sample_gen[0]['test_source'].version, 'rev1000000')
... | @run_in_test_environment()
def test_without_versions(self):
'Test if we get the correct revision if no VaRA modifications are\n enabled.'
bb_cfg()['versions']['full'] = False
sample_gen = self.vers_expr.sample(BBTestProject)
self.assertEqual(sample_gen[0]['test_source'].version, 'rev1000000')
... |
ac1cbf34cb88935c651f689de92ccbe493807c61e3c9b01737110616cff83f76 | @run_in_test_environment()
@mock.patch('varats.experiment.experiment_util.get_tagged_revisions')
def test_only_whitelisting_one(self, mock_get_tagged_revisions):
'Test if we can whitelist file status.'
self.prepare_vara_config(vara_cfg())
bb_cfg()['versions']['full'] = True
mock_get_tagged_revisions.ret... | Test if we can whitelist file status. | tests/utils/test_experiment_util.py | test_only_whitelisting_one | Kaufi-Jonas/VaRA-Tool-Suite | 8 | python | @run_in_test_environment()
@mock.patch('varats.experiment.experiment_util.get_tagged_revisions')
def test_only_whitelisting_one(self, mock_get_tagged_revisions):
self.prepare_vara_config(vara_cfg())
bb_cfg()['versions']['full'] = True
mock_get_tagged_revisions.return_value = self.generate_get_tagged_re... | @run_in_test_environment()
@mock.patch('varats.experiment.experiment_util.get_tagged_revisions')
def test_only_whitelisting_one(self, mock_get_tagged_revisions):
self.prepare_vara_config(vara_cfg())
bb_cfg()['versions']['full'] = True
mock_get_tagged_revisions.return_value = self.generate_get_tagged_re... |
726f2ad34a0d15086bba6630b27d92f70e9d1344a212e1e25884e40da49d27a0 | @run_in_test_environment()
@mock.patch('varats.experiment.experiment_util.get_tagged_revisions')
def test_only_whitelisting_many(self, mock_get_tagged_revisions):
'Test if we can whitelist file status.'
self.prepare_vara_config(vara_cfg())
bb_cfg()['versions']['full'] = True
mock_get_tagged_revisions.re... | Test if we can whitelist file status. | tests/utils/test_experiment_util.py | test_only_whitelisting_many | Kaufi-Jonas/VaRA-Tool-Suite | 8 | python | @run_in_test_environment()
@mock.patch('varats.experiment.experiment_util.get_tagged_revisions')
def test_only_whitelisting_many(self, mock_get_tagged_revisions):
self.prepare_vara_config(vara_cfg())
bb_cfg()['versions']['full'] = True
mock_get_tagged_revisions.return_value = self.generate_get_tagged_r... | @run_in_test_environment()
@mock.patch('varats.experiment.experiment_util.get_tagged_revisions')
def test_only_whitelisting_many(self, mock_get_tagged_revisions):
self.prepare_vara_config(vara_cfg())
bb_cfg()['versions']['full'] = True
mock_get_tagged_revisions.return_value = self.generate_get_tagged_r... |
68399d7b75c0db24cb386d219c33ec86a512c8ff4179fb19beaf4393ed02a96d | @run_in_test_environment()
@mock.patch('varats.experiment.experiment_util.get_tagged_revisions')
def test_only_blacklisting_one(self, mock_get_tagged_revisions):
'Test if we can blacklist file status.'
self.prepare_vara_config(vara_cfg())
bb_cfg()['versions']['full'] = True
mock_get_tagged_revisions.ret... | Test if we can blacklist file status. | tests/utils/test_experiment_util.py | test_only_blacklisting_one | Kaufi-Jonas/VaRA-Tool-Suite | 8 | python | @run_in_test_environment()
@mock.patch('varats.experiment.experiment_util.get_tagged_revisions')
def test_only_blacklisting_one(self, mock_get_tagged_revisions):
self.prepare_vara_config(vara_cfg())
bb_cfg()['versions']['full'] = True
mock_get_tagged_revisions.return_value = self.generate_get_tagged_re... | @run_in_test_environment()
@mock.patch('varats.experiment.experiment_util.get_tagged_revisions')
def test_only_blacklisting_one(self, mock_get_tagged_revisions):
self.prepare_vara_config(vara_cfg())
bb_cfg()['versions']['full'] = True
mock_get_tagged_revisions.return_value = self.generate_get_tagged_re... |
b8c542e612047e9a99def1cd1e8d4022b4f5241a9f32abfb71c8e5efe77c498b | @run_in_test_environment()
@mock.patch('varats.experiment.experiment_util.get_tagged_revisions')
def test_only_blacklisting_many(self, mock_get_tagged_revisions):
'Test if we can blacklist file status.'
self.prepare_vara_config(vara_cfg())
bb_cfg()['versions']['full'] = True
mock_get_tagged_revisions.re... | Test if we can blacklist file status. | tests/utils/test_experiment_util.py | test_only_blacklisting_many | Kaufi-Jonas/VaRA-Tool-Suite | 8 | python | @run_in_test_environment()
@mock.patch('varats.experiment.experiment_util.get_tagged_revisions')
def test_only_blacklisting_many(self, mock_get_tagged_revisions):
self.prepare_vara_config(vara_cfg())
bb_cfg()['versions']['full'] = True
mock_get_tagged_revisions.return_value = self.generate_get_tagged_r... | @run_in_test_environment()
@mock.patch('varats.experiment.experiment_util.get_tagged_revisions')
def test_only_blacklisting_many(self, mock_get_tagged_revisions):
self.prepare_vara_config(vara_cfg())
bb_cfg()['versions']['full'] = True
mock_get_tagged_revisions.return_value = self.generate_get_tagged_r... |
e7e3a02737d86d0e187f26f477c1c57a5b1ce725e546121582a5670372874b28 | @run_in_test_environment()
@mock.patch('varats.experiment.experiment_util.get_tagged_revisions')
def test_white_overwrite_blacklisting(self, mock_get_tagged_revisions):
'Test if whitelist overwrites blacklist.'
self.prepare_vara_config(vara_cfg())
bb_cfg()['versions']['full'] = True
mock_get_tagged_revi... | Test if whitelist overwrites blacklist. | tests/utils/test_experiment_util.py | test_white_overwrite_blacklisting | Kaufi-Jonas/VaRA-Tool-Suite | 8 | python | @run_in_test_environment()
@mock.patch('varats.experiment.experiment_util.get_tagged_revisions')
def test_white_overwrite_blacklisting(self, mock_get_tagged_revisions):
self.prepare_vara_config(vara_cfg())
bb_cfg()['versions']['full'] = True
mock_get_tagged_revisions.return_value = self.generate_get_ta... | @run_in_test_environment()
@mock.patch('varats.experiment.experiment_util.get_tagged_revisions')
def test_white_overwrite_blacklisting(self, mock_get_tagged_revisions):
self.prepare_vara_config(vara_cfg())
bb_cfg()['versions']['full'] = True
mock_get_tagged_revisions.return_value = self.generate_get_ta... |
d1fc51b3b5dfc10bb93ef5696c5bb2663efc022112aa88ce899defbcf8260db2 | @run_in_test_environment()
def test_zipped_result_folder_creation(self):
'Checks if a zipped result folder is automatically created.'
test_tmp_folder = Path(os.getcwd())
test_zip = (test_tmp_folder / 'FooBar.zip')
with EU.ZippedReportFolder(test_zip) as output_folder:
with open((Path(output_fold... | Checks if a zipped result folder is automatically created. | tests/utils/test_experiment_util.py | test_zipped_result_folder_creation | Kaufi-Jonas/VaRA-Tool-Suite | 8 | python | @run_in_test_environment()
def test_zipped_result_folder_creation(self):
test_tmp_folder = Path(os.getcwd())
test_zip = (test_tmp_folder / 'FooBar.zip')
with EU.ZippedReportFolder(test_zip) as output_folder:
with open((Path(output_folder) / 'foo.txt'), 'w') as output_file:
output_fi... | @run_in_test_environment()
def test_zipped_result_folder_creation(self):
test_tmp_folder = Path(os.getcwd())
test_zip = (test_tmp_folder / 'FooBar.zip')
with EU.ZippedReportFolder(test_zip) as output_folder:
with open((Path(output_folder) / 'foo.txt'), 'w') as output_file:
output_fi... |
3979adf796c25c3b2dc9e36dbad399a4d2b2c3863d143bb430c40982cf03e502 | def main():
' Run an ingestion task. Must specify -t <task-name>\n -t options\n coin_list - Update the list of cryptocurrencies with metadata and icons\n historical - Import historical data (price, volume, subreddit subscriber counts)\n current - Import current data (price, volume, subreddit... | Run an ingestion task. Must specify -t <task-name>
-t options
coin_list - Update the list of cryptocurrencies with metadata and icons
historical - Import historical data (price, volume, subreddit subscriber counts)
current - Import current data (price, volume, subreddit subscriber count, subreddit subscribe... | main.py | main | JesseCorrington/CryptoHypeTrader | 0 | python | def main():
' Run an ingestion task. Must specify -t <task-name>\n -t options\n coin_list - Update the list of cryptocurrencies with metadata and icons\n historical - Import historical data (price, volume, subreddit subscriber counts)\n current - Import current data (price, volume, subreddit... | def main():
' Run an ingestion task. Must specify -t <task-name>\n -t options\n coin_list - Update the list of cryptocurrencies with metadata and icons\n historical - Import historical data (price, volume, subreddit subscriber counts)\n current - Import current data (price, volume, subreddit... |
a73bd26772b40e8507ee06e64c1814eb22e8e32c4af8d05609da78284d9ec418 | @abstractmethod
def _handle_forwarder_event(self, event: BoboEvent) -> bool:
'\n Enables the forwarder to perform some action with the BoboEvent\n instance before it is sent to the subscribers of the forwarder.\n If the method returns True, the BoboEvent instance will be\n forwarded to s... | Enables the forwarder to perform some action with the BoboEvent
instance before it is sent to the subscribers of the forwarder.
If the method returns True, the BoboEvent instance will be
forwarded to subscribers.
:param event: The event.
:type event: BoboEvent
:return: True if event was successfully handled, False ot... | bobocep/forwarder/bobo_forwarder.py | _handle_forwarder_event | r3w0p/bobocep | 5 | python | @abstractmethod
def _handle_forwarder_event(self, event: BoboEvent) -> bool:
'\n Enables the forwarder to perform some action with the BoboEvent\n instance before it is sent to the subscribers of the forwarder.\n If the method returns True, the BoboEvent instance will be\n forwarded to s... | @abstractmethod
def _handle_forwarder_event(self, event: BoboEvent) -> bool:
'\n Enables the forwarder to perform some action with the BoboEvent\n instance before it is sent to the subscribers of the forwarder.\n If the method returns True, the BoboEvent instance will be\n forwarded to s... |
a332f4042079b781108d283633fb0f731ce63225702c0bb702fa7a129413da6e | def subscribe(self, subscriber: IForwarderSubscriber) -> None:
'\n :param subscriber: Subscribes to events from Forwarder.\n :type subscriber: IForwarderSubscriber\n '
with self._lock:
if (not self._is_cancelled):
if (subscriber not in self._subs):
self._... | :param subscriber: Subscribes to events from Forwarder.
:type subscriber: IForwarderSubscriber | bobocep/forwarder/bobo_forwarder.py | subscribe | r3w0p/bobocep | 5 | python | def subscribe(self, subscriber: IForwarderSubscriber) -> None:
'\n :param subscriber: Subscribes to events from Forwarder.\n :type subscriber: IForwarderSubscriber\n '
with self._lock:
if (not self._is_cancelled):
if (subscriber not in self._subs):
self._... | def subscribe(self, subscriber: IForwarderSubscriber) -> None:
'\n :param subscriber: Subscribes to events from Forwarder.\n :type subscriber: IForwarderSubscriber\n '
with self._lock:
if (not self._is_cancelled):
if (subscriber not in self._subs):
self._... |
da1ac69d0a23522616d47cb48f8bbf0cf20c01f9a61c055d335e8ed3f4790ca2 | def unsubscribe(self, unsubscriber: IForwarderSubscriber) -> None:
'\n :param unsubscriber: Unsubscribes to events from Forwarder.\n :type unsubscriber: IForwarderSubscriber\n '
with self._lock:
if (unsubscriber in self._subs):
self._subs.remove(unsubscriber) | :param unsubscriber: Unsubscribes to events from Forwarder.
:type unsubscriber: IForwarderSubscriber | bobocep/forwarder/bobo_forwarder.py | unsubscribe | r3w0p/bobocep | 5 | python | def unsubscribe(self, unsubscriber: IForwarderSubscriber) -> None:
'\n :param unsubscriber: Unsubscribes to events from Forwarder.\n :type unsubscriber: IForwarderSubscriber\n '
with self._lock:
if (unsubscriber in self._subs):
self._subs.remove(unsubscriber) | def unsubscribe(self, unsubscriber: IForwarderSubscriber) -> None:
'\n :param unsubscriber: Unsubscribes to events from Forwarder.\n :type unsubscriber: IForwarderSubscriber\n '
with self._lock:
if (unsubscriber in self._subs):
self._subs.remove(unsubscriber)<|docstring|... |
318ccae860c30c53c4ecee1d3979eecc1abae5fa13c86596d360c95f97d0a795 | def assertMessageHasHeaders(self, message, headers):
'\n Asserts that the `message` has all `headers`.\n\n message: can be an instance of an email.Message subclass or a string\n with the contents of an email message.\n headers: should be a set of (header-name, header-value) tupl... | Asserts that the `message` has all `headers`.
message: can be an instance of an email.Message subclass or a string
with the contents of an email message.
headers: should be a set of (header-name, header-value) tuples. | tests/mail/tests.py | assertMessageHasHeaders | jonashaag/django-1.1-python-3.7 | 5,079 | python | def assertMessageHasHeaders(self, message, headers):
'\n Asserts that the `message` has all `headers`.\n\n message: can be an instance of an email.Message subclass or a string\n with the contents of an email message.\n headers: should be a set of (header-name, header-value) tupl... | def assertMessageHasHeaders(self, message, headers):
'\n Asserts that the `message` has all `headers`.\n\n message: can be an instance of an email.Message subclass or a string\n with the contents of an email message.\n headers: should be a set of (header-name, header-value) tupl... |
c6fd98069f093927d2ba18aa669ad0c6f6aba7c6a00742e5c92d34a6d4dacef4 | def get_decoded_attachments(self, django_message):
"\n Encode the specified django.core.mail.message.EmailMessage, then decode\n it using Python's email.parser module and, for each attachment of the\n message, return a list of tuples with (filename, content, mimetype).\n "
msg_bytes ... | Encode the specified django.core.mail.message.EmailMessage, then decode
it using Python's email.parser module and, for each attachment of the
message, return a list of tuples with (filename, content, mimetype). | tests/mail/tests.py | get_decoded_attachments | jonashaag/django-1.1-python-3.7 | 5,079 | python | def get_decoded_attachments(self, django_message):
"\n Encode the specified django.core.mail.message.EmailMessage, then decode\n it using Python's email.parser module and, for each attachment of the\n message, return a list of tuples with (filename, content, mimetype).\n "
msg_bytes ... | def get_decoded_attachments(self, django_message):
"\n Encode the specified django.core.mail.message.EmailMessage, then decode\n it using Python's email.parser module and, for each attachment of the\n message, return a list of tuples with (filename, content, mimetype).\n "
msg_bytes ... |
3c3415fe88b5a14bc9985dd0257c2ef4997a6e16cff3b52792fd5021cae74c3b | def test_recipients_with_empty_strings(self):
'\n Empty strings in various recipient arguments are always stripped\n off the final recipient list.\n '
email = EmailMessage('Subject', 'Content', 'example@example.com', ['example@example.com', ''], cc=['example@example.com', ''], bcc=['', 'exa... | Empty strings in various recipient arguments are always stripped
off the final recipient list. | tests/mail/tests.py | test_recipients_with_empty_strings | jonashaag/django-1.1-python-3.7 | 5,079 | python | def test_recipients_with_empty_strings(self):
'\n Empty strings in various recipient arguments are always stripped\n off the final recipient list.\n '
email = EmailMessage('Subject', 'Content', 'example@example.com', ['example@example.com', ], cc=['example@example.com', ], bcc=[, 'example@e... | def test_recipients_with_empty_strings(self):
'\n Empty strings in various recipient arguments are always stripped\n off the final recipient list.\n '
email = EmailMessage('Subject', 'Content', 'example@example.com', ['example@example.com', ], cc=['example@example.com', ], bcc=[, 'example@e... |
973a5f9410f376b8b39180f4e2b77ccdd48e71dec96a0a5d29d3b2ce72f4e20a | def test_cc(self):
'Regression test for #7722'
email = EmailMessage('Subject', 'Content', 'example@example.com', ['example@example.com'], cc=['example@example.com'])
message = email.message()
self.assertEqual(message['Cc'], 'example@example.com')
self.assertEqual(email.recipients(), ['example@exampl... | Regression test for #7722 | tests/mail/tests.py | test_cc | jonashaag/django-1.1-python-3.7 | 5,079 | python | def test_cc(self):
email = EmailMessage('Subject', 'Content', 'example@example.com', ['example@example.com'], cc=['example@example.com'])
message = email.message()
self.assertEqual(message['Cc'], 'example@example.com')
self.assertEqual(email.recipients(), ['example@example.com', 'example@example.co... | def test_cc(self):
email = EmailMessage('Subject', 'Content', 'example@example.com', ['example@example.com'], cc=['example@example.com'])
message = email.message()
self.assertEqual(message['Cc'], 'example@example.com')
self.assertEqual(email.recipients(), ['example@example.com', 'example@example.co... |
34a1ff2f6972136ec1c66d58347eba884f0b1bd4074145a25f3ecc510d28d279 | def test_space_continuation(self):
'\n Test for space continuation character in long (ASCII) subject headers (#7747)\n '
email = EmailMessage('Long subject lines that get wrapped should contain a space continuation character to get expected behavior in Outlook and Thunderbird', 'Content', 'example... | Test for space continuation character in long (ASCII) subject headers (#7747) | tests/mail/tests.py | test_space_continuation | jonashaag/django-1.1-python-3.7 | 5,079 | python | def test_space_continuation(self):
'\n \n '
email = EmailMessage('Long subject lines that get wrapped should contain a space continuation character to get expected behavior in Outlook and Thunderbird', 'Content', 'example@example.com', ['example@example.com'])
message = email.message()
sel... | def test_space_continuation(self):
'\n \n '
email = EmailMessage('Long subject lines that get wrapped should contain a space continuation character to get expected behavior in Outlook and Thunderbird', 'Content', 'example@example.com', ['example@example.com'])
message = email.message()
sel... |
86e390f398fb65155fb2f2f87aaad2e1a4a3d5484d6adc537b0fb9cd17dbc015 | def test_message_header_overrides(self):
'\n Specifying dates or message-ids in the extra headers overrides the\n default values (#9233)\n '
headers = {'date': 'Fri, 09 Nov 2001 01:08:47 -0000', 'Message-ID': 'foo'}
email = EmailMessage('subject', 'content', 'example@example.com', ['exa... | Specifying dates or message-ids in the extra headers overrides the
default values (#9233) | tests/mail/tests.py | test_message_header_overrides | jonashaag/django-1.1-python-3.7 | 5,079 | python | def test_message_header_overrides(self):
'\n Specifying dates or message-ids in the extra headers overrides the\n default values (#9233)\n '
headers = {'date': 'Fri, 09 Nov 2001 01:08:47 -0000', 'Message-ID': 'foo'}
email = EmailMessage('subject', 'content', 'example@example.com', ['exa... | def test_message_header_overrides(self):
'\n Specifying dates or message-ids in the extra headers overrides the\n default values (#9233)\n '
headers = {'date': 'Fri, 09 Nov 2001 01:08:47 -0000', 'Message-ID': 'foo'}
email = EmailMessage('subject', 'content', 'example@example.com', ['exa... |
4ea7fc15f09be4477a49564ff8016a1162da76768b22763714de534e9f1aff0b | def test_from_header(self):
'\n Make sure we can manually set the From header (#9214)\n '
email = EmailMessage('Subject', 'Content', 'example@example.com', ['example@example.com'], headers={'From': 'example@example.com'})
message = email.message()
self.assertEqual(message['From'], 'example... | Make sure we can manually set the From header (#9214) | tests/mail/tests.py | test_from_header | jonashaag/django-1.1-python-3.7 | 5,079 | python | def test_from_header(self):
'\n \n '
email = EmailMessage('Subject', 'Content', 'example@example.com', ['example@example.com'], headers={'From': 'example@example.com'})
message = email.message()
self.assertEqual(message['From'], 'example@example.com') | def test_from_header(self):
'\n \n '
email = EmailMessage('Subject', 'Content', 'example@example.com', ['example@example.com'], headers={'From': 'example@example.com'})
message = email.message()
self.assertEqual(message['From'], 'example@example.com')<|docstring|>Make sure we can manually ... |
b94293fd7b887be0b663eac0c01b85875212de0a5ccb922754a072fc8ca0e1a0 | def test_to_header(self):
'\n Make sure we can manually set the To header (#17444)\n '
email = EmailMessage('Subject', 'Content', 'example@example.com', ['example@example.com', 'example@example.com'], headers={'To': 'example@example.com'})
message = email.message()
self.assertEqual(message... | Make sure we can manually set the To header (#17444) | tests/mail/tests.py | test_to_header | jonashaag/django-1.1-python-3.7 | 5,079 | python | def test_to_header(self):
'\n \n '
email = EmailMessage('Subject', 'Content', 'example@example.com', ['example@example.com', 'example@example.com'], headers={'To': 'example@example.com'})
message = email.message()
self.assertEqual(message['To'], 'example@example.com')
self.assertEqual(... | def test_to_header(self):
'\n \n '
email = EmailMessage('Subject', 'Content', 'example@example.com', ['example@example.com', 'example@example.com'], headers={'To': 'example@example.com'})
message = email.message()
self.assertEqual(message['To'], 'example@example.com')
self.assertEqual(... |
bd435d7780e7f07f0e943dfd644d1e54cb6c5bfee4f9b5461cac9ecf3ddb9e07 | def test_reply_to_header(self):
"\n Specifying 'Reply-To' in headers should override reply_to.\n "
email = EmailMessage('Subject', 'Content', 'example@example.com', ['example@example.com'], reply_to=['example@example.com'], headers={'Reply-To': 'example@example.com'})
message = email.message()... | Specifying 'Reply-To' in headers should override reply_to. | tests/mail/tests.py | test_reply_to_header | jonashaag/django-1.1-python-3.7 | 5,079 | python | def test_reply_to_header(self):
"\n \n "
email = EmailMessage('Subject', 'Content', 'example@example.com', ['example@example.com'], reply_to=['example@example.com'], headers={'Reply-To': 'example@example.com'})
message = email.message()
self.assertEqual(message['Reply-To'], 'example@exampl... | def test_reply_to_header(self):
"\n \n "
email = EmailMessage('Subject', 'Content', 'example@example.com', ['example@example.com'], reply_to=['example@example.com'], headers={'Reply-To': 'example@example.com'})
message = email.message()
self.assertEqual(message['Reply-To'], 'example@exampl... |
d23c5c4ba82e1a083a7ba721d6eb97bcedb7282247252c29038da6fcad856961 | def test_multiple_message_call(self):
'\n Regression for #13259 - Make sure that headers are not changed when\n calling EmailMessage.message()\n '
email = EmailMessage('Subject', 'Content', 'example@example.com', ['example@example.com'], headers={'From': 'example@example.com'})
message ... | Regression for #13259 - Make sure that headers are not changed when
calling EmailMessage.message() | tests/mail/tests.py | test_multiple_message_call | jonashaag/django-1.1-python-3.7 | 5,079 | python | def test_multiple_message_call(self):
'\n Regression for #13259 - Make sure that headers are not changed when\n calling EmailMessage.message()\n '
email = EmailMessage('Subject', 'Content', 'example@example.com', ['example@example.com'], headers={'From': 'example@example.com'})
message ... | def test_multiple_message_call(self):
'\n Regression for #13259 - Make sure that headers are not changed when\n calling EmailMessage.message()\n '
email = EmailMessage('Subject', 'Content', 'example@example.com', ['example@example.com'], headers={'From': 'example@example.com'})
message ... |
ead9cce00d3d1f6a62d67d60450ff16b2ba8b88dfd547f19c381a1d908a68d9d | def test_unicode_address_header(self):
'\n Regression for #11144 - When a to/from/cc header contains unicode,\n make sure the email addresses are parsed correctly (especially with\n regards to commas)\n '
email = EmailMessage('Subject', 'Content', 'example@example.com', ['"Firstname ... | Regression for #11144 - When a to/from/cc header contains unicode,
make sure the email addresses are parsed correctly (especially with
regards to commas) | tests/mail/tests.py | test_unicode_address_header | jonashaag/django-1.1-python-3.7 | 5,079 | python | def test_unicode_address_header(self):
'\n Regression for #11144 - When a to/from/cc header contains unicode,\n make sure the email addresses are parsed correctly (especially with\n regards to commas)\n '
email = EmailMessage('Subject', 'Content', 'example@example.com', ['"Firstname ... | def test_unicode_address_header(self):
'\n Regression for #11144 - When a to/from/cc header contains unicode,\n make sure the email addresses are parsed correctly (especially with\n regards to commas)\n '
email = EmailMessage('Subject', 'Content', 'example@example.com', ['"Firstname ... |
796ae388ad68a353cfa0a17a4207c7c40a70270259e5f2f5bbe0f864efec0451 | def test_safe_mime_multipart(self):
'\n Make sure headers can be set with a different encoding than utf-8 in\n SafeMIMEMultipart as well\n '
headers = {'Date': 'Fri, 09 Nov 2001 01:08:47 -0000', 'Message-ID': 'foo'}
(from_email, to) = ('example@example.com', '"Sürname, Firstname" <examp... | Make sure headers can be set with a different encoding than utf-8 in
SafeMIMEMultipart as well | tests/mail/tests.py | test_safe_mime_multipart | jonashaag/django-1.1-python-3.7 | 5,079 | python | def test_safe_mime_multipart(self):
'\n Make sure headers can be set with a different encoding than utf-8 in\n SafeMIMEMultipart as well\n '
headers = {'Date': 'Fri, 09 Nov 2001 01:08:47 -0000', 'Message-ID': 'foo'}
(from_email, to) = ('example@example.com', '"Sürname, Firstname" <examp... | def test_safe_mime_multipart(self):
'\n Make sure headers can be set with a different encoding than utf-8 in\n SafeMIMEMultipart as well\n '
headers = {'Date': 'Fri, 09 Nov 2001 01:08:47 -0000', 'Message-ID': 'foo'}
(from_email, to) = ('example@example.com', '"Sürname, Firstname" <examp... |
f1d948ce2fe67cbbd2eb2ca6adbbaf03f3663938546d52c4318e28a1c6e560ea | def test_encoding(self):
'\n Regression for #12791 - Encode body correctly with other encodings\n than utf-8\n '
email = EmailMessage('Subject', 'Firstname Sürname is a great guy.', 'example@example.com', ['example@example.com'])
email.encoding = 'iso-8859-1'
message = email.message... | Regression for #12791 - Encode body correctly with other encodings
than utf-8 | tests/mail/tests.py | test_encoding | jonashaag/django-1.1-python-3.7 | 5,079 | python | def test_encoding(self):
'\n Regression for #12791 - Encode body correctly with other encodings\n than utf-8\n '
email = EmailMessage('Subject', 'Firstname Sürname is a great guy.', 'example@example.com', ['example@example.com'])
email.encoding = 'iso-8859-1'
message = email.message... | def test_encoding(self):
'\n Regression for #12791 - Encode body correctly with other encodings\n than utf-8\n '
email = EmailMessage('Subject', 'Firstname Sürname is a great guy.', 'example@example.com', ['example@example.com'])
email.encoding = 'iso-8859-1'
message = email.message... |
dd1c716b035326180b0ca3717a796713635f53f95faec27b355bd093cac0137f | def test_attachments(self):
'Regression test for #9367'
headers = {'Date': 'Fri, 09 Nov 2001 01:08:47 -0000', 'Message-ID': 'foo'}
(subject, from_email, to) = ('hello', 'example@example.com', 'example@example.com')
text_content = 'This is an important message.'
html_content = '<p>This is an <strong>... | Regression test for #9367 | tests/mail/tests.py | test_attachments | jonashaag/django-1.1-python-3.7 | 5,079 | python | def test_attachments(self):
headers = {'Date': 'Fri, 09 Nov 2001 01:08:47 -0000', 'Message-ID': 'foo'}
(subject, from_email, to) = ('hello', 'example@example.com', 'example@example.com')
text_content = 'This is an important message.'
html_content = '<p>This is an <strong>important</strong> message.... | def test_attachments(self):
headers = {'Date': 'Fri, 09 Nov 2001 01:08:47 -0000', 'Message-ID': 'foo'}
(subject, from_email, to) = ('hello', 'example@example.com', 'example@example.com')
text_content = 'This is an important message.'
html_content = '<p>This is an <strong>important</strong> message.... |
acf769f603332f831feeb55a4ace17ed525d27f15d0e884f748d326d8aaf4da5 | def test_non_ascii_attachment_filename(self):
'Regression test for #14964'
headers = {'Date': 'Fri, 09 Nov 2001 01:08:47 -0000', 'Message-ID': 'foo'}
(subject, from_email, to) = ('hello', 'example@example.com', 'example@example.com')
content = 'This is the message.'
msg = EmailMessage(subject, conte... | Regression test for #14964 | tests/mail/tests.py | test_non_ascii_attachment_filename | jonashaag/django-1.1-python-3.7 | 5,079 | python | def test_non_ascii_attachment_filename(self):
headers = {'Date': 'Fri, 09 Nov 2001 01:08:47 -0000', 'Message-ID': 'foo'}
(subject, from_email, to) = ('hello', 'example@example.com', 'example@example.com')
content = 'This is the message.'
msg = EmailMessage(subject, content, from_email, [to], header... | def test_non_ascii_attachment_filename(self):
headers = {'Date': 'Fri, 09 Nov 2001 01:08:47 -0000', 'Message-ID': 'foo'}
(subject, from_email, to) = ('hello', 'example@example.com', 'example@example.com')
content = 'This is the message.'
msg = EmailMessage(subject, content, from_email, [to], header... |
1b5f05529379e58bf1f2062ae938701bc36bb817ca6e922065525028905b7bdf | def test_attach_file(self):
'\n Test attaching a file against different mimetypes and make sure that\n a file will be attached and sent properly even if an invalid mimetype\n is specified.\n '
files = (('file.txt', 'text/plain'), ('file.png', 'image/png'), ('file_txt', None), ('file_... | Test attaching a file against different mimetypes and make sure that
a file will be attached and sent properly even if an invalid mimetype
is specified. | tests/mail/tests.py | test_attach_file | jonashaag/django-1.1-python-3.7 | 5,079 | python | def test_attach_file(self):
'\n Test attaching a file against different mimetypes and make sure that\n a file will be attached and sent properly even if an invalid mimetype\n is specified.\n '
files = (('file.txt', 'text/plain'), ('file.png', 'image/png'), ('file_txt', None), ('file_... | def test_attach_file(self):
'\n Test attaching a file against different mimetypes and make sure that\n a file will be attached and sent properly even if an invalid mimetype\n is specified.\n '
files = (('file.txt', 'text/plain'), ('file.png', 'image/png'), ('file_txt', None), ('file_... |
727bf4b3a1c0ea6f6f4ff6e4d3e0116b8aaf14f8ba8c7a734c82e4aaaff5ab9e | def test_attach_utf8_text_as_bytes(self):
'\n Non-ASCII characters encoded as valid UTF-8 are correctly transported\n and decoded.\n '
msg = EmailMessage('subject', 'body', 'example@example.com', ['example@example.com'])
msg.attach('file.txt', b'\xc3\xa4')
(filename, content, mimety... | Non-ASCII characters encoded as valid UTF-8 are correctly transported
and decoded. | tests/mail/tests.py | test_attach_utf8_text_as_bytes | jonashaag/django-1.1-python-3.7 | 5,079 | python | def test_attach_utf8_text_as_bytes(self):
'\n Non-ASCII characters encoded as valid UTF-8 are correctly transported\n and decoded.\n '
msg = EmailMessage('subject', 'body', 'example@example.com', ['example@example.com'])
msg.attach('file.txt', b'\xc3\xa4')
(filename, content, mimety... | def test_attach_utf8_text_as_bytes(self):
'\n Non-ASCII characters encoded as valid UTF-8 are correctly transported\n and decoded.\n '
msg = EmailMessage('subject', 'body', 'example@example.com', ['example@example.com'])
msg.attach('file.txt', b'\xc3\xa4')
(filename, content, mimety... |
6cc5a54330e58760b21eebf2a0acd3df3e1ea46e7f8f51c7e7afd2970912fe94 | def test_attach_non_utf8_text_as_bytes(self):
"\n Binary data that can't be decoded as UTF-8 overrides the MIME type\n instead of decoding the data.\n "
msg = EmailMessage('subject', 'body', 'example@example.com', ['example@example.com'])
msg.attach('file.txt', b'\xff')
(filename, c... | Binary data that can't be decoded as UTF-8 overrides the MIME type
instead of decoding the data. | tests/mail/tests.py | test_attach_non_utf8_text_as_bytes | jonashaag/django-1.1-python-3.7 | 5,079 | python | def test_attach_non_utf8_text_as_bytes(self):
"\n Binary data that can't be decoded as UTF-8 overrides the MIME type\n instead of decoding the data.\n "
msg = EmailMessage('subject', 'body', 'example@example.com', ['example@example.com'])
msg.attach('file.txt', b'\xff')
(filename, c... | def test_attach_non_utf8_text_as_bytes(self):
"\n Binary data that can't be decoded as UTF-8 overrides the MIME type\n instead of decoding the data.\n "
msg = EmailMessage('subject', 'body', 'example@example.com', ['example@example.com'])
msg.attach('file.txt', b'\xff')
(filename, c... |
59ebc2c25363e97311a1717331ee2dcc9e523407dcc2a4aa87acdb9af30c7930 | def test_dummy_backend(self):
'\n Make sure that dummy backends returns correct number of sent messages\n '
connection = dummy.EmailBackend()
email = EmailMessage('Subject', 'Content', 'example@example.com', ['example@example.com'], headers={'From': 'example@example.com'})
self.assertEqual... | Make sure that dummy backends returns correct number of sent messages | tests/mail/tests.py | test_dummy_backend | jonashaag/django-1.1-python-3.7 | 5,079 | python | def test_dummy_backend(self):
'\n \n '
connection = dummy.EmailBackend()
email = EmailMessage('Subject', 'Content', 'example@example.com', ['example@example.com'], headers={'From': 'example@example.com'})
self.assertEqual(connection.send_messages([email, email, email]), 3) | def test_dummy_backend(self):
'\n \n '
connection = dummy.EmailBackend()
email = EmailMessage('Subject', 'Content', 'example@example.com', ['example@example.com'], headers={'From': 'example@example.com'})
self.assertEqual(connection.send_messages([email, email, email]), 3)<|docstring|>Make... |
ed86a2f11a670fb67d3fe5340962b6b0f38323f84982800d07188813346b67c8 | def test_arbitrary_keyword(self):
'\n Make sure that get_connection() accepts arbitrary keyword that might be\n used with custom backends.\n '
c = mail.get_connection(fail_silently=True, foo='bar')
self.assertTrue(c.fail_silently) | Make sure that get_connection() accepts arbitrary keyword that might be
used with custom backends. | tests/mail/tests.py | test_arbitrary_keyword | jonashaag/django-1.1-python-3.7 | 5,079 | python | def test_arbitrary_keyword(self):
'\n Make sure that get_connection() accepts arbitrary keyword that might be\n used with custom backends.\n '
c = mail.get_connection(fail_silently=True, foo='bar')
self.assertTrue(c.fail_silently) | def test_arbitrary_keyword(self):
'\n Make sure that get_connection() accepts arbitrary keyword that might be\n used with custom backends.\n '
c = mail.get_connection(fail_silently=True, foo='bar')
self.assertTrue(c.fail_silently)<|docstring|>Make sure that get_connection() accepts arbi... |
874a31db5ec6c2f4f0fe0c9ca5b55b2e591cdd489de3e50159fe07b4d3b81e58 | def test_custom_backend(self):
'Test custom backend defined in this suite.'
conn = mail.get_connection('mail.custombackend.EmailBackend')
self.assertTrue(hasattr(conn, 'test_outbox'))
email = EmailMessage('Subject', 'Content', 'example@example.com', ['example@example.com'], headers={'From': 'example@exa... | Test custom backend defined in this suite. | tests/mail/tests.py | test_custom_backend | jonashaag/django-1.1-python-3.7 | 5,079 | python | def test_custom_backend(self):
conn = mail.get_connection('mail.custombackend.EmailBackend')
self.assertTrue(hasattr(conn, 'test_outbox'))
email = EmailMessage('Subject', 'Content', 'example@example.com', ['example@example.com'], headers={'From': 'example@example.com'})
conn.send_messages([email])
... | def test_custom_backend(self):
conn = mail.get_connection('mail.custombackend.EmailBackend')
self.assertTrue(hasattr(conn, 'test_outbox'))
email = EmailMessage('Subject', 'Content', 'example@example.com', ['example@example.com'], headers={'From': 'example@example.com'})
conn.send_messages([email])
... |
0d8d1baf055d76005d16e381ba3e7c26d35d78e1a1d1d80e28396da3ff266c25 | def test_backend_arg(self):
'Test backend argument of mail.get_connection()'
self.assertIsInstance(mail.get_connection('django.core.mail.backends.smtp.EmailBackend'), smtp.EmailBackend)
self.assertIsInstance(mail.get_connection('django.core.mail.backends.locmem.EmailBackend'), locmem.EmailBackend)
self.... | Test backend argument of mail.get_connection() | tests/mail/tests.py | test_backend_arg | jonashaag/django-1.1-python-3.7 | 5,079 | python | def test_backend_arg(self):
self.assertIsInstance(mail.get_connection('django.core.mail.backends.smtp.EmailBackend'), smtp.EmailBackend)
self.assertIsInstance(mail.get_connection('django.core.mail.backends.locmem.EmailBackend'), locmem.EmailBackend)
self.assertIsInstance(mail.get_connection('django.cor... | def test_backend_arg(self):
self.assertIsInstance(mail.get_connection('django.core.mail.backends.smtp.EmailBackend'), smtp.EmailBackend)
self.assertIsInstance(mail.get_connection('django.core.mail.backends.locmem.EmailBackend'), locmem.EmailBackend)
self.assertIsInstance(mail.get_connection('django.cor... |
5a2017bb9c66590921dc57e1093df7f6cd0fd4544096e542f187287161873bf9 | @override_settings(EMAIL_BACKEND='django.core.mail.backends.locmem.EmailBackend', ADMINS=[('nobody', 'example@example.com')], MANAGERS=[('nobody', 'example@example.com')])
def test_connection_arg(self):
'Test connection argument to send_mail(), et. al.'
mail.outbox = []
connection = mail.get_connection('mai... | Test connection argument to send_mail(), et. al. | tests/mail/tests.py | test_connection_arg | jonashaag/django-1.1-python-3.7 | 5,079 | python | @override_settings(EMAIL_BACKEND='django.core.mail.backends.locmem.EmailBackend', ADMINS=[('nobody', 'example@example.com')], MANAGERS=[('nobody', 'example@example.com')])
def test_connection_arg(self):
mail.outbox = []
connection = mail.get_connection('mail.custombackend.EmailBackend')
send_mail('Subj... | @override_settings(EMAIL_BACKEND='django.core.mail.backends.locmem.EmailBackend', ADMINS=[('nobody', 'example@example.com')], MANAGERS=[('nobody', 'example@example.com')])
def test_connection_arg(self):
mail.outbox = []
connection = mail.get_connection('mail.custombackend.EmailBackend')
send_mail('Subj... |
b9bbe093016224751e2da651d81d3178ebfb7915b6ec56054955eb03017007b5 | def test_sanitize_address(self):
'\n Email addresses are properly sanitized.\n '
self.assertEqual(sanitize_address('example@example.com', 'ascii'), 'example@example.com')
self.assertEqual(sanitize_address('example@example.com', 'utf-8'), 'example@example.com')
self.assertEqual(sanitize_add... | Email addresses are properly sanitized. | tests/mail/tests.py | test_sanitize_address | jonashaag/django-1.1-python-3.7 | 5,079 | python | def test_sanitize_address(self):
'\n \n '
self.assertEqual(sanitize_address('example@example.com', 'ascii'), 'example@example.com')
self.assertEqual(sanitize_address('example@example.com', 'utf-8'), 'example@example.com')
self.assertEqual(sanitize_address(b'example@example.com', 'utf-8'), ... | def test_sanitize_address(self):
'\n \n '
self.assertEqual(sanitize_address('example@example.com', 'ascii'), 'example@example.com')
self.assertEqual(sanitize_address('example@example.com', 'utf-8'), 'example@example.com')
self.assertEqual(sanitize_address(b'example@example.com', 'utf-8'), ... |
82532ad1a792fee780de52357ada19501c54acc5d642d49b81aae2881834a6d7 | @override_settings(EMAIL_USE_LOCALTIME=False, USE_TZ=True, TIME_ZONE='Africa/Algiers')
def test_date_header_utc(self):
'\n EMAIL_USE_LOCALTIME=False creates a datetime in UTC.\n '
email = EmailMessage('Subject', 'Body', 'example@example.com', ['example@example.com'])
self.assertTrue(email.mess... | EMAIL_USE_LOCALTIME=False creates a datetime in UTC. | tests/mail/tests.py | test_date_header_utc | jonashaag/django-1.1-python-3.7 | 5,079 | python | @override_settings(EMAIL_USE_LOCALTIME=False, USE_TZ=True, TIME_ZONE='Africa/Algiers')
def test_date_header_utc(self):
'\n \n '
email = EmailMessage('Subject', 'Body', 'example@example.com', ['example@example.com'])
self.assertTrue(email.message()['Date'].endswith('-0000')) | @override_settings(EMAIL_USE_LOCALTIME=False, USE_TZ=True, TIME_ZONE='Africa/Algiers')
def test_date_header_utc(self):
'\n \n '
email = EmailMessage('Subject', 'Body', 'example@example.com', ['example@example.com'])
self.assertTrue(email.message()['Date'].endswith('-0000'))<|docstring|>EMAIL_U... |
27ec079c5647b6d7e68fefdbe70cca033bca9cc500d9a31fb703dfdf71e89d58 | @override_settings(EMAIL_USE_LOCALTIME=True, USE_TZ=True, TIME_ZONE='Africa/Algiers')
def test_date_header_localtime(self):
'\n EMAIL_USE_LOCALTIME=True creates a datetime in the local time zone.\n '
email = EmailMessage('Subject', 'Body', 'example@example.com', ['example@example.com'])
self.a... | EMAIL_USE_LOCALTIME=True creates a datetime in the local time zone. | tests/mail/tests.py | test_date_header_localtime | jonashaag/django-1.1-python-3.7 | 5,079 | python | @override_settings(EMAIL_USE_LOCALTIME=True, USE_TZ=True, TIME_ZONE='Africa/Algiers')
def test_date_header_localtime(self):
'\n \n '
email = EmailMessage('Subject', 'Body', 'example@example.com', ['example@example.com'])
self.assertTrue(email.message()['Date'].endswith('+0100')) | @override_settings(EMAIL_USE_LOCALTIME=True, USE_TZ=True, TIME_ZONE='Africa/Algiers')
def test_date_header_localtime(self):
'\n \n '
email = EmailMessage('Subject', 'Body', 'example@example.com', ['example@example.com'])
self.assertTrue(email.message()['Date'].endswith('+0100'))<|docstring|>EM... |
a77aab479715ec8b682f0b6f57bbadd666e57fbaf7d9d0cec44e487f67ddd2ac | def test_send_long_lines(self):
'\n Email line length is limited to 998 chars by the RFC:\n https://tools.ietf.org/html/rfc5322#section-2.1.1\n Message body containing longer lines are converted to Quoted-Printable\n to avoid having to insert newlines, which could be hairy to do properly... | Email line length is limited to 998 chars by the RFC:
https://tools.ietf.org/html/rfc5322#section-2.1.1
Message body containing longer lines are converted to Quoted-Printable
to avoid having to insert newlines, which could be hairy to do properly. | tests/mail/tests.py | test_send_long_lines | jonashaag/django-1.1-python-3.7 | 5,079 | python | def test_send_long_lines(self):
'\n Email line length is limited to 998 chars by the RFC:\n https://tools.ietf.org/html/rfc5322#section-2.1.1\n Message body containing longer lines are converted to Quoted-Printable\n to avoid having to insert newlines, which could be hairy to do properly... | def test_send_long_lines(self):
'\n Email line length is limited to 998 chars by the RFC:\n https://tools.ietf.org/html/rfc5322#section-2.1.1\n Message body containing longer lines are converted to Quoted-Printable\n to avoid having to insert newlines, which could be hairy to do properly... |
bd8c1c6ff0920f062886486ab149e15eea6d6ae29bcd7bc64f102994e9f1610d | def test_plaintext_send_mail(self):
'\n Test send_mail without the html_message\n regression test for adding html_message parameter to send_mail()\n '
send_mail('Subject', 'Content', 'example@example.com', ['example@example.com'])
message = self.get_the_message()
self.assertEqual(me... | Test send_mail without the html_message
regression test for adding html_message parameter to send_mail() | tests/mail/tests.py | test_plaintext_send_mail | jonashaag/django-1.1-python-3.7 | 5,079 | python | def test_plaintext_send_mail(self):
'\n Test send_mail without the html_message\n regression test for adding html_message parameter to send_mail()\n '
send_mail('Subject', 'Content', 'example@example.com', ['example@example.com'])
message = self.get_the_message()
self.assertEqual(me... | def test_plaintext_send_mail(self):
'\n Test send_mail without the html_message\n regression test for adding html_message parameter to send_mail()\n '
send_mail('Subject', 'Content', 'example@example.com', ['example@example.com'])
message = self.get_the_message()
self.assertEqual(me... |
ef9a3ab8db8adf3221462c61859d01e037925e4ff20718b5b082c521aaac3cb1 | def test_html_send_mail(self):
'Test html_message argument to send_mail'
send_mail('Subject', 'Content', 'example@example.com', ['example@example.com'], html_message='HTML Content')
message = self.get_the_message()
self.assertEqual(message.get('subject'), 'Subject')
self.assertEqual(message.get_all(... | Test html_message argument to send_mail | tests/mail/tests.py | test_html_send_mail | jonashaag/django-1.1-python-3.7 | 5,079 | python | def test_html_send_mail(self):
send_mail('Subject', 'Content', 'example@example.com', ['example@example.com'], html_message='HTML Content')
message = self.get_the_message()
self.assertEqual(message.get('subject'), 'Subject')
self.assertEqual(message.get_all('to'), ['example@example.com'])
self.... | def test_html_send_mail(self):
send_mail('Subject', 'Content', 'example@example.com', ['example@example.com'], html_message='HTML Content')
message = self.get_the_message()
self.assertEqual(message.get('subject'), 'Subject')
self.assertEqual(message.get_all('to'), ['example@example.com'])
self.... |
107a9a6c3a0bcbbdfe1d2392bb3d8873508ec9a536e1264ddd628e6cdc1a2716 | @override_settings(MANAGERS=[('nobody', 'example@example.com')])
def test_html_mail_managers(self):
'Test html_message argument to mail_managers'
mail_managers('Subject', 'Content', html_message='HTML Content')
message = self.get_the_message()
self.assertEqual(message.get('subject'), '[Django] Subject')... | Test html_message argument to mail_managers | tests/mail/tests.py | test_html_mail_managers | jonashaag/django-1.1-python-3.7 | 5,079 | python | @override_settings(MANAGERS=[('nobody', 'example@example.com')])
def test_html_mail_managers(self):
mail_managers('Subject', 'Content', html_message='HTML Content')
message = self.get_the_message()
self.assertEqual(message.get('subject'), '[Django] Subject')
self.assertEqual(message.get_all('to'), ... | @override_settings(MANAGERS=[('nobody', 'example@example.com')])
def test_html_mail_managers(self):
mail_managers('Subject', 'Content', html_message='HTML Content')
message = self.get_the_message()
self.assertEqual(message.get('subject'), '[Django] Subject')
self.assertEqual(message.get_all('to'), ... |
a3a4be71dd722f98a6815e7ecca8c4729af728a3cba76d6ad1ddd4a1a294c48c | @override_settings(ADMINS=[('nobody', 'example@example.com')])
def test_html_mail_admins(self):
'Test html_message argument to mail_admins '
mail_admins('Subject', 'Content', html_message='HTML Content')
message = self.get_the_message()
self.assertEqual(message.get('subject'), '[Django] Subject')
se... | Test html_message argument to mail_admins | tests/mail/tests.py | test_html_mail_admins | jonashaag/django-1.1-python-3.7 | 5,079 | python | @override_settings(ADMINS=[('nobody', 'example@example.com')])
def test_html_mail_admins(self):
' '
mail_admins('Subject', 'Content', html_message='HTML Content')
message = self.get_the_message()
self.assertEqual(message.get('subject'), '[Django] Subject')
self.assertEqual(message.get_all('to'), ['e... | @override_settings(ADMINS=[('nobody', 'example@example.com')])
def test_html_mail_admins(self):
' '
mail_admins('Subject', 'Content', html_message='HTML Content')
message = self.get_the_message()
self.assertEqual(message.get('subject'), '[Django] Subject')
self.assertEqual(message.get_all('to'), ['e... |
7f2bb553f95c216e5ac7f2d3f58851183ac212db698575391b37f7ebb3521284 | @override_settings(ADMINS=[('nobody', 'example@example.com')], MANAGERS=[('nobody', 'example@example.com')])
def test_manager_and_admin_mail_prefix(self):
'\n String prefix + lazy translated subject = bad output\n Regression for #13494\n '
mail_managers(ugettext_lazy('Subject'), 'Content')
... | String prefix + lazy translated subject = bad output
Regression for #13494 | tests/mail/tests.py | test_manager_and_admin_mail_prefix | jonashaag/django-1.1-python-3.7 | 5,079 | python | @override_settings(ADMINS=[('nobody', 'example@example.com')], MANAGERS=[('nobody', 'example@example.com')])
def test_manager_and_admin_mail_prefix(self):
'\n String prefix + lazy translated subject = bad output\n Regression for #13494\n '
mail_managers(ugettext_lazy('Subject'), 'Content')
... | @override_settings(ADMINS=[('nobody', 'example@example.com')], MANAGERS=[('nobody', 'example@example.com')])
def test_manager_and_admin_mail_prefix(self):
'\n String prefix + lazy translated subject = bad output\n Regression for #13494\n '
mail_managers(ugettext_lazy('Subject'), 'Content')
... |
564edb6d9d63a0570c96d8a49028ae4ec34bae10785b2ec3e403f977c627c5b1 | @override_settings(ADMINS=[], MANAGERS=[])
def test_empty_admins(self):
"\n mail_admins/mail_managers doesn't connect to the mail server\n if there are no recipients (#9383)\n "
mail_admins('hi', 'there')
self.assertEqual(self.get_mailbox_content(), [])
mail_managers('hi', 'there')
... | mail_admins/mail_managers doesn't connect to the mail server
if there are no recipients (#9383) | tests/mail/tests.py | test_empty_admins | jonashaag/django-1.1-python-3.7 | 5,079 | python | @override_settings(ADMINS=[], MANAGERS=[])
def test_empty_admins(self):
"\n mail_admins/mail_managers doesn't connect to the mail server\n if there are no recipients (#9383)\n "
mail_admins('hi', 'there')
self.assertEqual(self.get_mailbox_content(), [])
mail_managers('hi', 'there')
... | @override_settings(ADMINS=[], MANAGERS=[])
def test_empty_admins(self):
"\n mail_admins/mail_managers doesn't connect to the mail server\n if there are no recipients (#9383)\n "
mail_admins('hi', 'there')
self.assertEqual(self.get_mailbox_content(), [])
mail_managers('hi', 'there')
... |
86286130c43d5080f57029de9defebb0807e7c05b9534a8c0c77db611843c49e | def test_message_cc_header(self):
'\n Regression test for #7722\n '
email = EmailMessage('Subject', 'Content', 'example@example.com', ['example@example.com'], cc=['example@example.com'])
mail.get_connection().send_messages([email])
message = self.get_the_message()
self.assertMessageHas... | Regression test for #7722 | tests/mail/tests.py | test_message_cc_header | jonashaag/django-1.1-python-3.7 | 5,079 | python | def test_message_cc_header(self):
'\n \n '
email = EmailMessage('Subject', 'Content', 'example@example.com', ['example@example.com'], cc=['example@example.com'])
mail.get_connection().send_messages([email])
message = self.get_the_message()
self.assertMessageHasHeaders(message, {('MIME-... | def test_message_cc_header(self):
'\n \n '
email = EmailMessage('Subject', 'Content', 'example@example.com', ['example@example.com'], cc=['example@example.com'])
mail.get_connection().send_messages([email])
message = self.get_the_message()
self.assertMessageHasHeaders(message, {('MIME-... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.