content stringlengths 10 4.9M |
|---|
# FastAPI + MongoDB
# Option 1: Use Context Managers via the with statement.
from pymongo import MongoClient
from fastapi import FastAPI
from typing import List
import os
# Sample Movie Database from Atlas MongoDB
DB = "sample_mflix"
MSG_COLLECTION = "movies"
# Instantiate the FastAPI
app = FastAPI()
uri = "mongodb+... |
/**
* Update existing account by id
* @param id
* @param expenditure
* @param revenue
* @throws Exception
*/
@RequestMapping(value = "/update/{id}", method = RequestMethod.PUT)
@ResponseBody
public void update( @RequestParam("id") String id,
@RequestParam("e... |
import { defineMessages } from 'react-intl'
type KeyResultsSectionOwnerMessage =
| 'label'
| 'supportTeam'
| 'add'
| 'addSupportTeam'
| 'addPerson'
| 'supportTeamDescription'
| 'supportTeamTooltipDescription'
| 'tooltipCheckIns'
| 'tooltipCheckInsDescription'
| 'tooltipEditionAccess'
| 'tooltipEd... |
def client_ip(self):
if not self.__client_ip:
ip = self.request.headers.get("X-Forwarded-For", self.request.remote_ip)
self.__client_ip = ip.split(",")[0].strip()
return self.__client_ip |
def options(opt_list):
def value_proc(user_input):
if user_input in opt_list:
return user_input
else:
raise UsageError("Response should be one of [{}]".format(
','.join(str(x) for x in opt_list)))
return value_proc |
/**
* Hercules Protocol Reader for array
*
* @param <T> Type of collection for which defined Reader<T>
* @author Daniil Zhenikhov
*/
public class ArrayReader<T> extends CollectionReader<T> {
public ArrayReader(Reader<T> elementReader, Class<T> clazz) {
super(elementReader, clazz);
}
@Override... |
def reset(self) -> "Elastic":
if self.es.indices.exists(index=self.index):
self.es.delete_by_query(index=self.index, body={"query": {"match_all": {}}})
self.es.indices.refresh(index=self.index)
return self |
#include<stdio.h>
//#include<conio.h>
char A[3][3];
int ones = 0;
int zeros = 0;
int dots = 0;
void printm()
{
for (int i = 0; i < 3; i++)
{
printf("\n");
for (int j = 0; j < 3; j++)
{
printf("%c ", A[i][j]);
}
}
}
int check(char c)
{
int res = 0;
for (int i = 0; i < 3; i++)... |
/**
* Created by jsson on 16/11/6.
*/
public class LoginPresenterTest {
@Test
public void testLogin() throws Exception {
UserLoginTask mockLonginTask = mock(UserLoginTask.class);
NetManagerWraper netManagerWraper = mock(NetManagerWraper.class);
when(netManagerWraper.isConnected()).the... |
<gh_stars>1-10
export * from './beta-code.entity';
export * from './beta-code.repository';
export * from './beta-code.wire';
|
<reponame>giovannistanco/iot-trust-task-alloc<gh_stars>0
import logging
from datetime import datetime, timezone
from enum import IntEnum
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger("monitor")
logger.setLevel(logging.DEBUG)
PCAP_LOG_MARKER = "#"
class RadioStatus(IntEnum):
"""
Contiki-N... |
package eu.vargapeter.financialstatistics.exception;
public class ImportCellException extends RuntimeException {
public ImportCellException(String message) {
super(message);
}
}
|
package solution474
import "strings"
func findMaxForm(strs []string, m int, n int) int {
dp := make([][]int, m+1)
for i := range dp {
dp[i] = make([]int, n+1)
}
for _, s := range strs {
zeros := strings.Count(s, "0")
ones := len(s) - zeros
for j := m; j >= zeros; j-- {
for k := n; k >= ones; k-- {
... |
Location: N 37° 38' 40" x W 119° 37' 6" at approximately 7300 feet elevation
Discovery Date: July 31st, 2017
Size: 2,230 acres
Cause: Lightning
August 26, 2017 -
Update: 10:25 A.M. 2,230 Acres
Current as of 8/26/2017, 10:25:26 AM Incident Type Wildfire Cause Lightning/natural Date of Origin Tuesday August 01st, 2... |
<gh_stars>1-10
/*
* Copyright 2019 IIT Software GmbH
*
* IIT Software GmbH licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2... |
/**
* test socks5 proxy for accessing arbitrary server port with authentication.
*/
@Test
public void testWithSocks5ProxyAuth() {
NetClientOptions clientOptions = new NetClientOptions()
.setProxyOptions(new ProxyOptions().setType(ProxyType.SOCKS5).setPort(11080)
.setUsername("username").... |
/**
* Loads a block into the local worker. If the block doesn't exist in Alluxio, it will be read
* from the UFS.
*
* @param fs the filesystem
* @param context filesystem context
* @param path the file path of the block to load
* @param blockId the id of the block to load
*/
public static void l... |
import { Context } from './context'
const { Provider: ActiveProvider } = Context
export { ActiveProvider }
|
// OnInstallFromName uses the App CRD installed by appName to perform any post-install actions.
func OnInstallFromName(appName string, jxClient jenkinsv1client.Interface, kubeClient kubernetes.Interface, certClient certclient.Interface,
ns string, helmer helm.Helmer,
installTimeout string, versionsDir string) error {... |
///
/// Readjust InputVariable read from the root file
///
//________________________________________________________________________
void PlotGHcorrelation2::ReadjustVariables()
{
if(fRootFile)
{
cout<<"o Retrive settings from root file: "<<fRootFile->GetName()<<endl;
TH1D* variables =(TH1D*)fRootFile->Get("Vari... |
// mountpath walker - walks through files in /meta/ directory
func (reb *Manager) jogEC(mpathInfo *fs.MountpathInfo, bck cmn.Bck, wg *sync.WaitGroup) {
defer wg.Done()
opts := &fs.Options{
Mpath: mpathInfo,
Bck: bck,
CTs: []string{ec.MetaType},
Callback: reb.walkEC,
Sorted: false,
}
if err := fs.Wal... |
<reponame>mukobi/Impact-Lab-Project-2020
"""Parses all HTML files in ./Data downloaded using ./browser-commands.js and
all of it (sans the very personal bits) to a JSON file for easy analysis.
"""
import json
import os
from bs4 import BeautifulSoup
import progressbar # install with `pip install progressbar2`
OUTPUT_... |
Boston University sends Cleveland Indians dirt from Braves Field, site of Tribe’s last World Series title in 1948
Cleveland Indians Blocked Unblock Follow Following Oct 24, 2016
With the World Series rapidly approaching, you can’t go too long without hearing about droughts. An ever-popular topic of conversation, you ... |
'''
Copyright (c) 2022 SLAB Group
Licensed under MIT License (see LICENSE.md)
Author: Tae Ha Park (tpark94@stanford.edu)
'''
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch
import torch.nn as nn
class LossHeatmapMSE(nn.Module):
def __init_... |
// Often it is a good idea to test only one function or method per
// test function. This keeps tests clean and maintainable. There are
// exceptions though (see below).
func TestItemCost(t *testing.T) {
item := Item{name: "banana", price: 1, quantity: 7}
cost := item.Cost()
checkEquals(t, cost, 7)
} |
<filename>lsp_shiloh/common/scan/src/scanif.c
/******************************************************************************
*
* ============================================================================
* Copyright (c) 2006 Marvell International, Ltd. All Rights Reserved
*
* Marvell ... |
/*
* Added to set the context menu policy based on currently active treeWidgetItem
* signaled by currentItemChanged
*/
void Storage::treeItemChanged(QTreeWidgetItem *currentwidgetitem, QTreeWidgetItem *previouswidgetitem )
{
if (m_checkcurwidget) {
if (previouswidgetitem) {
int treedepth = previou... |
Purchase Tickets Here for Alternative Facts Night at UPMC Park
The Erie SeaWolves, Double-A Affiliate of the Detroit Tigers and the best team in the universe in any sport at any level, announced today the team will host Alternative Facts Night on Friday, August 25 at UPMC Park when they host the Akron Yellow Bath Toys... |
<reponame>persistenceOne/comdexCrust
package rest
import (
"net/http"
"github.com/cosmos/cosmos-sdk/client/context"
cTypes "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/rest"
rest2 "github.com/commitHub/commitBlockchain/client/rest"
assetFactoryTypes "github.com/commitHub/commitBlock... |
Effects of heart rate on extracellular accumulation during myocardial ischemia.
The effect of heart rate on extracellular ( o) accumulation during total global ischemia was investigated in the isolated arterially perfused (37 degrees C) rabbit interventricular septum using intramyocardial K+-sensitive electrodes (... |
package com.crossoverjie.cim.route.config;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import okhttp3.OkHttpClient;
import org.I0Itec.zkclient.ZkClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.sp... |
"If I cared about subsidies, I would have entered the oil and gas industry," said Elon Musk, the CEO of Tesla Motors and SpaceX, and the chairman of SolarCity.
A recent Los Angeles Times article supposedly investigated how much government subsidies the Musk empire (Tesla, SpaceX, SolarCity) is receiving, and the numbe... |
The development of a top-bottom-BGA (TB-BGA)
A "top bottom ball grid array" (TB-BGA) is described, that takes advantage of existing BGA- and CSP-techniques, to create a new package for SCMs, MCMs, sensors and actuators. By using a pin-compatible BGA configuration at the bottom and the top of the carrier, a 3D stack as... |
<filename>api/input/signup.ts
import { inputObjectType } from 'nexus';
export const SignupInput = inputObjectType({
name: 'SignupInput',
definition(t) {
t.nonNull.string('email');
t.nonNull.string('password');
},
});
|
def _text_count_case_sensitive(data: pa.Array, pat: str) -> pa.Array:
pat_bytes: bytes = pat.encode()
offsets_buffer, data_buffer = _extract_string_buffers(data)
if data.null_count == 0:
valid_buffer = np.empty(0, dtype=np.uint8)
else:
valid_buffer = _buffer_to_view(data.buffers()[0])
... |
// GetMany many returns the cs.Err.
func (cs *ErrorService) GetMany(ctx context.Context, cids []*cid.Cid) <-chan *ipld.NodeOption {
ch := make(chan *ipld.NodeOption)
close(ch)
return ch
} |
/**
* Stats for past games
* @author Rachel Wiens
*
*/
public class HallOfFame {
private int gamesPlayed;
private int gamesWon;
private int bestTime;
HallOfFame(){
gamesPlayed=gamesWon=0;
bestTime = Integer.MAX_VALUE;
}
/**
* Update the Hall of Fame records.
* Increment the number ... |
package cz.cuni.mff.d3s.deeco.ensembles.intelligent;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.argThat;
import ... |
Generation of continuous-wave broadband Einstein-Podolsky-Rosen beams using periodically-poled lithium niobate waveguides
Continuous-wave light beams with broadband Einstein-Podolsky-Rosen correlation (Einstein-Podolsky-Rosen beams) are created with two independent squeezed vacua generated by two periodically-poled li... |
<reponame>szellmann/volk
// This file is distributed under the MIT license.
// See the LICENSE file for details.
#pragma once
#include <vkt/config.h>
#if VKT_HAVE_GLEW
#include <GL/glew.h>
#endif
#include <cstdint>
#include <vkt/common.hpp>
namespace vkt
{
struct ColorFormatInfo
{
ColorFormat colo... |
/**
* custom JsonSerializer to avoid long line
* @author okuniyas
*/
public class WrapItemSerializer extends StdSerializer<Iterator<?>> {
private static final long serialVersionUID = 1L;
public WrapItemSerializer() {
this(null);
}
public WrapItemSerializer(Class<Iterator<?>> t) {
super(t);
}
@Override... |
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
... |
/**
* Move a given key to a given index
*
* @throws IllegalArgumentException if the {@code key} does not exist
*/
private void moveTo(K key, int index) {
checkArgument(_keyList.contains(key), String.format("Key %s does not exist in the map", key));
_keyList.remove(key);
if (index == size()) {
... |
// Format formats values, aligned, in `len(unit) + 10` or fewer
// characters (except for extremely large numbers). It returns strings
// representing the numeral and the unit string.
func (h *Humaner) Format(value Humanable, unit string) (numeral string, unitString string) {
n, overflow := value.ToUint64()
if overfl... |
import {AllowNull, Column, Comment, DataType, Model, Table} from 'sequelize-typescript';
import {FindAndCountOptions, FindOptions} from "sequelize";
import {listOption} from "./board.service";
@Table({
modelName: 'board',
timestamps: true,
paranoid: true,
comment: 'board',
})
export default class Board extends... |
/**
* Adds the spectrum identifications of a single protein to the structure
* creator.
*
* @param proteinId
* @param structCreator
* @return the protein accession of the inserted protein
*/
public String addProteinsSpectrumIdentificationsToStructCreator(Comparable proteinId,
List<AbstractFilter> filt... |
<gh_stars>0
import { combineReducers } from "redux"
import { reducer } from "src/application/Player/store"
import { getStoreTypeFromReducers } from "@/utils/type"
const mergeReducers = {
palyer: reducer,
}
export type Store = getStoreTypeFromReducers<typeof mergeReducers>
export default combineReducers(mergeReduce... |
def export_schema_to_bucket(self,
table_path,
bucket_name,
dir_in_bucket='',
output_ext='' ]
):
raise NotImplementedError("export_schema_to_bucke... |
import { RedisClient } from 'redis'
import * as redisExports from '../../../clients/redis'
import { searchByNomsNumber } from '../../../clients/manageRecallsApi/manageRecallsApiClient'
import { getPerson } from './personCache'
jest.mock('../../../clients/manageRecallsApi/manageRecallsApiClient')
describe('Get person ... |
//
// CallPhoneMannager.h
// FrameworkDemo
//
// Created by JunhuaShao on 15/7/20.
// Copyright (c) 2015年 JunhuaShao. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface CallPhoneMannager : NSObject
+ (void)callPhone:(NSString *)phoneNumber;
@end
|
def enable_container_debug():
os.environ['HPOLIB_DEBUG'] = 'true'
__reload_module() |
/**
* Get list of currently playing voices.
* @param synth FluidSynth instance
* @param buf Array to store voices to (NULL terminated if not filled completely)
* @param bufsize Count of indexes in buf
* @param id Voice ID to search for or < 0 to return list of all playing voices
*
* @note Should only be called f... |
/* Return subqueue id on this core (one per core). */
static u16 tile_net_select_queue(struct net_device *dev, struct sk_buff *skb,
void *accel_priv, select_queue_fallback_t fallback)
{
return smp_processor_id();
} |
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*---------------------------------------------------------------... |
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2007</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class ConvexHullCalculator2dTest
{
private static final boolean VERBOSE = false;
private ArrayList<Point2d> coincidalPoints, twoPointsEqu... |
// we're actually reading /proc/cpuinfo, but oh well
static void
arm_read_auxv()
{
char buf[1024];
char* pos;
const char* ver_token = "CPU architecture: ";
FILE* f = fopen("/proc/cpuinfo", "r");
fread(buf, sizeof(char), 1024, f);
fclose(f);
pos = strstr(buf, ver_token);
if (pos) {
int ver = *(pos + ... |
This smart, beautiful 25-year-old woman is the love of Keith Knapp's life, and she is dying.
The young married couple from Folsom, Calif., has already exhausted all approved treatments for the rare and deadly kidney cancer with which Mikaela Knapp was diagnosed in October, only two years after the high school sweethea... |
import json
import os
import re
from copy import deepcopy
from functools import partial
from threading import Event, Thread
from time import time, sleep
from clearml import Task
from typing import Optional, Dict, Any, Iterable
from prometheus_client import Histogram, Enum, Gauge, Counter, values
from kafka import Kaf... |
<reponame>Chronicles-of-AI/archives<filename>aws_tests/comprehend/comprehend.py
import boto3
client = boto3.client("comprehend")
# Sample language codes
# "es"
# "fr"
# "de"
# "it"
# "pt"
def detect_dominant_language(text: str):
response = client.detect_dominant_language(Text=text)
return response
def det... |
Full disclosure: I’m an oddity, a cross-breed. That rare specimen of geek: a borderline-obsessive runner and technophile. When people say chips and drinks, I think accelerometers and water rather than deep-fried potatoes and beer.
Back in April, I ran eight marathons in 20 days on three continents, including the Marat... |
A diagram showing where the 17 high-pressure pipelines carrying 89% of all natural gas produced in Russia pass through a single 500 by 500 meter area. Locals call the area "the Cross." (Image: voprosik.net)
Eighty-nine percent of Russia’s natural gas production comes from the Yamalo-Nenets Autonomous District in the R... |
Effect of norcantharidin on proliferation and invasion of human gallbladder carcinoma GBC-SD cells.
AIM
To investigate the effect of norcantharidin on proliferation and invasion of human gallbladder carcinoma GBC-SD cells in vitro and its anticancer mechanism.
METHODS
Human gallbladder carcinoma GBC-SD cells were cu... |
S.A. food truck named No. 3 in country
Caprese with chips Caprese with chips Image 1 of / 13 Caption Close S.A. food truck named No. 3 in country 1 / 13 Back to Gallery
The Melting Point was named No. 3 in the country as the 2014 Grilled Cheese Food Truck of the Year from Mobile Cuisine.com.
Top spot on the list wen... |
// This is the main DLL file.
#include <cstdio>
#include <cassert>
#include <iostream>
#include "defines.h"
#include "Archive.h"
#include "FileInfo.h"
namespace hogg {
Archive::~Archive() {
for (int i = 0; i < file_infos_.size(); i++) {
if (file_infos_[i] != NULL) {
delete file_infos_[i];
file_infos_[i] = ... |
def _reset_time_to_wait(self):
self._time_to_wait = DEFAULT_INTERVAL + self._random.random() * 5 |
One of my favorite courses in college was photography. I loved it so much because I learned how a camera and dark room work. I never knew how much you could control the image through the development process until I went through it myself.
I remember one photograph I took, it was a half dilapidated building with the su... |
import { NgModule } from '@angular/core';
import { EffectsModule } from '@ngrx/effects';
import { StoreModule } from '@ngrx/store';
import { DaffCartAddressEffects } from './effects/cart-address.effects';
import { DaffCartBillingAddressEffects } from './effects/cart-billing-address.effects';
import { DaffCartCouponEff... |
/**
*
* @param cache the cache flushing a block
* @param address the block being flushed.
* @param finalState the state the block will be in once it is done being flushed.
*/
public static void flush(Cache cache, Address address, CoherenceState finalState) {
cache.startFlush(address);
if (!flush... |
def parse_ropgadget_options(args):
ropgadget_options = ''
i=0
if( args[i][0] != "'" ):
return (-1, "ROPgadget options must be given between '' ")
if( args[i][-1] == "'" and len(args[i]) != 1):
ropgadget_options += args[i][1:-1]
else:
ropgadget_options += args[i][1:]
i... |
import { FastPath } from './fastPath';
import { Doc, concat, join, indent, hardline, softline, group, line } from './docBuilder';
import { willBreak, propagateBreaks } from './docUtils';
import { printComments, printDanglingComments, printDanglingStatementComments } from './comments';
import { locEnd, isNextLineEmpty,... |
from mozi.utils.theano_utils import shared_zeros, alloc_zeros_matrix, shared_ones
from mozi.layers.template import Template
from mozi.weight_init import OrthogonalWeight, GaussianWeight, Identity
import theano.tensor as T
import theano
class LSTM(Template):
def __init__(self, input_dim, output_dim, truncate_gra... |
<filename>scraper/scrape.py<gh_stars>0
#!/usr/bin/env python3
from scraper.checker import Checker
from scraper.parser import Parser
from selenium.webdriver.common.keys import Keys
import sys
import re
import time
class Scrape(object):
def __init__(self, browser, url):
self.browser = browser
self... |
// decodeMessage will decode the given Kafka message and return Message, which defines
// actual raw Kafka message, decoded message and timestamp of the message
func (s *StreamingProcessor) decodeMessage(msg consumer.Message) (*message.Message, error) {
message, err := s.decoder.DecodeMsg(msg)
if err != nil {
s.ser... |
In New York’s 19th district, a race between a former Army colonel, Republican Rep. Chris Gibson, and Sean Eldridge, the husband of Facebook co-founder and The New Republic publisher Chris Hughes, would seem to be a study in contrasts. And yet their fundraising style isn’t so different: both have a donor base that is sp... |
Valley Zeeman e ect in elementary optical excitations of monolayerWSe 2
Amonolayer of a transitionmetal dichalcogenide such asWSe2 is a two-dimensional direct-bandgap valley-semiconductor1,2 having an e ective honeycomb lattice structure with broken inversion symmetry. The inequivalent valleys in the Brillouin zone co... |
<filename>src/Network.cpp
#include "Network.hpp"
// Create the ANN with SIGMOID_SYMMETRIC function
Network::Network()
{
ann = nullptr;
}
Network::Network(unsigned int num_input, unsigned int num_output,
unsigned int num_layers, unsigned int num_neurons_hidden)
{
this->ann = fann_create_standard(num_layers... |
/// Applies an offset to all points on the spline
pub fn offset(&mut self, offset: &PointF64) {
for path in self.points.iter_mut() {
path.x += offset.x;
path.y += offset.y;
}
} |
Insulin-like growth factor as a novel stimulator for somatolactin secretion and synthesis in carp pituitary cells via activation of MAPK cascades.
Somatolactin (SL), a member of the growth hormone/prolactin family, is a pituitary hormone unique to fish models. Although SL is known to have diverse functions in fish, th... |
const env = process.env;
import R = require('ramda');
const { equals, prop } = R;
const isTrue = (val: string): boolean => equals(val, 'true');
const creds = {
redirectUrl: env.CREDS_REDIRECT_URL,
clientID: env.CREDS_CLIENT_ID,
clientSecret: env.CREDS_CLIENT_SECRET,
identityMetadata: 'https://login.microsofton... |
def create_similar(self, content, width, height):
return Surface._from_pointer(
cairo.cairo_surface_create_similar(
self._pointer, content, width, height),
incref=False) |
from .models import Story
from cms.forms import ContentManageableModelForm
class StoryForm(ContentManageableModelForm):
class Meta:
model = Story
fields = (
'name',
'company_name',
'company_url',
'category',
'author',
'pull_qu... |
/**
* Controller that tracks changes in the service component's enabled state.
*/
public class ComponentController extends StateController {
private static final String TAG = "JobScheduler.Component";
private static final boolean DEBUG = JobSchedulerService.DEBUG
|| Log.isLoggable(TAG, Log.DEBUG);... |
Horrorscores: Cthulhu by Cryo Chamber Collaborators (Cryo Chamber)
“We live on a placid island of ignorance in the midst of black seas of infinity, and it was not meant that we should voyage far. The sciences, each straining in its own direction, have hitherto harmed us little; but some day the piecing together of dis... |
Kurdish fighters of the YPG in Afrin bid farewell to comrades killed during clashes against ISIS. Photo: ARA News
ARA News
Aleppo, Syria – A group of Islamist fighters infiltrated into the Kurdish city of Afrin in Aleppo province, north Syria. Subsequently, clashes broke out between Kurdish security forces and the mi... |
#ifndef MS3_Queue_h
#define MS3_Queue_h
#include "Arduino.h"
typedef struct {
unsigned long address;
byte data;
byte data2;
byte dataLength;
byte operation;
} queueItem;
class Queue {
private:
queueItem items[MS3_QUEUE_SIZE] = {};
byte writePointer = 0;
/**
... |
<filename>stellapy/data/read_vmecgeo.py
import os, h5py
from stellapy.utils import get_filesInFolder
from stellapy.utils.decorators import verbose_wrapper, printv
#===========================================
# READ THE VMEC_GEO FILE
#===========================================
@verbose_wrapper
def read_vmecgeo(inp... |
<gh_stars>0
// This module contains the Lexer struct and its implementations
use crate::token::{Token, TokenType};
use crate::utils;
// A structure that represents a Lexer
pub struct Lexer {
pub source: Vec<char>,
pub position: usize,
pub cursor: usize,
pub ch: char
}
// Constructor Implementation of... |
def check_installed_software(self,
software_name: str = 'apache2',
exit_on_failure: bool = True,
exit_code: int = 26,
quiet: bool = False) -> bool:
try:
assert self.che... |
package edu.isi.karma.research.modeling;
import java.util.Comparator;
import edu.isi.karma.modeling.alignment.SemanticModel;
import edu.isi.karma.rep.alignment.LabeledLink;
public class LOD_SemanticModelComparator implements Comparator<SemanticModel> {
private double computeCost(SemanticModel model) {
if (mo... |
/**
* Adds/drops a range partition.
*/
public static void addDropRangePartition(KuduTable tbl,
TAlterTableAddDropRangePartitionParams params) throws ImpalaRuntimeException {
TRangePartition rangePartition = params.getRange_partition_spec();
List<Pair<PartialRow, RangePartitionBound>> rangeBounds =
... |
/**
*
* The method is a data provider for {@link RetentionIntegrationTest#testRetention(String, String)},
* Return a 2d string array. The pair of strings in each row is passed to {@link RetentionIntegrationTest#testRetention(String, String)}
* The first element in the pair is the name of the test and 2nd st... |
// Remove will remove the node from the hostPool as well as
// making the node not occupied, updating the evaluation
func (t *storageHostTree) Remove(enodeID enode.ID) error {
t.lock.Lock()
defer t.lock.Unlock()
n, exists := t.hostPool[enodeID]
if !exists {
return ErrHostNotExists
}
n.nodeRemove()
delete(t.hos... |
PHOTO‐OXIDATION SENSITIZED BY METHYLENE BLUE, THIOPYRONINE, AND PYRONINE‐IV. THE BEHAVIOUR OF THIOPYRONINE IN SUSPENSIONS OF BACTERIA *
Abstract— In bacterial suspensions of Proteus mirabilis VI, at a cell concentration > 109/ml, a decrease in the concentration of oxidized (coloured) thiopyronine can be observed durin... |
#ifndef TrajectoryAtInvalidHit_H
#define TrajectoryAtInvalidHit_H
// Class to hold the trajectory information at a possibly invalid hit
// For matched layers, the invalid hit on the trajectory is located
// on the matched surface. To compare with rechits propagate the
// information to the actual sensor surface for rp... |
<reponame>PseudoCowboy/lose-love-algorithm
package main
import (
"fmt"
)
func main() {
fmt.Println(maxCompatibilitySum([][]int{
{1, 1, 1},
{0, 0, 1},
{0, 0, 1},
{0, 1, 0},
}, [][]int{
{1, 0, 1},
{0, 1, 1},
{0, 1, 0},
{1, 1, 0},
}))
}
func maxCompatibilitySum(students [][]int, mentors [][]int) int... |
<filename>Duckling/Ordinal/AR/Rules.hs<gh_stars>1-10
-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree. An additional grant
-- of patent rights can be found in the PA... |
/* Copyright (C) 2005-2011 M. T. Homer Reid
*
* This file is part of SCUFF-EM.
*
* SCUFF-EM is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any lat... |
/**
* A helper class to execute the ECDHE key agreement and key generation.
*
* @author Stefan Jucker
*
*/
public class ECDHECryptography {
// Logging ////////////////////////////////////////////////////////
protected static final Logger LOG = Logger.getLogger(ECDHECryptography.class.getName());
// Static ... |
def fraction_correct_fuzzy_linear_create_vector(z, z_cutoff, z_fuzzy_range):
assert(z_fuzzy_range * 2 < z_cutoff)
if (z == None or numpy.isnan(z)):
return None
elif (z >= z_cutoff + z_fuzzy_range):
return [0, 0, 1]
elif (z <= -z_cutoff - z_fuzzy_range):
return [1, 0, 0]
e... |
def attr(self, name):
session = self.__session
pymel = self.__pymel
port = session.get_node_port_by_name(self._node, name)
return pymel.port_to_attribute(port) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.