query stringlengths 9 9.05k | document stringlengths 10 222k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 4 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Returns a list of linearspaced values with min_value and max_value as the boundaries with the specified number (length) of entries. If roundToIntegers is True, each value will be rounded to the nearest integer. | def linear_space(min_value=0, max_value=1.0, length=10, round_op=None):
out = []
value = min_value
length = max(2, length)
delta = (float(max_value) - float(min_value)) / float(length - 1.0)
for index in range(length - 1):
out.append(round_op(value) if round_op else value)
value +=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def math_map_list(values, toMin=0, toMax=1):\n minValue = min(values)\n maxValue = max(values)\n delta = maxValue - minValue\n deltaTarget = toMax - toMin\n newValues = [toMin +(value-minValue)*deltaTarget/delta for value in values]\n return newValues",
"def get_numeric_intervals(self):\n ... | [
"0.6354057",
"0.6273124",
"0.603573",
"0.60351825",
"0.6027625",
"0.59930015",
"0.59687275",
"0.5939713",
"0.5936503",
"0.5912387",
"0.581435",
"0.5784891",
"0.5772762",
"0.5737696",
"0.5734971",
"0.570616",
"0.5631111",
"0.5624516",
"0.55972034",
"0.55809015",
"0.5568487",
... | 0.72541976 | 0 |
trying to delete message when authorized | def test_authorized_delete(self):
user = User.query.filter(User.username == "testuser").first()
message = Message(text="text",
user_id=user.id,
id=10000)
self.client.post("/login", data={"username": "testuser",
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete(self):\n for i, message in enumerate(self.owner.messages):\n if message == self.body:\n del self.owner.messages[i]\n break",
"async def delete(self):\n return await self.set_message(text='')",
"def delete_message(self, message):\r\n retur... | [
"0.7266986",
"0.71698946",
"0.7003001",
"0.69563955",
"0.69488233",
"0.69374424",
"0.6878325",
"0.68730885",
"0.686122",
"0.682144",
"0.681105",
"0.67818886",
"0.6760031",
"0.67559224",
"0.6749782",
"0.6714628",
"0.6695347",
"0.66892964",
"0.6670156",
"0.6666097",
"0.66554487... | 0.7522226 | 0 |
Generator function to chunk through a matrix along specified axis. Will yield blocks of length 'blocksize' along axis = 1,2,3 | def matrix_chunker(blocksize, matrix, axis=0, offset=0):
length=matrix.shape[axis]
index=np.arange(0+offset, length+offset, blocksize)
index=np.append(index, index[-1]+(length+offset-index[-1]))
for start, end in zip(index[:-1],index[1:]):
yield start, end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def toBlocks(im, blocksize):\n blocks = im.reshape(\n im.shape[0]//blocksize, \n blocksize, \n im.shape[1]//blocksize, \n blocksize, 3).swapaxes(1, 2)\n\n\n blocks = blocks.reshape(\n im.shape[0]*im.shape[1]//(blocksize**2), \n blocksize, \n 1,\n blocks... | [
"0.66012836",
"0.6529381",
"0.64783555",
"0.6303526",
"0.6264694",
"0.6173771",
"0.61281383",
"0.6098625",
"0.60908544",
"0.60895056",
"0.60419375",
"0.6028545",
"0.60086375",
"0.5985733",
"0.5961891",
"0.5945922",
"0.5945654",
"0.59103626",
"0.58455825",
"0.5843193",
"0.5834... | 0.8451607 | 0 |
Selects a block_x x block_y subsquare in the underlying layers lying directly below the unit in the upper layer. Selects units within radius in that block. e.g. block_x=2, block_y=2 radius=2 1 1 1 1 e.g. block_x=3, block_y=3 radius=2 1 1 1 1 1 1 1 1 1 e.g. block_x=3, block_y=3 radius=1 0 1 0 1 1 1 0 1 0 | def get_fan_in(xy=(0, 0), dim_x_l=10, dim_y_l=10, dim_x_u=9, dim_y_u=9, block_x=2, block_y=2, radius=2):
x = xy[0]
y = xy[1]
if dim_x_u > 1:
factor_x = ((dim_x_l-1)-(block_x-1))/(1.0*(dim_x_u-1))
else:
factor_x = ((dim_x_l-1)-(block_x))/2.0
if dim_y_u > 1:
factor_y = ((dim_y_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def in_block(x, y, input_suduko_3d):\n block_id = 100\n\n if x < 3 and y < 3: # First if statements defines into which block the element of given x,y values is, this are\n # from 0-8 representing the 9 boxes\n block_id = 0\n if 6 > x >= 3 > 0 <= y:\n block_id = 3\n if 6 <= x <= 8 ... | [
"0.57853335",
"0.5534077",
"0.55082244",
"0.55064106",
"0.5454181",
"0.53618264",
"0.5243425",
"0.52276367",
"0.5208876",
"0.51775503",
"0.51532876",
"0.51532644",
"0.5141889",
"0.5138911",
"0.5133598",
"0.51161593",
"0.5114931",
"0.5114931",
"0.5114019",
"0.50985324",
"0.508... | 0.6242508 | 0 |
Connect two layers with a given fanin as defined by the square_size and radius. The forward connections are accompanied by a feedback context connections back to the originating source unit. | def connect_forward_and_back(simulation_dict, (index0, blocks_per_dim0, predicted_array), (index1, blocks_per_dim1), square_size, radius, context_factor):
hidden_size = simulation_dict['hidden_size']
dx = hidden_size
dy = hidden_size
logging.info("Connecting from index %d to index %d" % (index0, index1)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connect_back(simulation_dict, (index_from, blocks_per_dim_from), (index_to, blocks_per_dim_to), square_size, radius, context_factor):\n logging.info(\"Connecting back additional context from index %d to index %d\" % (index_from, index_to))\n logging.info(\"Connecting back additional context from layer si... | [
"0.597466",
"0.57517326",
"0.50623995",
"0.49667892",
"0.49642864",
"0.49607903",
"0.49168962",
"0.4915778",
"0.4870057",
"0.48660815",
"0.48269352",
"0.4822324",
"0.48160443",
"0.47990656",
"0.46569383",
"0.46474767",
"0.4635789",
"0.46261376",
"0.46119142",
"0.45876154",
"0... | 0.5859038 | 1 |
Connect two layers with a given fan in as defined by the square_size and radius. The forward connections are accompanied by feedback context connections back to the originating source unit. | def connect_forward_and_back_v1(simulation_dict, (index0, blocks_per_dim0, predicted_array, predicted_array_t2), (index1, blocks_per_dim1), square_size, radius, context_factor):
hidden_size = simulation_dict['hidden_size']
dx = hidden_size
dy = hidden_size
logging.info("Connecting from index %d to index... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connect_forward_and_back(simulation_dict, (index0, blocks_per_dim0, predicted_array), (index1, blocks_per_dim1), square_size, radius, context_factor):\n hidden_size = simulation_dict['hidden_size']\n dx = hidden_size\n dy = hidden_size\n logging.info(\"Connecting from index %d to index %d\" % (inde... | [
"0.5964945",
"0.5862508",
"0.49246627",
"0.49153936",
"0.48418275",
"0.47906286",
"0.47593868",
"0.4756391",
"0.47359917",
"0.47261834",
"0.4666891",
"0.46099734",
"0.46059293",
"0.45885086",
"0.45856825",
"0.4538176",
"0.45291564",
"0.45182663",
"0.45091137",
"0.4504134",
"0... | 0.58673096 | 1 |
adds item to end of items, will decide to extend or append based on item iterability | def push(self, item):
if hasattr(item, "__iter__"):
self.items.extend(item)
else:
self.items.append(item) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def append(self, item):\n if self.full or self.pre_allocated:\n # overwrite\n self.data[self.cur] = item\n else:\n self.data.append(item)\n if not self.full:\n self.full = self.cur == self.max - 1\n self.cur = (self.cur + 1) % self.max",
"de... | [
"0.7585724",
"0.72042567",
"0.7136644",
"0.7093334",
"0.70766443",
"0.7074858",
"0.702008",
"0.69905263",
"0.69694656",
"0.69540036",
"0.68580884",
"0.68391997",
"0.68382025",
"0.68109816",
"0.68016183",
"0.67989516",
"0.6775975",
"0.671375",
"0.6701978",
"0.66974854",
"0.667... | 0.7232399 | 1 |
Check number of tweets with a given polarities of given tweets. Check how many tweets are positive, negative or neutral | def check_polarity(df, name="Polarity"):
polarity = df[name]
positives = polarity[polarity == 4]
neutrals = polarity[polarity == 2]
negatives = polarity[polarity == 0]
print('Positive Tweets: {}'.format(len(positives)))
print('Neutral Tweets: {}'.format(len(neutrals)))
print('Negative Tweet... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test(self, tweets, without_neutral=True):\n correct = 0\n total = 0\n for tweet in tweets:\n assert tweet.polarity is not None\n if tweet.is_neutral() and without_neutral:\n continue\n\n if tweet.polarity == self.predict_sentiment_enum(tweet,... | [
"0.69956076",
"0.6323075",
"0.6051928",
"0.6020553",
"0.60054296",
"0.5880848",
"0.58020025",
"0.5775723",
"0.5775562",
"0.57518595",
"0.57133067",
"0.56743443",
"0.56387675",
"0.5637214",
"0.56288105",
"0.5614385",
"0.5610941",
"0.55810124",
"0.5555613",
"0.5540526",
"0.5516... | 0.63810635 | 1 |
Clean a pandas dataframe containing several tweets for sentiment analysis. | def data_clean(df, name="Tweet"):
tic = timer()
twts = []
# Define a punctuation dictionary so that we can replace each punctuation with an empty space.
table = str.maketrans('', '', string.punctuation)
stopWords = set(stopwords.words('senti')) # Set stop words language to English
for n in rang... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cleaninto_df(frame:pd) -> pd:\n # remove repeated characters EXAMPLE: DIMPLLLLEEEEE -> DIMPLE\n # nopunc = word_tokenize(nopunc) this might not work. find something else\n\n stop = stopwords.words('english')\n newStopWords = ['get', 'http','there','and','i','t','it','d']\n stop.extend(newStopWor... | [
"0.72220683",
"0.6873865",
"0.66959065",
"0.66368425",
"0.65932864",
"0.6456916",
"0.6384063",
"0.6361564",
"0.6303022",
"0.62216514",
"0.6215786",
"0.6181189",
"0.60718507",
"0.60612637",
"0.60575706",
"0.60547775",
"0.6050489",
"0.5991977",
"0.5986532",
"0.59694624",
"0.596... | 0.74418724 | 0 |
Calculates the euclidean distance between the two labels and the predictions. | def distance_metric(y_true, y_pred):
diff = y_true - y_pred
sqr = K.square(diff)
total = K.sum(sqr, axis=1)
return K.sqrt(total) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def LevDistMultilabels(y_true, y_pred):\n \n n = y_pred.shape[0]\n D = 0\n for i in range(n):\n D += LevenshteinDistance(y_pred[i,:], y_true[i,:])[-1, -1]\n return D/n",
"def euclideanDistance(data1, data2):\n distance = 0\n for x in range(14):\n data1[x] = truncate(data1[x], 3... | [
"0.7383842",
"0.7026889",
"0.6977112",
"0.69555247",
"0.6952029",
"0.68401",
"0.6823526",
"0.67569906",
"0.67405534",
"0.67359006",
"0.6658021",
"0.66576433",
"0.6644144",
"0.6634221",
"0.66333306",
"0.6625327",
"0.6588581",
"0.65771985",
"0.6573899",
"0.65667194",
"0.6559554... | 0.7344262 | 1 |
Supports the following commandline arguments listed below. dir_name directory to check the junit test results url bitbucket/stash url | def getargs():
parser = argparse.ArgumentParser(description='fetch all failed unit tests')
parser.add_argument('dir_name', help='directory to check the junit results')
parser.add_argument('url', help='bitbucket/stash url')
args = parser.parse_args()
return args | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main():\r\n args = getargs()\r\n dir_name = args.dir_name\r\n url = args.url\r\n fetch_junit(dir_name, url)",
"def test_dir(command, options=\"\", dir_=\".\"):\n\n print(\n \"\"\"\nRunning pytest the test framework\n=================================\n\"\"\"\n )\n command.run(f\"py... | [
"0.77802515",
"0.6323875",
"0.6216804",
"0.6210566",
"0.61194",
"0.61187565",
"0.6011419",
"0.590582",
"0.5868668",
"0.58155215",
"0.58143663",
"0.58103776",
"0.5791339",
"0.57763976",
"0.5775211",
"0.5773462",
"0.57602936",
"0.56986207",
"0.5685014",
"0.5645336",
"0.56211627... | 0.6335797 | 1 |
Counts variants in vcf file and outputs summary dataframe. | def count_variants(vcf_list, sample_list):
df_lst = []
sample_vcf_dct = dict(zip(sample_list,vcf_list))
for s in sample_vcf_dct.keys():
vcf_in = sample_vcf_dct[s]
vcf = VariantFile(vcf_in)
snv = 0
indel = 0
for rec in vcf:
ref_len = len(rec.ref)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_summary_statistics(self):\n # Get log 10 total mutation count\n self.log_mut_count = np.log10(self.variant_df.shape[0])\n\n # Get the number of variants stratified by functional location of variant\n # E.g. Exon, Intron, 5'UTR, etc.\n self.functional_counts = pd.DataFrame... | [
"0.58822435",
"0.57890356",
"0.5787876",
"0.5740579",
"0.5731693",
"0.5716607",
"0.5684999",
"0.5680566",
"0.56145954",
"0.55977553",
"0.5555825",
"0.554939",
"0.5524379",
"0.5494294",
"0.5492469",
"0.5470732",
"0.5433212",
"0.54157346",
"0.54056317",
"0.5402928",
"0.5400513"... | 0.7263814 | 0 |
Sends email according to the provided form data. Returns HTTP 200 if the mail is sent regardless of the provider it used. Returns HTTP 500 if an error occured and logs the error. | def send():
try:
message = get_message_from_request(request)
logging.info('Sending message {}'.format(message))
except KeyError:
logging.error('Missing mandatory fields in form request.')
return 'sender, recipients, subject and body fields are mandatory.', 500
try:
cl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_email(request):\n # send emails and return some manner of success response\n send(**request.params)\n return {'success': 'mail sent!'}",
"def send():\n try:\n data = request.get_json()\n if data['authkey'] != os.environ.get('MAIL_AUTHKEY'): \n return \"Ooops. Wrong `... | [
"0.69340616",
"0.67932796",
"0.67354476",
"0.65309924",
"0.6504864",
"0.65033066",
"0.6437234",
"0.6408452",
"0.63727117",
"0.62697357",
"0.614304",
"0.6036675",
"0.59977025",
"0.5985223",
"0.5973128",
"0.59453726",
"0.59409326",
"0.59167147",
"0.59006274",
"0.58988357",
"0.5... | 0.7023996 | 0 |
Parses the attached files in the request as Attachment array | def parse_attachments(request):
attachments = []
for attachment in request.files.getlist('attachment'):
attachments.append(Attachment(attachment.filename, attachment))
return attachments | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_attachbox_attachments(self, post_html):\n if 'attachbox' not in post_html:\n return []\n self.post_html = post_html\n self.p = PyQuery(self.post_html)\n\n attachment_dicts = []\n attachment_dicts += self.parse_s_thumbnails()\n attachment_dicts += self.... | [
"0.6827068",
"0.6735421",
"0.661379",
"0.646597",
"0.64154345",
"0.63524157",
"0.631864",
"0.6259333",
"0.62079674",
"0.61960596",
"0.6189419",
"0.6186647",
"0.6141066",
"0.6133313",
"0.61162454",
"0.6106934",
"0.6051867",
"0.6045327",
"0.6036548",
"0.60318506",
"0.5932437",
... | 0.83019084 | 0 |
Initializes the main client on flask.g and registers providers to it. | def initialize_client():
logging.info('Initializing Sendgrid provider')
sendgrid_authentication, sendgrid_username = get_provider_credentials('sendgrid')
sendgrid_provider = SendGridProvider(sendgrid_authentication, sendgrid_username)
logging.info('Initializing Mailgun provider')
mailgun_authentic... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_up_client():\n #creating new flask app and a test client\n app = create_app('test')\n client = app.test_client()\n\n #creating the application context and\n #allowing test functions to run by calling test client\n #and finally cleaning house\n ctx = app.app_context()\n ctx.push()\n ... | [
"0.6897568",
"0.68206555",
"0.6573613",
"0.65611285",
"0.645763",
"0.6242648",
"0.62383497",
"0.62190175",
"0.6214114",
"0.61999184",
"0.6143029",
"0.6102105",
"0.60550094",
"0.5952441",
"0.594646",
"0.59292895",
"0.5918728",
"0.5914333",
"0.5908699",
"0.5902818",
"0.59021896... | 0.7383164 | 0 |
Provider credentials should be injected in the deployed instance as enviroment variables. It gets them as PROVIDER_USERNAME and PROVIDER_AUTHENTICATION PROVIDER_USERNAME is optional in case the provider uses API key. For example, for Sendgrid it would be SENDGRID_USERNAME and SENDGRID_AUTHENTICATION. | def get_provider_credentials(provider):
logging.info('Getting provider credentials for {}'.format(provider))
uppercase_provider = provider.upper()
username_variable = '{}_USERNAME'.format(uppercase_provider)
authentication_variable = '{}_AUTHENTICATION'.format(uppercase_provider)
username = os.envir... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def aws_credentials():\n os.environ['AWS_ACCESS_KEY_ID'] = 'testing'\n os.environ['AWS_SECRET_ACCESS_KEY'] = 'testing'\n os.environ['AWS_SECURITY_TOKEN'] = 'testing'\n os.environ['REGION'] = 'region'",
"def get_credentials(env=\"development\") -> dict:\n load_dotenv()\n credentials = {}\n\n ... | [
"0.6156303",
"0.61343807",
"0.6078328",
"0.60325223",
"0.60214007",
"0.6018666",
"0.6018666",
"0.6018666",
"0.59797263",
"0.59468067",
"0.5937931",
"0.5937931",
"0.58606076",
"0.58562934",
"0.5853367",
"0.5835138",
"0.5820004",
"0.58101356",
"0.5797626",
"0.57737917",
"0.5765... | 0.7291802 | 0 |
Building event by hand, but with eliminating the meta fields | def build_event(
self,
type: EventType,
fqid: FullQualifiedId,
fields: Optional[Dict[str, Any]] = None,
list_fields: Optional[ListFields] = None,
) -> Event:
if type == EventType.Update and fields:
fields = {
k: v
for k, v i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def buildEvent(data):",
"def __init__(self, event_list):\n event_list = [AttribDict(event) for event in event_list]\n for event in event_list:\n event.datetime = UTC(event.datetime)\n if feregion is not None:\n event.flynn_region = feregion(event.latitude, event... | [
"0.7753694",
"0.6666498",
"0.64480186",
"0.6430229",
"0.64239025",
"0.63877994",
"0.63057095",
"0.63010573",
"0.62411094",
"0.6236453",
"0.61496586",
"0.6063579",
"0.6033859",
"0.6013378",
"0.60089743",
"0.598756",
"0.59403574",
"0.5883825",
"0.5802795",
"0.5795733",
"0.57948... | 0.7140484 | 1 |
Retrieves the name of the component | def get_name(self):
return COMPONENT_LIST[self.index][0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_component_name(self):\n return self._name",
"def getComponentName(self):\n if self.componentName:\n return self.componentName\n else:\n raise Warning(\"No component name has been currently defined\")",
"def name(self):\r\n return self.component.get(\"Na... | [
"0.8993381",
"0.8578204",
"0.832196",
"0.832196",
"0.7564453",
"0.752911",
"0.7503306",
"0.74896145",
"0.7467424",
"0.7465566",
"0.74547154",
"0.74547154",
"0.74547154",
"0.74547154",
"0.7447792",
"0.7447792",
"0.7447792",
"0.7416273",
"0.74120075",
"0.7411486",
"0.73846656",... | 0.8755263 | 1 |
Retrieves the description of the component | def get_description(self):
return COMPONENT_LIST[self.index][1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_description(self):\r\n return self.__description",
"def _get_description(self):\n return self.__description",
"def _get_description(self):\n return self.__description",
"def get_description():\n raise NotImplementedError",
"def get_description(self):\n pass",
"d... | [
"0.8060678",
"0.80528724",
"0.80528724",
"0.8034792",
"0.801626",
"0.79952645",
"0.79841787",
"0.79818565",
"0.7962023",
"0.79614246",
"0.7942446",
"0.7942446",
"0.7942446",
"0.7942446",
"0.7909087",
"0.7892895",
"0.7890679",
"0.78325516",
"0.7744791",
"0.77443457",
"0.772008... | 0.859268 | 0 |
Install firmware to module | def install_firmware(self, image_path):
"""Not Implement"""
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def install_firmware(self, firmware_file_path: str) -> None:\n raise NotImplementedError()",
"def install_firmware(self, pbz_path, recovery=False):\n\n\t\tresources = None\n\t\twith zipfile.ZipFile(pbz_path) as pbz:\n\t\t\tbinary = pbz.read(\"tintin_fw.bin\")\n\t\t\tif not recovery:\n\t\t\t\tresources... | [
"0.7427774",
"0.6969059",
"0.69159126",
"0.6860279",
"0.6850534",
"0.6627969",
"0.65738577",
"0.6535344",
"0.64783776",
"0.64002633",
"0.6383176",
"0.63472944",
"0.63452154",
"0.6341543",
"0.6337719",
"0.6332141",
"0.62691337",
"0.6253833",
"0.62381494",
"0.61869246",
"0.6147... | 0.7309129 | 1 |
Convert a numpy array to a TF placeholder. | def _build_tensor(self, ndarray):
ndarray = np.asarray(ndarray).astype(self.dtype)
return tf1.placeholder_with_default(
ndarray, shape=ndarray.shape if self.use_static_shape else None) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _from_numpy(array):\n return tf.constant(array)",
"def transpose_to_tensorflow(array: np.ndarray) -> np.ndarray:\n shape = (\n DIM_PT['batch'],\n DIM_PT['depth'],\n DIM_PT['height'],\n DIM_PT['width'],\n DIM_PT['channels'],\n )\n array = np.transpose(array, ... | [
"0.79168755",
"0.6447744",
"0.59538347",
"0.59502006",
"0.5948754",
"0.5824443",
"0.5824443",
"0.57951134",
"0.5754777",
"0.5732912",
"0.57207906",
"0.57052535",
"0.5687597",
"0.5686336",
"0.55867285",
"0.5567659",
"0.55511665",
"0.55475926",
"0.55343866",
"0.5527259",
"0.549... | 0.6905999 | 1 |
The mod_radial_average class constructor stores the parameters passed from the pyana configuration file in instance variables. All parameters, except address are optional, and hence need not be defined in pyana.cfg. address Address string XXX Que?! out_dirname Optional directory portion of output average pathname out_b... | def __init__(self,
address,
out_dirname = None,
out_basename = None,
xtal_target = None,
two_theta_low = None,
two_theta_high = None,
**kwds):
super(mod_radial_average, self).__init__(address=address, **kwds)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, mean, config):\n self.lb = config.get('lb', 0)\n self.ub = config.get('ub', sys.maxint)\n self.a = float(config['a'])",
"def radial(*args, attenuation: Union[float, bool]=0.0, magnitude: Union[float, bool]=0.0,\n maxDistance: Union[float, bool]=0.0, name: Union[A... | [
"0.58823407",
"0.5639091",
"0.563347",
"0.55161",
"0.53948456",
"0.53743595",
"0.5315376",
"0.53023726",
"0.5255032",
"0.5187186",
"0.5184907",
"0.5184907",
"0.5175284",
"0.51109797",
"0.50662816",
"0.504376",
"0.5026226",
"0.4991186",
"0.49473262",
"0.49444625",
"0.49436808"... | 0.85535985 | 0 |
The beginjob() function does onetime initialisation from event or environment data. It is called at an XTC configure transition. evt Event data object, a configure object env Environment object | def beginjob(self, evt, env):
super(mod_radial_average, self).beginjob(evt, env) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def begin(self):\n\n env = self.context.lookup(\"/environment\")\n\n self._test_results_dir = env[\"output_directory\"]\n self._starttime = env[\"starttime\"]\n self._runid = env[\"runid\"]\n\n self._result_filename = os.path.join(self._test_results_dir, \"testrun_results.jsos\")... | [
"0.57861096",
"0.56085485",
"0.5528966",
"0.54996747",
"0.5454728",
"0.54298323",
"0.54231644",
"0.54102683",
"0.53629297",
"0.53195006",
"0.53149587",
"0.5282009",
"0.5270217",
"0.5252762",
"0.5218137",
"0.52084434",
"0.51983976",
"0.5182246",
"0.5144393",
"0.5140691",
"0.51... | 0.5729683 | 1 |
The endjob() function logs the number of processed shots. evt Event object (psana only) env Environment object | def endjob(self, obj1, obj2=None):
if obj2 is None:
env = obj1
else:
evt = obj1
env = obj2
super(mod_radial_average, self).endjob(env)
if (env.subprocess() >= 0):
self.logger.info("Subprocess %02d: processed %d shots" %
(env.subprocess(), self.nshots))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def endjob(self, obj1, obj2=None):\n\n if obj2 is None:\n env = obj1\n else:\n evt = obj1\n env = obj2\n\n #self.logger.info(\"Saw %d shots, two_color %d, nodata %d \" % (self.nshots, self.naccepted, self.nnodata))",
"def on_eval_batch_end(self, step, logs=None):",
"def end():\n logg... | [
"0.6863275",
"0.55696213",
"0.5516178",
"0.54396594",
"0.5429018",
"0.5396587",
"0.5374466",
"0.529632",
"0.5290271",
"0.52774626",
"0.52727425",
"0.52209705",
"0.5210125",
"0.51715285",
"0.5167377",
"0.5102996",
"0.50926626",
"0.5086865",
"0.5086229",
"0.5083143",
"0.5081860... | 0.70764345 | 0 |
Test inputs are deduplicated for the encoding function. | def test_cache_duplicate_inputs(self):
random_encoding = mock.Mock(side_effect=_random_encoding)
cached_random_encoding = encoder_client.cache_encodings(
random_encoding, cache_size=100)
encodings = cached_random_encoding(["hello"] * 10)
self.assertEqual([10, 7], list(encodin... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testDuplicate(self,permutations=True):\n # This algorithm is faster than encode,\n # but for nplex=2 enmagic2 would probably still be faster.\n if permutations:\n C = self.copy()\n C.sort(axis=1)\n else:\n C = self\n ind = sortByColumns(C)\n ... | [
"0.6525442",
"0.62831426",
"0.62768084",
"0.6242956",
"0.61193717",
"0.6068965",
"0.6045352",
"0.6022538",
"0.5994702",
"0.5966574",
"0.59489924",
"0.59229994",
"0.58942944",
"0.5864432",
"0.57975835",
"0.5708045",
"0.56232053",
"0.55745244",
"0.55653274",
"0.55564296",
"0.55... | 0.6329421 | 1 |
Test the least recently used input is forgotten. | def test_least_recently_used_forgotten(self):
cached_random_encoding = encoder_client.cache_encodings(
_random_encoding, cache_size=10)
encoding = cached_random_encoding(["to be forgotten"])
cached_random_encoding(list(range(10)))
encoding_1 = cached_random_encoding(["to be f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_too_frequent_password_resets(self):\r\n student = self._user_factory_with_history()\r\n grandfathered_student = self._user_factory_with_history(set_initial_history=False)\r\n\r\n self.assertTrue(PasswordHistory.is_password_reset_too_soon(student))\r\n self.assertFalse(PasswordH... | [
"0.617269",
"0.5939254",
"0.5901139",
"0.5857087",
"0.5765842",
"0.5716414",
"0.5697374",
"0.568397",
"0.56715894",
"0.5663747",
"0.5653324",
"0.5643554",
"0.562245",
"0.5551021",
"0.5533676",
"0.5533053",
"0.55282557",
"0.5516118",
"0.5479338",
"0.54770094",
"0.54523236",
... | 0.65517306 | 0 |
Test that inputs with nested lists are cached correctly. | def test_nested_lists(self):
cached_random_encoding = encoder_client.cache_encodings(
_random_encoding, cache_size=100)
example_1 = ["hello", ["context 1", "context 2"]]
example_2 = ["hi", ["context 1", "context 2", "context 3"]]
encodings_1 = cached_random_encoding([example_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_shallow_deep_object(self):\n # cache params\n cache_key = 'test_shallow_deep_object'\n cache_len = 60\n num_items = 3\n num_sub_items = 20000\n\n # prepare cache data and save\n cache_data = {}\n for n in range(num_items):\n cache_data[n] ... | [
"0.6522186",
"0.64140004",
"0.6132525",
"0.61043525",
"0.601811",
"0.59138286",
"0.58714175",
"0.5837765",
"0.5805114",
"0.57767415",
"0.5767161",
"0.5762907",
"0.5743672",
"0.57405716",
"0.569464",
"0.5663124",
"0.56611806",
"0.56382847",
"0.5629299",
"0.5627038",
"0.5612794... | 0.6845108 | 0 |
Get value of DateEditField | def getValue(self):
return qDate2Date(self.field.date()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_date(self):\n return self.cleaned_data['date']",
"def date(self):\n return self.date_value",
"def getValue(self):\n return self.field.text()",
"def getValue(self):\n return self.field.currentText()",
"def getValue(self):\n return self.field.value()",
"def getVal... | [
"0.7726011",
"0.68309325",
"0.65818435",
"0.63797146",
"0.63699603",
"0.63699603",
"0.6341612",
"0.6341612",
"0.6341612",
"0.6341612",
"0.6116081",
"0.6042181",
"0.5984255",
"0.5964071",
"0.59639466",
"0.59452707",
"0.59399724",
"0.5923637",
"0.5918697",
"0.5900223",
"0.58684... | 0.7341388 | 1 |
Function for reading a response file | def readResponseFile(self):
resp_filename = QFileDialog.getOpenFileName(self, "Open Response File", str(Path.home()), '')
try:
resp_file = open(resp_filename[0], 'r')
except:
print("Couldn't get any files from QFileDialog")
return
try:
re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_response():\n result = ''\n line = ''\n while line != '\\n':\n result += line\n line = FROMFILE.readline()\n #print(\" I read line:[\"+line+\"]\")\n return result",
"def recv_read_response(self, recv_payload): \n\t#Only unpack the headers because we want to store th... | [
"0.6882571",
"0.67764246",
"0.6689666",
"0.663254",
"0.66002065",
"0.65235007",
"0.6518528",
"0.6441972",
"0.6441972",
"0.63936675",
"0.63545483",
"0.6312358",
"0.6307773",
"0.6301515",
"0.62988454",
"0.623506",
"0.6195498",
"0.6167778",
"0.60561365",
"0.60506356",
"0.6033456... | 0.78609484 | 0 |
Clear string field value | def clearField(self):
self.field.setText("") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear(self):\r\n self.room_value.set('')",
"def clearField(self):\n self.field.setValue(self.default_val)",
"def clearField(self):\n self.field.setValue(self.default_val)",
"def clear(self):\r\n self.firstname_value.set('')\r\n self.lastname_value.set('')\r\n sel... | [
"0.749064",
"0.7427105",
"0.7427105",
"0.7367588",
"0.7103921",
"0.7024007",
"0.697663",
"0.6923305",
"0.6922619",
"0.68387425",
"0.68102473",
"0.6765182",
"0.6753275",
"0.6720608",
"0.66926175",
"0.6682789",
"0.6559357",
"0.6558444",
"0.65180975",
"0.64615583",
"0.6446874",
... | 0.78305686 | 0 |
Get the value of StringEditField | def getValue(self):
return self.field.text() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getValue(self):\n return self.field.currentText()",
"def value(self):\n return str(self.input.text())",
"def value(self):\n s = str(self.input.text())\n if self._is_string_:\n return s\n else:\n return eval(s)",
"def value(self):\n s = str(s... | [
"0.7251396",
"0.711177",
"0.6903616",
"0.6872598",
"0.67954826",
"0.6794966",
"0.6647003",
"0.6647003",
"0.6558761",
"0.6513615",
"0.6455087",
"0.64429784",
"0.64178675",
"0.6397171",
"0.6364782",
"0.6331894",
"0.6302638",
"0.6302638",
"0.6302638",
"0.6302638",
"0.6302638",
... | 0.7493002 | 0 |
Get all values from the checkboxes | def getValues(self):
result = []
for cbox in self.checkboxes:
if cbox.isChecked():
result.append(cbox.text())
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getCheck(self) -> list:\n results = []\n for i in self.checkboxs:\n if i.isChecked():\n results.append(i)\n return results",
"def selectedValues(self):\n list_selected = []\n minLevel = float(self.minLevelLineEdit.text() or 0)\n maxLevel = f... | [
"0.754504",
"0.6864356",
"0.6775087",
"0.66403234",
"0.6456823",
"0.63692284",
"0.62996274",
"0.61769706",
"0.61111045",
"0.6079384",
"0.60151803",
"0.59716076",
"0.58443946",
"0.5843741",
"0.5835723",
"0.5835723",
"0.58272696",
"0.579749",
"0.5724495",
"0.57017225",
"0.56901... | 0.8536971 | 0 |
Perform `n_iter` iterations Gibbs sampling on the CRPMM. A record dict is constructed over the iterations, which contains several fields describing the sampling process. Each field is described by its key and statistics are given in a list which covers the Gibbs sampling iterations. This dict is returned. Also a distri... | def collapsed_gibbs_sampler(self, n_iter, true_assignments, num_saved=3, weight_first=True):
# Setup record dictionary
record_dict = self.setup_record_dict()
start_time = time.time()
distribution_dict = self.setup_distribution_dict(num_saved)
# Loop over iterations
for ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gibbs_sample(self):\n # Initialize the initial state of Markov Chain.\n self.initialize()\n # Gibbs Sampling.\n for iteration_index in range(0, self.iteration_number, 1):\n for m in range(0,self.document_number,1):\n for n in range(0, len(self.documents[m])... | [
"0.6322436",
"0.6285666",
"0.60211504",
"0.5784153",
"0.57558376",
"0.5718077",
"0.5679642",
"0.5619398",
"0.5619151",
"0.5593346",
"0.5539781",
"0.5460076",
"0.5412505",
"0.5410561",
"0.5342371",
"0.5312312",
"0.52381414",
"0.5194906",
"0.51755226",
"0.5162795",
"0.5161995",... | 0.6786249 | 0 |
For each label, extract the features from its segment and returns the list with the features from all of them. | def features_from_labels(audio_file, segments):
segments_features = []
#for each segment
for segment in segments:
features = features_from_label(audio_file, segment)
#and append it to the list
segments_features.append(features)
return segments_features | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def features_from_label(audio_file, segment):\n duration = segment['end'] - segment['start']\n audio, sample_rate = librosa.core.load(\n audio_file,\n duration=duration,\n offset=segment['start']\n )\n features = fe.get_features(audio, sample_rate)\n return features",
"def fea... | [
"0.69634634",
"0.656113",
"0.64468277",
"0.63244975",
"0.63244975",
"0.63244975",
"0.6308826",
"0.6191861",
"0.6083943",
"0.60839206",
"0.6039162",
"0.60375446",
"0.5988831",
"0.59702706",
"0.5932434",
"0.59319234",
"0.5916766",
"0.5876143",
"0.58422124",
"0.5826482",
"0.5819... | 0.81941056 | 0 |
Using the label, extract the features from the segment defined by the label. | def features_from_label(audio_file, segment):
duration = segment['end'] - segment['start']
audio, sample_rate = librosa.core.load(
audio_file,
duration=duration,
offset=segment['start']
)
features = fe.get_features(audio, sample_rate)
return features | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def features_from_labels(audio_file, segments):\n segments_features = []\n #for each segment\n for segment in segments:\n features = features_from_label(audio_file, segment)\n #and append it to the list\n segments_features.append(features)\n return segments_features",
"def get_fe... | [
"0.73163855",
"0.5836902",
"0.5791848",
"0.5791834",
"0.56940895",
"0.56239414",
"0.56133085",
"0.56110984",
"0.5592654",
"0.5533984",
"0.5508768",
"0.5500992",
"0.5496361",
"0.5473228",
"0.5451627",
"0.54497445",
"0.54106414",
"0.5410236",
"0.54029137",
"0.5383069",
"0.53493... | 0.7549193 | 0 |
This function reads all the label files from the label_folder, extract the features from the audio with matching name in audio_folder and saves all the features into the output_folder. | def features_from_folder(label_folder, audio_folder, output_folder):
print('Listing label files from folder.')
#scan labels folder
labels_list = os.listdir(label_folder)
label_files = []
for filename in labels_list:
#get its extension
file_extension = filename.split('.')[-1]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def label_training_data(input_path, output_path):\r\n import shutil\r\n image_files = [file for file in os.listdir(path=input_path) if '.JPG' in file or '.jpeg' in file]\r\n \r\n for file in image_files:\r\n file_input_path = os.path.join(input_path,file)\r\n \r\n img = cv2.imread(... | [
"0.6931007",
"0.68347615",
"0.6515901",
"0.6497116",
"0.64797205",
"0.636615",
"0.6359229",
"0.63424253",
"0.6320269",
"0.6292423",
"0.627479",
"0.62713116",
"0.62389636",
"0.6136188",
"0.6114869",
"0.6111111",
"0.61073345",
"0.6093371",
"0.6091186",
"0.60888165",
"0.60680854... | 0.8482654 | 0 |
Iterator to consume the messages available on this consumer | def __iter__(self):
# Trigger the consumer procs to start off.
# We will iterate till there are no more messages available
self.size.value = 0
self.events.pause.set()
while True:
self.events.start.set()
try:
# We will block for a small whi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __iter__(self):\n # Trigger the consumer procs to start off.\n # We will iterate till there are no more messages available\n self.size.value = 0\n self.pause.set()\n\n while True:\n self.start.set()\n try:\n # We will block for a small whi... | [
"0.7876559",
"0.7503774",
"0.73663545",
"0.7265061",
"0.70114726",
"0.69939095",
"0.6885746",
"0.68245155",
"0.6739083",
"0.66143394",
"0.6587319",
"0.65804994",
"0.655792",
"0.6548321",
"0.6544168",
"0.6527674",
"0.6492114",
"0.6468669",
"0.6443228",
"0.6439748",
"0.63970184... | 0.7853538 | 1 |
Inspect the supplied auth token to determine the user's IPAM server | def _user_ipam_server(token):
logger.info('Looking up IPAM server')
try:
header, payload, signature = token.split(b'.')
except (ValueError, AttributeError, TypeError) as doh:
# Mangled or missing JSON Web Token
logger.exception(doh)
user = None
else:
padding_neede... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_ilo_access(remote_console):\n url = remote_console.get('remoteConsoleUrl')\n url_parse = parse.urlparse(url)\n host_ip = parse.parse_qs(url_parse.netloc).get('addr')[0]\n token = parse.parse_qs(url_parse.netloc).get('sessionkey')[0]\n return host_ip, token",
"def get_token_info_remote(sel... | [
"0.61946833",
"0.6118207",
"0.60206807",
"0.5868862",
"0.5855231",
"0.58198047",
"0.5806784",
"0.57857645",
"0.5719891",
"0.56942225",
"0.5674779",
"0.565937",
"0.5640423",
"0.56349134",
"0.5603921",
"0.55928963",
"0.55651516",
"0.55602133",
"0.55421984",
"0.55298877",
"0.552... | 0.76831394 | 0 |
Set a high water mark on the zmq socket. Do so in a way that is crosscompatible with zeromq2 and zeromq3. | def set_high_water_mark(socket, config):
if config['high_water_mark']:
if hasattr(zmq, 'HWM'):
# zeromq2
socket.setsockopt(zmq.HWM, config['high_water_mark'])
else:
# zeromq3
socket.setsockopt(zmq.SNDHWM, config['high_water_mark'])
socket.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, ip='127.0.0.1', port='50020'):\n self.ip = ip \n self.port = port\n self.ctx = zmq.Context()\n self.socket = zmq.Socket(self.ctx, zmq.REQ) # this is pub socket",
"def start(self):\n zmq_uri = (\n \"{protocol}://{address}:{port}\".format(\n ... | [
"0.51234335",
"0.5065628",
"0.50134385",
"0.49544883",
"0.49474162",
"0.49436027",
"0.4931907",
"0.488579",
"0.488579",
"0.48692766",
"0.48552787",
"0.48457694",
"0.48174453",
"0.48031065",
"0.47897077",
"0.47836304",
"0.4770771",
"0.4770241",
"0.4731286",
"0.4699968",
"0.469... | 0.80861634 | 0 |
Set a series of TCP keepalive options on the socket if and only if 1) they are specified explicitly in the config and 2) the version of pyzmq has been compiled with support We ran into a problem in FedoraInfrastructure where longstanding connections between some hosts would suddenly drop off the map silently. Because P... | def set_tcp_keepalive(socket, config):
keepalive_options = {
# Map fedmsg config keys to zeromq socket constants
'zmq_tcp_keepalive': 'TCP_KEEPALIVE',
'zmq_tcp_keepalive_cnt': 'TCP_KEEPALIVE_CNT',
'zmq_tcp_keepalive_idle': 'TCP_KEEPALIVE_IDLE',
'zmq_tcp_keepalive_intvl': 'TC... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_tcp_keepalive(sock, opts):\n if hasattr(socket, \"SO_KEEPALIVE\"):\n if opts.get(\"tcp_keepalive\", False):\n sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)\n if hasattr(socket, \"SOL_TCP\"):\n if hasattr(socket, \"TCP_KEEPIDLE\"):\n ... | [
"0.75030094",
"0.6916339",
"0.66866887",
"0.55712473",
"0.5282807",
"0.5062797",
"0.5035763",
"0.50337327",
"0.5011154",
"0.5004305",
"0.49721786",
"0.49601498",
"0.49445322",
"0.49265453",
"0.4898219",
"0.48714292",
"0.48604316",
"0.48500705",
"0.48452032",
"0.48276287",
"0.... | 0.8027103 | 0 |
Override to use ACLESAggregator. | def _setup_aggregation(self, aggregator=None, **kwargs):
return super(ACLFilterViewMixin, self)._setup_aggregation(
aggregator=ACLESAggregator, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, aggregator: af.Aggregator):\r\n self.aggregator = aggregator",
"def _aggregation_target(self):\n ...",
"def aggregator():\n return Aggregator(\n agg_col=\"col_a\", values_col=\"col_b\", aggregates=[\"min\", \"max\", \"avg\", \"sum\"]\n )",
"def ADP (self):",
"d... | [
"0.58657575",
"0.53307277",
"0.5028247",
"0.50152344",
"0.49879622",
"0.4987954",
"0.49778157",
"0.49720332",
"0.49186838",
"0.49104032",
"0.49044472",
"0.49029803",
"0.48971638",
"0.48956355",
"0.4886094",
"0.4840375",
"0.48350465",
"0.4830124",
"0.48059037",
"0.47872633",
"... | 0.60906595 | 0 |
Preprocess a dataset before training NER. Assuming That a clean dataset of Entities should not contain verbs, adverbs, adjectives and random symbols | def dataset_NER_prepocess(dataset):
preprocessed = []
try:
preprocessed = stop_word_remove(dataset)
if not preprocessed:
preprocessed = dataset
preprocessed = adverb_remove(dataset)
if not preprocessed:
preprocessed = dataset
preprocessed = ve... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _preprocess(self):\n self.data['sentences'] = self.data['text'].apply(self._tokenize_sent)\n self.data['nouns'] = self.data['sentences'].apply(self._get_nouns)\n # self._get_frequent_features()\n # self._compactness_pruning()\n # self._redundancy_pruning()\n # self._ge... | [
"0.7355754",
"0.6839999",
"0.6822704",
"0.6733091",
"0.6711649",
"0.6583312",
"0.6569212",
"0.6514732",
"0.6510468",
"0.64858013",
"0.64236563",
"0.6358511",
"0.63251275",
"0.63248324",
"0.6324185",
"0.63179976",
"0.631258",
"0.62988704",
"0.62934196",
"0.62665325",
"0.626122... | 0.6929304 | 1 |
get needed data about the group of contacts specified with groupName | def getGroupData(service, groupName, attList):
# import IPython ; IPython.embed() ; exit();
groupsDataList = service.contactGroups().list().execute()["contactGroups"]
for group in groupsDataList:
if group["name"] == groupName:
groupData = []
for att in attList:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getContactsData(service, groupResourceName, maxMembers):\n # get the ids of the contacts inside the specified group\n contactsIDs = service.contactGroups().get(\n resourceName=groupResourceName, \n maxMembers=maxMembers).execute()[\"memberResourceNames\"]\n\n # get data of the contacts t... | [
"0.6783003",
"0.66426826",
"0.66284263",
"0.6583931",
"0.6508952",
"0.64133483",
"0.6247849",
"0.6223199",
"0.61684126",
"0.6117678",
"0.6113146",
"0.6007093",
"0.6001018",
"0.59909797",
"0.59482914",
"0.58569443",
"0.58345133",
"0.5827508",
"0.5820286",
"0.5813939",
"0.58055... | 0.745583 | 0 |
get names and mails of the contacts inside the specified group | def getContactsData(service, groupResourceName, maxMembers):
# get the ids of the contacts inside the specified group
contactsIDs = service.contactGroups().get(
resourceName=groupResourceName,
maxMembers=maxMembers).execute()["memberResourceNames"]
# get data of the contacts that correspon... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getPeopleInAddressBook(group_name=None):\n ab = ABAddressBook.sharedAddressBook()\n people = None\n if not group_name:\n people = ab.people()\n else:\n for group in ab.groups():\n if group.name() == group_name:\n people = group.members()\n if people == Non... | [
"0.72366965",
"0.72157335",
"0.68207794",
"0.66384506",
"0.6626178",
"0.6562149",
"0.65262914",
"0.64727664",
"0.6297635",
"0.628419",
"0.6233957",
"0.6177852",
"0.61701566",
"0.6106635",
"0.6102098",
"0.6078653",
"0.60124636",
"0.5987554",
"0.59866476",
"0.5976168",
"0.59199... | 0.7256055 | 0 |
This function is used to create a binary raster mask from polygons in a given geojson file, so as to label the pixels in the image as either background or target. | def training_mask_generation(img_pan_filename, input_geojson_filename, labels):
with rasterio.open(img_pan_filename) as f:
metadata_pan = f.profile
img_pan = f.read(1)
mask = np.zeros((img_pan.shape[0], img_pan.shape[1]))
xres = metadata_pan['transform'][0]
ulx = metada... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def geojsons_to_masks_and_fill_nodata(rtiler, vtiler, label_tile_dir, fill_value=0):\n rasterized_label_paths = []\n print(\"starting label mask generation\")\n if not os.path.exists(label_tile_dir):\n os.mkdir(label_tile_dir)\n for img_tile, geojson_tile in tqdm(zip(sorted(rtiler.tile_paths), s... | [
"0.6391694",
"0.6338343",
"0.6338343",
"0.62419814",
"0.6236292",
"0.616786",
"0.61537826",
"0.61002177",
"0.603093",
"0.6000926",
"0.60001945",
"0.5966524",
"0.5924841",
"0.5906967",
"0.5888724",
"0.58342755",
"0.5831503",
"0.58054227",
"0.57415473",
"0.5734043",
"0.5734043"... | 0.7429962 | 0 |
This function is used to convert image files and their respective polygon training masks into numpy arrays, so as to facilitate their use for model training. | def training_data_generation(DATA_DIR, img_height_size, img_width_size, label_list):
img_ms_files = glob.glob(DATA_DIR + '\\Train_MS' + '\\Train_*.tif')
img_pan_files = glob.glob(DATA_DIR + '\\Train_Pan' + '\\Train_*.tif')
polygon_files = glob.glob(DATA_DIR + '\\Train_Polygons' + '\\Train_*.geoj... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_images_from_folder(folder, n_cases,patch_size, mask_path, mask_type, mask_name,normalize=False, imrotate=False):\n\n# # Initialize the arrays:\n# if imrotate: # number of images is 4 * n_im\n# bigy = np.empty((n_im * 4, 64, 64))\n# bigx = np.empty((n_im * 4, 64, 64, 2))\n# else:\n#... | [
"0.67383176",
"0.6712333",
"0.66240686",
"0.6617843",
"0.6607581",
"0.652733",
"0.64513606",
"0.6360706",
"0.6346707",
"0.63367313",
"0.63006884",
"0.627508",
"0.62277615",
"0.6199671",
"0.61431366",
"0.6130395",
"0.61136776",
"0.6061919",
"0.60611165",
"0.60610926",
"0.60564... | 0.7334974 | 0 |
This function generates the Two Branch Land Cover Classification Convolutional Neural Network (TBLCCCNN) that is proposed in the paper 'A Two Branch CNN Architecture for Land Cover Classification of PAN and MS Imagery' by Gaetano R., Ienco D., Ose K., Cresson R. (2018) | def TBLCCCNN_Model(pan_image_height_size, pan_image_width_size, ms_to_pan_ratio, n_bands, n1_pan, n2_pan, n3_pan,
n1_ms, n2_ms, n3_ms, dropout_rate, n_classes, l_r):
if (pan_image_height_size % ms_to_pan_ratio) != 0 or (pan_image_width_size % ms_to_pan_ratio) != 0:
raise ValueEr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cifar10_cnn():\n # Set defaults.\n nb_classes = 10 #dataset dependent \n batch_size = 128\n epochs = 4\n \n # the data, shuffled and split between train and test sets\n (x_train, y_train), (x_test, y_test) = cifar10.load_data()\n \n # convert class vectors to binary class mat... | [
"0.6311451",
"0.61126846",
"0.60787344",
"0.60380226",
"0.5890978",
"0.5878846",
"0.58740735",
"0.5861365",
"0.58431727",
"0.5805545",
"0.5722827",
"0.5722399",
"0.56968087",
"0.5693346",
"0.56774884",
"0.5656095",
"0.5633978",
"0.5627525",
"0.56193244",
"0.5611147",
"0.55875... | 0.7077625 | 0 |
Whether the interval overlaps the given point, range or Interval. | def overlaps(self, begin, end=None):
if end is not None:
# An overlap means that some C exists that is inside both ranges:
# begin <= C < end
# and
# self.begin <= C < self.end
# See https://stackoverflow.com/questions/3269434/whats-the-most-effic... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ranges_overlap(start1, end1, start2, end2):\n return start1 <= end2 and end1 >= start2",
"def overlaps(x1, x2, y1, y2):\n\n return x1 <= y2 and y1 <= x2",
"def contains_interval(self, other):\n return (\n self.begin <= other.begin and\n self.end >= other.end\n )",
... | [
"0.7450774",
"0.72448725",
"0.72238123",
"0.7217159",
"0.721403",
"0.72099704",
"0.71903545",
"0.7162582",
"0.71042466",
"0.704064",
"0.7011865",
"0.6966663",
"0.69630086",
"0.6934209",
"0.69117546",
"0.6827023",
"0.68079567",
"0.6803514",
"0.67905587",
"0.67840844",
"0.67825... | 0.7603803 | 0 |
Return the overlap size between two intervals or a point | def overlap_size(self, begin, end=None):
overlaps = self.overlaps(begin, end)
if not overlaps:
return 0
if end is not None:
# case end is given
i0 = max(self.begin, begin)
i1 = min(self.end, end)
return i1 - i0
# assume the typ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def overlap_len(range1, range2):\n return min(range1[1], range2[1]) - max(range1[0], range2[0])",
"def find_overlap_range(x1, lenght1, x2, length2):\n\n\n highest_start_point = max(x1, x2)\n lowest_end_point = min(x1 + lenght1, x2 + length2)\n \n if highest_start_point >= lowest_end_point:\n ... | [
"0.73398906",
"0.71709347",
"0.71136653",
"0.7091278",
"0.69940406",
"0.6926135",
"0.68776464",
"0.66812265",
"0.65890884",
"0.650149",
"0.64867634",
"0.6443508",
"0.6277583",
"0.62052244",
"0.6189153",
"0.61834484",
"0.6166948",
"0.6160046",
"0.6154346",
"0.61486506",
"0.613... | 0.7516056 | 0 |
Whether the Interval contains p. | def contains_point(self, p):
return self.begin <= p < self.end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contains(self, p):\n return self.distance(p=p) < self.tolerance",
"def contains(self, p):\n p = base.getvector(p)\n if len(p) == 2:\n p = np.r_[p, 1]\n return base.iszero(self.line * p)",
"def containsPoint(self, p):\n return self.frameGeometry().contains(p)",
... | [
"0.7817759",
"0.7427082",
"0.7307771",
"0.71583736",
"0.70834273",
"0.70834273",
"0.7017026",
"0.6873289",
"0.68610114",
"0.68444407",
"0.6707772",
"0.6675187",
"0.66390264",
"0.65507036",
"0.651224",
"0.6506173",
"0.64738977",
"0.64628136",
"0.642916",
"0.6428434",
"0.64103"... | 0.8188833 | 0 |
Whether this equals the null interval. | def is_null(self):
return self.begin >= self.end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_null(self):\n return self.value is None",
"def is_null(self):\n return self.length2 < pygonal.EPSILON2",
"def is_null(self) -> bool:\n return self.allele1 == -1 and self.allele2 == -1",
"def is_null(self) -> bool:\n for y in range(0, self.num_of_rows):\n for x in... | [
"0.7243578",
"0.70753247",
"0.7025592",
"0.7005975",
"0.69593084",
"0.673967",
"0.67244315",
"0.67244315",
"0.67244315",
"0.67244315",
"0.67244315",
"0.671538",
"0.6705342",
"0.6700119",
"0.6637087",
"0.66299367",
"0.66105014",
"0.657015",
"0.65618104",
"0.6559858",
"0.642357... | 0.774378 | 0 |
Less than operator. Parrots __cmp__() | def __lt__(self, other):
return self.__cmp__(other) < 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __lt__(self, other):\n return self.lessThan(other)",
"def __lt__(self, other):\n return less(self, other)",
"def __lt__(self, other):\n return self.__le__(other) and self.__ne__(other)",
"def __lt__(self, other):\n return other > self._cmpkey()",
"def __lt__(self, other):\n ... | [
"0.82182264",
"0.7857503",
"0.7801803",
"0.7793374",
"0.77342093",
"0.77223086",
"0.77172345",
"0.7710354",
"0.7697853",
"0.7697853",
"0.76659536",
"0.76443315",
"0.7621985",
"0.76200825",
"0.76200014",
"0.75991046",
"0.75313133",
"0.752628",
"0.752628",
"0.752628",
"0.752405... | 0.8009337 | 1 |
Executable string representation of this Interval. | def __repr__(self):
if isinstance(self.begin, Number):
s_begin = str(self.begin)
s_end = str(self.end)
else:
s_begin = repr(self.begin)
s_end = repr(self.end)
if self.data is None:
return "Interval({0}, {1})".format(s_begin, s_end)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repr__(self):\n s = \"{}, {}\".format(self.left_endpoint, self.right_endpoint)\n if self.left_closed:\n left_bracket = '['\n else:\n left_bracket = '('\n\n if self.right_closed:\n right_bracket = ']'\n else:\n right_bracket = ')'\... | [
"0.71480864",
"0.696534",
"0.6899967",
"0.66029596",
"0.6529993",
"0.6518206",
"0.64999825",
"0.6445101",
"0.62968284",
"0.62619025",
"0.6259937",
"0.6250147",
"0.6226611",
"0.6221005",
"0.62134147",
"0.62100565",
"0.62071943",
"0.62010485",
"0.62010485",
"0.62010485",
"0.619... | 0.72492284 | 0 |
Split an s3 uri into the bucket and object name | def split_uri(s3_uri):
if not s3_uri.startswith("s3://"):
# This is a local path, indicate using None
raise ValueError(f"failed to parse s3 uri: {s3_uri}")
bucket, key = s3_uri.split("s3://")[1].split("/", 1)
return bucket, key | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_uri(uri):\n if not uri.startswith(\"s3://\"):\n raise ValueError(\"Expected S3 URI\")\n\n bucket_name, key = uri.replace(\"s3://\", \"\").split(\"/\", 1)\n return bucket_name, key",
"def split_s3_path(url):\n\tparsed = urlparse (url)\n\tif not parsed.netloc or not parsed.path:\n\t\trais... | [
"0.84234256",
"0.79439884",
"0.78763926",
"0.78763926",
"0.767611",
"0.76380134",
"0.7330717",
"0.71763176",
"0.69720215",
"0.69384485",
"0.69290155",
"0.6860623",
"0.6848078",
"0.674747",
"0.65667576",
"0.6564563",
"0.63594395",
"0.635297",
"0.6327186",
"0.630025",
"0.629873... | 0.83376247 | 1 |
Converts a first or second level batch to human readable | def first_or_second_level_to_human_readable(batch):
job_level_batches = db.get_child_batch_metadata(
batch[Attributes.BATCH_ID], BatchMetadataType.JOB_LEVEL
)
job_responses = [
job_level_to_human_readable(job_level_batch) for job_level_batch in job_level_batches
]
return {
"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def input_batch_to_human_readable(batch):\n\n # User should only be querying for parent batches of type \"INPUT\", not frame\n # level batches.\n if batch[Attributes.BATCH_METADATA_TYPE] != BatchMetadataType.INPUT:\n logger.error(\n \"User requested existing batch, but it is of the wrong... | [
"0.7052451",
"0.6277633",
"0.6207949",
"0.59580165",
"0.5956875",
"0.56889665",
"0.5668856",
"0.5634892",
"0.5634892",
"0.5634892",
"0.55901664",
"0.55360013",
"0.549158",
"0.5428135",
"0.5394302",
"0.5389692",
"0.53437525",
"0.53286153",
"0.5324247",
"0.5321802",
"0.52739024... | 0.7289912 | 0 |
Gets a full URL to a JAFC search page | def get_search_url(query, page=1):
# type: (str, int) -> str
return "{}?orderby=default&sound=all&num={}&page={}&keyword={}".format(
JAFC_SEARCH_URI, SEARCH_MAX_RESULTS, page, query) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_search_url(free_text_search):\n url = baseUrl + \"data/\"\n if not free_text_search:\n url += \"warehouse/\"\n url += \"search?\"\n return url",
"def url(self):\n return url_search_posts(self.parameters, url_domain=self.url_domain)",
"def search_url(url):\r\n\r\n surl = url + '... | [
"0.72922665",
"0.6772499",
"0.65420073",
"0.6432122",
"0.64029217",
"0.6359451",
"0.6330832",
"0.6317165",
"0.6235276",
"0.6229302",
"0.6211998",
"0.6206645",
"0.6206043",
"0.6205089",
"0.6143072",
"0.61282516",
"0.6092116",
"0.6081848",
"0.6070567",
"0.6063114",
"0.6032462",... | 0.7016892 | 1 |
Gets a full URL to a JAFC player page | def get_player_url(id):
return JAFC_M3U8_TEMPLATE.format(id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_embed_url(self):\n if not self.id_video or not self.original_url or not self.xml_response:\n return ''\n return '//view.vzaar.com/{0}/player'.format(self.id_video)",
"def get_url(self):\n if not self.get_video_id():\n return ''\n \n return 'http://www.dai... | [
"0.66149753",
"0.6611158",
"0.6531794",
"0.64999014",
"0.6488381",
"0.64640135",
"0.6438209",
"0.6393434",
"0.6368918",
"0.63414407",
"0.6317633",
"0.63145584",
"0.6299857",
"0.6293298",
"0.6293298",
"0.6273694",
"0.6272204",
"0.6265445",
"0.62509024",
"0.6201217",
"0.619866"... | 0.71524704 | 0 |
Gets a full URL to a JAFC html page | def get_page_url(href):
# type: (str) -> str
return "{}{}".format(JAFC_URI, href.lstrip("/")) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Url(self) -> str:",
"def web_url(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"web_url\")",
"def get_url(self, page):\n return self.server_url + page",
"def get_full_url(self):\n full_url = home_page + self.source_link\n return full_url",
"def _get_url(self, absol... | [
"0.6670181",
"0.66274405",
"0.66116786",
"0.66016185",
"0.6582116",
"0.65696293",
"0.65174687",
"0.6513991",
"0.6511577",
"0.6438163",
"0.64040387",
"0.6384952",
"0.63380724",
"0.6331847",
"0.6324063",
"0.63232374",
"0.63232374",
"0.631195",
"0.6308127",
"0.6307245",
"0.62800... | 0.6633017 | 1 |
Saves a list of search strings | def save(searches):
# type: (list) -> None
with Cache(CACHE_URI) as c:
c.set(SAVED_SEARCH, json.dumps(searches, ensure_ascii=False)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def saveQuery(self, query):\n items_temp = []\n field = self.txtSearchHistory # Initialise Search History textbox as 'field'\n field.config(state='normal') # Enable 'field' for editing (removing and adding texts)\n index = 1\n\n # Iterate through 'field' to check if query made matches previous sea... | [
"0.63106495",
"0.62108016",
"0.6156991",
"0.58614767",
"0.5767715",
"0.56644654",
"0.5652136",
"0.5616301",
"0.56007016",
"0.5581326",
"0.55317277",
"0.5507554",
"0.54770094",
"0.545046",
"0.5402758",
"0.53920615",
"0.5372612",
"0.53690314",
"0.530982",
"0.528692",
"0.5248267... | 0.71367985 | 0 |
Removes a query from the saved search list | def remove(query):
# type: (str) -> bool
if not query or not SEARCH_SAVED:
return False
searches = retrieve()
if query in searches:
searches.remove(query)
save(searches)
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete(self, query):\n self.collection.remove(query)",
"def query_remove(self,*q):\n query = self.parameters['q'].difference(q)\n params = join_params(self.parameters,\n {\"q\": query, \"limit\": self._limit,\n \"url_domain\": self.url_domain,... | [
"0.7211253",
"0.7050755",
"0.6936614",
"0.6839507",
"0.67858285",
"0.6480618",
"0.6479802",
"0.64102256",
"0.63554883",
"0.6253427",
"0.6241588",
"0.6116487",
"0.6018235",
"0.60095644",
"0.5906871",
"0.59045094",
"0.5893667",
"0.58832836",
"0.5882228",
"0.58817315",
"0.586768... | 0.789691 | 0 |
Adds a query to the saved search list unless the query is equal to False or SEARCH_SAVED settings is False | def append(query):
# type: (str) -> bool
if not query or not SEARCH_SAVED:
return False
searches = retrieve()
if query not in searches:
searches.append(query)
save(searches) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def saveQuery(self, query):\n items_temp = []\n field = self.txtSearchHistory # Initialise Search History textbox as 'field'\n field.config(state='normal') # Enable 'field' for editing (removing and adding texts)\n index = 1\n\n # Iterate through 'field' to check if query made matches previous sea... | [
"0.6368964",
"0.60500705",
"0.5986336",
"0.59545386",
"0.5931738",
"0.5926475",
"0.59156233",
"0.5875235",
"0.5836838",
"0.57738036",
"0.5770017",
"0.55606484",
"0.55499476",
"0.5534752",
"0.55133146",
"0.55129987",
"0.54866916",
"0.5432528",
"0.54266226",
"0.54100585",
"0.54... | 0.77002674 | 0 |
Gets cached or live HTML from the url | def get_html(url):
# type: (str) -> BeautifulSoup
headers = {
"Accept": "text/html",
"Accept-encoding": "gzip"
}
with Cache(CACHE_URI) as c:
cached = c.get(url)
if cached:
add_cache_headers(headers, cached)
# always return cached info regardless
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scrape_page(url):\n cached_page = cache.get(url)\n\n if cached_page:\n return html.fromstring(cached_page)\n else:\n page = get(url)\n\n cache.set(url, page.text)\n\n return html.fromstring(page.text)",
"def get(self, url=None, script=None, key=None):\n self.base_u... | [
"0.7545125",
"0.7428418",
"0.7357613",
"0.7355026",
"0.7341723",
"0.7332338",
"0.7266856",
"0.7048026",
"0.7047912",
"0.7039737",
"0.7023649",
"0.69982666",
"0.69752645",
"0.6962329",
"0.69497025",
"0.69189936",
"0.69020534",
"0.68549544",
"0.68450296",
"0.68338495",
"0.68158... | 0.74664515 | 1 |
Deletes an existing Pipeline. | def delete(self, params=None):
self.logger.debug('Deleting {resource_type} with parameters:'
' {params}'.format(resource_type=self.type_name,
params=params))
self.client.delete_pipeline(**params) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_list_pipeline_delete_one(self):\n response = self.client.delete_pipeline(self.pipeline_name)\n nose.tools.assert_is_not_none(response)\n\n response = self.client.list_pipelines()\n exsit = False\n for pipeline in response.pipelines:\n if pipeline.pipeline_name... | [
"0.71344304",
"0.66652894",
"0.6538766",
"0.64160043",
"0.606167",
"0.5928474",
"0.586184",
"0.577419",
"0.5719994",
"0.5530857",
"0.5435308",
"0.51739424",
"0.51568216",
"0.5153596",
"0.51468605",
"0.5143934",
"0.51435167",
"0.50878054",
"0.5085399",
"0.5078952",
"0.50729287... | 0.73128957 | 0 |
Gets the direction to the left of the car, from the perspective of the direction that the car is facing. E.g., if the car is facing UP, this will return LEFT, and if it's facing DOWN, this will return RIGHT | def get_direction_to_left(self, direction):
return direction_to_left[direction] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def directionLeft(self):\n return self.__directionLeft",
"def turn_left(self):\n self.facing_direction -= self.config\n if self.facing_direction < 0:\n self.facing_direction += 8\n self.x, self.y = self.compute_positions()",
"def get_left(self):\n return -self.l_mo... | [
"0.7663516",
"0.73489416",
"0.71305645",
"0.69870096",
"0.6913713",
"0.68939495",
"0.68638486",
"0.68636286",
"0.6823035",
"0.6767186",
"0.6711137",
"0.6702193",
"0.6595132",
"0.6579246",
"0.6517725",
"0.6501973",
"0.6487817",
"0.6425401",
"0.64018047",
"0.6377863",
"0.636999... | 0.76009375 | 1 |
Gets the direction to the right of the car, from the perspective of the direction that the car is facing. E.g., if the car is facing UP, this will return RIGHT, and if it's facing DOWN, this will return LEFT | def get_direction_to_right(self, direction):
return direction_to_right[direction] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def directionRight(self):\n return self.__directionRight",
"def turn_right(self):\n temp = self.direction[0]\n self.direction[0] = -self.direction[1]\n self.direction[1] = temp",
"def turn_right(self):\n self.facing_direction += self.config\n if self.facing_direction >... | [
"0.7777795",
"0.735609",
"0.72058654",
"0.7097927",
"0.70696753",
"0.7038165",
"0.69736624",
"0.69053406",
"0.6898099",
"0.6856463",
"0.6797121",
"0.6769212",
"0.6765747",
"0.675166",
"0.67343193",
"0.6712764",
"0.66965467",
"0.6684191",
"0.66769063",
"0.666835",
"0.665002",
... | 0.78666174 | 0 |
Moves the car in the desired direction. When this method is called, the car should already be certain that it can move to the tile in question. This method also removes the car from the tile it is move away off of and onto the tile it is moving onto. | def move_in_direction(self, direction, next_tile, previous_tile):
# for ii in range(self.velocity):
# Don't run over any cars or blow through traffic lights
if self.can_move_to_tile(next_tile):
self.turn_to_direction_map[direction]() # Adding the parentheses actually calls the m... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_car(self):\n a = self.h / 50\n self.x += self.speed_x / FPS\n if self.x + 170 * a >= 1100:\n self.dir = -1\n self.speed_x = -self.speed_x\n if self.x - 170 * a <= 50:\n self.dir = 1\n self.speed_x = -self.speed_x",
"def move(self, b... | [
"0.6581758",
"0.64435995",
"0.6281606",
"0.62406456",
"0.62285095",
"0.61850435",
"0.6177967",
"0.617256",
"0.6108114",
"0.60884064",
"0.60834736",
"0.6047164",
"0.6045349",
"0.60351455",
"0.600586",
"0.599142",
"0.5980788",
"0.5972384",
"0.5958476",
"0.5947111",
"0.5936153",... | 0.7081806 | 0 |
To be called by the main simulator when the car reaches its destination. It removes the car from the tile objects so that other cars can continue on their way | def destroy(self):
self.city_map.get_tile_at_position(self.position).car = None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(self):\n\n for car in self.cars.get_all_cars():\n old_position = car.position\n nearby_cars = self.cars.get_nearby_cars(position=car.position)\n nearby_cars[car.lane].remove(car)\n car.update(self.speed_limit, nearby_cars)\n # Check if we nee... | [
"0.6408383",
"0.6162225",
"0.6145868",
"0.6057817",
"0.6027329",
"0.6027052",
"0.59835607",
"0.59433895",
"0.58956313",
"0.58877546",
"0.5817011",
"0.5816",
"0.579692",
"0.5777173",
"0.5775827",
"0.5755283",
"0.5739541",
"0.57330614",
"0.5697933",
"0.5685382",
"0.5685382",
... | 0.7115272 | 0 |
Gets a list of cars between this car and the next intersection the car is approaching. We only look at the cars straight ahead and cutoff the range at the nearest intersection straight ahead, because we don't want to start trying to flock to cars several blocks ahead. And since cars will probably be going in a differen... | def get_cars_between_me_and_next_intersection(self):
next_intersection_tile = self.path[0]
tiles = self.city_map.get_tiles_between_tile_a_and_tile_b(self.city_map.get_tile_at_position(self.position),
next_intersection_tile)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cars_at_intersection(self):\n return self.cars_at_intersection",
"def get_cars_at_intersection(self):\n return self.cars_at_intersection",
"def get_cars_at_intersection(self):\n return self.cars_at_intersection",
"def getNext(self, carPos):\n if carPos.lane != self:\n ... | [
"0.7006788",
"0.7006788",
"0.7006788",
"0.63193274",
"0.58075684",
"0.56612337",
"0.538843",
"0.53481513",
"0.5330617",
"0.5250249",
"0.5212691",
"0.516299",
"0.51339966",
"0.5120874",
"0.50953263",
"0.50810665",
"0.50649995",
"0.5049101",
"0.5031665",
"0.49640206",
"0.495215... | 0.77712464 | 0 |
Initializes the SatData object and reads in the .json file | def __init__(self):
with open("sat.json", "r") as infile:
self._sat = json.load(infile)["data"]
#Define the headers for the csv
self._headers = ["DBN", "School Name", "Number of Test Takers", "Critical Reading Mean", "Mathematics Mean", "Writing Mean"] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, name):\n try:\n with open(DATA_DIR + name + \".json\") as data:\n self.data = json.load(data)\n except IOError:\n print \"Cannot open file for \", name",
"def __init__(self, data):\n\t\tassert isinstance(data, str), \"Data location must be pro... | [
"0.7230022",
"0.70839703",
"0.70451206",
"0.7019796",
"0.6950166",
"0.6915002",
"0.69049865",
"0.6745017",
"0.6663421",
"0.64876246",
"0.6458275",
"0.6453081",
"0.6421125",
"0.6399048",
"0.6386527",
"0.63818234",
"0.63470894",
"0.6332923",
"0.6332479",
"0.632893",
"0.63204163... | 0.73582524 | 0 |
This method takes a list of district bureau numbers and saves a CSV file | def save_as_csv(self, DBNs):
with open("output.csv", "w") as outfile:
# create the headers
for i in range(0, 5):
outfile.write(self._headers[i] + ",") # delimits header names
# moves to next line
outfile.write(self._headers[5] + "\n")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def export(tako_list, filename):\n for tak in tako_list:\n tak = tak[0]\n l1 = [tak.ident, \"a\"]\n for gen in tak.genome.weightchr_a:\n l1.append(gen.ident)\n l1.append(gen.weight)\n l1.append(gen.mut_rate)\n l1.append(gen.dom)\n f = os.pa... | [
"0.64082557",
"0.6216291",
"0.61752206",
"0.6168384",
"0.6143117",
"0.6140604",
"0.60723305",
"0.60699093",
"0.60474026",
"0.6013382",
"0.600645",
"0.5995924",
"0.5993597",
"0.59917456",
"0.5989028",
"0.5963057",
"0.59537816",
"0.59295964",
"0.59092754",
"0.5907891",
"0.59066... | 0.686182 | 0 |
Play a guessing game with a user. The exercise here is to rewrite the exampleGuessingGame() function | def advancedGuessingGame():
print("\nWelcome to the guessing game!")
print("A number between _ and _ ?")
lowerBound = not_number_rejector("Enter Lower Bound: ")
higher_number = False # we need to set an upper and lowerbound for game
while not higher_number:
upperBound = not_number_rejec... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def play(self):\n print(\"Game is starting!!\")\n self.generate_secret_number()\n while True:\n self.get_guess_from_user()\n self.ans = self.compare_results()\n if self.ans:\n print(f\"Right Guess!! , the number is {self.secret_number}\")\n ... | [
"0.72188973",
"0.70376676",
"0.6994092",
"0.69199556",
"0.69090265",
"0.68983454",
"0.68386334",
"0.68023723",
"0.6791833",
"0.6778669",
"0.67778534",
"0.6773469",
"0.6772827",
"0.6761244",
"0.67608136",
"0.67598337",
"0.6736602",
"0.6716704",
"0.6715845",
"0.66994876",
"0.66... | 0.71829236 | 1 |
Initalize instance with given response_dict. | def __init__(self, response_dict={}):
self.id = response_dict.get('id')
self.name = response_dict.get('name')
self.image_url = response_dict.get('imageUrl')
self.subtype = response_dict.get('subtype')
self.supertype = response_dict.get('supertype')
self.ability = response... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, res):\n self.fromResponseObj(res)",
"def __init__(self, res):\n self.fromResponseObj(res)",
"def __init__(\n self,\n response: dict\n ):\n\n self.__name = read_value(\n \"name\", response, str, True)\n self.__uuid = read_value(\... | [
"0.73315465",
"0.73315465",
"0.7124996",
"0.70806485",
"0.703705",
"0.69967353",
"0.6830665",
"0.68262124",
"0.68262124",
"0.68262124",
"0.68262124",
"0.68262124",
"0.68262124",
"0.68262124",
"0.68262124",
"0.68262124",
"0.68262124",
"0.68262124",
"0.68262124",
"0.68262124",
... | 0.747926 | 0 |
Return a specific Card given an id. | def find(id):
return QueryBuilder(Card).find(id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getCard(self,id):\n if not self.cardExists(id):\n return None\n return self.cards[id]",
"def retrieve(customer, card_id):\n if isinstance(customer, resources.Customer):\n customer = customer.id\n\n http_client = HttpClient()\n response, __ = http_clien... | [
"0.8715357",
"0.73507446",
"0.72734964",
"0.69763416",
"0.69386464",
"0.6935953",
"0.6860235",
"0.680616",
"0.6607529",
"0.6569944",
"0.6448182",
"0.64085186",
"0.6315493",
"0.6297896",
"0.6294089",
"0.62614655",
"0.62189525",
"0.62170476",
"0.6211605",
"0.6211605",
"0.619043... | 0.8268551 | 1 |
Returns the GPS week, day, seconds and microseconds since the beginning of the GPS week | def utctoweekseconds(utc, leapseconds=18):
datetimeformat = "%Y-%m-%d %H:%M:%S"
epoch = datetime.datetime.strptime("1980-01-06 00:00:00", datetimeformat)
tdiff = utc - epoch + datetime.timedelta(seconds=leapseconds)
gpsweek = tdiff.days // 7
gpsdays = tdiff.days - 7 * gpsweek
gpsseconds = tdiff.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_week_date(self, raw_week: str) -> tuple:\n\n search_result = re.search(r'^(\\d+.\\d+)\\s+-\\s+\\d+.\\d+', raw_week)\n\n if \"from\" in raw_week:\n week = re.sub(r'^\\D+', '', raw_week)\n\n elif search_result:\n week = search_result.group(1)\n else:\n ... | [
"0.59134704",
"0.59009886",
"0.5853655",
"0.5782736",
"0.5747621",
"0.57289743",
"0.5699698",
"0.56796503",
"0.5656576",
"0.56065714",
"0.55873585",
"0.55524087",
"0.5505642",
"0.5439676",
"0.5432224",
"0.5425123",
"0.5401933",
"0.5364168",
"0.53482115",
"0.5335548",
"0.53292... | 0.60639554 | 0 |
Unregister accessors or rtypes. | def unregister(self, rtypes=None, accessors=None):
if rtypes is not None:
for rtype in rtypes:
del self[rtype]
if accessors is not None:
for accessor in accessors:
for rtype in accessor.__rtypes__:
if rtype in self:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unregister ():\n dsf_prop_export.unregister ()\n dsf_geom_export.unregister ()\n dsf_wm_import.unregister ()\n dsf_pose_import.unregister ()\n dsf_arm_import.unregister ()\n dsf_uvset_import.unregister ()\n dsf_morph_export.unregister ()\n dsf_morph_import.unregister ()\n dsf_geom_import.unregister ()... | [
"0.69912624",
"0.6978314",
"0.675342",
"0.64715624",
"0.6418582",
"0.63744724",
"0.63308245",
"0.6324244",
"0.62827414",
"0.6219619",
"0.6187397",
"0.6147885",
"0.61440146",
"0.6115181",
"0.6083284",
"0.5992793",
"0.5981351",
"0.59576404",
"0.59505045",
"0.59396935",
"0.59232... | 0.83660007 | 0 |
Create the Attribute instance and create AttributeValue(s) associated with it | def create(self, validated_data):
# Create the Attribute instance
attribute = Attribute.objects.create(
name=validated_data['name']
)
# Create each AttributeValue instance
for item in validated_data.get('values', []):
AttributeValue.objects.create(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createAttribute(nid, label, primary, list, x, y):\n attribute = Attribute(nid, label, primary, x, y)\n list.append(attribute)",
"def create_attribute(owner_name, att_name, context=ast.Load(), line=0, column=0):\n attribute = ast.Attribute()\n attribute.attr = att_name\n attribute.ctx = context... | [
"0.64116377",
"0.6013851",
"0.59971005",
"0.5967344",
"0.5908096",
"0.58857423",
"0.5882443",
"0.58695245",
"0.5827147",
"0.57940096",
"0.5792889",
"0.5781367",
"0.57775974",
"0.5776246",
"0.5776246",
"0.5776246",
"0.5768085",
"0.5757633",
"0.5725134",
"0.5722951",
"0.5719026... | 0.78820187 | 0 |
Update the Attribute instance and update/create AttributeValue(s) associated with it and delete unwanted AttributeValue(s). | def update(self, instance, validated_data):
# Update the Attribute instance
instance.name = validated_data.get('name', instance.name)
instance.save()
# If there is no supplied values then do nothing with it
if validated_data.get('values'):
# Delete any AttributeValu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(self, instance, validated_data):\n\n # Update the Attribute instance\n instance.name = validated_data.get('name', instance.name)\n instance.save()\n\n # Update AttributeProduct\n self.update_attributes(instance, validated_data,\n field_nam... | [
"0.6762108",
"0.6644434",
"0.6610771",
"0.6478294",
"0.6431708",
"0.64186126",
"0.62374663",
"0.6134519",
"0.6097815",
"0.6054426",
"0.6005432",
"0.59968334",
"0.59843415",
"0.59825784",
"0.59301513",
"0.5895596",
"0.58702755",
"0.5737867",
"0.57373",
"0.5722033",
"0.5675206"... | 0.7772718 | 0 |
Create the ProductTemplate instance and create association with attribute(s) which connect to its Products and Varriants associated with ProductTemplate itself | def create(self, validated_data):
# Create the Attribute instance
# Creates an instance regardless errors happen later
template = ProductTemplate.objects.create(
name=validated_data['name']
)
# Create each AttributeProduct instance
if validated_data.get('att... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_product(self):\n product = self.product_obj.create({\n \"default_code\": 'A2330',\n \"product_tmpl_id\":\n self.ref(\"product.product_product_4_product_template\"),\n \"attribute_value_ids\": [(6, 0, [\n self.ref('product.product_attribut... | [
"0.68906796",
"0.6637699",
"0.6543743",
"0.64923847",
"0.6467413",
"0.6255171",
"0.61940205",
"0.60161066",
"0.5978016",
"0.5945357",
"0.58300525",
"0.57808197",
"0.5770319",
"0.5736123",
"0.5729061",
"0.57229173",
"0.57034343",
"0.56682295",
"0.5609585",
"0.55937654",
"0.555... | 0.7236754 | 0 |
Create a product Variant instance and its connectedVarianttAttribute | def create(self, validated_data):
variant = ProductVariant(
name=validated_data['name'],
product=validated_data['product']['id'],
active=validated_data.get('active', False)
)
if validated_data['price'].get('amount'):
variant.price = Money(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_product(self):\n product = self.product_obj.create({\n \"default_code\": 'A2330',\n \"product_tmpl_id\":\n self.ref(\"product.product_product_4_product_template\"),\n \"attribute_value_ids\": [(6, 0, [\n self.ref('product.product_attribut... | [
"0.70728076",
"0.70317554",
"0.67715746",
"0.6514791",
"0.64029783",
"0.6349646",
"0.62429774",
"0.6187608",
"0.6105697",
"0.609649",
"0.60295576",
"0.5962163",
"0.59564453",
"0.59382737",
"0.59142923",
"0.58707803",
"0.5799128",
"0.5735306",
"0.5721392",
"0.5668691",
"0.5642... | 0.80497056 | 0 |
Update a product Variant instance and its connectedVarianttAttribute | def update(self, instance, validated_data):
instance.name = validated_data.get('name', instance.name)
instance.active = validated_data.get('active', instance.active)
if validated_data.get('price'):
if validated_data['price'].get('amount'):
instance.price = Money(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(self, instance, validated_data):\n\n # Update the Product instance\n instance.name = validated_data.get('name', instance.name)\n instance.description = validated_data.get('description', instance.description)\n instance.active = validated_data.get('active', instance.active)\n ... | [
"0.701751",
"0.64262533",
"0.61184746",
"0.60352725",
"0.5932542",
"0.5842131",
"0.5804501",
"0.57167363",
"0.5685463",
"0.5658403",
"0.5640953",
"0.56252694",
"0.5607121",
"0.55334973",
"0.5522642",
"0.54955995",
"0.54925525",
"0.5485186",
"0.5482061",
"0.5471064",
"0.542706... | 0.6617582 | 1 |
Create the Product instance and its connectedProductAttribute | def create(self, validated_data):
# Create the Attribute instance
product = Product(
name=validated_data['name'],
product_template=validated_data['product_template']['id'],
description=validated_data.get('description'),
active=validated_data.get('active',... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_product(self):\n product = self.product_obj.create({\n \"default_code\": 'A2330',\n \"product_tmpl_id\":\n self.ref(\"product.product_product_4_product_template\"),\n \"attribute_value_ids\": [(6, 0, [\n self.ref('product.product_attribut... | [
"0.7809591",
"0.74017674",
"0.70743674",
"0.6890056",
"0.6756093",
"0.67468816",
"0.6729608",
"0.6729589",
"0.6467058",
"0.6433752",
"0.6425072",
"0.64164263",
"0.6376284",
"0.63619643",
"0.6321698",
"0.6321698",
"0.63119274",
"0.62768716",
"0.6142879",
"0.60312605",
"0.60166... | 0.77725405 | 1 |
Filters bam file based on mapping, mapping of mate, splicing | def bam_filtering(bam):
filt_bam = os.path.splitext(bam)[0] + "_filt.bam"
# Filtering bam, removing unmapped, mate unmapped, spliced, secondary mapping
cmd = "samtools view -h -F 0x4 -F 0x8 -F 0x100 {0} | awk '{{if ($1 ~ /^@/) {{print}} else if ($6 !~ /N/) {{print}}}}' | samtools view -bh > {1}".forma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_samfile(temp_alignment, filtered_out):\n # Check the quality and status of each aligned fragment.\n # Write the ones with good quality in the final output file.\n # Keep those that do not map unambiguously for the next round.\n\n unaligned = set()\n temp_sam = ps.AlignmentFile(temp_alignm... | [
"0.6563839",
"0.61846894",
"0.6106953",
"0.6029072",
"0.5986886",
"0.5983956",
"0.5952436",
"0.58762664",
"0.57932687",
"0.57255226",
"0.57188755",
"0.5712081",
"0.5709512",
"0.57006574",
"0.56707716",
"0.567073",
"0.5670114",
"0.56360954",
"0.5635739",
"0.56314486",
"0.56093... | 0.68917465 | 0 |
Set up the commandline progress bar with max_value | def initializeProgressBar(max_value):
bar = progressbar.ProgressBar(maxval=max_value, widgets=[progressbar.Bar('=', '[', ']'), ' ', progressbar.Percentage()])
return bar | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_progress_range(self, maximum):\r\n\r\n pass",
"def __init__(self, max: int) -> None:\n self.progress_bar = None\n self.progress = 0\n self._max = max",
"def bar(self, progress):\n if not hasattr(self, \"_limit\") or not self._limit:\n self._limit = self.ter... | [
"0.7111303",
"0.6805075",
"0.66656774",
"0.6650501",
"0.6446343",
"0.6415051",
"0.6409759",
"0.63803643",
"0.6345776",
"0.63089895",
"0.6278483",
"0.6257398",
"0.6244696",
"0.6239689",
"0.6172171",
"0.61557204",
"0.6144944",
"0.6059261",
"0.6045168",
"0.6035028",
"0.6018355",... | 0.7495011 | 0 |
Testing the case where we have a single command instance, but execute() is run multiple times with different content models. The expected behavior is to pick the correct content model class each time. | def test_model_class_loaded_on_each_execution(message_body):
cmd = Command()
mock_repo = MagicMock(spec=Repository)
headers = {
'PlastronJobId': 'test',
'PlastronCommand': 'update',
'PlastronArg-model': 'Letter',
}
message = PlastronCommandMessage(headers=headers, body=messa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create(self):\n with patch('sys.stdout', new=StringIO()) as f:\n HBNBCommand().onecmd(\"create\")\n self.assertEqual(f.getvalue().strip(), \"** class name missing **\")\n with patch('sys.stdout', new=StringIO()) as f:\n HBNBCommand().onecmd(\"create hello\")\... | [
"0.6008626",
"0.59421533",
"0.5843393",
"0.5799433",
"0.5684046",
"0.5677871",
"0.5666402",
"0.5653431",
"0.5589043",
"0.5587832",
"0.5562466",
"0.5555742",
"0.5520141",
"0.5520141",
"0.5490762",
"0.5461224",
"0.542619",
"0.5383023",
"0.53781736",
"0.53781736",
"0.53781736",
... | 0.70353436 | 0 |
Test retrieving documents and encoding them with vectors. | def test_retrieve_and_encode_simple(test_client, test_collection_name):
VECTOR_LENGTH = 100
def fake_encode(x):
return test_client.generate_vector(VECTOR_LENGTH)
# with TempClientWithDocs(test_client, test_collection_name, 100) as client:
test_client.insert_documents(test_collection_name, test_c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_document_retrieval(self):",
"def test_all_documents(self):",
"def test_documents_for(self):\n # Test the default ES version\n self._test_documents_for(_documents_for)\n\n # Test the DB version\n self._test_documents_for(_db_documents_for)",
"def test_get_documents_populat... | [
"0.7132346",
"0.70555973",
"0.64202774",
"0.63451856",
"0.62944025",
"0.6217141",
"0.61046475",
"0.60995257",
"0.60924697",
"0.6030219",
"0.6022934",
"0.5991151",
"0.59872127",
"0.589388",
"0.5838781",
"0.58209395",
"0.5817124",
"0.5815693",
"0.5729778",
"0.5727924",
"0.57028... | 0.7413078 | 0 |
For a list of positions and a constant recombination rate (in cM/Mb), return a list "results" of the same length as "positions" such that results[i] is the phredscaled recombination probability between positions[i1] and positions[i]. | def uniform_recombination_map(recombrate, positions):
return [0] + [
round(centimorgen_to_phred((positions[i] - positions[i - 1]) * 1e-6 * recombrate))
for i in range(1, len(positions))
] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def makeRecombMapBooker(snplist, rholist, chrom):\n if chrom == \"X\":\n mapsize = 44.7\n elif chrom == \"3R\":\n mapsize = 90.9\n elif chrom == \"3L\":\n mapsize = 89.1\n elif chrom == \"2L\":\n mapsize = 63.2\n elif chrom == \"2R\":\n mapsize = 94.8\n elif chr... | [
"0.5755035",
"0.56898737",
"0.5400906",
"0.53897715",
"0.53442574",
"0.5335959",
"0.53210104",
"0.5311045",
"0.53048027",
"0.5294955",
"0.528744",
"0.5275976",
"0.5264708",
"0.5260833",
"0.52288777",
"0.52222407",
"0.5210756",
"0.5198016",
"0.5188784",
"0.51821774",
"0.516453... | 0.67105913 | 0 |
rest_framework can't deal with ManyToMany relations that have a through table. In xos, most of the through tables we have use defaults or blank fields, so there's no reason why we shouldn't be able to save these objects. So, let's strip out these m2m relations, and deal with them ourself. | def save_object(self, obj, **kwargs):
obj._complex_m2m_data={};
if getattr(obj, '_m2m_data', None):
for relatedObject in obj._meta.get_all_related_many_to_many_objects():
if (relatedObject.field.rel.through._meta.auto_created):
# These are non-trough ManyT... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_m2m_fields(self, fieldname, mapping):\n _typemsg = \"Mapping must be a dictionary, with keys valued on the primary keys of instances in the queryset, \" \\\n \"valued on a list of primary keys of instances in the related object queryset\"\n if not isinstance(mapping, dict... | [
"0.65324277",
"0.64302415",
"0.607475",
"0.60060024",
"0.5994023",
"0.58564836",
"0.5841459",
"0.5675029",
"0.5641935",
"0.56222016",
"0.5618012",
"0.5562107",
"0.55059177",
"0.54370886",
"0.54183936",
"0.5415212",
"0.5393096",
"0.5389939",
"0.5386621",
"0.53754026",
"0.53401... | 0.7114395 | 0 |
Set additional append str to stock symbol when forming stock url. Set to sel.cur_quotes_stock_portion_additional_url. Mainly to set the '.SI' for singapore stocks. | def set_stock_sym_append_str(self, append_str):
self.com_data_stock_portion_additional_url = append_str | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_stock_sym_append_str(self, append_str):\n self.cur_quotes_stock_portion_additional_url = append_str",
"def form_cur_quotes_stock_url_str(self):\n self.cur_quotes_stock_portion_url = ''\n for n in self.target_stocks:\n self.cur_quotes_stock_portion_url = self.cur_quotes_sto... | [
"0.83196074",
"0.7468265",
"0.69796675",
"0.61658657",
"0.61611176",
"0.5607167",
"0.52325624",
"0.5215801",
"0.5201767",
"0.5153672",
"0.4878753",
"0.48634982",
"0.4798464",
"0.47756186",
"0.47064564",
"0.46863243",
"0.46857637",
"0.46786737",
"0.467215",
"0.46650028",
"0.46... | 0.8144998 | 1 |
Form the list of stock portion for the cur quotes url. | def form_com_data_stock_url_str(self):
self.com_data_stock_portion_url = ''
for n in self.target_stocks:
self.com_data_stock_portion_url = self.com_data_stock_portion_url +'%22' + n +\
self.com_data_stock_portion_additional_url + '%22%2C'
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def form_cur_quotes_stock_url_str(self):\n self.cur_quotes_stock_portion_url = ''\n for n in self.target_stocks:\n self.cur_quotes_stock_portion_url = self.cur_quotes_stock_portion_url + n +\\\n self.cur_quotes_stock_portion_additional_url + ... | [
"0.78473824",
"0.66010034",
"0.6469332",
"0.6243975",
"0.59980655",
"0.5917665",
"0.5836436",
"0.58335614",
"0.5813822",
"0.58052963",
"0.5770366",
"0.5768073",
"0.5726045",
"0.5700043",
"0.5691203",
"0.56370264",
"0.56281304",
"0.5598005",
"0.55803543",
"0.55655724",
"0.5563... | 0.68197006 | 1 |
Download the json file from the self.com_data_full_url. The save file is defaulted to the self.saved_json_file. | def download_json(self):
cache.clear()
url = URL(self.com_data_full_url)
f = open(self.saved_json_file, 'wb') # save as test.gif
f.write(url.download(timeout = 50)) #increse the time out time for this
f.close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def download_json(self):\n # make the path dir if it doesn't exist\n if not self.path.is_dir():\n self.path.mkdir(parents=True)\n\n # open a file, send a request for the json and write to the file\n with self.file.open('w') as json_file:\n try:\n jso... | [
"0.76825815",
"0.6899236",
"0.6899236",
"0.6703963",
"0.6665916",
"0.65556526",
"0.6494851",
"0.63685983",
"0.6284138",
"0.6250484",
"0.6167223",
"0.61638594",
"0.6151558",
"0.6141404",
"0.61134374",
"0.6105554",
"0.6081908",
"0.6049193",
"0.5993746",
"0.599304",
"0.59168667"... | 0.80634254 | 0 |
Return the binned (sum of all frames) data | def getBinnedData(self):
return self._array.sum(0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bin_binarise(self):\n pass",
"def _binarization(self):\n for feat in self.cat_feats:\n lbl = preprocessing.LabelBinarizer()\n lbl.fit(self.dataframe[feat].values)\n val = lbl.transform(self.dataframe[feat].values)\n self.dataframe_d_copy = self.datafr... | [
"0.66195166",
"0.6542668",
"0.6503437",
"0.62473",
"0.62198627",
"0.62198627",
"0.6209935",
"0.61888206",
"0.61871463",
"0.6124896",
"0.6068046",
"0.60338694",
"0.60149175",
"0.59968144",
"0.59640676",
"0.5954214",
"0.59471065",
"0.5930796",
"0.59244406",
"0.5913006",
"0.5883... | 0.7058887 | 0 |
Return the virtual chip size | def getVirtualChipSize(self):
return self._vChipSize | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getChipSize(self):\n return self._chipSize",
"def get_dev_size(self):\n\t\treturn call_sdk_function('PrlSrvCfgHdd_GetDevSize', self.handle)",
"def __get_size(self):\n\t\treturn 4*self.version + 17",
"def get_size(self):\n\t\treturn call_sdk_function('PrlSrvCfgHddPart_GetSize', self.handle)",
"de... | [
"0.7537076",
"0.7193751",
"0.71853673",
"0.7046478",
"0.69768065",
"0.69764334",
"0.68312764",
"0.68164086",
"0.6792047",
"0.6792047",
"0.6791824",
"0.6762953",
"0.6718725",
"0.6702376",
"0.6696075",
"0.66841346",
"0.6680521",
"0.66476923",
"0.6647065",
"0.6641362",
"0.662550... | 0.8628087 | 0 |
Return the comments in the data file If n is not provided then all the comments are returned as a list of string values. If n is provided then the n'th comment is returned | def getComment(self, n = None):
if n is None:
return self._comments
else:
return self._comments[n] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_comments():\n comments = list(get_comments(TEST_SUBREDDIT, TEST_START_DATE, TEST_END_DATE, TEST_MAX))\n\n # prints the dictionary of variables for each comment\n for x in comments:\n print(x.d_)",
"def _get_comments(self):\n if not hasattr(self, 'id'):\n raise BadRe... | [
"0.6559512",
"0.6508631",
"0.62756485",
"0.61539084",
"0.614451",
"0.6051848",
"0.6036511",
"0.59882265",
"0.597855",
"0.5907632",
"0.5848902",
"0.58425957",
"0.5839838",
"0.5800919",
"0.5784357",
"0.5766973",
"0.5750142",
"0.5720209",
"0.5689544",
"0.56683725",
"0.5658421",
... | 0.73399085 | 0 |
Run git, process it's output. Print any errors. On success, print a formatted version of the repo's authors. Return the total number of authors printed. | def get_authors():
# git log --encoding=utf-8 --full-history --reverse
# --format=format:%at;%an;%ae
gitcmd = (
'git',
'log',
'--encoding=utf-8',
'--full-history',
'--reverse',
'--format=format:%at;%an;%ae'
)
git = subprocess.Popen(
gitcmd,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main(*args):\n\n # Default options\n repos = []\n user_map = NullUserMap()\n plotout = None\n printout = True\n gitlab = None\n\n if \"--help\" in args:\n print(main.__doc__)\n return 0\n\n # Parse command-line \n it = iter(args)\n for a in it:\n if a == \"... | [
"0.64920014",
"0.627672",
"0.62206215",
"0.61437243",
"0.6047011",
"0.6009975",
"0.59818316",
"0.5933847",
"0.58700925",
"0.58233637",
"0.5719015",
"0.559531",
"0.5551623",
"0.554489",
"0.55376357",
"0.55274796",
"0.5512924",
"0.55097973",
"0.54649127",
"0.5457391",
"0.537788... | 0.7638564 | 0 |
Parse a string timestamp into a Time. | def parse_time(s):
return time.gmtime(float(s)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_time(time_string):\n return calendar.timegm(time.strptime(time_string, \"%Y%m%dT%H%M%SZ\"))",
"def parse_timestamp(timestamp):\n if not timestamp or timestamp == '0000-00-00T00:00:00Z':\n return struct_time((0, 0, 0, 0, 0, 0, 0, 0, 0))\n return strptime(timestamp, '%Y-%m-%dT%H:%M:%SZ')"... | [
"0.75230086",
"0.7408081",
"0.73725647",
"0.73398465",
"0.73247117",
"0.72148603",
"0.71765757",
"0.7144907",
"0.7143915",
"0.7115504",
"0.71063656",
"0.70861506",
"0.708549",
"0.70443153",
"0.70397437",
"0.7023746",
"0.6990175",
"0.69791627",
"0.6971797",
"0.6964172",
"0.694... | 0.7556363 | 0 |
Preprocesses a single utterance wav/text pair this writes the mel scale spectogram to disk and return a tuple to write to the train.txt file | def _process_utterance(lf0_dir, mgc_dir, bap_dir, cmp_dir, linear_dir, basename, wav_path, text, hparams):
if hparams.trim_silence:
tar_wavfile = wav_path[:-4] + "_trim.wav"
print("raw wav path:%s" % wav_path)
wav_raw, fs = sf.read(wav_path)
wav_trim = audio.trim_silence(wav_raw, hparams)
sf.write(tar_wavfi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _process_utterance(pml_dir, wav_dir, index, wav_path, pml_path, hparams):\n try:\n # Load the audio as numpy array\n wav = audio.load_wav(wav_path)\n except FileNotFoundError: # catch missing wav exception\n print('file {} present in csv metadata is not present in wav folder. skippi... | [
"0.616037",
"0.5901794",
"0.58221334",
"0.5771103",
"0.5722",
"0.57093835",
"0.570432",
"0.5699671",
"0.5650356",
"0.5633378",
"0.56267637",
"0.5594447",
"0.55906874",
"0.5556254",
"0.5471796",
"0.54641896",
"0.5443846",
"0.5442978",
"0.5431923",
"0.53901076",
"0.5388333",
... | 0.62324125 | 0 |
Prototype of function computing LPT deplacement. Returns output tensorflow and mesh tensorflow tensors | def lpt_prototype(mesh,
nc=FLAGS.nc,
bs=FLAGS.box_size,
batch_size=FLAGS.batch_size,
a0=FLAGS.a0,
a=FLAGS.af,
nsteps=FLAGS.nsteps):
stages = np.linspace(a0, a, nsteps, endpoint=True)
klin = np.loadtxt('../fl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split(input_legs, tensor_list, leg_list, ent_list, cutoff):\n # find tensor common to all input legs\n input_inds = [set([leg_list.index(legs) for legs in leg_list\n if legs.__contains__(qs)]) for qs in input_legs]\n ind = list(set.intersection(*input_inds))[0]\n svd_ten = tensor_list[ind] ... | [
"0.57856417",
"0.5665937",
"0.55605024",
"0.55246353",
"0.5397714",
"0.5371809",
"0.5283407",
"0.52216864",
"0.51886463",
"0.5177959",
"0.5160277",
"0.5157784",
"0.51423675",
"0.51132643",
"0.51029354",
"0.51028657",
"0.5083043",
"0.5074328",
"0.50735605",
"0.50595444",
"0.50... | 0.58466405 | 0 |
Signal for volume > 20 SMA | def signal_volume(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def signal_rsi(self):\n pass",
"def vol(x):\r\n return pi*(topdia(x)/2000.)**2 * length (x)",
"def silence_removal(signal, sampling_rate, st_win, st_step, smooth_window=0.5,\n weight=0.5, plot=False):\n\n if weight >= 1:\n weight = 0.99\n if weight <= 0:\n weight ... | [
"0.6216598",
"0.61762625",
"0.5933593",
"0.585632",
"0.58003706",
"0.57687545",
"0.5738506",
"0.5722117",
"0.5672636",
"0.5607543",
"0.5602781",
"0.559767",
"0.5591002",
"0.5564034",
"0.55251837",
"0.5514501",
"0.54904765",
"0.54731554",
"0.5459457",
"0.5459255",
"0.5444476",... | 0.6485503 | 0 |
Signal for RSI > 60 | def signal_rsi(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def slot_timer(self, _sender, _data):\r\n if self.connected:\r\n if time.time() - self._time_last_received > 60:\r\n self.debug(\"### did not receive anything for a long time, disconnecting.\")\r\n self.force_reconnect()\r\n self.connected = False\r\n ... | [
"0.61080366",
"0.6046958",
"0.5819819",
"0.57507235",
"0.5733319",
"0.563774",
"0.56190205",
"0.5609547",
"0.55858874",
"0.5540874",
"0.5450107",
"0.5448421",
"0.5423741",
"0.5396912",
"0.53902006",
"0.5377324",
"0.5354077",
"0.53379124",
"0.53039145",
"0.53007734",
"0.529446... | 0.63109714 | 0 |
Get one news from mongoDB | def get_one_news(self): # pylint: disable=no-self-use
return operations.get_one_news() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def obj_get(self, request=None, **kwargs):\n return Document(self.get_collection(request).find_one({\n \"_id\": ObjectId(kwargs.get(\"pk\"))\n }))",
"def get(self):\n return GlobalNews.retrieve()",
"def search_news(self, key=None):\r\n\r\n # Connect tp MongoDB databas... | [
"0.6565657",
"0.6507733",
"0.64140624",
"0.628049",
"0.62576056",
"0.6170488",
"0.6133731",
"0.6109496",
"0.60684144",
"0.605034",
"0.6038439",
"0.60371333",
"0.5964813",
"0.5918189",
"0.5864173",
"0.5860944",
"0.58509344",
"0.5848587",
"0.5828884",
"0.5821581",
"0.580858",
... | 0.6957589 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.