text:
<?php
namespace SCSS\UserBundle\Traits;

trait UserTrait
{

    /**
     * @ORM\Column(type="string")
     * @Assert\NotBlank(message="Please enter your first name.", groups={"Registration", "Profile"})
     * @Assert\Length(
     *     min="3",
     *     minMessage="The name is too short.",
     *     groups={"Registration", "Profile"},
     *     max="255",
     *     maxMessage="The name is too long."
     * )
     */
    protected $firstName;

    /**
     * @ORM\Column(type="string")
     * @Assert\NotBlank(message="Please enter your last name.", groups={"Registration", "Profile"})
     * @Assert\Length(
     *     min="3",
     *     minMessage="The name is too short.",
     *     groups={"Registration", "Profile"},
     *     max="255",
     *     maxMessage="The name is too long."
     * )
     */
    protected $lastName;

    /**
     * @ORM\Column(type="string",length="1")
     * @Assert\NotBlank()
     * @Assert\Choice(choices = {"M", "F"})
     */
    protected $gender;

    /**
     * @ORM\Column(type="date")
     * @Assert\NotBlank()
     */
    protected $birthdate;

    /**
     * @ORM\ManyToOne(targetEntity="SCSS\EnrollmentBundle\Entity\PasselEnrollment", inversedBy="user")
     * @ORM\JoinColumn(name="active_enrollment_id", referencedColumnName="id", nullable=true)
     */
    protected $active_enrollment;

    /**
     * @var string
     *
     * @ORM\Column(name="facebookId", type="string", length=255, nullable=true)
     */
    protected $facebookId;

    /**
     * @var string
     *
     * @ORM\Column(name="googleId", type="string", length=255, nullable=true)
     */
    protected $googleId;

    /**
     * @var string
     *
     * @ORM\Column(name="linkedinId", type="string", length=255, nullable=true)
     */
    protected $linkedinId;

    /**
     * @var string
     *
     * @ORM\Column(name="twitterId", type="string", length=255, nullable=true)
     */
    protected $twitterId;

    /**
     * @var string
     *
     * @ORM\Column(name="foursquareId", type="string", length=255, nullable=true)
     */
    protected $foursquareId;

    /**
     * @var string
     *
     * @ORM\Column(name="avatar", type="string", length=255)
     */
    protected $avatar = '/bundles/scssuser/img/avatars/default.png';

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
    * @Gedmo\Slug(fields={"last_name", "first_name"})
    * @ORM\Column(length=128, unique=true)
    */
    protected $slug;

    /**
     * Get slug
     */
    public function getSlug()
    {
        return $this->slug;
    }

    /**
     * Set slug
     */
    public function setSlug($slug = null)
    {
        if (null == $slug) {
            $this->slug = str_replace(
                ' ',
                '-',
                $this->getName()
            );
        }

        return $this;
    }

    public function getName()
    {
        return $this->first_name.' '.$this->last_name;
    }

    /**
     * Get the full name of the user (first + last name)
     * @return string
     */
    public function getFullName()
    {
        return $this->getFirstName() . ' ' . $this->getLastname();
    }

    /**
     * Set active_enrollment
     *
     * @param  SCSS\EnrollmentBundle\Entity\PasselEnrollment $activeEnrollment
     * @return User
     */
    public function setActiveEnrollment(ActiveEnrollment $activeEnrollment = null)
    {
        $this->active_enrollment = $activeEnrollment;

        return $this;
    }

    /**
     * Get active_enrollment
     *
     * @return SCSS\EnrollmentBundle\Entity\PasselEnrollment
     */
    public function getActiveEnrollment()
    {
        return $this->active_enrollment;
    }

    /**
     * @param  string $facebookId
     * @return void
     */
    public function setFacebookId($facebookId)
    {
        $this->facebookId = $facebookId;
        $this->setUsername($facebookId);
        $this->salt = '';
    }

    /**
     * @return string
     */
    public function getFacebookId()
    {
        return $this->facebookId;
    }

    /**
     * @param Array
     */
    public function setFBData($fbdata)
    {
        if (isset($fbdata['id'])) {
            $this->setFacebookId($fbdata['id']);
            $this->addRole('ROLE_FACEBOOK');
        }
        if (isset($fbdata['first_name'])) {
            $this->setFirstName($fbdata['first_name']);
        }
        if (isset($fbdata['last_name'])) {
            $this->setLastName($fbdata['last_name']);
        }
        if (isset($fbdata['email'])) {
            $this->setEmail($fbdata['email']);
        }
    }

