Dnow Gasolin Jessica1213 Justincheng12345 Kasimtan Kly LNDDYL Liuxinyu970226 Maskers Wehwei Xiplus

準備好要闖第 %1 關了嗎？

準備好要進行下一個挑戰了嗎？

透過此連結分享您的區塊：

%1

對不起，「%1」並未對應任何已保存的程式。

未能載入您保存的檔案。或許它是由其他版本的 Blockly 創建？

感謝您所提交的程式！若我們的那一群訓練有素猴子們喜歡它的話，將會公開此內容至展廊裡一陣子。

一旦你開始編輯 JavaScript，就不能返回編輯區塊，確定嗎？

此關卡非常困難。您是否要跳過並進入下一關？您隨時可以返回這關。

為了明日的程式設計師所設計的遊戲。

太完美了！
所有的 %1 個區塊都正確。

差不多了！只剩 1 個積木不正確。

高亮顯示的區塊不正確，再試試看。

為每個動物（綠色）加上它的圖片、選擇腿的數量並加入其擁有的特徵。

如果…否則區塊會依條件執行某事，若不符合條件則執行其他事。

向左或向右轉 90 度。

如果某方向有路可以移動，就去執行某些動作。

如果某方向有路可以移動，就去執行第一個區塊指定的動作，如果沒有，執行第二個區塊指定的動作。

重複區塊內的操作，直至到達終點。

你還可以使用 %0 個區塊。

你還可以使用 %1 個積木。

你還可以使用 %2 個區塊。

區塊組是由一系列區塊組成。將數個「移動-向前」區塊連結起來，好讓角色走到出口。

在這關中，您需要在白色的工作區中將區塊堆在一起。

運行您的程式，看看會發生什麼。

你寫的程式無法完成這個迷宮，點擊「重置」再試一次。

使用 2 個區塊來到達迷宮出口。使用「重複直到」區塊以多次執行該區塊中包含的程式。

您使用的區塊已達本關上限。若要再使用一個新的區塊，請先移除工作區中的一個區塊。

你可以在「重複直到」積木中塞入多個積木。

從選單中選擇你最喜歡的角色。

「如果」區塊只有當條件成立時才會執行。試著向左轉，如果左方有路的話。

點擊「如果」區塊中的 %1 以變更其狀態。

你能解決這個複雜的迷宮嗎？請嘗試沿著左手邊的牆走。只有高級的程式設計師解得出來喔！

轉到指定的方向：0 是向右，90 是向上…

x 和 y 座標紀錄鳥的位置。當 x = 0 時鳥靠近左邊，當 x = 100 時靠近右邊。當 y = 0 時鳥在底部，當 y = 100 時在頂部。

變更方向，讓鳥可以吃到蟲子，最後降落在牠的巢上。

如果你還沒有吃到蟲子，可以用這個區塊來往單一方向前進；如果你已經吃到蟲子，就往另一個方向。

「x」是你現在的水平位置，用這個區塊來往單一方向前進，當「x」小於某個數字的時候；否則，則往另一個方向前進。

點擊圖像以修改「如果」積木。

此關卡需要一個「否則如果」和一個「否則」區塊。

「且」積木只在兩個輸入都為 true 時，才會返回 true。

拖曳「否則」區塊到「如果」區塊那裡。

指定烏龜向前或向後移動的量。

指定烏龜向左或向右轉向的量。

下筆或是停筆以開始或停止畫圖。

讓烏龜（圓圈和箭頭）顯示或隱藏。

在烏龜的方向及位置繪製文字。

設置列印區塊要使用的字體。

執行您的程式直到它停止。然後您可以提交您的繪畫至圖庫。

提交你的繪圖作品到繪畫庫。

你的解法有用，但是你還可以做得更好。

請僅使用到 3 塊區塊來畫出這個圖形。

只用 4 塊積木來畫出這個圖形。

創建一個程式來畫出一個正方形。

更改你的程式，讓它改為繪製一個五邊形而不是正方形。

有一個新的區塊了，它可以讓你修改顏色：

這個新區塊能讓你在移動時停筆：

畫 1 個黃色小星星，然後在它上面畫 1 條直線。

你可不可以在正方形上畫出 4 個星星（而不只是一個）？

畫出 3 個黃色星星，和 1 條白色直線。

畫出星星，然後再畫 4 條白色直線。

畫出 360 條白色直線，讓它看起來像滿月一樣。

你能加入一個黑色的圓圈，讓月亮變成弦月嗎？

畫出任何您想畫的東西。有眾多的新區塊讓您探索。祝您玩得愉快！

使用 "檢視繪畫庫" 按鈕看看其他人所製作的作品。若您繪製了有趣的東西，使用 "提交至繪畫庫" 按鈕來發佈你的作品。

選擇一個類別，看看裡頭有哪些區塊。

在指定位置畫一個指定半徑的圓形。

在指定位置畫一個指定長和寬的方形。

從一點到另一點畫一條指定粗細的線。

返回動畫中的當前時間(0-100)。

您的影片沒有動。使用區塊來製作一些有趣的東西。之後您可以提交您的影片至圖庫。

移動背景圓圈到您的程式頂端。這將會出現在人物後方。

使用簡單的圖形來畫出這個人物。

此關卡是一個影片，你需要讓人物的手臂在螢幕上移動，點擊播放按鈕可以預覽。

隨著電影在播放，time（時間）區塊會從 0 算到 100。因為你需要將手臂的「y」座標從 0 移動到 100，而這個區塊可以幫得上忙。

time（時間）區塊計算是從 0 到 100。但現在您需要將其它手臂的「y」座標從 100 移動到 0。你可以想想看一個簡單的數學公式來翻轉方向嗎？

利用你在之前關卡所學到來把腿給交叉。

手臂的數學公式相當複雜。答案是：

使用「if」區塊在影片的前半段繪製顆小頭。然後在影片的後半段畫出一顆大頭。

在影片中途讓腿轉向反方向。

在人的後方畫出個大圈子。

做出任何您想做的影片。有眾多的新區塊讓您探索。祝您玩得愉快！

使用 "檢視影片庫" 按鈕看看其他人所製作的影片。若您製作了有趣的影片，使用 "提交至影片庫" 按鈕來發布您的影片。

演奏一個指定長度與音高的音符。

在演奏後續音符時切換成指定樂器。

當「運行程式」按鍵點擊時，會執行區塊裡頭項目。

一個音符（中央C是號碼7）。

執行你的程式直到它停止。接著，可以把自己的音樂提交到樂廊。

您的成果可用，但是可以試著弄得更好。請使用功能來刪減重複的代碼內容。

若您在各起始區塊使用不同的樂器，會讓音樂聽起來更好。

作出《兩隻老虎》的前四個音符。

「功能」可讓您把區塊聚集起來，並且可多次執行。

建立一個功能來演奏《兩隻老虎》的前四個音符。請執行此功能兩次，並且不要添加任何新的區塊。

建立內容是《兩隻老虎》下一段的第二個功能。最後的音符為長音。

建立內容是《兩隻老虎》下一段的第三個功能。前四個音符為短音。

作出《兩隻老虎》的完整旋律。

此新的區塊讓您可更改成其它樂器。

建立包含著兩個延遲區塊，然後會演奏《兩隻老虎》的第二個起始區塊。

任一起始區塊皆會演奏《兩隻老虎》兩次。

建立四個皆會演奏《兩隻老虎》兩次的起始區塊，並且請添加正確數量的延遲區塊。

作出任何您想聽的曲子。有眾多的新區塊讓您探索。祝您玩得愉快！

使用 "檢視樂廊" 按鈕看看其他人所製作的作品。若您編出了有趣的曲子，使用 "提交至樂廊" 按鈕來發佈你的樂曲。

指定一個方向(0-360)掃描敵人位置，並返回該方向最近的敵人距離。當無法找到敵人時則返回無限大。

指定一個方向(0-360)和一個範圍(0-70)來發射大炮。

指定一個方向(0-360)以向前游動。

停止游動。角色將緩慢停止。

返回角色的健康狀況（0 代表死亡，100 代表健康）。

返回角色目前的速度（0 代表停止，100 代表全速）。

返回角色的 x 座標位置（0 代表最左邊，100 代表最右邊）。

返回角色的 y 座標位置（0 代表最上面，100 代表最下面）。

印出一個數字到您的瀏覽器控制台。

你的解法有用，但你還可以做得更好。使用 scan（掃描）以告訴大炮要發射距離。

使用 cannon（大炮）指令來攻擊目標。第一個參數是角度，第二個參數是範圍。找出正確的組合值。

此目標需要不斷的被攻擊。使用「while (true)」迴圈來無限地執行指令。

對手會動來動去的，很難攻擊到。scan（掃描）表達式返回對手的具體範圍在特定的方向。

這個範圍就是 cannon 指令需要準確地發射精確火力的範圍。

這個對手離得太遠了，距離超出大炮所能射到的範圍（限 70 公尺）。不過使用 swim（游動）指令可游向對手並且撞擊它。

此對手距離超出大炮所能射到的範圍。而且以你的健康狀況無法撞擊對手。當您的水平位置小於 50 您可游往對手的方向。然後 stop（停止）以使用大炮。

這個對手在被攻擊的時候會逃跑。若距離超過範圍 (70公尺)請游往它的方向。

{'repo_name': 'google/blockly-games', 'stars': '921', 'repo_language': 'JavaScript', 'file_name': 'gviz-externs.js', 'mime_type': 'text/plain', 'hash': 7892281153781606591, 'source_dataset': 'data'}


//
//  Created by Jesse Squires
//  http://www.jessesquires.com
//
//
//  Documentation
//  http://cocoadocs.org/docsets/JSQMessagesViewController
//
//
//  GitHub
//  https://github.com/jessesquires/JSQMessagesViewController
//
//
//  License
//  Copyright (c) 2014 Jesse Squires
//  Released under an MIT license: http://opensource.org/licenses/MIT
//

//  ********************************
//  Special thanks to the localization contributors!
//
//  https://github.com/jessesquires/JSQMessagesViewController/issues/237
//  ********************************

"load_earlier_messages" = "载入较早的信息";

"send" = "发送";

"new_message" = "新信息";

{'repo_name': 'LunarFlash/Chaty', 'stars': '360', 'repo_language': 'Swift', 'file_name': 'contents.xcworkspacedata', 'mime_type': 'text/xml', 'hash': 1269838849577060717, 'source_dataset': 'data'}


#!/usr/bin/env python
#
# Copyright 2015 Google Inc. 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
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""This code example deactivates a creative wrapper belonging to a label.

The LoadFromStorage method is pulling credentials and properties from a
"googleads.yaml" file. By default, it looks for this file in your home
directory. For more information, see the "Caching authentication information"
section of our README.

