id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
199697 | <filename>tests/orbit/models/test_ktrlite.py
import pytest
import numpy as np
import pandas as pd
from orbit.estimators.stan_estimator import StanEstimatorMAP
from orbit.models.ktrlite import KTRLiteMAP
from orbit.diagnostics.metrics import smape
SMAPE_TOLERANCE = 0.5
@pytest.mark.parametrize(
"seasonality_fs_o... | StarcoderdataPython |
3304261 | <reponame>chrisconlon/DiversionReplication
"""
Goal: Run many Nevo cases, save results to a dict
to access these results later
"""
import pyblp
import numpy as np
import pandas as pd
import pathlib
main_dir = pathlib.Path.cwd().parent
data_dir = main_dir / 'data'
dict_dir = data_dir / 'dict'
raw_dir = data_dir / 'ra... | StarcoderdataPython |
82741 | '''
lab2
'''
#3.1
my_name = 'Tom'
print(my_name.upper())
#3.
my_id = 123
print(my_id)
#3.3
#123=my_id
my_id=your_id=123
print(my_id)
print(your_id)
#3.4
my_id_str = '123'
print(my_id_str)
#3.5
#print(my_name=my_id)
#3.6
print(my_name+my_id_str)
#3.7
print(my_name*3)
#3.8
print('hello, world. This is my first... | StarcoderdataPython |
3381038 | <reponame>bpneumann/django-raster
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('raster', '0009_rasterlayer_max_zoom'),
]
operations = [
migrations.AlterField(
... | StarcoderdataPython |
3289179 | <reponame>Okamille/mne-python<filename>conftest.py<gh_stars>0
# -*- coding: utf-8 -*-
# Author: <NAME> <<EMAIL>>
#
# License: BSD (3-clause)
import pytest
import warnings
# For some unknown reason, on Travis-xenial there are segfaults caused on
# the line pytest -> pdb.Pdb.__init__ -> "import readline". Forcing an
# i... | StarcoderdataPython |
1684449 | <gh_stars>1-10
import math
import string
def change(s, j, c):
return s[:j] + c + s[j + 1:]
def check(b, a, n, m):
for i in range(n):
count = 0
for j in range(m):
if b[i][j] != a[j]:
count += 1
if count > 1:
return 0
return 1
def s... | StarcoderdataPython |
4836156 | <filename>openerp/addons/l10n_in_hr_payroll/report/payslip_report.py
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2012-Today OpenERP SA (<http://www.openerp.com>).
#
# This program is free sof... | StarcoderdataPython |
1740127 | <gh_stars>0
import warnings
import numpy as np
# Scipy
try:
from scipy.spatial import ConvexHull
except:
warnings.warn("You don't have scipy package installed. You may get error while using some feautures.")
# Pypolycontain
try:
import pypolycontain as pp
except:
warnings.warn("You don't have pypol... | StarcoderdataPython |
3344031 | # -*- coding: utf-8 -*-
# Copyright (c) Vispy Development Team. All Rights Reserved.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
"""
Circular Layout
===============
This module contains several graph layouts which rely heavily on circles.
"""
import numpy as np
from ..util import _strai... | StarcoderdataPython |
1745364 | import random
import torch
import torch.nn as nn
from nntools.nnet import register_loss
class MultiLabelSoftBinaryCrossEntropy(nn.Module):
def __init__(self, smooth_factor: float = 0, weighted: bool = True,
mcb: bool = False, hp_lambda: int = 10,
epsilon: float = 0.1, logits=Tru... | StarcoderdataPython |
1714753 | """
Video Classification with Channel-Separated Convolutional Networks
ICCV 2019, https://arxiv.org/abs/1904.02811
Large-scale weakly-supervised pre-training for video action recognition
CVPR 2019, https://arxiv.org/abs/1905.00561
"""
# pylint: disable=missing-function-docstring, missing-class-docstring
import torch
im... | StarcoderdataPython |
1793401 | import config
import logging
import sys
from telegram.ext import Updater
updater = None
logger = logging.getLogger('bot')
if config.MODE == "dev":
def run(updater):
updater.start_polling()
elif config.MODE == "prod":
def run(updater):
updater.start_webhook(listen="0.0.0.0", port=config.PORT, u... | StarcoderdataPython |
3230863 | import matplotlib as mpl
import numpy as np
from polaris2.geomvis import utilmpl
from matplotlib.transforms import Bbox
# Model R2toC2 in the most general case
class xy:
def __init__(self, data, circle=False, title='', xlabel='', toplabel='',
bottomlabel='', colormax=None, fov=1, plotfov=1):
... | StarcoderdataPython |
3367288 | # from ..RoutesTable.routesTable import RoutesTable
from ..Status.status import QueryCode
class Packet(object):
# header format: {codeType: xxx, }
# body format: {value: xxx}
def __init__(self, *args):
if len(args) >= 1 and isinstance(args[0], dict) and 'codeType' in args[0]:
self.__he... | StarcoderdataPython |
3265659 | <filename>tests/test_htmljux.py
import io
import re
import jinja2
import os.path
import logging
import operator
import tempfile
from argparse import Namespace
from unittest import TestCase
from _common import redaction
from shelltools import htmljux
from operator import itemgetter
_log = logging.getLogger(__name__)
... | StarcoderdataPython |
3214744 | from functools import reduce
from typing import Optional, Iterable
class Calc:
def __init__(self, ext_obj=None):
if ext_obj:
# print('Connecting...')
self.external_object = ext_obj
self.external_object.connect()
# print('End connection...')
def add(self... | StarcoderdataPython |
1689042 | # unittest file for sampling of rotation space SO(3)
import sys
sys.path.append('../')
import pyEMsoft
import numpy as np
import unittest
from random import randint
class Test_SO3(unittest.TestCase):
def setUp(self):
pass
def test_01_IsinsideFZ(self):
# default integer seed vector
... | StarcoderdataPython |
3326662 | """
This example demonstrates TACS structural optimization capabilities.
The beam model that we will be using for this problem is a rectangular beam,
cantilevered, with a shear load applied at the tip. The beam is discretized using
1001 shell elements along it's span and depth.
The optimization problem is as follows:
... | StarcoderdataPython |
22830 | <reponame>alexk307/server-exercise<gh_stars>0
from requests import post
from random import randrange
from uuid import uuid4
import base64
import json
PORT = 6789
MAX_SIZE_UDP = 65535
HEADER_SIZE = 12
NUM_TRANSACTIONS = 10
SERVER = 'http://localhost:1234/add'
def main():
for i in range(NUM_TRANSACTIONS):
... | StarcoderdataPython |
3303697 | """
given an integer, write a function to determine if it is a power of two
"""
def is_power_of_two(n):
"""
:type n: int
:rtype: bool
"""
return n > 0 and not n & (n - 1)
| StarcoderdataPython |
137699 | <reponame>wull566/tensorflow_demo
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import logging
import os
import sys
import multiprocessing
from gensim.models import Word2Vec
from gensim.models.word2vec import LineSentence
if __name__ == '__main__':
program = os.path.basename(sys.argv[0])
logger = logging.get... | StarcoderdataPython |
3247123 | import torch
import torch.nn as nn
from src.utils import ScaleNorm, LayerNorm
class Generator(nn.Module):
def __init__(self, d_model, aggregation_type='mean', n_output=1, n_layers=1,
leaky_relu_slope=0.01, dropout=0.0, scale_norm=False):
super(Generator, self).__init__()
if n_lay... | StarcoderdataPython |
142007 | <reponame>zembrodt/story-generation<gh_stars>1-10
# encoder.py
import torch
import torch.nn as nn
######################################################################
# The Encoder
# -----------
#
# The encoder of a seq2seq network is a RNN that outputs some value for
# every word from the input sentence. For every... | StarcoderdataPython |
1626598 | # -*- coding: utf-8 -*-
"""
Created on Thu Mar 10 15:31:17 2016
Last update on Saturday 17 March 2018
@author: michielstock
Kruskal's algorithm for finding the maximum spanning tree
"""
from union_set_forest import USF
import heapq
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
blue ... | StarcoderdataPython |
3338634 | <filename>xrpc_tests/serde/test_generic.py
from typing import TypeVar, Generic
from dataclasses import dataclass
from xrpc.const import SERVER_SERDE_INST
from xrpc.serde.abstract import SerdeSet
from xrpc.serde.error import SerdeException
from xrpc.serde.types import CallableArgsWrapper, CallableRetWrapper
from xrpc_... | StarcoderdataPython |
3273722 | <gh_stars>100-1000
"""
Spokestack-Lite Speech Synthesizer
This module contains the SpeechSynthesizer class used to convert text to speech
using local TTS models trained on the Spokestack platform. A SpeechSynthesizer
instance can be passed to the TextToSpeechManager for playback.
Example:
This example assumes tha... | StarcoderdataPython |
3201071 | <gh_stars>1-10
import pathlib
import os
from typing import TextIO
from .gen.KoiParser import KoiParser
from .gen.KoiListener import KoiListener
from .sanitize import type_to_c, extract_name, extract_comparisons, extract_paramaters
class KoiTranspiler(KoiListener):
def __init__(self, file: TextIO = None, transpi... | StarcoderdataPython |
1799946 | <filename>nairaland/nairaland.py
from bs4 import BeautifulSoup
import dateparser
import requests
import lxml
class Nairaland:
def __init__(self, browser):
self.BASE_URL = "https://nairaland.com"
self.browser = browser
def front_page_topics(self):
soup = BeautifulSoup(requests.get(self... | StarcoderdataPython |
3219581 | #!/usr/bin/env python3
"""
blockchain_db_server.py - BlockchainDB Server
Author: <NAME> (<EMAIL>)
Date: 12/5/2017
"""
from flask import Flask, jsonify, render_template
from uuid import uuid4
from random import randint
import random
from blockchain_db import BlockchainDB
app = Flask(__name__)
blockchain_db_manag... | StarcoderdataPython |
128410 | def first_last(full_name):
first_name = ''
last_name = ''
has_been_a_space = False
for letter in full_name:
if letter == ' ':
has_been_a_space = True
elif has_been_a_space:
last_name = last_name + letter
else:
first_name = first_name + letter
... | StarcoderdataPython |
3261897 | """adding valuable tokens to article
Revision ID: <KEY>
Revises: <PASSWORD>
Create Date: 2017-05-10 16:13:43.117796
"""
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = '<PASSWORD>'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
def upgrade():
... | StarcoderdataPython |
3271539 | <filename>BrAinPI/old/test_mem_tiff.py
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 2 21:16:30 2022
@author: alpha
"""
import io
from skimage import img_as_uint
import numpy as np
import tifffile as tf
import tempfile
image = np.random.random((10,10))
image = img_as_uint(image)
img_ram = io.BytesIO()
tf.imwrite... | StarcoderdataPython |
3252055 | # NEW
load("@bazel_tools//tools/build_defs/cc:action_names.bzl", "ACTION_NAMES")
# NEW
load(
"@bazel_tools//tools/cpp:cc_toolchain_config_lib.bzl",
"artifact_name_pattern",
"feature",
"flag_group",
"flag_set",
"tool_path",
)
def mingw_directories(mingw_version):
return [
... | StarcoderdataPython |
129114 | # from . import quantities
# from . import numpy_attributes
| StarcoderdataPython |
3246791 | <reponame>scottviteri/verified-betrfs
#!/usr/bin/env python3
# Copyright 2018-2021 VMware, Inc., Microsoft Inc., Carnegie Mellon University, ETH Zurich, and University of Washington
# SPDX-License-Identifier: BSD-2-Clause
import os
import shutil
import subprocess
import sys
def callOrDie(*kargs):
rc = subproces... | StarcoderdataPython |
3281277 | <gh_stars>0
from __future__ import print_function
import datetime
import email.message
import os
import random
import sys
import unittest
from contextlib import AbstractContextManager, contextmanager
from http.server import BaseHTTPRequestHandler, HTTPServer, SimpleHTTPRequestHandler
from pathlib import PurePath, Pure... | StarcoderdataPython |
1721502 | from __future__ import annotations
from spark_auto_mapper_fhir.fhir_types.uri import FhirUri
from spark_auto_mapper_fhir.value_sets.generic_type import GenericTypeCode
from spark_auto_mapper.type_definitions.defined_types import AutoMapperTextInputType
# This file is auto-generated by generate_classes so do not edi... | StarcoderdataPython |
3229667 | <reponame>perellonieto/background_check
from __future__ import division
import numpy as np
import matplotlib.pyplot as plt
from sklearn.metrics import auc
import warnings
class AbstainGainCurve:
"""This class represents an Abstain-gain (AG) curve. An object of class
AbstainGainCurve is built based on the resu... | StarcoderdataPython |
3327477 | <filename>ClassifyAllSites.py
import sys
import torch
import matplotlib.pyplot as plt
#from metalsiteprediction.ConvRecurrent.utils import getTestLoader, get_model
#from metalsiteprediction.ConvRecurrent.utils import getIronLoader, iron_path
#from metalsiteprediction.ConvRecurrent.trainer import predict, estimate
#from... | StarcoderdataPython |
73242 | #!/usr/bin/env python
import numpy as np
import cv2
def findCenterOfTarget(dst):
return np.mean(dst, axis=0)
# def kaze_match(im1_path, im2_path):
def kaze_match(img1, img2):
if img1.shape[2] == 1:
gray1 = cv2.cvtColor(img1, cv2.COLOR_BGR2GRAY)
gray2 = cv2.cvtColor(img2, cv2.COLOR_BGR2GRAY)
... | StarcoderdataPython |
101667 | <reponame>pixelfelon/binho-python-package
import os
import enum
import threading
import queue
import signal
import sys
import serial
SERIAL_TIMEOUT = 0.5
class SerialPortManager(threading.Thread):
serialPort = None
txdQueue = None
rxdQueue = None
intQueue = None
stopper = None
inBridgeMode =... | StarcoderdataPython |
8430 | <reponame>gene1wood/django-product-details<filename>product_details/utils.py
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from product_details import settings_defaults
def settings_fallback(key):
"""Grab user-defined settings, or fall back to default."""
try:
... | StarcoderdataPython |
3315415 | <reponame>dougli1sqrd/agr_literature_service<filename>non_pr_tests/pydantic/config.py
from typing import Set
import inspect
from pydantic import (
BaseModel,
BaseSettings,
Field
)
from os import environ
from literature.schemas import EnvStateSchema
class SubModel(BaseModel):
foo = 'bar'
apple = 1... | StarcoderdataPython |
3355029 | import os
import sys
import json
import yaml
import pandas as pd
from ananke.graphs import ADMG
from networkx import DiGraph
from optparse import OptionParser
sys.path.append(os.getcwd())
sys.path.append('/root')
from src.causal_model import CausalModel
from src.generate_params import GenerateParams
def config_optio... | StarcoderdataPython |
4458 | # MIT LICENSE
#
# Copyright 1997 - 2020 by IXIA Keysight
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify,... | StarcoderdataPython |
1689501 | import os
import unittest
from vsi.tools.dir_util import (
find_file_in_path, is_subdir
)
from vsi.test.utils import TestCase
class DirTest(TestCase):
pass
class FindFileInPath(DirTest):
def test_path_argument(self):
# Empty lists
self.assertIsNone(find_file_in_path('foo.txt', ''))
self.assertIsNo... | StarcoderdataPython |
3277144 | <reponame>GerdED/football<filename>experiment.py
trial...
| StarcoderdataPython |
4822772 | # Collect weather data for predetermined cities
# these are the corresponding cities with:
# - wind
# - solar
# - weather data exists on openweather api
import json
import requests
import pandas as pd
from time import time, sleep
from datetime import datetime
def writeData(title,timetext,data):
histfile = f'{t... | StarcoderdataPython |
80732 | # pylint: disable=missing-docstring
from distutils.core import setup
setup(
name='noticast-iot-core',
version='0.1-dev',
packages=['noticast'],
install_requires=['AWSIoTPythonSDK', 'requests', 'raven'])
| StarcoderdataPython |
144935 | <reponame>chul0721/deliverables_presentation
from urllib.parse import quote
import requests
import json
import random
import time
boongi = input() # 분기를 입력받는 코드
encoding = quote(boongi)
header = {'laftel' : 'TeJava'}
laftel_API = 'https://laftel.net/api/search/v1/discover/?years=' + str(encoding)
ne... | StarcoderdataPython |
3389777 | <reponame>Wayne2Wang/Pytorch-minModel
import os
import time
from tqdm import tqdm
import matplotlib.pyplot as plt
import torch
import torch.nn as nn
import torch.optim as optim
import torchvision
import torchvision.datasets as datasets
from torch.utils.data import DataLoader
from torchvision import transforms
from tor... | StarcoderdataPython |
3212420 | def get_diagonale_code(grid: str) -> str:
flag=True
temp=grid.split("\n")
for i,j in enumerate(temp):
temp[i]=j.split()
res=""
x=0
y=0
while True:
try:
res+=temp[y][x]
if y==len(temp)-1:
flag=False
elif y==0 and not flag:
... | StarcoderdataPython |
164405 | <gh_stars>0
# Quick and dirty script to send cookies to a URL using python used for the picoctf challenge
import os
i = 0
while i != 30: # Number you want to go up to you can also create an array and loop it through that with a for loop
path = "./results.txt"
def command(i):
os.system("curl -v --cookie \... | StarcoderdataPython |
3236687 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# pvtol_lqr.m - LQR design for vectored thrust aircraft
# RMM, 14 Jan 03
#
#このファイルは、Astrom and Mruray第5章の平面垂直離着陸(PVTOL)航空機の例を使用して、
#LQRベースの設計上の問題をPythonコントロールパッケージの基本機を使って処理します。
#
from numpy import * # NumPy関数
from matplotlib.pyplot import * # MATLAB プロット関数
f... | StarcoderdataPython |
1602304 | from grapl_analyzerlib.grapl_client import GraphClient
from grapl_analyzerlib.prelude import (
BaseView,
)
from graplinc.grapl.api.graph.v1beta1.types_pb2 import MergedNode
def view_from_proto(graph_client: GraphClient, node: MergedNode) -> BaseView:
return BaseView(
node.uid,
node.node_key,
... | StarcoderdataPython |
4805555 | import unittest
import pandas as pd
from Parsers.Onlineparser import OnlineParser
from Parsers.csv_parser import CsvParser
from Processing.SingleColumnConcer import DataframeConcer
class MyTestCase(unittest.TestCase):
def test_online_table(self):
self.assertEqual(OnlineParser("https://www.rivm.nl/media/mi... | StarcoderdataPython |
15570 | <filename>modules/util/objects/query_parts/postgres_query_part.py
class PostgresQueryPart:
""" Object representing Postgres query part
"""
def get_query(self) -> str:
""" Get query
Returns:
str
"""
pass
| StarcoderdataPython |
1604140 | <reponame>aspferraz/GeneticAlgorithm
'''
File name: main.py
Author: <NAME>
Date created: 11/20/2020
Date last modified: 11/25/2020
Python Version: 3.8
'''
import struct
import math
import numpy as np
import random
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
DEFAULT_PR... | StarcoderdataPython |
1767879 | from modules.file import *
| StarcoderdataPython |
80942 | <gh_stars>0
class Sources:
"""
Sources class to define source object
"""
def __init__(self, id, name, description, url):
self.id = id
self.name = name
self.description = description
self.url = url
class Articles:
"""
Articles class to define articles object
... | StarcoderdataPython |
4810380 | # -*- coding: utf-8 -*-
"""
"""
import uuid
from rmfriend import exceptions
from rmfriend.content import Content
from rmfriend.pagedata import PageData
from rmfriend.metadata import MetaData
from rmfriend.notebook import Notebook
from rmfriend.lines.notebooklines import NotebookLines
class NotebookOPS(object):
"... | StarcoderdataPython |
197793 | <filename>traderGUI.py
import json
import os
import dash
import dash_core_components as dcc
import dash_html_components as html
import zmq
from dash.dependencies import Input, Output
from util import *
params = {'ready': 0,
'posUpperLimit': 0,
'posLowerLimit': 0,
'spread': 10.0,
... | StarcoderdataPython |
3376198 | # -*- coding: utf-8 -*-
"""
Created on Fri Nov 9 08:49:09 2018
@author: TIM
"""
import tkinter as tk
from tkinter import simpledialog
from tkinter.filedialog import askdirectory
from tkinter.filedialog import askopenfilename
from tkinter.filedialog import askopenfile
from tkinter import messagebox
from PIL import Im... | StarcoderdataPython |
3376578 | """
Configuration for model.
"""
from __future__ import annotations
import json
from pathlib import Path
from typing import TypedDict
filename = "config.json"
class ConfigData(TypedDict):
iterations: int
window_size: int
def read(path: Path) -> ConfigData:
with open(path / filename, "r", encoding="ut... | StarcoderdataPython |
186992 | <reponame>YaguangZhang/EarsMeasurementCampaignCode
# Open a serial port even if it's currently occupied.
#
# <NAME>, Purdue University, 2017-06-13
import serial
def openPort (p="COM5", b=9600, t=1):
try:
ser = serial.Serial(port=p, baudrate=b, timeout=t)
# Try to open port, if possible prin... | StarcoderdataPython |
3297593 | <gh_stars>10-100
#!python
# Copyright 2018 Datawire. 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 requir... | StarcoderdataPython |
1672019 | """
Copyright (c) 2015, <NAME>
All rights reserved.
A simple keylogger witten in python for linux platform
All keystrokes are recorded in a log file.
The program terminates when grave key(`) is pressed
grave key is found below Esc key
"""
import pyxhook
#change this to your log file's path
log_file='/home/aman/Des... | StarcoderdataPython |
4830286 | <reponame>deepyaman/NVTabular
import os
import subprocess
from shutil import copyfile
import cudf
import tritonclient.http as httpclient
from google.protobuf import text_format
from tritonclient.utils import np_to_triton_dtype
# read in the triton ModelConfig proto object - generating it if it doesn't exist
try:
... | StarcoderdataPython |
3268442 | from .loader import get_loader
from . import text_classification
from . import named_entity_recognition
from . import extractive_qa
from . import summarization
from . import text_pair_classification
from . import hellaswag
from . import aspect_based_sentiment_classification
| StarcoderdataPython |
3364240 | <filename>recodoc2/apps/doc/parser/special_parsers.py
from __future__ import unicode_literals
from docutil.etree_util import HierarchyXPath, SingleXPath
import doc.parser.common_parsers as cp
class HTClientParser(cp.NewDocBookParser):
xparagraphs = HierarchyXPath('.', './pre')
def __init__(self, document_pk... | StarcoderdataPython |
3263740 | <reponame>mylenefarias/360RAT
from PyQt5 import QtWidgets, QtGui
from Interfaces.save_ok__window import Ui_save
from Service.BlackMask import BlackMask
from Service.GetInputUser import GetInput
from sys import platform
import csv
import os
import sys
import shutil
import cv2
import os.path as osp
class CSV:
d... | StarcoderdataPython |
1767189 | # Copyright 2012 Hewlett-Packard Development Company, L.P.
#
# Author: <NAME> <<EMAIL>>
#
# 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 |
1699866 | # (C) Datadog, Inc. 2019
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
# 1st party.
import argparse
import re
# 3rd party.
from tuf.exceptions import UnknownTargetError
# 2nd party.
# 2nd party.
from .download import REPOSITORY_URL_PREFIX, TUFDownloader
from .exceptions import No... | StarcoderdataPython |
1752092 | <reponame>tzhanl/azure-sdk-for-python
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (... | StarcoderdataPython |
45148 | <reponame>bpoje/checkmk-python-rest-api
#!/bin/python3
from Checkmk import *
import re as re
import time
#Init checkmk rest api
def init_checkmk(site_name, cmk_rest_url, cafile, username, secret_token_filename):
# Read secret token from disk
secret_token = open(secret_token_filename,'r').readline().strip('\n'... | StarcoderdataPython |
1618000 | from django.db import models
from django.contrib.auth.models import User
# Create your models here.
class UserRole(models.Model):
role = models.CharField(max_length=100,unique=True)
# desc_chs = models.CharField(max_length=250)
def __unicode__(self):
return self.role
class Profile(models.Model):
user = models.O... | StarcoderdataPython |
3353524 | from __future__ import absolute_import, print_function, unicode_literals
from flask import (
Flask,
make_response,
jsonify,
request,
render_template,
send_from_directory,
abort,
redirect,
)
from flask_cors import CORS
from JavPy.functions import Functions
import json
import os
from JavPy... | StarcoderdataPython |
68191 | <reponame>dkazanc/flatsmatch
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 26 2020
Demo to show the capability of autocropping function.
It works to crop 2D projedctions as well as full 3D volumes.
@author: <NAME>
"""
import numpy as np
import matplotlib.pyplot as plt
from larix.methods.mis... | StarcoderdataPython |
63078 | import datetime
import logging
import random
import re
import time
from typing import Iterator, List, Union, Dict
from urllib.parse import quote
import pandas as pd
import requests
from bs4 import BeautifulSoup
from .conn_postgresql import ConnPostgreSQL
log = logging.getLogger(__name__)
class HhParser:
"""Пар... | StarcoderdataPython |
63139 | from pymapper.layer import LayerType, GeoPandasLayer
def test_layer_types():
"""Test the LayerType enum."""
assert list(LayerType.__members__.keys()) == [GeoPandasLayer.LAYER_TYPE]
assert LayerType[GeoPandasLayer.LAYER_TYPE].value == GeoPandasLayer
| StarcoderdataPython |
3352196 | <reponame>cbeach/nes_le
from .super_mario_bros import *
| StarcoderdataPython |
137211 | <reponame>doraskayo/buildstream
# Pylint doesn't play well with fixtures and dependency injection from pytest
# pylint: disable=redefined-outer-name
import os
import pytest
from buildstream import _yaml
from buildstream.exceptions import ErrorDomain, LoadErrorReason
from buildstream.testing.runcli import cli # pylint... | StarcoderdataPython |
24519 | <filename>test1.py
print("hello")
while True:
print("Infinite loop")
| StarcoderdataPython |
8822 | from oacensus.scraper import Scraper
from oacensus.commands import defaults
class TestScraper(Scraper):
"""
Scraper for testing scraper methods.
"""
aliases = ['testscraper']
def scrape(self):
pass
def process(self):
pass
def test_hashcode():
scraper = Scraper.create_inst... | StarcoderdataPython |
1630552 | import unittest
from oeqa.oetest import oeRuntimeTest, skipModule
from oeqa.utils.decorators import *
def setUpModule():
#check if DEFAULTTUNE is set and it's value is: x86-64-x32
defaulttune = oeRuntimeTest.tc.d.getVar("DEFAULTTUNE", True)
if "x86-64-x32" not in defaulttune:
skipMo... | StarcoderdataPython |
171278 | <reponame>seiferma/Docker_YoutubeDLService
from __future__ import unicode_literals
import cherrypy
from .YoutubeVideos import YoutubeVideos
class Youtube(object):
def __init__(self):
self.video = YoutubeVideos()
def _cp_dispatch(self, vpath):
if len(vpath) > 1:
subelement = vpath... | StarcoderdataPython |
3328229 | #
# Copyright 2017-2018 Government of Canada
# Public Services and Procurement Canada - buyandsell.gc.ca
#
# 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/LIC... | StarcoderdataPython |
3336185 | # -*- coding: utf-8 -*-
from PyQt5.QtCore import pyqtSignal
from PyQt5.QtWidgets import QLabel
_author_ = 'luwt'
_date_ = '2021/12/9 12:27'
class LabelButton(QLabel):
# 点击信号
clicked = pyqtSignal()
def __init__(self, parent):
super().__init__(parent)
def mousePressEvent(self, ev):
s... | StarcoderdataPython |
152603 | <reponame>lennykioko/Flask-API
import json
from flask import Blueprint, abort, make_response
from flask_restful import (Resource, Api, reqparse, inputs, fields,
marshal, marshal_with, url_for)
import models
user_fields = {
'username': fields.String,
'email': fields.String,
'... | StarcoderdataPython |
3325832 | <reponame>Ermlab/python-ddd<gh_stars>100-1000
from seedwork.infrastructure.request_context import request_context
from seedwork.infrastructure.logging import logger, LoggerFactory
from config.container import Container
from modules.catalog.domain.repositories import SellerRepository
from modules.catalog.application.que... | StarcoderdataPython |
8884 | import os
import re
from typing import Tuple
from pfio._typing import Union
from pfio.container import Container
from pfio.io import IO, create_fs_handler
class FileSystemDriverList(object):
def __init__(self):
# TODO(tianqi): dynamically create this list
# as well as the patterns upon loading th... | StarcoderdataPython |
92378 | from Bio import SeqIO
import gzip
import os
import sys
from seqtools.general import rc, translate
def parse_gtf_dict(gtf_str):
return {i.split(' "')[0]:i.split(' "')[1] for i in gtf_str.split('"; ')}
def gtf_to_gene_length(gtf_file, outfile, sum_type='transcript_longest'):
"""
Get Gene length, 3 option... | StarcoderdataPython |
1724328 | <filename>amr_verbnet_semantics/test/test_verbnet.py
from nltk.corpus.reader import VerbnetCorpusReader
from nltk.corpus.util import LazyCorpusLoader
verbnet = LazyCorpusLoader("verbnet3.4", VerbnetCorpusReader, r"(?!\.).*\.xml")
print(verbnet.frames("escape-51.1-1"))
try:
print(verbnet.frames("escape-51.1-2"))
ex... | StarcoderdataPython |
3328938 | <filename>ebcli/docker/container.py
# Copyright 2015 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
... | StarcoderdataPython |
1764868 | <reponame>DRubioBizcaino/AIS-home-assistant
"""
Support for MQTT sensors.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.mqtt/
"""
import logging
import json
from typing import Optional
from datetime import timedelta
import voluptuous as vol
from... | StarcoderdataPython |
1652153 | import os
from twilio.rest import Client
def send_mms():
account_sid = os.environ['TWILIO_ACCOUNT_SID']
auth_token = os.environ['TWILIO_AUTH_TOKEN']
client = Client(account_sid, auth_token)
message = client.messages \
.create(
body='I am as cute as baby yoda :)',
media_... | StarcoderdataPython |
7176 | import os
import option
import utility
import grapeMenu
import grapeGit as git
import grapeConfig
class Clone(option.Option):
""" grape-clone
Clones a git repo and configures it for use with git.
Usage: grape-clone <url> <path> [--recursive] [--allNested]
Arguments:
<url> The URL of th... | StarcoderdataPython |
4841399 | import numpy as np
import pandas as pd
from pandas.api.types import is_numeric_dtype
import matplotlib.pyplot as plt
from matplotlib import rcParams
import seaborn as sns
from .utils import *
from .utils import _make_iterable, _is_iter
def _plot_grid(plot_func, data, x, y, color=None, **kwargs):
MSG_ONLY_2D = "... | StarcoderdataPython |
1765896 | <filename>2017/12.py
#!/usr/bin/env python3
import sys
def dfs(graph, seen, nobe):
if nobe in seen: return
seen.add(nobe)
for child in graph[nobe]:
dfs(graph, seen, child)
def main(args):
data = [s.strip() for s in sys.stdin]
graph = {}
for line in data:
k, vs = line.split(" <... | StarcoderdataPython |
3235938 | import asyncio
import logging
from aiohttp.web import Application, WebSocketResponse, json_response
from aiohttp.http_websocket import WSMsgType, WSCloseCode
from lbry.wallet.util import satoshis_to_coins
from .node import Conductor
PORT = 7954
class WebSocketLogHandler(logging.Handler):
def __init__(self, se... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.