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 |
|---|---|---|---|---|---|---|
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`. | def plot_confusion_matrix(y_true, y_pred, classes,
normalize=True,
title=None,
cmap=plt.cm.Blues):
if not title:
if normalize:
title = 'Normalized confusion matrix (in %)'
else:
title = 'Confusion m... | {
"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.81949747",
"0.80953693",
"0.80294114",
"0.8019143",
"0.79937863",
"0.79912597",
"0.7980661",
"0.79754096",
"0.7960909",
"0.79568285",
"0.79377204",
"0.79348296",
"0.7934468",
"0.79314184",
"0.79262596",
"0.792439",
"0.79241437",
"0.79229194",
"0.7922838",
"0.7922132",
"0.7... | 0.0 | -1 |
Return the email address to satisfy FlaskLogin's requirements. | def get_id(self):
return escape(self.email) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def email(self) -> Optional[str]:\n return pulumi.get(self, \"email\")",
"def email(self) -> Optional[str]:\n return pulumi.get(self, \"email\")",
"def email(self) -> Optional[str]:\n return pulumi.get(self, \"email\")",
"def email(self) -> Optional[str]:\n return pulumi.get(self,... | [
"0.74655795",
"0.74655795",
"0.74655795",
"0.74655795",
"0.7447328",
"0.7447328",
"0.7447328",
"0.7441319",
"0.7441319",
"0.7441319",
"0.7441319",
"0.7441319",
"0.7441319",
"0.7441319",
"0.7423188",
"0.7293557",
"0.7235087",
"0.7231287",
"0.72089976",
"0.7177663",
"0.71498156... | 0.0 | -1 |
Return True if the user is authenticated. | def is_authenticated(self):
return self.authenticated | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_authenticated(self):\n return self.user is not None and self.state == AuthenticationOptions.authenticated",
"def is_authenticated(self):\n return bool(get_auth_token())",
"def is_authenticated(self):\n return True",
"def is_authenticated(self):\n return True",
"def is_aut... | [
"0.8739372",
"0.87086535",
"0.86574197",
"0.86574197",
"0.86574197",
"0.86574197",
"0.86574197",
"0.86574197",
"0.86574197",
"0.8613915",
"0.8609252",
"0.8578436",
"0.83723366",
"0.83587176",
"0.8258534",
"0.82273275",
"0.8209421",
"0.8200795",
"0.8174884",
"0.81280386",
"0.8... | 0.8580474 | 21 |
False, as anonymous users aren't supported. | def is_anonymous(self):
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_anonymous():\n return False",
"def is_anonymous(self):\r\n return False",
"def is_anonymous(self):\n return False",
"def is_anonymous_access_allowed(self):\n return self._is_anonymous_access_allowed",
"def is_authenticated(self):\n return False",
"def _is_anonymous_u... | [
"0.85624325",
"0.83800477",
"0.82456774",
"0.7815806",
"0.7576082",
"0.72904116",
"0.72619915",
"0.72347337",
"0.72347337",
"0.72347337",
"0.72347337",
"0.72347337",
"0.72347337",
"0.72347337",
"0.72338396",
"0.715833",
"0.7106215",
"0.70944613",
"0.70567185",
"0.70209265",
"... | 0.8360155 | 14 |
Creates the app and initializes the config of the app | def create_app(config_class=flaskblog_cf.Config):
app = flask.Flask(__name__)
app.config.from_object(flaskblog_cf.Config)
db.init_app(app)
bcrypt.init_app(app)
login_manager.init_app(app)
mail.init_app(app)
import flaskblog.controller.user_controller as flaskblog_user_ctrl
import flask... | {
"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.84064645",
"0.8173824",
"0.8027341",
"0.80095035",
"0.8000431",
"0.7800716",
"0.7797619",
"0.77753365",
"0.7758949",
"0.7753913",
"0.7747754",
"0.77299917",
"0.769039",
"0.7676692",
"0.76550883",
"0.76211506",
"0.7621147",
"0.75770366",
"0.7571011",
"0.75448424",
"0.754074... | 0.72276217 | 58 |
Given a word, we return its embedding. If the word is @ we return an empty embedding. | def _use_embeddings(self, word):
if word == "@PAD@":
return torch.zeros(self.embeddings_dim)
else:
return self.embeddings[word] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def embed_word(self):\n return self.emb.get_keras_embedding(dropout = self.emb_dropout,\n trainable = self.trainable_emb,\n input_length = self.sent_maxlen)",
"def embed_word(self):\n return self.emb.get_keras_emb... | [
"0.7205014",
"0.7154769",
"0.6953269",
"0.6738175",
"0.6409667",
"0.63891476",
"0.6343911",
"0.63125765",
"0.6245909",
"0.6232979",
"0.6217436",
"0.6154561",
"0.60386926",
"0.599839",
"0.59487975",
"0.5948101",
"0.59232",
"0.5914193",
"0.58986837",
"0.5824677",
"0.5799542",
... | 0.7745891 | 0 |
Get the path to our resources folder. | def resources_path(*args):
path = os.path.dirname(__file__)
path = os.path.abspath(
os.path.join(path, os.path.pardir, 'resources'))
for item in args:
path = os.path.abspath(os.path.join(path, item))
return path | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_resource_path():\n return os.path.join(os.path.dirname(__file__), \"resources\") + os.path.sep",
"def get_resource_dir(cls) -> str:\n return os.path.join(\n os.path.realpath(os.path.dirname(__file__)),\n os.pardir,\n os.pardir,\n os.pardir,\n ... | [
"0.86643046",
"0.8378637",
"0.7743809",
"0.75804335",
"0.72275496",
"0.719225",
"0.71488607",
"0.7127047",
"0.70747894",
"0.70379436",
"0.70340073",
"0.6962204",
"0.69613093",
"0.6918871",
"0.69143313",
"0.68873346",
"0.68873346",
"0.68871725",
"0.68836594",
"0.68566465",
"0.... | 0.7199979 | 5 |
Returns the vector pointing from particle p1 to particle p2 | def get_displ(self):
return self.p2.pos - self.p1.pos | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getVector(self):\n return Vector.createFromTwoPoints(self.p1, self.p2)",
"def vector(p0, p1):\n a = p1[0] - p0[0]\n b = p1[1] - p0[1]\n return (a, b)",
"def dirVector(self,p1,p2):\n v=p2-p1\n l=v.Length\n return self.toMatrix(v)/l",
"def create_vector(point_1, point_2... | [
"0.73576176",
"0.7047879",
"0.6773854",
"0.6745668",
"0.6736915",
"0.6667882",
"0.6557451",
"0.6445764",
"0.64060533",
"0.6363815",
"0.6324329",
"0.62883544",
"0.6274881",
"0.6254005",
"0.6224072",
"0.6191755",
"0.6177164",
"0.61661214",
"0.6116368",
"0.60950935",
"0.6084235"... | 0.55415106 | 96 |
Test that xlam is successfully generated from a OLE file | def test_success_from_bin():
createFromBin("tests/vbaProject.bin", "src/data", "success_bin.xlam")
# Assert that xlam file is created
assert exists("success_bin.xlam")
#assert that bin file within success_bin.xlam matches tests/vbaProject.bin
extractBinFromZip("success_bin.xlam")
md5hasher = Fil... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_savexspec(self):\n command = '{0}'.format(\n os.path.join(self.datadir, 'monol_testA_E3-50_pds_rebin2') +\n HEN_FILE_EXTENSION)\n hen.save_as_xspec.main(command.split())\n os.path.exists(os.path.join(self.datadir,\n 'monol_testA... | [
"0.61650157",
"0.5973011",
"0.5962556",
"0.5873756",
"0.57847834",
"0.5691951",
"0.5665343",
"0.5651631",
"0.56285954",
"0.5508423",
"0.5508423",
"0.5465604",
"0.54196095",
"0.54172206",
"0.5400182",
"0.53908134",
"0.5385172",
"0.53850764",
"0.5357528",
"0.533315",
"0.5330364... | 0.5414168 | 14 |
Test to see if all numbers in a list are consecutive. | def is_consecutive(a_list):
current_value = a_list[0]-1
for number in a_list:
current_value +=1
if current_value != number:
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def are_consecutive(int_list):\n\n if set(np.diff(int_list)) == set([1]):\n return True\n else:\n return False",
"def consecutive_ints(ints):\n\n if len(ints) == 0:\n return False\n\n for k in range(len(ints) - 1):\n diff = abs(ints[k] - ints[k+1])\n ... | [
"0.8298181",
"0.76965404",
"0.7653472",
"0.66523486",
"0.6632553",
"0.6485024",
"0.6289722",
"0.6228376",
"0.6180459",
"0.61781263",
"0.6171568",
"0.6038927",
"0.6026836",
"0.6026329",
"0.6010284",
"0.5998613",
"0.5995241",
"0.59898204",
"0.59724677",
"0.5964205",
"0.596208",... | 0.84912145 | 0 |
Return a list of rook neighbors for face | def rook_neighbors_face(self, face):
edges = self.cw_face_edges(face)
return list(set([ self.left_region[edge] for edge in edges])) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_neighbours(self):\n return []",
"def get_neighbors(self):\n \n return [neighbor for neighbor,_ in self.neighbors.items()]",
"def get_neighbors(self):\n return self.neighbors",
"def get_neighbors(self):\n return self.neighbors",
"def get_neighbors(self):\n ... | [
"0.7214258",
"0.7183325",
"0.7142914",
"0.7142914",
"0.7142914",
"0.7142914",
"0.711689",
"0.71140546",
"0.6957072",
"0.69526535",
"0.6927171",
"0.6880746",
"0.6863481",
"0.68318206",
"0.6790902",
"0.67848825",
"0.67337227",
"0.67166096",
"0.6711103",
"0.6708115",
"0.6705029"... | 0.8326925 | 0 |
Hide all the give buttons | def hide_give_buttons(self):
#
# Don't show the give buttons
for panel in self.health_panels.values():
panel.hide_button() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hide_main_buttons(self):\n pass",
"def hide_control_buttons(self):\n self.settings_button.hide()\n self.radio_button.hide()\n self.blank_button.hide()\n self.close_button.hide()",
"def hide_all(self):\n for UI_object in self.__UI_objects:\n UI_object.hid... | [
"0.8248472",
"0.815214",
"0.75692564",
"0.7316705",
"0.72356105",
"0.71855",
"0.71508044",
"0.70098287",
"0.69590956",
"0.6945517",
"0.683434",
"0.6802762",
"0.6763833",
"0.6708051",
"0.66740304",
"0.6670731",
"0.6657909",
"0.6651214",
"0.6629681",
"0.66175836",
"0.66152686",... | 0.81163603 | 2 |
Returns true if there are more elements in queue | def __nonzero__(self):
record = self.db.crawl_queue.find_one(
{'status': {'$ne': self.COMPLETE}}
)
return True if record else False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isFull(self):\r\n if (len(self.queue) == self.maxlen):\r\n return True\r\n else:\r\n return False",
"def any(self) -> bool:\n return len(self.queue) > 0",
"def isFull(self):\n return len(self.queue) == self.size",
"def more(self):\n # return True if th... | [
"0.7951514",
"0.7912515",
"0.78353816",
"0.77081764",
"0.7494042",
"0.74458694",
"0.74082726",
"0.7340187",
"0.73131305",
"0.7286642",
"0.7200341",
"0.7200341",
"0.7167515",
"0.7162698",
"0.71610945",
"0.71314126",
"0.712629",
"0.71022844",
"0.70930105",
"0.7091202",
"0.70807... | 0.0 | -1 |
Calculates the output shape of Conv2d | def conv2d_output_shape(height, width, filter_height, filter_width, out_channels, stride):
return (out_channels, ((height - filter_height) / stride + 1), ((width - filter_width) / stride + 1)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_output2_shape(self):\n return self.__y2.shape",
"def _output_size_conv2d(conv, size):\n o_size = np.array(size) + 2 * np.array(conv.padding)\n o_size -= np.array(conv.dilation) * (np.array(conv.kernel_size) - 1)\n o_size -= 1\n o_size = o_size / np.array(conv.stride) + 1\n return np... | [
"0.75668865",
"0.7222983",
"0.7196394",
"0.71196187",
"0.7083144",
"0.7083144",
"0.7083144",
"0.70378643",
"0.70119876",
"0.69937086",
"0.69783646",
"0.6930829",
"0.6912558",
"0.6906636",
"0.6898835",
"0.68910575",
"0.68647295",
"0.6860347",
"0.68561816",
"0.6854668",
"0.6854... | 0.7670311 | 0 |
Change the format of `hwc` from `(height, width, channels)` to `(batch, channels, height, width)` | def hwc2bchw(hwc):
return prepend_dimension(hwc2chw(hwc)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hwc2chw(hwc):\n return hwc.permute(2, 0, 1)",
"def convert_chwTensor_to_hwcNumpy(tensor):\n\n if isinstance(tensor, Variable):\n return np.transpose(tensor.data.numpy(), (0,2,3,1))\n elif isinstance(tensor, torch.FloatTensor):\n return np.transpose(tensor.numpy(), (0,2,3,1))\n else:... | [
"0.7169065",
"0.657868",
"0.6575038",
"0.64615595",
"0.5821664",
"0.5802621",
"0.57856226",
"0.5765042",
"0.57223004",
"0.56864095",
"0.5671263",
"0.5671263",
"0.5603312",
"0.55933166",
"0.55847925",
"0.5583463",
"0.5577185",
"0.5563041",
"0.5563041",
"0.5563041",
"0.5563041"... | 0.7195695 | 0 |
Clean the name of a company to get a better match with the url | def clean_name(naam):
# de naam altijd in kleine letters
naam_small = naam.lower()
# alles wat er uit zit als B.V. N.V., etc wordt verwijderd
naam_small = re.sub("\s(\w\.)+[\s]*", "", naam_small)
# alles wat tussen haakjes staat + wat er nog achter komt verwijderen
naam_small = re.sub("\(.*\)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def guess_company_name(self, response):\n # TODO here guess the name of the company\n # if og:title or title or smth else\n # if domain in the title then its the name\n # if not\n # take domain\n\n parts = urllib.parse.urlparse(response.url)\n name_parts = parts.net... | [
"0.71099955",
"0.63638985",
"0.633686",
"0.62193596",
"0.61567163",
"0.6127627",
"0.6085141",
"0.6069341",
"0.6022241",
"0.5999505",
"0.5960077",
"0.5943585",
"0.5923806",
"0.59202087",
"0.5861695",
"0.5860611",
"0.58260995",
"0.58212453",
"0.58029526",
"0.58026606",
"0.57968... | 0.52862364 | 99 |
Return the dataset given by attrname | def _read_h5_dataset(self):
dev = self.getParentObj()
top = dev.getFileDescriptor()
for attr in self._attr_list:
data = top.get(attr)
if data is None:
msg = "Unable to open object (Object %s doesn't exist)" % attr
raise TaurusException(msg)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dataset_by_name(name):\n return _datasets[name.lower()]",
"def __getattr__(self, name):\n return getattr(self.dataset, name)",
"def get_by_name(self, name: str) -> Optional[\"Dataset\"]:\n raise NotImplementedError",
"def get_attr(self, attr_name, ds_name=None):\n if self.science_... | [
"0.7200736",
"0.71141005",
"0.7057059",
"0.70067424",
"0.7004232",
"0.68233305",
"0.6647473",
"0.6621773",
"0.65331525",
"0.6517861",
"0.65117925",
"0.650482",
"0.64580303",
"0.6431572",
"0.6393592",
"0.6387506",
"0.63523895",
"0.63523895",
"0.63523895",
"0.63087416",
"0.6294... | 0.0 | -1 |
Determine whether `type_` is a subclass of `dtype`. | def issubclass_(type_, dtype):
if not isinstance(type_, typing.Type):
return False
return typing.is_subclass(type_, dtype) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def issubdtype(dtype1: DType, dtype2: DType):\n return np.issubdtype(convert(dtype1, NPDType), convert(dtype2, NPDType))",
"def is_type(self, typ):\n return typ == self.__class__.__name__",
"def is_type(value):\n if isinstance(value, type):\n return issubclass(value, Type)\n retu... | [
"0.65836364",
"0.65212995",
"0.6351597",
"0.6338538",
"0.630703",
"0.62895465",
"0.62218565",
"0.6181548",
"0.6132877",
"0.6069795",
"0.6044105",
"0.59636736",
"0.59330523",
"0.59306806",
"0.59108436",
"0.5885851",
"0.57967913",
"0.5784766",
"0.57831836",
"0.57495224",
"0.570... | 0.8298411 | 0 |
Test case for create_subscription_template Create a subscription template | def test_create_subscription_template(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_subscription_template(self):\n pass",
"def test_get_template_subscription(self):\n pass",
"def test_create_subscription(self):\n pass",
"def test_update_subscription_template(self):\n pass",
"def test_create_template_subsciption(self):\n pass",
"def test_up... | [
"0.7693981",
"0.75977504",
"0.73393166",
"0.7164994",
"0.7105468",
"0.7067066",
"0.6902376",
"0.68949294",
"0.68894017",
"0.6603974",
"0.65185064",
"0.64694715",
"0.6436654",
"0.6404223",
"0.627481",
"0.62104964",
"0.61859465",
"0.6167123",
"0.60983783",
"0.6070475",
"0.60679... | 0.8850013 | 0 |
Test case for get_subscription Retrieve a single subscription item and associated plans | def test_get_subscription(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_subscription(\n connection, subscription_id, project_id, fields=None, error_msg=None\n):\n return connection.get(\n url=f'{connection.base_url}/api/subscriptions/{subscription_id}',\n params={'fields': fields},\n headers={'X-MSTR-ProjectID': project_id},\n )",
"def get_subsc... | [
"0.7221876",
"0.71086645",
"0.6822837",
"0.65896064",
"0.64945227",
"0.6428486",
"0.6427117",
"0.64120084",
"0.63664573",
"0.635409",
"0.6335369",
"0.63264954",
"0.6279728",
"0.6278634",
"0.61629564",
"0.61160654",
"0.60799325",
"0.6067734",
"0.60591614",
"0.6056659",
"0.6052... | 0.74298936 | 0 |
Test case for get_subscription_templates List and search subscription templates | def test_get_subscription_templates(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_template_subscription(self):\n pass",
"def test_get_subscription_template(self):\n pass",
"def test_list_template_subscriptions(self):\n pass",
"def test_list_pending_template_subscriptions(self):\n pass",
"def test_create_subscription_template(self):\n pass"... | [
"0.8001164",
"0.78203017",
"0.7742171",
"0.7320913",
"0.6945081",
"0.6711903",
"0.6619258",
"0.65529203",
"0.6517631",
"0.6393329",
"0.6345983",
"0.6248021",
"0.6238697",
"0.6226552",
"0.6212653",
"0.6145476",
"0.61196834",
"0.6118657",
"0.60788804",
"0.607802",
"0.6051913",
... | 0.86588573 | 0 |
Test case for get_subscriptions List available subscription items and associated plans | def test_get_subscriptions(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_subscription(self):\n pass",
"def test_list_all_response_descriptor_subscriptions_subscription_subscription_resource(self):\n pass",
"def test_cmd_cs_subscription_list(self, mocker):\n\n mock_response = {\n 'foo': 'bar'\n }\n mocker.patch.object(\n ... | [
"0.7344387",
"0.70370054",
"0.69961584",
"0.69321305",
"0.6892585",
"0.6881295",
"0.6822648",
"0.67232937",
"0.6693409",
"0.66729087",
"0.66596293",
"0.66575223",
"0.6639008",
"0.6598915",
"0.6580591",
"0.65343857",
"0.65290195",
"0.65274036",
"0.65196717",
"0.65025175",
"0.6... | 0.7793709 | 0 |
Test case for update_subscription_template Update a subscription template | def test_update_subscription_template(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_update_template_subscription(self):\n pass",
"def test_create_subscription_template(self):\n pass",
"def test_update_subscription(self):\n pass",
"def test_get_template_subscription(self):\n pass",
"def test_get_subscription_template(self):\n pass",
"def test_d... | [
"0.8910484",
"0.7591905",
"0.73899454",
"0.73409426",
"0.7193628",
"0.7031251",
"0.70294935",
"0.70098615",
"0.69227225",
"0.6597859",
"0.65406775",
"0.6487217",
"0.6396656",
"0.63029706",
"0.6278784",
"0.6124437",
"0.6115093",
"0.6085949",
"0.60779536",
"0.60753375",
"0.6017... | 0.9010842 | 0 |
Sets the signature_type of this PresentationRequest. | def signature_type(self, signature_type):
self._signature_type = signature_type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def signer_id_type(self, signer_id_type):\n\n self._signer_id_type = signer_id_type",
"def signature(self, signature: object):\n\n self._signature = signature",
"def signature(self, signature: object):\n\n self._signature = signature",
"def signature(self, signature):\n\n self._si... | [
"0.6334617",
"0.6109964",
"0.6109964",
"0.5990726",
"0.5990726",
"0.584678",
"0.5743265",
"0.5655761",
"0.5628889",
"0.56207186",
"0.54199916",
"0.5411409",
"0.5411409",
"0.53656065",
"0.53580594",
"0.53580594",
"0.53326476",
"0.532455",
"0.5309663",
"0.5275425",
"0.5270677",... | 0.82128924 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, PresentationRequest):
return False
return self.__dict__ == other.__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):
return not self == other | {
"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.0 | -1 |
Get the camera state | def get_camera_state(self, parameter):
return self.opt.getParameter(parameter) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_state(self):\n return self.get_pose()",
"def camera(self):\n return self.__camera",
"def read_camera(self):\n _, frame = self.camera.read()\n return self.mirror(frame)",
"def camera(self):\n return self._camera",
"def camera(self):\n return self._camera",
... | [
"0.7418702",
"0.70903325",
"0.70849323",
"0.7024534",
"0.7024534",
"0.69902366",
"0.6969179",
"0.6958566",
"0.6876306",
"0.6854023",
"0.6830306",
"0.68080044",
"0.67785543",
"0.6737057",
"0.67324007",
"0.6631569",
"0.6520229",
"0.6471183",
"0.6469549",
"0.64381623",
"0.637073... | 0.8026797 | 0 |
Display image using imshow and some default values adapted to holoviews | def _imshow_hv_map(agg, extent=None, **kwargs):
alpha_mask = kwargs.pop('alpha_below', 0.)
defaults = {'origin': 'lower',
'aspect': 'auto',
'extent': extent}
defaults.update(**kwargs)
return plt.imshow(np.ma.masked_less_equal(agg, alpha_mask), origin='lower',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_env(self, img):\n plt.figure(1)\n plt.subplot(111)\n plt.imshow(img, interpolation=\"nearest\")\n plt.show()",
"def imshow(self):\n axes([0, 0, 1, 1], xticks=[], yticks=[])\n imshow(self.rgb_image())",
"def show_image(self):\n cv2.imshow(self.config.DIS... | [
"0.73273027",
"0.7198707",
"0.71909684",
"0.71902835",
"0.7145402",
"0.7119222",
"0.70969856",
"0.70824677",
"0.7069617",
"0.7018782",
"0.7003706",
"0.6973448",
"0.696171",
"0.6938317",
"0.6931517",
"0.69012994",
"0.6896671",
"0.6892891",
"0.6892891",
"0.6892891",
"0.68766886... | 0.6399075 | 74 |
Test the Film model can create a film. | def test_model_can_create_a_film(self):
self.assertEqual(self.film.title, "test_a") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_movie(self):\n # this functionality requires the executive producer token\n res = self.client().post('/movies', headers={\n 'Authorization': \"Bearer {}\".format(self.executive_producer_token)\n }, json=self.VALID_NEW_MOVIE)\n data = json.loads(res.data)\n\n ... | [
"0.7326092",
"0.71253955",
"0.70071846",
"0.67962664",
"0.67277986",
"0.6709954",
"0.66037697",
"0.65550524",
"0.64937556",
"0.6485218",
"0.6376396",
"0.63730735",
"0.6359602",
"0.6328501",
"0.63191885",
"0.63143927",
"0.6291337",
"0.62862486",
"0.6258519",
"0.62030053",
"0.6... | 0.845936 | 0 |
Test the api can handle POST requests. | def test_api_can_post(self):
# check person created
self.assertEqual(self.response.status_code, status.HTTP_201_CREATED)
# check studio created
self.assertEqual(self.response.status_code, status.HTTP_201_CREATED)
# check film created
self.assertEqual(self.response.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_post(self):\n self.assertEqual(\n status.HTTP_405_METHOD_NOT_ALLOWED, self.response.status_code)",
"def test_client_can_do_post_request(self):\n response = self.httpbin_4.test_requests_post_method()\n self.assertEqual(response.request.method, 'POST')\n self.assertE... | [
"0.81288964",
"0.8070564",
"0.79866374",
"0.78895104",
"0.7874037",
"0.786408",
"0.7684014",
"0.75225013",
"0.7472585",
"0.74551374",
"0.7442403",
"0.7430293",
"0.74298954",
"0.73765373",
"0.73765373",
"0.7321075",
"0.7302121",
"0.7235971",
"0.72245127",
"0.7190952",
"0.71374... | 0.7364214 | 15 |
Test the api can handle POST requests. | def test_api_can_get(self):
# get all people
people = People.objects.get()
response = self.client.get(
reverse("create_person"),
format="json"
)
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertContains(response, people)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_post(self):\n self.assertEqual(\n status.HTTP_405_METHOD_NOT_ALLOWED, self.response.status_code)",
"def test_client_can_do_post_request(self):\n response = self.httpbin_4.test_requests_post_method()\n self.assertEqual(response.request.method, 'POST')\n self.assertE... | [
"0.81288964",
"0.8070564",
"0.79866374",
"0.78895104",
"0.7874037",
"0.786408",
"0.7684014",
"0.75225013",
"0.7472585",
"0.74551374",
"0.7442403",
"0.7430293",
"0.74298954",
"0.73765373",
"0.73765373",
"0.7364214",
"0.7321075",
"0.7302121",
"0.7235971",
"0.72245127",
"0.71909... | 0.0 | -1 |
Yield successive nsized chunks from lst. | def chunks(lst, n):
for i in range(0, len(lst), n):
yield lst[i:i + n] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def chunks(self, lst, n):\n for i in range(0, len(lst), n):\n yield lst[i:i + n]",
"def chunks(lst: list, n: int):\n for i in range(0, len(lst), n):\n yield lst[i : i + n]",
"def chunks(lst, n):\n for i in range(0, len(lst), n):\n yield lst[i:i + n]",
"de... | [
"0.83071756",
"0.81939614",
"0.81910837",
"0.81910837",
"0.8190213",
"0.81267184",
"0.81218547",
"0.81218547",
"0.80773693",
"0.80526286",
"0.80526286",
"0.80526286",
"0.80526286",
"0.80526286",
"0.80042696",
"0.7871678",
"0.7845623",
"0.7828392",
"0.7827006",
"0.78138447",
"... | 0.80533457 | 14 |
Assumes f is a function of one argument x_vals is an array of suitable arguments for f Returns array containing results of applying f to the elements of x_vals | def create_data(f, x_vals):
y_vals = []
for i in x_vals:
y_vals.append(f(x_vals[i]))
return np.array(y_vals) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eval_f(f, xs):\n l = []\n for x in xs:\n l.append(f(x))\n return l",
"def batch_eval(f, pts):\n\n\t# Use this array to send into FEniCS.\n\tout = np.zeros(1)\n\n\tdef gen():\n\t\tfor pt in pts.reshape(2, -1).T:\n\t\t\tf.eval(out, pt)\n\t\t\tyield out[0]\n\n\tvalues = list(gen())\n\tavalues = ... | [
"0.7281645",
"0.6742578",
"0.658591",
"0.65140915",
"0.6400086",
"0.61604524",
"0.61573714",
"0.61381084",
"0.6107468",
"0.61030596",
"0.60999453",
"0.6063513",
"0.6055219",
"0.6043663",
"0.603129",
"0.5961085",
"0.5960057",
"0.59515846",
"0.59507626",
"0.5949912",
"0.594965"... | 0.7910308 | 0 |
Get global config instance. If global instance does not exist, creates it and returns it. | def get_config(cli_args: Dict = {}) -> Config:
global global_config
if global_config is None:
global_config = Config(cli_args)
return global_config | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_config(cls) -> GlobalConfig:\n if cls.config is None:\n raise ValueError(\"Config is not loaded\")\n return cls.config",
"def get_config(cls) -> \"__Config\":\n if cls.__instance is None:\n cls.__instance = cls.__Config()\n return cls.__instance",
"def ... | [
"0.7702124",
"0.7666447",
"0.74472445",
"0.73517764",
"0.7137227",
"0.6890116",
"0.68409854",
"0.68341744",
"0.68113756",
"0.6741357",
"0.6717012",
"0.67168754",
"0.67119265",
"0.6708008",
"0.6545631",
"0.64705616",
"0.6428417",
"0.64224553",
"0.64224553",
"0.64224553",
"0.64... | 0.7058225 | 5 |
Sets the name of this ComAdobeGraniteAuthOauthAccesstokenProviderProperties. | def name(self, name):
self._name = name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_name(self, name):\n\n\t\tif name is not None and not isinstance(name, str):\n\t\t\traise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: name EXPECTED TYPE: str', None, None)\n\t\t\n\t\tself.__name = name\n\t\tself.__key_modified['name'] = 1",
"def set_name(self, a_name):\n self.set_parameter('name'... | [
"0.60287666",
"0.6024407",
"0.60225886",
"0.5862234",
"0.5850794",
"0.58209664",
"0.58209664",
"0.58209664",
"0.58209664",
"0.58209664",
"0.5820882",
"0.5798398",
"0.57773155",
"0.57608837",
"0.57555205",
"0.57384616",
"0.57384616",
"0.5729308",
"0.57279676",
"0.57265085",
"0... | 0.5715665 | 80 |
Sets the auth_token_provider_title of this ComAdobeGraniteAuthOauthAccesstokenProviderProperties. | def auth_token_provider_title(self, auth_token_provider_title):
self._auth_token_provider_title = auth_token_provider_title | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authority_title(self, authority_title):\n\n self._authority_title = authority_title",
"def provider_display_name(self, provider_display_name: str):\n\n self._provider_display_name = provider_display_name",
"def auth_token_provider_client_id(self, auth_token_provider_client_id):\n\n sel... | [
"0.60304767",
"0.57130814",
"0.5510178",
"0.5489032",
"0.5331379",
"0.52722764",
"0.5268265",
"0.5230474",
"0.52094156",
"0.52050406",
"0.5178924",
"0.51139545",
"0.510355",
"0.50551885",
"0.5054401",
"0.5011264",
"0.5011264",
"0.5008644",
"0.5000477",
"0.49910516",
"0.497040... | 0.8455562 | 0 |
Sets the auth_token_provider_default_claims of this ComAdobeGraniteAuthOauthAccesstokenProviderProperties. | def auth_token_provider_default_claims(self, auth_token_provider_default_claims):
self._auth_token_provider_default_claims = auth_token_provider_default_claims | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_default_access_token(self):\n return self.default_access_token",
"def default_userinfo(claims, user):\n return claims",
"def unset_default_org(self):\n for org in self.list_orgs():\n org_config = self.get_org(org)\n if org_config.default:\n del org_... | [
"0.5696187",
"0.5610402",
"0.4889846",
"0.48809984",
"0.4812448",
"0.47694296",
"0.47215286",
"0.46632028",
"0.46542785",
"0.4609655",
"0.45344913",
"0.45305893",
"0.4524699",
"0.4516228",
"0.44998387",
"0.44568896",
"0.44416875",
"0.44141147",
"0.4407804",
"0.44063386",
"0.4... | 0.89118713 | 0 |
Sets the auth_token_validator_type of this ComAdobeGraniteAuthOauthAccesstokenProviderProperties. | def auth_token_validator_type(self, auth_token_validator_type):
self._auth_token_validator_type = auth_token_validator_type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def token_type(self, token_type):\n if self.local_vars_configuration.client_side_validation and token_type is None: # noqa: E501\n raise ValueError(\"Invalid value for `token_type`, must not be `None`\") # noqa: E501\n\n self._token_type = token_type",
"def get_validator_class(self):\n... | [
"0.62380844",
"0.59773284",
"0.57731944",
"0.57731944",
"0.5772862",
"0.5731854",
"0.5603095",
"0.5092965",
"0.5038968",
"0.49872926",
"0.49421284",
"0.48805046",
"0.48672032",
"0.4865523",
"0.4845931",
"0.47426105",
"0.47426105",
"0.47108474",
"0.46993667",
"0.46798113",
"0.... | 0.8329697 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, ComAdobeGraniteAuthOauthAccesstokenProviderProperties):
return False
return self.__dict__ == other.__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):
return not self == other | {
"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.0 | -1 |
Initializes a JustLatticeChord from a conventional chord name. | def from_name(
cls,
fundamental: float,
root: List[int],
name: str,
) -> JustLatticeChord:
nodes = {
"sub-minor triad": [[1, 0, 0], [-1, 0, 1]],
"minor triad": [[1, -1, 0], [1, 0, 0]],
"diminished triad": [[1, -1, 0], [0, -1, 1]],
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self,\n xyz_le: np.ndarray = np.array([0, 0, 0]),\n chord: float = 1.,\n twist_angle: float = 0,\n twist_axis: np.ndarray = np.array([0, 1, 0]),\n airfoil: Airfoil = Airfoil(\"naca0012\"),\n control_surface... | [
"0.57136005",
"0.55517083",
"0.5463547",
"0.53032833",
"0.5247908",
"0.52317935",
"0.5225093",
"0.5200174",
"0.51757944",
"0.5069886",
"0.50385845",
"0.500643",
"0.49973315",
"0.49876717",
"0.4955709",
"0.4950091",
"0.4918065",
"0.49147013",
"0.49086618",
"0.4907211",
"0.4901... | 0.66535735 | 0 |
Warp image using perspective transform 1. undistort image using camera calibration 2. warp to birdseye view | def image_warp(img, mtx, dist, M):
# 1) Undistort using mtx and dist
img = cv2.undistort(img, mtx, dist, None, mtx)
img_size = (img.shape[1], img.shape[0]) # note switch of x,y order
# 2) warp image to top-down view
warped = cv2.warpPerspective(img, M, img_size, flags=cv2.INTER_LINEAR)
retur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def warp(img1, img2, M):\n\n # Get width and height of input images \n w1,h1 = img1.shape[:2]\n w2,h2 = img2.shape[:2]\n\n # Get the canvas dimesions\n img2_dims = np.float32([ [0,0], [0,w2], [h2, w2], [h2,0] ]).reshape(-1,1,2)\n img1_dims_temp = np.float32([ [0,0], [0,w1], [h1, w1], [h1,0] ]).re... | [
"0.7196996",
"0.7192724",
"0.71216667",
"0.71152675",
"0.7111254",
"0.6961423",
"0.6892092",
"0.673013",
"0.6703743",
"0.66898274",
"0.66599053",
"0.6609936",
"0.6608387",
"0.66074306",
"0.6594465",
"0.64382154",
"0.6433926",
"0.6328231",
"0.62793535",
"0.6255697",
"0.6190480... | 0.64864296 | 15 |
Return the home page | def index(request):
context = {'is_logged_in': request.user.is_authenticated}
return render(request, 'sacms/index.html', context) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def home() -> Any:\n return home_page()",
"def home():\n\n return render_template('home_page.html')",
"def home():\n\n\treturn render_template('index.html', title='Home Page',\n\t\t\t\t\t\t year=datetime.now().year)",
"def home():\n\n return render_template(\"home.html\")",
"def homepage():\n\tr... | [
"0.8526042",
"0.8460915",
"0.82822025",
"0.8280693",
"0.82573193",
"0.82547617",
"0.8248272",
"0.8248272",
"0.8248272",
"0.8248272",
"0.8248272",
"0.8248272",
"0.8248272",
"0.8248272",
"0.8248272",
"0.8248272",
"0.8248272",
"0.8248272",
"0.8248272",
"0.8248272",
"0.8248272",
... | 0.0 | -1 |
Return the home page | def index_en(request):
context = {'is_logged_in': request.user.is_authenticated}
return render(request, 'sacms/index_en.html', context) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def home() -> Any:\n return home_page()",
"def home():\n\n return render_template('home_page.html')",
"def home():\n\n\treturn render_template('index.html', title='Home Page',\n\t\t\t\t\t\t year=datetime.now().year)",
"def home():\n\n return render_template(\"home.html\")",
"def homepage():\n\tr... | [
"0.8526042",
"0.8460915",
"0.82822025",
"0.8280693",
"0.82573193",
"0.82547617",
"0.8248272",
"0.8248272",
"0.8248272",
"0.8248272",
"0.8248272",
"0.8248272",
"0.8248272",
"0.8248272",
"0.8248272",
"0.8248272",
"0.8248272",
"0.8248272",
"0.8248272",
"0.8248272",
"0.8248272",
... | 0.0 | -1 |
Return the page for the list of all news articles | def newsfeed(request):
article_list = Article.objects.order_by('published_date')
context = {'article_list': article_list}
return render(request, 'sacms/newsfeed.html', context) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_news_list():\r\n\tnews_list = Page.objects.filter(tags='news').order_by('-created')\r\n\treturn {'news_list': news_list}",
"def NewsArticles():\n health_articles = get_articles('health')\n education_articles = get_articles('technology')\n return render_template('articles.html',health=health_art... | [
"0.781636",
"0.76884675",
"0.76201373",
"0.7255485",
"0.7250988",
"0.7234691",
"0.7175664",
"0.71060944",
"0.7067236",
"0.70360106",
"0.7008968",
"0.6983359",
"0.69572264",
"0.69443256",
"0.69374955",
"0.68874454",
"0.68850803",
"0.6802306",
"0.6745521",
"0.67309004",
"0.6694... | 0.729258 | 3 |
Return the page for the list of all news articles | def newsfeed_en(request):
article_list = Article.objects.order_by('published_date')
context = {'article_list': article_list}
return render(request, 'sacms/newsfeed_en.html', context) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_news_list():\r\n\tnews_list = Page.objects.filter(tags='news').order_by('-created')\r\n\treturn {'news_list': news_list}",
"def NewsArticles():\n health_articles = get_articles('health')\n education_articles = get_articles('technology')\n return render_template('articles.html',health=health_art... | [
"0.781636",
"0.76884675",
"0.76201373",
"0.729258",
"0.7255485",
"0.7250988",
"0.7234691",
"0.7175664",
"0.71060944",
"0.7067236",
"0.70360106",
"0.7008968",
"0.6983359",
"0.69572264",
"0.69443256",
"0.69374955",
"0.68850803",
"0.6802306",
"0.6745521",
"0.67309004",
"0.669415... | 0.68874454 | 16 |
Return the page for a notice | def notice(request, notice_id):
notice = get_object_or_404(Notice, pk=notice_id)
context = {'notice': notice}
return render(request, 'sacms/notice.html', context) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def message_page(request,page_name):\n return HttpResponse(\"This will be the {0} page.\".format(page_name))",
"def page_not_found(e):\n return \"Hey Bozo. You don't belong here -- scramo.\", 403",
"def page_error(e):\n\n return render_template('404.html')",
"def page_not_found(e):\n return rende... | [
"0.6926425",
"0.6661499",
"0.65547436",
"0.65507066",
"0.6485495",
"0.643029",
"0.641658",
"0.6396737",
"0.63873595",
"0.6383726",
"0.63831925",
"0.63764995",
"0.63660586",
"0.63660586",
"0.63484246",
"0.63484246",
"0.63484246",
"0.63484246",
"0.63484246",
"0.63484246",
"0.63... | 0.65961283 | 2 |
Return the page for a notice | def notice_en(request, notice_id):
notice = get_object_or_404(Notice, pk=notice_id)
context = {'notice': notice}
return render(request, 'sacms/notice_en.html', context) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def message_page(request,page_name):\n return HttpResponse(\"This will be the {0} page.\".format(page_name))",
"def page_not_found(e):\n return \"Hey Bozo. You don't belong here -- scramo.\", 403",
"def notice(request, notice_id):\n notice = get_object_or_404(Notice, pk=notice_id)\n context = {'not... | [
"0.6926425",
"0.6661499",
"0.65961283",
"0.65547436",
"0.65507066",
"0.6485495",
"0.643029",
"0.641658",
"0.6396737",
"0.63873595",
"0.6383726",
"0.63831925",
"0.63764995",
"0.63660586",
"0.63660586",
"0.63484246",
"0.63484246",
"0.63484246",
"0.63484246",
"0.63484246",
"0.63... | 0.5975454 | 51 |
The end of the path. This is a calculated property because sometimes the end is 'open', which means that the end is automatically adjusted to be the end of the current phase. | def end (self):
return self._end if self._end != self.inf else self.e | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def end_path(self) -> str:\n return self.get_from_redis(\"end_path\")",
"def endPath(self) -> None:\n pass",
"def get_end(self):\n return self._end",
"def get_end(self):\n return self.__end",
"def end(self):\n return self.__end_line",
"def _get_end(self):\n retur... | [
"0.74222875",
"0.734482",
"0.7165774",
"0.71453667",
"0.7130121",
"0.7125757",
"0.69665",
"0.67791015",
"0.67788714",
"0.6747188",
"0.6747188",
"0.6747188",
"0.67163265",
"0.6669577",
"0.6655419",
"0.6638375",
"0.66092044",
"0.66042536",
"0.65963286",
"0.65836364",
"0.6577562... | 0.6790509 | 7 |
Calculate water absorbed, water available and water exchanged for all plants of a group. | def calculateBGresourcesGroup(self, members, link_list_group):
## Get the system of linear equations (matrix) for the group of
# grafted plants;
# linear equation Ax=B in matrix form
matrix = self.getBGresourcesMatrixGroup(members=members,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def water_needed(self):\n water = self.water_needed_by_trunk()\n\n water += sum(map(lambda e: e.water_needed(), self.children))\n\n return water",
"def make_water_group(self):\r\n waters_names = ['SPC', 'TIP3', 'TIP4', 'TIP5', 'WAT']\r\n self.__mkGroupByRes('Water', water_names... | [
"0.6520833",
"0.65047836",
"0.64149517",
"0.6147245",
"0.5994674",
"0.59680545",
"0.5958425",
"0.5918724",
"0.5738272",
"0.5683999",
"0.56510717",
"0.5650601",
"0.5620681",
"0.5565135",
"0.54853106",
"0.54817617",
"0.5480861",
"0.544079",
"0.54350835",
"0.54263306",
"0.538163... | 0.5643535 | 12 |
This function identifies the target company from the tweet text, issuing a warning for unrecognized texts. It assumes that the full, untruncated tweet text has already been constructed (see compute_full_text()). | def compute_company(row):
global unknown_company_count_global
associated_company = []
# Identify the target company using known patterns in the tweet text.
tweet = row['text_derived'].lower()
author = row['user_screen_name'].lower()
for company_pattern in PTN_companies:
if re.compile(au... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def detect_author(user_to_tweets: Dict[str, List[tuple]], tweet_text: str) -> \\\n str:\n acc = []\n \n for keys in user_to_tweets:\n author_hashes = hashtag_seperator(user_to_tweets[keys])\n text_hashes = extract_hashtags(tweet_text)\n if set(text_hashes).issubset(author_hashes):\... | [
"0.5696613",
"0.5613782",
"0.5514986",
"0.5482968",
"0.5312689",
"0.52721834",
"0.52462196",
"0.52161294",
"0.5197548",
"0.5151859",
"0.5115014",
"0.50731903",
"0.5070537",
"0.5059215",
"0.50575215",
"0.49826312",
"0.49778822",
"0.49527124",
"0.49474606",
"0.4944147",
"0.4891... | 0.72649103 | 0 |
Initialize account with balance | def __init__(self, balance=0):
self.balance = balance | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, initial_amount = 0):\n self.balance = initial_amount",
"def __init__(self):\n self.account_balance = 0\n self.amount = 0",
"def __init__(self, account_id, balance):\n self.account_id = account_id\n self.balance = balance",
"def __init__(self, account_numb... | [
"0.7953162",
"0.7900487",
"0.78326696",
"0.77097565",
"0.752457",
"0.7395256",
"0.7373415",
"0.7363574",
"0.7194487",
"0.7131793",
"0.7113572",
"0.70813423",
"0.7035591",
"0.7028225",
"0.6953366",
"0.6916816",
"0.6916816",
"0.69029516",
"0.6776953",
"0.6776953",
"0.6776953",
... | 0.76181877 | 4 |
Instance is truthy if balance is greater than zero | def __bool__(self):
return self.balance > 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def balance(balance):\n\n if float(balance) >= 0.0:\n return True\n else:\n return False",
"def has_enough_balance(self, address, value):\n return int(self.addresses[address]['balance']) >= int(value)",
"def check_funds(self, amount):\n if amount > self.get_bal... | [
"0.7943185",
"0.7281657",
"0.7105397",
"0.7074409",
"0.70273745",
"0.6837374",
"0.67857534",
"0.6771081",
"0.67654467",
"0.6764264",
"0.6686117",
"0.6426282",
"0.6422742",
"0.63583505",
"0.62760806",
"0.6258149",
"0.62156785",
"0.6191746",
"0.61761296",
"0.6165583",
"0.608799... | 0.82115215 | 0 |
Convert value to packed form. | def to_packed(self, value):
if not isinstance(value, self.unpacked_type):
raise TypeError(value)
pv = self._to_packed(value)
if (len(pv) < self.min_length) or (self.max_length < len(pv)):
raise OptionLengthError(value)
return pv | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _to_packed(self, value):\n raise NotImplementedError",
"def _from_packed(self, value):\n raise NotImplementedError",
"def pack_val(self,val,stream=''):\n try:\n return stream + struct.pack(\">\"+self.fmt,val)\n except:\n raise ValueError",
"def msgpack_pa... | [
"0.86481655",
"0.7108504",
"0.7064377",
"0.6873717",
"0.6660088",
"0.6626896",
"0.6540108",
"0.65126115",
"0.64760154",
"0.6456696",
"0.64265656",
"0.64181685",
"0.63404316",
"0.6320312",
"0.62513894",
"0.6200925",
"0.614832",
"0.61402667",
"0.61320525",
"0.61204624",
"0.6112... | 0.71905196 | 1 |
Return ``True`` iff number identifies a critical option. | def is_critical_option(number):
return number & 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_critical(self):\n return str(self) in (\"AbiCritical\", \"QCritical\", \"Unconverged\", \"Error\")",
"def check(self, number: int) -> bool:\n return (number in self.numbers_set)",
"def check_number(self, number):\n return (not self.whitelist_numbers or\n number in sel... | [
"0.6351736",
"0.58683264",
"0.58652014",
"0.58082044",
"0.5716863",
"0.5604739",
"0.545997",
"0.54408807",
"0.5311502",
"0.52967334",
"0.5275748",
"0.5272906",
"0.52376837",
"0.52361184",
"0.5205041",
"0.51771677",
"0.5172219",
"0.5158954",
"0.51563734",
"0.51476204",
"0.5140... | 0.8124632 | 0 |
Return ``True`` iff this option may appear at least once in a request message. | def valid_in_request(self):
return self._repeatable[0] is not None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_option(self, key):\n\n return key in self.__opt",
"def valid_multiple_in_request(self):\n return self._repeatable[0] is True",
"def requested() -> bool:\n\treturn _flag.is_set()",
"def valid_in_response(self):\n return self._repeatable[1] is not None",
"def option_is_known(self... | [
"0.665786",
"0.6317925",
"0.6219058",
"0.6210447",
"0.6032289",
"0.6002273",
"0.5971877",
"0.5920948",
"0.59110945",
"0.59110594",
"0.58678997",
"0.5866624",
"0.5852941",
"0.5841195",
"0.5835512",
"0.58019596",
"0.5747506",
"0.57084405",
"0.5702802",
"0.5680196",
"0.5673516",... | 0.6528612 | 1 |
Return ``True`` iff this option may appear multiple times in a request message. | def valid_multiple_in_request(self):
return self._repeatable[0] is True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_multiple_in_response(self):\n return self._repeatable[1] is True",
"def only_once(self) -> bool:\n return self.times == 1",
"def isRepeated(self):\n return self._field.label == FieldDescriptor.LABEL_REPEATED",
"def valid_in_response(self):\n return self._repeatable[1] is... | [
"0.7004605",
"0.64946336",
"0.6176985",
"0.6144877",
"0.613378",
"0.59813803",
"0.5912566",
"0.5871078",
"0.58548886",
"0.5815144",
"0.56824976",
"0.56668687",
"0.56362414",
"0.5606027",
"0.5598573",
"0.5547338",
"0.5475107",
"0.54587466",
"0.5447439",
"0.54259616",
"0.540797... | 0.71789455 | 0 |
Return ``True`` iff this option may appear multiple times in a response message. | def valid_multiple_in_response(self):
return self._repeatable[1] is True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_multiple_in_request(self):\n return self._repeatable[0] is True",
"def valid_in_response(self):\n return self._repeatable[1] is not None",
"def only_once(self) -> bool:\n return self.times == 1",
"def isRepeated(self):\n return self._field.label == FieldDescriptor.LABEL_... | [
"0.66930914",
"0.6651821",
"0.6563542",
"0.6267618",
"0.6073747",
"0.605344",
"0.5985226",
"0.58709383",
"0.57483464",
"0.57360125",
"0.5726517",
"0.569678",
"0.56690544",
"0.5585781",
"0.5551369",
"0.55468005",
"0.5492985",
"0.5435823",
"0.5404594",
"0.5379182",
"0.53619486"... | 0.73638296 | 0 |
Contains the value of the option. This is an instance of | def _get_value(self):
return self.__value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_value(self):\n return self._get_value(self.optionType, self.value, self.defaultValue)",
"def opt_value(self):\n return self._opt_value",
"def OptionValue(self):\n if self.force_auto_sync:\n self.get('OptionValue')\n return self._OptionValue",
"def selected_value... | [
"0.83000505",
"0.82788384",
"0.8106803",
"0.74754095",
"0.74112713",
"0.7403821",
"0.7240465",
"0.7123255",
"0.6999006",
"0.6970556",
"0.6969828",
"0.6948097",
"0.6939403",
"0.6927413",
"0.69100994",
"0.69100994",
"0.69100994",
"0.6908598",
"0.6876871",
"0.6858926",
"0.685837... | 0.66906303 | 71 |
Ensure logging levels are correct when set to INFO. | def test_setup_logging_info(self) -> None:
# set the log level high to ensure they are properly being change by setup_logging
self.f_logger.setLevel(LogLevels.CRITICAL)
self.boto3_logger.setLevel(LogLevels.CRITICAL)
self.botocore_logger.setLevel(LogLevels.CRITICAL)
setup_logging... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _setup_log_levels(self):\n for logger_name, level in self.named_levels.items():\n logger = logging.getLogger(logger_name)\n logger.setLevel(level)\n LOG.info(\"Set %s to use logging level %s\", logger_name, level)",
"def test_set_single_logger_level(self):\n pas... | [
"0.73784083",
"0.7127363",
"0.7117754",
"0.71155375",
"0.70637476",
"0.70030844",
"0.6958855",
"0.6896499",
"0.6856032",
"0.6764709",
"0.6715727",
"0.65778124",
"0.6569934",
"0.6544587",
"0.6544587",
"0.6528209",
"0.6518626",
"0.6502518",
"0.6468188",
"0.6428952",
"0.64262253... | 0.73524535 | 1 |
This method is very important to keep blockchain safe from spamming. This method will use an algorithm to generate a number that will be used to create a new mined block. You can use your own algorithm and set a difficulty level so that people can't mine block easily. Bitcoin uses the Hashcash proof of work system. Gen... | def create_proof_of_work(previous_proof):
proof = previous_proof + 1
while (proof + previous_proof) % 7 != 0:
proof += 1
return proof | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def proof_of_work(self, block):\n block.nonce = 0 \n computed_hash = block.compute_hash()\n while not computed_hash.starswith('0' * Blockchain.difficulty):\n block.nonce += 1 \n computed_hash = block.compute_hash()",
"def proof_of_work(block):\n block.nonce = 0\n... | [
"0.6941896",
"0.6678171",
"0.6649563",
"0.6480323",
"0.64600503",
"0.64379865",
"0.6354243",
"0.6332005",
"0.6331568",
"0.6223958",
"0.61551034",
"0.6153683",
"0.61233366",
"0.60393184",
"0.60290134",
"0.5987292",
"0.59602284",
"0.59555304",
"0.5929251",
"0.59126353",
"0.5904... | 0.6374833 | 6 |
This just updates the limits on the plot. We put it in a separate function so it can be called when the time selection menu is changed. | def updatePlot(self,*args):
# set x limits
timeDisplayOptions = {'10 minutes':10,'1 hour':60,'6 hours':6*60,'24 hours':24*60,'All':0}
try:
lastDatetime = mpl.dates.num2date(self.stage60K.get_xdata()[-1])
firstDatetime = mpl.dates.num2date(self.stage60K.get_xdata()[0])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _update_limits(self):\n if self.pos_x > self.max_x:\n self.max_x = self.pos_x\n if self.pos_y > self.max_y:\n self.max_y = self.pos_y\n if self.pos_x < self.min_x:\n self.min_x = self.pos_x\n if self.pos_y < self.min_y:\n self.min_y = self... | [
"0.69729424",
"0.6846867",
"0.678547",
"0.67705965",
"0.6707118",
"0.66986716",
"0.66781026",
"0.6658897",
"0.65214163",
"0.6466103",
"0.6416409",
"0.6387019",
"0.63638526",
"0.636111",
"0.63448435",
"0.6336131",
"0.63080037",
"0.62865794",
"0.62640834",
"0.62546",
"0.6203816... | 0.69809914 | 0 |
Returns chart configuration object for a chart with given id. Communicates with external database api to fetch chart. | def get_chart(chart_id: int) -> Chart:
if chart_id is None:
raise ValueError("No id provided.")
else:
raise ConnectionError("No external service implemented.") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_configuration_by_id(config_id):\n session = connection.Session()\n try:\n my_configuration = session.query(Configuration).filter(\n Configuration.config_id == config_id).first()\n except:\n session.rollback()\n raise\n finally:\n session.close()\n c... | [
"0.65118104",
"0.5924878",
"0.5913172",
"0.5764782",
"0.57080287",
"0.5707849",
"0.568426",
"0.56425965",
"0.5635276",
"0.5604807",
"0.53932196",
"0.53927666",
"0.5385305",
"0.5377597",
"0.5372954",
"0.535501",
"0.5349873",
"0.5257758",
"0.5255764",
"0.5248607",
"0.52438027",... | 0.78142834 | 0 |
alpha is the desired bound on the false discovery rate (i.e. proportion of false positives against total positives. m is the total number of hypotheses that we test, and P is an array of Pvalues. Use independent = False if the pvalues are not independent of one and other. | def benjamini_hochberg(P, alpha=0.05, independent=True):
P = np.sort(P)
m = len(P)
if independent:
C = 1
else:
C = sum(1. / k for k in range(1, m + 1))
ell = np.arange(1, m + 1) * alpha / (C * m)
R = np.argmax(np.diff(P < ell))
return P[R] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pvalue_test(self, alpha=0.01):\n CL = int((1-alpha)*100) # confidence level\n \n if self.p_value < alpha:\n print(\"Null hypothesis rejected at {:d}%CL => distributions are different\".format(CL))\n else:\n print(\"Null hypothesis NOT rejected => distr... | [
"0.67532045",
"0.6600006",
"0.6322233",
"0.60776556",
"0.60411966",
"0.5920807",
"0.5916072",
"0.58885115",
"0.5857885",
"0.5852425",
"0.58407646",
"0.57969815",
"0.5740167",
"0.5726601",
"0.5695958",
"0.5687992",
"0.5663067",
"0.5655382",
"0.5655106",
"0.5611235",
"0.5604963... | 0.5577038 | 23 |
custom function to remove the stopwords | def remove_stop(text):
STOPWORDS = ['a' ,'b', 'c','d','e','f' ,'g' ,'h','i','j','k','l','m','n','o' ,'p' ,'q','r','s','t','u' ,'v' ,'w','x','y','z']
return " ".join([word for word in str(text).split() if word not in STOPWORDS]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_stopwords_fun(self):\n tokens = str(self.doc).split()\n cleaned_tokens = [token for token in tokens\n if token.lower() not in self.stopword_list]\n self.doc = ' '.join(cleaned_tokens)",
"def remove_stopwords(text):\n stopwords = [\"i\", \"me\", \"my\", ... | [
"0.8823565",
"0.8401623",
"0.8289207",
"0.8248563",
"0.8228253",
"0.82197374",
"0.8181915",
"0.8181915",
"0.8181915",
"0.8181915",
"0.8164255",
"0.81541234",
"0.81183577",
"0.8115647",
"0.81121063",
"0.8105464",
"0.8080783",
"0.8072988",
"0.806302",
"0.80382043",
"0.80332667"... | 0.7410538 | 69 |
Set the amount of rolls. | def rolls(self, rolls):
self._rolls = rolls | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_total_rolls(self):\n\n # Incremene the attribute by 1\n self._total_rolls += 1",
"def inc_rolls(self):\n self._rolls += 1",
"def roll(self):\n self.rolled = random.randint(1, 6)\n return self.rolled",
"def roll_dice(self):\n self.roll = (random.randint(1,6... | [
"0.75398564",
"0.7385004",
"0.68502325",
"0.64957064",
"0.6463144",
"0.64352345",
"0.6241606",
"0.6231023",
"0.6191605",
"0.6190525",
"0.6190275",
"0.61355335",
"0.61262727",
"0.60738546",
"0.6051682",
"0.60251045",
"0.6009221",
"0.5981302",
"0.5972627",
"0.593244",
"0.588104... | 0.78020304 | 0 |
Setup the configuration for the Flask app. This method is meant to be overridden in the case that a Flask app needs extra configuration. By default it sets the app Secret Key. | def setup_app_config(self, app: Flask) -> Flask:
app.secret_key = config.get_setting('SECRET_KEY')
return app | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def configure_secret_key(app):\n key_file = os.path.join(app.instance_path, 'secret.key')\n app.config['SECRET_KEY'] = get_secret_key(key_file)",
"def init_config():\n if 'FLASKUTILS_SETTINGS_MODULE' not in os.environ:\n raise ConfigurationError('No settings has been defined')\n\n ... | [
"0.7199223",
"0.6930156",
"0.6919864",
"0.6879763",
"0.68642753",
"0.6853833",
"0.6583093",
"0.65813184",
"0.6574622",
"0.6487712",
"0.64572114",
"0.64319974",
"0.6359506",
"0.63439614",
"0.62976485",
"0.62691975",
"0.62650275",
"0.62260985",
"0.6220788",
"0.62140787",
"0.620... | 0.8373161 | 0 |
Generate a Flask application with our preferred defaults. | def generate(self) -> Flask:
app = Flask(self.name, *self.args, **self.kwargs)
app = self.setup_app_config(app)
app = self.add_app_headers(app)
app = self.add_xsrf_error_handler(app)
return app | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_app() -> Flask:\n logger.info('creating flask application')\n app = Flask(\n 'pasta',\n static_url_path='/static',\n static_folder='./static',\n template_folder='./views')\n config.flask.SECRET_KEY = os.urandom(32)\n config.flask.SERVER_NAME = None\n app.config.f... | [
"0.7909486",
"0.7618156",
"0.7587956",
"0.751445",
"0.7501904",
"0.7484817",
"0.74160194",
"0.73780286",
"0.73758",
"0.7372829",
"0.7326809",
"0.7324248",
"0.73174256",
"0.72977144",
"0.72930497",
"0.7288373",
"0.7286618",
"0.7284041",
"0.7281885",
"0.72580165",
"0.72394854",... | 0.8261068 | 0 |
return a date one month in advance of 'date'. If the next month has fewer days then the current date's month, this will return an early date in the following month. | def next_month(date):
return date + datetime.timedelta(days=calendar.monthrange(date.year, date.month)[1]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def first_of_next_month(ref_date):\n year, month = add_months(ref_date.year, ref_date.month, 1)\n return type(ref_date)(year, month, 1)",
"def next_month(dateobj):\n year_delta, old_month = divmod(dateobj.month, 12)\n return datetime.date(dateobj.year + year_delta, old_month + 1, 1)",
"def ceil_sta... | [
"0.75237036",
"0.75181353",
"0.7469637",
"0.7203281",
"0.6971175",
"0.69181037",
"0.69181037",
"0.680561",
"0.6780251",
"0.6780251",
"0.6707535",
"0.6682568",
"0.6662633",
"0.6621288",
"0.6621288",
"0.65722543",
"0.65586656",
"0.6508916",
"0.6506974",
"0.64988816",
"0.6491393... | 0.8587938 | 0 |
a constrainable version of tf.argmax | def _argmax(self, input_tensor, dimension, c):
with self.session.graph.as_default():
min_values = tf.reduce_min(input_tensor, reduction_indices=[dimension,], keep_dims=True)
not_c = tf.abs(c - 1)
return tf.argmax(input_tensor * c + not_c * min_values, dimension) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def argmax(tensor):\n raise NotImplementedError",
"def max(tensor, axis=None):\n raise NotImplementedError",
"def max_n(inputs):\n ret = inputs[0]\n inputs = inputs[1:]\n for x in inputs:\n ret = tf.maximum(ret, x)\n return ret",
"def softmax_with_reduce_max(inp, axis=-1):\n ... | [
"0.7678649",
"0.69429123",
"0.6933782",
"0.6898688",
"0.6898688",
"0.67980206",
"0.67398393",
"0.6685052",
"0.66439664",
"0.6575737",
"0.6575708",
"0.6470778",
"0.64617753",
"0.64558613",
"0.64127415",
"0.64127415",
"0.6411897",
"0.64095986",
"0.63736093",
"0.636324",
"0.6362... | 0.7244173 | 1 |
Returns an increasing subsequence of array of length k (if found). | def get_subsequence(a, k):
if k > len(a):
return None
dp = [0] * len(a)
aux = [inf] * (k + 1)
aux[0] = -inf
high = 0
for i in range(len(a)):
dp[i] = bisect_left(aux, a[i])
aux[dp[i]] = min(aux[dp[i]], a[i])
high = max(high, dp[i])
if high == k:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fn(arr, k):\n ans = []\n for i, x in enumerate(arr): \n while ans and ans[-1] < x and len(ans) + len(arr) - i > k: ans.pop()\n if len(ans) < k: ans.append(x)\n return ans",
"def rotate_array(arr: list, k: int):\n\n return arr[-k::] + arr[:(len... | [
"0.71905845",
"0.6790254",
"0.67700154",
"0.67575175",
"0.6747199",
"0.6681213",
"0.65809906",
"0.65525365",
"0.6528025",
"0.6467839",
"0.6421712",
"0.63624656",
"0.6333768",
"0.63275117",
"0.6289315",
"0.62862104",
"0.6285352",
"0.6275237",
"0.6243933",
"0.62083817",
"0.6190... | 0.79856455 | 0 |
Create a tree from a node that is "root" in the tree. | def __init__(self, root):
self.root = root | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def construct_tree():\n root = TreeNode(5)\n root.left = TreeNode(3)\n root.right = TreeNode(8)\n root.left.left = TreeNode(2)\n root.left.right = TreeNode(4)\n root.right.left = TreeNode(7)\n return root",
"def build():\n\n root = Node(9)\n root.left = Node(6)\n root.left.left = No... | [
"0.77264977",
"0.7302258",
"0.726413",
"0.70362383",
"0.6717743",
"0.66498417",
"0.6613964",
"0.6604173",
"0.6604173",
"0.6602139",
"0.6586775",
"0.6520381",
"0.6508259",
"0.6507987",
"0.6481189",
"0.64737415",
"0.64601386",
"0.6451135",
"0.64422506",
"0.6435912",
"0.6400039"... | 0.0 | -1 |
Returns all nodes as a list | def getNodes(self, strategy = 'DEPTH-FIRST'):
nodes = []
queue = [self.root]
while len(queue) > 0:
node = queue.pop()
nodes.append(node)
# if strategy.upper().startswith('DEPTH'):
if not node.isLeaf():
queue.extend(node.children)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_node_list(self):\n return []",
"def get_node_list(self):\n return [[node] for node in self.graph.nodes]",
"def nodes(self): \n return [n for n in self.iternodes()]",
"def as_list(self):\n nodes = []\n node = self.first_node\n while node:\n nodes.ap... | [
"0.8597381",
"0.84329146",
"0.8410721",
"0.83637947",
"0.8165994",
"0.8165994",
"0.8144975",
"0.8026371",
"0.7985809",
"0.7977207",
"0.7923016",
"0.7916445",
"0.79031473",
"0.7877641",
"0.7864353",
"0.7771399",
"0.7759789",
"0.7757811",
"0.7757811",
"0.7746061",
"0.7737144",
... | 0.0 | -1 |
Returns string with node (incl descendants) in a Newick style. | def __str__(self):
stubs = ['' for _ in range(self.nChildren())]
label = dist = ''
for i in range(self.nChildren()):
stubs[i] = str(self.children[i])
if self.dist or self.dist == 0.0:
dist = ':' + str(self.dist)
if self.label != None:
label = s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_newick(self):\n tree_list = self.get_cluster_elements_labels\n newick = \"(\"\n \n \n newick = _get_newick_intermediate(tree_list,newick,False)\n\n newick = newick[0] + \");\"\n\n return newick",
"def get_node_tree_print_string(node: Node) -> str:\n nod... | [
"0.68169594",
"0.6401403",
"0.63146996",
"0.63013405",
"0.6249807",
"0.6249058",
"0.6213708",
"0.621351",
"0.6205817",
"0.6199942",
"0.6184481",
"0.6131897",
"0.61220986",
"0.60794437",
"0.6071962",
"0.6069767",
"0.6069327",
"0.6047322",
"0.6034819",
"0.6032283",
"0.6031069",... | 0.0 | -1 |
Returns string with node (incl descendants) in a Newick style. | def _printSequences(self, start, end):
stubs = ['' for _ in range(self.nChildren())]
label = dist = ''
for i in range(self.nChildren()):
stubs[i] = self._printSequences(self.children[i], start, end)
if self.dist or self.dist == 0.0:
dist = ':' + str(self.dist)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_newick(self):\n tree_list = self.get_cluster_elements_labels\n newick = \"(\"\n \n \n newick = _get_newick_intermediate(tree_list,newick,False)\n\n newick = newick[0] + \");\"\n\n return newick",
"def get_node_tree_print_string(node: Node) -> str:\n nod... | [
"0.6817552",
"0.64031994",
"0.63166195",
"0.630312",
"0.62489796",
"0.6248956",
"0.6216337",
"0.62125653",
"0.62071484",
"0.6201597",
"0.6186492",
"0.6134584",
"0.61230206",
"0.6079712",
"0.6071914",
"0.6071524",
"0.6068265",
"0.6049392",
"0.6037761",
"0.6035471",
"0.603411",... | 0.0 | -1 |
Find a node by label at this node or in any descendants (recursively). | def _findLabel(self, label):
if self.label == label:
return self
else:
for i in range(self.nChildren()):
found = self.children[i]._findLabel(label)
if found:
return found
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nodeWithLabel(self, label):\r\n for nt in self.listNodes.keys(): \t# for all kind of nodes...\r\n for node in self.listNodes[nt]: \t# for all nodes of type <nt>\r\n if node.GGLabel.getValue() == label: # check if the node's label is what we are looking for... | [
"0.7505685",
"0.7443465",
"0.6713871",
"0.66146094",
"0.65507793",
"0.6399838",
"0.63660276",
"0.6361973",
"0.63149834",
"0.627915",
"0.6244611",
"0.6209815",
"0.61728686",
"0.61343277",
"0.6127704",
"0.61018175",
"0.61007464",
"0.6076795",
"0.6007735",
"0.6007589",
"0.600758... | 0.82340354 | 0 |
Retrieve and return (list of) nodes descendant of this. If transitive is False (default), only direct descendants are included. If transitive is True, all descendants are (recursively) included. | def getDescendants(self, transitive=False):
children = []
for i in range(self.nChildren()):
children.append(self.children[i])
if not transitive:
return children
else:
grandchildren = []
for c in children:
d = c.getDescendant... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getDescendantsOf(self, node, transitive=False):\n if not isinstance(node, PhyloNode):\n node = self.findLabel(node)\n if node:\n return node.getDescendants(transitive)\n return None",
"def getAncestors(self, transitive=False):\n if self.parent == None:\n ... | [
"0.71189356",
"0.68233633",
"0.6454984",
"0.62291974",
"0.60535073",
"0.59824556",
"0.5946516",
"0.59396183",
"0.5736286",
"0.5713195",
"0.56391734",
"0.55963564",
"0.55955654",
"0.557082",
"0.55042374",
"0.5422957",
"0.5419807",
"0.5373518",
"0.53246486",
"0.5303088",
"0.530... | 0.8021294 | 0 |
Search through the matrix by row. | def search_matrix(row, current_sum, best, mask):
if row == SIZE:
return current_sum
# if we compare the current_sum plus the max sum of the remaining columns, and we can't beat our
# best sum, abort
if current_sum + REMAIMING_MAX[row] <= best:
return 0
for column in range(0, SIZE):... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def matrix_search(m, el):\n rows, cols = len(m), len(m[0])\n r, c = 0, cols - 1\n\n while r < rows and c >= 0:\n if m[r][c] == el:\n break\n elif m[r][c] > el:\n c -= 1\n else:\n r += 1\n\n return r, c",
"def contains_row(matrix, row):\n return... | [
"0.670191",
"0.6475018",
"0.6182763",
"0.6162033",
"0.61033976",
"0.608357",
"0.6024721",
"0.59828436",
"0.5973569",
"0.5933769",
"0.5860181",
"0.58508646",
"0.58001566",
"0.5790146",
"0.57711226",
"0.5756141",
"0.5746149",
"0.57427377",
"0.5705183",
"0.57048434",
"0.5680376"... | 0.52803665 | 62 |
Add a related language to an existing relation graph. | def test_related_add_existing_child(related_record, testdata):
docs = testdata["documents"]
series = testdata["series"]
doc1 = Document.get_record_by_pid(docs[0]["document_pid"])
doc6 = Document.get_record_by_pid(docs[4]["document_pid"])
ser10 = Series.get_record_by_pid(series[1]["series_pid"])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_related_add_language(app, testdata):\n doc1 = Document.get_record_by_pid(testdata[\"documents\"][0][\"document_pid\"])\n doc2 = Document.get_record_by_pid(testdata[\"documents\"][1][\"document_pid\"])\n\n doc1.related.add_language(doc2)\n\n parent_languages = doc1.related.languages\n child_... | [
"0.69292474",
"0.61778337",
"0.5919428",
"0.59173226",
"0.57819486",
"0.5642437",
"0.5611441",
"0.54581183",
"0.54461926",
"0.5445164",
"0.5439688",
"0.53914607",
"0.5359619",
"0.52514625",
"0.5185728",
"0.5168728",
"0.5165889",
"0.5150778",
"0.5142409",
"0.5122622",
"0.51053... | 0.5245591 | 14 |
Returns True if the given user can do the given action, otherwise returns False | def can(user, action):
v = bitvector.BitVector(user.access_level)
return v.is_set(EVERYTHING) or v.is_set(action) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def view(self, user, action, *args):\n if user.is_anonymous or user.is_client:\n return False\n\n if user.is_administrator:\n return True\n\n if user.is_manager:\n return False\n\n # TODO check groups in request maybe ? dunno\n if user.is_advisor:... | [
"0.81791806",
"0.7705522",
"0.7603144",
"0.72223186",
"0.72076553",
"0.715557",
"0.71461904",
"0.71443003",
"0.7113385",
"0.7083939",
"0.7063524",
"0.7024482",
"0.7008355",
"0.7002953",
"0.69669217",
"0.6959421",
"0.69452924",
"0.692764",
"0.69036293",
"0.68946594",
"0.68795"... | 0.81053865 | 1 |
Retrieve a list of question objects that belong to the category id provided along with the total of questions and the current category. | def retrieve_questions_by_category(category_id):
try:
selection = Question.query.filter(
Question.category == category_id).order_by(Question.id).all()
if len(selection) == 0:
abort(404)
questions = []
for question in selection:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_questions_per_category(category_id):\n questions = Question.query.filter(Question.category == category_id).all()\n\n if len(questions) == 0:\n abort(404)\n\n formatted_questions = [question.format() for question in questions]\n return jsonify({\n 'success':... | [
"0.77762574",
"0.7582906",
"0.75824726",
"0.754328",
"0.74690384",
"0.6553724",
"0.65512806",
"0.65091383",
"0.62899417",
"0.62215126",
"0.6205137",
"0.61774516",
"0.612792",
"0.61184573",
"0.6090481",
"0.60302997",
"0.59339976",
"0.5869045",
"0.5841057",
"0.58367103",
"0.581... | 0.7688467 | 1 |
Return a random question that belong to the category provided and that is not any of the previous questions. | def play_quizz():
body = request.get_json()
previous_questions = body.get('previous_questions', [])
quiz_category = body.get('quiz_category', None)
try:
quiz_category['id'] = int(quiz_category['id'])
except:
abort(405)
selection = []
ALL... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_random_question(self):\n available_qs = self.available_qs\n if available_qs.exists():\n return random.choice(available_qs)",
"def get_quiz_question():\n if request.content_type != \"application/json\":\n abort(415)\n previous_questions: list[int] = reques... | [
"0.67102814",
"0.63656265",
"0.5974335",
"0.59122866",
"0.5873354",
"0.57505035",
"0.56965464",
"0.56834596",
"0.56058484",
"0.5604836",
"0.5598445",
"0.55806845",
"0.5580359",
"0.5572733",
"0.5571551",
"0.5545844",
"0.55259943",
"0.5524069",
"0.5489524",
"0.5481339",
"0.5417... | 0.50594187 | 50 |
Convenience property to access the `Plotter` instance, which contains easy methods for basic plots. Returns `Plotter` The plotter class instance. | def plot(self):
return Plotter(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_plotter(self):\n \n return graphical.TrajectoryPlotter(self)",
"def _get_plotter(self):\n self.plotter = Plotter(\n axes=self._make_axes() if settings.SHOW_AXES else None,\n pos=(0, 0),\n title=\"brainrender\",\n bg=settings.BACKGROUND_COLO... | [
"0.8083355",
"0.78201425",
"0.7065065",
"0.6762227",
"0.66604626",
"0.65556526",
"0.6434893",
"0.61674476",
"0.6077074",
"0.6050804",
"0.604349",
"0.6037413",
"0.59835124",
"0.58849126",
"0.56851816",
"0.56005305",
"0.55608624",
"0.55183",
"0.5513459",
"0.54961085",
"0.548577... | 0.84322476 | 0 |
Perform a spatial query to calculate the projected density. | def spatial_query(self, z_draws, z_cm, dz_thresh=0.01):
n_obj = len(self)
dr = np.zeros_like(self['ra'])
dd = dr * 0.
aspect = dr * 0.
projected_density = np.zeros(n_obj)
roots = np.unique(self['root'])
dr_cm, dr_sep, dr_area = self.separation_radius(z_cm)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def density_grid(self):\n # Create a grid that contains the area in m2 per grid cell.\n if self.crs.is_geographic:\n area = self.area_grid()\n\n elif self.crs.is_projected:\n ucf = rasterio.crs.CRS.from_user_input(self.crs).linear_units_factor[1]\n area = abs(s... | [
"0.59410423",
"0.58309245",
"0.5766859",
"0.5720934",
"0.566541",
"0.5612836",
"0.55774325",
"0.5555027",
"0.55545056",
"0.54892445",
"0.5480157",
"0.5479234",
"0.5475572",
"0.5420816",
"0.5413919",
"0.54037374",
"0.53500783",
"0.53466976",
"0.5308443",
"0.526394",
"0.5252955... | 0.6005363 | 0 |
Converts time in Gitilesspecific format to datetime. | def parse_time(tm):
tm_parts = tm.split()
# Time stamps from gitiles sometimes have a UTC offset (e.g., -0800), and
# sometimes not. time.strptime() cannot parse UTC offsets, so if one is
# present, strip it out and parse manually.
timezone = None
if len(tm_parts) == 6:
tm = ' '.join(tm_parts[:-1])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_datetime(date, time):\n return datetime.datetime.strptime(date + \" \" + time, '%Y-%m-%d %H:%M:%S')",
"def convert_time(cls, time_str):\n if cls.date_ignore_pattern:\n time_str = re.sub(cls.date_ignore_pattern, '', time_str)\n return datetime.strptime(time_str, cls.date_fo... | [
"0.70353776",
"0.70126784",
"0.6687761",
"0.6670276",
"0.6649802",
"0.6617577",
"0.6615495",
"0.65611935",
"0.6508349",
"0.64830565",
"0.6482019",
"0.64736116",
"0.64291036",
"0.6427242",
"0.64181316",
"0.64057714",
"0.6382053",
"0.63651353",
"0.635569",
"0.6352932",
"0.63412... | 0.584788 | 76 |
Removing stop words from user query | def removestopwords(query):
wordlist = [word for word in query.split() if word not in stopwords.words('english')]
return " ".join(wordlist) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_stop_words(self, query):\n ans=\"\"\n words= query.split()\n for word in words:\n if word.lower() not in self.stop_words:\n ans+=word+\" \"\n return ans",
"def clean_string(self):\n\n cleaned = unidecode(self.user_query).lower()\n cle... | [
"0.864622",
"0.79861206",
"0.77600175",
"0.76680076",
"0.7317824",
"0.72542",
"0.71821",
"0.71496654",
"0.713319",
"0.7123882",
"0.7118023",
"0.7090382",
"0.70888937",
"0.7082846",
"0.70590854",
"0.7045588",
"0.69747204",
"0.69121045",
"0.69018644",
"0.68773144",
"0.6839356",... | 0.7873931 | 2 |
Removing text containing http. This is done in addition to removing stop words because stack exchnage data contains a lot of http links We did not want to include them as categories. | def removeurl(wordlist):
newlist=[]
for w in wordlist:
phrases=str(w[0]).split()
for phrase in phrases:
if(phrase.startswith('http') is True):
phrase=""
newlist.append((phrases,w[1]))
return newlist | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _remove_urls(self, text: str) -> str:\n pattern = r\"http\\S+\"\n return re.sub(pattern, \" \", str(text))",
"def remove_urls(self, text):\n return re.sub(r'http.?://[^\\s]+[\\s]?', '', text)",
"def remove_urls(text):\n pass",
"def remove_urls(text):\n text = re.sub('(?P<ur... | [
"0.8140522",
"0.77796614",
"0.7572648",
"0.755092",
"0.7473635",
"0.73308855",
"0.7298877",
"0.7282836",
"0.7276318",
"0.71344036",
"0.71276087",
"0.71054554",
"0.70693886",
"0.7044119",
"0.700906",
"0.69958794",
"0.6991723",
"0.69413084",
"0.69242114",
"0.68023324",
"0.67670... | 0.6711569 | 21 |
Non200 status codes are treated as NotFoundErrors. | def test_fetch_url_not_ok():
with patch("cheddar.index.remote.get") as mocked:
mocked.return_value = MagicMock()
mocked.return_value.status_code = codes.bad_request
with assert_raises(NotFoundError):
fetch_url("http://example.com", TIMEOUT, getLogger()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def not_found():\n return HttpError(404)",
"def not_found(self, error):\n return jsonify({'error': 'NOT FOUND'}), 404",
"def not_found(error): # pylint: disable=unused-argument\n response = jsonify(\n {\"success\": False, \"error_code\": 404, \"message\": \"Not Found\"}\n )\n return resp... | [
"0.75049514",
"0.74509406",
"0.74472773",
"0.74261755",
"0.7411975",
"0.73083514",
"0.72996825",
"0.7260912",
"0.7172013",
"0.71331763",
"0.7122226",
"0.7112234",
"0.70796347",
"0.70678174",
"0.70619994",
"0.70543873",
"0.70320284",
"0.7022096",
"0.70210284",
"0.7016814",
"0.... | 0.0 | -1 |
Return descendants of type `type` | def descendants(self, type: str):
return list(descendants(self.type_tree, type)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def descendants(self):\n for a in self._related(set(), 'children'):\n yield a",
"def descendants(cls):\n return cls.__subclasses__() + \\\n [g for s in cls.__subclasses__() for g in s.descendants()]",
"def get_children(self, *seg_type: str) -> List[BaseSegment]:\n b... | [
"0.6539508",
"0.63285637",
"0.62924606",
"0.6242546",
"0.62076044",
"0.619932",
"0.6165065",
"0.61643106",
"0.613949",
"0.6115447",
"0.60811734",
"0.60654396",
"0.6010511",
"0.5990686",
"0.5948994",
"0.59063995",
"0.5904499",
"0.589363",
"0.58906347",
"0.5852431",
"0.58033055... | 0.8702833 | 0 |
Turn off the switch. | async def async_turn_off(self, **kwargs: Any) -> None:
await self.entity_description.set_command(self, False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def turn_off(self):\n self.handleCommand(1)\n self._state = STATE_OFF",
"def off_switch(self):\n self._switch_callback = None",
"def turn_off(self, **kwargs):\n self.smartplug.turn_off()",
"def turn_off(self, **kwargs):\n set_sonoff_state(self._host, \"off\")\n self.... | [
"0.86709875",
"0.8610023",
"0.8504171",
"0.84375894",
"0.8349381",
"0.83241683",
"0.83171844",
"0.8292722",
"0.8285083",
"0.82738924",
"0.8258591",
"0.8195308",
"0.81797874",
"0.81612587",
"0.81196177",
"0.8116077",
"0.8111577",
"0.8107184",
"0.8093609",
"0.80684984",
"0.8002... | 0.0 | -1 |
Returns a boolean indicating whether or not the resource is in the cache | def resourceExists(self, uri):
return uri in self.cache | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_cache(self):\n try:\n cache = self.get_cache()\n return True\n except (KeyError, AttributeError):\n return False",
"def cached(self, key):\n return key in self._cache",
"def is_cached(self):\n return False",
"def _check_cache(self):\n ... | [
"0.7866917",
"0.77674526",
"0.7758504",
"0.7644629",
"0.75820166",
"0.7533671",
"0.7475945",
"0.7470769",
"0.73873365",
"0.7298565",
"0.7272562",
"0.72211844",
"0.7182152",
"0.7167297",
"0.7162016",
"0.7155817",
"0.70938087",
"0.7085736",
"0.7072006",
"0.7070189",
"0.7043332"... | 0.77047527 | 3 |
Get the duration of given audio file, in seconds. | def get_audio_file_duration_sec(file_path):
pure_path = pathlib.PurePath(file_path)
audio_seg = pydub.AudioSegment.from_file(pure_path, pure_path.suffix[1:])
return audio_seg.duration_seconds | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def duration(self):\n with audioread.audio_open(self.path) as f:\n return f.duration",
"def _duration(self):\n if getattr(self, '_duration_cache', None):\n return self._duration_cache\n duration = extractMetadata(guessParser(\\\n InputIOStream(self))).get('du... | [
"0.83321285",
"0.7888963",
"0.7677617",
"0.7675698",
"0.75412136",
"0.7523174",
"0.7491303",
"0.72688806",
"0.7209963",
"0.7174759",
"0.71186584",
"0.70174086",
"0.68890023",
"0.6839329",
"0.67705494",
"0.6701813",
"0.66989267",
"0.6694544",
"0.66904783",
"0.6683922",
"0.6672... | 0.8561251 | 0 |
Regroup utterances by using wordlevel timestamps and speaker indices. A boundary between the utterances in `utterances` are respected in the regrouped utterances, if and only if there is a gap between the two words at the two sides of the boundary. | def regroup_utterances(utterances, words):
all_words = []
original_bounds = []
for utterance in utterances:
utterance_words = [w.strip() for w in utterance.split(" ") if w]
all_words.extend(utterance_words)
original_bounds.append(
(len(utterance_words) + original_bounds[-1]) if original_bounds... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge_utterance_lines(utt_dict):\n new_utterances = {}\n for uid, utt in utt_dict.items():\n merged = False\n if utt.reply_to is not None and utt.speaker is not None:\n u0 = utt_dict[utt.reply_to]\n if u0.root == utt.root and u0.speaker == utt.speaker:\n ... | [
"0.5898699",
"0.58307666",
"0.5811763",
"0.53933984",
"0.51648027",
"0.5043441",
"0.4940336",
"0.48946774",
"0.4894231",
"0.48705527",
"0.48530787",
"0.48474246",
"0.4759834",
"0.47258553",
"0.46977386",
"0.46818677",
"0.46809426",
"0.4675914",
"0.4660164",
"0.46399462",
"0.4... | 0.8262106 | 0 |
Return true if set s contains value v as an element. >>> s = Link(1, Link(3, Link(2))) >>> contains(s, 2) True >>> contains(s, 5) False | def contains(s, v):
if empty(s):
return False
elif s.first == v:
return True
else:
return contains(s.rest, v) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __contains__(self, v):\n for i in self:\n if v in i:\n return True\n False",
"def contains(s, v):\n head = s\n while not empty(head):\n if head.first == v:\n return True\n head = head.rest\n return False",
"def has(self, v):\n ... | [
"0.75835574",
"0.70220816",
"0.68833876",
"0.679169",
"0.679169",
"0.67805535",
"0.6682476",
"0.65120304",
"0.64799297",
"0.64611685",
"0.64540267",
"0.6444838",
"0.6421102",
"0.6414975",
"0.6395543",
"0.63935304",
"0.6388657",
"0.6359729",
"0.6352513",
"0.6351029",
"0.632172... | 0.7086441 | 1 |
Filters a list of words to those are are valuable. Currently only makes sure that words are at least three characters. >>> w = ['hello', 'world', 'the', 'a', 'an'] >>> important_words(w) ['hello', 'world', 'the'] | def important_words(words):
return [x for x in words if len(x) >= 3] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean_words(words):\n return [clean_word(w) for w in words if len(clean_word(w)) >= 3]",
"def keepAllowedWords(self, words, keepWords):\n\t\tkept = [word for word in words if word in keepWords]\t\t\n\t\treturn kept",
"def importantWords(self, ignoreSemanticTagList=[]):\n words = set([])\n for toke... | [
"0.6960841",
"0.65794",
"0.65569043",
"0.63303006",
"0.629485",
"0.6271312",
"0.627032",
"0.62578964",
"0.6222073",
"0.61230373",
"0.60830384",
"0.6039497",
"0.6024355",
"0.593345",
"0.5821956",
"0.57900864",
"0.5753196",
"0.5730822",
"0.5704613",
"0.5701098",
"0.56928223",
... | 0.8137876 | 0 |
function that computes equilibrium profile for a game using multiplicative weights algorithm iters = number of iterations epsilon = epsilon parameter game = instance of Game class | def no_regrets(game, iters, e):
game_actions = game.numActions()
num_players = game.numPlayers()
# initialize strategies so that all actions have equal weights
weights = [ [1 for _ in xrange(size) ] for size in game_actions]
for _ in xrange(iters):
# generate mixed strategies for each ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def evaluate(game, player):\n weights = [2, 200, 2000, 20000]\n reward = 0\n opponent = get_opponent(player)\n for length in range(2, 6):\n reward += weights[length - 2] * get_num_series(game, player, length)\n reward -= weights[length - 2] * get_num_series(game, opponent, length)\n re... | [
"0.6525867",
"0.6091914",
"0.6087904",
"0.602307",
"0.60155195",
"0.5941081",
"0.5901388",
"0.5884387",
"0.58605963",
"0.5843595",
"0.5824338",
"0.58238405",
"0.58139104",
"0.58092314",
"0.5804368",
"0.5798249",
"0.5778337",
"0.576247",
"0.5749912",
"0.57452184",
"0.5742998",... | 0.59205437 | 6 |
Generate a name for a DiskType using a given uuid. | def get_name_by_uuid(disk_type, uuid, short=False):
prefix = '%s_' % (disk_type[0] if short else disk_type)
return pvm_util.sanitize_file_name_for_api(
uuid, prefix=prefix, max_len=pvm_const.MaxLen.VDISK_NAME if short
else pvm_const.MaxLen.FILENAME_DEFAULT) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_disk_name(disk_type, instance, short=False):\n prefix = '%s_' % (disk_type[0] if short else disk_type)\n base = ('%s_%s' % (instance.name[:8], instance.uuid[:4]) if short\n else instance.name)\n return pvm_util.sanitize_file_name_for_api(\n base, prefix=prefi... | [
"0.7109476",
"0.6545667",
"0.6507195",
"0.63580865",
"0.63459915",
"0.6298941",
"0.61929977",
"0.6152433",
"0.6098004",
"0.6096052",
"0.60402924",
"0.60274416",
"0.59869426",
"0.5974399",
"0.59345067",
"0.59241945",
"0.5918831",
"0.58771276",
"0.58720386",
"0.58717984",
"0.58... | 0.807177 | 0 |
Convert a GB size (usually of a disk) to bytes, with a minimum. | def _disk_gb_to_bytes(size_gb, floor=None):
disk_bytes = size_gb * units.Gi
if floor is not None:
if disk_bytes < floor:
disk_bytes = floor
return disk_bytes | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def size_to_gb(self, value):\n nb = re.search(\"[0-9]+\", value)\n if nb:\n nb = int(re.search(\"[0-9]+\", value).group())\n else:\n return 0\n if \"MB\" in value:\n return nb / 1024 if nb else 0\n elif \"GB\" in value:\n return nb\n ... | [
"0.81912106",
"0.7962849",
"0.7753249",
"0.76488125",
"0.74980754",
"0.7431103",
"0.7334594",
"0.72826415",
"0.7237502",
"0.7195972",
"0.7169093",
"0.71073925",
"0.70719355",
"0.70651174",
"0.70054996",
"0.69910496",
"0.69440705",
"0.6942241",
"0.6941221",
"0.6938423",
"0.691... | 0.81869435 | 1 |
Returns an instance of an Elasticsearch cluster connection. | def connect(args):
return elasticsearch.Elasticsearch(
[f"{args.host}:{args.port}"],
use_ssl=True,
verify_certs=True,
ca_certs=args.ca_certs,
client_cert=args.cert,
client_key=args.key,
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_connection(self):\n\n return Elasticsearch(\n self.conn_info[\"DATABASE_URI\"][\"hosts\"],\n use_ssl=self.conn_info.get(\"USE_SSL\", False),\n verify_certs=self.conn_info.get(\"VERIFY_CERTS\", False),\n )",
"def connection_es(): \n client = Elasticsear... | [
"0.79400486",
"0.7268057",
"0.72395104",
"0.704553",
"0.70328546",
"0.7029432",
"0.69135934",
"0.6854855",
"0.6729422",
"0.67037433",
"0.6615468",
"0.66135854",
"0.64333665",
"0.6384744",
"0.6353994",
"0.6326236",
"0.61957157",
"0.60788625",
"0.5993861",
"0.5960883",
"0.59299... | 0.68109375 | 8 |
Creates a temp folder which is deleted after used | def tmp_dir():
tmpdir = tempfile.mkdtemp()
yield tmpdir
shutil.rmtree(tmpdir) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_temp_folder():\n path_join = os.path.join(tempfile.gettempdir(), id_generator(5))\n os.makedirs(path_join)\n return path_join",
"def makeTempDir(self):\n try:\n os.mkdir(self.temp_dir)\n except FileExistsError:\n pass",
"def generate_temp_folder(self):\n ... | [
"0.81757224",
"0.7930139",
"0.7839827",
"0.7827467",
"0.77690333",
"0.77499795",
"0.77215666",
"0.7672008",
"0.766672",
"0.76290923",
"0.7528828",
"0.7482216",
"0.74566203",
"0.7454235",
"0.7401601",
"0.73948306",
"0.7387412",
"0.7382071",
"0.73796713",
"0.7376745",
"0.737605... | 0.75813866 | 10 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.