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
add words to the hook, the freq can be zero
def add_word(self, word, freq=None): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hook(self, sentence, words):\n pass", "def add_word(self, word):\r\n word = word.strip().lower()\r\n if word in self.builtin_words:\r\n return\r\n if word not in self.word_count:\r\n self.word_count[word] = 1\r\n else:\r\n self.word_count[wo...
[ "0.69517446", "0.6657809", "0.6642947", "0.66001993", "0.65204823", "0.65122044", "0.6511084", "0.64812547", "0.64495873", "0.6446654", "0.64199805", "0.6322514", "0.6322514", "0.63023627", "0.6289761", "0.6264287", "0.625373", "0.6221482", "0.62176096", "0.6214713", "0.61868...
0.7625774
0
hook to the new words
def hook(self, sentence, words): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _onWord(self, name, location, length):\n logging.debug(\"onWord...\")", "def words(self, word):\n pass", "def new_match(self, new_word): \n self.rhyming_words.append(new_word)", "def replace_words_fun(self):\n\n cleaned_doc = []\n for word in str(self.doc).s...
[ "0.73335236", "0.70898795", "0.6857864", "0.6740064", "0.6655703", "0.66475874", "0.66398466", "0.65910035", "0.6578497", "0.65458024", "0.6518663", "0.6515241", "0.6465367", "0.6461474", "0.64537036", "0.643757", "0.64302313", "0.6394466", "0.6372546", "0.6360671", "0.635584...
0.8223545
0
Get the value of the bracket_as_entity option.
def bracket_as_entity(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _entity_as_text(self):\n return str(self.value)", "def tag_value(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"tag_value\")", "def value_expression(self) -> Optional[str]:\n return pulumi.get(self, \"value_expression\")", "def value_expression(self) -> str:\n ...
[ "0.5723108", "0.546387", "0.5426668", "0.5333664", "0.53097063", "0.5231422", "0.52310586", "0.52190936", "0.52190936", "0.52109015", "0.52036643", "0.52036643", "0.51383114", "0.51383114", "0.51383114", "0.51383114", "0.51383114", "0.51383114", "0.51383114", "0.51383114", "0...
0.6956395
0
Get the value of the en_quote_as_entity option.
def en_quote_as_entity(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _entity_as_text(self):\n return str(self.value)", "def zh_quote_as_entity(self):\n pass", "def get_quotes(self):\n # However ignore the 'true' autodetection setting.\n jscs_quotes = self.jscs_options.get('validateQuoteMarks')\n if isinstance(jscs_quotes, dict):\n ...
[ "0.675374", "0.64509875", "0.57066256", "0.56627864", "0.5602044", "0.55100125", "0.53501636", "0.53001523", "0.53001523", "0.52353424", "0.5217777", "0.520476", "0.5186793", "0.51678133", "0.51678133", "0.51678133", "0.51433784", "0.51433784", "0.5109276", "0.50877744", "0.5...
0.7657667
0
Get the value of the use_en option.
def use_en(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_locale():\n setting = Setting.query.filter(Setting.name == 'default_language').first()\n\n if setting is not None:\n return setting.value\n\n # Return default language when none found\n return 'en'", "def get_language(self):\n return self.lang", "def get_lang(self):\n r...
[ "0.6574013", "0.6493536", "0.6492421", "0.64415383", "0.64187646", "0.6410013", "0.63214946", "0.6320696", "0.62423205", "0.62373483", "0.61986905", "0.6169279", "0.6161956", "0.6158396", "0.61440474", "0.61357933", "0.61304784", "0.61289316", "0.6108886", "0.6078264", "0.605...
0.7486109
0
Get the value of the use_zh option.
def use_zh(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def t(eng, chinese):\n return chinese if 'zh' in get_info().user_language else eng", "def use_chinese_lang():\n with patch.object(seafes_config, 'lang', 'chinese'):\n yield", "def get_language_of_horizon_url(self) -> str:\n if 'horizons-mag' in self.url_h:\n self.language = 'en'\...
[ "0.6717505", "0.56976795", "0.5680074", "0.55777305", "0.55127275", "0.5499445", "0.54354364", "0.5415517", "0.53936756", "0.5374183", "0.5350128", "0.533878", "0.5309943", "0.5309798", "0.5280812", "0.52690613", "0.5253077", "0.5231036", "0.52178603", "0.52027667", "0.518736...
0.74061096
0
Get the value of the zh_quote_as_entity option.
def zh_quote_as_entity(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def en_quote_as_entity(self):\n pass", "def quote_id(self) -> Optional[str]:\n return pulumi.get(self, \"quote_id\")", "def _entity_as_text(self):\n return str(self.value)", "def include_quote(self) -> Optional[bool]:\n return pulumi.get(self, \"include_quote\")", "def get_quote...
[ "0.6517354", "0.5597231", "0.5549282", "0.5526326", "0.5342145", "0.52442676", "0.5122187", "0.48057586", "0.47615916", "0.47427595", "0.47066078", "0.46741903", "0.4667675", "0.46673623", "0.4613167", "0.4613167", "0.4602033", "0.45982847", "0.45765555", "0.45765555", "0.456...
0.7811794
0
Get the email addresses collected between startdate and enddate.
def get_email_addresses(startdate, enddate, user, password): emails = [] page = 1 more_pages = True while more_pages: response = requests.get( 'https://restapi.surveygizmo.com/v2/survey/{survey}' '/surveyresponse?' 'filter[field][0]=datesubmitted' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_email_addresses(survey, startdatetime, enddatetime):\n token = settings.SURVEYGIZMO_API_TOKEN\n secret = settings.SURVEYGIZMO_API_TOKEN_SECRET\n emails = []\n page = 1\n more_pages = True\n survey_id = SURVEYS[survey][\"email_collection_survey_id\"]\n dtfmt = \"%Y-%m-%d+%H:%M:%S\"\n\n ...
[ "0.73143333", "0.6333139", "0.6218128", "0.60530376", "0.6030352", "0.59828067", "0.59139085", "0.5899869", "0.5890026", "0.584429", "0.5836746", "0.57966304", "0.57616365", "0.5750106", "0.5744556", "0.57397467", "0.57338107", "0.5727751", "0.5707086", "0.57034266", "0.56868...
0.77689946
0
Checks that the default parameters of an ExtrudeCircleShape are correct.
def test_default_parameters(self): assert self.test_shape.rotation_angle == 360 assert self.test_shape.extrude_both
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_default_parameters(self):\n\n assert self.test_shape.center_coordinate == (0.0, 0.0, 0.0)", "def test_default_parameters(self):\n\n # assert self.test_shape.rotation_angle == 360\n assert self.test_shape.start_angle == 0", "def test_default_parameters(self):\n\n assert self...
[ "0.7234929", "0.6976932", "0.6569412", "0.6049638", "0.5911374", "0.58454925", "0.55786914", "0.55746585", "0.55698836", "0.55458", "0.5545174", "0.54440904", "0.54202956", "0.5415855", "0.5415855", "0.541363", "0.5402548", "0.5379901", "0.5365727", "0.53643066", "0.53586715"...
0.7183801
1
Creates an ExtrudeCircleShape with another ExtrudeCircleShape cut out and checks that the volume is correct.
def test_cut_volume(self): shape_with_cut = ExtrudeCircleShape(points=[(30, 0)], radius=20, distance=40, cut=self.test_shape) assert shape_with_cut.volume() == pytest.approx((math.pi * (20**2) * 40) - (math.pi * (10**2) * 30))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_intersect_volume(self):\n\n intersect_shape = ExtrudeCircleShape(points=[(30, 0)], radius=5, distance=50)\n\n intersected_shape = ExtrudeCircleShape(\n points=[(30, 0)],\n radius=10,\n distance=50,\n intersect=[self.test_shape, intersect_shape],\n ...
[ "0.7168453", "0.619414", "0.5716917", "0.56402206", "0.5580943", "0.5580943", "0.55319566", "0.5295469", "0.52860016", "0.52201635", "0.5207854", "0.51808774", "0.5158859", "0.5153207", "0.5115594", "0.51125956", "0.51054686", "0.50718325", "0.5044905", "0.50279474", "0.49805...
0.7148607
1
Creates ExtrudeCircleShapes with other ExtrudeCircleShapes intersected and checks that their volumes are correct.
def test_intersect_volume(self): intersect_shape = ExtrudeCircleShape(points=[(30, 0)], radius=5, distance=50) intersected_shape = ExtrudeCircleShape( points=[(30, 0)], radius=10, distance=50, intersect=[self.test_shape, intersect_shape], ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _intersected(positions, radius):\n P1 = positions[0]\n P2 = positions[1]\n P3 = positions[2]\n temp1 = P2 - P1\n e_x = temp1 / np.linalg.norm(temp1)\n temp2 = P3 - P1\n i = np.dot(e_x, temp2)\n temp3 = temp2 - i * e_x\n e_y = temp3 / np.linalg.norm...
[ "0.54239005", "0.5234049", "0.52122986", "0.5175614", "0.5172687", "0.51635194", "0.51555014", "0.5080032", "0.5074395", "0.50595355", "0.50466657", "0.50424504", "0.5032449", "0.5030777", "0.50256217", "0.501177", "0.5008883", "0.50016856", "0.50016856", "0.49965402", "0.498...
0.71537566
0
Creates an ExtrudeCircleShape with extrude_both = True and False and checks that the volumes are correct.
def test_extrude_both(self): test_volume_extrude_both = self.test_shape.volume() self.test_shape.extrude_both = False assert self.test_shape.volume() == pytest.approx(test_volume_extrude_both)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_intersect_volume(self):\n\n intersect_shape = ExtrudeCircleShape(points=[(30, 0)], radius=5, distance=50)\n\n intersected_shape = ExtrudeCircleShape(\n points=[(30, 0)],\n radius=10,\n distance=50,\n intersect=[self.test_shape, intersect_shape],\n ...
[ "0.6457117", "0.53838617", "0.5200422", "0.51258683", "0.50411856", "0.50411856", "0.49835268", "0.4979422", "0.49603626", "0.4946774", "0.490671", "0.48764306", "0.48548558", "0.4835276", "0.48327264", "0.4805391", "0.4801365", "0.4793305", "0.47818324", "0.47760746", "0.477...
0.59421295
1
Exports and stp file with mode = solid and wire and checks that the outputs exist and relative file sizes are correct.
def test_export_stp(self): os.system("rm test_solid.stp test_solid2.stp test_wire.stp") self.test_shape.export_stp("test_solid.stp", mode="solid") self.test_shape.export_stp("test_solid2.stp") self.test_shape.export_stp("test_wire.stp", mode="wire") assert Path("test_solid.stp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_file_placement(mol_params):\n snapshot = init_from_none(mol_params)\n context = hoomd.context.initialize(mol_params.hoomd_args)\n production(snapshot, context, mol_params, dynamics=True)\n\n params = {\n \"molecule\": mol_params.molecule,\n \"pressure\": mol_params.pressure,\n ...
[ "0.574924", "0.56949127", "0.56544244", "0.56111264", "0.55992764", "0.5592849", "0.5569697", "0.5554061", "0.5532291", "0.5523748", "0.55029756", "0.55000603", "0.54876405", "0.5481802", "0.5458784", "0.5409814", "0.5402028", "0.5396599", "0.5384231", "0.5362747", "0.5309667...
0.7696644
1
Matches if all of the given matchers are satisfied by any elements of the sequence.
def has_items(*items): matchers = [] for item in items: matchers.append(wrap_matcher(item)) return IsSequenceContainingEvery(*matchers)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def any_of(*args):\n class AnyOfMatcher:\n def __init__(self, values):\n self.values = values\n\n def __eq__(self, other):\n return any(map(lambda v: v == other, self.values))\n\n def __ne__(self, other):\n return all(map(lambda v: v != other, self.values))\...
[ "0.6793648", "0.62049425", "0.6130358", "0.61209214", "0.60859215", "0.5958338", "0.5958338", "0.5905211", "0.58609545", "0.58154076", "0.58081245", "0.5749853", "0.5748864", "0.5746182", "0.5741673", "0.5715509", "0.5714579", "0.57087773", "0.56990945", "0.56659824", "0.5553...
0.7360219
0
Gets the access_window of this PopSettings. The range of messages which are accessible via POP.
def access_window(self): return self._access_window
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def access_window(self, access_window):\n allowed_values = [\"accessWindowUnspecified\", \"allMail\", \"disabled\", \"fromNowOn\"]\n if access_window not in allowed_values:\n raise ValueError(\n \"Invalid value for `access_window` ({0}), must be one of {1}\"\n ...
[ "0.5653705", "0.53341067", "0.5250064", "0.51709527", "0.51709527", "0.5137791", "0.5124928", "0.502916", "0.50011027", "0.49883795", "0.49689424", "0.49561146", "0.49306852", "0.49140164", "0.48545784", "0.48499143", "0.48499143", "0.48053774", "0.48042098", "0.47514024", "0...
0.6474205
0
Sets the access_window of this PopSettings. The range of messages which are accessible via POP.
def access_window(self, access_window): allowed_values = ["accessWindowUnspecified", "allMail", "disabled", "fromNowOn"] if access_window not in allowed_values: raise ValueError( "Invalid value for `access_window` ({0}), must be one of {1}" .format(access_wind...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_window_rect(self, value: bool):\n self._caps['setWindowRect'] = value", "def SetWindow(self, w):\r\n\r\n self.window = w", "def handleMonitorSettings(self):\n winPos = self.mainWindow.pos()\n popPos = QtCore.QPoint(winPos.x() + (self.mainWindow.width() - self.settingsPopup.w...
[ "0.486651", "0.48349455", "0.47570282", "0.46907958", "0.4688979", "0.45993996", "0.4583975", "0.45784625", "0.4382934", "0.43772432", "0.43756816", "0.43718892", "0.4349676", "0.43433076", "0.43346232", "0.43279564", "0.43230143", "0.43029824", "0.43011537", "0.42961788", "0...
0.73256314
0
Gets the disposition of this PopSettings. The action that will be executed on a message after it has been fetched via POP.
def disposition(self): return self._disposition
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disposition(self, disposition):\n allowed_values = [\"archive\", \"dispositionUnspecified\", \"leaveInInbox\", \"markRead\", \"trash\"]\n if disposition not in allowed_values:\n raise ValueError(\n \"Invalid value for `disposition` ({0}), must be one of {1}\"\n ...
[ "0.58163434", "0.558854", "0.51367563", "0.49677005", "0.4939197", "0.4939197", "0.4939197", "0.4939197", "0.4939197", "0.4939197", "0.49037772", "0.4865473", "0.48381123", "0.47464013", "0.47021428", "0.46780324", "0.46780324", "0.46662363", "0.46597967", "0.46557334", "0.46...
0.7230888
0
Sets the disposition of this PopSettings. The action that will be executed on a message after it has been fetched via POP.
def disposition(self, disposition): allowed_values = ["archive", "dispositionUnspecified", "leaveInInbox", "markRead", "trash"] if disposition not in allowed_values: raise ValueError( "Invalid value for `disposition` ({0}), must be one of {1}" .format(disposit...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disposition(self):\n return self._disposition", "def set_popup_mode(self, mode: str):\n if mode not in POPUP_MODES:\n raise ValueError(\"Invalid mode.\")\n self.setPopupMode(POPUP_MODES[mode])", "def delivery_mode(self, delivery_mode):\n\n self._delivery_mode = delive...
[ "0.62285453", "0.50006455", "0.4993129", "0.4591924", "0.4530001", "0.45073426", "0.4486179", "0.44548517", "0.4436408", "0.43279582", "0.4305703", "0.42922822", "0.42594072", "0.42561954", "0.41788253", "0.4150163", "0.41420588", "0.41411808", "0.40983132", "0.40756333", "0....
0.7115136
0
Given the urls already in the correct order, downloads each image into the given directory. Gives the images local filenames img0, img1, and so on. Creates an index.html in the directory with an img tag to show each local image file. Creates the directory if necessary.
def download_images(img_urls, dest_dir): # Creating the directory if the directory does not already exist if not os.path.exists(str(dest_dir)): os.mkdir(dest_dir) print ('Retrieving...') with open(str(dest_dir) + '/index.html', 'w') as f: f.write("<html>\n<body>\n") for index, ur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_images(img_urls, dest_dir):\n if not os.path.exists(dest_dir):\n # If the directory doesn't exist, create it\n os.mkdir(dest_dir)\n count = 0\n img_string = ''\n # Copies each file from the url provided to the directory provided\n for file in img_urls:\n new_filenam...
[ "0.8684506", "0.83942056", "0.83148164", "0.79432535", "0.7850097", "0.7684212", "0.7544121", "0.7534679", "0.7316021", "0.7306084", "0.7305959", "0.7237736", "0.716367", "0.71477824", "0.69875336", "0.6962605", "0.69536203", "0.69242907", "0.6902611", "0.6824033", "0.6726385...
0.8439321
1
Parse args, scan for urls, get images from urls
def main(args): parser = create_parser() if not args: parser.print_usage() sys.exit(1) parsed_args = parser.parse_args(args) img_urls = read_urls(parsed_args.logfile) if parsed_args.todir: download_images(img_urls, parsed_args.todir) else: print('\n'.join(img_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main(args):\n parser = create_parser()\n\n if not args:\n parser.print_usage()\n sys.exit(1)\n\n parsed_args = parser.parse_args(args)\n\n img_urls = read_urls(parsed_args.logfile)\n if parsed_args.todir:\n download_images(img_urls, parsed_args.todir)\n else:\n pri...
[ "0.70296556", "0.65749073", "0.65041465", "0.64431983", "0.63387156", "0.6273555", "0.61993766", "0.618466", "0.61794204", "0.61319304", "0.60635006", "0.60485786", "0.6020802", "0.59960306", "0.59640354", "0.5945829", "0.5926145", "0.5853876", "0.58419275", "0.58381164", "0....
0.7047148
1
Loads a yaml file and adds line numbers to the objects
def load_yaml_with_lines(config): try: # Source: https://stackoverflow.com/a/13319530 loader = yaml.Loader(config) def compose_node(parent, index): # the line number where the previous token has ended (plus empty lines) line = loader.line node = Composer....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_yaml_file(self, path):\n with path.open('r') as handle:\n data = load_yaml(handle)\n\n self.set_all(**self.SCHEMA.load(data).data)", "def __init__(self, yaml_file_path: Path) -> None:\n with yaml_file_path.open(\"r\") as yaml_file:\n self._yaml = YAML().load(ya...
[ "0.6319262", "0.6127903", "0.61255294", "0.60530853", "0.5874739", "0.5830585", "0.58296055", "0.5783401", "0.57766116", "0.57485676", "0.5716792", "0.5712814", "0.5704829", "0.5702566", "0.5691395", "0.56750816", "0.56460726", "0.5640595", "0.56267923", "0.5590943", "0.55880...
0.6834053
0
Prepare the sequences used by the Neural Network
def prepare_sequences(notes, n_vocab): sequence_length = 50 # get all pitch names pitchnames = sorted(set(item for item in notes)) # create a dictionary to map pitches to integers note_to_int = dict((note, number) for number, note in enumerate(pitchnames)) network_input = [] network_outp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepare_sequences(notes, n_vocab):\n sequence_length = GLOBAL_SEQUENCE_LENGTH\n\n # Get all pitch names\n pitchnames = sorted(set(item for item in notes))\n\n # Create a dictionary to map pitches to integers\n note_to_int = dict((note, number) for number, note in enumerate(pitchnames))\n\n ne...
[ "0.6553083", "0.6475834", "0.6432852", "0.6399662", "0.6352282", "0.6343611", "0.6190251", "0.6177846", "0.61391133", "0.6133018", "0.611801", "0.6101248", "0.60848916", "0.6037434", "0.60365427", "0.60153496", "0.60053694", "0.5964059", "0.59410936", "0.5940806", "0.59196734...
0.6686778
0
Add last layer to the convnet
def add_new_last_layer(base_model, nb_classes): x = base_model.output x = GlobalAveragePooling2D()(x) x = Dense(FC_SIZE, activation='relu')(x) #new FC layer, random init predictions = Dense(nb_classes, activation='softmax')(x) #new softmax layer model = Model(inputs=base_model.input, outputs=predi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_new_last_layer(base_model, nb_classes):\r\n x = base_model.output\r\n x = GlobalAveragePooling2D()(x)\r\n x = Dense(fc_size, activation='relu')(x) #new FC layer, random init\r\n predictions = Dense(nb_classes, activation='softmax')(x) #new softmax layer\r\n model = Model(inputs=base_model.in...
[ "0.7642628", "0.75002295", "0.7415982", "0.73166895", "0.66593826", "0.6591134", "0.6555395", "0.6465286", "0.6461949", "0.6428054", "0.6412877", "0.6385468", "0.6374509", "0.63645524", "0.62897575", "0.6263358", "0.62580836", "0.6250857", "0.6193484", "0.6168419", "0.6165371...
0.7567512
1
Removes an item from a multidict key.
def remove_from_multidict(d: MultiDict, key: str, item: typing.Any): # works by popping all, removing, then re-adding into i = d.popall(key, []) if item in i: i.remove(item) for n in i: d.add(key, n) return d
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _del_item(dic: dict, keys: list):\n\tdic = _get_item(dic, keys[:-1])\n\tdel dic[keys[-1]]", "def remove_item(self, item):\r\n\r\n for key in self._inner_dict:\r\n if item in self._inner_dict[key]:\r\n idx = self._inner_dict[key].index(item)\r\n del self._inner_...
[ "0.7515226", "0.75018364", "0.73690116", "0.7158925", "0.70968735", "0.70163935", "0.699003", "0.69833624", "0.69397354", "0.6935612", "0.69065166", "0.68776804", "0.6868091", "0.68556577", "0.6816006", "0.68149227", "0.68076974", "0.6798965", "0.6796473", "0.6791444", "0.679...
0.85784006
0
Base64ifys an image to send to discord.
def base64ify(image_data: bytes): # Convert the avatar to base64. mimetype = imghdr.what(None, image_data) if not mimetype: raise ValueError("Invalid image type") b64_data = base64.b64encode(image_data).decode() return "data:{};base64,{}".format(mimetype, b64_data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def b64_image(self) -> bytes:\n buffer = BytesIO()\n self.image.save(buffer, \"PNG\") \n im_b64 = base64.b64encode(buffer.getvalue())\n im_b64 = b\"data:image/png;base64,\" + im_b64\n return im_b64", "def base64(self):\n image = self.png.getvalue()\n return base...
[ "0.7444348", "0.7358379", "0.7203927", "0.7129906", "0.7109309", "0.7104519", "0.7082573", "0.6939985", "0.6869495", "0.6822275", "0.6782609", "0.6778094", "0.677527", "0.6764435", "0.6751479", "0.67436206", "0.6699742", "0.66778314", "0.660669", "0.6593207", "0.65859663", ...
0.7620646
0
Converts a Discordformatted timestamp to a datetime object.
def to_datetime(timestamp: str) -> datetime.datetime: if timestamp is None: return if timestamp.endswith("+00:00"): timestamp = timestamp[:-6] try: return datetime.datetime.strptime(timestamp, "%Y-%m-%dT%H:%M:%S.%f") except ValueError: # wonky datetimes return d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_timestamp(ts):\n format = '%Y-%m-%d %H:%M:%S'\n return datetime.strptime(ts, format)", "def _timestamp_to_datetime(timestamp):\n return datetime.fromtimestamp(timestamp * 0.001, tz=timezone.utc)", "def get_datetime_from_timestamp(timestamp: str) -> datetime.datetime:\n return dateti...
[ "0.745324", "0.73894274", "0.7363517", "0.7086619", "0.70164067", "0.6976756", "0.6949481", "0.6927075", "0.69260484", "0.66861904", "0.6679699", "0.66663504", "0.66598463", "0.664685", "0.6620737", "0.65995663", "0.6588165", "0.65610904", "0.6533557", "0.6528402", "0.6528402...
0.7474306
0
Traverses the stack for an object of type ``t``.
def _traverse_stack_for(t: type): for fr in inspect.stack(): frame = fr.frame try: locals = frame.locals except AttributeError: # idk continue else: for object in locals.values(): if type(object) is t: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def probe_stack(depth = 10):\n if depth == 0:\n return\n probe_stack(depth - 1)", "def do_display_stack_objects(self, args):\n start = self.reader.StackTop()\n end = self.reader.StackBottom()\n if len(args) != 0:\n args = args.split(' ')\n start = self.ParseAddressExpr(args[0])\n e...
[ "0.5210974", "0.5194495", "0.5193176", "0.5170919", "0.51102453", "0.5105788", "0.5105216", "0.5067196", "0.5058047", "0.50093937", "0.50008374", "0.4970677", "0.48915708", "0.48852113", "0.48597592", "0.48541418", "0.48447248", "0.48348817", "0.48050487", "0.480471", "0.4798...
0.7825187
0
Subclasses an immutable builtin, providing method wrappers that return the subclass instead of the original.
def subclass_builtin(original: type): def get_wrapper(subclass, func): @functools.wraps(func) def __inner_wrapper(self, *args, **kwargs): result = func(self, *args, **kwargs) new = subclass(result) # copy the parent dataclass if we need to if 'paren...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wrap(cls, orig):\n # hack to give the timestamp this class' specialized methods\n orig.__class__ = cls\n return orig", "def __copy__(self):\n return type(self)(self.value)", "def make_immutable(self):\n # just set the flag to make object immutable and hashable\n se...
[ "0.60920924", "0.59345937", "0.5797206", "0.5673648", "0.56651944", "0.5658072", "0.5650036", "0.5575062", "0.55314976", "0.5498412", "0.54812056", "0.5425845", "0.5407955", "0.5403788", "0.53938985", "0.53634125", "0.53393614", "0.5313916", "0.53056425", "0.52979714", "0.529...
0.6362824
0
Extract FASTQ filename and read header from Waden Sea FASTA headers.
def transform_fasta_header(fastaheader): fastq_source, read_header = fastaheader.split(" ", 1)[0].rsplit("_", 1) fastq_base = fastq_source.rsplit("_", 1)[0] return fastq_base, read_header
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extractHeader(file) :\n\n headerDispatching = {\n \t'AL': extractALFOSCHeader,\n \t'NC': extractNOTCAMHeader,\n \t'MO': extractMOSCAHeader,\n \t'ST': extractSTANCAMHeader,\t\n\t'FI': extractFIESHeader\n }\n\n fn = headerDispatching.get(os.path.basename(file)[:2], extractOldALFOSCHeader)\n retur...
[ "0.6401179", "0.62904555", "0.62217855", "0.6192803", "0.60394955", "0.5990652", "0.5989857", "0.59722316", "0.5967548", "0.59647876", "0.59257495", "0.58719146", "0.58522266", "0.584659", "0.5842128", "0.5835512", "0.58078194", "0.57997817", "0.5782842", "0.5766097", "0.5757...
0.64500093
0
Return a pair of complete fastq filenames for fastq_base.
def fastq_filename(fastq_base): return fastq_base+"_1.fastq", fastq_base+"_2.fastq"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_hq_fq(self):\n return op.join(self.combined_dir, 'all.polished_hq.fastq')", "def all_lq_fq(self):\n return op.join(self.combined_dir, 'all.polished_lq.fastq')", "def fq_of_arrowed_bin(self, first, last):\n return self._arrowed_bin_prefix(first, last) + \".arrowed.fastq\"", "def g...
[ "0.6794959", "0.6590789", "0.655755", "0.63155407", "0.62391496", "0.6222754", "0.6189609", "0.61213464", "0.60903966", "0.59978986", "0.5983365", "0.5931376", "0.5890936", "0.5836683", "0.5803387", "0.57962996", "0.57486457", "0.5661792", "0.5644376", "0.56189114", "0.561437...
0.82848316
0
Build a query to find all summary entries for the given PDB.
def query(self, session, pdb): return session.query(mod.UnitInteractionSummary).\ filter_by(pdb_id=pdb)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def query_summary(self):\n return self.details[KEY_QUERY_SUMMARY]", "def search_summaries(self, **query):\n for _, results in self._do_search_by_product(query, return_fields=True):\n for columns in results:\n yield dict(columns)", "def get_summary(self, query):\n\n ...
[ "0.5428255", "0.53583986", "0.52812225", "0.5227681", "0.5199599", "0.5171266", "0.5095973", "0.5043583", "0.49843055", "0.4918133", "0.48670068", "0.48459524", "0.4845896", "0.48094174", "0.4802881", "0.48007256", "0.47844446", "0.477813", "0.47563112", "0.47450638", "0.4740...
0.632136
0
Increment the count of the current bp. If the base pair is in `Loader.ignore_bp` we return the current counts.
def increment_bp(self, current, bp, crossing): if bp in self.ignore_bp: return current return self.increment(current, 'bps', bp, crossing)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pycount(self):\n\n self.count += 1\n return self.count", "def bpCount(file):\n amount_bp = len(file)\n return amount_bp", "def increment_counter(self) -> None:", "def counter(self) -> int:", "def counter(self) -> int:", "def fget(self):\n if not hasattr(self, \"_n\"...
[ "0.6269762", "0.60979223", "0.60404366", "0.59808373", "0.59808373", "0.5931304", "0.5916859", "0.5893586", "0.5866122", "0.5754383", "0.5724916", "0.5691284", "0.5618478", "0.56114733", "0.5611444", "0.5597437", "0.55804634", "0.55729675", "0.5571835", "0.5542841", "0.553719...
0.6975057
0
Insert the node n beginning at index position pos.
def insert(self, n, pos): if pos == 0: self.cons(n) else: prev = self.index(pos-1) next = prev.next prev.next = n n.next = next self.len += 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert(self, value, pos):\r\n\r\n if self.head is None:\r\n self.head = Node(value)\r\n return\r\n\r\n if pos == 0:\r\n self.prepend(value)\r\n return\r\n\r\n index = 0\r\n node = self.head\r\n while node.next and index <= pos:\r\n ...
[ "0.72740185", "0.7103719", "0.69398314", "0.6928973", "0.6863136", "0.68557435", "0.6832058", "0.6755653", "0.67459166", "0.667409", "0.666163", "0.6628564", "0.6612427", "0.65446794", "0.6527768", "0.65218896", "0.6517661", "0.65158284", "0.6425271", "0.64027345", "0.6361295...
0.82437086
0
Append the node n to the end of the list.
def append(self, n): last = self.last() if last: last.next = n self.len += 1 else: self.cons(n)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert(self, n, new_node):\n curr_node = self.head\n \n i = 0\n while i < n:\n if curr_node.next is None:\n raise IndexError(\"list is shorter than n\")\n curr_node = curr_node.next\n i += 1\n \n new_node.next = curr_node...
[ "0.69705254", "0.687432", "0.6709675", "0.6645751", "0.6608237", "0.6569515", "0.64727336", "0.64642847", "0.64602023", "0.6447882", "0.64307994", "0.6425153", "0.637969", "0.6370489", "0.6370111", "0.6368923", "0.63669413", "0.6334651", "0.63345844", "0.63304853", "0.6326456...
0.8417494
0
Start a cluster which should be in stopped status currently.
def cluster_start(r): cluster_id = request_get(r, "cluster_id") if not cluster_id: logger.warning("No cluster_id is given") return make_fail_response("No cluster_id is given") if cluster_handler.start(cluster_id): return jsonify(response_ok), CODE_OK return make_fail_response("c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def startCluster():\n # attempt to create a cluster\n print(\"Creating a Redshift cluster...\")\n try:\n redshift.create_cluster(\n\n # hardware parameters\n ClusterType=DWH_CLUSTER_TYPE,\n NodeType=DWH_NODE_TYPE,\n NumberOfNodes=int(DWH_NUM_NODES),\n\n ...
[ "0.71251774", "0.68893415", "0.68576354", "0.6779097", "0.6720754", "0.67115116", "0.6646528", "0.6419284", "0.63756603", "0.632783", "0.6314102", "0.6290016", "0.6287659", "0.62627524", "0.6175558", "0.6173656", "0.61347663", "0.6123808", "0.6108847", "0.61067957", "0.608645...
0.7536392
0
Stop a cluster which should be in running status currently.
def cluster_stop(r): cluster_id = request_get(r, "cluster_id") if not cluster_id: logger.warning("No cluster_id is given") return make_fail_response("No cluster_id is given") if cluster_handler.stop(cluster_id): return jsonify(response_ok), CODE_OK return make_fail_response("clu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop(self, data):\n return ClusterStopper(my_cluster=self).detach_cluster(data)", "def stop(self):\n response = self._shell_client.exec_command('{} stop'.format(self._executable_path), async=False)\n\n if not response.is_success():\n self._logger.error('clusterrunner stop fail...
[ "0.73711646", "0.7304418", "0.7216645", "0.70051634", "0.6953816", "0.6932318", "0.6856211", "0.67420995", "0.67134136", "0.66507083", "0.6637439", "0.65622604", "0.64982796", "0.6497791", "0.6390566", "0.63871026", "0.63806355", "0.6330831", "0.62956965", "0.6294592", "0.628...
0.8240757
0
Apply a cluster. Return a Cluster json body.
def cluster_apply(r): request_debug(r, logger) user_id = request_get(r, "user_id") if not user_id: logger.warning("cluster_apply without user_id") return make_fail_response("cluster_apply without user_id") allow_multiple, condition = request_get(r, "allow_multiple"), {} consensus_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cluster_apply_dep():\n request_debug(r, logger)\n\n user_id = request_get(r, \"user_id\")\n if not user_id:\n logger.warning(\"cluster_apply without user_id\")\n return make_fail_response(\"cluster_apply without user_id\")\n\n allow_multiple, condition = request_get(r, \"allow_multipl...
[ "0.7015488", "0.66317344", "0.64640945", "0.6455852", "0.643635", "0.63785547", "0.62163526", "0.60002464", "0.5994259", "0.59464735", "0.5941902", "0.59388435", "0.58669645", "0.5845137", "0.58328575", "0.5817479", "0.5765258", "0.570312", "0.57025146", "0.56841063", "0.5670...
0.7457299
0
Release a cluster which should be in used status currently.
def cluster_release(r): cluster_id = request_get(r, "cluster_id") if not cluster_id: logger.warning("No cluster_id is given") return make_fail_response("No cluster_id is given") if cluster_handler.release_cluster(cluster_id): return jsonify(response_ok), CODE_OK return make_fail...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shutdown_cluster(self):\n self.cluster.shutdown()", "def delete_cluster(self):", "def delete_cluster(ctx, project_name, cluster_name):\n project = ctx.obj.groups.byName[project_name].get().data\n ctx.obj.groups[project.id].clusters[cluster_name].delete().data\n click.echo(\"DONE!\")", "def de...
[ "0.6199519", "0.608621", "0.59004456", "0.5865586", "0.5860563", "0.5860563", "0.5860563", "0.5860563", "0.5860563", "0.5860563", "0.5804406", "0.5800434", "0.5766697", "0.5753451", "0.5695906", "0.5686576", "0.5686143", "0.5662215", "0.5662215", "0.5662215", "0.56477755", ...
0.7784186
0
Issue some operations on the cluster. e.g., /cluster_op?action=apply&user_id=xxx will apply a cluster for user
def cluster_actions(): request_debug(r, logger) action = request_get(r, "action") logger.info("cluster_op with action={}".format(action)) if action == "apply": return cluster_apply(r) elif action == "release": return cluster_release(r) elif action == "start": return clust...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cluster_apply(r):\n request_debug(r, logger)\n\n user_id = request_get(r, \"user_id\")\n if not user_id:\n logger.warning(\"cluster_apply without user_id\")\n return make_fail_response(\"cluster_apply without user_id\")\n\n allow_multiple, condition = request_get(r, \"allow_multiple\"...
[ "0.6829137", "0.66824836", "0.58821654", "0.5845386", "0.57353073", "0.57178664", "0.5618976", "0.56063074", "0.55692333", "0.54906636", "0.5473863", "0.546417", "0.5444256", "0.5412049", "0.53761446", "0.5353043", "0.53529376", "0.5323731", "0.5293265", "0.52870196", "0.5276...
0.7598276
0
Parse and return number of incidents by day of the week
def fetch_incident_by_days(parsed_data): incident_counter = dict() for incident in parsed_data: day_of_week = incident['DayOfWeek'] if day_of_week in incident_counter: incident_counter[day_of_week] += 1 else: incident_counter[day_of_week] = 1 return incident...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hindu_day_count(cls, date):\n return date - cls.EPOCH", "def compute_heatsum_per_week(heatsum_day, day=5):\n heatsum_week = {}\n for k in heatsum_day:\n year, week, weekday = map(int, datetime.datetime.strftime(datetime.datetime.strptime(k, '%Y-%m-%d'), '%Y %W %w').split())\n if we...
[ "0.6143644", "0.60441977", "0.59760845", "0.596039", "0.5862452", "0.58511275", "0.57420796", "0.57377696", "0.5718578", "0.57159406", "0.57054317", "0.56977046", "0.56142634", "0.5614007", "0.5611032", "0.55930954", "0.55916303", "0.55655766", "0.5558739", "0.5548449", "0.55...
0.79031706
0
Parse and return count of total incidents and unresolved incidents by category
def fetch_incident_by_category_and_resolution(parsed_data): incident_counter = dict() for incident in parsed_data: category = incident['Category'] resolution = incident['Resolution'] if category in incident_counter: incident_counter[category][0] += 1 if resolutio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_risk_categories(data):\n results = Counter([row['risk_category'] for row in data])\n if '' in results:\n results['No Violations'] = results['']\n del results['']\n return results", "def fetch_incident_by_days(parsed_data):\n incident_counter = dict()\n\n for incident in par...
[ "0.63893837", "0.6150627", "0.59409535", "0.579892", "0.57733595", "0.5721786", "0.5692909", "0.5685599", "0.5677747", "0.55068487", "0.544998", "0.544998", "0.53930646", "0.5385647", "0.5385461", "0.5301101", "0.52837664", "0.5264914", "0.5201706", "0.5188228", "0.5154808", ...
0.7612092
0
Data visualization of total incidents and fraction of unresolved incidents per category via bar graph
def visualize_type(parsed_data, output_dir): # Fetching incident data by category counter = fetch_incident_by_category_and_resolution(parsed_data) # List of total incidents by Category # list of unsolved incidents by Category y1_values = [item[0] for item in counter.values()] y2_values = [item...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def category_bar_chart(df):\n label_names = df.drop(['message', 'original', 'genre', 'id'], axis=1).columns\n label_counts = []\n for column in label_names:\n label_counts.append(df[column].sum())\n return {\n 'data': [\n Bar(\n x=label_names,\n ...
[ "0.636478", "0.6169683", "0.61512375", "0.61238253", "0.6020945", "0.59974974", "0.59757274", "0.59205467", "0.5895362", "0.5847873", "0.5773675", "0.57487893", "0.5739332", "0.5734073", "0.57228506", "0.5708981", "0.5675812", "0.5629417", "0.5622804", "0.5611301", "0.560582"...
0.6276634
1
Check that the given metadata has correct types for all its members.
def check_metadata(metadata): message = 'The given metadata contains unsupported types.' assert all([item['type'] in ['category', 'value'] for item in metadata['details']]), message
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _metadata_is_consistent(metadata):\n checks = []\n required = ('version', 'fields', 'size', 'width', 'height', 'points',\n 'viewpoint', 'data')\n for f in required:\n if f not in metadata:\n print('%s required' % f)\n checks.append((lambd...
[ "0.71089", "0.67898035", "0.65201443", "0.6332316", "0.62834567", "0.6140083", "0.612568", "0.6124426", "0.610049", "0.6036116", "0.6000703", "0.59797204", "0.593941", "0.59330225", "0.592734", "0.5916956", "0.5866322", "0.5858302", "0.5841307", "0.58241904", "0.5821699", "...
0.7577669
0
Validate inputs for functions whose first argument is a numpy.ndarray with shape (n,1).
def check_inputs(function): def decorated(self, data, *args, **kwargs): if not (isinstance(data, np.ndarray) and len(data.shape) == 2 and data.shape[1] == 1): raise ValueError('The argument `data` must be a numpy.ndarray with shape (n, 1).') return function(self, data, *args, **kwargs) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_input_shapes(*args):\n\n # Collect the shapes of the inputs\n shapes = set()\n\n # DESIGN NOTES - currently allow:\n # - scalars,\n # - 0 dim ndarrays (also scalars but packaged differently)\n # - 1 dim ndarrays with only a single value\n\n for val in args:\n if isinstan...
[ "0.696551", "0.68897444", "0.68860936", "0.6620291", "0.6588289", "0.6457762", "0.64314246", "0.6405052", "0.64038384", "0.6370529", "0.6309466", "0.6070468", "0.6018504", "0.5987222", "0.5961908", "0.5931549", "0.59065855", "0.5864621", "0.5858168", "0.5847836", "0.5837565",...
0.7947115
0
Listener will be called every second with the number of seconds passed since cog load
async def on_timer_update(self, secs: int): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_tick(self, time):\n pass", "def realtime(self):", "def timer_callback(self):\n self.get_logger().debug(f\"Timer heartbeat {self.timer_count}\")\n self.timer_count += 1", "def timer_handler():\r\n \r\n global elapsed_time\r\n elapsed_time += 1", "def time_automation_list...
[ "0.6764939", "0.6374665", "0.63279897", "0.6325875", "0.62773454", "0.6251775", "0.6120748", "0.60588634", "0.60588634", "0.6047806", "0.5971216", "0.59522736", "0.5940933", "0.59408", "0.5927215", "0.58737797", "0.5858658", "0.5828485", "0.58142847", "0.58096266", "0.5803449...
0.68236625
0
Inject the edition tools into the html content and return a BeautifulSoup object of the resulting content + tools.
def inject_edition_tools(response, request=None, context=None, body_top_template_name="pages/_body_top.html", body_bottom_template_name="pages/_body_bottom.html", edit_frame_template_name=None): #pylint:disable=too-many-arguments content...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_html(self):\n content = self.content\n excerpt = self.excerpt\n\n content_html = publish_parts(content,\n writer_name='html',\n settings_overrides=DOCUTILS_OVERRIDES)['fragment']\n excerpt_html = publis...
[ "0.5796182", "0.57176113", "0.55976796", "0.5577817", "0.55086136", "0.5481117", "0.5449412", "0.537632", "0.5369063", "0.52791226", "0.5236761", "0.5205818", "0.51522255", "0.51490635", "0.51384366", "0.5132662", "0.5127385", "0.5110196", "0.5093892", "0.5060148", "0.5054430...
0.6480746
0
Ensure that model= is optional for abstract=True.
def test_factory_for_optional(self): class TestObjectFactory(base.Factory): class Meta: abstract = True self.assertTrue(TestObjectFactory._meta.abstract) self.assertIsNone(TestObjectFactory._meta.model)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_abstract_attribute_is_not_inherited(self):\r\n assert not ConcreteModel.__abstract__\r\n assert not ConcreteModelWithCol.__abstract__", "def test_get_base_polymorphic_model_skip_abstract(self):\n class A(PolymorphicModel):\n class Meta:\n abstract = True\n\...
[ "0.66813874", "0.6643063", "0.64441586", "0.62198526", "0.60281485", "0.5868093", "0.57758063", "0.5757518", "0.57101095", "0.5701127", "0.56429243", "0.5633787", "0.56319803", "0.5624593", "0.5621721", "0.55961514", "0.5595935", "0.5579504", "0.55437565", "0.55372465", "0.55...
0.69028527
0
Tests that the sequence of a 'slave' factory cannot be reset.
def test_reset_sequence_subclass_fails(self): class SubTestObjectFactory(self.TestObjectFactory): pass with self.assertRaises(ValueError): SubTestObjectFactory.reset_sequence()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_slave():\n\n # Confirm slave status in case we need to refer to the values later\n slave_status()\n run_mysql_command(\"STOP SLAVE;\")\n\n with hide('everything'):\n # Store last known log file and position\n master_log_file = run(\"sudo -i mysql -e 'SHOW SLAVE STATUS\\G' | grep...
[ "0.6471116", "0.61706674", "0.60744417", "0.58116317", "0.5781919", "0.57753354", "0.57563055", "0.5733071", "0.57308346", "0.56739676", "0.56533957", "0.565217", "0.5629395", "0.560299", "0.55999875", "0.5592068", "0.5589435", "0.55867213", "0.5539783", "0.5514928", "0.55001...
0.6292787
1
Tests that reset_sequence(force=True) works.
def test_reset_sequence_subclass_force(self): class SubTestObjectFactory(self.TestObjectFactory): pass o1 = SubTestObjectFactory() self.assertEqual(0, o1.one) o2 = SubTestObjectFactory() self.assertEqual(1, o2.one) SubTestObjectFactory.reset_sequence(force=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_reset(self):\n ran = []\n def foo():\n ran.append(None)\n\n c = task.Clock()\n lc = TestableLoopingCall(c, foo)\n lc.start(2, now=False)\n c.advance(1)\n lc.reset()\n c.advance(1)\n self.assertEqual(ran, [])\n c.advance(1)\n ...
[ "0.6554954", "0.6521152", "0.64447737", "0.6432272", "0.6377116", "0.63428116", "0.6265255", "0.62649095", "0.62627584", "0.62083524", "0.6208312", "0.6206979", "0.6185866", "0.6146366", "0.6129778", "0.6064196", "0.58949924", "0.58949924", "0.5858686", "0.58486927", "0.58481...
0.7042529
0
Returns the filtered queryset based on the value provided in the query string and retrievable via `self.value()`.
def queryset(self, request, queryset): # Compare the requested value (either '80s' or 'other') # to decide how to filter the queryset. if self.value() is None: return queryset.all() return queryset.filter(firm__pk=self.value())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def queryset(self, request, queryset):\n # Compare the requested value (either '80s' or '90s')\n # to decide how to filter the queryset.\n if self.value():\n return queryset.filter(state_pol=self.value())", "def queryset(self, request, queryset):\n if self.value() is None:\...
[ "0.7419924", "0.7245252", "0.72038484", "0.70902455", "0.70488775", "0.6975942", "0.67827517", "0.6762181", "0.67344034", "0.6681628", "0.66560334", "0.6588891", "0.6470637", "0.64161074", "0.64019424", "0.6383527", "0.6369606", "0.63506347", "0.63492984", "0.62763286", "0.62...
0.7539923
0
inserts player name and score to top5 db
def insert_player(self, name, score): command = "UPDATE %s " % self.table_name_players command += "SET name_player = '%s', score = %d " % (name, score) command += "WHERE name_player = ( " command += "SELECT name_player " command += "FROM %s " % self.table_name_players ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_score(self, player, level, score):\n cursor = self._connection.cursor()\n command = 'INSERT INTO scores (player, level, score) VALUES (?, ?, ?)'\n cursor.execute(command, [player, level, score])\n self._connection.commit()", "def registerPlayer(name):\n db, cursor = connect...
[ "0.66316354", "0.65528435", "0.6539488", "0.6218796", "0.6213069", "0.61682665", "0.61086845", "0.6015163", "0.59967804", "0.59904796", "0.5963679", "0.59542024", "0.5944807", "0.59214735", "0.59171426", "0.58731747", "0.5869828", "0.58598584", "0.58454907", "0.58205545", "0....
0.7346812
0
Creates a delta between the initial statistics and the final one
def _deltas(self): istat = self.init lstat = self.stats uptime = self._uptime() delta = float(uptime) - float(self.uptime) self.uptime = uptime for dev in lstat.keys(): if not istat.has_key(dev): del lstat[dev] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delta(self) -> None:", "def calculate_delta(self):\n rho_des_index, distance, data_size = self.rho_des_index, self.distance, self.data_size\n self.result[rho_des_index[0]][1] = -1\n for i in range(1, data_size):\n for j in range(0, i):\n old_i, old_j = rho_des_i...
[ "0.66328543", "0.6213218", "0.61514914", "0.61068285", "0.6014113", "0.59775084", "0.5938798", "0.59145635", "0.58798945", "0.5820956", "0.5816481", "0.58054644", "0.5763823", "0.571858", "0.57119256", "0.56900823", "0.5680007", "0.5678773", "0.5669453", "0.56573594", "0.5641...
0.63489467
1
Search text for [[link_me]], replace with link_me
def wiki_link(text): return wiki_link_pattern.sub(get_link, text)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _replace_links(input_string,link_dict={}):\n\n # Dictionary to hold link string/target pairs\n target_dict = {}\n\n # Strip white space from string\n this_string = input_string.strip()\n\n # If we have a string stub, return it\n if len(input_string) < 2:\n return input_string, {}\n\n ...
[ "0.6165548", "0.60130036", "0.5864938", "0.5808209", "0.5724455", "0.5653492", "0.5621826", "0.55912733", "0.5550039", "0.5528044", "0.5508838", "0.54424155", "0.542252", "0.53638536", "0.5346632", "0.5269909", "0.5243337", "0.52135646", "0.51990354", "0.5163372", "0.5137252"...
0.62884384
0
Handle updating an object by its ID
def update(self, request, pk=None): #update a specific object return Response({'http_method': 'PUT'})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_item(id: str, obj: endpoint_model):\n # should this error if exists?\n if obj.id:\n if obj.id != id:\n raise HTTPException(status_code=400, detail=\"id in body does not match id in path\")\n else:\n obj.id = id\n new_obj = db.save(obj)\n ...
[ "0.760733", "0.7322684", "0.7160693", "0.7101339", "0.697243", "0.6948714", "0.6921794", "0.6902203", "0.689081", "0.6834843", "0.6813453", "0.6782466", "0.67707884", "0.67625", "0.67575747", "0.6728648", "0.67064226", "0.66966736", "0.6653617", "0.6611896", "0.65948665", "...
0.7415862
1
Handle updating part of an object by its ID
def partial_update(self, request, pk=None): #partial update a specific object return Response({'http_method': 'PATCH'})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_item(id: str, obj: endpoint_model):\n # should this error if exists?\n if obj.id:\n if obj.id != id:\n raise HTTPException(status_code=400, detail=\"id in body does not match id in path\")\n else:\n obj.id = id\n new_obj = db.save(obj)\n ...
[ "0.71984583", "0.6707685", "0.66999716", "0.66406435", "0.66380024", "0.6630572", "0.6587033", "0.6563462", "0.64720654", "0.6385685", "0.6380481", "0.63732487", "0.6364642", "0.6296849", "0.62867194", "0.6279398", "0.6251531", "0.6212349", "0.61951846", "0.61918664", "0.6188...
0.67500085
1
Purge all completed exports from the backing IHS remote account
def exports(): from celery_queue.tasks import cleanup_remote_exports cleanup_remote_exports.run()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def purge(self):\n pass", "def cleanup(self):\n files = self.nlst()\n latest = self.latest_filename\n for filename in files:\n if filename != latest:\n result = self.delete(filename)\n logger.info(f\"Deleted old export from FTP: {result}\")", ...
[ "0.6358549", "0.6349242", "0.6194633", "0.6167525", "0.61525655", "0.61206007", "0.6027554", "0.59524834", "0.59467685", "0.59411263", "0.5885341", "0.5773222", "0.5749375", "0.571782", "0.56598467", "0.5652387", "0.5631703", "0.56277174", "0.56239337", "0.5614715", "0.561232...
0.6384582
0
Moves the faller to the left Won't move left if there are jewels in the way check piece to left if it is zero, if it is then you can move left
def move_left(self): counter = 0 for y in range(1, self._col): for x in reversed(range(self._row)): if '[' in self._board[x][y] and self._board[x][y-1] == ' ': counter += 1 elif '|' in self._board[x][y] and self._board[x][y-1] == ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def moveLeft(board):\n\t# initial shift\n\t#shiftLeft(board)\n\trykTilVenstre(board)\n\t# merge cells\n\tfor i in range(4):\n\t\tfor j in range(3):\n\n\t\t\tif board[i][j] == board[i][j + 1] and board[i][j] != 0:\n\t\t\t\tboard[i][j] *= 2\n\t\t\t\tboard[i][j + 1] = 0\n\t\t\t\tj = 0\n\n\t# final shift\n\t#shiftLeft...
[ "0.72968435", "0.7108253", "0.7007417", "0.697426", "0.6911207", "0.69036156", "0.68996483", "0.6873529", "0.6853759", "0.68486154", "0.6829842", "0.67925954", "0.6785727", "0.6766036", "0.6765819", "0.6754254", "0.675414", "0.67041194", "0.66865104", "0.66781795", "0.6668006...
0.7336359
0
Loading directory with no courses gives only an empty "lessons" course
def test_no_courses(): model = models.Root() model.load_local_courses(fixture_path / 'empty-lessons-dir') assert sorted(model.courses) == ['lessons'] assert not model.courses['lessons'].sessions assert not model.courses['lessons'].lessons
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_course_index_view_with_no_courses(self):\r\n # Create a course so there is something to view\r\n resp = self.client.get_html('/course/')\r\n self.assertContains(\r\n resp,\r\n '<h1 class=\"page-header\">My Courses</h1>',\r\n status_code=200,\r\n ...
[ "0.6494664", "0.64453155", "0.6420257", "0.64079463", "0.63854814", "0.6376241", "0.6313256", "0.6268793", "0.6231201", "0.6211336", "0.6141695", "0.61415595", "0.60863847", "0.6081872", "0.60563177", "0.5995458", "0.5963661", "0.5940306", "0.5938993", "0.5885596", "0.5870694...
0.7734044
0
Test all methods inside the Pizza class.
def test_pizza_class(): # __init__() small = MenuItem("Small", "Pizza size", False, 0.0, 1) medium = MenuItem("Medium", "Pizza size", False, 4.0, 1) topping1 = MenuItem("Extra cheese", "Topping", False, 2.0, 1) topping2 = MenuItem("Special sauce", "Topping", False, 3.0, 1) pizza_menu_item1 = Men...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_food(self):\n pass", "def test_required_methods(self):", "def test_poets_get(self):\n pass", "def test_post_foods(self):\n pass", "def test_get_foods(self):\n pass", "def test_method(self):", "def _test(self):", "def _test(self):", "def _test(self):", "def...
[ "0.69464415", "0.6795874", "0.6673222", "0.6660429", "0.65980023", "0.65783155", "0.64330643", "0.64330643", "0.64330643", "0.64330643", "0.64330643", "0.6398508", "0.62931794", "0.62931794", "0.6187191", "0.61704147", "0.61076164", "0.61076164", "0.61076164", "0.6073124", "0...
0.69786686
0
Test all methods inside the Drink class.
def test_drink_class(): # __init__() default_size = MenuItem("Small size", "Drink size", False, 0.0, 1) size_upgrade = MenuItem("Medium size", "Drink size", False, 1.0, 1) drink_menu_item1 = MenuItem("Coca Cola", "Drinks", True, 1.0, 1) drink_menu_item2 = MenuItem("Fanta", "Drinks", True, 1.5, 1) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_theft_and_stealing(self):", "def test_get_food(self):\n pass", "def test_required_methods(self):", "def test_post_foods(self):\n pass", "def setUp(self) -> None:\n print(\"testing Deaths Class...\")\n self.data_handler_1 = self._init_mocked_data_handler(json_file_path=\...
[ "0.6496863", "0.64672583", "0.63941574", "0.6384117", "0.6376888", "0.62080526", "0.6195716", "0.6195716", "0.6195716", "0.6195716", "0.6195716", "0.61877775", "0.6143858", "0.6119874", "0.60925025", "0.60861033", "0.60861033", "0.60861033", "0.6076404", "0.60213035", "0.6008...
0.6493183
1
Test all methods inside the Side class.
def test_side_class(): # __init__() side_menu_item1 = MenuItem("Fries", "Sides", True, 4.0, 1) side_menu_item2 = MenuItem("Salad", "Sides", True, 3.0, 1) side1 = Side(side_menu_item1) side2 = Side(side_menu_item2) side3 = Side(side_menu_item1) # Getter methods assert side1.get_sauces() =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_required_methods(self):", "def _test(self):", "def _test(self):", "def _test(self):", "def _test(self):", "def _test(self):", "def test_method(self):", "def test(self):\n pass", "def test_method(self):\n self.assertEqual(self.method, 'modified strong collision')", "def runT...
[ "0.6895903", "0.6433451", "0.6433451", "0.6433451", "0.6433451", "0.6433451", "0.6388006", "0.6334689", "0.6332678", "0.6311027", "0.6272724", "0.6272724", "0.624409", "0.62368387", "0.6206552", "0.6206552", "0.6206552", "0.619093", "0.6120962", "0.6083485", "0.60834163", "...
0.6743495
1
Test all methods inside the ItemFactory class.
def test_item_factory_class(): # __init__() factory = ItemFactory() pizza_menuitem = MenuItem("cheese", "Pizzas", True, 10.0, 1) drink_menuitem = MenuItem("fanta", "Drinks", True, 10.0, 1) side_menuitem = MenuItem("fries", "Sides", True, 10.0, 1) none_menuitem = MenuItem("oreo", "oreo", True, 10...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_item(self):\n item = self.item\n\n self.assertTrue(isinstance(item, Item))\n self.assertEqual(item.name, \"Test Item\")", "def test_item_factory(self):\r\n course = CourseFactory.create()\r\n item = ItemFactory.create(parent_location=course.location)\r\n ...
[ "0.72097385", "0.6974505", "0.69647765", "0.68578804", "0.68017167", "0.67930925", "0.6737591", "0.666116", "0.6648063", "0.66393995", "0.6633347", "0.6621216", "0.65884066", "0.64894754", "0.6486753", "0.6479011", "0.63990486", "0.6379815", "0.63780177", "0.63681114", "0.635...
0.77116483
0
Tests methods of all Delivery subclasses.
def test_delivery_subclasses(): # Start with UberEatsDelivery class # __init__() order = Order(1) fries = MenuItem("fries", "Sides", True, 5.00, 1) order.add_to_cart(fries) uber_eats = UberEatsDelivery(order, "Test1.json") deliver_error = UberEatsDelivery(order, "FileDoesNotExist.jsdson") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_delivery_factory_class():\n # __init__()\n factory = DeliveryFactory()\n order = Order(1)\n file = \"This is a file.\"\n\n expected_uber = UberEatsDelivery(order, file)\n expected_foodora = FoodoraDelivery(order, file)\n expected_delivery = Delivery(order, \"not uber or foodora\")\n\n...
[ "0.6932525", "0.67744064", "0.6736943", "0.6681401", "0.6332729", "0.6103171", "0.60782915", "0.59496444", "0.5907", "0.59045416", "0.5860093", "0.5786136", "0.5719699", "0.5714881", "0.5705465", "0.5688725", "0.5654305", "0.5654305", "0.5642396", "0.5632793", "0.5632793", ...
0.8624718
0
Test all methods in DeliveryFactory class.
def test_delivery_factory_class(): # __init__() factory = DeliveryFactory() order = Order(1) file = "This is a file." expected_uber = UberEatsDelivery(order, file) expected_foodora = FoodoraDelivery(order, file) expected_delivery = Delivery(order, "not uber or foodora") assert factory....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_delivery_subclasses():\n # Start with UberEatsDelivery class\n # __init__()\n order = Order(1)\n fries = MenuItem(\"fries\", \"Sides\", True, 5.00, 1)\n order.add_to_cart(fries)\n uber_eats = UberEatsDelivery(order, \"Test1.json\")\n deliver_error = UberEatsDelivery(order, \"FileDoesN...
[ "0.77591133", "0.74950004", "0.6969184", "0.6616062", "0.65615195", "0.6530319", "0.6247274", "0.62400633", "0.6212892", "0.6183295", "0.61669254", "0.61602634", "0.6080189", "0.6077063", "0.60623956", "0.60152614", "0.6003989", "0.5962305", "0.5956253", "0.595623", "0.594784...
0.8259066
0
Test pizza parlour's read from file.
def test_parlour_one(): menu = 'Here is our menu:\nPizzas:\n\tMargherita: $10.99\n\t' \ 'Pepperoni: $12.99\nDrinks:\n\tSprite: $2.99\n\tPepsi: $3.99\n' \ 'PizzaSizes:\n\tSmall: $0.00\n\tMedium: $3.99\n\tLarge: $6.99\n' \ 'DrinkSizes:\n\tSmall: $0.00\n\tMedium: $2.99\n\tLarge: $4.99\...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ReadInputFile(file:int)->EvenMorePizza:\n self.files = ('a_example.in','b_little_bit_of_everything.in', 'c_many_ingredients.in','d_many_pizzas.in','e_many_teams.in')\n \n EvenMorePizza temporalValue\n \n file = open(files[file])#open the file\n data = doc.Read().strip(' ,\\n').split('\\n')\n ...
[ "0.62816143", "0.6195963", "0.6089519", "0.60648394", "0.59500283", "0.5931898", "0.59020066", "0.58859295", "0.582211", "0.5805901", "0.57465994", "0.5741897", "0.56686026", "0.5658264", "0.5647219", "0.56221044", "0.5591386", "0.5587265", "0.55658156", "0.5563152", "0.55371...
0.79743844
0
Given t, returns BWT(t) by way of the BWM
def bwtViaBwm(t): BWT= ''.join(map(lambda x:x[-1], bwm(t))) return BWT
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def m2_weight(t):\n return integrate.quad(lambda x: x*x * bethe_dos(x, t), -2*t, 2*t)[0]", "def calcBW(t,g,bw):\n if type(g) is not np.array:\n g = np.array(g)\n if bw>0.0:\n bw*=-1.0\n maxg = np.max(g)\n g = g-maxg\n #plt.figure('testbw')\n \n imax = np.argmax(g)\n mb = ...
[ "0.69747543", "0.6678443", "0.6650404", "0.6596994", "0.6503366", "0.6358359", "0.62313914", "0.60944253", "0.6083277", "0.60792756", "0.6062386", "0.6059564", "0.5959053", "0.58937097", "0.5877149", "0.58583546", "0.5853875", "0.58464986", "0.57807404", "0.57335067", "0.5727...
0.842045
0
Cleans up the current state of the GUI by closing any open models and motion files.
def cleanUp(self): # Close any open models openModels = getAllModels() if len(openModels): for model in openModels: setCurrentModel(model) performAction("FileClose") # Wait time.sleep(1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_gui():\n pass", "def destroy(self):\n tk.Frame.destroy(self)", "def close(self):\n self.window.destroy()\n self.buttons_window.destroy()", "def quit_fun(self):\n try:\n try:\n self.h5saver.close_file()\n except:\n ...
[ "0.72540486", "0.72328305", "0.70189834", "0.6971871", "0.69068426", "0.6906358", "0.69044363", "0.68878174", "0.68419445", "0.6836851", "0.6834143", "0.67956424", "0.6766781", "0.6766633", "0.6763605", "0.67270285", "0.67138654", "0.6711285", "0.67105806", "0.67079717", "0.6...
0.8206654
0
Loads the adjusted COM model for the chosen trial into the GUI.
def loadAdjustedModel(self): # Load model in GUI addModel(self.trcFilePath.replace('.trc','.osim'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def LoadModel(self):\n\t\tself.form = loader.loadModel(\"models/lampExport\")\n\t\t#self.form.setScale(.007)\n\t\tself.form.reparentTo(render)\n\t\tself.form.setPos(self.xpos, self.ypos, -30)", "def load(self, model):\r\n\r\n self._software_model = model\r\n\r\n self.chkDevEnvQ1.set_active(model.ls...
[ "0.6397701", "0.633631", "0.6274005", "0.5957209", "0.58768433", "0.5819468", "0.58116055", "0.57786995", "0.56621677", "0.56414884", "0.5607664", "0.55917513", "0.55909866", "0.55737233", "0.556685", "0.5564237", "0.5556083", "0.55559343", "0.55243313", "0.54895574", "0.5488...
0.7538407
0
Hide the markers in the current model.
def hideModelMarkers(self): # Handle to current model cmcModel = getCurrentModel() # Hide markers markerSet = cmcModel.getMarkerSet() for i in range(cmcModel.getNumMarkers()): marker = markerSet.get(i) toggleObjectDisplay(marker,False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hide(self):\n self.set_visible(False)", "def hide(self):\n self.visible = False", "def hidePlot(self, index):\n self.pathItem_list[index].hide()", "def hideAnnotations(self):\r\n widget = slicer.modules.NeedleFinderWidget\r\n nodes = slicer.mrmlScene.GetNodesByClass('vtkMRMLAnn...
[ "0.6804635", "0.66961974", "0.6605869", "0.65740716", "0.65275544", "0.63676405", "0.6291115", "0.6265939", "0.6202667", "0.6144658", "0.61384076", "0.6124352", "0.60892564", "0.6060456", "0.6000356", "0.59868026", "0.59822285", "0.5929362", "0.5924352", "0.5917634", "0.59023...
0.88948095
0
Loads the CMC motion into the adjusted model.
def loadCMCMotion(self): # Load motion file to current model loadMotion(self.trcFilePath.replace('.trc','_CMC_states.sto'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_model(self):\n with open(self.filepath, 'rb') as file:\n self.cmodel = pickle.load(file)", "def loadAdjustedModel(self):\r\n # Load model in GUI\r\n addModel(self.trcFilePath.replace('.trc','.osim'))", "def load_model():\n global columns\n global data\n \n ...
[ "0.6660261", "0.5961372", "0.58306295", "0.5790346", "0.56145704", "0.55496687", "0.5395073", "0.53921926", "0.5350237", "0.5312845", "0.53073144", "0.52975523", "0.5285391", "0.527037", "0.52650625", "0.5244477", "0.5244028", "0.5241696", "0.5236578", "0.5218793", "0.5214155...
0.81616914
0
Dynamic Programming Python implementation of Matrix Chain Multiplication build the worst sequence of brackets (it means that this sequence have the biggest number of elementary operations).
def matrix_chain_dynamic(dimensions, n): m = [[-1 for _ in range(n)] for _ in range(n)] s = [[0 for _ in range(n)] for _ in range(n)] # multiplying matrix by itself for i in range(1, n): m[i][i] = 0 for length in range(2, n): for i in range(1, n - length + 1): j = i + ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _multi_matmul_chain_order(arrays):\n n = len(arrays)\n # p stores the dimensions of the matrices\n # Example for p: A_{10x100}, B_{100x5}, C_{5x50} --> p = [10, 100, 5, 50]\n # Using -2 to generalize for shapes that are more than 2 dimmensions\n p = [a.shape[-2] for a in arrays] + [arrays[-1].sh...
[ "0.628266", "0.6160883", "0.6072152", "0.58409727", "0.58077633", "0.580263", "0.5799161", "0.57617015", "0.5760376", "0.5655284", "0.5590683", "0.5581058", "0.55787057", "0.5549699", "0.5547573", "0.5537065", "0.5532428", "0.5504157", "0.5502477", "0.5472439", "0.546243", ...
0.62702864
1
Returns a list of tuples representing model binaries that are cached locally. Each tuple has shape `(model_url, etag, size_MB)`. Filenames in `cache_dir` are use to get the metadata for each model, only urls ending with .bin are added.
def get_cached_models(cache_dir: Union[str, Path] = None) -> List[Tuple]: if cache_dir is None: cache_dir = TRANSFORMERS_CACHE elif isinstance(cache_dir, Path): cache_dir = str(cache_dir) if not os.path.isdir(cache_dir): return [] cached_models = [] for file in os.listdir(ca...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_cached_files(cache_dir=None):\n if cache_dir is None:\n cache_dir = TRANSFORMERS_CACHE\n else:\n cache_dir = str(cache_dir)\n if not os.path.isdir(cache_dir):\n return []\n\n cached_files = []\n for file in os.listdir(cache_dir):\n meta_path = os.path.join(cac...
[ "0.64820683", "0.6196719", "0.60758835", "0.59966093", "0.5914366", "0.58652943", "0.5834361", "0.57033515", "0.56778526", "0.56652087", "0.55668455", "0.5528032", "0.55096465", "0.5494031", "0.54744536", "0.5452223", "0.5452223", "0.5440602", "0.53939825", "0.5392779", "0.53...
0.7802284
0
Formats a useragent string with basic info about a request.
def http_user_agent(user_agent: Union[Dict, str, None] = None) -> str: ua = f"transformers/{__version__}; python/{sys.version.split()[0]}; session_id/{SESSION_ID}" if is_torch_available(): ua += f"; torch/{_torch_version}" if is_tf_available(): ua += f"; tensorflow/{_tf_version}" if DISA...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_user_agent(name=None):\n parts = ['TronAPI/%s' % tronapi.__version__,\n '%s/%s' % (platform.python_implementation(),\n platform.python_version())]\n if name:\n parts.insert(0, name)\n return ' '.join(parts)", "def build_user_agent(application_name, ve...
[ "0.7501937", "0.6610868", "0.6601205", "0.6560155", "0.65414107", "0.64870393", "0.64412105", "0.6412119", "0.62766165", "0.62002414", "0.61000466", "0.6004552", "0.59547067", "0.5931048", "0.5911232", "0.58893156", "0.5878208", "0.5870884", "0.5832963", "0.582548", "0.582548...
0.7017349
1
Extracts the commit hash from a resolved filename toward a cache file.
def extract_commit_hash(resolved_file: Optional[str], commit_hash: Optional[str]): if resolved_file is None or commit_hash is not None: return commit_hash resolved_file = str(Path(resolved_file).as_posix()) search = re.search(r"snapshots/([^/]+)/", resolved_file) if search is None: retur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _git_intern_file(self, file_contents, cwd, commit_hash):\n cmd = 'hash-object -t blob -w --stdin'.split(' ')\n stdin = self.api.m.raw_io.input(file_contents)\n stdout = self.api.m.raw_io.output()\n step_name = 'Hashing modified DEPS file with revision ' + commit_hash\n step_result = self.api.m.g...
[ "0.71363044", "0.70138985", "0.682399", "0.67539394", "0.66169316", "0.6589089", "0.6511221", "0.6444103", "0.6440251", "0.6434866", "0.6424781", "0.6415578", "0.64100504", "0.6395506", "0.63427746", "0.6313534", "0.6308896", "0.6279337", "0.627533", "0.62388635", "0.62369126...
0.7563469
0
Checks if a repo contains a given file without downloading it. Works for remote repos and local folders. This function will raise an error if the repository `path_or_repo` is not valid or if `revision` does not exist for this repo, but will return False for regular connection errors.
def has_file( path_or_repo: Union[str, os.PathLike], filename: str, revision: Optional[str] = None, proxies: Optional[Dict[str, str]] = None, token: Optional[Union[bool, str]] = None, **deprecated_kwargs, ): use_auth_token = deprecated_kwargs.pop("use_auth_token", None) if use_auth_token...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _git_exists_in_revision(path: Path, rev2: str) -> bool:\n # Surprise: On Windows, `git cat-file` doesn't work with backslash directory\n # separators in paths. We need to use Posix paths and forward slashes instead.\n cmd = [\"git\", \"cat-file\", \"-e\", f\"{rev2}:{path.as_posix()}\"]\n result = r...
[ "0.6596947", "0.6389621", "0.6368034", "0.63567364", "0.6278122", "0.6180356", "0.6152615", "0.6005258", "0.5924015", "0.58965087", "0.5867283", "0.58649385", "0.58643174", "0.586419", "0.5849708", "0.5784172", "0.57095075", "0.56832314", "0.56828415", "0.563263", "0.5627547"...
0.6584571
1
Create the repo if needed, cleans up repo_id with deprecated kwargs `repo_url` and `organization`, retrieves the token.
def _create_repo( self, repo_id: str, private: Optional[bool] = None, token: Optional[Union[bool, str]] = None, repo_url: Optional[str] = None, organization: Optional[str] = None, ) -> str: if repo_url is not None: warnings.warn( "T...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def api_repo_create():\n form = NewRepoForm()\n if form.validate_on_submit():\n # On the miniscule chance we generate a non-unique access key, loop and try again.\n success = False\n while not success:\n new_repo = Repo.create(\n pass_phrase = form.pass_phrase.d...
[ "0.63847035", "0.6254067", "0.62396747", "0.6013436", "0.5991349", "0.5897575", "0.57223994", "0.57146037", "0.5666377", "0.5590212", "0.55577445", "0.554561", "0.55116093", "0.5508899", "0.54985505", "0.54891235", "0.54314077", "0.5375935", "0.53152966", "0.52762866", "0.524...
0.743131
0
Returns the list of files with their last modification timestamp.
def _get_files_timestamps(self, working_dir: Union[str, os.PathLike]): return {f: os.path.getmtime(os.path.join(working_dir, f)) for f in os.listdir(working_dir)}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_files_list(dirname, date_order, rdate_order):\n file_list = os.listdir(dirname)\n file_mtimes = dict.fromkeys(file_list)\n for f in file_list:\n if f[0] == '.':\n print \"Skipping file: \", f\n del file_mtimes[f]\n continue\n if date_order or rdate_or...
[ "0.73492944", "0.7112882", "0.70843965", "0.7018853", "0.6814776", "0.67374945", "0.67360747", "0.6734983", "0.66534", "0.66412646", "0.6602865", "0.65822446", "0.6576336", "0.65412134", "0.6509738", "0.6460812", "0.63975394", "0.639307", "0.6381997", "0.63674754", "0.6314161...
0.7201854
1
Uploads all modified files in `working_dir` to `repo_id`, based on `files_timestamps`.
def _upload_modified_files( self, working_dir: Union[str, os.PathLike], repo_id: str, files_timestamps: Dict[str, float], commit_message: Optional[str] = None, token: Optional[Union[bool, str]] = None, create_pr: bool = False, revision: str = None, ): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upload_release_files():\n version = get_release_version()\n target = sf_files + sourceforge_target_dir(version)\n\n print()\n print(\"Uploading release files...\")\n print(\" Source:\", release_path)\n print(\" Target: \" + target)\n print(\" Files: \" + ', '.join(glob.glob('*')))\n ...
[ "0.6326092", "0.59037274", "0.5897512", "0.58474", "0.5663813", "0.56284285", "0.5628149", "0.5566654", "0.5565086", "0.5512359", "0.54885167", "0.5485811", "0.5406561", "0.5382631", "0.53670764", "0.5350603", "0.53416187", "0.5329326", "0.53228813", "0.529926", "0.5288088", ...
0.8192738
0
Sends telemetry that helps tracking the examples use.
def send_example_telemetry(example_name, *example_args, framework="pytorch"): if is_offline_mode(): return data = {"example": example_name, "framework": framework} for args in example_args: args_as_dict = {k: v for k, v in args.__dict__.items() if not k.startswith("_") and v is not None} ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def test_all_samples(self):\n response = await self.collect(get_request_json_return_value=self.JMETER_JSON)\n self.assert_measurement(response, value=\"248\", entities=[])", "def test_example_runs(self):\n run_example(\n verbose=False,\n testapp=self.testa...
[ "0.5905889", "0.58216053", "0.5645284", "0.5576144", "0.5565876", "0.5565876", "0.55629486", "0.555112", "0.55271477", "0.5478809", "0.54242194", "0.5422521", "0.54215646", "0.5384052", "0.5356486", "0.5323799", "0.5301311", "0.529773", "0.5288258", "0.5286861", "0.5278613", ...
0.71745557
0
Converts a size expressed as a string with digits an unit (like `"5MB"`) to an integer (in bytes).
def convert_file_size_to_int(size: Union[int, str]): if isinstance(size, int): return size if size.upper().endswith("GIB"): return int(size[:-3]) * (2**30) if size.upper().endswith("MIB"): return int(size[:-3]) * (2**20) if size.upper().endswith("KIB"): return int(size[:-...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_bytes_size(size_str):\n\n m = BYTES_REGEX.fullmatch(size_str.lower())\n if m:\n number = int(m.group(1))\n\n if m.group(2) is not None:\n unit = m.group(2)\n conversion = SIZE_UNITS.get(unit)\n if conversion:\n return conversion * numb...
[ "0.84322685", "0.8161158", "0.8068183", "0.803176", "0.803071", "0.78486603", "0.78093255", "0.7693891", "0.7610743", "0.7565714", "0.7565714", "0.7534851", "0.7485024", "0.7442531", "0.744205", "0.7435005", "0.7359864", "0.7353351", "0.7342231", "0.7331826", "0.7291998", "...
0.8204714
1
Returns a list for all files cached with appropriate metadata.
def get_all_cached_files(cache_dir=None): if cache_dir is None: cache_dir = TRANSFORMERS_CACHE else: cache_dir = str(cache_dir) if not os.path.isdir(cache_dir): return [] cached_files = [] for file in os.listdir(cache_dir): meta_path = os.path.join(cache_dir, f"{file...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_all_cache_files(self):\n files = set()\n dir_tree = os.walk(self.config.get('cachedir', self.CACHEDIR))\n for dirpath, _, filenames in dir_tree:\n for file_name in filenames:\n if 'cache' in file_name:\n files.add(os.path.join(dirpath, file...
[ "0.7865767", "0.7818694", "0.7672085", "0.7453912", "0.74362546", "0.7339646", "0.70547336", "0.69582987", "0.692106", "0.68153465", "0.6725137", "0.6692921", "0.6681838", "0.66680914", "0.6637055", "0.6628075", "0.66022044", "0.6594799", "0.6579378", "0.65584", "0.6520238", ...
0.81654704
0
Extract repo_name, revision and filename from an url.
def extract_info_from_url(url): search = re.search(r"^https://huggingface\.co/(.*)/resolve/([^/]*)/(.*)$", url) if search is None: return None repo, revision, filename = search.groups() cache_repo = "--".join(["models"] + repo.split("/")) return {"repo": cache_repo, "revision": revision, "fi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_url(repo_url: str) -> List[str]:\n try:\n return re.findall(r\"github\\.com/([^/]+)/([^\\/?]+)\", repo_url, re.I)[0]\n except IndexError:\n raise AnalyzerError(\"Incorrect repository URL\")", "def _filename_from_url(url):\n file_name = url.split(\"/\")[-1]\n r...
[ "0.66521394", "0.6614812", "0.65995854", "0.65686816", "0.6470143", "0.6419749", "0.6403617", "0.6361332", "0.6344536", "0.63396895", "0.63210946", "0.63057446", "0.6293681", "0.624197", "0.61405224", "0.611934", "0.61118877", "0.6109042", "0.61074966", "0.60993886", "0.60923...
0.7024231
0
Remove, if they exist, file, file.json and file.lock
def clean_files_for(file): for f in [file, f"{file}.json", f"{file}.lock"]: if os.path.isfile(f): os.remove(f)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _remove_files(self):\n if hasattr(self, 'files'):\n for file in self.files:\n if os.path.exists(file):\n os.remove(file)\n\n self._remove_changes()\n self._remove_temporary_files()", "def cleanup_file(name: str):\n if os.path.exists(name) a...
[ "0.7176565", "0.71468484", "0.7132706", "0.71127635", "0.71127635", "0.71077317", "0.7105861", "0.7046819", "0.70287746", "0.6958039", "0.6896235", "0.68671364", "0.68619233", "0.6854565", "0.6853768", "0.6840403", "0.68193984", "0.6813936", "0.680045", "0.6765633", "0.673455...
0.8273665
0
Move file to repo following the new huggingface hub cache organization.
def move_to_new_cache(file, repo, filename, revision, etag, commit_hash): os.makedirs(repo, exist_ok=True) # refs os.makedirs(os.path.join(repo, "refs"), exist_ok=True) if revision != commit_hash: ref_path = os.path.join(repo, "refs", revision) with open(ref_path, "w") as f: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_file(self, ctx):\n pass", "def rupture(url, outpath=None, branch='master', dirname=None, release=None):\n try:\n file, filename = _download(\n url, outpath=outpath, \n dirname=dirname, branch=branch, \n release=release\n )\n base, cs = _unz...
[ "0.63573015", "0.5870837", "0.58038634", "0.57403123", "0.5718693", "0.56007093", "0.55890596", "0.546481", "0.54431987", "0.5442263", "0.54101485", "0.5409202", "0.5406879", "0.54016227", "0.5373094", "0.5357668", "0.53532946", "0.5349556", "0.5305648", "0.5292807", "0.52848...
0.652527
0
Subtracts CLEAN model from data
def subtract_model(self, outfile, del_script=True): os.system('cp -r {} {}'.format(self.ms, outfile)) ct.subtract_model(outfile, delete=del_script)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subtract(self,*datas):\n\t\tdatas = list(datas)\n\t\tresult = datas.pop(0)\n\t\tfor data in datas:\n\t\t\tresult -= data\n\t\treturn result", "def original_clean():\n # load the data\n dataset = np.genfromtxt(\"wdbc.data\", dtype=np.float, delimiter=',', usecols=(2, 3, 4, 5, 6, 7, 8, 9, 10, 11,\n ...
[ "0.60749555", "0.5962677", "0.59040093", "0.58570546", "0.58570546", "0.58570546", "0.58430606", "0.57087916", "0.5620488", "0.5617179", "0.56085736", "0.55911463", "0.5569164", "0.5562851", "0.55291617", "0.5525032", "0.54715806", "0.54459673", "0.5407834", "0.53850883", "0....
0.6773486
0
Uncover blanks at this location
def uncover_blanks(self, row, col): checked = {} to_be_checked = [] to_be_checked.append((row, col)) while len(to_be_checked) > 0: sq_row, sq_col = to_be_checked.pop() if checked.has_key((sq_row, sq_col)): continue checked[(sq_row, sq_c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def blank(self):\n pass", "def check_and_clear_rows(self):\n # if board is full, then there will be a '#' in the first row\n if '#' in self.board[0]:\n return 'Game Over! Top has been reached.'\n for row in xrange(self.height):\n # if any given row is full, then ...
[ "0.64885885", "0.6289629", "0.6288845", "0.6187194", "0.61361164", "0.612752", "0.6098215", "0.6069186", "0.5969753", "0.5950767", "0.5934857", "0.59044385", "0.5894175", "0.5876831", "0.5842342", "0.58088094", "0.57956934", "0.5768279", "0.5730342", "0.5727449", "0.57215166"...
0.65439826
0
Returns load balancer name for the current environment.
def get_balancer_name(self): return '{}-{}'.format( self.config['namespace'], self.get_current_env(), )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_balancer_name(self) -> str:\n return pulumi.get(self, \"load_balancer_name\")", "def load_balancer_id(self) -> str:\n return pulumi.get(self, \"load_balancer_id\")", "def load_balancer_id(self) -> str:\n return pulumi.get(self, \"load_balancer_id\")", "def load_balancer_id(self)...
[ "0.8761447", "0.71948916", "0.71948916", "0.71948916", "0.7018782", "0.6654602", "0.66361946", "0.6568133", "0.6568133", "0.65211004", "0.6516881", "0.64701533", "0.64618856", "0.6360919", "0.62249076", "0.6202724", "0.6179302", "0.61681116", "0.61583096", "0.6115745", "0.604...
0.8589218
1
Returns load balancer security group short name.
def get_security_group_short_name(self): return self.config['security_group']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_target_group_fully_qualified_name(self, short_name):\n return '{}-{}'.format(\n self.get_balancer_name(),\n short_name,\n )", "def name(self):\n return f\"{self._group.friendly_name} {GROUP_SUFFIX}\"", "def server_group_name(self) -> str:\n return pulum...
[ "0.73476905", "0.69869596", "0.6923902", "0.6921061", "0.69105417", "0.68615884", "0.68233114", "0.6768074", "0.67503476", "0.67094326", "0.6699743", "0.6699743", "0.6699743", "0.6699743", "0.6699743", "0.6699743", "0.6699743", "0.6699743", "0.6699743", "0.6699743", "0.669974...
0.8458865
0
Returns the unique name of the target group for the current environment. The difference between this function and `get_target_group_fully_qualified_name` is that fits the name into 32 characters.
def get_target_group_name(self, short_name): app_env = self.get_current_env() full_name = self.get_target_group_fully_qualified_name(short_name) namespace = self.config['namespace'] if len(full_name) <= 32: return full_name elif len(namespace) + 10 <= 32: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def target_group_identifier(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"target_group_identifier\")", "def get_target_group_fully_qualified_name(self, short_name):\n return '{}-{}'.format(\n self.get_balancer_name(),\n short_name,\n )", "def target_group_i...
[ "0.7647652", "0.74390054", "0.7291971", "0.7287171", "0.7284457", "0.70294935", "0.69971144", "0.6987528", "0.693263", "0.6911461", "0.68637323", "0.68637323", "0.68078226", "0.6770091", "0.66889703", "0.6640256", "0.66363704", "0.66363704", "0.66363704", "0.66363704", "0.663...
0.8356981
0
Returns target groups configuration.
def get_target_groups_config(self): return self.config['target_groups']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_target_groups_info(self):\n target_groups_config = self.get_target_groups_config()\n groups_info = {}\n\n for short_name in target_groups_config.keys():\n target_group_name = self.get_target_group_name(short_name)\n data = self.get_target_group_info(short_name)\n ...
[ "0.74112564", "0.672198", "0.65918154", "0.65918154", "0.65918154", "0.65918154", "0.65918154", "0.65918154", "0.6472177", "0.6409221", "0.6371832", "0.63339555", "0.63301975", "0.6296605", "0.6258392", "0.61293525", "0.60561275", "0.60237026", "0.60043335", "0.6001119", "0.5...
0.9180246
0
Returns load balancer details for the current environment.
def get_balancer_info(self): try: response = self.client.describe_load_balancers( Names=[self.get_balancer_name()], ) assert response['ResponseMetadata']['HTTPStatusCode'] == 200 vpc_id = self.get_vpc_id() balancers = [balancer for bal...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def describe_balancer(ctx):\n data = self.get_balancer_info()\n if data is not None:\n ctx.info('Load balancer {} details:'.format(self.get_balancer_name()))\n ctx.pp.pprint(data)\n else:\n ctx.info('Load balancer {} does not exist.'.for...
[ "0.72443384", "0.7015506", "0.6776904", "0.66980827", "0.6632059", "0.6632059", "0.6632059", "0.6629249", "0.6578861", "0.6483858", "0.63487846", "0.6314404", "0.6303139", "0.6239039", "0.6202509", "0.6192813", "0.61762923", "0.6086847", "0.60727555", "0.6039273", "0.6030724"...
0.7646479
0
Returns whether load balancer exists in the current environment.
def balancer_exists(self): return self.get_balancer_info() is not None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_load_balancer_enabled(cluster_config):\n cluster = load_cluster_config_json(cluster_config)\n return cluster[\"environment\"][\"sg_lb_enabled\"]", "def lb_lookup(session, lb_name):\n if session is None:\n return None\n\n lb_name = lb_name.replace('.', '-')\n\n client = session.client...
[ "0.695405", "0.67182565", "0.6568076", "0.6403442", "0.6346334", "0.5996281", "0.5996281", "0.59851", "0.59643495", "0.5877768", "0.5831705", "0.58173513", "0.58082914", "0.5740544", "0.5653013", "0.5634984", "0.5630054", "0.5595231", "0.5571937", "0.55607104", "0.55493975", ...
0.82090664
0
Returns load balancer ARN for the current environment.
def get_balancer_arn(self): return self.get_balancer_info()['LoadBalancerArn']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_balancer_name(self):\n return '{}-{}'.format(\n self.config['namespace'],\n self.get_current_env(),\n )", "def load_balancer_name(self) -> str:\n return pulumi.get(self, \"load_balancer_name\")", "def load_balancer_id(self) -> pulumi.Output[str]:\n retu...
[ "0.69737446", "0.67671096", "0.63797647", "0.62352544", "0.62352544", "0.62352544", "0.6182437", "0.6182437", "0.61434364", "0.61434364", "0.61218286", "0.61218286", "0.61218286", "0.61218286", "0.61218286", "0.604468", "0.60387963", "0.5940735", "0.5940735", "0.5940735", "0....
0.76236105
0
Returns load balancer DNS name for the current environment.
def get_balancer_dns(self): return self.get_balancer_info()['DNSName']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_balancer_name(self):\n return '{}-{}'.format(\n self.config['namespace'],\n self.get_current_env(),\n )", "def load_balancer_name(self) -> str:\n return pulumi.get(self, \"load_balancer_name\")", "def domain_dns_name(self):\n domain_dn = self.get_defaul...
[ "0.76529366", "0.75585383", "0.7015553", "0.6898756", "0.6807746", "0.6806018", "0.6806018", "0.67674685", "0.67267495", "0.66026753", "0.6525063", "0.6525063", "0.6525063", "0.650673", "0.64512", "0.6416112", "0.6397409", "0.63273877", "0.63170844", "0.63055694", "0.6283905"...
0.75997025
1
Returns all target groups details for the current environment.
def get_target_groups_info(self): target_groups_config = self.get_target_groups_config() groups_info = {} for short_name in target_groups_config.keys(): target_group_name = self.get_target_group_name(short_name) data = self.get_target_group_info(short_name) i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_target_groups_config(self):\n return self.config['target_groups']", "def describe_target_groups(ctx):\n data = self.get_target_groups_info()\n ctx.info('Target groups details for load balancer {}:'.format(self.get_balancer_name()))\n ctx.pp.pprint(data)", "def ge...
[ "0.7435148", "0.7379804", "0.7054704", "0.67164725", "0.6578198", "0.6524327", "0.6510144", "0.6486742", "0.6458211", "0.6452521", "0.6412666", "0.63932836", "0.63932836", "0.63932836", "0.6388009", "0.63451225", "0.6304259", "0.6304259", "0.6304259", "0.6304259", "0.6304259"...
0.76235884
0
Returns whether target group exists in the current environment.
def target_group_exists(self, short_name): return self.get_target_group_info(short_name) is not None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def group_exists(self):\n return AzureTools().group_exists(names.group_name(self))", "def has_group(group, user, request):\n return group_names[group] in groupfinder(user.username, request)", "def has_group(self, resolvable):\n group = self._resolve_group(resolvable)\n\n for g i...
[ "0.7729518", "0.7035008", "0.6886645", "0.6784272", "0.6755214", "0.67159396", "0.6622473", "0.65812206", "0.6573095", "0.64742124", "0.6403617", "0.6397194", "0.63116044", "0.6310388", "0.6310108", "0.62999773", "0.6253467", "0.62442166", "0.61922187", "0.61876094", "0.61838...
0.8102559
0
Returns target group ARN for the current environment.
def get_target_group_arn(self, short_name): target_group_info = self.get_target_group_info(short_name) return target_group_info['TargetGroupArn']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_group_arn(self) -> str:\n return jsii.get(self, \"logGroupArn\")", "def log_group_arn(self) -> str:\n return jsii.get(self, \"logGroupArn\")", "def group_arn(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"group_arn\")", "def target_group(self) -> pulumi.Output[str]:\n ...
[ "0.7156454", "0.7156454", "0.68402165", "0.6673433", "0.6616204", "0.6345443", "0.61582327", "0.61299807", "0.6107626", "0.61024284", "0.60479337", "0.59156257", "0.59156257", "0.59156257", "0.59156257", "0.59156257", "0.59156257", "0.59156257", "0.59156257", "0.59156257", "0...
0.75529647
0
Creates load balancer in the current environment.
def create_balancer(self): app_env = self.get_current_env() balancer_name = self.get_balancer_name() subnet_ids = self.get_subnet_ids() response = self.client.create_load_balancer( Name=balancer_name, Subnets=subnet_ids, SecurityGroups=[self.get_secur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(ctx):\n create_target_groups(ctx)\n create_balancer(ctx)\n create_listeners(ctx)\n\n ctx.info('Load balancers setup completed.')", "def create_balancer(ctx):\n if not self.balancer_exists():\n data = self.create_balancer()\n ...
[ "0.7753503", "0.7641294", "0.7280807", "0.7179058", "0.67555755", "0.67294407", "0.65474385", "0.64428174", "0.63757575", "0.63649774", "0.61280835", "0.6105206", "0.60898733", "0.60526896", "0.6042839", "0.5977197", "0.5939473", "0.5935822", "0.5933579", "0.58584756", "0.583...
0.7866335
0
Creates target groups for the current environment.
def create_target_groups(self): target_groups_config = self.get_target_groups_config() vpc_id = self.get_vpc_id() response_data = {} for short_name in target_groups_config.keys(): target_group_name = self.get_target_group_name(short_name) if self.target_group_ex...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_target_groups(ctx):\n data = self.create_target_groups()\n ctx.info('Created target groups for the load balancer {}:'.format(self.get_balancer_name()))\n ctx.pp.pprint(data)", "def generate_groups(ctx):\n asyncio.run(generate_groups_impl(ctx.obj[\"config\"]))", "d...
[ "0.77843726", "0.66990286", "0.6696909", "0.6282211", "0.6119517", "0.6050414", "0.5997116", "0.59821665", "0.59821665", "0.5956269", "0.59005904", "0.5763568", "0.5756899", "0.57399017", "0.5738739", "0.5734707", "0.5720554", "0.57122076", "0.5707017", "0.56966335", "0.56955...
0.69275194
1
Deletes target groups for the current environment.
def delete_target_groups(self): target_groups_config = self.get_target_groups_config() for short_name in target_groups_config.keys(): if not self.target_group_exists(short_name): self.logger.info('Target group {} does not exists, nothing to delete.'.format( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_target_groups(ctx):\n self.delete_target_groups()\n ctx.info('Deleted target groups for the load balancer {}:'.format(self.get_balancer_name()))", "def test_delete_groups(self):\n pass", "def del_from_groups(self, username, groups):\n pass", "def drop_groups(sel...
[ "0.8269436", "0.66177106", "0.65208447", "0.6448851", "0.62806493", "0.62591887", "0.62582904", "0.62301564", "0.62272596", "0.62272596", "0.62231916", "0.6211974", "0.6204757", "0.6118375", "0.6099915", "0.60728055", "0.60700786", "0.6055358", "0.6038605", "0.60032064", "0.6...
0.80087006
1