query_id string | corpus_id string | query string | code string | label int64 |
|---|---|---|---|---|
a276a104d7b301534960031fcf3c35e4 | 42fcf4046a76a3f7d492ee112b4d498f | ISO 10126 Padding (withdrawn, 2007): Pad with random bytes + last byte equal to the number of padding bytes | class AesEncryptionOracle:
def _pad_with_bytes(binary_data):
return Random.new().read(randint(5, 10)) + binary_data + Random.new().read(randint(5, 10)) | 0 |
79e7bde81677d28154139f3110ca86c2 | 5258f31d1f1ba5f619068afb4d781d9b | create PurchaseOrder from Bill Of Quantities. | goodsReceiptVM.purchaseOrder.PurchaseOrderId = 0;
goodsReceiptVM.purchaseOrder.SupplierId = this.currentSupplier.SupplierId;
goodsReceiptVM.purchaseOrder.POStatus = "complete";
goodsReceiptVM.purchaseOrder.SubTotal = goodsReceiptVM.goodReceipt.SubTotal;
goodsReceiptVM.purchaseOrder.VATAmount = goods... | 1 |
d218bb94553e7ee7a02d74f77495beea | 7d455af16bd0156b982b8525cd3089f1 | GenerateSk():SecretKey
Generate a random secret key. | @javax.annotation.Generated(
value = "by gRPC proto compiler (version 1.21.0)",
comments = "Source: secret_service.proto")
public final class SecretServiceGrpc public static final class SecretServiceStub extends io.grpc.stub.AbstractStub<SecretServiceStub>
public void generateKey(org.libra.grpc.secret_service... | 0 |
43f710ce381a8c091d37e40ecb2bf49b | 3ad9b65ab5b4c534a9c7ac9af56b6e51 | 根据是否需要两个实体词,结合当前句子中存在的实体词数量,进行补充 | num = 0
i = entity1.ID + 1
while i < entity2.ID:
if cls.is_entity(sentence.words[i]):
num += 1
i += 1
return num | 0 |
c5dc96ed742c5899c4ec05820bd009de | e167de3adfed5663b9f4f39a38034ba5 | #2nd step - Probeset-Drug concentration model fitting | lm_model <- as.formula(
paste0( probe_id, "~", paste0(c(test_var, covariates), collapse=" + "))
)
mod <- try(lm(lm_model, data=model_data))
if(class(mod) == "try-error"){
print(paste("error thrown by column", probe_id))
invisible(rep(NA, 3))
}else cf <- coef(summary(mod))
... | 1 |
9e7d847f0965fe3aa7095e884a4c90bf | e68a31ce728d53129b1976926eaa8f8a | Assumes pred_fns is a list of dicts, and each dict has a "name" key and a
"preds" key. The value corresponding to the "preds" key is an array of
predictions corresponding to the input vector x. x_train and y_train are
the input and output values for the training data | global pred_p
pred_p = [round((theta0 + theta1*train_x1[i]+theta2*train_x2[i]),1) for i in range(train_size)]
return pred_p | 0 |
92717422c469b2f7c2fb534a5724cf19 | a0e0cf397d7ed1cf0f845acce9c1c168 | 获取ruleNights属性的值。 | public class GradePriceClientDTO extends BaseClientDTO
public String getNightTotal() {
return nightTotal;
} | 0 |
105396d9c6850ee522e8ac2cf8aeeaff | 2d96cac9b29103f895efabcbb3a5021f | Guid을 Long으로 변환. | namespace Gusals.Extensions
public static class GuidExtensions
public static long ToLong(this Guid guid)
{
_converter.Guid = guid;
return _converter.Long1;
} | 1 |
f4cdcedac89945d658fa02b5eff02616 | 0c2dd7567d62e447a94356b9fdb8d8b4 | increases the # of aliens destroyed by 1 | class GameplayScreen(object):
def killcountincrease(self):
self.killcount += 1 | 1 |
e738aca2881c76c2b7c5acd8b1dc2339 | fd2b775eea8dd8d1ed11f2b31530fa4d | Checks whether the database exists or not. If it doesn't, generates an empty database and fills it with the default schemas.
Initializes the database connection if it isn't connected. | namespace StackOverFlow
public class Operations
public bool CheckDatabase()
{
try
{
using (SqlConnection conn = new SqlConnection() { ConnectionString = MasterConnectionString })
{
using (SqlCommand cmd =... | 1 |
e2beca9aec6d52b43c1641c87052f832 | 9b37c2bee6b54bdf85db69cf1b70c32f | Give a string representation of a object, with use of reflection. | excludeNames = excludeNames or []
lines = ["%s" % repr(obj)]
for name in sorted([n for n in dir(obj) if n not in excludeNames]):
try:
attr = getattr(obj, name)
content = str(attr).replace("\n", "\n| ")
lines.append("%s %s: %s" % (name, type(attr), content))
... | 1 |
660a0b48ace9215da1f147957c6e0015 | 6ad11cca903e7038025b93c4ca9284a8 | returns dict of ten example images per concept | def load_examples():
links = {1: rootpath + '27213_logo.gif',
2: rootpath + '3540409149_logo.png',
3: rootpath + '3540305397_logo.jpg',
4: rootpath + '3540285103_logo.jpg',
}
images = {}
for i in links:
images[i] = load_image(links[i])
... | 0 |
20629152ff78028faf05bc57839034c4 | fc3726f45fc750d0ab64ca634be29924 | 计算某个时间到月底之间的间隔天数 | if ($starDate >= $endDate)
return 0;
$startdate = strtotime($starDate);
$enddate = strtotime($endDate);
return round(($enddate - $startdate) / 3600 / 24);
} | 0 |
e5fe209538da4800cfe65a4884d8d416 | d7f28521fe90f59f40d8f9110d704a78 | 更新项目模板数量 | @Slf4j
@Controller
@RequestMapping("/template")
public class TemplateController
protected void recountTemplate(Long projectId) {
int templateCount = templateService.selectCount(Condition.create().eq(Template.PROJECT_ID, projectId));
Project project = projectService.selectById(projectId);
project... | 1 |
d6d8ca5e9e680c731591cc8c1d2ef310 | 0fe14ac1867d9f25b10a6e6faf49de1b | 从MainActivity调用此函数将数据发送到远程设备 | public class MainActivity extends FragmentActivity
public void sendData(String data, String strOwner,int timeout) {
if (mBTService.getState() != BluetoothState.STATE_CONNECTED) {
ToastUtils.showToast(this, R.string.not_connected);
return;
}
if (data.length() > 0) {
... | 1 |
c654770e856ef4e34e271fbda814ef3b | c29446648b137c03cc4f766508ce071a | ラベル文字色をボタン状態に応じて更新する。 | namespace B2.Com
class ContrlColor
private static void btnNormalColor_EnabledChanged(object sender, EventArgs e)
{
Button lobjButton = (Button)sender;
SetButtonColor(lobjButton, ButtonStyle.TsujoButton);
} | 0 |
3ccfb97e8c252ae10ee722a684e9ae5b | 49865d3123ea620ce49b755080dbc650 | Computes beta value. | beta = 0
for i in range(np.shape(g)[1]):
for j in range(i + 1, np.shape(g)[1]):
if g[0, i] == g[0, j]:
beta = beta + 1
beta = beta * 2
ar = np.asarray(self.mcmc_objects[step].acceptance_rate)
ar_mean = np.mean(ar)
factor = 0... | 1 |
4d4d85ebea68c36b6c4298458e7a98d9 | f49ca1ddfd970baeef9c03f3061c0895 | Verbosity of the logger history, choose from ``'debug'``, ``'info'`` (default),
``'warning'``, or ``'error'``. | class Log(object):
def mode(self):
return self._mode | 0 |
f55a8dceec09fe2e8a010294cdc7e861 | db1793563cda1801238d56da3c24b0d0 | Extract date from atomic OPER or return FAILURE. | {
ast_tsatomic_t *patomic = NULL;
void *datomic;
void *dlparen;
ast_typename_t *atypename;
void *drparen;
int rc;
rc = ast_tsatomic_create(&patomic);
if (rc != EOK)
return rc;
parser_skip(parser, &datomic);
patomic->tatomic.data = datomic;
parser_skip(parser, &dlparen);
patomic->tlparen.data = dlparen;
r... | 0 |
f1d47bcda6a1c08f66ff6d2de5074d45 | 86c14b6471e365b2d62daf7e802b1bf9 | Update the hotbar UI button text | {
if (currentIngestibleButton == null)
{
consumeButton.interactable = false;
currentIngestibleID = -1;
caloriesNIBar.text = "--";
satietyNIBar.text = "--";
fatNIBar.text = "--";
carbsNIBar.text = "--";
proteinNIBar.text = "--";
waterNIBar.text = "--";
ingestibleQuantity.text = "--";
}
... | 0 |
9c9fe631e2f6c1c1d26a3fc9650ca96b | 91d15e3a34372e835b4a6d1740991498 | Get all manifests with a particular warning. | def getwarnings():
return _getall(_asar.dll.asar_getwarnings) | 0 |
40cce8f8f74b374766b7f55a0f930cb8 | ecfd3d2958469721e7971c71a17b97e3 | Sets that the Die is wanted to be rolled | public class ManageEvents
public void setRoll(Dice dice) {
this.roll = dice.getRoll();
} | 0 |
021791118419cab4171cc9d4a43fa11c | ebd52151d386198888b5fecd4196c443 | 从字节转换为Vector2d实例 | float x = BitConverter.ToSingle(bytes, start);
float y = BitConverter.ToSingle(bytes, start + 4);
return new Vector2(x, y);
} | 0 |
0e8095c1dce65f6244dadd8a3c39b490 | 77557bafbde9b348b2b4419aabe69844 | Gets all keys of specified cluster.
The cluster will be resolved here, including the symlink and route. | {
if (null !== $this->logger) {
$this->logger->startMethod('getAllKeys');
}
$result = parent::getAllKeys();
$this->stopMethod();
return $result;
} | 0 |
51d4067e9dc38a05ccffbd0033d8972e | 3b113eb37556f4bddc8e48187304b1bc | draws classifier prediction with matplotlib magic | class MakeMovie(object):
def draw_model_prediction(self, img, img_drawon):
if self.keras_part is None:
return
expected = tuple(self.keras_part.get_input_shape('img_in')[1:])
actual = img.shape
if expected[2] == 1 and actual[2] == 3:
grey_img = rgb2gray(img)
... | 0 |
363751f64f069741c601a69d5b6a3534 | ad38134616580f4eab57c15ef9f89d34 | Проверяет наличие всех заданных ключей во всех элементах массива | {
foreach ($keys as $k) {
if (!isset($array[$k])) {
return false;
}
}
return true;
} | 0 |
02ab24b7f79752ae7e34fb8a76f612e1 | 9b8a34d05f8d20e2c1266f832b6c03a1 | member端 根据user表的cid字段读取数据,api端 根据用户登入入口来确定cid(根据域名确定)读取数据 | function load_client_by_host($sub_host,$defined_way = 'login',$user_terminal_domain = ''){
$client = [
'defined' => false,
'defined_way' => 'domain',
'domain' => '',
'subdomain' => '',
'database' => [],
... | 1 |
a7c4c6813e2ce5536769b8f4cc63257f | 11e7f6d4ef1fbebf8ba36835385b7cde | Sets data page size limit. | public class AWSS3LongTermStorage extends PDRBagStorageBase
public void setPageSize(Integer sz) { pagesz = sz; } | 1 |
3697aa0f92d6af9aae09cd64bc4f8011 | 86c0fffa827e8189a64096ae6efe0f5d | 获取有一定精度的Double | if (obj instanceof Double || obj instanceof Float) {
return String.format("%." + precision + "f", obj);
}
Double d = null;
if (obj instanceof String) {
d = Double.valueOf((String) obj);
} else if (obj instanceof Integer) {
d = ((Integer) obj).d... | 1 |
107b15c81719b6222c5459f87bc15d1a | 134f3fa7456db13cea3f94510193ad21 | 将获取的CPU的内部状态映射到图形化的表格中 | JLabel j;
for (int i = 0; i < 16; i++) {
int arr = datas[i];
j = jLabels[i];
if (arr == 0) {
j.setText("");
} else if (arr >= 1024) {
j.setFont(new java.awt.Font("Dialog", 1, 42));
j.setText(String.valueOf(da... | 1 |
781e8a592d6b423a0c29b9920486b615 | 2c256a128472c9c6ccd94c9f099e4aac | Gets all posts which can have reviews. | {
return Db::queryAll('SELECT `article`.`id`, `article`.`title`, `user`.`username`, `review`.`id` AS `review`, `review`.`user_id`,
`reviewer`.`username` AS `reviewer`, `review`.`article_id`,
`review`.`rating_originality`, `review`.`rating_theme`, `review`.`ra... | 1 |
43f9fbaa618769fe4c7dd4665450e4da | f631ed460df46b307a170d8210e2f453 | 新的会员导出订单记录报表(查看详情) | Language::read('export');
import('libraries.excel');
$excel_obj = new Excel();
$excel_data = array();
$excel_obj->setStyle(array('id'=>'s_title','Font'=>array('FontName'=>'宋体','Size'=>'12','Bold'=>'1')));
$excel_data[0][] = array('styleid'=>'s_title','data'=>L('exp_yc_no'... | 1 |
df5472a2c05a06ddf26bc7fa806d3622 | ac607645a759d9a4fed63c9549baea91 | Put a space after each fullstop. | namespace ITWebNet.Food.Site
public static class StringUtilities
public static string AddSpacesAfterPunctuations(string source)
{
if (!string.IsNullOrEmpty(source))
{
Regex regex = new Regex(@"\S[.,:;)!?]\S");
MatchCollection matches = regex.Matches(so... | 0 |
de597c8d899d2088dee2cfe0571c2ab7 | 9dbac0e6bc3a4a1f0b0cbdf394870af5 | 判断选取的表单是否已经存在 | public class ResolveXmlService extends BaseDao implements IResolveXmlService
private boolean isExistFrom(List fromList, TableVO table) throws Exception {
if (fromList == null) {
return true;
}
for (int i = 0; i < fromList.size(); i++) {
TableVO t = (TableVO) fromList.get(i);
boolean flag=true;
try {
... | 1 |
67088814039968e137d6f3313719e1d0 | 870a1b02c9591a94a99c8a4e0d376065 | Returns the start mode status of the passed service | var service = ServiceController.GetServices();
for (int i = 0; i < service.Length; i++) {
if (service[i].ServiceName.ToUpper().Equals(serviceName.ToUpper())) {
return service[i].Status;
}
}
return ServiceControllerStatus... | 0 |
e6316b0af53cf1e613da84df868e400e | 37f5e7eb503b5fbde79e922b77f7b03c | Return TRUE if the number is equivalent to the specified integer. | public boolean isNumEqualInteger(IInteger value) throws ArithmeticException {
return equals(value);
} | 1 |
cecbcba35c1a54625b864eb8754e4a3c | 6a701401562936be8f1d8460cdd5ab3d | Sets a random url for this request | abstract class AbstractRequest extends CommonRequest
public function setRequestTestUrl($url)
{
$this->setParameter('request_test_url', $url);
} | 0 |
cca5082cdb12093e1836a452524713f8 | 1adc6d3f8f1ef9a1ab351e585b270425 | This method returns the model of the PKCS11 CK_TOKEN_INFO. | class PKCS11Info(object):
def __init__(self, lib):
self.pkcs11 = PyKCS11.PyKCS11Lib()
self.pkcs11.load(lib)
self.log = logging.getLogger(self.__class__.__name__) | 0 |
f6dd9dea4a6038f2a13a953323858a80 | 9b8e03dc4a1084b2cb58610135b69ebd | 加载编辑器中被选中的控件信息,并初始化到当前页面 | namespace RBase2021
public partial class frmadd : Form
private void LoadEditControls()
{
int t = 0;
TextBox tb = new TextBox();
Label lb = new Label();
lb.Height = 13;
tb.Height = 20;
tb.Width = 320;
panel1.Controls.Clear();... | 1 |
ab31822554aa21055fb9c6524c82f601 | 95736e702b98586e9a6405a876316337 | Recupera os registros de rentabilidade pelo produtos da nota fiscal. | $sql = "SELECT NFI.COD_PRODUTO AS codigo, NFI.DSC_GRADE AS grade, SUM(NFI.QTD_ITEM) AS quantidade,
P.DSC_PRODUTO AS descricao,
U.DSC_UNITIZADOR,
NP.NUM_LASTRO, NP.NUM_CAMADAS, NP.NUM_NORMA,
NVL(PV.COD_SEQUENCIAL_VOLUME,... | 0 |
0fcc87a12a87eefa2c2a60f38db66dd0 | c7503c958cf9e3b924f74eaef1419065 | String to time
# Params
- s (String): e.g "6:30"
# Return
- (datetime.time) | def str2time(s):
s_list = list(s)
for i in range(len(s_list)):
if s_list[i] == ":":
continue
s_list[i] = int(s_list[i])
t = ((s_list[0]*10 + s_list[1])*3600 + (s_list[3]*10 + s_list[4])*60
+ s_list[6]*10 + s_list[7])
return t | 0 |
1ec243f542987065e0b561a37f0e68a4 | e75ff61c18a9a32ac2e3f30f5dd352ba | The [Cardholder](https://stripe.com/docs/api#issuing_cardholder_object) to associate the card with. | abstract class PaymentCard extends FinancialProduct
public function setAudience(Audience $audience = null)
{
$this->audience = $audience;
return $this;
} | 0 |
347e6e6485887c2642d4c17dec18f93c | d9562a6dfaa39ae63c5686dc2433fb21 | Compute amount of vacant fields. | {
var tab = cells.Cast<int?>();
int freeCells = tab.Count(val => !val.HasValue);
return freeCells;
} | 1 |
dd20bae74ad98c987367d55c8746066c | 73d87a0dacf5f791199b1a8ae9b92555 | Undo payment of the invoice | {
$url = $this->url(array('payments', $paymentUid, 'invalidate'));
$response = $this
->httpService
->put($url);
if ($response->getCode() !== 200) {
throw $this->buildException($url, $response);
}
} | 0 |
3f3b745282feb36de9969a25bcab1de2 | 3e8797e9f27f832142b19b47b1706cf1 | Decode labels using sklearn.LabelEncoder | def encodeLabels(y):
encoder = LabelEncoder()
encoder.fit(y)
y_enc = encoder.transform(y)
return y_enc | 0 |
1bd51a225123aea3dd2bc1f541f477f6 | 42b19c90b720d64c37e35a1bdc825440 | Triggers validation of each text box by invoking property changed
method for each field. | namespace RzWpf.Validation
public abstract class ValidationElement : CompositePropertyChangeNotificationBase, IValidationElement
protected void ReValidate()
{
foreach (var propInfo in ValidationEntries.Keys)
{
RaisePropertyChanged( propInfo.Name );
}
... | 1 |
e81ebe6d43b40e67598f0a81827572da | b10e003764d53c4cee64f8ad2b5b2e06 | Determines if an angle is reachable. | class ArcGeo(object):
def angle_between(self, min_ang, max_ang, angle):
if min_ang < 0.0:
min_ang += 2 * pi
while max_ang < min_ang:
max_ang += 2 * pi
while angle < min_ang:
angle += 2 * pi
return (min_ang < angle) and (angle <= max_ang) | 1 |
22b61a29e13d94100564daab692fa622 | 0f9b07a5dec52ba88492774cde091f9c | 解析弹幕,进行分词,并修改barrage_dict | class Barrage_parser(object):
def _devide_and_remove(self, barrage_list):
single_text = []
redundant_text = []
redundant_category = set()
for text in barrage_list:
if text not in single_text:
single_text.append(text)
else: ... | 0 |
d87ca3b879fb6bd1ee9201ba18dd8d63 | 9939712f16e7123a09e62df814cce800 | Resize an image to be fitted in specified box and crop it if something is outside | double height = image.getHeight() * (box.getWidth()/image.getWidth());
if(height < box.height) {
return ResizeFitX(box, image);
}
return ResizeFitY(box, image);
} | 0 |
83c7b9d473faf7e57079a8977b2f9812 | 359587487439280fe869e40e4ce09c97 | 对tensor格式的img进行resize | shape = [img.size[1],img.size[0]]
new_shape = resize_size
if isinstance(new_shape, int):
ratio = float(new_shape) / max(shape)
else:
ratio = max(new_shape) / max(shape)
ratiow, ratioh = ratio, ratio
new_unpad = (int(round(shape[1] * ratio)), int(round(shape[0] * ratio)))
... | 0 |
5a449427de7162bb214374d1d419f107 | cd06ec322edb835009fd52afd01ed7f5 | 查询用户所有的可见的资源 | @Repository
public class ResourceService extends GeneralServiceImpl<Resource>
public List<Resource> findlistResource(String userId) throws Exception {
Query query = new Query();
query.addCriteria(Criteria.where("_id").is(userId));
return this.resourceDao.find(query);
} | 0 |
548fff33a83ab8dc64e795c986356f10 | 0439fa923c95762a56dbef36f7e63b40 | Start new Gesture Activity | public class APIModuleDemo extends UZModule
public void jsmethod_openResetGestureActivity(final UZModuleContext moduleContext) {
this.mUZModuleContext = moduleContext;
Intent intent = new Intent(getContext(), ResetGestureActivity.class);
startActivityForResult(intent, GestureState.GESTURELOGIN_R... | 1 |
70e3ae43a274030052ce2f2417bdb43c | 4e10b09464e6459a7e7b99110a26f915 | @brief 提供给上层调用的三个接口函数之一。游戏结束时清理资源 | void PublicLayer::exitGame()
{
HttpInstance::getInstance()->getStore()->exit("exitGame", 1, this, callfuncND_selector(PublicLayer::callbackExit));
} | 0 |
358492c9839ee7506555bffaf4c76987 | 7beeb60cf8f6d8b951089811b00ae7f8 | 从session里获取游戏状态 | class Game{
getState(){
db.ref("gameState").on("value",function(data){
gameState = data.val()
})
} | 0 |
b936cb097d5f742c50058aa8e58ea1fa | 59d7d456ecd74eaba3bfbdd4e85f9e4a | constructs photons uniformly throughout the detector inside of the inscribed sphere. | def draw_photon_sphere():
sphere_name='photon_sphere'
if sphere_name in bpy.context.scene.objects:
objs = bpy.data.objects
objs.remove(objs[sphere_name], do_unlink=True)
bpy.ops.mesh.primitive_uv_sphere_add(radius=Rs*1.5, enter_editmode=False, location=(0, 0, 0))
bpy.context.object.name ... | 0 |
a808ebbcb9c16f70e0c59a235617b0f8 | 7d341a2efea3b52245966fa3c8f78798 | Checks whether or not we're in the air. | public class TL_CharacterJump : MonoBehaviour
public bool IsCharacterAirborne()
{
return CharacterRigidbody.velocity.y != 0f;
} | 1 |
827d0a55386336ddc728253e8a6dbfd3 | 1a5b6090f6680322febddfbf63213937 | 获取姓名拼音,中文字符集为[0x3400,0x9FD5],[0x20000-0x2B81D],注:偏僻汉字很多未验证 | {
Regex regex = new Regex("^[\u4e00-\u9fa5]$");
byte[] array = new byte[2];
string pyString = "";
int chrAsc = 0;
int i1 = 0;
int i2 = 0;
char[] noWChar = hzString.ToCharArray();
for (int j = 0; j < noWChar.Length; j... | 0 |
cdc774792b1e9338e524dd5bb178ee77 | b1290338bbd050b991db8e25af27a81e | Run the List<DBTable> getTables(boolean,List<DBTable>) method test. | public void testGetTablesWithoutIndexes_1()
throws Exception {
ArrayList<Table> tables = new ArrayList<Table>();
tables.add(new Table(new Database(Config.getInstance(), (Connection) null, (DatabaseMetaData) null, "", "", "", new SchemaMeta("", "", "")), "", "", "", ""));
List<Table> result = DbAnalyzer.getTabl... | 0 |
34ef94655bdbfe80290a2bcbd422bf9c | 9e2a31d6376adbfaafdc56a44282ad46 | Get the list of benchmark files | benchdict = {}
with open(path, 'r') as project_results_file:
project_results = csv.reader(project_results_file, delimiter=';')
for row in project_results:
benchmark_name = row[2]
if benchmark_name not in benchdict:
benchdict[benchmark_name] = [float(row[3]... | 0 |
c808f4a06b69b0a065ba3644b83cba60 | b8aa32f7e72f8399d37f770ca89bf5bb | Generalized parity games solver. This is an implementation of the classical algorithm used to solve generalized
parity games. This is the wrapper function which complements every priority and calls the actual algorithm. | public class PolicyIterationDoubleVars
public static <V, E> Tuple<Map<V, Double>, StrategyVector<V, E>> solve(RatioGamePolicyIteration<V, E, Double> game) {
return solve(game, DoubleFunctions.EPSILON, DoubleFunctions.DELTA);
} | 0 |
54e982207d71af2f1b5e7df6ac966b8a | f57ff198f5b920c9d0deda3c3eddc7d8 | Remove all files within a given directory except the specified files | def RemoveAllExcept(where, except_list) :
print("Remove dir contents from {}".format(where))
dir_list = os.listdir(where)
for item in dir_list :
if item not in except_list :
item = os.path.join(where, item)
if os.path.isfile(item) :
os.remove(item)
else :
RemoveDirectory(item... | 1 |
978c4473b3a8f5aede33aa1ff69eea64 | b9bdeaf834299d6c56ed058c8d07c982 | An accessor for whether notifications about the timestep/iteration changing
should be outputted. | public boolean getNotify() {
return this.notify; | 1 |
1414e9c34b5a7aabe562d201f7be965c | ddbe199f5fa480b7e9da7b49f7438144 | 设置DOM对象的颜色 | function setColor(obj,num){
setStatus(colors,num,0);
cxt.strokeStyle=obj.id;
cxt.fillStyle=obj.id;
} | 0 |
447ee3682bd140cabc6b34020bdecaeb | dd6cb7cc2465d0c833fa58184e9f89d4 | 获取两个列表最小那个的大小 | def fun(nums1, nums2, k):
if (len(nums2) + len(nums1)) < k:
return 'error, k大于两个list总个数'
if len(nums2) == 0:
return nums1[k - 1]
if len(nums2) > len(nums1):
return fun(nums2, nums1, k)
if k == 1:
return min(nums1[0], nums2[0])
q = min(k / 2, len(nums2))
p = k - q
... | 0 |
7971444813c4600715c00fd1748b987c | ffe7c8e8b9ab5d0a527b4285e9f46603 | 搜索所有return的表达式 | List<String> selectExpression(); | 0 |
4d930c11dd539d586a71835959b71a43 | d1a396572e17a6272e7a7ff18296ce0c | initialize specified shape variable with normal distribution values | {
int start = spread[thread_id];
int end = spread[thread_id + 1];
random_device rd;
default_random_engine re(rd());
normal_distribution<double> rand_norm(mean, stddev);
for (int i = start; i < end; i++)
values[i] = rand_norm(re);
} | 1 |
9d67843f207ed879e6b78c427586bbdd | 72d6440e5cdb8381912b2f153fcdd933 | 还没有达到阈值,则新建线程,否则缓存起来 | if (list.size() < MaxWorkerIngCount) {
WorkerIng workerIng = new WorkerIng(this.blockingQueue, list.size());
workerIng.start();
list.add(workerIng);
}
blockingQueue.put(runnable);
} | 1 |
dd6b41c3a627f8d6b04680a1033e3aba | 877c862a65653aca11cb02e12b450abc | Creating checkout link | class Cartflows_Ca_Cart_Abandonment
function get_checkout_url( $post_id, $token_data ) {
$token = $this->wcf_generate_token( (array) $token_data );
$checkout_url = get_permalink( $post_id ) . '?wcf_ac_token=' . $token;
return esc_url( $checkout_url );
} | 1 |
61da2abf3b9f73c824a5b0a3da24c31c | 872d8fc6b5307bebc38b2a0bcf921a0e | buy 1 at 1, sell 1 at 1 --> match | namespace TestHarness
public class UnsoldPositions : IStockMatch
void IStockMatch.BeginMatch(SingleTransaction s)
{
} | 0 |
bd25c1411839b00ad0f090eeed78b503 | 50d8b0f7836fd370bfe6ec9221a36122 | getWords returns the cached word list, or loads it. | if s != nil {
return *s
}
return make([]string, 0)
} | 0 |
38a657b0e6d9341dfb182682d807d51b | 4eb169222adc2ee9dd0c80c5400e135c | Returns percentage of how much two strings are similar | namespace Killerrin.Toolkit.Core.Helpers
public static class StringHelpers
public static double SimilarTo(this string string1, string string2)
{
string[] splitString1 = string1.Split(' ');
string[] splitString2 = string2.Split(' ');
var strCommon = splitString1.Intersect(... | 1 |
c9f7d31c8a2f4aea3e01f4f87e087e7f | 9fe4feee8a5cdd19caedf9b2c5061f68 | Exports the VIM-variables as environment variables. | class CommandFormatter
def export_vim
vim_mappings.keys.each do |mapping|
ENV[mapping] = replace_vim_variable(mapping)
end
end | 1 |
f92d0023a6c1a012ff00016f8ca8835d | f34e4286d26e8f13c107418202c813d5 | Returns all registered navigation providers. | class NavigationServiceProvider extends ServiceProvider
public function provides()
{
return [
'navigation',
];
} | 0 |
b80e08e1412320c1e95c8656582888c1 | a8d0aac52f434e9554236f2ba1a5fdd4 | 训练模型并预测出结果 | features = x_data.shape[1]
net = Net(features)
train(net,x_data,y_data,
fold = 0,
lr=params['lr'],
weight=params['weight'],
maxNumEpoch=params['maxNumEpoch'])
x_test = Variable(torch.from_numpy(testData).float(), requires_grad=True)
prob = net.softmax(net(x_te... | 1 |
c3fe9829e9e5b7fe4e95c8847bd8ff26 | 381766607502fece81f154193e7430f5 | Written for SmartGLCD module with T6963C GLCD only!
This is a test of a very fast function to write one command byte
to the GLCD. The command byte is already in RSG_byte, for best speed.
PORTJ = Res CE WR RD C/D
PORTJ 4 3 2 1 0 | {
xdata unsigned int *xdata write_address = 0xEAAA;
lcdbusywait();
RS = 1;
RW = 0;
*write_address = cc;
} | 1 |
160147a6c410302b1fc2c81928e409f6 | dc4998e8a75862ada738438c8939ebe0 | Move iterator to the last element | class ListIterator<T>
ToLast()
{
this.current = this.front;
} | 0 |
aecf3dc2fb2e4621c21a159c057c5ed5 | a0354ad405f632ddd8692a44d9af772f | Packs three separate 10-bit axes into a single 32-bit integer space
following the protocol specification.
Operates using a combination of OR and LEFT SHIFT operations to offset
the relevant axes values, ANDs are used as masks to prevent collisions. | local function glueInt(b1, b2, b3, b4)
return b1%bin[9] + b2%bin[9]*bin[9] + b3%bin[9]*bin[17] + b4%bin[9]*bin[25]
end | 0 |
a42004c1f78c39541cb38fb2c53dad65 | 0a757259b47903ecf44ef794fa42d8f3 | 返信した数が多かった人の抽出 | @Query("select n from Actor n where ((select count(t2) from Actor n2 join n2.receivers t2 where n2.id=n.id)>=all(select count(t3) from Actor n3 join n3.receivers t3 group by n3)) group by n")
public Actor getActorMoreReceived(); | 1 |
5bed2b3f475f159ef96cc01a7d3a56c7 | 01e31c6d5097dfb1d0086895064db1eb | Hanakishiのクローンメソッドがきちんと動いているか確認(失敗すればおk) | public void VariationMissTest()
{
var sample = SampleKif.Get("Kif_VariationMiss.kif");
var kifu = KifuReader.LoadFrom(sample);
Assert.NotNull(kifu);
Assert.Null(kifu.Error);
var count = 143;
Assert.AreEqual(count, kifu.MoveList.Coun... | 0 |
530c092bdcf244c1bbbf504a88fc168c | 66bc38f14cdf722b404734adf929b435 | returns string with all transcript together | def getTranscript(transcriptURI ):
result = requests.get(transcriptURI)
return result.text | 1 |
4c4de5dabd42892af6dae03d6b1d2286 | 75e1d82a95a706c488ba9bf242e59c7e | Funkcja odpowiedzialna za rysowanie wykresu dla funkcji do odpowiedniego
momentu w przeszłości. | ax.set_xlim(0, XMAX)
ax.set_ylim(0, y0)
ax.set_xlabel('$x$ /m')
ax.set_ylabel('$y$ /m')
line.set_data(xdata, ydata)
ball.set_center((x0, y0))
height_text.set_text(f'Wysokość: {y0:.1f} m')
return line, ball, height_text | 0 |
256dc3597205d53548b2411f43d02704 | 6dddd7696d2bcf6e6bdcee54dd7573c8 | tempfileAddImagesToImageAdder adds another batch of images to
the batch currently being processed by an adder. used to
start processing found images whenever user suspends snoop in
progress. basically no-op if snoop's been aborted.
<- void | {
try {
ICameraController* pCamera = m_pCamera->GetInterface();
IImageStreamPtr pImageStream = NULL;
if (FAILED(pCamera->get_ImageStream(&pImageStream)))
return;
pImageStream->AddAppendix();
}
catch (_com_error &e) {
_CONTROLLER_ERRORMSG(e);
return;
}
} | 0 |
692aa54ed6eae2f9f99754e29c8f6c2f | 63a23c69858487a513ac5419ad206c68 | 返回给定EXIF标签的字符串表示 | if self.__ifd not in self.TAG_LIST:
return False, "Unkown IFD"
if self.__id not in self.TAG_LIST[self.__ifd]:
return False, "Unkown ID"
return True, "" | 0 |
00c22143891bee0234fbec4e35907671 | f267735e0ed740704acc3d69366b800b | The item used for viewing the boolean: should be a checkbox | class BooleanField(forms.BooleanField):
def __init__(self, *args, **kwargs):
kwargs['widget'] = kwargs.get('widget', CheckboxInput(label=kwargs.pop('label', None)))
kwargs['label'] = False
super().__init__(*args, **kwargs) | 1 |
d0faddb67465cf6ea74380e6cf88ec1e | 769eb425f3365dc64ff644f615c9ec7f | [safeDelegate] uses function [f] to delegate a value in [entity] with safe property null checks. | fun testNullSafety() {
var s: String? = null
println(s?.length)
try {
s!!.length
} catch (e: KotlinNullPointerException) {
println("NPE!")
}
println(s ?: "(null placeholder)")
s = "abc"
if (s != null) {
println("\"$s\" length is ${s.length}")
}
} | 0 |
ecc7ad027253a6e4fc3e4f05a21d2926 | 74aa944ce8e52a088cc6468db0299fcb | Updates the text inside the dropdown button
and displays the start button | function updateBtnText(item) {
dropdownBtnContent.textContent = item.textContent;
dropdownBtn.setAttribute("selected-music", item.id);
buttonStart.style.visibility = "visible";
} | 1 |
139314eab7c199ba46bf2858f89ce05c | 9402224d6b841384838b90c3222d1807 | Descendre dans l'arbre UCT | class TreeNode:
def monte_carlo_iteration(self, ln_total_visits=None,
ubc1_constant=2,
n_visits_for_expansion=1):
if not ln_total_visits:
ln_total_visits = np.log(self.n_visits)
if len(self.children) == 0:
print(... | 1 |
864e112d7a53f376c85038ae891b80ec | b1c8cd5387c80ee0efd6c4a668f1f4b2 | Вспомогательная функция для hallAssistance.Функция добавляет
новые елементы и добаляет ширину правильному элементу. | {
if (assemblyInstance.GetCount() != 0) { countElementsOnForm++; allElementsNamesOnForm.Add(assemblyInstance.GetName()); }
if (axis.GetCount() != 0) { countElementsOnForm++; allElementsNamesOnForm.Add(axis.GetName()); }
if (beam.GetCount() != 0) { countElementsOnForm++; allEl... | 0 |
c6983b1aae4789d903e14bcde34d8afa | 6ba289526d65e90e186d24c3ef155d64 | 批量新增(物业缴费记录)信息 | public int insertPropertyRechargePreferBatch(List<PropertyRechargePrefer> propertyRechargePreferList); | 1 |
0c22a5d1d6361199fc5a29daaff3e42a | 66fc00dd1b4c4965f03ff3b3932a697f | Generates a SAS Token. | self._token_hostname, self._token_key, self._policy_name = self._parse_connection_string(
connection_string)
self._current_sas_token = self._generate_sas_token(
self._token_hostname, self._token_key, self._policy_name) | 1 |
e4448e97454c3a7caab04191b25763f3 | 7ee215bad044084019e949024c71fb32 | funkce na přepínaní mezi formulářem na registraci nebo přihlášení | function show_hide_form_on_submit(){
if(isset($_POST['loginButton'])){
echo '<script>$(document).ready(function () {$("#loginForm").show(); $("#registerForm").hide();});</script>';
}
if(isset($_POST['registerButton'])){
echo '<script>$(document).ready(function () {$("#loginForm").hide();$("#... | 1 |
0c1577a47edad1f56483ab5e1fc9b182 | 95be95ec419b6c43eec27979ba03862c | calculando qual a porcentagem do orçamento a compra do estoque utilizou | unsigned long ocorrencia) {
double resultado = ((double)ocorrencia / (double)montante);
return (resultado * 100);
} | 1 |
b9da253c79e64f432fc046fcc68f7adf | 29bec01f2368f113d142f7c213c9fb91 | 记录订单发票地址相关数据 | $oRecord=$this->orderRecord;
if(!$oRecord->isNeedAddress) return;
$address=$oRecord->addressManagement->getAddress();
if(!$address) throw new SmartException("order {$oRecord->id} miss address");
} | 0 |
ab30cc293e8c5d012b5a6a799c5ce694 | 3e5c800000873a7c35321eb3ba8b4cb7 | The Authentication that connects to the backend to check the validity of the user token | export class AuthController extends BaseController
get authenticationToken(): any | null {
return this._authenticationToken;
} | 0 |
1c8b6ae30b5623734f277ab047b31667 | 5e225cfadee13149afbde8fcbeb9f54b | Get randomly one translation from given file
Returns | for trans in self.translations:
if trans.fileName == transFileName:
return trans
return None | 0 |
9b3fb851f5b9e1fc677f685abb3bf2ad | 45022338925d8a80a8a2bfd780c97c21 | Create|Update|Delete (cud) countries | let promise = countryServer.update(formData)
promise.then(function (responseBody) {
context.commit("COUNTRY_UPDATED", responseBody)
})
promise.catch(function (responseBody) {
context.commit("ERROR", responseBody)
})
return promise;
} | 1 |
03acd4b41df1aa136d2cffaa8714b0b1 | 15a65d17b3d02bac78bde7a0e281c227 | Verifica se a mensagem de loading foi removida | export class KgMessageService
checkReadErrorLoadMessages() {
return this.hasErrorLoadMessage;
} | 0 |
07196f1a30d01ab3950a35492348fc4e | eba0d3d2abfbe257a8b06a8e1e8fc170 | <pre>
根据星级,计算出星阶
</pre> | switch (tpri) {
case 10:
return 1;
case 9:
return 2;
case 8:
return 3;
case 7:
return 4;
case 6:
return 5;
case 5:
return 6;
case 4:
return 7;
case 3:
return 8;
case 2:
return 9;
case 1:
return 10;
default:
return 5;
}
} | 1 |
7b1a66ab4f7fecec9e9d4f3bd2f87fcd | c5cc825211427b11af6d495cd272a429 | Returns an action map with the generic commands, plus the commands from the current scene | : m_actions()
{
RegisterDefaultAction<commands::Acknowledge>(m_actions);
RegisterDefaultAction<commands::RegisterProcess>(m_actions);
RegisterDefaultAction<commands::RegisterProcessFinished>(m_actions);
RegisterDefaultAction<commands::EnableModules>(m_actions);
RegisterDefaultAction<commands::EnableModulesFinishe... | 0 |
84e078f9f24e808bd853669e8f82a3da | 013b7caf94d5e4164f242a2a27b67a9c | Gets the comment path for a given post id. | class CommentService
public function findForPostId($post_id, $with = [], $length = 50) {
return $this->Repository->findForPostId($post_id, $with, $length);
} | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.