query stringlengths 9 9.05k | document stringlengths 10 222k | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Retrieve all sessions associated with a conference. | def _getConferenceSessions(self, request):
# Ensure that websafeConferenceKey is a valid conference key
confKey = _raiseIfWebsafeKeyNotValid(request.websafeConferenceKey,
'Conference')
# Retrieve all sessions that have a matching conference key
... | [
"def get_conference_sessions(self, request):\n return self.session_service.get_conference_sessions(\n request.websafeConferenceKey)",
"def getConferenceSessions(self, request):\n # get the Conference key from the urlSafe key\n confKey = ndb.Key(urlsafe=request.websafeConferenceKey)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Retrieve all sessions associated with a conference, by type. | def _getConferenceSessionsByType(self, request):
# Ensure that websafeConferenceKey is a valid conference key
confKey = _raiseIfWebsafeKeyNotValid(request.websafeConferenceKey,
'Conference')
# Retrieve all sessions that have a matching conference key,... | [
"def get_sessions_by_type(self, request):\n return self.session_service.get_conference_sessions_by_type(\n request.websafeConferenceKey, request.sessionType)",
"def getConferenceSessionsByType(self, request):\n\n user = endpoints.get_current_user()\n if not user:\n raise... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Retrieve all sessions matching one or more given highlights. | def _getSessionsByHighlightSearch(self, request):
# Generate list of filters from the highlight arguments
filters = [Session.highlights == hl for hl in request.highlights]
if not filters:
raise endpoints.BadRequestException(
'At least one highlight must be specified'
... | [
"def getSessionsByHighlights(self, request):\n q = Session.query()\n q = q.filter(Session.highlights.IN(request.highlights))\n\n return SessionForms(\n items=[self._copySessionToForm(session) for session in q])",
"def getSessionsByHighlightSearch(self, request):\n sessions =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Retrieve all sessions given by a particular speaker. | def _getSessionsBySpeaker(self, request):
# Ensure that the speaker key is valid and that the speaker exists
speaker = _getEntityByWebsafeKey(request.websafeSpeakerKey, 'Speaker')
# Return all of the speaker's sessions
return ndb.get_multi(speaker.sessions) | [
"def get_speaker_sessions(self, request):\n return self.session_service.get_speaker_sessions(\n request.websafeSpeakerKey)",
"def getSessionsBySpeaker(self, request):\n speaker_obj = ndb.Key(urlsafe=request.websafeSpeakerKey).get()\n q = Session.query().filter(Session.speaker == sp... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Retrieve all sessions in the user's wishlist. | def _getSessionsInWishlist(self):
user = endpoints.get_current_user()
if not user:
raise endpoints.UnauthorizedException('Authorization required')
profile = self._getProfileFromUser()
# Fetch the entities and return them
return ndb.get_multi(profile.sessionWishlist) | [
"def wishlist_sessions(self, user):\n wishlist_key = self.get_wishlist_key(user)\n session_keys = [ndb.Key(urlsafe=wsck) for wsck in\n wishlist_key.get().sessionKeys]\n sessions = ndb.get_multi(session_keys)\n return sessions",
"def get_sessions_in_wishlist(self,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Removes a session from the user's wishlist, returning a boolean. | def _removeSessionFromWishlist(self, request):
# Preload necessary data items
user = endpoints.get_current_user()
if not user:
raise endpoints.UnauthorizedException('Authorization required')
profile = self._getProfileFromUser()
# Get actual session key from websafe ke... | [
"def deleteSessionInWishlist(self, request):\n # get user Profile\n prof = self._getProfileFromUser()\n # get session; check that it exists\n # check if session exists given websafeSessionKey\n websafeSessionKey = request.websafeSessionKey\n session = ndb.Key(urlsafe=websaf... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get list of sessions matching one or more of the given highlights. | def getSessionsByHighlightSearch(self, request):
sessions = self._getSessionsByHighlightSearch(request)
# Return individual SessionForm object per Session
return SessionForms(
items=[self._copySessionToForm(session) for session in sessions]
) | [
"def _getSessionsByHighlightSearch(self, request):\n # Generate list of filters from the highlight arguments\n filters = [Session.highlights == hl for hl in request.highlights]\n if not filters:\n raise endpoints.BadRequestException(\n 'At least one highlight must be s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Copy relevant fields from Profile to ProfileForm. | def _copyProfileToForm(self, prof):
pf = ProfileForm()
for field in pf.all_fields():
if hasattr(prof, field.name):
# Convert t-shirt string to Enum; just copy others
if field.name == 'teeShirtSize':
setattr(pf, field.name,
... | [
"def _copyProfileToForm(self, prof):\n # copy relevant fields from Profile to ProfileForm\n pf = ProfileForm()\n for field in pf.all_fields():\n if hasattr(prof, field.name):\n # convert t-shirt string to Enum; just copy others\n if field.name == 'teeShi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return Profile from datastore, creating new one if nonexistent. | def _getProfileFromUser(self):
# Make sure user is authenticated
user = endpoints.get_current_user()
if not user:
raise endpoints.UnauthorizedException('Authorization required')
# Get Profile from datastore
user_id = user.email()
p_key = ndb.Key(Profile, user_... | [
"def _getProfileFromUser(self):\n # make sure user is authed\n user = endpoints.get_current_user()\n if not user:\n raise endpoints.UnauthorizedException('Authorization required')\n\n # get Profile from datastore\n user_id = getUserId(user)\n p_key = ndb.Key(Prof... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create our CRITsDBAPI object. You may specify a full mongodb uri or the arguments individually. | def __init__(self,
mongo_uri='',
mongo_host='localhost',
mongo_port=27017,
mongo_user='',
mongo_pass='',
db_name='crits'):
# If the user provided a URI, we will use that. Otherwise we will build
# a URI... | [
"def create_mongodb(config):\n\n # =====================================================================================\n # This section will be to use the DB -\n # need to start building the connection string\n # =====================================================================================\n\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Search a collection for the query provided. Just a raw interface to mongo to do any query you want. | def find(self, collection, query):
obj = getattr(self.db, collection)
result = obj.find(query)
return result | [
"def query(self, collection, query = {}):\n Database.replaceObjectID(query) # Update all _id keys for use with Mongo\n try:\n return list(self.db[collection].find(query)) # Find using Mongo and convert to list\n except TypeError: # Ensure successful find\n raise Query... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Search a collection for all available items. | def find_all(self, collection):
obj = getattr(self.db, collection)
result = obj.find()
return result | [
"def all_items(searchqueryset):\n return searchqueryset.all()",
"def all_in(items, collection):\n return all(are_in(items, collection))",
"def searchItems(name, allPages = False):\n return Gw2Spidy._paginatedRequest(allPages, 'item-search', name)",
"def might_contains_all(self, collection):\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Search a collection for the query provided and return one result. Just a raw interface to mongo to do any query you want. | def find_one(self, collection, query):
obj = getattr(self.db, collection)
result = obj.find_one(query)
return result | [
"def find(self, collection, query):\n obj = getattr(self.db, collection)\n result = obj.find(query)\n return result",
"def find_document(collection: str, query: dict = None, regex: list = None) -> dict:\n if query is not None:\n return DB[collection].find_one(query)\n if regex is... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Search a collection for the distinct key values provided. | def find_distinct(self, collection, key):
obj = getattr(self.db, collection)
result = obj.distinct(key)
return result | [
"def _filter_search_values(key: str, values: list, collection: list):\n return_data = []\n for item in collection:\n if any(val in values for val in item[key]):\n return_data.append(item)\n return return_data",
"def distinct(self, key):\n return self.database.command({'distinct':... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds an embedded campaign to the TLO. | def add_embedded_campaign(self, id, collection, campaign, confidence,
analyst, date, description):
if type(id) is not ObjectId:
id = ObjectId(id)
# TODO: Make sure the object does not already have the campaign
# Return if it does. Add it if it doesn't
... | [
"def add_campaign(self, campaign):\n self._campaigns += [campaign]",
"def add_campaign(args):\n db_engine = sql.create_engine(args.engine_string)\n\n Session = sessionmaker(bind=db_engine)\n session = Session()\n\n campaign = Campaign(name=args.name,\n blurb=args.blurb,\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Removes an item from the bucket list | def remove_bucket_list_item(self, id, collection, item):
if type(id) is not ObjectId:
id = ObjectId(id)
obj = getattr(self.db, collection)
result = obj.update(
{'_id': id},
{'$pull': {'bucket_list': item}}
)
return result | [
"def remove_item_from_bucket(self, item):\n self.bucket_list.remove(item)",
"def bucketlist_item_delete():\n pass",
"def remove_item(self, item):\n self.items.pop(item.name)",
"def remove(self, item):\n entry = self.entry_finder.pop(item)\n entry[-1] = self.REMOVED",
"def _buc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds an item to the bucket list | def add_bucket_list_item(self, id, collection, item):
if type(id) is not ObjectId:
id = ObjectId(id)
obj = getattr(self.db, collection)
result = obj.update(
{'_id': id},
{'$addToSet': {'bucket_list': item}}
)
return result | [
"def add(self, item: object) -> None:\n self.items.append(item)",
"def add_to_bag(self, item):\n self._bag.append(item)",
"def add(self, item):\n self.cache.append(item)",
"def test_add_bucketlist_item(self):\n self.test_store.add_bucketlist('travel', 'visit london')\n test_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a list of all valid campaign names | def get_campaign_name_list(self):
campaigns = self.find('campaigns', {})
campaign_names = []
for campaign in campaigns:
if 'name' in campaign:
campaign_names.append(campaign['name'])
return campaign_names | [
"def validShortNames(self):\n return [self.gameShortName()]",
"def test_get_existent_campaigns_returns_campaigns_list(self):\n test_campaign = return_canned_campaign()\n test_campaign.create()\n response = self.client.get(self.endpoint_url)\n response_body = response.get_json()\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Whether the process is running as the main process | def is_main_process(args: dict):
return not is_distributed(args) or args.local_rank == 0 | [
"def is_main_process() -> bool:\n return multiprocessing.current_process().name == 'MainProcess' and os.environ['main_process_pid'] == str(os.getpid())",
"def is_running(self):\n return True if gtk.main_level() else False",
"def is_main_thread():\n\n return threading.current_thread().name == \"Main... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set parameters in the parameter tree. This method simply wraps underlying ParameterTree method so that an exceptions can be reraised with an appropriate FileInterfaceError. | def set(self, path, data):
try:
self.param_tree.set(path, data)
except ParameterTreeError as e:
raise FileInterfaceError(e) | [
"def setParameterNode(self, parameterNode):\r\n # framework\r\n profbox()\r\n self.parameterNode = parameterNode",
"def _set_params(self, *args, **kwargs):\n self._verify_not_readonly(*args, **kwargs)\n params_to_set = args[0]\n old_config = self._param_dict.get_all()\n\n # ch... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Retrieve all of the txt configuration files in the absolute directory path Clears the internal lists first to prevent circular appending at every "GET" | def get_config_files(self):
self.clear_lists()
print self.abs_directory
for file in os.listdir(self.abs_directory):
print file
if file.endswith('.json') and "qemii" in file:
self.txt_files.append(file) | [
"def get_list_paths(self):\n\n self.list_paths = glob.glob(\"lists/*.txt\")",
"def list_config(\n temp_config_paths: submanager.models.config.ConfigPaths,\n) -> submanager.models.config.ConfigPaths:\n config_data: Any = [\"spam\", \"eggs\"]\n submanager.config.utils.write_config(\n config_d... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
gets the frame processor config files from the list of text files found | def get_fp_config_files(self):
self.get_config_files()
for file in self.txt_files:
if "fp" in file:
self.fp_config_files.append(file)
return self.fp_config_files | [
"def _extract_config_filenames(self):\n\n for filename in self.directory_contents:\n\n if fnmatch(filename, '*.conf'):\n\n self.config_filenames.append(filename)\n\n elif fnmatch(filename, '*.comp'):\n\n self.comp_filenames.append(filename)",
"def get_con... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
clears the text file, fr and fp config file lists | def clear_lists(self):
self.fp_config_files = []
self.txt_files = []
self.fr_config_files = [] | [
"def __clear_file_list(self):\n self.filenames = []\n self.lineedit.setText(\"\")\n self.__update_status()\n\n self.checks = []\n self.checkboxes = []",
"def clearFilepath( self ):\n self.setFilepath('')",
"def clean_files(self):\n self.filenames.clear()",
"def... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Find the overlap areas between each cartesian bin and each polar bin. | def get_overlap_values(self, cbins, rbins, thbins):
dr = (cbins - 0.5) / rbins
dth = (pi / 2) / thbins
thbins_reduced = int(ceil(thbins / 2))
def overlap_value(x, y, r, th):
"""
Find the overlap area between a cartesian and a polar bin.
"""
thmin = max(th - dth/2, atan2(y - 0.5, x + 0.5))
thma... | [
"def annulus_area(x,y, rbins, cellsize=None):\n r = np.hypot(x,y)\n if cellsize is None:\n minr = list()\n for xi,yi in zip(x,y):\n rsep = usel.radius(x[x!=xi],y[y!=yi],[xi,yi],1)\n minr.append(np.min(rsep[rsep>0]))\n cellsize = 2*np.percentile(minr,99) # determine g... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
点击通讯录 点击添加成员;点击手动输入添加; 选择必填选项,输入名字, 选择手机号选项,输入名字, 点击地址,进入新页面,输入地址;点击确定; 点击保存; | def test_add(self):
self._driver.find_element(MobileBy.XPATH, '//*[@text="通讯录"]').click()
self._driver.find_element(MobileBy.XPATH, '//*[@text="添加成员"]').click()
self._driver.find_element(MobileBy.XPATH, '//*[@text="手动输入添加"]').click()
self._driver.find_element(MobileBy.XPATH, '//*[@text... | [
"def click_add_friend(self):\n try:\n self.click_by_id_after_refresh(\"com.tencent.mm:id/rb\")\n except Exception:\n pass\n try:\n self.click_by_text_after_refresh(\"添加朋友\")\n except Exception:\n pass",
"def __ui_add_new_person(self):\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Simply a setter for the switch_state variable | def switch_to_state(self, state):
self.switch_state = state | [
"def _set_switch(self, new_state):\n self._device.siren = new_state\n self._siren_on = new_state > 0\n self._no_updates_until = dt_util.utcnow() + SKIP_UPDATES_DELAY\n self.schedule_update_ha_state()",
"def set_state(self, value):\n self.state = value",
"def set_state(self, sw... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
uses the USA Today API in order to extract the list of the subAPIs for music reviews | def obtain_USAToday_APIs(api="http://api.usatoday.com/open/reviews/music?count=1000&api_key=mhph6f4afgvetbqtex4rs22a"):
import requests
r = requests.get(api)
jsonfile = r.json()
key = jsonfile.keys()
data = jsonfile[key[0]]
keys = jsonfile[key[0]].keys()
api_dict = {}
nData =... | [
"def fetch_title_data(id, count, api_key1, api_key2):\n if count %2==0:\n current_key = api_key1\n else:\n current_key = api_key2\n \n with urllib.request.urlopen(f\"https://api.watchmode.com/v1/title/{id}/details/?apiKey={current_key}\") as url:\n data = json.loads(url.read().decode())... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
convert any item to a numpy ndarray | def to_ndarray(item):
return type(item), sp.array(item, sp.float64, ndmin=1) | [
"def _as_ndarray(self, value):\n # TODO(tomhennigan) Support __array_interface__ too (including for\n # _convert_numpy_inputs).\n return value.__array__()",
"def convert_to_ndarray(entity):\n if isinstance(entity, np.ndarray) and entity.dtype.kind in set('biufc'):\n # entity is numerical ndarra... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Compute the ROUGEN score of a peer with respect to one or more models, for a given value of `n`. | def rouge_n(peer, models, n, alpha=1):
matches = 0
recall_total = 0
peer_counter = _ngram_counts(peer, n)
for model in models:
model_counter = _ngram_counts(model, n)
matches += _counter_overlap(peer_counter, model_counter)
recall_total += _ngram_count(model, n)
precision_tot... | [
"def rouge_n(peer, models, n, alpha, metric='f1'):\n if len(models) == 0:\n return 0.\n\n if type(models[0]) is not list:\n models = [models]\n\n matches = 0\n recall_total = 0\n peer_counter = _ngram_counts(peer, n)\n for model in models:\n model_counter = _ngram_counts(model... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Compute the ROUGE1 (unigram) score of a peer with respect to one or more models. | def rouge_1(peer, models, alpha=1):
return rouge_n(peer, models, 1, alpha) | [
"def rouge_1(peer, models, alpha, metric='f1'):\n return rouge_n(peer, models, 1, alpha, metric='f1')",
"def rouge_n(peer, models, n, alpha, metric='f1'):\n if len(models) == 0:\n return 0.\n\n if type(models[0]) is not list:\n models = [models]\n\n matches = 0\n recall_total = 0\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Compute the ROUGE2 (bigram) score of a peer with respect to one or more models. | def rouge_2(peer, models, alpha=1):
return rouge_n(peer, models, 2, alpha) | [
"def rouge_2(peer, models, alpha, metric='f1'):\n return rouge_n(peer, models, 2, alpha, metric='f1')",
"def rouge_n(peer, models, n, alpha, metric='f1'):\n if len(models) == 0:\n return 0.\n\n if type(models[0]) is not list:\n models = [models]\n\n matches = 0\n recall_total = 0\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Compute the ROUGE3 (trigram) score of a peer with respect to one or more models. | def rouge_3(peer, models, alpha=1):
return rouge_n(peer, models, 3, alpha) | [
"def rouge_l(peer, models, alpha=1):\n matches = 0\n recall_total = 0\n for model in models:\n matches += lcs(model, peer)\n recall_total += len(model)\n precision_total = len(models) * len(peer)\n return _safe_f1(matches, recall_total, precision_total, alpha)",
"def rouge_n(peer, mod... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Compute the ROUGEL score of a peer with respect to one or more models. | def rouge_l(peer, models, alpha=1):
matches = 0
recall_total = 0
for model in models:
matches += lcs(model, peer)
recall_total += len(model)
precision_total = len(models) * len(peer)
return _safe_f1(matches, recall_total, precision_total, alpha) | [
"def score(self, params):\n\n if self.use_sqrt:\n return self.score_sqrt(params)\n else:\n return self.score_full(params)",
"def rouge_n(peer, models, n, alpha, metric='f1'):\n if len(models) == 0:\n return 0.\n\n if type(models[0]) is not list:\n models = [... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given a list of graphs in networkx format, write each of them in its own little gml file in a folder named name in the data_root folder. Create the folder, if necessary. This function is very hacky, parsing node labels on the go for datasets obtained from the Dortmund collection at | def write_graph_list(name, graph_list, data_root):
data_path = os.path.join(data_root, name)
if not os.path.exists(data_path):
os.makedirs(data_path)
# compute right number of trailing zeros for file names
format_positions = ceil(log10(len(graph_list)))
for i, g in enumerate(graph_list):
... | [
"def write_graph_list(name, graph_list, data_root):\n\n data_path = os.path.join(data_root, name)\n if not os.path.exists(data_path):\n os.makedirs(data_path)\n\n # compute right number of trailing zeros for file names\n format_positions = ceil(log10(len(graph_list)))\n\n for i, g in enumerate... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
fetches tweets and wraps them in Tweet objects | def get_tweets(self):
now = datetime.datetime.now()
tweet_json = self.api.get_tweets(self.last, now)
self.last = now
return [Tweet(x) for x in tweet_json] | [
"def get_tweets():\n clean_tweetdb.delay()\n db_tweets = Tweet.objects.all()\n max_id = min([tweet.tweet_id for tweet in db_tweets])\n tweets = api.search(\n q='#python',\n max_id=max_id,\n count=100\n )\n tweets_id = [tweet.id for tweet in tweets]\n tweets_date = [tweet.cr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
updates max_importance value if importance is higher then max_importance | def update_importance(self, importance):
if importance > self.max_importance:
self.max_importance = importance | [
"def set_importance(self, importance):\r\n self.importance = importance\r\n for tweet in self.tweets:\r\n tweet.update_importance(importance)",
"def _updateMaxEnergy(self):\n maxEnergy = self.guesses[self.bestIndex].energy\n alternativeMaxEnergy = abs(maxEnergy - self.lowest... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
fetches tweets from start date till end date | def get_tweets(self, start_date, end_date):
pass | [
"def get_tweets(self, start_date, end_date):\r\n # get tweets from api\r\n config = crawler.APIConfig()\r\n config.set_api_key(\"8e1618e9-419f-4239-a2ee-c0680740a500\")\r\n config.set_end_time(end_date)\r\n config.set_filter(self.region)\r\n config.set_start_time(start_date... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
fetches tweets from start date till end date | def get_tweets(self, start_date, end_date):
# get tweets from api
config = crawler.APIConfig()
config.set_api_key("8e1618e9-419f-4239-a2ee-c0680740a500")
config.set_end_time(end_date)
config.set_filter(self.region)
config.set_start_time(start_date)
return c... | [
"def get_tweets(self, start_date, end_date):\r\n pass",
"def get_tweets_in_date_range(start, end, screen_name):\n start, end = convert_string_to_datetime(start), convert_string_to_datetime(end)\n culled_tweets = []\n first_date, max_id = start, None\n errors = 0\n while first_date >= start:\n try:\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return a final mad lib with parts of speech replaced by user input. | def make_madlib(get_input):
# call the get_input function and make a variable from its output list
replaced_list = get_input(read_text)
index = 0
# we want both the index and the word that we want to replace in text_split
for (i, word) in enumerate(text_split):
# find the parts of speech, ... | [
"def madlib2():\n print(\"\\n\")\n print(\n \"Alright! First let me ask you a few questions to get the story \"\n \"telling started.\")\n print(\"Please make sure to not misspell your answers.\")\n print(\"\")\n question1 = input(\"Choose any male name for your protagonist: Please \"\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generates a unary relation from our graph by first sampling a value from dist (must return a number between 1 and N, where N is the number of nodes in the graph), and then sampling that many nodes from the graph with replacement | def generateUnaryRel(graph, dist=None):
if dist is None:
dist = lambda: random.randint(1, len(graph.nodes()))
count = dist()
return random.sample(graph.nodes(), count) | [
"def generate_regular_graph(variable_names, dist_func, num_neigh=10, **kwargs):\n shuffle(variable_names)\n num_vars = len(variable_names)\n num_neigh = min(num_neigh, num_vars-1)\n graphs = nx.random_graphs.random_regular_graph(num_neigh, num_vars)\n edges = np.array(graphs.edges())\n edges.sort(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Plots the theoretical probability distribution for the random walk. | def plot_distribution(self,show=True):
k_vals,prob_vals = self.tuple_of_probabilities
plt.figure("Probability distribution of Random Walk, theoretical")
plt.scatter(k_vals,prob_vals,s=4)
plt.xlim((-self.n-1,self.n+1))
plt.xlabel("x\u2099 - Position after n jumps")
plt.ylabel("Probability")
plt.supti... | [
"def show_rand_walks(all_walks):\n np_aw = np.array(all_walks) # converts the list of all random walks to a Numpy Array\n np_aw_t = np.transpose(np_aw) # must transpose the array for graph to display properly\n plt.clf()\n plt.plot(np_aw_t)\n plt.xlabel(\"Steps\")\n plt.ylabel(\"S&P 500 Index Va... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Runs a Monte Carlo simulation of the random walk for a specified number of trials. It then plots the results as a frequency distribution. Mean and variance values of the Monte Carlo simulation can be retrieved by calling mc.mean and mc.variance, respectively. Method parameters | def run_monte_carlo(self,number_of_trials=2000,plot=True,histogram=False,show=True,overlay=False):
trial_data = []
for _ in range(number_of_trials):
steps = self._random_walk_simulation()
trial_data.append( sum(steps) + self.x_initial )
x_n, counts = np.unique(trial_data, return_counts=True)
self.mc... | [
"def run_monte_carlo(self,number_of_trials=2000,plot=True,show=True): #NEEDS TO BE COMPLETELY CHANGED\n\t\t\n\t\ttrial_data = []\n\t\tfor _ in range(number_of_trials):\n\t\t\tx_steps,y_steps,z_steps = self._random_walk_simulation()\n\t\t\ttrial_data.append( sum(x_steps) + self.x_initial )\n\t\tx_n, counts = np.uniq... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This method produces an animated simulation of a 1D random walk. | def random_walk_draw(self,num_plots,animated=False,show=True):
t_x_arrays = []
t_max = self.n
for _ in range(num_plots):
current_x = self.x_initial
x_array = [current_x]
t_array = range(t_max + 1)
steps = self._random_walk_simulation()
for s in steps:
current_x += s
x_array.append(curren... | [
"def random_walk(self):\n for i in range(self.width):\n tim.color((random.randint(0, 255), random.randint(0, 255), random.randint(0, 255)))\n tim.forward(self.length)\n tim.setheading(random.choice(self.movements))",
"def walk_one_dim() :\n global N, prob\n walk = np.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the theoretical average distance from x_initial. | def _calculate_mean_distance_theoretical(self):
x_mean_distance = 0
x_vals,prob_vals = self.tuple_of_probabilities
for i in range(len(x_vals)):
x_val, prob = x_vals[i], prob_vals[i]
x_distance = abs(x_val - self.x_initial)
x_weighted = x_distance * prob
x_mean_distance += x_weighted
return x_mean_di... | [
"def average_distance(self):\n avg_dist = 0\n for i in range(0, len(self.x_traj)-1):\n avg_dist += sqrt((self.x_traj[i] - self.x_traj[i+1])**2 +\n (self.y_traj[i] - self.y_traj[i+1])**2 +\n (self.t_traj[i] - self.t_traj[i+1])**2)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calculates the probability that x_n = k delta_x. This method uses the values of n and p in its calculations. | def _calculate_probability(self,k):
if abs(k * self.delta_x) > (3 * np.sqrt(self.variance)):
return 0.0
binom_coeff = special.binom(self.n,(self.n + k)/2)
b_value = binom_coeff * ((self.p) ** ((self.n + k)/2)) * ((1-self.p) ** ((self.n - k)/2))
return b_value | [
"def Poisson(n, k):\n\tp = math.exp(-k) * math.pow(k, n) / float(Factorial(n))\n\tassert 0.0 <= p <= 1.0, \"Error, value of p is invalid probability: \" + str(p)\n\treturn p",
"def probability_of_all_successes(p: float, r: int, n: int) -> float:\n\n if r == 1:\n return pow(p, n)\n elif n == 0:\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets a tuple of the form (kvalues,probabilities) in the range [n,n]. | def _get_tuple_of_probabilities(self):
k_array = np.arange(-self.n,self.n+1,2)
probability_array = []
for k in k_array:
probability_array.append(self._calculate_probability(k))
return (k_array,probability_array) | [
"def most_probable(self, n=None):\n indxs = list(reversed(np.argsort(self.factor_table)))[:n]\n return [(self._get_assignment_from_index(i)[0],\n self._decode(self.factor_table[i])) for i in indxs]",
"def get_probable_prime(n: int) -> [int]:\n return [6*n-1, 6*n+1]",
"def get_ra... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
tries to decode unicode to deal with python unicode strangeness | def unicode_decode(text):
try:
return text.encode('utf-8').decode()
except UnicodeDecodeError:
return text.encode('utf-8') | [
"def _decode(s, encoding=_default_encoding):\n try:\n return unicode(s, encoding)\n except (TypeError, UnicodeDecodeError, ValueError):\n return s",
"def _decode_utf8(s):\r\n return unicode(s, 'utf-8')",
"def escapeDecode(s: unicode) -> unicode:\n ...",
"def decode(val):\n try... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reads lines in file_id and fetches relevant facebook comments, using the facebook graph api, saving the result to result_file | def scrapeFacebookComments(file_id, result_file, access_token):
with open(file_id, 'r', encoding='utf8') as f, \
open(result_file, 'w', encoding='utf8', newline='') as o:
input_file = csv.DictReader(f)
output_file = csv.DictWriter(o,
fieldnames=[
... | [
"def get_comments(video_id, CLIENT_SECRETS_FILE):",
"def _aggregate_comments(self, final_comments_file_path):\n # copia todos os arquivos de comentarios coletados para um arquivo so\n try:\n folders = sorted(os.listdir(self.INPUT_DIR))\n n_folder = len(folders)\n fin... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generate an instance of the HPE OneView client. Generates an instance of the HPE OneView client using the hpOneView lib. | def get_hponeview_client():
manager_url = prepare_manager_url(CONF.oneview.manager_url)
config = {
"ip": manager_url,
"credentials": {
"userName": CONF.oneview.username,
"password": CONF.oneview.password
}
}
return hponeview_client.OneViewClient(config) | [
"def gen_heat_client(self):\n\n print \"\\t* Generating heat client\"\n # request a new auth token from keystone\n keystone = ksclient.Client(auth_url=self.auth_url,\n username=self.username,\n password=self.password,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the needed information to access ilo. Get the host_ip and a token of an iLO remote console instance which can be used to perform operations on that controller. | def _get_ilo_access(remote_console):
url = remote_console.get('remoteConsoleUrl')
url_parse = parse.urlparse(url)
host_ip = parse.parse_qs(url_parse.netloc).get('addr')[0]
token = parse.parse_qs(url_parse.netloc).get('sessionkey')[0]
return host_ip, token | [
"async def info(self):\n return await self.send(\"miIO.info\")",
"async def info_server(self, ctx):\r\n await ServerPages(ctx).interact()",
"async def get_ip():\n\turl = 'https://cheese.formice.com/api/tfm/ip'\n\tdata = await request_api(url)\n\n\tif not len(data):\n\t\t# Empty dictionary, request... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Verify if fields and namespaces of a node are valid. Verifies if the 'driver_info' field and the 'properties/capabilities' namespace exist and are not empty. | def verify_node_info(node):
capabilities_dict = utils.capabilities_to_dict(
node.properties.get('capabilities', '')
)
driver_info = node.driver_info
_verify_node_info('properties/capabilities', capabilities_dict,
REQUIRED_ON_PROPERTIES)
_verify_node_info('driver_info'... | [
"def _verify_node_info(node_namespace, node_info_dict, info_required):\n missing_keys = set(info_required) - set(node_info_dict)\n\n if missing_keys:\n raise exception.MissingParameterValue(\n _(\"Missing the keys for the following OneView data in node's \"\n \"%(namespace)s: %(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get OneView information from the node. | def get_oneview_info(node):
try:
capabilities_dict = utils.capabilities_to_dict(
node.properties.get('capabilities', '')
)
except exception.InvalidParameterValue as e:
raise exception.OneViewInvalidNodeParameter(node_uuid=node.uuid,
... | [
"def node_show(self, node):\n if node.instance_uuid:\n n = self.ironic_client.node.get_by_instance_uuid(\n node.instance_uuid)\n else:\n n = self.ironic_client.node.get(node.uuid)\n return n",
"def _info(self):\n return self._server.get_node_info(se... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Validate if the node configuration is consistent with OneView. This method calls hpOneView functions to validate if the node configuration is consistent with the OneView resources it represents, including serverHardwareUri, serverHardwareTypeUri, serverGroupUri serverProfileTemplateUri, enclosureGroupUri and node ports... | def validate_oneview_resources_compatibility(task):
ports = task.ports
oneview_client = get_hponeview_client()
oneview_info = get_oneview_info(task.node)
_validate_node_server_profile_template(oneview_client, oneview_info)
_validate_node_server_hardware_type(oneview_client, oneview_info)
_valid... | [
"def _validate_node_server_hardware_type(oneview_client, oneview_info):\n node_server_hardware_type_uri = oneview_info['server_hardware_type_uri']\n server_hardware = oneview_client.server_hardware.get(\n oneview_info['server_hardware_uri'])\n server_hardware_sht_uri = server_hardware.get('serverHar... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Verify if info_required is present in node_namespace. | def _verify_node_info(node_namespace, node_info_dict, info_required):
missing_keys = set(info_required) - set(node_info_dict)
if missing_keys:
raise exception.MissingParameterValue(
_("Missing the keys for the following OneView data in node's "
"%(namespace)s: %(missing_keys)s... | [
"def Requires(self, node):\n return False",
"def has_info(self):\r\n if 'info' in dir(self.module):\r\n return True\r\n else:\r\n return False",
"def verify_namespace_attrs(self, node):\n for cls in node.classes:\n for var in cls.variables:\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks if the node's Server Hardware has a Server Profile associated. Decorator to execute before the function execution to check if the Server Profile is applied to the Server Hardware. | def node_has_server_profile(func):
def inner(self, *args, **kwargs):
task = args[0]
has_server_profile(task)
return func(self, *args, **kwargs)
return inner | [
"def has_server_profile(task):\n oneview_client = get_hponeview_client()\n try:\n profile = task.node.driver_info.get('applied_server_profile_uri')\n oneview_client.server_profiles.get(profile)\n except client_exception.HPOneViewException as exc:\n LOG.error(\n \"Failed to g... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks if the node's Server Hardware has a Server Profile associated. Function to check if the Server Profile is applied to the Server Hardware. | def has_server_profile(task):
oneview_client = get_hponeview_client()
try:
profile = task.node.driver_info.get('applied_server_profile_uri')
oneview_client.server_profiles.get(profile)
except client_exception.HPOneViewException as exc:
LOG.error(
"Failed to get server pro... | [
"def create_simple_server_profile_by_server_hardware(profile_name, server_name, return_true_if_exists=False):\n logger.info(\"--> creating a server profile with name '%s' ...\" % profile_name)\n # checking if the profile is already existing\n FusionUIBase.navigate_to_section(SectionType.SERVER_PROFILES, ti... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Validate if the Server Profile Template is consistent. | def _validate_node_server_profile_template(oneview_client, oneview_info):
server_profile_template = oneview_client.server_profile_templates.get(
oneview_info['server_profile_template_uri'])
server_hardware = oneview_client.server_hardware.get(
oneview_info['server_hardware_uri'])
_validate_... | [
"def _validate_server_profile_template_manage_boot(server_profile_template):\n manage_boot = server_profile_template.get('boot', {}).get('manageBoot')\n\n if not manage_boot:\n message = _(\"Server Profile Template: %s, does not allow to manage \"\n \"boot order.\") % server_profile_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Validate if the Server Hardware Types are the same. Validate if the Server Profile Template and the Server Hardware have the same Server Hardware Type | def _validate_server_profile_template_server_hardware_type(
server_profile_template, server_hardware):
spt_server_hardware_type_uri = (
server_profile_template.get('serverHardwareTypeUri')
)
sh_server_hardware_type_uri = server_hardware.get('serverHardwareTypeUri')
if spt_server_hardwar... | [
"def _validate_node_server_hardware_type(oneview_client, oneview_info):\n node_server_hardware_type_uri = oneview_info['server_hardware_type_uri']\n server_hardware = oneview_client.server_hardware.get(\n oneview_info['server_hardware_uri'])\n server_hardware_sht_uri = server_hardware.get('serverHar... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Validate if the Server Profile Template allows to manage the boot order. | def _validate_server_profile_template_manage_boot(server_profile_template):
manage_boot = server_profile_template.get('boot', {}).get('manageBoot')
if not manage_boot:
message = _("Server Profile Template: %s, does not allow to manage "
"boot order.") % server_profile_template.get('... | [
"def _validate_node_server_profile_template(oneview_client, oneview_info):\n server_profile_template = oneview_client.server_profile_templates.get(\n oneview_info['server_profile_template_uri'])\n server_hardware = oneview_client.server_hardware.get(\n oneview_info['server_hardware_uri'])\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Validate if the node's Server Hardware Type matches Server Hardware's. | def _validate_node_server_hardware_type(oneview_client, oneview_info):
node_server_hardware_type_uri = oneview_info['server_hardware_type_uri']
server_hardware = oneview_client.server_hardware.get(
oneview_info['server_hardware_uri'])
server_hardware_sht_uri = server_hardware.get('serverHardwareType... | [
"def _validate_server_profile_template_server_hardware_type(\n server_profile_template, server_hardware):\n spt_server_hardware_type_uri = (\n server_profile_template.get('serverHardwareTypeUri')\n )\n sh_server_hardware_type_uri = server_hardware.get('serverHardwareTypeUri')\n\n if spt_se... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Validate if the node's Enclosure Group matches the Server Hardware's. | def _validate_node_enclosure_group(oneview_client, oneview_info):
server_hardware = oneview_client.server_hardware.get(
oneview_info['server_hardware_uri'])
sh_enclosure_group_uri = server_hardware.get('serverGroupUri')
node_enclosure_group_uri = oneview_info['enclosure_group_uri']
if node_encl... | [
"def _validate_node_server_hardware_type(oneview_client, oneview_info):\n node_server_hardware_type_uri = oneview_info['server_hardware_type_uri']\n server_hardware = oneview_client.server_hardware.get(\n oneview_info['server_hardware_uri'])\n server_hardware_sht_uri = server_hardware.get('serverHar... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Validate if a port matches the node's Server Hardware's MAC. | def _validate_node_port_mac_server_hardware(oneview_client,
oneview_info, ports):
server_hardware = oneview_client.server_hardware.get(
oneview_info['server_hardware_uri'])
if not ports:
return
# NOTE(nicodemos) If hponeview client's unable to ge... | [
"def validate_mac(mac):\n return mac",
"def _mac_test(mac):\n\n\t\tif re.search(r'([0-9A-F]{2}[:]){5}([0-9A-F]){2}', mac.upper()) is not None:\n\t\t\treturn True\n\t\telse:\n\t\t\treturn False",
"def validateMAC(mac):\n\n if re.match(\"[0-9a-f]{2}([-:]?)[0-9a-f]{2}(\\\\1[0-9a-f]{2}){4}$\",\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Validate if the node's Server Profile Template's MAC type is physical. | def _validate_server_profile_template_mac_type(oneview_client, oneview_info):
server_profile_template = oneview_client.server_profile_templates.get(
oneview_info['server_profile_template_uri']
)
if server_profile_template.get('macType') != 'Physical':
message = _("The server profile template... | [
"def _validate_server_profile_template_server_hardware_type(\n server_profile_template, server_hardware):\n spt_server_hardware_type_uri = (\n server_profile_template.get('serverHardwareTypeUri')\n )\n sh_server_hardware_type_uri = server_hardware.get('serverHardwareTypeUri')\n\n if spt_se... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add event on obj which will trigger error on this Deferred | def add_error_event(self, obj, event, *args):
hid = obj.connect(event, self._err_emited, *args)
self.handlers_id.append(hid) | [
"def errback(self, f):\r\n assert self.__obj is None, 'Only one object can be registered.'\r\n assert isinstance(f, Failure), \"Failure has to be of type 'Failure'.\"\r\n self.__notify(f)",
"def on_error(self, error):",
"def error(self, func):\n self.error_handler = func\n ret... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a frozenset of variables used in given terms. Note that this returns all used variables, not just free ones. | def used_variables(*terms):
t = terms[0] if len(terms) == 1 else terms
if type(t) is Var:
return frozenset((t,))
elif type(t) in (tuple, Const, Apply, Eq, Ite, Not, And, Or,
Implies, Iff):
return union(*(used_variables(x) for x in t))
elif type(t) in (ForAll, Exi... | [
"def free_variables(*terms, **kwargs):\n by_name = kwargs.get('by_name', False)\n _free_variables = partial(free_variables, by_name=by_name)\n\n t = terms[0] if len(terms) == 1 else terms\n\n if type(t) is Var:\n return frozenset((t.name if by_name else t,))\n\n elif type(t) in (tuple, Const, ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a frozenset of variables free in given terms. | def free_variables(*terms, **kwargs):
by_name = kwargs.get('by_name', False)
_free_variables = partial(free_variables, by_name=by_name)
t = terms[0] if len(terms) == 1 else terms
if type(t) is Var:
return frozenset((t.name if by_name else t,))
elif type(t) in (tuple, Const, Apply, Eq, Ite... | [
"def used_variables(*terms):\n\n t = terms[0] if len(terms) == 1 else terms\n\n if type(t) is Var:\n return frozenset((t,))\n\n elif type(t) in (tuple, Const, Apply, Eq, Ite, Not, And, Or,\n Implies, Iff):\n return union(*(used_variables(x) for x in t))\n\n elif type(t)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a frozenset of variables bound in given terms. | def bound_variables(*terms):
t = terms[0] if len(terms) == 1 else terms
if type(t) is Var:
return frozenset()
elif type(t) in (tuple, Const, Apply, Eq, Ite, Not, And, Or,
Implies, Iff):
return union(*(bound_variables(x) for x in t))
elif type(t) in (ForAll, Exist... | [
"def used_variables(*terms):\n\n t = terms[0] if len(terms) == 1 else terms\n\n if type(t) is Var:\n return frozenset((t,))\n\n elif type(t) in (tuple, Const, Apply, Eq, Ite, Not, And, Or,\n Implies, Iff):\n return union(*(used_variables(x) for x in t))\n\n elif type(t)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a frozenset of constants used in given terms. | def used_constants(*terms):
t = terms[0] if len(terms) == 1 else terms
if type(t) is Const:
return frozenset((t,))
elif type(t) in (tuple, Var, Apply, Eq, Ite, Not, And, Or,
Implies, Iff, ForAll, Exists, Lambda, NamedBinder):
return union(*(used_constants(x) for x in ... | [
"def get_constants(formulas: AbstractSet[Formula]) -> Set[str]:\n constants = set()\n for formula in formulas:\n constants.update(formula.constants())\n return constants",
"def get_all_constants():\n return filter(\n lambda key: key.upper() == key and type(globals()[key]) in _ALLOWED,\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the term obtained from t by simultaneous substitution given by subs subs is either a dictionary or a mapping given by an iterable of (key, value) pairs Both keys and values in subs can be either Var or Const. All keys in subs will be substituted by their values in subs. For variables, only free occurances will b... | def substitute(t, subs):
if not isinstance(subs, dict):
subs = dict(subs)
if type(t) in (Var, Const):
if t in subs:
return subs[t]
else:
return t
elif type(t) in (Apply, Eq, Ite, Not, And, Or, Implies, Iff):
return type(t)(*(substitute(x, subs) for ... | [
"def substitute_apply(t, subs, by_name=False):\n\n if not isinstance(subs, dict):\n subs = dict(subs)\n\n _substitute_apply = partial(substitute_apply, subs=subs, by_name=by_name)\n\n if type(t) in (Var, Const):\n return t\n\n if type(t) is Apply and t.func in subs:\n terms = tuple(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the term obtained from t by simultaneous substitution given by subs subs is either a dictionary or a mapping given by an iterable of (key, value) pairs Both keys and values in subs can be either Var or Const, but must be 2nd order. For any key, value in subs, Apply(key, terms) is substituted by value(terms'), so... | def substitute_apply(t, subs, by_name=False):
if not isinstance(subs, dict):
subs = dict(subs)
_substitute_apply = partial(substitute_apply, subs=subs, by_name=by_name)
if type(t) in (Var, Const):
return t
if type(t) is Apply and t.func in subs:
terms = tuple(_substitute_appl... | [
"def substitute(t, subs):\n\n if not isinstance(subs, dict):\n subs = dict(subs)\n\n if type(t) in (Var, Const):\n if t in subs:\n return subs[t]\n else:\n return t\n\n elif type(t) in (Apply, Eq, Ite, Not, And, Or, Implies, Iff):\n return type(t)(*(substit... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns True if t is Eq(x,x) for some x | def is_tautology_equality(t):
return type(t) is Eq and t.t1 == t.t2 | [
"def eq(self, x):\n return self.value == x",
"def exact(cls, lhs, rhs):\n return lhs == rhs",
"def eq():\n return Eq()",
"def __eq__(self, x):\n assert isinstance(x, Determinant), \"Invalid paramater %r (type %r)\" % (x, type(x))\n return self.get_key() == x.get_key() and self.g... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns True if t is syntactially equal to u modulo alpha conversion | def equal_mod_alpha(t,u):
def rec(t,u,m1,m2,n):
if type(t) is Var and type(u) is Var:
return m1.get(t,t) == m2.get(u,u)
if type(t) in (ForAll, Exists, Lambda, NamedBinder) and type(t) is type(u):
if len(t.variables) == len(u.variables):
for v1,v2 in zip(t.vari... | [
"def IsByAlpha(self) -> bool:",
"def u_exact(t):\n return a * t + b",
"def is_trans(c):\n return c and (is_upper(c) or is_lower(c) or is_number(c) or\n is_other(c) or is_reserved(c))",
"def IsAbs (t):\n return t[0] == 1",
"def isalpha(self) -> bool:\n pass",
"def isAcute(t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the body part of HTML files. | def get_body(html_file_content):
return findall("<body>(.*?)</body>", html_file_content, DOTALL)[0].decode("utf-8") | [
"def get_body_content(self):\n\n try:\n html_tree = parse_html_string(self.content)\n except:\n return ''\n\n html_root = html_tree.getroottree()\n\n if len(html_root.find('body')) != 0:\n body = html_tree.find('body')\n\n tree_str = etree.tost... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Correct the diagram links into the main content body. | def correct_img_links(body_main_content, schema_name, list_name_image):
for name_image in list_name_image:
body_main_content = body_main_content.replace(
"src=\"" + name_image + "\"",
"src=\"{% static \"schema_viewer/oxygen/" + schema_name + "/" + name_image + "\" %}\""
)
... | [
"def fixLinks():",
"def fix_links(self):\n\n # 1. Looping through Boxes\n for box in self.get_all_boxes():\n soup = BeautifulSoup(box.content, 'html5lib')\n soup.body.hidden = True\n\n for tag_name, tag_attribute in settings.FILE_LINKS_TAG_TO_FIX:\n se... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create the final HTML oxygen files, with the common header, a specific left menu and the main body. | def create_html_file(body_left_menu, body_main_content):
# Get the header fie and get it contents
path_header = path.join(
SITE_ROOT,
'schema_viewer',
'templates',
'schema_viewer',
'oxygen',
'header_oxygen_template.html'
)
file_header = open(path_header, ... | [
"def common_header_part2(outfile: TextIO, indexpath: str = \"\", include_map: bool = False) -> None:\n outfile.write(\" </head>\\n\")\n outfile.write(\"\\n\")\n if include_map:\n outfile.write(\" <body onload=\\\"initialize()\\\">\\n\")\n else:\n outfile.write(\" <body>\\n\")\n outfi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Delete the floating global control on the main content. | def del_global_control(body_main_content):
return sub("<div id=\"global_controls\" (.*?) </div>", "", body_main_content, flags=DOTALL) | [
"def DelDiv(self):\n if self.created:\n self.CloseImage()\n command = \"\"\"$('#{}').remove();\"\"\".format(self.wid)\n get_ipython().run_cell_magic('javascript', '', command)\n self.created = False\n self.wid = uuid.uuid4().hex",
"def delete_scroll_fi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
filters data that have at least $at_least $x unique values per $per | def filter_x_per_y(df, at_least, x, per):
return df.groupby(per, as_index=False, sort=False).filter(
lambda g: g[x].nunique() >= at_least
) | [
"def apply_uniques(self):\n if not np.all(self.data.unique() == self.unique_values):\n logger.info(\"Keeping only the following unique values:\")\n logger.info(json.dumps(self.unique_values, cls=TypeEncoder))\n for value in self.data.unique():\n if value not in... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Receives a DBSReader object and finds out whether it's pointing to Global DBS (no matter whether it's production or the preproduction instance). | def isGlobalDBS(dbs):
try:
url = urlparse(dbs.dbsURL)
if url.hostname.startswith('cmsweb'):
if url.path.startswith('/dbs/prod/global') or url.path.startswith('/dbs/int/global'):
return True
except Exception as ex:
logging.error("Failed to find out whether DBS ... | [
"def get_current_gisdbase():\n global current_gisdbase\n return current_gisdbase",
"def is_on_dbsnp(row):\n is_on_dbsnp = 1\n\n if row[\"dbsnp\"] == \"-\":\n is_on_dbsnp = 0\n\n return is_on_dbsnp",
"def getUseDB(self):\n\t\tuse_db\t\t= self.getEnvironmentVariable( name='USE_DB', default='... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get data location from dbs | def locationsFromDBS(self, dbs, dataItems):
result = defaultdict(set)
for dataItem in dataItems:
try:
if isDataset(dataItem):
phedexNodeNames = dbs.listDatasetLocation(dataItem)
else:
phedexNodeNames = dbs.listFileBlockL... | [
"def get_db_path(self):\n return (\n self.spark_session.sql(f\"DESCRIBE DATABASE EXTENDED {self.database_name}\")\n .filter(\"database_description_item=='Location'\")\n .collect()[0]\n .database_description_value\n )",
"def data_location(self):\n re... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sort items by dbs instances return dict with DBSReader as key & data items as values | def organiseByDbs(self, dataItems):
itemsByDbs = defaultdict(list)
for item in dataItems:
if ACDCBlock.checkBlockName(item['name']):
# if it is acdc block don't update location. location should be
# inserted when block is queued and not supposed to change
... | [
"def sortdb():\n return sorted(donor_db.items(), key=sumdbkey, reverse=True)",
"def sortdb():\n return sorted(donor_db, key=sumdbkey, reverse=True)",
"def get_instances_sorted(ctx, filters, limit, marker, columns_to_join,\n sort_keys, sort_dirs):\n\n if not sort_keys:\n #... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Hjorth's Complexity and Parameters Hjorth Parameters are indicators of statistical properties initially introduced by Hjorth (1970) to describe the general characteristics of an EEG trace in a few quantitative terms, but which can applied to any time series. The parameters are activity, mobility, and complexity. NeuroK... | def complexity_hjorth(signal):
# Sanity checks
if isinstance(signal, (np.ndarray, pd.DataFrame)) and signal.ndim > 1:
raise ValueError(
"Multidimensional inputs (e.g., matrices or multichannel data) are not supported yet."
)
# Calculate derivatives
dx = np.diff(signal)
d... | [
"def hjorthComplexity(data):\n return hjorthMobility(np.gradient(data)) / hjorthMobility(data)",
"def hjorthActivity(data):\n return np.var(data)",
"def hjorthMobility(data):\n return np.sqrt(np.var(np.gradient(data)) / np.var(data))",
"def hyperparams():\n H = 6\n return Munch(N=500, H=H, D=(H... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update the images that are displayed from the video stream. | def update(self):
# Update the vision frames in the system
self._system.update()
# Create blank PIL images to hold the video streams
layered = PIL.Image.new('RGBA', (400, 400))
stacked = PIL.Image.new('RGBA', (200, 800))
control = PIL.Image.new('RGBA', (600, 800... | [
"def update_camera_image(self):\n if self.vid.isOpened():\n (self.status, self.frame) = self.vid.read()\n self.img_pub.publish(self.bridge.cv2_to_imgmsg(self.frame, encoding=\"passthrough\"))",
"def update(self, frame = None):\n if type(frame) == type(None):\n frame ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update the vision choices when a new device is selected. | def updateDevice(self, *args):
# Update the list of vision choices and the default vision choice
self._appChoice["vision"] = [choice[0] for choice in self._system[self._appString["device"].get()]]
self._appString["vision"].set(self._appChoice["vision"][0])
# Delete the old choice... | [
"def updateVision(self, *args):\r\n\r\n # Update the list of frame choices and the default frame choice\r\n self._appChoice[\"frame\"] = [choice[0] for choice in self._system[self._appString[\"device\"].get()][self._appString[\"vision\"].get()]]\r\n self._appString[\"frame\"].set(self._appChoic... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update the frame choices whena new vision is selected. | def updateVision(self, *args):
# Update the list of frame choices and the default frame choice
self._appChoice["frame"] = [choice[0] for choice in self._system[self._appString["device"].get()][self._appString["vision"].get()]]
self._appString["frame"].set(self._appChoice["frame"][0])
... | [
"def slider_frames_changed(self):\n\n # Again, please note the difference between indexing and GUI displays.\n index = self.slider_frames.value() - 1\n\n # Differentiate between frame ordering (by quality or chronologically).\n if self.frame_ordering == \"quality\":\n self.fra... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a color palette compatible with Bokeh from a matplotlib cmap name. | def get_bokeh_palette(cmap):
from bokeh.colors import RGB
from matplotlib import cm
# Solution adapted from
# https://stackoverflow.com/questions/31883097/elegant-way-to-match-a-string-to-a-random-color-matplotlib
m_RGB = (255 * plt.get_cmap(cmap)(range(256))).astype("int")
return [RGB(*tuple(r... | [
"def palette_from_mpl_name(name):\n if name in CMAPS:\n return CMAPS[name]\n\n rgba = plt.get_cmap(name)(np.linspace(0, 1, 256))\n palette = [to_hex(color) for color in rgba]\n return palette",
"def palette(name_of_mpl_palette):\n from matplotlib.colors import rgb2hex\n import matplotlib.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
instead of return a cursor object, find_one() returns one document. so when you look up document by it's _id (_id field is always unique), use find_one() method. | def find_one():
fmter.tpl._straightline("one document", 100)
result = users.find_one({})
print(type(result))
ppt(result)
fmter.tpl._straightline("none result", 100)
result = users.find_one({"_id": 100})
print(type(result))
ppt(result) | [
"def get_one(conn,db_name,collection_name,object_id):\n\tres=conn[db_name][collection_name].find_one({\"_id\":ObjectId(object_id)})\n\tres[\"_id\"]=object_id\n\treturn res",
"def find_one(self, collection, query):\n obj = getattr(self.db, collection)\n result = obj.find_one(query)\n return re... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Fills out the model by invoking C{svnlook} | def _populateModel(self):
self.repoPath = self.argv[1]
self.rev = self.argv[2]
self.model.rev = self.rev
self.model.repo = os.path.split(self.repoPath)[-1]
self.prefix = (self.addRepoPrefix() and ('/' + self.model.repo)) or ''
# First, get the user and log message
... | [
"def update_model(self):\n pass # TODO: Implement this.",
"def build_model():",
"def findModels(make):\n\n pass",
"def test_update_saved_search(self):\n pass",
"def updateModel(self):\n pass",
"def loadAdjustedModel(self):\r\n # Load model in GUI\r\n addModel(self.tr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gera o codigo rml do cabecalho | def cabecalho(dic_cabecalho,dat_ordem,imagem):
tmp=''
tmp+='\t\t\t\t<image x="4.1cm" y="26.9cm" width="74" height="60" file="' + imagem + '"/>\n'
tmp+='\t\t\t\t<lines>3.3cm 26.3cm 19.5cm 26.3cm</lines>\n'
tmp+='\t\t\t\t<setFont name="Helvetica-Bold" size="15"/>\n'
tmp+='\t\t\t\t<drawString x="6.7cm... | [
"def cabecalho(dic_cabecalho,dat_reuniao,imagem):\n\n tmp=''\n tmp+='\\t\\t\\t\\t<image x=\"4.1cm\" y=\"26.9cm\" width=\"74\" height=\"60\" file=\"' + imagem + '\"/>\\n'\n tmp+='\\t\\t\\t\\t<lines>3.3cm 26.3cm 19.5cm 26.3cm</lines>\\n'\n tmp+='\\t\\t\\t\\t<setFont name=\"Helvetica-Bold\" size=\"15\"/>\\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Retreive a file from the file storage. | def storage_get_file(self, group='', key=''):
try:
obj = None
content = None
if key != '':
if self.config['type'] == 's3':
obj = self.s3.Object(bucket_name=self.bucket, key='corr-{0}s/{1}'.format(group,key))
res = obj.ge... | [
"def get(self, filename, **kw):\n\n file_path = os.path.join(self.storage_path, filename)\n try:\n file_obj = open(file_path, \"r\")\n except IOError:\n return\n else:\n return file_obj.read()",
"def get_file(self, path):\n file = self.get('data_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Agent function that prepares a dictionary for storage in a compressed files. | def agent_prepare(self, zf, group, object_dict):
object_buffer = StringIO()
object_buffer.write(json.dumps(object_dict, sort_keys=True, indent=4, separators=(',', ': ')))
object_buffer.seek(0)
data = zipfile.ZipInfo("{0}.json".format(group))
data.date_time = time.localtime(time.t... | [
"def _files_from_json(self, file_json):\n self.compressed_file_json = zlib.compress(json.dumps(file_json).encode('utf-8'))\n self.compression_algorithm = 'gzip'\n self.compressed_content_hash = hashlib.sha256(self.compressed_file_json).hexdigest()",
"def __init__(self):\n self.keyingMe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Delete a project files. | def delete_project_files(self, project, logStat):
from corrdb.common.models import FileModel
from corrdb.common.models import EnvironmentModel
for _file in project.resources:
file_ = FileModel.objects.with_id(_file)
if file_:
result = self.storage_delete_... | [
"def delete_project(proj_id):\n project_obj = Project.objects.get(id=proj_id)\n print('Deleting project the fastq files within the project: ', project_obj.description)\n\n description = project_obj.description.replace(' ', '') # remove any space in the project name\n project_dir = 'documents/%s/%s' % (... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Delete a record files. | def delete_record_files(self, record, logStat):
from corrdb.common.models import FileModel
final_result = True
for _file_id in record.resources:
_file = FileModel.objects.with_id(_file_id)
result = self.delete_record_file(_file, logStat)
if not result:
... | [
"def delete_record(records):\n delete_record()",
"def delete_record_file(self, record_file, logStat):\n result = self.storage_delete_file(record_file.group, record_file.storage)\n if result:\n logStat(deleted=True, file_obj=record_file)\n record_file.delete()\n return... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Delete a record file and log the stats. | def delete_record_file(self, record_file, logStat):
result = self.storage_delete_file(record_file.group, record_file.storage)
if result:
logStat(deleted=True, file_obj=record_file)
record_file.delete()
return result | [
"def delete_file(fileName):\n os.remove(fileName)\n print (\"Deleteing file: \" + str(fileName))\n write_log()\n read_log()",
"def delete_log():\n log_path = Path.cwd() / \"premise.log\"\n if log_path.exists():\n log_path.unlink()",
"def delete_file(self):\n targe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Retrieve a externaly hosted file. | def web_get_file(self, url):
try:
print(url)
response = requests.get(url, verify=False)
file_buffer = BytesIO(response.content)
file_buffer.seek(0)
return file_buffer
except:
print(traceback.print_exc())
return None | [
"def get_file(filename):\n return query.get_file(uri=util.path_to_uri(filename))",
"def get_file(self, path):\n file = self.get('data_request?id=file¶meters=%s' % path)\n return file",
"def get_file(self, path):\n return self.client._perform_raw(\"GET\", \"/plugins/%s/contents/%s\" %... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Bundle a project's environment. | def prepare_env(self, project=None, env=None):
if project == None or env == None:
return [None, '']
else:
memory_file = BytesIO()
with zipfile.ZipFile(memory_file, 'w') as zf:
if env.bundle != None and env.bundle.storage != '':
try:... | [
"def TOOL_BUNDLE(env):\n if 'BUNDLE' in env['TOOLS']: return\n if env['PLATFORM'] == 'darwin':\n TOOL_SUBST(env)\n # Common type codes are BNDL for generic bundle and APPL for application.\n def MakeBundle(env, bundledir, app,\n info_plist,\n typecode='BNDL',... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Obtain ORI, AGENCY, CGOVTYPE, FIPS_STATE, FIPS_PLACE from final main(9001) file | def get_final_main_cgovtype_ori_agency(file_path):
final_main_df = pd.read_csv(file_path)
final_main_fips_ori_agency = final_main_df[['ORI', 'AGENCY', 'CGOVTYPE', 'FIPS_STATE', 'FIPS_PLACE']]
"""
1. Obtain only unique records from the final main file - key: fips place + fips state
"""
final_mai... | [
"def ogip_dictionary_arf():\n \"\"\"\n this function returns the required and optional keywords and columns\n as defined by OGIP 92-002 and 92-002a\n \"\"\"\n global status\n global REPORT\n\n \"\"\"\n FOR the ARF file:\n \"\"\"\n \"\"\"\n Define REQUIRED Keywords for SPECRESP EXTE... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Merge CGOVTYPE, ORI, AGENCY from final main file into census files based on state and place fips. | def get_glevel_ori_agency(county_cens_file, crime_df, filename, cens_year, city_cens_file=False):
"""
1. Append cities census file to counties census file
"""
national_census_df = pd.read_csv(county_cens_file)
"""
Checking for city census file coz we need to first append city census file t... | [
"def get_final_main_cgovtype_ori_agency(file_path):\n final_main_df = pd.read_csv(file_path)\n final_main_fips_ori_agency = final_main_df[['ORI', 'AGENCY', 'CGOVTYPE', 'FIPS_STATE', 'FIPS_PLACE']]\n\n \"\"\"\n 1. Obtain only unique records from the final main file - key: fips place + fips state\n \"\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return a dictionary of a location's properties. | def to_dict(self):
return {
'location_id': self.location_id,
'location_name': self.location_name
} | [
"def to_dict(self):\n location_dict = {'location_id': self.location_id,\n 'title': self.title,\n 'address1': self.address1,\n 'address2': self.address2,\n 'city': self.city,\n 'zipcode': se... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Method used to sort the objects from low > highest of the currenthealth | def sort_currenthealth(cls):
CloudCtx.objCloudCtx.sort(key=lambda x: x.currenthealth)
for elem in CloudCtx.objCloudCtx:
print(elem.display_cloud_ctx()) | [
"def sort(self):\n self.red_bucket = (140, 0)\n self.green_bucket = (230, 0)\n self.blue_bucket = (-230, 0)\n self.rest();\n while len(self.vision_objects) > 0:\n obj = sorted(self.vision_objects, key=lambda x: x.cx)[0]\n x, y = getattr(self, '%s_bucket' % ob... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sequence init with other seq should preserve name and info. | def test_init_other_seq(self):
r = self.RNA("UCAGG", name="x", info={"z": 3})
s = Sequence(r)
self.assertEqual(s._seq, "UCAGG")
self.assertEqual(s.name, "x")
self.assertEqual(s.info.z, 3) | [
"def __init__(self, sequence) -> None:\n super().__init__()\n self.sequence = sequence",
"def __init__(self, *args, **kwargs):\n kwargs['suppress_named_seqs'] = True\n super(DenseAlignment, self).__init__(*args, **kwargs)\n self.ArrayPositions = transpose(\\\n self.Se... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |