id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
12854015
<filename>python/191122.py from os import getcwd def rdfile(): data = list() # 顯示這個程式碼檔案是在哪裡被執行 print(getcwd()) with open("pm25.txt", 'r') as fd: for line in fd: try: data.append(float(line.replace('\n', ''))) except: pass print('Max ...
StarcoderdataPython
8128744
<gh_stars>1-10 from django.urls import path from .views import ( LoginAPIView, RegistrationAPIView, UserRetrieveUpdateAPIView, TwitterAuthAPIView, GoogleAuthAPIView, FacebookAuthAPIView, AccountActivateAPIView, PasswordResetRequestAPIView, PasswordResetAPIView ) app_name = "authentication" urlpatterns...
StarcoderdataPython
5183110
execfile("core.py") from algorithms.ucb.ucb2 import * import random random.seed(1) means = [0.1, 0.1, 0.1, 0.1, 0.9] n_arms = len(means) random.shuffle(means) arms = map(lambda (mu): BernoulliArm(mu), means) print("Best arm is " + str(ind_max(means))) for alpha in [0.1, 0.3, 0.5, 0.7, 0.9]: algo = UCB2(alpha, [],...
StarcoderdataPython
4934077
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
StarcoderdataPython
6478633
#!/usr/bin/env python __author__ = '<NAME>' import os from collections import OrderedDict from scipy import stats from RouToolPa.Collections.General import TwoLvlDict def read_data(filename): data_dict = OrderedDict() with open(filename, "r") as in_fd: for line in in_fd: tmp = line.strip...
StarcoderdataPython
1834289
<reponame>willwhitney/exploration-reimplementation import time import os import math import pickle import queue from typing import Any import numpy as np import matplotlib.pyplot as plt import jax from jax import numpy as jnp, random from flax import nn, struct from dm_control import suite import replay_buffer impo...
StarcoderdataPython
9735128
<filename>apiserver/report/__init__.py #!/usr/bin/env python # -*- coding:utf-8 -*- # author:owefsad # datetime:2020/10/23 11:54 # software: PyCharm # project: webapi from apiserver.report.handler.error_log_handler import ErrorLogHandler from apiserver.report.handler.heartbeat_handler import HeartBeatHandler from apise...
StarcoderdataPython
3426907
# -*- coding: utf-8 -*- import unittest from iktomi.utils import ( quoteattr, quoteattrs, quote_js, weakproxy, cached_property, cached_class_property, ) class Tests(unittest.TestCase): def test_quoteattr(self): for src, dst in [('', '""'), ('abc', '"abc"'), ...
StarcoderdataPython
5077674
# Functions are used to create small reusable parts of code. # They are defined using the def keyword # This is the function head def fun(): # This is called the function body. # The function body is associated with the function fun because of the indentation print("Hello") # Functions are called with pa...
StarcoderdataPython
9655303
from setuptools import setup setup(name="blundercheck", author='<NAME>', author_email="<EMAIL>", version="0.0.1", license="None", keywords="chess", url='http://www.github.com/dsjoerg/blundercheck/', py_modules=["blundercheck"], description="Scores chess games", long_description=''' ''', classif...
StarcoderdataPython
3373820
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Sep 2 14:37:04 2019 @author: B.Mika-Gospodorz Input files: stdin with bam file with multi-mapped reads, reference_host_names.txt and reference_pathogen_names.txt files that contain references extracted with extract_reference_names_from_fasta_files.sh ...
StarcoderdataPython
276268
<gh_stars>0 #!/usr/bin/env python3 # imports go here # # Free Coding session for 2015-03-02 # Written by <NAME> # class SimpleClass: def main(self): return "HI" def main2(self): return "HELLO AGAIN" if __name__ == '__main__': sc = SimpleClass() assert(sc.main.__name__ == 'main') ...
StarcoderdataPython
9600040
print("Hello World!") Name = "SaMeeM" # Printing Name to the screen print(Name) age = 22 # Printing Age to screen print(age) print("My Name is " + Name + " and I am " + str(age) + " years old.") random_number = 45.6 result = random_number / 9 float_division_result = random_number // 9 print(result) print(float_...
StarcoderdataPython
5059684
# 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, software # distributed under t...
StarcoderdataPython
5061695
<reponame>AnnaKPolyakova/bbbs<gh_stars>1-10 from rest_framework.views import exception_handler def custom_exception_handler(exc, context): handlers = { "ValidationError": _handle_validation_error, "Http404": _handle_not_found_error, } response = exception_handler(exc, context) if resp...
StarcoderdataPython
95365
#!/usr/bin/env python import sys import imp import re def main(argv): cloud_provider = sys.argv[1] reqd_module_names_and_versions = {} reqd_module_names_and_versions['requests'] = '2.2.1' reqd_module_names_and_versions['json'] = '2.0.9' reqd_module_names_and_versions['docopt'] = '0.6.2' if ...
StarcoderdataPython
4883191
from ionotomo import * from ionotomo.utils.gaussian_process import * from rathings.phase_unwrap import * import pylab as plt import numpy as np import logging as log import os import h5py import sys import astropy.time as at import astropy.coordinates as ac import astropy.units as au if sys.hexversion >= 0x3000000: ...
StarcoderdataPython
3502464
<gh_stars>1-10 # Generated by Django 2.1.1 on 2018-11-04 09:28 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('main', '0004_auto_20181104_0923'), ] operations = [ migrations.AlterField( model_name='platform_models', ...
StarcoderdataPython
279717
<reponame>yaroslavNikolaev/A.R.M.O.R. __all__ = ['kubernetes']
StarcoderdataPython
3246612
<reponame>RevansChen/online-judge # Python - 2.7.6 test.assert_equals(find_slope([19, 3, 20, 3]), '0') test.assert_equals(find_slope([-7, 2, -7, 4]), 'undefined') test.assert_equals(find_slope([10, 50, 30, 150]), '5') test.assert_equals(find_slope([10, 20, 20, 80]), '6') test.assert_equals(find_slope([-10, 6, -10, 3])...
StarcoderdataPython
4957802
<reponame>Abhizx/snake-charming<filename>tests/test_factory.py from flaskr import create_app import json def test_config(): assert not create_app().testing assert create_app({'TESTING': True}).testing def test_view_single_get(client): response = client.get('/view?username=humble') assert json.loads(re...
StarcoderdataPython
3577291
<reponame>hououin/pdm<gh_stars>0 import numpy as np import cv2 import czifile import pickle import matplotlib.pyplot as plt import scipy.misc import math import random DDEPTH = 1 NUM_LANDMARKS = 50 def cropImage(im_cell): sum_i = 0 sum_j = 0 stevec = 0 for i in range(im_cell.shape[0]): for ...
StarcoderdataPython
5113102
<reponame>OSavchik/python_training import pymysql.connections from model.group import Group from model.contact import Contact class DbFixture: def __init__(self, host, name, user, password): self.host = host self.name = name self.user = user self.password = password self.co...
StarcoderdataPython
9764616
from PyQt4.QtCore import QMetaObject, QRect, Qt from PyQt4.QtGui import QApplication, QHBoxLayout, QMainWindow, QMenuBar, \ QStatusBar, QVBoxLayout, QWidget, QIcon from filetree import EzSphinxTreeView from splitter import EzSphinxSplitter from restedit import EzSphinxRestEdit from util import ...
StarcoderdataPython
11206007
<reponame>vivek28111992/AlgoDaily<gh_stars>0 """ This is a classic and very common interview problem. Given an array of integers, return the indices of the two numbers in it that add up to a specific goal number. So let's say our goal number was 10. Our numbers to sum to it would be 3 and 7, and their indices 1 and 3 ...
StarcoderdataPython
9730151
<filename>app/main/views.py from flask import g, jsonify, Markup, render_template, redirect, url_for, current_app, abort, flash, request, \ make_response from flask_login import login_required, current_user from datetime import datetime from mongoengine.queryset.visitor import Q from . import main from .forms impo...
StarcoderdataPython
3257816
<reponame>yifan-you-37/rl_swiss import joblib import numpy as np from numpy.random import choice, randint from rlkit.data_management.env_replay_buffer import get_dim as gym_get_dim from rlkit.data_management.simple_replay_buffer import SimpleReplayBuffer from rlkit.envs.maze_envs.trivial_grid import TrivialGrid from ...
StarcoderdataPython
5075898
<gh_stars>0 from main import no_space def test_no_space(benchmark): assert benchmark(no_space, '8 j 8 mBliB8g imjB8B8 jl B') == '8j8mBliB8gimjB8B8jlB' assert benchmark(no_space, '8 8 Bi fk8h B 8 BB8B B B B888 c hl8 BhB fd') == '88Bifk8hB8BB8BBBB888chl8BhBfd' assert benchmark(no_space, '8aaaaa dddd r...
StarcoderdataPython
3374006
#!/usr/bin/env python """ <Program> test_download.py <Author> <NAME>. <Started> March 26, 2012. <Copyright> See LICENSE for licensing information. <Purpose> Unit test for 'download.py'. NOTE: Make sure test_download.py is ran in 'tuf/tests/' directory. Otherwise, module that launches simple server w...
StarcoderdataPython
6691841
# -*- coding: utf-8 -*- """Top-level package for Azure IoT Edge Dev Tool.""" __author__ = 'Microsoft Corporation' __email__ = '<EMAIL>' __version__ = '2.1.2' __AIkey__ = '95b20d64-f54f-4de3-8ad5-165a75a6c6fe'
StarcoderdataPython
9641027
<filename>replay_parser.py import os import binascii import zlib import struct import datetime import functools import argparse import json FRAME_TO_MILLIS = 42 def is_zlib_compressed(data): unsigned_byte = data[1] & 0xFF return data[0] == 0x78 and (unsigned_byte in [0x9c, 0x01, 0x5e, 0xda]) def read_int(*,...
StarcoderdataPython
197589
# -*- coding: utf-8 -*- # Generated by Django 1.11.27 on 2020-01-27 17:01 from __future__ import unicode_literals import django.contrib.postgres.fields import django.contrib.postgres.fields.jsonb from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dep...
StarcoderdataPython
5136347
@login_required def profile(request, id): entity = directory.models.Entity.objects.get(pk = id) emails = directory.models.EntityEmail.objects.filter(entity__exact = id).all() all_entities = directory.models.Entity.objects.all() all_locations = directory.models.Location.objects.all() return Htt...
StarcoderdataPython
4849692
<gh_stars>1-10 """[summary] Returns: [type]: [description] """ import os import pickle import random from math import log from collections import defaultdict from src.countminsketch import CountMinSketch from src.feature_generator import FeatureGenerator from src.utils import add_lap from src.sketch_heap import Sk...
StarcoderdataPython
3578281
<filename>pydocx/openxml/drawing/blip.py # coding: utf-8 from __future__ import ( absolute_import, print_function, unicode_literals, ) from pydocx.models import XmlModel, XmlAttribute class Blip(XmlModel): XML_TAG = 'blip' embedded_picture_id = XmlAttribute(name='embed') linked_picture_id = ...
StarcoderdataPython
320869
# -*- coding: utf-8 -*- # Always prefer setuptools over distutils from setuptools import setup, find_packages # To use a consistent encoding from codecs import open from os import path from korean_lunar_calendar import __version__ here = path.abspath(path.dirname(__file__)) with open(path.join(here, 'README.rst'), ...
StarcoderdataPython
8069646
from flask import Flask, request, make_response, Response import os import logging import json from slackclient import SlackClient from botflow.engine_slack import SlackSocketEngine from examples.math_controller import MathController SLACK_BOT_TOKEN = os.environ.get('SLACK_BOT_TOKEN') slack_bot = SlackSocketEngine(M...
StarcoderdataPython
8091846
import numpy as np class Base_Automaton(object): def __init__(self, count, reward=0.10, punish=0.001): self.count = count self.__reward = reward self.__punish = punish self.cells = np.ones(self.count) / self.count def cell(self): return np.random.choice(self.coun...
StarcoderdataPython
4983444
<reponame>nizaevka/mlshell """Configuration example. Create pipeline (sgd) and optimize hp_grid: * target transformer on/off. * polynomial degree 1/2. """ import lightgbm import mlshell import pycnfg import sklearn target_transformer = sklearn.preprocessing.PowerTransformer( method='yeo-johnso...
StarcoderdataPython
1671939
"""Test the respond handler.""" import pytest from cactusbot.api import CactusAPI from cactusbot.handlers import ResponseHandler from cactusbot.packets import Packet, MessagePacket response_handler = ResponseHandler() @pytest.mark.asyncio async def test_user_update(): """Test the user update event.""" awa...
StarcoderdataPython
8098956
<reponame>htlcnn/ironpython-stubs class dotDeformingData_t(object): # no doc Angle=None Angle2=None Cambering=None Shortening=None
StarcoderdataPython
9694631
import hashlib import json import os.path import platform import shlex import shutil import stat import subprocess import sys import urllib.request from dataclasses import dataclass from logging import getLogger from typing import Dict, List, Optional, Set, Tuple from urllib.request import urlopen import filelock from...
StarcoderdataPython
4824486
# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. # Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation. # # 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 Licen...
StarcoderdataPython
3355058
import src.htc_calculator App = FreeCAD import ObjectsFem from femmesh.gmshtools import GmshTools def test_mesh_creation(): # more sophisticated example which changes the mesh size doc = App.newDocument("MeshTest") box_obj = doc.addObject("Part::Box", "Box") doc.recompute() max_mesh_s...
StarcoderdataPython
1620049
# # This source file is part of the EdgeDB open source project. # # Copyright 2016-present MagicStack Inc. and the EdgeDB 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...
StarcoderdataPython
5050807
<filename>QFTSampler/transformers/Affine.py<gh_stars>1-10 import numpy as np from .BaseTransformer import BaseTransformer from .Standardizer import Standardization from .Momentum import Momentum class AffineX(BaseTransformer): def __init__(self, N, M): self.N = N self.M = M self.w = np.zero...
StarcoderdataPython
6640500
''' --- Day 13: Shuttle Search --- Your ferry can make it safely to a nearby port, but it won't get much further. When you call to book another ship, you discover that no ships embark from that port to your vacation island. You'll need to get from the port to the nearest airport. Fortunately, a shuttle bus service is ...
StarcoderdataPython
5037662
import ctypes import faulthandler faulthandler.enable() # Get memory address 0, your kernel shouldn't allow this: ctypes.string_at(0)
StarcoderdataPython
11337373
from cassandra.cluster import Cluster import numpy as np import matplotlib.pyplot as plt from pprint import pprint from colorclass import Color, Windows from terminaltables import SingleTable import random def sigmoid(x): return 1.0 / (1.0 + np.exp(-x)) def sigmoid_derivative(x): return sigmoid(x) * (1.0 - si...
StarcoderdataPython
11374582
<reponame>sbkirby/imagehub-librarian #!/usr/bin/env python3 """ mqtt_client.py - detect objects in images and preform ALPR on car images via Plate Recognizer account at https://platerecognizer.com/ Edit JSON config.json file in work_dir defined below Date: October 1, 2020 By: <NAME> """ import sys import os import t...
StarcoderdataPython
4990286
from speech_style import * from kb import * from task3 import get_restaurants, rank_restaurants def modify_options(dialogs, kb, accept_prob=0.25, save='all'): new_dialogs = [] for dialog in dialogs: restaurants = get_restaurants(dialog) specialities = set([kb[restaurant]['R_speciality'] for re...
StarcoderdataPython
8136655
<reponame>komiya-atsushi/node-marisa-trie { 'targets': [ { 'target_name': 'libmarisa', 'product_prefix': 'lib', 'type': 'static_library', 'sources': [ 'libmarisa/marisa/agent.cc', 'libmarisa/marisa/grimoire/vector/bit-vector.cc', 'libmarisa/marisa/keyset.cc', ...
StarcoderdataPython
5054838
<filename>scripts/Augmentpp.py import pandas as pd import requests as rq import os from time import sleep import math baseURL = "https://maps.googleapis.com/maps/api/streetview?" size = "size=640x480&" location = "location=" keyfrag = "&key=" imgDir = "/datasets/sagarj/streetView/Translational_city_test/" logFile = ...
StarcoderdataPython
1816923
labels_cityscapes = [ # name id trainId category catId hasInstances ignoreInEval color ( 'unlabeled' , 0 , 255 , 'void' , 0 , False , True , ( 0, 0, 0) ), ( 'ego vehicle' , 1 , 255 , 'void'...
StarcoderdataPython
8045591
from ..conversion_context import * from torch2trt.module_test import add_module_test # ASSUME EXPLICIT BATCH MODE to make things easier for now def insert_dim(ctx, trt_tensor, new_dims: list): ndims = len(trt_tensor.shape) # if new_shape.count(-1) > 1: layer = ctx.network.add_shuffle(trt_tensor) laye...
StarcoderdataPython
11387687
user_data_script = '''#!/bin/bash echo "You can put your userdata script right here!" ''' cft = CloudFormationTemplate(description="A slightly more useful template.") properties = { 'ImageId': 'ami-c30360aa', 'InstanceType': 'm1.small', 'UserData': base64(user_data_script), } attributes = [ Metadata( ...
StarcoderdataPython
209835
from flask import current_app, _app_ctx_stack import flask_login from flaskloginintegration import _user_loader, User from views import login_views class ZKPP(object): def __init__(self, app=None, login_manager=flask_login.LoginManager()): self.app = app self.login_manager = login_manager ...
StarcoderdataPython
9654737
<gh_stars>10-100 import asyncio import discord from models import DB class PetRescueConfig: DEFAULT_CONFIG = { 'mention': '@everyone', 'delete_mention': True, 'delete_message': True, 'delete_pet': True, } def __init__(self): self.__data = {} async def load(se...
StarcoderdataPython
12807200
<gh_stars>0 import cPickle import numpy as np import Image f = file('../data/smile_detection/train/image_names', 'r') trainImage = [] trainResult=[] for line in f: line=line.strip() line = "../data/smile_detection/train/" + line trainImage.append(line) if "b" not in line: trainResult.append(0)...
StarcoderdataPython
3351814
<gh_stars>0 from operator import attrgetter from django.test.testcases import TestCase from .models import Address, Contact, Customer class TestLookupQuery(TestCase): @classmethod def setUpTestData(cls): cls.address = Address.objects.create(company=1, customer_id=20) cls.custome...
StarcoderdataPython
1751559
""" Class of logistic regression model """ from Logistic_Regression.cost_function import * from Logistic_Regression.hypothesis_function import * from Logistic_Regression.gradient_descent import * class Logistic_regression(): """ Purpose: Object initialization method Parameter: feature, output, # of tra...
StarcoderdataPython
355034
#!/usr/bin/env python3 print(sum([i for i in range(1,1000) if i%3==0 or i%5==0]))
StarcoderdataPython
3398036
def getUserInput(): filename = input("Please enter Filepath: ") objectname = input("Please enter objects name to replace: ") replacename = input("Please enter objects name to replace with: ") replace(filename, objectname, replacename) def replace(filename, objectname, replacename): replacement = ""...
StarcoderdataPython
3596437
#lims from SBaaS_LIMS.lims_experiment_postgresql_models import * from SBaaS_LIMS.lims_sample_postgresql_models import * from .stage01_physiology_data_postgresql_models import * from SBaaS_base.sbaas_base_query_update import sbaas_base_query_update from SBaaS_base.sbaas_base_query_drop import sbaas_base_query_drop fro...
StarcoderdataPython
11390482
<filename>backend/schemas/warn.py def Warn(warn_id, warns): return { "id": warn_id, "warns": warns }
StarcoderdataPython
6543081
<gh_stars>10-100 from autopalette import af print(af("Hello again!").h1)
StarcoderdataPython
8024351
# Copyright 2019 Dragonchain, Inc. # 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: # 6. Tr...
StarcoderdataPython
8074778
import pyaudio chunk = 1024 FORMAT = pyaudio.paInt16 CHANNELS = 1 RATE = 41000 RECORD_SECONDS = 5 p = pyaudio.PyAudio() stream = p.open(format = FORMAT, channels = CHANNELS, rate = RATE, input = True, output = True, frames_per_buffer = chunk) print ("***Recording***") a = [] for i in range...
StarcoderdataPython
1951429
<gh_stars>10-100 from aorist import aorist, TrainFasttextModel import json programs = {} @aorist( programs, TrainFasttextModel, entrypoint="training_fasttext_model", args={ "tmp_dir": lambda fasttext_embedding: fasttext_embedding.setup.local_storage_setup.tmp_dir, "dim": lambda fasttex...
StarcoderdataPython
5164477
import os from konduit import * from konduit.client import Client from konduit.server import Server from konduit.utils import default_python_path from utils import to_base_64 # Set the working directory to this folder and register # the "detect_image_str.py" script as code to be executed by konduit. work_dir = os.path...
StarcoderdataPython
141337
import matplotlib.pyplot as plt import numpy as np from scipy.optimize import curve_fit from astropy.io import ascii from uncertainties import ufloat import uncertainties.unumpy as unp g = ufloat(9.811899, 0.000041) x, d0, d = np.genfromtxt("Messdaten/c.txt", unpack=True) D = d - d0 x1 = x[0:26] x2 = x[28:52] D1 = D[0...
StarcoderdataPython
9705009
<gh_stars>0 import numpy as np from layers.base import Layer class Output(Layer): def __init__(self, input_layers, output_shape, loss_function=None, learning_rate=0.1): super().__init__(input_layers, output_shape) self.loss_function = loss_function self.cur_y_true = None self.learn...
StarcoderdataPython
1917452
''' main.py Created by <NAME> on 2020 Copyright © 2020 <NAME>. All rights reserved. ''' import sys a, b, c = map(int, sys.stdin.readline().rstrip().split(' ')) print((a + b) % c) print(((a % c) + (b % c)) % c) print((a * b) % c) print(((a % c) * (b % c)) % c)
StarcoderdataPython
1872341
from sane_doc_reports import utils from sane_doc_reports.domain.CellObject import CellObject from sane_doc_reports.domain.Element import Element from sane_doc_reports.conf import DEBUG, PYDOCX_FONT_SIZE, \ DEFAULT_TABLE_FONT_SIZE, DEFAULT_TABLE_STYLE, PYDOCX_FONT_NAME, \ PYDOCX_FONT_COLOR, DEFAULT_FONT_COLOR, D...
StarcoderdataPython
1874228
<gh_stars>1-10 class Cookie: def __init__(self, time, value, ttl): self.start = time self.ttl = ttl self.value = value class Memcache: def __init__(self): self.graph = dict() self.na = 2147483647 """ @param: curtTime: An integer @param: k...
StarcoderdataPython
345105
# -*- coding: utf-8 -*- """ tfrecord torch dataset实现 """ from . import dataset from .dataset import TFRecordDataset from .dataset import MultiTFRecordDataset
StarcoderdataPython
111605
from datetime import date m =0 me =0 for c in range(1,8): i = int(input('que ano a {}ª pessoa nasceu ? >>>'.format(c))) ano = int(date.today().year) idade = ano - i if idade > 18: m += 1 else: me += 1 print('{} pessoas são maiores de idade'.format(m)) print('{} pessoas são menores de...
StarcoderdataPython
5067885
"""Utils module of kytos/pathfinder Kytos Network Application.""" # pylint: disable=unused-argument def lazy_filter(filter_type, filter_func): """ Lazy typed filter on top of the built-in function. It's meant to be used when the values to be filtered for are only defined later on dynamically at runti...
StarcoderdataPython
8096493
import gym from stable_baselines.common.policies import MlpPolicy from stable_baselines.common.vec_env import DummyVecEnv from stable_baselines import PPO2 def test_cartpole(): env = gym.make('CartPole-v0') env = DummyVecEnv([lambda: env]) model = PPO2(MlpPolicy, env) model.learn(total_timesteps=100...
StarcoderdataPython
8199999
<reponame>briancline/softlayer-python """Get details for a hardware device.""" # :license: MIT, see LICENSE for more details. import SoftLayer from SoftLayer.CLI import environment from SoftLayer.CLI import formatting from SoftLayer.CLI import helpers from SoftLayer import utils import click @click.command() @click...
StarcoderdataPython
5195803
<filename>contigtax/shred_fasta.py #!/usr/bin/env python import random from Bio import SeqIO from argparse import ArgumentParser import sys def read_seqs(f): return SeqIO.to_dict(SeqIO.parse(f, "fasta")) def shred(d, prefix=None, existing=False, contigs=10000, minsize=500, maxsize=10000): """ ...
StarcoderdataPython
1706759
<reponame>zavanton123/coderators<gh_stars>0 # Generated by Django 3.1.3 on 2021-01-23 13:26 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ migrations.swappable_dependen...
StarcoderdataPython
1735343
<filename>module/shaders/src/compile_shaders.py #!/usr/bin/python # # This source file is part of appleseed. # Visit http://appleseedhq.net/ for additional information and resources. # # This software is released under the MIT license. # # Copyright (c) 2015 <NAME>, The appleseedhq Organization # # Permission is hereb...
StarcoderdataPython
3252598
<filename>d3d/vis/pcl.py import numpy as np from d3d.abstraction import ObjectTarget3DArray _pcl_available = False try: import pcl import pcl.visualization as pv _pcl_available = True except: pass def visualize_detections(visualizer: pcl.Visualizer, visualizer_frame: str, targets: ObjectTarget3DArray...
StarcoderdataPython
3522591
from conans.client.generators.cmake import DepsCppCmake from conans.model import Generator class CMakePathsGenerator(Generator): @property def filename(self): return "conan_paths.cmake" @property def content(self): deps = DepsCppCmake(self.deps_build_info) # We want to priori...
StarcoderdataPython
4956996
<filename>RFEM/Imperfections/imperfectionCase.py from RFEM.initModel import Model, clearAtributes class ImperfectionCase(): def __init__(self, no: int = 1, assigned_to_load_cases: str = '1', comment: str = '', params: dict = {}): ''' ...
StarcoderdataPython
69112
<filename>Boid.py from Quadtree import * class Boid: def __init__(self, x, y): self.pos = PVector(x, y) self.vel = PVector.random2D().mult(random(1, 2)) self.acc = PVector.random2D().mult(random(0.1, 0.3)) self.r = 10 self.max_speed = 4 self.max_force = .2 ...
StarcoderdataPython
6636978
# This is a sample settings file
StarcoderdataPython
3535770
<reponame>zaanposni/umfrageBot import os import json from datetime import datetime, timedelta import discord from discord.utils import get from bt_utils.console import Console from bt_utils.config import cfg from bt_utils.embed_templates import InfoEmbed SHL = Console("ActiveUserAssigment") content_dir = "content" i...
StarcoderdataPython
6647550
# Generated by Django 2.2.6 on 2020-02-13 10:12 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('comments', '0016_british_spelling'), ] operations = [ migrations.AlterField( model_name='catego...
StarcoderdataPython
4932214
<gh_stars>0 #coding=utf-8 import pyaudio import wave import time from pygame import mixer # Load the required library class player(): def __init__(self): pass def play(self,path = 'ans.mp3'): mixer.init() mixer.music.load(path) mixer.music.play() time.sleep(10) mixer.music.stop() # #de...
StarcoderdataPython
8043273
<filename>partners/migrations/0004_auto_20210122_1315.py # Generated by Django 3.1.5 on 2021-01-22 13:15 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('partners', '0003_auto_20210122_1315'), ] operations = [ migrations.AlterField( ...
StarcoderdataPython
9779263
<reponame>dapu/femagtools # -*- coding: utf-8 -*- """ femagtools.plot ~~~~~~~~~~~~~~~ Creating plots """ import numpy as np import scipy.interpolate as ip import logging try: import matplotlib import matplotlib.pyplot as plt import matplotlib.cm as cm from mpl_toolkits.mplot3d import Ax...
StarcoderdataPython
6591186
<gh_stars>0 import boto3, json, os, re QUEUE_NAME = os.environ["QUEUE_NAME"] BUCKET_NAME = os.environ["BUCKET_NAME"] def lambda_handler(event, context): # Load Sites List from S3 Bucket s3 = boto3.client('s3') data = s3.get_object(Bucket=BUCKET_NAME, Key="sites-list.json") sites_list = json.loads(data...
StarcoderdataPython
4950060
<reponame>baumartig/paperboy from settings_handler import settings import os import smtplib import mimetypes from email.MIMEMultipart import MIMEMultipart from email.MIMEBase import MIMEBase from email.MIMEText import MIMEText from email.MIMEAudio import MIMEAudio from email.MIMEImage import MIMEImage from email.Encode...
StarcoderdataPython
6551687
# Copyright 2018 The Texar Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable ...
StarcoderdataPython
25115
from django.contrib import admin from .models import Comment # Register your models here. class CommentsAdmin(admin.ModelAdmin): list_display = ['id', "user", "content", "timestamp"] class Meta: model = Comment admin.site.register(Comment, CommentsAdmin)
StarcoderdataPython
6619112
<gh_stars>0 from django.contrib.admin.apps import AdminConfig class AdminConfig2fa(AdminConfig): default = False default_site = 'modal_2fa.admin.AdminSite2FA'
StarcoderdataPython
6543713
import pytest from controlled_vocabulary.utils import search_term_or_none from radical_translations.core.documents import ResourceDocument from radical_translations.core.models import ( Classification, Contribution, Resource, ResourceLanguage, ) from radical_translations.utils.models import Date pytes...
StarcoderdataPython
9724427
from __future__ import unicode_literals from django_shares.constants import Status from django_shares.models import Share from django_testing.testcases.users import SingleUserTestCase from django_testing.user_utils import create_user from test_models.models import TestSharedObjectModel from test_models.models import ...
StarcoderdataPython