id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
1043 | import os
from setuptools import setup
VERSION = "0.2"
def get_long_description():
with open(
os.path.join(os.path.dirname(os.path.abspath(__file__)), "README.md"),
encoding="utf8",
) as fp:
return fp.read()
setup(
name="instapaper-to-sqlite",
description="Save data from In... | StarcoderdataPython |
1753297 | import numpy
def upshift(a,index,n):
col = []
for j in range(len(a)):
col.append(a[j][index])
shiftCol = numpy.roll(col,-n)
for i in range(len(a)):
for j in range(len(a[0])):
if(j==index):
a[i][j] = shiftCol[i]
def downshift(a,index,n):
col = []
for ... | StarcoderdataPython |
1784564 | from django.db import models
from django.utils.text import slugify
# TODO
'''
1. set predefined values(choices) for the block name, block slug, block_name
2. associate the user and complaints with all the models below
3. set predefined values(choices) for floor numbers
4. I've set the choices for the ... | StarcoderdataPython |
3399741 | class View():
def __init__(self, scene):
self.scene = scene | StarcoderdataPython |
1729206 | # -*- coding: utf-8 -*-
"""
@date: 2021/7/24 下午1:34
@file: compare_zcl_pytorch_and_onnx.py
@author: zj
@description: compare zcls pytorch's result with onnxruntime's result
"""
import os
import torch
import argparse
import onnxruntime
import numpy as np
from functools import reduce
from zcls.config import cfg
from ... | StarcoderdataPython |
126774 | <reponame>bidhata/EquationGroupLeaks
import datetime
import sys
import dsz
import ops
import ops.system.systemversion
dsz.control.echo.Off()
version = ops.system.systemversion.get_os_version(maxage=datetime.timedelta.max)
if ((version.versioninfo.major >= 6) and (version.versioninfo.arch == 'x64')):
ops.error('Pat... | StarcoderdataPython |
183026 | import nltk
import sys
from nltk import WordNetLemmatizer
from pyspark.ml.feature import IDF, CountVectorizer
from pyspark.sql.types import *
from pyspark.sql.functions import *
from pyspark.ml.clustering import LDA, BisectingKMeans
from pyspark.sql import SQLContext
from pyspark import SparkConf, SparkContext
import ... | StarcoderdataPython |
3286682 | from django.urls import path
from cride.circles.views import list_circles, create_cricle
urlpatterns = [
path('circles/', list_circles),
path('circles/create/', create_cricle),
] | StarcoderdataPython |
29007 | <reponame>rootifera/sceptre<filename>integration-tests/steps/test_update_stack.py
from behave import *
import subprocess
import os
import boto3
@when("the stack config is changed")
def step_impl(context):
# Get config file path
vpc_config_file = os.path.abspath(os.path.join(
os.path.dirname(os.path.di... | StarcoderdataPython |
3279581 | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import pandas as pd
# In[3]:
ideb_escola_2017 = pd.read_csv('../../data/bases_lidia/anos_iniciais/ideb_escola_2017_ai.csv')
# In[5]:
ideb_escola_2017.head().T
# In[ ]:
| StarcoderdataPython |
3380509 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# PyAlgoTrade
#
# 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
#
#... | StarcoderdataPython |
112732 | # Aiogram imports
from aiogram import types
# Module imports
from ..config import database_file, groups_dict
from ..database import Database
from ..texts import mystat, allstat, allstat_user, no_allstat
# Reply user stats
async def get_user_info(msg: types.Message):
database = Database(database_file)
group_n... | StarcoderdataPython |
83346 | <gh_stars>1-10
"""
Created on Wed Sep 23 08:38:56 2015
@author: aidanrocke
"""
#taken from here: http://rosettacode.org/wiki/Miller-Rabin_primality_test#Python
import numpy as np
def sequence_filter(skeleton, angle_indices):
"""this function checks whether a sequence of frames that is being loaded
using... | StarcoderdataPython |
1681087 | #!/usr/bin/python
import os
from sys import argv
from sys import exit as sysex
from lxml import etree
import requests
from html2text import html2text
def get_banek(addr):
req = requests.get('http://baneks.ru/' + addr)
req.encoding = 'utf-8'
parser = etree.HTMLParser()
root = etree.fromstring(req.tex... | StarcoderdataPython |
22580 | # -*- coding: utf-8 -*-
# Copyright (c) 2011,2014 <NAME> <<EMAIL>>
#
# 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 PROVIDED "AS I... | StarcoderdataPython |
165295 | #!/usr/bin/python3
def max_integer(my_list=[]):
if (len(my_list) == 0):
return (None)
a = my_list[0]
for i in range(0, len(my_list)):
if (my_list[i] > a):
a = my_list[i]
return (a)
| StarcoderdataPython |
150649 | # Generated by Django 3.2.6 on 2021-09-22 17:37
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('spyfall', '0003_players_refresh_room'),
]
operations = [
migrations.AlterField(
model_name='players',
name='refresh_... | StarcoderdataPython |
1664288 | <filename>scraper/streamer.py
import sys
import time
import logging
import tweepy
import args
import utils
from listener import StreamListener
from settings import ACCESS_KEY, ACCESS_SECRET, CONSUMER_KEY, CONSUMER_SECRET
logger = logging.getLogger(__name__)
"""
List of named location query (--location-query) na... | StarcoderdataPython |
3355977 | <filename>python/plugins/processing/algs/saga/SagaAlgorithmBase.py
# -*- coding: utf-8 -*-
"""
***************************************************************************
SagaAlgorithmBase.py
---------------------
Date : August 2017
Copyright : (C) 2017 by <NAME>
Email ... | StarcoderdataPython |
1703958 | import torch
from torch import nn, Tensor
from typing import Union, Tuple, List, Iterable, Dict
import torch.nn.functional as F
from enum import Enum
from sentence_transformers import SentenceTransformer
class TripletDistanceMetric(Enum):
"""
The metric for the triplet loss
"""
COSINE = lambda x, y: 1... | StarcoderdataPython |
1790002 | <filename>tests/plugins/dummy_plugin.py
def setup(spec):
spec.old_plugins["tests.plugins.dummy_plugin"]["foo"] = 42
| StarcoderdataPython |
1766102 | <reponame>Bibliome/obo-utils
#!/usr/bin/env python
# MIT License
#
# Copyright (c) 2017 Institut National de la Recherche Agronomique
#
# 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 wit... | StarcoderdataPython |
42156 | <filename>genre/util/util_cam_para.py
import numpy as np
def read_cam_para_from_xml(xml_name):
# azi ele only
import xml.etree.ElementTree
e = xml.etree.ElementTree.parse(xml_name).getroot()
assert len(e.findall('sensor')) == 1
for x in e.findall('sensor'):
assert len(x.findall('transform... | StarcoderdataPython |
3316733 | <reponame>msherman64/portal
from django.core.urlresolvers import reverse
from django.contrib import admin
from . import models
from . import forms
@admin.register(models.EarlyUserProgram)
class EarlyUserProgramAdmin(admin.ModelAdmin):
form = forms.EarlyUserProgramAdminForm
list_display = ('name', 'state', 'par... | StarcoderdataPython |
70597 | # -*- coding: utf-8 -*-
import logging
from core.helpers.log_format import format_dict
from core.models.base_product import BaseProduct
class ProductCollection(object):
"""
Коллекция продуктов (простой список) в объектном виде.
умеет добавлять продукты по имени из указанного фида
"""
def __init... | StarcoderdataPython |
1765639 |
import os
import numpy as np
# from . import _api, cbook, colors, ticker
import matplotlib
from matplotlib.lines import Line2D
from matplotlib.patches import Rectangle
from matplotlib.text import Text
from matplotlib.widgets import AxesWidget
from matplotlib.backends.qt_compat import QtGui
import matplotlib.pyplot as... | StarcoderdataPython |
1670286 | from django import template
register = template.Library()
# Django Software Foundation, "Custom Template tags and Filters", 2021-10-10
# https://docs.djangoproject.com/en/3.2/howto/custom-template-tags/#inclusion-tags
@register.inclusion_tag('tagtemplates/card_gh_event.html')
def card_gh_event(github_event):
retu... | StarcoderdataPython |
3273851 | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
"""VirusTo... | StarcoderdataPython |
3210486 | from datetime import datetime
from django.test import TestCase
from model_mommy import mommy
from ..models import User
class UserModelTest(TestCase):
def setUp(self):
self.user = mommy.make(User)
def test_create(self):
self.assertTrue(User.objects.exists())
def test_email_unique(self)... | StarcoderdataPython |
190133 | <filename>style-guide/serial-comma.py
# -*- coding: utf-8 -*-
"""serial comma check."""
from proselint.tools import memoize, existence_check
@memoize
def check_comma(text):
"""Use serial comma after penultimate item."""
err = "style-guide.serial-comma"
msg = "Use serial comma after penultimate item."
... | StarcoderdataPython |
3235864 | from src.leilao.excecoes import LanceInvalido
class Usuario:
def __init__(self, nome, carteira):
self.__nome = nome
self.__carteira = carteira
@property
def nome(self):
return self.__nome
@property
def carteira(self):
return self.__carteira
def propoe_lance(se... | StarcoderdataPython |
3355990 | from brownie import network, accounts
from brownie.network.transaction import TransactionReceipt
FORKED_LOCAL_BLOCKCHAIN_ENVIRONMENTS = ["mainnet-fork", "mainnet-fork-dev"]
LOCAL_BLOCKCHAIN_ENVIRONMENTS = ["development", "ganache-local-1"]
def wait_for_tx_confs(txid: str, conf_nb: int = 1):
tx_receipt = Transact... | StarcoderdataPython |
1681612 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
.. module:: utilities
:platform: Unix
:synopsis: the top-level submodule of Dragonfire that provides various utility tools for different kind of tasks.
.. moduleauthor:: <NAME> <<EMAIL>>
"""
import inspect # Inspect live objects
import os # Miscellaneous opera... | StarcoderdataPython |
3290609 | <gh_stars>0
import sys
sum = 0
def process(uri: str):
global sum
sum = 0
line = open(uri, 'r').readline().replace('\n', '').strip()
data = []
for char in line:
data.append(char)
# Remove '!' and the following
while '!' in data:
for i in data:
if i == '!':
... | StarcoderdataPython |
4819418 | <reponame>ShawnJSavoie2/ToBeRedone
# IDLE (Python 3.8.0)
# Time To Deceleration
c = 299792458.0
def user_input_handling_function_sixth():
print()
user_input = input('Enter: ')
print()
good_to_go = 'no'
errors = []
digits = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '.']
while good... | StarcoderdataPython |
4814418 | <reponame>Lyukov/notes_enhancement
from skimage.io import imread, imsave
import numpy as np
from skimage.color import rgb2gray, rgb2yuv, yuv2rgb
from skimage import exposure, img_as_float, img_as_ubyte
from scipy.ndimage.filters import gaussian_filter
import os
import sys
import bisect
import argparse
def stretch(imag... | StarcoderdataPython |
1745790 | '''
Deployment manager client
Created on Jan 3, 2017
@author: riaps
'''
import os
import zmq
import capnp
from riaps.proto import deplo_capnp
from riaps.consts.defs import *
from .exc import SetupError
import logging
class DeplClient(object):
'''
Deployment service client of an actor
'''
def __init__... | StarcoderdataPython |
4830456 | import gym
import numpy as np
'''
使用 动态规划 实现 FrozenLake-v0
动态规划法基于 贝尔曼公式 的迭代,包括 policy/value iteration
具体,包括 policy evaluation(PI)/optimization(VI) + policy improvement 两步
另外需要注意,动态规划法 需要完整的 MDP
只有 FrozenLake 等 环境 提供了 完整的 MDP
'''
POLICY_ITERATION = True # 控制使用 policy 或 value iteration
MAX_ITER = 500000
GAMMA = ... | StarcoderdataPython |
3252348 | # This file is part of the Data Cleaning Library (openclean).
#
# Copyright (C) 2018-2021 New York University.
#
# openclean is released under the Revised BSD License. See file LICENSE for
# full license details.
"""Implementation of the Nearest Neighbor clustering (also known as kNN) that
use a string similarity func... | StarcoderdataPython |
3303648 | <reponame>tejassp2002/RnD-Project<filename>src/openspiel/openspiel.py
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from open_spiel.python import rl_environment
from open_spiel.python.algorithms import random_agent
import torch
i... | StarcoderdataPython |
1642441 | import unittest
from tempfile import mkdtemp
from os.path import join
from shutil import rmtree
from json import dumps, loads
import copy
from .settings import SPEC_DATA_DIR
from slyd.gitstorage.repoman import Repoman
def j(json):
return dumps(json, sort_keys=True, indent=4)
class RepomanTest(unittest.TestCas... | StarcoderdataPython |
3301109 | <reponame>s-tian/robosuite
"""
Collection of Buffer objects with general functionality
"""
import numpy as np
class Buffer(object):
"""
Abstract class for different kinds of data buffers. Minimum API should have a "push" and "clear" method
"""
def push(self, value):
"""
Pushes a new... | StarcoderdataPython |
3305797 | # -*- coding: utf-8 -*-
"""
Created on Mon May 20 11:35:23 2019
@author: DiPu
"""
import numpy as np
# taking input 9 space separated digits
numbers=[int(n) for n in input("enter 9 numbers:").split()]
#converting into numpy array
x=np.array(numbers)
#reshaping to 2 d array
x=x.reshape(3,3)
print(x) | StarcoderdataPython |
1766943 | <filename>test_script.py
import twintel as tw
| StarcoderdataPython |
92768 | # ---
# jupyter:
# jupytext:
# formats: ipynb,py:light
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.10.1
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# +
from proto.messages_... | StarcoderdataPython |
3210346 | # Copyright © 2021 BaraniARR
# Encoding = 'utf-8'
# Licensed under MIT License
# Special Thanks for gogoanime
from pyrogram import *
from pyrogram.types import *
# Attractive Welcome message
def start_message(client, message):
kkeeyyb = [
[InlineKeyboardButton("📪UPDATES", url="https://t.me/coderzHex"),I... | StarcoderdataPython |
150838 | #
# Copyright 2018-2019 IBM Corp. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | StarcoderdataPython |
3319579 | from django.db import models
from django.contrib.auth.models import User
from django.dispatch import receiver
from django.db.models.signals import post_save
def custom_upload_to(instance,filename):
old_instance = Profile.objects.get(pk=instance.pk)
old_instance.avatar.delete()
return 'profiles/' + filename... | StarcoderdataPython |
3256136 | """
arXiv vectors
==============
Tasks for converting arXiv abstracts to vectors via BERT in batches.
"""
from nesta.core.luigihacks.luigi_logging import set_log_level
from nesta.core.luigihacks.misctools import f3p
from nesta.core.luigihacks.misctools import load_batch_config
from nesta.core.luigihacks.text2vectask ... | StarcoderdataPython |
162613 | <filename>salt/_states/suseconnect.py
# -*- coding: utf-8 -*-
#
# Author: <NAME> <<EMAIL>>
#
# Copyright 2019 SUSE LLC.
#
# 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 copyri... | StarcoderdataPython |
3262583 | <filename>demo-meta-optimize.py
########################################################################
# SwarmOps - Heuristic optimization for Python.
# Copyright (C) 2003-2016 <NAME>.
# See the file README.md for instructions.
# See the file LICENSE.txt for license details.
# SwarmOps on the internet: http://www.Hva... | StarcoderdataPython |
1769649 | import keras
from PIL import Image
from keras.applications.mobilenet import MobileNet,preprocess_input
from keras.utils import to_categorical
from keras.layers import Dense, Activation, Dropout
from keras.models import Model
from keras.optimizers import Adam
import numpy as np # linear algebra
import pandas as pd # dat... | StarcoderdataPython |
3315608 | <reponame>tylerIams/MB_Portal
from home.decorators import group_required_multiple
from django.contrib.auth.models import User as DjangoUser
from django.shortcuts import render, redirect
from home.models.models import Classroom, Attendance, Notification
from home.models.salesforce import ClassOffering
from staff.staff_v... | StarcoderdataPython |
41637 | <gh_stars>0
from path import Path
d = Path(__file__).parent.parent.parent
Path(d).chdir()
import pandas as pd
from sodapy import Socrata
def socrata_client(client_url: str, dataset_api_key: str, filename: str):
"""
client_url = found under developer portal -> str
dataset_api_key = found under developer por... | StarcoderdataPython |
3323999 | <gh_stars>1-10
from pathlib import Path
import click
import cloudpickle
def export(nb, output, force=False):
if not force and Path(output).exists():
click.echo(f'Notebook "{output}" already exists. Use --force to overwrite')
raise click.Abort()
nb.to_ipynb(output)
def get_selector():
bi... | StarcoderdataPython |
104002 | import uuid
from django.db import models
from django.contrib.auth import get_user_model
class Location(models.Model):
id = models.UUIDField(
primary_key=True,
default=uuid.uuid4,
editable=False,
)
latitude = models.FloatField()
longitude = models.FloatField()
address = mode... | StarcoderdataPython |
1653753 | <filename>koku/api/provider/test/test_serializers.py
#
# Copyright 2021 Red Hat Inc.
# SPDX-License-Identifier: Apache-2.0
#
"""Test the Provider serializers."""
import copy
import random
import uuid
from itertools import permutations
from unittest.mock import patch
from faker import Faker
from rest_framework import s... | StarcoderdataPython |
1619691 | from regalloc import *
frodNo = 0 #used for label numbering of COMPARE
reloplatest='-1' #used to store info for compare and jump
def nrelop(relop): #outputs the negation of reloplatest
if relop == "==":
return "!="
if relop == "!=":
return "=="
if relop == "<=":
return ">"
if... | StarcoderdataPython |
1715860 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Event classes.
Event representes events which take plase on browser DOM.
Usually users don't need to instantiate these classes directly.
"""
from asyncio import ensure_future, iscoroutinefunction, Future
from collections import defaultdict, OrderedDict
from typing i... | StarcoderdataPython |
3354787 | <gh_stars>0
""" Fixtures used for testing """
def state_machine():
''' Basic state machine for testing '''
simple_definition = (
'{"Comment": "An example of the Amazon States Language using a choice state.",'
'"StartAt": "DefaultState",'
'"States": '
'{"DefaultState": {"Type": "... | StarcoderdataPython |
1601409 | <filename>circle2.py
# circle2.py
array1 = [1, 2, 5, 3, 6, 8, 4, 10] # 建立list
def rank(array):
for i in range(len(array) - 1, 0, -1): # 从6到1间隔-1 注:“-”表示倒叙
if array [i - 1] > array [i]:
array [i - 1] , array [i] = array [i], array [ i - 1 ]
return print(array)
rank(array1)
| StarcoderdataPython |
168480 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import shutil
import sys
import tempfile
from observations.r.minard_troops import minard_troops
def test_minard_troops():
"""Test module minard_troops.py by downloading
minard_troops.csv and testing sha... | StarcoderdataPython |
3385570 | from requests.exceptions import HTTPError
def raise_detailed_error(request_object):
try:
request_object.raise_for_status()
except HTTPError as e:
# raise detailed error message
# TODO: Check if we get a { "error" : "Permission denied." } and handle automatically
raise HTTPError... | StarcoderdataPython |
130920 | # Run a test server.
import argparse
from app import create_app
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Runs BabyNames.')
parser.add_argument('--port', '-p', action='store', default=8000, type=int)
args = parser.parse_args()
app = create_app(debug=True)
app.run(ho... | StarcoderdataPython |
37746 | import os
# getting path so you can run the script python3 App_init, python3 .
if os.getcwd()[-8:] != "App_init":
default_path = "App_init/"
print(default_path)
else:
default_path = ""
# reading all built in modules
default_modules = open(f"{default_path}default_modules.txt", "r").readlines()
for a, i in ... | StarcoderdataPython |
1649349 | <reponame>mchelem/cref2<filename>cref/structure/clustering/__init__.py
import logging
import os
from sklearn.cluster import KMeans
from sklearn.preprocessing import OneHotEncoder
from sklearn import preprocessing
import matplotlib.pyplot as plt
from pylab import cm
from scipy import sparse
import numpy as np
from ... | StarcoderdataPython |
151227 |
'''
Make a mask of the emission
'''
from astropy.io import fits
from spectral_cube import SpectralCube, BooleanArrayMask
from signal_id import RadioMask, Noise
from astropy import units as u
make_mask = True
save_mask = False
cube = SpectralCube.read("M33_206_b_c_HI.fits")
cube = cube.with_mask(cube != 0*u.Jy)
if... | StarcoderdataPython |
3275950 | ############################################################################
##
## Copyright (C) 2006-2007 University of Utah. All rights reserved.
##
## This file is part of VisTrails.
##
## This file may be used under the terms of the GNU General Public
## License version 2.0 as published by the Free Software Foundat... | StarcoderdataPython |
1681315 | <gh_stars>10-100
import sys
python_version_min = '2.7.0'
pandas_version_min = '0.7.0'
global_results = ''
def main():
pyVersion = sys.version_info
# print('python version: ' + str(pyVersion[0]) + '.' + str(
# pyVersion[1]) + '.' + str(pyVersion[2]))
check_libraries()
print(global_results)
d... | StarcoderdataPython |
1709619 | import dask.dataframe as dd
from hypernets.tabular import sklearn_ex as skex, dask_ex as dex, get_tool_box
from hypernets.tabular.cache import cache, CacheCallback
from hypernets.tabular.datasets import dsutils
from hypernets.utils import Counter
class CacheCounter(CacheCallback):
def __init__(self):
supe... | StarcoderdataPython |
168031 | from traceback_with_variables import print_cur_tb # , format_cur_tb, iter_cur_tb_lines
def f(n):
print_cur_tb()
# cur_tb_str = format_cur_tb()
# cur_tb_lines = list(iter_cur_tb_lines())
return n + 1
def main():
f(10)
main()
| StarcoderdataPython |
171687 | from __future__ import annotations
from .abs import abs_val
def abs_min(x: list[int]) -> int:
"""
>>> abs_min([0,5,1,11])
0
>>> abs_min([3,-10,-2])
-2
>>> abs_min([])
Traceback (most recent call last):
...
ValueError: abs_min() arg is an empty sequence
"""
if len(x) ==... | StarcoderdataPython |
3221817 | <reponame>AIica/Crypto-2020
import mistune
import six
from flask import current_app as app, request, redirect, url_for, session, render_template, abort, jsonify
from CTFd.cache import cache
from CTFd.models import (
db,
Challenges,
Fails,
Pages,
Configs,
Tracking,
Teams,
Files
)
try:
... | StarcoderdataPython |
5021 | <reponame>carthage-college/django-djcorsche
"""
Django settings for project.
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
# Debug
#DEBUG = False
DEBUG = True
TEMPLATE_DEBUG = DEBUG
INFORMIX_DEBUG = "debug"
ADMINS = (
('', ''),
)
MANAGERS = ADMINS
SECRET_KEY = ''
ALLOWED_H... | StarcoderdataPython |
1756348 | from ukz import Song
# Sections:
# Intro
# Launch1
# Silence1
# Silence2
# Launch2
# Stars
# OuterSpace
song = Song("""
bpm 120
%bell tubular bell o4 v127
%hit church organ o2 v120
%hit orchestra hit o2 v127
%trumpet trumpet o4 v127
%s square o4 v127 50 40 30 20
%s2 square o4 v127 100 85
%choir choir aahs o5 v105... | StarcoderdataPython |
1772197 | <filename>utils/eval.py
import numpy as np
from enum import Enum
# import pickle
from .overlap import calculate_iou_partly
from .overlap import image_box_overlap
np.set_printoptions(precision=2,suppress=True)
class apMethod(Enum):
interp11 = 1
interp40 = 2
interp41 = 9
interpAll = 3
interpHyb11 = ... | StarcoderdataPython |
119559 | <gh_stars>0
"""
State is a behavioral design pattern that lets an object alter its behavior when its internal state changes.
It appears as if the object changed its class.
"""
import time
from abc import abstractmethod
class TurnstileStates():
"""
The base State class
"""
@abstractmethod
def en... | StarcoderdataPython |
3389531 | from typing import Type
import pytest
from ..core import type_params_issubclass, merge_params
from .. import Proxytype, GenericProxytype, is_generic, validate_typespec
from ... import Struct, List, Tuple, Int, Float, Str
# NOTE: we test with non-Proxytype classes for this first test to be a little more hermetic,
# si... | StarcoderdataPython |
1762834 | <filename>opentelemetry-api/tests/propagators/test_propagators.py
# Copyright The OpenTelemetry Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/... | StarcoderdataPython |
1735593 | # -*- coding: utf-8 -*-
import numpy as np
np.set_printoptions(precision=3, linewidth=256)
from dyconnmap.fc import pli
if __name__ == "__main__":
data = np.load("data/eeg_32chans_10secs.npy")
print(np.shape(data))
ts, avg = pli(data, [1.0, 4.0], 128.0, pairs=None)
print(avg)
| StarcoderdataPython |
3310756 | # proxy module
from __future__ import absolute_import
from mayavi.filters.delaunay3d import *
| StarcoderdataPython |
3222035 | <gh_stars>0
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'catalog_registration.ui'
#
# Created by: PyQt5 UI code generator 5.13.0
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(QtWidgets.QMainWindow):
def s... | StarcoderdataPython |
1619443 | import asyncio
from typing import (
Tuple,
)
import pytest
from helpers import (
DummyResponse,
)
from lahja import (
BroadcastConfig,
Endpoint,
)
@pytest.mark.asyncio
async def test_internal_propagation(pair_of_endpoints: Tuple[Endpoint, Endpoint]) -> None:
endpoint1, endpoint2 = pair_of_endpo... | StarcoderdataPython |
3363550 | <gh_stars>1-10
#
# Author: <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 or agreed to in writing,... | StarcoderdataPython |
3282007 | ##
# Copyright 2002-2012 <NAME>, PDC KTH
#
# 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 ... | StarcoderdataPython |
3261168 | <reponame>NafizTech/Beginner-python-projects
"""
Beginner Python Project using input, print, and conditionals by NafizTEch
"""
import time
username = 'kylie'
password = '<PASSWORD>'
username_input = input('Username: ')
password_input = input('Password: ')
if username_input == username and password_input... | StarcoderdataPython |
3309525 | <reponame>ethancharles02/cse210-project
"""
The draw actors action module contains the class and function to draw the actors on the screen.
"""
from data.action import Action
class DrawActorsAction(Action):
"""
DrawActorsAction draws actors onto the screen from a given cast using the execute method
Stereo... | StarcoderdataPython |
1788649 | from django.contrib import admin
from .models import Transference
# Register your models here.
admin.site.register(Transference)
| StarcoderdataPython |
1654105 | <reponame>baineng/feaflow
import multiprocessing
import os
import shutil
from datetime import datetime
from pathlib import Path
from sys import platform
import pandas as pd
import pytest
from feaflow.engine.spark import (
SparkEngine,
SparkEngineSession,
SparkExecutionEnvironment,
)
from feaflow.job impor... | StarcoderdataPython |
3275954 | <reponame>miketrumpis/ecoglib
"""
Many visualization utilities
"""
import matplotlib.cm
from matplotlib.gridspec import GridSpec
from matplotlib.figure import Figure
from matplotlib.collections import LineCollection
from matplotlib.patches import Polygon
from matplotlib.lines import Line2D
import matplotlib.offsetbox ... | StarcoderdataPython |
3269040 | <filename>invenio_records_marc21/ui/theme/webpack.py
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
#
# Copyright (C) 2021 Graz University of Technology.
#
# Invenio-Records-Marc21 is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see LICENSE file for more
# det... | StarcoderdataPython |
1786119 | <filename>datasets/two_dim/data_augmentation.py
import numpy as np
from batchgenerators.transforms import Compose, MirrorTransform
from batchgenerators.transforms.crop_and_pad_transforms import CenterCropTransform, RandomCropTransform
from batchgenerators.transforms.spatial_transforms import ResizeTransform, SpatialTra... | StarcoderdataPython |
138464 | <reponame>startnew/async_logging
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2019/12/3 17:06
# @Author : zhuzhaowen
# @email : <EMAIL>
# @File : my_async_logging.py
# @Software: PyCharm
# @desc : "异步记录日志信息"
import threading
from queue import Queue
import os
import logging
from logging.handlers... | StarcoderdataPython |
4808217 | from ray.rllib.agents.a3c.a3c_tf_policy import A3CTFPolicy
from ray.rllib.agents.ppo.ppo_tf_policy import PPOTFPolicy
from ray.rllib.agents.dqn.dqn_tf_policy import DQNTFPolicy
from rlcard.rllib_utils.random_policy import RandomPolicy
from rlcard.rllib_utils.trainer import RLTrainer
# rlcard_env_id = 'blackjack'
# rlc... | StarcoderdataPython |
188301 | import numpy as np
def pack_selector_from_mask(boolarray):
"""
pack all contiguous selectors into slices. Remember that
tiledb multi_index requires INCLUSIVE indices.
"""
if boolarray is None:
return slice(None)
assert type(boolarray) == np.ndarray
assert boolarray.dtype == bool... | StarcoderdataPython |
1727925 | # graph_viewer_serial.py
# NOTE on operating system/platform:
# This example runs on multiple operating systems (including Windows
# and Linux) and uses serial over USB to get data from the MS430 sensor
# via a microcontroller board (e.g. Arduino, ESP8266, etc).
# An alternate version, "graph_viewer_I2C.py" ... | StarcoderdataPython |
1707046 | #!/usr/bin/env python
import signal
import phatbeat
print("""
pHAT BEAT: Buttons
Shows off the various ways you can configure buttons on PHAT BEAT.
Press Ctrl+C to exit!
""")
@phatbeat.on(phatbeat.BTN_FASTFWD)
def fast_forward(pin):
print("FF Pressed")
@phatbeat.hold(phatbeat.BTN_FASTFWD, hold_time=2)
def ... | StarcoderdataPython |
68591 | <filename>tests/components/homekit_controller/specific_devices/test_koogeek_p1eu.py
"""Make sure that existing Koogeek P1EU support isn't broken."""
from homeassistant.components.sensor import SensorStateClass
from homeassistant.const import POWER_WATT
from tests.components.homekit_controller.common import (
HUB_... | StarcoderdataPython |
3298480 | # Created by <NAME> at 1/23/21
# Copyright © 2021 Carbon, Inc. All rights reserved.
import numpy as np
from sklearn.svm import LinearSVC
import matplotlib.pyplot as plt
def svm_test():
svm = LinearSVC(random_state=0)
X = np.array([-4, -3, -2, -1, 0, 1, 2, 3, 4]).reshape(-1, 1)
y = np.array([-1 if i < 1 e... | StarcoderdataPython |
1729270 | <filename>script/static-checks/check-copyright.py<gh_stars>0
#!/usr/bin/env python3
#
# Copyright (c) 2019-2020, Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
"""
Check if a given file includes the copyright boiler plate.
This checker supports the following comment styles:
/*
*
... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.