    /**
     * @param  string $firstName
     * @return User
     */
    public function setFirstName($firstName)
    {
        $this->first_name = $firstName;

        return $this;
    }

    /**
     * Get first_name
     *
     * @return string
     */
    public function getFirstName()
    {
        return $this->first_name;
    }

    /**
     * Set last_name
     *
     * @param  string $lastName
     * @return User
     */
    public function setLastName($lastName)
    {
        $this->last_name = $lastName;

        return $this;
    }

    /**
     * Get last_name
     *
     * @return string
     */
    public function getLastName()
    {
        return $this->last_name;
    }

    /**
     * Set googleId
     *
     * @param  string $googleId
     * @return User
     */
    public function setGoogleId($googleId)
    {
        $this->googleId = $googleId;

        return $this;
    }

    /**
     * Get googleId
     *
     * @return string
     */
    public function getGoogleId()
    {
        return $this->googleId;
    }

    /**
     * Set linkedinId
     *
     * @param  string $linkedinId
     * @return User
     */
    public function setLinkedinId($linkedinId)
    {
        $this->linkedinId = $linkedinId;

        return $this;
    }

    /**
     * Get linkedinId
     *
     * @return string
     */
    public function getLinkedinId()
    {
        return $this->linkedinId;
    }

    /**
     * Set twitterId
     *
     * @param  string $twitterId
     * @return User
     */
    public function setTwitterId($twitterId)
    {
        $this->twitterId = $twitterId;

        return $this;
    }

    /**
     * Get twitterId
     *
     * @return string
     */
    public function getTwitterId()
    {
        return $this->twitterId;
    }

    /**
     * Set foursquareId
     *
     * @param  string $foursquareId
     * @return User
     */
    public function setFoursquareId($foursquareId)
    {
        $this->foursquareId = $foursquareId;

        return $this;
    }

    /**
     * Get foursquareId
     *
     * @return string
     */
    public function getFoursquareId()
    {
        return $this->foursquareId;
    }

    /**
     * Set avatar
     *
     * @param  string $avatar
     * @return User
     */
    public function setAvatar($avatar)
    {
        $this->avatar = $avatar;

        return $this;
    }

    /**
     * Get avatar
     *
     * @return string
     */
    public function getAvatar()
    {
        return $this->avatar;
    }

    public function getUrl()
    {
        return $this->url;
    }
}


text: Initial crate release.

redpajama_set_name: RedPajamaGithub


text:
"""Database sub-commands"""
import os
import subprocess
import textwrap
from tempfile import NamedTemporaryFile

from airflow import AirflowException, settings
from airflow.utils import cli as cli_utils, db

def initdb(args):
    """Initializes the metadata database"""
    print("DB: " + repr(settings.engine.url))
    db.initdb()
    print("Done.")

def resetdb(args):
    """Resets the metadata database"""
    print("DB: " + repr(settings.engine.url))
    if args.yes or input("This will drop existing tables "
                         "if they exist. Proceed? "
                         "(y/n)").upper() == "Y":
        db.resetdb()
    else:
        print("Bail.")

@cli_utils.action_logging
def upgradedb(args):
    """Upgrades the metadata database"""
    print("DB: " + repr(settings.engine.url))
    db.upgradedb()

@cli_utils.action_logging
def shell(args):
    """Run a shell that allows to access metadata database"""
    url = settings.engine.url
    print("DB: " + repr(url))

    if url.get_backend_name() == 'mysql':
        with NamedTemporaryFile(suffix="my.cnf") as f:
            content = textwrap.dedent(f"""
                [client]
                host     = {url.host}
                user     = {url.username}
                password = {url.password or ""}
                port     = {url.port or ""}
                database = {url.database}
                """).strip()
            f.write(content.encode())
            f.flush()
            subprocess.Popen(["mysql", f"--defaults-extra-file={f.name}"]).wait()
    elif url.get_backend_name() == 'sqlite':
        subprocess.Popen(["sqlite3", url.database]).wait()
    elif url.get_backend_name() == 'postgresql':
        env = os.environ.copy()
        env['PGHOST'] = url.host or ""
        env['PGPORT'] = url.port or ""
        env['PGUSER'] = url.username or ""
        # PostgreSQL does not allow the use of PGPASSFILE if the current user is root.
        env["PGPASSWORD"] = url.password or ""
        env['PGDATABASE'] = url.database
        subprocess.Popen(["psql"], env=env).wait()
    else:
        raise AirflowException(f"Unknown driver: {url.drivername}")

