id stringlengths 1 7 | text stringlengths 6 1.03M | dataset_id stringclasses 1
value |
|---|---|---|
3292735 | FTP_PATH = 'ftp.1000genomes.ebi.ac.uk'
BASE_PATH = '/vol1/ftp/phase3/data'
EXOME_ALIGNMENT_DIR = 'exome_alignment'
ALIGNMENT_DIR = 'alignment'
DEFAULT_FILE_FORMAT = 'bam'
OUTPUT_FOLDER = 'samples'
FORMATS = dict(bam=('bam', 'bai'), cram=('cram', 'crai'))
| StarcoderdataPython |
3396963 | #!/usr/bin/python
'''
Author:
<NAME>
<EMAIL>
www.bitforestinfo.com
Description:
This Script is Part of https://github.com/surajsinghbisht054/reinforcement_learning_scripts Project.
I Wrote this script just for Educational and Practise Purpose Only.
=================... | StarcoderdataPython |
3980 | <filename>appliance/src/ufw_interface.py
#!/usr/bin/env python
#shamelessy stolen from: https://gitlab.com/dhj/easyufw
# A thin wrapper over the thin wrapper that is ufw
# Usage:
# import easyufw as ufw
# ufw.disable() # disable firewall
# ufw.enable() # enable firewall
# ufw.allow() #... | StarcoderdataPython |
197600 | from mesher.cgal_mesher import ConstrainedDelaunayTriangulation as CDT
from mesher.cgal_mesher import (
Point, Mesher, make_conforming_delaunay, make_conforming_gabriel, Criteria
)
def main():
cdt = CDT()
va = cdt.insert(Point(100, 269))
vb = cdt.insert(Point(246, 269))
vc = cdt.insert(Point(246, ... | StarcoderdataPython |
3209199 | <gh_stars>0
# Enter positive floating-point number as input
# Output an approximation of its square root
from math import sqrt
def squareroot(x):
return(sqrt(x))
x = float(input("Please enter a positive number: "))
ans = (sqrt(x))
y = format(ans, ".1f")
print("The square root of %s is approx." % x, y)
# push t... | StarcoderdataPython |
3231405 | <filename>sktime/classification/interval_based/_cif.py
# -*- coding: utf-8 -*-
"""CIF classifier.
Interval based CIF classifier extracting catch22 features from random intervals.
"""
__author__ = ["MatthewMiddlehurst"]
__all__ = ["CanonicalIntervalForest"]
import math
import numpy as np
from joblib import Parallel,... | StarcoderdataPython |
3267321 | <gh_stars>1-10
import pandas as pd
import numpy as np
from matplotlib import pyplot as plt
import seaborn as sns
import warnings
warnings.simplefilter('ignore')
from pylab import rcParams
rcParams['figure.figsize'] = 8, 5
import time
def timeConvert(x):
return int(x[0] + x[1]) * 60 + int(x[3] + x[4])
def con... | StarcoderdataPython |
4836286 | #!/usr/bin/env python
import os
from argparse import ArgumentParser
from pprint import pprint
from cncframework import graph, parser
from cncframework.events.eventgraph import EventGraph
from cncframework.inverse import find_step_inverses, find_blame_candidates, blame_deadlocks
def pprint_inverses(graphData):
fo... | StarcoderdataPython |
3291504 | <reponame>salam20-meet/meet2018y1final-proj
from PIL import Image
import turtle
import random
import math
screen = turtle.Screen()
screen_x = 700
screen_y = 1050
screen.setup(screen_x, screen_y)
player = turtle.Turtle()
bg = Image.open('background.jpeg')
pix=bg.load()
bagr=bg.resize((700,1050),Image.ANTIALIAS)
bagr.... | StarcoderdataPython |
1676888 | <filename>tests/test_agg.py
from __future__ import annotations
import unittest
from typing import Callable
from apm import *
class AggregationsTest(unittest.TestCase):
def test_agg_set(self):
result = match([
'foo',
3,
'bar',
10,
-4,
... | StarcoderdataPython |
33785 | from django.conf.urls import url
from django.conf.urls import patterns
from django.views.generic import TemplateView
view = TemplateView.as_view(template_name='dummy.html')
urlpatterns = patterns('',
url(r'^nl/foo/', view, name='not-translated'),
)
| StarcoderdataPython |
1798591 | <reponame>CDLUC3/counter-processor
import config
import json
from models import *
from peewee import *
from .report import Report
from .id_stat import IdStat
from .json_metadata import JsonMetadata
import datetime
import dateutil.parser
import io
import datetime
#import ipdb; ipdb.set_trace()
class JsonReport(Report):... | StarcoderdataPython |
3256731 | # -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2017-02-04 19:14
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('contactboard', '0002_mare_pare_a_tutors'),
]
operations = [
migrations.RemoveField(
... | StarcoderdataPython |
10102 | import json
import requests
from datetime import datetime
from playsound import playsound
tday=datetime.today().strftime('%Y-%m-%d')
right_now=datetime.today().strftime('%I-%M-%p')
response = requests.get("https://www.londonprayertimes.com/api/times/?format=json&key=0239f686-4423-408e-9a0c-7968a403d197&year=&mont... | StarcoderdataPython |
99502 | <reponame>fcchou/gan_models
"""
Train the Yelp photo generator
Example command:
python -m examples.yelp_photos.train_photo_generator --input-path=processed_photos.npy \
--epochs=5 --batch-size=64 --iters=75
"""
import argparse
import numpy as np
import keras
import matplotlib.pyplot as plt
from gan_models.mo... | StarcoderdataPython |
53245 | #!/usr/bin/env python
import cv2
import dlib
import rospy
from sensor_msgs.msg import Image
from cv_bridge import CvBridge, CvBridgeError
from ros_face_recognition.srv import Face
import config
import face_api
_service = "/{}/faces".format(config.topic_name)
class ImageReader:
def __init__(self):
self.... | StarcoderdataPython |
3217253 | <filename>parkstay/cron.py
from datetime import date, timedelta
from django_cron import CronJobBase, Schedule
from parkstay.models import Booking
from parkstay.reports import outstanding_bookings
from parkstay.emails import send_booking_confirmation
from parkstay.utils import oracle_integration
class UnpaidBookingsRe... | StarcoderdataPython |
25481 | bind = "0.0.0.0:80"
| StarcoderdataPython |
117013 | <gh_stars>0
from __future__ import print_function
import torch
# import networkx as nx
import torch.nn as nn
import torch.nn.functional as F
class DQN(nn.Module):
def __init__(self, input_dim, hidden_dim, out_dim):
super().__init__()
self.linear_h = nn.Linear(input_dim, hidden_dim)
self.l... | StarcoderdataPython |
4838370 | <filename>blogapp/admin.py
from django.contrib import admin
from blogapp.models import UserProfile
# Register your models here.
admin.site.register(UserProfile)
| StarcoderdataPython |
149043 | <filename>tensorflow_graphics/rendering/tests/interpolate_test.py
# Copyright 2020 The TensorFlow 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
#
# https://www.apache.org/license... | StarcoderdataPython |
1779806 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Implement a simulator to mimic a dynamic order book environment
@author: ucaiado
Created on 10/24/2016
"""
import datetime
import logging
import os
import sys
import pandas as pd
import numpy as np
import pickle
import pprint
import gzip
import random
import time
from mar... | StarcoderdataPython |
3353493 | <filename>eslearn/GUI/easylearn_main_run.py
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
Main GUI of the easylearn
# Author: <NAME> <<EMAIL>>
# License: MIT
"""
import sys
import os
import json
from PyQt5.QtWidgets import QApplication, QMainWindow, QMessageBox, QFileDialog
from PyQt5.QtGui import QIcon, QPixmap
f... | StarcoderdataPython |
3293606 | import collections
import contextlib
import hashlib
import json
import os
from typing import Dict, Iterator, List, Optional
from .api import API
from . import buildroot
from . import host
from . import objectstore
from . import remoteloop
from .devices import Device, DeviceManager
from .inputs import Input
from .mount... | StarcoderdataPython |
1685785 | <reponame>Fireman730/tap-as-a-service
# Copyright (C) 2018 AT&T
# All Rights Reserved.
#
# 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/LICE... | StarcoderdataPython |
3221036 | import requests
from models import Torrent
from provider import BaseProvider
from humanize import naturalsize
class YTS(BaseProvider):
def __init__(self, base_url):
super(YTS, self).__init__(base_url)
def search(self, query):
payload = {
'query_term': query, 'sort': 'title', 'ord... | StarcoderdataPython |
157274 | import argparse
import numpy as np
def Read_Evaluation():
'''Read all files in list and evaluate the count of the variants'''
variantDict={}
sample_names=[]
varType=''
plist=open(opts.pathList)
for line in plist:
varType=line.split('/')[-1].split('_')[0]
sample_names.append... | StarcoderdataPython |
1658838 | <reponame>kuanpern/jupyterlab-snippets-multimenus
constants.physical_constants["Loschmidt constant (273.15 K, 100 kPa)"] | StarcoderdataPython |
1621181 | # This scripts initializes a Model_Manager object a Traffic_Model and Cost_Function object
# It uses as input a Demand_Assignment objects (demand per path and per time) to generate costs per path as
# a Path_Costs object
# This particular model uses a Static model and BPR Cost_Function model
import numpy as np
from co... | StarcoderdataPython |
1682557 | <reponame>0x20Man/Watcher3<filename>lib/hachoir/parser/misc/mapsforge_map.py
"""
Mapsforge map file parser (for version 3 files).
Author: <NAME>
References:
- http://code.google.com/p/mapsforge/wiki/SpecificationBinaryMapFile
- http://mapsforge.org/
"""
from hachoir.parser import Parser
from hachoir.field import (Bi... | StarcoderdataPython |
1740314 | <reponame>kalxas/eoxserver<gh_stars>10-100
# ------------------------------------------------------------------------------
#
# Project: EOxServer <http://eoxserver.org>
# Authors: <NAME> <<EMAIL>>
#
# ------------------------------------------------------------------------------
# Copyright (C) 2017 EOX IT Services Gm... | StarcoderdataPython |
4821920 | <filename>test/test_impuritysolver.py
import unittest
from pytriqs.operators import c, c_dag
from pytriqs.gf import BlockGf, GfImFreq, SemiCircular, iOmega_n, inverse
from cdmft.impuritysolver import ImpuritySolver
class TestImpuritySolver(unittest.TestCase):
def test_ImpuritySolver_initialization(self):
... | StarcoderdataPython |
1690781 | <reponame>carlocastoldi/wyvern
#!/usr/bin/env python3
#
# Copyright 2018 | <NAME> <<EMAIL>>
#
# 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
... | StarcoderdataPython |
11592 | <reponame>sohammanjrekar/HackerRank<filename>10 Days of Statistics/Day 5 - Normal Distribution I.py
"""
Day 5: Normal Distribution I
In certain plant, the time taken to assemble a car is a random variable, X having a normal distribution
with a mean of 20 hours and a standard deviation of 2 hours. What is the proba... | StarcoderdataPython |
3207758 | from collections import Counter
def solve(N, A):
ans = float('inf')
cnts = Counter(Counter(A).values())
for x in cnts.keys():
cur = 0
for y in cnts.keys():
if y > x: cur += (y - x) * cnts[y]
elif y < x: cur += y * cnts[y]
ans = min(ans, cur)
return ans
f... | StarcoderdataPython |
1628513 | import os
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
IMAGES_DIR = os.path.join(ROOT_DIR, 'tmp/images')
ARCHIVES_DIR = os.path.join(ROOT_DIR, 'tmp/archives')
TEXTS_DIR = os.path.join(ROOT_DIR, 'tmp/texts')
IMAGES_SCRAPING_TYPE = 'images-type'
TEXTS_SCRAPING_TYPE = 'texts-type'
redis_host = "localhost"
redis... | StarcoderdataPython |
4824774 | <reponame>drewmee/opcsim
d2 = opcsim.load_distribution("Marine")
d3 = opcsim.load_distribution("Rural")
ax = opcsim.plots.pdfplot(d)
ax = opcsim.plots.pdfplot(d2, ax=ax)
ax = opcsim.plots.pdfplot(d3, ax=ax)
ax.set_title("Various Aerosol Distributions", fontsize=16)
ax.legend(loc='best')
sns.despine()
| StarcoderdataPython |
3246898 | """
@package mi.dataset.parser
@file mi-instrument/mi/dataset/parser/ctdav_nbosi_auv.py
@author <NAME>
@brief Parser and particle Classes and tools for the ctdav_nbosi_auv data
Release notes:
initial release
"""
__author__ = '<NAME>'
from mi.core.log import get_logger
log = get_logger()
from mi.dataset.parser.auv_... | StarcoderdataPython |
3250139 | class Solution:
def numSpecialEquivGroups(self, A):
"""
:type A: List[str]
:rtype: int
"""
adic = collections.Counter()
l = len(A[0])
for a in A:
evenA = sorted([a[c] for c in range(0, l, 2)])
oddA = sorted([a[c] for c in range(1, l, 2... | StarcoderdataPython |
4822443 | from dataclasses import dataclass
from functools import total_ordering
from typing import Any, cast
@dataclass
class OrderElement:
name: str
value: int
# @total_ordering
class Order:
def __init__(self, client_name: str) -> None:
self.client_name = client_name
self.elements: list[OrderEle... | StarcoderdataPython |
3390721 | class HelpVar:
def __init__(self):
self.wificonfig = False
self.validconfig = False
helpobj = HelpVar()
| StarcoderdataPython |
3221153 | <reponame>dj0wns/MA_MST_Extractor-DEPRECATED-<filename>loaders/csv.py
import json
from loaders.base import Loader
"""
Dump everything in the format:
type 0 ascii str - "a:string"
type 1 float num - 123
type 2 utf16 str - "u:string"
ex:
{
"some_key": ["u:äöõö", 123, "a:hello", ...],
"some_other_key": [956, "... | StarcoderdataPython |
178259 | <filename>exercise/week4/ex2.py
def interlock(word1, word2, word3):
if (not word1) or (not word2) or (not word3):
return False
interlocked = ""
for i in range(len(min([word1, word2], key=len))):
interlocked += (word1[i] + word2[i])
if word3 == (interlocked + max([word1, word2], key=le... | StarcoderdataPython |
99510 | #!/usr/bin/env python
"""
File: DataSet
Date: 5/1/18
Author: <NAME> (<EMAIL>)
This file provides loading of the BraTS datasets
for ease of use in TensorFlow models.
"""
import os
import pandas as pd
import numpy as np
import nibabel as nib
from tqdm import tqdm
from BraTS.Patient import *
from BraTS.structure impo... | StarcoderdataPython |
150155 | <gh_stars>1-10
x=100
text="python tutorial"
print(x)
print(text)
# Assign values to multiple variables
x,y,z=10,20,30
print(x)
print(y)
print(z) | StarcoderdataPython |
1634930 | from OpenGL.GL import *
from OpenGL.GLUT import *
from OpenGL.GLU import *
from typing import Callable
from functools import wraps
class glpy:
"""Main class to initialize OpenGL and Glut functions
"""
def __init__(self, **kwargs):
"""initialize the class with the following parameters
Keyw... | StarcoderdataPython |
3302399 | import time
from .http_request import HttpRequest
from .http_response import HttpResponse
from .tp_link_cipher import TpLinkCipher
class RequestSecurePassthrough(HttpRequest):
def __init__(self, cipher: TpLinkCipher, payload: HttpRequest):
enc_payload = self.tpLinkCipher.encrypt(payload.get_payload())
... | StarcoderdataPython |
3298147 | """
Test: header removal
"""
import os
import unittest
import ediclean.paxlst as paxlst
class TestEdifact(unittest.TestCase):
def test_files(self):
testfiles_dir = os.path.join(os.path.dirname(__file__), "testfiles",
"original")
for root, dirs, files in os.wal... | StarcoderdataPython |
1659154 | """init
Revision ID: 61bc6b460d35
Revises:
Create Date: 2021-04-28 03:43:32.300947
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic... | StarcoderdataPython |
15100 | <gh_stars>1-10
# Copyright (c) 2021.
# The copyright lies with <NAME>, the further use is only permitted with reference to source
import urllib.request
from RiotGames.API.RiotApi import RiotApi
class Match(RiotApi):
__timeline_by_match_id_url: str = "https://{}.api.riotgames.com/lol/match/v4/timelines/by-mat... | StarcoderdataPython |
1765721 | from os import path
from setuptools import setup, find_packages
GAME_ENGINE_VERSION_RAW: str
cwd = path.abspath(path.dirname(__file__))
# Import GAME_ENGINE_VERSION_RAW
# TODO XXX find a more elegant way of tracking versions
with open(path.join(cwd, 'd20', 'version.py')) as f:
exec(f.read())
with open(path.join... | StarcoderdataPython |
3384931 | '''
059. Spiral Matrix II - LeetCode
https://leetcode.com/problems/spiral-matrix-ii/description/
'''
# import numpy as np
class Solution(object):
def generateMatrix(self, n):
"""
:type n: int
:rtype: List[List[int]]
"""
if n == 0:
return []
# ret = np.ze... | StarcoderdataPython |
1657311 | <reponame>Vipheak/College-Manager
import sys, os;
from PyQt5.QtWidgets import QDialog;
from PyQt5 import uic;
from PyQt5.QtCore import QFile, QIODevice, QTextStream;
#from src.lib.database import DBManager;
class DBConfig(QDialog):
nameInConfig = "";
usernameInConfig = "";
passwordInConfig = "";
hostna... | StarcoderdataPython |
9569 | #!/usr/bin/env python
# Copyright (c) 2013, Digium, Inc.
# Copyright (c) 2014-2016, Yelp, Inc.
import os
from setuptools import setup
import bravado
setup(
name="bravado",
# cloudlock version, no twisted dependency
version=bravado.version + "cl",
license="BSD 3-Clause License",
description="Lib... | StarcoderdataPython |
1734965 | <gh_stars>0
from pid import PID
from lowpass import LowPassFilter
from yaw_controller import YawController
import rospy
GAS_DENSITY = 2.858
ONE_MPH = 0.44704
class Controller(object):
def __init__(self, vehicle_mass, fuel_capacity, brake_deadband,
decel_limit, accel_limit, wheel_radius, wheel_b... | StarcoderdataPython |
121034 | from djfilters import filters
from .models import (BooleanModel, DateFieldModel, EmailModel, IpModel,
NumberModel, RelatedIntIdModel, RelatedSlugIdModel,
TextModel)
# Simple Filters
class TextFieldFilter(filters.Filter):
text = filters.CharField(max_length=10, required=... | StarcoderdataPython |
61095 | <reponame>dfioravanti/tangles<filename>test/test_utils.py
import pytest
from src.utils import merge_dictionaries_with_disagreements, matching_items
class Test_matching_items():
def test_two_match(self):
d1 = {1: True, 2: True, 4: False}
d2 = {1: True, 2: True, 3: False}
expected = [1, 2]... | StarcoderdataPython |
1621668 | from synapyse.base.input_functions.input_function import InputFunction
from synapyse.base.neuron import Neuron
__author__ = '<NAME>'
class BiasNeuron(Neuron):
def __init__(self, activation_function):
"""
:type activation_function: synapyse.base.activation_functions.activation_function.ActivationF... | StarcoderdataPython |
3345220 | <filename>KF/AUKF.py
# Author: <NAME>
# Affiliation: Kyoto University
# ======================================================================
# 1. (IMPORTANT:CITATION ALERT)
# This script is largely an adaptation of the paper DOI:10.3390/s18030808 (Zheng et al., Sensors, 2018).
# This paper was chosen as the basis for... | StarcoderdataPython |
1734286 | from stenway.reliabletxt import *
class WsvChar:
def isWhitespace(c):
return (c == 0x09 or
(c >= 0x0B and c <= 0x0D) or
c == 0x0020 or
c == 0x0085 or
c == 0x00A0 or
c == 0x1680 or
(c >= 0x2000 and c <= 0x200A) or
c == 0x2028 or
c == 0x2029 or
c == 0x202F or
c == 0x205F or
... | StarcoderdataPython |
3252873 | <reponame>adsonrodrigues/customers
from django.core.management.base import BaseCommand, CommandError
from clients.models import Profile
from django.conf import settings
import environ
import googlemaps
import csv
env = environ.Env()
environ.Env.read_env()
class Command(BaseCommand):
help = 'Populanting database... | StarcoderdataPython |
173471 | import multiprocessing
import pickle
import random
import sys
from collections import defaultdict
from math import ceil, sqrt
import numpy as np
from scipy.stats import norm, skewnorm
from tqdm import tqdm
sys.path.append('..')
import features
INCOME_SECURITY = {
'employee_wage': 0.8,
'state_wage': 0.9,
... | StarcoderdataPython |
1633488 | <reponame>philsupertramp/django-data-migration
import os.path
from tests.utils import ResetDirectoryMixin
this_dir = os.path.dirname(__file__)
class ResetDirectoryContext(ResetDirectoryMixin):
targets = ['migrations', 'data_migrations']
protected_files = ['__init__.py', '0001_first.py', '0002_add_name.py']
... | StarcoderdataPython |
1766738 | import numpy as np
from simglucose.analysis.risk import risk_index, magni_RI
bg_opt=112.517 #The risk function has a minimun here, ris(112.517)=0
def stepReward3(BG,CGM, CHO, insulin, done=False):
bg_current=BG
LBGI, HBGI, RI = risk_index([bg_current], 1)
mRI = magni_RI([bg_current], 1)
if bg_current >= 7... | StarcoderdataPython |
1631159 | import redis
from xjkj import settings
from django_redis import get_redis_connection
class IpConn(object):
__instance = None
def __init__(self):
self._conn = redis.Redis(host=settings.REDIS_ADDR, port=settings.REDIS_PORT, db=3)
def __new__(cls, *args, **kwargs):
if cls.__instance == None:
cls.__instanc... | StarcoderdataPython |
50285 | <reponame>chrishendra93/dinner_at_clemz
from .all_messages import *
__all__ = [
'Eko', 'Emil', 'Marco', 'Ida', 'Karin', 'Rika', 'Zefa', 'Jason', 'Billy', 'Kafi', 'Indrik', 'Toto', 'Acang', 'Bena'
]
| StarcoderdataPython |
4835472 | <reponame>babatana/stograde
from dataclasses import dataclass, field
from typing import List
@dataclass
class SubmissionWarnings:
"""Track any warnings about the assignment"""
assignment_missing: bool = False # No assignment submission could be found
recording_err: str = None # Something raised an error... | StarcoderdataPython |
1645389 | # -*- coding: utf-8 -*-
#
# Copyright (c) 2016-2017 <NAME>
# Copyright (c) 2018 <NAME> (Kronuz)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limita... | StarcoderdataPython |
3223319 | <gh_stars>1-10
"""Remote control support for Apple TV."""
import asyncio
from haphilipsjs.typing import SystemType
from openpeerpower.components.remote import (
ATTR_DELAY_SECS,
ATTR_NUM_REPEATS,
DEFAULT_DELAY_SECS,
RemoteEntity,
)
from . import LOGGER, PhilipsTVDataUpdateCoordinator
from .const imp... | StarcoderdataPython |
3375841 | from algorithm.numberTheory.fibonacci import fibonacci_log_n
from tests.base_test_case import BaseTestCase
class SearchTest(BaseTestCase):
def setUp(self):
super().setUp()
self.num = 100
def test_fibonacci_log_n(self):
print(fibonacci_log_n(self.num))
| StarcoderdataPython |
3245898 | #
# Copyright (C) 2009-2010 <NAME>, <NAME>
#
# 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; either version 2
# of the License, or (at your option) any later version.
#
# This program is distrib... | StarcoderdataPython |
3208593 | <filename>backend/app/main.py
from fastapi import FastAPI, Depends, HTTPException
from fastapi.middleware.cors import CORSMiddleware
from sqlalchemy.orm import Session
from app.database import crud, models, schemas, SessionLocal, engine
from app.validate_wasm import validate_wasm
from typing import List
models.... | StarcoderdataPython |
170855 | <gh_stars>0
"""
The LSB implementation of the GIF steganography suite
"""
from maybe_open import maybe_open
import struct
all_data = bytearray()
def copy_blocks(in_f, out_f):
"""
Copy through blocks of data
"""
while True:
# Read the block size
block_size = in_f.read(1)
if len... | StarcoderdataPython |
49368 | from .provider import Provider
class NullProvider(Provider):
def connect(self):
pass
def close(self):
pass
def get_table_columns(self, table_name):
return []
def get_tables(self):
return []
def execute(self, query, **kwargs):
return None
def clear_ta... | StarcoderdataPython |
3394814 | # -*- coding: utf-8 -*-
import sys
import csv
import json
def get_selection(pref_code):
QUIZ_SELECTION = {
"01": ["北海道", "新潟県", "青森県", "秋田県"],
"02": ["青森県", "岩手県", "秋田県", "山形県"],
"03": ["岩手県", "山形県", "秋田県", "宮城県"],
"04": ["宮城県", "岩手県", "福島県", "山形県"],
"05": ["秋田県", "青森県", "... | StarcoderdataPython |
1770534 | <filename>login/views.py<gh_stars>0
# encoding: utf-8
from django.shortcuts import render
import logging
import urllib
import urllib2
import json
from django.http import HttpResponseRedirect,HttpResponse
from mysite import settings
from django.core.urlresolvers import reverse
from Xromate.lib.User import Users
import l... | StarcoderdataPython |
3370658 | from datetime import datetime
from typing import Tuple
from unittest import mock
from freezegun import freeze_time
from google.appengine.ext import testbed
from werkzeug.test import Client
from backend.common.consts.event_type import EventType
from backend.common.helpers.event_insights_helper import EventInsightsHelp... | StarcoderdataPython |
185891 | <gh_stars>10-100
from PIL import Image
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from repalette.constants import RAW_DATABASE_PATH
from repalette.datasets import AbstractQueryDataset
from repalette.db.raw import RawImage
class RawDataset(AbstractQueryDataset):
"""
Dataset o... | StarcoderdataPython |
4803388 | import argparse
parser = argparse.ArgumentParser(description='Split a mem into serverl mems.')
parser.add_argument('--filename', type=str, required=True, help='mem initial file path')
def main(file):
f = open(file, "r")
res = []
for line in f:
line = line.strip()
if line == '':
... | StarcoderdataPython |
1721485 | <reponame>nosoyyo/blox<gh_stars>0
# -*- coding: utf-8 -*-
# flake8: noqa
# @absurdity
# pipelines esp. for blox
__author__ = 'nosoyyo'
#############################################################
#·TwitterPipeline·isn't·working·well·due·to·the·wall·u·know·#
###########################################################... | StarcoderdataPython |
1789304 | import numpy as np
import logging
from benchmarker import benchmark
logger = logging.getLogger('exp11_blocked_matrices')
@benchmark
def blocked_solve_naive(A1, A2, B, C):
C = np.linalg.solve(np.concatenate(
(np.concatenate((A1, np.zeros((A1.shape[0], A1.shape[1]), dtype=np.float64)), axis=1),
np... | StarcoderdataPython |
137231 | for _ in range(150):
for _ in range(51):
print(1, end = ' ')
print() | StarcoderdataPython |
140845 | from django.db import models
class Document(models.Model):
description = models.CharField(max_length=255, blank=True)
document = models.FileField(upload_to='')
uploaded_at = models.DateTimeField(auto_now_add=True)
def __str__(self):
return self.document.name
# pylint: disable=arguments-... | StarcoderdataPython |
166734 | <gh_stars>1-10
"""
ゼロから学ぶスパイキングニューラルネットワーク
- Spiking Neural Networks from Scratch
Copyright (c) 2020 HiroshiARAKI. All Rights Reserved.
"""
import numpy as np
import matplotlib.pyplot as plt
class HodgkinHuxley:
def __init__(self, time, dt, rest=-65., Cm=1.0, gNa=120., gK=36., gl=0.3, ENa=50., EK=-77., El=-54.3... | StarcoderdataPython |
80297 | <filename>Codes/fengxuanmo/2_add_two_nums/add_two_nums.py
#! coding:utf-8
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
def addTwoNumbers(l1, l2):
"""
:type l1: ListNode
:type l2: ListNode
:rtype: ListNode... | StarcoderdataPython |
114445 | <reponame>kiteco/kiteco-public<gh_stars>10-100
from datetime import timedelta
import base64
import hashlib
import mixpanel
import gzip
import json
import customerio
from airflow.contrib.operators.s3_list_operator import S3ListOperator
# The DAG object; we'll need this to instantiate a DAG
from airflow import DAG
# Oper... | StarcoderdataPython |
165318 | import os
from whitenoise import WhiteNoise
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project_backend.settings')
application = get_wsgi_application()
application = WhiteNoise(application, root='/frontend/build/static')
application.add_files('/static', prefix='m... | StarcoderdataPython |
3318251 | import google.protobuf.json_format as pbjson
import os
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import cv2
import LabeledImage_pb2
import argparse
import deepracing.imutils as imutils
import torchvision
import torchvision.utils as tvutils
import torchvision.transforms.f... | StarcoderdataPython |
146457 | <reponame>LivingLogic/LivingApps.Python.LivingAPI
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# cython: language_level=3, always_allow_keywords=True
## Copyright 2016-2020 by LivingLogic AG, Bayreuth/Germany
##
## All Rights Reserved
"""
vSQL is a subset of UL4 expressions retargeted for generating SQL exp... | StarcoderdataPython |
34462 | <reponame>ceafdc/PythonChallenge<gh_stars>1-10
#!/usr/bin/env python3
# url: http://www.pythonchallenge.com/pc/return/5808.html
import requests
import io
import PIL.Image
url = 'http://www.pythonchallenge.com/pc/return/cave.jpg'
un = 'huge'
pw = 'file'
auth = un, pw
req = requests.get(url, auth=auth)
img_io = io.Byt... | StarcoderdataPython |
1747593 | <filename>pydis_site/apps/api/models/bot/role.py
from __future__ import annotations
from django.core.validators import MinValueValidator
from django.db import models
from pydis_site.apps.api.models.mixins import ModelReprMixin
class Role(ModelReprMixin, models.Model):
"""
A role on our Discord server.
... | StarcoderdataPython |
4819139 | import os
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_debugtoolbar import DebugToolbarExtension
from flask_cors import CORS
db = SQLAlchemy()
toolbar = DebugToolbarExtension()
cors = CORS()
def create_app():
app = Flask(__name__)
app.debug = True
app_settings = os.getenv(... | StarcoderdataPython |
1700326 | <gh_stars>1-10
import json
import uuid
import azure.functions as func
from scraper_pipeline.models import page_content
from scraper_pipeline.process import state_processor
def main(msg: func.ServiceBusMessage, notification: func.Out[str]):
json_str = msg.get_body().decode('utf-8')
content = page_content.Page... | StarcoderdataPython |
1614339 | import copy
import json
import base64
from functools import partial
import asyncio
import collections
from .values import DocStringLine, MetricValue
from .registry import Registry
from .task_manager import TaskManager
REGISTRY = Registry(task_manager=TaskManager())
DEFAULT_GAUGE_INDEX_KEY = 'GLOBAL_GAUGE_INDEX'
... | StarcoderdataPython |
3284349 | <filename>foundation/erpnext_foundation/doctype/service_provider/service_provider.py
# -*- coding: utf-8 -*-
# Copyright (c) 2015, EOSSF and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils import get_datetime
from frappe.model.docum... | StarcoderdataPython |
3380946 | <reponame>TachibanaET/CODSUG2<filename>source/model_fine_tune.py<gh_stars>0
import json
import os
import numpy as np
import argparse
from tqdm import tqdm
from utility.encode_bpe import BPEEncoder_ja
import torch
import torch.nn.functional as F
import torch.optim as optim
from transformers import GPT2Tokenizer, GPT2LMH... | StarcoderdataPython |
3344832 | <gh_stars>10-100
from .target import *
from .enumerator import Enumerator, start_tls
| StarcoderdataPython |
185195 | <reponame>osamuaoki/fun2prog
#!/usr/bin/python
# vi:ts=4:sts=4:et
# == c-list
# 0 context-switches
# 0 cpu-migrations
# 784 page-faults
# 484275890 cycles
# 131868649 stalled-cycles-frontend
# 15810580 stalled-cyc... | StarcoderdataPython |
125465 | # Standard imports
import cv2
import argparse
import numpy as np
ap = argparse.ArgumentParser()
ap.add_argument('-i', '--image', required=False, help='Path to the image')
args = vars(ap.parse_args())
# Read image
image = cv2.imread(args['image'])
# image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
dim = (320, 240)
... | StarcoderdataPython |
135876 | import os
from GenericBase import GenericBase
from STAPLERerror import VirtualIOError
from STAPLERerror import STAPLERerror
import utils
class samtools_index(GenericBase):
"""Class for creating command lines for samtools index.
Parameters:
in_cmd: String containing a command line
in_dir... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.