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 |
|---|---|---|---|---|---|---|
Parse document objects from page of text | def parse_docs_from_page(self, page_url: str, page_text: str) -> Iterable[Document]:
# get the data
data = requests.get(page_url)
# load data into bs4
soup = BeautifulSoup(data.text, 'html.parser')
# links = []
pdf_dis = []
dates = []
table = []
v... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_docs_from_page(self, page_url: str, page_text: str) -> Iterable[Document]:\n # parse html response\n url = \"https://www.med.navy.mil/directives/Pages/Publications.aspx\"\n base_url = 'https://www.med.navy.mil'\n parsed_docs = []\n doc_name_list = []\n if (page_u... | [
"0.6943239",
"0.69207364",
"0.6807848",
"0.6564104",
"0.6440653",
"0.6434585",
"0.6419085",
"0.6406201",
"0.63876253",
"0.6367041",
"0.6246994",
"0.62138414",
"0.6203199",
"0.6178067",
"0.6176524",
"0.61475307",
"0.6122435",
"0.6108919",
"0.60970265",
"0.6094376",
"0.6085055"... | 0.71913856 | 0 |
The following function returns the current weather for South Bend, IN.... | def get_weather_south_bend(message):
weather_api = 'http://api.openweathermap.org/data/2.5/weather?id=4926563&&units=imperial&appid={}'.format(
os.environ['WEATHER_KEY'])
weather = requests.get(weather_api).json()
return("The current weather at Notre Dame is {} with a temperature of {}.".format(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def weather_helper():\n\n weather = get_weather('Chicago')\n conditions = weather['weather'][0]['description']\n temperature = weather['main']['temp']\n location = weather['name']\n\n curr_weather = 'It is currently %s degrees with %s in %s' % (temperature, conditions, location)\n return curr_wea... | [
"0.6748897",
"0.6651157",
"0.65632546",
"0.654174",
"0.64824337",
"0.62617576",
"0.6250446",
"0.62484175",
"0.611307",
"0.609392",
"0.6065452",
"0.60488474",
"0.60212094",
"0.59851736",
"0.5981115",
"0.5960446",
"0.5955273",
"0.5950651",
"0.59499425",
"0.5916722",
"0.5912138"... | 0.67351866 | 1 |
Prometheus helper to quickly see the time in London. | def get_uk_time(message):
time_api = 'http://worldtimeapi.org/api/timezone/Europe/London.json'
london_time = requests.get(time_api).json()
return("The current time in London, England is {}".format(
london_time['datetime'][11:16])) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_time(self):\n return self.run_command('get_time')[0]",
"def timezone():\n \n pass",
"def get_time_info(self):\n\n raise NotImplementedError",
"def get_nightly_start_time():\n return 14 # 2PM local Tucson time",
"def get_time():\n # Use this one for production:\n now... | [
"0.59689367",
"0.59094346",
"0.5783251",
"0.57631344",
"0.57395995",
"0.5718757",
"0.5704612",
"0.5699259",
"0.56886494",
"0.5673247",
"0.5653273",
"0.5640289",
"0.56305677",
"0.558655",
"0.5577585",
"0.5576624",
"0.5555275",
"0.55360794",
"0.5501735",
"0.54946667",
"0.548418... | 0.5973397 | 0 |
This function will fetch yesterday's mlb scores and return them in a similar fashion to how nhl scores are being returned. | def get_mlb_scores(message):
yesterday = datetime.date.today() - datetime.timedelta(days=1)
games = scoreboard(yesterday.year,
yesterday.month,
yesterday.day)
scores = []
for game in games:
home = "{} {}\n".format(
game['home_team'],
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getDayAheadMarketLBMPZonal(self):\n\n\t\t# Variables\n\t\ttoday = self.helper.getYear() + self.helper.getMonth() + self.helper.getDay()\n\t\turl = 'http://mis.nyiso.com/public/csv/damlbmp/'+today+'damlbmp_zone.csv' \n\t\tresponse = urllib2.urlopen(url)\n\t\tmarket_data = sorted(csv.reader(response... | [
"0.5864733",
"0.5720611",
"0.5628312",
"0.54834133",
"0.54429305",
"0.54429305",
"0.5391816",
"0.53706133",
"0.5342564",
"0.52987903",
"0.5291811",
"0.52855325",
"0.52515596",
"0.5246376",
"0.51850957",
"0.51413584",
"0.50993174",
"0.50862217",
"0.5074362",
"0.5064369",
"0.50... | 0.7069956 | 0 |
Returns a random bit of advice. | def random_advice(message):
advice = requests.get("https://api.adviceslip.com/advice").json()['slip']['advice']
return advice | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_test(self):\r\n return 1",
"def random_test(self):\r\n return 1",
"def randomHelmet():\n return random.choice(HELMETS)",
"def randomMethod(self):\n return random.random()",
"def RandomAgentProgram(actions):\n return lambda percept: random.choice(actions)",
"def Rando... | [
"0.6780925",
"0.6780925",
"0.6756225",
"0.6611887",
"0.64579284",
"0.64579284",
"0.64425486",
"0.6346136",
"0.63369906",
"0.6270907",
"0.6244317",
"0.6233644",
"0.62298036",
"0.62264895",
"0.62022316",
"0.61940515",
"0.61672014",
"0.6140617",
"0.6140617",
"0.61395633",
"0.612... | 0.6908676 | 0 |
Test pattern_search using mocked response. | def test_pattern_search(self, mock_get, circuits_app, umbinv_regex, umbinv_start_epoch, umbinv_start_relative, umbinv_limit, umbinv_include_category):
keys_outer = ["matches", "limit", "totalResults", "expression", "moreDataAvailable"]
keys_match = ["name", "securityCategories", "firstSeen", "name", "f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mock_reddit_search_response(\n ) -> Dict:\n with open(\n \"util/reddit_search_response.json\"\n ) as static_response:\n mock_response = json.load(static_response)\n\n return(mock_response)",
"def test_search(self):\n d = self._search()\n self._response([2, 5, 1... | [
"0.6732833",
"0.66641694",
"0.63938046",
"0.6325752",
"0.62485534",
"0.6154589",
"0.6144737",
"0.6090113",
"0.60500705",
"0.60500705",
"0.60500705",
"0.60223466",
"0.60047615",
"0.60046566",
"0.59748423",
"0.58795416",
"0.587042",
"0.5864914",
"0.58384216",
"0.58313507",
"0.5... | 0.70248115 | 0 |
convert name to number | def name_to_number(name):
if name == "rock":
number = 0
elif name == "Spock":
number = 1
elif name == "paper":
number = 2
elif name == "lizard":
number = 3
elif name == "scissors":
number = 4
else:
print "Name is invalid!"
return 1
retu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name_to_number(self, name):\r\n try:\r\n return self._numbers[name]\r\n except KeyError:\r\n raise KeyError(\"No field named %s in %r\" % (name, self._numbers.keys()))",
"def name_to_number(name):\r\n \r\n if name == \"rock\":\r\n return 0\r\n elif name == ... | [
"0.7741844",
"0.7352965",
"0.7345282",
"0.7291842",
"0.72166365",
"0.6983042",
"0.6895514",
"0.67996234",
"0.67324436",
"0.66536355",
"0.65847605",
"0.6520935",
"0.6479899",
"0.6476801",
"0.64197266",
"0.64054585",
"0.6389672",
"0.6386971",
"0.63465",
"0.6332023",
"0.6235999"... | 0.7410772 | 1 |
convert number to name | def number_to_name(number):
if number == 0:
name = "rock"
elif number == 1:
name = "Spock"
elif number == 2:
name = "paper"
elif number == 3:
name = "lizard"
elif number == 4:
name = "scissors"
else:
print "Number is invalid!"
return 1
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def number_to_name(self, number):\r\n return self._names[number]",
"def number_to_name(number):\r\n\r\n if number == 0:\r\n return \"rock\"\r\n elif number == 1:\r\n return \"Spock\"\r\n elif number == 2:\r\n return \"paper\"\r\n elif number == 3:\r\n return \"lizar... | [
"0.8246705",
"0.7550283",
"0.7530132",
"0.74987745",
"0.7460435",
"0.7435132",
"0.7311404",
"0.7058323",
"0.68847036",
"0.6775639",
"0.67526454",
"0.67350024",
"0.6674833",
"0.66491246",
"0.6633272",
"0.658147",
"0.64966327",
"0.6492684",
"0.64624995",
"0.6456531",
"0.6436228... | 0.77541053 | 1 |
Calculate the number of digits in a number and the armstrong_sum. Return true if the armstrong_sum equals the armstrong_candidate | def is_armstrong_number(armstrong_candidate: int) -> bool:
if armstrong_candidate < 0:
return False
nr_digits = nr_digits_number(armstrong_candidate)
a_sum = armstrong_sum(armstrong_candidate, nr_digits)
return True if a_sum == armstrong_candidate else False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def armstrong_sum(armstrong_candidate: int, nr_digits: int) -> int:\n a_sum = 0\n\n while armstrong_candidate != 0:\n digit_in_armstrong_candidate = armstrong_candidate % 10\n a_sum += digit_in_armstrong_candidate ** nr_digits\n armstrong_candidate = int(armstrong_candidate / 10)\n re... | [
"0.79819995",
"0.73977816",
"0.71560806",
"0.6935217",
"0.68870246",
"0.66913134",
"0.65789026",
"0.6340746",
"0.6177836",
"0.6057625",
"0.5992606",
"0.59754694",
"0.5964514",
"0.5883641",
"0.5847304",
"0.57634735",
"0.57392144",
"0.5727389",
"0.5718226",
"0.56865513",
"0.558... | 0.807842 | 0 |
Calculate and return the armstrong_sum | def armstrong_sum(armstrong_candidate: int, nr_digits: int) -> int:
a_sum = 0
while armstrong_candidate != 0:
digit_in_armstrong_candidate = armstrong_candidate % 10
a_sum += digit_in_armstrong_candidate ** nr_digits
armstrong_candidate = int(armstrong_candidate / 10)
return a_sum | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sum(self):\n return self.vsum",
"def calculate_sum(self):\n\n left_sum = self.left.calculate_sum() if self.left else 0\n right_sum = self.right.calculate_sum() if self.right else 0\n return self.data + left_sum + right_sum",
"def summation(self):\n return sum(self.read_in... | [
"0.6603156",
"0.6591869",
"0.627234",
"0.62047184",
"0.61978614",
"0.6112021",
"0.60509235",
"0.5939432",
"0.5937607",
"0.5934721",
"0.5928078",
"0.5926152",
"0.5860448",
"0.5854603",
"0.58539337",
"0.58510864",
"0.58500665",
"0.5822862",
"0.581909",
"0.58153033",
"0.57878613... | 0.69721985 | 0 |
Split data by options of an attribute | def splitBy(data, attribute_id):
col = getColumn(data, attribute_id)
values = set(col)
split_data = []
for i in values:
subset = [row for row in data if row[attribute_id] == i]
split_data.append(subset)
return split_data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getNewData(self, data, splitIndex, attrVal):\n newData = []\n for record in data:\n if record[splitIndex] == attrVal:\n newRecord =[]\n lenRecord = len(record)\n\n for i in range(lenRecord):\n # doesnt include the split at... | [
"0.5996887",
"0.5792106",
"0.5760196",
"0.575071",
"0.57116055",
"0.5524944",
"0.55180806",
"0.55036134",
"0.5439692",
"0.542324",
"0.54069096",
"0.53839254",
"0.5351785",
"0.5330941",
"0.53060323",
"0.51633775",
"0.51120734",
"0.50981104",
"0.5087688",
"0.50799423",
"0.50781... | 0.65550715 | 0 |
Returns the definition for unit with name `definition_name`. | def get_definition(self, definition_name, unit_type):
if unit_type == pu.UnitType.alias:
relevant_dict = self.alias_definitions
elif unit_type == pu.UnitType.slot:
relevant_dict = self.slot_definitions
elif unit_type == pu.UnitType.intent:
relevant_dict = self... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_definition(self, name):\n if self.is_defined(name):\n return self._definitions[name]\n return None",
"def get_def(self, def_name):\n if not def_name:\n return None\n for defi in self._definitions:\n if defi._name == def_name:\n r... | [
"0.72344184",
"0.63266414",
"0.63032293",
"0.6179592",
"0.6067163",
"0.6035977",
"0.58439296",
"0.5780957",
"0.57687986",
"0.5746453",
"0.5741409",
"0.5714593",
"0.56843793",
"0.5671426",
"0.5670899",
"0.5664608",
"0.5657939",
"0.56444097",
"0.5607851",
"0.5600935",
"0.557700... | 0.7419221 | 0 |
Parses the master file and subsequent files and transforms the information parsed into a dictionary of declaration names > rules. | def parse(self):
print_DBG("Parsing master file: "+self.tokenizer.get_file_information()[0])
for token_line in self.tokenizer.next_tokenized_line():
if not token_line[0].isspace():
if token_line[0] == pu.INCLUDE_FILE_SYM:
self.tokenizer.open_file(token_lin... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_master_mapping_file(master_mapping_file, bcos):\n bco_names = []\n\n mapping_dict = {\n }\n\n for bco in bcos:\n bco_names.append(os.path.splitext(os.path.basename(bco))[0])\n mapping_dict[os.path.splitext(os.path.basename(bco))[0]] = {\n \"missing\": {\n\n ... | [
"0.60867506",
"0.578407",
"0.5697687",
"0.5682963",
"0.5680399",
"0.5605115",
"0.55050564",
"0.5500258",
"0.54917365",
"0.54871374",
"0.54120314",
"0.5396366",
"0.53410786",
"0.5339711",
"0.5313843",
"0.5282944",
"0.52651393",
"0.52578163",
"0.52340865",
"0.52198327",
"0.5214... | 0.74442387 | 0 |
Parses a line (as tokens) that contains a declaration initiator. | def _parse_declaration_initiator(self, token_line):
if self._expecting_rule:
self.tokenizer.syntax_error("Expected a generation rule, got a "+
"unit declaration instead.")
unit_type = pu.get_unit_type_from_sym(token_line[0])
declaration_inter... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Declaration(self):\n type = self.Type()\n if self.currtok[1].name == \"IDENT\":\n self.ids[self.currtok[0]] = type\n id = self.primary()\n\n if self.currtok[1].name == \"SEMI\":\n self.currtok = next(self.tg)\n return DeclarationExpr(... | [
"0.60595083",
"0.57688266",
"0.57019955",
"0.5691983",
"0.5684513",
"0.56226003",
"0.552998",
"0.55017716",
"0.5465409",
"0.5453657",
"0.5441814",
"0.52609015",
"0.5220658",
"0.520444",
"0.5193987",
"0.5159767",
"0.5131876",
"0.5129617",
"0.5114839",
"0.51058304",
"0.5096995"... | 0.8207203 | 0 |
Creates a unit of type `unit_type` with name `unit_name` and modifiers `modifiers` inside the relevant dictionary (`alias_definitions`, `slot_definitions` or `intent_definitions`). `modifiers` is a `UnitDeclarationModifiersRepr` and `nb_examples_asked` is a tuple (training, test). | def create_unit(self, unit_type, unit_name, modifiers,
nb_examples_asked=None):
new_unit = None
relevant_dict = None
if unit_type == pu.UnitType.alias:
new_unit = AliasDefinition(unit_name, modifiers)
# new_unit = AliasDefinition(unit_name, [], modifie... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_unit(self, unit_type):\n unit = None\n\n if unit_type == 'ElfRider':\n unit = ElfRider()\n elif unit_type == 'Knight':\n unit = Knight()\n elif unit_type == \"DwarfFighter\":\n unit = DwarfFighter()\n elif unit_type == 'OrcRider':\n ... | [
"0.6863574",
"0.62725776",
"0.6256398",
"0.6254103",
"0.60253644",
"0.5939342",
"0.58484507",
"0.57158554",
"0.56877196",
"0.5604188",
"0.5513164",
"0.5367513",
"0.5357851",
"0.53299356",
"0.5321212",
"0.5317357",
"0.52819335",
"0.5246464",
"0.51694965",
"0.5160825",
"0.51535... | 0.8705934 | 0 |
Checks that the str `indentation` is the same as the expected indentation from the last parsed rule. Raises a `SyntaxError` if it isn't. | def _check_indentation(self, indentation):
if self._expected_indentation is None:
self._expected_indentation = indentation
return
if indentation != self._expected_indentation:
self.tokenizer.syntax_error("Inconsistent indentation.") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_indentation(code: str, path: pathlib.Path = None):\n if not isinstance(code, str):\n raise TypeError('code must be string but {} given'.format(type(code)))\n assert path is None or isinstance(path, pathlib.Path), type(path)\n\n lines = code.splitlines(keepends=True)\n whitespace = r... | [
"0.6527587",
"0.598616",
"0.598616",
"0.5967331",
"0.57532173",
"0.5659602",
"0.56493586",
"0.5569273",
"0.550822",
"0.53785354",
"0.53224736",
"0.5262904",
"0.52626956",
"0.51944107",
"0.5175933",
"0.5161552",
"0.51611274",
"0.5155272",
"0.51426595",
"0.5091848",
"0.50561875... | 0.78708684 | 0 |
Transforms a list of tokens into a list of subrules | def tokens_to_sub_rules(self, tokens):
# Remove alternative slot rule if necessary
alt_slot_value = None # TODO DummySlotVal absolutely need to be managed differently
if self._currently_parsed_declaration[0] == pu.UnitType.slot:
answer = pu.find_alt_slot_and_index(tokens)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply_rules(self, token_parse_list):\r\n return token_parse_list",
"def extract_rules(self, labels=None):\n # Extract flat list of rules in array form\n if isinstance(self.base_estimator, RandomForestClassifier):\n rules = list(it.chain(*[self.__extract_dt_rules__(dt) for dt i... | [
"0.6186922",
"0.60484374",
"0.5945183",
"0.5885389",
"0.5819015",
"0.56935894",
"0.56846756",
"0.5673392",
"0.5631876",
"0.55965734",
"0.55585086",
"0.5541569",
"0.5531376",
"0.5428534",
"0.53792447",
"0.53696585",
"0.53554046",
"0.53478056",
"0.53404236",
"0.534006",
"0.5325... | 0.6196971 | 0 |
Checks that the subrule represented by `interior_tokens` is syntactically valid. | def _check_sub_rule_validity(self, interior_tokens, sub_rule_type):
try:
if sub_rule_type == pu.SubRuleType.word_group:
pu.check_word_group_validity(interior_tokens)
elif sub_rule_type == pu.SubRuleType.choice:
pu.check_choice_validity(interior_tokens)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_composite_tokens(self, name, tokens):\n assert len(tokens) >= 2\n key = tokens[0]\n\n assert key.value.lower() == name\n assert tokens[-1].value.lower() == \"end\"\n\n if len(tokens) == 2:\n body = [] # empty TYPE..END block\n else:\n body ... | [
"0.5497027",
"0.5389574",
"0.5389574",
"0.51875174",
"0.5152841",
"0.5063203",
"0.49809048",
"0.49645007",
"0.49629456",
"0.49387994",
"0.49272373",
"0.49200037",
"0.49097204",
"0.48745412",
"0.48715726",
"0.48682913",
"0.48433882",
"0.48420814",
"0.48327184",
"0.4830428",
"0... | 0.7403252 | 0 |
Renames the unit declaration of type `unit_type` from `old_name` to `new_name` (possibly replacing the unit with that name). Raises a `KeyError` if `old_name` is not a declared unit. | def rename_unit(self, unit_type, old_name, new_name):
if unit_type == pu.UnitType.alias:
relevant_dict = self.alias_definitions
elif unit_type == pu.UnitType.slot:
relevant_dict = self.slot_definitions
elif unit_type == pu.UnitType:
relevant_dict = self.intent... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def renameKey(self, oldKey, newKey, meta=None, units=None):\n\n if meta:\n if oldKey not in meta:\n return\n meta.replaceKey(oldKey, newKey)\n if units:\n if oldKey not in units:\n return\n units.replaceKey(oldKey, newKey)",
... | [
"0.6078044",
"0.60575974",
"0.5870249",
"0.58238894",
"0.57904357",
"0.56272036",
"0.5613752",
"0.551229",
"0.551229",
"0.54903346",
"0.54142356",
"0.541372",
"0.5401158",
"0.53964615",
"0.5391015",
"0.538513",
"0.533361",
"0.5305564",
"0.52826214",
"0.52747434",
"0.5249805",... | 0.8716253 | 0 |
Deletes a unit definition. | def delete(self, unit_type, unit_name, variation_name=None):
if unit_type == pu.UnitType.alias:
relevant_dict = self.alias_definitions
stat_key = "#aliases"
elif unit_type == pu.UnitType.slot:
relevant_dict = self.slot_definitions
stat_key = "#slots"
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def removeUnitDefinition(self, *args):\n return _libsbml.Model_removeUnitDefinition(self, *args)",
"def delete(self):\n key = self.request.get('key')\n\n if not self.assert_xsrf_token_or_fail(\n self.request, 'delete-unit', {'key': key}):\n return\n\n if not ... | [
"0.732434",
"0.6751945",
"0.6362059",
"0.6315331",
"0.62406754",
"0.6101216",
"0.6085688",
"0.5932826",
"0.5915547",
"0.58609813",
"0.57939345",
"0.56276876",
"0.5566255",
"0.5560605",
"0.55542415",
"0.5517972",
"0.5458577",
"0.5439751",
"0.5436361",
"0.54343516",
"0.54220444... | 0.6920054 | 1 |
Adds an already built definition to the list of declared units. | def add_definition(self, unit_type, unit_name, definition):
if unit_type == pu.UnitType.alias:
relevant_dict = self.alias_definitions
stat_key = "#aliases"
elif unit_type == pu.UnitType.slot:
relevant_dict = self.slot_definitions
stat_key = "#slots"
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addUnitDefinition(self, *args):\n return _libsbml.Model_addUnitDefinition(self, *args)",
"def insert_definition(self, definition):\r\n self.definitions.insert(definition)",
"def add_definition(self, definition):\n self._definitions[definition.name] = definition",
"def addUnit(self, *... | [
"0.6652101",
"0.62057215",
"0.61890745",
"0.5981908",
"0.597683",
"0.59402233",
"0.58646315",
"0.58580893",
"0.5674745",
"0.5613364",
"0.545894",
"0.5456516",
"0.5444362",
"0.53415227",
"0.52771723",
"0.527371",
"0.52607644",
"0.525298",
"0.52528954",
"0.52448136",
"0.5241117... | 0.6550536 | 1 |
Put a document in a box. document are, generally, File like objects. If a document with this name exist, it will be overwritten. | def _put(self, name, document):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit_document():",
"def add_doc(self, name, boring):\n\n self.documents[name] = boring",
"def create_document(file_name):\n path = INPUT_DIR+file_name # assemble the file descriptor\n file = open(path) # open in read mode\n doc = Document() # create a new document\n # add the title fi... | [
"0.61639756",
"0.6162539",
"0.59793246",
"0.5963256",
"0.590264",
"0.58933574",
"0.58044666",
"0.5765277",
"0.5765277",
"0.5704316",
"0.5627359",
"0.5610905",
"0.55908906",
"0.5577505",
"0.5577505",
"0.5577505",
"0.55759597",
"0.5559141",
"0.55538213",
"0.55373514",
"0.552513... | 0.7024438 | 0 |
Initialize the DFTimewolf console output object. | def __init__(self, sender, verbose):
super(DFTimewolfConsoleOutput, self).__init__()
self._sender = sender
self._verbose = verbose | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, console_output, console_stream):\n self.console_output = console_output\n self.console_stream = console_stream",
"def __init__(self):\n self.start = datetime.datetime.now()\n self.linecount = 0\n if sys.stdout.isatty():\n self.term = Terminal()\n ... | [
"0.7273711",
"0.6603541",
"0.63445574",
"0.62620664",
"0.6247948",
"0.6224108",
"0.62141013",
"0.6183469",
"0.6162597",
"0.6135037",
"0.6121743",
"0.6066026",
"0.6051641",
"0.60458225",
"0.6029775",
"0.60186225",
"0.5972186",
"0.59671825",
"0.5889796",
"0.58682",
"0.5840445",... | 0.7100504 | 1 |
Format message with timestamp, script name and sender name. | def _FormatMessage(self, message):
script_name = os.path.basename(sys.argv[0])
timestamp = datetime.now().isoformat()
formatted_message = '[{0:s}] {1:s}: {2:s} - {3:s}\n'.format(
timestamp, script_name, self._sender, message)
return formatted_message | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_message(self, message):\n return \"%s at %s\" % (\n message[0], time.asctime(time.localtime(message[1])))",
"def format(self, message):",
"def _format_msg(self, format_str, *args):\r\n return u\"{0} - - [{1}] {2}\\n\".format(\r\n self.client_address[0],\r\n ... | [
"0.71702343",
"0.63822514",
"0.6338278",
"0.6299789",
"0.6249407",
"0.6240023",
"0.61700153",
"0.61387986",
"0.61233366",
"0.6073101",
"0.60591334",
"0.5941699",
"0.58731693",
"0.5831379",
"0.58288723",
"0.5788805",
"0.57774264",
"0.57669884",
"0.5763617",
"0.5748114",
"0.572... | 0.81965363 | 0 |
Send message to standard out. | def StdOut(self, message):
sys.stdout.write('{0:s}\n'.format(message))
sys.stdout.flush() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send(self, msg):\n if self.verbose:\n print('<- out ' + msg)\n self._socket.send_string(msg)\n return",
"def write(self, msg, *_):\n if self.out is not None:\n self.out.write(msg)\n self.out.flush()",
"def stdout(msg):\n sys.stdout.write(msg)\n sys.stdout.... | [
"0.73845494",
"0.72514176",
"0.71020246",
"0.6914435",
"0.6861263",
"0.6831616",
"0.6803821",
"0.6777944",
"0.6777944",
"0.67456704",
"0.66035986",
"0.6591568",
"0.6567837",
"0.656644",
"0.656644",
"0.6550436",
"0.65137446",
"0.6496491",
"0.6481694",
"0.6435243",
"0.6383848",... | 0.75261456 | 0 |
Send verbose output to standard error. | def VerboseOut(self, message):
if self._verbose:
self.StdErr(message, die=False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def error(message):\n print(message, file=sys.stderr)",
"def error(*args, **kwargs):\n print(*args, file=sys.stderr, **kwargs)",
"def err(self, text):\n if not self.is_quiet_err:\n self.__emit(\"ERROR: \" + text, sys.stderr)",
"def _print_error(message):\n sys.stderr.write(str(mess... | [
"0.7068845",
"0.69946826",
"0.69232833",
"0.68590796",
"0.6770286",
"0.6770286",
"0.6770286",
"0.66918993",
"0.6639223",
"0.66315615",
"0.66117066",
"0.65715766",
"0.6510242",
"0.6505283",
"0.64945483",
"0.6488714",
"0.648618",
"0.6482448",
"0.64809734",
"0.6477335",
"0.64744... | 0.73082143 | 0 |
Check timezone string against known timezones in the pytz package. | def IsValidTimezone(timezone):
return timezone in pytz.all_timezones | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_timezone(tzstring):\n if not tzstring:\n return get_localzone()\n try:\n return pytz.timezone(tzstring)\n except pytz.UnknownTimeZoneError:\n raise VdtValueError(\"Unknown timezone {}\".format(tzstring))",
"def is_tz_valid(self, tz : str):\n # check tz is a string\n ... | [
"0.7579308",
"0.74548393",
"0.72705984",
"0.6789601",
"0.66779983",
"0.6512265",
"0.64019895",
"0.63673794",
"0.6315279",
"0.62908083",
"0.6286167",
"0.62601435",
"0.62428313",
"0.6206581",
"0.6180309",
"0.6156222",
"0.60593784",
"0.6052749",
"0.6025556",
"0.6025556",
"0.6025... | 0.74890524 | 1 |
Catches Ctrl + C to exit cleanly. | def signal_handler(*unused_argvs):
sys.stderr.write("\nCtrl^C caught, bailing...\n")
sys.exit(0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ctrl_c(signum, frame):\n global shutdown_event\n raise SystemExit('\\nCancelling...')",
"def allowCtrlC():\n signal.signal(signal.SIGINT, signal.SIG_DFL)",
"def signal_handler(self, signal, frame):\r\n print 'You pressed Ctrl+C!'\r\n sys.exit(0)",
"def ctrl_c_trapper(signum: int, s... | [
"0.80725306",
"0.789612",
"0.78671515",
"0.77578425",
"0.7625408",
"0.75891113",
"0.7430562",
"0.7410401",
"0.729414",
"0.7250938",
"0.7194444",
"0.7110748",
"0.70975953",
"0.679413",
"0.67453665",
"0.66968954",
"0.6669376",
"0.66400564",
"0.66031146",
"0.6600431",
"0.6469647... | 0.8342945 | 0 |
Adds the two vectors, v and u. | def add_vectors(v, u):
return (v[0] + u[0], v[1] + u[1]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_vectors(u, v): #11.22.5\r\n new_vector = []\r\n \"\"\"Because they have same length so we\r\n should take advantage from this one\"\"\"\r\n for i in range(len(u)):\r\n m = u[i] + v[i] # Get their value of i index at the same time!\r\n new_vector.append(m)\r\n return new_vector"... | [
"0.81809795",
"0.81132114",
"0.74564755",
"0.7385315",
"0.7307801",
"0.7250798",
"0.7221409",
"0.72022974",
"0.7178813",
"0.7116212",
"0.71116716",
"0.71053827",
"0.7038589",
"0.702951",
"0.70047545",
"0.68703395",
"0.68566346",
"0.68371874",
"0.6800543",
"0.6782561",
"0.6777... | 0.8510088 | 0 |
Finds the name of a given room. If the room doesn't exist returns None. | def get_room_name(dungeon, room):
for n in dungeon:
if dungeon[n] == room:
return n
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_room(self, room_name):\r\n try:\r\n return self._rooms[room_name]\r\n except KeyError:\r\n return None",
"def get_room(self, name):\n for i in self.rooms:\n if self.rooms[i].name == name:\n return self.rooms[i]\n raise RuntimeErr... | [
"0.75425893",
"0.7537608",
"0.7521715",
"0.7370273",
"0.7260868",
"0.7102111",
"0.7077929",
"0.69465464",
"0.6901336",
"0.6713058",
"0.6378655",
"0.63167995",
"0.62781125",
"0.62456167",
"0.62415075",
"0.6202007",
"0.6202007",
"0.6162853",
"0.6153098",
"0.61020285",
"0.607822... | 0.801243 | 0 |
Creates a new dungeon out of the graph rooms. The size of each room depends on it's rank. | def create_dungeon(graph, ranks):
dungeon = {}
w, h = 150, 100
for r in graph:
name, w, h = r, int(w*ranks[r]+10), int(h*ranks[r]+10)
dungeon[name] = create_room(w, h)
return dungeon | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_dungeon(self):\r\n # Total number of rooms\r\n n = self.__nx * self.__ny\r\n room_stack = []\r\n current_room = self.room_at(self.__ix, self.__iy)\r\n # Total number of visited rooms during maze construction\r\n nv = 1\r\n\r\n # iterate over all rooms of du... | [
"0.79936665",
"0.743523",
"0.673504",
"0.6677515",
"0.6576027",
"0.65215296",
"0.64986736",
"0.646819",
"0.64603704",
"0.6405314",
"0.63618886",
"0.6356892",
"0.6314918",
"0.6306273",
"0.6300013",
"0.6290147",
"0.6279687",
"0.6276442",
"0.6262408",
"0.62097096",
"0.62089825",... | 0.7741939 | 1 |
Prints out the whole dungeon... Kind of useless cause I couldn't get it to build all the rooms as a single dungeon with hallways and all. | def print_dungeon(dungeon):
for r in dungeon:
print_room(dungeon[r]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_room(dungeon, room):\n if not isinstance(room, str):\n name = get_room_name(dungeon, room)\n else:\n name = room\n room = dungeon[name]\n w, h = room_wh(room)\n room_str = ''\n for y in range(h):\n row = ''\n for x in range(w):\n #print room\n ... | [
"0.7222498",
"0.7206108",
"0.68528926",
"0.6848333",
"0.66115516",
"0.6574171",
"0.65262556",
"0.6516744",
"0.6489489",
"0.6471107",
"0.6433852",
"0.6400976",
"0.63732857",
"0.63092345",
"0.628924",
"0.62752634",
"0.6267731",
"0.62479174",
"0.6238725",
"0.62261903",
"0.621193... | 0.77093595 | 0 |
Create a new door. A door is a list with a symbol and a destination room. It is saved in the room's list and no where else. | def create_door(dungeon, room, pos, symbol, destination):
dungeon[room][pos[0]][pos[1]] = [symbol, destination] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_door(self, room=None, status=\"open\", tile=None, name=\"door\", color=None, random=False, x=None, y=None):\n\n walls = room.get_walls()\n if random:\n door_seed = randint(0, len(room.get_walls()) - 1)\n\n while walls[door_seed][0] == 1 or walls[door_seed][0] == room.... | [
"0.69796914",
"0.6737017",
"0.6626829",
"0.63650703",
"0.632819",
"0.6296616",
"0.628974",
"0.619405",
"0.6189811",
"0.6084912",
"0.5908753",
"0.5863805",
"0.5863573",
"0.58631283",
"0.5750759",
"0.5719418",
"0.56915903",
"0.56372154",
"0.56128436",
"0.5598879",
"0.5522017",
... | 0.79109216 | 0 |
Blits the obj unto the room it is in. An obj is a dictionary with all the relevent keys. | def blit(obj):
# An object is a dictionary with the keys: 'dungeon', 'room', 'symbol', 'pos', 'lastpos'
x = obj['pos'][0]
y = obj['pos'][1]
lastx= obj['lastpos'][0]
lasty = obj['lastpos'][1]
room = obj['room']
if x < len(room) and y < len(room[0]):
room[lastx][lasty] = ' '
ro... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_dict(self, obj):\n\n for attr, value in obj.__dict__.items():\n self.__dict__[attr] = value",
"def _update_loose (self, dict):\n self.__dict__.update(dict)",
"def put(self, obj):\n\n if obj is None:\n return\n\n return obj",
"def _restore_objs_from_I... | [
"0.55141205",
"0.5455272",
"0.5451394",
"0.5428932",
"0.53700477",
"0.5302088",
"0.527134",
"0.5265598",
"0.5256817",
"0.52297986",
"0.5223485",
"0.51562405",
"0.51516265",
"0.5151293",
"0.5136837",
"0.5135862",
"0.507945",
"0.50718594",
"0.50638777",
"0.5061924",
"0.5055992"... | 0.59469885 | 0 |
Constructs a QGraphicsItem displaying streams in a timeline | def __init__(self, parent, streams):
super(TimelineItem, self).__init__()
self._parent = parent
# Timeline boundries
self._start_stamp = None # earliest of all stamps
self._end_stamp = None # latest of all stamps
self._stamp_left = None # earliest timestamp currently visible
self._stamp_right = None ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, streams, parent=None):\n\n\t\t# Initialize class\n\t\tQtGui.QWidget.__init__(self, parent)\n\t\tself.main_layout = QtGui.QVBoxLayout(self)\n\t\tself.setLayout(self.main_layout)\n\n\t\t# Retrieve first and last timestamps\n\t\t_streams_ts_float = dict()\n\t\tfor stream_name in streams.keys():\n\t... | [
"0.8026527",
"0.6497834",
"0.5820398",
"0.5699911",
"0.5643354",
"0.55481607",
"0.5530482",
"0.5490387",
"0.5429456",
"0.53892124",
"0.5310036",
"0.528807",
"0.52612",
"0.51812494",
"0.51704144",
"0.5135293",
"0.5133683",
"0.51331383",
"0.51291114",
"0.50970054",
"0.50852877"... | 0.77844894 | 1 |
Recalculates the layout of the timeline to take into account any changes that have occured | def _layout(self):
# Calculate history left and history width
self._scene_width = self.scene().views()[0].size().width()
max_stream_name_width = -1
for stream_name in self.streams:
stream_width = self._qfont_width(stream_name)
if max_stream_name_width <= stream_width:
max_stream_name_width = stream_w... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_timeline_view(self):\n self.t2.setGeometry(self.t1.vb.sceneBoundingRect())\n self.t2.linkedViewChanged(self.t1.vb, self.t2.XAxis)",
"def refreshView(self):\n chldn = self.tDisp.get_children()\n for chld in chldn:\n self.tDisp.delete(chld)\n if len(self.con... | [
"0.65964925",
"0.6024597",
"0.58769494",
"0.5846595",
"0.57629436",
"0.5730918",
"0.5716509",
"0.5535949",
"0.55330044",
"0.54991317",
"0.54743934",
"0.5464647",
"0.5434402",
"0.540857",
"0.5375012",
"0.53379875",
"0.53152764",
"0.53030854",
"0.5293149",
"0.52806264",
"0.5271... | 0.6831872 | 0 |
Calculate positions of existing stream names and draw them on the left, one for each row | def _draw_stream_names(self, painter):
streams = self._history_boundaries.keys()
coords = [(self._margin_left, y + (h / 2) + (self._stream_font_height / 2))\
for (_, y, _, h) in self._history_boundaries.values()]
for text, coords in zip([t.lstrip('/') for t in streams], coords):
painter.setBru... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _draw_stream_history(self, painter, stream_name):\n\n\t\t# x, y, w, h = self._history_boundaries[stream]\n\t\t_, y, _, h = self._history_boundaries[stream_name]\n\n\t\tmsg_y = y\n\t\tmsg_height = h\n\n\t\t# Get the renderer and the message combine interval\n\t\tmsg_combine_interval = self.map_dx_to_dstamp(self... | [
"0.6044906",
"0.6034543",
"0.5864108",
"0.57839006",
"0.55741054",
"0.55496025",
"0.5518214",
"0.53334785",
"0.53273594",
"0.5275547",
"0.52673393",
"0.52578425",
"0.52254885",
"0.52020663",
"0.51958114",
"0.5169469",
"0.5148948",
"0.5139718",
"0.5129087",
"0.511747",
"0.5115... | 0.6857854 | 0 |
Group timestamps closer from each other than `max_interval` into one region | def _group_close_stamps(self, stamps, max_interval):
region_start, prev_stamp = None, None
for stamp in stamps:
if prev_stamp:
if stamp - prev_stamp > max_interval:
region_end = prev_stamp
yield (region_start, region_end)
region_start = stamp
else:
region_start = stamp
prev_stamp = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def MaxToMin(min_lev, max_lev, datetime_maxes):\r\n y_res_mins = []\r\n deltaT_ranges = []\r\n for row in range(len(max_lev)-1):\r\n range_length = (datetime_maxes.iloc[row+1]-datetime_maxes.iloc[row]).seconds/3600 # hours\r\n if ~np.isnan(max_lev.iloc[row]) & (range_length>=3.5) & (range_le... | [
"0.5671331",
"0.563569",
"0.5533073",
"0.5493953",
"0.54180735",
"0.53772825",
"0.536929",
"0.5356859",
"0.53497636",
"0.5327543",
"0.531671",
"0.5242983",
"0.5203973",
"0.51983154",
"0.513029",
"0.5128987",
"0.5108332",
"0.50875574",
"0.50568986",
"0.5040786",
"0.502568",
... | 0.7114516 | 0 |
Generate visible stamps every `stamp_step` | def _get_stamps(self, start_stamp, stamp_step):
if start_stamp >= self._stamp_left:
stamp = start_stamp
else:
stamp = start_stamp\
+ int((self._stamp_left - start_stamp) / stamp_step)\
* stamp_step\
+ stamp_step
while stamp < self._end_stamp:
yield stamp
stamp += st... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _step_plot_closure(self, step_number):\n if self.watermark_hint is not None:\n plot_image_grid(\"watermark_hint_and_mask_{}\".format(step_number),\n [np.clip(self.watermark_hint, 0, 1),\n np.clip(torch_to_np(self.mask_net_output), 0, 1)])... | [
"0.51510036",
"0.5127864",
"0.5116933",
"0.50611883",
"0.50135565",
"0.49733168",
"0.4951268",
"0.49507222",
"0.49395362",
"0.49356547",
"0.49340758",
"0.49257594",
"0.49197146",
"0.4887233",
"0.4885607",
"0.48852775",
"0.4877723",
"0.48731306",
"0.48653987",
"0.48653987",
"0... | 0.6394511 | 0 |
Converts a pixel x value to a stamp | def map_x_to_stamp(self, x, clamp_to_visible=True):
fraction = float(x - self._history_left) / self._history_width
if clamp_to_visible:
if fraction <= 0.0:
return self._stamp_left
elif fraction >= 1.0:
return self._stamp_right
return self._stamp_left + fraction * (self._stamp_right - self._stamp_l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def map_stamp_to_x(self, stamp, clamp_to_visible=True):\n\t\tif self._stamp_left is None:\n\t\t\treturn None\n\t\tfraction = (stamp - self._stamp_left) / (self._stamp_right - self._stamp_left)\n\n\t\tif clamp_to_visible:\n\t\t\tfraction = min(1.0, max(0.0, fraction))\n\n\t\treturn self._history_left + fraction * s... | [
"0.6354424",
"0.60428345",
"0.6025354",
"0.59755665",
"0.5949464",
"0.5905613",
"0.5802552",
"0.574917",
"0.5697909",
"0.5613637",
"0.5608171",
"0.5599196",
"0.5548162",
"0.5536649",
"0.5518662",
"0.54913527",
"0.5478743",
"0.5445028",
"0.5438126",
"0.5430467",
"0.54274035",
... | 0.6221601 | 1 |
Converts a timestamp to the x value where that stamp exists in the timeline | def map_stamp_to_x(self, stamp, clamp_to_visible=True):
if self._stamp_left is None:
return None
fraction = (stamp - self._stamp_left) / (self._stamp_right - self._stamp_left)
if clamp_to_visible:
fraction = min(1.0, max(0.0, fraction))
return self._history_left + fraction * self._history_width | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_timestamp(self, timestamp):\n return int(timestamp * 1e6)",
"def map_x_to_stamp(self, x, clamp_to_visible=True):\n\t\tfraction = float(x - self._history_left) / self._history_width\n\n\t\tif clamp_to_visible:\n\t\t\tif fraction <= 0.0:\n\t\t\t\treturn self._stamp_left\n\t\t\telif fraction >= 1.0:... | [
"0.59893584",
"0.595037",
"0.59041595",
"0.5840616",
"0.57994235",
"0.5774577",
"0.5716677",
"0.5689685",
"0.56540406",
"0.5592866",
"0.55166227",
"0.5504513",
"0.53762025",
"0.536753",
"0.5366946",
"0.53652966",
"0.5351976",
"0.53115314",
"0.53014266",
"0.5296015",
"0.529426... | 0.6297501 | 0 |
Constructs a widget displaying data streams. | def __init__(self, streams, parent=None):
# Initialize class
QtGui.QWidget.__init__(self, parent)
self.main_layout = QtGui.QVBoxLayout(self)
self.setLayout(self.main_layout)
# Retrieve first and last timestamps
_streams_ts_float = dict()
for stream_name in streams.keys():
tuple_ts = streams[stream_na... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, arg=None, maxpoints=None, token=None, **kwargs):\n super(Stream, self).__init__(\"stream\")\n\n # Validate arg\n # ------------\n if arg is None:\n arg = {}\n elif isinstance(arg, self.__class__):\n arg = arg.to_plotly_json()\n elif... | [
"0.60662293",
"0.60183984",
"0.5765122",
"0.57445544",
"0.5743239",
"0.5712016",
"0.5709956",
"0.5702659",
"0.5701964",
"0.5619593",
"0.5604423",
"0.55646557",
"0.55324537",
"0.5525624",
"0.5523583",
"0.54967433",
"0.5460502",
"0.5456427",
"0.5456427",
"0.54321116",
"0.542418... | 0.6148988 | 0 |
Return the list of files active at a specific timestamp | def getFilesAtStamp(self, timestamp):
out = []
for stream_name in self.stamps_by_stream.keys():
ts_index = bisect.bisect_right(self.stamps_by_stream[stream_name], timestamp)-1
if ts_index < 0:
continue
tuple_ts = self.streams[stream_name].keys()
tuple_ts.sort()
out.append(self.streams[stream_name... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select_superseded_by_timestamp(logfiles, current_timestamp):\n return [\n lf for lf in logfiles\n if current_timestamp - lf.timestamp > ONE_HOUR_PLUS\n ]",
"def list_files(line_id, datetime_, len_):\n the_dir = pathlib.Path(data_dir())/str(line_id)\n format_spec= \"%Y-%m-%d %H:%M\"\... | [
"0.66932845",
"0.66161937",
"0.63355404",
"0.6247447",
"0.62039196",
"0.6180368",
"0.6078104",
"0.6065711",
"0.5992878",
"0.59065336",
"0.5900509",
"0.5812714",
"0.57897043",
"0.5761614",
"0.5710695",
"0.5701943",
"0.5648884",
"0.56379694",
"0.5618448",
"0.55972624",
"0.55963... | 0.6878091 | 0 |
Slides the cursor to the previous frame. Does nothing if there is no frame before the current position | def moveToPreviousFrame(self):
all_ts = [s for t in self.stamps_by_stream.values() for s in t]
all_ts.sort()
first_frame = all_ts[0]
selected_index = bisect.bisect_right(all_ts, self._timeline.current_pos)-1
if selected_index <= 0 or all_ts[selected_index-1] < first_frame:
# There is no data before, or no... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def MoveToPreviousSlide(self, event):\n pass",
"def move_previous():\n self.variables.table.set_joystick(False)\n self.variables.table.set_axis(\n [True, True, True]\n ) # so all axis can be adressed\n errorcode = self.variables.table.move_to(\n ... | [
"0.67286366",
"0.6641986",
"0.66257024",
"0.66009825",
"0.6596117",
"0.649492",
"0.64684224",
"0.6314484",
"0.63081133",
"0.62761515",
"0.6240718",
"0.62358576",
"0.6189635",
"0.618176",
"0.61055577",
"0.60551465",
"0.6049198",
"0.602905",
"0.6027203",
"0.59977496",
"0.598562... | 0.67099565 | 1 |
A list of references to all availability sets in the proximity placement group. | def availability_sets(self) -> Sequence['outputs.SubResourceWithColocationStatusResponse']:
return pulumi.get(self, "availability_sets") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getSets():",
"def available_sets(self, data=None, remote=False):\n if data is None:\n data = [SET_LABELS.RELEASE_DATE, SET_LABELS.BLOCK]\n else:\n if SET_LABELS.RELEASE_DATE not in data:\n data.append(SET_LABELS.RELEASE_DATE)\n if SET_LABELS.BLOCK... | [
"0.6209047",
"0.61726505",
"0.6001793",
"0.58266896",
"0.57690054",
"0.5768825",
"0.5753576",
"0.5750528",
"0.5735078",
"0.573019",
"0.57248986",
"0.5633302",
"0.55227154",
"0.5505786",
"0.5500121",
"0.5497109",
"0.54799634",
"0.5475461",
"0.54534113",
"0.5427677",
"0.5427677... | 0.6932559 | 0 |
Describes colocation status of the Proximity Placement Group. | def colocation_status(self) -> Optional['outputs.InstanceViewStatusResponse']:
return pulumi.get(self, "colocation_status") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_proximity_placement_group_output(include_colocation_status: Optional[pulumi.Input[Optional[str]]] = None,\n proximity_placement_group_name: Optional[pulumi.Input[str]] = None,\n resource_group_name: Optional[pulumi.Input[str]] ... | [
"0.60518825",
"0.55944324",
"0.51280826",
"0.5106413",
"0.4960813",
"0.4956404",
"0.48696086",
"0.4845193",
"0.48329565",
"0.48307562",
"0.48002636",
"0.47613734",
"0.47556528",
"0.47326788",
"0.47120273",
"0.46764436",
"0.46637207",
"0.46574867",
"0.46571022",
"0.46519265",
... | 0.6535979 | 0 |
Specifies the user intent of the proximity placement group. | def intent(self) -> Optional['outputs.ProximityPlacementGroupPropertiesResponseIntent']:
return pulumi.get(self, "intent") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def proximity_placement_group_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"proximity_placement_group_id\")",
"def set_target_org_favor(self, target, org, amount, gossip):\n rep, _ = target.Dominion.reputations.get_or_create(organization=org)\n rep.favor = amount\n ... | [
"0.51500684",
"0.5134789",
"0.49458975",
"0.49388775",
"0.49299842",
"0.48332885",
"0.47327837",
"0.4717751",
"0.47022802",
"0.4651362",
"0.46352458",
"0.45787394",
"0.45650944",
"0.45557648",
"0.4527954",
"0.45201847",
"0.4517139",
"0.45151445",
"0.4511541",
"0.45032752",
"0... | 0.66879284 | 0 |
A list of references to all virtual machine scale sets in the proximity placement group. | def virtual_machine_scale_sets(self) -> Sequence['outputs.SubResourceWithColocationStatusResponse']:
return pulumi.get(self, "virtual_machine_scale_sets") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getSets():",
"def getscales(self):\n return self.scales",
"def scale_model(self) -> List[ClsSetInfo]:\n # Find layer groups\n connected_graph = ConnectedGraph(self._model)\n ordered_module_list = get_ordered_list_of_conv_modules(connected_graph.starting_ops)\n graph_searc... | [
"0.5751221",
"0.5642852",
"0.5589611",
"0.55564994",
"0.552904",
"0.54642105",
"0.5410798",
"0.5333115",
"0.53124064",
"0.528538",
"0.5217663",
"0.52064294",
"0.5205053",
"0.5187349",
"0.5155125",
"0.5154665",
"0.5090085",
"0.5086139",
"0.5064288",
"0.50516343",
"0.50274223",... | 0.6637517 | 0 |
Retrieves information about a proximity placement group . | def get_proximity_placement_group_output(include_colocation_status: Optional[pulumi.Input[Optional[str]]] = None,
proximity_placement_group_name: Optional[pulumi.Input[str]] = None,
resource_group_name: Optional[pulumi.Input[str]] = None,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def proximity_placement_group_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"proximity_placement_group_id\")",
"def get_proximity_placement_group(include_colocation_status: Optional[str] = None,\n proximity_placement_group_name: Optional[str] = None,\... | [
"0.6448816",
"0.6372465",
"0.59885687",
"0.5547061",
"0.52896416",
"0.5240235",
"0.5159709",
"0.514106",
"0.50733167",
"0.50714",
"0.50509393",
"0.50364816",
"0.50350046",
"0.5000382",
"0.49950966",
"0.49934098",
"0.49427128",
"0.49386653",
"0.49252462",
"0.4914164",
"0.49125... | 0.71223414 | 0 |
converts 1Dnumpy array to string readable py plotly.js | def numpy_to_plotlystring(numpy_array, precision=4):
np.set_printoptions(threshold=np.nan) # enables full printing
n_data = np.shape(numpy_array)[0]
# prevent array2string to cut string by ofsestting maximal width
max_line_width=n_data*(8) # Output Format [#.####, ...], thus 7 chars per entry, added 1... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def np2str(a: np.ndarray) -> str:\n return json.dumps(a.tolist())",
"def z_as_plotly(self):\n xs = np.asarray(self.position)[:,2]\n return numpy_to_plotlystring(xs)",
"def x_as_plotly(self):\n xs = np.asarray(self.position)[:,0]\n return numpy_to_plotlystring(xs)",
"def y_as_pl... | [
"0.7462204",
"0.73186773",
"0.71991277",
"0.692029",
"0.65574473",
"0.6528165",
"0.64883965",
"0.64638263",
"0.64638263",
"0.63993347",
"0.6335",
"0.6298709",
"0.6124041",
"0.6007191",
"0.59757954",
"0.5960761",
"0.5929254",
"0.588368",
"0.58670706",
"0.58461416",
"0.5804916"... | 0.78322643 | 0 |
Returns the type of piece in a position on the board | def piece_type(self, pos, board):
piece = board[self.ind(pos)[0]][self.ind(pos)[1]]
return piece | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_piece_type(self, pos):\n piece = self.get_board()[self.ind(pos)[0]][self.ind(pos)[1]]\n return piece",
"def piece_type(self):\n return self._piece_type",
"def piece_type(self):\n return self._piece_type",
"def piece_type(self):\n return self._piece_type",
"def pie... | [
"0.86817193",
"0.7477756",
"0.7477756",
"0.7477756",
"0.7477756",
"0.7477756",
"0.7477756",
"0.74554956",
"0.7289101",
"0.72572297",
"0.69393",
"0.6906759",
"0.66416234",
"0.6636054",
"0.6636054",
"0.66352475",
"0.66080254",
"0.66080254",
"0.66034764",
"0.6596245",
"0.6439447... | 0.8838244 | 0 |
Gives the time in microseconds to transmit num_bytes on the link. | def transmission_time_us(self, num_bytes):
bits_to_transmit = num_bytes * 8
transmission_time_us = (bits_to_transmit / self.megabits_per_second)
return transmission_time_us | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def us(self):\n return 1000 * 1000 * self.read()",
"def _estimate_write_time(self, data):\n return (len(data.encode('utf-8'))/(self.byte_rate))*1.25\n #1.25 multiplier accounts for start & stop bits",
"def ms(self):\n # my clock uses seconds internally\n return 1000 * self.re... | [
"0.6720585",
"0.6504805",
"0.6378402",
"0.62854517",
"0.6226713",
"0.6151735",
"0.61439157",
"0.61234903",
"0.60965896",
"0.6089865",
"0.6087299",
"0.6076675",
"0.6055497",
"0.6042046",
"0.60022366",
"0.5985856",
"0.59717196",
"0.59255844",
"0.59157556",
"0.59102046",
"0.5861... | 0.8264343 | 0 |
The port that is at the receiving end of the _Sublink. | def receiver_port(self):
return self._receiver_port | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def port(self) -> int:\n return self.proto.port",
"def get_port(self):\n return self.port",
"def get_port(self):\n return self.__port",
"def port(self) -> int:",
"def get_port(self) -> int:\n return int(self.socket.getsockname()[1])",
"def port(self):\n return self._por... | [
"0.7565528",
"0.7532018",
"0.74659866",
"0.7439742",
"0.742285",
"0.73868966",
"0.73868966",
"0.73868966",
"0.73868966",
"0.73868966",
"0.73868966",
"0.7381384",
"0.73809",
"0.7347191",
"0.73221254",
"0.7295965",
"0.72778606",
"0.72594",
"0.7227357",
"0.7207438",
"0.7188952",... | 0.7643471 | 0 |
Returns a list of all the input queues of the NetworkDevice instance. | def input_queues(self):
return [port.in_queue for port in self.ports] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_queue_list(self):\n return self.manager.get_queue_list()",
"def queues(self):\r\n return queues.Queues(self)",
"def queues(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:\n return pulumi.get(self, \"queues\")",
"def _get_queues(self):\n return self.__queues",
"... | [
"0.7292679",
"0.6934699",
"0.69167936",
"0.66446567",
"0.66446567",
"0.66446567",
"0.66446567",
"0.66446567",
"0.66446567",
"0.66446567",
"0.66446567",
"0.66446567",
"0.66436195",
"0.6511804",
"0.6432993",
"0.63185084",
"0.604206",
"0.6019034",
"0.5928827",
"0.5894514",
"0.58... | 0.8002415 | 0 |
Timestamp each message in messages with the current time. | def do_timestamp_messages(self, messages):
timestamp = self.env.now
self.reception_records[timestamp] = messages
log.debug("{} recorded {}".format(self, self.reception_records)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_timestamp(self):\n self._timestamp = datetime.datetime.now()",
"def _set_timestamp(self):\n d = datetime.now()\n self._time_stamp = \"{:>2} {} {} {:>2}:{:>02}\".format(\n d.day, MONTH_ABBREV[d.month], d.year, d.hour, d.minute)",
"def update_sent_at_timesta... | [
"0.57357347",
"0.56538224",
"0.55772907",
"0.5564249",
"0.5544044",
"0.55338705",
"0.5520455",
"0.55119085",
"0.5480451",
"0.5466076",
"0.545656",
"0.54557925",
"0.5449149",
"0.5431155",
"0.5430672",
"0.5411746",
"0.53955257",
"0.5393176",
"0.5375465",
"0.5375465",
"0.5371491... | 0.7175772 | 0 |
Load the transmission commands to execute once the run method is activated by simpy. | def load_transmission_commands(self, transmission_commands):
self.transmission_commands = transmission_commands
log.debug("{} loaded transmissions: {}".format(
self, self.transmission_commands)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def commands():\n pass",
"def commands():\n pass",
"def commands():\n pass",
"def commands():\n pass",
"def run_setup_commands(self):\n if not hasattr(self, 'commands') or not self.commands:\n return\n print('{GREEN}Running setup commands...{NC}'.format(**colors))\n ... | [
"0.61570454",
"0.61570454",
"0.61570454",
"0.61570454",
"0.61092925",
"0.60501635",
"0.6043742",
"0.5988766",
"0.57840395",
"0.5749445",
"0.57305175",
"0.5717177",
"0.57016313",
"0.56879026",
"0.5674538",
"0.5642886",
"0.5623862",
"0.5583021",
"0.5561773",
"0.5525386",
"0.552... | 0.6781366 | 0 |
Returns a list of time instants when transmissions will be instructed. | def transmission_start_times(self):
return sorted(self.transmission_commands.keys()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_target_timestamps(self):\n times=[]\n curr = self.begin_ts\n while curr<=self.end_ts:\n times.append(curr)\n curr = curr + 24 * 60 * 60\n return times",
"def ensemble_times(self):\n return self['validtime'].values",
"def transit_times(self):\n ... | [
"0.6600924",
"0.64621645",
"0.6443462",
"0.64339167",
"0.61645526",
"0.6126809",
"0.60728866",
"0.60608023",
"0.6047479",
"0.6042055",
"0.60369664",
"0.60369664",
"0.60369664",
"0.6036148",
"0.60101277",
"0.60079336",
"0.59973717",
"0.59792835",
"0.5938966",
"0.5935055",
"0.5... | 0.65130126 | 1 |
Forward each message in 'message_list' through the appropriate port. Note that forwarding a message from one port to another port is implemented as creating a new message instance based on the message in the first port, and transmitting the new message instance on the second port. | def forward_messages(self, message_list):
def find_ports(destination):
"""
Return a list of the ports that according to the forwarding table
lead to 'destination'.
Arguments:
destination: an instance of class NetworkDevice or an iterable
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _forward(self, messages):\n assert isinstance(messages, (tuple, list))\n assert len(messages) > 0\n assert all(isinstance(message, Message.Implementation) for message in messages)\n assert all(message.community == messages[0].community for message in messages)\n assert all(me... | [
"0.6203733",
"0.5830506",
"0.56460434",
"0.5634888",
"0.55948746",
"0.5523897",
"0.55229384",
"0.5491743",
"0.5479526",
"0.5479526",
"0.5468768",
"0.5325395",
"0.5231763",
"0.5212095",
"0.5202612",
"0.51999635",
"0.51933783",
"0.51795065",
"0.51346564",
"0.5112899",
"0.509607... | 0.8666615 | 0 |
Return a list of the ports that according to the forwarding table lead to 'destination'. | def find_ports(destination):
output_ports = set()
if isinstance(destination, collections.Iterable):
for device in destination:
# ports leading to device
ports_towards_device = self.forwarding_table.get(
device, self.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _GetPorts(self):\n ports = []\n for start, end in self.term.destination_port:\n if start == end:\n ports.append(str(start))\n else:\n ports.append('%d-%d' % (start, end))\n return ports",
"def get_log_forwarding_destinations(self) -> dict:\n uri = f\"{self.uri}/log-for... | [
"0.68636054",
"0.63937044",
"0.6293385",
"0.61560774",
"0.6080188",
"0.60246485",
"0.602398",
"0.59798646",
"0.59217554",
"0.59217554",
"0.5894943",
"0.5894943",
"0.5879433",
"0.58708215",
"0.5780149",
"0.5772737",
"0.5771177",
"0.5760051",
"0.57555175",
"0.5754745",
"0.57275... | 0.8411196 | 0 |
Creates a new message instance using template_message as a template. | def from_message(cls, template_message):
new_equivalent_message = cls(
template_message.env,
template_message.source,
template_message.destination,
template_message.size_bytes,
template_message.message_type,
template_message.data)
r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_message(filename):\n\n with open(filename, 'r', encoding='utf-8') as template_file:\n template_file_contents = template_file.read()\n return Template(template_file_contents)",
"def createMessage( self, *args, **kw ):\n return MailMessage( *args, **kw )",
"def create_message(message_... | [
"0.6601167",
"0.65768903",
"0.6510156",
"0.62768304",
"0.6161473",
"0.6139816",
"0.59907115",
"0.59879017",
"0.5969052",
"0.5905473",
"0.59045595",
"0.5868151",
"0.5855637",
"0.5845727",
"0.58385235",
"0.5831153",
"0.5827659",
"0.5786477",
"0.57841724",
"0.5783322",
"0.578185... | 0.7471443 | 0 |
Returns true if self and message are identical except for the message identifier. | def __eq__(self, message):
return (self.source == message.source and
self.destination == message.destination and
self.size_bytes == message.size_bytes and
self.message_type == message.message_type and
self.data == message.data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n result = NotImplemented\n if isinstance(other, Message):\n result = False\n if self is other:\n result = True\n else:\n # does not compare _id\n if (self._message_length == other._message_length a... | [
"0.75409573",
"0.6845765",
"0.6833236",
"0.67646956",
"0.676177",
"0.67007315",
"0.6687098",
"0.6542909",
"0.6538792",
"0.6526526",
"0.6486344",
"0.64815634",
"0.6458272",
"0.6454662",
"0.6447595",
"0.6419478",
"0.63492614",
"0.6322484",
"0.6286339",
"0.6276497",
"0.6268068",... | 0.735989 | 1 |
Create a player in the dictionary with and fill | def create_player(dct, player_name, place):
dct.update({player_name: ['N/A'] * place}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\r\n self.players = {}",
"def create_player(self, players, player_no, start_tile):\n if player_no in players.keys():\n raise ValueError(f\"Invalid map layout. Can't create player no {player_no} as it already exists.\")\n players[player_no] = Player(player_no, st... | [
"0.71841913",
"0.7117534",
"0.6787139",
"0.6747371",
"0.67037123",
"0.66691554",
"0.6661246",
"0.665843",
"0.66209733",
"0.65938175",
"0.64562774",
"0.64398587",
"0.6433812",
"0.64123106",
"0.6350407",
"0.6346398",
"0.6294373",
"0.62786156",
"0.62754565",
"0.6242238",
"0.6237... | 0.80811304 | 0 |
update a player's rank based on where the place is | def update_player_rank(dct, player_name, place, rank):
dct.get(player_name)[place - 1] = rank | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_player_rank(self, player, rank, match):\n\n # if player isn't moving, do nothing\n if player.rank == rank:\n return\n\n # if player doesn't have a rank yet, make them last\n if player.rank is None:\n player.rank = self.player_set.count()\n\n # upd... | [
"0.78234625",
"0.74328",
"0.73013973",
"0.7031596",
"0.69860005",
"0.69297636",
"0.69227743",
"0.6718269",
"0.65675956",
"0.65450794",
"0.63905835",
"0.6374642",
"0.63725924",
"0.6286222",
"0.62859046",
"0.6284572",
"0.62633055",
"0.62573326",
"0.6210624",
"0.62010586",
"0.61... | 0.8145205 | 0 |
Computes sparse cross entropy between logits and labels. | def sparse_cross_entropy(true, pred, axis=-1, epsilon=1e-7):
true = ivy.one_hot(true, pred.shape[axis])
return cross_entropy(true, pred, axis, epsilon) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sparse_softmax_cross_entropy_with_logits(\n labels=None,\n logits=None,\n name=None):\n _ensure_xent_args(\"sparse_softmax_cross_entropy_with_logits\", labels, logits)\n\n # TODO(pcmurray) Raise an error when the label is not an index in\n # [0, num_classes). Note: This could break users who call t... | [
"0.7383931",
"0.731593",
"0.7313389",
"0.7231131",
"0.71668744",
"0.7103112",
"0.70853496",
"0.70765847",
"0.7019666",
"0.69701236",
"0.6949585",
"0.69058555",
"0.68960786",
"0.68960786",
"0.6874639",
"0.68409586",
"0.68385947",
"0.67765355",
"0.67698383",
"0.67664945",
"0.67... | 0.75039977 | 0 |
Return the number of fixations in the item. | def fixation_count(self) -> int:
return len([fix for fix in self.fixations if not fix.excluded]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total(self) -> int:\n return len(self.fixes)",
"def item_count(self):\n return self.items.shape[0]",
"def count(self, item):\n return _(self._.count(item))",
"def items_num(self):\n\t\treturn len(self.items)",
"def items_num(self):\n\t\treturn len(self.items)",
"def items_num(sel... | [
"0.7213083",
"0.6613063",
"0.6595034",
"0.6532938",
"0.6532938",
"0.6506132",
"0.6467765",
"0.645923",
"0.64033294",
"0.6388774",
"0.632877",
"0.6280365",
"0.623872",
"0.61082006",
"0.61007196",
"0.60832393",
"0.605388",
"0.6051676",
"0.6040764",
"0.6022371",
"0.600364",
"0... | 0.77495074 | 0 |
Event handler for when the "assign" button is clicked | def on_assign(self): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _save_clicked(self, info):\n\n assignment = self._validate(info)\n if assignment is None:\n return\n\n # Update the data in the database.\n try:\n get_permissions_manager().policy_manager.policy_storage.set_assignment(assignment.user_name, [r.name for r in assi... | [
"0.629694",
"0.61017966",
"0.60601336",
"0.5925632",
"0.59112716",
"0.58607006",
"0.58108014",
"0.57452774",
"0.5703086",
"0.5687298",
"0.56709224",
"0.55582875",
"0.55336756",
"0.5520792",
"0.5518935",
"0.54766655",
"0.5393926",
"0.53858465",
"0.5372325",
"0.5365118",
"0.534... | 0.65540296 | 0 |
Event handler for when the "unassign" button is clicked | def on_unassign(self): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_assign_unassign(self, **kwargs):\n\n return self.api_request(self._get_method_fullname(\"update_assign_unassign\"), kwargs)",
"def assignmentsCalced(self, message):\n self.assign_btn.Disable()",
"def unassign(self, assignment, created_by):\n assignee = assignment.assignee\n ... | [
"0.6539649",
"0.6224625",
"0.6205943",
"0.6197301",
"0.60103565",
"0.5933693",
"0.59179527",
"0.58602744",
"0.5758165",
"0.5743737",
"0.57365894",
"0.5708317",
"0.5708317",
"0.5708317",
"0.5708317",
"0.56715363",
"0.5670001",
"0.56364554",
"0.55899113",
"0.55891675",
"0.55556... | 0.75327337 | 0 |
Builds the file tree for overrides compaction | def _build_file_tree(self):
# Build file tree with packmode and weigth info (# of file in the packmode)
root = {"packmode": None, "weight": None, "children": {}}
for filepath, packmode in self.override_packmode_map.items():
node = root
for part in filepath:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _buildindex( self ):\n try:\n import ROOT as rt\n except:\n print \"Could not load ROOT\"\n sys.exit(-1)\n \n # sigh. this is a mess\n self.producers = [] # all producer names found in ROOT files\n self.datatypes = [] # all data types... | [
"0.5822903",
"0.57955813",
"0.57734984",
"0.556816",
"0.54924077",
"0.5468945",
"0.5466384",
"0.5444506",
"0.5417983",
"0.54117495",
"0.540151",
"0.53963",
"0.5385253",
"0.53663236",
"0.5315143",
"0.5312253",
"0.5294251",
"0.52787477",
"0.5272092",
"0.52637345",
"0.524155",
... | 0.71749103 | 0 |
Uses DFS to assign to directory the packmode with maximum weight The override format support assigning a whole directory to a packmode, and having exception in that directory This method assign the packmode with the most files to the directory, so that the least amount of files/directory needs to be specified in the "o... | def _dfs_assign(self, filetree):
stack = [filetree]
while stack:
node = stack.pop()
if isinstance(node, tuple) and node[0]["packmode"] is None:
# all children have been seen already, assing packmode
node = node[0] # unpack the actual node
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _build_file_tree(self):\n # Build file tree with packmode and weigth info (# of file in the packmode)\n root = {\"packmode\": None, \"weight\": None, \"children\": {}}\n for filepath, packmode in self.override_packmode_map.items():\n node = root\n for part in filepath... | [
"0.62167066",
"0.55113137",
"0.545679",
"0.5249099",
"0.52270174",
"0.52258456",
"0.5218894",
"0.5173524",
"0.5060165",
"0.50510776",
"0.5016965",
"0.49667448",
"0.49320337",
"0.4899114",
"0.4883986",
"0.48228544",
"0.48040769",
"0.47905743",
"0.47506174",
"0.47441763",
"0.47... | 0.5894984 | 1 |
Uses recursive DFS to write the overrides from a weigthed, assigned file tree | def _write_overrides(
self, node, parent=None, parent_packmode=None, path_parts=tuple(), root=None
):
if root is None:
root = node
if (parent is root) or (
parent_packmode and node["packmode"] != parent_packmode
):
self.overrides[str(PurePath(*path... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _mutate_file(self, node, visited = set([])):\n for ch in self._get_children(node):\n\n if ch not in visited:\n visited.add(ch)\n\n try:\n self._mutate_node(ch)\n except Exception as e:\n print(e)\n\n ... | [
"0.67543304",
"0.5652397",
"0.55918777",
"0.5476559",
"0.5439046",
"0.54237384",
"0.53918606",
"0.538221",
"0.5363778",
"0.5344074",
"0.52756155",
"0.521393",
"0.517851",
"0.51598054",
"0.5157991",
"0.5055687",
"0.5039144",
"0.50361437",
"0.5031006",
"0.49998572",
"0.49961793... | 0.61889166 | 1 |
Start a combat, make all NPCs to cast skills automatically. | def start_combat(self):
super(HonourAutoCombatHandler, self).start_combat()
# All characters auto cast skills.
for char in self.characters.values():
character = char["char"]
character.start_auto_combat_skill() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def StartCombat(self):\n\n print(\"------------------------------------\")\n self.fighter1.PrintInfo()\n self.fighter2.PrintInfo()\n print(\"------------------------------------\")\n self.combatInProgress = True\n while self.combatInProgress and self.currentTurn < self.max... | [
"0.68635476",
"0.61531",
"0.6022753",
"0.60088336",
"0.5843919",
"0.58394575",
"0.5778643",
"0.56064093",
"0.5535863",
"0.55134916",
"0.5509995",
"0.5499876",
"0.54166967",
"0.5389035",
"0.53655183",
"0.536523",
"0.53433776",
"0.53231376",
"0.5306996",
"0.52780104",
"0.527367... | 0.841464 | 0 |
Finish a combat. Send results to players, and kill all failed characters. | def finish(self):
for char in self.characters.values():
character = char["char"]
character.stop_auto_combat_skill()
super(HonourAutoCombatHandler, self).finish() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def leave_combat(self):\n self.__regen()",
"def endBattle(self):\n self.map.removeDead()\n self.cancelAttackMode()\n self.deselectUnit()",
"def endCompetition(self):\n self.robot_exit = True",
"def finish(self, npc, world):\n pass",
"def finishTurn(self):\n ... | [
"0.5964447",
"0.5951488",
"0.583827",
"0.58253044",
"0.57186526",
"0.569342",
"0.5643143",
"0.5618079",
"0.5599302",
"0.55874985",
"0.556114",
"0.5545428",
"0.5520197",
"0.5506429",
"0.5500326",
"0.5500326",
"0.5500326",
"0.5500326",
"0.54973876",
"0.5483571",
"0.5472781",
... | 0.7119523 | 0 |
to get the data in grid lines | def grid_line(object):
def __init__(self, casenum):
self.casenum = casenum
def getList(self):
"""
to get the whole list of grid line data
"""
lineList = get_array(self.casenum, 'branch')
self.lineList = lineList
return lineList
def getLin... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def grid_lines(self):\n # get edges initially in model coordinates\n use_ref_coords = self.use_ref_coords\n self.use_ref_coords = False\n xyedges = self.xyedges\n self.use_ref_coords = use_ref_coords\n\n xmin = xyedges[0][0]\n xmax = xyedges[0][-1]\n ymin = x... | [
"0.67843086",
"0.6667962",
"0.6639809",
"0.65646976",
"0.6479268",
"0.6388036",
"0.6334958",
"0.63266695",
"0.6300384",
"0.62831205",
"0.62409914",
"0.619513",
"0.61594695",
"0.61511624",
"0.61485094",
"0.6129613",
"0.61257434",
"0.61074805",
"0.60834837",
"0.60828245",
"0.60... | 0.72366786 | 0 |
in this example, multiple threads are run main started myfunc started with realpython myfunc1 started with foo myfunc2 started with haha myfunc ended myfunc2 ended myfunc1 ended main ended | def example4(name):
print("main started") # main thread
t1 = threading.Thread(target=my_func, args=['realpython']) # the second thread
t1.start()
t2 = threading.Thread(target=my_func1, args=['foo']) # the third thread
t2.start()
t3 = threading.Thread(target=my_func2, args=['haha']) # the fourth ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def example5(name):\n print(\"main started\") # main thread\n with concurrent.futures.ThreadPoolExecutor(max_workers=3) as e:\n e.map(my_func, ['realpython', 'bar', 'haha'])\n print(\"main ended\")",
"def example0(name):\n print(\"main started\")\n my_func(\"realpython\")\n print(\"main ... | [
"0.72712207",
"0.7134418",
"0.6344133",
"0.62373",
"0.5900686",
"0.58492994",
"0.57990813",
"0.57882786",
"0.5758856",
"0.5754322",
"0.5727432",
"0.5726683",
"0.5707882",
"0.5698103",
"0.5674418",
"0.564004",
"0.5619732",
"0.561841",
"0.5604227",
"0.5597306",
"0.55969626",
... | 0.756083 | 0 |
This example recreates example4 but in a more efficient way using thread pool main started myfunc started with realpython myfunc started with bar myfunc started with haha myfunc ended myfunc ended myfunc ended main ended | def example5(name):
print("main started") # main thread
with concurrent.futures.ThreadPoolExecutor(max_workers=3) as e:
e.map(my_func, ['realpython', 'bar', 'haha'])
print("main ended") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def example0(name):\n print(\"main started\")\n my_func(\"realpython\")\n print(\"main ended\")",
"def example4(name):\n print(\"main started\") # main thread\n t1 = threading.Thread(target=my_func, args=['realpython']) # the second thread\n t1.start()\n t2 = threading.Thread(target=my_func1... | [
"0.7121908",
"0.70680535",
"0.6010677",
"0.5877939",
"0.58015925",
"0.5801124",
"0.5707956",
"0.56762254",
"0.5649907",
"0.562774",
"0.562774",
"0.562774",
"0.562774",
"0.562774",
"0.562774",
"0.562774",
"0.562774",
"0.562774",
"0.562774",
"0.562774",
"0.562774",
"0.562774"... | 0.75483465 | 0 |
Generate a hex UID | def generate_uid(length=10):
uid = uuid.uuid4().hex[0:length]
return uid | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_uid():\n return random_string(5, string.hexdigits.lower())\n # return (\"%x\" % (int(time.time()) * 0x10 % 0x1000000000)\n # + random_string(7, string.hexdigits.lower()))",
"def generate_user_id() -> str:\n return 'u' + str((uuid.getnode()))",
"def new_uid():\n return str(uuid... | [
"0.8424885",
"0.77790034",
"0.77502453",
"0.76640016",
"0.7663068",
"0.75369626",
"0.75063133",
"0.7452815",
"0.7432415",
"0.7419043",
"0.74088436",
"0.74088436",
"0.73718894",
"0.72921085",
"0.7273682",
"0.7256061",
"0.7255503",
"0.7239619",
"0.7232834",
"0.7204194",
"0.7201... | 0.7920812 | 1 |
Computes the name of a county given it's zipcode | def county_name(zipcode):
search = SearchEngine(simple_zipcode=True) # set simple_zipcode=False to use rich info database
zipcode_query = search.by_zipcode(str(zipcode))
zipcode_query_dict = zipcode_query.to_dict()
county = zipcode_query_dict['county']
if county is None:
print('Invalid Coun... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def city_country(city_name, country_name):\n city_country_combo = city_name + ', ' + country_name\n return city_country_combo.title()",
"def city_country(city_name, country_name):\n combi = f\"{city_name.title()}, {country_name.title()}\"\n return combi.title()",
"def city_state_zip(**kwargs):\r\n ... | [
"0.6422869",
"0.63803333",
"0.63314253",
"0.6329193",
"0.6269642",
"0.6251078",
"0.6227773",
"0.6216738",
"0.618028",
"0.61654603",
"0.61536604",
"0.61536604",
"0.60994875",
"0.6088756",
"0.6076896",
"0.6072779",
"0.60661525",
"0.6040675",
"0.6012614",
"0.59852415",
"0.595690... | 0.8695817 | 0 |
Analyze returns the expected list of rule matches. | def test_analyze(self, mock_requests: mock.MagicMock, mock_output: mock.MagicMock):
yara_matches = self._analyzer.analyze('/target.exe')
self._assert_request(mock_requests, mock_output)
self.assertEqual(1, len(yara_matches))
match = yara_matches[0]
self.assertEqual('THOR', match... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def match_rules(rules, wm):\n res = []\n for r in rules:\n new_patterns = match_rule(r[0],r[1],r[2], wm)\n if new_patterns:\n print(\" Match succeeds\")\n print(\" Adding assertions to WM\")\n else:\n print(\" Match fails\... | [
"0.5835707",
"0.58267164",
"0.55471814",
"0.5527018",
"0.5368063",
"0.5300912",
"0.52113616",
"0.51996094",
"0.5143646",
"0.5127022",
"0.51096666",
"0.5081547",
"0.50634825",
"0.506103",
"0.50559425",
"0.5054468",
"0.5012354",
"0.5004759",
"0.50028557",
"0.5001351",
"0.499751... | 0.5871569 | 0 |
After each test, rolls back the sandboxed_session | def rollback_session_after_test(self, sandboxed_session):
yield
sandboxed_session.rollback() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tearDown(self):\n self.session.close()",
"def teardown_session(e):\n my_db.close()\n OT_spider.close()",
"def tearDown(self): \n db.session.rollback()",
"def tearDown(self): \n db.session.rollback()",
"def tearDown(self):\n self.sess.close()",
"... | [
"0.7122727",
"0.6794178",
"0.6663135",
"0.6663135",
"0.66445196",
"0.66358507",
"0.66308486",
"0.6602018",
"0.65987426",
"0.6561146",
"0.6548552",
"0.6548552",
"0.6532302",
"0.6532302",
"0.6532302",
"0.6532302",
"0.6532302",
"0.6532302",
"0.65306467",
"0.6514152",
"0.6481635"... | 0.8207038 | 0 |
Retrieves the current IAM policy data for bucket example ```python import pulumi import pulumi_gcp as gcp policy = gcp.storage.get_bucket_iam_policy(bucket=google_storage_bucket["default"]["name"]) ``` | def get_bucket_iam_policy(bucket: Optional[str] = None,
opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetBucketIamPolicyResult:
__args__ = dict()
__args__['bucket'] = bucket
opts = pulumi.InvokeOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
__ret__ = pulu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_bucket_iam_policy_output(bucket: Optional[pulumi.Input[str]] = None,\n opts: Optional[pulumi.InvokeOptions] = None) -> pulumi.Output[GetBucketIamPolicyResult]:\n ...",
"def get_bucket_policy(Bucket=None):\n pass",
"def policy(self) -> typing.Optional[\"BucketPolicy... | [
"0.8047549",
"0.7948865",
"0.69205636",
"0.69205636",
"0.6630802",
"0.6520681",
"0.63187873",
"0.6244433",
"0.6199992",
"0.6199992",
"0.61718905",
"0.61498356",
"0.61498356",
"0.6139455",
"0.6080319",
"0.60535866",
"0.6042336",
"0.600247",
"0.598721",
"0.592493",
"0.5898587",... | 0.8031223 | 1 |
Retrieves the current IAM policy data for bucket example ```python import pulumi import pulumi_gcp as gcp policy = gcp.storage.get_bucket_iam_policy(bucket=google_storage_bucket["default"]["name"]) ``` | def get_bucket_iam_policy_output(bucket: Optional[pulumi.Input[str]] = None,
opts: Optional[pulumi.InvokeOptions] = None) -> pulumi.Output[GetBucketIamPolicyResult]:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_bucket_iam_policy(bucket: Optional[str] = None,\n opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetBucketIamPolicyResult:\n __args__ = dict()\n __args__['bucket'] = bucket\n opts = pulumi.InvokeOptions.merge(_utilities.get_invoke_opts_defaults(), opts)\n __re... | [
"0.8031692",
"0.79494417",
"0.6921183",
"0.6921183",
"0.6630346",
"0.6521183",
"0.63191986",
"0.6243815",
"0.6201865",
"0.6201865",
"0.6170791",
"0.6149633",
"0.6149633",
"0.61402816",
"0.60815215",
"0.6054667",
"0.6043298",
"0.60041904",
"0.5985827",
"0.59267944",
"0.5898068... | 0.80478656 | 0 |
Fetch data from Genesys and save it into Json files. This data is used to study the duplication level between USDA and CGN. | def fetch_data():
log = logging.getLogger(__name__)
log.info('Checking data files...')
if not os.path.isfile('CGN.txt'):
params_cgn = {
'institute.code': ['NLD037'],
# 'crops': ['tomato'],
'taxonomy.genus': ['Solanum', 'Lycopersicon'],
'taxonomy.specie... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def download_genotype_data():\n print(\"downloading genotype data\")\n download_from_url(PSAM_PATH, dst=f\"{GENOTYPE_DATA_PATH}/{MERGED_GENOTYPE_FILE}.psam\", desc=\"downloading psam\")\n download_from_url(PVAR_PATH, dst=f\"{GENOTYPE_DATA_PATH}/{MERGED_GENOTYPE_FILE}.pvar.zst\",\n des... | [
"0.5973477",
"0.5803134",
"0.57299006",
"0.5714865",
"0.56429684",
"0.56429684",
"0.56427765",
"0.56059736",
"0.55862916",
"0.55444044",
"0.55252194",
"0.54157865",
"0.53990847",
"0.53948665",
"0.53821665",
"0.5366713",
"0.53538084",
"0.5352743",
"0.53450966",
"0.5336839",
"0... | 0.76027054 | 0 |
Get all instances of this class in the registry. | def get_instances(cls, recursive=False):
instances = list(cls._instances)
if recursive:
for Child in cls.__subclasses__():
instances += Child.get_instances(recursive=recursive)
# Remove duplicates from multiple inheritance.
return list(set(instances)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_instances(cls):\n raise NotImplementedError",
"def get_all_cached_instances(cls):\n return list(cls.__dbclass__.__instance_cache__.values())",
"def getinstances(cls):\n\t\t\tdead = set()\n\t\t\tfor ref in cls._instances:\n\t\t\t\tobj = ref()\n\t\t\t\tif obj is not None:\n\t\t\t\t\tyield o... | [
"0.7619687",
"0.72287494",
"0.70653266",
"0.7045179",
"0.6888304",
"0.68455154",
"0.68399835",
"0.6827565",
"0.6720347",
"0.6706184",
"0.66594434",
"0.6623655",
"0.6620567",
"0.65878433",
"0.65827703",
"0.6566919",
"0.6550206",
"0.65336657",
"0.6468475",
"0.64582914",
"0.6431... | 0.732727 | 1 |
Instantiate a new build rule based on kwargs. Appropriate args list varies with rule type. | def new(ruletype, **kwargs):
try:
ruleclass = TYPE_MAP[ruletype]
except KeyError:
raise error.InvalidRule('Unrecognized rule type: %s' % ruletype)
try:
return ruleclass(**kwargs)
except TypeError:
log.error('BADNESS. ruletype: %s, data: %s', ruletype, kwargs)
rai... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build(cls, **kwargs):\n return cls(kwargs) #pylint: disable=no-value-for-parameter",
"def __init__(self, *args):\n this = _libsbml.new_Rule(*args)\n try: self.this.append(this)\n except: self.this = this",
"def construct(args,\n **kwargs):\n kw = parse_args(args)... | [
"0.6302051",
"0.61495674",
"0.5984927",
"0.59743166",
"0.5813008",
"0.5790656",
"0.5728552",
"0.57015586",
"0.5655793",
"0.5636998",
"0.5636998",
"0.5636998",
"0.5636998",
"0.5636998",
"0.56218827",
"0.56109154",
"0.55799127",
"0.55431616",
"0.54849225",
"0.54520905",
"0.5445... | 0.69835865 | 0 |
Takes an unsorted list, a threshold, below which insertion sort is used instead of merge sort, and a boolean reverse, which determines if the list is sorted in increasing or decreasing order. This part splits the list into progressively smaller parts then calls merge to put it all back together | def merge_sort(unsorted, threshold, reverse):
length = len(unsorted)
if length < 2:
return unsorted
elif length < threshold:
return insertion_sort(unsorted, reverse)
else:
mid = length//2
list1 = unsorted[0:mid]
list2 = unsorted[mid:length]
list1... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge_sort(input_list,start,end):\n if start < end:\n mid=(start+end)//2\n merge_sort(input_list,start,mid)\n merge_sort(input_list,mid+1,end)\n return merge(input_list,start,mid,end)",
"def test_list_with_unbalanced_halves():\n lst = [2, 4, 3, 8, 1, 9, 10, 13]\n assert m... | [
"0.6500331",
"0.64686525",
"0.6465554",
"0.64295685",
"0.64216506",
"0.6392987",
"0.63503456",
"0.63239914",
"0.6315092",
"0.62860906",
"0.62561256",
"0.62519425",
"0.6209382",
"0.62084955",
"0.620024",
"0.6192919",
"0.6174429",
"0.6171197",
"0.61506146",
"0.61372715",
"0.612... | 0.76275474 | 0 |
Merges two lists, first and second, in either increasing or decreasing order, depending on reverse | def merge(first, second, reverse):
final = [0]*(len(first)+len(second))
i = 0
j = 0
if reverse:
while i+j < len(final):
if (j >= len(second)) or ((i < len(first)) and (first[i] > second[j])):
final[i+j] = first[i]
i += 1
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge(l1, l2):\n\n #Reverse the lists\n l1 = list(reversed(l1))\n l2 = list(reversed(l2))\n\n ret = []\n\n while True:\n # If either list is empty, reverse the other one and append it to the end\n if not l1:\n ret.extend(reversed(l2))\n return ret\n if ... | [
"0.78887236",
"0.76090616",
"0.74231946",
"0.74130917",
"0.74009126",
"0.7382625",
"0.7322549",
"0.7304537",
"0.7280156",
"0.7268654",
"0.7245732",
"0.7214211",
"0.7207699",
"0.71946347",
"0.7191366",
"0.71792436",
"0.7142443",
"0.7132886",
"0.71247315",
"0.7108219",
"0.70609... | 0.7846751 | 1 |
Fetch a single legislation expression, if it exists, by filtering on the FRBR URI. We do this because there is no GET endpoint for a work FRBR URI, only an expression FRBR URI. By default, only fetches the id and frbr_uri fields. Specify a list of fields to fetch otherwise. | def find_legislation(self, frbr_uri_prefix, fields=('field_frbr_uri',)):
params = {
'filter[field_frbr_uri][value]': frbr_uri_prefix,
'filter[field_frbr_uri][operator]': 'STARTS_WITH'
}
if fields:
params['fields[node--legislation]'] = ','.join(fields)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_legislation(self, expr_uri, fields=('field_frbr_uri',)):\n # the GET request requires this accept header, not the default one\n headers = {\n 'Accept': 'application/json',\n }\n params = {}\n if fields:\n params['fields[node--legislation]'] = ','.joi... | [
"0.69796807",
"0.49620867",
"0.48607516",
"0.4747582",
"0.47416613",
"0.46898153",
"0.4659622",
"0.45725793",
"0.4541741",
"0.45356673",
"0.45117137",
"0.44913068",
"0.44750413",
"0.4474428",
"0.44622138",
"0.44539246",
"0.4417351",
"0.44019884",
"0.43827352",
"0.43553713",
"... | 0.64284 | 1 |
Fetch a single legislation expression, if it exists. By default, only fetches the id and frbr_uri fields. Specify a list of fields to fetch otherwise. | def get_legislation(self, expr_uri, fields=('field_frbr_uri',)):
# the GET request requires this accept header, not the default one
headers = {
'Accept': 'application/json',
}
params = {}
if fields:
params['fields[node--legislation]'] = ','.join(fields)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_legislation(self, frbr_uri_prefix, fields=('field_frbr_uri',)):\n params = {\n 'filter[field_frbr_uri][value]': frbr_uri_prefix,\n 'filter[field_frbr_uri][operator]': 'STARTS_WITH'\n }\n\n if fields:\n params['fields[node--legislation]'] = ','.join(fie... | [
"0.61241204",
"0.51818883",
"0.49835798",
"0.49209628",
"0.49200243",
"0.48930994",
"0.47840205",
"0.4743934",
"0.45873097",
"0.4581193",
"0.45607665",
"0.45160976",
"0.44856694",
"0.4447797",
"0.44260952",
"0.4411156",
"0.4410095",
"0.4408937",
"0.440199",
"0.43945158",
"0.4... | 0.7090029 | 0 |
List all legislation expressions for a place. | def list_legislation(self, place_code):
results = []
params = {
'filter[field_frbr_uri][value]': f'/akn/{place_code}/',
'filter[field_frbr_uri][operator]': 'STARTS_WITH',
'fields[node--legislation]': 'field_frbr_uri',
}
url = self.url + '/jsonapi/node/... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def legends(self):\n return [leg for leg in self._legends]",
"def list_formulae():\n return _list_tindyb_unique_values(\"formula\", dbpath=__dbpath__)",
"def describe_locations():\n pass",
"def _derive_country_MX(place):\n lname = place.name.lower()\n derived = []\n match = _PARENTHETIC... | [
"0.5264176",
"0.49682465",
"0.49632758",
"0.49632642",
"0.49223864",
"0.49025452",
"0.4897046",
"0.48797643",
"0.48588276",
"0.48420218",
"0.47878242",
"0.4753311",
"0.47311145",
"0.4720755",
"0.4714829",
"0.4704091",
"0.47006062",
"0.47000864",
"0.46678424",
"0.46594155",
"0... | 0.610629 | 0 |
Create a new legislation expression and return the full description. | def create_legislation(self, expr_uri, info):
resp = self.session.post(
self.url + expr_uri,
json=info,
headers={'Content-Type': JSON_CONTENT_TYPE},
timeout=self.timeout)
self.check_for_error(resp)
info = resp.json()['data']
if not info:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_descr(self, attr_name):",
"def leg_maker(size=40, color='0x9C661F'):\n leg = GOval(size, size+30)\n leg.filled = True\n leg.fill_color = color\n leg.color = color\n return leg",
"def description(self):\n assert not self._expression_used\n self._handle_used = True\n return sel... | [
"0.57703763",
"0.5612563",
"0.5591931",
"0.5380776",
"0.53548706",
"0.5211884",
"0.512674",
"0.51117057",
"0.51014334",
"0.5098089",
"0.5097364",
"0.50892615",
"0.50838184",
"0.50791925",
"0.50747347",
"0.507339",
"0.5043403",
"0.50364876",
"0.503377",
"0.5032216",
"0.5019911... | 0.5830445 | 0 |
Upload a file to the lii and return the node id. | def upload_file(self, node, fname, data, fieldname):
resp = self.session.post(
self.url + f'/jsonapi/node/{node}/{fieldname}',
data=data,
headers={
'Content-Type': 'application/octet-stream',
'Content-Disposition': f'attachment; filename="{fnam... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upload_file(self, f):\n return self._telegraph.upload_file(f)",
"def node_file_upload(ctx, file, filename):\n filepath = click.format_filename(file)\n filename = filename if filename else filepath\n\n with open(file, \"r\") as f:\n content = f.read()\n\n try:\n ctx.obj['node'... | [
"0.7023373",
"0.687328",
"0.6477241",
"0.6289029",
"0.62865573",
"0.6145262",
"0.6127179",
"0.60793984",
"0.6061025",
"0.6020251",
"0.6013384",
"0.59927136",
"0.5989776",
"0.5945167",
"0.59342283",
"0.5850324",
"0.5836321",
"0.583418",
"0.58282876",
"0.5811652",
"0.5753125",
... | 0.723194 | 0 |
List files associated with a legislation node. | def list_legislation_files(self, nid, field):
resp = self.session.get(self.url + f"/jsonapi/node/legislation/{nid}/{field}", timeout=self.timeout)
self.check_for_error(resp)
return resp.json()['data'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def listFiles(self):\n pass",
"def list_file(self, path: str) -> List[FileName]:\n current_file = self.file_exists(path)\n if current_file is None:\n raise FileNotExistException(\n \"Path doesn't exist. Can't list non-existent path\"\n )\n if curre... | [
"0.69451326",
"0.65188605",
"0.63498425",
"0.6243756",
"0.6219241",
"0.6154089",
"0.61321485",
"0.6004312",
"0.5975518",
"0.5971345",
"0.59706646",
"0.5954831",
"0.5954498",
"0.5953372",
"0.59485877",
"0.5926061",
"0.59160614",
"0.59031665",
"0.58852905",
"0.5877798",
"0.5866... | 0.7763789 | 0 |
Retrieve the tcp identified by the specified identifier | def getIpTcp(self):
query = ''
conn = self.get_connection()
headers = { 'Content-type' : 'application/json', 'Authorization' : 'A10 %s' %self.sessionid}
conn.request('GET', self.get_path() + '/' + query, headers=headers)
response = conn.getresponse()
expected_status = 200
errors = {500: 'An unexpected run... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lookup_socket(self, address): # TODO: optimize me\n\n net_tuple = self.read_nodestate(0)\n for item in net_tuple:\n discovered_address = item[1]\n if address == discovered_address:\n return item[0]",
"def tcp_socket(self) -> Optional[pulumi.Input['TCPSocket... | [
"0.59464496",
"0.55471534",
"0.5472671",
"0.54111755",
"0.53893316",
"0.5299998",
"0.52808774",
"0.5254719",
"0.5224211",
"0.52072257",
"0.5200745",
"0.5184563",
"0.5152923",
"0.5148989",
"0.5146435",
"0.51278967",
"0.5104274",
"0.51016253",
"0.5075102",
"0.5066041",
"0.50655... | 0.69662493 | 0 |
Remove the tcp identified by the specified identifier from the system | def deleteIpTcp(self):
query = ''
conn = self.get_connection()
headers = { 'Content-type' : 'application/json', 'Authorization' : 'A10 %s' %self.sessionid}
conn.request('DELETE', self.get_path() + '/' + query, headers=headers)
response = conn.getresponse()
expected_status = 200
errors = {500: 'An unexpect... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_tcp(ctx, global_ip, global_port, local_ip, local_port):\n\n # Verify the ip address format \n if is_valid_ipv4_address(local_ip) is False:\n ctx.fail(\"Given local ip address {} is invalid. Please enter a valid local ip address !!\".format(local_ip))\n\n if is_valid_ipv4_address(global_i... | [
"0.66617686",
"0.61916286",
"0.61521727",
"0.58983296",
"0.58463335",
"0.5779146",
"0.5741216",
"0.57381725",
"0.5735484",
"0.57274055",
"0.56983846",
"0.5684289",
"0.56816524",
"0.5629058",
"0.5621266",
"0.5618001",
"0.5610599",
"0.5610599",
"0.56052005",
"0.5603235",
"0.555... | 0.74882025 | 0 |
Retrieve all tcp objects currently pending in the system | def getAllIpTcps(self):
query = ''
conn = self.get_connection()
headers = { 'Content-type' : 'application/json', 'Authorization' : 'A10 %s' %self.sessionid}
conn.request('GET', self.get_path() + '/' + query, headers=headers)
response = conn.getresponse()
expected_status = 200
errors = {500: 'An unexpected... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetListTCPObjects(self):\n rdata =[]\n total = 0\n with open(self.ServerInfo['MgmtObjects'].MGMTServerFilePathTCPPorts) as f:\n data = json.load(f)\n total = data['total']\n if total == 0:\n return None\n for i in range(total):\n # prin... | [
"0.69517106",
"0.64199525",
"0.6138711",
"0.6105612",
"0.59809905",
"0.5949874",
"0.59222156",
"0.5889137",
"0.57988304",
"0.5736065",
"0.5722521",
"0.57223004",
"0.57219213",
"0.5707166",
"0.56596583",
"0.56313956",
"0.5623342",
"0.55821925",
"0.557804",
"0.5577517",
"0.5568... | 0.69884336 | 0 |
Get the length of the linked list | def get_length(self):
curr = self.head
length = 0
while curr != None:
length += 1
curr = curr.link
return length | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_length(self):\n pointer = self.head\n counter = 0\n while pointer:\n counter += 1\n pointer = pointer.next_node\n return counter",
"def length(self):\n return self.linked_list.length()",
"def length(self):\r\n current_node = self.head\r\n ... | [
"0.8839559",
"0.88344073",
"0.8750934",
"0.86144745",
"0.83789593",
"0.8362712",
"0.83407676",
"0.83168334",
"0.83009917",
"0.82192546",
"0.8112709",
"0.8077225",
"0.80621135",
"0.80393803",
"0.80384076",
"0.8028961",
"0.79636455",
"0.79584897",
"0.7937",
"0.7933721",
"0.7933... | 0.8840205 | 0 |
Get the element at specified position or returns None if position does not exist | def get_element(self, pos):
curr = self.head
count = 1
while curr != None:
if count == pos:
return curr.data
curr = curr.link
count += 1
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_position(self, pos):\n element = self.head\n count = 1\n\n if pos == 1:\n return element\n elif pos > 1 and self.head:\n while count < pos:\n element = element.next\n count += 1\n if element is None:\n ... | [
"0.7687424",
"0.7412961",
"0.6943923",
"0.68401533",
"0.67232615",
"0.67172253",
"0.66860145",
"0.66341776",
"0.6605367",
"0.6601718",
"0.6578222",
"0.6516474",
"0.6492555",
"0.6492555",
"0.64918137",
"0.64886534",
"0.647172",
"0.6471375",
"0.64704806",
"0.64075685",
"0.63981... | 0.7868817 | 0 |
Muestra la webcam y detecta los rostros y las emociones en tiempo real para dibujar los emojis. | def show_webcam_and_run(model, emoticons, window_size=None, window_name='webcam', update_time=10):
cv2.namedWindow(window_name, WINDOW_NORMAL)
if window_size:
width, height = window_size
cv2.resizeWindow(window_name, width, height)
# 选择摄像头,0为本地
vc = cv2.VideoCapture(0) # http://192.168... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_frame(self):\r\n\r\n # Reading the Video and grasping the Frames\r\n _, frame = self.video.read()\r\n\r\n # Converting the Color image to Gray Scale\r\n gray_frame = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)\r\n\r\n # Image size is reduced by 30% at each image scale.\r\n ... | [
"0.6349221",
"0.61298025",
"0.60099834",
"0.5987401",
"0.5907742",
"0.58317894",
"0.5773631",
"0.57720965",
"0.5752085",
"0.57329386",
"0.5702524",
"0.56955504",
"0.5686861",
"0.5675076",
"0.56712705",
"0.5658507",
"0.5623298",
"0.5621945",
"0.558406",
"0.5580833",
"0.5568899... | 0.67097116 | 0 |
Get the stride between lines of a C matrix | def get_matrix_stride(mat):
itemsize = mat.itemsize
stride = mat.strides[0] // itemsize
assert mat.strides == (stride * itemsize, itemsize)
return stride | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def out_stride(self):\n return 4",
"def lineout(data, cencol, pxwidth = 3):\n frame_dimension = len(data)\n spectrum_intensities = np.array([ sum( [data[i][j] for j in range(cencol-pxwidth,cencol+pxwidth+1)] ) for i in range(frame_dimension) ])\n return spectrum_intensities",
"def out_stride(self):... | [
"0.6341353",
"0.6026125",
"0.6015157",
"0.5969687",
"0.5904242",
"0.58180946",
"0.5800844",
"0.57403153",
"0.5735365",
"0.57338125",
"0.5727915",
"0.5695839",
"0.5649859",
"0.56348044",
"0.5630995",
"0.55920064",
"0.5587389",
"0.55793166",
"0.5561398",
"0.5519366",
"0.5517608... | 0.6712748 | 0 |
Check that the matrix of double looks fine | def check_double_matrix(mat):
if len(mat.shape) != 2:
sys.stderr.write("Invalid matrix: dimension {} not {}\n"
.format(len(mat.shape), 2))
return False
# If the strides hasn't got the same number of elements, really weird
# things happened... Let's abort in such cas... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testMatrix(m):\n print \"Testing the spread matrix:\"\n for i in m.matrix:\n if float('%.3g' % sum(i)) != 1.000 and sum(i) != 0:\n print \"The spread is not as expected\", sum(i)\n return\n print \"Matrix is acceptable\"",
"def _check_matrix(self,... | [
"0.6854547",
"0.6790353",
"0.67284423",
"0.6678701",
"0.6612804",
"0.6561573",
"0.64683634",
"0.63938135",
"0.63869256",
"0.6364449",
"0.63438624",
"0.6276176",
"0.6272913",
"0.62640566",
"0.6256419",
"0.6254902",
"0.62461764",
"0.62152296",
"0.6209413",
"0.6194714",
"0.61872... | 0.68912345 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.