code stringlengths 12 2.05k | label_name stringclasses 5
values | label int64 0 4 |
|---|---|---|
def limited?
@query_op.limit > 0
end | Class | 2 |
it "updates all records matching selector with change" do
query.should_receive(:update).with(change, [:multi])
query.update_all change
end | Class | 2 |
def team_organize
Log.add_info(request, params.inspect)
team_id = params[:team_id]
unless team_id.blank?
begin
@team = Team.find(team_id)
rescue
@team = nil
ensure
if @team.nil?
flash[:notice] = t('msg.already_deleted', :name => Team.model_name.human)
... | Base | 1 |
def authenticate(*credentials, &block)
raise ArgumentError, 'at least 2 arguments required' if credentials.size < 2
if credentials[0].blank?
return authentication_response(return_value: false, failure: :invalid_login, &block)
end
if @sorcery_config.downcase_username_bef... | Base | 1 |
def drop
command dropDatabase: 1
end | Class | 2 |
def test_parse_memory_nil
assert_raises(ArgumentError) do
@parser.parse_memory(nil)
end
end | Base | 1 |
def update_images_order
Log.add_info(request, params.inspect)
order_ary = params[:images_order]
item = Item.find(params[:id])
item.images_without_content.each do |img|
class << img
def record_timestamps; false; end
end
img.update_attribute(:xorder, order_ary.index(img.id.... | Base | 1 |
def query(query)
if options[:consistency] == :eventual
query.flags |= [:slave_ok] if query.respond_to? :flags
mode = :read
else
mode = :write
end
reply = socket_for(mode).execute(query)
reply.tap do |reply|
if reply.flags.include?(:query_failure)
... | Class | 2 |
it "stores the collection" do
query.collection.should eq collection
end | Class | 2 |
def add_order_set_constraint(
session, resource_set_list, force=false, autocorrect=true
)
command = [PCS, "constraint", "order"]
resource_set_list.each { |resource_set|
command << "set"
command.concat(resource_set)
}
command << '--force' if force
command << '--autocorrect' if autocorrect
stdout, s... | Compound | 4 |
def week
Log.add_info(request, params.inspect)
date_s = params[:date]
if date_s.nil? or date_s.empty?
@date = Date.today
else
@date = Date.parse(date_s)
end
params[:display] = 'week'
end | Base | 1 |
it "with params as nil" do
cl = subject.build_command_line("true", nil)
expect(cl).to eq "true"
end | Base | 1 |
def setup
FactoryGirl.create(:host)
end | Class | 2 |
it "merges the old and new session's options" do
session.with(new_options) do |new_session|
new_session.options.should eq options.merge(new_options)
end
end | Class | 2 |
def self.from(stream)
header = stream.read 512
empty = (header == "\0" * 512)
fields = header.unpack UNPACK_FORMAT
new :name => fields.shift,
:mode => fields.shift.oct,
:uid => fields.shift.oct,
:gid => fields.shift.oct,
:size => fields.shift.oct... | Base | 1 |
def team_organize
Log.add_info(request, params.inspect)
team_id = params[:team_id]
unless team_id.blank?
begin
@team = Team.find(team_id)
rescue
@team = nil
ensure
if @team.nil?
flash[:notice] = t('msg.already_deleted', :name => Team.model_name.human)
... | Base | 1 |
def build_actions(actions, guardian, args)
return unless pending?
if guardian.can_approve?(target) || args[:approved_by_invite]
actions.add(:approve_user) do |a|
a.icon = 'user-plus'
a.label = "reviewables.actions.approve_user.title"
end
end
delete_user_actions(actions, r... | Class | 2 |
def test_edit
get :edit, {:id => Hostgroup.first}, set_session_user
assert_template 'edit'
end | Class | 2 |
def dup
session = super
session.instance_variable_set :@options, options.dup
if defined? @current_database
session.send(:remove_instance_variable, :@current_database)
end
session
end | Class | 2 |
def set_certs(params, request, session)
if not allowed_for_local_cluster(session, Permissions::FULL)
return 403, 'Permission denied'
end
ssl_cert = (params['ssl_cert'] || '').strip
ssl_key = (params['ssl_key'] || '').strip
if ssl_cert.empty? and !ssl_key.empty?
return [400, 'cannot save ssl certifica... | Compound | 4 |
it "returns the living socket" do
cluster.socket_for(:write).should eq socket
end | Class | 2 |
it "adds the credentials to the auth cache" do
cluster.login("admin", "username", "password")
cluster.auth.should eq("admin" => ["username", "password"])
end | Class | 2 |
it "adds the node to the master set" do
cluster.sync_server server
cluster.primaries.should include server
end | Class | 2 |
it "executes a count command" do
database.should_receive(:command).with(
count: collection.name,
query: selector
).and_return("n" => 4)
query.count
end | Class | 2 |
def secondaries
servers.select(&:secondary?)
end | Class | 2 |
it "should should include the IndirectionHooks module in its indirection" do
Puppet::FileServing::Metadata.indirection.singleton_class.included_modules.should include(Puppet::FileServing::IndirectionHooks)
end | Class | 2 |
def update(change, flags = nil)
update = Protocol::Update.new(
operation.database,
operation.collection,
operation.selector,
change,
flags: flags
)
session.with(consistency: :strong) do |session|
session.execute update
end
end | Class | 2 |
def kill
session.execute kill_cursor_op
end | Class | 2 |
def self.up
add_column :items, :source_id, :integer
add_column :addresses, :groups, :text
add_column :addresses, :teams, :text
add_column :workflows, :groups, :text
add_column :users, :figure, :string
add_column :groups, :xtype, :string
add_column :teams, :req_to_del_at, :datetime
... | Base | 1 |
it "removes the socket" do
cluster.should_receive(:remove).with(dead_server)
cluster.socket_for :write
end | Class | 2 |
def self.password_reset_via_token(token, password)
# check token
user = by_reset_token(token)
return if !user
# reset password
user.update!(password: password)
# delete token
Token.find_by(action: 'PasswordReset', name: token).destroy
user
end | Class | 2 |
def remove(server)
servers.delete(server)
end | Class | 2 |
def self.update_xorder(title, order)
if title.nil?
con = nil
else
con = ['title=?', title]
end
SqlHelper.validate_token([order])
User.update_all("xorder=#{order}", con)
end | Base | 1 |
def _call(env)
unless ALLOWED_VERBS.include? env["REQUEST_METHOD"]
return fail(405, "Method Not Allowed")
end
path_info = Utils.unescape(env["PATH_INFO"])
parts = path_info.split SEPS
parts.inject(0) do |depth, part|
case part
when '', '.'
depth
... | Base | 1 |
it 'does not include user or group archived messages' do
UserArchivedMessage.archive!(user.id, group_message)
UserArchivedMessage.archive!(user.id, private_message)
topics = TopicQuery.new(nil).list_private_messages_all(user).topics
expect(topics).to eq([])
GroupArchivedMessage.arch... | Class | 2 |
def instantiate variant, mac=nil
# Filenames must end in a hex representation of a mac address but only if mac is not empty
log_halt 403, "Invalid MAC address: #{mac}" unless valid_mac?(mac) || mac.nil?
log_halt 403, "Unrecognized pxeboot config type: #{variant}" unless de... | Pillar | 3 |
it 'fails when local logins is disabled' do
SiteSetting.enable_local_logins = false
get "/session/email-login/#{email_token.token}"
expect(response.status).to eq(500)
end | Class | 2 |
it "executes a distinct command" do
database.should_receive(:command).with(
distinct: collection.name,
key: "name",
query: selector
).and_return("values" => [ "durran", "bernerd" ])
query.distinct(:name)
end | Class | 2 |
func getGateway(ctx *statsContext) error {
gatewayID := helpers.GetGatewayID(&ctx.gatewayStats)
gw, err := storage.GetAndCacheGateway(ctx.ctx, storage.DB(), gatewayID)
if err != nil {
return errors.Wrap(err, "get gateway error")
}
ctx.gateway = gw
return nil
} | Class | 2 |
func (x *UpdateGroupRequest) Reset() {
*x = UpdateGroupRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_console_proto_msgTypes[37]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
} | Base | 1 |
func newSignV4ChunkedReader(req *http.Request) (io.ReadCloser, APIErrorCode) {
cred, seedSignature, region, seedDate, errCode := calculateSeedSignature(req)
if errCode != ErrNone {
return nil, errCode
}
return &s3ChunkedReader{
reader: bufio.NewReader(req.Body),
cred: cred,
seedSign... | Base | 1 |
func (p *HTTPClient) closeResponse() error {
var err error
if p.response != nil && p.response.Body != nil {
// The docs specify that if keepalive is enabled and the response body is not
// read to completion the connection will never be returned to the pool and
// reused. Errors are being ignored here because i... | Base | 1 |
func (m *Sub) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowUnmarshalmerge
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
... | Variant | 0 |
func doesPolicySignatureMatch(formValues http.Header) APIErrorCode {
// For SignV2 - Signature field will be valid
if _, ok := formValues["Signature"]; ok {
return doesPolicySignatureV2Match(formValues)
}
return doesPolicySignatureV4Match(formValues)
} | Class | 2 |
func sendCode(id string) (err error) {
a, err := account.SelectAccount(id, 0)
if err != nil {
logger.Error("发送验证码失败", zap.Error(err))
return
}
if len(a) == 0 {
return errors.New("账号不存在")
}
rand.Seed(time.Now().UnixNano())
c := strconv.FormatFloat(rand.Float64(), 'f', -1, 64)[2:6]
client.GetClient().Se... | Base | 1 |
func (svc Service) CountSoftware(ctx context.Context, opt fleet.SoftwareListOptions) (int, error) {
if err := svc.authz.Authorize(ctx, &fleet.Software{}, fleet.ActionRead); err != nil {
return 0, err
}
return svc.ds.CountSoftware(ctx, opt)
} | Class | 2 |
func (EmptyEvidencePool) Update(State, types.EvidenceList) {} | Class | 2 |
func LoadDir(dirname string) (*Plugin, error) {
data, err := ioutil.ReadFile(filepath.Join(dirname, PluginFileName))
if err != nil {
return nil, err
}
plug := &Plugin{Dir: dirname}
if err := yaml.Unmarshal(data, &plug.Metadata); err != nil {
return nil, err
}
return plug, nil
} | Class | 2 |
func doTmpfsCopyUp(m *configs.Mount, rootfs, mountLabel string) (Err error) {
// Set up a scratch dir for the tmpfs on the host.
tmpdir, err := prepareTmp("/tmp")
if err != nil {
return fmt.Errorf("tmpcopyup: failed to setup tmpdir: %w", err)
}
defer cleanupTmp(tmpdir)
tmpDir, err := ioutil.TempDir(tmpdir, "run... | Base | 1 |
func ZeroTierLeaveNetwork(c *gin.Context) {
networkId := c.Param("id")
service.MyService.ZeroTier().ZeroTierLeaveNetwork(networkId)
if len(networkId) == 0 {
c.JSON(http.StatusOK, model.Result{Success: oasis_err2.INVALID_PARAMS, Message: oasis_err2.GetMsg(oasis_err2.INVALID_PARAMS)})
return
}
c.JSON(http.Status... | Base | 1 |
func (m *M) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowAsym
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uin... | Variant | 0 |
func (*ListAccountsRequest) Descriptor() ([]byte, []int) {
return file_console_proto_rawDescGZIP(), []int{26}
} | Base | 1 |
func (*DeleteGroupRequest) Descriptor() ([]byte, []int) {
return file_console_proto_rawDescGZIP(), []int{17}
} | Base | 1 |
func resize(in []byte, n int) (head, tail []byte) {
if cap(in) >= n {
head = in[:n]
} else {
head = make([]byte, n)
copy(head, in)
}
tail = head[len(in):]
return
} | Base | 1 |
func (m *SourceContext) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowSourceContext
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
i... | Variant | 0 |
func (p *Profile) write() (pth string, err error) {
rootDir, err := utils.GetTempDir()
if err != nil {
return
}
pth = filepath.Join(rootDir, p.Id)
_ = os.Remove(pth)
err = ioutil.WriteFile(pth, []byte(p.Data), os.FileMode(0600))
if err != nil {
err = &WriteError{
errors.Wrap(err, "profile: Failed to wri... | Class | 2 |
func (p *Profile) writeConfWgQuick(data *WgConf) (pth string, err error) {
allowedIps := []string{}
if data.Routes != nil {
for _, route := range data.Routes {
allowedIps = append(allowedIps, route.Network)
}
}
if data.Routes6 != nil {
for _, route := range data.Routes6 {
allowedIps = append(allowedIps,... | Base | 1 |
func (*DeleteStorageObjectRequest) Descriptor() ([]byte, []int) {
return file_console_proto_rawDescGZIP(), []int{21}
} | Base | 1 |
func TestMaxDepthValidation(t *testing.T) {
s, err := schema.ParseSchema(interfaceSimple, false)
if err != nil {
t.Fatal(err)
}
for _, tc := range []struct {
name string
query string
maxDepth int
expected bool
}{
{
name: "off",
query: `query Fine { # depth 0
characters { ... | Class | 2 |
func isLoopbackURI(requested *url.URL, registeredURI string) bool {
registered, err := url.Parse(registeredURI)
if err != nil {
return false
}
if registered.Scheme != "http" || !isLoopbackAddress(registered.Host) {
return false
}
if requested.Scheme == "http" && isLoopbackAddress(requested.Host) && register... | Base | 1 |
func (x *LeaderboardList) Reset() {
*x = LeaderboardList{}
if protoimpl.UnsafeEnabled {
mi := &file_console_proto_msgTypes[24]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
} | Base | 1 |
func (evpool *Pool) flushConsensusBuffer() {
for _, ev := range evpool.consensusBuffer {
if err := evpool.addPendingEvidence(ev); err != nil {
evpool.logger.Error("failed to flush evidence from consensus buffer to pending list: %w", err)
continue
}
evpool.evidenceList.PushBack(ev)
}
// reset consensus b... | Class | 2 |
func (b *Builder) buildControlPlanePrefixRoute(prefix string, protected bool) (*envoy_config_route_v3.Route, error) {
r := &envoy_config_route_v3.Route{
Name: "pomerium-prefix-" + prefix,
Match: &envoy_config_route_v3.RouteMatch{
PathSpecifier: &envoy_config_route_v3.RouteMatch_Prefix{Prefix: prefix},
},
Ac... | Class | 2 |
func Render(tmpl string, s *types.Step) (types.StepSlice, error) {
buffer := new(bytes.Buffer)
config := new(types.Build)
velaFuncs := funcHandler{envs: convertPlatformVars(s.Environment)}
templateFuncMap := map[string]interface{}{
"vela": velaFuncs.returnPlatformVar,
}
// parse the template with Masterminds/... | Base | 1 |
func (s *Server) CheckDeletionToken(deletionToken, token, filename string) error {
s.Lock(token, filename)
defer s.Unlock(token, filename)
var metadata Metadata
r, _, err := s.storage.Get(token, fmt.Sprintf("%s.metadata", filename))
if s.storage.IsNotExist(err) {
return nil
} else if err != nil {
return err... | Base | 1 |
func (v *validator) ValidateSignature(auth kolide.Auth) (kolide.Auth, error) {
info := auth.(*resp)
status, err := info.status()
if err != nil {
return nil, errors.New("missing or malformed response")
}
if status != Success {
return nil, errors.Errorf("response status %s", info.statusDescription())
}
decoded... | Base | 1 |
func (m *Wilson) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCasttype
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wi... | Variant | 0 |
func compileRegexps(regexpStrings []string) ([]*regexp.Regexp, error) {
regexps := []*regexp.Regexp{}
for _, regexpStr := range regexpStrings {
r, err := regexp.Compile(regexpStr)
if err != nil {
return regexps, err
}
regexps = append(regexps, r)
}
return regexps, nil
} | Base | 1 |
func (x *UserList_User) Reset() {
*x = UserList_User{}
if protoimpl.UnsafeEnabled {
mi := &file_console_proto_msgTypes[48]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
} | Base | 1 |
func mountPropagate(m *configs.Mount, rootfs string, mountLabel string) error {
var (
dest = m.Destination
data = label.FormatMountLabel(m.Data, mountLabel)
flags = m.Flags
)
if libcontainerUtils.CleanPath(dest) == "/dev" {
flags &= ^unix.MS_RDONLY
}
// Mount it rw to allow chmod operation. A remount wi... | Class | 2 |
func main() {
if len(os.Args) < 3 {
fatal(usage)
}
cmd, filename := os.Args[1], os.Args[2]
ff := archiver.MatchingFormat(filename)
if ff == nil {
fatalf("%s: Unsupported file extension", filename)
}
var err error
switch cmd {
case "make":
if len(os.Args) < 4 {
fatal(usage)
}
err = ff.Make(filen... | Base | 1 |
s := strings.Map(func(c rune) rune {
switch c {
case ' ', '\t', '\n', '\f', '\r':
return c
}
return -1
}, p.tok.Data)
if s != "" {
p.addText(s)
}
case StartTagToken:
switch p.tok.DataAtom {
case a.Html:
return inBodyIM(p)
case a.Frameset:
p.addElement()
case a.Frame:
p.addEl... | Base | 1 |
func SetJWTSecret() {
currentSecret, jwtErr := FetchJWTSecret()
if jwtErr != nil {
jwtSecretKey = []byte(RandomString(64)) // 512 bit random password
if err := StoreJWTSecret(string(jwtSecretKey)); err != nil {
logger.FatalLog("something went wrong when configuring JWT authentication")
}
} else {
jwtSecre... | Variant | 0 |
func (m *Bar4) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowIssue530
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire... | Variant | 0 |
func (m *Nil) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowThetest
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |... | Variant | 0 |
func (err ErrInvalidCloneAddr) Error() string {
return fmt.Sprintf("invalid clone address [is_url_error: %v, is_invalid_path: %v, is_permission_denied: %v]",
err.IsURLError, err.IsInvalidPath, err.IsPermissionDenied)
} | Base | 1 |
func testExternalNameServiceInsecure(namespace string) {
Specify("external name services work over http", func() {
t := f.T()
f.Fixtures.Echo.Deploy(namespace, "ingress-conformance-echo")
externalNameService := &corev1.Service{
ObjectMeta: metav1.ObjectMeta{
Namespace: namespace,
Name: "externa... | Class | 2 |
func (x *RuntimeInfo_ModuleInfo) ProtoReflect() protoreflect.Message {
mi := &file_console_proto_msgTypes[50]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
} | Base | 1 |
func TestBuilder_BuildBootstrapAdmin(t *testing.T) {
b := New("local-grpc", "local-http", filemgr.NewManager(), nil)
t.Run("valid", func(t *testing.T) {
adminCfg, err := b.BuildBootstrapAdmin(&config.Config{
Options: &config.Options{
EnvoyAdminAddress: "localhost:9901",
},
})
assert.NoError(t, err)
... | Class | 2 |
func (p *OAuthProxy) IsValidRedirect(redirect string) bool {
switch {
case redirect == "":
// The user didn't specify a redirect, should fallback to `/`
return false
case strings.HasPrefix(redirect, "/") && !strings.HasPrefix(redirect, "//") && !invalidRedirectRegex.MatchString(redirect):
return true
case str... | Base | 1 |
func (x *UpdateGroupRequest) ProtoReflect() protoreflect.Message {
mi := &file_console_proto_msgTypes[37]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
} | Base | 1 |
func (x *ListSubscriptionsRequest) Reset() {
*x = ListSubscriptionsRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_console_proto_msgTypes[29]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
} | Base | 1 |
func (m *FieldMask) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowFieldMask
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
... | Variant | 0 |
func setCapabilities(spec *specs.Spec, keepCaps ...string) error {
currentCaps, err := capability.NewPid2(0)
if err != nil {
return errors.Wrapf(err, "error reading capabilities of current process")
}
if err := currentCaps.Load(); err != nil {
return errors.Wrapf(err, "error loading capabilities")
}
caps, err... | Base | 1 |
func (m *CustomDash) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowThetest
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
... | Variant | 0 |
func (m *UInt64Value) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowWrappers
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
... | Variant | 0 |
func (x *UserList) ProtoReflect() protoreflect.Message {
mi := &file_console_proto_msgTypes[39]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
} | Base | 1 |
func (m *CustomContainer) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowThetest
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx... | Variant | 0 |
func (m *FloatingPoint) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowMapsproto2
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdE... | Variant | 0 |
func (evpool *Pool) Update(state sm.State, ev types.EvidenceList) {
// sanity check
if state.LastBlockHeight <= evpool.state.LastBlockHeight {
panic(fmt.Sprintf(
"Failed EvidencePool.Update new state height is less than or equal to previous state height: %d <= %d",
state.LastBlockHeight,
evpool.state.LastB... | Class | 2 |
func TestResourceServer_ValidateAccessToken(t *testing.T) {
r := newMockResourceServer(t)
_, err := r.ValidateAccessToken(context.Background(), "myserver", sampleIDToken)
assert.Error(t, err)
} | Base | 1 |
func (g DashboardHandler) Append(router *mux.Router) {
if g.Assets == nil {
log.WithoutContext().Error("No assets for dashboard")
return
}
// Expose dashboard
router.Methods(http.MethodGet).
Path("/").
HandlerFunc(func(response http.ResponseWriter, request *http.Request) {
http.Redirect(response, reques... | Base | 1 |
func TestBuilder_BuildBootstrapStaticResources(t *testing.T) {
t.Run("valid", func(t *testing.T) {
b := New("localhost:1111", "localhost:2222", filemgr.NewManager(), nil)
staticCfg, err := b.BuildBootstrapStaticResources()
assert.NoError(t, err)
testutil.AssertProtoJSONEqual(t, `
{
"clusters": [
{
... | Class | 2 |
func (m *Bar8) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowIssue530
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire... | Variant | 0 |
ctx := log.WithContext(context.TODO(), func(c zerolog.Context) zerolog.Context {
return c.Str("config_file_source", configFile)
})
options, err := newOptionsFromConfig(configFile)
if err != nil {
return nil, err
}
ports, err := netutil.AllocatePorts(3)
if err != nil {
return nil, err
}
grpcPort := port... | Class | 2 |
func handleConnect(config *Config, pctx *goproxy.ProxyCtx) error {
sctx := pctx.UserData.(*smokescreenContext)
// Check if requesting role is allowed to talk to remote
sctx.decision, sctx.lookupTime, pctx.Error = checkIfRequestShouldBeProxied(config, pctx.Req, pctx.Req.Host)
if pctx.Error != nil {
return pctx.Er... | Base | 1 |
func newContainerInit(t initType, pipe *os.File, consoleSocket *os.File, fifoFd, logFd int) (initer, error) {
var config *initConfig
if err := json.NewDecoder(pipe).Decode(&config); err != nil {
return nil, err
}
if err := populateProcessEnvironment(config.Env); err != nil {
return nil, err
}
switch t {
case... | Base | 1 |
func (svc *Service) GetGlobalScheduledQueries(ctx context.Context, opts fleet.ListOptions) ([]*fleet.ScheduledQuery, error) {
if err := svc.authz.Authorize(ctx, &fleet.Pack{}, fleet.ActionRead); err != nil {
return nil, err
}
gp, err := svc.ds.EnsureGlobalPack(ctx)
if err != nil {
return nil, err
}
return s... | Class | 2 |
func isLoopbackURI(requested *url.URL, registeredURI string) bool {
registered, err := url.Parse(registeredURI)
if err != nil {
return false
}
if registered.Scheme != "http" || !isLoopbackAddress(registered.Host) {
return false
}
if requested.Scheme == "http" && isLoopbackAddress(requested.Host) && register... | Base | 1 |
func NewConcatKDF(hash crypto.Hash, z, algID, ptyUInfo, ptyVInfo, supPubInfo, supPrivInfo []byte) io.Reader {
buffer := make([]byte, len(algID)+len(ptyUInfo)+len(ptyVInfo)+len(supPubInfo)+len(supPrivInfo))
n := 0
n += copy(buffer, algID)
n += copy(buffer[n:], ptyUInfo)
n += copy(buffer[n:], ptyVInfo)
n += copy(bu... | Base | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.