id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
3299936 | # terrascript/provider/sethvargo/berglas.py
# Automatically generated by tools/makecode.py (24-Sep-2021 15:13:20 UTC)
import terrascript
class berglas(terrascript.Provider):
"""A Terraform provider for Berglas"""
__description__ = "A Terraform provider for Berglas"
__namespace__ = "sethvargo"
__name... | StarcoderdataPython |
11244617 | #
# compas_hpc_input.py
#
# This is the script that should be modified by the user to give your inputs
# to compas_hpc.py
#
# The names of the variables in this script should not be changed as they
# are expected by compas_hpc.py
#
# Once you have edited this script, run
#
# python compas_hpc.py
#
import... | StarcoderdataPython |
4923166 | from playeranalyze import get_player_data
import matplotlib.pyplot as plt
def organize_data_by_over(player_data):
player_data["over"] = player_data["over"] + (player_data["ball"] / 6)
player_data = player_data[["over", "total_runs"]]
player_data[["over", "total_runs"]] = player_data.groupby("over",as_index... | StarcoderdataPython |
6503217 | <reponame>OpenITI/oipy
"""Converter that converts HTML files from the Ghbook library
to OpenITI mARkdown.
The converter has two main functions:
* convert_file: convert a single html file.
* convert_files_in_folder: convert all html files in a given folder
Usage examples:
>>> from html_converter_Ghbook import conv... | StarcoderdataPython |
9660914 | import json
import requests
import time
from urllib import parse
from datetime import datetime
import ac_utility
from ac_constants import *
"""
# The json from Airtable is processed first in build_icandi_json, parsed then saved locally to icandi.json
# icandi.json is then loaded into get_venue_list for process... | StarcoderdataPython |
6444252 | <filename>pyannote/metrics/detection.py<gh_stars>0
#!/usr/bin/env python
# encoding: utf-8
# The MIT License (MIT)
# Copyright (c) 2012-2019 CNRS
# 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 Sof... | StarcoderdataPython |
3478257 | import schedule
import time
def two_seconds():
print('tick')
time.sleep(2)
print('tock')
schedule.every().second.do(two_seconds)
while True:
schedule.run_pending()
time.sleep(1)
| StarcoderdataPython |
127817 | <filename>mp_server/_dash/server_dash_.py
import flask
from dash import Dash
import dash_core_components as dcc
import dash_html_components as html
## NOTE: https://community.plotly.com/t/dash-exceptions-nolayoutexception-the-layout-was-none-at-the-time-that-run-server/34798/3
server = flask.Flask(__name__)
app = das... | StarcoderdataPython |
8077249 | <gh_stars>0
from beir.datasets.data_loader import GenericDataLoader
from beir.configs import dataset_stored_loc
from beir.custom_logging import setup_logger, log_map
from sentence_transformers import InputExample
from typing import List, Set
from tqdm import tqdm
import requests
import json
import os
import argparse
im... | StarcoderdataPython |
163241 | import unittest
from player import Player
class PlayerTest(unittest.TestCase):
def setUp(self):
self.player_1 = Player()
def test_when_the_players_input_its_out_of_range(self):
previous_len = len(self.player_1.choices)
self.player_1.add_choice('C4')
last_len = len(se... | StarcoderdataPython |
3464607 | <reponame>Patrick-Star125/handgesture-recognition
import cv2 as cv
import abc
import numpy as np
class Buffer:
def __init__(self, length):
self.len = length
self.q = []
self.number = 0
self.count = 0
def isempty(self):
if self.q == []:
return 1
else... | StarcoderdataPython |
1770624 | import json
from app.api.auth import views
from app.tests import mock_objects
# Test user registration passes
def test_user_registration(test_app, monkeypatch):
monkeypatch.setattr(
views, "get_user_by_email", mock_objects.get_no_user_by_email,
)
monkeypatch.setattr(views, "add_user", mock_objec... | StarcoderdataPython |
5065035 | #!/usr/bin/env python
# -*-coding:utf-8-*-
# File Name : t.py
# Description :
# Author :
# Creation Date : 2021-10-24
# Last Modified : 2021年10月24日 星期日 20时57分01秒
# Created By : lsl
def f1(s):
name = ""
num = 0
ret = {}
while s:
c = s.pop(0)
if c == ")":
retu... | StarcoderdataPython |
5166086 | import numpy as np
import pytest
import numpy.testing as npt
from pulse2percept.implants.base import ProsthesisSystem
from pulse2percept.implants.bvt import BVT24, BVT44
@pytest.mark.parametrize('x', (-100, 200))
@pytest.mark.parametrize('y', (-200, 400))
@pytest.mark.parametrize('rot', (-45, 60))
@pytest.mark.parame... | StarcoderdataPython |
9722512 | <filename>test/test_static_runtime.py
# Owner(s): ["module: unknown"]
import unittest
from typing import Dict, Optional
import numpy as np
import torch
from torch import nn
from torch.testing._internal.common_utils import TestCase, run_tests
from typing import List
class StaticModule:
def __init__(self, scripted... | StarcoderdataPython |
9674369 | import pathlib
import shutil
import click
from roo.console import console
@click.group(help="Commands to interact with the cache")
def cache():
pass
@cache.command(name="clear", help="Clear the cache completely")
def cache_clear():
cache_root_dir = pathlib.Path("~/.roo/cache").expanduser()
console().pr... | StarcoderdataPython |
3445715 | <filename>src/Knight.py
from Defense import Defense
from Projectile import Projectile
KNIGHTATTACK = ["Images/Defense/knight1/attack1.png", "Images/Defense/knight1/attack2.png", "Images/Defense/knight1/attack3.png", "Images/Defense/knight1/attack4.png", "Images/Defense/knight1/attack5.png"]
KNIGHTIDLE = ["Images/Defen... | StarcoderdataPython |
6669612 | <reponame>ntaylorwss/megatron
from . import generator
from . import dataset
from . import storage
from .generator import *
from .dataset import *
from .storage import *
| StarcoderdataPython |
1773295 | <filename>flexmeasures/data/migrations/versions/e0c2f9aff251_rename_source_id_column_in_data_sources_table.py
"""rename_source_id_column_in_data_sources_table
Revision ID: e0c2f9aff251
Revises: <PASSWORD>
Create Date: 2018-07-20 16:08:50.641000
"""
from alembic import op
import sqlalchemy as sa
# revision identifie... | StarcoderdataPython |
6576928 | import multiprocessing
results = [] #Creating a Global Variable
def calc_square(numbers, q): #child-function
global results
for i in numbers:
q.put(i*i)
print('square: ', str(i*i))
results.append(i*i)
print('inside process : '+str(results))
def main():
arr = [2,3,8,9]... | StarcoderdataPython |
11283019 | <reponame>rapidpro/ureport-partners
from dash.orgs.views import OrgPermsMixin
from smartmin.views import SmartCRUDL, SmartListView
from .models import Rule
class RuleCRUDL(SmartCRUDL):
"""
Simple CRUDL for debugging by superusers, i.e. not exposed to regular users for now
"""
model = Rule
action... | StarcoderdataPython |
3418469 | <filename>torch_glow/torch_glow/to_glow.py
import collections
import copy
from typing import List, Any
import torch
__all__ = [
"to_glow",
"to_glow_selective",
"get_submod_input_shapes",
"CompilationSpec",
"CompilationGroup",
"InputSpec",
"CompilationSpecSettings",
"FuserSettings",
... | StarcoderdataPython |
4949725 | import sys
from functools import reduce
# Eager evaluation makes this easier
lmap = lambda x, y: list(map(x, y))
lfilter = lambda x, y: list(filter(x, y))
def get_input():
with open("input", "r") as filey:
for line in filey:
yield line.strip()
def transformed_input():
return lmap(list, get_input())
... | StarcoderdataPython |
3883 | pregunta = input('trabajas desde casa? ')
if pregunta == True:
print 'Eres afortunado'
if pregunta == False:
print 'Trabajas fuera de casa'
tiempo = input('Cuantos minutos haces al trabajo: ')
if tiempo == 0:
print 'trabajas desde casa'
elif tiempo <=20:
print 'Es po... | StarcoderdataPython |
4898513 | <gh_stars>0
#!python
import random
def merge(items1, items2):
left_index, right_index = 0, 0
result = []
while left_index < len(items1) and right_index < len(items2):
if items1[left_index] < items2[right_index]:
result.append(items1[left_index])
left_index += 1
el... | StarcoderdataPython |
11386613 | <gh_stars>0
#!/usr/bin/env python
from matplotlib import pyplot as plt
import numpy as np
def read_csv(path):
with open(path) as csvf:
data = list(zip(*[[float(cell) for cell in l.split(',')] for l in csvf.readlines()[1:]]))
return data
data = read_csv("optenc_data.csv")
trips = data[0]
std = np.std(... | StarcoderdataPython |
1650508 | <reponame>clojia/DTAE
import sys
import os.path
sys.path.insert(0, os.path.abspath("./simple-dnn"))
#Import the libraries we will need.
from IPython.display import display
import tensorflow as tf
import tensorflow.contrib.slim as slim
import numpy as np
from tensorflow.examples.tutorials.mnist import input_data
import... | StarcoderdataPython |
1752555 | <filename>tensorflow/save_clusters.py
import os
import cv2
import numpy as np
def save_images(images, clusters, dst, n=10):
""" Save images labelled by cluster prediction
images - np array [b, h, w, c]
clusters - np array [b, c] (softmaxed)
dst - str, destination
n - int number of images per cluster to sear... | StarcoderdataPython |
1775388 | # coding=utf-8
import random
def randomStr(length=6, timeIn=False, lowerCaseLetter=False, capitalLetter=False, number=True, specialSign=False,
otherSignsList=None):
'''
返回一个随机字符串
:param length: 字符串长度
:param time: 是否包含时间
:param number: 是否包含数字
:param lowerCaseLetter: 是否包含小写字母
:param capitalLetter: 是否包含大写字母
... | StarcoderdataPython |
355059 | from __future__ import unicode_literals
import frappe
from frappe import msgprint
from frappe.model.document import Document
from frappe.utils import flt
import erpnext.controllers.taxes_and_totals
@frappe.whitelist(allow_guest=True)
def sales_tax_series(sales_tax,company):
query= frappe.db.sql("SELECT MAX(tax_number... | StarcoderdataPython |
3365046 | <reponame>red5alex/ifm_contrib<filename>contrib_lib/simulator.py<gh_stars>0
from ifm import Enum
from .simulator_pandas import SimPd
import pandas as pd
from datetime import datetime
import sys
class Simulator:
"""
Extension child-class for IFM contributor's Extensions.
Use this class to add functionali... | StarcoderdataPython |
6604721 | #!/usr/bin/env python
# encoding:utf-8
#
# Copyright 2015-2016 <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 app... | StarcoderdataPython |
6401381 | # Specify either 'commit' (to label the x-axis with commit sha) or 'date' (to label the x-axis with the date the test was run)
x_axis_qty = 'date'
# Plot dims in pixels
plot_height = '300'
plot_width = ''
# For grouping tests together on same axes
test_group_prefixes = ['test_C3D8R_failureEnvelope_sig11sig22',
'... | StarcoderdataPython |
3402396 | <filename>main/tutors/admin.py
from django.contrib import admin
from .models import Tutor, Invitaions, PostAnAd, AboutAndQualifications, Verify,WishList, Invitaions_by_academy
# Register your models here.
class TutorAdmin(admin.ModelAdmin):
list_display = ("username", "id","gender", "email" , "verified", "verific... | StarcoderdataPython |
4961806 | """
Should always be faithful duplicate of sequence/BioReaders.py
Duplicated here for tofu installation. This one is called via cupcake.io.BioReaders.
"""
import re, sys, pdb
from collections import namedtuple
import pysam
Interval = namedtuple('Interval', ['start', 'end'])
class Sim... | StarcoderdataPython |
3222671 | <reponame>gdmarsh/opal
from fastapi import APIRouter, Depends, WebSocket
from fastapi_websocket_pubsub import PubSubEndpoint
from opal_common.confi.confi import load_conf_if_none
from opal_common.config import opal_common_config
from opal_common.logger import logger
from opal_common.authentication.signer import JWTSig... | StarcoderdataPython |
6401604 | #!/usr/bin/env python3
# Copyright 2018 <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 a... | StarcoderdataPython |
11301735 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 26 16:06:51 2018
@author: jguillaumes
"""
import json
import elasticsearch_dsl as dsl
from weatherLib import parseLine,connect_wait_ES,WeatherData,VERSION,FW_VERSION,SW_VERSION
from elasticsearch.helpers import bulk
from datetime import date,datetim... | StarcoderdataPython |
9762937 | <reponame>XinyueZ/models
"""Downloads the UCI HIGGS Dataset and prepares train data.
The details on the dataset are in https://archive.ics.uci.edu/ml/datasets/HIGGS
It takes a while as it needs to download 2.8 GB over the network, process, then
store it into the specified location as a compressed numpy file.
Usage:
... | StarcoderdataPython |
288526 | """
Form for creating a region object
"""
import logging
from django import forms
from django.utils.translation import ugettext_lazy as _
from django.apps import apps
from gvz_api.utils import GvzRegion
from ...models import Region, Page, PageTranslation, LanguageTreeNode
from ...utils.slug_utils import generate_uniq... | StarcoderdataPython |
84286 | # Copyright 2020 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from typing import Dict, cast
from pants.engine.addresses import Address, Addresses
from pants.engine.console import Console
from pants.engine.goal import Goal, GoalSubsystem, LineOriente... | StarcoderdataPython |
3268032 | <filename>src/cobra/apps/accessgroup/migrations/0001_initial.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
from django.conf import settings
import cobra.models.fields.gzippeddict
import cobra.models.fields.bounded
class Migrat... | StarcoderdataPython |
9768217 | <gh_stars>0
import sys, os, json, urllib
from collections import OrderedDict
"""
Steamspy & steam web api scraper
By <NAME>
Last Modified: 03/10/2018
Usage:
python scraper.py -f <filename.json>
"""
def get_args():
loc = ""
for index, item in enumerate(sys.argv, start=1):
if len(sys.argv) > index and sys.a... | StarcoderdataPython |
3407617 | <reponame>Xentrics/metaGEM
#!/usr/bin/env python
"""
Based on the checkm results, approves bins according to the leves of contamination and completeness.
Copies approved bins to output directory.
@author: alneberg
"""
from __future__ import print_function
import sys
import os
import argparse
import pandas as pd
from sh... | StarcoderdataPython |
1702868 | <filename>torch_trainer.py
import os,time
import numpy as np
import torch
import torch.nn as nn
# import torch.optim as optim
from torch.autograd import Variable
from sklearn.metrics import accuracy_score, classification_report, confusion_matrix, cohen_kappa_score, f1_score
from tqdm import tqdm
from tensorboardX impo... | StarcoderdataPython |
1923528 | <filename>utils/typecheck.py
"""
This module contains function to check the type of variables.
"""
def ensure_type(name, var, *types):
"""
Checks if a variable with a name has one of the allowed types.
Arguments
---------
name: variable name
var: python object
*types: allowed ... | StarcoderdataPython |
1604933 | <filename>minibugs/middleware.py
from django.utils.encoding import force_text
from django.conf import settings
from django.template.loader import render_to_string
from django.contrib.auth import get_user
from .models import Ticket, TicketUpdate
import re
_HTML_TYPES = ('text/html', 'application/xhtml+xml')
class M... | StarcoderdataPython |
4946600 | from megnet.models import MEGNetModel
from megnet.data.graph import GaussianDistance
from megnet.data.crystal import CrystalGraph
from keras.callbacks import ModelCheckpoint
import numpy as np
import pandas as pd
import json
inputs = pd.read_pickle('./band_gap_data.pkl')
boundary = int(len(inputs)*0.75)
epochs = 5
b... | StarcoderdataPython |
6443909 | <gh_stars>10-100
from typing import Dict, Tuple
import torch
import torch.nn as nn
from torecsys.layers import BaseLayer
class FieldAwareFactorizationMachineLayer(BaseLayer):
"""
Layer class of Field-aware Factorization Machine (FFM).
Field-aware Factorization Machine is purposed by Yuchin Juan et ... | StarcoderdataPython |
4818651 | <reponame>isaac-ped/demikernel
import seaborn as sns
import pandas as pd
import argparse
import matplotlib.pyplot as plt
import os.path
import numpy as np
webserver_root = '/media/memfs/wiki/'
def plot_hist(files_list, trim_flags=False):
files = []
with open(files_list, 'r') as f:
files = np.array(f.r... | StarcoderdataPython |
12832022 | # Copyright <NAME> 2021
# Author: <NAME>
"""
Comparison of GP-interpolated X-ray and true structure functions where the GP interpolated
structure functions are computed following the introduction of gaps into lightcurves.
"""
import numpy as np
from matplotlib import pyplot as plt
from simulation_utils import load_si... | StarcoderdataPython |
6662493 | import collections
class TreeNode:
def __init__(self):
self.key = key
self.value = value
list = [] # <TreeNode> children
self.node = TreeNode
#node
for child in node.children:
print (child.key)
# BFS O(n) visit... | StarcoderdataPython |
3592503 | import torch
from torch import nn
class Swish(nn.Module):
def __init__(self, num_features):
super().__init__()
self.num_features = num_features
self.scale = nn.Parameter(torch.ones(num_features))
def forward(self, x):
return x * torch.sigmoid(self.scale * x)
def extra_rep... | StarcoderdataPython |
1656496 | """
This unit test checks SBS server API.
"""
import asyncio
import asynctest
import unittest
import unittest.mock
from unittest.mock import patch
from adsb.sbs.client import Client
from adsb.sbs.server import Server
from adsb.sbs.protocol import logger as prot_logger
from adsb.sbs.message import SBSMessage
TEST_MS... | StarcoderdataPython |
9664556 | from allauth.account.models import EmailAddress
from allauth.socialaccount.providers.base import ProviderAccount
from allauth.socialaccount.providers.oauth2.provider import OAuth2Provider
class Scope(object):
PROFILE = 'profile'
class DitSSOAccount(ProviderAccount):
def get_profile_url(self):
return... | StarcoderdataPython |
3277834 | <filename>gui_utils/training.py
import os
import torch
import torch.nn as nn
import torch.optim as optim
import shutil
import threading
from torch.utils.data import DataLoader
from PyQt5 import QtWidgets
import matplotlib.pyplot as plt
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
fro... | StarcoderdataPython |
4889763 | #
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
import os
import sys
import datetime
from pykafka import KafkaClient
import endorser_util
def getOrdererList(context):
# Get the Orderers list from the orderer container name
orderers = list()
for container in context.... | StarcoderdataPython |
9763780 | #!/usr/bin/env python
__all__ = ['tradfriStatus', 'tradfriActions']
| StarcoderdataPython |
3203262 | # Copyright 2018 German Aerospace Center (DLR)
#
# 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 agre... | StarcoderdataPython |
6459658 | <reponame>ajgates42/netrd
from .threshold import *
__all__ = []
| StarcoderdataPython |
6621257 | #!/usr/bin/env python
import rospy #importar ros para python
from sensor_msgs.msg import Image
import cv2 as cv
from cv_bridge import CvBridge
from std_msgs.msg import String, Int32 # importar mensajes de ROS tipo String y tipo Int32
from geometry_msgs.msg import Twist # importar mensajes de ROS tipo geometry / Twist
... | StarcoderdataPython |
3218745 | <reponame>bbhunter/takeover-1
#!/usr/bin/env python3
# takeover - subdomain takeover finder
# coded by M'hamed (@m4ll0k) Outaadi
import os
import json
import requests
import urllib.parse
import concurrent.futures as thread
import urllib3
import getopt
import sys
import re
r = '\033[1;31m'
g = '\033[1;32m'
y = '\033[... | StarcoderdataPython |
181608 | # -*- coding: utf-8 -*-
u"""
Created on 2017-1-25
@author: cheng.li
"""
import unittest
import copy
import pickle
import tempfile
import os
import numpy as np
import pandas as pd
from PyFin.Analysis.SeriesValues import SeriesValues
class TestSecurityValues(unittest.TestCase):
def testSecurityValuesInit(self):
... | StarcoderdataPython |
12805547 | <filename>tests/filter_integration_tests/test_filters_with_mongo_storage.py
from chatterbot.storage import MongoDatabaseAdapter
from tests.base_case import ChatBotMongoTestCase
class RepetitiveResponseFilterTestCase(ChatBotMongoTestCase):
"""
Test case for the RepetitiveResponseFilter class.
"""
def ... | StarcoderdataPython |
1830857 | <reponame>chagaz/sfan<filename>code/synthetic_data_experiments__parallel-fold.py
import synthetic_data_experiments as sde
import argparse
import logging
if __name__ == "__main__":
# TODO : use sde.get_integrous_arg_values ???
help_str = "Validation experiments on synthetic data"
parser = argparse.Argu... | StarcoderdataPython |
11205437 | <reponame>jeantardelli/wargameRepo<filename>wargame/designpatterns/pythonic_dwarfironjacket.py<gh_stars>1-10
"""pythonic_dwarfironjacket
This module represents a dwarf iron jacket object.
"""
class DwarfIronJacket:
"""Represents a piece of armor for the attack of the orcs game"""
pass
| StarcoderdataPython |
12866452 | <reponame>Chang-Liu-TAMU/Python-Cookbook-reading
# @Time: 2022/4/12 20:50
# @Author: <NAME>
# @Email: <EMAIL>
# @File:4.4.Implementing_the_iterator_protocol.py
################ clean version #########################
# class Node:
# def __init__(self, val):
# self._value = val
# self._children = []... | StarcoderdataPython |
312046 | <gh_stars>0
import tensorflow as tf
import os
import numpy as np
from box_utils import compute_target
from image_utils import random_patching, horizontal_flip
os.environ['CUDA_VISIBLE_DEVICES'] = ''
# def _extract_fn(tfrecord):
def extract_fn(augmentation, default_boxes, tfrecord):
image_feature_description = {
... | StarcoderdataPython |
47724 | MAX = 4294967295
blacklist = []
with open("inputs/day20.txt") as f:
for line in f:
line = line.strip().split('-')
blacklist.append([int(x) for x in line])
blacklist.sort()
def part1():
ip = 0
for i in range(0, len(blacklist)):
bl = blacklist[i]
if ip < bl[0]:
... | StarcoderdataPython |
9704937 | # this file is here to make the external plugins of this repo available from the pcbnew menu.
# to make these plugins available in your kicad, you'll need to have then be available here:
# ~/ubuntu/.kicad_plugins/
#in other worked ~/ubuntu/.kicad_plugins/kicad_mmccooo
# for these particular plugins, you'll need dxfgra... | StarcoderdataPython |
6223 | <reponame>marshuang80/napari
import numpy as np
class Mesh:
"""Contains meshses of shapes that will ultimately get rendered.
Attributes
----------
vertices : np.ndarray
Qx2 array of vertices of all triangles for shapes including edges and
faces
vertices_centers : np.ndarray
... | StarcoderdataPython |
1846607 | <gh_stars>0
from architecture.trainer import Trainer
trainer = Trainer()
trainer.train(500)
| StarcoderdataPython |
9628748 | <gh_stars>0
# Copyright 2014 Netflix, Inc.
#
# 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 ap... | StarcoderdataPython |
279745 | """
Pretty Errors for TiddlyWeb
This module initializes the plugin.
See tiddlywebplugins.prettyerror.exceptor for details
on operation.
"""
__version__ = '1.1.1'
import selector
from httpexceptor import HTTPExceptor, HTTP404
from tiddlywebplugins.prettyerror.exceptor import PrettyHTTPExceptor
def replacement_n... | StarcoderdataPython |
1677207 | <reponame>allena29/brewerslabng
import cgi
from cloudApi import *
#from django.utils import simplejson
import json
import urllib
from google.appengine.api import users
from google.appengine.ext import webapp
from google.appengine.ext import db
from google.appengine.ext.webapp.util import run_wsgi_app
from cloudUtils im... | StarcoderdataPython |
168684 | <reponame>Frky/moon
from django.conf.urls import url, include
from django.contrib.auth.views import login as django_login
from django.contrib.auth.views import logout as django_logout
from . import views
urlpatterns = [
url(r'^$', views.index, name="index"),
url(r'^u/(?P<label>[\w-]{,50})$', views.undergrou... | StarcoderdataPython |
1669977 | # Copyright (c) 2015 The Pycroft Authors. See the AUTHORS file.
# This file is part of the Pycroft project and licensed under the terms of
# the Apache License, Version 2.0. See the LICENSE file for details.
from itertools import chain
import re
from sqlalchemy import inspect
from ipaddr import IPv4Address
from sqlalc... | StarcoderdataPython |
217526 | """
Parsed, structurized Quake3 events
"""
from collections import (
namedtuple,
)
from datetime import (
datetime,
)
from quakestats.core.q3toql import (
entities,
)
RawEvent = namedtuple(
'RawEvent', ['time', 'name', 'payload']
)
class Q3GameEvent():
def __init__(self, ev_time: int):
a... | StarcoderdataPython |
4894027 | from flask import current_app as app
# most recent date the app has stock data downloaded. Update if we retrieve more current data.
MOST_RECENT_DATE_FOR_STOCK_PRICES = '2022-03-10'
class Stock:
def __init__(self, ticker, name, sector, price=-1):
self.ticker = ticker
self.name = name
self.... | StarcoderdataPython |
6592522 | <gh_stars>1-10
# pylint: disable=protected-access,redefined-outer-name
"""Unit tests package."""
import os
from .const import MOCK_HOST
def load_fixture(filename):
"""Load a fixture."""
path = os.path.join(os.path.dirname(__file__), "fixtures", filename)
with open(path, encoding="utf-8") as fptr:
... | StarcoderdataPython |
8055509 | from tqdm import tqdm
def run_germ(exposure=None, N=2):
''' run count scans
exposure : exposure time in secs
if not set, use previously set exposure
N : number of measurements
'''
# set frame time to 30 min
if exposure is not None:
yield from bp.mv(germ.frametime, ... | StarcoderdataPython |
8060984 | <filename>DissertationFigures.py
"""
Functions to make some of the figures I used in my dissertation
and in my ISMIR 2017 paper
"""
from BlockWindowFeatures import *
from Covers80Experiments import *
from CSMSSMTools import *
from Covers80 import *
from SongComparator import *
import scipy.io.wavfile
import librosa
de... | StarcoderdataPython |
12848369 | <gh_stars>1-10
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: parse_bpmnxml.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
fro... | StarcoderdataPython |
12835854 | # -*- coding: utf-8 -*-
"""
@Time : 2020/3/4 13:58
@Author : 半纸梁
@File : urls.py
"""
from django.urls import path
from course import views
app_name = "course"
urlpatterns = [
path("index/", views.CourseIndexView.as_view(), name="index"),
path("<int:course_id>/", views.CourseDetailView.as_view(), name=... | StarcoderdataPython |
6455399 | from typing import Any
from typing import Mapping
from typing import Optional
from fastapi import FastAPI
from glassio.dispatcher import IDispatcher
from glassio.event_bus import IEventBus
from glassio.initializable_components import InitializableComponent
from glassio.logger import ILogger
from amocrm_asterisk_ng.in... | StarcoderdataPython |
6673474 | import logging
import pprint
from dataclasses import dataclass
from typing import Any, Dict, Mapping, Optional
import satosa.context
import satosa.internal
from satosa.attribute_mapping import AttributeMapper
from satosa.micro_services.base import ResponseMicroService
from eduid_userdb import UserDB
from eduid_scima... | StarcoderdataPython |
3412693 | <gh_stars>0
#!/usr/bin/env python3
# Amount of water, milk, and coffee beans required for a cup of coffee
WATER, MILK, COFFEE = (200, 50, 15)
# Enter the available amount of water, milk, and coffee beans
water_check = int(input("Write how many ml of water the coffee machine has: "))
milk_check = int(input("Write how m... | StarcoderdataPython |
78647 | <gh_stars>0
from django.shortcuts import render, redirect
from django.contrib.auth.decorators import login_required
from .forms import UserCreationForm
from .models import CustomUser, Party
from django.contrib.auth import login
# Create your views here.
def index(request):
if request.user.is_authenticated:
... | StarcoderdataPython |
8141200 | <filename>gym_lightriders/envs/__init__.py
"""Banana Gym Enviornments."""
from gym_lightriders.envs.light_rider_env import LightRidersEnv | StarcoderdataPython |
5194533 | from sdk.color_print import c_print
from user_profiles import usr_get, usr_add, usr_compare
def migrate(tenant_sessions: list, logger: object):
'''
Accepts a list of tenant session objects.
Migrates all the User Profiles from the source tenant to the
clone tenants
'''
tenant_users_added = []
... | StarcoderdataPython |
8099175 | <filename>linkedlist/code_signal/loop-tunnel/lt-02.py
# Given integers n, l and r, find the number of ways to
# represent n as a sum of two integers A and B such that
# l ≤ A ≤ B ≤ r.
# Example
# For n = 6, l = 2, and r = 4, the output should be
# countSumOfTwoRepresentations2(n, l, r) = 2.
# There are just two ways... | StarcoderdataPython |
11287710 | <gh_stars>0
import datetime
import os
import random
import base64
from mirai import Plain, At, AtAll, Image
from mirai.models.message import FlashImage
from plugins import BaseFunction
from plugins import Clash
from plugins import Clock
from plugins import RPG
from plugins import autoReply
from plugins import baidu
f... | StarcoderdataPython |
4908931 | #EXPORT_PATH = "/Users/johantenbroeke/Sites/projects/fullscreen_3/xcodeprojects/oneonone/Resources/leveldata/"
#GAMEPROGRESS_PATH = "/Users/johantenbroeke/Sites/projects/fullscreen_3/xcodeprojects/oneonone/Resources/"
USE_BINARY_PLIST = 1
EXPORT_PATH = "../../../../Resources/leveldata/"
GAMEPROGRESS_PATH = "./testing/... | StarcoderdataPython |
45408 | <reponame>ads-ad-itcenter/qunomon.forked
import os
import sys
import shutil
import glob
from pathlib import Path
import json
import yaml
# init
QAI_USER_HOME = os.environ['QAI_USER_HOME']
inventory_dir = os.path.join(QAI_USER_HOME, 'inventory/')
# check args
args_file = os.path.join(QAI_USER_HOME, 'args', 'args.json'... | StarcoderdataPython |
11308388 | from aiohttp import ClientSession
import asyncio
import json
import random
from typing import List
import hqtrivia.config as config
"""
Abstracts the multiple question to be used in the trivia game.
"""
class Question:
"""
Represents 1 multiple question that will be used in a game round.
"""
def __... | StarcoderdataPython |
301563 | <filename>mldp/tutorials/steps/features_labels_formatter.py<gh_stars>1-10
from mldp.steps.formatters.base_formatter import BaseFormatter
import numpy as np
class FeaturesLabelsFormatter(BaseFormatter):
"""Formats batches into features and one-hot encoded labels tuple."""
def __init__(self, features_field_nam... | StarcoderdataPython |
8109294 | <gh_stars>0
import aiohttp
from sanic.log import log
HOST = '127.0.0.1'
PORT = 42101
async def local_request(method, uri, cookies=None, *args, **kwargs):
url = 'http://{host}:{port}{uri}'.format(host=HOST, port=PORT, uri=uri)
log.info(url)
async with aiohttp.ClientSession(cookies=cookies) as session:
... | StarcoderdataPython |
1978674 | '''
Created on Dec 6, 2018
'''
# System imports
import os
# Standard imports
import numpy as np
import tensorflow as tf
import keras.backend as K
from scipy import stats
# Plotting libraries
import matplotlib.pyplot as plt
# Project library imports
from modules.deltavae.deltavae_latent_spaces.deltavae_parent import... | StarcoderdataPython |
3279259 | import hmac
import hashlib
import binascii
import json
import base64
import re
import time
def base64url(utfbytes):
s = base64.b64encode(utfbytes).decode('utf-8')
s = re.sub(r'=+$', "", s)
s = re.sub(r'\+', '-', s)
s = re.sub(r'\/', '_', s)
return s
def stringify64(data):
return base64url(j... | StarcoderdataPython |
6417455 | <filename>2020_2021/DonNU CTF 2021/Coding/coding3/hamming_distance.py
import random
from lib.types import IStdin, IStdout
def hamming_distance(a, b):
counter = 0
for i in str(bin(a ^ b)):
if i == '1': counter += 1
return counter
def main(stdin: IStdin, stdout: IStdout):
stdout.write("To get... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.