id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
6653663 | <filename>update.py
# -*- coding: utf-8 -*-
#!/usr/bin/python3
#@author xuan
#@created 2019/10/19
#@desciption Complete tasks at regular intervals
#system lib
import time
import os
import configparser
import logging
import MySQLdb
from apscheduler.schedulers.background import BackgroundScheduler
from DBUtils.PooledDB... | StarcoderdataPython |
11291693 | from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('users', '0003_auto_20151219_1141'),
]
operations = [
migrations.RemoveField(
model_name='userprofile',
name='start_workflow',
),
]
| StarcoderdataPython |
1824747 | <reponame>58563528/omega-miya
import imaplib
import email
import hashlib
from email.header import Header
from typing import List
class Email(object):
def __init__(self, date: str, header: str, sender: str, to: str, body: str = '', html: str = ''):
self.date = date
self.header = header
self... | StarcoderdataPython |
6507069 | <reponame>codelieche/kanban
"""
页面相关的序列化
"""
from rest_framework import serializers
from account.models import User
from account.tasks.message import send_message
from docs.models.article import Article
class ArticleModelSerializer(serializers.ModelSerializer):
"""
Article Model Serializer
"""
user ... | StarcoderdataPython |
5097488 | <reponame>ericflo/django-couch-lifestream
# Not much to see here. We're using CouchDB :) | StarcoderdataPython |
9653217 | <reponame>Into-Y0u/Github-Baby
class Solution:
def removeDuplicates(self, s: str, k: int) -> str:
stack, cur = [], ""
for c in s:
if cur and c != cur[-1]:
stack.append(cur)
cur = ""
cur += c
while len(cur) >= k:
if n... | StarcoderdataPython |
3300547 | import os
import logging
import nemo
import nemo.collections.asr as nemo_asr
from label_studio_ml.model import LabelStudioMLBase
from label_studio_ml.utils import DATA_UNDEFINED_NAME
logger = logging.getLogger(__name__)
class NemoASR(LabelStudioMLBase):
def __init__(self, model_name='QuartzNet15x5Base-En', **... | StarcoderdataPython |
38161 | <filename>Python3-world2/ex068.py
import random
title = 'par ou ímpar'.upper()
print('~~' * 10)
print(f'\033[7;30m{title:^20}\033[m')
print('~~' * 10)
# poi = par ou impar
# vop = vitoria ou perda
poi = vop = ''
cont = 0
while True:
cont += 1
escolha_numero = int(input('Digite um número: '))
escolha_parinpa... | StarcoderdataPython |
257031 | # Improtant note: This data file would ordinarily be used to connect with a proper database server
# more likely PostgreSQL, but thats me. I do plan on rewritting this in the future for such implementations.
# With that said, this file will be be very slow to run and only to demonstrate data processing using
# function... | StarcoderdataPython |
3482933 | <gh_stars>1-10
# -*- coding: UTF-8 -*-
import re
import sys
import traceback
from collections import OrderedDict
from datetime import datetime, timedelta
import requests
from lxml import etree
class Parser:
def __init__(self, config):
self.config = config
def deal_html(self, url, cookie):
""... | StarcoderdataPython |
5077267 | from django.db import models
# Create your models here.
class Shift(models.Model):
SHIFT_NAME_CHOICES = (
('A', 'Turno A'),
('B', 'Turno B'),
('C', 'Turno C'),
)
shift_name = models.CharField(
max_length=8,
choices=SHIFT_NAME_CHOICES,
)
start_time = models... | StarcoderdataPython |
4874353 | <reponame>echaussidon/LSS
# Predict the DECam z and GAIA G magnitudes using Tycho-2 and 2MASS photometry
from __future__ import division, print_function
import sys, os, glob, time, warnings, gc
import numpy as np
# import matplotlib
# matplotlib.use("Agg")
# import matplotlib.pyplot as plt
from astropy.table import Ta... | StarcoderdataPython |
5142472 | <reponame>mgalves/tweets
from os import listdir
from os.path import isfile, join
def load_dataset(dataset):
"""
Carrega os dados dos arquivos de mapeamento
Retorna duas listas: uma completa para o TWITTER, outra quebrada por arquivo
"""
keywords = [] # Lista completa
keywords_by_file = {} # Li... | StarcoderdataPython |
58674 | <filename>ysi_prediction/ysi_flask/prediction.py
import numpy as np
import pandas as pd
from sklearn.linear_model import BayesianRidge
from ysi_flask.colors import husl_palette
from ysi_flask.fragdecomp.chemical_conversions import canonicalize_smiles
from ysi_flask.fragdecomp.fragment_decomposition import (
Fragme... | StarcoderdataPython |
32976 | def percentage_format(x: float) -> str:
return f"{(x * 100):.1f}%"
| StarcoderdataPython |
3426011 | from flask import jsonify,g,request,url_for,current_app
from . import api
from ..models import User,Post
'''
Flasky应用API资源
资源URL 方法 说明
/users/ GET 返回所有用户
/users/<int:id> GET 返回一个用户
/users/<int:id>/posts/ GET ... | StarcoderdataPython |
222681 | <reponame>leap-solutions-asia/auto-scaling<filename>dashboard/CloudStackConfig.py
import configparser
import os
from tempfile import NamedTemporaryFile
cloudstack_file = "/auto-scaling/cloudstack.ini"
class CloudStackConfig:
def __init__(self):
self._conf = configparser.ConfigParser()
if os.path.e... | StarcoderdataPython |
5079676 | #missing : ln 5
def fib(n): # write Fibonacci series up to n
a = 0
b = 1
if a < n
print a
| StarcoderdataPython |
9619407 | <reponame>MW55/MDlatticeAnalysisTool
from Bio.PDB.Atom import Atom
from Bio.PDB.PDBParser import PDBParser
import numpy as np
import itertools
class Enviroment(object):
def __init__(self, protein_pdb_path, polymer_full_poses_path,
meshsize = np.array([3, 3, 3])):
self.prot_path = protein_pdb_pa... | StarcoderdataPython |
265779 | from . import matcher
import matplotlib.pyplot as plt
import matplotlib.colors as clrs
from scipy import stats
import numpy as np
import umap
import seaborn as sns
import matplotlib.patches as mpatches
def pearsonMatrix(dataset_filtered, patterns_filtered, cellTypeColumnName, num_cell_types, projectionName, plotName,... | StarcoderdataPython |
3574740 | from django.forms import ModelForm
from .models import *
class CollectiveOrderForm(ModelForm):
class Meta:
model = CollectiveOrder
fields = '__all__'
exclude = ['customer', 'transaction_id']
class CollectiveOrderItemsForm(ModelForm):
class Meta:
model = CollectiveOrderItem
fields = '__all__'
class Coll... | StarcoderdataPython |
1655890 | #!/usr/bin/env python3
#
# Harano Aji Fonts generator
# https://github.com/trueroad/HaranoAjiFonts-generator
#
# make_shift.py:
# create shift parameters from letter face
#
# Copyright (C) 2020 <NAME>.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are pe... | StarcoderdataPython |
11223034 | <reponame>ErickDiaz/tesis_master_ingmate
#!/usr/bin/python
"""
Released under the MIT License
Copyright 2015-2016 MrTijn/Tijndagamer
"""
from bmp180 import bmp180
bmp = bmp180(0x77)
print("Temp: " + str(bmp.get_temp()) + " Celcius")
print("Pressure: " + str(bmp.get_pressure()) + " Pascal")
print("Altitude: " + str(b... | StarcoderdataPython |
11296306 | from retico_core.abstract import *
from retico_core import audio
from retico_core import debug
from retico_core import network
from retico_core import text
from retico_core import dialogue
__version__ = "0.2.0" # This is the version that is used basically everywhere
| StarcoderdataPython |
8089929 | import json
import urllib.request
import pandas as pd
import os
class Covid19IndiaNationalLoader:
def __init__(self):
if os.path.exists("../data"):
self.store_location = '../data/covid19india_national_daily.pickle'
elif os.path.exists("../../data"):
self.store_location = '.... | StarcoderdataPython |
5194227 | import requests
import json
import urllib.parse
def get_aws_access_key(turbot_api_access_key, turbot_api_secret_key, turbot_host_certificate_verification, turbot_host, turbot_account, turbot_user_id, api_version):
""" Gets the federated access keys for a specified account
:return: Returns the access key, sec... | StarcoderdataPython |
3507222 | <filename>aws/templates/app_cluster.py
from cfn_pyplates.core import CloudFormationTemplate, Mapping, Parameter, \
Resource, Properties, DependsOn, Output
from cfn_pyplates.functions import join
AWS_REGIONS_AZ = {
'eu-west-1': ["eu-west-1a", "eu-west-1b", "eu-west-1c"],
'eu-central-1': ["eu-central-1a", "... | StarcoderdataPython |
204244 | import os.path
import setuptools
# Get long description from README.
with open('README.rst', 'r') as fh:
long_description = fh.read()
# Get package metadata from '__about__.py' file.
about = {}
base_dir = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(base_dir, 'resolwe_bio', '__about__.py'), '... | StarcoderdataPython |
5087345 | <filename>src/__init__.py
"""Source code for the very good semantic segmentation labeler."""
| StarcoderdataPython |
1974791 | import dcase_util
chain = dcase_util.processors.ProcessingChain([
{
'processor_name': 'AudioReadingProcessor',
'init_parameters': {
'fs': 44100
}
},
{
'processor_name': 'RepositoryFeatureExtractorProcessor',
'init_parameters': {
'parameters': {... | StarcoderdataPython |
3537398 | #!/usr/bin/env python3
from math import pi, atan, sin, cos, sqrt
from functools import reduce
import cv2
import numpy as np
import shm
from vision.modules.base import ModuleBase
from vision.framework.color import bgr_to_lab, elementwise_color_dist, range_threshold, color_dist
from vision.framework.transform import e... | StarcoderdataPython |
5047483 | <filename>src/profiler/img_to_base64.py
"""
Copyright 2018-2021 Board of Trustees of Stanford University
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 limi... | StarcoderdataPython |
3568982 | import multiprocessing as mp
import random
import sys
import time
import numpy as np
class Worker(mp.Process):
def __init__(self, wid, in_q, out_q, vs, rrset_func):
super(Worker, self).__init__(target=self.start)
self.wid = wid
self.in_q = in_q
self.out_q = out_q
self.vs ... | StarcoderdataPython |
3400247 | <gh_stars>0
import pytest
from fbotics import OAuthException
from fbotics.tests import ANY
def test_status_code_when_sending_text_message_to_valid_recipient(
client,
recipient_id):
"""
GIVEN a client and a recipient id
WHEN a text message is sent to the recipient
THEN the status code ... | StarcoderdataPython |
5060037 | <reponame>superonesfazai/fz_ip_pool
# coding:utf-8
'''
@author = super_fazai
@File : exception.py
@connect : <EMAIL>
'''
class NotIpException(Exception):
"""不是ip"""
pass
| StarcoderdataPython |
4910545 | from anadama.util import dict_to_cmd_opts, addext, new_file
from anadama.decorators import requires
from . import (
settings
)
@requires(binaries=["bowtie2"],
version_methods=["bowtie2 --version | head -1"])
def bowtie2_align(infiles_list, output_file, **opts):
"""Workflow to use bowtie2 to map a li... | StarcoderdataPython |
9657533 | <reponame>nirvaank/pyqmc
import numpy as np
from pyqmc.accumulators import EnergyAccumulator, LinearTransform, SqAccumulator
from pyqmc.obdm import OBDMAccumulator
from pyqmc.tbdm import TBDMAccumulator
import pyqmc.api as pyq
import copy
def test_transform(LiH_sto3g_rhf):
"""Tests that the shapes are ok"""
mo... | StarcoderdataPython |
8191350 | <filename>Exercicios do curso em video/pythonProject/pythonexercicios/ex005.py
num = int(input('Digite um numero: '))
print('O antecessor de {}'.format(num), 'é {}'.format(num - 1), 'e o sucessor de {}'.format(num), 'é {}'.format(num + 1)) | StarcoderdataPython |
3328525 | <filename>setup.py
import setuptools
requirements = [
'lxml',
'requests',
]
test_requirements = [
'pytest',
'requests-mock',
]
setuptools.setup(
name="py-walmart",
version="0.0.1",
url="https://github.com/dreygur",
author="<NAME>",
author_email="<EMAIL>",
description="Walmart Marketplace API",
... | StarcoderdataPython |
3561354 | <filename>scripts/ssc/witness_complex/witness_kNN_visualization.py<gh_stars>0
from sklearn.neighbors import NearestNeighbors
from scripts.ssc.persistence_pairings_visualization.utils_definitions import make_plot
from src.datasets.datasets import SwissRoll
from src.topology.witness_complex import WitnessComplex
PATH =... | StarcoderdataPython |
3414527 | import dem as d
prefixes = ['as', 'af', 'au', 'ca', 'eu', 'na', 'sa']
thetas = [0.4, 0.5, 0.6]
horizontal_interval = 5000.0
for prefix in prefixes:
dem = d.Elevation.load(prefix + '_elevation')
area = d.GeographicArea.load(prefix + '_area')
fd = d.FlowDirectionD8.load(prefix + '_flow_direction')
for theta in t... | StarcoderdataPython |
1829603 | <reponame>bwgref/duet-astro<filename>astroduet/models.py<gh_stars>1-10
import os
from astropy import log
import numpy as np
import astropy.units as u
import astropy.constants as const
from astropy.table import Table, QTable, join
from astroduet.config import Telescope
from astroduet.bbmag import bb_abmag, bb_abmag_fl... | StarcoderdataPython |
357542 | from pathlib import Path
from loguru import logger
def alter(f,
old_str,
new_str):
file_data = ""
for line in f:
line = line.replace(old_str, new_str)
file_data += line
return file_data
def alter_all_models(f,
block_list,
i... | StarcoderdataPython |
9780238 | #
# SPDX-License-Identifier: MIT
#
from oeqa.runtime.case import OERuntimeTestCase
from oeqa.core.decorator.depends import OETestDepends
from oeqa.core.decorator.data import skipIfNotFeature
from oeqa.runtime.decorator.package import OEHasPackage
class LddTest(OERuntimeTestCase):
@OEHasPackage(["ldd"])
@OETe... | StarcoderdataPython |
1775088 | import numpy as np
import matplotlib.pyplot as plt
file = open('magic04.txt')
Data = [[float(i) for i in a.split(',')[:-1]] for a in file.readlines()]
mymatrix = np.array(Data)
mymean = np.mean(mymatrix, axis=0)
print(mymean)
print('\n')
mean1=np.transpose(mymean)
n = mymatrix.shape[0]
temp=[1 for i in range(n)]
tm=... | StarcoderdataPython |
9763508 | <filename>csmserver/csm_exceptions/__init__.py<gh_stars>10-100
from exceptions import CSMLDAPException
| StarcoderdataPython |
3499548 | '''
Problem
For two strings s1 and s2 of equal length, the p-distance between them, denoted dp(s1,s2), is the
proportion of corresponding symbols that differ between s1 and s2.
For a general distance function d on n taxa s1,s2,…,sn (taxa are often represented by genetic strings),
we may encode the distances between p... | StarcoderdataPython |
9606195 | # coding=utf-8
# --------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
from ... | StarcoderdataPython |
3457195 | from django.contrib import admin
import models
# Register your models here.
admin.site.register(models.Playlist)
admin.site.register(models.Song) | StarcoderdataPython |
5042911 | from selenium import webdriver
import time
def main():
link = "http://suninjuly.github.io/selects1.html"
link2 = "http://suninjuly.github.io/selects2.html"
browser = webdriver.Chrome()
browser.get(link2)
num1 = browser.find_element_by_id("num1")
num2 = browser.find_element_by_id("num2")
... | StarcoderdataPython |
6589443 | <reponame>Bash-Air/bashair<gh_stars>0
# Generated by Django 3.2.12 on 2022-02-11 23:41
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('back', '0009_auto_20220212_0438'),
]
operations = [
migrations.AlterField(
model_name='in... | StarcoderdataPython |
1787092 | <filename>inbm/dispatcher-agent/dispatcher/device_manager/constants.py<gh_stars>1-10
"""
Constants for DeviceManager classes
Copyright (C) 2017-2022 Intel Corporation
SPDX-License-Identifier: Apache-2.0
"""
# Linux specific constants
LINUX_POWER = "/sbin/shutdown "
LINUX_RESTART = "-r"
LINUX_SHUTDOWN = "-... | StarcoderdataPython |
11262467 | import argparse
from telegram import telegram
from telegraph import Telegraph
__author__ = '<NAME> (<NAME>)'
__license__ = "MIT"
PARSER = argparse.ArgumentParser(description="Telegra.ph submitter")
PARSER.add_argument('-title', '-t', type=str, help="Post title", required=False)
PARSER.add_argument('-content', '-c', t... | StarcoderdataPython |
4980745 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2018-08-30 07:26
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateMo... | StarcoderdataPython |
6547383 | <gh_stars>0
import numpy as np
import pyarrow as pa
from pandas.core.dtypes.dtypes import register_extension_dtype
from spatialpandas.geometry import Polygon
from spatialpandas.geometry._algorithms.intersection import (
multipolygons_intersect_bounds
)
from spatialpandas.geometry._algorithms.orientation import orie... | StarcoderdataPython |
1668267 | <reponame>mrthevinh/tvmongofastapi<gh_stars>1-10
from fastapi import APIRouter
from api.public.health import views as health
from api.public.user import views as user
api = APIRouter()
api.include_router(health.router, prefix="/health", tags=["Health"])
api.include_router(user.router, prefix="/user", tags=["Users"])... | StarcoderdataPython |
9698924 | from lib import *
reactionStrings = [l.strip() for l in open("input.txt").readlines()]
reactions = dict()
components = dict()
ore = 0
#load reactions
for rString in reactionStrings:
parts = [p.strip() for p in rString.split("=>")]
inputs = [i.split() for i in [p.strip() for p in parts[0].split(',')]]
... | StarcoderdataPython |
1884833 | # -*- coding:utf-8 -*-
import os
import time
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
import pymongo
client = pymongo.MongoClient('localhost', 27017)
db = client.db
collection = db.house
class MyHandler(FileSystemEventHandler):
def on_created(self,event):
... | StarcoderdataPython |
11228060 | from setuptools import setup
setup(
name='tendermint',
version='0.3.0',
url='https://github.com/davebryson/py-tendermint',
license='Apache 2.0',
author='<NAME>',
description='A microframework for building blockchain applications with Tendermint',
packages=['tendermint'],
include_package... | StarcoderdataPython |
11270476 | <filename>ai_tool/predict_pipe.py
# coding:utf-8
import logging
import time
from concurrent.futures import ThreadPoolExecutor, as_completed
from threading import RLock
import cv2
import numpy as np
from GTUtility.GTTools.bbox import BBoxes, BBox
from GTUtility.GTTools.img_slide import yield_sub_img
from GTUtility.GTToo... | StarcoderdataPython |
190402 | <gh_stars>1-10
"""
Copyright 2015 <NAME>, <NAME>, <NAME> and <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... | StarcoderdataPython |
1854510 | """Docker helper functions.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from treadmill import utils
_DEFAULT_ULIMIT = ['core', 'data', 'fsize', 'nproc', 'nofile', 'rss', 'stack']
def init_ulimit(ulimit=None... | StarcoderdataPython |
98179 | import sys, os, getopt, time, datetime
from wxpy import *
def filesExist(fileList):
for i, aFile in enumerate(fileList):
if not os.path.exists(aFile):
print("warning: the {}th file, {}, doesn't exist.".format(i + 1, aFile))
return False
return True
def readFile(filename):
... | StarcoderdataPython |
154323 | <gh_stars>10-100
#!/usr/bin/env python2.7
# -*- coding: utf8 -*-
# import pip
# pip.main(['-q', 'install', 'cymruwhois'])
# pip.main(['-q', 'install', 'dpkt'])
# pip.main(['-q', 'install', 'simplejson'])
try:
import dpkt
except:
print "Download dpkt"
try:
import cymruwhois
except:
print "Download ... | StarcoderdataPython |
4964103 | <filename>comment/models/comments.py<gh_stars>0
from django.contrib.auth import get_user_model
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes.fields import GenericForeignKey
from django.db import models
from comment.managers import CommentManager
class Comment(models.Mode... | StarcoderdataPython |
4909845 | <reponame>kimvc7/Robustness
import json
import os
def config_experiments(results_dir, create_json=True):
with open('./base_config.json') as config_file:
base_config = json.load(config_file)
id = 0
experiment_list = []
config = base_config.copy()
config["model_name"] = str(id)
config... | StarcoderdataPython |
3290376 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author: <NAME>(<EMAIL>)
# Visualizer for pose estimator.
import os
import cv2
import matplotlib
import numpy as np
import pylab as plt
from PIL import Image
from numpy import ma
from scipy.ndimage.filters import gaussian_filter
from datasets.tools.transforms import DeN... | StarcoderdataPython |
1919037 | import attr
import torch
import os
import collections
from tensor2struct.utils import registry, dataset
@attr.s
class Stat:
sketch_cor_num = attr.ib(default=0)
lf_cor_num = attr.ib(default=0)
denotation_cor_num = attr.ib(default=0)
num_examples = attr.ib(default=0)
def __str__(self):
if ... | StarcoderdataPython |
6496973 | import random
def generatePassword(pwlength):
alphabet = "abcdefghijklmnopqrstuvwxyz"
passwords = []
for i in pwlength:
password = ""
for j in range(i):
next_letter_index = random.randrange(len(alphabet))
password = password + alphabet[next... | StarcoderdataPython |
3521051 | import xml.etree.ElementTree as ET
import csv
import sys
input_filename = str(sys.argv[1])
output_filename = str(sys.argv[2])
file = open(input_filename, "r")
xmldata = file.readlines()[1]
root = ET.fromstring(xmldata)
output_data = open(output_filename, 'w')
csvwriter = csv.writer(output_data)
csv_header = []
csv_... | StarcoderdataPython |
3435021 | # https://leetcode.com/problems/missing-number/
class Solution:
def missingNumber(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
x = 0
for i in range(0, len(nums) - 1):
x ^= i
for n in nums:
x ^= n
return x
| StarcoderdataPython |
11398443 | <reponame>shubhamksm/Library-Management-System
from django.apps import AppConfig
class LibrarymanagerConfig(AppConfig):
name = 'librarymanager'
def ready(self):
import librarymanager.signals | StarcoderdataPython |
399087 | #Spawn a Process – Chapter 3: Process Based Parallelism
import multiprocessing
def function(i):
print ('called function in process: %s' %i)
return
if __name__ == '__main__':
Process_jobs = []
for i in range(5):
p = multiprocessing.Process(target=function, args=(i,))
Process_jobs.append... | StarcoderdataPython |
8038240 | <filename>generate_algos.py
#!/usr/bin/env python3
import yaml
from math import log, sqrt, floor, ceil
from itertools import product
from operator import itemgetter
import numpy as np
if __name__ == '__main__':
max_n = 3000000
iv = 10
multiplier = sqrt(2)
max_i = int((log(max_n)-log(iv))/log(multiplie... | StarcoderdataPython |
9610867 | # Copyright (C) 2021-2022 Modin authors
#
# SPDX-License-Identifier: Apache-2.0
"""High-level API of MultiProcessing backend."""
import cloudpickle as pkl
from unidist.config import CpuCount
from unidist.core.backends.multiprocessing.core.object_store import ObjectStore, Delayed
from unidist.core.backends.multiproce... | StarcoderdataPython |
1828770 | <filename>main.py
from flask import Flask
app = Flask(__name__)
app.config['DEBUG'] = True
@app.route('/')
def hello():
"""Return a friendly HTTP greeting."""
return 'Hello <NAME>!'
@app.errorhandler(404)
def page_not_found(e):
"""whatever you are looking for we don't have. Sorry"""
return 'no, it i... | StarcoderdataPython |
3477995 | class PackageConstants(object):
DELIVERY_STREAM = "DELIVERY_STREAM"
AWS_REGION = "AWS_REGION"
| StarcoderdataPython |
8118961 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# Copyright 2014 Hewlett-Packard Development Company, L.P.
#
# SPDX-License-Identifier: Apache-2.0
from bandit import bandit
if __name__ == '__main__':
bandit.main()
| StarcoderdataPython |
344755 | <reponame>allenai/real-toxicity-prompts
# Project-level constants, including API keys and directories
# Note: importing this file has the side effect of loading a configuration file
from pathlib import Path
import yaml
##############################
# Config
##############################
CONFIG_FILE = Path('config.ym... | StarcoderdataPython |
11377221 | #!/usr/bin/env python
import argparse,logging,glob
import numpy as np
logger = logging.getLogger(__name__)
def main():
''' simple starter program that can be copied for use when starting a new script. '''
logging_format = '%(asctime)s %(levelname)s:%(name)s:%(message)s'
logging_datefmt = '%Y-%m-%d %H:%M:%S'
... | StarcoderdataPython |
1941181 | from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, String, Integer
Base = declarative_base()
class Adult(Base):
__tablename__ = 'adult'
age = Column("age", Integer) # primary_key=True
workclass = Column("Created At", String)
fnlwgt = Column("Discount", String)
... | StarcoderdataPython |
368010 | from django.forms import ModelForm
from django import forms
from orders.models import Staff, Product, Customer, Order, Engineering, Request
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Submit, Layout, Div, Fieldset, Field
from django.urls import reverse
class OrderForm(forms.ModelForm):
... | StarcoderdataPython |
5059953 | <filename>moler/util/__init__.py
# -*- coding: utf-8 -*-
__author__ = '<NAME>'
__copyright__ = 'Copyright (C) 2018, Nokia'
__email__ = '<EMAIL>'
| StarcoderdataPython |
6630171 | import os
from .BaseDataset import BaseDataset
from PIL import Image
class SingleFolderDataset(BaseDataset):
def __init__(self, root, cfg, is_train=True):
super(SingleFolderDataset, self).__init__(cfg, is_train)
root = os.path.abspath(root)
self.file_list = sorted(os.listdir(root))
... | StarcoderdataPython |
11341465 | <reponame>stoneyangxu/python-kata
import unittest
def range_50_to_80() -> list:
return [n for n in range(50, 90, 10)]
class MyTestCase(unittest.TestCase):
def test_something(self):
self.assertEqual(range_50_to_80(), [50, 60, 70, 80])
if __name__ == '__main__':
unittest.main()
| StarcoderdataPython |
6655106 | from pandas import DataFrame
from .utility import UtilityModel as UtilityModelBase
from churnmodels import conf
import pandas as pd
class UtilityModel(UtilityModelBase):
def __init__(self, name, df: DataFrame = None):
self.name = name
if df is None:
df = conf.get_csv(name, "utility")
... | StarcoderdataPython |
1901551 | <reponame>moazzamwaheed2017/carparkapi<filename>CarParkArcGisApi/CarParkArcGisApi/env/Lib/site-packages/arcgis/features/_data/__init__.py
"""
This Sub Package is Deprecated.
""" | StarcoderdataPython |
9630235 | <filename>tests/test_arrays.py<gh_stars>1-10
import unittest, testcontract
class TestArrays(testcontract.TestContract):
def test_set_stored_array(self):
s = self.reset_state()
ctr = self.reset_contract(s, 0, self.k0)
in_arr = [1,2,3,4]
ctr.set_stored_array(in_arr)
out_arr... | StarcoderdataPython |
3386167 | import os
import sys
import shutil
src_dir = sys.argv[1]
dst_dir = sys.argv[2]
for root, dirs, files in os.walk(src_dir):
for file in files:
if not file.endswith('.meta'):
src_file = os.path.join(root, file)
rel_src_file = src_file.replace(src_dir, '')
if r... | StarcoderdataPython |
6550825 | <gh_stars>1-10
#!/usr/bin/env python3
import argparse
import random
from scapy.all import send, IP, TCP
DEFAULT_PACKETS = 99999999
MAX_PORTS = 65535
def random_IP():
IP = ".".join(map(str, (random.randint(0,255)for _ in range(4))))
return IP
def get_args():
parser = argparse.ArgumentParser(description="Welcome t... | StarcoderdataPython |
6706343 | <reponame>kevin-de-granta/fleet<filename>lib/python/fleet/core/env_fleet.py
# -*- coding:utf-8 -*-
#
# File Name: env_fleet.py
# Function: Singleton for Env of Fleet Core.
# Created by: <NAME> (Kevin), <EMAIL>
# Created on: 2017/09/30
# Revised hist: revised by _____ on ____/__/__
#
import os
import threa... | StarcoderdataPython |
6589756 | import functools
from pathlib import Path
from deprecated import deprecated
from koapy.backend.kiwoom_open_api_plus.core.KiwoomOpenApiPlusTypeLibSpec import (
API_MODULE_PATH,
)
@deprecated
@functools.lru_cache()
def GetAPIModulePath() -> Path:
return API_MODULE_PATH
if __name__ == "__main__":
print(... | StarcoderdataPython |
1660392 | <gh_stars>10-100
import os
import sys
import argparse
parser = argparse.ArgumentParser(description='Anonymize a batch of videos')
parser.add_argument('--resume', default='SiamMask_DAVIS.pth', type=str,
metavar='PATH',help='path to latest checkpoint (default: none)')
parser.add_argument('--config', ... | StarcoderdataPython |
6694830 | from allennlp_demo.atis_parser.api import AtisParserModelEndpoint
from allennlp_demo.common.testing import ModelEndpointTestCase
class TestAtisParserModelEndpoint(ModelEndpointTestCase):
endpoint = AtisParserModelEndpoint()
predict_input = {"utterance": "show me the flights from detroit to westchester county"... | StarcoderdataPython |
11246892 | from pathlib import Path
from poetry_polylith_plugin.components import components
from poetry_polylith_plugin.components.bases.constants import dir_name
def get_bases_data(path: Path, ns: str):
return components.get_components_data(path, ns, dir_name)
| StarcoderdataPython |
5131298 | <reponame>Sentimentron/Dracula
__author__ = 'rtownsend'
from nltk.corpus import treebank
for sentence in treebank.tagged_sents():
for word, pos in sentence:
if 'NONE' in pos:
continue
print '{}\t{}'.format(word, pos)
print '' | StarcoderdataPython |
142902 | <reponame>toolness/usaspending-api<gh_stars>1-10
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2017-02-09 18:40
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('financial_activities', '0013_auto_20170209_1838'),
... | StarcoderdataPython |
11336709 | <reponame>antomuli/NeighborhoodApp
from django.test import TestCase
from mimesis import Generic
from ..models import User
class UserModelTestCase(TestCase):
def setUp(self):
self.gen = Generic()
self.new_user = User(
first_name=self.gen.person.full_name().split()[0],
last_... | StarcoderdataPython |
3437704 | <gh_stars>100-1000
# Copyright 2018 NAVER Corp.
#
# 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 a... | StarcoderdataPython |
9793523 | """
author: <NAME>
Blender Cycles 2.79
Problem:
Blender cycles uses too much memory when baking multiple objects
Solution (workaround):
Bakes all object in selected group sequentially, one ater another
to save memory script will restart blender after every bake
bake source in: object_bake_api.c
"""
imp... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.