id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
3544039 | <gh_stars>1-10
#!/usr/bin/env python3
# Written by <NAME> and released under GPL v3 license.
# See git repository (https://github.com/aidaanva/endorS.py) for full license text.
"""Script to calculate the endogenous DNA in a sample from samtools flag stats.
It can accept up to two files: pre-quality and post-quality ... | StarcoderdataPython |
1790691 | <gh_stars>0
from keras.datasets import mnist
from numpy import expand_dims, ones
from numpy.random import randint
# Génère n vrais échantillons
def generate_real_samples(n):
# Charge le jeu d'entrainement depuis MNIST
(trainX, _), (_, _) = mnist.load_data()
# transforme les tableaux 2D en 3D en ajoutant un canal... | StarcoderdataPython |
12817293 | CONFLICT_MARKER_START = '<<<<<<<'
CONFLICT_MARKER_MARK = '======='
CONFLICT_MARKER_END = '>>>>>>>'
import vim
from . import modes
from .settings import setting, init_cur_window_wrap
from .util import buffers, windows
from .util.log import log
def process_result():
windows.close_all()
buffers.result.open()
... | StarcoderdataPython |
9634143 | import math
def print_n(s, n):
while n > 0:
print(s)
n = n - 1
def mysqrt(a):
while True:
epsilon = 0.0000000000001
x = a /2.4
y = (x + a/x) / 2
if abs(y-x) < epsilon:
break
sqrt = y ... | StarcoderdataPython |
242780 | # Generated by Django 3.2.4 on 2021-08-05 12:28
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('registration', '0020_alter_child_family'),
]
operations = [
migrations.AddField(
model_name='family',
name='quotient... | StarcoderdataPython |
8094114 | from hashlib import md5
import random
import re
import string
def hash(s: str):
return md5(
bytes(
'{}'.format(s), 'utf'
)
).hexdigest()[0:32]
def hash_with_prefix(prefix: str, s: str = None):
if not s:
letters = string.ascii_lowercase
s = ''.join(random.choic... | StarcoderdataPython |
5010620 | import logging
import re
import typing as t
from typing import TYPE_CHECKING
from gkeepapi.node import ColorValue, TopLevelNode
if TYPE_CHECKING:
from gkeep.api import KeepApi
logger = logging.getLogger(__name__)
FLAG_RE = re.compile(r"[+\-=]\w+", re.I)
COLOR_RE = re.compile(r"\b(?:c|colors?):([\w,]+)\b", re.I)... | StarcoderdataPython |
5179102 | import re
from lxml.html import fromstring, tostring
from lxml.etree import SubElement
class Mention(object):
"""Replaces `@mention`'s with a URL pointing to the user's profile.
The URL can be configured by setting the ``user_url`` key in the `context`.
By default, it is set to `/users/{username}. ``{use... | StarcoderdataPython |
322245 | <filename>steganogan/cli.py
# -*- coding: utf-8 -*-
import argparse
from steganogan.models import SteganoGAN
def _get_steganogan(args):
steganogan_kwargs = {
'cuda': not args.cpu,
'verbose': args.verbose
}
if args.path:
steganogan_kwargs['path'] = args.path
else:
st... | StarcoderdataPython |
1836651 | <reponame>simo-tuomisto/portfolio
import numpy as np
import matplotlib.pyplot as mpl
import sys
from glob import glob
import os.path
import re
if __name__=="__main__":
cityfile = sys.argv[1]
routefolder = sys.argv[2]
namereg = re.compile('mrate\_(?P<mrate>\d+)-seed\_(?P<seed>\d+)\.route')
routefiles = glob(... | StarcoderdataPython |
8154269 | # -*- coding: utf-8 -*-
"""
Editor: <NAME>
School: BUPT
Date: 2018-03-01
算法思想: 查找字符串
对于一个给定的 source 字符串和一个 target 字符串,你应该在 source 字符串中找出 target 字符串出现的第一个位置(从0开始)。如果不存在,则返回 -1。
"""
class Solution:
"""
@param: source: source string to be scanned.
@param: target: target string containing the sequence of ch... | StarcoderdataPython |
16449 | #!/usr/bin/env python3
"""Radio scheduling program.
Usage:
album_times.py [--host=HOST] PORT
Options:
--host=HOST Hostname of MPD [default: localhost]
-h --help Show this text
Prints out the last scheduling time of every album.
"""
from datetime import datetime
from docopt import docopt
from mpd import M... | StarcoderdataPython |
309362 | from fetch_lords import fetch
from scrape_lords import scrape
| StarcoderdataPython |
1642491 | <filename>tests/spec/test_spec.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2018 Platform.sh
#
# 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, inclu... | StarcoderdataPython |
5197513 | <gh_stars>1-10
import os, glob, sys
import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)
import string
import re
def load_data(path):
"""Load training and testing datasets based on their path
Parameters
----------
path : relative path to location of... | StarcoderdataPython |
5039848 | # ----------------------------------------------------------------------------
# Copyright (c) 2016-2018, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... | StarcoderdataPython |
12840740 | # Copyright (c) 2020-2021, <NAME>
# License: MIT License
from pathlib import Path
import ezdxf
from ezdxf.render.forms import sphere
DIR = Path("~/Desktop/Outbox").expanduser()
doc = ezdxf.new()
doc.layers.new("form", dxfattribs={"color": 5})
doc.layers.new("csg", dxfattribs={"color": 1})
doc.layers.new("normals", ... | StarcoderdataPython |
4937392 | <filename>lisa/tools/qemu_img.py
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from lisa.executable import Tool
class QemuImg(Tool):
@property
def command(self) -> str:
return "qemu-img"
def create_diff_qcow2(self, output_img_path: str, backing_img_path: str) -> None:
... | StarcoderdataPython |
8075505 |
from wm_nctools import save_multiplier
import numpy as np
from ProcessMultipliers import processMultipliers as pM
indices = {
0: {'dir': 'n', 'min': 0., 'max': 22.5, 'fill': 0},
1: {'dir': 'ne', 'min': 22.5, 'max': 67.5, 'fill': 1},
2: {'dir': 'e', 'min': 67.5, 'max': 112.5, 'fill': 2},
3: {'dir': '... | StarcoderdataPython |
3518731 |
class Model(object):
"""ABC for models."""
@classmethod
def from_config(cls, **config):
raise NotImplementedError
| StarcoderdataPython |
1929898 |
# This file is part of the CLBlast project. The project is licensed under Apache Version 2.0. This file follows the
# PEP8 Python style guide and uses a max-width of 120 characters per line.
#
# Author(s):
# <NAME> <www.cedricnugteren.nl>
NL = "\n"
def header():
"""Generates the header for the API documentati... | StarcoderdataPython |
395517 | #
# Lincense: Academic Free License (AFL) v3.0
#
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as patches
plt.rc('text', usetex=False)
import tables as tb
import os
import tqdm
outputdir = 'output/'+'dsc_on_hc1_run.py.2016-03-17+11:39/'
outputdir = 'output/'+'dsc_on_hc1_run.py.2016-03-1... | StarcoderdataPython |
11379307 | <filename>pynoob/simpleprogram.py
__author__ = 'silvio'
def main(args):
print('hello')
| StarcoderdataPython |
8037965 | <gh_stars>1-10
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import tensorflow as tf
#import tensorflow.contrib.eager as tfe
import math
import train
from tqdm import tqdm
import pandas as pd
#
def test(model, dataset, num_dataset, c... | StarcoderdataPython |
1699201 | <reponame>ChocoYokan/PlayMix<filename>accounts/admin.py
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from accounts.models import Follow, User
class UserCustomAdmin(admin.ModelAdmin):
list_display = ('username', 'email')
admin.site.register(User, UserCustomAdmin)
admin.site.r... | StarcoderdataPython |
4988110 | from django.urls import path
from ..views import RegistroCorrispettiviView
urlpatterns = [
path("<int:azienda>/", RegistroCorrispettiviView.as_view()),
path("<int:azienda>/<periodo>/", RegistroCorrispettiviView.as_view()),
]
| StarcoderdataPython |
4935170 | from modbus_driver import Modbus_Driver
obj = Modbus_Driver("modbus_config.yaml",)
# DEFAULT: {'temperature_setpoint1': 44, 'temperature_setpoint2': 1, 'temperature_high_alarm': 6, 'temperature_low_alarm': 5, 'heartbeat': 17, 'zone1_temp': 46, 'zone2_temp': 0}
# bottom 7 seg display is setpoint and top is current te... | StarcoderdataPython |
9749546 | <reponame>p12tic/buildbot_travis<gh_stars>10-100
# Copyright 2014-2013 Isotoma 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/LICENSE-2.0
#
# Unl... | StarcoderdataPython |
4987866 | <filename>NMCE/data/datasets.py
import os
import numpy as np
import torchvision
from torch.utils.data import ConcatDataset
from .aug import load_transforms, ContrastiveLearningViewGenerator
def load_dataset(data_name, transform_name=None, use_baseline=False, train=True, contrastive=False, n_views=2, path="../../data/... | StarcoderdataPython |
5100889 | import pytest
from mikan import Counter, Number
@pytest.mark.parametrize(
"number,expkanji,expdigits,expkana",
[
(1, '一回', '1回', 'いっかい'),
(6, '六回', '6回', 'ろっかい'),
(8, '八回', '8回', 'はっかい'),
(8, '八回', '8回', 'はちかい'),
(10, '十回', '10回', 'じゅっかい'),
]
)
def test_hon_counter(n... | StarcoderdataPython |
12854309 | <reponame>CyrusBiotechnology/django-headmaster
from setuptools import setup
setup(name='django-headmaster',
version='0.0.1',
description='Add extra headers to your site via your settings file',
url='http://github.com/CyrusBiotechnology/django-headmaster',
author='<NAME>',
author_email='<E... | StarcoderdataPython |
8121490 | <reponame>IsaacXNG/CryptoArbitrage
import requests
transaction_fee = 0.005
major_currencies = ["DOGE"]
ignore_currencies = []
try:
markets = requests.get("https://www.cryptopia.co.nz/api/GetMarkets").json()
if not markets["Success"]:
exit()
except:
exit()
class graph:
"""
... | StarcoderdataPython |
3254018 | # Python 2
# Enter your code here. Read input from STDIN. Print output to STDOUT
# Observation: If you factor 9 from 9, 90, 99, 900, 909, 990, 999, ...
# you ge the binary numbers 1, 10, 11, 100, 101, 110, 111, ...
t = int(raw_input())
for i in range(t):
n = int(raw_input())
j = 1
while(in... | StarcoderdataPython |
12843586 | # When your package is installed in editable mode, you can call
# instances of that package from any directory. For example, this
# script may be run by calling
#
# python scripts/say-hello-world.py
#
# and it will call methods inside our python_ml_template project.
from math_so.utils import say_hello_world
if __... | StarcoderdataPython |
12816156 | <reponame>jachiike-madubuko/macro-scrapy<gh_stars>0
# -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://doc.scrapy.org/en/latest/topics/item-pipeline.html
from sqlalchemy.orm import sessionmaker
from scrapy.exceptions import Dro... | StarcoderdataPython |
3267488 | from cupy.cuda import device
import matplotlib.pyplot as plt
from mrrt.mri.operators.bench.bench_mri import (
bench_mri_2d_nocoils_nofieldmap,
bench_mri_2d_16coils_nofieldmap,
bench_mri_2d_16coils_fieldmap,
bench_mri_2d_16coils_fieldmap_multispectral,
bench_mri_3d_nocoils_nofieldmap,
bench_mri_... | StarcoderdataPython |
11310580 | #!/usr/bin/env python
# Copyright (c) 2014-2018, F5 Networks, 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 |
4805728 | <reponame>tferreira/slackron<gh_stars>1-10
from pathlib import Path
from yaml import load
try:
from yaml import CLoader as Loader
except ImportError:
from yaml import Loader
class Config:
def __init__(self):
self._config = load(
open('{}/.slackron.yml'.format(str(Path.home())), 'r'),
... | StarcoderdataPython |
11210981 | from helper.tile import *
def translate (mat):
# print(mat)
graph = {}
for row in range(len(mat)):
for col in range(len(mat[row])):
graph[(mat[row][col].Position)] = neighbours(row,col,mat)
return graph
def neighbours(row,col,mat):
neighbours = dict()
if(row-1 >= 0 and isVal... | StarcoderdataPython |
8196671 | from data import load_data_from_json_file
from matsmart import get_available_items
"""
Super-rudimentary testing, invoke as module;
python -m test
Returns "Passed" if the get_available_items_json result corresponds to the saved test_results.json
"""
# test_item_list = ["bovete", "chia", "matvete", "quinoa", "havr... | StarcoderdataPython |
1809368 | '''NXOS Implementation for Igmp modify triggers'''
# python
from copy import deepcopy
# pyats
from ats import aetest
# Genie Libs
from genie.libs.sdk.libs.utils.mapping import Mapping
from genie.libs.sdk.triggers.modify.modify import TriggerModify
# pyats
from ats.utils.objects import Not, NotExists
# Which key t... | StarcoderdataPython |
1773214 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''分类器,负责模型训练流程和预测流程.
fit_with_file:从文件中加载训练集和验证集
fit:意图分类模型的训练过程
predict_with_file:意图分类模型 batch test
predict:意图分类模型预测接口
save:将意图分类模型导出到模型文件中
restore:从文件中加载模型
'''
import os
import sys
import time
import traceback
import logging
import numpy as n... | StarcoderdataPython |
3282092 | <filename>kaggle_scripts.py<gh_stars>0
import numpy as np
# Functions to save solution files in the correct format for Kaggle Competition
def save_classification_file(file_to_save, names, labels):
'''
Saves the classification results in the format:
Id,Prediction
24551-2934-8931,ajuntament
30017-2... | StarcoderdataPython |
5159767 | <reponame>malfonsoNeoris/maskrcnn_tf2<filename>src/coco_minitrain.py<gh_stars>0
import os
import random
import tensorflow as tf
from common.utils import tf_limit_gpu_memory
from model import mask_rcnn_functional
from preprocess import augmentation as aug
from samples.coco import coco
from training import train_model
... | StarcoderdataPython |
6460363 | # Generated by Django 2.0.1 on 2018-06-20 20:33
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('unlabel_backend', '0002_auto_20180620_2017'),
]
operations = [
migrations.AlterField(
model_name='project',
name='sl... | StarcoderdataPython |
44846 | import cv2
'''
gets a video file and dumps each frame as a jpg picture in an output dir
'''
# Opens the Video file
cap = cv2.VideoCapture('./Subt_2.mp4')
i = 0
while(cap.isOpened()):
ret, frame = cap.read()
if i%(round(25*0.3)) == 0:
print(i)
if ret == False:
break... | StarcoderdataPython |
3564948 | <gh_stars>100-1000
from vit.formatter import Duration
class Recur(Duration):
def colorize(self, recur):
return self.colorizer.recurring(recur)
| StarcoderdataPython |
1728247 | <gh_stars>0
import ConfigParser
import ast
import grp
import json
import os
import numpy as np
import xlrd
def parseExcel(filename, clmnnames=-1, datastart=0, sheetname='Sheet1', *argv):
"""
Parse excel file into ....
filename = excel file name
clmnnames = row number where column names ... | StarcoderdataPython |
12842900 | ''' script to get predictions for movielens data '''
from measures import predictions
from processing import preprocessing
import time
import pickle
import argparse
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('--movielens_data', choices=['small', '100k'], required=True... | StarcoderdataPython |
11300710 | <reponame>alifoliveira/rep-estudos<filename>test/list_ex.py
# Function for each item
fun = [abs(x) for x in [-2, -1, 0, 1, 2]]
# List or Tuple
tup = [(y, y**2) for y in range(1, 11)]
# Loop on Loop
lista1 = []
for a in range(4):
for b in range(4):
if a != b:
lista1.append([a, b])
lista2 =... | StarcoderdataPython |
3582317 | <reponame>sukio-1024/codeitPy
# 빈 리스트 만들기
numbers = []
# numbers에 자연수 1부터 10까지 추가
i = 0
while (i < 10):
numbers.append(i + 1)
i += 1
print(numbers)
# numbers에서 홀수 제거
j = 0
while (j < len(numbers)):
if ((numbers[j] % 2) != 0):
del numbers[j]
j += 1
print(numbers)
# numbers의 인덱스 0 자리에 20이라는 값... | StarcoderdataPython |
390762 | #! usr/bin/python3.6
"""
Module initially auto generated using V5Automation files from CATIA V5 R28 on 2020-06-11 12:40:47.360445
.. warning::
The notes denoted "CAA V5 Visual Basic Help" are to be used as reference only.
They are there as a guide as to how the visual basic / catscript function... | StarcoderdataPython |
4939910 | '''
Copyright 2020 Xilinx 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, software... | StarcoderdataPython |
8127604 | <reponame>iangregson/advent-of-code<gh_stars>0
#!/usr/bin/env python3
import os
dir_path = os.path.dirname(os.path.realpath(__file__))
file = open(dir_path + "/input.txt", "r")
input_txt = file.readlines()
lines = [line.strip() for line in input_txt]
# print(lines)
class LightGrid:
def __init__(self, size):
... | StarcoderdataPython |
3575810 | """Test suite for experimental functions."""
import random
import json
from os import environ
from os.path import join, dirname
from requests.exceptions import HTTPError
from unittest import TestCase, skip
from pangea_api import (
Knex,
Sample,
Organization,
SampleGroup,
User,
RemoteObjectError... | StarcoderdataPython |
197313 | # Copyright 2011 <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, software
# ... | StarcoderdataPython |
1650533 | <filename>niimpy/exploration/eda/test_lineplot.py
"""
Created on Tue Nov 2 13:57:00 2021
@author: arsii
"""
import pytest
import plotly
from niimpy.exploration import setup_dataframe
from niimpy.exploration.eda import lineplot
def test_timeplot_single_ts():
df = setup_dataframe.create_dataframe()
fig =... | StarcoderdataPython |
3255795 | from setuptools import setup, find_packages
setup(
name='trello-cli',
version="1.1.1",
description='Trello CLI',
author='<NAME>',
url='https://github.com/whitef0x0/trello-cli',
author_email='<EMAIL>',
license='BSD License',
install_requires=["py-trello", "docopt", "python-dotenv"],
... | StarcoderdataPython |
6498091 | import json
import scipy
import numpy as np
from PIL import Image
from scipy.optimize import minimize, rosen, rosen_der
def xy_convert_paranoma(xs, rs, FOV = 240):
us = xs * (FOV / 180) * np.pi
coorsx = np.multiply(np.cos(us), rs)
coorsy = np.multiply(np.sin(us), rs)
return coorsx, coorsy
# estimate r0 r1 r2... | StarcoderdataPython |
11261404 | import skimage
from skimage.color import rgb2gray
from skimage import data, io
import matplotlib.pyplot as plt
import matplotlib
matplotlib.rcParams['font.size'] = 18
import numpy as np
import os
def kernel_creator(kernel_s,kernel_v=1, f_type=1):
kernel = np.ones(kernel_s*kernel_s).reshape(kernel_s,kernel_s)
... | StarcoderdataPython |
5073152 | <reponame>aadrm/breakoutwagtail
# Generated by Django 3.1.4 on 2021-03-19 11:19
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('streams', '0006_auto_20210319_1118'),
]
operations = [
migrations.AddField(... | StarcoderdataPython |
8068649 | """
This module defines a single AssociationItem in the AssociationsPanel.
"""
from threading import Thread
from PySide2.QtWidgets import QComboBox
from xdgprefs.gui.mime_item import MimeTypeItem
class AssociationItem(MimeTypeItem):
def __init__(self, mime_type, apps, main_window, listview):
MimeType... | StarcoderdataPython |
282909 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
Module that contains Unreal utility functions and classes
"""
from __future__ import print_function, division, absolute_import
import unreal
def get_unreal_version_name():
"""
Returns the version name of Unreal engine
:return: str
"""
return u... | StarcoderdataPython |
11201159 | #!/usr/bin/python
import os
import csv
import time
import json
import paramiko
from datetime import datetime, date
from paramiko_expect import SSHClientInteraction
BACKUP_SERVER_FQDN = ''
BACKUP_SERVER_IP = ''
BACKUP_USER = ''
BACKUP_PASS = ''
BACKUP_PATH = '/'
BACKUP_PORT = 22
def dump(host, commands, date, save_d... | StarcoderdataPython |
3961 | <filename>opensteer/teams/admin.py
from django.contrib import admin
from opensteer.teams.models import Team, Member
admin.site.register(Team)
admin.site.register(Member)
| StarcoderdataPython |
5189466 | from arango.exceptions import CollectionCreateError
from django.db.backends.base.schema import BaseDatabaseSchemaEditor
from django.db.models.base import ModelBase
class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
def create_model(self, model: ModelBase):
# TODO: Diferenciar se é edge collection.
... | StarcoderdataPython |
12840467 | try:
import feedparser, html2text, asyncio, json, datetime, telepot
from loguru import logger
from telepot.aio.loop import MessageLoop
from telepot.aio.delegate import per_chat_id, create_open, pave_event_space
except ImportError:
print("Failed to import required modules.")
class RSS(telepot.aio.h... | StarcoderdataPython |
1846240 | import arviz as az
import warnings
from importlib import reload
from typing import List, Any
from copy import copy
import altair as alt
import numpy as np
import pandas as pd
import xarray as xr
from bayes_window import models, BayesWindow
from bayes_window import utils
from bayes_window import visualization
from bay... | StarcoderdataPython |
81717 | import discord
import random
import yaml
from .ignore import canDm
with open("./conf.yaml", encoding="utf-8") as conf:
config = yaml.load(conf, Loader=yaml.FullLoader)
async def haunt(ctx, user):
target = user or ctx.author
if (canDm(target.id)):
channel = await target.create_dm()
f = ran... | StarcoderdataPython |
4886007 | <reponame>gchure/phd
#%%
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import phd.viz
colors, palette = phd.viz.phd_style()
# Load the data.
data = pd.read_csv('../../data/ch9_mscl_si/MLG910_electrophysiology.csv')
data.columns = ['time', 'pa', 'mmHg']
... | StarcoderdataPython |
5122477 | import logging
from behave import when, given, then
from veripy import custom_types # noqa
from veripy.pages import Page
logger = logging.getLogger('navigation')
@given('that the browser is at "{name}"')
def given_browser_is_at(context, name):
""" Tells the browser to load a specific page designated by an i... | StarcoderdataPython |
8000029 | """empty message
Revision ID: 8c17c134ecd4
Revises: b8b77bef3e60
Create Date: 2020-03-13 14:24:18.177162
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '8c17c134ecd4'
down_revision = 'b8b77bef3e60'
branch_labels = None
depends_on = None
def upgrade():
# ... | StarcoderdataPython |
11254681 | <reponame>Fak3/websubsub<filename>websubsub/management/commands/websub_purge_all.py
from uuid import uuid4
import logging
from django.apps import apps
from django.conf import settings
from django.core.management.base import BaseCommand
from django.urls import resolve, reverse, NoReverseMatch
from websubsub.models impo... | StarcoderdataPython |
8028371 | <filename>examples/uploads/upload_items_and_custom_format_annotations.py
def main():
"""
This is an example how to upload files and annotations to Dataloop platform.
Image folder contains the images to upload.
Annotations folder contains json file of the annotations. Same name as the image.
We read ... | StarcoderdataPython |
3450549 | import os
def _styles_contains(font, value):
for style in font["styles"]:
if value.lower() in style.lower():
return True
return False
class FontList(list):
def __init__(self, fonts=list()):
list.__init__(self, fonts)
def all():
return FontList(sorted(eval("[" + os.... | StarcoderdataPython |
11364121 | <gh_stars>1-10
import io
import os
import random
import textwrap
from io import BytesIO
import discord
from bot.cogs.utils.embed import Embeds
import PIL.Image
from discord.ext import commands
from PIL import ImageDraw, ImageFont
eupvote = '<:Upvote:822667264406192198>'
edownvote = '<:Downvote:822667263571525664>'
eco... | StarcoderdataPython |
1621654 | <filename>folderDefs_example.py
trainingDataDir = './'
nc_file = trainingDataDir+'SPCAM_outputs_sample.nc'
nc_norm_file= trainingDataDir+'normalization.nc'
LogDirMain = './TRAINS'
| StarcoderdataPython |
9760593 | <gh_stars>0
"""
Remove noise ICs from preprocessed data using fsl_regfilt
(https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/MELODIC#fsl_regfilt_command-line_program).
@author: <NAME>
"""
import os, subprocess
import pandas as pd
# input
projectdir = '/nfs/z1/zhenlab/MotorMap'
subject_list = pd.read_csv('/nfs/z1/userhome/MaSa... | StarcoderdataPython |
3383898 | <filename>docs/python_docs/themes/mx-theme/mxtheme/__init__.py
from os import path
from .card import CardDirective
__version__ = '0.3.9'
__version_full__ = __version__
package_dir = path.dirname(path.abspath(__file__))
def get_path():
return package_dir
def setup(app):
app.add_html_theme('mxtheme', package_... | StarcoderdataPython |
8136016 | <reponame>jonathansick/astropy-librarian<gh_stars>0
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Utilities for reducing HTML pages into search records.
"""
from __future__ import annotations
import logging
from copy import deepcopy
from dataclasses import dataclass
from typing import TYPE_CHECKI... | StarcoderdataPython |
8080880 | import sys
from datetime import datetime
from typing import Union
from PyQt5 import QtWidgets
from media import Episode
from ui import MessageBox, add_grid_to_layout
from ui import media_objects
class EpisodeDialog(QtWidgets.QDialog):
"""The Episode Dialog handles a user adding an Episode
to a Limited Serie... | StarcoderdataPython |
4935631 | <reponame>adriEzeMartinez/terminalDungeon
import json
import numpy as np
class Map:
"""
A helper class for easy loading of maps.
Each sprite is a dict with keys "pos","image","relative" for position,
sprite image number, and relative position to player (which will be set
after first call to cast_s... | StarcoderdataPython |
3596311 | <gh_stars>0
# Crie um programa que leia vários números inteiros pelo teclado. No final da execução, mostre a média entre todos os
# valores e qual foi o maior e o menor valores lidos. O programa deve perguntar ao usuário se ele quer ou não continuar
# a digitar valores.
n = 0
c = 0
s = 0
m = 0
continuar = ''
while c... | StarcoderdataPython |
3582092 | <filename>johann_web_basic/main.py
# Copyright (c) 2020-present, The Johann Web Basic Authors. All Rights Reserved.
# Use of this source code is governed by a BSD-3-clause license that can
# be found in the LICENSE file. See the AUTHORS file for names of contributors.
import secrets
import logzero
import requests
from... | StarcoderdataPython |
12828660 | <reponame>h11r/eventsourcing
from abc import ABC, abstractmethod
from collections import defaultdict
from threading import Event, Lock, Thread
from typing import Dict, Iterable, Iterator, List, Set, Tuple, Type, TypeVar
from eventsourcing.application import Application, NotificationLog, Section
from eventsourcing.doma... | StarcoderdataPython |
114341 | import tensorflow as tf
# Taken from https://www.tensorflow.org/guide/eager
# Eager execution works nicely with NumPy. NumPy operations accept tf.Tensor arguments.
# TensorFlow math operations convert Python objects and NumPy arrays to tf.Tensor objects.
# The tf.Tensor.numpy method returns the object's value as a Nu... | StarcoderdataPython |
9683461 | # This program is free software; you can
# redistribute it and/or modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of ME... | StarcoderdataPython |
4960162 | <filename>scenic/projects/vivit/data/video_tfrecord_dataset.py
"""Data-loader to read from SSTables using the MediaSequence format."""
import functools
import os
from typing import Dict, Iterator, List, Optional, Text, Tuple, Union
from absl import logging
from dmvr import builders
from dmvr import modalities
from dm... | StarcoderdataPython |
1988929 | <reponame>blackbotinc/AWS-Attack<filename>ttp/iam_backdoor_users_password.py
#!/usr/bin/env python3
#'description': ''This module attempts to add a password to users in the account. If all users are going to be backdoored, if it has not already been run, this module will run "enum_users_roles_policies_groups" to ... | StarcoderdataPython |
11390940 | <filename>python/num_swap.py
def num_swap(a,b):
a = a + b
b = a - b
a = a - b
return a, b
| StarcoderdataPython |
3510364 | import logging
import time
from datetime import datetime
from datetime import timedelta
from .orm import get_scoped_session, Voting, Karma, cast, Float
from .parse import Parse
from .words import Color
# FIXME: check every where for succeded POST
class KarmaManager:
__slots__ = [
'_initial_value', '_max_s... | StarcoderdataPython |
1655097 | def main():
bd = sorted(map(lambda x: tuple([x.split()[0], x.split()[1], int(x.split()[2])]), open("first_task.txt", "r").read().split("\n")))
print bd
user_list = {}
for index, user in enumerate(bd):
if user[0] not in user_list:
user_list[user[0]] = {}
if user[1] not in us... | StarcoderdataPython |
9791749 | <reponame>hvuhsg/Crawler
from Crawler.storage_types.sqlite_storage import Storage
from Crawler.crawler import Crawler
from worker import Worker
def main():
base_url = "en.wikipedia.org/wiki/Main_Page"
depth = 2
sqlite_storage = Storage(db_name="storage.db", base_url=base_url, max_depth=depth)
crawler... | StarcoderdataPython |
344524 | from django.db.models import QuerySet
class ThreadQuerySet(QuerySet):
def of_user(self, user):
return self.filter(user_threads__user=user)
def inbox(self):
return self.filter(user_threads__is_active=True)
def deleted(self):
return self.filter(user_threads__is_active=False)
d... | StarcoderdataPython |
11212547 | from paraview.simple import *
import os
mainDirName = os.getcwd() + '\\vtk\\'
fileRootFmt = '5MW_Land_ModeShapes.Mode{:d}.LinTime1.' # keep the format specifier {:d} for the mode number
nModes = 15 # number of modes to visualize
fps = 30 # frames per second (rate to save in the .avi file)
StructureModule = 'ED'... | StarcoderdataPython |
12866587 | from PyConstants import Paths
from PyConstants import Codes
from PyConstants import CacheTimes
from PyBaseTest import BaseTest
from PyRequest import PyRequest
import time
class Authentication(BaseTest):
password = "<PASSWORD>"
invalidPassword = "<PASSWORD>"
def runTests(self):
print("Runn... | StarcoderdataPython |
3358139 | # encoding: utf-8
# ---------------------------------------------------------------------------
# Copyright (C) 2008-2014, IPython Development Team and Enthought, Inc.
# Distributed under the terms of the BSD License. See COPYING.rst.
# ---------------------------------------------------------------------------
"""... | StarcoderdataPython |
3552726 | """
Everyone spend more time climbing.
"""
from climb import Climber
__all__ = ['Climber'] | StarcoderdataPython |
3468905 | <gh_stars>0
import random
n1 = str(('joao'))
n2 = str(('jose'))
n3 = str(('maria'))
n4 = str(('ana'))
ordem= [n1,n2,n3,n4]
random.shuffle (ordem)
print('a orden dos alunos será {}' .format(ordem)) | StarcoderdataPython |
6532020 | <gh_stars>1-10
import time
from flask import (
Blueprint, flash, g, redirect, render_template, request, url_for
)
from ..db import get_db
from ..utils import (
get_format_timestamp, timestamp_to_sec
)
from .auth import login_required
from .user import (
get_user_prefs
)
bp = Blueprint('workout', __name__... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.