query_id string | corpus_id string | query string | code string | label int64 |
|---|---|---|---|---|
a78c75d558eba52fe03cd41ce7d5ea9e | ad5c1f30afe7cd6bca9aaf70803fae31 | Attack a network by Project Gradient Descent. The attacker performs
k steps of gradient descent of step size a, while always staying
within the range of epsilon (under l infinity norm) from the input image. | class FastGradientSignMethodAttack(GradientMethodAttack):
def __init__(self, model, norm='Linf', epsilon_ball=8/255, epsilon_stepsize=2/255):
super(FastGradientSignMethodAttack, self).__init__(model,
norm=norm,
... | 0 |
4cb6a09d1d6a597c2c2524ea409e2ea3 | 0460361a7ce83eee9fa0d640b598ebbd | Creates canvas with background image and border
and set up it into $this->image property | {
$this->img = imagecreate($this->width, $this->height);
$this->_backgroundColor['r'] = rand(220, 255);
$this->_backgroundColor['g'] = rand(220, 255);
$this->_backgroundColor['b'] = rand(220, 255);
$colorallocate = imagecolorallocate(
$this->img,
$this... | 0 |
85b9e72a70dd0655ca0c73aa7f0c434b | 7a678e5b29589350555e23f2608167f7 | Constructor de la clase Interfaz. | class Interfaz
constructor() {
this.init();
this.listado = document.getElementById('resultado-eventos');
} | 1 |
cf29180a97dbfed661251e5f0832b451 | b8ff01f41d49dc43a767d97164941196 | 获取单篇文章的法条 | {
int channelID = 13;
BLL.article BLL_article = new BLL.article();
DataTable dt = null;
if ("0".Equals(category_id))
{
dt = BLL_article.GetList(0, "channel_id=" + channelID, "sort_id asc,id desc",true).Tables[0];
}
... | 0 |
97f1f6a56c21d3dfc2ff69f286f8eebb | 491b5d84f1684aefb1ed88329b09324d | Edit each new customer with the runner to be assigned.
<p>
Requires an accompanying list of customer descriptors describing these new customers and reflecting the assigned
runner. | void setRunners(RunnersDescriptor runners); | 0 |
d41bb5cebba9f2993ba020a549f94d62 | a14c001c391fa7b459fbabfc3a7fdee7 | (non-Javadoc)
通过主键查找系统参数 | public Systemparam querySystemparam(Map<String,Object> map); | 1 |
e9d0e3ef2016311e07e446942dbcbad7 | f0abff0e86f8dbd4ed33041d485c13b7 | Returns a list of types for data objects that can be instantiated by the new operator
These should preferably be in sorted order (by type String), however...
!!!!**** NOTE ****!!! In cases where one type is the prefix of another type (like Motif and Motif Collection)
the data type with the longer name must be listed be... | public class Operation_new extends Operation
public static String[] getAvailableTypes() {
return new String[]{RegionDataset.getType(),DNASequenceDataset.getType(),NumericDataset.getType(), SequenceCollection.getType(), SequencePartition.getType(), SequenceTextMap.getType(), SequenceNumericMap.getType(), Sequenc... | 1 |
4b9e728f8c216c4c131f421c3feb5901 | e215a96125eadef6f22ea93fe9a7fb05 | 根据课程名查询课程编号 | namespace stuScoreManager.BLL
class ClassBLL
public DataSet getclassno(string cname)
{
ClassDal cDal = new ClassDal();
return cDal.ccno(cname);
} | 1 |
0df25645392e8f69e9d26f6e48152256 | 56fdaad2da7c4ee13f27d675f83569a2 | Measuring the algorithm process time in milliseconds. | public class PathFindingOnSquaredGrid
public static String measureTime(long past) {
return Long.toString(System.nanoTime() - past);
} | 0 |
00a73c8683f7cd7b9ca508fcf184aa74 | 818e5e7d9a9fe56dd64834d7ea10298a | get info of all running replications - serves back to consumers who call the REST end point, i.e. UI | v1 = client.AppsV1Api(self.apiClient)
data = v1.list_replica_set_for_all_namespaces(watch=False, label_selector="app.kubernetes.io/managed-by")
dataHolder = []
for d in data.items:
name = d.metadata.name
image = d.spec.template.spec.containers[0].image
replicas = d.spec.replicas
... | 1 |
beb8d9338b0576cb4634063bd112b264 | c8ff384c1b27bd73939e8616356f792d | !
Returns the arrow size value. | @JSProperty("arrowSize")
double getArrowSize(); | 1 |
43e45e20bb1fc79359439ff898be9fc7 | f099f43203d06c2fbfd3582f19589627 | 通过文章id查找文章审核 | @Controller
public class ManageController
@RequestMapping("/manage/checkart")
public String checkart(Model model,Integer id){
if (id!=null){
Article article = articleService.getArticleById(id);
model.addAttribute("article",article);
}
return "manage/article/checkart";... | 1 |
de8e3e97067f5a01eef00717ddab07dd | 0881ad7f0d74024f02fe42c7f122c115 | 加载根证书 | func loadRootCa() error {
p, _ := pem.Decode(_rootCa)
var err error
rootCa, err = x509.ParseCertificate(p.Bytes)
if err != nil {
return errors.Wrap(err, "CA证书解析失败")
}
return nil
} | 1 |
7b744ff072db2844daf101cba0e4c7b7 | 1ac03f44f26f1527450d072a77d3699a | flip_case: This function accepts a string and a letter and reverses the case of all occurances of the letter in the string. | def swap_case(s):
new_string = s.swapcase()
return(new_string) | 0 |
eb67a4ad0073bb29cad657159e9e7b53 | eefd7eb29f4d381619cbab1cbe3e0b0e | The Euclidean Algorithm finds the highest common factor
of two numbers. Here we create lists of number pairs and
run the algorithm on it, printing out the result and the numbers
divided by the HCF. | vals = [a,b]
vals.sort(reverse = True)
a,b = vals
quot,rem = divmod(a,b)
print '%d = %d*%d + %d' %(a,b,quot,rem)
while rem != 0:
print 'Divide by %d and %d' %(b,rem)
a,b = b,rem
quot,rem = divmod(a,b)
print '%d = %d*%d + %d' %(a,b,quot,rem)
print 'The greatest common divisor of %d and %d is %d' %(vals[0]... | 1 |
36bad7dc836647e6598a9da6c2b40c55 | 9d8a731776ec1fdbc798031c0deae04d | 刷新屏蔽列表 | let index = this.fbDataList.indexOf(GlobalConfig.ZhanLingConfig.fbIndex);
if (index >= 0) {
if (GlobalConfig.ZhanLingConfig.openserverday > GameServer.serverOpenDay + 1) {
this.fbDataList.splice(index, 1);
}
}
(this.fbList.dataProvider as eui.ArrayCollection).replaceAll(this.fbDataList);
} | 1 |
52809330aa15e8427f4f196efa17028f | 9b68714e7f51fc74959bc05b989df828 | 是否删除此张图片 | @Entity
public class MemberImage implements Serializable
public boolean isRemoved() {
return removed;
} | 1 |
7f601773cd17bab148fdf07cf4094b06 | 110c6f9614302827bc0eb65ee3d96be4 | Creates a new instance from a ISO 8601 date array. | {
return new static($array['value'] ?? null, $array['minutes'] ?? 0, $array['created'] ?? null);
} | 0 |
c2b30e1a7e486ff78bdeaa2ddde61f31 | 06c396d9652090a2baaf1820fcb2696b | Updates render angle of the pointer and fires PropertyChanged event. | namespace SimpleTimer.Controls
public sealed partial class Arc : UserControl
private void OnRadiusChanged()
{
this.Render();
} | 0 |
5a1bbcd24d5d2b18439d4b38cab9d8fd | 614bfb4c7db679e6a32701b2977b4094 | GET: StCourseEnrollments | {
var courseEnrolls = db.CourseEnrolls.Include(c => c.aCourse).Include(c => c.aStudentRegistration);
return View(courseEnrolls.ToList());
} | 1 |
c9df470e9ca8d1db4a8dfc29d447fe81 | 7b6c85dc0b80e02a69b26938ebb9a43f | Set source_image_id | class Make
public function setSourceId($sourceId)
{
$this->sourceId = $sourceId;
return $this;
} | 0 |
f50a35b155277307626d25cf0a61ae1b | 18ed889caa9cfb4ad09fe359a9bdd089 | Validate all the entities in the saveMap. | var entityErrors = new List<EntityError>();
foreach (var kvp in saveMap) {
foreach (var entityInfo in kvp.Value) {
ValidateEntity(entityInfo, entityErrors);
}
}
if (throwIfInvalid && entityErrors.Any()) {
throw new EntityErrorsException(entityErrors);
}
... | 1 |
f7cd68371f29799e5155bfc0b3a293ca | 318c94d184719f583c31417d41804137 | Добавление оценки на заявку | namespace WcfService1
public class Service1 : IService1
public int AddResultExpert(int id_expertise, int id_expert, int id_project, double value)
{
try
{
experts_expertises experts_Expertises = db_Expertises.experts_expertises.Where(o => o.id_expert == id_expert && o.... | 1 |
477f8530de7a914df5426424b4070406 | 5094aed0a4cee14d2ed282ebadd11b09 | Called whenever a write completes and the output buffer is empty | {
while (Writes_completed != Writes_issued)
write_wait();
if (Out_buf_bytes)
{
flush_output_buf();
write_wait();
}
} | 0 |
c90a921d74a49a315a2134a1831b3f73 | d58dd4a017ccd546d5b5b236e749d1c4 | The maximum time a connection can be used before it *may* be
given away again. | class Network extends HotspotGraphElement
public function getConnectionLimitNetworkMaxDuration()
{
return $this->_row['connection_limit_network_max_usage_duration'];
} | 1 |
0c906e01076bb7df3655877e2ff9dd34 | 9f2a7a73ce310c4658b2b1f61673e2fb | Creates user and returns user id. | @Repository
public class CampsiteDAO
public int createUser (final String firstName, final String lastName, final String email) {
Transaction transaction = null;
int userId = -1;
final Session session = factory.openSession();
try {
transaction = session.beginTransaction();
... | 1 |
71c4258fed4205417c6142bc4635d051 | 7326c1f7bb715cedfd35a65cf7eeff4e | This function returns the size of the result vector for storing prime numbers | int Quadtree::getRes()
{
return res;
} | 0 |
02ebc4029696b0b17c0e42d480318e0d | 66792dd8bcbe65ecb372618dd3643d28 | Get the 2d array index for a given pixel number.
NB: Returns (y, x) because numpy array is row-based. | def pos2idx(pos):
return pos[0] + pos[1] * H | 0 |
ac4cbbe68f891ead483ad780caa96b9e | 1f3c2082bffba9421c5250693d4b2c52 | 获取训练用的密码串,需要读出这些密码串用于建立模型 | public class TrainActivity extends BaseActivity
private void getPassword(){
mVerifier.setParameter(SpeechConstant.PARAMS, null);
mVerifier.setParameter(SpeechConstant.ISV_PWDT, "3");
mVerifier.getPasswordList(new SpeechListener() {
@Override
public void onEvent(int arg0, Bundle arg1) {
}
@Override
... | 1 |
e597f552824fa33321911794729370e4 | 92ce612ad03d446a248ca2c1ccac8398 | convert global (row, col) pair to local (row, col) pair | def from_local_to_global(patch_id, patch_row_col, patch_size=40):
global_row = patch_size * patch_id[0] + patch_row_col[0]
global_col = patch_size * patch_id[1] + patch_row_col[1]
return (int(global_row), int(global_col)) | 0 |
f8af3089645fe2c48a9c3970dc6c3872 | c8f6bc8bbbd2e44f31ba6d5258b13a83 | 如果str已经出现过,则返回编号 | public class SymbolSet
public int getCode(String str) {
int result;
if (stoi.containsKey(str)) {
result = stoi.get(str);
}
else {
int code = itos.size();
stoi.put(str, code);
itos.add(str);
result = code;
}
retur... | 1 |
06b2fc6e4c87d126448be5d322fcd7ac | 2ab035440c88acf3fa57ce4ec11b4a3a | Removes all items from the user's cart and returns them to the
appropriate storefront. | namespace ShoppingWebApp.Models
public partial class ShoppingCartService
public void MigrateCart(string userName)
{
} | 0 |
db9001991c60433a8312cb0905dea957 | b43b8dbb5f75b92f3b6055eb5975ff0f | Creates a new GWS renderer to perform rendering on any buffer.
Only one instance of this object is required by GWS.
If you override the default GWS Factory class, and this method call,
You need to provide a valid IRenderer implementation. | namespace CSharpGL.Objects.VertexBuffers
public abstract class VertexBuffer<T> : IDisposable where T : struct
protected abstract BufferRenderer CreateRenderer(); | 0 |
c60b82b6aca8184b9ae725e9d51f61fa | fd0af2707d2bb75b67da5de1a25ac7e7 | Obtains eigenvals/vectors for bands at specified wavevectors | x = np.linspace(xmin, xmax, Nx)
dx = x[1] - x[0]
y = np.linspace(ymin, ymax, Ny)
dy = y[1] - y[0]
V = Vfun2D(x, y, params)
Hx = create_hamiltonian(Nx, dx)
Hy = create_hamiltonian(Ny, dy)
Ix = sparse.eye(Nx, Nx)
Iy = sparse.eye(Ny, Ny)
H = sparse.kron(Hx, Iy) + sparse.kron(Ix,... | 0 |
5bf97b9145d1ee7f914056cdc1a5e558 | ae4c930faf4bf97d4c9e1b6945f9bc86 | updates map moves for current player totals before move | function countMapMoves() {
var continentMoves = listOfContinentsPlayerControlsAndOwns(gameVars.gameStatus.turn)[0];
gameVars.mapInfo.mapMoves["moveAny"] = adminSettings.continentMoves["moveAny"];
if (isItemInArray("Africa", continentMoves)) {
gameVars.mapInfo.mapMoves["moveAfrica"] = adminSettings.c... | 1 |
a752c01811362abed5c7ead9b266fd90 | a72c810e9d47b47514c5c0c4cbcfe9b8 | PBKDF2 Implementation (described in RFC 2898) | afl::checksums::Hash::computePBKDF2(Bytes_t out, ConstBytes_t password, ConstBytes_t salt, uint32_t numIterations)
{
uint8_t saltAndIndexBuffer[MAX_BLOCK_SIZE + 4];
Bytes_t saltAndIndex(saltAndIndexBuffer);
saltAndIndex.trim(salt.size() + 4);
saltAndIndex.copyFrom(salt);
afl::bits::UInt32BE::Bytes_t... | 1 |
6efe684e379fcff11eaa1fbdd9428860 | 1f432c542d68f44ab946be5a0009073d | 以一对一的方式对标签进行二值化 适用于多分类 | def FeatureBinarize(CurrentLabel,Labels):
cLabel=CurrentLabel
nLabels=len(Labels)
binOutput=[0 for k in range(nLabels)]
for j in range(nLabels):
if cLabel==Labels[j]:
binOutput[j]=1
break
return binOutput | 1 |
2bcb0e03ce70224e1d342f8ca746ffb0 | b1dda68f4dfe641ac0604bd8cc9c8a25 | Read size bytes, returning an ndarray with np.int8 dtype.
Incorporate information from multiple underlying files if necessary.
The individual file pointers are assumed to be pointing at the right
locations, i.e., just before data that will be read here. | logger.debug(f"ab_read: start: {start}: size {size}: ")
result = self._library.Cli_AsABRead(self._pointer, start, size,
byref(data))
check_error(result, context="client")
return result | 0 |
08a9f9730b5752581003333961acfe5e | d5d5bf05640284a0eead62197c904f29 | Converts a Julian Day timestamp to a POSIX time timestamp | struct tm t;
unsigned int year;
unsigned int month;
unsigned int day;
unsigned int hour;
unsigned int min;
unsigned int sec;
double jd;
try {
localtime_r(&ts.tv_sec, &t);
year = t.tm_year + 1900;
month = t.tm_mon + 1;
day = t.tm_mday;
hour = t.tm_hour;
min = t.tm_min;
... | 0 |
d6a4936182c3f76c88ab9d0f480ed53b | cc5910d2fe3c31d74f8d133efb48b423 | Subscribe to notification of ALDB record changes. | class ALDBBase(ABC):
def subscribe_record_changed(self, listener):
subscribe_topic(listener, f"{self._address.id}.{ALDB_LINK_CHANGED}") | 1 |
574b046b988fbdd48b0b41d2a9f6e131 | 710242a5906ab37056451a4eca6fd461 | Gets a list of contact scoring data in specified address book. | public ListSelection getContacts(ContactProfile contact, int number); | 0 |
3069150f06d148cc364b02bb8d26889b | 4c2774e716a010b3d20e3e89ac010828 | 检查试卷是否全部设置了客观题答案 | public class PG_DTQuestionActivity extends MyBaseActivity implements View.OnClickListener
private boolean checkTengTong() {
if (Constant.ASSESS_CODE_PAIN_ASSESS.equals(mAssessDefine.getAssessCode())) {
if (mAssess.getAssessTopicRecordList() != null) {
mAssess.getAssessTopicRecordList... | 1 |
3735d59139f121511a5cf2453cd1ae05 | 79be68f3abf707044fde0cea670696a1 | Save holiday calculation plan. | @RestController
public class HolidayCalculationPlanController
@DeleteMapping(ADMIN_HOLIDAY_PLAN_DELETE_HOLIDAY_CALCULATION_PLAN)
public void deleteHolidayCalculationPlan(@PathVariable("id") Long planId) {
service.deleteHolidayCalculationPlan(planId);
} | 0 |
599afafdf3c827cd5f0c611ba5d68a82 | dbe948e5a726448a601023a63b59f601 | 当CheckUser_Authorization时写日志 | namespace MvcStudy.Filters
public class MyAuthorization:AuthorizeAttribute
public override void OnAuthorization(AuthorizationContext filterContext)
{
filterContext.HttpContext.Response.Write("fuck u");
} | 0 |
183cb986cbf1ed7c16d1c7fbeb7f6266 | c123d8c160aaaa86d0594458f1a36085 | Convert data backend of an instance. | self.drop_fks()
self.drop_pk()
with self.conn.begin():
self.truncate()
self.hdf_to_pg(
data_formatters=data_formatters,
data_formatter_kwargs=data_formatter_kwargs,
)
self.create_pk()
self.create_fks()
se... | 1 |
26ee5d8c847e9b3981e50294ef4578a0 | e384342d69bae79141c13f3c567cb91c | fonction qui me récupere la politique du F | String getPolitique(); | 1 |
fb99dea1490b6917779bc642334e4680 | b024a3e8c600bc4b9f8012c189b68803 | Returns a list containing the first possible path from the
start vertex to the end vertex in this graph. | class Graph(dict):
def findPath(self, start, end, path = []):
return self.findAllPaths(start, end)[0] | 1 |
491a577f9da803e48634e502599722c2 | 7839d7d902c4e7e40d9d1b79e4cdc179 | Suppression d'un medecin en base | {
if(Auth::user()->typeUtilisateur == 'medecin' || Auth::user()->typeUtilisateur == 'superAdmin'){
$medoc = Medicaments::findOrFail($id);
$medoc->delete();
Session::flash('messageSuccess', "{$medoc['nomMedicament']} Supprimer avec succès");
return redirect(... | 0 |
d9026ce5053ac3c76a5b5874715b757e | e83c7a847d180ce24810ee05c33db4d9 | Tester la modification d'un objet avec id = null | @Rollback
public void test_11_modifyCommande() throws DaoException {
final CommandeDo commandeDo = commandeDao.findById(ID_COMMANDE_ADD);
commandeDo.setAdresseFacturation("bad adress");
commandeDao.update(commandeDo);
} | 0 |
8983e95f34616dc7044e3ecc1f05e0b7 | feded72fdb448b8a1433de4d16f0160d | msec -> sec | {
ASSERT(res);
if (sec < 0.0 || sec >= 4294.967296)
return false;
(*res) = (DWORD)floor(sec * DI_SECONDS);
return true;
} | 0 |
8362d7ad1ed7f03f7badb64defd62954 | dbd1bcd035e833d01d3379fb9e0fabd9 | Проверка, если в автомате нет вообще монет | if (SandBox.Instance.isVirtualGate)
return true;
for (int i = 0; i < SandBox.Instance.Players.Count; i++)
{
if (SandBox.Instance.LastCurrency< SandBox.Instance.Players[i].silverCoins)
{
return false;
}
}
return true;... | 0 |
5221679ba47679708efd0d17df19173e | e8e01af1928769731978eceb3b7a01fb | clear the pixmap to black | void ScribbleArea::clearImage()
{
image.fill(qRgb(255, 255, 255));
modified = true;
update();
} | 0 |
6651b5747977e16636e6d488a9e91659 | 86d606eaaa5534c26fb6fcb7f8fe91e6 | reset the Add Rule form field values whenever the user moves folders | $("#btabtop").addClass('hidden');
$("#filesearchresults").addClass('hidden');
$("#newnote").removeClass('hidden');
document.getElementById("inputTitle").value = "My value" + homeNotesfolder;
} | 0 |
add358f5ac376ccafa87486d30e03f5d | 2a5263f5d1488eec90592089bb7474b8 | Finds the marks for a specific student. | public ArrayList<Marks> getMarksByStudent(Student student) throws SQLException {
if (student == null) return new ArrayList<>();
Connection connection = connectionManager.getConnection();
PreparedStatement statement = connection.prepareStatement("SELECT * " +
"FROM marks WHERE... | 1 |
3e86b6e2a811396252b56dbbbcb6fa4d | 278a26178393c10e5abe761ab368fc9b | Show the preferences dialog.
This method raises an Xmms::Error exception if XMMS is not running.
remote.show_prefs
remote.prefs | int *session;
Data_Get_Struct(self, int, session);
CHECK_SESSION(session);
xmms_remote_show_prefs_box(*session);
return self;
} | 1 |
d07b87a8810b3e8d6b9ab5ff4098f3ee | ee23fecbf315ba59ab982dba0efa44f8 | Metropolis-Adjusted Langevin Algorithm. | def metropolis_step(curr, data, log_likelihood, scales, bounds=None,
n_steps=1, **kwargs):
u = np.random.random(size=n_steps)
curr_log_L = log_likelihood(data, curr, **kwargs).sum()
if isinstance(curr_log_L, np.ndarray):
curr_log_L = curr_log_L.sum()
for j in range(n_steps):
prop, bi... | 0 |
2ee6b1228fcf6196b8f3f3887ea3e5fe | fcba90f83267499ee032661302d86753 | Returns the Mechanical Turk Site to post the HIT to (sandbox. prod) | def get_mturk_connection(config, debug=False):
if debug:
host = 'mechanicalturk.sandbox.amazonaws.com'
else:
host = 'mechanicalturk.amazonaws.com'
mturk_connection = MTurkConnection(aws_access_key_id=config["access_key"],
aws_secret_access_key=config["s... | 1 |
bdf341acc3b7950dd35c0bc0d3a74ab2 | abbda55b5e5cc8c8f4ab190adfa26456 | Returns rebuilt property tree as flat property file | class SwingMainWindow(val sciview: SciView) : MainWindow
override fun rebuildSceneTree() {
nodePropertyEditor.rebuildTree()
} | 0 |
c703cea651e81c99c70d534aed4bb942 | a3a612636ac3787d48e6c569270df0db | Returns the user prefs' GUI theme settings. | GuiSettings getGuiSettings(); | 1 |
93274ff05649e8a572acfe055fb48cf6 | 837d5e304762460c5d7958dbad824ee4 | Whether to close the window when unloading | function onUnload(deactivatedWhileWindowOpen) {
if (!deactivatedWhileWindowOpen) {
return;
}
} | 0 |
50ddf5bde3f8d6b4e1eada248931e488 | 697c55d58ea38e8d1066be2d7ffe59c6 | Formats a message for warning. If on a posix system the message will be in color. | {
#if defined(WIN32)
HANDLE hConsole;
hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hConsole, 14);
printf(pWarning);
printf("\n");
SetConsoleTextAttribute(hConsole, 15);
#else
puts(pWarning);
puts("\n");
#endif
} | 0 |
1ca978cf69b28f389771954b683678bc | cd44f26f56af0c5c70fdeadebb8beb78 | функция, проверяющая число на простоту | {
int i,m,a,b,j=0;
bool k=0;
a=m=n;
if (n%2==0) return 0;
if (!q[n]) return 0;
else{
for(i=3;i<=m;i+=2)
{if(a%i==0&&a!=1&&q[n])
{b=a/i;
j++;
if(b%i==0||(n-1)%(i-1)!=0)
return 0;
else {k=1;m=m/i;}
a=b;}
}
}
if(j<=2)return 0;
return k;
} | 0 |
8fe0c563c584f1c090c4ed68d34d4a67 | 9e903dff4056a5f475223bf4044c6f80 | 检测打什么牌后可以听牌 | try:
_pai = strSort(_pai)
print '->手牌:', _pai
if not re.match(r'^[1-9A-Ia-ikmwusoq]{14,}$', _pai):
raise Exception('牌型错误.')
if len(_pai) == 14 and re.compile(r'(?:(\w)\1{1}){7}').match(_pai):
raise HasHuPai('七对')
if re.sub(r'(\w)\1', '\\1', _pai) == '1... | 0 |
f8785a119669cf173e52ff58b38201df | 63b42a77de3fd2cdd78ed3ec4c501eec | set the potential (as a function of an array of x-values) | class OneDWell:
def setPotential(self, func):
self.potentialFunc = func | 1 |
48183bd3a64bf7712cebc7252d910062 | 4210dad456803d35270521f58b8ee4a7 | Reshape the image data to be used in a Convolutional Neural Network. | def prepare_trainset_for_cnn(x_train, x_test, y_train, y_test, image_h, image_w):
x_train = x_train.reshape(x_train.shape[0], 1, image_h, image_w).astype('float32')
x_test = x_test.reshape(x_test.shape[0], 1, image_h, image_w).astype('float32')
x_train = x_train / 255
x_test = x_test / 255
return x_... | 1 |
1ca4513c6e9a63cfe59114daeedf0fa8 | 4e87f33ef6dd7ee631bafe7ed567133f | Is the parse node a configuration node? | class ProcessesMemory(object):
class Nodes(object):
class Node(object):
class JobIds(object):
class JobId(object):
def is_config(self):
return False | 0 |
b5262014dfee157f5901c98cb06c8217 | c2081651a307a976d33452119970fdc9 | Assuming you want case-insensitive comparison | def case_insensitive_cmp(a, b):
return cmp(a.upper(), b.upper()) | 1 |
1b73fa39f6a4ca73b3ff6860b83e5cc6 | e7b9fc04dceeefa9aecf4a2d4980f050 | 设置巡逻模式--无参 | var arrSetProtect = new Array();
arrSetProtect[0] = "G";
arrSetProtect[1] = "1";
arrSetProtect[2] = "0";
arrSetProtect[3] = "0";
arrSetProtect[4] = "0";
arrSetProtect[5] = "0";
arrSetProtect[6] = "0";
arrSetProtect[7] = "0";
arrSetProtect[8] = "0";
arrSetProtect[9] = "1";
arrSetProtect[1... | 0 |
a54c39570080eee8143b179cf89ba2c4 | 5dbdfa4ef4b3a57caef0c9bfcc15b37e | Set 'IsPilot' value | GAME_INLINE void SetPilot( Vehicle_t *pVeh, bgEntity_t *pPilot ) { pVeh->m_pPilot = pPilot; } | 0 |
22ca605df4a45e02f5a6926d8ff80e96 | 7eba1a872914b452a2dd485d8c81ee94 | 获取rect_trans的size,来设置target_trans对应控件的大小 | public static class U_RectTransform
public static Vector2 GetReal_Size(RectTransform rectTran)
{
Vector2 size;
Vector3[] corner4 = new Vector3[4];
rectTran.GetWorldCorners(corner4);
float width = corner4[2].x - corner4[0].x;
float height = corner4[2].y - corner4[0].y;
... | 1 |
dc2eb8883c155438881c0681175f5cfa | 8f68bdee8428105cdfc19875e3957a47 | Filter external tasks only with null tenant id. | tenantsList(tenantsList().filter(filterTenants));
function filterTenants(tenant) {
var results = $.grep(activeConversation().ConversationUsers(), isTenantRecipient);
function isTenantRecipient(convoUser) {
return convoUser.UserId() === tenant.I... | 0 |
10eb4d4986148fb4a9666f51cbc42370 | 74b27074efa4b6d3e332adb224cebaa2 | Densifies a geometry using a given distance tolerance, and respecting the input geometry's <see cref="IPrecisionModel"/>. | namespace GeoAPI
IPrecisionModel CreatePrecisionModel(PrecisionModels modelType); | 0 |
314926ba9716dfabd7f51c4f10574717 | fee9e01fc851b4f89cdefe173cb32e3f | Gets the order list of INI values to place into the B2S file | class ConfigParse
public static function getOrders()
{
return ConfigParse::$_orders;
} | 1 |
c3f0572458b9b7ba259eea5a49e81f47 | 0fa66dc30dabd13be53563f34729824f | Verify the MCP9800 configuration. | {
i2c_address = 0x08;
crc_enabled = true;
bq769x0_write_byte(BQ769X0_CC_CFG, 0x19);
if (bq769x0_read_byte(BQ769X0_CC_CFG) == 0x19) {
return 0;
}
i2c_address = 0x18;
crc_enabled = true;
bq769x0_write_byte(BQ769X0_CC_CFG, 0x19);
if (bq769x0_read_byte(BQ769X0_CC_CFG) == 0x19) {
... | 0 |
48ff8412dfe73ea7f6dd28213a753f28 | afda650f487262e61bbb3a9e0f423f26 | 手机信息查询接口授权key状态查询 | class Marketcode extends Api
public function codeactivequery(array $params)
{
return $this->httpPost("/intp/marketcode/codeactivequery?access_token={$this->accessToken}", $params);
} | 0 |
b51d5e91426f4782901c1b01e2a86231 | 6db4067a3e1ea6775f78de75388309ad | Sets the width of a rectangle centered on a drag point to allow for limited movement of the pointer before a drag operation begins. | {
SetDragZoomRect(pt1, pt2);
dragZoomCanvas.Visibility = Visibility.Visible;
dragZoomBorder.Opacity = 0.5;
} | 0 |
ce0b86319313875dd9f33fb85ba367b7 | 71c8b632e424c68123bce7e19d8907de | Sets a state of the apriori algorithm. | class App:
def set_state(self, state: str):
self.__state = state | 0 |
15cc016201b5ecc82ebc76c9410604d1 | 63aa13722811a4f469496348616499be | Converts int to a double. | union {
uint64_t i;
double f;
} d;
d.f = f;
return d.i;
} | 0 |
05edbff4d054a9b21635b5761f6e3211 | 1b7a7d8eccaa20bdaf5c4a0de84bfa90 | Reset all tests reports. | interface FileSystemMigrationReportManager
fun resetReport(type: ReportType): FileSystemMigrationReport | 0 |
b40e212d964e9f0772707ffc9b16e274 | fa11f87dfa9b6a5a275a161779bcb1f8 | get the pose of the ith tool from observations | def get_tool_poses(obs,norm_flag=True):
toolposes = np.zeros((param.TOOL_COUNT,param.TOOL_STATE_DIM))
for i in range(param.TOOL_COUNT):
if norm_flag:
toolposes[i,:] = np.array(get_tool_pose(obs,i))
else:
toolposes[i,:] = np.array(revert_normalize_tool(get_tool_pose(obs,i)))
return toolposes | 1 |
905c2af38789f3a06d6011b4c9334257 | 7515b40a73cfee5bbcd35448bf9d69e8 | Gets the collection of User classes which hold listed owner's information. | namespace NefitEasyDotNet
Task<IEnumerable<string>> GetOwnerInfoAsync(); | 0 |
1b516c7e214e71ea18d79f7c22a74858 | 03b18440aae7c63e2ed06fdad786feeb | Add a new alarm action. | alarm = cloudwatch.Alarm(
'{0}Alarm{1}'.format(self.trop_topic.title, str(len(self.alarms))),
AlarmDescription=description,
AlarmActions=[Ref(self.trop_topic.title)],
OKActions=[Ref(self.trop_topic.title)],
Metri... | 1 |
23d0fe6ad7d26e508ce3133de5f54547 | c485e744940ee84061a266f95824ae14 | test for r_single_t for regression examples | def test_make_regressor_1():
condition = ([1, 20, 36.5], [2, 2, 2], [1, 1, 1])
frame_times = np.linspace(0, 69, 70)
hrf_model = "spm"
reg, reg_names = compute_regressor(condition, hrf_model, frame_times)
assert_almost_equal(reg.sum(), 6, 1)
assert reg_names[0] == "cond" | 0 |
ca641c80d24397089852c3cc447cc574 | 3a096a9de4ba1f562e66f82947fd41a1 | Тест выхода из комнаты. | class TestRoom(unittest.TestCase):
def test_leaveroom(self):
result = self.r.leaveRoom()
self.assertTrue(result[0],result[1]) | 1 |
73089ad677105a32907287747cecb4f2 | 168d0edb82b8a2758a7eb68c1677c49f | 导航到addOrUpdtPdtAttrVal.jsp页面 | public class PdtProductAction extends BaseAction
public String toAddPdtProductPage() {
return SUCCESS;
} | 0 |
13374ea994dd664bb5f39bb6a3f92b2f | bde54cab238a9da0c8ee536539a1bcf0 | Register a callback fn for whenever the cfg changes | function Addon.Config:AddOnChanged(onchange, position)
if (type(onchange) == "function") then
if position and type(position) == "number" then
table.insert(self.handlers, position, onchange)
else
table.insert(self.handlers, onchange)
end
end
end | 1 |
d2eff0036c2fec1c631e743821a05fac | 17157166075ed5ba3006595ebe36cd9e | Check to see if EstimatedOnDemandCost property is set | namespace Amazon.AutoScaling.Model
public partial class InstancesDistribution
internal bool IsSetOnDemandPercentageAboveBaseCapacity()
{
return this._onDemandPercentageAboveBaseCapacity.HasValue;
} | 0 |
0a4018030d5686d5bb9cde4ecb7bb5be | 2e39808fbc42bf8e7887afeccfc1bc5a | 计算旋转后图片的尺寸 | public class MyPhoto
private static Rectangle calculatorRotatedSize(Rectangle src, int angel) {
if (angel >= 90) {
if (angel / 90 % 2 == 1) {
int temp = src.height;
src.height = src.width;
src.width = temp;
}
angel = angel % 90;
}
double r = Math.sqrt(src.height * src.height + src.width * src... | 1 |
c44b5be3d515a1cbee8767a1f00efbb7 | 8d4ffdbcab9a929d6492e017bb433ccf | /////////////////////////// construct //////////////////////////////// | void CPlayState::ConstructL()
{
} | 1 |
59e14335df1f81023745ee1c4c6fbcbc | 98242cc3a7c9e2bed2a9cd3d7c961028 | Finds all the revenue types. | public function findById (RevenueTypeVO $revenueTypeVO); | 0 |
6e0fe1c2d8b986865a368455c31f098c | 3caedd76e7ce65f766d4d6e6809674a5 | 清除地图上的学区要素 | var Layer = window.parent.map.getLayer("countyGraphic");
if (Layer) {
window.parent.map.removeLayer(Layer);
}
} | 0 |
29ae12271cb3f580fd36a7af471533bc | 5b899629de3907bd8dfe9737e144381e | Generates ERD in Block-Format | s = """digraph prog {
node [shape=rectangle,fontname=Courier];"""
for block in sorted(self.blocks,key=lambda x:x.label):
s += '\n'
s += block.gen_graphviz()
s += '\n}';
return s | 0 |
565b3766ed5406b1a1cab7b9112ec2a7 | 51dbbdd44ab3a4144ed20682e44fe8fc | socket (error) state to string | static char *os2_socket_strerr(int errcode, char *tmp_buf)
{
#define TEXT_FOR_ERROR(code,text) \
if (errcode == code) \
{ \
return #code " - " text; \
}
TEXT_FOR_ERROR(SOCEPERM , "Not owner.")
TEXT_FOR_ERROR(SOCESRCH , "No such process.")
... | 1 |
1cd4c85e1b5d40ff9c1409c7585868a3 | f60de8b546628a59a2593dcaefc9055a | Assigns a comma-separated list of video embed codes (or a single embed code) to a particular player.
An existing player will be overwritten when using this mode. | if ( ! $atts ) {
$atts = array();
}
$post_id = 0;
if ( ! empty( $atts['id'] ) ) {
$post_id = (int) $atts['id'];
} else {
$supported_formats = array( 'mp4', 'webm', 'ogv', 'youtube', 'vimeo', 'dailymotion', 'facebook', 'dash', 'hls' );
$is_video_available = 0;
foreach ( $supported_formats as ... | 0 |
fd7893b8ec9b7d125a2f9fcb751e70bb | be4eb9143b32a938f9694a56257ba444 | 字符串转Long型List | public class StringUtil
public static List<Long> toLongList(String str) {
return toLongList(str, COMMA);
} | 1 |
d752ea4410c3c2e617c08a09eafb2069 | 1a7ba73911eb0dcf35b362a714caca32 | Get the vary headers that should be honoured by the cache. | {
$app_varys = array();
$serviceList = vmc::serviceList('cachemgr_global_vary');
foreach ($serviceList as $service) {
$class_name = get_class($service);
$p = strpos($class_name, '_');
$varys = null;
if (method_exists($service, 'get_varys')) {
... | 1 |
dcf39514984265daa231b6ff60b9c240 | c90e4a699bce7bda40e510c76418c278 | Consume data in advance of what the decompressor requires. | impl<R> DeflateDecoderBuf<R>
pub fn reset_data(&mut self) {
self.decompressor.reset()
} | 0 |
af4cc8eee2d74d719856164dbfa7cd42 | 131c7dabf4db34c44312de639c9b5a80 | 通过hostname(即ip)获取host所在的监控组名
返回由组名组成的字符串 | def get_alertgroup_by_hostname(alertgroup_file, merged_data_file):
data = pd.read_csv(merged_data_file, sep=',', dtype=str)
df = pd.read_csv(alertgroup_file, sep=',', dtype=str)
df['alertgroup'] = df['alertgroup'].map(lambda x: x[:3])
df.drop_duplicates(inplace=True)
print(df)
merged_df = pd.m... | 1 |
d0a82a8c54fc6c0fd6bcb7ad6d7dc036 | 2a8f388f9e1d8428e136bd7cdb2ee795 | Returns the value of the '<em><b>Mechanism Name</b></em>' attribute.
<!-- begin-user-doc -->
<p>
If the meaning of the '<em>Mechanism Name</em>' attribute isn't clear,
there really should be more of a description here...
</p>
<!-- end-user-doc --> | String getMName(); | 1 |
0e10c98f6bb16654f215807fb079342a | 481e23c071633a60b922902d0063ec7c | Set (replace) the ordering to sort by the day field. | class DateTime extends BaseField
public function order(Builder $builder, $direction)
{
$builder->orderBy($this->id, $direction);
return $this;
} | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.