@cli_utils.action_logging
def check(_):
    """Runs a check command that checks if db is available."""
    db.check()


text:
<?php

namespace App\DataTables;

use App\Models\Inventory;
use Illuminate\Support\HtmlString;
use Yajra\DataTables\EloquentDataTable;
use Yajra\DataTables\Services\DataTable;

class InventoryDataTable extends DataTable
{
    /**
     * Build DataTable class.
     *
     * @param mixed $query Results from query() method.
     * @return \Yajra\DataTables\DataTableAbstract
     */
    public function dataTable($query)
    {
        $dataTable = new EloquentDataTable($query);

        // $dataTable->addColumn('action', 'inventories.datatables_actions');
        $dataTable->editColumn('id', function ($model) {
            return new HtmlString('id) . '">' . $model->id . '');
        });

        return $dataTable;
    }

    /**
     * Get query source of dataTable.
     *
     * @param \App\Models\Inventory $model
     * @return \Illuminate\Database\Eloquent\Builder
     */
    public function query(Inventory $model)
    {
        return $model->newQuery()->with('supplier');
    }

    /**
     * Optional method if you want to use html builder.
     *
     * @return \Yajra\DataTables\Html\Builder
     */
    public function html()
    {
        return $this->builder()
                    ->columns($this->getColumns())
                    ->minifiedAjax()
                    // ->addAction(['width' => '80px'])
                    ->parameters([
                        'stateSave' => true,
                        'dom'     => 'Bfrtip',
                        'order'   => [[0, 'desc']],
                        'buttons' => [
                            'export',
                            'print',
                            'reset',
                            'reload',
                            'colvis',
                        ],
                    ]);
    }

    /**
     * Get columns.
     *
     * @return array
     */
    protected function getColumns()
    {
        return [
            'id' => ['title' => 'ID'],
            'supplier' => ['data' => 'supplier.name', 'name' => 'supplier.name'],
            'supplied_at' => ['title' => 'Date'],
            'total_amount',
            'paid_amount',
            'due_amount' => ['title' => 'Due'],
        ];
    }

    /**
     * Get filename for export.
     *
     * @return string
     */
    protected function filename()
    {
        return 'inventory_' . time();
    }
}


text:
        Home
        {{t.name}}
        Sync
        Settings

         0" data-toggle="tooltip" title="{{txsWaiting.length}} TXs waiting..">{{txsWaiting.length}}

        Account -

            <button class="btn btn-default btn-xs dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
            {{selectedAddress}}
            </button>

{{acc}}

Create

        {{balance}} Coins

        <button type="button" class="close" data-dismiss="modal">×</button>

Password for account

              <input type="text" class="form-control" ng-model="this.passModal" placeholder="Password">

                  <input type="checkbox" ng-model="this.autoUnlock"> Auto Unlock

        <button type="button" class="btn btn-default text-center" ng-click="modalSubmit()">Submit</button>


text:
import pytest

from marshmallow.exceptions import ValidationError

from polyaxon.polyflow.matrix import V1Hyperband
from polyaxon.polyflow.optimization import V1Optimization, V1OptimizationMetric
from polyaxon.utils.test_utils import BaseTestCase, assert_equal_dict

@pytest.mark.workflow_mark
class TestWorkflowV1Hyperbands(BaseTestCase):
    def test_hyperband_config(self):
        config_dict = {
            "kind": "hyperband",
            "maxIterations": 10,
            "eta": 3,
            "resource": {"name": "steps", "type": "int"},
            "resume": False,
            "metric": V1OptimizationMetric(
                name="loss", optimization=V1Optimization.MINIMIZE
            ).to_dict(),
            "params": {"lr": {"kind": "choice", "value": [[0.1], [0.9]]}},
        }
        config = V1Hyperband.from_dict(config_dict)
        assert_equal_dict(config.to_dict(), config_dict)

        # Raises for negative values
        config_dict["maxIterations"] = 0
        with self.assertRaises(ValidationError):
            V1Hyperband.from_dict(config_dict)

        config_dict["maxIterations"] = -0.5
        with self.assertRaises(ValidationError):
            V1Hyperband.from_dict(config_dict)

