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 |
|---|---|---|---|---|---|---|
Loads the weights of a model saved via `save_all_weights`. If model has been compiled, optionally load its optimizer's weights. Arguments | def load_all_weights(model, filepath, include_optimizer=True):
if h5py is None:
raise ImportError('`load_all_weights` requires h5py.')
with h5py.File(filepath, mode='r') as f:
# set weights
saving.load_weights_from_hdf5_group(f['model_weights'], model.layers)
# Set optimizer wei... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_model_weights(self):\n raise NotImplementedError",
"def get_weights(model):\n args = get_args()\n if args.weight is not None:\n model.load_weights(args.weight)",
"def load_weights(\n cls, model: Module, load_dir: Path, use_best_model: bool\n ) -> None:\n load_dir =... | [
"0.71827525",
"0.7035717",
"0.6961078",
"0.6786088",
"0.6694024",
"0.6690793",
"0.6664305",
"0.6658913",
"0.6652637",
"0.66178703",
"0.6617485",
"0.6614036",
"0.6604881",
"0.6589531",
"0.6574596",
"0.64939505",
"0.64369345",
"0.64238876",
"0.63786536",
"0.6367659",
"0.6346446... | 0.6977103 | 2 |
Validate a target_humidity range configuration, throws otherwise. | def valid_humidity_range_configuration(config: ConfigType) -> ConfigType:
if config[CONF_HUMIDITY_MIN] >= config[CONF_HUMIDITY_MAX]:
raise ValueError("target_humidity_max must be > target_humidity_min")
if config[CONF_HUMIDITY_MAX] > 100:
raise ValueError("max_humidity must be <= 100")
retu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def set_target_humidity(self, humidity):\n\n range_info = self._get_humidity_range()\n if range_info and not (range_info[0] <= humidity <= range_info[1]):\n raise ValueError(f\"Target humidity out of range: {humidity}\")\n keys = self._get_cmd_keys(CMD_STATE_TARGET_HUM)\n ... | [
"0.6406281",
"0.6342812",
"0.61929923",
"0.6178911",
"0.6154766",
"0.6011239",
"0.5900733",
"0.5748182",
"0.56038094",
"0.56013745",
"0.55817133",
"0.55508643",
"0.5546251",
"0.5524681",
"0.551215",
"0.54124975",
"0.5407183",
"0.5358275",
"0.5348189",
"0.5345972",
"0.5306307"... | 0.81445456 | 0 |
Initializes an instace of 'Exp3MixtureVariableCollection'. | def __init__(
self,
num_agents: int,
reward_aggregates: Optional[List[float]] = None,
inverse_temperature: float = 0.0,
):
if reward_aggregates is None:
reward_aggregates = [0.0] * num_agents
else:
if num_agents != len(reward_aggregates):
raise ValueError('`reward_a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(\n self,\n agents: List[tf_agent.TFAgent],\n variable_collection: Optional[Exp3MixtureVariableCollection] = None,\n forgetting: float = 0.999,\n max_inverse_temperature: float = 1000.0,\n name: Optional[Text] = None,\n ):\n self._num_agents = len(agents)\n self._fo... | [
"0.6288496",
"0.5976373",
"0.57256603",
"0.5591426",
"0.5497776",
"0.54606354",
"0.54355115",
"0.5426243",
"0.54162335",
"0.5343361",
"0.53160506",
"0.5312451",
"0.53009105",
"0.5281349",
"0.5275678",
"0.52354765",
"0.52215904",
"0.5201788",
"0.51727796",
"0.51576227",
"0.514... | 0.0 | -1 |
Initializes an instance of `Exp3MixtureAgent`. | def __init__(
self,
agents: List[tf_agent.TFAgent],
variable_collection: Optional[Exp3MixtureVariableCollection] = None,
forgetting: float = 0.999,
max_inverse_temperature: float = 1000.0,
name: Optional[Text] = None,
):
self._num_agents = len(agents)
self._forgetting = for... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, fluid, mixture, temperature, pressure, length, annulusdiameter, massflow, pressuredrop): \n self.fluid = thermo.Mixture(fluid, ws=mixture, T=temperature, P=pressure)\n self.annulusdiameter = annulusdiameter \n self.length = length\n self.massflow = massflow\n ... | [
"0.6062485",
"0.59127146",
"0.5899096",
"0.5888484",
"0.58651596",
"0.58574635",
"0.58246076",
"0.57218796",
"0.5681571",
"0.56594545",
"0.5637986",
"0.55879676",
"0.55778426",
"0.5576884",
"0.5571129",
"0.55637074",
"0.55512244",
"0.5544037",
"0.55395526",
"0.55393296",
"0.5... | 0.65384245 | 0 |
The event timestamp is represented in metastock 7 using a YYYYMMDDhhmm format. | def get_event_timestamp(self, event_payload: dict):
timestamp_str = str(event_payload[METASTOCK_EVENT_TIMESTAMP_KEY])
return datetime(year=int(timestamp_str[0:4]), month=int(timestamp_str[4:6]), day=int(timestamp_str[6:8]),
hour=int(timestamp_str[8:10]), minute=int(timestamp_str[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timestamp(self) -> str:\n return self._event.get('timestamp')",
"def _get_timestamp() -> str:\n\n dt = timezone(\"UTC\").localize(datetime.utcnow()).strftime(\"%b. %d, %Y#%H:%M UTC\")\n date, time = dt.split(\"#\")\n return f\"Event Timestamp: 📅 {date} 🕒 {time}\"",
"def times... | [
"0.71360266",
"0.6950136",
"0.6747642",
"0.6545169",
"0.6498417",
"0.64971715",
"0.64114845",
"0.6402434",
"0.63876575",
"0.63400596",
"0.63132334",
"0.6301463",
"0.6293203",
"0.6262489",
"0.625643",
"0.6253213",
"0.62521493",
"0.62120175",
"0.6205004",
"0.62043005",
"0.62022... | 0.7207731 | 0 |
Return current hvac action. | def hvac_action(self) -> HVACAction:
return HVACAction.HEATING if self._thermostat.is_heating else HVACAction.IDLE | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hvac_action(self) -> HVACAction | None:\n return self._hvac_action",
"def hvac_action(self):\n if self._hvac_mode == HVAC_MODE_OFF:\n return CURRENT_HVAC_OFF\n elif self._hvac_mode == HVAC_MODE_HEAT:\n return CURRENT_HVAC_HEAT\n elif self._hvac_mode == HVAC_M... | [
"0.8310278",
"0.8045929",
"0.8021468",
"0.7824198",
"0.7820939",
"0.7802573",
"0.7635632",
"0.76255465",
"0.7286594",
"0.7279279",
"0.68614507",
"0.67381793",
"0.66946393",
"0.66946393",
"0.66946393",
"0.66920906",
"0.6524985",
"0.64881814",
"0.64881814",
"0.64881814",
"0.648... | 0.7433832 | 8 |
>>> vec_product([1, 2, 3], [4, 5, 6]) 32 | def vec_product(vec1: List[int], vec2: List[int]) -> int:
return sum(map(lambda v1, v2: v1 * v2, vec1, vec2)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def product(*nums):\n\treturn reduce((lambda x, y: x * y), nums)",
"def multV(lists) -> list:\r\n return list(np.prod(lists, 0))",
"def _product(shape):\n result = 1\n for size in shape:\n result *= size\n return result",
"def _product(self, args):\n pools = map(tuple, args) #within... | [
"0.7417019",
"0.71447784",
"0.71366143",
"0.71293384",
"0.71156013",
"0.71156013",
"0.71156013",
"0.7099575",
"0.7099299",
"0.70821774",
"0.70740336",
"0.7070916",
"0.7060519",
"0.70551413",
"0.7042448",
"0.6994226",
"0.69603896",
"0.6951697",
"0.6946093",
"0.6924545",
"0.690... | 0.80642724 | 0 |
Returns the minimum and maximum values in a ragged array y. If the number of events is zero, returns (None, None) | def range(x):
try:
return (min(min(y) for y in x), max(max(y) for y in x))
except ValueError:
return (None, None) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def MaxToMin(min_lev, max_lev, datetime_maxes):\r\n y_res_mins = []\r\n deltaT_ranges = []\r\n for row in range(len(max_lev)-1):\r\n range_length = (datetime_maxes.iloc[row+1]-datetime_maxes.iloc[row]).seconds/3600 # hours\r\n if ~np.isnan(max_lev.iloc[row]) & (range_length>=3.5) & (range_le... | [
"0.641512",
"0.6336447",
"0.6288782",
"0.6276895",
"0.6233338",
"0.6221433",
"0.6162136",
"0.6151743",
"0.608986",
"0.60864186",
"0.6038165",
"0.6033484",
"0.6024235",
"0.60140955",
"0.592754",
"0.5923475",
"0.5913607",
"0.5904614",
"0.589682",
"0.58946145",
"0.5891196",
"0... | 0.0 | -1 |
Returns whether or not n is an emirp number. Emirps are primes whose reversal is a different prime | def is_emirp(n) -> bool:
if not is_prime(n):
return False
if not is_palindromic_number(n):
return is_prime(int(str(n)[::-1]))
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_prime(n):\n return mr_prime(n)",
"def if_prime(cls, n):\n\n if (n <= 1):\n return False\n if (n <= 3):\n return True\n\n if (n % 2 == 0 or n % 3 == 0):\n return False\n\n i = 5\n while(i * i <= n):\n if (n % i == 0 or n % (i... | [
"0.65931886",
"0.6445867",
"0.6400798",
"0.63895756",
"0.63267267",
"0.6311664",
"0.6246473",
"0.62460643",
"0.62441254",
"0.6218321",
"0.6216126",
"0.61661834",
"0.6137319",
"0.6133815",
"0.61190426",
"0.6114652",
"0.610161",
"0.60900074",
"0.6087166",
"0.6087166",
"0.606543... | 0.87985057 | 0 |
Create configuration for logger and change the default format that it uses. | def configure(cls):
logger = logging.getLogger()
logger.setLevel(logging.INFO)
logger_handler = logging.StreamHandler()
logger.addHandler(logger_handler)
logger_handler.setFormatter(logging.Formatter('%(message)s'))
cls.logger = logger | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_logger_creator(config):\n cfg = config[\"logger_config\"].copy()\n cls = cfg.pop(\"type\")\n # Provide default for logdir, in case the user does\n # not specify this in the \"logger_config\" dict.\n logdir_ =... | [
"0.6878788",
"0.6861924",
"0.66452044",
"0.66192836",
"0.65917665",
"0.6459856",
"0.64424056",
"0.6431782",
"0.64271367",
"0.64033335",
"0.6366231",
"0.6342275",
"0.63228226",
"0.63041747",
"0.6285166",
"0.6284129",
"0.62788993",
"0.6273831",
"0.625271",
"0.62485033",
"0.6238... | 0.6325082 | 12 |
Return y coordinate of the horizontal baseline. | def baseline(self):
if getattr(self, "_baseline", None) is None:
self._baseline = (self.container.height - 1) / 2
return self._baseline | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def baseline(self):\n return self.data[self.data['treatment'] == 'Baseline']",
"def y(self):\n return self.top",
"def height(self):\n return self.y.max() - self.y.min()",
"def calculate_height(self):\n return self.endY - self.startY",
"def yintercept(self):\n if self.slop... | [
"0.7127357",
"0.6703656",
"0.6684755",
"0.6663422",
"0.66573113",
"0.6647851",
"0.6576255",
"0.65520674",
"0.6515756",
"0.65074015",
"0.64597344",
"0.63976747",
"0.6331879",
"0.6321973",
"0.63064444",
"0.63030744",
"0.6293816",
"0.6258196",
"0.6255625",
"0.6249037",
"0.623633... | 0.7736031 | 0 |
Returns list of coordinates where grid lines intersect in format [(x, y), ...] Grid always has same number of vertical and horizontal columns. There has to be at least 2px margin between grid lines. | def item_coordinates(self, num_items):
num_columns = min([num_items + 1, Item.MIN_SIDE_SIZE])
column_width = self.container.width / num_columns
column_height = self.container.height / num_columns
points = []
for x in range(0, num_items):
for y in range(0, num_items):... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def box_line_coords(self):\n not_visited = set()\n for shape in self.shapes:\n for r, c in shape:\n # get points next to the numbers in one shape\n # and check which of them are inside the same shape too\n neighbors = [(r-1, c), (r+1, c), (r, c-1), (r, c+1)]\n for next_r, nex... | [
"0.65707356",
"0.6480723",
"0.6480299",
"0.6477887",
"0.6449248",
"0.63175213",
"0.6316722",
"0.6213611",
"0.62059736",
"0.61320084",
"0.609344",
"0.6081877",
"0.60762864",
"0.60392",
"0.602845",
"0.5984818",
"0.5975197",
"0.59404844",
"0.5929577",
"0.59124696",
"0.58542824",... | 0.6541232 | 1 |
Class initialization input_dim = input dimension output_dim = output dimension hidden_dims = dimension for hidden layers activation_fc = activation function out_activation_fc = Output activation function device = processing device | def __init__(self,
input_dim,
action_bounds,
out_activation_fc=F.tanh):
super(FCDP, self).__init__()
# TODO: Choose a non-linear activation function from https://pytorch.org/docs/stable/nn.html#non-linear-activations-weighted-sum-nonlinearity
a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(\n self,\n *,\n input_dim: int,\n hidden_layer_dims: List[int],\n hidden_layer_use_layernorm: bool = False,\n hidden_layer_use_bias: bool = True,\n hidden_layer_activation: Optional[Union[str, Callable]] = \"relu\",\n output_dim: Optional[int] = ... | [
"0.7247358",
"0.7166647",
"0.70988506",
"0.7083156",
"0.7055402",
"0.7030333",
"0.69688517",
"0.69670403",
"0.68650204",
"0.68477833",
"0.684689",
"0.6802445",
"0.6801052",
"0.6765905",
"0.675019",
"0.67494345",
"0.67324185",
"0.67299944",
"0.6725459",
"0.67239267",
"0.671873... | 0.7020841 | 6 |
creates an object from json | def load_from_json_file(filename):
with open(filename, 'r') as f:
json_string = json.load(f)
return json_string | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fromJson(json):\r\n raise NotImplementedError(\"Returns instance\")",
"def from_json(cls, b):\n return cls.from_dict(json.loads(b))",
"def fromJson(cls, inJson):\n\n return cls.fromDict(json.loads(inJson))",
"def fromJson(cls, inJson):\n\n return cls.fromDict(json.loads(inJson... | [
"0.7893492",
"0.7465262",
"0.7400017",
"0.7400017",
"0.7400017",
"0.72509503",
"0.7231897",
"0.7231187",
"0.7231187",
"0.7229368",
"0.7165902",
"0.71358436",
"0.70889235",
"0.706515",
"0.705552",
"0.7022349",
"0.7003687",
"0.69858325",
"0.6903389",
"0.6894128",
"0.6860281",
... | 0.0 | -1 |
creates a new Date object. If the dateString is supplied, it should | def __init__(self, dateString=None, isInterval=False, totalSeconds=None,
years=None, months=None, days=None,
hours=None, minutes=None, seconds=None):
self.isInterval = isInterval
if dateString is not None:
self._parseDate(dateString)
elif totalSecon... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fromString(self, QString, *__args): # real signature unknown; restored from __doc__ with multiple overloads\r\n return QDate",
"def from_date_string(cls, date_string: str):\n date_lst = [int(ele) for ele in date_string.split('/')]\n return CustomDate.from_date(date(date_lst[2], date_lst[... | [
"0.71286577",
"0.7009549",
"0.6897649",
"0.6871406",
"0.6825654",
"0.67616767",
"0.67494744",
"0.67461395",
"0.6595119",
"0.6562857",
"0.6499838",
"0.6476588",
"0.64519674",
"0.64399654",
"0.6362248",
"0.63430876",
"0.6244193",
"0.62367404",
"0.6231546",
"0.6225175",
"0.62067... | 0.0 | -1 |
Specifies the number of days to keep in the audit logs. | def retention_days(self) -> Optional[int]:
return pulumi.get(self, "retention_days") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transaction_log_retention_days(self) -> int:\n return pulumi.get(self, \"transaction_log_retention_days\")",
"def retention_days(self) -> Optional[pulumi.Input[int]]:\n return pulumi.get(self, \"retention_days\")",
"def soft_delete_retention_days(self) -> int:\n return pulumi.get(self,... | [
"0.6576259",
"0.6521634",
"0.64819294",
"0.63760763",
"0.63663083",
"0.6189113",
"0.6175019",
"0.61285347",
"0.5889035",
"0.5889035",
"0.58348525",
"0.57844746",
"0.57233083",
"0.56506574",
"0.557735",
"0.5493899",
"0.5450452",
"0.53428024",
"0.5334406",
"0.5332594",
"0.53104... | 0.6608715 | 0 |
Constructor. Initializes internal dictionaries to make later lookup faster. | def __init__(self):
self.vowels = u'あいうえお'
self.consonants = u'かがさざただまはばぱなら'
self.voiced_consonants = set(u'がだざびぴじばぱ')
self._table = {
u'あ': u'あいうえお',
u'か': u'かきくけこ',
u'が': u'がぎぐげご',
u'さ': u'さしすせそ',
u'ざ': u'ざじずぜぞ',
u... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self._map = {}",
"def __init__(self):\n self.hashmap = {}",
"def __init__(self):\n self.hashmap = {}",
"def __init__(self):\n self.hash_map = {}",
"def __init__(self):\n self.map = {}",
"def __init__(self, *args, **kwargs):\n dict.__init__(s... | [
"0.7743379",
"0.75783795",
"0.75783795",
"0.7503311",
"0.7453127",
"0.7440012",
"0.740139",
"0.73622656",
"0.7352791",
"0.7352791",
"0.73443484",
"0.7308993",
"0.72946274",
"0.72946274",
"0.72849256",
"0.7276469",
"0.7270722",
"0.72025895",
"0.7161641",
"0.7160133",
"0.715189... | 0.0 | -1 |
Perform H_l composite function for the layer and after concatenate input with output from composite function. | def add_internal_layer(self, _input, growth_rate):
lgc_out = self.learn_group_cov(_input, out_features=growth_rate*self.bottleneck, groups=self.group_1x1)
comp_out = self.standard_group_cov(lgc_out, out_features=growth_rate*self.bottleneck, kernel_size=3, groups=self.group_3x3)
# concatenate _in... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_internal_layer(_input, growth_rate, is_training, bc_mode=True):\n # call composite function with 3x3 kernel\n comp_out = None\n if not bc_mode:\n comp_out = composite_function(_input, out_features=growth_rate, kernel_size=3, is_training=is_training)\n elif bc_mode:\n bottleneck_ou... | [
"0.62747335",
"0.60684955",
"0.59325415",
"0.58224154",
"0.56973815",
"0.536632",
"0.5276962",
"0.52339405",
"0.52294135",
"0.51829046",
"0.5181456",
"0.51757383",
"0.51683176",
"0.51146525",
"0.50792825",
"0.5078312",
"0.5051692",
"0.5041233",
"0.50348115",
"0.5026185",
"0.5... | 0.5862651 | 3 |
Get absolute path to resource, works for dev and for PyInstaller | def resource_path(relative_path):
if hasattr(sys, '_MEIPASS'):
return os.path.join(sys._MEIPASS, "TopasGraphSim", relative_path)
return os.path.join(os.path.dirname(os.path.abspath(__file__)), os.pardir, os.pardir, os.pardir, relative_path) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_resource_path():\n return os.path.join(os.path.dirname(__file__), \"resources\") + os.path.sep",
"def resourcePath(relative):\r\n try:\r\n # PyInstaller creates a temp folder and stores path in _MEIPASS\r\n base_path = sys._MEIPASS\r\n except Exception:\r\n base_path = os.pa... | [
"0.8369666",
"0.82807267",
"0.8248764",
"0.81394184",
"0.81140023",
"0.8098792",
"0.80942446",
"0.80799985",
"0.8067907",
"0.80675864",
"0.8062711",
"0.8062711",
"0.8062711",
"0.8062711",
"0.8062711",
"0.8062711",
"0.8062711",
"0.8057206",
"0.80547804",
"0.80450505",
"0.80450... | 0.698283 | 82 |
Predict the strftime format from the given date_string. | def date_string_to_strftime_format(date_string):
for data in STRF_DATA:
for pattern in data.get('patterns', []):
if pattern in date_string:
date_string = date_string.replace(pattern, data['replacement'])
break
else:
if data.get('regex'):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _dateFmt(self, string):\n return time.strftime('%m/%d', time.strptime(string, '%B %d, %Y'))",
"def date_format(date_str):\r\n return date_str.replace(\"/\", \"_\")",
"def reformat_date(mdy_date_string):\n date = mdy_date_string.split('/')\n return f\"{date[2]}-{date[0]}-{date[1]}\" # diffic... | [
"0.7382009",
"0.66797495",
"0.65780437",
"0.6483879",
"0.6472791",
"0.64023346",
"0.63927376",
"0.63617575",
"0.62710834",
"0.6270469",
"0.6213916",
"0.612308",
"0.6119515",
"0.60871124",
"0.604963",
"0.60302734",
"0.6000998",
"0.59840924",
"0.59442866",
"0.59286183",
"0.5923... | 0.7572847 | 0 |
Get the current date. If convert_to_current_timezone is True, convert the date to the current timezone. If utc is True, convert the date to UTC. | def date_now(*, convert_to_current_timezone: bool = False, utc: bool = False):
now = datetime.datetime.now()
if convert_to_current_timezone:
now = date_make_timezone_aware(now)
if utc:
now = date_to_utc(now)
return now | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_local_date(self):\n tz = pytz.timezone(self.timezone)\n utc = pytz.utc\n utc_now = datetime.datetime.now(utc)\n return utc_now.astimezone(tz).date()",
"def now(self):\n if 'timezone' in self._data:\n return pytz.utc.localize(datetime.datetime.utcnow()).astime... | [
"0.6531101",
"0.6404187",
"0.6164619",
"0.6105284",
"0.6072704",
"0.606329",
"0.60616755",
"0.6049469",
"0.60355145",
"0.5977262",
"0.59162307",
"0.5909832",
"0.5815209",
"0.57911843",
"0.5770375",
"0.5768924",
"0.5737256",
"0.57113916",
"0.57113916",
"0.5643789",
"0.5633298"... | 0.78468484 | 0 |
Find the hour from the given date. | def date_hour(date):
return date.hour | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date_in_hours(date):\n delta = delta_from_now(date)\n return (delta.days * 24) + delta.seconds / (60 * 60)",
"def getHour(self):\n return _libsbml.Date_getHour(self)",
"def get_hour(date, padded_or_unpadded):\n if padded_or_unpadded == constants.str_padded:\n return date.strftime('%H... | [
"0.6811137",
"0.6775446",
"0.6659876",
"0.66178787",
"0.6439191",
"0.6433296",
"0.6433296",
"0.6433296",
"0.6291825",
"0.6291825",
"0.6205004",
"0.615318",
"0.6144629",
"0.6142751",
"0.61079955",
"0.60777724",
"0.60492986",
"0.5971252",
"0.59621704",
"0.5952844",
"0.58551717"... | 0.83104855 | 0 |
Find the day of the month from the given date. | def date_day(date):
return date_day_of_month(date) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date_day_of_month(date):\n return date.day",
"def day_of_month():\n return datetime.date.today().day",
"def day_of_month(self) -> pulumi.Input[int]:\n return pulumi.get(self, \"day_of_month\")",
"def day_of_month(self) -> pulumi.Input[int]:\n return pulumi.get(self, \"day_of_month\")"... | [
"0.8764477",
"0.7861314",
"0.7271487",
"0.7271487",
"0.7193178",
"0.7193178",
"0.705001",
"0.69759333",
"0.69259244",
"0.6831275",
"0.6793445",
"0.6781188",
"0.6749309",
"0.67333364",
"0.67252916",
"0.65796417",
"0.6477361",
"0.64690834",
"0.6335359",
"0.6326938",
"0.6326938"... | 0.8524309 | 1 |
Find the day of the month from the given date. | def date_day_of_month(date):
return date.day | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date_day(date):\n return date_day_of_month(date)",
"def day_of_month():\n return datetime.date.today().day",
"def day_of_month(self) -> pulumi.Input[int]:\n return pulumi.get(self, \"day_of_month\")",
"def day_of_month(self) -> pulumi.Input[int]:\n return pulumi.get(self, \"day_of_mon... | [
"0.8524309",
"0.7861314",
"0.7271487",
"0.7271487",
"0.7193178",
"0.7193178",
"0.705001",
"0.69759333",
"0.69259244",
"0.6831275",
"0.6793445",
"0.6781188",
"0.6749309",
"0.67333364",
"0.67252916",
"0.65796417",
"0.6477361",
"0.64690834",
"0.6335359",
"0.6326938",
"0.6326938"... | 0.8764477 | 0 |
Find the month from the given date. | def date_month(date):
return date.month | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def MONTH(date):\n return _make_datetime(date).month",
"def date_to_month(date):\r\n return re.sub(r'(\\d{4}-\\d{2})-\\d{2}', r'\\1', date)",
"def get_month_from_date(raw_format_date):\n date = None\n for pattern in NAMCS_DATASET_MONTH_PATTERNS:\n try:\n date = datetime.strptime(raw... | [
"0.81288993",
"0.73240244",
"0.7312248",
"0.7088284",
"0.70758754",
"0.69653225",
"0.6956546",
"0.67867476",
"0.6770171",
"0.6624447",
"0.6590804",
"0.6590804",
"0.6530026",
"0.6527469",
"0.6497475",
"0.64222634",
"0.6422084",
"0.6381604",
"0.63628453",
"0.6355428",
"0.634773... | 0.80149245 | 1 |
Make the given datetime_object timezone aware. This function does NOT convert the datetime_object. It will never change the hour/day or any value of the datetime... it will simply make the given datetime timezone aware. | def date_make_timezone_aware(datetime_object, timezone_string=None):
if timezone_string:
# make the date timezone aware using the given timezone_string
timezone_object = pytz_timezone_object(timezone_string)
timezone_aware_datetime_object = timezone_object.localize(datetime_object)
else:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def correct_dt_dst(datetime_obj):\n\n # https://en.wikipedia.org/wiki/Tz_database\n # https://www.iana.org/time-zones\n\n if datetime_obj.tzinfo is None:\n return datetime_obj\n\n # Create and return a New datetime object. This corrects the DST if errors are present.\n return dt(datetime_obj.... | [
"0.6941686",
"0.69341797",
"0.68531203",
"0.66651887",
"0.6656472",
"0.64684296",
"0.6465756",
"0.6457547",
"0.64099145",
"0.6389224",
"0.6313481",
"0.6284271",
"0.6252805",
"0.62247103",
"0.6202643",
"0.6179601",
"0.61405265",
"0.6031556",
"0.6012167",
"0.5956758",
"0.592196... | 0.8005339 | 0 |
Convert the given date to UTC. Assume that the given date is in the system's timezone and convert it to UTC. | def date_to_utc(date):
utc_date = date_convert_to_timezone(date, 'utc')
return utc_date | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date_to_utc(self, date):\n if date.tzinfo is not None:\n # date is timezone-aware\n date = date.astimezone(self.tz_utc)\n\n else:\n # date is a naive date: assume expressed in local time\n date = date.replace(tzinfo=self.tz_local)\n # and con... | [
"0.8517464",
"0.769484",
"0.72369564",
"0.7217169",
"0.7217169",
"0.71931946",
"0.7175732",
"0.7107694",
"0.700313",
"0.6979193",
"0.67240065",
"0.67240065",
"0.67240065",
"0.6646305",
"0.66185784",
"0.6598447",
"0.64771813",
"0.64220923",
"0.64044327",
"0.6349706",
"0.634904... | 0.80580527 | 1 |
Test the check_reset_variant_classification controller Assume we are in the situation when it will trigger to clear classifications, and make sure it does clear the classification. | def test_check_reset_variant_classification(app, case_obj, variant_obj):
# GIVEN an app with a current user
with app.test_client() as client:
client.get(url_for("auto_login"))
# GIVEN a variant classified according to ACMG
assert store.variant_collection.find_one_and_update(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_reset_training_set():\n classifier = classifier_module.Classifier(None)\n classifier.reset_training_set(117, \"a\")\n assert classifier.training_set == []\n assert classifier.training_size == 0\n assert classifier.ultimate_training_size == 117",
"def process(self):\n super(Test200S... | [
"0.6209402",
"0.59051013",
"0.58765286",
"0.5840196",
"0.5720844",
"0.5711459",
"0.5654874",
"0.56403255",
"0.5635486",
"0.555772",
"0.5533944",
"0.5531149",
"0.551197",
"0.5506288",
"0.5492125",
"0.5479801",
"0.5421097",
"0.5414882",
"0.5408753",
"0.54075414",
"0.5392143",
... | 0.8124226 | 0 |
Check there are items in API response and amount is equal to count argument | def assert_count_equal(self, result, count):
self.assertGreater(count, 0)
self.assertEqual(len(result['edges']), count) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_listingCatalogEntriesWithLimit(self):\n expected_results = {\n '': 2,\n '?limit=1': 2,\n }\n\n for search, expected in expected_results.items():\n response = self.client.get(\n '/api/v1/catalogentry/{}'.format(search)\n )\n ... | [
"0.6791966",
"0.66729575",
"0.6565801",
"0.6497505",
"0.64690703",
"0.6448682",
"0.63773793",
"0.6313796",
"0.623406",
"0.62317044",
"0.6155163",
"0.6136318",
"0.6103742",
"0.6057667",
"0.6053615",
"0.6022834",
"0.60172397",
"0.59977853",
"0.598408",
"0.59807146",
"0.5928976"... | 0.59041953 | 22 |
Check result is ordered the same way as queryset Execute query 2 times with order_by parameter ASC and DESC | def assert_response_orders(self, *args, **kwargs):
self.assert_response_order(*args, **kwargs)
kwargs['order_by'] = '-' + kwargs['order_by']
self.assert_response_order(*args, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_order_by(self):\n self.Person(name=\"User B\", age=40).save()\n self.Person(name=\"User A\", age=20).save()\n self.Person(name=\"User C\", age=30).save()\n\n names = [p.name for p in self.Person.objects.order_by(\"-age\")]\n assert names == [\"User B\", \"User C\", \"Use... | [
"0.67899144",
"0.6670928",
"0.6630725",
"0.6628486",
"0.6580276",
"0.65499324",
"0.6533739",
"0.64877474",
"0.6473126",
"0.64692175",
"0.6447702",
"0.64364284",
"0.6424204",
"0.6368952",
"0.6364485",
"0.6345996",
"0.63200474",
"0.6256264",
"0.62399656",
"0.62231755",
"0.61736... | 0.5780353 | 52 |
Finds haversin distance (distance along great circle) in miles between two points. Points are defined by latitude and longitude. Radius of the Earth is assumed to be halfway between radius at the equator and radius at the pole. | def haversin(lat1, lon1, lat2, lon2):
r = 3956.545 # Radius of the Earth in miles
# Conver to radians
lat1 = np.pi/180*lat1
lon1 = np.pi/180*lon1
lat2 = np.pi/180*lat2
lon2 = np.pi/180*lon2
# Haversin formula
d = 2*r*np.arcsin(np.sqrt(\
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_distance(point1, point2):\n import math\n\n def convert_to_radians(degrees):\n return degrees * math.pi / 180\n\n radius_earth = 6.371E3 # km\n phi1 = convert_to_radians(point1[0])\n phi2 = convert_to_radians(point2[0])\n\n delta_phi = convert_to_radians(point1[0] - point2[0]... | [
"0.7619608",
"0.7607864",
"0.7551687",
"0.7508094",
"0.7420255",
"0.7381104",
"0.73616487",
"0.73594844",
"0.73567516",
"0.7344407",
"0.7343951",
"0.7317549",
"0.73043895",
"0.7280788",
"0.72720975",
"0.72690815",
"0.7265229",
"0.725339",
"0.72272795",
"0.7225253",
"0.721876"... | 0.75291026 | 3 |
Check if the file is in allowed extensions. | def allowed_file(filename: str) -> bool:
return '.' in filename and filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_allowed_extension(filename):\n return '.' in filename and filename.rsplit('.', 1)[1] in ALLOWED_EXTENSIONS",
"def allowed_file(filename, allowed_extension):\n return '.' in filename and get_file_ext(filename) in allowed_extension",
"def file_allowed(self):\n if self._allowed_ext:\n ... | [
"0.86896974",
"0.85573995",
"0.8538222",
"0.85341746",
"0.85341746",
"0.85341746",
"0.85341746",
"0.85341746",
"0.85341746",
"0.8526133",
"0.8525191",
"0.8505907",
"0.8505907",
"0.8483758",
"0.8483758",
"0.8482575",
"0.8482575",
"0.84671956",
"0.8464725",
"0.8464725",
"0.8464... | 0.84573 | 28 |
Render the default homepage. | def get_index_page() -> Any:
return render_template("home.html", img_upload=session['img_full_path'],
img_rec1=session['img_rec1'], img_rec2=session['img_rec2'],
img_rec3=session['img_rec3'], img_rec4=session['img_rec4'],
img_rec5=sess... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def homepage():\n\treturn render_template(\"home/a_homepage.html\", title=\"Welcome\")",
"def homepage():\n return render_template(\"home/index.html\", title=\"Welcome\")",
"def homepage():\n return render_template('home/index.html', title=\"Home\")",
"def homepage():\n return render_template('home/... | [
"0.85261536",
"0.84153247",
"0.83990395",
"0.8388679",
"0.83687097",
"0.83687097",
"0.8366457",
"0.835218",
"0.82586414",
"0.8234007",
"0.8190585",
"0.81299186",
"0.79668856",
"0.7940881",
"0.7935847",
"0.79016554",
"0.7891117",
"0.786554",
"0.7846629",
"0.78457075",
"0.78076... | 0.0 | -1 |
Return the home page when website launched. | def home_page() -> Any:
session['img_full_path'] = path_web_img + "homepage/chicano-input.jpg"
likes = [1980, 2034, 2096, 1906, 2200]
username = "yz_asencio_art"
followers = 54019
img_path = path_web_img + "homepage/chicano-img"
for i in range(5):
set_session_recs(i, username, followers,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getHomePage(self):\n return self.home_url",
"def home_page(self) -> str:\n return self._home_page",
"def homepage():\n\treturn render_template(\"home/a_homepage.html\", title=\"Welcome\")",
"def homepage():\n return render_template('home/index.html', \n title=\... | [
"0.79455394",
"0.78901076",
"0.77300787",
"0.76787907",
"0.7667781",
"0.76378274",
"0.7613077",
"0.75858307",
"0.7581393",
"0.7581393",
"0.7565909",
"0.7550993",
"0.75246763",
"0.75138104",
"0.7503893",
"0.74730414",
"0.7470488",
"0.74618345",
"0.74518543",
"0.74442804",
"0.7... | 0.0 | -1 |
Return the home page on clicking home button. | def home() -> Any:
return home_page() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def go_home(self):\r\n if self.home_url is not None:\r\n self.set_url(self.home_url)",
"def home(self):\n self.goto(0, 0)",
"def _home(self, op, context):\n self.page = \"HOME\"\n return {'FINISHED'}",
"def go_home(request):\n\n url = request.route_url('home', _app_u... | [
"0.82513344",
"0.7953832",
"0.7935165",
"0.7791558",
"0.7724808",
"0.77172244",
"0.74854594",
"0.74854594",
"0.7445573",
"0.7439244",
"0.74363464",
"0.7414091",
"0.73621446",
"0.7338639",
"0.7338225",
"0.72828937",
"0.7269893",
"0.71437734",
"0.7133979",
"0.7089918",
"0.70625... | 0.7423845 | 11 |
Return the about me page. | def about() -> Any:
return render_template("about.html") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def about():\n return render_template(\n 'about.html',\n title='About',\n time=datetime.now(),\n message='about me'\n )",
"def about(self):\n return dict(page='about')",
"def about(self):\n return dict(page='about')",
"def about(self):\n return dict(page... | [
"0.7631999",
"0.7629802",
"0.7629802",
"0.7629802",
"0.7629802",
"0.753721",
"0.7536759",
"0.74981505",
"0.7494793",
"0.74647003",
"0.745472",
"0.74082994",
"0.73241353",
"0.7318575",
"0.73072827",
"0.73072827",
"0.73072827",
"0.73072827",
"0.73072827",
"0.73072827",
"0.73072... | 0.683364 | 81 |
Returns author in the database, if author is not found in the database it creates a new one using goodreads api | def getGRAuthorByID(id, book_callee=None, series_callee=None, printout=True):
author_entry = session.query(author).get(id)
if author_entry is None:
request = requests.get('https://www.goodreads.com/author/show/'+str(id)+'.xml?key='+API_KEY['GOODREADS'])
if request.status_code == 200:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(self, validated_data):\n return Author.objects.get_or_create_author(validated_data['author'])",
"def create_author(conn, author):\n\tsql = ''' INSERT INTO authorScopus(id,givenname,surname,initials,orcid)\n\t\t\t VALUES(?,?,?,?,?) '''\n\tcur = conn.cursor()\n\tcur.execute(sql, author)\n\tretur... | [
"0.731135",
"0.7142969",
"0.7078773",
"0.7053042",
"0.6846948",
"0.68380123",
"0.6828878",
"0.6667843",
"0.6667843",
"0.66318274",
"0.65874934",
"0.6552616",
"0.64743",
"0.6417939",
"0.64127463",
"0.6347658",
"0.6324049",
"0.6298681",
"0.62800825",
"0.6268134",
"0.6247716",
... | 0.6355792 | 15 |
Create a board with a given size. | def create_board(self, size):
self.board = [
[FieldState.EMPTY for _ in range(size)]
for _ in range(size)
] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_board(self, size):\n x = np.arange(0, size[0])\n y = np.arange(0, size[1])\n board = np.meshgrid(x, y)\n return board",
"def create_board(board_size):\n board = []\n for i in range(board_size):\n row = []\n for j in range(board_size):\n row.ap... | [
"0.81269544",
"0.7737996",
"0.76567954",
"0.73099595",
"0.72161114",
"0.7207438",
"0.7183829",
"0.7181716",
"0.7120404",
"0.7041562",
"0.70245093",
"0.6974107",
"0.69634724",
"0.6910442",
"0.69006073",
"0.6879879",
"0.68703496",
"0.6815675",
"0.6792136",
"0.6726942",
"0.66710... | 0.7908535 | 1 |
Return the version of this bot. | def do_version(self):
return "1.0.0", True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_version(self):\n return self.bot_data_file[\"version\"]",
"def get_version(self):\n return self.version",
"def version(self):\n return self._client.getVersion()",
"def version(self):\n return self.get_current_version()",
"def get_version(self):\n return version.__... | [
"0.8629768",
"0.8058316",
"0.803028",
"0.7994183",
"0.7976973",
"0.7976973",
"0.796721",
"0.796721",
"0.7921771",
"0.7890185",
"0.78885216",
"0.78709894",
"0.77990896",
"0.7777873",
"0.7777873",
"0.7777873",
"0.7777873",
"0.7776412",
"0.7758123",
"0.7730733",
"0.7730733",
"... | 0.0 | -1 |
Return the name of this name. | def do_name(self):
return "Otabot", True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_name(self) -> str:\n\n return self.name_",
"def get_name(self) -> str:\n return self._name",
"def get_name(self) -> str:\n return self._name",
"def get_name(self) -> str:\n return self.name",
"def get_name(self) -> str:\n return self.name",
"def get_name(self) -... | [
"0.89700687",
"0.8965141",
"0.8965141",
"0.8936542",
"0.8936542",
"0.8936542",
"0.88448375",
"0.88448375",
"0.88448375",
"0.88448375",
"0.88448375",
"0.88448375",
"0.88448375",
"0.88448375",
"0.88448375",
"0.88448375",
"0.88448375",
"0.88448375",
"0.88448375",
"0.88448375",
"... | 0.0 | -1 |
Given a admin user When I post an activity in the name of someone else And I try to post the same content twice in less than a minute Then the activity is posted only once | def test_create_activity_check_not_duplicate_activity(self):
from .mockers import user_status as activity
username = 'messi'
self.create_user(username)
self.testapp.post('/people/%s/activities' % username, json.dumps(activity), oauth2Header(test_manager), status=201)
self.testapp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post_activities():\n pass",
"def post_duplicate_meetup(self):\n\n self.post_meetup()\n return self.post_meetup()",
"async def check_for_spam(self, message: discord.Message):\n user = message.author\n guild = message.guild\n\n similarity_threshold = await self.config.gu... | [
"0.60872483",
"0.57995653",
"0.5792785",
"0.57450986",
"0.5678839",
"0.5602586",
"0.5591259",
"0.5491544",
"0.5478506",
"0.5473162",
"0.5471204",
"0.5468901",
"0.5432671",
"0.54191107",
"0.5370155",
"0.5369898",
"0.53670925",
"0.5363584",
"0.53386384",
"0.5333345",
"0.5325089... | 0.6391438 | 0 |
Sets the owner_id of this GetCharactersCharacterIdChatChannels200Ok. | def owner_id(self, owner_id):
if owner_id is None:
raise ValueError("Invalid value for `owner_id`, must not be `None`") # noqa: E501
self._owner_id = owner_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bot_owner_id(self, bot_owner_id):\n\n self._bot_owner_id = bot_owner_id",
"def owner_id(self, owner_id):\n self._owner_id = owner_id",
"def owner_id(self, owner_id):\n\n self._owner_id = owner_id",
"def set_owner(self, owner):\n self.__owner = owner",
"def bot_owner_id(self)... | [
"0.5711613",
"0.56560415",
"0.56034833",
"0.554228",
"0.54501593",
"0.54218566",
"0.541215",
"0.5395359",
"0.5317844",
"0.5300464",
"0.52877265",
"0.52860695",
"0.5237949",
"0.50969476",
"0.5054328",
"0.5054328",
"0.5054328",
"0.5054328",
"0.505116",
"0.505116",
"0.505116",
... | 0.53270805 | 8 |
Sets the motd of this GetCharactersCharacterIdChatChannels200Ok. | def motd(self, motd):
if motd is None:
raise ValueError("Invalid value for `motd`, must not be `None`") # noqa: E501
self._motd = motd | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_mot_clef(self, mc: [str]):\n self.mot_clef = mc",
"async def moderation(self, ctx):\n\n new_value = await self.toggle_dm_setting(ctx.author.id, \"ban_kick_mute\")\n\n if new_value:\n message = \":white_check_mark: You will now receive DMs when you get muted, kicked or bann... | [
"0.49468398",
"0.4406139",
"0.43965116",
"0.43365568",
"0.43319276",
"0.43273723",
"0.42952183",
"0.42786202",
"0.4252514",
"0.4252077",
"0.42007127",
"0.41906017",
"0.41436467",
"0.41346827",
"0.41155958",
"0.41134816",
"0.41108853",
"0.41013506",
"0.41011444",
"0.41001746",
... | 0.50869966 | 0 |
Sets the allowed of this GetCharactersCharacterIdChatChannels200Ok. | def allowed(self, allowed):
if allowed is None:
raise ValueError("Invalid value for `allowed`, must not be `None`") # noqa: E501
self._allowed = allowed | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cmd_weaponcontrol(self, data, client, cmd=None):\n if not data:\n restrictions = []\n for weap in self._forbiddenWeapons:\n restrictions.append(find_key(self.weaponCodes, weap))\n\n if len(restrictions) == 0:\n client.message('^7No weapon re... | [
"0.4656572",
"0.4596298",
"0.45805392",
"0.45122778",
"0.45099333",
"0.44996625",
"0.4455285",
"0.44330344",
"0.44308266",
"0.4408484",
"0.43993413",
"0.43750817",
"0.4356838",
"0.435108",
"0.43472853",
"0.43238524",
"0.43006727",
"0.42985108",
"0.42973328",
"0.42208877",
"0.... | 0.46634626 | 0 |
Sets the muted of this GetCharactersCharacterIdChatChannels200Ok. | def muted(self, muted):
if muted is None:
raise ValueError("Invalid value for `muted`, must not be `None`") # noqa: E501
self._muted = muted | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def async_set_muted(self, mute):\n self._muted = mute",
"def setMute(self, channel, isMuted=1, group=\"I\", unitCode=0):\n resp = self.XAPCommand(\"MUTE\", channel, group, str(isMuted),\n unitCode=unitCode)\n return int(resp)",
"def mute(self, status=None):\n ... | [
"0.58854496",
"0.56700486",
"0.540431",
"0.5339367",
"0.5319164",
"0.5280411",
"0.5219376",
"0.51907694",
"0.51797754",
"0.51378167",
"0.51292086",
"0.50707155",
"0.5059053",
"0.50289965",
"0.49752435",
"0.49115482",
"0.49030247",
"0.4887885",
"0.4854488",
"0.48399007",
"0.48... | 0.6136438 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, GetCharactersCharacterIdChatChannels200Ok):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748"
] | 0.0 | -1 |
Create and save a user with the given username, email, and password. | def _create_user(self, username, email, password, **extra_fields):
if not username:
raise ValueError('The given username must be set')
if not email:
raise ValueError('The given email must be set')
email = self.normalize_email(email)
username = self.model.normalize... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_user(self, email, password,username, **extra_fields):\r\n if not email:\r\n raise ValueError('The given email must be set')\r\n if not username:\r\n raise ValueError('The given username must be set')\r\n email = self.normalize_email(email)\r\n user = se... | [
"0.85967624",
"0.8440654",
"0.84264034",
"0.84063315",
"0.8393488",
"0.83878005",
"0.8341707",
"0.8334409",
"0.8332718",
"0.83224976",
"0.8288854",
"0.82819235",
"0.827502",
"0.8269521",
"0.8267577",
"0.81637603",
"0.8159258",
"0.8158126",
"0.81423306",
"0.8136717",
"0.812750... | 0.8423257 | 3 |
Test creating a new user with email is successful | def test_create_user_with_email_successful(self):
email = "test@gmail.com"
password = "test_password_123"
user = get_user_model().objects.create_user(
email=email,
password=password
)
self.assertEqual(user.email, email)
self.assertTrue(user.check... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_user_with_existing_email(client, existing_user):\n response = client.post(\"/auth/register\", json=existing_user)\n assert response.status_code == 400",
"def test_create_user_with_preexisting_email(self):\n data = {\n 'username': 'test_user2',\n 'email': 'test@e... | [
"0.8368191",
"0.836789",
"0.83441734",
"0.8341688",
"0.83315516",
"0.8322607",
"0.83179474",
"0.8308384",
"0.8308384",
"0.8308384",
"0.8308384",
"0.8308384",
"0.8307728",
"0.83033836",
"0.8294941",
"0.8293236",
"0.8289021",
"0.82869005",
"0.82833046",
"0.8282766",
"0.827963",... | 0.83187395 | 6 |
Test if the user email is invalid | def test_user_invalid_email(self):
with self.assertRaises(ValueError):
get_user_model().objects.create_user(email=None, password="123") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_email(self, email):\n user = User.query.filter_by(email=email.data).first()\n if user is not None:\n raise ValidationError('Please use a different email address.')",
"def validate_email(form, field):\n if not User.query.filter_by(email = field.data).first():\n ... | [
"0.8020295",
"0.7939462",
"0.787872",
"0.7826369",
"0.78195804",
"0.776506",
"0.776506",
"0.77207077",
"0.7673293",
"0.76470983",
"0.7617924",
"0.75996786",
"0.7584252",
"0.7558819",
"0.75569475",
"0.75528514",
"0.7532483",
"0.75177556",
"0.7505812",
"0.74966",
"0.74966",
"... | 0.6975558 | 86 |
Test the tag string representation | def test_tag_str(self):
tag = models.Tag.objects.create(
user=sample_user(),
name='Vegan'
)
self.assertEqual(str(tag), tag.name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_tag_str(self):\n tag = models.Tag.objects.create(\n user=sample_user(),\n name='Internal'\n )\n\n self.assertEqual(str(tag), tag.name)",
"def test_tag_str(self):\n tag = models.Tag.objects.create(\n user=sample_user(),\n name='Docke... | [
"0.7170174",
"0.70703965",
"0.6922232",
"0.69209194",
"0.6899433",
"0.6885665",
"0.6861665",
"0.66865885",
"0.64923304",
"0.637821",
"0.6311385",
"0.63077676",
"0.62146807",
"0.616337",
"0.61539763",
"0.60839355",
"0.60640544",
"0.6059385",
"0.5983592",
"0.5948616",
"0.593113... | 0.6938718 | 3 |
Restores the model weights. Loads the weights loaded from checkpoint dir onto the model. It ignores the missing weights since this is used to load the RPN weights onto AVOD. | def load_model_weights(sess, checkpoint_dir):
init_fn = slim.assign_from_checkpoint_fn(
checkpoint_dir, slim.get_model_variables(), ignore_missing_vars=True)
init_fn(sess) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _restore(self, checkpoint):\n checkpoint_path = os.path.join(checkpoint, \"model_weights\")\n self.model.load_weights(checkpoint_path)",
"def reset(self):\n checkpoint = torch.load(\n 'model_lr_finder.pth.tar',\n map_location=self.device)\n self.model.load_st... | [
"0.8179927",
"0.745341",
"0.73368376",
"0.7333495",
"0.7333495",
"0.70321006",
"0.70145917",
"0.69810003",
"0.6964686",
"0.6946235",
"0.6943324",
"0.6868712",
"0.6868712",
"0.6868712",
"0.6854219",
"0.6830171",
"0.6829471",
"0.68229496",
"0.6763843",
"0.67623216",
"0.6694251"... | 0.72402996 | 5 |
Returns True if this SQLite database has a table with the provided name. | def has_table(self, table):
con = self.connection
cur = con.cursor()
res = cur.execute("""SELECT COUNT(*) FROM sqlite_master
WHERE type='table' AND name='%s'""" % table)
tcnt = cur.fetchall()
cur.close()
if tcnt[0][0] > 0:
return True
else:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_table(self, name: str) -> bool:\n try:\n self.execute(\"select * from {table} limit 1\", name)\n return True\n except sqlite3.OperationalError:\n return False",
"def table_exists(self, table_name):\n\t\tif self.__dbfile is None:\n\t\t\treturn False\n\n\t\tcu... | [
"0.9046151",
"0.8717423",
"0.83914274",
"0.83394814",
"0.82819635",
"0.81824666",
"0.81554914",
"0.81372964",
"0.80550873",
"0.80494887",
"0.8039246",
"0.8027329",
"0.7929509",
"0.792135",
"0.78838015",
"0.78664917",
"0.78503513",
"0.7843717",
"0.7828832",
"0.7792916",
"0.770... | 0.8297428 | 4 |
force_communicate_tls returns a boolean indicating whether we should communicate with other nodes using the TLS ports. When communicating with a cluster which has 'clusterEncryptionLevel' set to 'strict' the nontls ports will only be open to 'localhost' meaning we must communicate via the nontls ports. | def force_communicate_tls(rest: ClusterManager) -> bool:
settings, err = rest.get_security_settings()
_exit_if_errors(err)
# The cluster isn't using 'strict' cluster encryption, we shouldn't need to force enable TLS
if 'clusterEncryptionLevel' not in settings or settings['clusterEncryptionLevel'] != 's... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_non_ssl_ports_after_enabling_tls(self):\n self.enable_tls_encryption_cli_on_nodes(nodes=[self.cluster.master])\n CbServer.use_https = True\n rest = RestConnection(self.cluster.master)\n for non_ssl_request in self.sample_urls_map.keys():\n api = non_ssl_request % sel... | [
"0.61725223",
"0.5974541",
"0.58473927",
"0.5810793",
"0.5717763",
"0.5677478",
"0.5663727",
"0.5559516",
"0.54929966",
"0.5491423",
"0.548591",
"0.54669243",
"0.54669243",
"0.5461717",
"0.5398977",
"0.53883904",
"0.5362573",
"0.5362573",
"0.53592825",
"0.52707344",
"0.526730... | 0.82616556 | 0 |
FUNCTION TO PERFORM PADDING OF NDARRAY LIST | def pad_ndarray_list(batch, pad_value):
bs = len(batch)
maxlen = max([b.shape[0] for b in batch])
if len(batch[0].shape) >= 2:
batch_pad = np.zeros((bs, maxlen) + batch[0].shape[1:])
else:
batch_pad = np.zeros((bs, maxlen))
batch_pad.fill(pad_value)
for i, b in enumerate(batch):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pad(lst, pad_size, filler):\n assert(isinstance(lst, list))\n assert(pad_size - len(lst) >= 0)\n lst.extend([filler] * (pad_size - len(lst)))",
"def np_pad(x, list_thresh):\n x = np.array(x)\n x = np.pad(x, pad_width = ((0,0),(0,list_thresh-x.shape[1])), mode=\"constant\", constant_values=0)\n... | [
"0.6966776",
"0.69038206",
"0.6876463",
"0.68747306",
"0.6769223",
"0.66913205",
"0.66281784",
"0.6605338",
"0.6424735",
"0.6417853",
"0.6404296",
"0.6370961",
"0.6345201",
"0.6184717",
"0.6167888",
"0.6125069",
"0.60996914",
"0.6099097",
"0.6097952",
"0.6094235",
"0.60881674... | 0.639093 | 11 |
This function resamples a dataset (daily timestep) into a time series based on the resample string resample strings are formatted as follows (follwing ISO 8601) R/ > specifies repeating interval YYYYMMDD/ > specifies start date of repeating interval PnM/ > specifies duration of repeating interval in months (This is the... | def resampleDataSet(dailyData, resampleString, resampleMethod, customFunction = None):
# Make sure the index is sorted
dailyData.sort_index(level='Datetime', inplace=True)
# Get today's date
today = datetime.now()
# Create a new empty series
resampleData = pd.Series([], index = pd.DatetimeInd... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resample_signal(s, sample_rate, desired_sample_rate):\n\n duration = float(len(s)) / sample_rate\n t = np.arange(len(s)) * (1.0 / sample_rate)\n desired_n = int(duration*desired_sample_rate)\n rs,t_rs = resample(s, desired_n, t=t)\n return t_rs,rs",
"def resample_data(self, data, freq, resampl... | [
"0.6189503",
"0.6186935",
"0.6006406",
"0.5984264",
"0.5794025",
"0.5790197",
"0.5642623",
"0.5627914",
"0.5624321",
"0.560069",
"0.5598766",
"0.55986637",
"0.55925095",
"0.55639607",
"0.5523618",
"0.54602885",
"0.54570323",
"0.54299384",
"0.5419657",
"0.53950626",
"0.5371256... | 0.7965821 | 0 |
Decorator that marks a function as a postinitialization function. Functions decorated with post_init_func will be executed after all init_funcs have been executed. The function has_run may be used to determine if a function has been run. | def post_init_func(fn):
fn.__has_run__ = False
@functools.wraps(fn)
def wrapper_fn(*args, **kwargs):
if fn.__has_run__:
cui.message('Warning: executing post_init_func %s more than once.' % fn)
result = fn(*args, **kwargs)
fn.__has_run__ = True
return result
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_func(fn):\n fn.__has_run__ = False\n @functools.wraps(fn)\n def wrapper_fn(*args, **kwargs):\n if fn.__has_run__:\n cui.message('Warning: executing init_func %s more than once.' % fn)\n\n result = fn(*args, **kwargs)\n fn.__has_run__ = True\n return result\n... | [
"0.63143677",
"0.5800149",
"0.5628334",
"0.547597",
"0.5469971",
"0.5295132",
"0.5269514",
"0.5231791",
"0.5231475",
"0.5126324",
"0.51138693",
"0.509769",
"0.50284564",
"0.5009093",
"0.50064725",
"0.49667948",
"0.49556038",
"0.48375946",
"0.48374042",
"0.48345646",
"0.480553... | 0.77718264 | 0 |
Calculates u(x) and log p(x) with a Gaussian base density | def log_likelihood(self, theta, x, **kwargs):
u, logdet_dudx, log_a = self.forward(theta, x, **kwargs)
constant = float(-0.5 * self.n_inputs * np.log(2.0 * np.pi))
# log_likelihood = torch.log(torch.sum(torch.exp(log_a - 0.5 * u ** 2 + logdet_dudx), dim=2))
log_likelihood = torch.logsu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gaussian_likelihood(x, mu, log_std):\n prob = -0.5 * (((x - mu) / (tf.exp(log_std) + EPS)) ** 2 + 2 * log_std + np.log(2 * np.pi))\n return tf.reduce_sum(prob, axis=1)",
"def gauss(x, *p):\n mu, sigma = p\n return (1 / (sigma * np.sqrt(2 * np.pi)) *\n np.exp(-(x - mu) ** 2 / (2. * sigm... | [
"0.7217705",
"0.72034866",
"0.71691",
"0.7159843",
"0.71092224",
"0.7094188",
"0.703113",
"0.698103",
"0.6955249",
"0.69354916",
"0.69039744",
"0.6893893",
"0.6873478",
"0.68720645",
"0.68450886",
"0.6833465",
"0.6800797",
"0.67968434",
"0.67864114",
"0.67768097",
"0.6758906"... | 0.0 | -1 |
Hide gridlines. Check API to see if they are hidden. | def test_hide_gridlines(self):
def are_gridlines_hidden():
res = self.spreadsheet.fetch_sheet_metadata()
sheets = res["sheets"]
sheet = utils.finditem(
lambda x: x["properties"]["sheetId"] == self.sheet.id,
sheets,
)
re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_show_gridlines(self):\n\n def are_gridlines_hidden():\n res = self.spreadsheet.fetch_sheet_metadata()\n sheets = res[\"sheets\"]\n sheet = utils.finditem(\n lambda x: x[\"properties\"][\"sheetId\"] == self.sheet.id,\n sheets,\n ... | [
"0.75390685",
"0.7167455",
"0.7008423",
"0.6905336",
"0.67983687",
"0.67720014",
"0.6716582",
"0.671336",
"0.671336",
"0.654991",
"0.6498917",
"0.6382459",
"0.63817275",
"0.62139803",
"0.6160078",
"0.6041856",
"0.5984211",
"0.5913565",
"0.5909985",
"0.5897187",
"0.58613646",
... | 0.7945359 | 0 |
Calculates a smooth Dice coefficient loss from sparse labels. | def dice_loss(y_true,
y_pred,
classes,
smooth=1e-5,
include_background=False,
only_present=True):
#print(y_true.dtype)
#y_true = tf.one_hot(tf.cast(y_true, tf.int32), classes)
#y_pred = tf.nn.softmax(y_pred)
#remove_classes = tf.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dice_loss(y_true, y_pred, smooth=1e-6):\n y_true=tf.cast(y_true,tf.float32)\n y_pred=tf.cast(y_pred,tf.float32)\n y_true_f = K.flatten(y_true)\n y_pred_f = K.flatten(y_pred)\n intersection = K.sum(y_true_f * y_pred_f)\n dice = (2. * intersection + smooth) / (K.sum(y_true_f) + K.sum(y_pred_f) ... | [
"0.6802747",
"0.6734848",
"0.67075133",
"0.66159457",
"0.64646",
"0.64117134",
"0.6408969",
"0.639347",
"0.63541967",
"0.63531536",
"0.63212824",
"0.630752",
"0.63052887",
"0.61968064",
"0.6185374",
"0.6157633",
"0.61560017",
"0.61389637",
"0.6119179",
"0.6112352",
"0.6110852... | 0.6307283 | 12 |
A dialog that sets the maximum attribute points to distribute | def setMaxAttributePoints(self):
try:
maxAttrPoints = int(self.getInput_setMaxAttributePoints(
"How many attribute points should your deck have in total? "))
except ValueError:
print("Invalid Value! Integer expected.")
self.setMaxAttributePoints()
if maxAttrPoints > 0:
self.mMaxAttributePoints = m... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_maximum(self):\n self._level_gen.maximum_length = self._maximum_length_spinbox.value()\n self._refresh_view()",
"def set_greatest(self,widget,greatest):\n self.greatest = greatest\n self.queue_draw()",
"def maximize(self):\n self.abstract_obj.maximize()",
"def maxi... | [
"0.5824828",
"0.57186735",
"0.5573971",
"0.5537985",
"0.5518747",
"0.5513778",
"0.5487703",
"0.5486311",
"0.5461815",
"0.5432258",
"0.54186946",
"0.5386697",
"0.537445",
"0.53688073",
"0.534487",
"0.5339686",
"0.53310525",
"0.53048486",
"0.5299572",
"0.5293547",
"0.5292245",
... | 0.6831523 | 0 |
saves a dictionary as .json | def saveDeck(pDeckDict):
import json
import os
path = './decks/decks/'
pathfilename = path + pDeckDict['filename']
with open(pathfilename, 'w') as f:
json.dump(pDeckDict, f)
decksyspath = os.path.abspath(path)
print("Deck saved in directory \"" + decksyspath + "\" as " + pDeckDict['filename']) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def store(my_dict, filename):\n my_json = json.dumps(my_dict)\n f = open(filename,\"w\")\n f.write(my_json)\n f.close()",
"def save(self) -> None:\n with open(dict_path, 'w', encoding='utf-8') as dictionary_file:\n json.dump(self.data, dictionary_file, indent=2, separators=(',', ':'), ensure_... | [
"0.8347037",
"0.8346495",
"0.8156121",
"0.8000728",
"0.79855925",
"0.7973229",
"0.787181",
"0.782894",
"0.7694713",
"0.7599424",
"0.75766426",
"0.7557857",
"0.75315416",
"0.7514683",
"0.7493824",
"0.7489669",
"0.74741083",
"0.7463696",
"0.7451027",
"0.7437084",
"0.7425388",
... | 0.0 | -1 |
Converts 32bit register value to signed integer in Python. | def _reg2int(self, reg):
result = -(reg>>31 & 0x1)*(1<<31)
for i in range(31):
result += (reg>>i & 0x1)*(1<<i)
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def u32(value: bytes, endian: str = \"little\", sign: bool = False) -> int:\n return unpack(value, 32, endian, sign)",
"def unsigned32(i):\n return i & 0xFFFFFFFF",
"def hex_to_signed(source):\n if not isinstance(source, str):\n raise ValueError(\"string type required\")\n if 0 == len(source... | [
"0.7428487",
"0.67801994",
"0.6697139",
"0.65716124",
"0.65618855",
"0.6530569",
"0.64744043",
"0.63174784",
"0.6297177",
"0.62906307",
"0.6248376",
"0.62289953",
"0.62176985",
"0.6176326",
"0.6162468",
"0.610647",
"0.60904956",
"0.608702",
"0.6031255",
"0.59960586",
"0.59872... | 0.60511786 | 18 |
return the full month name | def monthname(self):
return self.strftime("%B") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_month_name(month_of_year):\n return VALID_MONTHS[month_of_year - 1].title()",
"def get_month_name(self, month):\n return self.month_names[month.month - 1]",
"def month_name(month_number):\n return calendar.month_name[month_number]",
"def _monthName(self, month):\n if month is not ... | [
"0.8457601",
"0.83188426",
"0.8215947",
"0.821441",
"0.81788164",
"0.78555584",
"0.7828268",
"0.7793537",
"0.7708863",
"0.755012",
"0.75287694",
"0.7433193",
"0.73836243",
"0.73365885",
"0.7287329",
"0.7259511",
"0.7236556",
"0.71905386",
"0.71710396",
"0.70356345",
"0.699783... | 0.85666597 | 0 |
returns datetime as ISO8601 string with just YYYYMMDD | def iso_date(self):
return self.strftime(self.FORMAT_PRECISION_DAY) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date_to_iso8601(date):\n return '%s-%02d-%02d' % (date.year, date.month, date.day)",
"def dt_to_str(dt):\n return dt.isoformat()",
"def format_iso8601(obj):\n return obj.strftime('%Y-%m-%dT%H:%M:%SZ')",
"def format_date_iso(value: int) -> str:\n\n return (datetime(1970, 1, 1) + timedelta(... | [
"0.77519184",
"0.7464885",
"0.74158263",
"0.73707104",
"0.7342009",
"0.7291826",
"0.7290798",
"0.72507375",
"0.7180452",
"0.71494186",
"0.7148791",
"0.71266025",
"0.7043348",
"0.7021276",
"0.70129526",
"0.6981759",
"0.6969936",
"0.6963111",
"0.69131935",
"0.6903811",
"0.69015... | 0.6238393 | 66 |
returns datetime as ISO8601 string with no milliseconds | def iso_seconds(self):
return self.isoformat(timespec="seconds") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iso_8601(self):\n return self.isoformat(timespec=\"microseconds\")",
"def ISO8601(self):\n if self.timezoneNaive():\n return \"%0.4d-%0.2d-%0.2dT%0.2d:%0.2d:%0.2d\" % (\n self._year, self._month, self._day,\n self._hour, self._minute, self._second)\n ... | [
"0.8177513",
"0.7826658",
"0.770347",
"0.7678465",
"0.76640165",
"0.76269495",
"0.76085854",
"0.7591992",
"0.7581517",
"0.74818337",
"0.74075115",
"0.73775554",
"0.73427474",
"0.7220646",
"0.71737725",
"0.7163639",
"0.71269894",
"0.71251637",
"0.711252",
"0.71004486",
"0.7059... | 0.0 | -1 |
returns datetime as a full ISO8601 string with milliseconds | def iso_8601(self):
return self.isoformat(timespec="microseconds") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_iso8601(obj):\n return obj.strftime('%Y-%m-%dT%H:%M:%SZ')",
"def datetime_to_str(dt):\n return dt.replace(microsecond=0).isoformat()",
"def _serialize_time(val):\n return val.isoformat()",
"def _serialize_datetime(val):\n return datetime_to_iso8601(val)",
"def ISO8601(self):\n ... | [
"0.7295798",
"0.7209774",
"0.7157422",
"0.707845",
"0.70763683",
"0.7027591",
"0.69903433",
"0.694472",
"0.6871909",
"0.6868075",
"0.6838537",
"0.6791418",
"0.67581004",
"0.6726562",
"0.66623515",
"0.6621988",
"0.66075766",
"0.65853965",
"0.6566968",
"0.6532836",
"0.65131056"... | 0.8166942 | 0 |
Compute IoU of two bounding boxes. Define your bod IoU function HERE | def get_iou(bb1, bb2):
#pass
iou3d, iou2d = box3d_iou(bb1, bb2)
return iou3d | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _iou(box1: np.ndarray, box2: np.ndarray) -> np.ndarray:\n b1_x0, b1_y0, b1_x1, b1_y1 = box1\n b2_x0, b2_y0, b2_x1, b2_y1 = box2\n\n int_x0 = max(b1_x0, b2_x0)\n int_y0 = max(b1_y0, b2_y0)\n int_x1 = min(b1_x1, b2_x1)\n int_y1 = min(b1_y1, b2_y1)\n\n int_area = max(int_x1 - int_x0, 0) * max... | [
"0.8153281",
"0.8117208",
"0.7936601",
"0.7850897",
"0.7795968",
"0.77954185",
"0.77894783",
"0.7724968",
"0.77102655",
"0.7708795",
"0.770068",
"0.7694332",
"0.7694332",
"0.7687537",
"0.76686114",
"0.76560533",
"0.76497847",
"0.76317424",
"0.7611288",
"0.7591255",
"0.7591255... | 0.7898717 | 3 |
Compute pairwise distance of a point cloud. | def pairwise_distance(x, y, scope=None):
with tf.op_scope([x, y], scope, 'pairwise_l2_norm2_batch'):
y_T = tf.transpose(y, perm=[0, 2, 1])
x_y = -2 * tf.matmul(x, y_T)
x_square = tf.reduce_sum(tf.square(x), axis=-1, keep_dims=True)
y_square = tf.reduce_sum(tf.square(y), axis=-1, kee... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distancePairs(self):\n return spsd.squareform(spsd.pdist(self.coordinates()))",
"def _pairwise_dist(cx, cy, p=2, _pow_flag=False):\n def _are_equal(cx, cy):\n if cx is cy:\n return True\n return torch.equal(cx, cy)\n\n res = None\n m = cx.size(0)\n n = cy.size(0)\n... | [
"0.68699944",
"0.66280425",
"0.661844",
"0.65512",
"0.6534016",
"0.64478815",
"0.6431327",
"0.6417809",
"0.6399448",
"0.6350636",
"0.6324532",
"0.63039714",
"0.62968266",
"0.6261314",
"0.62560284",
"0.6238904",
"0.62239534",
"0.61941457",
"0.61893165",
"0.6180934",
"0.6158634... | 0.0 | -1 |
DriverLicenseResult a model defined in huaweicloud sdk | def __init__(self, number=None, name=None, sex=None, nationality=None, address=None, birth=None, issue_date=None, _class=None, valid_from=None, valid_to=None, issuing_authority=None, file_number=None, record=None):
self._number = None
self._name = None
self._sex = None
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def get_license(self) -> APIReturn:\n return await self._request(\"GET\", \"/getLicense\")",
"def get_license_info(self):\n\t\treturn Job(SDK.PrlSrv_GetLicenseInfo(self.handle)[0])",
"def qs_license():\r\n paragraph = document.add_paragraph('')\r\n document.add_heading('License', level=1)\r\... | [
"0.6317537",
"0.6113051",
"0.60704315",
"0.5967662",
"0.582312",
"0.5727685",
"0.5700134",
"0.5660123",
"0.5610738",
"0.55938",
"0.551588",
"0.5507045",
"0.5506936",
"0.5483861",
"0.54736483",
"0.5459874",
"0.54463166",
"0.54413724",
"0.54231906",
"0.53920084",
"0.53529304",
... | 0.0 | -1 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, DriverLicenseResult):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.84560555",
"0.83913696",
"0.8143685",
"0.81403786",
"0.8131871",
"0.8093231",
"0.80915105",
"0.80915105",
"0.80915105",
"0.8084564",
"0.8084564",
"0.8075547",
"0.8075547",
"0.8065006"
] | 0.0 | -1 |
Convert CamelCase class name to underscores_between_words table name. | def __tablename__(cls):
return get_table_name(cls.__name__) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __tablename__(self):\n return sub(r\"(?<!^)(?=[A-Z])\", \"_\", self.__name__).lower()",
"def get_name(tablename):\n\n return tablename[tablename.find(\"_\") + 1:].replace(\"_\", \" \").capitalize()",
"def __tablename__(cls) -> str:\n return inflection.underscore(cls.__name__)",
"def lowe... | [
"0.712605",
"0.7109449",
"0.71023643",
"0.7040043",
"0.70182806",
"0.68280566",
"0.65216476",
"0.64944196",
"0.6487408",
"0.6470323",
"0.6466193",
"0.643073",
"0.63982207",
"0.63861674",
"0.63653237",
"0.6316548",
"0.63154054",
"0.63039595",
"0.6252803",
"0.62234306",
"0.6209... | 0.5807187 | 41 |
Updates the specified Message. | def update(self, message):
return self.request().update(message) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_message(self, message: str):\n self.message = message\n self.updated_time = datetime.now()",
"def update(self, id, message):\n\n\t\told_message = self.get(id)\n\t\told_message.update(message)\n\n\t\treturn(old_message)",
"def update(self, msg):\n pass",
"def update_message(sel... | [
"0.78718656",
"0.77588254",
"0.775393",
"0.75076985",
"0.7267151",
"0.71954995",
"0.7186151",
"0.71696156",
"0.7121622",
"0.70676905",
"0.70676905",
"0.6819692",
"0.6819692",
"0.6819692",
"0.6819692",
"0.6819692",
"0.6819692",
"0.6819692",
"0.6819692",
"0.6819692",
"0.6819692... | 0.8665488 | 0 |
The event_message for the MessageRequestBuilder | def event_message(self):
return EventMessageRequestBuilder(self.append_to_request_url("eventMessage"), self._client) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def event_message(self):\n return self._event_message",
"def message(self):\n return self._message",
"def message(self):\n return self._message",
"def message(self):\n return self._message",
"def message(self):\n return self._message",
"def message(self):\n retur... | [
"0.82638556",
"0.69466007",
"0.69466007",
"0.69466007",
"0.69466007",
"0.69466007",
"0.69202733",
"0.69202733",
"0.68910265",
"0.68910265",
"0.68603957",
"0.68469983",
"0.6814825",
"0.6814825",
"0.6814825",
"0.68049085",
"0.67816174",
"0.67816174",
"0.67816174",
"0.67816174",
... | 0.8076746 | 1 |
Initialize the ship and set its starting position | def __init__(self, ai_settings, bunker_x, bunker_y, screen, images):
super(Bunker, self).__init__()
self.screen = screen
self.images = images
self.image = self.images[18]
self.rect = self.image.get_rect()
self.screen_rect = screen.get_rect()
# Start each new bu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self,ai_settings, screen):\n\t\tsuper(Ship,self).__init__()\n\t\tself.screen = screen\n\t\tself.ai_settings = ai_settings\n\t\t\n\t\t# Load ship and get its rect\n\t\tself.image = pygame.image.load('images/spaceship.bmp')\n\t\tself.image = pygame.transform.scale(self.image, (50,50))\n\t\tself.rect = s... | [
"0.724054",
"0.723063",
"0.718953",
"0.71750754",
"0.71750754",
"0.71102977",
"0.7028255",
"0.7022774",
"0.7009138",
"0.7005338",
"0.6996021",
"0.69817597",
"0.69712067",
"0.6951812",
"0.6941031",
"0.69371396",
"0.69253206",
"0.69229627",
"0.6834589",
"0.6765205",
"0.6728738"... | 0.0 | -1 |
Return ``self == other``. | def __eq__(self, other):
if not isinstance(other, DFM):
return NotImplemented
# Compare domains first because we do *not* want matrices with
# different domains to be equal but e.g. a flint fmpz_mat and fmpq_mat
# with the same entries will compare equal.
return self.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return self is other",
"def __eq__(self, other):\n return self is other",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return equal(self, othe... | [
"0.9088712",
"0.9088712",
"0.89318585",
"0.89318585",
"0.8923678",
"0.88707024",
"0.87874633",
"0.8690042",
"0.8690042",
"0.86718905",
"0.8666179",
"0.8630134",
"0.86278695",
"0.86194706",
"0.86166567",
"0.8598683",
"0.8564617",
"0.8544822",
"0.854106",
"0.85126925",
"0.85126... | 0.0 | -1 |
Convert to a flat list of nonzeros. | def to_flat_nz(self):
return self.to_ddm().to_flat_nz() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zeros(n):\n return [0 for i in range(n)]",
"def get_none_zero_list(line):\n new_line = []\n for dummy_i in range(0,len(line)):\n if line[dummy_i] != 0:\n new_line.append(line[dummy_i])\n return new_line",
"def zeroes(m, n):\n\n return [[0] * n for i in range(m)]",
"de... | [
"0.7234329",
"0.6851223",
"0.68392026",
"0.6766343",
"0.67550427",
"0.6731659",
"0.6583583",
"0.6579902",
"0.6574113",
"0.65614134",
"0.6516025",
"0.6425528",
"0.63218784",
"0.6305252",
"0.63007873",
"0.6266391",
"0.6223608",
"0.6221569",
"0.6198275",
"0.6185726",
"0.6179131"... | 0.64814806 | 11 |
Convert to a DOK. | def to_dok(self):
return self.to_ddm().to_dok() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_dlpack(self, v):\n raise NotImplementedError('to_dlpack')",
"def test_convert_dosdp(self):\n schema = self._convert('dosdp_schema', 'yaml',\n name='dosdp',\n root_class_name='Pattern',\n data_files=['OM... | [
"0.49756843",
"0.48631278",
"0.48013026",
"0.47988528",
"0.47463575",
"0.4711261",
"0.4681184",
"0.46596766",
"0.46539822",
"0.46338537",
"0.46162602",
"0.459949",
"0.4596944",
"0.45589927",
"0.45370874",
"0.45228192",
"0.45038283",
"0.4499329",
"0.4488213",
"0.4484964",
"0.4... | 0.5600874 | 0 |
Return a zero DFM matrix. | def zeros(cls, shape, domain):
func = cls._get_flint_func(domain)
return cls._new(func(*shape), shape, domain) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def EmptySystemMat(nDOF_2nd, nY, nP=None, nU=None):\n M=np.zeros((nDOF_2nd,nDOF_2nd))\n C=np.zeros((nDOF_2nd,nDOF_2nd))\n K=np.zeros((nDOF_2nd,nDOF_2nd))\n Ya = np.zeros((nY,nDOF_2nd)) # Sa\n Yv = np.zeros((nY,nDOF_2nd)) # Sv\n Yq = np.zeros((nY,nDOF_2nd)) # Sd\n\n if (nU is not None and nP is... | [
"0.66798735",
"0.65511805",
"0.65149194",
"0.6512493",
"0.6468885",
"0.64465356",
"0.64443064",
"0.6440339",
"0.63874286",
"0.6379453",
"0.62890327",
"0.62723136",
"0.6259156",
"0.6253021",
"0.6200745",
"0.6195006",
"0.6193114",
"0.61666393",
"0.6140166",
"0.6131754",
"0.6120... | 0.5813398 | 45 |
Return a diagonal matrix. | def diag(cls, elements, domain):
return DDM.diag(elements, domain).to_dfm() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def diagonal(self):\n M = self.rep\n m, n = self.shape\n return [M[i, i] for i in range(min(m, n))]",
"def diagonal(self):\n return self.rep.diagonal()",
"def diagonal(matrix):\n if sp.sparse.issparse(matrix):\n diag = np.array(matrix.diagonal())\n else:\n diag =... | [
"0.7904005",
"0.77598274",
"0.76164156",
"0.76062506",
"0.75014645",
"0.736733",
"0.7318296",
"0.7287923",
"0.7276762",
"0.7247055",
"0.72027045",
"0.71712035",
"0.71604145",
"0.71370566",
"0.7103009",
"0.7075853",
"0.7029945",
"0.7026525",
"0.69692916",
"0.69133127",
"0.6908... | 0.73832303 | 5 |
Return the diagonal of a DFM matrix. | def diagonal(self):
M = self.rep
m, n = self.shape
return [M[i, i] for i in range(min(m, n))] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_diagonal(matrix):\n\tdegree_vector = tf.reduce_sum(matrix, 1)\n\tdiagonal = tf.diag(degree_vector, name = 'diagonal')\n\treturn diagonal",
"def diagonal(matrix):\n if sp.sparse.issparse(matrix):\n diag = np.array(matrix.diagonal())\n else:\n diag = np.diagonal(matrix).copy()\n retu... | [
"0.77657014",
"0.7595447",
"0.73057634",
"0.70247054",
"0.69957006",
"0.69624776",
"0.68837667",
"0.687001",
"0.6767849",
"0.67080677",
"0.6683253",
"0.66829836",
"0.6668471",
"0.66473955",
"0.6619206",
"0.66121227",
"0.6608991",
"0.6575442",
"0.6575225",
"0.65666646",
"0.656... | 0.70386106 | 3 |
Return ``True`` if the matrix is upper triangular. | def is_upper(self):
M = self.rep
for i in range(self.rows):
for j in range(i):
if M[i, j]:
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_upper_triangular(self):\n self.check_square()\n\n for i in range(self.rows):\n for j in range(i):\n if self[i, j] != 0:\n return False\n return True",
"def is_lower_triangular(self):\n self.check_square()\n\n for i in range(se... | [
"0.80517894",
"0.6582998",
"0.6567371",
"0.6382913",
"0.6341181",
"0.6196102",
"0.61113966",
"0.5990001",
"0.58456594",
"0.5823694",
"0.5812436",
"0.5804869",
"0.57339376",
"0.5669786",
"0.5659927",
"0.565865",
"0.5602963",
"0.5585908",
"0.5542396",
"0.55369717",
"0.5530111",... | 0.7307936 | 1 |
Return ``True`` if the matrix is the zero matrix. | def is_zero_matrix(self):
M = self.rep
for i in range(self.rows):
for j in range(self.cols):
if M[i, j]:
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_zero(self):\n # any nonzero entry in any matrix representation\n # disqualifies the morphism as having totally zero outputs\n return self._matrix.is_zero()",
"def is_empty(matrix):\n return (is_matrix(matrix)\n and matrix.shape[0] == 0 and matrix.shape[1] == 0)... | [
"0.86292386",
"0.80726445",
"0.77540964",
"0.7665984",
"0.76578563",
"0.76379114",
"0.75390357",
"0.75339615",
"0.7503186",
"0.7493692",
"0.7454348",
"0.74488366",
"0.7385251",
"0.7309104",
"0.72853506",
"0.7279598",
"0.72115535",
"0.71663165",
"0.7149099",
"0.71061397",
"0.7... | 0.90603805 | 0 |
Compute the characteristic polynomial of the matrix using FLINT. Examples ======== >>> from sympy import Matrix >>> M = Matrix([[1, 2], [3, 4]]) >>> dfm = M.to_DM().to_dfm() need ground types = 'flint' >>> dfm [[1, 2], [3, 4]] >>> dfm.charpoly() [1, 5, 2] Notes ===== Calls the ``.charpoly()`` method of the underlying F... | def charpoly(self):
# FLINT polynomial coefficients are in reverse order compared to SymPy.
return self.rep.charpoly().coeffs()[::-1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def charpoly(self):\n M = self\n K = M.domain\n\n factors = M.charpoly_factor_blocks()\n\n cp = [K.one]\n\n for f, mult in factors:\n for _ in range(mult):\n cp = dup_mul(cp, f, K)\n\n return cp",
"def characteristic_polynomial(self, var='x'):\n... | [
"0.639068",
"0.6308214",
"0.5992542",
"0.5732046",
"0.56742406",
"0.56679964",
"0.5599488",
"0.5566664",
"0.5561966",
"0.5482758",
"0.54775363",
"0.5476295",
"0.5427428",
"0.5369665",
"0.5362976",
"0.5309477",
"0.52900285",
"0.5233391",
"0.52251774",
"0.5213451",
"0.5200965",... | 0.6696439 | 0 |
Compute LLLreduced basis using FLINT. | def lll(self, delta=0.75):
if self.domain != ZZ:
raise DMDomainError("ZZ expected, got %s" % self.domain)
elif self.rows > self.cols:
raise DMShapeError("Matrix must not have more rows than columns.")
rep = self._lll(delta=delta)
return self._new_rep(rep) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Z_lopass(C, L, R_L, f):\n return 1/(1/Xcap(C,f) + 1/Z_low(L, R_L, f))",
"def _lll(self, transform=False, delta=0.99, eta=0.51, rep='zbasis', gram='approx'):\n\n # XXX: There are tests that pass e.g. QQ(5,6) for delta. That fails\n # with a TypeError in flint because if QQ is fmpq then conversi... | [
"0.5997732",
"0.59264106",
"0.5894035",
"0.56400985",
"0.56364536",
"0.562528",
"0.55638885",
"0.55518335",
"0.55306554",
"0.5508043",
"0.55005753",
"0.54872835",
"0.5479219",
"0.54368263",
"0.5427297",
"0.5412494",
"0.5395482",
"0.53945225",
"0.539378",
"0.53699285",
"0.5361... | 0.0 | -1 |
Compute LLLreduced basis and transform using FLINT. Examples ======== >>> from sympy import Matrix >>> M = Matrix([[1, 2, 3], [4, 5, 6]]).to_DM().to_dfm() >>> M_lll, T = M.lll_transform() >>> M_lll [[2, 1, 0], [1, 1, 3]] >>> T [[2, 1], [3, 1]] >>> T.matmul(M) == M_lll True See Also ======== sympy.polys.matrices.domainm... | def lll_transform(self, delta=0.75):
if self.domain != ZZ:
raise DMDomainError("ZZ expected, got %s" % self.domain)
elif self.rows > self.cols:
raise DMShapeError("Matrix must not have more rows than columns.")
rep, T = self._lll(transform=True, delta=delta)
basi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _lll(self, transform=False, delta=0.99, eta=0.51, rep='zbasis', gram='approx'):\n\n # XXX: There are tests that pass e.g. QQ(5,6) for delta. That fails\n # with a TypeError in flint because if QQ is fmpq then conversion with\n # float fails. We handle that here but there are two better fix... | [
"0.7834534",
"0.677035",
"0.6669084",
"0.66281533",
"0.6141492",
"0.61079866",
"0.60700005",
"0.60389405",
"0.6028507",
"0.59825504",
"0.58455443",
"0.58364385",
"0.5799298",
"0.5797789",
"0.57772297",
"0.5754197",
"0.5731105",
"0.5697709",
"0.5671523",
"0.566102",
"0.5651364... | 0.62504447 | 4 |
Send test email only. | def test_email():
recipients = configs["email_to"].split(", ")
email_body = test_email_content()
if configs["smtp_ssl"] == 1:
server = smtplib.SMTP_SSL(configs["smtp_server"])
elif configs["smtp_tls"] == 1:
server = smtplib.SMTP(configs["smtp_server"])
server.starttls()
else:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_send_email(self):\n\t\trecipient = \"\"\n\t\tself.email.send_email(self.subject, recipient, self.content)",
"def send_test_email():\n from flask_mail import Message\n from website.core import mail\n\n to = ['no-reply@mikefromit.com']\n subject = 'Test Email'\n template = '<h1>You Ok?</h1>... | [
"0.8211882",
"0.78690976",
"0.7718814",
"0.762972",
"0.75801843",
"0.7550005",
"0.7424532",
"0.74018705",
"0.73223746",
"0.73200744",
"0.7313401",
"0.7289164",
"0.72882473",
"0.71855575",
"0.71826184",
"0.71791947",
"0.7162635",
"0.7155478",
"0.7127782",
"0.71003556",
"0.7094... | 0.8162519 | 1 |
Compute the distance between two positions | def compute_distance(fisrt_point: tuple, second_point: tuple) -> float:
return sqrt(int(fisrt_point[0] - second_point[0])**2 + int(fisrt_point[1] - second_point[1])**2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distance(pos1, pos2):\n return math.sqrt((pos1[0] - pos2[0])**2. + (pos1[1] - pos2[1])**2.)",
"def dist(pos1, pos2):\n a, b = pos1\n c, d = pos2\n \n return sqrt((a-c)**2 + (b-d)**2)",
"def getDistance(pos1, pos2):\r\n return ((pos1[0] - pos2[0]) ** 2 + (pos1[1] - pos2[1]) ** 2) ** 0.5",
... | [
"0.8411593",
"0.82585305",
"0.8237957",
"0.81730086",
"0.77968293",
"0.77520084",
"0.7694101",
"0.7689928",
"0.76564926",
"0.76178586",
"0.7589054",
"0.7588391",
"0.75772935",
"0.75713027",
"0.7565994",
"0.75619066",
"0.75565314",
"0.7550437",
"0.7547994",
"0.7526308",
"0.752... | 0.0 | -1 |
Check if the cell exists on the board | def test_cell_existence(board: list, i: int, j: int) -> bool:
return not (i < 0 or i > len(board)-1 or j < 0 or j > len(board)-1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_occupied(self, col, row):\n if self.board[row - 1][col - 1] == EMPTY:\n return False\n else:\n return True",
"def search_cell(self, row, col):\n isFound = self.board.search_cell(row, col)\n\n if isFound:\n return True\n\n return False... | [
"0.75983083",
"0.7410399",
"0.7395481",
"0.7132623",
"0.7046766",
"0.6959073",
"0.6944255",
"0.6940968",
"0.6932164",
"0.68837494",
"0.6862493",
"0.68514967",
"0.6837539",
"0.68338394",
"0.67996156",
"0.6786335",
"0.6760677",
"0.66867673",
"0.66815853",
"0.6662349",
"0.665627... | 0.7910929 | 0 |
the input is a pair of trees representing the objects as a quadtree shift_1 = (a1, b1) and shift2 = (a2, b2) are the lefttop coordinates of the boxes on the large canvas this means that all boxes in T_i must be shifted by (a_i, b_i), where i = 1, 2 parameter forces bounding boxes to stay at least pixels away from each ... | def test_collision(quadtree1, quadtree2, shift1, shift2, stay_away):
r1, r2 = quadtree1.root, quadtree2.root
if (not r1) or (not r2):
return False
stack = [(r1, r2)]
while stack:
p1, p2 = stack.pop() # the nodes of the 1st and the 2nd trees
if not rectangles_int... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_inside_canvas(quadtree, shift, canvas_size):\r\n\r\n stack = [quadtree.root]\r\n w, h = canvas_size\r\n sh_w, sh_h = shift\r\n\r\n while stack:\r\n v = stack.pop()\r\n\r\n a, b, c, d = v.value # a 4 tuple, left upper-coord and right-bottom coordinates\r\n if not ((a + sh_w ... | [
"0.6656996",
"0.6597781",
"0.63054514",
"0.6124916",
"0.60076994",
"0.60017914",
"0.5952814",
"0.59511137",
"0.59424627",
"0.5905724",
"0.5881257",
"0.58806664",
"0.58805597",
"0.58126056",
"0.58088535",
"0.5785901",
"0.5778625",
"0.57734925",
"0.5758643",
"0.5741829",
"0.574... | 0.74686724 | 0 |
Return the predecessor and successor of the current node, given by index. | def around(self, node):
index = self.tour.index(node)
pred = index - 1
succ = index + 1
if succ == self.size:
succ = 0
return (self.tour[pred], self.tour[succ]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __find_node_index(self, index):\n cur_index = 0\n cur_node = self.head\n prev_node = None\n while cur_node is not None:\n if index >= len(cur_node.data_list) + cur_index:\n cur_index += len(cur_node.data_list)\n prev_node = cur_node\n ... | [
"0.6438463",
"0.6410484",
"0.6079619",
"0.59833133",
"0.59603864",
"0.5887911",
"0.5859453",
"0.58579093",
"0.5800991",
"0.5794417",
"0.5777252",
"0.57748276",
"0.5716754",
"0.5673646",
"0.56648105",
"0.56641155",
"0.5623531",
"0.56196195",
"0.55853796",
"0.5580197",
"0.55464... | 0.5067899 | 78 |
Return the predecessor or successor depending on the `prev` parameter. | def pred(self, index, prev):
return self.tour[index - 1] if prev else self.tour[index + 1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prev(self):\n if self.signbit.dec_value == 0:\n method = 'prev'\n else:\n method = 'next'\n return self._step(method)",
"def successor(self, u, predecessor):\n if u[0] == predecessor:\n return u[1]\n elif u[1] == predecessor:\n re... | [
"0.6703023",
"0.6686091",
"0.65338326",
"0.6455781",
"0.6320229",
"0.6259691",
"0.6155501",
"0.61288166",
"0.6126208",
"0.61177784",
"0.61015093",
"0.6087203",
"0.6067297",
"0.6060474",
"0.59947026",
"0.59816563",
"0.5953477",
"0.59325135",
"0.59271646",
"0.5919061",
"0.58966... | 0.7337051 | 0 |
Class that represents the product class | def __init__(self, id, name, price):
self.__id = id
self.__name = name
self.__price = price | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def product_type(self):\n pass",
"def products(self):\r\n return Products(self)",
"def __repr__(self):\n\n return \"<Product: {}>\".format(self.name)",
"def __init__(self, id, name, price):\n self.id = id\n self.name = name\n self.price = price\n self.type = P... | [
"0.7278788",
"0.71051204",
"0.70517105",
"0.70221007",
"0.6977889",
"0.695085",
"0.69462305",
"0.6934127",
"0.6934127",
"0.69137555",
"0.68918926",
"0.68918926",
"0.68918926",
"0.6843233",
"0.6823405",
"0.6629643",
"0.6592317",
"0.6468625",
"0.64653355",
"0.63409036",
"0.6307... | 0.5928577 | 39 |
What is the value of this state under the best action? Concretely, this is given by V(s) = max_{a in actions} Q(s,a) | def getValue(self, state):
util.raiseNotDefined() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bestAction(self, state):\n action = self.q_network.chooseBestAction(state)\n V = max(self.q_network.qValues(state))\n return action, V",
"def computeActionFromValues(self, state):\n \"*** YOUR CODE HERE ***\"\n maxvalue = -100000000\n bestaction = None\n for a... | [
"0.84716994",
"0.84120655",
"0.80749923",
"0.8055596",
"0.8047843",
"0.7958805",
"0.7948218",
"0.793517",
"0.793191",
"0.79309773",
"0.7922599",
"0.78731936",
"0.7823911",
"0.7782631",
"0.7779682",
"0.7756241",
"0.7725547",
"0.7699368",
"0.7654051",
"0.76425976",
"0.7629047",... | 0.0 | -1 |
Ajuste do formato da hora. Sometimes the hour need to be proper formatted to be properly sorted. | def format_hour(df):
for idx, row in enumerate(df["hour"]):
hour = row.split(":")[0]
if len(hour) == 1:
hour = "0" + hour
hour = ":".join([hour, ":".join(row.split(":")[1:])])
df.loc[idx, "hour"] = hour
df = df.drop_duplicates()
df = df.sort_values(by=["da... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_time_sortkey(self, data):\n return self.input['start_time'].time().strftime('%H%M').lstrip('0')",
"def hour(self):\n return \"%s:00:00\" % self.timestamp[:13]",
"def format_hours(self, data):\n return unicode('%f' % data).rstrip('0').rstrip('.')",
"def _hour_to_time(num: int)... | [
"0.7428555",
"0.7169935",
"0.67452866",
"0.65783674",
"0.6218645",
"0.62057626",
"0.6183872",
"0.61721796",
"0.6067026",
"0.60477567",
"0.6007966",
"0.59946567",
"0.59911484",
"0.5978819",
"0.590974",
"0.59081864",
"0.58832884",
"0.5871316",
"0.58580506",
"0.5848324",
"0.5845... | 0.6680834 | 3 |
Get the preffered rotation axis. This is determined by the config object_type name of the object rotated_x X rotation vector rotated_y Y rotation vector rotated_z Z rotation vector returns preffered rotation vector, perpendicular vector, cylindrical axis | def getPrefferedRotation(self, object_type, rotated_x, rotated_y, rotated_z):
if object_type in self.pick_up_config:
cylindrical_axis = self.pick_up_config[object_type]
else:
cylindrical_axis = None
preffered_rotation = rotated_x
rod_vector = rotated_z
i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_rotation(self) -> np.array:\n axis = self.get_arms()[1]\n force = [self.d_x, self.d_y] # \"Force applied on the arm\"\n o_m = [self.target.x_obj - axis.x_obj, self.target.y_obj - axis.y_obj]\n torque = o_m[0]*force[1] - o_m[1] * force[0] # OM vectorial F\n if torque == ... | [
"0.64827377",
"0.6309268",
"0.6157398",
"0.6139212",
"0.60712576",
"0.60517395",
"0.60392267",
"0.60216266",
"0.59888667",
"0.5976832",
"0.59553224",
"0.5913147",
"0.5913147",
"0.5913147",
"0.5913147",
"0.5913147",
"0.5913147",
"0.5913147",
"0.5913147",
"0.5913147",
"0.591314... | 0.7668015 | 0 |
r""" Transform to the Boltzmann variable. Returns the Boltzmann variable at the given `r` and `t`, which is the | def o(r, t):
return r/t**0.5 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def b_vs_r(r, t=.97):\n min_b = (np.log(1-t))/(np.log(1-.95**r))\n return min_b",
"def B(self, t):\n return np.sqrt((3 * self.eta_B * self.snr.L0 *\n YEAR_TO_SEC * self.pulsar.tau_0) /\n (self.r(t) * PC_TO_CM) ** 3 *\n (1 - (1 + (t / self.pulsa... | [
"0.63092625",
"0.6233055",
"0.60294414",
"0.6027335",
"0.5653586",
"0.5634128",
"0.56264585",
"0.5599132",
"0.54672086",
"0.54558885",
"0.54474556",
"0.5433566",
"0.5315224",
"0.52995837",
"0.52752185",
"0.5258925",
"0.5233587",
"0.5233119",
"0.52089196",
"0.5202461",
"0.5175... | 0.54687667 | 8 |
Transform back from the Boltzmann variable into `t`. | def t(o, r):
return (r/o)**2 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Boltzmann(En,T):\n ev = 1.60218e-19\n kb = 1.380e-23\n return np.exp(-En/(kb*T/ev))",
"def modb_to_td(b):\n return 2.0 * np.pi / (1.758820150E11 * b)",
"def bergman_input(self):\n return self.m_t",
"def boltzmann(deltaE, T):\n\tassert T != 0\n\tk_b = 1.3806488e-23\n\treturn math.exp(-abs(d... | [
"0.5778399",
"0.56832516",
"0.56583923",
"0.55875516",
"0.55609995",
"0.5451362",
"0.53783387",
"0.53695345",
"0.53426254",
"0.5336061",
"0.53333795",
"0.5320841",
"0.5284654",
"0.52813816",
"0.5280521",
"0.5270026",
"0.5240292",
"0.5234594",
"0.5229645",
"0.5219504",
"0.5195... | 0.50466925 | 37 |
r""" Boltzmannvariable derivative of the solution. | def d_do(self, r=None, t=None, o=None):
return self._sol(as_o(r,t,o))[1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calc_det_dzb(theta):\n return -677.96 + 19.121 * theta - 0.17315 * theta ** 2 + 0.00049335 * theta ** 3",
"def get_derivative(self,var,g=None):\n if (g==None):g=self.g\n A=np.zeros([self.n+1,self.n])\n B=np.zeros([self.n+1])\n for i in range(self.n):\n B[i]=self.gamma*2.*g*self.N*(self.n-... | [
"0.66498256",
"0.6225001",
"0.6172595",
"0.6103102",
"0.610109",
"0.60564834",
"0.5976555",
"0.59546083",
"0.5921133",
"0.5892019",
"0.5880695",
"0.58549094",
"0.5847867",
"0.5842188",
"0.5842188",
"0.5816845",
"0.5793471",
"0.5781789",
"0.5725646",
"0.57208693",
"0.57103825"... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.