id stringlengths 2 8 | text stringlengths 16 264k | dataset_id stringclasses 1
value |
|---|---|---|
6418051 | <reponame>QazmoQwerty/simple-settings-daemon<gh_stars>0
from typing import Set, Dict
from libssettings.utils import is_integer
from libssettings.exceptions import SSettingsError
class InvalidSettingValueError(SSettingsError):
pass
class Rule:
def validate(self, value: str) -> None:
raise NotImplement... | StarcoderdataPython |
4981955 | <gh_stars>0
# -*- coding: utf-8 -*-
# cython: language_level=3
# BSD 3-Clause License
#
# Copyright (c) 2020-2022, <NAME>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of s... | StarcoderdataPython |
188478 | <reponame>nkuhzx/VSG-IA<filename>vsgia_model/dataset/videotargetatt.py<gh_stars>0
import glob
import numpy as np
import pandas as pd
import os
import math
import h5py
from PIL import Image
import torch
import torch.nn.functional as F
from torch.utils.data.dataset import Dataset
from torch.utils.data import DataLoade... | StarcoderdataPython |
1693707 | <gh_stars>1-10
# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Project panel.helloyuna.io
#
# Author: <NAME>
# <EMAIL>
# <EMAIL>
# http://ardz.xyz
#
# File Created: Thursday, 1st March 2018 1:56:43 pm
# Last Modified: Sunday, 4th March 2018 6:03:42 pm
# Modified By: <NAME> (<EMAIL... | StarcoderdataPython |
3403112 | <filename>src/commands/rcon.py
from src.commands.command import Command
class RconCommand(Command):
def __init__(self):
pass
def execute(self):
pass
| StarcoderdataPython |
6629009 | <gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Python bot for comment a list of urls in YouTube
import time
import numpy as np
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected... | StarcoderdataPython |
12848443 | <filename>tests/views/test_plot_configuration_dialog.py<gh_stars>0
# This file is part of spot_motion_monitor.
#
# Developed for LSST System Integration, Test and Commissioning.
#
# See the LICENSE file at the top-level directory of this distribution
# for details of code ownership.
#
# Use of this source code is gover... | StarcoderdataPython |
1684390 | <gh_stars>1-10
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 2.0.4
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
"""
This module defines internals of BLPAPI-Py and the following classes:
- CorrelationId: a key to t... | StarcoderdataPython |
1694610 | #### standard provider code ####
# import the correct PROVIDER_SUBMODULE and PROVIDER_ID constants for your provider
from .constants import PROVIDER_ID
from ..constants import PROVIDER_SUBMODULE
# define common provider functions based on the constants
from ckan_cloud_operator.providers import manager as providers_ma... | StarcoderdataPython |
3492918 | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2020 Alibaba Group Holding Limited.
#
# 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/LICENS... | StarcoderdataPython |
6621850 | """
File for running tests programmatically.
"""
import pytest
def main():
"""
Run pytest tests.
"""
errno = pytest.main(['-x', 'hydsensread', '-v', '-rw', '--durations=10',
'--cov=hydsensread'])
if errno != 0:
raise SystemExit(errno)
if __name__ == '__main__':... | StarcoderdataPython |
5156952 | import basilica
import tweepy
from decouple import config
from .models import DB, Tweets, User
TWITTER_USERS = ['elonmusk', 'nasa', 'lockheedmartin', 'bigdata', 'buzzfeed','theeconomist', 'funnyordie']
TWITTER_AUTH = tweepy.OAuthHandler(config('TWITTER_CONSUMER_KEY'),
config('TWITTE... | StarcoderdataPython |
5121267 | from io import BytesIO
from itertools import chain, product
from pathlib import Path
import random
from tempfile import TemporaryDirectory
import unittest
import h5py as h5
import numpy as np
from pentinsula import ChunkBuffer
from pentinsula.chunkbuffer import _chunk_slices
try:
from .utils import random_string... | StarcoderdataPython |
6563564 | <filename>src/beer/admin.py<gh_stars>0
from django.contrib import admin
from beer import models
admin.site.register(models.Beer) | StarcoderdataPython |
8026803 | from .fks_partition import FKSPartition
| StarcoderdataPython |
4932434 | import torch
__all__ = ['MeterShapeNet']
default_shape_name_to_part_classes = {
'Bag': [0],
'Box': [1],
'Cylinder': [2],
'RobotFrame': [3],
}
class MeterShapeNet:
def __init__(self, num_classes=4, num_shapes=4, shape_name_to_part_classes=None):
super().__init__()
self.num_classe... | StarcoderdataPython |
8181451 | <gh_stars>0
from stockroom import StockRoom
from stockroom import make_torch_dataset
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.utils.data import DataLoader
import matplotlib.pyplot as plt
import numpy as np
from tqdm import tqdm
def imshow(img):
plt.imshow(np.tra... | StarcoderdataPython |
4881848 | # import json
#
# from django.http import HttpResponse
# from django.utils.safestring import mark_safe
# from django.views.decorators.csrf import csrf_exempt
# from markdown import markdown
#
# from libs.util.auth import login_auth_view
#
#
# @csrf_exempt
# @login_auth_view
# def change_to_markdown(request):
# """
... | StarcoderdataPython |
4842378 | import pytest
from towel import *
class TestUpdate:
def test_deletes(self, base, cursor, fish_fixtures):
Fish, fishes = fish_fixtures
fish = fishes[0]
fish.objects().remove()
assert not fish.as_namedtuple() in Fish.objects().get_all()
def test_removes_multiple_without_filte... | StarcoderdataPython |
4995510 | from kirby_transform.schema.input.schema import CommonInput, NestedInputData
from kirby_transform.schema.validator import (FieldValidator, UnixEpoch,
ValidationError)
| StarcoderdataPython |
1978372 | <gh_stars>0
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from google.appengine.ext import ndb
from config.template_middleware import TemplateResponse
from article.article_model import Article
from gaecookie.decorator import no_csrf
from gaepermission.decorator import permissions, lo... | StarcoderdataPython |
301699 | import os
#=========== SIMULATION DETAILS ========
projectname = "project"
basename = "experimentname"
seed = -1
N_measurements = 1
measurements = range(N_measurements)
params1 = range(3)
params2 = range(3)
params3 = range(3)
params4 = range(3)
params5 = range(3)
params6 = range(3)
external_parameters = [
... | StarcoderdataPython |
4973827 | # coding=utf-8
# Copyright 2018-2020 EVA
#
# 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 ... | StarcoderdataPython |
1815943 | # Copyright 2019 Google 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 applicable law or agreed to in writing,... | StarcoderdataPython |
307632 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2019/6/8 上午10:53
# @Author : Ethan
# @Site :
# @File : my_crnn.py
# @Software: PyCharm
import torch
import torch.nn.functional as F
import torch.nn as nn
class Vgg_16(torch.nn.Module):
def __init__(self):
super(Vgg_16, self).__init__()
... | StarcoderdataPython |
289936 | <filename>releasescrawler/spiders/releases_games.py<gh_stars>0
# -*- coding: utf-8 -*-
import hashlib
import logging
import re
from datetime import datetime
from scrapy.linkextractors import LinkExtractor
from scrapy.selector import Selector
from scrapy.spiders import CrawlSpider, Rule
from releasescrawler.items impo... | StarcoderdataPython |
9735462 | import sys, os, hashlib
import numpy as np
if sys.version_info > (3,):
xrange = range
class Frame(np.ndarray):
pass
class SlicedView(object):
def __init__(self, parent, indexes, properties=()):
self.parent = parent
self.range = xrange(*indexes.indices(len(parent)))
self.properties... | StarcoderdataPython |
353134 | import pygame
import os
import random
import sys
import math
from pygame.locals import *
from gamestate import *
from battle import battle
from repair import repair
from events import events
from shop import shop
from gameover import game_over, game_win
from escape import Escape
LAST = -1
FIRST = 1
def get_rand():
... | StarcoderdataPython |
8011108 | <filename>cfg/weechat/__main__.py
from libdotfiles.packages import try_install
from libdotfiles.util import HOME_DIR, PKG_DIR, create_symlinks
try_install("weechat")
create_symlinks(
[
(path, HOME_DIR / ".weechat" / path.name)
for path in PKG_DIR.glob("*.conf")
]
)
create_symlinks(
[
... | StarcoderdataPython |
1817765 | # @lc app=leetcode id=497 lang=python3
#
# [497] Random Point in Non-overlapping Rectangles
#
# https://leetcode.com/problems/random-point-in-non-overlapping-rectangles/description/
#
# algorithms
# Medium (39.08%)
# Likes: 355
# Dislikes: 562
# Total Accepted: 32.1K
# Total Submissions: 82.2K
# Testcase Example:... | StarcoderdataPython |
1853109 | # -*- coding: utf-8 -*-
from __future__ import annotations
import typing
from typing import Optional
from collections import namedtuple
from dataclasses import dataclass
import functools
import warnings
import numpy as np
import pandas as pd
import scipy.signal
from endaq.calc.stats import L2_norm
from endaq.calc i... | StarcoderdataPython |
3398801 | <gh_stars>0
name = "ServerName"
user = "mongo"
japd = None
host = "hostname"
port = 27017
auth = False
repset = None
repset_hosts = None
auth_db = "admin"
use_arg = True
use_uri = False
| StarcoderdataPython |
1659970 | <filename>calculator.py
from evaluation import *
# this is the main function for the calculator
def calculator():
# this string makes sure that the calculator doesn't stop
mark = None
# this is the initial string instructions
print('To stop the calculator enter \'end\' and to get help enter \'help\'')... | StarcoderdataPython |
11273499 | <reponame>Livioni/Cloud-Workflow-Scheduling-base-on-Deep-Reinforcement-Learning
import gym, torch, copy, os, xlwt, random
import torch.nn as nn
from datetime import datetime
import numpy as np
env = gym.make("clusterEnv-v0").unwrapped
state_dim, action_dim = env.return_dim_info()
####### initialize environment hyperp... | StarcoderdataPython |
1817300 | import matplotlib.pyplot as plt
from chombopy.plotting import PltFile, setup_mpl_latex
import matplotlib.cm as cm
pf = PltFile("../tests/data/plt000100.2d.hdf5")
setup_mpl_latex(14)
fig = plt.figure()
ax = plt.gca()
cmap = "viridis"
field = "Temperature"
# Get data for the temperature variable on level 2
for level i... | StarcoderdataPython |
171796 | #!/usr/bin/env python
from distutils.core import setup
setup(name='pattern',
version='0.1~alpha0',
author='<NAME>',
author_email='<EMAIL>',
description='Parsing strings according to python formats',
url='http://github.com/integralws/pattern',
license='MIT License',
packages=['pattern'],
) | StarcoderdataPython |
1731271 | <filename>const/sub_categories/service/media.py
from typing import Dict
from ..base_category import BaseCategory
# CD錄音帶 cd-and-tape
class CdAndTape(object):
def cd_and_tape() -> Dict[str, Dict[str, str]]:
list = {}
list['name'] = 'CD錄音帶'
list['id'] = 'cd-and-tape'
cd_and_tape = {}
cd... | StarcoderdataPython |
6433942 | import inspect
import io
import os
import platform
import numpy
import cupy
try:
import cupy.cuda.thrust as thrust
except ImportError:
thrust = None
try:
import cupy_backends.cuda.libs.cudnn as cudnn
except ImportError:
cudnn = None
try:
import cupy.cuda.nccl as nccl
except ImportError:
ncc... | StarcoderdataPython |
4897968 |
import argparse
import inspect
import os
import pathlib
from shutil import copy2
from glob import glob
def parseargs(f):
argspec = inspect.getfullargspec(f)
argnames = argspec[0]
defaults = list() if argspec[3] is None else argspec[3]
reqlen = len(argnames)-len(defaults)
parser = argparse.Argu... | StarcoderdataPython |
65286 | <gh_stars>0
import FWCore.ParameterSet.Config as cms
isolatedTracksCone= cms.EDAnalyzer("IsolatedTracksCone",
doMC = cms.untracked.bool(False),
Verbosity = cms.untracked.int32( 1 ),
useJetTrigger = cms... | StarcoderdataPython |
9728016 | # 2) Write a script that generates all the possible ungapped alignments of two sequences, scores them and identifies
# the best scoring ones.
#
# These are all the possible ungapped alingments of the two sequences: TCA and GA:
#
# --TCA -TCA TCA TCA TCA- TCA--
# GA--- GA-- GA- -GA --GA ---GA
#
# Using the fol... | StarcoderdataPython |
5119148 | <reponame>DEADSEC-SECURITY/CODEX<gh_stars>10-100
#-----------Welcome to DeAdSeC Python Codex----------#
#-------Made By DeAdSeC-------#
#---Version 1.0.0---#
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
W = '\033[0m' # white (normal)
R = '\033[31m' # red
G = '\033[32m' # green
O = '\033[33m' # orange
B = '\033[34m' ... | StarcoderdataPython |
8003030 | from fastapi import APIRouter
from app.api.api_v1.endpoints import (
market_currency, wallet_asset, user_trade
)
api_router = APIRouter()
api_router.include_router(market_currency.router, prefix="/currency", tags=["currency"])
api_router.include_router(wallet_asset.router, prefix="/wallet", tags=["wallet"... | StarcoderdataPython |
270202 | from django import forms
from .models import Fee, StudentFee, StudentReceipt
class FeeForm(forms.ModelForm):
class Meta:
model = Fee
fields = '__all__'
widgets = {
'name': forms.TextInput(attrs={'class': 'form-control'}),
'amount': forms.NumberInput(attrs={'class': ... | StarcoderdataPython |
112465 | <filename>days/d11.py
import os
import time
import numpy as np
import pytest
from scipy.signal import convolve
day = os.path.basename(__file__).split(".")[0]
def parse(file: str):
return np.genfromtxt(file, delimiter=1)
def p1(data: np.array):
mask = np.array([[1, 1, 1], [1, 0, 1], [1, 1, 1]])
flashes... | StarcoderdataPython |
1957527 | <reponame>azavodov/social-apis
from social_apis.networks.network import Network
class Vkontakte(Network):
api_url = 'https://api.vk.com'
api_version = '5.103'
url = f"{api_url}/method"
def __init__(self, **params):
super(Vkontakte, self).__init__(self.api_url, **params)
def request(self... | StarcoderdataPython |
9741486 | import sqlite3
from sqlite3 import Error
from flask import (Flask, render_template, request, flash, redirect, url_for,
current_app)
from flask_login import current_user, login_user, login_required, logout_user
import os
from . import auth
from .forms import RegistraForm, LoginForm
from .db_conn import insert_utente... | StarcoderdataPython |
8193157 | <gh_stars>0
#!/usr/bin/env python3
# <NAME>, 2020, based on an implementation by Isabelle and <NAME> distibuted under the MIT license.
#The three bug algorithms differ only in how they decide to leave the wall and return to the path through free space to the goal. To implement this, a single Bug class was created tha... | StarcoderdataPython |
5167438 | import dataset
import models
import train
'''
FAUST = "../../Downloads/Mesh-Datasets/MyFaustDataset"
COMA = "../../Downloads/Mesh-Datasets/MyComaDataset"
SHREC14 = "../../Downloads/Mesh-Datasets/MyShrec14"
PARAMS_FILE = "../model_data/FAUST10.pt"
traindata = dataset.FaustDataset(FAUST, train=True, test=False)
train... | StarcoderdataPython |
3570047 | import random, discord
from discord.ext import commands
class _2048(commands.Cog):
def __init__(self, bot):
self.bot = bot
def format_board(self, board):
h = []
for row in board:
h.append(''.join(str(row)))
h = '\n'.join(h)
return f"```\n{h}\n```"
def go_up(self, board):
moved = Fals... | StarcoderdataPython |
3395404 | import os,cv2
import scipy.io as scio
import numpy as np
from tqdm import tqdm
# from scipy.misc import imresize
standard_size = [720,1280];
val_mat_dir='/input0/train_mat'
image_dir='/input0/image/'
save_label_path='train_label'
os.mkdir(save_label_path)
def main():
img_list=os.listdir(val_mat_dir)
for idx... | StarcoderdataPython |
9741076 | <reponame>simonsimon006/tensorflow-wavelets
import pickle
import matplotlib.pyplot as plt
history_file_path = r"..\trainHistoryCifar10CNN.txt"
# history_file_path = r"..\trainHistoryWaveletCifar10CNN.txt"
# history_file_path = r"..\trainHistoryWaveletCifarDb410CNN.txt"
with open(history_file_path, 'rb') as pickle_fil... | StarcoderdataPython |
4846401 | <reponame>TaoYibo1866/webots_ros2
#!/usr/bin/env python
# Copyright 1996-2021 Cyberbotics Ltd.
#
# 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-... | StarcoderdataPython |
345652 | <gh_stars>0
# Write programs that read a sequence of integer inputs and print
# a. The smallest and largest of the inputs.
# b. The number of even and odd inputs.
# c. Cumulative totals. For example, if the input is 1 7 2 9, the program should print
# 1 8 10 19.
# d. All adjacent duplicates. For exam... | StarcoderdataPython |
9797493 | <reponame>arianasatryan/IntrinsicAnalysis
from typing import Tuple, List
import os
import sys
from IntrinsicAnalysis.feature_extractors.utils import remove_non_letters, EXTERNAL_DIR
from sklearn.feature_extraction.text import TfidfVectorizer
from nltk.corpus import stopwords
UNIGRAM_IDF_THRESHOLD = 4.0
BIGRAM_IDF_THR... | StarcoderdataPython |
6503969 | import spacy
import pytextrank # noqa: F401
from math import sqrt
from operator import itemgetter
from .base_single_doc_model import SingleDocSummModel
from typing import Union, List
class TextRankModel(SingleDocSummModel):
# static variables
model_name = "TextRank"
is_extractive = True
is_neural = F... | StarcoderdataPython |
90532 | import numpy as np
class MAX_POOL_LAYER:
"""MAX_POOL_LAYER only reduce dimensions of height and width by a factor.
It does not put max filter on same input twice i.e. stride = factor = kernel_dimension
"""
def __init__(self, **params):
self.factor = params.get('stride', 2)
def forward(s... | StarcoderdataPython |
9624717 | """
Name : c8_07_pandas_read+csv_function.py
Book : Python for Finance (2nd ed.)
Publisher: Packt Publishing Ltd.
Author : <NAME>
Date : 6/6/2017
email : <EMAIL>
<EMAIL>
"""
import pandas as pd
url='http://canisius.edu/~yany/data/ibm.csv'
x=pd.read_csv(url,index_col=0,pars... | StarcoderdataPython |
6701295 | # Recursion Exercise 4
# Write a recursive function called reverse_string that takes a string as a parameter.
# Return the string in reverse order. Hint, the slice operator will be helpful when solving this problem.
# Expected Output
# If the function call is reverse_string("cat"), then the function would return tac
# ... | StarcoderdataPython |
3242210 | # This is here for loading old models
from tlkit.models.student_models import FCN4Reshaped
FCN5SkipCifar = FCN4Reshaped | StarcoderdataPython |
9784410 |
from find_files_in_folder import search_dirs
import pandas as pd
runs_directory = "D:\\Igor\\Research_USF\\University of South Florida\\Mao, Wenbin - Igor\\Febio-Models\\Active-Models\\PAQ\\Gamma-5-2\\runs"
pickles_paths = search_dirs(runs_directory, ".pickle")
df = pd.read_pickle(pickles_paths[0])
print(df)
# for ... | StarcoderdataPython |
355252 | <filename>python_native/01_collections/sorting.py
# Sorting
## Sorting with keys
airports = [
('MROC', 'San Jose, CR'),
('KLAS', 'Las Vegas, USA'),
('EDDM', 'Munich, DE'),
('LSZH', 'Zurich, CH'),
('VNLK', 'Lukla, NEP')
]
sorted_airports = dict(sorted(airports, key=lambda x:x[0]))
print(sorted_ai... | StarcoderdataPython |
9645108 | <reponame>anuraagbaishya/uiautomator
import os
import hashlib
import time
import json
from json_rpc_error import JsonRPCError
try:
import urllib2
except ImportError:
import urllib.request as urllib2
try:
from httplib import HTTPException
except:
from http.client import HTTPException
try:
if os.name... | StarcoderdataPython |
105363 | <reponame>rnui2k/vivisect
import vdb.extensions.i386 as v_ext_i386
import vdb.extensions.i386 as vdb_ext_i386
def vdbExtension(vdb, trace):
vdb.addCmdAlias('db','mem -F bytes')
vdb.addCmdAlias('dw','mem -F u_int_16')
vdb.addCmdAlias('dd','mem -F u_int_32')
vdb.addCmdAlias('dq','mem -F u_int_64')
v... | StarcoderdataPython |
5069362 | <reponame>sanja7s/MedRed
import pandas as pd
import numpy as np
from collections import defaultdict, Counter, OrderedDict
import re
import nltk
from nltk import word_tokenize
# THIS needs to be RUN once, for the first time
# nltk.download('punkt')
import string
"""
a bit low-level code to transform the AMT inputs to N... | StarcoderdataPython |
9720736 | <filename>compliance_checker/runner.py
import io
import json
import os
import sys
import traceback
from collections import OrderedDict
from contextlib import contextmanager
from compliance_checker.suite import CheckSuite
# Py 3.4+ has contextlib.redirect_stdout to redirect stdout to a different
# stream, but use th... | StarcoderdataPython |
8028008 | <filename>mscreen/autodocktools_prepare_py3k/AutoDockTools/Utilities24/prepare_ligand_vif.py
#!/usr/bin/env python
#
#
#
# $Header: /opt/cvs/python/packages/share1.5/AutoDockTools/Utilities24/prepare_ligand_vif.py,v 1.2 2012/01/31 17:57:37 rhuey Exp $
#
import os
from MolKit import Read
from string import split, st... | StarcoderdataPython |
1925041 | <gh_stars>0
"""Dashboard Module for all html/dash components"""
| StarcoderdataPython |
9610675 | def count_lines(fname):
with open(fname) as f:
return sum(1 for line in f)
def detokenize(tokens):
ret = ''
for g, a in zip(tokens['gloss'], tokens['after']):
ret += g + a
return ret.strip()
| StarcoderdataPython |
3504060 | #!/usr/bin/env python
# -*- coding:UTF-8 -*-
#
# shutdownevt.py
#
# Example of a generator that uses an event to shut down
import time
def follow(thefile,shutdown=None):
thefile.seek(0,2)
while True:
# 通过设置一个"全局"标志位,来关闭生成器
if shutdown and shutdown.isSet(): break # 从内部关闭
line = thefil... | StarcoderdataPython |
6641518 | # -*- coding: utf-8 -*-
# from Programs import program as pr
import csv
import re
# import os
import sys
# yazma-okuma işlemleri için parametreler
csv.register_dialect("myDialect", delimiter='|', quoting=csv.QUOTE_NONE, skipinitialspace=True)
def tr_title(paramWord: str) -> str:
"""türkçe harfler için title fonksi... | StarcoderdataPython |
1834286 | <reponame>prateekcom/django-phone-auth<gh_stars>0
import re
from django.core.exceptions import ValidationError
from django.utils.translation import gettext_lazy as _
def get_username_regex():
"""Username should be alphanumeric and in lowercase"""
return r'^[a-z0-9]{4,30}$'
def validate_username(username):... | StarcoderdataPython |
6443452 | <reponame>ViciousCircle-Github/arithmetic_arranger<gh_stars>0
def arithmetic_arranger(problems, *args):
if len(problems) > 5:
return "Error: Too many problems."
arranged_problems = []
for index, value in enumerate(problems):
operation = value.split(" ")
if operation[1] not in "-+"... | StarcoderdataPython |
9613744 | import attrs
from databutler.datana.generic.corpus.code import DatanaFunction
from databutler.datana.generic.corpus.processing.base_processor import DatanaFunctionProcessor
from databutler.utils import code as codeutils
class CodeNormalizer(DatanaFunctionProcessor):
def _process(self, d_func: DatanaFunction) -> ... | StarcoderdataPython |
6445892 | <gh_stars>10-100
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2016 uralbash <<EMAIL>>
#
# Distributed under terms of the MIT license.
from pyramid import testing
from pyramid_sacrud import CONFIG_RESOURCES
from pyramid_sacrud.views import home_view
class Foo:
pass
class TestH... | StarcoderdataPython |
3347013 | #
# Copyright (c) 2020 Seagate Technology LLC and/or its Affiliates
#
# 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 |
9635250 | <reponame>mainulhossain/biowl<filename>app/biowl/libraries/fastqc/adapter.py
import os
from os import path
from pathlib import Path
from ...exechelper import func_exec_run
from ...fileop import PosixFileSystem
from ....util import Utility
fastqc = path.join(path.abspath(path.dirname(__file__)), path.join('lib', 'fast... | StarcoderdataPython |
11344388 | from django import forms
class InputForm(forms.Form):
age_v = forms.DecimalField(min_value=0)
sex_v = forms.DecimalField(min_value=0)
cp_v = forms.DecimalField(min_value=0)
thalach_v = forms.DecimalField(min_value=0)
exang_v = forms.DecimalField(min_value=0)
oldpeak_v = forms.DecimalF... | StarcoderdataPython |
125855 | <filename>reus/transfermarkt/tm_team_transfers.py
from ..util import get_page_soup
from .util import tm_format_currency
import pandas as pd
def tm_team_transfers(club, season, position_group='All', main_position='All', window='All', currency='EUR'):
"""
Extracts basic player information for each player in a sq... | StarcoderdataPython |
195107 | <filename>py-misc/evaluate_categories.py
import json
import pprint
import argparse
from sklearn.metrics import log_loss
class CategoryResult:
def __init__(self, data_dict, pretty_print):
self.data_dict = data_dict
self.lang_code = data_dict['lang_code']
self.category_scores = data_dict['cat... | StarcoderdataPython |
1718264 | <filename>pkg/binary_tree.py
# Given the root to a binary tree, implement serialize(root), which serializes the tree into a string, and deserialize(s), which deserializes the string back into the tree.
# For example, given the following Node class
# class Node:
# def __init__(self, val, left=None, right=None):
# ... | StarcoderdataPython |
6544154 | import sys, os, inspect, glob, datetime, time, shutil
import timeit
start = timeit.default_timer()
cmd_folder = os.path.dirname(os.path.realpath(os.path.abspath(os.path.split(inspect.getfile( inspect.currentframe() ))[0])))
if cmd_folder not in sys.path:
sys.path.insert(0, cmd_folder)
import imageryObject
baseFo... | StarcoderdataPython |
12865651 | import tide_constituents as tc
from py_noaa import coops
import pandas as pd
import numpy as np
import tappy
start = '20180201'
end = '20180228'
interval = 1
start = pd.to_datetime(start)
end = pd.to_datetime(end)
d = start
w, t, p, r = [], [], [], []
while d < end:
start_ = d
end_ = start_ + pd.DateOffs... | StarcoderdataPython |
4993020 | import tkinter
class MinhaGUI:
def __init__(self):
# Criando a janela principal
self.main_window = tkinter.Tk()
# Criando os labels
self.label1 = tkinter.Label(self.main_window, text='Curso Python Progressivo!' )
self.label2 = tkinter.Label(self.main_window, text='www.pyt... | StarcoderdataPython |
4854375 | class Node:
def __init__(self, value=None, name=""):
self.value = value
self.name = name
def match(self, params):
raise NotImplementedError
class LogicNode(Node):
def __init__(self):
super().__init__([])
class AndNode(LogicNode):
def match(self, params):
for ... | StarcoderdataPython |
4896519 | #!/usr/bin/env python3
#
# Copyright 2022 The Dawn Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | StarcoderdataPython |
1939240 | # Este es mi primer programa
print('Hello, world!');
# print("HOla")
'''
Se va a imprimir el valor de la variable cantidad
utilizando al comando print
'''
cantidad = 25
print('Mi variable cantidad contiene el valor ', cantidad)
| StarcoderdataPython |
1995342 | <gh_stars>1-10
import os
from lxml import etree
path = "origin" # 文件夹目录
files = os.listdir(path) # 得到文件夹下的所有文件名称
files = filter(lambda x: x.endswith('.xml'), files)
for file in files: # 遍历文件夹
tree = etree.parse(path + '/' + file)
for element in tree.xpath('//i//d'):
info = element.xpath('./... | StarcoderdataPython |
1763020 | <reponame>rinha79/discordpy-startup<gh_stars>0
import discord
from discord.ext import commands
import os
import traceback
import datetime
bot = commands.Bot(command_prefix='r!!')
token = os.environ['DISCORD_BOT_TOKEN']
@bot.event
async def on_ready():
channel = bot.get_channel(696922604660850740)
await chann... | StarcoderdataPython |
9633636 | <filename>tests/test_e2e_mw.py
import pytest
import kubernetes.client as k8s_client
import kubernetes.config as k8s_config
import sys
from .utils import namespace_handling, kopf_runner, NAMESPACE, DEFAULT_WAIT_TIME
import os
import time
sys.path.insert(0, os.path.abspath(os.path.join(
os.path.dirname(__file__), '... | StarcoderdataPython |
6410573 | # Copyright 2017 Confluent 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 applicable law or agreed to in writing, s... | StarcoderdataPython |
6543766 | <gh_stars>10-100
from celery import Celery
from contentcuration.utils.celery.tasks import CeleryTask
class CeleryApp(Celery):
task_cls = CeleryTask
result_cls = 'contentcuration.utils.celery.tasks:CeleryAsyncResult'
_result_cls = None
def on_init(self):
"""
Use init call back to set ... | StarcoderdataPython |
233192 | <gh_stars>10-100
from os import walk
def getFileName(name):
f=open(name,'r+')
lines = f.read().split("\n")
data=[]
for i in range(0,len(lines)):
#this program also take this line because of import
if 'import' in lines[i]:
if 'from' in lines[i]:
temp=lines[i]... | StarcoderdataPython |
6450113 | from .models import Member
from django import forms
class MemberForm(forms.Form):
first_name = forms.CharField(label='First Name', max_length=50, required = True)
surname = forms.CharField(label='Surname', max_length=50, required = True)
email = forms.EmailField(label='Email', max_length=100, required = T... | StarcoderdataPython |
3595153 | #!/usr/bin/env python3.8
from account import Account
from credentials import Credentials
def create_account(account_user_name,account_password):
"""
Function to create a new account
"""
new_account = Account(account_user_name,account_password)
return new_account
def save_account(account):
'''... | StarcoderdataPython |
368686 | <reponame>VincentDehaye/recommender-system-liu<gh_stars>0
"""
Purpose: Retrieve users from table in database
"""
from Product.Database.DBConn import User, Rating
from Product.Database.DatabaseManager.Retrieve.Retrieve import Retrieve
from sqlalchemy import desc
class RetrieveUser(Retrieve):
"""
Author:<NAME>
... | StarcoderdataPython |
3578737 | <reponame>erelsgl/family-fair-allocation
#!python3
"""
Defines various useful fairness criteria to use with fair allocation algorithms.
"""
from abc import ABC, abstractmethod # Abstract Base Class
from agents import Agent, BinaryAgent
import math
class FairnessCriterion(ABC):
"""
A fairness criterio... | StarcoderdataPython |
6560560 | <gh_stars>0
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from django.http import Http404
from django.views.generic import DetailView
from django_filters.rest_framework import DjangoFilterBackend
from guardian.mixins import (
LoginRequiredMixin,
PermissionListMixin,
... | StarcoderdataPython |
9679723 | import numpy as np
import statsmodels as sm
import math
import matplotlib.pyplot as plt
from scipy.integrate import quad
import sys
import os
import logging
from brd_mod.brdstats import *
from brd_mod.brdecon import *
def meter_to_mi(x):
'''
Converts a parameter in metres to miles
using a standar... | StarcoderdataPython |
3429100 | import datetime
import Queue
from abc import ABCMeta, abstractmethod
from event import FillEvent, OrderEvent
from event import events
class ExecutionHandler(object):
__metaclass__ = ABCMeta
def __init__(self,events,commission):
self.events = events
self.commission = commission
@abstrac... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.