query_id string | corpus_id string | query string | code string | label int64 |
|---|---|---|---|---|
fe082bdb3372037cb459a54711e23f44 | 7eeadbc71122dd9f4ce352dbdc82b5ed | print all active accounts - number and balance | int z;
signal(SIGALRM, SIG_IGN);
sem_wait(&mutexOpen);
for(z = 0; z < l->size; z++){
printf("Account name: %s\n", l->alist[z].name);
printf("Balance: %f\n", l->alist[z].balance);
if(l->alist[z].on == 1){
printf("IN SERVICE\n");
}
printf("\n");
}
sem_post(&mutexOpen);
alarm(20);
signal(SIGALRM, ala... | 1 |
32b5b2e3fb12289346f8d2364b49249d | 11f95fe828ceb6074b561118982e0f30 | Call on_start on each callback in turn with the given state. | class CallbackList(Callback):
def on_train_start(self, **kwargs):
for callback in self.callbacks:
callback.on_train_start(**kwargs) | 1 |
bb616e18f91a69daf8ecbd3fb8c85cf3 | e61754067ba3192768ca12354e84e4be | Возвращает рейтинг после добавления оценки | value = flask.request.args['value']
notes[note_id][1].rating += int(value)
return flask.jsonify({'id': note_id, 'rating': notes[note_id][1].rating}) | 1 |
d301e17963f3d64563138cd4bbacd2ed | 032f93f99c85e47875da24cfaf3dbfcc | 从指定的表中读取项目(按主键+排序键读取) | {
var table = GetTable();
if (!table.Exists())
return null;
var filter = TableQuery.GenerateFilterCondition(TableConstants.PartitionKey, QueryComparisons.Equal,
partitionKey);
if (skipUpTo... | 1 |
8a0a4eec52f89d25b07c1962e3a14638 | 999067f8c5cfa4534f5a95d4a18f9384 | Метод вызывается по нажатию на сцену. Если точек меньше трех - делаем треугольник, иначе выставляем проверяемые точки. | namespace DeBoorsSplines
public partial class MainWindow : Window
private void GenerationButton_Click(object sender, RoutedEventArgs e)
{
if (splineCollection.PointsList == null)
{
splineCollection.PointsList = new List<PointsLibrary.Point>();
}
... | 0 |
49a11d790587a29a5c8f2d3ab11be718 | 6e6e1504567a68000eb0b660d4c21398 | Obter o elemento seguinte que é maior que o elemento fornecido | {
var node = FindNode(value);
if (node == null)
{
return default(T);
}
var next = (node as BSTNodeBase<T>).NextHigher();
return next != null ? next.Value : default(T);
} | 1 |
d729d883c75777c64010b7a8758cf7fa | 8a86934dbdfcacd8eb4163bdd52ffa42 | Test for "next" attribute for "category" tag.
<p>
Complex case, when we first see category with "next" attribute and only then referenced
category. | {
String reference;
Lexer lexer;
Node node;
reference = "<head lang='en_US' dir=ltr\nprofile=\"http://htmlparser.sourceforge.org/dictionary.html\">";
lexer = new Lexer (reference);
node = lexer.nextNode ();
assertEquals ("Tag contents wrong", reference, node.t... | 0 |
5526112a2906c6a129e49e8a20fc786d | db070caa2775c0f86a4451db5a5fbca0 | Read all the defined entities (YAML-only currently) and update
the source entity files to have all the correct methods. | {
self::$Entities = [];
$CoreEntities = [];
for ($i = 0; $i < count(Core::$DatabaseConfig['entities']); $i++) {
$CoreEntities[] = '\\App\\Entities\\' . Core::$DatabaseConfig['entities'][$i];
}
$Entities = array_merge($CoreEntities, Core::$ModulesEntities);
foreach ($Entities as $entity) ... | 0 |
07562fa1fe0922a0beb3c49d492e02ce | 1c6cf4af7917d3201e8069ebfb8daceb | 判断某点是否处于开启列表中 | namespace testAstar
public class Astar //【类】算法
private bool inCloseList(int x, int y)
{
return inList(closeList, x, y);
} | 0 |
98bd24278dc3db7ce325afabccc2fccb | b84c7d4ab196271d1c64297f7498af49 | gets all players which are on the bench | ArrayList<Player> returnPlayers = new ArrayList<Player>();
for (Player player : getPlayers(pRepo)) {
if(player.getPosition().charAt(player.getPosition().length() - 1) == 'B' || player.getPosition().equals("GK")){
returnPlayers.add(player);
}
}
Collections.sort(returnPlayers, new Comparator<Player>()... | 1 |
6da7f999ee1ad493272d6da438c61041 | cbfd585d9d010ae52581501f8ff6c744 | тест на недопустимый ввод: форма передаётся в шаблон | class ListViewTest(TestCase):
def test_for_invalid_input_passes_form_to_template(self):
response = self.post_invalid_inputs()
self.assertIsInstance(response.context['form'], ExistingListItemForm) | 1 |
9f3186ba52c014bfb9272656e300d613 | 9cae17ca4f4282cb3caa726bf64efb27 | Test whether all the items from the starting index is returned. | indices_by_letter = {'a': [0]}
self.assertEqual(substring.max_starting_index(indices_by_letter), 0)
indices_by_letter = {'a': [0, 1]}
self.assertEqual(substring.max_starting_index(indices_by_letter), 1)
indices_by_letter = {'a': [0, 1, 2, 9]}
self.assertEqual(substring.ma... | 0 |
d3c389281af8282250fcc0b04884b24c | bcf0b25d01d619e3c4ea2c13c17b0077 | Writes information about new word to the file.
Returns string representation of this information. | class ExportWord(BaseWord, AddonExportWordConverter):
def export(self) -> str:
match = self.stringer(self.match)
tid_old = self.stringer(self.TID_old)
origin_x = self.stringer(self.origin_x)
origin = self.stringer(self.origin)
return f"{self.id_old}@{self.type.type}@{self.type.ty... | 1 |
cb7919ac4422eeeeaa1c98b7873da7e7 | bef31f1a92d2b99c33e596d1d75f11f9 | Returns a list of arguments passed to the endpoints.
Returns:
list | class FunctionContainerBase(StorableObject):
def GetArgs(self) -> Tuple[Any, ...]:
return tuple([c.GetValue() for c in self.GetArgumentContainerList()]) | 0 |
5f246d4fd598853cbf10efc1cfb06171 | 514e9507a22e1564cc449486090c3903 | 完成对逆波兰式的运算 | {
int i, type, var = 0;
double result;
double op1, op2, v = 0.0;
char s[MAXOP];
double variable[26];
printf("输入逆波兰式计算 eg: 3 5 + 4 *\n");
for (i = 0; i < 26; i++)
variable[i] = 0.0;
while ((type = getop(s)) != EOF)
{
switch (type)
{
case NUMBER:
... | 1 |
26c307e71b37abb5463bd833da3cacbb | fc3e11e9243c94635a215774ba8a7f41 | bgm结束后循环播放 | function play_bgm(state)
if bgm and bgm:isPlaying() and bgm_table[state] == bgm then
return
end
if bgm then
bgm:stop()
end
bgm = bgm_table[state]
bgm:setVolume(options.music_volume)
bgm:play()
end | 0 |
0a96335a21042869e768ee52d92c2b9b | 2868c0aad236cc502976a6616ec80a73 | Returns True if the card is the last in the column - False otherwise | first_rank = current_deck[0][1:]
for card in current_deck[1:3]:
if card[1:] != first_rank:
return 0
return 1 | 0 |
0c8fd1279ee8b8d52bed96136fd7d5fd | 480914ce62dd1f3010f6da83e19bd8c9 | inserts meeting into Google Calendar at specified time | public class MeetingChecker
public void insertMeetQuery( String type, String confirmed, ArrayList<String> list)
{
TreeMap<String,String> freeTime = findmeetings.getFreeTime(list, startDate);
if( freeTime == null )
{
System.out.print("THE FIND MEETINGS TREE WAS NULL");
... | 0 |
30acab1984061b4bea7b2197833db777 | 2f3e8ffb0d49be526f5049d327240675 | Returns the HTML markup for the progress bar. | {
TagBuilder percentCompleteBar = new TagBuilder("div");
if (percentComplete == null)
{
return percentCompleteBar.ToString(TagRenderMode.Normal);
}
int taskPercentComplete = percentComplete.Value;
string completedTask = string.Empty;
if (taskPercentComplete >= 100 || isComplete)
{
task... | 1 |
d3df5c5048dea1c069b696d6f84fa4da | a351f2d47f36e28e3ef357ad467c5359 | Get the path of the original favicon copy. | String getFaviconPath(); | 1 |
3a29e2813160710bf6b5192a0bf4cd05 | c2cd03ef3cdd767144d931a893b5c594 | Special function for transforming the last block or partial block in the stream. The
return value is an array containing the remaining transformed bytes.
We return a new array here because the amount of information we send back at the end could
be larger than a single block once padding is accounted for. | namespace Org.BouncyCastle.Crypto
int DoFinal(byte[] output, int outOff); | 0 |
2969a73ff52cf6b5c4ccecdfe0dca5f1 | f8dca1346c4a01edab64154986e90085 | Добавление подчеркнутного текста | class StringUtils
public static addUnderLine(content: string): string {
return `<u>${content}</u>`;
} | 1 |
d78bc9866a3539612e135649eba1b2a3 | be06a947e4a455d6bc408dde8453f280 | Adds a new int32 parameter to the command's parameters list. | void param_add_int(int ival, param_t *param)
{
param->val[param->num].i = ival;
param_add(param);
} | 1 |
a073c731dfc4853ba4f73e313f788cbb | 4861b2b676f7404522bc506e595f1196 | Найм одного сотрудника. | namespace Sungero.BulkExchangeSolution.Server
public class ModuleFunctions
[Remote]
public IEmployee GetEmployeeByJobTitle(IDepartment department, string jobTitle)
{
return Employees.GetAll(e => e.Department == department).Where(e => Equals(e.JobTitle.Name, jobTitle)).FirstOrDefault();
} | 0 |
cebd05b85e572b27f91690fbfff25427 | 022fb794962494384b8236e950280899 | Return self to allow usage like:
with nengo_spinnaker.Simulator(model) as sim:
sim.run(1.0) | class Solver(object):
def __enter__(self):
return self | 1 |
b4ee46ebcfe88c449ddaef6c5b9cfc51 | 661a611f97ebc55c4d75a77ec9688179 | Find the top coefficients (or leaves) of the dyadic tree | if root._Symbol == "*":
left = is_leaf(root._Left)
right = is_leaf(root._Right)
if left and str(root._Left._NType) == str(NT.Literal):
coefs.append(root._Left)
elif right and str(root._Right._NType) == str(NT.Literal):
coefs.append(root._Right)
... | 1 |
b6dabd18e17ce81b8f19f4327ca27be9 | 215b06d7eecf49131f9a6c83b0fb86bb | Checks the SA(Security Association) formation in SSX for a particular tunnel ip | int ipsec_tunnel_group_spis (struct sa *sa, struct proto *proto1,
struct proto *proto2, int incoming) { return 0; } | 0 |
4699c3d105b9633c05cddbd889b5aa2f | 864a4fb14f98ccb7c871e6298e2977f6 | 删除所有数组中的重复元素,仅仅保留一个
方法七:借助List集合 | int[] arr = {1, 4, 4, 3, 2, 5, 5, 6, 6};
List<Integer> list = new ArrayList<>();
for(int i = 0; i < arr.length; i++) {
for(int j = i + 1; j < arr.length; j++) {
if(arr[i] == arr[j]) {
j = ++i;
}
}
list.add(ar... | 1 |
521a29643c2fedc61c372e4cd4576e16 | 4346fcf7ed191d26b3b80cc1406ccee8 | 获取猫和狗图片地址 | def get_photo_list(lst, pets_url):
html = get_html_text(pets_url)
soup = BeautifulSoup(html, 'html.parser')
imgs = soup.find_all('img', attrs={'class': 'photo-item__img'})
for img in imgs:
lst.append(img.attrs['src']) | 1 |
936818be33b665b442c7c4a03e386700 | 3b634067a87bc399a3e0e6ea980ec1df | 获取胴体总重 | public class LoadTaskSerialNoDto extends LoadSerialNoEntity
public double getLoadWeightTotal() {
return loadWeightTotal;
} | 1 |
8b17b9bb7a3e9f9641b3611d05414cb0 | cb5583345386f89910628734215180e6 | Reports whether or not this term is a constant (a number of a functor of arity zero). | public class Term implements RegStr
private boolean isConstant() {
return this.funcList[POW].equals(new PowFunc(BigInteger.ZERO)) &&
this.funcList[SIN].equals(new SinFunc(BigInteger.ZERO)) &&
this.funcList[COS].equals(new CosFunc(BigInteger.ZERO));
} | 1 |
0fb963874890de25807d3c53c9184103 | 9c81142e97bb20f7edab5ef623a3b56a | Populates the catListBox with all of the categories from the DB | {
CategoryList.Clear();
foreach (var cat in obj.DatabaseModel.Categories.Select(x => x.Name))
{
CategoryList.Add(cat);
}
} | 1 |
40dbf5d0910690aae62fe6ea2d9be7fd | f754213b04a6b886ef680fd4a4d3a2ba | Creates an HTML {@code INPUT} element with the given id and initial value.
The element as marked as initially disabled. | public HtmlButton createButton(HtmlView view, String id); | 0 |
7471febc6c1bd997304a9dda3b19d048 | 759f755141cba888d33b591faf1ec213 | returns whether or not the given ring is within the boundaries of the detector | {
double const Rcut = 445.0 / 2.0;
double const Xcut = 430.0 / 2.0;
double r = sqrt( z*z + y*y );
if ( r > Rcut ) return false;
if (fabs(x) > Xcut ) return false;
return true;
} | 1 |
80d7059b095127c3416d81cddbb9eeae | 3cb599b347543d0e2d9bf8a55ad118f7 | Creates Nondeterministic Finite Automata from a Regular Expression | public class Regular
void ProcessREToNFA()
{
Stack<String> st = new Stack<String>();
Stack<NFA> sNFA = new Stack<NFA>();
NFA nfa = new NFA();
NFA temp = new NFA();
NFA result=new NFA();
for(int i=0;i<str_regular.length();i++)
{
if(str_regular.charAt(i)=='(')
{
... | 1 |
5a0cdafa1df786f776e4939b9e4e4781 | fa7b5fde202e1865f1f74d8332371712 | Test that parse() returns an array of data from the file. | $this->assertEquals('[internal]', $this->object->parseFile(null));
$this->assertEquals('[vendors]', $this->object->parseFile(VENDORS));
$this->assertEquals('[titon]', $this->object->parseFile(TITON));
$this->assertEquals('[titon]core/Debugger.php', $this->object->parseFile(TITON . 'core/Debugger.php'));
$this... | 0 |
7a6c21c49e6647e3cab4004c20a6bb54 | 35e07698b542acc2302608ef2c06714a | 3 斐波那契数列第n项的值(递归) | if n == 1: return 1
if n == 2: return 2
if n == 3: return 3
if n > 3:
list = n * [1]
list[1] = 2
list[2] = 3
for i in range(3, n):
list[i] = (list[i - 1] + list[i - 2])
print(list[n - 1]) | 0 |
d876f093420af47fc4b6160590a1bfdd | d887ac1d0305a76182e2d4fab56c950d | Basically just checks if home icon is being looked at to "click" on it | class Homescreen():
def check_btn_click(self, mouse):
return self.btn_location_x-140 <= mouse[0] <= self.btn_location_x and self.btn_location_y-40 <= mouse[1] <= self.btn_location_y | 1 |
ea95b64465f1ab7262cdde76ed84da79 | fdf2bae5f9fd82722416e0260f6a6af6 | 生成字母数字随机字符串 | {
$nums = '0123456789';
$ltrs = 'abcdefghijklmnopqrstuvwxyz';
$chars = null;
switch ($type) {
case 0:
$chars = $nums . $ltrs;
break;
case 1:
$chars = $nums;
break;
case 2:
... | 1 |
0708c9b6e1f67b968c51dd7d8a9560b5 | 7e478e5706eb3866192b476c0d18e0b1 | Get an MSAL.NET Token cache from the HttpContext, and possibly the AuthenticationProperties and Cookies sign-in scheme | {
if (context is null)
{
throw new ArgumentNullException(nameof(context));
}
if (context.IdentityTokenPrincipal is null)
{
throw new InvalidOperationException(SR.GetResourceString(SR.ID0022));
}
i... | 0 |
6ec4f9828cac94fd8834ac9289fc69be | 985e6a93e5413a4fb5f0ff439f9d3504 | удаление всех классов из списка элементов | function cleanClass(list, styleClass) {
list.forEach(cv => cv.classList.remove(styleClass));
} | 0 |
0a22177bacd5b9c9990ddfad69c5cdf8 | 504256ee27c243d2dcdd576359f8458a | Test Runner
this method contains the algorithms that bascially runs through all of
the tests indivudually and returns you a state that shows which one
of those tests passed (True) and which one of those failed (False)
with their test names written in a key-value pairing | class Harness():
def run_tests(self):
for test in self.test_suite:
try:
if (test.run_test() == ('T', 'T')):
self.true_positives += 1
elif (test.run_test() == ('F', 'F')):
self.true_negatives += 1
elif (test.run... | 0 |
12ba97e5ee1ef863e7241935c13b0d40 | 5f95fb60ff68692a136e2b48b01b6fd3 | Legt die Farbe fest, mit der Linien und Raender um Formen gezeichnet werden.
Diese Farbe wird hexadezimal in Form der RGB angegeben: z.B. "CCFFAA" oder "004E23". Die Syntax verwendet sechs Ziffern - je zwei fuer die roten, gruenen und blauen Komponenten,
um eine Farbe anzugeben (genau wie Farben typischerweise in HTML... | public class DefaultMarkerRenderer extends AbstractMarkerRenderer
public void setColor(String color) {
this.color = color;
} | 1 |
574a29a8f16ec35f907731219f48411e | 3baeb89ab33d41fb9aec16d0816fede8 | Set cursor position (internal - not syscall) | {
if ( ! curs ) return;
curs->sv_curscol = ccol;
curs->sv_cursline = clin;
} | 1 |
2c00f86a3c83fd114c638bc677ca50dd | ba6f04c4de1f88382c4fbb361c4c54b7 | Returns an open-data measurement.
Returns a measurement by open-data UUID with either all or a custom selection of measurement types. | query_url = kwargs.pop("query_url", None)
if query_url:
response = self.session.get(query_url, headers=self._json_header)
else:
search_params = {}
_set_if_value_valid(
search_params, MEAS_TYPE_NAME_REGEX, kwargs.pop("type_name_regex", None)
... | 0 |
7711d14a38e2d6de5debbcc56b0871d9 | f1e0bf3c46e060f1a75eb48d716a9a94 | 在窗口大小更改(例如,设备方向更改)时更新应用程序状态 | namespace KinectEvolution
public sealed partial class MainPage : Page
private void MainPage_SizeChanged(object sender, SizeChangedEventArgs e)
{
this.SetViewState();
} | 1 |
fa0f90c82df35d8b35b7f71f6dcbd1ee | 4b59a3fa96e29894a2b032d4843d77a4 | Returns a list of name columns that are to be excluded from
rendering because they belong to attached tables. | def added_columns
attribute_names_plus.reject{|name| column_names.include?(name)}
rescue ActiveRecord::StatementInvalid
attribute_names_plus
end | 0 |
0d1f32fee36eab9015bb3f0fd56dd778 | a8d66ed3d4045f0d814dd92e60bf3764 | Decide if a page is edited with a page builder or not. | class MinervaKB_Info
public function is_builder_home() {
if (isset($this->is_builder_home)) {
return $this->is_builder_home;
}
$this->is_builder_home = get_post_type() === 'page' && MKB_PageOptions::is_builder_page();
return $this->is_builder_home;
} | 1 |
c1c39acb3491741684c4129b196921d2 | 6b9659f535c78d11d8f880720d53a874 | initialize network View and set type of synchronization | class MainActivity : AppCompatActivity()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
setTVContentViewValue(NetworkManager.INSTANCE.getConnectionState())
setTVNetTypeValue(NetworkManager.INSTANCE.getNetwork... | 0 |
d6bc006486652dc904a012269664b8af | f212e7ac9b587aed241d5ef243b1fba5 | Save session statistics. | class statistic
private function saveSessionStat(UmiCms\System\Session\iSession $session, $stat) {
$session->set('stat', $stat);
} | 1 |
f043d7e1174d48c684939ccb98de4b31 | 91ca0716753f704953317c1a2dda56c1 | Returns the sum of two tensors. | class TensorBase(object):
def __add__(self, tensor):
if self.encrypted:
return NotImplemented
tensor = _ensure_tensorbase(tensor)
return TensorBase(self.data + tensor.data) | 1 |
30e2787d3aec5a4529f6d29d31f57e6b | 99d33ce15dbd66f0c4554ca965dd5cfd | Create robot connection by Telnet | self.connection = telnet.Telnet(ip, port, USER, PW)
self.route = []
self.loss = [] | 1 |
ec5838533c36e088ee3d2a4f8c98cfe8 | 72ed08eee6a89405d301b1bb36c84b04 | 格式化参数,如果是form-data格式则将参数封装到MultipartEntity否则封装到StringEntity | if (null == request) {
return this;
}
if (request instanceof HttpHeader) {
HttpHeader entity = (HttpHeader) request;
if (null != entity.getHeaders()) {
if (LOG.isDebugEnabled()) {
LOG.debug("header : " + JSON.toJSONString(en... | 0 |
470c8ff04e1ed7c94eb44ed8a99afc0c | a2f657213a8974ec4701eb3c403af3b0 | Number of segments that the side is divided on | public int getSegmentCount(); | 1 |
b6c32de04b100741357b6638ec5b5e18 | 0e88901e53b4a19d4a911d4b9a29c266 | 根据标签获取居民 | class depositorModel extends model
public function getList($tag = '', $orderBy = 'id_desc', $pager = null)
{
return $this->dao->select('*')->from(TABLE_DEPOSITOR)
->beginIF($tag)->where('tags')->like("%{$tag}%")->fi()
->orderBy($orderBy)
->page($pager)
->fetch... | 1 |
3b00c731d5fff0389671d0de2e976528 | 7c378bc1b096f3b32e0e8f413fcf30c2 | スライド窓による部分時系列データの作成 | global idx, idy, lbd, z_raw
SQUARE_SIDE_LENGTH = 10
idx = slide_idx.get()
idy = slide_idy.get()
slide.flag = getattr(slide, "flag", True)
if slide.flag:
slide.flag = False
square = create_square(
WIDTH * idx / (len(da.x) - 1),
... | 0 |
759fb95e498ff9aa576b5ea1bdfd9d16 | da2240a8453b98605d341d9afe67d9d4 | produce a more friendly version of 'dump_chars_buf' output string; convert non-human-readable characters to '.' | def _stringDumpChar(c):
if _isprint(c):
return c
else:
return "[0x%02X]" % ord(c) | 0 |
37e109f4606a553bdd4a2b8adb9891c7 | cc456a0331d1266c0209e9aca2d01bc6 | delete all selected widgets | {
QList<QTreeWidgetItem*> items = treeWidget->selectedItems();
for (int i = 0; i < items.size(); ++i) {
removeItem(items[i]);
}
} | 1 |
30a25a0db0be880fa9ce878eb679cdca | 5c3c738eb98c60ce80e7fee228d9b2ce | Gets the value of the tempMin property.
possible object is
{@link Double } | abstract class BasePoplf extends BaseObject implements Persistent
public function setTempmin($v)
{
if ($v !== null && is_numeric($v)) {
$v = (double) $v;
}
if ($this->tempmin !== $v) {
$this->tempmin = $v;
$this->modifiedColumns[] = PoplfPeer::TEMPMIN;
... | 0 |
886b95846d15e0cbf51427641afd6553 | 9432914fb9bdfb13f5c21a09c41235a5 | Gets query for [[IdCliente0]]. | class User extends \yii\db\ActiveRecord implements \yii\web\IdentityInterface
public function getIdAgente0()
{
return $this->hasOne(Agente::className(), ['idAgente' => 'idAgente']);
} | 0 |
b58900161de63bcc9da5dc75639749fc | eb1e2cec51dfe3c68ad31d7963d2e3da | Retrieves a collection containing all sensors associated with the specified type. | namespace ION.Core.Devices
List<GaugeDeviceSensor> GetAllGaugeDeviceSensorsOfType(ESensorType sensorType); | 1 |
6f17f7e271685e1da4ecb018ef954c8c | 949faaa24cee7222ba468cd93a0b8aa4 | If Open is given a negative initial deposit, it must return nil. | class Billcoin_Tests
def test_update_negative_check_no_negs
the_Billcoin = Billcoin.new()
the_Billcoin.account_deposit("sam", 5)
assert_nil the_Billcoin.update_negative_check "sam"
end | 0 |
8fe55418b54c525126623ec37981efbe | 550a94ca76e004345ef4b730b7a5903c | send an alert email if one hasn't been sent recently | if self.delay == 0 or force or len(self.records) >= self.max_records:
self._sendmail()
elif len(self.records) > 1:
times = list(self.records.keys())[-2:]
if (times[0] - times[1]) >= self.delay:
self._sendmail() | 1 |
15e3b57ed34fa55fccee5e9cd75f2482 | 5e5cb472495fc0435e0c94866b5d74ff | Computes the bit length set for a structure type given the bit length sets of each of its fields.
As far as bit length sets are concerned, structures are similar to fixed-length arrays. The difference
here is that the length value sets are not homogeneous across fields, as they can be of different types. | class problemBinaryDeploymentShuffle(problem):
def calc_bit_length(self):
for i in range(0, len(self.dimensions_bits_list)):
self.dimension_bits += self.dimensions_bits_list[i] | 1 |
4b896147f26879ffc36f11dd6252b35b | 9d9a6448f828b387a03300307509d5c2 | Тесты для функции my_strcspn. Возвращает количество неудачных тестов | bool testMystrncat() {
bool ok1 = false;
bool ok2 = false;
bool ok3 = false;
bool ok4 = false;
bool ok5 = false;
bool ok6 = false;
bool ok7 = false;
bool ok8 = false;
char s1a[] = "012345678901234567890123456789";
char s2a[] = "ABCDEF";
char* s3a = strcpy(s1a, s2a);
char* s4a = strncat(s1a, s2a, 6);
pri... | 0 |
0e997e97121ce70287ec2be53feb2317 | 63d173e5e0b3527f634545b2b30e621d | Shows buffer in editor area starting at a given
number of line of buffer.
It's recommended to hide cursor before calling this function | self._error_bar.clear_state()
self._error_bar.set_total_buffer_lines(
self._buffer.getLineCount() + n_lines)
buffer_line_number = start_line + 1
new_errors = {}
for key in self._errors:
if key > buffer_line_number:
new_errors[key + n_lines] = self._errors[key]
else:
new_errors[key] = self._er... | 0 |
7c350d1a6a9b5f499984444429e05f45 | af2f06195bd4202223c43f316f8465a6 | mutates the codig by flipping some bits. | {
for(int i=0; i<n; i++)
{
if(rand()<RAND_MAX*Pb)
{
Code->flipBit(i);
}
}
} | 1 |
12a6eb78f7b3d5b8391862e88cbc6905 | 295fff9efefc6f31f2992ddd7c960ff3 | 以PushEach方式更新 | this MongoCollection<TDocument> mc,
Expression<Func<TDocument, bool>> whereExpression,
UpdateFlags flags,
WriteConcern writeConcern,
Expression<Func<TDocument, IEnumerable<TValue>>> memberExpression, Action<PushEachOptionsBuilder<TValue>> options, IEnumerable<TValue> values
)
... | 1 |
18e1dd51b7145673e0ef592d7f6489cb | f2f7f05d6785621478435ec847c764fc | 获取收藏歌手列表 | function getCollectArtist(params:object) {
return request({
url: '/artist/sublist',
method: 'get',
params
})
} | 1 |
1c7f809a9c58f15892cbb12624032273 | 8b74dcded3cf4b99b24d69afcde91182 | Sets the local Meta Info equal to a received Meta Info | public class SoapResponseParser implements ResponseParser{
public void setResponseMetaInfo(HashMap<String,String> mResponseMetaInfo) {
this.mResponseMetaInfo = mResponseMetaInfo;
} | 1 |
f408c3c9a780d0f1afc67b93bcce2fa7 | 1267a6095afe15da8d5723df6697cac6 | 根据地址显示当前路径下的所有文件(显示在右边的listview中) | names = ArrayList()
paths = ArrayList()
val file = File(path)
var files: Array<File>? = null
try {
files = file.listFiles()
} catch (e: Exception) {
e.printStackTrace()
ToastHelper.showToast(this, "获取文件列表失败")
}
if (files... | 1 |
4e755fc8b3ab4ea84e0addb790845dac | dd5a9c528643e254af6f4f2605fac5e0 | Evaluation function for evaluating all the existing checkpoints.
This function just runs through all the existing checkpoints.
Raises:
ValueError: if model.checkpoint_dir doesn't have at least one
element. | files = [f for f in listdir(self.model.checkpoint_dir) if path.isfile(path.join(self.model.checkpoint_dir, f))]
all_checkpoints = [re.findall(r'ckpt-\d+', f) for f in files if 'ckpt' in f]
all_checkpoints = [path.join(self.model.checkpoint_dir, c[0]) for c in all_checkpoints if len(c) > 0]
... | 0 |
fbf92f87c55d9241c70d898026ccc343 | 601f4ca369db5ee1c7ac5c43ad7ec9ae | dataにノイズを付与。※ 元データを変更する | def get_noise(data, rate=0.1, seed=66):
random.seed(seed)
data_temp = data.copy()
index = list(range(data.shape[0]))
data.index = index
random.shuffle(index)
n = int(rate * data.shape[0])
sub_index = index[:n]
data_temp.loc[sub_index, [0, 1, 2]] = 'a'
return data_temp | 1 |
3db80488a8f986d2098b8fabae7a2cd5 | 3955d28f6d408414937fdc33f1f9b8fd | 初始化描述的三段文字的动画 | public class ExpectedPositionActivity extends AppCompatActivity
private void initAnimation() {
ObjectAnimator alphaInAnimator, alphaOutAnimator, transInAnimator, transOutAnimator;
int width = DensityUtils.dp2px(this, 80);
alphaInAnimator = ObjectAnimator.ofFloat(viewBac, "alpha", 0.3f, 0f);
... | 1 |
638ab633f57af69f7225e7bd357e35c1 | eb53a3594a458ca0278af89346931ece | 下载所有需要更新的文件(根椐updatelist)并显示百分比 | {
string LocalAdd = "";
int i = 0;
foreach (string URL in szFileList)
{
string name = URL.Replace(strServerAddress, "");
if (forPublic)
{
if (name == "UpdateProgram_Public.exe")
... | 1 |
ab984c4bc575dd7e5d07bf06d2459013 | 8937abd359ee48215f7e98995dc1568a | Returns the address the server will claim to be listening on in the PASV reply. Useful when
the server is behind a NAT firewall and the client sees a different address than the server
is using. | public abstract class HttpServer<IN, OUT>
extends ReactivePeer<IN, OUT, HttpChannel<IN, OUT>>
public abstract InetSocketAddress getListenAddress(); | 1 |
b1f46c2fc666c62ced8948ff2d15499d | de94995b6180d0829cb51f379cb8ed42 | Empties supplied buffer into the sink descriptor | public class Buffer : Source, Sink
override fun flush(): Unit = Unit | 0 |
ddd69d41a24cd34d35189e03e168fb57 | ed7c0949ec490ddaa53515ca0744650e | Validate the filetype of the model. | class FileValidationBehavior extends ModelBehavior
public function mimeType(Model $model, $data, $mimeType) {
return $this->_validate($model, $data, 'mimeType', array($mimeType));
} | 1 |
a04db3af7bb5fe07b280b61dc7a8ca83 | f4d9e8918675f146810febcd9ecd107f | First tick of the day. | void DynaObject::do_day()
{
} | 0 |
31f8bb0386279746d0084888d8ca1b6a | 33e2c5dd50de7273356cfd90d32bace1 | Проверка на количество открытых приватов за день. | {
if (order == 0) {
return 0;
}
int free = 0;
for (int i = 0; i < day; i++) {
if (GR.Check_private(day, direction, type_wagon, wagon, i + 1, type_place) == 1) {
free++;
}
}
if (free >= count) {
return 1;
}
else {
return 0;
}
} | 1 |
4741e022258b9770d3c3bd4d00e0f9a1 | 83c062fc27153e04a5b8928364709809 | 判断楼梯显示隐藏 | function elevatorBoxState(b, c){
var _op = b.options;
if ("auto" == _op.threshold){
c ? b.elevatorBox.show() : b.elevatorBox.hide();
}else if (null != _op.threshold) {
var _scrollTop = $("body").scrollTop() || $("html").scrollTop();
var _threshold = _op.... | 1 |
68ae0ae5373655c0af698333f7fa390e | d9c959e04a7b5407bd5f4294c8965715 | 流排序测试方法 | {
int [] a = {1,2,3,4,5,6,7};
int [] b ={7,6,5,4,3,2,1};
int [] c ={3,5,2,4,1,7,6};
int [] d ={3,3,3,3,3,3,3};
testbubbleSort(a);
testbubbleSort(b);
testbubbleSort(c);
testbubbleSort(d);
} | 0 |
94e53fa18319868efe278c14ae8de666 | 34720e4a51fa563980e5907880858605 | Tests the full circuit cutting pipeline returns the correct value and
gradient for a simple circuit using the `cut_circuit` transform with the TF interface. | tf = pytest.importorskip("tensorflow")
batch_size = 2
prog = Program(1)
eng = Engine(backend="tf", backend_options={"cutoff_dim": 3, "batch_size": batch_size})
theta = prog.params("theta")
_theta = tf.Variable([0.1] * batch_size)
with prog.context as q:
gate(theta) | q[0]
eng.run... | 0 |
743373ff0f51dbf10ed993ac01a7e5c6 | dacc8769206b12bdcbaefba0fdfffbc3 | Get the current view dimensions | view(): ViewInterface {
let w = window;
let d = document && document.documentElement;
let b = document && document.getElementsByTagName("body")[0];
let x = w.innerWidth || d.clientWidth || b.clientWidth;
let y = w.innerHeight || d.clientHeight || b.clientHeight;
return {w... | 1 |
d18a604680eb08bd21903bf28976504c | 7d33611ce47b4168c7ee5f785e24355e | 计算ppt学习进度 | async def progress_calculat(content, user_defined):
if not content.isdigit():
return "已获得积分参数错误,应为正整数"
point = int(content)
echo = "计算完成\n"
info = activites(point, user_defined)
if not info[0]:
return "暂时没有开启的活动哦"
name, schedule, progress, barlist, booeolean, gaptime = info[1]
... | 0 |
35b2e7dca40aa77e4684e93ba08469d4 | ccffe83143f8f622acd1356d718c7a15 | Função gira 180° | void rotate_180()
{
switch (direction)
{
case ('n'):
swap_direction('s');
break;
case ('s'):
swap_direction('n');
break;
case ('e'):
swap_direction('w');
break;
case ('w'):
swap_direction('e');
break;
}
} | 1 |
624866d651f861b16b308c83cdf305cb | 23916c411f4503f32bd0a75aa4751b5f | Handles the 'tick' event of the executionTimer. | {
int tickCount = 0;
if (ViewState["TickCount"] != null)
{
tickCount = (int)ViewState["TickCount"];
}
tickCount++;
ViewState["TickCount"] = tickCount;
if (tickCount >= 10)
{
Timer1.Ena... | 1 |
8b91cf32349766e858ce6bc13cb2db62 | 448256d93f8065bb01120c0a96601d5b | Gets the <a href='http://www.isi.edu/in-notes/rfc2342.txt' rel='tag'>RFC
2342</a> other users namespace for the current session.<br>
Note that though servers may offer multiple other users namespaces,
support is not offered through this API. This decision may be revised if
reasonable use cases emerge. | public abstract XmppURI getCurrentUser(); | 0 |
bf6277781e2505e08b5c3d87ea29ebbe | 987e856cd0417c5ee74a7e048f4588e7 | Called when receiving input events from controller, sets player vars accordingly | {
velocity = Vector2.Zero;
if (ignoreInput)
return;
Keys[] keys = new Keys[6];
switch (inputKeys)
{
case InputKeys.WASD:
keys[0] = Keys.A;
keys[1] = Keys.D;
key... | 1 |
b60254b3c508e9e5bc4cd96ca06b9949 | e86ded532000e4a0df1149168db27d36 | This method overrides existing filterQueries without warning or error.
<p>
If multiple filters are to be used, consider collapsing them into one:
{@code ["foo", "bar"]} → {@code ["(foo) AND (bar)"]}.
<p> | public class CmsSolrQuery extends SolrQuery
public void addFilterQuery(String fieldName, List<String> vals, boolean all, boolean useQuotes) {
if (getFilterQueries() != null) {
for (String fq : getFilterQueries()) {
if (fq.startsWith(fieldName + ":")) {
removeFilte... | 1 |
1d85fc2f13885bb12778fe5248192c7b | 52b2b0c3f86a11a54cf2f420a9339567 | Tests unit handling with strings, which should be dimensionless | rint = random.randint(1, 100)
self.assertEqual(str(Unit(rint, metre)), '{} m'.format(rint))
self.assertEqual(str(Unit(rint, second)), '{} s'.format(rint))
self.assertEqual(str(Unit(rint, kilogram)), '{} kg'.format(rint))
self.assertEqual(str(Unit(rint, kelvin)), '{} K'.format(rin... | 0 |
6a8dc92b402afb771d9d85978c31a67a | ebf543505e786434410beecd54e4ad1b | Проверяет, является ли город Москвой | class CityHelper
public static function isMoskowRegionCity($city)
{
return in_array($city, EnvironmentHelper::getParam('citiesMoskow'));
} | 0 |
c806ec1007e040375fe79a7a95a8eff6 | 28027cc49b1a13b049f6de34c334ef6f | Parse dcov log basic block table from filestream. | format = '< ' + ' '.join(x[1] for x in map)
calcsize = struct.calcsize(format)
binary = file.read(calcsize)
content = unpack_from(format, binary)
out = dict(itertools.chain(
*(readBlockDec(key, value)
for key, value in itertools.izip(
(x[0] for x in map if not ... | 1 |
b40c04fc0cc9c65f29e0342607d064a5 | 694e134e576b2124f1127dfafc5fa9e8 | 根据分页对象、所属部门ID号,分页查询用户列表 | namespace RDIFramework.WebApp.Modules.handler
public class UserAdminHandler : IHttpHandler, IRequiresSessionState
private void GetUserPageDTByDepartmentId(HttpContext context)
{
var organizeId = PublicMethod.GetString(WebCommon.StringHelper.GetRequestObject("organizeId"));
var where ... | 1 |
5b5ac315c5b871be1a5974dff2aef439 | 7ac94519a4358b388b981bc00a4ae107 | funcion para cargar Totales Detalle de Factura | $usuario = $_SESSION['user']->USER_LOGIN;
$data=array();
$this->query = "SELECT A.CDFOLIO as folio, A.CVE_CLIENTE as cliente, B.NOMBRE, B.RFC, A.IDPEDIDO, A.INSTATUS as estatus, EXTRACT(DAY FROM A.DTFECREG) || '/' || EXTRACT(MONTH FROM A.DTFECREG) || '/' || EXTRACT(YEAR FROM A.DTFECREG) AS FECHA... | 1 |
83b4196886903de60675d80486051af4 | 965f5449e5fe269b58ff80785557d34e | Register the channels with the selector, and specify what
conditions we'd like the Selector to wake up for. | public class ClientNetEventHandler extends AbstractNetEventHandler
@Override
protected void wakeUpSelector(ChannelAgent agent) {
} | 0 |
c53ce45ab89df00ec04da4dd28f0a6d5 | 9cc87483c6293ed5d2b9e2b34b133755 | 创建服务端的证书 | BouncyCastleProvider bouncyCastleProvider = new BouncyCastleProvider();
Security.addProvider(bouncyCastleProvider);
String fileName = "root" + new Date().getTime() / 1000;
String path = "./";
String rootCertPath = path + fileName + ".cer";
try {
KeyPair kp = n... | 1 |
836e3970a246135048ac7200a663a049 | fcb3d3739d64eeeab585f4672eaae238 | Generates base Highcharts graph option structure | export class ChartConfiguration
public generateHighChartConfig() {
try {
let chartConfig: any = { ...this.getBaseConfig() };
switch (this.type) {
case 'bar': {
chartConfig.series = this.generateSeries(this.type);
chartConfig.xAxis =... | 1 |
3bc8c9fe2daf33df55d9a673c05a089a | 274053857dd432c9dd479cfd652e77bf | Test that MediaFileManager removes session maps when requested (even if empty). | with app.app_context():
nmaps = len(Map.query.all())
with app.app_context():
map1 = Map.query.filter_by(map_id=1012).first()
sa.session.delete(map1)
sa.session.commit()
with app.app_context():
assert (nmaps - 1) == len(Map.query.all())
map1 = Map.query.filter_... | 0 |
b987e2108bc754916e1c28626c514284 | 9c62a00f72a3360304ac8e69fbb6060a | Change the hilite of the user that's currently selected | function selectUser(li) {
li.toggleClass("choiced");
} | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.