inputs
stringlengths
312
52k
targets
stringlengths
1
3.1k
block_type
stringclasses
11 values
scenario
stringclasses
7 values
<filename>searcharray/searcharray/solr.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # searcharray/searcharray/postings.py def positions(self, term=None): if self.posns is None: return {} if term is None: p...
term_scores = []
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>searcharray/searcharray/postings.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # searcharray/searcharray/term_dict.py def get_term_id(self, term): try: return self.term_to_ids[term] except KeyError: ...
return self.posns.docfreq(self.term_dict.get_term_id(token))
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>searcharray/searcharray/utils/roaringish.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # searcharray/searcharray/phrase/middle_out.py def adjacent_bigram_freqs(lhs: np.ndarray, rhs: np.ndarray, phrase_freqs: np.nda...
_, (lhs_idx, rhs_idx) = snp.intersect(lhs >> self.payload_lsb_bits, rhs_shifted, indices=True, algorithm=_algorithm)
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>searcharray/searcharray/utils/roaringish.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # searcharray/searcharray/utils/mat_set.py def __str__(self): as_str = [""] for idx, (row, row_next) in enumerate(zip(self.rows, self...
msbs = (encoded & self.payload_msb_mask) >> self.payload_msb_bits
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>searcharray/searcharray/phrase/middle_out.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # searcharray/searcharray/term_dict.py def get_term_id(self, term): try: return self.term_to_ids[term] except KeyError: ...
return [np.array([], dtype=np.uint32)]
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>searcharray/searcharray/phrase/middle_out.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # searcharray/searcharray/term_dict.py def get_term_id(self, term): try: return self.term_to_ids[term] except KeyError: ...
return decs
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>searcharray/searcharray/solr.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # searcharray/searcharray/postings.py def positions(self, term=None): if self.posns is None: return {} if term is None: p...
for field, boost in query_fields.items(): term = search_terms[field][term_posn] post_arr = get_field(frame, field) field_term_score = post_arr.score(term, similarity=similarity) * (1 if boost is None else boost) boost_exp = f"{boost}" if boost is not None else "1" ...
FOR
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>searcharray/searcharray/solr.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # searcharray/searcharray/phrase/middle_out.py def insert(self, key, term_ids_to_posns, is_encoded=False): new_posns = PosnBitArrayBuilder() if i...
for field in query_fields: arr = get_field(frame, field) tokenizer = arr.tokenizer search_terms[field] = [] field_num_search_terms = 0 for posn, term in enumerate(tokenizer(query)): search_terms[field].append(term) field_num_search_terms += 1 if n...
FOR
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>searcharray/searcharray/solr.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # searcharray/searcharray/similarity.py def bm25_legacy_similarity(k1: float = 1.2, b: float = 0.75) -> Similarity: """BM25 similarity prior to LUCENE-8563 with ...
for field, boost in phrase_fields.items(): arr = get_field(frame, field) terms = search_terms[field] field_phrase_score = arr.score(terms, similarity=similarity) * (1 if boost is None else boost) boost_exp = f"{boost}" if boost is not None else "1" explain += f" ({field}:\"{' '.j...
FOR
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>searcharray/searcharray/solr.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # searcharray/searcharray/phrase/middle_out.py def insert(self, key, term_ids_to_posns, is_encoded=False): new_posns = PosnBitArrayBuilder() if i...
for posn, term in enumerate(tokenizer(query)): search_terms[field].append(term) field_num_search_terms += 1
FOR
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>searcharray/searcharray/solr.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # searcharray/searcharray/phrase/posn_diffs.py def compute_phrase_freqs(term_posns, phrase_freqs, slop=1, width=10): """Compute phrase freq using matrix-diff met...
for s in spec.split(): parts = s.split('<', 1) if len(parts) < 2: raise ValueError("Invalid 'mm' spec: '" + s + "'. Expecting values before and after '<'") upper_bound = checked_parse_int(parts[0], "Invalid 'mm' spec. Expecting an integer.") if num_clauses...
FOR
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>searcharray/searcharray/solr.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # searcharray/searcharray/postings.py def positions(self, term=None): if self.posns is None: return {} if term is None: p...
for term_posn in range(num_search_terms): max_scores = np.zeros(len(frame)) term_explain = [] for field, boost in query_fields.items(): term = search_terms[field][term_posn] post_arr = get_field(frame, field) field_term_score = post_arr.score(term, similarity=...
FOR
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>searcharray/searcharray/utils/roaringish.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # searcharray/searcharray/utils/mat_set.py def __str__(self): as_str = [""] for idx, (row, row_next) in enumerate(zip(self.rows, self...
for bit in range(self.payload_lsb_bits): mask = 1 << bit lsbs = encoded & mask set_lsbs = (lsbs != 0) this_keys = keys[set_lsbs] payload = bit + (msbs[set_lsbs] * self.payload_lsb_bits) doc_with_posn = np.dstack([this_keys, payload])[0] ...
FOR
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>searcharray/searcharray/postings.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # searcharray/searcharray/phrase/posn_diffs.py def stack_term_posns(term_posns: List[List[np.ndarray]], phrase_freqs: np.ndarray, width: int = 10): # Pad for...
for curr_mask in masks: mask = mask & curr_mask
FOR
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>searcharray/searcharray/phrase/middle_out.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # searcharray/searcharray/utils/row_viewable_matrix.py def rowwise_eq(mat: SparseMatSet, other: SparseMatSet) -> Union[bool, np.ndarray]: """Check e...
for rhs in encoded_posns[1:]: # Only count the count of the last bigram (ignoring the ones where priors did not match) phrase_freqs[mask] = 0 phrase_freqs, lhs = bigram_freqs(lhs, rhs, phrase_freqs) mask &= (phrase_freqs > 0)
FOR
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>searcharray/searcharray/solr.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # searcharray/searcharray/postings.py def ws_tokenizer(string): if pd.isna(string): return [] if not isinstance(string, str): raise ValueErro...
for field in field_lists: parts = carat_pattern.split(field) out[parts[0]] = None if len(parts) == 1 else float(parts[1])
FOR
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>searcharray/searcharray/term_dict.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # searcharray/searcharray/postings.py def docfreq(self, token: str) -> int: if not isinstance(token, str): raise TypeError("Expected a s...
try: return self.term_to_ids[term]
TRY
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>searcharray/searcharray/solr.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # searcharray/searcharray/phrase/posn_diffs.py def compute_phrase_freqs(term_posns, phrase_freqs, slop=1, width=10): """Compute phrase freq using matrix-diff met...
try: return int(value)
TRY
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>searcharray/searcharray/postings.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # searcharray/searcharray/phrase/middle_out.py def _termfreqs_with_cache(self, term_id: int) -> Tuple[np.ndarray, np.ndarray]: try: retur...
try: doc_ids = self.term_mat.rows term_ids = [self.term_dict.get_term_id(token) for token in tokens] return self.posns.phrase_freqs(term_ids, doc_ids=doc_ids, phrase_freqs=phrase_freqs)
TRY
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>searcharray/searcharray/postings.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # searcharray/searcharray/utils/row_viewable_matrix.py def __getitem__(self, key): if isinstance(key, numbers.Integral): return self.copy...
try: rows = self.term_mat[key] doc_len = self.doc_lens[key] doc_id = key if doc_id < 0: doc_id += len(self) return _row_to_postings_row(doc_id, rows[0], doc_len, self.term_dict...
TRY
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>searcharray/searcharray/postings.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # searcharray/searcharray/term_dict.py def get_term_id(self, term): try: return self.term_to_ids[term] except KeyError: ...
try: return self.posns.docfreq(self.term_dict.get_term_id(token))
TRY
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>searcharray/searcharray/phrase/middle_out.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # searcharray/searcharray/solr.py def checked_parse_int(value, error_message): try: return int(value) except ValueError:...
try: return self.docfreq_cache[term_id]
TRY
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>searcharray/searcharray/postings.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # searcharray/searcharray/term_dict.py def get_term_id(self, term): try: return self.term_to_ids[term] except KeyError: ...
try: term_id = self.term_dict.get_term_id(token) matches = np.zeros(len(self), dtype=int) slice_of_rows = None if self.term_mat.subset: slice_of_rows = self.term_mat.rows doc_ids, termfreqs = self.posns.termfreqs(term_id, ...
TRY
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>searcharray/searcharray/phrase/middle_out.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # searcharray/searcharray/postings.py def phrase_freq(self, tokens: List[str], slop=1) -> np.ndarray: if slop == 1 and len(tokens) == len(se...
try: return self.termfreq_cache[term_id]
TRY
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>searcharray/searcharray/solr.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # searcharray/searcharray/term_dict.py def get_term_id(self, term): try: return self.term_to_ids[term] except KeyError: r...
try: return int(value)
TRY
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>searcharray/searcharray/phrase/middle_out.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # searcharray/searcharray/term_dict.py def get_term_id(self, term): try: return self.term_to_ids[term] except KeyError: ...
try: np_doc_ids = convert_keys(doc_ids) term_posns = encoder.slice(self.encoded_term_posns[term_id], keys=np_doc_ids)
TRY
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>searcharray/searcharray/postings.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # searcharray/searcharray/phrase/middle_out.py def _termfreqs_with_cache(self, term_id: int) -> Tuple[np.ndarray, np.ndarray]: try: retur...
except TermMissingError: return phrase_freqs
CATCH
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>searcharray/searcharray/solr.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # searcharray/searcharray/phrase/posn_diffs.py def compute_phrase_freqs(term_posns, phrase_freqs, slop=1, width=10): """Compute phrase freq using matrix-diff met...
except ValueError: raise ValueError(error_message)
CATCH
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>searcharray/searcharray/postings.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # searcharray/searcharray/utils/row_viewable_matrix.py def __getitem__(self, key): if isinstance(key, numbers.Integral): return self.copy...
except IndexError: raise IndexError("index out of bounds")
CATCH
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>searcharray/searcharray/phrase/middle_out.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # searcharray/searcharray/solr.py def checked_parse_int(value, error_message): try: return int(value) except ValueError:...
except KeyError: encoded = self.encoded_term_posns[term_id] docfreq = np.uint64(encoder.keys_unique(encoded).size) self._maybe_cache_docfreq(term_id, docfreq) return docfreq
CATCH
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>searcharray/searcharray/postings.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # searcharray/searcharray/term_dict.py def get_term_id(self, term): try: return self.term_to_ids[term] except KeyError: ...
except TermMissingError: return 0
CATCH
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>searcharray/searcharray/phrase/middle_out.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # searcharray/searcharray/postings.py def phrase_freq(self, tokens: List[str], slop=1) -> np.ndarray: if slop == 1 and len(tokens) == len(se...
except KeyError: term_posns = self.encoded_term_posns[term_id] doc_ids, term_freqs = self._computed_term_freqs(term_posns) if self._is_cached(term_id): self.termfreq_cache[term_id] = (doc_ids, term_freqs) return doc_ids, term_freqs
CATCH
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>searcharray/searcharray/phrase/middle_out.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # searcharray/searcharray/term_dict.py def get_term_id(self, term): try: return self.term_to_ids[term] except KeyError: ...
except KeyError: r_val = [np.array([], dtype=np.uint32) for doc_id in doc_ids] if len(r_val) == 1 and len(doc_ids) == 1 and isinstance(doc_ids[0], numbers.Number): return [r_val[0]] return r_val
CATCH
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>searcharray/searcharray/postings.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # searcharray/searcharray/term_dict.py def get_term_id(self, term): try: return self.term_to_ids[term] except KeyError: ...
except TermMissingError: return np.zeros(len(self), dtype=int)
CATCH
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>searcharray/searcharray/solr.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # searcharray/searcharray/term_dict.py def get_term_id(self, term): try: return self.term_to_ids[term] except KeyError: r...
except ValueError: raise ValueError(error_message)
CATCH
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>searcharray/searcharray/term_dict.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # searcharray/searcharray/postings.py def docfreq(self, token: str) -> int: if not isinstance(token, str): raise TypeError("Expected a s...
except KeyError: raise TermMissingError(f"Term {term} not present in dictionary. Reindex to add.")
CATCH
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>searcharray/searcharray/solr.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # searcharray/searcharray/similarity.py def bm25_legacy_similarity(k1: float = 1.2, b: float = 0.75) -> Similarity: """BM25 similarity prior to LUCENE-8563 with ...
def listify(x): return x if isinstance(x, list) else [x]
METHOD
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>searcharray/searcharray/solr.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # searcharray/searcharray/phrase/posn_diffs.py def compute_phrase_freqs(term_posns, phrase_freqs, slop=1, width=10): """Compute phrase freq using matrix-diff met...
def checked_parse_int(value, error_message): try: return int(value) except ValueError: raise ValueError(error_message)
METHOD
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>tanuki_py/src/tanuki/language_models/language_model_manager.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # tanuki_py/src/tanuki/language_models/embedding_model_manager.py def get_embedding_case(self, args, function_description: Functio...
""" Check if the inputs are suitable for finetuning, i.e are below the finetuning token count """
BLOCK_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>tanuki_py/src/tanuki/validator.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # tanuki_py/src/tanuki/function_modeler.py def _construct_config_from_finetune(self, finetune_hash: str, finetune: FinetuneJob): """ Construct ...
""" Validate a value against a type definition. Args: value: Any object or primitive value type_definition: The type definition to validate against Returns: Whether the value is valid for the type definition """
BLOCK_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>tanuki_py/src/tanuki/utils.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # tanuki_py/src/tanuki/validator.py def _is_tuple_like(self, target_type: Type) -> bool: """Determine if the target type is tuple-like.""" if targe...
""" Get a dictionary representation of the object """
BLOCK_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>tanuki_py/src/tanuki/trackers/abc_buffered_logger.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # tanuki_py/src/tanuki/function_modeler.py def _save_contrastive_alignment_pair(self, function_hash: str, args, kwargs, pair, positive=True)...
""" Log a patched function invocation to the file system :param func_hash: A string representation of the function signature and input parameters :param example: :return: """
BLOCK_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>tanuki_py/src/tanuki/persistence/filter/filesystem_bloom.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # tanuki_py/src/tanuki/trackers/filesystem_buffered_logger.py def get_patch_location_for_function(self, func_hash, extension: Union[ ...
""" Load a bloom filter from the local filesystem. :return: A bloom filter object containing the state of unique function invocations """
BLOCK_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>tanuki_py/src/tanuki/models/function_config.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # tanuki_py/src/tanuki/function_modeler.py def _construct_config_from_finetune(self, finetune_hash: str, finetune: FinetuneJob): """ ...
""" Update the function config with the finetuned response Args: response: The finetuned response """
BLOCK_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>tanuki_py/src/tanuki/validator.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # tanuki_py/src/tanuki/trackers/filesystem_buffered_logger.py def does_object_exist(self, path: str) -> bool: """ Check to see if a path exists...
"""Validate base types."""
BLOCK_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>tanuki_py/src/tanuki/function_modeler.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # tanuki_py/src/tanuki/models/function_config.py def update_with_finetuned_response(self, response): """ Update the function config with...
""" Return the current model from the config file """
BLOCK_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>tanuki_py/src/tanuki/trackers/filesystem_buffered_logger.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # tanuki_py/src/tanuki/trackers/abc_buffered_logger.py def get_bloom_filter_persistence(self) -> IBloomFilterPersistence: """...
""" Get an instance of the bloom filter persistence provider. Typically this will be a file system provider. :return: A persistence provider """
BLOCK_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>tanuki_py/src/tanuki/function_modeler.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # tanuki_py/src/tanuki/models/function_config.py def update_with_finetuned_response(self, response): """ Update the function config with...
""" Load the config file for a function hash """
BLOCK_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>tanuki_py/src/tanuki/validator.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # tanuki_py/src/tanuki/trackers/dataset_worker.py def log_symbolic_patch(self, func_hash, example): """ Save the example to the patch dataset f...
if self._is_subclass_of_generic(target_type, tuple): return target_type(instantiated_tuple)
IF
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>tanuki_py/src/tanuki/validator.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # tanuki_py/src/tanuki/register.py def get_class_definition(class_type): """Helper function to get class definition source if not a built-in ty...
if hasattr(target_type, '__orig_bases__'): for base in target_type.__orig_bases__: if get_args(base): return base, get_args(base)
IF
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>tanuki_py/src/tanuki/validator.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # tanuki_py/src/tanuki/function_modeler.py def _construct_config_from_finetune(self, finetune_hash: str, finetune: FinetuneJob): """ Construct ...
if not isinstance(value, tuple): return False
IF
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>tanuki_py/src/tanuki/validator.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # tanuki_py/src/tanuki/trackers/dataset_worker.py def log_symbolic_patch(self, func_hash, example): """ Save the example to the patch dataset f...
if self._is_subclass_of_generic(target_type, list) and not self._is_generic(target_type): return target_type(instantiated_items)
IF
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>tanuki_py/src/tanuki/trackers/abc_buffered_logger.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # tanuki_py/src/tanuki/function_modeler.py def _save_contrastive_alignment_pair(self, function_hash: str, args, kwargs, pair, positive=True)...
if log_file_path not in self.buffers: self.buffers[log_file_path] = bytearray()
IF
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>tanuki_py/src/tanuki/language_models/language_model_manager.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # tanuki_py/src/tanuki/utils.py def get_model(content, logger, func_hash): """ Get the model from the content and the logger. ...
if func_hash not in self.initialized_functions: # initialise the initialized_functions dict self.initialized_functions[func_hash] = {"model": "", "examples": []}
IF
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>tanuki_py/src/tanuki/validator.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # tanuki_py/src/tanuki/trackers/dataset_worker.py def log_symbolic_patch(self, func_hash, example): """ Save the example to the patch dataset f...
if self.is_base_type(target_type) or target_type is Any: # If the parsed data is a string and target type is str, return it directly if isinstance(data, str) and target_type is str: return data # If any, return the data directly if target_type is Any: ...
IF
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>tanuki_py/src/tanuki/validator.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # tanuki_py/src/tanuki/trackers/dataset_worker.py def log_symbolic_patch(self, func_hash, example): """ Save the example to the patch dataset f...
if origin is defaultdict or (isinstance(origin, type) and issubclass(origin, defaultdict)): key_type, value_type = get_args(target_type) if get_args(target_type) else (Any, Any) instantiated_items = {self.instantiate(k, key_type): self.instantiate(v, value_type) for k, v in ...
IF
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>tanuki_py/src/tanuki/validator.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # tanuki_py/src/tanuki/function_modeler.py def _construct_config_from_finetune(self, finetune_hash: str, finetune: FinetuneJob): """ Construct ...
if origin == list: if not isinstance(value, list): return False item_type = args[0] if args else Any return all(self.check_type(v, item_type) for v in value)
IF
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>tanuki_py/src/tanuki/validator.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # tanuki_py/src/tanuki/function_modeler.py def _construct_config_from_finetune(self, finetune_hash: str, finetune: FinetuneJob): """ Construct ...
if origin == tuple: if not isinstance(value, tuple): return False item_type = args[0] if args else Any return all(self.check_type(v, item_type) for v in value)
IF
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>tanuki_py/src/tanuki/validator.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # tanuki_py/src/tanuki/trackers/dataset_worker.py def log_symbolic_patch(self, func_hash, example): """ Save the example to the patch dataset f...
return target_type(data)
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>tanuki_py/src/tanuki/persistence/filter/filesystem_bloom.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # tanuki_py/src/tanuki/trackers/filesystem_buffered_logger.py def get_patch_location_for_function(self, func_hash, extension: Union[ ...
bloom_filter_path = os.path.join(self.log_directory, 'bloom_filter_state.bin')
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>tanuki_py/src/tanuki/validator.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # tanuki_py/src/tanuki/register.py def get_class_definition(class_type): """Helper function to get class definition source if not a built-in ty...
origin = get_origin(target_type)
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>tanuki_py/src/tanuki/models/function_description.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # tanuki_py/src/tanuki/bloom_filter.py def hash_functions(self, string): # h1(x) hash1 = int(hashlib.sha256(string.encode('ut...
return str(h)
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>tanuki_py/src/tanuki/function_modeler.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # tanuki_py/src/tanuki/language_models/language_model_manager.py def __init__(self, function_modeler: FunctionModeler, ...
self.function_configs = {}
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>tanuki_py/src/tanuki/validator.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # tanuki_py/src/tanuki/trackers/dataset_worker.py def log_symbolic_patch(self, func_hash, example): """ Save the example to the patch dataset f...
return dict(instantiated_dict)
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>tanuki_py/src/tanuki/trackers/abc_buffered_logger.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # tanuki_py/src/tanuki/trackers/filesystem_buffered_logger.py def load_existing_datasets(self) -> Dict[str, Dict[str, str]]: log_dir...
config_path = f"{log_file_path}.json"
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>tanuki_py/src/tanuki/validator.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # tanuki_py/src/tanuki/function_modeler.py def _construct_config_from_finetune(self, finetune_hash: str, finetune: FinetuneJob): """ Construct ...
key_type, value_type = args
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>tanuki_py/src/tanuki/validator.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # tanuki_py/src/tanuki/trackers/dataset_worker.py def log_symbolic_patch(self, func_hash, example): """ Save the example to the patch dataset f...
item_type = get_args(target_type)[0] if get_args(target_type) else Any
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>tanuki_py/src/tanuki/validator.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # tanuki_py/src/tanuki/trackers/dataset_worker.py def log_symbolic_patch(self, func_hash, example): """ Save the example to the patch dataset f...
item_type = item_types[0] if item_types else Any
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>tanuki_py/src/tanuki/trackers/filesystem_buffered_logger.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # tanuki_py/src/tanuki/trackers/abc_buffered_logger.py def ensure_persistence_location_exists(self): """ Ensure that ...
# If installed in a project that contains a git repo - place it in the same folder as the git repo
LINE_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>tanuki_py/src/tanuki/validator.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # tanuki_py/src/tanuki/trackers/dataset_worker.py def log_symbolic_patch(self, func_hash, example): """ Save the example to the patch dataset f...
# try to instantiate datetime
LINE_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>tanuki_py/src/tanuki/trackers/abc_buffered_logger.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # tanuki_py/src/tanuki/trackers/filesystem_buffered_logger.py def load_existing_datasets(self) -> Dict[str, Dict[str, str]]: log_dir...
# remove teacher_models from the config
LINE_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>tanuki_py/src/tanuki/language_models/language_model_manager.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # tanuki_py/src/tanuki/utils.py def get_model(content, logger, func_hash): """ Get the model from the content and the logger. ...
# initialise the initialized_functions dict
LINE_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>tanuki_py/src/tanuki/language_models/language_model_manager.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # tanuki_py/src/tanuki/utils.py def get_model(content, logger, func_hash): """ Get the model from the content and the logger. ...
# update the examples in the initialized_functions dict
LINE_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>tanuki_py/src/tanuki/validator.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # tanuki_py/src/tanuki/trackers/dataset_worker.py def log_symbolic_patch(self, func_hash, example): """ Save the example to the patch dataset f...
# If the target type is a built-in, attempt to instantiate and return
LINE_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>tanuki_py/src/tanuki/validator.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # tanuki_py/src/tanuki/trackers/dataset_worker.py def log_symbolic_patch(self, func_hash, example): """ Save the example to the patch dataset f...
# backwards compatibility with pydantic < 2
LINE_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>tanuki_py/src/tanuki/validator.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # tanuki_py/src/tanuki/trackers/dataset_worker.py def log_symbolic_patch(self, func_hash, example): """ Save the example to the patch dataset f...
# If none of the above, return the data as-is
LINE_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>tanuki_py/src/tanuki/validator.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # tanuki_py/src/tanuki/function_modeler.py def _construct_config_from_finetune(self, finetune_hash: str, finetune: FinetuneJob): """ Construct ...
# check that all required arguments are in value and do type checking
LINE_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>tanuki_py/src/tanuki/trackers/filesystem_buffered_logger.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # tanuki_py/src/tanuki/trackers/abc_buffered_logger.py def ensure_persistence_location_exists(self): """ Ensure that ...
# If installed as a library
LINE_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>tanuki_py/src/tanuki/validator.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # tanuki_py/src/tanuki/trackers/dataset_worker.py def log_symbolic_patch(self, func_hash, example): """ Save the example to the patch dataset f...
try: return int(float(data))
TRY
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>tanuki_py/src/tanuki/trackers/abc_buffered_logger.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # tanuki_py/src/tanuki/function_modeler.py def _save_contrastive_alignment_pair(self, function_hash: str, args, kwargs, pair, positive=True)...
try: self.write(log_file_path, self.buffers[log_file_path], mode="a+b") # update buffers written_datapoints[func_hash] = self.buffer_rolling_size[log_file_path] self.buffers[log_file_path].clear() self.buffer_rolling_size[log_file_path] = 0...
TRY
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>tanuki_py/src/tanuki/validator.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # tanuki_py/src/tanuki/function_modeler.py def _construct_config_from_finetune(self, finetune_hash: str, finetune: FinetuneJob): """ Construct ...
try: #temp_model = create_model('TempModel', **value) if isinstance(value, origin): return True #return isinstance(temp_model, origin) # check if value is dict if not isinstance(value, dict): return F...
TRY
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>tanuki_py/src/tanuki/validator.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # tanuki_py/src/tanuki/trackers/dataset_worker.py def log_symbolic_patch(self, func_hash, example): """ Save the example to the patch dataset f...
try: return self.instantiate(data, arg)
TRY
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>tanuki_py/src/tanuki/validator.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # tanuki_py/src/tanuki/trackers/dataset_worker.py def log_symbolic_patch(self, func_hash, example): """ Save the example to the patch dataset f...
try: return int(float(data))
TRY
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>tanuki_py/src/tanuki/validator.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # tanuki_py/src/tanuki/trackers/dataset_worker.py def log_symbolic_patch(self, func_hash, example): """ Save the example to the patch dataset f...
try: instantiated_item = self.instantiate(item, item_type)
TRY
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>tanuki_py/src/tanuki/validator.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # tanuki_py/src/tanuki/function_modeler.py def _construct_config_from_finetune(self, finetune_hash: str, finetune: FinetuneJob): """ Construct ...
try: obj = origin(**value) return True
TRY
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>tanuki_py/src/tanuki/validator.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # tanuki_py/src/tanuki/trackers/dataset_worker.py def log_symbolic_patch(self, func_hash, example): """ Save the example to the patch dataset f...
try: return target_type.model_validate(data)
TRY
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>tanuki_py/src/tanuki/validator.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # tanuki_py/src/tanuki/trackers/dataset_worker.py def log_symbolic_patch(self, func_hash, example): """ Save the example to the patch dataset f...
try: return target_type(**data)
TRY
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>tanuki_py/src/tanuki/trackers/abc_buffered_logger.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # tanuki_py/src/tanuki/function_modeler.py def _save_contrastive_alignment_pair(self, function_hash: str, args, kwargs, pair, positive=True)...
try: self.ensure_persistence_location_exists()
TRY
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>tanuki_py/src/tanuki/validator.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # tanuki_py/src/tanuki/function_modeler.py def _construct_config_from_finetune(self, finetune_hash: str, finetune: FinetuneJob): """ Construct ...
except: return False
CATCH
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>tanuki_py/src/tanuki/validator.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # tanuki_py/src/tanuki/trackers/dataset_worker.py def log_symbolic_patch(self, func_hash, example): """ Save the example to the patch dataset f...
except: continue
CATCH
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>tanuki_py/src/tanuki/validator.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # tanuki_py/src/tanuki/trackers/dataset_worker.py def log_symbolic_patch(self, func_hash, example): """ Save the example to the patch dataset f...
except (ValueError, TypeError): pass
CATCH
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>tanuki_py/src/tanuki/validator.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # tanuki_py/src/tanuki/function_modeler.py def _construct_config_from_finetune(self, finetune_hash: str, finetune: FinetuneJob): """ Construct ...
except Exception as e: print(e) return False
CATCH
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>tanuki_py/src/tanuki/validator.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # tanuki_py/src/tanuki/trackers/dataset_worker.py def log_symbolic_patch(self, func_hash, example): """ Save the example to the patch dataset f...
except (ValueError, TypeError): pass
CATCH
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>tanuki_py/src/tanuki/validator.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # tanuki_py/src/tanuki/trackers/dataset_worker.py def log_symbolic_patch(self, func_hash, example): """ Save the example to the patch dataset f...
except AttributeError as e: # backwards compatibility with pydantic < 2 return target_type.parse_obj(data)
CATCH
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>tanuki_py/src/tanuki/validator.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # tanuki_py/src/tanuki/trackers/abc_buffered_logger.py def write_symbolic_align_call(self, func_hash, example) -> bool: log_file_path = self.get_patch_...
except json.JSONDecodeError: return False
CATCH
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>tanuki_py/src/tanuki/language_models/openai_api.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # tanuki_py/src/tanuki/language_models/anyscale_api.py def generate(self, model, system_message, prompt, **kwargs): """ The ma...
except Exception as e: if ("error" in response and "code" in response["error"] and response["error"]["code"] == 'invalid_api_key'): raise Exception(f"The supplied OpenAI API key {self.api_key} is invalid") if counter == ...
CATCH
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>tanuki_py/src/tanuki/validator.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # tanuki_py/src/tanuki/trackers/dataset_worker.py def log_symbolic_patch(self, func_hash, example): """ Save the example to the patch dataset f...
except ValueError: raise TypeError( f"Item of type {type(item).__name__} does not match expected type {item_type[0].__name__}.")
CATCH
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>tanuki_py/src/tanuki/validator.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # tanuki_py/src/tanuki/trackers/dataset_worker.py def log_symbolic_patch(self, func_hash, example): """ Save the example to the patch dataset f...
except TypeError: raise TypeError(f"Failed to instantiate {target_type.__name__} from dictionary.")
CATCH
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>tanuki_py/src/tanuki/validator.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # tanuki_py/src/tanuki/trackers/dataset_worker.py def log_symbolic_patch(self, func_hash, example): """ Save the example to the patch dataset f...
for arg in get_args(target_type): try: return self.instantiate(data, arg) except: continue
FOR
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>tanuki_py/src/tanuki/bloom_filter.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # tanuki_py/src/tanuki/function_modeler.py def _configure_student_model(self, student_model: str, ...
for seed in range(self.hash_count): index = (hash1 + seed * hash2) % self.size self.bit_array[index] = 1 #print(f"Add: Seed={seed}, Digest={index}, BitValue={self.bit_array[index]}")
FOR
prefix_suffix_full_complete_current_block_with_repo_rag_oracle