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 |
|---|---|---|---|---|---|---|
Make a copy of this instance. Copies the local data stored as simple types and copies the client attached to this instance. | def copy(self):
new_client = self._client.copy()
return self.__class__(self.instance_id, new_client,
self._cluster_location_id,
display_name=self.display_name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy(self) -> \"WOQLClient\":\n return copy.deepcopy(self)",
"def copy(self):\n return self.__class__(self.items, self.is_cloud)",
"def copy(self):\n pass",
"def copy(self):\n pass",
"def copy(self):\n pass",
"def copy(self):\n from copy import deepcopy\n ... | [
"0.6870998",
"0.67256683",
"0.6523121",
"0.6523121",
"0.6523121",
"0.6512271",
"0.6481088",
"0.6477343",
"0.6454667",
"0.6447611",
"0.64095336",
"0.6341214",
"0.6341214",
"0.6341214",
"0.6341214",
"0.6341214",
"0.6341214",
"0.6341214",
"0.6341214",
"0.6341214",
"0.6341214",
... | 0.6868304 | 1 |
Crawl the IMDB top 250 movies, save CSV with their information. | def main():
# Create a directory to store copies of all the relevant HTML files (those
# will be used in testing).
print('Setting up backup dir if needed ...')
create_dir(BACKUP_DIR)
# Make backup of the IMDB top 250 movies page
print('Access top 250 page, making backup ...')
top_250_html ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_csv(outfile, movies):\n fieldnames = ['title', 'rating', 'year', 'actors', 'runtime']\n with open('movies.csv', 'w') as outfile:\n writer = csv.DictWriter(outfile, fieldnames=fieldnames)\n writer.writeheader()\n for line in movies:\n writer.writerow(line)\n\n\n # A... | [
"0.69534105",
"0.6842434",
"0.67165273",
"0.6698219",
"0.6382748",
"0.6283574",
"0.62063265",
"0.6099753",
"0.6017572",
"0.599738",
"0.59611505",
"0.5958461",
"0.59397745",
"0.59288883",
"0.5927518",
"0.5907681",
"0.5907066",
"0.58562887",
"0.5839268",
"0.5821602",
"0.5808227... | 0.68514156 | 1 |
Scrape the IMDB top 250 movies index page. | def scrape_top_250(soup):
# to save the urls
movie_urls = []
# take the part where all the movies are
content = soup.find("tbody", "lister-list").find_all("tr")
# for every movie take the absolute url
for title in content:
url = "http://www.imdb.com" + title.find("td", "titleColumn").a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_imdb_movies(max_movies: int):\n from imdb.database import index_movie_to_database\n movie_count = 0\n for url in crawl_imdb_listing_page(TOP_PAGE):\n if movie_count == max_movies:\n break\n movie_data = parse_movie_page(url)\n if index_movie_to_database(movie_data):... | [
"0.76122737",
"0.666392",
"0.66290194",
"0.65015304",
"0.6491648",
"0.64602834",
"0.6427198",
"0.6267651",
"0.625287",
"0.60673034",
"0.601147",
"0.6007559",
"0.59912735",
"0.5976503",
"0.5973458",
"0.5959234",
"0.59561735",
"0.59081995",
"0.5846302",
"0.5815787",
"0.57971823... | 0.73371065 | 1 |
Scrape the IMDB page for a single movie | def scrape_movie_page(dom):
# to save the information
info = []
# find the information block needed
header = dom.find("div", "title_wrapper")
# find the title and strip the string
name_dom = header.h1.get_text().encode("utf-8")
name = str(name_dom)[2:-16]
info.append(name)
# find ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def movie_spider(self, movieTag):\n index = 0\n logging.info(\"Start crawling tag: %s\" % movieTag)\n while index < self.MAX_NUM:\n root = \"https://movie.douban.com/tag/%s?start=%d&type=T\" % (movieTag, index)\n result = {}\n try:\n html = reque... | [
"0.7362223",
"0.71684545",
"0.71325827",
"0.6993874",
"0.6979878",
"0.69582427",
"0.6947582",
"0.6888327",
"0.6886808",
"0.6821694",
"0.6817886",
"0.67733526",
"0.67380553",
"0.6733104",
"0.6632344",
"0.6556607",
"0.643643",
"0.6433405",
"0.6427055",
"0.6404059",
"0.63820803"... | 0.71959716 | 1 |
takes the first genre as input and looks if there are more find_genres. | def find_genres(genre_dom, dom):
# take the first genre and turn it into a string
genre = str(genre_dom)[3:-1]
# see if there are more genres to a movie
next_genre = dom.find("div", itemprop="genre").a.find_next_sibling("a")
# add the new genres to the string
while(next_genre):
temp = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search_genres(self, needle):\n return self._genre_search.search(searchable(needle))",
"def _get_genres(self):\n separated = self.movies['genre'].apply(self.separate_genre)\n return {g: True for x in separated for g in x}.keys()",
"def chatbot_genre_query(self, genres: list): #-> cursor... | [
"0.660926",
"0.59218156",
"0.5887331",
"0.58336353",
"0.5639189",
"0.5631359",
"0.55921984",
"0.53470975",
"0.5322265",
"0.53138363",
"0.5299636",
"0.5262009",
"0.52536136",
"0.52508396",
"0.52483845",
"0.52240586",
"0.51974875",
"0.5196372",
"0.51822656",
"0.5175137",
"0.516... | 0.6475148 | 1 |
takes the first writer as input and looks if there are more find_genres. | def find_writers(writer_dom, dom):
# take the first writer and turn it into a string
writer = str(writer_dom)[2:-1]
# see if there are more writers
next_writer = dom.find("span", itemprop="creator").find_next_sibling("span",
itemprop="creator")
# add all the writers to t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search_genres(self, needle):\n return self._genre_search.search(searchable(needle))",
"def find_genres(genre_dom, dom):\n # take the first genre and turn it into a string\n genre = str(genre_dom)[3:-1]\n\n # see if there are more genres to a movie\n next_genre = dom.find(\"div\", itemprop=... | [
"0.6010571",
"0.5308337",
"0.5180943",
"0.5133908",
"0.50772184",
"0.49792778",
"0.4967971",
"0.49632066",
"0.49230486",
"0.49229807",
"0.48883152",
"0.48799068",
"0.48754558",
"0.48731622",
"0.47359285",
"0.4730448",
"0.47194862",
"0.46617717",
"0.46156126",
"0.46125743",
"0... | 0.5384775 | 1 |
Returns list of product "mask" type variable names | def getMaskVariableNames(self, product):
h = product.getSceneRasterHeight()
# 10m resolution
if h == 10980:
return self.return_available_variables(product, MASK_VARIABLE_NAMES_10m)
# 20m resolution
elif h == 5490:
return self.return_available_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getMaskVariableNames(self, product):\r\n return []",
"def getMaskVariables(self, product):\r\n mask_variable_names = self.getMaskVariableNames(product)\r\n mask_variables = [self.createMaskVariable(product, n) for n in mask_variable_names]\r\n mask_variables = [self.editMaskVariab... | [
"0.8208737",
"0.6958801",
"0.64847463",
"0.6349178",
"0.6011559",
"0.5973692",
"0.59298366",
"0.5911321",
"0.5737965",
"0.57031",
"0.5660973",
"0.564376",
"0.5616179",
"0.5612669",
"0.5611548",
"0.56073886",
"0.55775",
"0.55704635",
"0.556705",
"0.5525116",
"0.5524691",
"0.... | 0.6996702 | 1 |
Returns list of product "sensor" type variable names | def getSensorVariableNames(self, product):
return [] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getSensorVariableNames(self, product):\r\n return []",
"def getSensorVariables(self, product):\r\n sensor_variable_names = self.getSensorVariableNames(product)\r\n sensor_variables = [self.createSensorVariable(product, n) for n in sensor_variable_names]\r\n sensor_variables = [sel... | [
"0.8339771",
"0.7041706",
"0.6947138",
"0.69332373",
"0.69057155",
"0.68343633",
"0.682075",
"0.67683005",
"0.67416674",
"0.6687287",
"0.6636566",
"0.65286463",
"0.64218646",
"0.64184695",
"0.6377054",
"0.6244942",
"0.60869145",
"0.6007184",
"0.6000745",
"0.59992135",
"0.5956... | 0.83588517 | 0 |
Returns list of product "info" type variable names | def getInfoVariableNames(self, product):
h = product.getSceneRasterHeight()
# 10m resolution
if h == 10980:
return self.return_available_variables(product, INFO_VARIABLE_NAMES_10m)
# 20m resolution
elif h == 5490:
return self.return_available_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getInfoVariableNames(self, product):\r\n return []",
"def getInfoVariables(self, product):\r\n info_variable_names = self.getInfoVariableNames(product)\r\n info_variables = [self.createInfoVariable(product, n) for n in info_variable_names]\r\n info_variables = [self.editInfoVariab... | [
"0.8265886",
"0.7063334",
"0.6817584",
"0.66157585",
"0.6581945",
"0.65705514",
"0.65406626",
"0.65016574",
"0.6487752",
"0.6485825",
"0.6484793",
"0.645135",
"0.641339",
"0.63766634",
"0.61927",
"0.618237",
"0.61796445",
"0.6175805",
"0.61612755",
"0.6157979",
"0.6153227",
... | 0.715711 | 1 |
Test that the default manager is correct. | def test_default_manager(self):
self.assertIsInstance(FlatPage._default_manager, UrlNodeManager)
self.assertIsInstance(FlatPage.objects.all(), UrlNodeQuerySet) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_manager(self):\n manager = ISubscriptionManager(self.root.document, None)\n self.assertNotEqual(manager, None)\n self.assertTrue(verifyObject(ISubscriptionManager, manager),)\n\n manager = ISubscriptionManager(self.root, None)\n self.assertNotEqual(manager, None)\n ... | [
"0.71595335",
"0.70388806",
"0.66866904",
"0.64357024",
"0.6430612",
"0.64073193",
"0.63974637",
"0.6350312",
"0.63089633",
"0.6293002",
"0.62254477",
"0.61976516",
"0.61641526",
"0.61507624",
"0.61332285",
"0.61205125",
"0.6085805",
"0.6080796",
"0.6075874",
"0.603002",
"0.6... | 0.7431091 | 0 |
Creates the Turtle and the Screen with the map background and coordinate system set to match latitude and longitude. | def irma_setup():
import tkinter
turtle.setup(965, 600) # set size of window to size of map
wn = turtle.Screen()
wn.title("Hurricane Irma")
# kludge to get the map shown as a background image,
# since wn.bgpic does not allow you to position the image
canvas = wn.getcanvas()
turtl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def screen_setup(screen_size):\n window = turtle.Screen()\n window.bgcolor(\"black\")\n window.title(\"Maze Game\")\n window.setup(screen_size, screen_size)",
"def setup_screen():\n screen = Screen()\n screen.setup(width=600, height=600)\n screen.bgcolor(\"black\")\n screen.title(\"My Sna... | [
"0.6898329",
"0.6388394",
"0.6379641",
"0.6363494",
"0.6310737",
"0.62915754",
"0.6289173",
"0.62512696",
"0.62480205",
"0.6170483",
"0.6141268",
"0.61327434",
"0.60947466",
"0.6038608",
"0.6035277",
"0.6034598",
"0.6033603",
"0.602872",
"0.597623",
"0.592445",
"0.58940214",
... | 0.68916774 | 1 |
Create a cartonActivity Inserts a new cartonActivity using the specified data. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. | def add_carton_activity(self, body, **kwargs):
all_params = ['body']
all_params.append('callback')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argume... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_carton_activity_tag(self, carton_activity_id, carton_activity_tag, **kwargs):\n\n all_params = ['carton_activity_id', 'carton_activity_tag']\n all_params.append('callback')\n\n params = locals()\n for key, val in iteritems(params['kwargs']):\n if key not in all_params... | [
"0.65059453",
"0.5947981",
"0.5774275",
"0.5743377",
"0.5573552",
"0.5534408",
"0.5441946",
"0.5287218",
"0.5261877",
"0.5095724",
"0.49159083",
"0.48912296",
"0.48800573",
"0.4859543",
"0.48262998",
"0.48246723",
"0.4767928",
"0.46715868",
"0.465052",
"0.46045247",
"0.459696... | 0.6539719 | 0 |
Add new audit for a cartonActivity Adds an audit to an existing cartonActivity. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. | def add_carton_activity_audit(self, carton_activity_id, carton_activity_audit, **kwargs):
all_params = ['carton_activity_id', 'carton_activity_audit']
all_params.append('callback')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_carton_activity_tag(self, carton_activity_id, carton_activity_tag, **kwargs):\n\n all_params = ['carton_activity_id', 'carton_activity_tag']\n all_params.append('callback')\n\n params = locals()\n for key, val in iteritems(params['kwargs']):\n if key not in all_params... | [
"0.5893889",
"0.56795913",
"0.5599321",
"0.5464882",
"0.5209918",
"0.50052756",
"0.49850735",
"0.49730384",
"0.49699482",
"0.49107304",
"0.4882419",
"0.47739702",
"0.47686157",
"0.46770212",
"0.45531315",
"0.45512614",
"0.452703",
"0.45114335",
"0.44965294",
"0.44539297",
"0.... | 0.7834779 | 0 |
Add new tags for a cartonActivity. Adds a tag to an existing cartonActivity. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. | def add_carton_activity_tag(self, carton_activity_id, carton_activity_tag, **kwargs):
all_params = ['carton_activity_id', 'carton_activity_tag']
all_params.append('callback')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_carton_activity_tags(self, carton_activity_id, **kwargs):\n\n all_params = ['carton_activity_id']\n all_params.append('callback')\n\n params = locals()\n for key, val in iteritems(params['kwargs']):\n if key not in all_params:\n raise TypeError(\n ... | [
"0.6755179",
"0.5814125",
"0.56261075",
"0.5556964",
"0.54720086",
"0.5454889",
"0.5432447",
"0.5414081",
"0.5406628",
"0.5325057",
"0.5270936",
"0.5174351",
"0.5162913",
"0.5153116",
"0.5111313",
"0.5092139",
"0.50879234",
"0.5066982",
"0.50359213",
"0.5025138",
"0.5021132",... | 0.73234785 | 0 |
Delete a cartonActivity Deletes the cartonActivity identified by the specified id. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. | def delete_carton_activity(self, carton_activity_id, **kwargs):
all_params = ['carton_activity_id']
all_params.append('callback')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"G... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_carton_activity_tag(self, carton_activity_id, carton_activity_tag, **kwargs):\n\n all_params = ['carton_activity_id', 'carton_activity_tag']\n all_params.append('callback')\n\n params = locals()\n for key, val in iteritems(params['kwargs']):\n if key not in all_par... | [
"0.68737936",
"0.57801306",
"0.5770761",
"0.5651873",
"0.5592482",
"0.54830134",
"0.5461021",
"0.54573774",
"0.53889877",
"0.5284232",
"0.52449757",
"0.5211619",
"0.5211619",
"0.51212776",
"0.5116634",
"0.5096319",
"0.50580716",
"0.5016581",
"0.49912858",
"0.49603426",
"0.495... | 0.80336636 | 0 |
Delete a tag for a cartonActivity. Deletes an existing cartonActivity tag using the specified data. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. | def delete_carton_activity_tag(self, carton_activity_id, carton_activity_tag, **kwargs):
all_params = ['carton_activity_id', 'carton_activity_tag']
all_params.append('callback')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_carton_activity(self, carton_activity_id, **kwargs):\n\n all_params = ['carton_activity_id']\n all_params.append('callback')\n\n params = locals()\n for key, val in iteritems(params['kwargs']):\n if key not in all_params:\n raise TypeError(\n ... | [
"0.65332395",
"0.62648904",
"0.6206653",
"0.60998005",
"0.60190386",
"0.5695426",
"0.5627239",
"0.5621899",
"0.55221844",
"0.53584176",
"0.53337467",
"0.5285021",
"0.52439374",
"0.5210847",
"0.5196048",
"0.5188383",
"0.5146715",
"0.50971574",
"0.50823796",
"0.50794446",
"0.50... | 0.7673404 | 0 |
Search cartonActivitys by filter Returns the list of cartonActivitys that match the given filter. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. | def get_carton_activity_by_filter(self, **kwargs):
all_params = ['filter', 'page', 'limit', 'sort']
all_params.append('callback')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"G... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_carton_activity_by_id(self, carton_activity_id, **kwargs):\n\n all_params = ['carton_activity_id']\n all_params.append('callback')\n\n params = locals()\n for key, val in iteritems(params['kwargs']):\n if key not in all_params:\n raise TypeError(\n ... | [
"0.53114",
"0.5290665",
"0.5160244",
"0.51501334",
"0.5136461",
"0.5019022",
"0.50118244",
"0.4994216",
"0.49656084",
"0.49583882",
"0.49430656",
"0.48703286",
"0.48623845",
"0.48623845",
"0.48623845",
"0.48623845",
"0.48564547",
"0.485406",
"0.4849172",
"0.48109105",
"0.4800... | 0.75492764 | 0 |
Get a cartonActivity by id Returns the cartonActivity identified by the specified id. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. | def get_carton_activity_by_id(self, carton_activity_id, **kwargs):
all_params = ['carton_activity_id']
all_params.append('callback')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_duplicate_carton_activity_by_id(self, carton_activity_id, **kwargs):\n\n all_params = ['carton_activity_id']\n all_params.append('callback')\n\n params = locals()\n for key, val in iteritems(params['kwargs']):\n if key not in all_params:\n raise TypeErr... | [
"0.6449085",
"0.6341287",
"0.63101023",
"0.5809725",
"0.5605849",
"0.559797",
"0.5246748",
"0.5207538",
"0.52007586",
"0.51091886",
"0.50567985",
"0.50264806",
"0.50061727",
"0.49880445",
"0.49682713",
"0.49606812",
"0.4948862",
"0.48991984",
"0.48133543",
"0.47327924",
"0.47... | 0.7842999 | 0 |
Get the tags for a cartonActivity. Get all existing cartonActivity tags. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. | def get_carton_activity_tags(self, carton_activity_id, **kwargs):
all_params = ['carton_activity_id']
all_params.append('callback')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_tags(self, session):\n result = self._tag(session.get, session=session)\n return result['tags']",
"def get_tags(self, *args, **kwargs):\n \n tags_data = api.get_tags(\n *args,\n api_key=self.__creds.api_key_v2,\n **kwargs)\n return [en.... | [
"0.5847432",
"0.58260983",
"0.5702042",
"0.56724346",
"0.5530561",
"0.5507581",
"0.5481185",
"0.54222554",
"0.5383679",
"0.5249438",
"0.5207172",
"0.51760936",
"0.5166908",
"0.51572615",
"0.51572615",
"0.51154923",
"0.50972337",
"0.508396",
"0.5074662",
"0.5072342",
"0.505157... | 0.7763086 | 0 |
Get a duplicated a cartonActivity by id Returns a duplicated cartonActivity identified by the specified id. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. | def get_duplicate_carton_activity_by_id(self, carton_activity_id, **kwargs):
all_params = ['carton_activity_id']
all_params.append('callback')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_carton_activity_by_id(self, carton_activity_id, **kwargs):\n\n all_params = ['carton_activity_id']\n all_params.append('callback')\n\n params = locals()\n for key, val in iteritems(params['kwargs']):\n if key not in all_params:\n raise TypeError(\n ... | [
"0.68601924",
"0.59325856",
"0.57145596",
"0.5497775",
"0.5472108",
"0.54584974",
"0.5320074",
"0.5269935",
"0.50570655",
"0.48682854",
"0.48382714",
"0.47813615",
"0.47610122",
"0.47371498",
"0.47237444",
"0.4635629",
"0.45927307",
"0.45755008",
"0.45652983",
"0.45400804",
"... | 0.8400414 | 0 |
Update a cartonActivity Updates an existing cartonActivity using the specified data. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. | def update_carton_activity(self, body, **kwargs):
all_params = ['body']
all_params.append('callback')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword arg... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_carton_activity(self, carton_activity_id, **kwargs):\n\n all_params = ['carton_activity_id']\n all_params.append('callback')\n\n params = locals()\n for key, val in iteritems(params['kwargs']):\n if key not in all_params:\n raise TypeError(\n ... | [
"0.5470711",
"0.53928757",
"0.536302",
"0.51352435",
"0.4850845",
"0.4835823",
"0.4745151",
"0.47427103",
"0.4730338",
"0.470771",
"0.46928594",
"0.46521118",
"0.4649748",
"0.4622234",
"0.45755666",
"0.45750722",
"0.4569502",
"0.45484254",
"0.45429483",
"0.4441744",
"0.444113... | 0.64768636 | 0 |
Checks whether or not a player can take on the input color. | def validPlayerColor(color):
if color not in (RED, GREEN, BLUE, YELLOW):
return False
else:
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def color_in_check(self, mycolor):\n\n opponent = self.__players[self.get_opponent_color(mycolor)]\n\n x, y = None, None\n for (u, v) in self.__players[mycolor]:\n piece = self.get_piece(u, v)\n if not piece:\n raise ValueError()\n\n if self.get_... | [
"0.7221195",
"0.71365774",
"0.713204",
"0.7071138",
"0.702432",
"0.693353",
"0.6682949",
"0.6586236",
"0.6583911",
"0.6565734",
"0.6541181",
"0.6510639",
"0.6480027",
"0.6437859",
"0.6409153",
"0.63930285",
"0.639012",
"0.63468397",
"0.62909555",
"0.6262261",
"0.6245493",
"... | 0.8037171 | 0 |
Check whether or not the input color is a valid color (including EMPTY). | def validColor(color):
if color not in (RED, GREEN, BLUE, YELLOW, EMPTY):
return False
else:
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_is_valid_color(self):\n self.assertTrue(is_valid_color('black'))\n self.assertTrue(is_valid_color('#aabb11'))\n self.assertTrue(is_valid_color('rgba(23,45,67, .5)'))\n self.assertFalse(is_valid_color('bl(ack'))",
"def _is_color_valid(self, color):\n # make sure it is a... | [
"0.7934704",
"0.7657638",
"0.7578412",
"0.74673444",
"0.7333226",
"0.71767724",
"0.7126696",
"0.7092184",
"0.7017223",
"0.7006884",
"0.69969285",
"0.69682324",
"0.68484133",
"0.6763875",
"0.67374766",
"0.6728577",
"0.6533575",
"0.65154064",
"0.64646447",
"0.6460852",
"0.64551... | 0.827423 | 0 |
Get the string corresponding to a color. | def getColorString(color):
if type(color) is not int:
raise TypeError("The input to getColorString is not of type int.")
if color in COLOR_STRINGS:
return COLOR_STRINGS[color]
else:
raise ValueError("Input color not found.") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_colorstring(color) -> str:\n return f\"#{int(color[0]*255):02x}{int(color[1]*255):02x}{int(color[2]*255):02x}\"",
"def get_color(self) -> str:\r\n return self.color",
"def get_color(self) -> str:\n return self.color",
"def _colorstr(self, color):\n if len(color) == 1:\n ... | [
"0.83270156",
"0.77107364",
"0.75636035",
"0.7493946",
"0.74208045",
"0.7393732",
"0.7268761",
"0.7196634",
"0.71570015",
"0.71258074",
"0.7123171",
"0.7118092",
"0.7080076",
"0.7004553",
"0.6993604",
"0.69608295",
"0.6912071",
"0.6907833",
"0.6881702",
"0.68744445",
"0.68460... | 0.8094415 | 1 |
The concatenation uses AnnData.concatenate(), here we test the concatenation result on region, region_key, instance_key | def test_concatenate_tables():
table0 = _get_table(region="shapes/circles", instance_key="instance_id")
table1 = _get_table(region="shapes/poly", instance_key="instance_id")
table2 = _get_table(region="shapes/poly2", instance_key="instance_id")
with pytest.raises(ValueError):
_concatenate_tables... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def concatenate_data():",
"def test_concat_data(self):\n\n this_satellite_dict = satellite_io.concat_data(\n satellite_dicts=[\n SATELLITE_DICT_SUBSET_BY_INDEX, SATELLITE_DICT_SUBSET_BY_TIME\n ]\n )\n\n self.assertTrue(compare_satellite_dicts(\n ... | [
"0.63169724",
"0.55213654",
"0.52088755",
"0.51720846",
"0.5145792",
"0.49678332",
"0.49579075",
"0.48907503",
"0.48401648",
"0.47977793",
"0.47825605",
"0.4763224",
"0.47080132",
"0.46887326",
"0.4682378",
"0.4668646",
"0.46574107",
"0.46545583",
"0.4639255",
"0.46378735",
"... | 0.5730689 | 1 |
surface plot of the temperature in the whole room | def plotWholeRoom(mesh):
fig = plt.figure()
ax = fig.gca(projection='3d')
X = np.arange(0, mesh.xLength+mesh.meshsize, mesh.meshsize)
Y = np.arange(0, mesh.yLength+mesh.meshsize, mesh.meshsize)
X, Y = np.meshgrid(X,Y)
numberOfXNodes = mesh.x_res#round(mesh.xLength/mesh.meshsize)+1
num... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_surface(self):\n X, Y = np.meshgrid(self.x, self.y)\n fig = plt.figure()\n ax = fig.add_subplot(111, projection='3d')\n ax.plot_surface(X=X, Y=Y, Z=self.z)\n plt.show()",
"def imshow_surface(self):\n plt.imshow(self.z)\n plt.colorbar()\n plt.show()... | [
"0.7008557",
"0.6671473",
"0.657766",
"0.65188175",
"0.64394766",
"0.62508905",
"0.6203389",
"0.6193158",
"0.6164005",
"0.61388636",
"0.61340743",
"0.6104772",
"0.60910434",
"0.60061425",
"0.6003217",
"0.5999266",
"0.5967324",
"0.59593225",
"0.5940153",
"0.59139824",
"0.59097... | 0.68719196 | 1 |
Reads API private key stored at keyPath. | def readKey(self, keyPath):
try: | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_private_key():\n if not os.path.exists(_private_key_path):\n return None\n\n try:\n with open(_private_key_path) as secret_file:\n return secret_file.read()\n\n except Exception as exc:\n log.error(f'Could not read private key.\\n{exc}')\n traceback.print_exc... | [
"0.72051257",
"0.70617217",
"0.69600236",
"0.6915302",
"0.668007",
"0.66768414",
"0.6642561",
"0.6624825",
"0.6615483",
"0.6496666",
"0.64925957",
"0.6490158",
"0.6469417",
"0.6446457",
"0.6441216",
"0.64364284",
"0.64151865",
"0.6385343",
"0.6289841",
"0.62765306",
"0.626847... | 0.7792327 | 0 |
Robust way to access `obj.__orig_class__`. Compared to a direct access this has the | def get_orig_class(obj, default_to__class__=False):
try:
# See https://github.com/Stewori/pytypes/pull/53:
# Returns `obj.__orig_class__` protecting from infinite recursion in `__getattr[ibute]__`
# wrapped in a `checker_tp`.
# (See `checker_tp` in `typechecker._typeinspect_fun... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_orig_class(obj, default_to__class__=False):\n try:\n # See https://github.com/Stewori/pytypes/pull/53:\n # Returns `obj.__orig_class__` protecting from infinite recursion in `__getattr[ibute]__`\n # wrapped in a `checker_tp`.\n # (See `checker_tp` in `typechecker._typeinspec... | [
"0.76980686",
"0.6622713",
"0.662021",
"0.662021",
"0.662021",
"0.6512145",
"0.63538855",
"0.6307841",
"0.62945986",
"0.6189339",
"0.6158842",
"0.6116041",
"0.60950243",
"0.60413843",
"0.60330874",
"0.6005985",
"0.60026515",
"0.5988169",
"0.59284616",
"0.5886291",
"0.5862983"... | 0.7655947 | 1 |
Returns the requested campaign bid modifier in full detail. | def GetCampaignBidModifier(self, request, context):
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getBid(self):\r\n\t\treturn self.data['bid']",
"def _bidding_function(self):\n return self._bid_value",
"def getModifier(self, *args):\n return _libsbml.Reaction_getModifier(self, *args)",
"def get_adcreative(self, creative_id, fields, batch=False):\n path = '%s' % creative_id\n ... | [
"0.64405745",
"0.5491782",
"0.5352912",
"0.53522617",
"0.53101903",
"0.5145897",
"0.5034038",
"0.5004115",
"0.5001304",
"0.49945304",
"0.4993839",
"0.4987359",
"0.49709523",
"0.49398753",
"0.4900452",
"0.488487",
"0.4844014",
"0.48204824",
"0.4778102",
"0.47757906",
"0.477011... | 0.6848136 | 0 |
Creates, updates, or removes campaign bid modifiers. Operation statuses are returned. | def MutateCampaignBidModifiers(self, request, context):
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetCampaignBidModifier(self, request, context):\n context.set_code(grpc.StatusCode.UNIMPLEMENTED)\n context.set_details('Method not implemented!')\n raise NotImplementedError('Method not implemented!')",
"def MutateCampaignBudgets(self, request, context):\n context.set_code(grpc.S... | [
"0.6355806",
"0.54915804",
"0.5289272",
"0.50759953",
"0.4918394",
"0.49026936",
"0.48864666",
"0.4789297",
"0.47348252",
"0.46732575",
"0.45410955",
"0.45076388",
"0.4457251",
"0.44238174",
"0.44031692",
"0.43514192",
"0.43435964",
"0.43363217",
"0.432393",
"0.43129963",
"0.... | 0.6816361 | 0 |
Finds all the unique integers that correspond to a change in class. | def __find_integers_with_class_change(self, sorted_data):
potential_integer_splits = []
for row in range(sorted_data.shape[0] - 1):
if sorted_data[row, 1] != sorted_data[row + 1, 1]:
potential_integer_splits.append(sorted_data[row + 1, 0])
# return only the unique in... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def findIndices(g):\r\n change = [0]\r\n seen = [g[0]]\r\n for i in range(1, len(g)):\r\n if not g[i] in seen:\r\n change.append(i)\r\n seen.append(g[i])\r\n return change",
"def remove_duplicates(numbers: List[int]) -> List[int]:\n#[SOLUTION]\n import collections\n ... | [
"0.5589745",
"0.5522386",
"0.55177635",
"0.54917526",
"0.5476852",
"0.53103954",
"0.5294811",
"0.52648157",
"0.52156276",
"0.519498",
"0.5180705",
"0.5176299",
"0.5175594",
"0.51660055",
"0.51583177",
"0.5150952",
"0.51428884",
"0.5121026",
"0.51114494",
"0.51038694",
"0.5096... | 0.76339954 | 0 |
Calculates each of the information gains for a list of integer splits with the given sorted feature and class data. | def __info_gain_from_splits(self, potential_integer_splits, sorted_data):
info_gains = []
for split in map(int, potential_integer_splits):
left_child = sorted_data[sorted_data[:, 0].astype(int) < split, :]
right_child = sorted_data[sorted_data[:, 0].astype(int) >= split, :]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_split(data):\n \"\"\" gets the best feature, and best value \"\"\"\n\n best_feature = None\n best_value = 0.0\n columns = data.columns\n gini_base = gini_impurity(data)\n n_rows = len(data.index) # total number of rows of data before split\n\n # Fininding which split yie... | [
"0.66188765",
"0.62608063",
"0.6256927",
"0.62233657",
"0.6083229",
"0.59658355",
"0.5856173",
"0.58538896",
"0.5840882",
"0.57807654",
"0.5772018",
"0.5771111",
"0.5770281",
"0.5768238",
"0.5764604",
"0.5764604",
"0.57252175",
"0.56902254",
"0.5675291",
"0.5666471",
"0.56187... | 0.69695956 | 0 |
Calculates the information gain given a parent and its two children (after a specific split). | def __calc_info_gain(self, parent, left_child, right_child):
parent_entropy = self.__entropy(parent[:, -1])
num_rows_left = left_child.shape[0]
num_rows_right = right_child.shape[0]
num_rows_total = num_rows_left + num_rows_right
# don't calculate if any of the children rows ar... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calc_information_gain(data, split_name, target_name):\n # Calculate the original entropy\n original_entropy = calc_entropy(data[target_name])\n \n # Find the median of the column we're splitting\n column = data[split_name]\n median = column.median()\n \n # Make two subsets of the data, ... | [
"0.6516687",
"0.65080124",
"0.63141376",
"0.60892826",
"0.58556247",
"0.568292",
"0.56074995",
"0.55897933",
"0.55755717",
"0.5476209",
"0.53574795",
"0.5254822",
"0.520783",
"0.51747257",
"0.5096569",
"0.5088244",
"0.50874364",
"0.5062651",
"0.5010227",
"0.500158",
"0.498423... | 0.74386626 | 0 |
Prunes a node if doing so increases the validation accuracy. | def __prune_node(self, accuracy, node, validation_data):
classes = np.unique(node.labels)
class_counts = np.unique(node.labels, return_counts=True)[1]
node.predicted_class = classes[np.argmax(class_counts)]
node.is_leaf = True
x_validation = validation_data.features
y_va... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __prune_tree(self, accuracy, node, validation_data, depth):\n\n if node.is_leaf:\n return accuracy\n\n if node.depth == depth:\n if node.left_child.is_leaf and node.right_child.is_leaf:\n accuracy = self.__prune_node(accuracy, node, validation_data)\n ... | [
"0.679676",
"0.66037804",
"0.6426782",
"0.6208207",
"0.6121172",
"0.59960705",
"0.5981017",
"0.59379864",
"0.57365125",
"0.563774",
"0.5563799",
"0.55594593",
"0.5546524",
"0.5513652",
"0.5510996",
"0.5478574",
"0.543666",
"0.54011655",
"0.5294919",
"0.5273336",
"0.52240556",... | 0.7665027 | 0 |
Recursively goes down a tree until the node depth matches the input depth. If the node's children are leaves, it checks whether it's optimal to prune the node. | def __prune_tree(self, accuracy, node, validation_data, depth):
if node.is_leaf:
return accuracy
if node.depth == depth:
if node.left_child.is_leaf and node.right_child.is_leaf:
accuracy = self.__prune_node(accuracy, node, validation_data)
return... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prune(self, rng, get_nodes, max_depth=1):\n if not self.children:\n return\n for i_c, child in enumerate(self.children):\n if child.min_depth >= max_depth:\n self.children[i_c] = Node(\n rng.choice(get_nodes(arity=0)),\n s... | [
"0.6360459",
"0.604336",
"0.5938862",
"0.58943194",
"0.5823375",
"0.5788803",
"0.57416785",
"0.5709899",
"0.5696002",
"0.5655448",
"0.56483674",
"0.56330293",
"0.5631921",
"0.563008",
"0.5626417",
"0.56150573",
"0.56009525",
"0.55969006",
"0.55513614",
"0.5547976",
"0.5540269... | 0.64476705 | 0 |
Add an expression for the given binary address. | def add_expression(binary_addr, s):
assert not isinstance(s, labelmanager.Label) # TODO!?
# TODO: Warn/assert if addr already in expressions? Allow overriding this via an optional bool argument?
if binary_addr not in expressions:
expressions[binary_addr] = s | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_op(self, expr):\n from cascada.bitvector import operation\n assert isinstance(expr, operation.Operation)\n assert not self.contain_op(expr)\n name = \"{}{}\".format(self.id_prefix, self.counter)\n self.counter += 1\n identifier = core.Variable(name, expr.width)\n ... | [
"0.64002496",
"0.62857234",
"0.62688",
"0.605564",
"0.5965186",
"0.59127086",
"0.5830413",
"0.57543206",
"0.56582236",
"0.55917954",
"0.5561406",
"0.54797566",
"0.54700917",
"0.54415226",
"0.5429673",
"0.54226315",
"0.5420622",
"0.54032975",
"0.53921527",
"0.5365806",
"0.5355... | 0.81047773 | 0 |
Get the previously supplied expression for the given address. | def get_expression(binary_addr, expected_value):
expression = expressions[binary_addr]
utils.check_expr(expression, expected_value)
return expression | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eval_take_address(self, expr):\n if isinstance(expr, expressions.VariableAccess):\n declaration = expr.variable.declaration\n if isinstance(\n declaration,\n (\n declarations.VariableDeclaration,\n declarations.Par... | [
"0.6682179",
"0.6228155",
"0.62082",
"0.61590976",
"0.5866463",
"0.58355653",
"0.5672677",
"0.5643076",
"0.56316537",
"0.5614684",
"0.5610915",
"0.56038564",
"0.55660117",
"0.5565124",
"0.5557098",
"0.5557098",
"0.5557098",
"0.5524335",
"0.55141246",
"0.5494056",
"0.54875547"... | 0.7468352 | 0 |
Get a string representing the 8 bit constant at binary_addr. This could return the name of a constant, an expression or failing that just a constant hex value. Used by CPU Opcodes to format output, e.g. for converting 'LDA 3' into 'LDA num_lives' | def get_constant8(binary_addr):
if binary_addr in expressions:
return get_expression(binary_addr, memory_binary[binary_addr])
return mainformatter.constant8(binary_addr) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_address8(binary_addr):\n\n operand = memory_binary[binary_addr]\n if binary_addr not in expressions:\n return disassembly.get_label(operand, binary_addr)\n return get_expression(binary_addr, operand)",
"def get_constant16(binary_addr):\n\n if binary_addr in expressions:\n return... | [
"0.67110384",
"0.63497406",
"0.6013744",
"0.59776306",
"0.5975686",
"0.5903683",
"0.57989484",
"0.5765043",
"0.5677991",
"0.559972",
"0.5513182",
"0.5490668",
"0.5480578",
"0.54773694",
"0.54433036",
"0.54310673",
"0.5414964",
"0.53971416",
"0.53705996",
"0.5370063",
"0.53668... | 0.7693498 | 0 |
Get a string representing the 16 bit constant at binary_addr. This could return the name of a constant, an expression or failing that just a constant hex value. Used by CPU Opcodes to format output, e.g. for converting 'LXI BC,$1234' into 'LXI BC,my_special_constant'. | def get_constant16(binary_addr):
if binary_addr in expressions:
return get_expression(binary_addr, memorymanager.get_u16_binary(binary_addr))
return mainformatter.constant16(binary_addr) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_address16(binary_addr):\n\n operand = memorymanager.get_u16_binary(binary_addr)\n if binary_addr not in expressions:\n return disassembly.get_label(operand, binary_addr)\n\n assert isinstance(disassembly.get_classification(binary_addr), Word) or (isinstance(disassembly.get_classification(bi... | [
"0.62325543",
"0.6061215",
"0.5533641",
"0.5410458",
"0.5308353",
"0.51860064",
"0.5170984",
"0.51191694",
"0.510812",
"0.51072353",
"0.49929827",
"0.4976014",
"0.49712458",
"0.49693966",
"0.49671468",
"0.49650222",
"0.4961762",
"0.49451163",
"0.4941017",
"0.49307668",
"0.492... | 0.7581733 | 0 |
Get a string representing the 8 bit address at binary_addr. This could return a label name, an expression or failing that just a constant hex address. Used by CPU Opcodes to format output, e.g. for converting 'LDA $12' into 'LDA num_lives'. | def get_address8(binary_addr):
operand = memory_binary[binary_addr]
if binary_addr not in expressions:
return disassembly.get_label(operand, binary_addr)
return get_expression(binary_addr, operand) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_address_binary(address):\n\n if is_valid_ipv4_address(address):\n return ''.join([_get_binary(int(octet), 8) for octet in address.split('.')])\n elif is_valid_ipv6_address(address):\n address = expand_ipv6_address(address)\n return ''.join([_get_binary(int(grouping, 16), 16) for grouping in add... | [
"0.6732723",
"0.6528365",
"0.6506534",
"0.6489246",
"0.6433877",
"0.6411833",
"0.63180417",
"0.62149584",
"0.618123",
"0.6051444",
"0.6042936",
"0.59640974",
"0.5957376",
"0.59408915",
"0.5895213",
"0.5891723",
"0.58413285",
"0.5822231",
"0.5796226",
"0.57706934",
"0.57389814... | 0.7582911 | 0 |
Get a string representing the 16 bit address at binary_addr. This could return a label name, an expression or failing that just a constant hex address. Used by CPU Opcodes to format output, e.g. for converting 'JSR $1234' into 'JSR my_label'. | def get_address16(binary_addr):
operand = memorymanager.get_u16_binary(binary_addr)
if binary_addr not in expressions:
return disassembly.get_label(operand, binary_addr)
assert isinstance(disassembly.get_classification(binary_addr), Word) or (isinstance(disassembly.get_classification(binary_addr -... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_constant16(binary_addr):\n\n if binary_addr in expressions:\n return get_expression(binary_addr, memorymanager.get_u16_binary(binary_addr))\n return mainformatter.constant16(binary_addr)",
"def bt_addr_to_str(bt_addr):\n return \":\".join([b.encode(\"hex\") for b in bt_addr])",
"def __i... | [
"0.67523515",
"0.65508014",
"0.611563",
"0.61117715",
"0.6098377",
"0.60977286",
"0.6076913",
"0.60072947",
"0.5978159",
"0.58664674",
"0.58170366",
"0.57972336",
"0.57046545",
"0.56946206",
"0.56206506",
"0.5608305",
"0.5533078",
"0.55327",
"0.5509495",
"0.5507779",
"0.55056... | 0.7478014 | 0 |
Classifies part of the binary as a string followed by a given terminator byte. Returns the next available memory address after the string. | def stringterm(runtime_addr, terminator, exclude_terminator=False):
runtime_addr = memorymanager.RuntimeAddr(runtime_addr)
binary_addr, _ = movemanager.r2b_checked(runtime_addr)
initial_addr = binary_addr
while memory_binary[binary_addr] != terminator:
binary_addr += 1
string_length = (bina... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stringhiz(runtime_addr, include_terminator_fn=None):\n\n runtime_addr = memorymanager.RuntimeAddr(runtime_addr)\n binary_addr, _ = movemanager.r2b_checked(runtime_addr)\n assert not disassembly.is_classified(binary_addr, 1)\n initial_addr = binary_addr\n while True:\n if disassembly.is_cl... | [
"0.5908737",
"0.5769606",
"0.5666709",
"0.566427",
"0.5659553",
"0.5444973",
"0.53724027",
"0.5353021",
"0.5340873",
"0.53317374",
"0.5320064",
"0.53055394",
"0.5225632",
"0.5193464",
"0.5171954",
"0.5166538",
"0.5161003",
"0.5111299",
"0.5103323",
"0.50885046",
"0.503426",
... | 0.693786 | 0 |
Classifies part of the binary as a string followed by ASCII 13. Returns the next available memory address after the string. | def stringcr(runtime_addr, exclude_terminator=False):
runtime_addr = memorymanager.RuntimeAddr(runtime_addr)
return stringterm(runtime_addr, 13, exclude_terminator) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def autostring(min_length=3):\n\n assert min_length >= 2\n addr = memorymanager.BinaryAddr(0)\n while addr < len(memory_binary):\n i = 0\n while (addr + i) < len(memory_binary) and memory_binary[addr + i] is not None and not disassembly.is_classified(addr + i, 1) and utils.isprint(memory_bin... | [
"0.60261166",
"0.5575427",
"0.55525887",
"0.5451665",
"0.5430152",
"0.5402106",
"0.537459",
"0.53555804",
"0.53287554",
"0.53241026",
"0.5264728",
"0.5187579",
"0.51730996",
"0.51520854",
"0.5141504",
"0.5126803",
"0.5119388",
"0.50915444",
"0.50793564",
"0.50766116",
"0.5050... | 0.5639703 | 1 |
Classifies a part of the binary as a string with the first byte giving the length. Returns the next available memory address after the string. | def stringn(runtime_addr):
runtime_addr = memorymanager.RuntimeAddr(runtime_addr)
binary_addr, _ = movemanager.r2b_checked(runtime_addr)
disassembly.add_classification(binary_addr, Byte(1))
length = memory_binary[binary_addr]
add_expression(binary_addr, utils.LazyString("%s - %s", disassembly.get_l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def autostring(min_length=3):\n\n assert min_length >= 2\n addr = memorymanager.BinaryAddr(0)\n while addr < len(memory_binary):\n i = 0\n while (addr + i) < len(memory_binary) and memory_binary[addr + i] is not None and not disassembly.is_classified(addr + i, 1) and utils.isprint(memory_bin... | [
"0.71907574",
"0.60568094",
"0.60319275",
"0.60304165",
"0.5983436",
"0.5930473",
"0.59154713",
"0.56741375",
"0.5656219",
"0.56132877",
"0.5602844",
"0.5600993",
"0.5566914",
"0.5478548",
"0.5426606",
"0.5397106",
"0.53721356",
"0.53622264",
"0.5342458",
"0.53340405",
"0.527... | 0.62302107 | 1 |
Do a simple SECINFO_NO_NAME send PUTROOTFH+SECINFO_NO_NAME, check is result legal | def testSupported(t, env):
c = env.c1.new_client(env.testname(t))
sess = c.create_session()
# Do a simple SECINFO_NO_NAME
res = sess.compound([op.putrootfh(), op.secinfo_no_name(0)])
check(res) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_cleans_peer_name(self):\n ps1_status = self.pybird.get_peer_status(\"PS1{\\\"'}\")\n self.assertFalse(ps1_status['up'])",
"def testSupported2(t, env):\n c = env.c1.new_client(env.testname(t))\n sess = c.create_session()\n\n # GETFH after do a SECINFO_NO_NAME should get error NFS4E... | [
"0.5770228",
"0.57652646",
"0.56357694",
"0.5508631",
"0.5416629",
"0.5194066",
"0.5136464",
"0.50815845",
"0.5057677",
"0.49920005",
"0.49905288",
"0.4957912",
"0.4951877",
"0.49414647",
"0.4929611",
"0.4901294",
"0.4896876",
"0.4892041",
"0.48907965",
"0.48583683",
"0.48363... | 0.65952736 | 0 |
GETFH after do a SECINFO_NO_NAME or SECINFO result in a NOFILEHANDLE error, See rfc 5661 section 2.6.3.1.1.8 | def testSupported2(t, env):
c = env.c1.new_client(env.testname(t))
sess = c.create_session()
# GETFH after do a SECINFO_NO_NAME should get error NFS4ERR_NOFILEHANDLE
res = sess.compound([op.putrootfh(), op.secinfo_no_name(0), op.getfh()])
print res
check(res, NFS4ERR_NOFILEHANDLE) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetHFSFileEntry(self):\n return self._fshfs_file_entry",
"def get_fh(filename, mode):\n fh = None\n try:\n if mode == 'r':\n fh = open(filename,'r')\n elif mode == 'w':\n fh = open(filename,'w')\n else:\n raise ValueError('Command should be r or ... | [
"0.53072584",
"0.5148183",
"0.50249344",
"0.502488",
"0.4968095",
"0.49357927",
"0.48998624",
"0.48761383",
"0.48639977",
"0.48622304",
"0.48400453",
"0.48285824",
"0.47875142",
"0.47775492",
"0.4760703",
"0.4758203",
"0.47239888",
"0.47136837",
"0.47108918",
"0.46619362",
"0... | 0.6027806 | 0 |
Return the max sequence length of this tokenizer. | def max_sequence_length(self) -> int:
return self._max_request_length | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_length(self) -> int | None:\n return self._underlying.max_length",
"def max_length(self):\n\t\treturn self._max_length",
"def _max_length(self):\n return self.__max_length",
"def max_request_length(self) -> int:\n return self.max_sequence_length",
"def get_length_of_longest_sen... | [
"0.79248345",
"0.7814715",
"0.7710857",
"0.76122516",
"0.7540627",
"0.74956506",
"0.7342764",
"0.7237697",
"0.71165454",
"0.70737785",
"0.6990284",
"0.68691313",
"0.6851906",
"0.6830742",
"0.68259156",
"0.67945015",
"0.6794275",
"0.67336994",
"0.67235285",
"0.6708446",
"0.669... | 0.7911943 | 1 |
Return the max request length of this tokenizer. | def max_request_length(self) -> int:
return self.max_sequence_length | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_sequence_length(self) -> int:\n return self._max_request_length",
"def max_length(self):\n\t\treturn self._max_length",
"def _max_length(self):\n return self.__max_length",
"def max_length(self) -> int | None:\n return self._underlying.max_length",
"def maxsize(self):\r\n ... | [
"0.8040181",
"0.80028194",
"0.7908217",
"0.78137726",
"0.74633443",
"0.7395531",
"0.73337406",
"0.7236661",
"0.70824194",
"0.6937923",
"0.6824151",
"0.6814213",
"0.6814213",
"0.6808442",
"0.6740837",
"0.67247903",
"0.67175454",
"0.6702094",
"0.66950095",
"0.66950095",
"0.6653... | 0.84071106 | 0 |
The end of text token. | def end_of_text_token(self) -> str:
return self._end_of_text_token | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isEnd(self):\n return _libsbml.XMLToken_isEnd(self)",
"def _is_at_end(self):\n return self._peek().token_type == scanner.TokenType.EOF",
"def end(text=None):\n global _current_line\n if _current_line is not None:\n _current_line.end(text)\n _current_line = None",
"de... | [
"0.7161437",
"0.69371384",
"0.6831333",
"0.6623254",
"0.6569478",
"0.6566383",
"0.6510539",
"0.6465891",
"0.64181924",
"0.63650733",
"0.63393337",
"0.63297063",
"0.630279",
"0.63026834",
"0.62961084",
"0.6288676",
"0.6287439",
"0.62656957",
"0.6261917",
"0.6245131",
"0.624513... | 0.87383765 | 0 |
Name of the tokenizer to use when sending a request. | def tokenizer_name(self) -> str:
return self._tokenizer_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_tokenizer_class(model_name):\n return OpenAIGPTTokenizer if model_name == 'openai-gpt' else GPT2Tokenizer",
"def token_type(self) -> str:\n return self._token_type",
"def token_type(self) -> str:\n return self._token_type",
"def token(self) -> str:",
"def token(self) -> str:\n ... | [
"0.6726041",
"0.6509525",
"0.6509525",
"0.63465",
"0.62254226",
"0.6080051",
"0.60489094",
"0.6039997",
"0.6039997",
"0.6030399",
"0.5906061",
"0.58846533",
"0.586634",
"0.5844633",
"0.58108366",
"0.5780667",
"0.57521707",
"0.57521707",
"0.57500947",
"0.57380617",
"0.57223713... | 0.8316068 | 0 |
Convert serialized json to Mobile component | def from_json(json_data):
direction = json_data.get('direction')
max_momentum = json_data.get('max_momentum')
current_momentum = json_data.get('current_momentum')
max_speed = json_data.get('max_speed')
current_speed = json_data.get('current_speed')
rowing = json_data.get(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, mobile_attck_json):\n self.mobile_attck = mobile_attck_json",
"def test_wire_parsing_from_json(self) -> None:\n grid_unit = StackupTestHelper.mfr_grid()\n metal_dict = StackupTestHelper.create_test_metal(3) # type: Dict[str, Any]\n direct_metal = Metal.from_setting... | [
"0.6125935",
"0.60722554",
"0.59188205",
"0.5756421",
"0.55791175",
"0.5515973",
"0.53879184",
"0.5372095",
"0.5279038",
"0.5270271",
"0.52698904",
"0.5241729",
"0.52389807",
"0.52368647",
"0.52153134",
"0.519805",
"0.5191095",
"0.51542693",
"0.51514065",
"0.5138934",
"0.5133... | 0.62281847 | 0 |
Get the grant counts for real/synth benes If application != None, the counts are for a specific application. | def get_grant_bene_counts(application=None):
# Init counts dict
counts_returned = {}
# Grant real/synth bene counts (includes granted to multiple apps)
start_time = datetime.utcnow().timestamp()
# Setup base queryset
grant_queryset = DataAccessGrant.objects
if application:
grant_q... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_beneficiary_grant_app_pair_counts():\n\n # Init counts dict\n counts_returned = {}\n\n # Grant real/synth bene counts (includes granted to multiple apps)\n start_time = datetime.utcnow().timestamp()\n\n # Setup base queryset\n grant_queryset = DataAccessGrant.objects.values(\"beneficiary\... | [
"0.69182026",
"0.5773201",
"0.55573565",
"0.55211645",
"0.5338212",
"0.5242998",
"0.51704586",
"0.513185",
"0.51247793",
"0.5093041",
"0.50661576",
"0.5023353",
"0.49908602",
"0.49895573",
"0.49218634",
"0.4905657",
"0.49004886",
"0.48802036",
"0.48799422",
"0.4876613",
"0.48... | 0.7806188 | 0 |
Get AccessToken, DataAccessGrant and ArchivedDataAccessGrant counts for beneficiary type users. | def get_beneficiary_counts():
User = get_user_model()
# Init counts dict
counts_returned = {}
start_time = datetime.utcnow().timestamp()
queryset = (
User.objects.select_related()
.filter(userprofile__user_type="BEN")
.annotate(
fhir_id=Min("crosswalk___fhir_id... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_stats(request):\r\n user_count = UserMgr.count()\r\n pending_activations = ActivationMgr.count()\r\n users_with_bookmarks = BmarkMgr.count(distinct_users=True)\r\n return _api_response(request, {\r\n 'count': user_count,\r\n 'activations': pending_activations,\r\n 'with_bo... | [
"0.6891219",
"0.61459666",
"0.6123837",
"0.6058093",
"0.6011557",
"0.5944853",
"0.5926225",
"0.5921975",
"0.5912602",
"0.58535355",
"0.585157",
"0.58273494",
"0.5811506",
"0.58088696",
"0.5805567",
"0.5795218",
"0.5774675",
"0.5768302",
"0.57660484",
"0.57649344",
"0.57579374... | 0.68389356 | 1 |
Get DataAccessGrant and ArchivedDataAccessGrant counts for beneficiaryapplication pairs. | def get_beneficiary_grant_app_pair_counts():
# Init counts dict
counts_returned = {}
# Grant real/synth bene counts (includes granted to multiple apps)
start_time = datetime.utcnow().timestamp()
# Setup base queryset
grant_queryset = DataAccessGrant.objects.values("beneficiary", "application"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_grant_bene_counts(application=None):\n # Init counts dict\n counts_returned = {}\n\n # Grant real/synth bene counts (includes granted to multiple apps)\n start_time = datetime.utcnow().timestamp()\n\n # Setup base queryset\n grant_queryset = DataAccessGrant.objects\n\n if application:\... | [
"0.6973483",
"0.66911924",
"0.5162412",
"0.51583827",
"0.5151415",
"0.5109306",
"0.5107106",
"0.4989022",
"0.4976905",
"0.49694315",
"0.4954362",
"0.49121442",
"0.4887774",
"0.48872083",
"0.48740187",
"0.48256645",
"0.4821141",
"0.48171303",
"0.48086876",
"0.48056912",
"0.480... | 0.79986787 | 0 |
Make an API call to Wild Apricot to retrieve contact info for all active members. | def get_all_active_members(debug, contactsUrl):
valid_date = str(datetime.date.today() - datetime.timedelta(days=7)) # 7 days ago in yyyy-mm-dd format
#params = {'$filter': 'member eq true AND Status eq Active',
# '$async': 'false'}
params = {'$filter': "member eq true AND ( Status eq Active ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_contacts():\n return jsonify(g.driver.get_contacts())",
"def getcontacts():\n contacts = {}\n\n try:\n #get list of contact ids\n contactids = r.smembers(\"contacts\")\n\n #for each contact id get data\n for contactid in contactids:\n contacts.update(_getco... | [
"0.6713617",
"0.6643783",
"0.64085954",
"0.6258809",
"0.6256413",
"0.6255006",
"0.6143721",
"0.6133915",
"0.6131055",
"0.61093426",
"0.60089076",
"0.5980703",
"0.5980703",
"0.5980703",
"0.5972099",
"0.5960462",
"0.59564537",
"0.59230226",
"0.58822167",
"0.5870821",
"0.5854786... | 0.6996974 | 0 |
Maps RFID strings to integers | def fix_RFID(r):
#f = str(r).strip()
#while f[0] == '0':
# f = f[1:]
return int(r) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def phone_int_mapping(path_to_phone_char_map):\n mapping = dict()\n with open(path_to_phone_char_map) as f:\n for line in f:\n m = line.strip().split('\\t')\n mapping[m[0]] = int(m[1])\n\n return mapping",
"def __file_from_str_to_int(rank: str) -> int:\n # Warning, my... | [
"0.6201763",
"0.5783668",
"0.5724338",
"0.57200146",
"0.5689862",
"0.5614756",
"0.560068",
"0.55919224",
"0.55771476",
"0.55649203",
"0.55375004",
"0.55303115",
"0.55156255",
"0.5489265",
"0.54641",
"0.54608136",
"0.54566324",
"0.5437163",
"0.5405148",
"0.53972507",
"0.539091... | 0.64756197 | 0 |
Given a contact from Wild Apricot member database, pulls out list of RFIDs and privileges (ACLs) Adds to global RFID_list | def grab_RFID(debug, contact):
global RFID_list
global NAME_list
priv = ['door', 'beltsander', 'spindlesander'] # everyone gets in the door and access to some basic tools
# change: only folks that have taken the orientation get in the door!
#
#priv = []
#for field in contact.FieldValues:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_fedcm_account_list(self):\n pass",
"def receiveContactList(self, contactList):",
"def read_contacts(contacts_file, uidlist, used_uid_names):\n # Read in out values to a list\n lines = read_contacts_to_list(contacts_file)\n\n # Convert our list to dict\n contactsdict = contacts_from_list_... | [
"0.5793463",
"0.5556666",
"0.55314684",
"0.5385785",
"0.5292811",
"0.528041",
"0.5224662",
"0.5192124",
"0.51767176",
"0.5069077",
"0.5021138",
"0.5014443",
"0.500264",
"0.4993337",
"0.4978985",
"0.4968212",
"0.4967215",
"0.49658525",
"0.4953307",
"0.4927711",
"0.49252343",
... | 0.7778988 | 0 |
Reads stored list of RFID and writes ACL files with that data | def dump_RFIDs(debug, acl_dir, ts):
# get existing list of acl files
old_files = os.listdir(acl_dir)
# sort RFIDs and generate list of privileges - we need the list to know what files to write
privileges = set()
RFID_list.sort(key=lambda x:x['rfid'])
for e in RFID_list:
for p in e['... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dump_NAMEs(debug, acl_dir, ts):\n NAME_list.sort(key=lambda x:x['name'])\n\n fname_tmp = os.path.join(acl_dir, 'name_to_rfid')\n f = open (fname_tmp, 'w')\n if debug: print('Opened file:',fname_tmp)\n\n for e in NAME_list:\n f.write(e['name']+':'+str(e['rfids'])+'\\n')\n\n # all done w... | [
"0.62157315",
"0.58563346",
"0.5717289",
"0.5391716",
"0.5216398",
"0.5095185",
"0.5009426",
"0.5003885",
"0.49178278",
"0.49156103",
"0.49055976",
"0.48633957",
"0.48611525",
"0.4849756",
"0.48304555",
"0.4824907",
"0.47930318",
"0.4769174",
"0.47683936",
"0.47630203",
"0.47... | 0.72992396 | 0 |
Make links to the project resource folders in this project | def link_resources(ctx):
for resource in RESOURCES:
command = "ln -s -r -f -T {res}/{resource} {proj}/{resource}".format(
res=RESOURCE_DIR,
proj=PROJECT_DIR,
resource=resource)
print("Running")
print(command)
print("-----------------------------... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resources(self):",
"def assemble_resource_directories(project, base_dir):\n resource_path = os.path.join(base_dir, project.resources_path)\n os.makedirs(os.path.join(resource_path, 'images'))\n os.makedirs(os.path.join(resource_path, 'fonts'))\n os.makedirs(os.path.join(resource_path, 'data'))",
... | [
"0.6542292",
"0.65333784",
"0.6218728",
"0.6017278",
"0.5855742",
"0.58258486",
"0.57360697",
"0.57241046",
"0.57001704",
"0.5696988",
"0.56854105",
"0.5660929",
"0.56329405",
"0.5610566",
"0.5601242",
"0.5526083",
"0.55225146",
"0.55170727",
"0.55170727",
"0.55170727",
"0.55... | 0.72876143 | 0 |
Return enumerated responses for various datasets. Raises NotImplementedError if the dataset doesn't support enumerated responses. | def get_responses(data_folder):
return [str(i) for i in range(10)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def get_datasets(db_pool, query_parameters, include_dataset):\n hit_datasets = []\n miss_datasets = []\n response = []\n dataset_ids = query_parameters[-2]\n\n # Fetch datasets where the variant is found\n hit_datasets = await fetch_resulting_datasets(db_pool, query_parameters)\n LOG.deb... | [
"0.5544492",
"0.53126925",
"0.52980965",
"0.5260126",
"0.52431834",
"0.517832",
"0.517747",
"0.51302063",
"0.5119488",
"0.5118657",
"0.50919074",
"0.5065844",
"0.5031305",
"0.50046426",
"0.4993167",
"0.49779087",
"0.49499705",
"0.49407813",
"0.49365756",
"0.49354747",
"0.4909... | 0.594185 | 0 |
For some reason if a RecipeForm is saved with only data specifically `Recipe` data, it somehow copies ingredients/instructions form some other recipe. This test specifically checks for this. | def test_recipe_no_related_stays_no_related(self):
form = RecipeForm(data=self.form_data_recipe_no_related)
recipe = form.save()
# Check that the resulting recipe has no related items
self.assertEqual(len(recipe.ingredient_groups.all()), 0)
self.assertEqual(len(recipe.instructio... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_item_form_ingredients(self):\n\n test_ingredients = [Ingredient.objects.create(name='chocolate').id]\n\n form_data = {'name': 'test_item2',\n 'description': 'Description is longer than 10 characters',\n 'chef': self.test_user.id,\n ... | [
"0.6628717",
"0.6450618",
"0.6439353",
"0.641164",
"0.6409625",
"0.63565224",
"0.6294549",
"0.6208296",
"0.6173742",
"0.61556935",
"0.6142231",
"0.6087612",
"0.6058639",
"0.6040254",
"0.6011858",
"0.59933704",
"0.5978738",
"0.59578437",
"0.5951923",
"0.5949646",
"0.59408957",... | 0.67777187 | 0 |
Fits the data assuming a normal distributions, returns mean and standard deviation | def gauss_fit(seld, data=''):
mean, std = norm.fit(data)
return mean, std | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_mean_std(self, data):\n if self._data_mean is None:\n self._data_mean = np.mean(data)\n if self._data_std is None:\n self._data_std = np.std(data)",
"def MeanAndStandardDeviation(data):\n n = len(data)\n if n == 0:\n return 0.0, 0.0\n mean = float(sum(data)) / n\n variance = sum([... | [
"0.6888555",
"0.68504137",
"0.6841606",
"0.6830163",
"0.6830163",
"0.68180627",
"0.6798879",
"0.6758738",
"0.67473656",
"0.6739367",
"0.6725009",
"0.6633292",
"0.6610731",
"0.6590639",
"0.6556199",
"0.6534529",
"0.6516616",
"0.6500733",
"0.6474724",
"0.64506733",
"0.643497",
... | 0.69635624 | 0 |
Given the list of cov. matrices and the index of the chosen matrix, returns an averaged matrix. The average is calculated using the N following matrices. Only the the entries with actual values are used, nans values are skipped | def average_matrix(self,matrices_list='', N='', matrix_index=""):
averaged = np.empty([16, 16], dtype = float) # initialize an empty 16*16 matrix (for the 16 standard pressure levels)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __average__(self,indices):\n # first, do a sanity check on the X parameters\n for index in indices[1:]:\n # this assertion expects data to be a numpy array\n assert (self.data[0][0] == self.data[0][index]).all()\n # first, build the matrix of quantities to be averaged... | [
"0.64237404",
"0.59842265",
"0.5794853",
"0.57721573",
"0.5706617",
"0.5686782",
"0.56770647",
"0.56623095",
"0.56601936",
"0.56601936",
"0.5605636",
"0.5566386",
"0.55588996",
"0.5492407",
"0.5470992",
"0.5452519",
"0.5416029",
"0.5415425",
"0.53965974",
"0.53833455",
"0.537... | 0.7203003 | 0 |
Used to delete the document. This method will return a folder object of the parent folder that this document resided in. Once the document has been deleted it will be added to this documents graveyard. This graveyard is used to restore the deleted document. If you delete this document it will set metadata.deleted to tr... | def delete(self):
documentUrl = self.metaData.getLink("delete")
assert documentUrl is not None
response = self._adapter.deleteRequest(documentUrl, self._baseHeader)
self.metaData.graveyard.append(self.metaData)
return Folder(self._client, self._client.getUrlFromHeaderLink(respo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_document(self):\n pass",
"def delete_document(self, document):\n assert isinstance(document, pylastica.document.Document), \"document must be a Document object: %r\" % document\n options = document.get_options([\n 'version',\n 'version_type',\n 'ro... | [
"0.6484638",
"0.61606187",
"0.60621583",
"0.6035355",
"0.5832543",
"0.5816837",
"0.57378757",
"0.57177037",
"0.57134974",
"0.5706775",
"0.57032114",
"0.56466174",
"0.5635844",
"0.56301296",
"0.5602695",
"0.55812174",
"0.5522459",
"0.5512628",
"0.5492893",
"0.54907286",
"0.545... | 0.74119663 | 0 |
Restores the document from this objects graveyard. If the document is deleted and not in the graveyard there is no way to restore the folder without knowing the full uri of the deleted folders restore link. Once the document has been restored that document will be removed from the graveyard. This method will return the... | def restore(self):
documentUrl = self.metaData.graveyard[0].selfLink + "/restore"
response = self._adapter.putRequest(documentUrl, self._baseHeader, "{}")
self.metaData.graveyard.pop()
return Document(self._client, response['Headers']['location']) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def onDocumentRestored(self, obj):\n\n ArchComponent.Component.onDocumentRestored(self, obj)\n self.setProperties(obj)",
"def restoreFolder(self, index):\n assert isinstance(index, int)\n\n try:\n url = self.metaData.graveyard[index].selfLink + \"/restore\"\n res... | [
"0.64388806",
"0.6095156",
"0.6062036",
"0.57751065",
"0.5687914",
"0.5608966",
"0.5519199",
"0.5485542",
"0.53546196",
"0.5215274",
"0.514078",
"0.5119221",
"0.5116823",
"0.5115562",
"0.5107034",
"0.5098345",
"0.5090812",
"0.50686884",
"0.5038821",
"0.50364536",
"0.50192696"... | 0.7713666 | 0 |
Updates the meta data about this document. This method returns the document object of the updated document. This method allows you to edit the title and description of the document, if you leave 1 argument as optional it won't update that argument | def update(self, title=None, description = None):
jsonData = self.metaData.jsonObj
header = self._baseHeader.copy()
header['Content-type'] = "application/vnd.huddle.data+json"
url = self.metaData.getLink("edit")
assert url is not None
if title is not None: jsonData['tit... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_document(self):\n pass",
"def updateDocument(self, document):\n data = self.updateDocumentAll([document])\n try:\n return data[0]\n except: pass",
"def update(self, **kwargs):\n return self._object.update(meta=kwargs)",
"def update(self, instance, validated_dat... | [
"0.66688526",
"0.62547284",
"0.60333407",
"0.5880621",
"0.5862949",
"0.5862766",
"0.5861224",
"0.58463687",
"0.5817708",
"0.5811926",
"0.5780793",
"0.5764078",
"0.57550293",
"0.572387",
"0.5709954",
"0.56813335",
"0.5664649",
"0.5654251",
"0.563176",
"0.56187606",
"0.56129867... | 0.7680318 | 0 |
Copies this document to target folder. This method returns a Document Object of the new copied document. | def copyTo(self, folder):
copyUrl = self.metaData.getLink("copy")
if not hasattr(folder, "metaData"): raise TypeError("Your newFolder does not have a metaData property")
assert getattr(folder, "selfLink")
assert copyUrl is not None
header = self._baseHeader.copy()
heade... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copyDoc(self, recursive):\n ret = libxml2mod.xmlCopyDoc(self._o, recursive)\n if ret is None:raise treeError('xmlCopyDoc() failed')\n __tmp = xmlDoc(_obj=ret)\n return __tmp",
"def copydoc(self, doc):\n dst = os.path.join(self.path, os.path.split(doc)[1])\n if not se... | [
"0.71349126",
"0.6750404",
"0.6204421",
"0.6086825",
"0.60836196",
"0.6018448",
"0.6002959",
"0.5863096",
"0.5853461",
"0.5714051",
"0.56894773",
"0.5596433",
"0.5568087",
"0.54949385",
"0.54816085",
"0.5456911",
"0.5450843",
"0.54444283",
"0.54300004",
"0.53996104",
"0.53740... | 0.7200869 | 0 |
Creates a new version of the document. While you are uploading the new version of the document the document is locked. When you create a new version of the document you can specify the ability to alter meta data such as the title, description and a note about why you are uploading this new version. This method returns ... | def createNewVersion(self, file, title=None, description =None, versionNote = None):
newVersionUrl = self.metaData.getLink("create-version")
assert newVersionUrl is not None
uploadFile = MultiPartFormRequest(file)
header = self._baseHeader.copy()
header['Content-type'] = "appli... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_document(self, doc):\n assert isinstance(doc, pylastica.document.Document), \"doc must be of type Document: %r\" % doc\n path = urllib.quote_plus(str(doc.doc_id))\n request_type = pylastica.request.Request.PUT\n if path is None or path == '':\n #no doc id has been giv... | [
"0.6806192",
"0.6367714",
"0.63407457",
"0.63301355",
"0.6271407",
"0.62206775",
"0.6092243",
"0.6000473",
"0.5980312",
"0.5973449",
"0.59679925",
"0.5838267",
"0.5769989",
"0.57600176",
"0.5757804",
"0.57221675",
"0.5720036",
"0.57080275",
"0.56902295",
"0.56881624",
"0.5668... | 0.6962159 | 0 |
Puts a lock on the document. You should never need to call this method as it is called by the methods that need to lock content. This method returns the httprequest response of the request to lock | def __createLock(self):
lockUrl = self.metaData.getLink("lock")
assert lockUrl is not None
lockBody = json.dumps({"lockIntent" : "lockedForEdit"})
header = self._baseHeader.copy()
header['Content-type'] = "application/vnd.huddle.data+json"
lockResponse = self._adapter.po... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lock(self):\n print(\"DEPRECATED lock\")\n return self._operations.lock()",
"def response_lock(self) -> asyncio.Lock:\n return self._response_lock",
"def lock_renew(self) -> None:\n self.__logger.debug('Eva.lock_renew called')\n return self.__http_client.lock_renew()",
... | [
"0.6321234",
"0.6303788",
"0.61984277",
"0.6192926",
"0.6147174",
"0.61304164",
"0.6030385",
"0.58965194",
"0.5814758",
"0.5760184",
"0.57189375",
"0.5718485",
"0.57042176",
"0.5690154",
"0.5661982",
"0.5631437",
"0.5613648",
"0.5563974",
"0.55422676",
"0.55245847",
"0.552153... | 0.7071806 | 0 |
Unlocks a lock on the document. To unlock the document you need to specify the locks delete link. You should never need to call this method as it is called by the methods that need to unlock content. This method returns the httprequest response of the request to lock | def __deleteLock(self, url):
response = self._adapter.deleteRequest(url, self._baseHeader)
return response | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unlock(self) -> None:\n self.__logger.debug('Eva.unlock called')\n return self.__http_client.lock_unlock()",
"def unlock(self):\n print(\"DEPRECATED unlock\")\n return self._operations.unlock()",
"def delete_lock(self, lock_name):\n path = '/locks/delete/%s' % lock_name\n... | [
"0.68083674",
"0.6345917",
"0.6094885",
"0.5934181",
"0.5823708",
"0.58127487",
"0.5714637",
"0.5680282",
"0.5665088",
"0.56600356",
"0.5629937",
"0.5591542",
"0.5526212",
"0.55148894",
"0.55102915",
"0.54996765",
"0.54857737",
"0.546973",
"0.54582894",
"0.5447916",
"0.541543... | 0.68893224 | 0 |
Moves this document to another folder. This method returns a document object of the newly moved document >>moveTo(Folder> api.document.Document object Raises an AssertError if it does not have a move link Raises an AssertError if the folder object you specify does not act like a folder Raises an AssertError if we canno... | def moveTo(self, folder):
parent = self.metaData.getLinkIndex('parent')
moveUri = self.metaData.getLink("move")
assert parent != -1
assert moveUri is not None
if not hasattr(folder, "metaData"): raise TypeError("Your newFolder does not have a metaData property")
assert h... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_to_folder(self):\n if \"moveToFolder\" in self._prop_dict:\n return self._prop_dict[\"moveToFolder\"]\n else:\n return None",
"def moveTo(self, newFolder):\n moveURI = self.metaData.getLink(\"move\")\n parent = self.metaData.getLinkIndex('parent')\n\n ... | [
"0.7297154",
"0.7124918",
"0.6340775",
"0.6333984",
"0.6298626",
"0.6161408",
"0.609878",
"0.595133",
"0.590833",
"0.5853341",
"0.57983345",
"0.56845987",
"0.5643568",
"0.55118966",
"0.5488545",
"0.5386517",
"0.53304493",
"0.5285402",
"0.5278725",
"0.5239656",
"0.5220192",
... | 0.7776914 | 0 |
grabs the version history of the content. This is returned as a dictionary >>versionHistory(Folder> | def versionHistory(self):
url = self.metaData().getLink("version-history")
assert url is not None
header = self._baseHeader.copy()
response = self._adapter.getRequest(url, header)
return json.loads(response['Body']) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _grab_history(self):\n self.data['history_lines'] = []\n self.data['history_file'] = None\n self.data['history_encoding'] = None\n self.data['headings'] = []\n self.data['history_last_release'] = ''\n self.data['history_insert_line_here'] = 0\n default_location ... | [
"0.65825874",
"0.6521536",
"0.6386225",
"0.638059",
"0.62766725",
"0.6217639",
"0.61316204",
"0.5951934",
"0.59497416",
"0.59497416",
"0.59479266",
"0.5925264",
"0.59054226",
"0.59028655",
"0.5882962",
"0.58716905",
"0.5824519",
"0.5821543",
"0.58190054",
"0.5817504",
"0.5812... | 0.752361 | 0 |
creates a sub folder in the specififed directory. The index paramater is optional If you do not specify index it will create the sub folder in the parent directory. If everything goes right this method will return a folder object of the new folder | def createFolder(self, title, description="", index=None):
assert isinstance(index, int) or index is None
try:
if index is None:
url = self.metaData.getLink("create-folder")
else:
url = self.getFolders()[index].getLink("create-folder")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_folder(id_parent, name):\n id_folder = incr_key_store('folders:counter')\n rpush_key_store('folders:list', {'id': id_folder, 'parent': id_parent, 'name': name})\n return id_folder",
"def create_folder(client, parent_folder_id, folder_name):\n\n try:\n subfolder = client.folder(paren... | [
"0.6715626",
"0.64188874",
"0.632356",
"0.6228173",
"0.619247",
"0.6182481",
"0.6165542",
"0.6152539",
"0.6138185",
"0.6093231",
"0.60769814",
"0.60543686",
"0.60450804",
"0.60377955",
"0.60241455",
"0.60187376",
"0.59500784",
"0.5923687",
"0.58826816",
"0.5864929",
"0.586129... | 0.6823123 | 0 |
updated the meta data of the specified folde. If you do not specify index it will update the parent directory. This method will return a Folder object of the updated folder | def updateFolder(self, title=None, description=None, index = None):
url = self.metaData.getLink("edit")
assert url is not None
assert isinstance(index, int) or index is None
header = self._baseHeader.copy()
header['Content-Type'] = "application/vnd.huddle.data+json"
t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def moveTo(self, folder):\n parent = self.metaData.getLinkIndex('parent')\n moveUri = self.metaData.getLink(\"move\")\n\n assert parent != -1\n assert moveUri is not None\n if not hasattr(folder, \"metaData\"): raise TypeError(\"Your newFolder does not have a metaData property\")... | [
"0.6175569",
"0.5814018",
"0.55603045",
"0.5426907",
"0.54050916",
"0.53955954",
"0.53315574",
"0.5192204",
"0.51585466",
"0.50854665",
"0.50382555",
"0.50282925",
"0.49623883",
"0.49554533",
"0.494669",
"0.49134162",
"0.48834294",
"0.48825207",
"0.4874468",
"0.48549354",
"0.... | 0.7469257 | 0 |
Deletes the parent folder, if an index is specified it will delete the sub folder instead. This method returns a folder object of the deleted folders parent folder e.g foo>bar if we deleted bar we will be returned a folder of foo. Deleting a folder will also add it to this objects graveyard. The graveyard is used to re... | def deleteFolder(self, index=None):
assert isinstance(index, int) or index is None
try:
if index is None:
url = self.metaData.getLink("delete")
else:
url = self.getFolders()[index].metaData().getLink("delete")
assert url is not None
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def restoreFolder(self, index):\n assert isinstance(index, int)\n\n try:\n url = self.metaData.graveyard[index].selfLink + \"/restore\"\n response = self._adapter.putRequest(url, self._baseHeader, \"{}\")\n\n self.metaData.graveyard.pop(index)\n\n return Fo... | [
"0.6515443",
"0.59471726",
"0.569328",
"0.557232",
"0.5469304",
"0.5413422",
"0.5399414",
"0.5327829",
"0.5294971",
"0.5158216",
"0.50951225",
"0.5028694",
"0.50104535",
"0.4989633",
"0.495497",
"0.49530485",
"0.4880121",
"0.4831308",
"0.48299935",
"0.48282167",
"0.48012197",... | 0.6842206 | 0 |
Restores a folder from this objects graveyard. All resources in the deleted folder will also be restored. If the folder is deleted and not in the graveyard there is no way to restore the folder without knowing the full uri of the deleted folders restore link. Once the folder has been restored that folder will be remove... | def restoreFolder(self, index):
assert isinstance(index, int)
try:
url = self.metaData.graveyard[index].selfLink + "/restore"
response = self._adapter.putRequest(url, self._baseHeader, "{}")
self.metaData.graveyard.pop(index)
return Folder(self._client,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _restore(self, restore_folder):\n tf.reset_default_graph()\n self.init_session()\n ckpt = tf.train.get_checkpoint_state(restore_folder)\n self.saver = tf.train.import_meta_graph('{}.meta'.format(ckpt.model_checkpoint_path))\n self.saver.restore(self.sess, ckpt.model_checkpoin... | [
"0.5945062",
"0.5876237",
"0.5666672",
"0.54734826",
"0.5426759",
"0.5377757",
"0.53391206",
"0.53048646",
"0.52903396",
"0.52628475",
"0.5223572",
"0.51942337",
"0.5185043",
"0.5169018",
"0.5158355",
"0.51475716",
"0.5130876",
"0.50951403",
"0.50185645",
"0.50087166",
"0.500... | 0.72095025 | 0 |
Moves this folder to the specified folder in the parameter. This method will then return a folder object of the parent of the updated folder >>moveTo(FolderB) this folder is now in folder b Raises an AssertError if the folder you are trying to move doesn't have a move link Raises an AssertError or if it can't find the ... | def moveTo(self, newFolder):
moveURI = self.metaData.getLink("move")
parent = self.metaData.getLinkIndex('parent')
assert parent != -1
assert moveURI is not None
if not hasattr(newFolder, "metaData"): raise TypeError("Your newFolder does not have a metaData property")
if... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def moveTo(self, folder):\n parent = self.metaData.getLinkIndex('parent')\n moveUri = self.metaData.getLink(\"move\")\n\n assert parent != -1\n assert moveUri is not None\n if not hasattr(folder, \"metaData\"): raise TypeError(\"Your newFolder does not have a metaData property\")... | [
"0.7261138",
"0.6705902",
"0.6575451",
"0.6526594",
"0.65095097",
"0.64146525",
"0.6387781",
"0.6270765",
"0.6242283",
"0.6054274",
"0.58678836",
"0.5814525",
"0.5769776",
"0.5745311",
"0.55582905",
"0.5547848",
"0.54846185",
"0.5406132",
"0.5359096",
"0.5345634",
"0.5344492"... | 0.7869363 | 0 |
Copies this folder to the specified folder in the parameter. This method will then return a folder object of the new copied folder >>copyTo(FolderB) this folder has now been copied to folder b Raises an AssertError if the folder you are trying to move doesn't have a copy link Raises an TypeError if the newFolder parame... | def copyTo(self, newFolder):
copyUri = self.metaData.getLink("copy")
if not hasattr(newFolder, "metaData"): raise TypeError("Your newFolder does not have a metaData property")
if not hasattr(newFolder, "selfLink"): raise TypeError("Your folder object is missing a selfLink")
assert copyU... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def moveTo(self, newFolder):\n moveURI = self.metaData.getLink(\"move\")\n parent = self.metaData.getLinkIndex('parent')\n\n assert parent != -1\n assert moveURI is not None\n if not hasattr(newFolder, \"metaData\"): raise TypeError(\"Your newFolder does not have a metaData prope... | [
"0.6888628",
"0.6768166",
"0.65492064",
"0.6453956",
"0.6346155",
"0.61940354",
"0.61880684",
"0.61434925",
"0.6127224",
"0.6077558",
"0.5964605",
"0.59633493",
"0.5782848",
"0.5767946",
"0.5682942",
"0.5664407",
"0.56458795",
"0.5645485",
"0.55684936",
"0.5515525",
"0.550605... | 0.7699019 | 0 |
Use gradient descent to find an image that minimizes the lossfunctions of the contentlayers and stylelayers. This should result in a mixedimage that resembles the contours of the contentimage, and resembles the colours and textures of the styleimage. | def style_transfer(content_image,
content_layer_ids,
num_iterations=120, step_size=10.0):
# Create an instance of the VGG16-model. This is done
# in each call of this function, because we will add
# operations to the graph so it can grow very large
# and run out of... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stylization(stretched_image, style_image,\r\n\t\talpha = 1.0, style_size = 512, crop_size = 0):\r\n\ttf.reset_default_graph()\r\n\r\n\tassert stretched_image.ndim == 3\r\n\t\r\n\tcp = [\"./models/relu5_1\",\r\n\t\t\t \"./models/relu4_1\",\r\n\t\t \"./models/relu3_1\",\r\n\t\t \"./models/relu2_1\",\r... | [
"0.61786896",
"0.6164723",
"0.61576635",
"0.6105687",
"0.6076067",
"0.6060993",
"0.5963049",
"0.59628075",
"0.5925563",
"0.5875337",
"0.58690226",
"0.576405",
"0.57587606",
"0.5723707",
"0.5684236",
"0.5642646",
"0.56415737",
"0.5629251",
"0.562675",
"0.5611985",
"0.55835485"... | 0.63845575 | 0 |
Constructor that intializes the search to extract the data | def __init__(self, driver, output_folder, search_parameters):
self.driver = driver
self.search_results = SearchResults(output_folder, search_parameters)
self.version = search_parameters["version"]
self.region = search_parameters["community"]
self.province = search_parameters["pr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_search_data(self):\n # Must be overriden by subclass.\n pass",
"def construct(self):\n return self.as_search().construct()",
"def __init__(self, args, parsers):\n self.parsers = parsers\n self.search_fields = args.search_field if args.search_field else []",
"def _... | [
"0.74298084",
"0.72582036",
"0.69904244",
"0.687046",
"0.6810866",
"0.6688437",
"0.66254735",
"0.6623682",
"0.6594633",
"0.65885544",
"0.65650845",
"0.65181285",
"0.65010107",
"0.6488581",
"0.64617634",
"0.64591503",
"0.642912",
"0.64052725",
"0.6401393",
"0.6376879",
"0.6369... | 0.74217045 | 1 |
Method that selects the desired historical data version for this search | def select_proper_version(self):
try:
# See if the submit button is displayed
submit_button = self.driver.find_element_by_xpath(submit_versions)
except NoSuchElementException:
# In case it is not shown, make it appear
self.driver.find_element_by_xpath(show... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_latest_version(self):\n study = self.source_study_version.study\n current_study_version = self.source_study_version.study.get_latest_version()\n if current_study_version is None:\n return None\n # Find the same dataset associated with the current study version.\n ... | [
"0.5997586",
"0.58068544",
"0.5563834",
"0.5411222",
"0.53838325",
"0.53473306",
"0.532596",
"0.5323683",
"0.52684224",
"0.52212214",
"0.52131855",
"0.521049",
"0.5187213",
"0.5186738",
"0.5155839",
"0.51361215",
"0.51353586",
"0.51331025",
"0.5111388",
"0.5096219",
"0.509455... | 0.6540754 | 0 |
Method that selects the desired region for this search from the landing page | def select_proper_region(self):
# Click the desired region
region = self.driver.find_element_by_css_selector(web_map[self.region][button_path])
region.click()
time.sleep(1)
try:
search = self.driver.find_element_by_css_selector(go_to_search)
search.click(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select_regions(data, region_col, regions, combine_subregions=True):",
"def set_region(sender, instance, *args, **kwargs):\n if instance.geocity and not instance.georegion:\n instance.georegion = instance.geocity.region",
"def select_region_of_interest():\r\n image = np.array(ImageGrab.grab(bbo... | [
"0.6173443",
"0.60131407",
"0.59935087",
"0.5924314",
"0.57906854",
"0.5778641",
"0.57748395",
"0.57520103",
"0.57211655",
"0.57080865",
"0.57039094",
"0.5672578",
"0.56141526",
"0.5597352",
"0.55812305",
"0.5569898",
"0.5565366",
"0.55647045",
"0.55633926",
"0.55633926",
"0.... | 0.7525899 | 0 |
Method that fills the search form with all the paramters from the search | def fill_search_parameters(self):
time.sleep(1)
if self.province is not None:
self.driver.find_element_by_xpath(provincia_path).send_keys(self.province)
if self.entity_type is not None:
self.driver.find_element_by_xpath(tipo_ente_1_path).send_keys(self.entity_type[0])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def perform_search(self):\n\n self.implicitly_wait(5)\n html_element = self.find_element_by_xpath(\n '/html/body').get_attribute('outerHTML')\n soup = Scraper(html_element)\n target = soup.find_search_field()\n\n for elem in target:\n for attr, value in elem... | [
"0.66910803",
"0.66623443",
"0.65476847",
"0.6458294",
"0.6422288",
"0.6403961",
"0.6375824",
"0.6361148",
"0.6290763",
"0.62626666",
"0.6255805",
"0.6205426",
"0.6199787",
"0.6189706",
"0.61679465",
"0.61610675",
"0.61527574",
"0.6134219",
"0.6087507",
"0.6081296",
"0.606471... | 0.79306954 | 0 |
Method called after the results from the search are shown. It obtains all the links from the shown entities and extracts the data for each one of the links. Finally it updates the variable search_result with the scraped data. | def scrap_results(self):
# Find the table
table = self.driver.find_element_by_xpath(results_table_path)
found_links = []
# For each row the table hase
for row in table.find_elements_by_xpath(".//tr"):
elements = row.find_elements_by_xpath(".//td")
# If th... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def navigate_search_results(self):\n driver = self.driver\n search_results_exhausted = False\n results_page = self.results_page\n delay = 60\n date = get_date_time()\n # css elements to view job pages\n list_element_tag = '/descendant::a[@class=\"job-title-link\"]['... | [
"0.661581",
"0.65875775",
"0.6578253",
"0.65035903",
"0.64849716",
"0.6185542",
"0.611211",
"0.6109967",
"0.6050844",
"0.60115045",
"0.598589",
"0.595911",
"0.592672",
"0.59238786",
"0.59154433",
"0.5891052",
"0.5891052",
"0.5889387",
"0.5857786",
"0.5853461",
"0.5789102",
... | 0.7701433 | 0 |
Method that scraps a single entity. It updates the browser with the URL of the desired entity, clicks the button to show all the entity data at once and leavs everything prepared for EntityScraper to obtain the desired information. | def _scrap_single_entity(self, link):
# Click to show the info of a specific entity
self.driver.get(link)
# Show all data from this entity
all_data_link = self.driver.find_element_by_xpath(show_all_data)
all_data_link.click()
entity = EntityScraper(self.driver, self.ver... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_clicked_update(self):\n process = crawler.CrawlerProcess(\n {\n \"USER_AGENT\": \"currency scraper\",\n \"SCRAPY_SETTINGS_MODULE\": \"currency_scraper.currency_scraper.settings\",\n \"ITEM_PIPELINES\": {\n \"currency_scraper.c... | [
"0.5507844",
"0.5499927",
"0.54691416",
"0.5409359",
"0.5368381",
"0.53061575",
"0.53056824",
"0.5304008",
"0.53017473",
"0.5299134",
"0.5276429",
"0.5218978",
"0.518513",
"0.51674116",
"0.5150308",
"0.514106",
"0.5113388",
"0.50975657",
"0.5088687",
"0.50573105",
"0.50335795... | 0.6079428 | 0 |
Return next word from user_word and computer_word. | def get_next_word(self, user_word, computer_word):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_next_word(model: Dict[str, Set[str]], word: str) -> str:\n possible_words = [pos_word for pos_word in model[word]]\n return random.choice(possible_words)",
"def __findNextWord(self):\n self.activeWindow().searchCurrentWordForward()",
"def gen_user_word_2(word, user_word, user_char, se... | [
"0.64305073",
"0.64022636",
"0.6212819",
"0.61267036",
"0.61255014",
"0.60444844",
"0.59781766",
"0.59431016",
"0.5898044",
"0.5867311",
"0.58612424",
"0.5834356",
"0.582984",
"0.58241343",
"0.57892656",
"0.57833505",
"0.5781561",
"0.5773234",
"0.5772917",
"0.5763064",
"0.576... | 0.9207571 | 0 |
Create a new Scratchpad and associated ScratchpadRevision. The POST data should be a JSONencoded dict, which is passed verbatim to Scratchpad.create as keyword arguments. | def create_scratchpad():
if not gandalf.bridge.gandalf("scratchpads"):
return api_forbidden_response(
"Forbidden: You don't have permission to do this")
if not request.json:
return api_invalid_param_response("Bad data supplied: Not JSON")
# TODO(jlfwong): Support phantom users
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post(self):\n data = request.json\n create_entry(data)\n return None, 201",
"def _create(self, request, *args, **kwargs):\n app = kwargs['app']\n\n data_form = PreviewJSONForm(request.data)\n if not data_form.is_valid():\n return Response(data_form.errors,... | [
"0.61571413",
"0.5872489",
"0.57040757",
"0.5469651",
"0.5447269",
"0.54139733",
"0.53953916",
"0.5317828",
"0.5221214",
"0.52156967",
"0.52054673",
"0.51913214",
"0.5187153",
"0.5175984",
"0.5161655",
"0.51363313",
"0.51328707",
"0.5120854",
"0.51141393",
"0.51068985",
"0.50... | 0.72182924 | 0 |
Update a preexisting Scratchpad and create a new ScratchpadRevision. The POST data should be a JSONencoded dict, which is passsed verbatim to Scratchpad.update as keyword arguments. | def update_scratchpad(scratchpad_id):
if not gandalf.bridge.gandalf("scratchpads"):
return api_forbidden_response(
"Forbidden: You don't have permission to do this")
if not request.json:
return api_invalid_param_response("Bad data supplied: Not JSON")
user = UserData.current()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_scratchpad():\n if not gandalf.bridge.gandalf(\"scratchpads\"):\n return api_forbidden_response(\n \"Forbidden: You don't have permission to do this\")\n\n if not request.json:\n return api_invalid_param_response(\"Bad data supplied: Not JSON\")\n\n # TODO(jlfwong): Sup... | [
"0.5830076",
"0.54428226",
"0.54384106",
"0.5388444",
"0.5172423",
"0.5118314",
"0.50912094",
"0.50869083",
"0.50869083",
"0.5076901",
"0.5074334",
"0.5056127",
"0.5050681",
"0.5022906",
"0.5009896",
"0.5004409",
"0.49962482",
"0.4994732",
"0.4982116",
"0.49775523",
"0.497696... | 0.64261657 | 0 |
Describes the query command. | def description(self):
return QueryCommand.desc_text | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def query(self, command: str) -> str:\n return self._dmm.query(command).rstrip()",
"def command_list(self, query):\n return query",
"def query(self):\n return self.details[KEY_QUERY]",
"def query(self):\n pass",
"def query(self):\n return self.msg",
"def query(self) -> ... | [
"0.6920159",
"0.66629356",
"0.65501624",
"0.6539018",
"0.65007603",
"0.6458777",
"0.6458777",
"0.64061743",
"0.63914585",
"0.63866216",
"0.6300175",
"0.6286667",
"0.62046415",
"0.6189607",
"0.6187114",
"0.6182993",
"0.6180869",
"0.61589646",
"0.6131976",
"0.6092591",
"0.60806... | 0.7841744 | 0 |
= array of necessary values for the endpoint to function = POST, PUT, GET, DELETE = request object from django = function that actually does the specific logic for this endpoint; takes (student_query, request) as params | def standard_student_endpoint(
endpoint_name,
required_values,
method,
request,
functor):
try:
# verify method
if request.method != method:
logger.warn("non-"+method+" request landed in "+method+" logic at "+endpoint_name+" in the api")
return HttpResponseBadRequest(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def request(query):",
"def admin_search_student_query(request):\n\n if not validate_request(request): return redirect(reverse(URL_FORBIDDEN))\n if request.session['type'] == 'S' or request.session['type'] == 'R': return redirect(reverse(URL_FORBIDDEN))\n\n if request.method == \"POST\":\n first_n... | [
"0.60971296",
"0.5948114",
"0.5902992",
"0.58379984",
"0.5760867",
"0.56506467",
"0.56495714",
"0.56206256",
"0.555941",
"0.55475605",
"0.55047286",
"0.5470059",
"0.54542714",
"0.54467124",
"0.5445971",
"0.54176366",
"0.540915",
"0.53910285",
"0.53737706",
"0.53653616",
"0.53... | 0.697114 | 0 |
= array of necessary values for the endpoint to function = POST, PUT, GET, DELETE = request object from django = function that actually does the specific logic for this endpoint; takes (teacher_query, request) as params | def standard_teacher_endpoint(
endpoint_name,
required_values,
method,
request,
functor):
try:
# validate we are receiving expected method
if request.method != method:
logger.warn("non-"+method+" request landed in "+method+" logic at "+endpoint_name+" in the api:"+str(request))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def request(query):",
"def urlfor( request, *args, **kwargs ):",
"def get_request_args():\n args = {}\n args['user_id'] = request.args.get('user_id', default=None, type=int)\n args['is_examiner'] = request.args.get('is_examiner', default=None, type=int)\n if args['is_examiner'] is not None: args['i... | [
"0.5773605",
"0.550711",
"0.5505826",
"0.54748213",
"0.541358",
"0.5309723",
"0.522989",
"0.52046406",
"0.51748013",
"0.51410276",
"0.5131988",
"0.51249206",
"0.5116607",
"0.5065685",
"0.50522614",
"0.5045558",
"0.5037566",
"0.50146616",
"0.5013002",
"0.50122494",
"0.50120574... | 0.71122515 | 0 |
Test in_order_list() and make sure it returns an inorder list | def test_in_order_list(self):
_expected_list = [5, 13, 23, 57, 103]
_output_list = []
# Call in_order_list to test
in_order_list(self.root, _output_list)
# We just want to test the values
# so make a list from the list of objects
_sorted_output = [x.get_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testin_order_0_4(bst_wiki):\n assert tuple(bst_wiki.in_order()) == (1, 2, 3, 4, 5, 6, 7, 8, 9)",
"def test_pre_order_list(self):\n _expected_list = [23, 5, 13, 57, 103]\n\n _output_list = []\n\n # Call pre_order_list to test\n pre_order_list(self.root, _output_list)\n\n ... | [
"0.71159047",
"0.68667185",
"0.65902406",
"0.6583254",
"0.65332425",
"0.64737827",
"0.6378989",
"0.63576657",
"0.63542444",
"0.6317717",
"0.629651",
"0.6267976",
"0.6235458",
"0.62261045",
"0.6203755",
"0.6186887",
"0.6052205",
"0.60516423",
"0.60353404",
"0.60251814",
"0.601... | 0.7938445 | 0 |
Test post_order_list() builds a proper list | def test_post_order_list(self):
_expected_list = [13, 5, 103, 57, 23]
_output_list = []
# Call post_order_list to test
post_order_list(self.root, _output_list)
# We just want to test the values
# so make a list from the list of objects
_post_order_output = [x.g... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_post_order_traversal(our_bsts):\n bpost = []\n for i in our_bsts[0].post_order():\n bpost.append(i)\n assert bpost == our_bsts[6]",
"def test_pre_order_list(self):\n _expected_list = [23, 5, 13, 57, 103]\n\n _output_list = []\n\n # Call pre_order_list to test\n ... | [
"0.6714462",
"0.67056686",
"0.668058",
"0.66765714",
"0.6622983",
"0.65353596",
"0.6508708",
"0.6487586",
"0.64617425",
"0.6366691",
"0.6242497",
"0.62152255",
"0.6207949",
"0.6207949",
"0.61733276",
"0.6121865",
"0.6087537",
"0.59351695",
"0.58675224",
"0.586745",
"0.5840298... | 0.82653 | 0 |
Test pre_order_list() builds a proper list | def test_pre_order_list(self):
_expected_list = [23, 5, 13, 57, 103]
_output_list = []
# Call pre_order_list to test
pre_order_list(self.root, _output_list)
# We just want to test the values
# so make a list from the list of objects
_pre_order_output = [x.get_v... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_preorder_traversal(depth_one_tree):\n testlist = []\n depth_one_tree.pre_order(lambda x: testlist.append(x))\n assert str(testlist) == str([0, 1, 2, 3, 4])",
"def test_binarytree_pre_order_on_given(given_list, capsys):\n expected = [20, 18, 12, 11, 14, 19, 40, 31, 22, 33]\n given_list.pre... | [
"0.7134197",
"0.6952254",
"0.69361955",
"0.69228834",
"0.6712876",
"0.66876805",
"0.66182965",
"0.6506275",
"0.6481896",
"0.6332289",
"0.622093",
"0.61910236",
"0.61716825",
"0.6148367",
"0.6133927",
"0.6091369",
"0.6089609",
"0.60648483",
"0.60648483",
"0.6035778",
"0.595851... | 0.83723724 | 0 |
Test level_order_list() returns proper list | def test_level_order_list(self):
_expected_list = [23, 5, 57, 13, 103]
# Call level_order_list to test
_lst = level_order_list(self.root)
# We just want to test the values
# so make a list from the list of objects
_level_order_output = [x.get_value() for x in _lst]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_print_level_order(depth_one_tree):\n assert print_level_order(depth_one_tree) == ['0', '1 2 3 4']",
"def test_print_level_order_2(depth_one_tree):\n depth_one_tree.insert(5, 1)\n depth_one_tree.insert(6, 2)\n depth_one_tree.insert(7, 3)\n depth_one_tree.insert(8, 4)\n assert print_leve... | [
"0.7119945",
"0.6891942",
"0.6810224",
"0.67512816",
"0.66849685",
"0.65906245",
"0.654603",
"0.6543282",
"0.6518044",
"0.6412306",
"0.63750464",
"0.622505",
"0.6220062",
"0.6184824",
"0.6179744",
"0.61769027",
"0.610887",
"0.60863924",
"0.6083974",
"0.60619295",
"0.5994936",... | 0.8427759 | 0 |
This function warps an image sequence (with corresponding flow and depth) to a stereo sequence 1) First of all it uses a heuristic to calculate initial depth 2) Then, It smooth this initial depth by spatial smoothness if needed 4) After that, it warps the image and does interpolation to generate the right image \ it pu... | def stereoWarpK_noMotion_singleSided(curImageInfo, conversionParam, globalParam):
h, w, u = curImageInfo.originalImageResized.shape # shape after resize
K = 1
N = h * w * K
gr = np.mean(curImageInfo.originalImageResized, 2) # not 3 as it is zero based :3
grs = cv2.GaussianBlur(gr, (5, 5), 1)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def smooth_stitch(*, input_dir, output_dir):\n image_paths = glob(os.path.join(input_dir, \"*.tif\"))\n if not image_paths:\n raise RuntimeError(\"%s does not contain any .tif file\" % (input_dir))\n\n # Get the profile and affine of some image as template for output image\n first_image = image_... | [
"0.6078032",
"0.59519064",
"0.59111696",
"0.58948994",
"0.57756174",
"0.5736996",
"0.5640896",
"0.5628331",
"0.5625276",
"0.55844927",
"0.5533586",
"0.5519274",
"0.55109257",
"0.5501204",
"0.54939526",
"0.5480183",
"0.54773796",
"0.546816",
"0.5466745",
"0.5464357",
"0.544682... | 0.66762245 | 0 |
Returns whether num_of_players multi playing is supported or not. Calculated by the ratio columns/num_of_players. By experimental observations, if the ratio is greater than 40, then multi playing is supported else not. (But there are some exceptions too, this formula doesn't work well for high terminal sizes.) | def multi_player_support(self, num_of_players):
if self.screen['columns'] / num_of_players > 40:
return True
else:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_winner(self, player: str) -> bool:\n total_result = self.current_state.hori_result + self.current_state.left_result + self.current_state.right_result\n total_line = len(total_result)\n p1_taken = 0\n p2_taken = 0\n for item in total_result:\n if item == '1':\n ... | [
"0.60528976",
"0.5894889",
"0.57506096",
"0.5736657",
"0.57216996",
"0.56766444",
"0.5639242",
"0.5638798",
"0.56313765",
"0.55557156",
"0.55519736",
"0.5526917",
"0.5416034",
"0.53952646",
"0.5383263",
"0.5374004",
"0.5368561",
"0.53543204",
"0.5328036",
"0.5291333",
"0.5289... | 0.7676265 | 0 |
1. Build a list of tuples represent the sequence of characters [("a", 3), ("b", 2), ("c", 1)]. 2. Calculate all possibles create from each tupble 3. Calculate how many possibles created with a different character in between | def substrCount(n, s):
lst = []
character = s[0]
count = 1
result = 0
for i in range(1, n):
if s[i] == character:
count += 1
else:
lst.append((character, count))
character = s[i]
count = 1
lst.append((character, count))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def part1(input_string):\n twos, threes = 0, 0\n for line in input_string:\n letters_seen = {}\n for char in line:\n letters_seen[char] = letters_seen.setdefault(char, 0)+1\n if 2 in letters_seen.values():\n twos += 1\n if 3 in letters_seen.values():\n threes += 1\n return threes * tw... | [
"0.6370319",
"0.631129",
"0.62461615",
"0.62214625",
"0.61855423",
"0.6170227",
"0.60728705",
"0.6035342",
"0.6032441",
"0.60059273",
"0.59726614",
"0.5971988",
"0.5968853",
"0.5966242",
"0.5942112",
"0.59405017",
"0.592574",
"0.5887282",
"0.58769894",
"0.5861784",
"0.5853972... | 0.65442604 | 0 |
Generates a random hash | def create_hash(self):
return os.urandom(32).encode('hex') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash_gen(n):\n domain = \"abcdefghijklmnopqrstuvwxyz\"\n temp = \"\"\n for i in range(0, n):\n temp += domain[random.randrange(0, 26)]\n return temp",
"def seed_hash(*args):\n args_str = str(args)\n return int(hashlib.md5(args_str.encode(\"utf-8\")).hexdigest(), 16) % (2**31)",
"de... | [
"0.7629578",
"0.758247",
"0.7516325",
"0.75082797",
"0.7490267",
"0.73890376",
"0.72695833",
"0.7265213",
"0.7222997",
"0.71885234",
"0.7061839",
"0.70534843",
"0.7019731",
"0.6947813",
"0.69440633",
"0.69429433",
"0.69230837",
"0.6919496",
"0.6906894",
"0.6899868",
"0.689819... | 0.81974334 | 0 |
Send >countdest_addrtimeout< and display the result. | def verbose_ping(dest_addr, timeout = 2, count = 4):
for i in range(count):
logging.info("%s: ping %s..." % (i, dest_addr))
try:
delay = do_one(dest_addr, timeout)
except socket.gaierror as e:
logging.error("failed. (socket error: '%s')" % (e[1]))
break
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def SendTimeout(self) -> int:",
"def SendTimeout(self) -> int:",
"def send_command_timeout(self, sn: TransactionID, destination: tuple, source: tuple):\n pass",
"def ping(dst, count = 10, timeout = 30):\t\n\tpingTimes = []\n\tlogging.debug(\"ping %s (%i times)\", dst, count)\n\tcommand = Command(['pin... | [
"0.6299477",
"0.6299477",
"0.6273986",
"0.62287384",
"0.6068203",
"0.60135263",
"0.59908974",
"0.5865602",
"0.5819534",
"0.5819534",
"0.5675437",
"0.5655426",
"0.56502455",
"0.56440985",
"0.5607505",
"0.5594451",
"0.55888224",
"0.5520488",
"0.55140877",
"0.5496508",
"0.548701... | 0.6857996 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.