query_id string | corpus_id string | query string | code string | label int64 |
|---|---|---|---|---|
ca757be975a8667248616989eb422db3 | a94a7f74c2d79b76a289d62c521790eb | 接收警告信息 | class ResponseHandler extends Handler
private function sendWarnging(){
if($this->warning != null && count($this->warning) > 0){
$this->setVar(ResponseHandler::KEY_WARNING, $this->warning);
}
} | 0 |
07d4baa6fefe9020ed64e4b75901d37f | 59c0bbed54e98ad0b51ec615fd3271ff | 编写函数 可以计算两个数的和和差,并返回结果 | hap = num1 + num2
sub = num1 - num2
return hap, sub | 1 |
2985fa5039c807aa69c20be88a1510b7 | 95c4517756279d783e3ca716de80796d | Try to read a byte, if available, and return true if succeeded | impl<'a, T: Read> Decoder<'a, T>
pub fn try_read(&mut self, buf: &mut [u8]) -> io::Result<Option<usize>> {
match self.read(buf) {
Ok(n) => Ok(Some(n)),
Err(e) => match e.kind() {
io::ErrorKind::WouldBlock => Ok(None),
_ => Err(e)
}
}
... | 0 |
385e245929f8ca6f47efedd56ff77f58 | 693eace908b87d09485d48464bff0811 | 在rviz上显示虫洞1和虫洞2 | {
for(int i=0; i<points[1].size(); i++)
{
cv::line(output,
initial[i],
points[1][i],
cv::Scalar(255,255,255)
);
cv::circle(output,points[1][i],3,cv::Scalar(255,255,255),-1);
}
} | 0 |
095d17b4af2b7ed71ca187c10bf17e08 | 249b5c71358badc035e7e05e1e7acdb2 | Sequential search on an unsorted chain for desiredItem, iteratively. | public class LBList<T> implements ListInterface<T>
protected void find(T target)
{
location = front;
found = false;
targetIndex = -1;
while (location != null)
{
targetIndex++;
if (location.getInfo().equals(target))
{
found = true;
return;
}
else
... | 1 |
3230e24a43e3bb284426c9ff89a2a488 | e4d3e8506accadfa9d11a3aa72ac82a9 | 分数的指数运算,将分子分母分别进行指数运算 | def cal_exp_son(exp_son):
if "/" in exp_son:
a, b = exp_son.split("/")
return str(float(a)/float(b))
elif "*" in exp_son:
a, b = exp_son.split("*")
return str(float(a)*float(b)) | 0 |
8fe97c1c18247bd265569789c7944515 | 3d9b2db205c276939f7849c406e9a825 | 将敌人数据存入字典 | bool PlayerSaveJob::SaveEnemyInfo(Player* player)
{
DBRecorder recorder;
Json::FastWriter writer;
Json::Value json_enemy;
std::string enemy_txt;
char sqlTxt[MAX_SQLTXT_LEN] = {0};
ENEMY_INFO& enemy_info = player->GetEnemyInfo();
write_ENEMY_INFO(enemy_info, json_enemy);
enemy_txt = write... | 0 |
91230017b961734b1db5f7bedffda3a4 | f6017645cd534b90438c3a66f976b22c | Get the value of a method from a constants interface, returning null if the method is unknown. | namespace RepoZ.Api.Win.PInvoke
public class Combridge : IDisposable
public T InvokeMethod<T>(string methodName)
=> GetValueViaReflection<T>(methodName, BindingFlags.InvokeMethod); | 0 |
1b8a525de21397c4dfe98a16af93f8a4 | 6f114bb24656201271354c4f57d15b67 | コンボボックスのための得意先Mのコードと名称を全て取得します | {
try
{
List<ComboHaken> src = new List<ComboHaken>();
tempObj.Items.Clear();
tempObj.DisplayMember = "DisplayName";
tempObj.ValueMember = "code";
string sc = sqlControl.getCon... | 1 |
de3ce1ba2cf0aad9650db512bfbbafbc | d1df79d13f2bdf4c4023a52b2fafef20 | Add Button Text | $return = $this->atts['button_text'];
if ( empty( $return ) ) {
return $this->get_option( 'button_text' );
}
return $return;
} | 0 |
314534dc729dc78d88139e76eae9d8ed | 2c8102b9ceef03db4633963e872a1af8 | translate this point by the parameter vector | {
return Point3(x + b.x, y + b.y, z + b.z);
} | 1 |
1fd043325f5c647170b77f4025fe8966 | 1eadb1ce17d64ef30139007238522da3 | Reads and integer value from the console | abstract public class AdvancedCommandGroup
extends CommandGroup
public int readInt(String question)
{
return iostream.readInt(question);
} | 1 |
b0106d3c1882bdbf9b524602f7914138 | 6411f8c14dba12691057be8b7d7b9619 | Generator function to yield "nearby" configurations to cfg.
Each neighbor generator in neighbor_fns will be called individually,
and a new configuration yielded that replaces that element of cfg
with each possible neighbor.
If bfs_neighbors is True, then do this in BFS order
(first change the first parameter by one ste... | contig, neighbors_index=None, graph=None, max_neighbors=100
):
contigs = np.array(graph.vs['name'])
neighbors_index = list(neighbors_index[::-1])
i = 0
while neighbors_index:
neighbor_index = neighbors_index.pop()
neighbor = contigs[neighbor_index]
if i < max_neighbors:
... | 0 |
dcbb36482c9a63d3686fafbadbc7c1d3 | c8fa21b36a5fd9bcfb85fdaf16c467ec | Destructor, takes care of releasing the dynamically allocated types | AtomTypes::~AtomTypes()
{
for(int i=0;i<no_types;i++)
delete atom_names[i];
if(no_types)
{
delete [] atom_names;
delete [] mass;
}
} | 1 |
cc6cc2d3211484210bb95876bfb07a12 | dd80d13ee25eff26cdf89909018081ed | Generate the handlers ptb needs to call the function this is attached to | def CreateQzManualQAPIHandlerStubs(functionElement, c_file):
c_file.write('\nSerStatus_t Handle_' + functionElement.get('name') + '(uint8_t *qsBuffer, uint16_t qsLength, PackedBuffer_t *qsOutputBuffer, uint8_t *uId)\n')
c_file.write('{\n')
c_file.write(' return(Mnl_Handle_' + functionElement.get('name') ... | 1 |
17934623d92902a19ea3bc1b92c3c0ab | 222ab872c856edf1c6ddc3bb56d13cec | 根据drawImg树结构进行绘图 | class RedBlackTree:
def draw_img(self, img_name='Red_Black_Tree.png'):
if self.tree is None:
return
tree = pgv.AGraph(directed=True, strict=True)
queue = deque([self.tree])
num = 0
while queue:
e = queue.popleft()
if e != self.black_leaf:
... | 1 |
0775cf3b8695ca8265621557977b7408 | 2f992383e0cc63836b8b565da6112965 | <include file="doc\Rectangle.uex" path="docs/doc[@for=" Rectangle.Offset1"]/*">
<devdoc>
Adjusts the location of this rectangle by the specified amount.
</devdoc> | namespace Excalibur.Controls
[Serializable, StructLayout(LayoutKind.Sequential), TypeConverter(typeof(CircleFConvertor))]
public sealed class CircleF : ICloneable
public void Offset(System.Drawing.PointF pos)
{
Offset(pos.X, pos.Y);
} | 0 |
ec9af84abb05f7140dd75bf9e5325285 | e0798c2e6ee4409e08c4ff90d90b8ccd | Gets the transform of this BTAssemblyTransformDefinitionParams. # noqa: E501 | class BTAssemblyTransformDefinitionParams(object):
def transform(self):
return self._transform | 1 |
67586676e41d8573159f2a241cc3d57f | 96b6cd7f09546189fcacfe79dc6e19ec | Adds a new query to the unhandled query list | struct MSL_CdsQuery* UGL_QueriesAdd(struct MSL_CdsQuery *cdsQuery)
{
struct MSL_CdsQuery* retVal = NULL;
if (cdsQuery->UserObject == NULL)
{
sem_wait(&UGL_QueryLock);
if (UGL_Queue_Head == NULL)
{
UGL_Queue_Head = UGL_Queue_Tail = cdsQuery;
}
else
{
retVal = UGL_Queue_Tail;
UGL_Queue_Tail = UGL_... | 1 |
9427d1e1e44cfddc3b684ab31a5ce1ce | 2f68a9f503f24bc3e2a658ba680de3ee | Deletes each character in s1 that matches any character in string s2 | int main()
{
char s1[256], s2[256];
char *buf;
int i, j;
cout << "Enter 1: ";
gets_s(s1);
cout << "Enter 2: ";
gets_s(s2);
buf = strstr(s1, s2);
if (buf)
{
for (i = 0; i < strlen(s2); i++)
for (j = 0; j < strlen(s1); j++)
buf[j] = buf[j + 1];
}
cout << s1;
system ("pause");
return 0;
} | 0 |
daf919d26385507287aaa0018a5d8939 | ba71e0eb14dc83ea5ccb24aefca6e7f4 | 如果在马上则下马 | class DemoStrategy(bt.Strategy):
def next(self):
if self.order:
self.log("存在未决订单")
return
self.order = self.buy(size=100)
self.log("下买单") | 0 |
99db652c9f70b6ddc1fa0fc390abd40d | 4ec67a61f1c8bb39e53b132f1d98dfbc | <p>Puts request authorizer with specified action id to list of request authorizers.</p> | if(getActionScopeID(renderParameters) == null) {
renderParameters.put(PortletRequest.ACTION_SCOPE_ID, new String[] { scopeID});
}
} | 0 |
711d3afce3087e6c880fd3aa4ac525e6 | 6f1ce588312257e1dd6d8020eeeeddfd | Active ou désactive le régulateur de distance | class Psu:
def setRemoteControl(self, remote):
params = self.getParameters()
if params is None:
return False
self.remote = remote
state = 0x02 if remote else 0x00
state = state | (0x01 if params.outputState else 0x00)
return self.send(self.COMMAND_CONTROLSTATE... | 0 |
0eda7049b8415ac926ce9d120fd37bef | dae46e22f7575c291762696650709619 | Performs cashout from consumer wallet to the bank account identified by the given id | pthread_mutex_lock(&bank_account_mut);
if (!isAccountExist(accountID)) {
sleep(1);
pthread_mutex_lock(&log_write_mut);
logfile << "Error " << AtmID << ": Your transaction failed - account id " << accountID
<< " does not exist" << endl;
pthread_mutex_unlock(&log_write... | 0 |
dfefd41544664b5b50a7d069a6cef5d8 | e659f0bd61dc96c38dcdfaf4831a880c | В зависимости от выбранного item в ComboBox, устанавливаем необходимый цвет кисти. | {
if (attributes == null) return;
var selectedColor = ((ComboBox)sender).SelectedValue;
attributes.Color = (Windows.UI.Color)selectedColor;
inkCanvas.InkPresenter.UpdateDefaultDrawingAttributes(attributes);
inkCanvas.InkPresenter.UpdateDefaultDrawingAt... | 1 |
c3361b1664408ab1cc999177c72dd57c | b20d9fe2d12adefb11ca6fad895cf9f4 | Increase all clients' ages | void rgroup_IncrAges( void) {
Int j;
GrpIndex rg;
SppIndex sp;
IndivType *ndv;
ForEachGroup(rg) {
if (RGroup[rg]->max_age == 1) continue;
ForEachEstSpp( sp, rg, j) {
ForEachIndiv( ndv, Species[sp]) {
ndv->age++;
if ( ndv->age > Species[ndv->myspecies]->max_age ) {
LogEr... | 1 |
80752448147af47c2779014739fe9e41 | b12066babcbd416f6f475727ec295172 | 老师查看学生出勤记录 | public ApiResponse<List<Attendance>> getTeacherSignInHistory(String classId) {
Map<String, String> paramMap = new HashMap<>();
paramMap.put("classId", classId);
Type type = new TypeToken<ApiResponse<List<Attendance>>>() {
}.getType();
try {
return httpEngine.postH... | 1 |
b181d07ecffa54735fbc6e97d33089fb | 9e61b05d4742d7afbc5c6ae54a043a5d | Takes a path to a youtube#liveChatMessage ressource_file (as
produced when a LiveChat is saved to json), prepares the content of the
messages, labels them using default_label and saves the resulting two
column csv file to output_file. | def prepare_for_labeling(ressource_file, output_file, default_label=0):
with open(ressource_file, 'r', encoding='utf8') as f:
ressources = json.load(f)
messages = [
ress['snippet']['textMessageDetails']['messageText']
for ress in ressources
]
unlabeled = pd.Series(prepare(message... | 1 |
7dc6ed3ab7e479e6f080f974666a02bf | 8b130c5237d15476539da5ea1d98c02f | Setter for the size property | class Follow extends \Twitter\Widgets\Base
public function setSize($size)
{
if ($size && isset(static::$ALLOWED_SIZES[$size])) {
$this->size = $size;
}
return $this;
} | 1 |
e99bb5a01ae401b3891db8530611e72f | ed8d3a0933d8b3d8afb0b4073d1eb225 | ShiftExpr ::= AddExpr ( ( << | >>) AddExpr )* | def p_shift_expression(p):
if len(p) == 2:
p[0] = p[1]
else:
temp = ast_node(value=p[2], lineno=p[1].lineno)
p[0] = ast_node('Shift', value = '', type = '', children =[p[1],p[3],temp], lineno = p[1].lineno) | 1 |
1fdf9fba7db69b36dba6135e20f0eb6c | 65c55083a0fa16edf2a558240abb0c36 | Set up the Gearbest sensor. | class GyroscopeModule(PyMetaWearLoggingModule):
def start(self):
libmetawear.mbl_mw_gyro_bmi160_start(self.board) | 0 |
e2e4ae759685a6228fb5a4dbcf6f0458 | d339296f29f4f515ba190c92001df162 | Method wipes old literal levels. | void clearLiterals(); | 1 |
50ecfc541cf779fcbdbf2d1202311872 | 333b2758e52afecff77dfc851dc289e5 | Function checks for errors and prints them if any | void _checkErrors(int addr, std::vector<const char*> errors)
{
for (auto err : errors)
{
if (err != nullptr)
ERROR("Servo: %d: in troubles: %s \n", addr, err);
}
} | 1 |
0b2603095713aea343ce93940b582095 | 42997b109ece53d17d97f7f0b7bf8d4f | POST /invoice-line-items : Create a new invoiceLineItem. | @hospital_line_item = HospitalLineItem.new(hospital_line_item_params)
if @hospital_line_item.save
render json: @hospital_line_item, status: :created, location: @hospital_line_item
else
render json: @hospital_line_item.errors, status: :unprocessable_entity
end
end | 0 |
88ce593255ab4ad26fe5ca017b9effc5 | 2faf1fe654a27a297f823af667bd5b8e | Update RUs per second of an Azure Cosmos DB Gremlin graph. | public Mono<ThroughputSettingsGetResultsInner> updateGremlinGraphThroughputAsync(
String resourceGroupName,
String accountName,
String databaseName,
String graphName,
ThroughputSettingsUpdateParameters updateThroughputParameters) {
return beginUpdateGremlinGraphThroug... | 1 |
45692ebdabc72f020751c7c36cbcdd13 | b75e3729524c67de594e94ba5b1b9822 | Get the function values. | auto fun = theFunction();
size_t np = fun->nParams();
QList<double> out;
for (size_t i = 0; i < np; ++i) {
const double parValue = fun->getParameter(i);
out.append(parValue);
}
return out;
} | 0 |
5e47dc3bf7635e62453eb0897caf7194 | cb59856b522c8359c3d99ce58cf5a35d | TestnetParams | {
var builder = new NetworkBuilder();
builder.SetConsensus(new Consensus()
{
SubsidyHalvingInterval = 840000,
MajorityEnforceBlockUpgrade = 51,
MajorityRejectBlockOutdated = 75,
MajorityWindow = 1000,
PowLimit = new Target(new uint256("00000ffffffffffffffffffffffffffffffffffffffffffffffff... | 1 |
a325177af118ec70c3a097673bf06068 | b0381e765193fcbc8f11cffb40b91811 | Removes the method parameter. | {
if (!isset($this->methods[$param])) {
return $this;
}
$instance = clone($this);
unset($instance->methods[$param]);
return $instance;
} | 1 |
a79242a099ebfe6f878634801ff4e4a5 | 977fb87d7f8a39bf3aaac4a08e8a2a78 | given an unnormalized density in the x-y upper half plane, normalize it and set the data member | public void Normalize() {
double magnitude = Magnitude();
if (magnitude > 0.0) {
double inv = 1.0 / magnitude;
x *= inv;
y *= inv;
}
} | 1 |
30e2670b5f2827c90e8815c4dd630aa2 | 9368dffe061fdf119fededebc4c17cdd | 16-bit displacements get sign extended | uint32_t H8CPU::readDisp16(uint32_t addr) const
{
uint32_t ret = readWord(addr);
if(ret & 0x8000)
ret |= 0xFFFF0000;
return ret;
} | 1 |
9a6fa843f280488201ae8ea2411a9d89 | ed725ee43fe89be19dc6e04c81c593d6 | 路由切换时,取消前一个页面未执行完的ajax请求 | beforeRouteUpdate (to,from,next) {
console.log('beforeRouteUpdate')
next()
} | 0 |
9a057cfb68bcaf057687e99214c3f42b | aba0c73e82bb92ff67c297b55e17b273 | Solves for the outputs of a circuit. This function requires that ALL inputs are
passed in or else it is likely that the circuit outputs will all be True.
ckt: the circuit object
inputs: the inputs to the circuit | class OracleRunner:
def run(self, inputs):
return solve_ckt(self.ckt, inputs) | 1 |
9a20e14de6987acca98ed021c32bf872 | 3156da08885d2f74384777eb64186422 | 批量禁用模块 | $ids = I('get.ids', []);
$modId = intval(I('get.modId', 0));
$result = ['status' => 1, 'msg' => '', 'data' => []];
if(empty($ids) || empty($modId)) {
$result['status'] = 0;
$result['msg'] = '参数错误';
if(IS_AJAX) {
$this->ajaxReturn($result, 'json');
} else {
$this->error($result['msg']);
}
... | 1 |
dab8b8249e0f08aec05f930b6372cb5a | 20347310abaec2eac8a14a08d5698dc3 | Returns how much space in height the menu entry requires | namespace MonoGameBallerburg.Controls
public class ActionToggleButton : Control
public virtual int GetHeight(MenuScreen screen)
{
return screen.ScreenManager.Font.LineSpacing;
} | 1 |
00142ff25ac0f1b46464d1a6e0b36a28 | 5304883187dbcec95a3e6977b975ada1 | Takes in a url and returns the parsed BeautifulSoup code for that url with
handling capabilities if the request 'bounces'. | try:
request_url = self.session.get(url, params=params)
if request_url.status_code == 401:
sys.exit("Username or Password is incorrect.")
elif request_url.status_code == 200:
if soup == "y":
html_soup = bs4.BeautifulSoup(req... | 1 |
0dbd21cda21ad1acd2622ace2f4abb11 | eefadb7ca150620e6589952e8129dfdf | returns a pointer to the current item in the list. | void *tw_get_curitem(void)
{
return (tw_current_item);
} | 1 |
79b51840eb82536c6f2f17f8bcabdce4 | 2286c5cace969841e3bf5f56501016b4 | 获得最小厚度 | namespace EarthView
namespace World
namespace Spatial3D
namespace Atlas
public class Iterrainlayer : EarthView.World.Spatial3D.Atlas.Iglobelayer
public virtual int GetMinLevel_NoVirtual()
{
int ret=EarthView_World_Spatial3D_Atlas_ITerrainLayer_getMinLevel_ev_int32_NoVirtual(this.NativeObject);
... | 0 |
c35f59b576b9fecfc672a805fa97c37a | 79dcf82be7f62758ee1969f172bd2663 | Validate that every gate argument that isn't a number refers to a register in the registers argument. This
validator is expected to be called after all resolutions in the tree. Also check that each index is between
zero and the maximum value for the register. | class TestXIRToStrawberryFields:
def test_gates_with_args(self):
circuit_data = [
("Sgate", [Decimal("0.1"), Decimal("0.2")], (0,)),
("Sgate", [Decimal("0.3")], (1,)),
]
irprog = create_xir_prog(data=circuit_data)
sfprog = to_program(irprog)
assert len(sfp... | 0 |
b6fc75d8b48f2635d1f7d0457befc7d5 | 7f87db565513c196bb9b9103a4aa0b5e | Paints X axis grid line at given X in display coords | {
try
{
Pen pen = new Pen(Brushes.Black, 1);
g.DrawLine(pen, new PointF(pointX - 2, pointY), new PointF(pointX - 2, pointY + interval));
g.DrawLine(pen, new PointF(pointX + 770, pointY), new PointF(pointX + 770, pointY + interval));
... | 0 |
b661a28dbb1beb9ef21cfbd017bf6d55 | caac0a1770a7635118ff36f0a348f935 | Tests equivalence of DFAs | class FiniteAutomaton:
def is_equivalent_to(self, other):
self_dfa = self.to_deterministic()
return self_dfa.is_equivalent_to(other) | 1 |
4d097874bae9cd703ad08d0ac7997944 | f35c88f93990aaa646d4e7fccf28448b | Aggiunge il valore nel dizionario se è "stringabile" e lo restituisce | namespace TimePlusPlusDengiWindowsPhone71
public partial class MainPage : PhoneApplicationPage
private string PerfokartaSieString(string klucEtt)
{
if (perfokarta.Contains(klucEtt)) { return perfokarta[klucEtt].ToString(); }
else { perfokarta.Add(klucEtt, ""); perfokarta.Save(); retu... | 0 |
c7be05661cb5d6a3e17d4321b126a7b5 | c4ae447f5b9ca764f92f5ca6616a824b | Creates a HTTP link that auto-refreshes to download the tarball. | class Updater
public function link($name)
{
return HTML::link($this->buildRemoteUrl('https://github.com/:rep/archive/:branch.zip'), $name);
} | 0 |
933552bf3540780cc177a18a87c9eb15 | 1020d4984d398f9a1ef22d786fe2cdd3 | <p>This method will return all the products of a warehouse</p> | try {
let result = await db.query(`select * from stock s LEFT JOIN warehouse w ON s.warehouse_id = w.warehouse_id RIGHT JOIN product p ON s.product_id = p.product_id RIGHT JOIN product_price pp ON s.product_id = pp.product_id RIGHT JOIN product_detail pd ON s.product_id = pd.product_id WHERE s.produ... | 1 |
834d816d784f5c2e80d9972d3fad6761 | e7cb458a2d65c4e9c5856686a82a241f | Get rotation matrix from specific point of view and scale. | namespace OpenCV.Net
public static partial class CV
public static Mat GetRotationMatrix2D(Point2f center, double angle, double scale, Mat mapMatrix)
{
NativeMethods.cv2DRotationMatrix(center, angle, scale, mapMatrix);
return mapMatrix;
} | 1 |
c56673b9796b3579e94f9645cfa836f2 | 865baba7cb939b98418002cdabc9cca1 | don't need to do anything here; | namespace ImgAlgos
void
ImgPeakFinderAB::endRun(Event& evt, Env& env)
{
} | 1 |
7b3e8ef3a66c43dcab7fb0271be6281a | 3e125c4b8f3b23eb6ccd0a05f36442f5 | Returns the number of prinicipal components that have to be used
in order for the model to capture the given fraction
of total variance | varianceLimits = [0.25,0.4, 0.5, 0.6,0.7, 0.75, 0.8, 0.9, 0.95, 0.98, 0.99, 1]
varianceLimitsDict = dict.fromkeys(varianceLimits)
for i in range(TotalComponents):
if pca.explained_variance_ratio_.cumsum()[i] > varianceLimits[0]:
varianceLimitsDict[varianceLimits[0]] = i
varia... | 1 |
d2e8ab6650c31fff83c7301bd01dc56d | b8cf48d3cb1c568f5586b3863cdb4336 | convert 5-strokes format to image | $data = '*' . $this->data . '*';
$length = strlen($data);
$width = $length * 16;
$height = 33;
$padding = array(0, 0, 18, 0);
$image = imagecreate(($padding[1] + $padding[3]) + $width, ($padding[0] + $padding[2]) + $height);
$black = imagecolorallocate($image, 0, 0, 0);
$white = imagecolorallocate($ima... | 1 |
0815ba1cedaa380f496ac54e64c645a6 | 84647797909700f66984544beaa6c6b0 | The service which is used to store a trajectory to disk | @Configuration
public class CommonConfiguration
@Bean
public FileStoreService getFileStoreService() {
return new LocalFileStoreService();
} | 1 |
4823b8077de7db1bde3b1a1c3e4b03aa | 92b8c7598f5a80a5c10141e8e938a555 | Delete a journal_type. | if not is_admin():
abort(403)
if request.method == 'POST':
db.call_delete_document_type(int(request.get_json()['params']['id']))
print(request.get_json())
return json.dumps({'success':True}), 200, {'ContentType':'application/json'} | 1 |
b9c533508aeb3f7f8c4ffeb13f99ac07 | e7f55c33fe399d8bdf55aa0b2308bd72 | 设置[CT_BANK_ITEM]的属性所属用户(题目原作者)ID | class dbs_custom_visitordata extends dbs_basedatacell
public function set_itemid1($value) {
$value = strval ( $value );
$this->setdata ( self::DBKey_itemid1, $value );
} | 0 |
072aeec1c1c75b7a3bca0c96b6dbac20 | bf5278f2832ceefbdb5922634ace4bf9 | 授業のindexから次の授業を探す | class CourseRepository extends BasePdoRepository
public function getNextLesson($userId, $courseId) {
$query = 'SELECT l.course_id as course_id, rank, l.lesson_id as lesson_id, name, title, section_id, content_object_id, description, section_rank, image_name
FROM lessons as l
left outer join progress as p on l.lesso... | 1 |
49ac47493658cb4a5bc7a4ab836daaee | 1506b2b29d2c1037e720a87edb57d111 | 抓取订阅页面中离线部分的数据 | def process(url, offline_path):
run_log('get data from page...')
page_data = get_page_data_from_url(url)
offline_html_path = offline_path + '/' + 'page' + '.html'
with open(offline_html_path, 'wb') as f:
f.write(page_data)
run_log('write page to path: %s' % offline_html_path)
pattern = r... | 1 |
7190f125563e0c0ce06476619617d632 | 5742a719b0d7dfcfd01f61c314d35cfd | Test string hashes to expected index. | class TestList(unittest.TestCase):
def test_01g(self):
ht = HashTable(7)
ht.insert("cat", 5)
self.assertEqual(ht.get_index("cat"), 3) | 1 |
d7f5c67189f6ef72431cc07de1c1fb62 | 8a082009e7dc5ee4bb4aa1aec4f3b51e | 逆インデント | class DotForm():
## インスタンスの初期化時の処理。
#
# @param fp 出力先ファイル
# @param stderr_ エラーメッセージ出力先を変更する際に指定する
#
def indent(self):
self.__indent += 1 | 0 |
00d7b2a3fdcf6f706cf802fd525c692e | c8ddcd51d6660af987ed3f243b4e459d | unpacks the elements of an encryption op into individual components so they may be used to decrypt | enc1 = BASE64_KEY.indexOf(aaaa[0])
enc2 = BASE64_KEY.indexOf(aaaa[1])
enc3 = BASE64_KEY.indexOf(aaaa[2])
enc4 = BASE64_KEY.indexOf(aaaa[3])
e3 = ((enc3 & 3) << 6) | enc4
e2 = ((enc2 & 15) << 4) | (enc3 >> 2)
e1 = (enc1 << 2) | (enc2 >> 4)
return [e1, e2, e3]
} | 1 |
cfac64f554586c324d3dd442d3a6a0d8 | 7d0acba2c1ece1fa5b847aa35d6566bc | Tests parameters within a sequence. | params = {"a": 1, "sequences": {"b": [2, 3], "c": [2, 3], "d": [2, 3]}}
expected_result = [{"a": 1, "b": 2, "c": 2, "d": 2},
{"a": 1, "b": 2, "c": 2, "d": 3},
{"a": 1, "b": 2, "c": 3, "d": 2},
{"a": 1, "b": 2, "c": 3, "d": ... | 1 |
e50eb87ff56171acc4e0638592c65056 | 15a80b65148bee7f7fff45403501586f | Create all the roles from the configuration. All the permissions referenced by these roles
must already be created. | {
$roleManager = $this->container->get('claroline.manager.role_manager');
foreach ($this->groups as $name => $users) {
$role = $roleManager->createCustomRole('ROLE_' . $name, 'ROLE_' . $name);
$group = new Group();
$group->setName($name);
$roleManager-... | 1 |
ae9eace57c2a17504529c953ba3be626 | 7df8ea4a4bd1c958194ea84c52d3789e | Moves the AppIntro to the previous slide | export class IntroSliderComponent
goToApp() {
this.goToNext.emit(true);
} | 0 |
a488650dd97f29a050acfeb4694dc532 | d3329e3bd77b415e4c261e1466314957 | Determines if the current game version is greater than the given version. | IVersionType versionType)
{
if (versionType == null)
{
return true;
}
return versionType.Comparator.Compare(currentVersion, newVersion) <= 0;
} | 0 |
d1eaee4e5566006ee1fcd0bf839363e3 | 8d13ec82ae59750b87c522a2c8f35115 | LD DE, n16 | public class Z80 implements Z80debug
private final void ld_DE_nn() {
cycle -= 10;
E = peekb(PC++);
D = peekb(PC++);
} | 1 |
d1c34a5512e14ff5260724415e4967f3 | 0883e78f40d8d0d854e4a260024fdcf2 | Move Z position in absolute terms | if self.debug:
raise ControllerDebugException("Cannot use move absolute \
when stage is in debug mode. Only specifically implemented methods \
can be used")
else:
self._write("1PA+{}".format(x))
vel = self.read_velocity()
while abs(... | 1 |
c553d44260c5360f7b70cb626797779c | 708658b777b9073169bfebaeb05f7eda | Pure implementation of the heap sort algorithm in Python | def heap_sort(array):
heap = build_heap(array)
for i in reversed(range(heap.size)):
swap(heap, 0, i)
heap.size -= 1
heapify(heap, 0)
return array | 1 |
02b56f15f88f8aa66038d09d1227ce28 | 2dd32541096d384f10656a42752733a4 | 设置视图模式为页面视图 | class AppServiceProvider extends ServiceProvider
public function boot()
{
\Illuminate\Pagination\LengthAwarePaginator::defaultView('layout.page');
} | 1 |
435b3fc56f0c48de7d92e7ad3237b48a | 321691c736104765e0ef56e37fa500e9 | Sends the next keyboard HID report to the host, via the keyboard data endpoint. | void usbcrSetReport(void)
{
if (usbfwData.ep0Status == EP_IDLE) {
if ((HI_UINT16(usbSetupHeader.value) == HID_REP_TYPE_OUTPUT) &&
(usbSetupHeader.index == KEYBOARD_INDEX) &&
(usbSetupHeader.length == sizeof(KEYBOARD_OUT_REPORT))) {
usbfwData.ep0Status = EP_RX;
... | 0 |
d4aae2d7e28700324d61530744d0c51b | 6f814b752b4541de8e1422fb7687656a | The function get the flights from the files by given plane id. | vector<MyFlight *> planeFlights;
if (!fexists("FlightOfPlanes.txt")) {
return planeFlights;
}
ifstream planeFlightsFile;
planeFlightsFile.open("FlightOfPlanes.txt");
string buffer = "";
string temp = "";
string prevString = "";
while (!planeFlightsFile.eof()) {
getlin... | 1 |
a11d2fdf96199990d72db908bc0c9ac0 | 59ae64754e8c947e5388f4149e900697 | 验证学科类型 | getSubjectTypes({state}, $url) {
Axios.get($url).then(res => {
if(res.data.code == 20001) {
if(res.data.data) {
let subjectTypes = state.subjectTypes,
data = res.data.data;
subjectTypes.length = 0;
... | 0 |
070623a3223c5badd1113396600ea159 | dbb152b1e6a12d11bc4d2e95d5b7edd9 | Returns the value of the '<em><b>MODELREFERENCE</b></em>' containment reference.
<!-- begin-user-doc -->
<p>
If the meaning of the '<em>MODELREFERENCE</em>' containment reference isn't clear,
there really should be more of a description here...
</p>
<!-- end-user-doc -->
extendedMetaData="kind='element' name='MODELREFE... | @NotNull
GenericAttributeValue<String> getModel(); | 0 |
fb801e5d7150e9d49773b677832337a6 | f6bd3022feee35b231d951a7a7287180 | returns: int<municipality_id> of closest municipality | def closest(lon,lat):
c=0
d=1000000000000000000000000000000000000000000000
for n in NYCStreetsC.nodes():
d1=geodist(IntPos[n][0],IntPos[n][1],lon,lat)
if d1<d:
c=n
d=d1
return c | 0 |
9fe6a1aeaacd1325701aa0ed1b5be261 | d15e202cb4a732ab28c34cd79e4d1ad8 | A unique, case-sensitive token you provide to ensure idempotency of
your modification request.
your modification request. | class UpdateOrderCustomAttributeDefinitionRequestBuilder
public function idempotencyKey(?string $value): self
{
$this->instance->setIdempotencyKey($value);
return $this;
} | 1 |
00ecc5db9f76dd8b3b221593531f77c9 | 7c099113929564acead230c220f50439 | Upgrade xuanxuan. | {
for(auto ¯o : SFx)
{
macro.UpgradeLegacyMacro();
}
for(auto ¯o : Zxx)
{
macro.UpgradeLegacyMacro();
}
} | 0 |
17fcfe99cd97ba73379c666778393770 | 5f4d0b5d633281fae009a87df76a09db | HashData returns the sha256 sum of src. | func Sha1str(src string) string {
has = sha1.New()
has.Write([]byte(src))
return hex.EncodeToString(has.Sum(nil))
} | 0 |
955539acbcd45e89116210635486f5a5 | e0446f8ba0bf1e238575a86f465b53af | 医院管理员列表 | {
$list = get_current_login_user_org_info()->admins()
->with('department', 'roles', 'serviceProvider')
->type(1)
->when($request->search,function ($query) use ($request) {
$query->where('name', 'like', "%$request->search%");
})
->or... | 1 |
5bdb7ac98110683a1166a7684ddbb3fa | cc752584ac454c21565963a31b2b24a1 | Concatenate two sequences (Concat in LINQ) | namespace Atom.Collections
public static class EnumerableExtensions
public static IEnumerable<TDestination> Concat<TDestination, TFirst, TSecond>(
this IEnumerable<TFirst> first,
IEnumerable<TSecond> second )
{
Contract.Requires<ArgumentNullException>( first != null );
... | 1 |
07f0bc29467895b6a66b5bc35856c6b9 | 24da626acc264ad69a3517ed328954ec | 根据用户的一个投资需求的id,获得该投资需求下,A+Quant所做股票市场投资的收益表现 | public InvestSummary getInvestSummary(long user_id); | 0 |
bea4274a7f92808ff0afcb2ac806b036 | aa5dd26a080eaf3b2110c3234f752d7d | Lee el fichero de texto pasado por parametro y crea sublistas con cada una de las lineas | def readFileIN(fileIN):
try:
file = open(fileIN, 'r')
count = 0
for line in file.readlines():
if count > 0 :
line = line.rstrip('\n')
tmpSplit = line.split('#')
tmpSplit[2] = tmpSplit[2].split(',')
dataIN.append(tmpS... | 1 |
cd139b996712dc7be3d6a0eef7166cac | aeffd80632e3f91ba36eed61b3dc8124 | Removes task from collection and from the database | namespace Banes.ToDo.Repositories
public class ToDoTaskRepository : IToDoTaskRepository
public bool Delete(int taskId) => GetToDoTaskCollection().Delete(new BsonValue(taskId)); | 1 |
ba1c536c81fd00629da094048c722f62 | a1e68861f43a049b52cf0b6f17f1dc81 | Support for tokens serialized with version 5.1 or lower of symfony/security-core. | {
foreach ($container->getDefinitions() as $definition) {
if ($definition->getClass() === SymfonyDefaultAuthenticationSuccessHandler::class) {
$definition->setClass(SyliusDefaultAuthenticationSuccessHandler::class);
}
}
} | 0 |
3c98efe72c8c488547eccf692acf1faa | 48b1ce7a310bfc7e2d06d23acb751ec1 | Gets the UI location given the raw location from the runtime. We make
an effort to avoid async/await in the happy path here, since this function
can get very hot in some scenarios. | {
using var operationContext = CreateOperationContext(callContext);
try
{
return await _localContentTracker.GetLocationsAsync(operationContext, request).ThrowIfFailureAsync();
}
catch (Exception exception)
{
Tracer.Error(operationContext, excep... | 0 |
60698eb64c2810c554c3f53b56248dcf | 97dccb6a6d9cb081172cdc828617b250 | This assumes a centered 90% confidence interval, i.e. the left endpoint
marks 0.05% on the CDF, the right 0.95%. | public class Range<T>
public static Range<Double> calcCI95(Double percentageValue, Integer sampleSize) {
GWT.log("percentageValue: " + percentageValue.toString(), null);
GWT.log("sampleSize: " + sampleSize, null);
if (sampleSize==0) {
return null;
}
if ( (sampleSize <... | 0 |
0daf036a8bda8908cf8922103cbcd6c9 | baf9384e86e5f9dd956b01261fbf4467 | Creates an instance of empty snapshotable aggregate root. | namespace Anycmd.Snapshots.Providers
public sealed class SuppressedSnapshotProvider : SnapshotProvider
public override void CreateOrUpdateSnapshot(ISourcedAggregateRoot aggregateRoot) { } | 0 |
0e740622321d1a2ef20d28acfcd9077e | 4a230dbf8729fdfa2ebd5dfbb2710813 | 前台保活处理 | class BackGuard extends Command
public function handle()
{
if (self::getProsize("notgid=log_") < 3) {
$cmd = 'nohup /usr/local/php/bin/php /data/www/php-script/artisan Back:UpData --orgdb=\'127.0.0.1,10010,bas,root,3i$LxH8%Ec\' --trgdb=\'10.20.20.66,27017,bas,admin,tyiSq6-ml\' --notgid=\'log_\' ... | 0 |
c56a66d4db2df8466cbde948275309e5 | 52fdd5f5e27189f0a4956ebcd760169e | Returns a number that reflects the material advantage of the passed color | int PositionStruct::Material ( void ) const {
return SIDE_VALUE ( player, vlRed - vlBlk ) + Evl.vlAdvanced;
} | 1 |
468509670efbe04be8a66404a2e0bf98 | ed9999d4221f643318663118f49f959d | Get raw distribution data and corrispective I_linspace
Returns | if self.paths == 0 or self._bins is None:
raise ValueError('no distribution data available')
counts, bins = self._counts, self._bins
if (counts.dtype == object and counts.size > 1):
raise IndexError(
'histograms and distributions must be invoked '
... | 1 |
020e388a32d605b1f986f2b08acce2a3 | 031940450a5b84ddfd35fcd6729d262d | Examine the preditability of the document-concept vector via classical ML methods
such as logistic regression, random forest among other non-NN-based algorithms. | classifier = Classifier()
classifier.training_sets = [evaluation_recording]
datasource = DataSource(classifier)
data, target = await datasource.generate_fixed_evaluation_data(limit=600)
cv = ShuffleSplit(numpy.array(data).shape[0], n_iter=50, test_size=0.8, random_state=17)
ylim = [0.45, 0.75]
... | 1 |
23ec6f3e92061eb1a6aa4fed65c98874 | 4613a554475f5f0a404a91c505912620 | Returns a new object of class '<em>constrained Array Type Ref</em>'.
<!-- begin-user-doc -->
<!-- end-user-doc --> | UnconstrainedArrayDefinition createUnconstrainedArrayDefinition(); | 0 |
060d06a94118d2f460afbb2dc9fab0af | ae3e9fba0e92f2de14167b15a4693a92 | Keyword search functionality for all frameworks | def search_search_queries(request, *args, **kwargs):
return search_view(request,
model_vars = search_queries_vars,
cur_app = CUR_APP,
sfields = None, ) | 0 |
fe5dad6b0c92363ef9bd11be73746b3b | 6ed938b02cba63fb87f004b8d7f47335 | Resume the experiment if it is paused.
Throws an error if called when the experiment is not paused. | if (!this._isPaused) {
return this;
}
this._isPaused = false;
this._processQueue();
return this;
} | 0 |
b4909600625a326ceabe7c4892f4a3e3 | 1330a454422ee5aa1e4cf7a5444d6892 | Returns the id for the user with the given name. null if not found | String getUserIdByName(String userName) throws CommonServiceException; | 0 |
aa434d5739485ab11ea79048c3261d31 | 73958a73bf6c75f1771505ded1c18227 | Find a file by walking up parent directories | def findParentFile(filename, base_path=None):
if base_path==None:
base_path = os.getcwd()
if os.path.exists(os.path.join(base_path, filename)):
return base_path
if os.path.samefile(base_path, os.path.dirname(base_path)):
return None
else:
return findParentFile(filename, o... | 1 |
69dff2761042353924d93d9f40287c2c | 9fed198fb56454fb506b3e72eb0f56d7 | Get the service used for testing | class NodeUpdateServiceTest extends TestCase
private function getService(): NodeUpdateService
{
return new NodeUpdateService(
$this->connection, $this->encrypter, $this->configurationRepository, $this->repository
);
} | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.