        config_dict["maxIterations"] = 3
        # Add numRuns percent
        config_dict["eta"] = -0.5
        with self.assertRaises(ValidationError):
            V1Hyperband.from_dict(config_dict)

        config_dict["eta"] = 2.9
        config = V1Hyperband.from_dict(config_dict)
        assert_equal_dict(config.to_dict(), config_dict)


text:
namespace blimp {

BlimpMessageOutputBuffer::BlimpMessageOutputBuffer(int max_buffer_size_bytes)
    : max_buffer_size_bytes_(max_buffer_size_bytes) {}

BlimpMessageOutputBuffer::~BlimpMessageOutputBuffer() {}

void BlimpMessageOutputBuffer::SetOutputProcessor(
    BlimpMessageProcessor* processor) {
  DVLOG(1) << "SetOutputProcessor " << processor;
  // Check that we are setting or removing the processor, not replacing it.
  if (processor) {
    DCHECK(!output_processor_);
    output_processor_ = processor;
    write_complete_cb_.Reset(base::Bind(
        &BlimpMessageOutputBuffer::OnWriteComplete, base::Unretained(this)));
    WriteNextMessageIfReady();
  } else {
    DCHECK(output_processor_);
    output_processor_ = nullptr;
    write_complete_cb_.Cancel();
  }
}

void BlimpMessageOutputBuffer::RetransmitBufferedMessages() {
  DCHECK(output_processor_);
  DVLOG(1) << "RetransmitBufferedMessages()";

  // Prepend the entirety of |ack_buffer_| to |write_buffer_|.
  write_buffer_.insert(write_buffer_.begin(),
                       std::make_move_iterator(ack_buffer_.begin()),
                       std::make_move_iterator(ack_buffer_.end()));
  ack_buffer_.clear();

  WriteNextMessageIfReady();
}

int BlimpMessageOutputBuffer::GetBufferByteSizeForTest() const {
  return write_buffer_.size() + ack_buffer_.size();
}

int BlimpMessageOutputBuffer::GetUnacknowledgedMessageCountForTest() const {
  return ack_buffer_.size();
}

void BlimpMessageOutputBuffer::ProcessMessage(
    std::unique_ptr<BlimpMessage> message,
    const net::CompletionCallback& callback) {
  DVLOG(2) << "OutputBuffer::ProcessMessage " << *message;

  message->set_message_id(++prev_message_id_);

  current_buffer_size_bytes_ += message->ByteSize();
  if (max_buffer_size_bytes_ < current_buffer_size_bytes_)
    DLOG(WARNING) << "Output Buffer Size exceeds " << max_buffer_size_bytes_
                  << "bytes. Current size: " << current_buffer_size_bytes_
                  << " bytes.";

  write_buffer_.push_back(
      base::MakeUnique<BufferEntry>(std::move(message), callback));

  // Write the message
  if (write_buffer_.size() == 1 && output_processor_) {
    WriteNextMessageIfReady();
  }
}

// Flushes acknowledged messages from the buffer and invokes their
// |callbacks|, if any.
void BlimpMessageOutputBuffer::OnMessageCheckpoint(int64_t message_id) {
  VLOG(2) << "OnMessageCheckpoint (message_id=" << message_id << ")";
  if (ack_buffer_.empty()) {
    LOG(WARNING) << "Checkpoint called while buffer is empty.";
    return;
  }
  if (message_id > prev_message_id_) {
    LOG(WARNING) << "Illegal checkpoint response: " << message_id;
    return;
  }

  // Remove all acknowledged messages through |message_id| and invoke their
  // write callbacks, if set.
  while (!ack_buffer_.empty() &&
         ack_buffer_.front()->message->message_id() <= message_id) {
    const BufferEntry& ack_entry = *ack_buffer_.front();
    current_buffer_size_bytes_ -= ack_entry.message->GetCachedSize();
    DCHECK_GE(current_buffer_size_bytes_, 0);
    VLOG(3) << "Buffer size: " << current_buffer_size_bytes_
            << " (max=" << current_buffer_size_bytes_ << ")";

    if (!ack_entry.callback.is_null()) {
      base::ThreadTaskRunnerHandle::Get()->PostTask(
          FROM_HERE, base::Bind(ack_entry.callback, net::OK));
    }

    ack_buffer_.pop_front();
  }

  // An empty buffer should have a zero-byte footprint.
  DCHECK(current_buffer_size_bytes_ > 0 ||
         (ack_buffer_.empty() && write_buffer_.empty()))
      << "Expected zero-length buffer size, was " << current_buffer_size_bytes_
      << " bytes instead.";
}

BlimpMessageOutputBuffer::BufferEntry::BufferEntry(
    std::unique_ptr<BlimpMessage> message,
    net::CompletionCallback callback)
    : message(std::move(message)), callback(callback) {}

BlimpMessageOutputBuffer::BufferEntry::~BufferEntry() {}

void BlimpMessageOutputBuffer::WriteNextMessageIfReady() {
  DVLOG(3) << "WriteNextMessageIfReady";
  if (write_buffer_.empty()) {
    DVLOG(3) << "Nothing to write.";
    return;
  }

  std::unique_ptr<BlimpMessage> message_to_write(
      new BlimpMessage(*write_buffer_.front()->message));
  DVLOG(3) << "Writing message (id="
           << write_buffer_.front()->message->message_id() << ", "
           << *message_to_write << ")";

  output_processor_->ProcessMessage(std::move(message_to_write),
                                    write_complete_cb_.callback());
  DVLOG(3) << "Queue size: " << write_buffer_.size();
}

void BlimpMessageOutputBuffer::OnWriteComplete(int result) {
  DCHECK_LE(result, 0);

  VLOG(2) << "Write result=" << net::ErrorToString(result);
  if (result == net::OK) {
    ack_buffer_.push_back(std::move(write_buffer_.front()));
    write_buffer_.pop_front();
    WriteNextMessageIfReady();
  }
}

}  // namespace blimp


text:
require 'test_helper'

class LoggerTest < Test::Unit::TestCase
  context "with connection that has logger" do
    setup do
      @output = StringIO.new
      @logger = Logger.new(@output)
      MongoMapper.connection = Mongo::Connection.new('127.0.0.1', 27017, :logger => @logger)
    end

