text
string
size
int64
token_count
int64
import inspect import sys from abc import ABC, abstractmethod from enum import Enum from typing import List, Union, Type, Optional, Dict, Any from pydantic import BaseModel from onemsdk.exceptions import NodeTagMismatchException, ONEmSDKException from .node import Node __all__ = ['Tag', 'HeaderTag', 'FooterTag', 'Br...
13,500
4,096
class Sign: """ 符号 """ def __init__(self, sign_type, sign_str='', sign_line=-1): """ 构造 :param sign_type: 符号的类型 :param sign_str: 符号的内容(可以为空) :param sign_line: 符号所在行数(可以为空) """ self.type = sign_type self.str = sign_str self.line = si...
12,113
3,980
import json import hashlib import logging import os import threading import time import datetime import itertools import peewee from passlib.apps import custom_app_context as pwd_context from playhouse.postgres_ext import ArrayField, DateTimeTZField, PostgresqlExtDatabase from flask.ext.login import UserMixin, Anonymo...
24,566
7,655
import numpy as np import time import logging from .base import BaseClassifier import scipy.sparse as sp from ._svm import train_one from functools import partial from ..utils import sparse from ..data import data_loader from ._svm import train_one, _get_liblinear_solver_type from joblib import Parallel, delayed from ....
10,112
2,946
#!/usr/bin/env python3 import ipaddress import random import unittest import ipgroup class TestGroupIPs(unittest.TestCase): def setUp(self): pass def test_group(self): IPs = ["127.0.0.1", "127.0.1.1", "127.1.1.1", "127.1.0.1", "127...
6,555
2,272
from dataclasses import dataclass from pickle import FALSE from dol import Dol from asm_section_list import AsmSection, AsmSectionType @dataclass class Slice: start: int end: int def size(self) -> int: assert self.end > self.start return self.end - self.start def contains_section(self...
2,566
830
import utils import argparse import wandb from os.path import join from qm9 import dataset from qm9 import losses from qm9.models import get_optim, get_model from flows.utils import assert_mean_zero_with_mask, remove_mean_with_mask,\ assert_correctly_masked import torch import time import pickle import numpy as np ...
13,993
4,733
# -*- coding: utf-8 -*- # Copyright (c) 2021. Distributed under the terms of the MIT License. from vise.util.string import numbers_to_lowercases def test_numbers_to_lowercases(): assert numbers_to_lowercases("Mg2") == "Mg₂"
230
89
def find_accounts(search_text): # perform search... if not db_is_available: return None # returns a list of account IDs return db_search(search_text) accounts = find_accounts('python') if accounts is None: print("Error: DB not available") else: print("Accounts found: Would list them he...
421
152
import os import json import shutil import tempfile import mock import pytest from opencivicdata.models import Person from pupa.scrape import Person as ScrapePerson from pupa.scrape import Organization as ScrapeOrganization from pupa.importers.base import omnihash, BaseImporter from pupa.importers import PersonImporter...
3,885
1,361
#!/usr/bin/env python # -*- coding: utf-8 -*- # # 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...
6,008
1,798
#!/usr/bin/env python3 # Day 22: Sort Characters By Frequency # # Given a string, sort it in decreasing order based on the frequency of # characters. import collections class Solution: def frequencySort(self, s: str) -> str: return "".join(map( lambda t: t[0] * t[1], collections.C...
547
179
''' 说明: loc和iloc有几个功能 1. 可以获取一行或者多行数据 2. 可以获取1列或多列数据 3. 可以获取某个单元格的数据 对应dataframe来说, 在不指定index和columns的情况下,iloc和loc一样 区别在于,iloc根据索引下标取值, loc根据索引值取值 ''' import numpy as np import pandas as pd def test_1(): # 按行取值 pf = pd.DataFrame([[1, 2], [3, 4]]) iloc_0 = pf.iloc[0] loc_0 = pf.loc[0] assert pd.Se...
1,877
957
"""Runner to discover, run and collect the results of all the checks.""" def import_module(module_path): """Import a Python file as a module in the current context. @param module_path: Path to the Python file. @return: A reference to the module once loaded. """ import os import sys modu...
4,673
1,263
# Copyright (c) 2016 Mirantis, Inc. # # 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 w...
11,612
3,523
""" Various utility functions for using mmdetection in Determined that may be useful even if not using the provided MMDetTrial. build_fp16_loss_scaler is large derived from the original mmcv code at https://github.com/open-mmlab/mmcv/blob/master/mmcv/runner/hooks/optimizer.py mmcv is covered by the Apache 2.0 License....
4,345
1,274
"""tests bigquery client""" import unittest from gcloud.datastores.bigquery import BigqueryClient class BigqueryClientTestCases(unittest.TestCase): """stuff""" @classmethod def setUpClass(cls): cls.project_id = 'test' cls.dataset_id = 'etl_test' cls.table_id = 'etl_test' ...
2,465
778
fruits = ["orange", "banana", "apple", "avocado", "kiwi", "apricot", "cherry", "grape", "coconut", "lemon", "mango", "peach", "pear", "strawberry", "pineapple", "apple", "orange", "pear", "grape", "banana" ] filters = dict() for key in fruits: filters[key] = 1 result =...
354
133
from sklearn import preprocessing import pandas as pd import numpy as np #import matplotlib.pyplot as plt #Abrindo o dados como Dataframe dados = pd.read_csv('dados/001.csv') #Iniciando o método para binanizar as classe sim=1; não=0 pre = preprocessing.LabelBinarizer() #Binazirando a classe jogou, e atribuíndo a uma...
1,919
778
# Copyright 2021 The Kubeflow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
8,940
2,899
from ctypes import c_uint32, c_void_p, string_at from rotypes.idldsl import define_winrt_com_method, GUID from rotypes.inspectable import IInspectable, IUnknown @GUID('905a0fef-bc53-11df-8c49-001e4fc686da') class IBufferByteAccess(IUnknown): pass @GUID('905A0FE0-BC53-11DF-8C49-001E4FC686DA') class IBuffer(IIns...
805
333
# -*- coding: utf-8 -*- """ Playground documentation. Module defining Playground Base Class """ import os from abc import ABC import yaml import pymunk from .utils import PositionAreaSampler from .utils.definitions import SPACE_DAMPING, CollisionTypes, SceneElementTypes # pylint: disable=unused-argument # pylint:...
23,410
6,770
# -*- coding: utf-8 -*- import zlib from UEManifestReader.enums import * from UEManifestReader.classes.FCustomFields import FCustomFields from UEManifestReader.classes.FManifestMeta import FManifestMeta from UEManifestReader.classes.FChunkDataList import FChunkDataList from UEManifestReader.classes.FManifestHeader imp...
2,679
727
#module.py def hello(): print("Hello!") #if __name__=="__main__": # print(__name__)
98
43
import csv import json import pickle import logging import re import pandas import gzip import os import numpy as np from random import randint, random from tqdm import tqdm from retriever.dense_retriever import DenseRetriever from models.tokenization import tokenize from typing import Union, List class InputExampl...
10,690
3,070
# Generated by Django 2.1.5 on 2019-01-22 08:33 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('accounts', '0024_auto_20190119_1540'), ] operations = [ migrations.RemoveField( model_name='member', name='team', ),...
327
124
from django.conf import settings #from proxyclient.v2 import client as proxy_client from openstack_dashboard.utils import proxy_client def proxyclient(request): management_url = getattr(settings, 'MANAGEMENT_URL') conn = proxy_client.Client(request.user.username, request.user.t...
6,671
2,056
import overtime as ot times = ['14:00','14:05', '14:10', '14:15', '14:20', '14:25', '14:30', '14:35', '14:40', '14:45', '14:50', '14:55'] tfl_data = ot.TflInput(['victoria', 'central', 'bakerloo', 'piccadilly'], ['inbound', 'outbound'], times)
251
140
import json from pathlib import Path import click import datacube from datacube.index.hl import Doc2Dataset from odc.apps.dc_tools.utils import ( index_update_dataset, update_if_exists, allow_unsafe, transform_stac, ) from ._stac import stac_transform from typing import Generator, Optional import loggi...
2,375
770
""" WARNING: Using this script outside any server except one with IP 127.0.0.1 means risking getting an instant and permanent ban, anywhere you use it. The script was created *ONLY FOR LOCAL* testing purposes. NEVER, NEVER, *NEVER* run it in an online multiplayer server. At least unless you're a dumb freak. ""...
651
214
# -*- coding: utf-8 -*- """ gluster-georep-tools.setup.py :copyright: (c) 2016 by Aravinda VK :license: MIT, see LICENSE for more details. """ from setuptools import setup setup( name="gluster-georep-tools", version="0.2", packages=["gluster_georep_tools", "gluster_georep_tools....
1,458
493
""" PyTorch Profiler With TensorBoard ==================================== This tutorial demonstrates how to use TensorBoard plugin with PyTorch Profiler to detect performance bottlenecks of the model. Introduction ------------ PyTorch 1.8 includes an updated profiler API capable of recording the CPU side operations ...
14,184
4,019
# coding: utf-8 from .__utils__ import grayscaleOf, makeImage, sortByGrayscale NAME = "imgtoch" VERSIONNUM = 0, 2, 3 VERSION = ".".join(map(str, VERSIONNUM)) AUTHOR = "hrpzcf" EMAIL = "hrpzcf@foxmail.com" WEBSITE = "https://gitee.com/hrpzcf/imgtoch" __all__ = ["grayscaleOf", "makeImage", "sortByGrayscale"]
311
137
import typing as t from gradient_boosting_model.config.core import config import numpy as np import pandas as pd from marshmallow import fields, Schema, ValidationError class HouseDataInputSchema(Schema): Alley = fields.Str(allow_none=True) BedroomAbvGr = fields.Integer() BldgType = fields.Str() Bsm...
4,298
1,436
class IOEngine(object): def __init__(self, node): self.node = node self.inputs = [] self.outputs = [] def release(self): self.inputs = None self.outputs = None self.node = None def updateInputs(self, names): # remove prior outputs for input...
2,458
719
import os from rlbot.agents.base_agent import BOT_CONFIG_AGENT_HEADER from rlbot.agents.base_dotnet_agent import BaseDotNetAgent from rlbot.parsing.custom_config import ConfigHeader, ConfigObject class DotNetBot(BaseDotNetAgent): def get_port_file_path(self): # Look for a port.cfg file in the same direct...
1,006
303
# coding=utf-8 import inspect from functools import wraps def listify(func_s): if callable(func_s): return [func_s] else: return func_s def parse_conditions(condition_s, args, kwargs, title): err_msg = unicode(title) + u" nr. {} failed: {}" for i, condition in enumerate(listify(condi...
2,640
843
''' Gets the core asm module out of an emscripten output file. By default it adds a ';' to end the var asm = ... statement. You can add a third param to customize that. If the third param is 'swap-in', it will emit code to swap this asm module in, instead of the default one. XXX this probably doesn't work with cl...
1,198
392
import torch import pdb from torch.autograd import gradcheck import fused_conv_bias_relu class ConvBiasReLU_(torch.autograd.Function): @staticmethod @torch.cuda.amp.custom_fwd(cast_inputs=torch.half) def forward(ctx, x, weight, bias, padding, stride): outputs = fused_conv_bias_relu.forward([x, wei...
2,399
883
class Node: def __init__(self,value): self.value=value self.left=None self.right=None class Binary_Tree: def __init__(self): self.root = None def pre_order(self): """ root-left-right """ try: self.values=[] if self.ro...
3,367
846
# Copyright 2015 Cisco Systems # 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...
3,037
1,007
from jogo import desenha_jogo from random import randint import sys def input_cria_usuario(): usuario = dict() usuario['nome'] = input('Informe o seu nome: ') usuario['pontos'] = 0 usuario['desafiado'] = False return usuario def comeco(j1, j2): j1 = 1 j2 = 2 n= randint(j1,j2) ...
1,300
565
from datetime import date, datetime from DesksReminder.Basics.dataFinder import Data from DesksReminder.Basics.nickNames import ContactBook from Config.settings import JIRA_URL __author__ = 'Manuel Escriche' class AccountsDesk: def __init__(self): self.contactBook = ContactBook() def open(self): ...
9,018
2,424
#!/usr/bin/python import sys import re def iptohex(ip): octets = ip.split('.') hex_octets = [] for octet in octets: if int(octet) < 16: hex_octets.append('0' + hex(int(octet))[2:]) else: hex_octets.append(hex(int(oc...
826
298
import random import numpy as np import numpy.linalg as LA import scipy as spy import time from itertools import * import sys import cvxpy as cvx from random import randint import numpy as np import random from scipy.sparse import csc_matrix from scipy import sparse as sp import networkx as nx class CVX_weighted: def...
1,329
577
import sys import glob from os.path import join from multiprocessing import Pool import numpy as np import matplotlib.pyplot as plt from skimage import io, color from PIL import Image, ImageEnhance import torch from torch.utils.data import Dataset, DataLoader, TensorDataset import torch.nn.functional as F import torch...
5,704
2,168
# python 3.7 """Utility functions for image editing from latent space.""" import os.path import numpy as np __all__ = [ 'parse_indices', 'interpolate', 'mix_style', 'get_layerwise_manipulation_strength', 'manipulate', 'parse_boundary_list' ] def parse_indices(obj, min_val=None, max_val=None): """Parses in...
16,215
5,072
/home/runner/.cache/pip/pool/24/e8/39/183700a0b2d2a9545f3da2571d82b53df290aab3a51dc229b113d16e6c
96
75
import numpy as np def denormalize(x, x_min, x_max): if x_max is None: _range = 1 else: _range = (x_max - x_min) return x * _range + x_min def normalize(x, x_min=None, x_max=None, return_bounds=False, estimate_bounds_if_none=True): # if the bounds should be estimated if none do it...
1,277
461
"""Check new Revision ID: 92235b77ea53 Revises: 381fdb66ec27 Create Date: 2017-10-14 02:38:51.007307 """ # revision identifiers, used by Alembic. revision = '92235b77ea53' down_revision = '381fdb66ec27' from alembic import op import sqlalchemy as sa def upgrade(): # ### commands auto generated by Alembic - pl...
31,211
9,846
import subprocess import os def get_connected_devices() -> list: """ Returns a list of tuples containing the Device name and the android Version :return: """ devices = [] devices_output = subprocess.check_output(["adb", "devices"]).decode("utf-8").strip("List of devices attached").split("\n") ...
5,633
1,780
import glob import os import sys from tempfile import TemporaryDirectory import netCDF4 import numpy as np import numpy.ma as ma from all_products_fun import Check from lidar_fun import LidarFun from cloudnetpy import concat_lib from cloudnetpy.instruments import ceilo2nc SCRIPT_PATH = os.path.dirname(os.path.realpa...
2,664
964
from sqlalchemy import Column, func from clickhouse_sqlalchemy import types, Table from tests.testcase import ( BaseAbstractTestCase, HttpSessionTestCase, NativeSessionTestCase, ) class CountTestCaseBase(BaseAbstractTestCase): def create_table(self): metadata = self.metadata() return Table( ...
1,343
400
import click import requests from bs4 import BeautifulSoup from modules.Word.managers.DictionaryManager import DictionaryManager import re @click.command() @click.option('--url', help='URL to fetch from') @click.pass_context def search(ctx, url): dictionary_manager: DictionaryManager = ctx.obj[DictionaryManager] ...
1,055
308
"""Datasets to be used in search and related functions""" from .DATASET import *
81
24
# -*- coding: utf-8 -*- import matplotlib as mpl import numpy as np import pandas as pd import seaborn as sns from matplotlib import pyplot as plt from cell2cell.clustering import compute_linkage from cell2cell.preprocessing.manipulate_dataframes import check_symmetry from cell2cell.plotting.aesthetics import map_col...
16,089
4,429
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) import os from spack.package import * class Gnuconfig(Package): """ The GNU config.guess and config.sub scripts...
1,051
353
from mp4box.box import CompositionTimeToSampleBox def parse_ctts(reader, my_size): version = reader.read32() box = CompositionTimeToSampleBox(my_size, version, 0) box.entry_count = reader.read32() for _ in range(0, box.entry_count): box.sample_count.append(reader.read32()) box...
378
135
import pickle import numpy as np import matplotlib.pyplot as plt from lightweaver.rh_atoms import H_6_atom, C_atom, O_atom, OI_ord_atom, Si_atom, Al_atom, Fe_atom, FeI_atom, MgII_atom, N_atom, Na_atom, S_atom, CaII_atom from lightweaver.atmosphere import Atmosphere, ScaleType from lightweaver.atomic_table import Defaul...
24,485
8,736
# coding:utf-8 from openpyxl import load_workbook import openpyxl from openpyxl.styles import Font, colors def copy_excel(cese_path, report_path): """ 复制测试用例到report_path :param cese_path: :param report_path: :return: """ wb2 = openpyxl.Workbook() wb2.save(report_path) # 在设置的路径下创建一个exc...
1,895
840
# # Copyright (C) 2018 The Android Open Source Project # # 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 la...
1,904
826
from typing import Sequence, Any from jina.executors.evaluators.rank import BaseRankingEvaluator from jina.executors.evaluators.decorators import as_aggregator class RecallEvaluator(BaseRankingEvaluator): """A :class:`RecallEvaluator` evaluates the Precision of the search. It computes how many of the firs...
1,450
427
from typedpy import Array, DoNotSerialize, Structure, mappers class Foo(Structure): i: int s: str _serialization_mapper = {"i": "j", "s": "name"} class Example5(Foo): a: Array _serialization_mapper = [{"j": DoNotSerialize}, mappers.TO_LOWERCASE]
270
99
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. import dataclasses from abc import ABC, abstractmethod from dataclasses import dataclass from typing import Dict, Generic, List, Optional, Sequence, TypeVar from semantic_parsing_with_constrained_lm.datum import FullDatum, FullDatumSub from sema...
3,447
1,085
class Check_Excessive_Current(object): def __init__(self,chain_name,cf,handlers,irrigation_io,irrigation_hash_control,get_json_object): self.get_json_object = get_json_object cf.define_chain(chain_name, False ) #cf.insert.log("check_excessive_current") cf.insert.ass...
959
347
# -*- coding: utf-8 -*- # # Copyright 2016 Google LLC. 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 requir...
8,913
2,485
import os import unittest import numpy as np import networkx as nx import numpy.testing as npt from pgmpy.models import SEM, SEMGraph, SEMAlg class TestSEM(unittest.TestCase): def test_from_graph(self): self.demo = SEM.from_graph( ebunch=[ ("xi1", "x1"), ("xi1...
49,844
20,064
# coding=utf-8 # This script is finished following HF's datasets' template: # https://github.com/huggingface/datasets/blob/master/templates/new_dataset_script.py # More examples as references to write a customized dataset can be found here: # https://github.com/huggingface/datasets/tree/master/datasets from __future__...
1,790
534
import itertools from typing import Sequence, Iterator # Source: https://github.com/Cog-Creators/Red-DiscordBot/blob/V3/develop/redbot/core/utils/chat_formatting.py def error(text: str) -> str: """Get text prefixed with an error emoji. Returns ------- str The new message. """ return "...
7,941
2,478
# @date 2018-12-28 # @author Frederic Scherma, All rights reserved without prejudices. # @license Copyright (c) 2018 Dream Overflow # Strategy trade for margin with multiples positions. from __future__ import annotations from typing import TYPE_CHECKING, Optional, Tuple if TYPE_CHECKING: from trader.trader impor...
35,410
9,986
# local from .panels import SqlalchemyCsvDebugPanel __VERSION__ = "0.3.1" # ============================================================================== def includeme(config): """ Pyramid hook to install this debugtoolbar plugin. Update your ENVIRONMENT.ini file debugtoolbar.includes = pyr...
718
221
# -*- coding: utf-8 -*- import os,os.path import zipfile def zip_compress(dir_name, zip_filename): filelist = [] if os.path.isfile(dir_name): filelist.append(dir_name) else : for root, dirs, files in os.walk(dir_name): for name in files: filelist.append(os.path....
1,165
410
#!/usr/bin/env python3 import boto import boto.ec2 import sys from pprint import pprint from collections import defaultdict output = defaultdict(lambda: []) comments = defaultdict(lambda: {}) skip_region_strings = ['us-gov', 'cn-', 'ca-'] #skip_region_strings = ['us-gov', 'cn-', 'ca-', 'eu-', 'ap-'] if len(sys.arg...
1,985
709
"""Install exception handler for process crash.""" from selfdrive.swaglog import cloudlog from selfdrive.version import version import sentry_sdk from sentry_sdk.integrations.threading import ThreadingIntegration def capture_exception(*args, **kwargs) -> None: cloudlog.error("crash", exc_info=kwargs.get('exc_info',...
938
338
import math import visualization.panda.world as wd import modeling.geometric_model as gm import modeling.collision_model as cm import grasping.planning.antipodal as gpa import robot_sim.end_effectors.grippers.yumi_gripper.yumi_gripper as yg base = wd.World(cam_pos=[1, 1, 1],w=960, h=540, lookat_pos=[0...
1,235
496
# Copyright 2012 OpenStack Foundation # # 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...
60,103
16,052
import numpy as np import os from chainercv.chainer_experimental.datasets.sliceable import GetterDataset from chainercv.utils import read_image linemod_object_diameters = { 'ape': 0.103, 'benchvise': 0.286908, 'cam': 0.173, 'can': 0.202, 'cat': 0.155, 'driller': 0.262, 'duck': 0.109, ...
3,193
1,264
import FWCore.ParameterSet.Config as cms process = cms.Process("BeamMonitor") #---------------------------- # Common part for PP and H.I Running #----------------------------- process.load("DQM.Integration.test.inputsource_cfi") #-------------------------- # HLT Filter process.load("HLTrigger.special.HLTTriggerType...
10,857
3,473
# flake8: noqa import json from src.models.hacker import Hacker from tests.base import BaseTestCase from datetime import datetime class TestHackersBlueprint(BaseTestCase): """Tests for the Hackers Endpoints""" """create_hacker""" def test_create_hacker(self): now = datetime.now() res = s...
3,036
980
""" sources.chicago =============== Reads a CSV file in the format (as of April 2017) of data available from: - https://catalog.data.gov/dataset/crimes-one-year-prior-to-present-e171f - https://catalog.data.gov/dataset/crimes-2001-to-present-398a4 The default data is loaded from a file "chicago.csv" which should be ...
13,330
4,420
# https://github.com/Anfany/Codility-Lessons-By-Python3/blob/master/L11_Sieve%20of%20Eratosthenes/11.2%20CountSemiprimes.md def solution(N, P, Q): """ 返回由数组P、Q的元素组成的区间内,不大于N的半素数的个数, 时间复杂度O(N * log(log(N)) + M) :param N: 半素数的最大值 :param P: 数组 :param Q: 数组 :return: 每次查询,得到的半素数的个数 """ # 半素数...
2,140
1,069
############################################################################## # # Copyright (c) 2006 Zope Foundation and Contributors. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS I...
2,614
777
# # Copyright (c) nexB Inc. and others. All rights reserved. # ScanCode is a trademark of nexB Inc. # SPDX-License-Identifier: Apache-2.0 # See http://www.apache.org/licenses/LICENSE-2.0 for the license text. # See https://github.com/nexB/scancode-toolkit for support or download. # See https://aboutcode.org for more in...
6,090
1,658
# -*- coding: utf-8 -*- #django from django.contrib import admin from django.db import transaction #python import csv from decimal import Decimal #gazepattern from .models import Experiment, ExperimentPoint, Image, ImageRectangle, ExperimentPointCSV, ExperimentFunction @transaction.atomic def procesar(modeladmin, req...
2,359
681
from django.test import TestCase, Client from django.urls import reverse from orders.models import Order, OrderItem from datetime import datetime from django.utils.timezone import get_current_timezone import pytz class TestViews(TestCase): def setUp(self): self.client = Client() def test_home_GET...
2,634
806
from codigo.hexagonal.app.domain.switchable_repository import Switchable class LightBulb(Switchable): def turn_on(self) -> bool: print("Connecting with the device...") print("The light is on") return True def turn_off(self) -> bool: print("The light is off") print("Dis...
373
107
from random import randint menor = 100 linha = 0 maior = 0 m = [] for i in range(10): m.append([]) for j in range(10): m[i].append(randint(1,99)) for i in range(10): for j in range(10): print(f'{m[i][j]:2}',end=' ') print() for i in range(10): for j in range(10): if m[i][j...
541
236
import os.path as osp import argparse import yaml from src.token_classification.archs.data_formatter import * # ********************* launch formating *********************** # cmd to launch : python -m src.token_classification.format --config ./src/token_classification/config/config.yml if __name__ == '__main__...
1,153
359
from __future__ import absolute_import, division, print_function import os, sys, time import numpy as np import scipy.sparse import scipy.linalg import scipy.sparse.linalg from astropy.table import Table, Column import multiprocessing from desiutil.log import get_logger from desispec.interpolation import resample...
6,393
2,233
from mock import patch import pytest from pontoon.base.models import User from pontoon.pretranslation.pretranslate import get_translations from pontoon.test.factories import ( EntityFactory, TranslationMemoryFactory, ) @patch("pontoon.pretranslation.pretranslate.get_google_translate_data") @pytest.mark.djan...
2,525
819
# -*- encoding: utf-8 -*- """Utility functions for computing combinations of dimensions and hierarchy levels""" from __future__ import absolute_import import re import os.path import json from collections import OrderedDict from .errors import ModelInconsistencyError, ArgumentError, ConfigurationError from . impor...
9,615
2,706
import torch import torch.nn as nn import torch.nn.functional as F from modules import Conv, ResBlock class Wavenet_Student(nn.Module): def __init__(self, num_blocks_student=[1, 1, 1, 1, 1, 1], num_layers=10, front_channels=32, residual_channels=64, gate_channels=128, skip_channels=64, ...
4,366
1,504
try: from gevent import monkey monkey.patch_all() except ImportError: # fine if no gevent is available pass import base64 import logging from unittest.mock import Mock from flask.app import Flask from flask_testing import TestCase from openbrokerapi.api import BrokerCredentials from openbrokerapi.log...
828
240
#!/usr/bin/python # -*- coding: utf-8 -*- # # (c) 2015, Michael Perzel # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at you...
5,234
1,742
#! /usr/bin/env python from __future__ import print_function import pandas as pd import numpy as np import argparse def generate_csv(start_index, fname): cols = [ str('A' + str(i)) for i in range(start_index, NUM_COLS + start_index) ] data = [] for i in range(NUM_ROWS): vals = (np.ra...
1,323
478
indexWords = list() def PreviousWord(_list, _word): if _list[_list.index(_word)-1] : return _list[_list.index(_word)-1] else: return phrase = str(input()) phraseList = phrase.split(" ") length = len(phraseList) for item in phraseList : item = item.strip() if phrase != "" : fo...
1,219
418
# Copyright 2017 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import base64 import json import mock import webapp2 from google.appengine.api import taskqueue from go.chromium.org.luci.buildbucket.proto.build_pb2 impor...
14,107
4,506
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload from ... import _utilities fro...
24,660
7,109
# Generated by Django 3.2.4 on 2021-06-17 02:01 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('quiz', '0016_auto_20210617_0724'), ] operations = [ migrations.RemoveField( model_name='quiz', name='questions', ), ...
326
125
# -*- coding: iso-8859-1 -*- import os import shutil import datetime import sqlite3 from flask import Flask, request, session, render_template, g, redirect, url_for, abort, flash, make_response from random import randint import json import urllib2 import json from json.decoder import JSONObject from werkzeug.utils imp...
18,348
5,951