query_id string | corpus_id string | query string | code string | label int64 |
|---|---|---|---|---|
9dc163fa21fafdf32139abc64525e8fa | 7d777153687faab7a0a9d467e3982dd1 | Parse multiple index definitions documents from a string or stream. | def parse_project_index(data: str, content_type: str) -> ProjectIndex:
if content_type == ACCEPT_JSON_V1:
return json.loads(data)
elif any(content_type.startswith(mime_type) for mime_type in _ACCEPT_HTML_VALUES):
return from_project_index_html(data)
else:
raise UnsupportedMIMEType(f"... | 0 |
a5492d49ab2e69a0b4e88b790648a144 | 1c4d69787985563ee747cf8709da55ef | Local file is always stale. | class CommandTwigLoader implements Twig_LoaderInterface, \Twig_ExistsLoaderInterface
public function isFresh($name, $time)
{
return false;
} | 1 |
b2bab25d1f336190e9da33075de4381c | d3165b8700cd1b6b1341870052a8c8e2 | Fetch the html code to display the field value in artifact | HtmlGraphField getHtml(String key); | 1 |
775a9c5843af50543f889648c9249f9b | e8184090fd48e6372cf2eef46fbad823 | fonction : charge une matrice à partir d'un fichier | void matrixMarket(double **A, char *nom)
{
FILE *fichier;
char mot[100], chemin[50] = "./Matrix/";
int cpt = 0, end = 10, cpt2 = 0, i, j;
strcat(chemin, nom);
fichier = fopen(chemin, "r");
while(cpt != end)
{
fscanf(fichier, "%s", mot);
if(cpt == 7)
{
sscanf(mot, "%d", &end);
end = end * 3 + 8;
... | 1 |
a3bc5163765f5798b018c027b75f45ee | 877bfa65db5b808affa8cda715cac900 | 必须调用,否则宽度改变但UI没有刷新 | {
if (_setWidth == width)
{
return;
}
int lastIndex = GetSelectedIndex(_scrollTop);
int newScrollTop = 0;
for (int i = 0; i < _items.Count; i++)
{
_items[i].Width = width;
}
... | 1 |
b81129c1ce3e4e0160da7aa2495f7589 | 1205c76f380392c849815ccdd91f7ba2 | adds new user if no user with the given name exists
returns true if ok, false if admin-token not valid or user already exists
token is refreshed via isSuperAdmin | {
using (var db = new DatabaseContext())
{
bool addUser = false;
var admin = db.Users.FirstOrDefault(u => u.ID == adminID);
var user = db.Users.FirstOrDefault(u => u.Name == username);
if (user == null && admin != null && St... | 1 |
c68c6df694f2fe482687328f7030e105 | 27f95ecb169a4b78ccfc425186315091 | 如果已经有设备号就不作任何操作 | public class MyApplication extends Application
public void scanDevice() {
if (BleManager.getInstance().getScanSate() == BleScanState.STATE_SCANNING)
return;
clearDevice();
BleManager.getInstance().enableLog(false).scan(new BleScanCallbackWrap() {
@Override
pub... | 0 |
1ef93f6dc55f6b910bb907a0c19e14ef | 6230a0e2e4ce2e85c76c4359d2529a3f | Regresa un Map con el nombre de todos los meses | namespace BPMO.SDNI.Reportes.PRE
public class ReportesPRE
private ArrayList ObtenerMeses()
{
ArrayList items = new ArrayList();
for (int i = 0; i < 12 && i < CultureInfo.CurrentCulture.DateTimeFormat.MonthNames.Length; i++)
items.Add(
new
... | 0 |
22cbaa67f7f2c6b001c75aac57ce227e | 26762bbca394bdfbdf24b30e61959884 | Sends self._wanted_value to the thermostat. | class Thermostat:
def activate_comfort(self):
value = struct.pack("B", PROP_COMFORT)
self._conn.make_request(PROP_WRITE_HANDLE, value) | 0 |
e2cacf9143f118f4c90767912c05b477 | 71346d96ffc6a26fc061c3fe616442a1 | Clear any added regularizers (only retains the first objective) | class AdamOptimizer:
def objective_changed(self):
self.t = 0
self.g1.clear() | 0 |
47c687d5da0daf92b598a8f0cc573537 | 18a03074a7a0ec806fb82afa037b3d0c | Mainly used to profile the serialization performance and memory usage | public class DIPRegexSerDe2 extends AbstractSerDe
@Override
public SerDeStats getSerDeStats() {
return null;
} | 0 |
e3a44e563d23b1b9cba705ca44e25d5c | 3ba9ac1a4b595c3ec2e8d7e5abc52408 | Rafraichir les listes de devises d'entrée, et les taux de conversion | namespace ClientConvertisseurV2.ViewModel
public class DevToEuroViewModel : ViewModelBase
private async void ActionGetData()
{
WSService connection = WSService.GetInstance();
var result = await connection.GetAllDevisesAsync("Devise");
this.ComboBoxDevises = new Observable... | 1 |
7836af05ef57bb0982c7ac32b63b01ad | 3487efe92bbc6fd6f71369fdf718601f | Get list of event ids that user is managing | public function getListEvents($userId); | 1 |
fa182d2ff41555fdda3014a69d10456a | c1a15e7271f3e70f8abec39ed0e3c372 | <para>
Draw the center of the clock
</para> | public class CustomClock extends View
private void drawCenterPoint(Canvas canvas) {
canvas.save();
canvas.drawCircle(mRadius, mRadius, 20, mPointPaint);
canvas.restore();
} | 1 |
eefa249c85a6b5663421d86b48df38aa | 28a2895e4f050d5dcd63e7b6663bbf36 | 周K | SwingWorker<List<StockKLineVO>, Void> worker = new SwingWorker<List<StockKLineVO>, Void>() {
@Override
protected List<StockKLineVO> doInBackground() throws Exception {
return kLineDataService.getKLineWeek(stockCode);
}
@Override
protect... | 1 |
d24e56f33bdbb910292538e5ee5055ec | 84f07a06f02ff0f09ea3f7cf8ab1094a | Read a dataset from a two level directory, sub-directory name will be treated as labels for all images inside. | def load_dataset(directory, keep_original_size=False):
X, y, paths = list(), list(), list()
for subdir in sorted(os.listdir(directory)):
path = os.path.join(directory, subdir)
if not os.path.isdir(path):
continue
files = [os.path.join(path, p) for p in os.listdir(path) if p !... | 1 |
51c557fe1a755d08026c5b4dfffffc48 | 441a1dc7cac3f2d739933e5ed1e5db7e | Gets the attribute value for UC_PASSWORD using the alias name UcPassword. | try :
return self._password
except Exception as e:
raise e | 0 |
b763bba7bef0b719cdb432a89d451eb3 | ac8bd09c76880298cd4c5acc8b15c366 | WARNING : Do not use this unless debugging, it'll probably slow down the program quite a bit.
NOTE : Keep this code the same as the getAiInputs(), to make sure what is visualised is actually what is happening. | function setDebugElement(initialise, world) {
let str = "Current state: " + world.worldFSM.currentState + "<br/>world.advanceState: " + initialise + "<br/>";
str += "Current level: " + world.currentLevel + "<br/>";
str += "Mouse: (" + world.mouse.x + ", " + world.mouse.y + ") <br />";
str += "Force:" + ... | 1 |
8dff94b55ec1c9f32a812d739856e6e4 | 2521ccdf9f087d501b2abb7106528415 | Spot all active ADCs to reconfigure them | uint32_t n = sizeof(adc_config) / sizeof(struct __adc_config);
for (int k=0; k<n; k++) {
if (adc_configured[k])
adc_close(adc_config[k].pin_number);
}
} | 0 |
0de02e721ea6c466b5d0f86eab962151 | 348b1373e08c9d10749aacbd947aa4b3 | POST /attendees
POST /attendees.json | class AttendancesController
def create
@attendance.user = current_user
@attendance.save!
render json: @attendance, status: 200
rescue ActiveRecord::RecordInvalid
render json: @attendance.errors, status: 422
end | 1 |
5dbabafb0c8775d29aad1a2e70371282 | 5ae428ccc3704ae1b6b3a79ba2f2f086 | This method combines the contour before editing (prevCanvasPoints) with
the current edit (editCanvasPoints), to produce a renderable preview of the
edit. Upon finishing the contour, the preview generated here is written back
into the contour state.
optimal contour:
the edit line aligns better with the intended cross po... | texture_height, image_path):
texture_height += self.edit_contour_add_border
texture_width += self.edit_contour_add_border
self.main_contour_points = cnt_points
self.mapped_main_cnt = self.map_from_image_to_opengl(texture_width,
... | 0 |
65c16ea6b9f56ff15afda0d703c4f90f | 185b221823764980bf8f82d9ad95918c | 颜色转HEX值 | var bin = r << 16 | g << 8 | b;
return (function(h){
return new Array(7-h.length).join("0")+h
})(bin.toString(16).toUpperCase())
} | 1 |
5ab24df0ffb23fb0913a33c9501cc005 | 58326c4dc672742e9bb03b909c8ab4f4 | Static method to find QWidget object from view by its name | function findDomByViewName(viewName) {
return content.find('div[ui-view="' + viewName + '"]');
} | 0 |
3b2801cc443b6583c1ab93f6872b7fd9 | bb0dfe14ce5a1af155d8ce4634d79305 | 修改建筑室内办公设备 | user=request.user
try:
dept_id = user.dept.id
dept_arr = []
depts = Department.objects.all()
getDept(dept_id, depts, dept_arr).append(dept_id)
id = request.data['id']
json_data = request.data.copy()
json_data['user'] = r... | 1 |
fc5ab2f2e74f6cb5a7cf1b4a8ac7916a | 3451ed696533ebf07a471ff1dcd6e2f4 | Gets the localized must convert text | namespace net.minecraft.src
public class GuiSelectWorld : GuiScreen
public static string GetLocalizedMustConvert(GuiSelectWorld par0GuiSelectWorld)
{
return par0GuiSelectWorld.LocalizedMustConvertText;
} | 1 |
6d0dfed89b271bdcd2efa41a4760dbc5 | 19296b5fbc30859fbc736c84f59c81a6 | Returns the shooting delay | class DoubleShoot
_computeDelay() {
return this._towerCadency / (this.nbShoot*2);
} | 1 |
92bf4e142dcd6a9cfc519e6afa617af6 | 301a6eab94c03726c568bf20a542c785 | 弹出全屏窗口 | var bh = $(".con").height();
var bw = $(".con").width();
$("#fullbg").css({
height : bh,
width : bw,
display : "block"
});
$("#dialog").show();
} | 1 |
e408493204273df3f1ed7e554bfd9e23 | 2f38164964c8804d2b6f1323e92202df | @brief add TopoNode to MapCollection directly.
this is used for UI building mode | void MapCollection::addNodeDirectly(TopoNode * node) {
if (maps.size() > 1) {
std::cerr << "[MapCollection::addNodeDirectly]"
"You try to add node directly, but there are more than 1 map candidate"
<< endl;
}
if (maps.empty()) {
maps.insert(new MapCand... | 1 |
bcdb47d7eebd2bfaa5b2bcd40ac4b510 | 1ad9c03f4d04b37650e02ca801e3b08f | Creates an instance of questions service. | this.title = config.title;
this.date = config.date;
this.id = config.id? config.id: CreateQuestions.__getId__();
this.status = config.status;
this.question = config.question? config.question: [];
} | 0 |
fc308f8e504b2c4508a368fed98d1698 | 498a09ca73fb8c27686c39fdfdda0c8f | Get information about the MinHash implementation that generated the matches. | public class SequenceMatches
public MinHashImplementationInformation getImplementationInformation() {
return implementationInformation;
} | 1 |
0f860e07fe81e97983e2a9f720da3d92 | b3e7c5b835eff08e822d9b4888ca1cc9 | Function to merge the smaller arrays that are created from recursively calling mergeSortRecords | CSVrecord* result = NULL;
if (a == NULL)
return(b);
else if (b==NULL)
return(a);
if (compareFields(a->sortVal, b->sortVal)==-1){
result = a;
result->next = SortedMerge(a->next, b);
}
else {
result = b;
result->next = SortedMerge(a, b->next);
}
... | 1 |
ff30e76175b13fa001be3ce9b554739a | 8fbdfc26bc3a9e36473f00158ce9b06c | 统计top n的日志组或日志流流量
统计top n的日志组或日志流流量
Please refer to HUAWEI cloud API Explorer for details. | ListFlowLogsRequest request) {
return new AsyncInvoker<ListFlowLogsRequest, ListFlowLogsResponse>(request, VpcMeta.listFlowLogs, hcClient);
} | 0 |
4c15d1abaa0ab4d357265e8b20ff2c1c | 9e86d4eddf738ffd18fa29d0d022a9a0 | Finds the regex pattern in a string, replaces it with the peg, and returns the token and tag strings. | function pegger.single_quote_lua_string(str)
return lua_single_peg:match(str)
end | 0 |
9f11235ca991dc6e9ef2d1754aa28398 | 1a9e7c0cf3f3e832f234a60fa91dd877 | 获取手机号验证次数 | namespace CRL.Package.Person
public class MobileVerifyData
public static int GetTimes(string moduleName, string mobile)
{
return 0;
} | 1 |
f1afb1db530e90066974c807e77102b0 | 200a94a574e1e3d15725c0dfda794b89 | Remove custom ID from the social profiles on the current user's account. | public class PlayFabClientAPI
public static FutureTask<PlayFabResult<UnlinkCustomIDResult>> UnlinkCustomIDAsync(UnlinkCustomIDRequest request) {
return new FutureTask(new Callable<PlayFabResult<UnlinkCustomIDResult>>() {
public PlayFabResult<UnlinkCustomIDResult> call() throws Exception {
... | 1 |
9819de2f1d1b560b45305e4d8619792b | cf60d164edbda934c4d57fa79f945c26 | Returns assigned assessments for the assigned assessment report | const [assessments, count] = await this.assessmentRepository.getAssessmentsForAssignment(assignmentId, filter);
const dtos = assessments.map(assessment => DtoFactory.createAssessmentDto(assessment));
return [dtos, count];
} | 1 |
502703e232cd1e44237a7108ce7ddc01 | ac23ceaa11e92a6008a6be7cb0f8f642 | 在List 与 Edit View中放入Category列表. | mCategories = (ListView) findViewById(R.id.classbook_edit_category);
ArrayList<String> cats = new ArrayList<>();
for (String s : ClassbookUtils.CATEGORIESSTRING) {
cats.add(s);
}
mCategories.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1... | 1 |
04998c143ef7842fe73da25007740507 | f8022f3b088082733bff10f1ac30383d | Asserts that dangling commits are removed after creating a branch. | self.testCommit()
old_temp_dir = self.temp_dir
new_temp_dir = os.path.join(tempfile.gettempdir(), 'moved')
os.chdir(tempfile.gettempdir())
os.rename(old_temp_dir, new_temp_dir)
self.repository = Repository(new_temp_dir)
changes = list(self.repository.iter_changes(... | 0 |
941d7a027d2aae6ef39dde5f8f945234 | 8a33cc58f205ef97d0f237c637642cb1 | Creates a test Wasm module with sample `add` function. | fn binary_i32() {
let module = module()
.function()
.signature().return_type().i32().build()
.body().with_opcodes(Opcodes::new(vec![
Opcode::I32Const(1),
Opcode::I32Const(2),
Opcode::I32Add,
Opcode::End,
])).build()
.build()
.function()
.signature().return_type().i32().build()
.bo... | 1 |
2811fdbbf777881fc56fec323acfe0c8 | 8bf90238e81a539c8268693a01664642 | sets the available movements of the ghosts | if(ghost1){
ghostMap[locationRow1][locationCol1] = "1";
}
if(ghost2){
ghostMap[locationRow2][locationCol2] = "2";
}
if(ghost3){
ghostMap[locationRow3][locationCol3] = "3";
}
if(ghost4){
ghostMap[locationRow4][locationCol4] = "4";
}
} | 0 |
fa49026db774ea610591925242d57ccd | 166ba241aaaf9003f2d013bf9b501c32 | Add the main document objects - these are all required to pass document
validation | public void setup() {
startDate = work.getStartDateDay() + " " + work.getStartDateMonth() + " "
+ work.getStartDateYear();
work.setStartDateQuestionSeen(true);
workDoc = new Document()
.append(Q1,
makeQuestion(work.getCurrentRoleDuratio... | 1 |
c21cfb43ae370663ef6d287c0cd5d949 | 57163ebefba9c7c2e47cf3d86a99e296 | Get preg part to match a revision in a string | def get_current_rev(current_rev_str):
rev = PATTERN_REVISION_REGEX.search(current_rev_str)
return rev.group().split('=')[1] | 1 |
b248ccffa72965c11344f249987b3393 | cb5c38bd23232104b1e904f27b883b41 | 异步发送一次http get请求,获取一个byte数组 | public class MyAsyncTask extends AsyncTask<String, Integer, byte[]>
@Override
protected byte[] doInBackground(String... params)
{
HttpClient httpClient = new DefaultHttpClient();
HttpGet httpGet = new HttpGet(params[0]);
byte[] image = new byte[]{};
try
{
Http... | 1 |
5d91e0ab97ece6dc895d3c6eca9aae57 | af1a2f1777881400d8677cfbe1fe2c8d | 增加数据(多个)
如果有重复则覆盖 | abstract class Model
public function saveAll(array $data, $replace = false, $query = null)
{
foreach ($data as $k => $item) {
if (!empty($this->allow)) {
$allowData = [];
foreach ($this->allow as $field) {
if (isset($item[$field])) {
... | 1 |
bb24bd3881d5793b6cd7a8d613325ee9 | 5e02e3b2efa4b1e525a86fe73cbcb2f7 | Tries to find a nearby node that will hide
the caller from its enemy.
If supplied, search will return a node at least as far
away as MinDist, but no farther than MaxDist.
if MaxDist isn't supplied, it defaults to a reasonable
value | edict_t *ent=NULL, *best_ent=NULL;
float this_dist=0, best_dist=8192;
int i;
if (bot->bossman->enemy)
return bot->bossman->enemy;
if (deathmatch->value) {
for(i=0;i < game.maxclients;i++) {
ent=g_edicts+i+1;
if (!G_ClientInGame(ent)) continue;
if (!ent->takedamage) continue;
if (ent==bot || ent==bo... | 0 |
3a8ba5e0a48e7e32da36a70d8419d24b | 3b7dd3e613900d55b93cf53877db522a | ## main function | PS.main <- function()
{
ISO <- Sys.getenv("ISO_REGION")
block.size <- as.numeric(Sys.getenv("BLOCK_SIZE"))
block.no <- as.numeric(Sys.getenv("BLOCK_NO"))
if (is.na(block.no)){block.no <- 1}
rLog(paste("Running CP vs. SP for block", block.no, "region", ISO))
filename.out <- paste("S:/All/Risk/Data/FTRs/", ... | 1 |
6c5ad6acd0967f866be3579ea2c56bbc | fa9899afeeafc44d412e22bd2b7aed6c | Trims reversions down to the max number allowed in the options | class Specie:
def trim(self, count: int):
self.genomes.sort(reverse=True)
self.genomes = self.genomes[:min(len(self.genomes), count)] | 1 |
b3024e83a237ee2e7c50ca6eea171197 | e57fb30fec1e0a269994aaf403306fca | takes the coordinates of a wall in wallData and returns the coords of the rooms it lies between | void wallDemolish(int room1, int room2); | 0 |
a6d633d685572c840575c49b1839b7f6 | c7d469e3a3b3a69456d17530ed0e528f | HandleLogin implements a POST request to retrieve a token based on a loginRequest | var newUser Error_Management.Auth
err := json.NewDecoder(r.Body).Decode(&newUser)
if err != nil {
w.WriteHeader(http.StatusInternalServerError)
return
}
model, e := Error_Management.FormValidationHandler(newUser)
if e.ResponseCode != http.StatusOK {
w.WriteHeader(e.ResponseCode)
err := json.NewEncoder(w).... | 1 |
cd1a58da7601a909544773f8330d94dd | c5bd3377bfab4e2ba9b1fde86745cc71 | Wyznacza nowy rozmiar grupy/populacji na podstawie jej bieżących cech. | global nAban, nResr, nCross, nVari, nCloneWithVari
change = False
if (-2 < direction) and (step < 0.00001):
direction -= 1
change = True
elif (direction < 2) and (step > 0.003*prev):
direction = 2
change = True
if change:
if (direction == -1):
nA... | 1 |
41b54acbccf019e605a204be28af9e5c | 1a5a8d5c298c340a82bc17212db9d499 | Tests if a timeout is active on specified handle. | public boolean isTimeoutActive(long id) {
log.trace("isTimeoutActive(" + id + ")");
return getExecuteItems().contains(id);
} | 1 |
9d11d99f4e9769585c275eed5e4f3d2e | 16f4c984af3c321b5c4eb5924e31a9d8 | find the min from 3 integers | int min_3(int a, int b, int c)
{
return min_2(a, min_2(b, c));
} | 1 |
bd0b08344272c50a18641df7fe7552dc | 1c717c223d49992d2ff9d82ad40f6840 | Custom Fire Type for Primary Fire | bool PrimaryFire(WeaponWielder firer, bool tryAuto); | 1 |
bdb0d5b153175b16827f4c7d3e12ef85 | 02ccb38f440bf5fd0d38b048fe2a79e6 | Verify that the file contains one or multiple valid graphs in sparse matrix format. | prev_vId, prev_rvId = -1, -1
nVertices = 0
with open(orig_map_file, 'r') as omf:
for line in omf:
vId, rvId = [int(k) for k in line.split()]
assert vId > prev_vId, "(1) Matrix-market verification failed!"
assert rvId > prev_rvId, "(2) Matrix-market verification fa... | 1 |
821b16365ed006bbea268868417f8702 | 5f30ad03423ff9fc67705bd3c8427389 | Sends the voyage with the new emplyees to the datalayer | namespace AirportProject.Common.Interfaces
void SendNewFlight(IPlane plane); | 0 |
7ba3921a74524195c0a4bcdfe524ce7d | ed15eed076f5963f5e2014304469cf11 | 「成り」ができる動きなら真。 | class Hand
def can_richi?
!richi? and menzen? and tenpai?
end | 1 |
250ebbeb2922b1468362d61906b7d154 | 831bd8afe5baa3ec7e4efcd96318aec0 | Списать штраф.
Количество ресурсов может уйти в минус. | {
if (!$this->isEnough()) {
throw new PointUnderFlowException;
}
$userStatus = $this->getUserStatus();
$userStatus->point -= $this->cost;
$userStatus->save();
UserPointHistory::register($this->user->getId(), $this->cost * -1);
} | 1 |
e3485a311bb7856bf868c35602d169c9 | 2e2ac38c4003a0f43736e1d7bd6538a3 | compute the real filename of a file by matching it without its
extensions to all the stream's filenames | {
char file1[1024];
char file2[1024];
char *p;
FFServerStream *stream;
av_strlcpy(file1, filename, sizeof(file1));
p = strrchr(file1, '.');
if (p)
*p = '\0';
for(stream = config.first_stream; stream; stream = stream->next) {
av_strlcpy(file2, stream->filename, sizeof(file... | 1 |
dcedb31acad582fa2a02bd5dc6b21969 | a74ad84cecfca3233a95f499bc17d32c | Removes Dead animals from CURRENT PLAYER | class Landscape:
def remove_all_dead_animals(self):
self.pop_herb = [herb for herb in self.pop_herb
if herb.will_animal_live() is True]
self.pop_carn = [carn for carn in self.pop_carn
if carn.will_animal_live() is True] | 0 |
ddc59e6b4048a3cadc379b16a1a8b378 | ddafa6679c51010694f5b1cb8e6220fc | 主要是执行FTP下载任务 | @Slf4j
@Component
public class MqJobClient extends JobExecutorTemplate{
@Override
protected void executeJob(JobTaskDTO dto, ExcelJobDTO jobDTO) {
taskService.asyncFtpProcess(dto,jobDTO);
} | 1 |
d7b7e1669c8571824ed6bc6d34ddd3b2 | b5aa9a51c039c1ac173adb7f4bcd5eeb | 在值列表末尾添加一个值 | class ListMixin:
def append(self, val):
self[len(self) :] = [val] | 1 |
265386a7452487947503e95c5060620e | b667655843fcf89a7bd35f6e2ebf853a | Test that permutation function return good output with a 1-size test string. | def test_permutations_1_item(permutations_1_item) :
assert [permutations_1_item]==permutations(permutations_1_item) | 1 |
0711284804c8c19b18aace856398a144 | 40dccea0298edf7eb4ff4f67eba9118d | Purpose: Calculates all of the coefficients for the error constraints
in the point-constrained reaction and species elimination integer
linear programming formulations. | class SynapseParam(SynapseBase):
def constraint_coeff(npl: int, nst: int) -> la.lnarray:
rows, cols = la.arange(npl*nst), la.arange(nst-1)
cols = cols + rows.c * (nst-1)
coeffs = la.zeros((npl*nst, npl*nst*(nst-1)))
coeffs[rows.c, cols] = 1
return coeffs | 1 |
2580cfc905225e72c44a95a5d2eb8af0 | 41f59138c21d33dc8ba121c09695d3ac | 给敌人附加Debuff | local ability = keys.ability
local caster = keys.caster
local target = keys.target
AddLuaModifier(caster,target,"tc_xlly_debuff",{},ability)
end | 1 |
41d6381ee71fc6a500a0f85b881af8d0 | e26729f5f988aadd349fb5fd255f9fb9 | Returns the maximum length limit of a cluster name.
This method is used by check_cluster_name_is_valid() to check if the
cluster name is too long.
None means no limit. | def default_max_length():
return _settings().get('DEFAULT_MAX_LENGTH', DEFAULT_MAX_LENGTH) | 1 |
eca39b33c2611c1cdd190e4403ab8eb5 | 7d9a0e05ac6f2b413c6309ced3722745 | Get default bucket namespace (volume) policy name given tenant name. | SERVER_URL = self.__service_url + '/admin/v2/namespaces/{tenant}/{namespace}/persistence'\
.format(tenant=tenant, namespace=namespace)
response = requests.post(SERVER_URL)
msg = {
'http_status': response.status_code,
'content': response.content.decode('utf-8')... | 0 |
d0a2de0ea9cd66f6767f553441eb0468 | 2035d0ba27faf951e2d68657548639e5 | 投稿にひもづけられたアイキャッチ画像の情報を取得 | $att_list = array();
$args = array(
'post_type' => 'attachment',
'numberposts' => -1,
'post_status' => null,
'post_parent' => $post_id,
'order' => 'ASC',
'orderby' => 'menu_order'
);
$post = get_post( $post_id );
$content = $post->post_content;
$at... | 0 |
ed0d79065e4afc3d02203011f569104d | 0f11964f51ef6900c7c23c88daa0623b | Converting the xlabels to mm | {
if (ui->label_pressIndex->text() == "Pa")
{
ui->pressLbl->setText(QString::number((ui->pressLbl->text()).toFloat() / 133.322));
}
ui->label_pressIndex->setText("mm");
} | 1 |
3c5d6cfa1161572c4e03a473f430a05c | faac99073604b1210c500b8fb689cf5c | Muestra el ranking de los usuarios ordenados por premios y nivel desde la base de datos | $stmt = DBConnector::connect()->prepare("SELECT * FROM $tabla_db WHERE puntos <= :puntos ORDER BY puntos ASC");
$stmt->bindParam(":puntos", $PremioModel, PDO::PARAM_INT);
if($stmt->execute()){
return $stmt->fetchAll();
}else{
return "error";
}
$stmt->close();
} | 0 |
7dd00787d5fee478294c2370b39fe53f | 6b67600b90a1a55e24e8a64d6c4ad2c8 | Create a simulation of given size with given obstacles,
humans, and zombies | class Apocalypse(poc_grid.Grid):
def __init__(self, grid_height, grid_width, obstacle_list = None,
zombie_list = None, human_list = None):
poc_grid.Grid.__init__(self, grid_height, grid_width)
if obstacle_list != None:
for cell in obstacle_list:
self.set_ful... | 1 |
6606dcef4d262adef62f4f2eab2ad1b3 | f67d79cdfb799bdcdf100df9ab26f8c2 | Call when the modem sensor is added to Home Assistant. | class AsuswrtSensor(CoordinatorEntity):
async def async_added_to_hass(self) -> None:
self._handler.enable_sensor(self._type)
await super().async_added_to_hass() | 1 |
1c805450f72d9d0965c5e26d79b708ff | 1d0473c85810f8edec375a737e4480b5 | Ajoute des espaces dans le numéro de téléphone et supprime les points | {
$numero = '+33 (0) '.mb_substr($numero, 1);
return $numero;
} | 0 |
81992ba2de3cf2f49b25e517f45f7922 | 07d77773dae01af1b800d9cc441ab722 | Get WindowsLive access token. | {
var credentials = connector.Credentials as MicrosoftAppCredentials;
if (credentials != null)
{
return await credentials.GetTokenAsync();
}
return null;
} | 0 |
1e297825c84d897240c97a0e0e739f69 | 5094a3dfd999dfcdb41148720ccf7a3e | 按行打印二叉树 | val list = LinkedList<BinaryTreeNode<T>>()
print("$value ")
println()
left?.let { list.push(it) }
right?.let { list.push(it) }
var thisFloorCount = 2
var nextFloorCount = 0
var lineCount = 2
fun left(node: BinaryTreeNode<T>, boo: Boolean) {
node.left?.let {
if (boo) {
list.offer(it)
} else {
li... | 1 |
61360ef7e44edf5169287f82a0fc78de | 35bce6a561b5a33083038210842cf73b | Handles received {@link Intent} by activity. | public boolean onEvent(Context context, Intent intent) {
if (mApi != null && mApi.handleIntent(intent, this)) {
return true;
}
return false;
} | 1 |
a107009c1b6c150b5610a4b251cc029a | 24ce066436010f8b4c5a178f55a62484 | Convert gibibytes per second to yobibytes per second | namespace Juniper.Units
public static class BytesPerSecond
public static float YobibytesPerSecond(float bytesPerSecond)
{
return bytesPerSecond * Units.YobibytesPerSecond.PER_BYTE_PER_SECOND;
} | 0 |
3cf75ac7056374031a146ea98dadf6fb | 127090b16bab5cbc7b9588e2c84f7266 | 单点登录配置 | http.csrf().disable()
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and()
.authorizeRequests()
.and()
.formLogin()
.usernameParameter(securityConfig.usernameParameter)
.passwordParameter... | 0 |
007d684abaa9e8a45a5eeab5161003ae | c369ebd8388fee78f2043f4717519a41 | 调用crm项目,通过手机号查询客户 | @CrossOrigin(origins = {"*"})
@RestController
@RequestMapping(value = "/api/callcenter")
public class CallCenterAPIController extends BaseController
@RequestMapping(value = {"/get_call_user_info", "/get_user_info"}, method = {RequestMethod.GET, RequestMethod.POST, RequestMethod.OPTIONS})
@ResponseBody
public Ca... | 1 |
a9a378f64494fa758139219c91f9207a | 91e1bb31f51e2d91c37c260c953b1764 | Show or Hide the enemies health bars. | public class GameManager : MonoBehaviour
public void ToggleHealthBars()
{
_showHealthBars = !_showHealthBars;
foreach (var item in EnemyManager.GetInstance().ListOfEnemies)
{
if (!(item is EnemyWorker || item is EnemyFlyer))
{
item.HealthBar.gameObject... | 1 |
3ab616fb828b5c1300d662609e4654be | c78a0f147816b729364affd04255eb3e | Mostra una informació d'un element de tipus "element" al conjunt. | namespace Ejercicio_3
void ShowElements(); | 0 |
e3ccee7055bb668d30bd50b4b75dd3ba | 8cb9c3b29bb3019f4b49a6d4bf674221 | Retreive and check CDATA from the generated file | if os.path.isfile(cdl_filename):
try:
with codecs.open(cdl_filename, 'r', 'utf-8') as f:
cdl_file_content = f.readlines()
cdl_file_content = [x.strip() for x in cdl_file_content]
return cdl_file_content
except Exception as e:
lo... | 0 |
fbd5568bb0606c53eed5aea43fcac37a | 8138d0c5d656b064244f3dac661b0e52 | Download a range of usenet messages. Store binaries with subjects matching a
specific pattern in the database. | class Binaries
function scan($nntp, $groupArr, $first, $last, $type='update')
{
$n = $this->n;
$this->startHeaders = microtime(true);
if ($this->compressedHeaders)
$msgs = $nntp->getXOverview($first."-".$last, true, false);
else
$msgs = $nntp->getOverview($first."-".$last, true, false);
if (PEAR::isErr... | 1 |
72716c0ede6ca38fcf93b1beac312c0f | 8a0292578214cca693fe79d0488fd25a | 返回带单引号包裹的字符串,用于SQL的字符串类型参数 | namespace IP地址切换器.CommonComponent
public class SqlStringFormat
public static String GetQuotedString(String pStr)
{
return ("'" + pStr.Replace("'", "''") + "'");
} | 1 |
76ffa5c197bbe67c877fb7690fcf3deb | 3714d0ae8bae79c062a78e7fd95e0712 | 开发模式下去掉预加载和预请求的优化 | chainWebpack(config) {
config.plugins.delete('preload')
config.plugins.delete('prefetch')
} | 1 |
81c237a01860cd3addcbb55d02fd4ee0 | 28861a6a273cdc9bd59e8b4e0a2b9909 | salva uma lista internamente de pokemons (favoritos) | function setFavs(aoFavs) {
localStorage.setItem(goPage.localStoreName, JSON.stringify(aoFavs || []));
} | 1 |
cd539fc02967492f97971445fec38ffe | f5d7b97a425232a9afcd04c778af2fec | Calculate overaal net error (RMS of output neuron errors)
RMS = Root Mean Square Error | class FeedForwardNetwork(object):
def network_error(self, i, t):
net_err = mean_squared_error(t, self.predict(i))
return net_err | 0 |
1fcf37014d7c1a56ab5208eaa2fe89a2 | aecf76282c2b43e5bf531bdb82a0f72b | POST /issue_statuses
POST /issue_statuses.json | @issue = Issue.new(api_issue_params)
if @issue.save
render json: @issue, status: 201, location: @issue
else
render json: @issue.errors, status: 422
end
end | 0 |
ee43b8ee224f6a6f506f0f498d5e3bf5 | 164a26c04dd4171d38c613b8756c6e51 | Create singleton Spark instance | class GetSparkSession:
def __init__(self):
if GetSparkSession.__spark_instance is None:
GetSparkSession.__spark_instance = GetSparkSession.__internal()
self.__dict__['SparkInstance'] = GetSparkSession.__spark_instance | 1 |
78f305ad609d082e5979cab9533a68eb | 32e59ddf61fccdcfccd0795c34b43884 | Get a idle core; if there are a idle core now, return the core id;
else accroding the priority, add the reserve request to queue,wait
other application release core.
There are two priority: VOD and LIVE, the level of LIVE is
higher than VOD.So LIVE level will get a idle core first. Until LIVE
list is empty, VOD can get... | if( m_idleList.size()==0)
m_idleCCond.wait()
m_idleMutex.lock();
if(m_idleList.size()>0){
CWorkThread * thread = m_idleList.pop_front();
m_idleMutex.unlock();
return thread;
}else{
m_idleMutex.unlock();
return NULL;
}
} | 0 |
89f4f82dffeac14a00313f03fc30e48f | 5600d86925f85fa77f7292d716ee715e | This function returns the bounding box corners in
a local frame | def polygon_cr_to_boundingbox(polygon_cr):
cr_arr = np.array(polygon_cr)
return (np.min(cr_arr[:,0]),np.min(cr_arr[:,1])),(np.max(cr_arr[:,0]),np.max(cr_arr[:,1])) | 0 |
ef8049e6744a531afff32d9c4888f590 | 0d6ed839f77986c2ed9b4da3de76b372 | Permet d'allouer l'espace mémoire nécessaire pour le tableau de briques | function creerBriques(ctx, nbrLignes, nbrParLigne, largeur, hauteur, espace) {
tabBriques = new Array(nbrLignes);
return 1;
} | 1 |
7aff11ff1d69f5fc7e9c9daba19174ff | 0b3b8dc66db5e0f5d2f23ac2a7ed8d39 | Gets the max value that a number can be given the bytes. | def get_maximum_value_from_sample_format(sample_format):
size_bits = SAMPLE_FORMATS[sample_format]['size_bytes'] * 8
return 1 << (size_bits - 1) | 1 |
09f22029d85768e2bf4a44e94df72035 | cd7b6785344d101c83c68a47026af285 | Valida que el valor seleccionado en el combobox, es válido | export class NewgroupComponent implements OnInit{
public validateCareer(value):boolean{
let datosOk = false;
datosOk = this.carrerList.find(id => id.longName == value);
return datosOk;
} | 1 |
495748aad2d9d47cb7ef00a3d4d8d8ca | 969c3c3c6ff5e32aa525d2fd3d754577 | возвращает массив возможных ходов для короля | class Game
public function getPossibleMoves(Figure $figure)
{
$possibleMoves = array();
$pos_X = $figure->getPositionX();
$pos_Y = $figure->getPositionY();
if ($figure->getType() == 'p') {
if ($figure->getColor() == 'w') {
if ($pos_X != 8 && is_object... | 0 |
6779d81acfa89faad8fa4f9b75ec3c25 | 6f35c82151bb67c333f071103cfe60df | Получить всех авторов | class Author extends BaseModel
public static function getAuthorsList()
{
$result = Db::getConnection()->query(
'SELECT id, first_name as fname, last_name as lname
FROM ' . self::TABLE_NAME . ' ORDER BY fname ASC, lname ASC'
);
return $result->fetchAll();
... | 1 |
3ec39cb0fceebc2189be57557ee54d68 | 632da8b036533faa17537ce7637bc4da | Starts the HTTP server, creates the routes to service and waits until initialization completes. | namespace Energistics.Etp.Native
public class EtpSelfHostedWebServer : EtpWebServerBase, IEtpSelfHostedWebServer
public void Start()
{
StartAsync().Wait();
} | 1 |
210fef410f23c269ac452edb75eed124 | f88f0c866ed2012e4ac076a8b0466372 | Tests for the ProgramEnrollment model. | super().setUp()
self.course = CourseFactory.create()
self.audit_mode = CourseModeFactory.create(
course_id=self.course.id,
mode_slug='audit',
mode_display_name='Audit',
)
self.honor_mode = CourseModeFactory.create(
course_id=self.co... | 0 |
4baa6f57defe32778870af5fb6de976c | e7419cc0144e954a17a0ba69f5ef74e9 | Determine if the two events have a dependency. | public final class Graphplan
private boolean are_dependent(final Op op1, final Op op2) {
return op1.getNegativeEffect().intersects(op2.getPositivePreconditon())
|| op1.getNegativeEffect().intersects(op2.getPositiveEffect())
|| op2.getNegativeEffect().intersects(op1.getPos... | 1 |
ad92d3b1dac76fb67eac360be0069095 | a0193fc6322d57b2ca6b10a14bcaff63 | Calculate the tangent vectors for face i | void Mesh::updateTangents() {
for (GLuint i = 2; i < indexBuffer()->elementCount(); i += 3) {
GLuint i0 = indexBuffer()->element(i-2);
GLuint i1 = indexBuffer()->element(i-1);
GLuint i2 = indexBuffer()->element(i-0);
MeshVertex v0 = attributeBuffer_->element(i0);
MeshVertex v... | 1 |
4b14c4125d52dbfd4f8bae480a77b0f1 | 67cf9909dfa1956a7c8d5a1d118206ea | Returns the meta object for class '{@link org.storydriven.storydiagrams.expressions.common.expressions.And <em>And</em>}'.
<!-- begin-user-doc -->
<!-- end-user-doc --> | EClass getAndExpression(); | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.