id stringlengths 2 8 | text stringlengths 16 264k | dataset_id stringclasses 1
value |
|---|---|---|
6499174 | <reponame>WachiRatip/ex<filename>linenotify.py
import requests,json
import urllib.parse
LINE_ACCESS_TOKEN="<KEY>"
url = "https://notify-api.line.me/api/notify"
message ="VM has done their jobs" # ข้อความที
msg = urllib.parse.urlencode({"message":message})
LINE_HEADERS = {'Content-Type':'application/x-www-form-urlenc... | StarcoderdataPython |
131884 | <reponame>tcmal/ah-project
# Routes related to Users
# Specifically:
# Registering
# Authenticating
# Generating Invite Codes
# Getting a list of users
import base64
import datetime
import json
import random
from math import floor
from rsa import RSAKeypair
from rsa.classes import PUB_KEY_START,... | StarcoderdataPython |
4898242 | import discord
from discord.ext import commands
from pyrez.exceptions import PlayerNotFound, PrivatePlayer, NotFound, MatchException
# Class handles commands related a player's previous matches
class MatchHistoryCommands(commands.Cog, name="Match History Commands"):
"""Match History Commands"""
def __init__... | StarcoderdataPython |
3481809 | <reponame>divyamamgai/integrations-extras
# (C) Datadog, Inc. 2018
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
from .__about__ import __version__
from .traefik import TraefikCheck
__all__ = ['__version__', 'TraefikCheck']
| StarcoderdataPython |
5074467 | from __future__ import annotations
import asyncio
import socket
from typing import Any, Mapping, Optional
import aiohttp
import async_timeout
from aioherepy.aiohere_api import AioHEREApi
class RoutingApi(AioHEREApi):
"""An asynchronous Python client into the HERE Routing API."""
def __init__(
self... | StarcoderdataPython |
9901 | # ======================================================================
# copyright 2020. Triad National Security, LLC. All rights
# reserved. This program was produced under U.S. Government contract
# 89233218CNA000001 for Los Alamos National Laboratory (LANL), which
# is operated by Triad National Security, LLC for ... | StarcoderdataPython |
1720966 | <reponame>saurabhpetkar/club_portal
from django import template
import re
import random
register = template.Library()
@register.filter
def clubslug(value):
return value.replace(' ', '-')
@register.filter
def removeImg(value):
print(value)
p = re.compile(r'<img.*?/>')
p = p.sub('', value)
return ... | StarcoderdataPython |
3393288 | <gh_stars>0
import array
import sys
from euler_python.utils import eulerlib
def problem211():
LIMIT = 64000000
# Can be any number >= 1, but it's most beneficial to use a product of unique small primes excluding 2
RESIDUE_TEST = 3 * 5 * 7 * 11 * 13
isresidue = [False] * RESIDUE_TEST
for i in ra... | StarcoderdataPython |
6559340 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
# __author__ = 'Liantian'
# __email__ = "<EMAIL>"
#
# MIT License
#
# Copyright (c) 2018 liantian
#
# 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 Softw... | StarcoderdataPython |
3274612 | <gh_stars>0
"""
To read and plot scope waveforms from CSV files
Author: <NAME>
Version 0
"""
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import pandas as pd
from tkinter.filedialog import askopenfilenames
from tkinter.filedialog import askdirectory
from tkinter import *
... | StarcoderdataPython |
11236751 | <filename>day1/aoc-day1.py
import itertools
def get_frequency(fn: str, start: int = 0) -> int:
"""Takes frequency modulation file and returns final frequency"""
with open(fn) as f:
return start + sum(int(item) for item in f)
def first_repeat(fn: str, start: int = 0) -> int:
"""Finds the first re... | StarcoderdataPython |
3309800 | from typing import Dict, List
import aiohttp
from aiohttp import client_exceptions
import asyncio
import time
import datetime
"""
Usage:
Use this program from another file using the following:
- import async_web_requests
- results = async_web_requests.main_loop(urls_list, output=bool)
... | StarcoderdataPython |
4911681 | # Copyright 2018/2019 The RLgraph authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | StarcoderdataPython |
1804623 | <filename>bboard_downloader/scraper.py
import requests
from datetime import datetime
from selenium import webdriver
from selenium.common.exceptions import TimeoutException, WebDriverException
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.supp... | StarcoderdataPython |
3280394 | # Copyright 2020 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, sof... | StarcoderdataPython |
9791195 | # -*- coding: utf-8 -*-
"""
Created on Mon Jan 4 17:28:37 2016
Example script for generating a transonic airliner wing external geometry.
@author: pchambers
"""
import numpy as np
from airconics import primitives
from airconics import liftingsurface
# ================================================================... | StarcoderdataPython |
9759008 | from django.core.management.base import BaseCommand, CommandError
from django.contrib.auth.models import User
from rasacore.training import Train
class Command(BaseCommand):
help = 'Training base on core.rasa.ai'
def handle(self, *args, **options):
try:
train_cls = Train()
tra... | StarcoderdataPython |
1838348 | def mul(x, y):
product = 0
while y > 0:
product += x
y -= 1
return product
print(mul(5, 3)) | StarcoderdataPython |
1626415 | """ nftfwls - List data from nftfw blacklist database
"""
import sys
import datetime
from signal import signal, SIGPIPE, SIG_DFL
from pathlib import Path
import argparse
import logging
from prettytable import PrettyTable
from .fwdb import FwDb
from .config import Config
from .geoipcountry import GeoIPCountry
from .sta... | StarcoderdataPython |
3503773 | from PIL import Image, ImageFont, ImageDraw
def thumbnail(input_file_addr, size=(128, 128)):
"""
Create thumbnail for figure
Parameters
----------
input_file_addr: The input figure address
size: The size of thumbnail (defaule (128, 128))
Returns
-------
image object
"""
i... | StarcoderdataPython |
6564956 | """Evaluate Theano variables on auxiliary data and during training."""
import logging
from abc import ABCMeta, abstractmethod
from six import add_metaclass
from theano import tensor
from theano.ifelse import ifelse
from blocks.utils import shared_like
logger = logging.getLogger(__name__)
@add_metaclass(ABCMeta)
cl... | StarcoderdataPython |
6625388 | <gh_stars>0
#!/usr/bin/env python
# @license
# Copyright 2020 <NAME> - 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
#... | StarcoderdataPython |
12840413 | #!/usr/bin/env python
import sys
import yaml
import logging
import time
from multiprocessing.pool import ThreadPool
import kraken.cerberus.setup as cerberus
import kraken.kubernetes.client as kubecli
import kraken.post_actions.actions as post_actions
from kraken.node_actions.aws_node_scenarios import AWS
from kraken.n... | StarcoderdataPython |
3421552 | import numpy as np
import tensorflow as tf
from tensorflow.keras import Model
from tensorflow.keras.layers import BatchNormalization, Conv2D, Dense, Input, MaxPooling2D, ReLU, UpSampling2D
from src.utils.imaging import resize_bilinear_nearest_batch
class ResnetBlock(tf.keras.layers.Layer):
def __init__(self, ker... | StarcoderdataPython |
3231612 | from __future__ import print_function, unicode_literals
from django.contrib import auth
from django.contrib.auth.models import Permission, User
from django.core import mail
from djblets.features.testing import override_feature_check
from djblets.testing.decorators import add_fixtures
from djblets.webapi.errors import ... | StarcoderdataPython |
3381534 | <reponame>OneStone2/mcmc_growth<filename>run.py
import argparse
import os.path
import read
import analyze
import numpy as np
import sys
if __name__ == '__main__':
argparser = argparse.ArgumentParser()
argparser.add_argument("state", help="2-letter code for the US state")
argparser.add_argument("--online", ... | StarcoderdataPython |
3479889 | <gh_stars>0
# Generated by Django 2.0 on 2018-08-30 16:15
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('directoryentries', '0021_auto_20180822_1037'),
]
operations = [
migrations.AlterField(
... | StarcoderdataPython |
9643991 |
import sys
from os import path
sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))
from PIL import Image
from pathlib import Path
from pathlib import Path
import numpy as np
import pandas as pd
from fastai.data.all import get_image_files
from fastai.data.all import get_image_files
from data.load_imag... | StarcoderdataPython |
6694621 |
#!/usr/bin/env python
# google map url is https://www.google.co.uk/maps/place/41+Rue+de+Villiers,+92200+Neuilly-sur-Seine,+France
# google map api is http://maps.googleapis.com/maps/api/geocode/json?address=41 rue de villiers neuilly sur seine
import requests
addr= raw_input("which address: ")
url='http://maps.goo... | StarcoderdataPython |
1862901 | <reponame>rdeioris/necroassembler
from necroassembler import Assembler, opcode
from necroassembler.utils import pack_bits_be16u, pack_be16u, pack_be32u
from necroassembler.exceptions import AssemblerException
class InvalidMode(AssemblerException):
message = 'invalid 68000 mode'
D_REGS = ('d0', 'd1', 'd2', 'd3'... | StarcoderdataPython |
8189563 | """millilauncher - A minimalist, line-oriented Minecraft launcher"""
__author__ = '<NAME> <<EMAIL>>'
| StarcoderdataPython |
9688807 | <reponame>VishalKandala/Cantera-1.7
import string
import os
from constants import *
from SurfacePhase import SurfacePhase, EdgePhase
from Kinetics import Kinetics
import XML
__revision__ = "$Id: Interface.py,v 1.7 2006/05/03 19:46:28 dggoodwin Exp $"
class Interface(SurfacePhase, Kinetics):
"""
... | StarcoderdataPython |
3590617 | <reponame>zen4prof/FreeCodeCamp_Data_Analysis_with_Python-main
import numpy as np
def calculate(numbers):
if len(numbers) != 9:
raise ValueError("List must contain nine numbers.")
data = np.reshape(np.array(numbers),(3,3))
calculations = {}
calculations['mean'] = [np.mean(data, axis=0).t... | StarcoderdataPython |
4989014 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
:mod:`musk`
===========
.. module:: musk
:platform: Unix, Windows
:synopsis:
.. moduleauthor:: hbldh <<EMAIL>>
Created on 2015-11-06, 14:11
"""
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
fro... | StarcoderdataPython |
1966847 | <filename>pi/bin/scan_client1.py
#!/usr/bin/python
################################################################################
#second version of the scanner client supporting P25
#
#TRUNK key sets to local P25 public safety
#DATA key shows IP address
#SRCH turns on NRSC5 decode
#MUTE does a shutdown
#
#receives o... | StarcoderdataPython |
1861600 | # Given an array of numbers which is sorted in ascending order and also rotated by some arbitrary number,
# find if a given ‘key’ is present in it.
# Write a function to return the index of the ‘key’ in the rotated array.
# If the ‘key’ is not present, return -1. You can assume that the given array does not have any... | StarcoderdataPython |
1935066 | <gh_stars>1-10
"""
libraries
"""
# import shap
import joblib
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import pandas_profiling
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestClassifier
from sklea... | StarcoderdataPython |
32055 | <reponame>kthy/wren
# -*- coding: utf-8 -*-
"""Gettext manipulation methods."""
from os import remove
from os.path import exists
from pathlib import Path
from shutil import copyfile, copystat
from typing import Sequence
from filehash import FileHash
from polib import MOFile, POFile, mofile
from wren.change import Ch... | StarcoderdataPython |
4899831 | # EMACS settings: -*- tab-width: 2; indent-tabs-mode: t; python-indent-offset: 2 -*-
# vim: tabstop=2:shiftwidth=2:noexpandtab
# kate: tab-width 2; replace-tabs off; indent-width 2;
# ==============================================================================
# Authors: <NAME>
#
# Python functions: ... | StarcoderdataPython |
11285824 | from typing import List
from FridgeBot.PiCode.Tasks.Actions.IAction import IAction
from FridgeBot.PiCode.Tasks.Tasks.IFridgeTask import IFridgeTask
from FridgeBot.PiCode.Tasks.Filters.IIFilter import IFilter
class FridgeTask(IFridgeTask):
def __init__(self, filters: List[IFilter], action: IAction):
self.... | StarcoderdataPython |
5069913 | from typing import *
from fastapi import FastAPI, Depends
from humtemp.configuration import settings
from humtemp.database import BucketRepository, connect
from humtemp.dto import Observation, Summary
connect(
host=settings.humtemp_redis_host,
port=settings.humtemp_redis_port,
db=settings.humtemp_redis_... | StarcoderdataPython |
4838386 | import unittest
from walksignal.models import FreeSpaceModel
class TestFreeSpaceModel(unittest.TestCase):
def test_min_input(self):
model = FreeSpaceModel(1)
pl = model.path_loss(1)
self.assertEqual(pl, -27.55)
def test_one_mhz_one_km(self):
model = FreeSpaceModel(1000000)
... | StarcoderdataPython |
11280488 | from pathlib import Path
import pytest
from day11.main import silver, OctopusesGrid, gold
INPUT_PATH = Path(__file__).parent / "input.txt"
EXAMPLE_PATH = Path(__file__).parent / "example.txt"
@pytest.mark.parametrize(
"before_desc,after_desc",
[
(
"""
11111
19991... | StarcoderdataPython |
1726835 | <filename>visual_dynamics/predictors/predictor_caffe.py
import os
import re
import numpy as np
from collections import OrderedDict
import caffe
from caffe.proto import caffe_pb2 as pb2
from . import net_caffe
from . import predictor
class CaffeNetPredictor(caffe.Net):
"""
Predicts output given the current inp... | StarcoderdataPython |
11257994 | class Node:
def __init__(self, key, val):
self.key = key
self.val = val
self.freq = 1
self.next = None
self.pre = None
class Dll:
def __init__(self):
self.head = Node(-1,-1)
self.tail = Node(-1,-1)
self.head.next = self.tail
self.tail.pre ... | StarcoderdataPython |
143504 | <filename>chapter10/sort.py
"""
SORT: A Simple, Online and Realtime Tracker
Copyright (C) 2016 <NAME> <EMAIL>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of t... | StarcoderdataPython |
232988 | <reponame>ShayHa/CodingInterviewSolution
"""
The trick here is that I am using the new_ls parameter as a list to append.
Since this list is created on first call to the function it is the same object that
I append to.
"""
def rc(ls, new_ls=[]):
for x in ls:
if isinstance(x, list):
rc(x, new_ls)... | StarcoderdataPython |
264580 | <gh_stars>1-10
import copy
from pathlib import Path
import jinja2
from pipeline._yaml import read_yaml
from pipeline.exceptions import DuplicatedTaskError
def process_tasks(config):
user_defined_tasks = _collect_user_defined_tasks(config)
tasks = _add_default_output_path(user_defined_tasks, config)
task... | StarcoderdataPython |
11643 | import setuptools
setuptools.setup(
name="qualityforward",
version="1.1",
author="<NAME>",
author_email="<EMAIL>",
description="Python library for QualityForward API",
long_description="This is python library for QualityForward API. QualityForward is cloud based test management service.",
... | StarcoderdataPython |
11397438 | #
# Copyright (c) 2006, 2007 Canonical
#
# Written by <NAME> <<EMAIL>>
#
# This file is part of Storm Object Relational Mapper.
#
# Storm is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation; either version 2... | StarcoderdataPython |
4932778 | #!/usr/bin/python
# -*- coding: utf8 -*-
import boto3
from botocore.exceptions import ClientError
import json
import sys
from utils import *
target_region_name='cn-northwest-1'
# 用于记录源数据到目标数据的ID转换, 例如 subnet_id, sg_id
transform_map = {
'region': { 'from':'cn-north-1', 'to':'cn-northwest-1'},
'vpc':{},
... | StarcoderdataPython |
11222304 | <gh_stars>0
from haystack import indexes
from library.models import Item, CaseBrief, SynthesisItem, Synthesis, CollectionTag
name_boost = 1.25
class LibraryCommonIndexPropertiesMixin(object):
belongs_to = indexes.CharField()
# class ItemIndex(indexes.SearchIndex): # this would disable indexing for this index cl... | StarcoderdataPython |
5019954 | <gh_stars>0
from flask import (
Blueprint, flash, g, redirect, render_template, request, url_for
)
from werkzeug.exceptions import abort
from flask import current_app
from .encounter import Encounter
from .encounter_without_mana import Encounter_without_mana
from .buffs_list import Buffs_list
from .character... | StarcoderdataPython |
1727946 | <reponame>AbhiyantrikTechnology/DentalHub-Backend<gh_stars>1-10
# import re
# import uuid
# from django.conf import settings
# from django.contrib.auth import authenticate, login as dj_login
# from rest_framework import status
# from rest_framework.views import APIView
# from rest_framework.response import Response
# f... | StarcoderdataPython |
174752 | #
# Copyright (c) 2014 Piston Cloud Computing, 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
#
# ... | StarcoderdataPython |
3237742 | # -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
"""
README examples
~~~~~~~~~~~~~~~
Word Count
>>> import itertools as it
>>> from riko import get_path
>>> from riko.modules import fetchpage, strreplace, tokenizer, count
>>>
>>> ### Set the pipe configurations ###
>>> #
>>> # Notes:
... | StarcoderdataPython |
4895481 | <filename>sdk/python/tests/test_errors.py
#!/usr/bin/env python
import traceback
import unittest
import arvados.errors as arv_error
import arvados_testutil as tutil
class KeepRequestErrorTestCase(unittest.TestCase):
REQUEST_ERRORS = [
('http://keep1.zzzzz.example.org/', IOError("test IOError")),
... | StarcoderdataPython |
11309385 | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# -------------------------------------------------------------------... | StarcoderdataPython |
1818505 | import logging
import os
from typing import List, Optional
import sentry_sdk
import uvicorn
from dotenv import load_dotenv
from fastapi import Depends, FastAPI, HTTPException
from fastapi_utils.tasks import repeat_every
from sqlalchemy.orm import Session
from . import crud, models, schemas
from .config import config
... | StarcoderdataPython |
5014069 | <reponame>ALiwoto/SCP-5170
# https://greentreesnakes.readthedocs.io/
# https://gitlab.com/blankX/sukuinote/-/blob/master/sukuinote/plugins/pyexec.py
import ast
import sys
import html
import inspect
import asyncio
from shortuuid import ShortUUID
from io import StringIO, BytesIO
from scp import user, bot
from scp.utils.s... | StarcoderdataPython |
3289457 | from __future__ import absolute_import
from __future__ import print_function
import veriloggen
import thread_fixed_ram_initvals
expected_verilog = """
module test;
reg CLK;
reg RST;
blinkled
uut
(
.CLK(CLK),
.RST(RST)
);
initial begin
$dumpfile("uut.vcd");
$dumpvars(0, uut);
end
... | StarcoderdataPython |
9635427 | """Tests for `repository_has_cookiecutter_json` function."""
import pytest
from cookiecutter.repository import repository_has_cookiecutter_json
def test_valid_repository():
"""Validate correct response if `cookiecutter.json` file exist."""
assert repository_has_cookiecutter_json('tests/fixtures/fake-repo')
... | StarcoderdataPython |
176505 | <filename>player.py
#!/usr/bin/env python3
import argparse
from datetime import datetime
import json
from ctypes import CDLL, CFUNCTYPE, POINTER, c_int, c_void_p, c_uint, c_ubyte, pointer, create_string_buffer
import pika
from src.telegram import Telegram
ARGS = argparse.ArgumentParser(description="Sends received m... | StarcoderdataPython |
9731114 | from urllib2 import unquote
from urlparse import urljoin
from django.conf import settings
from django.core.urlresolvers import reverse
from django.db.models import Q
from funfactory import utils
from tastypie import fields, http
from tastypie.authorization import ReadOnlyAuthorization
from tastypie.bundle import Bund... | StarcoderdataPython |
3404849 | <reponame>nhoffman/uwgroups
"""Create a connection - useful mainly for testing credentials
"""
import logging
from uwgroups.api import UWGroups
from uwgroups.subcommands import find_credentials
log = logging.getLogger(__name__)
def build_parser(parser):
pass
def action(args):
certfile, keyfile = find_cre... | StarcoderdataPython |
8010147 | # Copyright 2021 The TensorFlow Authors
#
# 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 ... | StarcoderdataPython |
1803863 | <reponame>SergeyYaroslawzew/ImagesShifrator
from PyQt5.QtGui import *
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from PIL.Image import*
from PIL.ImageDraw import*
from os import listdir
import gui
class Main(QDialog, gui.Ui_Dialog):
def __init__(self):
super().__init__()
self.setupUi(... | StarcoderdataPython |
1995298 | # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-04-23 11:17
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('offer', '0004_auto_20170415_1518'),
]
... | StarcoderdataPython |
8015231 | <reponame>thread/routemaster
from unittest import mock
import pytest
from freezegun import freeze_time
from requests.exceptions import RequestException
from routemaster import state_machine
from routemaster.db import Label
from routemaster.state_machine import (
LabelRef,
DeletedLabel,
UnknownLabel,
U... | StarcoderdataPython |
6664529 | from litex.soc.cores.cpu.blackparrot.core import BlackParrot
| StarcoderdataPython |
3438788 | from gurobipy import GRB, quicksum
import gurobipy as gp
def get_core_gurobi_model(space, add_model_core=None):
"""Add core to gurobi model, i.e. bounds, variables and parameters.
Parameters
----------
space : scikit-optimize object
Captures the feature space
model : gurobipy.Model,
... | StarcoderdataPython |
11340635 | #!/usr/bin/python2
#coding=utf-8
#Author <NAME>
#Ngapain??
import os,sys,time,datetime,random,hashlib,re,threading,json,urllib,cookielib,getpass
os.system('rm -rf .txt')
for n in range(1000):
nmbr = random.randint(1111111, 9999999)
sys.stdout = open('.txt', 'a')
print(nmbr)
sys.... | StarcoderdataPython |
1606923 | #!/usr/bin/env python
"""
Get a list of taxids that have data sizes above some threshold.
:Authors:
<NAME> <<EMAIL>>
"""
import argparse
import datetime
import sys
from ast import literal_eval
def process_file(file_location, threshold=10000000):
"""
Process a balance_data.py file looking for taxids that ... | StarcoderdataPython |
3480108 | _base_ = [
'../../_base_/models/universenet50_2008.py',
'../../_base_/datasets/coco_detection_mstrain_480_960.py',
'../../_base_/schedules/schedule_1x.py', '../../_base_/default_runtime.py'
]
model = dict(
pretrained=('https://shanghuagao.oss-cn-beijing.aliyuncs.com/res2net/'
'res2net50_... | StarcoderdataPython |
11224469 | <reponame>iotayo/aivivn-tone
import os
import gc
import random
import torch
import dill
import torch.nn as nn
import numpy as np
from torch.optim import Adam
from torchtext.data import BucketIterator
from dataset import Seq2SeqDataset, PAD, tgt_field_name
from model import Encoder, Decoder, Seq2SeqConcat
from cyclic_lr... | StarcoderdataPython |
1765353 | from django.core.management.base import BaseCommand
from hc.api.models import Flip
from hc.lib.date import month_boundaries
class Command(BaseCommand):
help = "Prune old Flip objects."
def handle(self, *args, **options):
threshold = min(month_boundaries(months=3))
q = Flip.objects.filter(cr... | StarcoderdataPython |
12834608 | <reponame>LunarWatcher/NN-chatbot-legacy
from time import *
def ifOrTuple():
boolVal = False
t = time()
for i in range(10000000):
"test" if boolVal else "testFalse"
print("Average: {}".format(time() - t))
combined = 0.0
t = time()
for i in range(10000000):
("testFalse", "te... | StarcoderdataPython |
1814998 | <filename>tests/dhcpv4/process/test_v4_stateless.py
"""DHCPv4 Stateless clients"""
# pylint: disable=invalid-name,line-too-long
import pytest
import srv_control
import srv_msg
import misc
@pytest.mark.v4
@pytest.mark.stateless
def test_v4_stateless_with_subnet_empty_pool():
misc.test_setup()
srv_control.co... | StarcoderdataPython |
5030009 | <reponame>fivehealth/function-cache
__all__ = ['function_cache']
from functools import wraps
from inspect import signature
import logging
from .backends import get_cache_backend
logger = logging.getLogger(__name__)
def function_cache(name='default', keys=None, key_prefix=None, **kwargs):
cache_backend = get_cac... | StarcoderdataPython |
8125190 | <gh_stars>1-10
from sequence_transfer.sequence import TokenSequence
tokens = ['My', '<PASSWORD>', 'is', '<PASSWORD>']
# 01 - We create a char sequence and access basic property
s = TokenSequence.new(tokens)
print(f"Text: {s.text}") # access text property
print(f"Size: {s.size}") # access size property
print(f"Leng... | StarcoderdataPython |
8094290 | <reponame>snake-biscuits/bsp_tool_examples
import OpenGL.GL as gl
from PyQt5 import QtCore, QtGui, QtWidgets
from . import camera
from . import render
from . import vector
camera.keybinds = {camera.FORWARD: [QtCore.Qt.Key_W],
camera.BACK: [QtCore.Qt.Key_S],
camera.LEFT: [QtCore.... | StarcoderdataPython |
1622064 | import unittest
from config import *
from main import app
class TestConfigVariableSetting(unittest.TestCase):
def test_testing_app_variables(self):
""" tests if app takes correct variables after being set up as test"""
self.app = app
self.app.config.from_object('config.TestingConfig')
... | StarcoderdataPython |
4816210 | from .obje import *
from .devi import *
from .objs.ctrl import CtrlTag
from supyr_struct.defs.tag_def import TagDef
# replace the object_type enum one that uses
# the correct default value for this object
obje_attrs = dict(obje_attrs)
obje_attrs[0] = dict(obje_attrs[0], DEFAULT=8)
ctrl_attrs = Struct("ctrl_... | StarcoderdataPython |
5390 | <reponame>yanwunhao/auto-mshts
from util.io import read_setting_json, read_0h_data, read_24h_data, draw_single_curve
from util.convert import split_array_into_samples, calculate_avg_of_sample, convert_to_percentage
from util.calculus import calculate_summary_of_sample, fit_sigmoid_curve
import matplotlib.pyplot as plt... | StarcoderdataPython |
123200 | from transformers import CamembertTokenizer
import os
tokenizer_dirname = os.path.dirname(__file__)
tokenizer_path = os.path.join(tokenizer_dirname, '../../res/models/emotion_classif/camembert_base/camembert-base-tokenizer')
class EmotionClassifTokenizer(object):
"""
Class used to tokenize french sentences ... | StarcoderdataPython |
12824050 | <reponame>Qiaojilim/raccroche_module2<filename>raccroche/module2/save_mwmoutput.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed May 13 15:16:43 2020
@author: qiaojixu
"""
"""
Module discription:
--------------------
module to save all mwm adjacency output:
"""
def save_simple (WS1,WS2,... | StarcoderdataPython |
9797118 | # coding=utf-8
"""
Flask APP配置
app = Flask(__name__)
1. 直接设置
app.config['TESTING'] = True
某些配置值还转移到了 Flask 对象中,可以直接通过 Flask 来操作:
app.testing = True
一次更新多个配置值可以使用 dict.update() 方法:
app.config.update(
TESTING=True,
SECRET_KEY=b'aaa'
)
2. 通过对象加载
app.config.from_object('yourapplicatio... | StarcoderdataPython |
53403 | <filename>.ci/test_lint_doctests.py<gh_stars>0
# Pytest stub for running lint tests and doctests
# Running these checks through pytest allows us to report any errors in Junit format,
# which is posted directly on the PR
import os
import pathlib
import shutil
import subprocess
import textwrap
import pytest
def chec... | StarcoderdataPython |
6504664 | <reponame>Sab0tag3d/pyppeteer<gh_stars>1000+
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Utility functions."""
import gc
import socket
from typing import Dict, Optional
from pyppeteer.chromium_downloader import check_chromium, chromium_executable
from pyppeteer.chromium_downloader import download_chromium
__a... | StarcoderdataPython |
9750734 | <filename>smbus2/__main__.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ## #############################################################
# board.py
#
# Author: <NAME>
# Licence: MIT
# Date: 2020.03.01
#
# ## #############################################################
from . import smbus as smbus2
from .vi2... | StarcoderdataPython |
3314611 | <reponame>ItayGoren/fhir.resources<filename>fhir/resources/evidencevariable.py
# -*- coding: utf-8 -*-
"""
Profile: http://hl7.org/fhir/StructureDefinition/EvidenceVariable
Release: R4
Version: 4.0.1
Build ID: 9346c8cc45
Last updated: 2019-11-01T09:29:23.356+11:00
"""
from typing import Any, Dict
from typing import Lis... | StarcoderdataPython |
5190752 | from telegram.ext import Updater, CommandHandler, CallbackQueryHandler
import telegram
from Utils import Utils
import RuBot, BusBot, CalendarBot, CanteenBot, EventsBot, DateBot, DatabaseConnection
from conf.settings import telegramToken
import threading
ruBot = RuBot.RuBot()
canteenBot = CanteenBot.CanteenBot(... | StarcoderdataPython |
11366323 | <reponame>cclauss/confidant<gh_stars>1-10
import unittest
from mock import patch
from mock import Mock
from confidant import settings
from confidant.encrypted_settings import EncryptedSettings
class EncprytedSettingsTest(unittest.TestCase):
def test_register(self):
enc_set = EncryptedSettings(None)
... | StarcoderdataPython |
11249022 | <reponame>WorkShoft/python-developer-delectatech
from .baserepository import BaseRepo
from restaurants.services import get_mongo_client
class MongoRestaurantRepo(BaseRepo):
client = get_mongo_client()
db = client.python_developer_db
collection = db.segment_collection
def _query(self, params={}, first... | StarcoderdataPython |
1886020 | import re
import json
import asyncio
import websockets
from slacker import Slacker
from conf import *
from dust import Dust
slack = Slacker(TOKEN)
response = slack.rtm.start()
sock_endpoint = response.body['url']
# Send message to slack channel
def extract_message(channel, msg):
cmd = msg.split(' ')
if CMD... | StarcoderdataPython |
5107986 | <filename>nexus/pylon/sources/libgen_doi.py
import re
from typing import AsyncIterable
from library.logging import error_log
from nexus.pylon.exceptions import RegexNotFoundError
from .base import (
DoiSource,
PreparedRequest,
)
class LibgenDoiSource(DoiSource):
base_url = 'http://libgen.gs'
resolve... | StarcoderdataPython |
11315956 | from ..imports.qt import QtCore, pyqtSignal, pyqtSlot
from ..imports.openpose import OPENPOSE_LOADED, OPENPOSE_MODELS_PATH
if OPENPOSE_LOADED:
from ..imports.openpose import op
import cv2
import numpy as np
def getLengthLimb(data, keypoint1: int, keypoint2: int):
if data[keypoint1, 2] > 0.0 and data[keypoint... | StarcoderdataPython |
5118662 | from .pcan import CanBus, CanFdBus
| StarcoderdataPython |
6519818 | <reponame>szrharrison/py-mkv<gh_stars>1-10
from typing import TypeVar
from lib.models.metadata.target_types import AudioTargetTypes, VideoTargetTypes, TargetTypesInt, TargetTypesStr
SimpleSubTags = TypeVar("SimpleSubTags", "TagName", "TagString", "TagDefault", "TagBinary")
TargetsSubTags = TypeVar("TargetsSubTags", "... | StarcoderdataPython |
1813157 | <filename>apitest/apiauto_testcase3.py
#coding:utf-8
import requests,time,sys,re
import urllib,zlib
import pymysql
import HtmlTestRunner
import unittest
from trace import CoverageResults
import json
from idlelib.rpc import response_queue
from time import sleep
#import fconfig
HOSTNAME = '127.0.0.1'
class ApiFlow(unit... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.