id stringlengths 1 7 | text stringlengths 6 1.03M | dataset_id stringclasses 1
value |
|---|---|---|
70252 | <reponame>HaardikBhagtani/healthy
from time import time
from musiconloop import musiconloop
from lognow import log_now
print("Welcome to the Beautiful Day")
user_name = input("Enter Your name\n").capitalize()
if __name__ == '__main__':
init_water = time()
init_eyes = time()
init_exercise = time()
wat... | StarcoderdataPython |
1777309 | <filename>src/qcar/src/qcarnode.py
#!/usr/bin/env python3
from __future__ import division, print_function, absolute_import
import rospy
import numpy as np
from qcar.product_QCar import QCar
from qcar.q_interpretation import *
from std_msgs.msg import String, Float64
from geometry_msgs.msg import Vector3Stamped
from ... | StarcoderdataPython |
1610603 | <reponame>ogorodnikov/m1
import signal
# https://stackoverflow.com/questions/492519/timeout-on-a-function-call
def plot_timeout_handler(signal_number, stack_frame):
raise TimeoutError(f"Plot timeout: {PLOT_STATEVECTOR_TIMEOUT} seconds")
def plot_statevector_figure(task_id, statevector):
... | StarcoderdataPython |
3319805 | <filename>orders/tasks.py
from celery import task
from django.core.mail import send_mail
from .models import Order
@task
def order_created(order_id):
"""Task to send and email notification when an order is succesfully created."""
order = Order.objects.get(id=order_id)
subject = f'Order nr. {order_id}'
... | StarcoderdataPython |
1668399 | from .sql_database_backend_service import SqlDatabaseBackendService # noqa
from .sql_occ_locker_backend_service import SqlOccLockerBackendService # noqa
| StarcoderdataPython |
3320946 | <gh_stars>0
class LoggingMixin():
"""
Mixin class with methods for logging of configurations.
"""
def get_option_and_log(self, key):
value = self.get_option(key)
self.config.log(f"{self.configuration_key}.{key} set to {value}")
return value
| StarcoderdataPython |
98570 | <reponame>DataCanvasIO/tabular-toolbox<gh_stars>1-10
# -*- coding:utf-8 -*-
__author__ = 'yangjian'
"""
"""
import copy
import time
import dask
import dask.array as da
import dask.dataframe as dd
import numpy as np
import pandas as pd
from lightgbm.sklearn import LGBMClassifier
from sklearn import model_selection as ... | StarcoderdataPython |
136135 | <gh_stars>100-1000
def append_text(new_text):
'''
Write the code instruction to be exported later on
Args.
new_text (str): the text that will be appended to the base string
'''
global code_base_text
code_base_text = code_base_text + new_text | StarcoderdataPython |
147198 | """
Represent classes found in European Medicines Agency (EMA) documents
"""
class SectionLeaflet:
"""
Class to represent individual section of a Package Leaflet
"""
def __init__(self, title, section_content, entity_recognition=None):
self.title = title
self.section_conten... | StarcoderdataPython |
157458 | from pyULIS4 import *
import math
# Keep in mind the coordinate system
# starts at (0;0) in the bottom left
# corner, since we are working in an
# OpenGL context.
pool = FThreadPool()
queue = FCommandQueue( pool )
fmt = Format_RGBA8
ctx = FContext( queue, fmt )
canvas = FBlock( 800, 600, fmt )
temp = F... | StarcoderdataPython |
3291840 | <reponame>Festusali/django-browser-reload<filename>tests/test_middleware.py
from __future__ import annotations
from django.http import HttpRequest, HttpResponse, StreamingHttpResponse
from django.test import RequestFactory, SimpleTestCase, override_settings
from django_browser_reload.middleware import BrowserReloadMi... | StarcoderdataPython |
1737111 | import pytest
from app import tasks
pytestmark = [
pytest.mark.django_db,
]
@pytest.fixture(autouse=True)
def mass_update_subscription(mocker):
return mocker.patch('app.integrations.mailchimp.client.AppMailchimp.mass_update_subscription')
@pytest.fixture(autouse=True)
def set_tags(mocker):
return mock... | StarcoderdataPython |
86764 | <reponame>tdimnet/integrations-core
# (C) Datadog, Inc. 2021-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import click
from ...console import CONTEXT_SETTINGS
from .pdh import pdh
ALL_COMMANDS = [pdh]
@click.group(context_settings=CONTEXT_SETTINGS, short_help='Windows ut... | StarcoderdataPython |
65117 | from seleniumbase import MasterQA
class MasterQATests(MasterQA):
def test_xkcd(self):
self.open("https://xkcd.com/1512/")
for i in range(4):
self.click('a[rel="next"]')
for i in range(3):
self.click('a[rel="prev"]')
self.verify()
self.open("https://... | StarcoderdataPython |
4801184 | <gh_stars>0
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
from ...sipmessaging import SIPHeaderField
from ...sipmessaging import classproperty
class DateSIPHeaderField(SIPHeaderField):
# noinspection PyNestedDecorators
@classproperty
@classmethod
def can... | StarcoderdataPython |
1702784 | <reponame>MasterMeng/PKCS11_example
from PyKCS11 import *
# import ptvsd
# ptvsd.enable_attach(address=('0.0.0.0', 5678))
# ptvsd.wait_for_attach()
aes_iv = [0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f]
class OpenCryptoKi:
def __init__(self, libpath)... | StarcoderdataPython |
121108 | # valueIterationAgents.py
# -----------------------
# Licensing Information: Please do not distribute or publish solutions to this
# project. You are free to use and extend these projects for educational
# purposes. The Pacman AI projects were developed at UC Berkeley, primarily by
# <NAME> (<EMAIL>) and <NAME> (<EMAIL... | StarcoderdataPython |
4810276 | <filename>work/03_load_sql.py
#!/usr/bin/python3
import psycopg2
# connect to database
connect_str = 'host=postgres port=5432 dbname=bakery user=postgres password=<PASSWORD>'
conn = psycopg2.connect(connect_str)
conn.autocommit = True
cursor = conn.cursor()
# execute sql script
sql_file = open('bakery.sql', 'r')
sql... | StarcoderdataPython |
3366977 | <gh_stars>0
# Generated by Django 3.0.8 on 2020-07-14 08:55
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accounts', '0002_client_instansi'),
]
operations = [
migrations.AlterField(
model_name='client',
name='i... | StarcoderdataPython |
1709905 | from typing import Tuple
import tensorflow as tf
from tensorflow.python.ops import gen_array_ops
def decode_png(filename: str, channels: int = 1):
"""
Read image from `filename` with `channels`.
Parameters
----------
filename : str
A filename to read.
channels : int, optional
... | StarcoderdataPython |
1790102 | import asyncio
def flatten(to_flatten):
return list(flatten_generator(to_flatten))
def flatten_generator(to_flatten):
return (
item
for sub_list_or_generator in to_flatten
for item in sub_list_or_generator
)
async def repeat_until_cancelled(context, exception_intervals, to_repe... | StarcoderdataPython |
4837678 | from datetime import date
from pathlib import Path
import re
import sys
from typing import Tuple
from invoke import task
TOP_DIR = Path(__file__).parent.resolve()
def update_file(filename: str, sub_line: Tuple[str, str], strip: str = None):
"""Utility function for tasks to read, update, and write files"""
... | StarcoderdataPython |
18039 | #!/usr/bin/env python
#
# Creates resources
# This script creates VPC/security group/keypair if not already present
import logging
import os
import sys
import time
from . import aws_util as u
from . import util
DRYRUN = False
DEBUG = True
# Names of Amazon resources that are created. These settings are fixed across
... | StarcoderdataPython |
4815304 | <reponame>Ricyteach/candemachine
def process(ilines):
pass | StarcoderdataPython |
163686 | <filename>packages/pyre/h5/Schema.py<gh_stars>0
#-*- coding: utf-8 -*-
#
# <NAME> <<EMAIL>>
# (c) 1998-2022 all rights reserved
# superclass
from pyre.patterns.AttributeClassifier import AttributeClassifier
# the base class for my descriptors
from .Identifier import Identifier
# dataset harvester
class Schema(Attri... | StarcoderdataPython |
1669209 | import ujson
with open("config.json") as f:
CONFIG = ujson.load(f)
| StarcoderdataPython |
1701156 | <reponame>01studio-lab/MicroPython_Examples
'''
实验名称:水位传感器
版本:v1.0
日期:2021.5
作者:01Studio 【www.01Studio.org】
开发平台:01Studio 达芬奇
说明:通过水位传感器对水位测量并显示。
'''
#导入相关模块
from machine import Pin, ADC
from tftlcd import LCD43R
import time
#定义常用颜色
WHITE=(255,255,255)
BLACK = (0,0,0)
BLUE=(0,0,255)
#初始化LCD
d=LCD43R()
d.fill(WHITE)#... | StarcoderdataPython |
1436 | import requests
from bs4 import BeautifulSoup
import urllib.request
import os
import random
import time
def html(url):
user_agents = [
'Mozilla/5.0 (Windows; U; Windows NT 5.1; it; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11',
'Opera/9.25 (Windows NT 5.1; U; en)',
'Mozilla/4.0 (compatible... | StarcoderdataPython |
1741749 | <reponame>drcrook1/iot_edge_starter<filename>EdgeSolution/modules/SampleModule/sample_module.py<gh_stars>0
"""
@Author: <NAME>
@Copyright: Microsoft Corporation 2022
"""
from enum import Enum
import logging
import asyncio
from azure.iot.device.aio import IoTHubModuleClient
from azure.iot.device import MethodResponse
... | StarcoderdataPython |
1709723 | <gh_stars>0
from ConfigLoader import ConfigLoader
import numpy as np
from numpy import linalg as LA
from Plotter import Plotter
class FindEquilibria:
'''
this class implements the algorithms to find the equilibria of the system
'''
def __init__(self):
config = ConfigLoader()
self.config... | StarcoderdataPython |
147918 | <filename>tests/mock-webserver.py
#!/usr/bin/env python
'''
A bottle+gevent based webservice suitable for testing CoCrawler
'''
try:
from gevent import monkey
monkey.patch_all()
except ImportError:
print('gevent not present; that\'s OK for test purposes')
pass
import os
import random
from bottle impor... | StarcoderdataPython |
1737054 | import random
import time
import matplotlib.pyplot as plt
# ------------------------------------------------------------------------------
def objective_function(O):
x = O[0]
y = O[1]
nonlinear_constraint = (x - 1) ** 3 - y + 1
linear_constraint = x + y - 2
if nonlinear_constraint > 0:
penal... | StarcoderdataPython |
3365406 | <reponame>sacherjj/array_devices<gh_stars>1-10
from .array3710 import Load, Program, ProgramStep | StarcoderdataPython |
15177 | <gh_stars>0
# -*- coding: utf-8 -*-
"""
Created on Sat Feb 24 23:18:54 2018
@author: Rupesh
"""
# Multiple Linear Regression
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
plt.style.use("ggplot")
# loading dependies
df = pd.read_csv("50_Startups.csv")
df.head()
X = d... | StarcoderdataPython |
3323415 | '''
Created on Aug 21, 2014
@author: moloyc
'''
import os
import sys
sys.path.insert(0,os.path.abspath(os.path.dirname(__file__) + '/' + '../..')) #trick to make it run from CLI
import unittest
from jnpr.openclos.util import *
class TestFunctions(unittest.TestCase):
def setUp(self):
pass
def tearDo... | StarcoderdataPython |
1655872 | import random
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import onqg.dataset.Constants as Constants
from onqg.models.modules.Attention import ConcatAttention
from onqg.models.modules.MaxOut import MaxOut
from onqg.models.modules.DecAssist import StackedRNN,... | StarcoderdataPython |
78232 | <filename>non_semantic_speech_benchmark/eval_embedding/finetune/models_test.py<gh_stars>1-10
# coding=utf-8
# Copyright 2022 The Google Research 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 ... | StarcoderdataPython |
1769703 | """
Lhs functions are inspired by
https://github.com/clicumu/pyDOE2/blob/
master/pyDOE2/doe_lhs.py
"""
import numpy as np
from sklearn.utils import check_random_state
from scipy import spatial
from ..space import Space, Categorical
from .base import InitialPointGenerator
def _random_permute_matrix(h, random_state=Non... | StarcoderdataPython |
163915 | from pytest import raises, warns
from bidso.find import find_in_bids, find_root, _generate_pattern
from .paths import BIDS_PATH, task_ieeg
filename = task_ieeg.get_filename(BIDS_PATH)
def test_find_root():
assert find_root(filename).name == 'bids'
assert find_root(filename, target='subject').name == 'sub-be... | StarcoderdataPython |
4820252 | <filename>example/blog/models.py<gh_stars>1-10
# coding: utf-8
from __future__ import unicode_literals
import random
try:
from django.urls import reverse
except ImportError:
from django.core.urlresolvers import reverse
from django.utils.encoding import python_2_unicode_compatible
from django.db import models
... | StarcoderdataPython |
1768616 | <gh_stars>0
# Array; Greedy; Queue
# Given a char array representing tasks CPU need to do. It contains capital letters A to Z where different letters represent different tasks.Tasks could be done without original order. Each task could be done in one interval. For each interval, CPU could finish one task or just be id... | StarcoderdataPython |
19089 | <filename>src/arch/riscv/RiscvCPU.py<gh_stars>1-10
# Copyright 2021 Google, Inc.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyright
# notice, this list of co... | StarcoderdataPython |
41488 | try:
print('enter try statement')
raise Exception()
print('exit try statement')
except Exception as inst:
print(inst.__class__.__name__)
| StarcoderdataPython |
1783722 | #!/usr/bin/env python3
from scipy.stats import kendalltau
from sklearn.metrics import accuracy_score, recall_score
import numpy as np
def get_combined_score(pr_mean, tr_mean, rr_std, pred_ids, labels):
'''
Get combined performance score
'''
k_pr_mean = kendalltau(pr_mean, labels[:, 0])[0]
k_tr_m... | StarcoderdataPython |
3320849 | # -*- coding: utf-8 -*-
"""
Created on Thu Apr 16 13:32:08 2020
@author: ingvord
"""
from flask import request
from flask_restful import Resource
from functools import reduce
import time
class PiController(Resource):
def get(self, id):
return {'version': request.pi_device.qVER()}
class PiControllerSer... | StarcoderdataPython |
1739155 | <reponame>xuziheng1002/django-river<gh_stars>0
from __future__ import unicode_literals
from django.db import models, transaction
from django.db.models import PROTECT
from django.db.models.signals import post_save, pre_delete
from django.utils.translation import ugettext_lazy as _
from river.config import app_config
f... | StarcoderdataPython |
96115 | import os
import datetime
import subprocess
import os.path
def normalize_time(month, day, hour, minute, round_to_nearest_5m=True):
if int(month) <= 9:
month = "0" + month
if int(day) <= 9:
day = "0" + day
if int(hour) <= 9:
hour = "0" + hour
if int(minute) <= 9:
minute ... | StarcoderdataPython |
3218230 | <reponame>hettlage/salt-data-quality-site
def title():
return ''
def content():
return 'This is a placeholder for plots displaying telescope statistics for a week.'
| StarcoderdataPython |
1636244 | # noqa
if __name__ == "__main__":
from dotenv import load_dotenv
load_dotenv('.flaskenv')
from robotehr.models import Base, engine
from robotehr.models.cohort import *
from robotehr.models.training import *
from robotehr.models.data import *
from robotehr.models.predictor import *
Bas... | StarcoderdataPython |
4809336 | <reponame>sergiors/pyramda<gh_stars>100-1000
from .assert_dicts_equal import assert_dicts_equal
from .assert_domain import assert_in_domain, assert_not_in_domain
from .assert_equal import assert_equal, assert_not_equal
from .assert_iterables_equal import assert_iterables_equal
from .assert_pred import assert_pred_cases... | StarcoderdataPython |
3201779 | import copy
from zopeskel import abstract_buildout
from zopeskel.base import var, EASY, EXPERT
from zopeskel.vars import StringVar, StringChoiceVar
class SilvaBuildout(abstract_buildout.AbstractBuildout):
_template_dir = 'templates/silva_buildout'
summary = "A buildout for Silva projects"
help = """
This... | StarcoderdataPython |
118975 | """Incorporate ETH Zurich's BIWI (EWAP) dataset into simple gridworld."""
import os
from pathlib import Path
from matplotlib.image import imread
import matplotlib.pyplot as plt
import numpy as np
from .simple_gw import SimpleGridworld
# Grid constants
OBSTACLE = 2
GOAL = 6
PERSON = 9
ROBOT = 15
class EwapDataset:
... | StarcoderdataPython |
3233847 | <filename>PackageTests/test_namespace.py
import unittest
import spelling
class TestNameSpace(unittest.TestCase):
def test_predict(self):
# As such because the built in model is not trained, only all words are added
self.assertIn(spelling.predict("bway"), ["way", "bay", "away", "sway", "tway", "br... | StarcoderdataPython |
191719 | <reponame>huawei-cloud/compass<filename>compass/tests/config_management/utils/test_config_merger_callbacks.py
import unittest2
from compass.config_management.utils import config_merger_callbacks
from compass.config_management.utils import config_reference
class TestAssignRoles(unittest2.TestCase):
def test_assig... | StarcoderdataPython |
173619 | from sys import maxsize
class Contact:
def __init__(self, first_name=None, middle_name=None, last_name=None, nick_name=None, title=None, company=None, address=None, home_phone=None,
mobile_phone=None, work_phone=None, fax=None, email=None, email2=None, email3=None, home_page=None, bday=None, bmon... | StarcoderdataPython |
3238314 | # Copyright 2017 The TensorFlow Authors All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | StarcoderdataPython |
82535 | <reponame>misads/torch_image_template
import os
tags = ['fold_1', 'fold_2']
for tag in tags:
cmd = "python3 test.py --load %s" % tag
print(cmd)
os.system(cmd)
| StarcoderdataPython |
96295 | from arcgis import GIS
from arcgis.features import GeoAccessor, GeoSeriesAccessor
import arcpy
from arcpy import env
from arcpy.sa import *
import numpy as np
import os
import pandas as pd
#####
arcpy.env.overwriteOutput = True
arcpy.CheckOutExtension("Spatial")
def select_feature_by_attributes_arcgis(input,Attri_NM... | StarcoderdataPython |
91339 | <reponame>Slewentogzz/hk_ros_2021<filename>hk_ros_2021/scripts/scan.py
#! /usr/bin/env python
import rospy
from sensor_msgs.msg import LaserScan
from darknet_ros_msgs.msg import BoundingBoxes
import tf2_ros
import tf2_msgs.msg
import geometry_msgs.msg
#def callback(msg):
#class animal_pos:
# def __init__(self):
# ... | StarcoderdataPython |
3382903 | from .utils import getNormBackground, getNormBackground, getNormBackground
| StarcoderdataPython |
1675208 | from request_validation import BaseValidator, RequestParamError, add_into_dtype_map
@add_into_dtype_map
class CommaStringListValidator(BaseValidator):
dtype = "commalist"
def _validate(self, data):
if self.dtype is not str:
raise RequestParamError(f"{self._log_prefix} need to be string")
... | StarcoderdataPython |
4810216 | <reponame>rexzhang/ddns-clienter
from dataclasses import dataclass, asdict as dataclass_as_dict
from datetime import timedelta
from logging import getLogger
from django.conf import settings
from django.forms.models import model_to_dict
from django.utils import timezone
from ddns_clienter_core.constants import Address... | StarcoderdataPython |
3323250 | <filename>scripts/3_training/train.py
import os
import sys
curr_path = os.getcwd()
package_path = (os.path.abspath(os.path.join(curr_path, os.pardir))).replace('\\', '/')+'/'
sys.path.insert(1, package_path)
from config.config import *
from processing_scripts.model_preprocessing import *
df_full= pd.read_csv(Tra... | StarcoderdataPython |
1761933 | <filename>test_logtailer.py
import unittest
import logtailer
class TestConstructor(unittest.TestCase):
def setUp(self):
self.matches = []
self.tail = logtailer.Tail("test_file.txt", [])
def dummy_callback_function(self, index, matched_pattern):
self.matches.append({index, matched_pat... | StarcoderdataPython |
179016 | <gh_stars>0
#/usr/bin/env python3
'''
这是书中1.5节的练习3
创建一些词汇列表,比如,冠词("the", "a"等)、主题("cat", "dog", "man", "woman")、动词(“sang”, "ran", "jumped")与状语("loudly", "quietly", "well")等,
之后循环5次,每次迭代中,使用random.choice()函数选取冠词、主题、动词、状语等内容。
使用random.randint()函数在两种语句结构之间进行选择:
冠词、主题、动词、状语;
只包括冠词、主题与动词,之后打印语句。
输入:awfulpoe... | StarcoderdataPython |
4832260 | <reponame>Hadrien-Montanelli/chebpy<gh_stars>1-10
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 2 15:37:10 2020
Copyright 2020 by <NAME>.
"""
# %% Imports.
# Standard library import:
from math import pi
import numpy as np
# Chebpy imports:
from chebpy.trig import coeffs2vals, trigpts, vals2c... | StarcoderdataPython |
3388943 | <filename>python/add_pixscale.py
"""
Does exactly what the name says, adds a pixel scale (given in arcsec/pix) to
a fits file. This code does _not_ change the crpix or crval -- only the
pixel scale.
"""
import sys
import glob
from astropy.io import fits as pf
""" Check the command line syntax """
if len(sys.argv) < ... | StarcoderdataPython |
90149 | #!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
# This file is only used if you use `make publish` or
# explicitly specify it as your config file.
import os
import sys
sys.path.append(os.curdir)
from pelicanconf import *
SITEURL = 'https://ankursinha.in'
FEED_DOMAIN = SITEURL... | StarcoderdataPython |
78557 | <gh_stars>0
# 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 ... | StarcoderdataPython |
1755346 | <filename>moler/cmd/unix/gunzip.py
# -*- coding: utf-8 -*-
"""
Gunzip command module.
"""
__author__ = '<NAME>'
__copyright__ = 'Copyright (C) 2018, Nokia'
__email__ = '<EMAIL>'
from moler.cmd.unix.genericunix import GenericUnixCommand
from moler.exceptions import CommandFailure
from moler.exceptions import ParsingDo... | StarcoderdataPython |
1767624 | <reponame>CD3/BaseballSimulator
# from .Simulator import *
# from .Pitchers import *
| StarcoderdataPython |
3340738 | class NewRecreationPage():
def __init__(self, page):
self.page = page
def open(self):
self.page.goto("/places/new")
| StarcoderdataPython |
1640932 | <filename>reddit_user.py
# -*- coding: utf-8 -*-
import csv
import datetime
import re
import json
import time
import sys
import calendar
from collections import Counter
from itertools import groupby
from urlparse import urlparse
import requests
import pytz
from subreddits import subreddits_dict, ignore_text_subs, de... | StarcoderdataPython |
118402 | DynamoTable # unused import (dynamo_query/__init__.py:8)
DynamoRecord # unused variable (dynamo_query/__init__.py:12)
create # unused function (dynamo_query/data_table.py:119)
memo # unused variable (dynamo_query/data_table.py:137)
filter_keys # unused function (dynamo_query/data_table.py:299)
get_column # unused... | StarcoderdataPython |
1628739 | <filename>hyperts/utils/tstoolbox.py
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split as sklearn_tts
from hypernets.tabular.toolbox import ToolBox
from hyperts.utils import tscvsplit, ensemble
from hyperts.utils import consts, metrics as metrics_
from hyperts.utils.holidays... | StarcoderdataPython |
1655707 | <filename>multiexplorer/wallet/migrations/0005_delete_cachedtransaction.py<gh_stars>10-100
# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-04-25 01:12
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('wallet', '... | StarcoderdataPython |
81707 | <gh_stars>10-100
# -*- coding: utf-8 -*-
from datetime import timedelta
from django.http import HttpResponse
from django.template import RequestContext
from django.shortcuts import render_to_response
from django.contrib.auth.decorators import login_required
from gui.utils import parse_date_range, country_sites
from ... | StarcoderdataPython |
20397 | import torch
import numpy as np
PAD_TOKEN_INDEX = 0
def pad_masking(x, target_len):
# x: (batch_size, seq_len)
batch_size, seq_len = x.size()
padded_positions = x == PAD_TOKEN_INDEX # (batch_size, seq_len)
pad_mask = padded_positions.unsqueeze(1).expand(batch_size, target_len, seq_len)
return pa... | StarcoderdataPython |
55179 | from django.apps import AppConfig
class RealmConfig(AppConfig):
name = 'etools_permissions'
| StarcoderdataPython |
1770429 | <filename>arxiv_latex_cleaner.py
# coding=utf-8
# Copyright 2018 The Google Research 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.... | StarcoderdataPython |
1687307 | # This file is part of rinohtype, the Python document preparation system.
#
# Copyright (c) <NAME>.
#
# Use of this source code is subject to the terms of the GNU Affero General
# Public License v3. See the LICENSE file or http://www.gnu.org/licenses/.
import os
from os import path
import docutils
from docutils.nod... | StarcoderdataPython |
4823462 | <reponame>Puriney/scanpy
try:
from bbknn import bbknn
except ImportError:
def bbknn(*args, **kwargs):
raise ImportError('Please install BBKNN: `pip3 install bbknn`')
| StarcoderdataPython |
1749910 | import numpy as np
def merge_data(data, metric):
merged_outcomes = {}
for key in data.keys():
results = data[key]
if metric == 1:
merged_outcomes[key] = list(map(np.mean, zip(*results)))
if metric == 2:
merged_outcomes[key] = list(map(min, zip(*results)))
... | StarcoderdataPython |
3290797 | <reponame>lowrybg/PythonAdvanced
def concatenate(*args):
return ''.join(args)
print(concatenate("Soft", "Uni", "Is", "Great", "!")) | StarcoderdataPython |
98287 | #!/usr/bin/env python
"""
MiP Sound tester.
To Use:
mip_test_sound.py -i hci0 -b D0:39:72:C4:7A:01 -s <n>
<n> 1 - 106
1 = beep
2 = burp
3 = ewwp - ah
4 = la la la la (lower)
5 = small raspberry?
6 = rerrr
7 = punching sound
8 = punching sound
9 = harder punching sound
10 = lep
11 = lep
12 = lep
13 = lep
14 = ahhh! (in... | StarcoderdataPython |
3375382 | # Importing boto3, pickle
import boto3
import _pickle as pickle
# Creating the connection
ec2Client = boto3.client('ec2',
region_name='ap-south-1'
)
ec2 = boto3.resource('ec2',
region_name='ap-south-1',
)
# Check... | StarcoderdataPython |
51763 | <reponame>marcgarrofe/Twitter-Sentiment-Analysis
import pandas as pd
import numpy as np
def count_class_type(dataset: pd.DataFrame, column_label: str):
"""
Counts de class type of the dataset
:param dataset: Input data
:param column_label: Name of the column to be analyzed
"""
assert dataset.s... | StarcoderdataPython |
3374929 | <filename>tests/test_pandas.py
import os
import bln
import pandas as pd
bln.pandas.register(pd)
def test_pandas_read():
"""Test the `read_bln` method."""
project_id = "UHJvamVjdDpiZGM5NmU1MS1kMzBhLTRlYTctODY4Yi04ZGI4N2RjMzQ1ODI="
file_name = "ia.csv"
tier = os.getenv("BLN_TEST_ENV", "dev")
df = ... | StarcoderdataPython |
174996 | from apiclient import errors
from apiclient.http import BatchHttpRequest
class Gmail(object):
def __init__(self, http, service):
self.connected = False
self.labels = {}
self.events = {
'on_message': []
}
self._http = http
self._service = service
... | StarcoderdataPython |
6782 | from selenium import webdriver
from time import sleep
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait
def Dm(driver,user,message):
''' This functio... | StarcoderdataPython |
76806 | <gh_stars>0
from flask import Blueprint, render_template, url_for, flash, redirect, session, request
from werkzeug.security import generate_password_hash, check_password_hash
from forms import UserForm, NewsForm
from functools import wraps
from application import db
from modules import User, News
from datetime import d... | StarcoderdataPython |
1775058 | <gh_stars>1-10
import cv2
from plantcv.plantcv import rgb2gray
def test_rgb2gray(test_data):
"""Test for PlantCV."""
# Read in test data
img = cv2.imread(test_data.small_rgb_img)
gray_img = rgb2gray(rgb_img=img)
# Assert that the output image has the dimensions of the input image but is only a sin... | StarcoderdataPython |
69877 | import re
import pytest
import responses
from quickbuild import QBError
DASHBOARDS_XML = r"""<?xml version="1.0" encoding="UTF-8"?>
<list>
<com.pmease.quickbuild.model.Dashboard>
<id>1</id>
<user>1</user>
<name>Default</name>
<description>System default dashboard</description>
<primary>false</... | StarcoderdataPython |
3392951 | <filename>server/inv/site.py
from flask import Blueprint, redirect, url_for, render_template
site = Blueprint('site',__name__,template_folder='templates')
@site.route('/', methods=['GET'])
def home():
return redirect(url_for('site.about'))
@site.route('/about', methods=['GET'])
def about():
return render_templat... | StarcoderdataPython |
1621581 | from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from flier.admin import register
from flier.utils import render
class MailAdmin(admin.ModelAdmin):
list_filter = ('status', )
list_excludes = ('body', 'html', )
list_additionals = ('instance_link', )
readonly_fiel... | StarcoderdataPython |
160498 | #!/usr/bin/env /Users/alexrudy/.pyenv/versions/bitly-boto/bin/python
import subprocess
import click
import re
import tempfile
import shlex
import os
import typing as t
from pathlib import Path
from collections import OrderedDict
@click.command()
@click.option(
"--name", type=str, help="Name of the GCE instance t... | StarcoderdataPython |
3299655 | """Comment CRUD functionality"""
from app.api.v2.dbmodel import QuestionerDb
class CommentModel:
"""Comment class model"""
def create_comment(self, question, comment):
"""Method to create a comment"""
comment_query = """INSERT INTO comments
(question, comment)
VALUES (%s, %s)
... | StarcoderdataPython |
144508 | <gh_stars>0
import os
import re
import sys
import subprocess
# Use the official chef lex file
# Compile from source each time
path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'swedish_chef.l')
COMPILE_CMD = "lex -o /tmp/swedish_chef.c {0} && cc /tmp/swedish_chef.c -o /tmp/swedish_chef -ll".format(path... | StarcoderdataPython |
1739710 | #!/usr/bin/env python3
import argparse
import os
import sys
import json
import numpy as np
PROG = os.path.basename(sys.argv[0])
def main():
parser = argparse.ArgumentParser(
description='Fix a raman.json file created before 99e7a42a5 (June 14)',
)
parser.add_argument('INPUT', nargs='*')
parse... | StarcoderdataPython |
4818816 | from . import basicauth, jwt
from .. import exceptions
token_identifiers = [
jwt.parse,
basicauth.parse,
]
def identify(region, service, headers):
for fn in token_identifiers:
try:
return fn(region, service, headers)
except exceptions.Unsigned:
continue
raise... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.