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 |
|---|---|---|---|---|---|---|
Sets the last_modified_on of this JsonJdbcIngestionProperties. | def last_modified_on(self, last_modified_on):
self._last_modified_on = last_modified_on | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setLastModified(when):",
"def last_modified(self, last_modified):\n\n self._last_modified = last_modified",
"def last_modified_dts(self, last_modified_dts):\n\n self._last_modified_dts = last_modified_dts",
"def last_modified_by(self, last_modified_by):\n\n self._last_modified_by = l... | [
"0.6223496",
"0.62083447",
"0.5805215",
"0.5642214",
"0.5642214",
"0.5547025",
"0.55205786",
"0.5488712",
"0.5488712",
"0.5488712",
"0.5488712",
"0.5435409",
"0.54256123",
"0.54256123",
"0.54190284",
"0.54190284",
"0.53778666",
"0.53735816",
"0.53735816",
"0.53735816",
"0.537... | 0.7030811 | 0 |
Sets the system of this JsonJdbcIngestionProperties. | def system(self, system):
self._system = system | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def jdbc_properties(self, jdbc_properties):\n\n self._jdbc_properties = jdbc_properties",
"def set_system_name(self, system_name):\n\n\t\tif system_name is not None and not isinstance(system_name, str):\n\t\t\traise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: system_name EXPECTED TYPE: str', None, None)... | [
"0.5509424",
"0.52224773",
"0.5148992",
"0.5148992",
"0.49638796",
"0.49095058",
"0.48922232",
"0.48535156",
"0.48432377",
"0.48115724",
"0.4799595",
"0.47686774",
"0.471078",
"0.46972197",
"0.46735558",
"0.46624678",
"0.46403193",
"0.4637089",
"0.46324444",
"0.4600796",
"0.4... | 0.57980996 | 1 |
Sets the jdbc_properties of this JsonJdbcIngestionProperties. | def jdbc_properties(self, jdbc_properties):
self._jdbc_properties = jdbc_properties | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def jdbc_driver(self, jdbc_driver):\n\n self._jdbc_driver = jdbc_driver",
"def featurestore_jdbc_connector_connections(self, featurestore_jdbc_connector_connections):\n\n self._featurestore_jdbc_connector_connections = featurestore_jdbc_connector_connections",
"def set(self, properties):\n ... | [
"0.5649309",
"0.50222313",
"0.47574311",
"0.46739405",
"0.46268708",
"0.45842722",
"0.45746607",
"0.45746607",
"0.45746607",
"0.45319366",
"0.44661254",
"0.44294205",
"0.4381224",
"0.43291444",
"0.42857668",
"0.42779317",
"0.42766798",
"0.42484736",
"0.42474186",
"0.4227801",
... | 0.80829346 | 0 |
Sets the jdbc_driver of this JsonJdbcIngestionProperties. | def jdbc_driver(self, jdbc_driver):
self._jdbc_driver = jdbc_driver | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def jdbc_properties(self, jdbc_properties):\n\n self._jdbc_properties = jdbc_properties",
"def set_driver(self, driver):\n self.driver = driver",
"def featurestore_jdbc_connector_connections(self, featurestore_jdbc_connector_connections):\n\n self._featurestore_jdbc_connector_connections =... | [
"0.59748155",
"0.5136365",
"0.4919816",
"0.4734082",
"0.4734082",
"0.44693297",
"0.44617736",
"0.44019923",
"0.43831828",
"0.43056816",
"0.43017954",
"0.43000233",
"0.42807668",
"0.42476252",
"0.41980818",
"0.4153368",
"0.41307756",
"0.4118861",
"0.40781423",
"0.40676874",
"0... | 0.73837024 | 0 |
Sets the cron_expression of this JsonJdbcIngestionProperties. | def cron_expression(self, cron_expression):
self._cron_expression = cron_expression | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cron_time_zone(self, cron_time_zone):\n\n self._cron_time_zone = cron_time_zone",
"def cron(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"cron\")",
"def cron(self):\n return",
"def __init__(__self__, *,\n cron_schedule: Optional[pulumi.Input[str]] = None,\n ... | [
"0.6386084",
"0.5834923",
"0.5414254",
"0.53603417",
"0.52862346",
"0.519446",
"0.5114584",
"0.511273",
"0.5026007",
"0.48927107",
"0.48927107",
"0.4794293",
"0.47415823",
"0.46956754",
"0.46733984",
"0.46733984",
"0.46656173",
"0.45883653",
"0.45881572",
"0.45879054",
"0.458... | 0.7999758 | 0 |
Sets the cron_time_zone of this JsonJdbcIngestionProperties. | def cron_time_zone(self, cron_time_zone):
self._cron_time_zone = cron_time_zone | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cron_expression(self, cron_expression):\n\n self._cron_expression = cron_expression",
"def time_zone(self, time_zone):\n\n self._time_zone = time_zone",
"def set_timezone(self, to_tz):\n self.startdate = to_tz.localize(self.startdate.replace(tzinfo=None))\n self.enddate = to_tz.... | [
"0.5902269",
"0.5746598",
"0.5613646",
"0.5612734",
"0.5612734",
"0.5612734",
"0.5612734",
"0.5612734",
"0.55559283",
"0.53948164",
"0.52916694",
"0.5215786",
"0.51940787",
"0.51104444",
"0.50565326",
"0.5027158",
"0.50026774",
"0.4984067",
"0.4952581",
"0.48982117",
"0.48882... | 0.83452237 | 0 |
Sets the execute_profiling of this JsonJdbcIngestionProperties. | def execute_profiling(self, execute_profiling):
self._execute_profiling = execute_profiling | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def jdbc_properties(self, jdbc_properties):\n\n self._jdbc_properties = jdbc_properties",
"def setProfileJobs(self,profile=False):\n self.__profileJobs = profile",
"def execution_profile(self):\n raise NotImplementedError(\n method_name=\"execution_profile\",\n class_name=typ... | [
"0.4877867",
"0.47615573",
"0.46750104",
"0.46304145",
"0.4542346",
"0.44202763",
"0.4358259",
"0.41864684",
"0.41732705",
"0.41306156",
"0.41144234",
"0.41056332",
"0.40532285",
"0.4051517",
"0.40302408",
"0.40086052",
"0.40018988",
"0.39283058",
"0.3907618",
"0.38800254",
"... | 0.7147761 | 0 |
Sets the extract_data_sample of this JsonJdbcIngestionProperties. | def extract_data_sample(self, extract_data_sample):
self._extract_data_sample = extract_data_sample | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_sample_data_extracted(self, is_sample_data_extracted):\n self._is_sample_data_extracted = is_sample_data_extracted",
"def set_sampling(self, sampling: str = 'training'):\n self._sampling_accessor = sampling\n with open(self._inputPath + '/../sampling.json', encoding='utf-8') as data_f... | [
"0.6318039",
"0.56455183",
"0.53558093",
"0.5122929",
"0.5103026",
"0.49853206",
"0.49181038",
"0.4829947",
"0.48101833",
"0.48060548",
"0.47768047",
"0.4770165",
"0.47481054",
"0.47255185",
"0.47225806",
"0.4699318",
"0.46696988",
"0.46533418",
"0.4651343",
"0.4646242",
"0.4... | 0.7396614 | 0 |
Sets the detect_advanced_data_types of this JsonJdbcIngestionProperties. | def detect_advanced_data_types(self, detect_advanced_data_types):
self._detect_advanced_data_types = detect_advanced_data_types | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_dtype(self, dtype):\n _d = dtype.lower()\n if \"phot\" in _d:\n self.dtype = \"photon\"\n elif \"ener\" in _d:\n self.dtype = \"energy\"\n else:\n raise ValueError('Unknown detector type {0}'.format(dtype))",
"def advanced_features(self, advanc... | [
"0.50965697",
"0.49736077",
"0.49001017",
"0.4881866",
"0.47757646",
"0.476277",
"0.4752075",
"0.4641316",
"0.45932186",
"0.45875108",
"0.4532499",
"0.4515847",
"0.44989982",
"0.44780585",
"0.4475511",
"0.44473377",
"0.44451487",
"0.4419167",
"0.44160962",
"0.44096804",
"0.43... | 0.7839279 | 0 |
Sets the tables_to_skip of this JsonJdbcIngestionProperties. | def tables_to_skip(self, tables_to_skip):
self._tables_to_skip = tables_to_skip | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_fkey_nav_stops_on_skip(dumper, db):\n dumper.reader.load_db(\n db.create_sample(\n 5,\n fkeys=[\n (\"table1\", \"t2id\", \"table2\", \"id\"),\n (\"table2\", \"t3id\", \"table3\", \"id\"),\n (\"table3\", \"t4id\", \"table4\", \"id... | [
"0.47862852",
"0.47083324",
"0.47003055",
"0.4666161",
"0.46463743",
"0.4631545",
"0.4589141",
"0.45797166",
"0.45434368",
"0.45173484",
"0.44476372",
"0.4442546",
"0.44404238",
"0.44373155",
"0.44281414",
"0.43903542",
"0.43850672",
"0.43013865",
"0.42779592",
"0.4262847",
"... | 0.8193819 | 0 |
Decode the response headers and create appropriate metrics based on the header values. The response_headers are passed in as a list of tuples. [(HEADER_NAME0, HEADER_VALUE0), (HEADER_NAME1, HEADER_VALUE1)] | def process_response_headers(self, response_headers):
settings = self.settings
if not settings:
return
if not settings.cross_application_tracer.enabled:
return
appdata = None
try:
for k, v in response_headers:
if k.upper() ==... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_response(response):\n data = []\n \n for report in response.get('reports', []):\n columnHeader = report.get('columnHeader', {})\n dimensionHeaders = columnHeader.get('dimensions', [])\n metricHeaders = columnHeader.get('metricHeader', {}).get('metricHeaderEntries', [])\n rows = report.... | [
"0.6024652",
"0.58121204",
"0.5701095",
"0.5608415",
"0.55389136",
"0.54506004",
"0.54506004",
"0.5417471",
"0.5374543",
"0.5340843",
"0.53154534",
"0.5298669",
"0.5272827",
"0.52655214",
"0.5247795",
"0.52409744",
"0.5230199",
"0.5219283",
"0.5217733",
"0.5178149",
"0.516461... | 0.6154797 | 0 |
It takes in a website link as input and return all the classnames used on the website. | def extract_all_tags(final_link, driver):
#driver = webdriver.Chrome(executable_path="ChromeDriver/chromedriver.exe")
driver.get(str(final_link))
classes = []
tags = ['div', 'td', 'li', 'a']
for tag in tags:
a = driver.find_elements_by_tag_name(str(tag))
b = len(a)
for i in ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_classes(html):\n # elements = html.find_all(\"span\", \"code\")\n # titles = html.find_all(\"span\", \"title\")\n # classes = []\n # for i in range(len(elements)):\n # item = elements[i]\n # tit = titles[i]\n # classes += [(item.text.replace('\\xa0', ' '), tit.text.replace(... | [
"0.6977077",
"0.63743794",
"0.63369435",
"0.6298379",
"0.60849005",
"0.6010769",
"0.595103",
"0.58935386",
"0.58824253",
"0.5866446",
"0.58081573",
"0.57081354",
"0.56383866",
"0.5592302",
"0.559083",
"0.5580339",
"0.5535862",
"0.5511863",
"0.5510536",
"0.55013674",
"0.549088... | 0.6917513 | 1 |
1. It takes all the useful links from the home website as input. 2. Enforce web crawling and extract all useful found 3. Extract the useful data from all the useful links extracted | def deep_link_scraping(final_links, driver):
import re
second_links = []
for website2 in final_links:
links2 = extract_all_links(website2, driver)
final_links1 = find_usefull_links(links2, classmodel, class_count_vect)
final_links2 = list(set(final_links1) - set(final_links))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def link_scraping(final_links, driver):\n\n for final_link in final_links:\n tags = extract_all_tags(final_link, driver)\n if len(tags) != 0:\n final_tags = find_usefull_tags(tags, tagmodel, tag_count_vect)\n if len(final_tags) != 0:\n print('Extracting(classna... | [
"0.7229524",
"0.67814445",
"0.6743636",
"0.66795707",
"0.6603203",
"0.65976393",
"0.6584772",
"0.6559459",
"0.65498966",
"0.6531386",
"0.65170753",
"0.65139127",
"0.6511179",
"0.6486064",
"0.64685076",
"0.64224035",
"0.6405716",
"0.6380941",
"0.6372001",
"0.637091",
"0.635036... | 0.7232413 | 0 |
It takes useful links as an input and calls the function scrape_data or scrape_data_tag on the basis if useful tags are received | def link_scraping(final_links, driver):
for final_link in final_links:
tags = extract_all_tags(final_link, driver)
if len(tags) != 0:
final_tags = find_usefull_tags(tags, tagmodel, tag_count_vect)
if len(final_tags) != 0:
print('Extracting(classname): ', fina... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scrape_data(final_link, tags, driver):\n #driver = webdriver.Chrome(executable_path=\"ChromeDriver/chromedriver.exe\")\n driver.get(str(final_link))\n errcount = 0\n for tag in tags:\n try:\n children = driver.find_elements_by_css_selector(tag)\n for child in children:\... | [
"0.6941169",
"0.6730641",
"0.630104",
"0.6288677",
"0.6256914",
"0.5943134",
"0.5876478",
"0.5758648",
"0.5690269",
"0.56877136",
"0.5608039",
"0.5546213",
"0.5546081",
"0.5538152",
"0.55267596",
"0.5491039",
"0.5466902",
"0.54129934",
"0.5401599",
"0.5398654",
"0.5341974",
... | 0.7491283 | 0 |
initializes an empty graph (no nodes, no edges) and an empty list that stores graph copies | def __init__(self):
self._graph = DirectedGraph()
self._graph_copies = [] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self.graph = {}\n self.edges = 0\n self.vertices = 0",
"def _init_graph(self):\n self.G = nx.Graph()\n self.G.add_nodes_from([1,2,3,4,5])\n self.G.add_edges_from([(1,2),(2,3),(2,4)\\\n ,(2,5),(3,4),(4,5)])",
"def init_vertic... | [
"0.6994657",
"0.6869622",
"0.67684174",
"0.67584795",
"0.6714823",
"0.6585916",
"0.6517928",
"0.6511417",
"0.6493447",
"0.64735955",
"0.647329",
"0.64572185",
"0.64479786",
"0.6444233",
"0.6434317",
"0.64009154",
"0.6390514",
"0.6379037",
"0.63668334",
"0.6359676",
"0.6354472... | 0.75274307 | 0 |
checks if there is an edge between two vertices read from keyboard. | def check_edges(self):
start = int(input('Enter start vertex: '))
end = int(input('Enter end vertex: '))
if self._graph.is_edge_between(start, end):
print('There is an edge from ' + str(start) + ' to ' + str(end))
else:
print('There is NO edge from ' + str(start) ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isEdge(self,x,y):\n\t\treturn y in self._dictOut[x]",
"def isEdge(self, x, y):\n if y in self.parseX() or x in self.parseX():\n return y in self.dictOut[x]\n else :\n print(\"verteces not found\")",
"def isEdge(self,x,y):\r\n return self.matr[x][y]",
"def isEd... | [
"0.7021373",
"0.70151204",
"0.6955464",
"0.6910868",
"0.68814826",
"0.683401",
"0.66876227",
"0.6523862",
"0.6507085",
"0.6488775",
"0.6424605",
"0.6365208",
"0.63593936",
"0.63342386",
"0.6291343",
"0.6290668",
"0.6263541",
"0.62546223",
"0.62185633",
"0.6196922",
"0.6156392... | 0.71416295 | 0 |
prints the degree of a vertex read from keyboard | def print_degree(self):
vertex = int(input('enter vertex: '))
in_degree = self._graph.get_in_degree(vertex)
out_degree = self._graph.get_out_degree(vertex)
print('The in degree of ' + str(vertex) + ' is ' + str(in_degree))
print('The out degree of ' + str(vertex) + ' is ' + str(o... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def degree(self, v):\n self._validateVertex(v)\n return self._adj[v].size()",
"def degree(self, v):\n self._validateVertex(v)\n return self._adj[v].size()",
"def return_outdeg(self, vertex: np.int_):\n return len(self.__adj[vertex])",
"def degree(adj_mat, vertex):\n return np.su... | [
"0.6310401",
"0.60159636",
"0.5975416",
"0.5782732",
"0.56887203",
"0.56442046",
"0.56138074",
"0.54638255",
"0.54545337",
"0.5335347",
"0.53333074",
"0.5323652",
"0.5312062",
"0.5273959",
"0.52303344",
"0.5211556",
"0.51971334",
"0.51810956",
"0.51810956",
"0.5150495",
"0.51... | 0.7967106 | 0 |
iterates all outbound edges of vertex read from keyboard. prints them and their cost | def iterate_outbound_edges(self):
vertex = int(input('enter vertex: '))
try:
vertices = self._graph.get_outbound_edges(vertex)
except ValueError as ve:
print(ve)
return
print('Outbound edges from ' + str(vertex) + ':')
for v in vertices:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iterate_inbound_edges(self):\n vertex = int(input('enter vertex: '))\n try:\n vertices = self._graph.get_inbound_edges(vertex)\n except ValueError as ve:\n print(ve)\n return\n print('Inbound edges from ' + str(vertex) + ':')\n for v in vertic... | [
"0.7460391",
"0.6843248",
"0.63860714",
"0.63567245",
"0.62640804",
"0.62558603",
"0.6059996",
"0.60002565",
"0.589454",
"0.5844208",
"0.5819766",
"0.5682499",
"0.5679052",
"0.56354827",
"0.5605318",
"0.5578951",
"0.5576057",
"0.554845",
"0.55293566",
"0.55283886",
"0.5504756... | 0.79708344 | 0 |
iterates all inbound edges of vertex read from keyboard, prints them and their cost. | def iterate_inbound_edges(self):
vertex = int(input('enter vertex: '))
try:
vertices = self._graph.get_inbound_edges(vertex)
except ValueError as ve:
print(ve)
return
print('Inbound edges from ' + str(vertex) + ':')
for v in vertices:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iterate_outbound_edges(self):\n vertex = int(input('enter vertex: '))\n try:\n vertices = self._graph.get_outbound_edges(vertex)\n except ValueError as ve:\n print(ve)\n return\n print('Outbound edges from ' + str(vertex) + ':')\n for v in ver... | [
"0.7314351",
"0.7056074",
"0.63513935",
"0.6183939",
"0.6028314",
"0.59128845",
"0.5906504",
"0.58057135",
"0.58016145",
"0.5688565",
"0.5601222",
"0.54778075",
"0.54134685",
"0.5381318",
"0.5345022",
"0.53172",
"0.5306116",
"0.53016233",
"0.5269003",
"0.5239629",
"0.5238125"... | 0.8002663 | 0 |
prints the cost of an edge between two vertices read from keyboard, if the edge exist. If the edge does not exist, or vertices are not valid, raise ValueError | def print_cost(self):
start = int(input('start vertex: '))
end = int(input('end vertex: '))
cost = self._graph.get_cost(start, end)
print('the cost of edge is ' + str(cost)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cost_distance(e):\n # Make sure we have a proper edge with two vertices\n if len(e) != 2:\n raise ValueError\n\n a = V_coord[e[0]]\n b = V_coord[e[1]]\n\n # Return the distance between two points\n return distance(a, b)",
"def check_edges(self):\n start = int(input('Enter star... | [
"0.6220483",
"0.61472213",
"0.59278435",
"0.5844462",
"0.58335537",
"0.5662212",
"0.56271285",
"0.55602974",
"0.5559249",
"0.5526453",
"0.5518155",
"0.5488179",
"0.54742926",
"0.5436777",
"0.53099567",
"0.5294081",
"0.5268533",
"0.5267662",
"0.5257673",
"0.5257595",
"0.525588... | 0.708619 | 0 |
restores the state of the graph from a previous copy made. If there is at least one copy to restore from | def restore_graph_ui(self):
if len(self._graph_copies) == 0:
print('No copies to restore!')
return
# the last made copy is restored in graph
self._graph = self._graph_copies.pop(-1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def restore(self):\n self.nodes.restore()",
"def _Restore(self) -> None:\n self._SetNodes(self._nodes)",
"def _restoreGraph(self):\n\n # self.tempG = self.g.copy()\n\n if nx.is_directed(self.g):\n self.tempG = nx.DiGraph(self.g)\n else:\n self.tempG = nx.Gra... | [
"0.74744827",
"0.7448601",
"0.74397695",
"0.73925924",
"0.7309107",
"0.70217335",
"0.69016004",
"0.6828779",
"0.68268186",
"0.67718124",
"0.6744612",
"0.67356306",
"0.6699239",
"0.66833806",
"0.6653536",
"0.65983886",
"0.6584011",
"0.65656936",
"0.65646636",
"0.6524735",
"0.6... | 0.7628298 | 0 |
reads graph from a file whose name is given from keyboard. | def read_graph_ui(self):
filename = input('enter filename: ')
try:
self._graph = read_graph(filename)
except FileNotFoundError:
print('invalid filename! ') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_graph(filename):\n with open(filename) as f:\n g = eval(f.read())\n return g",
"def read_graph(filename, directed=True):\n if not directed:\n G = nx.Graph()\n else:\n G = nx.DiGraph()\n with open(filename) as f:\n for line in f:\n d = line.split()\n ... | [
"0.72687954",
"0.6888777",
"0.6812073",
"0.68117404",
"0.6764579",
"0.6715689",
"0.67132574",
"0.66535294",
"0.6625131",
"0.6620927",
"0.6601009",
"0.6579922",
"0.65244764",
"0.6517937",
"0.6517937",
"0.64780235",
"0.6475796",
"0.6463978",
"0.64423335",
"0.6433082",
"0.642820... | 0.7448128 | 0 |
Generate positions (x, y coordinates) for each spike on the probe. This function assumes that the spikes were generated with the kilosort algorithm so the base_folder holds all the necessary .npy arrays. In order for this function to find which channels are the most relevant in each spike it looks into the spike's assi... | def generate_probe_positions_of_spikes(base_folder, binary_data_filename, number_of_channels_in_binary_file,
used_spikes_indices=None, position_mult=2.25, threshold=0.1):
# Load the required data from the kilosort folder
channel_map = np.load(os.path.join(base_folder, 'cha... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_probe_positions_of_templates(base_folder, threshold=0.1, new_templates_array=None):\n # Load the required data from the kilosort folder\n channel_positions = np.load(os.path.join(base_folder, 'channel_positions.npy'))\n if new_templates_array is None:\n try:\n templates = np... | [
"0.73915523",
"0.5584274",
"0.53825366",
"0.53255445",
"0.51729035",
"0.5165869",
"0.5158448",
"0.5107639",
"0.506456",
"0.50437576",
"0.50229704",
"0.5019746",
"0.501889",
"0.5014978",
"0.5013797",
"0.5013797",
"0.49993762",
"0.49964085",
"0.49760303",
"0.49754888",
"0.49720... | 0.76321465 | 0 |
Generate positions (x, y coordinates) for each template found by kilosort on the probe or passed to it by the new_templates_array. This function assumes that the base_folder holds all the necessary .npy arrays. If no new_templates_array is passed it will look for the templates.npy file (created by kilosort) which is th... | def generate_probe_positions_of_templates(base_folder, threshold=0.1, new_templates_array=None):
# Load the required data from the kilosort folder
channel_positions = np.load(os.path.join(base_folder, 'channel_positions.npy'))
if new_templates_array is None:
try:
templates = np.load(os.p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_probe_positions_of_spikes(base_folder, binary_data_filename, number_of_channels_in_binary_file,\n used_spikes_indices=None, position_mult=2.25, threshold=0.1):\n # Load the required data from the kilosort folder\n channel_map = np.load(os.path.join(base_fold... | [
"0.6328705",
"0.53906786",
"0.5349962",
"0.5301935",
"0.5298006",
"0.52869534",
"0.5275999",
"0.5120418",
"0.5108772",
"0.50137204",
"0.4991059",
"0.4970462",
"0.49680394",
"0.49202514",
"0.49110833",
"0.48883888",
"0.4870274",
"0.48590174",
"0.48584995",
"0.48383528",
"0.481... | 0.839063 | 0 |
Plot the spike positions as a scatter plot on a probe marked with brain regions | def view_spike_positions(spike_positions, brain_regions, probe_dimensions, labels_offset=80, font_size=20):
fig = plt.figure()
ax = fig.add_axes([0.08, 0.05, 0.9, 0.9])
ax.scatter(spike_positions[:, 0], spike_positions[:, 1], s=5)
ax.set_xlim(0, probe_dimensions[0])
ax.set_ylim(0, probe_dimensions[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_variant_positions(strains):\n if strains.lower() == 'all':\n strains = None\n strains = get_required_strains(strains)\n gd_data = []\n with database.make_connection() as connection:\n for strain in strains:\n hits = r.table(TABLE).filter(lambda row: row['StrainID'].mat... | [
"0.6227864",
"0.62214625",
"0.6140126",
"0.6102602",
"0.6080271",
"0.6071637",
"0.602967",
"0.6007783",
"0.5980094",
"0.596806",
"0.5963319",
"0.59417874",
"0.5923047",
"0.5893003",
"0.58578354",
"0.5840446",
"0.5825529",
"0.5800904",
"0.5780873",
"0.5771907",
"0.5767062",
... | 0.70573217 | 0 |
Returns the Collatz function value of value. | def collatz(value):
assert value >= 1
if value % 2 == 0:
return value/2
else:
return 3 * value + 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def z(self) -> float:\n return self.A[3] if self.scalar_vector else self.A[2]",
"def f_c(self, z, m):\n\t return (1. - self.f_o(z))*m/(self.ALPHA_1*self.MMAX + m)",
"def f_c(self, z, m):\n\t return (1. - self.f_o(z))*m/(self.ALPHA_1*self.mmax + m)",
"def zvalue(value, sigma, mu):\n return (va... | [
"0.6321339",
"0.6254899",
"0.62513334",
"0.6250638",
"0.5922092",
"0.5831883",
"0.5831861",
"0.5827949",
"0.58229166",
"0.58096135",
"0.5748661",
"0.57371926",
"0.57262725",
"0.5722124",
"0.57200646",
"0.57154316",
"0.5712435",
"0.5700306",
"0.5682831",
"0.5676214",
"0.566184... | 0.7737109 | 0 |
Returns the collatz length associated with val, building the collatz_len_dict as it goes. | def collatz_length(val):
assert val >= 1
# Seed the dictionary with collatz_length(1) = 1.
if val == 1:
collatz_len_dict[1] = 1
return collatz_len_dict[1]
# Return the collatz length if it exists in the dictionary.
if val in collatz_len_dict:
return collat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main():\r\n \r\n TOP_VAL = 1000000\r\n for i in xrange(1, TOP_VAL):\r\n _ = collatz_length(i) # Seed each collatz length.\r\n \r\n # Find the key with largest value in the collatz length dictionary.\r\n value, collatz_len = max(collatz_len_dict.iteritems(),\r\n ... | [
"0.63886285",
"0.5896573",
"0.5646013",
"0.56028664",
"0.5522218",
"0.5476281",
"0.54210943",
"0.5352304",
"0.53408134",
"0.52664757",
"0.52570415",
"0.52268237",
"0.5211673",
"0.52104354",
"0.52061903",
"0.5202915",
"0.5193688",
"0.5139088",
"0.5105716",
"0.5094535",
"0.5080... | 0.8624163 | 0 |
Finds the number with the longest Collatz sequence under 1 million. | def main():
TOP_VAL = 1000000
for i in xrange(1, TOP_VAL):
_ = collatz_length(i) # Seed each collatz length.
# Find the key with largest value in the collatz length dictionary.
value, collatz_len = max(collatz_len_dict.iteritems(),
key=lambda x:x[1... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def brute(limit):\n c_lengths = {s: collatz_length(s) for s in range(1, limit+1)}\n return max(c_lengths, key=lambda x: c_lengths[x])",
"def longest_sequence_seed(ubound):\n max_seq_seed = 1\n max_seq_len = 1\n for seed in range(1, ubound):\n seq_len = sum(1 for t in collatz_sequence(seed))... | [
"0.75266415",
"0.7198738",
"0.7196087",
"0.717631",
"0.64048016",
"0.63742423",
"0.63255733",
"0.63223904",
"0.6298933",
"0.6236006",
"0.61663425",
"0.60797447",
"0.60653627",
"0.60575485",
"0.60220593",
"0.60206336",
"0.60177255",
"0.6012676",
"0.60087687",
"0.5935851",
"0.5... | 0.7428995 | 1 |
convert a matplotlib colormap into a PIL palette | def cmap_to_pil_palette(cmap):
# return (255.*np.array(
# map(lambda x: cmap(x)[0:3], np.linspace(0., 1.,256)))
# .ravel()).astype('int')
return (255. * np.array(
[cmap(x)[:3] for x in np.linspace(0,1,256)]).ravel().astype('int')) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def colormap(self):\n palette = [(0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0),\n (111, 74, 0), (81, 0, 81), (128, 64, 128), (244, 35, 232),\n (250, 170, 160), (230, 150, 140), (70, 70, 70),\n (102, 102, 156), (190, 153, 153), (180, 165, 180),\n ... | [
"0.6967287",
"0.68760455",
"0.68467826",
"0.68011427",
"0.6650869",
"0.6646248",
"0.66290563",
"0.66052055",
"0.6603507",
"0.65802604",
"0.655248",
"0.6547776",
"0.6542165",
"0.6542165",
"0.65381736",
"0.65381736",
"0.6538096",
"0.6535332",
"0.6535332",
"0.6523931",
"0.651459... | 0.8015995 | 0 |
Save a png image of a colorbar. One can use this code directly, or use it as an example to modify. | def save_colorbar(img=None, vmin=None, vmax=None, cmap="jet",
filename=None, title="Colorbar", lab=""):
fig = plt.figure(figsize=(1.0, 4.0), facecolor=None, frameon=False)
ax = fig.add_axes([0.0, 0.05, 0.2, 0.9])
if vmin is None: vmin = np.min(img)
if vmax is None: vmax = np.max(img)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_colorbar(\n map_path: Path = typer.Option(...),\n colorbar_path: Path = typer.Option(...),\n label: str = typer.Option(...),\n output_path: Path = typer.Option(...),\n):\n img = plt.imread(map_path)\n w, h = 3779 / 1000, 3749 / 1000\n fig, ax = plt.subplots(dpi=100)\n assert isinsta... | [
"0.6722815",
"0.66249746",
"0.6546425",
"0.64947253",
"0.6400522",
"0.62403846",
"0.6202291",
"0.61253536",
"0.61250126",
"0.61182654",
"0.61181164",
"0.60613644",
"0.601523",
"0.599384",
"0.5987088",
"0.5985315",
"0.59652644",
"0.5953611",
"0.5927927",
"0.59235275",
"0.59234... | 0.7792215 | 0 |
Test a all successful scenario's for TOTP validation. | def test_successful_verification(self):
for i in (-2, -1, 0, 1, 2):
description = "TOTP not verified for `i={0}`".format(i)
calculated = self.algorithm.calculate(self.device.secret, drift=i)
confirmed = self.relate.verify(calculated, save=False)
self.assertTrue(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_valid_otp(self, client, valid_otp_data):\n resp = client.post(self.url, json=valid_otp_data)\n assert resp.status_code == 200\n assert resp.json()[\"status\"] == \"OK\"",
"def test_unsuccessful_verification(self):\n for i in (-4, -3, 3, 4):\n description = \"TOTP v... | [
"0.74338865",
"0.68149686",
"0.6745631",
"0.67049855",
"0.6556469",
"0.6342859",
"0.6192209",
"0.6178929",
"0.611805",
"0.60867935",
"0.60529476",
"0.5979635",
"0.5956218",
"0.59378344",
"0.5920723",
"0.5908492",
"0.58967924",
"0.5874718",
"0.58681774",
"0.5859935",
"0.585794... | 0.7176029 | 1 |
Test all unsuccessful scenario's for TOTP validation. | def test_unsuccessful_verification(self):
for i in (-4, -3, 3, 4):
description = "TOTP verified for `i={0}`".format(i)
calculated = self.algorithm.calculate(self.device.secret, drift=i)
confirmed = self.relate.verify(calculated, save=False)
self.assertFalse(confi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_invalid_otp(self, client, valid_otp_data):\n\n valid_otp_data[\"code\"] += \"1\"\n\n resp = client.post(self.url, json=valid_otp_data)\n assert resp.status_code == 401\n assert resp.json()[\"code\"] == \"invalid_otp\"",
"def test_successful_verification(self):\n for i ... | [
"0.70181113",
"0.68967783",
"0.6756452",
"0.65170574",
"0.6170026",
"0.61201423",
"0.6116117",
"0.6086188",
"0.6060815",
"0.6015356",
"0.6000249",
"0.5992706",
"0.5935468",
"0.5925306",
"0.59237534",
"0.5915284",
"0.5909458",
"0.5885173",
"0.5880219",
"0.58797127",
"0.587615"... | 0.7493148 | 0 |
changes hue of image | def change_hue(image, delta):
imHueChange = tf.image.adjust_hue(image, delta=delta, name=None)
return imHueChange | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adjust_hue(image, delta):\r\n image[..., 0] = np.mod(image[..., 0] + delta * 180, 180)\r\n return image",
"def adjustHue(img, fac):\n hsv = cv2.cvtColor(img, cv2.COLOR_RGB2HSV_FULL)\n hsv[..., 0] += np.uint8(fac * 255)\n img2 = cv2.cvtColor(hsv, cv2.COLOR_HSV2RGB_FULL)\n return img2",
"de... | [
"0.7590641",
"0.7467261",
"0.74252427",
"0.7315436",
"0.72571546",
"0.7229215",
"0.70048535",
"0.6902539",
"0.6804992",
"0.6753325",
"0.6750485",
"0.67452693",
"0.6604627",
"0.6576694",
"0.6470038",
"0.6399022",
"0.6370358",
"0.6367779",
"0.6312419",
"0.6231982",
"0.6156993",... | 0.7747147 | 0 |
Removes all Tkinter widgets from a master window [master], skipping widgets of type [ignore] | def removeWidgets(master, ignore=None):
for w in master.winfo_children():
if w.winfo_class() != ignore:
w.destroy() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear_screen(self):\r\n lst_grid = self.root.grid_slaves()\r\n for widget in lst_grid:\r\n widget.destroy()\r\n lst_pack = self.root.pack_slaves()\r\n for widget in lst_pack:\r\n widget.destroy()",
"def removeWidgets(self): \n for widget in self.activeWid... | [
"0.6616854",
"0.65503854",
"0.63473904",
"0.6290107",
"0.6270392",
"0.6248559",
"0.6188864",
"0.6032273",
"0.60007054",
"0.59946984",
"0.5981343",
"0.5974938",
"0.59474486",
"0.59302163",
"0.5915207",
"0.5860621",
"0.5817283",
"0.5775139",
"0.57666093",
"0.574026",
"0.5724115... | 0.8474203 | 0 |
Create a new player and write data to the filename. | def create_player (self, username = None):
# Get unique username if needed
if (username == None):
username = "default_username" + str (time.time ())
self.username = username
r = requests.post (self.url_endpoint, data = {"new_player": self.username})
if (r.status_code ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_player(self,player_name, attr = None, team_file = None):\n player_first, player_last = player_name.split(\" \")\n player_file = player_name.replace(\" \", \"\") + '.json'\n if(os.path.exists(self.player_path + player_file)):\n return(False)\n else:\n wit... | [
"0.7191583",
"0.67326915",
"0.6686919",
"0.6426288",
"0.62403584",
"0.6238124",
"0.62195104",
"0.6184011",
"0.6181962",
"0.61628854",
"0.61118764",
"0.607156",
"0.6037864",
"0.5991602",
"0.5968651",
"0.5889733",
"0.58838624",
"0.5861497",
"0.5849546",
"0.5849546",
"0.57562464... | 0.765587 | 0 |
Create a new game, return the game_name for others to join. | def create_new_game (self, game_name = None, ai_game = False):
if (game_name == None):
game_name = "default_game_name" + str (time.time ())
self.cur_game_name = game_name
data =\
{
"new_game": True,
"player_secret": self.secret,
"game_name"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_game(self, request):\n player = Player.query(Player.name == request.player_name).get()\n if not player:\n raise endpoints.NotFoundException(\n 'A Player with that name does not exist!, '\n 'we need one player in order to create the game')\n t... | [
"0.74982727",
"0.7224595",
"0.71563494",
"0.7064729",
"0.7029593",
"0.6942317",
"0.6867906",
"0.6801306",
"0.67754155",
"0.67094946",
"0.6696803",
"0.66419804",
"0.6577166",
"0.65620756",
"0.65488946",
"0.65466297",
"0.63818413",
"0.63808215",
"0.63724446",
"0.6359087",
"0.63... | 0.7971833 | 0 |
Join the game given by game_name. | def join_game (self, game_name):
r = requests.post (self.url_endpoint,
data = {"join_game": True, "player_secret": self.secret, "game_name": game_name})
if (r.status_code != 201):
print (f"ERROR: Failed to join game <{game_name}>:\n", r.text)
return r
join_da... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def join(self, game):\n self.game = game\n self.game.join(self)\n return self.game",
"def join_game(game_id, name):\n name = name or generate_player_name()\n game_data = load_state(game_id)\n if not game_data:\n return None\n if game_data['active']:\n return None\n ... | [
"0.7661626",
"0.74558544",
"0.7195359",
"0.7126481",
"0.68551546",
"0.679203",
"0.67057157",
"0.66459024",
"0.6494704",
"0.64837074",
"0.6400737",
"0.633987",
"0.6150461",
"0.57934856",
"0.5774604",
"0.5773208",
"0.5761066",
"0.5674457",
"0.56051105",
"0.5584419",
"0.5577556"... | 0.8584529 | 0 |
Play a random number in the current game | def play_random_number (self):
if (self.cur_game_secret == ""):
print ("ERROR: No current game, join a game.")
return 1
play_value = self.hand.pop (random.randint (0, len (self.hand) - 1))
r = requests.post (self.url_endpoint, data = {"play_game": True, "game_name": self... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def play_game():\n pass",
"def play_card(self, rnd: PlayerRound) -> int:\n # play random\n\n # get the valid cards to play\n valid_cards = rnd.get_valid_cards()\n\n # select a random card\n return np.random.choice(np.flatnonzero(valid_cards))",
"def play_against_random... | [
"0.67719114",
"0.6715166",
"0.65946126",
"0.657753",
"0.6477629",
"0.64705646",
"0.64638734",
"0.6418923",
"0.63751155",
"0.63736075",
"0.6312471",
"0.6293785",
"0.62644374",
"0.62609655",
"0.6227182",
"0.62094754",
"0.61644715",
"0.6161215",
"0.6155693",
"0.6143119",
"0.6083... | 0.73658437 | 0 |
Create the file if it does not exist The file name or directory after the main_work_directory is needed | def createFile(file):
file_ = os.path.join(os.getcwd(),file)
if not(os.path.isfile(file_)):
with open(file_,"a") as f:
f.close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_file_if_needed(self):\n if not os.path.exists(self._file.filename()):\n old_umask = os.umask(0o177)\n try:\n open(self._file.filename(), 'a+b').close()\n finally:\n os.umask(old_umask)",
"def create_file(self, content=\"\"):\n ... | [
"0.73009753",
"0.7079987",
"0.68976206",
"0.68703544",
"0.6857016",
"0.68501914",
"0.6773079",
"0.6750972",
"0.67404485",
"0.6667307",
"0.66664904",
"0.66058165",
"0.65952826",
"0.6595119",
"0.6497435",
"0.64764035",
"0.6461944",
"0.64312977",
"0.6428579",
"0.6413308",
"0.639... | 0.7875238 | 0 |
This function is to remove duplicates of csv file that stores all links | def unqiueList(csvfile):
links_array = genfromtxt(getFulldirAddress(csvfile), delimiter='\n', dtype="unicode")
links_array_2 = np.unique(links_array)
np.savetxt(getFulldirAddress(csvfile), links_array_2, fmt='%s') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_dupes(infile):\n filename = infile.replace('.csv', '-unique.csv')\n s = set()\n with open(filename, 'w') as outfile:\n for line in open(infile):\n if line not in s:\n outfile.write(line)\n s.add(line)",
"def removeDuplicateUrl(inputfile, outputf... | [
"0.7300982",
"0.7081345",
"0.67904526",
"0.65356153",
"0.63604176",
"0.6315184",
"0.62329036",
"0.6186843",
"0.61564404",
"0.61082506",
"0.6049242",
"0.5962678",
"0.5925597",
"0.5874987",
"0.58611417",
"0.58346677",
"0.5809679",
"0.57887757",
"0.5729091",
"0.5712264",
"0.5684... | 0.72341794 | 1 |
Ingests temperature and precipitation values for nClimDiv datasets. Uses a matching soil constants file from open source indices_python github repository. | def _ingest_netcdf(output_netcdf, # pragma: no cover
release_date,
temp_var_name,
precip_var_name,
awc_var_name):
try:
# parse the soil constant (available water capacity)
soil_url = 'https://raw.githubuse... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def readFiles(opt, path, pathCopyData,minlat, maxlat, minlon, maxlon , variables, estaciones):\n date = '\\d\\d\\d\\d-\\d\\d-\\d\\d'\n dirr = pathCopyData\n patron2 = re.compile(date)\n print(dirr + 'tfile.txt')\n tempfile = df.read_csv(dirr + 'tfile.txt')\n tempbase = df.read_csv(dirr + 'tbase.t... | [
"0.5458172",
"0.544506",
"0.5209446",
"0.5198056",
"0.51781434",
"0.51172733",
"0.5074061",
"0.50648355",
"0.50631434",
"0.5045619",
"0.50367564",
"0.50034976",
"0.5003238",
"0.5000506",
"0.49836215",
"0.49703583",
"0.4964933",
"0.49271986",
"0.49256334",
"0.4920216",
"0.4889... | 0.6332168 | 0 |
get valid direcitons by action | def _get_valid_directions(self, turn, action):
if not isinstance(action, Action):
raise TypeError("Action must be Action class")
if action.x < 0 or action.x > 7 or action.y < 0 or action.y > 7:
raise Exception("You must set disk in board.")
if self.board[action.x][actio... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _needaction_domain_get(self):\n return [('name','!=',False)]",
"def valid_actions(self) -> List[str]:\n return list(self.action_map().keys())",
"def getAction(self, state):\n \"*** YOUR CODE HERE ***\"\n x, y = state.getPacmanPosition(self.index)\n numPacmen = state.getNu... | [
"0.5468673",
"0.54495037",
"0.5311105",
"0.5310429",
"0.5265401",
"0.5223957",
"0.5167855",
"0.51475793",
"0.51320946",
"0.5081162",
"0.50440097",
"0.50379986",
"0.49994648",
"0.49994648",
"0.49994648",
"0.49994648",
"0.49954423",
"0.49549085",
"0.49456745",
"0.49088195",
"0.... | 0.6010672 | 0 |
register function as agent actor | def agent_actor(self, func):
if len(self.agents) is 2:
raise Exception("You cannot register 3 or more agents.")
self.agents.append(func)
return func | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def agentbehavior1():\n gr = register_message()\n\n pass",
"def _register_agent(self) -> None:\n strategy = cast(Strategy, self.context.strategy)\n description = strategy.get_location_description()\n self._register(description, \"registering agent on SOEF.\")",
"def register(self):\n... | [
"0.6673103",
"0.65623486",
"0.6539472",
"0.6514525",
"0.6410053",
"0.6113836",
"0.6079823",
"0.60349107",
"0.59799165",
"0.5877702",
"0.5860427",
"0.58369124",
"0.5813449",
"0.5748822",
"0.568736",
"0.5673512",
"0.566552",
"0.5624594",
"0.5615585",
"0.5604878",
"0.55964804",
... | 0.7703901 | 0 |
regiseter function as renderer | def renderer(self, func):
self.renderers.append(func)
return func | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render(self):",
"def render(self):\n pass",
"def render(self):\n pass",
"def render(self):\n pass",
"def render(self):\n pass",
"def render(self):\n pass",
"def render(self):\n pass",
"def dspyRender(self):\n pass",
"def render(self, renderer, ri... | [
"0.7153093",
"0.68493503",
"0.68493503",
"0.68493503",
"0.68493503",
"0.68493503",
"0.68493503",
"0.67106134",
"0.6558736",
"0.64851606",
"0.647033",
"0.64371425",
"0.6435466",
"0.6386689",
"0.6374712",
"0.6264179",
"0.62263614",
"0.62246114",
"0.6217402",
"0.6178282",
"0.610... | 0.69676054 | 1 |
Changes the state of a cell to 'dead' (deletes it from _state) | def die(self, cell: Position):
self._next_state.remove(cell) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setToDead(self, state=DeadState()):\n if len(self._lastStates) > 5:\n self._lastStates.pop(0)\n self._lastStates.append(self._state)\n self._state = state\n self._nextState = self._state\n return self._state",
"def just_died(self):\r\n self.dead = True",
... | [
"0.7117927",
"0.6882622",
"0.67887944",
"0.6527977",
"0.63036853",
"0.62571025",
"0.61986595",
"0.6177285",
"0.6154865",
"0.61490744",
"0.61047286",
"0.6075287",
"0.6068681",
"0.5937211",
"0.59354275",
"0.5935308",
"0.5922249",
"0.5892255",
"0.5870188",
"0.58586854",
"0.58119... | 0.7240025 | 0 |
Checks if a given cell is alive or not. | def is_alive(self, cell: Position) -> bool:
return cell in self._state | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _should_cell_live(self, cell: Cell) -> bool:\n living_neighbours_count = self._count_living_neighbors(cell)\n # Any live cell with two or three live neighbours survives\n if cell.is_alive and living_neighbours_count in [2, 3]:\n return True\n # Any dead cell with three li... | [
"0.7732439",
"0.7323605",
"0.72250414",
"0.70527005",
"0.68661433",
"0.6856171",
"0.68087983",
"0.67438215",
"0.6720457",
"0.6720003",
"0.6717379",
"0.6694156",
"0.6650826",
"0.6636511",
"0.6630166",
"0.6612319",
"0.6587549",
"0.65421706",
"0.6487532",
"0.6472208",
"0.6469954... | 0.8583199 | 0 |
Returns coordinates of all neighbours of a given cell. | def get_neighbours(self, cell: Position) -> Iterable[Position]:
x, y = cell
return [
(x - 1, y - 1), (x, y - 1), (x + 1, y - 1),
(x - 1, y), (x + 1, y),
(x - 1, y + 1), (x, y + 1), (x + 1, y + 1),
] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_neighbours(self, cell):\n\t\tx,y = cell.find_id()\n\t\tlength = self.space.shape[1]\n\t\twidth = self.space.shape[0]\n\t\tif (length == 0 or width == 0 or x < 0 or x >= length or y < 0 or y >= width):\n\t\t\treturn []\n\t\tneighs = [(i,j) for i in range(y-1,y+2) if 0<=i<width for j in range(x-1,x+2) if 0<=... | [
"0.82961637",
"0.7774539",
"0.77439696",
"0.77102953",
"0.7669595",
"0.76490885",
"0.76151395",
"0.7545304",
"0.7466637",
"0.74308044",
"0.7411153",
"0.7390729",
"0.7387905",
"0.73723334",
"0.73409045",
"0.7315632",
"0.7302817",
"0.7294805",
"0.72876567",
"0.72745216",
"0.718... | 0.88792723 | 0 |
Version 2 Counts the number of alive cells around a given cell. | def get_neighbours_count(self, cell: Position) -> int:
possible_neighbours = self.get_neighbours(cell)
return sum(self.is_alive(n) for n in possible_neighbours) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _count_living_neighbors(self, cell: Cell) -> int:\n count = 0\n # borders of the area in which we are trying to find neighbors\n # Let's assume y axis directs downside and x axis directs to the left\n \n for x in range(cell.x - 1, cell.x + 2):\n for y in range(cell... | [
"0.7672008",
"0.76624143",
"0.7382347",
"0.7139768",
"0.7037743",
"0.69860864",
"0.69566",
"0.6810786",
"0.6799832",
"0.6796467",
"0.6747899",
"0.6627136",
"0.6614573",
"0.6529785",
"0.6528386",
"0.64564586",
"0.6418126",
"0.638742",
"0.6342964",
"0.6341502",
"0.634074",
"0... | 0.80764383 | 0 |
Log the test method name at the information level | def logTestName(self):
logging.info('%s', self.id()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testCaseInfo(self):\n print(\"Override method..\")",
"def _log_some_info(self):\n logging.info('info')",
"def function_name(func):\n return log(level=\"info\", message=_function_name(func))",
"def _info(self, func):\n self.logger.info(\"llamando a %s\" % func)",
"def test_case(self)... | [
"0.6939496",
"0.6753157",
"0.67056024",
"0.6593296",
"0.655111",
"0.65080243",
"0.63936245",
"0.63719064",
"0.63291377",
"0.62749195",
"0.6237274",
"0.6226717",
"0.6113689",
"0.60864156",
"0.6064637",
"0.6063154",
"0.60485363",
"0.6036148",
"0.6035138",
"0.60232055",
"0.60160... | 0.7718581 | 0 |
Check the target. Create the directory if it does not exists. Remove the file if it exists. | def check_output(self):
directory, file = split(self.target)
if not exists(directory):
mkdir(directory)
if exists(self.target):
unlink(self.target) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _prepare_target_dir(file_path: Path):\n if os.path.isfile(file_path):\n delete = input(f\"File '{file_path.resolve()}' exists. Delete? (Y/n) \")\n if delete == \"Y\":\n os.remove(file_path)\n logging.info(\"File removed.\")\n else:\n logging.info(\"Won't... | [
"0.76190555",
"0.6762315",
"0.66105056",
"0.6576535",
"0.6568848",
"0.64974195",
"0.6490682",
"0.6441938",
"0.6410524",
"0.6340638",
"0.63112664",
"0.62681997",
"0.6213513",
"0.6172672",
"0.6133321",
"0.6117379",
"0.61134595",
"0.61049193",
"0.60567",
"0.6047739",
"0.6032793"... | 0.79120916 | 0 |
Call 'lame' to convert the source into target. | def convert(self):
#lame --mp3input --silent -h -b BITRATE SOURCE TARGET
self.success = False
command = ['lame', '-h', '--silent']
command.append('-b ' + str(self.bitrate))
command.append(self.source)
command.append(self.target)
msg('command', command)
err... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run():\n renanme_action()\n\n write_anim()\n alc.save_file()",
"def remix(self):\n self.original = audio.LocalAudioFile(self.infile)\n #for i, segment in enumerate(self.original.analysis.segments):\n # segment.encode(\"seg_%s.mp3\" % i)\n print \"\\n\\n\\n\"\n l... | [
"0.50153357",
"0.50003153",
"0.49708053",
"0.49008447",
"0.48989916",
"0.48274243",
"0.47542843",
"0.46465498",
"0.4634066",
"0.46137536",
"0.45959595",
"0.4591142",
"0.45887837",
"0.45870468",
"0.45831475",
"0.45617545",
"0.45598978",
"0.4540805",
"0.45056278",
"0.44987753",
... | 0.75757915 | 0 |
Print the conversion command. | def print_command(self):
self.success = False
command = ['lame', '-h', '--silent']
command.append('-b ' + str(self.bitrate))
command.append(self.source)
command.append(self.target)
print(' '.join(command)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cmdPrint( self, *args):\n return self.cmd( *args, **{ 'verbose': True } )",
"def print_cmd(ctx, klass=None):\n connecter = ScalingoInterface(ctx.obj)\n connecter.print_cmd()",
"def print_out():\n pass",
"def to_string(self):\r\n return self.command()",
"def result_display(sel... | [
"0.6848495",
"0.66727597",
"0.63724464",
"0.6287818",
"0.62833863",
"0.6276899",
"0.6276899",
"0.6243502",
"0.6141594",
"0.6130643",
"0.61209077",
"0.6089271",
"0.60720986",
"0.6064459",
"0.60399777",
"0.6034725",
"0.60216033",
"0.599648",
"0.59858876",
"0.59689856",
"0.59606... | 0.67482394 | 1 |
Create a list of tasks to convert each file in 'from_dir' to a file in 'to_dir'. The leaf directory name is appended to 'to_dir' to create the target file name. | def create_tasks(from_dir, to_dir):
try:
tasks = []
source_files = list_directory(from_dir)
dir_name = get_last_dir(from_dir)
print('dir_name', dir_name)
for file in source_files:
source = join(from_dir, file)
target = join(to_dir, dir_name, file)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def task():\n if os.path.isdir(orig):\n for fP in [ fP for fP in glob.glob(os.path.join(orig, '*-*/*')) if \\\n os.path.isdir(fP) ]:\n if not os.path.exists(dest + fP[len(orig):]):\n os.makedirs(dest + fP[len(orig):])\n for fP in [ fP for fP in glob.glob(os.path.join(orig, '*-*/*/... | [
"0.7332554",
"0.6948502",
"0.6218275",
"0.595692",
"0.5839352",
"0.5757753",
"0.57038224",
"0.56779176",
"0.5652623",
"0.5578878",
"0.5547265",
"0.54988056",
"0.5482269",
"0.54351574",
"0.53682166",
"0.5311556",
"0.5300187",
"0.529343",
"0.5276933",
"0.5270991",
"0.5238482",
... | 0.80804676 | 0 |
Get the name of the last directory in the path. | def get_last_dir(path):
head, tail = split(path)
while not tail:
head, tail = split(head)
return tail | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_dirname(self, dirpath):\n return dirpath.split('/')[-1]",
"def get_last_part_of_path(path: str) -> str:\n multi_os_path = path.replace(\"\\\\\", \"/\")\n return re.search(\"(?:[^/](?!/))+$\", multi_os_path).group(0)",
"def get_leafname(path):\n\n\tpos = string.rfind(path, os.sep)\n\tif pos... | [
"0.7505416",
"0.74623406",
"0.74319196",
"0.73088986",
"0.7307475",
"0.7292277",
"0.7252292",
"0.7176553",
"0.71378094",
"0.7074937",
"0.7073228",
"0.7056331",
"0.70458376",
"0.70192856",
"0.6981031",
"0.69700545",
"0.69595456",
"0.6891311",
"0.6724386",
"0.67243403",
"0.6723... | 0.83793795 | 0 |
Print the argument list, if messages are enabled. | def msg(*args):
if messages_on:
print(*args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_args():\r\n args = \", \".join(sys.argv)\r\n print(\"pfArgs: \" + args)",
"def print_args():\n for key, value in vars(ARGS).items():\n print(key + ' : ' + str(value))",
"def _p(self, *args, level=2, **kwargs):\n if self._verbosity >= level:\n print(*args, **kwargs)",... | [
"0.6971768",
"0.67458904",
"0.6694167",
"0.6375415",
"0.632234",
"0.6310823",
"0.62469834",
"0.61811984",
"0.6164702",
"0.61581194",
"0.6086061",
"0.6059611",
"0.60574204",
"0.60503286",
"0.6039692",
"0.60293937",
"0.59743184",
"0.59670794",
"0.59340376",
"0.5925582",
"0.5907... | 0.75241137 | 0 |
Verify that the token is mapped with an leave request. | def _check_leave_request(self, cr, uid, request, token, context=None):
holidays_obj = request.registry['hr.holidays']
holidays_ids = holidays_obj.search(cr, uid, [
('token', '=', token)
])
if len(holidays_ids) == 0:
return request.website.render(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def leave_request_decline(self, token, **kwargs):\n cr, uid, context = self._get_cr_uid_context()\n res = self._check_leave_request(\n cr, uid, request, token, context=context\n )\n if isinstance(res, http.Response):\n return res\n if res:\n res.s... | [
"0.6704487",
"0.6437914",
"0.6411729",
"0.6111032",
"0.6050588",
"0.59361327",
"0.5914343",
"0.57987326",
"0.5751445",
"0.57407093",
"0.57377267",
"0.5708885",
"0.56781447",
"0.56609726",
"0.5640214",
"0.56348395",
"0.56014645",
"0.5599922",
"0.5575192",
"0.55741096",
"0.5570... | 0.674709 | 0 |
Accept the leave request | def leave_request_accept(self, token, **kwargs):
cr, uid, context = self._get_cr_uid_context()
res = self._check_leave_request(
cr, uid, request, token, context=context
)
if isinstance(res, http.Response):
return res
if res:
res.signal_workflow... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def leave_request_decline(self, token, **kwargs):\n cr, uid, context = self._get_cr_uid_context()\n res = self._check_leave_request(\n cr, uid, request, token, context=context\n )\n if isinstance(res, http.Response):\n return res\n if res:\n res.s... | [
"0.6880239",
"0.6516881",
"0.6185665",
"0.61551434",
"0.6062611",
"0.6054114",
"0.60301316",
"0.5909732",
"0.5860862",
"0.58154184",
"0.5806893",
"0.5784919",
"0.56871283",
"0.5668547",
"0.56303436",
"0.5545764",
"0.5517316",
"0.54911333",
"0.54911333",
"0.5460764",
"0.545767... | 0.74375314 | 0 |
Refuse the leave request | def leave_request_decline(self, token, **kwargs):
cr, uid, context = self._get_cr_uid_context()
res = self._check_leave_request(
cr, uid, request, token, context=context
)
if isinstance(res, http.Response):
return res
if res:
res.signal_workflo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def leave(self):\n self.pleaseQuit=1",
"def on_leave(self):\n\n self.check_connection.cancel()",
"def leave(self):\n self.__alive = False\n self.__successor = self\n self.__successor_next = self",
"def _leave(self, *args):\n if not self.game:\n raise ServerExc... | [
"0.70730305",
"0.6811757",
"0.6799905",
"0.6524368",
"0.63409483",
"0.63367146",
"0.63284117",
"0.62440395",
"0.6219235",
"0.6180015",
"0.6151843",
"0.614144",
"0.6127388",
"0.61022913",
"0.6079791",
"0.607551",
"0.60644406",
"0.6062947",
"0.60620743",
"0.60315233",
"0.602959... | 0.7075348 | 0 |
Thinning image using morphological operations | def thinning_morph(image, kernel):
thining_image = np.zeros_like(image)
img = image.copy()
while 1:
erosion = cv.erode(img, kernel, iterations = 1)
dilatate = cv.dilate(erosion, kernel, iterations = 1)
subs_img = np.subtract(img, dilatate)
cv.bitwise_or(thining_image, subs_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def thinning (input_path, output_path):\n if os.path.exists(output_path):\n shutil.rmtree(output_path)\n os.makedirs(output_path)\n img_fn_list = get_images(input_path)\n epsilon = 0.0001\n for img_fn in img_fn_list:\n print('===============')\n print(img_fn)\n start = ti... | [
"0.7514813",
"0.65897703",
"0.6360056",
"0.6171215",
"0.6054021",
"0.60341424",
"0.5943268",
"0.5903157",
"0.5851343",
"0.5834294",
"0.58272",
"0.5822836",
"0.5783079",
"0.57600325",
"0.57185334",
"0.57183504",
"0.57124734",
"0.5712307",
"0.5708888",
"0.57082224",
"0.57026327... | 0.69837624 | 1 |
return the document viewer | def viewer(self):
return self.parent | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getViewer(self, v_id=-1) -> Viewer:\n viewer_ctrl = self.getViewerController(v_id)\n if viewer_ctrl is None:\n return None\n return viewer_ctrl.view",
"def getSceneviewer(self):\n return self._sceneviewer",
"def __newDocumentView(self):\n aw = self.activeWindow... | [
"0.69375134",
"0.69163793",
"0.6853111",
"0.67617315",
"0.6756576",
"0.6754555",
"0.6550173",
"0.6465868",
"0.6302576",
"0.6270481",
"0.62411624",
"0.6146605",
"0.6146425",
"0.60257083",
"0.6004018",
"0.59994894",
"0.59861445",
"0.5976136",
"0.59636796",
"0.59499943",
"0.5945... | 0.7425443 | 0 |
On total lines changed | def updateTotalLines(self):
self.viewer().TotalLinesChanged.emit( self.editor().lines() ) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _dig_line_count_changed(self, text):\n self._setup_table_digital()",
"def _changedlines(self, changedlines):\n self.changedlines = changedlines\n self.before = self.context\n self.context = []",
"def update(self, line):",
"def cb_update_line_numbers(data, signal, s... | [
"0.7203833",
"0.6602556",
"0.6500687",
"0.6306492",
"0.61856705",
"0.6170643",
"0.6146898",
"0.6140344",
"0.6085471",
"0.6069593",
"0.6003475",
"0.5908536",
"0.5886867",
"0.58802915",
"0.583377",
"0.5828164",
"0.5817332",
"0.5803678",
"0.5741449",
"0.5721413",
"0.56738824",
... | 0.7786801 | 0 |
Emit signal from parent to update the position of the cursor | def onCursorPositionChanged (self , ln, col):
self.viewer().CursorPositionChanged.emit( ln, col ) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mousePressEvent(self, event):\n self.begin = event.pos()\n self.end = event.pos()\n self.update()",
"def mouseMoveEvent(self, event):\n self.end = event.pos()\n self.update()",
"def moveCursor(self):\n\n\t\tself._before = self.rect.center\n\t\tself.rec... | [
"0.7106103",
"0.65444225",
"0.6542953",
"0.6539708",
"0.6421766",
"0.63098747",
"0.6277237",
"0.6269175",
"0.62403893",
"0.6239031",
"0.62021893",
"0.6195149",
"0.6182977",
"0.6173183",
"0.6135628",
"0.6033672",
"0.5999649",
"0.5986024",
"0.5984097",
"0.59757787",
"0.59611",
... | 0.6663372 | 1 |
Active or deactivate the lines numbering | def setLinesNumbering (self, visible):
if visible:
self.srcEditor.setMarginLineNumbers(1, visible)
self.srcEditor.onLinesChanged()
else:
self.srcEditor.setMarginLineNumbers(1, visible)
self.srcEditor.setMarginWidth(1, 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def toggleLineNumbering(self, checked):\n self.lineNumbering = checked\n for tabId in xrange( self.tab.count() ):\n doc = self.tab.widget(tabId)\n # bypass the welcome page\n if isinstance(doc, WelcomePage):\n continue\n # end of bypass\n ... | [
"0.715932",
"0.71021974",
"0.6928087",
"0.6304502",
"0.61044735",
"0.6058214",
"0.58346593",
"0.57963574",
"0.57231426",
"0.57112205",
"0.57014596",
"0.5667571",
"0.5618884",
"0.5568091",
"0.5567257",
"0.55642784",
"0.5552298",
"0.5506729",
"0.5483577",
"0.54285765",
"0.53866... | 0.7129927 | 1 |
Active or deactivate indentation guides visibility | def setIndentationGuidesVisible (self, visible):
if visible:
self.srcEditor.setIndentationGuidesVisible(visible)
else:
self.srcEditor.setIndentationGuidesVisible(visible) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def toggleIndentGuidesVisibility(self, checked):\n self.indentationGuidesVisible = checked\n for tabId in xrange( self.tab.count() ):\n doc = self.tab.widget(tabId)\n # bypass the welcome page\n if isinstance(doc, WelcomePage):\n continue\n #... | [
"0.765902",
"0.756237",
"0.64416647",
"0.61077577",
"0.60643417",
"0.60643417",
"0.605182",
"0.6029787",
"0.59826225",
"0.5865516",
"0.5814423",
"0.5500346",
"0.54570514",
"0.5425387",
"0.5388049",
"0.5363415",
"0.532164",
"0.51982653",
"0.5184068",
"0.516022",
"0.516022",
... | 0.7604601 | 1 |
Called when focus on editors Emit the signal "focusChanged" | def focusChanged (self):
weditor = QApplication.focusWidget()
if isinstance(weditor, PyEditor):
if weditor.editorId == self.TEST_DATA_EDITOR:
self.viewer().findWidget.setEditor( editor = self.srcEditor)
self.viewer().FocusChanged.emit(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def focus_changed(self):\r\n fwidget = QApplication.focusWidget()\r\n for finfo in self.data:\r\n if fwidget is finfo.editor:\r\n self.refresh()",
"def changedFocusSlot(self, old, now):\n if self.focusWidget():\n self.focusWidget().installEventFilter(self... | [
"0.7528211",
"0.70036095",
"0.69637966",
"0.6493235",
"0.6487977",
"0.64844894",
"0.6407414",
"0.6407414",
"0.6407414",
"0.6407414",
"0.6306348",
"0.6266443",
"0.6196158",
"0.611592",
"0.60014147",
"0.59973145",
"0.5948752",
"0.59431016",
"0.59339786",
"0.59243387",
"0.575966... | 0.7537676 | 0 |
Set the default cursor position | def setDefaultCursorPosition(self):
self.srcEditor.setFocus()
self.srcEditor.setCursorPosition(0,0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_cursor_position(self, x: int, y: int) -> None:\n self.screen.move(y, x)",
"def change_cursor(self, cursor):\n self.setCursor(cursor)",
"def set_cursor_default(self, widget=None):\n logger.debug(\"Setting cursor to default. widget: %s\", widget)\n widget = self.root if widget... | [
"0.7599676",
"0.75060236",
"0.73707634",
"0.7345042",
"0.73390526",
"0.73276865",
"0.71844566",
"0.7176274",
"0.70245934",
"0.69838053",
"0.69177216",
"0.69093466",
"0.68998706",
"0.6859215",
"0.6852698",
"0.6690307",
"0.66542625",
"0.6634238",
"0.66124254",
"0.65964746",
"0.... | 0.8522591 | 0 |
Return how many hours, rounded to 2 decimals, Python 2 has left on Planet Earth (calculated from start_date) | def py2_earth_hours_left(start_date=BITE_CREATED_DT):
td = (PY2_DEATH_DT - start_date)
return round((td.days*24 + td.seconds/3600), 1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def py2_earth_hours_left():\r\n left = PY2_RETIRED_DT - BITE_CREATED_DT\r\n left_earth_hours = round(left.total_seconds()/3600,2)\r\n\r\n return left_earth_hours",
"def get_time_delta_in_hours(start, end):\n dhour = end.hour - start.hour\n dmin = end.minute - start.minute\n dsec = e... | [
"0.7207195",
"0.6741372",
"0.6569625",
"0.64889026",
"0.6452905",
"0.6452884",
"0.64516276",
"0.6404332",
"0.6370794",
"0.63112926",
"0.61538273",
"0.61222947",
"0.6121003",
"0.61137897",
"0.608259",
"0.60218483",
"0.60139096",
"0.6005377",
"0.59297705",
"0.58832794",
"0.5881... | 0.7106655 | 1 |
function loads a random images from a random folder in our test path | def getRandomImage(path):
folders = list(filter(lambda x: os.path.isdir(os.path.join(path, x)), os.listdir(path)))
random_directory = np.random.randint(0,len(folders))
path_class = folders[random_directory]
print("Class - " + five_celeb_dict_n[str(path_class)])
file_path = path + path_class
file... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_image():\n img_dir = \"./static\"\n img_list = os.listdir(img_dir)\n img_path = os.path.join(img_dir, random.choice(img_list))\n return img_path",
"def get_rand_img():\n import urllib\n import os\n import glob\n\n pics = glob.glob('/home/cody_techngs/PycharmProjects/ProjTest/Ac... | [
"0.7551531",
"0.7279827",
"0.6884776",
"0.67798495",
"0.67052203",
"0.6687566",
"0.66579896",
"0.66472167",
"0.6636999",
"0.66174686",
"0.6566692",
"0.6547921",
"0.6532665",
"0.65265673",
"0.6523696",
"0.64311254",
"0.6420229",
"0.6414222",
"0.6388513",
"0.6381001",
"0.637737... | 0.7617784 | 0 |
Given an spotify track id, returns the audio features from the api | def get_song_features(tid):
# dictionary of features to return
spotify_track_data = SpotifyData[tid]
features = {}
features['name'] = spotify_track_data.name
features['artists'] = spotify_track_data.artists
features['popularity'] = spotify_track_data.popularity
features['album'] = spotify_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_spotify_features(search):\n\t\n\t# Configure API credentials\n\tclient_credentials_manager = SpotifyClientCredentials(client_id=config.SPOTIFY_CID, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\tclient_secret=config.SPOTIFY_SECRET)\n\tsp = spotipy.Spotify(client_credentials_manager = client_credentials_manager)\n\t\n\t# Fi... | [
"0.7792372",
"0.71938753",
"0.7018876",
"0.6849401",
"0.6807805",
"0.66801125",
"0.65858024",
"0.6479527",
"0.6410977",
"0.64090264",
"0.63816774",
"0.6330502",
"0.6310716",
"0.6288286",
"0.62875885",
"0.62578976",
"0.60792536",
"0.60729116",
"0.6036491",
"0.5983391",
"0.5981... | 0.7500363 | 1 |
Given a list of seed track ids and candidate_tids returns a dataframe summarizing the differences between each candidate track's features and seed features. | def compute_df_features(seed_tids, candidate_tids, relevences):
seed_features = compute_seedset_features(seed_tids)
# drop candidate songs w/0 all features
candidate_df = get_features_dataframe(candidate_tids)
candidate_df['relevence'] = relevences
candidate_df.dropna(axis=0)
df = {}
df['re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_seedset_features(tids):\n seed_dataframe = get_features_dataframe(tids)\n summary_feats = {}\n summary_feats['names'] = list(seed_dataframe['name'])\n summary_feats['artists'] = list(\n itertools.chain.from_iterable(seed_dataframe['artists'])\n )\n summary_feats['albums'] = lis... | [
"0.6472781",
"0.6158789",
"0.5906265",
"0.54349333",
"0.54249525",
"0.51813656",
"0.51468873",
"0.51135445",
"0.49663937",
"0.4961182",
"0.49079064",
"0.49037227",
"0.4902718",
"0.4884296",
"0.48739198",
"0.48463288",
"0.4835363",
"0.48272344",
"0.482661",
"0.4811474",
"0.479... | 0.74968517 | 0 |
Given an input playlist and factors computed from stage 1, returns a df for stage 2 | def compute_df(playlist, song_factors, playlist_factors=None, method='ensemble'):
playlist = playlist.str.replace('spotify:track:', '')
playlist_set = set(playlist)
seed_ids = []
while len(seed_ids) < 2:
rand = list(playlist.sample(n=1))[0]
if rand in tid_to_idx and rand not in seed_ids:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_df_playlist(api_results,sp = None, append_audio = True):\r\n df = create_df_saved_songs(api_results[\"tracks\"])\r\n if append_audio == True:\r\n assert sp != None, \"sp needs to be specified for appending audio features\"\r\n df = append_audio_features(df,sp)\r\n return df",
"d... | [
"0.6053288",
"0.5691462",
"0.5527055",
"0.55186474",
"0.5355124",
"0.52818215",
"0.520463",
"0.5169522",
"0.51587737",
"0.5151688",
"0.51458937",
"0.5117981",
"0.5104984",
"0.5068347",
"0.50469536",
"0.50429755",
"0.5041572",
"0.5026257",
"0.5013502",
"0.49976748",
"0.4991693... | 0.6845031 | 0 |
Updates all FixedAssets data (in FA_DATA directory) for user defined year and frequency | def update_all_fa(year, frequency):
failed_dict = {}
mb_remaining = 100
requests_remaining = 100
fa_table_ids = pybea.get_parameter_values(UserID, 'FixedAssets', ParameterName='TableName', ResultFormat='JSON')
tablenames = fa_table_ids['TableName'].values
for x in tablenames:
temp = py... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_fa(tablenames, frequency, year):\n failed_dict = {}\n mb_remaining = 100\n requests_remaining = 100\n\n for x in tablenames:\n print(x)\n temp = pybea.get_data(UserID, 'FixedAssets', TableName=x, Frequency=frequency, Year=year)\n size = sys.getsizeof(temp) / 1000000\n ... | [
"0.6209893",
"0.6189374",
"0.60861397",
"0.5450324",
"0.54325956",
"0.5320851",
"0.5301557",
"0.5278848",
"0.52665955",
"0.5241639",
"0.5227907",
"0.5178437",
"0.51680624",
"0.5150038",
"0.50933963",
"0.5090828",
"0.50715846",
"0.5067478",
"0.50668526",
"0.503126",
"0.5020451... | 0.6789207 | 0 |
Calculates the dependecy matrix, which is | def calc_dependency_matrix(encoder: nn.Module, latents: torch.Tensor) -> torch.Tensor:
# calculate the jacobian
jacob = jacobian(encoder.forward, latents)
# take the absolute value
return jacob.abs() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decoherence(self,system):\n for i in range(self.n):\n for j in range(i,self.n):\n for item in self.decoherence_matrix[i][j]:\n tmp=Expolist([Expo(item[2],0)])\n t = int(self.index(item[0],item[1]))\n system[int(self.index... | [
"0.6056143",
"0.586802",
"0.58234936",
"0.5677216",
"0.56426907",
"0.56066704",
"0.56030965",
"0.55682796",
"0.5565402",
"0.55227166",
"0.5503907",
"0.54893047",
"0.5426093",
"0.5422756",
"0.541555",
"0.54099625",
"0.5407855",
"0.5392639",
"0.53858066",
"0.5381336",
"0.536226... | 0.63176143 | 0 |
Nonnested view of the unfaceted_array_of_objects field | def non_nested_array_of_objects(self, unfaceted_array_of_objects):
return unfaceted_array_of_objects | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def objectFields(self):\n raise NotImplementedError",
"def iflatten(self):\n return _((e for es in self.array for e in es))",
"def _get_embedded_objects(self):\n return [getattr(self, name) for name, field in self._get_fields().items() if isinstance(field, fields.Object)]",
"def do_flatten(o... | [
"0.6074154",
"0.5800832",
"0.5692128",
"0.5534284",
"0.54768306",
"0.54336363",
"0.54329735",
"0.54007703",
"0.538946",
"0.53849775",
"0.5372095",
"0.53356856",
"0.53252435",
"0.5293318",
"0.52790385",
"0.5278998",
"0.5253122",
"0.5250943",
"0.5238906",
"0.5227962",
"0.520917... | 0.77682173 | 0 |
Load image from file and perform preprocessing. Args | def _load_preprocess_image(self, image_file):
image_raw = tf.io.read_file(image_file)
image = self._preprocess_image(image_raw)
return image | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _load_preprocess_image(self, image_file):\n\n image_raw = tf.io.read_file(image_file)\n\n image = self._preprocess_image(image_raw)\n\n return image",
"def pre_processing_function(label, filename: str, augmentor: Augmentor = None):\n image = imread(filename)\n if augmentor is not N... | [
"0.7445202",
"0.7336954",
"0.732776",
"0.68389344",
"0.67588747",
"0.6732957",
"0.6699492",
"0.6671857",
"0.6556289",
"0.6554106",
"0.65509486",
"0.64734775",
"0.64721584",
"0.64554745",
"0.6452393",
"0.6435409",
"0.6434359",
"0.6419279",
"0.6392069",
"0.63866806",
"0.636376"... | 0.7423453 | 1 |
Generate the trainingholdout folds from a set of splits. Args | def _get_folds(self, splits):
train = [splits.copy() for i in range(self.n_splits)]
holdout = [train[i].pop(i) for i in range(self.n_splits)]
train_flat = [list(chain(*row)) for row in train]
return list(zip(train_flat, holdout)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_folds(train_path,n_splits):\n df = pd.read_csv(train_path, sep = \",\") \n\n df[\"kfold\"] = -1\n\n df = df.sample(frac = 1).reset_index(drop = True)\n\n kf = model_selection.StratifiedKFold(n_splits = n_splits)\n\n for fold,(trn_,val_) in enumerate(kf.split(X = df,y = df.Prediction.value... | [
"0.68464065",
"0.661796",
"0.64245856",
"0.6398819",
"0.63746804",
"0.6372801",
"0.63497585",
"0.6347038",
"0.634233",
"0.6329367",
"0.63166386",
"0.6315036",
"0.63112",
"0.6283015",
"0.6247967",
"0.6247136",
"0.62002194",
"0.6170478",
"0.6168151",
"0.61529356",
"0.615237",
... | 0.7535942 | 0 |
Display sorted results for each metric. Args | def display_results(self, metrics):
for k, v in self.cv_results_.items():
# sorted_results = sort_results(v)
print(f'Results for {k} metric:')
print()
print(v.sort_values(by=['Metric mean'], ascending=False))
print() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort_results(self):\n pass",
"def display_metric(metrics_to_print, results, num_refs, args):\n for metric, result in zip(metrics_to_print, results):\n if metric == 'bleu':\n if args.score_only:\n print('{0:.{1}f}'.format(result.score, args.width))\n else:... | [
"0.70512533",
"0.67428845",
"0.6740514",
"0.66059077",
"0.6381608",
"0.63613796",
"0.6359567",
"0.62953067",
"0.6252458",
"0.6167347",
"0.61356187",
"0.6116705",
"0.6112208",
"0.60608053",
"0.6045988",
"0.60451716",
"0.60379475",
"0.6036549",
"0.60357326",
"0.60313785",
"0.60... | 0.8140085 | 0 |
Builds a dense network. Args | def _build_network(self,
input_dim,
dense_layers,
nodes_per_layer=None,
hidden_act='relu',
output_act='sigmoid',
dropout_layers=None):
if nodes_per_layer is None:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_network(self, inputs, targets, training=False):\n raise NotImplementedError",
"def build_dense(self): # Pass state_size and action_size\n model = Sequential()\n model.add(Dense(24, input_dim = grid_size*grid_size+2, activation = 'relu'))\n model.add(Dense(24, activation = 'r... | [
"0.6853862",
"0.68205714",
"0.67849225",
"0.6764053",
"0.67236805",
"0.66235286",
"0.66105014",
"0.6556568",
"0.65352154",
"0.6469878",
"0.6422112",
"0.63993216",
"0.6319492",
"0.63183075",
"0.63123035",
"0.62499654",
"0.6205989",
"0.62024623",
"0.6172296",
"0.61618066",
"0.6... | 0.6921859 | 0 |
Load image from file and perform preprocessing. Args | def _load_preprocess_image(self, image_file):
image_raw = tf.io.read_file(image_file)
image = self._preprocess_image(image_raw)
return image | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _load_preprocess_image(self, image_file):\n image_raw = tf.io.read_file(image_file)\n\n image = self._preprocess_image(image_raw)\n\n return image",
"def pre_processing_function(label, filename: str, augmentor: Augmentor = None):\n image = imread(filename)\n if augmentor is not Non... | [
"0.74256855",
"0.73369807",
"0.73286986",
"0.6840995",
"0.67607754",
"0.67328",
"0.6700069",
"0.6671392",
"0.65570325",
"0.6555786",
"0.6551207",
"0.6473794",
"0.6472941",
"0.6457876",
"0.64540195",
"0.6435529",
"0.64323664",
"0.6421467",
"0.6393144",
"0.638709",
"0.63641036"... | 0.74474293 | 0 |
Convert raw binary to float64 and scale the pixel values. Args | def _preprocess_image(self, image_raw):
image = tf.io.decode_raw(image_raw, tf.float64)
return image * self.rescale | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize_image(img_arr_uint):\n return img_arr_uint.astype(np.float64) * ONE_BYTE_SCALE",
"def _preprocess_image(self, image_raw):\n\n image = tf.io.decode_raw(image_raw, tf.float64)\n \n if self.rescale is not None:\n image_out = image * self.rescale\n else:\n ... | [
"0.66381794",
"0.6144738",
"0.60239863",
"0.59767365",
"0.59652585",
"0.59652585",
"0.582018",
"0.58109397",
"0.57753944",
"0.5748591",
"0.5741926",
"0.5717114",
"0.56944793",
"0.56926674",
"0.56763875",
"0.56397724",
"0.56142133",
"0.5569439",
"0.55578226",
"0.5540915",
"0.5... | 0.62331146 | 1 |
Get a Path object for an image file. Args | def get_path_image(path_data, label, filename):
return path_data.joinpath(f'label_{label}', filename) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_path_to_image():\n file_types = [\n (\"JPEG Image\", '*.jpeg; *jpg'),\n (\"PNG Image\", '*.png'),\n (\"BPM Image\", '*.bmp'),\n (\"Netpbm Image\", '*.ppm; *.pgm; *.pbm; *pnm')\n ]\n\n GlobalVar.file_path = filedialog.askopenfilename(filetypes=file_types)\n GlobalVar.... | [
"0.68334705",
"0.67055607",
"0.6676877",
"0.6605143",
"0.65452087",
"0.6487829",
"0.6407208",
"0.63472",
"0.63395727",
"0.63245505",
"0.62733346",
"0.62279886",
"0.62067974",
"0.6199286",
"0.61989886",
"0.6193733",
"0.6192277",
"0.61828023",
"0.61645263",
"0.61601126",
"0.612... | 0.6797976 | 1 |
Sort metric performance results by the mean. Args | def sort_results(metric_results):
means, stds, params_list = metric_results
dtype = [('index', int), ('params_list', object), ('std', float), ('mean', float)]
#Sort will fail when attempting to rank based on the
#dictionary 'params_list' when encountering identical mean and
#standard deviations. T... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_sorted_metric(self, *args, **kwargs):\n return sorted(self.fetch_metric(*args, **kwargs).items(),\n key=lambda x: float(x[0]))",
"def display_results(self, metrics):\n\n for k, v in self.cv_results_.items():\n# sorted_results = sort_results(v)\n print(f'Re... | [
"0.66437477",
"0.6032373",
"0.5961712",
"0.5948859",
"0.5929985",
"0.5761439",
"0.575289",
"0.5731947",
"0.5665318",
"0.5618689",
"0.55005497",
"0.54784197",
"0.5470458",
"0.5452049",
"0.5449651",
"0.5446144",
"0.54368585",
"0.54318",
"0.54064316",
"0.540437",
"0.54033154",
... | 0.6717352 | 0 |
Task state handler that timestamps new states and logs the duration between state changes using the task's logger. | def timestamper(task, old_state, new_state):
new_state.timestamp = pendulum.now("utc")
if hasattr(old_state, "timestamp"):
duration = (new_state.timestamp - old_state.timestamp).in_seconds()
task.logger.info(
"{} seconds passed in between state transitions".format(duration)
)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_state(cls, t_state, t_msg):\n cls.state['TASK_STATE'] = t_state\n cls.state['TASK_INFO'] = t_msg\n\n print str(t_state) + ': ' + str(t_msg)\n\n if cls.USE_CELERY:\n # send message to the front end\n current_task.update_state(state=t_state, meta={'result': t... | [
"0.5885212",
"0.58848715",
"0.58534354",
"0.56856",
"0.5671338",
"0.5634042",
"0.56279546",
"0.55943364",
"0.5561087",
"0.55303365",
"0.5510022",
"0.5481808",
"0.5466947",
"0.54583615",
"0.54421115",
"0.5429091",
"0.5358745",
"0.5344362",
"0.53066605",
"0.53047794",
"0.529884... | 0.73996735 | 0 |
Gathers paths and converts to data frames per the arguments provided. Multiple checks are in place to ensure data exists prior to processing. | def gather_data(instance):
paths = [instance.get('file1'), instance.get('file2')]
if Path(instance.get('file1')).parents[0].is_dir() is True and Path(
instance.get('file2')).parents[0].is_dir() is True:
files = [f for f in paths if os.path.isfile(f)]
if len(files) == 0:
r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Collect1DResults(Path, FolderNames, Left, Right, SavePath, OneD,\n fromf='', tof='', FilterbyName = False):\n\n second = \"=pd.DataFrame()\"\n if fromf == '':\n fromf = 0\n\n for i in range(len(FolderNames)):\n print(str(i) + \"-\" + FolderName... | [
"0.6140729",
"0.60189486",
"0.60069317",
"0.5918741",
"0.5903055",
"0.5874215",
"0.57365006",
"0.5694283",
"0.5647274",
"0.5642507",
"0.56362635",
"0.56183475",
"0.5613369",
"0.5595061",
"0.5594611",
"0.5551575",
"0.5548242",
"0.5546088",
"0.55329657",
"0.54976887",
"0.549497... | 0.6369519 | 0 |
Plot the Fourier power spectrum as a function of Fourier period (1/frequency) | def FourierPlot(tas):
detrend = signal.detrend(tas)
L = len(tas)
freqs = np.fft.fftfreq(L)
tas_fft = np.fft.fft(detrend)
R = tas_fft.real
Im = tas_fft.imag
mag = np.sqrt(R**2+Im**2)
plt.plot(1/freqs,mag) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plotSpectrum(y,Fs):\n n = len(y) # length of the signal\n k = arange(n)\n T = n/Fs\n frq = k/T # two sides frequency range\n frq = frq[range(n/2)] # one side frequency range\n\n Y = fft(y)/n # fft computing and normalization\n Y = Y[range(n/2)]\n \n plt.plot(frq,abs(Y),'r') ... | [
"0.7615863",
"0.7419003",
"0.7383069",
"0.7210782",
"0.71881646",
"0.71796924",
"0.7083896",
"0.7013927",
"0.69972104",
"0.69949406",
"0.69703716",
"0.6941302",
"0.6861467",
"0.6775772",
"0.67533875",
"0.67032903",
"0.6698539",
"0.6558969",
"0.65308404",
"0.6506726",
"0.64978... | 0.7869603 | 0 |
Check to see whether the annual cycle is dominant | def annual_cycle_dominant(tas):
detrend = signal.detrend(tas)
L = len(tas)
freqs = np.fft.fftfreq(L)
tas_fft = np.fft.fft(detrend)
R = tas_fft.real
Im = tas_fft.imag
mag = np.sqrt(R**2+Im**2)
the_period = 1./np.abs(freqs[np.argmax(mag)])
return the_period | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_convergence(self, time_step):\n \n ##compare the average episode length between two loop\n if self.past_episode == time_step:\n self.convergence = True\n else:\n self.convergence = False",
"def test_convergence(self, time_step):\n \n ##comp... | [
"0.62297946",
"0.62297946",
"0.5960085",
"0.5867683",
"0.57064927",
"0.5630493",
"0.5588978",
"0.5522075",
"0.55003005",
"0.5482426",
"0.54632854",
"0.53641206",
"0.53202057",
"0.529571",
"0.52799577",
"0.52640945",
"0.52534276",
"0.52385813",
"0.52203447",
"0.5218158",
"0.52... | 0.7054014 | 0 |
Return the tangent of the phase associated with Fourier mode | def get_tan_phase(tas,period=12):
L = len(tas)
freqs = np.fft.fftfreq(L)
closest = np.abs(freqs-1./period)
# i = np.where(freqs == 1./period)[0]
i = np.argmin(closest)
#print 1/freqs[i]
tas_fft = np.fft.fft(tas)/L
R = tas_fft.real
Im = tas_fft.imag
mag = np.sqrt(R**2+Im**2)
ph... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tangent(self, p):\n p = array(p, float)\n v = (p - self.o)\n v /= norm(v)\n b = self.o + ((cross(v, self.N) - v) / 3)*self.r\n mb = _mirror_(self.o, p, b) \n mbb = mb - b\n return mbb/norm(mbb)",
"def position_to_Fourier(self):\n #TODO Try to do it with... | [
"0.6427801",
"0.63849",
"0.6319369",
"0.62911284",
"0.6175167",
"0.6103598",
"0.61004394",
"0.5953742",
"0.59293723",
"0.5875864",
"0.5871563",
"0.5863087",
"0.5850907",
"0.5847475",
"0.58400255",
"0.5815378",
"0.5795082",
"0.5776325",
"0.5728028",
"0.5683427",
"0.5675834",
... | 0.6825005 | 0 |
Convert phase to day of the year | def phase_to_day(phase):
if phase < 0:
phase += 2*np.pi
return phase*(365./(2*np.pi)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calendar_year(cls, tee):\n return iround(((tee - OldHindu.EPOCH) / cls.SIDEREAL_YEAR) - (cls.solar_longitude(tee) / 360))",
"def day_of_year(self):\n return int(self.date.strftime('%j'))",
"def calendar_year(cls, tee):\n return iround(((tee - OldHindu.EPOCH) / cls.MEAN_SIDEREAL_YEAR) -... | [
"0.66281295",
"0.656976",
"0.65153605",
"0.63975745",
"0.6394729",
"0.63570565",
"0.62479067",
"0.62440753",
"0.62306625",
"0.6158912",
"0.61399734",
"0.61389637",
"0.613164",
"0.6119462",
"0.61124986",
"0.6075899",
"0.60695523",
"0.60540843",
"0.60523653",
"0.60377324",
"0.5... | 0.816147 | 1 |
Convert phase to day of the year | def phase_to_day(phase):
if phase < 0:
phase += 2*np.pi
return phase*(365./(2*np.pi)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calendar_year(cls, tee):\n return iround(((tee - OldHindu.EPOCH) / cls.SIDEREAL_YEAR) - (cls.solar_longitude(tee) / 360))",
"def day_of_year(self):\n return int(self.date.strftime('%j'))",
"def calendar_year(cls, tee):\n return iround(((tee - OldHindu.EPOCH) / cls.MEAN_SIDEREAL_YEAR) -... | [
"0.66281295",
"0.656976",
"0.65153605",
"0.63975745",
"0.6394729",
"0.63570565",
"0.62479067",
"0.62440753",
"0.62306625",
"0.6158912",
"0.61399734",
"0.61389637",
"0.613164",
"0.6119462",
"0.61124986",
"0.6075899",
"0.60695523",
"0.60540843",
"0.60523653",
"0.60377324",
"0.5... | 0.816147 | 0 |
Given a list of observers of the same type, aggregates and returns their results. | def aggregate_results(observers):
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def aggregate(observables, aggregator, window=1, name=None):\r\n return MultiFold(\r\n observables,\r\n UpdatableLookback(aggregator, window, name))",
"def aggregate(objs):\n summed = OrderedDict()\n for obj in objs:\n pps = [obj] if isinstance(obj, types.PlayPlayer) else ob... | [
"0.5721193",
"0.5561385",
"0.55577785",
"0.5462068",
"0.5439121",
"0.5361046",
"0.5298299",
"0.5273142",
"0.52542335",
"0.51171476",
"0.5113394",
"0.5094156",
"0.5029211",
"0.4950974",
"0.49225077",
"0.4893143",
"0.48639148",
"0.4856655",
"0.47869506",
"0.4766969",
"0.4759411... | 0.7154875 | 0 |
Initialization of graph class with specification of the style used, default is 'ggplot' | def __init__(self, Style='ggplot'):
fig_var = ['style', 'Plots', 'title', 'xlabel', 'ylabel',
'Xmin',
'Xmax',
'Ymin', 'Ymax']
self.data = dict.fromkeys(fig_var)
self.data['style'] = Style
self.data['Plots'] = {} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, graph_format='png'):\n\n self.graph = Digraph(\"Dependencies\", format=graph_format, filename='dependency_graph.gv', node_attr={'color': 'lightblue2', 'style': 'filled'})\n self.graph.attr(size='8000,8000')",
"def new_graph(self, data, name=None, style='bar', color=colors.lightgr... | [
"0.7160513",
"0.6328354",
"0.6294184",
"0.6196716",
"0.6181779",
"0.61812836",
"0.6128171",
"0.6123356",
"0.60171515",
"0.5940059",
"0.5715224",
"0.5710166",
"0.5687517",
"0.5683037",
"0.56678903",
"0.56520355",
"0.5641087",
"0.56200397",
"0.56195146",
"0.56164175",
"0.560812... | 0.7229065 | 0 |
define the X and Y axis limits | def setlimits(self, Xlim=[], Ylim=[]):
self.data['Xmin'] = Xlim[0]
self.data['Xmax'] = Xlim[1]
self.data['Ymin'] = Ylim[0]
self.data['Ymax'] = Ylim[1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def xylim(xmin=None, xmax=None, ymin=None, ymax=None):\n plt.axis(xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax)",
"def set_plot_limits(self) -> None:\n matplotlib.pyplot.xlim(0, self.imgsz[0])\n matplotlib.pyplot.ylim(self.imgsz[1], 0)",
"def setXYLimit(self, xmin=None, xmax=None, ymin=None, yma... | [
"0.7596813",
"0.7430736",
"0.73098594",
"0.73097605",
"0.72856957",
"0.7243441",
"0.71406424",
"0.7069249",
"0.70277447",
"0.6997044",
"0.6965993",
"0.6949617",
"0.69271195",
"0.69196284",
"0.68260384",
"0.68236095",
"0.6807305",
"0.6789631",
"0.6702974",
"0.6700313",
"0.6699... | 0.8024198 | 0 |
Converts stoplist text file into list of tokens | def load_stop_list():
stop_list = []
with open(STOP_LIST, "r") as f:
lines = f.readlines()
stop_list = [word.strip() for word in lines]
return stop_list | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def readStopList():\n f = None\n try:\n f = open('documents/stoplist.txt', 'r')\n except FileNotFoundError:\n print(\"ERROR: File not found.\")\n exit(-1)\n if f is None:\n print(\"ERROR: Error loading stoplist\")\n exit(-1)\n\n return str(f.read()).split()",
"de... | [
"0.7023497",
"0.69153845",
"0.6750235",
"0.6572064",
"0.65620124",
"0.65080184",
"0.6481563",
"0.6412093",
"0.6406209",
"0.6372647",
"0.6366648",
"0.6364497",
"0.62950796",
"0.62819886",
"0.6274022",
"0.62412465",
"0.618894",
"0.6159963",
"0.61280495",
"0.6125582",
"0.6113427... | 0.749372 | 0 |
Sort in a specified order any dictionary nested in a complex structure. Especially useful for sorting a JSON file in a meaningful order. | def make_custom_sort(orders):
orders = [{k: -i for (i, k) in enumerate(reversed(order), 1)} for order in orders]
def process(stuff):
if isinstance(stuff, dict):
l = [(k, process(v)) for (k, v) in stuff.items()]
keys = set(stuff)
order = max(orders, key=lambda order: l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_dictsort_complex_sorting_key(self):\n data = [\n {\"foo\": {\"bar\": 1, \"baz\": \"c\"}},\n {\"foo\": {\"bar\": 2, \"baz\": \"b\"}},\n {\"foo\": {\"bar\": 3, \"baz\": \"a\"}},\n ]\n sorted_data = dictsort(data, \"foo.baz\")\n\n self.assertEqual(... | [
"0.653086",
"0.6437128",
"0.63729537",
"0.632864",
"0.62446153",
"0.6146052",
"0.61061865",
"0.60864496",
"0.6072396",
"0.58841217",
"0.5882846",
"0.5782154",
"0.57771605",
"0.57738656",
"0.57239145",
"0.57142466",
"0.5708071",
"0.56768537",
"0.56660247",
"0.5647559",
"0.5618... | 0.65726316 | 0 |
Return statistics about the current state of this lock. | def statistics(self) -> LockStatistics:
return LockStatistics(self.locked(), self._owner_task, len(self._waiters)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getstatus(self):\n with self.lock:\n return (self.status, self.time_start)",
"def stats(self):\n\n res = self.read_block(REG_STATS, 9)\n\n ret = {\n \"completed_cycles\": (res[1] << 8) + (res[0] << 0),\n \"last_boot\": {\n \"retries\": res[... | [
"0.70566237",
"0.6653602",
"0.66055226",
"0.6495829",
"0.643085",
"0.6398969",
"0.6388215",
"0.6358421",
"0.63350755",
"0.6322747",
"0.6304496",
"0.62816703",
"0.6240129",
"0.61882067",
"0.61520123",
"0.6146637",
"0.6145223",
"0.614285",
"0.6135839",
"0.61339086",
"0.61233103... | 0.7832995 | 0 |
Notify exactly n listeners. | def notify(self, n: int = 1) -> None:
self._check_acquired()
for _ in range(n):
try:
event = self._waiters.popleft()
except IndexError:
break
event.set() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_until_callbacks_invoked(n=10, loop=None):\n\n if loop is None:\n loop = get_event_loop()\n\n for i in range(n):\n _run_until_callbacks_invoked_once(loop=loop)",
"def notify_all(self, event: GameEvent):\n for listener in self._listeners:\n listener.notify(event)",
"... | [
"0.6379929",
"0.60313714",
"0.5906169",
"0.585487",
"0.585487",
"0.58078414",
"0.5751406",
"0.57240236",
"0.56408536",
"0.55741954",
"0.55261433",
"0.5521699",
"0.55093133",
"0.5486637",
"0.5445235",
"0.5404716",
"0.5376677",
"0.5353639",
"0.5348436",
"0.5333781",
"0.5329927"... | 0.7488429 | 0 |
Return statistics about the current state of this condition. | def statistics(self) -> ConditionStatistics:
return ConditionStatistics(len(self._waiters), self._lock.statistics()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def state(self):\n return self._measure",
"def get_state(self) -> Dict:\n return {\n \"patience\": self.patience,\n \"cooldown\": self.cooldown,\n \"cooldown_counter\": self.cooldown_counter,\n \"mode\": self.mode,\n \"threshold\": self.thresho... | [
"0.71586376",
"0.6778751",
"0.6764442",
"0.67526835",
"0.6747207",
"0.6739327",
"0.66986823",
"0.66798747",
"0.664067",
"0.6600649",
"0.6561397",
"0.6514252",
"0.6514252",
"0.64937204",
"0.64810133",
"0.6475574",
"0.6457649",
"0.645014",
"0.6437783",
"0.643425",
"0.64169234",... | 0.71001214 | 1 |
Return statistics about the current state of this semaphore. | def statistics(self) -> SemaphoreStatistics:
return SemaphoreStatistics(len(self._waiters)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def statistics(self):\n return self._queue.statistics(self._name)",
"def statistics(self):\n return self._statistics",
"def statistics(self) -> LockStatistics:\n return LockStatistics(self.locked(), self._owner_task, len(self._waiters))",
"def statistics(self):\n return self.get_s... | [
"0.67205733",
"0.6648728",
"0.65306365",
"0.6503779",
"0.6471665",
"0.644764",
"0.6430983",
"0.6360429",
"0.6350041",
"0.6304903",
"0.62686765",
"0.6248332",
"0.62444067",
"0.6222603",
"0.61656606",
"0.61591345",
"0.61494213",
"0.61186785",
"0.6094856",
"0.60945207",
"0.60824... | 0.7326038 | 0 |
Create an asynchronous lock. | def create_lock() -> Lock:
return Lock() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lock_object(self):\n return gevent.thread.allocate_lock()",
"def createLock(self):\n self.lock = stdoutlock",
"def acquire(self, blocking=True):\n ops = fcntl.LOCK_EX\n if not blocking:\n ops |= fcntl.LOCK_NB\n fcntl.flock(self.lock_file, ops)",
"def get_lock... | [
"0.6727348",
"0.65719485",
"0.6558888",
"0.6537412",
"0.6400549",
"0.63881797",
"0.6383415",
"0.63614863",
"0.6335667",
"0.6314012",
"0.6301484",
"0.6290461",
"0.62749565",
"0.62582034",
"0.62369066",
"0.6198255",
"0.6179671",
"0.6177639",
"0.6171515",
"0.6148447",
"0.6141186... | 0.77168024 | 0 |
Create an asynchronous condition. | def create_condition(lock: Optional[Lock] = None) -> Condition:
return Condition(lock=lock) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ensure_condition(callback, *args,\n sleep_step=0.001, max_wait_time=30, **kwargs):\n event = Event()\n condition = ConditionWaiter(event, callback, *args,\n sleep_step=sleep_step, **kwargs)\n condition.start()\n result = event.wait(max_wait_time)\n... | [
"0.63410366",
"0.62055475",
"0.6199077",
"0.6119846",
"0.60336334",
"0.59146494",
"0.58612967",
"0.5782969",
"0.56079465",
"0.56079465",
"0.5525224",
"0.5494368",
"0.54022723",
"0.54022723",
"0.53985673",
"0.53892046",
"0.53815883",
"0.5368199",
"0.53287435",
"0.5314211",
"0.... | 0.6838926 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.