mradermacher/Qwen2.5-CodeFIM-1.5B-v2-GGUF
2B • Updated • 107 • 2
file_name stringlengths 3 137 | prefix stringlengths 0 918k | suffix stringlengths 0 962k | middle stringlengths 0 812k |
|---|---|---|---|
component.ts | // deno-lint-ignore no-explicit-any
type Class<S> = new (...args: any[]) => S;
const registry: { [name: string]: Class<BaseComponent> } = {};
const registeredElements: HTMLElement[] = [];
export function Component(name: string) {
return (ctor: Class<BaseComponent>) => {
registry[name] = ctor;
};
}
export abs... |
declare global {
interface HTMLElement {
component: BaseComponent;
}
}
export function bootComponents() {
function initializeComponents() {
document.querySelectorAll<HTMLElement>(`[data-cmp]`).forEach((ctx) => {
// do not initialize more than once
if (!registeredElements.includes(ctx)) {
... |
destructor(): void {
}
} |
test_userid.py | import pytest
import time
from tests.live import testlib
from pandevice import base
class TestUserID_FW(object):
"""Tests UserID on live Firewall."""
def test_01_fw_login(self, fw, state_map):
state = state_map.setdefault(fw)
user, ip = testlib.random_name(), testlib.random_ip()
fw.u... |
def test_04_fw_logouts(self, fw, state_map):
state = state_map.setdefault(fw)
if not state.multi_user:
raise Exception("User not logged in yet")
fw.userid.logouts(state.multi_user)
def test_05_register_str(self, fw, state_map):
state = state_map.setdefault(fw)
... | fw.userid.logout(user, ip) |
files.go | package filehandler
import (
"bytes"
"html/template"
"os"
"path/filepath"
)
func check(e error) {
if e != nil {
panic(e)
}
}
// CreateDirIfNotExist ...
func CreateDirIfNotExist(dir string) {
if _, err := os.Stat(dir); os.IsNotExist(err) {
err = os.MkdirAll(dir, 0755)
check(err)
}
}
// GetAllFilePathsI... | (dirpath string) ([]string, error) {
// Get all the .tmpl files in the directory.
var paths []string
extension := ".tmpl"
err := filepath.Walk(dirpath, func(path string, info os.FileInfo, err error) error {
if err != nil {
return err
}
if !info.IsDir() && filepath.Ext(path) == extension {
paths = appen... | GetAllFilePathsInDirectory |
transform_group_by_partial.rs | // Copyright 2020-2021 The Datafuse Authors.
//
// SPDX-License-Identifier: Apache-2.0.
use std::any::Any;
use std::collections::HashMap;
use std::sync::Arc;
use std::time::Instant;
use bumpalo::Bump;
use common_datablocks::DataBlock;
use common_datablocks::HashMethod;
use common_datablocks::HashMethodKind;
use commo... | apply! { hash_method , DFUInt8ArrayBuilder, RwLock<HashMap<u8, (Vec<usize>, Vec<DataValue>), ahash::RandomState>> }
}
HashMethodKind::KeysU16(hash_method) => {
apply! { hash_method , DFUInt16ArrayBuilder, RwLock<HashMap<u16, (Vec<us... | HashMethodKind::KeysU8(hash_method) => { |
specs.py | # MIT License
# This project is a software package to automate the performance tracking of the HPC algorithms
# Copyright (c) 2021. Victor Tuah Kumi, Ahmed Iqbal, Javier Vite, Aidan Forester
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation... | (hardware_ids, rocm_versions):
"""Gets specification for all specified rocm hardwares"""
specs_info = []
for rocm in rocm_versions:
for hardw_id in hardware_ids:
specs = model.get_specs(hardw_id, rocm) #returns dictionary
if specs is not None:
title = f'{rocm... | get_specs |
extension.py | from waldur_core.core import WaldurExtension
class PlaybookJobsExtension(WaldurExtension):
class Settings: | WALDUR_PLAYBOOK_JOBS = {
'PLAYBOOKS_DIR_NAME': 'ansible_playbooks',
'PLAYBOOK_ICON_SIZE': (64, 64),
}
@staticmethod
def django_app():
return 'waldur_ansible.playbook_jobs'
@staticmethod
def rest_urls():
from .urls import register_in
retur... | |
build_requires_test.py | import unittest
from nose_parameterized.parameterized import parameterized
from conans.test.utils.tools import TestClient
from conans.paths import CONANFILE
tool_conanfile = """
import os
from conans import ConanFile
class Tool(ConanFile):
name = "Tool"
version = "0.1"
def package_info(self):
s... | (self, conanfile):
client = TestClient()
client.save({CONANFILE: tool_conanfile}, clean_first=True)
client.run("export lasote/stable")
client.save({CONANFILE: conanfile}, clean_first=True)
client.run("export lasote/stable")
client.run("install MyLib/0.1@lasote/stable --... | test_build_requires |
squeezenet.py | import torch
from torch import nn
from torch.nn import functional as F
import torchvision
def main():
|
if __name__ == '__main__':
main()
| print('cuda device count: ', torch.cuda.device_count())
net = torchvision.models.squeezenet1_1(pretrained=True)
#net.fc = nn.Linear(512, 2)
net = net.eval()
net = net.to('cuda:0')
print(net)
tmp = torch.ones(2, 3, 227, 227).to('cuda:0')
out = net(tmp)
print('squeezenet out:', out.sha... |
unassociate_eip_address.go | package vpc
//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
//distribut... | () (response *UnassociateEipAddressResponse) {
response = &UnassociateEipAddressResponse{
BaseResponse: &responses.BaseResponse{},
}
return
}
| CreateUnassociateEipAddressResponse |
main.go | //
// Copyright 2020 Verizon Media
//
// 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 t... | signal.Notify(signals, os.Interrupt, syscall.SIGTERM)
sig := <-signals
log.Printf("Received signal %v, stopping rotation\n", sig)
stop <- true
}()
err = <-errors
if err != nil {
log.Printf("%v\n", err)
}
}
os.Exit(0)
}
// getAttestationData fetches attestation data for all the services mentio... |
go func() {
signals := make(chan os.Signal, 2) |
random number generation.py | import random
| x=random.random()
print("The Random number is",round(x,3)) | |
setup.py | #!/usr/bin/env python
from os.path import join, dirname, abspath
from setuptools import setup
def read(rel_path):
here = abspath(dirname(__file__))
with open(join(here, rel_path)) as fp:
return fp.read()
def get_version(rel_path):
for line in read(rel_path).splitlines():
if line.startsw... | setup(name='robotframework-csvlibrary',
version=get_version("CSVLibrary/__init__.py"),
description='CSV library for Robot Framework',
long_description=DESCRIPTION,
long_description_content_type='text/markdown',
author='Marcin Mierzejewski',
author_email='<mmierz@gmail.com>',
ur... | |
predict.py | from tensorflow.keras.models import load_model
from clean import downsample_mono, envelope
from kapre.time_frequency import STFT, Magnitude, ApplyFilterbank, MagnitudeToDecibel
from sklearn.preprocessing import LabelEncoder
import numpy as np
from glob import glob
import argparse
import os
import pandas as pd
from tqdm... |
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Audio Classification Training')
parser.add_argument('--model_fn', type=str, default='models/lstm.h5',
help='model file to make predictions')
parser.add_argument('--pred_fn', type=str, default='y_pred',
... | model = load_model(args.model_fn,
custom_objects={'STFT': STFT,
'Magnitude': Magnitude,
'ApplyFilterbank': ApplyFilterbank,
'MagnitudeToDecibel': MagnitudeToDecibel})
# fi... |
utils.py | """
Copyright (C) 2019 Interactive Brokers LLC. All rights reserved. This code is subject to the terms
and conditions of the IB API Non-Commercial License or the IB API Commercial License, as applicable.
"""
"""
Collection of misc tools
"""
import sys
import logging
import inspect
from ibapi.common import UNSET_I... |
if orig_type is bool:
n = False if n == 0 else True
return n
def ExerciseStaticMethods(klass):
import types
#import code; code.interact(local=dict(globals(), **locals()))
for (_, var) in inspect.getmembers(klass):
#print(name, var, type(var))
if type(var) == types.Func... | n = the_type(s or 0) |
lib.rs | #![recursion_limit="128"]
#![doc(html_root_url = "https://api.rocket.rs/master")]
#![doc(html_favicon_url = "https://rocket.rs/images/favicon.ico")]
#![doc(html_logo_url = "https://rocket.rs/images/logo-boxed.png")]
#![warn(rust_2018_idioms)]
//! # Rocket - Code Generation
//!
//! This crate implements the code gene... | ///
/// 3. Data parameter, if any.
///
/// If a data guard fails, the request is forwarded if the
/// [`Outcome`] is `Forward` or failed if the [`Outcome`] is
/// `Failure`. See [`FromTransformedData` Outcomes] for further detail.
... | ///
/// If a path or query parameter guard fails, the request is
/// forwarded. |
mixin.py | class TransactionHooksDatabaseWrapperMixin(object):
"""
A ``DatabaseWrapper`` mixin to implement transaction-committed hooks.
To use, create a package for your custom database backend and place a
``base.py`` module within it. Import whatever ``DatabaseWrapper`` you want
to subclass (under some othe... | (self, *a, **kw):
# a list of no-argument functions to run when the transaction commits;
# each entry is an (sids, func) tuple, where sids is a list of the
# active savepoint IDs when this function was registered
self.run_on_commit = []
# Should we run the on-commit hooks the nex... | __init__ |
views.py | from django.shortcuts import render
# Create your views here.
from django.http import HttpResponse
def | (request):
return HttpResponse('TEST URL')
| index |
lib.rs | // Copyright 2021 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use {
anyhow::Result,
errors::{ffx_bail, ffx_error},
ffx_core::ffx_plugin,
ffx_pdk_lib::groups::{ArtifactStore, ArtifactStoreEntry, Artifac... | let mut res = client
.get(uri.clone())
.await
.map_err(|e| ffx_error!(r#"Failed on http get for "{}": {}"#, uri, e))?;
let status = res.status();
if status != StatusCode::OK {
ffx_bail!("Cannot download meta.far. Status is {}. Uri is: {}.", status... | .map_err(|e| ffx_error!(r#"Parse Uri failed for "{}": {}"#, hostname, e))?;
let client = new_https_client(); |
a_bit_of_everything.go | package server
import (
"context"
"fmt"
"io"
"strings"
"sync"
"github.com/golang/glog"
"github.com/golang/protobuf/proto"
"github.com/golang/protobuf/ptypes/duration"
"github.com/golang/protobuf/ptypes/empty"
examples "github.com/grpc-ecosystem/grpc-gateway/examples/proto/examplepb"
"github.com/grpc-ecosys... | () ABitOfEverythingServer {
return &_ABitOfEverythingServer{
v: make(map[string]*examples.ABitOfEverything),
}
}
func (s *_ABitOfEverythingServer) Create(ctx context.Context, msg *examples.ABitOfEverything) (*examples.ABitOfEverything, error) {
s.m.Lock()
defer s.m.Unlock()
glog.Info(msg)
var uuid string
for... | newABitOfEverythingServer |