id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
11374124 | """Test for nx_itertools.recipes.first_true"""
from nx_itertools.recipes import first_true
def test_normal():
"""Test first_true."""
# first_true with success
data = iter([0, 0, 'A', 0])
res = first_true(data)
assert res == 'A'
assert list(data) == [0]
# first_true with no success
dat... | StarcoderdataPython |
12813577 | #!/usr/bin/env python3
"""Tests for PartOfSpeechTagger class"""
import copy
import unittest
from gruut.pos import PartOfSpeechTagger
class PartOfSpeechTaggerTestCase(unittest.TestCase):
"""Test cases for PartOfSpeechTagger class"""
def test_encode_decode(self):
"""Test encode/decode functions for py... | StarcoderdataPython |
1934993 | <reponame>ckurze/mongodb-iot-reference
import base64
import os
import yaml
import json
from collections import defaultdict
from pymongo import MongoClient
import helper
import db_operations as operations
def process(event, context):
'''
Entrypoint for Cloud Function 'iotcore_to_mongodb'. Read messages IoT Hub ... | StarcoderdataPython |
3428899 | <filename>cogs/levels.py
import io
import random
import time
from datetime import datetime
import discord
from discord.ext import commands
from easy_pil import Canvas, Editor, Font, load_image_async
from tabulate import tabulate
from helpers.bot import Bonbons
class Levels(commands.Cog):
"""
A cog for leve... | StarcoderdataPython |
6650898 | from .dirutils import *
| StarcoderdataPython |
1869035 | import os
from mask_rcnn.utils import extract_bboxes
from visual_tools.visualize import display_instances
from .gui_viewer import GuiViewer
class GuiCocoViewer(GuiViewer):
def __init__(self, figurename, dataset):
super(GuiCocoViewer, self).__init__(figurename)
self.dataset = dataset
self... | StarcoderdataPython |
11250090 | import sys
from cmake_checker.components.file_finder import provide_files_for_verification
from cmake_checker.components.parse_arguments import parse_arguments
from cmake_checker.components.verifier import Verifier
from cmake_checker.components.reporter import Reporter
def compute_exit_code(violations: list, warn_on... | StarcoderdataPython |
6686193 | import datetime
bills = [
{
u'_all_ids': [u'EXB00000001'],
u'_current_session': True,
u'_current_term': True,
u'_id': u'EXB00000001',
u'_term': u'T1',
u'_type': u'bill',
u'action_dates': {
u'first': datetime.datetime(2011, 1, 7, 0, 0),
... | StarcoderdataPython |
6408164 | from .convert import UCCA2tree, to_UCCA
from .trees import InternalParseNode, LeafParseNode
from .trees import InternalTreebankNode, LeafTreebankNode
from .trees import get_position
__all__ = (
"UCCA2tree",
"to_UCCA",
"InternalParseNode",
"LeafParseNode",
"InternalTreebankNode",
"LeafTreebankNo... | StarcoderdataPython |
3544728 | '''
Simple text based Sudoku solver.
'''
__author__ = '<NAME>'
import copy
def uniqueInsert(l, v):
'''
Add v to list if it is not already there, else raise ValueError
'''
if v is not None:
if v in l:
raise ValueError('list already contains value %s' % v)
assert 0 < v < 10, ... | StarcoderdataPython |
261670 | <reponame>HitmanBobina47/family-task-queue<gh_stars>0
from flask import Flask
import tempfile, os
from family_task_queue import db
def create_app():
app = Flask(__name__)
db_path = os.path.join(tempfile.gettempdir(), "test.db")
app.config["SQLALCHEMY_DATABASE_URI"] = f"sqlite:///{db_path}"
app.config["... | StarcoderdataPython |
1666539 | # -*- coding: utf-8 -*-
"""These are search-related elements for the django ORM, which have
been moved to a separate model because the FTS implementation with
requires a *hybrid* implementation that is different than the other
models. The functionality was moved here to make it easier to support
test routines for our F... | StarcoderdataPython |
3439010 |
cpu = {
'cpu_times': {
'user': 0.0,
'system': 0.0,
'idle': 0.0,
'interrupt': 0.0,
'dpc': 0.0,
},
'cpu_percent': {
'0' : 0.0,
'1' : 0.0,
'2' : 0.0,
'4' : 0.0
},
'cpu_times_percent': {
},
'cpu_count': {
},
'cpu... | StarcoderdataPython |
1778529 | # -*- coding: utf-8 -*-
# @Time : 26.04.21 11:56
# @Author : sing_sd
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import pickle
from pathlib import Path
import src.common_functions as cf
import src.clustering.COStransforms as ct
import src.clustering.cluster_association as ca
plt.rcParam... | StarcoderdataPython |
8031471 | <filename>src/file_note/main.py<gh_stars>1-10
# -*- coding: utf-8 -*-
import os
import sys
import logging
from argparse import ArgumentParser
from file_note.note import FileNote, filter_notes_by_keyword, formatted_print
logging.basicConfig(format="%(levelname)s - %(message)s", level=logging.INFO)
def main():
pa... | StarcoderdataPython |
6558187 | import sys
import mock
from hurricane.server.debugging import setup_debugging, setup_debugpy, setup_pycharm
from hurricane.server.exceptions import IncompatibleOptions
from hurricane.testing import HurricanServerTest
class HurricanDebuggerServerTest(HurricanServerTest):
alive_route = "/alive"
@HurricanSer... | StarcoderdataPython |
3387788 | class Constants(object):
VERSIONS = {
'champion_mastery': 'v4',
'league': 'v4',
'match': 'v4',
'spectator': 'v4',
'summoner': 'v4',
'third_party_code': 'v4'
}
RESPONSE_CODES ... | StarcoderdataPython |
8092335 | #!/usr/bin/env python3
from pyroute2 import IPRoute
IP = IPRoute()
def get_peer_addr(ifname):
"""Return the peer address of given peer interface.
None if address not exist or not a peer-to-peer interface.
"""
for addr in IP.get_addr(label=ifname):
attrs = dict(addr.get('attrs', []))
i... | StarcoderdataPython |
3325219 | from .configs.config import Config
from .lib.authentication import Authentication
from .menu.menu_generator import MenuGenerator
# import typer
from typing import Optional
# app = typer.Typer()
class Application():
def __init__(self):
self.configuration = Config(environment="Prod") #TODO: Make this dynami... | StarcoderdataPython |
3590469 | import twitter
from models import feed_user_coll
from datetime import datetime, timedelta
from pathlib import Path
import test_credentials as c
import sys
import json
import pickle
import pytz
from collections import defaultdict
if __name__ == "__main__":
api = twitter.Api(
c.CONSUMER_KEY,
c.CONSUMER_SECRET,
... | StarcoderdataPython |
1692708 | <reponame>xtommy-1/community-detection
# louvain示意图生成
import numpy as np
import networkx as nx
import matplotlib.pyplot as plt
edge0 = [
(0, 2), (0, 3), (0, 4), (0, 5),
(1, 2), (1, 4), (1, 7),
(2, 4), (2, 5), (2, 6),
(3, 7),
(4, 10),
(5, 7), (5, 11),
(6, 7), (6, 11),
(8, 9), (8, 10), (... | StarcoderdataPython |
8062181 | <reponame>maxwnewcomer/OpenCVFacialRecognition
from imutils.video import VideoStream
from imutils.video import FPS
from tensorflow import keras
from datetime import datetime
import numpy as np
import argparse
import imutils
import pickle
import time
import cv2
import os
def recognize_video(detectorPath, embedding_mode... | StarcoderdataPython |
3294602 | <reponame>adrian2x/asgi-caches<filename>tests/examples/resources.py
from caches import Cache
cache = Cache("locmem://default", ttl=2 * 60)
special_cache = Cache("locmem://special", ttl=60)
| StarcoderdataPython |
3304095 | # Copyright 2019 Atalaya Tech, 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 writing, ... | StarcoderdataPython |
9648337 | <filename>.github/check_import.py
import os
from pathlib import Path
def test_imports(path):
is_correct = True
print("Testing file:", path)
with open(path) as f:
lines = f.readlines()
for i, l in enumerate(lines):
if "#check_import" in l or "# check_import" in l:
l_ = l.... | StarcoderdataPython |
1751317 | <filename>moredata/enricher/osm/osm_places_connector.py
from ..enricher import IEnricherConnector
from ...utils import OSM_util
import pandas as pd
from shapely import wkt
import geopandas
import pyproj
from functools import partial
from shapely.geometry import MultiPolygon, Polygon
from shapely.ops import transform
... | StarcoderdataPython |
6446447 | <reponame>AshivDhondea/DFTS_TF2
"""
Created on Wed Sep 2 10:36:41 2020.
tc_algos.py
Tensor Completion Algorithms:
1. Simple Low Rank Tensor Completion aka SiLRTC
2. High accurracy Low Rank Tensor Completion aka HalRTC
3.
Based on code developed by <NAME> (Multimedia Lab, Simon Fraser University).
SiLRTC-complete.py... | StarcoderdataPython |
5108922 | <filename>src/dice_cli/fs/_copy_from_local.py
# https://arrow.apache.org/docs/python/generated/pyarrow.fs.HadoopFileSystem.html
# connect to HDFS
# create_dir(self, path, *, bool recursive=True)
# async open_output_stream(self, path[, …])
| StarcoderdataPython |
6609440 | """
This file is part of LiberaForms.
# SPDX-FileCopyrightText: 2021 LiberaForms.org
# SPDX-License-Identifier: AGPL-3.0-or-later
"""
import os, re, shutil
from datetime import datetime, timezone
import unicodecsv as csv
from flask import current_app, g
from flask_babel import gettext as _
from liberaforms import d... | StarcoderdataPython |
9644785 | #!/usr/bin/python
import json
import urllib
def showsome(searchfor):
query = urllib.urlencode({'q': searchfor})
print query
url = 'http://ajax.googleapis.com/ajax/services/search/web?v=1.0&%s' % query
search_response = urllib.urlopen(url)
search_results = search_response.read()
results = json.loads(search_... | StarcoderdataPython |
11219858 | # Copyright 2016 Red Hat, 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.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | StarcoderdataPython |
11308814 | import sys
from pybtex.database.input import bibtex
import jinja2
import jinja2.sandbox
import re
from calendar import month_name
_months = {
'jan': 1, 'feb': 2, 'mar': 3, 'apr': 4, 'may': 5, 'jun': 6,
'jul': 7, 'aug': 8, 'sep': 9, 'oct': 10, 'nov': 11, 'dec': 12,
}
def _author_fmt(author):
return u' '.jo... | StarcoderdataPython |
327989 | # -*- coding: utf-8 -*-
"""
Created on Mon Oct 24 15:55:28 2016
@author: sasha
"""
import os
from .init import QTVer
if QTVer == 4:
from PyQt4 import QtGui, QtCore
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.backends.backend_qt4agg import ... | StarcoderdataPython |
8064428 | """
Networking code.
"""
import logging
import signal
import socket
import tornado
from tornado import gen
from tornado.ioloop import IOLoop
from tornado.tcpserver import TCPServer
from . import utils
logger = logging.getLogger("uwhoisd")
def handle_signal(sig, frame):
"""
Stop the main loop on signal.
... | StarcoderdataPython |
8158720 | import os, sys, string, re, commands
######################
# Requirement
# parseUniprot.py
######################################
######################################
#read each line until <name type="ORF" is read
#continue to read the same line and replace matching ME49 or VEG or GT
#and replace the <name type="O... | StarcoderdataPython |
8175512 | <filename>python/pysvso/localization/pnp.py
import cv2
import numpy as np
# used to evaluated pose graph optimization inside PnP Solver
class Measurement:
def __init__(self, pt3d, frame1, px2d1, frame2, px2d2):
self.pt3d = pt3d
#
self.frame1 = frame1
self.px2d1 = px2d1
self... | StarcoderdataPython |
4933492 | from flask import Flask, render_template, request, redirect, url_for, g
from flask_sqlalchemy import SQLAlchemy
import jyserver.Flask as jsf
import numpy as np
import time
import random
from python_code.q_learning import QLearning
from python_code.robot import _raspi
import python_code.constantes as const
# Si se... | StarcoderdataPython |
3478057 | <reponame>felix-salfelder/sage
"""
Schur symmetric functions
"""
#*****************************************************************************
# Copyright (C) 2007 <NAME> <<EMAIL>>
# 2012 <NAME> <<EMAIL>>
#
# Distributed under the terms of the GNU General Public License (GPL)
#
# This cod... | StarcoderdataPython |
1902051 | from osbot_utils.utils.Files import file_create, file_not_exists
from osbot_utils.utils.Process import start_process
def run(event, context=None):
target_host = event.get('target_host' )
ssh_key = event.get('ssh_key' )
ssh_key_name = event.get('ssh_key_name' )
ssh_user = even... | StarcoderdataPython |
8082864 | #!/usr/bin/python
import os, os.path, re, copy
from ..utils.misc import json_dumps, get_string
try:
from html import escape
except ImportError:
from cgi import escape
__all__ = ["add_entries"]
config = {"__Instructions__":"In filename and main_header, {} is replaced with the log title",
"path": os... | StarcoderdataPython |
1658930 | <reponame>andrew0harney/Semantic-encoding-model
from ldaUtils import LdaEncoder,LdaEncoding,createLabeledCorpDict
import numpy as np
from gensim import models
import pickle
import heapq
#<NAME> 28/04/14
#This scripts produces nExemplars for each of the topic models
#(Ordered by probability of belonging to a topic)
... | StarcoderdataPython |
8071312 | <reponame>Bazinga0426/Crowd-Counting-for-FYP
import cv2
import os, time
import random
import pandas as pd
import torch
import torch.nn as nn
from torch.autograd import Variable
import numpy as np
try:
from termcolor import cprint
except ImportError:
cprint = None
try:
from pycrayon import CrayonClient
ex... | StarcoderdataPython |
11352069 | friends = ["Gaurav", "Kritika", "Sachin", "Batra", "Taya", "Taya"]
print("List friends: " + str(friends))
friends.sort()
print("Sorted friends: " + str(friends)) # sort does not work on complex list while reverse does
numbers = [1, 2, 3, 4, 5]
print("List numbers: " + str(numbers))
friends.extend(numbers)
print("E... | StarcoderdataPython |
3520824 | <reponame>bozcani/yolov3-tensorflow2
# -*- coding: utf-8 -*-
import numpy as np
import tensorflow as tf
from tensorflow.keras import layers
from tensorflow.keras.regularizers import l2
import time
from absl import app, flags, logging
def create_model(size, yolo_anchors, yolo_anchor_masks, classes, training=False):
... | StarcoderdataPython |
4972720 | """Terraform module."""
import logging
import os
import re
import subprocess
import sys
from future.utils import viewitems
import hcl
from send2trash import send2trash
from . import RunwayModule, run_module_command, warn_on_skipped_configs
from ..util import change_dir, which
LOGGER = logging.getLogger('runway')
... | StarcoderdataPython |
278681 | <reponame>michael-golden/pulumi-aws
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** 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 Union
from .. import utiliti... | StarcoderdataPython |
3245974 | # 016
# Ask the user if it is raining and convert their answer to lower
# case so it doesn’t matter what case they type it in. If they answer
# “yes”, ask if it is windy. If they answer “yes” to this second
# question, display the answer “It is too windy for an umbrella”,
# otherwise display the message “Take an umbrel... | StarcoderdataPython |
6492942 | import random
import numba
import numpy as np
import torch
from collections import defaultdict
import random
import logging
logger = logging.getLogger(__name__)
# Taken and modified from https://github.com/MorvanZhou/Reinforcement-learning-with-tensorflow/blob/master/contents/5.2_Prioritized_Replay_DQN/RL_brain.py
... | StarcoderdataPython |
8045814 | """misc build utility functions"""
# Copyright (c) PyZMQ Developers
# Distributed under the terms of the Modified BSD License.
import os
import sys
import logging
from distutils import ccompiler
from distutils.sysconfig import customize_compiler
from pipes import quote
from subprocess import Popen, PIPE
pjoin = os.p... | StarcoderdataPython |
9691496 | <gh_stars>1-10
import unittest, doctest
import test_ini
import test_misc
import test_fuzz
import test_compat
import test_unicode
from holland.backup.mysqldump.util import config
from holland.backup.mysqldump.util import ini
class suite(unittest.TestSuite):
def __init__(self):
unittest.TestSuite.__init__(s... | StarcoderdataPython |
6533840 | <gh_stars>1-10
# -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# https://doc.scrapy.org/en/latest/topics/items.html
import scrapy
class OerhoernchenscrapyItem(scrapy.Item):
# define the fields for your item here like:
# name = scrapy.Field()
project_key... | StarcoderdataPython |
6640659 | from eth_abi import encode_single, decode_single
from eth_utils import function_signature_to_4byte_selector
def parse_signature(signature):
"""
Breaks 'func(address)(uint256)' into ['func', '(address)', '(uint256)']
"""
parts = []
stack = []
start = 0
for end, letter in enumerate(signature... | StarcoderdataPython |
314281 | import time
import board
import busio
uart = busio.UART(board.GP0, board.GP1, baudrate=9600)
while True:
# await incoming message
bytes_waiting = uart.in_waiting
if bytes_waiting:
incoming_msg = uart.readline()
print(incoming_msg)
# re-transmit
uart.write(incoming_msg) | StarcoderdataPython |
11212002 | <filename>src/python/magnum/test/test_trade.py
#
# This file is part of Magnum.
#
# Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019
# <NAME> <<EMAIL>>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentati... | StarcoderdataPython |
1834052 | #!/usr/bin/env python
# coding: utf-8
#
# Author: <NAME>
# Email: yanpx (at) mail2.sysu.edu.cn
from __future__ import absolute_import, division, print_function
import os
import sys
sys.path.append('flownet2')
import torch
import torch.nn as nn
from torch.utils import data
from torchvision.transforms import funct... | StarcoderdataPython |
6614830 | import numpy as np
import abc
from constants import *
from vector import Vector
from dist import Dist
# Definition of a body
class Body():
def __init__(self, m=constants.cons_m, pos, v = Vector(), size=, i):
self.x, self.y = x, y
self.vx, self.vy = vx, vy
self.m = m
self.pos = pos
... | StarcoderdataPython |
215568 | # This file is part of the pyMOR project (http://www.pymor.org).
# Copyright Holders: <NAME>, <NAME>, <NAME>
# License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
from pymor.algorithms.basisextension import trivial_basis_extension, gram_schmidt_basis_extension, pod_basis_extension
from pymor.al... | StarcoderdataPython |
6677141 | <gh_stars>0
#!/usr/bin/python
# socket_client.py
import socket
import sys
import os
def socket_send(command):
try:
sock = socket.socket()
sock.connect(('127.0.0.1', 1000))
sock.send(command)
result = sock.recv(2048)
sock.close()
return result
ex... | StarcoderdataPython |
4830517 | <filename>python_modules/dagster/dagster/grpc/types.py<gh_stars>1-10
from collections import namedtuple
from enum import Enum
from dagster import check
from dagster.core.code_pointer import CodePointer
from dagster.core.instance.ref import InstanceRef
from dagster.core.origin import PipelineOrigin, PipelinePythonOrigi... | StarcoderdataPython |
3264424 | from app import create_app
from app.database import db_session
APP = create_app()
@APP.teardown_appcontext
def shutdown_session(exception=None):
db_session.remove() | StarcoderdataPython |
5142254 | <filename>abexp/core/planning.py
# MIT License
#
# Copyright (c) 2021 Playtika Ltd.
#
# 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 r... | StarcoderdataPython |
3437531 | <reponame>dannyroberts/commcare-hq
from __future__ import absolute_import, unicode_literals
import json
import six
import datetime
from copy import copy
from django.core.serializers.json import (
Serializer as JsonSerializer,
DjangoJSONEncoder)
from dimagi.utils.parsing import json_format_datetime
class J... | StarcoderdataPython |
9615852 | #!/usr/bin/env python3
import unittest
import numpy as np
import torch
from pytorch_translate import rnn # noqa
from pytorch_translate.beam_decode import SequenceGenerator
from pytorch_translate.ensemble_export import BeamSearchAndDecode
from pytorch_translate.tasks import pytorch_translate_task as tasks
from pytorc... | StarcoderdataPython |
8199458 | '''
---------------------------
Licensing and Distribution
---------------------------
Program name: TorsiFlex
Version : 2021.3
License : MIT/x11
Copyright (c) 2021, <NAME> (<EMAIL>) and
<NAME> (<EMAIL>)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associ... | StarcoderdataPython |
116085 | <reponame>pathakraul/internetradio-client
#!/usr/bin/python
# Internet Radio Client using Shoutcast service
# to search and play random channels with genre search
# Usage ./internetradio.py --genre <GENRE>
import os
import logging
import argparse
import requests as rq
import xml.etree.ElementTree as et
#-----------... | StarcoderdataPython |
4836351 | import os
# -*- coding: utf-8 -*-
# available languages
LANGUAGES = {
'fr': 'Français',
'en': 'English'
}
STRIPE_KEYS = {
'secret_key': os.environ['SECRET_KEY'],
'publishable_key': os.environ['PUBLISHABLE_KEY'],
'endpoint_secret': os.environ['ENDPOINT_SECRET']
}
SQLALCHEMY_DATABASE_URI = 'sqlite... | StarcoderdataPython |
5184766 | <filename>clipik.py
from PIL import ImageGrab
import time
# Change the following path according to your folder of choice.
fileName = 'E:\myScreenshots\Screenshot_' + time.strftime("%Y%m%d_%H%M%S") + '.JPG'
def save_clipboard_image():
ImageGrab.grabclipboard().save(fileName)
print('Image saved to %s' % fileName)... | StarcoderdataPython |
3423137 | import numpy as np
import os
import torch
import logging
from visualsearch.utils import ProcessingStats
class NumpyRepo:
def __init__(self, numpy_file):
self.use_gpu = torch.cuda.is_available()
self.numpy_file = numpy_file
self.stats = ProcessingStats()
if os.path.isfile(numpy_file... | StarcoderdataPython |
3229467 | def main(argv):
import importlib # pylint: disable=C0415
import argparse # pylint: disable=C0415
from . import __version__ # pylint: disable=C0415
prog_name = "tesserae"
subcommands = {
"align": "tesserae.command.align.main",
}
parser = argparse.ArgumentParser(
prog=pro... | StarcoderdataPython |
6508213 | <gh_stars>1-10
from assets.forms import SimpleSearchForm
def common_variables(request):
form = SimpleSearchForm()
return {'simple_search_form': form}
| StarcoderdataPython |
4957689 | <gh_stars>0
#from api import *
from .ev3 import *
from .mproc import MprocModel
| StarcoderdataPython |
6687300 | import cv2
import sys
import os
def append_file_text(filename, text):
name, ext = os.path.splitext(filename)
return "{name}_{uid}{ext}".format(name=name, uid=text, ext=ext)
# Input error catching
num_args = len(sys.argv)
if num_args != 3:
print("Usage: python3 ./resize_image <filename> <width (px)>")
... | StarcoderdataPython |
6468805 | <gh_stars>0
#! /opt/stack/bin/python3
#
# @copyright@
# Copyright (c) 2006 - 2018 Teradata
# All rights reserved. Stacki(r) v5.x stacki.com
# https://github.com/Teradata/stacki/blob/master/LICENSE.txt
# @copyright@
class ProfileBase:
def pre(self, client):
pass
def main(self, client)... | StarcoderdataPython |
3497107 | <reponame>JustinTW/pulumi-eks<filename>python/pulumi_eks/_inputs.py
# coding=utf-8
# *** WARNING: this file was generated by pulumi-gen-eks. ***
# *** 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... | StarcoderdataPython |
5000768 | <filename>ltr/admin/multigpu.py<gh_stars>1-10
import os
import torch.nn as nn
from gpustat import GPUStatCollection
def is_multi_gpu(net):
return isinstance(net, (MultiGPU, nn.DataParallel))
class MultiGPU(nn.DataParallel):
"""Wraps a network to allow simple multi-GPU training."""
def __getattr__(self,... | StarcoderdataPython |
5014946 | <gh_stars>1-10
# -*- coding: utf-8 -*-
import sys
from termcolor import colored
from DIR import *
def Hello():
print("▒▒▒▒▒▒▒█▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀█")
print("▒▒▒▒▒▒▒█░▒▒▒▒▒▒▒▓▒▒▓▒▒▒▒▒▒▒░█")
print("▒▒▒▒▒▒▒█░▒▒▓▒▒▒▒▒▒▒▒▒▄▄▒▓▒▒░█░▄▄")
print("▒▒▄▀▀▄▄█░▒▒▒▒▒▒▓▒▒▒▒█░░▀▄▄▄▄▄▀░░█")
print("▒▒█░░░░█░▒▒▒▒▒▒▒▒▒▒... | StarcoderdataPython |
1760929 | from PyQt5.QtWidgets import QLabel
from PyQt5.QtCore import pyqtSignal
class ClickableLabel(QLabel):
sig_send = pyqtSignal(int)
def __init__(self, pos, parent=None):
super(ClickableLabel, self).__init__(parent)
self.pos = pos
def mousePressEvent(self, event):
QLabel.mousePressEve... | StarcoderdataPython |
1922815 | # coding=utf-8
# --------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
from ... | StarcoderdataPython |
3268601 | <filename>scielomanager/export/forms.py
# coding: utf-8
from django import forms
from django.core.exceptions import ValidationError
from journalmanager import models as jm_models
class BlidModelChoiceField(forms.ModelChoiceField):
def to_python(self, value):
try:
issue_pk = int(value)
... | StarcoderdataPython |
346847 | <reponame>oliverwy/PhysicalTestReportingAuxiliarySystem
# Generated by Django 2.2.6 on 2019-10-26 10:44
import computed_property.fields
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
... | StarcoderdataPython |
6547621 | # django
from django.conf.urls import url
# views
from cooggerapp.views import users
urlpatterns = [
# url(r'^upload/pp/$', users.Uploadpp.as_view(), name="user_upload_pp"),
url(r"^about/@(?P<username>.+)/$", users.UserAboutBaseClass.as_view(), name="userabout"),
url(r'^(?P<utopic>.+)/@(?P<username>.+)/$'... | StarcoderdataPython |
3272631 | <reponame>sinedie/Flask-Svelte-Websockets-Nginx-Docker<gh_stars>1-10
from flask import Blueprint, jsonify, request
from flask_jwt_extended import jwt_required, get_jwt_identity, fresh_jwt_required
api = Blueprint('api', __name__, url_prefix="/api")
@api.route('/', methods=["GET"])
def healt_check():
return json... | StarcoderdataPython |
8081235 | <reponame>agrija9/Software-Development-Project
import rospy
import numpy as np
from std_msgs.msg import String
import threading
import time
import rosgraph
import socket
from datetime import datetime
from flask import Flask, render_template
from flask import request, redirect
from gevent.pywsgi import WSGIServer
from w... | StarcoderdataPython |
6661969 | <gh_stars>0
#!/usr/bin/env python3
import sys,re
import getopt
from glob import glob
import os
import shutil
import time
import tempfile
import subprocess
import json
import pprint
import pickle
from datasketch import MinHash, LeanMinHash
import itertools
start = time.time()
'''
schema of dictionary db:
<hash:List... | StarcoderdataPython |
6637201 | # line_reader.py
import os
# Function: Will read and return the first line from a file.
# The filename and path to this pile will be passed in as
# an argument to the function, and the function will open
# that file, read in the first line, and return it.
def read_from_file(filename):
if not os.path.exists(filena... | StarcoderdataPython |
11269936 | from .help import dp
from .start import dp
from .rules import dp
from .settings import dp
from .death_note_list import dp
from .top_users import dp
from .shop import dp
from .write import dp
from .write_down import dp
__all__ = ["dp"]
| StarcoderdataPython |
309506 | <gh_stars>1-10
from django.apps import AppConfig
class UnclassedConfig(AppConfig):
name = 'Unclassed'
| StarcoderdataPython |
6599101 | <filename>sco_py/expr.py
import numdifftools as nd
import numpy as np
from scipy.linalg import eigvalsh
DEFAULT_TOL = 1e-4
"""
Utility classes to represent expresions. Each expression defines an eval, grad,
hess, and convexify method. Variables and values are assumed to be 2D numpy
arrays.
"""
N_DIGS = 6 # 10
cla... | StarcoderdataPython |
11294480 | <reponame>syeomvols/SISSO<gh_stars>0
# Created by <NAME> and <NAME>, 2022.2
# Variable Selection for SISSO (SISSO-SV). Please refer to [<NAME>, <NAME>, et al., xxx] for more details.
# Usage: prepare the normal SISSO.in and train.dat in working directory, and then run the VarSelect.py with
# proper input parameters... | StarcoderdataPython |
11390561 | import logging
import os
import sqlite3
from time import sleep
def _log_msg(msg, project_id=None):
"""Return the log message with project_id."""
if project_id is not None:
return f"Project {project_id} - {msg}"
return msg
def get_db(db_file):
db = sqlite3.connect(str(db_file), detect_types=... | StarcoderdataPython |
178036 | import numpy as np
from skimage import feature
from sklearn import preprocessing
class LBP:
def __init__(self, p, r):
self.p = p
self.r = r
def getVecLength(self):
return 2**self.p
def getFeature(self, imgMat):
feat = feature.local_binary_pattern(
... | StarcoderdataPython |
3536612 | <filename>pie.py
import data
import matplotlib.pyplot as plt
def pie_chart():
df, emails, timestamp = data.get_data()
# queries to filter responses by social media, labels are self-explanatory
tiktok = df[df["Social Media"] == "Tiktok"]
instagram = df[df["Social Media"] == "Instagram"]
youtube = ... | StarcoderdataPython |
161121 | from typing import Dict, List
import logging
from pydoc import locate
from attrdict import AttrDict
from flask_sqlalchemy import Model
from api.models import * # noqa
logger = logging.getLogger(__name__)
class Endpoint(object):
def __init__(
self,
name: str,
model: str,
versio... | StarcoderdataPython |
3427900 | # Licensed under MIT License - see LICENSE
"""
An N-dimensional lattice class with an identify_cluster method.
"""
import numpy as np
__all__ = ["latticeND"]
class latticeND():
"""
An N-dimensional lattice class.
"""
def __init__(self, data, level):
"""
Args:
data (`numpy... | StarcoderdataPython |
5195185 | <gh_stars>1-10
import settings
import schedules.messages as messages
#TODO: Multiprocessing, Real Scheduling
if __name__ == "__main__":
messages.process_scheduled_messages()
| StarcoderdataPython |
6498509 | from RedditPy import RedditPy
re = RedditPy("<username>", "<password>")
re.subscribe("test") # optional: Type="user", unsub=True | StarcoderdataPython |
5000072 | <reponame>YAPP-18th/ML-Team-Backend
from app.database.base_class import Base
from app.models.users import User
| StarcoderdataPython |
1808874 | <filename>src/pycairo/examples/cairo_snippets/c_to_python.py
#!/usr/bin/env python
"""
translate C <snippet>.cairo to Python <snippet>.py
; -> ''
cairo_ -> cr.
'(cr, ' -> ( but not snippet_normalize (cr, width, height)
(cr) -> ()
/* -> #/*
CAIRO_ -> cairo.
"""
import sys
if len(sys.argv) != 2 or... | StarcoderdataPython |
6614755 | import pytest
from remove_popular import solution
def test_solution_simple():
actual = solution([1], 0)
expected = []
assert actual == expected
def test_solution():
actual = solution([1, 1, 1, 1, 2, 2, 2, 3, 4, 4, 5, 6, 6, 4, 2, 4], 3)
expected = [3, 5, 6, 6]
assert actual == expected
| StarcoderdataPython |
3457375 | <reponame>OceanAtlas/QC_Library<filename>setup.py
# -*- mode: python; coding: utf-8 -*
# Copyright (c) <NAME>
# Licensed under the 2-clause BSD License
from __future__ import absolute_import, division, print_function
from setuptools import setup, Extension
import os
import io
with io.open('README.md', 'r', encoding... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.