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 |
|---|---|---|---|---|---|---|
A string identifying the data type. Will be used for display in, e.g. ``Series.dtype`` | def name(self):
# type: () -> str
return str(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data_type_str(self):\n return data_ref_type_str(self.data_type)",
"def typecast(dtype: Any) -> str:\n if dtype is int:\n return \"Int64\"\n elif dtype is float:\n return \"Float64\"\n elif dtype is bool:\n return \"bool\"\n return \"string\"... | [
"0.8170928",
"0.7862311",
"0.7646698",
"0.7332368",
"0.72843975",
"0.72716475",
"0.72587484",
"0.72587484",
"0.72587484",
"0.7236054",
"0.7178421",
"0.71663415",
"0.7143789",
"0.71425635",
"0.71134084",
"0.71044236",
"0.7100429",
"0.7057926",
"0.70389223",
"0.70199174",
"0.69... | 0.0 | -1 |
Length of this array | def __len__(self):
return len(self.data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __len__(self):\n return len(self.array)",
"def __len__(self):\n return len(self.array)",
"def size(self):\n return len(self.arr)",
"def getArrayLength(self):\r\n return self.arraySize",
"def __len__(self):\n return self._arr.shape[1]",
"def __len__(self):\n r... | [
"0.88697076",
"0.88697076",
"0.8568784",
"0.85674953",
"0.85121554",
"0.84302646",
"0.8242494",
"0.82212347",
"0.8191083",
"0.8191083",
"0.8191083",
"0.8160682",
"0.8160682",
"0.8119859",
"0.8119068",
"0.81132764",
"0.81072354",
"0.8098457",
"0.8090626",
"0.8078921",
"0.80748... | 0.7894373 | 62 |
Return the number of elements in the underlying data. | def size(self):
return len(self.data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count(self):\r\n return self.data_array.size",
"def size(self):\n ret = 0\n for ii in self.__data:\n ret += int(ii.get_size())\n return ret",
"def data_count(self):\n return(len(self.data))",
"def getNumData(self):\n return len(self.data)",
"def count_elements_in_data... | [
"0.85908943",
"0.84240013",
"0.841494",
"0.8210764",
"0.8093028",
"0.8047887",
"0.80380154",
"0.8034744",
"0.8028253",
"0.79156435",
"0.789435",
"0.7874148",
"0.7865271",
"0.78371",
"0.7821569",
"0.7813561",
"0.7796924",
"0.7779704",
"0.77639097",
"0.77570605",
"0.7756761",
... | 0.78437287 | 16 |
Boolean NumPy array indicating if each value is missing. This should return a 1D array the same length as 'self'. | def isna(self):
size = len(self.data)
isnull_byte_map = np.zeros(size, dtype=bool)
for i in range(size):
if self.data[i] is None:
isnull_byte_map[i] = 1
return isnull_byte_map | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isna(self):\n # type: () -> np.ndarray\n return extract_isnull_bytemap(self.data)",
"def isna(self):\n # type: () -> np.ndarray\n return extract_isnull_bytemap(self.data)",
"def data_missing():\n return RaggedArray([[], [-1, 0, 1]], dtype='int16')",
"def _nodata_mask(self):... | [
"0.74016434",
"0.74016434",
"0.6756111",
"0.65700454",
"0.6547105",
"0.6491851",
"0.64488673",
"0.6447906",
"0.6432374",
"0.64213294",
"0.63770986",
"0.636226",
"0.63351846",
"0.63128227",
"0.6284389",
"0.628389",
"0.6247779",
"0.6235008",
"0.6202572",
"0.6197546",
"0.6167118... | 0.6850717 | 2 |
Cast to a NumPy array with 'dtype' | def astype(self, dtype, copy=True):
if isinstance(dtype, ndtypes.ndt):
raise NotImplementedError(
"cast propagation in \
astype not yet implemented"
)
else:
dtype = np.dtype(dtype)
return np.asarray(self).astype(dtype) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def asarray(val, dtype=np.float64):\n # val is a list, tuple etc\n if not np.isscalar(val) and np.ndim(val) > 0:\n np_val = np.asarray(val, dtype=dtype)\n else:\n # val is a scalar number\n np_val = np.asarray([val], dtype=dtype)\n\n return np_val",
"def to_numpy(x):\r\n retur... | [
"0.72624075",
"0.72014713",
"0.71995467",
"0.71618325",
"0.710085",
"0.70915705",
"0.70541614",
"0.7033298",
"0.6930374",
"0.68656456",
"0.6856388",
"0.68353546",
"0.6813874",
"0.68079454",
"0.68029666",
"0.6798556",
"0.6761799",
"0.6750903",
"0.6703527",
"0.668972",
"0.66737... | 0.6858235 | 10 |
Construct a new ExtensionArray from a sequence of scalars. | def _from_sequence(cls, scalars):
return cls(xnd.xnd(list(scalars))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _from_sequence(cls, scalars):\n return cls(pa.array(scalars))",
"def _from_sequence(cls, scalars, dtype=None, copy=None):\n if isinstance(scalars, FletcherArray):\n return scalars\n if dtype and isinstance(dtype, FletcherDtype):\n dtype = dtype.arrow_dtype\n ... | [
"0.7350238",
"0.7182404",
"0.5925194",
"0.578319",
"0.561165",
"0.5573342",
"0.55363554",
"0.549628",
"0.54935765",
"0.54918486",
"0.5459624",
"0.54315454",
"0.5349382",
"0.5279878",
"0.5261748",
"0.5165157",
"0.51567626",
"0.5156627",
"0.5146947",
"0.5140071",
"0.5140071",
... | 0.7438445 | 0 |
Test the successful return of a list of users with their profiles. | def test_users_profile_list_return(self):
self.client.credentials(
HTTP_AUTHORIZATION='Token ' + self.login_response.data['token'])
self.response = self.client.get("/api/users/users_list/")
self.assertEqual(self.response.status_code, status.HTTP_200_OK)
self.assertIn('users',... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_list_profiles(self):\n response = self.client.get(self.url)\n self.assertEqual(response.status_code, status.HTTP_200_OK)\n self.assertEqual(len(response.data['results']), 1)",
"def test_view_all_users_profiles(self):\n self.authorize_user(self.user_login_details)\n res... | [
"0.8237166",
"0.7843827",
"0.77611274",
"0.7440431",
"0.7399832",
"0.73843527",
"0.7356723",
"0.7324195",
"0.7283967",
"0.72519284",
"0.7168515",
"0.709724",
"0.691054",
"0.69093055",
"0.68828183",
"0.6875339",
"0.6873077",
"0.6854492",
"0.6848099",
"0.6827129",
"0.6819302",
... | 0.84941363 | 0 |
Test that unauthenticated user can not access the endpoint. | def test_unauthenticated_user_denial(self):
self.response = self.client.get("/api/users/users_list/")
self.assertEqual(self.response.status_code, status.HTTP_403_FORBIDDEN)
self.assertEqual(
'Authentication credentials were not provided.', self.response.data['detail']) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_unauthenticated_resource_allowed(self):\n raise NotImplementedError # FIXME",
"def test_user_not_authorized(self):\n response = self.client.post(self.url)\n self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)",
"def noaccess(self):\n self.assertEqual(self.client.... | [
"0.81456953",
"0.80915487",
"0.7994836",
"0.7974266",
"0.7912416",
"0.7895024",
"0.78587884",
"0.7841028",
"0.7831594",
"0.78175676",
"0.78175676",
"0.77514654",
"0.76794064",
"0.7671994",
"0.7667695",
"0.7667695",
"0.7667695",
"0.7667695",
"0.7666188",
"0.7648051",
"0.764713... | 0.81329226 | 1 |
Format a time for display | def format_time(value):
if value:
time = dateutil.parser.parse(value)
# pylint: disable=E1101
return time.strftime("%I:%M%p")
else:
return '' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_time(self, time):\n hours = time // 3600\n time = time - hours*3600\n minutes = time // 60\n seconds = time - minutes*60\n return ('%d:%d:%d' %(hours, minutes, seconds))",
"def format_time(self, time):\n hh = time[0:2]\n mm = time[2:4]\n ss = tim... | [
"0.8418031",
"0.84093404",
"0.8248695",
"0.79867977",
"0.7942159",
"0.7818924",
"0.7816692",
"0.76928216",
"0.7608608",
"0.75996464",
"0.75786716",
"0.7567828",
"0.75133425",
"0.74887806",
"0.7429112",
"0.7424193",
"0.74152845",
"0.7395174",
"0.7357358",
"0.73552704",
"0.7343... | 0.78713924 | 5 |
Returns pin name of wire. For unsplit tiles, this is the name of the wire. For split tiles with only 1 site, this is the name of the site pin connected to this wire. For wires that are not a pin, returns None. | def get_pin_name_of_wire(conn, wire_pkey):
c = conn.cursor()
c.execute(
"""
SELECT wire_in_tile_pkey, tile_pkey FROM wire WHERE pkey = ?
""", (wire_pkey, )
)
wire_in_tile_pkey, tile_pkey = c.fetchone()
c.execute(
"""
SELECT site_as_tile_pkey FROM tile WHERE pkey = ?
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_pin(self) -> str:\n return self._pin",
"def get_wire_in_tile_from_pin_name(conn, tile_type_str, wire_str):\n # Find the generic wire_in_tile_pkey for the specified tile_type name and\n # wire name.\n c = conn.cursor()\n\n # Find if this tile_type is a split tile.\n c.execute(\n ... | [
"0.6594488",
"0.61665666",
"0.5766498",
"0.5750162",
"0.57163584",
"0.5713178",
"0.5642281",
"0.5625731",
"0.5603803",
"0.5602733",
"0.55686694",
"0.55492705",
"0.553697",
"0.5527082",
"0.5513342",
"0.5509373",
"0.55061746",
"0.54618746",
"0.5448286",
"0.54304475",
"0.5419778... | 0.7388332 | 0 |
Returns the contents of the file. | def get_contents(self):
return self.contents | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contents(file):\n with open(file) as f:\n return f.read()",
"def get_file_contents(filename):\n with open(filename, 'r') as f:\n content = f.read()\n return content",
"def read_content(self):\n return self.file.read()",
"def read_file(self, file):\n fd = open(file)\n ... | [
"0.84233165",
"0.8001005",
"0.77832305",
"0.7678333",
"0.76167744",
"0.75897086",
"0.7586111",
"0.75617945",
"0.75590175",
"0.7557482",
"0.7522077",
"0.74923486",
"0.7491131",
"0.7477652",
"0.7451645",
"0.7437356",
"0.74259627",
"0.74253434",
"0.74134374",
"0.7398352",
"0.739... | 0.0 | -1 |
A method to drop rows from a DF given the index to keep and those of all the duplicate rows for a peak. | def drop_duplicates(self, dup_indexes, keep_index, peak_df):
dup_indexes.remove(keep_index)
for index_to_drop in dup_indexes:
print("dropping this")
display(peak_df.loc[[index_to_drop]])
peak_df = peak_df.drop(index_to_drop)
return peak_df | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def discard_duplicate_rows(df: pd.DataFrame) -> None:\n logging.info('Discarding duplicate rows')\n num_rows_before = len(df)\n df.drop_duplicates(inplace=True)\n num_rows_after = len(df)\n num_dups_found = num_rows_before - num_rows_after\n if num_dups_found > 0:\n logging.warning(f'{num_... | [
"0.65247035",
"0.6363891",
"0.63022333",
"0.6241097",
"0.61256933",
"0.5994911",
"0.5928844",
"0.58999646",
"0.58847857",
"0.58363986",
"0.58298856",
"0.58038944",
"0.577985",
"0.5767388",
"0.57611185",
"0.5709669",
"0.57017154",
"0.56906784",
"0.56683886",
"0.563273",
"0.560... | 0.76865387 | 0 |
Choose a standard compound based on the one which matches the name of the FrAnk annotation most closely. | def select_standard_cmpd(self, sid_df, standard_cmpds):
print ("selecting standard compound")
new_row = None
display(standard_cmpds)
name_match_dic = {}
# For each of the standard compounds identified for the peak
for i in standard_cmpds['identifier'].unique():
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _is_compound_of(entry: _LexiconEntry) -> str:\n return entry[\"is_compound\"].lower()",
"def getlabel(scores):\n main_score = scores['compound']\n if main_score > 0.1:\n return 'pos'\n elif main_score < -0.1:\n return 'neg'\n else:\n return 'neu'",
"def surface_or_abstract... | [
"0.5417017",
"0.51523066",
"0.4860653",
"0.4835405",
"0.48096776",
"0.4792644",
"0.47313273",
"0.47253352",
"0.46857738",
"0.467569",
"0.4671355",
"0.46706206",
"0.4664007",
"0.46483254",
"0.45594722",
"0.45584187",
"0.45564082",
"0.454979",
"0.45439628",
"0.4518412",
"0.4509... | 0.4688043 | 8 |
Gets the ID of club entity that we're joining | def getID(self):
return self.__clubDbID | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getCountryClubId(self):\n return self.countryClubId",
"def club_id(self, club_name):\r\n # UTF-8 comparison\r\n headers = {\"Content-type\": \"application/x-www-form-urlencoded\", \"Accept\": \"text/plain\",\r\n 'Referer': 'http://' + self.domain + '/', \"User-Agent\": ... | [
"0.64245063",
"0.62600726",
"0.6127675",
"0.59417766",
"0.59417766",
"0.59417766",
"0.59417766",
"0.59417766",
"0.5920782",
"0.5836426",
"0.57591325",
"0.5717022",
"0.56990856",
"0.56990856",
"0.56990856",
"0.56990856",
"0.56990856",
"0.56990856",
"0.56990856",
"0.56990856",
... | 0.6805473 | 0 |
Plot trajectory for single animal over period. | def bar_plot(trj: TrajaDataFrame, bins: Union[int, tuple] = None, **kwargs) -> Axes:
# TODO: Add time component
bins = traja.trajectory._bins_to_tuple(trj, bins)
X, Y, U, V = coords_to_flow(trj, bins)
hist, _ = trip_grid(trj, bins, hist_only=True)
fig = plt.figure()
ax = fig.add_subplot(111, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_single_trajectory(self):\n\n plt.plot(self.trip_centroids['lon'], self.trip_centroids['lat'], '-o')",
"def trajectory_plotter(trajectories, title = \"Trajectories\"):\r\n\r\n fig = plt.figure()\r\n ax = fig.add_subplot(projection=\"3d\")\r\n\r\n ax.set_xlabel('X')\r\n ax.set_ylabel('Y... | [
"0.66793895",
"0.6651571",
"0.64615256",
"0.63502246",
"0.63131243",
"0.6300293",
"0.61842453",
"0.6165123",
"0.6128747",
"0.6106654",
"0.6054732",
"0.6031158",
"0.6026553",
"0.60228103",
"0.60154575",
"0.60098654",
"0.5993065",
"0.5989462",
"0.59496844",
"0.5946391",
"0.5944... | 0.0 | -1 |
Plot trajectory for single animal over period. | def plot(
trj: TrajaDataFrame,
n_coords: Optional[int] = None,
show_time: bool = False,
accessor: Optional[traja.TrajaAccessor] = None,
ax=None,
**kwargs,
) -> matplotlib.collections.PathCollection:
import matplotlib.patches as patches
from matplotlib.path import Path
after_plot_arg... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_single_trajectory(self):\n\n plt.plot(self.trip_centroids['lon'], self.trip_centroids['lat'], '-o')",
"def trajectory_plotter(trajectories, title = \"Trajectories\"):\r\n\r\n fig = plt.figure()\r\n ax = fig.add_subplot(projection=\"3d\")\r\n\r\n ax.set_xlabel('X')\r\n ax.set_ylabel('Y... | [
"0.66777134",
"0.6651562",
"0.64616317",
"0.634923",
"0.63133115",
"0.6298848",
"0.61831796",
"0.61646396",
"0.6127904",
"0.6106606",
"0.60532546",
"0.6031092",
"0.6025849",
"0.6023147",
"0.6014494",
"0.6008613",
"0.5994614",
"0.5987358",
"0.59483",
"0.5946726",
"0.5944228",
... | 0.5578266 | 68 |
Converts a string argument to a byte string. If the argument is already a byte string or None, it is returned unchanged. Otherwise it must be a unicode string and is encoded as utf8. | def utf8(value):
if isinstance(value, (bytes, type(None))):
return value
if not isinstance(value, unicode_type):
raise TypeError(
"Expected bytes, unicode, or None; got %r" % type(value)
)
return value.encode("utf-8") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def give_me_bytes(string):\n return string.encode('utf8') if isinstance(string, str) else string",
"def unicode2utf8(arg):\n\n try:\n if isinstance(arg, unicode):\n return arg.encode('utf-8')\n except NameError:\n pass # Python 3\n return arg",
"def _to_bytes(value: Union[... | [
"0.80326253",
"0.7813401",
"0.76934886",
"0.76233983",
"0.7555012",
"0.7535237",
"0.75086457",
"0.745254",
"0.7449655",
"0.74415",
"0.7406604",
"0.72742164",
"0.72495484",
"0.7248803",
"0.7212638",
"0.7140547",
"0.71323127",
"0.71291935",
"0.7126722",
"0.7095218",
"0.70831263... | 0.7623582 | 3 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, HostVulInfoAppList):
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.808826",
"0.808826",
"0.8054592",
"0.79827315",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"... | 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 |
Get the uri of Artifact from a list of length one. | def get_single_uri(artifact_list: List[Artifact]) -> Text:
return get_single_instance(artifact_list).uri | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_split_uri(artifact_list: List[Artifact], split: Text) -> Text:\n return _get_split_instance(artifact_list, split).uri",
"def get_single_instance(artifact_list: List[Artifact]) -> Artifact:\n if len(artifact_list) != 1:\n raise ValueError('expected list length of one but got {}'.format(\n len(... | [
"0.6694992",
"0.6678573",
"0.6036447",
"0.57635313",
"0.5733404",
"0.57188797",
"0.57050806",
"0.5506731",
"0.54937464",
"0.5459528",
"0.5424566",
"0.5384717",
"0.5369287",
"0.5325053",
"0.5313212",
"0.52798706",
"0.5239682",
"0.5219548",
"0.50673246",
"0.5066369",
"0.5050734... | 0.8574332 | 0 |
Gets the dbt version. | def dbt_version(self):
from dbt.version import get_installed_version
self.dbt_version = get_installed_version().to_version_string()
return self.dbt_version | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def version(self):\n response = self._request_call('/version')\n return response.version_etcdserver",
"def version():\n return Tns.exec_command(command='--version')",
"def get_version():\n return __version__",
"def get_version():\n return __version__",
"def get_version():\n re... | [
"0.7145694",
"0.7125913",
"0.7120701",
"0.7120701",
"0.7120701",
"0.70801204",
"0.70801204",
"0.70779526",
"0.705302",
"0.7039336",
"0.7022879",
"0.70223117",
"0.70012116",
"0.70012116",
"0.6933615",
"0.69303304",
"0.68409157",
"0.68354994",
"0.67538184",
"0.6747352",
"0.6744... | 0.8455315 | 0 |
Get the dbt project directory from the configuration. Defaults to the working directory. | def _get_project_dir(self):
return os.path.expanduser(
self.sqlfluff_config.get_section(
(self.templater_selector, self.name, "project_dir")
)
or os.getcwd()
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_project_dir():\n path = Path(__file__).parent.parent\n project_dir = path.parent\n return project_dir",
"def get_project_dir():\n\n return Path(settings.PROJECT_DIR)",
"def set_working_dir():\n cwd = os.getcwd()\n nwd = cwd[:cwd.find(config.project)+len(config.project)]\n os.chdir(... | [
"0.76650935",
"0.75579333",
"0.7509792",
"0.75066334",
"0.74863327",
"0.728954",
"0.7167732",
"0.7150337",
"0.69681174",
"0.6966489",
"0.6945919",
"0.69238085",
"0.6923453",
"0.6867748",
"0.68591374",
"0.681492",
"0.681492",
"0.68107915",
"0.67870337",
"0.67672306",
"0.676606... | 0.77256685 | 0 |
Computes the accuracy over the k top predictions for the specified values of k | def accuracy(output, target, topk=(1,)):
with torch.no_grad():
maxk = max(topk)
batch_size = target.size(0)
_, pred = output.topk(maxk, 1, True, True)
pred = pred.t()
correct = pred.eq(target.view(1, -1).expand_as(pred))
res = []
for k in topk:
c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def topk_accuracy(y, y_pred, k=2):\n pred = []\n for i in range(len(y)):\n if y[i] in y_pred[i][:k]:\n pred.append(1)\n else:\n pred.append(0)\n return sum(pred) / len(pred)",
"def accuracy(y_pred, y_actual, topk=(1, )):\n maxk = max(topk)\n batch_size = y_actua... | [
"0.8331214",
"0.8284662",
"0.82381004",
"0.8229767",
"0.82202226",
"0.81864446",
"0.81847763",
"0.8175173",
"0.8171541",
"0.81699467",
"0.81664646",
"0.81645083",
"0.81637454",
"0.81622064",
"0.81622064",
"0.81622064",
"0.81622064",
"0.81622064",
"0.81622064",
"0.81622064",
"... | 0.7847017 | 92 |
Single number string should be converted to value. | def test_single_value(self, test_input, expected, sc):
assert sc.add(test_input) == expected | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def StringToValue(self, s, flags):\n try:\n v = int(s)\n if self.GetValue() != v:\n return (True, v)\n except (ValueError, TypeError):\n if flags & wxpg.PG_REPORT_ERROR:\n wx.MessageBox(\"Cannot convert '%s' into a number.\" % s, \"Error\... | [
"0.71264195",
"0.70858926",
"0.69701576",
"0.69429284",
"0.69373137",
"0.68939006",
"0.68939006",
"0.685865",
"0.68324894",
"0.67340624",
"0.6712292",
"0.67089546",
"0.65752494",
"0.65564555",
"0.65477663",
"0.6542622",
"0.65319824",
"0.65306616",
"0.652247",
"0.65082407",
"0... | 0.0 | -1 |
Saves parameters to json file | def save(self, json_path):
with open(json_path, 'w') as f:
json.dump(self.__dict__, f, indent=4) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_json(self, path=None):\n if path is None:\n path = self.parampath\n\n params = {str(key): str(value) for key, value in self.__dict__.items()}\n # with open(f'{path}/params_{self.mode}.json', 'w') as f:\n with open(os.path.join(path, f'params_{self.mode}.json'), 'w') ... | [
"0.82312053",
"0.8181947",
"0.8057166",
"0.7808885",
"0.77812463",
"0.775106",
"0.7710382",
"0.7706769",
"0.76148814",
"0.75990826",
"0.7574917",
"0.75643057",
"0.7448175",
"0.7373087",
"0.7341731",
"0.7261098",
"0.719621",
"0.7154501",
"0.714766",
"0.7143015",
"0.71297264",
... | 0.6701761 | 62 |
Construct initial conditions for lfilter for step response steadystate. Compute an initial state `zi` for the `lfilter` function that corresponds to the steady state of the step response. A typical use of this function is to set the initial state so that the output of the filter starts at the same value as the first el... | def lfilter_zi(b, a):
# FIXME: Can this function be replaced with an appropriate
# use of lfiltic? For example, when b,a = butter(N,Wn),
# lfiltic(b, a, y=numpy.ones_like(a), x=numpy.ones_like(b)).
#
# We could use scipy.signal.normalize, but it uses warnings in
# cases where a ValueError ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_initial_state(self, x_init):\n assert isinstance(x_init, np.ndarray)\n # Get the initial condition of the filter\n zi = signal.lfilter_zi(self.b, self.a) # dim = order of the filter = 1\n # Set the filter state\n self.z = np.outer(zi, x_init)",
"def lowpass_filter_rese... | [
"0.7032643",
"0.6021594",
"0.5773026",
"0.5741071",
"0.5474929",
"0.54529476",
"0.52769065",
"0.52764946",
"0.52715707",
"0.5255074",
"0.5245324",
"0.5220993",
"0.5098176",
"0.5048571",
"0.5022408",
"0.50180316",
"0.5001296",
"0.49854076",
"0.49851388",
"0.4942927",
"0.493341... | 0.45731252 | 64 |
Forwardbackward IIR filter that uses Gustafsson's method. Apply the IIR filter defined by `(b,a)` to `x` twice, first forward then backward, using Gustafsson's initial conditions [1]_. Let ``y_fb`` be the result of filtering first forward and then backward, and let ``y_bf`` be the result of filtering first backward the... | def _filtfilt_gust(b, a, x, axis=-1, irlen=None):
# In the comments, "Gustafsson's paper" and [1] refer to the
# paper referenced in the docstring.
b = np.atleast_1d(b)
a = np.atleast_1d(a)
order = max(len(b), len(a)) - 1
if order == 0:
# The filter is just scalar multiplication, with ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fc_forward(x, w, b):\n out = None\n ###########################################################################\n # TODO: Implement the forward pass. Store the result in out. #\n ###########################################################################\n out = np.dot(x, w) + b\n ... | [
"0.63200927",
"0.6171222",
"0.6026708",
"0.60242057",
"0.6008347",
"0.59686536",
"0.5937913",
"0.5900663",
"0.5816148",
"0.5654618",
"0.5623432",
"0.55986273",
"0.5569046",
"0.55684686",
"0.5502139",
"0.5495101",
"0.5487408",
"0.5486265",
"0.54790324",
"0.5476043",
"0.5463220... | 0.65092564 | 0 |
Format a timedelta into a humanfriendly string. | def format_timedelta(timedelta):
seconds = timedelta.total_seconds()
days, rmainder = divmod(seconds, 60 * 60 * 24)
hours, rmainder = divmod(rmainder, 60 * 60)
minutes, rmainder = divmod(rmainder, 60)
seconds = rmainder
timestring = ''
if days > 0:
timestring += '%dd ' % days
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timedelta_nice_repr(timedelta, display='long', sep=', '):\n if not isinstance(timedelta, datetime.timedelta):\n raise TypeError('First argument must be a timedelta.')\n result = []\n weeks = int(timedelta.days / 7)\n days = timedelta.days % 7\n hours = int(timedelta.seconds / 3600)\n m... | [
"0.77723676",
"0.76607543",
"0.762818",
"0.73419565",
"0.7202255",
"0.7108916",
"0.70849556",
"0.7073843",
"0.7036123",
"0.7018252",
"0.7017238",
"0.6976021",
"0.69339114",
"0.69047356",
"0.6893588",
"0.6883069",
"0.68343514",
"0.67669547",
"0.6760717",
"0.67505556",
"0.66786... | 0.7566095 | 3 |
Format a time span into a humanfriendly string. | def format_span(start, end):
time_string = start.strftime('%m/%d/%Y %H:%M:%S - ')
time_string += end.strftime('%H:%M:%S')
return time_string | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_time(t: float):\n if t >= 60:\n return f\"{round(t / 60.0, 2)} mins\"\n else:\n return f\"{round(t, 2)} secs\"",
"def format_time(t):\n m, s = divmod(t, 60)\n h, m = divmod(m, 60)\n if h:\n return f\"{h:2.0f}hr {m:2.0f}min {s:4.1f}s\"\n elif m:\n return f\... | [
"0.6638713",
"0.6583312",
"0.65616876",
"0.651444",
"0.64904475",
"0.6479359",
"0.64139974",
"0.6395044",
"0.63763905",
"0.6351688",
"0.63433737",
"0.63231444",
"0.6321622",
"0.6319888",
"0.631667",
"0.62895375",
"0.62303764",
"0.6216116",
"0.6179851",
"0.6170669",
"0.6170237... | 0.75956345 | 0 |
Assert that peptide sequence only contains valid symbols. | def is_legit_peptide_sequence(record_seq: str) -> bool:
aas = {
"A",
"C",
"D",
"E",
"F",
"G",
"H",
"I",
"K",
"L",
"M",
"N",
"P",
"Q",
"R",
"S",
"T",
"V",
"W",
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate(data, badchars):\n assert(all(b not in data for b in badchars))",
"def isValidPeptide(self, sequence):\n for position, disallowedAAs in self._rules.iteritems():\n nextAA = sequence[position - 1].upper()\n if nextAA in disallowedAAs:\n return False\n ... | [
"0.6565036",
"0.64590997",
"0.6323804",
"0.62964374",
"0.6238537",
"0.6238537",
"0.62147486",
"0.6213494",
"0.6171131",
"0.61430746",
"0.6120542",
"0.60339886",
"0.6021188",
"0.5990329",
"0.5965872",
"0.5927269",
"0.588844",
"0.5873576",
"0.5868379",
"0.58543175",
"0.58492625... | 0.5314951 | 85 |
Assert that DNA sequence only contains valid symbols. | def is_legit_DNA_sequence(record_seq: str) -> bool:
nts = {"A", "G", "T", "C", "N"}
seq_symbols = {s.upper() for s in record_seq}
return seq_symbols.issubset(nts) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate(data, badchars):\n assert(all(b not in data for b in badchars))",
"def test_should_raise_in_case_of_wrong_characters(self):\n validator = CharCombinationValidator()\n\n regex = re.compile(r'[\\(\\[\\{]\\)\\]\\}')\n forbidden_chars = regex.sub('', punctuation)\n for cha... | [
"0.69303834",
"0.6763284",
"0.66415906",
"0.66238123",
"0.6582187",
"0.6570025",
"0.6552528",
"0.64736414",
"0.64573836",
"0.6400359",
"0.6362274",
"0.63191116",
"0.63155955",
"0.63146573",
"0.62954974",
"0.628502",
"0.62770355",
"0.62732005",
"0.6248555",
"0.619243",
"0.6192... | 0.0 | -1 |
Performs padding for the list of tensors. | def pad_list(xs: torch.Tensor, pad_value: int):
n_batch = len(xs)
max_len = max(x.size(0) for x in xs)
pad = xs[0].new(n_batch, max_len, *xs[0].size()[1:]).fill_(pad_value)
for i in range(n_batch):
pad[i, : xs[i].size(0)] = xs[i]
return pad | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pad_and_cat(tensors, padding):\n n_tensors = [len(ts) for ts in tensors]\n pad_size = max(n_tensors)\n\n # pad to has same number of operands for each problem\n tensors = [ts + (pad_size - len(ts)) * [padding]\n for ts in tensors]\n\n # tensors.size() = (batch_size, pad_size, dim_h... | [
"0.73704475",
"0.7338566",
"0.73259455",
"0.71354586",
"0.7108747",
"0.6976042",
"0.6847556",
"0.67829055",
"0.66107386",
"0.6595525",
"0.657188",
"0.6563072",
"0.6560154",
"0.65475124",
"0.6534839",
"0.65250087",
"0.6519585",
"0.65166515",
"0.64960134",
"0.64924383",
"0.6488... | 0.7086067 | 5 |
Creates dataset for training | def __init__(self, x, y, n, shuffleAfterEpoch=True):
self.shuffleAfterEpoch = shuffleAfterEpoch
self.x = x
self.y = y
self.index = 0
self.n = n
self.subX = []
self.subY = []
self.sameBatch = True
self.batchStart ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_dataset():\n\n\tnumberOfTrials = dataset_params.num_of_samples\n\tnumberOfTrials_train = int(numberOfTrials*0.8)\n\tnumberOfTrials_test = int(numberOfTrials*0.2)\n\n\tprint(\"==================================================\")\n\tprint(\"1. Generating Train images ......\")\n\tprint(\"\\nTrain image per... | [
"0.80415595",
"0.79590386",
"0.756445",
"0.74865973",
"0.74819845",
"0.74757904",
"0.74376166",
"0.74369645",
"0.7394728",
"0.7381261",
"0.7371115",
"0.73706275",
"0.73533183",
"0.7313135",
"0.7310101",
"0.7304001",
"0.72870475",
"0.72832793",
"0.7265336",
"0.7251944",
"0.723... | 0.0 | -1 |
Name of the template. | def template_name(self):
raise NotImplementedError('template_name must be defined') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inspect_template_name(self) -> str:\n return pulumi.get(self, \"inspect_template_name\")",
"def template_name(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"template_name\")",
"def getNameTemplate(self):\n\n return self.nameTemplate",
"def template_name(self) -> pulumi.Outpu... | [
"0.8503216",
"0.842787",
"0.8359827",
"0.8345027",
"0.81483734",
"0.75944674",
"0.7592048",
"0.7592048",
"0.758043",
"0.73846203",
"0.7362201",
"0.7316545",
"0.7288355",
"0.7237161",
"0.7196626",
"0.7196293",
"0.7154887",
"0.7057262",
"0.6999352",
"0.6959105",
"0.69427884",
... | 0.88806194 | 0 |
Return canonical form of filename. For real filenames, the canonical form is a casenormalized (on case insensitive filesystems) absolute path. 'Filenames' with angle brackets, such as "", generated in interactive mode, are returned unchanged. | def canonic(self, filename):
if filename == "<" + filename[1:-1] + ">":
return filename
canonic = self.fncache.get(filename)
if not canonic:
canonic = os.path.abspath(filename)
canonic = os.path.normcase(canonic)
self.fncache[filename] = canonic
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def canonical_filename(filename):\n import os, os.path\n\n path = from_posix(filename)\n while True:\n path = os.path.abspath(path)\n try:\n p = os.path.dirname(path)\n # os.readlink doesn't exist in windows python2.7\n try:\n deref_path = os.readlink(path)\n except AttributeErr... | [
"0.7585273",
"0.70930815",
"0.69635314",
"0.6745768",
"0.67102647",
"0.64551646",
"0.6319798",
"0.6228791",
"0.6202106",
"0.6176385",
"0.61737037",
"0.61678934",
"0.61673635",
"0.6132709",
"0.6073931",
"0.6066517",
"0.60429406",
"0.6013058",
"0.6009444",
"0.60043764",
"0.5982... | 0.6410635 | 6 |
Return all lines with breakpoints for filename. If no breakpoints are set, return an empty list. | def get_file_breaks(self, filename):
filename = self.canonic(filename)
if filename in self.breaks:
return self.breaks[filename]
else:
return [] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_breakpoints(self, filename=None, lineno=None):\r\n if filename is None:\r\n return self.bpoints.items()\r\n if lineno is None:\r\n return self.bpoints.filter( keys=('filename',),\r\n values=(filename,) )\r\n else:\r\n ... | [
"0.7383101",
"0.636505",
"0.61353457",
"0.60737354",
"0.59970886",
"0.5882054",
"0.58403075",
"0.5667144",
"0.5625614",
"0.5588128",
"0.55685806",
"0.5556824",
"0.55278546",
"0.5520582",
"0.55112535",
"0.5509692",
"0.5492264",
"0.549223",
"0.5489187",
"0.54844314",
"0.5480767... | 0.6807635 | 1 |
A wrapper on sklearn's evaluator which returns the results into a nice `pandas` Dataframe format | def evalute_prf(predictions: Dict, labels: List[str]):
y_true, y_pred = [], []
for k, v in predictions.items():
if v['True Label'] in labels:
y_true.extend([v['True Label']] * len(v['Predictions']))
y_pred.extend(v['Predictions'])
p, r, f1, s = precision_recall_fscore_suppo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_to_data_frame(result, exp_name, nets, critic, loss, seed):\n label = \"{}, {}, {}\".format(nets, critic, loss)\n rows = list(\n zip(\n itertools.repeat(exp_name),\n itertools.repeat(nets),\n itertools.repeat(critic),\n itertools.repeat(loss),\n iterto... | [
"0.69360065",
"0.6641997",
"0.620042",
"0.61570156",
"0.613275",
"0.6068549",
"0.6037571",
"0.6021548",
"0.60174704",
"0.5868568",
"0.58401",
"0.5830864",
"0.58220214",
"0.5818702",
"0.5800076",
"0.5788648",
"0.5780096",
"0.5764063",
"0.5761641",
"0.5759701",
"0.57406753",
... | 0.54440075 | 62 |
Return a string representation of the bitmap's pixels. | def __repr__(self):
rows = ''
for y in range(self.height):
for x in range(self.width):
rows += '*' if self.pixels[y * self.width + x] else ' '
rows += '\n'
return rows | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getPixels(self):\n self._logger.debug(\"getPixels\")",
"def __repr__(self):\r\n out = \"\"\r\n for x in range(0, self.width):\r\n for y in range(0, self.height):\r\n out += str(\"{:.1f}\".format(self.tiles[x][y])).rjust(6,' ')\r\n out += \"\\n\"\r\n ... | [
"0.6233989",
"0.61053455",
"0.6088202",
"0.60603136",
"0.6036789",
"0.59823155",
"0.5893808",
"0.5883536",
"0.5866404",
"0.5854719",
"0.5811766",
"0.57992077",
"0.5771727",
"0.5758332",
"0.5757699",
"0.5713861",
"0.57050276",
"0.56222796",
"0.5612865",
"0.5589039",
"0.5580806... | 0.640616 | 0 |
Check if the bitmap is fully black (total height and width) | def is_black( self, font_max_width, font_max_height ):
if (self.width != font_max_width) or (self.height != font_max_height):
return False
for bit in self.pixels:
if not(bit):
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contains_black(image):\n extrema = ImageStat.Stat(image).extrema\n r = extrema[0][0]\n g = extrema[1][0]\n b = extrema[2][0]\n\n if r == 0 and g == 0 and b == 0:\n return True\n\n return False",
"def blank_img_check(url):\n img = data_convert_image(url)\n h, w = img.shape\n ... | [
"0.7774197",
"0.6976498",
"0.6874269",
"0.67914265",
"0.6685844",
"0.6629294",
"0.644429",
"0.6423006",
"0.6375097",
"0.636757",
"0.636757",
"0.6271395",
"0.61988735",
"0.6164749",
"0.613162",
"0.6094138",
"0.6056243",
"0.6048958",
"0.5981879",
"0.59615207",
"0.58979446",
"... | 0.7603252 | 1 |
Construct and return a Glyph object from a FreeType GlyphSlot. | def from_glyphslot(slot):
pixels = GlyphDecoder.unpack_mono_bitmap(slot.bitmap)
width, height = slot.bitmap.width, slot.bitmap.rows
return GlyphDecoder(pixels, width, height) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_glyphslot(char, slot):\n pixels = Glyph.unpack_mono_bitmap(slot.bitmap)\n width, height = slot.bitmap.width, slot.bitmap.rows\n top = slot.bitmap_top\n\n # The advance width is given in FreeType's 26.6 fixed point format,\n # which means that the pixel values are multipl... | [
"0.7961057",
"0.57016915",
"0.56690794",
"0.5349367",
"0.53132254",
"0.5270089",
"0.522534",
"0.5216988",
"0.5152464",
"0.51194143",
"0.51083726",
"0.5107212",
"0.51010185",
"0.50698286",
"0.50342345",
"0.50262636",
"0.49323416",
"0.49297082",
"0.49011374",
"0.4865927",
"0.48... | 0.74135077 | 1 |
Apply a transformation to an axis aligned bounding box. The result is a new AABB in the same coordinate system as the original AABB. The new AABB contains all corner points of the original AABB after applying the given transformation. Arguments | def apply_transform_aabb(transform, aabb):
x1, y1, x2, y2 = aabb
# Transform all 4 corners of the AABB.
points = transform.dot([
[x1, x2, x1, x2],
[y1, y2, y2, y1],
[1, 1, 1, 1 ],
])
# Extract the min and max corners again.
min_corner = points.min(axis=1)
max_corn... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_transform(self):\n\n self.a = self.scale * self.pixel_size * math.cos(self.angle)\n self.d = self.scale * self.pixel_size * math.sin(self.angle)\n self.b = self.d\n self.e = -self.a\n self.c = self.point.x() - self.a*self.width/2.0 - self.b*self.height/2.0\n sel... | [
"0.5993216",
"0.5780909",
"0.5768768",
"0.5743269",
"0.55341667",
"0.5510269",
"0.5494402",
"0.5352737",
"0.52365863",
"0.51920664",
"0.51549",
"0.509332",
"0.50885874",
"0.5083554",
"0.5083312",
"0.5074581",
"0.50669986",
"0.50400835",
"0.50364906",
"0.5030839",
"0.5024302",... | 0.67207336 | 0 |
Test that we have the correct orientation for 3D mesh. | def crss(nds):
cross_product = []
nds = nodes[:, array(nds) - 1]
for i, j, k, l in zip([2, 3, 1, 4, 6, 7, 5, 8], [4, 1, 3, 2, 8, 5, 7, 6],
[5, 6, 8, 7, 1, 2, 4, 3], [1, 2, 4, 3, 5, 6, 8, 7]):
p1 = nds[:, i - 1]
p2 = nds[:, j - 1]
p3 = nds[:, k - 1]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_x_y_and_z_rot(self):\n\n axis = Vec3(4, 5, 6)\n # Create a Matrix representing a rotation.\n mat = Matrix44.from_axis_angle_deg(axis, 45.0)\n # Use from_matrix44()\n quat = Quat.from_matrix44(mat)\n\n # Ensure it matches the expected quaternion.\n expected_... | [
"0.66907644",
"0.65344775",
"0.64866644",
"0.64775765",
"0.635225",
"0.6186914",
"0.61645645",
"0.6123289",
"0.6066205",
"0.6064173",
"0.6039344",
"0.6009261",
"0.59722024",
"0.59441614",
"0.58758104",
"0.5860983",
"0.58420926",
"0.584001",
"0.57968104",
"0.5790933",
"0.57800... | 0.0 | -1 |
Tri un queryset par rapport au def __unicode__ de chaque objets. Retourne une liste python, pas un queryset. | def sort_queryset(queryset):
objects = list(queryset)
my_cmp = lambda x, y: cmp(str(x), str(y))
objects.sort(my_cmp)
return objects | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def objects_to_choices(queryset):\n res = []\n for elm in queryset:\n res.append((elm.pk, unicode(elm)))\n return res",
"def __unicode__(self): \n return str(self.queryset)",
"def querySet_to_list(qs):\n return [dict(q) for q in qs]",
"def get_questions(self, obj):\n queryse... | [
"0.70968956",
"0.6741115",
"0.6254498",
"0.5864133",
"0.5862209",
"0.58416355",
"0.5731505",
"0.5717065",
"0.57003266",
"0.565199",
"0.5644098",
"0.5628487",
"0.56271607",
"0.56271607",
"0.55429447",
"0.5528571",
"0.5502742",
"0.5465159",
"0.54650456",
"0.54631305",
"0.545972... | 0.0 | -1 |
Retrun age of employee | def get_age(self, name=None):
now = datetime.now()
delta = relativedelta(now, self.date_of_birth)
years_months_days = str(delta.years) + 'y ' + str(delta.months) + \
'm ' + str(delta.days) + 'd'
return years_months_days | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_age(self):\n\t\treturn self.age",
"def _get_age(self):\n for employee in self:\n if employee.sudo().birthday:\n employee.age = relativedelta(\n fields.Date.from_string(fields.Date.today()),\n fields.Date.from_string(employee.sudo().bi... | [
"0.78343093",
"0.7780342",
"0.7756065",
"0.77246886",
"0.76102054",
"0.75961936",
"0.74387103",
"0.7418841",
"0.7412204",
"0.7412204",
"0.7412204",
"0.73868626",
"0.7370561",
"0.73587114",
"0.73402995",
"0.73250574",
"0.73189145",
"0.72657144",
"0.7245541",
"0.72433716",
"0.7... | 0.7532154 | 6 |
Get the due date in datetime format | def get_due_date(self) -> datetime.datetime:
if self.borrow_date:
return self.borrow_date + datetime.timedelta(days=4 * 7)
else:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def due_date(self) -> date:\n return self._due_date",
"def get_due_date(self):\n return self.created_at + self.urgency_level.duration",
"def get_inbound_statement_details_payment_terms_due_date(self):\n return self.get_text_from_element(self.inbound_statements_details_payment_terms_due_dat... | [
"0.78906375",
"0.78834194",
"0.7153348",
"0.7092116",
"0.7023346",
"0.66670465",
"0.6626673",
"0.6591438",
"0.65586597",
"0.6511818",
"0.64915997",
"0.6456736",
"0.6456193",
"0.64521253",
"0.6422806",
"0.6335825",
"0.63243085",
"0.6323519",
"0.6301096",
"0.6301096",
"0.630109... | 0.7597051 | 2 |
get all calculated_calculated concentrations by analysis_id and calculated_concentration_units from analysis ID | def get_allCalculatedConcentrations_analysisIDAndUnits_dataStage02GlogNormalized(self, analysis_id_I,concentration_units_I):
#Tested
try:
data = self.session.query(
data_stage02_quantification_glogNormalized.calculated_concentration).filter(
data_stage... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_allCalculatedConcentrations_analysisIDAndUnits_dataStage02QuantificationDataPreProcessingReplicates(self, analysis_id_I,concentration_units_I):\n #Tested\n try:\n data = self.session.query(\n data_stage02_quantification_dataPreProcessing_replicates.calculated_con... | [
"0.7162613",
"0.68476903",
"0.6752006",
"0.6683399",
"0.66714275",
"0.6462583",
"0.5874923",
"0.5613554",
"0.5523357",
"0.5503766",
"0.5471785",
"0.54066485",
"0.5320807",
"0.5307685",
"0.52459073",
"0.5201571",
"0.51649505",
"0.5096715",
"0.50874203",
"0.50873196",
"0.505260... | 0.70165676 | 1 |
Returns a timestamp (str) with the current time. | def get_timestamp(format=config.time["format_sec"], zone=config.time["zone"]):
zone = pytz.timezone(zone)
ts = zone.localize(datetime.datetime.now())
return ts.strftime(format) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_current_timestamp_str(self):\n return str(time.mktime(datetime.datetime.now().timetuple()))",
"def timestamp():\n return datetime.now().strftime(\"%Y%m%dT%H%M%S\")",
"def timestamp_now():\n return datetime.now().strftime(\"%A, %B %d, %Y, %I:%M %p\")",
"def getTimeStamp(self):\n\n\t\t... | [
"0.906371",
"0.85514706",
"0.8534162",
"0.8467712",
"0.8440766",
"0.84330547",
"0.8397142",
"0.8386568",
"0.8360851",
"0.8360851",
"0.82711256",
"0.82680434",
"0.82563066",
"0.82427406",
"0.82190543",
"0.8216528",
"0.82146263",
"0.82130355",
"0.81927985",
"0.8135484",
"0.8132... | 0.0 | -1 |
Calculates the layerwise penalty encouraging orthogonality. | def orthogonality(weight):
with tf.name_scope(None, "orthogonality", [weight]) as name:
w2 = tf.matmul(weight, weight, transpose_b=True)
wn = tf.norm(weight, ord=2, axis=1, keepdims=True) + 1e-32
correlation_matrix = w2 / tf.matmul(wn, wn, transpose_b=True)
# print(tf.matmul(wn, wn, transpos... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_orthogonality_regularizer(orthogonality_penalty_weight):\n def orthogonality(weight):\n \"\"\"Calculates the layer-wise penalty encouraging orthogonality.\"\"\"\n with tf.name_scope(None, \"orthogonality\", [weight]) as name:\n w2 = tf.matmul(weight, weight, transpose_b=True)\n wn = tf.nor... | [
"0.69200915",
"0.6353696",
"0.6278551",
"0.6172562",
"0.59301263",
"0.59207624",
"0.58558095",
"0.58037406",
"0.57302594",
"0.5674434",
"0.56275505",
"0.56165236",
"0.55922383",
"0.5579428",
"0.5538275",
"0.55350715",
"0.55337864",
"0.54824656",
"0.5415079",
"0.540698",
"0.53... | 0.61121196 | 4 |
A bit of hackery to get the first name and last name at the top of the form instead at the end. | def __init__(self, *args, **kw):
super(SignupFormExtra, self).__init__(*args, **kw) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_form_label_first_last(self):\n self.user.first_name = 'Full'\n self.user.last_name = 'Name'\n self.assertEqual(\n self.user.get_form_label(email=True),\n 'Full Name (testuser) <testuser@example.com>',\n )",
"def get_full_name(self):\n full_name = ... | [
"0.6801476",
"0.6762489",
"0.6628234",
"0.6617115",
"0.6600809",
"0.65938073",
"0.6571226",
"0.6537582",
"0.6530346",
"0.6527405",
"0.6511258",
"0.65101653",
"0.65016127",
"0.6481687",
"0.64700675",
"0.64504963",
"0.644965",
"0.64333814",
"0.64296985",
"0.64296985",
"0.640742... | 0.0 | -1 |
Check if DaemonSet is running. | def wait_for_daemonset_complete(daemonset_name):
complete = False
try:
response = api.read_namespaced_daemon_set(
daemonset_name, namespace)
status = response.status
if status.desired_number_scheduled == status.number_ready:
log.info("DaemonSet: %s/%s nodes ready ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_running(self):\n qstat = self._grep_qstat('running')\n if qstat:\n return True\n return False",
"def is_running(self):\n\t\treturn self in _running",
"def daemon(self) -> bool:\n return any(thread.daemon for thread in self.threads)",
"def is_instance_running(self... | [
"0.70547146",
"0.7020915",
"0.7012597",
"0.69985205",
"0.6957461",
"0.68912524",
"0.6876981",
"0.68632114",
"0.68553746",
"0.6831734",
"0.6814105",
"0.6805375",
"0.67099726",
"0.6706933",
"0.6689171",
"0.6684411",
"0.66475326",
"0.66450506",
"0.66450506",
"0.66450506",
"0.663... | 0.0 | -1 |
Return the name of the owner's item. | def read_name(item):
return item.metadata.owner_references[0].name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_item_name(self):\n return self.__item_name",
"def getName(self,item):\n return item.s",
"def get_owner_name(self):\n\t\treturn call_sdk_function('PrlAcl_GetOwnerName', self.handle)",
"def owner(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"owner\")",
"def owner(self)... | [
"0.77469575",
"0.7475767",
"0.71366477",
"0.71188045",
"0.71188045",
"0.71057993",
"0.7092732",
"0.70605654",
"0.6931098",
"0.68843687",
"0.67656195",
"0.676506",
"0.66826564",
"0.66612375",
"0.66588694",
"0.6646543",
"0.6621471",
"0.6581284",
"0.65615845",
"0.65601873",
"0.6... | 0.8084857 | 0 |
Redirects to default front page if name equals None or return render template from templates directory. | def mainpage(name=None):
if not name:
return redirect(url_for('mainpage', name='presence_weekday.html'))
try:
return render_template(name)
except TemplateNotFound:
return make_response('Not Found', 404) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default():\n\treturn render_template(\"login.html\")",
"def home():\n\n # sets the page to load depending on the type of user\n # if none specified the login screen will be displayed\n pageName = ''\n userType = session.get('UserType', None)\n if userType == None:\n pageName = 'anonHome... | [
"0.6120167",
"0.5955169",
"0.595008",
"0.5949647",
"0.5908594",
"0.589172",
"0.587618",
"0.5864448",
"0.5857943",
"0.58538955",
"0.5847052",
"0.58400846",
"0.58287644",
"0.58267605",
"0.581946",
"0.581946",
"0.58135086",
"0.57992566",
"0.5783744",
"0.57754236",
"0.57754236",
... | 0.66500276 | 0 |
Pytorch Dataset class to load samples from the PASTIS dataset, for semantic and panoptic segmentation. | def __init__(
self,
folder,
norm=True,
target="semantic",
cache=False,
mem16=False,
folds=None,
reference_date="2018-09-01",
class_mapping=None,
mono_date=None,
sats=["S2"],
):
super(PASTIS_Dataset, self).__init__()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loadData(self):\n batch_size = 256\n \n #if self.conv_sg == True:\n # batch_size = 1 \n \n download = True\n root = self.root + self.dataset\n if self.dataset == \"MNIST\": \n transform = transforms.Compose([transforms.ToTensor(), tra... | [
"0.6727793",
"0.64861995",
"0.6135096",
"0.61262006",
"0.60691357",
"0.6002083",
"0.5928011",
"0.5922055",
"0.5903629",
"0.5898939",
"0.58785695",
"0.58609563",
"0.58533734",
"0.58301216",
"0.5822101",
"0.5815738",
"0.5810329",
"0.57941467",
"0.57546306",
"0.5729781",
"0.5727... | 0.5419369 | 67 |
Fill in entire replay buffer with state action pairs using current policy. | def populate_buffer(self, num_transitions):
while len(self.replay_buffer) < self.buffer_sample_size:
self.play(num_transitions) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self,buffer_size,state_dim,action_dim,random_seed=123):\n print(\"Creating Replay Buffer object\")\n self.buffer_size=buffer_size\n self.state_dim=state_dim\n self.action_dim=action_dim\n self.pointer=0\n self.states=np.zeros(shape=[buffer_size,state_dim])\n ... | [
"0.6267561",
"0.6070136",
"0.602667",
"0.5983036",
"0.5977448",
"0.59287256",
"0.58492136",
"0.5834873",
"0.58293843",
"0.5768325",
"0.5757128",
"0.57521325",
"0.574201",
"0.5735531",
"0.5720933",
"0.5711951",
"0.56975585",
"0.5696251",
"0.5672254",
"0.5606715",
"0.55388564",... | 0.59846336 | 3 |
Resets the optimizers used in the training | def reset_training(self):
self.policy_optim = Adam(self.policy.parameters(), lr=self.lr)
self.q_optim = Adam(self.q_net.parameters(), lr=self.lr)
self.alpha_optim = Adam([self.log_alpha], lr=1e-2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset():\n\n global optimizer_data\n global optimizer_len\n\n optimizer_data = []\n optimizer_len = 0\n return",
"def _reset(self):\n self.loss_history = []\n self.optim_configs = {}\n for p in self.model.params:\n d = {k: v for k, v in self.optim_config.items()... | [
"0.7334564",
"0.7212947",
"0.69250166",
"0.6861769",
"0.6775574",
"0.6772441",
"0.672611",
"0.66176474",
"0.6553896",
"0.64799196",
"0.6395125",
"0.63662076",
"0.6365094",
"0.63484704",
"0.63399565",
"0.6327522",
"0.6312298",
"0.631006",
"0.6309615",
"0.6298623",
"0.6281012",... | 0.74592006 | 0 |
Kinetic Energy Spectrum. Gives the portion of kinetic energy associated with each frequency. | def tke_frequency_spectrum(u, v, f_range=None):
v_f = np.fft.fftn(v.reshape((-1, v.shape[-1])))
u_f = np.fft.fftn(u.reshape((-1, u.shape[-1])))
E_f = np.abs(v_f)**2 + np.abs(u_f)**2
E_f = np.mean(E_f, axis=0)
if f_range is None:
f = np.arange(len(E_f))
else:
f = np.linspace(f_ran... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _spectrum(self, energy):\n return self.pref*energy**2*self.occupation_number(energy/self.kT)",
"def kineticEnergy(self):\n return self.params['kinetic']",
"def stEnergy(frame):\n return np.sum(frame ** 2) / np.float64(len(frame))",
"def stEnergy(frame):\n return numpy.sum(frame ** 2) ... | [
"0.6861842",
"0.6445651",
"0.6287193",
"0.6266233",
"0.6244497",
"0.62123275",
"0.6204889",
"0.61811525",
"0.61730987",
"0.61602485",
"0.614568",
"0.61367446",
"0.6133212",
"0.6100294",
"0.60933536",
"0.6072925",
"0.6069817",
"0.60697424",
"0.606528",
"0.6057135",
"0.60438627... | 0.0 | -1 |
Returns the direct distribution for the given variable. | def direct_dist(var, bins=40, range=None, diff_max=None, scale=1,
percentile=99.9, interpolate=False, period=None):
if period is not None:
diffs = (var + period) % period
diffs /= scale
else:
diffs = var / scale
diff_max = diff_max or np.percentile(np.abs(diffs), per... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_distribution(self, variable, **kwargs):\n return self.visualizer.plot_distribution(variable, **kwargs)",
"def marginalDistribution(self, x, variable):\n return self._distribution.marginal(x, variable)",
"def density(self, arg):\n mean = - self.sigma**2 * self.data['maturity']\n ... | [
"0.6467348",
"0.63833463",
"0.6300723",
"0.6067981",
"0.5978737",
"0.5963487",
"0.595797",
"0.595797",
"0.5913198",
"0.5906003",
"0.59034425",
"0.5875564",
"0.58719707",
"0.576542",
"0.5726047",
"0.5690711",
"0.5650356",
"0.56478614",
"0.56463945",
"0.56415516",
"0.5624215",
... | 0.59783715 | 5 |
Returns the time derivative distribution for the given variable. | def time_derivative_dist(var, bins=40, range=None, diff_max=None, t_steps=1,
scale=1, percentile=99.9, interpolate=False,
period=None):
msg = (f'Received t_steps={t_steps} for time derivative calculation but '
'data only has {var.shape[-1]} time steps')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def derivative(self, variable):\n cached_derivative = self._first_derivatives.get(variable, None)\n if cached_derivative: \n return cached_derivative\n else:\n return self._first_derivatives.setdefault(variable,\n em.di... | [
"0.6622309",
"0.58894396",
"0.5864268",
"0.58023024",
"0.58023024",
"0.58000356",
"0.5728521",
"0.57245445",
"0.5626638",
"0.56089735",
"0.56089735",
"0.5599535",
"0.5599535",
"0.5583621",
"0.55788773",
"0.5570113",
"0.5501774",
"0.54770494",
"0.54531556",
"0.5452138",
"0.544... | 0.5955312 | 1 |
Initialises the main window of the application. | def __init__(self):
QMainWindow.__init__(self)
self.setWindowTitle('Owl')
self.setGeometry(10, 10, 1100, 800)
self.status = self.statusBar()
self.status.showMessage('Ready')
self.setupMenus()
userLabel = QLabel('Contacts')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main(self):\n\n self.window.show_all()\n gtk.main()",
"def init(self):\n sg.theme(gui.app_theme)\n self.window = sg.Window(\n gui.app_title,\n gui.create_layout(),\n **gui.window_config,\n )\n gui.after_window_init(self.window)",
"d... | [
"0.75760764",
"0.75612587",
"0.73898476",
"0.73387116",
"0.7228604",
"0.7200158",
"0.71207225",
"0.7109992",
"0.70946085",
"0.7089324",
"0.70546174",
"0.70515865",
"0.697219",
"0.6970044",
"0.69645756",
"0.69482714",
"0.6923739",
"0.6916414",
"0.68812364",
"0.6830505",
"0.681... | 0.0 | -1 |
Override the default Equals behavior | def __eq__(self, other):
return (self.vertices == other.vertices and self.weight == other.weight) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n pass",
"def __eq__(self, other):\n pass",
"def __eq__(self, other):\n raise NotImplementedError('must be implemented by subclass')",
"def __eq__(self, other):\n raise NotImplementedError('must be implemented by subclass')",
"def __eq__(self, ot... | [
"0.8262612",
"0.8262612",
"0.81877613",
"0.81877613",
"0.81877613",
"0.81877613",
"0.8174912",
"0.81672645",
"0.80995893",
"0.80995893",
"0.80995893",
"0.80995893",
"0.80995893",
"0.80995893",
"0.80995893",
"0.80995893",
"0.80995893",
"0.80995893",
"0.80995893",
"0.8097035",
... | 0.0 | -1 |
Constructs an fully connected layer. | def __init__(self, units, activation=tf.nn.softmax):
super(MyDense, self).__init__()
self.units = units
self.activation = activation | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_fully_connected_layer(input_layer,\n layer_size,\n activation=tf.nn.relu,\n layer_name='',\n logs=False):\n if not layer_name:\n layer_name = ''.join(str(x) for x in np.random.... | [
"0.7020512",
"0.688982",
"0.68701226",
"0.63937783",
"0.63932055",
"0.62187624",
"0.6207529",
"0.619554",
"0.6186766",
"0.6175642",
"0.6166383",
"0.61588913",
"0.6119729",
"0.6114282",
"0.6049771",
"0.6003767",
"0.60019237",
"0.6000434",
"0.59905297",
"0.59616965",
"0.5961360... | 0.0 | -1 |
Creates random weights and bias from a normal distribution for our layer. | def build(self,input_shape):
self.w = self.add_weight(shape=(input_shape[-1],self.units),
initializer='random_normal',
trainable=True)
self.b = self.add_weight(shape=(self.units,),
initializer='random_normal',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _random_weight_initialization(self, mean=0, stddev=1):\n self.slp_weights = np.random.normal(mean, stddev, size=(self.n_rbfs, self.n_targets))",
"def standard_normal(weight_shape):\n return np.random.normal(size=weight_shape)",
"def WeightInitializer():\n return np.random.uniform(-1, 1)",
"d... | [
"0.76400465",
"0.746221",
"0.7263178",
"0.7149812",
"0.7103362",
"0.7101213",
"0.70200807",
"0.7013912",
"0.7002722",
"0.69757056",
"0.6883427",
"0.68715763",
"0.6870996",
"0.68662703",
"0.68238586",
"0.68208855",
"0.6756688",
"0.66976434",
"0.667375",
"0.66245705",
"0.661857... | 0.0 | -1 |
Asks user to specify a city, month, and day to analyze. | def get_filters():
print("Welcome to bikeshare data! \n")
# Taksk0.1: Users choose a city, create a list with length=CITY_DATA ,
#in future, it other cities are added codes will updated automatically
all_cities=list(CITY_DATA)
for i in range(len(all_cities)):
message = ("For the city of {... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Raw_Data(city,month,day):\n print(\"The city you have entered is: \",city)\n print(\"The month you have entered is: \",month)\n print(\"The day you have entered is: \",day)",
"def get_filters():\n city = None\n month = None\n day = None\n while day == None:\n # TO DO: get user input f... | [
"0.6670663",
"0.65355295",
"0.6460245",
"0.6373799",
"0.6348607",
"0.6310135",
"0.62867314",
"0.625986",
"0.6231188",
"0.62122154",
"0.62052953",
"0.6181617",
"0.61711454",
"0.6169287",
"0.6158972",
"0.6158044",
"0.6153508",
"0.614449",
"0.61302817",
"0.610529",
"0.6102876",
... | 0.0 | -1 |
Loads data for the specified city and filters by month and day if applicable. | def load_data(city, month, day):
##task0.4 now the user choices are all ready and saved, start preparing your data
## first, load the data of the selected city using the pd.read_csv command for the user specified city
df = pd.read_csv(CITY_DATA[city])
## read the column start time as a date, to start... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_data(city, month, day):\n df = pd.read_csv(CITY_DATA [city])\n \n # convert the Start Time column to datetime\n df['Start Time'] = pd.to_datetime(df['Start Time'])\n \n # extract month and day of week from Start Time to create new columns\n df['month'] = df['Start Time'].dt.month\n ... | [
"0.81320685",
"0.8108889",
"0.8045821",
"0.8042514",
"0.80090284",
"0.80071104",
"0.79991937",
"0.7998333",
"0.7988789",
"0.797905",
"0.79737365",
"0.79610896",
"0.7956163",
"0.7947432",
"0.79463065",
"0.7908287",
"0.7908229",
"0.7904569",
"0.7900715",
"0.78930074",
"0.788921... | 0.0 | -1 |
Displays statistics on the most frequent times of travel. | def time_stats(df):
print('\nCalculating The Most Frequent Times of Travel...\n')
print("if you selcted a specific month, it will be the most frequent")
print("Choose all month for most frequent month data")
start_time = time.time()
#Task1.1: TO DO: display the most common month
## most common... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_stats(df):\n\n print('\\nDisplaying the statistics on the most frequent times of '\n 'travel...\\n')\n start_time = time.time()\n\n # display the most common month\n most_common_month = df['Month'].mode()[0]\n print('For the selected filter, the month with the most travels is: ' +\... | [
"0.80247396",
"0.80233026",
"0.7915788",
"0.78266186",
"0.7822246",
"0.78143597",
"0.77659196",
"0.7740343",
"0.773628",
"0.77344066",
"0.76867086",
"0.7668633",
"0.7651731",
"0.7644636",
"0.76399267",
"0.76367253",
"0.7625196",
"0.7623158",
"0.7612803",
"0.76002145",
"0.7583... | 0.0 | -1 |
Displays statistics on the most popular stations and trip. | def station_stats(df):
###Tsk 2:popular stations and trips
print('\nCalculating The Most Popular Stations and Trip...\n')
start_time = time.time()
##task2.1:start_station: most popular start station is the mode
## calculate the count and percentage of trips from each station
## present count... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def station_stats(df):\n\n print('\\nCalculating The Most Popular Stations and Trip...\\n')\n start_time = time.time()\n\n # display most commonly used start station\n print(popular_start_station(df))\n\n # display most commonly used end station\n print(popular_end_station(df))\n\n # display m... | [
"0.7815675",
"0.7662213",
"0.7553417",
"0.74914914",
"0.74748665",
"0.7446617",
"0.7428588",
"0.74237514",
"0.74177027",
"0.7400495",
"0.7387161",
"0.7385634",
"0.73647535",
"0.735934",
"0.73566747",
"0.73548365",
"0.7351854",
"0.7351274",
"0.735057",
"0.73421645",
"0.7340198... | 0.0 | -1 |
Displays statistics on the total and average trip duration. | def trip_duration_stats(df):
##task3 Trip duration: total and average travel time
## time of each trip is given in seconds, it is converted into minutes and hours
##Task3.1 & 3.2 the total and average trip time, rounded to 2 decimal places are displayed in a table
##The shortest trip in the database is ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trip_duration_stats(data):\n print('\\nCalculating Trip Duration...\\n')\n start_time = time.time()\n # display total travel time\n total_trip_time= data['Trip Duration'].sum()\n print('The Total Travel Time is {} Hours'. format(total_trip_time/3600))\n # display mean travel time\n avg_tri... | [
"0.8145283",
"0.80273277",
"0.800625",
"0.79516613",
"0.79394716",
"0.7933188",
"0.79289365",
"0.7917429",
"0.79167455",
"0.79100615",
"0.79077137",
"0.7902854",
"0.7893696",
"0.7891645",
"0.7888904",
"0.7887135",
"0.78862405",
"0.7884963",
"0.78764445",
"0.7870734",
"0.78687... | 0.0 | -1 |
Creates a new rule. | def __init__(self,
positive_atoms: List[Tuple['Predicate', Tuple[str, ...]]],
negative_atoms: List[Tuple['Predicate', Tuple[str, ...]]]) \
-> None:
self.atoms = [Atom(*at) for at in positive_atoms + negative_atoms]
self.negated = [False] * len(positive_a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_snat_rule(self, **attrs):\n return self._create(_snat.Rule, **attrs)",
"def test_create_rule(self):\n pass",
"def create_rule(self: object,\n body: dict,\n cs_username: str = None # pylint: disable=W0613 # cs_username is deprecated\n ... | [
"0.77661496",
"0.7165851",
"0.71593416",
"0.6962275",
"0.6962275",
"0.6962275",
"0.6962275",
"0.6962275",
"0.69479007",
"0.6912512",
"0.6896337",
"0.6890248",
"0.68671674",
"0.6777787",
"0.67252964",
"0.67167526",
"0.67128694",
"0.6699123",
"0.6659627",
"0.66477424",
"0.66436... | 0.0 | -1 |
Create a sparse representention of x. | def sparse_tuple_from(sequences, dtype=np.int32):
indices = []
values = []
for n, seq in enumerate(sequences):
indices.extend(zip([n]*len(seq), range(len(seq))))
values.extend(seq)
indices = np.asarray(indices, dtype=np.int64)
values = np.asarray(values, dtype=dtype)
shape = np... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_sparse(x):\n x_typename = torch.typename(x).split('.')[-1]\n sparse_tensortype = getattr(torch.sparse, x_typename)\n\n indices = torch.nonzero(x)\n if len(indices.shape) == 0: # if all elements are zeros\n return sparse_tensortype(*x.shape)\n indices = indices.t()\n values = x[tupl... | [
"0.75686485",
"0.7074417",
"0.7010392",
"0.7005248",
"0.6776821",
"0.6769516",
"0.6685081",
"0.6682845",
"0.6600969",
"0.6585346",
"0.658275",
"0.6573287",
"0.6444108",
"0.6443818",
"0.64427996",
"0.6438962",
"0.6436992",
"0.6384505",
"0.63345295",
"0.6333298",
"0.6276179",
... | 0.0 | -1 |
Select random inputs. Return an array of batch_size columns, each of which is an input represented as a (column) vector. | def rand_stim(self, batch_size=None):
batch_size = batch_size or self.batch_size
veclength = np.prod(self.datasize)
X = np.zeros((veclength, batch_size))
for i in range(batch_size):
which = np.random.randint(self.nstims)
vec = self.data[which, ...]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pickInputs(self):\n return [np.random.choice([-1,1])*np.random.random() for i in range(self.N)]",
"def next_batch_random(self, size):\n index = np.random.randint(0, self.dataset_size, size=int(size))\n return ([x[index, :] for x in self.data])",
"def RandomInputs(batch_size, seq_length... | [
"0.64807093",
"0.6289564",
"0.6093539",
"0.5945525",
"0.5935339",
"0.5926138",
"0.5920289",
"0.59120786",
"0.5849037",
"0.5830708",
"0.57624984",
"0.57112575",
"0.57057184",
"0.56899136",
"0.56694734",
"0.566208",
"0.56372875",
"0.5617041",
"0.557958",
"0.55650944",
"0.555099... | 0.6261103 | 2 |
Injects DynamoDB serialization into parameter input | def inject_attribute_value_input(self, params, model, **kwargs):
self._transformer.transform(
params,
model.input_shape,
self._serializer.serialize,
'AttributeValue',
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dynamo_dump(self, value, *, context, **kwargs):\n raise NotImplementedError",
"def _serialize_item(self, item_id: str, item: Pipeline) -> dict:\n return item.to_json()",
"def _serialize(\n self, value: typing.Any, attr: str | None, obj: typing.Any, **kwargs\n ):\n return valu... | [
"0.55243766",
"0.5366625",
"0.53529614",
"0.52168065",
"0.51654994",
"0.5139176",
"0.51223093",
"0.5121041",
"0.51064765",
"0.50441146",
"0.5018304",
"0.50087184",
"0.49939594",
"0.4987816",
"0.49662238",
"0.4937576",
"0.4937576",
"0.4914141",
"0.48839846",
"0.48533607",
"0.4... | 0.5200302 | 4 |
Return a 'fixed' version of filename. | def get_fixed_filename(filename):
initial_changed_name = filename.replace(" ", "_").replace(".TXT", ".txt")
previous_character = ""
new_name = ""
for i, character in enumerate(initial_changed_name):
current_character = character
if previous_character == "_" and current_character.islower(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _safe_filename(filename):\n date = datetime.datetime.utcnow().strftime(\"%Y-%m-%d-%H%M%S\")\n basename, extension = filename.rsplit('.', 1)\n return \"{0}-{1}.{2}\".format(basename, date, extension)",
"def _safe_filename(filename):\n filename = secure_filename(filename)\n date = datetime.datet... | [
"0.7250059",
"0.71424264",
"0.7099398",
"0.7067578",
"0.70534736",
"0.6940534",
"0.68074816",
"0.67568046",
"0.673747",
"0.6724021",
"0.67217356",
"0.6685823",
"0.6665831",
"0.6630088",
"0.661831",
"0.6595872",
"0.658626",
"0.65764874",
"0.6531638",
"0.6502819",
"0.64971834",... | 0.6781198 | 7 |
Yield successive nsized chunks from l. | def get_chunks(self, l, n):
for i in range(0, len(l), n):
yield l[i:i+n] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _chunk(self, l, n):\n for i in range(0, len(l) + 1, n):\n yield l[i:i + n]",
"def chunks(self, l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def __chunks(l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def chunks(self, l, n... | [
"0.8038813",
"0.79248375",
"0.7923423",
"0.78773195",
"0.7815877",
"0.77655786",
"0.77556044",
"0.77441615",
"0.7731815",
"0.77288336",
"0.772473",
"0.77028215",
"0.76889825",
"0.76889825",
"0.7664208",
"0.76570904",
"0.7655856",
"0.7655856",
"0.76458347",
"0.76458347",
"0.76... | 0.7885103 | 3 |
strip enclosing double quotes, parse coordinates | def getGeo(self,section,option):
value=ConfigParser.SafeConfigParser.get(self,section,option)
value=value.strip('"')
coord=value.split(",",2)
# print(coord)
ll={}
ll["long"]=coord.pop()
ll["lat"]=coord.pop()
return ll | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extractCoords(coords):\n\tregex2 = re.compile('\\s+')\n\ts = regex2.split(coords[0])\n\tcoord_list = []\n\tfor i in s:\n\t\tcoord_list.append(i.split(','))\n\n\tnew_coord_list = []\n\tfor item in coord_list:\n\t\ttriple = []\n\t\tfor n in item:\n\t\t\ts = n.strip()\n\t\t\ttry:\n\t\t\t\ttriple.append( float(s))... | [
"0.695526",
"0.6227543",
"0.62095004",
"0.6090966",
"0.6055424",
"0.6024204",
"0.60163367",
"0.60098034",
"0.59717023",
"0.59682554",
"0.5957412",
"0.59151083",
"0.59012395",
"0.5887412",
"0.58620256",
"0.5854239",
"0.5816421",
"0.57776093",
"0.57767564",
"0.5760621",
"0.5756... | 0.0 | -1 |
Computes the mass of the fuel system (e.g., tanks, pumps, but not the fuel itself) for a cargo/transport | def mass_fuel_system(
fuel_volume: float,
n_tanks: int,
fraction_in_integral_tanks: float = 0.5,
) -> float:
fraction_in_protected_tanks = 1 - fraction_in_integral_tanks
return (
2.405 *
(fuel_volume / u.gallon) ** 0.606 *
(1 + fraction_in_integral_ta... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mass_from_composition(composition):\n mass = 0.0\n for k, v in composition.items():\n if k == 0: # electron\n mass -= v * 5.489e-4\n else:\n mass += v * relative_atomic_masses[k - 1]\n return mass",
"def fuel_calc(mass):\n return max((mass / 3) - 2, 0)",
"def ... | [
"0.6908069",
"0.6871332",
"0.68011856",
"0.67922527",
"0.6770156",
"0.6728891",
"0.67110443",
"0.66887164",
"0.66869414",
"0.6595515",
"0.659239",
"0.6591645",
"0.6586524",
"0.6565294",
"0.6550709",
"0.6544877",
"0.6527932",
"0.64481664",
"0.63721675",
"0.63560534",
"0.635293... | 0.64137846 | 18 |
Computes the mass of the auxiliary power unit (APU) for a cargo/transport aircraft, according to Raymer's Aircraft | def mass_APU(
mass_APU_uninstalled: float,
):
return 2.2 * mass_APU_uninstalled | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mass_air_conditioning(\n n_crew: int,\n n_pax: int,\n volume_pressurized: float,\n mass_uninstalled_avionics: float,\n):\n return (\n 62.36 *\n (n_crew + n_pax) ** 0.25 *\n (volume_pressurized / u.foot ** 3 / 1e3) ** 0.604 *\n (mass_uni... | [
"0.64762974",
"0.62614197",
"0.62603736",
"0.62260145",
"0.62219983",
"0.6205465",
"0.5964669",
"0.59323215",
"0.5930326",
"0.5611548",
"0.5528604",
"0.5490929",
"0.54532516",
"0.541888",
"0.5407808",
"0.5377963",
"0.53560084",
"0.5346819",
"0.53421617",
"0.5334387",
"0.53013... | 0.69907904 | 0 |
Return the HTML with the main HTML page | def get_main_page(self):
if OPENFDA_BASIC:
with open("openfda_basic.html") as html_file:
html = html_file.read()
else:
with open("openfda.html") as html_file:
html = html_file.read()
return html | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main_page():\n return render_template(\"main_page.html\")",
"def main_page():\n return render_template(\"index.html\")",
"def index(self):\n return self.html",
"def main():\n return render_template(\"main.html\")",
"def main():\n return render_template(\"main.html\")",
"def view_ht... | [
"0.78748435",
"0.77521324",
"0.76116705",
"0.75585",
"0.75585",
"0.73639154",
"0.7333431",
"0.7279256",
"0.7279256",
"0.7254037",
"0.71512",
"0.7110393",
"0.7098005",
"0.7090026",
"0.70862687",
"0.7077242",
"0.7077242",
"0.7058926",
"0.7040499",
"0.7040274",
"0.70097804",
"... | 0.78949946 | 0 |
Decorator which defines a functions as concurrent, eg. it should be executed on the worker. If you wish to call the function directly you can access the original function at ``.direct``. | def concurrent(
func=None, queue=None, unique=False, timeout_seconds=0, expire_seconds=0
):
if isinstance(func, str):
return lambda f: Concurrent(
func=f,
dft_queue=func,
unique=unique,
timeout_seconds=timeout_seconds,
expire_seconds=expire_sec... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sync_decorated(*args, **kwargs):\n return IOLoop.current().run_sync(\n functools.partial(func, *args, **kwargs))",
"def threadsafe(function):\n def wrapper(*args, **kw):\n with Entity.lock:\n return function(*args, **kw)\n return wrapper",
"def deco... | [
"0.6510552",
"0.63173974",
"0.6249528",
"0.62272984",
"0.6185312",
"0.6140188",
"0.612324",
"0.6075599",
"0.60568535",
"0.60537964",
"0.60237414",
"0.5989997",
"0.5975493",
"0.5974378",
"0.59714663",
"0.5958049",
"0.5949265",
"0.59252757",
"0.58865726",
"0.5875453",
"0.585736... | 0.6644512 | 0 |
Decorator which defines a functions as a cron job, eg. it should be executed at specific times. Workers will enqueue this job at or just after the set times. If ``unique`` is true (the default) the job will only be enqueued once even if multiple workers are running. If you wish to call the function directly you can acc... | def cron(
*,
month: Union[None, set, int] = None,
day: Union[None, set, int] = None,
weekday: Union[None, set, int, str] = None,
hour: Union[None, set, int] = None,
minute: Union[None, set, int] = None,
second: Union[None, set, int] = 0,
microsecond: int = 123_456,
dft_queue=None,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def repeat(job, *args, **kwargs):\n\n def _schedule_decorator(decorated_function):\n job.do(decorated_function, *args, **kwargs)\n return decorated_function\n\n return _schedule_decorator",
"def cron(self, crontab, job_func):\n job = Job(crontab, job_func, self)\n self.jobs.appe... | [
"0.6076152",
"0.58702916",
"0.5756076",
"0.57473314",
"0.57189727",
"0.5709732",
"0.5664868",
"0.565292",
"0.5606182",
"0.5501176",
"0.5487995",
"0.54742056",
"0.54571533",
"0.5441805",
"0.5439397",
"0.54101604",
"0.5384286",
"0.5375054",
"0.53689355",
"0.53640383",
"0.533690... | 0.6734553 | 0 |
returns max lines allowed | def get_max_lines(self):
return self._maxLines | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_length(lines):\n return max([len(s.split()) for s in lines])",
"def get_max_log_lines(self):\n\t\treturn self.spinMaxLogLines.get_value_as_int()",
"def maxlines(self):\n return self._kml['maxlines']",
"def max_line(self):\n return self.screen.getmaxyx()[0] - 2 # Account for header s... | [
"0.76349723",
"0.7272547",
"0.7165713",
"0.713636",
"0.6942895",
"0.6775653",
"0.6698256",
"0.6691362",
"0.65517646",
"0.6521363",
"0.64554095",
"0.64491695",
"0.6431088",
"0.63999057",
"0.6381548",
"0.6380912",
"0.6375888",
"0.63401747",
"0.63022345",
"0.6243584",
"0.6243525... | 0.87286377 | 0 |
sets maximum number of lines allowed | def set_max_lines(self, n):
self._maxLines = n
self._trunc_lines() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_max_lines(self):\n\t\treturn self._maxLines",
"def setmaxsize(self, maxsize):\n self.maxsize = maxsize",
"def set_max_log_lines(self, value):\n\t\tself.spinMaxLogLines.set_value(value)",
"def set_max_record_limit(self, limit):\n self.max_record_limit = limit",
"def set_max_sentence_le... | [
"0.72174835",
"0.69830364",
"0.6847755",
"0.64669925",
"0.64234453",
"0.6422268",
"0.6249642",
"0.62354034",
"0.62354034",
"0.62354034",
"0.6177047",
"0.6175626",
"0.6175626",
"0.6175626",
"0.6175626",
"0.6175626",
"0.6175626",
"0.6175626",
"0.6175626",
"0.6175626",
"0.617562... | 0.8597132 | 0 |
returns index af a column given its column name | def get_column_index(self, colName):
return self._columns[colName] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def column_index(self, column_name: str) -> int:\n return self._column_indices[column_name]",
"def get_index(self, column):\r\n\r\n\t\treturn self.columns.index(column)",
"def column_index(self, column_label):\n return self.column_labels.index(column_label)",
"def get_column(filename, column_na... | [
"0.82776165",
"0.8147774",
"0.7764068",
"0.76117903",
"0.76086396",
"0.7571018",
"0.754229",
"0.7536253",
"0.74898005",
"0.7489108",
"0.7346924",
"0.7274244",
"0.7170877",
"0.7091701",
"0.705067",
"0.69433796",
"0.6920825",
"0.67590076",
"0.6746004",
"0.6701321",
"0.6662654",... | 0.82448417 | 1 |
returns number of rows in the list | def get_row_count(self):
return self.iter_n_children(None) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getNumRows(self) -> int:\n ...",
"def countitems(self):\n count = 0\n sid = self.client.scannerOpen(self.table, '', ['f:s'])\n while 1:\n r = self.client.scannerGetList(sid, 1000)\n #r = self.client.scannerGet(sid)\n if not r: break\n co... | [
"0.7781061",
"0.75541437",
"0.74858695",
"0.74643165",
"0.7447117",
"0.739282",
"0.73849195",
"0.73849195",
"0.73794454",
"0.7354553",
"0.73329073",
"0.7278076",
"0.72680926",
"0.7204585",
"0.7120261",
"0.709179",
"0.7075071",
"0.7041571",
"0.70252377",
"0.6982923",
"0.696881... | 0.70733774 | 17 |
returns value of the 'max log lines' setting | def get_max_log_lines(self):
return self.spinMaxLogLines.get_value_as_int() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_max_lines(self):\n\t\treturn self._maxLines",
"def set_max_log_lines(self, value):\n\t\tself.spinMaxLogLines.set_value(value)",
"def maxlines(self):\n return self._kml['maxlines']",
"def on_spin_max_log_lines_value_changed(self, spinBox):\n\t\tself.logView.set_max_lines(spinBox.get_value_as_in... | [
"0.78338355",
"0.7617107",
"0.6942586",
"0.6877112",
"0.6832664",
"0.6807198",
"0.6686845",
"0.665079",
"0.65768594",
"0.64467424",
"0.6433672",
"0.6432308",
"0.63611275",
"0.63475496",
"0.63421357",
"0.6280894",
"0.6252704",
"0.62475055",
"0.6235007",
"0.6223025",
"0.6201123... | 0.8683542 | 0 |
A view to render information on the Checkout Page | def checkout(request):
stripe_public_key = settings.STRIPE_PUBLIC_KEY
stripe_secret_key = settings.STRIPE_SECRET_KEY
if request.method == 'POST':
bag = request.session.get('bag', {})
form_data = {
'full_name': request.POST['full_name'],
'email': request.POST['email'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def view_shoppingbag(request):\n\n return render(request, 'shoppingbag/shoppingbag.html')",
"def view_cart(request):\n\n return render(request, 'cart/cart.html')",
"def view_cart(request):\n\n return render(request, 'cart/cart.html')",
"def view_cart(request):\n \n return render(request, \"car... | [
"0.6685182",
"0.6613053",
"0.6613053",
"0.66004103",
"0.6580404",
"0.6571783",
"0.6529572",
"0.6529572",
"0.6529572",
"0.6443502",
"0.6412792",
"0.6289644",
"0.61918694",
"0.61916804",
"0.61078906",
"0.599275",
"0.59790355",
"0.59725815",
"0.5967623",
"0.5963918",
"0.59468776... | 0.55554163 | 66 |
the the repr string representation | def test_repr():
c = Circle(4)
assert c.__repr__() == 'Circle(4)' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repr__ (self):\n\t\tStr = \"\"\n\t\tfor i in self.structref:\n\t\t\tStr = Str + \"%-15s = \"%(i[self.NAME])\n\t\t\tvalue = self.value [i[self.NAME]]\n\t\t\tif isInteger(value):\n\t\t\t\tStr = Str + \"%d, 0x%X\"%(value,value)\n\t\t\t\tif value >= 0x20 and value <= 0xFF:\n\t\t\t\t\tStr = Str + \" '\" + chr (va... | [
"0.7628614",
"0.7607337",
"0.7500048",
"0.74883145",
"0.74816614",
"0.74650484",
"0.74650484",
"0.7421648",
"0.7382179",
"0.73706067",
"0.7362777",
"0.7356752",
"0.73461705",
"0.73355764",
"0.731826",
"0.72497004",
"0.72497004",
"0.72497004",
"0.72444856",
"0.7230697",
"0.723... | 0.0 | -1 |
Creates a LaTeX table with different batch sizes, drum instruments and input metrics. | def create_latex_table(data, id):
bd = data['bd']
sd = data['sd']
filename = 'LatestResults.tex'
file = r'..\latex\tables\\' + filename
if os.path.exists(file):
f_temp = os.path.splitext(file)[0] # without extension
os.rename(file, f_temp + '_' + id + '.tex')
f = codecs.op... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_tables(times, accuracies, batch_sizes):\r\n #Get time data\r\n p_cpu_times = list(times[0].values())\r\n p_gpu_times = list(times[1].values())\r\n c_cpu_times = list(times[2].values())\r\n c_gpu_times = list(times[3].values())\r\n\r\n #Get differences in times\r\n p_diff_times = [a ... | [
"0.6562396",
"0.6529816",
"0.6491857",
"0.64495707",
"0.64167845",
"0.63943183",
"0.63101923",
"0.62994653",
"0.62431747",
"0.62373394",
"0.62016743",
"0.6185538",
"0.61628616",
"0.6155211",
"0.6155211",
"0.61309963",
"0.6130336",
"0.6113951",
"0.60355633",
"0.6020376",
"0.60... | 0.7563468 | 0 |
Decorator that produces a callable that executes a TensorFlow graph. When applied on a function that constructs a TensorFlow graph, this decorator | def graph_callable(shape_and_dtypes):
# TODO(alive,apassos): support initialized_value and friends from tf.Variable.
assert context.in_eager_mode(), (
"graph_callable can only be used when Eager execution is enabled.")
def decorator(func):
return tf_decorator.make_decorator(func,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _graph_callable_internal(func, shape_and_dtypes):\n with context.graph_mode():\n # This graph will store both the initialization and the call version of the\n # wrapped function. It will later be used by the backprop code to build the\n # backprop graph, if necessary.\n tmp_graph = tf_ops.Graph()\... | [
"0.7012606",
"0.65417904",
"0.6532894",
"0.6417617",
"0.63722134",
"0.6340726",
"0.6339656",
"0.62744623",
"0.6274035",
"0.6260365",
"0.61824006",
"0.60748726",
"0.60312593",
"0.60261095",
"0.6015492",
"0.5931827",
"0.59099317",
"0.58882207",
"0.588018",
"0.58785814",
"0.5820... | 0.7653254 | 0 |
Computes the precision for the specified values of k | def accuracy(output, target, topk=(1,)):
maxk = max(topk)
batch_size = target.size(0)
_, pred = output.topk(maxk, 1, True, True)
pred = pred.t()
correct = pred.eq(target.view(1, -1).expand_as(pred))
res = []
for k in topk:
correct_k = correct[:k].reshape(-1).float().sum(0)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def precision(gt, pred, k):\n k = min(len(pred), k)\n den = min(len(gt), k)\n return sum([int(pred[i] in gt) for i in range(k)]) / den",
"def precision_at_k(r, k):\n assert k >= 1\n r = np.asarray(r)[:k] != 0\n if r.size != k:\n raise ValueError('Relevance score length < k')\... | [
"0.76427615",
"0.74189496",
"0.7418079",
"0.72710466",
"0.72456723",
"0.72446615",
"0.7237539",
"0.72213703",
"0.7210107",
"0.7058935",
"0.6852219",
"0.6786084",
"0.67836976",
"0.6768417",
"0.67273885",
"0.67181736",
"0.67181736",
"0.67181736",
"0.67181736",
"0.67181736",
"0.... | 0.0 | -1 |
Remove redundent spaces in the result. | def compress(result):
return string.join((result.split()),' ') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strip_space():\n pass",
"def removeMultipleSpaces(self) -> None:\n self.text = re.sub('\\s+', ' ', self.text)",
"def removeExtraSpaces(self, words):\n\t\treturn re.sub(r'\\s+', ' ', words.strip()).strip()",
"def removeSingleChars(self) -> None:\n self.text = re.sub('\\s[^\\n\\s]\\s', ' ... | [
"0.7912003",
"0.7556939",
"0.7490573",
"0.74472016",
"0.74088115",
"0.74071205",
"0.7287244",
"0.71814144",
"0.7178578",
"0.71600956",
"0.7155232",
"0.7106763",
"0.70857656",
"0.7040228",
"0.70316476",
"0.7024055",
"0.7019722",
"0.69865537",
"0.6975499",
"0.6957336",
"0.69362... | 0.0 | -1 |
Do sentence tokenization by using regular expression | def sent_tokenize(line):
sentences = []
cur_pos = 0
if not re.search(r"\.", line):
return [line]
for match in re.finditer(r"\.", line):
_pos = match.start()
end_pos = match.end()
if is_end_of_sentence(_pos, line):
tmpsent = line[cur_pos:end_pos]
t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tokenize(text):\n sentence = Sentence(text)\n return sentence.tokens()",
"def tokenize(sentence):\n ret = []\n #for token in re.split('\\W+', sentence):\n for token in sentence.split(' '):\n token = token.strip()\n if not len(token):\n continue\n if token[-1] ==... | [
"0.74220836",
"0.74122137",
"0.7266134",
"0.7251823",
"0.7218098",
"0.71925735",
"0.7083671",
"0.7070938",
"0.70606124",
"0.7046501",
"0.70435935",
"0.7018513",
"0.6983145",
"0.69479495",
"0.69418025",
"0.69155204",
"0.6903725",
"0.6878934",
"0.68594134",
"0.6830891",
"0.6830... | 0.0 | -1 |
Sets the additional_description of this ScheduleH4. | def additional_description(self, additional_description):
self._additional_description = additional_description | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_description(self, desc):\n self.description = desc",
"def description(self, description):\n self._description = description",
"def description(self, description):\n self._description = description",
"def description(self, description):\n self._description = description",
... | [
"0.72619593",
"0.7170543",
"0.7170543",
"0.7170543",
"0.7170543",
"0.70948803",
"0.70948803",
"0.70948803",
"0.70948803",
"0.70948803",
"0.70948803",
"0.70948803",
"0.70948803",
"0.70948803",
"0.70948803",
"0.70948803",
"0.70948803",
"0.70948803",
"0.70948803",
"0.70948803",
... | 0.8298258 | 0 |
Sets the amendment_indicator of this ScheduleH4. | def amendment_indicator(self, amendment_indicator):
self._amendment_indicator = amendment_indicator | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def amendment_indicator_desc(self, amendment_indicator_desc):\n\n self._amendment_indicator_desc = amendment_indicator_desc",
"def amendment(self, amendment):\n\n self._amendment = amendment",
"def setImmunity(self, immune):\n self._immune = immune",
"def setArmor(self, armor):\n ... | [
"0.6742256",
"0.6677889",
"0.5813163",
"0.5147014",
"0.5105721",
"0.50622237",
"0.4842453",
"0.48225528",
"0.48016068",
"0.47667405",
"0.47481444",
"0.47450197",
"0.47441792",
"0.46944198",
"0.4628116",
"0.4602124",
"0.4571568",
"0.457075",
"0.45612878",
"0.45555827",
"0.4546... | 0.84887534 | 0 |
Sets the back_reference_transaction_id of this ScheduleH4. | def back_reference_transaction_id(self, back_reference_transaction_id):
self._back_reference_transaction_id = back_reference_transaction_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def back_reference_schedule_id(self, back_reference_schedule_id):\n\n self._back_reference_schedule_id = back_reference_schedule_id",
"def set_reference_id(self, reference_id):\n self.reference_id = reference_id",
"def remittance_reference(self, remittance_reference):\n\n self._remittance_... | [
"0.74941343",
"0.60008985",
"0.5925845",
"0.5806116",
"0.5742958",
"0.5742958",
"0.5622873",
"0.5403959",
"0.5377329",
"0.5298495",
"0.5256606",
"0.5217262",
"0.5216628",
"0.5138288",
"0.5138288",
"0.5129164",
"0.5113195",
"0.51116526",
"0.50931233",
"0.5026752",
"0.50219774"... | 0.8494196 | 0 |
Sets the candidate_first_name of this ScheduleH4. | def candidate_first_name(self, candidate_first_name):
self._candidate_first_name = candidate_first_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_first_name(self, first_name):\n self.first_name = first_name",
"def first_name(self, name):\n self._first_name = name",
"def first_name(self, first_name):\n\n self._first_name = first_name",
"def first_name(self, first_name):\n\n self._first_name = first_name",
"def firs... | [
"0.75824547",
"0.7547167",
"0.7452706",
"0.7452706",
"0.7452706",
"0.7452706",
"0.7452706",
"0.7452706",
"0.7452706",
"0.7452706",
"0.7452706",
"0.71671736",
"0.71671736",
"0.7015078",
"0.6868375",
"0.6791379",
"0.6791379",
"0.67802525",
"0.66729325",
"0.6627801",
"0.66264015... | 0.86969966 | 1 |
Sets the candidate_last_name of this ScheduleH4. | def candidate_last_name(self, candidate_last_name):
self._candidate_last_name = candidate_last_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_last_name(self, last_name):\n self.last_name = last_name",
"def last_name(self, last_name):\n\n self._last_name = last_name",
"def last_name(self, last_name):\n\n self._last_name = last_name",
"def last_name(self, last_name):\n\n self._last_name = last_name",
"def last_n... | [
"0.74708027",
"0.73828924",
"0.73828924",
"0.73828924",
"0.73828924",
"0.73828924",
"0.73828924",
"0.73828924",
"0.73828924",
"0.73828924",
"0.73828924",
"0.72051",
"0.71920407",
"0.70317674",
"0.69352674",
"0.69352674",
"0.6726542",
"0.6726542",
"0.67165387",
"0.6689159",
"0... | 0.8767063 | 1 |
Sets the candidate_name of this ScheduleH4. | def candidate_name(self, candidate_name):
self._candidate_name = candidate_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def candidate_first_name(self, candidate_first_name):\n\n self._candidate_first_name = candidate_first_name",
"def candidate_first_name(self, candidate_first_name):\n\n self._candidate_first_name = candidate_first_name",
"def candidate_last_name(self, candidate_last_name):\n\n self._candid... | [
"0.7092625",
"0.7092625",
"0.6677585",
"0.6677585",
"0.65063214",
"0.65063214",
"0.64476204",
"0.6195637",
"0.58725446",
"0.57911706",
"0.57601213",
"0.57601213",
"0.57540077",
"0.57015824",
"0.5669734",
"0.5663513",
"0.5651387",
"0.5640458",
"0.5639279",
"0.55983293",
"0.559... | 0.8184515 | 1 |
Sets the category_code of this ScheduleH4. | def category_code(self, category_code):
self._category_code = category_code | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_category(self, category):\n\n\t\tif category is not None and not isinstance(category, str):\n\t\t\traise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: category EXPECTED TYPE: str', None, None)\n\t\t\n\t\tself.__category = category\n\t\tself.__key_modified['category'] = 1",
"def merchant_category_code(sel... | [
"0.70052147",
"0.6873093",
"0.6493307",
"0.6475282",
"0.64124507",
"0.6383197",
"0.6313648",
"0.6313648",
"0.6313648",
"0.6313648",
"0.6313648",
"0.63000166",
"0.619993",
"0.6078352",
"0.60332304",
"0.60040987",
"0.5946537",
"0.55942386",
"0.55619985",
"0.55609185",
"0.550935... | 0.8171355 | 0 |
Sets the committee_id of this ScheduleH4. | def committee_id(self, committee_id):
self._committee_id = committee_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def conduit_committee_id(self, conduit_committee_id):\n\n self._conduit_committee_id = conduit_committee_id",
"def committee(self, committee):\n\n self._committee = committee",
"def committee_name(self, committee_name):\n\n self._committee_name = committee_name",
"def committee_type(self... | [
"0.749569",
"0.69791913",
"0.66032636",
"0.5948443",
"0.5899994",
"0.55302703",
"0.5518239",
"0.5518239",
"0.5495657",
"0.5495657",
"0.5495657",
"0.5495657",
"0.54889387",
"0.54333365",
"0.54333365",
"0.54275227",
"0.5408964",
"0.53359383",
"0.52936035",
"0.5244547",
"0.52329... | 0.83848655 | 2 |
Sets the conduit_committee_id of this ScheduleH4. | def conduit_committee_id(self, conduit_committee_id):
self._conduit_committee_id = conduit_committee_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def committee_id(self, committee_id):\n\n self._committee_id = committee_id",
"def committee_id(self, committee_id):\n\n self._committee_id = committee_id",
"def committee_id(self, committee_id):\n\n self._committee_id = committee_id",
"def conduit_committee_name(self, conduit_committee_... | [
"0.74760234",
"0.74760234",
"0.74760234",
"0.6913661",
"0.6707337",
"0.63203984",
"0.61773175",
"0.58653337",
"0.57406956",
"0.57005507",
"0.5467312",
"0.5467312",
"0.5446104",
"0.54000014",
"0.53744346",
"0.5324333",
"0.51176476",
"0.509109",
"0.5082635",
"0.50509894",
"0.49... | 0.8622019 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.