query_id string | corpus_id string | query string | code string | label int64 |
|---|---|---|---|---|
4601302ae8dcbf1c38edf6fa8fb7e6e5 | 3453183e6c66ad515af082b8ec4bbcf8 | 如果a和b中有负数,抛出异常 | public class Test
public void test(int a, int b) throws ArithmeticException {
if (b == 0) {
throw new ArithmeticException();
}
System.out.println(a / b);
} | 0 |
df65f58b3aaa076eddf454469ce1c60e | 359b60cbc3b3b5f06cbd01e923be7c98 | Returns string representation of CSV filtered to row with given filterFieldValue in selected column | def filter_csv( values, csv ):
f = filter( lambda x: x in values, csv.split( ',' ))
if (not f):
return values[0]
return ','.join( f ) | 0 |
b48101d04a668eb43c650911e7b074b5 | cfd0e7d18c9597fe8bd2f7f2175f092a | Makes the simulator write instantaneous forces of atoms during simulation.
- **Note** call this method before running the simulation with :meth:`tools.FrictionSimulation.run_simulation`
The format is::
(atom 0 f_x) (atom 0 f_y) (atom 0 f_z)
(atom 1 f_x) (atom 1 f_y) (atom 1 f_z)
(atom 2 f_x) (atom 2 f_y) (atom 2 f_z)
.... | with open(filename,'w') as f:
positions = self.get_pos_arr(force=True)
formatstring = "{color} {x} {y} {z}\n"
for ind,row in enumerate(positions):
f.write(formatstring.format(x=row[0], y=row[1], z=0, color=self.cells[ind].type.type_ind)) | 0 |
01d68cb241c83c26c055275538d2b3bc | 48115dca64fc260891bb4dcbf2b1446a | Gets the service level objectives for an Azure SQL Database server.
server_name:
Name of the server. | public final class ServersInner
public ServiceObjectiveInner getServiceObjective(String resourceGroupName, String serverName, String serviceObjectiveName) {
return getServiceObjectiveWithServiceResponseAsync(resourceGroupName, serverName, serviceObjectiveName).toBlocking().single().getBody();
} | 1 |
3589657f49a847a09772e12e062b552b | a2772d25411b7c21815c6e92950952bc | Returns :obj:`True` if and only if the model type is *not timed*.
Untimed model types are :code:`LTS`, :code:`DTMC`, and :code:`MDP`. | class Everywhere(ParameterSubspace):
def time_invariant(self):
return self._time_invariant | 0 |
da841d8d4c2bc058ad0e9fd4ffb88989 | dfcfe813d15bc52239acc23d98a49d6b | Returns the room labeled as the starting room. | class TestGame():
def __chooseStartingpoint(self):
self.__currentRoom = self.__listOfRooms[9] | 0 |
eab854b343680ef72ba133f82e9a08b2 | 2bfdecfa1a138589e1595264cf348b7f | 获取外部sdcard上私有存储图片路径(Android文件夹是隐藏文件夹,用户无法操作),path:/sdcard/Android/date/package_name/files/Pictures
应用卸载的时候会被删除
注意:要访问必须有文件读取权限 | public class FileUtils
public static String getSDCardPrivateFilesDir(Context context, String type) {
return context.getExternalFilesDir(type).getAbsolutePath();
} | 1 |
a70ea6db52a593502eb5dd9467a55920 | c3c07d9cfb70f5d6335bda4b56425928 | Returns the meta object for the reference list '{@link qvtoperational.ModelType#getMetamodel <em>Metamodel</em>}'.
<!-- begin-user-doc -->
<!-- end-user-doc --> | EReference getOptimisation_Metamodel(); | 0 |
e38b78eadcf396fbebc0157df391c82d | 105a939e8eadc410dc617227e0bde3da | Converts list from IDL format to ONEP AAA format
[in] idl_list AAA attr list in IDL format. This is mainly used for
inputs from Outbound thrift calls.
[out] result_attr_list AAA attr list in ONEP specific format | aList = NewNewAttrList()
for i := 0; i < len(a); i++ {
aList.attrs = append(aList.attrs, a[i])
}
return
} | 0 |
229464014c92cdb571340943da9e50f6 | 31f634a587829e265adc898af955b371 | ### Update seedbank function | writecensustable <- function() {
censuses=update_portal_plant_censuses()
write.csv(censuses, file="Plants/Portal_plant_censuses.csv", row.names=FALSE, quote = FALSE) } | 0 |
8a405287ddefee11cc3fd2c59e3019e0 | 1473d14aa28ce8c9be293ee374119635 | 探测文件的真实下载地址 | def before_record_response(response):
try:
response['body']['string'] = re.sub(download_url, r'\1/dummy_hash', response['body']['string'].decode('utf-8')).encode('utf-8')
except UnicodeDecodeError:
pass
return response | 0 |
cd28fd465483e81a03bd9cd427e0f349 | 522f97458f1085dd7d02e3d80494f5d5 | Returns a dictionary encoding an execution of tskit conforming to the
provenance schema. | return {
'step_type':
step_type if step_type is not None else str(
type(self).__name__),
'property_values': [],
'timestamp':
self.preroutine_timestamp,
} | 1 |
755f15bfcffbf930d254e08777c93807 | 915b4dd7a9d24d47a77fc05ceec569ee | Decides whether to draw or to fill an area. | public class DrawController extends JPanel
public void setFilled(Boolean filled) {
this.filled = filled;
} | 1 |
76e4b1b2e1956df935a7a5b0acb47db6 | 4a8c428781438b82fe78131967575c0a | Draws one eye and eyebrow | {
int y = mRightEye.Y;
Point p1 = TransformPoint(Point(x-10, y));
Point p2 = TransformPoint(Point(x+10, y));
Pen eyebrowPen(Color::Black, 2);
graphics->DrawLine(&eyebrowPen, p1, p2);
float wid = 15.0f;
float hit = 20.0f;
p1 = TransformPoint(Point(x, y + 15));
SolidBrush brush(Color::Black);
auto state = grap... | 1 |
6d3edcae0154445b40869f637f2d2a10 | 4ca9f55266b33a0e059d23de751b4ba4 | LZW expansion algorithm | bool lzwEncode(unsigned int bits, unsigned int maxBits,
int (*readFunc )(void* context), void* readContext,
int (*writeFunc)(unsigned char c, void* context), void* writeContext) {
int lvCode = 0;
Dict * lvDict = Dict_Create((1 << maxBits)); ... | 0 |
0e5d9c767a1b99c8cf24c7d8160b3e17 | 8a8a1863babc52d0d6f551d9344fbb58 | Ejecuta las validaciones del directorio | $directory = $this->file->getDirectory();
if (!$directory->create()) {
$this->setError(
__('ERROR_CREATE_DIR')
);
return false;
}
if ($this->file->exist() && !$this->file->canWrite()) {
$this->setError(
__( '... | 1 |
9eb853cb68e44e8eee06a8a2f99c3109 | a2bffa86e0024b971967a3d133f28d35 | ! \details
This command sets the parameters needed to the HTTP connection. | void ConnectionDialog::setConnectParams()
{
set->setValue("JobAccounting/host", ui->hostLine->text());
set->setValue("JobAccounting/port", ui->portLine->text());
close();
} | 0 |
f66609a0c505ce1441bfeb33f153a77e | 9fb3a82ec74a9a234db527732c9006b3 | Obtenemos el objeto Informe Venta a partir del id de la venta | {
var ventas = (from v in iDbContext.Ventas
.Include("Lineas")
.Include("Cliente")
.Include("MetodoPago")
where v.IdVenta == pIdVenta
select v);
return ventas... | 1 |
6905683f9b9d1ca6915acec176d09355 | 2f6ab3c0619374c475700d37af68da03 | Convert strings of fields and values
to associative array. | $retVal = array();
if (!empty($s)) {
$c = explode(',', $s);
if (!empty($c)) {
foreach ($c as $p) {
$pair = explode(':', $p, 2);
$retVal[trim($pair[0])] = trim($pair[1]);
}
}
}
retu... | 1 |
54568a63b9124b0b52cb2cf4bc24d29d | 83a166ec0099bad681d59e247c85cdc1 | !This method can be used to log information. Only when the specified
level of the message is part of the Set of logged values the
information is logged. This method receives a character string that may
contain format specifiers that are also available to 'printf' (like %d, %5.2f,
etc.). The remaining arguments are the ... | public abstract class LogContext extends Context
public final void logInfo(String message) {
logInfo(Javolution.j2meToCharSeq(message));
} | 0 |
7c6c358adffb13d8790215ae6205fce9 | 53b4d56dec673ad1d5afd212d0e31c8e | RFC1522に従ったエンコードを行う。 | {
System.Text.StringBuilder dstStr = new System.Text.StringBuilder();
byte[] srcByte = encoding.GetBytes(srcString);
for (int i = 0; i < srcByte.Length; i++)
{
dstStr.Append(Encode(srcByte[i], spaceToPlus, large, RFC1738_UNRESERVED));
}... | 0 |
1a46a3b1329d2d9e6b974dcbe414f6c2 | 7f0dbf2576d22ac6c602569f7a275316 | Initialize UCE Handler library | {
try
{
return IEUSignCP.EUInitialize();
}
catch (Exception)
{
return IEUSignCP.EU_ERROR_UNKNOWN;
}
} | 1 |
4697f41ff25868214c778192dee0844d | 759a83cddcc395c0bce8dc5d167714dd | Returns a pointer to the current item in pList. | void* List_curr(List* pList){
if(pList->listCurrent != NULL){
return pList->listCurrent->curr;
}
return NULL;
} | 1 |
0fccbe947b9125d7f219166be1f7d96f | 3df88d84083577d7798a8639d80bb243 | Get subdomain by subdomain id | namespace Agents.Service.Abstractions.Distributions
Task<DomainDto> GetDomainByIdAsync(Guid guid); | 0 |
fe8e6574c0843ac552a630bf0ab45fcd | b361dfc8e0ab26d509c8f7a70f8118e0 | 检查telnet通不通 | public class NetworkUtil
public static final boolean telnet(String ip, int port) {
Socket socket = new Socket();
try {
socket.connect(new InetSocketAddress(ip, port), TIMEOUT);
return socket.isConnected();
} catch (Exception e) {
logger.error(ip + ":" + port +... | 1 |
08d472fc618ac62c80cc0ada16356f87 | 1d7d6dec8ee4c0b34803c3cbbec9210c | The desired average inbound bit rate in Mbps (Megabits per sec).
Used to configure virtual machines networks. If defined, `inbound_peak` and `inbound_burst` also has to be set.
See link:https://libvirt.org/formatnetwork.html#elementQoS[Libvirt-QOS] for further details. | class VmUtilizationMetricsArgs:
def network_throughput_average_kbps(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "network_throughput_average_kbps") | 0 |
7e005d6f10fb5a8de2953a1f3ed48ffa | 1f8bd5c4df59ec29327ac70f3ae0d37e | Methode dient zum Deaktivieren der Scatterplot Ansicht. | function showScattChartSP2(op)
{
d3.select('#scattChartSP2').attr("opacity", op);
if (op == '0')
{
d3.select('#scattChSP2Spots').html('');
d3.select('#scattChSP2Xaxis').html('');
d3.select('#scattChSP2Yaxis').html('');
d3.select('#scattChSP2Title').html('');
d3.select('#scattChSP2Labels').html('');
d3.select('... | 1 |
dba9d1ea76241332acb4d3f8a014ed5a | abe0200c0f6ea03a945397952045eba3 | resample group allocation of all gene copies by drawing from conditional posterior | {
double resSum = 0;
for(int i = 0; i < M; i++)
{
double genevalue = GSFDeCode(GeneGroup[gid][i].geneList);
GeneGroup[gid][i].prob = Fx(genevalue);
resSum += GeneGroup[gid][i].prob;
}
for(int i = 0; i < M; i++)
{
GeneGroup[gid][i].prob /= resSum;
}
sort(Ge... | 0 |
53ddc2eac9b3703739ba228874271791 | c65570038d39ae22f3a6220b41c20a50 | 設定標頭名稱 | namespace Lee.Reports.Csv
public class CsvReport : BaseReport<DataTable>
public void SetHeaderText(string headerText)
{
this.HeaderText = headerText;
} | 1 |
eb6c8fb1676d9443b4013cae20762cbf | de40043f85edaf83cce8e8be2cdd1b95 | Finds node with the lowest F cost in the passed array | AStarPathNode* AStarPathNode::lowestCostNodeInArray ( CCArray* pArray )
{
AStarPathNode* pLowest = KD_NULL;
for ( KDuint i = 0; i < pArray->count ( ); i++ )
{
AStarPathNode* pNode = (AStarPathNode*) pArray->objectAtIndex ( i );
if ( !pLowest || pNode->getCost ( ) < pLowest->getCost ( ) )
{
pLowest = pNod... | 1 |
0c38713ffe84a8d6950b5d3a08de6b82 | cda40a13ab90b765c2989f213c127b8b | 获取指定菜单的层级数 | public class Menu implements Serializable
public Integer getRank(){
String[] rank = this.parent_ids.split("[/]");
return rank.length;
} | 1 |
d8498c62d2d21ac09aab22285eabe047 | 5bc6759242097b4ade386e3a8a839c1b | restituisce la lita delle prenotazioni di un determinato utente | class EUtente extends EUser
public function cercaPrenotazioni() {
$fPrenotazioni = USingleton::getInstance('FPrenotazione');
$this->_prenotazioni = $fPrenotazioni->cercaPrenotazioni($this->_codFiscale);
return $this->_prenotazioni;
} | 1 |
48715361d9c14ef32a8fec8f9234be1e | d5d6fc39c43cd4bdaf8001b108cfcf56 | 将查询结果转换为BigInteger集合 | BigInteger count = (BigInteger) query.getSingleResult();
return null != count ? count.longValue() : 0L;
} | 0 |
823e0518c469877a6a6d6f2184380502 | 39f6ca2e1301874003f5746d707d5230 | Simplify the list of geometries passed in using the GeometryServer. Simplify permanently alters the input geometry so that it becomes topologically consistent. | namespace GeoAPI
IGeometry BuildGeometry(ICollection<IGeometry> geomList); | 0 |
14244b86b1b5454473ef218bb33f6ce9 | a545fa1306da21f57a44550dbd6c4788 | 화면에 조회된 일반회원의 정보를 데이터베이스에서 삭제 | try {
Class.forName(DRIVER);
conn = DriverManager.getConnection(URL, USER, PASSWORD);
String sql = "DELETE FROM ORDERS "
+ " WHERE ID = ? ";
pstmt = conn.prepareStatement(sql);
SignUpLoginUI idPwd = new SignUpLoginUI();
... | 1 |
03c81408fd9dce7516be89b0b80980a6 | 0604220eab94b54a2d4c42198cc656f7 | Retourne l'image de la notice ou une par défaut si aucune existante | class P_constantes
public function getImageNote(int $duree)
{
switch ($duree)
{
case 1 : return $this->get_croche();
case 2 :
case 3 : return $this->get_noire();
case 4 :
case 6 : return $this->get_blanche();
default : return $this->get_ronde();
}
} | 0 |
2df24cc659ef3a0ec26fdfddda957cab | 4803034932a7825391419ba49c1b66c0 | Gets the total duration the app op was accessed (performed) in the foreground.
The duration is in wall time.
{@link #OP_FLAG_SELF}, {@link #OP_FLAG_TRUSTED_PROXY},
{@link #OP_FLAG_UNTRUSTED_PROXY}, {@link #OP_FLAG_TRUSTED_PROXIED},
{@link #OP_FLAG_UNTRUSTED_PROXIED}. You can use {@link #OP_FLAGS_ALL}
for any flag. | @SystemService(Context.APP_OPS_SERVICE)
public class AppOpsManager @TestApi
@SystemApi
public static final class HistoricalOp implements Parcelable
public long getForegroundAccessDuration(@OpFlags int flags) {
return sumForFlagsInStates(mAccessDuration, MAX_PRIORITY_UID_STATE,
... | 1 |
9a46045b857471ddc5bed8b1ff271047 | 6d69b679a635ad91c9074d112a998b7c | Check if merging ethanol with a molecule yields the right number of atoms. | mol = Molecule().from_smiles('CC(C)CCCC(C)C1CCC2C3CC=C4CC(O)CCC4(C)C3CCC12C')
group = mol.to_group()
self.assertTrue(isinstance(group, Group))
self.assertEquals(len(mol.atoms), len(group.atoms))
molbondcount = sum([1 for atom in mol.atoms for _ in atom.edges.items()])
g... | 0 |
693870e9372d5b87d0ae0ba5af13a7e3 | 6c3e7a9a8a9df3b69882d63b60741446 | dash-separated -> camelCaseAction name.
dash_separated -> camelCaseAction name. | class CC_Inflector
public static function convertActionName($string)
{
$string = substr($string, 0, -6);
return self::camelCaseToDash($string);
} | 0 |
50c3a6e25df8ddb221ec48c62eaad1e2 | 412e7085c191f6dfa6f670e2f26523c4 | 新增收藏用例 | public class MyCollectionServiceTest extends BaseTransServiceTest{
@Test
public void insertTest(){
TAirshuttleMyCollection t = new TAirshuttleMyCollection();
t.setRefId(1);
t.setType(UserRoleEnum.FLY_GROUP.getValue());
t.setUserId(1);
myCollectionDAO.insert(t);
} | 1 |
2653a3fcc87e1ce462d445703be577a9 | 2d2cb4a3d47e409871cf8c505e8190c7 | 通过名字获得列,比如A,B,AC | int index = this.header.getIndex(name);
if((0 < index) && (columnList.size() > index)){
return columnList.get(index);
}else{
return "";
}
} | 1 |
42daf937fffacea8c368c849dee96db9 | 1707a84c3d375c42a61f45619ecefe43 | New generates a random ID using crypto/rand. | func New() (string, error) {
id, err := FormatString(generateRandomBuffer, alphabet, size)
if err != nil {
return "", err
}
return id, nil
} | 0 |
857c3c191dd2494d0a321b0d5339137b | db20cec595a951f76205f908fd6e9494 | Determines if an Entity has Components consistent with the Aspect's pattern. | namespace SoupV2.Simulation.Components.util
public static class ComponentCompatibility
public static bool ValidateEntityComponents(Entity e, out List<string> errorReasons)
{
errorReasons = e.Components.Values
.Select((ac) =>
(ac.GetType().Name, ValidateCompone... | 1 |
425ccbece086679dc3310a003523a297 | 057dc62ad1c5cf79840bfdcffe7bdac3 | 在服务器保存图片文件 | namespace Framework.CDQXIN.Utils
public class ImageHelper
public static int SavePicToServer(HttpPostedFile file, bool needAbbr, string imageLocalPath, ref string imageDbPath, int[] width, string[] suffix, ref string errorMsg)
{
return SavePicToServer(file, imageLocalPath, ref imageDbPath, needAb... | 1 |
51213ce8e0722ad266266cc3c7f8f6e6 | 8f56388ceb534f7e5a22f506db56cf0c | Verify that if the path is a folder, we process all files in the folder | mock_mod.get_folders.return_value = (200, {})
req = APIRequestFactory().post('', {'test': 'data'})
response = views.file_get_folders(req)
mock_mod.get_folders.assert_called_with(QueryDict('test=data')) | 0 |
d59f18b5a427658166891cd7ced41cd6 | 619e5102200a05942f60a5b9b0b2548b | 调用类中打开端口函数,使用协程打开指定端口 | try:
socket.setdefaulttimeout(2)
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((self.host,port))
sock.close()
self.open_port_list.append(str(port))
return
except IOError as e:
return | 0 |
33bf501aa8cb9336364d2c98ea7568ce | e9f9719808c9625cd11ba39b8929670f | Convert device twin registration property to registration model | decoded_state = decoded_response.get("registrationState", None)
registration_state = None
if decoded_state is not None:
registration_state = RegistrationState(
device_id=decoded_state.get("deviceId", None),
assigned_hub=decoded_state.get("assignedHub",... | 1 |
7e62e9cee26d2e097ad2cb1285324353 | 943475d7794c961a98f383fa123e97e4 | 有玩家胡牌 | {
byte[] data1 = new byte[20];
byte[] data2 = new byte[20];
byte[] data3 = new byte[20];
byte[] data4 = new byte[20];
_sockets[0].Receive(data1);
_sockets[1].Receive(data2);
_sockets[2].Receive(data3);
_sockets[3].Re... | 1 |
7fdcc8b385090172c1b232f5d5d783af | 65b8c3f639e604b5884f5b35dbb03682 | @brief Display Decrypted Data | void Decrypt::displayOriginalData() const {
std::cout<<"\tThe original data is ";
for (int i=4;i<8;i++){
std::cout<<data[i]<<(i<7?" ":".\n");
}
} | 1 |
ad129082f13590554675fcf2e0cb0d95 | 17da710a7f5b56910c64a3151902613c | Actualiza la información de la canción. | let params = JSON.stringify(song);
let headers = new Headers({
'Content-Type':'application/json',
'Authorization': token
});
return this._http.put(this.url + 'update-songs/' + id, params, {headers: headers}).map(res => res.json());
} | 1 |
3033c3c6c4c9529733ab833fde3b9a62 | 06da14b457f2d88f754f04a055bed822 | Initialize the hash tables: mon_table, record_table, recov_q and
locks. | nchinit(void)
{
TAILQ_INIT(&nclruhead);
nchashtbl =
hashinit(desiredvnodes, HASH_LIST, M_CACHE, M_WAITOK, &nchash);
ncvhashtbl =
#ifdef NAMECACHE_ENTER_REVERSE
hashinit(desiredvnodes, HASH_LIST, M_CACHE, M_WAITOK, &ncvhash);
#else
hashinit(desiredvnodes/8, HASH_LIST, M_CACHE, M_WAITOK, &ncvhash);
#end... | 0 |
6f3b9947fb01c9792c688bde4c8e87e0 | 81759cf34d64a1229c249dc2f1ae6af1 | update the current map to the next map | if self.current >= len(self.map) - 1:
self.timer.stop()
return
self.current += 1
super().repaint() | 1 |
32f6c67fbc1f11781455cdbc3ec459a8 | 91e853c3eb213fe516abdf21733a9b6d | Returns the distorted waveforms. | class HCI_TestBench(gym.Env):
def _turbulence(self):
wf = self._turbulence_generator.forward(self._wavefront)
wf = self._demag.forward(wf)
return wf | 1 |
b2b31295de03b289f69f14de66423f38 | ae96188f1a93c4600ebffb51d551a608 | In-Order Traversal Search | class BinaryTree{
public Node midOrderSearch(int no){
if(root!=null){
return root.midOrderSearch(no);
}else {
System.out.println("BinaryTree is empty");
return null;
}
} | 1 |
fcd51c21c95af5fd72fd0247b83053fc | f0e5e4d1b46a9d7347e7e519a30a5eea | Gets the spaces that a user has the "member" role. | namespace Snippet.Controllers
[Route("api/[controller]/[action]")]
[ApiController]
[Authorize]
public class SpaceController : ControllerBase
[HttpPost]
public CommonResult GetUserManageSpaceList()
{
var userName = _userService.GetUserName();
var result = (from spa... | 1 |
5b08f7fa71e8e89a1a8c57ac9a9ab4af | cf3f2f0c7796c3b1a5e6c9be97722ecf | Gibt an, ob es sich bei dem Namen um einen weiblichen (true) oder männlichen
Namen (false) handelt. | public class GenderApiSelf
private boolean isNameUnisexOrNotFound() {
return this.isNameFemale() && this.isNameMale() || !this.isNameFemale() && !this.isNameMale();
} | 0 |
818ca35907a8d22970b728a2c1f36d73 | d07865e0caa31009b47a2b5f8b34ed30 | Returns a summary of insider transactions for the requested ticker. | def topsSSE(symbols=None, on_data=None, token='', version=''):
return _runSSE('tops', symbols, on_data, token, version) | 0 |
0748c39ad2d1be73a4080e5387b632d2 | d601f94791dd3ea42fac62071c36aaa7 | Given a 3x3 SO(3) matrix, compute its euler angles | sy = np.sqrt(R[0,0]*R[0,0]+R[1,0]*R[1,0])
singular = sy < 1e-6
if not singular:
rx = np.arctan2(R[2,1], R[2,2])
ry = np.arctan2(-R[2,0], sy)
rz = np.arctan2(R[1,0], R[0,0])
else:
rx = np.arctan2(-R[1,2], R[2,2])
ry = np.arctan2(-R[2,0], sy)
rz = 0
retu... | 1 |
fc2e26285756f071ceee7a3393b5bd0d | 24ad54474d05591a421975226463f242 | Registers a publisher address for a given endpoint type. | namespace SimpleDomain.Bus
EndpointAddress GetPublishingEndpointAddress(string fullNameOfEventType); | 0 |
33cdfebe987c0f4f785a651153008df7 | a855e12131310b8fdaa4a4f267ab0392 | Function settleWager either deducts the amount lost or adds the amount gained, depending on the argument | class Game
def dealer_loses(position)
unless position.war?
Account.transfer(@casino_funds, position.pot, position.pot.balance)
end
position.win
end | 0 |
1cfc79234da9da0b00c5fa5366556de9 | fce08cec9f2909de71c2673bcfd87347 | Called when [camera capture image available]. | @TargetApi(21)
public class Camera2 extends BaseCameraViewImpl
@Override
public void onReady() {
captureStillPicture();
} | 0 |
864526f34433092b306c675b56338889 | 56705466db22d10e5b078dd2ba61b03f | Extract attributes from opening blocks | try:
attr_hash = re.search("\{.+\}", haml_line).group(0)
attr_pairs = re.findall(',?\s*:(\w+)\s*=>\s*"(.+?)"\s*,?',
attr_hash)
for k, v in attr_pairs:
self.attrs[k] = set(v.split())
except AttributeError:
... | 1 |
1292fd7e31a2c40963de979756e614b9 | 720f14b54100f51a87db7d1c1d3b2072 | Responsible for the movement of the fourth car | {
width = 15;
height = 10;
color = colors[BLUE];
radius = 5.0;
DrawRoundRect(x2, y2, width, height, color, radius);
DrawRoundRect(x2 + width * 3, y2, width, height, color, radius);
DrawRoundRect(x2 + width * 3, y2 + height * 4, width, height, color, radius);
DrawRoundRect(x2, y2 + height * 4, width, height... | 0 |
cc0a2648cb9f928206b12131bfc5b1c3 | a248aa84bc7b6fb1aaab90b9f4564ffb | @brief Convert transaction to PSBT. | class RawTransactions:
def convert_to_psbt(self, hexstring: str, permitsigdata=None, iswitness=None) -> None:
return self.__rpc.batch(["converttopsbt", hexstring, permitsigdata, iswitness]) | 1 |
03c1dcc08e107005b7c939343d6a1836 | f5f0359a9b76b6d42366729e6f78ad2c | 宽度优先遍历二叉树,从左到右打印,分层遍历 | ArrayList<Integer> list = new ArrayList<>();
if (root == null) return list;
Queue<TreeNode> queue = new LinkedList<>();
queue.offer(root);
int nextLevel = 0;
int toBePrinted = 1;
while (!queue.isEmpty()) {
TreeNode node = queue.poll();
list... | 1 |
c20e6b0f9eb0e09c0a990616e0d63e74 | d369c2e9b09898dfa9554f2418a6a49a | Retrieves the number of hosted zones that are associated with the current Amazon Web
Services account. | @Generated("com.amazonaws:aws-java-sdk-code-generator")
public class AbstractAmazonRoute53Async extends AbstractAmazonRoute53 implements AmazonRoute53Async
@Override
public java.util.concurrent.Future<ListHostedZonesByNameResult> listHostedZonesByNameAsync() {
return listHostedZonesByNameAsync(new ListHoste... | 0 |
108b037df527b9ec0ec00751711f0406 | bb9d25061abc57e09567d728283ea84c | Devuelve un artículo al azar. | class CSDNArticle(Article):
def get_one(self):
return random.choice(self._article) | 1 |
aaab607dd16db466e96001be7bb27b95 | d28e3334534a16618ae42682703bf2ab | 判断是否是父级机构 | namespace LWLCX.Erds.Common
bool IsParent(T parent); | 1 |
d3fd07975d76b1e3a6ad1db18486d947 | 40f480a614d6c5088d5e68777f7c654a | Deletes every single booking from the repo | namespace WebApi.Controllers
[Route("api/bookings")]
public class BookingController : ControllerBaseApi
[HttpDelete]
[AuthorizationFilter]
public IActionResult Delete()
{
this.bookingLogic.Delete();
return Ok();
} | 0 |
0e34bb5ef5175bd838832ca632705d8b | e866e21851c1376964871a67ca60d1f0 | Parse the given XML and use the document element to create a Python instance. | class XbrlInstance:
def parse(doc, base_url=None):
i = XbrlInstance()
values = {}
ns = {
"ix": "http://www.xbrl.org/2013/inlineXBRL",
"xbrli": "http://www.xbrl.org/2003/instance",
"xbrldi": "http://xbrl.org/2006/xbrldi",
"xlink": "http://www.w3.org... | 1 |
ed87425e9709363aef75a726bacbb833 | 87afd625ba16e17c4b3005f63f2e6443 | devuelve un array con una cadena extra agregada al final | $contenido_nuevo = ‘ - Flat101’;
$title .= $contenido_nuevo;
return $title;
} | 0 |
7141b681ae0940593c284c98c966f660 | a5576b79fb47b7c3de2004fc02acfea9 | Rekursive Methode zum Zeichnen des Baumes | void rAufgabe::zeichnen()
{
Aufgabeschreiben();
if (nextAufgabe&&aktuelleAufgabennummer<24)
{
nextAufgabe->zeichnen();
}
} | 1 |
2a775dc9b0a58086138f69f2a951e73a | ad4edeefcd530a069cfc149b5ad153e2 | 获取随机手机的ID | public class ActivityUtils
public static String getRandomId() {
String result = "0";
for (int i = 0; i < 17; i++) {
Random random = new Random();
int a = random.nextInt(10);
result = result + a;
}
return result;
} | 0 |
b2510946da80dccdad71e12f63a4e4d0 | 9e06f60c828aeab0d8c47819700fe7a0 | This method returns the speed of the cluster in bits per second
speed in bps | zs_get_speed(struct zs_chanstate *cs)
{
int tconst;
tconst = zs_read_reg(cs, 12);
tconst |= zs_read_reg(cs, 13) << 8;
return (TCONST_TO_BPS(cs->cs_brg_clk, tconst));
} | 1 |
8a5c107586d4d7af57548fcb773f6394 | 8f2300d7c86c07e0980214f37a4cfe96 | Calculating the fitness value of each solution in the current population.
The fitness function calulates the sum of products between each input and its corresponding weight. | def fitness(x):
w = [0.0, 0.0, 0.1, 0.9, 0.0, 0.0, 0.1, 0.9]
return (x[:, :8] * w).sum(1) | 1 |
a59d09e0818465e6ec8e3a31075cc877 | 5cbcf87416417b4affe8be332bc96cff | 获取手机MCC码 | public class CommonDeviceUtil
public static String getMNC(Context context) {
return mncString;
} | 0 |
86395d558a6b49cbd4411e69c718662a | e1fc80f76e2f1ebe218edf1790ad4278 | Returns fourth vertex' coordinates. | def getParallelogram4th(cornerB,cornerC,cornerA):
mid= mid_point(cornerB, cornerC)
return (int(2*mid[0] - cornerA[0]),int(2*mid[1]-cornerA[1])) | 1 |
a8919a558c6d15cc4aa8fc012c750369 | d6056d26b80f4a48a8a92611a7969a3d | Gets the card manager.<br>
获取CardManager
CardManager对象的引用 | public class CasinoCardDAO extends BaseDAO implements ICasinoCardDAO
public CasinoCardMapper getCasinoCardMapper() {
return casinoCardMapper;
} | 0 |
0d53ba7f91a30ebb5591695b92487809 | b92ea7ddd9942345969ce863751704f6 | Sets the beta of this OneOfAdvancedConceptsPorousMediums. | key = '_Beta__p'
if key in jsonObject:
p = int(jsonObject[key])
key = '_Beta__q'
if key in jsonObject:
q = int(jsonObject[key])
key = '_Beta__l'
if key in jsonObject:
l = float(jsonObject[key])
key = '_Beta__width'
if ke... | 0 |
4fe5b88f29718c51f62c3db427ee2afb | d7d87c07c3e896bc3d81338f8f913721 | Figure out the gateway URL from the user configuration | {
$url = CE4WP_APP_GATEWAY_URL;
if ($url === '{GATEWAY_URL}') {
$url = 'https://app-gateway.creativemail.com/';
}
if (is_null($path)) {
return $url;
}
if (isset($path) && !empty($path)) {
return $url.$path;
}
return ... | 1 |
6034a916dbfd0096a0cac6f103305d12 | 55c8a1dcabaff2516f233db0f717ac11 | A fully connected layer (linear, relu, bn) plus additional l2 normalization. | def _bn_relu_conv(**conv_params):
filters = conv_params["filters"]
kernel_size = conv_params["kernel_size"]
strides = conv_params.setdefault("strides", 1)
kernel_initializer = conv_params.setdefault("kernel_initializer", "he_normal")
padding = conv_params.setdefault("padding", "same")
kernel_reg... | 0 |
e632262797fad09dcc43ee81525de52b | 1dee964f80e7f7eae02d257e595c92d8 | Function Name: PIXY2UART_GetChar
Returns the last received byte of data. PIXY2UART_GetChar() is
designed for ASCII characters and returns a uint8 where 1 to 255 are values
for valid characters and 0 indicates an error occurred or no data is present.
None.
Character read from UART RX buffer. ASCII characters from 1 to 2... | {
volatile static u8 Local_u8Data = 0;
#if (UART2_ENABLE == 1)
Local_u8Data = Global_u8UART2Buffer[0];
if(Local_u8Data)
{
for(u8 i = 0; i<Global_u8UART2Buffer_Index; i++)
{
Global_u8UART2Buffer[i] = Global_u8UART2Buffer[i+1];
}
Global_u8UART2Buffer_Index--;
}
#endif
return Local_u8Data;
} | 1 |
22714f8ae45aca5068ec195359c99060 | 29ed80a495a0b427bfb0e8ed31739bda | Funkcja sprawdzająca istnienie użytkownika o podanym loginie i haśle. | function users_get_valid_user($login, $password)
{
$user = users_find_by_login($login);
if ($user && $user['pass_hash'] === users_hash_password($password, $user['salt'])) {
return $user;
}
return false;
} | 1 |
4307151fc3e12d2cf22e0565488ddddd | 87307502b784e4a152aaa9c414f5c3f9 | Iterates through all the characters in a word, and removes any that are not letters or digits. | char *removeSequences(char *word) {
char *updatedWord = calloc(1, sizeof(word));
int i = 0, j= 0;
for (; i < strlen(word) ; i++) {
if (!iscntrl(word[i]) && !ispunct(word[i]) &&!isspace(word[i]))
updatedWord[j++] = word[i];
}
updatedWord[strlen(word)] = '\0';
return updated... | 0 |
74357914c8e5057f4323da0ae890aed5 | 80fa6721e31b3db0aeeb294b1d3c7885 | Инициализирует спрайт с изображением бытовки. | try {
bspawnImage = ImageIO.read(loader.getResource("/images/bspawn" + ".png"));
bspawnImage = bspawnImage.getScaledInstance((int)(3 *Block.BLOCK_SIZE), (int)(3 *Block.BLOCK_SIZE), 10);
} catch (IOException e) {
e.printStackTrace();
}
} | 1 |
37e3353885163885e15b3df2177ad7f1 | fefd054dee9abac6e0a27954d415b30f | Getter method for enabled, mapped from YANG variable /sampling/sflow/config/enabled (boolean)
YANG Description: Enables or disables sFlow sampling for the device. | class Steps(Base):
def Enabled(self):
return self._get_attribute(self._SDM_ATT_MAP["Enabled"]) | 1 |
531f10ce1645180eb3bdf7672df6d181 | dcbe0895801c4d95d0809fa43217cf14 | Helper method used to populate a menu label in the most minimal manner
such that it is valid. | public class UISideMenu
private Label getMenuBtnLabel(String title) {
Label btnLabel = new Label(title);
btnLabel.getStyleClass().add(STYLECLASS_BTN_LABEL);
return btnLabel;
} | 1 |
4afcbb30075c621461c9bad84f081352 | 6dd36484ff3cb2397f1ec17c5ff7d77d | 打开创建进程窗口,开始创建进程 | {
using (ProcessSearchFrm frm = new ProcessSearchFrm())
{
frm.ShowDialog();
}
} | 0 |
1ca6499069f94be2c3ee0cad6019568e | 04560db6840a6d289051ac8c17db87ce | 유튜브 플레이어 생성 | function genPlayer(id) {
return new YT.Player('player', {
width: '100%',
height: '100%',
host: 'http://www.youtube-nocookie.com',
videoId: id,
playerVars: {
origin: window.location.host,
'playsinline': 1,
'modestbranding': 1,
'd... | 1 |
38ea0f67989499802daea468d4cee177 | 888b2f2a8320ed7382a937b9b26c1dfd | set x.y screen coordinates for selected cell | @SuppressWarnings("serial")
public class ChessBoard extends Container{
public void dispSelectionSq(int xIn, int yIn){
dispSlSq = 1;
slX = xIn;
slY = yIn;
} | 1 |
af108cbc1c41ecafb229b9a128f0979d | 3f8be2a5d21c779ad255c1f3d7abe3cf | 取消暂停指定容器 | func DockerUnpause(id string) (err error) {
err = dockerClient.UnpauseContainer(id)
if err != nil {
log.Printf("unpause container error: %v\n", err)
return
}
return
} | 1 |
48f0a63c00ef06160bb9c9908ea52e17 | 1178aae3ba3e455867728229ae2dfb95 | Method to get the Table object for the content type from the table object. | class TZ_PortfolioModelArticle extends JModelAdmin
public function getTable($type = 'Content', $prefix = 'JTable', $config = array())
{
return JTable::getInstance($type, $prefix, $config);
} | 1 |
f6676f1cb42353dc39e56dc590ea2d80 | a116044b54f19d63f769f110d571b741 | 根据营销活动ID集合查询所有的商品信息(包括已删除)(店铺自己创建的商品没有推送操作,不查询店铺自创的商品) | @Component
public class PromotionManager
public List<Promotion> queryPromotionByCondition(String marketingActivityId) {
QueryWrapper<Promotion> queryWrapper = new QueryWrapper<>();
queryWrapper.eq(Promotion.FieldNames.isDeleted.getTableFieldName(),PromoConst.IsDelete.IS_DELETE_CD_0.getCode());
q... | 0 |
bd36cfe4f2f2d5674ad930eb2250435d | 67281acecb4890164de076d11439f00c | 코드 객체의 복사 객체를 반환한다. this 객체가 가지고 있는 속성 중 자식 객체에 해당하는 속성은 복사 대상에서 제외한다. | class ChargeCode
def deep_clone
clone_charge_code = self.clone
clone_charge_code.id = self.id
clone_charge_code.service_provider = self.service_provider
self.downlink_block_infos.each do |downlink_block_info|
clone_downlink_block_info = downlink_block_info.clone
clone_downlink_block_info.id ... | 0 |
4e102bc0305c60b8e0aa8bda38fd5ad3 | 798bc3f5524b9b86f4fce747fe89e399 | SGD方法梯度下降,更新权重𝜃 | global w
score = np.dot(w.T, X[:, 0:m])
h = activation(score)
delta = (h-y[:,0:m])
g = alpha / m * np.dot(X[:, 0:m], delta.T)
w -= g | 1 |
2158df806b9ba3343a5b534ed0044bfd | 290770bbbfa7b7e10c2a834247884674 | 根据手机号生成第三方交易ID (32位)<br>
格式:TXphone_yyyymmddhh24miss_三位随机字符串(数字,大小写字母)<br>
举例:TX13444444444_201804021026_a8X | public class OrderUtils
public static String generateTransactionId(String phone) {
boolean checked = RegExpUtils.check(phone, RegExpUtils.p_mobilephone);
if (!checked) {
throw new RuntimeException("手机号[" + phone + "]格式有误");
}
Random random = new Random();
StringBuffer sb = new StringBuffer(32);
sb.append... | 1 |
581b68805e654948a912ada5b3e89927 | b2bb8863c0d74f8eca96fb6ba8791a1f | pure functional version of dict.update that returns a new instance | def update_dict(d, e, copy=True):
if copy:
d = d.copy()
d.update(e)
return d | 1 |
3e87f73065ee6152176a548daea6fc13 | 591d96c951a2d252557005bdd355c4fd | Rule that the task holding it cannot overlap with a defined set of intervals | def NoOverlap(tasks=None, *, origins=None, lengths=None, zero_ignored=False):
if tasks is not None:
assert origins is None and lengths is None
tasks = list(tasks) if isinstance(tasks, (tuple, set, frozenset, types.GeneratorType)) else tasks
if len(tasks) <= 1:
warning("A constrai... | 1 |
ab92e9fe8b86c17721690a1f6d7170a1 | dc71f82d537c0bfb0043cfbc40890491 | 加入新任务,返回当前任务数 | public class TaskHelper
public <T extends ITask> int add(T task){
return taskQueue.add(task);
} | 1 |
dc0779f97cbfd17750dee2d25db59df1 | 22d6299540998bfb0a78bf17245af9a1 | Create a DFS client instance from a given URL; initialize it from the configuration.
<p/>
This method uses {@link FileSystem#newInstance(URI, Configuration)} to create a new
instance, rather than return a cached one. This is to eliminate race conditions
across threads of the kind that surfaced in
<a href="http://jira.s... | Configuration conf = new Configuration();
fileSystem = FileSystem.get(URI.create(hdfsUrl),conf);
return fileSystem;
} | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.