id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
187874
<gh_stars>0 from ..util import output, mainserver from ..permissions import isbanned, ban, unban, bantypes, bans from ..commands import command, command_help from ..config import get_config from ..client import client @command_help("ban", "Bans somebody for a specified ban type.", "ban [@mention to member] [ban type]...
StarcoderdataPython
4955946
import warnings import numpy as np from asreviewcontrib.visualization.plot_base import PlotBase class PlotInclusions(PlotBase): def __init__(self, analyses, result_format="percentage", thick=None): """Class for the Inclusions plot. Plot the number of queries that turned out to be included ...
StarcoderdataPython
9745625
<gh_stars>0 # 계단 오르는 데는 다음과 같은 규칙이 있다. # 계단은 한 번에 한 계단씩 또는 두 계단씩 오를 수 있다. 즉, 한 계단을 밟으면서 이어서 다음 계단이나, 다음 다음 계단으로 오를 수 있다. # 연속된 세 개의 계단을 모두 밟아서는 안 된다. 단, 시작점은 계단에 포함되지 않는다. # 마지막 도착 계단은 반드시 밟아야 한다. # 따라서 첫 번째 계단을 밟고 이어 두 번째 계단이나, 세 번째 계단으로 오를 수 있다. 하지만, 첫 번째 계단을 밟고 이어 네 번째 계단으로 올라가거나, 첫 번째, 두 번째, 세 번째 계단을 연속해서 모두 밟을 수는...
StarcoderdataPython
282286
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon May 22 15:41:30 2017 @author: m75380 """ # TODO: remove this temporary import import os,sys,inspect currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) parentdir = os.path.dirname(currentdir) sys.path.insert(0,parentd...
StarcoderdataPython
4905359
class TestClass(object): ClassVariable = 101 def __init__(self, name): self.__name = name self.__hidden = "You can not touch this!" @property def name(self): return self.__name @property def hidden(self): return self.__hidden @hidden.setter def hi...
StarcoderdataPython
6593299
<gh_stars>1-10 from image_env_mnist1 import Image_env1 from RL_brain_b import DeepQNetwork import numpy as np import time import SYCLOP_env as syc from misc import * from reservoir import ESN import pickle hp=HP() hp.mem_depth = 2 hp.max_episode = 30000 hp.steps_per_episode = 1000 hp.steps_between_learnings...
StarcoderdataPython
1701977
import logging import datetime import ovirtsdk4 as sdk import ovirtsdk4.types as types import config logging.basicConfig(level=logging.DEBUG, filename='backup.log') # This example will connect to the server and print the names and identifiers of all the virtual machines: class MisseVirt(): def __init__(self): ...
StarcoderdataPython
1863275
<reponame>AndreCrescenzo/multi-agents #!/usr/bin/python import sys import time import threading import traceback import signal import sys sys.path.append('.') import iec61850 def signal_handler(signal, frame): global running running =0 print('You pressed Ctrl+C!') #sys.exit(0) signal.signal(signal.S...
StarcoderdataPython
3344262
# -*- coding: utf-8 -*- from scrapy.contrib.spiders.init import InitSpider import datetime class SpiderBase(InitSpider): def extractor(self, xpathselector, selector): """ Helper function that extract info from xpathselector object using the selector constrains. """ val = ...
StarcoderdataPython
11358949
<gh_stars>0 # Author: <NAME> # coding: utf-8 import logging from database import repos sqla_logger = logging.getLogger('sqlalchemy.engine.base.Engine') sqla_logger.disabled = True TEST_NAME = 'name' def main(): while True: session2 = repos.get_session_2() records = repos.get_records(session2, TE...
StarcoderdataPython
314919
<reponame>designer-edu/designer """ Use this script to build up the JSON mapping names to their code point Potentially could decrease file by removing letters that aren't likely to be used... But you never know, maybe someone wants to write their name using this? Perhaps the `text` object could support unicode if we a...
StarcoderdataPython
72246
#!/usr/bin/env python """ Contains the proxies.DictLikeChildrenProxy class definition Please note that this module is private. The proxies.DictLikeChildrenProxy class is available in the ``wpipe.proxies`` namespace - use that instead. """ from .core import sys, itertools, in_session from .BaseProxy import BaseProxy fr...
StarcoderdataPython
274180
import importlib def class_from_name(name): module_name, class_name = name.rsplit(".", 1) return getattr(importlib.import_module(module_name), class_name)
StarcoderdataPython
6543939
<reponame>SunGuo/500lines<filename>modeller/node.py import random from OpenGL.GL import glCallList, glColor3f, glMaterialfv, glMultMatrixf, glPopMatrix, glPushMatrix, \ GL_EMISSION, GL_FRONT import numpy from primitive import G_OBJ_CUBE, G_OBJ_SPHERE from aabb import AABB from transformation impo...
StarcoderdataPython
3233841
from streamlink.stream.akamaihd import AkamaiHDStream from streamlink.stream.dash import DASHStream from streamlink.stream.flvconcat import extract_flv_header_tags from streamlink.stream.hds import HDSStream from streamlink.stream.hls import HLSStream from streamlink.stream.http import HTTPStream from streamlink.stream...
StarcoderdataPython
9602
<gh_stars>1-10 import nox SOURCE_FILES = ( "setup.py", "noxfile.py", "elastic_workplace_search/", "tests/", ) @nox.session(python=["2.7", "3.4", "3.5", "3.6", "3.7", "3.8"]) def test(session): session.install(".") session.install("-r", "dev-requirements.txt") session.run("pytest", "--re...
StarcoderdataPython
11217945
<reponame>teodoramilcheva/softuni-software-engineering from project.animals.animal import Bird from project.food import Meat class Owl(Bird): _FOOD_PREFERENCES = (Meat, ) _WEIGHT_GAIN_PER_FOOD = 0.25 def make_sound(self): return 'Hoot Hoot' class Hen(Bird): _FOOD_PREFERENCES = ...
StarcoderdataPython
8151900
<filename>grove/button/__init__.py from .button import Button from .button_gpio import ButtonTypedGpio from .button_i2c import ButtonTypedI2c __all__ = ["Button", "ButtonTypedGpio", "ButtonTypedI2c"]
StarcoderdataPython
6574636
<gh_stars>0 #!/usr/bin/python import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import matplotlib.colors as mcolors import tensorflow as tf from segnet import segnet from tensorflow.contrib.keras import backend as K from PIL import Image import numpy as np import pdb import cv2 from vis.visualizat...
StarcoderdataPython
8002189
import os import re import math from flask import Flask, render_template, redirect, request, url_for, \ session, flash, Markup from flask_pymongo import pymongo, PyMongo from bson.objectid import ObjectId from forms import RegistrationForm, LoginForm, ReviewForm from werkzeug.security import generate_password_hash,...
StarcoderdataPython
5190378
<reponame>MartinVondrak/club-election<filename>tests/test_auth.py from time import time import jwt import pytest from flexmock import flexmock from sqlalchemy.orm import Session from sqlalchemy.orm.exc import NoResultFound from werkzeug.datastructures import Headers from werkzeug.exceptions import Unauthorized from c...
StarcoderdataPython
1933400
# # The Python Imaging Library. # $Id$ # # EPS file handling # # History: # 1995-09-01 fl Created (0.1) # 1996-05-18 fl Don't choke on "atend" fields, Ghostscript interface (0.2) # 1996-08-22 fl Don't choke on floating point BoundingBox values # 1996-08-23 fl Handle files from Macintosh (0.3) # 2001-02-17 fl ...
StarcoderdataPython
8170080
# ------------------------------------ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # ------------------------------------ import asyncio import os from azure.keyvault.secrets.aio import SecretClient from azure.identity.aio import DefaultAzureCredential from azure.core.exceptions import Http...
StarcoderdataPython
9733444
import numpy as np import tensorflow as tf from tensorflow import keras from tensorflow.keras import layers import tensorflow_probability as tfp from energypy.networks import dense from energypy.utils import minimum_target # clip as per stable baselines log_stdev_low, log_stdev_high = -20, 2 epsilon = 1e-6 def ma...
StarcoderdataPython
131454
# # grid_spline.py # # Code for one-dimensional cubic splines on a # uniform grid, including analytic slope, curvature, # and extremum evaluation. # # Most convenient interface is via GridSpline class, # which encapsulates the low-level routines. # # <NAME>, <NAME>, 2010-2014 # import numpy as n def tri_diag(a, b, c,...
StarcoderdataPython
11373156
<gh_stars>1-10 """ Heat Pump Calculator Dash Application. Requires version 0.23 or later of Dash. """ from textwrap import dedent from pprint import pformat import time import pandas as pd import dash import dash_core_components as dcc import dash_html_components as html from dash.dependencies import Input, Output, St...
StarcoderdataPython
6461821
''' Created on 25 Jul 2015 @author: Thomas ''' from pygame import joystick joystick.init() buconv = {"XBOX": {"A": 0, "B": 1, "X": 2, "Y": 3, "L1": 4, "R1": 5, "SELECT": 6, "START": 7}, "PS2": {"A": 2, "B": 3, "L1": 6}, "CHEAP": {"A": 2, "B": 3, "L1": 4}} class Unijoy: def __init__(self, jnum...
StarcoderdataPython
3593835
#|============================================================================== #| TOP OF FILE #| #| File name: kineticEnergyFunction.py [Python module source file] #| #| Description: #| #| This module defines an abstract base class from which to #| deri...
StarcoderdataPython
6440339
#get_ipython().run_line_magic('matplotlib', 'inline') import matplotlib.pyplot as plt #Load libraries for data processing import pandas as pd #data processing, CSV file I/O (e.g. pd.read_csv) import numpy as np from scipy.stats import norm # visualization import seaborn as sns plt.style.use('fivethirtyeight') sns.se...
StarcoderdataPython
1933943
<filename>tests/unittest/test_topology.py from typing import Union, TypeVar, Any from dyndis.annotation_filter import annotation_filter def cmp(a, b): an_a = annotation_filter(a) an_b = annotation_filter(b) atb = an_a.envelops(an_b) bta = an_b.envelops(an_a) if atb and not bta: return 1 ...
StarcoderdataPython
8041308
<reponame>sponnet/rotki from typing import Any, Dict, List, NamedTuple, Optional, Tuple, Union from unittest.mock import _patch, patch import requests from rotkehlchen.constants.assets import A_BTC, A_ETH from rotkehlchen.constants.misc import ZERO from rotkehlchen.exchanges.data_structures import AssetMovement, Marg...
StarcoderdataPython
4863249
<reponame>davbre/rotki import logging import os import gevent from rotkehlchen.chain.ethereum.manager import NodeName NODE_CONNECTION_TIMEOUT = 10 log = logging.getLogger(__name__) INFURA_TEST = 'https://mainnet.infura.io/v3/66302b8fb9874614905a3cbe903a0dbb' if 'GITHUB_WORKFLOW' in os.environ: # For Github ac...
StarcoderdataPython
6619472
#!/usr/bin/env pythoh # -*- encoding: utf-8 -*- import emojies def main(): input_text = input("Enter your text:\n") no_emoji_text = emojies.replace(input_text) print(f"{no_emoji_text}") if __name__ == "__main__": main()
StarcoderdataPython
1777060
s = input() def reverse(string): return "".join(reversed(string)) def split_and_join(string, word): return "".join(string.split(word)) reversed_s = reverse(s) ls = ["eraser", "dreamer", "erase", "dream"] for word in ls: reversed_word = reverse(word) reversed_s = split_and_join(rev...
StarcoderdataPython
1843656
<reponame>scwolof/adaptive<gh_stars>0 # # Autogenerated by Thrift Compiler (0.11.0) # # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING # # options string: py # from thrift.Thrift import TType, TMessageType, TFrozenDict, TException, TApplicationException from thrift.protocol.TProtocol import TProtoco...
StarcoderdataPython
5071523
import typing import discord import asyncio from discord.ext import commands from Components.MangoPi import MangoPi from Components.MuteTimer import MuteTimer, remove_mute from Components.DelayedTask import time_converter, range_calculator def setup(bot: MangoPi): """ Function necessary for loading Cogs. ...
StarcoderdataPython
9643442
<reponame>Ahtsham-pyds/ga-learner-dsmp-repo # -------------- #Code starts here import matplotlib.pyplot as plt fig = plt.figure() ax_1=plt.subplot(311) ax_1.boxplot(data['Intelligence']) ax_1.set_title('Intelligence') ax_2=plt.subplot(312) ax_2.boxplot(data['Speed']) ax_2.set_title('Speed') ax_3=plt.subplot(31...
StarcoderdataPython
176538
<gh_stars>10-100 from toee import * from utilities import * def OnBeginSpellCast( spell ): print "Neutralize Poison OnBeginSpellCast" print "spell.target_list=", spell.target_list print "spell.caster=", spell.caster, " caster.level= ", spell.caster_level game.particles( "sp-conjuration-conjure", spell.caster ) d...
StarcoderdataPython
238734
<gh_stars>1-10 import bokeh.io as bkio import bokeh.layouts as bklayouts import bokeh.models as bkmodels import bokeh.models.graphs as bkgraphs import bokeh.palettes as bkpalettes import bokeh.plotting as bkplotting import networkx as nx import numpy as np from logging import getLogger logger = getLogger(__name__) ...
StarcoderdataPython
3552879
<filename>eventApi/python/api.py # API For Python
StarcoderdataPython
6450007
from __future__ import annotations from typing import List, Optional, Union, TYPE_CHECKING from .base import Interaction from ..components import ActionRow, Button, SelectMenu from ..enums import ComponentType, try_enum from ..utils import cached_slot_property from ..message import Message __all__ = ( 'MessageIn...
StarcoderdataPython
9696292
<filename>db/similarity/OtoO_Similarity.py # -*- coding: utf-8 -*- from scipy import linalg, mat, dot import numpy as np import sys import math def main(argument1, argument2) : text = argument1+ " " + argument2 table = dict() wcnt = 0 for word in text.split(): if word not in table...
StarcoderdataPython
1912297
from app import ma class ResponseSchema(ma.Schema): success = ma.Bool() message = ma.Str() errors = ma.Dict() token = ma.Str()
StarcoderdataPython
122712
"""Gradient compression algorithms.""" from __future__ import division import tensorflow as tf from tensorflow.python.framework import load_library from tensorflow.python.platform import resource_loader tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.ERROR) import random, math from horovod.tensorflow.mpi_ops i...
StarcoderdataPython
3314412
<reponame>hiro-o918/luigi<gh_stars>1-10 # -*- coding: utf-8 -*- # # Copyright 2012-2015 Spotify AB # # 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...
StarcoderdataPython
4910412
<filename>tests/krs/test_bootstrap.py from krs import bootstrap def test_wait_for_keycloak(monkeypatch): bootstrap.wait_for_keycloak() def test_token(monkeypatch): monkeypatch.setenv('USERNAME', 'admin') monkeypatch.setenv('PASSWORD', '<PASSWORD>') bootstrap.wait_for_keycloak() bootstrap.get_token...
StarcoderdataPython
8034990
#FT991a is on COM3 # https://pyserial.readthedocs.io/en/latest/shortintro.html # https://pythonhosted.org/pyserial/index.html # http://www.varesano.net/blog/fabio/serial%20rs232%20connections%20python # https://www.yaesu.com/indexVS.cfm?cmd=DisplayProducts&ProdCatID=102&encProdID=D24F60F33816ED8BE5568D7E2B5E2131 # http...
StarcoderdataPython
8111569
<reponame>jmgilman/fapi """ A script for generating an openapi.json file for use in mkdocs. """ import json from app.api.v1 import api from app.main import app if __name__ == "__main__": app.include_router(api.router) with open("docs/openapi.json", "w") as fd: json.dump(app.openapi(), fd)
StarcoderdataPython
3386123
<filename>darwin/importer/formats/labelbox_schemas.py bounding_box = { "$id": "https://darwin.v7labs.com/schemas/labelbox/bounding_box", "description": "Schema of a Bounding Box", "title": "Bounding Box", "default": {"top": 1.2, "left": 2.5, "height": 10, "width": 20}, "examples": [{"top": 0, "left"...
StarcoderdataPython
11336348
"""Modul ini digunakan untuk melakukan proses preprocessing dan evaluasi. Sehingga dengan jelas, jika ada penggunaan preprocessing seperti cleaning text. Maka modul ini digunakan, agar, digunakan lebih baik. dari modul ini pula dapat digunakan untuk mengeveluasi setiap model yang dikerjakan. """ import numpy a...
StarcoderdataPython
8183012
<filename>applications/Gardeners_temp/models/order.py # -*- coding: utf-8 -*- userauth=Auth(db,controller='order') from gluon.validators import Validator class IS_PHONE(Validator): def __init__(this,error_message='Must be a valid ph. number'): this.error_message=error_message def __call__(this,value): ...
StarcoderdataPython
6418402
import pytest import xarray from distributed import Client from odc.stac.bench import ( BenchLoadParams, collect_context_info, load_from_json, run_bench, ) CFG = {"*": {"warnings": "ignore"}} @pytest.fixture(scope="module") def dask_client(): client = Client( n_workers=1, threads...
StarcoderdataPython
8038810
import requests import dateutil.parser from datetime import timedelta import re import numpy as np import json SERVICE_ENDPOINT = 'https://api.applicationinsights.io' QUERY_ENDPOINT_PATH_TEMPLATE = 'beta/apps/{0}/query' # Regex for TimeSpan TIMESPAN_PATTERN = re.compile(r'((?P<d>[0-9]*).)?(?P<h>[0-9]{2}):(?P<m>[0-9]{...
StarcoderdataPython
3278799
<reponame>marinaPauw/Assurance<gh_stars>1-10 import sys from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5.QtWidgets import * from PyQt5.QtCore import * from PyQt5.QtGui import * import math, sys import statistics from sklearn import decomposition as sd from sklearn import preprocessing from sklearn.cluster...
StarcoderdataPython
143986
import turtle ninja = turtle.Turtle() ninja.speed(10) for i in range(180): ninja.forward(100) ninja.right(30) ninja.forward(20) ninja.left(60) ninja.forward(50) ninja.right(30) ninja.penup() ninja.setposition(0, 0) ninja.pendown() ninja.right(2) ...
StarcoderdataPython
1817652
#!/usr/bin/env python3 """ Module containing the agent class for the coverage control algorithm """ # Standard libraries # Third-party libraries import numpy as np # Local libraries import geometry import voronoi class Agent(object): """ Agent class. """ def __init__(self, position, id): self....
StarcoderdataPython
4991752
<filename>faculdade2.0/aula 2/prof-2.py lista = [] # Lista vazia from time import sleep ''' def menu(): print('[c] - Create') print('[r] - Read') print('[u] - Update') print('[d] - Delete') print('[e] - Exit') opcao = input('Opção: ') return opcao ''' def menu(): whi...
StarcoderdataPython
210825
from soda.scan import Scan def test_variables(): scan = Scan() scan.add_variables({"now": "2022-10-22 11:12:13"}) scan.add_sodacl_yaml_str( f""" variables: hello: world sometime_later: ${{now}} """ ) assert scan._variables["hello"] == "world" ...
StarcoderdataPython
9690163
<reponame>h-qub/wordeater-web # coding=utf-8 import os from tests.test_base import BaseTest from services.external.giphy import GiphyService __author__ = '<NAME>' class GiphyTest(BaseTest): def setUp(self): BaseTest.setUp(self) self.gs = GiphyService() class GiphyRandomTest(GiphyTest): ""...
StarcoderdataPython
9705239
def get_dataset(composer: str, with_inversions=False) -> str: ''' Returns the content of the txt file for the composer's repertoire Parameters ---------- composer : str The composer which has been encoded with_inversion : bool, optional Whether to fetch the dataset with or with...
StarcoderdataPython
12858283
# -*- coding: utf-8 -*- """Base data handler. Copyright 2021, Gradient Zero All rights reserved """ import logging import dq0.sdk from dq0.sdk.estimators.data_handler.base import BasicDataHandler import pandas as pd from sklearn.model_selection import train_test_split logger = logging.getLogger(__name__) class ...
StarcoderdataPython
9755101
<filename>models/tinydb/article.py<gh_stars>1-10 # # TinyDB Model: Article # from medium.models.tinydb.tinymodel import TinyModel import datetime class Article(TinyModel): # # Use the cerberus schema style # which offer you immediate validation with cerberus # http://docs.python-cerberus.org/en/stab...
StarcoderdataPython
8165010
import xml.dom.minidom import sys sys.path.append('py') import ColladaScene import ColladaAnim import os import shutil import re #matchThis = '.' matchThis = 'space-station' outFolder = './json/' #if os.path.exists(outFolder[:-1]): # shutil.rmtree(outFolder[:-1]) #os.makedirs(outFolder[:-1]) fileHandle = open(outFo...
StarcoderdataPython
11246593
<gh_stars>1-10 from typing import Dict import torch from nets import VotingNet from evaluator.evaluators import LinemodEvaluator from utils.io_utils.inout import save_dict_to_txt def main(): # Load the network net = VotingNet() last_state = torch.load('/home/ryan/Codes/VotingNet6DPose/log_info/models/linemod_cat...
StarcoderdataPython
8105977
# coding=utf-8 # Copyright 2020 HuggingFace Datasets 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/LICENSE-2.0 # # Unless required by applica...
StarcoderdataPython
3492360
#!/usr/bin/python # # Copyright 2012 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required b...
StarcoderdataPython
8190139
import logging from distutils.util import strtobool from flask import Markup, flash, json, redirect, render_template, request, url_for from structlog import wrap_logger from frontstage import app from frontstage.common.authorisation import jwt_authorization from frontstage.common.message_helper import from_internal, ...
StarcoderdataPython
11287415
import numpy as np import matplotlib.pyplot as plt import src.envs.lunar_lander.utils as utils import src.envs.lunar_lander.conditions as conditions # from stable_baselines import PPO2 # from stable_baselines.common.policies import MlpPolicy # from stable_baselines.common.vec_env import SubprocVecEnv # from stable_bas...
StarcoderdataPython
6408903
from django.http import HttpResponse from django.views.decorators.csrf import csrf_exempt from django.views.decorators.http import require_POST from sendgrid_events.models import SendgridEvent @require_POST @csrf_exempt def handle_batch_post(request): SendgridEvent.process_batch(data=request.raw_post_data) r...
StarcoderdataPython
1863447
<reponame>mike-douglas/venmo2ynab<filename>venmo2ynab.py import click import csv import sys from datetime import datetime def read_transactions(input_file): with open(input_file) as csvin: in_reader = csv.reader(csvin, delimiter=',', quotechar='"') next(in_reader) next(in_reader) h...
StarcoderdataPython
276875
import pretty from pretty import * def showAllPlasma(cur,con): try: query = "SELECT * FROM PLASMA" if cur.execute(query): pretty(cur.fetchall()) con.commit() except Exception as e: con.rollback() print("Show All failed") print(">>>>>>>>>>>>>", e) ...
StarcoderdataPython
1746162
<reponame>LCBRU/identity from sqlalchemy import ( MetaData, Table, Column, Text, DateTime, ) meta = MetaData() def upgrade(migrate_engine): meta.bind = migrate_engine t = Table("demographics_request", meta, autoload=True) error_datetime = Column("error_datetime", DateTime) error...
StarcoderdataPython
6457639
__author__ = 'miko' from de.hochschuletrier.jpy.jason.JSONHandler import JSONHandler from de.hochschuletrier.jpy.jason.JSONBackupHandler import JSONBackupHandler class QuestionManager: def __init__(self, master, questiondir): self.master = master self.questiondir = questiondir self.questions = {} self.answer...
StarcoderdataPython
124718
# -*- coding: utf-8 -*- # @Time : 2018/6/30 1:03 # @Author : TrumanGu # @Email : <EMAIL> # @File : __init__.py.py # @Software: PyCharm
StarcoderdataPython
9674132
import sys import numpy as np import time from sklearn import preprocessing OUTS = 1 FAULT = 0.01 def perceptron(name, outs=OUTS, fault=FAULT): # Данные dataset = np.loadtxt('../data/{}/train.csv'.format(name), delimiter=',', skiprows=1) x = np.hstack((np.ones((dataset.shape[0], 1)), dataset[:, outs:])) y = ...
StarcoderdataPython
4913179
from .__about__ import ( __author__, __commit__, __copyright__, __email__, __license__, __summary__, __title__, __uri__, __version__, ) from . import datasets from . import make from . import tarprep from . import urlcopy from .fetchfuncs import fetch
StarcoderdataPython
11281474
from secml.ml.classifiers.gradients.tests import \ CClassifierGradientMixinTestCases from secml.ml.classifiers.gradients.tests.test_classes import \ CClassifierGradientTestLogisticRegression from secml.ml.classifiers import CClassifierLogistic from secml.ml.features.normalization import CNormalizerMinMax cla...
StarcoderdataPython
4806103
<filename>recording_inputs.py import pygame import time import random class InputRecorder(): def __init__(self, inputs): # Initializes the input recorder object. # delay 0, 1, 2 represent no delay, actual delay, and randomly generated delay respectively # self._record_mode may be...
StarcoderdataPython
199219
test = { 'name': 'Mutability', 'points': 0, 'suites': [ { 'type': 'wwpp', 'cases': [ { 'code': """ >>> lst = [5, 6, 7, 8] >>> lst.append(6) Nothing >>> lst [5, 6, 7, 8, 6] >>> lst.insert(0, 9) >>> lst ...
StarcoderdataPython
1811120
<reponame>movingpictures83/ASV2Taxon<filename>ASV2TaxonPlugin.py import sys class ASV2TaxonPlugin: def input(self, filename): self.myfile = filename def run(self): filestuff = open(self.myfile, 'r') self.firstline = filestuff.readline().strip() classification = self.firstline.split(','...
StarcoderdataPython
11250995
<gh_stars>0 ''' api-tests.py <NAME>, <NAME> 18 Feb 2021 Testing api for covid website project CS257 winter2021 ''' import #whatever the covid api program will look like import unittest class ApiEndpointTester(unittest.TestCase): def setUp(self): self.api_endpoint = #not sure what to put here ...
StarcoderdataPython
6585947
from etl.xml_importer.utils.sourceId import SourceID from etl.xml_importer.xpaths import paths, namespace from etl.xml_importer.parseLido import sanitize, filter_none from etl.xml_importer.encoding import JSONEncodable class Iconography(JSONEncodable): def __init__(self, root): self.root = root s...
StarcoderdataPython
11266823
# -*- coding: utf-8 -*- """ Created on Tue Jul 9 11:15:45 2019 @author: hu """ # Classification template # Importing the libraries import numpy as np import matplotlib.pyplot as plt import pandas as pd # Importing the dataset dataset = pd.read_csv('Social_Network_Ads.csv') F = pd.get_dummies(datase...
StarcoderdataPython
11289353
""" Datos de entrada sueldo bruto-->s-->int Datos de salida nuevo sueldo-->ns-->float """ #Entradas s=int(input("Digite su sueldo ")) #Caja negra if(s<900000): ns=(s*0.15)+s elif(s>=900000): ns=(s*0.12)+s #salidas print(f"Su nuevo sueldo es de: {ns}")
StarcoderdataPython
378438
# MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2021 Megvii Inc. All rights reserved. # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT ARRANTIES OR CONDITIONS OF ANY ...
StarcoderdataPython
236698
import os os.chdir('./src') f1 = open("Cit-HepTh-dates.csv", "w") f2 = open("Cit-HepTh.csv", "w") d = {} class Paper: def __init__(self, id, date): self.id = id self.date = date self.citations = set() def citates(self, citation): self.citations.add(citation) ...
StarcoderdataPython
9698719
<reponame>dychangfeng/intro-to-programming-with-python """package Description Copyright (c) 2017 <NAME> <<EMAIL>> This code is free software; you can redistribute it and/or modify it under the terms of the BSD License (see the file COPYING included with the distribution). @status: experimental @author: <NAME> @contac...
StarcoderdataPython
8143919
<reponame>mjbremer/metalpedal import serial import datetime ser = serial.Serial() ser.baudrate = 115200 ser.port = 'COM5' print(ser) ser.open() data = [] for i in range(1): new_data = ser.read(int(1250*4)) print(new_data) floats = [] for i in range(0, len(data), 4): floats.append(struct.unp...
StarcoderdataPython
11318887
import sys import os import subprocess from shutil import copyfile from shutil import rmtree from shutil import move from os import scandir from os import remove from os import path from ownStyle import GREEN,BLUE,BOLD,GREEN,RED,RESET,CYAN from ProjectSignin import SignIn from gradle_management import manageSigninAn...
StarcoderdataPython
11391179
<filename>skaben/device/urls.py from device import views from django.urls import include, path from rest_framework.routers import SimpleRouter app_name = 'device' router = SimpleRouter() router.register('lock', views.LockViewSet) router.register('terminal', views.TerminalInternalViewSet) #router.register('simple', vi...
StarcoderdataPython
11371070
<reponame>Corwinpro/your-train-butler from setuptools import setup, find_packages # The find_packages function does a lot of the heavy lifting for us w.r.t. # discovering any Python packages we ship. setup( name="rail_bot", version="0.1.0.dev0", packages=find_packages(), # PyPI packages required for th...
StarcoderdataPython
9728670
<reponame>blefaudeux/chinoxel from scene import Scene import taichi as ti import argparse @ti.kernel def write_circle(buffer: ti.template(), circle_radius: float): # type: ignore """ For optimization testing purposes, write a white circle in the frame buffer """ center = ti.Vector([buffer.shape[0...
StarcoderdataPython
255776
<reponame>johan--/commcare-hq from datetime import datetime, timedelta from functools import partial import logging from celery.schedules import crontab from celery.task import task, periodic_task from django.conf import settings from django.db import transaction from psycopg2._psycopg import DatabaseError from casex...
StarcoderdataPython
8008237
import superimport import random import numpy as np import matplotlib.pyplot as plt from numpy import transpose from numpy.random import default_rng from math import exp, sqrt, sin, pi, cos import pyprobml_utils as pml def gpKernelPlot(seed): if seed == 1: return X = np.array([1, 2, 3]) X_t ...
StarcoderdataPython
126326
<filename>extras/forms.py from django import forms from django.contrib.auth.models import User from django.core.exceptions import ValidationError from requests.exceptions import HTTPError from utils.forms import ( APISelectMultiple, BootstrapMixin, DynamicModelMultipleChoiceField, StaticSelect, add...
StarcoderdataPython
4965581
import sys import os import nanomsg as nn from nanomsg import wrapper as nn_wrapper import time if __name__ == "__main__": # Local pub and sub lsub = nn.Socket( nn.SUB, domain=nn.AF_SP ) lsub.connect( "tcp://localhost:8687" ) lsub.set_string_option( nn.SUB, nn.SUB_SUBSCRIBE, "") while(True): ...
StarcoderdataPython
5135326
# -*- coding: utf-8 -*- import pytest import astropy.units as u from irispy.obsid import ObsId OBSID = [3677508065, 3880903651, 4050607445] INVALID_OBSID = [4643502010, 4050607495, 3880903650, 3680903685, 335987081297, 40] TEST_DATA = {} TEST_DATA['exptime'] = [8 * u.s, 30 * u.s, 4 * u.s] TEST_DATA['raster_desc'] = [...
StarcoderdataPython
8196664
# Code to train a word2vec model with gensim # For use with ml5.js word2vec examples from gensim.models import Word2Vec import re import json import sys import argparse import glob import os #Parsing for the user arguments parser = argparse.ArgumentParser(description="Text File to Word2Vec Vectors") #Required input f...
StarcoderdataPython
107725
from typing import List from pytest import fixture from pytest_bdd import scenarios, given, when, then from pytest_bdd.parsers import parse from game import Game from puzzle import HintType, Puzzle from dictionary import Dictionary @fixture(scope="session") def dictionary() -> Dictionary: return Dictionary.from...
StarcoderdataPython
4832102
<gh_stars>0 from numpy import full, nan from numpy.random import seed, shuffle from pandas import isna from sklearn.linear_model import LinearRegression from .compute_empirical_p_value import compute_empirical_p_value from .plot_and_save import plot_and_save from .RANDOM_SEED import RANDOM_SEED def correlate_2_1d_ar...
StarcoderdataPython