id stringlengths 2 8 | text stringlengths 16 264k | dataset_id stringclasses 1
value |
|---|---|---|
11338452 | # coding=utf-8
"""
Config value that will be cast as a boolean
"""
import tomlkit.container
from elib_config._types import Types
from ._config_value import ConfigValue
from ._exc import ConfigValueTypeError
class ConfigValueBool(ConfigValue):
"""
Config value that will be cast as a boolean
"""
@prop... | StarcoderdataPython |
1718709 | <filename>math.py
#!/usr/bin/env python
#
# Simple script that performs arbitrary math operations
#
# Needs PyExpressionEval, install with `pip install py_expression_eval`
#
# Config usage:
# => exec=python
# => params=path/to/math.py
# => name="Math"
#
from __future__ import print_function
from py_expression_eval imp... | StarcoderdataPython |
1776983 | <filename>src/asce/__init__.py
# -*- coding: utf-8 -*-
from . import core
__version__ = '0.0.1'
get_path_list = core.get_path_list
get_template_path_list = core.get_template_path_list
get_parameter_path_list = core.get_parameter_path_list
load_template = core.load_template
load_parameter = core.load_parameter
fin... | StarcoderdataPython |
1886919 | <reponame>xiaolinzi-xl/Algorithm-Interview-Study<filename>09-dynamic-programming/leetcode_300.py
class Solution:
def rebot(self, nums, index):
if index == 0:
return 1
res = 1
for i in range(index-1, -1, -1):
if nums[index] > nums[i]:
res = max(res, s... | StarcoderdataPython |
8062138 | # Copyright 2017-2021 EPAM Systems, Inc. (https://www.epam.com/)
#
# 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 appli... | StarcoderdataPython |
1867631 | #!/usr/bin/env python
import logging
import datetime
import sys
import json
import warnings
sys.path.append('../')
warnings.filterwarnings("ignore")
import pandas as pd
from scipy import stats
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.model_selection import RandomizedSearchCV
import l... | StarcoderdataPython |
8194492 | <gh_stars>0
# @l2g 1881 python3
# [1881] Maximum Value after Insertion
# Difficulty: Medium
# https://leetcode.com/problems/maximum-value-after-insertion
#
# You are given a very large integer n,represented as a string, and an integer digit x.
# The digits in n and the digit x are in the inclusive range [1,9],
# ... | StarcoderdataPython |
8055628 | <filename>rosalind/ini4/ini4.py
import sys
if __name__=="__main__":
a, b = sys.stdin.readline().strip().split()
a, b = int(a), int(b)
if a % 2 == 0: a += 1
print(sum(range(a, b+1, 2)))
| StarcoderdataPython |
11299183 | import datetime
from django.db import models
from employees.models import Employee
# Create your models here.
class Task(models.Model):
state = [
("pending", "pending"), ("assigned", "assigned"),
("incomplete", "incomplete"), ("complete", "complete")
]
task_name = models.CharField(max_len... | StarcoderdataPython |
6458347 | <gh_stars>1-10
from behave import *
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
@given(u'we have navigated to {url}')
def step_impl(context, url):
browser = webdriver.Chrome()
browser.get(url)
context.browser = browser
time.sleep(5)
@when(u'we change {s... | StarcoderdataPython |
9712174 | <gh_stars>0
'''
@File : iplocation.py
@Time : 2020/12/14 19:55:19
@Author : <NAME>
@Contact : <EMAIL>
@License : Copyright (c) 2020 <NAME>
'''
import os
import json
import time
import datetime
import urllib.request
import logging as log
from IPy import IP
import IP2Location
from urllib.error import H... | StarcoderdataPython |
6464417 | <gh_stars>1-10
import sys
import argparse
import signal
import re
import json
from .checks import detectandcheck, allchecks
from .checks import checkrsa, checkcrt, checksshpubkey
from .allkeys import urllookup, loadextrabl
from .scanssh import scanssh
from .scantls import scantls
from .update import update_bl
MAXINPU... | StarcoderdataPython |
6441681 | import turtle
#note: the horizontal and vertical distance between the sides is constant
#hence (distance + 2)
def spiral(turtle, counter, sides, distance, angle):
if counter == sides: return
else:
turtle.forward(distance)
turtle.right(angle)
spiral(turtle, counter + 1, sides, distance... | StarcoderdataPython |
12856096 | <reponame>lycantropos/rsrc_web
from .literals import booleans
from .models import (readable_web_streams,
web_streams,
writeable_web_streams)
from .paths import web_url_strings
| StarcoderdataPython |
8199122 | <reponame>ju-sh/colorviews
"""
colorviews module
"""
__all__ = ["Color", "AlphaColor", "scale"]
__version__ = "0.1-alpha1"
__author__ = "<NAME>"
from colorviews.colors import Color, AlphaColor
from colorviews.utils import scale
| StarcoderdataPython |
126353 | <reponame>michdr/satzify
WHAT_IS_SATZIFY = (
"Satzify is a simple tool to help with analysing sentences in a given language. "
"It helps with visualising and highlighting the different parts "
"of a sentence according to the selected categories and parts to annotate. "
"Initially and predominantly it ha... | StarcoderdataPython |
12828565 | <reponame>1024sparrow/traliva
#!/usr/bin/env python3
import sys, re
def get_map(pin_js_paths, pin_css_paths, pout_js, pout_css, pout_js_css):
for i_src in [(pin_js_paths, pout_js), (pin_css_paths, pout_css)]:
for i in i_src[0]:
with open(i) as f:
cand = {
'f... | StarcoderdataPython |
3518179 | <reponame>arnaudsm/brep
import os
import pathlib
import gzip
class File():
def __init__(self, file) -> None:
if isinstance(file, str):
self.path = pathlib.Path(file)
elif isinstance(file, pathlib.Path):
self.path = file
else:
raise Exception("Please prov... | StarcoderdataPython |
3363667 | <reponame>Lauszus/socketsocketcan
from socketsocketcan import TCPBus
import can
from datetime import datetime
from time import sleep
bus = TCPBus(5000)
print("socket connected!")
#create a listener to print all received messages
listener = can.Printer()
notifier = can.Notifier(bus,(listener,),timeout=None)
try:
... | StarcoderdataPython |
11326862 | <gh_stars>1000+
import pygments
class SimplifiedHTTPLexer(pygments.lexer.RegexLexer):
"""Simplified HTTP lexer for Pygments.
It only operates on headers and provides a stronger contrast between
their names and values than the original one bundled with Pygments
(:class:`pygments.lexers.text import Htt... | StarcoderdataPython |
3511275 | <reponame>techshot25/gpytorch<filename>gpytorch/models/pyro_variational_gp.py
#!/usr/bin/env python3
import torch
import pyro
from .abstract_variational_gp import AbstractVariationalGP
class PyroVariationalGP(AbstractVariationalGP):
def __init__(self, variational_strategy, likelihood, num_data, name_prefix=""):
... | StarcoderdataPython |
351639 | # -*- coding: utf-8 -*-
"""
Created on Wed May 25 15:37:43 2016
@author: mtkessel
"""
import queue as Q
import serial
import threading
import time
import weakref
class LLAP(serial.Serial):
"""Lightweight Local Automation Protocol (LLAP) defines a small device
protocol that balances simplicity and human re... | StarcoderdataPython |
5077963 | #!/usr/bin/env python
import ngs_utils.ensembl as ebl
import os
import shutil
from optparse import OptionParser, SUPPRESS_HELP
from os.path import isfile, join, basename, dirname, pardir
from ngs_utils import logger
from ngs_utils.file_utils import file_transaction, adjust_path, safe_mkdir, verify_file
''' Generates... | StarcoderdataPython |
5078718 | <reponame>windystrife/UnrealEngine_NVIDIAGameWork
import maya.cmds as cmds
import maya.OpenMaya as om
from functools import partial
# This script walks along the surface of a mesh from a single component and find the nearest N verts based on the number you pass into it (count).
# It then selects these verts ... | StarcoderdataPython |
3437934 | <reponame>mlweilert/bpnet
"""Small helper-functions for used by modisco classes
"""
import pandas as pd
import numpy as np
from kipoi.readers import HDF5Reader
from bpnet.cli.contrib import ContribFile
from bpnet.functions import mean
import warnings
def bootstrap_mean(x, n=100):
"""Bootstrap the mean computation... | StarcoderdataPython |
3362823 | <reponame>rsouza01/cli-plugin
# -*- coding: utf-8 -*-
# from setuptools import setup, find_packages
import setuptools
with open('README.md') as f:
readme = f.read()
with open('LICENSE') as f:
license = f.read()
setuptools.setup(
name='cli-plugin',
packages=['cli-plugin'],
version='0.2.3',
de... | StarcoderdataPython |
9785649 | <reponame>ChangedLater/feeding-nemo<gh_stars>0
import RPi.GPIO as GPIO
from time import sleep
GPIO.setmode(GPIO.BCM)
class Motor:
def __init__(self,pin):
self.pin = pin
self.cycle = 50
self.minAngle = 90
self.maxAngle = 270
self.centreDuty = 7.5 #the duty cycle for the centr... | StarcoderdataPython |
3461471 | <gh_stars>0
import streamlit as st
st.set_page_config(layout='wide', page_title='Seismic Viewer')
import pandas as pd
import numpy as np
from obspy import read
import plotly.graph_objects as go
# event handling
from plotly.callbacks import Points, InputDeviceState
# local module
from load import loadData
def click_f... | StarcoderdataPython |
3361535 | <reponame>digambar15/ironic<gh_stars>1-10
# 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 |
6413653 | <gh_stars>10-100
from __future__ import annotations
from entities.entity import Entity
from arweave.arweave_lib import Wallet
from graphql.query import get_tag_value_from_query
from typing import List
TAG_EXTENDS = "extends"
TAG_TRUSTED_SOURCES = "trustedSources"
TAG_NAME = "name"
TAG_METADATA_TAGS = "metadat... | StarcoderdataPython |
249253 | #!/usr/bin/env python
import logging
import os
import sys
if os.environ.get("NVHTOP_DEBUG"):
LEVEL = logging.DEBUG
else:
LEVEL = logging.INFO
sys.path.insert(0, os.path.dirname(os.path.abspath(os.path.join(__file__, os.pardir))))
logging.basicConfig(
format="%(asctime)s - %(levelname)s - %(name)s - %(mess... | StarcoderdataPython |
3443147 | import os
import sys
import errno
import argparse
import logging
import docker
import docker.errors
from .. import dockerutils
_DEFAULT_LOG_FORMAT = "%(name)s : %(threadName)s : %(levelname)s : %(message)s"
logging.basicConfig(
stream=sys.stderr,
format=_DEFAULT_LOG_FORMAT,
level=logging.INFO,
)
SETUP_S... | StarcoderdataPython |
348501 | <reponame>bincrafters/conan-bazel_installer<filename>conanfile.py<gh_stars>1-10
from conans import ConanFile, tools
from conans.errors import ConanException
from conans.errors import ConanInvalidConfiguration
import os
import platform
class BazelInstallerConan(ConanFile):
name = "bazel_installer"
version = "... | StarcoderdataPython |
1809789 | # YouTube: https://youtu.be/6hVTr0bcBc0
# Publicação: https://caffeinealgorithm.com/blog/20210922/funcao-input-em-python/
primeiroNome = input('Insere o teu primeiro nome: ')
ultimoNome = input('Insere o teu último nome: ')
idade = input('Insere a tua idade: ')
print('Primeiro nome:', primeiroNome)
print('Últ... | StarcoderdataPython |
226440 | <reponame>TreZc0/donation-tracker
import urllib.parse
import post_office.models
from django.contrib.auth import get_user_model
from django.test import TestCase, RequestFactory
from django.test import override_settings
from django.urls import reverse
from django.utils.encoding import force_bytes
from django.utils.http ... | StarcoderdataPython |
6682069 | <reponame>PhilipeRLeal/bootstrap_analyses<gh_stars>0
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 26 11:47:43 2020
@author: Philipe_Leal
"""
import pandas as pd
import numpy as np
a = np.random.normal(size=10)
b = np.random.normal(size=10)
c = np.random.normal(size=10)
def diff_multi(*args):
Multi = pd.Mult... | StarcoderdataPython |
9637136 | <filename>ute/utils/visualization.py
#!/usr/bin/env python
"""Class for visualization of trained embedding: PCA or t-SNE methods are used
for dimensionality reduction."""
__author__ = '<NAME>'
__date__ = 'August 2018'
import matplotlib.pyplot as plt
import numpy as np
from sklearn.decomposition import PCA
from sklea... | StarcoderdataPython |
4925874 | <reponame>YouhuaLi/metamath-turing-machines
"""Framework for building Turing machines using a register machine abstraction
and binary decision diagrams in place of subprograms."""
# Tape layout: PC:bit[NNN] 0 0 ( 1 1* 0 )*
#
# each thing after the PC is a unary register.
#
# There is a "dispatch" state which assumes th... | StarcoderdataPython |
214485 | <reponame>MaciejNowicki/celery_dill_serializer
import os
from setuptools import setup
VERSION = '0.1.3'
def readme(*paths):
with open(os.path.join(*paths), 'r') as f:
return f.read()
def requirements(*paths):
with open(os.path.join(*paths), 'r') as f:
return list(line.strip() for line in f... | StarcoderdataPython |
1745766 | <filename>my_project/my_project/common/migrations/0001_initial.py<gh_stars>0
# Generated by Django 4.0.3 on 2022-03-28 09:47
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
... | StarcoderdataPython |
9646228 | """Did Model."""
from masoniteorm.models import Model
class Did(Model):
__table__="dids" | StarcoderdataPython |
3266462 | <gh_stars>1-10
class <caret>B(C):
def __init__(self):
C.__init__(self) | StarcoderdataPython |
6611792 | <gh_stars>1-10
# =================================================#
# gsn_vector_1.ncl
# =================================================#
#
# This file is loaded by default in NCL V6.2.0 and newer
# load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
# =================================================#
from path... | StarcoderdataPython |
1677465 | <filename>py2d.py
from math import sqrt
from PIL.Image import Image
import math
class Point2d:
def __init__(self, x_init, y_init):
self.x = x_init
self.y = y_init
def shift(self, x, y):
self.x += x
self.y += y
def distanceto(self, b, axis=None):
if (axis == 'x'):
... | StarcoderdataPython |
3201149 | # -*- coding: utf-8 -*-
"""OpenCTI CrowdStrike connector module."""
from crowdstrike.core import CrowdStrike
__all__ = ["CrowdStrike"]
| StarcoderdataPython |
6596142 | <reponame>gianimpronta/SentiHIV
from keras import models
from keras.layers import Dropout, Dense
class ModelBuilder:
def __init__(self, layers, units, dropout_rate, input_shape):
self.layers = layers
self.units = units
self.dropout_rate = dropout_rate
self.input_shape = input_shap... | StarcoderdataPython |
1982417 | <reponame>pplotn/SeismicPro
"""File contains metircs for seismic processing."""
# pylint: disable=no-name-in-module, import-error
import inspect
import numpy as np
from numba import njit, prange
from ..batchflow.models.metrics import Metrics
from .plot_utils import plot_metrics_map
class MetricsMap(Metrics):
""... | StarcoderdataPython |
9717041 | <reponame>Matheus1714/Python<filename>CCI/Find_Roots/Newton_Raphson.py<gh_stars>1-10
import math
def function(x):
return x**3-x-1
def differential(x):
return 3*x**2-1
def main():
x0, e = map(float, input().split())
i=0
while True:
i+=1
x1 = x0 - function(x0)/differential(x0)
... | StarcoderdataPython |
3567012 |
import pandas as pd
import numpy as np
txt = ['this is fake text',
"i don't care what this text says",
"please don't abandon me",
"it needs preprocessing but i really don't want to do that right now"]
txt = pd.DataFrame({'text':txt})
txt['txt'] = txt['text'].apply(lambda x: "".join([i for i in... | StarcoderdataPython |
6642675 | from tkinter import *
from tkinter import ttk
import tkinter.filedialog as filedialog
from tkinter import messagebox
from PIL import Image,ImageDraw,ImageFont
from PIL import ImageTk,ImageGrab
import cv2
import numpy as np
import os
from predictionModel import predictionCNN
root=Tk()
root.title('Rootster v.0 ')
root.g... | StarcoderdataPython |
1921880 | import argparse
import os
import sys
from src.crawlers.BrowserRobot import BrowserRobot
from src.crawlers.CostcoCrawler import CostcoCrawler
from config.print_path import print_path
from src.crawlers.BestBuyCrawler.BestBuyCrawler import BestBuyCrawler
if __name__ == '__main__':
# parser = argparse.ArgumentParser(d... | StarcoderdataPython |
3299996 | <reponame>KeiichiHirobe/tcp-keepalives<filename>test-dead2.py
import io
import os
import select
import socket
import time
import utils
utils.new_ns()
port = 1
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0)
s.bind(('127.0.0.1', port))
s.listen(16)
tcpdump = utils.tcpdump_start(port)
c = socket.socket(sock... | StarcoderdataPython |
11210325 | from src.enums.Rotations import Rotations
import random
class Ship:
type = 'Ship'
size = 2
def __init__(self):
self.rotation = random.choice(list(Rotations))
| StarcoderdataPython |
1939200 | # Copyright (C) 2018 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Ignoring flake8 warnings because init file is used for importing package
# members.
from ggrc.cache.localcache import LocalCache # Noqa
from ggrc.cache.memcache import MemCache # Noqa
from ggrc.cache.cac... | StarcoderdataPython |
4924923 | '''Calculate Coefficient of variation'''
# import libraries
import pandas as pd
# Read dataset
dataset = pd.read_csv('19_coefficient_of_variation_players_data.csv')
player_a_mean = dataset['PlayerA'].mean() # Answer 49.8
player_a_sd = dataset['PlayerA'].std() # Answer 44.57
# Player A Coefficient of variation
payer... | StarcoderdataPython |
3498370 | ###############################################################################
# Scalability benchmark
#
# <NAME>
# Dec, 2018
#
# Plotting time taken as dimensionality increases
###############################################################################
import os
import timeit
import numpy as np
import infotheory
... | StarcoderdataPython |
12818337 | <filename>bus_system/apps/bus_driver/serializer.py
from rest_framework.serializers import ModelSerializer
# Imports from your apps
from bus_system.apps.bus_driver.models import BusDriverModel
class BusDriverSerializer(ModelSerializer):
"""
Bus Driver serializers.
"""
class Meta:
model = BusD... | StarcoderdataPython |
4863893 | <gh_stars>0
import requests
from json import loads
def data_return():
data = loads(requests.get("https://simplecovidapi.herokuapp.com").text)
return data['cases'], data['deaths'], data['recoveries']
| StarcoderdataPython |
5123789 | <gh_stars>0
import tensorflow as tf
import numpy as np
import sys,os
import argparse
parser = argparse.ArgumentParser(description='Finetune AHLF and store finetuned weights.')
parser.add_argument('model_weights', type=str, help='[loaded:] trained model weights')
parser.add_argument('finetuned_weights', type=str, hel... | StarcoderdataPython |
8035037 | # Generated by Django 2.2.17 on 2021-03-08 14:10
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ucsrb', '0021_pourpointbasin_segment_id'),
]
operations = [
migrations.RemoveField(
model_name='pourpointbasin',
na... | StarcoderdataPython |
5154626 | <filename>app1/filters.py
import django_filters
from .models import *
class StdFilter (django_filters.FilterSet):
class Meta:
model = App1Students
fields = '__all__' | StarcoderdataPython |
4938875 | <reponame>luislorenzom/celery_priority_queue_example<gh_stars>0
from time import sleep
from config import celery_app
@celery_app.task(name='priority', queue='priority')
def doing_something(msg):
print('PRIORITY ~~~~> ' + msg)
sleep(10)
@celery_app.task(name='fifo', queue='fifo')
def doing_something_importan... | StarcoderdataPython |
150609 | #!/usr/bin/env python
# Copyright 2015 Coursera
#
# 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 ag... | StarcoderdataPython |
8132971 | EPSILON = 1e-10
RANDOM_STATE = 0
| StarcoderdataPython |
6556775 | class PCF8574:
def __init__(self, i2c, address):
self._i2c = i2c
self._address = address
self._input = 0 # Buffers the result of read in memory
self._input_mask = 0 # Mask specifying which pins are set as input
self._output = 0 # The state of pins set for output
se... | StarcoderdataPython |
217014 | <reponame>kaustubh-s1/EvalAI
# -*- coding: utf-8 -*-
# Generated by Django 1.11.23 on 2020-09-10 18:09
from __future__ import unicode_literals
import base.utils
import django.contrib.postgres.fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
(
... | StarcoderdataPython |
3537824 | <reponame>Clinical-Genomics/scout
# -*- coding: utf-8 -*-
import logging
from datetime import datetime as datetime
from scout.exceptions import IntegrityError
from scout.constants import VALID_MODELS
LOG = logging.getLogger(__name__)
def build_gene(gene_info, adapter):
"""Build a panel_gene object
Args:
... | StarcoderdataPython |
6520499 | """
* Python program to use OpenCV drawing tools to create a mask.
*
"""
import numpy as np
import skimage
from skimage.viewer import ImageViewer
# Load the original image
image = skimage.io.imread("maize-roots.tif")
viewer = ImageViewer(image)
viewer.show()
# Create the basic mask
mask = np.ones(shape=image.shape[... | StarcoderdataPython |
4813997 | <filename>array/easy/maxProfit.py
""" Summary
在遍历价格数组时,根据这个动态更新的最低价和当前的价格可以算出当前卖股票最大能赚多少钱。
"""
class Solution(object):
"""
Problem:
https://leetcode.com/problems/best-time-to-buy-and-sell-stock/
Example:
Input: [7, 1, 5, 3, 6, 4]
Output: 5
"""
def maxProfit(self, prices... | StarcoderdataPython |
396989 | <filename>alto/commands/terra/remove_method.py
import argparse
from firecloud import api as fapi
from alto.utils import *
def main(argv):
parser = argparse.ArgumentParser(description='Remove methods from Broad Methods Repository.')
parser.add_argument('-m', '--method', dest='method', action='store', require... | StarcoderdataPython |
6576153 | # Generated by Django 2.2.7 on 2019-11-30 03:56
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('core', '0003_tag'),
]
operations = [
migrations.CreateModel(
n... | StarcoderdataPython |
6678721 | <gh_stars>0
def multiply(a, b):
"""
This code does not execute properly. Try to figure out why.
"""
result = a * b
return result
| StarcoderdataPython |
9602520 | <filename>Naive_Bayes/docclass.py
import re
import math
from pysqlite2 import dbapi2 as sql
def sampletrain(cl):
cl.train('Nobody owns the water.', 'good')
cl.train('the quick rabbit jumps fences', 'good')
cl.train('buy pharmaceuticals now', 'bad')
cl.train('make quick money at the online casino', 'ba... | StarcoderdataPython |
4882258 | <filename>Admission Counselling For Direct Second Year/Web-Application/AdmissionDirectSecondYear/AdmissionDirectSecondYear/urls.py
"""AdmissionDirectSecondYear URL Configuration
"""
from django.contrib import admin
from django.urls import path, include
from django.conf.urls import url
from . import views
from... | StarcoderdataPython |
9632345 | <reponame>vandurme/TFMTL
# coding=utf-8
# Copyright 2017 The Tensor2Tensor Authors.
# Copyright 2018 Johns Hopkins University.
#
# 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://w... | StarcoderdataPython |
261410 | <gh_stars>0
"""
Test the health check endpoints
"""
def test_live(mini_sentry, relay):
"""Internal endpoint used by kubernetes """
relay = relay(mini_sentry)
response = relay.get("/api/relay/healthcheck/live/")
assert response.status_code == 200
def test_external_live(mini_sentry, relay):
"""End... | StarcoderdataPython |
6596413 | import os
import lief
import re
import mimetypes
import hashlib
import os.path
import subprocess
from os import path
from string import digits
from . import CtagsHandler
class FileHandler:
def __init__(self, errorHandler, filepath, filename, filetype, checksum):
self.debug = errorHandler
self.fil... | StarcoderdataPython |
3457941 | class EMdata(object):
def __init__(self):
self.holo_1 = None
self.holo_2 = None
self.holo_ref = None
self.holo_2_aligned = None
self.phase_1 = None
self.amplitude_1 = None
self.amplitude_2 = None
self.phase_2 = None
self.phase_ref = None
... | StarcoderdataPython |
12856968 | # DBPLoadController.py
# 1) Run Validate on the files to process
# 2) Move any Fileset that is accepted to uploading
# 3) Perform upload
# 4) Move any fully uploaded fileset to database
# 5) Update fileset related tables
# 6) Move updated fileset to complete
import os
from Config import *
from RunStatus import *
fro... | StarcoderdataPython |
5032500 | import subprocess
import re
p = subprocess.check_output("poetry version", shell=True)
ver = re.match(".* to (.*)\\\\.*$", str(p)).group(1)
open("attrs_serde/__version__.py", "w").write('__version__ = "{}"'.format(ver))
print("git tag v{}".format(ver))
print(subprocess.check_call("git tag v{}".format(ver), shell=True))... | StarcoderdataPython |
8104454 | <filename>lingcod/async/migrations/0001_initial.py
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'URLtoTaskID'
db.create_t... | StarcoderdataPython |
1902042 | <reponame>KatharineShapcott/levelup-exercises<gh_stars>0
import numpy as np
import matplotlib.pyplot as plt
# set up parameters
n_samples = 30
n_repeats = 1000
distribution_mean = 10
# figure preparation
fig, axs = plt.subplots(5, 2, constrained_layout=True)
# create and plot uniform and mean
uniform = np.random.r... | StarcoderdataPython |
11386934 | <reponame>chschtsch/kiuss<filename>kiuss/local_settings_example.py
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
SECRET_KEY = '<KEY>'
# DEBUG = True
# THUMBNAIL_DEBUG = True
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'kiuss... | StarcoderdataPython |
9670351 | from haystack import indexes
from .models import Request
class RequestIndex(indexes.SearchIndex, indexes.Indexable):
text = indexes.NgramField(document=True, use_template=True)
name = indexes.CharField(model_attr='title')
def get_model(self):
return Request
def index_queryset(self, using=Non... | StarcoderdataPython |
3376500 |
def test_something():
pass
# TODO: write this test
| StarcoderdataPython |
3464247 | <filename>autodmg_cache_builder/autodmg_utility.py
#!/usr/bin/python
"""Utility functions used by other parts of the AutoDMG build tools."""
import subprocess
import os
import tempfile
import shutil
def run(cmd):
"""Run a command with subprocess, printing output in realtime."""
proc = subprocess.Popen(
cmd,
... | StarcoderdataPython |
8123740 | """Unit test package for navigation."""
| StarcoderdataPython |
3577531 | #!/usr/bin/env python
# Software License Agreement (BSD License)
#
# Copyright (c) 2014, <NAME>, Social Robotics Lab, University of Freiburg
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
#... | StarcoderdataPython |
5196210 | <reponame>yelabucsf/scrna-parameter-estimation<filename>analysis/cell_type_effects/ct_coexpression.py
import scanpy as sc
import scipy as sp
import numpy as np
import pickle as pkl
import sys
sys.path.append('/data/home/Github/scrna-parameter-estimation/scmemo')
import estimator, simulate, scmemo, bootstrap, util, hyp... | StarcoderdataPython |
11330370 | <gh_stars>0
import sys
from collections import defaultdict
def main():
"""
TODO think about better data structure, list of tuples might be better, perhaps a class for a self-sorting tuple manager, essentially a DB
"""
input_file = sys.argv[1]
output_file_top10occupations = sys.argv[2]
output_fi... | StarcoderdataPython |
11366768 | <reponame>p4l1ly/pycapnp<filename>benchmark/addressbook.proto.py
import addressbook_pb2 as addressbook
import os
print = lambda *x: x
def writeAddressBook():
addressBook = addressbook.AddressBook()
alice = addressBook.person.add()
alice.id = 123
alice.name = 'Alice'
alice.email = '<EMAIL>'
a... | StarcoderdataPython |
12836291 | """
urlresolver XBMC Addon
Copyright (C) 2011 t0mm0
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 3 of the License, or
(at your option) any later version.
... | StarcoderdataPython |
4818385 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from io import StringIO
import re
import os
from datetime import datetime
def parse_ssh_config(config=os.getenv("HOME") + "/.ssh/config"):
entries = []
with open(config, "r") as fh:
entry = None
for line in fh:
if re.search("^\s+$", ... | StarcoderdataPython |
1969614 | <reponame>udox/django-social-tools<filename>setup.py
import os
from setuptools import setup
README = open(os.path.join(os.path.dirname(__file__), 'README.rst')).read()
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name='django-socia... | StarcoderdataPython |
16651 | #!/usr/bin/python2
import sys
import os
import redis
import time
import datetime
string_keys = []
hash_keys = []
list_keys = []
set_keys = []
zset_keys = []
def import_string(source, dest):
print "Begin Import String Type"
keys_count = len(string_keys)
print "String Key Count is:", keys_count
pipeSrc... | StarcoderdataPython |
8101522 | # For production
from algoritms.macro_sostream.micro_cluster import MicroCluster
from algoritms.macro_sostream.macro_cluster import MacroCluster
# For test
# from micro_cluster import MicroCluster
# from macro_cluster import MacroCluster
def new_microcluster(vt):
return MicroCluster(vt)
def new_macrocluster(mi... | StarcoderdataPython |
3358379 | # 2019-11-24 20:59:47(JST)
import sys
#import numpy as np
days = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT']
def main():
s = sys.stdin.readline().rstrip()
ans = 7 - days.index(s)
print(ans)
if __name__ == '__main__':
main()
| StarcoderdataPython |
344496 | <reponame>eakadams/fluffy-happiness
# Fluffy Happiness: Test code to grab pictures of cute animals from the Internet
# Usage: >> python get_fluffy.py [options]
# <NAME> (<EMAIL>)
__author__ = "<NAME> smells nice"
__date__ = "$22-oct-2018 22:00:00$"
__version__ = "0.2"
# Imports
import os
import sys
import urllib.reque... | StarcoderdataPython |
6406988 |
import os
import shutil
import sys
import time
import glob
import importlib
# as we need to load the shared lib from here, make sure it's in our path:
if os.path.join( os.environ['CMSSW_BASE'], 'src') not in sys.path:
sys.path.append( os.path.join( os.environ['CMSSW_BASE'], 'src') )
# ----------------------------... | StarcoderdataPython |
287341 | import uuid
from celery.task import task
from spylunking.log.setup_logging import build_colorized_logger
from celery_loaders.work_tasks.custom_task import CustomTask
log = build_colorized_logger(
name='do_some_work')
@task(
bind=True,
base=CustomTask,
queue="do_some_work")
def do_some_work(
... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.