id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
3345951 | #
# Generate read-only SAS URLs for all LILA containers, to facilitate partial downloads.
#
# The results of this script end up here:
#
# http://lila.science/wp-content/uploads/2020/03/lila_sas_urls.txt
#
# Update: that file is manually maintained now, it can't be programmatically generated
#
#%% Imports
from azure.s... | StarcoderdataPython |
4158 | from socket import *
serverPort = 12001
serverSocket = socket(AF_INET, SOCK_STREAM)
serverSocket.bind(('', serverPort))
serverSocket.listen(1)
print("the server is ready to receive")
while True:
connectionSocket,addr = serverSocket.accept()
sentence = connectionSocket.recv(1024).decode()
sentence = sentence... | StarcoderdataPython |
153660 | <filename>days/day13/part2.py
from submarine.systems.fold import Origami
def solution(day):
o = Origami(f"inputs/{day}.txt")
o.run(only_once=False)
o.print()
| StarcoderdataPython |
3254967 | #!/usr/bin/env python3
from diagrams import Cluster, Diagram
from diagrams.k8s.compute import Pod
from diagrams.k8s.network import Service
from diagrams.k8s.storage import PersistentVolumeClaim
from diagrams.onprem.client import Client
from diagrams.onprem.compute import Server
from diagrams.onprem.database import Mysq... | StarcoderdataPython |
3379973 | <reponame>Dio-Off-Brando/projet-nsi-idk-yet<filename>main.py
##################
# <NAME> #
# Mehdi #
# & #
# #
# #
##################
def affichage_tas(liste):
pass
def choix_allumettes(joueur):
#adapter au nom du joueur
return input(joueur+" choi... | StarcoderdataPython |
65102 | <gh_stars>1-10
import FWCore.ParameterSet.Config as cms
LowPtDielectronPSet = cms.PSet(
hltPathsToCheck = cms.vstring(
"HLT_DoubleEle33_CaloIdL_GsfTrkIdVL_MW_v", # Run2
"HLT_DoubleEle33_CaloIdL_GsfTrkIdVL_v", # Run1 & Run2
"HLT_DoubleEle33_CaloIdL_MW_v", # 2016 menu
"H... | StarcoderdataPython |
3007 | <reponame>Mithras/ha
import globals
class ToggleSwitch(globals.Hass):
async def initialize(self):
config = self.args["config"]
self._input = config["input"]
self._toggle_service = config["toggle_service"]
self._toggle_payload = config["toggle_payload"]
self._power = config[... | StarcoderdataPython |
1637964 | import json
from calendar import timegm
from datetime import timezone, datetime, timedelta
import jwt
from tests.base_test import BaseTest
from crc import app, session
from crc.api.common import ApiError
from crc.models.protocol_builder import ProtocolBuilderStatus
from crc.models.study import StudySchema, StudyModel... | StarcoderdataPython |
1674607 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib.auth.backends import ModelBackend
from django.contrib.auth import get_user_model
from ...core.conf import settings
User = get_user_model()
class EmailAuthBackend(ModelBackend):
def authenticate(self, username=None, password=N... | StarcoderdataPython |
3205846 | <gh_stars>0
from collections import defaultdict
import glob
import logging
import os
import numpy as np
import pathlib
from pyspark.sql import functions as sf
from pyspark.sql import types as st
import shutil
import sys
from typing import Iterable
from .config import create_spark_session
from .config import create_spa... | StarcoderdataPython |
3202502 | import colorsys
import random
TWITCH_PURPLE = (145, 70, 255)
class TwitchUser:
def __init__(self, user_id="", display_name="", roles=[], color=""):
self.user_id = user_id
self.display_name = display_name
self.username = self.display_name.lower()
self.roles = roles
self.is_... | StarcoderdataPython |
1685706 | import os
import time
import numpy as np
import pandas as pd
import torch
import torch.optim as optim
import umap
from matplotlib import pyplot as plt
from sklearn.manifold import TSNE
from data.data_loader import get_data_ts_onh_mac
from losses import elbo_general_timeseries
from losses import mae_globalmean, mae_l... | StarcoderdataPython |
1623014 | <gh_stars>1-10
# # # # # # # # # # # # # # # # # # # # # '''
# # # # # # # # # # # # # # # # # # # # # Values Count_Range
# # # # # # # # # # # # # # # # # # # # # 455 1
# # # # # # # # # # # # # # # # # # # # # 475 2
# # # # # # # # # # # # # # # # # # # # # 479 3
# # # # # # # # # # # # # # # # # # # # # 471 4
# # # ... | StarcoderdataPython |
1623330 | <reponame>iorodeo/py2scad
"""
Copyright 2010 IO Rodeo Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agre... | StarcoderdataPython |
53704 | <reponame>kedmenec/commerce_api<filename>products/management/commands/clear_products.py
from django.core.management.base import BaseCommand
from products.models import Product
class Command(BaseCommand):
help = 'Clear all entries from the Product table'
def _delete_all_products(self):
Product.objects.... | StarcoderdataPython |
3393005 | <reponame>douglasdavis/rexplotlib<filename>rexart/utils.py<gh_stars>0
import numpy as np
from pathlib import PosixPath
import os
import subprocess
import logging
log = logging.getLogger(__name__)
def draw_ratio_with_line(ax, data, mc_sum, mc_err, yline=1.0, autoxscale=True):
""" draw the ratio with a horizontal... | StarcoderdataPython |
3352066 | <reponame>Krrishdhaneja/cpython
import sys
try:
import layout
except ImportError:
# Failed to import our package, which likely means we were started directly
# Add the additional search path needed to locate our module.
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolv... | StarcoderdataPython |
102985 | import numpy
from gensim.summarization.bm25 import BM25
class WrappedBM25(BM25):
def __init__(self, docs, tokenizer='spacy'):
self.docs = docs
if tokenizer == 'spacy':
try:
import spacy
except ImportError:
raise ImportError('Please install sp... | StarcoderdataPython |
3298035 | import pathlib
import vkquick as vq
from . import config
from tests.test_bot.src._add_cache import cache
@vq.Cmd(names=config.NAMES)
@vq.Reaction("message_new")
async def doc_uploader(event: vq.Event()):
"""
Handler to command `send_photo`
"""
path = pathlib.Path() / "tests" / "test_bot" / "assets" /... | StarcoderdataPython |
3286087 | """The sia integration."""
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_PORT
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryNotReady
from .const import DOMAIN, PLATFORMS
from .hub import SIAHub
async def async_setup_entry(hass... | StarcoderdataPython |
4814840 | <reponame>CybersecurityLuxembourg/openxeco
import datetime
import os
import bs4
from test.BaseCase import BaseCase
class TestGetPublicArticleContent(BaseCase):
complete_article = [
{
"id": 1,
"article_version_id": 2,
"position": 1,
"type": "TITLE1",
... | StarcoderdataPython |
1719478 | <reponame>dreaming-coder/DeepLab<filename>src/model/TrajGRU/TrajGRUCell.py
r"""
TrajGRUCell 的实现,卷积核尺寸需要根据图片尺寸计算,必须保证根据公式算出的 feature map 尺寸是整数,不能取整
"""
from typing import Tuple
import torch
from torch import nn, Tensor
__all__ = ["TrajGRUCell"]
def warp(input: Tensor, flow: Tensor) -> Tensor:
device = input.devi... | StarcoderdataPython |
1686615 | import streamlit as st
import os
import sys
import ee
import sys
import base64
import geemap as gee
from geemap import cartoee
import pandas as pd
from utils import new_get_image_collection_gif
st.title("SARveillance")
st.subheader("Sentinel-1 SAR time series analysis for OSINT use")
class SAREXPLORER:
north_ar... | StarcoderdataPython |
192070 | #!/home/charmm-gui/local/bin/python
import sys, os
import cPickle
import numpy as np
from sklearn.neighbors import KernelDensity
segid = sys.argv[1]
#segid = segid.lower()
#saved_pickle = 'glycan_rotlib.dat'
saved_pickle = sys.argv[2]
kde = cPickle.load( open(saved_pickle, 'rb') )
sample = kde[segid].sample(n_samples... | StarcoderdataPython |
3336763 | <reponame>FarhanSyedain/miniblog
from django.forms import ModelForm
from .models import Post
class PostCreationForm(ModelForm):
class Meta:
model = Post
fields = ['title','sub_title','thumbnail','body','key_words','tags','catogory','slug','active']
def save(self,author, commit=True):
... | StarcoderdataPython |
1794372 | <reponame>rootshellz/Beatporter<filename>spotify.py
import sys
import json
import socket
import spotipy
import asyncio
import webbrowser
from time import time
from spotipy import oauth2
from config import *
def listen_for_callback_code():
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind(('localho... | StarcoderdataPython |
3201608 | # -*- coding: utf-8 -*-
a = float(input())
b = float(input())
print("MEDIA = %.5f" % float(((a*3.5)+(b*7.5))/11))
| StarcoderdataPython |
3232657 | <gh_stars>0
import pandas
# from check_m1 import preprocessing, pipe_line, measures, kwargs
from check_m2 import preprocessing, pipe_line, measures, kwargs
# from check_m3 import preprocessing, pipe_line, measures, kwargs
# from check_m4 import preprocessing, pipe_line, measures, kwargs
d = './data/dataset_groupgrab... | StarcoderdataPython |
3286089 | from awrams.utils.messaging.robust import PollingChild, SharedMemClient, Chunk, to_chunks
import netCDF4 as nc
#from awra import db_open_with
#+++ Need to use NCD (as opposed to h5py) when writing to LSD compressed datasets
db_opener = nc.Dataset#db_open_with()
FILL_VALUE = -999.
class MultifileChunkWriter(PollingCh... | StarcoderdataPython |
3218826 | from flask import current_app as app
from .auth import auth
from .legal import legal
from .home import home
from .subjects import subjects
from .suggestquestion import suggestquestion
from .user import user
from .quiz import quiz
from .highscore import highscore
from .tutor import tutor
app.register_blueprint(auth.a... | StarcoderdataPython |
1721722 | <gh_stars>1-10
"""
<Name>
data.py
<Author>
<NAME> <<EMAIL>>
<Started>
May, 2018
<Copyright>
See LICENSE for licensing information.
<Purpose>
Python dictionary containing sample DMARC aggregate report data.
"""
sample_report = {
# Report generator metadata
"report_metadata": {
"org_name": "... | StarcoderdataPython |
128141 | <reponame>lalapapauhuh/Python<gh_stars>0
def mdc(x1, x2):
while x1%x2 != 0:
nx1 = x1
nx2 = x2
# Trocando os valores de variavel
x1 = nx2
x2 = nx1 % nx2 # x2 recebe o resto da divisao entre nx1 e nx2
return x2
class Fracao:
def __init__(self, numerador, denominador):... | StarcoderdataPython |
3243724 | count_case = int(input())
for i in range(0, count_case):
sum = int(input())
n = int(input())
for i in range(0, n):
q, p = map(int, input().split())
sum += q * p
print(sum)
| StarcoderdataPython |
1739034 | <reponame>kevko/ancfinder
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('ancfindersite',... | StarcoderdataPython |
1759937 | import hoomd
import pytest
import numpy
import itertools
from copy import deepcopy
def test_brownian_attributes():
"""Test attributes of the Brownian integrator before attaching."""
all_ = hoomd.filter.All()
constant = hoomd.variant.Constant(2.0)
brownian = hoomd.md.methods.Brownian(filter = all_, kT=... | StarcoderdataPython |
1774395 | <filename>autoKirbi2hashcat.py<gh_stars>10-100
# Note: This is a copy of kirbi2john.py with slight modifications to take input from Invoke-Autokerberoast function output and output in a hashcat-compatible format.
# Based on the Kerberoast script from <NAME> to extract the Kerberos tickets
# from a kirbi file.
# Modif... | StarcoderdataPython |
1686706 | <gh_stars>1-10
import os
__author__ = "<NAME>"
__version__ = 1.0
def xmlMarkup(games, team_ab, team_name, team_record):
'''Markup the RSS feed using the data obtained.
:param games: list of games that the team played this season
:type games: list of GameData
:param team_ab: the team's abbreviated name
... | StarcoderdataPython |
3349293 | <gh_stars>0
import unittest
from tests.test_utils import *
from tests.test_ini_file import *
from tests.test_cli import *
if __name__ == "__main__":
unittest.main()
| StarcoderdataPython |
156235 | <reponame>danilkuzin/GP-EnKF
class DataProvider(object):
pass | StarcoderdataPython |
97622 | """
View more, visit my tutorial page: https://morvanzhou.github.io/tutorials/
My Youtube Channel: https://www.youtube.com/user/MorvanZhou
Dependencies:
torch: 0.4
matplotlib
torchvision
"""
import torch
from torch import nn
import pandas as pd
import torch
from torchvision import transforms
from PythonApplication2 imp... | StarcoderdataPython |
3264245 | # -*- coding: utf-8 -*-
# (C) Copyright IBM Corp. 2020.
#
# 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 l... | StarcoderdataPython |
3362616 | # Generated by Django 2.1.3 on 2018-12-25 15:18
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('SOS', '0008_auto_20181225_1515'),
]
operations = [
migrations.AddField(
model_name='order',
... | StarcoderdataPython |
1609525 | <reponame>benjolitz/wrangle
from .create_synth_data import create_synth_data
from .create_synth_model import *
from .create_time_sequence import create_time_sequence
from .read_large_csv import read_large_csv
| StarcoderdataPython |
1753130 | '''
Magic loop for comparing fitness among different models
'''
from dskc import dskc_terminal
from src.modeling.models import *
def _display_reports(reports):
table = []
# build each report
for i, report in enumerate(reports):
table.append(report.table_row())
# sort by mse
table.sort(ke... | StarcoderdataPython |
1643304 | from django.urls import path
from rest_framework.urlpatterns import format_suffix_patterns
from api import views
urlpatterns = [
path('translate', views.Translate.as_view()),
path('translate/logs', views.TranslateLogList.as_view()),
path('translate/logs/<int:n>', views.TranslateLogList.as_view()),
pat... | StarcoderdataPython |
1730941 | <reponame>tomato-300yen/coding<filename>atcoder/abc/b131.py
N, L = map(int, input().split())
sum_ = N * (L - 1) + N * (N + 1) // 2
taste_min = 999
sign = 1
for i in range(1, N + 1):
if taste_min > abs(L + i - 1):
taste_min = abs(L + i - 1)
sign = -1 * ((L + i - 1) < 0) + 1 * ((L + i - 1) >= 0)
print... | StarcoderdataPython |
3288527 | import os
import json
import torch
import torch.nn as nn
import torch.optim as optim
from torchvision import transforms, datasets
from tqdm import tqdm
from model import resnet34
def main():
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
print("using {} device.".format(device))
... | StarcoderdataPython |
150683 | #!/usr/bin/env python
from __future__ import division
import numpy as np
import scipy.spatial.distance as ssd
import h5py, sys
import pycuda.driver as drv
import pycuda.autoinit
from pycuda import gpuarray
from scikits.cuda import linalg
linalg.init()
from tps import tps_kernel_matrix, tps_eval
from transformations ... | StarcoderdataPython |
1726427 | <reponame>sumpfgottheit/du-1800
__author__ = 'Florian'
from util import get_lan_ip
#################
# CONFIGURATION #
#################
# CHANGE FROM HERE
#
UDP_PORT = 18877
IP = get_lan_ip()
BUFFER_SIZE = 8192
TIMEOUT_IN_SECONDS = 0.1
#
SCREEN_WIDTH = 320
SCREEN_HEIGHT = 240
SCREEN_DEEP = 32
#
LABEL_RIGHT = 0
LA... | StarcoderdataPython |
19717 | <gh_stars>0
"""Top-level package for Goldmeister."""
__author__ = """<NAME>"""
__email__ = '<EMAIL>'
__version__ = '0.2.0'
| StarcoderdataPython |
1659729 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Topic: 通过在类中实现__call__方法,让该类的实例变成可调用对象,即可以在实例对象后面加()来调用该实例对象
Desc : 流畅的Python 第五章示例程序5-8
"""
import random
class BingoCage:
"""
BingoCage的实例使用任何可迭代的对象构建,而且会在
"""
def __init__(self, items):
"""
在本地构建一个副本,防止列表参数的意外副作用
:param item... | StarcoderdataPython |
1754498 | from setuptools import (
find_packages,
setup,
)
setup(
name='blocktrans-trimmed-check',
description='pre-commit hook: ensure multi-line blocktrans blocks in Django templates are "trimmed"',
url='https://github.com/gimbo/blocktrans-trimmed-check',
version='1.0.0',
author='<NAME>',
aut... | StarcoderdataPython |
1600934 | import os
import re
import sys
def turn_on(lights, x1, y1, x2, y2):
x = x1
while x != x2 + 1:
y = y1
while y != y2 + 1:
lights[x][y] = 1
y = y + 1
x = x + 1
def turn_off(lights, x1, y1, x2, y2):
x = x1
while x != x2 + 1:
y = y1
while y != y2 + 1:
lights[x][y] = 0
y ... | StarcoderdataPython |
3372766 | <filename>timeseries-streaming/timeseries-python-applications/MLPipeline/timeseries/pipeline_templates/timeseries_pipeline.py
# Lint as: python2, python3
# Copyright 2020 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance... | StarcoderdataPython |
3282918 | <filename>simpleblog/blog/admin.py
from django.contrib import admin
from blog.models import Post
admin.site.register(Post) | StarcoderdataPython |
4831200 | <gh_stars>0
from typing import Type, TypeVar, Tuple, List, Dict, Any
from Crypto.Hash import SHA256
from pycoin.tx.pay_to.ScriptPayToAddressWit import ScriptPayToAddressWit
from pycoin.key.BIP32Node import BIP32Node
from pycoin.ui import address_for_pay_to_script, standard_tx_out_script
from pycoin.networks import bec... | StarcoderdataPython |
3274858 | '''
Family 3
buddy list management
'''
import struct, logging, oscar
from util.primitives.funcs import do
from datetime import datetime
unpack_int = lambda v: struct.unpack('!I', v)[0]
subcodes = {}
log = logging.getLogger('oscar.snac.x03')
x03_name="Buddy List management"
def x03_init(o, sock, cb)... | StarcoderdataPython |
1701099 | import pathlib
from typing import Optional
class WorkflowStepContext:
# TODO(suquark): we have to skip some type hints here, because we are
# still not quite sure what should be the correct type. It will finalize
# we we receive enough feedback about the API.
def __init__(self,
workfl... | StarcoderdataPython |
73765 | import unittest
from transition_sampling.engines import ShootingResult
from transition_sampling.algo.aimless_shooting import AsyncAimlessShooting, \
generate_velocities
import numpy as np
import tempfile
class NextPositionTest(unittest.TestCase):
"""Test that picking the next position works"""
def test_... | StarcoderdataPython |
1640756 | <reponame>jhonatancasale/learning-python<filename>snippets/defaultdict.lambda.py
from collections import defaultdict
def main() -> None:
print()
default_dict = defaultdict(lambda: "Maybe I missed something?")
default_dict['a'] = 1
default_dict['b'] = 2
print(default_dict['a'])
print(defa... | StarcoderdataPython |
77684 | <reponame>dreamhost/python-glanceclient<filename>glanceclient/common/utils.py
# Copyright 2012 OpenStack LLC.
# 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
#... | StarcoderdataPython |
1779348 | <filename>test.py<gh_stars>0
import game_logic
import unittest
import checkers_exception
import log_parser
import glob
import os
class ParserTest(unittest.TestCase):
file_for_deleted = []
def tearDown(self):
for file in self.file_for_deleted:
os.remove(file)
def init_p... | StarcoderdataPython |
27735 | import logging
from django.conf import settings
from django.contrib.admin.views.decorators import staff_member_required
from django.contrib.auth.models import User
from django.core.cache import cache
from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response
from django.template.conte... | StarcoderdataPython |
1685183 | <reponame>bsnisar/composer-samples
"""
DAG describing Hive pipeline
"""
from datetime import datetime, timedelta
from airflow import DAG
from airflow.operators.dummy_operator import DummyOperator
from airflow.contrib.operators.dataproc_operator import DataprocWorkflowTemplateInstantiateOperator
PROJECT_ID = 'wmt-data... | StarcoderdataPython |
1651764 | from __future__ import annotations
import logging
import typing
from typing import Any, Dict
import jsondiff
from silex_client.action.command_base import CommandBase
from silex_client.action.parameter_buffer import ParameterBuffer
from silex_client.utils.parameter_types import (
AnyParameter,
ListParameterMe... | StarcoderdataPython |
3332557 | <gh_stars>1-10
# Review Clustering and Ranking
import torch
import torch.nn as nn
from torch.autograd import Variable
import numpy as np
from collections import defaultdict
from sklearn.cluster import KMeans
import pdb
import math
from utils import config
class RCR(nn.Module):
def __init__(self):
super(R... | StarcoderdataPython |
3386624 | import tkinter as tk
from tkinter import ttk
from tkinter import filedialog
import csv
from PIL import Image, ImageTk
import ttkwidgets
import os,sys
###########3main functions###################33
from operator import itemgetter
class Gene:
def __init__(self, gene_code, virus_name,gene_name,host_na... | StarcoderdataPython |
4800968 | #!/usr/bin/python
# [2015-01-05] Challenge #196 [Practical Exercise] Ready... set... set!
import random
class IntegerSet(object):
def __init__(self, values):
self.values = values
def Contains(self, value):
return value in self.values
def Equals(self, setb):
if len(self.values)... | StarcoderdataPython |
22532 | import asyncio
import os
from youwol_utils import WhereClause, QueryBody, Query, Path, flatten
from .configurations import Configuration
from .utils import format_download_form, post_storage_by_chunk, md5_from_folder
from .utils_indexing import format_doc_db_record, post_indexes, get_version_number_str
async def in... | StarcoderdataPython |
3303121 | #!/usr/bin/env python
"""Compute a dependency graph between active Python eggs.
"""
from setuptools import setup, find_packages
longdesc = "\n\n".join((open("README.rst").read(),
open("ABOUT.rst").read()))
entry_points = {
"console_scripts": [
"eggdeps = tl.eggdeps.cli:eggdeps",
... | StarcoderdataPython |
3263193 | <gh_stars>1-10
"""
Python 3
VirusTotal Public API v2.0
__author__ = "Erlopek"
__copyright__ = "Copyright 2017, Erlopek"
__license__ = "Apache License"
__version__ = "1.0.2"
__maintainer__ = "Erlopek"
__email__ = "<EMAIL>"
__status__ = "Beta"
"""
import requests, argparse, json, sys, urllib
from colorama import For... | StarcoderdataPython |
3396603 | <filename>01_Python_Basico_Intermediario/Aula061/cnpj.py
import re
def remover_caract(cnpj):
return re.sub(r'[^0-9]', '', cnpj)
| StarcoderdataPython |
3383849 | <reponame>mileistone/synthtext<filename>synthtext/text_renderer/utils.py
import numpy as np
def sample_weighted(p_dict):
ps = list(p_dict.keys())
key = np.random.choice(ps)
return p_dict[key]
def move_bb(bbs, t):
"""
Translate the bounding-boxes in by t_x,t_y.
BB : 2x4xn
T : 2-long np.a... | StarcoderdataPython |
3220647 | # ext/asyncio/exc.py
# Copyright (C) 2020-2021 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: https://www.opensource.org/licenses/mit-license.php
from ... import exc
class AsyncMethodRequired(exc.InvalidRequestError):
""... | StarcoderdataPython |
1718552 | '''
Unit tests for the ScheduleTimeBlock to verify the input validation and serialization
Author: Alex (Yin) Chen
Creation Date: February 20, 2020
'''
import pytest
import datetime
import json
from blinds.blinds_schedule import BlindMode, ScheduleTimeBlock, InvalidTimeBlockException
class TestScheduleTimeBlock:
... | StarcoderdataPython |
1629493 | from dataclasses import dataclass
from typing import Optional
from dataclasses_json import dataclass_json
@dataclass_json
@dataclass
class Link:
url: Optional[str]
label: str
active: bool
| StarcoderdataPython |
3345191 | #!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
__metaclass__ = type
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
DOCUMENTATION = """
module: nxos_snapshot
extends_documentation_fragment:
- cisco.nxos.nxos
sho... | StarcoderdataPython |
3222678 | <filename>BlockOL/__init__.py
"""A utils library."""
from typing import Any, Generator, Union, Iterable, Tuple, List, Dict, Callable
def is_prime(n: int) -> bool:
"""Returns whether n is a prime number
Args:
n (int): The number to check
Returns:
bool: Whether n is a prime number
"""... | StarcoderdataPython |
198450 | """Tests for feedback app"""
| StarcoderdataPython |
3332264 | <gh_stars>100-1000
import logging
import pytest
from ocs_ci.ocs import constants
from ocs_ci.framework.testlib import ManageTest, tier3
from ocs_ci.ocs.exceptions import CommandFailed
log = logging.getLogger(__name__)
@tier3
@pytest.mark.parametrize(
argnames="interface",
argvalues=[
pytest.param(
... | StarcoderdataPython |
1701406 |
def image_import(filename):
array = f(filename)
# Check dimensions of array
# Normalize array using function from import_array
# Write out csv file: same as filename, but different extension
return array | StarcoderdataPython |
125500 | <reponame>tony/django-docutils<filename>django_docutils/lib/roles/pypi.py
from .common import generic_url_role
def pypi_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
"""Role for linking to pypi page.
:pypi:`libsass` ->
link: https://pypi.python.org/pypi/libsass
text: libsa... | StarcoderdataPython |
3346909 | <filename>pom/page/__init__.py
from .home_page import HomePage
from .detail_page import DetailPage | StarcoderdataPython |
3353406 | from thespian.actors import ActorAddress, ActorSystemConventionUpdate
from thespian.system.messages.convention import (ConventionRegister,
ConventionDeRegister,
ConventionInvite)
from thespian.system.admin.convention impor... | StarcoderdataPython |
41262 | import numpy
import re
with open('/home/johnny/Documents/navigate_building/source/assets/images_with_plaques.txt') as f:
LIST_OF_POSITIVES = f.read().split('\n')
class ImageDetectionMetadata():
headers = ['label', 'parsed_text', 'found_contour_area', 'ref_contour_area', 'source_image_location', 'image', 'ima... | StarcoderdataPython |
98448 | <filename>tests/__init__.py
"""Tests for the Frigate integration."""
from __future__ import annotations
from typing import Any
from unittest.mock import AsyncMock, patch
from pytest_homeassistant_custom_component.common import MockConfigEntry
from custom_components.frigate.const import DOMAIN, NAME
from homeassistan... | StarcoderdataPython |
179848 | <reponame>dimagilg/commcare-hq
# -*- coding: utf-8 -*-
# Generated by Django 1.11.29 on 2020-07-01 07:42
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('couchforms', '0007_auto_20191210_2206'),
]
operatio... | StarcoderdataPython |
129810 | # Copyright (c) 2021 PaddlePaddle 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 |
127732 | <filename>src/recipi/utils/helpers.py
from django.contrib.sessions.serializers import JSONSerializer as BaseJSONSerializer
from recipi.utils import json
class UUIDCapableJSONSerializer(BaseJSONSerializer):
def dumps(self, obj):
return json.dumps(obj).encode('latin-1')
def loads(self, data):
... | StarcoderdataPython |
93558 | import csv
import io
import os
import uuid
from datetime import datetime, timezone
from Levenshtein import distance
from requests import Session
from requests.auth import HTTPBasicAuth # or HTTPDigestAuth, or OAuth1, etc.
from zeep import Client
from zeep.transports import Transport
from dotenv import loa... | StarcoderdataPython |
1779838 | # Pretty printers for the NPTL lock types.
#
# Copyright (C) 2016-2020 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
#
# The GNU C Library 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 ... | StarcoderdataPython |
66305 | '''
# something wrong with the logging/the way to write as a
'''
import os
import re
import time
import numpy as np
import matplotlib.pyplot as plt
import argparse
# original settings ...
parser = argparse.ArgumentParser()
parser.add_argument('--file_name', type = str, default = 0, help = 'The name of txt log fil... | StarcoderdataPython |
71542 | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
sns.set()
from sklearn.model_selection import train_test_split
from sklearn.model_selection import cross_val_score
from sklearn.linear_model import LinearRegression
from sklearn.preprocessing import StandardScaler, PolynomialF... | StarcoderdataPython |
3131 | <filename>expyfun/_utils.py
"""Some utility functions"""
# Authors: <NAME> <<EMAIL>>
#
# License: BSD (3-clause)
import warnings
import operator
from copy import deepcopy
import subprocess
import importlib
import os
import os.path as op
import inspect
import sys
import tempfile
import ssl
from shutil import rmtree
im... | StarcoderdataPython |
74944 | from django.core.cache import cache
from django.shortcuts import render, get_object_or_404
from django_redis import get_redis_connection
from .models import Image
# Create your views here.
con = get_redis_connection("default")
def index(request):
query = Image.objects.all()
images_seq = [
{'id': da... | StarcoderdataPython |
1677016 | <reponame>basilmahmood/Wsimple<filename>setup.py<gh_stars>0
from os import path
from setuptools import setup, find_packages
def read(fname):
return open(path.join(path.dirname(__file__), fname)).read()
def from_here(relative_path):
return path.join(path.dirname(__file__), relative_path)
with open('requiremen... | StarcoderdataPython |
4838061 | '''
Created on 12.07.2018
@author: yvo
'''
from dataflow.DataReaders.DatabaseReaders.GlamosDatabaseReader import GlamosDatabaseReader
from dataflow.DataObjects.Glacier import Glacier
from dataflow.DataObjects.MassBalance import MassBalanceObservation
from dataflow.DataObjects.MassBalance import MassBalanceFixDate
fro... | StarcoderdataPython |
3332723 | <reponame>polart/vagrant-registry
from io import StringIO
from unittest.mock import patch
from datetime import timedelta
from django.conf import settings
from django.contrib.auth.models import AnonymousUser
from django.test import TestCase
from django.utils import timezone
from apps.boxes.models import Box, BoxMember... | StarcoderdataPython |
1674079 | <reponame>Matej-Chmel/parallel-qr-code-scanner
from __future__ import annotations
from mchqr.dev import NoScreen, UnsupportedOS
from mchqr.geometry import Size
from platform import system
class OsMetaClass(type):
def __str__(self: OS):
return 'Linux' if self.LINUX else 'Windows'
class OS(metaclass=OsMetaClass):
L... | StarcoderdataPython |
3296501 | <reponame>MatusBako/MakeFacesGreatAgain<gh_stars>0
from math import log2, floor,sqrt
from torch import nn, cat, add, Tensor
from torch.nn import init, Upsample, Conv2d, ReLU, AvgPool2d, BatchNorm2d
from torch.nn.functional import interpolate
class Residual_Block(nn.Module):
def __init__(self):
super(Resid... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.