id stringlengths 1 7 | text stringlengths 6 1.03M | dataset_id stringclasses 1
value |
|---|---|---|
1603816 | import datetime
import flask.scaffold
flask.helpers._endpoint_from_view_func = flask.scaffold._endpoint_from_view_func
import flask_restful
from flask import request
from marshmallow import ValidationError
from app import RestException, db
from app.model.investigator import Investigator
from app.model.study_investiga... | StarcoderdataPython |
3258862 | import json
import numpy as np
import os
import io
def dice_score(ref, pred):
# from https://stackoverflow.com/questions/49759710/calculating-dice-co-efficient-between-two-random-images-of-same-size
if ref.shape != pred.shape:
raise ValueError("Shape mismatch: img and img2 must have to be of the same ... | StarcoderdataPython |
4838571 | """Functions copypasted from newer versions of numpy.
"""
from __future__ import division, print_function, absolute_import
import warnings
import sys
import numpy as np
from numpy.testing.nosetester import import_nose
from scipy._lib._version import NumpyVersion
if NumpyVersion(np.__version__) > '1.7.0.dev':
_... | StarcoderdataPython |
3232782 | <reponame>beidongjiedeguang/manim-express
from manim_express_tests.tests_import import *
scene = EagerModeScene(screen_size=Size.medium)
test_axis = np.array([1, 1, 1])
vector_arrow = Arrow(ORIGIN, test_axis)
scene.play(ShowCreation(vector_arrow))
scene.hold_on()
q_1 = Quaternion().set_from_axis_angle(test_axis, 20 ... | StarcoderdataPython |
1671866 | # A part of pdfrw (pdfrw.googlecode.com)
# Copyright (C) 2006-2012 <NAME>, Austin, Texas
# MIT license -- See LICENSE.txt for details
class PdfObject(str):
''' A PdfObject is a textual representation of any PDF file object
other than an array, dict or string. It has an indirect attribute
which defa... | StarcoderdataPython |
1751437 | #!/usr/bin/python
##############################################
###Python template
###Author: <NAME>
###Date: 7/15/14
###Function: Conduct time-based simulations on age-structure networks where pre-existing immunity exists and is heterogeneous within the adult population. Vary single average value of immunity for sub... | StarcoderdataPython |
49991 | ## This File Contains all the different Neural Network Architectures used and the Loss function
import torch
import torch.nn as nn
import torch.nn.functional as functions
## Dense Network
class Dense(nn.Module):
def __init__(self):
super(Dense,self).__init__()
self.fc1 = nn.Linear(6*7,32) #board... | StarcoderdataPython |
4839642 | <reponame>domenukk/lighthouse
from .misc import *
from .debug import *
from .log import lmsg, logging_started, start_logging
| StarcoderdataPython |
3277058 | print("Input: ",end="")
string = input()
def stack(s):
if (len(s) == 0):
return
x = s[-1]
s.pop()
stack(s)
print(x, end="")
s.append(x)
def min(s):
Stack = []
Stack.append(s[0])
for i in range(1, len(s)):
if (len(Stack) == 0):
Stack.append(s[... | StarcoderdataPython |
1775084 | from django.apps import AppConfig
class IngresoConfig(AppConfig):
name = 'ingreso'
| StarcoderdataPython |
28766 | class Solution:
def diStringMatch(self, S):
low,high=0,len(S)
ans=[]
for i in S:
if i=="I":
ans.append(low)
low+=1
else:
ans.append(high)
high-=1
return ans +[low]
| StarcoderdataPython |
3240719 | # Faça um programa que leia o ano de nascimento de um jovem e informe, de acordo com sua idade:
# - se ele ainda vai se alistar ao serviço militar.
# - se é a hora de se alistar.
# - se já passou do tempo do alistamento.
# seu programa também deverá mostrar o tempo que falta ou que passou do prazo.
from datetime impor... | StarcoderdataPython |
43501 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
import matplotlib.pyplot as plt
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
class MatplotlibWidget(FigureC... | StarcoderdataPython |
1719089 | import json
import pytest
from idempotency_key.encoders import BasicKeyEncoder
from idempotency_key.exceptions import MissingIdempotencyKeyError
def test_basic_encoding():
class Request:
path_info = "/myURL/path/"
method = "POST"
body = json.dumps({"key": "value"}).encode("UTF-8")
r... | StarcoderdataPython |
161847 | # In the mysterious country of Byteland, everything is quite different from what you'd normally expect. In most places, if
# you were approached by two mobsters in a dark alley, they would probably tell you to give them all the money that you
# have. If you refused, or didn't have any - they might even beat you up.
#
#... | StarcoderdataPython |
1706411 | <filename>src/e404.py
#!/usr/bin/python
import util
import templates
def run():
print("Creating 404")
html = templates.get("404")
html = templates.initial_replace(html, -1)
html = templates.final_replace(html, ".")
util.writefile("../404.html", html)
if __name__ == "__main__":
run()
| StarcoderdataPython |
128297 | <reponame>troyel/OpenMetadata<gh_stars>1-10
# Copyright 2021 Collate
# 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 appl... | StarcoderdataPython |
1737697 | from django.db import models
class Job(models.Model):
image = models.ImageField(upload_to='images/')
summary = models.CharField(max_length=200)
| StarcoderdataPython |
3399015 | import copy
import json
import os
import pdb
import re
from typing import Dict, List, TypeVar
import torch
from elvis.modeling.models import build_net
from elvis.modeling.models.layers import MLP
from torch.nn import functional as F
from .base import MetaArch
from .build import ARCH_REGISTRY
Tensor = TypeVar('torch... | StarcoderdataPython |
41476 | """
Receiving Open Sound Control messages as audio streams
**02-receive-streams.py**
This script shows a granulation process controlled by OSC messages
coming from another program (run the next example, *03-send-streams.py*,
to get values coming in).
"""
from pyo import *
s = Server().boot()
# The sound table to g... | StarcoderdataPython |
3244987 | <gh_stars>1-10
# daily request to youtube
from django.utils import timezone
from youtube.models import despacito
from .ytbAPI import ytbAPI
from . import youtube_lib as ytb
def despacito_daily():
result = ytb.video_list('kJQP7kiw5Fk','statistics')
t = timezone.now()
v = result['statistics']['vie... | StarcoderdataPython |
1685128 | <gh_stars>10-100
# Copyright 2014-2020 Scalyr Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | StarcoderdataPython |
1675353 | #!/usr/bin/env python
"""bless_client
A sample client to invoke the BLESS Lambda function and save the signed SSH Certificate.
Usage:
bless_client.py region lambda_function_name bastion_user bastion_user_ip remote_usernames
bastion_ips bastion_command <id_rsa.pub to sign> <output id_rsa-cert.pub>
region: AWS... | StarcoderdataPython |
4815625 | <reponame>zhuyuanxiang/deep-learning-with-python-notebooks
# -*- encoding: utf-8 -*-
"""
@Author : zYx.Tom
@Contact : <EMAIL>
@site : https://zhuyuanxiang.github.io
---------------------------
@Software : PyCharm
@Project : deep-learning-with-python-notebooks
@File : ch0702_tenso... | StarcoderdataPython |
138454 | <gh_stars>1-10
from .APIKeyLabel import APIKeyLabel
from .Contract import Contract
from .DnsAddress import DnsAddress
from .Error import Error
from .GetOrganizationUsersResponseBody import GetOrganizationUsersResponseBody
from .IsMember import IsMember
from .JoinOrganizationInvitation import JoinOrganizationInvitation
... | StarcoderdataPython |
324 | # -*- coding: utf-8 -*-
"""
Created on Tue Jun 26 16:34:21 2018
@author: LiHongWang
"""
import os
import tensorflow as tf
from model import fcn_vgg
from model import fcn_mobile
from model import fcn_resnet_v2
from data import input_data
slim = tf.contrib.slim
def main():
num_classes... | StarcoderdataPython |
145207 | import os
from flask import Flask, render_template, request, Response, send_from_directory, Blueprint, flash, g, redirect
from functools import wraps
from flask import current_app as app
from flask_nav.elements import Navbar, View, Subgroup, Link, Text, Separator
import datetime
from crontab import CronTab
import getp... | StarcoderdataPython |
3393269 | #! /usr/bin/python
import logging
import os
import random
import threading
from random import randint
class emGps(threading.Thread):
def __init__(self, mode=None):
threading.Thread.__init__(self)
logging.info('Global Positioning System')
self.gpsd = None
self.running = False
... | StarcoderdataPython |
1731868 | <filename>rec_run.py
import os
import argparse
def get_all_ini_files():
"""
collect all ini files in the current folder
:return: a list of sorted file names
"""
current_path = os.getcwd()
all_files = os.listdir(current_path)
ini_files = []
for item in all_files:
if os.path.is... | StarcoderdataPython |
1699053 | import os
from configparser import ConfigParser, RawConfigParser
from flask import request, g, Response
import requests
from json import dumps, loads
from pymunge import MungeContext
curr_dirname = os.path.dirname(os.path.abspath(__file__))
src_dir, _ = os.path.split(curr_dirname)
file = src_dir + '/dev_config.ini'
... | StarcoderdataPython |
3234542 | <filename>blog/migrations/0005_auto_20180721_0113.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2018-07-21 08:13
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('blog', '0004_auto_20180721_0108'),
]
... | StarcoderdataPython |
3369629 | <gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class AlipayCommerceDataScenicSyncModel(object):
def __init__(self):
self._code_value = None
self._isv_name = None
self._isv_scenic_address = None
sel... | StarcoderdataPython |
170905 | <gh_stars>1-10
from topfarm.constraint_components.capacity import CapacityConstraint
import numpy as np
import topfarm
from topfarm.tests.test_files import xy3tb
from topfarm._topfarm import TopFarmProblem
from topfarm.easy_drivers import EasySimpleGADriver
def test_capacity_as_penalty():
tf = xy3tb.get_tf(design... | StarcoderdataPython |
114294 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import typing as tp
from . import core
from . import container
from . import choice
def flatten_parameter(
para... | StarcoderdataPython |
4840264 | <reponame>xiaohuid/huobi_Python<filename>huobi/model/accountbalancerequest.py
from huobi.model import *
class AccountBalanceRequest:
"""
The account change information received by subscription of account.
:member
timestamp: The UNIX formatted timestamp generated by server in UTC.
change_t... | StarcoderdataPython |
157342 | # Generated by Django 2.2.6 on 2019-12-07 01:20
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('events', '0016_auto_20191206_2347'),
]
operations = [
migrations.DeleteModel(
name='DayOfWeek',... | StarcoderdataPython |
143857 | #!/usr/bin/env python
#
# Copyright 2011 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | StarcoderdataPython |
1796190 | <reponame>L3gume/CodeAndBrunch
from setuptools import setup
# you may need setuptools instead of distutils
setup (
# basic stuff here
scripts = [
'patrickTweet.py',
'jsonParser.py'
]
)
| StarcoderdataPython |
3250813 | import osgtest.library.core as core
import osgtest.library.files as files
import osgtest.library.osgunittest as osgunittest
class TestRestoreLcMaps(osgunittest.OSGTestCase):
@core.osgrelease(3.5)
def test_01_restore_lcmaps(self):
core.skip_ok_unless_installed('lcmaps', 'lcmaps-plugins-voms', 'lcmaps-d... | StarcoderdataPython |
3358177 | # coding=utf8
import re
import os
import logging
import datetime
class SignalInfo:
def __init__(self):
self.log_datetime = None
self.startup = None
self.strategy = None
self.runtime = None
self.signal = None
self.instrument = None
self.quantity = None
... | StarcoderdataPython |
155818 | import datetime
import random
import threading
import time
from selenium import webdriver
from selenium.common.exceptions import TimeoutException, WebDriverException
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.support.ui import WebDrive... | StarcoderdataPython |
189678 | # -*- coding: utf-8 -*-
"""
Created on Thu Sep 18 09:25:00 2014
@author: rich
"""
import sys
import re
import ast
import numpy as np
from collections import Counter
headerQuestion = 'Question'
headerQID = 'qID'
headerQuestionType = 'qAnalysisType'
headerQuestionWeight = 'qWeight'
headerPossibleResponses = 'Possible ... | StarcoderdataPython |
1681038 | <filename>ansible/venv/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_auditlog.py
#!/usr/bin/python
# (c) 2018, NetApp, Inc
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ ... | StarcoderdataPython |
3395754 | <filename>scrapy_cookies/storage/mongo.py
import logging
import pickle
import re
from http.cookiejar import Cookie
from itertools import starmap
from typing import Dict
import pymongo
from pymongo import MongoClient
from pymongo.collection import Collection
from pymongo.database import Database
from scrapy.http.cookie... | StarcoderdataPython |
23317 | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
"""This mo... | StarcoderdataPython |
31379 | CANAIS_ADM = {
"diretoria": 441263190832185350,
"secretaria": 731689039853518848
}
SAUDACOES = ["Olá!", "Oi!", "Iai!"]
GUIA_ANONIMA_ID = 956319073568976967
msg_ajuda = "**::ola** | **::oi** | **::iai** | **::athena**: Mande um ola caloroso para mim, e responderei!\n" \
"**::cool** `texto`: Você po... | StarcoderdataPython |
3381040 | <gh_stars>1-10
# Copyright 2019 The Kapitan Authors
# SPDX-FileCopyrightText: 2020 The Kapitan Authors <<EMAIL>>
#
# SPDX-License-Identifier: Apache-2.0
"kapitan error classes"
class KapitanError(Exception):
"""generic kapitan error"""
pass
class CompileError(KapitanError):
"""compile error"""
pa... | StarcoderdataPython |
4818819 | """
Struct that holds abstract_task, its part and handlers.
"""
from typing import Callable, Tuple
import numpy as np
from omtool.core.datamodel.abstract_task import AbstractTask
from omtool.core.datamodel.snapshot import Snapshot
class HandlerTask:
"""
Struct that holds abstract_task, its part and handlers.... | StarcoderdataPython |
1733589 | # Generated by Django 2.2 on 2019-04-17 06:02
import django.contrib.postgres.fields.jsonb
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0004_auto_20190417_0601'),
]
operations = [
migrations.AlterField(
model_name='avatar'... | StarcoderdataPython |
3335244 | import numpy as np
def return_test_set(X, y):
"""
:param X : 2D array of our dataset
:param y : 1D array of the groundtruth labels of the dataset
"""
# total number of samples in the dataset
N = X.shape[0]
indices_all = list(np.arange(N))
... | StarcoderdataPython |
1679237 | # -*- coding: utf-8 -*-
"""Mutations that expand the graph."""
from . import neighborhood, upstream
from .neighborhood import *
from .upstream import *
__all__ = neighborhood.__all__ + upstream.__all__
| StarcoderdataPython |
1632948 | # Feed-related, but Atom-independent, functions.
from feedmark.utils import quote_plus
def construct_entry_url(section):
# Currently supports links to anchors generated by Github's Markdown renderer.
if 'link-target-url' not in section.document.properties:
return None
return '{}#{}'.format(sect... | StarcoderdataPython |
1742638 | import numpy as np
import matplotlib.pylab as plt
from skimage.transform import resize
import imageio
from os import walk
from skimage.restoration import denoise_nl_means, estimate_sigma
noisy_path = 'C:/Files/M2 MVA/S1/Object recognition/Project/SinGAN-master/Input/GaussianNoise/'
NLmeans_path = 'C:/Files... | StarcoderdataPython |
5524 | <gh_stars>0
# Copyright (c) 2021 PaddlePaddle Authors. 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/LICENSE-2.0
#
# Unless requi... | StarcoderdataPython |
7746 | <gh_stars>1-10
import wrapper as w
from multiprocessing import Process
import atexit
import time
from queue import Queue
''' 8 Processes, 24 threads per process = 192 threads '''
NUM_PROCESSES = 8
workerList = [] # Worker processes
class Worker(Process): # Need multiple threads or else it takes forever
def __init_... | StarcoderdataPython |
1721067 | <gh_stars>1-10
from iocompython import Root, EndPoint, Signal, Stream, json2bin
import ioterminal
import time
def get_network_conf(device_name, network_name):
global root
exp_mblk_path = 'conf_exp.' + device_name + '.' + network_name
imp_mblk_path = 'conf_imp.' + device_name + '.' + network_name
str... | StarcoderdataPython |
19213 | """
These tests require an AWS account to be set up, but don't require any manual
intervention beyond some initial setup. Also, these tests create instances (which cost
money!). Either `meadowrun-manage install` needs to be set up, or `meadowrun-manage
clean` needs to be run periodically
"""
import asyncio
import date... | StarcoderdataPython |
4817309 | <filename>plans/apps.py
from django.apps import AppConfig
from . import conf as app_settings
class PlansConfig(AppConfig):
name = 'plans'
verbose_name = app_settings.APP_VERBOSE_NAME
| StarcoderdataPython |
3348593 | <filename>multilingual_librispeech/reorg_speakers.py
import os
mls_root = 'D:/Data/speech/multilingual_librispeech'
for language in os.listdir(mls_root):
language_dir = os.path.join(mls_root, language)
if not os.path.isdir(language_dir):
continue
print(language)
for speaker in os.listdir(langu... | StarcoderdataPython |
111981 | <filename>ckanext/ckanpackager/cli.py
import click
from ckan import model
from .model.stat import ckanpackager_stats_table
def get_commands():
return [ckanpackager]
@click.group()
def ckanpackager():
'''
The CKAN Packager CLI.
'''
pass
@ckanpackager.command(name='initdb')
def init_db():
'... | StarcoderdataPython |
1748279 | from setup import *
def plot_attention(epoch_attentions, epoch):
attn_plot_size = 16
attention = np.array(epoch_attentions[-1])
attention = attention[:attn_plot_size, :attn_plot_size]
plt.clf()
sns_plot = sns.heatmap(attention, cmap="GnBu")
plt.title('Hidden State Activation vs. Decoder Time ... | StarcoderdataPython |
1608226 | """
Copyright (c) 2020 COTOBA DESIGN, Inc.
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 limitation
the rights to use, copy, modify, merge, publish, distri... | StarcoderdataPython |
114312 | from math import ceil
import cocotb
import random
from cocotb.clock import Clock
from cocotb.result import TestSuccess, TestFailure
from cocotb.triggers import RisingEdge
from queue import Queue
from poseidon_python import basic
from cocotb_test import simulator
CASES_NUM = 1 # the number of test cases
BUFFER_SIZE =... | StarcoderdataPython |
3207039 | <reponame>douglaspands/controle-financeiro
from django.http import HttpRequest, HttpResponse
from django.shortcuts import render
from django.views.generic import TemplateView, View
from .forms import RegistroForm
from .usecases import registrar_usuario_pessoa_fisica
class LogoutConfirmar(TemplateView):
template_... | StarcoderdataPython |
3311928 | from todo import *
bloco = Bloquinho()
#colocando o bloco dentro do programa que manipula ele
app = Request(bloco)
#inicia o loop do programa
app.run()
| StarcoderdataPython |
121593 | <filename>graspsampling-py-defgraspsim/graspsampling/utilities.py<gh_stars>10-100
# Copyright (c) 2020 NVIDIA Corporation
# 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,... | StarcoderdataPython |
106234 | <reponame>IvanProgramming/dnevnik_mos_ru
__version__ = "2.3.0"
from .school import School
from .class_unit import ClassUnit
from .group import Group
from .teacher import Teacher
from .student_profile import StudentProfile
from .client import Client
from .academic_years import AcademicYear
from .auth_providers import *... | StarcoderdataPython |
1681588 | #!/usr/bin/python3
try:
from pbkdf2 import PBKDF2
except:
print("install pbkdf2: \"pip3 install pbkdf2\"")
exit(1)
try:
from Crypto import Random
from Crypto.Util.py3compat import bchr
from Crypto.Cipher import AES
except:
print("install pycrypto: \"pip3 install pycrypto\"")
exit(1)
import os, sys
from base64 ... | StarcoderdataPython |
3232362 | # Copyright (C) 2019 The Raphielscape Company LLC.
#
# Licensed under the Raphielscape Public License, Version 1.d (the "License");
# you may not use this file except in compliance with the License.
#
# Port to userbot by @MoveAngel
from telethon.errors.rpcerrorlist import YouBlockedUserError
from userbot import bot, ... | StarcoderdataPython |
87672 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-08-29 20:55
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('animals', '0001_initial'),
]
operations = [
migrations.AlterField(
... | StarcoderdataPython |
137563 | <reponame>ajrox090/VaRA-Tool-Suite<filename>varats/varats/data/reports/commit_report.py<gh_stars>0
"""Data wrappers for commit reports generated by VaRA."""
import logging
import typing as tp
from pathlib import Path
import pandas as pd
import yaml
from varats.base.version_header import VersionHeader
from varats.mapp... | StarcoderdataPython |
79468 | <reponame>SidneyAn/nfv<filename>nfv/nfv-vim/nfv_vim/nfvi/objects/v1/_guest_service.py
#
# Copyright (c) 2015-2016 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
import six
from nfv_common.helpers import Constant
from nfv_common.helpers import Constants
from nfv_common.helpers import Singleton
from... | StarcoderdataPython |
1623371 | # -*- coding: utf-8 -*-
"""
Provide a wrapper and helpers for AWS boto library.
See https://boto3.readthedocs.io/en/latest/ for API details
"""
import logging
import os
import boto3
import re
import toil.provider.base
import toil
from botocore.client import Config
logger = logging.getLogger(__name__)
... | StarcoderdataPython |
1660249 | from unittest.mock import patch
import pytest
from exco.extractor import Validator
from exco.extractor.validator.built_in.is_not_blank_validator import IsNotBlankValidator
from exco.extractor.validator.built_in.value_validator import ValueValidator
from exco.extractor.validator.validation_result import ValidationResu... | StarcoderdataPython |
4832467 | import cv2
import numpy as np
#Read a Video Stream and Display It
#Camera Object
cam = cv2.VideoCapture(0)
face_cascade = cv2.CascadeClassifier("haarcascade_frontalface_alt.xml")
face_data= []
cnt =0
user_name = input("Enter your name")
while True:
ret,frame = cam.read()
if ret==False:
print("... | StarcoderdataPython |
76754 | <reponame>joefinlon/Finlon_et_al_2021_DFR<filename>dfr_enhancement.py
'''
Contains a routine to find regions of enhanced DFR based on matched DFR_Ku-Ka using
a peak prominence method.
Copyright <NAME>, Univ. of Washington, 2022.
'''
import numpy as np
from scipy.signal import find_peaks, peak_prominences, peak_widths... | StarcoderdataPython |
3349030 | <reponame>clefever/aoc2019
from collections import defaultdict
import adventofcode
def part1(codes):
prog = defaultdict(int, zip(range(len(codes)), codes))
output = run_program(prog, [])
x, y = 0,0
grid = defaultdict(int)
for char in output[1]:
if char == 10:
y += 1
... | StarcoderdataPython |
4842578 | """Find the minimal frame pointer and stack pointer positions from a C6T VM
logfile. This will be the lowest depth of the stack.
"""
from sys import argv
from typing import Optional, Tuple
def findmin(log: str, fieldpos: int) -> Optional[int]:
"""Splits and then finds minimum in given split index fieldpos.
"... | StarcoderdataPython |
3297470 | import tweepy
from twill_util import Util
class Twill():
def __init__(self,
consumer_key=None,
consumer_secret=None,
access_token=None,
access_token_secret=None):
'''Initialize the tweepy api'''
self.util = Util()
if not consumer_key:
... | StarcoderdataPython |
3362170 |
from setuptools import setup, find_packages
from opensimplex import __version__
setup(
name='opensimplex',
version=__version__,
description='OpenSimplex n-dimensional gradient noise function.',
long_description=open('README.rst').read(),
keywords='opensimplex simplex noise 2D 3D 4D',
url='ht... | StarcoderdataPython |
185615 | from flask import Flask
from flask import request
from flask import render_template
from sassutils import builder
from search import search
import json
app = Flask(__name__)
compiled = builder.build_directory(
sass_path="static/scss",
css_path="static/css",
strip_extension=False
)
if app.debug or app.env =... | StarcoderdataPython |
4819469 | # coding: utf-8
import datetime
from simple_api import db
class User(db.Document):
username = db.StringField(unique=True, sparse=True, regex=r'^[a-z0-9][a-z0-9\.\-_]*$')
email = db.EmailField(max_length=256)
created_at = db.DateTimeField(default=datetime.datetime.utcnow)
meta = {
'index_back... | StarcoderdataPython |
168310 | <reponame>thatch/nozomi<gh_stars>1-10
"""
Nozomi
Abstract API Session Module
author: <EMAIL>
"""
from nozomi.data.decodable import Decodable
from nozomi.security.agent import Agent
from nozomi.ancillary.immutable import Immutable
from nozomi.security.perspective import Perspective
from typing import TypeVar
T = TypeVa... | StarcoderdataPython |
3309101 | <reponame>shish/sikulpy<gh_stars>10-100
"""
http://doc.sikuli.org/keys.html
"""
import autopy3 # EXT
class Key(object):
ENTER = int(autopy3.key.K_RETURN)
UP = int(autopy3.key.K_UP)
DOWN = int(autopy3.key.K_DOWN)
LEFT = int(autopy3.key.K_LEFT)
RIGHT = int(autopy3.key.K_RIGHT)
BACKSPACE = int(... | StarcoderdataPython |
90342 | <reponame>mentix02/djodo<filename>task/urls.py
from django.urls import path, register_converter
from task import views, converters
register_converter(converters.DateConverter, 'date')
app_name = 'task'
urlpatterns = [
path('', views.TaskListView.as_view(), name='index'),
path('create/', views.TaskCreateView... | StarcoderdataPython |
4822854 | <reponame>radluz/fakear
import pytest
import yaml
import os
from fakear import Fakear, FakearFileNotFound
from voluptuous import Error as VoluptuousError
class TestErrorsFakear(object):
def test_engine_multiple_args_one_error(self):
with pytest.raises(VoluptuousError):
Fakear(cfg="tests/cfgs/... | StarcoderdataPython |
1610779 | <filename>RockPaperScissors.py
import pygame, random
WINDOW_WIDTH = 800
WINDOW_HEIGHT = 600
pygame.init()
screen = pygame.display.set_mode([WINDOW_WIDTH
, WINDOW_HEIGHT])
pygame.display.set_caption('Smileeeeeeeeeeeeeeeeeee')
keep_going = True
pic = pygame.image.load('./resources/bal... | StarcoderdataPython |
1625603 | from flask import jsonify, Response
from backend.api.handlers.decorators import api_authenticated, validate_team_key
from backend.common.consts.api_version import ApiMajorVersion
from backend.common.decorators import cached_public
from backend.common.models.keys import TeamKey
from backend.common.queries.team_query im... | StarcoderdataPython |
3281117 | <gh_stars>1-10
import multiprocessing
import os
import re
from utils.Log import Log
import requests
import threadpool
from net.NetUtils import EasyHttp
from utils.sqllite_handle import Sqlite
requests.packages.urllib3.disable_warnings()
address = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) + '/'
"""
... | StarcoderdataPython |
4841717 | <reponame>csh-tech/horovod<filename>horovod/torch/sync_batch_norm.py
# Based on https://github.com/pytorch/pytorch/blob/master/torch/nn/modules/_functions.py
# Modifications copyright 2020 Maka Autonomous Robotic Systems
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file exc... | StarcoderdataPython |
105308 | """
time: c*26 + p
space: 26 + 26 (1)
"""
class Solution:
def findAnagrams(self, s: str, p: str) -> List[int]:
cntP = collections.Counter(p)
cntS = collections.Counter()
P = len(p)
S = len(s)
if P > S:
return []
ans = []
for i, c in enumerate(s):
... | StarcoderdataPython |
1777405 | <gh_stars>1-10
# Choregraphe simplified export in Python.
from naoqi import ALProxy
names = list()
times = list()
keys = list()
names.append("HeadPitch")
times.append([0.8, 1.56, 2.24, 2.8, 3.48, 4.6])
keys.append([0.29602, -0.170316, -0.340591, -0.0598679, -0.193327, -0.01078])
names.append("HeadYaw")
times.append([... | StarcoderdataPython |
1643707 | <reponame>realvitya/fmcapi
from fmcapi.api_objects.apiclasstemplate import APIClassTemplate
from fmcapi.api_objects.helper_functions import *
from .networkaddresses import NetworkAddresses
import logging
import warnings
class NetworkGroups(APIClassTemplate):
"""
The NetworkGroups Object in the FMC.
"""
... | StarcoderdataPython |
4809055 | <gh_stars>1000+
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
try:
from unittest.mock import Mock, patch
except ImportError: # python < 3.3
from mock import Mock, patch # type: ignore
from azure.identity.... | StarcoderdataPython |
4842306 | import decorator
import inspect
import time
import zope.testing.cleanup
_caches = {}
_timeouts = {}
def collect():
"""Clear cache of results which have timed out"""
for func in _caches:
for key in list(_caches[func]):
if (time.time() - _caches[func][key][1] >=
_timeou... | StarcoderdataPython |
1606434 | import numpy as np
def generate_noise(size, beta):
white_noise = np.random.randn(*size)
white_noise_fft = np.fft.fftn(white_noise)
ndims = len(size)
freq_along_axis = []
for axis in range(ndims):
freq_along_axis.append(np.fft.fftfreq(size[axis]))
grids = np.meshgrid(*freq_along_ax... | StarcoderdataPython |
1672995 | # Generated by Django 3.0.5 on 2020-12-23 15:51
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('shows', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='show',
name='updated_date',... | StarcoderdataPython |
181296 | #removes small images (<80x80) and resize all remaining images to 80x80
import os
import cv2
sourceDir = 'D:\MER\Dataset\Expressions\\3. Face_crop\\Surprise' # Source folder
targetDir = 'D:\MER\Dataset\Expressions\\4. small_image_removed_resized\\Surprise' # Target Folder
imageCount = 0
for sRoot,sDirs,sFiles i... | StarcoderdataPython |
3230319 | <gh_stars>1-10
# Generated by Django 3.0.6 on 2021-03-01 09:57
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("backend", "0004_pointsgained_comment"),
]
operations = [
migrations.AddField(
model_name="community",
... | StarcoderdataPython |
86116 | from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('adverts', '0006_auto_20150303_0009'),
]
operations = [
migrations.AlterField(
model_name='adchannel',
name='ad_formats',
field=models.ManyToManyField(
... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.