query stringlengths 10 2k | document stringlengths 20 51.2k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Load configuration as YAML | def create_from_config_file(cls, filename: str):
return cls(load_yaml_config(filename)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_config():\n proj_dir = os.path.dirname(os.path.abspath(__file__))\n config_path = os.path.join(proj_dir, \"config.yml\")\n conf = yaml.safe_load(open(config_path))\n return conf",
"def load_config(path):\n return yaml.load(open('config.yaml', 'r'), Loader=yaml.SafeLoader)",
"def load_co... | [
"0.7498169",
"0.7469654",
"0.7407388",
"0.73893446",
"0.7375833",
"0.7322686",
"0.7309558",
"0.730626",
"0.728386",
"0.7278236",
"0.7198929",
"0.71866953",
"0.71773416",
"0.7143315",
"0.71375245",
"0.7136472",
"0.7121104",
"0.71088123",
"0.7106947",
"0.7104316",
"0.70963204",... | 0.0 | -1 |
String representation of HashMap | def __str__(self) -> str:
return "scapacity of hash: {}, current size of hash: {}".format(
self.capacity, self.length
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repr__(self):\n res = \"{\"\n for k in self.keys():\n res+=\" '\"+str(k)+\"':\"+str(self[k])+\",\"\n res=res[:-1]+\" }\"\n return res",
"def _to_string(self) -> str:\n\n string_list = []\n for key, value in self.__dict__.items():\n if isinstan... | [
"0.73969597",
"0.7382804",
"0.73118407",
"0.72339815",
"0.71007025",
"0.7078618",
"0.7071905",
"0.70162076",
"0.6926971",
"0.6917885",
"0.6871455",
"0.6868821",
"0.68683535",
"0.6868242",
"0.6849327",
"0.6827283",
"0.6805755",
"0.67866665",
"0.6743823",
"0.6734863",
"0.672186... | 0.0 | -1 |
String representation of HashMap | def __repr__(self) -> str:
return "capacity of hash: {}, current size of hash: {}".format(
self.capacity, self.length
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repr__(self):\n res = \"{\"\n for k in self.keys():\n res+=\" '\"+str(k)+\"':\"+str(self[k])+\",\"\n res=res[:-1]+\" }\"\n return res",
"def _to_string(self) -> str:\n\n string_list = []\n for key, value in self.__dict__.items():\n if isinstan... | [
"0.73969597",
"0.7382804",
"0.73118407",
"0.72339815",
"0.71007025",
"0.7078618",
"0.7071905",
"0.70162076",
"0.6926971",
"0.6917885",
"0.6871455",
"0.6868821",
"0.68683535",
"0.6868242",
"0.6849327",
"0.6827283",
"0.6805755",
"0.67866665",
"0.6743823",
"0.6734863",
"0.672186... | 0.0 | -1 |
Returns the unitary for this gate, see Unitary for more info. | def get_unitary(self, params: Sequence[float] = []) -> UnitaryMatrix:
self.check_parameters(params)
H = dot_product(params, self.sigmav)
eiH = sp.linalg.expm(H)
return UnitaryMatrix(eiH, check_arguments=False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_unitary(self, params: Sequence[float] = []) -> UnitaryMatrix:\n self.check_parameters(params)\n if hasattr(self, 'utry'):\n return self.utry\n\n return self.gate.get_unitary(params)",
"def get_unit(self):\n return self.unit",
"def unit(self):\n return self._... | [
"0.73084533",
"0.6853074",
"0.6796897",
"0.6787496",
"0.67088467",
"0.67088467",
"0.64119154",
"0.6364377",
"0.63519824",
"0.63118136",
"0.63069683",
"0.6300979",
"0.62563705",
"0.62363553",
"0.62363553",
"0.62363553",
"0.62363553",
"0.62363553",
"0.62363553",
"0.62363553",
"... | 0.0 | -1 |
Returns the gradient for this gate, see Gate for more info. | def get_grad(self, params: Sequence[float] = []) -> np.ndarray:
self.check_parameters(params)
H = dot_product(params, self.sigmav)
_, dU = dexpmv(H, self.sigmav)
return dU | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_gradient(self):\n # Fast path\n if self._gradient is not None:\n return self._gradient\n # Flatten (make if necessary)\n gradient = tools.flatten(tools.grads_of(self._model.parameters()))\n self._gradient = gradient\n return gradient",
"def get_grad(self):\n\n return self._g... | [
"0.8085759",
"0.80038965",
"0.77770317",
"0.77462053",
"0.77197397",
"0.76745313",
"0.7669742",
"0.7668911",
"0.75381553",
"0.7504617",
"0.74778986",
"0.74767464",
"0.7301407",
"0.7287206",
"0.7258881",
"0.7254634",
"0.71921414",
"0.71770763",
"0.71519166",
"0.71435493",
"0.7... | 0.0 | -1 |
Another moving average function. _i = sum_j=k^k x_i+j | def moving_average(x, window_len = 11):
one_over_size = 1./float(window_len)
window = np.ones(window_len) * one_over_size
result = np.convolve(x, window, 'valid')
# Cut off the clutter at the boundaries
#return result[ (window_len-1)/2 : -(window_len-1)/2]
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def moving_average(data, beta):\n avg = 0\n maverages = []\n for i in range(len(data)):\n avg = avg * beta + (1 - beta) * data[i]\n maverages.append(avg / (1 - (beta ** (i + 1))))\n return maverages",
"def moving_average(a, n=3) :\n ret = np.cumsum(a, dtype=float)\n ret[n:] = ret[... | [
"0.71843755",
"0.716615",
"0.7143164",
"0.7132354",
"0.71248853",
"0.70662874",
"0.7041034",
"0.70031595",
"0.69867367",
"0.69572216",
"0.6957015",
"0.6807443",
"0.6807205",
"0.6796927",
"0.6651025",
"0.66394615",
"0.6610586",
"0.6545233",
"0.6524394",
"0.6446204",
"0.6386004... | 0.6997602 | 8 |
Iterator to return one record at a time. Assigns payload and device metadata to the instance of SensorKitProtoFile | def walk(self):
data = open(self.data_file_path, 'rb')
read_metric = globals()["ProtoDefinition"].Payload()
read_metric.ParseFromString(data.read())
# One record for the whole file
self.payload_metadata = read_metric.payloadMetadata
self.device = read_metric.device
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _record_iterator(self):\n\n # Alias these values so the code won't need to keep performing\n # attribute lookups on `self` (small optimization)\n stream = self.stream\n sync_marker = self._sync_marker\n writer_schema = self.writer_schema\n reader_schema = self.reader_s... | [
"0.6672943",
"0.6447087",
"0.6186513",
"0.6181375",
"0.6179146",
"0.6148484",
"0.60548794",
"0.5995896",
"0.587418",
"0.58472407",
"0.582769",
"0.58241385",
"0.5822537",
"0.58175874",
"0.58102715",
"0.57757586",
"0.5767108",
"0.57566285",
"0.574908",
"0.573971",
"0.5732266",
... | 0.7334093 | 0 |
Create vector of spatial ycoordinate | def vec_y(self):
if self.oy != 0:
ov = self.oy
lv = self.self.ly + self.oy
else:
ov = self.dy / 2
lv = self.ly
yv = ""
for num in np.arange(ov, lv, self.dy):
yv += str(num) + " "
return yv | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def y_coord(self):\n\n return self.y0 + np.arange(self.ny) * self.dy",
"def y(self):\n return self.coords[1]",
"def y(self):\n return self._coords[1]",
"def yvec(self):\n return self._yvec",
"def y(self) -> ir.FloatingValue:\n return ops.GeoY(self).to_expr()",
"def get_... | [
"0.7333083",
"0.71942174",
"0.7127296",
"0.71029323",
"0.69317174",
"0.68536824",
"0.68213683",
"0.6779995",
"0.6748052",
"0.6704327",
"0.6672681",
"0.66487724",
"0.6632838",
"0.6632782",
"0.66326797",
"0.6626961",
"0.6621542",
"0.6605102",
"0.6605102",
"0.6605102",
"0.660510... | 0.7214166 | 1 |
Create a meshgrid representation of the grid | def meshup(self, ind='ij'):
xv, yv, zv = self.vec()
x_reg, y_reg, z_reg = np.meshgrid(xv, yv, zv, indexing=ind)
return x_reg, y_reg, z_reg | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_grid(self, nx, ny):\n nx_vec = np.arange(nx)\n ny_vec = np.arange(ny)\n yv, xv = np.meshgrid(ny_vec, nx_vec)\n grid = np.stack((yv, xv), axis=2)\n grid = grid.reshape(1, 1, ny, nx, 2)\n return grid",
"def _create_meshgrid(self):\n x = np.linspace(self.lim... | [
"0.80851996",
"0.79244447",
"0.76786584",
"0.76786584",
"0.7657271",
"0.7527732",
"0.74811447",
"0.7475076",
"0.7420758",
"0.74013096",
"0.74013096",
"0.736971",
"0.7350516",
"0.7346512",
"0.73272777",
"0.7322336",
"0.7318078",
"0.7318078",
"0.7318078",
"0.7318078",
"0.723785... | 0.6328292 | 76 |
Create a 2D meshgrid representation of the grid | def meshup2d(self, ind='ij'):
xv, yv, _ = self.vec()
x_reg, y_reg = np.meshgrid(xv, yv, indexing=ind)
return x_reg, y_reg | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_grid(self, nx, ny):\n nx_vec = np.arange(nx)\n ny_vec = np.arange(ny)\n yv, xv = np.meshgrid(ny_vec, nx_vec)\n grid = np.stack((yv, xv), axis=2)\n grid = grid.reshape(1, 1, ny, nx, 2)\n return grid",
"def _create_meshgrid(self):\n x = np.linspace(self.lim... | [
"0.8363773",
"0.79592085",
"0.77074903",
"0.77074903",
"0.76912636",
"0.76912636",
"0.7661321",
"0.76565844",
"0.7617566",
"0.7603872",
"0.76033956",
"0.76033956",
"0.76033956",
"0.76033956",
"0.7569078",
"0.75537515",
"0.7510543",
"0.7491267",
"0.74287635",
"0.74131",
"0.739... | 0.6514651 | 55 |
Get x,y coordinates in a tuple | def cart_coords2d(self):
mgx, mgy = self.meshup2d()
coords = np.column_stack((mgx.flatten(), mgy.flatten()))
return coords | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def coordinates(self) -> Tuple[int, int]:\n return self.x, self.y",
"def xy(self) -> Tuple[float, float]:\n return (self.x, self.y)",
"def xy(self) -> Tuple[int, int]:\n return self._x, self._y",
"def get(self):\n return (self.x,self.y);",
"def coordinates(self) -> Tuple[float, ... | [
"0.8051869",
"0.80070484",
"0.7868651",
"0.7785271",
"0.77273345",
"0.75921357",
"0.7576082",
"0.75237995",
"0.75237995",
"0.74783134",
"0.7463815",
"0.7435307",
"0.74250096",
"0.73297495",
"0.73278373",
"0.73105294",
"0.7269016",
"0.72689795",
"0.7261552",
"0.724623",
"0.721... | 0.0 | -1 |
Return the elapsed time taken to complete the trial. | def duration(self):
# type: () -> Optional[timedelta]
if self.datetime_start and self.datetime_complete:
return self.datetime_complete - self.datetime_start
else:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_time_taken_sec(self) -> float:\n return self.time_stop - self.time_start",
"def elapsed():\n global start_time\n return time.time() - start_time",
"def elapsed(self):\n return datetime.datetime.now() - self.start",
"def elapsed_time(self) -> float:\n current_time = ... | [
"0.76456666",
"0.752926",
"0.74266106",
"0.7425949",
"0.7407271",
"0.73942703",
"0.7316452",
"0.7281836",
"0.7265075",
"0.72546345",
"0.7215146",
"0.72078353",
"0.7193335",
"0.71842283",
"0.71714514",
"0.7166046",
"0.714372",
"0.7141995",
"0.71389806",
"0.7117587",
"0.7096246... | 0.0 | -1 |
Add a vertex to the graph. | def add_vertex(self, vertex_id):
self.vertices[vertex_id] = set() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_vertex(self, vertex):\n raise NotImplementedError",
"def add_vertex(self, vertex):\n if isinstance(vertex, Vertex):\n self.vertices.append(vertex)\n return\n raise TypeError('Is not vertex instance!')",
"def add_vertex(self, vertex_name: n):\n new_verte... | [
"0.87015903",
"0.84329987",
"0.8422056",
"0.840923",
"0.83646226",
"0.8317027",
"0.825337",
"0.808519",
"0.8081489",
"0.8038682",
"0.8035422",
"0.78834563",
"0.78711975",
"0.7838118",
"0.7838118",
"0.77608305",
"0.7757061",
"0.77158874",
"0.7711681",
"0.76663774",
"0.76616603... | 0.7310487 | 35 |
Get all neighbors (edges) of a vertex. | def get_neighbors(self, vertex_id):
if vertex_id in self.vertices:
return self.vertices[vertex_id]
else:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def neighbors_in(self, vertex):\n return list(self.neighbor_in_iterator(vertex))",
"def neighbors_out(self, vertex):\n return list(self.neighbor_out_iterator(vertex))",
"def get_neighbours(self, vertex):\n output = []\n \n if vertex in self.adjacency_list:\n for ne... | [
"0.8147006",
"0.78279907",
"0.7812863",
"0.7635039",
"0.76201296",
"0.7560235",
"0.7391392",
"0.7360321",
"0.7331741",
"0.7293987",
"0.7293987",
"0.7293987",
"0.7293987",
"0.7293987",
"0.7293987",
"0.7280387",
"0.7163595",
"0.7129881",
"0.7085101",
"0.7077671",
"0.7035337",
... | 0.64617395 | 52 |
Routes add_user_to_team request to ApplicationFacade of another user (to_manager) | def add_user_to_team(self, for_user, to_manager):
for_user = User.get_user_by_username(for_user)
manager = User.get_user_by_username(to_manager)
# @Todo test inheritance of get_user_by_username
self.access_handler.check_add_user_to_team(for_user, manager)
manager.add_user_to_team... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def team_user_add(token_user, team_id, user_id):\n team = Team.query.get(team_id)\n if team is None:\n abort(404, 'team not found')\n\n # check for permissions to update the team\n if not (token_user.has_permission('team.update.elevated') or\n (token_user.has_permission('team.update')... | [
"0.6874511",
"0.677191",
"0.6640521",
"0.6562554",
"0.6454202",
"0.62877584",
"0.61561483",
"0.6138414",
"0.6021417",
"0.6015747",
"0.5984722",
"0.59716547",
"0.59436655",
"0.5843997",
"0.5733098",
"0.5713306",
"0.5691408",
"0.569047",
"0.56469405",
"0.550362",
"0.5469829",
... | 0.7722358 | 0 |
Bottleneck block for ResNet. If style is "pytorch", the stridetwo layer is the 3x3 conv layer, if it is "caffe", the stridetwo layer is the first 1x1 conv layer. | def __init__(self,
inplanes,
planes,
stride=1,
dilation=1,
downsample=None,
style='pytorch',
with_cp=False,
conv_cfg=None,
norm_cfg=dict(type='BN')):
super(Bot... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bottleneck(self,\n inputs,\n depth,\n depth_bottleneck,\n stride,\n rate=1,\n outputs_collections=None,\n scope=None):\n with variable_scope.variable_scope(scope, 'bottleneck_v1', [inputs]) as sc:... | [
"0.7055745",
"0.6868894",
"0.6774563",
"0.6602584",
"0.64642286",
"0.6374515",
"0.62850827",
"0.62419933",
"0.61871433",
"0.6150485",
"0.6127702",
"0.6127702",
"0.60869473",
"0.60658646",
"0.6005607",
"0.5982693",
"0.59697086",
"0.5961271",
"0.5958031",
"0.5958031",
"0.595707... | 0.6639166 | 3 |
Initialize the weights in backbone. | def init_weights(self, pretrained=None):
if isinstance(pretrained, str):
logger = get_root_logger()
load_checkpoint(self, pretrained, strict=False, logger=logger)
elif pretrained is None:
for m in self.modules():
if isinstance(m, nn.Conv2d):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_weights(self):\n # Initialize weights\n self.apply(self._init_weights)",
"def _initialize_weights(self):\n pass",
"def init_weights(self):\n # Initialize weights\n self.apply(self._init_weights)\n # Tie weights if needed\n self.tie_weights()",
"def in... | [
"0.83809745",
"0.83567804",
"0.8318618",
"0.80969334",
"0.79236996",
"0.79064524",
"0.78415686",
"0.76821744",
"0.76756763",
"0.7579746",
"0.7504763",
"0.75038546",
"0.75038546",
"0.75038546",
"0.74933714",
"0.7491974",
"0.7485691",
"0.7437889",
"0.74249136",
"0.7403326",
"0.... | 0.0 | -1 |
Computes the total number of holidays between the start and end dates | def compute_holidays(start, end):
# The list of holidays and their given dates every year
holiday_dates = {
"new year holiday:": (1, 1),
"labor day holiday:": (5, 1),
"all saints day holiday:": (11, 1),
"christmas holiday:": (12, 25)
}
# Initialize the count of occurrenc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_workdays(start, end):\n # Subtracts the total number of holidays from the total number of weekdays\n return compute_weekdays(start, end) - compute_holidays(start, end)[\"total holidays:\"]",
"def compute_days(start: date, end: date) -> int:\n delta = end - start\n return delta.days + 1",
... | [
"0.7925853",
"0.72534883",
"0.71697754",
"0.71389604",
"0.7121654",
"0.6976317",
"0.6880273",
"0.68517286",
"0.67994386",
"0.66162187",
"0.6600932",
"0.6599427",
"0.65229666",
"0.64709324",
"0.6416626",
"0.64138246",
"0.6283126",
"0.62713355",
"0.6221902",
"0.617465",
"0.6167... | 0.81252795 | 0 |
Control whether mosek should wait for an available license if no license is available. putlicensewait(self,licwait_) | def putlicensewait(self,licwait_): # 3
res = self.__obj.putlicensewait(licwait_)
if res != 0:
raise Error(rescode(res),"") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def putlicensewait(self,licwait_):\n res = __library__.MSK_XX_putlicensewait(self.__nativep,licwait_)\n if res != 0:\n raise Error(rescode(res),Env.getcodedesc(rescode(res))[1])",
"def accept_license():\r\n msg, status = \"\", True\r\n\r\n try:\r\n sleep(5)\r\n if g.platform == 'an... | [
"0.8430193",
"0.6124477",
"0.6124088",
"0.5969026",
"0.59399414",
"0.585453",
"0.58310574",
"0.5819503",
"0.5743812",
"0.57230073",
"0.5673114",
"0.5649755",
"0.56356895",
"0.5599235",
"0.5545542",
"0.5537507",
"0.55170566",
"0.5481851",
"0.54529166",
"0.54420036",
"0.5417914... | 0.86069447 | 0 |
Computes the inner product of two vectors. dot(self,n_,x,y) | def dot(self,n_,x,y): # 3
if x is None: raise TypeError("Invalid type for argument x")
if x is None:
x_ = None
else:
try:
x_ = memoryview(x)
except TypeError:
try:
_tmparr_x = array.array("d",x)
except TypeError:
raise TypeE... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vec_dot(x, y):\r\n return sum(a * b for a, b in zip(x, y))",
"def vector_dot(x, y):\n\n if(len(x) != len(y)):\n raise ValueError(\"vector lengths differ\")\n else:\n # return x1*y1+x2*y2+...xn*yn\n return sum([x[i] * y[i] for i in range(len(x))])",
"def dot(x,y):\n\treturn sum([... | [
"0.78908086",
"0.7703501",
"0.75874764",
"0.7541884",
"0.75255686",
"0.7520059",
"0.74970186",
"0.7487115",
"0.74395573",
"0.74240917",
"0.73870796",
"0.7380625",
"0.73609656",
"0.73484606",
"0.73424864",
"0.72776973",
"0.7258741",
"0.72530854",
"0.7223078",
"0.7221579",
"0.7... | 0.72610885 | 16 |
Performs a rankk update of a symmetric matrix. syrk(self,uplo_,trans_,n_,k_,alpha_,a,beta_,c) | def syrk(self,uplo_,trans_,n_,k_,alpha_,a,beta_,c): # 3
if not isinstance(uplo_,uplo): raise TypeError("Argument uplo has wrong type")
if not isinstance(trans_,transpose): raise TypeError("Argument trans has wrong type")
if a is None: raise TypeError("Invalid type for argument a")
if a is None:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def syrk(self,uplo_,trans_,n_,k_,alpha_,a_,beta_,c_):\n _a_minlength = ((n_) * (k_))\n if ((n_) * (k_)) > 0 and a_ is not None and len(a_) != ((n_) * (k_)):\n raise ValueError(\"Array argument a is not long enough: Is %d, expected %d\" % (len(a_),((n_) * (k_))))\n if a_ is None:\n raise ValueErr... | [
"0.67712295",
"0.5318383",
"0.52853566",
"0.5274425",
"0.5195702",
"0.5142933",
"0.51365656",
"0.50324565",
"0.502728",
"0.502728",
"0.50243443",
"0.5021619",
"0.495693",
"0.49485558",
"0.48802036",
"0.4866401",
"0.48614314",
"0.4860556",
"0.4807733",
"0.48001644",
"0.4781496... | 0.7794454 | 0 |
Changes the bounds for one constraint. chgconbound(self,i_,lower_,finite_,value_) | def chgconbound(self,i_,lower_,finite_,value_): # 3
res = self.__obj.chgconbound(i_,lower_,finite_,value_)
if res != 0:
result,msg = self.__getlasterror(res)
raise Error(rescode(res),msg) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def chgconbound(self,i_,lower_,finite_,value_):\n res = __library__.MSK_XX_chgconbound(self.__nativep,i_,lower_,finite_,value_)\n if res != 0:\n _,msg = self.__getlasterror(res)\n raise Error(rescode(res),msg)",
"def chgbound(self,accmode_,i_,lower_,finite_,value_): # 3\n if not isinstance(a... | [
"0.87962055",
"0.7915556",
"0.7374655",
"0.7193188",
"0.6016495",
"0.6003055",
"0.5817122",
"0.5724581",
"0.57071257",
"0.5674716",
"0.56427246",
"0.56145924",
"0.5549266",
"0.55412686",
"0.5538162",
"0.55004245",
"0.5479595",
"0.5465985",
"0.54559875",
"0.5438169",
"0.543770... | 0.9179632 | 0 |
Obtains all objective coefficients. getc(self,c) | def getc(self,c): # 3
_copyback_c = False
if c is None:
c_ = None
else:
try:
c_ = memoryview(c)
except TypeError:
try:
_tmparr_c = array.array("d",c)
except TypeError:
raise TypeError("Argument c has wrong type")
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def coefficients(self) :\n return self.__coefficients",
"def coefficients(self) :\n raise NotImplementedError",
"def coefficients(self):\n return self._coefficients",
"def coefficients(self):\n return self._coefficients",
"def coefficients(self):\r\n return self.coef_['x'... | [
"0.66709536",
"0.6564794",
"0.6501379",
"0.6501379",
"0.6479863",
"0.638523",
"0.638523",
"0.6315886",
"0.6307558",
"0.6105121",
"0.6091317",
"0.60873526",
"0.60698646",
"0.5979509",
"0.59356976",
"0.5863073",
"0.5787421",
"0.5751444",
"0.57505965",
"0.5711324",
"0.5706123",
... | 0.542105 | 34 |
Obtains the fixed term in the objective. getcfix(self) | def getcfix(self): # 3
res,resargs = self.__obj.getcfix()
if res != 0:
result,msg = self.__getlasterror(res)
raise Error(rescode(res),msg)
_cfix_return_value = resargs
return _cfix_return_value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getcfix(self):\n cfix_ = ctypes.c_double()\n res = __library__.MSK_XX_getcfix(self.__nativep,ctypes.byref(cfix_))\n if res != 0:\n _,msg = self.__getlasterror(res)\n raise Error(rescode(res),msg)\n cfix_ = cfix_.value\n _cfix_return_value = cfix_\n return (_cfix_return_value)",
"d... | [
"0.72392535",
"0.69383645",
"0.6180273",
"0.61721146",
"0.6119554",
"0.61034906",
"0.60181254",
"0.590948",
"0.58965456",
"0.5892888",
"0.5847018",
"0.58357286",
"0.57893103",
"0.57264996",
"0.57217616",
"0.5684293",
"0.5644139",
"0.56363136",
"0.56273365",
"0.56273365",
"0.5... | 0.71006364 | 1 |
Obtains the maximum number variables allowed. getmaxnumvar(self) | def getmaxnumvar(self): # 3
res,resargs = self.__obj.getmaxnumvar()
if res != 0:
result,msg = self.__getlasterror(res)
raise Error(rescode(res),msg)
_maxnumvar_return_value = resargs
return _maxnumvar_return_value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getmaxnumbarvar(self): # 3\n res,resargs = self.__obj.getmaxnumbarvar()\n if res != 0:\n result,msg = self.__getlasterror(res)\n raise Error(rescode(res),msg)\n _maxnumbarvar_return_value = resargs\n return _maxnumbarvar_return_value",
"def getmaxnumvar(self):\n maxnumvar... | [
"0.8638552",
"0.8318876",
"0.7975339",
"0.75058955",
"0.7293481",
"0.71520394",
"0.71520394",
"0.7027731",
"0.6982515",
"0.69716805",
"0.69318897",
"0.6927233",
"0.6925119",
"0.6925119",
"0.6882538",
"0.68813956",
"0.68506175",
"0.68492895",
"0.6819296",
"0.67849064",
"0.6708... | 0.9134594 | 0 |
Obtains the name of a semidefinite variable. getbarvarname(self,i_) | def getbarvarname(self,i_): # 3
sizename_ = (1 + self.getbarvarnamelen((i_)))
arr_name = array.array("b",[0]*((sizename_)))
memview_arr_name = memoryview(arr_name)
res,resargs = self.__obj.getbarvarname(i_,sizename_,memview_arr_name)
if res != 0:
result,msg = self.__getlasterror(re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getbarvarname(self,i_):\n sizename_ = (1 + self.getbarvarnamelen((i_)))\n name_ = (ctypes.c_char * (sizename_))()\n res = __library__.MSK_XX_getbarvarname(self.__nativep,i_,sizename_,name_)\n if res != 0:\n _,msg = self.__getlasterror(res)\n raise Error(rescode(res),msg)\n _name_retval... | [
"0.83124495",
"0.70636773",
"0.7021346",
"0.6814069",
"0.6768735",
"0.6749503",
"0.6696013",
"0.6655233",
"0.6600145",
"0.65645903",
"0.65538573",
"0.65234154",
"0.634015",
"0.61727566",
"0.6150951",
"0.6128864",
"0.597935",
"0.5966808",
"0.5926254",
"0.5901665",
"0.5890842",... | 0.83518904 | 0 |
Sets the name of a constraint. putconname(self,i_,name_) | def putconname(self,i_,name_): # 3
res = self.__obj.putconname(i_,name_)
if res != 0:
result,msg = self.__getlasterror(res)
raise Error(rescode(res),msg) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def putconname(self,i_,name_):\n if isinstance(name_,unicode):\n name_ = name_.encode(\"utf-8\",errors=\"replace\")\n res = __library__.MSK_XX_putconname(self.__nativep,i_,name_)\n if res != 0:\n _,msg = self.__getlasterror(res)\n raise Error(rescode(res),msg)",
"def putconename(self,j_,n... | [
"0.7829545",
"0.7109529",
"0.66708755",
"0.66558343",
"0.65581566",
"0.6500634",
"0.64994293",
"0.6485172",
"0.6476038",
"0.6476038",
"0.64725053",
"0.64725053",
"0.64725053",
"0.64725053",
"0.64725053",
"0.64380765",
"0.64380765",
"0.6426416",
"0.6426416",
"0.6426416",
"0.64... | 0.8193527 | 0 |
Sets the name of a variable. putvarname(self,j_,name_) | def putvarname(self,j_,name_): # 3
res = self.__obj.putvarname(j_,name_)
if res != 0:
result,msg = self.__getlasterror(res)
raise Error(rescode(res),msg) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def putvarname(self,j_,name_):\n if isinstance(name_,unicode):\n name_ = name_.encode(\"utf-8\",errors=\"replace\")\n res = __library__.MSK_XX_putvarname(self.__nativep,j_,name_)\n if res != 0:\n _,msg = self.__getlasterror(res)\n raise Error(rescode(res),msg)",
"def putbarvarname(self,j_... | [
"0.84260845",
"0.7847339",
"0.75843376",
"0.7371363",
"0.6805376",
"0.6749658",
"0.67184365",
"0.6677941",
"0.6664005",
"0.6604637",
"0.6604637",
"0.65338516",
"0.65015674",
"0.65015674",
"0.64961225",
"0.6457167",
"0.6457167",
"0.6421323",
"0.64125746",
"0.6411722",
"0.63882... | 0.8884831 | 0 |
Sets the name of a cone. putconename(self,j_,name_) | def putconename(self,j_,name_): # 3
res = self.__obj.putconename(j_,name_)
if res != 0:
result,msg = self.__getlasterror(res)
raise Error(rescode(res),msg) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def putconename(self,j_,name_):\n if isinstance(name_,unicode):\n name_ = name_.encode(\"utf-8\",errors=\"replace\")\n res = __library__.MSK_XX_putconename(self.__nativep,j_,name_)\n if res != 0:\n _,msg = self.__getlasterror(res)\n raise Error(rescode(res),msg)",
"def putconname(self,i_,... | [
"0.7865969",
"0.77436495",
"0.7510013",
"0.6582177",
"0.6530854",
"0.6465643",
"0.64578557",
"0.64150274",
"0.63634545",
"0.63573754",
"0.63573754",
"0.6346879",
"0.6346033",
"0.6333818",
"0.6333818",
"0.6333818",
"0.6333818",
"0.6326524",
"0.6326524",
"0.6326524",
"0.6326524... | 0.8515966 | 0 |
Sets the name of a semidefinite variable. putbarvarname(self,j_,name_) | def putbarvarname(self,j_,name_): # 3
res = self.__obj.putbarvarname(j_,name_)
if res != 0:
result,msg = self.__getlasterror(res)
raise Error(rescode(res),msg) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def putbarvarname(self,j_,name_):\n if isinstance(name_,unicode):\n name_ = name_.encode(\"utf-8\",errors=\"replace\")\n res = __library__.MSK_XX_putbarvarname(self.__nativep,j_,name_)\n if res != 0:\n _,msg = self.__getlasterror(res)\n raise Error(rescode(res),msg)",
"def putvarname(self... | [
"0.83027333",
"0.7868955",
"0.7379362",
"0.63194853",
"0.6231179",
"0.61827314",
"0.6176594",
"0.607982",
"0.607798",
"0.60263175",
"0.5947799",
"0.59326524",
"0.5837751",
"0.5830235",
"0.5815705",
"0.574492",
"0.57225835",
"0.57101053",
"0.570889",
"0.570889",
"0.56842077",
... | 0.8724992 | 0 |
Obtains the number of cones. getnumcone(self) | def getnumcone(self): # 3
res,resargs = self.__obj.getnumcone()
if res != 0:
result,msg = self.__getlasterror(res)
raise Error(rescode(res),msg)
_numcone_return_value = resargs
return _numcone_return_value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def num_cones(self):\n return self._shape_count(_sff.cone)",
"def getnumcone(self):\n numcone_ = ctypes.c_int32()\n res = __library__.MSK_XX_getnumcone(self.__nativep,ctypes.byref(numcone_))\n if res != 0:\n _,msg = self.__getlasterror(res)\n raise Error(rescode(res),msg)\n numcone_ ... | [
"0.81962085",
"0.8135336",
"0.75427234",
"0.74378294",
"0.69177985",
"0.67452365",
"0.67098516",
"0.6589998",
"0.65676737",
"0.6466872",
"0.64434046",
"0.6414762",
"0.63785934",
"0.6378523",
"0.63385296",
"0.6297581",
"0.62972945",
"0.6237324",
"0.6213397",
"0.6148255",
"0.61... | 0.9106109 | 0 |
Obtains the number of members in a cone. getnumconemem(self,k_) | def getnumconemem(self,k_): # 3
res,resargs = self.__obj.getnumconemem(k_)
if res != 0:
result,msg = self.__getlasterror(res)
raise Error(rescode(res),msg)
_nummem_return_value = resargs
return _nummem_return_value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getnumconemem(self,k_):\n nummem_ = ctypes.c_int32()\n res = __library__.MSK_XX_getnumconemem(self.__nativep,k_,ctypes.byref(nummem_))\n if res != 0:\n _,msg = self.__getlasterror(res)\n raise Error(rescode(res),msg)\n nummem_ = nummem_.value\n _nummem_return_value = nummem_\n retur... | [
"0.7930638",
"0.6547216",
"0.6333205",
"0.6301713",
"0.62568665",
"0.60509694",
"0.6046145",
"0.60436803",
"0.6009492",
"0.60091627",
"0.5991287",
"0.59608996",
"0.5905592",
"0.58840805",
"0.58747464",
"0.5874404",
"0.58710396",
"0.58700097",
"0.58524823",
"0.58503115",
"0.58... | 0.87194437 | 0 |
Obtains maximum number of symmetric matrix variables for which space is currently preallocated. getmaxnumbarvar(self) | def getmaxnumbarvar(self): # 3
res,resargs = self.__obj.getmaxnumbarvar()
if res != 0:
result,msg = self.__getlasterror(res)
raise Error(rescode(res),msg)
_maxnumbarvar_return_value = resargs
return _maxnumbarvar_return_value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getmaxnumbarvar(self):\n maxnumbarvar_ = ctypes.c_int32()\n res = __library__.MSK_XX_getmaxnumbarvar(self.__nativep,ctypes.byref(maxnumbarvar_))\n if res != 0:\n _,msg = self.__getlasterror(res)\n raise Error(rescode(res),msg)\n maxnumbarvar_ = maxnumbarvar_.value\n _maxnumbarvar_retur... | [
"0.7974102",
"0.7626193",
"0.7177821",
"0.71738005",
"0.6899728",
"0.6754429",
"0.6753096",
"0.660486",
"0.6596178",
"0.65558964",
"0.64927113",
"0.64927113",
"0.6441858",
"0.63781196",
"0.63643104",
"0.63464445",
"0.63263625",
"0.6322328",
"0.62782854",
"0.62308466",
"0.6208... | 0.83529484 | 0 |
Obtains the problem type. getprobtype(self) | def getprobtype(self): # 3
res,resargs = self.__obj.getprobtype()
if res != 0:
result,msg = self.__getlasterror(res)
raise Error(rescode(res),msg)
_probtype_return_value = resargs
_probtype_return_value = problemtype(_probtype_return_value)
return _probtype_return_value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_prob_type(self):\n return self.prob_type",
"def get_prob_type(self):\n return self.prob_type",
"def get_prob_type(self):\n return self.prob_type",
"def get_prob_type(self):\n return self.prob_type",
"def get_prob_type(self):\n return self.prob_type",
"def getpro... | [
"0.85797167",
"0.85797167",
"0.85797167",
"0.85797167",
"0.85797167",
"0.81917536",
"0.75342023",
"0.64539766",
"0.6302305",
"0.6269259",
"0.6167121",
"0.6167121",
"0.6167121",
"0.6167121",
"0.6167121",
"0.6167121",
"0.6167121",
"0.6167121",
"0.6167121",
"0.6167121",
"0.61671... | 0.9006907 | 0 |
Obtains the status keys for the scalar variables. getskx(self,whichsol_,skx) | def getskx(self,whichsol_,skx): # 3
if not isinstance(whichsol_,soltype): raise TypeError("Argument whichsol has wrong type")
_copyback_skx = False
if skx is None:
skx_ = None
else:
try:
skx_ = memoryview(skx)
except TypeError:
try:
_tmparr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getskx(self,whichsol_,skx_):\n _skx_minlength = self.getnumvar()\n if self.getnumvar() > 0 and skx_ is not None and len(skx_) != self.getnumvar():\n raise ValueError(\"Array argument skx is not long enough: Is %d, expected %d\" % (len(skx_),self.getnumvar()))\n if isinstance(skx_,numpy.ndarray) a... | [
"0.7796877",
"0.63049835",
"0.6158791",
"0.6117627",
"0.6097506",
"0.6061638",
"0.6033665",
"0.60118854",
"0.5955878",
"0.58595866",
"0.58246785",
"0.5812363",
"0.57521355",
"0.5600206",
"0.53672403",
"0.5349376",
"0.53143424",
"0.51968336",
"0.5149174",
"0.51379985",
"0.5118... | 0.77266645 | 1 |
Obtains the y vector for a solution. gety(self,whichsol_,y) | def gety(self,whichsol_,y): # 3
if not isinstance(whichsol_,soltype): raise TypeError("Argument whichsol has wrong type")
if y is None: raise TypeError("Invalid type for argument y")
_copyback_y = False
if y is None:
y_ = None
else:
try:
y_ = memoryview(y)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gety(self,whichsol_,y_):\n _y_minlength = self.getnumcon()\n if self.getnumcon() > 0 and y_ is not None and len(y_) != self.getnumcon():\n raise ValueError(\"Array argument y is not long enough: Is %d, expected %d\" % (len(y_),self.getnumcon()))\n if isinstance(y_,numpy.ndarray) and not y_.flags.... | [
"0.8300887",
"0.7558555",
"0.7407283",
"0.7368878",
"0.71877843",
"0.71633005",
"0.7134357",
"0.7132734",
"0.705018",
"0.7029874",
"0.7029874",
"0.7029874",
"0.7029874",
"0.7029874",
"0.7029874",
"0.7029874",
"0.7029874",
"0.7029874",
"0.7029874",
"0.70239764",
"0.69673294",
... | 0.8433062 | 0 |
Obtains a slice of the slc vector for a solution. getslcslice(self,whichsol_,first_,last_,slc) | def getslcslice(self,whichsol_,first_,last_,slc): # 3
if not isinstance(whichsol_,soltype): raise TypeError("Argument whichsol has wrong type")
_copyback_slc = False
if slc is None:
slc_ = None
else:
try:
slc_ = memoryview(slc)
except TypeError:
try:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getslcslice(self,whichsol_,first_,last_,slc_):\n _slc_minlength = ((last_) - (first_))\n if ((last_) - (first_)) > 0 and slc_ is not None and len(slc_) != ((last_) - (first_)):\n raise ValueError(\"Array argument slc is not long enough: Is %d, expected %d\" % (len(slc_),((last_) - (first_))))\n i... | [
"0.8885943",
"0.7903121",
"0.77781576",
"0.776827",
"0.7719666",
"0.7706315",
"0.7673623",
"0.7601376",
"0.75609344",
"0.70728725",
"0.690385",
"0.6900801",
"0.68715274",
"0.6797456",
"0.6727579",
"0.6720451",
"0.67186975",
"0.6667074",
"0.6662807",
"0.65105104",
"0.6496517",... | 0.8940289 | 0 |
Sets the y vector for a solution. puty(self,whichsol_,y) | def puty(self,whichsol_,y): # 3
if not isinstance(whichsol_,soltype): raise TypeError("Argument whichsol has wrong type")
if y is None: raise TypeError("Invalid type for argument y")
if y is None:
y_ = None
else:
try:
y_ = memoryview(y)
except TypeError:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def puty(self,whichsol_,y_):\n _y_minlength = self.getnumcon()\n if self.getnumcon() > 0 and y_ is not None and len(y_) != self.getnumcon():\n raise ValueError(\"Array argument y is not long enough: Is %d, expected %d\" % (len(y_),self.getnumcon()))\n if y_ is None:\n raise ValueError(\"Argument... | [
"0.7980786",
"0.7467331",
"0.7414117",
"0.7341319",
"0.73385406",
"0.72822994",
"0.72759205",
"0.72759205",
"0.72216535",
"0.716188",
"0.7105489",
"0.7105489",
"0.704032",
"0.7025292",
"0.69937927",
"0.69311845",
"0.6928499",
"0.681751",
"0.67185503",
"0.67038804",
"0.6585851... | 0.798927 | 0 |
Sets the slc vector for a solution. putslc(self,whichsol_,slc) | def putslc(self,whichsol_,slc): # 3
if not isinstance(whichsol_,soltype): raise TypeError("Argument whichsol has wrong type")
if slc is None: raise TypeError("Invalid type for argument slc")
if slc is None:
slc_ = None
else:
try:
slc_ = memoryview(slc)
except Ty... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def putslc(self,whichsol_,slc_):\n _slc_minlength = self.getnumcon()\n if self.getnumcon() > 0 and slc_ is not None and len(slc_) != self.getnumcon():\n raise ValueError(\"Array argument slc is not long enough: Is %d, expected %d\" % (len(slc_),self.getnumcon()))\n if slc_ is None:\n raise Value... | [
"0.80939215",
"0.7127283",
"0.6981142",
"0.6874318",
"0.68628615",
"0.64437",
"0.6415943",
"0.6327982",
"0.62976587",
"0.61485314",
"0.611149",
"0.587014",
"0.58528334",
"0.57478553",
"0.57347184",
"0.5725949",
"0.5603986",
"0.5560089",
"0.5529244",
"0.54716456",
"0.54550815"... | 0.8102084 | 0 |
Sets the slx vector for a solution. putslx(self,whichsol_,slx) | def putslx(self,whichsol_,slx): # 3
if not isinstance(whichsol_,soltype): raise TypeError("Argument whichsol has wrong type")
if slx is None: raise TypeError("Invalid type for argument slx")
if slx is None:
slx_ = None
else:
try:
slx_ = memoryview(slx)
except Ty... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def putslx(self,whichsol_,slx_):\n _slx_minlength = self.getnumvar()\n if self.getnumvar() > 0 and slx_ is not None and len(slx_) != self.getnumvar():\n raise ValueError(\"Array argument slx is not long enough: Is %d, expected %d\" % (len(slx_),self.getnumvar()))\n if slx_ is None:\n raise Value... | [
"0.8227534",
"0.75031966",
"0.7294913",
"0.70008105",
"0.69223344",
"0.6582627",
"0.64496696",
"0.63729155",
"0.6279643",
"0.6060753",
"0.6051383",
"0.5939722",
"0.5937078",
"0.5874649",
"0.58557886",
"0.5814396",
"0.57694393",
"0.5743312",
"0.5736985",
"0.571725",
"0.5714966... | 0.8406566 | 0 |
Sets the snx vector for a solution. putsnx(self,whichsol_,sux) | def putsnx(self,whichsol_,sux): # 3
if not isinstance(whichsol_,soltype): raise TypeError("Argument whichsol has wrong type")
if sux is None: raise TypeError("Invalid type for argument sux")
if sux is None:
sux_ = None
else:
try:
sux_ = memoryview(sux)
except Ty... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def putsnx(self,whichsol_,sux_):\n _sux_minlength = self.getnumvar()\n if self.getnumvar() > 0 and sux_ is not None and len(sux_) != self.getnumvar():\n raise ValueError(\"Array argument sux is not long enough: Is %d, expected %d\" % (len(sux_),self.getnumvar()))\n if sux_ is None:\n raise Value... | [
"0.79652536",
"0.6977705",
"0.69029534",
"0.6840297",
"0.6730063",
"0.6700717",
"0.66731846",
"0.6651068",
"0.6616195",
"0.64797753",
"0.62790495",
"0.62466705",
"0.6051568",
"0.5944151",
"0.58988196",
"0.58134973",
"0.58022714",
"0.5754032",
"0.5619595",
"0.5616192",
"0.5582... | 0.80564487 | 0 |
Sets the status keys for a slice of the constraints. putskcslice(self,whichsol_,first_,last_,skc) | def putskcslice(self,whichsol_,first_,last_,skc): # 3
if not isinstance(whichsol_,soltype): raise TypeError("Argument whichsol has wrong type")
if skc is None:
skc_ = None
else:
try:
skc_ = memoryview(skc)
except TypeError:
try:
_tmparr_skc = arr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def putskcslice(self,whichsol_,first_,last_,skc_):\n _skc_minlength = ((last_) - (first_))\n if ((last_) - (first_)) > 0 and skc_ is not None and len(skc_) != ((last_) - (first_)):\n raise ValueError(\"Array argument skc is not long enough: Is %d, expected %d\" % (len(skc_),((last_) - (first_))))\n i... | [
"0.7878032",
"0.7324264",
"0.72055733",
"0.70434856",
"0.695358",
"0.6820521",
"0.6723412",
"0.6392203",
"0.6374772",
"0.63110477",
"0.6275647",
"0.6228513",
"0.6054086",
"0.5991555",
"0.59311754",
"0.58947575",
"0.58841753",
"0.58709055",
"0.5834223",
"0.5812345",
"0.5808716... | 0.77862066 | 1 |
Sets the status keys for a slice of the variables. putskxslice(self,whichsol_,first_,last_,skx) | def putskxslice(self,whichsol_,first_,last_,skx): # 3
if not isinstance(whichsol_,soltype): raise TypeError("Argument whichsol has wrong type")
if skx is None: raise TypeError("Invalid type for argument skx")
if skx is None:
skx_ = None
else:
try:
skx_ = memoryview(skx)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def putskxslice(self,whichsol_,first_,last_,skx_):\n _skx_minlength = ((last_) - (first_))\n if ((last_) - (first_)) > 0 and skx_ is not None and len(skx_) != ((last_) - (first_)):\n raise ValueError(\"Array argument skx is not long enough: Is %d, expected %d\" % (len(skx_),((last_) - (first_))))\n i... | [
"0.78635985",
"0.7424604",
"0.7405193",
"0.6910344",
"0.6705808",
"0.66730547",
"0.66334337",
"0.63971466",
"0.63536805",
"0.63480496",
"0.6341284",
"0.62940514",
"0.6269792",
"0.62681013",
"0.6214591",
"0.607708",
"0.60471714",
"0.5982883",
"0.58000416",
"0.5797448",
"0.5717... | 0.7742946 | 1 |
Sets a slice of the slc vector for a solution. putslcslice(self,whichsol_,first_,last_,slc) | def putslcslice(self,whichsol_,first_,last_,slc): # 3
if not isinstance(whichsol_,soltype): raise TypeError("Argument whichsol has wrong type")
if slc is None: raise TypeError("Invalid type for argument slc")
if slc is None:
slc_ = None
else:
try:
slc_ = memoryview(slc)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def putslcslice(self,whichsol_,first_,last_,slc_):\n _slc_minlength = ((last_) - (first_))\n if ((last_) - (first_)) > 0 and slc_ is not None and len(slc_) != ((last_) - (first_)):\n raise ValueError(\"Array argument slc is not long enough: Is %d, expected %d\" % (len(slc_),((last_) - (first_))))\n i... | [
"0.8665271",
"0.8028874",
"0.79689276",
"0.7586415",
"0.7571979",
"0.7481478",
"0.7443932",
"0.73685884",
"0.7250818",
"0.6873892",
"0.6865921",
"0.6845474",
"0.68408936",
"0.6835351",
"0.6811375",
"0.67149657",
"0.6622215",
"0.6455107",
"0.6454194",
"0.64446056",
"0.62881243... | 0.86664194 | 0 |
Sets a slice of the suc vector for a solution. putsucslice(self,whichsol_,first_,last_,suc) | def putsucslice(self,whichsol_,first_,last_,suc): # 3
if not isinstance(whichsol_,soltype): raise TypeError("Argument whichsol has wrong type")
if suc is None: raise TypeError("Invalid type for argument suc")
if suc is None:
suc_ = None
else:
try:
suc_ = memoryview(suc)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def putsucslice(self,whichsol_,first_,last_,suc_):\n _suc_minlength = ((last_) - (first_))\n if ((last_) - (first_)) > 0 and suc_ is not None and len(suc_) != ((last_) - (first_)):\n raise ValueError(\"Array argument suc is not long enough: Is %d, expected %d\" % (len(suc_),((last_) - (first_))))\n i... | [
"0.8458082",
"0.78352803",
"0.7823198",
"0.697396",
"0.66800994",
"0.66672105",
"0.6612828",
"0.65653783",
"0.65534025",
"0.6473596",
"0.6382252",
"0.63652766",
"0.63203996",
"0.6249303",
"0.6229676",
"0.6119368",
"0.6072003",
"0.601853",
"0.60000366",
"0.5946613",
"0.5850652... | 0.8440238 | 1 |
Sets a slice of the slx vector for a solution. putslxslice(self,whichsol_,first_,last_,slx) | def putslxslice(self,whichsol_,first_,last_,slx): # 3
if not isinstance(whichsol_,soltype): raise TypeError("Argument whichsol has wrong type")
if slx is None: raise TypeError("Invalid type for argument slx")
if slx is None:
slx_ = None
else:
try:
slx_ = memoryview(slx)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def putslxslice(self,whichsol_,first_,last_,slx_):\n _slx_minlength = ((last_) - (first_))\n if ((last_) - (first_)) > 0 and slx_ is not None and len(slx_) != ((last_) - (first_)):\n raise ValueError(\"Array argument slx is not long enough: Is %d, expected %d\" % (len(slx_),((last_) - (first_))))\n i... | [
"0.86987597",
"0.81707865",
"0.8090086",
"0.76664007",
"0.7569977",
"0.7491802",
"0.7421092",
"0.73564",
"0.7310712",
"0.72694886",
"0.7246696",
"0.71117413",
"0.7088779",
"0.7066789",
"0.7048525",
"0.70223415",
"0.69794166",
"0.69253093",
"0.69242007",
"0.64906347",
"0.64746... | 0.8702004 | 0 |
Sets a slice of the sux vector for a solution. putsuxslice(self,whichsol_,first_,last_,sux) | def putsuxslice(self,whichsol_,first_,last_,sux): # 3
if not isinstance(whichsol_,soltype): raise TypeError("Argument whichsol has wrong type")
if sux is None: raise TypeError("Invalid type for argument sux")
if sux is None:
sux_ = None
else:
try:
sux_ = memoryview(sux)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def putsuxslice(self,whichsol_,first_,last_,sux_):\n _sux_minlength = ((last_) - (first_))\n if ((last_) - (first_)) > 0 and sux_ is not None and len(sux_) != ((last_) - (first_)):\n raise ValueError(\"Array argument sux is not long enough: Is %d, expected %d\" % (len(sux_),((last_) - (first_))))\n i... | [
"0.83270234",
"0.8310678",
"0.8062453",
"0.68127537",
"0.66257215",
"0.6514107",
"0.640519",
"0.63978034",
"0.63856447",
"0.63657236",
"0.6364191",
"0.63023823",
"0.6279157",
"0.6227445",
"0.6151261",
"0.6146947",
"0.6129155",
"0.61140305",
"0.60963166",
"0.6054423",
"0.60241... | 0.8475651 | 0 |
Sets a slice of the snx vector for a solution. putsnxslice(self,whichsol_,first_,last_,snx) | def putsnxslice(self,whichsol_,first_,last_,snx): # 3
if not isinstance(whichsol_,soltype): raise TypeError("Argument whichsol has wrong type")
if snx is None: raise TypeError("Invalid type for argument snx")
if snx is None:
snx_ = None
else:
try:
snx_ = memoryview(snx)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def putsnxslice(self,whichsol_,first_,last_,snx_):\n _snx_minlength = ((last_) - (first_))\n if ((last_) - (first_)) > 0 and snx_ is not None and len(snx_) != ((last_) - (first_)):\n raise ValueError(\"Array argument snx is not long enough: Is %d, expected %d\" % (len(snx_),((last_) - (first_))))\n i... | [
"0.85828114",
"0.7945033",
"0.7808164",
"0.7766909",
"0.77377814",
"0.74767923",
"0.7460703",
"0.7104095",
"0.70643973",
"0.6853887",
"0.6741942",
"0.67371625",
"0.6673794",
"0.65873826",
"0.6565678",
"0.65549874",
"0.6534593",
"0.6502936",
"0.64653575",
"0.64384925",
"0.6320... | 0.8466408 | 1 |
Obtains the length the task name. gettasknamelen(self) | def gettasknamelen(self): # 3
res,resargs = self.__obj.gettasknamelen()
if res != 0:
result,msg = self.__getlasterror(res)
raise Error(rescode(res),msg)
_len_return_value = resargs
return _len_return_value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gettasknamelen(self):\n len_ = ctypes.c_int32()\n res = __library__.MSK_XX_gettasknamelen(self.__nativep,ctypes.byref(len_))\n if res != 0:\n _,msg = self.__getlasterror(res)\n raise Error(rescode(res),msg)\n len_ = len_.value\n _len_return_value = len_\n return (_len_return_value)"... | [
"0.8848174",
"0.7396339",
"0.7211169",
"0.66781706",
"0.6509832",
"0.638948",
"0.63247794",
"0.6289375",
"0.6192284",
"0.6141001",
"0.61032224",
"0.6098824",
"0.6098824",
"0.60865223",
"0.58865136",
"0.58703756",
"0.58387864",
"0.5816365",
"0.5760647",
"0.5759496",
"0.5754741... | 0.8965042 | 0 |
Obtains the task name. gettaskname(self) | def gettaskname(self): # 3
sizetaskname_ = (1 + self.gettasknamelen())
arr_taskname = array.array("b",[0]*((sizetaskname_)))
memview_arr_taskname = memoryview(arr_taskname)
res,resargs = self.__obj.gettaskname(sizetaskname_,memview_arr_taskname)
if res != 0:
result,msg = self.__get... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getTaskName(self):\n return self._taskName",
"def task_name(self) -> str:\n return self._task_name",
"def task_name(self):\n pass",
"def task(self) -> str:\n return self._task",
"def get_current_task_name(self):\r\n task_available = False\r\n while not task_ava... | [
"0.9225649",
"0.92226565",
"0.890475",
"0.80714345",
"0.77892965",
"0.7712749",
"0.76918936",
"0.76918936",
"0.76128006",
"0.760115",
"0.7543221",
"0.7498984",
"0.7413234",
"0.736176",
"0.7214945",
"0.71906304",
"0.71588486",
"0.712833",
"0.7097375",
"0.70958984",
"0.705449",... | 0.78340673 | 4 |
Get the positions of the nonzero elements in barc. getbarcsparsity(self,idxj) | def getbarcsparsity(self,idxj): # 3
maxnumnz_ = self.getnumbarcnz()
if idxj is None: raise TypeError("Invalid type for argument idxj")
_copyback_idxj = False
if idxj is None:
idxj_ = None
else:
try:
idxj_ = memoryview(idxj)
except TypeError:
try:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getbarcsparsity(self,idxj_):\n maxnumnz_ = self.getnumbarcnz()\n numnz_ = ctypes.c_int64()\n _idxj_minlength = (maxnumnz_)\n if (maxnumnz_) > 0 and idxj_ is not None and len(idxj_) != (maxnumnz_):\n raise ValueError(\"Array argument idxj is not long enough: Is %d, expected %d\" % (len(idxj_),(... | [
"0.7880039",
"0.7069366",
"0.69609344",
"0.69448763",
"0.68547386",
"0.6244682",
"0.624142",
"0.5826277",
"0.5707228",
"0.56314456",
"0.558511",
"0.55000687",
"0.54627365",
"0.53390604",
"0.53189814",
"0.529206",
"0.51894635",
"0.5175475",
"0.51474226",
"0.5140838",
"0.513782... | 0.7875644 | 1 |
Sets the objective sense. putobjsense(self,sense_) | def putobjsense(self,sense_): # 3
if not isinstance(sense_,objsense): raise TypeError("Argument sense has wrong type")
res = self.__obj.putobjsense(sense_)
if res != 0:
result,msg = self.__getlasterror(res)
raise Error(rescode(res),msg) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def putobjsense(self,sense_):\n res = __library__.MSK_XX_putobjsense(self.__nativep,sense_)\n if res != 0:\n _,msg = self.__getlasterror(res)\n raise Error(rescode(res),msg)",
"def objective(self, objective):\n\n self._objective = objective",
"def optimize(self, objective_sense=None, **k... | [
"0.7520607",
"0.52856076",
"0.51713824",
"0.50965065",
"0.50691324",
"0.48808637",
"0.48373786",
"0.4836329",
"0.4834191",
"0.4817863",
"0.47958386",
"0.47829077",
"0.47675174",
"0.47340724",
"0.4723223",
"0.46988454",
"0.46940908",
"0.46940097",
"0.46933573",
"0.46758312",
"... | 0.79466873 | 0 |
Changes one element in barc. putbarcj(self,j_,sub,weights) | def putbarcj(self,j_,sub,weights): # 3
num_ = None
if num_ is None:
num_ = len(sub)
elif num_ != len(sub):
raise IndexError("Inconsistent length of array sub")
if num_ is None:
num_ = len(weights)
elif num_ != len(weights):
raise IndexError("Inconsistent len... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def putbarcj(self,j_,sub_,weights_):\n num_ = None\n if num_ is None:\n num_ = len(sub_)\n elif num_ != len(sub_):\n raise IndexError(\"Inconsistent length of array sub\")\n if num_ is None:\n num_ = len(weights_)\n elif num_ != len(weights_):\n raise IndexError(\"Inconsistent le... | [
"0.76669323",
"0.7315079",
"0.71391314",
"0.6202151",
"0.60657674",
"0.5813972",
"0.5804683",
"0.5798792",
"0.5771986",
"0.5744488",
"0.5671224",
"0.5516903",
"0.55073386",
"0.5496936",
"0.5472952",
"0.53638756",
"0.5278725",
"0.5263576",
"0.5227484",
"0.5184158",
"0.51833236... | 0.80895865 | 0 |
Sets the number of preallocated conic constraints in the optimization task. putmaxnumcone(self,maxnumcone_) | def putmaxnumcone(self,maxnumcone_): # 3
res = self.__obj.putmaxnumcone(maxnumcone_)
if res != 0:
result,msg = self.__getlasterror(res)
raise Error(rescode(res),msg) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def putmaxnumcone(self,maxnumcone_):\n res = __library__.MSK_XX_putmaxnumcone(self.__nativep,maxnumcone_)\n if res != 0:\n _,msg = self.__getlasterror(res)\n raise Error(rescode(res),msg)",
"def putmaxnumcon(self,maxnumcon_): # 3\n res = self.__obj.putmaxnumcon(maxnumcon_)\n if res != 0... | [
"0.76631105",
"0.6873881",
"0.6576481",
"0.6515341",
"0.6249171",
"0.5743204",
"0.57229555",
"0.566485",
"0.56632674",
"0.56456995",
"0.55652726",
"0.55497414",
"0.5527375",
"0.54716325",
"0.54450977",
"0.543764",
"0.5433045",
"0.53766745",
"0.53474724",
"0.53441435",
"0.5334... | 0.78598285 | 0 |
Sets the number of preallocated symmetric matrix variables. putmaxnumbarvar(self,maxnumbarvar_) | def putmaxnumbarvar(self,maxnumbarvar_): # 3
res = self.__obj.putmaxnumbarvar(maxnumbarvar_)
if res != 0:
result,msg = self.__getlasterror(res)
raise Error(rescode(res),msg) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def putmaxnumbarvar(self,maxnumbarvar_):\n res = __library__.MSK_XX_putmaxnumbarvar(self.__nativep,maxnumbarvar_)\n if res != 0:\n _,msg = self.__getlasterror(res)\n raise Error(rescode(res),msg)",
"def putmaxnumvar(self,maxnumvar_): # 3\n res = self.__obj.putmaxnumvar(maxnumvar_)\n if ... | [
"0.78251684",
"0.6959753",
"0.6795598",
"0.65727705",
"0.6438065",
"0.6048308",
"0.5996996",
"0.5852882",
"0.5841968",
"0.5822205",
"0.5682764",
"0.5667983",
"0.5649398",
"0.5640302",
"0.5615086",
"0.56006753",
"0.55580956",
"0.5552524",
"0.5495012",
"0.54564613",
"0.5411751"... | 0.7951648 | 0 |
Replaces one coefficient in the quadratic term in the objective. putqobjij(self,i_,j_,qoij_) | def putqobjij(self,i_,j_,qoij_): # 3
res = self.__obj.putqobjij(i_,j_,qoij_)
if res != 0:
result,msg = self.__getlasterror(res)
raise Error(rescode(res),msg) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def putqobjij(self,i_,j_,qoij_):\n res = __library__.MSK_XX_putqobjij(self.__nativep,i_,j_,qoij_)\n if res != 0:\n _,msg = self.__getlasterror(res)\n raise Error(rescode(res),msg)",
"def getqobjij(self,i_,j_): # 3\n res,resargs = self.__obj.getqobjij(i_,j_)\n if res != 0:\n resul... | [
"0.78803056",
"0.67813957",
"0.659472",
"0.62387276",
"0.6219436",
"0.61874425",
"0.6092477",
"0.6030711",
"0.6007447",
"0.58423615",
"0.58029187",
"0.5546479",
"0.5543163",
"0.54854363",
"0.54592514",
"0.54140776",
"0.5403207",
"0.54002947",
"0.537518",
"0.5340782",
"0.53344... | 0.8022443 | 0 |
Return {password} hashed with a random salt. | def _hashPassword(password):
charset = './' + ascii_letters + digits
return crypt.crypt(password, ''.join(random.sample(charset, 2))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_password(plain_password, salt):\n return crypt(plain_password, \"$6$%s\" % salt)",
"def get_salt():\n return os.urandom(32)",
"def hash_password(self, password):\n salt = hashlib.sha256(os.urandom(60)).hexdigest().encode('ascii')\n pwdhash = hashlib.pbkdf2_hmac('sha256', passwo... | [
"0.785195",
"0.7485919",
"0.7229884",
"0.7139252",
"0.7042943",
"0.70410484",
"0.70328486",
"0.69745654",
"0.6972978",
"0.6963016",
"0.69494325",
"0.6923372",
"0.6914759",
"0.6914759",
"0.69035566",
"0.69032335",
"0.6849369",
"0.6846902",
"0.68391377",
"0.6820383",
"0.6793918... | 0.72318745 | 2 |
Returns whether the Enum contains the given value | def contains(cls, value):
return value in cls.values() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contains(self, value):\n return value in self.values",
"def containsValue(self, value):\n for val in values():\n if val == value or val == value:\n return True\n return False",
"def is_enum_value(enumeration, potential_value):\n try:\n enumeration(po... | [
"0.77123004",
"0.72656065",
"0.70571256",
"0.7028384",
"0.7001019",
"0.6976045",
"0.6976045",
"0.6915918",
"0.6735124",
"0.67162323",
"0.66731423",
"0.66354334",
"0.66343904",
"0.6532867",
"0.6506448",
"0.64733434",
"0.6471284",
"0.63954747",
"0.63917613",
"0.6385912",
"0.632... | 0.76120925 | 1 |
For a given list of sentences, convert all sentences to a list of words. Optional is if we want to replace all names and digits with special joker characters so that they don't have a different meaning. We return a list of list of words where each word is in lower case. | def convert_sentences_to_list_of_words(sentences, names_set, keep_names = False):
start_time = time.time()
print("SentencesCount={}, Message=\"Starting to convert sentences to lists of words\"".format(len(sentences)))
sentences_to_words = list()
for sentence in sentences:
words = token_to_wor... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_word_list(self, sentences):\n\n ############ 1.4 TODO\n \"\"\"\n https://machinelearningmastery.com/clean-text-machine-learning-python/\n \"\"\"\n import string\n table = str.maketrans('','',string.punctuation)\n # import ipdb; ipdb.set_trace()\n ... | [
"0.7843854",
"0.7488675",
"0.7488675",
"0.74834925",
"0.7450238",
"0.72817487",
"0.7251751",
"0.7230152",
"0.7098521",
"0.70853525",
"0.70543855",
"0.7040246",
"0.69851166",
"0.6936858",
"0.69340396",
"0.6912219",
"0.68851644",
"0.6876494",
"0.6874023",
"0.6847757",
"0.682465... | 0.6810224 | 29 |
From a given string (text), extract sentences by using a Regex and return a list of sentences. A sentence is defined as a continuous flow of words between 2 punctuation signs. Logically, this is not a correct definition of a sentence. It was done like this because in a lot of cases where punctuation signs are present, ... | def token_to_sentence(text):
regex_of_sentence = re.findall(TEXT_TO_SENTENCES_REGEX, text)
text_sentences = [x.strip() for x in regex_of_sentence if x is not '']
return text_sentences | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_sentences(text):\n # sentence_delimiters = re.compile(r'(?<!\\w\\.\\w.)(?<![A-Z][a-z]\\.)(?<=\\.|\\?)\\s')\n # sentences = sentence_delimiters.split(text)\n sentences = nltk.sent_tokenize(text)\n return sentences",
"def sentences(text, remove_puncts=True):\n if remove_puncts:\n ss... | [
"0.79939556",
"0.7925823",
"0.79061824",
"0.787048",
"0.78565335",
"0.7849685",
"0.78382206",
"0.7568798",
"0.7548214",
"0.7383739",
"0.7365318",
"0.73031485",
"0.72995585",
"0.72606564",
"0.7183229",
"0.71747917",
"0.71676517",
"0.71676517",
"0.71335554",
"0.6990329",
"0.692... | 0.73375064 | 11 |
From a given sentence, extract a list of words using a regex and returns the list | def token_to_words(sentence):
regex_of_word = re.findall(SENTENCE_TO_WORDS_REGEX, sentence)
words = [x.lower() for x in regex_of_word if x is not '']
return words | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_word_list(text):\n return re.findall('\\w+', text)",
"def process_sentence(sentence: str) -> list:\r\n return [process_word(word) for word in sentence.split()][:-1]",
"def GetWords(phrase):\n # Remove special characters regex\n # It works faster than the standard \\w+ pattern\n regex = ... | [
"0.73824656",
"0.73613733",
"0.73354656",
"0.7329176",
"0.7300523",
"0.7278349",
"0.72088933",
"0.71624345",
"0.70499563",
"0.7004783",
"0.6892251",
"0.68916184",
"0.68813795",
"0.6872783",
"0.6861082",
"0.6854046",
"0.68317294",
"0.68259835",
"0.6718483",
"0.6714542",
"0.670... | 0.7182423 | 7 |
Get the absolute path relative from the users home directory. | def user(path = None):
if path:
return "%s/%s" % (expanduser("~"), path)
else:
return expanduser("~") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def absolute_path(path):\n path = re.sub('~', os.environ['HOME'], str(path))\n if path[0] != '/':\n path = str(sh.pwd()).strip() + '/' + path\n return path",
"def relativeToAbsoluteHomePath(path):\n if \"~\" in path:\n return path.replace(\"~\",expanduser(\"~\"))\n else:\n ret... | [
"0.79745674",
"0.7967853",
"0.78495085",
"0.7806317",
"0.780348",
"0.77588886",
"0.77579105",
"0.7545472",
"0.7545435",
"0.74873245",
"0.7457176",
"0.7137103",
"0.7137103",
"0.7135744",
"0.71298516",
"0.7122463",
"0.7048174",
"0.704382",
"0.7042589",
"0.6985595",
"0.6984571",... | 0.71705526 | 11 |
Computes the DCG for a given ranking. | def dcg(self, ranking):
return sum([(2**r-1)/math.log(i+2,2) for i,r in enumerate(ranking)]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dcg(relevances, rank=10):\n relevances = np.asarray(relevances)[:rank]\n n_relevances = len(relevances)\n if n_relevances == 0:\n return 0.\n\n discounts = np.log2(np.arange(n_relevances) + 2)\n return np.sum(relevances / discounts)",
"def dcg(self, ranking_relevances):\n return ... | [
"0.71015334",
"0.70199543",
"0.68278605",
"0.6297935",
"0.6167642",
"0.6159737",
"0.6100069",
"0.60535264",
"0.60535264",
"0.60441524",
"0.5942948",
"0.59037614",
"0.58951026",
"0.5890461",
"0.5877349",
"0.58557963",
"0.58392525",
"0.5831029",
"0.58152866",
"0.57738566",
"0.5... | 0.80949104 | 0 |
Get the full path to the project directory. The sitename is os.path.basename() fo the path. | def _GetDjangoProjectDir(self):
manage_file, settings_file = self._FindKeyFiles()
if manage_file is None:
return None
else:
return os.path.dirname(manage_file) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_project_path():\n file_path = os.path.abspath(__file__)\n root_dir = os.path.join(os.path.dirname(file_path), \"..\")\n return os.path.abspath(root_dir)",
"def get_project_dir():\n\n return Path(settings.PROJECT_DIR)",
"def _get_project_dir(self):\n return os.path.expanduser(\n ... | [
"0.76835746",
"0.7609278",
"0.7565632",
"0.7564937",
"0.75076115",
"0.75076115",
"0.7460581",
"0.7403331",
"0.7370139",
"0.7338093",
"0.7278179",
"0.7269134",
"0.72575593",
"0.71984255",
"0.7181923",
"0.7166557",
"0.71590376",
"0.7155332",
"0.7155332",
"0.7155332",
"0.7155332... | 0.6642871 | 55 |
Get a list of the app directories in the current project. Returns a list of the full path to the app directory. The app name is os.path.basename() of each path. | def _GetDjangoAppDirs(self):
manage_file, settings_file = self._FindKeyFiles()
if manage_file is None:
return None
dirname = os.path.dirname(manage_file)
files = os.listdir(dirname)
appnames = []
for fn in files:
dn = os.path.join(dirname, fn)
if os.path.isdir(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_local_app_list():\n\t\tapp_list = [\n\t\t\t{\n\t\t\t\t'name': app,\n\t\t\t\t'dir': os.path.dirname(os.path.abspath(import_module(app).__file__)),\n\t\t\t}\n\t\t\tfor app in settings.INSTALLED_APPS\n\t\t]\n\t\treturn [app for app in app_list if settings.BASE_DIR in app['dir']]",
"def get_app_paths(self):\... | [
"0.77939665",
"0.73979264",
"0.72740537",
"0.70311385",
"0.68899965",
"0.6566972",
"0.65643966",
"0.6475137",
"0.646991",
"0.6422327",
"0.63913584",
"0.63813317",
"0.6374119",
"0.6369508",
"0.62916684",
"0.6290896",
"0.627292",
"0.6270338",
"0.6235929",
"0.6227795",
"0.619181... | 0.77305305 | 1 |
Performs (inputs + shift) % vocab_size in the onehot space. | def one_hot_add(inputs, shift):
inputs = torch.stack((inputs, torch.zeros_like(inputs)), dim = -1)
shift = torch.stack((shift, torch.zeros_like(shift)), dim = -1)
inputs_fft = torch.fft(inputs, 1) #ignore last and first dimension to do batched fft
shift_fft = torch.fft(shift, 1)
result_fft_real = in... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def onehot(inputs, num_classes):\n num_sample = inputs.size(0)\n inputs_onehot = torch.zeros(num_sample, num_classes)\n inputs_onehot.scatter_(1, inputs.unsqueeze(1), 1.0)\n return inputs_onehot",
"def one_hot(list_of_index, vocab_size=None, pad=False, max_len=None):\n if vocab_size is None:\n... | [
"0.6625687",
"0.6522718",
"0.64381754",
"0.6421956",
"0.6420222",
"0.6403999",
"0.62599635",
"0.62588215",
"0.6248834",
"0.62333953",
"0.6146165",
"0.61171454",
"0.6112145",
"0.60882616",
"0.6079414",
"0.6055295",
"0.6053049",
"0.6050454",
"0.60179824",
"0.6004405",
"0.600012... | 0.63782936 | 6 |
Performs (inputs + shift) % vocab_size in the onehot space. | def one_hot_add_tf(inputs, shift):
# Compute circular 1-D convolution with shift as the kernel.
inputs = tf.cast(inputs, tf.complex64)
shift = tf.cast(shift, tf.complex64)
inputs_fft = tf.signal.fft(inputs)
shift_fft = tf.signal.fft(shift)
result_fft = inputs_fft * shift_fft
return tf.math.real(tf.signal.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def onehot(inputs, num_classes):\n num_sample = inputs.size(0)\n inputs_onehot = torch.zeros(num_sample, num_classes)\n inputs_onehot.scatter_(1, inputs.unsqueeze(1), 1.0)\n return inputs_onehot",
"def one_hot(list_of_index, vocab_size=None, pad=False, max_len=None):\n if vocab_size is None:\n... | [
"0.6628839",
"0.6523513",
"0.64391387",
"0.6423872",
"0.64209574",
"0.64065593",
"0.6380521",
"0.6262665",
"0.62580264",
"0.6250413",
"0.62356365",
"0.6147972",
"0.6119448",
"0.6090384",
"0.6080483",
"0.60556436",
"0.605519",
"0.605154",
"0.60198885",
"0.600641",
"0.60033774"... | 0.61148727 | 13 |
Return the user's home directory. | def get_home_dir(self, username):
return self.user_table[username]['home'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_user_homedir():\n return os.path.expanduser(\"~\")",
"def get_home_dir(self) -> str:\n ret = os.path.expanduser(\"~\")\n if not os.path.exists(ret):\n raise RuntimeError(\"The home directory does not exist.\")\n return ret",
"def get_home_directory():\n \n try:\... | [
"0.893307",
"0.88721424",
"0.88705593",
"0.886407",
"0.8731782",
"0.85772765",
"0.85295665",
"0.85295665",
"0.8465337",
"0.8290572",
"0.82589376",
"0.820919",
"0.81753886",
"0.8058806",
"0.79158306",
"0.7841633",
"0.7787422",
"0.7623524",
"0.74783534",
"0.72487456",
"0.724365... | 0.83210564 | 9 |
Whether the user has read permissions for obj (an absolute pathname of a file or a directory) | def r_perm(self, username, obj=None):
return 'r' in self.user_table[username]['perm'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_perms(resource):\r\n stmode = os.stat(resource).st_mode\r\n return (getattr(stat, 'S_IROTH') & stmode) > 0",
"def check_perms(resource):\r\n stmode = os.stat(resource).st_mode\r\n return (getattr(stat, 'S_IROTH') & stmode) > 0",
"def isAccessible(self,path):\n if isdir(path):\n ... | [
"0.7149955",
"0.7149955",
"0.70938736",
"0.6990295",
"0.69801116",
"0.69389063",
"0.69380355",
"0.69380355",
"0.68666345",
"0.6863203",
"0.6834633",
"0.67876285",
"0.6740451",
"0.673493",
"0.673483",
"0.6718482",
"0.67093164",
"0.66729295",
"0.6671589",
"0.6646158",
"0.664228... | 0.65625834 | 26 |
Close the dispatcher socket. | def close(self):
self.cmd_channel.debug("PassiveDTP.close()")
asyncore.dispatcher.close(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close(self):\n self.context['socket'].close()",
"def close(self):\n self.socket.close()",
"def close(self):\n self.socket.close()",
"def close(self):\n self.socket.close()",
"def close(self):\n self.socket.close()",
"def close(self):\n self.socket.close()",
"de... | [
"0.7848705",
"0.7726064",
"0.7726064",
"0.7726064",
"0.7726064",
"0.7726064",
"0.7726064",
"0.7700651",
"0.7669155",
"0.76530904",
"0.7632863",
"0.7632863",
"0.76012707",
"0.75902194",
"0.7560573",
"0.7434389",
"0.7321297",
"0.7294117",
"0.7286715",
"0.72644",
"0.7214975",
... | 0.0 | -1 |
Close the dispatcher socket. | def close(self):
self.cmd_channel.debug("ActiveDTP.close()")
asyncore.dispatcher.close(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close(self):\n self.context['socket'].close()",
"def close(self):\n self.socket.close()",
"def close(self):\n self.socket.close()",
"def close(self):\n self.socket.close()",
"def close(self):\n self.socket.close()",
"def close(self):\n self.socket.close()",
"de... | [
"0.7848705",
"0.7726064",
"0.7726064",
"0.7726064",
"0.7726064",
"0.7726064",
"0.7726064",
"0.7700651",
"0.7669155",
"0.76530904",
"0.7632863",
"0.7632863",
"0.76012707",
"0.75902194",
"0.7560573",
"0.7434389",
"0.7321297",
"0.7294117",
"0.7286715",
"0.72644",
"0.7214975",
... | 0.0 | -1 |
Initialize the DTPHandler instance, replacing asynchat's "simple producer" deque wrapper with a pure deque object. | def __init__(self, sock_obj, cmd_channel):
asyncore.dispatcher.__init__(self, sock_obj)
# we toss the use of the asynchat's "simple producer" and
# replace it with a pure deque, which the original fifo
# was a wrapping of
self.producer_fifo = deque()
self.cmd_channel = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\r\n self.deque = deque()",
"def __init__(self):\n self.queue = deque()",
"def __init__(self):\n self.queue = deque()",
"def __init__(self):\n self.queue = deque()",
"def __init__(self):\n self.queue = deque()",
"def __init__(self):\n self.q = ... | [
"0.6298625",
"0.6257873",
"0.6257873",
"0.6257873",
"0.6257873",
"0.6106297",
"0.6059178",
"0.6051605",
"0.6043369",
"0.60149276",
"0.6001413",
"0.5958562",
"0.5939856",
"0.5935468",
"0.5929445",
"0.5925022",
"0.58833015",
"0.58527035",
"0.5844222",
"0.58023155",
"0.57953054"... | 0.64715147 | 0 |
Check whether the path belongs to user's home directory. Expected argument is a "real" filesystem path. If path is a symbolic link it is resolved to check its real destination. Pathnames escaping from user's root directory are considered not valid. | def validpath(self, path):
root = self.realpath(self.root)
path = self.realpath(path)
if not self.root.endswith(os.sep):
root = self.root + os.sep
if not path.endswith(os.sep):
path = path + os.sep
if path[0:len(root)] == root:
return True
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __validate_home_dir(self, home, login, system, force):\n\n\t\tif system:\n\t\t\tif home:\n\t\t\t\tif os.path.exists(home) and not force:\n\t\t\t\t\traise exceptions.BadArgumentError(_(u'Specified directory '\n\t\t\t\t\t\t'{0} for system user {1} already exists. If you '\n\t\t\t\t\t\t'really want to use it, ple... | [
"0.71177983",
"0.7048908",
"0.7040957",
"0.6963441",
"0.6747281",
"0.66532487",
"0.6618474",
"0.66068685",
"0.65856624",
"0.65571314",
"0.6536434",
"0.6516736",
"0.6498955",
"0.64894295",
"0.6459149",
"0.6441646",
"0.64196706",
"0.6412966",
"0.637745",
"0.6343931",
"0.6334745... | 0.57718456 | 48 |
Reinitialize user's current session. | def ftp_REIN(self, line):
# From RFC-959:
# REIN command terminates a USER, flushing all I/O and account
# information, except to allow any transfer in progress to be
# completed. All parameters are reset to the default settings
# and the control connection is left open. This i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def relogin(self):\n spotify.Error.maybe_raise(lib.sp_session_relogin(self._sp_session))",
"def reset_flask_session_on_login():\n session.clear()\n session.permanent = True",
"def reset():\n if app.config['SESSION_KEY'] in session:\n session.pop(app.config['SESSION_KEY'])\n return red... | [
"0.73114216",
"0.70115596",
"0.65970606",
"0.6527118",
"0.64791566",
"0.64384454",
"0.63787323",
"0.628014",
"0.6276127",
"0.62758726",
"0.62699926",
"0.62674457",
"0.62058717",
"0.6175197",
"0.6162526",
"0.6159558",
"0.6126029",
"0.604522",
"0.6030053",
"0.59277743",
"0.5923... | 0.0 | -1 |
Check if the user in the user.json file. | def user_loader(self, email):
if not self.um.check_file_exists("users.json"):
return
if email not in self.users:
return
user = User()
user.id = email
return user | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_if_registered():\n\n with open(json_file, 'r') as file_to_read:\n data = json.load(file_to_read)\n\n return data['username'] == '' or data['password'] == ''",
"def has_user(self, user): # pylint: disable=unused-argument\r\n return False",
"def check():\n enteredUsername = ... | [
"0.7748234",
"0.7304994",
"0.70522434",
"0.7008959",
"0.69846535",
"0.6952139",
"0.67624503",
"0.6762297",
"0.6752197",
"0.67460907",
"0.670604",
"0.66726625",
"0.66645384",
"0.6638253",
"0.6597192",
"0.6584211",
"0.6571729",
"0.6549531",
"0.6547135",
"0.6542674",
"0.6509126"... | 0.0 | -1 |
Return the number of rows. | def n_rows(self) -> int:
return len(self.plaincolumns[0].values) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getNumRows(self) -> int:\n ...",
"def num_rows(self):\n return (len(self.rows))",
"def row_count(self) -> int:\n return len(self.rows)",
"def row_count(self) -> int:\n return len(self.rows)",
"def num_rows(self):\n return len(self.rows)",
"def get_num_rows(self):\n ... | [
"0.9221344",
"0.8939995",
"0.8883343",
"0.8883343",
"0.8881884",
"0.88316065",
"0.8796254",
"0.87434655",
"0.8638738",
"0.8571888",
"0.8547149",
"0.85056275",
"0.8504988",
"0.8499684",
"0.84940827",
"0.8438511",
"0.8185211",
"0.81843865",
"0.81450695",
"0.81191826",
"0.811221... | 0.8278957 | 16 |
Returns the number columns. | def n_cols(self):
return len(self.plaincolumns) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_num_cols(self):\n return self._num_cols",
"def ncolumns(self):\n return self.__ncols",
"def GetNumberCols(self):\n return len(self.__colsKey)",
"def getNumCols(self):\n return self.__cols",
"def num_cols(self):\n return len(self.column_names())",
"def GetNumColu... | [
"0.8479093",
"0.8321676",
"0.83161926",
"0.81688076",
"0.81617033",
"0.81603026",
"0.81361294",
"0.81158787",
"0.8098255",
"0.8052948",
"0.8027492",
"0.8011963",
"0.7991961",
"0.7988968",
"0.7957302",
"0.7940329",
"0.78685737",
"0.7859736",
"0.7843928",
"0.78203475",
"0.77553... | 0.80597484 | 9 |
Converts test data table into a pandas dataframe. | def to_pandas(self) -> pd.DataFrame:
data = {column.name: column.to_pandas()
for column in self.plaincolumns}
return pd.DataFrame(data, columns=self.columns) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_to_df(data):\r\n ans = pd.DataFrame(data)\r\n return ans",
"def table_to_data_frame(table):\n nr = table.rowCount()\n nc = table.columnCount()\n\n if nr == 0:\n return None\n\n idx_labels = []\n for i in range(nr):\n item = table.verticalHeaderItem(i)\n if it... | [
"0.7470056",
"0.7357014",
"0.72778505",
"0.7176993",
"0.7033917",
"0.7017266",
"0.67617035",
"0.65868384",
"0.6532865",
"0.65319735",
"0.6518283",
"0.651351",
"0.64821416",
"0.64706",
"0.64474356",
"0.6439888",
"0.6410859",
"0.6402957",
"0.6367853",
"0.6367853",
"0.63493586",... | 0.6197717 | 33 |
Converts test data table into a pandas dataframe. | def to_pyspark(self):
from pyspark.sql import types
converted = [column.to_pyspark() for column in
self.plaincolumns]
fields, values = zip(*converted)
data = list(zip(*values))
schema = types.StructType(fields)
from pyspark.sql import SparkSession... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_to_df(data):\r\n ans = pd.DataFrame(data)\r\n return ans",
"def table_to_data_frame(table):\n nr = table.rowCount()\n nc = table.columnCount()\n\n if nr == 0:\n return None\n\n idx_labels = []\n for i in range(nr):\n item = table.verticalHeaderItem(i)\n if it... | [
"0.7470056",
"0.7357014",
"0.72778505",
"0.7176993",
"0.7033917",
"0.7017266",
"0.67617035",
"0.65868384",
"0.6532865",
"0.65319735",
"0.6518283",
"0.651351",
"0.64821416",
"0.64706",
"0.64474356",
"0.6439888",
"0.6410859",
"0.6402957",
"0.6367853",
"0.6367853",
"0.63493586",... | 0.0 | -1 |
Check plaincolumns in regard to validity constraints. Raises ValueError in case of invalidity. | def _validate_plaincolumns(self):
# assert tuples for plaincolumns and plaincolumns to be PlainColumn
if not isinstance(self.plaincolumns, tuple):
raise ValueError("PlainFrame was instantiated incorrectly. "
"`plaincolumns` needs to be of type `tuple`. "
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _validate_from_plain(data: Sequence[Sequence],\n columns: Sequence[str],\n dtypes: Sequence[str],\n row_wise: bool):\n\n if row_wise:\n # assert equal number of elements across rows\n row_lenghts = ... | [
"0.6761087",
"0.6729761",
"0.6513836",
"0.6438157",
"0.6385335",
"0.63654524",
"0.6263734",
"0.62583905",
"0.6255833",
"0.6212334",
"0.6211183",
"0.62062204",
"0.6201675",
"0.61666995",
"0.61343145",
"0.6121989",
"0.6118989",
"0.61071795",
"0.6073725",
"0.60706",
"0.6070016",... | 0.80588007 | 0 |
Instantiate `PlainFrame` from ordered dict. Assumes keys to be column names with type annotations and values to be values. | def from_dict(cls, data: 'collections.OrderedDict[str, Sequence]') \
-> 'PlainFrame':
typed_columns, values = zip(*data.items())
columns, dtypes = cls._parse_typed_columns(typed_columns)
return cls.from_plain(data=values, columns=columns, dtypes=dtypes,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def df_from_dict(dict, cols):\n vals = []\n for k, v in dict.items():\n vals.append([k, v])\n\n df = pd.DataFrame(vals, columns=cols)\n\n return df",
"def create_dataframe(self, dictionary_to_convert, cols):\n\n dataframe_converted = pd.DataFrame.from_dict(dictionary_to_convert, orient='ind... | [
"0.63685435",
"0.62464345",
"0.6095923",
"0.60642916",
"0.6041559",
"0.5951722",
"0.5781031",
"0.57471037",
"0.57081604",
"0.56951296",
"0.56654984",
"0.56471837",
"0.56197417",
"0.5537039",
"0.54596746",
"0.54495865",
"0.54340917",
"0.5428056",
"0.54244924",
"0.5409822",
"0.... | 0.82753557 | 0 |
Converts PlainFrame into dictionary with key as typed columns and values as data. Returns | def to_dict(self) -> 'collections.OrderedDict[str, tuple]':
columns = [(column.typed_column, column.values)
for column in self.plaincolumns]
return collections.OrderedDict(columns) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pandas_typecast(self) -> dict:\n res = {}\n for feat in self.data_features:\n res[feat.key] = ApiForm.typecast(feat.dtype)\n return res",
"def as_dict(self):\r\n values = {}\r\n for name, col in self._columns.items():\r\n values[name] = col.to_database... | [
"0.6954712",
"0.62818605",
"0.62708193",
"0.6214804",
"0.61942667",
"0.61277246",
"0.601162",
"0.59994304",
"0.5976457",
"0.5975498",
"0.5973699",
"0.5925594",
"0.5913598",
"0.590992",
"0.590216",
"0.58729947",
"0.5852472",
"0.5852472",
"0.5852472",
"0.5852472",
"0.58184606",... | 0.6149699 | 5 |
Inspect all columns of dtype object and ensure no mixed dtypes are present. Raises type error otherwise. Ignores columns for which dtypes are already explicitly set. | def get_object_dtypes(self, dtypes_validated: TYPE_DSTR) -> TYPE_DSTR:
dtypes_object = {}
for column in self.df.columns:
if column in dtypes_validated:
continue
if pd_types.is_object_dtype(self.df[column]):
dtypes_object[column] = self.inspect_d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def correct_type(data):\n\n if all(data[col].dtypes == data.dtypes[0] for col in data.columns):\n if all(data[col].isnull().sum() == 0 for col in data.columns):\n print('All columns have values of the correct type.')\n else:\n print('Bad result.')",
"def data_all_types(df):\n \n... | [
"0.70867485",
"0.68489903",
"0.67461854",
"0.6728249",
"0.64754266",
"0.645636",
"0.63884103",
"0.6336763",
"0.6271342",
"0.61969036",
"0.6189384",
"0.61450166",
"0.6108982",
"0.6063777",
"0.60391325",
"0.60314035",
"0.60085917",
"0.597513",
"0.5947335",
"0.5945935",
"0.59280... | 0.61040664 | 13 |
Get all dtypes for columns which have not been provided, yet. Assumes that columns of dtype object are not present. Raises type error otherwise. | def get_inferred_dtypes(self, dtypes_validated: TYPE_DSTR) -> TYPE_DSTR:
dtypes_inferred = {}
for column in self.df.columns:
if column in dtypes_validated:
continue
dtypes_inferred[column] = self.inspect_dtype(self.df[column])
return dtypes_inferred | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data_all_types(df):\n \n printmd (\"**Type of every column in the data**\")\n print(\"\")\n print(df.dtypes)",
"def dtypes(self) -> List[str]:\n\n return [column.dtype for column in self.plaincolumns]",
"def get_forced_dtypes(self, dtypes: TYPE_DTYPE_INPUT) -> TYPE_DSTR:\n\n if is... | [
"0.65239817",
"0.6408806",
"0.61233187",
"0.6065816",
"0.604482",
"0.5963158",
"0.59571636",
"0.593806",
"0.5936834",
"0.58090985",
"0.57966083",
"0.57694626",
"0.5765626",
"0.57220525",
"0.5674758",
"0.56686723",
"0.56302917",
"0.5604693",
"0.5604485",
"0.5604228",
"0.557179... | 0.6124964 | 2 |
Inspect series of dtype object and ensure no mixed dtypes are present. Try to infer actual dtype after removing np.NaN distinguishing dtypes bool and str. | def inspect_dtype_object(self, column: str) -> str:
series = self.df[column].dropna()
# check for bool
try:
conv = pd.to_numeric(series)
return self.inspect_dtype(conv)
except ValueError:
pass
# check for mixed dtypes
dtypes = {type(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inspect_dtype(series: pd.Series) -> str:\n\n mapping = {pd_types.is_bool_dtype: \"bool\",\n pd_types.is_integer_dtype: \"int\",\n pd_types.is_float_dtype: \"float\",\n pd_types.is_datetime64_any_dtype: \"datetime\"}\n\n for check, result in ma... | [
"0.70855945",
"0.7065239",
"0.6979094",
"0.67403305",
"0.6491286",
"0.6475484",
"0.6446953",
"0.64218414",
"0.64200073",
"0.6314996",
"0.6283848",
"0.62426305",
"0.62084246",
"0.6199139",
"0.6194982",
"0.61911464",
"0.61762136",
"0.6094981",
"0.60808",
"0.60113406",
"0.597092... | 0.6623532 | 4 |
Get appropriate dtype of pandas series. Checks against bool, int, float and datetime. If dtype object is encountered, raises type error. | def inspect_dtype(series: pd.Series) -> str:
mapping = {pd_types.is_bool_dtype: "bool",
pd_types.is_integer_dtype: "int",
pd_types.is_float_dtype: "float",
pd_types.is_datetime64_any_dtype: "datetime"}
for check, result in mapping.items():
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def force_dtype(series: pd.Series, dtype: str) -> TYPE_ROW:\n\n conv_funcs = {\"bool\": bool,\n \"int\": int,\n \"float\": float,\n \"str\": str,\n \"datetime\": lambda x: pd.to_datetime(x).to_pydatetime()}\n\n conv_f... | [
"0.71820045",
"0.7095558",
"0.7025059",
"0.67244714",
"0.65434676",
"0.6396191",
"0.63210595",
"0.6268763",
"0.6195392",
"0.6174257",
"0.6168124",
"0.6152117",
"0.6139253",
"0.61209184",
"0.6077286",
"0.6074643",
"0.60624564",
"0.5972227",
"0.59623206",
"0.59545696",
"0.58716... | 0.786083 | 0 |
Since pandas 0.24.0 exists `arrays.IntegerArray` which could be used as an nullable interger dtype. However, this is still experimental (0.25.3) and hence is not used yet. | def _convert_int(self) -> pd.Series:
if self.requires_nan:
dtype = "float"
else:
dtype = "int"
return self._convert(dtype=dtype) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adapt_numpy_int64(numpy_int64):\n return AsIs(numpy_int64)",
"def _get_int_int_array_attr(\n values: Optional[Union[ArrayAttr, Sequence[Union[ArrayAttr,\n IntOrAttrList]]]]\n) -> ArrayAttr:\n if values is None:\n return ArrayAttr.get([])\n if isi... | [
"0.6449275",
"0.62429845",
"0.62327516",
"0.60950404",
"0.59707195",
"0.59292316",
"0.5907126",
"0.59008235",
"0.58847946",
"0.5843335",
"0.57713395",
"0.5722363",
"0.5695228",
"0.56517184",
"0.56418616",
"0.5628159",
"0.5601276",
"0.55606514",
"0.5557012",
"0.5460305",
"0.54... | 0.55060124 | 19 |
Pandas timestamp values have to be created via `pd.to_datetime` and can't be casted via `astype`. | def _convert_datetime(self) -> pd.Series:
series = pd.to_datetime(self.sanitized)
series.name = self.parent.name
return series | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _convert_timestamp(self, df: DataFrame, timestamp_column: str = \"ts\") -> DataFrame:\n return df.withColumn(timestamp_column, (col(timestamp_column) / 1000).cast(TimestampType()))",
"def _convert(frame):\n frame = frame.convert_objects(convert_numeric=True)\n for column in frame:\n if co... | [
"0.71113366",
"0.6984713",
"0.69662225",
"0.6962683",
"0.68888426",
"0.6767642",
"0.6694901",
"0.66372114",
"0.6523099",
"0.6374327",
"0.63732517",
"0.6368356",
"0.6327262",
"0.632549",
"0.62751055",
"0.62132126",
"0.61919034",
"0.6164887",
"0.6164303",
"0.6136397",
"0.612279... | 0.58880985 | 29 |
Check for matching column names. Take column order into account if required. | def _assert_column_names(self,
other: 'PlainFrame',
assert_column_order: bool):
if assert_column_order:
enum = enumerate(zip(self.parent.columns, other.columns))
for idx, (left, right) in enum:
if left != right:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_columns(df: pd.DataFrame, names: typing.Sequence[str]) -> None:\n for expected in names:\n if expected not in df.columns:\n raise ValueError(f\"'{expected}' column not found in input\")\n return",
"def check_column_names(expected_headings, found_headings):\n column_missing =... | [
"0.76251984",
"0.7195401",
"0.709563",
"0.7042353",
"0.69941586",
"0.6691781",
"0.66475064",
"0.66325456",
"0.663073",
"0.6598974",
"0.6592288",
"0.6592108",
"0.6558971",
"0.6541223",
"0.65041465",
"0.6478449",
"0.6473228",
"0.640525",
"0.63871473",
"0.6381296",
"0.6322646",
... | 0.6192432 | 27 |
Check for matching dtypes. | def _assert_dtypes(self, other: 'PlainFrame'):
left_dtypes = {column.name: column.dtype
for column in self.parent.plaincolumns}
right_dtypes = {column.name: column.dtype
for column in other.plaincolumns}
if left_dtypes != right_dtypes:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def checktypestest(chosen_df):\n for i in chosen_df:\n if not chosen_df.dtypes[1] == chosen_df.dtypes[i]:\n raise ValueError('Types do not match')",
"def test_dtype_equality(self):\r\n dtypes = get_numeric_types(with_complex=True)\r\n # Perform all pairwise comparisons of dtype... | [
"0.80135894",
"0.7234959",
"0.68205154",
"0.6746715",
"0.67441595",
"0.66658807",
"0.6659452",
"0.6638226",
"0.66149473",
"0.66130525",
"0.6607592",
"0.6601777",
"0.65685874",
"0.65441304",
"0.6497217",
"0.6473403",
"0.64085436",
"0.64021945",
"0.63886726",
"0.6349159",
"0.63... | 0.6849566 | 2 |
Set or change the operation name. | def set_operation_name(self, operation_name: str) -> 'Span':
with self.update_lock:
self.operation_name = operation_name
return self | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_operation_name(self, operation_name):\n return self",
"def set_name(self, newname=\"\"):\n self.name = newname",
"def name(self, new_name: str) -> None:\n raise NotImplementedError()",
"def set_name(self, name):\n\t\tself.name_ = name",
"def set_name(self, name):\n self.... | [
"0.7433442",
"0.7001983",
"0.67910045",
"0.6782286",
"0.67231905",
"0.6708289",
"0.6708289",
"0.6684355",
"0.6664667",
"0.66417277",
"0.6621219",
"0.6621219",
"0.6621219",
"0.6621219",
"0.6621219",
"0.6613929",
"0.6613929",
"0.6613633",
"0.6591319",
"0.65641296",
"0.6563096",... | 0.72364527 | 1 |
close the database's connection | def close(self):
self.connect.close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close_db_connection(cls):\n db.close()",
"def close_database(self):\n if self._conn is not None:\n self._conn.close()\n self._conn = None",
"def close(self):\n Log.debug('DB -> close')\n # 关闭数据库连接\n self.conn.close()",
"def close_connection(excepti... | [
"0.8881403",
"0.8559506",
"0.8463414",
"0.83629894",
"0.83302844",
"0.8282513",
"0.82658875",
"0.8225167",
"0.8153175",
"0.81202096",
"0.8097706",
"0.80866265",
"0.80779445",
"0.8049228",
"0.803939",
"0.80156606",
"0.8003277",
"0.80013746",
"0.7982475",
"0.7946808",
"0.794660... | 0.0 | -1 |
Common asserts used for function check_bounds_column() | def assert_check_bounds_column(self):
value = logic.check_bounds_column(config.NR_COLS-1)
self.assertTrue(value)
value = logic.check_bounds_column(config.NR_COLS)
self.assertFalse(value)
value = logic.check_bounds_column(config.NR_COLS+1)
self.assertFalse(value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_b2_calc_bounds_column(self):\n type_of = \"c\"\n self.assert_calc_bounds(type_of)\n\n\n\n # config.NR",
"def test_contains_bounds(self):\n dim = Dimension(\"yolo\", \"uniform\", -3, 4)\n with pytest.raises(NotImplementedError):\n assert -3 in dim",
"def te... | [
"0.74237484",
"0.69838613",
"0.6953942",
"0.681433",
"0.67596763",
"0.6752799",
"0.6680745",
"0.66799754",
"0.65971136",
"0.6589417",
"0.65089524",
"0.6441844",
"0.6408359",
"0.6392604",
"0.63723135",
"0.63084906",
"0.62712693",
"0.6248684",
"0.61748815",
"0.6167",
"0.6103051... | 0.83791935 | 0 |
View for INSPIRE author new form review by a cataloger. | def newreview():
objectid = request.values.get('objectid', 0, type=int)
if not objectid:
abort(400)
workflow_object = workflow_object_class.get(objectid)
form = AuthorUpdateForm(
data=workflow_object.extra_data["formdata"], is_review=True)
ctx = {
"action": url_for('.reviewh... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reviewhandler():\n objectid = request.values.get('objectid', 0, type=int)\n if not objectid:\n abort(400)\n\n form = AuthorUpdateForm(formdata=request.form)\n visitor = DataExporter()\n visitor.visit(form)\n\n workflow_object = workflow_object_class.get(objectid)\n workflow_object.e... | [
"0.6186342",
"0.6019241",
"0.5921319",
"0.5894577",
"0.5713364",
"0.569221",
"0.5633519",
"0.5633519",
"0.5633519",
"0.5596706",
"0.55956036",
"0.5584584",
"0.5584584",
"0.55457455",
"0.554146",
"0.55128425",
"0.550151",
"0.5495999",
"0.54383487",
"0.5430356",
"0.54087865",
... | 0.75021577 | 0 |
Form handler when a cataloger accepts an author review. | def reviewhandler():
objectid = request.values.get('objectid', 0, type=int)
if not objectid:
abort(400)
form = AuthorUpdateForm(formdata=request.form)
visitor = DataExporter()
visitor.visit(form)
workflow_object = workflow_object_class.get(objectid)
workflow_object.extra_data["appr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def newreview():\n objectid = request.values.get('objectid', 0, type=int)\n if not objectid:\n abort(400)\n workflow_object = workflow_object_class.get(objectid)\n\n form = AuthorUpdateForm(\n data=workflow_object.extra_data[\"formdata\"], is_review=True)\n ctx = {\n \"action\":... | [
"0.7060465",
"0.629307",
"0.629307",
"0.6149655",
"0.6149655",
"0.6149655",
"0.6120107",
"0.6103637",
"0.6026453",
"0.60095066",
"0.5672402",
"0.5662186",
"0.5639166",
"0.5606529",
"0.55910844",
"0.5585579",
"0.55271304",
"0.55271304",
"0.55214375",
"0.5510191",
"0.5484171",
... | 0.7324554 | 0 |
Set the various initial parameters for the specified model | def set_params(self, dG=None, dH=None, dCp=None ):
if len(self.dG) > 0 and dG != None:
assert( len(self.dG) == len(dG) )
if len(self.dG) > 0 and dH != None:
assert( len(self.dG) == len(dH) )
if len(self.dG) > 0 and dCp != None:
assert( len(self.dG) == len(dCp) )
# note, dG & dH values are always at r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_initial_params(model: LogisticRegression):\n n_classes = 15 # threat types\n n_features = 33 # Number of features in dataset\n model.classes_ = np.array([i for i in range(15)])\n\n model.coef_ = np.zeros((n_classes, n_features))\n if model.fit_intercept:\n model.intercept_ = np.zeros(... | [
"0.7503698",
"0.74369335",
"0.7389962",
"0.72154593",
"0.71639836",
"0.71451163",
"0.70785147",
"0.70662534",
"0.70307606",
"0.6950158",
"0.6889478",
"0.686397",
"0.68393457",
"0.68064916",
"0.6782626",
"0.6708926",
"0.6668387",
"0.66682464",
"0.6650155",
"0.66411406",
"0.657... | 0.0 | -1 |
Tests can not set unchanged artifacts path. | def test_set_artifacts_path__deny_change_to_same():
path_before = copy.copy(ContractHandler.artifacts_path)
assert path_before is not None
assert ContractHandler._contracts
ContractHandler.set_artifacts_path(path_before)
assert ContractHandler.artifacts_path == path_before
assert ContractHandl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_set_artifacts_path__allow_change():\n path_before = copy.copy(ContractHandler.artifacts_path)\n assert path_before is not None\n assert ContractHandler._contracts\n\n ContractHandler.set_artifacts_path(\"new path\")\n\n assert ContractHandler.artifacts_path == \"new path\"\n assert not C... | [
"0.70567626",
"0.6995183",
"0.623431",
"0.6215728",
"0.62038463",
"0.60514677",
"0.6049854",
"0.6023675",
"0.59698844",
"0.59686464",
"0.5953195",
"0.5943441",
"0.5891",
"0.5854915",
"0.5839878",
"0.58333623",
"0.58179164",
"0.5816709",
"0.580364",
"0.58033425",
"0.5800118",
... | 0.7390868 | 0 |
Tests that a correct artifacts path can be set (happy flow). | def test_set_artifacts_path__allow_change():
path_before = copy.copy(ContractHandler.artifacts_path)
assert path_before is not None
assert ContractHandler._contracts
ContractHandler.set_artifacts_path("new path")
assert ContractHandler.artifacts_path == "new path"
assert not ContractHandler._c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_read_artifact(self):\n pass",
"def test_install_artifact_files():\n # Temporary directory to unzip the drop file into.\n tmp_dir = Path(mkdtemp())\n fig_dir = tmp_dir / \"figures\"\n fig_dir.mkdir()\n # cwd should be the parent directory of the tests/ directory.\n subrepo_dir = ... | [
"0.6734806",
"0.6585317",
"0.63297534",
"0.62533635",
"0.6192594",
"0.6092325",
"0.60607845",
"0.6028703",
"0.6021184",
"0.60106695",
"0.5944625",
"0.59431756",
"0.59092385",
"0.58946306",
"0.58640033",
"0.5832616",
"0.58008415",
"0.5799116",
"0.57847387",
"0.5770137",
"0.574... | 0.6141658 | 5 |
Tests setting of a DataTokenTemplate on a Contract. | def test_set():
contract = ContractHandler.get("DataTokenTemplate")
address = contract.address
ContractHandler.set("second_name", contract)
# result format is a tuple of (contract, contract_concise)
# did it store in (name) key?
result = ContractHandler._contracts["second_name"]
assert len... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_meta_template_parameters(test_vpc_layer):\n assert test_vpc_layer.user_params.get('template_parameter') is not None\n assert test_vpc_layer.meta['parameters']['dummy_parameter']['value'] ==\\\n test_vpc_layer.user_params['template_parameter']",
"def test_get_concise_contract():\n contrac... | [
"0.5199592",
"0.51107925",
"0.5046259",
"0.4994357",
"0.49763298",
"0.49422327",
"0.4907097",
"0.48470324",
"0.47955355",
"0.47663856",
"0.476633",
"0.47482803",
"0.47373295",
"0.47278598",
"0.4717996",
"0.4717283",
"0.4710187",
"0.46833718",
"0.46761113",
"0.46761113",
"0.46... | 0.5985615 | 0 |
check if a class is the subclass of analyzer.fitters.fitter_base.Fit | def is_Fit_subclass(cls: Type[Fit]) -> bool:
try:
if issubclass(cls, Fit) and (cls is not Fit):
return True
else:
return False
except TypeError:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_proper_subclass(cls, maybe_proper_superclass):\n return cls is not maybe_proper_superclass and issubclass(cls, maybe_proper_superclass)",
"def inherits_from(obj, a_class):\n if type(obj) is not a_class:\n return(issubclass(type(obj), a_class))\n else:\n return False",
"def inherit... | [
"0.6576094",
"0.6364645",
"0.6303626",
"0.6294872",
"0.62884855",
"0.62675166",
"0.62474513",
"0.6242943",
"0.62300366",
"0.62144125",
"0.61947626",
"0.61947626",
"0.6180429",
"0.61680543",
"0.61600274",
"0.61493444",
"0.6127009",
"0.6123876",
"0.6121389",
"0.6117836",
"0.611... | 0.86213636 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.