id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
9692545
# import the necessary packages from tensorflow.keras.utils import to_categorical import numpy as np import h5py class HDF5DatasetGenerator: def __init__(self, dbPath, batchSize, preprocessors=None, aug=None, binarize=True, classes=2): self.batchSize = batchSize self.preprocessors ...
StarcoderdataPython
3512155
<filename>util/visualization.py # -*- coding: utf-8 -*- # Author:sen # Date:2020/3/14 12:30 from torch.utils.tensorboard import SummaryWriter def writer(logs_dir): return SummaryWriter(log_dir=logs_dir, max_queue=5, flush_secs=30)
StarcoderdataPython
4907770
<reponame>felipeescallon/mision_tic_2022<gh_stars>1-10 # -*- coding: utf-8 -*- """ @author: Ing. <NAME> """ import os # Obtiene el Directorio de trabajo actual dta Current Working Directory dta=os.getcwd() # Imprime el Directorio de trabajo actual dta print("El Directorio de Trabajo Actual es :\n {0}".forma...
StarcoderdataPython
4845285
<gh_stars>0 """ ##### Copyright 2021 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
StarcoderdataPython
8188621
<filename>scripts/knp_to_bunsetsu_segmentation_example.py import sys import re def main(knp_dir, filelist_file): files = read(filelist_file) for file in files: write_example(knp_dir + '/' + file) def read(filelist_file): files = [] with open(filelist_file) as f: for line in f: ...
StarcoderdataPython
1789695
from collections import deque from flask import Flask, request as user_req, jsonify from flask_cors import CORS, cross_origin import requests import re import json import time from tornado.wsgi import WSGIContainer from tornado.web import Application, FallbackHandler, RequestHandler from tornado.ioloop import IOLoop fr...
StarcoderdataPython
4806935
<filename>sample/sample.py # Copyright (c) 2016 <NAME>. All rights reserved. # # This program is licensed to you under the Apache License Version 2.0, # and you may not use this file except in compliance with the Apache License Version 2.0. # You may obtain a copy of the Apache License Version 2.0 at http://www.apache....
StarcoderdataPython
325645
<filename>azure_compute/komand_azure_compute/actions/start_vm/schema.py # GENERATED BY KOMAND SDK - DO NOT EDIT import komand import json class Input: RESOURCEGROUP = "resourceGroup" SUBSCRIPTIONID = "subscriptionId" VM = "vm" class Output: STATUS_CODE = "status_code" class StartVmInput(ko...
StarcoderdataPython
303119
# -*- coding: utf-8 -*- from __future__ import print_function # Form implementation generated from reading ui file '.\acq4\modules\Patch\PatchMultiTemplate.ui' # # Created: Thu Jan 15 20:16:09 2015 # by: PyQt4 UI code generator 4.10.4 # # WARNING! All changes made in this file will be lost! from PyQt4 import QtC...
StarcoderdataPython
6643544
<reponame>koolgax99/rake_new2 # Import libraries import string,re from constants import TEST_TEXT from collections import Counter,defaultdict from itertools import groupby,product,chain import nltk from nltk.tokenize import wordpunct_tokenize ''' nltk.download('stopwords') nltk.download('punkt') ''' # the Rake() clas...
StarcoderdataPython
175180
#!/usr/bin/env python from selenium import webdriver import os import time options = webdriver.ChromeOptions() #CHROMEDRIVER_PATH = '/app/.chromedriver/bin/chromedriver' #CHROMEDRIVER_PATH = '/usr/bin/chromedriver' #GOOGLE_CHROME_SHIM = os.getenv('GOOGLE_CHROME_SHIM',"chromedriver") #options.binary_location = '/app...
StarcoderdataPython
11326157
from django.contrib import admin from import_export.admin import ImportExportModelAdmin from import_export import resources # Register your models here. from .models import ( Ticket, TicketPrice, Coupon, TicketSale ) class TicketSaleResource(resources.ModelResource): ticket_type = resources.Field() email ...
StarcoderdataPython
8019075
import sys from utils.utils import get_args, process_config, create_dirs from data_loader.cyclegan_data_loader import CycleGANDataLoader from models.cyclegan_model import CycleGANModel from trainers.cyclegan_trainer import CycleGANModelTrainer def predict(): # get json configuration filepath from the run argument...
StarcoderdataPython
6425704
# Channel specifications #=============================================================================== import numpy as np #------------------------------------------------------------------------------- # Fast Na current # From Traub et al. 1991 J Neurophys #---------------------------------------------------------...
StarcoderdataPython
179082
<reponame>disaisoft/python-course """ Diccionarios en python! => tipo de estructuras de datos que te permite ordenar un conjunto no ordenado de pares clave valor! o en ingles key values """
StarcoderdataPython
1812668
from django.shortcuts import render, HttpResponse from django.views.generic import View from rest_framework.views import APIView from rest_framework.response import Response from .modules.gmail_manager import GUser import re GMAIL_USER = None class GetStarted(View): """ Create a Get Started Page """ ...
StarcoderdataPython
1659991
import parser from models.bandex_classes import MyJsonEncoder import json try: # date_string = date.today().strftime("%y-%m-%d") # start_date cardapios = parser.get_next_cardapios("2016-09-02", 400) except Exception as e: print("Uso do parser falhou: {}".format(e)) print(e.with_traceback()) c...
StarcoderdataPython
3592057
import requests from unittest import TestCase from test_arguments import test_print from test_functions import compare_get_request, compare_post_request class TestTwins(TestCase): def test_twins(self): return # test_print("test_twins starting") # # data = {'id':(None, 'testid1'), # ...
StarcoderdataPython
3560685
#!/usr/bin/env python import click as ck import numpy as np import pandas as pd from collections import Counter from utils import Ontology, FUNC_DICT import logging import json import gzip logging.basicConfig(level=logging.INFO) @ck.command() @ck.option( '--go-file', '-gf', default='data/go.obo', help='Gene ...
StarcoderdataPython
50500
<gh_stars>0 from django.apps import AppConfig class StockDashboardConfig(AppConfig): name = 'stock_dashboard'
StarcoderdataPython
6668544
n, m = input().strip().split(' ') n, m = [int(n), int(m)] c = sorted([int(c_temp) for c_temp in input().strip().split(' ')]) #c = sorted(c) #print (c) if n == m: print (0) else: max_dist = 0 for i in range(m-1): c_dist = (c[i+1] - c[i]) // 2 max_dist = max(max_dist, c_dist) max_dist = ma...
StarcoderdataPython
5100452
# importing database and model from app.py from app import db, Task first_task = Task(task_text = 'lets play with flask') db.session.add(first_task) # how to store in database db.session.commit() # lets run task.py it will add task in databse # how to access the data in database all_tasks = Task.query.all() print(a...
StarcoderdataPython
4999107
# Copyright © 2020-2020 <NAME> 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 ...
StarcoderdataPython
3505999
from importlib import import_module from cognibench.models import CNBModel from cognibench.capabilities import ContinuousAction, ContinuousObservation from cognibench.continuous import ContinuousSpace from cognibench.models.wrappers import ( OctaveWrapperMixin, RWrapperMixin, MatlabWrapperMixin, ) class B...
StarcoderdataPython
202928
import os import sys from setuptools import setup, find_packages py_version = sys.version_info[:2] if py_version < (3, 3): raise Exception("websockets requires Python >= 3.3.") here = os.path.abspath(os.path.dirname(__file__)) NAME = 'creds' with open(os.path.join(here, 'README.rst')) as readme: README = re...
StarcoderdataPython
8172940
from django.views.decorators.csrf import csrf_exempt from django.shortcuts import render, redirect, get_object_or_404, get_list_or_404 from django.contrib.auth.models import User from .models import Inquilino from django.contrib import auth, messages from django.core.paginator import Paginator, EmptyPage, PageNotAnInte...
StarcoderdataPython
5123420
<gh_stars>100-1000 from __future__ import absolute_import, print_function import gensim import numpy from .base_model_output import ModelOutput from ._registry import register from .tests.test_data import test_vectorized_output def _topic_term_to_array(id_term_map, topic): term_scores = {term: float(score) for ...
StarcoderdataPython
3535720
<filename>prize/util/number.py #!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2021/11/20 12:10 下午 # @Author : LeiXueWei # @CSDN/Juejin/Wechat: 雷学委 # @XueWeiTag: CodingDemo # @File : number.py # @Project : prize def padding0(data): """ padding '0' into a number. so given a number=1, then it retur...
StarcoderdataPython
12859658
<filename>WebApp/main/utility/StringUtility.py # Utility functions for Strings (i.e. storing common strings once) #define common strings ERR_MISSING_KEY = "The field(s) {0} must be filled in this form." ERR_INVALID_KEY = "The field '{0}' contains an invalid value." ERR_UNAUTHORIZED = "The logged in user does not have ...
StarcoderdataPython
11350846
# # ImageViewCanvasTypesGtk.py -- drawing classes for ImageViewCanvas widget # # <NAME> (<EMAIL>) # # Copyright (c) <NAME>. All rights reserved. # This is open-source software licensed under a BSD license. # Please see the file LICENSE.txt for details. # All gtk drawing in Ginga is done with cairo from ginga.cairow....
StarcoderdataPython
6433147
<reponame>kfinny/finnpie from setuptools import setup, find_packages setup(name='kfinny.finnpie', version='1', description='A simple library for packaging useful RE functions', url='https://github.com/kfinny/finnpie', author='<NAME>', author_email='<EMAIL>', license='MIT', pac...
StarcoderdataPython
43577
<filename>sdk_samples/scripts/dcgm_example.py<gh_stars>10-100 # Copyright (c) 2021, NVIDIA CORPORATION. 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://ww...
StarcoderdataPython
3243480
<reponame>helpcomputer/megaball import pyxel NUM_COLOURS = 4 DEFAULT = [ pyxel.COLOR_NAVY, pyxel.COLOR_GREEN, pyxel.COLOR_LIME, pyxel.COLOR_WHITE ] RED = [ pyxel.COLOR_PURPLE, pyxel.COLOR_RED, pyxel.COLOR_PINK, pyxel.COLOR_WHITE ] BLUE = [ pyxel.COLOR_NAVY, pyxel.COLOR_DARKBLUE, pyxel.COLOR_CYAN, pyxel.COLOR_WHITE ]...
StarcoderdataPython
8178892
<gh_stars>10-100 from sys import platform if platform == "win32": testing = True else: # print(platform) from gpiozero import Button, LED testing = False import time class SensitivitySelector: def __init__(self, switchDict: dict): self.switchDict = switchDict self.buttonList = [] ...
StarcoderdataPython
4912727
# -*- coding: utf-8 -*- import torch from ..utils import lerp class WGAN_ACGAN(torch.nn.Module): """WGAN + AC-GAN Loss Function Used as a loss function for training generators in GANs Note: References: `WGAN <https://arxiv.org/pdf/1704.00028.pdf>`_, `AC-GAN <https://arxiv.org/pd...
StarcoderdataPython
5131708
<filename>sub-finder.py<gh_stars>0 import requests import sys import resolver import threading import time print(r""" _____ _ ______ _ _ / ____| | | | ____| (_) | | | (___ _ _ | |__ ...
StarcoderdataPython
6512420
from cassandra.cluster import Cluster from cassandra.query import dict_factory from typing import List def create_keyspace(session, keyspace): session.execute(""" CREATE KEYSPACE IF NOT EXISTS """+keyspace+""" WITH replication = { 'class': 'SimpleStrategy', 'replication_factor': '1' } """) def...
StarcoderdataPython
1928517
<reponame>basavarajamogi/Azure_Irrigation_UAV #This file contains constants that are normally found in win32all #But included here to avoid the dependency from __future__ import print_function, unicode_literals, absolute_import VK_LBUTTON=1 VK_RBUTTON=2 VK_CANCEL=3 VK_MBUTTON=4 VK_XBUTTON1=5 VK_XBUTTON2=6 VK_BACK=8 VK...
StarcoderdataPython
8092813
<gh_stars>0 from datetime import date from nose.tools import eq_ from . import (_filter_changelog_files, _parse_changelog_text, _extract_version, _starts_with_ident, _parse_item, _extract_date,) from allmychanges.utils import transform_url, get_markup_type, get_commit_type def test_chan...
StarcoderdataPython
104121
"""Runs an infinite loop to find race conditions in context get_tasklet.""" from google.appengine.ext import testbed from ndb import model from ndb import tasklets def cause_problem(): tb = testbed.Testbed() tb.activate() tb.init_datastore_v3_stub() tb.init_memcache_stub() ctx = tasklets.make_default_cont...
StarcoderdataPython
9607283
import sys import smp_qrc from PyQt5.QtCore import ( QDir, Qt, QUrl, QTime ) from PyQt5.QtGui import ( QIcon, QKeySequence, QPalette, QColor, QCursor, QFontDatabase, QFont ) from PyQt5.QtMultimedia import ( QMediaContent, QMediaPlayer ) from PyQt5.QtMultimediaWidgets...
StarcoderdataPython
9744508
# Import *just* the sqrt function from math on line 3! from math import sqrt
StarcoderdataPython
1815104
#!/usr/bin/env python """Read zip format file from stdin and write new zip to stdout. With the --store option the output will be an uncompressed zip. Uncompressed files are stored more efficiently in Git. https://github.com/costerwi/rezip """ import sys import io from zipfile import * import argparse parser = argpa...
StarcoderdataPython
3469361
<reponame>LunaBestPone/ps5alert import time import random from pywinauto import Application from pywinauto.keyboard import send_keys def main(): app = Application(backend='uia') app.connect(title_re='.*Chrome.*') dlg = app.top_window() while True: time.sleep(random.uniform(3, 5)) ...
StarcoderdataPython
8046162
<gh_stars>1000+ #!/usr/bin/env python2.7 # Copyright 2017 gRPC authors. # # 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 ...
StarcoderdataPython
12842151
<gh_stars>1-10 VERSION = (0, 0, 4) default_app_config = 'iitgauth.apps.IitgauthConfig'
StarcoderdataPython
4829042
<gh_stars>0 from paperplane.cli.parser import cli from paperplane.parser.main import parse_and_execute # noqa: F401 def main(): """Entry point for the application script""" cli()
StarcoderdataPython
9700719
<gh_stars>0 #encoding=utf-8 import cv2 import os import numpy path = "dataset" filenames = os.listdir(path) #得到目录下所有文件 faceSample = [] #样本集合 ids= [] #标签集合 lbpclassifier = cv2.face.createLBPHFaceRecognizer() for file in filenames: #print (file) img = cv2.imread(path+"/"+file,0) img = cv2.resize(i...
StarcoderdataPython
6497774
<filename>recorded_failures/aoc2020/day_24_lobby_layout/stringify_directions_missed_to_handle_empty_directions.py import collections import enum import re from typing import Tuple, List from icontract import require, ensure # crosshair: on class Cell: @require(lambda x, y, z: x + y + z == 0) def __init__(se...
StarcoderdataPython
6583807
<reponame>adriangrepo/segmentl<gh_stars>1-10 import torch from torch import nn from torch.autograd import Variable from torch import einsum import torch.nn.functional as F import numpy as np from ..distribution.distribution_based import CrossentropyND, TopKLoss, WeightedCrossEntropyLoss from ..utils import get_tp_fp_fn...
StarcoderdataPython
12809906
<filename>apps/auth_api/views.py<gh_stars>0 from django.core.files.base import ContentFile from rest_framework.views import APIView from rest_framework import viewsets, status from rest_framework.response import Response from rest_framework.decorators import list_route, detail_route from rest_framework.permissions imp...
StarcoderdataPython
8150268
""" Python Character Mapping Codec generated from '8859-3.TXT' with gencodec.py. Written by <NAME> (<EMAIL>). (c) Copyright CNRI, All Rights Reserved. NO WARRANTY. (c) Copyright 2000 <NAME>. """#" import codecs ### Codec APIs class Codec(codecs.Codec): def encode(self,input,errors='strict'): return ...
StarcoderdataPython
1637865
from pygame import mouse, font, image, transform import util.enums from util.util import ui_cover_up import enums as ui_enums class Drawable(): def isDrawable(self, obj_to_test): """ Checks to see if an object has inherited from Drawable Vars: obj_to_test = object to test...
StarcoderdataPython
1739700
# Title : Print details about today # Author : <NAME>. # Date : 29:10:2020 import datetime import time print(f"Today is : { datetime.datetime.now().strftime('%y/%m/%d')}") print(f"Day : {datetime.date.today().strftime('%A')}") print(f"Name of month : {datetime.date.today().strftime('%B')}") print(f"Day of the year...
StarcoderdataPython
8082886
# GENERATED VERSION FILE # TIME: Wed Mar 18 09:52:48 2020 __version__ = '0.1.rc0+unknown' short_version = '0.1.rc0'
StarcoderdataPython
3531849
<gh_stars>1-10 """ Binds a python executable as a rez package. """ from __future__ import absolute_import from rez.bind._utils import check_version, find_exe, extract_version, \ make_dirs, log, run_python_command from rez.package_maker__ import make_package from rez.system import system from rez.utils.lint_helper i...
StarcoderdataPython
4838192
<reponame>Freestyle-FinTech/robovest import csv import os import numpy as np import matplotlib.pyplot as plt import matplotlib.pylab as pylab import psycopg2 import pandas from pandas_datareader import data from datetime import date, timedelta from numpy.linalg import inv def portfolio(score): #This is for server ...
StarcoderdataPython
5130608
<reponame>PersonMeetup/France2Comms #!/usr/bin/env python import discord from discord.ext import commands from discord_slash import SlashCommand, SlashContext from configparser import ConfigParser import requests import os; import logging import twitter from dotenv import load_dotenv load_dotenv() logging.basicConfig(f...
StarcoderdataPython
5095179
<reponame>Foxgeek36/douyin_spider """ In this module ,you can download videos from music You can choose how many you want,and what media you want download and store. """ from douyin_spider.enter.hot_music import hot_music from douyin_spider.handler.video import VideoHandler from douyin_spider.handler.music import Mu...
StarcoderdataPython
188394
<filename>cloudrail/knowledge/context/azure/network/azure_subnet.py from typing import List, Optional from cloudrail.knowledge.context.azure.azure_resource import AzureResource from cloudrail.knowledge.context.azure.constants.azure_resource_type import AzureResourceType from cloudrail.knowledge.context.azure.network.a...
StarcoderdataPython
6605125
<reponame>zhouhaifeng/vpe #!/usr/bin/env python # # test_ospf_topo1.py # Part of NetDEF Topology Tests # # Copyright (c) 2017 by # Network Device Education Foundation, Inc. ("NetDEF") # # Permission to use, copy, modify, and/or distribute this software # for any purpose with or without fee is hereby granted, provided ...
StarcoderdataPython
8115632
<reponame>hipstas/audio-tagging-toolkit<filename>tests/old_test.py import os def test(): os.chdir('/Users/mclaugh/Dropbox/WGBH_ARLO_Project/audio-tagging-toolkit/') try: os.system('python Diarize.py -b -c -i /Users/mclaugh/Desktop/attktest/Creeley-Robert_33_A-Note_Rockdrill-2.mp3') os.system('python FindApplause...
StarcoderdataPython
5029977
# coding: utf-8 # TODO - add W(p,2) spaces and Sobolev of higher order => needed for high order # derivatives from numpy import unique from sympy.core import Basic from sympy.tensor import Indexed, IndexedBase from sympy.core import Symbol from sympy.core import Expr from sympy.core.containers import Tuple ...
StarcoderdataPython
8168181
<reponame>Cheese229/DataAssignmentCIS<filename>color_change.py """ Code source here: https://stackoverflow.com/questions/40160808/python-turtle-color-change Trying to see how this person uses turtle.stamp to change the color of their turtles I cannot seem to make sense out of it, or at least be able to u...
StarcoderdataPython
3520108
from src.ui import fatal, label from src.temp import temp, clean import src.update as update def task(file): try: update.check() except Exception as e: print(e) pass label("Abriendo archivo...") import os if len(file) < 2: fatal("No se encuentra el archivo") ...
StarcoderdataPython
4952421
<reponame>pbs/m3u8<filename>tests/test_variant_m3u8.py # coding: utf-8 # Copyright 2014 Globo.com Player authors. All rights reserved. # Use of this source code is governed by a MIT License # license that can be found in the LICENSE file. import m3u8, playlists def test_create_a_variant_m3u8_with_two_playlists(): ...
StarcoderdataPython
4868915
<gh_stars>0 from django.urls import path from app4 import views from app4.dateview.addteacher import * from app4.dateview.delteacher import * from app4.dateview.showteacher import * from app4.dateview.updateteacher import * from app4.dateview.getTeachCourse import * from app4.dateview.addTeachCourse import * from app4....
StarcoderdataPython
11208286
<filename>DataEngineering/Chapter8/8.1.4/financialdata/tasks/worker.py<gh_stars>1-10 from celery import Celery from financialdata.config import ( WORKER_ACCOUNT, WORKER_PASSWORD, MESSAGE_QUEUE_HOST, MESSAGE_QUEUE_PORT, ) broker = ( f"pyamqp://{WORKER_ACCOUNT}:{WORKER_PASSWORD}@" f"{MESSAGE_QUEU...
StarcoderdataPython
82642
<gh_stars>1-10 import cv2 import matplotlib.pyplot as plt import numpy as np from skimage.util import img_as_float from fuzzy_clustering.core.fuzzy import FCM from fuzzy_clustering.utils.utils import segment_image def sample_fcm_image(): _, axis = plt.subplots(1,2, figsize= (8,6)) axis = axis.flatten()...
StarcoderdataPython
1609619
<reponame>hwmrocker/pokerhand-eval<filename>setup.py # -*- coding: utf-8 -*- from distutils.core import setup setup( name='pokereval', version='0.1.2', author=u'<NAME>, <NAME>, arlsr, <NAME>', author_email='<EMAIL>', packages=['pokereval'], url='https://github.com/aliang/pokerhand-eval', li...
StarcoderdataPython
5088644
from __future__ import annotations import os import uuid import torch from torch import Tensor import numpy as np import pickle import inspect from kge import Config, Configurable import kge.indexing from kge.indexing import create_default_index_functions from kge.misc import kge_base_dir from typing import Dict, L...
StarcoderdataPython
3425987
<filename>tests/test_task0021.py import pytest from tasks.task0021 import solution @pytest.mark.parametrize( "s, t, result", [ ("anagram", "nagaram", True), ("rat", "car", False), ], ) def test_task0021_solution(s, t, result): assert solution(s, t) == result
StarcoderdataPython
4958079
# Copyright 2017 The Bazel 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 applicable la...
StarcoderdataPython
9791189
# Copyright 2016, 2017, 2018 IBM Corp. # # 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 ...
StarcoderdataPython
11366557
import torch import os import numpy as np import pandas as pd import sys import time import random from src.report.logs import print_and_save_logs from src.report.metrics import Metrics import argparse from torch import optim from torch.nn import functional as F from torch import nn, distributions from pathlib imp...
StarcoderdataPython
1944701
b = "hello" src = get_name() a = src jinja2.Markup(a.getValues())
StarcoderdataPython
3445016
<filename>sdk/python/pulumi_azure_native/solutions/__init__.py # 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! *** from .. import _utilities import typing # Export this package's modules as members: from...
StarcoderdataPython
5189426
print('===== DESAFIO 94 =====') cadastro = [] pessoa = {} somaid = 0 fem = [] acimaid = [] while True: pessoa['nome'] = str(input('Nome: ')) pessoa['sexo'] = str(input('Sexo [M/F]: ')).strip().upper() while pessoa['sexo'] not in 'MF': print('ERRO! Por favor, digite apenas M ou F!') pessoa['s...
StarcoderdataPython
9641321
from utils import * from functools import lru_cache def parse_nums(s): return [int(i) for i in s.strip().split(',')] def part1(values: List[int], DAYS=80) -> int: @lru_cache def dfs(v, d): if d == 0: return 1 return dfs(v-1, d-1) if v else dfs(6, d-1) + dfs(8, d-1) return sum(dfs(v, ...
StarcoderdataPython
11373803
# Definition for singly-linked list. class ListNode: def __init__(self, x): self.val = x self.next = None class Solution: def swapPairs(self, head: ListNode) -> ListNode: if not (head and head.next): return head ans = ListNode(None) pre = ans ...
StarcoderdataPython
5053309
import os import sys from aiohttp import web from mako.template import Template import virtool.utils from virtool.api.response import not_found @web.middleware async def middleware(req, handler): is_api_call = req.path.startswith("/api") try: response = await handler(req) if not is_api_cal...
StarcoderdataPython
384742
#!/usr/bin/env python3 from datamodel_parser.application import Argument from datamodel_parser.application import Store from sdssdb.sqlalchemy.archive.sas import * from json import dumps import time print('Populating filespec table.') arg = Argument('filespec_archive') options = arg.options if arg else None store = ...
StarcoderdataPython
8031162
from datetime import timezone import boto3 import datetime import os DATE_FORMAT = '%Y-%m-%dT%H:%M:%S.%f%z' def get_formatted_date(date_obj: datetime, date_format: str): return date_obj.strftime(date_format) def handler(event, context): """ Function to be invoked by a Cognito Post Confirmation trigger...
StarcoderdataPython
9620680
<filename>calvin/Tools/log_analyze.py #!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c) 2015 Ericsson AB # # 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...
StarcoderdataPython
17503
<gh_stars>1-10 from django.apps import AppConfig class SharingGroupsConfig(AppConfig): name = 'sharing_groups'
StarcoderdataPython
1954404
"""System visualization/animation tool. usage: sysvis [-i <file>] [-o <svg>] sysvis -h | --help Options: -h --help show help -i <file> specify input sysvis file name -o <svg> specify output SVG file name """ from docopt import docopt from sysvis import example from sysvis.parser import parse ...
StarcoderdataPython
3561102
<reponame>gorf/tushare-trader # -*- coding:utf-8 -*- """ 通联数据 Created on 2015/08/24 @author: <NAME> @group : waditu @contact: <EMAIL> """ from io import StringIO import pandas as pd from tushare.util import vars as vs from tushare.util.common import Client from tushare.util import upass as up class Macro(): ...
StarcoderdataPython
3330894
<reponame>peb-adr/openslides-backend from typing import List, Optional, Tuple def calculate_inherited_groups_helper( access_group_ids: Optional[List[int]], parent_is_public: Optional[bool], parent_inherited_access_group_ids: Optional[List[int]], ) -> Tuple[bool, List[int]]: inherited_access_group_ids:...
StarcoderdataPython
3408129
<reponame>seungsoolee0007/MRliverfibrosis import tensorflow as tf import time def _parse_data_infer(image_paths): image_content = tf.read_file(image_paths) images = tf.image.decode_png(image_content, channels=0, dtype=tf.uint16) return images def _normalize_data_infer(image): image = tf.cast(image, ...
StarcoderdataPython
6521934
import ast def as_tree(node, indent=" "): """ Returns an eval-able string representing a node tree. The result is the same as given by `ast.dump()`, except that the elements of the tree are put on separate lines and indented with `indent`s so that the whole tree is more human-readable. """ ...
StarcoderdataPython
5090996
<reponame>abusamrah2005/Python # python Week4 Day25-26 . Challenge of the week4 set1 = {1,3,5,7,8} print(set1) # Add multiple items to my set. set1.update([4,8,12]) print("Add [4,8,12] To My Set : ", set1) # remove an item in my set. set1.remove(8) print("Delete number 8 From My Set : ", set1) # clear items in my set....
StarcoderdataPython
15444
#!/usr/bin/env python # # Copyright 2018-2019 IBM Corp. 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 requ...
StarcoderdataPython
238832
<gh_stars>10-100 import argparse import pkg_resources import re import os import os.path import sys import webbrowser try: raw_input except NameError: raw_input = input YESNO_RE = re.compile(r'^\s*(([Yy](es)?)|([Nn]o?))\s*$') DRINKME_FILE = pkg_resources.resource_filename(__name__, 'shared/drinkme.txt') LOGO_FILE...
StarcoderdataPython
9709221
from nlp_profiler.core import gather_whole_numbers, count_whole_numbers # noqa text_with_a_number = '2833047 people live in this area' def test_given_a_text_with_numbers_when_parsed_then_return_only_the_numbers(): # given expected_results = ['2833047'] # when actual_results = gather_whole_numbers(t...
StarcoderdataPython
11368326
from collections import defaultdict class Info: def __init__(self): self.name = '' self.counter = 0 self.tickets_id = defaultdict(set) self.areas = set()
StarcoderdataPython
6441398
# # @lc app=leetcode id=238 lang=python3 # # [238] Product of Array Except Self # # @lc code=start class Solution: def productExceptSelf(self, nums: List[int]) -> List[int]: result = [] # 왼쪽 곱셈 point = 1 for i in range(len(nums)): result.append(point) point ...
StarcoderdataPython
3575788
import click from typing import IO from stiff.data.fixes import fix_all from stiff.data.constants import DEFAULT_SAMPLE_LINES, DEFAULT_SAMPLE_MAX from stiff.writers import AnnWriter, man_ann_ann from stiff.extract import FinExtractor from stiff.corpus_read import read_opensubtitles2018 from stiff.utils import parse_q...
StarcoderdataPython
373039
class NotInitedException(Exception): """Deprecated! was used to state that the database in the general config was not inited yet""" def __init__(self, *args, **kwargs): Exception.__init__(self, *args, **kwargs) class MissingUserException(Exception): """The requested User could not be found""" ...
StarcoderdataPython
11213930
import torch import torch.nn as nn import numpy as np import os from tqdm import tqdm import h5mapper as h5m # the model we'll be training class Net(nn.Module): def __init__(self): super(Net, self).__init__() self.fc1 = nn.Linear(32, 32) self.fc2 = nn.Linear(32, 32) def forward(self...
StarcoderdataPython
5068463
import unittest import communication_tests import os from time import sleep import threading file_name_to_slave = "signal_to_slave.dat" file_name_from_slave = "signal_from_slave.dat" # map signal - [size, case-Id] # NOTE needs to be consistent with C++ signal_map = { "data_0" : 25, "data_1" : 25, "data_2"...
StarcoderdataPython