file
stringlengths
8
116
function
stringlengths
2
72
version_data
listlengths
2
2
diff_code
stringlengths
87
17.4k
diff_docstring
stringlengths
31
12k
whitespace_only_code
bool
1 class
whitespace_only_docstring
bool
1 class
file_path
stringlengths
9
116
filename
stringlengths
5
52
project
stringclasses
100 values
owner
stringclasses
96 values
kivy_core_image___init__.py
ImageLoader.zip_loader
[ { "version": "v20", "docstring_lines": { "start_line": 177, "end_line": 182 }, "code_lines": { "start_line": 182, "end_line": 218 }, "commit_date_time": "2011-07-16 16:46:51", "commit_sha": "b8d1e288d3035ddb7a7f8475b69e1453644d1e6d", "commit_message": "fix com...
def zip_loader(_filename, **kwargs): - + ''' ? +++ - + ''' ? +++ # Read all images inside z = zipfile.ZipFile(_filename, 'r') image_data = [] #for each file in zip for zfilename in z.namelist(): try: ...
Read images from an zip file. + .. versionadded:: + 1.0.8 Returns an Image with a list/array of type ImageData stored in Image._data
false
false
kivy/core/image/__init__.py
__init__.py
kivy
kivy
detectron2_engine_launch.py
launch
[ { "version": "v10", "docstring_lines": { "start_line": 36, "end_line": 52 }, "code_lines": { "start_line": 52, "end_line": 127 }, "commit_date_time": "2021-08-11 18:53:12", "commit_sha": "42286d3c8bf7f261ec2112a4d7ac456e7869c48e", "commit_message": "Use curren...
def launch( main_func, + # Should be num_processes_per_machine, but kept for compatibility. num_gpus_per_machine, num_machines=1, machine_rank=0, dist_url=None, args=(), timeout=DEFAULT_TIMEOUT, ): world_size = num_machines * num_gpus_per_mach...
- Launch multi-gpu or distributed training. ? - ^ + Launch multi-process or distributed training. ? ^^^^^^ This function must be called on all machines involved in the training. It will spawn child processes (defined by ``num_gpus_per_machine``) on each machine. Args: ...
false
false
detectron2/engine/launch.py
launch.py
detectron2
facebookresearch
pupy_pupylib_PupyCmd.py
PupyCmd.do_list_modules
[ { "version": "v12", "docstring_lines": { "start_line": 411, "end_line": 413 }, "code_lines": { "start_line": 413, "end_line": 415 }, "commit_date_time": "2015-10-27 17:47:38", "commit_sha": "ebe5d36029a1cdec663039623846ae1b67b9e1d1", "commit_message": "Termina...
def do_list_modules(self, arg): for m,d in self.pupsrv.list_modules(): - self.stdout.write("{:<20} {}\n".format(m, color(d,'grey'))) + self.stdout.write("{:<20} {}\n".format(m, color(d.split("\n",1)[0],'grey'))) ? +++++++++++++++++
- List available modules with a brief description + List available modules with a brief description (the first description line) ? +++++++++++++++++++++++++++++
false
false
pupy/pupylib/PupyCmd.py
PupyCmd.py
pupy
n1nj4sec
src_lightning_pytorch_trainer_connectors_logger_connector_logger_connector.py
_LoggerConnector.metrics
[ { "version": "v85", "docstring_lines": { "start_line": 226, "end_line": 228 }, "code_lines": { "start_line": 228, "end_line": 232 }, "commit_date_time": "2023-08-09 14:44:20", "commit_sha": "efa7b2f9efd8d268a463b73e5d9154a6c5ab4831", "commit_message": "docform...
def metrics(self) -> _METRICS: - on_step = not self._epoch_end_reached + on_step = self._first_loop_iter is not None assert self.trainer._results is not None return self.trainer._results.metrics(on_step)
- This function returns either batch or epoch metrics depending on ``_epoch_end_reached``. + This function returns either batch or epoch metrics.
false
false
src/lightning/pytorch/trainer/connectors/logger_connector/logger_connector.py
logger_connector.py
pytorch-lightning
Lightning-AI
skrf_media_media.py
DefinedGammaZ0.Z0
[ { "version": "v123", "docstring_lines": { "start_line": 1364, "end_line": 1364 }, "code_lines": { "start_line": 1365, "end_line": 1376 }, "commit_date_time": "2021-06-27 17:27:24", "commit_sha": "95e42983b06f02060f22f45bcd08e23220b54812", "commit_message": "Fi...
def Z0(self): - ''' - ? - + - ''' ? --- + + return self._Z0*ones(len(self))
- Characteristic Impedance + Characteristic Impedance of the media. ? ++++++++++++++
false
false
skrf/media/media.py
media.py
scikit-rf
scikit-rf
skrf_media_media.py
Media.load
[ { "version": "v151", "docstring_lines": { "start_line": 1455, "end_line": 1478 }, "code_lines": { "start_line": 1478, "end_line": 1487 }, "commit_date_time": "2023-03-29 07:15:16", "commit_sha": "8cf80d7be84cf4f4330cacb9564e3456ab66389c", "commit_message": "pr...
- def load(self, Gamma0: NumberLike, nports: int = 1, **kwargs) -> Network: ? ---------------------- + def load(self, Gamma0: NumberLike, nports: int = 1, + z0: Union[NumberLike, None] = None, **kwargs) -> Network: - result =...
r""" Load of given reflection coefficient. Parameters ---------- Gamma0 : number, array-like Reflection coefficient of load (linear, not in db). If its an array it must be of shape: `kxnxn`, where k is number of frequency points in m...
false
false
skrf/media/media.py
media.py
scikit-rf
scikit-rf
skrf_media_media.py
Media.delay_load
[ { "version": "v130", "docstring_lines": { "start_line": 914, "end_line": 937 }, "code_lines": { "start_line": 937, "end_line": 938 }, "commit_date_time": "2022-05-16 18:45:05", "commit_sha": "db5bd03d871419d43ced23b6fe0a0ea46fef3018", "commit_message": "Fix fo...
def delay_load(self, Gamma0: NumberLike, d: Number, unit: str = 'deg', **kwargs) -> Network: + return self.line(d=d, unit=unit, **kwargs) ** self.load(Gamma0=Gamma0, **kwargs) - return self.line(d=d, unit=unit,**kwargs)**\ - self.load(Gamma0=Gamma0,**kwargs)
r""" Delayed load. A load with reflection coefficient `Gamma0` at the end of a matched line of length `d`. Parameters ---------- Gamma0 : number, array-like reflection coefficient of load (not in dB) d : number the...
false
false
skrf/media/media.py
media.py
scikit-rf
scikit-rf
skrf_media_media.py
Media.splitter
[ { "version": "v173", "docstring_lines": { "start_line": 1835, "end_line": 1870 }, "code_lines": { "start_line": 1870, "end_line": 1878 }, "commit_date_time": "2024-02-18 00:33:01", "commit_sha": "daf9de4cdc6444b3dec1415ad3c457e37bbb015b", "commit_message": "fi...
def splitter(self, nports: int, **kwargs) -> Network: result = self.match(nports, **kwargs) - - result.s = splitter_s(self.frequency, nports, z0=result.z0) + + y0s = npy.array(1./result.z0) + y_k = y0s.sum(axis=1) + s = npy.zeros((self.frequen...
r""" Ideal, lossless n-way splitter. + + The port impedances can be mismatched and the power is split + accordingly. + + For n > 2, the splitter is not matched because the power wave entering + one port meet the equivalent impedance of the other ports in par...
false
false
skrf/media/media.py
media.py
scikit-rf
scikit-rf
skrf_media_media.py
Media.attenuator
[ { "version": "v129", "docstring_lines": { "start_line": 1154, "end_line": 1171 }, "code_lines": { "start_line": 1171, "end_line": 1185 }, "commit_date_time": "2021-10-22 14:26:08", "commit_sha": "99b7b76f40dfa5cd9d6a5cbd475ea09d02e5efcc", "commit_message": "En...
def attenuator(self, s21: NumberLike, db: bool = True, d: Number = 0, unit: str = 'deg', name: str = '', **kwargs) -> Network: + - + s21 = npy.array(s21) if db: s21 = mf.db_2_magnitude(s21) result = self.match(nports=...
+ r""" - Ideal matched attenuator of a given length. + Ideal matched attenuator of a given length. ? ++++++++ Parameters ---------- s21 : number, array-like the attenuation db : bool, optional is s21 in dB? otherwise assumes linear. Default...
false
false
skrf/media/media.py
media.py
scikit-rf
scikit-rf
skrf_media_media.py
Media.z0
[ { "version": "v156", "docstring_lines": { "start_line": 1675, "end_line": 1675 }, "code_lines": { "start_line": 1676, "end_line": 1678 }, "commit_date_time": "2023-04-28 20:06:13", "commit_sha": "fd2b1ec52569a4939900900566e1912642a094d3", "commit_message": "ad...
def z0(self): + if self.z0_override is None: + return self.z0_characteristic + else: - return self.z0_override + return self.z0_override ? ++++
- Characteristic Impedance + Return Characteristic Impedance `z0_characteristic`. + If `z0_override` is not None, it is returned instead. Returns ------- z0 : npy.ndarray - Characteristic Impedance in units of ohms ? ^ ^^^ --- + ...
false
false
skrf/media/media.py
media.py
scikit-rf
scikit-rf
skrf_media_media.py
Media.capacitor_q
[ { "version": "v161", "docstring_lines": { "start_line": 1314, "end_line": 1334 }, "code_lines": { "start_line": 1334, "end_line": 1339 }, "commit_date_time": "2023-07-18 08:00:40", "commit_sha": "4d0c661e3932dd4f4ad8eceedcb13573abb4c119", "commit_message": "Up...
- def capacitor_q(self, C: NumberLike, f: NumberLike, q_factor: NumberLike, **kwargs) -> Network: + def capacitor_q(self, C: NumberLike, f_0: NumberLike, q_factor: NumberLike, **kwargs) -> Network: ? ++ - idea_cap = self.shunt(self.capacitor(C=C)) ...
r""" Capacitor with Q factor. Parameters ---------- C : number, array-like Capacitance in Farads. - f : number + f_0 : number ? ++ Frequency at which Q is defined, in Hz. q_factor : number Q-factor...
false
false
skrf/media/media.py
media.py
scikit-rf
scikit-rf
skrf_media_media.py
Media.inductor_q
[ { "version": "v165", "docstring_lines": { "start_line": 1314, "end_line": 1334 }, "code_lines": { "start_line": 1334, "end_line": 1339 }, "commit_date_time": "2023-07-22 13:38:08", "commit_sha": "9275a31b1bb125096ca504f45dd149d0c7a356fa", "commit_message": "Ap...
- def inductor_q(self, L: NumberLike, f_0: NumberLike, q_factor: NumberLike, rdc: NumberLike = 0.0, **kwargs) -> Network: + def inductor_q(self, + L: NumberLike, + f_0: NumberLike, + q_factor: NumberLike, + rdc: NumberLike = 0.0, + ...
r""" Inductor with Q factor. Parameters ---------- L : number, array-like Inductance in Henries. f_0 : number Frequency at which Q is defined, in Hz. q_factor : number - Q-factor of inductor ? ...
false
false
skrf/media/media.py
media.py
scikit-rf
scikit-rf
Lib_functools.py
_make_key
[ { "version": "v94", "docstring_lines": { "start_line": 155, "end_line": 155 }, "code_lines": { "start_line": 156, "end_line": 176 }, "commit_date_time": "2013-03-04 09:19:09", "commit_sha": "352cc8cfc38e0233b0a0051761afcfd842367b95", "commit_message": "Another...
def _make_key(args, kwds, typed, kwd_mark = (object(),), fasttypes = {int, str, frozenset, type(None)}, sorted=sorted, tuple=tuple, type=type, len=len): - '' ? -- + + + key = args if kwds: sorted_items = sorted(kwds.items()) ...
Make a cache key from optionally typed positional and keyword arguments + + The key is constructed in a way that is flat as possible rather than + as a nested structure that would take more memory. + + If there is only a single argument and its data type is known to cache + its hash value, then that...
false
false
Lib/functools.py
functools.py
cpython
python
research_object_detection_dataset_tools_context_rcnn_generate_embedding_data.py
main
[ { "version": "v1", "docstring_lines": { "start_line": 355, "end_line": 360 }, "code_lines": { "start_line": 360, "end_line": 379 }, "commit_date_time": "2020-06-17 07:59:17", "commit_sha": "420a7253e034a12ae2208e6ec94d3e4936177a53", "commit_message": "Refactor...
- def main(_): + def main(argv=None, save_main_session=True): + args, pipeline_args = parse_args(argv) - # must create before flags are used - runner = runners.DirectRunner() + pipeline_options = beam.options.pipeline_options.PipelineOptions( + pipeline_args) + pipeline_options.view_a...
Runs the Beam pipeline that performs inference. Args: - _: unused + argv: Command line arguments. + save_main_session: Whether to save the main session.
false
false
research/object_detection/dataset_tools/context_rcnn/generate_embedding_data.py
generate_embedding_data.py
models
tensorflow
research_object_detection_dataset_tools_context_rcnn_generate_embedding_data.py
GenerateEmbeddingDataFn.__init__
[ { "version": "v14", "docstring_lines": { "start_line": 146, "end_line": 153 }, "code_lines": { "start_line": 153, "end_line": 159 }, "commit_date_time": "2020-08-06 18:44:37", "commit_sha": "94a2302adce96c316d31c820df721a6bba1cc609", "commit_message": "Load mo...
def __init__(self, model_dir, top_k_embedding_count, - bottom_k_embedding_count): + bottom_k_embedding_count, embedding_type='final_box_features'): self._model_dir = model_dir self._session = None self._num_examples_processed = beam.metrics.Metrics.counter...
Initialization function. Args: model_dir: A directory containing saved model. top_k_embedding_count: the number of high-confidence embeddings to store bottom_k_embedding_count: the number of low-confidence embeddings to store + embedding_type: One of 'final_box_features', 'rpn_b...
false
false
research/object_detection/dataset_tools/context_rcnn/generate_embedding_data.py
generate_embedding_data.py
models
tensorflow
conans_test_functional_command_test_install_deploy.py
test_deploy_single_package
[ { "version": "v11", "docstring_lines": { "start_line": 249, "end_line": 251 }, "code_lines": { "start_line": 251, "end_line": 265 }, "commit_date_time": "2023-04-04 17:15:13", "commit_sha": "eb622b84a99b290054d654dc8c82e2d7623feddb", "commit_message": "fix ful...
def test_deploy_single_package(): c = TestClient() c.save({"conanfile.py": GenConanfile("pkg", "1.0").with_package_file("include/hi.h", "hi"), "consumer/conanfile.txt": "[requires]\npkg/1.0"}) c.run("create .") # if we deploy one --requires, we get that package ...
- Lets try a deploy that executes on a single package reference + Let's try a deploy that executes on a single package reference ? +
false
false
conans/test/functional/command/test_install_deploy.py
test_install_deploy.py
conan
conan-io
rllib_models_torch_misc.py
same_padding
[ { "version": "v15", "docstring_lines": { "start_line": 19, "end_line": 31 }, "code_lines": { "start_line": 31, "end_line": 50 }, "commit_date_time": "2020-06-23 18:42:30", "commit_sha": "f77c638d6dc0ba4533b94fa704e46cf478479aec", "commit_message": "Pytorch Att...
def same_padding(in_size, filter_size, stride_size): in_height, in_width = in_size + if isinstance(filter_size, int): + filter_height, filter_width = filter_size, filter_size + else: - filter_height, filter_width = filter_size + filter_height, filter_width = filter_size...
Note: Padding is added to match TF conv2d `same` padding. See www.tensorflow.org/versions/r0.12/api_docs/python/nn/convolution - Params: + Args: in_size (tuple): Rows (Height), Column (Width) for input - stride_size (tuple): Rows (Height), Column (Width) for stride ? ...
false
false
rllib/models/torch/misc.py
misc.py
ray
ray-project
readthedocs_api_v2_views_integrations.py
BitbucketWebhookView.is_payload_valid
[ { "version": "v100", "docstring_lines": { "start_line": 281, "end_line": 297 }, "code_lines": { "start_line": 297, "end_line": 304 }, "commit_date_time": "2023-07-10 12:24:49", "commit_sha": "1add44a6f2404d41078e69ce1ab8b0a43bdb9448", "commit_message": "Build:...
def is_payload_valid(self): + + + signature = self.request.headers.get(BITBUCKET_SIGNATURE_HEADER) + secret = self.get_integration().secret + if not secret: + log.debug("Skipping payload signature validation.") - return True + return...
- Bitbucket doesn't have an option for payload validation. + BitBucket use a HMAC hexdigest hash to sign the payload. + + It is sent in the request's header. + + See https://support.atlassian.com/bitbucket-cloud/docs/manage-webhooks/#Secure-webhooks.
false
false
readthedocs/api/v2/views/integrations.py
integrations.py
readthedocs.org
readthedocs
homeassistant_components_frontend___init__.py
_handle_get_static
[ { "version": "v2", "docstring_lines": { "start_line": 82, "end_line": 84 }, "code_lines": { "start_line": 84, "end_line": 143 }, "commit_date_time": "2015-01-30 08:00:19", "commit_sha": "61f6aff0568f91f850bf5c512fec94d47eac0ac6", "commit_message": "Upgrade to ...
def _handle_get_static(handler, path_match, data): req_file = util.sanitize_path(path_match.group('file')) # Strip md5 hash out of frontend filename if re.match(r'^frontend-[A-Za-z0-9]{32}\.html$', req_file): req_file = "frontend.html" path = os.path.join(os.path.dirna...
- Returns a static file. + Returns a static file for the frontend.
false
false
homeassistant/components/frontend/__init__.py
__init__.py
core
home-assistant
homeassistant_components_frontend___init__.py
websocket_get_panels
[ { "version": "v473", "docstring_lines": { "start_line": 549, "end_line": 553 }, "code_lines": { "start_line": 553, "end_line": 563 }, "commit_date_time": "2020-04-19 00:13:13", "commit_sha": "98f1548f2d4a1ef7051ec7611fc9aa2be7d96102", "commit_message": "Allow ...
def websocket_get_panels(hass, connection, msg): - user_is_admin = connection.user.is_admin panels = { panel_key: panel.to_response() for panel_key, panel in connection.hass.data[DATA_PANELS].items() if user_is_admin or not panel.require_admin } con...
Handle get panels command. - - Async friendly.
false
false
homeassistant/components/frontend/__init__.py
__init__.py
core
home-assistant
libs_experimental_langchain_experimental_data_anonymizer_presidio.py
PresidioAnonymizer._anonymize
[ { "version": "v3", "docstring_lines": { "start_line": 55, "end_line": 67 }, "code_lines": { "start_line": 67, "end_line": 86 }, "commit_date_time": "2023-09-07 04:33:24", "commit_sha": "4cc4534d81e8f96f0163ed74e9e3862ac49a73da", "commit_message": "Data deanony...
- def _anonymize(self, text: str) -> str: + def _anonymize(self, text: str, language: Optional[str] = None) -> str: + if language is None: + language = self.supported_languages[0] + + if language not in self.supported_languages: + raise ValueError( + ...
Anonymize text. Each PII entity is replaced with a fake value. Each time fake values will be different, as they are generated randomly. Args: text: text to anonymize + language: language to use for analysis of PII + If None, the first (main) l...
false
false
libs/experimental/langchain_experimental/data_anonymizer/presidio.py
presidio.py
langchain
langchain-ai
chainer_computational_graph.py
ComputationalGraph.__init__
[ { "version": "v26", "docstring_lines": { "start_line": 113, "end_line": 157 }, "code_lines": { "start_line": 157, "end_line": 162 }, "commit_date_time": "2015-07-07 03:49:29", "commit_sha": "98d29beb32cdc5b4970154bb857020afdd6b96d4", "commit_message": "Fix ind...
- def __init__(self, nodes, edges): ? ------- + def __init__(self, edges): - self.nodes = nodes self.edges = edges
Initializes computational graph. Args: - nodes (list): List of nodes. Each node is either - :class:`Variable` object or :class:`Function` object. edges (list): List of edges. Each edge consists of pair of nodes. + Nodes are either :class:`Variable` o...
false
false
chainer/computational_graph.py
computational_graph.py
chainer
chainer
chainer_computational_graph.py
ComputationalGraph.dump
[ { "version": "v16", "docstring_lines": { "start_line": 96, "end_line": 104 }, "code_lines": { "start_line": 104, "end_line": 108 }, "commit_date_time": "2015-07-02 10:14:20", "commit_sha": "7544b51793ec915029e7bd2dd5b29470c60ccd85", "commit_message": "Refactor...
def dump(self, format='dot'): if format == 'dot': return self._to_dot() else: - NotImplementedError('Currently, only dot format is supported') + NotImplementedError('Currently, only dot format is supported.') ? ...
- Dump graph as a text + Dumps graph as a text. ? + + Args - format: specifies graph language to output ? ^^ ------ ^ + format(str): The graph language name of the output. ? +++++ ^^ ++++++++...
false
false
chainer/computational_graph.py
computational_graph.py
chainer
chainer
gensim_models_tfidfmodel.py
TfidfModel.__init__
[ { "version": "v63", "docstring_lines": { "start_line": 162, "end_line": 179 }, "code_lines": { "start_line": 179, "end_line": 187 }, "commit_date_time": "2019-04-28 02:37:50", "commit_sha": "460dc1cb9921817f71b40b412e11a6d413926472", "commit_message": "Fix the...
def __init__(self, corpus=None, id2word=None, dictionary=None, wlocal=utils.identity, - wglobal=df2idf, normalize=True, smartirs=None, pivot=None, slope=0.65): ? ^ + wglobal=df2idf, normalize=True, s...
r"""Compute TF-IDF by multiplying a local component (term frequency) with a global component (inverse document frequency), and normalizing the resulting documents to unit length. Formula for non-normalized weight of term :math:`i` in document :math:`j` in a corpus of :math:`D` documents ...
false
false
gensim/models/tfidfmodel.py
tfidfmodel.py
gensim
piskvorky
conans_test_integration_lockfile_test_lock_requires.py
TestLockTestPackage.test_create_lock_tool_requires_test
[ { "version": "v16", "docstring_lines": { "start_line": 451, "end_line": 454 }, "code_lines": { "start_line": 454, "end_line": 472 }, "commit_date_time": "2023-02-20 12:21:37", "commit_sha": "0a3bf876f936ddc7b1c43aba9bd42ff3697f8308", "commit_message": "[develo...
def test_create_lock_tool_requires_test(self, client): c = client with c.chdir("app"): - c.run("create . --lockfile-out=conan.lock") + c.run("create . --lockfile-out=conan.lock -tf=") ? +++++ + ...
same as above, but the full lockfile including the "test_package" can be - obtained with a single "conan create" ? ------- ---- + obtained with a "conan test" ? ++
false
false
conans/test/integration/lockfile/test_lock_requires.py
test_lock_requires.py
conan
conan-io
st2api_st2api_controllers_v1_auth.py
ApiKeyController.post
[ { "version": "v16", "docstring_lines": { "start_line": 104, "end_line": 107 }, "code_lines": { "start_line": 107, "end_line": 129 }, "commit_date_time": "2015-10-08 18:50:34", "commit_sha": "b77c689053bec36f07f0151d1449d948caa7f1d2", "commit_message": "Update ...
def post(self, api_key_api): api_key_db = None + api_key = None try: + if not getattr(api_key_api, 'user', None): - api_key_api.user = self._get_user() + api_key_api.user = self._get_user() ? ++++ + # If ...
- Create a new entry or update an existing one. + Create a new entry.
false
false
st2api/st2api/controllers/v1/auth.py
auth.py
st2
StackStorm
st2api_st2api_controllers_v1_auth.py
ApiKeyController.get_all
[ { "version": "v23", "docstring_lines": { "start_line": 91, "end_line": 97 }, "code_lines": { "start_line": 97, "end_line": 105 }, "commit_date_time": "2017-01-20 02:55:09", "commit_sha": "1791d8b56542cbbede0d0c67c78259e2d198e7f8", "commit_message": "Add ApiKey...
- def get_all(self, **kw): + def get_all(self, requester_user, show_secrets=None, **kw): - mask_secrets, kw = self._get_mask_secrets_ex(**kw) + mask_secrets = self._get_mask_secrets(show_secrets=show_secrets, + requester_...
List all keys. Handles requests: - GET /keys/ + GET /apikeys/ ? +++
false
false
st2api/st2api/controllers/v1/auth.py
auth.py
st2
StackStorm
python_ray_tests_kuberay_test_kuberay_node_provider.py
test_create_node_cap_at_max
[ { "version": "v2", "docstring_lines": { "start_line": 241, "end_line": 244 }, "code_lines": { "start_line": 244, "end_line": 274 }, "commit_date_time": "2022-11-18 05:08:45", "commit_sha": "c976799dfd96806ec9972a287835f7a034ec3d2c", "commit_message": "KubeRay ...
def test_create_node_cap_at_max( attempted_target_replica_count, expected_target_replica_count ): raycluster = get_basic_ray_cr() - with mock.patch.object(KuberayNodeProvider, "__init__", return_value=None): ? ^ + with mock.patch.object(KubeRayNodePr...
- Validates that KuberayNodeProvider does not attempt to create more nodes than ? ^ + Validates that KubeRayNodeProvider does not attempt to create more nodes than ? ^ allowed by maxReplicas. For the config in this test, maxReplicas is fixed at 300. Args: ...
false
false
python/ray/tests/kuberay/test_kuberay_node_provider.py
test_kuberay_node_provider.py
ray
ray-project
other_magicdiamondpattern.py
pretty_print
[ { "version": "v8", "docstring_lines": { "start_line": 34, "end_line": 38 }, "code_lines": { "start_line": 38, "end_line": 56 }, "commit_date_time": "2023-08-29 13:18:10", "commit_sha": "421ace81edb0d9af3a173f4ca7e66cc900078c1d", "commit_message": "[pre-commit....
def pretty_print(n): - + if n <= 0: - print(" ... .... nothing printing :(") ? - ^ ^^ - + return " ... .... nothing printing :(" ? ^^^^ ^ - return - f...
- Parameters: - n : size of pattern + Print a complete diamond pattern with '*' characters. + + Args: + n (int): Size of the pattern. + + Examples: + >>> pretty_print(0) + ' ... .... nothing printing :(' + + >>> pretty_print(3) + ' * \\n * * \\n...
false
false
other/magicdiamondpattern.py
magicdiamondpattern.py
Python
TheAlgorithms
gym_spaces_multi_binary.py
MultiBinary.sample
[ { "version": "v32", "docstring_lines": { "start_line": 59, "end_line": 70 }, "code_lines": { "start_line": 70, "end_line": 89 }, "commit_date_time": "2022-08-22 13:20:28", "commit_sha": "7b0b85cbca16163d07ec39ba098e35565e838134", "commit_message": "removed inl...
def sample(self, mask: Optional[np.ndarray] = None) -> np.ndarray: if mask is not None: assert isinstance( mask, np.ndarray ), f"The expected type of the mask is np.ndarray, actual type: {type(mask)}" assert ( ...
Generates a single random sample from this space. A sample is drawn by independent, fair coin tosses (one toss per binary variable of the space). Args: mask: An optional np.ndarray to mask samples with expected shape of ``space.shape``. - Where mask == 0 then th...
false
false
gym/spaces/multi_binary.py
multi_binary.py
gym
openai
homeassistant_components_london_underground_sensor.py
LondonTubeSensor.__init__
[ { "version": "v8", "docstring_lines": { "start_line": 61, "end_line": 63 }, "code_lines": { "start_line": 63, "end_line": 68 }, "commit_date_time": "2019-04-03 15:40:03", "commit_sha": "048b100eea478665ded47a5f238fc68c96199436", "commit_message": "Clean up doc...
def __init__(self, name, data): + self._data = data + self._description = None self._name = name - self._data = data self._state = None - self._description = None + self.attrs = {ATTR_ATTRIBUTION: ATTRIBUTION}
- Initialize the sensor. + Initialize the London Underground sensor.
false
false
homeassistant/components/london_underground/sensor.py
sensor.py
core
home-assistant
spacy___main__.py
CLI.train
[ { "version": "v13", "docstring_lines": { "start_line": 70, "end_line": 94 }, "code_lines": { "start_line": 94, "end_line": 102 }, "commit_date_time": "2017-03-26 12:24:07", "commit_sha": "6b7f7a2060c4500d3c820712c4eac2daa5324880", "commit_message": "Connect pa...
- def train(self, lang, output_dir, train_data, dev_data, n_iter=15, + def train(self, lang, output_dir, train_data, dev_data=None, n_iter=15, ? +++++ - parser_L1=0.0, - no_tagger=False, no_parser=False, no_ner=False): + pa...
- Train a model. + Train a model. Expects data in spaCy's JSON format.
false
false
spacy/__main__.py
__main__.py
spaCy
explosion
official_nlp_modeling_networks_span_labeling.py
XLNetSpanLabeling.end_logits
[ { "version": "v9", "docstring_lines": { "start_line": 106, "end_line": 125 }, "code_lines": { "start_line": 125, "end_line": 173 }, "commit_date_time": "2020-10-12 18:45:14", "commit_sha": "fcb43c38fe5bbe351ee89dc45c1e86ec78178b0f", "commit_message": "Implemen...
def end_logits(self, inputs): + + + if len(tf.shape(inputs)) == 3: + # inputs: [B, S, H] -> [B, S, 1, H] + inputs = tf.expand_dims(inputs, axis=2) + end_logits = self.end_logits_inner_dense(inputs) end_logits = self.end_logits_layer_norm(end_logits) end_logits = self.en...
Computes the end logits. + + Input shapes into the inner, layer norm, output layers should match. + + During training, inputs shape should be + [batch_size, seq_length, input_width]. + + During inference, input shapes should be + [batch_size, seq_length, start_n_top, input_width]. + + Args...
false
false
official/nlp/modeling/networks/span_labeling.py
span_labeling.py
models
tensorflow
speechbrain_lobes_models_g2p_homograph.py
SubsequenceExtractor.extract_hyps
[ { "version": "v12", "docstring_lines": { "start_line": 594, "end_line": 608 }, "code_lines": { "start_line": 608, "end_line": 636 }, "commit_date_time": "2022-07-01 10:08:36", "commit_sha": "84bca108f8c3739bc2f058bab7e43db32c46e090", "commit_message": "merge l...
def extract_hyps( self, ref_seq, hyps, subsequence_phn_start, use_base=False ): range_phns = torch.arange( ref_seq.size(1), device=ref_seq.device ).expand_as(ref_seq) target_word_indexes = self._get_target_word_indexes( re...
- Extracts a subsequnce from hypotheses (e.g. the result of a beam + Extracts a subsequence from hypotheses (e.g. the result of a beam ? + - search) based on a refernece sequence, which can be either a sequence of phonemes (the target during training) ? - + ...
false
false
speechbrain/lobes/models/g2p/homograph.py
homograph.py
speechbrain
speechbrain
pydantic_type_adapter.py
TypeAdapter.validate_python
[ { "version": "v15", "docstring_lines": { "start_line": 124, "end_line": 126 }, "code_lines": { "start_line": 126, "end_line": 168 }, "commit_date_time": "2023-05-30 20:37:15", "commit_sha": "f299a566581b444e2e5c76873f46abe4dbb9d497", "commit_message": "fix dat...
- def validate_python(self, __object: Any, *, strict: bool | None = None, context: dict[str, Any] | None = None) -> T: + def validate_python( + self, + __object: Any, + *, + strict: bool | None = None, + from_attributes: bool | None = None, + context: dict[str, Any] | Non...
Validate a Python object against the model. Args: __object (Any): The Python object to validate against the model. strict (bool | None, optional): Whether to strictly check types. Defaults to None. + from_attributes (bool | None, optional): Whether to extract data ...
false
false
pydantic/type_adapter.py
type_adapter.py
pydantic
pydantic
st2common_st2common_bootstrap_actionsregistrar.py
ActionsRegistrar.register_from_pack
[ { "version": "v72", "docstring_lines": { "start_line": 79, "end_line": 85 }, "code_lines": { "start_line": 85, "end_line": 112 }, "commit_date_time": "2021-12-10 15:55:13", "commit_sha": "f5a6aa8497a8126717e305b4e46131925bf97c8e", "commit_message": "Initial ch...
def register_from_pack(self, pack_dir): pack_dir = pack_dir[:-1] if pack_dir.endswith("/") else pack_dir _, pack = os.path.split(pack_dir) actions_dir = self._pack_loader.get_content_from_pack( pack_dir=pack_dir, content_type="actions" ...
Register all the actions from the provided pack. - :return: Number of actions registered. + :return: Number of actions registered, Number of actions overridden - :rtype: ``int`` ? -- + :rtype: ``tuple`` ? ++++
false
false
st2common/st2common/bootstrap/actionsregistrar.py
actionsregistrar.py
st2
StackStorm
readthedocs_projects_views_private.py
project_manage
[ { "version": "v53", "docstring_lines": { "start_line": 46, "end_line": 51 }, "code_lines": { "start_line": 51, "end_line": 61 }, "commit_date_time": "2011-10-17 02:37:57", "commit_sha": "a28e74587a43308dbe7a970a37204e9c6c231016", "commit_message": "Add ability...
def project_manage(request, project_slug): + return HttpResponseRedirect(reverse('projects_detail', args=[project_slug])) - project = get_object_or_404(request.user.projects.live(), slug=project_slug) - return object_list( - request, - queryset=project.files.live(), - ...
The management view for a project, where you will have links to edit the projects' configuration, edit the files associated with that project, etc. + + Now redirects to the normal /projects/<slug> view.
false
false
readthedocs/projects/views/private.py
private.py
readthedocs.org
readthedocs
readthedocs_projects_views_private.py
project_import_github
[ { "version": "v104", "docstring_lines": { "start_line": 509, "end_line": 512 }, "code_lines": { "start_line": 512, "end_line": 535 }, "commit_date_time": "2014-11-20 19:53:14", "commit_sha": "903d099facb7dc0857d3062a74af3256a5454c17", "commit_message": "Wizard...
def project_import_github(request, sync=False): + '''''' - - - - github_connected = oauth_utils.import_github(user=request.user, sync=sync) - repos = GithubProject.objects.filter(users__in=[request.user]) # Find existing projects that match a repo url for repo in repos:...
- Integrate with GitHub to pull repos from there. + Show form that prefills import form with data from GitHub
false
false
readthedocs/projects/views/private.py
private.py
readthedocs.org
readthedocs
readthedocs_projects_views_private.py
ProjectDashboard.validate_primary_email
[ { "version": "v349", "docstring_lines": { "start_line": 115, "end_line": 122 }, "code_lines": { "start_line": 122, "end_line": 127 }, "commit_date_time": "2024-01-02 19:21:28", "commit_sha": "06abe5d81c0f4d872d6ea745e80461343e604e89", "commit_message": "Redire...
def validate_primary_email(self, user): email_qs = user.emailaddress_set.filter(primary=True) email = email_qs.first() if not email or not email.verified: - notification = EmailConfirmNotification(user=user, success=False) - notifi...
- Sends a persistent error notification. + Sends a dismissable site notification to this user. Checks if the user has a primary email or if the primary email - is verified or not. Sends a persistent error notification if ? ^^^^ ^ -------- + is verified ...
false
false
readthedocs/projects/views/private.py
private.py
readthedocs.org
readthedocs
scripts_tinybird_upload_raw_test_metrics_and_coverage.py
send_metadata_for_build
[ { "version": "v3", "docstring_lines": { "start_line": 123, "end_line": 142 }, "code_lines": { "start_line": 142, "end_line": 154 }, "commit_date_time": "2023-03-31 11:51:44", "commit_sha": "54350c7f104b6fc853113dec524e81dc1b736994", "commit_message": "cleanup ...
def send_metadata_for_build(build_id: str, timestamp: str): + # on GitHub the GITHUB_HEAD_REF is only set for pull_request, else we use the GITHUB_REF_NAME + branch = ( + os.environ.get("CIRCLE_BRANCH", "") + or os.environ.get("GITHUB_HEAD_REF", "") + or os.environ...
sends the metadata for the build to tinybird SCHEMA > `build_id` String `json:$.build_id`, `timestamp` DateTime `json:$.timestamp`, `branch` String `json:$.branch`, `build_url` String `json:$.build_url`, `pull_requests` String `json:$.pull_requests`, `build_num` String `js...
false
false
scripts/tinybird/upload_raw_test_metrics_and_coverage.py
upload_raw_test_metrics_and_coverage.py
localstack
localstack
Lib_idlelib_run.py
exit
[ { "version": "v94", "docstring_lines": { "start_line": 211, "end_line": 217 }, "code_lines": { "start_line": 217, "end_line": 223 }, "commit_date_time": "2013-02-09 19:20:55", "commit_sha": "4234992c750cad2bbf36f712a47515f050df549f", "commit_message": "Keep ID...
def exit(): if no_exitfunc: + import atexit + atexit._clear() - try: - del sys.exitfunc - except AttributeError: - pass sys.exit(0)
- Exit subprocess, possibly after first deleting sys.exitfunc ? ^^ ^ ---- + Exit subprocess, possibly after first clearing exit functions. ? ^ ^^ + ++++++ If config-main.cfg/.def 'General' 'delete-exitfunc' is True, th...
false
false
Lib/idlelib/run.py
run.py
cpython
python
gensim_topic_coherence_segmentation.py
s_one_one
[ { "version": "v6", "docstring_lines": { "start_line": 76, "end_line": 92 }, "code_lines": { "start_line": 92, "end_line": 101 }, "commit_date_time": "2017-09-05 14:58:07", "commit_sha": "6d6f5dcfa3af4bc61c47dfdf5cdbd8e1364d0c3a", "commit_message": "Refactor al...
def s_one_one(topics): - s_one_one = [] + s_one_one_res = [] ? ++++ for top_words in topics: s_one_one_t = [] for w_prime_index, w_prime in enumerate(top_words): for w_star_index, w_star in enumerate(top_words): if...
This function performs s_one_one segmentation on a list of topics. s_one_one segmentation is defined as: s_one_one = {(W', W*) | W' = {w_i}; W* = {w_j}; w_i, w_j belongs to W; i != j} Example: >>> topics = [np.array([1, 2, 3]), np.array([4, 5, 6])] >>> s_one_pre(topics) [[...
false
false
gensim/topic_coherence/segmentation.py
segmentation.py
gensim
piskvorky
glances_exports_glances_influxdb___init__.py
Export._normalize
[ { "version": "v57", "docstring_lines": { "start_line": 101, "end_line": 103 }, "code_lines": { "start_line": 103, "end_line": 152 }, "commit_date_time": "2021-09-04 14:46:20", "commit_sha": "a0b5982f1dd71ad47c5b91a372a62efc9e82139a", "commit_message": "Refacto...
def _normalize(self, name, columns, points): + ret = [] # Build initial dict by crossing columns and point data_dict = dict(zip(columns, points)) # issue1871 - Check if a key exist. If a key exist, the value of # the key should be used as a t...
Normalize data for the InfluxDB's data model. + - Output is a list of measurements. ? ^ ^^^^^^^ + :return: a list of measurements. ? ^^^^ ^^^
false
false
glances/exports/glances_influxdb/__init__.py
__init__.py
glances
nicolargo
Lib_fnmatch.py
filter
[ { "version": "v28", "docstring_lines": { "start_line": 45, "end_line": 47 }, "code_lines": { "start_line": 47, "end_line": 66 }, "commit_date_time": "2010-07-10 14:11:51", "commit_sha": "fd47cdceb2372b2434e87ea82c3278b1a22f0611", "commit_message": "Merged revi...
def filter(names, pat): - import os,posixpath - result=[] + result = [] ? + + - pat=os.path.normcase(pat) + pat = os.path.normcase(pat) ? + + + match = _compile_pattern(pat) - if not pat in _cache: - res = translate(pat) - if len(_cache) >= _MAXCAC...
- Return the subset of the list NAMES that match PAT + Return the subset of the list NAMES that match PAT. ? +
false
false
Lib/fnmatch.py
fnmatch.py
cpython
python
official_recommendation_ncf_input_pipeline.py
create_ncf_input_data
[ { "version": "v4", "docstring_lines": { "start_line": 94, "end_line": 107 }, "code_lines": { "start_line": 107, "end_line": 119 }, "commit_date_time": "2019-08-14 01:34:08", "commit_sha": "c789d64b88825be06d889c87ed8d3c2c70921f3c", "commit_message": "Internal ...
- def create_ncf_input_data(params, producer=None, input_meta_data=None): + def create_ncf_input_data(params, + producer=None, + input_meta_data=None, + strategy=None): + # NCF evaluation metric calculation logic assumes that eval...
Creates NCF training/evaluation dataset. Args: params: Dictionary containing parameters for train/evaluation data. producer: Instance of BaseDataConstructor that generates data online. Must not be None when params['train_dataset_path'] or params['eval_dataset_path'] is not specified...
false
false
official/recommendation/ncf_input_pipeline.py
ncf_input_pipeline.py
models
tensorflow
skrf_io_general.py
network_2_dataframe
[ { "version": "v58", "docstring_lines": { "start_line": 836, "end_line": 836 }, "code_lines": { "start_line": 837, "end_line": 855 }, "commit_date_time": "2021-06-29 17:52:35", "commit_sha": "a5007c5bef182a4206b976e2c1de82a1c7c5b241", "commit_message": "Improve...
def network_2_dataframe(ntwk, attrs=['s_db'], ports = None): - ''' - ''' + + from pandas import DataFrame, Series # delayed because its not a requirement d = {} index =ntwk.frequency.f_scaled if ports is None: ports = ntwk.port_tuples for attr in ...
- Convert one or more attributes of a network to a pandas DataFrame + Convert one or more attributes of a network to a pandas DataFrame. ? + Parameters - -------------- ? ---- + ---------- ntwk : :class:`~skrf.netwo...
false
false
skrf/io/general.py
general.py
scikit-rf
scikit-rf
skrf_io_general.py
read_all
[ { "version": "v68", "docstring_lines": { "start_line": 253, "end_line": 308 }, "code_lines": { "start_line": 308, "end_line": 355 }, "commit_date_time": "2022-08-31 22:12:32", "commit_sha": "883d2bd744ae7ccc9013d7acba8add18c073a1bc", "commit_message": "Update ...
- def read_all(dir: str ='.', sort = None, contains = None, f_unit = None, obj_type=None, files: list=None, recursive=False) -> dict: ? ^^^ + def read_all(dir: str ='.', sort = True, contains = None, f_unit = None, obj_type=None, files: list=None, recursive=False) -> dict: ? ...
Read all skrf objects in a directory. Attempts to load all files in `dir`, using :func:`read`. Any file that is not readable by skrf is skipped. Optionally, simple filtering can be achieved through the use of `contains` argument. Parameters ---------- dir : str, optional ...
false
false
skrf/io/general.py
general.py
scikit-rf
scikit-rf
src_datasets_utils_metadata.py
metadata_dict_from_readme
[ { "version": "v8", "docstring_lines": { "start_line": 57, "end_line": 70 }, "code_lines": { "start_line": 70, "end_line": 79 }, "commit_date_time": "2021-06-03 14:32:27", "commit_sha": "43cbc507c8a8f4fc2073a15d683cf3c1d1ad279b", "commit_message": "Insert Extra...
def metadata_dict_from_readme(path: Path) -> Optional[Dict[str, List[str]]]: - ? - + yaml_block = yaml_block_from_readme(path=path) if yaml_block is None: return None metada_dict = yaml.load(yaml_block, Loader=NoDuplicateSafeLoader) or dict() return metada_dict
- "Loads a dataset's metadata from the dataset card (REAMDE.md), as a Python dict ? - + Loads a dataset's metadata from the dataset card (REAMDE.md), as a Python dict
false
false
src/datasets/utils/metadata.py
metadata.py
datasets
huggingface
django_contrib_gis_gdal_raster_source.py
GDALRaster.transform
[ { "version": "v23", "docstring_lines": { "start_line": 430, "end_line": 433 }, "code_lines": { "start_line": 433, "end_line": 466 }, "commit_date_time": "2020-01-16 13:34:54", "commit_sha": "266c853e10de50ce75af8be834647fda2c5fc2a0", "commit_message": "Fixed #...
- def transform(self, srid, driver=None, name=None, resampling='NearestNeighbour', ? ^^ + def transform(self, srs, driver=None, name=None, resampling='NearestNeighbour', ? ^ max_error=0.0): # Convert the resampl...
- Return a copy of this raster reprojected into the given SRID. ? ^^^^^ + Return a copy of this raster reprojected into the given spatial ? ^^^^^^^ + reference system.
false
false
django/contrib/gis/gdal/raster/source.py
source.py
django
django
localstack_services_edge.py
get_api_from_headers
[ { "version": "v75", "docstring_lines": { "start_line": 274, "end_line": 276 }, "code_lines": { "start_line": 276, "end_line": 338 }, "commit_date_time": "2021-07-12 00:54:27", "commit_sha": "01e81ec38bfc20e6598a98765538aee967aba8eb", "commit_message": "add sup...
def get_api_from_headers(headers, method=None, path=None, data=None): # initialize result result = API_UNKNOWN, 0 target = headers.get("x-amz-target", "") host = headers.get("host", "") auth_header = headers.get("authorization", "") - if not auth_header: + if not ...
- Determine API and backend port based on Authorization headers. + Determine API and backend port based on "Authorization" or "Host" headers. ? + +++++++++++
false
false
localstack/services/edge.py
edge.py
localstack
localstack
localstack_services_edge.py
get_auth_string
[ { "version": "v118", "docstring_lines": { "start_line": 279, "end_line": 299 }, "code_lines": { "start_line": 299, "end_line": 321 }, "commit_date_time": "2022-03-24 14:08:46", "commit_sha": "2580a2bd986e01f011fd3785f161a3e46ce2a638", "commit_message": "migrat...
def get_auth_string(method, path, headers, data=None): - auth_header = headers.get("authorization", "") + if auth_header := headers.get("authorization", ""): ? +++ + + - - if auth_header: return auth_header data_c...
Get Auth header from Header (this is how aws client's like boto typically - provide it) or from query string or url encoded parameters (sometimes ? - + provide it) or from query string or url encoded parameters sometimes - happens with presig...
false
false
localstack/services/edge.py
edge.py
localstack
localstack
sklearn_cluster__kmeans.py
KMeans.fit
[ { "version": "v470", "docstring_lines": { "start_line": 2157, "end_line": 2180 }, "code_lines": { "start_line": 2180, "end_line": 2257 }, "commit_date_time": "2023-02-20 15:05:53", "commit_sha": "6169cc9b383c7dc15d9039767ed28eb6fd944f06", "commit_message": "DO...
def fit(self, X, y=None, sample_weight=None): self._validate_params() X = self._validate_data( X, accept_sparse="csr", dtype=[np.float64, np.float32], order="C", copy=self.copy_x, accept_la...
Compute k-means clustering. Parameters ---------- X : {array-like, sparse matrix} of shape (n_samples, n_features) Training instances to cluster. It must be noted that the data will be converted to C ordering, which will cause a memory copy if...
false
false
sklearn/cluster/_kmeans.py
_kmeans.py
scikit-learn
scikit-learn
sklearn_cluster__kmeans.py
_labels_inertia
[ { "version": "v391", "docstring_lines": { "start_line": 474, "end_line": 546 }, "code_lines": { "start_line": 546, "end_line": 596 }, "commit_date_time": "2020-02-29 14:05:11", "commit_sha": "d205638475ca542dc46862652e3bb0be663a8eac", "commit_message": "MNT In...
- def _labels_inertia(X, sample_weight, x_squared_norms, centers, n_threads=1): ? -------------- + def _labels_inertia(X, sample_weight, x_squared_norms, centers, + n_threads=None): n_samples = X.shape[0] n_clu...
E step of the K-means EM algorithm. Compute the labels and the inertia of the given samples and centers. Parameters ---------- X : {array-like, sparse matrix} of shape (n_samples, n_features) The input samples to assign to the labels. If sparse matrix, must be in CSR ...
false
false
sklearn/cluster/_kmeans.py
_kmeans.py
scikit-learn
scikit-learn
sklearn_cluster__kmeans.py
k_means
[ { "version": "v480", "docstring_lines": { "start_line": 1699, "end_line": 1891 }, "code_lines": { "start_line": 1891, "end_line": 1932 }, "commit_date_time": "2023-10-02 06:32:14", "commit_sha": "335c2d227af5a2dbcf1f8a9d792e63cdfd413536", "commit_message": "TS...
def k_means( X, n_clusters, *, sample_weight=None, init="k-means++", - n_init="warn", ? - ^^ + n_init="auto", ? ^^^ max_iter=300, verbose=False, tol=1e-4, random_state=None, copy_x=True, algorithm="lloyd", retur...
Perform K-means clustering algorithm. Read more in the :ref:`User Guide <k_means>`. Parameters ---------- X : {array-like, sparse matrix} of shape (n_samples, n_features) The observations to cluster. It must be noted that the data will be converted to C ordering, whic...
false
false
sklearn/cluster/_kmeans.py
_kmeans.py
scikit-learn
scikit-learn
sklearn_cluster__kmeans.py
_kmeans_single_elkan
[ { "version": "v405", "docstring_lines": { "start_line": 975, "end_line": 975 }, "code_lines": { "start_line": 976, "end_line": 986 }, "commit_date_time": "2020-07-12 14:29:44", "commit_sha": "5d2107e9998805a64112b51b26ac13020dc5d2bc", "commit_message": "DOC do...
- def _kmeans_single_elkan(X, sample_weight, n_clusters, max_iter=300, ? ----- + def _kmeans_single_elkan(X, sample_weight, centers_init, max_iter=300, ? ++ +++++ - init='k-means++', verbose=False, x_sq...
A single run of k-means elkan, assumes preparation completed prior. Parameters ---------- X : {ndarray, sparse matrix} of shape (n_samples, n_features) The observations to cluster. If sparse matrix, must be in CSR format. sample_weight : array-like of shape (n_samples,) ...
false
false
sklearn/cluster/_kmeans.py
_kmeans.py
scikit-learn
scikit-learn
sklearn_cluster__kmeans.py
MiniBatchKMeans.fit
[ { "version": "v420", "docstring_lines": { "start_line": 1910, "end_line": 1929 }, "code_lines": { "start_line": 1929, "end_line": 1986 }, "commit_date_time": "2021-03-12 15:08:36", "commit_sha": "579e7de7f38f9f514ff2b2be049e67b14e723d17", "commit_message": "mo...
def fit(self, X, y=None, sample_weight=None): X = self._validate_data(X, accept_sparse='csr', dtype=[np.float64, np.float32], order='C', accept_large_sparse=False) self._check_params(X) random_st...
Compute the centroids on X by chunking it into mini-batches. Parameters ---------- X : {array-like, sparse matrix} of shape (n_samples, n_features) Training instances to cluster. It must be noted that the data will be converted to C ordering, which will cau...
false
false
sklearn/cluster/_kmeans.py
_kmeans.py
scikit-learn
scikit-learn
sklearn_cluster__kmeans.py
_BaseKMeans._init_centroids
[ { "version": "v477", "docstring_lines": { "start_line": 970, "end_line": 1007 }, "code_lines": { "start_line": 1007, "end_line": 1044 }, "commit_date_time": "2023-06-26 15:37:33", "commit_sha": "2579841daaeccd68db2f0d865ebba404e5a18c83", "commit_message": "FIX...
def _init_centroids( self, X, x_squared_norms, init, random_state, + sample_weight, init_size=None, n_centroids=None, - sample_weight=None, ): n_samples = X.shape[0] n_clusters = self....
Compute the initial centroids. Parameters ---------- X : {ndarray, sparse matrix} of shape (n_samples, n_features) The input samples. x_squared_norms : ndarray of shape (n_samples,) Squared euclidean norm of each data point. Pass it if you have...
false
false
sklearn/cluster/_kmeans.py
_kmeans.py
scikit-learn
scikit-learn
sklearn_cluster__kmeans.py
_BaseKMeans.predict
[ { "version": "v484", "docstring_lines": { "start_line": 1074, "end_line": 1098 }, "code_lines": { "start_line": 1098, "end_line": 1122 }, "commit_date_time": "2024-01-15 17:24:47", "commit_sha": "5aeeeefe31acd5444148fd89f3a8df9443b04889", "commit_message": "MA...
- def predict(self, X, sample_weight="deprecated"): + def predict(self, X): check_is_fitted(self) X = self._check_test_data(X) + + # sample weights are not used by predict but cython helpers expect an array + sample_weight = np.ones(X.shape[0], dtype=X.dtype...
Predict the closest cluster each sample in X belongs to. In the vector quantization literature, `cluster_centers_` is called the code book and each value returned by `predict` is the index of the closest code in the code book. Parameters ---------- X :...
false
false
sklearn/cluster/_kmeans.py
_kmeans.py
scikit-learn
scikit-learn
test_integrationtests_voight_kampff_features_steps_utterance_responses.py
dialog_from_sentence
[ { "version": "v13", "docstring_lines": { "start_line": 71, "end_line": 73 }, "code_lines": { "start_line": 73, "end_line": 86 }, "commit_date_time": "2020-03-23 10:41:13", "commit_sha": "353239cbc2c5d03ed4cb9d8b8d44c29283a121fd", "commit_message": "Move more c...
- def dialog_from_sentence(sentence, skill_path): + def dialog_from_sentence(sentence, skill_path, lang): ? ++++++ + - dialog_paths = join(skill_path, 'dialog', 'en-us', '*.dialog') ? ^^ ^^^^ + dialog_paths ...
Find dialog file from example sentence. + + Arguments: + sentence (str): Text to match + skill_path (str): path to skill directory + lang (str): language code to use + + Returns (str): Dialog file best matching the sentence.
false
false
test/integrationtests/voight_kampff/features/steps/utterance_responses.py
utterance_responses.py
mycroft-core
MycroftAI
test_integrationtests_voight_kampff_features_steps_utterance_responses.py
_match_dialog_patterns
[ { "version": "v24", "docstring_lines": { "start_line": 119, "end_line": 123 }, "code_lines": { "start_line": 123, "end_line": 142 }, "commit_date_time": "2022-01-26 19:09:12", "commit_sha": "a3fd830cb0ae3deef01d0e4d3cfc4512fd55f269", "commit_message": "VK: Exp...
def _match_dialog_patterns(dialogs, sentence): # Allow custom fields to be anything - dialogs = [re.sub(r'{.*?\}', r'.*', dia) for dia in dialogs] - # Remove left over '}' - dialogs = [re.sub(r'\}', r'', dia) for dia in dialogs] - # Merge consequtive .*'s into a single .* - dia...
Match sentence against a list of dialog patterns. - Returns index of found match. + dialogs (list of str): dialog file entries to match against + sentence (str): string to match. + + Returns: + (tup) index of found match, debug text
false
false
test/integrationtests/voight_kampff/features/steps/utterance_responses.py
utterance_responses.py
mycroft-core
MycroftAI
theano_gof_compiledir.py
cleanup
[ { "version": "v45", "docstring_lines": { "start_line": 115, "end_line": 125 }, "code_lines": { "start_line": 125, "end_line": 159 }, "commit_date_time": "2012-05-11 18:29:41", "commit_sha": "5afc4fb437bc48a69ea43ba5ee507222774ab5ca", "commit_message": "Added t...
def cleanup(): compiledir = theano.config.compiledir for directory in os.listdir(compiledir): file = None try: try: filename = os.path.join(compiledir, directory, "key.pkl") file = open(filename, 'rb') ...
Delete keys in old format from the compiledir. Old clean up include key in old format: 1) keys that have an ndarray in them. Now we use a hash in the keys of the constant data. 2) key that don't have the numpy ABI version in them + 3) They do not have a compile version string ...
false
false
theano/gof/compiledir.py
compiledir.py
Theano
Theano
homeassistant_components_deluge_switch.py
DelugeSwitch.is_on
[ { "version": "v14", "docstring_lines": { "start_line": 81, "end_line": 83 }, "code_lines": { "start_line": 83, "end_line": 85 }, "commit_date_time": "2022-01-21 12:17:45", "commit_sha": "4c83ecd7bd83ffe5d2a22843d24df1c8a708443e", "commit_message": "Fix incorre...
- def is_on(self): + def is_on(self) -> bool: ? ++++++++ - return self._state == STATE_ON + if self.coordinator.data: + data: dict = self.coordinator.data[Platform.SWITCH] + for torrent in data.values(): + item = torrent.popitem() + ...
- Return true if device is on. + Return state of the switch.
false
false
homeassistant/components/deluge/switch.py
switch.py
core
home-assistant
spleeter_model_provider___init__.py
ModelProvider.get
[ { "version": "v3", "docstring_lines": { "start_line": 52, "end_line": 57 }, "code_lines": { "start_line": 57, "end_line": 71 }, "commit_date_time": "2020-07-17 11:30:42", "commit_sha": "227020c256ef5c09674238979b2a76f91b5f0c68", "commit_message": "replace mail...
- def get(self, model_directory): + def get(self, model_directory: str) -> str: ? +++++ +++++++ - ? - + + # Expend model directory if needed. if not isabs(model_directory): model_directory = join(self.DEF...
Ensures required model is available at given location. - :param model_directory: Expected model_directory to be available. + Parameters: + model_directory (str): + Expected model_directory to be available. + + Raises: + IOError: -...
false
false
spleeter/model/provider/__init__.py
__init__.py
spleeter
deezer
speechbrain_lobes_models_transformer_TransformerASR.py
TransformerASR.make_masks
[ { "version": "v70", "docstring_lines": { "start_line": 230, "end_line": 241 }, "code_lines": { "start_line": 241, "end_line": 252 }, "commit_date_time": "2023-04-05 21:13:19", "commit_sha": "2485bbe3d8465801e8dfb4a71d4af92d9d791407", "commit_message": "adding ...
- def make_masks(self, src, tgt, wav_len=None, pad_idx=0): + def make_masks(self, src, tgt=None, wav_len=None, pad_idx=0): ? +++++ src_key_padding_mask = None if wav_len is not None: abs_len = torch.round(wav_len * src.shape[1]) ...
This method generates the masks for training the transformer model. Arguments --------- src : tensor The sequence to the encoder (required). tgt : tensor - The sequence to the decoder (required). ? ----------- ...
false
false
speechbrain/lobes/models/transformer/TransformerASR.py
TransformerASR.py
speechbrain
speechbrain
python_ccxt_bitfinex.py
bitfinex.fetch_transaction_fees
[ { "version": "v347", "docstring_lines": { "start_line": 408, "end_line": 414 }, "code_lines": { "start_line": 414, "end_line": 428 }, "commit_date_time": "2022-09-29 17:19:03", "commit_sha": "73a0d584c596d7d721e72c94ce908bf279f879fa", "commit_message": "move p...
def fetch_transaction_fees(self, codes=None, params={}): self.load_markets() + result = {} response = self.privatePostAccountFees(params) + # + # { + # 'withdraw': { + # 'BTC': '0.0004', + # } + ...
fetch transaction fees + see https://docs.bitfinex.com/v1/reference/rest-auth-fees :param [str]|None codes: not used by bitfinex2 fetchTransactionFees() :param dict params: extra parameters specific to the bitfinex api endpoint :returns [dict]: a list of `fees structures <https:/...
false
false
python/ccxt/bitfinex.py
bitfinex.py
ccxt
ccxt
python_ccxt_bitfinex.py
bitfinex.fetch_my_trades
[ { "version": "v396", "docstring_lines": { "start_line": 990, "end_line": 998 }, "code_lines": { "start_line": 998, "end_line": 1010 }, "commit_date_time": "2023-11-16 12:46:12", "commit_sha": "8d2f99100013351c73cf0629d66e28e7a2e45c0a", "commit_message": "Merge...
def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}): - self.check_required_symbol('fetchMyTrades', symbol) + if symbol is None: + raise ArgumentsRequired(self.id + ' fetchMyTrades() requires a symbol argument') ...
fetch all trades made by the user :param str symbol: unified market symbol :param int [since]: the earliest time in ms to fetch trades for :param int [limit]: the maximum number of trades structures to retrieve :param dict [params]: extra parameters specific to the bitfinex api...
false
false
python/ccxt/bitfinex.py
bitfinex.py
ccxt
ccxt
theano_tensor_tests_test_shared_randomstreams.py
T_SharedRandomStreams.test_permutation
[ { "version": "v6", "docstring_lines": { "start_line": 113, "end_line": 115 }, "code_lines": { "start_line": 115, "end_line": 131 }, "commit_date_time": "2010-01-21 18:09:42", "commit_sha": "7c1e4862fbeb5f69dd4e6ba7cb7f18d048f4e046", "commit_message": "Update t...
def test_permutation(self): # Check over two calls to see if the random state is correctly updated. - random = RandomStreams(234) ? ^^^ + random = RandomStreams(utt.fetch_seed()) ? ^^^^^^^^^^^^^^^ + fn = fun...
- Test that RandomStreams.uniform generates the same results as numpy ? ^^^^^ + Test that RandomStreams.permutation generates the same results as numpy ? ^^ +++++++
false
false
theano/tensor/tests/test_shared_randomstreams.py
test_shared_randomstreams.py
Theano
Theano
homeassistant_components_greeneye_monitor_sensor.py
VoltageSensor._get_sensor
[ { "version": "v8", "docstring_lines": { "start_line": 299, "end_line": 301 }, "code_lines": { "start_line": 301, "end_line": 304 }, "commit_date_time": "2020-01-14 19:46:04", "commit_sha": "ba3c3057da87f6e34e6a4cb142e04ca302b8c4dd", "commit_message": "Add supp...
def _get_sensor(self, monitor): + return monitor - self._monitor = monitor - return monitor.channels[self._number - 1]
- Wire the updates to a current channel. + Wire the updates to the monitor itself, since there is no voltage element in the API.
false
false
homeassistant/components/greeneye_monitor/sensor.py
sensor.py
core
home-assistant
maths_volume.py
vol_circular_cylinder
[ { "version": "v8", "docstring_lines": { "start_line": 185, "end_line": 195 }, "code_lines": { "start_line": 195, "end_line": 203 }, "commit_date_time": "2022-05-01 10:44:23", "commit_sha": "e1ec661d4e368ceabd50e7ef3714c85dbe139c02", "commit_message": "Fix some...
def vol_circular_cylinder(radius: float, height: float) -> float: + if height < 0 or radius < 0: + raise ValueError("vol_circular_cylinder() only accepts non-negative values") return pi * pow(radius, 2) * height
Calculate the Volume of a Circular Cylinder. Wikipedia reference: https://en.wikipedia.org/wiki/Cylinder :return pi * radius^2 * height - >>> vol_circular_cylinder(1, 1) 3.141592653589793 >>> vol_circular_cylinder(4, 3) 150.79644737231007 + >>> vol_circular_cylinder(1.6, 1.6) ...
false
false
maths/volume.py
volume.py
Python
TheAlgorithms
maths_volume.py
vol_conical_frustum
[ { "version": "v9", "docstring_lines": { "start_line": 270, "end_line": 287 }, "code_lines": { "start_line": 287, "end_line": 291 }, "commit_date_time": "2022-10-12 18:34:01", "commit_sha": "922887c38609650dc8eb8eaa9153605eabc45ecd", "commit_message": "Add volu...
def vol_conical_frustum(height: float, radius_1: float, radius_2: float) -> float: + # Volume is 1/3 * pi * height * + # (radius_1 squared + radius_2 squared + radius_1 * radius_2) if radius_1 < 0 or radius_2 < 0 or height < 0: raise ValueError("vol_conical_frustum() on...
Calculate the Volume of a Conical Frustum. Wikipedia reference: https://en.wikipedia.org/wiki/Frustum - :return 1/3 * pi * height * (radius_1^2 + radius_top^2 + radius_1 * radius_2) + >>> vol_conical_frustum(45, 7, 28) 48490.482608158454 >>> vol_conical_frustum(1, 1, 2) 7.3303828583...
false
false
maths/volume.py
volume.py
Python
TheAlgorithms
django_contrib_auth_models.py
User.get_group_permissions
[ { "version": "v77", "docstring_lines": { "start_line": 114, "end_line": 114 }, "code_lines": { "start_line": 115, "end_line": 121 }, "commit_date_time": "2011-12-23 11:22:13", "commit_sha": "64066a59d9fd4ee746e373e98a2cc1c7e26801e3", "commit_message": "Fixed #...
def get_group_permissions(self, obj=None): permissions = set() for backend in auth.get_backends(): if hasattr(backend, "get_group_permissions"): if obj is not None: - permissions.update(backend.get_group_permissio...
- Returns a list of permission strings that this user has through + Returns a list of permission strings that this user has through his/her ? ++++++++ - his/her groups. This method queries all available auth backends. ? -------- + g...
false
false
django/contrib/auth/models.py
models.py
django
django
django_contrib_auth_models.py
AbstractUser.email_user
[ { "version": "v152", "docstring_lines": { "start_line": 353, "end_line": 353 }, "code_lines": { "start_line": 354, "end_line": 356 }, "commit_date_time": "2017-01-28 14:29:00", "commit_sha": "d5b573d872bbe0d5825efaee2d41cb3cdc75417b", "commit_message": "Fixed ...
def email_user(self, subject, message, from_email=None, **kwargs): - - send_mail(subject, message, from_email, [self.email], **kwargs)
- Sends an email to this User. ? - ^ + Send an email to this user. ? ^
false
false
django/contrib/auth/models.py
models.py
django
django
thefuck_rules_cd_correction.py
get_new_command
[ { "version": "v3", "docstring_lines": { "start_line": 61, "end_line": 68 }, "code_lines": { "start_line": 68, "end_line": 87 }, "commit_date_time": "2015-05-17 06:53:08", "commit_sha": "252859e63a1f41d79899d289da763b973df6a395", "commit_message": "fixed accide...
def get_new_command(command, settings): - ? - + dest = command.script.split()[1].split(os.sep) if dest[-1] == '': dest = dest[:-1] cwd = os.getcwd() for directory in dest: if directory == ".": continue elif directory == ...
Attempt to rebuild the path string by spellchecking the directories. If it fails (i.e. no directories are a close enough match), then it defaults to the rules of cd_mkdir. + Change sensitivity by changing MAX_ALLOWED_DIFF. Default value is 0.6 - Change sensitivity to matching by changing MAX_ALL...
false
false
thefuck/rules/cd_correction.py
cd_correction.py
thefuck
nvbn
python_ccxt_mercado.py
mercado.fetch_open_orders
[ { "version": "v165", "docstring_lines": { "start_line": 745, "end_line": 753 }, "code_lines": { "start_line": 753, "end_line": 765 }, "commit_date_time": "2023-11-08 11:29:04", "commit_sha": "dd04d2f491f85331e500fd69b46084a56d61599b", "commit_message": "4.1.44...
def fetch_open_orders(self, symbol: Optional[str] = None, since: Optional[int] = None, limit: Optional[int] = None, params={}): + self.check_required_symbol('fetchOpenOrders', symbol) - if symbol is None: - raise ArgumentsRequired(self.id + ' fetchOpenOrder...
fetch all unfilled currently open orders :param str symbol: unified market symbol :param int [since]: the earliest time in ms to fetch open orders for - :param int [limit]: the maximum number of open orders structures to retrieve ? - ...
false
false
python/ccxt/mercado.py
mercado.py
ccxt
ccxt
python_ccxt_mercado.py
mercado.cancel_order
[ { "version": "v171", "docstring_lines": { "start_line": 764, "end_line": 772 }, "code_lines": { "start_line": 772, "end_line": 785 }, "commit_date_time": "2023-11-16 12:46:12", "commit_sha": "8d2f99100013351c73cf0629d66e28e7a2e45c0a", "commit_message": "Merge ...
def cancel_order(self, id: str, symbol: Str = None, params={}): - self.check_required_symbol('cancelOrder', symbol) + if symbol is None: + raise ArgumentsRequired(self.id + ' cancelOrder() requires a symbol argument') self.load_markets() ...
cancels an open order :param str id: order id :param str symbol: unified symbol of the market the order was made in :param dict [params]: extra parameters specific to the mercado api endpoint - :returns dict: An `order structure <https://github.com/ccxt/ccxt/wiki/Manual#order-str...
false
false
python/ccxt/mercado.py
mercado.py
ccxt
ccxt
python_ray_tune_analysis_experiment_analysis.py
Analysis.get_trial_checkpoints_paths
[ { "version": "v13", "docstring_lines": { "start_line": 123, "end_line": 131 }, "code_lines": { "start_line": 131, "end_line": 151 }, "commit_date_time": "2020-01-17 18:15:04", "commit_sha": "5f36e6eacb381ab79806652338fd4c116aea5686", "commit_message": "[tune] ...
def get_trial_checkpoints_paths(self, trial, metric=TRAINING_ITERATION): - if isinstance(trial, str): trial_dir = os.path.expanduser(trial) - - # get checkpoints from logdir ? ^ + # Get checkpoints from logdir. ? ^ ...
+ Gets paths and metrics of all persistent checkpoints of a trial. - Returns a list of [path, metric] lists for all disk checkpoints of - a trial. - Arguments: ? ----- + Args: - trial(Trial): The log directory of a trial, or a trial instance. + trial (Tria...
false
false
python/ray/tune/analysis/experiment_analysis.py
experiment_analysis.py
ray
ray-project
python_ray_tune_analysis_experiment_analysis.py
Analysis.get_best_checkpoint
[ { "version": "v20", "docstring_lines": { "start_line": 144, "end_line": 154 }, "code_lines": { "start_line": 154, "end_line": 169 }, "commit_date_time": "2020-08-15 00:52:30", "commit_sha": "f87a4aa45dfb6b00c2074af867dd5352c27a2e28", "commit_message": "[Tune] ...
- def get_best_checkpoint(self, trial, metric=TRAINING_ITERATION): ? ^^ + def get_best_checkpoint(self, trial, metric=TRAINING_ITERATION, ? ^ + mode="max"): ...
Gets best persistent checkpoint path of provided trial. Args: trial (Trial): The log directory of a trial, or a trial instance. metric (str): key of trial info to return, e.g. "mean_accuracy". "training_iteration" is used by default. + mode (str):...
false
false
python/ray/tune/analysis/experiment_analysis.py
experiment_analysis.py
ray
ray-project
python_ray_tune_analysis_experiment_analysis.py
ExperimentAnalysis.get_best_trial
[ { "version": "v16", "docstring_lines": { "start_line": 216, "end_line": 231 }, "code_lines": { "start_line": 231, "end_line": 267 }, "commit_date_time": "2020-05-14 22:20:43", "commit_sha": "4633d81c390fd33d54aa62a5eb43fe104062bb41", "commit_message": "[tune] ...
def get_best_trial(self, metric, mode="max", scope="all"): if mode not in ["max", "min"]: raise ValueError( "ExperimentAnalysis: attempting to get best trial for " "metric {} for mode {} not in [\"max\", \"min\"]".format( ...
Retrieve the best trial object. Compares all trials' scores on `metric`. Args: metric (str): Key for trial info to order on. mode (str): One of [min, max]. - scope (str): One of [all, last, avg]. If `scope=last`, only look at - each tri...
false
false
python/ray/tune/analysis/experiment_analysis.py
experiment_analysis.py
ray
ray-project
python_ray_tune_analysis_experiment_analysis.py
Analysis.get_all_configs
[ { "version": "v23", "docstring_lines": { "start_line": 463, "end_line": 463 }, "code_lines": { "start_line": 464, "end_line": 473 }, "commit_date_time": "2020-09-09 04:00:52", "commit_sha": "d7c7aba99cc2e6383af605aaa4671f4266fad979", "commit_message": "[tune] ...
- def get_all_configs(self, prefix=False): + def get_all_configs(self, prefix: bool = False) -> Dict[str, Dict]: fail_count = 0 for path in self._get_trial_paths(): try: with open(os.path.join(path, EXPR_PARAM_FILE)) as f: c...
Returns a list of all configurations. Args: prefix (bool): If True, flattens the config dict and prepends `config/`. Returns: - List[dict]: List of all configurations of trials, ? ^ ^^ ^ ^ + Dict[str, Dict]: Dict of ...
false
false
python/ray/tune/analysis/experiment_analysis.py
experiment_analysis.py
ray
ray-project
faker_generator.py
Generator.parse
[ { "version": "v14", "docstring_lines": { "start_line": 73, "end_line": 77 }, "code_lines": { "start_line": 77, "end_line": 78 }, "commit_date_time": "2014-07-07 22:41:50", "commit_sha": "e98cc2ce661fb08ad24bb51992a55d71a56ca5a0", "commit_message": "Apply PEP8 ...
def parse(self, text): - return re.sub(r'\{\{(\s?)(\w+)(\s?)\}\}', self.__format_token, text) + return _re_token.sub(self.__format_token, text)
- Replaces tokens (like '{{ tokenName }}') with the result + Replaces tokens (like '{{ tokenName }}' or '{{tokenName}}') - from the token method call. + with the result from the token method call. ? ++++++++++++++++
false
false
faker/generator.py
generator.py
faker
joke2k
libs_experimental_langchain_experimental_agents_agent_toolkits_pandas_base.py
create_pandas_dataframe_agent
[ { "version": "v27", "docstring_lines": { "start_line": 168, "end_line": 217 }, "code_lines": { "start_line": 217, "end_line": 307 }, "commit_date_time": "2024-03-08 03:23:07", "commit_sha": "3b975c6ebe3be15e62eb4caef26a6f36e37571bf", "commit_message": "experim...
def create_pandas_dataframe_agent( llm: LanguageModelLike, df: Any, agent_type: Union[ - AgentType, Literal["openai-tools"] + AgentType, Literal["openai-tools", "tool-calling"] ? ++++++++++++++++ ] = AgentType.ZERO_SHOT_REACT_DESCRIPTIO...
Construct a Pandas agent from an LLM and dataframe(s). Args: - llm: Language model to use for the agent. + llm: Language model to use for the agent. If agent_type is "tool-calling" then + llm is expected to support tool calling. df: Pandas dataframe or list of Pandas dat...
false
false
libs/experimental/langchain_experimental/agents/agent_toolkits/pandas/base.py
base.py
langchain
langchain-ai
sklearn_decomposition__dict_learning.py
MiniBatchDictionaryLearning.partial_fit
[ { "version": "v196", "docstring_lines": { "start_line": 2487, "end_line": 2512 }, "code_lines": { "start_line": 2512, "end_line": 2552 }, "commit_date_time": "2022-12-28 18:35:32", "commit_sha": "5aa9b99114400b1032631b357825f066af420194", "commit_message": "MA...
- def partial_fit(self, X, y=None, iter_offset="deprecated"): + def partial_fit(self, X, y=None): has_components = hasattr(self, "components_") if not has_components: self._validate_params() X = self._validate_data( X, dtype=[np.float...
Update the model using the data in X as a mini-batch. Parameters ---------- X : array-like of shape (n_samples, n_features) Training vector, where `n_samples` is the number of samples and `n_features` is the number of features. y : Ignored ...
false
false
sklearn/decomposition/_dict_learning.py
_dict_learning.py
scikit-learn
scikit-learn
sklearn_decomposition__dict_learning.py
dict_learning
[ { "version": "v195", "docstring_lines": { "start_line": 1463, "end_line": 1649 }, "code_lines": { "start_line": 1649, "end_line": 1713 }, "commit_date_time": "2022-12-27 16:40:46", "commit_sha": "0ab47124fcaab6cb9e44d5fc2e892d9872950da6", "commit_message": "MA...
def dict_learning( X, n_components, *, alpha, max_iter=100, tol=1e-8, method="lars", n_jobs=None, dict_init=None, code_init=None, callback=None, verbose=False, random_state=None, return_n_iter=False, positive_dict=False, p...
Solve a dictionary learning matrix factorization problem. Finds the best dictionary and the corresponding sparse code for approximating the data matrix X by solving:: (U^*, V^*) = argmin 0.5 || X - U V ||_Fro^2 + alpha * || U ||_1,1 (U,V) with |...
false
false
sklearn/decomposition/_dict_learning.py
_dict_learning.py
scikit-learn
scikit-learn
homeassistant_components_amcrest___init__.py
AmcrestChecker.available_flag
[ { "version": "v49", "docstring_lines": { "start_line": 170, "end_line": 170 }, "code_lines": { "start_line": 171, "end_line": 176 }, "commit_date_time": "2022-01-09 05:06:56", "commit_sha": "665eeb4b27271dea1b82d34ac9863fbfe8d9e526", "commit_message": "Explici...
- def available_flag(self) -> threading.Event: ? ---- ^ ^^ + def available_flag(self) -> asyncio.Event: ? ^^^^ ^ return self._wrap_event_flag
- Return threading event flag that indicates if camera's API is responding. ? ---------- + Return event flag that indicates if camera's API is responding.
false
false
homeassistant/components/amcrest/__init__.py
__init__.py
core
home-assistant
st2tests_st2tests_action_aliases.py
BaseActionAliasTestCase.assertExtractedParametersMatch
[ { "version": "v1", "docstring_lines": { "start_line": 47, "end_line": 54 }, "code_lines": { "start_line": 54, "end_line": 69 }, "commit_date_time": "2016-04-07 16:35:15", "commit_sha": "d02e63c9d38e5ec8c6cb971f35ba1d81c829b0ca", "commit_message": "Improve code...
def assertExtractedParametersMatch(self, format_string, command, values): - extracted_params = extract_parameters(action_alias_db=self.action_alias_db, ? ^ ^^^^^^^^^^^^^^^^^^^^^^ + extracted_params = extract_p...
+ Assert that the provided command matches the format string. - Assert that the parameters extracted from the user provided command string match the - provided values. In addition to that, also assert that the parameters which have been extracted from the - user input also match the provide...
false
false
st2tests/st2tests/action_aliases.py
action_aliases.py
st2
StackStorm
theano_tensor_nnet_abstract_conv.py
conv2d
[ { "version": "v62", "docstring_lines": { "start_line": 370, "end_line": 417 }, "code_lines": { "start_line": 417, "end_line": 445 }, "commit_date_time": "2016-02-03 21:00:32", "commit_sha": "10ba9ab74b22a1838de0e85873c9d1da6e350329", "commit_message": "fixing ...
def conv2d(input, filters, input_shape=None, filter_shape=None, border_mode='valid', subsample=(1, 1), filter_flip=True): - conv_op = AbstractConv2d(imshp=input_shape, kshp=filter_shape...
- This function will build the symbolic graph for convolving a + This function will build the symbolic graph for convolving a mini-batch of a ? ++++++++++++++++ + stack of 2D inputs with a set of 2D filters. The implementation is modelled + after Conv...
false
false
theano/tensor/nnet/abstract_conv.py
abstract_conv.py
Theano
Theano
theano_tensor_nnet_abstract_conv.py
conv2d_grad_wrt_inputs
[ { "version": "v140", "docstring_lines": { "start_line": 1621, "end_line": 1674 }, "code_lines": { "start_line": 1674, "end_line": 1745 }, "commit_date_time": "2017-08-18 19:28:09", "commit_sha": "89221d0d88c5d66d1f6263e6dcda5f052387f791", "commit_message": "sm...
def conv2d_grad_wrt_inputs(output_grad, filters, input_shape, filter_shape=None, border_mode='valid', subsample=(1, 1), filter_flip=True, ...
Compute conv output gradient w.r.t its inputs This function builds the symbolic graph for getting the gradient of the output of a convolution (namely output_grad) w.r.t the input of the convolution, given a set of 2D filters used by the convolution, such that the output_grad is upsampled ...
false
false
theano/tensor/nnet/abstract_conv.py
abstract_conv.py
Theano
Theano
theano_tensor_nnet_abstract_conv.py
get_conv_gradinputs_shape_1axis
[ { "version": "v156", "docstring_lines": { "start_line": 1366, "end_line": 1451 }, "code_lines": { "start_line": 1451, "end_line": 1487 }, "commit_date_time": "2017-09-19 19:26:36", "commit_sha": "0d2bee043e9df3c81f1629bd66604bafbc45d2fe", "commit_message": "fi...
def get_conv_gradinputs_shape_1axis(kernel_shape, top_shape, border_mode, subsample, dilation): if None in [kernel_shape, top_shape, border_mode, subsample, dilation]: return None if subsample != 1: return ...
This function tries to compute the image shape of convolution gradInputs. The image shape can only be computed exactly when subsample is 1. If subsample is not 1, this function will return None. Parameters ---------- kernel_shape: int or None. Corresponds to the kernel shape on a g...
false
false
theano/tensor/nnet/abstract_conv.py
abstract_conv.py
Theano
Theano
theano_tensor_nnet_abstract_conv.py
bilinear_upsampling
[ { "version": "v155", "docstring_lines": { "start_line": 1682, "end_line": 1731 }, "code_lines": { "start_line": 1731, "end_line": 1796 }, "commit_date_time": "2017-09-12 16:36:54", "commit_sha": "83a288fd3396ead83d9a9c132ea5464c5bde06df", "commit_message": "ad...
def bilinear_upsampling(input, - ratio, + ratio=None, ? +++++ + frac_ratio=None, batch_size=None, num_input_channels=None, use_1D_kernel=T...
Compute bilinear upsampling - This function will build the symbolic graph for upsampling a tensor by the given ratio using bilinear interpolation. Parameters ---------- input: symbolic 4D tensor mini-batch of feature map stacks, of shape (batch size, input channel...
false
false
theano/tensor/nnet/abstract_conv.py
abstract_conv.py
Theano
Theano
python_ray_autoscaler__private_resource_demand_scheduler.py
ResourceDemandScheduler.get_nodes_to_launch
[ { "version": "v32", "docstring_lines": { "start_line": 445, "end_line": 456 }, "code_lines": { "start_line": 456, "end_line": 459 }, "commit_date_time": "2021-08-19 03:56:33", "commit_sha": "d958457d07b4a6bbae7be59e8c5f6062894eb340", "commit_message": "[Core] ...
def get_nodes_to_launch( self, nodes: List[NodeID], launching_nodes: Dict[NodeType, int], resource_demands: List[ResourceDict], unused_resources_by_ip: Dict[NodeIP, ResourceDict], pending_placement_groups: List[PlacementGroupTableData...
Given resource demands, return node types to add to the cluster. This method: (1) calculates the resources present in the cluster. (2) calculates the remaining nodes to add to respect min_workers constraint per node type. (3) for each strict spr...
false
false
python/ray/autoscaler/_private/resource_demand_scheduler.py
resource_demand_scheduler.py
ray
ray-project
python_ray_autoscaler__private_resource_demand_scheduler.py
ResourceDemandScheduler._get_concurrent_resource_demand_to_launch
[ { "version": "v20", "docstring_lines": { "start_line": 627, "end_line": 644 }, "code_lines": { "start_line": 644, "end_line": 670 }, "commit_date_time": "2020-11-19 00:24:48", "commit_sha": "4717fcd9c06b65ee1c99e5547434e4fad0479358", "commit_message": "[autosc...
def _get_concurrent_resource_demand_to_launch( self, to_launch: Dict[NodeType, int], connected_nodes: List[NodeIP], non_terminated_nodes: List[NodeID], pending_launches_nodes: Dict[NodeType, int], - nodes_to_add_based_on_requests: Dict[...
Updates the max concurrent resources to launch for each node type. Given the current nodes that should be launched, the non terminated nodes (running and pending) and the pending to be launched nodes. This method calculates the maximum number of nodes to launch concurrently ...
false
false
python/ray/autoscaler/_private/resource_demand_scheduler.py
resource_demand_scheduler.py
ray
ray-project
pydantic_mypy.py
PydanticModelField.deserialize
[ { "version": "v51", "docstring_lines": { "start_line": 899, "end_line": 903 }, "code_lines": { "start_line": 903, "end_line": 969 }, "commit_date_time": "2023-06-21 10:38:06", "commit_sha": "64264eca79660f334be663597d387dd4f7c98fd9", "commit_message": "Improve...
- def deserialize(cls, info: TypeInfo, data: JsonDict) -> PydanticModelField: + def deserialize(cls, info: TypeInfo, data: JsonDict, api: SemanticAnalyzerPluginInterface) -> PydanticModelField: ? ++++++++++++++++++++++++++++++++++++++ - return cls(*...
- Creates a Pydantic model field from a dict. + Based on mypy.plugins.dataclasses.DataclassAttribute.deserialize.
false
false
pydantic/mypy.py
mypy.py
pydantic
pydantic
research_object_detection_models_bidirectional_feature_pyramid_generators.py
KerasBiFpnFeatureMaps.__init__
[ { "version": "v1", "docstring_lines": { "start_line": 359, "end_line": 388 }, "code_lines": { "start_line": 388, "end_line": 445 }, "commit_date_time": "2020-06-26 17:45:37", "commit_sha": "a555f1b07bf5c30a20a86e9420f5a1e372116aa7", "commit_message": "Merged c...
def __init__(self, bifpn_num_iterations, bifpn_num_filters, fpn_min_level, fpn_max_level, input_max_level, is_training, conv_hyperparams, freeze_batchnorm, bifpn_nod...
Constructor. Args: bifpn_num_iterations: The number of top-down bottom-up iterations. bifpn_num_filters: The number of filters (channels) to be used for all feature maps in this BiFPN. fpn_min_level: The minimum pyramid level (highest feature map resolution) to use...
false
false
research/object_detection/models/bidirectional_feature_pyramid_generators.py
bidirectional_feature_pyramid_generators.py
models
tensorflow
localstack_utils_cloudwatch_cloudwatch_util.py
publish_sqs_metric
[ { "version": "v28", "docstring_lines": { "start_line": 50, "end_line": 59 }, "code_lines": { "start_line": 59, "end_line": 76 }, "commit_date_time": "2023-08-29 07:13:23", "commit_sha": "601aecb0e16ca2dd75f5b9b6d5ed6c142c0af278", "commit_message": "CloudWatch:...
def publish_sqs_metric( - region: str, queue_name: str, metric: str, value: float = 1, unit: str = "Count" + account_id: str, + region: str, + queue_name: str, + metric: str, + value: float = 1, + unit: str = "Count", ): - cw_client = connect_to(region_name=regio...
Publishes the metrics for SQS to CloudWatch using the namespace "AWS/SQS" See also: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-available-cloudwatch-metrics.html + :param account_id The account id that should be used for CloudWatch :param region The region that shoul...
false
false
localstack/utils/cloudwatch/cloudwatch_util.py
cloudwatch_util.py
localstack
localstack
samcli_lib_providers_sam_function_provider.py
SamFunctionProvider._convert_lambda_function_resource
[ { "version": "v10", "docstring_lines": { "start_line": 169, "end_line": 177 }, "code_lines": { "start_line": 177, "end_line": 196 }, "commit_date_time": "2019-12-18 22:03:42", "commit_sha": "382a81483a6bf616e6d30490c0fa433cabeb6555", "commit_message": "refacto...
def _convert_lambda_function_resource(name, resource_properties, layers): # pylint: disable=invalid-name # CodeUri is set to "." in order to get code locally from current directory. AWS::Lambda::Function's ``Code`` # property does not support specifying a local...
Converts a AWS::Serverless::Function resource to a Function configuration usable by the provider. + Parameters + ---------- + name str - :param string name: LogicalID of the resource NOTE: This is *not* the function name because not all functions ? ^^^^^^^^^^^^^^^^^^^ + ...
false
false
samcli/lib/providers/sam_function_provider.py
sam_function_provider.py
aws-sam-cli
aws
samcli_lib_providers_sam_function_provider.py
SamFunctionProvider._extract_functions
[ { "version": "v44", "docstring_lines": { "start_line": 444, "end_line": 467 }, "code_lines": { "start_line": 467, "end_line": 545 }, "commit_date_time": "2022-04-06 20:13:38", "commit_sha": "a55764cdbf12a817de1b71a8e6a3219d780ab920", "commit_message": "Functio...
def _extract_functions( - stacks: List[Stack], use_raw_codeuri: bool = False, ignore_code_extraction_warnings: bool = False + stacks: List[Stack], + use_raw_codeuri: bool = False, + ignore_code_extraction_warnings: bool = False, + locate_layer_nested: bool = False, ) -> D...
Extracts and returns function information from the given dictionary of SAM/CloudFormation resources. This method supports functions defined with AWS::Serverless::Function and AWS::Lambda::Function :param stacks: List of SAM/CloudFormation stacks to extract functions from :param bool u...
false
false
samcli/lib/providers/sam_function_provider.py
sam_function_provider.py
aws-sam-cli
aws
samcli_lib_providers_sam_function_provider.py
SamFunctionProvider._build_function_configuration
[ { "version": "v31", "docstring_lines": { "start_line": 19, "end_line": 25 }, "code_lines": { "start_line": 25, "end_line": 25 }, "commit_date_time": "2021-03-11 01:26:55", "commit_sha": "52cf6f540996baa90b926846d133bfdb9d5410b5", "commit_message": "chore: Add ...
def _build_function_configuration( stack: Stack, name: str, codeuri: Optional[str], resource_properties: Dict, layers: List, inlinecode: Optional[str], imageuri: Optional[str], + use_raw_codeuri: bool = False, ) -> Function: ...
Builds a Function configuration usable by the provider. Parameters ---------- name str LogicalID of the resource NOTE: This is *not* the function name because not all functions declare a name codeuri str Representing the local code path ...
false
false
samcli/lib/providers/sam_function_provider.py
sam_function_provider.py
aws-sam-cli
aws
official_modeling_performance.py
set_mixed_precision_policy
[ { "version": "v16", "docstring_lines": { "start_line": 40, "end_line": 42 }, "code_lines": { "start_line": 42, "end_line": 54 }, "commit_date_time": "2023-03-29 17:55:19", "commit_sha": "00b830c7ca641413f37e5147cf059c89f79b0e8e", "commit_message": "Internal ch...
def set_mixed_precision_policy(dtype, loss_scale=None): # TODO(b/191894773): Remove loss_scale argument assert loss_scale is None, ( 'The loss_scale argument must be None. The argument exists for ' 'historical reasons and will be removed soon.') if dtype == tf.float16: - tf.keras....
- Sets the global `tf.keras.mixed_precision.Policy`. ? ^ + Sets the global `tf_keras.mixed_precision.Policy`. ? ^
false
false
official/modeling/performance.py
performance.py
models
tensorflow
agenthub_monologue_agent_utils_monologue.py
Monologue.condense
[ { "version": "v15", "docstring_lines": { "start_line": 60, "end_line": 69 }, "code_lines": { "start_line": 69, "end_line": 79 }, "commit_date_time": "2024-04-14 04:51:17", "commit_sha": "53f95056dee645f8bccafae76771b965b05424ca", "commit_message": "Revamp Exce...
def condense(self, llm: LLM): try: prompt = prompts.get_summarize_monologue_prompt(self.thoughts) messages = [{'content': prompt, 'role': 'user'}] resp = llm.completion(messages=messages) summary_resp = resp['choices...
Attempts to condense the monologue by using the llm Parameters: - llm (LLM): llm to be used for summarization Raises: - - RunTimeError: When the condensing process fails for any reason + - Exception: the same exception as it got from the llm or processing the respon...
false
false
agenthub/monologue_agent/utils/monologue.py
monologue.py
OpenDevin
OpenDevin
agenthub_monologue_agent_utils_monologue.py
Monologue.add_event
[ { "version": "v14", "docstring_lines": { "start_line": 20, "end_line": 29 }, "code_lines": { "start_line": 29, "end_line": 32 }, "commit_date_time": "2024-04-14 04:19:56", "commit_sha": "dd32fa6f4a689d6243ae8056ca03d91708b78713", "commit_message": "Unify linte...
def add_event(self, t: dict): if not isinstance(t, dict): - raise ValueError('Event must be a dictionary') + raise AgentEventTypeError() self.thoughts.append(t)
Adds an event to memory if it is a valid event. Parameters: - t (dict): The thought that we want to add to memory Raises: - - ValueError: If t is not a dict ? ^^^^ + - AgentEventTypeError: If t is not a dict ? ^^^^^^^^^^^^^
false
false
agenthub/monologue_agent/utils/monologue.py
monologue.py
OpenDevin
OpenDevin