text
string
size
int64
token_count
int64
"""Collecting statistics of site visits.""" import collections from datetime import datetime from functools import reduce from django.utils.translation import gettext_lazy as _ from hier.models import IPInfo, AccessLog, SiteStat from v2_hier.utils import APPS def get_site_stat(user): """Processing a new portion of...
2,688
848
# Copyright 2018 Amazon.com, Inc. or its affiliates. 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. A copy of the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "LICENSE.txt" file accom...
16,643
5,081
__author__ = 'Xsank' import time from thinkutils_plus.eventbus.eventbus import EventBus from myevent import GreetEvent from myevent import ByeEvent from mylistener import MyListener if __name__=="__main__": eventbus=EventBus() eventbus.register(MyListener()) ge=GreetEvent('world') be=ByeEvent('world'...
452
150
# Copyright 2014 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 unittest from telemetry import benchmark from telemetry.core import browser_options from telemetry.core.platform import android_device from telemetry...
3,963
1,346
#! /usr/bin/env python import logging #--------------------------------------- class logger : ''' A ready to use logging class. All you need to do is set an object with the parameters (log_filename, directory to save it) then whenever you want to add text, type obj.add("some text"). The function obj.close() is no...
1,265
400
import json import multiprocessing as mp import re from argparse import ArgumentParser from enum import Enum, auto import javalang from functools import partial PRED_TOKEN = 'PRED' modifiers = ['public', 'private', 'protected', 'static'] class TargetType(Enum): seq = auto() tree = auto() @staticmethod ...
5,536
1,756
# 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) from spack import * class RMulticool(RPackage): """Permutations of multisets in cool-lex order A set of tools t...
1,865
668
#!/usr/bin/env python3 # updatetranslations.py # # tl;dr this script updates our translation file with the newest, coolest strings we've added! # it manually searches the source code, extracts strings and then updates the language files. # Written in 2018 by Daniel Oaks <daniel@danieloaks.net> # # To the extent possib...
7,426
2,169
import sys from collections import defaultdict def Process (fnames): tenant_time = defaultdict(lambda: defaultdict(lambda: 0.0)) tenant_run = defaultdict(lambda: defaultdict(lambda:0)) for fname in fnames: f = open(fname) for l in f: if l.startswith("tenant"): co...
1,437
490
from __future__ import print_function import numpy as np import os,sys,time """ Copied from orphics.mpi """ try: disable_mpi_env = os.environ['DISABLE_MPI'] disable_mpi = True if disable_mpi_env.lower().strip() == "true" else False except: disable_mpi = False """ Use the below cleanup stuff only for inte...
2,564
885
import requests import urllib.request import urllib.parse import PIL import re import configparser import json from PIL import Image from ebaysdk.trading import Connection as Trading from ebaysdk.exception import ConnectionError from yaml import load from PyQt5.QtWidgets import QMessageBox class EbaySeller: def ...
6,260
1,815
import typing from bot.constants import BOT_REPO_URL from discord import Embed from discord.ext import commands from discord.ext.commands.cooldowns import BucketType from . import _issues, _profile, _source class Github(commands.Cog): """ Github Category cog, which contains commands related to github. ...
3,175
933
from slackclient import SlackClient from external import SLACK_API_KEY class SlackBot: API_CHAT_MSG = 'chat.postMessage' BOT_NAME = 'News Bot' DEFAULT_CHANNEL = 'news_notification' def __new__(cls, *p, **k): if '_the_instance' not in cls.__dict__: cls._the_instance = object.__new...
1,154
364
from typing import Any, Dict, List, Tuple from pytezos.michelson.forge import forge_array, forge_base58, optimize_timestamp def bump_fitness(fitness: Tuple[str, str]) -> Tuple[str, str]: if len(fitness) == 0: major = 0 minor = 1 else: major = int.from_bytes(bytes.fromhex(fitness[0]), ...
2,379
837
# Copyright (c) 2018 PaddlePaddle 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 app...
5,321
1,821
from test_proxy import * from test_serializers import * from test_deserializers import * from test_exceptions import * from test_authentication import * from test_whole_flow import * from test_handlers_metaclass_magic import * from test_handlers_serialize_to_python import * from test_handlers_is_method_allowed im...
1,162
349
import numpy as np raw = open("inputs/20.txt","r").readlines() input_array= [(i.replace('\n', '').replace('.','0').replace('#', '1')) for i in raw] test_raw = open("inputs/20_test.txt","r").readlines() test_array= [(i.replace('\n', '').replace('.','0').replace('#', '1')) for i in test_raw] def addLayerZero(grid): #if...
2,518
1,112
import sys from PyQt5 import QtCore, QtGui, QtWidgets class Demo(QtWidgets.QWidget): def __init__(self): super(Demo, self).__init__() self.button = QtWidgets.QPushButton() self.label = QtWidgets.QLabel(alignment=QtCore.Qt.AlignCenter) self.combo = QtWidgets.QComboBox(self) ...
1,674
552
import pytest from apistrap.flask import FlaskApistrap from apistrap.schemas import ErrorResponse @pytest.fixture() def app_with_raises(app): oapi = FlaskApistrap() @app.route("/", methods=["GET"]) def view(): """ Something something. :raises KeyError: KeyError description ...
1,638
492
#$Id$ from projects.util.ZohoHttpClient import ZohoHttpClient from projects.api.Api import Api from projects.parser.UsersParser import UsersParser base_url = Api().base_url zoho_http_client = ZohoHttpClient() parser = UsersParser() class UsersApi: """Users Api class is used to 1.Get all the users in th...
1,126
347
#!/usr/bin/env python # Copyright (c) 2013-2015, Rethink Robotics # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, # ...
11,340
3,534
from rest_framework import serializers from .models import Measurement class MeasurementSerializer(serializers.ModelSerializer): class Meta: model = Measurement fields = '__all__'
203
54
_Msun_kpc3_to_GeV_cm3_factor = 0.3/8.0e6 def Msun_kpc3_to_GeV_cm3(value): return value*_Msun_kpc3_to_GeV_cm3_factor
123
75
class Solution(object): def nextPermutation(self, nums): """ :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead. """ if not nums: return n = len(nums)-1 while n > 0 and nums[n-1] >= nums[n]: n -= 1 t = n...
606
226
from django.db import models from django.contrib.auth import get_user_model from poll.models.poll_models import Poll class BasePollTelemetry(models.Model): """ This Base class gives a hint that in the future more Telemetry classes could be implemented. """ poll = models.ForeignKey(db_index=True, ...
1,114
348
from .base_bev_backbone import BaseBEVBackbone from .decouple_bev_backbone import DecoupledBEVBackbone __all__ = { 'BaseBEVBackbone': BaseBEVBackbone, 'DecoupledBEVBackbone': DecoupledBEVBackbone, }
208
83
from unittest.mock import Mock import pytest from galaxy import model from galaxy.tools.parameters import basic from .util import BaseParameterTestCase class SelectToolParameterTestCase(BaseParameterTestCase): def test_validated_values(self): self.options_xml = """<options><filter type="data_meta" ref="...
4,883
1,502
#!/usr/bin/env python # -*- coding: utf-8 -*- """recumpiler Recompile text to be semi-readable memey garbage. """ __version__ = (0, 0, 0)
141
62
# Copyright 2013 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. { 'variables': { 'chromium_code': 1, 'linux_link_kerberos%': 0, 'conditions': [ ['chromeos==1 or OS=="android" or OS=="ios"', { ...
108,939
38,009
import logging import torch import torch.nn as nn from abc import ABC, abstractmethod log = logging.getLogger(__name__) class Detector(ABC): def __init__(self, lr=0.001): self.lr = lr self.__model = None self.__optimizer = None self.__criterion = nn.CrossEntropyLoss() @proper...
2,268
692
import math import random from django.db import models class TimeStampedModel (models.Model): """ Base model class for when you want to keep track of created and updated times for model instances. """ created_datetime = models.DateTimeField(auto_now_add=True) updated_datetime = models.DateTim...
5,366
1,577
# SPDX-License-Identifier: BSD-3-Clause # # Copyright (c) 2021 Vít Labuda. All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, are permitted provided that the # following conditions are met: # 1. Redistributions of source code must retain the above copyright notice...
4,351
1,404
# TODO: https://libvirt.org/formatnwfilter.html
47
17
from estafeta.core.client import EstafetaClient user = None password = None id = None account_number = None production = None from estafeta.core.error import EstafetaWrongData, EstafetaEmptyField __url_label__ = [ 'https://labelqa.estafeta.com/EstafetaLabel20/services/EstafetaLabelWS?wsdl', 'https://label.e...
669
259
from yunionclient.common import base class FlavorManager(base.StandaloneManager): keyword = 'flavor' keyword_plural = 'flavors' _columns = ['ID', 'Name', 'VCPU_count', 'VMEM_size', 'Disk_size', 'Disk_backend', 'Ext_Bandwidth', 'Int_Bandwidth', 'is_public', 'Description', 'A...
355
124
""" Defines two dictionaries for converting between text and integer sequences. """ char_map_str = """ ' 0 <SPACE> 1 ব 2 া 3 ং 4 ল 5 দ 6 ে 7 শ 8 য 9 ় 10 ি 11 ত 12 ্ 13 ন 14 এ 15 ধ 16 র 17 ণ 18 ক 19 ড 20 হ 21 উ 22 প 23 জ 24 অ 25 থ 26 স 27 ষ 28 ই 29 আ 30 ছ 31 গ 32 ু 33 ো 34 ও 35 ভ 36 ী 37 ট 38 ূ 39 ম 40 ৈ 41 ৃ 42 ঙ 4...
892
778
from flask import Blueprint from flask_restful import Api # from restful import Api from resources.Hello import CategoryResource api_bp = Blueprint('api', __name__) api = Api(api_bp) # Route api.add_resource(CategoryResource, '/Hello')
238
71
#from gevent import monkey #monkey.patch_all() from flask import Flask, render_template, json from flask_socketio import SocketIO, emit from pydbus import SystemBus from gi.repository import GLib import threading import json app = Flask(__name__) app.config['SECRET_KEY'] = 'secret!' socketio = SocketIO(app, async_m...
3,549
1,246
# -*- coding: utf-8 -*- from includes import * from common import * def search(env, r, *args): return r.execute_command('ft.search', *args) def testTagIndex(env): r = env env.expect('ft.create', 'idx', 'ON', 'HASH','schema', 'title', 'text', 'tags', 'tag').ok() N = 10 for n in range(N): ...
15,524
6,085
import itertools import logging import math import random from collections import Counter from typing import Any, Dict, List, Optional, Set, Tuple, Union # mypy type checking from .cache import property_cache_forever, property_cache_once_per_frame from .data import ActionResult, Alert, Race, Result, Target, race_gas,...
39,956
11,304
# Copyright 2022 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import annotations from dataclasses import dataclass from enum import Enum from typing import Any, Iterable, cast from pants.core.util_rules.lockfile_metadata import ( ...
4,260
1,230
#!/usr/bin/env python3 import os import re cur_path = os.path.dirname(os.path.realpath(__file__)) opendbc_root = os.path.join(cur_path, '../') include_pattern = re.compile(r'CM_ "IMPORT (.*?)";') def read_dbc(src_dir, filename): with open(os.path.join(src_dir, filename)) as file_in: return file_in.read() def...
1,528
560
from django.contrib import admin from django.utils.safestring import mark_safe from customer.models import Owner, Dog, Breed, SubBreed class OwnerAdmin(admin.ModelAdmin): """ Owner ModelAdmin. """ search_fields = ['name'] class BreedAdmin(admin.ModelAdmin): """ Breed ModelAdmin. """ s...
1,105
371
from __future__ import absolute_import from redis import Redis from rq.decorators import job from kaneda.utils import get_backend backend = get_backend() @job(queue='kaneda', connection=Redis()) def report(name, metric, value, tags, id_): """ RQ job to report metrics to the configured backend in kanedasett...
464
138
from dotenv import load_dotenv from PyPDF2 import PdfFileReader, PdfFileWriter import os import json class CertRipper: def __init__( self, start_page_index=0, master_pdf_path=None, json_points_path=None, ripped_certs_path=None, ripped_cert_file_name=None, ): ...
4,067
1,304
# # Licensed Materials - Property of IBM # # (c) Copyright IBM Corp. 2007-2008 # import unittest, sys import ibm_db import config from testfunctions import IbmDbTestFunctions class IbmDbTestCase(unittest.TestCase): def test_111_FieldNumAddCol(self): obj = IbmDbTestFunctions() obj.assert_expect(self.run_...
2,192
933
from cms.api import get_page_draft from cms.toolbar_pool import toolbar_pool from cms.toolbar_base import CMSToolbar from cms.utils import get_cms_setting from cms.utils.permissions import has_page_change_permission from django.core.urlresolvers import reverse, NoReverseMatch from django.utils.translation import ugette...
2,382
647
import math import torch import torch.nn as nn import torch.nn.functional as F class RNNModel(nn.Module): """Container module with an encoder, a recurrent module, and a decoder.""" def __init__(self, rnn_type, ntoken, ninp, nhid, nlayers, dropout=0.5, tie_weights=False, encoder=None, decoder=None): su...
7,346
2,429
def main(): a=input("The enter the first number :") b=input("The enter the second number :") range=input("Please enter the range") i=0;count=0; print a print b while count!=range: c=a+b count +=1 print c a=b b=c main()
248
112
from scrapper.playstation.spider import main
44
12
import slackbot.bot import random answer = random.randint(1, 50) max = 50 def number(num): '''number 判定 Args: num (int): 判定する数字 Returns: str: num が answer より大きい: 'Too large' num が answer より小さい: 'Too small' num が answer と一致: 'Correct!'、新しくゲームを始める その他: 'C...
2,737
1,223
"""Code for checking and inferring types.""" import collections import logging import re import subprocess from typing import Any, Dict, Union from pytype import abstract from pytype import abstract_utils from pytype import convert_structural from pytype import debug from pytype import function from pytype import met...
30,964
9,472
#!/usr/bin/env python __author__ = "etseng@pacb.com" """ Given a pooled input GFF + demux CSV file, write out per-{barcode group} GFFs If input fasta/fastq is given, optionally also output per-{barcode group} FASTA/FASTQ """ import re from collections import defaultdict from csv import DictReader from typing import Op...
3,979
1,444
import random import numpy as np import math from skimage.draw import line, line_aa, circle, set_color, circle_perimeter_aa from skimage.io import imsave from skimage.util import random_noise maxSlope = 10 # restrict the maximum slope of generated lines for stability minLength = 20 # restrict the minimum length of li...
5,168
2,074
# -*- coding: utf-8 -*- """ Created on Wed Apr 1 17:14:19 2020 @author: Mitchell nesm_generator.py ~~~~~~~~~~~~~~~~~ This file serves as a script for using our pre-trained VAE model to generate brand new NES music soundtracks. NOTE - using the reduced model we only generate the first melodic voice for each track rat...
5,276
1,643
import logging import logging.handlers import os class Logger(object): def __init__(self, name, default_loglevel='INFO', fmt=None, syslog=None): self.name = name self.syslog = syslog self.fmt = fmt if fmt is not None else "%(asctime)-15s %(name)s %(levelname)s %(message)s" if 'LOGLEVEL' in os.env...
1,030
350
#Author Theodosis Paidakis print("Hello World") hello_list = ["Hello World"] print(hello_list[0]) for i in hello_list: print(i)
133
50
from collections import namedtuple from unittest.mock import MagicMock _fake_ext = namedtuple('_', ['qtype', 'kb_ident']) class FakeDoc: def __init__(self, text, qtype, kb_ident): self._ = _fake_ext(qtype, kb_ident) self.text = text def __str__(self): return f"<[MOCKED NLP]{sel...
330
123
from abc import ABCMeta, abstractmethod from typing import Tuple, Callable class BaseTradeStrategy(object, metaclass=ABCMeta): @abstractmethod def __init__(self, commissionPercent: float, maxSlippagePercent: float, base_precision: int, asset_...
729
188
# Book04_1.py class Book: category = '소설' # Class 멤버 b1 = Book(); print(b1.category) b2 = b1; print(b2.category) print(Book.category) Book.category = '수필' print(b2.category); print(b1.category) ; print(Book.category) b2.category = 'IT' print(b2.category); print(b1.category) ; print(Book.category)
304
133
# Copyright (C) 2015-2021 Virgil Security, Inc. # # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # (1) Redistributions of source code must retain the above copyright # notice, this li...
4,146
1,514
#!/usr/bin/env python # encoding: utf-8 from django.test import TestCase from zoo import models class AnimalTestCase(TestCase): """Test animals' sound """ def test_dog_says(self): """test dog says woof or not """ dog = models.Dog(name='Snoopy') self.assertEqual(dog.says()...
497
167
print('Digite seu nome completo: ') nome = input().strip().upper() print('Seu nome tem "Silva"?') print('SILVA' in nome)
123
45
dataset_type = 'STVQADATASET' data_root = '/home/datasets/mix_data/iMIX/' feature_path = 'data/datasets/stvqa/defaults/features/' ocr_feature_path = 'data/datasets/stvqa/defaults/ocr_features/' annotation_path = 'data/datasets/stvqa/defaults/annotations/' vocab_path = 'data/datasets/stvqa/defaults/extras/vocabs/' trai...
3,283
1,358
# -*- coding: utf-8 -*- # Generated by Django 1.10 on 2016-09-27 13:17 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion import mezzanine.core.fields class Migration(migrations.Migration): dependencies = [ ('rpocore', '0006_auto_20160921_19...
2,955
879
#LineSensor test from gpiozero import LineSensor from time import sleep from signal import pause def lineDetected(): print('line detected') def noLineDetected(): print('no line detected') sensor = LineSensor(14) sensor.when_line = lineDetected sensor.when_no_line = noLineDetected pause() sensor.close()
320
108
# # This file is part of LiteX-Boards. # # Copyright (c) 2021 Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com> # SPDX-License-Identifier: BSD-2-Clause from migen import * from litex.build.generic_platform import * from litex.build.gowin.platform import GowinPlatform from litex.build.openfpgaloader import ...
4,239
1,845
import numpy as np import copy import combo.misc import cPickle as pickle from results import history from .. import utility from ...variable import variable from ..call_simulator import call_simulator from ... import predictor from ...gp import predictor as gp_predictor from ...blm import predictor as blm_predictor im...
8,468
2,578
def _disable_linecache(): import linecache def fake_getline(*args, **kwargs): return "" linecache.orig_getline = linecache.getline linecache.getline = fake_getline _disable_linecache()
213
69
import requests from bs4 import BeautifulSoup as bs import os #source url = '' # the source you want the bot take images from #down page page = requests.get(url) html = bs(page.text, 'html.parser') #locate image_loc = html.findAll('img') #create folder for located imgs if not os.path.exists('imgs'): os.makedirs(...
693
249
''' 1、启动appium服务 subproccess 配置文件 1.1、校验服务是否启动 1.2、杀掉上一次的服务 2、启动driver ''' from lib.tools import Tool import subprocess from lib.path import SYSTEMPATH, ERRORPATH import time from appium import webdriver import queue # 声明一个python队列 driver_queue = queue.Queue() class Controller(object): def __init__(se...
2,403
838
# -*- encoding: utf-8 -*- ''' @project : LeetCode @File : pondSizes.py @Contact : 9824373@qq.com @Desc : 你有一个用于表示一片土地的整数矩阵land,该矩阵中每个点的值代表对应地点的海拔高度。若值为0则表示水域。由垂直、水平或对角连接的水域为池塘。池塘的大小是指相连接的水域的个数。编写一个方法来计算矩阵中所有池塘的大小,返回值需要从小到大排序。 示例: 输入: [ [0,2,1,0], [0,1,0,1], [1,1,0,1], ...
2,226
991
# -*- coding: utf-8 -*- from decimal import Decimal, setcontext, ExtendedContext from geolucidate.links.google import google_maps_link from geolucidate.links.tools import MapLink from geolucidate.parser import parser_re setcontext(ExtendedContext) def _cleanup(parts): """ Normalize up the parts matched by :...
5,990
2,298
from setuptools import setup, find_packages setup( name='Pokedex', version='0.1', zip_safe=False, packages=find_packages(), package_data={ 'pokedex': ['data/csv/*.csv'] }, install_requires=[ 'SQLAlchemy>=1.0,<2.0', 'whoosh>=2.5,<2.7', 'markdown==2.4.1', ...
715
254
# Copyright 2018 The TensorFlow 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 applica...
17,900
6,309
import matplotlib.font_manager as fm import matplotlib.pyplot as plt import numpy as np font_location = './wordcloud_file/malgun.ttf' # For Windows font_name = fm.FontProperties(fname=font_location).get_name() plt.rc('font', family=font_name) def percent_graph2(movie_review) : b = movie_review labelss = sorte...
1,898
1,033
from django.shortcuts import render from django.views.generic import TemplateView def index(request): return render(request, 'index.html')
143
38
from django.shortcuts import render from .forms import * from django.shortcuts import redirect,get_object_or_404 from django.contrib.auth.decorators import login_required from . models import * from django.views import generic @login_required(login_url='/accounts/login/') def home(request): mylocs = Myloc.objects....
3,727
1,158
""" Day 1 Main Module """ from day01 import parse_input, part1, part2 if __name__ == "__main__": # trying out the new walrus[:=] oprtr in python if (part := int(input("Enter Part: "))) == 1: print(part1(parse_input("input.txt"))) elif part == 2: print(part2(parse_input("input.txt"))) e...
361
133
""" Django settings for quiz_app project. Generated by 'django-admin startproject' using Django 2.1.2. For more information on this file, see https://docs.djangoproject.com/en/2.1/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/2.1/ref/settings/ """ SITE_ID = 1 ...
4,406
1,619
import numpy as np import pickle from os.path import exists, realpath import sys import math from topple_data_loader import ToppleData, ToppleDataLoader import transforms3d class ToppleNormalizationInfo(): ''' Structure to hold all the normalization information for a dataset. ''' def __init__(self...
20,840
6,774
import numpy as np from operator import truediv def AA_andEachClassAccuracy(confusion_matrix): counter = confusion_matrix.shape[0] list_diag = np.diag(confusion_matrix) list_raw_sum = np.sum(confusion_matrix, axis=1) each_acc = np.nan_to_num(truediv(list_diag, list_raw_sum)) average_acc = n...
370
138
#!/usr/bin/env python ######################################################################################### # # Apply transformations. This function is a wrapper for sct_WarpImageMultiTransform # # --------------------------------------------------------------------------------------- # Copyright (c) 2014 Polytechn...
13,193
4,027
# Copyright 2013-2014 MongoDB, 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 writin...
3,132
950
import logging import sys from django.core.exceptions import ValidationError from django.db import models from django.db.models.fields.related import ForeignObject from django.utils.encoding import python_2_unicode_compatible try: from django.db.models.fields.related_descriptors import ForwardManyToOneDescriptor ...
10,365
3,054
# -*- coding: utf-8 -*- """ Modules for exposing functions that can be run as tasks. """ from __future__ import (absolute_import, division, print_function, unicode_literals)
198
60
#-*- coding:utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. from odoo import api, fields, models, _ from odoo.exceptions import UserError from odoo.tools import float_compare, float_is_zero class HrPayslipLine(models.Model): _inherit = 'hr.payslip.line' def _get_partner_...
7,715
2,441
import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec import sys import numpy as np from matplotlib.colors import LinearSegmentedColormap from matplotlib.colors import BoundaryNorm def plot_images( num_sample_perclass=10, x=None, y=None, labels=None, title=None, cmap=None ): grid_x = num_samp...
3,048
1,228
import logging import os import random from abc import ABC, abstractmethod from random import randint from time import sleep, strftime HOSTNAME = ['defence-first.rs', 'defence-first.de', 'defence-first.ru'] HOSTIP = ['78.218.236.218', '87.236.11.212', '54.147.165.86'] SOURCEIP = ['163.189.141.53', '204.164.10.7', '213...
4,794
1,650
from bayes_race.pp.pure_pursuit import purePursuit
50
20
from typing import Optional import numpy as np from . import Evaluator from ..state import VectorSpaceStateVar class VectorSpaceErrorEval(Evaluator): """Error evaluator for a measured vector space state variable""" def __init__(self, meas: np.ndarray, state_vec: VectorSpaceStateVar) -> None: super().__init_...
793
261
from .knn_interpolate import knn_interpolate __all__ = [ 'knn_interpolate', ]
83
36
from bc4py_extension import PyAddress import hashlib def is_address(ck: PyAddress, hrp, ver): """check bech32 format and version""" try: if ck.hrp != hrp: return False if ck.version != ver: return False except ValueError: return False return True def g...
937
315
"""``cubi-tk snappy kickoff``: kickoff SNAPPY pipeline.""" import argparse import os import subprocess import typing from logzero import logger from toposort import toposort from . import common from cubi_tk.exceptions import ParseOutputException def run( args, _parser: argparse.ArgumentParser, _subparser: ar...
2,687
853
from __future__ import absolute_import from functools import reduce from operator import mul try: from StringIO import StringIO except ImportError: # Python3 compatibility from io import StringIO import pytest from conftest import skipif_yask import numpy as np from devito import Grid, Function, TimeFun...
4,152
1,396
from data.data_reader import BIZCARD_LABEL_MAP, BizcardDataParser import argparse from pathlib import Path import os import json import cv2 import numpy as np def convert_bizcard_to_coco_format(image_dir, json_dir, id_list, out_dir, out_name): coco_json = {} images = [] annotations = [] categories = [...
2,683
907
from pathlib import Path from typing import List, Optional from typer import Argument from deckz.cli import app from deckz.paths import Paths from deckz.running import run as running_run @app.command() def run( targets: Optional[List[str]] = Argument(None), handout: bool = True, presentation: bool = Tru...
643
197
from django import template register = template.Library() @register.filter(name='isboolean') def isboolean(value): return isinstance(value, bool) @register.filter(name='vartypename') def vartypename(value): return type(value).__name__
248
78
import asyncio import contextvars import aioredis import uvloop from aioredis import Redis from fastapi import FastAPI from starlette.middleware.base import BaseHTTPMiddleware from starlette.staticfiles import StaticFiles from RLog import rprint from routers import apirest, websockets REDIS_HOST = 'redis' REDIS_PORT =...
2,171
738
import argparse import autoencoder def addTrainablesArg(parser): parser.add_argument('--model', dest='model', help='Trained model', default='model.pt') def addExchangeArg(parser): parser.add_argument('--exchange', dest='exchange', help='File with exchanged data', required=True) parser = argparse.ArgumentPa...
1,009
312