query
stringlengths
10
2k
document
stringlengths
20
51.2k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
This is the get_query_set method override. Here only published stuff is retrieved; this filter is on is_published field.
def get_query_set(self): return super(PublishedManager, self).get_query_set().filter(is_published=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_queryset(self):\n return Post.objects.filter(\n user_id=self.kwargs['user_id'], status='published', visibility='public'\n )", "def get_queryset(self):\n return self.queryset.filter(theme__contest__publish_date__lte=timezone.now())", "def queryset(self, request, queryset)...
[ "0.70220584", "0.6788593", "0.67274594", "0.66892874", "0.6646506", "0.65970665", "0.65970665", "0.65725654", "0.6521099", "0.6521099", "0.6501853", "0.64506245", "0.6412047", "0.6371001", "0.63544446", "0.6349875", "0.6338123", "0.62963647", "0.6289338", "0.62089586", "0.618...
0.8397425
0
Convert timestamp to string using format.
def to_time_format(timestamp: int, fmt: str = '%Y-%m-%d %H:%M:%S'): return datetime.fromtimestamp(int(timestamp) // 1000).strftime(fmt)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def timestamp2str(t, fmt='%Y-%m-%d %H:%M:%S.000'):\n return datetime.fromtimestamp(t).strftime(fmt)", "def timestamp2str(t, fmt='%Y-%m-%d %H:%M:%S.000'):\n return datetime.fromtimestamp(t).strftime(fmt)", "def _format_ts(cls, timestamp):\n return localtime(timestamp).strftime('%Y-%m-%d %H:%M:%S')", ...
[ "0.8357739", "0.8357739", "0.8031947", "0.7968215", "0.79178745", "0.7772432", "0.7758908", "0.7710306", "0.76766634", "0.76313555", "0.7551597", "0.753645", "0.73706114", "0.73626345", "0.72953624", "0.7293809", "0.7292967", "0.72356147", "0.72174114", "0.7209453", "0.718636...
0.7674627
9
Given any number of dicts, shallow copy and merge into a new dict, precedence goes to key value pairs in latter dicts.
def merge_dicts(*dict_args): result = {} for dictionary in dict_args: result.update(dictionary) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _merge_dicts(*args):\n return reduce(lambda d, s: d.update(s) or d, args)", "def _merge_dicts(*args):\n return reduce(lambda d, s: d.update(s) or d, args)", "def merge_dict(lhs, rhs, override=True):\n if not isinstance(lhs, dict) or not isinstance(rhs, dict):\n if override:\n retur...
[ "0.7666459", "0.7659905", "0.7477444", "0.7452081", "0.7452081", "0.7452081", "0.73736817", "0.7339292", "0.7305909", "0.7278611", "0.7273084", "0.72545934", "0.72309065", "0.72202486", "0.721549", "0.7198203", "0.7179858", "0.71764696", "0.71735495", "0.71639633", "0.7157251...
0.72511727
14
Test that C{self.portType} is a child of the store service after it is installed.
def test_serviceParent(self): port = self.port(store=self.store) installOn(port, self.store) service = IServiceCollection(self.store) self.failUnlessIn(port, list(service))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_setServiceParent(self):\n port = self.port(store=self.store)\n port.setServiceParent(self.store)\n self.failUnlessIn(port, list(IService(self.store)))", "def test_service(self):\n port = self.port(store=self.store)\n installOn(port, self.store)\n\n self.assertEq...
[ "0.71119165", "0.65650636", "0.6326528", "0.5875559", "0.5772955", "0.56577957", "0.5603226", "0.55200523", "0.55144584", "0.5514278", "0.5507534", "0.54768574", "0.54724973", "0.5471126", "0.54527295", "0.545062", "0.5434957", "0.5426111", "0.53762704", "0.5350093", "0.53412...
0.7120828
0
Test that the deletion of a C{self.portType}'s factory item results in the C{self.portType} being deleted.
def test_deletedFactory(self): port = self.port(store=self.store, portNumber=self.lowPortNumber, factory=self.factory) self.factory.deleteFromStore() self.assertEqual(list(self.store.query(self.portType)), [])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_cannotDeleteOtherStuff(self):\n store = Store()\n factory = DummyFactory(store=store)\n tcp = TCPPort(\n store=store, factory=factory, interface=u\"foo\", portNumber=1234)\n self.assertFailStatus(\n 1,\n self._makeConfig(store),\n [\"...
[ "0.71867806", "0.70628184", "0.67760944", "0.6616015", "0.6562167", "0.6463917", "0.6408617", "0.6408617", "0.6392832", "0.6378496", "0.6341593", "0.63374084", "0.63165987", "0.6301886", "0.62879246", "0.6271785", "0.6260438", "0.62588084", "0.6245392", "0.62334526", "0.62198...
0.85633665
0
Create a L{PortConfiguration} instance with a properly set C{parent} attribute.
def _makeConfig(self, store): config = PortConfiguration() config.parent = CommandStub(store, "port") return config
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_port_item(self, port_spec, is_connected, is_optional,\n is_visible, is_editable, parent=None):\n return PortItem(port_spec, is_connected, True, False, False, parent)", "def create_dhcp_port(self, port):\n LOG.debug(\"create_dhcp_port: %s\", port)\n port['po...
[ "0.59705615", "0.5949117", "0.56717104", "0.5597809", "0.5570993", "0.5510379", "0.54692346", "0.5390396", "0.53486806", "0.53483963", "0.53298616", "0.53298616", "0.53035873", "0.5299302", "0.52892697", "0.52582514", "0.52540827", "0.5233715", "0.5213366", "0.515721", "0.515...
0.76167333
0
function to serve home page and handle post requests from home page
def process_home_page(): global trsfrm_no, cur_val, max_val, progress if request.method == "GET": return render_template("index.html") elif request.method == "POST": trsfrm_no += 1 if request.form["init-choice"] == "dtod": srcfil_object ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def homepage():\n return redirect(\"/posts\")", "def home_page():\n return \"pong\", 201, {'Content-Type': 'text/html'}", "def homepage():\n return redirect('index.html')", "def home():\n return response(\"OK\")", "def homepage( request ):\n if \"email\" in request.session:\n return r...
[ "0.7420546", "0.6956087", "0.69188464", "0.6762154", "0.67290354", "0.67058015", "0.66983634", "0.66983634", "0.6589068", "0.6586701", "0.6554238", "0.64712334", "0.64617085", "0.64506334", "0.64506334", "0.64506334", "0.64286", "0.6383632", "0.6326235", "0.6306543", "0.63034...
0.60558033
58
Return the current metric limit for the given user A user's metric limit can either be the value given specifically to the user or it can be the maximum metric limit for all of the groups that the user is a part of.
def lookup_user(self, user): # User specific settings will override any group based limits if user.username in self.users: return parse_limit(self.users[user.username]) # Find the largest limit for all groups the user is a member of limits = [parse_limit(self.groups[group.na...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def userMaximum(self) -> float:\n return self._user_maximum", "def user_get_rate_limit():\n login = demisto.getArg('login')\n request = req('GET', USER_API + 'users/' + login + '/rate-limit')\n r = request.json()\n rate_limit = {\n 'SubmissionWaitSeconds': demisto.get(r, 'data.user.subm...
[ "0.67212045", "0.66833913", "0.62740946", "0.61946094", "0.6192797", "0.6131393", "0.6131393", "0.61170113", "0.6039059", "0.59866637", "0.5867525", "0.581682", "0.57933956", "0.5754686", "0.5752311", "0.57483315", "0.5744387", "0.57351875", "0.57313097", "0.5712545", "0.5711...
0.7920091
0
Check to see if the user is currently throttled
def check_user(self, user, cost, details): current = self.data.get_metric(user.username) max = self.limits.lookup_user(user) if max is None: return if current > max: details['current_metric'] = current details['max_metric'] = max self.err...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def should_be_throttled(self, resource):\r\n pass", "def _throttle_time(provider):\n if provider == 'nominatim':\n return 1\n else:\n return 0", "def test_request_throttling_is_per_user(self):\n self.ensure_is_throttled(MockView, 200)", "def _throttle_check(self, request):\n...
[ "0.70075536", "0.6859691", "0.6849796", "0.67770934", "0.6702937", "0.6463941", "0.64130974", "0.63720816", "0.63251764", "0.63211906", "0.6262829", "0.6131689", "0.60859597", "0.60248756", "0.6020205", "0.6012459", "0.59976834", "0.590671", "0.58706313", "0.58381456", "0.582...
0.0
-1
Check to see if the System is currently throttled
def check_system(self, cost, details): current = self.data.get_metric('system') max = self.limits.lookup_system() if max is None: return if current > max: details['current_metric'] = current details['max_metric'] = max self.error(system =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def should_be_throttled(self, resource):\r\n pass", "def _throttle_time(provider):\n if provider == 'nominatim':\n return 1\n else:\n return 0", "def dynamic_throttling_enabled(self) -> Optional[bool]:\n return pulumi.get(self, \"dynamic_throttling_enabled\")", "def _throttl...
[ "0.6828239", "0.6769253", "0.63522345", "0.6310118", "0.624194", "0.6238942", "0.617302", "0.6055254", "0.6029945", "0.6023131", "0.5919614", "0.58881456", "0.5883421", "0.5875436", "0.5838395", "0.5829609", "0.58092475", "0.5807515", "0.57960993", "0.5793386", "0.5786902", ...
0.0
-1
The Azure Region where the Application Volume Group exists.
def location(self) -> str: return pulumi.get(self, "location")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def endpoint_group_region(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"endpoint_group_region\")", "def region(self):\n return self.config.region", "def region(self) -> str:\n return pulumi.get(self, \"region\")", "def region(self) -> str:\n return pulumi.get(self, \"re...
[ "0.727904", "0.72607845", "0.72238386", "0.72238386", "0.72238386", "0.72238386", "0.72238386", "0.72238386", "0.72147715", "0.7168365", "0.71440935", "0.71440935", "0.71440935", "0.71440935", "0.706943", "0.7063364", "0.69620115", "0.69418424", "0.69213516", "0.69213516", "0...
0.0
-1
The name of this volume.
def name(self) -> str: return pulumi.get(self, "name")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_full_name(self):\n return \"{vol} ({fs})\".format(vol=self.volume_id, fs=self.fs.get_full_name())", "def persistent_volume_name(self) -> str:\n return typing.cast(\n str,\n self._properties.get(\"persistentVolumeName\"),\n )", "def vpd_name(self) -> str:\n ...
[ "0.810865", "0.7552251", "0.74530333" ]
0.74525404
27
Render the index view for the CTF.
def index_view(self) -> str: return render_template( "index.html", challenge_groups=self._challenge_groups, ctff=current_app, )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index(self):\n\t\treturn render_template('index.html')", "def index(self):\n return render_template('main/index.html')", "def index(self) -> HTMLBody:\n\t\treturn render_template(\"index.jinja2\")", "def index():\n return render_template('index.html')", "def index():\r\n re...
[ "0.7438788", "0.7233761", "0.72045463", "0.7195309", "0.71942914", "0.71658796", "0.71658796", "0.71287584", "0.7122635", "0.70266587", "0.70266587", "0.7025269", "0.6996906", "0.69685644", "0.69447464", "0.69447464", "0.69447464", "0.69447464", "0.69447464", "0.69447464", "0...
0.7228578
2
Returns the first_name plus the last_name, with a space in between.
def get_full_name(self): full_name = '%s %s' % (self.first_name, self.last_name) return full_name.strip()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def full_name(first_name, last_name):\n return first_name + \" \" + last_name", "def full_name(first_name, last_name):\n\t\n\treturn first_name + \" \" + last_name", "def get_formated_name(first_name,last_name):\n\tfull_name = first_name + '' + last_name\n\treturn full_name.title()", "def get_full_name(se...
[ "0.8313066", "0.82006806", "0.8049215", "0.80409706", "0.8017754", "0.7999701", "0.79541886", "0.7942144", "0.7942144", "0.7942144", "0.7937664", "0.79287225", "0.7921711", "0.790314", "0.7892264", "0.7890117", "0.7878668", "0.786143", "0.78528684", "0.7823523", "0.7813124", ...
0.77466476
38
the timezone is Eastern Standard Time (EST) timezone WITHOUT Day Light Savings adjustments
def read_MyCSV(symbol_path, file_name, data_time_difference_to_UTC, names, usecols): shifted_hr = config.BROKER_TIME_BETWEEN_UTC + data_time_difference_to_UTC full_path = os.path.join(symbol_path, file_name) df = pd.read_csv(full_path, header=None, names=names, usecols=usecols) df.set_index('time', inpl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def timezone():\n \n pass", "def time_zone():\n return timezone('Etc/GMT-10')", "def astimezone(self, tz=LOCAL):\n if tz is None:\n tz = LOCAL\n tz = parser.get_timezone(tz)\n return super(self.__class__, self).astimezone(tz)", "def _get_tz():\n return 'UTC'", ...
[ "0.73235726", "0.68980855", "0.68760014", "0.6788756", "0.6647669", "0.65953755", "0.65124893", "0.65058285", "0.64412254", "0.63900715", "0.63634205", "0.6330066", "0.6317683", "0.6317683", "0.6317683", "0.6317683", "0.6317683", "0.6317683", "0.6317683", "0.6317683", "0.6317...
0.0
-1
Get sentence snippets with pattern containing of only one words according to window size.
def __get_sentence_window_one_word(self, pattern, sentences, constraints): textsnippets = [] for ind, sent in enumerate(sentences): tokens = self.tokenizer.tokenize(sent) for i, token in enumerate(tokens): if check_pattern(pattern, token): if c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_sentence_window(self, pattern, sentences, constraints):\n split_pattern = pattern.split()\n\n if len(split_pattern) > 1:\n textsnippets = self.__get_sentence_window_more_words(split_pattern, sentences, constraints)\n else:\n textsnippets = self.__get_sentence_wind...
[ "0.7163368", "0.6849779", "0.67328805", "0.6226332", "0.600647", "0.59936357", "0.59245497", "0.58491385", "0.58410674", "0.58038557", "0.5644307", "0.56441176", "0.55974454", "0.5593932", "0.5589226", "0.5536139", "0.55335736", "0.5505716", "0.5500609", "0.54939234", "0.5465...
0.7181783
0
Get sentence snippets with pattern containing of more than 2 words according to window size.
def __get_sentence_window_more_words(self, split_pattern, sentences, constraints): textsnippets = [] for ind, sent in enumerate(sentences): tokens = self.tokenizer.tokenize(sent) p_index = 0 begin_index = ind end_index = ind while p_index < len...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_sentence_window(self, pattern, sentences, constraints):\n split_pattern = pattern.split()\n\n if len(split_pattern) > 1:\n textsnippets = self.__get_sentence_window_more_words(split_pattern, sentences, constraints)\n else:\n textsnippets = self.__get_sentence_wind...
[ "0.7201363", "0.7005446", "0.67089474", "0.6628436", "0.6116158", "0.6103016", "0.60819113", "0.5933626", "0.5923856", "0.5891973", "0.5859513", "0.57960486", "0.5750944", "0.5729182", "0.56848985", "0.56515276", "0.56372046", "0.563057", "0.56189036", "0.56143767", "0.560121...
0.71401876
1
Get the application environment context (e.g., devel, staging, prod). Determines the context by looking for a corresponding file under basedir. If there are multiple files, we prefer devel, then staging, and then prod. If no file exists, then returns the empty string.
def get_environment(basedir): for env in ('devel', 'staging', 'prod'): if os.path.exists(os.path.join(basedir, env)): return env return 'devel'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def base_dir(context):\n return '{}'.format(os.getcwd())", "def get_default_environment(cwd=None):\n\n # NOTE(dittrich): I know this code has multiple return points\n # but it is simpler and easier to understand this way.\n #\n # Highest priority is inhereted environment variable.\n environme...
[ "0.64868194", "0.61204356", "0.61032766", "0.6096168", "0.5977275", "0.58119845", "0.57629263", "0.5752137", "0.5631754", "0.56152016", "0.55856603", "0.5580664", "0.55804914", "0.55666906", "0.55662274", "0.5558372", "0.55430543", "0.5536405", "0.55004174", "0.5456205", "0.5...
0.7056174
0
generates a population with given size of population, board's w(idth) and h(eight) N is used for the number that we want to optimize. Entity is stored as a tuple (list of indexes of mines, amount of N on the board).
def generate_population(size, w, h, N): population = [] for _ in range(size): entity = gen_mines(w, h, randint(0, w*h)) entity = (entity[:], count_numbers(gen_board(w, h, entity), N)) population.append(entity) return population
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_population(population, w, h, N):\r\n t = lambda entity: entity[1]\r\n population.sort(key=t, reverse=True)\r\n upper_half = population[:len(population)//2]\r\n mutated_half = []\r\n for entity in upper_half:\r\n new_entity = mutate(w, h, entity[0][:], 0.1) #0.1 as p seems to be prett...
[ "0.65781146", "0.6323854", "0.6265096", "0.6242301", "0.61545503", "0.61024064", "0.59205765", "0.5912314", "0.58373505", "0.58208656", "0.58164537", "0.5748129", "0.5725683", "0.5723813", "0.57064307", "0.5654712", "0.5633401", "0.56158036", "0.55824524", "0.558006", "0.5571...
0.82011485
0
Features for a single value of the Gaussian blurring parameter ``sigma``
def features_sigma(img, sigma, intensity=True, edges=True, texture=True): features = [] gx,gy = np.meshgrid(np.arange(img.shape[1]), np.arange(img.shape[0])) # print(gx.shape) #features.append(gx) gx = filters.gaussian(gx, sigma) gy = filters.gaussian(gy, sigma) features.a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_gaussian(X, sigma):\n return np.array([ndimage.gaussian_filter(x, sigma) for x in X])", "def get_sigma_psf(self):\n pass", "def _FWHMGauss(sigma, pixel=12):\n return sigma*2*np.sqrt(2*np.log(2))*pixel", "def gaussian_blurring(self,input_image,kernel_size,sigma):\n #Applying Gaus...
[ "0.6763228", "0.6613205", "0.65753853", "0.64767945", "0.64472085", "0.6437173", "0.634764", "0.6292287", "0.62893575", "0.62761486", "0.6237404", "0.6231699", "0.6225659", "0.6207986", "0.62067163", "0.6181268", "0.6175777", "0.6164177", "0.61551803", "0.61365306", "0.610820...
0.73828053
0
Return the event status that corresponds to the player's current achievements.
def get_event_status(self): return self.event_status
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getAchievements(self) -> list:\n return self.state[ACHIEVEMENTS]", "def get_game_on_status(self) -> bool:\n return self._game_on.get()", "def get_game_state(self):\n return self._game_status", "def status(self) -> pulumi.Input['AssessmentStatusArgs']:\n return pulumi.get(self,...
[ "0.63678783", "0.6121245", "0.58624065", "0.5825316", "0.5808889", "0.5808154", "0.5762622", "0.5757477", "0.5734203", "0.5702378", "0.56238544", "0.5618956", "0.553246", "0.553246", "0.553246", "0.5522746", "0.547792", "0.5474681", "0.5469436", "0.5451207", "0.54432654", "...
0.64444774
0
Return the main player in the game.
def get_player(self): return self.player
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def player(self):\n return self.current.player", "def getPlayer(self):\n return self.currentPlayer", "def __get_current_player(self):\n return engine.Engine.game_manager.players[self.current_player_index]", "def get_current_player(self):\n return self.current_player", "def get_c...
[ "0.8176109", "0.8091673", "0.8064268", "0.80538344", "0.8049888", "0.79887706", "0.7961187", "0.78958654", "0.7778541", "0.77297044", "0.7720904", "0.7701055", "0.75953895", "0.75070447", "0.7496505", "0.74419737", "0.73573744", "0.73419404", "0.7277789", "0.7275791", "0.7244...
0.79553753
7
Write all of the game fields to a json dict. Writes the ids of objects.
def to_json_dict(self): json_dict = {} json_dict['event_status'] = self.event_status json_dict['event_status_list'] = self.event_status_list json_dict['spaces'] = [s.get_id() for s in self.spaces] json_dict['characters'] = [c.get_id() for c in self.characters] json_dict['...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_json(self):\n data = {\"image_id\": self.ids, \"img_path\": self.img_paths, \"bg\": self.bgs}\n if hasattr(self, \"bbox\"):\n data[\"bbox\"] = self.bbox\n if hasattr(self, \"masks\"):\n data[\"masks\"] = self.masks\n with open(f\"{self.save_path}{self.na...
[ "0.61263454", "0.6114282", "0.5974308", "0.5620736", "0.56118494", "0.5599084", "0.5583692", "0.5556887", "0.5490878", "0.5466681", "0.5445394", "0.5443413", "0.5419908", "0.54153943", "0.5397341", "0.53878105", "0.53817725", "0.5376276", "0.5370713", "0.5368517", "0.53664625...
0.52856076
33
When a function is annotated by this decorator, it will be only executed once. The result will be cached and returned for following invocations.
def call_once(factory_func): factory_func.executed = False factory_func.cached_result = None def _wrapped(*args, **kwargs): if not factory_func.executed: factory_func.cached_result = factory_func(*args, **kwargs) return factory_func.cached_result return _wrapped
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def func_once(func):\n def decorated(*args, **kwargs):\n try:\n return decorated._once_result\n except AttributeError:\n decorated._once_result = func(*args, **kwargs)\n return decorated._once_result\n return decorated", "def run_once(func):\n @wraps(func)\...
[ "0.79485494", "0.76788753", "0.7422959", "0.7410493", "0.72565323", "0.7125439", "0.7117283", "0.70094895", "0.6962124", "0.68158823", "0.67676604", "0.67193955", "0.67075396", "0.6702309", "0.66256845", "0.65878344", "0.6583837", "0.6581387", "0.657624", "0.65248203", "0.651...
0.7090897
7
Renders a selected auction listing.
def current_listing(request, auction_id): # if user is not logged in, display an error message if not request.user.is_authenticated: return render(request, 'auctions/apology.html', { 'message': "You must be logged in to see this listing." }) else: # query fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index(request): \n \n # finds a current bid for each listing via a SQL query\n current_bid = Auction_listing.objects.annotate(max_bid=Max('bid__bid'))\n \n return render(request, \"auctions/index.html\", { \n \"auctions\": Auction_listing.objects.filter(active=True),\n \"curren...
[ "0.6403919", "0.58578354", "0.58549315", "0.5816518", "0.5675529", "0.56724674", "0.5455817", "0.5438532", "0.54326963", "0.5361312", "0.53254974", "0.5321177", "0.52953047", "0.52399206", "0.5231552", "0.52246255", "0.5219139", "0.5176552", "0.51570404", "0.51491827", "0.514...
0.59837395
1
Test that authenticated user can retrieve a list of ingredients
def test_retrieve_ingredient_list(self): # sample ingredients Ingredient.objects.create(user=self.user, name='Potato') Ingredient.objects.create(user=self.user, name='Salt') response = self.client.get(INGREDIENTS_URL) ingredients = Ingredient.objects.all().order_by('-name') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_login_required_to_retrieve_ingredients(self):\n\n # Retrieve the ingredients belonging to user.\n response = self.client.get(URL_INGREDIENTS)\n\n self.assertEqual(response.status_code, status.HTTP_401_UNAUTHORIZED)", "def test_retreive_ingredients_list(self):\n Ingredients.ob...
[ "0.81904703", "0.8157258", "0.8073557", "0.8060249", "0.8027342", "0.8017916", "0.7826821", "0.7767236", "0.7754893", "0.75799614", "0.7570181", "0.74360055", "0.7296447", "0.7272765", "0.7177081", "0.71593475", "0.707899", "0.7037265", "0.7033921", "0.7010285", "0.7001008", ...
0.81193304
2
Test creating ingredient with invalid credentials
def test_create_ingredient_with_invalid_credentials(self): payload = {"name": ""} response = self.client.post(INGREDIENTS_URL, payload) self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_ingredient_invalid(self):\n payload = {'name':''}\n res = self.client.post(INGREDIENTS_URL, payload)\n self.assertEqual(res.status_code, status.HTTP_400_BAD_REQUEST)", "def test_create_ingredient_invalid(self):\n payload = {\n 'name': ''\n }\n ...
[ "0.8043383", "0.8036038", "0.8029763", "0.8024851", "0.7773412", "0.7599798", "0.73002553", "0.72850907", "0.71619797", "0.7160281", "0.71310294", "0.71235204", "0.7037476", "0.70134836", "0.6984105", "0.69611526", "0.68679124", "0.68590033", "0.6851586", "0.6813474", "0.6775...
0.870159
0
Filter by ingredients assigned to recipes
def test_retrieve_ingredients_assigned_to_recipes(self): ingredient1 = create_sample_ingredient(user=self.user, name='Corn') ingredient2 = create_sample_ingredient(user=self.user, name='Egg') recipe1 = create_sample_recipe( user=self.user, title='Corn Dog', t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_filter_recipes_by_ingredients(self):\n recipe1 = sample_recipe(self.user, title='Waxy box')\n recipe2 = sample_recipe(self.user, title='Waxy noodle beans')\n ingredient1 = sample_ingredient(self.user, name='box')\n ingredient2 = sample_ingredient(self.user, name='Wet noodle')\n...
[ "0.74599975", "0.74357456", "0.72040355", "0.7188793", "0.7147592", "0.7116517", "0.69812226", "0.692441", "0.68783134", "0.6871175", "0.6649661", "0.65530777", "0.65298396", "0.6493257", "0.6479203", "0.6454717", "0.6451735", "0.6447602", "0.64124024", "0.6401968", "0.639679...
0.58202124
34
Filter ingredients by those are assigned to recipes returns unique items / ids of ingredients
def test_retrieve_ingredients_assigned_unique(self): ingredient = create_sample_ingredient(user=self.user, name="Orange") create_sample_ingredient(user=self.user, name='Chocolate') recipe1 = create_sample_recipe( user=self.user, title="Orange Juice", time_mi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_filtered_ingredients_unique(self):\n ing = Ingredient.objects.create(user=self.user, name='Eggs')\n Ingredient.objects.create(user=self.user, name='Lentils')\n recipe1 = Recipe.objects.create(\n title='Eggs Benedict',\n time_minutes=60,\n price=Decimal...
[ "0.7229256", "0.6928261", "0.6920205", "0.6784174", "0.6782429", "0.6679733", "0.6670056", "0.662722", "0.65767", "0.6507663", "0.6490793", "0.64781773", "0.64031595", "0.63517034", "0.63069206", "0.63019747", "0.62759256", "0.62652475", "0.61477053", "0.61253864", "0.6076788...
0.6574619
9
Creates a new FromListConnector.
def __init__(self, conn_list=None, safe=True, verbose=False): if not safe: logger.warn("the modification of the safe parameter will be " "ignored") if verbose: logger.warn("the modification of the verbose parameter will be " "ignore...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n this = _libsbml.new_ListWrapperModelCreator()\n try: self.this.append(this)\n except: self.this = this", "def from_list(cls, lst):\n return cls(lst[0], lst[1], lst[2])", "def list(self, list_id):\r\n return List(self, list_id)", "def from_list(cls, row...
[ "0.60183996", "0.5919735", "0.5798672", "0.5784119", "0.56553894", "0.55375713", "0.55278265", "0.55278265", "0.55074215", "0.5480959", "0.54269934", "0.53291017", "0.5315204", "0.5281003", "0.52645147", "0.51994765", "0.5130956", "0.5095737", "0.5045077", "0.5038056", "0.497...
0.0
-1
``True``, if the internal language cache is filled, ``False`` otherwise.
def has_languages(self): return bool(self._languages)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_cache(self):\n try:\n cache = self.get_cache()\n return True\n except (KeyError, AttributeError):\n return False", "def is_cached(self):\n return False", "def _check_cache(self):\n return os.path.exists(self._cache_key)", "def cacheFull(web...
[ "0.6942361", "0.68318915", "0.65948224", "0.6503021", "0.64110017", "0.63322335", "0.6321114", "0.63051057", "0.6265696", "0.6262965", "0.6196539", "0.6152407", "0.61419666", "0.6140476", "0.61153585", "0.6093247", "0.60530853", "0.6018364", "0.60178024", "0.5994895", "0.5965...
0.6350723
5
Test that the password must be more then 7 characters
def test_password_short(self): data = { 'email': 'test@test.com', 'password': 'test', 'first_name': 'Test test', 'last_name': 'Test' } res = self.client.post(SIGN_IN_USER_URL, data) self.assertEqual(res.status_code, status.HTTP_400_BAD_RE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_length(string):\n if 6 < len(string) < 12:\n return True\n\n print(\"Your password is not between 6 and 12 characters\")\n return False", "def test_long_password():\n expect_error(register, InputError,\n \"abcdef\", \"a\" * (MIN_PASSWORD - 1), \"a\", \"A\", \"a\")", ...
[ "0.80208486", "0.79477334", "0.7934826", "0.78026134", "0.77830195", "0.7745394", "0.7707861", "0.76281524", "0.76030385", "0.7602646", "0.7564967", "0.75589675", "0.7549383", "0.7548989", "0.7403878", "0.7389894", "0.7354346", "0.7343393", "0.7304078", "0.72721195", "0.72599...
0.0
-1
Test that token is not create if user doesn't exist
def test_create_token_to_user(self): data = { 'email': 'test@test.com', 'password': "testtest" } res = self.client.post(TOKEN_URL, data) self.assertNotIn('token', res.data) self.assertEqual(res.status_code, status.HTTP_400_BAD_REQUEST)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_token_no_user(self):\n res = self.client.post(TOKEN_URL, self.mock_user)\n\n self.assertEqual(res.status_code, status.HTTP_400_BAD_REQUEST)\n self.assertNotIn('token', res.data)", "def test_create_token_no_user(self):\n payload = {\n 'email': 'test@gmail.com...
[ "0.78874886", "0.7785409", "0.7752514", "0.7734269", "0.766065", "0.7623596", "0.75152147", "0.74973255", "0.7489596", "0.74872077", "0.7420635", "0.7392291", "0.7373913", "0.73681974", "0.7366023", "0.73431665", "0.7332282", "0.73075014", "0.7283629", "0.72805274", "0.721604...
0.72450686
20
Create and save the datasets.
def main(unused_argv): del unused_argv if not os.path.exists(FLAGS.data_dir): os.makedirs(FLAGS.data_dir) tfds_cached_dict = {} data_dir = FLAGS.tfds_data_dir if FLAGS.tfds_data_dir else None name = FLAGS.dataset_name tfds_cached_dict[name] = tfds.load(name, batch_size=-1, data_dir=data_dir) dataset_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __save_datasets(self):\n self.train.to_csv('{}/{}/{}'.format(path_to_train_set, img_format, 'train.csv'))\n self.valid.to_csv('{}/{}/{}'.format(path_to_valid_set, img_format, 'valid.csv'))\n self.test.to_csv('{}/{}/{}'.format(path_to_test_set, img_format, 'test.csv'))", "def save_dataset...
[ "0.79612356", "0.7385049", "0.72598714", "0.705634", "0.6983985", "0.6935778", "0.6897555", "0.6824486", "0.6816316", "0.6662035", "0.66399854", "0.6609084", "0.65978307", "0.6585421", "0.6560831", "0.6556407", "0.6553561", "0.655299", "0.65457475", "0.65290606", "0.651883", ...
0.0
-1
Get `CANONICAL COMBINING CLASS` property.
def get_canonical_combining_class_property(value, limit_ascii=False): obj = unidata.ascii_canonical_combining_class if limit_ascii else unidata.unicode_canonical_combining_class if value.startswith('^'): negated = value[1:] value = '^' + unidata.unicode_alias['canonicalcombiningclass'].get(neg...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def CAMC_class_level(self, class_entity: und.Ent):\n if \"Interface\" in class_entity.kindname():\n return 2.\n\n percentage = class_entity.metric(['PercentLackOfCohesion']).get('PercentLackOfCohesion', 0)\n\n if percentage is None:\n percentage = 0\n cohesion_ = 1...
[ "0.63853973", "0.5887872", "0.57596433", "0.5675097", "0.56383353", "0.56019676", "0.55945706", "0.55662066", "0.5561708", "0.5547934", "0.55256736", "0.5514127", "0.5507694", "0.54908484", "0.5418986", "0.5392617", "0.5386657", "0.53766394", "0.5375963", "0.53421754", "0.532...
0.6050919
1
Get `GRAPHEME CLUSTER BREAK` property.
def get_grapheme_cluster_break_property(value, limit_ascii=False): obj = unidata.ascii_grapheme_cluster_break if limit_ascii else unidata.unicode_grapheme_cluster_break if value.startswith('^'): negated = value[1:] value = '^' + unidata.unicode_alias['graphemeclusterbreak'].get(negated, negate...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_color_marker(self):\r\n return self._board.get_color_marker_b()", "def get_bl_cell(self):\n return self._bl_cell", "def get_br_cell(self):\n return self._br_cell", "def get_board():\r\n try:\r\n get_board_property('BOARD')\r\n except:\r\n logging.info(\"board ...
[ "0.55951756", "0.55076516", "0.5462207", "0.53071433", "0.5261261", "0.52243507", "0.5152381", "0.5127707", "0.51017517", "0.50475234", "0.4952774", "0.49512142", "0.49273625", "0.49251992", "0.49002564", "0.487547", "0.48741546", "0.48646748", "0.48517516", "0.48342806", "0....
0.65827864
0
Get `WORD BREAK` property.
def get_word_break_property(value, limit_ascii=False): obj = unidata.ascii_word_break if limit_ascii else unidata.unicode_word_break if value.startswith('^'): negated = value[1:] value = '^' + unidata.unicode_alias['wordbreak'].get(negated, negated) else: value = unidata.unicode_al...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wordWrap(self):\n return self._wordWrap", "def get_sentence_break_property(value, limit_ascii=False):\n\n obj = unidata.ascii_sentence_break if limit_ascii else unidata.unicode_sentence_break\n\n if value.startswith('^'):\n negated = value[1:]\n value = '^' + unidata.unicode_alias[...
[ "0.63220966", "0.6150562", "0.6047898", "0.5909866", "0.58146465", "0.5801833", "0.5726474", "0.5657182", "0.5430929", "0.5427109", "0.52837193", "0.5201121", "0.5191721", "0.51680475", "0.51624715", "0.51624715", "0.51624715", "0.5069191", "0.5050564", "0.50338864", "0.50219...
0.75088406
0
Get `NFKC QUICK CHECK` property.
def get_nfkc_quick_check_property(value, limit_ascii=False): obj = unidata.ascii_nfkc_quick_check if limit_ascii else unidata.unicode_nfkc_quick_check if value.startswith('^'): negated = value[1:] value = '^' + unidata.unicode_alias['nfkcquickcheck'].get(negated, negated) else: val...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_nfkd_quick_check_property(value, limit_ascii=False):\n\n obj = unidata.ascii_nfkd_quick_check if limit_ascii else unidata.unicode_nfkd_quick_check\n\n if value.startswith('^'):\n negated = value[1:]\n value = '^' + unidata.unicode_alias['nfkdquickcheck'].get(negated, negated)\n else:...
[ "0.7399226", "0.7337496", "0.72616553", "0.5161121", "0.5059721", "0.5059721", "0.4972487", "0.4945945", "0.4945945", "0.49445036", "0.49255425", "0.49119884", "0.4869819", "0.47528106", "0.4734799", "0.4722543", "0.47131658", "0.47095245", "0.46954685", "0.4686565", "0.46799...
0.7472594
0
Get `JOINING GROUP` property.
def get_joining_group_property(value, limit_ascii=False): obj = unidata.ascii_joining_group if limit_ascii else unidata.unicode_joining_group if value.startswith('^'): negated = value[1:] value = '^' + unidata.unicode_alias['joininggroup'].get(negated, negated) else: value = unidat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def group(self):\n return self.properties.get('Group', None)", "def get_group(self):\n return self._group", "def group(self):\n return self._group", "def group(self):\n return self._group", "def group(self):\n return self._group", "def group(self) -> str:\n retur...
[ "0.6174453", "0.6123196", "0.60643935", "0.60643935", "0.60643935", "0.59725654", "0.5935929", "0.5920283", "0.5876285", "0.5870215", "0.58685136", "0.5822746", "0.5815961", "0.58036333", "0.57742864", "0.5754312", "0.5753029", "0.5753029", "0.5753029", "0.5733493", "0.573349...
0.71418804
0
Get shortcut for `Block` property.
def get_in_property(value, limit_ascii=False): if value.startswith('^'): prefix = value[1:3] temp = value[3:] negate = '^' else: prefix = value[:2] temp = value[2:] negate = '' if prefix != 'in': raise ValueError("Does not start with 'in'!") val...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetBlock(self):\n return self._block", "def block(self) -> IMockPin:\n return self[\"block\"]", "def getBlock(self) -> ghidra.program.model.correlate.Block:\n ...", "def get_block(self):\n return Gumtree.gumtree.getBlock()", "def getblock(self, hash):\n return self.proxy....
[ "0.7928375", "0.73139465", "0.69850004", "0.67546177", "0.66679144", "0.661986", "0.66102415", "0.65308094", "0.65064275", "0.6449779", "0.6446401", "0.6398499", "0.63909376", "0.63490975", "0.62836283", "0.62705564", "0.6235264", "0.6230996", "0.6214852", "0.6166191", "0.615...
0.0
-1
Get a random element from the set.
def getRandom(self): return random.choice(self.data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getRandom(self):\n return self.nums[random.randint(0, len(self.nums) - 1)]\n\n # Your RandomizedSet object will be instantiated and called as such:\n # obj = RandomizedSet()\n # param_1 = obj.insert(val)\n # param_2 = obj.remove(val)\n # param_3 = obj.getRandom()", "...
[ "0.77060276", "0.738916", "0.7296881", "0.72187954", "0.6871744", "0.68453854", "0.68330806", "0.67740154", "0.67226046", "0.6703282", "0.6665089", "0.66356236", "0.66217655", "0.6612035", "0.66000897", "0.6567767", "0.6477719", "0.6462421", "0.64428514", "0.6400411", "0.6398...
0.64162946
19
General test to make sure that all groups respond with a Status Code of 200 regardless of the filters.
def test_success_with_all_filters(client, monkeypatch, elasticsearch_transaction_index): setup_elasticsearch_test(monkeypatch, elasticsearch_transaction_index) for group in GROUPING_LOOKUP.keys(): resp = client.post( "/api/v2/search/spending_over_time", content_type="applicatio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_group_pass(client):\n\n response = client.get('/group/group_a')\n assert response.status_code == 202", "def test_status_code(self):\n assert self.list_response.status_code == 200", "def test_request_groups_group(self):\n response = requests.get(self.url + '/groups/Human')\n\n ...
[ "0.7418035", "0.7088492", "0.69642097", "0.68185294", "0.67782515", "0.67724663", "0.670773", "0.6686556", "0.66719025", "0.6595372", "0.65692824", "0.64868635", "0.6468003", "0.6461254", "0.64291203", "0.64102817", "0.6367873", "0.6328", "0.63214076", "0.62600344", "0.625736...
0.6559423
11
Test that the Transactions ES query does NOT return transactions with an `action_date` before the applicable `earliest_public_law_enactment_date`
def test_transactions_defc_date_filter(client, monkeypatch, elasticsearch_transaction_index): baker.make( "references.DisasterEmergencyFundCode", code="L", group_name="covid_19", earliest_public_law_enactment_date="2020-03-06", ) baker.make( "references.DisasterEmerg...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_filter_by_bad_date(admin_client, public_resource_with_metadata):\n query_filter = {\"date\": [\"2019-11-01\", \"bad-date\"]}\n djangoresponse = admin_client.get('/discoverapi/?filter={}'.format(json.dumps(query_filter)), follow=True)\n response = json.loads(djangoresponse.content.decode(\"utf-8\"...
[ "0.61819583", "0.61686105", "0.5963692", "0.5957112", "0.5909046", "0.5907962", "0.5800679", "0.57791096", "0.57678175", "0.57347214", "0.5731899", "0.56792355", "0.56678224", "0.56271493", "0.55481404", "0.5541767", "0.54604393", "0.54364276", "0.54326934", "0.5422241", "0.5...
0.67618805
0
Return the default system encoding. If data is passed, try to decode the data with the default system encoding or from a short list of encoding types to test.
def detect_encoding(data): enc_list = ['UTF-8', 'LATIN-1', 'iso8859-1', 'iso8859-2', 'UTF-16', 'CP720'] code = locale.getpreferredencoding(False) if code not in enc_list: enc_list.insert(0, code) for c in enc_list: try: for line in data: line.d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def guess_encoding(data):\n successful_encoding = None\n # we make 'utf-8' the first encoding\n encodings = ['utf-8']\n #\n # next we add anything we can learn from the locale\n try:\n encodings.append(locale.nl_langinfo(locale.CODESET))\n except AttributeError:\n pass\n try:\...
[ "0.6944692", "0.6613656", "0.6527844", "0.6300768", "0.62194836", "0.62194836", "0.6140156", "0.5925443", "0.58904684", "0.5785104", "0.57738185", "0.5766558", "0.5673164", "0.56675607", "0.56627065", "0.56410706", "0.56225324", "0.56027883", "0.5567192", "0.5565101", "0.5556...
0.6907834
1
Helper assert method that matches email properties to posted data. It's pulled out here as this is used in most of the tests to assert that the parser worked properly.
def _assertEmailParsedCorrectly(self, email, data): self.assertIsInstance(email, EmailMultiAlternatives) self.assertEqual(email.to, data.get('recipient', '').split(',')) self.assertEqual(email.from_email, data.get('sender', '')) self.assertEqual(email.subject, data.get('subject', '')) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assertEmail(self,email,email_expected):\n for attr in email_expected.keys():\n try:\n found = getattr(email,attr)\n except AttributeError as e:\n raise AttributeError(\"Could not find attribute '{0}' for this email.\\\n ...
[ "0.7014028", "0.66918933", "0.6532641", "0.6497586", "0.648692", "0.64052284", "0.635272", "0.6342222", "0.6341287", "0.63165236", "0.6255496", "0.6204508", "0.6194129", "0.6184835", "0.6110779", "0.61066616", "0.60909665", "0.60880065", "0.60849625", "0.6076038", "0.60755575...
0.7647631
0
Test that a valid POST returns a 200.
def test_parse_valid_request(self): request = self.factory.post(self.url, data=mailgun_payload) email = self.parser.parse(request) self._assertEmailParsedCorrectly(email, mailgun_payload)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_post(self):\n self.assertEqual(200, self.resp.status_code)", "def test_post(self):\n self.assertEqual(200, self.resp.status_code)", "def test_post(self): \n self.assertEqual(200, self.resp.status_code)", "def test_post(self):\n self.assertEqual(200, self.re...
[ "0.82553154", "0.82553154", "0.82292974", "0.8173999", "0.8010713", "0.79098445", "0.74451107", "0.74392253", "0.7405635", "0.7391436", "0.7379532", "0.73664683", "0.73558956", "0.7295357", "0.7261452", "0.72538483", "0.7249718", "0.7217101", "0.7189996", "0.71717715", "0.714...
0.0
-1
Test inbound email with no HTML alternative.
def test_text_email_only(self): data = mailgun_payload del data['stripped-html'] request = self.factory.post(self.url, data=data) email = self.parser.parse(request) self._assertEmailParsedCorrectly(email, mailgun_payload)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_activation_email_is_plain_text_if_html_disabled(self):\n new_user = UserModel().objects.create_user(**self.user_info)\n profile = self.registration_profile.objects.create_profile(new_user)\n profile.send_activation_email(Site.objects.get_current())\n\n self.assertEqual(len(mail...
[ "0.65976375", "0.6327827", "0.63211226", "0.61484176", "0.61226", "0.6074866", "0.6008096", "0.60016257", "0.5972114", "0.59697807", "0.59566844", "0.594743", "0.58718866", "0.5854165", "0.5848339", "0.5822363", "0.58075315", "0.5782085", "0.57576954", "0.5717805", "0.5676927...
0.70654714
0
Transforms the text into a numeric representation.
def transform(self, X, y=None): result = [] for b in _batch(X, self.batch_size): resp = openai.Embedding.create(input=b, model=self.model) # fmt: off result.extend([_["embedding"] for _ in resp["data"]]) return np.array(result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply(cls, strText):\n return convertNumber(cls, strText)", "def convert_to_number(text):\n try:\n value = float(text)\n return value\n except ValueError:\n return 0.0", "def get_number(text):\n# if (isinstance(text, str) or isinstance(text, unicode)...
[ "0.7592332", "0.75282353", "0.701761", "0.68892765", "0.66164124", "0.66003793", "0.6380535", "0.6368573", "0.63230425", "0.63054836", "0.62920934", "0.62110823", "0.6151446", "0.613479", "0.60599333", "0.60599333", "0.60599333", "0.60471356", "0.6026906", "0.60151595", "0.59...
0.0
-1
Creates an application instance to run
def create_app(config_class=DevConfig): app = Flask(__name__) # Configure langbridge wth the settings from config.py app.config.from_object(config_class) # Initialise plugins db.init_app(app) login_manager.init_app(app) from populate_db import populate_db from langbridge.models import...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_and_run():\n\n app = App()\n app.run()", "def app():\n app = create_app()\n return app", "def app():\n return create_app()", "def _create_app_instance(script_info):\n return create_app()", "def create():\n\n return App()", "def create_app(self):\n raise NotImplement...
[ "0.83488935", "0.82451415", "0.8128195", "0.80928856", "0.80755126", "0.775862", "0.75094706", "0.74950886", "0.7403474", "0.7395022", "0.7382577", "0.73744416", "0.7364556", "0.7333675", "0.7302484", "0.73002446", "0.72676677", "0.7261175", "0.7236767", "0.7206738", "0.71572...
0.0
-1
String representation of the class instance
def __str__(self): return 'Token({type}, {value})'.format( type=self.type, value=repr(self.value) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n class_dictionary = vars(self)\n out = self.__class__.__name__\n for k,v in class_dictionary.items():\n if v > 0:\n out += ' : ' + str(k) + ' = ' + str(v)\n return out", "def __repr__(self):\n outl = 'class :'+self.__class__.__name_...
[ "0.81874895", "0.8106245", "0.80137444", "0.80137444", "0.80137444", "0.80137444", "0.80137444", "0.8001348", "0.7990777", "0.7988722", "0.7976598", "0.79554594", "0.79554594", "0.79554594", "0.7947037", "0.79151434", "0.7913208", "0.7875277", "0.7874553", "0.7874151", "0.786...
0.0
-1
Makes a list of watersheds formatted for a tethys gizmo [(Name (Delineation), designation)]
def watershedlist(): opts = watersheds_db() return [(opts[opt]['name'] + ' (' + opts[opt]['delineation'] + ')', opt) for opt in opts]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def MONSTERS():\n list_of_monster = [\n (\"Elfy the Elf\", \"A small elvin creature with a bow and arrows around its back.\", 2, 1, 1),\n (\"Bazilisk\", \"A long snake with piercing eyes\", 3, 2, 1), \n (\"Shrak the Ogre\", \"A large green ogre with a penchant for eating people\", 4, 2, 2),\n (\"Wanda the Wit...
[ "0.5882248", "0.5573241", "0.5532029", "0.5512244", "0.55052084", "0.5487949", "0.5289236", "0.5280334", "0.52248394", "0.5207762", "0.5192513", "0.5189626", "0.5178893", "0.5100959", "0.50942713", "0.5082073", "0.50586253", "0.5032512", "0.5022993", "0.50028336", "0.49869308...
0.7866766
0
The time index, i.e., axis labels related to the time domain. Returns
def time(self): ret = self._iamcache.get("time") if ret is None: ret = self._iamcache["time"] = ( self.index[self].unique(level=self.time_col).rename("time") ) return ret
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solar_time_index(self):\n return self.data.solar_time_index", "def time_index(self):\n if self._time_index is None and self.cf_file is not None:\n with Outputs(self.cf_file) as cfh:\n if 'time_index' in cfh.datasets:\n self._time_index = cfh.time_ind...
[ "0.76805323", "0.7640153", "0.7546885", "0.7121995", "0.71130514", "0.70129293", "0.7009037", "0.695897", "0.69034654", "0.6875653", "0.68154144", "0.6781627", "0.6730721", "0.6686779", "0.6686779", "0.66274023", "0.6620398", "0.6618044", "0.6617106", "0.6554614", "0.63860774...
0.5926848
52
Gets a list of all greenlets the gc interface knows about.
def get_greenlets(cls): return { obj for obj in gc.get_objects() if isinstance(obj, greenlet) and not obj.dead }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self) -> list:\n return self.__cogs", "def get_all_objects():\n gc.collect()\n gcl = gc.get_objects()\n olist = []\n seen = {}\n # Just in case:\n seen[id(gcl)] = None\n seen[id(olist)] = None\n seen[id(seen)] = None\n # _getr does the real work.\n _getr(gcl, olist, seen)\n return olist...
[ "0.64701545", "0.62942654", "0.62942165", "0.6208794", "0.59352356", "0.57832265", "0.5764089", "0.5752288", "0.57292235", "0.57271373", "0.5709225", "0.5648399", "0.56404215", "0.5579244", "0.5573825", "0.5542654", "0.5540714", "0.55387324", "0.54869395", "0.54617894", "0.54...
0.83147603
0
Gets the user's first and last name concatenated. This way, if the format for names changes, the update only needs to be reflected in this method.
def full_name(self): return f"{self.first_name} {self.last_name}"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_full_name(self):\n full_name = f'{self.first_name} {self.last_name}' if self.first_name and self.last_name else self.username\n return full_name.strip()", "def get_full_name(self):\n # The user is identified by their email address\n return self.first_name+' '+self.last_name", ...
[ "0.81973845", "0.81669945", "0.8132565", "0.8126113", "0.8113143", "0.8062174", "0.80300283", "0.80249274", "0.8020681", "0.7976161", "0.79322284", "0.7912409", "0.78997415", "0.78978443", "0.78973573", "0.7881445", "0.7881445", "0.7867806", "0.7866995", "0.7866995", "0.78631...
0.76130414
65
Retrieve a value from the cache. Returns unpicked value if key is found, ``None`` if not.
def get(self, key, default=None): try: # get the value from the cache value = self._cache.get(self.prepare_key(key)) if value is None: return default # pickle doesn't want a unicode! value = smart_str(value) # hydrate that p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self, key):\n if key:\n return self.cache_data.get(key)\n else:\n return None", "def get(self, key):\n if key and key in self.cache_data:\n return self.cache_data[key]\n return None", "def get(self, key):\n if key and key in self.cache...
[ "0.8305171", "0.8263916", "0.8189407", "0.8189407", "0.81053424", "0.76638633", "0.7656514", "0.76529044", "0.76509786", "0.7629301", "0.7560026", "0.75022787", "0.7495058", "0.7485665", "0.7392598", "0.72800326", "0.7275602", "0.7250145", "0.7169241", "0.7161578", "0.7151992...
0.70645964
25
Key used to sort models on this field.
def sort_wildcard(self): return self.make_key( self._model._name, "*", self.name, )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort_key(self):\n ...", "def get_sort_key(self) -> str:\n return self.name", "def sort_by_key(request):\n return request.param", "def sort_by_key(request):\n return request.param", "def _get_field_sort_key(self, field):\n if not field.is_relation:\n return -1\n ...
[ "0.8122682", "0.7901692", "0.7208272", "0.7208272", "0.7014104", "0.67793083", "0.67062646", "0.6582051", "0.6541909", "0.6519382", "0.63183063", "0.6314355", "0.62919545", "0.6241614", "0.6240595", "0.62015873", "0.6119211", "0.6075274", "0.60637546", "0.59809494", "0.597624...
0.69114256
5
Deindex the current value of the field
def deindex(self): self.deindex_value(self.proxy_get())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deindex_value(self, value):\n if value:\n value = value.decode('utf-8')\n key = self.index_key(value)\n return self.connection.srem(key, self._instance.get_pk())\n else:\n return True # True?", "def pop(self, idx=-1):\n to_ret =self. __getitem...
[ "0.6951613", "0.64633554", "0.646068", "0.62501496", "0.6222606", "0.6207916", "0.61745286", "0.61714756", "0.6165094", "0.61245394", "0.60726035", "0.60725737", "0.60651714", "0.60317326", "0.6026809", "0.6017447", "0.59831345", "0.5916838", "0.59073985", "0.58976287", "0.58...
0.7719006
0
Sends a 401 response that enables basic auth
def authenticate(): return abort(401)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authenticate():\n return Response('Not Authorized', 401, {'WWW-Authenticate': 'Basic realm=\"api\"'})", "def authenticate():\n return Response(\n '', 401, {'WWW-Authenticate': 'Basic realm=\"Login Required\"'}\n )", "def authenticate():\n return Response(\n 'You have to login with pro...
[ "0.8093736", "0.80926424", "0.7958403", "0.7852648", "0.7843114", "0.7824419", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", ...
0.69043815
54
Squared distance matrix for column array of Ndimensional points Example
def squared_dist(x1: np.ndarray, x2: np.ndarray) -> np.ndarray: return ( np.sum(x1 ** 2, 1).reshape(-1, 1) + np.sum(x2 ** 2, 1) - 2 * np.dot(x1, x2.T) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distance_matrix(n_row, n_col):\n\n n_pop = int(n_row * n_col)\n center = int(n_row/2*(n_col+1))\n\n pop_idx = np.arange(n_pop)\n pop_idx_col = np.remainder(pop_idx, n_col)\n pop_idx_row = pop_idx // n_row\n\n pos = np.vstack((pop_idx_col,pop_idx_row)).T\n distance = spa.distance.cdist([pos...
[ "0.69117224", "0.6829781", "0.6806005", "0.6759985", "0.669698", "0.6486786", "0.6480252", "0.64737844", "0.6473206", "0.6419687", "0.64023644", "0.63711214", "0.6355581", "0.6352303", "0.6334924", "0.63265526", "0.6226102", "0.6218937", "0.6191305", "0.6184281", "0.6179523",...
0.6524205
5
convert poselist into an numpy 2d array
def pose_list_to_array(poses): tmp_list = list() for p in poses: tmp_list.append([p.pose.position.x, p.pose.position.y, p.pose.position.z, p.pose.orientation.x, p.pose.orientation.y, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_pose_2d(np_trajectory):\n arr = []\n for i in range(len(np_trajectory[0])):\n pose = msgs.Pose2D(np_trajectory[0,i], np_trajectory[1,i], 0.)\n arr.append(pose)\n return arr", "def path_response_to_array(get_path_response):\n point_list = list()\n for pose in get_path_response....
[ "0.7336553", "0.68967414", "0.65081954", "0.63894117", "0.6176081", "0.6107774", "0.60596323", "0.60092604", "0.5987461", "0.59838676", "0.5980979", "0.5977322", "0.5962724", "0.5959343", "0.5950146", "0.5943165", "0.59344727", "0.5907701", "0.5892749", "0.58887064", "0.58855...
0.8136957
0
Calculate Entropy of a String.
def entropy(data): strings, lens = Counter(data), np.float(len(data)) return -sum(count / lens * np.log2(count / lens) for count in strings.values())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def entropy(string):\n p, lns = Counter(string), float(len(string))\n return -sum(count/lns * math.log(count/lns, 2) for count in p.values())", "def entropy(self, text):\n\n# text = self.myReplacer.replace(text)\n# text = self.tokenizer.tokenize(text)\n new_text = []\n for word ...
[ "0.77224576", "0.6730553", "0.6705342", "0.6565808", "0.6565808", "0.6491419", "0.6362258", "0.62436306", "0.6176176", "0.6171096", "0.61296725", "0.6118673", "0.6105753", "0.61055726", "0.6078979", "0.6041101", "0.60042286", "0.5980629", "0.5935177", "0.58972156", "0.5895118...
0.6606669
3
Return True if all regrets are 0
def is_zero(self): for action, prob in self._regrets.items(): if prob != 0.0: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_zero(self):\n for t in self:\n if t != TRIT_ZERO:\n return False\n return True", "def __nonzero__(self):\n for e in self:\n if e != 0:\n return True\n return False", "def __bool__(self):\n\t\treturn any(c != 0 for c in self)...
[ "0.7635675", "0.76350194", "0.727699", "0.7210684", "0.708253", "0.7021046", "0.7011555", "0.69927406", "0.69814265", "0.69644326", "0.6951224", "0.6889062", "0.68753296", "0.68695354", "0.68598664", "0.68163645", "0.6744497", "0.6741299", "0.67163473", "0.67092997", "0.66817...
0.8309084
0
Get the cell state for the given x, y coordinate
def __get_cell_state(self, y, x): if 0 <= y <= self.__height - 1: if 0 <= x <= self.__width - 1: return self.__board[y][x] return 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cell_at(self, x, y):\n\n return self.maze_map[x][y]", "def get_state(self,board):\n s = range(board.size())\n return [ board.getCell(x,y) for y in s for x in s]", "def cell_from_xy(self,x,y):\n return self.cell_array.item((x,y))", "def cell_index(self, coord):\n\n for x...
[ "0.713203", "0.71026856", "0.69490874", "0.6937443", "0.6854741", "0.68144614", "0.68128306", "0.67764723", "0.67439634", "0.6685023", "0.65999454", "0.6586837", "0.6516534", "0.6488384", "0.6488384", "0.64798576", "0.6478275", "0.6438097", "0.63796806", "0.633307", "0.630186...
0.8463577
0
Return dataframe with parameters and corresponding AIC parameters_list list with (ps,d, qs, Ps,D, Qs,s) tuples
def optimize_SARIMA(data_column,parameters_list): results = [] best_aic = float('inf') #for param in tqdm(parameters_list): for param in parameters_list: try: model = sm.tsa.statespace.SARIMAX(data_column, order=(param[0], param[1],param[2]), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sa_pandas_init(self):\n\n lca = self.lca\n\n ind_activity = 0\n ind_product = 1\n ind_biosphere = 2\n\n cols = []\n rows = []\n inputs = []\n\n #All exchanges in inputs\n for input_ in self.inputs:\n\n if input_ == 'biosphere':\n ...
[ "0.65259737", "0.5827112", "0.58132374", "0.566593", "0.56378794", "0.56074446", "0.55929184", "0.5585561", "0.5496825", "0.54877466", "0.54783034", "0.54392135", "0.5418733", "0.54003364", "0.53908134", "0.5383692", "0.53503346", "0.5346228", "0.5342126", "0.5288558", "0.526...
0.54691213
11
xaxis label and units. Axis labels know about units. We need to do this so that we can detect when axes are not commesurate. Currently this is ignored other than for formatting purposes.
def xaxis(self,label,units): if units != "": label = label + " (" + units + ")" self.subplot.set_xlabel(label) pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xaxis(self,label,units):\r\n if units != \"\": label = label + \" (\" + units + \")\"\r\n self.xbox.set_text(r\"$%s$\" % (label))\r\n pass", "def set_xunits(self, units, include_brackets):\n if include_brackets:\n plt.xlabel(\n \"x (\" + self.xunits_from_...
[ "0.747232", "0.68593526", "0.6854486", "0.65952134", "0.64550745", "0.64156145", "0.6395764", "0.6342323", "0.6329634", "0.6263506", "0.62534124", "0.6244231", "0.62103266", "0.6163172", "0.61463356", "0.6105711", "0.60833925", "0.607024", "0.60589856", "0.6041085", "0.603822...
0.77870077
0
yaxis label and units.
def yaxis(self,label,units): if units != "": label = label + " (" + units + ")" self.subplot.set_ylabel(label) pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def yaxis(self,label,units):\r\n if units != \"\": label = label + \" (\" + units + \")\"\r\n self.ybox.set_text(r\"$%s$\" % (label))\r\n pass", "def ylabel(ylabel):\n impl.ylabel(**locals())", "def labels_y(y_unit, latex = True, verbose = 0): \n\n if verbose > 1:\n ...
[ "0.83645123", "0.7328002", "0.7229695", "0.72150916", "0.7116793", "0.70888394", "0.70200956", "0.7003589", "0.6940507", "0.6940507", "0.6785098", "0.67295647", "0.67104685", "0.66930753", "0.6681132", "0.66706085", "0.6655517", "0.6536776", "0.65352345", "0.65045035", "0.644...
0.8391478
0
Return a particular colour
def _color(self,c): return self.colorlist[c%len(self.colorlist)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_colour(self):\n return self.colour", "def get_color(self):\r\n if self.color:\r\n return \"RED\"\r\n else:\r\n return \"BLACK\"", "def _get_color(self):\n return self.__color", "def _get_color(self):\n return self.__color", "def _get_color(self):\n ...
[ "0.79189974", "0.7775498", "0.7696077", "0.7696077", "0.7696077", "0.7696077", "0.76859313", "0.76137847", "0.7596811", "0.759279", "0.7581686", "0.7569029", "0.7531314", "0.75232863", "0.75227064", "0.7502206", "0.746936", "0.74628705", "0.74507976", "0.74475384", "0.7388337...
0.7317383
51
Get the last forecast date of course for the student.
def get_last_forecast_date( self, student: Student, course: Course ) -> datetime.date | None: task_items = self.get_task_items(student, course) if not task_items: return None task_item = task_items[-1] if "planned_date" in task_item: return task_item[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forecast_date(self):\n return self._forecast_date", "def lastdate(self):\n if hasattr(self, \"_lastdate\"):\n return self._lastdate\n else:\n return None", "def get_latest_date(cls):\n\n return cls.query.order_by(desc(cls.date)).first().date", "def get_la...
[ "0.6093679", "0.59575355", "0.5748554", "0.5667801", "0.5599203", "0.5595519", "0.55529684", "0.5526187", "0.55168307", "0.54966515", "0.5483566", "0.5449377", "0.5418685", "0.5374554", "0.5362375", "0.5356439", "0.5336235", "0.5240382", "0.5226819", "0.5215349", "0.5214512",...
0.8132933
0
Plot dashed lines marking the left and right edges of the RightofWay. Axis limits are also adjusted to allow extra space on the sides to make the ROW edge lines visible if needed. The ROW edge line handles are returned in a list.
def _plot_ROW_edges(ax, lROW, rROW, **kw): yl = list(ax.get_ylim()) if(yl[0] > 0): yl[0] = 0 kw['H'].append(ax.plot([lROW]*2, yl, '--', color=_ROW_color, linewidth=_ROW_linewidth, zorder=-1)[0]) ax.plot([rROW]*2, yl, '--', color = _ROW_color, linewidth=_RO...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def makeLeftRightline(self):\r\n left_lines = []\r\n right_lines = []\r\n for i in self.lines:\r\n for x1,y1,x2,y2 in i:\r\n if x1 == x2:\r\n #Vertical Lines\r\n pass\r\n else:\r\n m = (y2 - y1) /...
[ "0.66394055", "0.5998774", "0.56851923", "0.5674667", "0.56207216", "0.55366576", "0.54972124", "0.5479025", "0.5462891", "0.54447293", "0.5372779", "0.532239", "0.52326506", "0.5189719", "0.5189172", "0.5184833", "0.51770264", "0.5139401", "0.5131068", "0.5127037", "0.511634...
0.63444376
1
Spawn a process acting as a data stream process. Attach to subscription queue with process function.
def _spawn_stream_process(self, process_id, name, module, cls, config, proc_attr): process_instance = self._create_process_instance(process_id, name, module, cls, config, proc_attr) listen_name = get_safe(config, "process.listen_name") or name log.debug("Stream Process (%s) listen_name: %s", na...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def spawn_process_for(self, gq):\n pipe_top, pipe_bottom = multiprocessing.Pipe()\n p = multiprocessing.Process(target=GridQueue.listen,args=(gq, pipe_bottom))\n p.start()\n self.pipes[gq.index] = pipe_top", "def _spawn_simple_process(self, process_id, name, module, cls, config, proc_...
[ "0.64839756", "0.63894695", "0.6189457", "0.6163997", "0.61158824", "0.6041421", "0.6003201", "0.5981737", "0.5918307", "0.59148973", "0.58488166", "0.58281493", "0.58237195", "0.5796234", "0.5717466", "0.57159036", "0.56957644", "0.5688037", "0.5662339", "0.5662339", "0.5658...
0.7301095
0
Spawn a process acting as immediate one off process. No attachments.
def _spawn_immediate_process(self, process_id, name, module, cls, config, proc_attr): process_instance = self._create_process_instance(process_id, name, module, cls, config, proc_attr) self._process_init(process_instance) self._process_start(process_instance) return process_instance
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Spawn(proc):\n proc.start()\n return proc", "def _spawn_simple_process(self, process_id, name, module, cls, config, proc_attr):\n process_instance = self._create_process_instance(process_id, name, module, cls, config, proc_attr)\n # Add publishers if any...\n publish_streams = get_...
[ "0.7232305", "0.6948426", "0.671985", "0.6622016", "0.64707696", "0.6302122", "0.6241317", "0.62348", "0.62282974", "0.6213381", "0.6209543", "0.61510676", "0.613883", "0.6133707", "0.60917604", "0.6044146", "0.603128", "0.59901947", "0.5881509", "0.5866953", "0.58435607", ...
0.79713595
0
Sets the ycoordinate of the game object
def set_y(self, y: float): self.y = y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setY(self, y):\n self.position.setY(y)", "def setY(self, y):\n self.y = y\n pass", "def setY(self, y):\r\n\t\tself._y=y", "def set_y(self, y):\n self.scene.set_y_loc(y)\n self.redraw()", "def set_y(self, y):\n self._y = y", "def SetY(self, y):\r\n\r\n ...
[ "0.84512925", "0.8356659", "0.8343062", "0.8309194", "0.8244446", "0.8196277", "0.8193444", "0.79307985", "0.7924641", "0.7599219", "0.7569241", "0.7569241", "0.75308496", "0.75104684", "0.7189491", "0.7133116", "0.71157473", "0.70214254", "0.7008428", "0.7008428", "0.6955724...
0.81367886
7
Return string representation of duration.
def say_duration(duration): result = [] for d in ['day', 'hour', 'minute', 'second']: if duration[d] == 1: result.append("{0} {1}".format(duration[d], d)) if duration[d] > 1: result.append("{0} {1}s".format(duration[d], d)) if result: if len(result) > ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_duration_string(duration):\n\n minutes = duration // 60\n seconds = duration % 60\n return \"the game took {} minutes and {} seconds\".format(minutes, seconds)", "def duration_string(duration, precision='s'):\n if not duration:\n return ''\n try:\n return d_string(duration, p...
[ "0.78283954", "0.7612748", "0.740321", "0.73615193", "0.7223187", "0.7030458", "0.697632", "0.6972373", "0.69521856", "0.69521856", "0.6948369", "0.69230866", "0.6889261", "0.68474483", "0.6789574", "0.67614967", "0.6703804", "0.66851985", "0.6647659", "0.6642876", "0.6639498...
0.6809884
14
Returns best match from list of valid Strava activities.
def match_activity(activity): possibilities = [ 'Ride', 'Kitesurf', 'Run', 'NordicSki', 'Swim', 'RockClimbing', 'Hike', 'RollerSki', 'Walk', 'Rowing', 'AlpineSki', 'Snowboard', 'BackcountrySki', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_best_match(self, list):\n raise NotImplementedError", "def selectActivity(self, activities):\n activitiesList = list(activities) # in case it is a np.array\n return max(set(activitiesList), key = activitiesList.count) # when mutiple activities have the same count retuns one (not ...
[ "0.65340424", "0.6246927", "0.57577205", "0.5686547", "0.55669457", "0.5486536", "0.5419764", "0.54120296", "0.54005754", "0.53934324", "0.538365", "0.53741246", "0.53499854", "0.5321839", "0.52588767", "0.52541435", "0.52394557", "0.5184378", "0.5132319", "0.51221687", "0.50...
0.6975584
0
Function to convert Twitter created_at to date format
def get_date(created_at): dt_obj = datetime.datetime.strptime(created_at, '%a %b %d %H:%M:%S +0000 %Y') #dt_str = datetime.datetime.strftime(dt_obj, '%Y-%m-%d') return dt_obj
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def date_posted(tweet):\n return tweet.created_at.date()", "def friendly_date(self):\n return self.created_at.strftime(\"%a %b %#d %Y, %#I:%M %p\")", "def friendly_date(self):\n\n return self.created_at.strftime(\"%a %b %-d %Y, %-I:%M %p\")", "def create_timestamp(record):\n\n timestamp =...
[ "0.73269874", "0.7021728", "0.67332566", "0.65926284", "0.6580471", "0.65517807", "0.65517807", "0.65517807", "0.6434054", "0.6430373", "0.64195925", "0.6413171", "0.6406449", "0.63994086", "0.6347499", "0.633535", "0.63320607", "0.6305673", "0.6235785", "0.6194503", "0.61923...
0.70207125
2
check is user exist
def create(self, request): serializer = self.serializer_class(data=request.data) serializer.is_valid(raise_exception=True) return Response(serializer.data, status=status.HTTP_200_OK)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _checkUserExists(username,self):\r\n \r\n exists = False\r\n \r\n if _findUser(username) is not None:\r\n exists = True\r\n \r\n return exists", "def test_existence(self):\n self.assertTrue(User.objects.filter(username='rcm').exists())", "def check_user_exists(self):\n ...
[ "0.8011452", "0.79563403", "0.7864296", "0.786003", "0.7761995", "0.77526516", "0.7740998", "0.76807237", "0.76514554", "0.76472235", "0.76272124", "0.76221436", "0.7577246", "0.7468657", "0.74626964", "0.745452", "0.7435738", "0.7427423", "0.7424676", "0.74196064", "0.740010...
0.0
-1
Parses a requirements.txt file and removes all comments leaving only the actual requirements
def get_valid_requirements(req_path): return [r for r in open(req_path, "r").readlines() if r[0] != "#"]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tidy_requirements(requirement_file):\n outdata = []\n with open(requirement_file) as dependencies:\n for line in dependencies:\n line = line.strip()\n if line and not line.startswith('#') and line not in outdata:\n outdata.append(line)\n return outdata", "...
[ "0.78399515", "0.78128076", "0.77822816", "0.77679926", "0.776729", "0.77522475", "0.77522475", "0.77522475", "0.7705741", "0.7676343", "0.75130236", "0.7471396", "0.74597234", "0.7435557", "0.7402026", "0.7391762", "0.7386599", "0.7341365", "0.7288002", "0.7262905", "0.72131...
0.6703767
30
Add the object to the current database session
def new(self, obj): self.__session.add(obj)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(self, obj):\n self.getSession().add(obj)\n self.commit() # paranoially\n return obj", "def add(self, obj):\n self.session.add(obj)", "def add(self, object):\n self.lock.acquire()\n self.__Session.add(object)\n self.__Session.commit(...
[ "0.84632283", "0.8163169", "0.81402755", "0.80503243", "0.80503243", "0.78167", "0.77583957", "0.77583957", "0.7714483", "0.7714483", "0.7658091", "0.7658091", "0.7658091", "0.7658091", "0.76524687", "0.7636913", "0.7588926", "0.7566705", "0.7566705", "0.7566705", "0.7566705"...
0.7876826
7
Creates an instance of the card class.
def mock_card(): return Card(Suit.SPADE, 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def card(self):\r\n return Card(self)", "def card(self):\r\n return Card(self)", "def card(self, card_id):\r\n return Card(self, card_id)", "def make_card(cls, suit, pip):\n return Card(suit, pip)", "def __init__(self, cards):\n self.cards = cards", "def __init__(self):...
[ "0.7959108", "0.7959108", "0.74237317", "0.7355019", "0.7121511", "0.7074987", "0.6937828", "0.69237655", "0.68092966", "0.67770374", "0.6762003", "0.67599535", "0.67185754", "0.6666483", "0.6629821", "0.65835816", "0.65799624", "0.65542614", "0.65262437", "0.6508743", "0.646...
0.6308868
29
Initialize Status instance with default values.
def __init__(self, config): self.config = config self.status = { 'serial':'None', 'timestamp':'None', 'uptime':'None', 'free_disk_space_sdcard':'None', 'free_disk_space_stick':'None', 'wwan_reception':'None', 'log':'None...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self: \"Status\") -> None:\n raise NotImplementedError(\n \"Please instantiate one of the `Status` \"\n \"subclasses:\\n\"\n \"\\n\\t- `Failed`\"\n \"\\n\\t- `NotStarted`\"\n \"\\n\\t- `InProgress(progress)`\"\n \"\\n\\t- `Succee...
[ "0.71189165", "0.6934013", "0.6931037", "0.69235045", "0.684814", "0.6817359", "0.66762745", "0.66749215", "0.6566718", "0.6415941", "0.6402932", "0.6355079", "0.63485444", "0.63140565", "0.62978905", "0.6297153", "0.62918776", "0.6287179", "0.6228762", "0.6210606", "0.619195...
0.61524487
21
Return a new dictionary, like d, but with any string value stripped
def strip_dict(d): return dict((k, v.strip() if hasattr(v, 'strip') else v) for k, v in d.items())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strip_dict(self, inp_d):\r\n inp_d = dict([(k, numpy.complex(inp_d[k]))\r\n for k in inp_d if type(k) == str and\r\n k.isalnum() and\r\n isinstance(inp_d[k], numbers.Number)])\r\n return inp_d", "def remove_em(d: OrderedDict) -> Ord...
[ "0.7371823", "0.72386134", "0.7028661", "0.6819724", "0.6779143", "0.6773956", "0.66447425", "0.65717447", "0.6540621", "0.64549816", "0.64047813", "0.63706195", "0.6346178", "0.6250591", "0.62245697", "0.61995286", "0.6185272", "0.61531425", "0.6130929", "0.61137676", "0.605...
0.7688446
0
Takes an absolute file path and returns only the file name (stripping of all directory information).
def get_basename(absolute_file_path): return absolute_file_path.split('/')[-1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_filename(file_path):\n\n # Get rid of directories and etc\n just_file = os.path.basename(file_path)\n\n # Now we return just the base name\n return os.path.splitext(just_file)[0]", "def extract_file_name(file_path):\n # ファイルパスからファイル名(拡張子含む)を取り出す\n file_name = file_path.split('/')[-1]\n ...
[ "0.8088687", "0.80622214", "0.8035501", "0.7811951", "0.78026396", "0.77992547", "0.7755818", "0.76209706", "0.7608741", "0.7566847", "0.7544392", "0.7532338", "0.75173813", "0.7418168", "0.7390784", "0.73564136", "0.7350524", "0.7331247", "0.73287725", "0.729024", "0.7259834...
0.80317575
3
Returns a random string of Upper case and numeric characters of the given length.
def generate_random_string(length): return ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(length))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_random_string(length: int) -> str:\n # With combination of lower and upper case\n result_str = \"\".join(\n random.choice(string.ascii_letters) for _ in range(length)\n )\n return result_str", "def get_random_string(self, length):\n letters = string.ascii_lowercase\n retu...
[ "0.8574145", "0.8499594", "0.84784347", "0.8434324", "0.84214973", "0.8324547", "0.83172387", "0.8272258", "0.8270285", "0.82682747", "0.82487756", "0.81440544", "0.8141733", "0.81412303", "0.81358176", "0.81286985", "0.81097823", "0.8096998", "0.808642", "0.8083731", "0.8078...
0.852892
1
If there is a hit, uses AI targetting for next coordinate. Otherwise, generate random coordinate This AI takes the coordinate of the first hit, and goes outward in each direction one at a time until it encounters a miss in that direction. It keeps going until all directions hit miss or boundary.
def ai_get_coord(): aim_tries = 0 directions = ['left', 'right', 'up', 'down'] while True: # If there was a hit and not all directions have been exhausted( encounted a miss) if ai_targetting['last_hit_coord'] != "" and check_aim(): coordinate = ai_aimed_coord(directions[ai_target...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def targetpoint(self, initpoint):\n while True:\n col = int(random.uniform(0, COLS))\n row = int(random.uniform(0, ROWS))\n if (row, col) != initpoint:\n break\n return (row, col)", "def make_random_move(self):\n s=set()\n for i in range...
[ "0.63009953", "0.611043", "0.60920197", "0.60589576", "0.6027805", "0.6025457", "0.59975106", "0.59721947", "0.5967654", "0.59441674", "0.5941523", "0.59369344", "0.59369344", "0.5932259", "0.5898686", "0.5886378", "0.58754253", "0.58751", "0.58671", "0.5854305", "0.58387226"...
0.7147442
0
Testing the landing page having the categories form
def test_home(self): resp = self.client.get('/') self.assertTrue('form' in resp.context) self.assertEqual(resp.status_code, 200)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_view_categories(self):\n res = self.client().post('/categories/', data=self.category)\n self.assertEqual(res.status_code, 201)\n res = self.client().get('/categories/')\n self.assertEqual(res.status_code, 200)\n self.assertIn('Stews', str(res.data))", "def test_view_ca...
[ "0.7502253", "0.7471328", "0.72770786", "0.72438437", "0.72304755", "0.7189664", "0.7151104", "0.7095977", "0.704132", "0.70408267", "0.7010419", "0.69687575", "0.6947916", "0.6923749", "0.6893527", "0.6885194", "0.6878934", "0.6788499", "0.678767", "0.6777279", "0.67679816",...
0.5934448
91
Testing the validity of the Categories form on the landing page. Also, tests API call to Eventbrite to get categories of events
def test_valid_form(self): data = {'category': ['103','109'] } form = CategoriesForm(data=data) self.assertTrue(form.is_valid())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_view_categories(self):\n res = self.client().post('/categories/', data=self.category)\n self.assertEqual(res.status_code, 201)\n res = self.client().get('/categories/')\n self.assertEqual(res.status_code, 200)\n self.assertIn('Stews', str(res.data))", "def test_get_cat...
[ "0.74039084", "0.733267", "0.73077506", "0.7272092", "0.7260476", "0.7215514", "0.71662664", "0.71400774", "0.7086933", "0.70860076", "0.7058367", "0.6995042", "0.69379574", "0.6922946", "0.6913031", "0.69091547", "0.68313503", "0.68053377", "0.6800555", "0.6767403", "0.67440...
0.59128165
94
Take a given filename and return the normalized version of it. Where ~/ is expanded to the full OS specific home directory and all relative path elements are resolved.
def normalizeFilename(filename): return os.path.abspath(os.path.expanduser(filename))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _normalized_path(path):\n return os.path.abspath(os.path.expanduser(path))", "def normalize_path(working_dir, filename):\n\n if not os.path.isabs(filename):\n filename = os.path.join(working_dir, filename)\n\n return filename", "def normalize_name(filename):\n filename = os.path.expa...
[ "0.74457467", "0.7408055", "0.72986275", "0.7174307", "0.70112133", "0.6955889", "0.6746083", "0.6674728", "0.660164", "0.65541744", "0.65351176", "0.65298456", "0.65221703", "0.6495173", "0.6483005", "0.6461712", "0.6453468", "0.64261514", "0.6411645", "0.64055103", "0.63702...
0.77120847
0
Test that the endpoints route lists all available endpoints
def test_list_endpoints(self): routes = [ '/', '/npm/<name>', '/nuget/<name>', '/ping', '/ping/npm', '/ping/nuget', '/ping/pypi', '/ping/rubygems', '/pypi/<name>', '/rubygems/<name>', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_list_route_for_all_namespaces(self):\n pass", "def testListEndpoints(self):\n # Register an exporter\n context = self.framework.get_bundle_context()\n exporter = Exporter(context)\n context.register_service(pelix.remote.SERVICE_EXPORT_PROVIDER,\n ...
[ "0.7580558", "0.75524527", "0.73952734", "0.70963556", "0.7005917", "0.6963463", "0.6665037", "0.66130275", "0.65906405", "0.6562715", "0.6556106", "0.6537472", "0.65315896", "0.65152", "0.64932644", "0.6485881", "0.64844257", "0.6470505", "0.63818353", "0.63762695", "0.62854...
0.8348294
0
Convert string into base26 representation where a=0 and z=25.
def base26(w): val = 0 for ch in w.lower(): next_digit = ord(ch) - ord('a') val = 26*val + next_digit return val
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encode(n):\n encode = []\n if n < 0:\n return ''\n while n >= 58:\n remainder = n % 58\n encode.append(LETTERS[remainder])\n n = n / 58\n if n:\n encode.append(LETTERS[n])\n return ''.join(reversed(encode))", "def encode1(s,n):\n r = \"\"\n for l in s:\...
[ "0.6783516", "0.65919346", "0.63928884", "0.63139576", "0.62986946", "0.6236351", "0.6201637", "0.6147975", "0.6125049", "0.6120341", "0.6120341", "0.60831934", "0.6075121", "0.6075121", "0.6075121", "0.6075121", "0.6054871", "0.5999064", "0.5999064", "0.5978415", "0.5975259"...
0.72634697
0
returns True if the two lines are parallel This method tests if two lines are parallel by finding the angle between the perpendicular vector of the first line and the second line. If the dot product between perpVect and the vect of line2 is zero then line1 and line2 are parallel. Farin and Hansford recommend checking w...
def areParallel(self, line): # A vector perpendicular to line1 perpVect = np.array([-self.vector[c.Y], self.vector[c.X]]) # Farin-Hansford eq 3.14 cosTheda = (np.dot(perpVect, line.vector)/ (np.linalg.norm(perpVect)*np.linalg.norm(line.vector))) # if cosTheda ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def coplanar_points_are_on_same_side_of_line(a, b, p1, p2):\n check_shape_any(a, (3,), (-1, 3), name=\"a\")\n vg.shape.check(locals(), \"b\", a.shape)\n vg.shape.check(locals(), \"p1\", a.shape)\n vg.shape.check(locals(), \"p2\", a.shape)\n\n # Uses \"same-side technique\" from http://blackpawn.com/...
[ "0.6761651", "0.6409711", "0.6385129", "0.63298166", "0.63047385", "0.62770724", "0.62302876", "0.62062806", "0.6201033", "0.6155257", "0.6117889", "0.60754585", "0.6064054", "0.6054145", "0.6013601", "0.6009256", "0.5970284", "0.5970284", "0.59610635", "0.59599835", "0.59556...
0.80515516
0
Tests to see if a point is on the line.
def isOnLine(self, point): if((point < self.start and point < self.end) or ( point > self.start and point > self.end)): return False #point is not between the start and end of self if(self.getArea(self.start, self.end, point) > c.EPSILON): return False #point...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def point_on_line(point:tuple, line:tuple, d_y:float, d_x:float, b:float)->bool:\n if not near_segment(point, line):\n # Fast fail to handle cases where the point isn't in the bounding rectangle of the line segment.\n return False\n if b == None and point[0] == line[0][0]:\n return True\...
[ "0.7951045", "0.79323596", "0.7887562", "0.7825015", "0.7740387", "0.75868034", "0.7570696", "0.750717", "0.74718523", "0.74269235", "0.7418471", "0.7328994", "0.7324058", "0.72643554", "0.7242127", "0.71990955", "0.6978171", "0.68723476", "0.68723476", "0.6869415", "0.686588...
0.83987504
0
Uses the determinant of a matrix containing the three to find the area of the triangle formed by the three points.
def getArea(self, p1, p2, p3): matrix = [p1.normalVector, p2.normalVector, p3.normalVector, [1,1,1,1]] matrix = np.rot90(matrix) return abs(np.linalg.det(matrix))/2.0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _triangle_area_at_points(self, p1, p2, p3):\n a = sqrt((p1[0] - p2[0]) ** 2 + (p1[1] - p2[1]) ** 2)\n b = sqrt((p2[0] - p3[0]) ** 2 + (p2[1] - p3[1]) ** 2)\n c = sqrt((p1[0] - p3[0]) ** 2 + (p1[1] - p3[1]) ** 2)\n s = (a + b + c) / float(2)\n area = sqrt(s * (s - a) * (s - b)...
[ "0.72334784", "0.7186592", "0.71641284", "0.70531", "0.68716633", "0.68582284", "0.68390244", "0.6835778", "0.68248683", "0.6807106", "0.67215294", "0.6660411", "0.6558524", "0.6556429", "0.64930767", "0.6468867", "0.64372075", "0.63936585", "0.63108045", "0.6300739", "0.6211...
0.6936992
4
returns a line with the start and end points flipped form self.
def fliped(self): return Line(self.end, self.start, self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reversed(self):\n return LINE(*self.elems,**{'reverse':(not self.reverse)})", "def revert(self):\n reverted = Line(l=self)\n reverted.direction *= -1.0\n return reverted", "def _inverse_lines(self):\n pass", "def reverse(self):\n x = self._x * -1\n y = sel...
[ "0.69320935", "0.68377566", "0.6696487", "0.66876197", "0.6644953", "0.6519105", "0.6501204", "0.6462024", "0.6427982", "0.6335366", "0.6301148", "0.615522", "0.6074712", "0.6061257", "0.60537267", "0.603382", "0.6020667", "0.5955463", "0.59493715", "0.5907887", "0.5896952", ...
0.8431879
0
If the start point and end point of the two lines are the same then the lines are equal. Note that this means that self != flipped(self). I don't know if that is necessary but that hasn't caused me any problems... yet.
def __eq__(self, other): return (self.start == other.start and self.end == other.end)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return (type(self) is type(other) and\n self.line == other.line and\n self.line_num == other.line_num and\n six.text_type(self) == six.text_type(other))", "def __eq__(self, other):\n if not isinstance(other, Line):\n ...
[ "0.6572204", "0.64023584", "0.63870186", "0.6306835", "0.61787945", "0.61564523", "0.6151873", "0.6147044", "0.6125139", "0.60961527", "0.6094624", "0.60558796", "0.60261655", "0.5989863", "0.59831953", "0.5979767", "0.5960016", "0.5960016", "0.5929494", "0.59234804", "0.5913...
0.6220436
4
Creates a server and remove the testing db if exists
def server(): server = client.Server(host=host, auth=auth) try: server.delete_db(test_db_name) except excepts.DBNotExists: pass return server
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_exists(server):\n\n db = server.create_db(test_db_name)\n assert test_db_name in server\n assert db in server\n assert server[test_db_name]\n server.delete_db(db)\n assert test_db_name not in server", "def test_create_delete_db(server):\n\n db = server.create_db(test_db_name)\n\n ...
[ "0.7734355", "0.7028195", "0.66999996", "0.6528318", "0.6528039", "0.6512039", "0.65053254", "0.6431582", "0.6386555", "0.6330555", "0.6292679", "0.62630886", "0.623853", "0.6238234", "0.6195964", "0.6191252", "0.6173235", "0.61354697", "0.6126808", "0.6091517", "0.60588837",...
0.7994085
0
Creates a classification model.
def create_model(max_seq_len, adapter_size=64): # adapter_size = 64 # see - arXiv:1902.00751 # create the bert layer with tf.io.gfile.GFile(bert_config_file, "r") as reader: bc = StockBertConfig.from_json_string(reader.read()) bert_params = map_stock_config_to_params(bc) bert_para...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_model(self):\n self.classifier = DecisionTreeClassifier(max_depth=1)", "def create_model(self, C : float =1):\n self.classifier = RandomForestClassifier(max_depth=5)", "def create_model():\n\n # Create a sequential model (a simple NN is created) adding a softmax activation at the en...
[ "0.7451048", "0.716728", "0.70753753", "0.69427526", "0.69337225", "0.69306064", "0.6929345", "0.68631464", "0.68004555", "0.6769279", "0.6737084", "0.66838384", "0.66709864", "0.660953", "0.65912193", "0.6564333", "0.6534873", "0.6526978", "0.6525293", "0.6521778", "0.651739...
0.0
-1
Get a list of the nodes currently contained in the graph.
def nodes(self): return self._nodes
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_node_list(self):\n return [[node] for node in self.graph.nodes]", "def get_nodes(self):\n\n return list(self.graph.nodes)", "def nodes(self):\n return list(self.__graph.keys())", "def nodes(self):\n nodes = list()\n for node in self._nodes:\n if isinstanc...
[ "0.8687766", "0.8656459", "0.83660626", "0.8304205", "0.8251637", "0.82475966", "0.82475966", "0.8222444", "0.82217216", "0.8189093", "0.8129993", "0.8051035", "0.80475503", "0.8025214", "0.80017066", "0.79846066", "0.79206234", "0.7882176", "0.78589", "0.78210354", "0.779916...
0.791188
18
Add edges to the graph (nodes should be already set).
def edges(self, edges): if edges: edges = ensure_list(edges) for (nd_out, nd_in) in edges: if nd_out not in self.nodes or nd_in not in self.nodes: raise Exception( f"edge {(nd_out, nd_in)} can't be added to the graph" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addEdges(self, edges):\n for edge in edges:\n self.addEdge(edge[0], edge[1], edge[2])", "def add_edges_from(self, edges: Iterable):\n for i, j in edges:\n self.add_edge(i, j)", "def add_edges(self, edges):\n if self.is_weighted():\n for vertex1, vertex2, weight ...
[ "0.8346678", "0.80433065", "0.79015255", "0.76325476", "0.7568429", "0.7457783", "0.7395212", "0.72679406", "0.7253225", "0.7198172", "0.7188471", "0.71735394", "0.71731913", "0.71445286", "0.7110158", "0.7100186", "0.70861846", "0.7080048", "0.70712894", "0.7063997", "0.7053...
0.7636876
3
Get edges as pairs of the nodes they connect.
def edges_names(self): return [(edg[0].name, edg[1].name) for edg in self._edges]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_pairs(self):\n return chain(self.nx_graph.edges(), nx.non_edges(self.nx_graph))", "def generate_edges(self):\n edges = []\n for vertex in self.graph_dict:\n for neighbour in self.graph_dict[vertex]:\n if (neighbour, vertex) not in edges:\n ...
[ "0.7654879", "0.74958074", "0.74224085", "0.73934007", "0.73183304", "0.7295909", "0.7190719", "0.71783423", "0.71693146", "0.7151082", "0.71239746", "0.70717496", "0.70563245", "0.7034443", "0.7007451", "0.6886851", "0.68839455", "0.68777627", "0.6865281", "0.6856478", "0.68...
0.61759543
59
Read dword from IDB
def get_dword(self, offset): self.ret = ida_bytes.get_dword(offset) return self.ret
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unpack_dword(self, offset):\n return struct.unpack_from(str(\"<I\"), self._buf, self._offset + offset)[0]", "def getDbInt(self, db, key):\n return int(self.getDbStr(db, key))", "def getInt(self, addr: ghidra.program.model.address.Address, bigEndian: bool) -> int:\n ...", "def is_dwor...
[ "0.68306047", "0.6513913", "0.6102496", "0.60322803", "0.5974714", "0.5973808", "0.5904012", "0.5901331", "0.58901477", "0.58243495", "0.581299", "0.5759988", "0.5758021", "0.5686244", "0.56856036", "0.56844217", "0.5642868", "0.55930585", "0.55779475", "0.556425", "0.5554248...
0.6909299
0