id
stringlengths
1
7
text
stringlengths
6
1.03M
dataset_id
stringclasses
1 value
1663522
""" Test that we can get a reasonable list of tags from the data source of /tags """ import shutil from tiddlyweb.model.bag import Bag from tiddlyweb.model.tiddler import Tiddler from tiddlyweb.config import config from tiddlywebplugins.utils import get_store from tiddlywebplugins.tank.search import get_indexed_tag...
StarcoderdataPython
1671173
# 使用第三方库来创建useragent from fake_useragent import UserAgent ua = UserAgent() print(ua.chrome) print('='*100) for i in range(10): print(ua.random)
StarcoderdataPython
3288408
#!/usr/bin/python ############################################################################### # enbackup-archive.py - worker script to store backups on external disks # # August 2008, <NAME> # # Copyright (c) 2008-2012 by Ensoft Ltd. All right reserved # # Version 1.0 - all working, does all it should apart from po...
StarcoderdataPython
188507
import os import numpy as np import pytest from config.stage import ConfigStage from extract.stage import ExtractStage from preprocess.stage import PreprocessStage @pytest.mark.parametrize("action", ['train']) def test_extract_stage(action): path = os.path.abspath(os.path.join(__file__, "../../..", 'resources/co...
StarcoderdataPython
3278513
import plotly.graph_objects as go def make_figure(df): fig = go.Figure( ) fig.update_layout( width=600, height=600) fig.add_trace(go.Scatter(x=df["x"].tolist(), y=df["y"].tolist() )) fig.update_layout( title={ 'text': "Demo plotly title", 'xanchor': 'left', ...
StarcoderdataPython
1698184
<reponame>ArlenCHEN/IntraDA<filename>ADVENT/advent/domain_adaptation/config.py # -------------------------------------------------------- # Configurations for domain adaptation # Copyright (c) 2019 valeo.ai # # Written by <NAME> # Adapted from https://github.com/rbgirshick/py-faster-rcnn/blob/master/lib/fast_rcnn/confi...
StarcoderdataPython
3248008
"""Provide an interface to data, parameters and results A :class:`DataHandle` is passed in to a :class:`Model` at runtime, to provide transparent access to the relevant data and parameters for the current :class:`ModelRun` and iteration. It gives read access to parameters and input data (at any computed or pre-compute...
StarcoderdataPython
3301029
import os import re from typing import List from box import Box from pyspark.sql.session import SparkSession from consolebundle.detector import is_running_in_console from injecta.container.ContainerInterface import ContainerInterface from injecta.dtype.DType import DType from injecta.service.Service import Service from...
StarcoderdataPython
92966
import numpy as np import pandas as pd import util from othello import Othello from constants import COLUMN_NAMES class StartTables: _start_tables = [] def _init_start_tables(self): """ read start tables from csv file 'start_moves.csv' and store them in _start_tables """ ...
StarcoderdataPython
1710679
import flask import flask_login from flask.views import MethodView from flask import request from webapp import models from webapp import api from webapp.journal_plugins import extensions from collections import Counter import datetime class IndexerPluginView(MethodView): def get_summary(self, context): ...
StarcoderdataPython
3320427
from ibeverage import ibeverage class vanilla(ibeverage): def __init__(self, bevObj): self.beverage = bevObj self.cost = bevObj.cost + 0.25 self.description = bevObj.description + ' ' + 'vanilla' def printCost(self): print('Vanilla cost = {0}'.format(self.cost)) def pr...
StarcoderdataPython
35913
import magic import os import random import string from ahye.settings import LOCAL_UPLOADS_DIR def generate_filename(image_data, detect_extension=True): alphanum = string.ascii_letters + string.digits retval = '' while not retval or os.path.exists(os.path.join(LOCAL_UPLOADS_DIR, retval)): retval...
StarcoderdataPython
1786406
import os import nox from nox import options PATH_TO_PROJECT = os.path.join(".", "duckari") SCRIPT_PATHS = [ PATH_TO_PROJECT, "noxfile.py", ] options.sessions = ["format_fix", "mypy"] @nox.session() def format_fix(session): session.install("-Ur", "nox-requirements.txt") session.run("python", "-m", ...
StarcoderdataPython
132595
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import io import logging import contextlib import os import datetime import json import numpy as np import cv2 import math import torch from PIL import Image from fvcore.common.timer import Timer from detectron2.structures import BoxMode, Polygon...
StarcoderdataPython
198979
<reponame>kartben/MaixPy_scripts import network, time from machine import UART from Maix import GPIO from fpioa_manager import fm, board_info fm.register(8, fm.fpioa.GPIOHS0, force=True) wifi_en=GPIO(GPIO.GPIOHS0, GPIO.OUT) fm.register(0, fm.fpioa.GPIOHS1, force=True) wifi_io0_en=GPIO(GPIO.GPIOHS1, GPIO.OUT) wifi_io...
StarcoderdataPython
1632144
<reponame>nragon/vision from multiprocessing import current_process from os import devnull, kill from signal import signal, SIGTERM, SIGINT from socket import socket, SOCK_STREAM, AF_INET, SHUT_RDWR from subprocess import Popen from time import sleep from core import common, logger PROCESS_NAME = current_process().na...
StarcoderdataPython
3323424
from bootstrap3.renderers import FieldRenderer, InlineFieldRenderer from bootstrap3.text import text_value from django.forms import CheckboxInput from django.forms.utils import flatatt from django.utils.html import format_html from django.utils.safestring import mark_safe from django.utils.translation import pgettext f...
StarcoderdataPython
3299858
<gh_stars>1-10 from .measure import normalized_levenshtein, jaccard_word, jaccard_char from gensim.models import KeyedVectors import numpy as np print('--------------load--------------------') EMBEDDING_PATH = 'distance_module/zh.300.vec.gz' EMBEDDING_DIM = 300 DEFAULT_KEYVEC = KeyedVectors.load_word2vec_format(EMBEDD...
StarcoderdataPython
3371850
<filename>Grammar/10Files and exceptions/division_caculator.py print("Give me two numbers, and I`ll divide them.") print("Enter `q` to quit.") while True: first_number = input("\nFirst Number: ") if first_number == 'q': break second_number = input("\nSecond Number: ") if second_number == 'q':3 break ...
StarcoderdataPython
1653094
from dataclasses import dataclass, field from typing import List @dataclass class A: class Meta: name = "a" value: str = field( init=False, default="e1", metadata={ "required": True, } ) @dataclass class B: class Meta: name = "b" valu...
StarcoderdataPython
141301
import json from unittest import TestCase import websockets import asyncio from .utils.rabbitmq import send_trigger from .utils.wiremock import set_bootstrap_response from settings import WS_URI # from time import time class TestSubscribe(TestCase): """ Simple test for setting up a websocket connection. ...
StarcoderdataPython
1756990
import numpy as np # Scalars product = np.dot(5, 4) print("Dot Product of scalar values : ", product) # 1D array vector_a = 2 + 3j vector_b = 4 + 5j product = np.dot(vector_a, vector_b) print("Dot Product : ", product)
StarcoderdataPython
3235730
import os import pytest import configparser from foxha.utils import Utils @pytest.fixture(scope='module') def utils(): return Utils() @pytest.fixture(scope='module') def cipher_suite(utils, test_key_path): return utils.parse_key_file(keyfile=test_key_path) @pytest.fixture(scope='module') def config_files_...
StarcoderdataPython
1620795
<filename>src/python/models/train_model.py<gh_stars>0 # -*- coding: utf-8 -*- import click import logging from pathlib import Path import numpy as np from catboost import CatBoostClassifier from dotenv import find_dotenv, load_dotenv import pandas as pd from sklearn.metrics import accuracy_score,roc_auc_score, f1_scor...
StarcoderdataPython
198576
''' Basic structures ''' from struct import Struct from .helpers import num, hexbyte from .enums import GradientType _MAGIC = b'4-tP' _LENGTH = Struct('<i') def _bare(fmt: str, mul=None) -> tuple: fmt = Struct(fmt) def packer(*data) -> bytes: if mul is not None: data = [x / mul for x i...
StarcoderdataPython
80711
<filename>pyontutils/utils_extra.py """ Reused utilties that depend on packages outside the python standard library. """ import hashlib import rdflib rdflib.plugin.register('librdfxml', rdflib.parser.Parser, 'pyontutils.librdf', 'libRdfxmlParser') rdflib.plugin.register('libttl', rdflib.par...
StarcoderdataPython
1698849
from . import pairwise from . import losses from . import objects from .losses import gmm from . import phantoms from . import utils
StarcoderdataPython
1736644
# Copyright 2020 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...
StarcoderdataPython
3302674
<reponame>NULLCT/LOMC # coding: utf-8 import sys import math import io from collections import Counter from collections import deque def i_input(): return int(input()) def i_map(): return map(int, input().split()) def i_list(): return list(i_map()) def main(): sys.setrecursionlimit(10**6) n,...
StarcoderdataPython
3327025
import re def scene_names_key_func(scene_name): """ Key function for sorting scenes with the naming convention that was used """ m = re.search('FloorPlan[_]?([a-zA-Z\-]*)([0-9]+)_?([0-9]+)?.*$', scene_name) last_val = m.group(3) if m.group(3) is not None else -1 return m.group(1), int(m.group(2...
StarcoderdataPython
1764551
<reponame>usc-psychsim/atomic_domain_definitions<filename>atomic/util/plot.py import colorsys import copy import matplotlib import pandas as pd import numpy as np import matplotlib.pyplot as plt import matplotlib.patches as mpatches from matplotlib.legend_handler import HandlerTuple from matplotlib.lines import Line2D ...
StarcoderdataPython
141096
""" Just a purple sphere """ from vapory import * objects = [ # SUN LightSource([1500,2500,-2500], 'color',1), # SKY Sphere( [0,0,0],1, 'hollow', Texture( Pigment( 'gradient', [0,1,0], 'color_map{[0 color White] [1 color Blu...
StarcoderdataPython
164737
<filename>pypet2bids/pypet2bids/dcm2niix4pet.py import os import sys import warnings from json_maj.main import JsonMAJ, load_json_or_dict from pypet2bids.helper_functions import ParseKwargs, get_version, translate_metadata, expand_path import subprocess import pandas as pd from os.path import join from os import listd...
StarcoderdataPython
3218155
<reponame>the-aerospace-corporation/ITU-Rpy<gh_stars>0 __all__ = ['itu453', 'itu530', 'itu618', 'itu676', 'itu835', 'itu836', 'itu837', 'itu838', 'itu839', 'itu840', 'itu1144', 'itu1510', 'itu1511', 'itu1853'] import itur.models.itu453 import itur.models.itu530 import itur.models.itu618 import it...
StarcoderdataPython
1697440
<gh_stars>0 #!/usr/bin/env python2 # # sumo-launchd.py -- SUMO launcher daemon for use with TraCI clients # Copyright (C) 2006-2012 <NAME> <<EMAIL>> # # Documentation for these modules is at http://veins.car2x.org/ # # SPDX-License-Identifier: GPL-2.0-or-later # # This program is free software; you can redistribute it...
StarcoderdataPython
8153
#!/usr/bin/env python # Licensed under a 3-clause BSD style license - see LICENSE.rst import mica.archive.asp_l1 mica.archive.asp_l1.main()
StarcoderdataPython
3387721
<filename>tests/test_gizmo_query.py import unittest from pyley import GraphObject class GizmoQueryTests(unittest.TestCase): def setUp(self): self.opts = dict(url='http://localhost:64210/api/v1/query/gizmo') def test_vertex_query(self): g = GraphObject() query = g.Vertex() se...
StarcoderdataPython
2978
<filename>src/printReport.py from __future__ import print_function from connection import * from jinja2 import Environment, FileSystemLoader import webbrowser def print_report(id): env = Environment(loader=FileSystemLoader('.')) template = env.get_template("src/template.html") cursor = db.cursor(MySQLdb.cursors.D...
StarcoderdataPython
1762189
<filename>benchmark/operations/test/test_wait.py # Copyright 2015 ClusterHQ Inc. See LICENSE file for details. from twisted.internet.task import Clock from flocker.testtools import TestCase from benchmark.operations import Wait class WaitOperationTests(TestCase): """ Test Wait operation """ def te...
StarcoderdataPython
3220460
# coding: utf-8 from __future__ import absolute_import from datetime import date, datetime # noqa: F401 from typing import List, Dict # noqa: F401 from .base_model_ import Model from .. import util class DocumentInfoPageEntry(Model): """NOTE: This class is auto generated by the swagger code generator program...
StarcoderdataPython
1655829
#!/usr/bin/env python import sh import sys import flask.ext.script import server.app as server import wsgi instance = server.flask_instance manager = flask.ext.script.Manager(instance) @manager.command def run(): wsgi.run() @manager.command def docker_build(): sh.docker.build('-t', 'webapp', '.', _out=sys...
StarcoderdataPython
42321
# proxy module from __future__ import absolute_import from mayavi.filters.cell_derivatives import *
StarcoderdataPython
3242771
from django.conf.urls import patterns, include, url from django.views.generic import TemplateView from . import views urlpatterns=patterns('graficas.views', url(r'^$', 'graficas', name='graficas'), )
StarcoderdataPython
1630062
# Copyright (c) 2020 NVIDIA Corporation # 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, d...
StarcoderdataPython
1668680
from collections import deque import math import sys import time class Timer: def __init__(self, f=sys.stdout): self._start_time = time.monotonic() self._time_history = deque([]) self._file = f def _get_current_time(self): return time.monotonic() - self._start_time def add...
StarcoderdataPython
104319
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import sys import pprint if len(sys.argv) < 2: print '''Please provide a top-level path. Usage: % find-directories-without-sfv.py . OR % find-directories-without-sfv.py /somewhere''' sys.exit(1) rootPath = sys.argv[1] for path in os.walk(rootPath): ...
StarcoderdataPython
183263
<gh_stars>0 nu = int(input('Digite um número: ')) an = nu - 1 su = nu + 1 print('O sucessor de {} é {} e o\nsucessor é {}'.format(nu,an,su))
StarcoderdataPython
27551
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/01a_datasets_download.ipynb (unless otherwise specified). __all__ = ['get_cifar10', 'get_oxford_102_flowers', 'get_cub_200_2011'] # Internal Cell import glob import json from pathlib import Path import os import subprocess import tarfile import urllib import zlib # In...
StarcoderdataPython
3296877
<filename>bnpy/ioutil/CountReader.py from builtins import * import sys import os import scipy.sparse import numpy as np from bnpy.util import argsort_bigtosmall_stable def loadKeffForTask( taskpath, effCountThr=0.01, MIN_PRESENT_COUNT=1e-10, **kwargs): ''' Load effective number of ...
StarcoderdataPython
3364099
<gh_stars>100-1000 from securify.solidity import compile_attributed_ast_from_string from securify.staticanalysis.factencoder import encode from securify.staticanalysis.souffle.souffle import is_souffle_available, generate_fact_files, run_souffle if __name__ == '__main__': print(is_souffle_available()) # langu...
StarcoderdataPython
4842032
<gh_stars>1-10 from fractions import Fraction from math import ceil, log def eval_kraft_mcmillan(radix, *args, **kwargs): return sum(map(lambda l: Fraction(1, radix ** l), args)) def eval_kraft_mcmillan_length(k, radix, *args, **kwargs): curr_k = eval_kraft_mcmillan(radix, *args) length = int(log(k - cu...
StarcoderdataPython
3332067
<gh_stars>0 #way to upload image: endpoint #way to save the image #function to make prediction on the image #show the results import torch import torchvision from torchvision import transforms from PIL import Image import io import os from flask import Flask, request, render_template app= Flask(__name__) UPLOAD_FOLD...
StarcoderdataPython
9457
<reponame>emissible/emissilbe #from . import context #from . import test_NNModels #from . import test_data_extract #from . import test_speedcom #from . import test_utilities
StarcoderdataPython
3382621
from zenoss.protocols.protobufs.zep_pb2 import SEVERITY_INFO # Get attributes from the event object ap_name = str(getattr(evt, 'wlsxTrapAPLocation.0', '')) radio = str(getattr(evt, 'wlsxTrapAPRadioNumber.0', '')) prev_chan = str(getattr(evt, 'wlsxTrapAPPrevChannel.0', '')) curr_chan = str(getattr(evt, 'wlsxTrapAPChann...
StarcoderdataPython
4815025
<reponame>ARte-team/ARte #!/usr/bin/env python3 import os import sys import argparse import pathlib import posixpath import io import itertools import mmap import shutil from binascii import hexlify C_HEADER = """/* This file was automatically generated by mkconstfs2. * !!!! DO NOT EDIT !!!!! */ #include <stdint.h...
StarcoderdataPython
3228693
<filename>bitcoinpy/cache.py # Cache.py # # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. class Cache(object): def __init__(self, max=1000): self.d = {} self.l = [] self.max = max def put(self, k, v): self.d[k] = v...
StarcoderdataPython
132680
import socket import sys import threading import time import uuid import unittest from mock import patch from nose import SkipTest from nose.tools import eq_ from nose.tools import raises from kazoo.testing import KazooTestCase from kazoo.exceptions import ( AuthFailedError, BadArgumentsError, Configurati...
StarcoderdataPython
1772671
import re from espider.spider import Spider class TSpider(Spider): __custom_setting__ = { 'max_retry': 0, 'max_thread': 10 } index = 1 def start_requests(self): self.url = 'http://www.pythonchallenge.com/pc/def/linkedlist.php?nothing={}' yield self.request(self.url.f...
StarcoderdataPython
108027
<reponame>Ziki2001/new-school-sdk # -*- coding: utf-8 -*- ''' :file: utils.py :author: -Farmer :url: https://blog.farmer233.top :date: 2021/09/04 23:45:40 ''' class ObjectDict(dict): """:copyright: (c) 2014 by messense. Makes a dictionary behave like an object, with attribute-style access. ...
StarcoderdataPython
22247
<reponame>mtymchenko/npaths<gh_stars>0 import unittest import numpy as np import matplotlib.pyplot as plt from npaths import NPathNode, Filter, Circulator __all__ = [ 'TestNPathNode', 'TestFilter', 'TestCirculator' ] GHz = 1e9 ohm = 1 pF = 1e-12 freqs = np.linspace(0.001, 6, 500)*GHz class TestNPathN...
StarcoderdataPython
3304752
<filename>docs/examples/e06_simple_bot_structure/modules/meta.py<gh_stars>100-1000 from hata import Client from hata.ext.commands_v2 import checks Sakuya : Client @Sakuya.commands @checks.owner_only() async def ping(): """Pongs.""" return 'pong'
StarcoderdataPython
181027
<reponame>froukees/querybook<filename>querybook/server/lib/table_upload/importer/base_importer.py from abc import ABC, abstractmethod from typing import Any, Dict, List, Optional, Tuple from pandas import DataFrame from lib.table_upload.common import ImporterResourceType class BaseTableUploadImporter(ABC): def __...
StarcoderdataPython
15867
<reponame>gcunhase/tensorflow-onnx # SPDX-License-Identifier: Apache-2.0 """Graph Optimizer Base""" import copy from .. import logging, utils class GraphOptimizerBase(object): """optimizer graph to improve performance """ def __init__(self): self._logger = logging.getLogger('.'.join(__name__....
StarcoderdataPython
1654436
<gh_stars>0 from .client import SkyRouter
StarcoderdataPython
3366545
""" mcpython - a minecraft clone written in python licenced under the MIT-licence (https://github.com/mcpython4-coding/core) Contributors: uuk, xkcdjerry (inactive) Based on the game of fogleman (https://github.com/fogleman/Minecraft), licenced under the MIT-licence Original game "minecraft" by Mojang Studios (www.m...
StarcoderdataPython
1617929
# Func04.py def Sum(*args): return sum(args) print(Sum(20, 10)) #30 print(Sum(20, 10, 5)) #35 print(Sum(20, 10, 5, 3)) #8 b = [10, 20, 30, 40, 50] print(Sum(*b))
StarcoderdataPython
3286113
<reponame>PepSalehi/algorithms<gh_stars>0 #!/usr/bin/env python """Get all page names of a given language.""" import json import requests def query(lang, query): query = "&".join(query) q = (u"https://{lang}.wikipedia.org/w/api.php?action=query&{query}" "&format=json" .format(lang=lang, qu...
StarcoderdataPython
39829
import dash import dash_bio as dashbio import dash_html_components as html import dash_core_components as dcc external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css'] app = dash.Dash(__name__, external_stylesheets=external_stylesheets) app.layout = html.Div([ 'Select which chromosomes to display on ...
StarcoderdataPython
1624653
<gh_stars>1-10 """Anagrafica app.""" from fattureincloud.models.base import Resource class Soggetto(Resource): """Soggetto class.""" def lista(self, _id="", filtro="", nome="", cf="", piva="", pagina=1): """Return list of elements filtered by given parameters if set.""" payload = { ...
StarcoderdataPython
1763256
<reponame>railnova/raven-cron<gh_stars>0 from getpass import getuser from os import getenv, path, SEEK_END from raven import Client from subprocess import call from tempfile import TemporaryFile from argparse import ArgumentParser import argparse from sys import argv, stderr from time import time from .version import V...
StarcoderdataPython
153036
# 2016. Vlachos Group Ge<NAME>. University of Delaware.
StarcoderdataPython
1660162
''' May 2017 @author: <NAME> ''' import unittest class GuiUnitTests(unittest.TestCase): pass if __name__ == '__main__': unittest.main()
StarcoderdataPython
1639475
<reponame>omnivector-solutions/charm-fluentbit """Fluentbit operations.""" import logging import shlex import subprocess import shutil from pathlib import Path from typing import List from jinja2 import Environment, FileSystemLoader from utils import operating_system logger = logging.getLogger() class FluentbitOp...
StarcoderdataPython
82824
"""Delete permission template API method.""" from ibsng.handler.handler import Handler class deletePermTemplate(Handler): """Delete permission template method class.""" def control(self): """Validate inputs after method setup. :return: None :rtype: None """ self.is_va...
StarcoderdataPython
12505
from ex01.funcoes import * def arqExiste(nome): try: a = open(nome, 'rt') #rt = read text a.close() except FileNotFoundError: return False else: return True def criarArq(nome): try: a = open(nome, 'wt+') #wt = write text and + = create one if it not exists ...
StarcoderdataPython
11236
""" Totally untested file. Will be removed in subsequent commits """ import tensorflow as tf import matplotlib.image as mpimg import numpy as np from math import ceil, floor import os IMAGE_SIZE = 720 def central_scale_images(X_imgs, scales): # Various settings needed for Tensorflow operation boxes = np.zeros...
StarcoderdataPython
3301050
<reponame>code-watch/meltano<gh_stars>0 import click import json from . import cli from .params import project from meltano.core.db import project_engine from meltano.core.project import Project from meltano.core.plugin import PluginType from meltano.core.config_service import ConfigService from meltano.core.plugin.s...
StarcoderdataPython
94098
<gh_stars>1-10 from django.conf import settings SLACK_VERIFICATION_TOKEN = settings.SLACK_VERIFICATION_TOKEN SLACK_BOT_TOKEN = settings.SLACK_BOT_TOKEN import logging logging.getLogger().setLevel(logging.INFO) from pyee import EventEmitter from slacker import Slacker CLIENT = Slacker(SLACK_BOT_TOKEN) class SlackEve...
StarcoderdataPython
1703438
# static analysis: ignore from .test_name_check_visitor import TestNameCheckVisitorBase from .test_node_visitor import assert_passes from .value import ( NO_RETURN_VALUE, AnnotatedValue, AnySource, AnyValue, KVPair, assert_is_value, CallableValue, GenericValue, SequenceIncompleteVal...
StarcoderdataPython
1792204
import os import matplotlib.pyplot as plt from ArmMovementPredictionStudien.Preprocessing.utils.utils import open_dataset_pandas import pandas as pd ROOT_DIR = os.path.dirname(__file__) + "/../../" base_directory = ROOT_DIR + "DATA/" raw_directory = base_directory + "0_raw/" truncated_directory = base_directory + "3_...
StarcoderdataPython
3396282
<gh_stars>0 import stdio import random random_values = tuple(map(lambda x: random.random(), range(5))) stdio.writeln("Random values: " + "\n" + "-" * 30 + "\n" "{}".format(random_values) + "\n" + "-" * 100 + "\n" + "mean: {}".format(sum(random_values) / 5) + "\n...
StarcoderdataPython
114235
<reponame>sungho-joo/leetcode2github<gh_stars>0 # @l2g 200 python3 # [200] Number of Islands # Difficulty: Medium # https://leetcode.com/problems/number-of-islands # # Given an m x n 2D binary grid grid which represents a map of '1's (land) and '0's (water), # return the number of islands. # An island is surrounded by ...
StarcoderdataPython
113188
<reponame>Max-PJB/python-learning2 #!/usr/bin/env python # -*- coding: utf-8 -*- """ ------------------------------------------------- @ Author : Max_Pengjb @ date : 2018/9/23 22:37 @ IDE : PyCharm @ GitHub : https://github.com/JackyPJB @ Contact : <...
StarcoderdataPython
1785464
v = float(input('Digite o valor: ')) print('É possível comprar US${:.2f}'.format(v/3.27))
StarcoderdataPython
3381042
""" pynet data augmentation overview ================================ Credit: <NAME> pynet contains a set of tools to efficiently augment 3D medical images that is crutial for deep learning applications. It includes random affine/non linear transformations, simulation of intensity artifacts due to MRI magnetic field ...
StarcoderdataPython
3221582
<gh_stars>0 # -*- coding: utf-8 -*- """ Created on Thu Apr 30 2020 @author: Cassio (chmendonca) Description: This class will have the ship characteristics and almost all behaviors """ import pygame from pygame.sprite import Sprite class Alien(Sprite): """A class that represents a single alien from the fleet""" ...
StarcoderdataPython
1699930
<filename>ERation/customer/models.py from django.db import models from django.core import validators as v import eadmin.models as admin # Create your models here. class Customer(models.Model): name = models.CharField( verbose_name='Name', name='name', max_length=50, null=False, ...
StarcoderdataPython
4809435
<reponame>juliendelaunay35000/APE-Adapted_Post-Hoc_Explanations<filename>tabular_experiments.py from sklearn import tree, svm from sklearn.neural_network import MLPClassifier from sklearn.multiclass import OneVsRestClassifier from sklearn.ensemble import GradientBoostingClassifier, RandomForestClassifier, VotingClassif...
StarcoderdataPython
3305553
<gh_stars>1-10 # -*- coding: utf-8 -*- # This plugins is licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php # Authors: <NAME> <<EMAIL>> from gluon import * def multiselect_widget(field, value, **attributes): requires = field.requires if not isinstance(requires, (list, tuple)): ...
StarcoderdataPython
3241074
from ..models import Experiment, Group, Subject import dash import dash_table import dash_html_components as html import dash_core_components as dcc import dash_bootstrap_components as dbc from dash.dependencies import Input, Output, State from dash.dash import no_update from .utils.data_table import DatatableComponent...
StarcoderdataPython
1788045
<reponame>MarcSaric/variant-filtration-tool<filename>gdc_filtration_tools/tools/format_gdc_vcf.py """ This script formats a VCF file header to contain various GDC-specific metadata attributes: * fileDate - the date of the processing * center - The NCI Genomic Data Commons (processing center not sequencing) ...
StarcoderdataPython
1715938
<gh_stars>1-10 import Enum import os import Validate from msvcrt import getch from colorama import init init(convert=True) from colorama import Fore, Back, Style from Enum import StringFore def Clear(): return os.system('cls') def GetInput(): while True: keycode = ord(getch()) if keycode == 13: #E...
StarcoderdataPython
68027
import unittest from synful import synapse class TestSynapse(unittest.TestCase): def test_cluster_synapses(self): syn_1 = synapse.Synapse(id=1, location_pre=(1, 2, 3), location_post=(10, 10, 0), id_segm_pre=1, id_segm_post=10) syn_2 ...
StarcoderdataPython
4806537
class Solution(object): def addToArrayForm(self, num, k): """ :type num: List[int] :type k: int :rtype: List[int] """ # Runtime: 232 ms # Memory: 13.6 MB last = 0 ptr = len(num) - 1 while k != 0 or last != 0: if ptr < 0: ...
StarcoderdataPython
176719
""" This file is part of the Semantic Quality Benchmark for Word Embeddings Tool in Python (SeaQuBe). Copyright (c) 2021 by <NAME> :author: <NAME> """ import copy import time from googletrans import Translator from seaqube.augmentation.base import SingleprocessingAugmentation from seaqube.nlp.tools i...
StarcoderdataPython
1692803
# Copyright (c) 2015, Ecole Polytechnique Federale de Lausanne, Blue Brain Project # All rights reserved. # # This file is part of NeuroM <https://github.com/BlueBrain/NeuroM> # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are ...
StarcoderdataPython
1759311
<filename>src/uwds3_core/underworlds_core.py<gh_stars>1-10 import rospy import numpy as np import sensor_msgs import tf2_ros import math import cv2 import message_filters from cv_bridge import CvBridge import geometry_msgs from tf2_ros import Buffer, TransformListener, TransformBroadcaster from .utils.transformations i...
StarcoderdataPython
131512
<gh_stars>0 from mpi4pyve import MPI import mpiunittest as unittest class BaseTestMessageZero(object): null_b = [None, MPI.INT] null_v = [None, (0, None), MPI.INT] def testPointToPoint(self): comm = self.COMM comm.Sendrecv(sendbuf=self.null_b, dest=comm.rank, recv...
StarcoderdataPython
33200
print("linear search") si=int(input("\nEnter the size:")) data=list() for i in range(0,si): n=int(input()) data.append(n) cot=0 print("\nEnter the number you want to search:") val=int(input()) for i in range(0,len(data)): if(data[i]==val): break; else: cot=co...
StarcoderdataPython
38044
""" Functions for working with tabix dosages in pandas dataframes """ import gzip import numpy as np import pandas as pd import pysam import statsmodels.api as sm class Dosage(object): def __init__(self, dosages, annotations, gene_name): # Match up the annotation dataframe with the dosage dataframe ...
StarcoderdataPython