id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
1944175 | <gh_stars>0
import numpy as np
import tensorflow as tf
import argparse
import time
import os
import pdb
from lib.episode_generator import EpisodeGenerator
from lib.networks import ProtoNet
from config.loader import load_config
def parse_args():
parser = argparse.ArgumentParser(description='protonet')
parse... | StarcoderdataPython |
4827583 | # hexutil.py
"""Miscellaneous utility routines relating to hex and byte strings"""
# Copyright (c) 2008-2012 <NAME>
# This file is part of pydicom, released under a modified MIT license.
# See the file license.txt included with this distribution, also
# available at http://pydicom.googlecode.com
from binascii im... | StarcoderdataPython |
11372834 | <gh_stars>1-10
import ast
import json
def parser(json_file: str, is_training: bool) -> dict:
with open(json_file) as f:
parsed_data = {}
data = json.load(f)["data"]
answers = []
for entry in data:
title = entry["title"]
for para in entry["paragraphs"]:
... | StarcoderdataPython |
8082409 | <reponame>oskiw/RaspiSnake<gh_stars>1-10
from random import randint
from raspisnake.treats.apple import Apple
from raspisnake.treats.blueberry import Blueberry
from raspisnake.treats.lemon import Lemon
from raspisnake.treats.orange import Orange
from raspisnake.treats.plum import Plum
from raspisnake.treats.strawberry... | StarcoderdataPython |
5113829 | <reponame>afeld/api-snippets<filename>video/rest/compositions/get-completed-compositions/get-completed-compositions.6.x.py
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client
# Your Account Sid and Auth Token from twilio.com/console
api_key_sid = 'SKXXXX'
api_key_sec... | StarcoderdataPython |
3387232 | <reponame>nanjekyejoannah/pypy
"""
Tests for the PyPy cStringIO implementation.
"""
from cStringIO import StringIO
data = b"some bytes"
def test_reset():
"""
Test that the reset method of cStringIO objects sets the position
marker to the beginning of the stream.
"""
stream = StringIO()
stream.... | StarcoderdataPython |
119909 | <reponame>paulliwali/Basketball-Stats
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 27 21:28:13 2017
@author: paull
"""
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.ticker as mtick
# using ggplot styles
plt.style.use('ggplot')
# reading the analysis dataframe from csv
analysisDf = pd.read_... | StarcoderdataPython |
4906700 | <filename>pypodo/backup.py
"""
Pypodo scripts
"""
import os
import sys
import time
from shutil import copyfile
from pypodo.config import (
todofilefromconfig,
todobackupfolderfromconfig,
)
from pypodo.print import (
printinfo,
printerror,
)
def backup(openfile=open):
"""
Backup the todofile
... | StarcoderdataPython |
4979793 | <filename>src/pyramid_torque_engine/util.py
# -*- coding: utf-8 -*-
"""Utility functions."""
import logging
logger = logging.getLogger(__name__)
import collections
import inspect
import urllib
import zope.interface
class DeclaredNamespacedNamedTuple(object):
"""Instantiate one of these with a namespace. Call ``... | StarcoderdataPython |
3596401 | <filename>no0001_no1000/no_0455/solution.py<gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
solution.py
~~~~~~~~~~~~~~~~~~~~~~~
link:
https://leetcode.com/problems/assign-cookies/
solution:
贪心算法, 优先用小分量的食物满足食物分量要求小的小孩
:author: Nacht
:copyright: (c) 2022, <NAME>... | StarcoderdataPython |
76001 | <filename>gameDisplay.py
from tkinter import Tk, Canvas
from snakeGame import direction, SnakeGame
class GameDisplay:
def __init__(self, sg):
self.gameInstance = sg
self.snakeLayer = []
self.foodLayer = []
# initialize tkinter elements
self.root = Tk()
self.root.g... | StarcoderdataPython |
6583538 | <reponame>adamskrz/KivyMD<filename>kivymd/toast/__init__.py
from kivy.utils import platform
if platform == "android":
from .androidtoast import toast
else:
from .kivytoast import toast
| StarcoderdataPython |
80973 | <filename>research/inception/inception/imagenet_distributed_train.py
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www... | StarcoderdataPython |
4938110 | <gh_stars>0
# import libraries
from fastapi import APIRouter, Depends, status, BackgroundTasks, HTTPException, Request
from typing import Optional, List
from sqlalchemy.orm import Session
from decouple import config
import os
import json
from datetime import datetime
# include other functionality
from ..authentication ... | StarcoderdataPython |
3373819 | import numpy as np
import pandas as pd
np.random.seed(54)
df = pd.DataFrame(
{
"date": pd.date_range(start="2021-01-01", end="2021-07-01", freq="D"),
"var1": np.random.randint(low=100, high=500, size=182),
"var2": np.random.randint(low=100, high=500, size=182),
}
)
df.to_csv("data/ill... | StarcoderdataPython |
1910849 | <reponame>maxhenderson23/MODpy
import numpy as np
#Function to match hardest 2 jets with fastjet jets
def match_jets(ak5_hardest, ak5_second, fastjets):
""" Function to check fastjet generated 2 hardest jets, match the AK5 two hardest jets in (rap,phi) multiplicity and 4-vector to within 1MeV
Input 2 hardest A... | StarcoderdataPython |
6621104 | #!/usr/bin/env python3
import contextlib
import os
import subprocess
import sys
import time
from typing import cast, IO, Iterator, Optional
import click
from llvmlite import binding as llvm, ir
from kotlang.context import Context
class Emitter:
def __init__(self, optimization_level: Optional[int] = None) -> Non... | StarcoderdataPython |
6496842 | <gh_stars>100-1000
from symengine.utilities import raises
from symengine.lib.symengine_wrapper import (true, false, Eq, Ne, Ge, Gt, Le, Lt, Symbol,
I, And, Or, Not, Nand, Nor, Xor, Xnor, Piecewise,
Contains, Interval, FiniteSet, oo,... | StarcoderdataPython |
5009819 | #!/usr/bin/env python
from typing import Sequence
import pyro
import pyro.distributions as dist
import pyro.poutine as poutine
import torch
import torch.nn as nn
from drvish.models.modules import Encoder, NBDecoder
class MCVNBVAE(nn.Module):
r"""Variational auto-encoder model with negative binomial loss.
... | StarcoderdataPython |
1902121 | from rest_framework import serializers
from .models import Bread
class BreadSerializer(serializers.ModelSerializer):
class Meta:
model = Bread
fields = ("id", "name", "description", "bread_type") | StarcoderdataPython |
11361614 | import asyncio
import aioxmpp
from PyQt5 import QtWidgets
from PyQt5.QtCore import pyqtSignal, QObject
from aiosasl import AuthenticationFailure, SASLError
from aioxmpp import JID
from app import cache, Config
from app.modules import Muc
from app.modules.Muc import MucChat
from utils import Log
from app.modules.P2P im... | StarcoderdataPython |
3403965 | # Calculating with a formula
#Importing the module math
from math import sqrt,trunc
# Lets put the constants
h = 30
c = 50
#Receiving the sequence
d_list = str(input('Type a sequence of numbers: '))
d_list = d_list.split(',')
# List that will take the answer
answer = []
for d in d_list:
# Trying attribute a i... | StarcoderdataPython |
3258354 | <filename>Use_Cases/VPS_Popcorn_Production/Kubernetes/src/L0_PC_CPPS.py
import requests
import json
import time
import os
from Big_Data_Platform.Kubernetes.Kafka_Client.Confluent_Kafka_Python.src.classes.CKafkaPC import (
KafkaPC,
)
from Use_Cases.VPS_Popcorn_Production.Kubernetes.src.classes.caai_util import Obje... | StarcoderdataPython |
1610488 | # ---
# jupyter:
# jupytext:
# formats: ipynb,py:percent
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.13.7
# kernelspec:
# display_name: Python [conda env:bandit]
# language: python
# name: conda-env-bandit-p... | StarcoderdataPython |
12801113 | <gh_stars>0
"""
events/__init__.py
Declare main event dispatcher
"""
import logging
import json
import traceback
from events.attack import AttackManager
from events.trends import TrendsManager
from events.honeypot import HoneypotManager
LOGGER = logging.getLogger()
class Dispatcher(object):
"""docstring... | StarcoderdataPython |
1615448 | <reponame>metegenez/WAVEPAL
import numpy as np
from scipy.stats import chi2 as chi2distr
from scipy.stats import gamma as gammadistr
def white_noise_mcmc(alpha_gamma,beta_gamma,smoothing_length,nmcmc):
""" white_noise_mcmc generates chi-square samples, weigthed by a variance whose inverse follows a gamma distributio... | StarcoderdataPython |
6455440 | ###
# ============LICENSE_START=======================================================
# ORAN SMO PACKAGE - PYTHONSDK TESTS
# ================================================================================
# Copyright (C) 2021-2022 AT&T Intellectual Property. All rights
# reserved.
# ======... | StarcoderdataPython |
238763 | from django import forms
class ProfileForm(forms.Form):
first_name = forms.CharField(max_length=200,required=True)
last_name = forms.CharField(max_length=200,required=True)
email = forms.EmailField(required=True)
phone_number = forms.CharField(max_length=30,required=True)
gender = forms.ChoiceFiel... | StarcoderdataPython |
312686 | """Test different ways of passing options are interpreted correctly."""
import pytest
from sphinx_probs_rdf.directives import (
parse_composed_of,
parse_consumes_or_produces,
eval_amount,
expand_consumes_produces_amounts,
)
def test_parse_composed_of():
assert parse_composed_of("Child") == ["Chi... | StarcoderdataPython |
3243745 | VERSION = (0, 0, 10)
__version__ = '.'.join(map(str, VERSION))
| StarcoderdataPython |
1630689 | import copy
import datetime
import json
from json import JSONDecodeError
from logging import Logger
from typing import List
import peewee_async
from aiohttp import web
from common.excpetions import InvalidParameterError
from common.models import BaseModel
class BaseApiView(web.View):
kwarg_pk = "pk"
validat... | StarcoderdataPython |
11343507 | # NAME : Planina
# URL : https://open.kattis.com/problems/planina
# =============================================================================
# Simple problem.
# =============================================================================
import math
def main():
n = int(input())
to_raise = 3
for i... | StarcoderdataPython |
8064163 | from androguard.core.analysis.analysis import Analysis
from androguard.core.bytecodes.apk import APK
from androguard.core.bytecodes.dvm import DalvikVMFormat
from androguard.decompiler.decompiler import DecompilerDAD
d = DalvikVMFormat(APK("dosya"))
da = Analysis(d)
decompiler = DecompilerDAD(d,da)
d.set_d... | StarcoderdataPython |
1617339 | <reponame>clchiou/garage
import unittest
from g1.asyncs.bases import streams
from g1.asyncs.kernels import contexts
from g1.asyncs.kernels import errors
from g1.asyncs.kernels import kernels
class BytesStreamTest(unittest.TestCase):
def setUp(self):
self.s = streams.BytesStream()
self.k = kernel... | StarcoderdataPython |
6486589 | <reponame>ttjaden/openBatLib
import tools
import numpy as np
import scipy.io as sio
import numba as nb
from numba import types
from numba.typed import Dict
from numba import njit
import pandas as pd
import time
import datetime
import csv
from pyModbusTCP.client import ModbusClient
from pyModbusTCP import ut... | StarcoderdataPython |
1802296 | <filename>dgad/grpc/classifier_server.py
# type: ignore
import logging
import os
import random
import string
import time
from concurrent import futures
from importlib import resources
import grpc
import dgad.models
from dgad.classification import TCNClassifier
from dgad.grpc import classification_pb2, classification... | StarcoderdataPython |
8120334 | <gh_stars>1-10
from discord.http import Route
class _CustomRoute(Route):
"""
A route that allows for v9
"""
BASE = "https://discord.com/api/v9"
| StarcoderdataPython |
11370277 | # uncompyle6 version 2.9.10
# Python bytecode 2.7 (62211)
# Decompiled from: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10)
# [GCC 6.2.0 20161005]
# Embedded file name: tasking.py
import mcl_platform.tasking
from tasking_dsz import *
_fw = mcl_platform.tasking.GetFramework()
if _fw == 'dsz':
RPC_INFO_INSTALL = ds... | StarcoderdataPython |
11373860 | <gh_stars>0
def tokenizer(S):
return [x for x in S.strip().split(' ') if x]
| StarcoderdataPython |
3267624 | <gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib
import json
import better_spoken_numbers as bsn
from math import floor
from apcontent import alarmpi_content
class btc(alarmpi_content):
def build(self):
try:
coinbase_url = 'https://' + self.sconfig['host'] + self.sconfig['path']
... | StarcoderdataPython |
68289 | # -*- coding: utf-8 -*-
# 版权所有 2019 深圳米筐科技有限公司(下称“米筐科技”)
#
# 除非遵守当前许可,否则不得使用本软件。
#
# * 非商业用途(非商业用途指个人出于非商业目的使用本软件,或者高校、研究所等非营利机构出于教育、科研等目的使用本软件):
# 遵守 Apache License 2.0(下称“Apache 2.0 许可”),您可以在以下位置获得 Apache 2.0 许可的副本:http://www.apache.org/licenses/LICENSE-2.0。
# 除非法律有要求或以书面形式达成协议,否则本软件分发时需保持当前许可“原样”... | StarcoderdataPython |
3243387 | import json
import subprocess
from js_helper import _do_test_raw
from validator.errorbundler import ErrorBundle
import validator.testcases.scripting as scripting
import validator.testcases.javascript.spidermonkey as spidermonkey
from validator.errorbundler import ErrorBundle
def test_scripting_disabled():
"Ensure... | StarcoderdataPython |
9706090 | <filename>bin/ColorDecoder.py
from PIL import Image
im= Image.open("ntsc.png")
pix = im.load()
colorFile = open("colorsT.txt",'w')
counter = 0
for y in range(1,129,16):
for x in range(0,255,16):
colorFile.write("\ncase " + str(counter)+":"+"\n\t"+"pixels[i] = "+str(pix[x,y][0])+"; //r"+"\n\t"+"pi... | StarcoderdataPython |
3449870 | import random
import numpy as np
import math
def prod(lst):
p = 1
for i in lst:
p *= i
return p
def finite_diffs(xs, ordem, x0, f):
A = []
B = []
n = len(xs)
for i in range(n):
# para construir a matraiz A
A.append([0] * n)
for j in range(n):
A[i... | StarcoderdataPython |
1923714 | <reponame>cokelaer/biokit
"""Volcano plot"""
import numpy as np
import pylab
import pandas as pd
__all__ = ['Volcano']
class Volcano(object):
"""Volcano plot
In essence, just a scatter plot with annotations.
.. plot::
:width: 80%
:include-source:
import numpy as np
fc... | StarcoderdataPython |
11252697 | <filename>fuocore/__init__.py
from fuocore.models import ModelType # noqa
from fuocore.player import (
MpvPlayer,
State as PlayerState,
PlaybackMode,
Playlist,
) # noqa
from fuocore.live_lyric import LiveLyric # noqa
from .library import Library # noqa
__version__ = '2.3'
__all__ = [
'MpvPla... | StarcoderdataPython |
9757662 | # GENERATED VERSION FILE
# TIME: Sat Feb 13 07:17:43 2021
__version__ = '0.1.rc0+117a4d1'
short_version = '0.1.rc0'
| StarcoderdataPython |
1810605 | from detectem.plugin import Plugin
class ReactPlugin(Plugin):
name = 'react'
homepage = 'https://facebook.github.io/react/'
tags = ['javascript', 'react']
matchers = [
{'body': r' \* React v(?P<version>[0-9\.]+)'},
{'url': r'/react/(?P<version>[0-9\.]+)/react(-with-addons)?(\.min)?\.j... | StarcoderdataPython |
4952220 | from json import dumps
from requests import get, post
import time
import logging
import os
import re
import json
from urllib.request import Request, urlopen
headers = {
'Content-Type': 'application/json',
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chr... | StarcoderdataPython |
144637 | import functools
import os
from sys import platform
from typing import Dict
from PyQt5 import QtCore, QtWidgets
from PyQt5.QtCore import Qt, QModelIndex
from PyQt5.QtGui import QPaintEvent, QPainter, QCursor, QIcon
from PyQt5.QtWidgets import QWidget, QPushButton, QVBoxLayout, QHBoxLayout, QComboBox, QListWidget, QAct... | StarcoderdataPython |
1901334 | <gh_stars>0
#!/usr/bin/env python
import os
import sys
import boto3
IMAGE_COMMIT_TAG = os.getenv('IMAGE_COMMIT_TAG')
session = boto3.session.Session()
s3 = session.resource('s3')
with open(sys.argv[1], 'rb') as data:
s3.Bucket('ossci-windows-build').put_object(Key='pytorch/' + IMAGE_COMMIT_TAG + '.7z', Body=data... | StarcoderdataPython |
3277647 | # tests/test_bitstream.py
import pytest
import requests
from dspace.bitstream import Bitstream
from dspace.errors import MissingFilePathError, MissingIdentifierError
from dspace.item import Item, MetadataEntry
def test_bitstream_delete(my_vcr, vcr_env, test_client, test_file_path_01):
with my_vcr.use_cassette(
... | StarcoderdataPython |
3322092 | <gh_stars>0
""" 63 - Escreva um programa que leia um número N inteiro qualquer e mostre na tela os N primeiros elementos de uma
sequência de Fibonacci.
Exemplo: 0 - 1 - 1 - 2 - 3 - 5 - 8 - 13"""
# Minha resposta:
print('-' * 59)
print(f"{'Sequência de Fibonacci':^50}")
print('-' * 59)
n = int(input('Quantos termos voc... | StarcoderdataPython |
11367673 | # Generated by Django 2.0.1 on 2018-02-06 17:20
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('classy', '0006_classification_creation_date'),
]
operations = [
migrations.AddField(
model_name='classification',
na... | StarcoderdataPython |
8114230 | #!/usr/bin/env python3
"""
Solve Example 16.4 of [1]_.
References
----------
.. [1] <NAME> and <NAME>. Numerical Optimization. Second. Springer
Ser. Oper. Res. Financ. Eng. New York, NY, US: Springer, 2006.
"""
import numpy as np
from cobyqa import minimize
np.set_printoptions(precision=4, suppress=True)
def q... | StarcoderdataPython |
1816344 | <reponame>Uberi/The-Mippits
#!/usr/bin/env python3
import sys, getopt
import mippits
def breakpoint_prompt():
print("[DEBUGGER] Program hit breakpoint at {:=#010x}".format(mips.PC))
while True:
try: values = input("[DEBUGGER] Enter a debugger command (or \"help\" for options): ").strip().split(maxspl... | StarcoderdataPython |
1844751 | <filename>Pattern_Generator.py
import numpy as np
import json, os, time, pickle, librosa, re, argparse
from concurrent.futures import ThreadPoolExecutor as PE
from collections import deque
from threading import Thread
from random import shuffle
from Audio import melspectrogram, spectrogram, preemphasis, inv_preemphasi... | StarcoderdataPython |
73472 | <reponame>ds-wook/BOJ
def solution(board, moves):
basket = []
answer = 0
for move in moves:
for row in board:
if row[move - 1] != 0:
basket.append(row[move - 1])
row[move - 1] = 0
if len(basket) >= 2 and basket[-1] == basket[-2]:
... | StarcoderdataPython |
1946888 | # Generated by Django 2.0 on 2017-12-16 03:26
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('devices', '0004_auto_20171216_0318'),
]
operations = [
migrations.RenameField(
model_name='client',
old_name='clientipadd',
... | StarcoderdataPython |
11337668 | <gh_stars>1-10
import os
import unittest
from ....BaseTestCase import BaseTestCase
from centipede.Crawler import Crawler
from centipede.PathHolder import PathHolder
from centipede.Crawler.Fs.Render import NukeRender
class NukeRenderTest(BaseTestCase):
"""Test NukeRender crawler."""
__exrFile = os.path.join(Ba... | StarcoderdataPython |
1715040 | <reponame>evestidor/svc-stock-manager<filename>src/operations/update_stock_price.py
from src import interfaces
from src.domain import Stock
class UpdateStockPriceOperation(interfaces.Operation):
def __init__(self, storage: interfaces.StockStorage):
self._storage = storage
def execute(self, symbol: s... | StarcoderdataPython |
11315310 | '''
New Integration Test for 2 normal accounts to operate VM
@author: Youyk
'''
import zstackwoodpecker.operations.account_operations as acc_ops
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker... | StarcoderdataPython |
9793474 | <reponame>semeniuta/EPypes
import zmq
from threading import Thread
from epypes.loop import CommonEventLoop
class ZeroMQSubscriber(Thread):
def __init__(self, server_address, q, sub_prefix=''):
self._context = zmq.Context()
self._socket = self._context.socket(zmq.SUB)
self._socket.connect... | StarcoderdataPython |
4810678 | import torch
import numpy as np
from mmdet.utils import get_root_logger
from .builder import DATASETS
class RandomDataStream:
def __init__(self, data, generator, shuffle=True, dtype=torch.int32):
self._size = len(data)
self.data = torch.Tensor(data).to(dtype=dtype)
self._shuffle = shuffle
... | StarcoderdataPython |
9758429 | #!/usr/bin/env python
import urllib
import re
print "To get IP Adress we will run this"
url = "http://checkip.dyndns.org"
print url
request = urllib.urlopen(url).read()
IpAddress = re.findall(r"\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b",request)
print "My IP -Address is =>",IpAddress
| StarcoderdataPython |
6703146 | from matplotlib import pyplot as plt
plt.plot([1, 2], [1, 2]) | StarcoderdataPython |
3205557 | from django.http import HttpResponseRedirect
from django.shortcuts import render
from .forms import NicknameForm
from core.models import ChatMessage, ChatUser
def index(request):
if request.method == 'POST':
form = NicknameForm(request.POST)
if form.is_valid():
print('valid')
... | StarcoderdataPython |
3327152 | # Copyright 2019 <NAME>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import _, models
from odoo.exceptions import UserError
from odoo.tools.safe_eval import safe_eval
class TierValidation(models.AbstractModel):
_inherit = "tier.validation"
def evaluate_formula_tier(self, tier):
... | StarcoderdataPython |
3451335 | # -*- coding:utf-8 -*-
#
# time: 23:22
# date: 2020-07-07
# description: test Description on this line
# author: untitled
# import pyModule
# import sys
# import os
# import 3rd-part Moudle
# sys.path.append( os.path.split( os.path.realpath(__file__) )[0] + '' )
# import usrModule
| StarcoderdataPython |
1955240 | import argparse
from solvers.cs import solveCS
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='solve compressive sensing')
parser.add_argument('-prior',type=str,help='choose with prior to use glow, dcgan, wavelet, dct', default='glow')
parser.add_argument('-denoiser', type=str, he... | StarcoderdataPython |
4833660 | <filename>0821 Shortest Distance to a Character.py
'''
URL: https://leetcode.com/problems/shortest-distance-to-a-character/
Difficulty: Easy
Description: Shortest Distance to a Character
Given a string S and a character C, return an array of integers representing the shortest distance from the character C in the str... | StarcoderdataPython |
8020885 | import requests
import datetime
import config
from utils import logger, play_sound
import time
headers_dict = {
'dnt': '1',
'origin': 'https://www.cowin.gov.in',
'referer': 'https://www.cowin.gov.in/',
'sec-fetch-dest': 'empty',
'sec-fetch-mode': 'cors',
'sec-fetch-site': 'cross-site',
'use... | StarcoderdataPython |
6546180 | import time, ast
import json, requests
from bs4 import BeautifulSoup
from urllib.request import Request, urlopen
from urllib import parse
WEBHOOK_ADDRESS="<YOUR DISCORD WEBHOOK ADDRESS>"
def parse_info():
session = requests.Session()
req = "http://ncov.mohw.go.kr/index_main.jsp"
res = session.get(req)
time.s... | StarcoderdataPython |
8068917 | <gh_stars>0
from PyQt5.QtWidgets import *
from matplotlib.backends.backend_qt5agg import FigureCanvas
from matplotlib.figure import Figure
from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolbar
class MplWidget(QWidget):
def __init__(self, parent=None):
QWidget.__init__(... | StarcoderdataPython |
1804503 | <filename>Final_Code_Set/weatherstation.py
from matrix import *
import LED_display as LD
import threading
import stt
from urllib.request import urlopen, Request
import urllib
import bs4
import time
import requests
import copy
import list_set
import weathertts
t=threading.Thread(target=LD.main, args=... | StarcoderdataPython |
6571025 | """The Z-Wave-Me WS integration."""
import logging
from zwave_me_ws import ZWaveMe, ZWaveMeData
from homeassistant.helpers.entity import Entity
from .const import (
DOMAIN,
PLATFORMS,
ZWAVEPLATFORMS,
)
from homeassistant.helpers.dispatcher import dispatcher_send, async_dispatcher_connect
from homeassistan... | StarcoderdataPython |
6516713 | n = int(input())
A = set(map(int,input().split()))
N = int(input())
for _ in range(N):
take = input().split()
set_take = set(map(int,input().split()))
if take[0] == "intersection_update":
A.intersection_update(set_take)
elif take[0] == "update":
A.update(set_take)
elif take[0] == "sy... | StarcoderdataPython |
371278 | #!/usr/bin/env python
# -- coding: utf-8--
from celery import Celery
# CELERY_BROKER_URL = 'redis://localhost:6379/9'#flask-celery=2.4.3
# CELERY_RESULT_BACKEND = 'redis://localhost:6379/9'
# app.config['CELERY_BROKER_URL'] = CELERY_BROKER_URL
# app.config['CELERY_RESULT_BACKEND'] = CELERY_RESULT_BACKEND
class Cel... | StarcoderdataPython |
6698823 | <reponame>firehose-dataset/congrad
import os
from nltk.tokenize import TweetTokenizer
from collections import Counter, OrderedDict
import torch
import sentencepiece as spm
from tqdm import tqdm
TOKENIZER = TweetTokenizer()
SPIECE_UNDERLINE = '▁'
def _tokenize(text):
return TOKENIZER.tokenize(text)
def _is_star... | StarcoderdataPython |
8124828 | <filename>small_projects/spiro/drawCircleTurtle.py
import math
import turtle
# 画圆的函数 x,y为坐标,r为圆的半径
def drawCirleTurtle(x,y,r):
# move to the start of circle
turtle.up()
turtle.setpos(x + r, y)
turtle.down()
# draw the circle
for i in range(0, 361):
print(i)
a = math.radians(i)... | StarcoderdataPython |
9649368 | <gh_stars>1-10
import ujson
from zerver.lib.actions import do_add_alert_words, do_remove_alert_words
from zerver.lib.alert_words import alert_words_in_realm, user_alert_words
from zerver.lib.test_classes import ZulipTestCase
from zerver.lib.test_helpers import most_recent_message, most_recent_usermessage
from zerver.m... | StarcoderdataPython |
6538674 | <gh_stars>0
import pandas as pd
country_df = pd.read_csv('../data/country.csv')
language_df = pd.read_csv('../data/country_list.csv', encoding='ISO-8859-1')
merged_df = pd.merge(country_df, language_df, how='inner', left_on='name', right_on='country_name')
merged_df = merged_df.reset_index(drop=True).drop(['ID', 'nam... | StarcoderdataPython |
1913072 | <gh_stars>1-10
from matrix import*
from original import*
from LED_display import*
scoreBlk = [[0, 0, 0, 0, 0, 0, 0, 0, 0], #scoreBlk초기화
[0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0,... | StarcoderdataPython |
1653455 | <filename>sailor/assetcentral/indicators.py
"""
Indicators module can be used to retrieve Indicator information from AssetCentral.
Classes are provided for individual Indicators as well as groups of Indicators (IndicatorSet).
Note that the indicators here represent 'materialized' indicators, i.e. indicators attached t... | StarcoderdataPython |
3588503 | #!/usr/bin/env python
# ----------------------------------------------------------------------------
# Copyright 2016 Nervana Systems 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
#
# ... | StarcoderdataPython |
1965557 | # -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import glob
import json, csv
import wave
from PIL import Image
from scipy import fromstring, int16
import struct
# keras系
from keras import models
from keras import layers
from keras.layers import Input,merge
from keras.la... | StarcoderdataPython |
11320842 | import unittest
from pypermissions.permission import Permission, DynamicPermission
from pypermissions.templates import PermissionTemplate
from pypermissions.factory import PermissionFactory
class TestLessThanPermission(DynamicPermission):
templates = [PermissionTemplate(form="test.hello.!")]
def __init__(se... | StarcoderdataPython |
11376132 | # Copyright 2018 The TensorFlow 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 applica... | StarcoderdataPython |
8080850 | import urllib
import urllib.parse
import re
# from urllib.parse import urlparse, parse_qs
import mwparserfromhell
import requests
def one_page(conf_url):
parsed = urllib.parse.urlparse(conf_url)
www = "{scheme}://{netloc}".format(scheme=parsed.scheme, netloc=parsed.netloc)
url = www + "/w/api.php"
... | StarcoderdataPython |
9611715 | <gh_stars>1-10
"""Management command to setup courseware index pages"""
from django.core.management.base import BaseCommand
from cms.api import ensure_index_pages
class Command(BaseCommand):
"""Creates courseware index pages and moves the existing courseware pages under the index pages"""
help = __doc__
... | StarcoderdataPython |
3266412 | <reponame>xtinkt/hivemind
import threading
import time
from ..dht import DHTNode
class DHTHandlerThread(threading.Thread):
def __init__(self, experts, dht: DHTNode,
update_period: int = 5, addr: str = '127.0.0.1', port: int = 8080):
super(DHTHandlerThread, self).__init__()
self.p... | StarcoderdataPython |
3269694 | from schematics import Model
from schematics.types import StringType, ModelType
class LaunchConfiguration(Model):
arn = StringType()
name = StringType()
class LaunchTemplate(Model):
launch_template_id = StringType(deserialize_from='LaunchTemplateId')
name = StringType(deserialize_from='LaunchTemplat... | StarcoderdataPython |
6576031 | """
sentry.plugins.bases.notify
~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from django import forms
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
from sent... | StarcoderdataPython |
4881211 | <reponame>dpopadic/arpmRes
# -*- coding: utf-8 -*-
import numpy as np
def sector_select(sectors, sect):
"""For details, see here.
Parameters
----------
sectors : string array
sect : string array
Returns
-------
index : array
"""
a = sect == sectors
index =... | StarcoderdataPython |
98303 | #
# Copyright (c) 2016 Juniper Networks, Inc. All rights reserved.
#
from vnc_api.vnc_api import *
from kube_manager.vnc.config_db import *
import uuid
LOG = logging.getLogger(__name__)
class ServiceLbManager(object):
def __init__(self, vnc_lib=None, logger=None):
self._vnc_lib = vnc_lib
self.l... | StarcoderdataPython |
3373977 | <reponame>gottaegbert/penter
"""
===========
Zorder Demo
===========
The drawing order of artists is determined by their ``zorder`` attribute, which
is a floating point number. Artists with higher ``zorder`` are drawn on top.
You can change the order for individual artists by setting their ``zorder``.
The default valu... | StarcoderdataPython |
3316545 | import base64
import bcrypt
import json
import pika
import requests
import urllib
import urlparse
import yaml
def make_auth(credsfile_path):
with open(credsfile_path, 'r') as credsfile:
return yaml.load(credsfile)
def make_settings(settingsfile_path):
with open(settingsfile_path, 'r') as settingsfile:... | StarcoderdataPython |
1612894 | # Copyright (C) 2017 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""Tests for functions inside import_helper module.
"""
import unittest
import copy
import random
from ggrc import app # noqa - this is neede for imports to work
from ggrc.converters import import_helper
... | StarcoderdataPython |
8060043 | <reponame>Builditluc/kkst-bot
from nextcord.ext import commands
__all__ = ["Cog"]
class Cog(commands.Cog):
def __init__(self, name: str, bot: commands.Bot):
self.name = name
self.bot = bot
def setup(self):
self.bot.add_cog(self, override=True)
| StarcoderdataPython |
346893 | <gh_stars>0
class Solution:
def findDisappearedNumbers(self, nums: List[int]) -> List[int]:
res = []
num_set = set(nums)
for i in range(1,len(nums)+1):
if i not in num_set:
res.append(i)
return res
| StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.