query_id string | corpus_id string | query string | code string | label int64 |
|---|---|---|---|---|
ee927cad80ab496a91ddc44a64f010e2 | 307572be9a4fdbb54c57f3391d3c3501 | Tests deregistering a registered entity | class UnitOfWorkTest extends \PHPUnit\Framework\TestCase
public function testDetachingEntityAfterSchedulingForDeletionInsertionUpdate()
{
$this->entityRegistry->registerEntity($this->entity1);
$this->unitOfWork->scheduleForDeletion($this->entity1);
$this->unitOfWork->scheduleForInsertion($th... | 1 |
82d3dbc1f463f2ab95ffe78ac36bc645 | 630423cdd2fbbd54b0470f0205c87951 | 購入確認描画処理 | try {
if (req.session === undefined)
throw new models_1.AppError(HTTPStatus.BAD_REQUEST, models_1.ErrorType.Property);
const purchaseModel = new models_1.PurchaseModel(req.session.purchase);
if (purchaseModel.isExpired())
throw new models_1.AppError(HTTPStatus.BAD_REQ... | 1 |
46e6ef44cf7e6c00d372e1e909e321c6 | 673ac780b627b54a84f360b7ff9b5be9 | GET: AdminTable | namespace COREMVC.Controllers
[Authorize]
public class ManagerTablesController : Controller
[Authorize(Roles = "Manager")]
public async Task<IActionResult> Index()
{
return View(await _context.ManagerTable.ToListAsync());
} | 0 |
c96d62ab6a346c9c701281171981efa7 | d6b94f6f0dbfa761e2563b14644d7a5a | 获取某个联动当前的状态:开启/关闭 | public SetOperate getOneStatus(String maxc_id,String openId,long id); | 1 |
857b79e13290b89b1e384a9dee908aba | 102991e3d22192bc1baafb374467edbf | Initialize data based on the sidecar file. | if self.repository in data.tracked:
self.hashes = data.tracked[self.repository]["hashes"]
self.parsed = data.tracked[self.repository]["parsed"] | 0 |
8a075cfe4c230ff529c190841dc1f775 | 95abd6b0c1048b0fee69514dc5628bc2 | テトリミノ左回転 | if (this._gameState === GameState.playing && this._curTeris) {
TerisRule.move(this._curTeris, Direction.left, this._exists);
}
} | 0 |
0a56378bec887d7c2c747b416678eeb4 | b080ddee769c7d38da8290c2935a3944 | Checks the invigilator clashes with detention event. | class ReservationController extends Controller
public function check_crash($booking_id, $detail_id, $room_id, $event_start, $event_end){
return BookingDetail::join('rooms', 'rooms.id','=','booking_details.room_id')
->join('bookings', 'bookings.id','=', 'booking_details.booking_id')
->joi... | 0 |
c83c7a2975f484723708e37a9952a87e | 226fb4661fae087c4e00d7c756a38301 | Common PchInit Module Entry Point | VOID
EFIAPI
PchInitPrePolicy (
VOID
)
{
DEBUG_CODE_BEGIN ();
PchShowInformation ();
PchFiaPrintLosRegisters ();
DEBUG_CODE_END ();
PostCode (0xB00);
DEBUG ((DEBUG_INFO, "PchInitPrePolicy() - Start\n"));
if (!IsPchSupported ()) {
DEBUG ((DEBUG_ERROR, "PCH SKU is not supported due to no proper PCH L... | 1 |
9b46ac934d31f58446cc41b0fc560259 | 06c0866a96c4de8a0c988ac4178530a8 | Executes a complete Python script | def execScript():
try:
d = { 'vim':vim, 'VOOM':VOOM, 'voom':sys.modules['voom'] }
execfile(voom_script, d)
print '---end of Python script---'
except Exception:
typ,val,tb = sys.exc_info()
lines = traceback.format_exception(typ,val,tb)
print ''.join(lines) | 1 |
a6a61d71b9779deaa499c122b31d8fe0 | 6c1fb43952a038d5b78ff3dd84038f0c | Sets the value of the descrizioneSelfCare property.
allowed object is
{@link String } | @Table(name = "ASSESSMENT_ADMISSION_RECORD")
public class AssessmentAdmissionRecord
public void setSelfcareName(String selfcareName) {
this.selfcareName = selfcareName == null ? null : selfcareName.trim();
} | 0 |
e8215784ac4fa37bb59ceae2fc0802b0 | 2d0e261aca468a48ed20deb9dda3e498 | Gets the value associated with this key.
The LRU priority for this item is updated. | public String get(String key) {
synchronized (LruCacheImpl.class) {
Node node = map.get(key);
if (node != null) {
remove(node, false);
setHead(node);
return node.val;
}
return null;
}
} | 1 |
72e87f3c0d6d2c8b3f05e294307fb7f2 | ed159b5c0d44c6f5d74074dc6d5e1c75 | Converts to rem resource message. | function pxcalc(remValue: string | number): number {
const baseFontValue = window
? parseFloat(window.getComputedStyle(document.documentElement).fontSize as string)
: BASE_FONT_VALUE;
if (typeof remValue === 'string') {
return stripUnit(remValue) * baseFontValue;
}
return remValue * baseFontValue;
} | 0 |
7d11f9c3cdf6dd1fd68ea8ee1904d168 | f7fbb601690d5b7267b125ec584cf933 | Iterating without an index is more compact and less error prone. | fun iteration2() {
var list = arrayListOf("10", "11", "1001")
for ((index, element) in list.withIndex()) {
println("$index: $element")
}
} | 0 |
02450bf2528a75d01b1015b99f97f6d4 | f1ce5c7e4497fdfc354eabd8fa3a89ea | Prompts the user for the difficulty level desired
Returns: the user's dificulty choice | while True:
level = input("Please select the difficulty level (Easy, Medium, Hard, Impossible) or 'quit' if you'd like to exit the game: ")
if level == "quit":
sys.exit(0)
if level.lower() == "easy":
lives = 7
difficulty = 1
return lives, d... | 1 |
dde23a7a1beb110a9b20d42fb65a0b27 | b2aeef3e9442483762f02f5062f827dc | 计算出模式字符串的各字符失败链接值 | class Indexkmp(StringList):
#获取模式串next数组的函数
def GetListNextValue(self):
ListNextValue=[None for x in range(0,100)]
ListNextValue[0]=-1
k=-1
j=0
while j<len(self.chars)-1:
if k==-1 or self.chars[j]==self.chars[k]:
k=k+1
j=j+1
... | 1 |
a4e37e9a269b17f216590e4e94234dd5 | 968f55798c88c446f2ff7a24144faf22 | 문자(한자리 숫자)를 두자리 문자(숫자)로 변환하여 반환한다. | func ConvertTwoChar(number int) string {
if number < 10 {
return "0" + strconv.Itoa(number)
}
return strconv.Itoa(number)
} | 1 |
ce02ccdbf9ecf02fad8b8e23e980a0a9 | a8cfb36532e5a76a066c151ea7e4279d | This method retrieves a list of all the available CleanSheets instances
on the same LAN. | List<Nic> findAllFromCSServer() throws Exception; | 0 |
a0b5925ca4cba5828b09be19fb92ef82 | 619fc9d6e8f02eb134015688ef35c54f | 保存文件,如果文件的目录不存会自动创建 | export class FileUtil
public static save(path: string, data: any, callback: (result: boolean) => void = null, charSet: string = 'UTF-8'): void {
fsextra.writeFile(path, data, charSet).then(() => {
if (callback) {
callback(true);
}
}, err => {
if (callback) {
callback(false);
}
});
} | 0 |
23e43a18b926fb486362b7614d67ef34 | caf559debd4e0033406ae2d296e03baf | The exception that is thrown when the code is trying to
interact with the API when the API has not been
initialized with .init yet. | class APIResponseNotJson(KGXExceptionBase):
def __init__(self, inner_exception):
self.inner_exception = inner_exception | 0 |
2ef6c5536fdf77af3d97e62761fedcb3 | 0174f77d1d3b35bb86425aa4e9fec9e8 | Initializes an instance of the Selenium scraper with options inherited
from an instance of the Options class. | self._options: options.Options = options.Options()
self._options.headless = headless_mode
self._browser: WebDriver = webdriver.Firefox(options=self._options)
self._web_driver_wait = WebDriverWait(
driver=self._browser,
timeout=timeout,
) | 1 |
3965934a1d1acf16cb6840344fe6b7f2 | 31770ca8ea89d04073937b770670bdf3 | Helper function to do mixed max/avg pooling | with tf.name_scope(name):
return tf.nn.pool(input, pooling_type='AVG', \
window_shape=[filter_shape[0], filter_shape[1]], \
strides=[strides[0], strides[1]], padding='VALID', \
name=name) | 0 |
d48d971358057a9304b5c2196d12d0dc | 1a24aa669c8ef1c6d9301a0b1fc13cb3 | Method to validate atribute similarity at different locations. | def Lin_Sim(i, j, non_geo_attr_names, non_geo_attr_types, vertex_attrs, num_total, sampled_vertex_attrs, num_sample):
similar_nodes=numpy.copy(sampled_vertex_attrs)
for attr_name, attr_type in zip(non_geo_attr_names, non_geo_attr_types):
check=vertex_attrs[attr_name][i]-vertex_attrs[attr_name][j]
... | 1 |
6b5a8a886c42405f743fec7551032442 | 2ed8748cf2f3408a1f05a62cfb939283 | Suspend the thread
<!> To ensure consistency this function must be called from inside the thread | nyaErrno_t nyaThread_Suspend(nyaThread_ID Handle) {
OS_ASSERT(ETYPE_VAR, Handle == NULL);
register uint32_t level;
ThreadUnitBlock_t* tub = (ThreadUnitBlock_t* ) Handle;
if (!(tub->stage & THREAD_READY)) {
return EPERM;
}
level = vPort_DisableINT();
tub->stage = THREAD_SUSPEND;
Schedule_RemoveTask(t... | 1 |
7b89ea64310a28246d77801749509893 | 8ba9bc4bbfb98e5f532ec0683951c6d2 | 获取 购买商品数量 的属性值 | @Table(name = "bill_detail")
public class BillDetail
public Integer getBuyNum() {
return buyNum;
} | 1 |
88eb54ca3f93e1da6e2287623fbf9255 | 21ef48ebd0b42d0cfcc5ee22eff0dfca | incremente ou decremente la satisfaction ( = points d'action ) du villageois | int Villageois::get_Satisfaction() {
return satisfaction_;
} | 0 |
a003da18ad286cc82388bc67ecb94dc3 | 665492ad609db5ea2c60d3e1af79cc6a | Reject an EdgeProposal. | public class RejectProposalCommand extends FrontCommand
@Override
public void process() throws ServletException, IOException {
User speaker = (User) request.getSession().getAttribute(Defaults.USER.toString());
int speakerId = speaker.getId();
int topicId = Integer.parseInt(request.getParamet... | 0 |
50ad1e87b50a6f64e3acb9f16384f538 | efb0b2804ba546700424052b54d1d6b3 | Number of Patients by Condition. This function returns the result set of
the report which shows the number of patients who were marked with the
same diagnosis/condition, for each one of them.
ConditionReport, fields: int, String) | {
#region Prepare SqlConnection & SqlCommand
SqlConnection MyConnection = new SqlConnection(CSManager.GetConnectionString("PatientsSystem"));
_ReportSqlCommand = new SqlCommand();
_ReportSqlCommand.Connection = MyConnection;
#endregion
#reg... | 0 |
dd86aed83ff4de9f4dfd8a4a8aafb0b7 | 2d10aeba6b0c4f531f53006af0d0cc49 | The initialization of the WONDER stack. | exactle_stack_init(void)
{
wsfHandlerId_t handlerId;
uint16_t wsfBufMemLen;
WsfOsInit();
WsfTimerInit();
wsfBufMemLen = WsfBufInit(sizeof(g_pui32BufMem), (uint8_t *)g_pui32BufMem, WSF_BUF_POOLS,
g_psPoolDescriptors);
if (wsfBufMemLen > sizeof(g_pui32BufMem))
{
am... | 1 |
221d77b64eaf7d416b837d7e6192545f | 5c1071b8016f557d8dfa6216a08bc160 | Start media discovery.<br>
To stop it, call libvlc_media_discoverer_stop() or<br>
libvlc_media_discoverer_release() directly.<br>
\see libvlc_media_discoverer_stop<br>
\version LibVLC 3.0.0 or later<br>
<i>native declaration : line 4042</i><br> | class MediaDiscoverer(_Ctype):
def is_running(self):
return libvlc_media_discoverer_is_running(self) | 0 |
b3350fc97aaea60f7eb99170727487b0 | 85d605c77f2a37930a78a3e920ad3fe6 | Registers {@code strategy} to be used to handle operations of the type
{@code operationType} for elements of the type {@code elementType}.
<p>
In other words, this method specifies that {@code strategy} should be
executed using an operation {@code o} and an element {@code e} if
{@code o.getClass().equals(operationType)... | namespace ExpectedObjects
void MapStrategy<T>(IComparisonStrategy comparisonStrategy); | 0 |
8047ef1b42ff7b7d40e19569835e7bc7 | 9a7b66e566ef904c4d3c6a727b54e557 | Keypad module registration. | void Keypad_Init(void)
{
} | 0 |
3c9e593c0c67930c63e9d6cc77263e8e | 9c8e00b4f4442ea74c41c46526e2a4a5 | 根据学生id和作业id去判断是否存在该记录 | Upload findUploadByStudentIdAndWorkId(String studentId, String workId); | 1 |
0ade085bb148ce3087a66625189fd0c3 | 41e73134076abfa668cfcf1b5f771815 | Метод для получения списка доступных ролей для текущего пользователя | namespace WebApi.BLs.Interfaces
IEnumerable<AppUserRoleDto> GetAvailableUserRoles(); | 1 |
294abdab02a79bcd86550070045b230d | bfedaaa241aa3712607f1eb94adb29d1 | Compute the gate pose from two lines in the image corresponding to the
side poles. | cog = NautAngle(units.convert_from_default(cog, 'degrees')).full_circle()
twd = NautAngle(units.convert_from_default(twd, 'degrees')).full_circle()
x = cog - twd
if 0 <= x < 180:
twa = x
wwSide = 'R'
elif -180 <= x < 0:
twa = -x
wwSide = 'G'
elif x >= 180:
... | 0 |
604baa9893f79918037ef655cd154116 | 812906243c2f4b1014be765a2aa958fe | 緯度経度(10進数)から緯度経度(度分秒)への変換 | $vars = explode(".", $dec);
$deg = $vars[0];
$tempma = "0.{$vars[1]}";
$tempma = $tempma * 3600;
$min = floor($tempma / 60);
$sec = $tempma - ($min * 60);
$coordinate = array
(
'deg' => $deg,
'min' => $min,
'sec' => ... | 0 |
ad9518a36eda1a8e1533ac5734370dd7 | 65116cde8ced379bfb1433f50f691272 | we need set timeout for the cases when element itself is rendered by *ngIf directive and we need to wait it's rendering | export class SearchPageComponent implements OnInit, AfterViewInit
ngAfterViewInit(): void {
setTimeout(() => {
this._media.broadcast();
this._changeDetectorRef.detectChanges();
});
} | 1 |
6391026e412c5e73423624f4f38847a3 | a0572ef24797912adcc519b85c910649 | Detects if ProBuilder 2.8+ is in the project.
@return bool true if ProBuilder 2.8+ was detected. | namespace SpaceEquipmentLtd.Utils
public static class Utils
public static bool IsProjected(this IMySlimBlock target)
{
var cubeGrid = target.CubeGrid as MyCubeGrid;
return (cubeGrid != null && cubeGrid.Projector != null);
} | 0 |
ad4c391cec4943e9e96da48fcfa2c364 | 6609c414062078a1051133a919f93d12 | Gets the value of the employeeID property.
possible object is
{@link StringType } | @XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ProfileEN", namespace = "http://schemas.datacontract.org/2004/07/GoQuo.DP.Entities", propOrder = {
"approvedBy",
"businessPhone",
"cardStatus",
"city",
"companyName",
"country",
"countryCode",
"dateOfBirth",
"defaultCurrency",
... | 0 |
63fe7dee05e2a25d755f8b73bdce09e9 | 1955dab664bb358b81cd6a35b15e939d | Tries to return a custom type that matches the given name. If no
custom type was found, it tries to return a class that was exposed on
the C++ side. If that fails too, an error will be raises. | Type typeForName(String name) throws SemanticException; | 1 |
646685c4cfbe7710a398cbd647c7d981 | 1384881b536e6b6515816502f7f17afc | Getter for the student journal | ArrayList<GroupStudents> journal = new ArrayList<>();
for (EnumForSubjects e : EnumForSubjects.values())
journal.add(new GroupStudents(e));
return journal;
} | 0 |
5da1bfb25c8ab70b1a9ceaaf3523e4ac | b4628f8687cea8f941f90f8396e82a04 | return the device structure for the named SoC | devpolicy_getbyname(size_t sz, devplcysys_t *uitmp, char *devname)
{
devplcysys_t itm;
devplcy_t *plcy;
vtype_t spec;
vnode_t *vp;
if (sz != sizeof (devplcysys_t))
return (EINVAL);
if (lookupname(devname, UIO_USERSPACE, FOLLOW,
NULLVPP, &vp) != 0)
return (EINVAL);
spec = vp->v_type;
if (spec != VBLK &&... | 0 |
4f576d7a04f87601a2922699ac4f329e | 212c091d543cb85c328bcea8a5a027e0 | Test parsing people from text | class TestPersonCreation(unittest.TestCase):
def test_successful_loading_of_people_using_a_txt_file(self):
self.dojo = Dojo()
self.dojo.load_people("sample")
self.assertEqual(len(self.dojo.total_people), 7) | 1 |
0aca8e77456daa027daa59dafc4382b1 | c8083855e9f30c2ee5c42004f3e833a0 | Fetches the right tree node. Can be null | class Tree(list):
def _get_node(self): | 0 |
3ad0f5eba5d78c867fd43a1e3c9c356a | 0ec82e1e3df8320f080e901532dbf0b0 | helper function to find median given one array ### | class Solution:
def find_median(self, arr):
arr.sort()
if len(arr)%2==0:
return (arr[len(arr)//2]+arr[(len(arr)//2)-1])//2
else:
return arr[len(arr)//2] | 1 |
4f5064ef2db675aafac5580e565b8812 | eb78c562d44925babafed447ebe39019 | Редактирует выбранного сотрудника компании. | class Controller_Employee extends Controller_Public
public function action_edit($id = null) {
if (Auth::has_access('employee.manage')) {
is_null($id) and Response::redirect('employee');
if (!$employee = Model_Employee::find($id)) {
Session::set_flash('error', __('EMPLOYEE... | 1 |
2026ce74f39fe6152372a0cf5a17d5d2 | 10ab10593e35209b9f8e7b4c29c13f51 | Finds and/or compiles all script files and assemblies. | namespace AO.Core.Scripting
internal class CSExecutor
public string Compile(string scriptFile, string assemblyFile, bool debugBuild)
{
if (assemblyFile != null)
options["forceOutputAssembly"] = assemblyFile;
else
options["forceOutputAssembly"] = Path.G... | 0 |
e26dba9920e634e6d7bb36d6ac014a78 | 55db80c6edcd332fa66b9d72eeb1dedc | CheckIfCertIsSigned verifies that client certificate is signed by server certificate | namespace XtraUpload.GrpcServices
public class ClientCertificateValidator
public Task IsValid(CertificateValidatedContext context)
{
bool isValid = false;
if (! File.Exists(_certConfig.CrtPath))
{
return SetInvalidContext(context, "Invalid path, the public... | 1 |
3c909283a6ed9b3d3030714424a5cfbf | 9565acb1ab0a03a3484cf96dd861cb19 | 初始化刮刮卡界面 | var dataSource:Array<any> = [];
for (var i:number = 0; i < this.cardNum; i++) {
dataSource.push({card: { skin: 'ui/card_init.jpg'}});
this.cardList.getCell(i).x = 0;
this.cardList.getCell(i).y = 0;
var _props:any = {};
if ([0, 3, 6].indexOf(i) ... | 1 |
3020588b26b3496cb09d888361a95681 | 7dabf881b21efc9e2a5c45d9b45ef8d8 | Returns true if keeping the position on rotation is enabled and false if not. | class CurvySlider
def rotation_enabled?
MSPhysics::Newton::CurvySlider.rotation_enabled?(@address)
end | 1 |
f8f38c95b0728b80ed3727453d092f62 | 0cb7ec9b17f7cbbb4453575bce112733 | Handles the Shown event of the MainForm control. | {
ResetFocus(false, true);
if (Shown != null)
{
Shown(this, EventArgs.Empty);
}
} | 1 |
7c4c50bca41f66346e7299d271fe213e | 13e7e7e9a4d91da5136cb74148053f4c | 数据表对象当前ID数据下的子节点减少排序值 | $arrRet = getChildrenArray($tableObj, $pid_name, $id_name, $id);
$map[$id_name] = array('in',$arrRet);
$ret = $tableObj->where($map)->setInc('sort',$count);
return $ret;
} | 0 |
90a9e0866e173a434bafd1b9ffc3ba69 | 08559f60ea05bd8234f7e844cfdeec4b | 두 배열 또는 두 집합 A, B에 대해, A가 B의 부분집합인지 판정한다. | const bSet = new Set(b)
for (const av of a) {
if (!bSet.has(av)) {
return false
}
}
return true
} | 1 |
3df5e429d3a22fdf4b78688513b06d83 | 4cb5a8f88fa6174b495e8f3906c99cf4 | Обработка пола игрока | if(count( array_keys($this->positions, '-') ) % 2){
$this->playerFigure = '0';
} else {
$this->playerFigure = 'X';
}
} | 0 |
30677930f4757f50fe3d9d333109e1c2 | 5af362a0192e78be65b07a0d0c107057 | When sigint is called, just tell the system to exit at the next possible
moment. | static void sigint_h(int sig)
{
(void)sig;
exit(EXIT_SUCCESS);
} | 1 |
b0c1a20e70223c24982436296b9bb6dd | 656776b7c91e4bc1afb9577bb2e56bde | Returns ATOM view of the 10 latest projects | class TaxonNameRelationshipsController
def index
@recent_objects = TaxonNameRelationship.recent_from_project_id($project_id).order(updated_at: :desc).limit(10)
end | 0 |
b9c468cc7046c73b0dbcf5a6aba86dee | 7a5c33d37b5da0b5a194e72907fbf4c8 | 默认查询未结算的绩效信息 | StringBuffer sb1=new StringBuffer("SELECT sspm.PRECLR_ID,sspm.PRECLR_DATE,fc.CUSTOM_ID,fc.custom_name,'' as temp1,");
sb1.append(" '' as temp2,'' as temp3,'' as temp4,ssc.PAID_AMOUNT,ssc.TOTAL_AMOUNT,ssc.PAID_BALANCE,ssc.CHARGE_UNFINISHED");
sb1.append(" FROM st_sell_charge ssc,st_sell_preclr_main sspm,st_sell_or... | 1 |
d8b34394f6c50d11729582235490b2bf | f3d0e83fcb7381f039fb549afc5251ad | Read values from SaveGameData.txt and apply those values | public class GameController : MonoBehaviour
public void loadGameDataFromPlayerPrefs()
{
sceneData.playerPosition.x = PlayerPrefs.GetFloat("playerTransformX");
sceneData.playerPosition.y = PlayerPrefs.GetFloat("playerTransformY");
sceneData.playerPosition.z = PlayerPrefs.GetFloat("playerTrans... | 0 |
933afd7cc0f4fbc0e343ac346dc7f37b | bab2bb3a6df98a0e7795a6b0772c527a | This simple tag says hello to a person. | class Shell(Cmd):
def do_hello(self, args):
if len(args) == 0:
name = 'stranger'
else:
name = args
print "Hello, %s" % name | 1 |
8508afd084418f0507fb9adae5112588 | 82c7751da990472bdddb54f1b8bc660a | autentica o user e guarda o token no localStorage | const user = localStorage.getItem('laravel-vue-spa-token')
if (! user) {
return null
}
let dataFromStorage = jwt.decode(user)
dataFromStorage.user.user = userData
const token = jwt.sign({ user: dataFromStorage.user }, 'laravelvue2020');
localStorage.setItem('laravel-vue-spa-token', t... | 1 |
6c080731da1bb68d335a0de98e5e29e0 | 88bdd21977d4f365aedddb106e0b131b | Validates an event name | if( typeof(type) != 'string' ){
console.log( 'event name has to be represented by string');
}
} | 1 |
ada38d5ab1611ed9281befc1ab6bb1b6 | 49ebed4b9db5999f65e286225797324f | Return an element with lowest fn(x) score; tie goes to first one.
Gen must be a generator.
Ex: argmin(['one', 'to', 'three'], len) ==> 'to | samps = samplingFn(computation, *samplerArgs)
maxelem = max(samps, key=lambda s: s[1])
return maxelem[0] | 0 |
48b7dc569cc289ba0663f716acb91ce5 | 522717c8cf4874238b0beed3296390f7 | 打开重置温馨提示 | ReportManager.getInstance().answerReset()
UIManager.getInstance().closeUI(OverTips)
for (const key in this.optionArr) {
this.optionArr[key].getChildByName('sp').active = true
this.optionArr[key].getChildByName('box').active = false
}
for (const key in this... | 0 |
b4e2998b68080f6bc0a2af0e6b54e1a9 | b6f5953fe62a466d8eb3770eea24c963 | Drops authors table. To be used when the table is malformed. | class CreateCartographyAuthorsTable extends Migration
public function down()
{
Schema::drop('cartography_authors');
} | 1 |
f0835790a07dbff4988a6a4d55428c0b | 8eb5ebdd224fff64e2ff943625fef2a2 | 字典累加 | for i in dict2:
if i in dict1:
dict1[i] += dict2[i]
else:
dict1[i] = dict2[i] | 1 |
8b0553587f3025bd50bb1430da87fce7 | a3bb333dfd3f9dd54144c4d92506452e | ConditionGroup constructor. | class ConditionGroup
public function __construct()
{
$this->conditions = new \Doctrine\Common\Collections\ArrayCollection();
} | 1 |
3fa7735bca92d50ff2ebc0fe1be25780 | e194db6a64ae2ebe18dada96aec7813e | @brief 解析mqtt参数 | pParams->MQTTVersion = MQTT_3_1_1;
pParams->client_id = pClientId;
pParams->keep_alive_interval = QCLOUD_IOT_MQTT_KEEP_ALIVE_INTERNAL;
} | 0 |
cb7611a54e94d4633a01cf083acea290 | 7049f2e865d86c7e15fbc3c8f8d7d34f | 予約登録のメール | {
$mailContext = [
'staff_name' => Auth::user()->name,
'processing' => $processing,
'hospital_name' => $hospital->name,
'reservation' => $reservation
];
Mail::to(config('mail.to.gyoumu'))->send(new ReservationCheckMail($mailContext));
} | 1 |
f23a08b995102039e2faac7176dfd659 | 51a9afb535bf1745031f00b2330d778c | 描述:求纯度(有的cluster分到0,求不了熵)
参数:带标签的数据
返回:纯度 | def calculate_purity(dataset, cluster):
elements = np.unique(cluster)
if len(elements) == 1 and elements[0] == -1:
return -1
cluster = pd.DataFrame(cluster)
cluster.columns = ['cluster']
c_dataset = pd.concat([dataset, cluster], axis=1)
sum_purity = 0
for element in elements:
... | 1 |
3e6ff2732a31caf451156397f06927d5 | b61b9deff73247c2f64e7ed13159f69e | 获取合约个数 | return fetchData(`${__HOST}/ledgers/${ledger}/contracts/count/search`,
self.setContractsCount,
{keyword:keyword}, {
method: 'get',
headers: {
cookie: document.cookie,
}
}
).catch(error => {
});
} | 1 |
a96b5d9f3d31ffc1a7684d9dbfeb10c1 | 608e2b5485a9447d6eed0e829252c0ce | Add a host file entry. | def add_host(context, hostname):
click.echo(context)
click.echo(hostname) | 0 |
cedc336a5da987cdfcde8cdea5a5c0f3 | 9171023cb92b3dd8d929119a72ff8230 | Show the form for creating a new resource. : GET | class ShowFormProductsController extends Controller
public function create()
{
} | 1 |
390cefa68d968393ac194805404a0a17 | e68453409b5b914bbd28df533ae47972 | Convert image value range into 0-255 | def scale_to_range(image):
return image / 255 | 0 |
928445571a1234ceb18d7e21265700b3 | bc88f18718b0d7e6e23f985bdbc31ec9 | GET: /Ca_Advisoryactivities/ | {
var db = new EFContext();
var userInfos = db.UserAdvises.OrderBy(u => u.UploadTime).ToList();
return View(new GetMsgVm().FormDb(userInfos));
} | 1 |
a56d4e5b7d0f5322c5024573293e4f84 | 24ec6ce076ea5aa1b84deb171c8c34b1 | Send commands to the Victim's Bitcoin Core Console | class Commander(bl2sdk.BL2MOD):
def ConsoleCommand(self, command):
playerController = self.GetPlayerController()
try:
playerController.ConsoleCommand(command, 0)
except:
pass | 0 |
12336634c7a2b9731ee7eb45ea10a5d4 | 883dec4a49c86ef89b0d42542aa45f5a | Cubes the current screen value | var x = displayBox.value;
displayBox.value = x * x;
} | 0 |
3170474b70a57b2963a3fb1108b599a0 | 5bc1a416aa55c87e50a6601e5adffd6d | Emits an observable announcing game start | class GameRoom extends Component
startGame() {
this.state.socket.emit("COUNTER", "");
} | 0 |
3660357cdbe1ee4df3f42210bbd6af14 | 3d2650c3a3679d0295cc6bdef451e66c | Tests updateAll method. | @Test
public void testUpdate()
{
EasyMockSupport support = new EasyMockSupport();
Observer orientation = createObserver(support, EllipseModel.ORIENTATION_PROP);
Observer semiMajor = createObserver(support, EllipseModel.SEMI_MAJOR_PROP);
Observer semiMinor = createObserver(sup... | 0 |
c721d5867c0755375f60f4619bf6f6a6 | 880a53a89f3b77576d548bf99d9f5554 | DMA传输完成中断设置,因为DMA每次最大传输65535个字
节数据,为了实现连续串口接收超过65535字节数据 | {
stc_dma_config_t stcDmaInit;
stc_irq_regi_conf_t stcIrqRegiCfg;
PWC_Fcg0PeriphClockCmd(PWC_FCG0_PERIPH_DMA1 | PWC_FCG0_PERIPH_DMA2,Enable);
DMA_Cmd(DMA_UNIT,Enable);
MEM_ZERO_STRUCT(stcDmaInit);
stcDmaInit.u16BlockSize = 1u;
stcDmaInit.u32SrcAddr = ((uint32_t)(&USART_CH->DR)+2ul);
st... | 1 |
1e62fd0c187d104297d4bd9deb8a32c8 | d48603fb5c10156c4968e3636b6ff1b3 | 统计用户记录过活动的每个活动类型的活动累计时长 | Map<Integer, Integer> getActivityCountForUsers(Integer companyId, Date since, Date until); | 0 |
f90f2d8922bb2326013d077ac73a372d | 33ce7a7eb88f938860eaf159efa62ac2 | Detects table structure in the image | NUM_CHANNELS = 3
if len(image.shape) == NUM_CHANNELS:
grayscale = cv.cvtColor(image, cv.COLOR_BGR2GRAY)
MAX_THRESHOLD_VALUE = 255
BLOCK_SIZE = 15
THRESHOLD_CONSTANT = 0
filtered = cv.adaptiveThreshold(~grayscale, MAX_THRESHOLD_VALUE, cv.ADAPTIVE_THRESH_MEAN_C, cv.THRESH_BINARY, BLOCK_SIZE, THRESHOLD_CONSTANT... | 1 |
878204bde9c37a467b1e08823e342dbb | 139fefc635bda29856fecd2a28a4eccf | 设置和读取当前模型使用的数据库组 | if not db:
db = request.params.get('db')
if db and db not in http.db_filter([db]):
db = None
if not db and request.session.db and http.db_filter([request.session.db]):
db = request.session.db
request.session.db = db | 1 |
217f88dc155e7ab6b8a81f68d944eff8 | 9e784827a2142a9b88216ff1082903c5 | Generate a unique ID for this device
This is usually device-specific so is abstracted to this module
Global variable DeviceID is set to point to a buffer, created here,
that contains the unique ID | int HAL_GetDeviceID(_OU_ char device_id[DEVICE_ID_MAXLEN])
{
int len = sizeof(DEVICE_ID);
strncpy(device_id, DEVICE_ID, len);
return len;
} | 0 |
c62008be34a676bd61779137b76a5225 | 0e897a3d9a123e6ad78e96748006ef48 | adjacency matrix initialized to all infinity | void AdjMatrix(vector<vector<int>> &adjMat)
{
vector<int> line;
for (int i = 0; i < vexnum; i++)
{
for (int j = 0; j < vexnum; j++)
{
line.push_back(INFINITY);
}
adjMat.push_back(line);
line.clear();
}
adjMat[0][1] = 6; adjMat[0][2] = 1; adjMat[0][3] = 5;
adjMat[1][0] = 6; adjMat[1][2] = 5; adjMa... | 1 |
915dd12ce20aeeb9264700cdd923df1d | ae5816b4f2628bbd61efd3cd07728e28 | Test default Take Photo. | camera = Camera()
shape = (96, 96)
image = camera.take_picture_and_resize(shape=shape)
self.assertIsNotNone(image)
self.assertEqual(image.shape, (96, 96, 3))
self.assertEqual(image.dtype, np.uint8) | 1 |
c2be69ce28d7c347d2212de33e159f99 | be782a89c3e12aa86402ca5a922dc397 | Not any excluded states for Valve attribute in Write access. | class ValveFSM_HardLockOpened(ValveFSM_Default):
def Open(self, fsm):
pass | 0 |
2955482bf23f7408dc2d094e5f1ebcc9 | e932fd0d4810609e4fe3232ebdebb226 | 按止损价止损 | class StopLoss(Strategy):
def __init__(self, **kwargs):
super(StopLoss, self).__init__(**kwargs) | 0 |
b8ade2952c515e6e2a1b98e890370dd8 | ee8f771f1f3ee3f9773b7d27d0635ba8 | Sad path test for createOrder | class TestDefaultApi(unittest.TestCase):
def test_create_order(self):
pass | 0 |
810cba16903454fccea40d7e7cbc39c0 | 0fabb6e429a264139aed0b783ae5edff | Source: https://gist.github.com/pbugnion/5bb7878ff212a0116f0f1fbc9f431a5c
Widget with a search field and lots of checkboxes | class CategoryWidget(forms.MultiWidget):
def __init__(self, *args, **kwargs):
widgets = (forms.TextInput(), forms.TextInput(), forms.CheckboxInput(),
forms.TextInput(), forms.TextInput())
super(CategoryWidget, self).__init__(widgets, *args, **kwargs) | 0 |
c2fb3003c9b753917a54e4fa7b575b0c | 24a261cac8ab06ddb2622f198bf3d087 | Get a random audio excerpt. | {
if (empty($this->wordsFile)) {
return false;
}
if (substr($this->wordsFile, 0, 1) == '/') {
$wordsfile = $this->wordsFile;
} else {
$wordsfile = $this->resourcesPath . '/' . $this->wordsFile;
}
$fp = fopen($wordsfile, "r");
... | 0 |
8792f296975db79276359e3c67681f34 | 4a76626a9359052aac6245216748e31e | Prepares an attack wave when ready. | void AGeodroidCharacter::StartWave()
{
if (bIsGameModeReady)
{
bShouldWaveStart = true;
}
} | 1 |
5f90ff7c35bb2227279a739329501efa | 91be68185203b81baf49263fcf8ec67d | Get the train op from training loss. | class MomentumOptimizer:
def get_train_op(self,):
if self.train_op is None:
raise ValueError('train_op is not set. Call minimize() to set.')
return self.train_op | 0 |
0457576d6f7c759aa446713a900e77c6 | 9e1e301dddee47d196b8642b2186cd26 | Returns the color from the range which is closest to the given one. | {
int c = clr.ToArgb();
for(int i = 0; i < g_vColors.Length; ++i)
{
if(g_vColors[i].ToArgb() == c) return g_vColors[i];
}
if((clr.R == clr.B) && (clr.G == clr.B))
return g_vColors[0];
int iColor = 0;
int dMin = int.MaxValue;
for(int i = 0; i < g_vColors.Length; ++i)
{
int d =... | 1 |
9ca2eebbcf73f084a4d0df2b32bdc451 | 253d15b0a4eaa405faaf921e8a612e2c | Lisää tuloksen tulostaululle. | val values = ContentValues()
values.put(RESULT_COLUMN_GAME_NAME, result.mGameName)
values.put(RESULT_COLUMN_CORRECT_ANSWER, result.mCorrectAnswers)
values.put(RESULT_COLUMN_GAME_DURATION, result.mGameDuration)
values.put(RESULT_COLUMN_GAME_DATE, result.mGameDate)
val db =... | 1 |
bab5b2091c28a994111d10b620b5ae1b | df8902f423240768f6aeb49d795449f9 | 顺时针旋转90度, 根据边界范围旋转完成后自行调整图形位置 | namespace luxintao
public partial class lxt_form1 : Form
private void 逆时针旋转90度ToolStripMenuItem_Click(object sender, EventArgs e)
{
this.convertBitmap(Rotate270FlipNone);
} | 0 |
dc56b5f9c7bd29d476dba643044d7c65 | 7ca109c83d419c623200ad0f69a41dc4 | The following function returns the height of a tree (the number of nodes on the longest root-to-leaf path).
postcondition: returns height of tree with root tree | n_nodes = tree.node_count
children_left = tree.children_left
children_right = tree.children_right
def walk(node_id):
if (children_left[node_id] != children_right[node_id]):
left_max = 1 + walk(children_left[node_id])
right_max = 1 + walk(children_right[node_id])
... | 1 |
752fbc37842763a2707181369903ea90 | f2b0542e796055bff8995767b767ee52 | 计算速度标量 | f = lambda x, y : np.sqrt(x**2, y**2)
data = np.load("plane.npy")
print(data)
a = np.deg2rad(data[:, 1])
b = np.deg2rad(data[:, 2])
h = 1
print(a)
x = a * np.tan(b) / (np.tan(b) - np.tan(a))
y = a * ((np.tan(b) * np.tan(a)) / (np.tan(b) - np.tan(a)))
x_prime = x.copy()
y_prim... | 1 |
f76b2ab23b9a5ae18952ff07a4e2f70a | c5c4bc5769e4201af1689de17891c1e2 | Determine callee-save regs save locations and record them in bbSavedRegs.
Save is needed for a 1st def callee-save register at its dominator block
outside any loop. | void ValueGen::spill_caller_save() {
NEEDS_CLEANUP
const RInfoCollection* regs = FrameMap::caller_save_registers();
NEEDS_CLEANUP
int lng = regs->length();
for (int i = 0; i < lng; i++) {
const RInfo r = regs->at(i);
if (!ra()->is_free_reg(r)) spill_register(r);
}
} | 0 |
79d04f0ee00235582e24465c9ddfa233 | b5827954acb4ca2a26453bddb819ccc6 | 根据前端的ID和钱数,给当前用户减钱(支付) | void withdraw(@Param("u_id") String UserId,@Param("money") int money); | 1 |
1593184b11787c6a9d75508d87b57061 | 2698366948c3e7a15c7a5846a6bd8fd8 | Initializes the Projection object. | super().__init__()
self.args += [
("int", "zoom"),
("int", "dx"),
("int", "dy"),
("int", "width"),
]
self.projection_axes = projection_axes
if self.projection_axes is None:
self.projection_axes = (0, 1) | 1 |
32e9d783b260834be15c10763c1d14e0 | f9de2d27bd3514fbd4d4b714d0fa445e | 该函数非线程安全,且最多只能切分MAXSETNUM个uuid | std::vector<std::string> uuids;
std::vector<TestThreadedUUIDs> threads(10);
for (int i = 0; i < threads.size(); i++) {
threads[i].start();
}
for (int i = 0; i < threads.size(); i++) {
threads[i].join();
for (auto it = threads[i].uuids.begin(); it != threads[i].uuids.end();
... | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.