id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
4997855 | <filename>tools/SDKTool/main.py
# -*- coding: utf-8 -*-
"""
This source code file is licensed under the GNU General Public License Version 3.
For full details, please refer to the file "LICENSE.txt" which is provided as part of this source code package.
Copyright (C) 2020 THL A29 Limited, a Tencent company. All rights... | StarcoderdataPython |
1887224 | # This file is part of ranger, the console file manager.
# License: GNU GPL version 3, see the file "AUTHORS" for details.
# THIS WHOLE FILE IS OBSOLETE AND EXISTS FOR BACKWARDS COMPATIBILITIY
import re
from re import compile as regexp
from ranger.api import *
from ranger.gui import color
| StarcoderdataPython |
5112650 | """
Wrappers for python 2 & 3 compatibility
"""
import struct
import six
if six.PY2:
import Queue as queue
else:
import queue
def pack(fmt, *args):
if six.PY2:
# print(struct.pack(fmt, *args))
return struct.pack(fmt, *args)
else:
return struct.pack(fmt, *args)
def unpack(fm... | StarcoderdataPython |
3238446 | from django.shortcuts import render
from django.http import HttpResponse
from pyrebase import pyrebase
from django.contrib import auth
# Create your views here.
config = {
'apiKey': "<KEY>",
'authDomain': "where-s-the-beef.firebaseapp.com",
'databaseURL': "https://where-s-the-beef.firebaseio.com",
'project... | StarcoderdataPython |
8113196 | <filename>dagger/graph/task_graph.py
import logging
import sys
from abc import ABC
import dagger.pipeline.pipeline
from dagger.pipeline.io import IO
from dagger.pipeline.task import Task
from dagger.utilities.exceptions import IdAlreadyExistsException
from dagger.conf import config
_logger = logging.getLogger("graph"... | StarcoderdataPython |
6436688 | from OpenGLCffi.GL import params
@params(api='gl', prms=['target', 'format', 'len', 'string'])
def glProgramStringARB(target, format, len, string):
pass
@params(api='gl', prms=['target', 'program'])
def glBindProgramARB(target, program):
pass
@params(api='gl', prms=['n', 'programs'])
def glDeleteProgramsARB(n, pr... | StarcoderdataPython |
3239662 | """Day 4 challenge for Advent of Code 2019 - https://adventofcode.com/2019/day/4"""
from unittest import TestCase
PASSWORD_RANGE = (272091, 815432)
class ChallengeTests(TestCase):
"""Tests for day 4."""
def test_part1(self):
"""Test part one example values."""
self.assertTrue(_valid_passw... | StarcoderdataPython |
1623733 | import logging
from .. import conf
from .default import service_info_v01
LOG = logging.getLogger(__name__)
# noinspection PyDictCreation
def ga4gh_service_info_v10(row):
group = None
artifact = None
version = None
url = None
if row is None:
# Data for this registry
row = servic... | StarcoderdataPython |
3391450 | <gh_stars>0
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
data = pd.read_csv('/home/atrides/Desktop/R/statistics_with_Python/04_Exploring_Data_with_Graphs/Data_Files/Hiccups.dat', sep='\s+')
print(data.head())
print(data.describe())
data['id'] = data.index
df = pd.melt(data, id_vars='i... | StarcoderdataPython |
1869927 | <reponame>corenel/algorithm-exercises
"""
Graph
https://algorithm.yuanbin.me/zh-hans/basics_data_structure/graph.htmlk;w
"""
| StarcoderdataPython |
6516052 | import dj_database_url
from .base import * # noqa
from .base import get_env_var, DATABASES
SECRET_KEY = get_env_var('DJANGO_SECRET_KEY')
DATABASES['default'] = dj_database_url.config()
ALLOWED_HOSTS = ['djangogirlstaipei.herokuapp.com']
SESSION_ENGINE = 'django.contrib.sessions.backends.signed_cookies'
STATIC... | StarcoderdataPython |
1998863 | import compas_ags
from compas_ags.diagrams import FormGraph
from compas_ags.diagrams import FormDiagram
from compas_ags.diagrams import ForceDiagram
from compas_ags.viewers import Viewer
from compas_ags.ags import form_update_from_force
from compas_ags.ags import form_update_q_from_qind
from compas_ags.ags import force... | StarcoderdataPython |
1752247 | <reponame>PeterSulcs/mlflow
import logging
import sys
import pytest
import mlflow
import mlflow.utils.logging_utils as logging_utils
from mlflow.utils.logging_utils import eprint
logger = logging.getLogger(mlflow.__name__)
LOGGING_FNS_TO_TEST = [logger.info, logger.warning, logger.critical, eprint]
@pytest.fixture... | StarcoderdataPython |
1967016 | import unittest
import os
import sys
from io import StringIO
import logging
from container_workflow_tool.main import ImageRebuilder
def create_logger(out_file, level, c_name=None):
# Unique name for a given combination, allow overriding
name = c_name if c_name else "test-"+str(level)+str(out_file.name)
l... | StarcoderdataPython |
5115491 | <gh_stars>0
from flask import Flask, render_template, request, url_for, redirect, session
import random
import boto3
# Flask Initialization
# global variable must be named "application" as per EB requirement
application = Flask(__name__)
application.debug = True
random_number = 0
@application.route("/")
def index()... | StarcoderdataPython |
56280 | class ModbusException(Exception):
def __init__(self, code):
codes = {
'1': 'Illegal Function',
'2': 'Illegal Data Address',
'3': 'Illegal Data Value',
'4': 'Slave Device Failure',
'5': 'Acknowledge',
'6': 'Slave Device Busy',
... | StarcoderdataPython |
11309669 | # Imports a text file where each line contains
# the space-separated integer coordinates x y z
# (on the voxel grid, not the scene space) of a voxel,
# and adds them as cubes to the current scene
filename = bpy.path.abspath("//..\\voxels.dat")
center_voxel_scene = True
automatic_scale = True
points_only = False ... | StarcoderdataPython |
6426517 | <gh_stars>1-10
import tkinter_dndr
import tkinter
window = tkinter.Tk()
button = tkinter.Button(text="Test Widget")
button.place(x=10, y=10, width=50, height=60)
dndr_button = tkinter_dndr.DragDropResizeWidget(button)
dndr_button.make_draggable() # if you want the widget to only have drag and drop suppor... | StarcoderdataPython |
11240762 | <filename>docs/support/test_my_module.py
# test_my_module.py
# Copyright (c) 2013-2019 <NAME>
# See LICENSE for details
# pylint: disable=C0111,C0410,C0411,R0903,W0104,W0105
import pmisc, pytest, docs.support.my_module
def test_func():
"""Test func() function."""
pmisc.assert_exception(
docs.support.... | StarcoderdataPython |
12857961 | from tkinter import *
import random
from tkinter import messagebox
class GuessGame:
def protocolhandler(self):
if messagebox.askyesno("Exit", "Really Wanna stop Guessing?"):
if messagebox.askyesno("Exit", "Are you sure?"):
self.root.destroy()
def result(self):
... | StarcoderdataPython |
12824058 | <gh_stars>0
from __future__ import annotations
from typing import List, Tuple, Callable
from ehelply_python_sdk.services.access.sdk import AuthModel
import asyncio
class AuthException(Exception):
pass
class AuthRule:
"""
Provides a nice interface into developing authorization rules for endpoints
"""... | StarcoderdataPython |
6703630 | <gh_stars>0
__all__ = ["Samsung"] | StarcoderdataPython |
1917978 | #!/usr/bin/env python3
import sql_credentials
import argparse
import experiment_database_manager
from experiment_database_tools import download_experiment_to_file
parser = argparse.ArgumentParser(
'Deletes an experiment from the database')
parser.add_argument('experiment_name',
help='Experimen... | StarcoderdataPython |
293066 | import time
from ctypes import *
import numpy as np
import scipy.stats as sps
from matplotlib import pyplot as pypl
# =========================测试数据设置=========================
# 正态分布均值
MU = 0
# 正态分布标准差
SIGMA = 1
# 正态分布随机数生成数量
TOTAL_COUNT = 10000
# 分桶计数时每个桶计数区间的大小
BUCKET_SIZE = 2
# 分桶数量
BUCKET_COUNT = 50
# 耗时测试中生成随机数的... | StarcoderdataPython |
1939282 | <filename>lib/dataset/get_dataset.py<gh_stars>10-100
import init_path
import os
import os.path as osp
from lib.dataset import voc12_sgan
def get_dataset(dataset_name, args):
if dataset_name == "voc12_sgan":
train_dataset = voc12_sgan.VOC12ClsSalDataset(voc12_root=args.dataset_root,
... | StarcoderdataPython |
1738663 | import pandas as pd
import re
#SOCCOM = ["infoadd, 'subject'; 'body'; 'msgcat'; 'concern(optional)'; 'code (optional)'; 'tag (optional)'",
#"handover, No# 'subject'; 'body';'msgcat'; 'concern(optional)'; 'code (optional)'; 'tag (optional)",
#"query, 'text/code/category', date(optional)"]
#def insert_msg(dt, src, sub... | StarcoderdataPython |
9668633 | <filename>op_product_report/report_data_collect.py
import collections
import bpy
from .. import dynamic_lists
from ..lib import unit, mesh
from ..lib.compat import gem_id_compat
def data_collect():
scene = bpy.context.scene
props = scene.jewelcraft
data = {}
# Size
# ---------------------------
if props.pr... | StarcoderdataPython |
6532227 | <reponame>kjmin622/ERICA_Game_DevilInvade<filename>src/Play.py<gh_stars>1-10
#!/usr/bin/env python3
import GUI_main
import GUI_game
import GUI_save
import GUI_help
action = GUI_main.main(True)
done = False
while action != 0 :
if action == 1 :
done = GUI_game.play_game()
if action == 2 :
... | StarcoderdataPython |
1718193 | <gh_stars>0
from app import app, db
from flask import flash, redirect, url_for, request, session
from app.forms import editItemForm
from app.models.item import Item
from app.models.user import User
@app.route('/edititem/', methods=['POST'])
def editItem():
"""Handles Edit Item form submissions and updates the ite... | StarcoderdataPython |
8001182 | <filename>test.py
#!/usr/bin/env python
from __future__ import unicode_literals
from __future__ import print_function
import codecs
import glob
import json
import doctest
import unittest
import six
import frontmatter
class FrontmatterTest(unittest.TestCase):
"""
Tests for parsing various kinds of content an... | StarcoderdataPython |
1973079 | """
@author <NAME>
@file InMemoryZip.py
@brief inspired by http://www.kompato.com/post/43805938842/in-memory-zip-in-python
providing an in memory zip with some more features
@note tested with Python 2.7.5 and with Python 3.3
Copyright (c) 2013 <NAME>
Permission is hereby granted... | StarcoderdataPython |
9743084 | <gh_stars>0
countries = [
"Afghanistan",
"Albania",
"Algeria",
"Andorra",
"Angola",
"Antigua and Barbuda",
"Argentina",
"Armenia",
"Aruba",
"Australia",
"Austria",
"Azerbaijan",
"Bahamas, The",
"Bahrain",
"Bangladesh",
"Barbados",
"Belarus",
"Belgium",
"Belize",
"Benin",
"Bhutan",
"Bolivia",
"Bosnia and Herzegovina",
"... | StarcoderdataPython |
8149590 | """Barrier Application.
This script will serve serve HTTP requests and accepts any command line arguments and options that Flask applications
will accept.
"""
import logging
import os
import pathlib
from flask import Flask, redirect, send_from_directory, url_for
from flask_oidc import OpenIDConnect
from oauth2client... | StarcoderdataPython |
1763541 | from django.shortcuts import render
# Create your views here.
def register(request):
pass
| StarcoderdataPython |
6695783 | <gh_stars>10-100
from WMCore.WMException import WMException
class WMSpecFactoryException(WMException):
"""
_WMSpecFactoryException_
This exception will be raised by validation functions if
the code fails validation. It will then be changed into
a proper HTTPError in the ReqMgr, with the message y... | StarcoderdataPython |
1697891 | <filename>bot/__init__.py
import sys
import telebot
from loguru import logger
from config.config import token
# from model.postgres import DataBase # for postgres
from model.sqlite import DataBase # for sqlite
bot = telebot.TeleBot(token)
# db = DataBase() # for posgres
db = DataBase("sqlite.db") # for sqlite
# l... | StarcoderdataPython |
12855549 | import gevent.monkey
gevent.monkey.patch_all()
import os
from logging import getLogger
#from apscheduler.executors.pool import ThreadPoolExecutor, ProcessPoolExecutor
from apscheduler.schedulers.gevent import GeventScheduler as Scheduler
from couchdb import Server, Session
from couchdb.http import Unauthorized, extract... | StarcoderdataPython |
5034860 | <reponame>nextfit/tortoise-orm
from .base import CommentModel, NoID
from .constraints import UniqueName, UniqueTogetherFields, UniqueTogetherFieldsWithFK
from .datafields import (
BigIntFields,
BinaryFields,
BooleanFields,
CharFields,
Currency,
DateFields,
DatetimeFields,
DecimalFields... | StarcoderdataPython |
1837674 | <gh_stars>0
class captcha():
def capt(in_string):
res = 0
for index, obj in enumerate(in_string):
if index < len(in_string) - 1:
next_ = in_string[index + 1]
else:
next_ = in_string[0]
if obj == next_:
res += int(obj... | StarcoderdataPython |
8048711 | <reponame>ohbobbyboy/bobby_boy<filename>ofd.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
import datetime
import json
import os
import re
import sys
import requests
from bs4 import BeautifulSoup
import config
class OFDProvider:
# заводской номер фискального накопителя
# fiscalDriveId
# fn
# ФН
fi... | StarcoderdataPython |
6584055 | from preprocess.load_data.data_loader import load_hotel_reserve
import pandas as pd
def main():
customer_tb, hotel_tb, reserve_tb = load_hotel_reserve()
reserve_tb.info()
print(reserve_tb)
# reserve_datetimeを日時型に変換する
reserve_tb['reserve_datetime'] = pd.to_datetime(reserve_tb['reserve_datetime'])
... | StarcoderdataPython |
3358003 | <reponame>felipefr/netfibGen<gh_stars>1-10
import numpy as np
import os, sys
#~ sys.path.append('/home/felipe/Dropbox/simuls17/fibresGen')
#~ import matrixAndFibresGeneration as mfg
#~ import newTheoryFibresLib as ntf
#from matrixAndFibresGeneration import *
#from newTheoryFibresLib import *
import copy
from fibresL... | StarcoderdataPython |
11369824 | # -*- coding: utf-8 -*-
# @Time : 2021/3/17 12:59
# @Author : sunxuan
# @Site :
# @File : test_version.py
import os
import sys
def test_vesion():
from interface_test import __version__
assert isinstance(__version__,str) | StarcoderdataPython |
347448 | <gh_stars>0
# -*- coding: utf-8 -*-
from returns.context import Context
def test_context_ask():
"""Ensures that ``ask`` method works correctly."""
assert Context[int].ask()(1) == 1
assert Context[str].ask()('a') == 'a'
def test_context_unit():
"""Ensures that ``unit`` method works correctly."""
... | StarcoderdataPython |
5030830 | <gh_stars>0
class RoutingPreferenceRule(object, IDisposable):
"""
A class representing a rule set in MEP routing preferences.
RoutingPreferenceRule(MEPPartId: ElementId,description: str)
"""
def AddCriterion(self, myCriterion):
"""
AddCriterion(self: RoutingPreferenceRule,myCriterio... | StarcoderdataPython |
11273108 | import sys
from nltk.tag import pos_tag
from nltk.tokenize import word_tokenize
from train import NamedEntityRecognizer
def main(argv):
if len(argv)!=1:
print("Usage: python3 ner.py input-sentence")
exit()
# READ USER INPUT SENTENCE
sent = argv[0]
# TOKENIZE INPUT SENTENCE
... | StarcoderdataPython |
9644006 | <filename>benchmarks/python3-flask/hello.py
from flask import Flask
app = Flask(__name__)
import logging
log = logging.getLogger('werkzeug')
log.setLevel(logging.ERROR)
@app.route("/hello")
def hello():
return "Hello from /hello" | StarcoderdataPython |
5063257 | <reponame>yhcting/pycui
import ut
from cmdbase import BaseCmd
class CmdHelp(BaseCmd):
def __init__(self, cmds=None):
self.cmds = cmds
self.text = None
def cmd(self):
return 'help', 'h'
def help(self):
return 'Show help text'
def run(self, argv, **kwargs):
cmd... | StarcoderdataPython |
6634102 | <filename>insights.py<gh_stars>0
import sys
import reviews
if __name__ == '__main__':
if len(sys.argv) > 1:
tgt_asin = sys.argv[1]
else:
tgt_asin = review.random_asin()
print("Product ASIN: {}".format(tgt_asin))
neg_reason = reviews.negative_reason(tgt_asin)
reason = neg_reason[... | StarcoderdataPython |
9739026 | __author__ = "JJ.sven"
import pika
''' 客户端连接的时候需要配置认证参数
credentials = pika.PlainCredentials('alex', 'alex3714')
connection = pika.BlockingConnection(pika.ConnectionParameters(
'10.211.55.5',5672,'/',credentials))
channel = connection.channel()
'''
connection = pika.BlockingConnection(pika.ConnectionParameters(... | StarcoderdataPython |
1799881 | # -*- coding: utf-8 -*-
from pysignfe.xml_sped import *
from pysignfe.nfe.manual_500 import ESQUEMA_ATUAL
from .evento_base import DetEvento, InfEventoEnviado, Evento, EnvEvento, InfEventoRecebido, RetEvento, RetEnvEvento, ProcEventoNFe
import os
DIRNAME = os.path.dirname(__file__)
CONDICAO_USO = u'A Carta de Corre... | StarcoderdataPython |
12812586 | """Classes to demonstrate how to write unit tests for TensorFlow code.
"""
# Copyright 2020 Google Inc. 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.... | StarcoderdataPython |
4924615 | import mxnet.gluon.data.vision.transforms as transforms
from mxnet import init
from mxnet.gluon import nn, data
from mxnet.gluon.model_zoo import vision
from train import *
if __name__ == "__main__":
# parser
parser = argparse.ArgumentParser()
parser.add_argument("--use_mask_contour", dest='mask', action='... | StarcoderdataPython |
1838170 | <filename>sdk/metricsadvisor/azure-ai-metricsadvisor/samples/sample_credential_entities.py
# coding: utf-8
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# ... | StarcoderdataPython |
12831087 | <gh_stars>0
############this module is for feature engineering##############
############ make sure you have new_data folder create under your working folder#####
###### usage: main(t_type,name)
import pandas as pd
teamname = 'emotional-support-vector-machine-unsw'
data_folder='s3://tf-trachack-data/212/'
root_folder=... | StarcoderdataPython |
1789372 | <gh_stars>1000+
from getpass import getpass
name = input("What's your name?\n")
pw = getpass("<PASSWORD>")
print(name, pw)
| StarcoderdataPython |
6598727 | <reponame>uw-it-cte/uw-restclients
from restclients.canvas import Canvas
class Conversations(Canvas):
def get_conversation_ids_for_sis_login_id(self, sis_login_id):
url = "/api/v1/conversations"
params = {
"as_user_id": self.sis_login_id(sis_login_id),
"include_all_conversa... | StarcoderdataPython |
6481560 | import os,rootpath
rootpath.append(pattern='main.py') # add the directory of main.py to PATH
from kivy.app import App
from kivy.lang import Builder
from kivy.properties import DictProperty,StringProperty,ListProperty
from kivy.uix.boxlayout import BoxLayout
from kivy.core.window import Window
from kivy.logger import L... | StarcoderdataPython |
3460081 | # Copyright 2020 <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, subl... | StarcoderdataPython |
6443586 | from django.test import Client
from django.test import TestCase
from backend.models import ShortHand
class TestCreate(TestCase):
def setUp(self):
self.client = Client()
def test_creating_shorthand_from_url(self):
self.assertFalse(ShortHand.objects.filter(url='http://bar.com', label='foo').ex... | StarcoderdataPython |
3395707 | # -*- coding: utf-8 -*-
#
# tests.models.programdb.validation.conftest.py is part of The RAMSTK Project
#
# All rights reserved.
# Copyright since 2007 Doyle "weibullguy" Rowland doyle.rowland <AT> reliaqual <DOT> com
"""The RAMSTK Validation module test fixtures."""
# Standard Library Imports
from datetime impo... | StarcoderdataPython |
11233193 | import pathlib
import time
import scipy.misc
from mxnet import nd
import mxnet as mx
import h5py
import numpy as np
from mxnet import gluon
class DeepLatentGaussianModel(gluon.HybridBlock):
def __init__(self):
super().__init__()
with self.name_scope():
self.log_prior = GaussianLogProb()
# genera... | StarcoderdataPython |
6575384 |
'''
Split the HI data from AT0206 into individual channels.
'''
from casa_tools import ms_split_by_channel
vis = "/global/scratch/ekoch/combined/M33_b_c_LSRK.ms"
output_dir = "/global/scratch/ekoch/combined/AT0206_channel_ms/"
start_chan = 11
nchan = 205
ms_split_by_channel(vis, nchan=nchan, start=start_chan,
... | StarcoderdataPython |
3478272 | <reponame>cednore/InvenTree
"""
Django settings for InvenTree project.
In practice the settings in this file should not be adjusted,
instead settings can be configured in the config.yaml file
located in the top level project directory.
This allows implementation configuration to be hidden from source control,
as well... | StarcoderdataPython |
1744753 | from distutils.version import LooseVersion
import click
from demisto_sdk.commands.common.constants import \
LAYOUT_AND_MAPPER_BUILT_IN_FIELDS
from demisto_sdk.commands.common.errors import Errors
from demisto_sdk.commands.common.hook_validations.content_entity_validator import \
ContentEntityValidator
from dem... | StarcoderdataPython |
9721230 | <gh_stars>0
import uuid
from datetime import datetime
from django.utils import timezone
from django.utils.timezone import utc
def get_uuid(limit=32):
return str(uuid.uuid4())[:limit]
def now():
return timezone.now()
| StarcoderdataPython |
3235169 | # ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distrib... | StarcoderdataPython |
11335299 | """
File: day-8.py
--------------
For Level 1, use the website. For Level 2, use the file puzzles/day-...
"""
import os
from utils import *
DAY = 8
YEAR = 2021
data = get_input(write=True, day=DAY, year=YEAR)
# --- Part 1 ---
lines = data.split('\n')
ans_1 = 0
for line in lines:
i, o = line.split(' | ')
o = o... | StarcoderdataPython |
8045356 | <filename>2018/day11/day11.py<gh_stars>0
import time
import numpy as np
start_time = time.time()
def getPowerLevel(x, y, serial):
return ((((x+10)*y + serial)*(x+10))//100)%10 - 5
assert getPowerLevel(122,79,57) == -5
assert getPowerLevel(217,196,39) == 0
assert getPowerLevel(101,153,71) == 4
GRID_SIZE = 300
d... | StarcoderdataPython |
8182924 | <filename>src/cities/city.py<gh_stars>1-10
import pandas as pd
import geopandas as gpd
from ..utils import RAW_DATA_DIR, CLEAN_DATA_DIR
from pathlib import Path
import logging
from pathlib import Path
from ..features import geo as Geo, call_types as Calls, time as Time
from urllib.request import urlretrieve
import nump... | StarcoderdataPython |
12800476 | import torch
import numpy as np
from utils.utils import model_device
from callback.progressbar import ProgressBar
from sklearn.metrics import f1_score
class Predictor(object):
def __init__(self,
model,
logger,
n_gpu
):
self.model = model
... | StarcoderdataPython |
13212 | from selenium import webdriver
navegador = webdriver.Chrome()
navegador.get("https://webstatic-sea.mihoyo.com/ys/event/signin-sea/index.html?act_id=e202102251931481&lang=pt-pt") | StarcoderdataPython |
8077755 | <reponame>aazzolini/fairscale
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
#
# This source code is licensed under the BSD license found in the
# LICENSE file in the root directory of this source tree.
""" Shared functions related to testing GPU memory sizes. """
import gc
from typing import... | StarcoderdataPython |
3467624 | import hashlib
import json
import logging
from copy import deepcopy
from typing import Any, Callable, Coroutine, Dict
from pydantic import BaseModel
from ..projects import Project
from ..projects_nodes import NodeID
from ..projects_nodes_io import PortLink
logger = logging.getLogger(__name__)
def project_node_io_p... | StarcoderdataPython |
321866 | <filename>urlman/web/lifetime.py
from asyncio import current_task
from typing import Awaitable, Callable
from fastapi import FastAPI
from sqlalchemy.ext.asyncio import (
AsyncSession,
async_scoped_session,
create_async_engine,
)
from sqlalchemy.orm import sessionmaker
from urlman.settings import settings
... | StarcoderdataPython |
1833314 | #from lru import LinkedList, LLNode
from llist import dllist
class EvictsAndAdds(object):
pass
class Wrapper:
def __init__(self, value):
self.value = value
class Arc(EvictsAndAdds):
def __init__(self, **kwargs):
self.PLEASE_SET_k = -1
self.T1 = dllist()
self.T2 = dllist(... | StarcoderdataPython |
3433632 | #!/usr/bin/python
import imaplib
import email
import datetime
def process_mailbox(M):
rv, data = M.search(None, "UNSEEN")
if rv != 'OK':
print "No messages found!"
return
for num in data[0].split():
# rv, data = M.fetch(num, '(RFC822)') # mark us read
rv, data = M.fetc... | StarcoderdataPython |
5166160 | from django.contrib import admin
from .models import Radiological_Data
# Register your models here.
admin.site.register(Radiological_Data) | StarcoderdataPython |
11324032 | from PyFlow.Core.Common import *
from PyFlow.Core.NodeBase import NodePinsSuggestionsHelper
from common import get_property_value, get_enum_values, CameraNode
class ColorCameraNode(CameraNode):
def __init__(self, name):
import depthai
super(ColorCameraNode, self).__init__(name)
self.previe... | StarcoderdataPython |
1600644 |
# Copyright (c) 2015 Microsoft Corporation
"""
>>> from z3 import *
>>> x, y, z = Bools('x y z')
>>> And(x, And(y, z))
And(x, And(y, z))
>>> And(And(x, y), z)
And(And(x, y), z)
>>> Or(x, Or(y, z))
Or(x, Or(y, z))
>>> Or(Or(x, y), z)
Or(Or(x, y), z)
>>> And(Or(x, y), z)
And(Or(x, y), z)
>>> Or(And(x, y), z)
Or(And(x, y... | StarcoderdataPython |
1803047 | # -*- coding: utf-8 -*-
"""
Tests for the html module functions.
"""
from __future__ import unicode_literals
from backports import html
import unittest
class HtmlTests(unittest.TestCase):
def test_escape(self):
self.assertEqual(
html.escape('\'<script>"&foo;"</script>\''),
''&... | StarcoderdataPython |
11310595 | # Generated by Django 2.2.3 on 2019-08-05 05:08
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
("marketing", "0009_auto_2... | StarcoderdataPython |
9699840 | <reponame>bpabel/pysideuic
from setuptools import setup
import pysideuic
setup(
name='pysideuic',
version=pysideuic.__version__,
license='MIT',
author='<NAME>',
packages=['pysideuic'],
) | StarcoderdataPython |
73870 | <reponame>juddc/MediaFS
import sys
import os
from setuptools import setup
long_description = ("MediaFS is a Python API that makes it easy to search a "
"directory tree. It has support for custom metadata as well as caching "
"for faster searching. The primary design goal for MediaFS is to be a "
"... | StarcoderdataPython |
113990 | import busio
import digitalio
import board
import adafruit_mcp3xxx.mcp3008 as MCP
from adafruit_mcp3xxx.analog_in import AnalogIn
class ADC:
# Its the same spi bus, cs object and mcp object for all ADC instances.
# The difference between instances is the channel attribute
# create the spi bus
_spi ... | StarcoderdataPython |
11223669 | #!/usr/bin/env python
import rospy
import tf
from flexbe_core import EventState
from flexbe_core.proxy import ProxyServiceCaller
from std_msgs.msg import Bool
from robotis_controller_msgs.msg import StatusMsg
from math import pi, radians
from enum import IntEnum
from hand_eye import eye2base, eye2baseRequest
'''
Cr... | StarcoderdataPython |
1810724 | <reponame>fscottfoti/activitysim
# ActivitySim
# See full license in LICENSE.txt.
from builtins import next
from builtins import range
import multiprocessing # for process name
import os
import logging
import logging.config
import sys
import time
import yaml
import numpy as np
import pandas as pd
from activitysim.... | StarcoderdataPython |
5122441 | <reponame>oleiade/etcaetera<filename>tests/test_formatters.py
import pytest
from etcaetera.formatters import (
uppercased,
lowercased,
environ
)
def test_uppercased_with_lowercased_str():
assert uppercased("abc") == "ABC"
def test_uppercased_with_uppercased_str():
assert uppercased("ABC") == "A... | StarcoderdataPython |
386733 | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
__... | StarcoderdataPython |
5100099 | from django.contrib import admin
from .models import Categoria, Despesa, Lancamento, Parcela, Receita
@admin.register(Categoria)
class CategoriaAdmin(admin.ModelAdmin):
list_display = ("titulo", "slug", "atualizado_em")
prepopulated_fields = {"slug": ("titulo",)}
date_hierarchy = "atualizado_em"
admin.... | StarcoderdataPython |
3501041 | import unittest
from unittest import mock
from easybill_rest import Client
from easybill_rest.resources.resource_customer_groups import ResourceCustomerGroups
from easybill_rest.tests.test_case_abstract import EasybillRestTestCaseAbstract
class TestResourceCustomerGroups(
unittest.TestCase,
EasybillR... | StarcoderdataPython |
4972547 | <gh_stars>0
"""
Internal use only
Grab data from wikipedia and write records to file
"""
import re
import urllib.request
class SignParser:
SPECIALS = {
# country code found: country code real
'Alderney': 'GGY', # https://www.iso.org/obp/ui/#iso:code:3166:GG
'Malteserorden': 'MLT', # is M... | StarcoderdataPython |
11236964 | <reponame>srozb/warsaw_garbage_collection_schedule
#!/usr/bin/env python3
import fire
import requests
from schedule import Schedule
from mqtt import Client
from config import config
def once(dry_run: bool = False):
"""Do the one-time schedule check and print it out (dry-run) or send to mqtt according to configu... | StarcoderdataPython |
8165585 | <reponame>ChristianD37/Natural-Selection<filename>Assets/interactables/decorator.py
import pygame
import random, os
from player import Player
# Create base decorator class
class Decorator(pygame.sprite.Sprite):
def __init__(self, game):
pygame.sprite.Sprite.__init__(self)
self.dir = os.path.j... | StarcoderdataPython |
9624483 | from nilearn import surface
import argparse
from braincoder.decoders import GaussianReceptiveFieldModel
from braincoder.utils import get_rsq
from bids import BIDSLayout
import pandas as pd
import os
import os.path as op
import numpy as np
import nibabel as nb
from nipype.interfaces.freesurfer.utils import SurfaceTransf... | StarcoderdataPython |
11209680 | #
# Script for generating population files for
# running contributions tests
#
import random
# Input file with info on population
agents_in = 'test_data/NR_agents.txt'
# Number of agents to create
n_agents = 10000
# Place numbers
n_houses = 29645
n_works = 882
n_hsp = 3
n_rh = 5
n_schools = 68
with open(agents... | StarcoderdataPython |
4992875 | <filename>CopyFromLinkedModel.py
__author__ = '<NAME> - <EMAIL>'
__twitter__ = '@danbentley'
__Website__ = 'http://dannybentley.tech/'
__version__ = '1.0.0'
# Enable Python support and load DesignScript library
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
clr.AddReference(... | StarcoderdataPython |
187019 | <filename>algs/SOTL/sotl_agent.py
from algs.agent_fix import AgentFix
class SOTLAgent(AgentFix):
def __init__(self, conf_path, round_number, inter_name):
super().__init__(conf_path, round_number, inter_name)
self.__conf_path = conf_path
self.__round_number = round_number
self.__int... | StarcoderdataPython |
378571 | <filename>alignment.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import attr
from command import *
@attr.s
class AlignmentRecord(object):
'''
alignment result record with 12 columns and convert each
column to correct data type
@para query, query sequence id
@para subject, subject sequence id
@para identity... | StarcoderdataPython |
3326374 | <filename>src/rdbms-connect/azext_rdbms_connect/vendored_sdks/__init__.py
__version__="0.0.1" | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.