id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
1636066 | <gh_stars>1-10
# Main Types of Regression Tables
| StarcoderdataPython |
32165 | <filename>bin/v0eval.py
#!/usr/bin/env python3
# coding: utf-8
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib import gridspec
import datetime, time
from scipy.signal import savgol_filter
from scipy.interpolate import interp1d, Akima1DInterpolator, PchipInterpolator
from sys impo... | StarcoderdataPython |
184778 | <reponame>Pythocrates/pyfluence
# -*- coding: utf-8 -*-
import shutil
from http.cookiejar import CookiePolicy
import requests
class Session:
class NoCookies(CookiePolicy):
''' A cookie policy blocking any cookies, thus enabling us to use
request.prepare_cookies, which does not overwrite existing... | StarcoderdataPython |
124853 | from django.db import models
# Create your models here.
class PolicyCreation(models.Model):
policyname= models.CharField(max_length=100)
description= models.TextField()
def __str__(self):
return self.policyname | StarcoderdataPython |
1602253 | <reponame>Prakyathkantharaju/bayes-skopt
import numpy as np
from scipy.integrate import quad
__all__ = ["make_roundflat"]
def make_roundflat(
lower_bound=0.1,
upper_bound=0.6,
lower_steepness=2.0,
upper_steepness=8.0,
integration_bounds=(0.0, 10.0),
):
"""Construct a round-flat prior with a c... | StarcoderdataPython |
3220895 |
student_list = []
def CreateStudent():
name = input("Please enter the new student's name: ")
student_data = {
'name': name,
'marks': []
}
return student_data
def AddMark(student, mark):
student['marks'].append(mark)
def CalculateAverageMark(student):
number = len(student[... | StarcoderdataPython |
3294494 | # 给定一个不超过5位的正整数,判断该数的位数,依次打印出十位,百位千位,万位的数字
num = int(input(':>> '))
length = len(str(num))
if num < 100000 and num>=0:
for x in range(length):
print(num%10)
num //= 10
num = int(input(':>> '))
length = len(str(num))
if num < 100000 and num >= 0:
for x in range(length):
tmp = num // 1... | StarcoderdataPython |
1604311 | #!/usr/bin/python
import fileinput
import string
import sys
import os
def perm_to_string(perm):
A = perm[0]
B = perm[1]
C = perm[2]
D = perm[3]
return A+B+C+D
def get_omp_info(OpenMP):
if OpenMP:
name = 'omp'
text = 'with OpenMP'
else:
name = 'ser'
text = ... | StarcoderdataPython |
4820208 | <reponame>OrionDark7/Pyweek31
import pygame, random
from game.map import builds, foods
class Object(pygame.sprite.Sprite):
def __init__(self, type, pos):
pygame.sprite.Sprite.__init__(self)
self.type = str(type)
self.pos = list(pos)
self.image = pygame.image.load("./images/tiles/"+s... | StarcoderdataPython |
1796335 | <filename>data/showtimes.py
from dataclasses import dataclass
from datetime import date
from typing import List
from helpers.schedules import Schedule, build_weekly_schedule_str
from .movies import MovieVersion
@dataclass
class Showtime(Schedule):
movie: MovieVersion
def __str__(self):
return f"{self... | StarcoderdataPython |
1772355 | <gh_stars>0
class Node:
# Constructor to initialize data
# If data is not given by user,its taken as None
def __init__(self, data=None, next=None, prev=None):
self.data = data
self.next = next
self.prev = prev
# method for setting the data field of the node
def set_data(... | StarcoderdataPython |
49942 | <reponame>rehohoho/coiltraine<gh_stars>100-1000
from .attribute_dict import AttributeDict
#from .experiment_schedule import mount_experiment_heap, get_free_gpus, pop_half_gpu, pop_one_gpu | StarcoderdataPython |
1731052 | from typing import Iterable, Optional, TypeVar
from stock_indicators._cslib import CsIndicator
from stock_indicators._cstypes import List as CsList
from stock_indicators.indicators.common.results import IndicatorResults, ResultBase
from stock_indicators.indicators.common.quote import Quote
def get_prs(base_history: ... | StarcoderdataPython |
82133 | from rest_framework import viewsets
from rest_framework import status
from rest_framework.response import Response
from rest_framework import mixins
from rest_framework.decorators import detail_route, list_route
from rest_framework.permissions import IsAuthenticatedOrReadOnly
from .models import Bot, TelegramUser, Aut... | StarcoderdataPython |
1777359 | """The post-processing module provides filters for image post-processing."""
import SimpleITK as sitk
import pymia.filtering.filter as pymia_fltr
class BinaryThreshold(pymia_fltr.Filter):
def __init__(self, threshold: float):
"""Represents a binary threshold image filter.
Args:
thre... | StarcoderdataPython |
3209814 | import os
import tempfile
import logging
import signal
import pytest
from pybnb.common import inf, nan
from pybnb.misc import (
_cast_to_float_or_int,
MPI_InterruptHandler,
metric_format,
time_format,
get_gap_labels,
as_stream,
get_default_args,
get_keyword_docs,
get_simple_logger,... | StarcoderdataPython |
1720494 | <gh_stars>10-100
# -*- coding: utf-8 -*-
from dp_tornado.engine.controller import Controller
class RequestUriController(Controller):
def get(self):
assert(self.render_string('tests/view/ui_methods/request_uri.html') == '/tests/view/ui_methods/request_uri')
| StarcoderdataPython |
3237046 | <filename>pymongo_formatter/json_example.py<gh_stars>0
from bson.objectid import ObjectId
from pymongo import IS
{
"_id" : ObjectId("59367cbbb26a8807133f2864"),
"member" : {
"city" : "Dublin",
"events_attended" : 21,
"last_access_time" : ISODate("2017-06-01T22:37:50Z"),
"country" : "Ireland",
"member_id" :... | StarcoderdataPython |
3360188 | <reponame>mihailescum/poisson_learning
import numpy as np
import pandas as pd
from scipy.spatial.distance import cdist
import logging
import matplotlib.pyplot as plt
import poissonlearning as pl
import storage
import plotting
LOGGER = logging.getLogger(name=__name__)
logging.basicConfig(level="INFO")
SAVE_PLOTS = ... | StarcoderdataPython |
3332828 | <filename>tools/FG_utils.py
"""____________________________________________________________________________
Script Name: FG_utils.py
Description: Contains a set of Python functions used by
FluvialGeomorph tools.
Date: 05/22/2020
Functions:
line_route_points ... | StarcoderdataPython |
144925 | <reponame>EdmundoSanchezM/Proyecto-Administracion-De-Servicios-En-Red<gh_stars>0
from scapy.all import *
import platform
import subprocess
from threading import Thread
BLUE, RED, WHITE, YELLOW, MAGENTA, GREEN, END = '\33[94m', '\033[91m', '\33[97m', '\33[93m', '\033[1;35m', '\033[1;32m', '\033[0m'
"""
@args:
... | StarcoderdataPython |
1687884 | <filename>playwell-python-service/playwell/service/message/proxy/launcher.py
"""Message proxy launcher
"""
import atexit
from playwell.service.message.proxy.config import load_config_from_yaml
def launch(config_file_path: str):
"""初始化配置 & 开始运行
"""
load_config_from_yaml(config_file_path)
# 初始化日志
... | StarcoderdataPython |
157442 | """Unit tests of learning managers."""
import pytest
from ..utilities.general import is_never_authz, is_no_authz, uses_cataloging, uses_filesystem_only
from dlkit.abstract_osid.osid import errors
from dlkit.abstract_osid.type.objects import TypeList as abc_type_list
from dlkit.primordium.id.primitives import Id
fro... | StarcoderdataPython |
3394148 | <reponame>hkotkanen/home-infoboard
from flask import render_template
from app import app
from influxdb import InfluxDBClient
from influxdb.exceptions import InfluxDBClientError
import local_settings as settings
try:
client = InfluxDBClient(host='127.0.0.1',
port=8086,
... | StarcoderdataPython |
1661652 | <reponame>zhangmengdream/Hellogit
'''
在这里制造bug
'''
print('爬虫')
print('网站没有')
a = 'sssssssssss'
print('今天天气很好')
| StarcoderdataPython |
1703026 | <reponame>Techtonique/nnetsauce
# Authors: <NAME>
#
# License: BSD 3 Clear
import numpy as np
import platform
import warnings
from functools import partial
from sklearn.base import BaseEstimator
from sklearn.cluster import KMeans
from sklearn.mixture import GaussianMixture
from sklearn.preprocessing import StandardSca... | StarcoderdataPython |
3249029 | from .cache import *
from .hierarchyonly import *
from .image import *
from .pagination import *
from .seo import *
from .settings import *
from .singleton import *
from .substitute import *
from .utils import *
from .links import *
from .opengraph import *
from .structureddata import *
from .namedreference import *
| StarcoderdataPython |
3337847 | <gh_stars>0
import numpy as np
import multiprocessing as mp
from functools import partial
import time
import os
# UNCOMMENT the following line and change 'withMPI' to 'True' to lines to run with MPI on multiple nodes
# from mpi4py import MPI
withMPI = False
if __name__ == '__main__':
if withMPI:
comm =... | StarcoderdataPython |
1694722 | <filename>old/fastai/vat.py
import contextlib
import torch
import torch.nn as nn
import torch.nn.functional as F
from .core import no_grad_context, set_grad_enabled
from .text import *
SM = F.softmax
@contextlib.contextmanager
def _disable_tracking_bn_stats(model):
def switch_attr(m):
if hasattr(m, 'track_... | StarcoderdataPython |
3392147 | from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.naive_bayes import MultinomialNB
from data_set import *
post_list, class_list, test_list = load_data_set()
# 实例化CountVectorizer
train_tfidfVectorizer = TfidfVectorizer()
train_term_matrix = train_tfidfVectorizer.fit_transform(post_list)
vocabul... | StarcoderdataPython |
3216216 | <gh_stars>0
def connected(state, num_to_connect, player, row, col):
"""
Args:
state (np.ndarray): a numpy ndarray of shape (2, M, N), where M and N are > 0.
num_to_connect (int): num_to_connect > 0.
player (int): 0 or 1. The player we are checking.
row (int): the starting row
... | StarcoderdataPython |
1678419 | from sys import *
import os
from pathlib import *
Path_s = input("Enter path:")
file_name = input("Enter name of the file (don't forget to enter the extention):")
acces_file = os.path.join(Path_s, file_name)
file1 = open(acces_file, "w")
file1.write("Hello world")
file1.close()
| StarcoderdataPython |
1708686 | <reponame>CourseraStudent58/Chategories<filename>venv/lib/python2.7/site-packages/cpaassdk/resources/twofactor.py
from cpaassdk.utils import (
compose_response,
parse_response,
build_error_response,
id_from,
is_test_response,
response_converter,
check_if_error_response)
class Twofactor:
"""
... | StarcoderdataPython |
1651082 | <gh_stars>1-10
import signal
import asyncio
import logging
import functools
import wiji
async def _signal_handling(logger: wiji.logger.BaseLogger, workers: list) -> None:
try:
loop = asyncio.get_running_loop()
except RuntimeError:
loop = asyncio.get_event_loop()
try:
for _signal ... | StarcoderdataPython |
1690790 | from kom_framework.src.base_element import KOMElementBase
from kom_framework.src.support.locators import Xpath
from kom_framework.src.support.driver_aware import DriverAware
class WindowFactory:
@classmethod
def init_elements(cls, instance: DriverAware, ancestor: DriverAware):
elements = vars(instanc... | StarcoderdataPython |
159901 | <filename>examples/ex_tracing_monitor.py<gh_stars>1-10
# Copyright (c) Crossbar.io Technologies GmbH, licensed under The MIT License (MIT)
import pprint
import asyncio
from cbsh import client
async def main(session):
"""
Subscribe to all tracing related topics to monitor tracing on any node/worker.
"""
... | StarcoderdataPython |
1674307 | <filename>examples/googleclient.py
"""
Non-Working Example for Initial Reference
By: <NAME>
GitHub: https://github.com/Sniedes722
Inspired by Flask-OAuthLib's Google Client Example
"""
from sanic import Sanic
from sanic.response import json
from sanic_session import InMemorySessionInterface
from sanic_e... | StarcoderdataPython |
3330929 | <filename>Game/Constants.py
from enum import Enum
class Directions(Enum):
NORTH = "N"
EAST = "E"
SOUTH = "S"
WEST = 'W'
class Status(Enum):
LIVE = "LIVE"
DROWNED = "DROWNED"
DEAD = "DEAD"
class ItemType(Enum):
HELMET = 0
DAGGER = 1
MAGICSTAFF = 2
AXE = 3
def __lt__(self... | StarcoderdataPython |
3355607 | import sys
import os
import warnings
from optparse import OptionParser
from amuse.units import units
from amuse.community.sse.interface import SSE
from amuse.community.evtwin.interface import EVtwin
from amuse.community.evtwin2sse.interface import EVtwin2SSE
from amuse.community.mesa.interface import MESA
from amuse... | StarcoderdataPython |
190317 | inp = [eval(i) for i in input().split()]
lst = list(inp)
lst.sort()
sort = True
for i in range(len(lst)):
if lst[i] == inp[i]:
pass
else:
sort = False
if sort:
print("Good")
else:
print("Bad") | StarcoderdataPython |
3316960 | import youtube as Y
from urllib.parse import urlparse
import urllib
dt = 'https://www.youtube.com/playlist?list=PLxBhf17jrfxHQq8BYVBnelNbTte6OSy0e'
dt = 'https://www.youtube.com/playlist?list=PLxBhf17jrfxFHnXhQNSLiWjnA2y6pNJ62'
dt = 'https://www.youtube.com/playlist?list=PL65CC0384A1798ADF'
dta = urlparse(dt)
dta = ... | StarcoderdataPython |
3366822 | import argparse
from ccc_client.dts.DtsRunner import DtsRunner
from ccc_client.utils import resolve_filepath_from_pattern
def run(args):
runner = DtsRunner(args.host, args.port, args.authToken)
file_list = resolve_filepath_from_pattern(args.filepath)
for file_iter in file_list:
cccId = runner.inf... | StarcoderdataPython |
3268879 | <reponame>akotlerman/YANPIWS
#!/usr/bin/python
# grab args from CLI
import argparse
parser = argparse.ArgumentParser()
# Rev 2 Pi, Pi 2 & Pi 3 uses bus 1
# Rev 1 Pi uses bus 0
# Orange Pi Zero uses bus 0 for pins 1-5 (other pins for bus 1 & 2)
parser.add_argument('--bus', '-b', default=0, type=int, help='Bus Number... | StarcoderdataPython |
3392738 | from core.server import Server as AppiumServer
class StartServer(object):
def __init__(self, serial="", port=4723):
self._port = port
self._serial = serial
AppiumServer().start(serial, port)
if __name__ == '__main__':
StartServer(serial="123123", port=4723)
| StarcoderdataPython |
1761903 | from .segments import vcsh_repo # noqa
| StarcoderdataPython |
1784526 | <reponame>jedrzejboczar/litex-rowhammer-tester
#!/usr/bin/env python3
import time
import random
import argparse
from math import ceil
from rowhammer_tester.gateware.payload_executor import Encoder, OpCode, Decoder
from rowhammer_tester.scripts.utils import (
memfill, memcheck, memwrite, DRAMAddressConverter, lite... | StarcoderdataPython |
4843151 | <gh_stars>1-10
# -*- coding: utf-8 -*-
import sys
import copy
from random import randrange, randint
from django.db import models
from especialidad import Especialidad
from profesional import Profesional
from penalidad import Penalidad
from perfil.models import Institucion
PUNTOS_HORAS_SEMANALES = 1
CANT_PAREJAS = 4
... | StarcoderdataPython |
3249836 | <gh_stars>0
import socket
def init_server(server_ip,server_port):
global server
server=socket.socket(socket.AF_INET, socket.SOCK_STREAM) #socket.AF_INET=IPv4 // socket.SOCK_STREAM=TCP #CAMBIAR POR UDP
server_address=(server_ip,server_port)
server.bind(server_address) #Relate the protocol to the port I... | StarcoderdataPython |
95860 | <reponame>Mehdishishehbor/gpytorch<filename>test/kernels/test_rff_kernel.py
#!/usr/bin/env python3
import unittest
from unittest.mock import MagicMock, patch
import torch
import Lgpytorch
from Lgpytorch.kernels import RFFKernel
from Lgpytorch.test.base_kernel_test_case import BaseKernelTestCase
class TestModel(Lgp... | StarcoderdataPython |
141194 | #!/usr/bin/env python3
import atexit
import struct
import random
import sys
import threading
import socket
import termios
from select import select
PORT = 13117
BUFFER_SIZE = 4096
TEAM_NAME = f"2pack\n"
UTF8_ENCODE = 'utf-8'
SOCKET_LIST = []
ACTIVE_CONNECTION = 0
stop_threads = False
import os
os.system("")
# Grou... | StarcoderdataPython |
4806140 | <filename>rllib/examples/centralized_critic_2.py
"""An example of implementing a centralized critic with ObservationFunction.
The advantage of this approach is that it's very simple and you don't have to
change the algorithm at all -- just use callbacks and a custom model.
However, it is a bit less principled in that ... | StarcoderdataPython |
1788440 | VERSION = "1.2"
from geo import *
from filter import *
from util import *
| StarcoderdataPython |
127322 | <filename>project/recipes/crud.py
"""Actions for Recipe model."""
from typing import Dict, List, Union
from sqlalchemy.orm import Session
from .models import Recipe
def create_recipe(db: Session, name: str, url: str,
product_list: List[Dict[str, Union[str, float]]]) -> Recipe:
"""Save model in... | StarcoderdataPython |
4823060 | <gh_stars>100-1000
from __future__ import print_function, absolute_import, division #makes KratosMultiphysics backward compatible with python 2.6 and 2.7
import os
import sys
kratos_benchmarking_path = '../../../benchmarking'
sys.path.append(kratos_benchmarking_path)
import benchmarking
def Run():
Msg = ""
T... | StarcoderdataPython |
34860 | <filename>codility/lessons/1-iterations/test_binary_gap.py
import pytest
from binary_gap import solution
@pytest.mark.parametrize("value, expected", [(9, 2), (529, 4), (15, 0), (32, 0)])
def test_gaps(value, expected):
assert solution(value) == expected
| StarcoderdataPython |
75415 | <gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""""Airtest图像识别专用."""
import os
import sys
import time
import types
from six import PY3
from copy import deepcopy
from airtest import aircv
from airtest.aircv import cv2
from airtest.core.helper import G, logwrap
from airtest.core.settings import Settings as ... | StarcoderdataPython |
93589 | <gh_stars>1-10
from rest_framework import serializers
from ipam.models import Aggregate, IPAddress, Prefix, RIR, Role, VLAN, VLANGroup, VRF
from utilities.api import WritableNestedSerializer
__all__ = [
'NestedAggregateSerializer',
'NestedIPAddressSerializer',
'NestedPrefixSerializer',
'NestedRIRSeria... | StarcoderdataPython |
1691368 | import subprocess as sp
from pathlib import Path
import os
import tempfile
import contextlib
import shutil
from subprocess import CalledProcessError
__all__ = ['working_directory', 'working_file',
'exec_cmd', 'exec_cmd_with_output', 'CalledProcessError',
'process_flags', 'os_install', 'python3... | StarcoderdataPython |
3386373 | /usr/local/lib/python3.7/_collections_abc.py | StarcoderdataPython |
62583 | from bot import botToken
import unittest
def test_bot():
assert str(botToken(token_file='test_bot.token').getToken(
)) == '1111111111:TeStTaPiToKeN', 'Loading token from file is wrong'
| StarcoderdataPython |
102928 | <filename>core/test/container/docker/test_task_init.py
# -*- coding: utf-8 -*-
import os
from io import BytesIO
from unittest import TestCase, main
from tarfile import open as tar_open
from recc.container.docker.task_init import (
RECC_MODULE_INIT_PATH,
RECC_MODULE_DIR,
BUILD_CONTEXT_DOCKERFILE_PATH,
B... | StarcoderdataPython |
180274 | from custom_gym.envs.myxpc import xpc2 as xpc
def top_left():
print('top_left')
with xpc.XPlaneConnect() as client:
# Verify connection
try:
# If X-Plane does not respond to the request, a timeout error
# will be raised.
client.getDREF("sim/test/test_float"... | StarcoderdataPython |
3376749 | from grid_world import standard_grid
import numpy as np
import sys
def print_policy(P, title):
print("---------------------------")
print(title)
for i in range(3):
print("---------------------------")
for j in range(4):
a = P.get((i,j), ' ')
print(" %s |" % a, en... | StarcoderdataPython |
35967 | <reponame>lasse-aagren/poezio
"""
Module defining structures useful to the core class and related methods
"""
import collections
# http://xmpp.org/extensions/xep-0045.html#errorstatus
ERROR_AND_STATUS_CODES = {
'401': 'A password is required',
'403': 'Permission denied',
'404': 'The room doesn’t exist',
... | StarcoderdataPython |
3274001 | <filename>pokermon/poker/cards.py
from __future__ import annotations
import functools
from dataclasses import dataclass
from typing import Dict, List, Tuple
import regex as regex # type: ignore
from pokermon.poker.ordered_enum import OrderedEnum
class Suit(OrderedEnum):
SPADES = 1
CLUBS = 2
HEARTS = 3... | StarcoderdataPython |
1715341 | <filename>tests/rest_employees_unittests.py
import os
import sys
import unittest
import datetime
import json
sys.path.append(os.path.abspath(os.path.join('..')))
from models.departments import Departments
from models.employees import Employees
from models.users import User
from wsgi import app
app.app_context().push... | StarcoderdataPython |
3310785 | <filename>multijson/__init__.py
from multijson.multi import MultiJSONEncoder # noqa
| StarcoderdataPython |
131928 | <gh_stars>10-100
#pylint: disable=all
import tornado_swirl.swagger as swirl
import tornado_swirl.settings as settings
from tornado_swirl import api_routes
from tornado.testing import AsyncHTTPTestCase, gen_test
from tornado.web import RequestHandler
import json
class TestSampleEndpoints2(AsyncHTTPTestCase):
def ... | StarcoderdataPython |
260 | import numpy as np
from sklearn.linear_model import LogisticRegression
from .models import User
from .twitter import vectorize_tweet
def predict_user(user1_name, user2_name, tweet_text):
"""
Determine and return which user is more likely to say a given Tweet.
Example: predict_user('ausen', 'elonmusk'... | StarcoderdataPython |
3278147 | <filename>Security/CloudTrail/get_cloudtrail_alerts.py
import requests
import json
import numpy as np
import sys
"""
This python script is used to add cost alerts to all non mav AWS accounts
python3 get_cloudtrail_alerts.py 0000000000000000000000000000000000000000000000000000000000000000
"""
def log_information(log_s... | StarcoderdataPython |
4842200 | <gh_stars>1-10
#! /usr/bin/env python
import future
import os
import codecs
import sys
import locale
import logging
from io import StringIO, open
from . import csvhelpers
import dedupe
import itertools
class CSVDedupe(csvhelpers.CSVCommand) :
def __init__(self):
super(CSVDedupe, self).__init__()
... | StarcoderdataPython |
1737075 | #!/usr/bin/env python3
import csv
import sys
import matplotlib.pyplot as plt
FIG_NAME = 'plot-{:05}.png'
def parse_csv(filename):
'Parses the given filename and returns a dict of run no to list of values.'
data = {}
with open(filename, newline='') as csv_file:
for row in csv.DictReader(csv_fil... | StarcoderdataPython |
1751063 | #!/usr/bin/env python3
#
# Copyright 2011-2015 <NAME>
#
# 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 ... | StarcoderdataPython |
173035 | <filename>coniii/test_utils.py
from __future__ import division
from utils import *
def test_sub_to_ind():
for n in xrange(2,5):
counter = 0
for i,j in combinations(range(n),2):
assert sub_to_ind(n,i,j)==counter
assert ind_to_sub(n,counter)==(i,j)
counter += 1
de... | StarcoderdataPython |
196230 | import pickle
import numpy as np
from numpy.testing import (assert_almost_equal, assert_equal, assert_,
assert_allclose)
from refnx.analysis import Parameter, Model
def line(x, params, *args, **kwds):
p_arr = np.array(params)
return p_arr[0] + x * p_arr[1]
def line2(x, p):
r... | StarcoderdataPython |
3273609 | <gh_stars>1-10
from mykrobe.typing.typer.base import Typer
from mykrobe.typing.typer.base import MIN_LLK
from mykrobe.variants.schema.models import SequenceCall
from mykrobe.stats import log_lik_depth
from mykrobe.stats import percent_coverage_from_expected_coverage
from math import log
class PresenceTyper(Typer):
... | StarcoderdataPython |
4812232 | # Copyright 2022 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 applica... | StarcoderdataPython |
1767330 | import boto3
exceptions = boto3.client('mgh').exceptions
AccessDeniedException = exceptions.AccessDeniedException
DryRunOperation = exceptions.DryRunOperation
InternalServerError = exceptions.InternalServerError
InvalidInputException = exceptions.InvalidInputException
PolicyErrorException = exceptions.PolicyErrorExce... | StarcoderdataPython |
3282951 | """
Python implementation of the LiNGAM algorithms.
The LiNGAM Project: https://sites.google.com/site/sshimizu06/lingam
"""
import numbers
import numpy as np
from sklearn.utils import check_array, resample
from .direct_lingam import DirectLiNGAM
from .bootstrap import BootstrapResult
class MultiGroupDirectLiNGAM(Dir... | StarcoderdataPython |
1622600 | <reponame>Sourav692/FAANG-Interview-Preparation
# Time: O(n)
# Space: O(h)
import abc
from abc import ABCMeta, abstractmethod
class Node:
__metaclass__ = ABCMeta
# define your fields here
@abstractmethod
def evaluate(self):
pass
import operator
class NodeIter(Node):
ops = {'+':oper... | StarcoderdataPython |
18185 | #from weakref import WeakValueDictionary
import random, operator, weakref
def format_service_group(group):
"""pretty prints the group"""
rstr = '%s [%s]'
if group.cover != None: # Spy for IntSec
return rstr % (group.cover, group.cover.firm)
elif group.spyon != None:
return rstr % (group.spyon, group.spyon.firm... | StarcoderdataPython |
18437 | from sweeps.sweepFunctions import *
import numpy as np
def SMTBFSweep(SMTBFSweepInput,ourInput):
myRange = SMTBFSweepInput["range"] if dictHasKey(SMTBFSweepInput,"range") else False
myStickyRange=SMTBFSweepInput["sticky-range"] if dictHasKey(SMTBFSweepInput,"sticky-range") else False
sticky=False if type(... | StarcoderdataPython |
1788712 | <reponame>samuelmarroni/Python
# Crie um algoritmo que leia um número e mostre o seu dobro, triplo e raiz quadrada.
n = float(input('Digite um número:'))
dobro = float(n + n)
triplo = float(n * 3)
raiz = float(n ** (1 / 2))
print('O número é {}, seu dobro {}, triplo {} e sua raiz quadrada {}'.format(n, dobro, triplo... | StarcoderdataPython |
1710504 | #!/usr/bin/env python
import json
import rospy
from firos.srv import FIROS_Info, FIROS_InfoResponse
def get_robot_info(req):
ret = FIROS_InfoResponse()
robot = {
req.instance_name: {
"topics": [
{
"name": "cmd_vel_mux/input/teleop",
"... | StarcoderdataPython |
122658 | '''
module for implementation of
merge sort
'''
def merge_sort(arr: list):
if len(arr) > 1:
mid = len(arr) // 2
L = arr[:mid]
R = arr[mid:]
merge_sort(L)
merge_sort(R)
i, j, k = 0, 0, 0
while (i < len(L) and j < len(R)):
if (L[i] < R[j])... | StarcoderdataPython |
1703894 | <filename>model/functions.py
import numpy as np
import gzip
'''
This file contains all the essential functions that are used in the network '''
''' Getting data '''
#Extract images by reading the file bytestream.
#Reshape the read values into a 2D matrix of dimensions [n, h*w]
def extract_data(filename,... | StarcoderdataPython |
3297159 | # Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements.
# Example:
# Input: [0,1,0,3,12]
# Output: [1,3,12,0,0]
class Solution:
def moveZeroes(self, nums):
"""
:type nums: List[int]
:rtype: void Do not return... | StarcoderdataPython |
3260968 | <gh_stars>0
from flask import Flask, render_template, request
from ozekilibsrest import Configuration, Message, MessageApi, Folder
app = Flask(__name__)
configuration = Configuration(
username="http_user",
password="<PASSWORD>",
api_url="http://127.0.0.1:9509/api"
)
api = MessageApi(configuration)
logs =... | StarcoderdataPython |
19957 | import logging
import os
import re
import time
import urllib
from threading import Thread
import xmlrpclib
from Queue import Queue
from flask import current_app as app, render_template, request, redirect, abort, jsonify, json as json_mod, url_for, session, Blueprint
from itsdangerous import TimedSerializer, BadTimeSi... | StarcoderdataPython |
3370035 | from eager_core.engine_params import EngineParams
class RealEngine(EngineParams):
"""
Real engine parameters for EAGER environments.
This class includes all settings available for reality.
:param dt: The time step when :func:`eager_core.eager_env.EagerEnv.step` is called
"""
def __init__(se... | StarcoderdataPython |
3384364 | <filename>src/surrogate/datahandler.py<gh_stars>0
from pandas import read_csv, DataFrame
def load_data_file(filename: str) -> DataFrame:
data: DataFrame = read_csv(filename)
return data
| StarcoderdataPython |
3360368 | <filename>czsc/Setting/__init__.py
from czsc.Setting.localize import quanta_path, setting_path, cache_path, log_path
from czsc.Setting.setting import TDX_DIR, CLIENT
| StarcoderdataPython |
3312039 | from .alerts import AlertService
from .users import UserService
from .teams import TeamService
from .accounts import AccountService
from .config import Configuration
from .errors import InvalidConfigurationError
class OpsGenie:
def __init__(self, configuration):
"""
Init OpsGenie client to interac... | StarcoderdataPython |
3235309 | # Statement for enabling the development environment.
DEBUG = True
# Define the application directory.
import os
BASE_DIR = os.path.abspath(os.path.dirname(__file__))
# Application threads. A common general assumption is
# using 2 per available processor cores - to handle
# incoming requests using one and performing ... | StarcoderdataPython |
3338116 | <reponame>ssm-jax/ssm-book<filename>_build/jupyter_execute/chapters/learning/sgd.py
#!/usr/bin/env python
# coding: utf-8
# (sec:sgd)=
# # Stochastic Gradient Descent (SGD)
#
#
| StarcoderdataPython |
3227974 | import json
import logging
import os
from io import StringIO
from balsam.core.models import ApplicationDefinition as AppDef
from balsam.launcher import dag
from balsam.launcher.async import FutureTask
from balsam.launcher.async import wait as balsam_wait
from ytopt.evaluator.evaluate import Evaluator
from django.core... | StarcoderdataPython |
3297477 | <reponame>jonhealy1/stac-mongo-api<filename>api/db.py<gh_stars>0
import motor.motor_asyncio
from dotenv import load_dotenv
import os
load_dotenv()
MONGO_CONN_STRING = os.environ.get("MONGO_CONN_STRING")
client = motor.motor_asyncio.AsyncIOMotorClient(MONGO_CONN_STRING)
database = client.stac
stac_collection = databas... | StarcoderdataPython |
3344094 | #!/usr/bin/env python
from PythonBinding import *
import os
#import lsst.eotest.sensor as sensorTest
import sys
#from lcatr.harness.helpers import dependency_glob
fileName = "/tmp/ccscmnd"
fo = open(fileName,"w");
#print "Number of arguments = ", len(sys.argv)
if (len(sys.argv)==2) :
fo.write(sys.argv[1]);
else :
... | StarcoderdataPython |
3354141 | <reponame>andyGFHill/fieldosophy<gh_stars>1-10
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Unit tests for mesh module of Fieldosophy.
This file is part of Fieldosophy, a toolkit for random fields.
Copyright (C) 2021 <NAME> <<EMAIL>>
This Source Code is subject to the terms of the BSD 3-Clause License.
If a co... | StarcoderdataPython |
4802616 | # -*- coding: utf-8 -*-
"""
Created on Mon Sep 10 15:18:51 2018
Copyright (c) <NAME>
Author Email: <<EMAIL>>
Description:
This program creates a augmented images that are blurry version of an input
image. The types of blur is hard coded as Gaussian and average blur. The
radius of the blur is a... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.