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 |
|---|---|---|---|---|---|---|
Return the digit prefix from a list of characters. | def get_digit_prefix(characters):
value = 0
while characters and characters[0].isdigit():
value = value * 10 + int(characters.pop(0))
return value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_non_digit_prefix(characters):\n prefix = []\n while characters and not characters[0].isdigit():\n prefix.append(characters.pop(0))\n return prefix",
"def prefixes(s):\n output = ''\n for i in range(len(s) + 1):\n add = s[0:i]\n output += add\n return output",
"def... | [
"0.78587323",
"0.67651623",
"0.6760233",
"0.66336036",
"0.65106934",
"0.6476999",
"0.6258126",
"0.62505066",
"0.6086174",
"0.60779506",
"0.5976031",
"0.5954396",
"0.5935519",
"0.59206545",
"0.5833455",
"0.5797259",
"0.57922006",
"0.57849747",
"0.5730795",
"0.5724486",
"0.5715... | 0.77311194 | 1 |
Initialize layers of the head. | def _init_layers(self) -> None:
self.relu = nn.ReLU(inplace=True)
self.cls_convs = nn.ModuleList()
self.reg_convs = nn.ModuleList()
for i in range(self.stacked_convs):
chn = self.in_channels if i == 0 else self.feat_channels
self.cls_convs.append(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _init_layers(self):\n self._init_predictor()\n if self.use_edge_fusion:\n self._init_edge_module()",
"def _init_layers(self) -> None:\n self.self_attn = MultiheadAttention(**self.self_attn_cfg)\n self.cross_attn = MultiheadAttention(**self.cross_attn_cfg)\n self.... | [
"0.7565452",
"0.73801965",
"0.7378758",
"0.70826614",
"0.70083666",
"0.68058515",
"0.6793121",
"0.6747672",
"0.67046845",
"0.6699219",
"0.6565106",
"0.6552534",
"0.6548868",
"0.6536724",
"0.6533556",
"0.65013635",
"0.64803135",
"0.6478405",
"0.6438143",
"0.6429889",
"0.642896... | 0.62296057 | 29 |
Forward features from the upstream network. | def forward(self, x: Tuple[Tensor]) -> Tuple[List[Tensor]]:
return multi_apply(self.forward_single, x, self.scales) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forward_train(self, *args, **kwargs):\n pass",
"def forward(self, X, training=False):\n pass",
"def forward(self, features=None):\n\n assert (features is None) == (self.in_features is None), \\\n \"Layer has not been properly configured to take in features!\"\n\n in_d... | [
"0.69998914",
"0.67290515",
"0.671595",
"0.6710372",
"0.66852725",
"0.6682484",
"0.6649977",
"0.6626594",
"0.660322",
"0.65913093",
"0.6573614",
"0.6568412",
"0.6568412",
"0.65524113",
"0.6550743",
"0.65131605",
"0.6505302",
"0.6499309",
"0.6492958",
"0.6483335",
"0.64765483"... | 0.0 | -1 |
Forward feature of a single scale level. | def forward_single(self, x: Tensor, scale: Scale) -> Sequence[Tensor]:
cls_feat = x
reg_feat = x
for cls_conv in self.cls_convs:
cls_feat = cls_conv(cls_feat)
for reg_conv in self.reg_convs:
reg_feat = reg_conv(reg_feat)
cls_score = self.atss_cls(cls_feat)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def feature_forward(self, x):\n raise NotImplementedError",
"def forward(self, x):\n x = self.features(x)\n return x",
"def forward_single(self, x, scale):\n cls_feat = x\n reg_feat = x\n for cls_conv in self.cls_convs:\n cls_feat = cls_conv(cls_feat)\n ... | [
"0.74690366",
"0.68007946",
"0.65777415",
"0.6515914",
"0.6515914",
"0.6404764",
"0.6320513",
"0.6306763",
"0.6299315",
"0.6285584",
"0.6279949",
"0.6200305",
"0.6179189",
"0.6158268",
"0.6132828",
"0.6124821",
"0.61077636",
"0.61061907",
"0.6104554",
"0.6101124",
"0.6098391"... | 0.6088855 | 22 |
Reads an image, and returns the image converted as requested | def imReadAndConvert(filename: str, representation: int) -> np.ndarray:
return normalize(imgRead(filename,representation)).astype(np.float) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_image(filename, representation):\n img = imread(filename)\n img = int2float(img)\n if representation == GS_REP:\n img = rgb2gray(img)\n return img",
"def read_image(img_path):\n img = imageio.imread(uri=img_path)\n return img",
"def read_image(path):\n img = misc.imread(pat... | [
"0.7637244",
"0.7631406",
"0.7625927",
"0.7598105",
"0.757752",
"0.75463986",
"0.7503955",
"0.7487823",
"0.7478501",
"0.74411386",
"0.7417968",
"0.73840916",
"0.7372546",
"0.73162466",
"0.73159194",
"0.7283539",
"0.7280386",
"0.71980983",
"0.7189244",
"0.7180297",
"0.7125468"... | 0.6885347 | 41 |
Reads an image, and returns the image converted as requested | def imgRead(filename: str, representation: int) -> np.ndarray:
if representation==LOAD_GRAY_SCALE:
img = cv2.imread(filename,0)
else:
img = cv2.imread(filename)
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
return img.astype('uint8') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_image(filename, representation):\n img = imread(filename)\n img = int2float(img)\n if representation == GS_REP:\n img = rgb2gray(img)\n return img",
"def read_image(img_path):\n img = imageio.imread(uri=img_path)\n return img",
"def read_image(path):\n img = misc.imread(pat... | [
"0.7637244",
"0.7631406",
"0.7625927",
"0.7598105",
"0.757752",
"0.75463986",
"0.7503955",
"0.7487823",
"0.7478501",
"0.74411386",
"0.7417968",
"0.73840916",
"0.7372546",
"0.73162466",
"0.73159194",
"0.7283539",
"0.7280386",
"0.71980983",
"0.7189244",
"0.7180297",
"0.7125468"... | 0.69988364 | 32 |
Reads an image as RGB or GRAY_SCALE and displays it | def imDisplay(filename: str, representation: int):
img=imReadAndConvert(filename, representation)
if representation==LOAD_GRAY_SCALE:
plt.imshow(img,cmap='gray')
else:
plt.imshow(img)
plt.show() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_image(filename, representation):\n img = imread(filename)\n img = int2float(img)\n if representation == GS_REP:\n img = rgb2gray(img)\n return img",
"def read_image(filename, representation):\n\n # loads the image\n im = imread(filename)\n\n if representation == RGB:\n ... | [
"0.71310514",
"0.71129113",
"0.6931304",
"0.6907308",
"0.6869184",
"0.6850564",
"0.6765676",
"0.6745545",
"0.67344934",
"0.6725464",
"0.6689097",
"0.66784036",
"0.66701776",
"0.66513896",
"0.6649678",
"0.6557594",
"0.65238005",
"0.6523356",
"0.65081024",
"0.6498182",
"0.64924... | 0.6784014 | 6 |
Converts an RGB image to YIQ color space | def transformRGB2YIQ(imgRGB: np.ndarray) -> np.ndarray:
YIQ_from_RGB = np.array([[0.299, 0.587, 0.114],
[0.59590059, -0.27455667, -0.32134392],
[0.21153661, -0.52273617, 0.31119955]])
YIQImg = np.ndarray(imgRGB.shape)
YIQImg[:, :, 0] = YIQ_fro... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def yiq2rgb(im_yiq):\n return multiply_by_left_matrix(np.linalg.inv(YIQ_MATRIX), im_yiq)",
"def transformYIQ2RGB(imgYIQ: np.ndarray) -> np.ndarray:\r\n yiq_from_rgb = np.array([[0.299, 0.587, 0.114],\r\n [0.59590059, -0.27455667, -0.32134392],\r\n [0.... | [
"0.78210664",
"0.78199023",
"0.7666547",
"0.76417565",
"0.76410896",
"0.7546602",
"0.7540405",
"0.74511164",
"0.7390635",
"0.73402584",
"0.73154837",
"0.7043586",
"0.70303035",
"0.69857025",
"0.69055045",
"0.68357015",
"0.6676329",
"0.6645435",
"0.64459527",
"0.62554914",
"0.... | 0.7730443 | 2 |
Converts an YIQ image to RGB color space | def transformYIQ2RGB(imgYIQ: np.ndarray) -> np.ndarray:
yiq_from_rgb = np.array([[0.299, 0.587, 0.114],
[0.59590059, -0.27455667, -0.32134392],
[0.21153661, -0.52273617, 0.31119955]])
rgb_from_yiq = np.linalg.inv(yiq_from_rgb)
RGBImg = np.ndar... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def yiq2rgb(imYIQ):\n return __image_color_conversion(imYIQ, YIQ_TO_RGB_MATRIX)",
"def yiq2rgb(im_yiq):\n return multiply_by_left_matrix(np.linalg.inv(YIQ_MATRIX), im_yiq)",
"def yiq2rgb(imYIQ):\n trans = np.array([[1, 0.956, 0.62], [1, -0.272, -0.647], [1, -1.108, 1.705]])\n return np.dot(imYIQ, t... | [
"0.8308794",
"0.804683",
"0.79945725",
"0.7797806",
"0.7565786",
"0.7317489",
"0.7250127",
"0.7234322",
"0.7208047",
"0.7001171",
"0.6986416",
"0.6962196",
"0.68149173",
"0.6802846",
"0.6547641",
"0.65185916",
"0.6507848",
"0.6482017",
"0.64524335",
"0.6437913",
"0.6417729",
... | 0.80674505 | 1 |
Returns a TimeSeriesRDD, with a transformation applied to all the series in this RDD. Either the series produced by the given function should conform to this TimeSeriesRDD's index, or a new DateTimeIndex should be given that they conform to. | def map_series(self, fn, dt_index = None):
if dt_index == None:
dt_index = self.index()
return TimeSeriesRDD(dt_index, self.map(fn)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_series_rdd_from_pandas_series_rdd(series_rdd, sc):\n first = series_rdd.first()\n dt_index = irregular(first[1].index, sc)\n return TimeSeriesRDD(dt_index, series_rdd.mapValues(lambda x: x.values))",
"def with_index(self, new_index):\n return TimeSeriesRDD(None, None, self._jtsrdd.withIn... | [
"0.62711495",
"0.5801939",
"0.56270325",
"0.5609492",
"0.5563915",
"0.54916096",
"0.5479368",
"0.5370125",
"0.5354681",
"0.5337373",
"0.5293034",
"0.51766896",
"0.5163525",
"0.5150459",
"0.5144428",
"0.508436",
"0.5071875",
"0.5059751",
"0.50471544",
"0.5014208",
"0.49850103"... | 0.77668923 | 0 |
Returns a DataFrame of instants, each a horizontal slice of this TimeSeriesRDD at a time. This essentially transposes the TimeSeriesRDD, producing a DataFrame where each column is a key form one of the rows in the TimeSeriesRDD. | def to_instants_dataframe(self, sql_ctx):
ssql_ctx = sql_ctx._ssql_ctx
jdf = self._jtsrdd.toInstantsDataFrame(ssql_ctx, -1)
return DataFrame(jdf, sql_ctx) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timeseries_dataframe(self):\n return",
"def get_dataframe_with_time_column(self):\n return pd.concat([self.get_time_dataframe(),\n self.get_x_dataframe_without_time_column(),\n self.get_y_dataframe_without_time_column()], axis=1)",
"def get_x_... | [
"0.63760203",
"0.61218834",
"0.6075911",
"0.59492457",
"0.58164054",
"0.5799775",
"0.576747",
"0.56634945",
"0.5662398",
"0.56245106",
"0.56157786",
"0.55995685",
"0.5584687",
"0.55010736",
"0.5490728",
"0.5480752",
"0.54156256",
"0.54066265",
"0.5387363",
"0.5375128",
"0.535... | 0.63853914 | 0 |
Returns a DataFrame of observations, each containing a timestamp, a key, and a value. | def to_observations_dataframe(self, sql_ctx, ts_col='timestamp', key_col='key', val_col='value'):
ssql_ctx = sql_ctx._ssql_ctx
jdf = self._jtsrdd.toObservationsDataFrame(ssql_ctx, ts_col, key_col, val_col)
return DataFrame(jdf, sql_ctx) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dataframe(self):\n dictionary = OrderedDict(zip(self.keys, [[value] for value in self.values]))\n dataframe = pd.DataFrame(dictionary)\n return dataframe",
"def time_series_rdd_from_observations(dt_index, df, ts_col, key_col, val_col):\n jvm = df._sc._jvm\n jtsrdd = jvm.com.clouder... | [
"0.6459648",
"0.6400567",
"0.6189685",
"0.606364",
"0.6063265",
"0.60247695",
"0.59910816",
"0.5958121",
"0.5942607",
"0.58885336",
"0.58758396",
"0.5858734",
"0.5820036",
"0.57595956",
"0.5736643",
"0.572634",
"0.57074404",
"0.56914395",
"0.5685607",
"0.5673251",
"0.56664556... | 0.7196428 | 0 |
Returns a TimeSeriesRDD with instants containing NaNs cut out. The resulting TimeSeriesRDD has a slimmed down DateTimeIndex, missing all the instants for which any series in the RDD contained a NaN. | def remove_instants_with_nans(self):
return TimeSeriesRDD(None, None, self._jtsrdd.removeInstantsWithNaNs(), self.ctx) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dropna(self) -> \"Dataset\":\n if not self[0]._has_time_axis: # type: ignore\n raise ValueError(\"Not available if no time axis!\")\n\n all_index: List[int] = []\n for i in range(self.n_items):\n x = self[i].to_numpy()\n\n # this seems overly complicated..... | [
"0.65195477",
"0.5936032",
"0.5821432",
"0.5557815",
"0.5507173",
"0.54744035",
"0.54522794",
"0.5414286",
"0.539981",
"0.53563136",
"0.5326098",
"0.5321653",
"0.5230177",
"0.52193105",
"0.5205547",
"0.51892334",
"0.5168442",
"0.5151765",
"0.5127313",
"0.511249",
"0.5084101",... | 0.7648933 | 0 |
Returns a TimeSeriesRDD where each series is a return rate series for a series in this RDD. Assumes periodic (as opposed to continuously compounded) returns. | def return_rates(self):
return TimeSeriesRDD(None, None, self._jtsrdd.returnRates(), self.ctx) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rateTS (self,ts):\n output = []\n for line in ts.data:\n output.append([line[0],self.rate(line[1]),line[2]])\n return timeseries(output)",
"def reverseRateTS (self,ts):\n output = []\n for line in ts.data:\n output.append([line[0],self.rate2(line[1]),line[2]])\n return timeseries(... | [
"0.65692306",
"0.5961046",
"0.59325075",
"0.57829857",
"0.57081616",
"0.56895584",
"0.5604049",
"0.5561605",
"0.5553764",
"0.53714114",
"0.5337914",
"0.5286991",
"0.5235922",
"0.5227559",
"0.52169186",
"0.5195939",
"0.5192842",
"0.5188313",
"0.518587",
"0.5182831",
"0.5175865... | 0.73874104 | 0 |
Instantiates a TimeSeriesRDD from an RDD of Pandas Series objects. The series in the RDD are all expected to have the same DatetimeIndex. | def time_series_rdd_from_pandas_series_rdd(series_rdd, sc):
first = series_rdd.first()
dt_index = irregular(first[1].index, sc)
return TimeSeriesRDD(dt_index, series_rdd.mapValues(lambda x: x.values)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_series_rdd_from_observations(dt_index, df, ts_col, key_col, val_col):\n jvm = df._sc._jvm\n jtsrdd = jvm.com.cloudera.sparkts.TimeSeriesRDD.timeSeriesRDDFromObservations( \\\n dt_index._jdt_index, df._jdf, ts_col, key_col, val_col)\n return TimeSeriesRDD(None, None, jtsrdd, df._sc)",
"def ... | [
"0.72149736",
"0.68661404",
"0.6623931",
"0.5935621",
"0.5660876",
"0.56325513",
"0.55991715",
"0.55562854",
"0.5541364",
"0.54949653",
"0.54765224",
"0.5392781",
"0.5373742",
"0.5373718",
"0.53336143",
"0.5327711",
"0.53011894",
"0.5295875",
"0.5198684",
"0.51886564",
"0.513... | 0.8425635 | 0 |
Instantiates a TimeSeriesRDD from a DataFrame of observations. An observation is a row containing a timestamp, a string key, and float value. | def time_series_rdd_from_observations(dt_index, df, ts_col, key_col, val_col):
jvm = df._sc._jvm
jtsrdd = jvm.com.cloudera.sparkts.TimeSeriesRDD.timeSeriesRDDFromObservations( \
dt_index._jdt_index, df._jdf, ts_col, key_col, val_col)
return TimeSeriesRDD(None, None, jtsrdd, df._sc) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_series_rdd_from_pandas_series_rdd(series_rdd, sc):\n first = series_rdd.first()\n dt_index = irregular(first[1].index, sc)\n return TimeSeriesRDD(dt_index, series_rdd.mapValues(lambda x: x.values))",
"def map_series(self, fn, dt_index = None):\n if dt_index == None:\n dt_index =... | [
"0.7046191",
"0.60221064",
"0.5998396",
"0.5928619",
"0.58309406",
"0.57387125",
"0.5716675",
"0.553439",
"0.5460759",
"0.535865",
"0.53585386",
"0.5303728",
"0.5294243",
"0.5290926",
"0.52446043",
"0.5226981",
"0.52258366",
"0.52015996",
"0.520077",
"0.51979744",
"0.51745284... | 0.77521336 | 0 |
Instanciate a Flask app | def create_app(config_object='fifa_app.settings'):
# FLASK APP OBJECT
app = Flask(__name__,
template_folder='views/templates',
static_folder='views/static')
# APP CONFIGS
app.config.from_object(config_object)
app.url_map.converters['objectid'] = ObjectIdConverter
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_app(self):\r\n self.app = Flask(__name__, instance_relative_config=True)\r\n\r\n # Init the secret key of the app -it is a must for flask to run\r\n self.app.config.from_mapping(\r\n SECRET_KEY='!ZNeverSayNever116Z!',\r\n MONGODB_SETTINGS= {'host': 'mongodb://l... | [
"0.85229576",
"0.843523",
"0.8428554",
"0.83035755",
"0.8290718",
"0.82541245",
"0.8250584",
"0.8227921",
"0.82277375",
"0.82213604",
"0.8210886",
"0.8171451",
"0.81696296",
"0.8166794",
"0.8166638",
"0.8124132",
"0.8116281",
"0.80839455",
"0.80515736",
"0.8042839",
"0.803034... | 0.0 | -1 |
test that get_respondent_enrolments_for_started_collex will only return enrolment data if we have a corresponding collex | def test_get_respondent_enrolments_for_started_collex(self):
collex = {"survey1": "collex1", "survey3": "collex3"}
enrolment_data = [
{"survey_id": "survey1", "enrolment_data": "enrolment1"},
{"survey_id": "survey2", "enrolment_data": "enrolment2"},
{"survey_id": "s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_respondent_enrolments_for_started_collex(enrolment_data, collection_exercises):\n\n enrolments = []\n for enrolment in enrolment_data:\n if enrolment[\"survey_id\"] in collection_exercises:\n enrolments.append(enrolment)\n return enrolments",
"def get_respondent_enrolments(resp... | [
"0.74228185",
"0.5970302",
"0.5802192",
"0.56863153",
"0.5631165",
"0.555663",
"0.5517439",
"0.5487424",
"0.5435976",
"0.53995126",
"0.539434",
"0.53268313",
"0.53059155",
"0.52902067",
"0.5266447",
"0.520747",
"0.520632",
"0.52000195",
"0.51906496",
"0.51803434",
"0.5162696"... | 0.8722717 | 0 |
Calculates E_loc in F = 1/2 Re p^ nabla E_loc | def total_loc_efield(i, r1, r2, k, case, nmin, nmax, kzimax,
fiber_radius, eps_out, eps_in, E0_mod, nmin_sc, nmax_sc,
R_particle, eps_particle):
if i == 1:
ri = r1
rj = r2
j = 2
elif i == 2:
ri = r2
rj = r1
j = 1
else:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def E_fermi(n_e):\n return n_e / nu0 # in K",
"def energy(e: float) -> float:\n\n return (1/np.sqrt(2))*(gamma(-e/2+1/2)/(gamma(-e/2+3/4)))",
"def update_E(self):\n self.grid.E[self.loc] += (\n self.grid.courant_number\n * self.grid.inverse_permittivity[self.loc]\n ... | [
"0.61578",
"0.6137544",
"0.60636985",
"0.60535794",
"0.60052717",
"0.5948755",
"0.5905985",
"0.58588016",
"0.5821682",
"0.5814282",
"0.57353085",
"0.57304126",
"0.5725624",
"0.56935596",
"0.5693008",
"0.5691016",
"0.5663702",
"0.5596646",
"0.55741847",
"0.5573453",
"0.5542354... | 0.65836173 | 0 |
Position and velocity of galaxy g2 COM relative to g1 COM. Uses only disk particles for the COM determination. | def separations(self, g1, g2):
results = {}
com1 = CenterOfMass(self.galaxies[g1], 2)
com2 = CenterOfMass(self.galaxies[g2], 2)
com1_p = com1.com_p()
com2_p = com2.com_p()
com1_v = com1.com_v(com1_p)
com2_v = com2.com_v(com2_p)
results['pos_xyz']... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def indices_and_currents_TSC_2D( charge_electron, positions_x, positions_y, velocity_x, velocity_y,\\\n x_grid, y_grid, ghost_cells, length_domain_x, length_domain_y, dt ):\n \n \n positions_x_new = positions_x + velocity_x * dt\n positions_y_new = positions_y + velo... | [
"0.58575815",
"0.5825163",
"0.5763137",
"0.5720161",
"0.56911534",
"0.5588453",
"0.55679363",
"0.5482735",
"0.54465604",
"0.5420334",
"0.5410448",
"0.5377566",
"0.52806664",
"0.5279981",
"0.5279643",
"0.5279466",
"0.52791387",
"0.52676374",
"0.5264033",
"0.526127",
"0.5246839... | 0.6156531 | 0 |
Return a color unique for this key, brigher if selected. Of course the color can't really be unique because there are more keys in the world than colors; but the algorithm tries to make similar strings come out different colors so they can be distinguished in a chart or graph | def hashColor(key, selected=False):
def tw(t): return t ^ (t << (t % 5)) ^ (t << (6 + (t % 7))) ^ (t << (13 + (t % 11)))
theHash = tw(hash(key) % 5003)
ifsel = 0x00 if selected else 0x80
(r, g, b) = (ifsel | (theHash & 0x7f),
ifsel | ((theHash >> 8) & 0x7F),
ifsel | ((theH... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def uniqueish_color(color_data):\n # return plt.cm.gist_ncar(color_data)\n # return plt.cm.binary(color_data)\n return plt.cm.bwr(color_data)",
"def unique_color(n=1):\n \n if n == 1:\n c='xkcd:red'\n elif n== 2:\n c='xkcd:green'\n elif n== 3:\n c='xkcd:yellow'\n elif n=... | [
"0.672433",
"0.66087276",
"0.6485091",
"0.63489294",
"0.6275688",
"0.6187645",
"0.6166512",
"0.6104571",
"0.6056631",
"0.60467076",
"0.594447",
"0.5927787",
"0.5907678",
"0.5875776",
"0.5856652",
"0.58503646",
"0.58503646",
"0.58503646",
"0.58503646",
"0.58503646",
"0.5850364... | 0.67416835 | 0 |
Create a pad with convolution pattern. | def pad_conv_pattern():
pattern = is_op("nn.pad")(wildcard(), is_constant())
pattern = is_op("nn.conv2d")(pattern, is_constant())
pattern = pattern.optional(lambda x: is_op("nn.bias_add")(x, is_constant()))
pattern = pattern.optional(lambda x: is_op("add")(x, is_constant()))
patt... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pad_pattern():\n pattern = is_op(\"nn.pad\")(wildcard(), is_constant())\n return pattern",
"def padding(src, min_size):\n # pad before put into convolutional layer\n src_dim = src.dim()\n if src_dim[0][1] >= min_size:\n return src\n pad_size = min_size - src_dim[0][1]\n channels = src_d... | [
"0.7179577",
"0.7081386",
"0.70543116",
"0.6750609",
"0.6728046",
"0.66987216",
"0.6688631",
"0.6644302",
"0.65576375",
"0.65093374",
"0.65056735",
"0.64760536",
"0.6472652",
"0.64346755",
"0.64319086",
"0.6369909",
"0.63127315",
"0.63033724",
"0.629313",
"0.6289233",
"0.6270... | 0.79311615 | 0 |
Create a pad pattern. | def pad_pattern():
pattern = is_op("nn.pad")(wildcard(), is_constant())
return pattern | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pad(seq, n):\n return",
"def _pattern01(width):\n zeroes = core.Constant(0, width)\n return operation.Concat(zeroes, ~zeroes)",
"def get_pad(self, n):\n pad = \"\"\n for i in range(0, n):\n pad += \" \"\n return pad",
"def padzeros(f,npad=None,padpattern=None):\r... | [
"0.68809325",
"0.6671816",
"0.66681606",
"0.6660439",
"0.6549455",
"0.65051806",
"0.6372611",
"0.6361178",
"0.6350253",
"0.6318035",
"0.6267106",
"0.6223662",
"0.61023414",
"0.60866624",
"0.6055036",
"0.60397214",
"0.6010678",
"0.6006676",
"0.60056216",
"0.5976305",
"0.597630... | 0.7753386 | 0 |
r"""Returns all available builtin image backends. | def builtin_image_backends() -> Dict[str, ImageBackend]:
available_backends = OrderedDict()
for meta in BUILTIN_IMAGE_BACKENDS_META:
try:
exec(f"import {meta.name}")
except ImportError:
pass
else:
backend_class = getattr(
import_module(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def backends():\n return list(loader.backend_dict.keys())\n # return loader._preference",
"def list_backends(_):\n backends = [b.__name__ for b in available_backends()]\n print('\\n'.join(backends))",
"def getConfiguredBackends():\n\ttry:\n\t\tfrom OPSI.Backend.BackendManager import BackendDispatcher\n... | [
"0.75774294",
"0.74756455",
"0.6591343",
"0.6485748",
"0.642623",
"0.64187396",
"0.6286682",
"0.6174606",
"0.59503514",
"0.5817098",
"0.57944405",
"0.5783438",
"0.57697886",
"0.5762268",
"0.5746804",
"0.5740274",
"0.5740274",
"0.57331276",
"0.5727784",
"0.5727784",
"0.569572"... | 0.8447348 | 0 |
Compute the autocorrelation of the signal, based on the properties of the power spectral density of the signal. | def _ac_fft3 (self,xp,max_lag):
'''takes xp'''
f = np.fft.fft(self.xp)
p = np.array([np.real(v)**2+np.imag(v)**2 for v in f])
pi = np.fft.ifft(p)
corr = np.real(pi)[:self.n]/np.sum(self.xp**2)
return corr[:max_lag] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def autocorrelation(x):\n x = np.asarray(x)\n N = len(x)\n x = x-x.mean()\n s = fft.fft(x, N*2-1)\n result = np.real(fft.ifft(s * np.conjugate(s), N*2-1))\n result = result[:N]\n result /= result[0]\n return result",
"def autocorrelation_1d(data):\n\n N = len(data)\n n_fft = select_... | [
"0.6977139",
"0.6682479",
"0.6680385",
"0.6673429",
"0.6645971",
"0.6645971",
"0.6638325",
"0.6450153",
"0.64091885",
"0.6401146",
"0.6401146",
"0.6296091",
"0.62658864",
"0.62283957",
"0.61280847",
"0.6104208",
"0.6090213",
"0.59735745",
"0.5953956",
"0.59319025",
"0.5927878... | 0.57503 | 26 |
Add `word` to trie | def insert(self, words, handler):
current_node = self.root
for word in words:
if word not in current_node.children:
current_node.children[word] = RouteTrieNode()
current_node = current_node.children[word]
current_node.handler = handler | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addWord(self, word): \n\n # make trie for new word\n self.root.makeTrie(word)",
"def addWord(self, word):\n trie = self.trie\n for c in word:\n if c in trie.children:\n trie = trie.children[c]\n else:\n new_trie_node = TrieNode... | [
"0.9127098",
"0.91074383",
"0.907848",
"0.9077506",
"0.9059536",
"0.89692134",
"0.8944615",
"0.8935418",
"0.89311486",
"0.8908895",
"0.8865934",
"0.8834281",
"0.8752977",
"0.86890453",
"0.8627298",
"0.85813296",
"0.8530083",
"0.8507056",
"0.8489907",
"0.8469678",
"0.84570843"... | 0.7289838 | 96 |
Moves the snake head by velocity, and makes each piece of the tail/body follow the preceding piece. | def move(self,velocity):
# make a copy of the body
old_body = deepcopy(self.body)
# move the head
self.body[0][0] += velocity[0]
self.body[0][1] += velocity[1]
# for the rest of the body
for i in range(1,len(self.body)):
# move a piece to the next p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __snake_move(self):\n self.__eat_candy()\n # move tail and body\n n_snake = len(self.__snake)\n for i in range(1, n_snake):\n s2 = self.__snake[n_snake - i]\n s1 = self.__snake[n_snake - i - 1]\n s2.move(s1.pos())\n # move head\n pos = ... | [
"0.7899923",
"0.7674553",
"0.6916892",
"0.68793786",
"0.66987824",
"0.6624796",
"0.6624796",
"0.65994817",
"0.65944964",
"0.6485675",
"0.63883007",
"0.6364401",
"0.6259971",
"0.62499386",
"0.6240311",
"0.62007177",
"0.61963856",
"0.6171125",
"0.61553556",
"0.61485434",
"0.612... | 0.7307512 | 2 |
Adds a piece to the tail. | def grow(self):
self.body.append(self.body[-1]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_piece(self, pos, piece):\n self._board[self.ind(pos)[0]][self.ind(pos)[1]] = piece",
"def addPiece(self, piece):\r\n \r\n self.pieces[(piece.x, piece.y)] = piece",
"def add_piece(self, peer_id, piece):\n self.peers[peer_id].add_piece(piece)",
"def add_line_piece(self, star... | [
"0.6926095",
"0.6796923",
"0.67203015",
"0.6695232",
"0.6662546",
"0.662813",
"0.62408054",
"0.60545915",
"0.60510665",
"0.6011269",
"0.6005867",
"0.5995756",
"0.59787685",
"0.5912679",
"0.58771855",
"0.58430296",
"0.58342856",
"0.58294994",
"0.58294994",
"0.5801538",
"0.5791... | 0.0 | -1 |
Test a climate entity from a HRT4ZW / SRT321 thermostat device. This device currently has no setpoint values. | async def test_thermostat_srt321_hrt4_zw(
hass: HomeAssistant, client, srt321_hrt4_zw, integration
) -> None:
state = hass.states.get(CLIMATE_MAIN_HEAT_ACTIONNER)
assert state
assert state.state == HVACMode.OFF
assert state.attributes[ATTR_HVAC_MODES] == [
HVACMode.OFF,
HVACMode.HEA... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def test_climate_device(hass: HomeAssistant, nefit_wrapper):\n entity_registry = er.async_get(hass)\n\n entry = entity_registry.async_get(\"climate.nefit\")\n assert entry\n\n thermostat = hass.states.get(\"climate.nefit\")\n assert thermostat\n assert thermostat.state == HVAC_MODE_HEAT\n ... | [
"0.71660626",
"0.70875716",
"0.7076626",
"0.6939296",
"0.6882237",
"0.68028986",
"0.67620087",
"0.6737158",
"0.6728056",
"0.67012626",
"0.6649743",
"0.65662515",
"0.6451067",
"0.6431211",
"0.63004863",
"0.6281278",
"0.6260004",
"0.62042004",
"0.6119531",
"0.6067164",
"0.60661... | 0.6240225 | 17 |
Test a thermostat v2 with unknown values. | async def test_thermostat_unknown_values(
hass: HomeAssistant, client, climate_radio_thermostat_ct100_plus_state, integration
) -> None:
node_state = replace_value_of_zwave_value(
climate_radio_thermostat_ct100_plus_state,
[
ZwaveValueMatcher(
THERMOSTAT_OPERATING_STA... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def test_thermostat_heatit_z_trm3_no_value(\n hass: HomeAssistant, client, climate_heatit_z_trm3_no_value, integration\n) -> None:\n # When the config parameter that specifies what sensor to use has no value, we fall\n # back to the first temperature sensor found on the device\n state = hass.stat... | [
"0.6639261",
"0.5986812",
"0.5972934",
"0.5954473",
"0.5872868",
"0.58689713",
"0.57315207",
"0.57127076",
"0.5701074",
"0.5692173",
"0.5677791",
"0.5614458",
"0.5600535",
"0.55856824",
"0.5584413",
"0.55762774",
"0.55755365",
"0.55627763",
"0.5526178",
"0.549743",
"0.5479788... | 0.71495783 | 0 |
Returns whether there is a command that can be undone. | def canUndo(self):
return self._index > 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_commands(self) -> bool:\n return len(self.commands) > 0",
"def check_command(self):\n return self.process is not None and self.process.poll() is None",
"def has_undo(self):\n return self._current_undo_command != -1",
"def has_redo(self):\n return self._current_undo_command... | [
"0.67834055",
"0.6547972",
"0.6518035",
"0.6447762",
"0.63967794",
"0.63082707",
"0.6237768",
"0.6157265",
"0.61475927",
"0.61365205",
"0.61364776",
"0.6113849",
"0.608146",
"0.60621536",
"0.6061401",
"0.60613286",
"0.6028211",
"0.6018211",
"0.60032314",
"0.5990162",
"0.59579... | 0.5940334 | 24 |
Returns whether there is a command that can be redone. | def canRedo(self):
return self._index < len(self._commands) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_redo(self):\n return self._current_undo_command + 1 != len(self._commands)",
"def can_redo(self) -> bool:\n\n return self.position < len(self.history) - 1",
"def has_commands(self) -> bool:\n return len(self.commands) > 0",
"def check_command(self):\n return self.process i... | [
"0.7555134",
"0.72837406",
"0.6869247",
"0.68536013",
"0.6704742",
"0.6677132",
"0.6618921",
"0.65715176",
"0.6503353",
"0.6491763",
"0.6437503",
"0.6396975",
"0.63901436",
"0.6370292",
"0.6334409",
"0.62515205",
"0.62515205",
"0.6251112",
"0.6236309",
"0.6211866",
"0.6211117... | 0.7432786 | 1 |
Get user by id | def get_by_id(self, id):
return self.session.query(User).filter_by(id=id).first() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_user_by_id(self, id):\n\t\treturn self.users.get(id)",
"def get_user(id):\n pass",
"def get(id):\n return User.query.filter_by(id=id).first()",
"def getUser(self, id : int) -> bbUser.bbUser:\n id = self.validateID(id)\n return self.users[id]",
"def get_single_user(self, id):... | [
"0.8873811",
"0.88707125",
"0.87658477",
"0.8525675",
"0.85058427",
"0.84312195",
"0.84294516",
"0.8414046",
"0.84003544",
"0.839886",
"0.83409226",
"0.8265451",
"0.826507",
"0.82554895",
"0.8222798",
"0.8222798",
"0.8222798",
"0.8222798",
"0.8204112",
"0.8201288",
"0.8189301... | 0.8248595 | 14 |
Returns a random labeled dataset. | def fixture_input_data(wrapper_arguments):
n_features, classes = wrapper_arguments
num_data = 50
data = np.random.rand(num_data, n_features)
labels = np.random.choice(classes, size=num_data)
return data, labels | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assign_random_labels(dataset: pd.DataFrame, n_classes: int) -> pd.DataFrame:\n labels = np.zeros(shape=(len(dataset), n_classes))\n labels = pd.DataFrame(labels, columns=[\"l{}\".format(i) for i in range(n_classes)])\n for label in labels.values:\n for cla in range(n_classes):\n labe... | [
"0.73875695",
"0.6786948",
"0.65675145",
"0.6484826",
"0.645497",
"0.6390921",
"0.63362074",
"0.63342875",
"0.6241633",
"0.6209723",
"0.6206563",
"0.61762094",
"0.61379987",
"0.6130341",
"0.6126388",
"0.6120965",
"0.6102047",
"0.6094238",
"0.6084647",
"0.60841554",
"0.6068123... | 0.57182926 | 64 |
Checks that the linear classifier model throws an error if wrong labels are used as input. | def test_train_wrong_labels(mock_classifier, wrapper_arguments, input_data):
mock_classifier.return_value = Mock()
wrapped_model = LinearClassifierModel(*wrapper_arguments)
data, labels = input_data
wrong_labels = labels
wrong_labels[0] = "not_initialized_class"
with pytest.raises(AssertionErro... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_evaluate_wrong_labels(mock_classifier, wrapper_arguments, input_data):\n mock_classifier.return_value = Mock()\n wrapped_model = LinearClassifierModel(*wrapper_arguments)\n data, labels = input_data\n wrong_labels = labels\n wrong_labels[0] = \"not_initialized_class\"\n\n with pytest.rai... | [
"0.70162016",
"0.6596796",
"0.6207182",
"0.61819524",
"0.61724216",
"0.6171075",
"0.61486006",
"0.6040735",
"0.6040735",
"0.5995088",
"0.597207",
"0.59578687",
"0.59483284",
"0.59204865",
"0.59179425",
"0.59169173",
"0.59071946",
"0.5902077",
"0.589556",
"0.5890201",
"0.58733... | 0.7112136 | 0 |
Checks that the linear classifier model throws an error if wrong labels are used as input. | def test_evaluate_wrong_labels(mock_classifier, wrapper_arguments, input_data):
mock_classifier.return_value = Mock()
wrapped_model = LinearClassifierModel(*wrapper_arguments)
data, labels = input_data
wrong_labels = labels
wrong_labels[0] = "not_initialized_class"
with pytest.raises(AssertionE... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_train_wrong_labels(mock_classifier, wrapper_arguments, input_data):\n mock_classifier.return_value = Mock()\n wrapped_model = LinearClassifierModel(*wrapper_arguments)\n data, labels = input_data\n wrong_labels = labels\n wrong_labels[0] = \"not_initialized_class\"\n\n with pytest.raises... | [
"0.7110434",
"0.6597575",
"0.6206473",
"0.61817634",
"0.61737555",
"0.6171343",
"0.61473376",
"0.6041683",
"0.6041683",
"0.5995617",
"0.59730643",
"0.5957797",
"0.5948513",
"0.59206915",
"0.5917823",
"0.5916608",
"0.5907948",
"0.5900792",
"0.58965117",
"0.58897865",
"0.587505... | 0.7015247 | 1 |
r""" Return True if and only if this homomorphism has a trivial kernel. | def is_injective(self, verbose=False):
algebra = self.base_ring()
finite_algebra = algebra.__class__(algebra.prime(), profile=self.profile())
return FP_ModuleMorphism.is_injective(
self.change_ring(finite_algebra),
verbose=verbose) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_trivial(self):\n return self.dims == 0",
"def is_injective(self):\n return self._matrix.kernel().dimension() == 0",
"def is_empty(self):\n return ch.prod(ch.tensor(self.x.shape)).item() == 0",
"def isenhance(kernel):\n length = len(kernel)\n count = 0.0\n\n # if B(i, j) =... | [
"0.6903241",
"0.65487707",
"0.653006",
"0.63655764",
"0.61706007",
"0.6125771",
"0.6106417",
"0.6102352",
"0.6068555",
"0.60209465",
"0.6020802",
"0.59582776",
"0.5953543",
"0.594697",
"0.59442323",
"0.5932855",
"0.5905489",
"0.59015024",
"0.58880293",
"0.5871551",
"0.586312"... | 0.0 | -1 |
get the file path to data files. | def file_path(name):
base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
return os.path.join(base_dir, 'data', name.lower()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getDataPath():\n\treturn \"..\" + os.sep + \"data\" + os.sep",
"def path(self):\n return self._data_file",
"def get_data_path():\n\treturn _paths[_DATA_DIRECTORY_KEY]",
"def get_data_path():\n return os.getcwd() + \"/data/\"",
"def data_path(self):\n raise NotImplementedError",
"def ... | [
"0.8300072",
"0.8241289",
"0.8229929",
"0.8198363",
"0.7958644",
"0.7937459",
"0.7799665",
"0.7782577",
"0.7780533",
"0.77370566",
"0.7693159",
"0.764171",
"0.75637734",
"0.7555965",
"0.7472452",
"0.7442788",
"0.74180096",
"0.7397107",
"0.73833483",
"0.7371238",
"0.73576427",... | 0.7389862 | 18 |
Converting delta datetime to minutes | def convert_time(time_passed):
minutes = time_passed.seconds // 60
return minutes | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_minutes(delta):\n return int(math.ceil(delta.total_seconds() / 60))",
"def time_delta_to_minutes(time_delta):\n return (time_delta.days * 24 * 60) + (time_delta.seconds / 60)",
"def delta2min(time_delta):\n # time_delta.total_seconds() / 60\n return time_delta / pd.Timedelta(minutes=1)",
"... | [
"0.8181742",
"0.8130486",
"0.7532703",
"0.6888096",
"0.678103",
"0.67372805",
"0.67013836",
"0.66944385",
"0.6602517",
"0.651106",
"0.6372096",
"0.6307475",
"0.62887394",
"0.62825507",
"0.6209683",
"0.6200058",
"0.61812025",
"0.6082458",
"0.6067605",
"0.60406214",
"0.6036944"... | 0.6740284 | 5 |
Get the pergeneration mean fitness. | def get_fitness_mean(self):
return self.get_fitness_stat(mean) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def average_fitness(self):\n return sum([e.fitness for e in self.population]) / len(self.population)",
"def get_population_mean(self):\n\t\treturn self.variables.get('population_mean')",
"def fitness(self) -> float:\n return self._fitness",
"def average_population_grade(population):\r\n tota... | [
"0.7803301",
"0.71787584",
"0.71372515",
"0.71364874",
"0.6913973",
"0.69131637",
"0.6905594",
"0.6817561",
"0.6794811",
"0.66514665",
"0.66482604",
"0.65488553",
"0.6542442",
"0.6524524",
"0.65137464",
"0.65137464",
"0.650433",
"0.6503977",
"0.64932597",
"0.64765346",
"0.645... | 0.8043681 | 0 |
Get the pergeneration standard deviation of the fitness. | def get_fitness_stdev(self):
return self.get_fitness_stat(stdev) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def standard_deviation(self):\r\n\t\treturn self.variance()**(1/2)",
"def global_std_deviation(self):\n\n return np.std(self.average_scores_all_subjects(), axis=0)",
"def std_dev(self) -> float:\n return math.sqrt(self.variance())",
"def standard_dev(self):\n return self.variance()**0.5"... | [
"0.76088023",
"0.7393253",
"0.73062134",
"0.7279767",
"0.7274756",
"0.7230499",
"0.715094",
"0.7078528",
"0.7067827",
"0.6957537",
"0.69047874",
"0.68320376",
"0.68123114",
"0.6812042",
"0.6812042",
"0.6811408",
"0.67779607",
"0.6699714",
"0.66983443",
"0.66824543",
"0.668223... | 0.7509829 | 1 |
Get the pergeneration median fitness. | def get_fitness_median(self):
return self.get_fitness_stat(median2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def estimate_median(self):\n return self.estimate_percentile(0.5)",
"def get_median(self):\n return self.serie.median()",
"def medianDegree(self):\n return self._graph.median",
"def median(self):\n # TO DO\n pass",
"def get_median(self):\n if not self.left:\n ... | [
"0.69530004",
"0.68535054",
"0.67228645",
"0.6668791",
"0.6636749",
"0.65827227",
"0.65533626",
"0.64336264",
"0.6421495",
"0.6375153",
"0.6364462",
"0.6322581",
"0.63209295",
"0.6317582",
"0.62696624",
"0.6231595",
"0.62281525",
"0.61946803",
"0.6190863",
"0.6188814",
"0.612... | 0.81567943 | 0 |
Set up commonly used values in tests. | def setUp(self):
self.device_key = "some_key"
self.factory = WAPMF(self.device_key) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n self.params_1 = {\"S\":100,\"K\":100,\"Vol\":0.2,\"R\":0.05,\"T\":1}\n self.params_2 = {\"S\":100,\"K\":100,\"Vol\":0.2,\"R\":0.00,\"T\":1}\n pass",
"def setUp(self):\n self.t = True\n self.f = False\n self.value = 25",
"def setUp(self):\n\n s... | [
"0.68198013",
"0.67609864",
"0.67048514",
"0.6646931",
"0.6577273",
"0.6539432",
"0.6516301",
"0.6511611",
"0.65098864",
"0.6463557",
"0.64459133",
"0.6430749",
"0.64257866",
"0.6424057",
"0.6405252",
"0.64021075",
"0.6401771",
"0.6395533",
"0.6380763",
"0.63797104",
"0.63736... | 0.0 | -1 |
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`. | def plot_confusion_matrix(cm, classes,
normalize=False,
title='Confusion matrix',
cmap=plt.cm.Blues):
if normalize:
cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]
print("Normalized confusion matrix")
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_confusion_matrix(cm, classes=[0,1], normalize=False, title='Confusion matrix', print_matrix=False):\n\n if normalize:\n cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n print(\"Normalized confusion matrix\")\n else:\n print('Confusion matrix, without normalization')\n\n... | [
"0.8194862",
"0.80949175",
"0.8029915",
"0.8019153",
"0.79941195",
"0.7991258",
"0.7980955",
"0.7976606",
"0.79610753",
"0.79590565",
"0.79378676",
"0.7934962",
"0.7934504",
"0.79313844",
"0.7926313",
"0.7924577",
"0.79241234",
"0.7923211",
"0.7923023",
"0.7921931",
"0.791787... | 0.7814644 | 96 |
Test a browser rendering of about page. | def test_about(self):
self.selenium.get('{}/about'.format(self.live_server_url)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_about(self):\n\t\tresponse = self.client.get('/about')\n\t\tself.assertContains(response, 'About', 3, 200)",
"def test_aboutpage_view(self):\n response = self.client.get(url_for('about'))\n self.assertEqual(response.status_code, 200)",
"def about_page_test(self):\r\n # default for... | [
"0.75224",
"0.751587",
"0.7467261",
"0.7431765",
"0.7332179",
"0.733196",
"0.7263237",
"0.7257342",
"0.7048715",
"0.7030121",
"0.7007658",
"0.6959074",
"0.6889133",
"0.6859753",
"0.67994165",
"0.67304534",
"0.66603196",
"0.6622727",
"0.66139585",
"0.65969247",
"0.6589599",
... | 0.80826455 | 0 |
Test a browser rendering of home page. | def test_home(self):
self.selenium.get('{}/'.format(self.live_server_url)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_home_page(self):\n\n self.browser.get('http://localhost:8000/index.html')\n\n # there is a page title defined by <title></title> on the home page\n # check it\n\n self.assertIn('Stability within Movement',self.browser.title)\n\n # You will have an image for your home pag... | [
"0.77406085",
"0.75502485",
"0.7529317",
"0.74661803",
"0.7454214",
"0.7454214",
"0.7390457",
"0.7338987",
"0.72208196",
"0.71934897",
"0.71644086",
"0.71535635",
"0.70737803",
"0.70722103",
"0.7058205",
"0.70205647",
"0.7016932",
"0.70007384",
"0.6988044",
"0.69845355",
"0.6... | 0.74651206 | 4 |
Raises a sensible error when `expected_shape` does not match the actual shape of this internal. | def _check_shape(self, obj, expected_shape):
if self.shape != expected_shape:
raise ValueError(
'%s expects internal signal %s to be %s, but it is %s' % (
obj, self.name, Shaped(expected_shape).describe_shape(),
self.describe_shape())) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assert_shape(tensor, shape, name):\n real_shape = tensor.get_shape().as_list()\n same_rank = len(real_shape) == len(shape)\n all_equal = all([(s == r or s == -1) for s, r in zip(shape, real_shape)])\n if not same_rank or not all_equal:\n raise tf.errors.InvalidArgumentError(\n 'Error: Expected te... | [
"0.72354573",
"0.72242576",
"0.72138286",
"0.7040485",
"0.69634986",
"0.69407386",
"0.6933494",
"0.690346",
"0.68564135",
"0.6825397",
"0.67985356",
"0.6783065",
"0.66512746",
"0.6626737",
"0.65925545",
"0.6590281",
"0.65885615",
"0.6554043",
"0.65492815",
"0.65293545",
"0.64... | 0.8135042 | 0 |
VHDL variable name to use for driving this signal. | def drive_name(self):
if self.is_strobe():
return 'intsigs_%s' % self.name
return 'intsig_%s' % self.name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self):\n return '{} {} {}'.format(self.var_period, self.var_type,\n self.var_detail)",
"def name(self):\n return f\"{self.device_name} {self.device_variable}\"",
"def name(self):\n return f'{self._vehicle.name} {self.wan_name} Signal'",
"def var(s... | [
"0.71870327",
"0.68501693",
"0.6699323",
"0.66339576",
"0.663244",
"0.64283246",
"0.64283246",
"0.64283246",
"0.6358863",
"0.63532263",
"0.6351002",
"0.63064194",
"0.6294732",
"0.62599975",
"0.6257935",
"0.6231208",
"0.619541",
"0.619541",
"0.6194887",
"0.609904",
"0.60967404... | 0.0 | -1 |
VHDL variable name to use for reading this signal. | def use_name(self):
if self.is_strobe():
return 'intsigr_%s' % self.name
return 'intsig_%s' % self.name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self):\n return '{} {} {}'.format(self.var_period, self.var_type,\n self.var_detail)",
"def var(self, name):\n raise NotImplementedError",
"def getVariable(self, varName):\n return self[varName]",
"def var(self, name):\n return self.get_gro... | [
"0.67126006",
"0.65343505",
"0.6443804",
"0.6396916",
"0.6396916",
"0.6396916",
"0.6366455",
"0.6241869",
"0.62288713",
"0.6193571",
"0.6186896",
"0.60898983",
"0.60833",
"0.6081899",
"0.6080032",
"0.6071777",
"0.6058282",
"0.6045307",
"0.5988761",
"0.59775615",
"0.5976835",
... | 0.0 | -1 |
Given an entity, return the political affiliation of that entity if one is available. Otherwise, return 'None found'. | def entity_to_political_party(self, entity, building_dict=True, lookup_enabled=True, dict_allowed=True):
entity_name, ent_type = entity
# If already in dictionary, return dict entry instead of looking on Wikipedia
if dict_allowed and entity_name.lower() in self.ent_dict:
try:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wsgc_affiliate(self, instance):\r\n reggie = instance.user.profile.get_registration()\r\n try:\r\n wsgc_affiliate = reggie.wsgc_affiliate\r\n except Exception:\r\n wsgc_affiliate = None\r\n try:\r\n if wsgc_affiliate.name == 'Other':\r\n ... | [
"0.59103745",
"0.58128136",
"0.5796615",
"0.5675816",
"0.551549",
"0.5233092",
"0.5173053",
"0.51131594",
"0.5101729",
"0.5072412",
"0.503142",
"0.49949446",
"0.49842256",
"0.49208355",
"0.49196157",
"0.48972735",
"0.48874384",
"0.4877251",
"0.48525777",
"0.4844203",
"0.48195... | 0.54965794 | 5 |
Check if value is iterable if value is iterable, it returns True. | def isIterable(value):
try:
iter(value)
return True
except:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _is_iterable(value):\n return isinstance(value, list) or isinstance(value, tuple)",
"def is_iterable(value):\n # noinspection PyUnresolvedReferences\n return hasattr(value, '__iter__') and hasattr(value, '__getitem__')",
"def isiterable(x):\n try:\n iter(x)\n return True\n ... | [
"0.8431681",
"0.83536625",
"0.82284427",
"0.82263345",
"0.81933695",
"0.8079945",
"0.80715984",
"0.7925328",
"0.78486764",
"0.78391105",
"0.78359526",
"0.78167224",
"0.7697836",
"0.7668988",
"0.7596915",
"0.7592618",
"0.75574476",
"0.7501975",
"0.7394501",
"0.7393762",
"0.738... | 0.88137597 | 0 |
Compute the accuracy of prediction given the labels. | def compute_acc_unsupervised(emb, graph):
train_mask = graph.ndata['train_mask']
test_mask = graph.ndata['test_mask']
val_mask = graph.ndata['val_mask']
train_nids = torch.LongTensor(np.nonzero(train_mask)).squeeze().cpu().numpy()
val_nids = torch.LongTensor(np.nonzero(val_mask)).squeeze().cpu().nu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def accuracy(preds, labels):\n correct = preds == labels\n return correct.sum().float() / correct.shape[0]",
"def accuracy(labels, preds):\n\tassert labels.shape[0]==preds.shape[0]\n\treturn np.sum(preds==labels)/float(labels.shape[0])",
"def accuracy(predictions, labels):\n return (100.0 * np... | [
"0.9071727",
"0.88519585",
"0.8827697",
"0.8705641",
"0.867338",
"0.8662161",
"0.8652662",
"0.8632878",
"0.85964775",
"0.84195536",
"0.83260214",
"0.82963693",
"0.81954473",
"0.8182062",
"0.81582314",
"0.8148542",
"0.81409615",
"0.8133342",
"0.8127938",
"0.8127938",
"0.812690... | 0.0 | -1 |
Infers the common shape of an iterable of arraylikes (assuming all are of the same dimensionality). Inconsistent dimensions are replaced with `None`. | def common_shape(arrays):
arrays = iter(arrays)
shape = next(arrays).shape
for array in arrays:
shape = tuple(a if a == b else None
for a, b in zip(shape, array.shape))
return shape | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def as_same_dimension(*arrays):\n ndim = arrays[0].ndim\n for a in arrays:\n if a.ndim == ndim:\n continue\n # XXX could try broadcasting here\n raise ValueError(\"Invalid array dimensions: %s vs %s\" % (ndim, a.ndim))\n return arrays",
"def standardize_single_array(x):\n... | [
"0.6311127",
"0.60749906",
"0.6035019",
"0.6028536",
"0.5912532",
"0.586066",
"0.5740297",
"0.5736857",
"0.56783897",
"0.566291",
"0.56438595",
"0.5540744",
"0.5540744",
"0.5540744",
"0.5525927",
"0.5490167",
"0.5486984",
"0.54779214",
"0.54551077",
"0.54502577",
"0.5388037",... | 0.67230785 | 0 |
Returns the file name without path and without file extension. | def get_itemid(filename):
return os.path.splitext(os.path.basename(filename))[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name_sans_ext(self) -> str:\n return os.path.splitext(self.path)[0]",
"def get_file_name(file):\n return os.path.splitext(os.path.basename(file))[0]",
"def get_file_name(path: str) -> str:\n return os.path.splitext(os.path.basename(path))[0]",
"def get_file_name(self):\n return self.p... | [
"0.84342027",
"0.8030437",
"0.7982178",
"0.79480875",
"0.79451966",
"0.794215",
"0.79396355",
"0.79161084",
"0.7869143",
"0.78475106",
"0.7790727",
"0.7778952",
"0.7767677",
"0.7717451",
"0.7708506",
"0.76435417",
"0.76374817",
"0.76316994",
"0.7631067",
"0.7623275",
"0.76187... | 0.0 | -1 |
Creates a khot vector of length `num_classes` with 1.0 at every index in `classes`. | def make_multilabel_target(num_classes, classes):
target = np.zeros(num_classes, dtype=np.uint8)
target[classes] = 1
return target | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def one_hot(class_ids, num_classes):\n oh = np.zeros((len(class_ids), num_classes), dtype=np.float32)\n oh[np.arange(len(class_ids)), class_ids] = 1\n\n assert (oh.argmax(axis=1) == class_ids).all()\n assert (oh.sum(axis=1) == 1).all()\n\n return oh",
"def to_one_hot(class_indices, num_classes):\n... | [
"0.75396484",
"0.7503581",
"0.73860186",
"0.73860186",
"0.73162496",
"0.7231835",
"0.717281",
"0.7113684",
"0.71107954",
"0.71089983",
"0.70890075",
"0.7061369",
"0.7061369",
"0.70590544",
"0.7051777",
"0.70454144",
"0.6986073",
"0.6981101",
"0.6937607",
"0.69373286",
"0.6933... | 0.64384764 | 67 |
Full filepath to the QML style file. | def style_filepath(self) -> Union[Path, None]:
if self.style is None:
return None
return get_style_filepath(self.style) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def qml(self):\n return self.default_style(\"QML\")",
"def css_file(self):\n pass",
"def load_style() -> str:\n return '<style id=\"scipp-style-sheet\">' + load_style_sheet() + '</style>'",
"def get_html_theme_path():\n theme_path = os.path.abspath(Path(__file__).parent)\n return theme... | [
"0.67198914",
"0.6175416",
"0.57624984",
"0.576201",
"0.5761419",
"0.5697186",
"0.5668058",
"0.56571805",
"0.5642963",
"0.56400967",
"0.5627969",
"0.56203437",
"0.56057805",
"0.5549793",
"0.54678786",
"0.5461109",
"0.5453014",
"0.54285324",
"0.5399566",
"0.53830653",
"0.53707... | 0.62612987 | 1 |
Recompute and update the batch norm stats to make them more precise. During training both BN stats and the weight are changing after every iteration, so the running average can not precisely reflect the actual stats of the current model. In this function, the BN stats are recomputed with fixed weights, to make the runn... | def update_bn_stats(
model: nn.Module,
data_loader: Iterable[Any],
num_iters: int = 200,
by_epoch: bool = False):
bn_layers = get_bn_modules(model)
if len(bn_layers) == 0:
return
momentum_actual = [bn.momentum for bn in bn_layers]
for bn in bn_layers:
bn.momentum = 1.0
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def batchnorm_forward(x, gamma, beta, bn_param):\n mode = bn_param['mode']\n eps = bn_param.get('eps', 1e-5)\n momentum = bn_param.get('momentum', 0.9)\n\n N, D = x.shape\n running_mean = bn_param.get('running_mean', np.zeros(D, dtype=x.dtype))\n running_var = bn_param.get('running_var', np.zeros... | [
"0.70496625",
"0.70293885",
"0.70059633",
"0.6954984",
"0.6871671",
"0.6850107",
"0.6724652",
"0.6721841",
"0.6720613",
"0.6711663",
"0.6710707",
"0.6693435",
"0.6683277",
"0.6617421",
"0.6569398",
"0.6545393",
"0.65435",
"0.65435",
"0.65312237",
"0.65253",
"0.6518139",
"0.... | 0.63914526 | 26 |
Find all BatchNorm (BN) modules that are in training mode. See fvcore.precise_bn.BN_MODULE_TYPES for a list of all modules that are included in this search. | def get_bn_modules(model: nn.Module) -> List[nn.Module]:
bn_layers = [
m for m in model.modules() if m.training and isinstance(m, BN_MODULE_TYPES)
]
return bn_layers | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trainFreezeBN(self):\n\t\tprint(\"Freezing Mean/Var of BatchNorm2D.\")\n\t\tprint(\"Freezing Weight/Bias of BatchNorm2D.\")\n\t\tfor m in self.modules():\n\t\t\tif isinstance(m, nn.BatchNorm2d):\n\t\t\t\tm.eval()\n\t\t\t\tm.weight.requires_grad = False\n\t\t\t\tm.bias.requires_grad = False",
"def trainFreeze... | [
"0.6272068",
"0.6272068",
"0.609218",
"0.5904157",
"0.5815117",
"0.57882863",
"0.56975883",
"0.56968665",
"0.5578572",
"0.5563816",
"0.55359036",
"0.5528026",
"0.5519034",
"0.5519034",
"0.55170214",
"0.55133545",
"0.54680794",
"0.53865564",
"0.53706515",
"0.53471404",
"0.5324... | 0.72638524 | 0 |
Initialize attributes to describe a car. | def __init__(self, make, model, year):
self.make = make
self.model = model
self.year = year
self.odometer_reading = 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, car):\n super(self.__class__, self).__init__(car)\n self.coordinator_name = car.get_faulty_coordinator_name()\n self.second_at_charge_name = car.get_second_at_charge_name()\n self.coordinated_car_name = car.get_corrected_coordinated_car_name()\n self.following_... | [
"0.7500984",
"0.7397504",
"0.6964254",
"0.69572306",
"0.68612015",
"0.671638",
"0.6585787",
"0.6585787",
"0.6585787",
"0.6455301",
"0.6448016",
"0.64400023",
"0.6431852",
"0.63737345",
"0.63079256",
"0.62494457",
"0.6206326",
"0.6174237",
"0.6162698",
"0.61395067",
"0.6102099... | 0.5570608 | 72 |
Initialises the pupil function as a real circular step function of value 1 | def initP0(self, size, radius):
return h.circle(size, radius)[:, :, 0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pi(self):\n return self(self._real_field().pi())",
"def P0(self):\n if not self.isVaild():\n pass\n temp = ((self.r()**self.C)*self.C) / \\\n (math.factorial(self.C)*(self.C - self.r()))\n temp2 = 0\n for i in range(0, self.C):\n temp3 = ((s... | [
"0.5705908",
"0.5674653",
"0.5663209",
"0.554762",
"0.5532812",
"0.54937106",
"0.5440735",
"0.54149765",
"0.54074836",
"0.53754187",
"0.53523886",
"0.53503454",
"0.533067",
"0.53212917",
"0.5297973",
"0.5282385",
"0.5280658",
"0.52611715",
"0.5261054",
"0.52586544",
"0.524411... | 0.51103586 | 41 |
Transforms a given text to its lemmatized form. Assumes clean text separated by spaces. | def remove_stopwords_set(sentence: str, stop_words: Collection[str]) -> str:
return " ".join([w for w in word_tokenize(sentence) if w not in stop_words]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lemmatize_words(text: str, lemmatizer=WordNetLemmatizer()) -> str:\n return ' '.join(lemmatizer.lemmatize(word) for word in text.split())",
"def lemmatize(text):\n\n lem = WordNetLemmatizer()\n return ' '.join(list(map(lambda x: lem.lemmatize(x, 'v'),\n text.split())))",
"def le... | [
"0.8325147",
"0.82353944",
"0.8188808",
"0.807453",
"0.7722582",
"0.7680182",
"0.7645914",
"0.76116306",
"0.75722176",
"0.74764687",
"0.7458086",
"0.74217445",
"0.7343142",
"0.72684515",
"0.72594",
"0.7239799",
"0.72364676",
"0.72202444",
"0.71992624",
"0.71592456",
"0.715035... | 0.0 | -1 |
Generate the positions DataFrame, based on the signals provided by the 'signals' DataFrame. | def generate_positions(self):
positions = pd.DataFrame(index=self.signals.index).fillna(0.0)
for algo in self.algos:
positions[algo] = self.shares*self.signals[algo]
return positions | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_signals(self):\n return QFDataFrame(data=self._signals, index=self._signals_dates)",
"def base_to_signal_mapping(grp):\n\n position_in_signal = [0 for _ in range(5)]\n for i in range(1, len(grp)):\n position_in_signal += [i for _ in range(grp[i][5])]\n # position_in_signal += [... | [
"0.5889015",
"0.5505957",
"0.54773927",
"0.5429316",
"0.525371",
"0.5136594",
"0.51193076",
"0.50882554",
"0.5058506",
"0.5022489",
"0.50096154",
"0.49994406",
"0.49521428",
"0.49482527",
"0.4945336",
"0.49416083",
"0.49410614",
"0.4913745",
"0.49040717",
"0.48893058",
"0.488... | 0.71387136 | 0 |
add gradual shadow vertically. | def gradualShadeV(img, brightness, direction=0, min_b=0.35, max_b=1.5):
h, _, _ = img.shape
img2 = np.float32(img)
half = brightness / 2.0
alpha = max(min_b, 1 - half)
beta = min(max_b, alpha + brightness)
delta = (beta - alpha) / float(h)
t = alpha
if direction % 2 == 0:
t = b... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def DrawVerticalGradient(self, dc, rect, hasfocus):\r\n\r\n oldpen = dc.GetPen()\r\n oldbrush = dc.GetBrush()\r\n dc.SetPen(wx.TRANSPARENT_PEN)\r\n\r\n # calculate gradient coefficients\r\n if hasfocus:\r\n col2 = self._secondcolour\r\n col1 = self._firstcol... | [
"0.5278003",
"0.5277403",
"0.52709943",
"0.51464826",
"0.5138528",
"0.50653166",
"0.49792486",
"0.49391317",
"0.49017125",
"0.4826543",
"0.48072848",
"0.4804083",
"0.47906247",
"0.47609577",
"0.47080192",
"0.4670744",
"0.46527514",
"0.4643053",
"0.4634156",
"0.46209332",
"0.4... | 0.5067547 | 5 |
Returns a single cluster response to a passed trial | def get_single_cluster_trial_response(self, trial_name, cluster_index, *, pre_trial_window=0.5, post_trial_window=0.5):
assert trial_name in self.trial_names, 'Trial is not in any recording'
cluster = np.concatenate([rec.get_good_clusters() for rec in self.recordings])[cluster_index]
re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def describe_cluster_response():\n return {\n \"cluster\": {\n \"status\": \"ACTIVE\",\n \"endpoint\": \"https://endpoint.amazonaws.com\",\n \"name\": EXAMPLE_NAME,\n \"certificateAuthority\": {\n \"data\": \"LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tD... | [
"0.6487583",
"0.615691",
"0.6145092",
"0.6120403",
"0.6074275",
"0.6046672",
"0.5971348",
"0.5865875",
"0.5767551",
"0.56833667",
"0.56329894",
"0.56275904",
"0.54827094",
"0.547546",
"0.5462176",
"0.5430654",
"0.54040766",
"0.52769643",
"0.5270493",
"0.52493095",
"0.5237358"... | 0.70883596 | 0 |
Constructor for the CustomerAccount class | def __init__(self,
id=None,
number=None,
name=None,
balance=None,
mtype=None,
status=None,
customer_id=None,
institution_id=None,
balance_date=None,
c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, customer, bank, acnt, limit):\n self._customer = customer\n self._bank = bank\n self._account = acnt\n self._limit = limit\n self._balance = 0",
"def __init__(self, customer, bank, account, limit, bank_bal = 0):\n\n self._customer = customer\n s... | [
"0.7792473",
"0.7723838",
"0.7711047",
"0.76523674",
"0.73038244",
"0.7286186",
"0.72582436",
"0.7083018",
"0.70752746",
"0.70624447",
"0.7056807",
"0.70492035",
"0.6902671",
"0.6801875",
"0.67770815",
"0.67457324",
"0.67373705",
"0.6700496",
"0.6691002",
"0.6637917",
"0.6562... | 0.5900596 | 71 |
Creates an instance of this model from a dictionary | def from_dictionary(cls,
dictionary):
if dictionary is None:
return None
json_data = copy.deepcopy(dictionary)
# Extract variables from the dictionary
id = dictionary.get('id')
number = dictionary.get('number')
name = dictionary.get('... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_dictionary(cls,\n dictionary):\n if dictionary is None:\n return None\n\n # Extract variables from the dictionary\n id = dictionary.get('id')\n name = dictionary.get('name')\n mtype = dictionary.get('type')\n usage_bytes = diction... | [
"0.83181584",
"0.8168118",
"0.8168118",
"0.8118749",
"0.8089047",
"0.79787344",
"0.7949278",
"0.79231393",
"0.7898951",
"0.78923255",
"0.788838",
"0.7882321",
"0.7882212",
"0.7876749",
"0.78585315",
"0.7836853",
"0.7801407",
"0.7801407",
"0.7801407",
"0.7801407",
"0.7801407",... | 0.0 | -1 |
Constructs a ResNet50 model. | def resnet50_srelu(pretrained=False, **kwargs):
model = ResNet(BottleNeckSReLU, [3, 4, 6, 3], **kwargs)
model.relu = SoftReLU()
return model | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resnet50(pretrained=False, **kwargs):\n model = ResNet(Bottleneck, [3, 4, 6, 3], **kwargs)\n if pretrained:\n model.load_state_dict(model_zoo.load_url(model_urls['resnet50']))\n fc = transfer_fc(model.fc)\n model.fc = fc\n return model",
"def resnet50(**kwargs):\n model = ResNet(... | [
"0.7557751",
"0.75548905",
"0.74759895",
"0.74759895",
"0.74759895",
"0.74759895",
"0.74557495",
"0.7386862",
"0.7386862",
"0.73601955",
"0.7355623",
"0.724254",
"0.724254",
"0.7191571",
"0.7158499",
"0.7101107",
"0.70165247",
"0.69687796",
"0.68687624",
"0.6822836",
"0.68010... | 0.59007484 | 97 |
Constructs a ResNet50 model. | def resnet50(num_classes=1000, pretrained='imagenet'):
model = resnet50_srelu(pretrained=False)
if pretrained is not None:
settings = pretrained_settings['resnet50'][pretrained]
model = load_pretrained(model, num_classes, settings)
model = modify_resnets(model)
return model | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resnet50(pretrained=False, **kwargs):\n model = ResNet(Bottleneck, [3, 4, 6, 3], **kwargs)\n if pretrained:\n model.load_state_dict(model_zoo.load_url(model_urls['resnet50']))\n fc = transfer_fc(model.fc)\n model.fc = fc\n return model",
"def resnet50(**kwargs):\n model = ResNet(... | [
"0.7557751",
"0.75548905",
"0.74759895",
"0.74759895",
"0.74759895",
"0.74759895",
"0.74557495",
"0.7386862",
"0.7386862",
"0.73601955",
"0.7355623",
"0.724254",
"0.724254",
"0.7191571",
"0.7158499",
"0.7101107",
"0.69687796",
"0.68687624",
"0.6822836",
"0.6801022",
"0.673301... | 0.70165247 | 16 |
Set up the test scaffolding | def setUp(self):
self.schema = {
"name": "Country",
"id": "#Country",
"properties": {
"name": {"type": "string"},
"abbreviation": {"type": "string"},
"languages": {"type": ["array", "null"], "items": {"type": "string"}},
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n self.app = create_app(config_name=\"testing\")\n self.client = self.app.test_client\n self.category = {'category_name': 'Stews'}\n\n # binds the app to the current context\n with self.app.app_context():\n # create all tables\n db.create_al... | [
"0.71576583",
"0.692548",
"0.68858683",
"0.6870665",
"0.68536156",
"0.684587",
"0.67811084",
"0.67510015",
"0.67510015",
"0.67316914",
"0.67210525",
"0.67005813",
"0.66957575",
"0.6664818",
"0.66631454",
"0.6650878",
"0.6650878",
"0.6645456",
"0.6645456",
"0.6645456",
"0.6644... | 0.0 | -1 |
Gets and sets the originalStartTimeZone | def original_start_time_zone(self):
if "originalStartTimeZone" in self._prop_dict:
return self._prop_dict["originalStartTimeZone"]
else:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def original_end_time_zone(self):\n if \"originalEndTimeZone\" in self._prop_dict:\n return self._prop_dict[\"originalEndTimeZone\"]\n else:\n return None",
"def original_start(self):\n if \"originalStart\" in self._prop_dict:\n return datetime.strptime(self.... | [
"0.64996535",
"0.6192951",
"0.5967887",
"0.58197635",
"0.5790269",
"0.5743967",
"0.57416403",
"0.56874007",
"0.56842536",
"0.5681942",
"0.56812644",
"0.56752443",
"0.5629361",
"0.5547581",
"0.5518309",
"0.5509743",
"0.54922193",
"0.54895127",
"0.54794633",
"0.5476835",
"0.544... | 0.83052355 | 0 |
Gets and sets the originalEndTimeZone | def original_end_time_zone(self):
if "originalEndTimeZone" in self._prop_dict:
return self._prop_dict["originalEndTimeZone"]
else:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def end(self):\n if \"end\" in self._prop_dict:\n if isinstance(self._prop_dict[\"end\"], OneDriveObjectBase):\n return self._prop_dict[\"end\"]\n else :\n self._prop_dict[\"end\"] = DateTimeTimeZone(self._prop_dict[\"end\"])\n return self._... | [
"0.68946385",
"0.6608553",
"0.65355784",
"0.6509233",
"0.62346625",
"0.6223961",
"0.62082595",
"0.61971325",
"0.6111875",
"0.60923195",
"0.60189545",
"0.59361607",
"0.5901024",
"0.5892767",
"0.5892767",
"0.5892767",
"0.5892767",
"0.5892767",
"0.5892767",
"0.5868117",
"0.58681... | 0.85490453 | 0 |
Gets and sets the isReminderOn | def is_reminder_on(self):
if "isReminderOn" in self._prop_dict:
return self._prop_dict["isReminderOn"]
else:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_reminder_on(self):\n return self.__is_reminder_on",
"def reminder(self):\n return self._reminder",
"def reminder(self, reminder):\n\n self._reminder = reminder",
"def get_on(self):\n return self._on",
"def send_reminder(self):\n pass",
"def is_on(self):\n ... | [
"0.83681226",
"0.7366879",
"0.64288884",
"0.63457566",
"0.6296808",
"0.6176612",
"0.61578524",
"0.61578524",
"0.61578524",
"0.61578524",
"0.61578524",
"0.61578524",
"0.61578524",
"0.61578524",
"0.61578524",
"0.61578524",
"0.61578524",
"0.61003137",
"0.59261525",
"0.58106935",
... | 0.8640008 | 0 |
Gets and sets the hasAttachments | def has_attachments(self):
if "hasAttachments" in self._prop_dict:
return self._prop_dict["hasAttachments"]
else:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def support_attachments(self) -> ConfigNodePropertyBoolean:\n return self._support_attachments",
"def _has_attachment(self):\n ATTACHMENT = self.env['ir.attachment']\n for ticket in self:\n attachments = ATTACHMENT.search([\n ('res_id', '=', ticket.id),\n ... | [
"0.67507243",
"0.67041194",
"0.651",
"0.64856315",
"0.6291282",
"0.627325",
"0.62320924",
"0.6196996",
"0.6075222",
"0.6059664",
"0.6012935",
"0.5983826",
"0.58908194",
"0.5841896",
"0.5739594",
"0.57385767",
"0.5725813",
"0.5543804",
"0.5524178",
"0.55160356",
"0.5405152",
... | 0.83772117 | 0 |
Gets and sets the subject | def subject(self):
if "subject" in self._prop_dict:
return self._prop_dict["subject"]
else:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subject(self, value):\n self.set_property(\"subject\", value)",
"def get_subject(self):\n return self._subject",
"def subject(self):\n return self.__subject",
"def subject(self):\n return self._subject",
"def subject(self):\n return self.get(\"subject\")",
"def subj... | [
"0.8342096",
"0.829388",
"0.8193849",
"0.81898236",
"0.81511325",
"0.8144604",
"0.80689555",
"0.8061106",
"0.8006155",
"0.7946623",
"0.7946623",
"0.7946623",
"0.7864578",
"0.7864578",
"0.7830554",
"0.7830554",
"0.76639825",
"0.74752796",
"0.74151593",
"0.74040616",
"0.7291813... | 0.78584194 | 14 |
Gets and sets the type | def type(self):
if "type" in self._prop_dict:
if isinstance(self._prop_dict["type"], OneDriveObjectBase):
return self._prop_dict["type"]
else :
self._prop_dict["type"] = EventType(self._prop_dict["type"])
return self._prop_dict["type"]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_type(self, type):\n self.type = type",
"def set_type(self, type):\n self.type = type",
"def _get_type(self):\n return self.__type",
"def _get_type(self):\n return self.__type",
"def _get_type(self):\n return self.__type",
"def _get_type(self):\n return self.__type",
"d... | [
"0.8025164",
"0.8025164",
"0.7905535",
"0.7905535",
"0.7905535",
"0.7905535",
"0.7905535",
"0.7905535",
"0.7905535",
"0.7905535",
"0.7905535",
"0.7905535",
"0.7905535",
"0.7905535",
"0.7905535",
"0.7905535",
"0.7905535",
"0.7905535",
"0.7905535",
"0.7905535",
"0.7905535",
"... | 0.0 | -1 |
Gets and sets the organizer | def organizer(self):
if "organizer" in self._prop_dict:
if isinstance(self._prop_dict["organizer"], OneDriveObjectBase):
return self._prop_dict["organizer"]
else :
self._prop_dict["organizer"] = Recipient(self._prop_dict["organizer"])
retur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def organizer(self):\n return self.__organizer",
"def is_organizer(self):\n if \"isOrganizer\" in self._prop_dict:\n return self._prop_dict[\"isOrganizer\"]\n else:\n return None",
"def add_organizer(self):\n principal = self.client.principal()\n ## TODO... | [
"0.8029385",
"0.66902566",
"0.66554755",
"0.6089599",
"0.593489",
"0.5748408",
"0.5657248",
"0.56203043",
"0.5598347",
"0.55157906",
"0.5515202",
"0.55074334",
"0.54486424",
"0.54486424",
"0.54486424",
"0.53705543",
"0.536448",
"0.5338768",
"0.5335882",
"0.53047544",
"0.52697... | 0.75690687 | 1 |
Gets and sets the onlineMeetingUrl | def online_meeting_url(self):
if "onlineMeetingUrl" in self._prop_dict:
return self._prop_dict["onlineMeetingUrl"]
else:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def marketing_url(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"marketing_url\")",
"def join_url(self) -> str:\n return f\"https://meet.allmende.io/{self.uuid}\"",
"def marketing_url(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"marketing_url\")",
... | [
"0.6156503",
"0.6001205",
"0.59455806",
"0.59455806",
"0.5787941",
"0.5672921",
"0.5672921",
"0.5653182",
"0.5653182",
"0.5589596",
"0.55533785",
"0.5510201",
"0.5466163",
"0.5430354",
"0.5417716",
"0.53929937",
"0.53665304",
"0.53612226",
"0.53548825",
"0.5330924",
"0.532928... | 0.8622252 | 0 |
Gets and sets the attachments | def attachments(self):
if "attachments" in self._prop_dict:
return AttachmentsCollectionPage(self._prop_dict["attachments"])
else:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attachments(self):\n return self._attachments",
"def attachments(self, attachments):\n\n self._attachments = attachments",
"def set_attachments(self):\n self.response['attachments'] = []",
"def attachments(self):\n return self.properties.get('attachments',\n ... | [
"0.76437557",
"0.76413935",
"0.7576477",
"0.74786353",
"0.74176276",
"0.7019562",
"0.6985797",
"0.6839894",
"0.6577468",
"0.6346749",
"0.63310397",
"0.6199655",
"0.61806154",
"0.61744153",
"0.61624384",
"0.61411107",
"0.6124371",
"0.6087513",
"0.60662776",
"0.60544384",
"0.59... | 0.69728386 | 7 |
Return a string representation of treap. | def __repr__(self):
lines = []
nodes = [(self.root, 0)]
while nodes:
node, indent = nodes.pop()
name = str(node) if node else 'None'
lines.append(' ' * indent + name)
if node:
nodes.append((node.child[True], indent + 1))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self, depth=1):\n if self.isLeaf():\n return \"Predict: \\\"{:s}\\\"\".format(str(self.predict))\n else:\n s = \"if features[{:d}] != \\\"{:s}\\\" then:\\n {:s} \\n{:s}else:\\n {:s}\"\n return s.format(self.feature, \n str(self.v... | [
"0.6569541",
"0.6564553",
"0.6288253",
"0.6239516",
"0.6198712",
"0.6157606",
"0.61191803",
"0.60998636",
"0.6080329",
"0.6078113",
"0.60558754",
"0.60331213",
"0.600741",
"0.600741",
"0.6001885",
"0.5998371",
"0.5995466",
"0.5989622",
"0.59403855",
"0.59403855",
"0.5899942",... | 0.0 | -1 |
Retrieve all budgeted expenses for the specified period | def active_budgeted_expenses_by_period(ledger_id: int, year: int, period: int):
active_budget = ActiveBudgetModel.find_by_year(ledger_id, year)
if not active_budget:
raise NotFound("No active budget found")
return budgeted_expenses_by_period(active_budget.budget_id, period) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def budgeted_expenses_by_period(budget_id: int, period: int):\n budget = BudgetModel.query.get_or_404(budget_id)\n if period < 0 or period >= budget.periods:\n raise NotFound(\"Invalid period\")\n\n expenses_by_envelope = {}\n\n periodic_expenses = BudgetPeriodicExpenseModel.find_by_budget_id(bu... | [
"0.78203267",
"0.6825508",
"0.668888",
"0.65180045",
"0.62607527",
"0.62220967",
"0.607252",
"0.6005905",
"0.59967965",
"0.58637214",
"0.5805157",
"0.57737756",
"0.57145876",
"0.57000726",
"0.5682976",
"0.56776744",
"0.5563128",
"0.5546513",
"0.5543273",
"0.5532565",
"0.54836... | 0.76533157 | 1 |
Retrieve all budgeted expenses for the specified period | def budgeted_expenses_by_period(budget_id: int, period: int):
budget = BudgetModel.query.get_or_404(budget_id)
if period < 0 or period >= budget.periods:
raise NotFound("Invalid period")
expenses_by_envelope = {}
periodic_expenses = BudgetPeriodicExpenseModel.find_by_budget_id(budget.id)
f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def active_budgeted_expenses_by_period(ledger_id: int, year: int, period: int):\n active_budget = ActiveBudgetModel.find_by_year(ledger_id, year)\n if not active_budget:\n raise NotFound(\"No active budget found\")\n return budgeted_expenses_by_period(active_budget.budget_id, period)",
"def get_e... | [
"0.76533157",
"0.6825508",
"0.668888",
"0.65180045",
"0.62607527",
"0.62220967",
"0.607252",
"0.6005905",
"0.59967965",
"0.58637214",
"0.5805157",
"0.57737756",
"0.57145876",
"0.57000726",
"0.5682976",
"0.56776744",
"0.5563128",
"0.5546513",
"0.5543273",
"0.5532565",
"0.54836... | 0.78203267 | 0 |
Import a JSON file as a dictionary. | def import_json(self) -> dict:
with open(self.path, encoding="utf8") as json_file:
return json.load(json_file) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def importJSON(path_to_json) -> dict:\n try:\n with open(path_to_json, 'r') as f:\n json_data = json.load(f)\n return(json_data)\n except Exception as error:\n print(f\"Error: importJSON({path_to_json}) -> {error}\")",
"def load_json(filename: str) -> Dict:\n \n with o... | [
"0.8132251",
"0.78092873",
"0.7569825",
"0.75547385",
"0.75534666",
"0.7481352",
"0.7439165",
"0.7397945",
"0.7374938",
"0.7351664",
"0.7289676",
"0.7285432",
"0.72298884",
"0.7197911",
"0.71824056",
"0.7176398",
"0.7174046",
"0.7158838",
"0.71412903",
"0.7139101",
"0.7132746... | 0.83987874 | 0 |
Computes area of boxes. | def area(boxes):
return (boxes[:, 2] - boxes[:, 0]) * (boxes[:, 3] - boxes[:, 1]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def box_area(boxes):\n return (boxes[:, 2] - boxes[:, 0]) * (boxes[:, 3] - boxes[:, 1])",
"def box_area(boxes):\n return (boxes[:, 2] - boxes[:, 0]) * (boxes[:, 3] - boxes[:, 1])",
"def area(boxes):\n y_min, x_min, y_max, x_max = np.split(boxes, 4, axis=-1)\n return np.squeeze((y_max - y_min) * (x_max ... | [
"0.84715885",
"0.84715885",
"0.84084266",
"0.8369817",
"0.830171",
"0.81802857",
"0.80124605",
"0.79808813",
"0.7970544",
"0.7858747",
"0.78092647",
"0.7688126",
"0.7576553",
"0.7440499",
"0.73104835",
"0.72514987",
"0.72302496",
"0.7130858",
"0.71270365",
"0.7125084",
"0.712... | 0.8334332 | 4 |
Test that a route works without an exception | def test_no_exception(exception_app):
request, response = exception_app.test_client.get('/')
assert response.status == 200
assert response.text == 'OK' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_main_route():\n response = client.get(url)\n assert response.status_code == 200",
"def test_get_not_found(self):\n url = reverse('route', kwargs={'way_id': 999, 'route_id': 100})\n response = self.client.get(url)\n self.assertEqual(response.status_code, 400)\n\n url... | [
"0.7249853",
"0.7223772",
"0.7219277",
"0.70852524",
"0.7059087",
"0.70470285",
"0.70180875",
"0.69386655",
"0.6924521",
"0.68773216",
"0.6826702",
"0.6797358",
"0.67713445",
"0.67624456",
"0.674976",
"0.66934156",
"0.66745996",
"0.66634643",
"0.6658555",
"0.6639204",
"0.6556... | 0.0 | -1 |
Test the builtin NotFound exception works | def test_not_found_exception(exception_app):
request, response = exception_app.test_client.get('/404')
assert response.status == 404 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_not_found(self):\n self._error_test(fitbit_exceptions.HTTPNotFound)",
"def not_found(error):\n pass",
"def test_get_non_existing(self):\n\n response = self.client.get('/auth/non-existing-resource')\n\n self.assert404(response)\n self.assertEqual('not found', response.jso... | [
"0.76968735",
"0.75267845",
"0.7308462",
"0.7259774",
"0.725441",
"0.7216601",
"0.7208017",
"0.71932423",
"0.71264267",
"0.7092522",
"0.70613563",
"0.7056691",
"0.7042297",
"0.6977715",
"0.69740534",
"0.6950682",
"0.694123",
"0.69366896",
"0.6928748",
"0.69176847",
"0.6901971... | 0.69823277 | 13 |
Evaluates a policy by running it n times. | def evaluate_policy(env, policy, gamma = 1.0, n = 100):
scores = [
run_episode(env, policy, gamma = gamma, render = False)
for _ in range(n)]
return np.mean(scores) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iterate(self, iteration_loops, print_every_n):\n current_policy_function = lambda state_input: random.randint(0,self.nA-1) # Initialize with random policy\n current_Q = None\n iterations_completed = 0\n list_of_Q_dicts = [] # Maintain Qs throughout for comparison later\n whil... | [
"0.6549958",
"0.63208497",
"0.61738336",
"0.6098411",
"0.60485",
"0.6004604",
"0.59992456",
"0.5964593",
"0.59505534",
"0.5901866",
"0.5885304",
"0.58399665",
"0.58039004",
"0.57846254",
"0.57740563",
"0.5771689",
"0.5767388",
"0.57504654",
"0.57327",
"0.57078016",
"0.5707386... | 0.6675732 | 0 |
rps_to_mps transforms radians per second to meters per second. If rps = 2.0, then mps should equal MuleBot.CIRCUM_M because there are 2.0 radians in a circle. | def rps_to_mps(self, rps):
mps = rps * MuleBot.CIRCUM_M / 2
return mps | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mps_to_rps(self, mps):\n\n rps = mps * 2 / MuleBot.CIRCUM_M\n return rps",
"def rpm_to_mps(self, rpm):\n\n mps = rpm / 60 * MuleBot.CIRCUM_M\n return mps",
"def rps_to_rpm(self, rps):\n\n rpm = rps * MuleBot.SECONDS_PER_MINUTE / MuleBot.RADIANS_IN_CIRCLE\n return rpm",
"def ... | [
"0.7884196",
"0.73680454",
"0.6346073",
"0.6312413",
"0.6243015",
"0.5757073",
"0.5726225",
"0.56108093",
"0.559185",
"0.55581874",
"0.5527092",
"0.55248797",
"0.547593",
"0.5453415",
"0.54287136",
"0.54133725",
"0.530003",
"0.5289325",
"0.52060044",
"0.5199103",
"0.5191064",... | 0.8734056 | 0 |
rpm_to_mps transforms RPM to meters per second. | def rpm_to_mps(self, rpm):
mps = rpm / 60 * MuleBot.CIRCUM_M
return mps | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rps_to_mps(self, rps):\n\n mps = rps * MuleBot.CIRCUM_M / 2\n return mps",
"def pulses_to_mps(pulses, period=10):\n return pulses / (period * 4) # there are 4 pulses per rotation of the annemometer",
"def m_to_mm(meters):\n return meters * 1000.0",
"def pp2mp(percent_power, rpm, altitude,... | [
"0.75313336",
"0.6569572",
"0.64124066",
"0.6387432",
"0.63605464",
"0.6330294",
"0.6279928",
"0.6109284",
"0.6084121",
"0.6025862",
"0.5982968",
"0.5855224",
"0.58433664",
"0.5827793",
"0.57129604",
"0.57125986",
"0.5672748",
"0.5634531",
"0.5604179",
"0.5596185",
"0.5563323... | 0.85114133 | 0 |
motorDirection sets the direction of a single motor. | def motorDirection(self, motorPin, direction):
# print "motorPin: ", motorPin
# print "direction: ", direction
GPIO.output(motorPin, direction) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setRobotDirection(self, direction):\n self.direction = direction",
"def setRobotDirection(self, direction):\n self.direction = direction",
"def setRobotDirection(self, direction):\n self.direction = direction\n #raise NotImplementedError",
"def setRobotDirection(self, directio... | [
"0.78039855",
"0.78039855",
"0.7709002",
"0.7709002",
"0.7585717",
"0.7412099",
"0.7352856",
"0.71028143",
"0.6948896",
"0.69030976",
"0.6887376",
"0.6725957",
"0.67026407",
"0.6702",
"0.66915363",
"0.66901445",
"0.6595284",
"0.6550186",
"0.6498117",
"0.6497259",
"0.64663273"... | 0.69564164 | 8 |
motorsDirection sets the direction of both motors to the same direction. | def motorsDirection(self, direction):
print (direction)
if direction == 'r' or direction == 'R':
self.motorDirection(self.motor1DirectionPin, self.motorReverse)
self.motorDirection(self.motor2DirectionPin, self.motorReverse)
print ("Direction reverse")
else:
self.motorDirection(self... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def motors__Direction(self, speed_l, speed_r):\n\n if speed_l >= 0:\n self.motorDirection(self.motor1DirectionPin, self.motorForward)\n else:\n self.motorDirection(self.motor1DirectionPin, self.motorReverse)\n\n if speed_r >= 0:\n self.motorDirection(self.motor2DirectionPin, self.motorForwa... | [
"0.6219442",
"0.60433346",
"0.5977859",
"0.5977859",
"0.5830889",
"0.5830889",
"0.56077635",
"0.5575481",
"0.5550122",
"0.5507093",
"0.55046207",
"0.545564",
"0.54380953",
"0.54064393",
"0.5392228",
"0.53736645",
"0.5370225",
"0.5323972",
"0.5317303",
"0.5311097",
"0.5309726"... | 0.6657054 | 0 |
Test 'Bigram' approximate string comparator | def testBigram(self): # - - - - - - - - - - - - - - - - - - - - - - - - - -
for pair in self.string_pairs:
approx_str_value = stringcmp.bigram(pair[0],pair[1])
assert (isinstance(approx_str_value,float)), \
'"Bigram" does not return a floating point number for: '+str(pair)
asser... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_bigrams():\n tokenizer = Tokenizer(bigram_freq=0.5)\n X = tokenizer.transform([[\"a b a b\"]])\n assert X[\"corpus\"][0] == [\"a_b\", \"a_b\"]\n assert isinstance(tokenizer.bigrams, pd.DataFrame)",
"def test_on_anagram(self):\n\n test_string = \"anagram\"\n test_anagram = \"gra... | [
"0.6000327",
"0.5986625",
"0.5895741",
"0.5838204",
"0.5792004",
"0.5760904",
"0.5736884",
"0.5727978",
"0.57144856",
"0.5658657",
"0.5651072",
"0.56146127",
"0.55928683",
"0.5586304",
"0.5584148",
"0.558255",
"0.5579644",
"0.5579274",
"0.55765563",
"0.55633885",
"0.5512954",... | 0.7765245 | 0 |
Create an instane of TimeSeries object from dictionary of data where the keys are the timestamps and the values are signal data points. | def from_dictionary(self, data):
self.timestamps = list(data.keys())
self.signal = list(data.values())
return TimeSeries(self.timestamps, self.signal) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, tsa, tsastats=None):\n self.__data = {}\n self.__keys = tuple(tsa.keys())\n self.__value_keynames = tuple(tsa.value_keynames)\n for value_keyname in self.__value_keynames:\n try:\n self.__data[value_keyname] = Quantile(tsa, value_keyname, tsa... | [
"0.62621456",
"0.624562",
"0.6099669",
"0.6073427",
"0.60713404",
"0.600722",
"0.6001774",
"0.59670144",
"0.59603304",
"0.5954221",
"0.592088",
"0.5920819",
"0.5905056",
"0.5881809",
"0.58710706",
"0.58115184",
"0.5766777",
"0.57457846",
"0.5738244",
"0.572964",
"0.57286125",... | 0.896 | 0 |
Returns whether a user can read the workspace given in the auth_param. | def can_read(self, auth_param: str) -> bool:
perms = self._get_workspace_permissions([auth_param])
return self._has_read_perm(perms.get(auth_param, WorkspacePermission.NONE)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_write(self, auth_param: str) -> bool:\n perms = self._get_workspace_permissions([auth_param])\n return self._has_write_perm(perms.get(auth_param, WorkspacePermission.NONE))",
"def can_read_list(self, auth_params: List[str]) -> Dict[str, bool]:\n perms = self._get_workspace_permission... | [
"0.70653075",
"0.67511535",
"0.6226286",
"0.61642677",
"0.6084195",
"0.6083059",
"0.59168607",
"0.58925736",
"0.58878726",
"0.58619165",
"0.58455825",
"0.57607174",
"0.5757951",
"0.57568485",
"0.5744081",
"0.57314855",
"0.5724138",
"0.5687167",
"0.56680757",
"0.5662202",
"0.5... | 0.8667439 | 0 |
Sets the signer_id_type of this NotaryJournalMetaData. | def signer_id_type(self, signer_id_type):
self._signer_id_type = signer_id_type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def signature_type(self, signature_type):\n\n self._signature_type = signature_type",
"def id_type(self, id_type):\n\n self._id_type = id_type",
"def identifier_type(self, identifier_type):\n self._identifier_type = identifier_type",
"def payment_type_id(self, payment_type_id):\n\n ... | [
"0.6532262",
"0.60474306",
"0.57943356",
"0.5762185",
"0.5578021",
"0.5578021",
"0.5509771",
"0.54522735",
"0.53988785",
"0.5347313",
"0.5241237",
"0.5228201",
"0.51502347",
"0.51381564",
"0.51341337",
"0.51341337",
"0.51331216",
"0.5129309",
"0.5090714",
"0.50367403",
"0.499... | 0.8765965 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, NotaryJournalMetaData):
return False
return self.to_dict() == other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
if not isinstance(other, NotaryJournalMetaData):
return True
return self.to_dict() != other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
... | 0.0 | -1 |
internal function that takes a string describing a known matplotlib color map, and returns n colors from that color map as a ListedColormap. the string itself not refer to a ListedColormap; LinearSegmentedColormap names are fine as well, which unlocks the entire matplotlib color map suite. the colors returned are equid... | def _get_cmap_colors(cmap, n, cc = 0, callfn = None):
if callfn is None: callfn = _get_cmap_colors.__name__
# sanity checks
if not isinstance(cmap, str):
raise TypeError("{0}: error: cmap must be a string matplotlib color "
"map".format(callfn))
if not isinstance(n,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_colors(color_map, count):\n cols = plt.get_cmap(color_map, count + 1) # +1 to prevent wrapping, where col 0 is same as col -1\n cols = cols(range(count + 1)).tolist() # Create a list of colours\n return cols[:-1] # Remove overlapping colour and return",
"def getColorMap(colors):\n # Normal... | [
"0.7207551",
"0.6838294",
"0.6831267",
"0.67343676",
"0.6707821",
"0.65944684",
"0.6523689",
"0.6502768",
"0.6496795",
"0.64556015",
"0.64525926",
"0.6443073",
"0.64240056",
"0.6390757",
"0.63859034",
"0.638383",
"0.6354073",
"0.63461304",
"0.63261366",
"0.63261366",
"0.63261... | 0.7522413 | 0 |
Only keep rows where file extension is one of those in FILE_EXT_FORMAT_MAP.keys | def filter_df_by_file_ext(df):
df[CONCEPT.GENOMIC_FILE.FILE_FORMAT] = df["Key"].apply(file_format)
return df[df[CONCEPT.GENOMIC_FILE.FILE_FORMAT].notnull()] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_target_extensions(self, files_dict):\n files_filtered = defaultdict(list)\n supported_formats = self.sox_get_supported_formats()\n logging.info('Filtering audio files ...')\n paths = list(files_dict.keys())\n\n for path in paths:\n if not path.endswith('letm... | [
"0.6905007",
"0.6304427",
"0.6237332",
"0.60624385",
"0.59670866",
"0.57710046",
"0.57660365",
"0.5727793",
"0.5645229",
"0.56040347",
"0.5587062",
"0.55750984",
"0.54700994",
"0.54692805",
"0.54550856",
"0.5440374",
"0.53755754",
"0.53479874",
"0.5337239",
"0.53009486",
"0.5... | 0.7725254 | 0 |
Return the value of the state (computed in __init__). | def getValue(self, state):
return self.values[state] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def value(self, state):\n raise NotImplementedError",
"def value(self, state):\n raise NotImplementedError",
"def value(self, state):\n\t\traise NotImplementedError",
"def getValue(self, state):\n util.raiseNotDefined()",
"def getValue(self, state):\n util.raiseNotDefined()",
... | [
"0.83014333",
"0.83014333",
"0.826012",
"0.8086146",
"0.8086146",
"0.79581815",
"0.79296756",
"0.78013283",
"0.77367806",
"0.77336967",
"0.76010257",
"0.76010257",
"0.76010257",
"0.76010257",
"0.76010257",
"0.76010257",
"0.76010257",
"0.76010257",
"0.76010257",
"0.76010257",
... | 0.77333474 | 18 |
The policy is the best action in the given state according to the values currently stored in self.values. You may break ties any way you see fit. Note that if there are no legal actions, which is the case at the terminal state, you should return None. | def computeActionFromValues(self, state):
"*** YOUR CODE HERE ***"
actions = self.mdp.getPossibleActions(state)
optimalAction = None
maxValue = float('-inf')
for a in actions:
qValue = self.computeQValueFromValues(state, a)
if qValue > maxValue:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getPolicy(self, state):\n \"*** YOUR CODE HERE ***\"\n # OUR CODE HERE\n possibleActions = self.mdp.getPossibleActions(state)\n #checking for terminal state (no possible actions)\n if len(possibleActions) is 0: \n return None\n \n #attempt at using the Counter\n eValsActions = ut... | [
"0.77927935",
"0.7712501",
"0.7614127",
"0.760677",
"0.74919736",
"0.7467642",
"0.7373656",
"0.7342063",
"0.73408103",
"0.73386407",
"0.7335315",
"0.73145425",
"0.7310617",
"0.7310009",
"0.72952896",
"0.7273412",
"0.7244162",
"0.7244162",
"0.7155686",
"0.7088477",
"0.70826954... | 0.7012027 | 27 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.