id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
5148442 | <gh_stars>0
"""For a detailed guide on all the features of the Circuit Playground Express (cpx) library:
https://adafru.it/cp-made-easy-on-cpx"""
import time
import math
import random
# from threading import Thread
import microcontroller
from adafruit_circuitplayground.express import cpx
# Set TONE_PIANO to True to en... | StarcoderdataPython |
6448720 | import hikari
import tanjun
import spotipy
import sqlite3
import json
import requests
import typing
from tanjun.abc import SlashContext
conn = sqlite3.connect('database.db')
c = conn.cursor()
#c.execute("""CREATE TABLE database (
#users_id integer,
#playlist_id BLOB,
#playlist_link BLOB)""")
compo... | StarcoderdataPython |
5037772 | <reponame>miffyrcee/tf
import numpy as np
import tensorflow as tf
import tensorflow_probability.python as tfp
tfd = tfp.distributions
num_schools = 8 # number of schools
treatment_effects = np.array([28, 8, -3, 7, -1, 1, 18, 12],
dtype=np.float32) # treatment effects
treatment_stddevs = ... | StarcoderdataPython |
6579732 | <filename>crypto.py<gh_stars>1-10
SUFFIX_PRIVKEY_COMPRESSED = 0x01
PREFIX_P2PKH = 0x00 # Publick Key Hash
PREFIX_PUBKEY_EVEN = 0x02
PREFIX_PUBKEY_ODD = 0x03
PREFIX_PUBKEY_FULL = 0x04
PREFIX_P2SH = 0x05 # https://github.com/bitcoinbook/bitcoinbook/blob/develop/ch07.asciidoc#pay-to-script-hash-p2sh
PREFIX_TESTNET_P2PKH =... | StarcoderdataPython |
239077 | from PySide2.QtWidgets import (QWidgetAction, QWidget, QPushButton, QGridLayout, QMenu, QButtonGroup)
from PySide2.QtCore import Qt, QPoint, Signal
from PySide2.QtGui import (QColor, QPixmap, QPainter, QIcon)
COLOR_PALETTE = [
QColor(179,102,102),QColor(255,128,128),QColor(255,0,0),QColor(191,0,0),QColor(128,0,0),... | StarcoderdataPython |
5112209 | <filename>tests/test_verilog_preproc.py
import unittest
from os import path
try:
from tests.basic_tc import TEST_DIR
except ImportError:
from basic_tc import TEST_DIR
from hdlConvertor import ParseException, HdlConvertor
from hdlConvertor.language import Language
SV = Language.SYSTEM_VERILOG_2012
def _test... | StarcoderdataPython |
1914793 | <gh_stars>0
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-08-11 11:31
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('events', '0001_initial'),
]
operations = [
migrations.AlterModelOptions... | StarcoderdataPython |
9785056 | <reponame>luqidndx/PyWake
import json
import os
from os.path import dirname
from os.path import join as pjoin
import re
import ssl
import sys
class Notebook():
def __init__(self, filename):
self.filename = filename
try:
self.nb = self.load_notebook(self.filename)
except Excepti... | StarcoderdataPython |
9610768 | <reponame>meawoppl/numba
"""
>>> temp_string_var()
hellohello0
>>> temp_string()
hellohello0
>>> temp_string2()
hellohello0
>>> temp_string3()
hellohello0
hellohello1
hellohello2
>>> eq("foo", "foo")
True
>>> eq("foo", "bar")
False
>>> ne("foo", "foo")
False
>>> ne("foo", "bar")
True
>>> lt("foo", "foo")
False
>>> lt(... | StarcoderdataPython |
62319 | <reponame>mustard-seed/SparseNN_training
import torch
import torch.nn.functional as F
import torch.nn as nn
from torch.quantization import QuantStub, DeQuantStub
import torch.optim as optim
import horovod.torch as hvd
from torchvision import datasets, transforms
import torch.utils.data.distributed as distributed
import... | StarcoderdataPython |
1902062 | <reponame>adamtorres/unit-convert
import unittest
import unit_convert
class TestVolume(unittest.TestCase):
def test_ounce_and_cup(self):
# (ounces, cups)
tests = [
(16, 2),
(1, 0.125),
(0.5, 0.0625),
(128, 16),
(124, 15.5),
]
... | StarcoderdataPython |
6464724 | # encoding: utf-8
# module PySide.QtGui
# from C:\Python27\lib\site-packages\PySide\QtGui.pyd
# by generator 1.147
# no doc
# imports
import PySide.QtCore as __PySide_QtCore
import Shiboken as __Shiboken
class QProxyModel(__PySide_QtCore.QAbstractItemModel):
# no doc
def columnCount(self, *args, **kwargs): #... | StarcoderdataPython |
6469400 | <reponame>osoco/better-ways-of-thinking-about-software
# lint-amnesty, pylint: disable=missing-module-docstring
import datetime
from unittest.mock import patch
import pytest
from openedx.core.djangoapps.schedules.content_highlights import (
course_has_highlights_from_store,
get_all_course_highlights,
get_ne... | StarcoderdataPython |
5104538 | <filename>solver.py
#Dependencies: None
"""
/***************************************************************************
Author :<NAME>
Email :cdbrissac (at) gmail.com
License :Apache 2.0
***************************************************************************/
"""
import copy
import random
N=64
visc=0... | StarcoderdataPython |
6436977 | """I'm a different package, but I'm in demopackage.__all__!"""
x = 42
| StarcoderdataPython |
308883 | <gh_stars>1-10
from django.conf.urls import patterns, url, include
from example.forms import AutoCompleteOrderedItemForm, OrderedItemForm, ContactFormset, MaxFiveContactsFormset, EmptyContactFormset, EventFormset
from example.forms import AutoCompleteSelectFieldForm
urlpatterns = patterns('example.views',
url(r'^... | StarcoderdataPython |
12865605 | # ------------------------------------------
# Description: This python script will update AWS Thing Shadow for a Device/Thing
# ------------------------------------------
# Import package
import paho.mqtt.client as mqtt
import ssl, time, sys
# =======================================================
# Set Following V... | StarcoderdataPython |
4969208 | # -*- coding: utf-8 -*-
#
# Copyright (c) 2012-2019 by nils_2 <<EMAIL>>
#
# Display size of current logfile in item-bar
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the ... | StarcoderdataPython |
139054 | <gh_stars>1-10
from mrhttp import app
@app.route('/')
def hello(r):
if r.file == None:
return "No file uploaded"
#for f in r.files:
#print(f)
name = r.file['name']
typ = r.file['type']
body = r.file['body']
return name
app.run(cores=4)
# curl -i -X POST -F "data=@14_upload.py" http://localhost:... | StarcoderdataPython |
3402275 | #!/usr/bin/env python3
# frequency.py
# word frequency analysis script
# i love dictionaries
import string
import json
def alphanumericize(source_text):
source = source_text.lower()
source = source.replace('-', ' ') # because Dostoevsky loves his dashes
# I think this is backwards - I should instead ... | StarcoderdataPython |
5151215 | <reponame>hashberg-io/dag-cbor<filename>dag_cbor/utils.py
"""
Error classes and utility functions.
Errors raised because of CBOR codec specifications are instances of :class:`CBORError`, while errors
raised because of additional restrictions imposed by the DAG-CBOR codec are instances of :class:`DAGCBORErr... | StarcoderdataPython |
9624790 | import fu
from inspect import isclass
##################################################
# classes for navigating through types dynamically
class naviter(object):
'''generic way of navigating through an object's properties if they are iterable'''
attribute = 'co_consts'
type = None
object = None
de... | StarcoderdataPython |
4890888 | <filename>shShellcode.py
#!/usr/bin/python
### /bin/sh shellcode of length 28 bytes
shellcode = "\x31\xc0\x50\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x89\xc1\x89\xc2\xb0\x0b\xcd\x80\x31\xc0\x40\xcd\x80"
print len(shellcode)
print shellcode
| StarcoderdataPython |
9638803 | '''
View for managing social properties of view
'''
from django.template import Template, Context
from django.conf import settings
class SocialView(object):
"""
Uses class properties for social arguments
Allows inheritance.
Template language can be used
e.g.
share_title = "{{title}}"
... | StarcoderdataPython |
1747656 | <filename>python_experiments/generate_inputs/generate_bin_files.py<gh_stars>1-10
import os
if __name__ == '__main__':
small_data_set_lst = ['ca-GrQc', 'ca-HepTh', 'p2p-Gnutella06', 'wiki-Vote']
data_set_lst = [
# 'email-Enron', 'email-EuAll',
# 'web-NotreDame', 'web-Stanford', 'web-BerkStan', '... | StarcoderdataPython |
5152494 | # splines in 1d
# We use the cherry blossom daa from sec 4.5 of "Statistical Rethinking"
# We use temperature as the target variable, to match a draft version of the book,
# https://github.com/Booleans/statistical-rethinking/blob/master/Statistical%20Rethinking%202nd%20Edition.pdf
# The published version uses day of y... | StarcoderdataPython |
6630624 | # coding: utf-8
"""
Control-M Services
Provides access to BMC Control-M Services # noqa: E501
OpenAPI spec version: 9.20.215
Contact: <EMAIL>
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
from ctm_api_client.configuratio... | StarcoderdataPython |
5112760 | <filename>notedrive/others/magnet/utils.py
class FailedToFetchException(Exception):
"""Unable to fetch torrent exception"""
| StarcoderdataPython |
6491708 | from flask_restful import Resource,reqparse
from flask import jsonify, request
import pandas as pd
import os
import numpy as np
import datetime
# parse parameters
parser = reqparse.RequestParser()
parser.add_argument('stockid', type=str)
parser.add_argument('start', type=str)
parser.add_argument('end', type=str)
# 接收... | StarcoderdataPython |
1764771 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | StarcoderdataPython |
5079666 | ##Data Structure
#List: Mutable, meaning data can be manipulated
#List instantiation with specific values
my_list = [1,2,3]
#Nested List instantiation
my_list = [1,2,[3,4]]
print('Before appending anything:',my_list)
#Appending list value
my_list.append(5)
print('After appending \'5\' to the list:',my_list)
#Retrie... | StarcoderdataPython |
14793 | <filename>example.py<gh_stars>0
#!/usr/bin/env python3
# pylint: disable=unused-wildcard-import
from py_derive_cmd import *
import cmd
class MyCmd(cmd.Cmd):
pass
s = Settings(MyCmd, print_warnings=False)
@make_command(s, 'Test for the decorator', aliases=['d'])
def test_decorator(shell: MyCmd, req_arg: str, opt_... | StarcoderdataPython |
1649058 | #!/usr/bin/env python3
import logging
from logging import config
import os
from os import path
import sys
import ntpath
import smtplib
import email
from email import encoders
from email.mime.base import MIMEBase
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
LOG_PATH = '/data/scrip... | StarcoderdataPython |
150175 | <filename>openleadr/enums.py
# SPDX-License-Identifier: Apache-2.0
# Copyright 2020 Contributors to OpenLEADR
# 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/lice... | StarcoderdataPython |
5197464 | <filename>draw/__init__.py
__all__ = [
"Canvas", "Rect", "Circle", "Line"
]
from .canvas import Canvas
from .diagrams import Rect, Circle, Line
| StarcoderdataPython |
3285121 | <filename>src/dispatch/plugins/kandbox_planner/planner_engine/optimizer_shared_jobs_in_slots.py
from dispatch.plugins.kandbox_planner.env.env_models import ActionDict
from dispatch.plugins.kandbox_planner.env.env_enums import OptimizerSolutionStatus, ActionType
from datetime import datetime, timedelta
import pandas as ... | StarcoderdataPython |
6433176 | from rest_framework import generics, status
from localground.apps.site.api import serializers, filters
from localground.apps.site.api.views.abstract_views \
import QueryableListCreateAPIView
from localground.apps.site import models
from localground.apps.site.api.permissions import CheckProjectPermissions
from djang... | StarcoderdataPython |
5118233 | #!/usr/bin/python
from __future__ import print_function
import os
import sys
import errno
import argparse
import tempfile
import subprocess
import shlex
import shutil
import stat
import json
cmdLog = None
# Derived from http://stackoverflow.com/a/4417735
def execute(command):
cmdLog.write(command + '\n')
p ... | StarcoderdataPython |
12862101 | <gh_stars>0
from lesson12_projects.house3.data.const import E_TURNED_KNOB, MSG_TURN_KNOB, E_FAILED
class OutState:
def update(self, req):
self.on_entry(req)
# 入力
msg = self.on_trigger(req)
# 外に居ます。 'Turn knob' とメッセージを送ってくるのが正解です
if msg == MSG_TURN_KNOB:
self.... | StarcoderdataPython |
3375945 | # -*- coding: utf-8 -*-
# pylint: disable=bad-continuation
"""core user interface
:mod:`pcapkit.interface.core` defines core user-oriented
interfaces, variables, and etc., which wraps around the
foundation classes from :mod:`pcapkit.foundation`.
"""
import io
import sys
from pcapkit.foundation.analysis import analys... | StarcoderdataPython |
186848 | # -*- coding: utf-8 -*-
# IPC: A python library for interprocess communication via standard streams.
#
# $Id$
#
# License: MIT
# Copyright 2015-2017 <NAME> (https://github.com/UncleRus)
# Copyright 2017 <NAME> (https://github.com/oleg-golovanov)
#
# Permission is hereby granted, free of charge, to any person obtaining... | StarcoderdataPython |
6674627 | <filename>lib/workflow/func/tag.py<gh_stars>0
from .func import FuncInsert, FuncUpdate
class FuncTagInsert(FuncInsert):
def __init__(self, key, rule):
self._key = key
self._rule = rule
def get_fields(self):
if type(self._key) == str:
return [self._key]
elif type(se... | StarcoderdataPython |
1922307 | <reponame>anajulijapreseren/Najbolj-e-knjige-vseh-asov<gh_stars>0
import csv
import os
import requests
import re
import math
import os.path
import json
import sys
#--------------------------------------------------------------------------------------------------
#Definiramo konstante za število knjig in poimenujemo sp... | StarcoderdataPython |
11200460 | import sys
from django.apps import apps
from django.core.management.base import BaseCommand
from django.db import DEFAULT_DB_ALIAS, connections
from django.db.migrations.loader import MigrationLoader
class Command(BaseCommand):
help = "Shows all available migrations for the current project"
def add_argument... | StarcoderdataPython |
6551430 | # Copyright (c) 2016 Boulder Real Time Technologies, Inc.
#
# Written by <NAME>
#
# This software may be used freely in any way as long as
# the copyright statement above is not removed.
from __main__ import * # _et all the libraries from parent
class DbMoment(Station):
'''
Main class for calcu... | StarcoderdataPython |
5077252 |
import os
import json
class User(object):
def __init__(self, userName:str, dirPath:str):
assert isinstance(userName, str)
if dirPath is not None:
assert isinstance(dirPath, str)
dataFilePath = os.path.join(dirPath, "data.json")
self.__name = userName
self.__dirPath = dirPath
self.__dataFile... | StarcoderdataPython |
230204 | from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils.text import slugify
from cms.models import CMSPlugin
from .conf import settings
class TabGroupPlugin(CMSPlugin):
tab_group_name = models.CharField(max_length=200, blank=False)
layout_template = models.Char... | StarcoderdataPython |
8103859 | #!/usr/bin/python
import nfldb
import nflgame
from nflgame import *
import json
import sys
import urllib
import urllib2
import re
#db = nfldb.connect()
#q.game(season_year=2014, season_type='Regular')
#for pp in q.sort('passing_yds').limit(10).as_aggregate():
# print pp.player, pp.passing_yds
#q.game(season_year=201... | StarcoderdataPython |
9634186 | <filename>breakdown_utilization_experiments/asynchronous_task_generation.py
import functools
from cProfile import run
from math import floor, inf
import pickle
from random import choice, randint
import matplotlib.pyplot as plt
from multiprocessing import cpu_count, Pool
from priority_functions import *
from schedule_pl... | StarcoderdataPython |
6512680 | class Player:
def __init__(self, turn, character):
self.turn = turn
self.character = character
class Bot:
def __init__(self, turn, character):
self.turn = turn
self.character = character
| StarcoderdataPython |
1616453 | import json
import logging
import os
import re
import requests
import retrying
import shakedown
from dcos import marathon
log = logging.getLogger(__name__)
logging.basicConfig(format='[%(levelname)s] %(message)s', level='INFO')
def get_json(file_name):
""" Retrieves json app definitions for Docker and UCR backe... | StarcoderdataPython |
6412072 | import numpy as np
r=int(input('Rate:'))
p=int(input('Principle:'))
n=int(input('Months:'))
print(np.pmt(r,n,p))
| StarcoderdataPython |
11296414 | #!/usr/bin/env python3
#
# Copyright (c) 2022 <NAME>
#
# MIT License - See LICENSE file accompanying this package.
#
"""Wrapper for "pulumi destroy" command"""
from typing import (Any, Dict, List, Optional, Union, Set, Type)
from copy import deepcopy
from lib2to3.pgen2.token import OP
import os
import sys
import jso... | StarcoderdataPython |
1800844 | <reponame>llinmeng/PythonStudy
# -*- coding: utf-8 -*-
for line in open(filename):
process(line) | StarcoderdataPython |
1916843 | <reponame>Yadira-Ferrer/tytus
import tabla_simbolos as TS
class Instruccion():
def __init__(self, tipo, instruccion):
self.tipo = tipo
self.instruccion = instruccion
class Select():
def __init__(self, dist, selcol, fromcol, joins, order, conditions):
self.dist = dist
self.selc... | StarcoderdataPython |
221390 | <reponame>seuzmj/pyBN<filename>pyBN/inference/map_exact/__init__.py
from pyBN.inference.map_exact.ilp_map import *
from pyBN.inference.map_exact.ve_map import * | StarcoderdataPython |
6440805 | <filename>corehq/apps/export/management/commands/process_skipped_pages.py<gh_stars>100-1000
import multiprocessing
import os
import re
import shutil
import tempfile
import zipfile
from datetime import datetime
from django.core.management.base import BaseCommand, CommandError
import sh
from corehq.apps.export.dbacces... | StarcoderdataPython |
11213295 | """
Some common utilities for interacting with discord.
"""
from __future__ import annotations
import asyncio
import re
import math
import discord
import discord.abc
import discord.ext.commands
import string
import logging
from typing import (Any, List, Sequence, Callable, Iterable, Optional, Union, Coroutine, AsyncCon... | StarcoderdataPython |
1844518 | <filename>systemofequations.py
#!/usr/bin/env python
# TOGGLE THESE VALUES
equation1 = '10 - x' # y = 10 - x
equation2 = 'x / (5 / 8)' # y = x / (5 / 8)
check_until = 100 # We check all the fractions from 1/1 to check_until / check_until. So for example it would go 1 / 1, 1 / 2, ..., 1 / 100, ..., 100 / 1, 100 ... | StarcoderdataPython |
6583312 | import falcon
from wsgiref import simple_server
import leaderboard
import root
ALLOWED_ORIGINS = ['http://0.0.0.0:5000'] # Or load this from a config file
class CorsMiddleware(object):
def process_request(self, request, response):
origin = request.get_header('Origin')
if origin in ALLOWED_ORIG... | StarcoderdataPython |
5109863 | <reponame>thegreenwebfoundation/greenwebfoundation-admin<filename>apps/accounts/admin_site.py
import re
import logging
from django.contrib.admin.sites import AdminSite
from django.contrib.auth.forms import AuthenticationForm
from django.core.exceptions import ValidationError
from django.urls import path
from django.ur... | StarcoderdataPython |
1746613 | <gh_stars>0
#!/usr/bin/env python3
INT_POWER = 32
for _ in range(int(input())):
arr = [1] * INT_POWER
b = bin(int(input()))[2:]
len_b = len(b)
for i in range(len_b):
if b[i] == '1':
arr[len_b - i - 1] = 0
print(sum([2 ** i for i in range(INT_POWER) if arr[i] == 1]))
| StarcoderdataPython |
5153927 | import abc
import collections
import typing
import warnings
from typing import AbstractSet, Deque, Dict, Optional, Set, Tuple, cast
from ..utils.meta import roundrepr
if typing.TYPE_CHECKING:
from ..entity import Entity
from ..term import Term, TermSet, TermData
from ..relationship import Relationship, Re... | StarcoderdataPython |
3286538 | <reponame>xujunhuii/huobi_Python<filename>example/generic/get_market_status.py
from huobi.client.generic import GenericClient
generic_client = GenericClient()
market_status = generic_client.get_market_status()
print(market_status)
| StarcoderdataPython |
1718316 | <filename>random_reward.py
import json
import argparse
from functions import *
#parse arguments
#usage of id arguments not recommended; they are here for completeness
parser = argparse.ArgumentParser()
parser.add_argument('--profile', default='default')
parser.add_argument('--token')
parser.add_argument('--budget_name... | StarcoderdataPython |
5077894 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
#lint:disable
from .config import get_db
from .core import getTable, getSession
#lint:enable
| StarcoderdataPython |
8167083 | <reponame>MegaMosquito/rebooter
#
# This is the code for my autmoatic rebooter.
#
# Written by <EMAIL>, 2021-8-21
#
import os
import sys
import schedule
import time
from datetime import datetime
def get_from_env(v, d):
if v in os.environ and '' != os.environ[v]:
return os.environ[v]
else:
return d
# Defa... | StarcoderdataPython |
3516274 | <reponame>nkhanal0/ampcrowd
from django.conf.urls import patterns, url
from basecrowd import views
urlpatterns = patterns(
'',
url(r'^(\w+)/assignments/$', views.get_assignment, name='get_assignment'),
url(r'^(\w+)/responses/$', views.post_response, name='post_response'),
url(r'^(\w+)/tasks/$', views.... | StarcoderdataPython |
1689851 | <filename>5 kyu/The maximum and minimum difference Challenge version.py
def max_and_min(arr1,arr2):
arr1=set(arr1)
arr2=set(arr2)
temp1=abs(max(arr1)-min(arr2))
temp2=abs(max(arr2)-min(arr1))
first=temp1 if temp1>temp2 else temp2
arr1=sorted(arr1)
arr2=sorted(arr2)
index1=len(arr1)-1
... | StarcoderdataPython |
9798011 | #!/usr/bin/env python
"""
Definition and functions for a simple image (stamp) data structure:
a square image with Npix*Npix pixels, where input Npix is odd
N.B. the center of the central pixel of the stamp has coordinates (0,0)
Functions:
- getOneDpixels(self, Npix)
- set2Dpixels(self, Xpixels... | StarcoderdataPython |
6661619 | <filename>tests/v0x01/test_controller2switch/test_aggregate_stats_reply.py
"""Test for AggregateStatsReply message."""
import unittest
from pyof.v0x01.controller2switch.common import AggregateStatsReply
class TestAggregateStatsReply(unittest.TestCase):
"""Test for AggregateStatsReply message."""
def setUp(s... | StarcoderdataPython |
225145 | <filename>Providers/Scripts/3.x/Scripts/Tests/dummy_nxOMSAutomationWorker_files/main.py
#!/usr/bin/env python2
# ====================================
# Copyright (c) Microsoft Corporation. All rights reserved.
# ====================================
import sys
import os
import configuration
import ConfigParser
import ti... | StarcoderdataPython |
5067992 | <gh_stars>1-10
"""
[2017-08-01] Challenge #325 [Easy] Color maze
https://www.reddit.com/r/dailyprogrammer/comments/6qutez/20170801_challenge_325_easy_color_maze/
#Description
Today we are going to do something colorfull and amazing. Yes it is a color maze :D (you can downvote me now, it was
totally worth it).
You tra... | StarcoderdataPython |
6621455 | <reponame>Healthedata1/pubsub-endpoint<filename>app.py
# A very simple Flask app to get started with using
# FHIR Subscriptions
# This is a reciever for the FHIR R4 Server URL (https://subscriptions.argo.run/)
# with an ednpoint = "http://healthedatainc2.pythonanywhere.com/webhook"
# It just saves the subscription noti... | StarcoderdataPython |
6505812 | import threading
class Limiter:
'''A limit keeps track of the count of certain keys
If a key's count exceeds the limit, it is considered done.
'''
def __init__(self, limit=2):
self.d = dict()
self.limit = limit
self.lock = threading.Lock()
def get(self, url):
return... | StarcoderdataPython |
396255 | <filename>giveaways/constants.py
import discord
giveaway_embed: discord.Embed = discord.Embed(
title="**`{prize}`**",
description=("React with {emoji} to enter\n" "Host: {host}\n" "Ends {timestamp}\n"),
).set_footer(text="Winners: {winners} | ends : ")
winnerdm_message: str = (
"You have won the giveaway ... | StarcoderdataPython |
12839849 | from copy import deepcopy
from nglp.lib.seamless import Construct, SeamlessException
class OpenAPISupport(object):
DEFAULT_OPENAPI_TRANS = {
# The default translation from our coerce to openapi is {"type": "string"}
# if there is no matching entry in the trans dict here.
"unicode": {"type... | StarcoderdataPython |
12830162 | from .constants import VV, VH, IW, ASCENDING
from .filter import filter_sentinel1_data
from tqdm import tqdm
import ee
from .compose import compose_sentinel1_data
from .dictify import dictify_pixel_values
__all__ = ["fetch_sentinel1_data"]
def fetch_sentinel1_data(
start_date,
end_date,
geome... | StarcoderdataPython |
3286960 | <filename>tests/legacy/core_tests.py
from nose.tools import raises
from graffiti.legacy import core
from graffiti.util import fninfo
from graffiti.legacy.keys import simplify
def test_build_nodes():
fn = lambda a, b=1: 1
info = fninfo(fn)
graph = {
"a": fn,
"b": fn,
"c": "foo"
... | StarcoderdataPython |
11222834 | import typing
def travese_better(x: int) -> int:
# 在函数里面定义函数
def helper(x, res=0):
x = x if x > 0 else -x
if x == 0:
return res
res = res * 10 + x % 10
w = helper(x // 10, res)
if res > 2 ** 31:
return 0
return w
return helper(x) if ... | StarcoderdataPython |
198264 | from virtool_workflow.analysis.sample import sample
from virtool_workflow.analysis.subtractions import subtractions
from virtool_workflow.analysis.hmms import hmms
from virtool_workflow.analysis.analysis import analysis
from virtool_workflow.analysis.indexes import indexes
__all__ = [
"sample",
"subtractions",... | StarcoderdataPython |
1766815 | <reponame>minhman727/miao-nutrition-assistant
from mongoengine import *
from src.models.abstract_models.food_model import Food
class SampleFood(Food):
meta = {
"db_alias": "miao",
"collection": "sample_foods"
} | StarcoderdataPython |
6575645 | from .native import *
from .native_extends import *
from .bool import *
from .vector import * | StarcoderdataPython |
391764 | # Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2013 Hewlett-Packard Development Company, L.P.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except i... | StarcoderdataPython |
313477 | # Bader et al. (2003) MCODE clustering algorithm from
# "An automated method for finding molecular complexes in large protein interaction networks"
# Python 2 Author: <NAME> <<EMAIL>>
# Python 3 protclus version: Paul Scherer
import sys
from collections import defaultdict
from .cluster_alg import ClusterAlg
class ... | StarcoderdataPython |
3310253 | <reponame>hansehe/DockerBuildSystem
import unittest
import os
from tests import TestTools
from DockerBuildSystem import VersionTools
class TestVersionTools(unittest.TestCase):
def test_GetVersionFromChangelog(self):
version = VersionTools.GetVersionFromChangelog(os.path.join(TestTools.TEST_SAMPLE... | StarcoderdataPython |
6539459 | from flask import Flask, jsonify, make_response
from connector import connector
from sqlapi import sqlapi
from utils import api_response
app = Flask(__name__)
app.register_blueprint(connector)
app.register_blueprint(sqlapi)
@app.route("/")
@api_response
def default():
return 'Nothing to see here'
@app.errorhan... | StarcoderdataPython |
5010436 | """ This module tests the Fourier implementation.
Author: <NAME>, <EMAIL>
"""
import numpy as np
from pypret.fourier import FourierTransform, Gaussian
from pypret import lib
def test_gaussian_transformation():
""" This test compares the numerical approximation of the Fourier transform
to the analy... | StarcoderdataPython |
5156949 | <gh_stars>1-10
import io
import json
import pathlib
import fastavro
import pytest
from freezegun import freeze_time
import datahub.metadata.schema_classes as models
from datahub.cli.json_file import check_mce_file
from datahub.ingestion.run.pipeline import Pipeline
from datahub.ingestion.source.file import iterate_mc... | StarcoderdataPython |
1647664 | """The min_max component."""
from homeassistant.const import Platform
DOMAIN = "min_max"
PLATFORMS = [Platform.SENSOR]
| StarcoderdataPython |
8033801 | <gh_stars>1-10
"""Support Trac's XML-RPC interface."""
from dateutil.parser import parse as dateparse
from . import Trac
from .._xmlrpc import Xmlrpc, MulticallIterator, _Unmarshaller
from ...utc import utc
class _Unmarshaller_UTC(_Unmarshaller):
"""Unmarshaller that assumes datetimes are in UTC."""
dispat... | StarcoderdataPython |
8135884 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import pytest
import pandas as pd
import numpy as np
from pyroofit.models import Gauss, Chebychev
from pyroofit.composites import AddPdf, ProdPdf, Convolution
def get_test_df(size=100):
d = {}
d['mbc1'] = np.random.random_sample(size)
d['mbc'] = np.random.r... | StarcoderdataPython |
1679803 | import threading
import time
import json
def writeDataToLog():
json_data=open("last.json").read()
data = json.loads(json_data)
json_data2=open("log.json").read()
data2 = json.loads(json_data2)
data2['log'].append(data)
with open('log.json', 'w') as outfile:
json.dump(data2, outfile)
class checkWeight():
... | StarcoderdataPython |
9638531 | <filename>answers/Drish-xD/Day-11/Question-1.py
# Program to Check the string is anagram, which is in turn a palindrome :)
def palindrome(string):
lst = [] # Empty list to store all odd occurring alphabets in the string
length1 = len(string)
for i in range(len(string)):
if string[i] in lst... | StarcoderdataPython |
5037928 | import re
import sys
from git import Repo
from utils import Mbox, get_issue, generate_branch_name
from constants import ISSUE_URL, WORKING_DIR, BASE_BRANCH_NAME
from startIssue import start_issue
from finishIssue import finish_issue
from cleanupIssue import cleanup_issue
def router(issue_url: str, working_dir: str ... | StarcoderdataPython |
76052 | from datetime import *
'''to find age of a person'''
try:
day=int(input("enter day as number "))
month=int(input("enter month as number (Eg: 1-for Jan 2-for feb) "))
year=int(input("enter year Eg-2004,2018 "))
dob=date(year,month,day)
print(dob)
today=datetime.now().date()
age=(today-dob)/timedelta(days=365.24... | StarcoderdataPython |
11391883 | <filename>spotty/providers/aws/cfn_templates/instance_profile/template.py
import os
import chevron
def prepare_instance_profile_template(managed_policy_arns: list):
with open(os.path.join(os.path.dirname(__file__), 'data', 'template.yaml')) as f:
content = f.read()
parameters = {
'HAS_MANAGED... | StarcoderdataPython |
3598278 | """
CloudFormation Lint Rules for Serverless applications
"""
| StarcoderdataPython |
3568251 | <filename>test/programytest/parser/base.py
import unittest
from programy.bot import Bot
from programy.config.bot.bot import BotConfiguration
from programy.context import ClientContext
from programytest.client import TestClient
from programytest.custom import CustomAssertions
class TestBot(Bot):
def __init__(sel... | StarcoderdataPython |
4999954 | """Kata: List Filering
#1 Best practice solution
def filter_list(l):
'return a new list with the strings filtered out'
return [i for i in l if not isinstance(i, str)]
"""
def filter_list(given_list):
"""Function filers list and removes anything that is not an int."""
return [i for i in given_list if ty... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.