id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
153456 | import unittest
import os
from rastervision2.pipeline import rv_config
from rastervision2.pipeline.file_system import file_to_json
from rastervision2.core.data import (
ClassConfig, ChipClassificationLabelSourceConfig, GeoJSONVectorSourceConfig,
ChipClassificationGeoJSONStoreConfig, RasterioSourceConfig, Scene... | StarcoderdataPython |
79919 | import os
import pytest
from mergepurge import clean, match
import pandas as pd
import numpy as np
from context import COMP_PATH, PARTIAL_PATH
COMP_DTYPES = {'aa_streetnum': str, 'aa_zip': str, 'zipcode': str}
complete = pd.read_csv(COMP_PATH, sep='\t', encoding='utf-8', dtype=COMP_DTYPES)
COMP_LOC_COLS = ['addre... | StarcoderdataPython |
3335164 | from enum import Enum
from django.core.exceptions import ValidationError
from django.db import models
from django.utils.translation import gettext_lazy as _
from django_enum_choices.fields import EnumChoiceField
from apps.core.models.base import BaseModel
from apps.core.fields.aes_json_field import AesJSONField
cla... | StarcoderdataPython |
1755436 | # -*- coding: utf-8 -*-
#
# Copyright (c) 2015, Alcatel-Lucent Inc, 2017 Nokia
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyrigh... | StarcoderdataPython |
3313889 | # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under th... | StarcoderdataPython |
4840802 | """
File: bstnode.py
Author: <NAME>
"""
class BSTNode:
"""Represents a node for a linked binary search tree."""
def __init__(self, data):
self.data = data
| StarcoderdataPython |
63273 | <filename>src/activeledgerPythonSDK/classes/transaction.py
import json
import requests
from activeledgerPythonSDK.classes import key
from activeledgerPythonSDK.classes import Connection
from activeledgerPythonSDK.classes import resp
class baseTransaction(object):
transaction = {
'$ter... | StarcoderdataPython |
3304553 | <reponame>pd-giz-dave/fellsafe-uhf<filename>flash/lib/fipy_off.py
""" history
2021-01-30 DCN: created
"""
""" description
Import this to turn off Pycom services on boot
"""
import pycom
pycom.pybytes_on_boot(False)
pycom.smart_config_on_boot(False)
pycom.wifi_on_boot(False)
print("Pycom services tur... | StarcoderdataPython |
3333937 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Oct 7 15:13:37 2018
@author: katezeng
"""
# Libraries
import pandas as pd
# functions
def drop_zipcodes(df1, df2):
zipcode1 = list(df1['zipcode'])
zipcode2 = list(df2['zipcode'])
for zips in zipcode1:
if zips not in zipcode2:
... | StarcoderdataPython |
4839694 | <filename>crawlers/crawlers/spiders/zjlottery.py
import scrapy
from scrapy.http import JsonRequest, Request
from scrapy import Selector
import time
import re
import w3lib.html
import pprint
class ZjlotterySpider(scrapy.Spider):
name = "zjlottery"
custom_settings = {
'DATABASEPIPELINE_ENABLED': Tr... | StarcoderdataPython |
4827766 | # flake8: noqa
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
"Write your forwards methods here."
for tag in orm['tagging.Tag'].objects.all():
if ta... | StarcoderdataPython |
53831 | from importlib import import_module
from django.conf import settings
from django.conf.urls import include, url
from django.core.exceptions import ImproperlyConfigured
from tastypie.api import Api
from .api import TemporaryFileResource, ServiceResource, VariableResource
from .views import TemporaryFileUploadFormView, ... | StarcoderdataPython |
4821403 | <gh_stars>0
# -*- coding: utf-8 -*-
u"""?
:copyright: Copyright (c) 2016 <NAME>. All Rights Reserved.
:license: http://www.apache.org/licenses/LICENSE-2.0.html
"""
from __future__ import absolute_import, division, print_function
from pykern.pkdebug import pkdp
import glob
import os
import os.path
import py.path
impor... | StarcoderdataPython |
3145 | <gh_stars>10-100
# Copyright (c) 2006-2012 <NAME> http://garnaat.org/
# Copyright (c) 2012 Amazon.com, Inc. or its affiliates.
# All Rights Reserved
#
# 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 S... | StarcoderdataPython |
1739681 | #
# Author: <NAME> (2017)
# All rights reserved.
#
# This script takes input data from Christopher Chamberland's Matlab code
# and strips spaces, leaving the distance 3 surface code data in the format
# synX1synX2synX3 errX1errX2errX3 synZ1synZ2synZ3 errZ1errZ2errZ3
# for every iteration.
# Ever line contains: 12bits ... | StarcoderdataPython |
1605367 | """
Sparklines for text. text_lines counts your words, paragraphs, pages
and emits a short summary.
This text doesn't need to be here, but I'm trying to write a new paragraph.
"""
__author__ = '<NAME>'
__email__ = '<EMAIL>'
__url__ = 'https://github.com/michaeljoseph/textlines'
__version__ = '0.0.1'
import humanize
f... | StarcoderdataPython |
1726503 | #!/usr/bin/python
import sys
import time
import Adafruit_DHT
import json
import httplib, urllib
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(24, GPIO.IN, pull_up_down=GPIO.PUD_UP)
deviceId = "DD8jNe9y"
deviceKey = "<KEY>"
def post_to_mcs(payload):
headers = {"Content-type": "application/json", "deviceKe... | StarcoderdataPython |
1785504 | <gh_stars>0
#!/usr/bin/python3
# -*- coding:utf-8 -*-
# author: https://blog.csdn.net/zhongqi2513
# ============================================================
# 内容描述: 拉勾应用
# ============================================================
from urllib.request import urlopen
from urllib.request import Request
from bs4 im... | StarcoderdataPython |
3303745 | import compas_rrc as rrc
if __name__ == '__main__':
# Create Ros Client
ros = rrc.RosClient()
ros.run()
# Create ABB Client
abb = rrc.AbbClient(ros, '/rob1')
print('Connected.')
# Print text on FlexPenant
abb.send(rrc.PrintText('Welcome TUM to COMPAS_RRC ;)'))
# Define robot joi... | StarcoderdataPython |
1696223 | import _access, datetime, googlemaps, sys
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from db import *
sys.setrecursionlimit(100000)
db = create_engine('sqlite:///data/mke_wibrs_db.db', echo = False)
Session = sessionmaker(bind = db)
session = Session()
access = _access.google_api_t... | StarcoderdataPython |
1720750 | <filename>sfp/utils.py<gh_stars>1-10
#!/usr/bin/python
"""various utils
"""
import os
import numpy as np
import matplotlib.pyplot as plt
import scipy as sp
from . import stimuli as sfp_stimuli
from bids import BIDSLayout
import pandas as pd
from . import first_level_analysis
from . import tuning_curves
import warnings... | StarcoderdataPython |
4814579 | from ConfigParser import ConfigParser
import glob
import os
# thanks, OEDA! https://github.com/openeventdata/scraper/blob/master/scraper.py
def _parse_config(parser):
try:
if 'Auth' in parser.sections():
auth_db = parser.get('Auth', 'auth_db')
auth_user = parser.get('Auth', 'auth_u... | StarcoderdataPython |
164547 | <gh_stars>0
# Import Modules
import os, pygame
from pygame.locals import *
from pygame.compat import geterror
import time
from random import randint
if not pygame.font: print('Warning, fonts disabled')
if not pygame.mixer: print('Warning, sound disabled')
# Load data for generating image on the screen.
data_dir = "..... | StarcoderdataPython |
3249808 | from manim import *
class Intro(Scene):
def construct(self):
ok = Text("OK", t2c={'O':YELLOW}).scale(2)
oykamal = Text("oykamal", t2c={'oy':YELLOW}).scale(2)
lets = Text("lets start")
message = TextMobject(r"I'm going to teach you the basic concept of ", r"Program... | StarcoderdataPython |
3261014 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# @Author: <NAME> (<EMAIL>)
# @Date: 2021-10-03
# @Filename: __init__.py
# @License: BSD 3-clause (http://www.opensource.org/licenses/BSD-3-Clause)
__all__ = [
"PlcController",
]
from .controller import PlcController
| StarcoderdataPython |
3206671 | <filename>2019/exam_solutions-2019December/question5.py
def calc(a,b):
mul = a * b
summation = a + b
difference = a - b
return (mul, summation, difference)
## Wrong solutions
result = calc(5,4)
print(result) | StarcoderdataPython |
3318377 | <filename>tech/MACD.py
# -*- coding: UTF-8 -*-
import pandas as pd
import numpy as np
from tech import StockTechIndicator
from util import StockUtil as su
class MACD(StockTechIndicator):
def __init__(self):
StockTechIndicator.__init__(self)
def calculate(self, stock_code, date, short=12, long=26, mid... | StarcoderdataPython |
3318013 | from sklearn.neural_network import MLPRegressor
class RegressionModel:
model = None
def __init__(self, no_hidden):
self.model = MLPRegressor(hidden_layer_sizes=(no_hidden, ),
activation='relu',
solver='adam',
alpha=0.0001,
... | StarcoderdataPython |
3202434 | import crawler.function.UVa as __CrawlerUVa
import crawler.function.POJ as __CrawlerPOJ
__crawler_problems_entry = {
'UVA_PROBLEMS': __CrawlerUVa.get_problems,
'POJ_PROBLEMS': __CrawlerPOJ.get_problems
}
__crawler_submissions_entry = {
'UVA_SUBMISSIONS': __CrawlerUVa.get_submissions,
'POJ_SUBMISSIONS... | StarcoderdataPython |
148967 | """
Copyright Declaration (C)
From: https://github.com/leeykang/
Use and modification of information, comment(s) or code provided in this document
is granted if and only if this copyright declaration, located between lines 1 to
9 of this document, is preserved at the top of any document where such
information, co... | StarcoderdataPython |
3216286 | """Broker application module."""
import sys
import os.path
import tornado
import logging
from tornado.options import define, options
from server import OTAServerApplication
from coap import COAP_PORT, COAP_HOST
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s - %(name)14s - '
... | StarcoderdataPython |
1624475 | <reponame>mitchnm/GALLERY
from django.db import models
# Create your models here.
class Location(models.Model):
location = models.CharField(max_length=35, unique=True)
def __str__(self):
return self.location
def save_location(self):
self.save()
class Category(models.Model):
category... | StarcoderdataPython |
1732115 | from .core import DirectNBody
| StarcoderdataPython |
1652333 | import sqlite3
con = sqlite3.connect(":memory:")
con.execute("create table lang (id integer primary key, name varchar unique)")
# Successful, con.commit() is called automatically afterwards
with con:
con.execute("insert into lang(name) values (?)", ("Python",))
# con.rollback() is called after the with block fin... | StarcoderdataPython |
132654 | <filename>ffmpeg/utils.py
import collections
import re
Progress = collections.namedtuple('Progress', [
'frame', 'fps', 'size', 'time', 'bitrate', 'speed'
])
progress_pattern = re.compile(
r'(frame|fps|size|time|bitrate|speed)\s*\=\s*(\S+)'
)
def build_options(options):
arguments = []
for key, value ... | StarcoderdataPython |
1676389 | """
Qualquer número natural de quatro algarismos pode ser dividido em duas dezenas
formadas pelos seus dois primeiros e dois últimos dígitos.
Exemplos:
1297: 12 e 97.
5314: 53 e 14.
5314 --> 53*100 + 14
Escreva um programa que imprime todos os milhares (4 algarismos)
1000 <= n < 10000
cuja raiz quadrada seja a soma da... | StarcoderdataPython |
3252350 | <reponame>zaqwes8811/coordinator-tasks
#-*- coding: utf-8 -*-
import io
import os
import IOOperations
import PreProc
''' CallBacks '''
def cbIncCondition( item ):
return 'define' in item
def cbAsmCondition( item ):
return 'ifdef' in item or 'ifndef' in item
''' CallBacks '''
def cbIncGetFileList( dirForFound, typ... | StarcoderdataPython |
3288451 | # Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import errno
import os
from contextlib import contextmanager
from pants.base.deprecated import deprecated_conditional
from pants.base.exceptions import TaskError
from pants.task.task impo... | StarcoderdataPython |
1774268 | """Package implementing data preprocessing methods."""
from .base import DataTransformer
from .base import InvertibleDataTransformer
from .standardize import Standardizer
from .pca import PCA
| StarcoderdataPython |
1703007 | <gh_stars>0
# Generated by Django 3.2.5 on 2021-07-09 17:51
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('contributions', '0002_tweetspythontips'),
]
operations = [
migrations.RemoveField(
model_name='tweetspythontips',
... | StarcoderdataPython |
58410 | #
# file: gd_1d.py
#
# 1D example of GD
#
# RTK, 14-Feb-2021
# Last update: 14-Feb-2021
#
################################################################
import sys
import os
import numpy as np
import matplotlib.pylab as plt
# The function and its derivative
def f(x):
return 6*x**2 - 12*x + 3
def d(x):
... | StarcoderdataPython |
3280591 | """
_AlcaHarvest_
"""
import os
import time
import threading
import logging
from WMCore.WMBS.File import File
from WMCore.JobSplitting.JobFactory import JobFactory
from WMCore.DAOFactory import DAOFactory
from WMCore.Services.UUIDLib import makeUUID
class AlcaHarvest(JobFactory):
"""
_AlcaHarvest_
Unde... | StarcoderdataPython |
4836659 | ######################################################################################################################
# Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. #
# ... | StarcoderdataPython |
1673999 | # -*- coding: utf-8 -*-
"""
celery.worker.job
~~~~~~~~~~~~~~~~~
This module defines the :class:`Request` class,
which specifies how tasks are executed.
:copyright: (c) 2009 - 2012 by <NAME>.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import loggin... | StarcoderdataPython |
175048 | """
This indexer is for the Sample objects represented in the SampleService and
the SampleSet object in the Workspace.
"""
# import uuid
from src.utils.es_utils import _get_document
from src.utils.sample_utils import get_sample as _get_sample
def _flatten_meta(meta, prefix=None):
""" Flattens metadata fields in a... | StarcoderdataPython |
3318453 | from __future__ import annotations
import re
from bisect import bisect
from functools import reduce
from re import sub
from string import ascii_lowercase
from typing import Callable
from typing import Iterable
from typing import cast
from hypothesis.strategies import SearchStrategy
from hypothesis.strategies import c... | StarcoderdataPython |
3307130 | <reponame>dolikemc/hosttheway
from django.test import Client
from wagtail.tests.utils import WagtailPageTests
from django.contrib.auth.admin import User
class BasicWagtailTest(WagtailPageTests):
def setUp(self) -> None:
self.client = Client()
def test_start(self) -> None:
response = self.clie... | StarcoderdataPython |
29081 | from anndata import AnnData
import numpy as np
import pandas as pd
from scipy.sparse import csr_matrix
from joblib import delayed
from tqdm import tqdm
import sys
import igraph
from .utils import ProgressParallel
from .. import logging as logg
from .. import settings
def pseudotime(adata: AnnData, n_jobs: int = 1, ... | StarcoderdataPython |
3205826 | import numpy as np
from math import floor, ceil, sqrt
from numba import jitclass, float64, boolean, int64, prange
from typing import List
spec = [
('heads', int64[:]),
('nexts', int64[:]),
('shifts', int64[:]),
('xmin', float64),
('xmax', float64),
('ymin', float64),
('ymax'... | StarcoderdataPython |
3361763 | <gh_stars>0
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.cluster import KMeans
X = np.array([12, 20, 28, 18, 29, 33, 24, 45, 45, 52, 51, 52, 55, 53, 55, 61, 64, 69, 72])
y = np.array([39, 36, 30, 52, 54, 46, 55, 59, 63, 70, 66, 63, 58, 23, 14, 8, 19, 7, ... | StarcoderdataPython |
3363110 | buffer = [None]*10
for i in range (0,14):
buffer[i] = 7
print("Admin Granted") | StarcoderdataPython |
1773709 | # encoding=utf8
# This is temporary fix to import module from parent folder
# It will be removed when package is published on PyPI
import sys
sys.path.append('../')
# End of fix
from NiaPy.algorithms.modified import SelfAdaptiveDifferentialEvolution
from NiaPy.util import StoppingTask
from NiaPy.task.task import Optim... | StarcoderdataPython |
3378930 | <filename>pipe_event2.py
'''
pipe_event2
===========
This module provides a Event class which behaves just like threading.Event
but is based on two pipes created using os.pipe() functions.
Before Python 3.3, monotonic time is not introduced so adjusting system
clock may affect Event.wait() function if specific timeou... | StarcoderdataPython |
1677076 | #!/usr/bin/env python2
# -----------------------------------------------------------------------------
# @author:
# <NAME>, Jun 23rd, 2017
# -----------------------------------------------------------------------------
import graph_util.init_path as init_path
from util import logger
import graph_util.mujoco_p... | StarcoderdataPython |
1634878 | <filename>plotting/paper_appendix_imagenet_r.py
import os
from os.path import join, exists
import argparse
import pathlib
from enum import Enum
import click
import numpy as np
import pandas as pd
import download_data
import dataframe
import plotter
from model_types import ModelTypes, model_types_map
class DeepAugme... | StarcoderdataPython |
3391437 | <reponame>brandongk-ubco/ensembler
from ensembler.datasets.CompressedNpzDataset import CompressedNpzDataset
class CityscapesDataset(CompressedNpzDataset):
classes = [
"road", "sidewalk", "building", "wall", "fence", "pole",
"traffic light", "traffic sign", "vegetation", "terrain", "sky",
"... | StarcoderdataPython |
13708 | # Generated by Django 2.1.11 on 2020-06-04 09:19
from django.db import migrations, models
def fix_period_before_after(apps, schema_editor):
# noinspection PyPep8Naming
Form = apps.get_model("iaso", "Form")
for form in Form.objects.filter(period_type=None).exclude(periods_before_allowed=0, periods_after_... | StarcoderdataPython |
133931 | <gh_stars>0
from drf_spectacular.types import OpenApiTypes
from drf_spectacular.utils import (
extend_schema_view,
extend_schema,
OpenApiParameter,
OpenApiExample,
)
from rest_framework import viewsets, mixins
from rest_framework.exceptions import ValidationError
from rest_framework.parsers import FileU... | StarcoderdataPython |
3239553 | from zipline.api import symbol
from zipline.data import bundles
def initialize(context):
context.asset = symbol('GBPUSD')
bundle = bundles.load('custom_history')
print(bundle.asset_finder.retrieve_all(bundle.asset_finder.sids))
def handle_data(context, data):
# print(data.current(context.asset, 'pri... | StarcoderdataPython |
3369523 | # -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making BK-BASE 蓝鲸基础平台 available.
Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
BK-BASE 蓝鲸基础平台 is licensed under the MIT License.
License for BK-BASE 蓝鲸基础平台:
------------------------------------------... | StarcoderdataPython |
3398508 | <gh_stars>10-100
import utils
import models.bayes
from models import vae
import models.lenet
| StarcoderdataPython |
1613542 | import pytest
from app.api.services import assessments
from app.models import Assessment, Domain, Supplier, SupplierDomain, db
from tests.app.helpers import BaseApplicationTest
class TestAssessmentsService(BaseApplicationTest):
def setup(self):
super(TestAssessmentsService, self).setup()
@pytest.fix... | StarcoderdataPython |
1619273 | <gh_stars>1-10
# ------------------------------------------------------------------
# Copyright (c) 2020 PyInstaller Development Team.
#
# This file is distributed under the terms of the GNU General Public
# License (version 2.0 or later).
#
# The full license is available in LICENSE.GPL.txt, distributed with
# this so... | StarcoderdataPython |
1628766 | <gh_stars>0
import time
def createMenu(*ops, stop='cancelar', msg=''):
if msg:
print(msg)
for pos, op in enumerate(ops):
print(f'{pos + 1} - {op.capitalize() if op else "default"}')
print(f'0 - {stop.capitalize()}')
def show(msg=''):
print(msg)
def delay(msg='', seg=1.0):
print(ms... | StarcoderdataPython |
140645 | import sys
import json
import string
import datetime
import os
output_file = open("mpd_dataset.txt", "w", encoding='raw_unicode_escape')
#uniquePlaylists = open("challenge_playlists_unique.txt", "w", encoding='raw_unicode_escape')
#uniqueTracks = open("challenge_tracks_unique.txt", "w", encoding='raw_unicode_e... | StarcoderdataPython |
129526 | from flask_wtf import FlaskForm
from wtforms import (
BooleanField,
PasswordField,
SelectField,
StringField,
SubmitField,
ValidationError,
)
from wtforms.validators import DataRequired, Email, EqualTo, Length, Regexp
from pili.jinja_filters import permissions2str
from pili.models import Role, U... | StarcoderdataPython |
3242629 | <reponame>pgruening/ConvNeXt<filename>exe_eval_caltech.py
from ast import arg
import subprocess
import os
import argparse
def get_options():
parser = argparse.ArgumentParser()
parser.add_argument('--index', type=int, default=0)
return parser.parse_args()
GPUS = [2, 3, 4, 5, 6, 7]
GPUS = [0]
BITSTRINGS ... | StarcoderdataPython |
32840 | #
# See top-level LICENSE.rst file for Copyright information
#
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
from collections import OrderedDict
from ..defs import (task_name_sep, task_state_to_int, task_int_to_state)
from ...util import option_list
from ...io import find... | StarcoderdataPython |
3363157 | from django.conf import settings as django_settings
PAGE_TITLE = getattr(django_settings, 'LOG4DJANGO_PAGE_TITLE', 'log4django')
CONNECTION_NAME = getattr(django_settings, 'LOG4DJANGO_CONNECTION_NAME', 'default')
DEFAULT_APP_ID = getattr(django_settings, 'LOG4DJANGO_DEFAULT_APP_ID', None)
GERMAN_TASK_NAME = getattr(d... | StarcoderdataPython |
1745677 | <filename>carts/models.py
from django.conf import settings
from decimal import Decimal
from django.db import models
from django.db.models.signals import pre_save, post_save, m2m_changed
import math
from products.models import Product
User = settings.AUTH_USER_MODEL
class CartManager(models.Manager):
def new_or_... | StarcoderdataPython |
3219749 | <reponame>robertwb/sage
"""
Edit the source code of Sage interactively
AUTHORS:
- <NAME>
- <NAME> -- touch up for inclusion in Sage.
- <NAME>: Make it usable on extension classes that do not have
a docstring; include this module into the reference manual and
fix some syntax errors in the doc strings.
This module... | StarcoderdataPython |
162358 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'untitled.ui'
# Created by: PyQt5 UI code generator 5.9.2
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets,QtWebEngineWidgets
import io,sys,folium
from PyQt5.QtGui import *
from PyQt5.QtW... | StarcoderdataPython |
100524 | <gh_stars>10-100
from numpy import ndindex, savetxt
def save_array(
file, data, fmt="%7.2f", delimiter=",", header="data", slice="slice", sep=":"
):
"""Function to save numpy nD arrays. Therefore the array is sliced except for
the last 2 dimenions.
Parameters
----------
file: str
the... | StarcoderdataPython |
3240612 | import torchvision.datasets as datasets
from torch.utils.data import SubsetRandomSampler, DataLoader
from torchvision import transforms
import torch
import params
transform = transforms.Compose([transforms.ToTensor(),
transforms.Normalize(mean=(0.1307,), std=(0.3081,))
... | StarcoderdataPython |
3319465 | <filename>intermediate/03_json_and_regex.py
# json
# regex
| StarcoderdataPython |
63919 | <reponame>alpesh-te/pyTenable
'''
Testing the Agents schemas
'''
from tenable.io.v3.vm.agents.schema import AgentSchema
def test_agent_groups_schema_with_name():
'''
Test the agents schema with name
'''
payload = {
'items': [
'57b74c0a-5d95-11ec-bf63-0242ac130002',
'57b... | StarcoderdataPython |
4812745 | import numpy
from nonbonded.library.statistics.statistics import (
StatisticType,
bootstrap_residuals,
compute_statistics,
)
N_DATA_POINTS = 1000
N_ITERATIONS = 1000
def test_rmse():
"""Test that the statistics module returns the 'correct' RMSE
to within some noise given a set of noisy estimated... | StarcoderdataPython |
68422 | # -*- coding: utf-8 -*-
from Views.mainFinanceiro import Ui_ct_MainFinanceiro
from movconta import MainMovimentoConta
from areceber import MainAReceber
from apagar import MainAPagar
from Funcoes.data import DataAtual
class MainFinanceiro(Ui_ct_MainFinanceiro, DataAtual, MainMovimentoConta,
MainAR... | StarcoderdataPython |
1700883 | <gh_stars>100-1000
import FWCore.ParameterSet.Config as cms
process = cms.Process("Test")
process.source = cms.Source("EmptySource")
process.fail = cms.EDProducer("FailingProducer")
process.readFail = cms.EDProducer("AddIntsProducer", labels = cms.VInputTag("fail"))
process.a = cms.EDProducer("BusyWaitIntProducer"... | StarcoderdataPython |
1723876 | from abc import ABC, abstractmethod
from itertools import chain, product
from collections import deque
import numpy as np
class SynapsesBuilder(object):
"""
Builder devoted to construct the ANN graph arch. from a config. dict.
"""
def __init__(self, topology):
self.topology = topology... | StarcoderdataPython |
1658684 | <reponame>yakutovicha/aiida-zeopp<filename>aiida_zeopp/__init__.py
"""
AiiDA Zeo++ Plugin
"""
__version__ = "0.1.2"
| StarcoderdataPython |
4828009 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Browser based Web App
Purpose: Battery Monitoring on a RPI with a PICAN2 Board
Version: 4/2018 Roboball (MattK.)
"""
import dash
from dash.dependencies import Input,Output, State, Event
import dash_core_components as dcc
import dash_html_components as html
import base64... | StarcoderdataPython |
1742325 | <gh_stars>0
from django.db import models
from django.utils.translation import ugettext_lazy as _
from localflavor.us.models import USStateField, USZipCodeField
class Educator(models.Model):
""" An educator has to fill out this form before they can download vouchers
for their students. """
ORG_CHOICES = ... | StarcoderdataPython |
3246064 | import json
from types import SimpleNamespace
import relogic.utils.crash_on_ipy
from relogic.logickit.base.constants import DOCIR_TASK
from relogic.logickit.dataflow import TASK_TO_DATAFLOW_CLASS_MAP, DocPointwiseDataFlow
from relogic.logickit.tokenizer.tokenization import BertTokenizer
config = SimpleNamespace(
**... | StarcoderdataPython |
1745639 | #!/shared/anaconda/bin/python
# encoding=utf8
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
from builtins import bytes, chr
from builtins import str
from builtins import dict
from builtins import object
from builtins import range
from builtins import map
... | StarcoderdataPython |
99182 | <filename>mir/sre/__init__.py
# Copyright (C) 2017 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | StarcoderdataPython |
3264680 | <gh_stars>1-10
def info(message):
print(green('[info] {}'.format(message)))
def warn(message):
print(yellow('[warn] {}'.format(message)))
def error(message):
print(red('[error] {}'.format(message)))
def _wrap_with(code):
def inner(text, bold=False):
c = code
if bold:
c ... | StarcoderdataPython |
3384835 | class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution(object):
def postorderTraversal_none_recursive(self, root):
s = []
res = []
last_visited = None
while s or root:
if root:
... | StarcoderdataPython |
88943 | from flask import Blueprint, jsonify, request
from psycopg2 import sql
from app.postgres import Database
from app.models import check_auth, authorize
from vacancy.create_new_vacancy import check_fields
manage_candidat_bp = Blueprint('manage_candidat', __name__)
@manage_candidat_bp.route('/get_statuses_candidat', m... | StarcoderdataPython |
3362196 | import csv
# from multiprocessing import Pool
import nltk
from spacy import load
from nltk.sentiment import SentimentIntensityAnalyzer
from stsci.learning.corpus import get_messages, username_lookup, rmcode
from stsci.learning.settings import TAG_LOOKUP
sia = SentimentIntensityAnalyzer()
nlp = load("en_core_web_lg"... | StarcoderdataPython |
1619351 | <gh_stars>100-1000
# -*- coding: iso-8859-15 -*-
"""Conf FunkLoad test
$Id$
"""
import unittest
from random import random
from funkload.FunkLoadTestCase import FunkLoadTestCase
from funkload.utils import extract_token
from funkload.utils import xmlrpc_get_credential
class Jcourse(FunkLoadTestCase):
"""This test u... | StarcoderdataPython |
193774 | from losses import initialize_flownet
from model import Pix2Pix
from utils import get_train_test_files, get_data_gen, get_data_gen_frames
from keras.utils.vis_utils import plot_model
import tensorflow as tf
from keras.backend.tensorflow_backend import set_session
import os
config = tf.ConfigProto()
config.gpu_options.... | StarcoderdataPython |
3322156 | # -*- coding: utf-8 -*-
# Copyright 2018 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/
#
# or in t... | StarcoderdataPython |
145396 |
import argparse
import subprocess
from time import sleep
from notebuild.shell import run_shell, run_shell_list
from notecron.tasks import start
from notetool.tool.log import log
logger = log("notebuild")
class JobScheduler:
def __init__(self):
pass
def start(self):
logger.info("start")
... | StarcoderdataPython |
110678 | <reponame>Teichlab/celltypist
import os
from anndata import AnnData
from typing import Optional, Union
import numpy as np
import pandas as pd
_samples_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "data", "samples")
def _get_sample_data(filename: str) -> str:
"""Get the full path to the sample ... | StarcoderdataPython |
1613951 | """
Copyright 2020 The OneFlow 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 applicable law or agr... | StarcoderdataPython |
3248686 | <reponame>jylins/CORE-Text
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmdet.models.builder import HEADS
from mmdet.core import roi2bbox, multi_apply
from .convfc_bbox_head import Shared2FCBBoxHead
@HEADS.register_module()
class VRM2FCBBoxHead(Shared2FCBBoxHead):
"""BBox Head with Van... | StarcoderdataPython |
1623184 | import logging
import numpy as np
from scipy.integrate import quad
from scipy.interpolate import BarycentricInterpolator
from pySDC.core.Errors import CollocationError
class CollBase(object):
"""
Abstract class for collocation
Derived classes will contain everything to do integration over intervals and... | StarcoderdataPython |
159863 | from django.conf.urls import url
from timepiece.entries import views
urlpatterns = [
url(r'^time/$',
views.Dashboard.as_view(),
name='dashboard'),
# Active entry
url(r'^entry/clock_in/$',
views.clock_in,
name='clock_in'),
url(r'^entry/clock_out/$',
views.clock_... | StarcoderdataPython |
1680519 | <filename>database/sql.py
import psycopg2
def record_win(name, duration, conn, cur):
"""
Record a player win in the database
Update the player SQL object to reflect that they just won.
Args:
name (str): The name of the player
duration (int): The duration of the match, in seconds
... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.