id stringlengths 1 7 | text stringlengths 6 1.03M | dataset_id stringclasses 1
value |
|---|---|---|
56108 | <reponame>thekerrlab/brainstaves<filename>bsmindwave/__init__.py
from .bs_mindwave import Mindwave | StarcoderdataPython |
3311525 | <filename>IMLearn/learners/classifiers/gaussian_naive_bayes.py
from typing import NoReturn
from ...base import BaseEstimator
import numpy as np
from numpy.linalg import det, inv
from IMLearn.learners.gaussian_estimators import UnivariateGaussian
class GaussianNaiveBayes(BaseEstimator):
"""
Gaussian Naive-Bayes... | StarcoderdataPython |
1652448 | <filename>enthought/units/ui/meta_quantity_view.py<gh_stars>1-10
# proxy module
from __future__ import absolute_import
from scimath.units.ui.meta_quantity_view import *
| StarcoderdataPython |
3260344 | <filename>webapp/text-sum-core.py
from flask import Flask, render_template, request, send_file
from werkzeug import secure_filename
app = Flask(__name__)
@app.route('/text-summarizer')
def ignite():
return render_template('main-page.html')
@app.route('/result_text',methods = ['POST', 'GET'])
def result_text():
if... | StarcoderdataPython |
1637089 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# This file was part of Flask-Bootstrap and was modified under the terms of
# its BSD License. Copyright (c) 2013, <NAME>. All rights reserved.
#
# This file was part of Bootstrap-Flask and was modified under the terms of
# its MIT License. Copyright (c) 2018 <NAME>. All r... | StarcoderdataPython |
3204818 | # For find the pose of any person
import cv2
from cvzone.PoseModule import PoseDetector
cap = cv2.VideoCapture(0)
detector = PoseDetector()
while True:
Success, img = cap.read()
img = detector.findPose(img)
lmList, bboxInfo = detector.findPosition(img)
cv2.imshow("Image",img)
cv2.wa... | StarcoderdataPython |
122397 | """Implement the Space Packet protocol as used by cFE for the Software Bus:
https://github.com/nasa/cFE/blob/6.7.3-bv/fsw/cfe-core/src/sb/cfe_sb_msg_id_util.c refers to:
"CCSDS Space Packet Protocol 133.0.B-1 with Technical Corrigendum 2, September 2012"
So the relevant specifications are:
* https://web.archive.... | StarcoderdataPython |
17064 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
__title__ = ''
__author__ = 'HaiFeng'
__mtime__ = '2016/8/16'
"""
import time
from py_at.EnumDefine import *
########################################################################
class OrderItem(object):
"""策略信号"""
#----------------------------------------------... | StarcoderdataPython |
3340629 | """
Copyright (C) 2019-2020 <NAME>.
This Source Code Form is subject to the terms of the
Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed
with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
"""
from askci.apps.users.models import User
from askci.settings import (
VIEW_RATE... | StarcoderdataPython |
3319064 | # RateLimiter: Execute query when number of queries per minute is lower than MAX_RATE_PER_MIN
#
# @author <NAME>
# 12/5/2018
from datetime import datetime as dt
import time
MAX_RATE_PER_MIN = 10
hash = {}
# returns 1 if underlimit, else 0
def isUnderLimit(userId):
return (1 if updateHash(userId) <= MAX_RATE_PER_... | StarcoderdataPython |
1636758 | from core import banners
from core import config
from core import TwitterActions
from core import MainFunctions
from time import sleep
import random
import os
try:
import argparse
except ImportError:
print("* Couldn't find requests, trying to install argparse using pip3 ..")
os.system("pip3 install argpar... | StarcoderdataPython |
138527 | """
Copyright 2014 Rackspace
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
dist... | StarcoderdataPython |
185989 | <gh_stars>0
from django.db import models
from .enums import LevelType
class AccessLevel(models.Model):
"""
Defines how information about certain access level will be stored in the database
Access levels is filled during the application installation routines
"""
type = models.CharField(max_length=... | StarcoderdataPython |
3323892 | <gh_stars>10-100
# -*- coding: utf-8 -*-
# @Time : 2019-11-10 16:49
# @Author : yingyuankai
# @Email : <EMAIL>
# @File : __init__.py
from .base_model import BaseModel
from .pretrained import *
from .classifications import *
from .info_extract import *
from .question_answer import *
from .generation import *
| StarcoderdataPython |
168597 | <filename>there/jupyter-setup.py
#! /usr/bin/env python3
# encoding: utf-8
#
# (C) 2017 <NAME> <<EMAIL>>
#
# SPDX-License-Identifier: BSD-3-Clause
"""\
Install a json kernel specification into the users settings of Jupyter.
see also http://jupyter-client.readthedocs.io/en/latest/kernels.html#kernel-specs
"""
KERNE... | StarcoderdataPython |
4830016 | # Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not ... | StarcoderdataPython |
3289765 | #!/usr/bin/python
# 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.
#
# This program is distributed in the hope that... | StarcoderdataPython |
4817563 | <reponame>olivier-m/rafter<filename>rafter/exceptions.py
# -*- coding: utf-8 -*-
"""
Exceptions
----------
.. autoexception:: ApiError
.. autoattribute:: data
.. automethod:: to_primitive
Error Handlers
--------------
.. autoclass:: ExceptionHandler
.. automethod:: __call__
.. autoclass:: SanicExcept... | StarcoderdataPython |
177373 | # -*- coding: utf-8 -*-
"""说明:
select
"""
import select
import socket
from queue import Queue # message queue
import time
def run(host='localhost', port=8086):
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as server:
# https://docs.python.org/3/library/socket.html#socket.socket.setblocking
... | StarcoderdataPython |
3317679 | from DartDeepRNN.rnn.RNNController import RNNController
from DartDeepRNN.util.Pose2d import Pose2d
from DartDeepRNN.util.Util import *
from OpenGL.GL import *
from OpenGL.GLU import *
from fltk import *
from PyCommon.modules.GUI.hpSimpleViewer import hpSimpleViewer as SimpleViewer
from PyCommon.modules.Renderer import... | StarcoderdataPython |
1770426 | # Keras implementation of the paper:
# 3D MRI Brain Tumor Segmentation Using Autoencoder Regularization
# by <NAME>. (https://arxiv.org/pdf/1810.11654.pdf)
# Author of this code: <NAME> (https://github.com/IAmSUyogJadhav)
from blocks import *
from utils import *
import torch
import torch.nn as nn
from collections impo... | StarcoderdataPython |
3280505 | <gh_stars>1-10
__version__ = '1.4.0'
__flavio__version__ = '1.6.0'
| StarcoderdataPython |
5587 | """API for AVB"""
import json
import sys
import requests
def actualite_found ():
osm = "https://opendata.bruxelles.be/api/datasets/1.0/search/?q="
data = {
"nhits":0,
"parameters":{
"dataset":"actualites-ville-de-bruxelles",
"timezone":"UTC",
"q":"actualite",
"langu... | StarcoderdataPython |
3249947 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
test_weasycovers.py
Last updated: 2019-12-04
"""
from wz_core.reporting import Report
from test_core import testinit, runTests
if __name__ == '__main__':
testinit ()
from wz_text import coversheet
runTests (coversheet)
| StarcoderdataPython |
1615246 | <reponame>he-actlab/cdstack
from TablaListener import TablaListener
class ProgramPrinter(TablaListener):
counter = 0
isLeft = True
lineBuilder = ""
inStat = False
ssaTable = {}
ssaFile = open("ssa.txt", "a")
temp = {}
var = ""
def enterProgram(self, ctx):
#print(ctx.childre... | StarcoderdataPython |
4839966 | <reponame>erd3muysal/rapsodo<filename>train.py
import numpy as np
from tensorflow.keras.applications import VGG16, InceptionV3, ResNet50, DenseNet121, MobileNet, MobileNetV2
from tensorflow.keras.utils import Sequence
from tensorflow.keras.layers import Flatten
from tensorflow.keras.layers import Dense
from tensorflow.... | StarcoderdataPython |
1676431 | <gh_stars>10-100
"""Caching of formatted files with feature-based invalidation."""
import os
import pickle
from pathlib import Path
import tempfile
from typing import Dict, Iterable, Set, Tuple
from platformdirs import user_cache_dir
from black.mode import Mode
from _black_version import version as __version__
# ... | StarcoderdataPython |
197489 | <gh_stars>0
# import pandas
import numpy as np
#-------------------------------Function to manipulate Features------------------
# This function takes dataframe and normalized frame to extract the required
# Features from the JSON data and returns the array
def extract_array(frame):
hand = frame['hands'][0]
# n... | StarcoderdataPython |
1767641 | from flask import Blueprint
control_panel = Blueprint('control_panel',__name__)
from app.control_panel import views | StarcoderdataPython |
150175 | <filename>openleadr/enums.py
# SPDX-License-Identifier: Apache-2.0
# Copyright 2020 Contributors to OpenLEADR
# 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/lice... | StarcoderdataPython |
128078 | <filename>modules/implant/gather/hashdump_dc.py
import core.implant
import uuid
class HashDumpDCImplant(core.implant.Implant):
NAME = "Domain Hash Dump"
DESCRIPTION = "Dumps the NTDS.DIT off the target domain controller."
AUTHORS = ["zerosum0x0", "Aleph-Naught-"]
def load(self):
self.options.... | StarcoderdataPython |
1614351 | from spacy.matcher import Matcher
from spacy.tokens import Token, Doc
from spacy.language import Language
from scispacy.hearst_patterns import BASE_PATTERNS, EXTENDED_PATTERNS
@Language.factory("hyponym_detector")
class HyponymDetector:
"""
A spaCy pipe for detecting hyponyms using Hearst patterns.
This ... | StarcoderdataPython |
3396967 | # TO RUN
# python experiments/run_experiment.py examples/tpot_medicare.py <PEM FILE> <BUCKET> --instance-type m5.4xlarge
from tpot import TPOTClassifier
local = False
random_state = 42
features_file = 'data/2015_partB_sparse.npz'
labels_file = 'data/2015_partB_lookup.csv'
label_col = 'provider_type'
classifier = TPO... | StarcoderdataPython |
1759333 | # -*- coding: utf-8 -*-
"""
Created on Tue May 12 22:36:50 2020
@author: Xavier
"""
import numpy as np
f = np.array(
[["#","#","#"],
["#"," "," "],
["#","#","#"],
["#"," "," "],
["#"," "," "]])
for ii in range (0,2):
print(np.flip(f, ii ))
| StarcoderdataPython |
172933 | <reponame>jbueltemeier/pystiche<filename>tests/test_ops.py
import itertools
import torch
from torch import nn
from torch.nn.functional import mse_loss
import pystiche
from pystiche import ops
from pystiche.enc import MultiLayerEncoder, SequentialEncoder, SingleLayerEncoder
from pystiche.image.transforms.functional im... | StarcoderdataPython |
172995 | <filename>data-storage-manager/src/simcore_service_dsm/rest/config.py<gh_stars>0
""" REST-api configuration
- Set here the version of API to be used
- Versions and name consistency tested in test_rest.py
"""
from pathlib import Path
import yaml
from .. import resources
API_MAJOR_VERSION = 1
API_URL_VERSION = "v{:.... | StarcoderdataPython |
3238000 | <reponame>Ninja-Official/rtu-mirea-schedule-api
from fastapi import APIRouter, Depends, Path
from fastapi.responses import JSONResponse
from starlette.exceptions import HTTPException
from starlette.status import HTTP_404_NOT_FOUND
from app.database.database import AsyncIOMotorClient, get_database
from app.models.sched... | StarcoderdataPython |
1747703 | import matplotlib
matplotlib.use("Agg") # noqa
import warnings
import os
import numpy as np
import matplotlib.pyplot as plot
import matplotlib.font_manager
import xarray as xr
import seaborn as sns
import scipy.optimize
try:
import tephigram
HAS_TEPHIGRAM = True
except ImportError:
HAS_TEPHIGRAM = Fa... | StarcoderdataPython |
1719424 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import xml.etree.ElementTree as ElementTree
import logging
class QtTs(object):
def __init__(self, ts_path, tr_table, patch):
self.ts_path = ts_path
self.xml_tree = ElementTree.parse(ts_path)
self.tr_table = tr_table
self.patch = patch
... | StarcoderdataPython |
3307521 | <reponame>kowalcj0/teeb<gh_stars>0
# -*- coding: utf-8 -*-
"""
Modified version of a Cue Sheet parser from idlesign.
https://github.com/idlesign/deflacue/blob/master/deflacue/deflacue.py
Improvements:
* turned get_global_context & context_tracks into .meta & .tracks properties
* auto text encoding detection wi... | StarcoderdataPython |
3208579 | <gh_stars>0
from django.db import models
from django.contrib.auth.models import User
from django.utils import timezone
from api.utils import humanize_time
import datetime
import urllib
class ChatMessage(models.Model):
author = models.ForeignKey(User, related_name='author', null=False, blank=False)
message = m... | StarcoderdataPython |
3392873 | from json import dumps, loads
from typing import List
# Sample Data
# [
# {
# "id": 10,
# "name": "<NAME>",
# "fatherId": -1,
# "motherId": -1,
# "spouseId": 22,
# "gender": "M",
# "childIds": []
# },
# {
# "id": 20,
# "name": "<NAME>",
# "fatherId": 7,
# "motherId": ... | StarcoderdataPython |
3358917 | <gh_stars>0
import time, re
from bs4 import BeautifulSoup
import pandas as pd
import numpy as np
import requests
import matplotlib.font_manager as fm
import matplotlib.pyplot as plt
from wordcloud import WordCloud
from collections import Counter
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.f... | StarcoderdataPython |
36168 | import unittest
import acpc_python_client as acpc
from tools.constants import Action
from weak_agents.action_tilted_agent import create_agent_strategy, create_agent_strategy_from_trained_strategy, TiltType
from tools.io_util import read_strategy_from_file
from evaluation.exploitability import Exploitability
from tool... | StarcoderdataPython |
1624876 | # -*- coding: utf-8 -*-
# Time : 2021/12/22 0:12
# Author : QIN2DIM
# Github : https://github.com/QIN2DIM
# Description:
from gevent import monkey
monkey.patch_all()
from apis.scaffold import (
entropy,
runner,
server
)
from services.middleware.subscribe_io import SubscribeManager
from serv... | StarcoderdataPython |
1704659 | # Time: O(nlogn + mlogm + nlogk + mlogk), k is max(max(nums), max(xi))
# Space: O(nlogk)
class Trie(object):
def __init__(self, bit_length):
self.__root = {}
self.__bit_length = bit_length
def insert(self, num):
node = self.__root
for i in reversed(xrange(self.__bit_le... | StarcoderdataPython |
120916 | <filename>leetcode/medium/Linked Lists/LinkedListCycleCheck_ii.py
# Given a linked list, return the node where the cycle begins. If there is no cycle, return null.
# To represent a cycle in the given linked list, we use an integer pos which represents the position (0-indexed) in the linked list where tail connects to.... | StarcoderdataPython |
1662148 | # This code is part of Mapomatic.
#
# (C) Copyright IBM 2022.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative... | StarcoderdataPython |
9074 | # Copyright 2017 Mycroft AI Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | StarcoderdataPython |
140417 | <gh_stars>0
import base64
import sys
from django.core.mail import EmailMessage, EmailMultiAlternatives
from django.test import override_settings
from django.test.testcases import SimpleTestCase
from sendgrid_backend.mail import SendgridBackend, SENDGRID_VERSION
if sys.version_info >= (3.0, 0.0, ):
from email.mim... | StarcoderdataPython |
1711458 | <reponame>opennode/nodeconductor-azure
from __future__ import unicode_literals
import copy
from libcloud.utils.py3 import httplib
try:
from lxml import etree as ET
except ImportError:
from xml.etree import ElementTree as ET
from libcloud.common.azure import AzureServiceManagementConnection as _AzureServiceMa... | StarcoderdataPython |
133582 | <reponame>ckamtsikis/cmssw
import FWCore.ParameterSet.Config as cms
process = cms.Process("TEST")
import FWCore.Framework.test.cmsExceptionsFatalOption_cff
process.options = cms.untracked.PSet(
Rethrow = FWCore.Framework.test.cmsExceptionsFatalOption_cff.Rethrow
)
process.maxEvents = cms.untracked.PSet(
inpu... | StarcoderdataPython |
1652755 | <reponame>mrdulin/python-codelab
from unittest.mock import patch
import unittest
import json
from member import member
class TestMember(unittest.TestCase):
@patch('member.requests.post')
def test_member_success(self, mock_post):
mock_post.return_value.status_code = 201
mock_post.return_value.j... | StarcoderdataPython |
4837471 | # 70. Climbing Stairs
class Solution:
# Recursion with Memoization
def __init__(self) -> None:
self._mem: list[int] = None
def climbStairs(self, n: int) -> int:
self._mem = [-1 for _ in range(n + 1)]
return self._climb_stairs(n)
def _climb_stairs(self, n: int) -> int:
... | StarcoderdataPython |
170473 | from trex_stl_lib.api import *
import argparse
MIN_VLAN, MAX_VLAN = 1, (1 << 12) - 1
class Dot1QFieldEngine(object):
def create_streams(self, burst_size, pps, vlans):
"""
Get Single Burst Streams with given pps and burst size.
Args:
burst_size (int): Burst size for STL Sing... | StarcoderdataPython |
188317 | <filename>rollDice.py<gh_stars>0
import random
def rollDice(inputArray):
"""Simulate rolling dice. Accepts array size of three. Returns a int value representing the total."""
diceValue = []
for x in range (0,int(inputArray[0])):
diceValue.append(random.randint(1, int(inputArray[1])))
p... | StarcoderdataPython |
164595 | <reponame>schmittner/ctypescrypto
from ctypescrypto.rand import *
import unittest
class TestRand(unittest.TestCase):
def test_bytes(self):
b=bytes(100)
self.assertEqual(len(b),100)
b2=bytes(100)
self.assertNotEqual(b,b2)
def test_pseudo_bytes(self):
b=pseudo_bytes(100)
... | StarcoderdataPython |
3309392 | # Copyright 2019 Nokia
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softwar... | StarcoderdataPython |
4815054 | <gh_stars>1-10
import random
import logging
import pprint
import copy
import game
from log_context import log_context
logger = logging.getLogger(__name__)
class ForceField(game.LambdaManAI):
def __init__(self):
self.first_call = False
def initialize(self, map, undocumented):
self.f = [[DE... | StarcoderdataPython |
3241046 | #!/usr/bin/env python
import random
import time
gen_file = raw_input("Generate file|.txt| with keys? [yes/no] > ")
if gen_file == 'yes':
name = raw_input("\nPlease name the file. > ")
# find current file path
import os
path = os.path.dirname(os.path.realpath(__file__))
def matrix():
# lists are ... | StarcoderdataPython |
1684710 | <filename>json2oraparser/DataGenerationController/DataGeneration.py
from json2oraparser import PublishToDBController
from json2oraparser import ConfigController
from json2oraparser import DBConnectionController
import os
from datetime import datetime
class DataGeneration:
def __init__(self):
self.objDBCo... | StarcoderdataPython |
3302230 |
import sys
import time as time
import numpy as np
import pandas as pd
from itertools import combinations
#from sklearn.neighbors import DistanceMetric
#from sklearn.cluster import AgglomerativeClustering
#from sklearn.decomposition import PCA
import matplotlib
from matplotlib import pyplot as plt
from scipy.cluster.... | StarcoderdataPython |
3343804 | <reponame>bchiu/Simple-CenterNet
from .resnet import *
from .dcn import *
from utils import common
import numpy as np
import math
import torch
from torch import Tensor
from typing import Type, Any, Callable, Union, List, Optional
import torch.nn as nn
import torchvision.transforms.functional as F
def fill_up_weight... | StarcoderdataPython |
44873 | import os
import numpy as np
from ._population import Population
from pychemia import pcm_log
from pychemia.utils.mathematics import spherical_to_cartesian, cartesian_to_spherical, rotate_towards_axis, \
angle_between_vectors
from pychemia.code.vasp import read_incar, read_poscar, VaspJob, VaspOutput
from pychemia.... | StarcoderdataPython |
8654 | <filename>tests/Python/test_all_configs_output.py
def binom(n, k):
"""Quickly adapted from https://stackoverflow.com/questions/26560726/python-binomial-coefficient"""
if k < 0 or k > n:
return 0
if k == 0 or k == n:
return 1
total_ways = 1
for i in range(min(k, n - k)):
total... | StarcoderdataPython |
9882 | #coding:utf-8
import numpy as np
import tensorflow as tf
import os
import time
import datetime
import ctypes
import threading
import json
ll1 = ctypes.cdll.LoadLibrary
lib_cnn = ll1("./init_cnn.so")
ll2 = ctypes.cdll.LoadLibrary
lib_kg = ll2("./init_know.so")
class Config(object):
def __init__(self):
self.in... | StarcoderdataPython |
3350293 | import sys
import numpy as np
from scipy.stats import norm
import matplotlib.pyplot as plt
from plot_normal_dist import normal_dist
import my_style
if __name__ == "__main__":
vx, vy = normal_dist(1.0, 0.0)
plt.plot(vx, vy)
vx, vy = normal_dist(0.4, 1.5)
plt.plot(vx, vy)
vx, vy = normal_dist(2.0, -... | StarcoderdataPython |
135952 | <gh_stars>0
from django.db import models
class Currency(models.Model):
id = models.IntegerField(primary_key=True) # id_moneda
acronym = models.CharField(max_length=218) # cod_mone
description = models.CharField(max_length=218) # desc_mone
active = models.BooleanField() # activo
def __str__(se... | StarcoderdataPython |
100243 | #!usr/bin/python
# -*- coding:utf8 -*-
def gen_func():
try:
yield "http://projectesdu.com"
except GeneratorExit:
pass
yield 2
yield 3
return "bobby"
if __name__ == "__main__":
gen = gen_func()
next(gen)
gen.close()
next(gen)
| StarcoderdataPython |
67601 | <filename>larch/wxmap/gse_dtcorrect.py
#!/usr/bin/env python
"""
"""
import os
import time
import shutil
import numpy as np
from random import randrange
from functools import partial
from datetime import timedelta
import wx
import wx.lib.scrolledpanel as scrolled
import wx.lib.mixins.inspection
HAS_EPICS = False
try:... | StarcoderdataPython |
1748153 | # Copyright (c) 2020-2022, NVIDIA CORPORATION & AFFILIATES. 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 ... | StarcoderdataPython |
3293393 | <reponame>Imipenem/mlf_core_website
from flask import Blueprint
bp = Blueprint('basic', __name__)
from mlf_core_website.basic import routes # noqa: E402, F401
| StarcoderdataPython |
89730 | from django.contrib import admin
from .models import IR
# Register your models here.
class IRAdmin(admin.ModelAdmin):
list_display = ('title', 'author', 'date_posted')
list_filter = ('title', 'date_posted', 'author')
admin.site.register(IR, IRAdmin)
| StarcoderdataPython |
3311941 | <filename>tests/test_cifti_vis_fmri.py<gh_stars>0
#!/usr/bin/env python
import unittest
import logging
import importlib
import random
import ciftify.qc_config
func2hcp = importlib.import_module('ciftify.bin.cifti_vis_fmri')
# Necessary to silence all logging during tests.
logging.disable(logging.CRITICAL)
class Test... | StarcoderdataPython |
3230175 | <reponame>MarcWong/PointMVSNet<gh_stars>100-1000
import numpy as np
import cv2
import math
def norm_image(img):
""" normalize image input """
img = img.astype(np.float32)
var = np.var(img, axis=(0, 1), keepdims=True)
mean = np.mean(img, axis=(0, 1), keepdims=True)
return (img - mean) / (np.sqrt(va... | StarcoderdataPython |
3230071 | <gh_stars>0
import tensorflow as tf
import glob
import os
import re
##########################
# Settings #
##########################
# Which experiment to extract
import tensorflow.python.framework.errors_impl
ex = "ex4"
# Which tag should be extracted
#'eval/Reward (SMA)' 'eval/Entropy'
tags = ['eva... | StarcoderdataPython |
76980 | import os
import shutil
import tempfile
import lbryum.wallet
from decimal import Decimal
from collections import defaultdict
from twisted.trial import unittest
from twisted.internet import threads, defer
from lbrynet.core.Error import InsufficientFundsError
from lbrynet.core.Wallet import Wallet, LBRYumWallet, Reserv... | StarcoderdataPython |
3392753 | # stdlib
import sys
sys.path.append("../")
# third party
from src import __version__
def test_version():
assert __version__ == "0.5.0"
| StarcoderdataPython |
1631730 | <filename>aries_cloudagent/resolver/__init__.py
"""Interfaces and base classes for DID Resolution."""
import logging
from ..config.injection_context import InjectionContext
from ..config.provider import ClassProvider
from .did_resolver_registry import DIDResolverRegistry
LOGGER = logging.getLogger(__name__)
async... | StarcoderdataPython |
82081 | import uuid
import cv2
OUTPUT_IMAGE_FOLDER = "./output/"
OUTPUT_FILE_TYPE = ".jpg"
def save_image_with_internal_name(img):
internal_name = str(uuid.uuid1()) + OUTPUT_FILE_TYPE
cv2.imwrite(OUTPUT_IMAGE_FOLDER + internal_name, img)
return internal_name
| StarcoderdataPython |
1659978 | # Generated by Django 2.2.7 on 2020-04-15 21:04
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('creel_portal', '0003_auto_20200409_1730'),
]
operations = [
migrations.AlterField(
model_name='fn111',
name='comment... | StarcoderdataPython |
175000 | <filename>src/shut/renderers/core.py
# -*- coding: utf8 -*-
# Copyright (c) 2021 <NAME>
#
# 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... | StarcoderdataPython |
1644443 | """Syntax: .whatscrapp as reply to a message copied from @WhatsCRApp"""
from darkbot.utils import *
from userbot.cmdhelp import *
# when you are tight on schedule...
# and also lazy af!!
@bot.on(admin_cmd(pattern="whatscrapp"))
@bot.on(sudo_cmd(pattern="whatscrapp", allow_sudo=True))
async def _(event):
if event.f... | StarcoderdataPython |
3340883 | import argparse
import collections
import fnmatch
import json
import chainer
import chainer.functions as F
import chainer.links as L
import numpy as np
import chainer_trt
generators = list()
# Use this type to describe acceptable error for each test case
error = collections.namedtuple('error', ['fp32', 'fp16', 'in... | StarcoderdataPython |
3338692 | <filename>skytap/models/Group.py
"""Support for Skytap groups."""
import json
from skytap.framework.ApiClient import ApiClient
import skytap.framework.Utils as Utils
from skytap.models.SkytapResource import SkytapResource
from skytap.Users import Users
class Group(SkytapResource):
"""One Skytap Group."""
de... | StarcoderdataPython |
143495 | #! /usr/bin/env python
#
# example1_tk.py -- Simple, configurable FITS viewer.
#
# <NAME> (<EMAIL>)
#
# Copyright (c) <NAME>. All rights reserved.
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
#
import sys, os
import logging
import Tkinter
from tkFileDialog... | StarcoderdataPython |
1778489 | # Copyright (c) 2021 <NAME>
#
# 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, distribute,... | StarcoderdataPython |
1611376 | <reponame>Valker-Vinicius/Number-checker
from facilitators import colors
def readint(userInput):
while True:
try:
value = int(input(userInput).strip())
except (ValueError, TypeError):
print(f'{colors.red()}ERRO! São permitidos apenas números inteiros, tente novamente')
... | StarcoderdataPython |
3391275 | from __future__ import annotations
import pytest
from steam.ext.commands.utils import MissingClosingQuotation, Shlex
test_strings = [
("foo bar baz", ["foo", "bar", "baz"]),
('foo "bar baz"', ["foo", "bar baz"]),
('foo \\"bar baz', ["foo", '"bar', "baz"]),
('foo bar baz\\"', ["foo", "bar", 'baz"']),
... | StarcoderdataPython |
16727 | <filename>libensemble/tests/regression_tests/test_6-hump_camel_elapsed_time_abort.py<gh_stars>0
# """
# Runs libEnsemble on the 6-hump camel problem. Documented here:
# https://www.sfu.ca/~ssurjano/camel6.html
#
# Execute via the following command:
# mpiexec -np 4 python3 test_6-hump_camel_elapsed_time_abort.py
#... | StarcoderdataPython |
3373817 | <gh_stars>10-100
import logging
import peewee
from typing import Type, Tuple, List, Iterable, Union
from slim.support.peewee.sqlfuncs import PeeweeSQLFunctions
from slim.support.peewee.validate import get_pv_model_info
from ...base.sqlquery import SQLForeignKey
from ...base.permission import DataRecord, Permissions
f... | StarcoderdataPython |
1763719 | # Single Color RGB565 Blob Tracking Example
#
# This example shows off single color RGB565 tracking using the OpenMV Cam.
import sensor, image, time, math
threshold_index = 0 # 0 for red, 1 for green, 2 for blue
# Color Tracking Thresholds (L Min, L Max, A Min, A Max, B Min, B Max)
# The below thresholds track in ge... | StarcoderdataPython |
31921 | <gh_stars>0
# Copyright or Copr. Centre National de la Recherche Scientifique (CNRS) (2017/11/27)
# Contributors:
# - <NAME> <<EMAIL>>
# This software is a computer program whose purpose is to provide small tools and scripts related to phylogeny and bayesian
# inference.
# This software is governed by the CeCILL-B li... | StarcoderdataPython |
63006 | from pyopenproject.api_connection.exceptions.request_exception import RequestError
from pyopenproject.api_connection.requests.post_request import PostRequest
from pyopenproject.business.exception.business_error import BusinessError
from pyopenproject.business.services.command.time_entry.time_entry_command import TimeEn... | StarcoderdataPython |
3200154 | c = 1
c_m = 0
c_f = 0
mayor = 0
menor = 0
while c <= 5:
Nombre = input("nombre: ")
Apellido =input("Apellido: ")
Sexo = input("Sexo: ")
Edad = int(input("Ingresa Edad: "))
if Sexo == "M":
c_m=c_m + 1
else:
c_f=c_f + 1
if Edad >=18:
mayor=mayor + 1
else:
... | StarcoderdataPython |
42105 | from datetime import datetime
from django.shortcuts import render
from django.http import Http404
from .models import ProgramSchedule
from utils.datedeux import DateDeux
# Create your views here.
def display_single_schedule(request, schedule_id):
try:
schedule = ProgramSchedule.objects.get(id=int(schedu... | StarcoderdataPython |
3246278 |
class GeneratedLogicalId(object):
"""
Class to generate LogicalIDs for various scenarios. SAM generates LogicalIds for new resources based on code
that is spread across the translator codebase. It becomes to difficult to audit them and to standardize
the process. This class will generate LogicalIds fo... | StarcoderdataPython |
3348632 | <gh_stars>1-10
while True:
try:
e = str(input()).strip()
except EOFError: break
p = []
for i in e:
if i == '(': p.append('(')
elif i == ')':
if len(p) > 0: p.pop()
else:
p.append(')')
break
print('correct' if len(p) == 0... | StarcoderdataPython |
4821621 | # ---
# jupyter:
# jupytext:
# formats: py:percent,ipynb
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.4.2
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# %% [markdown]
# # 1... | StarcoderdataPython |
85289 | <filename>ooobuild/cssdyn/drawing/framework/__init__.py
# coding: utf-8
#
# Copyright 2022 :Barry-Thomas-Paul: Moss
#
# 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.... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.