"""

# Import appropriate modules from the client library.
from googleads import ad_manager

LABEL_ID = 'INSERT_LABEL_ID_HERE'

def main(client, label_id):
  # Initialize appropriate service.
  creative_wrapper_service = client.GetService('CreativeWrapperService',
                                               version='v202008')

  # Create a query to select the active creative wrappers for the given label.
  statement = (ad_manager.StatementBuilder(version='v202008')
               .Where('status = :status AND labelId = :labelId')
               .WithBindVariable('status', 'ACTIVE')
               .WithBindVariable('labelId', int(label_id)))

  creative_wrappers_deactivated = 0

  # Get creative wrappers by statement.
  while True:
    response = creative_wrapper_service.getCreativeWrappersByStatement(
        statement.ToStatement())
    if 'results' in response and len(response['results']):
      # Display results.
      for creative_wrapper in response['results']:
        print('Creative wrapper with ID "%s" applying to label "%s" with '
              'status "%s" will be deactivated.' %
              (creative_wrapper['id'],
               creative_wrapper['labelId'],
               creative_wrapper['status']))
      # Perform action.
      result = creative_wrapper_service.performCreativeWrapperAction(
          {'xsi_type': 'DeactivateCreativeWrappers'}, statement.ToStatement())
      if result and int(result['numChanges']) > 0:
        creative_wrappers_deactivated += int(result['numChanges'])
      statement.offset += statement.limit
    else:
      break

  # Display results.
  if creative_wrappers_deactivated > 0:
    print('Number of creative wrappers deactivated: %s' %
          creative_wrappers_deactivated)
  else:
    print('No creative wrappers were deactivated.')

if __name__ == '__main__':
  # Initialize client object.
  ad_manager_client = ad_manager.AdManagerClient.LoadFromStorage()
  main(ad_manager_client, LABEL_ID)

{'repo_name': 'googleads/googleads-python-lib', 'stars': '488', 'repo_language': 'Python', 'file_name': 'test.crt', 'mime_type': 'text/plain', 'hash': 1806048251963470588, 'source_dataset': 'data'}


/*
    Lightmetrica - A modern, research-oriented renderer

    Copyright (c) 2015 Hisanari Otsu

    Permission is hereby granted, free of charge, to any person obtaining a copy
    of this software and associated documentation files (the "Software"), to deal
    in the Software without restriction, including without limitation the rights
    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    copies of the Software, and to permit persons to whom the Software is
    furnished to do so, subject to the following conditions:

    The above copyright notice and this permission notice shall be included in
    all copies or substantial portions of the Software.

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    THE SOFTWARE.
*/

#include "mltutils.h"
#include "multiplexeddensity.h"

LM_NAMESPACE_BEGIN

enum class MMLTInvmapFixed_Strategy : int
{
    // Path space mutations
    BidirFixed      = (int)(MLTStrategy::BidirFixed),
    Bidir           = (int)(MLTStrategy::Bidir),
    Lens            = (int)(MLTStrategy::Lens),
    Caustic         = (int)(MLTStrategy::Caustic),
    Multichain      = (int)(MLTStrategy::Multichain),
    ManifoldLens    = (int)(MLTStrategy::ManifoldLens),
    ManifoldCaustic = (int)(MLTStrategy::ManifoldCaustic),
    Manifold        = (int)(MLTStrategy::Manifold),
    Identity        = (int)(MLTStrategy::Identity),

    // Primary sample space mutations
    SmallStep,
    LargeStep,
    ChangeTechnique,
};

///! MMLT with fused mutation (fixed path length).
class Renderer_Invmap_MMLTInvmapFixed final : public Renderer
{
public:

    LM_IMPL_CLASS(Renderer_Invmap_MMLTInvmapFixed, Renderer);

public:

    int numVertices_;
    long long numMutations_;
    std::vector<Float> initStrategyWeights_{ 1_f, 1_f, 1_f, 1_f, 1_f, 1_f, 1_f, 1_f, 1_f, 1_f, 1_f, 1_f };
    #if INVERSEMAP_OMIT_NORMALIZATION
    Float normalization_;
    #endif
    std::string pathType_;

public:

    LM_IMPL_F(Initialize) = [this](const PropertyNode* prop) -> bool
    {
        if (!prop->ChildAs<int>("num_vertices", numVertices_)) return false;
        if (!prop->ChildAs<long long>("num_mutations", numMutations_)) return false;

        {
            LM_LOG_INFO("Loading mutation strategy weights");
            LM_LOG_INDENTER();
            const auto* child = prop->Child("mutation_strategy_weights");
            if (!child)
            {
                LM_LOG_ERROR("Missing 'mutation_strategy_weights'");
                return false;
            }
            initStrategyWeights_[(int)(MMLTInvmapFixed_Strategy::BidirFixed)]      = child->ChildAs<Float>("bidir", 1_f);
            initStrategyWeights_[(int)(MMLTInvmapFixed_Strategy::Bidir)]           = 0_f;
            initStrategyWeights_[(int)(MMLTInvmapFixed_Strategy::Lens)]            = child->ChildAs<Float>("lens", 1_f);
            initStrategyWeights_[(int)(MMLTInvmapFixed_Strategy::Caustic)]         = child->ChildAs<Float>("caustic", 1_f);
            initStrategyWeights_[(int)(MMLTInvmapFixed_Strategy::Multichain)]      = child->ChildAs<Float>("multichain", 1_f);
            initStrategyWeights_[(int)(MMLTInvmapFixed_Strategy::ManifoldLens)]    = child->ChildAs<Float>("manifoldlens", 0_f);
            initStrategyWeights_[(int)(MMLTInvmapFixed_Strategy::ManifoldCaustic)] = child->ChildAs<Float>("manifoldcaustic", 0_f);
            initStrategyWeights_[(int)(MMLTInvmapFixed_Strategy::Manifold)]        = child->ChildAs<Float>("manifold", 1_f);
            initStrategyWeights_[(int)(MMLTInvmapFixed_Strategy::Identity)]        = child->ChildAs<Float>("identity", 0_f);
            initStrategyWeights_[(int)(MMLTInvmapFixed_Strategy::SmallStep)]       = child->ChildAs<Float>("smallstep", 1_f);
            initStrategyWeights_[(int)(MMLTInvmapFixed_Strategy::LargeStep)]       = child->ChildAs<Float>("largestep", 1_f);
            initStrategyWeights_[(int)(MMLTInvmapFixed_Strategy::ChangeTechnique)] = child->ChildAs<Float>("changetechnique", 0_f);
        }

        #if INVERSEMAP_OMIT_NORMALIZATION
        normalization_ = prop->ChildAs<Float>("normalization", 1_f);
        #endif

        pathType_ = prop->ChildAs<std::string>("path_type", "");

        return true;
    };

    LM_IMPL_F(Render) = [this](const Scene* scene_, Random* initRng, const std::string& outputPath) -> void
    {
        const auto* scene = static_cast<const Scene3*>(scene_);
        auto* film = static_cast<const Sensor*>(scene->GetSensor()->emitter)->GetFilm();

        // --------------------------------------------------------------------------------

        #pragma region Compute normalization factor
        #if INVERSEMAP_OMIT_NORMALIZATION
        const auto b = normalization_;
        #else
        throw std::runtime_error("not implemented");
        #endif
        #pragma endregion

        // --------------------------------------------------------------------------------

        #pragma region Rendering
        {
            LM_LOG_INFO("Rendering");
            LM_LOG_INDENTER();

            // --------------------------------------------------------------------------------

            // Thread-specific context
            struct Context
            {
                Random rng;
                Film::UniquePtr film{ nullptr, nullptr };
                MultiplexedDensity::State curr;
            };
            std::vector<Context> contexts(Parallel::GetNumThreads());
            for (auto& ctx : contexts)
            {
                ctx.rng.SetSeed(initRng->NextUInt());
                ctx.film = ComponentFactory::Clone<Film>(film);

                // Initial state
                while (true)
                {
                    MultiplexedDensity::State state(initRng, numVertices_);
                    const auto path = MultiplexedDensity::InvCDF(state, scene);
                    if (!path)
                    {
                        continue;
                    }
                    if (!path->path.IsPathType(pathType_))
                    {
                        continue;
                    }

                    // Sanity check
                    const auto invS = MultiplexedDensity::CDF(path->path, path->s, scene, initRng);
                    if (!invS)
                    {
                        continue;
                    }
                    const auto path_invS = MultiplexedDensity::InvCDF(*invS, scene);
                    if (!path_invS)
                    {
                        continue;
                    }
                    //const auto C1 = (path->Cstar * path->w).Luminance();
                    const auto C2 = (path_invS->Cstar * path_invS->w).Luminance();
                    //if (path->s != path_invS->s || path->t != path_invS->t || Math::Abs(C1 - C2) > Math::Eps())
                    //{
                    //    continue;
                    //}
                    if (path->s != path_invS->s || path->t != path_invS->t || C2 == 0)
                    {
                        continue;
                    }

                    ctx.curr = state;
                    break;
                }
            }

            // --------------------------------------------------------------------------------

            Parallel::For(numMutations_, [&](long long index, int threadid, bool init) -> void
            {
                auto& ctx = contexts[threadid];

                // --------------------------------------------------------------------------------

                #pragma region Mutation
                const auto accept = [&]() -> bool
                {
                    #pragma region Select mutation strategy
                    const auto strategy = [&]() -> MMLTInvmapFixed_Strategy
                    {
                        const auto StrategyDist = [&]() -> Distribution1D
                        {
                            Distribution1D dist;
                            for (size_t i = 0; i < initStrategyWeights_.size(); i++)
                            {
                                const auto w = initStrategyWeights_[i];
                                if (i <= (int)(MMLTInvmapFixed_Strategy::Identity))
                                {
                                    // Path space mutations
                                    // TODO: Optimize it
                                    const auto currP = MultiplexedDensity::InvCDF(ctx.curr, scene);
                                    if (MLTMutationStrategy::CheckMutatable((MLTStrategy)(i), currP->path)) { dist.Add(w); }
                                    else { dist.Add(0_f); }
                                }
                                else
                                {
                                    // Primary sample space mutations
                                    dist.Add(w);
                                }
                            }
                            dist.Normalize();
                            return dist;
                        }();
                        return (MMLTInvmapFixed_Strategy)(StrategyDist.Sample(ctx.rng.Next()));
                    }();
                    #pragma endregion

                    // --------------------------------------------------------------------------------

                    if (strategy == MMLTInvmapFixed_Strategy::SmallStep || strategy == MMLTInvmapFixed_Strategy::LargeStep || strategy == MMLTInvmapFixed_Strategy::ChangeTechnique)
                    {
                        #pragma region Primary sample space mutations

                        // Mutate
                        auto prop =
                            strategy == MMLTInvmapFixed_Strategy::LargeStep ? ctx.curr.LargeStep(&ctx.rng) :
                            strategy == MMLTInvmapFixed_Strategy::SmallStep ? ctx.curr.SmallStep(&ctx.rng) : ctx.curr.ChangeTechnique(&ctx.rng);

                        // Paths
                        const auto currP = MultiplexedDensity::InvCDF(ctx.curr, scene);
                        const auto propP = MultiplexedDensity::InvCDF(prop, scene);
                        if (!propP)
                        {
                            return false;
                        }

                        // Scalar contributions
                        #if INVERSEMAP_MULTIPLEXED_DENSITY_DEBUG_SIMPLIFY_STRATEGY_SINGLE
                        const auto currC = InversemapUtils::ScalarContrb(currP->Cstar);
                        const auto propC = InversemapUtils::ScalarContrb(propP->Cstar);
                        #else
                        const auto currC = InversemapUtils::ScalarContrb(currP->Cstar * currP->w);
                        const auto propC = InversemapUtils::ScalarContrb(propP->Cstar * propP->w);
                        #endif

                        // MH update
                        const auto A = currC == 0_f ? 1_f : Math::Min(1_f, propC / currC);
                        if (ctx.rng.Next() < A)
                        {
                            ctx.curr.Swap(prop);
                            return true;
                        }

                        return false;
                        #pragma endregion
                    }
                    else
                    {
                        #pragma region Path space mutations

                        #pragma region Map to path space
                        const auto currP = [&]() -> MultiplexedDensity::CachedPath
                        {
                            const auto p = MultiplexedDensity::InvCDF(ctx.curr, scene);
                            assert(p);
                            assert((p->Cstar * p->w).Luminance() > 0);
                            assert(p->path.vertices.size() == numVertices_);
                            return *p;
                        }();
                        #pragma endregion

                        // --------------------------------------------------------------------------------

                        #pragma region Mutate the current path
                        const auto propP = MLTMutationStrategy::Mutate((MLTStrategy)(strategy), scene, ctx.rng, currP.path);
                        if (!propP)
                        {
                            return false;
                        }
                        #pragma endregion

                        // --------------------------------------------------------------------------------

                        #pragma region MH update
                        {
                            const auto Qxy = MLTMutationStrategy::Q((MLTStrategy)(strategy), scene, currP.path, propP->p, propP->subspace);
                            const auto Qyx = MLTMutationStrategy::Q((MLTStrategy)(strategy), scene, propP->p, currP.path, propP->subspace);
                            Float A = 0_f;
                            if (Qxy <= 0_f || Qyx <= 0_f || std::isnan(Qxy) || std::isnan(Qyx))
                            {
                                A = 0_f;
                            }
                            else
                            {
                                #if INVERSEMAP_MULTIPLEXED_DENSITY_DEBUG_SIMPLIFY_STRATEGY_SINGLE
                                A = Math::Min(1_f, Qyx / Qxy);
                                #else
                                // Reject if proposed path is not samplable by current technique
                                if (propP->p.EvaluatePathPDF(scene, currP.s).v == 0_f)
                                {
                                    return false;
                                }

                                const auto wx = currP.w;
                                const auto wy = propP->p.EvaluateMISWeight(scene, currP.s);
                                if (wx <= 0 || wy <= 0)
                                {
                                    A = 0_f;
                                }
                                else
                                {
                                    A = Math::Min(1_f, (Qyx * wy) / (Qxy * wx));
                                }
                                #endif
                            }
                            if (ctx.rng.Next() < A)
                            {
                                // Map to primary sample space
                                const auto propInvS = MultiplexedDensity::CDF(propP->p, currP.s, scene, &ctx.rng);
                                if (!propInvS)
                                {
                                    return false;
                                }

                                // Sanity check
                                const auto path_propInvS = MultiplexedDensity::InvCDF(*propInvS, scene);
                                if (!path_propInvS)
                                {
                                    return false;
                                }
                                //const auto C1 = (currP.Cstar * currP.w).Luminance();
                                const auto C2 = (path_propInvS->Cstar * path_propInvS->w).Luminance();
                                //if (currP.s != path_propInvS->s || currP.t != path_propInvS->t || Math::Abs(C1 - C2) > Math::Eps())
                                //{
                                //    return false;
                                //}
                                if (currP.s != path_propInvS->s || currP.t != path_propInvS->t || C2 == 0)
                                {
                                    return false;
                                }

                                ctx.curr = *propInvS;
                                return true;
                            }

                            return false;
                        }
                        #pragma endregion

                        #pragma endregion
                    }

                    // --------------------------------------------------------------------------------
                    LM_UNREACHABLE();
                    return true;
                }();
                LM_UNUSED(accept);
                #pragma endregion

                // --------------------------------------------------------------------------------

                #pragma region Accumulate contribution
                {
                    const auto p = MultiplexedDensity::InvCDF(ctx.curr, scene);
                    assert(p);
                    if (p->path.IsPathType(pathType_))
                    {
                        const auto C = p->Cstar * p->w;
                        const auto I = InversemapUtils::ScalarContrb(C);
                        ctx.film->Splat(p->path.RasterPosition(), C * (b / I));
                    }
                }
                #pragma endregion
            });

            // --------------------------------------------------------------------------------

            #pragma region Gather & Rescale
            film->Clear();
            for (auto& ctx : contexts)
            {
                film->Accumulate(ctx.film.get());
            }
            film->Rescale((Float)(film->Width() * film->Height()) / numMutations_);
            #pragma endregion
        }
        #pragma endregion

        // --------------------------------------------------------------------------------

        #if INVERSEMAP_DEBUG_MLT_MANIFOLDWALK_STAT
        MLTMutationStrategy::PrintStat();
        #endif

        // --------------------------------------------------------------------------------

        #pragma region Save image
        {
            LM_LOG_INFO("Saving image");
            LM_LOG_INDENTER();
            film->Save(outputPath);
        }
        #pragma endregion
    };

};

LM_COMPONENT_REGISTER_IMPL(Renderer_Invmap_MMLTInvmapFixed, "renderer::invmap_mmltinvmapfixed");

LM_NAMESPACE_END

{'repo_name': 'hi2p-perim/lightmetrica-v2', 'stars': '138', 'repo_language': 'C++', 'file_name': 'FindGLEW.cmake', 'mime_type': 'text/plain', 'hash': 7646093693930017602, 'source_dataset': 'data'}


package notifications

import (
	"github.com/code-creatively/datav/backend/pkg/log"
)

var logger = log.RootLogger.New("logger", "notifications")

{'repo_name': 'apm-ai/datav', 'stars': '1250', 'repo_language': 'TypeScript', 'file_name': 'index.html', 'mime_type': 'text/html', 'hash': 5958846276368385344, 'source_dataset': 'data'}


import { IconDefinition, IconPrefix, IconName } from "@fortawesome/fontawesome-common-types";
export const definition: IconDefinition;
export const faSign: IconDefinition;
export const prefix: IconPrefix;
export const iconName: IconName;
export const width: number;
export const height: number;
export const ligatures: string[];
export const unicode: string;
export const svgPathData: string;

{'repo_name': 'sujaykundu777/devlopr-jekyll', 'stars': '172', 'repo_language': 'CSS', 'file_name': 'post.html', 'mime_type': 'text/html', 'hash': 9039264359253711530, 'source_dataset': 'data'}


// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using System;

namespace osu.Game.Beatmaps.ControlPoints
{
    public abstract class ControlPoint : IComparable<ControlPoint>
    {
        /// <summary>
        /// The time at which the control point takes effect.
        /// </summary>
        public double Time => controlPointGroup?.Time ?? 0;

        private ControlPointGroup controlPointGroup;

        public void AttachGroup(ControlPointGroup pointGroup) => controlPointGroup = pointGroup;

        public int CompareTo(ControlPoint other) => Time.CompareTo(other.Time);

        /// <summary>
        /// Determines whether this <see cref="ControlPoint"/> results in a meaningful change when placed alongside another.
        /// </summary>
        /// <param name="existing">An existing control point to compare with.</param>
        /// <returns>Whether this <see cref="ControlPoint"/> is redundant when placed alongside <paramref name="existing"/>.</returns>
        public abstract bool IsRedundant(ControlPoint existing);
    }
}

{'repo_name': 'ppy/osu', 'stars': '5092', 'repo_language': 'C#', 'file_name': 'AndroidManifest.xml', 'mime_type': 'text/xml', 'hash': 6054253918699702694, 'source_dataset': 'data'}


EESchema-LIBRARY Version 2.3
#encoding utf-8
#
# BFCN-2450+
#
DEF BFCN-2450+ F 0 40 Y Y 1 F N
F0 "F" -200 200 50 H V L CNN
F1 "BFCN-2450+" -200 -200 50 H V L CNN
F2 "agg:FV1206-4" -200 -300 50 H I L CNN
F3 "https://ww2.minicircuits.com/pdfs/BFCN-2450+.pdf" -200 -400 50 H I L CNN
F4 "BFCN-2450+" -200 -500 50 H I L CNN "Minicircuits"
DRAW
S -200 150 200 -150 0 1 0 f
X IN 1 -300 100 100 R 50 50 0 0 P
X GND 2 -300 0 100 R 50 50 0 0 W
X OUT 3 300 100 100 L 50 50 0 0 P
X GND 4 300 0 100 L 50 50 0 0 W
ENDDRAW
ENDDEF
#
#End Library

{'repo_name': 'adamgreig/agg-kicad', 'stars': '128', 'repo_language': 'Python', 'file_name': '0201-l.yaml', 'mime_type': 'text/plain', 'hash': 586392997303262534, 'source_dataset': 'data'}


About
==========
tcplay is a free (BSD-licensed), pretty much fully featured (including multiple
keyfiles, cipher cascades, etc) and stable TrueCrypt implementation.

This implementation supports mapping (opening) both system and normal TrueCrypt
volumes, as well as opening hidden volumes and opening an outer volume while
protecting a hidden volume. There is also support to create volumes, including
hidden volumes, etc. Since version 1.1, there is also support for restoring
from the backup header (if present), change passphrase, keyfile and PBKDF2
PRF function.

Since tcplay uses dm-crypt (or dm_target_crypt on DragonFly) it makes full use
of any available hardware encryption/decryption support once the volume has been
mapped.

It is based solely on the documentation available on the TrueCrypt website,
many hours of trial and error and the output of the Linux' TrueCrypt client.
As it turns out, most technical documents on TrueCrypt contain mistakes, hence
the trial and error approach.

VeraCrypt support
==========
tcplay has support for creating, modifying and mapping VeraCrypt volumes. See
the man page for more details.

Implementation notes
==========
DragonFly BSD uses the hybrid OpenSSL + cryptodev(9) approach that can be
found in crypto-dev.c. OpenSSL is only used for the hash/pbkdf2. The
encryption/decryption is performed via cryptodev(9) with enabled cryptosoft.

On Linux gcrypt is used for the encryption and decryption. For the hash/pbkdf2
either gcrypt or OpenSSL can be used. gcrypt only supports pbkdf2 since its
July 2011 release (1.5.0), while OpenSSL has had pbkdf2 since around December
2010, so its easier to find in most distros.

The crypto options can be chosen with make/Makefile parameters. Building on Linux
is as easy as doing

    make -f Makefile.classic SYSTEM=linux

you can even skip the SYSTEM=linux, since that's the default. To choose the
PBKDF backend, you can use either,

    make -f Makefile.classic PBKDF_BACKEND=openssl

or

    make -f Makefile.classic PBKDF_BACKEND=gcrypt

The interface to device mapper is libdevmapper on Linux and libdm on DragonFly.
libdm is a BSD-licensed version of libdevmapper that I hacked together in a few
hours.

On Ubuntu, the following dev packages are needed to build tcplay:

    apt-get install build-essential libdevmapper-dev libgcrypt11-dev uuid-dev

cmake
----------
New in version 1.0 is a cmake build system. tcplay can now be built using:

    mkdir objdir
    cd objdir
    cmake ..
    make

NOTE: building inside the source directory is discouraged, so please do
build inside an "objdir" directory. If you happen to do it anyway, you can
clean up behind cmake using:

    make -f Makefile.classic clean_cmake_mess

Before running `cmake`, make sure you have `pkg-config` installed; e.g. on a
Debian or Ubuntu system you can install it using:

    apt-get install pkg-config

This process will check for dependencies and automatically select whether to
use OpenSSL or gcrypt as PBKDF backend.

In addition, this process will also generate a .pc file (pkg-config) for the
tcplay library.

The classic single-file Makefile can still be used for building, however, using

    make -f Makefile.classic

Or, if you only want the command line tool:

    make -f Makefile.classic tcplay

Library
==========
In addition to providing a command line tool, tcplay is also available as a
library. See the `tcplay.3` man page for more details on how to use the API.

TODO: link examples

Documentation
==========
Please refer to the man pages bundled with tcplay.

Download for packaging
==========
Latest release can be found as a (source) tarball at:

https://github.com/bwalex/tc-play/archive/v3.3.tar.gz

Bugs
==========
Please report all bugs on the github issue tracker. If appropriate, please
attach a small test volume which you think tcplay isn't handling correctly.
The reduce_test_vol.sh script in test/ can significantly reduce the size
of a volume when compressed by stripping out all the unnecessary data,
leaving only the headers. After that, just bzip2 it and it should be fairly
tiny.

What would be even better is if you could write a small test case to
reproduce the issue. The README in the test/ directory has information on
how to write tests for tcplay.

OS Support
==========
tcplay is now available for both DragonFly BSD and Linux. It is a core part of
the DragonFly BSD operating system and is available in a number of linux
distros.

Licensing
==========
The project is under a two-clause BSD license. I would consider dual-licensing
it if required. Drop me an email to discuss the options.

Development
==========
tcplay is pretty much stable, but if you find a bug, please report it.
If anyone wants to add new features or port it to another OS, I'll gladly merge
your changes into this repository so that there is a single point of contact.

I've noticed that sometimes bugs are only reported downstream (e.g. in the
distro's bugtracker). Please make sure those bugs are also reported upstream on
github, otherwise odds are they will never reach me.

Bugs in the TrueCrypt documentation
==========
The TrueCrypt documentation is pretty bad and does not really represent the
actual on-disk format nor the encryption/decryption process.

Some notable differences between actual implementation and documentation:
 - PBKDF using RIPEMD160 only uses 2000 iterations if the volume isn't a system
   volume.
 - The keyfile pool is not XOR'ed with the passphrase but modulo-256 summed.
 - Every field *except* the minimum version field of the volume header are in
   big endian.
 - Some volume header fields (creation time of volume and header) are missing
   in the documentation.
 - All two-way cipher cascades are the wrong way round in the documentation,
   but all three-way cipher cascades are correct.

{'repo_name': 'bwalex/tc-play', 'stars': '500', 'repo_language': 'C', 'file_name': 'env.rb', 'mime_type': 'text/x-ruby', 'hash': 994143198196581201, 'source_dataset': 'data'}


<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="24dp"
    android:height="24dp"
    android:viewportWidth="24"
    android:viewportHeight="24"
    android:tint="?attr/colorControlNormal">
  <path
      android:fillColor="@android:color/white"
      android:pathData="M11.15,3.4L7.43,9.48c-0.41,0.66 0.07,1.52 0.85,1.52h7.43c0.78,0 1.26,-0.86 0.85,-1.52L12.85,3.4c-0.39,-0.64 -1.31,-0.64 -1.7,0z"/>
  <path
      android:fillColor="@android:color/white"
      android:pathData="M17.5,17.5m-4.5,0a4.5,4.5 0,1 1,9 0a4.5,4.5 0,1 1,-9 0"/>
  <path
      android:fillColor="@android:color/white"
      android:pathData="M4,21.5h6c0.55,0 1,-0.45 1,-1v-6c0,-0.55 -0.45,-1 -1,-1H4c-0.55,0 -1,0.45 -1,1v6c0,0.55 0.45,1 1,1z"/>
</vector>

{'repo_name': 'JetBrains/android', 'stars': '559', 'repo_language': 'Java', 'file_name': 'InspectorPanelModelTest.kt', 'mime_type': 'text/x-c++', 'hash': 2917543157766355183, 'source_dataset': 'data'}


<?xml version="1.0"?>
<RunInfo xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Version="4">
  <Run>
    <Reads>
      <Read Number="1" NumCycles="151" IsIndexedRead="N" />
      <Read Number="2" NumCycles="8" IsIndexedRead="Y" />
      <Read Number="3" NumCycles="8" IsIndexedRead="Y" />
      <Read Number="4" NumCycles="151" IsIndexedRead="N" />
    </Reads>
  </Run>
</RunInfo>

{'repo_name': 'broadinstitute/picard', 'stars': '581', 'repo_language': 'Java', 'file_name': 'testng.css', 'mime_type': 'text/plain', 'hash': 6655775942479580747, 'source_dataset': 'data'}


#include "STREAMICE_OPTIONS.h"

C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|

CBOP
      SUBROUTINE STREAMICE_DIAGNOSTICS_STATE( myTime, myIter, myThid )

C     /============================================================\
C     | SUBROUTINE                                                 |
C     | o                                                          |
C     |============================================================|
C     |                                                            |
C     \============================================================/
      IMPLICIT NONE

C     === Global variables ===
#include "SIZE.h"
#include "EEPARAMS.h"
#include "PARAMS.h"
#include "STREAMICE.h"

      _RL myTime
      INTEGER myIter, myThid

#ifdef ALLOW_STREAMICE
#ifdef ALLOW_DIAGNOSTICS
      CHARACTER*(MAX_LEN_MBUF) msgBuf

#ifdef ALLOW_OPENAD
      INTEGER i, j, bi, bj

      _RL u_streamice_diag(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
      _RL v_streamice_diag(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
      _RL u_surf_diag(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
      _RL v_surf_diag(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
      _RL h_streamice_diag(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
      _RL area_diag(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
      _RL float_frac_diag(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
      _RL surf_diag(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
#ifdef STREAMICE_HYBRID_STRESS
      _RL streamice_taubx_diag(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
      _RL streamice_tauby_diag(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
#endif
#ifdef ALLOW_STREAMICE_2DTRACER
       _RL trac2d_diag
#endif

      DO bj = myByLo(myThid), myByHi(myThid)
       DO bi = myBxLo(myThid), myBxHi(myThid)
        DO j=1-OLy,sNy+OLy
         DO i=1-OLx,sNx+OLx
           u_streamice_diag(i,j,bi,bj) = u_streamice(i,j,bi,bj)%v
           v_streamice_diag(i,j,bi,bj) = v_streamice(i,j,bi,bj)%v
           h_streamice_diag(i,j,bi,bj) = H_streamice(i,j,bi,bj)%v
           area_diag(i,j,bi,bj) = area_shelf_streamice(i,j,bi,bj)%v
#ifdef STREAMICE_SMOOTH_FLOATATION2
           float_frac_diag(i,j,bi,bj) =
     &         float_frac_streamice(i,j,bi,bj)%v
#endif
           surf_diag(i,j,bi,bj) =
     &         surf_el_streamice(i,j,bi,bj)%v
#ifdef STREAMICE_HYBRID_STRESS
           streamice_taubx_diag(i,j,bi,bj) =
     $         streamice_taubx(i,j,bi,bj)%v
           streamice_tauby_diag(i,j,bi,bj) =
     $         streamice_tauby(i,j,bi,bj)%v
           u_surf_diag(i,j,bi,bj) = streamice_u_surf(i,j,bi,bj)%v
           v_surf_diag(i,j,bi,bj) = streamice_v_surf(i,j,bi,bj)%v
#endif
#ifdef ALLOW_STREAMICE_2DTRACER
           trac2d_diag(i,j,bi,bj)=trac2d(i,j,bi,bj)%v
#endif

         ENDDO
        ENDDO
       ENDDO
      ENDDO

#endif /* ALLOW_OPENAD */

      IF ( useDiagnostics ) THEN
       WRITE(msgBuf,'(A)') 'CALLING FILL DIAGNOSTICS'
       CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
     &                     SQUEEZE_RIGHT , 1)

#ifdef ALLOW_OPENAD

       CALL DIAGNOSTICS_FILL(U_streamice_diag,'SI_Uvel ',
     &      0,1,0,1,1,myThid)
       CALL DIAGNOSTICS_FILL(V_streamice_diag,'SI_Vvel ',
     &      0,1,0,1,1,myThid)
       CALL DIAGNOSTICS_FILL(H_streamice_diag,'SI_Thick',
     &      0,1,0,1,1,myThid)
       CALL DIAGNOSTICS_FILL(area_diag,'SI_area ',
     &      0,1,0,1,1,myThid)
       CALL DIAGNOSTICS_FILL(surf_diag,'SI_selev',
     &      0,1,0,1,1,myThid)

#else

       CALL DIAGNOSTICS_FILL(U_streamice,'SI_Uvel ',
     &      0,1,0,1,1,myThid)
       CALL DIAGNOSTICS_FILL(V_streamice,'SI_Vvel ',
     &      0,1,0,1,1,myThid)
       CALL DIAGNOSTICS_FILL(H_streamice,'SI_Thick',
     &      0,1,0,1,1,myThid)
       CALL DIAGNOSTICS_FILL(area_shelf_streamice,'SI_area ',
     &      0,1,0,1,1,myThid)
       CALL DIAGNOSTICS_FILL(float_frac_streamice,'SI_float',
     &      0,1,0,1,1,myThid)
       CALL DIAGNOSTICS_FILL(surf_el_streamice,'SI_selev',
     &      0,1,0,1,1,myThid)
        CALL DIAGNOSTICS_FILL(bdot_streamice,'BDOT_SI ',
     &      0,1,0,1,1,myThid)

#endif

#ifdef ALLOW_OPENAD
#ifdef STREAMICE_SMOOTH_FLOATATION2
       CALL DIAGNOSTICS_FILL(float_frac_diag,'SI_float',
     &      0,1,0,1,1,myThid)
#else
       CALL DIAGNOSTICS_FILL(float_frac_streamice,'SI_float',
     &      0,1,0,1,1,myThid)
#endif
#endif

       CALL DIAGNOSTICS_FILL_RS(STREAMICE_hmask,'SI_hmask',
     &      0,1,0,1,1,myThid)
#ifdef STREAMICE_HYBRID_STRESS
       CALL DIAGNOSTICS_FILL(streamice_u_bed,'SI_ubase',
     &      0,1,0,1,1,myThid)
       CALL DIAGNOSTICS_FILL(STREAMICE_v_bed,'SI_vbase',
     &      0,1,0,1,1,myThid)

#ifdef ALLOW_OPENAD
       CALL DIAGNOSTICS_FILL(streamice_taubx_diag,'SI_taubx',
     &      0,1,0,1,1,myThid)
       CALL DIAGNOSTICS_FILL(STREAMICE_tauby_diag,'SI_tauby',
     &      0,1,0,1,1,myThid)
       CALL DIAGNOSTICS_FILL(u_surf_diag,'SI_usurf',
     &      0,1,0,1,1,myThid)
       CALL DIAGNOSTICS_FILL(v_surf_diag,'SI_vsurf',
     &      0,1,0,1,1,myThid)
#else
       CALL DIAGNOSTICS_FILL(streamice_taubx,'SI_taubx',
     &      0,1,0,1,1,myThid)
       CALL DIAGNOSTICS_FILL(STREAMICE_tauby,'SI_tauby',
     &      0,1,0,1,1,myThid)
       CALL DIAGNOSTICS_FILL(streamice_u_surf,'SI_usurf',
     &      0,1,0,1,1,myThid)
       CALL DIAGNOSTICS_FILL(streamice_v_surf,'SI_vsurf',
     &      0,1,0,1,1,myThid)
#endif

#endif

#ifdef ALLOW_STREAMICE_2DTRACER
#ifdef ALLOW_OPENAD
       CALL DIAGNOSTICS_FILL(trac2d_diag,'SI2Dtrac',
     &      0,1,0,1,1,myThid)
#else
       CALL DIAGNOSTICS_FILL(trac2d,'SI2Dtrac',
     &      0,1,0,1,1,myThid)
#endif
#endif

      ENDIF

#endif /* ALLOW_DIAGNOSTICS */
#endif /* ALLOW_STREAMICE */
      RETURN
      END

{'repo_name': 'MITgcm/MITgcm', 'stars': '143', 'repo_language': 'Fortran', 'file_name': 'remesh.rst', 'mime_type': 'text/plain', 'hash': -7889368548839580996, 'source_dataset': 'data'}


# -*- coding: utf-8 -*-
require 'helper'

class TestChartGridlines06 < Test::Unit::TestCase
  def setup
    setup_dir_var
  end

  def teardown
    @tempfile.close(true)
  end

  def test_chart_gridlines06
    @xlsx = 'chart_gridlines06.xlsx'
    workbook    =  WriteXLSX.new(@io)
    worksheet   = workbook.add_worksheet
    chart       = workbook.add_chart(:type => 'scatter', :embedded => 1)

    # For testing, copy the randomly generated axis ids in the target xls file.
    chart.instance_variable_set(:@axis_ids, [82812288, 46261376])

    data = [
            [ 1, 2, 3, 4,  5 ],
            [ 2, 4, 6, 8,  10 ],
            [ 3, 6, 9, 12, 15 ]
           ]

    worksheet.write('A1', data)

    chart.add_series(
                     :categories => '=Sheet1!$A$1:$A$5',
                     :values     => '=Sheet1!$B$1:$B$5'
                     )
    chart.add_series(
                     :categories => '=Sheet1!$A$1:$A$5',
                     :values     => '=Sheet1!$C$1:$C$5'
                     )

    chart.set_x_axis(
                     :major_gridlines => { :visible => 1 },
                     :minor_gridlines => { :visible => 1 }
                     )
    chart.set_y_axis(
                     :major_gridlines => { :visible => 1 },
                     :minor_gridlines => { :visible => 1 }
                     )

    worksheet.insert_chart('E9',  chart)

    workbook.close
    compare_for_regression
  end
end

{'repo_name': 'cxn03651/write_xlsx', 'stars': '214', 'repo_language': 'Ruby', 'file_name': 'test_chartsheet01.rb', 'mime_type': 'text/x-ruby', 'hash': 1887375048599803270, 'source_dataset': 'data'}


react-docgen-typescript

tsc && mocha --timeout 10000 ./lib/**/__tests__/**.js

tsc && mocha --debug ./lib/**/__tests__/**.js

npm run tsc && node ./lib/print.js ./src/__tests__/data/ColumnHigherOrderComponent.tsx simple

prettier --parser typescript --single-quote --trailing-comma none

npm run prettier:base -- -l "src/**/*.{ts,tsx}"

npm run prettier:base -- --write "src/**/*.{ts,tsx}"

{'repo_name': 'styleguidist/react-docgen-typescript', 'stars': '432', 'repo_language': 'TypeScript', 'file_name': 'Grid.tsx', 'mime_type': 'text/x-java', 'hash': -3684806451280058673, 'source_dataset': 'data'}


SET @LAFOO := 28120;
SET @MOODLE := 28122;
SET @JALOOT := 28121;
SET @CHICKENESCAPEE := 28161;
SET @GOREGEK := 28214;
SET @DAJIK := 28215;
SET @ZEPIK := 28216;
SET @MISTWHISPERLIGHTNINGCLOUD := 28253;
SET @MISTWHISPERLIGHTNINGTARGET := 28254;
SET @GLINTINGDIRT := 28362;
SET @RHUNOK := 28416;
SET @TORMENTOR := 28575;
SET @SCAREDSOFTKNUCKLE := 50979;
SET @LIGHTNING := 51172;
SET @FRENZYAURA := 51234;
SET @MISTWHISPERAURA := 51239;
SET @DIGGINGFORTEASURE := 51405;
SET @TREASUREPING:= 51420;
SET @THROWSPEAR := 51603;
SET @CHAINS1 := 51606;
SET @CHAINS2 := 51607;
SET @RAINSPEAKERAURA := 51639;
SET @SPEARBORNAURA := 51642;
SET @MOSSWALKERAURA := 51644;
SET @SKYREACHPILLARAURA:= 51645;
SET @SAPPHIREHIVEAURA := 51651;
SET @WOLVARPING := 51791;
SET @GORLOCPING := 51794;
SET @CHICKENLOCATIONPING := 51843;
SET @SCAREDCHICKEN := 51846;
SET @DESSAWNRETAINER := 53163;

DELETE FROM `creature_text` WHERE `entry`=@TORMENTOR;
INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES
(@TORMENTOR,0,0,'Filthy $R intruder. DIE!',12,0,100,0,0,0,'Rhunok''s Tormentor'),
(@TORMENTOR,0,1,'If Rhunok regains his strength, we all die!',12,0,100,0,0,0,'Rhunok''s Tormentor'),
(@TORMENTOR,0,2,'There are intruders about. Slay them before they ruin everything!',12,0,100,0,0,0,'Rhunok''s Tormentor'),
(@TORMENTOR,0,3,'The bear god must be kept enfeebled so that the prophet can finish the ritual.',12,0,100,0,0,0,'Rhunok''s Tormentor'),
(@TORMENTOR,0,4,'Keep him weak!',12,0,100,0,0,0,'Rhunok''s Tormentor');

UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@TORMENTOR;
-- DELETE FROM `creature_ai_scripts` WHERE `creature_id`=@TORMENTOR;
DELETE FROM `smart_scripts` WHERE `entryorguid` IN (-113481,-113482,-113483,-113558,@TORMENTOR) AND `source_type`=0;
INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
(@TORMENTOR,0,0,0,4,0,100,0,0,0,0,0,1,0,0,0,0,0,0,7,0,0,0,0,0,0,0, 'Rhunok''s Tormentor - On aggro - Say line'),
(@TORMENTOR,0,1,0,0,0,100,0,3000,8000,10000,20000,11,38556,0,0,0,0,0,2,0,0,0,0,0,0,0, 'Rhunok''s Tormentor - On update IC - Spellcast Throw'),
(@TORMENTOR,0,2,0,0,0,100,0,5000,30000,30000,35000,11,54526,0,0,0,0,0,2,0,0,0,0,0,0,0, 'Rhunok''s Tormentor - On update IC - Spellcast Torment'),
(@TORMENTOR,0,3,0,1,0,100,0,5000,30000,30000,40000,11,@THROWSPEAR,0,0,0,0,0,10,95460,@RHUNOK,0,0,0,0,0, 'Rhunok''s Tormentor - On update OOC - Spellcast Throw Spear'),

(-113481,0,0,0,1,0,100,0,0,0,5000,5000,11,@CHAINS1,0,0,0,0,0,10,95460,@RHUNOK,0,0,0,0,0, 'ELM General Purpose Bunny - On update OOC - Spellcast Rhunok''s Chains'),
(-113482,0,0,0,1,0,100,0,0,0,5000,5000,11,@CHAINS2,0,0,0,0,0,10,95460,@RHUNOK,0,0,0,0,0, 'ELM General Purpose Bunny - On update OOC - Spellcast Rhunok''s Chains'),
(-113483,0,0,0,1,0,100,0,0,0,5000,5000,11,@CHAINS1,0,0,0,0,0,10,95460,@RHUNOK,0,0,0,0,0, 'ELM General Purpose Bunny - On update OOC - Spellcast Rhunok''s Chains'),
(-113558,0,0,0,1,0,100,0,0,0,5000,5000,11,@CHAINS2,0,0,0,0,0,10,95460,@RHUNOK,0,0,0,0,0, 'ELM General Purpose Bunny - On update OOC - Spellcast Rhunok''s Chains');

DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry` IN (@THROWSPEAR,@CHAINS1,@CHAINS2,@LIGHTNING,@SCAREDSOFTKNUCKLE,@FRENZYAURA,@RAINSPEAKERAURA,@WOLVARPING,@GORLOCPING,@DESSAWNRETAINER,@CHICKENLOCATIONPING,@TREASUREPING,@DIGGINGFORTEASURE,@MOSSWALKERAURA,@SPEARBORNAURA,@MISTWHISPERAURA,@SAPPHIREHIVEAURA,@SCAREDCHICKEN,@SKYREACHPILLARAURA);
INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES
(13,1,@LIGHTNING,0,31,3,@MISTWHISPERLIGHTNINGTARGET,0,0,0, '', 'Cloud to Lightning hits Mistwhisper Lightning Target'),
(13,1,@LIGHTNING,1,31,3,@MISTWHISPERLIGHTNINGCLOUD,0,0,0, '', 'Cloud to Lightning hits Mistwhisper Lightning Cloud'),
(13,1,@FRENZYAURA,0,31,3,@GOREGEK,0,0,0,'','Spell Frenzyheart Hill Aura targets Goregek the Bristlepine Hunter'),
(13,1,@FRENZYAURA,1,31,3,@DAJIK,0,0,0,'','Spell Frenzyheart Hill Aura targets Dajik the Wasp Hunter'),
(13,1,@FRENZYAURA,2,31,3,@ZEPIK,0,0,0,'','Spell Frenzyheart Hill Aura targets Zepik the Gorloc Hunter'),
(13,1,@RAINSPEAKERAURA,0,31,3,@LAFOO,0,0,0,'','Spell Rainspeaker Canopy Aura targets Lafoo'),
(13,1,@RAINSPEAKERAURA,1,31,3,@MOODLE,0,0,0,'','Spell Rainspeaker Canopy Aura targets Jaloot'),
(13,1,@RAINSPEAKERAURA,2,31,3,@JALOOT,0,0,0,'','Spell Rainspeaker Canopy Aura targets Moodle'),
(13,1,@WOLVARPING,0,31,3,@GOREGEK,0,0,0,'','Spell Wolvar Location Ping targets Goregek the Bristlepine Hunter'),
(13,1,@WOLVARPING,1,31,3,@DAJIK,0,0,0,'','Spell Wolvar Location Ping targets Dajik the Wasp Hunter'),
(13,1,@WOLVARPING,2,31,3,@ZEPIK,0,0,0,'','Spell Wolvar Location Ping targets Zepik the Gorloc Hunter'),
(13,1,@GORLOCPING,0,31,3,@LAFOO,0,0,0,'','Spell Gorloc Location Ping targets Lafoo'),
(13,1,@GORLOCPING,1,31,3,@JALOOT,0,0,0,'','Spell Gorloc Location Ping targets Jaloot'),
(13,1,@GORLOCPING,2,31,3,@MOODLE,0,0,0,'','Spell Gorloc Location Ping targets Moodle'),
(13,1,@DESSAWNRETAINER,0,31,3,@LAFOO,0,0,0,'','Spell Dessawn Retainer targets Lafoo'),
(13,1,@DESSAWNRETAINER,1,31,3,@DAJIK,0,0,0,'','Spell Dessawn Retainer targets Dajik the Wasp Hunter'),
(13,1,@DESSAWNRETAINER,2,31,3,@ZEPIK,0,0,0,'','Spell Dessawn Retainer targets  Zepik the Gorloc Hunter'),
(13,1,@DESSAWNRETAINER,3,31,3,@JALOOT,0,0,0,'','Spell Dessawn Retainer targets Jaloot '),
(13,1,@DESSAWNRETAINER,4,31,3,@MOODLE,0,0,0,'','Spell Dessawn Retainer targets Moodle'),
(13,1,@DESSAWNRETAINER,5,31,3,@GOREGEK,0,0,0,'','Spell Dessawn Retainer targets  Goregek'),
(13,1,@TREASUREPING,0,31,3,@LAFOO,0,0,0,'','Spell Dessawn Retainer targets Lafoo'),
(13,1,@TREASUREPING,1,31,3,@JALOOT,0,0,0,'','Spell Dessawn Retainer targets Jaloot '),
(13,1,@TREASUREPING,2,31,3,@MOODLE,0,0,0,'','Spell Dessawn Retainer targets Moodle'),
(13,1,@CHICKENLOCATIONPING,0,31,3,@GOREGEK,0,0,0,'','Spell chicken ping targets Goregek'),
(13,1,@CHICKENLOCATIONPING,1,31,3,@DAJIK,0,0,0,'','Spell chicken ping targets Dajik '),
(13,1,@CHICKENLOCATIONPING,2,31,3,@ZEPIK,0,0,0,'','Spell chicken ping targets Zepik'),
(13,3,@SCAREDCHICKEN,0,31,3,@CHICKENESCAPEE,0,0,0,'','Scared Chicken targets only chicken escapee'),
(13,1,@MOSSWALKERAURA,0,31,3,@MOODLE,0,0,0,'','Mosswalker village aura targets moodle'),
(13,1,@SPEARBORNAURA,0,31,3,@JALOOT,0,0,0,'','spearborn encampment aura targets moodle'),
(13,1,@MISTWHISPERAURA,0,31,3,@ZEPIK,0,0,0,'','mistwhisper refuge aura targets zepik'),
(13,1,@SAPPHIREHIVEAURA,0,31,3,@DAJIK,0,0,0,'','sapphire hive aura targets dajik'),
(13,1,@THROWSPEAR,0,31,3,@RHUNOK,0,0,0,'','Spell Throw Spear targets Rhunok'),
(13,1,@CHAINS1,0,31,3,@RHUNOK,0,0,0,'','Spell Rhunok''s Chains targets Rhunok'),
(13,1,@CHAINS2,0,31,3,@RHUNOK,0,0,0,'','Spell Rhunok''s Chains targets Rhunok'),
(13,1,@SKYREACHPILLARAURA,0,31,3,@DAJIK,0,0,0,'','skyreach pillar aura targets dajik');

{'repo_name': 'TrinityCore/TrinityCore', 'stars': '6272', 'repo_language': 'C++', 'file_name': '2020_08_12_07_hotifxes.sql', 'mime_type': 'text/plain', 'hash': 1700042931176635353, 'source_dataset': 'data'}


/*
** 2004 May 26
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
**
** This file contains code use to implement APIs that are part of the
** VDBE.
*/
#include "sqliteInt.h"
#include "vdbeInt.h"
#include "os.h"

/*
** Return TRUE (non-zero) of the statement supplied as an argument needs
** to be recompiled.  A statement needs to be recompiled whenever the
** execution environment changes in a way that would alter the program
** that sqlite3_prepare() generates.  For example, if new functions or
** collating sequences are registered or if an authorizer function is
** added or changed.
*/
int sqlite3_expired(sqlite3_stmt *pStmt){
  Vdbe *p = (Vdbe*)pStmt;
  return p==0 || p->expired;
}

/**************************** sqlite3_value_  *******************************
** The following routines extract information from a Mem or sqlite3_value
** structure.
*/
const void *sqlite3_value_blob(sqlite3_value *pVal){
  Mem *p = (Mem*)pVal;
  if( p->flags & (MEM_Blob|MEM_Str) ){
    return p->z;
  }else{
    return sqlite3_value_text(pVal);
  }
}
int sqlite3_value_bytes(sqlite3_value *pVal){
  return sqlite3ValueBytes(pVal, SQLITE_UTF8);
}
int sqlite3_value_bytes16(sqlite3_value *pVal){
  return sqlite3ValueBytes(pVal, SQLITE_UTF16NATIVE);
}
double sqlite3_value_double(sqlite3_value *pVal){
  return sqlite3VdbeRealValue((Mem*)pVal);
}
int sqlite3_value_int(sqlite3_value *pVal){
  return sqlite3VdbeIntValue((Mem*)pVal);
}
sqlite_int64 sqlite3_value_int64(sqlite3_value *pVal){
  return sqlite3VdbeIntValue((Mem*)pVal);
}
const unsigned char *sqlite3_value_text(sqlite3_value *pVal){
  return (const unsigned char *)sqlite3ValueText(pVal, SQLITE_UTF8);
}
#ifndef SQLITE_OMIT_UTF16
const void *sqlite3_value_text16(sqlite3_value* pVal){
  return sqlite3ValueText(pVal, SQLITE_UTF16NATIVE);
}
const void *sqlite3_value_text16be(sqlite3_value *pVal){
  return sqlite3ValueText(pVal, SQLITE_UTF16BE);
}
const void *sqlite3_value_text16le(sqlite3_value *pVal){
  return sqlite3ValueText(pVal, SQLITE_UTF16LE);
}
#endif /* SQLITE_OMIT_UTF16 */
int sqlite3_value_type(sqlite3_value* pVal){
  return pVal->type;
}
/* sqlite3_value_numeric_type() defined in vdbe.c */

/**************************** sqlite3_result_  *******************************
** The following routines are used by user-defined functions to specify
** the function result.
*/
void sqlite3_result_blob(
  sqlite3_context *pCtx,
  const void *z,
  int n,
  void (*xDel)(void *)
){
  assert( n>=0 );
  sqlite3VdbeMemSetStr(&pCtx->s, z, n, 0, xDel);
}
void sqlite3_result_double(sqlite3_context *pCtx, double rVal){
  sqlite3VdbeMemSetDouble(&pCtx->s, rVal);
}
void sqlite3_result_error(sqlite3_context *pCtx, const char *z, int n){
  pCtx->isError = 1;
  sqlite3VdbeMemSetStr(&pCtx->s, z, n, SQLITE_UTF8, SQLITE_TRANSIENT);
}
#ifndef SQLITE_OMIT_UTF16
void sqlite3_result_error16(sqlite3_context *pCtx, const void *z, int n){
  pCtx->isError = 1;
  sqlite3VdbeMemSetStr(&pCtx->s, z, n, SQLITE_UTF16NATIVE, SQLITE_TRANSIENT);
}
#endif
void sqlite3_result_int(sqlite3_context *pCtx, int iVal){
  sqlite3VdbeMemSetInt64(&pCtx->s, (i64)iVal);
}
void sqlite3_result_int64(sqlite3_context *pCtx, i64 iVal){
  sqlite3VdbeMemSetInt64(&pCtx->s, iVal);
}
void sqlite3_result_null(sqlite3_context *pCtx){
  sqlite3VdbeMemSetNull(&pCtx->s);
}
void sqlite3_result_text(
  sqlite3_context *pCtx,
  const char *z,
  int n,
  void (*xDel)(void *)
){
  sqlite3VdbeMemSetStr(&pCtx->s, z, n, SQLITE_UTF8, xDel);
}
#ifndef SQLITE_OMIT_UTF16
void sqlite3_result_text16(
  sqlite3_context *pCtx,
  const void *z,
  int n,
  void (*xDel)(void *)
){
  sqlite3VdbeMemSetStr(&pCtx->s, z, n, SQLITE_UTF16NATIVE, xDel);
}
void sqlite3_result_text16be(
  sqlite3_context *pCtx,
  const void *z,
  int n,
  void (*xDel)(void *)
){
  sqlite3VdbeMemSetStr(&pCtx->s, z, n, SQLITE_UTF16BE, xDel);
}
void sqlite3_result_text16le(
  sqlite3_context *pCtx,
  const void *z,
  int n,
  void (*xDel)(void *)
){
  sqlite3VdbeMemSetStr(&pCtx->s, z, n, SQLITE_UTF16LE, xDel);
}
#endif /* SQLITE_OMIT_UTF16 */
void sqlite3_result_value(sqlite3_context *pCtx, sqlite3_value *pValue){
  sqlite3VdbeMemCopy(&pCtx->s, pValue);
}

/*
** Execute the statement pStmt, either until a row of data is ready, the
** statement is completely executed or an error occurs.
*/
int sqlite3_step(sqlite3_stmt *pStmt){
  Vdbe *p = (Vdbe*)pStmt;
  sqlite3 *db;
  int rc;

  /* Assert that malloc() has not failed */
  assert( !sqlite3MallocFailed() );

  if( p==0 || p->magic!=VDBE_MAGIC_RUN ){
    return SQLITE_MISUSE;
  }
  if( p->aborted ){
    return SQLITE_ABORT;
  }
  if( p->pc<=0 && p->expired ){
    if( p->rc==SQLITE_OK ){
      p->rc = SQLITE_SCHEMA;
    }
    return SQLITE_ERROR;
  }
  db = p->db;
  if( sqlite3SafetyOn(db) ){
    p->rc = SQLITE_MISUSE;
    return SQLITE_MISUSE;
  }
  if( p->pc<0 ){
#ifndef SQLITE_OMIT_TRACE
    /* Invoke the trace callback if there is one
    */
    if( db->xTrace && !db->init.busy ){
      assert( p->nOp>0 );
      assert( p->aOp[p->nOp-1].opcode==OP_Noop );
      assert( p->aOp[p->nOp-1].p3!=0 );
      assert( p->aOp[p->nOp-1].p3type==P3_DYNAMIC );
      sqlite3SafetyOff(db);
      db->xTrace(db->pTraceArg, p->aOp[p->nOp-1].p3);
      if( sqlite3SafetyOn(db) ){
        p->rc = SQLITE_MISUSE;
        return SQLITE_MISUSE;
      }
    }
    if( db->xProfile && !db->init.busy ){
      double rNow;
      sqlite3OsCurrentTime(&rNow);
      p->startTime = (rNow - (int)rNow)*3600.0*24.0*1000000000.0;
    }
#endif

    /* Print a copy of SQL as it is executed if the SQL_TRACE pragma is turned
    ** on in debugging mode.
    */
#ifdef SQLITE_DEBUG
    if( (db->flags & SQLITE_SqlTrace)!=0 ){
      sqlite3DebugPrintf("SQL-trace: %s\n", p->aOp[p->nOp-1].p3);
    }
#endif /* SQLITE_DEBUG */

    db->activeVdbeCnt++;
    p->pc = 0;
  }
#ifndef SQLITE_OMIT_EXPLAIN
  if( p->explain ){
    rc = sqlite3VdbeList(p);
  }else
#endif /* SQLITE_OMIT_EXPLAIN */
  {
    rc = sqlite3VdbeExec(p);
  }

  if( sqlite3SafetyOff(db) ){
    rc = SQLITE_MISUSE;
  }

#ifndef SQLITE_OMIT_TRACE
  /* Invoke the profile callback if there is one
  */
  if( rc!=SQLITE_ROW && db->xProfile && !db->init.busy ){
    double rNow;
    u64 elapseTime;

    sqlite3OsCurrentTime(&rNow);
    elapseTime = (rNow - (int)rNow)*3600.0*24.0*1000000000.0 - p->startTime;
    assert( p->nOp>0 );
    assert( p->aOp[p->nOp-1].opcode==OP_Noop );
    assert( p->aOp[p->nOp-1].p3!=0 );
    assert( p->aOp[p->nOp-1].p3type==P3_DYNAMIC );
    db->xProfile(db->pProfileArg, p->aOp[p->nOp-1].p3, elapseTime);
  }
#endif

  sqlite3Error(p->db, rc, 0);
  p->rc = sqlite3ApiExit(p->db, p->rc);
  return rc;
}

/*
** Extract the user data from a sqlite3_context structure and return a
** pointer to it.
*/
void *sqlite3_user_data(sqlite3_context *p){
  assert( p && p->pFunc );
  return p->pFunc->pUserData;
}

/*
** Allocate or return the aggregate context for a user function.  A new
** context is allocated on the first call.  Subsequent calls return the
** same context that was returned on prior calls.
*/
void *sqlite3_aggregate_context(sqlite3_context *p, int nByte){
  Mem *pMem = p->pMem;
  assert( p && p->pFunc && p->pFunc->xStep );
  if( (pMem->flags & MEM_Agg)==0 ){
    if( nByte==0 ){
      assert( pMem->flags==MEM_Null );
      pMem->z = 0;
    }else{
      pMem->flags = MEM_Agg;
      pMem->xDel = sqlite3FreeX;
      *(FuncDef**)&pMem->i = p->pFunc;
      if( nByte<=NBFS ){
        pMem->z = pMem->zShort;
        memset(pMem->z, 0, nByte);
      }else{
        pMem->z = sqliteMalloc( nByte );
      }
    }
  }
  return (void*)pMem->z;
}

/*
** Return the auxilary data pointer, if any, for the iArg'th argument to
** the user-function defined by pCtx.
*/
void *sqlite3_get_auxdata(sqlite3_context *pCtx, int iArg){
  VdbeFunc *pVdbeFunc = pCtx->pVdbeFunc;
  if( !pVdbeFunc || iArg>=pVdbeFunc->nAux || iArg<0 ){
    return 0;
  }
  return pVdbeFunc->apAux[iArg].pAux;
}

/*
** Set the auxilary data pointer and delete function, for the iArg'th
** argument to the user-function defined by pCtx. Any previous value is
** deleted by calling the delete function specified when it was set.
*/
void sqlite3_set_auxdata(
  sqlite3_context *pCtx,
  int iArg,
  void *pAux,
  void (*xDelete)(void*)
){
  struct AuxData *pAuxData;
  VdbeFunc *pVdbeFunc;
  if( iArg<0 ) return;

  pVdbeFunc = pCtx->pVdbeFunc;
  if( !pVdbeFunc || pVdbeFunc->nAux<=iArg ){
    int nMalloc = sizeof(VdbeFunc) + sizeof(struct AuxData)*iArg;
    pVdbeFunc = sqliteRealloc(pVdbeFunc, nMalloc);
    if( !pVdbeFunc ) return;
    pCtx->pVdbeFunc = pVdbeFunc;
    memset(&pVdbeFunc->apAux[pVdbeFunc->nAux], 0,
             sizeof(struct AuxData)*(iArg+1-pVdbeFunc->nAux));
    pVdbeFunc->nAux = iArg+1;
    pVdbeFunc->pFunc = pCtx->pFunc;
  }

  pAuxData = &pVdbeFunc->apAux[iArg];
  if( pAuxData->pAux && pAuxData->xDelete ){
    pAuxData->xDelete(pAuxData->pAux);
  }
  pAuxData->pAux = pAux;
  pAuxData->xDelete = xDelete;
}

/*
** Return the number of times the Step function of a aggregate has been
** called.
**
** This function is deprecated.  Do not use it for new code.  It is
** provide only to avoid breaking legacy code.  New aggregate function
** implementations should keep their own counts within their aggregate
** context.
*/
int sqlite3_aggregate_count(sqlite3_context *p){
  assert( p && p->pFunc && p->pFunc->xStep );
  return p->pMem->n;
}

/*
** Return the number of columns in the result set for the statement pStmt.
*/
int sqlite3_column_count(sqlite3_stmt *pStmt){
  Vdbe *pVm = (Vdbe *)pStmt;
  return pVm ? pVm->nResColumn : 0;
}

/*
** Return the number of values available from the current row of the
** currently executing statement pStmt.
*/
int sqlite3_data_count(sqlite3_stmt *pStmt){
  Vdbe *pVm = (Vdbe *)pStmt;
  if( pVm==0 || !pVm->resOnStack ) return 0;
  return pVm->nResColumn;
}

/*
** Check to see if column iCol of the given statement is valid.  If
** it is, return a pointer to the Mem for the value of that column.
** If iCol is not valid, return a pointer to a Mem which has a value
** of NULL.
*/
static Mem *columnMem(sqlite3_stmt *pStmt, int i){
  Vdbe *pVm = (Vdbe *)pStmt;
  int vals = sqlite3_data_count(pStmt);
  if( i>=vals || i<0 ){
    static Mem nullMem;
    if( nullMem.flags==0 ){ nullMem.flags = MEM_Null; }
    sqlite3Error(pVm->db, SQLITE_RANGE, 0);
    return &nullMem;
  }
  return &pVm->pTos[(1-vals)+i];
}

/*
** This function is called after invoking an sqlite3_value_XXX function on a
** column value (i.e. a value returned by evaluating an SQL expression in the
** select list of a SELECT statement) that may cause a malloc() failure. If
** malloc() has failed, the threads mallocFailed flag is cleared and the result
** code of statement pStmt set to SQLITE_NOMEM.
**
** Specificly, this is called from within:
**
**     sqlite3_column_int()
**     sqlite3_column_int64()
**     sqlite3_column_text()
**     sqlite3_column_text16()
**     sqlite3_column_real()
**     sqlite3_column_bytes()
**     sqlite3_column_bytes16()
**
** But not for sqlite3_column_blob(), which never calls malloc().
*/
static void columnMallocFailure(sqlite3_stmt *pStmt)
{
  /* If malloc() failed during an encoding conversion within an
  ** sqlite3_column_XXX API, then set the return code of the statement to
  ** SQLITE_NOMEM. The next call to _step() (if any) will return SQLITE_ERROR
  ** and _finalize() will return NOMEM.
  */
  Vdbe *p = (Vdbe *)pStmt;
  p->rc = sqlite3ApiExit(0, p->rc);
}

/**************************** sqlite3_column_  *******************************
** The following routines are used to access elements of the current row
** in the result set.
*/
const void *sqlite3_column_blob(sqlite3_stmt *pStmt, int i){
  const void *val;
  sqlite3MallocDisallow();
  val = sqlite3_value_blob( columnMem(pStmt,i) );
  sqlite3MallocAllow();
  return val;
}
int sqlite3_column_bytes(sqlite3_stmt *pStmt, int i){
  int val = sqlite3_value_bytes( columnMem(pStmt,i) );
  columnMallocFailure(pStmt);
  return val;
}
int sqlite3_column_bytes16(sqlite3_stmt *pStmt, int i){
  int val = sqlite3_value_bytes16( columnMem(pStmt,i) );
  columnMallocFailure(pStmt);
  return val;
}
double sqlite3_column_double(sqlite3_stmt *pStmt, int i){
  double val = sqlite3_value_double( columnMem(pStmt,i) );
  columnMallocFailure(pStmt);
  return val;
}
int sqlite3_column_int(sqlite3_stmt *pStmt, int i){
  int val = sqlite3_value_int( columnMem(pStmt,i) );
  columnMallocFailure(pStmt);
  return val;
}
sqlite_int64 sqlite3_column_int64(sqlite3_stmt *pStmt, int i){
  sqlite_int64 val = sqlite3_value_int64( columnMem(pStmt,i) );
  columnMallocFailure(pStmt);
  return val;
}
const unsigned char *sqlite3_column_text(sqlite3_stmt *pStmt, int i){
  const unsigned char *val = sqlite3_value_text( columnMem(pStmt,i) );
  columnMallocFailure(pStmt);
  return val;
}
#if 0
sqlite3_value *sqlite3_column_value(sqlite3_stmt *pStmt, int i){
  return columnMem(pStmt, i);
}
#endif
#ifndef SQLITE_OMIT_UTF16
const void *sqlite3_column_text16(sqlite3_stmt *pStmt, int i){
  const void *val = sqlite3_value_text16( columnMem(pStmt,i) );
  columnMallocFailure(pStmt);
  return val;
}
#endif /* SQLITE_OMIT_UTF16 */
int sqlite3_column_type(sqlite3_stmt *pStmt, int i){
  return sqlite3_value_type( columnMem(pStmt,i) );
}

/* The following function is experimental and subject to change or
** removal */
/*int sqlite3_column_numeric_type(sqlite3_stmt *pStmt, int i){
**  return sqlite3_value_numeric_type( columnMem(pStmt,i) );
**}
*/

/*
** Convert the N-th element of pStmt->pColName[] into a string using
** xFunc() then return that string.  If N is out of range, return 0.
**
** There are up to 5 names for each column.  useType determines which
** name is returned.  Here are the names:
**
**    0      The column name as it should be displayed for output
**    1      The datatype name for the column
**    2      The name of the database that the column derives from
**    3      The name of the table that the column derives from
**    4      The name of the table column that the result column derives from
**
** If the result is not a simple column reference (if it is an expression
** or a constant) then useTypes 2, 3, and 4 return NULL.
*/
static const void *columnName(
  sqlite3_stmt *pStmt,
  int N,
  const void *(*xFunc)(Mem*),
  int useType
){
  const void *ret;
  Vdbe *p = (Vdbe *)pStmt;
  int n = sqlite3_column_count(pStmt);

  if( p==0 || N>=n || N<0 ){
    return 0;
  }
  N += useType*n;
  ret = xFunc(&p->aColName[N]);

  /* A malloc may have failed inside of the xFunc() call. If this is the case,
  ** clear the mallocFailed flag and return NULL.
  */
  sqlite3ApiExit(0, 0);
  return ret;
}

/*
** Return the name of the Nth column of the result set returned by SQL
** statement pStmt.
*/
const char *sqlite3_column_name(sqlite3_stmt *pStmt, int N){
  return columnName(
      pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, COLNAME_NAME);
}
#ifndef SQLITE_OMIT_UTF16
const void *sqlite3_column_name16(sqlite3_stmt *pStmt, int N){
  return columnName(
      pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_NAME);
}
#endif

/*
** Return the column declaration type (if applicable) of the 'i'th column
** of the result set of SQL statement pStmt.
*/
const char *sqlite3_column_decltype(sqlite3_stmt *pStmt, int N){
  return columnName(
      pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, COLNAME_DECLTYPE);
}
#ifndef SQLITE_OMIT_UTF16
const void *sqlite3_column_decltype16(sqlite3_stmt *pStmt, int N){
  return columnName(
      pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_DECLTYPE);
}
#endif /* SQLITE_OMIT_UTF16 */

#ifdef SQLITE_ENABLE_COLUMN_METADATA
/*
** Return the name of the database from which a result column derives.
** NULL is returned if the result column is an expression or constant or
** anything else which is not an unabiguous reference to a database column.
*/
const char *sqlite3_column_database_name(sqlite3_stmt *pStmt, int N){
  return columnName(
      pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, COLNAME_DATABASE);
}
#ifndef SQLITE_OMIT_UTF16
const void *sqlite3_column_database_name16(sqlite3_stmt *pStmt, int N){
  return columnName(
      pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_DATABASE);
}
#endif /* SQLITE_OMIT_UTF16 */

/*
** Return the name of the table from which a result column derives.
** NULL is returned if the result column is an expression or constant or
** anything else which is not an unabiguous reference to a database column.
*/
const char *sqlite3_column_table_name(sqlite3_stmt *pStmt, int N){
  return columnName(
      pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, COLNAME_TABLE);
}
#ifndef SQLITE_OMIT_UTF16
const void *sqlite3_column_table_name16(sqlite3_stmt *pStmt, int N){
  return columnName(
      pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_TABLE);
}
#endif /* SQLITE_OMIT_UTF16 */

/*
** Return the name of the table column from which a result column derives.
** NULL is returned if the result column is an expression or constant or
** anything else which is not an unabiguous reference to a database column.
*/
const char *sqlite3_column_origin_name(sqlite3_stmt *pStmt, int N){
  return columnName(
      pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, COLNAME_COLUMN);
}
#ifndef SQLITE_OMIT_UTF16
const void *sqlite3_column_origin_name16(sqlite3_stmt *pStmt, int N){
  return columnName(
      pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_COLUMN);
}
#endif /* SQLITE_OMIT_UTF16 */
#endif /* SQLITE_ENABLE_COLUMN_METADATA */

/******************************* sqlite3_bind_  ***************************
**
** Routines used to attach values to wildcards in a compiled SQL statement.
*/
/*
** Unbind the value bound to variable i in virtual machine p. This is the
** the same as binding a NULL value to the column. If the "i" parameter is
** out of range, then SQLITE_RANGE is returned. Othewise SQLITE_OK.
**
** The error code stored in database p->db is overwritten with the return
** value in any case.
*/
static int vdbeUnbind(Vdbe *p, int i){
  Mem *pVar;
  if( p==0 || p->magic!=VDBE_MAGIC_RUN || p->pc>=0 ){
    if( p ) sqlite3Error(p->db, SQLITE_MISUSE, 0);
    return SQLITE_MISUSE;
  }
  if( i<1 || i>p->nVar ){
    sqlite3Error(p->db, SQLITE_RANGE, 0);
    return SQLITE_RANGE;
  }
  i--;
  pVar = &p->aVar[i];
  sqlite3VdbeMemRelease(pVar);
  pVar->flags = MEM_Null;
  sqlite3Error(p->db, SQLITE_OK, 0);
  return SQLITE_OK;
}

/*
** Bind a text or BLOB value.
*/
static int bindText(
  sqlite3_stmt *pStmt,
  int i,
  const void *zData,
  int nData,
  void (*xDel)(void*),
  int encoding
){
  Vdbe *p = (Vdbe *)pStmt;
  Mem *pVar;
  int rc;

  rc = vdbeUnbind(p, i);
  if( rc || zData==0 ){
    return rc;
  }
  pVar = &p->aVar[i-1];
  rc = sqlite3VdbeMemSetStr(pVar, zData, nData, encoding, xDel);
  if( rc==SQLITE_OK && encoding!=0 ){
    rc = sqlite3VdbeChangeEncoding(pVar, ENC(p->db));
  }

  sqlite3Error(((Vdbe *)pStmt)->db, rc, 0);
  return sqlite3ApiExit(((Vdbe *)pStmt)->db, rc);
}

/*
** Bind a blob value to an SQL statement variable.
*/
int sqlite3_bind_blob(
  sqlite3_stmt *pStmt,
  int i,
  const void *zData,
  int nData,
  void (*xDel)(void*)
){
  return bindText(pStmt, i, zData, nData, xDel, 0);
}
int sqlite3_bind_double(sqlite3_stmt *pStmt, int i, double rValue){
  int rc;
  Vdbe *p = (Vdbe *)pStmt;
  rc = vdbeUnbind(p, i);
  if( rc==SQLITE_OK ){
    sqlite3VdbeMemSetDouble(&p->aVar[i-1], rValue);
  }
  return rc;
}
int sqlite3_bind_int(sqlite3_stmt *p, int i, int iValue){
  return sqlite3_bind_int64(p, i, (i64)iValue);
}
int sqlite3_bind_int64(sqlite3_stmt *pStmt, int i, sqlite_int64 iValue){
  int rc;
  Vdbe *p = (Vdbe *)pStmt;
  rc = vdbeUnbind(p, i);
  if( rc==SQLITE_OK ){
    sqlite3VdbeMemSetInt64(&p->aVar[i-1], iValue);
  }
  return rc;
}
int sqlite3_bind_null(sqlite3_stmt* p, int i){
  return vdbeUnbind((Vdbe *)p, i);
}
int sqlite3_bind_text(
  sqlite3_stmt *pStmt,
  int i,
  const char *zData,
  int nData,
  void (*xDel)(void*)
){
  return bindText(pStmt, i, zData, nData, xDel, SQLITE_UTF8);
}
#ifndef SQLITE_OMIT_UTF16
int sqlite3_bind_text16(
  sqlite3_stmt *pStmt,
  int i,
  const void *zData,
  int nData,
  void (*xDel)(void*)
){
  return bindText(pStmt, i, zData, nData, xDel, SQLITE_UTF16NATIVE);
}
#endif /* SQLITE_OMIT_UTF16 */

/*
** Return the number of wildcards that can be potentially bound to.
** This routine is added to support DBD::SQLite.
*/
int sqlite3_bind_parameter_count(sqlite3_stmt *pStmt){
  Vdbe *p = (Vdbe*)pStmt;
  return p ? p->nVar : 0;
}

/*
** Create a mapping from variable numbers to variable names
** in the Vdbe.azVar[] array, if such a mapping does not already
** exist.
*/
static void createVarMap(Vdbe *p){
  if( !p->okVar ){
    int j;
    Op *pOp;
    for(j=0, pOp=p->aOp; j<p->nOp; j++, pOp++){
      if( pOp->opcode==OP_Variable ){
        assert( pOp->p1>0 && pOp->p1<=p->nVar );
        p->azVar[pOp->p1-1] = pOp->p3;
      }
    }
    p->okVar = 1;
  }
}

/*
** Return the name of a wildcard parameter.  Return NULL if the index
** is out of range or if the wildcard is unnamed.
**
** The result is always UTF-8.
*/
const char *sqlite3_bind_parameter_name(sqlite3_stmt *pStmt, int i){
  Vdbe *p = (Vdbe*)pStmt;
  if( p==0 || i<1 || i>p->nVar ){
    return 0;
  }
  createVarMap(p);
  return p->azVar[i-1];
}

/*
** Given a wildcard parameter name, return the index of the variable
** with that name.  If there is no variable with the given name,
** return 0.
*/
int sqlite3_bind_parameter_index(sqlite3_stmt *pStmt, const char *zName){
  Vdbe *p = (Vdbe*)pStmt;
  int i;
  if( p==0 ){
    return 0;
  }
  createVarMap(p);
  if( zName ){
    for(i=0; i<p->nVar; i++){
      const char *z = p->azVar[i];
      if( z && strcmp(z,zName)==0 ){
        return i+1;
      }
    }
  }
  return 0;
}

/*
** Transfer all bindings from the first statement over to the second.
** If the two statements contain a different number of bindings, then
** an SQLITE_ERROR is returned.
*/
int sqlite3_transfer_bindings(sqlite3_stmt *pFromStmt, sqlite3_stmt *pToStmt){
  Vdbe *pFrom = (Vdbe*)pFromStmt;
  Vdbe *pTo = (Vdbe*)pToStmt;
  int i, rc = SQLITE_OK;
  if( (pFrom->magic!=VDBE_MAGIC_RUN && pFrom->magic!=VDBE_MAGIC_HALT)
    || (pTo->magic!=VDBE_MAGIC_RUN && pTo->magic!=VDBE_MAGIC_HALT) ){
    return SQLITE_MISUSE;
  }
  if( pFrom->nVar!=pTo->nVar ){
    return SQLITE_ERROR;
  }
  for(i=0; rc==SQLITE_OK && i<pFrom->nVar; i++){
    sqlite3MallocDisallow();
    rc = sqlite3VdbeMemMove(&pTo->aVar[i], &pFrom->aVar[i]);
    sqlite3MallocAllow();
  }
  return rc;
}

/*
** Return the sqlite3* database handle to which the prepared statement given
** in the argument belongs.  This is the same database handle that was
** the first argument to the sqlite3_prepare() that was used to create
** the statement in the first place.
*/
sqlite3 *sqlite3_db_handle(sqlite3_stmt *pStmt){
  return pStmt ? ((Vdbe*)pStmt)->db : 0;
}

{'repo_name': 'plutinosoft/Platinum', 'stars': '304', 'repo_language': 'C++', 'file_name': 'SQLite.vcproj', 'mime_type': 'text/xml', 'hash': -5670023749748687879, 'source_dataset': 'data'}


package com.sksamuel.scapegoat.inspections.exception

import com.sksamuel.scapegoat.InspectionTest

/** @author Marconi Lanna */
class CatchExceptionTest extends InspectionTest {

  override val inspections = Seq(new CatchException)

  "catch _ exception" - {
    "should report warning" in {

      val code1 = """object Test {
                        try {
                        } catch {
                          case t : Throwable =>
                          case _ : Exception =>
                        }
                    } """.stripMargin

      compileCodeSnippet(code1)
      compiler.scapegoat.feedback.warnings.size shouldBe 1
    }
  }
  "catch e exception" - {
    "should report warning" in {

      val code2 = """object Test {
                        try {
                        } catch {
                          case e : RuntimeException =>
                          case x : Exception =>
                          case f : Throwable =>
                        }
                    } """.stripMargin

      compileCodeSnippet(code2)
      compiler.scapegoat.feedback.warnings.size shouldBe 1
    }
  }
  "catch without exception case" - {
    "should not report warning" in {

      val code2 = """object Test {
                        try {
                        } catch {
                          case e : RuntimeException =>
                          case f : Throwable =>
                        }
                    } """.stripMargin

      compileCodeSnippet(code2)
      compiler.scapegoat.feedback.warnings.size shouldBe 0
    }
  }
}

{'repo_name': 'sksamuel/scapegoat', 'stars': '374', 'repo_language': 'Scala', 'file_name': 'plugins.sbt', 'mime_type': 'text/plain', 'hash': -843175191525074720, 'source_dataset': 'data'}


babel-helper-function-name

Helper function to change the property 'name' of every function

{'repo_name': 'sx1989827/DOClever', 'stars': '2669', 'repo_language': 'JavaScript', 'file_name': 'parse.js', 'mime_type': 'text/plain', 'hash': -1249182722751574106, 'source_dataset': 'data'}


// +build !linux,!freebsd freebsd,!cgo

package mount

func mount(device, target, mType string, flag uintptr, data string) error {
	panic("Not implemented")
}

func unmount(target string, flag int) error {
	panic("Not implemented")
}

{'repo_name': 'rancher/docker-from-scratch', 'stars': '104', 'repo_language': 'Go', 'file_name': 'util_linux.go', 'mime_type': 'text/plain', 'hash': -8991468260889971744, 'source_dataset': 'data'}


/*
  +----------------------------------------------------------------------+
  | phar php single-file executable PHP extension                        |
  +----------------------------------------------------------------------+
  | Copyright (c) 2005-2016 The PHP Group                                |
  +----------------------------------------------------------------------+
  | This source file is subject to version 3.01 of the PHP license,      |
  | that is bundled with this package in the file LICENSE, and is        |
  | available through the world-wide-web at the following url:           |
  | http://www.php.net/license/3_01.txt.                                 |
  | If you did not receive a copy of the PHP license and are unable to   |
  | obtain it through the world-wide-web, please send a note to          |
  | license@php.net so we can mail you a copy immediately.               |
  +----------------------------------------------------------------------+
  | Authors: Gregory Beaver <cellog@php.net>                             |
  |          Marcus Boerger <helly@php.net>                              |
  +----------------------------------------------------------------------+
*/

/* $Id$ */

#ifndef PHP_PHAR_H
#define PHP_PHAR_H

#define PHP_PHAR_VERSION "2.0.2"

#include "ext/standard/basic_functions.h"
extern zend_module_entry phar_module_entry;
#define phpext_phar_ptr &phar_module_entry

#ifdef PHP_WIN32
#define PHP_PHAR_API __declspec(dllexport)
#else
#define PHP_PHAR_API PHPAPI
#endif

PHP_PHAR_API int phar_resolve_alias(char *alias, int alias_len, char **filename, int *filename_len TSRMLS_DC);

#endif /* PHP_PHAR_H */

/*
 * Local variables:
 * tab-width: 4
 * c-basic-offset: 4
 * End:
 * vim600: noet sw=4 ts=4 fdm=marker
 * vim<600: noet sw=4 ts=4
 */

{'repo_name': 'fanchy/h2engine', 'stars': '197', 'repo_language': 'C', 'file_name': 'pem.h', 'mime_type': 'text/x-c', 'hash': 3793048059046508502, 'source_dataset': 'data'}


package com.blamejared.crafttweaker.api.zencode.impl.preprocessors.snipping;

public class SnippingParameterNoStart extends SnippingParameter {

    public SnippingParameterNoStart() {
        super("nostart");
    }

    @Override
    public SnippingParameterHit isHit(String[] additionalArguments) {
        return SnippingParameterHit.noSnip(0);
    }
}

{'repo_name': 'CraftTweaker/CraftTweaker', 'stars': '121', 'repo_language': 'Java', 'file_name': 'gradle-wrapper.properties', 'mime_type': 'text/plain', 'hash': 5109901817606653323, 'source_dataset': 'data'}


// This file was procedurally generated from the following sources:
// - src/function-forms/dflt-params-rest.case
// - src/function-forms/syntax/async-gen-func-decl.template
/*---
description: RestParameter does not support an initializer (async generator function declaration)
esid: sec-asyncgenerator-definitions-instantiatefunctionobject
features: [default-parameters, async-iteration]
flags: [generated]
negative:
  phase: parse
  type: SyntaxError
info: |
    AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
        ( FormalParameters ) { AsyncGeneratorBody }

        [...]
        3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
            scope, strict).
        [...]

    14.1 Function Definitions

    Syntax

    FunctionRestParameter[Yield] :

      BindingRestElement[?Yield]

    13.3.3 Destructuring Binding Patterns

    Syntax

    BindingRestElement[Yield] :

      ...BindingIdentifier[?Yield]
      ...BindingPattern[?Yield]

---*/
throw "Test262: This statement should not be evaluated.";

async function* f(...x = []) {

}

{'repo_name': 'sebastienros/jint', 'stars': '1901', 'repo_language': 'C#', 'file_name': 'let-array-with-newline.js', 'mime_type': 'text/plain', 'hash': 2637518992977120354, 'source_dataset': 'data'}


/*
 * Copyright (C) 2017 Intel Corporation.
 *
 * This file is released under the GPL.
 */

#include "dm.h"

#include <linux/module.h>

struct unstripe_c {
	struct dm_dev *dev;
	sector_t physical_start;

	uint32_t stripes;

	uint32_t unstripe;
	sector_t unstripe_width;
	sector_t unstripe_offset;

	uint32_t chunk_size;
	u8 chunk_shift;
};

#define DM_MSG_PREFIX "unstriped"

static void cleanup_unstripe(struct unstripe_c *uc, struct dm_target *ti)
{
	if (uc->dev)
		dm_put_device(ti, uc->dev);
	kfree(uc);
}

/*
 * Contruct an unstriped mapping.
 * <number of stripes> <chunk size> <stripe #> <dev_path> <offset>
 */
static int unstripe_ctr(struct dm_target *ti, unsigned int argc, char **argv)
{
	struct unstripe_c *uc;
	sector_t tmp_len;
	unsigned long long start;
	char dummy;

	if (argc != 5) {
		ti->error = "Invalid number of arguments";
		return -EINVAL;
	}

	uc = kzalloc(sizeof(*uc), GFP_KERNEL);
	if (!uc) {
		ti->error = "Memory allocation for unstriped context failed";
		return -ENOMEM;
	}

	if (kstrtouint(argv[0], 10, &uc->stripes) || !uc->stripes) {
		ti->error = "Invalid stripe count";
		goto err;
	}

	if (kstrtouint(argv[1], 10, &uc->chunk_size) || !uc->chunk_size) {
		ti->error = "Invalid chunk_size";
		goto err;
	}

	if (kstrtouint(argv[2], 10, &uc->unstripe)) {
		ti->error = "Invalid stripe number";
		goto err;
	}

	if (uc->unstripe > uc->stripes && uc->stripes > 1) {
		ti->error = "Please provide stripe between [0, # of stripes]";
		goto err;
	}

	if (dm_get_device(ti, argv[3], dm_table_get_mode(ti->table), &uc->dev)) {
		ti->error = "Couldn't get striped device";
		goto err;
	}

	if (sscanf(argv[4], "%llu%c", &start, &dummy) != 1) {
		ti->error = "Invalid striped device offset";
		goto err;
	}
	uc->physical_start = start;

	uc->unstripe_offset = uc->unstripe * uc->chunk_size;
	uc->unstripe_width = (uc->stripes - 1) * uc->chunk_size;
	uc->chunk_shift = is_power_of_2(uc->chunk_size) ? fls(uc->chunk_size) - 1 : 0;

	tmp_len = ti->len;
	if (sector_div(tmp_len, uc->chunk_size)) {
		ti->error = "Target length not divisible by chunk size";
		goto err;
	}

	if (dm_set_target_max_io_len(ti, uc->chunk_size)) {
		ti->error = "Failed to set max io len";
		goto err;
	}

	ti->private = uc;
	return 0;
err:
	cleanup_unstripe(uc, ti);
	return -EINVAL;
}

static void unstripe_dtr(struct dm_target *ti)
{
	struct unstripe_c *uc = ti->private;

	cleanup_unstripe(uc, ti);
}

static sector_t map_to_core(struct dm_target *ti, struct bio *bio)
{
	struct unstripe_c *uc = ti->private;
	sector_t sector = bio->bi_iter.bi_sector;
	sector_t tmp_sector = sector;

	/* Shift us up to the right "row" on the stripe */
	if (uc->chunk_shift)
		tmp_sector >>= uc->chunk_shift;
	else
		sector_div(tmp_sector, uc->chunk_size);

	sector += uc->unstripe_width * tmp_sector;

	/* Account for what stripe we're operating on */
	return sector + uc->unstripe_offset;
}

static int unstripe_map(struct dm_target *ti, struct bio *bio)
{
	struct unstripe_c *uc = ti->private;

	bio_set_dev(bio, uc->dev->bdev);
	bio->bi_iter.bi_sector = map_to_core(ti, bio) + uc->physical_start;

	return DM_MAPIO_REMAPPED;
}

static void unstripe_status(struct dm_target *ti, status_type_t type,
			    unsigned int status_flags, char *result, unsigned int maxlen)
{
	struct unstripe_c *uc = ti->private;
	unsigned int sz = 0;

	switch (type) {
	case STATUSTYPE_INFO:
		break;

	case STATUSTYPE_TABLE:
		DMEMIT("%d %llu %d %s %llu",
		       uc->stripes, (unsigned long long)uc->chunk_size, uc->unstripe,
		       uc->dev->name, (unsigned long long)uc->physical_start);
		break;
	}
}

static int unstripe_iterate_devices(struct dm_target *ti,
				    iterate_devices_callout_fn fn, void *data)
{
	struct unstripe_c *uc = ti->private;

	return fn(ti, uc->dev, uc->physical_start, ti->len, data);
}

static void unstripe_io_hints(struct dm_target *ti,
			       struct queue_limits *limits)
{
	struct unstripe_c *uc = ti->private;

	limits->chunk_sectors = uc->chunk_size;
}

static struct target_type unstripe_target = {
	.name = "unstriped",
	.version = {1, 1, 0},
	.module = THIS_MODULE,
	.ctr = unstripe_ctr,
	.dtr = unstripe_dtr,
	.map = unstripe_map,
	.status = unstripe_status,
	.iterate_devices = unstripe_iterate_devices,
	.io_hints = unstripe_io_hints,
};

static int __init dm_unstripe_init(void)
{
	return dm_register_target(&unstripe_target);
}

static void __exit dm_unstripe_exit(void)
{
	dm_unregister_target(&unstripe_target);
}

module_init(dm_unstripe_init);
module_exit(dm_unstripe_exit);

MODULE_DESCRIPTION(DM_NAME " unstriped target");
MODULE_ALIAS("dm-unstriped");
MODULE_AUTHOR("Scott Bauer <scott.bauer@intel.com>");
MODULE_LICENSE("GPL");

{'repo_name': 'pfactum/pf-kernel', 'stars': '150', 'repo_language': 'C', 'file_name': 'verbs.h', 'mime_type': 'text/x-c', 'hash': 1287281148260922927, 'source_dataset': 'data'}