id stringlengths 2 8 | text stringlengths 16 264k | dataset_id stringclasses 1
value |
|---|---|---|
24180 | import copy
import logging
import warnings
from kolibri.plugins.registry import registered_plugins
logger = logging.getLogger(__name__)
def __validate_config_option(
section, name, base_config_spec, plugin_specs, module_path
):
# Raise an error if someone tries to overwrite a base option
# except for th... | StarcoderdataPython |
9778707 | #! /usr/bin/python
FontSize=20
Color="Black"
LineWeight=3
svgWidth=400
svgHeight=400
def svgHeader():
textout = '<svg xmlns="http://www.w3.org/2000/svg" version="1.1"'
textout += ' width="' + str(svgWidth)
textout += '" height="' +str(svgHeight)
textout += '">\n'
return textout
def svgFooter():
return '</svg>... | StarcoderdataPython |
1745672 | <gh_stars>0
#!/usr/bin/env python3
class Animal:
name = ""
category = ""
def __init__(self, name):
self.name = name
def set_category(self, category):
self.category = category
class Turtle(Animal):
category = "reptile"
class Snake(Animal):
category = "reptile"
class Zoo:
... | StarcoderdataPython |
8092893 | <reponame>knrdk/SoccerPlayersCrawler
import codecs
class CsvWriter:
def __init__(self, fileName):
self.fileName = fileName
self.separator = ","
def __enter__(self):
self.file = codecs.open(self.fileName, 'w', 'utf-8')
return self
def add(self, *args):
row = self.se... | StarcoderdataPython |
8043391 | <reponame>seberg/scipy
"""sparsetools - a collection of routines for sparse matrix operations
"""
from csr import *
from csc import *
from coo import *
from dia import *
from bsr import *
from csgraph import *
| StarcoderdataPython |
8163780 | # https://www.codewars.com/kata/554b4ac871d6813a03000035/train/python
# In this little assignment you are given a string of space separated numbers,
# and have to return the highest and lowest number.
def highAndLow(numbers):
arr = numbers.split()
lowest = int(arr[0])
highest = int(arr[0])
if len(arr)... | StarcoderdataPython |
11225645 | <gh_stars>100-1000
import pytest
import logbook
from logbook.utils import (
logged_if_slow, deprecated, forget_deprecation_locations,
suppressed_deprecations, log_deprecation_message)
from time import sleep
_THRESHOLD = 0.1
try:
from unittest.mock import Mock, call
except ImportError:
from mock impor... | StarcoderdataPython |
1649472 | #!/usr/bin/env python3
import math
def split_float(x):
xf, xi = math.modf(float(x))
return int(xi), xf
if __name__ == "__main__":
import sys
for line in sys.stdin:
xy = line.strip().split(' ')
x = split_float(xy[0])
y = split_float(xy[1])
print('{0[0]} {1[0]} {0[1]} ... | StarcoderdataPython |
1674053 | # Copyright The PyTorch Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | StarcoderdataPython |
9619276 | from __future__ import unicode_literals
import unittest
import io
import jshlib
class TestLoadJsh(unittest.TestCase):
def test_nums(self):
s = "42 31 2.343"
result = list(jshlib.load_json_iter(s))
expected = [42, 31, 2.343]
assert expected == result
def test_strs(self):
... | StarcoderdataPython |
5023210 | """
Definition of TreeNode:
class TreeNode:
def __init__(self, val):
self.val = val
self.left, self.right = None, None
"""
class Solution:
"""
@param root: the root of the tree
@return: the total sum of all root-to-leaf numbers
"""
def sumNumbers(self, root):
# write you... | StarcoderdataPython |
12825141 | from model.storage import *
from model.disk import *
from model.blueprint import *
from utils.dbconn import *
import os
from pkg.azure import sas
from asyncio.subprocess import PIPE, STDOUT
import asyncio
from pathlib import Path
from utils.logger import *
async def download_worker(osdisk_raw,project,host):
con ... | StarcoderdataPython |
8073422 | import fasttext
import pandas as pd
model = fasttext.load_model("tuned-30h.bin")
print("model is loaded")
df = pd.read_csv("data/allrepos_processed_textonly.csv")
df['title_processed'] = df['title_processed'].astype(str)
df['body_processed']= df['body_processed'].astype(str)
df['txt'] = df['title_processed'] + " " +... | StarcoderdataPython |
315758 | from .pyDoodle2Web import PyDoodle2Web | StarcoderdataPython |
1801382 | import logging
from datetime import timedelta
from typing import List
from sqlalchemy.sql import and_, func
from couchers.db import session_scope
from couchers.models import (
Notification,
NotificationDelivery,
NotificationDeliveryType,
NotificationPreference,
NotificationTopicAction,
User,
)... | StarcoderdataPython |
3541683 | /usr/lib/python3.8/random.py | StarcoderdataPython |
8146283 | from django.conf import settings
from django.urls import include, path
from django.conf.urls.static import static
from django.contrib import admin
import django_cas_ng.views as cas_views
urlpatterns = [
path('service/', include("app.urls")),
path('accounts/login/', cas_views.LoginView.as_view(), name='cas_ng_l... | StarcoderdataPython |
8169835 | <gh_stars>0
import torch.nn as nn
from mmcv.cnn import ConvModule
class DepthwiseSeparableConvModule(nn.Module):
"""Depthwise separable convolution module.
See https://arxiv.org/pdf/1704.04861.pdf for details.
This module can replace a ConvModule with the conv block replaced by two
conv block: depth... | StarcoderdataPython |
3264430 | <filename>edkrepo/common/workspace_maintenance/workspace_maintenance.py
#!/usr/bin/env python3
#
## @file
# workspace_maintenance.py
#
# Copyright (c) 2017- 2020, Intel Corporation. All rights reserved.<BR>
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
''' Contains shared workspace maintenance functions. '... | StarcoderdataPython |
5069240 | '''
update on GameBoard, specialized for shame and obedience element
'''
from ShameAndObedienceElement import *
from math import sqrt
# assignElementsToRegion needs to go from False -> "assignMode"
# add variable to this method : assign_elements_to_region
class GameBoard:
"""
description:
-
arguments... | StarcoderdataPython |
11396838 | from flask import Flask, render_template, request, send_file
from flask_uploads import UploadSet, configure_uploads, IMAGES
import images as image_mgr
app = Flask(__name__)
photos = UploadSet('photos', IMAGES)
app.config['UPLOADED_PHOTOS_DEST'] = 'original_images'
configure_uploads(app, photos)
@app.route('/upload'... | StarcoderdataPython |
294297 | """
"""
# Enter your code here. Read input from STDIN. Print output to STDOUT
for _ in range(int(raw_input())):
n = int(raw_input())
print str(bin(n))[2:]
| StarcoderdataPython |
12848200 | <reponame>wangleon/gamse
import os
import re
import sys
import shutil
import logging
logger = logging.getLogger(__name__)
import configparser
import numpy as np
import astropy.io.fits as fits
import matplotlib.pyplot as plt
import matplotlib.ticker as tck
from ..utils.obslog import read_obslog
from ..utils.misc imp... | StarcoderdataPython |
3493453 | """
Test module.
Tests the whole system as a black box.
"""
import os
import io, shutil
from six.moves import getcwd
import pytest
from chatette.parsing.parser import Parser
from chatette.units.ast import AST
from chatette.generator import Generator
from chatette.adapters import RasaAdapter, JsonListAdapter
class ... | StarcoderdataPython |
4902969 | # coding=utf-8
import logging
import sys
import unittest
import matplotlib.pyplot as plt
import numpy as np
from ybckit.mpl import init as mpl_init
from . import ybc_env
logger = logging.getLogger()
logger.level = logging.DEBUG
logger.addHandler(logging.StreamHandler(sys.stdout))
class MplTestCase(unittest.TestCas... | StarcoderdataPython |
12330 | import pytest
from pypospack.potential import EamPotential
symbols = ['Al']
func_pair_name = "bornmayer"
func_density_name = "eam_dens_exp"
func_embedding_name = "fs"
expected_parameter_names_pair_potential = []
expected_parameter_names_density_function = []
expected_parameter_names_embedding_function = []
expected_... | StarcoderdataPython |
1645716 | <reponame>FilipDimi/restaurant-website<gh_stars>0
from django.contrib import admin
from core.models import Ingredient, MealCategory, Side, Meal, Special, BeverageCategory, Beverage, Soup, Dessert
admin.site.register(Ingredient)
admin.site.register(MealCategory)
admin.site.register(Side)
admin.site.register(Meal)
admin... | StarcoderdataPython |
3317788 | import pandas as pd
import os
from os.path import join
import sys
import time
from itertools import chain
sys.path.insert(1, '/home/nlp/ernstor1/rouge/SummEval_referenceSubsets/code_score_extraction')
import calculateRouge
import numpy as np
import glob
# from DataGenSalientIU_DUC_maxROUGE import greedy_selec... | StarcoderdataPython |
8129297 | <reponame>StalingradTeam/E-9.11-Event-manager<filename>config.py<gh_stars>0
import os
class Config:
SQLALCHEMY_DATABASE_URI = os.getenv('DATABASE_URL', 'sqlite:///temp.db')
SQLALCHEMY_TRACK_MODIFICATIONS = False
SECRET_KEY=os.environ.get('SECRET_KEY', 'very_secret_key')
TIMEZONE='UTC' | StarcoderdataPython |
9775296 | # this is __inti__.py | StarcoderdataPython |
9724072 | <filename>LabSessionsSol/TP91_superviseur_fils_Q2_v3.py
# encoding: UTF-8
import random, time, sys, numpy, os, mmap, posix_ipc, traceback, signal
# version complete Q2
pid = []
# modif du comportement de signal
def arret(signal, frame):
global pid
# on tue les fils créés
try:
pids = 0
wh... | StarcoderdataPython |
1602625 | from rest_framework import viewsets, generics, pagination, filters
from django_filters.rest_framework import DjangoFilterBackend
from rest_framework.response import Response
import django_filters
from .models import *
from .serializers import *
from .api_filters import *
from django_filters.rest_framework import Filter... | StarcoderdataPython |
8154081 | from flask import Blueprint, jsonify, request
from skynet.roku.models import RokuModel
from skynet.roku.forms import RokuKeypressForm, RokuLaunchForm
roku = Blueprint('roku', __name__, url_prefix='/roku')
@roku.route('/keypress')
def keypress():
form_data = RokuKeypressForm(request.args)
if not form_data.v... | StarcoderdataPython |
1771747 | #
# Copyright 2019 - <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 to in writing, ... | StarcoderdataPython |
1965648 | <filename>floodsystem/analysis.py<gh_stars>0
from matplotlib.dates import date2num
import numpy as np
from datetime import datetime
def polyfit(dates, levels, p):
"""Calculate the polynomial of order p that passes through the data points
Returns a poly1d object, and the time axis offset"""
date_nums = date... | StarcoderdataPython |
8154736 | <reponame>kodebach/libelektra
class ElektraPlugin(object):
def __init__(self):
self.x = 1
def open(self, config, errorKey):
print("[CLASS-PYTHON-2] open -->")
self.x = self.x + 1
return 1
def get(self, returned, parentKey):
print("[CLASS-PYTHON-2] get")
return 1
def set(self, returned, parentKey):
... | StarcoderdataPython |
6541620 | #! -*- encoding:utf-8 -*-
"""
@File : Baselines.py
@Author : <NAME>
@Contact : <EMAIL>
@Dscpt :
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
from transformers import AlbertModel, AlbertPreTrainedModel, BertPreTrainedModel, BertModel
class AlbertBaseline(AlbertPreTrainedModel):... | StarcoderdataPython |
9783566 | from django.contrib import admin
from products.models import Products
admin.site.register(Products)
# Register your models here.
| StarcoderdataPython |
11318177 | <reponame>Lonewolf-Information-systems/owtf
import os
import shutil
import subprocess
# FIXME: Do not remove user's results. Need OWTF to fix its custom profiles
# options.
DIR_SCRIPTS = 'owtf/scripts'
DB_SETUP_SCRIPT = 'owtf/db_setup.sh'
DIR_OWTF_REVIEW = 'owtf_review'
def db_setup(cmd):
"""Reset OWTF database... | StarcoderdataPython |
5109936 | import json
import matplotlib.pyplot as plt
import numpy as np
def load_json_arr(json_path):
lines = []
with open(json_path, 'r') as f:
for line in f:
lines.append(json.loads(line))
return lines
# # # # Configurations # # #
color_base = 'black'
color_APsml = 'tab:orange'
color_AP = 'ta... | StarcoderdataPython |
6613277 | <gh_stars>0
#!/usr/bin/env python
# from __future__ import print_function
import code
import readline
# context provides the slurm module
# from context import slurm
import modu.slurm as slurm
import modu.color_printer as cp
print("----------------------------------------------------------------------")
cp.printWarn... | StarcoderdataPython |
3213356 | <filename>sphinx_yaml_config/__init__.py
"""A small sphinx extension to let you configure a site with YAML metadata."""
from pathlib import Path
__version__ = "0.0.1dev0"
from yaml import safe_load
def add_yaml_config(app, config):
"""Load all of the key/vals in a config file into the HTML page context"""
pa... | StarcoderdataPython |
11277629 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
from django.utils.encoding import force_text
from django.core import serializers
def old_to_new_questions(apps, schema_editor):
Question = apps.get_model('editor', 'Question')
NewQuestion = apps.get_model('editor'... | StarcoderdataPython |
5090625 | <filename>altapay/invoice.py
from __future__ import absolute_import, unicode_literals
from altapay.payment import Payment
class Invoice(Payment):
def create(self, terminal, shop_orderid, amount, currency, **kwargs):
"""
Create a invoice reservation request.
:arg terminal: name of the tar... | StarcoderdataPython |
1767701 | <reponame>pimpale/BQuest-Backend
from rest_framework import serializers
from drf_writable_nested import WritableNestedModelSerializer
from django.contrib.auth.models import User, Group
from users.models import Profile, Mentor
from .models import Request
from users.serializers import ProfileSerializer, MentorSerializer... | StarcoderdataPython |
4872447 | """site1 URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based v... | StarcoderdataPython |
5191716 | <filename>user/views.py
import hashlib
from django.shortcuts import redirect, render
from user.util import quiet_logout
from .models import User
# Create your views here.
def signup(request):
return render(request, 'user/login.html', {})
def login(request):
return render(request, 'user/login.html', {})
... | StarcoderdataPython |
84709 | from MDRSREID.Loss_Meter import Loss
import torch.nn as nn
import torch
from MDRSREID.utils.meter import RecentAverageMeter as Meter
class IDLoss(Loss):
def __init__(self, cfg, tb_writer=None):
super(IDLoss, self).__init__(cfg, tb_writer=tb_writer)
self.criterion = nn.CrossEntropyLoss(reduction='n... | StarcoderdataPython |
6586241 | #import all the modules
from tkinter import *
import sqlite3
import tkinter.messagebox
conn = sqlite3.connect("D:\Store Management System\Database\store.db")
c = conn.cursor()
result = c.execute("SELECT Max(id) from inventory")
for r in result:
id = r[0]
class Database:
def __init__(self, master, *a... | StarcoderdataPython |
141332 | from pygments.lexers.rdf import SparqlLexer
from pygments.token import Other
class SparqlLexerMagics( SparqlLexer ):
"""
A variant of the standard SPARQL Pygments lexer that understands
line magics
"""
#print( "I'm the custom converter")
aliases = [ 'sparql-nb', 'sparql' ]
name = 'SPARQL ... | StarcoderdataPython |
11315665 | <gh_stars>0
####################
# ES-DOC CIM Questionnaire
# Copyright (c) 2017 ES-DOC. All rights reserved.
#
# University of Colorado, Boulder
# http://cires.colorado.edu/
#
# This project is distributed according to the terms of the MIT license [http://www.opensource.org/licenses/MIT].
###################... | StarcoderdataPython |
118889 | ##Generate patches from a large raster##
"""preprocessing model for creating a non-overlapping sliding window of fixed size to generate tfrecords for model training"""
import rasterio
import tensorflow as tf
import numpy as np
def extract_patches(image, width, height):
# The size of sliding window
ksizes = [1... | StarcoderdataPython |
3308118 | <reponame>Charly98cma/Boredom-Factory
from sys import stderr as STDERR
from random import choice as rndCh
from string import ascii_letters as letters
from os import path
from lib import err_msgs as err
def print_result(text: str, out_method: int) -> None:
"""Print the text after applying the operation specified ... | StarcoderdataPython |
5101865 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Oct 2 11:18:20 2021
@author: h2jw
"""
import pandas as pd
# SELECT TEST VISUALIZATION NUMBER
nb = 4
#%%
topic_desc = f"/Users/h2jw/Documents/GitHub/NLP-FOMC/LDA_qje/LDA QJE test {nb}/topic_description.csv"
t_desc = pd.read_csv(topic_desc)
pres ... | StarcoderdataPython |
1895420 | import multiprocessing
import threading
import time
import sys
from math import fabs
try:
TIME_FUNC = time.perf_counter
except AttributeError:
TIME_FUNC = time.monotonic
# Default precision
DEF_PRECISION = 4
# Default time step
DEF_STEP = 0.01
def write_time(start_time, precision, step):
cur_time = '{0... | StarcoderdataPython |
5167609 | <filename>src/lib/mine/utility/test_my_assert.py
#!/usr/bin/env false
"""TODO: Write
"""
# Internal packages (absolute references, distributed with Python)
from pathlib import Path
# External packages (absolute references, NOT distributed with Python)
from pytest import raises
# Library modules (absolute references... | StarcoderdataPython |
11357949 | <reponame>mrx04programmer/frza
#! /bin/python3
import socket
listener = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
listener.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1)
listener.bind(('127.0.0.1', 8080))
listener.listen(0)
print("[+] Esperando por conexiones")
connection, addr = listener.accept()
pr... | StarcoderdataPython |
3597475 | # Copyright (c) 2010 Resolver Systems Ltd.
# All Rights Reserved
#
from functionaltest import FunctionalTest
class Test_2559_FitEditorToCells(FunctionalTest):
def test_editor_fits_cells(self):
# * Harold logs in and creates a new sheet
self.login_and_create_new_sheet()
cell_locator = s... | StarcoderdataPython |
6554839 | from nksama import bot
def send_log(err , module):
bot.send_message(-1001646296281 , f"error in {module}\n\n{err}")
| StarcoderdataPython |
8022894 | <gh_stars>100-1000
DEFAULT_MAXIMUM_SESSION_LENGTH = 60 * 60 * 24 * 30 # 30 days
DEFAULT_AUTHENTICATION_BACKEND = 'mayan.apps.authentication.authentication_backends.AuthenticationBackendModelDjangoDefault'
DEFAULT_AUTHENTICATION_BACKEND_ARGUMENTS = {
'maximum_session_length': DEFAULT_MAXIMUM_SESSION_LENGTH
}
DEFAU... | StarcoderdataPython |
5113099 | from typing import Any, Dict
from fedot.core.optimisers.adapters import PipelineAdapter
from fedot.core.optimisers.opt_history import ParentOperator
from . import any_to_json
def parent_operator_to_json(obj: ParentOperator) -> Dict[str, Any]:
serialized_op = any_to_json(obj)
serialized_op['parent_objects'] ... | StarcoderdataPython |
311406 | import math
import random
import matplotlib.pyplot as plt
from algorithms.ParticleFilter import ParticleFilter
WORLD_SIZE = 10
MARKERS = [1, 2, 5, 6, 8]
MAX_RANGE = 5
HIT_VARIANCE = .75
MOVEMENT_VARIANCE = 5
def sample_measurement_distribution(actual_range):
measurement = min(random.normalvariate(actual_rang... | StarcoderdataPython |
3487734 | # coding: utf-8
import os
import sys
import logging
from typing import Dict
from overrides import overrides
import torch
from allennlp.common import Params
from allennlp.data import Vocabulary
from allennlp.models.model import Model
from allennlp.modules import Seq2SeqEncoder, TextFieldEmbedder
from a... | StarcoderdataPython |
6497054 | """
File Name: Urls
Purpose: Url paths this application uses.
Comments:
"""
from django.urls import path, include
from rest_framework.routers import DefaultRouter
from api.views.user_views import UserSearchView
from auth_backend.modules.superAdmin.utilities import bulk_invite
from auth_backend.modules.superAdmin.view... | StarcoderdataPython |
1925971 | <filename>sdk/python/pulumi_google_native/memcache/v1beta2/_inputs.py
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mappi... | StarcoderdataPython |
11271795 | <reponame>rohitashwa1907/Text-Summarization-Using-GPT2<gh_stars>1-10
import os
import torch
import argparse
import warnings
import textwrap
import helper as hlp
from transformers import GPT2LMHeadModel
def eval(args):
warnings.filterwarnings("ignore")
""" set the device """
if torc... | StarcoderdataPython |
4849709 | <gh_stars>0
import requests
import urllib
import math
import time
import random
import numpy as np
import matplotlib.pyplot as plt
import jieba
from snownlp import SnowNLP
from wordcloud import WordCloud
import pandas as pd
import sqlite3
import math
class calculator:
find_artist=''
my_headers ... | StarcoderdataPython |
369105 | """
sonde.formats.merge
~~~~~~~~~~~~~~~~~
This module implements the Merge format used by sonde.merge
"""
from __future__ import absolute_import
import datetime
import pkg_resources
import re
from StringIO import StringIO
import xlrd
import csv
import numpy as np
import quantities as pq
from .. import ... | StarcoderdataPython |
237935 | """Prepares a text-format word2vec vectors for R's PCA.
Usage: $0 input-vectors.txt output-vectors.txt
"""
import sys
input_file = sys.argv[1]
output_file = sys.argv[2]
k = 0
V = 0
with open(output_file, 'w') as fout:
with open(input_file, 'r') as fin:
first_line = True
count = 0
for line in fin:
... | StarcoderdataPython |
3288559 | import numpy as np
from metod_alg import metod_analysis as mt_ays
def metod_analysis_sog():
"""
Calculates the total number of times the METOD algorithm condition
fails for trajectories that belong to the same region of attraction and
different regions of attraction. Saves all results for different v... | StarcoderdataPython |
3333048 | # ==============================================================================
# Copyright 2019 - <NAME>
#
# NOTICE: 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, ... | StarcoderdataPython |
9717967 | from os import getcwd
from webtest import TestApp
import transaction
from tg import AppConfig
from tg.configuration import milestones
from tg.configuration.auth import TGAuthMetadata
from tgext.pluggable import plug, app_model
from sqlalchemy import Integer, Column, Unicode, inspect
from sqlalchemy.orm import sessio... | StarcoderdataPython |
5011319 | #!/usr/bin/env python2.3
#########
#
# Copyright (c) 2005 <NAME>
#
# This file is part of the vignette-removal library.
#
# Vignette-removal is free software; you can redistribute it and/or modify
# it under the terms of the X11 Software License (see the LICENSE file
# for details).
#
# This program is distributed in ... | StarcoderdataPython |
3519493 | <reponame>LBJ-Wade/gpr4im
'''
Setup script, to make package pip installable
'''
from setuptools import setup
# read the contents of your README file
from os import path
this_directory = path.abspath(path.dirname(__file__))
with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f:
long_descriptio... | StarcoderdataPython |
3308536 | from django.contrib import admin
from .models import Class
admin.site.register(Class) | StarcoderdataPython |
5101270 | <gh_stars>1-10
'''PyPFASST SDC tests.'''
import math
import numpy as np
import pfasst.imex
import linearad
# test these nodes...
nodes = [ ('GL', 3), ('GL', 5), ('GL', 9), ('GL', 13) ]
tolerances = [ -7, -13, -13, -13 ]
sweeps = 12
# test problem
size = 128
feval = linearad.Lin... | StarcoderdataPython |
1804724 | <reponame>dtoma/python<gh_stars>0
import sqlite3
import urllib.parse as urlp
from contextlib import contextmanager
import click
import feedparser
from flask import Flask, g, redirect, render_template, request, url_for
DATABASE = "feed.db"
app = Flask(__name__)
@contextmanager
def ignore_table_exists(msg):
"""Si... | StarcoderdataPython |
5136909 | import tensorflow as tf
class Optimize(tf.keras.Model):
def __init__(self, config,global_step):
super(Optimize, self).__init__()
with tf.variable_scope('optimize'):
self.config=config
self.global_step = global_step # global step
self.lr_start = config.lr_start ... | StarcoderdataPython |
6649512 | <filename>src/ScreenScrapper.py<gh_stars>0
from PIL import Image, ImageGrab
import math
import logging, logging.config
# Logger
logging.config.fileConfig(fname='logging.conf', disable_existing_loggers=False)
logger = logging.getLogger('screen_scrapper')
class ScreenScrapper:
# Screen/Game resolution
screenRes... | StarcoderdataPython |
1857319 | <filename>promgen/mixins.py
# Copyright (c) 2019 LINE Corporation
# These sources are released under the terms of the MIT license: see LICENSE
from django.contrib import messages
from django.contrib.auth.mixins import PermissionRequiredMixin
from django.contrib.auth.views import redirect_to_login
from django.contrib.c... | StarcoderdataPython |
3248568 | <gh_stars>0
"""
.. module:: data_loader
:synopsis: Data Reader
.. moduleauthor:: <NAME>
This module is to read the data
Todo:
* Add more readers
* Add features to read from Kaggle using API
"""
import sys
sys.path.append('.')
import pandas as pd
import numpy as np
class readDataStore():
"""
This... | StarcoderdataPython |
1676818 | print("Inside dags folder init") | StarcoderdataPython |
3520269 | <gh_stars>0
from .rgb_data_loader import RGBDataLoad
from .rgb_data_loader_L import RGB2LDataLoad
__datasets__ = {
"dataload": RGBDataLoad,
"dataload_L": RGB2LDataLoad
}
| StarcoderdataPython |
9670814 | <reponame>hackaugusto/scenario-player
import pytest
import yaml
from web3.gas_strategies.time_based import fast_gas_price_strategy, medium_gas_price_strategy
from scenario_player.exceptions.config import InsufficientMintingAmount, UDCTokenConfigError
from scenario_player.scenario import ScenarioYAML
from scenario_play... | StarcoderdataPython |
181489 | from sklearn.base import BaseEstimator, ClassifierMixin
import collections
from typing import Any, Union
import pandas as pd
import numpy as np
from numpy.core._multiarray_umath import ndarray
from pandas import Series
from pandas.core.arrays import ExtensionArray
import sys
import buildBNStructure
import param4BN_lea... | StarcoderdataPython |
302563 | <gh_stars>10-100
# Copyright 2018 <NAME>. All rights reserved.
import logging
import pandas as pd
from src.instrumentation import logspeed
from src.cache import load_from_cache, save_to_cache
## Get the same logger from main"
logger = logging.getLogger("HomeCredit")
@logspeed
def fte_missed_installments(train, test,... | StarcoderdataPython |
3433390 | import unittest
from marmot.evaluation.evaluation_metrics import get_spans, intersect_spans, sequence_correlation
class TestEvaluationUtils(unittest.TestCase):
def setUp(self):
self.predictions = []
cur_pred = []
for line in open('test_data/hyp'):
if line.strip() == '':
... | StarcoderdataPython |
6569311 | from typing import List, NamedTuple
import pandas as pd
from pyspark import SparkContext
from pyspark.sql import SparkSession, Row
from qanta import logging
from qanta.datasets.quiz_bowl import Question, QuestionDatabase
from qanta.guesser.abstract import AbstractGuesser
from qanta.util.io import safe_path
from qa... | StarcoderdataPython |
3570428 | #!/usr/bin/python3
#
# Take CSV and print out DNS A records for the Bind zone file
import fileinput
for line in fileinput.input():
machine = line.rstrip().split(",")
print("{0} in a {1}".format(
machine[1], machine[2])) | StarcoderdataPython |
6680118 | # dataloader for 7-Scenes / when testing D-Net
import os
import random
import glob
import numpy as np
import torch
import torch.utils.data.distributed
from PIL import Image
from torch.utils.data import Dataset, DataLoader
from torchvision import transforms
import torchvision.transforms.functional as TF
class SevenS... | StarcoderdataPython |
9741606 | <gh_stars>0
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | StarcoderdataPython |
11221753 | """
Testing simple cases for pyxform
"""
from unittest import TestCase
#from ..pyxform import survey_from_json
from pyxform.survey import Survey
from pyxform.builder import create_survey_element_from_dict
# TODO:
# * test_two_questions_with_same_id_fails
# (get this working in json2xform)
class BasicJson2XForm... | StarcoderdataPython |
4924077 | # level order, preorder, inorder, post order
class Node:
def __init__(self, key):
self.left = None
self.right = None
self.val = key
def printInorder(root):
if root:
printInorder(root.left)
print(root.val)
printInorder(root.right)
def printPost... | StarcoderdataPython |
268614 | # Generated by Django 3.1.12 on 2021-08-29 18:48
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('projects', '0022_auto_20210829_1747'),
]
operations = [
migrations.DeleteModel(
name='ProjectUser',
),
]
| StarcoderdataPython |
8070962 | <filename>health_check.py
# -*- coding: utf-8 -*-
import argparse
import logging
import os
import re
import socket
import sys
import time
import urllib.error
import urllib.request
import ping3
import pymemcache.client.base
import pymysql
import redis
import redis.sentinel
import stringcase
import yaml
VERSION = '0.0... | StarcoderdataPython |
258350 | <reponame>Jeremiad/Flexget
"""Torrenting utils, mostly for handling bencoding and torrent files."""
# Torrent decoding is a short fragment from effbot.org. Site copyright says:
# Test scripts and other short code fragments can be considered as being in the public domain.
import binascii
import re
from contextlib import... | StarcoderdataPython |
11356251 | <gh_stars>0
from setuptools import setup
setup(
name="nicepy",
version="0.1",
author="<NAME>",
author_email="<EMAIL>",
description="NICE experiment data tools",
requires=['numpy', 'scipy', 'pint', 'matplotlib', 'pandas', 'labrad'],
url='https://github.com/Campbell-IonMolecule/nicepy'
)
| StarcoderdataPython |
345930 | #!/usr/bin/env python
"""
@author: <NAME>
"""
from VISA_Driver import VISA_Driver
from InstrumentConfig import InstrumentQuantity
import numpy as np
__version__ = "0.0.1"
class Driver(VISA_Driver):
""" This class implements the Rigol scope driver"""
def performGetValue(self, quant, options={})... | StarcoderdataPython |
8050952 | <filename>ztp/vnf.onboard-test.py
#!/usr/bin/python
"""
Test script can trigger second phase VNF on-boarding without
actually doing any VPN.
You just need to make sure vCenter has reachability to remote ESXi
host
<NAME>
<EMAIL>
"""
import logging
import pika
import yaml
import argparse
def main(esx_hostname):... | StarcoderdataPython |
9744767 | # -*- coding: utf-8 -*-
from __future__ import division, absolute_import, unicode_literals
from django.conf import settings
# Restricts the attributes that are passed from ModelAdmin2 classes to their
# views. This is a security feature.
# See the docstring on djadmin2.types.ModelAdmin2 for more detail.
MODEL_ADMI... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.