    should "be able to get access to that logger" do
      MongoMapper.logger.should == @logger
    end

    should "be able to log messages" do
      MongoMapper.logger.debug 'testing'
      @output.string.include?('testing').should be_true
    end
  end
end


text:
import api from './api';

class PizzaService {
  static fetchAll() {
    return api
      .get(`/pizzas`);
  }

  static fetch(pizzaId) {
    return api.get(`/pizzas/${pizzaId}`);
  }

  static create(pizza) {
    return api.post(`/pizzas`, pizza);
  }

  static update(pizzaId, pizza) {
    return api.patch(`/pizzas/${pizzaId}`, pizza);
  }

  static delete(pizzaId) {
    return api.delete(`/pizzas/${pizzaId}`);
  }
}

export default PizzaService;


text:
using System;
using System.Threading;
using System.Net;

using Kast.Server.General;

using HumDrum.Operations;
using HumDrum.Collections;

namespace Kast
{
	/*Master TODO list (in no particular order)*/

	//TODO: Add list capabilities to client (list running names)
	//TODO: Handle all thrown exceptions
	//TODO: Fix the ton of port commands in the configuration file
	//TODO: Replace all Logger parameters with Logger constructor
	//TODO: Implement command builder interface for client
	//TODO: Make the configuration file more forgiving (missing key? Use default value)
	//TODO: Add "ObjectExists" exception for name clashes
	//TODO: Change Builder around to use inheritence of a Builder
	//TODO: Make an automatic generator for the default assets

	/* Very future TODOS */
	//TODO: Add scripting support (read arguments one-by-one as kast-client commands)
	//TODO: Add GUI support for client
	//TODO: Generate HTML documentation

	/// <summary>
	/// The entry point for the Kast program.
	/// </summary>
	class MainClass
	{
		/// <summary>
		/// Get help for a specific part of kast.
		/// </summary>
		/// <param name="part">The part of the program to get help for. Can be server or client.</param>
		public static string Help(string part){
			string helpMsg = "";

			if(part.Equals("server")){
				return ("The command \"kast server\" will start the server");
			}
			if (part.Equals ("client")) {
				helpMsg += "[] denotes a required argument. {} denotes optional ones. OR denotes choices\n";
				helpMsg += "Client commands templates are:\n";

				helpMsg += "kast client box [command] +{args comma,separated,args} {name boxName}\n";
				helpMsg += "kast client feed |[box syntax]| |[box syntax]| |{name feedName} {option all OR last}\n";
				helpMsg += "kast client hook |[box syntax]| target |{name hookName} {option first OR last OR innerRemove OR innerKeep}\n";
				helpMsg += "kast client unlist name\n";
				helpMsg += "In places where [box syntax] is accepted, @name is accepted to reference a currently running box in the relay";

			} else return Help();

			return helpMsg;
		}

