id
stringlengths
2
8
text
stringlengths
16
264k
dataset_id
stringclasses
1 value
9648003
import logging import signal import socket import threading import traceback import typing from io import StringIO, BytesIO from typing import Type, Optional, Union from wsproto import ConnectionType, WSConnection from wsproto.events import Ping, Request, AcceptConnection, CloseConnection, TextMessage, \ BytesMess...
StarcoderdataPython
207600
<filename>maze_solver/__main__.py from utils import ( get_input_data, solve_maze_from_file, solve_test_mazes, display_help, ) def main() -> None: """Entry point of the script""" mode, value = get_input_data() if mode == 'file': solve_maze_from_file(value) elif mode == 'test': ...
StarcoderdataPython
5107539
<filename>src/wagtail_2fa/__init__.py default_app_config = "wagtail_2fa.apps.Wagtail2faConfig" __version__ = "1.5.0"
StarcoderdataPython
11343852
<gh_stars>0 from django.contrib import admin from musics.models import Music class MusicAdmin(admin.ModelAdmin): pass admin.site.register(Music, MusicAdmin)
StarcoderdataPython
5198957
<filename>apps/deadline/management.py from django.conf import settings from django.db.models import signals from django.utils.translation import ugettext_noop as _ if "notification" in settings.INSTALLED_APPS: from notification import models as notification def create_notice_types(app, created_models, verbosi...
StarcoderdataPython
6607369
#!/usr/bin/python import argparse from passlib.context import CryptContext parser = argparse.ArgumentParser() parser.add_argument('--password', type=str, required=True) args = parser.parse_args() hasher = CryptContext(schemes=['bcrypt']) print(hasher.hash(args.password))
StarcoderdataPython
6647246
<filename>zulip_bots/zulip_bots/bots/codery/codery.py<gh_stars>1-10 import sys import os sys.path.insert(0, os.getcwd()) import requests import calculator import todo import dictionary import news import geekjokes import courses import jobs import leaderboard import trendingproblems from bs4 import BeautifulSoup from...
StarcoderdataPython
3254318
<reponame>LucLapenta/is-it-raining-site # users/urls.py from django.urls import path from .views import SignUpView, AlertListView, CreateAlertView, UpdateAlertView from .models import Alert from . import views urlpatterns = [ path('signup/', SignUpView.as_view(), name='signup'), path('profile/', views.view_pr...
StarcoderdataPython
133577
<gh_stars>0 # coding=utf-8 from matplotlib import pyplot as plt from matplotlib import font_manager interval = [0,5,10,15,20,25,30,35,40,45,60,90] width = [5,5,5,5,5,5,5,5,5,15,30,60] quantity = [836,2737,3723,3926,3596,1438,3273,642,824,613,215,47] print(len(interval),len(width),len(quantity)) #设置图形大小 plt.figure(f...
StarcoderdataPython
1624687
from click.testing import CliRunner from mock import Mock, patch from sigopt.cli import cli class TestClusterCreateCli(object): def test_cluster_create(self): services = Mock() runner = CliRunner() with \ runner.isolated_filesystem(), \ patch('sigopt.orchestrate.controller.OrchestrateServic...
StarcoderdataPython
134904
<gh_stars>0 """ pygame-menu https://github.com/ppizarror/pygame-menu WIDGET This module contains the widgets of pygame-menu. License: ------------------------------------------------------------------------------- The MIT License (MIT) Copyright 2017-2021 <NAME>. @ppizarror Permission is hereby granted, free of char...
StarcoderdataPython
3522107
from django.apps import AppConfig class DeliveryOptionsConfig(AppConfig): name = 'delivery_options'
StarcoderdataPython
1891896
import numpy as np from PIL import Image import glob import time import sys output_dir = '/hpctmp2/e0046667/' data = [] total_amount_data = 0 first_simu = int(sys.argv[1]) last_simu = int(sys.argv[2]) for k in range(first_simu, last_simu + 1): simulation_path = output_dir + "output"+str(k) action_dirs = glo...
StarcoderdataPython
3232575
import sys import pandas as pd # From Assignment 2, copied manually here just to remind you # that you can copy stuff manually if importing isn't working out. # You can just use this or you can replace it with your function. def countTokens(text): token_counts = {} tokens = text.split(' ') for word in to...
StarcoderdataPython
4821620
from django.urls import path from rest_framework_simplejwt.views import TokenObtainPairView, TokenRefreshView from .views import ProfileRetrieveView urlpatterns = [ path("token/", TokenObtainPairView.as_view(), name="token-obtain-pair"), path("token/refresh/", TokenRefreshView.as_view(), name="token-refresh...
StarcoderdataPython
8010885
from django.conf.urls import url from ...bruv.views.benthic_category import BenthicCategoryView urlpatterns = [ url(r"habitat/substrate/$", BenthicCategoryView.as_view(), name="ajax_substrate"), ]
StarcoderdataPython
6436312
from django.contrib import admin from .models import CustomUser class CustomUserAdmin(admin.ModelAdmin): list_display = ('id', 'email', 'username', 'avatar', 'age', 'is_staff',) search_fields = ('id', 'username',) ordering = ('id',) admin.site.register(CustomUser, CustomUserAdmin)
StarcoderdataPython
4821324
<filename>ImageFinder/ImageFinder/ImageFinder.py import cv2 import numpy import os import imghdr import sys AcceptableImages = ['jpeg','png','gif','bmp'] #Take in a image and look for images that are very similar or exactly the same as the original image #Does this by naively just calculating the difference norm of th...
StarcoderdataPython
6479379
<filename>Meiju/spiders/Meijuspider.py<gh_stars>0 # -*- coding: utf-8 -*- import scrapy # -*- coding: utf-8 -*- import scrapy from lxml import etree from Meiju.items import MeijuItem # from .Meiju.pipelines import MeijuPipeline class MeijuspiderSpider(scrapy.Spider): name = 'Meijuspider' allowed_domains = [...
StarcoderdataPython
5127768
import numpy as np def softmax(predictions): ''' Computes probabilities from scores Arguments: predictions, np array, shape is either (N) or (batch_size, N) - classifier output Returns: probs, np array of the same shape as predictions - probability for every class, 0..1 ...
StarcoderdataPython
1944959
""" Copyright Government of Canada 2017 Written by: <NAME>, National Microbiology Laboratory, Public Health Agency of Canada Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with the License. You may obtain a copy of the License at: http://www...
StarcoderdataPython
4898711
<gh_stars>0 import pandas as pd import numpy as np from sklearn.model_selection import train_test_split from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer from sklearn.multiclass import OneVsRestClassifier from sklearn.svm import LinearSVC from sklearn.preprocessing import LabelEncoder from va...
StarcoderdataPython
6694732
"""Libraries."""
StarcoderdataPython
1761595
from argparse import Namespace from .pg2.db_methods import Pg2DB from .sqla.db_methods import AlchemyDB from ...parsers import AGP_RDS_GENERATE def get_connection_dict(args: Namespace) -> dict: """Create connection dict""" db_connect = { 'host': args.host, 'port': args.port, 'password...
StarcoderdataPython
6613871
<filename>valveless/problem.py import numpy as np class Problem(object): """ This class encapsulates the relevant physical parameters of the problem into an object. """ def __init__(self, L, D, f, psi_ca, a_0, alpha_m, rho_t, mu_m, eta_f, gamma): """ Initializes and sets the vario...
StarcoderdataPython
6627538
#!/usr/bin/env python3 """A very simple batch that tests basic functionality.""" import hail as hl hl.init()
StarcoderdataPython
5175978
''' <NAME> 4/5/21 custom_invitation.py creates personalied invitations and puts them all on separate pages in a .docx file. Invitations are personalized by reading a .txt file of recipient names. ''' import os import docx from docx.shared import Pt def custom_invitation(text_file): names_file = open(text_file, ...
StarcoderdataPython
1881288
# Copyright © 2020 by <NAME>. # Simple GUI with screens filled with widgets, some touchable. # Colors: # For best performance and lowest memory use, this GUI cean use a GS4_HSMB "4-bit greyscale" # framebuffer. This is used to represent 16 colors and # the display driver (it's display() method specifically) is expecte...
StarcoderdataPython
11350423
from flask_wtf import FlaskForm from wtforms import StringField, TextAreaField, SubmitField from wtforms.validators import Required class BioForm(FlaskForm): bio = TextAreaField('Write A Short Bio About You...') submit = SubmitField('Submit') class UpdateProfile(FlaskForm): bio = TextAreaField('Tell us a...
StarcoderdataPython
189957
<reponame>orwonthe/big_muddy_pi from big_muddy_io import BigMuddyIO from flask import render_template from flask import request def servo_cycle_request(servo_cycler): if request.method == 'POST': if request.form.get('action') == "Once": servo_cycler.cycle(1) elif request.form.get('acti...
StarcoderdataPython
164070
"""Web socket proxy.""" import asyncio import collections import weakref import aiohttp from aiohttp import web from aiohttp import WSMsgType from being.serialization import dumps from being.logging import get_logger class WebSocket: """WebSocket connections. Interfaces with aiohttp web socket requests. Can ...
StarcoderdataPython
3397288
<filename>tests/test_wps_correlate_field.py import pytest from pywps import Service from pywps.tests import client_for, assert_response_success from .common import get_output from climexp_numerical_wps.processes.correlate_field import CorrelateField def test_wps_correlate_field(): client = client_for(Service(pr...
StarcoderdataPython
3267112
<gh_stars>0 #!/usr/bin/python3 """ This program inserts itself in between the two hoverboard control boards, each of which is connected to the program-running computer by a USB-serial converter. Commands sent from one board to another may be changed. """ import serial import sys import collections master = '/dev/tty...
StarcoderdataPython
4886159
# Problem 52 : Permuted multiples def contain_same_digit(a, b): """ This function tests whether or not numbers a and b contains the same digits. """ list_a = list(str(a)) list_b = list(str(b)) if len(list_a) == len(list_b): for elt in list_a: if elt not in list_b: ...
StarcoderdataPython
3489880
<reponame>typo-team/tap-typo ''' TapTypo tests ''' # Copyright 2019-2020 Typo. 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/l...
StarcoderdataPython
327883
__version__ = '0.6.3-dev'
StarcoderdataPython
1709333
import shutil def escrever_arquivo(texto): arquivo = open("teste.txt", "w") arquivo.write(texto) arquivo.close() def atualizar_arquivo(nome_arquivo, texto): arquivo = open(nome_arquivo, "a") arquivo.write(texto) arquivo.close() def ler_arquivo(nome_arquivo): arquivo = open(nome_arquivo...
StarcoderdataPython
11259134
from datetime import datetime import os import uuid from django.conf import settings from django.urls import reverse from django.db import models from django.core.exceptions import ValidationError from django.utils import timezone from devilry.apps.core.models import Delivery from devilry.apps.core.models import Stat...
StarcoderdataPython
5045330
#!/usr/bin/env python import logging import ioservice import configuration Ioservices = {} callbacks = [] def init(): for s in configuration.services: new_service = ioservice.ioservice(s["name"], s["displays"], s["settings"]) new_service.subscribe(ioservice_change) Ioservices[s["name"]] = new_ser...
StarcoderdataPython
12855347
#ModBUS Communication between Schneider EM6436 Meter and Raspberry Pi #First beta version. #The meter is set with the following settings #Communication : (RS484 to RS232 to USB) - BaudRate = 19200, Parity = N, Stopbits = 1, Device ID=1 (Hardcode in meter) #Electical Settings: APri:50, Asec: 5, VPri: 415, Vsec:415, SYS:...
StarcoderdataPython
4872849
import cv2 def compare_ratio(src_img, template, ratio_list): optimal_maxVal = 0 optimal_ratio = 0 optimal_x = 0 optimal_y = 0 optimal_w = 0 optimal_h = 0 temp_h, temp_w = template.shape[:2] for ratio in ratio_list: resize_w = int(temp_w*ratio) resize_h = int(temp_h*rati...
StarcoderdataPython
11203858
<reponame>ClovisChen/LearningCNN #!/usr/bin/env python # -*- coding: utf-8 -*- import numpy as np import pose.IMUPreInt as imu import pose.PyLie.transform as tf import pose.IMUPreInt as IMUPreInt import pose.struct as line_struct import data.euroc_reader as euroc import cv2 def test_fuse_gravity(data_root): read...
StarcoderdataPython
1672105
<reponame>taharh/label-studio # coding: utf-8 import sys import os import warnings import glob from importlib import import_module import ruamel.yaml from ruamel.yaml.error import UnsafeLoaderWarning, YAMLError # NOQA from ruamel.yaml.tokens import * # NOQA from ruamel.yaml.events import * # NOQA from ruamel.yam...
StarcoderdataPython
6636592
# coding: utf-8 import requests from .horizon import Horizon from .keypair import Keypair from .exceptions import AccountNotExistError, NotValidParamError from .horizon import HORIZON_LIVE, HORIZON_TEST class Address(object): """The :class:`Address` object, which represents an address (public key) on Stella...
StarcoderdataPython
1938853
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """This module defines and registers the example gym environments.""" import subprocess from pathlib import Path from typing import Iterable f...
StarcoderdataPython
8035822
class SettlementOrderGid(object): def __init__(self): self._id = 0 def get(self): res = self._id self._id += 1 return res settlement_order_gid = SettlementOrderGid()
StarcoderdataPython
347509
<reponame>anniyanvr/nesta<filename>nesta/core/routines/meetup/health_tagging/topic_discovery_task.py ''' Topic discovery =============== Task to automatically discover relevant topics from meetup data, defined as the most frequently occurring from a set of categories. ''' import luigi import datetime import json fro...
StarcoderdataPython
1982727
<reponame>PNNL-Comp-Mass-Spec/DtaRefinery<gh_stars>0 from aux_sys_err_prediction_module.additive.my_additive_regression_analysis import do_additive_regression_analysis as additive_approach from aux_sys_err_prediction_module.simple_shift.my_simple_shift import do_simple_shift as simple_shift from numpy import log, a...
StarcoderdataPython
3565453
import sqlalchemy import urllib.request import zipfile import pandas as pd URL = "https://download.geonames.org/export/dump/cities500.zip" urllib.request.urlretrieve(URL, "cities500.zip") with zipfile.ZipFile("./cities500.zip", "r") as zip_ref: zip_ref.extractall(".") column_names = """\ geonameid : i...
StarcoderdataPython
5182093
<gh_stars>0 import unittest import numpy as np from scipy.stats import binom, hypergeom from scipy import stats from scipy.special import factorial from functools import partial from pyapprox.numerically_generate_orthonormal_polynomials_1d import * from pyapprox.orthonormal_polynomials_1d import * from pyapprox.uni...
StarcoderdataPython
213022
import torch from .. import FF class PositionwiseFF(torch.nn.Module): """Positionwise Feed-forward layer. Arguments: Input: Output: """ def __init__(self, model_dim, ff_dim, activ='relu'): super().__init__() self.model_dim = model_dim self.ff_dim = ff_dim s...
StarcoderdataPython
1920675
import json import pandas as pd import os from constants import * import csv from Scrape import * from bs4 import BeautifulSoup import requests from GetUrls import * from pathlib import Path import datetime import sys import zerorpc from functions import * import numpy as np import time from time import sleep
StarcoderdataPython
9737855
<filename>python/rsml/src/rsml/misc.py """ Practical functionality to process rsml-formated mtg """ def plant_vertices(g): """ return the list of mtg vertices that represent plants """ return g.vertices(scale=1) def root_vertices(g): """ return the list of mtg vertices that represent root axes """ ...
StarcoderdataPython
5046804
from django.shortcuts import render # Create your views here. # coding:utf-8 from django.http import HttpResponse def index(request): return HttpResponse(u'Django测试站')
StarcoderdataPython
5089077
# -*- coding: utf-8 -*- # # Sorted list implementation. from __future__ import print_function from sys import hexversion from .sortedlist import recursive_repr from bisect import bisect_left, bisect_right, insort from itertools import chain, repeat, starmap from collections import MutableSequence from operator import...
StarcoderdataPython
48200
<filename>src/03.Structure.py ## 连接 multiLineStr = 'hell' + \ 'o, w' + \ 'orld' print(multiLineStr) # 会输出 hello, world ## 条件分支 ### 条件控制 furry = True small = True if furry: if small: print(" It' s a cat.") else: print(" It' s a bear!") else: if small: print(" It' s a skink!")...
StarcoderdataPython
6615104
from abc import ABCMeta, abstractmethod import json import time from indy import ledger import asyncio from .AbstractConnector import AbstractConnector class IndyConnector(AbstractConnector): def __init__(self, socketio, sessionid, indy_dic): self.moduleName = "IndyConnector" self.indy_dic = indy...
StarcoderdataPython
9751997
import os import glob import random from sklearn.model_selection import train_test_split def filter_bird_dataset(image_dir, seg_dir, save_dir, save_name_prefix, max_count=100, select_class_name=None, select_class_count=N...
StarcoderdataPython
1826746
<filename>blog/urls.py<gh_stars>10-100 from django.contrib.sitemaps.views import sitemap from django.urls import ( path, re_path ) from .sitemaps import PostSitemap from .views import ( PostListView, PostDetailView, PostMyListView, PostMyDetailView, PostCreateView, PostUpdateView, PostDeleteView, PostCateg...
StarcoderdataPython
8180097
<reponame>amadavan/PhasorPy import numpy as np import scipy as sp import scipy.sparse import stukapy as st def constructLP(network, formulation, alphap): if formulation == 'ISF': c, Aub, bub, Cub, Aeq, beq, Ceq, lb, ub = [], [], [], [], [], [], [], [], [] p0 = 1. for lineOutage in network...
StarcoderdataPython
12859223
<gh_stars>1-10 import torch import numpy as np import copy def remove(path): data = torch.load(path) location_list, action_list = [np.reshape(st[0], (1, 8)) for st in data], [st[1] for st in data] location_list = np.concatenate(location_list, axis=0) action_list = np.asarray(action_list) acti...
StarcoderdataPython
3428752
<filename>ncskos/test/test_ld_functions.py """ Unit tests for ld_functions against a test URI Created on 5Oct.,2016 @author: <NAME> """ import unittest from pprint import pprint from ncskos import ld_functions # ConceptFetcher, CliValuesValidator SHOW_DEBUG_OUTPUT = False TEST_SKOS_PARAMS = { 'lang': 'pl', ...
StarcoderdataPython
3563712
from copy import deepcopy import numpy as np from rdkit import Chem from rdkit import DataStructs from rdkit.Chem.AtomPairs import Pairs from rdkit.Chem.Scaffolds import MurckoScaffold from reinvent_scoring.scoring.diversity_filters.reinvent_core.base_diversity_filter import BaseDiversityFilter from reinvent_scoring....
StarcoderdataPython
1889435
<filename>login/admin.py # -*- coding: utf-8 -*- """ Add the login module to the Django admin """ from __future__ import unicode_literals # Register your models here.
StarcoderdataPython
5008481
<filename>sudokuer.py #!/usr/bin/env python # coding: utf-8 # default background color: #300a24 # default text color: #839496 from collections import namedtuple Entry = namedtuple('Entry', 'pos val') ROWS = [range(9*i, 9*(i+1)) for i in range(9)] COLUMNS = [range(i, i+80, 9) for i in range(9)] BOXES = [] for i in r...
StarcoderdataPython
394931
<reponame>MosyMosy/ivadomed<filename>lab/pre_encoder_to_unet.py<gh_stars>0 from ivadomed.models import Unet import torch device = torch.device("cpu") model = Unet(depth=4, in_channel=1) model.decoder = torch.load('./pretrained/model_seg_rat_axon-myelin_sem.pt', map_location=torch.device(device))....
StarcoderdataPython
12803899
<gh_stars>0 # Generated by Django 3.2 on 2022-02-03 14:11 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ('customer', '0002_alter_dccustomer_email'), ] operations = [ migrations.Create...
StarcoderdataPython
5061207
<filename>blaze/mahimahi/__init__.py """ This module defines classes and methods for interacting with Mahimahi """ from .mahimahi import MahiMahiConfig
StarcoderdataPython
4809244
<reponame>krontzo/nume.py ## module goldSearch ''' a,b = bracket(f,xStart,h) Finds the brackets (a,b) of a minimum point of the user-supplied scalar function f(x). The search starts downhill from xStart with a step length h. x,fMin = search(f,a,b,tol=1.0e-6) Golden section method for de...
StarcoderdataPython
5149503
<gh_stars>0 # 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"); y...
StarcoderdataPython
5079048
#!/usr/bin/env python3 """ MiSTer SNES Controller display based on retrospy (c) 2021 <NAME> License: MIT To be honest, this script is really shitty and I just did it quick and dirty on a free afternoon to simply show inputs on my SNES compatible controller from my MiSTer FPGA. The client viewer from the suggested ap...
StarcoderdataPython
3372555
<reponame>drewilson23/xzceb-flask_eng_fr from .. import translator
StarcoderdataPython
12832518
<filename>ray/adaptdl_ray/adaptdl/utils.py # Copyright 2021 Petuum, 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...
StarcoderdataPython
11254953
<filename>tests/test_session.py<gh_stars>0 from LSP.plugin.core.protocol import WorkspaceFolder from LSP.plugin.core.sessions import create_session, Session, InitializeError, ACQUIRE_READY_LOCK_TIMEOUT from LSP.plugin.core.types import ClientConfig from LSP.plugin.core.types import Settings from test_mocks import MockC...
StarcoderdataPython
11356357
<filename>src/Interview_exp/goog/subarray_sums/AllSubstriSubArrayProbs.py '''LC3: Longest Substring Without Repeating Characters https://leetcode.com/problems/longest-substring-without-repeating-characters/ Given a string, find the length of the longest substring without repeating characters. Example 1: Input: "abcabcb...
StarcoderdataPython
6545561
<filename>func_without_wsgi_middleware.py # 素のWSGIアプリ # middlewareの作り方は以下を参照 # http://gihyo.jp/dev/feature/01/wsgi/0003 # python func_without_wsgi_middleware.py from wsgiref.simple_server import make_server def hello_app(environ, start_response): start_response('200 OK', [('Content-Type', 'text/plain')]...
StarcoderdataPython
5039569
print ("hello python") print("TPP") print ("如果我是DJ,你会爱我吗“)
StarcoderdataPython
11252371
########################################################################## # # Copyright (c) 2008, Image Engine Design Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistrib...
StarcoderdataPython
9607146
<reponame>multipaths/diffuPy<filename>src/diffupy/cli.py # -*- coding: utf-8 -*- """Command line interface for diffuPy.""" import json import logging import os import pickle import time from typing import Optional, Callable, Union import click from .constants import CSV, EMOJI, JSON, METHODS, OUTPUT, RAW, Z from .d...
StarcoderdataPython
6684787
from sqlalchemy import Column, Integer, String, ForeignKey, BigInteger, DateTime, Boolean from ..util.db import Base class Message(Base): __tablename__ = "messages" id = Column(Integer, primary_key=True) message_id = Column(BigInteger) author = Column(BigInteger) awaiting = Column(String) emo...
StarcoderdataPython
3252829
<gh_stars>0 """Contains methods and classes to collect data from Yahoo Finance API """ import pandas as pd import baostock as bs import yfinance as yf from .lxcUrl import hsDownloadData class YahooDownloader: """Provides methods for retrieving daily stock data from Yahoo Finance API Attributes -------...
StarcoderdataPython
3479057
from polygon import * import pytest def test_polygon(): abs_tol = 0.001 rel_tol = 0.001 try: p = Polygon(2, 10) assert False, ('Creating a Polygon with 2 sides: ' ' Exception expected, not received') except ValueError: pass ...
StarcoderdataPython
4991000
from progressbar import Bar, ETA, Percentage, ProgressBar, RotatingMarker import jieba import pickle from pymongo import MongoClient class SimpleVocab: def __init__(self): self.word_to_idx={} self.words=[] self.vocabulary_size=10000 self.reserved=['PAD','UNK_0','UNK_1','UNK_2','UNK_...
StarcoderdataPython
1728732
import pandas as pd import os import numpy as np def restrict_variable_to_possible_ranges(df, variable_name, possible_value_ranges, verbose=False): """ Restricts a variable to the possible ranges in the possible_value_ranges dataframe. """ variable_range = possible_value_ranges[possible_value_ranges['v...
StarcoderdataPython
8074691
import arcade from arcade.gui import * import random import math import CONST from moviepy.editor import * import pygame import time from Player import Player from Supporter import Supporter from Bullets import Bullets from ProTrump import ProTrump from Redneck import Redneck from Boss import Boss fro...
StarcoderdataPython
3407176
<reponame>hawkhai/pyinstaller from . import mod1 from .mod2 import *
StarcoderdataPython
162638
<gh_stars>0 """ Copyright 2020 <NAME> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed t...
StarcoderdataPython
8065592
from datetime import datetime from anubis.models import TheiaSession def mark_session_ended(theia_session: TheiaSession): """ Mark the database entries for the theia session as ended. :param theia_session: :return: """ theia_session.active = False theia_session.state = "Ended" th...
StarcoderdataPython
9609265
<gh_stars>1-10 import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' os.environ['AUTOGRAPH_VERBOSITY'] = '10' import tensorflow as tf tf.compat.v1.logging.info('TensorFlow') tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.ERROR) tf.compat.v1.logging.info('TensorFlow') import numpy as np import scipy.spatial.dist...
StarcoderdataPython
191176
<filename>tankmonitor.py from threading import Lock, Thread from tornado.web import Application, RequestHandler, HTTPError from tornado.httpserver import HTTPServer from tornado.template import Template from tornado.ioloop import IOLoop, PeriodicCallback from tornado.gen import coroutine from tornado.concurrent import ...
StarcoderdataPython
3491076
# <auto-generated> # This code was generated by the UnitCodeGenerator tool # # Changes to this file will be lost if the code is regenerated # </auto-generated> def to_bits(value): return value * 8000.0 def to_kilobits(value): return value * 8.0 def to_megabits(value): return value / 125.0 def to_gigabits(value):...
StarcoderdataPython
278621
<reponame>Akshat-Mantri/Rock-Paper_Scissor<filename>Rock Paper Scissor.py ######################################################################### # Importing a random library import random # getting the player Input def player_choose(): char_list = ['Stone', 'Paper', 'Scissor'] player_choice = '' ...
StarcoderdataPython
1602172
<gh_stars>0 ######importe###### #pip3 install colorama import colorama #mögliche Farben: Magenta, Green, Red, Cyan, Yellow, White, Black from colorama import init, Fore, Style init(autoreset=True) import spacy nlp=spacy.load("de") from mitsatzstrukturDEF import * ######code####### print (Fore.CYAN+"GRAMMARCHECK") pr...
StarcoderdataPython
5014810
<reponame>rit-bikeshare/backend from django.contrib import admin class BikeshareAdminSite(admin.AdminSite): index_title = site_header = 'Bikeshare administration' site_title = 'Bikeshare admin' site_url = None login_form = logout_template = logout_template = password_change_template = password_change_done_templat...
StarcoderdataPython
1988704
<filename>kitty/themes/color_setter.py from itertools import starmap def get_numbered(coolors_export): hex_values = [prop.rstrip(';').split(': ')[1][:-2] for prop in coolors_export.splitlines()] return '\n'.join(starmap('color{} {}'.format, enumerate(hex_values))) colors = '''\ --space-cadet: #24283bff; --ult...
StarcoderdataPython
3302618
import discord from discord.ext import commands from .. import __version__, __author__ class Basics(commands.Cog): def __init__(self, client): self.client = client @commands.command(help=_("calculates bot latency")) async def ping(self, ctx): latency = int(round(self.client.latency * 100...
StarcoderdataPython
4936889
from __future__ import print_function from builtins import str from past.builtins import basestring from builtins import object import socket, sys, time, uuid, json, inspect, collections from xml.sax.saxutils import escape from nltk.corpus import wordnet from xml.etree.ElementTree import Element from EHR.APIConstants...
StarcoderdataPython
247556
<filename>test/test_proto_inspect.py<gh_stars>0 # coding=utf-8 import pytest from proto_inspect import ( ProtoMessage, signed_to_uint, uint_to_signed, read_varint, write_varint, bytes_to_encode_varint, ) # suppress 'not found' linting pytest.raises = pytest.raises def test_parse_empty_message...
StarcoderdataPython
1693558
<filename>tests/sdk/queries/alerts/filters/test_alert_filter.py from datetime import datetime from time import time from tests.sdk.queries.conftest import CONTAINS from tests.sdk.queries.conftest import IN_RANGE from tests.sdk.queries.conftest import IS from tests.sdk.queries.conftest import IS_IN from tests.sdk.queri...
StarcoderdataPython
1630203
""" Exchange information. This information should be filled in when connecting to a service. Some of this should be filled from Note that the host used for job management and status updates is going to be different from that used for mapping operations within the job. *CLIENT_HOST* | "user:password@host:port/virtua...
StarcoderdataPython