id
stringlengths
1
7
text
stringlengths
6
1.03M
dataset_id
stringclasses
1 value
29891
import numpy as np import math from scipy.optimize import minimize class Optimize(): def __init__(self): self.c_rad2deg = 180.0 / np.pi self.c_deg2rad = np.pi / 180.0 def isRotationMatrix(self, R) : Rt = np.transpose(R) shouldBeIdentity = np.dot(Rt, R) I = np.id...
StarcoderdataPython
1722368
# coding: utf-8 import numpy as np import pandas as pd from utils.split_data import split_data from utils.write_logs import write_log import re class Prefix: def __init__(self, app_name='', data_name='data.csv', target='',alert_level = 1): df = pd.read_csv(data_name) self.app_name = app_name ...
StarcoderdataPython
3290058
<gh_stars>1-10 import os, sys import numpy as np import torch as tc import torch.tensor as T import torch.nn as nn import torch.nn.functional as F import torchvision from .BaseForecasters import * class ResNet50_Office31(Forecaster): def __init__(self, pretrained=True, n_labels = 31): super().__...
StarcoderdataPython
3397702
from django.http import HttpResponse from django.shortcuts import render def login(request): return HttpResponse("Superuser login") def show_all_instruments(request): return HttpResponse("All available instruments will be listed here") def add_new_instrument(request): return HttpResponse("Add new inst...
StarcoderdataPython
1761992
<gh_stars>0 import sys, math def parse_vec3(line): return [float(line[1]), float(line[2]), float(line[3])] def parse_vec2(line): return [float(line[1]), float(line[2])] def norm(vec): l = math.sqrt(vec[0] * vec[0] + vec[1] * vec[1] + vec[2] * vec[2]) if l != 0.0: return [vec[0] / l, vec[1] / l, vec[2] / ...
StarcoderdataPython
1664764
<gh_stars>100-1000 import subprocess from optparse import OptionParser import re import time def run(command): try: output = subprocess.Popen(command, shell=True, universal_newlines=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) ...
StarcoderdataPython
40037
<filename>2-Python-Fundamentals (Jan 2021)/Course-Exercises-and-Exams/03-Lists-Basics/02_Exercises/02_Multiples-List.py # 2. Multiples List # Write a program that receives two numbers (factor and count) and creates a list with length of the given count # and contains only elements that are multiples of the given factor...
StarcoderdataPython
3201645
<filename>Methodo_TD7-phase1.py import nltk from nltk.corpus import brown import my_toolsv2 as mt import json def ex_constitution_corpus(): themes = {"news":["news", "reviews", "editorial"], "literature":["science_fiction", "romance", "fiction", "mystery"], "sciences":["learned"]} nb_inst...
StarcoderdataPython
1613853
<reponame>krazos/southwest-alerts<filename>southwestalerts/southwest.py import json import time import asyncio from pyppeteer import launch from pyppeteer.network_manager import Request import requests BASE_URL = 'https://mobile.southwest.com' class Southwest(object): def __init__(self, username, password, ...
StarcoderdataPython
177835
<reponame>cmccandless/stunning-pancake #!/usr/bin/env python # https://projecteuler.net/problem=25 import unittest def fibon(): a = 1 b = 1 yield 0 yield a yield b while True: c = a + b yield c a = b b = c def answer(ndigits=1000): f = e...
StarcoderdataPython
1752812
<filename>middle_tier/services/loader.py import json from exceptions import MiddleTierException from services.service import Service class NotFoundServiceException(MiddleTierException): pass class NotFoundSecurityServiceException(MiddleTierException): pass CONFIG_PATH = "/opt/middle_tier/services.json" ...
StarcoderdataPython
1657070
""" Main entrance to commandline actions """ import click from sveetoy_cli.cli.version import version_command from sveetoy_cli.cli.colors import colors_command from sveetoy_cli.cli.export import export_command from sveetoy_cli.cli.schemes import schemes_command from sveetoy_cli.logs import init_logger # Help alias o...
StarcoderdataPython
1654096
<reponame>rsiemens/nidus import os import shutil from unittest import TestCase from unittest.mock import Mock from nidus.log import LogEntry from nidus.state import RaftState class RaftStateTestCases(TestCase): test_log_dir = "test_nidus_logs" def setUp(self): os.makedirs(self.test_log_dir) def...
StarcoderdataPython
1765048
<reponame>congltk1234/LaptopAnalyst import scrapy import re from ..items import LaptopItem from scrapy_selenium import SeleniumRequest from selenium import webdriver from scrapy.utils.project import get_project_settings class TikiSpider(scrapy.Spider): name = 'tiki' allowed_domains = ['tiki.vn'] start_url...
StarcoderdataPython
3222451
import asyncio from Discord.discord import Discord from FTXwrapper.methods import FTXMethods class StackBot(FTXMethods): def __init__(self, account_name, market): super().__init__(account_name=account_name) self.market = market def run(self): res = asyncio.run(self.single...
StarcoderdataPython
3351450
from sqlalchemy import Column, String, Date, Float exchange_rate_item_table_name = 'exchange_rate_item' def get_exchange_rate_item_db(base, table_name=exchange_rate_item_table_name): class ExchangeRateItem(base): __tablename__ = table_name date = Column(Date, primary_key=True) bkpr = Colu...
StarcoderdataPython
1656522
<reponame>i25959341/Happynodes import psycopg2 import time import os import socket import requests import json from discoverSQL import NodeObject, isOpen, getRemoteNodes, checkEndpoint from discoverSQL import insertNewNodes, insertNewEndpoints, insertNewEndpointsInfo host = str(os.environ['PGHOST']) databasename = st...
StarcoderdataPython
113359
class Solution(object): def divide(self, dividend, divisor): """ :type dividend: int :type divisor: int :rtype: int """ sign = 1 if (dividend >= 0) == (divisor >= 0) else -1 dd = abs(dividend) dr = abs(divisor) if dd < dr: return 0 ...
StarcoderdataPython
3336156
<reponame>iahuang/scratch-gcc import os import json from . import SPArgumentName, SPArithmetic, SPAssign, SPConstant, SPFunctionDefinition, SPModule, SPNode, SPVariableName from .. import scratch class CompilationContext: def __init__(self): self.enclosingFunction: SPFunctionDefinition = None self....
StarcoderdataPython
131680
""" ******************************************************************************** * Name: spatial_reference.py * Author: nswain * Created On: May 15, 2018 * Copyright: (c) Aquaveo 2018 ******************************************************************************** """ from tethys_sdk.testing import TethysTestCase f...
StarcoderdataPython
1621636
<filename>Taller_Diccionarios/Ejercicio_1.py ejercicio=[12, 23, 5, 12, 92, 5,12, 5, 29, 92, 64,23] diccionario={ } for i in ejercicio: a=ejercicio.count(i) diccionario.update({i:a}) print(diccionario)
StarcoderdataPython
1670489
# Copyright 2017 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 # # https://aws.amazon.com/apache-2-0/ # # or in the "license" file accompa...
StarcoderdataPython
1792615
from .allauth import * from .drf import * from .jwt import * from .rest_auth import * from .cors import *
StarcoderdataPython
3238876
<gh_stars>0 #!/usr/bin/env python from distutils.core import setup setup(name='mysql2tsv', version='0.01', packages=['mysql2tsv'], package_dir={'mysql2tsv': 'mysql2tsv'} )
StarcoderdataPython
1725637
<filename>react_game/employeelistBackend/urls.py from django.urls import path
StarcoderdataPython
113868
# get china stock symbols from tqdm import tqdm from time import sleep from random import randint from bs4 import BeautifulSoup from requests import Request from selenium import webdriver from selenium.webdriver.chrome.options import Options from selenium.webdriver.common.keys import Keys from webdriver_manager.chrome...
StarcoderdataPython
1606314
''' ############################################################################### "MajoranaNanowire" Python3 Module v 1.0 (2020) Created by <NAME> (2018) ############################################################################### ...
StarcoderdataPython
3283252
## @file # This file is used to parse a xml file of .PKG file # # Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR> # # SPDX-License-Identifier: BSD-2-Clause-Patent # ''' XmlParser ''' ## # Import Modules # import re from edk2basetools.UPT.Library.Xml.XmlRoutines import XmlNode from edk2basetool...
StarcoderdataPython
3391860
#image to text from PIL import Image from pytesseract import image_to_string img=Image.open('/home/soham/Pictures/check.png') text=image_to_string(img) print(text)
StarcoderdataPython
3255869
<reponame>singh-hrituraj/Transformers """ Code/Comments By <NAME> Code reference: http://nlp.seas.harvard.edu/2018/04/03/attention.html June 2019 """ import torch.nn as nn from utils import * class Decoder(nn.Module): """Base class for generic Decoder""" def __init__(self, layer, N): """Initializes the class ...
StarcoderdataPython
3379483
import numpy as np class MyList: arr = [] index = -1 def __init__(self, arr): self.arr = arr print(self.arr) def __iter__(self): self.index = self.index + 1 return self def __next__(self): max = len(arr) if self.index + 1 >= max: raise...
StarcoderdataPython
3362429
# 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 writing, software # d...
StarcoderdataPython
1689109
# wp-data-splitter.py: split a large wordpress data file into smaller ones # See https://github.com/kei-51/wp-data-splitter for details. # License: MIT license http://www.opensource.org/licenses/mit-license.php import sys def main(): # 1.5M char counts as default since 2M bytes is the popular PHP upload l...
StarcoderdataPython
1722304
<reponame>CodingLeeSeungHoon/Python_Algorithm_TeamNote """ matrix transpose """ def transpose(original): matrix = original[:] matrix = [list(x) for x in zip(*matrix)] return matrix
StarcoderdataPython
1685958
<reponame>snowxmas/alipay-sdk-python-all #!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class KoubeiMerchantDeviceCrashinfoUploadModel(object): def __init__(self): self._event_time = None self._extend_info = None self._hardw...
StarcoderdataPython
1751621
<filename>src/main.py ''' Reference implementation of node2vec. Author: <NAME> For more details, refer to the paper: node2vec: Scalable Feature Learning for Networks <NAME> and <NAME> Knowledge Discovery and Data Mining (KDD), 2016 ''' import argparse import numpy as np import networkx as nx import node2vec2 from ge...
StarcoderdataPython
3267328
<reponame>khaykingleb/Automatic-Speech-Recognition from torch import nn import torch from asr.models.base_model import BaseModel device = torch.device("cuda:0") if torch.cuda.is_available() else torch.device("cpu") class DummyModel(BaseModel): def __init__(self, n_feats, n_class, gru_hidden=512, gru_num_layers...
StarcoderdataPython
1608021
# Copyright 2014-2015 MongoDB, 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 writi...
StarcoderdataPython
3241020
from django.db import models _QUESTIONS = { "first_name": "textfield_28990631", "last_name": "textfield_28990632", "email": "email_28990633", "coming_from": "dropdown_28990634", "nationality": "dropdown_28990808", "degree": ("list_28990901_choice", "list_28990901_other"), "graduation": "dat...
StarcoderdataPython
6506
"""This module contains the general information for StorageScsiLunRef ManagedObject.""" from ...ucscmo import ManagedObject from ...ucsccoremeta import UcscVersion, MoPropertyMeta, MoMeta from ...ucscmeta import VersionMeta class StorageScsiLunRefConsts(): pass class StorageScsiLunRef(ManagedObject): """Th...
StarcoderdataPython
1708048
<reponame>Michael-Czekanski/WMIAdventure-1 from battle.businesslogic.effects.Effect import Effect class TwoTimesExecuteEffect(Effect): """ One may say that this effect 'duplicates' the card, so the card gets used two times in two consecutive player turns, but it does not duplicate itself in a way that the...
StarcoderdataPython
3204288
#!/usr/bin/env python3 """ Die class module. """ import random class Die: """ Die class, represents a dice. """ # Static attributes MIN_ROLL_VALUE = 1 MAX_ROLL_VALUE = 6 def __init__(self, value=None): """ Constructor method for class instance """ if valu...
StarcoderdataPython
3334199
name = input() sum = float(0) grade = float(input()) count = 0 while count != 13: grade = float(grade) count += 1 grade = round(grade, 2) sum += grade round(sum, 2) if grade == 2: print (f"{name} has been excluded at {count} grade") break grade = float(grade) grade = int(...
StarcoderdataPython
1684610
<reponame>eshanking/fears-figures import sys sys.path.append('/Users/kinge2/repos/') import numpy as np import math import random from seascapes_figures.utils import plotter, pharm, fitness, dir_manager import pandas as pd class Population(fitness.Fitness,plotter.Plotter): """Population class: the f...
StarcoderdataPython
3937
<reponame>VGrondin/CBNetV2_mask_remote<gh_stars>0 _base_ = [ '../_base_/models/faster_rcnn_r50_fpn.py' ] model = dict( type='FasterRCNN', # pretrained='torchvision://resnet50', backbone=dict( type='ResNet', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), frozen...
StarcoderdataPython
3355724
# Copyright (c) 2019-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # def f_gold(n): BT = [0] * (n + 1) BT[0] = BT[1] = 1 for i in range(2, n + 1): for j in range(i): ...
StarcoderdataPython
1651067
<reponame>ciarakamahele/sasy<filename>simulator/Planners/RockTestPlanner.py # Copyright 2015 <NAME>-Sanfratello # # 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/...
StarcoderdataPython
1748890
<filename>bookmanager/book/admin.py from django.contrib import admin # Register your models here. #导入模型 from book.models import BookInfo,PeopleInfo #注册书籍模型 admin.site.register(BookInfo) #注册人物模型 admin.site.register(PeopleInfo)
StarcoderdataPython
1600872
<gh_stars>1-10 from retic.runtime import * from retic.transient import * from retic.typing import * def check8(val): try: val.parse_args return val except: raise CheckError(val) def check9(val): try: val.run_benchmark return val except: raise CheckError(...
StarcoderdataPython
1737705
<filename>Code/checkpoints.py from modules import * from plot import * from IPython.display import clear_output class DisplayCallback(tf.keras.callbacks.Callback): def on_train_begin(self, logs=None): self.loss = [] self.val_loss = [] def on_epoch_end(self, epoch, logs=None): cle...
StarcoderdataPython
152239
# -*- coding: utf-8 -*- """Data endpoints optimized for reports in the Reporter blueprint.""" from operator import itemgetter from AIPscan import db from AIPscan.Data import ( fields, get_storage_location_description, get_storage_service_name, ) from AIPscan.models import AIP, Event, File, FileType, Stora...
StarcoderdataPython
3234003
######################################################################## # Utility functions # # <NAME>, 26/03/2020 ######################################################################## import os def create_dirs(fn): """Create missing directories for output fn.""" if not os.path.isdir(os.path.dirname(fn))...
StarcoderdataPython
3349866
<filename>process/tests/testDrawRadar.py #!/usr/bin/python # -*- coding: utf-8 -*- import sys, os from VtkRenderer import * import numpy as np from RadarTransforms import * from LidarTransforms import * from Q50_config import * class ImageGrabberCallback: def __init__(self, map_file): self.map_file = ma...
StarcoderdataPython
1773845
from pyramid.i18n import TranslationStringFactory from formencode import Schema, validators from pytz import common_timezones from ow.schemas.blob import FieldStorageBlob from ow.utilities import get_available_locale_names, get_gender_names _ = TranslationStringFactory('OpenWorkouts') class PasswordMatch(validators...
StarcoderdataPython
4829855
<filename>clocwalk/libs/analyzer/nodejs.py # coding: utf-8 import json __product__ = 'JavaScript' __version__ = '0.3' from clocwalk.libs.core.common import recursive_search_files def _get_dependencies(file_name='package.json', origin=None): """ get properties :param file_name: :return: """ ...
StarcoderdataPython
3316351
import sys class listenerlibrary(object): ROBOT_LISTENER_API_VERSION = 2 ROBOT_LIBRARY_SCOPE = "TEST CASE" def __init__(self): self.ROBOT_LIBRARY_LISTENER = self self.events = [] def get_events(self): return self.events[:] def _start_suite(self, name, attrs): sel...
StarcoderdataPython
4822005
""" *Now* """ def now(): eps = 1e-16 dummy_loss = Time.Loss( 0, 0, 0, 0, 0, ) dummy_status = Report.LearningStatus( dummy_loss, 0, 0, ) return Now.Learning( eps, eps, eps, eps, dummy_s...
StarcoderdataPython
3202749
import math from typing import Sequence import fastfilters import numpy from sklearn.base import BaseEstimator, TransformerMixin class Filter(BaseEstimator, TransformerMixin): def fit(self, X=None, y=None, **kwargs): return self def transform(self, X): raise NotImplementedError @propert...
StarcoderdataPython
3376122
<reponame>klow-analytics/klow import unittest from ddt import ddt from ddt import file_data from google_analytics_pipeline.core.enrichment.page import PageEnrichmentFn @ddt class TestPageEnrichment(unittest.TestCase): def setUp(self): self.maxDiff = None self.test_fn = PageEnrichmentFn().proces...
StarcoderdataPython
1619895
<reponame>ebbaberg/MovingFiles import csv import os import shutil import numpy as np import random import pandas as pd import math import General_Moving class MakeKFolds: def __init__(self, labels_path = '/home/jovyan/scratch-shared/Ebba/BBBC021_Filtered_Data/Labels.csv', excl...
StarcoderdataPython
105419
import numpy as np # numerical tools from scipy import integrate from scipy import interpolate c_light=299792.458#in km/s #Find nearest value def find_nearest(array,value): idx = (np.abs(array-value)).argmin() return array[idx] #### DATA SN def get_SN_info(targetname): data_sn=np.loadtxt('Info_SNe_KAIT.txt',u...
StarcoderdataPython
4832224
<reponame>dvzrv/softlayer-python """List SSH keys.""" # :license: MIT, see LICENSE for more details. import click import SoftLayer from SoftLayer.CLI import environment from SoftLayer.CLI import formatting @click.command() @click.option('--sortby', help='Column to sort by', type=click.Ch...
StarcoderdataPython
3347639
<gh_stars>10-100 ''' This code is part of QuTIpy. (c) Copyright <NAME>, 2021 This code is licensed under the Apache License, Version 2.0. You may obtain a copy of this license in the LICENSE.txt file in the root directory of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. Any modifications or deri...
StarcoderdataPython
192723
from librespot.player.playback.PlayerSession import PlayerSession
StarcoderdataPython
104763
from django.db import models from bets.models import Bet from account.models import User # Create your models here. class Cart(models.Model): user=models.OneToOneField(User,on_delete=models.CASCADE,related_name="user") bets=models.ManyToManyField(Bet,blank=True)
StarcoderdataPython
3317600
""" Dataclasses; classes whose only purpose is to hold specific data. """ import typing import math from .. import constants from .abc import JSONData, Settable, Block from ..enums import Enchantments, TagType, CodeblockActionType, BlockType, BracketDirection, BracketType from ..utils import remove_u200b_from_doc, all_...
StarcoderdataPython
3380057
"""Routes for CoVID-19 dashboard app.""" from flask import render_template from app import covid_app from app import data from app import plotting from app import config as cfg from app import constants as cts from bokeh.embed import components def filter_secondary_links(region, num_links=2): """Return `num_link...
StarcoderdataPython
60201
""" *Lower-East Block* ⠨ The lower-east block gi. """ from dataclasses import dataclass from ...._gi import Gi from ..._gi import StrismicGi from ...east import EasternGi from ..._number import BlockGi from .._gi import LowerGi __all__ = ["LowerEastBlock"] @dataclass class LowerEastBlock( Gi, St...
StarcoderdataPython
1735080
<filename>setup.py<gh_stars>0 from setuptools import setup, find_packages setup( name="dodocs", description="", version="1.0", author="<NAME>", author_email="<EMAIL>", # url="", packages=find_packages() )
StarcoderdataPython
3345869
from argparse import ArgumentParser from utils import sequence_to_parenthesis, flat_list, rebuild_input_sentence from tree import SeqTree, SyntacticDistanceEncoder from collections import Counter import codecs import os import copy import sys import warnings """ To encode: python /home/david/Escritorio/encoding2multi...
StarcoderdataPython
14245
# Generated by Django 2.2.1 on 2022-02-25 15:50 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('mutational_landscape', '0002_auto_20180117_1457'), ] operations = [ migrations.RemoveField( model_name='diseasemutations', n...
StarcoderdataPython
3270586
<reponame>UTbioinf/InvDet #!/usr/bin/env python import pysam import math import argparse class FileWriter(object): def __init__(self, write_type = "two-file", prefix = "output", use_pacbio_head = False): self._write_type = write_type self._prefix = prefix self._fout1 = None self._f...
StarcoderdataPython
81441
""" demo.py - demonstration program for freq2note.py by <NAME> | <EMAIL> | http://groverlab.org """ import freq2note as f2n freqs = [23, 120.0, 345.0, 440.1, 5001.1] notes = "" for f in freqs: notes = notes + f2n.lilypond(f2n.find_closest_note(f)) f2n.write(notes)
StarcoderdataPython
1627910
<gh_stars>1-10 """368. Largest Divisible Subset https://leetcode.com/problems/largest-divisible-subset/ Given a set of distinct positive integers nums, return the largest subset answer such that every pair (answer[i], answer[j]) of elements in this subset satisfies: answer[i] % answer[j] == 0, or answer[j] % answer[i...
StarcoderdataPython
132278
<filename>build/lib/torch_utils/models/DeeplabV1.py<gh_stars>1-10 """ Deeplabv1 backbone: VGG16 """ from collections import OrderedDict from torch.nn import * import torch.nn.functional as F class DeeplabV1(Module): def __init__(self, num_classes=21, vgg_based_type=16, bn=True): super(DeeplabV1, self).__i...
StarcoderdataPython
1659001
<reponame>felipead/sqs-mega-python from mega.match.types import ValueType, FunctionType, is_function, RightHandSideFunction class Lambda(RightHandSideFunction): def __init__(self, rhs: FunctionType): if not is_function(rhs): raise TypeError('Right-hand side is not a user-defined function: {}'....
StarcoderdataPython
3328365
from abc import ABC, abstractmethod from collections import deque class BaseAgent(ABC): def __init__(self, cfg): self.state_size = cfg['state_size'] self.action_size = cfg['action_size'] cfg_agent = cfg.get('agent', {}) self.memory = deque(maxlen=cfg_agent.get('memory_size', 2000))...
StarcoderdataPython
4831046
# Copyright 2018-2020 Xanadu Quantum Technologies 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 applicabl...
StarcoderdataPython
132146
# For each run: # - Pick 1 file from each parent dir (alphabet) for train # - Pick 1 file from each parent dir (alphabet) for test import os import random import logging from pathlib import Path from shutil import copyfile OUTPUT_PATH = './data/omniglot/all_runs_unseen' unseen_image_folder = './data/omniglot/images...
StarcoderdataPython
3286367
from sqlite3 import IntegrityError, Row from riego.db import get_db import aiohttp_jinja2 from aiohttp import web from aiohttp_session import get_session import bcrypt import secrets import json import asyncio from logging import getLogger _log = getLogger(__name__) router = web.RouteTableDef() ...
StarcoderdataPython
3262033
<gh_stars>0 # execute simulation script with all TOLERANCE combinations ###################################################################################### # very important: linSol, nonLinSolIter, solAlg must be their corresponding integers # # ...
StarcoderdataPython
3371965
<reponame>Sprith/greyatom-python-for-data-science<filename>Project-:-Loan-Approval-Analysis/code.py # -------------- import pandas as pd bank = pd.read_csv(path) categorical_var = bank.select_dtypes('object') print(categorical_var) numerical_var = bank.select_dtypes('number') print(numerical_var) # -----...
StarcoderdataPython
98509
import os def init(): """ Load IDs of all available batteries and their capacity :return: battery_config (Dict containing the battery id and its size """ battery_config = {} for item in os.listdir('/sys/class/power_supply/'): if os.path.isdir(os.path.join('/sys/class/power_supply/', i...
StarcoderdataPython
77350
# GENERATED BY KOMAND SDK - DO NOT EDIT import komand import json class Input: ASSIGNEE = "assignee" ATTRIBUTES = "attributes" DUE_DATE = "due_date" ESCALATED = "escalated" ESCALATEE = "escalatee" ESCALATION_DATE = "escalation_date" NAME = "name" OVERDUE = "overdue" REMINDED = "rem...
StarcoderdataPython
3344533
<reponame>timgates42/pex # Copyright 2015 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). import os from argparse import ArgumentParser from contextlib import contextmanager from tempfile import NamedTemporaryFile import pytest from pex.bin.pex import...
StarcoderdataPython
3200601
from __future__ import absolute_import from __future__ import division from __future__ import print_function from camera import Camera from control_panel import ControlPanel import time import kivy from kivy.config import Config Config.set('graphics', 'width', '1920') Config.set('graphics', 'height', '1080') #Config....
StarcoderdataPython
3234045
"""Testing the base """ import os import pytest from vectorai.models import * from appdirs import * def test_start_utils_mixin(): utils_func = EmbedMixin() assert True def check(): """Dummy function""" return 1 def test_save_function(): """Test adding an embedding function""" mixin = Embed...
StarcoderdataPython
108327
<filename>week03/test17.py<gh_stars>0 import requests from bs4 import BeautifulSoup page = requests.get("https://www.myhome.ie/residential/mayo/property-for-sale?page=1") soup = BeautifulSoup(page.content, 'html.parser') # print (soup.prettify()) listings = soup.findAll("div", class_="PropertyListingCard" ) ...
StarcoderdataPython
21311
def foo(x=Non<caret>):
StarcoderdataPython
3360636
import os from getmodule.get_collector_executer import GetCollectorExecuter from getmodule.get_collector import GetCollector from getmodule.get_list_analyzer import GetListAnalyzer from getmodule.get_detail_collector import GetDetailCollector from getmodule.csv_util import CsvWriter from getmodule.file_path_util impor...
StarcoderdataPython
140727
import logging import asyncio import grpc import products_pb2 import products_pb2_grpc GRPC_HOST_PORT = 'localhost:8080' async def main(): async with grpc.aio.insecure_channel(GRPC_HOST_PORT) as channel: stub = products_pb2_grpc.ProductServiceStub(channel) response = await stub.GetV...
StarcoderdataPython
1619793
<reponame>thehanemperor/LeetCode class Solution: def pathSum(self, root: TreeNode, sum: int) -> List[List[int]]: result = [] self.dfs(root,sum,[],result) return result def dfs(self,root,total,tmp,result): if not root: return if not root.left and not ...
StarcoderdataPython
1695132
from setuptools import setup setup( name='mls', version='0.1', description='Material for UCI course "ML & Statistics for Physicists"', url='http://github.com/dkirkby/MachineLearningStatistics', author='<NAME>', author_email='<EMAIL>', license='BSD3', packages=['mls'], install_requir...
StarcoderdataPython
3339080
#!/usr/bin/env python """ -------------------------------------------------------------------------------- Created: <NAME> 2/19/14 This script reads a tab-delimited otu table file containing relative abundance and makes a simple heatmap of this data. The tab-delimited otu is of raw counts. The program will compu...
StarcoderdataPython
16328
<reponame>google-cloud-sdk-unofficial/google-cloud-sdk # -*- coding: utf-8 -*- # # Copyright 2019 Google LLC. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http:...
StarcoderdataPython
1609983
from ..utils import choose_weighted_option from ..classes import * from ..meta_classes import DataSetProperties, PersonStyleWeightDistribution, ProductStyleWeightDistribution def product_style_function(product_styles_distribution: ProductStyleWeightDistribution) -> ProductStyleVector: return choose_weighted_optio...
StarcoderdataPython
88276
#!/bin/python from arroguella import game def main(): game.run() if __name__ == '__main__': main()
StarcoderdataPython
1781451
<reponame>ivteplo/json-to-yaml-compiler #!/usr/bin/env python3 # # Copyright (c) 2020 <NAME> # Licensed under the Apache License, version 2.0 # import os import shutil from pathlib import Path implementations_path = Path(__file__).parent.parent / "Implementations" implementations_folders = [] for (dirpath, dirnames...
StarcoderdataPython
3383685
<filename>pt-1/sem_4/6.sem4_ex4_factorial.py def main(): num = int(input("Digite o número que deseja obter o fatorial: ")) fat = 1 if num == 0: print("1") while (num > 0): fat = fat * num num = num - 1 print(fat) main()
StarcoderdataPython
1683827
<reponame>MuhammedHasan/pyranges<filename>pyranges/methods/itergrs.py import pandas as pd from collections import defaultdict def itergrs(prs, strand=None, keys=False): if strand is None: strand = all([gr.stranded for gr in prs]) if strand is False and any([gr.stranded for gr in prs]): prs ...
StarcoderdataPython