id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
3200595 | <reponame>menga-team/menga-lang
import json
import sys
def s(_):
return '"' + _ + '"'
def i(_):
return str(_)
def b(_):
if _:
return "true"
else:
return "false"
def enc(typ, val):
if typ == "int":
return i(val)
elif typ == "string":
return s(val)
elif typ ... | StarcoderdataPython |
1600844 | <gh_stars>0
'''
Created on 24.02.2017
Mockup for development
@author: steinorb
'''
BOARD = 1
OUT = 1
IN = 1
BCM = 1
def setmode(a):
print(a)
def setup(a, b):
print(a, b)
def output(a, b):
print(a, b)
def input(a):
return 0
def cleanup():
pass
def setwar... | StarcoderdataPython |
1638546 | <reponame>CircuitMess/CircuitBlocks
#!/bin/python
import os
import sys
import httplib
import urllib
import json
from StringIO import StringIO
import shutil
"""
Script for bundling Arduino Blockly extensions into one Node.JS module.
Based on build.py found in https://github.com/google/blockly
"""
# eslint doe... | StarcoderdataPython |
4836844 | <filename>pygram/__init__.py<gh_stars>10-100
from pygram.pygram import PyGram
| StarcoderdataPython |
1628460 | <filename>named_entities.py
import argparse
import os
from utils import Service
def main(text_file):
access_token = os.environ.get('LANGUAGE_API')
service = Service('language', 'v1beta1', 'analyzeEntities', access_token=access_token)
with open(text_file, 'rb') as f:
text = f.read().decode('utf-... | StarcoderdataPython |
1750992 | # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# Copyright (c) 2019, Eurecat / UPF
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of... | StarcoderdataPython |
41217 | <filename>genkey/migrations/0007_auto_20190328_1149.py
# Generated by Django 2.0.4 on 2019-03-28 02:49
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('genkey', '0006_auto_20190327_1004'),
]
operations = [
migrations.RenameModel(
old... | StarcoderdataPython |
3220664 | <filename>libs/settings.py<gh_stars>0
import pickle
import os
import sys
class Settings(object):
def __init__(self):
# Be default, the home will be in the same folder as labelImg
home = os.path.expanduser("~")
self.data = {}
# self.path = os.path.join(home, '.labelImgSettings.pkl')... | StarcoderdataPython |
89119 | from django.apps import AppConfig
class RenderServiceConfig(AppConfig):
name = 'render_service'
| StarcoderdataPython |
4837474 | <filename>circa/core/email.py<gh_stars>1-10
# A helper module to generate emails and avoid spaghetti code
from circa.settings import ALLOWED_HOSTS
from django.core.mail import EmailMessage
from core.payout import calc_payout
LISTING_BOUGHT_SELLER = \
"Dear {},\n\nYour item, {}, has been sold! Your total earni... | StarcoderdataPython |
1740025 | """Unit test module for the Trade Object.
Will perform an instance test to make sure it creates it. Additionally,
it will test different properties and methods of the object.
"""
import unittest
from unittest import TestCase
from configparser import ConfigParser
from pyrobot.robot import PyRobot
from pyrobot.trades ... | StarcoderdataPython |
19523 | #
# 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 us... | StarcoderdataPython |
1769477 | <gh_stars>10-100
import re
import pandas as pd
import numpy as np
class Extract_Commands():
# 提取微博评论的内容
def __init__(self, content):
super(Extract_Commands, self).__init__()
self.content = content
if content == '':
raise Exception('评论内容为空')
def clear_quotation(self):
... | StarcoderdataPython |
3214034 | #!/usr/bin/env python3
import os
import json
#print out all env variables as plain text
#print("Content-Type: text/plain")
#print()
#print(os.environ)
#print env variables as json
print("Content-Type: application/json")
print()
print(json.dumps(dict(os.environ), indent=2))
#print query parameter data in html
#pri... | StarcoderdataPython |
1746032 | from aimm.plugins.common import (Model,
initialize,
exec_data_access,
exec_instantiate,
exec_fit,
exec_predict,
exec_seria... | StarcoderdataPython |
27074 | from setuptools import setup
with open('README.md', 'r') as f:
long_description = f.read()
setup(
name = 'dogey',
version = '0.1',
description = 'A pythonic dogehouse API.',
long_description = long_description,
long_description_content_type = 'text/markdown',
author = 'Shadofer#7312',
... | StarcoderdataPython |
3228917 | #!/pxrpythonsubst
#
# Copyright 2017 Pixar
#
# Licensed under the Apache License, Version 2.0 (the "Apache License")
# with the following modification; you may not use this file except in
# compliance with the Apache License and the following modification to it:
# Section 6. Trademarks. is deleted and replaced with:
#
... | StarcoderdataPython |
109406 | <reponame>justinkjackson/ImpactTestFixture<filename>enterTool.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import time
from PyQt5 import QtWidgets, uic
from PyQt5.QtCore import pyqtSlot
# import second capture tool screen
from captureTool2 import CaptureTool2
EnterToolUI, EnterToolWind... | StarcoderdataPython |
1669099 | #!/usr/bin/env python
from setuptools import setup
version = '2.0.3'
repo_url = 'https://github.com/agerasev/test_cmd_x'
download_url = repo_url + '/tarball/' + version
setup(name='test_cmd_x',
version=version,
description='Tool for black-box testing command-line programs, with extensions',
long_de... | StarcoderdataPython |
4843235 | <reponame>Dekatron322/onion
# Generated by Django 3.1.7 on 2022-01-29 10:36
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0010_auto_20220129_1025'),
]
operations = [
migrations.AlterField(
model_name='problem',
... | StarcoderdataPython |
3344330 | import pymysql.cursors
import json
from decimal import *
import time
import random
connection = pymysql.connect(host='localhost',
user='root',
passwd='<PASSWORD>',
db='gotham',
charset='utf8mb4',
... | StarcoderdataPython |
1721675 | <reponame>TheoLvs/beth<filename>beth/evaluation/elo.py
raise NotImplementedError()
A = 1
B = 0.5
C = 2
def expected(A,B,base_elo=400):
return 1/(1+10**((B-A)/base_elo))
def elo(old,exp,score,k = 32):
return old + k * (score - exp)
for i in range(10):
exp = expected(A,B,base_elo = 0.5)
if i < 8:
... | StarcoderdataPython |
1645484 | <gh_stars>1-10
from synergine.core.connection.Display import Display
class TestDisplay(Display):
def start_of_cycle(self):
pass
def end_of_cycle(self):
pass
def draw_objects(self, objects, point):
pass | StarcoderdataPython |
1641886 | <gh_stars>1-10
from contextlib import contextmanager
from math import cos, sin, pi, tau
from glm import vec3, ivec2, normalize, vec2
from game.constants import FULL_FOG_DISTANCE, GREEN, DEBUG
from game.entities.ai import CircleAi, CombinedAi
from game.entities.butterfly import Butterfly
from game.entities.buttabomber... | StarcoderdataPython |
118847 | <gh_stars>0
class Solution:
# @param {integer[]} nums
# @return {integer}
def singleNumber(self, nums):
a = set(nums)
a = sum(a)*2
singleNumber = a - sum(nums)
return singleNumber
| StarcoderdataPython |
5022 | <filename>records/12-09/ffff.py<gh_stars>10-100
__author__ = '<NAME>'
__email__ = '<EMAIL>'
__date__ = '12/9/2020 4:18 PM'
from abc import abstractmethod
class Product(object):
@abstractmethod
def setMsg(self, msg="default info"):
self.msg = msg
@abstractmethod
def info(self):
print... | StarcoderdataPython |
98353 | <reponame>KnownAsNob/SOStimate
# Generated by Django 3.0.3 on 2020-03-08 16:52
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('VisualizeApp', '0002_auto_20200128_1845'),
]
operations = [
migra... | StarcoderdataPython |
1672133 | <gh_stars>0
#!/Users/iamDarshan/Documents/Projects/Web/shop/bin/python
#
# The Python Imaging Library.
# $Id$
#
# print image files to postscript printer
#
# History:
# 0.1 1996-04-20 fl Created
# 0.2 1996-10-04 fl Use draft mode when converting.
# 0.3 2003-05-06 fl Fixed a typo or two.
#
from __future__ i... | StarcoderdataPython |
3345404 | """Keeping track of mapping and reduce operations over tasks."""
from copy import deepcopy
from . import helpers_state as hlpst
from .helpers import ensure_list
from .specs import BaseSpec
class State:
"""
A class that specifies a State of all tasks.
* It's only used when a task have a splitter.
... | StarcoderdataPython |
199132 | <gh_stars>0
from flask import Flask, json
from BL import DistanceItemFactory
app = Flask(__name__)
class Service:
distance_items = object()
def start(self, host, port):
self.distance_items = DistanceItemFactory.get_init_distance_items()
app.run(host, port)
instance = Service(... | StarcoderdataPython |
105340 | <reponame>xiaohh2016/python-25
###实现一个timeit的装饰器:timeit 装饰能够计算被装饰函数的运行时间
import datetime
def copy_properties(src,dst):
dst.__name__ = src.__name__
dst.__doc__ = src.__doc__
def try_timeit(fn,number=10000):
def wrapper(*args,**kwargs):
start = datetime.datetime.now()
for _ in range(number)... | StarcoderdataPython |
1725470 | import subprocess
from helpers import msg
@msg('r (?P<cmd>.*)')
def handle(bot, grouper):
who = grouper('nick')
target = grouper('target')
try:
ps = subprocess.Popen(['redis-cli']+grouper('cmd').split(),
stdin=subprocess.PIPE,
stdout=sub... | StarcoderdataPython |
3266582 | """
Django settings for demo project.
Generated by 'django-admin startproject' using Django 3.2.9.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.2/ref/settings/
"""
from pathlib im... | StarcoderdataPython |
98776 | #
# testin main: contras_cli
import pytest
import sys
import pdb
sys.path.append("./src")
from crypty import encrypt, decrypt
import io_wrap
import contras_cli as cli
@pytest.mark.happy
def test_usr_happy_path_1(mocker, inputs, out_fn, spec_out_es,
out_data):
t_inputs = inputs[0]
t_outputs = []
... | StarcoderdataPython |
184307 | <filename>pyke/tests/test_kepbls.py
import pytest
from astropy.io import fits as pyfits
from astropy.utils.data import get_pkg_data_filename
from ..kepbls import kepbls
from ..kepio import delete
# fake light curve with transits of period = 2.02 days
# and duration 0.18 days
fake_lc = get_pkg_data_filename("data/golde... | StarcoderdataPython |
162664 | from mcpi.minecraft import Minecraft
mc = Minecraft.create()
pos = mc.player.getTilePos()
x = pos.x
y = pos.y
z = pos.z
bottomStep = 0
topStep = 256
stepWidth = x + 3
melonBlock = 103
stone = 1
mc.setBlock(x, y, z, melonBlock)
for s in range(bottomStep, topStep):
for sw in range(x, stepWidth):
mc.setBlock(sw,... | StarcoderdataPython |
198394 | <filename>基础教程/A1-Python与基础知识/算法第一步/ExampleCodes/chapter16/16-7.py
def recursion_test(depth):
print("recursion depth:", depth)
if depth < 996:
recursion_test(depth + 1)
else:
print("exit recursion")
return
# 下面是 代码16-5,重复出现,不要出现在代码示例里:
recursion_test(1) | StarcoderdataPython |
4839682 | # Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
# @param {ListNode} head
# @return {boolean}
def isPalindrome(self, head):
s = []
while head != None:
s.append(head.val)
... | StarcoderdataPython |
167322 | from flask import Flask
from .main.routes import main
from .extensions import mongo
def create_app():
app = Flask(__name__)
app.config['MONGO_URI'] = ''
app.register_blueprint(main)
mongo.init_app(app)
return app
| StarcoderdataPython |
1677768 | <reponame>angel-penchev/banknote-serial<filename>recognition/detect.py
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
import tensorflow as tf
import numpy as np
import cv2
import argparse
import json
import glob
from src.character_recognition import overlap, serial_decode
from src.text_recognition import decode
... | StarcoderdataPython |
3389 | # This module provides mocked versions of classes and functions provided
# by Carla in our runtime environment.
class Location(object):
""" A mock class for carla.Location. """
def __init__(self, x, y, z):
self.x = x
self.y = y
self.z = z
class Rotation(object):
""" A mock class... | StarcoderdataPython |
3397337 | """
我测测试扫描脚本
"""
import requests
import re
from lxml import html
class AzureScanner:
"""
扫描脚本
将域名写入 domains.txt
"""
def __init__(self):
# 保存的文件名
self.filename = 'domains.txt'
@staticmethod
def getdomain(page=1, debug=False):
url = "https://freedns.afraid.org/domai... | StarcoderdataPython |
1797386 | <reponame>bhrzslm/uncertainty-reasoning
#!/usr/bin/env python
import copy
# a potential has a set of variables and a CPT
variable_c = ('c', 2)
variable_s = ('s', 2)
variable_r = ('r', 2)
variable_w = ('w', 2)
pc_vars = (variable_c,)
pc_cpt = {
(0,) : 0.5,
(1,) : 0.5
}
pot_c = (pc_vars,... | StarcoderdataPython |
3269908 | from bson.objectid import ObjectId
from pymongo import helpers
import streamlit as st
from Controllers.ECGModel import ECG
import wfdb
from datetime import datetime
import pandas as pd
import Controllers.Constants as cons
import Controllers.Common as common
import Views.DownloadChannel as download_channel
import Scrape... | StarcoderdataPython |
1624024 | <filename>GAN/simple_curve.py
import numpy as np
import tensorflow as tf
def get_y(x):
return 10 + x*x
def sample_data(n=10000, scale=100):
data = []
x = scale*(np.random.random_sample((n,))-0.5)
for i in range(n):
yi = get_y(x[i])
data.append([x[i], yi])
return np.array(data)
... | StarcoderdataPython |
149505 | <reponame>Dauriel/signalpeptides
import numpy as np
import sys
from sklearn.neural_network import MLPClassifier
import math
import random
from bionetwork import BioNetwork as bio
def main(arc):
#Network creation
network = bio()
#Obtain testing set and testing labels
X = getData(arc)
... | StarcoderdataPython |
113557 | from __future__ import unicode_literals
from django.core.urlresolvers import reverse
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import python_2_unicode_compatible
from base.models import ActiveManager, StandardMetadata
@python_2_unicode_compatible... | StarcoderdataPython |
3373499 | from enum import IntEnum
class GraphIR(IntEnum):
identity = 0
relay = 1
treelite = 2
| StarcoderdataPython |
3307926 | <filename>frontend/urls.py
from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name='index'),
path('following',views.index, name='index'),
path('profile/<str:username>',views.index, name='index'),
path('login', views.index, name='index'),
path('signup', vi... | StarcoderdataPython |
13919 | <reponame>johink/willsmith
from tkinter import Label, GROOVE
from willsmith.gui_display_controller import GUIDisplayController
class MCTSDisplay(GUIDisplayController):
"""
The display controller for MCTSAgent.
Creates a Tkinter GUI that displays some stats about the agent's latest
moves.
"""
... | StarcoderdataPython |
1670288 | """
WSGI config for {{ project_name }} project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
from django.core.exceptio... | StarcoderdataPython |
3215661 | <reponame>hadi-f90/SphinxMinooTheme<filename>sphinx_minoo_theme/__init__.py
from __future__ import print_function
import os
"""SphinxMinooTheme.
https://github.com/saeiddrv/SphinxMinooTheme.
"""
class MinooVersion():
major = "0"
minor = "9"
micro = "7"
level = "Beta"
release = r"2015/09/20"
d... | StarcoderdataPython |
3255737 | import pytest
from tests.conftest import generate_port_lists, generate_priority_lists
@pytest.fixture(autouse=True, scope="module")
def rand_one_oper_up_intf(request):
"""
Fixture that randomly selects one oper up interface
Args:
request (object): pytest request object
Yields:
interf... | StarcoderdataPython |
1748987 | <gh_stars>100-1000
import struct
import os
from .base import FirmwareObject, RawObject, BaseObject, AutoRawObject
from .uefi import FirmwareVolume
from .utils import print_error, dump_data, sguid, green, blue
PFS_GUIDS = {
"FIRMWARE_VOLUMES": "7ec6c2b0-3fe3-42a0-a316-22dd0517c1e8",
"INTEL_ME": "7439e... | StarcoderdataPython |
1690921 |
"""Utilities for deriving new names from existing names.
Style objects are used to customize how :ref:`storable objects are found for DataSet objects <using-loadable-fixture-style>`
"""
__all__ = [
'CamelAndUndersStyle', 'TrimmedNameStyle', 'NamedDataStyle',
'PaddedNameStyle', 'ChainedStyle']
class Style(o... | StarcoderdataPython |
187162 | <gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from os import getenv
import logging
from typing import NoReturn
COMMIT_SHA = getenv('CI_COMMIT_SHA', 'ERROR_NO_VAR')
LOG_FILENAME = 'error_logs_' + COMMIT_SHA + '.txt'
logging.basicConfig(filename=LOG_FILENAME, level=logging.ERROR)
class execution_transpar... | StarcoderdataPython |
1780440 | import quran.endpoints.grpc.edition_pb2 as edition_proto
import quran.endpoints.grpc.edition_pb2_grpc as edition_rpc
import quran.endpoints.grpc.entity_pb2 as entity_proto
from quran.domain.edition import Edition
from quran.factory.edition_factory import EditionFactory
from quran.utils.proto_converter import ProtoConve... | StarcoderdataPython |
1432 | """Organize the calculation of statistics for each series in this DataFrame."""
import warnings
from datetime import datetime
from typing import Optional
import pandas as pd
from tqdm.auto import tqdm
from visions import VisionsTypeset
from pandas_profiling.config import Settings
from pandas_profiling.model.correlati... | StarcoderdataPython |
3280099 | from PIL import Image
from pprint import pprint
import math
def get_image(im):
if type(im) == str:
image = Image.open(im,'r')
else:
image = im
width, height = image.size
pixel_values = list(image.getdata())
# if image.mode == 'RGB':
# channels = 3
# elif image.mode == 'L':
# channels = 1
# else:
... | StarcoderdataPython |
119405 | <filename>charlotte/resources/renderers/mathdown.py
import markdown
def render(raw):
html = markdown.markdown(raw)
return html
def head():
html = """
<script type="text/x-mathjax-config">
MathJax.Hub.Config(
{
elements: document.querySelectorAll(".ma... | StarcoderdataPython |
13525 | '''
Created on Apr 16, 2014
@author: jtaghiyar
'''
import os
import subprocess as sub
from plumber import Plumber
from job_manager import LocalJobManager
from workflow_manager import WorkFlow
from helpers import trim, make_dir, export_to_environ
class ComponentAbstract(object):
"""
component template.... | StarcoderdataPython |
3286369 | # coding: utf-8
from flask import Flask, request, session
from twilio.twiml.messaging_response import MessagingResponse
from twilio.rest import Client
import random
import pprint
pp = pprint.PrettyPrinter(indent=4)
import requests
import urllib2
import ssl
file_phone_numbers = open("file_phone_numbers", "r")
# This ... | StarcoderdataPython |
3200408 | import sys
for line in sys.stdin:
if line.startswith('#'):
sys.stdout.write(line)
continue
else:
tab_split = line.strip().split("\t")
if len(tab_split) == 1:
continue
else:
position = int(tab_split[1])
end = int(line.replace("CIEND","X... | StarcoderdataPython |
1783350 | <reponame>jin10086/py-evm
from eth.tools.fixtures.helpers import (
get_test_name,
)
from eth.tools.fixtures.normalization import (
normalize_bytes,
normalize_call_creates,
normalize_environment,
normalize_execution,
normalize_int,
normalize_logs,
normalize_state,
)
from eth.tools._utils.... | StarcoderdataPython |
3325151 | <gh_stars>1-10
def QuickSort(list, left, right): #left : first index # right:last index
if left < right:
position = Partition(list, left, right)
QuickSort(list, left, position - 1)
QuickSort(list, position + 1, right)
return list
def Partition(list, left, right):
pivot = list[right]... | StarcoderdataPython |
1626193 | <reponame>tjlaboss/tasty_treat
"""core.py
Provides a container class for TREAT core lattice
"""
import common_files.treat.constants as c
from common_files.treat.corebuilder import TemplatedLattice
class Core(object):
################################################################################################... | StarcoderdataPython |
4839763 | import pathlib
import pytest # pylint: disable=unused-import
import numpy as np
from pyseir.models.seir_model import (
SEIRModel,
steady_state_ratios,
)
TEST_OUTPUT_DIR = pathlib.Path(__file__).parent.parent / "output" / "test_results"
def make_tlist(num_days):
return np.linspace(0, num_days, num_days... | StarcoderdataPython |
3298098 | """ Mock Recommender for tests purposes only.
"""
from barbante.recommendation.Recommender import Recommender
class RecommenderMock(Recommender):
""" Returns weird things.
"""
def __init__(self, session_context):
super().__init__(session_context)
def get_suffix(self):
""" See barbant... | StarcoderdataPython |
4805335 | <reponame>mikepfrank/dynamic
from typing import Callable,Iterable,Iterator,Set
import logmaster; from logmaster import *
logger = getLogger(logmaster.sysName + '.simulator')
# The dynamicVariable module is part of our core simulation component.
from partialEvalFunc import PartiallyEvaluatableFuncti... | StarcoderdataPython |
3227268 | <reponame>zealoussnow/chromium
# Copyright 2021 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.
import logging
import os
import subprocess
import sys
import impersonate
import proc_util
import uac
class UpdaterTestRPCHan... | StarcoderdataPython |
1645177 | <reponame>universuen/pokemon_GAN
batch_size = 64
epochs = 300
d_learning_rate = 2e-4
d_loop_num = 5
g_learning_rate = 2e-4
g_loop_num = 1
sample_num = 64
gp_lambda = 10
| StarcoderdataPython |
3210714 | ## This soft organizer names in alphabetical form
names = [' ',' ',' ',' ',' ',' ']
for i in range(6):
names[i] = input('inform names {} \n'.format(i+1))
names.sort()
##choice form
print('What form you wait see your list ? \n 1- Array \n 2- List \n')
chooce = int(input('inform your option \n'))
if chooce == 1:
... | StarcoderdataPython |
1701671 | from django.contrib.auth import get_user_model
from django_visipedia import client, persistor
from django_visipedia.models import VisipediaUser
from django_visipedia import VISIPEDIA_SCOPES
# compatibility for Django < 1.6
try:
from django.db.transaction import atomic
except ImportError:
from django.d... | StarcoderdataPython |
3297506 | import functools
from typing import Optional, Tuple
IMAGE_UNAVAILABLE_SVG = """
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="isolation:isolate" viewBox="0 0 200 200" width="200pt" height="200pt"><defs><clipPath id="_clipPath_eSdCSpw1sB1xWp7flmMoZ0WjTPwPpzQh"><rect width="20... | StarcoderdataPython |
3295196 | from .behavior import Behavior, BehaviorTemplate, BlackBoxBehavior
from .baseline import ConstantBehavior, DummyBehavior, RandomBehavior
from .hierarchical_behavior_template import HierarchicalBehaviorTemplate
from .linear import LinearBehavior
__all__ = [
"Behavior", "BehaviorTemplate", "BlackBoxBehavior", "Cons... | StarcoderdataPython |
4837067 | from flask import Flask, json, jsonify, request, make_response, Blueprint
import datetime
from ..models import user_models
from ..utils.validators import Verify
from ..utils.auth import token_required
auth = Blueprint('auth', __name__, url_prefix='/api/v1/auth')
user_object = user_models.Accounts()
@auth.route('/... | StarcoderdataPython |
1722035 | from django.shortcuts import render
# Create your views here.
#coding=utf-8
from list_movie.models import Detial
from django.shortcuts import render_to_response
from django.http import HttpResponse
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
# Create your views here.
def index_listmovie(... | StarcoderdataPython |
3333163 | N,M = map(int,input().split())
for i in range(1, N, 2):
print (( str('.|.')*i ).center(M, '-'))
print (str('WELCOME').center(M, '-'))
for i in range(N-2, -1, -2):
print (( str('.|.')*i ).center(M, '-')) | StarcoderdataPython |
1614192 | <filename>dnsmanager/api/polymorphic_serializer.py
from collections.abc import Mapping
from django.db import models
from rest_framework import serializers
"""
This is an adaptation of https://github.com/apirobot/django-rest-polymorphic/
by <NAME>, MIT licenced.
It integrates django-polymorphic with restframework.
""... | StarcoderdataPython |
187434 | import os
from ..praat import PraatAnalysisFunction
from pyraat.parse_outputs import parse_track_script_output
def track_pulse_parse_output(text):
track_text = []
pulse_text = []
blank_count = 0
add_track = True
for line in text.splitlines():
line = line.strip()
if line:
... | StarcoderdataPython |
1654133 | # -*- coding: utf-8 -*-
__all__ = ['dongting_download']
from ..common import *
_unit_prefixes = 'bkmg'
def parse_size(size):
m = re.match(r'([\d.]+)(.(?:i?B)?)', size, re.I)
if m:
return int(float(m.group(1)) * 1024 **
_unit_prefixes.index(m.group(2).lower()))
else:
re... | StarcoderdataPython |
3367575 | <filename>statsmodels/tools/validation/tests/test_validation.py
from collections import OrderedDict
import numpy as np
import pandas as pd
import pytest
from statsmodels.tools.validation import (array_like, PandasWrapper, bool_like,
dict_like, float_like, int_like,
... | StarcoderdataPython |
170898 | from django.db import models
# Create your models here.
class Skill(models.Model):
skillName= models.CharField(verbose_name='Skill', max_length=100)
SKILL_CHOICES = [
('B', 'Beginner'),
('I', 'Intermediate'),
('E', 'Expert'),
]
level= models.CharField(verbose_name='Profici... | StarcoderdataPython |
70966 | <filename>test/vptree_test.py
# =============================================================================
# Phylactery VPTree Unit Tests
# =============================================================================
from Levenshtein import distance as levenshtein
from phylactery import VPTree
WORDS = [
'book'... | StarcoderdataPython |
1688408 | <reponame>neptune-ml/model-fairness-in-practice
from collections import OrderedDict
from IPython.display import HTML, Image
from functools import partial
from aif360.datasets import BinaryLabelDataset
import neptune
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import job... | StarcoderdataPython |
3362315 | <filename>First_unique_number.py
"""
You have a queue of integers, you need to retrieve the first unique integer in the queue.
Implement the FirstUnique class:
FirstUnique(int[] nums) Initializes the object with the numbers in the queue.
int showFirstUnique() returns the value of the first unique integer of the queue... | StarcoderdataPython |
72056 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import gradcheck
import random
import numpy as np
import math
import scipy.io as sio
import matplotlib.pyplot as plt
from sphere_cuda import SPHERE_CUDA
random.seed(1)
np.random.seed(1)
torch.manual_seed(1)
if torch.cuda.is_availa... | StarcoderdataPython |
96908 | <gh_stars>0
import datetime
import math
pi = 22 / 7
def add():
num1 = float(input("Enter the number"))
num2 = float(input("Enter the second number"))
return num1 + num2
def subtract():
num1 = float(input("Enter the number"))
num2 = float(input("Enter the second number"))
return... | StarcoderdataPython |
1671606 | # Some Basic Examples
match = re.search(r'\d' , "it takes 2 to tango")
print match.group() # print 2
match = re.search(r'\s\w*\s', 'once upon a time')
match.group() # ' upon '
match = re.search(r'\s\w{1,3}\s', 'once upon a time')
match.group() # ' a '
match = re.search(r'\s\w*$', 'once upon a time')
match.group() # ... | StarcoderdataPython |
3273292 | <gh_stars>1-10
import pygame
class Item:
def __init__(self, startPos, itemType):
self.itemType = itemType
self.image = pygame.image.load("Images/Items/"+self.itemType+".png")
self.rect = self.image.get_rect()
self.rect.x = startPos[0]
self.rect.y = startPos[1]
self.p... | StarcoderdataPython |
3322693 | from django.conf import settings
from django.db import models
#from datetime import datetime
from django.utils import timezone
import pytz
class Webinar(models.Model):
name = models.CharField(max_length=255)
description = models.TextField()
registration_open = models.DateTimeField()
registration_closed... | StarcoderdataPython |
3342350 | <reponame>bartoszm/Snowmass-ONFOpenTransport
# coding: utf-8
from __future__ import absolute_import
from datetime import date, datetime # noqa: F401
from typing import List, Dict # noqa: F401
from tapi_server.models.base_model_ import Model
from tapi_server.models.admin_state_pac import AdminStatePac # noqa: F401... | StarcoderdataPython |
3327966 | <gh_stars>0
from http import HTTPStatus
from .test_utils import PostTestCase, User, clear_cache
class PostURLTests(PostTestCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.user_not_author = User.objects.create_user(username='not_author')
@clear_cache
def test_urls_ex... | StarcoderdataPython |
131264 | <filename>python/graphscope/analytical/app/pagerank_nx.py<gh_stars>1000+
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2020 Alibaba Group Holding Limited. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Lic... | StarcoderdataPython |
1673695 | <reponame>neer201/Multi-Object-Tracking-for-Automotive-Systems-in-python
# noxfile.py
import nox
locations = "src", "tests", "noxfile.py"
nox.options.sessions = "lint", "black", "tests"
@nox.session
def lint(session):
args = session.posargs or locations
session.install("flake8")
session.run("flake8", *... | StarcoderdataPython |
41593 | from usefull import read_db
def test_read_csv_db_simple():
'''
page msg parent choice end
1 1. Mi sembra che 0 False False
2 ...se ti trovassi 1 True False
'''
assert read_db('db_simple.csv')[0]['page'] == 1
assert read_db('db_simple.csv')[0]['msg'][-3:] == ... | StarcoderdataPython |
1691589 | # -*- coding: utf-8 -*-
"""
SlideSpeechConverter.py
a component of SlideSpeech.py
Extract speaker notes from .odp or .ppt file
Prepare script.txt for SlideSpeech
Prepare convert.bat to generate audio via text-to-speech
Output HTML wrappers for slide images and audio
Prepare makeVid.bat to generate video
Copyright (c)... | StarcoderdataPython |
161097 | <reponame>FlynnMa/quantBob
"""
如何获取数据
"""
import os
import matplotlib.pyplot as plt
import pandas_datareader as pdr
df = pdr.get_data_tiingo('601398', start='2021-01-01',
end='2021-08-05', api_key=os.getenv('TIINGO_API_KEY'))
fig = plt.figure(figsize=(20, 12))
fig.suptitle("price plotting")... | StarcoderdataPython |
3231555 | <filename>Chapter_4/BankOOP4_InteractiveMenu/Main_Bank_Version4.py<gh_stars>10-100
# Interactive test program creating a dictionary of accounts
# Version 4, with an interactive menu
from Account import *
accountsDict = {}
nextAccountNumber = 0
# Build some starting accounts for testing
oAccount = Account('Joe', 100,... | StarcoderdataPython |
46921 | """Aggregate hosts data set."""
from censys.search import SearchClient
c = SearchClient()
# The aggregate method constructs a report using a query, an aggregation field, and the
# number of buckets to bin.
report = c.v2.hosts.aggregate(
"service.service_name: HTTP",
"services.port",
num_buckets=5,
)
print... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.