query_id string | corpus_id string | query string | code string | label int64 |
|---|---|---|---|---|
cd2e945f09e29aef14927ee6f63fcf0e | dc91533e62c66a33e9b20a6f8443dcb9 | Set the default settings for constraints | public class StressTest extends AbstractTest<Project>
@Test
@Ignore
public void testConstraintDefaults() {
reasoningTest("ConstraintDefault.1.ivml", 0);
reasoningTest("ConstraintDefault.2.ivml", 1);
} | 0 |
6f86ab3edffe6c8ceabe0f72ad13696d | 5ee417e651b05f3b166b5267b5889e34 | 增加技能经验 | void CChar :: Skill_Experience( SKILL_TYPE skill, int difficulty )
{
if ( skill > SKILL_QTY )
return;
if ( difficulty/2 > m_Skill[skill] )
return;
m_Skill[skill] ++;
if ( m_pClient != NULL )
{
m_pClient->addSkillWindow( skill );
}
} | 1 |
d6ce17c9afa0a2224273d80de87c56cf | b4f902cb561e72a1098d88a12e529c33 | Tests that you can get items for an invoice | namespace TestInventory
TEST_METHOD(TestInvoiceItemSearchByInvoiceItemID)
{
Logger::WriteMessage("TestInvoiceItemSearchByInvoiceItemID");
string returned = invoiceItem->search("invoice_item_id", "102");
Logger::WriteMessage(returned.c_str());
Assert::AreEqual("102|1002|25\n", returned.c_str());
} | 1 |
1ed05e7abe79ab90329e6475c957f8ff | 44d8273cbce1eefd094210440fdbf272 | decode a 4 char base64 encoded byte triple | namespace util
void Base64::decodeblock( const unsigned char in[4], unsigned char out[3] )
{
out[ 0 ] = ( unsigned char ) ( in[0] << 2 | in[1] >> 4 );
out[ 1 ] = ( unsigned char ) ( in[1] << 4 | in[2] >> 2 );
out[ 2 ] = ( unsigned char ) ( ( ( in[2] << 6 ) & 0xc0 ) | in[3] );
} | 1 |
485cf30e1f7f226abb3e0e43d9f7c797 | 31e6041e665d258ede4d50a0b9075916 | Gets the relative weight for link capacity when the load balancing mode is set to
LB_METHOD_QOS. | class ModuleConnection(object):
def get_qos(self):
return int(self._send_command(OPCODES['QOS_GET'])[0]) | 1 |
1df3e4788e8662f1eba2a1100ad21296 | c628ca917e87bd970dd07db4f30c7618 | 生成相应的form复选框 | $html = '';
$html .= '<div class="layui-form-item" pane>';
$html .= '<label class="layui-form-label">' . $title . '</label>';
$html .= '<div class="layui-input-block">';
if (is_array($checkbox) && $checkbox) {
foreach ($checkbox as $v) {
$html .= '<inp... | 1 |
6243c62b80cb7231f14fdbd45373300a | 04cd3ab86d4b7222defcf7f816ec2864 | 取得小时对应的栏位名称 | namespace HISPlus
public partial class NurseScheduleDayFrm : FormDo
private string getScheduleColumnName(int dayOfWeek, string scheduleName)
{
return STR_ALL_DAY + dayOfWeek.ToString();
} | 0 |
4fd0f5dd5fb3337ca879ca3cd431ff22 | 535c798ad3e51947b712a82510e23f0b | 5. Получить список всех Учителей, преподающих в указанном классе | class School:
def get_teachers(self, class_room):
return [teacher.get_short_name for teacher in self._teachers if class_room in teacher.get_classes] | 1 |
096d3d355dfa2d43c8e92f9be9384948 | a6f72cf05f679644fc2e2def6b48a32f | 通过set集合判断子集有多少个“组件”。ps.组件是连续的 | boolean flag = false;
for (int i = 0; i < num; i++)
if (s.contains(set[i]) == false) {
remove(set[i]);
flag = true;
}
return flag;
} | 0 |
ac15c0ba8e21d42c7a7504670abd148f | 1c340892eb5e53147b35d147691df275 | Regression test for https://github.com/bazelbuild/bazel/issues/9321 | val indirectLib = project(
manifest,
xml(
"lint.xml",
"""
<lint>
<issue id="ManifestOrder">
<ignore regexp="AndroidManifest.xml" />
</issue>
</lint>
... | 0 |
fc0c9c1988964a15ed92cac513cfe4f7 | ded32bf136a3afc573820b0956596592 | remove part before @ | public class UDPReceiver implements Runnable{
public String extractNickname(String nick){
return nick.substring(0,nick.indexOf('@'));
} | 0 |
f0e1c2c27f23347396a81bd3e8197ed1 | df9675aebbc90cb04575c0a129e157db | The method that we expect all plugins to implement. This is the
method that our framework will call | class PluginAbstract extends Core\Model\ModelAbstract implements PluginInterface
public function hook() {} | 1 |
85588d1127e5d28a4563e529bf50660d | c671c259ae6549ee0e2cffc12b46eadc | 只接受UserDTO类型的消息,并且设置为默认处理器 | @Configuration
@EnableWebMvc
public class ConsumerWebConfig extends WebMvcConfigurerAdapter
@Override
public void extendMessageConverters(List<HttpMessageConverter<?>> converters) {
converters.add(protostuffHttpMessageConverter);
} | 0 |
62e2760fa6af80dfad1e17d0ce0f2332 | 3065e67deb6dad409cdbc21475da2e55 | 构造神经元,目前只执行初始化超参数的步骤 | self.code_params = {
"name": name,
"n": n,
"neurontype": neurontype,
"para": "{}_params".format(name),
"ini": "{}_ini_params".format(name)} | 1 |
6385fe12b5fbf121bf46f358bc50a938 | 4ee2ef6d5b72cb08e63a9636fe1a1d71 | Executes the given method inside an open StreamReader. The caller is not responsible for opening, closing, or
cleaning up after the StreamReader. | {
Contract.Requires<ArgumentNullException>(method != null);
logger.ExecuteInContext<object>(() =>
{
method();
return null;
});
} | 0 |
90ff9fc0fdb5049190169d7878c4fdd9 | 7a26753e780f19401f0e10635c8cb671 | 可能な区間の組み合わせの中から最適な区間を求める | def optimalIntervalSelect(intervals):
pass | 1 |
668f699f5c8a5af2632b2274ef55e4a7 | f4a5fd8367142d0d7480dd139faed626 | Gets a list of all scene items in a scene.
Scenes only | export class Root extends ExtensibleProperty<IRoot>
public listScenes(): Scene[] {
return this.listRefs('scenes');
} | 1 |
28e58fb04574270ba53c3a848af74160 | 3ee8c59e78c22dffc2986a5dc5320cc8 | Add a vector to this vector, returns this instance. | public IVector add(IVector vector); | 0 |
f0a60c3ab47095457f72a5b394286a16 | 5f0e9d56b201c73026a94753df2b7ba7 | POST /institutes
POST /institutes.json | {
try
{
$json = json_decode(RequestUtil::GetBody());
if (!$json)
{
throw new Exception('The request body does not contain valid JSON');
}
$institution = new Institution($this->Phreezer);
$institution->Name = $this->SafeGetVal($json, 'name');
$institution->Description = $this->SafeGetVal($j... | 1 |
395c64472c1ab133a3832710f36211cc | cbed660dfd744cff9aa530e5cec9dcf9 | Setter for property fieldLength. | {
try {
parent::setFieldLength($fieldLength);
if (is_array($fieldLength) === true) {
$this->DecimalLength = $fieldLength[0];
$this->PrecisionLength = $fieldLength[1];
}
} catch (\Exception $ex) {
throw new \Bridge\Compon... | 1 |
24ad3b20f2d0fc311ff4b0886652be26 | fdb17d917dd38deccfe3ddf007891318 | Converts an improper rational fraction to a proper mixed fraction. | public class CompoundFraction
private void convertToProper() {
if (this.wholeNum > 0) {
this.numerator = (this.wholeNum * this.denominator) + this.numerator;
this.wholeNum = 0;
} else if (this.wholeNum < 0) {
this.numerator = ((this.denominator * this.wholeNum) - this.numerator);
this.wh... | 0 |
111aa0c53cedd3bfafe5027d190526bd | 10cafccdbc3caef0ef9e752573ac067a | Obtain subject alternative names from the Python cryptography extensions object. | def extract_dns_subject_alternative_names(certificate: x509.Certificate) -> List[str]:
subj_alt_names: List[str] = []
try:
san_ext = certificate.extensions.get_extension_for_oid(x509.ExtensionOID.SUBJECT_ALTERNATIVE_NAME)
san_ext_value = cast(x509.SubjectAlternativeName, san_ext.value)
s... | 1 |
514b6b4328a42204ee1bbe0b5ca1f810 | 5fdac4061932ca9a347b12e9e90707e0 | Sets whether to use strings in lower case or not. | class Plexity
public function requireLowerCase()
{
$this->rules->put(self::RULE_LOWER, true);
return $this;
} | 1 |
330062d06a1bf9fd0979ae88988f93dd | 3efe493364c09aecd26c464d9e054562 | Returns a regex that is used for determining the extension of a file
name. The first match group will be the entire extension, including the
leading period. | class FileGlob
def extension_regex
if @config && @config[:allow_periods_in_identifiers]
/(\.[^\/\.]+$)/
else
/(\.[^\/]+$)/
end
end | 1 |
db259147db612e2c51cf73d4561dd082 | d2c8010e9db9cdd747f8dc87205ace44 | @brief This function handles TIM0 global interrupt request. | {
if ((htim->Instance == htim5.Instance ) &&
(htim->Channel == HAL_TIM_ACTIVE_CHANNEL_2)) {
taskDISABLE_INTERRUPTS();
const uint32_t l_TIM5_CNT = htim->Instance->CNT;
htim->Instance->CNT = (uint32_t) ((l_TIM5_CNT + g_TIM5_ofs) % Tim5_reloadValue);
g_TIM5_ofs ... | 0 |
e7f02fe59b1c17302ea2b94b87afbbd8 | 54ccfeb9ebdcf6ce40ab52bcb10b5069 | この要素が保持する子要素から指定の要素選択ルールに適合する要素を取得する。<br/>
要素が存在しない場合、空のリストを返却する。 | public class DomUtil
public static List<Element> subElements(Element element) {
return subElements(element, null);
} | 0 |
3c4129e88f78ccc23a13bd83fbf888df | 8dd884621562492fbc4621388f4a27ae | Allow user to change the current world size | void GameWidget::setCellNumber(const int &s)
{
universeSize = s;
base1.resizeWorld(s,s);
update();
} | 1 |
9a6ae20a1c20b46c3f8a320944b12dae | 23975cbdfbc64b0f9493b3ff6487021f | condition of EVENT_TO_GRAVE + destroyed_by_opponent_from_field | IsDestructionEvent(UInt16 inCode) {
if ( (inCode >= event_DefendersLost) && (inCode <= event_PlanetDamaged) ) {
return true;
} else {
return false;
}
} | 0 |
4c31f306e2f322d057683d7390d2953e | 59f50efb88f17fc8e3ba7dd0b4e40f95 | 一个字段ui对象, 对不同的类型输出不同的html代码 | let html = '';
if (col.c_column === 'link_name') {
let dataUrl = '';
if (this.rec.c_type === cmpage.enumActAssignType.DEPT) {
dataUrl = '/admin/code/code_lookup?rootid=5&multiselect=false';
colValue = await cmpage.service('admin/code').getNameById(... | 1 |
7278e18a5ad1a533b095b58a2bf2ffaf | 411b0344e4d8ef3f924a3b13d6de4a5e | Creates an array with n amount of identical objects. | function rep(x,n)
{
var iRep;
array=new Array(n);
for (iRep=0;iRep<n;iRep++)
{
array[iRep]=x;
}
delete iRep;
return(array);
} | 1 |
b79fbf987f5fa311fdafe32ed3fcc4af | ef1df5949ed307380b9d87c3520366ed | When the timer expires, the question is marked as attempted. The control moves on to the next question. | public class QuestionFragment extends Fragment implements QuestionsListPopupMenu.questionNumberClick{
public void getNextQuestion(View v){
models.get(questionPosition).setTimeTakentoAttempt(((DashBoardActivity)getActivity()).attemptedQuestionModel.getTimeTakentoAttempt());
models.get(questionPosition).s... | 0 |
dd8b82b06244ae695975f3435288a658 | e01308cbab41b60feee215b53643fcf9 | 跳转艺术培训视频列表页 | public final class PageJumpUtil
public static void skillList2Detail(Context context, Class<? extends BaseActivity> clazz, String articleId, String title) {
sIntent = new Intent(context, clazz);
sIntent.putExtra("title", title);
sIntent.putExtra("articleId", articleId);
context.startActiv... | 0 |
9949315d6de9d8dd8cf739b7faf53692 | 4919ae79c82b26473410870447b8d875 | Called when the AllowHovering dependency property changes. | namespace Avalonia.Controls
[TemplatePart("PART_DecreaseButton", typeof(Button))]
[TemplatePart("PART_IncreaseButton", typeof(Button))]
[PseudoClasses(":left", ":right")]
public class ButtonSpinner : Spinner
protected virtual void OnAllowSpinChanged(bool oldValue, bool newValue)
{
Se... | 0 |
70c8e312ce4a8f06b3f892608800e145 | 1260f4333db6cd1b24dab13cdf37aa61 | Получаем минимальную цену на семена | class Product
public static function getMinCostProduct() {
try {
$db = Core\Db::getConnection();
$db->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
$sql = "SELECT MIN(price) FROM product";
$result = $db->query($sql)->fetch();
} catch (\PDOExce... | 1 |
490e446b6122631b0a77a9e62047ed78 | 7c5fb3fcda4a71e50452911ba0ece406 | helper function: convert int indirection level to string | def level_to_down_name(level):
assert(level>=1)
return 'ds%d%d'%(level-1,level) | 1 |
1fcd796cf0ee06106fb8b77f372682fb | 186fb471cff6e028b1ef5fc6da788398 | Debe ser llamado cuando no se vaya a usar el controlador
De-registrar listeners | public class ConversacionControlador
public static void eliminarListener(XMPPConnection xc){
cm.removeChatListener(cl);
cm = null;
cl = null;
MultiUserChat.removeInvitationListener(xc,il);
il = null;
} | 1 |
713b97cf0e6d98b03005b7c50eb50b30 | 4d3de44d1a1f370726345b82c714095d | Check whether there still some pin tries (max 3) | public function swordTries(); | 0 |
c9f5841686f0495528c3c77918cdafcb | 46a528ed54af75443f59847e1f41b5c4 | Initialises all the variables used by the checker | class Checker:
def __init__(self, player, king = False):
self.player = player
self.king = king | 1 |
da06d151e3d06c3cbf17e2914e62c0a2 | 4522fbf0dff2f926cc70cfb5a5742b58 | Creates the widget buttons and defines where they are displayed. | self.btns_widget = QWidget()
hbox = QHBoxLayout()
hbox.setContentsMargins(0,0,0,0)
self.btn_add = Button(onClickHandler=0)
self.btn_add.setObjectName('btn_add')
self.btn_add.clicked.connect(self.add_download)
self.btn_start = Button(onClickHandler=1)
self.btn_start.setObjectName('btn_start')
self.btn_... | 1 |
21d91f34f9e2566d5a51453b1ff1e7dc | 12efe16c534bb38c538c1b24dfb6099d | Load saved analyzed object from .dat file | if '.' in file:
model = joblib.load(file)
else:
model = joblib.load(file + ".joblib")
self.boundaries = model.boundaries
self.bin_type = model.bin_type
self.ind_type = model.ind_type
self.binary = None | 0 |
6af85a61c5834cedd2d5b9e8c9b0c2e0 | 80ac61aa119daec5cfb766148f1e238f | Getter pentru lista id-urilor tuturor utilizatorilor. | @Entity
@Table(name = "SCHEDULE")
public class ScheduleBean
public List<String> getUserIds() {
List<String> userIds = new ArrayList<>();
for (PersonBean user : userBeans) {
userIds.add(user.getId());
}
return userIds;
} | 1 |
fb5e9db02bbffb8c11419ba986ebf9a6 | ad10ec45a7c0719e626e574bb1122713 | 设置赛季开始时间 | public class Season{
public void setSeasonStartDate(Date seasonStartDate) {
this.seasonStartDate = seasonStartDate;
} | 1 |
d08a9ec6109f96c960d8ea0db2742072 | 02f9fb54f7289c8a5334e3f0a717355a | Function to easily implement low pass filters.
The base parameters are for low pass filtering of
photometry signals | class LowPassFilter:
def __init__(self, bandwidth, sample_time):
self.bandwidth = bandwidth
self.sample_time = sample_time
denominator = bandwidth * sample_time + 2.0
self.b1 = (bandwidth * sample_time - 2.0) / denominator
self.a0 = (bandwidth * sample_time) / denominator
... | 1 |
29a84e7c95253b33fe70f0140e0077ec | 998426e57f9e035ef995d938cac6f8b5 | Determines whether the current <see cref="decimal"/> is a positive number. | namespace System
public static class FloatExtensions
public static bool IsPositive(this float self)
{
return self >= 0;
} | 0 |
5766691688c4bd08444302262f34e3f9 | 813de377451839546cc9fcee9091f801 | Añade una nueva papeleta/voto | this.setState(({ elections }) => {
if (id in elections) {
return;
}
elections[id] = {
id, title, candidates,
closed: false,
voted: false
};
return { elections };
});
} | 0 |
4f6d9d39386347bd33471e9f8f57f72d | 9803695fd8f5cfdab0643f595e9f35f9 | 获取某个省份下所有区域当月目标 | @Controller
@RequestMapping("/crmPersonTargetController")
public class TeeCrmPersonTargetController
@RequestMapping("/getSumTarget.action")
@ResponseBody
public TeeJson getSumTarget(HttpServletRequest request) {
TeeJson json = new TeeJson();
int year = Integer.parseInt(request.getParameter("year"));
int deptId ... | 0 |
4f011a004a75064aafa83302635d6c79 | 0c37bce619503bd7e07fa297987d541c | Preprocess the band data. | ev = epochs.events[:, 0]
step = 0.5
band_min = 0.5
band_max = 49.5
z = list(np.arange(band_min, band_max, step))
FREQ_BANDS = [[x, x+step] for x in z]
psds, freqs = psd_welch(
epochs,
picks='eeg',
fmin=band_min,
fmax=band_max,
verbose='warning',
... | 1 |
01edaf3c21d687f3df0974fb947b8387 | 1c011735127e07e6b92aad8176ff376a | Action to be overriten in child | class ActionStub extends \Magento\Framework\App\Action\Action
public function execute()
{
} | 1 |
31d8f34fe7b8551ac42fdb5cc2318064 | 2ed00abfa3c9fcacdfee6acba29eb5a6 | Tests the loginlog relation | {
$relatedAnalytics = factory(Analytics::class)->create();
ServerAnalytics::addRelation($relatedAnalytics, 'some fake reason');
$this->get('/analytics');
$this->assertDatabaseHas(ServerAnalytics::getAnalyticsDataTable(), [
'id' => 2
]);
$this->assertDataba... | 0 |
edb71820e95967e33808d58ef30526e1 | e8e8f53873b9d4cf076aa895cbe802b0 | 根据订单状态传入值筛选出不同的订单数据 | export class OrderComponent implements AfterViewInit
show(status: string) {
this.orderList = this.resetData;
const allData = this.orderList;
if (status === 'all') {
this.retrieveAll();
}
else if (status === 'todo') {
this.orderList = allData.filter(i => i.... | 1 |
dadb73037019887569eb1be703b13433 | cbb921c2fdaaf435b785639cc6a0191d | Get all parsed data. | abstract class OMP_Parser_Component_Abstract
public function getParsedData() {
$val = (count($this->parsedData) > 0) ? $this->parsedData : null;
return $val;
} | 1 |
a3a1d81610e27000ebc9b6e118def6b9 | d47b6792df3f0ce298e2a818582af1c6 | Set UniProt protein name | public class ProteinModificationImpl
implements ProteinModification public static class Builder
public Builder setPsimodName(final String psimodName) {
this.psimodName = psimodName;
return this;
} | 0 |
8f54a96824bfe2f731a32dbd7ad01e1f | d2bbcd2bdcafb8a55020825195739d75 | Shows the blocks moving from their previous to new position | if(animatingBlocks) {
blockVals[gFromBlock].destroy();
textVals[gFromBlock].destroy();
blockVals[gFromBlock].blockActive = false;
var blocksDown = false;
for(var n=0; n < totalBlocks; n++) {
if(blockVals[n].blockActive) {
if(blockVals[n].x == gFromX && blockVals[n].y ... | 1 |
36b9d3aa6d224a59381a743d8754f295 | 4e1a5a481d4e0db51007026427d145e2 | Find the latest commit ({@code segments_N file}) and load all {@link SegmentCommitInfo}s, as
long as the commit's {@link SegmentInfos#getIndexCreatedVersionMajor()} is strictly greater
than the provided minimum supported major version. If the commit's version is older, an {@link
IndexFormatTooOldException} will be thro... | ArtifactVersion[] getAllUpdates(Optional<Segment> updateScope, boolean includeSnapshots)
throws InvalidSegmentException; | 0 |
0fc0f03a6174718a5f8e077f303a4d99 | bf9fcb9f8049ff4074286c2a9f5faee1 | Retrieve the currently selected package in the results list and invoke the Package GUI
for displaying information about it. | path = self.open.text()
if paf.valid_package(path) and not closing:
try:
self.window.package = paf.Package(path)
except paf.PAFException as e:
QtGui.QMessageBox.critical(self,
_('Unable to load package'),
... | 0 |
9a1ae85af96c56b1262fdabef1b2c009 | fa6a6c80cbb2ad9ec13d0d70cbe0ac0d | Returns new geometry whose coordinates are translated along axes. | namespace RFC.Geometry
IGeom translate(Vector2 v); | 1 |
75e154c86c446214834cc6a05acea5b1 | e19d11890a82f5073e32e93337766a99 | Function Name: colourChange_StartEx
Set up the interrupt and enable it.
None | ext->int_no = int_no;
ext->int_mode = RISING_EDGE;
ext->enabled = FALSE;
} | 0 |
312dfb2fbc556fca469734679593b4b6 | d665cd84a21c2a9639a4f626c8f1e1ba | Runs a command-line command for the netpbm tools. | def run_exif_tool(*args):
args = (EXIFTOOL_PATH,) + args
res = subprocess.check_output(args)
return res | 0 |
bc350346e0c0ae8e8668dd73d55cdb53 | 759a8a0c7a46f5ba1f55b1afe6abc4df | Calculates the score for the height difference between the highest and lowest column. | let initalColumn = this.getColumn(initialCenter);
let newColumn = this.getColumn(newCenter);
return initalColumn - newColumn;
} | 0 |
c792b6911cafa1af06a3a2bcce458546 | d1e59f195f4838765afd3358b757eef6 | 我的房源列表接口:
0.登录校验 @login_required
1.获取登录用户的所有发布的房源
2.响应数据 | user_id = g.user_id
try:
houses = House.query.filter_by(user_id=user_id).all()
except Exception as e:
current_app.logger.error(e)
return jsonify(errno=RET.DBERR, errmsg='数据库查询异常')
house_list = []
for house in houses:
house_list.append(house.to_basic_dict())
return... | 1 |
cd889150b30d1c3a4e25555900191a16 | 17b1da2c1869f7b5b19b81332855273c | Berechnet den Gesamtpreis aller Pizzen, die sich im Warenkorb befinden. | public class PizzaController
public int calculatePizzaPrice(Pizza pizza){
return pizza.getIngredients().stream()
.mapToInt(p -> p.getPrice())
.sum();
} | 0 |
40e0ef9108953466b53fe2091d62ee0d | e9c6bd7cab39114207362849eee1b48c | Hide the car hire options when the car hire checkbox is unchecked | namespace Presentation
public partial class MainWindow : Window
private void chkCarHire_Checked(object sender, RoutedEventArgs e)
{
rctCarHire.Visibility = Visibility.Visible;
txtCarHireDriver.Visibility = Visibility.Visible;
dpCarHireStart.Visibility = Visibility.Visible... | 0 |
50abe0c5f2f36b8c6f564d367565be3d | a88ab1429ad396d74784a923285e6bad | Retrieve a binding value or default. | {
$value = $this->bindings[$key];
if ($value instanceof \Closure) {
return call_user_func($value);
} else {
return $value;
}
} | 0 |
f022a5e6f86d4aa58d71ccc7bf0b82b0 | a20fc0aaafcaf89b848d25874b90b0f8 | Function that creates the design matrix of argument x, which is an array.
Argument n is the polynomial degree. | def _poly_matrix(x, degree, origin=False):
if origin:
n = np.arange(degree, 0, -1, dtype='i')
else:
n = np.arange(degree, -1, -1, dtype='i')
x = np.asarray(x, 'd')
return x[:, None] ** n[None, :] | 1 |
586218d181cf0b5f4719c8de9acdcf8f | f73be535ccbe16964796ff8f602a4754 | 1 定义一个函数func(filename) filename:文件的路径,函数功能:打开文件,并且返回文件内容,最后关闭,用异常来处理可能发生的错误。 | f=open(filename,mod)
try:
strs=f.read()
f.close()
return strs
except Exception as e:
f.close()
return False | 1 |
0e1b951fa367450bce2537cda1921e81 | c5ec00c1bfe9094f7b94039924392c22 | Give processes time to finish and kill them if they are stuck | def cleanup_process(process):
TIMEOUT, WAIT = 5, 1
if process is None:
return
for attempt in range(TIMEOUT):
status = process.poll()
if status is not None:
break
logger.info('Wait for process {} attempt {}'
.format(process, at... | 1 |
dd444b0cfa5745980d1cb880d8a80c14 | af9a95353375551e39233052250a32c0 | StartTest - serves the start test web page | from sillyswarm import app
from webtest import AppError, TestApp
app = TestApp(app.app)
res = app.get('/') | 0 |
e6b80247a874d361027955a769d2cb18 | 3003dccee4c08f111d21eb30e97b13ac | Tato funkce popisuje, co se stane pokud hra zkončí výbuchem miny. | class Gui():
def konec(self):
self.napis1.set("Konec!")
stanje=self.igra.stanje()
if stanje[0]>stanje[1]:
self.napis2.set("Zmagal je modri s {0} proti {1}.".format(stanje[0], stanje[1]))
elif stanje[0]<stanje[1]:
self.napis2.set("Zmagal je rdeči s {1} proti {0}.".... | 0 |
4f93d8f9361aa134a8ba33d694af7e2d | eb1c64fe5da73e975ec79bc4353fa984 | Tests check_validconnectionoutput to see if correct errors
are raised in 1st line. | class TestListConnections:
def test_correct_output(self):
compare_text = """------------------------------
Name: local
Description: The local connection provides a stub for an OEF node.
Version: 0.1.0
------------------------------
"""
assert self.result.output == compare_text | 0 |
071f7723793055493ca967d5f3c311db | bbc8cac2f5f81e05b3b1d4a52153c2c8 | Log profile connection event by incrementing an internal counter for that profile.
This log persists over adapter enable/disable and only get cleared when metrics are
dumped or when Bluetooth process is killed. | void profileIncrement(@NonNull UserRecord userRecord) throws InvalidArgumentException; | 1 |
44332a84b6ff3674d7d18a8c8ed86bbf | fa80edb60f04f3cd7334bcce080aee02 | Load the RSEM gene results file into a dict of dicts. | with h5py.File(filename, "r") as f:
d = {}
if "seqs" in f:
d["seqs"] = np.array([n.decode("ascii", "ignore") for n in f["seqs"][:]])
if "names" in f:
d["names"] = np.array([n.decode("ascii", "ignore") for n in f["names"][:]])
if "ohe_seqs" in f:
d[... | 0 |
d3e511a84a8233b3e16bddb1d13c2e39 | 5f3e088873cde35ba9b5a197d14b23d2 | Return a pointer to the actual gui window | sf::RenderWindow& Graphics_Manager::getGuiWindow(){
return *m_gui_window;
} | 0 |
67f0328f0b2b800b1ebdb690916d9b22 | a33d252252edaa682cf5c58d16c68248 | returns the checked out element from the checkout operation at the given directory
If the path is not a valid checkout directory, returns None | logFull('CeXmlRpc:if_file_checkout')
user = cherrypy.session.get('username')
user_roles = self.project.authenticate(user)
cc_cfg = self.project.get_clearcase_config(user, 'tests_path')
if user_roles and cc_cfg:
view = cc_cfg['view']
actv = cc_cfg['actv']
... | 0 |
e7557effe2b55d755cb6e88160e90d76 | c96425c5da59e5a8e50d7e4b768aa54f | Obtain the PnlImpresionTopComponent instance. Never call {@link #getDefault} directly! | public final class CNVCATTopComponent extends TopComponent
public static synchronized CNVCATTopComponent findInstance() {
TopComponent win = WindowManager.getDefault().findTopComponent(PREFERRED_ID);
if (win == null) {
Logger.getLogger(CNVCATTopComponent.class.getName()).warning(
... | 0 |
971a71844e4a6472fcaa1258b863bdc0 | 52f1c9769fa687a6637a33ee4385a637 | assumes binary trees rooted at left(i) and right(i) are max-heaps but heap[i] might be smaller than its children | left = self.left(i)
right = self.right(i)
largest = i
if left < self.size and self.array[left].get_value(self.sort_by) > self.array[i].get_value(self.sort_by):
largest = left
if right < self.size and self.array[right].get_value(self.sort_by) > self.array[largest].get_... | 1 |
d2f744662e76679631fdcd7384ec4def | 750ecfa92afe4ac9ecef296e255c19e3 | ======================== ReRun =========================================
Function description
ReRun test. | {
if (mr_state == MR_STATE_PAUSE){
mr_state = MR_STATE_RUN;
}else if ( mr_state == MR_STATE_RESTART){
mr_timer_p = (void*)"restart";
MR_TIME_START(100);
return MR_SUCCESS;
}else{
return MR_IGNORE;
};
if (mr_resumeApp_function){
int status = mr_resumeApp_function();
if(status!= MR_IGNORE)
return s... | 1 |
ae3ba1a0950d798af75fe3875dcc49c2 | f948444ce29e7cd5291cfe1b30d8006f | 创建一个int的切片,长度为5,容量为10 | var slice1 []int = make([]int, 10)
for i:= 0; i<len(slice1); i++ {
slice1[i] = 5*i
}
for i:=0; i<len(slice1); i++ {
fmt.Printf("%d,", slice1[i])
}
fmt.Printf("\n")
fmt.Println(len(slice1))
fmt.Println(cap(slice1))
} | 0 |
56da5b6b3a41f2fdc7526d0fcebf28de | 7e0a047dd1c4a499751fa43c0641ffd2 | Creates a new <code>CellStyle</code> for the given <code>Workbook</code>,
with the given attributes. Moved from <code>StyleTag</code> here for
0.5.0. | final class ExcelUpdateCallback extends AbstractUpdateCallback implements UpdateCallback
public CellStyle createCellStyle() {
Workbook workbook = getWorkbook(true);
return workbook.createCellStyle();
} | 0 |
253c52cdcc170cdc7bcb4958061f2d63 | 9548119fa9d0a66dd28ce49d066907f3 | クラス(インスタンス)のフィールドの値を取得する | public Object getValueOfField(Object clsInst, String fieldName){
Field []fields = clsInst.getClass().getDeclaredFields();
for(int i =0; i < fields.length; i++){
if(fieldName.equals(fields[i].getName())){
fields[i].setAccessible(true);
try {
return fields[i].get(clsInst);
} catch (Exception e) {... | 1 |
b2d5342d6afae45e62330c6294e293b9 | 23438b60193a0221c523c3d7b1e20921 | Get End Date from String date foramt (format could be YYYY / YYYY-Qn
YYYY-MM ) | class NySimpleConsultation(NyAttributes, Implicit, NyProperties, BTreeFolder2, NyContainer, NyCheckControl, NyValidation, utils):
def get_end_date(self):
return self.utConvertDateTimeObjToString(self.end_date) | 0 |
546c12bb955019f8d225c44a198e3aba | 42ab4a3c1e82a7897504614327a0f966 | Method for handling Spine element missing. | class ErrorHandler
public function handleMissing(NotFoundHttpException $exception)
{
try {
if ($this->exceptionHasBeenHandled($exception)) return null;
$this->app->make('anlutro\L4SmartErrors\Log\MissingLogger', [$this->app['log'], $this->app['request']])
->log();
return $this->app->make('anlutro\L4Smar... | 0 |
c4ba08c3014e866339d3dfedf4cad92c | 6e256a30b567f20250e20b886887dd6f | Go through every standard level model and write its collision grid list pointer | {
int i,ListSize=ModelList.size();
int Ofs=ftell(File);
for (i=0; i<ListSize; i++)
{
sModel Out;
sMkLevelModel &ThisModel=ModelList[i];
sOutElem3d &ThisElem=OutElem3d[ThisModel.ElemID];
sBBox &ElemBBox=ThisElem.FaceStore.GetBBox();
Out.ElemID=ThisModel.ElemID;
Out.BBox=ElemBBox;
if (... | 0 |
09085a52dbe8db556ab12e659c4ef98b | 170fc8746617d8e105cee0f06777b1aa | click event for filtering the playlist. | document.getElementById('playlistArea').addEventListener('click', ev => {
if (ev.target.tagName === 'BUTTON') {ev.target.parentNode.remove(); }
});
} | 0 |
aae6491fca26152c7c79954867668b27 | 0253b6e436f17b2e3bca4ac9938b1952 | 获取dialog中确定按钮控件,从而外部就可以再定义其样式了 | if(mIDBtnSure == 0){
mIDBtnSure = mResourceManager.getIdentifier("ema_btn_sure", "id");
}
return mIDBtnSure;
} | 1 |
eb00dbc42a1d8f40d0124ff0dde4ecbb | d246bf3b60eb15adabfa2a00cc5bf37a | @brief Returns the threshold that determines wheather the pixelvalues
are shown. | int CvGFilter::getThresholdLevel() const
{
return thresholdLevel;
} | 1 |
c3c6d3f1e0952f6a1f9e229ba214abe2 | 83597ddd97a687368fb134f0066676ee | Takes a list of module codes
e.g. ["MATH1234","COMP1234"]
and generates a url from which to pull
timetable data and returns this url | function buildUrl(m) {
return conf.u + m.join(conf.m) + conf.m + conf.v + '.js';
} | 1 |
30f9cd11877c6c34a550453a147fda09 | a0ef6a3670ff5b7e28409496ecf58dc4 | Does this JVM support {@link java.util.LinkedHashSet} and {@link java.util.LinkedHashMap}?
<p/>
Note, this is true for JDK 1.4 and above; hence the deprecation. | return ((jdkVersionNumber == JDK_15) ||
(jdkVersionNumber == JDK_16) ||
(jdkVersionNumber == JDK_17) ||
(jdkVersionNumber == JDK_18) ||
(jdkVersionNumber == JDK_19) ||
(jdkVersionNumber == JDK_CVM));
} | 0 |
eefa5922616d2b42f8eae7517812f02c | 33074d0304da64dcee9567b7eca663f0 | Test request ajax view if ajax request. | class CsrfMiddlewareTest(TestCase):
def test_ajax_exemption(self):
req = self._get_POST_session_request()
req.META['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest'
req2 = CsrfMiddleware().process_view(req, self.get_view(), (), {})
self.assertEquals(None, req2) | 1 |
a3886652fbd817d075d4616d2d0ca546 | cadd576e13aee8ac9c442435604bd3f5 | Parses skill level up, champion kill, and position data
of specified participant from JSON match details | if key == 'road':
pp_idx = 0
else:
pp_idx = -1
try:
pp_ovr_goals, pp_ovr_opps = [
int(x) for x in pp_overall[pp_idx].split("/")[0].split("-")]
pp_ovr_time = str_to_timedelta(pp_overall[pp_idx].split("/")[-1])
except Exceptio... | 0 |
1b9a697995dc846b9bd0636ec6425c4b | 04e99adc666cc5e859b1b9df049c7b48 | Returns the portlet ID of this portlet. | public class DocumentPortlet extends Portlet
public int getPortletId( )
{
return _nPortletId;
} | 1 |
c07f240390e8387390e38514b94c2880 | 6a77a748a8e9b44a30b576aa92dea733 | returns the length of the 'pseudo-intersection' of list A (short list) and B. duplicates are counted, hence 'pseudo' intersection | temp = ""
count = 0
while len(temp) < len(B):
temp+=A
count += 1
if B in temp:
return count
temp += A
if B in temp:
return count + 1
return -1 | 0 |
a7ef53664006977974687ad9e0a2538f | b8a5043de71fdc42e0e4ca8f3a8555e2 | 开启TCP管道线程 | {
TCP_isrunning_flag = 1;
if (0 != pthread_create(&ulAPPTCPThreadID, NULL, AppTcpThread, NULL))
{
printf("Create APPTCPThread failed!");
return -1;
}
return 0;
} | 1 |
a89fc30cd91471d1bdbae05db5524456 | 47c42bfc473a3f39bec970d48fc97ef6 | Check for data being ready for transmission to client | uint8_t isSendReady()
{
return (U1STAHbits.UTXBF == 0);
} | 1 |
e82910bbe4aa826fb527e10b0942d2ed | 0baa3b1fce0c073e15fcdd23693534ec | Change the max rows of a group. | class E5ModelMenu(QMenu):
def setMaxRows(self, rows):
self.__maxRows = rows | 1 |
6c0ad18db72140e7a34131f738a7efcf | b4b0a01d86ff31836c6a78df934ae79a | Put a binary file to the server. | class RackspaceServer extends AbstractServer implements LoggerAwareInterface
public function put(BucketInterface $bucket, string $name, $source): bool
{
$this->connect();
if (empty($mimetype = \GuzzleHttp\Psr7\mimetype_from_filename($name))) {
$mimetype = self::DEFAULT_MIMETYPE;
... | 1 |
3faa49edb5ddfc2d05bf0c5650fb9882 | fabeaef303fe3a56e9168bd1e1ce7970 | Destroy the sound manager. | Tetris::Utils::SoundManager::~SoundManager() {
al_destroy_sample(gameMusic);
al_destroy_sample(missionImpossible);
al_destroy_sample(crash);
} | 1 |
6cb1c1c5511dfe57f5c91c23fb49241a | 7feee69f349f2a383988b51d6c13078a | Send a message to the server, with acknowledgement | sock = socket.socket( socket.AF_INET, socket.SOCK_STREAM )
try:
sock.connect( (host , port) )
sock.settimeout( 3 )
except socket.error as err:
logging.debug( 'Connection Error (' + str(err) + ')! Trying to connect to ' + host + ':' + str( port ))
r... | 1 |
cac455c09421e5a6a5a77853752f8321 | 604e51b20d1b96be636227848fcacce8 | Iterator转换为Map,转换规则为:<br>
按照keyFunc函数规则根据元素对象生成Key,元素作为值 | public class CollectionUtils
public static final <K, V> Map<K, V> list2Map(List<V> source, FetchKeyFunction<K, V> function) {
Map<K, V> result = Maps.newHashMap();
for (V v : source) {
K k = function.getKey(v);
if (k != null) {
result.put(k, v);
}
}
return result;
} | 1 |
2fb33914fe9df75818fc17afb79b9b8b | 29f1c5da9b1e05f28d2bedc19c1c908e | Returns True if user is an artist | curs = dbi.dict_cursor(conn)
curs.execute('''select count(artist_id) from coda_artist
where artist_name = %s''', [artist_name])
result = curs.fetchone()
return result['count(artist_id)'] == 0 | 0 |
a6d1c09de09f377e6b5ab08a1029a1ed | 8ef13fca85feb199d69dcf6f7faa651b | Removes bounding boxes that have too much overlap
with other bounding boxes that have a higher score. | def same_class_remove(out, score_th=0.5, overlap_th=0.9):
passing_scores_ind = torch.where(out["scores"] > score_th)[0]
for i in range(1, 7):
labels_ind = torch.where(out["labels"] == i)[0]
if labels_ind.size(0) > 1:
ind = set(passing_scores_ind.tolist()) & set(labels_ind.tolist())
... | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.