id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
5006710
<filename>setup/client/setup.py import os from pyrolysis import client from setuptools import setup, find_packages this_dir = os.path.abspath(os.path.dirname(__file__)) with open(os.path.join(this_dir, 'README.rst'), 'r') as f: long_description = f.read() # More information on properties: https://packaging.pytho...
StarcoderdataPython
3590743
try: from gpio_rpi import * except ImportError: from gpio_test import *
StarcoderdataPython
1911471
<reponame>xmunoz/uwrtourist # -*- coding: utf-8 -*- # ... # available languages LANGUAGES = { 'en': 'English', 'es': 'Español' }
StarcoderdataPython
31381
<reponame>S-c-r-a-t-c-h-y/coding-projects from arbre_binaire import AB def parfait(ngd): """ Fonction qui renvoit un arbre binaire parfait à partir de son parcourt en profondeur préfixe ngd de type str """ cle = ngd[0] ab1 = AB(cle) if len(ngd) > 1: ngd_g = ngd[1 : len(ngd) // 2 + ...
StarcoderdataPython
8045890
<filename>ct-tests/lib/common/bss.py # # MIT License # # (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP # # 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 restrictio...
StarcoderdataPython
4902346
# Copyright 2020 Google 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...
StarcoderdataPython
11307786
<reponame>victorkifer/SocialMediaTopTrends<filename>data_source/__init__.py __author__ = 'viktor'
StarcoderdataPython
1647736
<filename>test_train_cifar.py import test_utils FLAGS = test_utils.parse_common_options( datadir='../cifar-data', batch_size=125, num_epochs=254, momentum=0.9, lr=0.8) import os import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import torch_xla import t...
StarcoderdataPython
6672867
<reponame>JayH5/django-watchman<gh_stars>0 from django.conf.urls import include, url from django.contrib import admin import watchman.views urlpatterns = [ url(r'^admin/', include(admin.site.urls)), url(r'^watchman/', include('watchman.urls')), url(r'^watchman/bare/', watchman.views.bare_status, name='bar...
StarcoderdataPython
8177175
# Copyright (c) 2019 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 appli...
StarcoderdataPython
10669
# imports from telegram.ext import ( CommandHandler, MessageHandler, Filters, ConversationHandler, ) from handler_functions.start import start from handler_functions.bio import bio from handler_functions.gender import gender from handler_functions.photo import photo, skip_photo from handler_functions.lo...
StarcoderdataPython
69162
import pandas as pd import datetime as dt import jpholiday as jh class Tradetime: def __init__(self, time=None): self.set_time(time) def set_time(self, time=None): if time: self.time = time else: self.time = dt.datetime.now().date() if not is_busine...
StarcoderdataPython
4890928
__author__ = '<NAME>' import sys import pygame from pygame.locals import * def main(result_file): pygame.init() winSurfObj =pygame.display.set_mode((800,800)) whiteColor = pygame.Color(255,255,255) blackColor = pygame.Color(0,0,0) greenColor = pygame.Color(128,255,128) pygame.dis...
StarcoderdataPython
6706274
#!/usr/bin/env python3 import vlc, time, random vlc_instance = vlc.Instance() player = vlc_instance.media_player_new() media = vlc_instance.media_new("testSong.wav") player.set_media(media) playState = player.play() if playState != 0: exit(1) while player.is_playing() == 0: pass duration = player.get_length() / 10...
StarcoderdataPython
204845
IMAGES_PATH = 'write_box/images/' FONTS_PATH = 'write_box/fonts/' LOGFILE_PATH = 'log.txt' TOKEN = 'TOKEN'
StarcoderdataPython
150553
# -*- coding: utf-8 -*- from .context import ann import numpy as np from ann import core, helpers import unittest from sklearn.model_selection import train_test_split from sklearn.metrics import classification_report from sklearn import datasets import cv2 class NetworksTestSuiteV2(unittest.TestCase): """Basic t...
StarcoderdataPython
8169848
<filename>apps/aggregate_criteria.py<gh_stars>0 # the purpose of this script is # when a button is clicked # -some set of of criteria are checked # -if they are met # -the entire collection of stores are collected # - from dash import html import dash_bootstrap_components as dbc import dash_core_components as dcc from ...
StarcoderdataPython
8008350
import os import numpy as np import nibabel as nb import pandas as pd import glob from nltools.simulator import Simulator from nltools.data import (Brain_Data, Adjacency, Groupby, Design_Matrix) from nltools.stats import threshold, align from nltoo...
StarcoderdataPython
6542063
import logging as log def f(arg): return "arg" + arg # Function a = "arg_var" log.debug("debug function", "arg1", "arg2", f()) # Nested function a = "arg_var" log.debug("debug nested function", "arg1", "arg2", f(f(f()))) # Multi line a = "arg_var" log.debug("debug multi line", "arg1", "arg2", a) # Mult...
StarcoderdataPython
12814423
<filename>src/ydata_quality/utils/logger.py<gh_stars>100-1000 "Data Quality logger functions" import logging import os import sys from logging import _nameToLevel from typing import TextIO # Default vars for the logger NAME = os.getenv('DQ_LOGGER_NAME', 'DQ_Logger') def get_logger(name, stream: TextIO = sys.stdout, ...
StarcoderdataPython
98973
B77;10003;0c#!python import os, sys, string, time, BaseHTTPServer, getopt, re, subprocess, webbrowser from operator import itemgetter from utils import * from preprocess import Preprocess from assemble import Assemble sys.path.append(INITIAL_UTILS) from ruffus import * _readlibs = [] _skipsteps = [] _settings = Sett...
StarcoderdataPython
4868378
import pytest from liualgotrader.common import assets @pytest.mark.devtest def test_round_asset() -> bool: f = 0.999349343434 print(f, assets.round_asset("BTCUSD", f)) return True
StarcoderdataPython
6535183
import os from httpx import AsyncClient from canvas.files import FileModel, FolderModel class CanvasFileManager: """A file manager""" client: AsyncClient root: FolderModel def __init__(self, client: AsyncClient) -> None: self.client = client def latest_update(self, t = '', count: int = ...
StarcoderdataPython
4804037
<reponame>JustinKuli/adventofcode2020 #!/usr/bin/env python3 data = [] with open('data.txt', 'r') as file: for line in file: data.append(line[:-1]) # Strip the newline char! your_ticket = [79,193,53,97,137,179,131,73,191,139,197,181,67,71,211,199,167,61,59,127] def get_ranges(): ranges = [] for l...
StarcoderdataPython
4887959
from django.db import models from django.contrib import auth class Publisher(models.Model): """A company that publishes books.""" name = models.CharField(max_length=50, help_text="The name of the Publisher.") website = models.URLField(help_text="The publisher's website.") email = models.EmailField(he...
StarcoderdataPython
9767439
from string import Template preamble = '''#include "arm_compute/graph.h" #include "support/ToolchainSupport.h" #include "utils/CommonGraphOptions.h" #include "utils/GraphUtils.h" #include "utils/Utils.h" using namespace arm_compute::utils; using namespace arm_compute::graph::frontend; using namespace arm_compute::gra...
StarcoderdataPython
9722338
<reponame>cdev-framework/cdev-sdk<gh_stars>1-10 # Generated as part of Quick Start project template from cdev.resources.simple.xlambda import simple_function_annotation import aurora_data_api import pandas from .utils import helper_function @simple_function_annotation("hello_world_function") def hello_world(event,...
StarcoderdataPython
3228676
<filename>bch/cli.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import sys import logging import click import click_log import simplejson as json from datetime import datetime import paho.mqtt.client from paho.mqtt.client import topic_matches_sub import bch.node import bch.gateway from bch.mqtt_client im...
StarcoderdataPython
4977850
<reponame>vcyrus/python-workshop<filename>module.py def add(x, y): return x + y print('This is module.py') if __name__ == '__main__': print('Running module.py as main script')
StarcoderdataPython
8163336
<reponame>PaloAltoNetworks/SLI<filename>sli/commands/createTemplate.py from .base import BaseCommand from sli.decorators import require_single_skillet, require_skillet_type from sli.tools import format_xml_string from lxml import etree import re from io import BytesIO class CreateTemplate(BaseCommand): sli_comma...
StarcoderdataPython
4931330
# # provide a pointer to the right settings.py file for # programs that assume it starts in the current directory from htsworkflow.settings import *
StarcoderdataPython
9664224
<filename>src/wagtail_site_inheritance/receivers.py from django.db import transaction from wagtail.core.signals import page_unpublished from wagtail_site_inheritance.models import PageInheritanceItem def remove_copies(sender, instance, **kwargs): """ Remove all published copies when unpublishing a page. ...
StarcoderdataPython
3561902
from django.db import models # Create your models here. class ApplicantLoggedIn(models.Model): username = models.CharField(max_length=70) password = models.CharField(max_length=50) class ApplicantSignedUp(models.Model): username = models.CharField(max_length=70) emailID = models.EmailField(max_leng...
StarcoderdataPython
3259834
#! /usr/bin/python3 # modules additionnels import falcon import psycopg2 class dgac_drone(object): def getDrone(self, req, resp): db = psycopg2.connect("") # connexion à la base PG locale cur = db.cursor() where = '' lat = float(req.params.get('lat', None).replace(',','.')) ...
StarcoderdataPython
9662281
# # This file is part of MicroPython M5Stack package # Copyright (c) 2017-2018 <NAME> # # Licensed under the MIT license: # http://www.opensource.org/licenses/mit-license.php # # Project home: # https://github.com/tuupola/micropython-m5stack # """ M5Stack specific constants and classes. """ # pylint: disable=impo...
StarcoderdataPython
6538586
from django.shortcuts import render # importing http response to create a response. from django.http import HttpResponse # every view method needs to have access to # request and it will be passed using method argument. def index(request): # return a response. return HttpResponse("Hello World!!!")
StarcoderdataPython
294677
# Copyright 2021 <NAME> # Licensed under the MIT license import asyncio import logging import sys import click from jaymap.client import JMAP from jaymap.types.core import Request, Invocation, Capabilities from jaymap.types.mail import Email, MailboxCondition @click.group() @click.pass_context @click.option("--dom...
StarcoderdataPython
4819125
<reponame>Hadisalman/AirSim import copy import json import threading import numpy as np import torch from robustness import airsim from .sim_object import SimObject class AdversarialObjects(SimObject): def __init__(self, name='3DAdversary', car=None, **kwargs): super().__init__(name) assert 'res...
StarcoderdataPython
8169600
# Copyright 2015 <EMAIL> # Copyright 2015-2017 FUJITSU LIMITED # # 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 appli...
StarcoderdataPython
9687088
<gh_stars>0 # -*- encoding: utf-8 -*- """ generic """
StarcoderdataPython
11360510
<reponame>kraushm/hpctools<filename>reframechecks/mpip/mpip.py # Copyright 2019-2020 Swiss National Supercomputing Centre (CSCS/ETH Zurich) # HPCTools Project Developers. See the top-level LICENSE file for details. # # SPDX-License-Identifier: BSD-3-Clause import os import sys import reframe as rfm import reframe.util...
StarcoderdataPython
252763
<filename>Python3/0856-Score-of-Parentheses/soln-1.py<gh_stars>1-10 class Solution: def scoreOfParentheses(self, S): """ :type S: str :rtype: int """ cnt, layer = 0, 0 for a, b in zip(S, S[1:]): layer += (1 if a == '(' else -1) if a + b == '()'...
StarcoderdataPython
1913840
""" Application CLI Commands. This file defines command functions which are invokable as commands from the command line. Additional application-specific commands are encouraged, and may be added with the {{app_name}}.cli.command decorator. """ import logging import os import sys from argparse import REMAINDER from ...
StarcoderdataPython
6487338
#!/usr/bin/env python2.7 # __BEGIN_LICENSE__ # # Copyright 2012 Stanford University. All rights reserved. # # __END_LICENSE__ # calibrate.py # # Usage: calibrate.py <calibration_dir> # # This script re-runs the calibration from a set of calibration images # captured by the uScope GUI. This script is mostly useful f...
StarcoderdataPython
6577182
<gh_stars>1-10 __all__ = ['interpolate', 'polynomial']
StarcoderdataPython
6453938
<filename>aiaia_detector/aiaia_detector/evaluation.py #!/usr/bin/env python # coding: utf-8 #### Citations # # https://github.com/tensorflow/models/tree/master/research/object_detection # "Speed/accuracy trade-offs for modern convolutional object detectors." # <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <N...
StarcoderdataPython
1983996
<filename>explorer/utils/rpc.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Copyright Blaze 2021. Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) """ from typing import Callable, Dict, Op...
StarcoderdataPython
5012027
print('-=-'*20) print('Analizador de Triângulos') print('-=-'*20) r1 = float(input('Digite o 1º segmento: ')) r2 = float(input('Digite o 2º segmento: ')) r3 = float(input('Digite o 3º segmento: ')) if r1 < r2 + r3 and r2 < r1 + r3 and r3 < r1 + r2: print(' Os segmentos {}, {} e {} formam um triangulo.'.format(r1, r...
StarcoderdataPython
3591179
# coding=UTF-8 import tensorflow as tf from google.protobuf import text_format from utils.common_info import CommonInfo class SimpleModel: ''' model info class ''' def __init__(self): self.model_name = '' self.nodes = set() self.inputs = set() self.outputs = set() ...
StarcoderdataPython
6678301
<filename>donor/migrations/0012_auto_20201216_1729.py # Generated by Django 3.1.4 on 2020-12-16 11:44 from django.db import migrations, models import donor.models class Migration(migrations.Migration): dependencies = [ ("donor", "0011_merge_20201216_1728"), ] operations = [ migrations....
StarcoderdataPython
9624484
<filename>python/faceblurer.py import cv2 as cv import numpy as np cam=cv.VideoCapture(0) face=cv.CascadeClassifier("haarcascade_frontalface_default.xml") while True: _,frame=cam.read() frame=cv.flip(frame,1) try: new=face.detectMultiScale(frame) for i in range(len(new)): new1=ne...
StarcoderdataPython
1798569
<gh_stars>1-10 from src.main.managers.game.base_game_manager import BaseGameManager from src.main.managers.conflict.automated_conflict_manager import AutomatedConflictManager from src.main.managers.players.base_player_manager import BasePlayerManager class AutomatedGameManager(BaseGameManager): def _build_player_...
StarcoderdataPython
3207453
# coding=utf-8 from flask import Flask, json, render_template from threading import Thread from flask_socketio import SocketIO from graphqlclient import GraphQLClient import serial, time, serial.tools.list_ports, datetime, socket app = Flask(__name__) app.config['SECRET_KEY'] = 'SECRET!' socketio = SocketIO(app) uuid...
StarcoderdataPython
9670455
<reponame>mcvine/mcvine<gh_stars>1-10 #!/usr/bin/env python # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # # <NAME> # California Institute of Technology # (C) 2007 All Rights Reserved # # {LicenseText} #...
StarcoderdataPython
8166293
<gh_stars>1-10 from sqlalchemy.ext.asyncio import AsyncSession from sqlalchemy import select from sqlalchemy.engine import Result from src.schema import user as user_schema from src.models import model async def create_user(db: AsyncSession, form_data: user_schema.UserCreate) -> model.User: user = model.User(**for...
StarcoderdataPython
1646081
<reponame>almoratalla/mimo-python-projects<gh_stars>0 class Employee: def __init__(self, name, job): self.name = name self.job = job def tasks(self): print("Tasks are:") class Manager(Employee): def __init__(self, name, job, staff): super().__init__(name, job) self....
StarcoderdataPython
107508
<gh_stars>0 import serial import serial.tools.list_ports as spools ports = spools.comports() from flask import Flask,request from flask import render_template, send_from_directory import atexit import time import requests as req from subprocess import call from colorthief import ColorThief import numpy as np import ra...
StarcoderdataPython
8073388
import ast import collections import json import logging from logging.handlers import RotatingFileHandler from os import sys, path from flasgger import Swagger from flask import Flask, request from flask.json import jsonify sys.path.append(path.dirname(path.dirname(path.abspath(__file__)))) from lib.wss.wss import W...
StarcoderdataPython
8127860
from django.core.management.base import BaseCommand from moderation.models import SimpleRight class Command(BaseCommand): """Создание в базе возможных прав для модераторов""" help = 'Creating simple rights for moderators' def create_simple_rights(self): rights = { 0: 'Полные права', ...
StarcoderdataPython
8072552
<filename>privacy_encoder/__init__.py<gh_stars>1-10 from .models import * from . import data from . import callbacks
StarcoderdataPython
1774630
import pytest from dataclasses import dataclass from typing import Optional from gemma import Course, PORT, Item, Fallback, Attr, Call, NullNameError class TestBasicAPI: def test_init_basic(self, course_basic): assert str(course_basic) == "a/b/c/d" def test_repr(self, course_basic): assert r...
StarcoderdataPython
5146584
<gh_stars>0 # Copyright (c) OpenMMLab. All rights reserved. import torch.nn as nn from mmcv.cnn import ConvModule from mmdet.models.builder import HEADS from mmdet.models.utils import build_linear_layer from .atr_head import AttributeHead @HEADS.register_module() class ConvFCAtrHead(AttributeHead): r""" ...
StarcoderdataPython
9738703
<reponame>kuraakhilesh8230/aries-cloudagent-python """Multiple IndyVdrLedger Manager.""" import asyncio import concurrent.futures import logging import json from collections import OrderedDict from typing import Optional, Tuple, Mapping from ...cache.base import BaseCache from ...core.profile import Profile from ...l...
StarcoderdataPython
1926285
import struct from cStringIO import StringIO from unicorn import * from unicorn.arm64_const import * import nxo64 def load_nxo_to_unicorn(uc, f, loadbase): for sym in f.symbols: if sym.shndx: sym.resolved = loadbase + sym.value else: sym.resolved = 0 resultw = StringI...
StarcoderdataPython
1823204
<reponame>felipebarraza6/emprende_escena from .users import User, ProfileUser from .courses import Course, Video, Resource, PreRequisite from .contests import (QuestionCourse, AlternativeQuestion, ResultContest, AnswerQuestion) from .tests import (Test, QuestionTest, AlternativeQuestionTest, AnswerTest, ResultTest)
StarcoderdataPython
178169
<filename>apps/contents/urls.py<gh_stars>0 from rest_framework import routers from .views import * router = routers.DefaultRouter() router.register('contents', ContentsViewSet, basename='contents') urlpatterns = router.urls
StarcoderdataPython
3584515
<reponame>m-wichmann/kodi_addons # -*- coding: utf-8 -*- from resources.lib import plugin plugin.run_video_source()
StarcoderdataPython
313070
<gh_stars>1-10 """ add 2 number """ def add(x, y): return x + y """ substract y from x """ def substract(x, y): return y - x
StarcoderdataPython
208102
<filename>tests/test_tools_pdf2txt.py import os from shutil import rmtree from tempfile import mkdtemp import filecmp import tools.pdf2txt as pdf2txt from helpers import absolute_sample_path from tempfilepath import TemporaryFilePath def run(sample_path, options=None): absolute_path = absolute_sample_path(sample...
StarcoderdataPython
245933
def notas(*num, sit=0): """ :param num: valores de nota :param sit: se True apresenta a situação do boletim se False nao apresenta :return: dicionario um dict() com varias infos das notas """ soma = 0 count = 0 for c in num: soma += c count += 1 media = soma/count ...
StarcoderdataPython
9678068
"""This module provides convenient tools for the communication with Mifare cards via the PN532. Some knowledge of a Mifare card's layout and general access procedure is needed to use this class effectively. Special care needs to be taken when modifying trailer blocks because you may shut yourself out of your car...
StarcoderdataPython
1600830
from __future__ import unicode_literals, absolute_import from datetime import datetime, timedelta from django import forms from django.conf import settings from django.utils.dates import MONTHS from django.core.validators import validate_email from django.core.urlresolvers import resolve, Resolver404 from uwsgiit.api...
StarcoderdataPython
175171
<reponame>ozburo/babushka<gh_stars>1-10 # -*- coding: utf-8 -*- """ example.handlers.py """ from basehandler import BaseHandler from models import Blog, Post import yaml # -------------------------------------------------------------------- # Example Handler # ------------------------------------------------------...
StarcoderdataPython
6497073
# !/usr/bin/env python # -*-coding:utf-8 -*- # PROJECT : web-common-service # Time :2020/12/4 11:09 # Warning:The Hard Way Is Easier import json from flask import g from collections import namedtuple from webAPi.extensions import db from webAPi.models import Column from webAPi.models import BaseModel from webA...
StarcoderdataPython
112422
# create node class class Node: def __init__(self, value=None, next=None): self.value = value self.next = next # create stack class Stack: def __init__(self): self.top = None def isEmpty(self): if self.top == None: return True else: ...
StarcoderdataPython
8026361
from application_form.models.application import ( Applicant, Application, ApplicationApartment, ) from application_form.models.lottery import LotteryEvent, LotteryEventResult from application_form.models.reservation import ( ApartmentQueueChangeEvent, ApartmentReservation, ) __all__ = [ "Applic...
StarcoderdataPython
5118721
<reponame>enuan/duktape-py """ This file represents how to implement an event loop for duktape using asyncio. """ import asyncio from functools import partial import duktape class Timer: def __init__(self, event_loop, callback, delay, oneshot=True): self.event_loop = event_loop self.callback = c...
StarcoderdataPython
1787544
finding_target = 101 finding_numbers = [i for i in range(100)] def is_existing_target_number_sequential(target, array): find_count = 0 for number in array: find_count += 1 if target == number: print(find_count) # 14! return True return False result = is_existing_...
StarcoderdataPython
8119447
""" Tests methods for evaluating model fairness. """ # Author: <NAME> <<EMAIL>> # <NAME> <<EMAIL>> # License: BSD 3 clause import pytest import numpy as np import fatf.fairness.models.measures as ffmm # ACC: 10/19; TPR: (0) 5/9 (2) 1/3; PPV: (0) 5/7 (2) 1/3 CM1 = np.array([[5, 2, 0], [3, 4, 2], [1, 1, 1]]) ...
StarcoderdataPython
169861
# -*- coding: utf-8 -*- # Generated by Django 1.11.7 on 2018-03-06 02:46 from __future__ import unicode_literals import ckeditor.fields from django.db import migrations, models import django.db.models.deletion from newsroomFramework.settings import PROJECT_ROOT import os import ontospy def forwards_func(apps, schema...
StarcoderdataPython
4932561
<reponame>f213/rumetr-client from .item import ApptItem from .pipeline import UploadPipeline from .yandex import YandexFeedSpider __all__ = [ ApptItem, UploadPipeline, YandexFeedSpider, ]
StarcoderdataPython
3407702
import cv2 import numpy as np import matplotlib.pyplot as plt # Gray scale def BGR2GRAY(img): b = img[:, :, 0].copy() g = img[:, :, 1].copy() r = img[:, :, 2].copy() # Gray scale out = 0.2126 * r + 0.7152 * g + 0.0722 * b out = out.astype(np.uint8) return out # Otsu Binalization def otsu_binarization(img, th...
StarcoderdataPython
6659871
<reponame>denilau17/RepSeq import sys import os import csv import sqlite3 import clusteringcore import numpy as np import scipy as sp import scipy.cluster import datetime import multiprocessing as mp import itertools def pdist(X,metric): m = len(X) dm = np.zeros((m * (m - 1) / 2,), dtype=np.double) k = 0...
StarcoderdataPython
4948947
import cv2 import os import numpy as np IMG_WIDTH = 128 IMG_HEIGHT = 128 IMG_CHANNELS = 3 INPUT_PATH = 'dataset/' # define the format types you shall have imgFormatType2WorkWithInput = ('PNG', 'png', 'jpeg', 'jpg') # initialize the variables X_train = [] ImageNamesListTrain = [] Y_train = [] X_val = [] ImageNamesL...
StarcoderdataPython
1629451
<reponame>ISISNeutronMuon/HLM_PV_Import import os import sys # noinspection PyUnresolvedReferences from shared.const import * # About VER = '1.1.4' B_DATE = '6 Jul 2021' ISIS_URL = "https://www.isis.stfc.ac.uk/Pages/home.aspx" if getattr(sys, 'frozen', False): # BASE_PATH = os.path.dirname(sys.executable) # ...
StarcoderdataPython
9697591
<reponame>lancethomps/lt-pylib<filename>ltpylib/dicts.py #!/usr/bin/env python # pylint: disable=C0111 from typing import Any, Callable, Dict, List, Optional, Union from ltpylib import checks, strings def convert_keys_to_snake_case( obj: Union[dict, list], recursive: bool = False, ) -> Union[dict, list]: if is...
StarcoderdataPython
5156301
from gpt2.translation.configuration import TranslationConfig from gpt2.translation.specification import TranslationSpec from gpt2.translation.translation import Translator
StarcoderdataPython
9734805
from __future__ import print_function import os import numpy as np from scipy.misc import imresize from scipy.ndimage import imread from pepper.framework.sensor.face_detect import OpenFace def add_friend_from_directory(directory, name, max_size=1024): # type: (str, str, int) -> None openface = OpenFace() ...
StarcoderdataPython
11295224
from .ge_exception import GeException class GeGeneralServerError(GeException): """Error raised when there is a server error (not 4xx http code)""" pass
StarcoderdataPython
3510959
<reponame>cv4ppl/face-checkin<gh_stars>1-10 import numpy as np class Utils: @staticmethod def im2vec(shape, img): h, w = shape vec = np.empty((w * h)) for i in range(h): for j in range(w): vec[i * w + j] = img[i][j] return vec, (h, w) @staticm...
StarcoderdataPython
11351945
""" All nuitka functions associated for TA """ import os import sys from setuptools import find_packages from pkgutil import iter_modules import dataclasses as dc import importlib import pathlib import re PACKAGES_DIRS = [ os.getcwd(), '/opt/venvdm/lib64/python3.8/site-packages/', '/opt/venvdm/src', '/usr/lib/...
StarcoderdataPython
12830451
<reponame>jeremyschlatter/vaccine-feed-ingest #!/usr/bin/env python import json import pathlib import sys import requests output_dir = pathlib.Path(sys.argv[1]) output_file = output_dir / "nv.json" with output_file.open("w") as fout: r = requests.post( "https://www.immunizenevada.org/views/ajax", ...
StarcoderdataPython
5043841
<reponame>orabhan/twip from __future__ import unicode_literals import pandas as pd def try_int(s): try: return int(s) except: return None def try_encode(s): try: return s.encode('utf-8') except: return None def try_decode(s): try: return s.decode('utf-8...
StarcoderdataPython
8058439
<filename>testData/search/grandChildFieldWithPythonClass.py from pydantic import BaseModel, validator class A(BaseModel): pass class B(A): pass class D: pass class C(B, D): ab<caret>c: str A(abc='cde') B(abc='cde') C(abc='cde') ## count: 0
StarcoderdataPython
8066531
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from re import finditer def convert(df): """Turns original binary values to 0/1""" replace = {'No': 0, 'Yes': 1} replace2 = {'Male': 0, 'Female': 1} bool_col = ['SeniorCitizen', 'Partner', 'Dependents', 'PhoneS...
StarcoderdataPython
3475248
# Generated by Django 3.1 on 2021-07-11 08:51 from django.db import models from django.db import migrations import api.models class Migration(migrations.Migration): initial = True dependencies = [] operations = [ migrations.CreateModel( name="Vector", fields=[ ...
StarcoderdataPython
3352333
<gh_stars>1-10 from dataclasses import dataclass, field from enum import Enum from typing import Optional __NAMESPACE__ = "NISTSchema-SV-IV-list-token-enumeration-1-NS" class NistschemaSvIvListTokenEnumeration1Type(Enum): THE_RESIDES_EARLY_OF_DATA_UNAMBIGUOUS = ( "the", "resides", ...
StarcoderdataPython
12809885
<reponame>borntyping/python-infix #!/usr/bin/env python from setuptools import setup setup( name = 'infix', version = '1.2', license = 'MIT License', url = 'https://github.com/borntyping/python-infix', author = '<NAME>', author_email = ...
StarcoderdataPython
5192721
import http.server import random import socketserver PORT = 8000 class ServerHandler(http.server.BaseHTTPRequestHandler): def do_PUT(self): body = random.choices( population=['accepted\n', 'invalid\n', 'too old', 'is not available'], weights=(1, 0.1), k=1 )[0] ...
StarcoderdataPython
4959782
from .annota_vo import AnnotaVO from .dataset_entry_vo import DatasetEntryVO from .dataset_vo import DatasetVO from .hub_model_vo import HubModelVO from .hub_vo import HubVO from .label_vo import LabelVO
StarcoderdataPython