query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
r"""Change the position in the file/series.
def change_position(self, file_pos, series_index=None): if series_index is None: series_index = self._series_index self.advance_in_series(series_index) self.advance_in_file(file_pos)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setPosition(position):", "def set_position(self, posicion):\n\n # FIXME: Actualmente no funciona bien\n posicion = int(posicion)\n if posicion != self.posicion:\n self.posicion = posicion\n self.entrada.write('seek %s %i 0\\n' % (posicion, 1))\n self.entr...
[ "0.72056144", "0.70718175", "0.67845094", "0.6580323", "0.6580323", "0.6580323", "0.6580323", "0.6580323", "0.6580323", "0.6580323", "0.6580323", "0.6580323", "0.6580323", "0.6580323", "0.6469467", "0.6442066", "0.64292395", "0.64211136", "0.6298545", "0.62945306", "0.6270689...
0.84161323
0
r"""Advance to a certain position in the current file.
def advance_in_file(self, file_pos): if self.is_open: try: self.fd.seek(file_pos) except (AttributeError, ValueError): # pragma: debug if self.is_open: raise
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def advance(self) -> None:\n self.current_token = self.jack_file_tokens[self._token_idx]\n self._token_idx += 1", "def change_position(self, file_pos, series_index=None):\n if series_index is None:\n series_index = self._series_index\n self.advance_in_series(series_index)\n...
[ "0.72152966", "0.69049877", "0.6838981", "0.6814385", "0.6776304", "0.6665995", "0.665468", "0.6625875", "0.6596541", "0.65920854", "0.65885144", "0.6423817", "0.62222093", "0.61866915", "0.61842614", "0.6172611", "0.6140963", "0.61377656", "0.61164963", "0.6113868", "0.60734...
0.7815316
0
r"""Advance to a certain file in a series.
def advance_in_series(self, series_index=None): out = False if self.is_series: if series_index is None: series_index = self._series_index + 1 if self._series_index != series_index: if (((self.direction == 'send') or os.path.isf...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def change_position(self, file_pos, series_index=None):\n if series_index is None:\n series_index = self._series_index\n self.advance_in_series(series_index)\n self.advance_in_file(file_pos)", "def next_file(self):\n raise NotImplementedError()", "def setNextFile(self):\n...
[ "0.64862776", "0.62571436", "0.58013743", "0.5733115", "0.55588067", "0.53472054", "0.530694", "0.5274793", "0.5255113", "0.5248722", "0.51650816", "0.50924605", "0.5050964", "0.5038752", "0.5038603", "0.5033101", "0.5023816", "0.5007362", "0.50028795", "0.49895343", "0.49683...
0.58193123
2
r"""Get the address of a file in the series.
def get_series_address(self, index=None): if index is None: index = self._series_index return self.address % index
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_loc(self):\n\t\treturn self.__dbfile", "def get_file_entry(self):\n pass", "def link(self, fname):\n return fname", "def fileUrl(self) -> str:\n if self.urls is None or len(self.urls) == 0:\n raise InputOutputError('Chart version does not have file urls')\n\n i...
[ "0.63108003", "0.6168881", "0.6091168", "0.6090714", "0.60745543", "0.6020673", "0.6017974", "0.5996216", "0.5953485", "0.5908953", "0.5885286", "0.5866734", "0.5802416", "0.57521087", "0.57091165", "0.5658679", "0.5606503", "0.56011635", "0.55989647", "0.5590912", "0.5569076...
0.5762605
13
r"""Close file when EOF to be sent.
def on_send_eof(self): flag, msg_s = super(FileComm, self).on_send_eof() try: self.fd.flush() except (AttributeError, ValueError): # pragma: debug if self.is_open: raise # self.close() return flag, msg_s
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def endfile(self) :\n\n\t\tself.fd.close()\n\t\treturn 1", "def _close(self):\n self.fh.close()", "def close(self):\n\n if self._buffer:\n self.flush()\n self._handle.write(_bgzf_eof)\n self._handle.flush()\n self._handle.close()", "def endFileOutput(self):\n ...
[ "0.7616852", "0.70272315", "0.6968532", "0.69370455", "0.6904911", "0.6900146", "0.6881973", "0.6857646", "0.6857646", "0.6731838", "0.67068696", "0.6695717", "0.6672172", "0.66496336", "0.66146374", "0.66146374", "0.6599462", "0.6599462", "0.65962714", "0.6594169", "0.658688...
0.6309329
39
r"""Write message to a file.
def _send(self, msg): try: if msg != self.eof_msg: if not self.open_as_binary: msg = backwards.as_unicode(msg) self.fd.write(msg) if self.append == 'ow': self.fd.truncate() self.fd.flush() exc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write(message):\n\n with open(str(path), 'a') as fp:\n fp.write(message)", "def write_msg(file_path, msg):\n try:\n fd = open(file_path, 'a+')\n fd.write(msg)\n fd.close()\n except Exception, e:\n debug(e)", "def WriteToFile(msg, file_name):\r\n out_msg = ...
[ "0.8442251", "0.82397515", "0.77011585", "0.7678833", "0.7614421", "0.75861824", "0.7571906", "0.7506095", "0.7440228", "0.7245873", "0.72123677", "0.7200499", "0.7200499", "0.717865", "0.717203", "0.69217885", "0.68961126", "0.68329555", "0.68048483", "0.6795374", "0.679528"...
0.0
-1
r"""Reads message from a file.
def _recv(self, timeout=0): flag = True try: if self.read_meth == 'read': out = self.fd.read() elif self.read_meth == 'readline': out = self.fd.readline() except BaseException: # pragma: debug # Use this to catch case where clo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_file(self, filename):\n import pycbf\n self.cbf_handle = pycbf.cbf_handle_struct()\n self.cbf_handle.read_file(filename, pycbf.MSG_DIGEST)\n self.cbf_handle.rewind_datablock()", "def read_from_file(self, filename: str) -> None:", "def read(self, filename):\n pass", "def read(self,...
[ "0.71123075", "0.7036925", "0.6907029", "0.6907029", "0.68571204", "0.670311", "0.6662373", "0.66516316", "0.66199094", "0.6613957", "0.66086966", "0.6605945", "0.6546667", "0.65357894", "0.65169245", "0.6491202", "0.6471501", "0.647048", "0.64680797", "0.6429478", "0.6428459...
0.0
-1
r"""Purge all messages from the comm.
def purge(self): if self.is_open and self.direction == 'recv': try: self.fd.seek(0, os.SEEK_END) except (AttributeError, ValueError): # pragma: debug if self.is_open: raise
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_all(self):\n if self._processed:\n res, messages = self._mailconn.search(None, 'ALL')\n if res == 'OK':\n for msg in messages[0].split():\n res, data = self._mailconn.store(msg.decode('utf-8'), '+FLAGS', '\\\\Deleted')\n p...
[ "0.7650822", "0.76029015", "0.7258673", "0.7233067", "0.71664816", "0.6951946", "0.69284844", "0.690629", "0.68744373", "0.6856972", "0.6840228", "0.67339873", "0.6711218", "0.6697031", "0.6575052", "0.653088", "0.6470689", "0.6462076", "0.6435771", "0.64267474", "0.64187866"...
0.0
-1
Pick GPU if avaliable, else CPU
def get_default_device(): if torch.cuda.is_available(): return torch.device('cuda:0') else: return torch.device('cpu')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_gpu_device_if_present():\n d = dpctl.SyclDevice(\"gpu,cpu\")\n print(\"Selected \" + (\"GPU\" if d.is_gpu else \"CPU\") + \" device\")", "def return_free_GPU():\r\n if torch.cuda.is_available():\r\n gpu_num = torch.cuda.device_count()\r\n device = torch.device('cuda:{}'.format(g...
[ "0.7683472", "0.72507006", "0.72352254", "0.71842563", "0.7158814", "0.71412784", "0.711983", "0.7038046", "0.70373195", "0.69980836", "0.69747734", "0.69747734", "0.69747734", "0.6954179", "0.68830943", "0.6867826", "0.6854919", "0.6854919", "0.68005115", "0.67918307", "0.67...
0.65981096
30
Move tensor(s) to chosen device
def to_device(data, device): if isinstance(data, (list, tuple)): return [to_device(x, device) for x in data] return data.to(device, non_blocking=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_to_device(input_tensors: List[torch.Tensor],\n target_device: Optional[torch.device],\n non_blocking: bool = False) -> Iterable[torch.Tensor]:\n return (tensor if tensor.device == target_device or target_device is None\n else tensor.to(target_device, non_b...
[ "0.6268374", "0.5992489", "0.58285815", "0.58246756", "0.5760445", "0.5746895", "0.56957227", "0.5695672", "0.5674205", "0.5668232", "0.5656621", "0.55133724", "0.5512487", "0.55118686", "0.54767984", "0.5452559", "0.54362", "0.5378659", "0.5353823", "0.5353823", "0.53118145"...
0.0
-1
Yield a batch of data after moving it to device
def __iter__(self): for b in self.dl: yield to_device(b, self.device)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __iter__(self):\n for b in self.dl: \n yield to_device(b, self.device) # yield pauses the execution, not store values in memory, forgets about them once iterated\n # no need to remove batch of data from device, done automatically", "def __iter__(self):\n while True:\n ...
[ "0.80380756", "0.681836", "0.68135273", "0.68135273", "0.68135273", "0.68135273", "0.6770501", "0.6754636", "0.67446125", "0.6652299", "0.6626395", "0.6621452", "0.65598935", "0.65336037", "0.6526245", "0.64669716", "0.6410819", "0.63767326", "0.63346195", "0.6315828", "0.631...
0.6756917
7
Calculate the loss and metric of a batch of data
def loss_batch(model, loss_func, xb, yb, opt=None, metric=None): # Generate predictions preds = model(xb) # Calculate loss loss = loss_func(preds, yb) if opt is not None: # Compute gradients loss.backward() # Update parameters opt.step() # Reset gradients ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_batch_loss(self, batch_data):\n loss = 0\n for data in batch_data:\n x, y = data\n x = x.view(-1,x.shape[0],x.shape[1])\n y = y.view(-1,y.shape[0], y.shape[1])\n loss += self.compute_loss(x.to(self.device), y.to(self.device))\n \n ...
[ "0.8041445", "0.7663224", "0.74196714", "0.73287374", "0.7286657", "0.7242296", "0.72416306", "0.7221165", "0.7213613", "0.7163928", "0.71469676", "0.71469676", "0.7138438", "0.7112197", "0.70583266", "0.70163196", "0.70161384", "0.69570386", "0.69545066", "0.69394636", "0.68...
0.7148558
10
Calculate the total loss of validation set and required metric value
def evaluate(model, loss_fn, valid_dl, metric=None): with torch.no_grad(): # Pass each batch through the model results = [loss_batch(model, loss_fn, xb, yb, metric=metric) for xb, yb in valid_dl] # Separate losses, counts and metrics losses, nums, metrics = zip(*results) # To...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_validation_loss(self):\n self.network.train()\n self.validation_average_loss = self.calculate_average_loss(self.validation_dataloader)", "def loss_total(self):\r\n def loss(y_true, y_pred):\r\n l2 = 1/2*K.sum(K.square(y_true-y_pred))\r\n\r\n return l2\r\n ...
[ "0.7593667", "0.7389937", "0.73727524", "0.7198157", "0.7091602", "0.70856285", "0.7077367", "0.70650685", "0.7062741", "0.697941", "0.6937876", "0.6931188", "0.6905627", "0.69005936", "0.6803193", "0.6803193", "0.6789933", "0.6745538", "0.6734614", "0.67305297", "0.6725344",...
0.67959136
16
two coupled waveguides with bends
def coupler_symmetric( bend: Callable = bend_s, gap: float = 0.234, wg_width: float = 0.5, layer: Tuple[int, int] = pp.LAYER.WG, layers_cladding: List[Tuple[int, int]] = [pp.LAYER.WGCLAD], cladding_offset: float = 3.0, ) -> Component: bend = pp.call_if_func( bend, width=wg_wi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bblo(wave,bstar,airlimit,fig):\n import matplotlib.pyplot as plt\n import logging\n from scipy.interpolate import splrep,splev\n import tmath.wombat.womconfig as womconfig\n from tmath.wombat.womwaverange import womwaverange\n from tmath.wombat.womget_element import womget_element\n from t...
[ "0.60280955", "0.58768016", "0.5783345", "0.5706493", "0.55753314", "0.55456394", "0.5497405", "0.5485155", "0.5484322", "0.54677373", "0.5466135", "0.546538", "0.54592824", "0.54584545", "0.54166114", "0.540033", "0.53583735", "0.53554535", "0.5349171", "0.5318572", "0.53165...
0.0
-1
Reset the module to use or not use Theano. This should be called once at the top of your code.
def load(library='theano', reraise=False): #TODO: Move as much as possible to config.Config # And/or move the function to config, and import config.load global theano, T if library == 'theano': try: import theano except ImportError: logger.error("The theano...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_theano():\n\tglobal theano_initialized\n\tif theano_initialized:\n\t\treturn\n\timport caffe\n\tfrom theano.sandbox.cuda import use\n\tassert caffe.check_mode_gpu()\n\tuse('gpu%d' % caffe.get_device())\n\ttheano_initialized = True", "def _reset_module(m):\n raise NotImplementedError", "def rese...
[ "0.6621931", "0.63993675", "0.6377733", "0.62301695", "0.61323786", "0.61103064", "0.59686583", "0.5965064", "0.59396863", "0.59054166", "0.5905252", "0.58968747", "0.589062", "0.58898497", "0.5885364", "0.5885364", "0.58332396", "0.5829257", "0.58200634", "0.5813767", "0.580...
0.0
-1
Return True if there is a pending symbolic updates for any one of the variables in `args`. If called with no arguments, return True if the update dictionary is nonempty.
def pending_update(*args): if len(args) == 0: return len(cf.symbolic_updates) > 0 else: for x in _expand_args(args): if is_graph_object(x) and x in cf.symbolic_updates: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(args):\n\n home = args.assert_home()\n\n if args.all:\n env_repos = list(home.iter_env_repos())\n else:\n env_repos = [home.get_env_repo(x) for x in args.repos] if args.repos else [home.get_env_repo()]\n\n success = True\n\n for env_repo in env_repos:\n did_update = e...
[ "0.5759457", "0.5594278", "0.5564285", "0.5475863", "0.54533947", "0.5403371", "0.5373276", "0.53273535", "0.5294355", "0.52783906", "0.52717745", "0.52661645", "0.5215869", "0.52099615", "0.5206429", "0.51566654", "0.5129506", "0.51088214", "0.5104792", "0.509193", "0.506166...
0.8218321
0
Return the same function as theano.printing._print_fn, with the difference that 'file' is passed as a keyword argument to print().
def _get_print_fn(file=sys.stdout): def _print_fn(op, xin,): for attr in op.attrs: temp = getattr(xin, attr) if callable(temp): pmsg = temp() else: pmsg = temp print(op.message, attr, '=', pmsg, file=file) return _print_fn
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def real_print(*args, **kwargs):\n\n kwargs.setdefault('file', real_stdout)\n _python_print_function(*args, **kwargs)", "def adv_print(*args, start='', in_file = False, **kwargs):\n max_line = kwargs.pop('max_line', False)\n print(kwargs)\n old_stdout = sys.stdout\n value = StringIO()\n sys....
[ "0.7028008", "0.60618174", "0.58106077", "0.58032954", "0.57211655", "0.57190937", "0.57069385", "0.568632", "0.5670888", "0.5670888", "0.56702733", "0.5655732", "0.56508785", "0.5643723", "0.55961174", "0.55758446", "0.55572623", "0.54762155", "0.5462057", "0.5454509", "0.54...
0.7636272
0
Helper function for printing just one element in an array. All parameters except `idx` are the same as for `print`. Returns an identity operation on `x`, so that it can be used as follows >>> x = shim.tensor(np.arange(100, 0.1)) >>> x = shim.print_array(x, idx=3)
def print_array(x, idx=slice(None), message=None, message_prefix="SHIM - ", file=sys.stdout): return set_subtensor(x[idx], print(x[idx], message=message, message_prefix=message_prefix, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ndarray_print(nd):\n try:\n x = nd.tolist()\n except (TypeError, NotImplementedError):\n x = nd.tobytes()\n if isinstance(nd, ndarray):\n offset = nd.offset\n flags = nd.flags\n else:\n offset = 'unknown'\n flags = 'unknown'\n print(\n \"ndarray(%...
[ "0.60525095", "0.601079", "0.5855006", "0.575493", "0.5318782", "0.52099293", "0.5171336", "0.5115472", "0.50951475", "0.50903505", "0.50739056", "0.5069581", "0.49996632", "0.49829748", "0.4963213", "0.49431276", "0.49431276", "0.49431276", "0.49431276", "0.4938878", "0.4933...
0.77429724
0
Call pretty printer (`pprint`) on Theano objects, otherwise standard `print`
def pprint(x): if is_theano_object(x): return _gettheano().printing.pprint(x) else: return str(x)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_pydotprint_profile():\r\n\r\n # Skip test if pydot is not available.\r\n if not theano.printing.pydot_imported:\r\n raise SkipTest('pydot not available')\r\n\r\n A = tensor.matrix()\r\n f = theano.function([A], A + 1, mode='ProfileMode')\r\n theano.printing.pydotprint(f, print_output...
[ "0.67568576", "0.66903853", "0.6612041", "0.64975744", "0.63267666", "0.63239855", "0.62581927", "0.6243194", "0.61284935", "0.61009616", "0.5968577", "0.5889163", "0.58622116", "0.5802376", "0.5783404", "0.57769144", "0.5669858", "0.5625584", "0.5618598", "0.55597955", "0.55...
0.7738382
0
If `value` is a Theano variable, return its test value if it is defined. Otherwise just return `value` unchanged. If `nofail` is False (default), will raise an error if no test value is found. Otherwise returns None
def get_test_value(var, nofail=False): if 'theano' in sys.modules and isinstance(var, _getT().sharedvar.SharedVariable): retval = var.get_value() elif 'theano' in sys.modules and isinstance(var, _gettheano().graph.basic.Variable): try: retval = var.tag.test_value except Attri...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def value_or_none(value):\n if value or value == 0:\n return value\n return None", "def get_test_value(v):\r\n if not isinstance(v, graph.Variable):\r\n v_var = theano.tensor.as_tensor_variable(v)\r\n else:\r\n v_var = v\r\n return PureOp._get_test_value(v_var)", "def _get_t...
[ "0.59126365", "0.5759972", "0.56993127", "0.55516756", "0.5535529", "0.5529996", "0.536491", "0.53313243", "0.5318258", "0.5313379", "0.53128356", "0.5148102", "0.509741", "0.50536364", "0.50174165", "0.49973387", "0.49730897", "0.49612755", "0.49369153", "0.49357876", "0.493...
0.74623376
0
Recursively expand slices, iterables, dictionaries into a list of scalar data type. Scalars are returned as a 1 element list.
def _expand_args(arglst): if not isinstance(arglst, Iterable): arglst = [arglst] elif isinstance(arglst, dict): arglst = [arglst] elif ('theano' in sys.modules and isinstance(arglst, _gettheano().graph.basic.Variable)): arglst = [arglst] elif isinstance(arglst, cf.Termi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Scalar(obj):\n return Sequence([obj])", "def flatten(x: Any) -> List[Any]:\n l: List[Any] = []\n if isinstance(x, torch.Size):\n l.append(x)\n elif isinstance(x, dict):\n # sorted(x.items(), key=lambda t: t[0])\n for y in x.values():\n l.extend(flatten(y))\n eli...
[ "0.56902283", "0.5656688", "0.5533485", "0.547219", "0.54316616", "0.54221416", "0.5373782", "0.53371006", "0.53105795", "0.52716976", "0.5212556", "0.5172671", "0.5107006", "0.5097354", "0.50967675", "0.5085077", "0.5071284", "0.50681317", "0.5066115", "0.50630945", "0.50537...
0.5032017
23
Todo There seems to be some redundancy between ``is_pure_symbolic(x)`` and ``not graph.is_computable(x)``.
def is_pure_symbolic(*var): # return 'theano' in sys.modules and builtins.any(isinstance(v, _gettheano().tensor.TensorVariable) return 'theano' in sys.modules and builtins.any(isinstance(v, cf.PureSymbolicTypes) for v in _expand_args(var))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_pure(self) -> bool:\r\n return self.is_valid and np.all([x[\"operation\"].is_pure for x in self.operations_by_name.values()])", "def is_pure(self):\r\n return isinstance(self, PureOperation)", "def is_symbolic(self: Q) -> bool:\n\n symbolic = False\n\n if (\n h...
[ "0.65525603", "0.6225219", "0.6183948", "0.6024547", "0.57890093", "0.55200416", "0.5471868", "0.5459004", "0.5401552", "0.53722376", "0.5332143", "0.53140587", "0.5311742", "0.5289241", "0.5244963", "0.5174868", "0.51738834", "0.517038", "0.5164459", "0.51191884", "0.5084533...
0.7302066
0
Return True if `x` is a scalar. Note that in contrast to Numpy's isscalar, this returns True for 0dim arrays.
def isscalar(x): arrayed_x = asarray(x) return asarray(x).ndim == 0 and arrayed_x.dtype != 'object'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_scalar(x: Any) -> bool:\r\n return np.isscalar(x) or (isinstance(x, np.ndarray) and x.ndim == 0)", "def is_scalar(x):\n return x.ndim == 0", "def is_np_scalar(x):\n return isinstance(x, np.generic)", "def is_scalar(obj: _std_typing.Any) -> bool:\n return obj.ndim == 0", "def is_scalar(se...
[ "0.8768672", "0.86589956", "0.80164564", "0.7863019", "0.77135247", "0.75862515", "0.7455009", "0.7453047", "0.7153089", "0.70043737", "0.69697446", "0.6967579", "0.69169796", "0.67348695", "0.6723391", "0.6613435", "0.65615326", "0.65140235", "0.6503674", "0.64797664", "0.64...
0.64801896
19
Return True if `var` is any recognized sparse format.
def issparse(var): if 'theano.sparse' in sys.modules: return (sp.sparse.issparse(var) or isinstance(var, sys.modules['theano.sparse'].basic.SparseVariable)) else: return sp.sparse.issparse(var)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isspsparse(var):\n if 'theano.sparse' in sys.modules:\n return (sp.sparse.issparse(var)\n or isinstance(var, sys.modules['theano.sparse'].basic.SparseVariable))\n else:\n return sp.sparse.issparse(var)", "def is_sparse(constant) -> bool:\n return sp.issparse(constant)", ...
[ "0.80299467", "0.7115952", "0.6787843", "0.66746426", "0.6657034", "0.6640711", "0.65491956", "0.647349", "0.6378612", "0.5713969", "0.56804806", "0.5675083", "0.5631618", "0.55671525", "0.5554212", "0.5530677", "0.54940146", "0.54143655", "0.54069203", "0.5393739", "0.537159...
0.7509615
1
Return True if `var` is sparse with `scipy.sparse` interface. True for scipy.sparse, theano.sparse.
def isspsparse(var): if 'theano.sparse' in sys.modules: return (sp.sparse.issparse(var) or isinstance(var, sys.modules['theano.sparse'].basic.SparseVariable)) else: return sp.sparse.issparse(var)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_sparse(x: Any, backend=None) -> bool:\r\n module = get_module(backend)\r\n return module.is_sparse(x)", "def issparse(var):\n if 'theano.sparse' in sys.modules:\n return (sp.sparse.issparse(var)\n or isinstance(var, sys.modules['theano.sparse'].basic.SparseVariable))\n el...
[ "0.73790324", "0.72182786", "0.7192387", "0.71083176", "0.706764", "0.65949607", "0.6314302", "0.62896657", "0.62845683", "0.6133798", "0.6107449", "0.6087067", "0.6074301", "0.6030176", "0.60223293", "0.5920868", "0.585102", "0.5810927", "0.57268214", "0.57231104", "0.570871...
0.86598843
0
Equivalent to theano.tensor.addbroadcast. For NumPy objects, checks that broadcasted dimensions have length 1, but otherwise does nothing.
def addbroadcast(x, *axes): if is_theano_object(x): # T.addbroadcast only works with positive axes axes = [ ax if ax >= 0 else x.ndim + ax for ax in axes ] return T.addbroadcast(x, *axes) else: for ax in axes: if x.shape[ax] != 1: raise ValueError("Tri...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_broadcast_dims():\r\n test((1, 2, 3))\r\n test((2, 1, 3))\r\n test((2, 3, 1))\r\n test2((1, 2, 3))\r\n test2((2, 1, 3))\r\n test2((2, 3, 1))", "def test_unbroadcast_addbroadcast(self):\r\n\r\n x = matrix()\r\n assert unbroadcast(x, 0) is x\r\n assert unbroadcast(x,...
[ "0.71459633", "0.6914185", "0.68297416", "0.66783226", "0.654165", "0.6527929", "0.651774", "0.6381184", "0.6363589", "0.6338809", "0.6334122", "0.63105303", "0.63056207", "0.62698644", "0.6191693", "0.6153234", "0.6143489", "0.6117331", "0.6100611", "0.6088057", "0.6025157",...
0.7421298
0
Call this function on any expression that might appear in a Theano graph as a boolean (Theano expects integers rather than booleans.)
def bool(a): # Booleans need to be converted to integers for Theano if cf.use_theano and isinstance(a, (builtins.bool, np.bool_)): return np.int8(a) elif cf.use_theano or is_theano_object(a): return a else: return builtins.bool(a)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluateBoolean(compiled_expression):", "def boolean_func(experiment):", "def on_true(self) -> global___Expression:", "def _op(\n x: Union[bool, dts.Boolean, tps.BooleanValue],\n y: Union[bool, dts.Boolean, tps.BooleanValue],\n ) -> T:", "def __nonzero__(self):\n raise RuntimeEr...
[ "0.66782403", "0.66504705", "0.6595281", "0.64725804", "0.6440128", "0.6385642", "0.63522696", "0.6339515", "0.6285484", "0.62269044", "0.6185963", "0.6184478", "0.6112703", "0.6025595", "0.5911982", "0.590077", "0.58995366", "0.5801486", "0.57946014", "0.57801527", "0.570051...
0.6897003
0
All parameters except `outshape` are the same as for theano.ifelse.ifelse `outshape` is an extra parameter to allow the then_branch and else_branch
def ifelse(condition, then_branch, else_branch, name=None, outshape=None): # First check if we can replace an Theano conditional by a Python one if is_theano_object(condition) and is_constant(condition): condition = bool(condition.data) # Now the actual function if (cf.use_theano and no...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def switch(condition, then_expression, else_expression):\n x_shape = copy.copy(then_expression.get_shape())\n x = tf.cond(tf.cast(condition, 'bool'),\n lambda: then_expression,\n lambda: else_expression)\n x.set_shape(x_shape)\n return x", "def ifelse(condition, then_bra...
[ "0.5731582", "0.5591258", "0.555741", "0.5469535", "0.5441478", "0.53432226", "0.5295958", "0.52848524", "0.5284638", "0.5276015", "0.5276015", "0.5276015", "0.5193365", "0.51561433", "0.51561433", "0.5092851", "0.5084068", "0.5084068", "0.5070655", "0.5028776", "0.49839672",...
0.6365673
0
For the equivalent to the singleargument version of `np.where`, see `nonzero`.
def switch(cond, ift, iff): if (cf.use_theano and (isinstance(cond, theano.graph.basic.Variable) or isinstance(ift, theano.graph.basic.Variable) or isinstance(iff, theano.graph.basic.Variable))): return T.switch(cond, ift, iff) else: return np.wher...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nonzero_indices(a):\n return (np.nonzero(a)[0])", "def where(predicate):\n matching_indices = predicate.nonzero()\n if len(matching_indices) != 0:\n matching_indices = matching_indices.t().squeeze(0)\n return matching_indices", "def nonzero(x, /):\n\n if isinstance(x, dpnp_array) or i...
[ "0.6924894", "0.66165656", "0.6458996", "0.62945676", "0.6201161", "0.6181641", "0.6086266", "0.6056673", "0.6036273", "0.5988236", "0.59605914", "0.5939114", "0.59073454", "0.5854956", "0.58422494", "0.5841795", "0.5825763", "0.5792545", "0.5792545", "0.5792545", "0.57689095...
0.0
-1
This function is deprecated if you can import `RandomStream` from `theano.tensor.random.utils`.
def make_TheanoRNG(rng_class): def add_kwarg_name(f): def wrapper(self, *args, **kwargs): name = kwargs.pop('name', None) sf = getattr(super(type(self), self), f.__name__) rndstream = sf(*args, **kwargs) if name is not None: rndstream.name = name r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def theano_rng_instance(theano_rng=None):\n\n if theano_rng is None:\n numpy_rng = RandomState(None)\n return RandomStreams(numpy_rng.randint(2 ** 30))\n elif isinstance(theano_rng, RandomStreams):\n return theano_rng\n else:\n return RandomStreams(theano_rng)", "def initiali...
[ "0.5877001", "0.56382555", "0.54041225", "0.52478224", "0.52437794", "0.51667553", "0.5153004", "0.51513296", "0.5095069", "0.50710434", "0.5041658", "0.50340027", "0.49918595", "0.49538463", "0.49402973", "0.49301234", "0.4879825", "0.48730177", "0.48655665", "0.48411006", "...
0.55849844
2
For Numpy legacy RandomState, just calls `rng.seed`. For Numpy Generator, sets the state of the underlying `BitGenerator` as though it had just been created with `BitGenerator(new_seed)`. For Theano, reseeds both the seeds of the current random streams, and the seed generator for future ones.
def reseed_rng(rng, new_seed): if isinstance(rng, np.random.RandomState): rng.seed(new_seed) elif isinstance(rng, np.random.Generator): rng.bit_generator.state = type(rng.bit_generator)(new_seed).state #elif is_symbolic(rng): elif isinstance(rng, cf.SymbolicNumpyRNGType): # I don...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_seed(seed):\n state = RandomState()\n random.seed(seed) # alter state\n np.random.seed(seed)\n torch.manual_seed(seed)\n yield\n state.set_global()", "def numpy_seed(seed):\n if seed is None:\n yield\n return\n state = np.random.get_state()\n np.random.seed(se...
[ "0.80153906", "0.7950996", "0.7838938", "0.78035676", "0.74638736", "0.7421813", "0.73486114", "0.7348077", "0.7326139", "0.73171145", "0.73013014", "0.7241416", "0.7239641", "0.72352993", "0.7207434", "0.71863073", "0.7174729", "0.7163923", "0.71558696", "0.71458584", "0.714...
0.78864896
2
Returns the default broadcastable pattern for a shape, replacing 1s with `True`.
def shape_to_broadcast(shape): return tuple(n==1 for n in shape)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_mask(shape):\n return np.zeros(shape).astype(bool)", "def broadcastable(self):\n return tuple(s==1 for s in self.shape)", "def generate_default_mask(data, dim1=None):\n batch_size = data.size(1)\n sequence_len = data.size(0)\n if dim1 is None:\n dim1 = sequence_len\n ret...
[ "0.6918157", "0.6437492", "0.6300757", "0.6217095", "0.6205907", "0.6100955", "0.6060882", "0.59409136", "0.59366935", "0.5933645", "0.5914848", "0.59019846", "0.58798945", "0.5850175", "0.58367413", "0.5828354", "0.5715668", "0.56040365", "0.5578355", "0.5577387", "0.5566503...
0.7036175
0
Make an object into a tensor. If `object` is a numpy array, a new tensor matching its shape and dtype is returned. The array values are used to set the test value.
def tensor(object, name=None, dtype=None): # Try to infer the tensor shape, test_value, dtype and broadcast pattern broadcastable = None shape = None if isinstance(object, np.ndarray): # Numpy arrays become the symbolic's test value shape = object.shape test_value = object ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def obj2tensor(pyobj, device='cuda'):\n storage = torch.ByteStorage.from_buffer(pickle.dumps(pyobj))\n return torch.ByteTensor(storage).to(device=device)", "def istorch(*obj):\n\n return istype(torch.Tensor, *obj)", "def to_scalar(obj):\n if isinstance(obj, np.generic):\n return obj.item()\n...
[ "0.64124453", "0.611078", "0.6001016", "0.59482175", "0.5769962", "0.57507235", "0.56285244", "0.5619557", "0.55715656", "0.55606765", "0.5538848", "0.5523602", "0.548882", "0.54432493", "0.54424465", "0.5397815", "0.5368648", "0.5290406", "0.5290406", "0.5290406", "0.5289074...
0.7057965
0
If `allow_resize` is false (default), will raise an error if new_value has a different shape than the stored variable.
def set_value(self, new_value, borrow=False): new_value = np.array(new_value, copy = not borrow) try: if self.shape != new_value.shape: self.resize(new_value.shape, refcheck=False) # refcheck is necessary to get this to work, but bypasses # the...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resize(self, old, new):", "def _fix_shape(self, value):\n for k, v in self.variables.items():\n if len(v.shape) < len(value.shape):\n a, b = self._broadcast(value, v)\n self.variables[k] = np.zeros(a.shape, dtype=b.dtype) + b", "def cell(self, value):\n if...
[ "0.6160011", "0.5616089", "0.5501954", "0.53800654", "0.53766894", "0.5319863", "0.5319749", "0.53089726", "0.53088486", "0.52785385", "0.5275074", "0.52321464", "0.5216825", "0.51956314", "0.519471", "0.5184352", "0.51834565", "0.5168249", "0.51639163", "0.5145052", "0.51329...
0.6490318
0
For Numpy arrays, an axis is broadcastable iff it has length one.
def broadcastable(self): return tuple(s==1 for s in self.shape)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def really1d(arr):\n if np.ndim(arr) != 1:\n return False\n # Empty list or array\n if len(arr) == 0:\n return True\n if np.any(np.vectorize(np.ndim)(arr)):\n return False\n return True", "def test_broadcast_dims():\r\n test((1, 2, 3))\r\n test((2, 1, 3))\r\n test((2,...
[ "0.67279613", "0.65214336", "0.64793956", "0.6454583", "0.6402333", "0.63785535", "0.6363917", "0.6327987", "0.62992084", "0.6255868", "0.6253109", "0.61367655", "0.61352086", "0.61097795", "0.6078569", "0.60693306", "0.5999976", "0.59963834", "0.59572417", "0.593746", "0.586...
0.6370583
6
In contrast to Theano's `shared()`, the broadcast pattern is set to be compatible with NumPy's behaviour; i.e., any axis in `value` with dimension 1 is considered broadcastable by default. As with Theano's `shared()`, broadcast pattern can by changed by passing
def shared(value, name=None, strict=False, allow_downcast=None, symbolic=True, **kwargs): if not isinstance(value, np.ndarray): value = np.asarray(value) if 'dtype' in kwargs: logger.warning("You passed the keyword 'dtype' to the shared constructor. " "Theano do...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sharedX(value, name=None, borrow=False):\n return theano.shared(theano._asarray(value, dtype=theano.config.floatX),\n name=name,\n borrow=borrow)", "def sharedX_value(value, name=None, borrow=None, dtype=None):\n if dtype is None:\n dtype = theano....
[ "0.6955052", "0.68128425", "0.6489515", "0.6380227", "0.6346469", "0.62513626", "0.60865706", "0.6063434", "0.5991516", "0.5971064", "0.5877886", "0.58261615", "0.5815576", "0.58030784", "0.57885367", "0.577562", "0.5775391", "0.5771261", "0.5756086", "0.57556057", "0.5688109...
0.6865
1
In contrast to `numpy.atleast_1d`, will not cast lists or tuples to arrays. This is to allow lists of symbolic variables.
def atleast_1d(*arrays): if len(arrays) == 1: a = arrays[0] if isscalar(a): a = add_axes(a, 1) return a else: assert len(arrays) > 1 return [atleast_1d(a) for a in arrays]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def atleast_1d(*arys):\n res = []\n for a in arys:\n if not isinstance(a, cupy.ndarray):\n raise TypeError('Only cupy arrays can be atleast_1d')\n if a.ndim == 0:\n a = a.reshape(1)\n res.append(a)\n if len(res) == 1:\n res = res[0]\n return res", "de...
[ "0.7054152", "0.66508734", "0.64807516", "0.6265879", "0.62099147", "0.614839", "0.61127764", "0.60296506", "0.59864676", "0.59615374", "0.5930761", "0.59285194", "0.59205323", "0.59188753", "0.5905526", "0.5883461", "0.5868971", "0.5861243", "0.5836253", "0.5815137", "0.5810...
0.7249189
0
Add an axis to `x`, e.g. to treat a scalar as a 1x1 matrix. String arguments for `pos` should cover most typical use cases; for more complex operations, like adding axes to the middle, specify the insertion position for the axes directly.
def add_axes(x, num=1, pos='left'): if is_theano_object(x): if pos in ['left', 'before', 'begin', 'first']: shuffle_pattern = ['x']*num shuffle_pattern.extend(range(x.ndim)) elif pos in ['right', 'after', 'end', 'last']: shuffle_pattern = list(range(x.ndim)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pos_x(self, *args, **kwargs) -> Any:\n pass", "def set_pos(self, x):\n self._pos = x", "def set_new_pos_in_x(self, new_pos):\n self.__pos_x = new_pos", "def format_x_axis(self, text=None, positionx=None, positiony=None, color=None, fontsize=None):\n if text is not None:\n ...
[ "0.5671687", "0.56453615", "0.5537362", "0.5427651", "0.53706735", "0.53447604", "0.5194955", "0.5190737", "0.5185418", "0.512035", "0.5075469", "0.5074113", "0.50620127", "0.50525665", "0.50525665", "0.5034201", "0.50065833", "0.4998663", "0.49879915", "0.49418423", "0.49294...
0.6144922
0
All parameters except `array_shape` are the same as for np.pad. `array_shape` is necessary because while we can deal with a Theano array, we need to know its shape.
def pad(array, array_shape, pad_width, mode='constant', **kwargs): if mode not in ['constant']: raise ValueError("theano_shim does not support mode '{}'".format(mode)) if not is_theano_object(array): assert(array.shape == array_shape) # If this fails, than the Theano code will also f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad(arr, target_shape, constant_values=0):\n arr_shape = arr.shape\n npad = ()\n for dim in range(len(arr_shape)):\n diff = target_shape[dim] - arr_shape[dim]\n if diff > 0:\n before = int(diff / 2)\n after = diff - before\n else:\n before = 0\n ...
[ "0.72683674", "0.69279623", "0.6815563", "0.6631931", "0.6603894", "0.6579442", "0.65710515", "0.6466191", "0.646429", "0.6456382", "0.63967574", "0.6391941", "0.630208", "0.6301449", "0.62548065", "0.6236044", "0.6222941", "0.61766315", "0.61551076", "0.61501074", "0.6145136...
0.774596
0
Convolve each component of data_arr with kernel_arr and stack the result into an array. data_arr is an NxM array, where N is the number of time bins and M the number of components kernel_arr is an MxM array, for which the element with index (i,j) represents the contribution of component j to component i. (Consistent wi...
def conv1d(data_arr, kernel_arr, tarr_len, discrete_kernel_shape, mode='valid'): assert(data_arr.ndim == 2) output_shape = discrete_kernel_shape[1:] if (kernel_arr.ndim == 2): # Algorithm assumes a "to" axis on the kernel. Add it. kernel_arr = add_axes(kernel_arr, 1, 'before last') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convolution2D(ndarray, kernel, kernel_pivot):\n\t#validation of arrays types\n\tassert ndarray.dtype == np.float, 'Invalid dtype of ndarray should be float'\n\tassert kernel.dtype == np.float, 'Invalid dtype of kernel should be float'\n\tassert ndarray.ndim == 2, 'Invalid ndarray dimension'\n\tassert kernel.nd...
[ "0.63226545", "0.60152525", "0.55545235", "0.5552033", "0.5547346", "0.5546287", "0.5444849", "0.53988546", "0.5391903", "0.5335605", "0.5316029", "0.53053594", "0.52910376", "0.5272581", "0.52257395", "0.52186984", "0.5215682", "0.5211804", "0.5200732", "0.5198506", "0.51931...
0.6499635
0
Wrapper for the linear filter operator implemented by scipy.signal.lfilter At the moment, the implementation is restricted to the case a = 1.
def lfilter(size, b, a, x, *args, **kwargs): sym_a = is_theano_object(a) sym_b = is_theano_object(b) sym_x = is_theano_object(x) M, N = size if sym_b or sym_x: s = x * b[0] for tau in range(1, M): u = x[:-tau] * b[tau] s = T.inc_subtensor(s[tau:], u) els...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lfilter(b, a, x, axis=-1, zi=None):\n a = np.atleast_1d(a)\n if len(a) == 1:\n # This path only supports types fdgFDGO to mirror _linear_filter below.\n # Any of b, a, x, or zi can set the dtype, but there is no default\n # casting of other types; instead a NotImplementedError is rai...
[ "0.69632137", "0.6564763", "0.65372974", "0.6445048", "0.6321419", "0.6162388", "0.6106465", "0.5994196", "0.5921511", "0.5803433", "0.5786575", "0.57217765", "0.5690797", "0.5678843", "0.55839986", "0.5573224", "0.55679464", "0.5538213", "0.55143213", "0.55127573", "0.549178...
0.67906237
1
Always returns `True` on symbolic inputs.
def isfinite(x, *args, **kwargs): if is_theano_object(x): return True else: assert not is_theano_object(kwargs.values()) return np.isfinite(x, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_symbolic(self: Q) -> bool:\n\n symbolic = False\n\n if (\n hasattr(self.t, \"free_symbols\")\n or hasattr(self.x, \"free_symbols\")\n or hasattr(self.y, \"free_symbols\")\n or hasattr(self.z, \"free_symbols\")\n ):\n ...
[ "0.7129196", "0.71198785", "0.6929518", "0.6552455", "0.63741213", "0.6354848", "0.62485", "0.62369853", "0.616255", "0.6124291", "0.6124291", "0.61058354", "0.6099405", "0.6050791", "0.60412824", "0.5905185", "0.5882749", "0.5847256", "0.5795424", "0.5760967", "0.57428145", ...
0.0
-1
Method used to search for a specific blob, commit or tree. If a tree is searched for, the result is splitted into its components (blobs and directories), which are again splitted into their mode, hash and name. In the case of a commit, we split the information string and the tree hash and parent's commit hash are retur...
def search(hash, type): out = bash('echo ' + hash + ' | ~/lookup/showCnt ' + type) if type == 'tree': return [blob.split(';') for blob in out.strip().split('\n')] if type == 'commit': splitted = out.split(';') # the tree and parent commit hashes are the second and third word, respectively # the commit time...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tree_lookup(self, target_path, commit):\n segments = target_path.split(\"/\")\n tree_or_blob = commit.tree\n path = ''\n while segments:\n dirent = segments.pop(0)\n if isinstance(tree_or_blob, pygit2.Tree):\n if dirent in tree_or_blob:\n ...
[ "0.620875", "0.55707973", "0.5503819", "0.5488553", "0.54023314", "0.52747744", "0.5221155", "0.5140808", "0.5135953", "0.5121725", "0.5115463", "0.5029685", "0.50186586", "0.5016464", "0.4965771", "0.49135715", "0.48894116", "0.48343554", "0.48126018", "0.481247", "0.4811850...
0.6542909
0
Method used to check the usage of Continuous Integration in a tree, given its hash.
def ci_lookup(tree_hash): query = 'echo ' + tree_hash + ' | ~/lookup/showCnt tree | egrep "' + '|'.join(ci_files) +'"' out = bash(query) """ # alternate method blobs = search(tree_hash, 'tree') index = {'mode':1, 'hash':1, 'name':2} ci = False for blob in blobs: name = blob[index['name']] hash = blob[ind...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkGit(directory):", "def check_build_status(owner, repository, ref):\n return get_hvcs().check_build_status(owner, repository, ref)", "def check_dependency(self, repo, minhash=None):\n try:\n p = Project.objects.get(repo_url=repo)\n except Project.DoesNotExist:\n r...
[ "0.5615642", "0.5446968", "0.53468597", "0.53203434", "0.5279424", "0.5214733", "0.51891404", "0.51716375", "0.5140349", "0.5117159", "0.5067787", "0.5063527", "0.5044477", "0.50306433", "0.5022968", "0.5018853", "0.50033265", "0.4998231", "0.49759716", "0.49759635", "0.49651...
0.62855154
0
Alternative way to check_if_introduction, to compare performance.
def calc_CI_introductions(commits, author): # using a dictionary that has the commits' hashes as keys, # so as to not search multiple times for the same commit CI_checked = {} # delete contents open('introductions.csv', 'w').close() # for every commit, we look up whether the author included a CI file, # that...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_doc() -> None:", "def check_if_introduction(commit, result):\n\ttree_hash, parent_commit_hash, time = search(commit, 'commit')\n\t\n\t# controlling for the case of no parent commits\n\tif parent_commit_hash == '':\n\t\treturn True\n\n\t# controlling for the case of multiple parent commits\n\tall_parent_C...
[ "0.6213324", "0.6069793", "0.5908131", "0.59015363", "0.582942", "0.5780646", "0.5681919", "0.5614936", "0.56105876", "0.560899", "0.55925333", "0.54970586", "0.54607743", "0.5455965", "0.5413873", "0.5401259", "0.538701", "0.53337276", "0.53230894", "0.532307", "0.532114", ...
0.0
-1
We check the parent commit to see if its child commit introduced or modified a CI config file.
def check_if_introduction(commit, result): tree_hash, parent_commit_hash, time = search(commit, 'commit') # controlling for the case of no parent commits if parent_commit_hash == '': return True # controlling for the case of multiple parent commits all_parent_CI = False for parent in parent_commit_hash.split...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lint_commit_base(commit):\n success = True\n # Merge commits have two parents, we maintain a linear history.\n if len(commit.parents) > 1:\n error(\n \"Please resolve merges by re-basing. Merge commits are not allowed.\",\n commit)\n success = False\n\n return su...
[ "0.59226084", "0.5910878", "0.5807173", "0.57713675", "0.5732562", "0.5723487", "0.5709827", "0.56935096", "0.5671692", "0.5613732", "0.55919313", "0.5571465", "0.5569481", "0.55452746", "0.55405", "0.55384827", "0.5518048", "0.54979306", "0.5494411", "0.5483143", "0.54710555...
0.6080408
0
Used to investigate how many commits, from a user, modified a CI configuration file. Unix commands are used for a better performance.
def calc_CI(commits, author): # delete contents open('modifications.csv', 'w').close() open('introductions.csv', 'w').close() for count, commit in enumerate(commits): # status update if (count + 1) % 50 == 0: print commit, '.. ..', count + 1, ' / ', len(commits) # c2f does seems to result in a tie erro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_git_commiter_count(path):\n process = subprocess.Popen(['git', 'shortlog', '-sn'], cwd=path, stdout=subprocess.PIPE)\n stdout, _ = process.communicate()\n committers = stdout.decode(\"ISO-8859-1\")\n return len(committers.split('\\n'))", "def test_repo_commit_count():\n\n commit_count ...
[ "0.6731065", "0.67019707", "0.617036", "0.6134285", "0.60985065", "0.6043435", "0.59961593", "0.5965492", "0.5777808", "0.5718004", "0.56138355", "0.5547764", "0.5468513", "0.5459471", "0.5377669", "0.53591144", "0.5353509", "0.5288537", "0.5275442", "0.52726763", "0.5257457"...
0.5999456
6
Method written as a faster alternative to calc_CI. It seems to be 30 times faster.
def calc_CI_diff(commits, author): # delete contents open('modifications.csv', 'w').close() open('introductions.csv', 'w').close() for count, commit in enumerate(commits): #status update if (count + 1) % 50 == 0: print commit, '.. ..', count + 1, ' / ', len(commits) # cmputeDiff2.perl seems to produce ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_ci(yhat, yhat_var, ci_level):\n z_mapping = {0.95: 1.96,\n 0.99: 2.58}\n z = z_mapping[ci_level]\n\n ci_lower = yhat - yhat_var * z\n ci_upper = yhat + yhat_var * z\n\n return ci_lower, ci_upper", "def ci(self):\n var_assumptions = self.va...
[ "0.6736339", "0.6356646", "0.63336897", "0.63277143", "0.6315159", "0.6300209", "0.62987596", "0.62628466", "0.6235239", "0.61868376", "0.60992825", "0.60582167", "0.60496235", "0.5989783", "0.5989783", "0.5971814", "0.5969796", "0.5959656", "0.5940242", "0.5927083", "0.58964...
0.0
-1
Method used to find the neighbours of a given author, i.e. the authors that affected the given author's use of good coding practices. A timestamp is also given to define the time till which we find the connections.
def find_links(author, end_time, method='sh'): out = bash('echo "'+ author + '" | ~/lookup/getValues a2P') pr = [x for x in out.strip().split(';')[1:]] if method == 'pr_timeline': p = Proj() for project in pr: rows = p.project_timeline(['time','repo', 'author'], project) for row in rows: print row
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def neighbors(self, ident, time=None):\n if time is not None:\n ident = (ident, time)\n return map((lambda i: self._nodes[i]), self._edges[ident])", "def get_temporal_neighbor(self, source_nodes, timestamps, n_neighbors=20):\n assert (len(source_nodes) == len(timestamps))\n\n tmp_n...
[ "0.5375797", "0.51991403", "0.49526277", "0.48657554", "0.47699863", "0.47616437", "0.47396174", "0.473548", "0.4701188", "0.46866152", "0.4677123", "0.4675736", "0.46735922", "0.46472782", "0.46351343", "0.46327373", "0.4630453", "0.46180713", "0.46115577", "0.46042266", "0....
0.4829051
4
Used to investigate how many commits, from a user, modified a unit testing file. Unix commands are used to achieve a better performance. The blobs are parsed, looking for unit testing library imports. An alternative would be using the thruMaps directories or the ClickHouse API, but those options seem slower.
def calc_test(commits, author): open('modifications.csv', 'w').close() for count, commit in enumerate(commits): # status update if (count + 1) % 5 == 0: print commit, '.. ..', count + 1, ' / ', len(commits) # getting every blob from a given commit query = ('for x in $(echo ' + commit + ' | ~/lookup/g...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_repo_commit_count():\n\n commit_count = BehavioralUtils.count_commits('drupal', 'builds')\n assert commit_count == 4", "def get_git_commiter_count(path):\n process = subprocess.Popen(['git', 'shortlog', '-sn'], cwd=path, stdout=subprocess.PIPE)\n stdout, _ = process.communicate()\n ...
[ "0.6643158", "0.60023016", "0.58225226", "0.581164", "0.564116", "0.5630193", "0.5622561", "0.5608913", "0.5597471", "0.55932194", "0.55867994", "0.5578852", "0.5450797", "0.5377554", "0.5376797", "0.53600526", "0.5338216", "0.5317002", "0.5301987", "0.52945113", "0.5284733",...
0.67948884
0
Method used to count the usage of certain languages' good practices and modern approaches. We parse the diff of a modified file and the content of an introduced file, in order to find those practices, and we count the extent of the usage. Then, we write to a file, for each commit that included these features.
def calc_lang_features(commits, author): lang_features = ['/\*\*', '\\"\\"\\"', '///', # documentation '^\s*@', 'def.+:.+->', 'using\s+System\.ComponentModel\.DataAnnotations', # assertion 'assert', 'TODO', 'lambda'] # delete contents open('lang_features.csv', 'w').close() for count, commit in enumerate(co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_line_counts(self):\n diff = (\n b'+ This is some line before the change\\n'\n b'- And another line\\n'\n b'Index: foo\\n'\n b'- One last.\\n'\n b'--- README 123\\n'\n b'+++ README (new)\\n'\n b'@@ -1,1 +1,1 @@\\n'\n ...
[ "0.55916655", "0.55377793", "0.549463", "0.5345161", "0.53267086", "0.5320616", "0.526287", "0.52469856", "0.5209883", "0.51992834", "0.5179559", "0.51548904", "0.5102893", "0.5010156", "0.50060344", "0.49976557", "0.49974072", "0.49898696", "0.49847335", "0.49833786", "0.498...
0.6791736
0
Display error message, then terminate.
def display_error(message, raise_exception = True): print "Error:", message print if raise_exception: raise ExternalCommandFailed else: sys.exit(1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def finalize_error():\n print('')\n exit(-1)", "def error(message):\n print message\n sys.exit(2)", "def error(self, message):\n ErrorExit('error: {}\\n'.format(message), 2)", "def error(error_no):\n print('--] Encountered unrecoverable ERROR [%s] ... leaving' % error_no)\n write_ter...
[ "0.7756523", "0.76536196", "0.7577054", "0.7483119", "0.74432796", "0.74233305", "0.74082273", "0.7378887", "0.73447204", "0.73279417", "0.73041856", "0.7302073", "0.72931904", "0.72321796", "0.7213401", "0.71944994", "0.71725494", "0.71556145", "0.7137041", "0.711855", "0.71...
0.7231697
14
Find the name of the program for Popen. Windows is finnicky about having the complete file name. Popen won't search the %PATH% for you automatically. (Adapted from ctypes.find_library)
def find_program(name): # See MSDN for the REAL search order. base, ext = os.path.splitext(name) if ext: exts = [ext] else: exts = ['.bat', '.exe'] for directory in os.environ['PATH'].split(os.pathsep): for e in exts: f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def FindEnv(progname):\n for path in os.environ['PATH'].split(':'):\n fullname = os.path.join(path, progname)\n if os.access(fullname, os.X_OK):\n return fullname\n raise AssertionError(\n \"Could not find an executable named '%s' in the system path\" % progname)", "def _prog(shell_cmd):\n c...
[ "0.7055392", "0.7032965", "0.6972828", "0.6802683", "0.6751492", "0.67297626", "0.66937417", "0.66916645", "0.66209626", "0.6619629", "0.661692", "0.66129804", "0.66069007", "0.6597765", "0.65944254", "0.6529503", "0.6529503", "0.6499914", "0.6469315", "0.6443715", "0.6432038...
0.7439804
0
Find the name of the program for Popen. On Unix, popen isn't picky about having absolute paths.
def find_program(name): return name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _prog(shell_cmd):\n cmd = _which(shell_cmd)\n return os.path.basename(cmd) if cmd else None", "def _compute_program_name():\n program_path = os.path.abspath(sys.argv[0])\n if os.path.exists(program_path):\n return os.path.basename(program_path)\n else:\n match = re.match(r\"^.*(?...
[ "0.7561935", "0.6962303", "0.69209117", "0.68554986", "0.682868", "0.67098635", "0.6651493", "0.6524895", "0.6517235", "0.65085274", "0.6487945", "0.6462928", "0.6462928", "0.64370745", "0.64370745", "0.64251924", "0.6410065", "0.63671607", "0.6365036", "0.6350533", "0.633277...
0.634644
20
Run svn cmd in PIPE exit if svn cmd failed
def run_svn(args, fail_if_stderr=False, encoding="utf-8"): def _transform_arg(a): if isinstance(a, unicode): a = a.encode(encoding or locale_encoding) elif not isinstance(a, str): a = str(a) return a t_args = map(_transform_arg, args) cmd = find_prog...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_svn(*cmd, **kwargs):\n kwargs.setdefault('stdin', subprocess2.PIPE)\n kwargs.setdefault('stdout', subprocess2.PIPE)\n kwargs.setdefault('stderr', subprocess2.PIPE)\n\n cmd = (SVN_EXE,) + cmd\n proc = subprocess2.Popen(cmd, **kwargs)\n ret, err = proc.communicate()\n retcode = proc.wait()\n if retco...
[ "0.8139468", "0.6768759", "0.6742464", "0.6726329", "0.64676774", "0.61645204", "0.60822946", "0.5962468", "0.59567994", "0.5952341", "0.59217626", "0.5921187", "0.5896519", "0.58793974", "0.58608013", "0.58277047", "0.58246434", "0.5786155", "0.5755748", "0.57454145", "0.573...
0.7465438
1
Parse an SVN date as read from the XML output and return the corresponding timestamp.
def svn_date_to_timestamp(svn_date): # Strip microseconds and timezone (always UTC, hopefully) # XXX there are various ISO datetime parsing routines out there, # cf. http://seehuhn.de/comp/pdate date = svn_date.split('.', 2)[0] time_tuple = time.strptime(date, "%Y-%m-%dT%H:%M:%S") return c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getversion_svn(path=None): # pragma: no cover\n _program_dir = path or _get_program_dir()\n tag, rev, date = svn_rev_info(_program_dir)\n hsh, date2 = github_svn_rev2hash(tag, rev)\n if date.tm_isdst >= 0 and date2.tm_isdst >= 0:\n assert date == date2, 'Date of version is not consistent'\n...
[ "0.6344183", "0.63013804", "0.6238115", "0.60493755", "0.59930885", "0.59590983", "0.59490615", "0.59364974", "0.58739996", "0.5863237", "0.5850068", "0.5847718", "0.5834404", "0.5801015", "0.5763705", "0.5755848", "0.5741187", "0.57391524", "0.57288116", "0.57245946", "0.571...
0.75384796
0
Parse the XML output from an "svn info" command and extract useful information as a dict.
def parse_svn_info_xml(xml_string): d = {} tree = ET.fromstring(xml_string) entry = tree.find('.//entry') if entry: d['url'] = entry.find('url').text d['revision'] = int(entry.get('revision')) d['repos_url'] = tree.find('.//repository/root').text d['last_changed_r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def svn_info():\n code, result = popen('svn info --xml .', False, False)\n parser = ElementTree.XMLTreeBuilder()\n parser.feed(''.join(result))\n return parser.close()", "def get_svn_info(svn_url_or_wc, rev_number=None):\r\n if rev_number is not None:\r\n args = [svn_url_or_wc + \"@\" + str...
[ "0.8203796", "0.7418163", "0.7025013", "0.693242", "0.69245094", "0.66416997", "0.6343546", "0.62355715", "0.6154227", "0.6129481", "0.6104162", "0.6081777", "0.5968167", "0.58136433", "0.57634497", "0.57295316", "0.5708708", "0.5692372", "0.5637466", "0.5557835", "0.54935837...
0.78879315
1
Parse the XML output from an "svn log" command and extract useful information as a list of dicts (one per log changeset).
def parse_svn_log_xml(xml_string): l = [] tree = ET.fromstring(xml_string) for entry in tree.findall('logentry'): d = {} d['revision'] = int(entry.get('revision')) # Some revisions don't have authors, most notably # the first revision in a repository. author =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def svn_log():\n code, result = popen('svn log --stop-on-copy --xml %s' % base_url(),\n False, False)\n parser = ElementTree.XMLTreeBuilder()\n parser.feed(''.join(result))\n return parser.close()", "def log(repo, args):\n args = args or []\n out = subprocess2.check_output(\n ['svn', 'l...
[ "0.7319128", "0.72359306", "0.66491866", "0.6320032", "0.62218016", "0.6190972", "0.6050652", "0.6038229", "0.60048187", "0.5899122", "0.58628863", "0.5842269", "0.58312356", "0.58181256", "0.58050287", "0.5794505", "0.5756526", "0.57474965", "0.5689585", "0.5652634", "0.5652...
0.8071326
0
Parse the XML output from an "svn status" command and extract useful info as a list of dicts (one per status entry).
def parse_svn_status_xml(xml_string, base_dir=None): l = [] tree = ET.fromstring(xml_string) for entry in tree.findall('.//entry'): d = {} path = entry.get('path') if base_dir is not None: assert path.startswith(base_dir) path = path[len(base_dir):].ls...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def svn_info():\n code, result = popen('svn info --xml .', False, False)\n parser = ElementTree.XMLTreeBuilder()\n parser.feed(''.join(result))\n return parser.close()", "def get_svn_status(svn_wc):\r\n # Ensure proper stripping by canonicalizing the path\r\n svn_wc = os.path.abspath(svn_wc)\r\...
[ "0.72432333", "0.71974355", "0.6659712", "0.6412356", "0.62618715", "0.62445164", "0.6192214", "0.6184007", "0.61359966", "0.6080127", "0.5983944", "0.5895939", "0.58736753", "0.58303154", "0.58027536", "0.57808256", "0.5779228", "0.57057047", "0.570344", "0.5685933", "0.5664...
0.7791763
0
Get SVN information for the given URL or working copy, with an optionally specified revision number. Returns a dict as created by parse_svn_info_xml().
def get_svn_info(svn_url_or_wc, rev_number=None): if rev_number is not None: args = [svn_url_or_wc + "@" + str(rev_number)] else: args = [svn_url_or_wc] xml_string = run_svn(svn_info_args + args, fail_if_stderr=True) return parse_svn_info_xml(xml_string)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_svn_info_xml(xml_string):\r\n d = {}\r\n tree = ET.fromstring(xml_string)\r\n entry = tree.find('.//entry')\r\n if entry:\r\n d['url'] = entry.find('url').text\r\n d['revision'] = int(entry.get('revision'))\r\n d['repos_url'] = tree.find('.//repository/root').text\r\n ...
[ "0.74792516", "0.7262006", "0.6978561", "0.6912358", "0.6846923", "0.6805328", "0.67821187", "0.64899975", "0.64640033", "0.6269762", "0.6125339", "0.61188823", "0.60885954", "0.6075489", "0.6045305", "0.6036259", "0.60327077", "0.60039306", "0.59969646", "0.5993393", "0.5896...
0.85259694
0
Checkout the given URL at an optional revision number.
def svn_checkout(svn_url, checkout_dir, rev_number=None): args = [] if rev_number is not None: args += ['-r', rev_number] args += [svn_url, checkout_dir] return run_svn(svn_checkout_args + args)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkout(self, url=None, rev=None):\r\n args = []\r\n if url is None:\r\n url = self.url\r\n if rev is None or rev == -1:\r\n if (py.std.sys.platform != 'win32' and\r\n svncommon._getsvnversion() == '1.3'):\r\n url += \"@HEAD\" \r\n ...
[ "0.7587817", "0.69942826", "0.69249", "0.66799235", "0.66345185", "0.6605867", "0.6593704", "0.5971365", "0.58886915", "0.5854396", "0.57321954", "0.5711707", "0.56829685", "0.56620574", "0.5588385", "0.5566829", "0.5447706", "0.5394447", "0.53901905", "0.53690535", "0.535483...
0.734565
1
Fetch up to 'limit' SVN log entries between the given revisions.
def run_svn_log(svn_url_or_wc, rev_start, rev_end, limit, stop_on_copy=False): if stop_on_copy: args = ['--stop-on-copy'] else: args = [] args += ['-r', '%s:%s' % (rev_start, rev_end), '--limit', str(limit), svn_url_or_wc] xml_string = run_svn(svn_log_args + args) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iter_svn_log_entries(svn_url, first_rev, last_rev):\r\n cur_rev = first_rev\r\n chunk_length = log_min_chunk_length\r\n chunk_interval_factor = 1.0\r\n while last_rev == \"HEAD\" or cur_rev <= last_rev:\r\n start_t = time.time()\r\n stop_rev = min(last_rev, cur_rev + int(chunk_length ...
[ "0.70947737", "0.67464644", "0.64936244", "0.62931967", "0.6224911", "0.6203545", "0.6197707", "0.6176134", "0.6131039", "0.61278427", "0.6080677", "0.5966624", "0.596037", "0.5953586", "0.5938793", "0.59325117", "0.57986856", "0.5760113", "0.57526404", "0.5749698", "0.572157...
0.73090345
0
Get SVN status information about the given working copy.
def get_svn_status(svn_wc): # Ensure proper stripping by canonicalizing the path svn_wc = os.path.abspath(svn_wc) args = [svn_wc] xml_string = run_svn(svn_status_args + args) return parse_svn_status_xml(xml_string, svn_wc)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetStatus(self, filename):\r\n if not self.options.revision:\r\n status = RunShell([\"svn\", \"status\", \"--ignore-externals\",\r\n self._EscapeFilename(filename)])\r\n if not status:\r\n ErrorExit(\"svn status returned no output for %s\" % filename)\r\n status...
[ "0.71096194", "0.7067892", "0.647219", "0.63601357", "0.6357903", "0.6204381", "0.6062598", "0.6060114", "0.6008719", "0.6006883", "0.5979798", "0.59328514", "0.5929919", "0.59271693", "0.5922021", "0.5919111", "0.5851352", "0.5848176", "0.5807185", "0.57792634", "0.5682582",...
0.7943254
0
Get the first SVN log entry in the requested revision range.
def get_one_svn_log_entry(svn_url, rev_start, rev_end, stop_on_copy=False): entries = run_svn_log(svn_url, rev_start, rev_end, 1, stop_on_copy) if not entries: display_error("No SVN log for %s between revisions %s and %s" % (svn_url, rev_start, rev_end)) return entries[0...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_first_svn_log_entry(svn_url, rev_start, rev_end):\r\n return get_one_svn_log_entry(svn_url, rev_start, rev_end, stop_on_copy=True)", "def get_last_svn_log_entry(svn_url, rev_start, rev_end):\r\n return get_one_svn_log_entry(svn_url, rev_end, rev_start, stop_on_copy=True)", "def log(self, rev_star...
[ "0.8594663", "0.77562016", "0.6639953", "0.6424312", "0.63635945", "0.6149215", "0.6090127", "0.59696937", "0.5898888", "0.57166743", "0.567495", "0.5618679", "0.5595425", "0.5574369", "0.55588615", "0.5477116", "0.5469488", "0.54385024", "0.5427549", "0.5397868", "0.53943014...
0.852757
1
Get the first log entry after/at the given revision number in an SVN branch. By default the revision number is set to 0, which will give you the log entry corresponding to the branch creaction.
def get_first_svn_log_entry(svn_url, rev_start, rev_end): return get_one_svn_log_entry(svn_url, rev_start, rev_end, stop_on_copy=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_one_svn_log_entry(svn_url, rev_start, rev_end, stop_on_copy=False):\r\n entries = run_svn_log(svn_url, rev_start, rev_end, 1, stop_on_copy)\r\n if not entries:\r\n display_error(\"No SVN log for %s between revisions %s and %s\" %\r\n (svn_url, rev_start, rev_end))\r\n\r\n ...
[ "0.7474543", "0.7324269", "0.64620775", "0.6080599", "0.6027151", "0.6015015", "0.5875284", "0.58532226", "0.5841055", "0.58372486", "0.58316255", "0.5739844", "0.57326627", "0.5732128", "0.57199556", "0.57193303", "0.56884575", "0.5652329", "0.56429666", "0.5642953", "0.5626...
0.7538443
0
Get the last log entry before/at the given revision number in an SVN branch. By default the revision number is set to HEAD, which will give you the log entry corresponding to the latest commit in branch.
def get_last_svn_log_entry(svn_url, rev_start, rev_end): return get_one_svn_log_entry(svn_url, rev_end, rev_start, stop_on_copy=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def latest_branch_revision(self, branch):\n return self.repo.get_refs()['refs/remotes/origin/' + branch]", "def get_one_svn_log_entry(svn_url, rev_start, rev_end, stop_on_copy=False):\r\n entries = run_svn_log(svn_url, rev_start, rev_end, 1, stop_on_copy)\r\n if not entries:\r\n display_error...
[ "0.6765192", "0.67387676", "0.66078806", "0.6342817", "0.6319162", "0.6254498", "0.6168754", "0.6143793", "0.6119326", "0.6102056", "0.6072445", "0.6065642", "0.60258543", "0.60138184", "0.5993434", "0.59712136", "0.5943732", "0.5923224", "0.5839787", "0.5791853", "0.57440645...
0.75275195
0
Iterate over SVN log entries between first_rev and last_rev. This function features chunked log fetching so that it isn't too nasty to the SVN server if many entries are requested.
def iter_svn_log_entries(svn_url, first_rev, last_rev): cur_rev = first_rev chunk_length = log_min_chunk_length chunk_interval_factor = 1.0 while last_rev == "HEAD" or cur_rev <= last_rev: start_t = time.time() stop_rev = min(last_rev, cur_rev + int(chunk_length * chunk_interval_fa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log(self, rev_start=None, rev_end=1, verbose=False):\r\n from py.__.path.svn.urlcommand import _Head, LogEntry\r\n assert self.check() # make it simpler for the pipe\r\n rev_start = rev_start is None and _Head or rev_start\r\n rev_end = rev_end is None and _Head or rev_end\r\n\r\n...
[ "0.6570125", "0.65208936", "0.63974756", "0.6192296", "0.61243796", "0.6018704", "0.59748876", "0.5943721", "0.589428", "0.5800521", "0.57751346", "0.577392", "0.57538754", "0.5708253", "0.56509763", "0.5612253", "0.5603118", "0.55822706", "0.55163515", "0.5505781", "0.550519...
0.87408674
0
Given an SVN log entry and an optional sequence of files, do an svn commit.
def commit_from_svn_log_entry(entry, files=None, keep_author=False): # This will use the local timezone for displaying commit times timestamp = int(entry['date']) svn_date = str(datetime.fromtimestamp(timestamp)) # Uncomment this one one if you prefer UTC commit times #svn_date = "%d 0" % times...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def svn_client_commit(svn_client_commit_info_t_commit_info_p, apr_array_header_t_targets, svn_boolean_t_nonrecursive, svn_client_ctx_t_ctx, apr_pool_t_pool): # real signature unknown; restored from __doc__\n pass", "def svn_fs_commit_txn(*args):\r\n return _fs.svn_fs_commit_txn(*args)", "def commit (files)...
[ "0.68557906", "0.67462325", "0.6638299", "0.6335978", "0.62727916", "0.6222189", "0.61176294", "0.60768735", "0.60218906", "0.5964429", "0.59317654", "0.5900699", "0.5886317", "0.582448", "0.5789793", "0.57313246", "0.5703045", "0.5606527", "0.5589553", "0.55780494", "0.55426...
0.7727907
0
Pull SVN changes from the given log entry. Returns the new SVN revision. If an exception occurs, it will rollback to revision 'svn_rev 1'.
def pull_svn_rev(log_entry, svn_url, target_url, svn_path, original_wc, keep_author=False): svn_rev = log_entry['revision'] run_svn(["up", "--ignore-externals", "-r", svn_rev, original_wc]) removed_paths = [] merged_paths = [] unrelated_paths = [] commit_paths = [] for d in log_entr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_last_svn_log_entry(svn_url, rev_start, rev_end):\r\n return get_one_svn_log_entry(svn_url, rev_end, rev_start, stop_on_copy=True)", "def get_one_svn_log_entry(svn_url, rev_start, rev_end, stop_on_copy=False):\r\n entries = run_svn_log(svn_url, rev_start, rev_end, 1, stop_on_copy)\r\n if not entr...
[ "0.68926513", "0.67179364", "0.63539994", "0.6260936", "0.623889", "0.61554503", "0.6080435", "0.5869495", "0.58553165", "0.58542365", "0.5845239", "0.5809937", "0.5799207", "0.577643", "0.57277685", "0.57229894", "0.57108986", "0.56525624", "0.5649471", "0.5644801", "0.56429...
0.782687
0
Gives a value for terminal position. R is minimizing while C is maximizing
def eval_field_seki(field, depth, is_r): assert (field.is_terminal()) r_won = None if field.has_zero_row() and field.has_zero_col(): r_won = not is_r elif field.has_zero_row(): r_won = True else: r_won = False value = -1 if r_won else 1 return value / depth
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fd_pasym_head(self,pos):\n\t\tvalue = 0.0\n\t\ty = self.y\n\t\t#print('point:%d' % pos)\n\t\tfor j in range(-pos, 0):\n\t\t\t#print( \"\ty[%d] - y[%d] * c[%d][%d] \" % (pos+j, pos, pos, j) )\n\t\t\tvalue = value + ( y[pos+j] - y[pos] ) * self.coef_asym[pos][j]\n\t\tfor j in range(1,self.order - pos+1):\n\t\t\t...
[ "0.61338705", "0.59819514", "0.59533167", "0.5895877", "0.58766717", "0.58374786", "0.57107085", "0.5688918", "0.5687046", "0.5676773", "0.56493044", "0.5604459", "0.55781573", "0.5576921", "0.55641127", "0.5559627", "0.55448663", "0.5541612", "0.5539037", "0.54996073", "0.54...
0.0
-1
Constructs the solver matrix numpy matrix type string with value "seki" or "dseki"
def __init__(self, matrix, type) -> None: self.field = Field(matrix) assert (type in ["seki", "dseki"]) self.eval_field = eval_field_seki if type == "seki" else eval_field_dseki self.depth = 1 self.unrolled = 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def matrix_string_zeros(self, size, prefix = ''):\n if size == 1: # Not indexed\n return np.array2string(np.array(0.))\n if len(size) == 1:\n size.append(1)\n mat = np.zeros(size)\n return np.array2string(mat, prefix = prefix, sign = ' ', separa...
[ "0.5760166", "0.5666808", "0.56033075", "0.5507681", "0.53949434", "0.5318736", "0.5278236", "0.52359253", "0.521982", "0.52061254", "0.52024376", "0.5202384", "0.518477", "0.5170777", "0.5167868", "0.5157931", "0.511876", "0.51112455", "0.5110738", "0.51063246", "0.51015216"...
0.5191977
12
Decrements the field in the position x, y (zero based) x int y int
def decrement(self, x, y): self.field.add(x, y, -1) self.depth += 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset(self, x, y):\n # Update impact to row, column and block containing (x, y)\n val = self.field[x][y]\n\n for i in range(0, 9):\n self.reset_detail(x, y, val, x, i)\n \n for i in range(0, 9):\n self.reset_detail(x, y, val, i, y)\n\n cx = int(in...
[ "0.6667889", "0.6542566", "0.63265264", "0.6257075", "0.62394804", "0.6153629", "0.61325014", "0.6112912", "0.60975367", "0.6093218", "0.60634387", "0.59816176", "0.59665287", "0.59466773", "0.5920354", "0.5912557", "0.59046715", "0.5892904", "0.58569384", "0.5818755", "0.579...
0.77877957
0
field Field returns optimal move
def _find_optimal_impl(self, field, depth, is_r, alpha, beta): # Try to evaluate the field right now if field.is_terminal(): final_value = self.eval_field(field, depth, is_r) return Move(final_value, 0, 0) self.unrolled += 1 # copy = field.copy() value =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def best_move(self):\n if self._move is not None:\n return self._move\n else:\n return self.pass_move", "def find_best_move(state: GameState) -> None:", "def move(self, _vec):\n\n\t\t_dest = self._grid[0] + _vec[0], self._grid[1] + _vec[1], self._grid[2] + _vec[2]\n\t\tif _v...
[ "0.6263069", "0.6059461", "0.5905605", "0.58534604", "0.58158803", "0.5784372", "0.5657567", "0.5616514", "0.55931526", "0.55312353", "0.55171657", "0.5478466", "0.5442166", "0.540294", "0.5393491", "0.53857905", "0.5375167", "0.5373872", "0.53728926", "0.536618", "0.5354955"...
0.63401204
0
Calcula costes de plataforma IN/OUT, donde
def costo_plataforma(df, t_util = 8, efic_rep = 0.75, dias_lab = 6, q_sem = 4): ofertas = pd.read_csv('modelo_plataforma_cc.txt', sep=",") ofertas['cost_plat_in'] = 0 ofertas['cost_plat_out'] = ofertas['cost_hora_pos']*ofertas['dur_llam_out']/ofertas['efic_rep'] result = pd.merge(df, ofertas, on = 'tip...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calcula_aptitud(self, individuo, costo=None):", "def compute(self):\n\t\tmontant = self.spn_montant.value() #recuperation de la valeur de la spn\n\t\tdevise_from = self.cbb_devisesFrom.currentText() #recuperation de la valeur de la cbb\n\t\tdevise_to = self.cbb_devisesTo.currentText()\n\t\t\n\t\t# on effectu...
[ "0.65401614", "0.6488248", "0.643085", "0.6191603", "0.61788696", "0.60793084", "0.6011011", "0.5920542", "0.58996636", "0.57785296", "0.5770543", "0.57606196", "0.5681205", "0.5672207", "0.56567854", "0.563276", "0.56140304", "0.560827", "0.55904824", "0.5572631", "0.5561377...
0.60322857
6
Calcula costes SAC totales, donde
def costo_sac(df): costo_sac = {'cost_sac': df['subsidio'] + df['logistica'] + df['comisiones']} costo_sac_df = pd.DataFrame(data=costo_sac) return costo_sac_df
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ticket_salida(self):\n total = 0.0\n for x in self.mi_parqueo:\n total=x.cobro=total\n\n print(\"El costo total es de :\",total)", "def costo_total(df, t_util = 8, efic_rep = 0.75, dias_lab = 6, q_sem = 4):\n\n cost_plat = costo_plataforma(df, t_util, efic_rep, dias_lab, q_...
[ "0.71331376", "0.6838398", "0.65452355", "0.65064234", "0.63895726", "0.63738936", "0.6218767", "0.61712676", "0.61413014", "0.6100593", "0.61002", "0.6050563", "0.6042762", "0.6030574", "0.60190064", "0.5970461", "0.5924554", "0.59165955", "0.5898301", "0.58842534", "0.58736...
0.6641389
2
Calcula costes de campana totales IN/OUT, donde
def costo_campana(df): cost_campana = {'cost_campana_in': df['cost_plat_in'] + df['cost_sac'], 'cost_campana_out': df['cost_plat_out'] + df['cost_sac']} cost_campana_df = pd.DataFrame(data=cost_campana) return cost_campana_df
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ticket_salida(self):\n total = 0.0\n for x in self.mi_parqueo:\n total=x.cobro=total\n\n print(\"El costo total es de :\",total)", "def calcula_aptitud(self, individuo, costo=None):", "def _compute_cuantia_subtotal(self):\n for line in self:\n line.gasto = ...
[ "0.70049584", "0.6887061", "0.6675226", "0.6600468", "0.64609945", "0.62451947", "0.6129486", "0.61174196", "0.61088085", "0.6103059", "0.6055941", "0.6007516", "0.597338", "0.59122866", "0.5907891", "0.5861689", "0.58308345", "0.58278495", "0.58226305", "0.58205116", "0.5815...
0.5616694
43
Corre las 3 funciones anteriores, donde
def costo_total(df, t_util = 8, efic_rep = 0.75, dias_lab = 6, q_sem = 4): cost_plat = costo_plataforma(df, t_util, efic_rep, dias_lab, q_sem) cost_sac = costo_sac(df) cost_campana = costo_campana(pd.concat([cost_plat, cost_sac], axis=1)) return cost_campana
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_ejercicio_3():\n\n # Parametros para el ejercicio\n lower = 0\n upper = 4 * np.pi\n number_of_points = 100\n\n print(f\"Separando el intervalo [{lower}, {upper}] en {number_of_points} puntos equidistantes\")\n values = np.linspace(lower, upper, number_of_points)\n print(\"\")\n\n pr...
[ "0.5906704", "0.58492017", "0.5816238", "0.57364416", "0.5734827", "0.561756", "0.55833215", "0.555679", "0.55504805", "0.55209035", "0.54694617", "0.5459285", "0.5459001", "0.543896", "0.5436901", "0.54169863", "0.54040456", "0.53924125", "0.53897214", "0.53456795", "0.53359...
0.0
-1
Calcula churn estimado al vencimiento de una oferta, donde
def churn_post_oferta(churn_orig, churn_nvo, dur_oferta, progresivo = True): churn_of = list(np.repeat(churn_nvo, dur_oferta)) churn_blin = list() if progresivo: churn_n = churn_nvo*1.1 while churn_n < churn_orig and len(churn_blin) < 24 - dur_oferta: churn_blin.append(churn_n)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ticket_salida(self):\n total = 0.0\n for x in self.mi_parqueo:\n total=x.cobro=total\n\n print(\"El costo total es de :\",total)", "def cobroEfectivo(self):\n if self.total_a_pagar == 0:\n QtGui.QMessageBox.information(self,\"Aviso\",\"El saldo restante a pag...
[ "0.594477", "0.59144413", "0.5895648", "0.5884257", "0.582389", "0.57966834", "0.576086", "0.5704633", "0.5664176", "0.566226", "0.5612852", "0.5609941", "0.55848473", "0.5577858", "0.5547411", "0.5522488", "0.54816175", "0.5461725", "0.54548883", "0.5430527", "0.5413788", ...
0.5432651
19
We want to grab data from the db, put it into coordinate style for scipy, then run our cluster on them The coordinate transform from the db is the reusable part. What format do we need as output is the question. And how do we cluster on multiple dimensions? Also worth setting up the pipeline to graphing it.
def main(): # First grab data from db engine = create_engine("sqlite:///cities.db") session = Session(bind=engine) # Grab all data from flat stats table query = session.query(FlatStat).all() X = transform_to_np_array(query) # Run dbscan now results = DBSCAN(eps=2, min_samples=10).fit(X...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cluster_spatial_positioning(data):\n \n n_clusters = len(set(data['clusters'])-{-1}) # since -1 element denotes noice\n if n_clusters <2:\n #Setting cluster angluar features to default\n cdist=[Cluster_Relative_Distances()]\n cdist = pd.DataFrame([o.__dict__ for o in cdist])\n\n ...
[ "0.65974456", "0.65166414", "0.64565694", "0.6299202", "0.6146439", "0.6073454", "0.6066283", "0.6054685", "0.60449445", "0.6035069", "0.60201204", "0.5978135", "0.59736603", "0.59551185", "0.5908959", "0.588963", "0.5849856", "0.5788239", "0.5782379", "0.57132316", "0.570308...
0.5249919
68
Prepare a raw input file by eg. adding the classification classes to use for the classification,...
def prepare_input(input_parcel_filepath: Path, input_parcel_filetype: str, input_parcel_pixcount_filepath: Path, classtype_to_prepare: str, classes_refe_filepath: Path, output_parcel_filepath: Path, force: bool =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preprocess(self):\n lines = [line.rstrip() for line in open(self.attr_path, 'r')]\n all_attr_names = lines[1].split()\n for i, attr_name in enumerate(all_attr_names):\n self.attr2idx[attr_name] = i\n self.idx2attr[i] = attr_name\n\n lines = lines[2:]\n r...
[ "0.6518632", "0.63359535", "0.6328908", "0.630111", "0.6296088", "0.6294266", "0.6280184", "0.61144876", "0.61144876", "0.6112482", "0.6062052", "0.60491985", "0.60467964", "0.60427934", "0.6041654", "0.60150254", "0.59850276", "0.5966872", "0.59632254", "0.59494656", "0.5936...
0.5612273
64
Create a seperate train and test sample from the general input file.
def create_train_test_sample(input_parcel_filepath: Path, output_parcel_train_filepath: Path, output_parcel_test_filepath: Path, balancing_strategy: str, force: bool = False): # If force == False Che...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_train_test(self):\n x, y = self.read_data()\n x_train, y_train, x_test, y_test = self.sample_data(x, y)\n self.train = (x_train, y_train)\n self.test = (x_test, y_test)", "def train(self, trainfile):", "def read_train_data(train_file,file_id=None):\n if os.path.isfil...
[ "0.7296715", "0.69343054", "0.64366525", "0.6365826", "0.635796", "0.6317381", "0.6297845", "0.62914085", "0.62863445", "0.6279584", "0.6257158", "0.6185912", "0.618352", "0.61781466", "0.61696774", "0.6167486", "0.61413723", "0.611984", "0.61026764", "0.60994875", "0.6079686...
0.57436734
85
Decorator for a custom writer, but a default reader
def _writer(func): name = func.__name__ return property(fget=lambda self: getattr(self, '_%s' % name), fset=func)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_writer(fn, samples):\n if is_bed(fn):\n return BedWriter(fn, samples)\n elif is_vcf(fn):\n return VcfWriter(fn, samples)\n else:\n raise ValueError(\"Could not get reader for %s\" % fn)", "def _json_default_encoder(func):\n\n @wraps(func)\n def inner(self, o):\n ...
[ "0.595238", "0.54192704", "0.53424925", "0.52520764", "0.52455467", "0.52088577", "0.51499164", "0.5144171", "0.5096153", "0.50615203", "0.49974352", "0.4978391", "0.49752855", "0.49655232", "0.49428678", "0.49167585", "0.49089715", "0.4900687", "0.4897344", "0.48930278", "0....
0.5535025
1
Encodes a certificate into PEM format
def pem_armor_certificate(certificate): return asymmetric.dump_certificate(certificate)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encode_certificate(self, cert):\n return cert.public_bytes(\n serialization.Encoding.PEM,\n ).decode(encoding='UTF-8')", "def cert_to_pem(cert):\n return cert.public_bytes(Encoding.PEM)", "def encode_csr(self, csr):\n return csr.public_bytes(\n serialization.En...
[ "0.790705", "0.67137074", "0.66287994", "0.62648046", "0.62635964", "0.6201385", "0.6190777", "0.6079637", "0.57039255", "0.5664951", "0.5664951", "0.56504196", "0.55824506", "0.55710584", "0.5538198", "0.54970545", "0.5482253", "0.5482253", "0.5482253", "0.5480252", "0.54799...
0.71420515
1
Unless changed, certificates will use SHA256 for the signature, and will be valid from the moment created for one year. The serial number will be generated from the current time and a random number.
def __init__(self, subject, subject_public_key): self.subject = subject self.subject_public_key = subject_public_key self.ca = False self._hash_algo = 'sha256' self._other_extensions = {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_sig():\n return hashlib.md5(\n (\n app.config[\"ROVI_API_KEY\"]\n + app.config[\"ROVI_SHARED_SECRET\"]\n + repr(int(time.time()))\n ).encode(\"utf-8\")\n ).hexdigest()", "def cert_serial_number(self) -> str:\n return pulumi.get(self, \"cert_seri...
[ "0.6197397", "0.59526736", "0.59117323", "0.5746391", "0.5691744", "0.5687212", "0.56695473", "0.5644744", "0.5605802", "0.5597728", "0.55461216", "0.5529499", "0.5500181", "0.5500181", "0.54843247", "0.54745406", "0.54307294", "0.5403768", "0.53915924", "0.53654635", "0.5352...
0.0
-1
A bool if the certificate should be selfsigned.
def self_signed(self, value): self._self_signed = bool(value) if self._self_signed: self._issuer = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _self_signed(cert):\n\n self_signed = cert.self_signed\n\n if self_signed == 'yes':\n return True\n if self_signed == 'no':\n return False\n\n # In the case of \"maybe\", we have to check the signature\n signature_algo = cert['signature_algorithm'].signature_algo\n hash_algo = c...
[ "0.7676269", "0.7297445", "0.66110617", "0.65087295", "0.64427626", "0.64114046", "0.63890487", "0.63365227", "0.6318945", "0.6201762", "0.61719525", "0.616227", "0.6131436", "0.6125913", "0.6094979", "0.607799", "0.6075482", "0.6075482", "0.60754424", "0.60716385", "0.606905...
0.6872902
2
An int representable in 160 bits or less must uniquely identify this certificate when combined with the issuer name.
def serial_number(self, value): if not isinstance(value, int_types): raise TypeError(_pretty_message( ''' serial_number must be an integer, not %s ''', _type_name(value) )) if value < 0: raise ValueErro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def certificate_issuer_id(self):\n return self._certificate_issuer_id", "def issuer_did(self) -> str:\n return self._issuer_did", "def build_cert_identifier(cert):\n hash_subject = get_cert_issuer_string_hash(cert)\n serial_number = get_cert_serial(cert)\n cert_id = '%s-%s' % (hash_subje...
[ "0.65630484", "0.64448166", "0.6042292", "0.5742815", "0.56468314", "0.5594798", "0.55910057", "0.55862623", "0.5569976", "0.55607724", "0.55246556", "0.5510257", "0.5505552", "0.5504308", "0.5503427", "0.5472687", "0.5470952", "0.54480195", "0.54480195", "0.54326737", "0.543...
0.0
-1
An asn1crypto.x509.Certificate object of the issuer. Used to populate both the issuer field, but also the authority key identifier extension.
def issuer(self, value): is_oscrypto = isinstance(value, asymmetric.Certificate) if not isinstance(value, x509.Certificate) and not is_oscrypto: raise TypeError(_pretty_message( ''' issuer must be an instance of asn1crypto.x509.Certificate or ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def certificate_issuer_id(self):\n return self._certificate_issuer_id", "def certificate_issuer_value(self):\n\n if self._processed_extensions is False:\n self._set_extensions()\n return self._certificate_issuer_value", "def issuer(self) -> str:\n return self._issuer", ...
[ "0.73816204", "0.6945147", "0.66578543", "0.6484168", "0.6398865", "0.639261", "0.6361317", "0.6319611", "0.62974656", "0.6297223", "0.6297223", "0.62301636", "0.6222359", "0.61747855", "0.6001003", "0.5899635", "0.5805775", "0.5805775", "0.57601124", "0.5741107", "0.5689454"...
0.7783984
0
A datetime.datetime object of when the certificate becomes valid.
def begin_date(self, value): if not isinstance(value, datetime): raise TypeError(_pretty_message( ''' begin_date must be an instance of datetime.datetime, not %s ''', _type_name(value) )) self._begin_date = value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getCertificateExpireDate(self):\n cert = self.getLatestValidCertification()\n if cert == None:\n return ''\n date = cert.getValidTo()\n return date", "def date_validity(self):\n return self._date_validity", "def ssl_expiry_datetime(hostname):\n context = ssl...
[ "0.69607", "0.66542804", "0.6585032", "0.65495664", "0.62872523", "0.6156159", "0.6081939", "0.6014796", "0.60007334", "0.5992161", "0.5919488", "0.5916895", "0.58901703", "0.58606815", "0.58521783", "0.581352", "0.57810855", "0.5732573", "0.57031465", "0.56885535", "0.567074...
0.0
-1
A datetime.datetime object of when the certificate is last to be considered valid.
def end_date(self, value): if not isinstance(value, datetime): raise TypeError(_pretty_message( ''' end_date must be an instance of datetime.datetime, not %s ''', _type_name(value) )) self._end_date = value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getCertificateExpireDate(self):\n cert = self.getLatestValidCertification()\n if cert == None:\n return ''\n date = cert.getValidTo()\n return date", "def ssl_expiry_datetime(hostname):\n context = ssl.create_default_context()\n conn = context.wrap_socket(\n ...
[ "0.72346616", "0.67452127", "0.6745199", "0.6700553", "0.6599108", "0.6572279", "0.6531324", "0.63191897", "0.629717", "0.6254792", "0.61955625", "0.6154121", "0.6149514", "0.6149514", "0.61366004", "0.6044898", "0.6033291", "0.59885865", "0.59877986", "0.595451", "0.59464043...
0.0
-1
An asn1crypto.x509.Name object, or a dict with a minimum of the
def subject(self, value): is_dict = isinstance(value, dict) if not isinstance(value, x509.Name) and not is_dict: raise TypeError(_pretty_message( ''' subject must be an instance of asn1crypto.x509.Name or a dict, not %s ''', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cert_object_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"cert_object_name\")", "def convert_x509_name(name):\n types = {\n 'country_name': 'C',\n 'state_or_province_name': 'ST',\n 'locality_name': 'L',\n 'organization_name': 'O',\n 'organ...
[ "0.61068594", "0.60691684", "0.5984909", "0.5686483", "0.563324", "0.5583557", "0.55041414", "0.54571456", "0.5341562", "0.52905697", "0.5269361", "0.525769", "0.5204798", "0.51825786", "0.51745605", "0.5153804", "0.51404864", "0.51404864", "0.5100858", "0.5081084", "0.505347...
0.56423205
4
An asn1crypto.keys.PublicKeyInfo or oscrypto.asymmetric.PublicKey object of the subject's public key.
def subject_public_key(self, value): is_oscrypto = isinstance(value, asymmetric.PublicKey) if not isinstance(value, keys.PublicKeyInfo) and not is_oscrypto: raise TypeError(_pretty_message( ''' subject_public_key must be an instance of asn1cry...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_pubkey(self):\n return self._csr['certificationRequestInfo']['subjectPublicKeyInfo']", "def get_public_key_in_pem(self):\n serialized_public = self.public_key_obj.public_bytes(\n encoding=serialization.Encoding.PEM,\n format=serialization.PublicFormat.SubjectPublicKeyI...
[ "0.7763876", "0.76124096", "0.7592928", "0.7516889", "0.7312235", "0.7280198", "0.72754097", "0.7230182", "0.71164966", "0.6709869", "0.67095035", "0.665919", "0.66478723", "0.66478723", "0.66474545", "0.6620959", "0.6620501", "0.6620501", "0.66195834", "0.6607613", "0.656907...
0.83701605
0
A unicode string of the hash algorithm to use when signing the certificate "sha1" (not recommended), "sha256" or "sha512".
def hash_algo(self, value): if value not in set(['sha1', 'sha256', 'sha512']): raise ValueError(_pretty_message( ''' hash_algo must be one of "sha1", "sha256", "sha512", not %s ''', repr(value) )) self._hash_algo =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def signatureHashAlgorithm(self) -> str:\n hash_algo = self['signature_algorithm'].hash_algo\n return hash_algo", "def hash_algo(self) -> str:\n return self._hash_algo", "def RSA_SIGNATURE_HASH() :\n return \"SHA-256\"", "def signatureAlgorithm(self) -> str:\n sig_algo = self['...
[ "0.7617197", "0.7241762", "0.7215664", "0.69843435", "0.66730136", "0.6568381", "0.6529633", "0.6485693", "0.6373251", "0.6373251", "0.63428897", "0.63382006", "0.6287389", "0.62459266", "0.6244673", "0.6243459", "0.62148154", "0.61939317", "0.61780065", "0.6158464", "0.61474...
0.6341182
11
A bool if the certificate is a CA cert
def ca(self): return self._basic_constraints['ca'].native
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_ca_cert(cert):\n # extract \"ca\" value from cert extensions\n is_ca = False\n try:\n basic_constraints = cert.extensions.get_extension_for_oid(\n x509.ExtensionOID.BASIC_CONSTRAINTS)\n value = getattr(basic_constraints, 'value', None)\n if value:\n is_ca ...
[ "0.77921116", "0.76305676", "0.72788465", "0.69085", "0.66927445", "0.6602046", "0.6553518", "0.653734", "0.6530486", "0.64007705", "0.64000976", "0.6396583", "0.62475324", "0.6196692", "0.6176096", "0.61371815", "0.61318576", "0.610232", "0.610232", "0.6089868", "0.6045874",...
0.60311806
21
A list of unicode strings the domains in the subject alt name extension.
def subject_alt_domains(self): return self._get_subject_alt('dns_name')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_gnames(self, ext):\n res = []\n for gn in ext:\n if isinstance(gn, x509.RFC822Name):\n res.append('email:' + as_unicode(gn.value))\n elif isinstance(gn, x509.DNSName):\n res.append('dns:' + as_unicode(gn.value))\n elif isinsta...
[ "0.72788537", "0.6887314", "0.68745184", "0.6768655", "0.66532815", "0.6598599", "0.6590056", "0.64256465", "0.63596284", "0.6282002", "0.62713486", "0.61748195", "0.6156774", "0.6148802", "0.6116992", "0.60856193", "0.60594046", "0.60446495", "0.5983179", "0.5977446", "0.589...
0.7977574
0
A list of unicode strings the email addresses in the subject alt name extension.
def subject_alt_emails(self): return self._get_subject_alt('rfc822_name')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def email_list(self) -> Sequence[str]:\n return pulumi.get(self, \"email_list\")", "def _get_subject_alt(self, name):\n\n if self._subject_alt_name is None:\n return []\n\n output = []\n for general_name in self._subject_alt_name:\n if general_name.name == name:\...
[ "0.72356385", "0.6921819", "0.6838051", "0.6719125", "0.6706177", "0.6345417", "0.6270645", "0.6250385", "0.6169006", "0.6162307", "0.60720193", "0.60488534", "0.5979134", "0.5948501", "0.5937776", "0.5931379", "0.57942194", "0.5780418", "0.5780418", "0.5755309", "0.5742887",...
0.78213984
0
A list of unicode strings the IPs in the subject alt name extension.
def subject_alt_ips(self): return self._get_subject_alt('ip_address')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subject_alt_domains(self):\n\n return self._get_subject_alt('dns_name')", "def extract_gnames(self, ext):\n res = []\n for gn in ext:\n if isinstance(gn, x509.RFC822Name):\n res.append('email:' + as_unicode(gn.value))\n elif isinstance(gn, x509.DNSNam...
[ "0.6537365", "0.646454", "0.6455185", "0.62171775", "0.616625", "0.59316343", "0.5899585", "0.5891852", "0.58809155", "0.58578", "0.5840667", "0.58072513", "0.5775309", "0.57627815", "0.5722256", "0.5714882", "0.5680381", "0.56474614", "0.5626229", "0.55998427", "0.5547352", ...
0.72669786
0
A list of unicode strings the URIs in the subject alt name extension.
def subject_alt_uris(self): return self._get_subject_alt('uniform_resource_identifier')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subject_alt_emails(self):\n\n return self._get_subject_alt('rfc822_name')", "def extract_gnames(self, ext):\n res = []\n for gn in ext:\n if isinstance(gn, x509.RFC822Name):\n res.append('email:' + as_unicode(gn.value))\n elif isinstance(gn, x509.DNSN...
[ "0.6799801", "0.66808426", "0.66736543", "0.6628554", "0.6431734", "0.61050284", "0.60392606", "0.594447", "0.5796263", "0.57637", "0.568384", "0.5626839", "0.5591084", "0.5591084", "0.5548497", "0.5543832", "0.55101144", "0.54757005", "0.54666746", "0.5451787", "0.5436031", ...
0.7319736
0
Returns the native value for each value in the subject alt name extension that is an asn1crypto.x509.GeneralName of the type specified by the name param.
def _get_subject_alt(self, name): if self._subject_alt_name is None: return [] output = [] for general_name in self._subject_alt_name: if general_name.name == name: output.append(general_name.native) return output
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_gnames(self, ext):\n res = []\n for gn in ext:\n if isinstance(gn, x509.RFC822Name):\n res.append('email:' + as_unicode(gn.value))\n elif isinstance(gn, x509.DNSName):\n res.append('dns:' + as_unicode(gn.value))\n elif isinsta...
[ "0.60357517", "0.60340154", "0.58107865", "0.57732433", "0.57518286", "0.52605563", "0.52396375", "0.5225003", "0.51472336", "0.50632966", "0.50319296", "0.50171", "0.4920979", "0.4885249", "0.48720473", "0.48472485", "0.48396906", "0.48279297", "0.48234767", "0.47389436", "0...
0.72134984
0
Replaces all existing asn1crypto.x509.GeneralName objects of the choice represented by the name param with the values.
def _set_subject_alt(self, name, values): if self._subject_alt_name is not None: filtered_general_names = [] for general_name in self._subject_alt_name: if general_name.name != name: filtered_general_names.append(general_name) self._subjec...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_x509_name(name):\n types = {\n 'country_name': 'C',\n 'state_or_province_name': 'ST',\n 'locality_name': 'L',\n 'organization_name': 'O',\n 'organizational_unit_name': 'OU',\n 'common_name': 'CN',\n 'email_address': 'emailAddress'\n }\n\n return...
[ "0.54285276", "0.52805185", "0.5233348", "0.5175837", "0.5152925", "0.5109464", "0.50863415", "0.50817627", "0.5079362", "0.50544924", "0.5022161", "0.5008312", "0.50026274", "0.50002813", "0.49956682", "0.49948135", "0.49948135", "0.49823135", "0.49680725", "0.49542877", "0....
0.676688
0
A set of unicode strings the allowed usage of the key from the key usage extension.
def key_usage(self): if self._key_usage is None: return set() return self._key_usage.native
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extended_key_usage(self):\n\n if self._extended_key_usage is None:\n return set()\n\n return set(self._extended_key_usage.native)", "def ext_key_usages(self) -> pulumi.Output[Optional[Sequence[str]]]:\n return pulumi.get(self, \"ext_key_usages\")", "def ext_key_usages(self) ...
[ "0.72852504", "0.71876127", "0.7110622", "0.7110622", "0.6899027", "0.6682606", "0.6610231", "0.6610231", "0.6250715", "0.6044399", "0.5868221", "0.57700825", "0.5761456", "0.57214475", "0.564019", "0.5608141", "0.5545575", "0.5542595", "0.5515115", "0.551212", "0.549101", ...
0.69564635
4