id stringlengths 1 7 | text stringlengths 6 1.03M | dataset_id stringclasses 1
value |
|---|---|---|
3246014 | <gh_stars>10-100
# -*- coding: utf-8 -*-
# pylint: disable=E0401
import logging
from cryptoauthlib import constant as ATCA_CONSTANTS
log = logging.getLogger("ateccX08a.tests_selftest")
def run(device=None):
if not device:
raise ValueError("device")
tests = (
(ATCA_CONSTANTS.SELFTEST_MODE_RN... | StarcoderdataPython |
3115 | # pyRasp
# Copyright (c) <NAME> 2020. Licensed under MIT.
# requirement :
# Python 3
# pip install pyyaml
# pip install request
# pip install f90nml
from downloadGFSA import downloadGFSA
from prepare_wps import prepare_wps
from ungrib import ungrib
from metgrid import metgrid
from prepare_wrf import prepare_wrf
fro... | StarcoderdataPython |
3391841 | import sys
from collections import deque
import matplotlib as mpl
import numpy as np
from PyQt5 import QtCore, QtWidgets
import Runge_Kutta as Rk
from ui import Ui
# Constants
rc0 = 0.6
m = 1
a = 4.3
t0 = 0
t = t0
dt = 0.025
tmaxn = 200
ti = 0
r0 = 1
Pr0 = 1
r = r0
Pr = Pr0
r_range = (-6, 6)
Pr_range = (-6, 6)
V_... | StarcoderdataPython |
3295386 | #!/bin/python3
# The MIT License (MIT)
# Copyright © 2021 <NAME>
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
# documentation files (the “Software”), to deal in the Software without restriction, including without limitation
# the rights to use, copy, ... | StarcoderdataPython |
1640325 | """ Tests for validation report results, relies on test for loaders passing """
from decimal import DivisionByZero
from pathlib import Path
import os
from pytest import MonkeyPatch
import pytest
from dp_tools.bulkRNASeq.entity import BulkRNASeqSample
from dp_tools.bulkRNASeq.loaders import (
load_BulkRNASeq_STAGE... | StarcoderdataPython |
1602467 | <gh_stars>0
def sort(l, n):
for i in range(1, n):
temp, j = l[i], i
# while j>0 and temp<l[j-1]: # Asending Order
while j>0 and temp>l[j-1]: # Decending Order
l[j] = l[j-1]
j -= 1
l[j] = temp
if __name__ == "__main__":
# Inputs
numberList = [23, ... | StarcoderdataPython |
3372477 | <reponame>younhapan/ystdoc
# coding=utf8
class UserContact():
phone = ''
owner_id = ''
created_time = None
phone_location = ''
created_at = None
name = ''
call_count = ''
device_id = ''
class UserPhoneCall():
phone = ''
phone_location = ''
location = ''
owner_id = ''
... | StarcoderdataPython |
1756649 | <gh_stars>1-10
""" Coiflets 1 wavelet """
import numpy as np
class Coiflets1:
"""
Properties
----------
near symmetric, orthogonal, biorthogonal
All values are from http://wavelets.pybytes.com/wavelet/coif1/
"""
__name__ = "Coiflets Wavelet 1"
__motherWaveletLength__ = 6 # length of... | StarcoderdataPython |
66841 | <reponame>tristan/blockies
from setuptools import setup
setup(
name='blockies',
version='0.0.3',
author='<NAME>',
author_email='<EMAIL>',
py_modules=['blockies'],
url='http://github.com/tristan/blockies',
description='A tiny library for generating blocky identicons.',
long_description_c... | StarcoderdataPython |
1776684 | import functools
import operator
from chainer import initializers
from chainer import link
from chainer import variable
import chainer.functions as F
from persistent_memory_function import persistent_memory
class PersistentMemory(link.Chain):
def __init__(self, in_size, slot_size, memory_size, ini... | StarcoderdataPython |
120299 | <filename>tests/test_upload_and_restore.py
import filecmp
import os
import tempfile
import threading
from concurrent import futures
import grpc
import pytest
from pysrbup.backup_system_pb2_grpc import (BackupStub,
add_BackupServicer_to_server)
from pysrbup.client import Bac... | StarcoderdataPython |
115325 | # -*- coding: utf-8 -*-
# pragma pylint: disable=unused-argument, no-self-use
#
# (c) Copyright IBM Corp. 2010, 2018. All Rights Reserved.
#
"""
MlBernoulliNB
-------------
A machine learning model that uses the scikit-learn Bernoulli Naive Bayes algorithm.
https://scikit-learn.org/stable/modules/genera... | StarcoderdataPython |
27513 | import numpy as np
import pandas as pd
import xarray as xr
import matplotlib.pyplot as plt
import geocat.viz.util as gvutil
path = r'H:\Python project 2021\climate_data_analysis_with_python\data\sst.mnmean.nc'
ds= xr.open_dataset(path)
# time slicing
sst = ds.sst.sel(time=slice('1920-01-01','2020-12-01'))
# anomaly wi... | StarcoderdataPython |
3211149 | import os, csv, json, shutil
from data_tools.coco_tools import read_json
from PIL import Image
def reduce_data(oidata, catmid2name, keep_classes=[]):
"""
Reduce the amount of data by only keeping images that are in the classes we want.
:param oidata: oidata, as outputted by parse_open_images
:param ca... | StarcoderdataPython |
141620 | from PyQt5 import QtCore
from PyQt5.Qt3DCore import *
from PyQt5.Qt3DExtras import *
from PyQt5.Qt3DRender import *
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
class RenderWidget(QWidget):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.view = Qt... | StarcoderdataPython |
3267279 | <reponame>godontop/python-work<gh_stars>0
import re
pattern = r"gr.y"
# .(dot) matches any charactor(just one charactor)
if re.match(pattern, "grey"):
print("Match 1")
if re.match(pattern, "gray"):
print("Match 2")
if re.match(pattern, "gr$y"):
print("Match 3")
if re.match(pattern, "blue"):
print(... | StarcoderdataPython |
1714930 | import sys
from util import print_error,print_log,print_result
command = sys.argv[1]
if __name__ == '__main__':
try:
print("Calling creating loadbalancer service script")
from google_load_balancer import main
main(command)
except Exception as e:
print e
f = open('FAILU... | StarcoderdataPython |
96681 | <reponame>hockeyprincess/google-api-dfp-python
#!/usr/bin/python
#
# Copyright 2010 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache... | StarcoderdataPython |
75805 | from importlib import import_module
from os import environ
environment_name = environ.get('ENVIRONMENT_NAME', 'dev')
config = import_module('app.config.{}'.format(environment_name)).CONFIG
def get_config():
return config
| StarcoderdataPython |
88823 | '''
Title : Day 10: Binary Numbers
Domain : Tutorials
Author : <NAME>
Created : 03 April 2019
'''
#!/bin/python3
import math
import os
import random
import re
import sys
if __name__ == '__main__':
n = int(input())
b = str(bin(n))[2:]
l = len(b)
max_1 = 0
i = 0
while i < l... | StarcoderdataPython |
33410 | <filename>examples/example_interactive_prefix/main.py
"""This example read the settings and print them out, so you can check how they get loaded.
"""
# noinspection PyUnresolvedReferences,PyPackageRequirements
from settings import my_settings as settings
print("Redis Host:", settings.redis_host)
print("Redis Port:", ... | StarcoderdataPython |
3374880 | <gh_stars>10-100
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# _version.py
"""Package initialization for DVHA-Analytics."""
# Copyright (c) 2020 <NAME>
# This file is part of DVH Analytics
# See the file LICENSE included with this distribution, also
# available at https://github.com/cutright/DVH-Analytics
__au... | StarcoderdataPython |
1716555 | # -*- coding: utf-8 -*-
"""BioImageIT formats reader service provider.
This module implement the runner service provider
Classes
-------
RunnerServiceProvider
"""
from ._plugins._csv import (TableCSVServiceBuilder, ArrayCSVServiceBuilder, NumberCSVServiceBuilder)
from ._plugins._imagetiff import ImagetiffServiceBuil... | StarcoderdataPython |
3231134 | #
# Autogenerated by Thrift Compiler (0.9.3)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
# options string: py:new_style
#
from thrift.Thrift import TType, TMessageType, TException, TApplicationException
import sentry_common_service.ttypes
import sentry_policy_service.ttypes
from thrift.tr... | StarcoderdataPython |
74098 | <filename>client_sdk_python/middleware/normalize_request_parameters.py
from client_sdk_python.packages.eth_utils import (
is_string,
)
from client_sdk_python.utils.formatters import (
apply_formatter_at_index,
apply_formatter_if,
apply_formatters_to_dict,
)
from .formatting import (
construct_form... | StarcoderdataPython |
3320693 | from mindpile.Mapping.types import OutPort
from mindpile.Mapping.utils import MethodCall, Requires, Setup
@Setup
def largeMotorSetup():
return '''
from ev3dev2.motor import LargeMotor
'''
@MethodCall(target="MotorStop.vix", MotorPort=OutPort, BrakeAtEnd=bool)
@Requires(largeMotorSetup)
def largeMotorS... | StarcoderdataPython |
1751661 | """
Summary => The controller class for initializing the Robotic aritst.
Description => Will initilize the sequence of events for robotic artist.
This involves initializing the GUI and this will then initilize all
the other requirements in the product.
Author => <NAME> (mah60).
Version =>
0.1 - 23/02/2018 - T... | StarcoderdataPython |
1697394 | <gh_stars>0
def stations_level_over_threshold(stations, tol):
names = []
ranges = []
waterlevels = []
relwaterlevels = []
for station in stations:
names.append(station.name)
waterlevels.append(station.latest_level)
ranges.append(station.typical_range)
for z in range... | StarcoderdataPython |
9805 | import os
SERVER_NAME = os.getenv('DOMAIN_SUPERSET')
PUBLIC_ROLE_LIKE_GAMMA = True
SESSION_COOKIE_SAMESITE = None # One of [None, 'Lax', 'Strict']
SESSION_COOKIE_HTTPONLY = False
MAPBOX_API_KEY = os.getenv('MAPBOX_API_KEY', '')
POSTGRES_DB=os.getenv('POSTGRES_DB')
POSTGRES_PASSWORD=os.getenv('POSTGRES_PASSWORD')
POSTG... | StarcoderdataPython |
1774267 | """
Module containing the code for the add command in then CLI.
"""
import json
import logging
from pathlib import Path
import os
from .operations.environment_manager_operations import EnvironmentManagerOperations
from .common_operations import (
append_requirement, backup_requirements,
rollback_requirement, l... | StarcoderdataPython |
3365152 | # Copyright (c) 2015 Rackspace, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | StarcoderdataPython |
3237285 | <reponame>dealfonso/ipfloater
#! /usr/bin/env python
# coding: utf-8
#
# Floating IP Addresses manager (IPFloater)
# Copyright (C) 2015 - GRyCAP - Universitat Politecnica de Valencia
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publi... | StarcoderdataPython |
1610124 | def aumentar(preco=0, taxa=0, formato=False):
"""
-> Função que retorna o valor monetario formatado
:param preco: valor a ser formatado
:param taxa: percentual a ser adicionado
:param formato: formata a moeda
:return: se falso não formata se true formata
"""
res = preco + (preco * taxa/1... | StarcoderdataPython |
1797653 | # influenced by https://www.reddit.com/r/adventofcode/comments/a3kr4r/2018_day_6_solutions/eb7385m/
import itertools
from collections import defaultdict, Counter
def part1(points):
max_x, max_y = max(x[0] for x in points), max(x[1] for x in points)
grid = defaultdict(lambda: -1)
for x, y in itertools.pr... | StarcoderdataPython |
3317605 | example = """ |
| +--+
A | C
F---|----E|--+
| | | D
+B-+ +--+
"""
import os.path
INPUT=os.path.join(os.path.dirname(__file__), "input.txt")
with open(INPUT) as f:
data = f.read()
# Part 1
def func(data):
# find start
maze = []
for line in data.spl... | StarcoderdataPython |
4841632 | #!usr/bin/env python
from tkinter import *
root = Tk()
v = StringVar()
def test(content, reason, name):
if content == "whu":
print("right")
print(content, reason, name)
return True
else:
print("fault")
print(content, reason, name)
return False
testCMD = root.... | StarcoderdataPython |
3287488 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
from astropy.io.fits.util import _is_int
__all__ = ['BoundingBox']
class BoundingBox:
"""
A rectangular bounding box in integer (not float) pixel indices.
Parameters
----------
ixmin, ixmax, iymin, iymax : int
... | StarcoderdataPython |
1714998 | <gh_stars>0
"""Common classes used as base for the integration test
and the unittest.
"""
import io
import logging
import os
import shutil
import tempfile
import time
import unittest
import requests
import urllib3
from app import create_app
class BaseTest(unittest.TestCase):
@classmethod
def get_testdata_pa... | StarcoderdataPython |
135892 | <reponame>stockdillon/AMPED_MSU_Capstone<filename>comprehend/cam-backend-master-e5bd2e9e571e99ee3c655986cb5895bfa12c9174/deserializer.py<gh_stars>0
import enum
import json
import collections
class ComprehendResponse(object):
def __init__(self,name='Comprehend Response'):
self.name = name
def __repr__... | StarcoderdataPython |
3207485 | # coding: utf-8
from memcached import Memcached # noqa
| StarcoderdataPython |
7021 | <reponame>richteer/pyfatafl<gh_stars>0
from module import XMPPModule
import halutils
import pyfatafl
class Game():
self.players = []
self.xmpp = None
self.b = None
self.turn = ""
self.mod = None
def __init__(self, mod, p1, p2):
self.players = [p1, p2]
self.mod = mod
self.xmpp = mod.xmpp
self.xmpp.sendMs... | StarcoderdataPython |
1703841 | <reponame>ATCtech/Automate-Tasks
from PIL import Image, ImageDraw, ImageFont
import pandas as pd
form = pd.read_csv("test_mail_new.csv")
#name_list = ["<NAME>", "<NAME>", "<NAME>"]
#c_no = ["ABC123", "ABC124", "ABC125"]
c_no = form['certificate_no'].to_list()
name_list = form['receiver_names'].to_list()
for i,j in ... | StarcoderdataPython |
3340886 | <filename>raylab/envs/wrappers/gaussian_random_walks.py<gh_stars>10-100
"""Wrapper for introducing irrelevant state variables."""
import gym
import numpy as np
from gym.spaces import Box
from .mixins import IrrelevantRedundantMixin, RNGMixin
from .utils import assert_flat_box_space
class GaussianRandomWalks(Irreleva... | StarcoderdataPython |
1617882 | #!/usr/bin/env python3
from PyQt5.QtWidgets import QApplication, QSystemTrayIcon, QMenu, QAction
from PyQt5.QtGui import QIcon
import sys
import subprocess
import resources
class Inhibitation():
def __init(self):
self.__cookie = -1
pass
def start(self):
self.__cookie = subprocess.Pope... | StarcoderdataPython |
11238 | <reponame>dnootana/Python<filename>Interview/langTrans.py
#!/usr/bin/env python3.8
table="".maketrans("0123456789","\N{Devanagari digit zero}\N{Devanagari digit one}"
"\N{Devanagari digit two}\N{Devanagari digit three}"
"\N{Devanagari digit four}\N{Devanagari digit five}"
"\N{Devanagari digit six}\N{Devanagari digit s... | StarcoderdataPython |
3398572 | <gh_stars>0
"""API views."""
# Django REST framework
from rest_framework import viewsets
# Models
from .models import Author, Book
# Serializers
from .serializers import AuthorSerializer, BookSerializer
class BookViewSet(viewsets.ModelViewSet):
"""Book Views class."""
queryset = Book.objects.all()
ser... | StarcoderdataPython |
42760 | from tensorflow.keras.layers import (Conv2D, Dense, Flatten, MaxPooling2D,
TimeDistributed)
def VGG16(inputs):
x = Conv2D(64,(3,3),activation = 'relu',padding = 'same',name = 'block1_conv1')(inputs)
x = Conv2D(64,(3,3),activation = 'relu',padding = 'same', name = 'bl... | StarcoderdataPython |
3275284 | masks_folder = '/home/minglee/Documents/aiProjects/git_clone/face-id-with-medical-masks/imageNoneMask'
verbose = 'store_true'
skip_warnings = 'store_true'
database_file = '/home/minglee/Documents/aiProjects/git_clone/face-id-with-medical-masks/folderCreateJsonFIle/data.json'
masks_database_file = '/home/minglee/Docum... | StarcoderdataPython |
3322056 | <gh_stars>10-100
#!/usr/bin/env python3
import json
import sys
# requires a full design space
try:
f = sys.argv[1]
except:
print("Expects report json file: ./pretty_print.py <report>.json")
exit(-1)
handle = open(f, "r")
x = json.load(handle)
handle.close()
for i in range(1, 9):
for j in range(1, 9... | StarcoderdataPython |
3378340 | # -*- coding: utf-8 -*-
import logging
import util
import os
import os.path as path
from os.path import basename
from util import bcolors
from os.path import join
from shutil import copyfile
def open_assignment(backend, config, station):
"""
Otvara pojedinačan studentski zadatak na osnovu zadatog naziva računara n... | StarcoderdataPython |
183493 | <reponame>NinjaDero/Directly<gh_stars>1-10
from Directly import Ext
@Ext.cls
class Buttons():
@staticmethod
@Ext.method
def ping(request):
return "Pong!"
@staticmethod
@Ext.method
def reverse(request, text):
return text[::-1]
@staticmethod
@Ext.method
def full_caps... | StarcoderdataPython |
1779670 | #!/usr/bin/python3
import json, argparse, time, logging
import requests, requests.packages
import os
import sys
sys.path.append(r"/usr/local/fworch/importer")
import fwcommon, common, getter
requests.packages.urllib3.disable_warnings() # suppress ssl warnings only
parser = argparse.ArgumentParser(description='Read c... | StarcoderdataPython |
154725 | <reponame>tshu-w/deep-learning-project-template
#!/usr/bin/env python
import json
import logging
from collections import ChainMap
from datetime import datetime
from pathlib import Path
from typing import Any
import shtab
from pytorch_lightning.loggers import LightningLoggerBase, LoggerCollection
from pytorch_lightnin... | StarcoderdataPython |
3382520 | from ideas.examples import switch
from ideas.import_hook import remove_hook
def test_transform():
source = """
switch EXPR:
case EXPR_1:
SUITE
case EXPR_2:
SUITE
case in (EXPR_3, EXPR_4, ...):
SUITE
else:
... | StarcoderdataPython |
3312684 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
import base64
import hashlib
import HTMLParser
import json
import random
import re
import string
import sys
import time
import urllib2
import requests
import xbmcgui
from bs4 import BeautifulSoup
from xbmcswift2 import Plugin
import danmuku
import os
def random_sentence(si... | StarcoderdataPython |
1751941 | <gh_stars>0
from datetime import datetime
from hashlib import sha1
from os import path
from re import search
from typing import Any, Dict, List
from unicodedata import normalize
from elasticsearch_dsl import Document
from lxml import etree
from kosh.utils import logger
from kosh.utils import namespaces as ns
class ... | StarcoderdataPython |
1655512 | from django.http import HttpResponse
from houdini_stats.models import *
from stats_main.models import *
from django.contrib.gis.geoip import GeoIP
from settings import REPORTS_START_DATE, _this_dir
from dateutil.relativedelta import relativedelta
import json
import re
import datetime
import time
import hashlib
import ... | StarcoderdataPython |
174853 | <filename>Lib/compositor/scriptList.py<gh_stars>1-10
"""
ScriptList object (and friends).
"""
__all__ = ["ScriptList", "ScriptRecord", "ScriptCount", "LangSysRecord", "LangSysCount"]
class ScriptList(object):
__slots__ = ["ScriptCount", "ScriptRecord"]
def __init__(self):
self.ScriptCount = 0
... | StarcoderdataPython |
3230460 | <reponame>ismailah28/URL-Shortener
from django.http import Http404, HttpResponse, HttpResponseRedirect
from django.shortcuts import render, get_object_or_404
from django.views import View
from analytics.models import ClickEvent
from .forms import SubmitUrlForm
from .models import KirrUrl
# Create your views here.
clas... | StarcoderdataPython |
1766233 | <reponame>Yuhta/dfcompare<gh_stars>0
from dfcompare import BufferedIterator, compare, Identical, Different, Unmatched
import pandas as pd
import unittest
class TestBufferedIterator(unittest.TestCase):
def test_head(self):
it = BufferedIterator(iter([1, 2, 3]))
self.assertEqual(it.head(), 1)
... | StarcoderdataPython |
1784762 | from typing import Any
""" Class to encode and decode the input string """
class HuffmanCoding:
def recur(self, node, vi, val=''):
""" Recur to add nodes with huffman codes """
new_v = val + str(node.hufcode)
if(node.left):
self.recur(node.left, vi, new_v)
if (node.... | StarcoderdataPython |
176760 | <filename>test/bar_test.py
# -*- coding:utf-8 -*-
'''
Created on 2017/9/24
@author: <NAME>
'''
import unittest
import tushare.stock.trading as fd
class Test(unittest.TestCase):
def set_data(self):
self.code = '300770'
self.start = ''
self.end = ''
def test_bar_data(self):
... | StarcoderdataPython |
3325468 | <gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import codecs
import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
with codecs.open(os.path.join(here, 'README.rst'), encoding='utf-8') as f:
readme = f.read()
with codecs.open(os.path.join(here, 'CHANGEL... | StarcoderdataPython |
34173 | '''
191. Number of 1 Bits
Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming weight).
For example, the 32-bit integer ’11' has binary representation 00000000000000000000000000001011, so the function should return 3.
'''
class Solution(object):
de... | StarcoderdataPython |
3289463 | <reponame>mrshu/stash
#!/usr/bin/env python
import sys, os, re, json, argparse, time, pytz
import console
from datetime import datetime, timedelta
from difflib import unified_diff, ndiff
def argue():
parser = argparse.ArgumentParser()
parser.add_argument('-v', '--verbose', action='store_true')
parser.ad... | StarcoderdataPython |
1741452 | <filename>7/7/finall/models/weather.py<gh_stars>1-10
class Weather:
def __init__(self, city_name, temp, feel, temp_max, temp_min, humidity):
self.city_name = city_name
self.temp = temp
self.feel = feel
self.temp_min = temp_min
self.temp_max = temp_max
self.humidity = ... | StarcoderdataPython |
3267022 | #! /usr/bin/env python3
import sys
import os
from pydub import AudioSegment
from pydub.playback import play
def read_header(lines):
bpm = None
offset = None
audio_name = None
i = None
header = []
for i in range(len(lines)):
if lines[i][:4] == "BPM:":
bpm = float(lines[i][4... | StarcoderdataPython |
1696300 | # Find the maximum element in an array which is first increasing and then decreasing
# Given an array of integers which is initially increasing and then decreasing,
# find the maximum value in the array.
# Examples :
# Input: arr[] = {8, 10, 20, 80, 100, 200, 400, 500, 3, 2, 1}
# Output: 500
# Input: arr[] = {1, 3,... | StarcoderdataPython |
43138 | from box import Box
from src import repos
from src.processors import SelfIteratingProcessor
from src.processors import use_cases
def CallbackDelivery(config: Box = None):
use_case = use_cases.DeliverCallbackUseCase(
delivery_outbox_repo=repos.DeliveryOutbox(config.DELIVERY_OUTBOX_REPO),
topic_base... | StarcoderdataPython |
1747545 | from __future__ import division
from __future__ import absolute_import
import pytest
from returns.future import FutureResult, future_safe
from returns.io import IOResult, IOSuccess
@future_safe
async def _coro(arg):
return 1 / arg
@pytest.mark.anyio()
async def test_future_safe_decorator():
u"""Ensure that... | StarcoderdataPython |
110447 | import click
from coder.app import create_app
from coder.extensions import db
from coder.blueprints.billing.gateways.stripecom import Plan as PaymentPlan
# Create an app context for the database connection.
app = create_app()
db.app = app
@click.group()
def cli():
""" Perform various tasks with Stripe's API. ""... | StarcoderdataPython |
61025 | <reponame>renmengye/inc-few-shot-attractor-public
"""Runs a baseline for prototype networks for incremental few-shot learning.
Author: <NAME> (<EMAIL>)
See run_exp.py for usage.
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import numpy as np
import... | StarcoderdataPython |
185074 | <gh_stars>10-100
import asyncio
import re
import time
from hashlib import md5
from _config import Config
from shared import Shared
from log import Log
class Camera:
def __init__(self, camera_hash):
self.hash = camera_hash
self.url = self._parse_url(Config.cameras[camera_hash]['url'])
self.... | StarcoderdataPython |
1657426 | """
Diags package.
This package contains the Diagnostics class, which implements the rover diagnostics.
"""
from __future__ import print_function
import rospy
import time
import os
import subprocess
import re
import textwrap
from std_msgs.msg import String, Float32MultiArray, UInt8
from diagnostics.watcher i... | StarcoderdataPython |
3202408 | from flask import current_app
from itsdangerous import TimedJSONWebSignatureSerializer as Serializer
from itsdangerous import BadSignature
from app.models.user import User
def generate_auth_token(user_class, expiration):
s = Serializer(current_app.config['SECRET_KEY'], expires_in=expiration)
return s.dumps({... | StarcoderdataPython |
27628 | <reponame>fishface60/python-flock
#!/usr/bin/python
# Copyright (c) 2015, <NAME>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS P... | StarcoderdataPython |
1649473 | <gh_stars>1-10
import requests
from urllib.parse import urlparse
from urllib.request import urljoin
__all__ = 'Config', 'Nord'
class Config(object):
"""
Nord Configuration Client
"""
base = 'https://api.nordvpn.com'
endpoints = {
'address': '/user/address',
'config': '/files/zipv2... | StarcoderdataPython |
3228312 | from django.apps import AppConfig
class PytuidConfig(AppConfig):
name = 'pyTUID'
| StarcoderdataPython |
1702600 | <filename>pvlibs/process_data/models/recombination.py
'''
'''
''' Imports '''
# data array processing
import numpy as np
''' Recombination Lifetime Calculation Functions '''
def calc_tau_aug(_dn, _n, _p, _n_0, _p_0, _n_i_eff, _T):
''' Calculate Auger Recombination Lifetime
Empirical model for au... | StarcoderdataPython |
3222504 | import os
import sys
import json
import torch
import logging
from tqdm import tqdm
from . import loader_utils
from ..constant import BOS_WORD, EOS_WORD
logger = logging.getLogger()
# -------------------------------------------------------------------------------------------
# preprocess label
# ----------------------... | StarcoderdataPython |
29078 | <reponame>atish3/mig-website
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('history', '0006_committeemember_member'),
]
operations = [
migrations.AlterField(
m... | StarcoderdataPython |
102799 | <gh_stars>0
# This file will load only if OPi.GPIO fails because of a Dev environment.
# The basic idea is that when a pin is made HIGH or LOW it is writen into a file,
# and then when the input is checked it reads the file.......
from . import extendJSON as JSON
# Values
LOW = 0
HIGH = 1
# Modes
BCM = 11
BOARD = 1... | StarcoderdataPython |
1766602 | # Copyright (c) 2021, <NAME>
# Licensed under BSD 3-Clause License. See LICENSE.txt for details.
from .where import where
from .value_locate import value_locate | StarcoderdataPython |
40178 | #!/usr/bin/python3
import json
import os
import subprocess
# Icons for the animation
sleep = ""
icons_base = ["","","","",""]
# Path to the script
__location__ = os.path.realpath(
os.path.join(os.getcwd(), os.path.dirname(__file__)))
# Run the script for getting the CPU usage
subprocess.Popen([os.path.join... | StarcoderdataPython |
1683337 | import socket
import os
import math
se = socket.socket()
port = 5001
contype = input("Enter 1 for manual ip entering 2 for automatic ip configuration : ")
if contype == "1":
hostip = input("Enter virtual network ip : ")
elif contype == "2":
hostip = socket.gethostbyname(socket.gethostname())
se.bind((hostip... | StarcoderdataPython |
3340687 | <reponame>CESNET/exafs<filename>migrations/versions/76856add9483_.py<gh_stars>1-10
"""empty message
Revision ID: 76856add9483
Revises: <PASSWORD>
Create Date: 2019-01-28 10:22:17.904055
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '76856add<PASSWORD>3'
down_... | StarcoderdataPython |
66585 | # Copyright 2016-2017 Capital One Services, LLC
# Copyright The Cloud Custodian Authors.
# SPDX-License-Identifier: Apache-2.0
import itertools
import operator
import zlib
import jmespath
from c7n.actions import BaseAction, ModifyVpcSecurityGroupsAction
from c7n.exceptions import PolicyValidationError, ClientError
fro... | StarcoderdataPython |
1767845 | <reponame>cmhc/cs
#coding:utf8
'''
clean style
===========
简介:清理代码中的样式,但是不清理标签
###功能和用途###
用作抓取网页中含有大量的无用标记,本程序能够有效的清理,但是请注意,程序使用正则表达式
性能的消耗可能会不小,请在自己的本机上跑,避免在服务器上运行
'''
import re
#默认忽略参数
#清理,参数为html内容
def clean(html,ignore="img",deltags="a|span"):
#首先只留下标签
if ignore == '':
exp = "<(?P<tag... | StarcoderdataPython |
1633762 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# ProDy: A Python Package for Protein Dynamics Analysis
#
# Copyright (C) 2010-2012 <NAME>
#
# 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 vers... | StarcoderdataPython |
1759498 | <reponame>zinebabercha/zineb-abercha<filename>1.Chapter-Python/presentation/ch01/1.age1.py
# Copyright 2013, <NAME>
#
# Developed for use with the book:
#
# Data Structures and Algorithms in Python
# <NAME>, <NAME>, and <NAME>
# <NAME>, 2013
#
# This program is free software: you can redistribute it and/or mod... | StarcoderdataPython |
4831355 | <filename>fonty/lib/__init__.py
'''fonty.lib'''
| StarcoderdataPython |
1651353 | <reponame>portfolioplus/pysymbolscanner<gh_stars>1-10
import wikipedia as wp
import wptools
from pysymbolscanner.infobox import Infobox
from pysymbolscanner.const import (
blocklist_search,
most_common_endings,
remove_most_common_endings,
)
from pysymbolscanner.utils import get_wiki_page_title_and_links, ge... | StarcoderdataPython |
187928 | """
File: hailstone.py
Name: <NAME>
-----------------------
This program should implement a console program that simulates
the execution of the Hailstone sequence, as defined by Douglas
Hofstadter. Output format should match what is shown in the sample
run in the Assignment 2 Handout.
"""
# This constant controls when... | StarcoderdataPython |
3226995 | <filename>str_analysis/convert_gangstr_spec_to_expansion_hunter_variant_catalog.py<gh_stars>1-10
"""This script converts a GangSTR repeat spec to an ExpansionHunter variant catalog. This simplifies the process of
switching from GangSTR to ExpansionHunter to genotype a set of loci previously genotyped using GangSTR.
"""... | StarcoderdataPython |
3328939 | # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'targets': [
{
'target_name': 'shell_api',
'type': 'static_library',
'sources': [
'<@(schema_files)',
],
# TODO... | StarcoderdataPython |
4842304 | <filename>apps/logs/views.py
from collections import Counter
from functools import reduce
from pprint import pprint
from time import monotonic
from core.exceptions import BadRequestException
from core.filters import PkMultiValueFilterBackend
from core.logic.dates import date_filter_from_params, parse_month
from core.l... | StarcoderdataPython |
4824189 | <reponame>JonathanGailliez/azure-sdk-for-python<filename>azure-keyvault/azure/keyvault/v7_0/models/key_properties_py3.py
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.t... | StarcoderdataPython |
3233703 | <reponame>rodrigomelo9/uvm-python
#//----------------------------------------------------------------------
#// Copyright 2007-2010 Mentor Graphics Corporation
#// Copyright 2007-2010 Cadence Design Systems, Inc.
#// Copyright 2010 Synopsys, Inc.
#// Copyright 2019 <NAME>
#// All Rights Reserved Worldwide
#//... | StarcoderdataPython |
3317504 | <reponame>carmatthews/VideoIndexer<gh_stars>0
# Get a list of all videos in your account in video indexer - returns the VideoId you need for other operations
#List Videos API: https://api-portal.videoindexer.ai/docs/services/Operations/operations/List-Videos?
import requests
##### CONFIGURE YOUR ACCOUNTS & A... | StarcoderdataPython |
3335097 | import copy
import datetime
from kardboard.tests.core import KardboardTestCase
class CardBlockTests(KardboardTestCase):
def setUp(self):
super(CardBlockTests, self).setUp()
self.card = self.make_card()
self.card.save()
self.required_data = {
'reason': 'You gotta lock t... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.