id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
8131430
''' save csv in mysql ''' # -*- coding:utf-8 -*- import csv import os import numpy as np import pandas as pd import pymysql from pymysql import connect class CsvToMysql(object): def __init__(self, hostname, port, user, passwd, db): self.dbname = db self.conn = connect(host=hostname, port=port, use...
StarcoderdataPython
253404
<reponame>deepnox-io/python-wipbox #!/usr/bin/env python3 """ This package provides simple routines for defining models or schemas. Package: deepnox.models This file is a part of python-wipbox project. (c) 2021, Deepnox SAS. """ __import__("pkg_resources").declare_namespace(__name__) from typing import Union, Any,...
StarcoderdataPython
1808541
<reponame>ReubenJ/fltk-testbed import torch.nn as nn import torch.nn.functional as F class Cifar10CNN(nn.Module): def __init__(self): super(Cifar10CNN, self).__init__() self.conv1 = nn.Conv2d(3, 32, kernel_size=3, padding=1) self.bn1 = nn.BatchNorm2d(32) self.conv2 = nn.Conv2d(32,...
StarcoderdataPython
1906122
<filename>app/backend/backend/migrations/0004_teams_school.py<gh_stars>10-100 # -*- coding: utf-8 -*- # Generated by Django 1.11.16 on 2018-10-19 13:18 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('backend', '00...
StarcoderdataPython
25993
<reponame>BrunoMalard/pybbox<gh_stars>0 from .bboxConstant import BboxConstant import netaddr as net import socket class BboxAPIUrl: """ Used to handle API url """ API_PREFIX = "api/v1" def __init__(self, api_class, api_method, ip=BboxConstant.DEFAULT_LOCAL_IP): """ :param api_cla...
StarcoderdataPython
3419452
#!/usr/bin/python # -*- coding:utf-8 -*- from utils.mysql_util import MysqlUtil from sqlalchemy import desc from models import Article import datetime class ArticleDao: def __init__(self): self.session = MysqlUtil().get_session() def get_articles(self, page=0, size=20): article_num = self.ge...
StarcoderdataPython
1705735
def soma_elementos(lista): soma = 0 for i in lista: soma = soma + i return soma
StarcoderdataPython
4849649
import rospy # from ros_homebot_msgs import srv as srvs #from ros_homebot_python import constants as c #from ros_homebot_python.node import ( # subscribe_to_topic, #get_service_proxy, # packet_to_message_type, # set_line_laser, # say, #) from std_msgs.msg import UInt8MultiArray, Int16 class Robot(...
StarcoderdataPython
8123208
""" NOTE: these functions are copied from "gpu_extract.py" in the hackathon branch; the pieces have not yet been put together into a working GPU extraction in this branch. """ import math import numpy as np import cupy as cp import cupyx.scipy.special from numba import cuda from ..io import native_endian from ..util...
StarcoderdataPython
1827865
from accurate_bg_check.client import BgCheck # Add your client key, client secrete here client = BgCheck('CLIENT_KEY', 'CLIENT_SECRETE')
StarcoderdataPython
5167420
<filename>contacts/app/views.py from django.shortcuts import render from .models import Contacts import uuid from django.http import HttpResponse, HttpResponseRedirect # Create your views here. def index(request): data = Contacts.objects.all() return render(request, "index.html", {"data":data}) def ...
StarcoderdataPython
6688604
<reponame>zongdaoming/TinyTransformer from __future__ import absolute_import from __future__ import division from __future__ import print_function import torch import torch.nn as nn from ..initializer import initialize_from_cfg from ...extensions import DeformableConvInOne from ...utils.bn_helper import setup_bn, rol...
StarcoderdataPython
11284133
from django.conf import settings from sqlalchemy.orm import sessionmaker from EOSS.vassar.api import VASSARClient from asgiref.sync import async_to_sync, sync_to_async from EOSS.graphql.client.Dataset import DatasetGraphqlClient from EOSS.graphql.client.Admin import AdminGraphqlClient from EOSS.graphql.client.Problem...
StarcoderdataPython
3206554
from boto3 import client from json import dumps from os import environ ''' Coding notes: 1) If the source language is the same target language, a JSON is also stored using the original transcription text. 2) AWS translate_text() allows 5000 bytes per request, so original transcription must be split in case its...
StarcoderdataPython
3412835
<reponame>kivzcu/heatmap.zcu<gh_stars>0 import yaml import os from typing import Dict, Set from shared_types import StringSetType from Utilities.Database import database_record_logs from Utilities.helpers import should_skip # Path to dataset configuration files CONFIG_FILES_PATH = "DatasetConfigs/" # Config f...
StarcoderdataPython
11286714
import datanog dn = datanog.daq() dn.calibrate(dn.dev[0])
StarcoderdataPython
1779831
<gh_stars>0 # name1 = "Helder" # name2 = "Ragle" # name3 = "Anna" # name4 = "Tina" # name5 = "Anni" # name6 = "Marvin" names = ["Helder", "Ragle", "Anna", "Tina", "Anni", "Marvin"] counter = 0 while counter < 6: print(names[counter]) counter = counter + 1
StarcoderdataPython
3514061
from PySide.QtGui import QWidget, QGridLayout, QLabel, QLineEdit, QPushButton from PySide.QtCore import Qt class Connect(QWidget): def __init__(self): QWidget.__init__(self) self.grid = QGridLayout() self.setLayout(self.grid) self.setWindowModality(Qt.ApplicationModal) def sh...
StarcoderdataPython
9713032
# -*- coding: utf-8 -*- """Provides sync for podio.""" __all__ = [ 'add_notification', 'AddNotification' ] from pyramid_torque_engine import unpack from pyramid_torque_engine import operations as ops from pyramid_torque_engine import repo from pyramid import path from pyramid_simpleauth.model import get_ex...
StarcoderdataPython
3532769
<filename>STED_analysis/img_preprocess.py # -*- coding: utf-8 -*- import cv2,os import numpy as np from matplotlib import pyplot as plt from PIL import Image from removehighlight import remove_connectivity #Binary processing #Set the threshold threshold, the pixel value is less than the threshold, the value is 0,...
StarcoderdataPython
9743616
''' @author: <NAME> @summary: Test cases to check the behavior when the batch request is not constructed properly. ''' import json from django.test import TestCase from tests import ensure_text_content class TestBadBatchRequest(TestCase): ''' Check the behavior of bad batch request. '''...
StarcoderdataPython
3235703
#!/usr/bin/env python """ Given a string, return a new string where "not " has been added to the front. However, if the string already begins with "not", return the string unchanged. not_string('candy') == 'not candy' not_string('x') == 'not x' not_string('not bad') == 'not bad' """ def not_string(str): if str...
StarcoderdataPython
8176956
from java import lang lang.System.loadLibrary('GraphMolWrap') from org.RDKit import * from threading import Thread import os from find_props import funct_dict def filter_prop(request): """Function to filter a list of mols given a particular property Takes a request object with three potential attributes 1)...
StarcoderdataPython
344063
"""Preprocessing module.""" # pylint: disable=C0330 # pylint: disable=R0902 #import tensorflow import argparse import csv import json import logging import re import string import sys from typing import List import preprocessor # type: ignore import nltk # type: ignore from nltk.stem.wordnet import WordNetLemmatize...
StarcoderdataPython
1806448
from django.shortcuts import render from wechatpy.utils import check_signature from django.http import HttpResponse from django.views.decorators.csrf import csrf_exempt from wechatpy import WeChatClient, parse_message from wechatpy.replies import TextReply from wechatpy.events import ScanCodeWaitMsgEvent from wechatpy....
StarcoderdataPython
4960331
<filename>train/abstract2vec.py import os, nltk, csv, re, gensim, logging from nltk import RegexpTokenizer from nltk.corpus import stopwords from os.path import isfile, join from random import shuffle from gensim import utils from gensim.models.doc2vec import LabeledSentence from gensim.models import Doc2Vec from sklea...
StarcoderdataPython
3269981
# Copyright 2020 The KNIX 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 by applicable law or agree...
StarcoderdataPython
1695218
<gh_stars>1-10 import os from prediction.src.opt import model_path, classes from prediction.src.utils import load_model, load_image if os.path.exists(model_path): model = load_model(model_path) print("Model successfully loaded!") else: print("Model file path does not exist or is incorrect! Please c...
StarcoderdataPython
9799936
<reponame>sma-software/openviriato.algorithm-platform.py-client<filename>py_client/conversion/convert_json_to_aidm_for_end_to_end_test_tools.py from enum import Enum from typing import List, Union, Dict, Type from py_client.aidm import StopStatus, UpdateTimesTrainPathNode, UpdateStopTimesTrainPathNode, IncomingRout...
StarcoderdataPython
4926400
""" This template is written by @Nocturnal-2 What does this quickstart script aim to do? - I do some unfollow and like by tags mostly NOTES: - I am an one month old InstaPy user, with a small following. So my numbers in settings are bit conservative. """ from instapy import InstaPy from instapy import smart_run # g...
StarcoderdataPython
3594346
# -*- coding: utf-8 -*- """Top-level package for Coding Assignments.""" __author__ = """<NAME>""" __email__ = '<EMAIL>' __version__ = '0.1.0'
StarcoderdataPython
9637397
<reponame>TachikakaMin/client<filename>wandb/sdk/service/grpc_server.py #!/usr/bin/env python """wandb grpc server. - GrpcServer: - StreamMux: - StreamRecord: - WandbServicer: """ from concurrent import futures import logging import multiprocessing import os import sys import tempfile import threading from threading...
StarcoderdataPython
11388412
# Copyright Contributors to the Packit project. # SPDX-License-Identifier: MIT from deprecated import deprecated def deprecate_and_set_removal(since: str, remove_in: str, message: str): """ Decorator for deprecating functions in ogr. Args: since: Indicates a version since which is attribute depr...
StarcoderdataPython
5154416
<reponame>thompsnm/capture-the-pi #!/usr/bin/python # -*- coding: iso-8859-1 -*- import RPi.GPIO as GPIO import Tkinter import time import httplib2 as http import json class app_tk(Tkinter.Tk): def __init__(self, parent): Tkinter.Tk.__init__(self,parent) self.parent = parent self.initialize() def ini...
StarcoderdataPython
3258304
<gh_stars>0 primeiro=int(input('Primeiro termo:')) razao=int(input('Razão:')) decimo=primeiro+(10-1)*razao for c in range(primeiro,decimo+razao,razao): print('{}'.format(c), end='->') print('ACABOU') #progressão aritmética (PA)
StarcoderdataPython
3372545
<filename>python/foundation/suite/suite.py # Copyright © 2019 by <NAME> # All rights reserved. No part of this publication/code may not be reproduced, # distributed, or transmitted in any form or by any means, including # photocopying, recording, or other electronic or mechanical methods, # without the prior writte...
StarcoderdataPython
51474
import os import time while (True): os.system("pipenv run start --token 1<PASSWORD> --board 1 --time-factor=1 --logic LowerRight") time.sleep(1)
StarcoderdataPython
3387290
import torch import torch.utils.model_zoo as model_zoo from urllib.parse import urlparse def load_weights(network, save_path, partial=True): if urlparse(save_path).scheme != '': pretrained_dict = model_zoo.load_url(save_path) else: pretrained_dict = torch.load(save_path) if 'state_dict' in...
StarcoderdataPython
1910731
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2018/10/8/008 21:15 # @Author : Woe # @Site : # @File : login.py # @Software: PyCharm from http.client import HTTPConnection from src.utils import get_logger logger = get_logger('Tieba_login') def getCookieValue(cookies, cookieName): '''从cookies中获...
StarcoderdataPython
11351032
import cv2 import numpy as np img= cv2.imread('ct1.jpg') # img = cv2.resize(img,(512,512)) hsv = cv2.cvtColor(img, cv2.COLOR_BGR2HSV) lower = np.array([0,48,80],dtype='uint8') upper = np. array([20,255,255], dtype='uint8') mask = cv2.inRange(hsv, lower, upper) kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE,(1...
StarcoderdataPython
3249730
""" mongodb https://github.com/MongoEngine/mongoengine """ from mongoengine import *
StarcoderdataPython
4940580
<filename>koabot/utils/net.py """Handle network requests""" import io from datetime import datetime from typing import List import aiohttp class NetResponse(): """Custom network response class""" def __init__(self, response: aiohttp.ClientResponse, **kwargs): self.client_response = response ...
StarcoderdataPython
3494398
<reponame>maxi7587/DRFContact<filename>DRFContact/DRFContact/serializers.py from rest_framework import serializers from DRFContact.DRFContact.models import Address, Phone, Web, SocialMedia, Contact class AddressSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = Address fields =...
StarcoderdataPython
3354428
import unittest import numpy as np from flowutils import transforms class TransformsTestCase(unittest.TestCase): def setUp(self): self.test_data_range = np.linspace(0.0, 1000.0, 10001) @staticmethod def test_logicle_range(): """Test a range of input values""" data_in = np.array([...
StarcoderdataPython
1785608
<gh_stars>0 from dwave.system import EmbeddingComposite, DWaveSampler # simple crossroad h = {0,0,0,0} J = { (0, 1): 1, (0, 3): 1, (1, 2): 1, (2, 3): 1 } # chessboard 3 x 3 h = {0,0,0,0} J = { (0, 1): 1, (0, 3): 1, (1, 2): 1, (1, 4): 1, (2, 5): 1, (3, 4): 1, (3, 6): 1, ...
StarcoderdataPython
9780841
from .actor import Actor from .control import ActorHandler def find_actor_handlers(actor, must_allow_standalones=False, include_same_level=False): """ Returns a list of actor handlers, starting from the current node (excluded). The search goes up in the actor hierarchy, up to the root (i.e., the last ...
StarcoderdataPython
3460008
<reponame>keflavich/TurbuStat """ From <NAME>'s AG_fft_tools: Copyright (c) 2009 <NAME> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the right...
StarcoderdataPython
337203
<filename>dependents/imageloads.py<gh_stars>0 # This file will take care of loading all of the image files in the game import pyglet, os # ********Functions********* #This function returns a list of the png images pyglet image file. def image_compiler(path): i = 0 #This is the index number for...
StarcoderdataPython
1701990
<gh_stars>0 """ Users Equipment """ class Users: def __init__(self): self.users = {} self.teaching_assistants = {} # Subset of users def insert(self,user): self.users[user.barcode] = user if(user.ta == 'yes'): self.teaching_assistants[user.barcode] = user ...
StarcoderdataPython
144218
<gh_stars>1-10 """ ABC Class of any Experiment Matrix Generating Module """ from abc import ABC, abstractmethod from typing import Any, Dict import numpy as np class _Generator(ABC): """ ABC Class of Experiment Matrix Generator Method ------ get_exmatrix(**info: Dict[str, Any]) -> np.ndarray ...
StarcoderdataPython
3330452
expected_output = { "tag": { "1": { "flex-algo": 131 } } }
StarcoderdataPython
11324764
# -*- coding: utf-8 -*- # Generated by Django 1.9.1 on 2016-03-15 20:34 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('crowdcop_web', '0002_campaign_num_tips'), ] operations = [ migrations.AddFie...
StarcoderdataPython
6620621
<filename>eveil/map.py # Copyright (C) 2018 <NAME> # <pierrejean dot fichet at posteo dot net> # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # T...
StarcoderdataPython
11360116
<filename>docs/plots/peak_detection_baseline_example.py import tidyms as ms import numpy as np import matplotlib.pyplot as plt np.random.seed(1234) signal_height = 100 snr = 10 n_col = 4 x = np.arange(200) noise_level = signal_height / snr noise = np.random.normal(size=x.size, scale=noise_level) fig, ax = plt.subplots...
StarcoderdataPython
3425504
<reponame>Ron423c/chromium<filename>third_party/blink/tools/blinkpy/tool/commands/rebaseline.py # Copyright (c) 2010 Google Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistrib...
StarcoderdataPython
5064253
import codecs import os import re from setuptools import setup from setuptools.command.test import test as TestCommand with codecs.open(os.path.join(os.path.abspath(os.path.dirname( __file__)), 'sphinxcontrib', 'asyncio.py'), 'r', 'latin1') as fp: try: version = re.findall(r"^__version__ = '([^']+)...
StarcoderdataPython
3581700
import json import os from datetime import datetime from croniter import croniter from boto3.dynamodb.types import TypeDeserializer from lambda_client import invoke_lambda from model import client, table_name, cron_table_name, cron_table from util import make_chunks from scheduler import schedule_cron_events deseria...
StarcoderdataPython
35029
import json import uuid from dataclasses import dataclass from typing import Callable, Sequence, Any, Optional, Tuple, Union, List, Generic, TypeVar from serflag import SerFlag from handlers.graphql.graphql_handler import ContextProtocol from handlers.graphql.utils.string import camelcase from xenadapter.task import ge...
StarcoderdataPython
3561575
<reponame>osrf/cloudsim-legacy #!/usr/bin/env python from __future__ import with_statement from __future__ import print_function import cgitb import json from common import get_javascripts cgitb.enable() import common from common import authorize email = authorize() udb = common.UserDatabase() role = udb.get_role(...
StarcoderdataPython
1990976
<filename>3.py class Edge: def __init__(self, p1, p2, steps): self.p1 = p1 self.p2 = p2 self.steps = steps self.vertical = p1.x == p2.x class Point: def __init__(self, x, y): self.x = x self.y = y class Intersection: def __init__(self, point, steps1, steps...
StarcoderdataPython
9604968
import numpy as np import scipy.interpolate as interpolate import h5py as h5 import os from lxml import objectify, etree import sharpy.utils.generator_interface as generator_interface import sharpy.utils.settings as settings import sharpy.utils.cout_utils as cout @generator_interface.generator class TurbVelocityFiel...
StarcoderdataPython
8029582
<gh_stars>1-10 def simulate(registers, instructions): i = 0 while i < len(instructions): args = instructions[i].split() if args[0] == 'hlf': registers[args[1]] //= 2 i += 1 elif args[0] == 'tpl': registers[args[1]] *= 3 i += 1 elif ...
StarcoderdataPython
6532459
# output.__init__.py from .dict_format import OutputModule from .sqlite import SQLiteModule from .textcloud import TextCloudModule
StarcoderdataPython
6650887
from typing import Callable from typing import List from typing import Optional from typing import Union from torch import nn from caldera.defaults import CalderaDefaults as D from caldera.utils import pairwise class MLPBlock(nn.Module): """A multilayer perceptron block.""" def __init__( self, ...
StarcoderdataPython
11275622
<reponame>bigfoolliu/liu_aistuff #!/usr/bin/env python3 # -*- coding:utf-8 -*- # author: bigfoolliu """查找和替换字符串""" import re s = "this is china, and i love it" target = "loe" # 查找 ret = re.findall(target, s) print(s, ret) # 替换 ret = re.sub("i", "we", s) print(s, ret) print(s.replace("china", "world"))
StarcoderdataPython
3470332
# @Time : 2021/4/19 # @Author : <NAME> # @Email : <EMAIL> """ textbox.evaluator.averagelength_evaluator ########################################## """ import numpy as np from textbox.evaluator.abstract_evaluator import AbstractEvaluator class AvgLenEvaluator(AbstractEvaluator): def _calc_metrics_info(self, ...
StarcoderdataPython
4812410
<reponame>shreyaphirke/interbotix_ros_manipulators from interbotix_xs_modules.arm import InterbotixManipulatorXS # This script commands some arbitrary positions to the arm joints # # To get started, open a terminal and type... # 'roslaunch interbotix_xsarm_control xsarm_control.launch robot_model:=wx250s' # Then chang...
StarcoderdataPython
134347
<filename>MLlib/models.py from MLlib.optimizers import GradientDescent from MLlib.activations import sigmoid from MLlib.utils.misc_utils import generate_weights from MLlib.utils.decision_tree_utils import partition, find_best_split from MLlib.utils.decision_tree_utils import Leaf, Decision_Node from MLlib.utils .knn_ut...
StarcoderdataPython
4893902
# Copyright 2014 Mirantis Inc. # 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 or a...
StarcoderdataPython
1739608
#!/usr/bin/env python # Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import os import re import pyauto_functional # Must be imported before pyauto import pyauto import pyauto_utils class AboutPlug...
StarcoderdataPython
9676823
<reponame>yanshengjia/nlp #! /usr/bin/env python # -*- coding: utf-8 -*- from snownlp import SnowNLP s = SnowNLP(u':#微感动#【一次搀扶,四载照顾[心]】路遇一摔倒老人蜷缩在地,她将老人扶起送回家。不放心老人她次日再去拜访,得知老人孤身一人后从此义务照顾!每天看望,帮洗衣服,陪着聊天…她坚持至今4年!她说当下好多人不敢扶老人,想用行动改变大家看法!31岁山西籍好人赵艳善心无畏惧[赞](央视记者杨晓东)') print '中文分词:' for each in s.words: print each, prin...
StarcoderdataPython
10560
class IOEngine(object): def __init__(self, node): self.node = node self.inputs = [] self.outputs = [] def release(self): self.inputs = None self.outputs = None self.node = None def updateInputs(self, names): # remove prior outputs for input...
StarcoderdataPython
1943197
""" __new__()方法, 对象创建的过程, 1- new方法返回一个对象 2- init利用new返回的对象进行属性的添加 """ class Person(object): # 监听创建一个实例对象的过程,需要返回一个对象赋值给xiaoming # new中不return的话,那么久不会执行init方法 def __new__(cls, *args, **kwargs): print("new") print((object.__new__(cls))) return object.__new__(cls) # 构造方法...
StarcoderdataPython
3426861
# -*- coding: utf-8 -*- from music21 import * import copy def richardBreedGetWell(): ''' <NAME> is a donor who supports the purchases of early music materials at M.I.T. -- I used this code as part of a get well card for him, it finds the name BREED in the Beethoven quartets. (well something close, B-...
StarcoderdataPython
6509824
# Copyright (c) 2020 <NAME> # Distributed under the MIT software license, see the accompanying # file LICENSE or http://www.opensource.org/licenses/mit-license.php import os import json import logging from moneysocket.beacon.beacon import MoneysocketBeacon PERSIST_FILENAME = "connect-persist.json" EMPTY_DB = {"asse...
StarcoderdataPython
8148812
<reponame>slowmosteve/news-app<gh_stars>0 import os import json import time import datetime import gcsfs import requests import uuid import logging import papermill from flask import Flask, request from subscriber import Subscriber from loader import Loader from google.cloud import pubsub, bigquery, storage import goog...
StarcoderdataPython
6500598
from unittest import TestCase from expects import expect, equal, raise_error from slender import Set class TestIntersection(TestCase): def test_intersection_other_with_inersection(self): e = Set({1, 2, 3, 4}) o = {3, 4, 5, 6} expect(e.intersection(o).to_set()).to(equal({3, 4})) de...
StarcoderdataPython
6508193
from .mime import ( get_by_filename ) __all__ = [ 'get_by_filename' ]
StarcoderdataPython
37366
<reponame>DramatikMan/mlhl-01-python-bot from typing import Any from telegram.ext import CallbackContext, Dispatcher CCT = CallbackContext[ dict[Any, Any], dict[Any, Any], dict[Any, Any] ] DP = Dispatcher[ CCT, dict[Any, Any], dict[Any, Any], dict[Any, Any] ] DataRecord = tuple[ int, ...
StarcoderdataPython
3264720
<filename>allauthdemo/auth/insurance.py import datetime from django.db import models class Automotive(models.Model): id = models.AutoField(primary_key=True) customer_id = models.IntegerField(default=0) make = models.CharField(max_length=25, default='Toyota') model = models.CharField(max_length=100, de...
StarcoderdataPython
12856133
""" Author: <NAME> Created in: September 19, 2019 Python version: 3.6 """ from Least_SRMTL import Least_SRMTL import libmr from matplotlib import pyplot, cm from matplotlib.patches import Circle from mpl_toolkits.mplot3d import Axes3D, art3d import numpy as np import numpy.matlib import sklearn.metrics cla...
StarcoderdataPython
12816639
import os import socket import subprocess from collections import deque from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException, httplib from . logger import info from . config import DASHCORE_DIR def simplemovingaverage(period): assert period == int(period) and period > 0, "Period must be an integer ...
StarcoderdataPython
3484434
<reponame>defrex/graphql-core<gh_stars>0 from ...error import GraphQLError from ...language.printer import print_ast from ...type.definition import GraphQLNonNull from ...utils.is_valid_literal_value import is_valid_literal_value from .base import ValidationRule class DefaultValuesOfCorrectType(ValidationRule): d...
StarcoderdataPython
3307341
<gh_stars>10-100 giver = open("./to_add.md", 'r', encoding = 'UTF8') taker = open("./korean-bad-words.md", 'a+', encoding = 'UTF8') words_to_add = set([line.rstrip() for line in giver]) existing_words= set([line.rstrip() for line in taker]) for word_to_add in words_to_add: if word_to_add not in existing_words: ...
StarcoderdataPython
6444801
from covgen.run.inputgenerator import execute execute()
StarcoderdataPython
235919
from django.test import TestCase from django.contrib.auth import get_user_model class ModelTests(TestCase): def test_create_user_with_emamil_successful(self): """Test creating a new user with an email is successful""" email = '<EMAIL>' password = '<PASSWORD>' user = get_user_model().objects.create_...
StarcoderdataPython
11276534
<gh_stars>1000+ import pandas as pd from random import random, randint, choice from faker import Faker fake = Faker() def superstore(count=50): data = [] for id in range(count): dat = {} dat['Row ID'] = id dat['Order ID'] = '{}-{}'.format(fake.ein(), fake.zipcode()) dat['Order ...
StarcoderdataPython
98473
import json import pytest from custom_components.hacs.validate.brands import Validator from tests.sample_data import response_rate_limit_header @pytest.mark.asyncio async def test_added_to_brands(repository, aresponses): aresponses.add( "brands.home-assistant.io", "/domains.json", "get"...
StarcoderdataPython
8140592
<reponame>Rhoana/dataspec<gh_stars>0 import setuptools from dataspec.loader import DATASPEC_GROUP VERSION = "1.1.2" setuptools.setup( description="Tilespec data model", dependency_links=[ 'http://github.com/Rhoana/rh_renderer/tarball/master' '#egg=rh_renderer-0.0.1'], entry_points={ ...
StarcoderdataPython
4889082
<reponame>subhadarship/nlp4if-2021 import logging from typing import List import pandas as pd import torch from torch.utils.data import Dataset from tqdm import tqdm from transformers import BertTokenizer from .data import COLUMN_NAMES from .field import LabelField logger = logging.getLogger(__name__) class BertIn...
StarcoderdataPython
8067317
#BMI calculator print("This is a program to calculte your BMI\n") weight=int(input("Enter your weight\n")) height=float(input("Enter your height\n")) bmi=weight/height **2 bmi_round=round(bmi,2) print(f"your bmi is {bmi_round}")
StarcoderdataPython
4981722
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (c) 2017~2999 - cologler <<EMAIL>> # ---------- # # ---------- from .common import Stop, Help from .bool import pick_bool from .list import pick_item from .obj import pick_method
StarcoderdataPython
11329470
# # discinfo.py # # Copyright (C) 2010 Red Hat, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program...
StarcoderdataPython
9759390
# GNU MediaGoblin -- federated, autonomous media hosting # Copyright (C) 2011, 2012 MediaGoblin contributors. See AUTHORS. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either versio...
StarcoderdataPython
5059989
<filename>dsvidgp/__init__.py """Module to build deep Gaussian process models."""
StarcoderdataPython
11385957
from .teacher import build_teacher from .roi_heads import TeacherROIHeads from .rpn import TeacherRPN
StarcoderdataPython
3295844
<reponame>kelseykm/kelchat #!/usr/bin/env python3 #Written by kelseykm ##Creates TCP chatroom server with messages encrypted in TLS import os import socket import sys import threading import ssl HOST = '' PORT = 1999 ADDR = (HOST, PORT) SSL_KEY = os.path.abspath('key.pem') SSL_CERT = os.path.abspath('cert.pem') se...
StarcoderdataPython
3430163
<filename>src/compare_files.py import filecmp from .types import FsPath class CompareFiles(): """Provides the basic interface needed by the filehandler when comparing files. This implementation simply does a filecmp. """ def compare(self, f1: FsPath, f2: FsPath) -> bool: """Compare two file...
StarcoderdataPython
9607734
<filename>test/test_parsers/test_broken_parse_data_from_jena.py import os from test.data import TEST_DATA_DIR import pytest import rdflib # Recovered from # https://github.com/RDFLib/rdflib/tree/6b4607018ebf589da74aea4c25408999f1acf2e2 broken_parse_data = os.path.join(TEST_DATA_DIR, "broken_parse_test") @pytest.f...
StarcoderdataPython
6696756
class SearchAPI: """ This module can be used to search through the database. A user should supply two things: the query as string, and a dictionairy with table names as keys, and a list of table columns as values. This dictionairy indicates which part of the database is to be search. The q...
StarcoderdataPython