query_id
string
corpus_id
string
query
string
code
string
label
int64
0dd50e373f5344006fd1f73d8a5d9b26
553fb40bf2227eaa9d637bc491bc332b
各个省份的的总成交量对比
{ $date = date('Y-m-d'); $res = DataMonitorHandler::getProvinceSales($date, 'day'); foreach ($res as $key => $val) { $val['y'] = round($val['y'] / 100) / 100; $res[$key] = $val; } $res = empty($res) ? [["x" => "", "y" => 0]] : $res; return $res...
1
1b2c74fd572abe265bcefdcb6bb6070d
d290121baabaf87f728a62c6ea184bd8
将csv格式的转成json
csvFile=open(os.path.join(rootPath,csvFilePath),'r') csvReader=csv.reader(csvFile) csvRow=[row for row in csvReader if len(row)!=0] csvRow=flatten_lam(csvRow) csvRow=[eval(row) for row in csvRow] jsonFile=open(os.path.join(rootPath,str(time.time())+r'_csv2json.json'),'w') json.dump...
1
78e6914c0abc94189056421d2bf54db7
29bf7eccd4f34ce98186f39267df9df0
APIResponse creates an APIGatewayProxyResponse with status code and body
function ok(data: any, statusCode = 200, headers: Headers = {}): APIGatewayProxyResult { return { body: JSON.stringify(data), headers: { "Access-Control-Allow-Origin": "*", ...headers }, statusCode }; }
1
a0dc19c0afac8600536db6f1ef4c5dc7
27738808f2fe28c369b5f7cf3e563d30
Sets extraction mode, option that will control extraction process.
class TypeCreditCardTypeHistory extends TypePaymentCardHistory public function setExtractIndicator($extractIndicator = null) { if (!is_null($extractIndicator) && !is_bool($extractIndicator)) { throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a bool, %s given', var_ex...
1
350c5a2dc38b9a382d236e5411bdf3d6
9963e369594fcdfaf1f446d6021d9c78
Pequenya aleatoriedad de la posicion donde caen las objetos al tirarlos al suelo
{ s_pos.x = Random.Range(-5.0f,5.0f); s_pos.y = Random.Range(-10.0f, 2.0f); s_pos.z = Random.Range(20.0f, 25.0f); }
1
4a7b79a96f2e43cc9c69be63d6397896
446d6b414df3ff36305151797dedf02a
把按钮加入界面, 并存入ButtonList数组
{ int x_st = 100; int y_st = 100; int i = 0; for (i = 0; i < 10; i++) { Button btn = new Button(); btn.Name = "button" + i.ToString(); btn.Text = "button" + i.ToString(); btn.Size = new Si...
0
e779edce82dcc95297e5cd57a24287b6
5116254c0594a9177109a653ef9be132
converts pixels to excel units
def in2px(i): return i * PIXELS_PER_INCH
0
7809822005cdc17416781aba932f0489
e7ff063910f4d67babb936532c3f0bf1
create security admin from given user and add him as security admin of given security team
namespace Monosoft.Database.Auth.Datalayer public class User public static User CreateAdmin(Monosoft.Auth.DTO.User usr, Guid organisationContext) { Console.Write(organisationContext); string pwd = "defaultPWD"; var dbuser = DataContext.Instance.Users.Where(p => p.Name == ...
1
6fabb9fbbb21059cc184fa4b1856bf3e
b54b88212596fbe30834f68ac528e3ee
Testcase - Validate Sign Up from Cars HomePage
CommonFunctions f1= new CommonFunctions(driver); f1.waitFor(20); f1.click(mnuYourTrips); f1.click(LinkSignIn); f1.waitFor(20); driver.switchTo().frame("modal_window"); f1.waitFor(200); Actions act= new Actions(driver); WebDriverWait wait = new WebDriverWait(driver, 200); wait.until(ExpectedCondition...
0
bd310fc50ca6720f314b8ece8a0436ef
c2011a7f3b3b7b9218fcdd8296965e8f
Инициализация вывода DVI
{ SC_POWER_CTRL2 |= BIT1; #if IS_NT68660_SERIES || IS_NT68650_SERIES SC_DVI_CTRL_333 = 0x07; #else SC_DVI_CTRL_333 = 0x00; #endif SC_DVI_CTRL_334 = 0x00; #if IS_NT68669_SERIES SC_DVI_CTRL_336 = 0xD0; #elif IS_NT68660_SERIES || IS_NT68650_SERIES SC_DVI_CTRL_336 = 0xC0; #else SC_DVI_CTRL_336 =...
1
b87fa6a6af4ca70556b5e1b6a99739e8
ab3b2080b724e1599a988ff076cf23a7
We queue the objects to be destroyed: we can't destroy them while the physics engine is in the middle of its computations.
class PhysicalWorld(cocos.layer.Layer): def process_destroy_queue(self): for body in self._destroy_queue: self._engine.DestroyBody(body) self._destroy_queue = []
1
af925d9e5034688451ff97e4edbdd585
ec339d8064378b2ad2004b69f8b6a09d
Convert list of town names to routes text.
result = [] start = route[0][:] for i in range(1, len(route)) : temp = start.strip() + '-' + route[i].strip() result.append(temp) start = route[i][:] return result
1
91d38ab30ae998727a83867f61c83782
4dc322855bd93829fcaefcd76efc8ac8
invoked when a user selects/unselects a conference using the checkboxes
newSelectedValue, store) { const state = store.getState(); const conference = getCurrentConference(state); if (!conference) { return; } if (!isLocalParticipantModerator(state)) { return; } if (newSelectedValue === 'off') { conference.sendCommandOnce( ...
0
fab66ad848600438a630f06a3f4b90dc
49d8d6510d38b09d8ba5caaab499063d
Сжатие png
$im = new Imagick(); $im->readImageBlob($image); $im->setImageFormat(self::FormatPng); $im->setOption('png:compression-level', 9); return $im->writeImage($filename); }
1
d87f06d7c18ce978ce711368e8d3c5e6
bf05fd9eb107a6e19114d8d0fd84c849
! @brief Tells whether or not signal components are hidden
bool FlashComponent::isVisible() { return is_visible; }
0
8a09bc80a7bd2dfc463c934c6f6e2d5c
df2b6b04ab858d91e43f6a13cce0f3aa
C-major chord
def dMin(): playNote(62,250,90) playNote(65,250,90) playNote(69,250,90)
1
646b4216ccd6ccd339597324c9cd2eed
7f61448ad6da3ef0f9cb03f40c5be655
in a format that can be directly pasted into sh to be run.
cases like (1)
0
4cf3dc1b4fc98a71db722ef251db7ec1
5149f74285573398ba06a63d85e02d9c
The key may be used in a key agreement protocol.
class CertificateCertificateDescriptionX509DescriptionKeyUsageBaseKeyUsage(dict): def key_encipherment(self) -> Optional[bool]: return pulumi.get(self, "key_encipherment")
0
40b0dabd05e01517ccae00fd8e51921c
f108a42b3d4ecad93ce261a5c7467e7b
Decorate routes that can only be accessed by anonymous users. https://flask.palletsprojects.com/en/1.1.x/patterns/viewdecorators/
f_oauth_required = oauth2.require_oauth()(f) @wraps(f) def decorated(*args, **kwargs): if current_user.is_authenticated: return f(*args, **kwargs) else: try: return f_oauth_required(*args, **kwargs) excep...
0
6e93c001c5a6a2ad537f2801f4938589
cda2803478dc23bcc06ed963d4288f5b
create out of order timestamps to test sorting
u1 = generate() sleep(.01) u2 = generate() time1, time2 = unpack(u1)[0], unpack(u2)[0] self.assertLess(time1, time2)
0
c8088ab8f86f524cc4efa378e0d1f495
b10f74c2da427f8002c05539c465f79a
Starts building the project using the specified options.
{ if (settings == null) { throw new ArgumentNullException(nameof(settings)); } Run(settings, GetArguments(project, arguments, settings)); }
1
ef7f60750e7b7c0adf08237593c6eefd
0a7501b41045458ae8f99b59ad1a55e8
Add tainting logic relating to variable declaration
switch (t->nodekind) { case StmtK: switch (t->kind.stmt) { case AssignK: case ReadK: if (st_lookup(t->attr.name) == -1) st_insert(t->attr.name, t->thisLine, location++); else s...
1
7f1bcbde2b8c4767817090b4c7bf2735
2821f8d0832dc830d481c2c60f70e385
リレー先を抽出する処理
regi_number = '' txt = self.text.split('\n') for l in txt: if 'レシ' in l or 'レジ' in l or 'No' in l: _regi_number = self.__getDigit(l) if len(_regi_number) > 4: regi_number = '{0}{1}{2}'.format(_regi_number[:1], '-', _regi_number[1:5]...
0
02e9f6081a06fb87fcb1f61a452072ee
23b84fc921cb3e1defc80f45069dbb93
根据thing 的id 查找该事项
async function getThingByTid(params) { return request({ url: `${apiPrefix}/thing/getThingByTid?${stringify(params)}`, }) }
1
4abb8e2d98e85fb5ccaafd8bbf2dbca5
ec31cb8e047998940ed7d3a2a40bf345
fournit un objet Soiree qui contient tous les détails concernant la PROCHAINE soirée (un seul enregistrement dans la table ae_soirees) le résultat est fourni sous forme d'un objet Soiree le paramètre "relire" permet de tester si les données ont déjà été lues et stockées en variable de session si "relire" est égal à tru...
$sql = $this->db->prepare('SELECT * FROM calendrier WHERE journee=?'); $sql->execute(array($journee)); $result = $sql->fetch(PDO::FETCH_OBJ); return $result; }
0
036e2a1d56bf594a5ef818d53cef533b
e746b0306089e3f7c7731999dfc6a777
获取棋子将绘制的矩形(棋子填充比棋格小15%,以保证美观)
void ChessBoard::drawChess(QPainter& painter){ for(int i=51;i<=203;i++){ int X,Y; if(!Rotate){ X=MARGIN_X+Grid_Width*(i%16-3)-Radius; Y=MARGIN_Y+Grid_Width*(i/16-3)-Radius; }else{ X=MARGIN_X+Grid_Width*(8-(i%16-3))-Radius; ...
0
42a569834afa57c5993df1557ee6ed5f
da9073ecc8255e42d8cdf653d42f3c3c
シナリオから各ボタンを生成する
namespace ImageSample class ImageSample : NUIApplication private void CreateButtons() { mButtonTableView = new TableView(1, mCaseCount); mButtonTableView.PositionUsesPivotPoint = true; mButtonTableView.PivotPoint = PivotPoint.CenterLeft; mButtonTableView.Paren...
1
df832a46fd7938881521cf3de0828893
4431f4b266fe6447de5eb3cde7094f20
salva json das acoes para trabalhar offline
function salvaJSON(dados) { fs.writeFile("src\\data\\data.json", JSON.stringify(dados), function (erro) { if (erro) { throw erro; } console.log("Atendimento salvo"); }); }
1
c1a3e9ffb3e6e3f9101cae41b125a775
7c8bead7711315e95a0294da6eb35ebe
POST /arduinos
class ArduinoController extends Controller public function create() { return view('arduinos.create'); }
0
0c14cc6425c58a312a59faa7bcdb8288
69d07167ec81abce400038446f0a9353
What is the first term in the Fibonacci sequence to contain 1000 digits?
series = 0 for i in range(1, 1001): series += i**i return str(series)[-10:]
0
a3f69fd1f478308c8d7402e0ca9dc57d
598618551c5e473704db42ccb639cde6
This command sets the display to have all pixels at GS0.
void LCDGoto00() { LCDWrite(0b000000010, 0); delay_mc(1); }
0
9d173d042db847686582fc28d7844e74
d87f7840ba5f72df12da6dabfa9bc19e
Verifies that the specified element(s) has the specified class.
public void waitForClass(final String elementLocator, final String clazzString) { _adapter.waitForClass(elementLocator, clazzString); }
1
2a9a21f90e992d5f0f3d01091a673fe2
7cf9c58fc2f4c1f72b1b2b57fd76d30a
Sets the status of this ListOrderIncidentRequest. 状态
public class ItemDetailsRes public void setStatus(String status) { this.status = status; }
0
89eb6d7e1cc97aa1b06b855ca3ab4ef9
3a5ea91aaf6554967a8c599265ddc3f2
Returns whether a command is allowed according to the configured server name or pattern.
foreach( $this->allows as $pattern ){ if( $this->hostMatches( $pattern , $host ) ){ return true; } } return false; }
1
f029a5addd184a7412f6965fba62f94a
526b1a837aeaa482af9dbf0ad878a4ea
模糊搜索数据,根据用户输入的关键字来模糊查询
public String searchKey(String keyWord,Map map){ String keyword= "%"+keyWord+"%"; List<Flower> flowerList = flowerMapper.searchKey(keyword); if(flowerList!=null && flowerList.size()!=0){ map.put("flowerList",flowerList); }else{ map.put("sereachnothing","1"); ...
1
0627f736addbb3766ce1098c3883cb8c
bc83c984009754834d0eed5dab3f9479
Gets the existing data at the given path. If such data does not exist, will return None.
filename = self.get_path(*path_parts) with open(filename, 'r') as fh: return json.load(fh)
0
60597da2234aea63ee7ee4f3a0869efc
b0bd5f1779604d1974422770ea169b04
a function used for writing all the data from the metrics to a .txt file when the game is finished
{ ofstream g("scores.txt"); for (int i = 0; i < 3; i++) g << secE[i] << " "; for (int i = 0; i < 3; i++) g << secM[i] << " "; for (int i = 0; i < 3; i++) g << secH[i] << " "; g.close(); }
1
2a9c181989eb585f818bd163d2e06e41
a64a52dd1bf3c130282145aa306e211b
Function that is called by keyboard to update the flag if the hotkey was pressed
if key == simplegui.KEY_MAP['w']: self.w = True if key == simplegui.KEY_MAP['a']: self.a = True if key == simplegui.KEY_MAP['s']: self.s = True if key == simplegui.KEY_MAP['d']: self.d = True if key == simplegui.KEY_MAP['m']: ...
1
2095280c0d59bdc08092f94997dc0fda
c24642ca049d76d0252da19118591708
Verifies implementation of Series.operator.add between two numeric Series with default indexes and same size
class TestSeries_ops(TestCase): def test_series_operator_add_str_align_index_int(self): def test_impl(A, B): return A + B
0
3e8e4f0062b06a730e577d1b11141531
51859796ac94e41a518c6166a8075bfa
Get the total spent by county
Price getTotalSpending();
0
81c67361632cdd31d6daea0349acdab6
d8f5196a7e45a64c765990528517b234
a class for creating user profiles
self.user_type = user_type self.first = first self.last = last self.age = age self.gender = gender self.q = questionnaire self.bio = bio self.email = email self.user_matches = [["", 0],["", 0], ["", 0], ["", 0], ["", 0]] self.username = username self.password = password
1
be36cd59b3e56c716f26d01d879d4a87
cdd6d53b167b8735edf10522f03c2853
Estimate how much disk space (in bytes) is needed to write out. Since OVA (TAR) is an uncompressed format, the disk space required is approximately the same for both OVF and OVA output. Thus we can provide this value even if :attr:`output_file` is ``None``. In the TAR format, each file in the archive has a 512-byte hea...
if self.blob.uncompressed_size: return self.blob.uncompressed_size return (self.layer_info.compressed_size or 0) * estimate_multiplier
1
af5a9404aec67b5f6e2d0d8d1c8f3a96
5a3f49e8fbc0cd883d36473c1a97034d
Error accessor.
class Error public function __get($key){ return isset($this->{$key}) ? $this->{$key} : null; }
1
e27454787bebd1ea2c161ba3eaea3396
1929296e3a6af26dd0dae3558572e01d
updates the tags table after a new photo was selected from the photos table
resultsTable.getItems().remove(0, resultsTable.getItems().size()); if(SearchPhotoByTagController.tags) { photosInAlbum = (List<Photo>)SearchPhotoByTagController.finalList; } else { photosInAlbum = SearchPhotoByDateController.searchResult; } imageColumn.setCellValueFactory(new PropertyValueFactory<>("im...
0
a7a7fde1a67f66a0524ec9a918d38cdc
a7ac3e54d2fc948cc92e546174356fb7
获取外部通讯录中某一类别中所有联系人方式
boolean mShowInvisible, int start, int limit) { mContext = MyApplication.nowApplication.getApplicationContext(); ContentResolver cr = mContext.getContentResolver(); ArrayList<ContactBean> data = new ArrayList<ContactBean>(); Uri uri = ContactsContract.Contacts.CONTENT_URI; String[] projection = new String[...
1
87ad60a433f703075c680aa2a353a813
87190d2cc6a83b7e010f368642a3b922
select * from dog where name='zhangsan-7' or (name='zhangsan-5' and age=25)
public void orNew() { List<User> userList = userMapper.selectList(new EntityWrapper<User>().where("name like '%ang%'").orNew("age=18")); System.out.println(userList); }
0
1684f6a2c0f3c7ac7061d738ec4c624d
31aa6dfac7f12f271ce4f243b36bcd5a
Creates a new the service account with the given parameters.
class UserApi def user_create_service_account(user, opts = {}) data, _status_code, _headers = user_create_service_account_with_http_info(user, opts) return data end
1
ffabe3c62606ca81574283dc251bfc28
6cac64c820a24f42a385b7aa6ad46124
Creates a polyline from a collection of paths or rings.
namespace WLib.ArcGis.Geometry public static class PolygonRingsOpt public static IPolygon CreatePolygon(this IEnumerable<IEnumerable<IPoint>> pointRings) { List<IRing> rings = new List<IRing>(); foreach (var ptRing in pointRings) { rings.Add(CreateRing(ptR...
0
caf3b52696d4e389cf059ed13379fb61
fa9b7f9cc5775fa2e1c28e93cb306500
Binds each question's check box field such that the user cannot select an invalid combination.
public class QuizBeginnerActivity extends AppCompatActivity public void bGetAnswers(View view) { if (view instanceof RadioGroup) { if (((RadioGroup) view).getCheckedRadioButtonId() != R.id.answer1 || ((RadioGroup) view).getCheckedRadioButtonId() != R.id.answer2 || ((RadioGroup) view).getCheckedRadio...
0
2238a98c691f7fb22abc0fc4329e50c4
ae7067149269671b10dde12cb7cca76f
线程函数一,视频帧畸变校正处理
void correct_thread_entry(void* parameter) { rt_uint32_t e; rt_uint16_t i; rt_int16_t * mpu1, *mpu2, *mpu3; rt_int16_t m1, m2, m3; rt_sem_init(&angle_fix_sem, "angle_fix", 0, RT_IPC_FLAG_FIFO); while (1) { rt_sem_take(&angle_fix_sem, RT_WAITING_FOREVER); rt_kprintf("start ang...
0
da5da2c05f6f9289ba3f5883f7ffd65f
1cafedc0f301c4bfb53192a41a35dd76
重新设置Playable时间
public class PlayableTime : BasicPlayableBehaviour public override void OnBehaviourPlay(Playable playable, FrameData info) { allTime = (float)PlayableExtensions.GetDuration(playable); }
0
08c1e96f500999ebe66265a67129b175
f3f82a490b00f9164cf8707fdb89acd6
Removes all special characters from mac address
public class Formatter public static final String formatMacAddress(String macAddress) { return macAddress .toLowerCase() .replaceAll("-", ":"); }
0
f9e6dcfe8055d3e2f8265792c9aaf25a
6ba11d5380162bfb224b9c971ec60818
Gets descendants and includes itself. Use treebeard's get_descendants if you don't want to include the category itself. It's a separate function as it's commonly used in templates.
qs = self.__class__.objects.filter(parent=self.parent) if not include_self: qs = qs.exclude(pk=self.pk) return qs
0
6bd15f2b33e15b0c1bf1e7bfb12b0fcc
6f3e799c61c4dcafee86d24b15ca031c
所有用例执行之前只执行一次
class TestInfo(): def setup_method(self): print('前置操作method,整个method开始用例前只执行一次')
1
86b7cb934b0b2a30a01452f37af5e7f4
fb214b8119f793be5b942c232449d27b
obtain least significant 16 bits of a value
namespace InputLayer sealed class WMInputLayer : Form, IWMInputLayer static Int32 LoWord(Int32 number) { return number & 0xffff; }
1
8e130c4dceb95f7992bb251b870b6a21
f36f86714c41176a68d5ed0c106d9cb7
絕交
if($this->input->post()){ $data = array( 'user_id_1' => $this->input->post('user_id_1'), 'user_id_2' => $this->input->post('user_id_2'), ); $rejectFriend = $this->postPatients('rejectFriend', $data); $this->redirect(true,$this->input->post('username')); }else{ $this->denyAccess(); } }
1
7e2d1dd29919b9b2c8bb8d7d4da2cabb
fb307412ffa1c6860fbbd863dec315b1
An internal helper function to get a counter name.
class CounterBase(object): def get_key(self, counter_id): return "%s:%s" % (self.prefix, str(counter_id))
1
4a3f496bb0e7996def32012b3050a243
17075d7155e0c2457f7a142545a5194f
通过检测两次鼠标单机的间隔来模拟鼠标双击事件
class UI: def mouse_dclick(self,x=None,y=None,t=0.5): if not x is None and not y is None: self.mouse_move(x,y) win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0) win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, 0, 0, 0, 0) win32api.mouse_event(win32con.MOUSEEVEN...
0
58e9d20001973d8d2e83291bf9f297eb
063030c2f31d180f6c087801c9881431
Asserts that the element exists in the DOM and is not enabled.
FluentWebElementAssert isEnabled();
0
0d08a3257808bd19b2b41f3031a42449
e7095499140bc1e0cd9635ffb10b7149
Finding duplicate elements in a sorted list
{ struct Node *ptr1, *ptr2, *dup; ptr1 = start; while( ptr1 != NULL && ptr1->next != NULL) { ptr2 = ptr1; while (ptr2->next != NULL) { } } }
0
791c64c3cb775eb0a8f194ebf7abccd3
fc531db951442a2a38988734fb64d2d6
Obtém a lista de roles e suas respectivas ações
{ $allRolesActions = []; foreach ( $aclData as $acl ) { if( isset($acl['acl']['rolesActions']) && ! empty ($acl['acl']['rolesActions']) ) { foreach ( $acl['acl']['rolesActions'] as $role => $actions ) { if( array_key_exists($role, $allRolesActions) ) {...
1
89c61d4891d7e8e1a78bc9e76605c2ea
80b37cdc579c021ef18b52547648cd7b
返回一屏幕有多少个项
public int getCount() { if (screenNo == screenCount - 1 && items.size() % NUMBER_PER_SCREEN != 0) { return items.size() % NUMBER_PER_SCREEN; } return NUMBER_PER_SCREEN; }
1
4cdff32f6ec35f45fb67c9ce3fc4cf85
913534f48a98c7b75e651f454881ce45
设置权限请求码
public class MainActivity extends Activity implements PermissionInterface @Override public int getPermissionsRequestCode() { return 10000; }
1
aeb88684fa3162ea0790af5bbd7bb107
6ae4f20f60c0e6cfcc16355091d7f5ee
Validates the exercise insert/update form.
if (!Utils.isNonEmpty (this.nameForm) || this.exerciseTypeForm == null || this.exerciseTypeForm == 0) { super.addWarnMessage ("formUpdateExercise:messagesUpdateExercise", " Preencha os campos corretamente."); return false; } return true; }
1
ddba768f9f7f2f509b94b13abc5652bf
2b4113c4547239c4f5010e369c8ad420
Apply the compound interest formula to p to produce the final amount.
def compound_interest(P,r,t): Pt = P * (1 + r/100)**t return Pt
1
29645e6740b15b08eac0d4e44f4f3c97
62d92ffd1c991ac742d42308dd20c683
Returns whether the interface supports calling by IDispatch
{ if(InlineIsEqualGUID(IID_IPager, interfaceToCheck)) { return S_OK; } return S_FALSE; }
0
34d6dca5f1c88e74b10ce1d8945ff846
4a7aa559bb7f5ff4075489795c9daef7
启动广播服务
Intent intent = new Intent(); intent.setAction(Const.BT_SERVICE_ACTION); getActivity().bindService(intent, new BtServiceConn(), Context.BIND_AUTO_CREATE); }
0
70cdf68a7f93311ca2d5736dd1194ad6
458f91d9a5e94f18ac67ffc740004783
Make a Hazard from the Pmf.
mix = Pmf(name=name) for pmf, p1 in metapmf.Items(): for x, p2 in pmf.Items(): mix.Incr(x, p1 * p2) return mix
0
8414aba4347260f30d7c05502fe6b796
3e38e587a0a055b68c32977b77a0cc43
Тест на вычисление площади квадрата
public void Square() { double a = 3; double b = 4; double c = 5; double expected = 6; double actual; Triangle tr = new Triangle(a, b, c); actual = tr.square(); Assert.AreEqual(expected, actual); }
0
b962e119db482d182d068c348e4413be
c812f674d9e2bdcc63c809e9250940b4
method to load requirements from a file
RCNormReq = collections.namedtuple('RCNormReq', 'Num_Var Num_Constr Num_Bin Num_Int Num_Non_Zeroes Num_Equality') Num_Var_idx = 0 Num_Constr_idx = 1 Num_Bin_idx = 2 Num_Int_idx = 3 Num_Non_Zeroes_idx = 5 Num_Equality_idx = 16 Num_Var, Num_Constr, Num_Bin, Num_Int, Num_Non_Zeroes, Num_Equ...
1
0e8b67ecb7e55c125a13f73cf06b66d0
db54a72f6dbe6468f7878016c14638e3
Finishes control initialization and resumes controller attachment
namespace OpenLiveWriter.Controls public class LightweightControlContainerControl : FocusWatchingUserControl, ISupportInitialize, ILightweightControlContainerControl, IToolTipDisplay public void EndInit() { if (--initializationCount == 0) ResumeLayout(true); }
1
0d1cadfbc4ae1022078f861ea70f7795
23d50f2573dd4e98d72e771165347c37
Squared L2 Norm of x.
def squared_norm(x): return (x ** 2).sum(1).view(-1, 1)
1
4c5561f4c223749c95ee734bbe514aff
cb6796954c32585614885153612f0173
Creates a six digit instance with the default time step.
class League class Floodgate class NextTimeGenerator_Floodgate_3600_0 def initialize super end
0
486609739fae81e879b20e187cfb01d4
a59c1a4307720bf9b2d2d856cf2ca854
metodă de a converti un CursEntity într-un CursDTO
@RestController @RequestMapping(path = "/cnes") public class CnesController private Cnes convertToEntity(CnesDTO cnesDTO) { return modelMapper.map(cnesDTO, Cnes.class); }
0
cd726540da3ab6dd6f5780ca1ddca2e5
3b65e9233c1e8f11f8e863959a1ff05f
按照单元格名称写入Excel
class WriteExcel(): def write_excel_xls(cls, cell, value): workbook_ = load_workbook(file_name) sheetnames = workbook_.sheetnames sheet = workbook_[sheetnames[1]] sheet[cell] = value workbook_.save(file_name)
1
504ce5305ec0efd54f271a2b80c8101f
4d2b826612ee12bc7ade5dc26627a871
Creates a control panel to adjust the stem plot
cbar = Checkbox(description="Colorbar") link((self.model, "colorbar"), (cbar, "value")) interact = Checkbox(description="Interactive") link((self.model, "interactive"), (interact, "value")) plug_select = Checkbox(description="Line Selection") link((self.model, "selectline...
1
d8539763278f826b7644ed5c018c4020
287e5f2f334d64d01e8850f34fe6091c
Reverse bits of a given 32 bits unsigned integer. For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return 964176192 (represented in binary as 00111001011110000010100101000000). Follow up: If this function is called many times, how would you optimize it? Related problem: Rev...
public class OthersSolution public int reverseBits(int n) { int mask = 1; int result = 0; for (int i = 0; i < 32; i++) { if ((n & mask) == 1) { result = (result << 1) + 1; } else { result = result << 1; } n = n >>> 1; } return result; }
1
38716c12210ba6e2357edda701d0a564
9a9b4bd605b00fc10857d15a42261344
Возвращает массив отсортированных имен шаблонов исследований
{ global $blog_id; $query = "SELECT * FROM `".$this->wpdb->base_prefix."sd_qa_display_templates` WHERE `blog_id` = '$blog_id'"; $results = $this->query( $query ); $rv = array(); foreach( $results as $result ) $rv[ $result[ 'id' ] ] = $this->sql_to_display_template( $result ); return $this->array_sort_su...
1
1c58c4fc3fc035c4100e67592df6e117
988c615767e1e7247052a5c889406117
Action responsável por pesquisa de grupo de vendas por data.
{ $periodo = Carbon::parse($request->data) ?: Carbon::now(); $customer = Customer::first(); $customer_id = $request->customer_id ?: $customer->id; $clientes = Customer::all(); $vendas = Sale::whereDate('updated_at', $periodo)->where('customer_id', '=', $customer_id)->get(); ...
1
dcc6462dd3a9a48bdb89a41ba898c094
bb0c293f5fd4d1a0851da4e642271c51
添加支付配置弹窗
class GameConfig_Model extends Model{ public function addPayConfig($data) { if($this->db->insert($this->table,$data)){ return true; } return false ; }
0
599a0d4ae0407b9c5f778e4c6b8ff8c6
cc851f3cece14832d67c55f407cc4810
Softly updates the target model
class Agent: def target_update(self): for weights, target_weights in zip( self.model.trainable_weights, self.target_model.trainable_weights): target_weights.assign(weights)
0
3985f30eb2167c210845e85be30af4ce
5d0071896f849124aa63835cfe7e485d
Выполнение запроса от лица аккаунта
class VkApi extends CComponent public function execute_account(VkAccount $account, $method, array $params = NULL) { Yii::beginProfile('vkApiExecuteAccount'.$account->id); if ($params === NULL) { $params = array(); } $params = array_merge($params, array( ...
1
07a4b435d431433b22a94c9e9644fbda
65b988746ec0dd8e715d07fb8b1dbb3e
Parse raw data files at pre-defined directories to generate objects and links between objects for all available features. Currently coded to be specific to E. coli K-12 MG1655 features
def main(dir_name): OUT = open(os.path.join(dir_name,"plasmid_features.csv"),"w") order = ["CDS","promoter","terminator","LTR","misc_feature"] ret = dict((x,[]) for x in order) OUT.write("Name,") OUT.write(",".join(order)) OUT.write(",filepath" + "\n") ls = [os.path.join(r,fi) for r,d,f in os.walk(dir_name) for ...
1
769b0a8487759af8bb516b2aa26926a0
93475eff4942983d7a18fe81d01760d0
Resolve e exibe um sudokus
try: data = interface() data_list = data_list_filter(data, build_data_list(data), 0) newdata = fill_num(data, data_list, 0) print('Answer:') print_sudoku(newdata) except: print('Error occurred! please check your data~')
1
146feb8bebbd0e27499489fc7f48811e
1368ea554dcb398047c9c39554cdbd08
Room constructor.
{ $this->name = $name; foreach (range(0, 9) as $num) { $this->rooms = new Room(); } }
0
d0d42441a6119515f7af2f39da012044
c85519961584be6e94c6182b098ac53e
<p>获取单个应用的授权实体管理Service类</p>
class NewMicroAuthPrivilege public function getAppAuth() { return app('cache') ->remember( 'newMicro:newPrivilege:app:auth', 20, function () { $ts = time()*1000; return app('iceService')->dispatch( ...
0
0682e3f39417367fb370f4dffa1e9b82
bbfb3de68e27a43ebebe9a7f9a64ac54
更新仓库id
public class VipReturnNotice extends VersionDO public void setWarehouseId(Long warehouseId) { this.warehouseId = warehouseId; }
1
0f6d23a0c3569534bdf6be026e533f5e
29cd2c37d5da3a30d1ab4bf459ffd63e
添加合同级别信息
@Api(value="ProcolCont",description="合同类别",tags="procolContController") @Controller @RequestMapping("/procolContController") public class ProcolContController extends BaseController @RequestMapping(params = "doAdd") @ResponseBody public AjaxJson doAdd(ProcolContEntity procolCont, HttpServletRequest request) { Strin...
1
daa1d1305aadcddf4671c1d6b93cf622
2145d523008bffad8b0c49e78c2a130b
执行命令返回首行首列的数据,忽略其他的行和列(命令无需配置连接对象)
namespace Sofire.DataComm.Remoting Result<object> ExecuteScalar(RemotingCommand command);
1
f68fbab3deb734b6679564a7d9ae13a2
8487d3ac88c86798408b4f3f6897f74e
设置条码号校验规则
public class ManageConfig implements Serializable public void setGoodsCodeRule(Integer goodsCodeRule) { this.goodsCodeRule = goodsCodeRule; }
1
b8c4150267a055d1f08b4b299404e2df
e623145d153136b08022c62dd081e51d
短时傅里叶变换stft
class AudioConfig(DataClassJsonMixin): def stft(self, wav: np.ndarray) -> np.ndarray: return librosa.stft( y=wav, n_fft=self.filter_length, hop_length=self.hop_length, win_length=self.win_length, pad_mode="reflect", )
1
d8c175163bd981bbae48aa2a25fb9d45
6a941f6ce676fe845101aec222efe3e4
Convert an Avro schema into a titus.datatype.AvroType.
def schemaToAvroType(schema): if schema.type == "null": return AvroNull() elif schema.type == "boolean": return AvroBoolean() elif schema.type == "int": return AvroInt() elif schema.type == "long": return AvroLong() elif schema.type == "float": return AvroFloa...
1
33d8ebc067806465110d2dbb42f2906a
cde4d57a434c9aaa9dc38d4b52ce4b3f
删除以node作为根节点的二分搜索树中的最小节点,并返回删除节点后的新的二分搜索树的根节点
if (node.left == null) { return node.right; } node.left = deleteMin(node.left); return node; }
1
7fa1e93fd3e5d2269c8ffafca7eaeb91
a5745f6c6ebfbb4702ef04520e7e6b3b
向注册中心获取可用的远程服务,本地实现将会缓存相同参数下上一次的Provider,直到Provider不可用
public class ClientProxyFactory public List<Service> getServiceList(String serviceName){ List<Service> services; synchronized (serviceName){ if(ServerDiscoveryCache.isEmpty( serviceName )){ services= serverDiscovery.findServiceList( serviceName ); if(services==null || s...
1
8acf3a9741c318f94c96deb348e3dec1
d2ca477dbe0ac335b5fc071e96c832d9
Проверка, есть ли кадр в списке ключевых и добавление его в список ключевых
function addRedKey() { if(localStorage.getItem('redKey')) { playerKeys.push(localStorage.getItem('redKey')); } }
0
862ec686f2907413d3187a4e17754d51
fcbd0dbaa5d4502409b8c5b7c165c09f
Adds the element to this diagram.
namespace ThreatsManager.Interfaces.ObjectModel.Diagrams void Add(IGroupShape groupShape);
1
e311d854fd6e797211ca1970228d687c
6fcc46826d6662ce26aa2b14b6236154
updates rName, rNo and chain for all atoms in this residue
for atom in atoms: atom.orig_name = atom.name atom.ros_type = "" atom.mm_type = "" atom.cen_type = "" atom.is_virtual = False atom.rigid_id = 0 atom.fragment_id = 0 atom.conn_bonds = [] atom.is_root = False ...
0
1631f2fb7774d1eead3e9d4e935bd83d
4b4129005b15107117994bf0127e0d66
将数组从index个元素起的length个元素进行排序返回
if (data.length == 0 || length <= 0 || start < 0 || end >= length) { return -1; } int index = start - 1; for (int i = start; i < end; ++i) { if (data[i] < data[end]) { ++index; if (index != i) { int ...
0
a62549c7c03582a1a9d407f4c6d8e791
bbb27417ef25574e79c6878a1bd42f6b
如果在某一页的完整最后一行,并且点击向下按钮
public class questionlistofSingleChoice extends AppCompatActivity implements DownloadCallback{ public void pagedown(){ if(positionindex.get(positionindex.size()-1)<bottomviewposition) positionindex.add(bottomviewposition); prevbottom = bottomviewposition; lv.setSelection(bottomviewpo...
1
7cb8af13fff7d7b80214d069edc0e4a5
5c064fcea3a3b5e5b18b1d6efea8b0f6
Get nationalTeam.
export class PlayerApi extends BaseApi{ public getNationalCoach () : Observable<Array<models.CoachCategoryTop>> { const path = '/games/coaches/national'; return this.getAPI(path) .map((response: Response) => response.json()); }
0