id stringlengths 2 8 | text stringlengths 16 264k | dataset_id stringclasses 1
value |
|---|---|---|
9759724 | from PySide2.QtCore import QTimer
import os
from datetime import datetime
def minutes(minutes):
MINUTE = 60000
return MINUTE * minutes
class NotepadRecovery:
def __init__(self):
self.RECOVERY_DIR = "recovery"
self.TEMP_EXT = '.bak'
# Create a recovery directory if one ... | StarcoderdataPython |
6568532 | <filename>tests/sync_pipfile_test.py
from .conftest import data
from .main_test import copy_file, compare_list_of_string_kw_arg
from pipenv_setup.main import cmd
import pytest
from vistir.compat import Path
@pytest.mark.parametrize(
("source_pipfile_dirname", "update_count"),
[("nasty_0", 23), ("no_original_... | StarcoderdataPython |
1735689 | <gh_stars>0
#!/usr/bin/env python
# encoding: utf-8
"""
blmfire.py
Created by <NAME> on 2011-06-08. <EMAIL>
"""
from __future__ import division
from future import standard_library
standard_library.install_aliases()
from builtins import zip
from io import open
import sys
import os, shutil
import urllib.request
import... | StarcoderdataPython |
6531710 | <reponame>TheTechRobo/install-palc-plus
import os
from setuptools import setup, find_packages
def read(filename):
with open(os.path.join(os.path.dirname(__file__), filename)) as f:
return f.read()
setup(
name='py-getch and cprint',
version='1.0.1',
description='Portable getch() for Python. A... | StarcoderdataPython |
5080239 | #!/usr/bin/env python3
# author: greyshell
# description: how to use queue ADT
from collections import deque as queue
def main():
q = queue()
# enque: adding items at rear
q.append(9)
q.append(5)
q.append(3)
q.append(1)
# display the queue elements
print(f"display the queue elements... | StarcoderdataPython |
1771264 | """pbs_map test suite."""
import unittest
import random
import sys
import pbs_map as ppm
print """
Note: If jobs are accepted to by the batch system but not executed, this test suite will hang.
"""
# TODO: Use showstart to identify hanging submissions
class IdentityWorker(ppm.Worker):
def do_work(self, x):... | StarcoderdataPython |
5011486 | <gh_stars>0
# Copyright 2014 Cloudera 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 t... | StarcoderdataPython |
9665901 | <gh_stars>1-10
# flowapp/views/admin.py
from datetime import datetime, timedelta
from flask import Blueprint, render_template, redirect, flash, request, url_for
from sqlalchemy.exc import IntegrityError
from ..forms import UserForm, ActionForm, OrganizationForm, CommunityForm
from ..models import User, Action, Organi... | StarcoderdataPython |
3475057 | <gh_stars>0
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import numpy as np
import torch
class BoxCoder(object):
"""
This class encodes and decodes a set of bounding boxes into
the representation used for training the regressors.
"""
def __init__(self, weights=(10., 10.,... | StarcoderdataPython |
6518276 | #=======================================================================
__version__ = '''0.0.07'''
__sub_version__ = '''20051210041342'''
__copyright__ = '''(c) <NAME> 2003'''
#-----------------------------------------------------------------------
__doc__ = '''\
this module will define a set of mixins providing t... | StarcoderdataPython |
1678160 | <reponame>basbeu/PyLaia<filename>laia/nn/adaptive_pool_2d_base.py
from __future__ import absolute_import
import torch
from laia.data import PaddedTensor
class AdaptivePool2dBase(torch.nn.Module):
def __init__(self, output_sizes, func):
super(AdaptivePool2dBase, self).__init__()
self._output_size... | StarcoderdataPython |
5115211 | from dataclasses import dataclass
from typing import List, Optional
@dataclass
class Route:
id: Optional[str] = None
name: Optional[str] = None
type: Optional[str] = None
authority: Optional[str] = None
directions: Optional[List[str]] = None
alerts: Optional[List[str]] = None
| StarcoderdataPython |
5006569 | <filename>4.1.1.py
def palindrome(word):
word=word.lower()
left=0
right=len(word)-1
i=True
while left<right:
if word[left]!=word[right]:
i=False
break
else:
left+=1
right-=1
return i
def test_palindrome(word, res, testId):
i... | StarcoderdataPython |
6687565 | <gh_stars>0
"""
Creating editing files and folders for googledoc
Copyright 2019 <NAME>, <EMAIL>
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 t... | StarcoderdataPython |
6631920 | try:
import math
import sys
from PyQt4 import QtGui, QtCore
from random import randint
from time import sleep
except ImportError as ie:
print (str(ie))
# Catched if any packages are missing
missing = str(ie).split("named")[1]
print("Software needs %s installed\nPlease run pip instal... | StarcoderdataPython |
180280 | <filename>batch_flattened_seq_shuffler.py
import torch
import hashlib
import dataclasses
import numpy as np
from typing import List, Tuple, final
from .misc import collate_tensors_with_variable_shapes, CollateData, inverse_permutation
from .tensors_data_class_base import TensorsDataClass
from .mixins import TensorData... | StarcoderdataPython |
5187304 | <filename>pysem/plot.py<gh_stars>1-10
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Graphviz wrapper to visualize SEM models."""
from .model import Model
import logging
try:
import graphviz
__GRAPHVIZ = True
except ModuleNotFoundError:
logging.info("No graphviz package found, visualization method is "... | StarcoderdataPython |
5140052 | <reponame>jnthn/intellij-community
"{}".format(1, 2) | StarcoderdataPython |
3506663 | from .encoders import *
from .decoders import * | StarcoderdataPython |
11333719 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
PyCOMPSs Testbench Tasks
========================
"""
# Imports
import unittest
from modules.testMultiReturnFunctions import testMultiReturnFunctions
from modules.testMultiReturnInstanceMethods import testMultiReturnInstanceMethods
from modules.testMultiReturnIntFunctio... | StarcoderdataPython |
1818658 | <reponame>leighmck/wouter
# -*- coding: utf-8 -*-
#
# Copyright (c) 2018, <NAME>
# All rights reserved.
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies... | StarcoderdataPython |
11365677 | import pickle
from typing import Any, Dict, List, Optional, Tuple, Union
from tqdm import tqdm
from .create import Create
class _Messages:
"""custom class for messages
"""
add_msg = "adding videos"
rm_msg = "removing videos"
class Playlists:
"""Playlists class interacts with youtube playlist... | StarcoderdataPython |
6607090 | import numpy as np
from .parameters import get_arguments
from .utils.read_datasets import read_dataset
from .models.encoder import encoder_base_class
import matplotlib.pyplot as plt
def main():
args = get_arguments()
train_loader, test_loader = read_dataset(args)
encoder = encoder_base_class(args)
... | StarcoderdataPython |
32170 | import os
from pathlib import Path
from flask import Flask, current_app, jsonify, request
from flask_cors import CORS
from mongoengine import connect, MongoEngineConnectionError
import namesgenerator
from model import Doc
from app_logic import random_df, call_r
def create_app(config=None):
app = Flask(__name__)
... | StarcoderdataPython |
1757192 | """Tools for displaying tool-tips.
This includes:
* an abstract base-class for different kinds of tooltips
* a simple text-only Tooltip class
"""
from tkinter import *
class TooltipBase(object):
"""abstract base class for tooltips"""
def __init__(self, anchor_widget):
"""Create a tool... | StarcoderdataPython |
11310853 | <reponame>ZedThree/FreeQDSK
"""
SPDX-FileCopyrightText: © 2020 <NAME>, University of York. Email: <EMAIL>
SPDX-License-Identifier: MIT
"""
import numpy
from io import StringIO
from freeqdsk import aeqdsk
def test_writeread():
"""
Test that data can be written then read back
"""
data = {
"sh... | StarcoderdataPython |
393548 | <gh_stars>0
import os
from cloudmesh.common.util import path_expand
class EncryptFile(object):
def __init__(self, file_in, file_out, debug=False):
self.data = {
'file': file_in,
'secret': file_out,
'pem': path_expand('~/.ssh/id_rsa.pub.pem'),
'key': path_exp... | StarcoderdataPython |
5017621 | # -*- coding:utf-8 -*-
__author__ = 'SheldonChen'
class Settings(object):
# 安全检验码,以数字和字母组成的32位字符
ALIPAY_KEY = '<KEY>'
ALIPAY_INPUT_CHARSET = 'utf-8'
# 合作身份者ID,以2088开头的16位纯数字
ALIPAY_PARTNER = '2088311784493747'
# 签约支付宝账号或卖家支付宝帐户
ALIPAY_SELLER_EMAIL = '<EMAIL>'
ALIPAY_SIGN_TYPE = 'M... | StarcoderdataPython |
6670775 | """Unit test for s3 bucket."""
import unittest
from unittest.mock import MagicMock
import boto3
from e2fyi.utils.aws.s3 import S3Bucket
class S3BucketTest(unittest.TestCase):
"""TestCase for S3Bucket"""
def setUp(self):
s3client = boto3.client("s3")
s3client.upload_fileobj = MagicMock() #... | StarcoderdataPython |
6499076 | <filename>cp_light_control/cp_task_2.py
import time
import board
from analogio import AnalogOut
led = AnalogOut(board.A0)
while True:
#counts up from 0 to 65535, with 64 increments, ends up corresponding to the DAC's 10-bit range
for i in range(0, 65535, 64):
led.value = i
time.sleep(0.1)
| StarcoderdataPython |
3597427 | <reponame>trevortomlin/Elliptic-Curve-Python
import math
import copy
import matplotlib.pyplot as plt
#https://stackoverflow.com/questions/31074172/elliptic-curve-point-addition-over-a-finite-field-in-python
def inv_mod_p(x, p):
"""
Compute an inverse for x modulo p, assuming that x
is not divisible... | StarcoderdataPython |
135841 | <gh_stars>1-10
"""shufflenetv2 in pytorch
[1] <NAME>, <NAME>, <NAME>, <NAME>
ShuffleNet V2: Practical Guidelines for Efficient CNN Architecture Design
https://arxiv.org/abs/1807.11164
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
def channel_split(x, split):
"""split a tensor... | StarcoderdataPython |
5080067 | a = 100
b = 100
c = 100
surfaceArea = 2*(a + b + c)
print(surfaceArea)
volume = a * b * c
print(volume)
| StarcoderdataPython |
3292443 | """
pygame-menu
https://github.com/ppizarror/pygame-menu
EXAMPLE - GAME SELECTOR
Game with 3 difficulty options.
License:
-------------------------------------------------------------------------------
The MIT License (MIT)
Copyright 2017-2021 <NAME>. @ppizarror
Permission is hereby granted, free of charge, to any p... | StarcoderdataPython |
6555426 | <reponame>jrstats/pymirror
import logging
from typing import Dict, Any, List
class Logger(logging.Logger):
def __init__(self, loggerName: str, config: Dict[str, Any]) -> None:
## initialise class
super().__init__(loggerName)
self.config: Dict[str, Any] = config
## formatter
... | StarcoderdataPython |
8140648 | <reponame>maxiimilian/distlink
from .distlink import COrbitData, SMOIDResult, SLCResult, detect_suitable_options, test_peri_apo, LC, MOID_fast, MOID_direct_search
| StarcoderdataPython |
3397152 | # Generated by Django 2.2.5 on 2019-12-20 11:04
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('dockerapi', '0015_auto_20191220_1903'),
]
operations = [
migrations.AlterField(
model_name='networkinfo',
name='crea... | StarcoderdataPython |
4883407 | """Main package."""
import pytest
import pkg_resources
import micromagnetictests.calculatortests
from .get_tests import get_tests
__version__ = pkg_resources.get_distribution(__name__).version
def test():
"""Run all package tests.
Examples
--------
1. Run all tests.
>>> import micromagnetictest... | StarcoderdataPython |
11234707 | <reponame>mylenefarias/360RAT
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'upload_video_window_dark.ui'
#
# Created by: PyQt5 UI code generator 5.15.4
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what ... | StarcoderdataPython |
3498817 | <reponame>movermeyer/pyramid_es
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from hashlib import sha1
from sqlalchemy import Column, ForeignKey, types, orm
from sqlalchemy.ext.declarative import declarative_base
from ..mixin import ElasticMixin, ESMappin... | StarcoderdataPython |
8118122 | def test_fn(a,b,c):
print('%d' %(a+b-c))
import inspect
print(inspect.getsource(test_fn))
| StarcoderdataPython |
8154540 | import os
import sys
import click
import requests
TOKEN_URL = 'https://openapi.baidu.com/oauth/2.0/token?grant_type={0}&client_id={1}&client_secret={2}'
TEXT2AUDIO_URL = 'http://tsn.baidu.com/text2audio?tex={0}&lan=zh&cuid={1}&ctp=1&tok={2}&spd={3}&pit={4}&vol={5}&per={6}'
GRANT_TYPE = 'client_credentials'
CUID = 'pyan... | StarcoderdataPython |
80974 | print("Heeeey")
| StarcoderdataPython |
3448328 | __title__ = 'git_demo'
__description__ = 'Demo of GIT workflow'
__url__ = 'https://github.com/gonzalocasas/git_demo'
__version__ = '0.1.0'
__author__ = '<NAME> Research'
__author_email__ = '<EMAIL>'
__license__ = 'MIT license'
__copyright__ = 'Copyright 2018 Gramazio Kohler Research'
__all__ = ['__author__', '__author... | StarcoderdataPython |
5139306 | <reponame>halhenke/promnesia
#!/usr/bin/env python3
import sys
from pathlib import Path
from subprocess import check_call
def convert(path: Path):
suf = '.mp4'
if path.suffix == suf:
# makes it easier for shell globbing...
path = path.with_suffix('')
inp = path.with_suffix(suf)
asser... | StarcoderdataPython |
51449 | # Import modules
import groupdocs_annotation_cloud
from Common import Common
class MoveFolder:
@classmethod
def Run(cls):
# Create instance of the API
api = groupdocs_annotation_cloud.FolderApi.from_config(Common.GetConfig())
try:
request = groupdocs_annotation... | StarcoderdataPython |
3506817 | <filename>basic/dataSource.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 4 20:07:36 2021
@author: alikemalcelenk
"""
from bs4 import BeautifulSoup
import requests
import cloudscraper
import json
import pandas
# GET BINANCE PAIRS
scraper = cloudscraper.create_scraper()
url = 'https://c... | StarcoderdataPython |
11349667 | <gh_stars>1-10
def is_list_or_tuple(obj):
if type(obj) in [list, tuple]:
return True
else:
return False
def list_to_csv_string(obj):
return ",".join([str(ii) for ii in obj])
def list_to_ssv_string(obj):
return " ".join([str(ii) for ii in obj])
| StarcoderdataPython |
6645887 | <gh_stars>0
#!/usr/bin/env python3
"""
Copyright (c) 2018-2020 Cisco and/or its affiliates.
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 ri... | StarcoderdataPython |
6565052 | """
The purpose of this file is to provide benchmarks based on publicly accessible data that can be run on candidate models
without restrictions. As opposed to the private benchmarks hosted on www.Brain-Score.org, models can be evaluated
without having to submit them to the online platform.
This allows for quick local ... | StarcoderdataPython |
6607087 | from datetime import date, datetime, time
from django.conf import settings
from django.db import models
from django.http import Http404
from django.utils.translation import ugettext_noop
from random import randint, shuffle
from wouso.core.user.models import Player
from wouso.core.game.models import Game
from wouso.core... | StarcoderdataPython |
5082912 | #!/usr/bin/env python3
# color molecules from a SMILES file according to per-atom delta score
# values from another file
import matplotlib.pyplot as plot
import rdkit, sys
from rdkit import Chem
from rdkit.Chem import Draw
from rdkit.Chem.Draw import rdDepictor, SimilarityMaps
def RobustSmilesMolSupplier(filename):
... | StarcoderdataPython |
9784427 | <filename>notebooks/mortgage_e2e_gquant/mortgage_common.py
'''
Collection of functions to run the mortgage example.
'''
import os
from glob import glob
class MortgageTaskNames(object):
'''Task names commonly used by scripts for naming tasks when creating
a gQuant mortgage workflow.
'''
load_acqdata_ta... | StarcoderdataPython |
4951287 | #!/usr/bin/env python3
#
# Forked from LiteX-Boards, with additions to support USB debugging.
#
# Copyright (c) 2020 <NAME> <<EMAIL>>
# Copyright (c) 2018-2019 <NAME> <<EMAIL>>
# Copyright (c) 2018 <NAME> <<EMAIL>>
# SPDX-License-Identifier: BSD-2-Clause
import os
import argparse
import sys
from migen import *
from... | StarcoderdataPython |
9797301 | <reponame>javokhirbek1999/pet-finder-rest-api
# Generated by Django 3.2.6 on 2021-09-01 07:34
from django.db import migrations, models
import profiles.models
class Migration(migrations.Migration):
dependencies = [
('profiles', '0001_initial'),
]
operations = [
migrations.AlterField(
... | StarcoderdataPython |
3523259 | <gh_stars>0
import os
from flask import Flask, url_for, render_template, request
app = Flask(__name__)
@app.route('/')
def renderMain():
return render_template('home.html')
@app.route('/page1')
def renderPage1():
return render_template('page1.html')
@app.route('/page2')
def renderPage2():
return render_... | StarcoderdataPython |
4890638 | # Copyright (C) 2010 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the ... | StarcoderdataPython |
5032537 | #########################################################################
#
# Date: Nov 2001 Authors: <NAME>, <NAME>
#
# <EMAIL>
# <EMAIL>
#
# Copyright: <NAME>, <NAME> and TSRI
#
#########################################################################
import tkinter, numpy, _py2k_string as string, math
from m... | StarcoderdataPython |
170736 | <reponame>mishrakeshav/Competitive-Programming
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def diameterOfBinaryTree(self, root: TreeNode) -> int:
... | StarcoderdataPython |
265440 | #!/usr/bin/env python
import unittest
from pycoin.key import Key
from pycoin.serialize import h2b
class KeyTest(unittest.TestCase):
def test_translation(self):
def do_test(exp_hex, wif, c_wif, public_pair_sec, c_public_pair_sec, address_b58, c_address_b58):
secret_exponent = int(exp_hex, 16... | StarcoderdataPython |
1623317 | from authlib.jose import jwt
from authlib.jose.errors import BadSignatureError, DecodeError
from flask import current_app, jsonify, request
from errors import AuthorizationError, InvalidArgumentError
def get_auth_token():
"""
Parse and validate incoming request Authorization header.
NOTE. This function ... | StarcoderdataPython |
4646 | <filename>plugins/panorama/panorama/__init__.py
# -*- coding: utf-8 -*-
"""
Panorama is a Pelican plugin to generate statistics from blog posts
(number of posts per month, categories and so on) display them as beautiful charts.
Project location: https://github.com/romainx/panorama
"""
__version__ = "0.2.0"
__author_... | StarcoderdataPython |
8010509 | import os
import time
from buildworker_scripts.utils.logutils import Log
import boto3
import botocore
import botocore.exceptions
class S3Session(object):
def __init__(self, logger=None, bucket=None):
self.s3client = None
if logger is None:
self.log = Log(name=__name__)
else:
... | StarcoderdataPython |
3336217 | from setuptools import setup
version = {}
with open("src/datadog_cloudformation_common/version.py") as fp:
exec(fp.read(), version)
setup(
version=version["__version__"]
)
| StarcoderdataPython |
266589 | <reponame>ajrichards/bayesian-examples
#!/usr/bin/env python
"""
multi-level example with GLM
Gelman et al.s (2007) radon dataset is a classic for hierarchical modeling
Radon gas is known to be the highest cause of lung cancer in non-smokers.
Here welll investigate this differences and try to make predictions of
rad... | StarcoderdataPython |
1877259 | <filename>items/migrations/0002_item_whereabouts.py
# Generated by Django 2.2.8 on 2020-01-10 16:57
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('items', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='i... | StarcoderdataPython |
4865228 | <reponame>sebastien-Boussier/pygamon<filename>game.py
import pygame
import pyscroll
import pytmx.util_pygame
from player import Joueur
class Game:
def __init__(self):
# creer la fenetre du jeu
self.screen = pygame.display.set_mode((800,600))
pygame.display.set_caption("Pygamon - Adventur... | StarcoderdataPython |
6596383 | #!/usr/bin/env python
import os
import sys
import unittest
pkg_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) # noqa
sys.path.insert(0, pkg_root) # noqa
from tests import config
from terra_notebook_utils import costs
class TestTerraNotebookUtilsCosts(unittest.TestCase):
def test_costs_e... | StarcoderdataPython |
9706626 | <reponame>matthewwardrop/python-mplkit<filename>examples/contour_image.py
import sys
sys.path.insert(0,'..')
from mplkit.plot import *
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from matplotlib.colors import Normalize
from matplotlib.colorbar import ColorbarBase
from mplkit.style import *
c... | StarcoderdataPython |
8078484 | <reponame>PandoraLS/python_toys
import time
import urllib.request
import urllib.parse
from urllib.error import HTTPError, URLError
import socket
import requests
from random import choice
from bs4 import BeautifulSoup
socket.setdefaulttimeout(30)
user_agents = [
'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.... | StarcoderdataPython |
1747688 | cr# -*- coding: utf-8 -*-
"""
This script is used to plot cohen'd using circle format.
"""
import numpy as np
import pytest
import scipy.io as sio
import matplotlib.pyplot as plt
from mne.viz import plot_connectivity_circle, circular_layout
def test_plot_connectivity_circle():
"""
Test plotting connectivity ... | StarcoderdataPython |
3587474 | <filename>genbank_fasta/urls.py
from django.conf.urls import url
from . import views
app_name = 'genbank_fasta'
urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^results/$', views.generate_results, name='generate-genbank-fasta-results'),
url(r'^results/(?P<dataset_id>[0-9]+)/$', views.results... | StarcoderdataPython |
12855559 | #!/usr/bin python
#coding:utf-8
#
# 生成10^7个乱序整数
import random
RANGE = 10000000
f = open('../test/input/bitSort.input','w')
for i in random.sample(range(RANGE),RANGE):
f.write(str(i) + '\n')
f.close()
print 'generator input file success!' | StarcoderdataPython |
4863623 | from django.shortcuts import render
from metaci.api.serializers.cumulusci import OrgSerializer
from metaci.api.serializers.cumulusci import ScratchOrgInstanceSerializer
from metaci.api.serializers.cumulusci import ServiceSerializer
from metaci.cumulusci.filters import OrgFilter
from metaci.cumulusci.filters import Scra... | StarcoderdataPython |
11349762 | import discord
from discord.ext import commands
from .core.image import Reddit, Subreddits
subreddits = Subreddits()
class ImageCog(commands.Cog):
"""Image listener cogs"""
def __init__(self, client):
self.client = client
self.reddit = Reddit()
self.name = "Image Command"
async ... | StarcoderdataPython |
1835869 | import re
from collections import namedtuple
from django.conf import settings
from django.utils.module_loading import import_string
from rest_framework.exceptions import ValidationError
from caluma.core.utils import translate_value
class BaseFormatValidator:
r"""Basic format validator class to be extended by an... | StarcoderdataPython |
8077766 | #!/usr/bin/env python
#-----------------------------------------------------------------------------
# de2120_ex3_send_command.py
#------------------------------------------------------------------------
#
# Written by <NAME> @ SparkFun Electronics, April 2021
#
# This example demonstrates how to use the "send_command(... | StarcoderdataPython |
281221 | """Exceptions for ReSpecTh Parser.
.. moduleauthor:: <NAME> <<EMAIL>>
"""
class ParseError(Exception):
"""Base class for errors."""
pass
class KeywordError(ParseError):
"""Raised for errors in keyword parsing."""
def __init__(self, *keywords):
self.keywords = keywords
def __str__(self)... | StarcoderdataPython |
161272 | import argparse
import os
import mmcv
import torch
from mmcv import Config, DictAction
from mmcv.parallel import MMDataParallel, MMDistributedDataParallel
from mmcv.runner import get_dist_info, init_dist, load_checkpoint
from tools.fuse_conv_bn import fuse_module
from mmdet.apis import multi_gpu_test, single_gpu_test... | StarcoderdataPython |
164192 | <gh_stars>1-10
# Copyright (c) 2020 North Star Imaging, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
# following conditions are met:
# * Redistributions of source code must retain the above copyright notice, this list ... | StarcoderdataPython |
8093439 | <reponame>Sehun0819/pytea
#!/usr/bin/env python
import os
import subprocess
import argparse
import tempfile
from pathlib import Path
DEFAULT_FRONT_PATH = Path(__file__).absolute().parent / "packages"/ "pytea" / "index.js"
def parse_arg():
"""
pytorch_pgm_path : <path_to_pytorch>/<pytorch_pgm_name>.py
"... | StarcoderdataPython |
4911303 | <gh_stars>0
# -*-coding:Utf-8 -*
#--------------------------------------------------------------------------------
# jtlib: conftest.py
#
# Common test code for jtlib.
#--------------------------------------------------------------------------------
# BSD 2-Clause License
#
# Copyright (c) 2018, <NAME>
# All rights r... | StarcoderdataPython |
1941533 | <gh_stars>0
#!/usr/bin/env python
#
# See top-level LICENSE file for Copyright information
#
# -*- coding: utf-8 -*-
"""
This script runs PypeIt on a set of MultiSlit images
"""
def parse_args(options=None, return_parser=False):
import argparse
parser = argparse.ArgumentParser(description='Script to run PypeI... | StarcoderdataPython |
116329 | <reponame>vladsaveliev/sequana
"""
Some useful data sets to be used in the analysis
The command :func:`sequana.sequana_data` may be used to retrieved data from
this package. For example, a small but standard reference (phix) is used in
some NGS experiments. The file is small enough that it is provided within
sequa... | StarcoderdataPython |
11326097 | """
Testing for memory overlap.
"""
# Copyright (c) 2017, <NAME> <<EMAIL>>
# All rights reserved.
# License: BSD 3 clause see https://choosealicense.com/licenses/bsd-3-clause/
from memory_overlap import share_memory
import numpy as np
import unittest
class TestMemoryOverlap(unittest.TestCase):
def test_01(self... | StarcoderdataPython |
78049 | import tweepy
# import the consumer data
from consumer_data import consumer_key, consumer_secret
import helpers
print("=========================")
print("========= twjnt =========")
print("=========================")
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
# try first to load already gotten tokens... | StarcoderdataPython |
4819093 | """Vocabulary for theme-based transformer
Author: <NAME>
Email: <EMAIL>
Date: 2021/11/03
"""
import pickle
import numpy as np
import miditoolkit
import os
import math
from miditoolkit.midi import parser as mid_parser
from miditoolkit.midi import containers as ct
class Vocab(object):
def __init_... | StarcoderdataPython |
3321628 | # -*- coding: utf-8 -*-
#
# Copyright (C) 2010-2016 PPMessage.
# <NAME>, <EMAIL>
# All rights reserved
#
# backend/ppemail.py
#
from ppmessage.core.constant import REDIS_HOST
from ppmessage.core.constant import REDIS_PORT
from ppmessage.core.constant import REDIS_EMAIL_KEY
from ppmessage.bootstrap.config import BOOT... | StarcoderdataPython |
11287977 | # specifiy the actual model start and end years (model period)
mod_start_year=2020
mod_end_year=2040
years = pd.Series(range(mod_start_year,mod_end_year+1),dtype="int")
# please specify the start and end years for the visualisations
vis_start=2020
vis_end=2040
#Fundamental dictionaries that govern naming and colour cod... | StarcoderdataPython |
9742153 | <filename>ekf.py
# ************************************** #
# Extended Kalman Filter #
# ************************************** #
# by <NAME> #
# <NAME> #
# <NAME> #
# ************************************** #
# Department of Mechanical ... | StarcoderdataPython |
1966507 | <reponame>vladertel/tg_dj<gh_stars>1-10
import os
import json
import time
import tornado.ioloop
import tornado.web
import tornado.websocket
import asyncio
import logging
from prometheus_client import Gauge
from core.AbstractComponent import AbstractComponent
from core.models import Song
# noinspection PyAbstractClas... | StarcoderdataPython |
9689313 | import pytest
from slippinj.emr.job_flow.configuration import JobFlowConfigurationParser
class TestJobFlowConfigurationParser(object):
def setup_method(self, method):
self.__job_flow_configuration = JobFlowConfigurationParser()
def teardown_method(self, method):
self.__job_flow_configuration... | StarcoderdataPython |
8159278 | <gh_stars>1-10
import scs
from concurrent.futures import ThreadPoolExecutor
import time
"""
Set up a list of several SCS problems and map `scs.solve` over that list.
Compare the compute time of Python's serial `map` with a multithreaded map
from concurrent.futures. Also test times with and without verbose printing.
"... | StarcoderdataPython |
4926993 | <reponame>EVAyo/BaiduPCS-Py
import os
CPU_NUM = os.cpu_count() or 1
# Defines that should never be changed
OneK = 1024
OneM = OneK * OneK
OneG = OneM * OneK
OneT = OneG * OneK
OneP = OneT * OneK
OneE = OneP * OneK
| StarcoderdataPython |
9618190 | <reponame>gauthamzz/vimana
import sys
import os
stderr = sys.stderr
sys.stderr = open(os.devnull, 'w')
import logging
import numpy as np
import keras
sys.stderr = stderr
from keras.models import load_model
from keras import backend as K
import tensorflow as tf
from PIL import Image
logging.basicConfig(level=os.envir... | StarcoderdataPython |
9744980 | <filename>soco_spotify_plugin/soco_spotify.py
#!/usr/bin/env python3
# coding: utf-8
"""Spotify plugin for Sonos."""
import re
from xml.sax.saxutils import escape
from soco.plugins import SoCoPlugin
from soco.music_services import MusicService
from soco.music_services.accounts import Account
from soco.data_structures... | StarcoderdataPython |
9679578 | <gh_stars>0
import os
import sys
from os.path import dirname
from pathlib import Path
from typing import Optional, List
def find_qemu(
engine: str,
script_paths: Optional[List[str]] = None,
search_paths: Optional[List[str]] = None
) -> Optional[Path]:
def find_executable(base_path: Path) -... | StarcoderdataPython |
3546002 | from enum import Enum
# u'\U00000000'
class Emoji(Enum):
digit_zero = u'\U00000030\U000020E3'
digit_one = u'\U00000031\U000020E3'
digit_two = u'\U00000032\U000020E3'
digit_three = u'\U00000033\U000020E3'
digit_four = u'\U00000034\U000020E3'
digit_five = u'\U00000035\U000020E3'
digit_six = ... | StarcoderdataPython |
3485068 | # Copyright 2019 <NAME>.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, soft... | StarcoderdataPython |
3484883 | import random
FLOAT_TO_INT_MULTIPLIER = 2000000000
def generate_python_random_seed():
"""Generate a random integer suitable for seeding the Python random generator
"""
return int(random.uniform(0, 1.0) * FLOAT_TO_INT_MULTIPLIER)
| StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.