id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
70734
DATA = """ { "DU1ZrX0rAncEYwLyWlwqgdEfjqA2": { "COV": { "event_code": "COV", "name": "<NAME>", "course": "FY", "registration_id": "DU1ZrX0rAncEYwLyWlwqgdEfjqA2-COV-1645969638818", "team": "", "transaction_status": "PAID", "e...
StarcoderdataPython
31213
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # <NAME>. aïvázis # orthologue # (c) 1998-2018 all rights reserved # """ Check that declarations of trivial protocols produce the expected layout """ def test(): import pyre # declare class protocol(pyre.protocol): """a trivial protocol""" #...
StarcoderdataPython
1728646
# coding=utf8 ''' Created on 17 février 2014 @author: <NAME> ''' from NaturalJoin import NaturalJoin, INNER_JOIN from PositionDAO import PositionDAO from AbstractDAO import AbstractDAO from PickupDAO import PickupDAO from system.PickupLink import PickupLink from interfacebdd.Connexion import Connexion import operator ...
StarcoderdataPython
1610541
<filename>08_pygame.py import pygame import sys pygame.init() screen = pygame.display.set_mode((256, 256)) pygame.display.set_caption('Caption') ball_tile = pygame.image.load('ball.jpg').convert() graph_rect = ball_tile.get_rect() rows = int(256 / graph_rect.height) + 1 columns = int(256 / graph_rect.width) + 1 fo...
StarcoderdataPython
189534
""" Author: <NAME> Date: October 1, 2020 Email: <EMAIL> Scope: App for Tensorflow Doggo classifier """ from fastapi import APIRouter from app.api.routes import heartbeat, prediction api_router = APIRouter() api_router.include_router(heartbeat.router, tags=["health"], prefix="/health") api_router.include_router(predict...
StarcoderdataPython
4807740
integer = int(input("Ganzzahl eingeben: ")) normalints = list(range(2, integer, 1)) normalints = [i for i in normalints if i%2 == 0] print(normalints)
StarcoderdataPython
3374694
import matplotlib.pyplot as plt import numpy as np #x_length = [70, 90, 93.1, 115, 120, 125, 130, 135, 144] #black bars #y_frequency = [1501, 936, 869, 587, 538, 488, 460, 429, 379] #measured frequency from black bars #Fill in aquired lengths and frequency for your 13 bars. x_length = [74.5, 79.2, 84.1, 86.8, 92.1...
StarcoderdataPython
3311134
<filename>src/GCN.py<gh_stars>0 import torch import torch.nn.functional as F from torch_geometric.nn import GCNConv class GCN(torch.nn.Module): ''' GCN ''' def __init__(self, num_node_features, num_classes, num_hidden_features=16): super().__init__() self.conv1 = GCNConv(num_node_fea...
StarcoderdataPython
4835008
""" MIT License Copyright (c) 2017 <NAME>. <EMAIL> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publis...
StarcoderdataPython
156096
from typing import Set, Optional, Iterable from django.urls import reverse from lazy import lazy from annotation.models import ClinVar, ClinVarVersion from classification.enums import SpecialEKeys from classification.views.classification_export_utils import ExportFormatter, AlleleGroup from library.django_utils impor...
StarcoderdataPython
111704
<gh_stars>0 #!/usr/bin/env python import unittest from day08 import Screen class TestInitializingScreen(unittest.TestCase): def test_inits_screen(self): screen = Screen(3, 5) self.assertEqual(len(screen.data), 3) self.assertEqual(len(screen.data[0]), 5) class TestParsingCommands(unitte...
StarcoderdataPython
4826538
<filename>build/lib/atesa/mbar.py import pymbar import numpy as np import matplotlib.pyplot as plt import matplotlib.colors as colors import sys import random def main(input_file,bootstrap=True,bootstrapN=0,error=[]): # Main function that calls itself recursively once with bootstrap = True to build the error estim...
StarcoderdataPython
1616843
import numpy as np from .geometry import Point, Rectangle, Circle from typing import Union import copy class Entity: def __init__(self, center: Point, heading: float, movable: bool = True, friction: float = 0): self.center = center # this is x, y self.heading = heading self.movable = movable self.color = 'gh...
StarcoderdataPython
3343193
from setuptools import setup, find_packages with open('requirements.txt', 'r') as req_file: requirements = [line[:-1] for line in req_file if len(line) > 1] setup( name='wiki_passage_retriever', version='0.1.4', author="<NAME>", author_email="<EMAIL>", description="A small tool for retrieving ...
StarcoderdataPython
3394825
<gh_stars>1-10 from .utils import * from . import models class User: endpoint = ENTRYPOINT + "/api/user" def __init__(self, target_session): self.session = target_session # Log into account. def login(self, username_or_email, password): login_data = get_dict("api-user-login") ...
StarcoderdataPython
3244507
import re from urllib import urlopen from django.template import Node, Library, Variable import feedparser register = Library() def do_images_for(parser, token): tags = re.search(r'images_for (.*) as', token.contents).group(1).split() engine = re.search(r'from (.*)', token.contents).group(1) tags = map(Va...
StarcoderdataPython
43167
<filename>pysimgame/model.py<gh_stars>0 """The model that runs with the game.""" from __future__ import annotations import json import re from functools import cached_property, singledispatchmethod from pathlib import Path from threading import Lock, Thread from types import NotImplementedType from typing import TYPE_...
StarcoderdataPython
132900
"""Constants for HTTP""" class HttpConstants: HTTP_METHOD_GET = 'GET' HTTP_METHOD_POST = 'POST' HTTP_METHOD_PUT = 'PUT' HTTP_METHOD_OPTIONS = 'OPTIONS' HTTP_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN = 'Access-Control-Allow-Origin' @staticmethod def http_method_get(): """Returns the HTT...
StarcoderdataPython
3230244
# -*- coding: utf-8 -*- """ Created on Thu Nov 14 11:30:55 2019 @author: <NAME> """ # import the necessary packages from PIL import Image import numpy as np import datetime import os import pandas as pd #%% Set the output file location run_data = datetime.datetime.now().strftime("%Y_%m_%d") result_path...
StarcoderdataPython
3275796
import argparse from . import ( download_grsec, download_linux_hardened, ) def main(): parser = argparse.ArgumentParser( description='Fetch a linux security kernel patch') choices = ['unofficial-grsec', 'linux-hardened', 'linux-hardened-anthraxx'] parser.add_argument( '-p', ...
StarcoderdataPython
1790894
<filename>beancount_balexpr/balexpr.py # BalExpr: Check balances against simple expressions combining multiple accounts in beancount. # Parts of the code adapted from the beancount project (https://github.com/beancount/beancount) import collections import re from copy import copy from decimal import Decimal from bean...
StarcoderdataPython
45688
""" Implementation of a specific learning rate scheduler for GANs. """ class DRS_LRScheduler: """ Learning rate scheduler for training GANs. Supports GAN specific LR scheduling policies, such as the linear decay policy using in SN-GAN paper as based on the original chainer implementation. However, one...
StarcoderdataPython
4814072
import os import pandas as pd from cuts import select_targets, format_output import healpy as hp import numpy as np # Defining important metrics and functions # Setting NSIDE values NSIDE = 256 NPIX = hp.nside2npix(NSIDE) # Todo: check desitarget api if there is a equivalent function inside desitarget def raDec2the...
StarcoderdataPython
1772503
import logging import azure.functions as func import os import json import pickle import sklearn from timeit import default_timer as timer def main(req: func.HttpRequest, context: func.Context) -> func.HttpResponse: logging.info('Python HTTP trigger function processed a request.') localdir = context.function_...
StarcoderdataPython
1724559
<filename>cli.py import logging logging.basicConfig(level=logging.DEBUG) logger = logging.getLogger(__name__) from ucam100 import Client from ucam100.command import * def main(): client = Client(port="/dev/ttyACM0") # client.send_command(SyncCommand()) # logger.debug(f"client.sp : {client.sp}") # lo...
StarcoderdataPython
101958
<gh_stars>0 #!/usr/bin/env python3 #-*- coding:utf-8 -*- """ Provides definition for Ring: """ import json import yaml from . import deserialize class Ring(yaml.YAMLObject): """ name : r : z : orientation: angle : BPside : fillets : """ yaml_tag = 'Ring' def __init__(se...
StarcoderdataPython
117123
try: from psutil import virtual_memory, net_if_addrs, cpu_percent, getloadavg, disk_usage except: from .mockpsutil import virtual_memory, net_if_addrs, cpu_percent, getloadavg, disk_usage import logging from enum import Enum from pprint import PrettyPrinter from sys import stdout import socket import requests ...
StarcoderdataPython
3397620
<filename>doni/common/context.py<gh_stars>0 from oslo_context import context class RequestContext(context.RequestContext): """Extends security contexts from the oslo.context library.""" def ensure_thread_contain_context(self): """Ensure threading contains context For async/periodic tasks, the...
StarcoderdataPython
30195
from flask_sqlalchemy import SQLAlchemy from flask_user import UserMixin from itsdangerous import (TimedJSONWebSignatureSerializer as Serializer, BadSignature, SignatureExpired) db = SQLAlchemy() class User(db.Model, UserMixin): __tablename__ = 'user' id = db.Column(db.Integer, prima...
StarcoderdataPython
1673682
<reponame>akathpal/ComputerVision-CMSC733 from __future__ import division import os import random import tensorflow as tf class DataLoader(object): def __init__(self, dataset_dir=None, batch_size=None, img_height=None, img_width=None, ...
StarcoderdataPython
1685269
<filename>src/config/plugins/rest_framework.py import datetime from rest_framework.pagination import PageNumberPagination ANONYMOUS_USER_ID = -1 CORS_ORIGIN_ALLOW_ALL = True # REST FRAMEWORK ~ http://www.django-rest-framework.org/ # -----------------------------------------------------------------------------------...
StarcoderdataPython
1785739
#!/usr/bin/env python3 import requests import json import pandas as pd import tweepy import os import config as cfg import time import asyncio import aiohttp from time import sleep from datetime import datetime, timedelta from pytz import timezone from bs4 import BeautifulSoup from selenium import webdriver from seleni...
StarcoderdataPython
8291
import copy import numpy as np import pybullet as p from igibson.metrics.metric_base import MetricBase class BehaviorRobotMetric(MetricBase): def __init__(self): self.initialized = False self.state_cache = {} self.next_state_cache = {} self.agent_pos = {part: [] for part in ["l...
StarcoderdataPython
3329400
<filename>src/run_locally.py<gh_stars>1-10 """ Start a simulation """ import compile_erl import clean_state from lib_run import * def main(): compile_erl.compile_all() clean_state.clear() ip_addr = get_ip_addr() args = sys.argv n_cars = string_to_int(args[1]) if len(args) == 2 else 1 # Run...
StarcoderdataPython
1639560
# -*- coding:utf-8 -*- # @author xupingmao # @since 2022/01/26 17:01:06 # @modified 2022/01/26 17:05:37 # @filename dict_test_run.py import pyximport pyximport.install() import dict_test2 dict_test2.run()
StarcoderdataPython
3324238
# This code was contributed by <NAME>, see # http://sourceforge.net/tracker/?func=detail&aid=1619889&group_id=71702&atid=532156 # pythonhdr.py module # Compatible with Python 2.3 and up, ctypes 1.0.1. """Python Application Programmer's Interface (Partial) For information on functions and types in this module refer t...
StarcoderdataPython
157146
<filename>lab9/lab9.py #!/usr/bin/env python # coding: utf-8 # In[ ]: from sklearn.datasets import load_iris import pandas as pd import numpy as np import pickle from sklearn.linear_model import Perceptron from sklearn.model_selection import train_test_split from sklearn.metrics import accuracy_score # In[ ]: ...
StarcoderdataPython
3383794
<filename>collect.py #!/usr/bin/env python # -*- coding: utf-8 -*- import os import logging import json import csv from datetime import date, datetime from hashlib import sha1 import botocore import boto3 logger = logging.getLogger('main') logger.setLevel(logging.DEBUG) ch = logging.StreamHandler() ch.setLevel(loggi...
StarcoderdataPython
1679897
<reponame>Viech/cynetworkx from nose.tools import * import cynetworkx as nx class TestReciprocity(object): # test overall reicprocity by passing whole graph def test_reciprocity_digraph(self): DG = nx.DiGraph([(1, 2), (2, 1)]) reciprocity = nx.reciprocity(DG) assert reciprocity == 1.0...
StarcoderdataPython
86483
from ecolor import slow_color, slow_print, ecolor ecolor("This is red text", "red") ecolor("This is bold blue text", "bold_blue") slow_print("This is slow_print\n", 0.025) slow_color("This is slow_print but colorful\n", "blue", 0.025) slow_color("This is slow_print but colorful and bold\n", "bold_blue", 0.025)
StarcoderdataPython
3352665
<reponame>scparedes/reading-plan-generator # python native libs from math import ceil # globals WEEKDAYS = {'SUNDAY':6, 'MONDAY':0, 'TUESDAY':1, 'WEDNESDAY':2, 'THURSDAY':3, 'FRIDAY':4, 'SATURDAY':5} START_OF_WEEK = WEEKDAYS['MONDAY'] def week_o...
StarcoderdataPython
1727021
from datetime import datetime, timedelta def create_expiration_cookie_time(): tomorrow = datetime.now() + timedelta(days=2) tomorrow = datetime.replace(tomorrow, hour=0, minute=0, second=0) expires = tomorrow.strftime("%a, %d-%b-%Y %H:%M:%S GMT") return expires
StarcoderdataPython
1667089
<reponame>NataliaNasu/cursoemvideo-python3 #leia um número e mostre seu fatorial. num = int(input('Digite um número: ')) fatorial = num print(f'{num}! = {num} x ', end='') for c in range(num-1, 0, -1): if c != 1: print(f'{c}', end=' x ') fatorial *= c else: print(f'{c}', end=' = ') ...
StarcoderdataPython
162944
<reponame>anmolmalik01/mediapipe<filename>holistic.py<gh_stars>1-10 import cv2 import mediapipe as mp import time class mediapipe: # ============================================ init ================================================= def __init__(self): # mediapipe solutions variable mp_drawing = mp.so...
StarcoderdataPython
169706
<filename>DL_training/KERAS_model/keras_inference_shape_1.py<gh_stars>1-10 from matplotlib import pyplot from scipy.misc import toimage from keras.datasets import cifar10 import cv2 import glob import os from sklearn.utils import shuffle from sklearn.model_selection import train_test_split import keras from keras.mo...
StarcoderdataPython
1712925
import urllib3 from urllib3 import HTTPResponse from b_cfn_api_v2_test.integration.infrastructure.main_stack import MainStack def test_RESOURCE_api_WITH_no_api_keys_EXPECT_request_denied() -> None: """ Tests whether the API works as expected. Without api keys request should get denied. :return: No r...
StarcoderdataPython
164638
import os import glob import random import numpy as np import torchaudio as T from torch.utils.data import Dataset, DataLoader from torch.utils.data.distributed import DistributedSampler def create_dataloader(params, train, is_distributed=False): dataset = AudioDataset(params, train) return DataLoader( ...
StarcoderdataPython
1712794
<reponame>skinfiter/task_manger<gh_stars>0 from __future__ import unicode_literals from django.apps import AppConfig class FaultRecordConfig(AppConfig): name = 'fault_record'
StarcoderdataPython
1745320
# -*- coding: utf-8 -*- """ import os os.environ['STALKER_PATH'] = '/mnt/NAS/Users/eoyilmaz/Stalker_Projects' from anima.ui import SET_PYSIDE2 SET_PYSIDE2() from anima.ui import project_manager project_manager.ui_caller(None, None, project_manager.MainWindow) """ from anima.ui.base import ui_caller from anima.ui.lib...
StarcoderdataPython
3294123
from django.contrib import admin # Register your models here. from .models import UserModel admin.site.register(UserModel)
StarcoderdataPython
62602
<gh_stars>1-10 #!/usr/bin/env python import time import rospy import sys import signal import math import tf from geometry_msgs.msg import Twist pub = None def handle_cmd(msg): cmd_vel = Twist() cmd_vel.linear.x = msg.linear.x cmd_vel.angular.z = -msg.angular.z pub.publish(cmd_vel) if __name__ == '_...
StarcoderdataPython
1683569
<filename>giswork/extract_polylines.py import zipfile import os import json import csv of = zipfile.ZipFile("polylines.zip", "w", allowZip64=True, compression=zipfile.ZIP_DEFLATED) zf = zipfile.ZipFile("routes.zip") allroutes = zf.namelist() for i in allroutes: if not ".json" in i: continue zf.read(i) ...
StarcoderdataPython
63291
<gh_stars>0 from tools.general import load_input sum_any = 0 sum_all = 0 for group in load_input("day6.txt").split("\n\n"): members = [set(i) for i in group.split('\n')] sum_any += len(set.union(*members)) sum_all += len(set.intersection(*members)) print(f"Part 1 => {sum_any}") print(f"Part 2 => {sum_al...
StarcoderdataPython
3385139
<filename>webadmin/src/WebChilds/UploadText.py # -*- coding: utf-8 -*- from os import chmod, close, rename, statvfs, unlink, write from os.path import basename, isdir, isfile, join, realpath from tempfile import mkstemp from twisted.web import resource, http class UploadTextResource(resource.Resource): default_upload...
StarcoderdataPython
3304105
<reponame>phil65/PrettyQt<gh_stars>1-10 from __future__ import annotations from prettyqt import core from prettyqt.qt import QtCore from prettyqt.utils import bidict SYSTEM = bidict( gregorian=QtCore.QCalendar.System.Gregorian, julian=QtCore.QCalendar.System.Julian, milankovic=QtCore.QCalendar.System.Mil...
StarcoderdataPython
179004
<reponame>Gaurav-Pande/DataStructures<filename>leetcode/stack_and_queues/stack_usng_queue.py # Author: <NAME> # implement stack using queue # link: https://leetcode.com/problems/implement-stack-using-queues/description/ class MyStack(object): def __init__(self): """ Initialize your data structure...
StarcoderdataPython
1619815
<filename>external/ORB_SLAM2/compute_poses.py from subprocess import call import pickle import numpy as np import os def compute_poses_orb(sequence, calib_params, save_path, data_path, model_path, vocab_path): if not os.path.exists(save_path): os.makedirs(save_path) template_file = open(model_path + ...
StarcoderdataPython
1691899
# # svm_k_and_g.py # # Visualize the margin created by a Support Vector Machine (SVM) # with different kernels. Also take a look at the effect of the # parameter gamma. # # Support Vector Machines (svm) are also called "Large Margin # Classifers" as they try to find the decision boundary with # the largest ...
StarcoderdataPython
3345329
<gh_stars>1-10 """Compare feature importances for disease and panel vs clinvar""" rule prep_varimpact: input: i = DATA + 'interim/full/panel.dat' output: x = DATA + 'interim/varimpact_pre/panel.{disease}.x', y = DATA + 'interim/varimpact_pre/panel.{disease}.y' run: df = pd.read_csv(inp...
StarcoderdataPython
1600088
import urllib3 import certifi import os from lxml import etree as et from math import ceil from time import sleep from hashlib import sha256 from functools import lru_cache import datetime import logging from typing import Iterable from sqlalchemy.exc import OperationalError from eurlex2lexparency.celex_manager.celex...
StarcoderdataPython
1794954
<reponame>adrian-kalinin/django_crm from django.shortcuts import reverse from django.views import generic from django.contrib.auth.mixins import LoginRequiredMixin from agents.mixins import OrganiserAndLoginRequiredMixin from .models import Lead, Category, Agent from .forms import ( LeadModelForm, CustomUserCreat...
StarcoderdataPython
4811597
from manim import * from tests.helpers.graphical_units import set_test_scene # Note: DO NOT COMMIT THIS FILE. The purpose of this template is to produce control data for graphical_units_data. As # soon as the test data is produced, please revert all changes you made to this file, so this template file will be # still ...
StarcoderdataPython
3209842
<reponame>flyteorg/flytesnacks """ .. _core-extend-flyte-container-interface: Container Interface ------------------- Flyte typically interacts with containers in the course of its task execution (since most tasks are container tasks). This is what that process looks like: #. At compilation time for a container task,...
StarcoderdataPython
1710321
import logging import os import sqlite3 from flask import Flask, request , jsonify from flask_sqlalchemy import SQLAlchemy from flask_migrate import Migrate from config import Config from werkzeug.debug import DebuggedApplication from flask_marshmallow import Marshmallow from flask_cors import CORS import json from sql...
StarcoderdataPython
62395
<filename>book/scripts/chapter0/part3.py #%%[markdown] # # Dont trust machine learning blindly # %% # %%
StarcoderdataPython
1684059
# Copyright (c) Microsoft Corporation and Fairlearn contributors. # Licensed under the MIT License. import sklearn.metrics as skm from sklearn import preprocessing from ._extra_metrics import (_balanced_root_mean_squared_error, _mean_overprediction, _mean_unde...
StarcoderdataPython
1714931
import pendulum from app.api.business.agreement_business import get_current_agreement from tests.app.helpers import BaseApplicationTest class TestCurrentAgreement(BaseApplicationTest): def setup(self): super(TestCurrentAgreement, self).setup() def test_current_agreement_is_in_the_present(self, maste...
StarcoderdataPython
1746923
# -- encoding: UTF-8 -- import click import logging from spo.tools.playlist_gen import generate_playlist from spo.tools.spotify_albums_to_tracks import spotify_albums_to_tracks from spo.tools.spotify_search import spotify_search_albums, spotify_search_tracks from spo.tools.spotify_playlists_to_tracks import spotify_pl...
StarcoderdataPython
127772
<gh_stars>0 import numpy as np import pytest from metod_alg import objective_functions as mt_obj def test_function_parameters_sog(): """ Testing functionality of slices used in mt_obj.function_parameters_sog() and comparing results by using for loop. Have not used for loop in mt_obj.function_paramete...
StarcoderdataPython
22251
# -*- coding: utf-8 -*- # Citations from flask import (Blueprint, request, render_template, flash, url_for, redirect, session) from flask.ext.login import login_required, current_user import logging, sys, re from sqlalchemy.exc import IntegrityError, InvalidRequestError from DictionaryOfNewZealandE...
StarcoderdataPython
4810639
<gh_stars>0 # -*- coding: utf-8 -*- # Generated by Django 1.11.4 on 2017-11-02 15:35 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('ProjectSurveillance', '0002_projectd...
StarcoderdataPython
4835750
# Licensed to the StackStorm, Inc ('StackStorm') 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 use th...
StarcoderdataPython
4834983
<filename>tests/unit/hca/test_updater.py import unittest from mock import MagicMock, call from hca.submission import HcaSubmission from hca.updater import HcaUpdater from tests.unit.utils import random_id, random_uuid, make_ingest_entity class TestHcaUpdater(unittest.TestCase): def setUp(self) -> None: s...
StarcoderdataPython
3373391
from unittest import TestCase from unittest.mock import patch, PropertyMock, MagicMock from basketball_reference_web_scraper.html import PlayByPlayRow class TestPlayByPlayRow(TestCase): @patch.object(PlayByPlayRow, 'home_team_play_description', new_callable=PropertyMock) def test_is_home_team_play_when_home_...
StarcoderdataPython
3242288
<reponame>RosettaCommons/jade2<filename>jade2/basic/sequence/SequenceInfo.py #<NAME> class SequenceInfo: """ Simple class for holding + accessing sequence metadata Original class for sequence info. Basically deprecated by SequenceStats and PDBConsensusInfo. """ def __init__(self): self.s...
StarcoderdataPython
147233
from distutils.core import setup, Extension import Cython from Cython.Build import cythonize import numpy setup( ext_modules=cythonize("special_partition.pyx"), include_dirs=[numpy.get_include()] ) """ Build instructions: ------------------ > cd special_partition > python setup.py build_ext --inplace """
StarcoderdataPython
3399572
# coding: utf-8 """ Unittests module on loss and grad functions.""" # Authors: <NAME> <<EMAIL>> # License: new BSD import numpy as np import matplotlib.pyplot as plt from scipy.optimize import approx_fprime from carpet.checks import check_tensor from pyta.loss_and_grad import _obj_t_analysis, _grad_t_analysis from pyt...
StarcoderdataPython
1627069
import pytz from app.models import User from flask_login import current_user from flask_wtf import FlaskForm from wtforms import PasswordField, SelectField, StringField, TimeField from wtforms.validators import Email, EqualTo, InputRequired, Length, ValidationError class AccountForm(FlaskForm): tz_tuples = [] ...
StarcoderdataPython
28393
from repacolors import ColorScale from .colorbrewer import PALETTES as CBPALETTES PALETTES = { "ryb": ["#fe2713", "#fd5307", "#fb9900", "#fabc00", "#fefe34", "#d1e92c", "#66b032", "#0492ce", "#0347fe", "#3e01a4", "#8600af", "#a7194b"], "rybw3": ["#FE2712", "#FC600A", "#FB9902", "#FCCC1A", "#FEFE33", "#B2D732"...
StarcoderdataPython
1772056
import time import copy import warnings import itertools import numpy as np import pandas as pd from tqdm import tqdm from boruta import BorutaPy from shap import TreeExplainer from sklearn.tree import DecisionTreeClassifier from sklearn.tree import DecisionTreeRegressor from sklearn.ensemble import RandomForestClassif...
StarcoderdataPython
1728386
<filename>tests/test_travis.py<gh_stars>0 def test_travis(): assert(True)
StarcoderdataPython
1723798
from .ucomm_server import UCommServer, UCommServerHandler, ResultForwardingClient, ResultForwardingClientBase
StarcoderdataPython
37773
from db_connection import DbConnection import random def load(): db_conn = DbConnection('profiles') db_conn.execute("drop table if exists profiles") db_conn.execute("create table profiles (id integer PRIMARY KEY, name text not null, skillset text not null, connection_weight integer not null)") names_for_prof...
StarcoderdataPython
59602
# 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
43116
<gh_stars>0 # Задание 9. Вариант 26 # Создайте игру, в которой компьютер выбирает какое-либо слово, а игрок должен его отгадать. Компьютер сообщает игроку, сколько букв в слове, и дает пять попыток узнать, есть ли какая-либо буква в слове, причем программа может отвечать только "Да" и "Нет". Вслед за тем игрок должен п...
StarcoderdataPython
1723358
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from menu import * try: Menu.getMenu() except KeyboardInterrupt: print('\nScript closed!!') sys.exit()
StarcoderdataPython
134366
import os for i in range(0,1): # randomly generate flag and lambda expression os.system("python3 compiler.py > expr.h") # create directory dir_name = "chall%u" % i os.mkdir(dir_name) # generate binary and move it to directory os.system("gcc -Wall -s main.c -o lambda") os.system("rm expr.h") os.system("python3...
StarcoderdataPython
140181
<reponame>skilo83/MOCAM-720-01-Custom-setup-tool<gh_stars>1-10 # MOCAM 720-01 Custom setup tool v1.0 import sys import socket def subCypher(ssid, passwd): #The wifi credentials must be encoded with this cypher or the camera will reject them #as of version 1.0 this list is incomplete and does not yet co...
StarcoderdataPython
1631979
#!/usr/bin/python import os import sys import binascii import grpc from lndlibs import rpc_pb2 as ln from lndlibs import rpc_pb2_grpc as lnrpc from pathlib2 import Path print("This is the legacy - Python2 only - version.") if sys.version_info > (3, 0): print("Can't run on Python3") sys.exit() # display config...
StarcoderdataPython
94701
"""This file is used in setting the feature of datetime.""" # import relation package. from datetime import datetime class DatetimeSetting: """This class is used in setting the feature of datetime.""" def __init__(self): """Initial some variable""" self.time_now = datetime.now() def cur...
StarcoderdataPython
3378
# encoding: utf-8 """ @version: v1.0 @author: Richard @license: Apache Licence @contact: <EMAIL> @site: @software: PyCharm @time: 2019/9/12 20:37 """ from pprint import pprint as pp from operator import itemgetter import time from collections import OrderedDict from hard.smallest_range.srcs.big_2d_list impo...
StarcoderdataPython
3359343
<reponame>maximsmol/ray<gh_stars>0 # -*- coding: UTF-8 -*- """Module to interact between java and python """ import msgpack import ray class GatewayClient: """GatewayClient is used to interact with `PythonGateway` java actor""" _PYTHON_GATEWAY_CLASSNAME = \ b"io.ray.streaming.runtime.python.PythonGa...
StarcoderdataPython
3221123
<reponame>reevespaul/firebird-qa<filename>tests/bugs/core_1040_test.py #coding:utf-8 # # id: bugs.core_1040 # title: Wrong single-segment ascending index on character field with NULL and empty string values # decription: Wrong single-segment ascending index on character field with NULL and empty stri...
StarcoderdataPython
1788171
<reponame>chhsiao90/gviewer<filename>gviewer/tests/test_controller.py import unittest import mock from gviewer.controller import Controller class TestController(unittest.TestCase): def setUp(self): self.parent = mock.Mock() self.controller = Controller(self.parent) def test_open_view(self): ...
StarcoderdataPython
3281976
""" Binary Cross Entropy w/ a few extras Hacked together by / Copyright 2021 <NAME> """ from typing import Optional import torch import torch.nn as nn import torch.nn.functional as F class BinaryCrossEntropy(nn.Module): """ BCE with optional one-hot from dense targets, label smoothing, thresholding NOTE for...
StarcoderdataPython
3217082
import torch import torch.nn as nn _input_size = 3 _seq_len = 2 _batch = 2 _hidden_size = 5 _num_layers = 2 # model class net_RNN(nn.Module): def __init__(self): super().__init__() self.op = nn.RNN(_input_size, _hidden_size, _num_layers, bidirectional=True) def forward(self, inputs): ...
StarcoderdataPython
1693766
#!/usr/bin/python3 import re import requests import sys from lxml import html domain = sys.argv[1] filetype = sys.argv[2] start = 0 results = [] totalFiles = 0 def google_dork(): global domain global filetype global start global results global totalFiles regex = re.compile(r'(?P<urls>http\...
StarcoderdataPython
1779595
<reponame>AH-SALAH/CS50X import os from cs50 import SQL from flask import Flask from werkzeug.exceptions import default_exceptions, HTTPException, InternalServerError from helpers import apology from settings import Settings from routes.routes import Routes # Configure application app = Flask(__name__) settings = S...
StarcoderdataPython
3207634
<gh_stars>0 # from flask import Flask, render_template # from flask_mqtt import Mqtt # import ssl # import urllib.request as request # from swinder.utils.constants import * # app = Flask(__name__) # app.config["MQTT_BROKER_URL"] = ENDPOINT # app.config["MQTT_BROKER_PORT"] = PORT # app.config["MQTT_CLIENT_ID"] ...
StarcoderdataPython
3268719
<reponame>dancan-sandys/News-api import unittest from ..app.models import NewsArticle class TestArticles(unittest.TestCase): def setUp(self): self.new_articles = NewsArticle('Dancan','leon','Sandys','27/12/1999', 'Yesterday') def test_initialize(self): self.new_articles ...
StarcoderdataPython