id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
3439381
<gh_stars>1-10 from decouple import config MYEMS_SYSTEM_DB_HOST = config('MYEMS_SYSTEM_DB_HOST', default='127.0.0.1') MYEMS_SYSTEM_DB_PORT = config('MYEMS_SYSTEM_DB_PORT', default=3306, cast=int) MYEMS_SYSTEM_DB_DATABASE = config('MYEMS_SYSTEM_DB_DATABASE', default='myems_system_db') MYEMS_SYSTEM_DB_USER = config('MY...
StarcoderdataPython
1864199
<filename>kubernetes/kserve/kf_request_json/v2/bert/Transformer_kserve_handler.py import torch import logging from Transformer_handler_generalized import ( TransformersSeqClassifierHandler, captum_sequence_forward, construct_input_ref, summarize_attributions, get_word_token, ) import json from captu...
StarcoderdataPython
33615
from models.lenet import * from models.wresnet import * import os def select_model(dataset, model_name, pretrained=False, pretrained_models_path=None): if dataset in ['SVHN', 'CIFAR10', 'CINIC10', 'CIFAR100']: n_classes = 100 if dataset == 'CIFAR100' else...
StarcoderdataPython
5165349
<gh_stars>100-1000 from rest_framework import serializers from .models import Proposal, ProposalSection, ProposalType class ProposalSerializer(serializers.HyperlinkedModelSerializer): section = serializers.SerializerMethodField() type = serializers.SerializerMethodField() author = serializers.SerializerM...
StarcoderdataPython
5031581
<reponame>joeltio/np-train from django.db import models class Order(models.Model): # A train location, e.g. Bishan destination = models.TextField() # PositiveSmallIntegerField accepts [0, 32767] color = models.PositiveSmallIntegerField() # SmallIntegerField accepts [-32768, 32767] status = mod...
StarcoderdataPython
1830357
def bold(text): return f'<b>{text}</b>' def italicize(text): return f'<i>{text}</i>' def normalize(text): return text.replace('_', ' ').title() def capitalize(text): return ' '.join(list(map(lambda t: t.capitalize(), text.split())))
StarcoderdataPython
1822050
<reponame>aiforrural/Digital-Events-Example # This file is part of Indico. # Copyright (C) 2002 - 2020 CERN # # Indico is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see the # LICENSE file for more details. # TODO: Move this whole package into a standalone pypi package...
StarcoderdataPython
9607358
<reponame>bidhata/EquationGroupLeaks # uncompyle6 version 2.9.10 # Python bytecode 2.7 (62211) # Decompiled from: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10) # [GCC 6.2.0 20161005] # Embedded file name: type_Result.py from types import * MSG_KEY_RESULT_STATUS = 196608 MSG_KEY_RESULT_STATUS_TYPE = 196609 MSG_KEY_RE...
StarcoderdataPython
5099205
from django.contrib.auth import get_user_model from django.contrib.sites.models import Site from django.core.exceptions import ValidationError from django.utils.translation import ugettext_lazy as _ from konkourse import settings from change_email.models import EmailChange class EmailNotUsedValidator(object): "...
StarcoderdataPython
4977135
# -*- coding: utf-8 -*- """ Created on Fri Apr 23 17:18:27 2021 @author: <NAME> """ from .specification import Specification import sympy as sp class RWS(Specification): """Reach-while-stay specification. Represents the RWS specification and implements the corresponding fitness function and verificatio...
StarcoderdataPython
8057696
<filename>osr2mp4/ImageProcess/Objects/Components/Playfield.py from PIL import Image FORMAT = ".png" class Playfield: def __init__(self, filename, width, height): self.img = Image.open(filename + FORMAT) self.img.resize(width, height) def add_to_frame(self, background): # y1, y2 = 0, background.shape[0] #...
StarcoderdataPython
6682890
<reponame>wep21/jetson-containers print('testing numba...') import math import numba from numba import vectorize, cuda import numpy as np print('numba version: ' + str(numba.__version__)) print('testing cuda ufunc...') @vectorize(['float32(float32, float32, float32)', 'float64(float64, float64...
StarcoderdataPython
3355885
#!/usr/bin/env python # coding=utf-8 from tornado import gen from tornado.ioloop import IOLoop from tornado.locks import Condition condition = Condition() @gen.coroutine def waiter(): print 'wait here' yield condition.wait() print 'done waiting' @gen.coroutine def notifier(): print 'ready notify' ...
StarcoderdataPython
9645931
<gh_stars>0 # -*- coding: utf-8 -*- import base64 import os import random import string import requests from kubernetes import client, config from src import KIBANA_HOST, KIBANA_USERNAME, KIBANA_PASSWORD, LOAD_KUBECONFIG, LOAD_INCLUSTER_CONFIG, \ ELASTICSEARCH_HOST, DOMAIN, ES_VERSION from src.loggings.logger imp...
StarcoderdataPython
5059838
<gh_stars>1-10 import numpy as np from text import colour_text import sympy def getLinearlyIndependentCoeffs(expr): def getCoefficient(e): return e.as_independent(*e.free_symbols, as_Add=False) if type(expr) == sympy.Add: result = [] for term in expr.as_terms()[0]: result.append(getCoefficient(term[0])) ...
StarcoderdataPython
8155296
<reponame>frommwonderland/pytorch_connectomics from typing import Optional, List import numpy as np import torch import torch.utils.data from .dataset_volume import VolumeDataset from ..augmentation import Compose from ..utils import * TARGET_OPT_TYPE = List[str] WEIGHT_OPT_TYPE = List[List[str]] AUGMENTOR_TYPE = Opt...
StarcoderdataPython
8114299
<reponame>EdwaRen/Competitve-Programming class Solution: def spiralOrder(self, matrix): res = [] m = len(matrix) if m == 0: return res n = len(matrix[0]) r1 = 0 r2 = n-1 c1 = 0 c2 = m-1 i = 0 j = 0 while len(res) < m...
StarcoderdataPython
6421029
#!/usr/bin/env python import numpy as np import pandas as pd import timeit def inv_mat(n): '''Inverse une matrice carrée aléatoire de taille n''' np.random.seed(0) # O(1) matrice = np.random.rand(n, n) # O(n^2) return np.linalg.inv(matrice) # O(n^3) ? def main(): # Différentes tai...
StarcoderdataPython
9679858
<gh_stars>10-100 import numpy as np import os import shutil import yaml from typing import Union, List, Dict from rich.console import Console from .utils import ( write_to_hdf5, load_config, print_welcome, print_startup, print_update, print_reload, print_storage, ) from .save import StatsLog...
StarcoderdataPython
3495386
import sys import logging from rez.vendor import colorama from rez.config import config from rez.utils.platform_ import platform_ _initialised = False def _init_colorama(): global _initialised if not _initialised: colorama.init() _initialised = True def stream_is_tty(stream): """Return...
StarcoderdataPython
3201366
from django.contrib import admin from .models import SbAdmins, SbServers, SbProtests admin.site.register(SbAdmins) admin.site.register(SbServers) admin.site.register(SbProtests)
StarcoderdataPython
12800437
<filename>script.py #!/usr/bin/env python # -*- coding: utf-8 -*- __license__ = """\ Copyright (c) 2014 <NAME> <<EMAIL>> Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission not...
StarcoderdataPython
6633856
# -*- coding: utf-8 -*- # vim: sw=4 ts=4 fenc=utf-8 # ============================================================================= # $Id: accounts.py 139 2008-01-30 18:16:06Z s0undt3ch $ # ============================================================================= # $URL: http://ispmanccp.ufsoft.org/svn/...
StarcoderdataPython
6674577
from behaviors.behaviors import Timestamped from django.contrib.contenttypes.models import ContentType from django.db import models __all__ = [ 'models', 'DefaultModel', 'TimestampedModel', ] class DefaultModel(models.Model): class Meta: abstract = True def __str__(self) -> str: ...
StarcoderdataPython
9665261
<filename>test/e2e/service_bootstrap.py # Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You may # not use this file except in compliance with the License. A copy of the # License is located at # # http://aws.amazon.com/apache2.0/ #...
StarcoderdataPython
9614392
<reponame>stevenc987/sbc-auth # Copyright © 2019 Province of British Columbia # # 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 req...
StarcoderdataPython
1722053
from datetime import date from rest_framework import status from apps.api.tests.base import ApiTest class DynamicsUserApiTest(ApiTest): def test_read(self): usd = self.create_currency("usd") eur = self.create_currency("eur") ai95 = self.create_fuel("95") at = date(year=2019, mont...
StarcoderdataPython
8176442
# -*- coding: utf-8 -*- # Copyright 2020 The PsiZ 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 r...
StarcoderdataPython
3233026
import random import json import nltk import torch import transformers from gtts import gTTS import speech_recognition as sr import os import playsound import config import pyjokes from nltk.stem.porter import PorterStemmer import numpy as np from torch.utils.data import Dataset, DataLoader import torch.nn as nn clas...
StarcoderdataPython
4895067
<reponame>dbluhm/aries-staticagent-python """Cron script example. This file is intended to be run as a cron script. Upon execution, it does it's thing and shuts down. """ from aries_staticagent import Connection, utils from common import config def main(): """Send message from cron job.""" keys, target, _a...
StarcoderdataPython
1815715
<reponame>koatse/heroku_helloworld # -*- coding: utf-8 -*- # Generated by Django 1.10.4 on 2017-04-01 16:49 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ('citi...
StarcoderdataPython
6547145
<filename>sampledb/scripts/run.py # coding: utf-8 """ Script for running the SampleDB server. Usage: python -m sampledb run [<port>] """ import sys import cherrypy from .. import create_app def main(arguments): if len(arguments) > 1: print(__doc__) exit(1) if arguments: port = argum...
StarcoderdataPython
3599342
<reponame>sourcery-ai-bot/APRManager import json import os class Utils: @staticmethod def validate_json(path_to_json): if ( os.path.isfile(path_to_json) and os.path.getsize(path_to_json) == 0 or not os.path.isfile(path_to_json) ): with open(path...
StarcoderdataPython
6670557
from .event_logger import EventLogger # noqa: F401
StarcoderdataPython
9709862
<reponame>FDUJiaG/PyML-Course from sklearn.datasets import fetch_20newsgroups # 导入新闻数据抓取器 fetch_20newsgroups from sklearn.model_selection import train_test_split from sklearn.feature_extraction.text import CountVectorizer # 导入文本特征向量化模块 from sklearn.naive_bayes import MultinomialNB # 导入朴素贝叶斯模型 from sklearn.me...
StarcoderdataPython
381612
from evdev import InputDevice, list_devices, ecodes import robot def store_x(value): current_x = value; def store_y(value): current_y = value; def limit_value(value): if value > 100: value = 100 elif value < -100: value = -100 return value def update_motor_powers(): power_l...
StarcoderdataPython
11318154
"""This module contains functions to help manage configuration for the offline analysis of LSST Electrical-Optical testing""" import os import numpy as np CONFIG_DIR = None def is_none(val): """Check to see if a value is none""" return val in [None, 'none', 'None', np.nan] def is_not_none(val): """Check...
StarcoderdataPython
11240526
""" Command-line entry point. """ from __future__ import print_function from __future__ import unicode_literals import argparse import logging import sys import os from chromalog import basicConfig from .configuration import load_from_file from .log import logger from .displays import StreamDisplay from .compat imp...
StarcoderdataPython
3261640
from SimpleGraphics import* from math import* import random background("deep sky blue") side=500 a2=100 a1=500 b,c,d=a1-side/2,a1+side/2,a2+side*(sqrt(3)/2) setFill("pink") vertex1=(a1,a2) vertex2=(b,d) vertex3=(c,d) print(vertex1,vertex2,vertex3) polygon(vertex1[0],vertex1[1],vertex2[0],vertex2[1],v...
StarcoderdataPython
127483
fileChange = open("gwsf/hasOpened.gwsf", "w") fileChange.write("1") fileChange.close()
StarcoderdataPython
3561681
"""Define sparse embedding and optimizer.""" from .. import backend as F from .. import utils from .dist_tensor import DistTensor class DistEmbedding: '''Distributed embeddings. DGL provides a distributed embedding to support models that require learnable embeddings. DGL's distributed embeddings are main...
StarcoderdataPython
259153
import os import click from werkzeug.serving import run_simple def make_app(): """Helper function that creates a plnt app.""" from plnt import Plnt database_uri = os.environ.get("PLNT_DATABASE_URI") app = Plnt(database_uri or "sqlite:////tmp/plnt.db") app.bind_to_context() return app @clic...
StarcoderdataPython
6423521
<reponame>Zakovskiy/lwaf.py<gh_stars>1-10 class Account: def __init__ (self, data: dir): self.json = data self.user_id = data["uid"] self.nickname = data["n"] self.lvl = data["l"] self.balance = data["b"] self.likes = data["li"] self.dislikes = data["di"] ...
StarcoderdataPython
9671109
<gh_stars>1-10 from packages.components.status import status_props, default_status from packages.modules.crud_sqlite import crud_driver from packages.modules.db_templates_manager import connect_toDB, statusDB_name def status_loader_routine(self): print('loading previous status....') try: connect_toDB(...
StarcoderdataPython
1819293
<gh_stars>0 #For a detailed explanation of this code please refer to page 43 of the Final Year Project Manual import csv import psycopg2 import json print('opening connection to psql database') conn = psycopg2.connect("host = 'localhost' port='5432' dbname='stack' user='root' password='<PASSWORD>'") cur = conn.cursor...
StarcoderdataPython
5049766
#!/usr/bin/env python #coding:utf-8 # with_example01.py class Sample: def __enter__(self): print "In __enter__()" return "Foo" def __exit__(self, type, value, trace): print "In __exit__()" def get_sample(): return Sample() with get_sample() as sample: print "sam...
StarcoderdataPython
1617890
<gh_stars>10-100 import os import sys import pickle import argparse import time from torch import optim from torch.utils.tensorboard import SummaryWriter sys.path.append(os.getcwd()) from utils import * from motion_pred.utils.config import Config from motion_pred.utils.dataset_h36m_multimodal import DatasetH36M from m...
StarcoderdataPython
168648
<filename>python/ql/test/library-tests/frameworks/fastapi/router.py # like blueprints in Flask # see https://fastapi.tiangolo.com/tutorial/bigger-applications/ # see basic.py for instructions for how to run this code. from fastapi import APIRouter, FastAPI inner_router = APIRouter() @inner_router.get("/foo") # $ ro...
StarcoderdataPython
11308303
""" File input/output functions. This module provides functions for file input and output of data related to single-molecule localization microscopy. Submodules: ----------- .. autosummary:: :toctree: ./ locdata """ from .locdata import * __all__ = [] __all__.extend(locdata.__all__)
StarcoderdataPython
3325550
from rest_framework.pagination import PageNumberPagination class CustomPageNumberPagination(PageNumberPagination): page_size = 1 max_page_size = 1
StarcoderdataPython
1965585
<reponame>Shivanjain023/django-brambling import urllib from django.conf import settings from django.core.urlresolvers import reverse from brambling.payment.core import LIVE from brambling.payment.stripe.core import stripe_prep def stripe_organization_oauth_url(organization, api_type, request): stripe_prep(api_t...
StarcoderdataPython
331160
<gh_stars>0 import math import numpy as np # import sys # sys.path.append(".") from visualization.panda import world as wd from modeling import geometric_model as gm from modeling import collision_model as cm from robot_sim.robots.fr5 import fr5 as fr5 from motion.probabilistic import rrt_connect as rrtc from basis imp...
StarcoderdataPython
87211
<filename>tests/query_test/test_decimal_casting.py # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache Li...
StarcoderdataPython
1727251
<reponame>eternal-flame-AD/px_helper import argparse import re from . import config from .parser import parse_pixiv from .pxelem import PixivUrl from .login import login from . import imgfilter def main(): parser = argparse.ArgumentParser(description="Pixiv downloader") parser.add_argument( "url", ...
StarcoderdataPython
47562
<reponame>AlexisNava/ABitly-Services import pytest from flask import json # Flask App from abitly import create_app @pytest.fixture def app(): app = create_app() return app def test_create_link_should_responds_created(client): """Should responds Created when makes a request with a valid request bo...
StarcoderdataPython
6421375
# Copyright (c) 2015 <NAME> # Written by <NAME> <<EMAIL>> # See LICENSE file. from . import namespace class AttrDict(namespace.SettableHierarchialNS): """Allow access to dictionary via attributes as well as array-style references.""" _notpresent = object() def __init__(self, base=None): ...
StarcoderdataPython
3287348
<reponame>davguez/date_guesser from datetime import datetime from bs4 import BeautifulSoup import pytz from date_guesser import DateGuesser, guess_date from date_guesser.constants import Accuracy, NO_METHOD def test_guess_date(): # Just making sure it works url = 'https://www.nytimes.com/opinion/catalonia-s...
StarcoderdataPython
3305928
<filename>src/evaluating_rewards/envs/mujoco.py # Copyright 2019 DeepMind Technologies 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/LI...
StarcoderdataPython
8052687
<filename>src/cloud/clouds.py from __future__ import annotations import csv import re from enum import Enum from functools import total_ordering import geopy.distance from util.utils import gcp_default_project basename_key_for_aws_ssh = "cloud-perf" class Cloud(Enum): GCP = "GCP" AWS = "AWS" def __st...
StarcoderdataPython
377822
<reponame>tomtylor/ableton-live-packs import requests import re import os import urllib.request import getpass import pprint import logging from clint.textui import progress from hurry.filesize import size # Config debug = 1 pp = pprint.PrettyPrinter(indent=4) logging.basicConfig(level=logging.DEBUG) # Change to your...
StarcoderdataPython
3418863
#!/usr/local/bin/python # coding:utf-8 import os import re import math def get_name(filename): name_list = os.listdir(filename) return name_list def writefile(data): log = open("./trainingname.txt", 'a') log.write(data) log.write('\n') log.close() name_list = get_name("./training") for name in name_list: if ...
StarcoderdataPython
8086563
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'Ui_chicken.ui' # # Created by: PyQt5 UI code generator 5.12.3 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_MainWindow(object): def setupUi(self, MainWindow): Mai...
StarcoderdataPython
1871141
import typing as t from ._transpiler import TranspileOptions, transpile_to_ast def execute( code: t.Union[str, t.TextIO], filename: t.Optional[str], globals: t.Dict[str, t.Any], locals: t.Optional[t.Mapping[str, t.Any]] = None, options: t.Optional[TranspileOptions] = None, ) -> None: """ Exec...
StarcoderdataPython
11307316
# _*_coding:utf-8_*_ class Solution: def MoreThanHalfNum_Solution(self, numbers): total = dict() target = len(numbers) / 2 for item in numbers: total[item] = total.get(item, 0) + 1 for k, v in total.items(): if v > target: return k ...
StarcoderdataPython
5052301
# -*- coding:utf-8 -*- ''' Testing for map app. ''' from torcms.core import tools from torcms.model.post_model import MPost class TestApp(): ''' Testing for map app. ''' def setup(self): print('setup 方法执行于本类中每条用例之前') self.title = '哈哈sdfsdf' self.uid = 'g' + tools.get_uu4d() ...
StarcoderdataPython
6693840
<gh_stars>0 import os from pip._vendor.colorama import Fore, Back from ws.RLUtils.monitoring.tracing.log_mgt import log_mgt if __name__ == '__main__': cwd = os.path.curdir acwd = os.path.join(cwd, '_tests') log_dir = os.path.join(acwd, "logs") fn_log2 = log_mgt(log_dir, show_debug=True, fixed_log_f...
StarcoderdataPython
1920237
<filename>problem/baseproblem.py # flake8: noqa: F403 from firedrake import * from firedrake.utils import cached_property from abc import ABCMeta, abstractproperty, abstractmethod from firedrake.petsc import PETSc class Problem(object): __metaclass__ = ABCMeta def __init__(self, N=None, degree=None, dimensio...
StarcoderdataPython
124611
<filename>Route_prediction/error.py from theano import tensor import theano import numpy def const(v): if theano.config.floatX == 'float32': return numpy.float32(v) else: return numpy.float64(v) rearth = const(6371) deg2rad = const(3.141592653589793 / 180) def hdist(a, b): lat1 = a[:, 0] ...
StarcoderdataPython
3263979
<gh_stars>1-10 import pytest from reserva.core.models import User @pytest.mark.django_db def test_user_name(): user = User.objects.create_user("joanedoe", first_name="Joane", last_name="Doe") assert user.name == "<NAME>" assert str(user) == user.name @pytest.mark.django_db def test_user_without_name():...
StarcoderdataPython
1758103
<reponame>OSMadmin/osmclient # Copyright 2018 Telefonica # # 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...
StarcoderdataPython
1839664
from .FlowNetS import * from .FlowNetC import *
StarcoderdataPython
5178466
<reponame>nano-db/NanoCube<gh_stars>1-10 import csv import datetime import os from server.nanocube import NanoCube samples = dict( simple=dict( path=os.path.dirname(__file__) + "/samples/simple_cube.csv", schema=["Devise"], loc_granularity=2 ) ) def mock_cube(name="simple"): par...
StarcoderdataPython
1901621
<gh_stars>0 import fcntl import select import time from pygdbmi import gdbmiparser import os DEFAULT_GDB_TIMEOUT_SEC = 1 DEFAULT_TIME_TO_CHECK_FOR_ADDITIONAL_OUTPUT_SEC = 1 class GdbTimeoutError(ValueError): pass class IoManager: def __init__( self, stdin, stdout, stderr, ...
StarcoderdataPython
4886742
import socket,time,math class pyMultiWii: def __init__(self,TCP_IP, TCP_PORT,debug=False): self.TCP_IP=TCP_IP self.TCP_PORT=TCP_PORT self.BUFFER_SIZE = 1024 self.debug=debug self.mySocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.mySocket.connect((...
StarcoderdataPython
1778009
import torch.nn.utils.clip_grad as clip from torch.optim.optimizer import Optimizer from torch.optim.lr_scheduler import _LRScheduler class SchedulerOptimizer(): def __init__(self, optimizer, scheduler, gradclip): assert(isinstance(optimizer, Optimizer)) self.optimizer = optimizer self.sche...
StarcoderdataPython
3426392
<filename>downloader.py import aiohttp from aiohttp_retry import RetryClient import asyncio import os import re import heapq from datetime import datetime, timedelta import logging MAX_FILE_NAME_LEN = 250 ONE_SEC = timedelta(seconds=1) class DefaultArgs: qps = 100 downloader_cache_dir = 'cache' class Downloa...
StarcoderdataPython
3590832
<gh_stars>1-10 #!/usr/bin/env python3 import os import argparse import gatenlphiltlab import hiltnlp import Levenshtein #TODO : integrate this into hiltnlp/reorganize def is_participant_speech(turn): ratio = Levenshtein.ratio(turn.speaker, "Participant") return ratio > 0.75 def is_therapist_speech(turn): ...
StarcoderdataPython
6688491
def insetion_sort(L): n = len(L) for i in range(1,n): # I will find the interval in which I need # to shift and then I will do right rotation # I guess if I ignored all python boilerplate # It is a tad efficient firstElement = i-1 while firstElement>=0 and L[first...
StarcoderdataPython
12817458
<filename>back-end/f1hub/constructorstandings/apps.py from django.apps import AppConfig class ConstructorstandingsConfig(AppConfig): name = 'constructorstandings'
StarcoderdataPython
6615913
<reponame>lizawood/Apple-Health-Fitness-Tracker class Person: def __init__(self, name, age, gender): """Create a object of class Person() Parameters: name, age, gender Return: An object of class Person""" # assign the name, age, and gender to the class object in in...
StarcoderdataPython
8020806
<reponame>rasmusskovbo/fantasy-football-data-analysis import pandas as pd import math import statsmodels.formula.api as smf from os import path DATA_DIR = '/Users/nathan/fantasybook/data' ##################### # logistic regression ##################### # load df = pd.read_csv(path.join(DATA_DIR, 'play_data_sample.c...
StarcoderdataPython
122288
from PyQt5.QtCore import Qt from PyQt5.QtGui import QPixmap from PyQt5.QtWidgets import QGraphicsPixmapItem from client.constants import IMAGES_DIR from client.models.abstract.info_scene import InfoScene from client.models.enums.button_state import ButtonState from client.models.menu_objects.button import Button from c...
StarcoderdataPython
4877598
<gh_stars>0 #Generator with while loop def range_generator(a, b): while a < b: yield a a = a+1 seq = range_generator(1,5) print(next(seq)) print(next(seq)) print() #Geenerator usage using a for loop def range_with_for_loop_usage(a,b): while a < b: yield a a = a+1 #use the gene...
StarcoderdataPython
5037351
from pathlib import Path from textwrap import wrap from typing import NamedTuple from aiodns.error import DNSError # to generate public and private keys # openssl genrsa -out private.pem 4096 # openssl rsa -in private.pem -pubout > public.pem from em2.protocol.dns import DNSResolver KEY_DIR = (Path(__file__).parent ...
StarcoderdataPython
12830941
import torch def segment_index_add_python(values, scopes, indices, out=None): if out is None: out = values.new_zeros([scopes.shape[0]] + list(values.shape[1:])) scopes = scopes.long() values_dup = values.index_select(0, indices) idx_global = torch.repeat_interleave(scopes[:, 1]) out.inde...
StarcoderdataPython
6426781
<filename>wavesim/App.py<gh_stars>0 # -*- coding: utf-8 -*- from pyio.DataSturucture import Plugin from pyio.Main import main from wavesim.Window import Window class App(Plugin): def __init__(self): super().__init__() self.window = None def init(self, data): self.data = data s...
StarcoderdataPython
3321168
<reponame>shannenye/saleor from collections import defaultdict import graphene from ....shipping.error_codes import ShippingErrorCode from ..mutations import BaseChannelListingMutation def test_validate_duplicated_channel_ids(channel_PLN, channel_USD): # given channel_id = graphene.Node.to_global_id("Channe...
StarcoderdataPython
8185959
<filename>1.3/logistic-regression.py import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' # Suppress warning that it can't use CUDA import tensorflow as tf import pandas as pd import numpy as np import time from sklearn.datasets import load_iris from sklearn.model_selection import train_test_split import matplotlib.p...
StarcoderdataPython
11364762
from django.urls import path from . import views urlpatterns = [ path('', views.index, name='index'), path('addbook', views.addbook, name='addbook'), ]
StarcoderdataPython
1930901
""" This module extracts syntactic features. """ import subprocess import os import re import nltk.tree from utils import file_utils from utils.lexicosyntactic import yngve def get_lu_complexity_features(lu_analyzer_path, transcript_filepath, transcript_filename, output_lu_parse_dir): ''' This function extracts...
StarcoderdataPython
8131526
import numpy as np class BinarySegmentationMetrics: """ This class is responsible for calculating simple metrics for one pair of ground truth mask and its predicted mask. :param jaccard_threshold: float Threshold value for the jaccard index. Values below this value will be calculated as 0. T...
StarcoderdataPython
9655335
<reponame>EaterGit/EaterDiscordBot import discord from discord.ext import commands, tasks from discord.ext.commands import Bot import random from itertools import cycle import time BOT_PREFIX = '.' user = input('Enter Bot Discord ID and Name ID : ') TOKEN = "<KEY>" bot = commands.Bot(command_prefix=",", activity=disc...
StarcoderdataPython
1703057
<gh_stars>0 #!/usr/bin/env python3 # 文字入力をする処理 text = input("文字を入力してください: ") # 入力された文字を画面に出力 print("入力された文字はこちらです: {}".format(text))
StarcoderdataPython
8060275
""" This module include all class objects used for the management project system MP. """ import json import datetime import copy # Load settings of the lib import settings class Workflow: """ Workflow is the interface that manages all projects. """ def __init__(self, db_path): """Initialization of the instanc...
StarcoderdataPython
44506
<reponame>pmalkki/checkov from typing import Iterable, Optional from checkov.common.checks.base_check import BaseCheck from checkov.common.models.enums import CheckCategories from checkov.json_doc.registry import registry class BaseJsonCheck(BaseCheck): def __init__(self, name: str, id: str, categories: "Iterabl...
StarcoderdataPython
6658692
<gh_stars>1-10 __version__ = "2.2" from .customtkinter_button import CTkButton from .customtkinter_slider import CTkSlider from .customtkinter_frame import CTkFrame from .customtkinter_progressbar import CTkProgressBar from .customtkinter_label import CTkLabel from .customtkinter_entry import CTkEntry from .customtkin...
StarcoderdataPython
146938
# -*- coding: utf-8 -*- # Busca em Largura(sem nós repetidos) def busca_largura(tab_inicial): fila = [tab_inicial] filaRepet = [tab_inicial] # usada para verificar expanção de repetidos nos_exp = 0 # numero de nós expandidos while (len(fila) > 0): nodoTemp = fila.pop(0) # retira do início ...
StarcoderdataPython
1822799
from flask import Flask,render_template,request from main import firebase from flask import redirect app = Flask(__name__) db=firebase.database() #Global Varible global i i=0 points=0 data=db.child('quizz').child('questions').get() @app.route('/') def hello_world(): try: global i q...
StarcoderdataPython
349907
<reponame>rana-sigmoid/python-airflow-assignment from airflow import DAG from datetime import datetime, timedelta from airflow.operators.python_operator import PythonOperator from airflow.operators.postgres_operator import PostgresOperator from utils import get_weather_api_method default_args = { 'owner': 'Airflow...
StarcoderdataPython
243764
<gh_stars>0 from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import random import json from matplotlib import pyplot as plt from PIL import Image ROOT_PATH = '/media/disk/mazm13/dataset/images' SEQ_PER_IMAGE = 5 INPUT_TREE_JSON = "/home/mazm17/imag...
StarcoderdataPython