		/// <summary>
		/// General help. This happens if no input is given on the command line.
		/// </summary>
		public static string Help(){
			string helpMsg = "";

			helpMsg += "Welcome to kast help.\n";
			helpMsg += "For more general help, type \"kast help server\" or \"kast help client\"\n";

			return helpMsg;
		}

		/// <summary>
		/// Either creates a server in this thread, or sends data to a running server.
		/// </summary>
		/// <param name="args">The command-line arguments.</param>
		public static void Main (string[] args)
		{
			//*
			Console.WriteLine ();

			// Help the user if they need it
			if (args.Length == 0 || args [0].Equals ("help")){
				if (args.Length > 1)
					Console.WriteLine (Help (args [1]));
				else
					Console.WriteLine (Help ());
				return;
			}

			// If it's not asking for help, server, or client, just exit.
			if (!(args [0].Equals ("server") || args [0].Equals ("client"))) {
				Console.WriteLine ("Unrecognized command. Exiting kast. Use \"kast help\" for help.");
				Environment.Exit (0);
			}

			var masterConfig = new KastConfiguration ();

			// Is there a command line flag specifying the configuration?
			if (args.Length > 1 && args [1].Equals ("file"))
				masterConfig.Load (args [2]);
			else
				masterConfig = new KastConfiguration(KastConfiguration.DefaultConfiguration ());

			var logger = new Logger (masterConfig.Get("server_log"));

			if(args[0].Equals("server")){
				var server = new Server.Program (masterConfig, logger);
				server.Start ();
			} else {
				// Send everything but "client" and "file" if it exists
				var client = new Client.Program (masterConfig, logger);
				client.main(Transformations.Subsequence (args, (args[1].Equals("file")?3:1), args.Length).AsArray());
			}
			//*/
		}

	/// <summary>
	/// Until the project is mature, I will be using this to test the program
	/// </summary>
	public static void Test(){
			//*
			KastConfiguration master = new KastConfiguration ();
			master = new KastConfiguration(KastConfiguration.DefaultConfiguration ());

			Logger log = new Logger (master.Get("server_log"));

			Kast.Server.Program server = new Kast.Server.Program (master, log);
			Kast.Client.Program client = new Kast.Client.Program (master, log);

			// The server is running now
			new Thread (new ThreadStart (server.Start)).Start ();

			client.SendData ("box gshfdkgj sdgfjk");

			Console.WriteLine ("Successful test");
			//*/
		}
	}
}


text:
#import <React/RCTSurfacePresenterStub.h>
#import <React/RCTUIManager.h>

#import "RCTBridge.h"
#import "RCTBridgeModule.h"

@implementation RCTViewRegistry {
  RCTBridgelessComponentViewProvider _bridgelessComponentViewProvider;
  __weak RCTBridge *_bridge;
}

- (void)setBridge:(RCTBridge *)bridge
{
  _bridge = bridge;
}

- (void)setBridgelessComponentViewProvider:(RCTBridgelessComponentViewProvider)bridgelessComponentViewProvider
{
  _bridgelessComponentViewProvider = bridgelessComponentViewProvider;
}

- (UIView *)viewForReactTag:(NSNumber *)reactTag
{
  UIView *view = nil;

  RCTBridge *bridge = _bridge;
  if (bridge) {
    view = [bridge.uiManager viewForReactTag:reactTag];
  }

  if (view == nil && _bridgelessComponentViewProvider) {
    view = _bridgelessComponentViewProvider(reactTag);
  }

  return view;
}

- (void)addUIBlock:(RCTViewRegistryUIBlock)block
{
  if (!block) {
    return;
  }

  __weak __typeof(self) weakSelf = self;
  if (_bridge) {
    [_bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
      __typeof(self) strongSelf = weakSelf;
      if (strongSelf) {
        block(strongSelf);
      }
    }];
  } else {
    RCTExecuteOnMainQueue(^{
      __typeof(self) strongSelf = weakSelf;
      if (strongSelf) {
        block(strongSelf);
      }
    });
  }
}

@end