id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
1669006 | from django.db import models
class Tag(models.Model):
name = models.CharField(max_length=250)
def __str__(self):
return self.name
class Entity(models.Model):
slug = models.SlugField(unique=True)
title = models.CharField(max_length=250)
text = models.TextField()
creation_date = model... | StarcoderdataPython |
1718549 | <gh_stars>0
# DO NOT EDIT: File is generated by code generator.
from pokepay_partner_python_sdk.pokepay.request.request import PokepayRequest
from pokepay_partner_python_sdk.pokepay.response.shop_with_accounts import ShopWithAccounts
class UpdateShop(PokepayRequest):
def __init__(self, shop_id, **rest_args):
... | StarcoderdataPython |
48971 | <gh_stars>1-10
#------------------------------------------------------------------------------
# Libraries
#------------------------------------------------------------------------------
# Standard
import numpy as np
# User
from .base.base_mlreg import BaseMLRegressor
#------------------------------------------------... | StarcoderdataPython |
106935 | <filename>pydoh.py
"""
DoH JSON client in Python
"""
import json
import urllib3
import sys
import argparse
import socket
import signal
import random
# noinspection PyShadowingBuiltins, PyUnusedLocal
def handler(sgn, frame):
"""
:param sgn:
:param frame:
:return:
"""
sys.... | StarcoderdataPython |
3210271 | <filename>html_parsing/get_game_genres/export_import/import.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
import json
import sys
sys.path.append('..')
from db import Dump
import peewee
from playhouse.shortcuts import dict_to_model
from export import FILE_NAME_EXPORT_JSON
items = jso... | StarcoderdataPython |
43842 | """baseline
Revision ID: 398d6252cdce
Revises:
Create Date: 2020-03-12 10:10:15.689958
"""
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import mysql
# revision identifiers, used by Alembic.
revision = '398d6252cdce'
down_revision = None
branch_labels = None
depends_on = None
def upgrade... | StarcoderdataPython |
4812550 | <reponame>uni-tue-kn/p4-ipsec
import cmd
def start_cli(ctrl):
cmd = CLI()
cmd.set_controller(ctrl)
cmd.cmdloop()
ctrl.teardown()
class CLI(cmd.Cmd):
def set_controller(self, controller):
self.controller = controller
def do_EOF(self, line):
return True
def do_connections... | StarcoderdataPython |
4812603 | <reponame>alexandr1221/drf-angularjs-todolist
from models import TodoItem
from rest_framework import viewsets
from django.shortcuts import render_to_response
from django.template import RequestContext
from serializers import TodoItemSerializer
class TodoItemViewSet(viewsets.ModelViewSet):
queryset = TodoItem.obj... | StarcoderdataPython |
1743911 | # Mentor = <NAME>
# Author = <NAME>
def hitungBB(sts, jenis):
if jenis == "bmi":
r = (int(sts) - 100) - (10 / 100 * (int(sts) - 100))
print("Berat badan ideal kamu adalah : ", r, "kg")
elif jenis == "bmiW":
r = (int(sts)- 100)-(15 / 100 *(int(sts) - 100))
print("Berat badan idea... | StarcoderdataPython |
100317 | # Copyright 2016-present CERN – European Organization for Nuclear Research
#
# 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... | StarcoderdataPython |
3288049 | from setuptools import setup
setup(name="ciforecast",
version="0.1.1",
description="Basic Pip Module for Carbon Intensity Forecasting",
url="https://github.com/juliandehoog/carbon-intensity-forecast",
author="<NAME>",
author_email="<EMAIL>",
packages=[
"ciforecast",
... | StarcoderdataPython |
1783474 | <filename>PythonBasics/Files,Exceptions and functions/RegEx.py
"""
......................Regular Expressions.....................
..........................match method.................
////////////////////////////////////////
what is the importance of * and **
////////////////////////////////////////
import re
#pri... | StarcoderdataPython |
1791946 | from controllers.application_ctrl import ApplicationCtrl
def main():
chessmanager = ApplicationCtrl()
chessmanager.run()
if __name__ == "__main__":
main()
| StarcoderdataPython |
1715228 | import sys
try:
from osgeo import ogr, osr, gdal
except:
sys.exit('ERROR: cannot find GDAL/OGR modules') | StarcoderdataPython |
4814734 | try:
import sl1m.planner as sl1m
except ImportError:
message = "ERROR: Cannot import SL1M python library.\n"
message += "Did you correctly installed it?\n"
message +="See https://gepgitlab.laas.fr/loco-3d/sl1m"
raise ImportError(message)
from pinocchio.utils import *
import importlib
import multicon... | StarcoderdataPython |
91585 | <gh_stars>1-10
from SimPEG import *
import simpegEM as EM
from pymatsolver import MumpsSolver
cs, ncx, ncy, ncz, npad = 20., 30, 20, 30, 12
hx = [(cs,npad,-1.4), (cs,ncx), (cs,npad,1.4)]
hy = [(cs,npad,-1.4), (cs,ncy), (cs,npad,1.4)]
hz = [(cs,npad,-1.4), (cs,ncz), (cs,npad,1.4)]
mesh = Mesh.TensorMesh([hx,hy,hz], 'CC... | StarcoderdataPython |
1630246 | <reponame>sdall/scikit-mine<filename>skmine/itemsets/slim.py<gh_stars>0
"""SLIM pattern discovery"""
# Authors: <NAME> <<EMAIL>>
# License: BSD 3 clause
from collections import defaultdict
from functools import lru_cache, reduce
from itertools import chain
import numpy as np
import pandas as pd
from sortedcontainers... | StarcoderdataPython |
3307995 | <reponame>jessejohn01/CSCI446PA2<gh_stars>0
import network_3_0
import argparse
import time
from time import sleep
import hashlib
class Packet:
## the number of bytes used to store packet length
seq_num_S_length = 10
length_S_length = 10
## length of md5 checksum in hex
checksum_length = 32
... | StarcoderdataPython |
3219167 | <reponame>WeitaoZC/iflow<filename>examples/UQ_comp.py
#coding=utf-8
'''
Script processing results from the well-trained model for artificialy made uq data
'''
from operator import ne
import os, torch
from numpy.lib.function_base import average, select
import numpy as np
import scipy.io as spio
from scipy.linalg import ... | StarcoderdataPython |
25751 | <reponame>mbatchkarov/dc_evaluation
__author__ = 'mmb28'
import sys
sys.path.append('.')
sys.path.append('..')
sys.path.append('../..') | StarcoderdataPython |
3341039 | # coding: utf-8
def test_default_value(printer):
assert printer._bold is False
def test_changing_no_value(printer):
printer.bold()
assert printer._bold is False
def test_changing_state_on(printer):
printer.bold(True)
assert printer._bold is True
def test_changing_state_off(printer):
prin... | StarcoderdataPython |
111522 | import logging
from datetime import datetime
from django.conf import settings
from django.http import HttpResponse, HttpResponseForbidden, JsonResponse
from django.views.generic import View
from google.appengine.api import search
import requests
from dinela_search.models import Restaurant
from dinela_search.parser im... | StarcoderdataPython |
4826239 | <reponame>Maastro-CDS-Imaging-Group/SQLite4Radiomics
from typing import List, Optional, Any, Dict
from dal.database_connector import DatabaseConnector
from dal.patient_repository import PatientRepository
from logic.entities.patient import Patient
from test.mock_ups.dal.repository import RepositoryMockUp
class Patien... | StarcoderdataPython |
1717474 | import re
while True:
字符串 = input('> ')
m = re.match('[-+]?(?:[A-Za-z-]+://)?www\.[A-Za-z_-]+\.(?:com|edu|net)/?', 字符串)
if m is not None:
print(m.group()) | StarcoderdataPython |
127606 | """
Beautiful Arrangement
Suppose you have n integers labeled 1 through n. A permutation of those n integers perm (1-indexed) is considered a beautiful arrangement if for every i (1 <= i <= n), either of the following is true:
perm[i] is divisible by i.
i is divisible by perm[i].
Given an integer n, return t... | StarcoderdataPython |
87601 | from random import randint
import os
# This class define the entire game board
# It will be used to create two boards, one for storing what the player sees and one for storing the underlying mines and mine numbers around a given block
# I'm new to classes in python (or anywhere else), so this file will be heavily comme... | StarcoderdataPython |
1732676 | import itertools
import logging
import math
from copy import deepcopy
import numpy as np
import pandas as pd
from scipy.ndimage.filters import uniform_filter1d
import basty.utils.misc as misc
np.seterr(all="ignore")
class SpatioTemporal:
def __init__(self, fps, stft_cfg={}):
self.stft_cfg = deepcopy(st... | StarcoderdataPython |
3210717 | <reponame>lycantropos/dendroid
from hypothesis import given
from tests.utils import (KeysView,
KeysViewsPair,
KeysViewsTriplet,
is_left_subtree_less_than_right_subtree,
to_height,
to_max_binary_... | StarcoderdataPython |
1718331 | <gh_stars>0
from kivy.uix.button import Button
class AddButton(Button):
def __init__(self):
super(AddButton, self).__init__()
self.text = 'Add'
def add_to_sequence(self, instance, signal_value, slider_value, log):
print("The button {} will sent {} {}".format(instance.text, signal_value... | StarcoderdataPython |
4578 | # Generated by Django 2.2.4 on 2019-10-03 21:09
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('ingreso', '0003_auto_20190907_2152'),
]
operations = [
migrations.AlterField(
model_name='detal... | StarcoderdataPython |
3214959 | <reponame>caidevOficial/Python_Platzi
# MIT License
#
# Copyright (c) 2021 [FacuFalcone]
#
# 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 th... | StarcoderdataPython |
1662784 | <reponame>ross-schlie/exercism-Python-track<filename>guidos-gorgeous-lasagna/lasagna.py
"""exercism lasagna module."""
EXPECTED_BAKE_TIME = 40 # how many minutes the lasagna should bake in the oven
PREPARATION_TIME = 2 #the time it takes to prepare a single layer
def bake_time_remaining(elapsed_bake_time):
"""Cal... | StarcoderdataPython |
1602942 | <reponame>ikestar99/endopy<gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri May 28 10:29:19 2021
@author: ike
"""
import sys
import shutil
import os.path as op
import readlif.reader as rr
from ..main import tqdm
from ..utils.base import BasePipeline
from ..utils.pathutils import (
get... | StarcoderdataPython |
1751650 | import sys
import maya.cmds as cmds
from mGui.core import Control
import maya.mel as mel
class UserCancelledProgress(RuntimeError):
pass
class ProgressBar(Control):
"""
mGui style wrapper for ProgressBar
Use start() and end() to avoid the cumbersome (cmds.progressBar('xxx', e=True, beginProgress = ... | StarcoderdataPython |
3291025 | <filename>Release/Tests/AnalysisTest/Python.VS.TestData/Grammar/DictComp.py
{foo:bar for foo,bar in baz}
{foo:bar for foo,bar in baz if quox}
{foo:bar for foo,bar in baz for quox in Exception}
| StarcoderdataPython |
1740463 | # dictionary of all available drivers
all_drivers = dict(
gps="osgar.drivers.gps:GPS",
imu="osgar.drivers.imu:IMU",
spider="osgar.drivers.spider:Spider",
serial="osgar.drivers.logserial:LogSerial",
can="osgar.drivers.canserial:CANSerial",
simulator="osgar.drivers.simulator:SpiderSimulator",
... | StarcoderdataPython |
95463 | <reponame>guyfreund/data_drift_detection
from unittest import TestCase
import logging
from src.pipeline.datasets.training_datasets import BankMarketingDataset, GermanCreditDataset
from src.pipeline.model.model_trainining_manager import MultipleDatasetModelTrainingManager, ModelTrainingManagerInfo
from src.pipeline.mod... | StarcoderdataPython |
3351570 | # Pyrogram - Telegram MTProto API Client Library for Python
# Copyright (C) 2017-2021 Dan <https://github.com/delivrance>
#
# This file is part of Pyrogram.
#
# Pyrogram 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... | StarcoderdataPython |
1799096 | <gh_stars>1-10
import preparenovonix.novonix_prep as prep
from preparenovonix.compare import plot_vct
# The r" " are needed to handle Windows paths
# otherwise ' ' can be enough to include the path.
infile = r"example_data/example_data.csv"
# Prepare the Novonix data file
prep.prepare_novonix(infile, addstate=True, l... | StarcoderdataPython |
193787 | <filename>segmentation_models_pytorch/encoders/dpn.py
""" Each encoder should have following attributes and methods and be inherited from `_base.EncoderMixin`
Attributes:
_out_channels (list of int): specify number of channels for each encoder feature tensor
_depth (int): specify number of stages in decoder (... | StarcoderdataPython |
3226316 | <gh_stars>0
from bokeh.plotting import figure, output_file, show
from bokeh.charts import Bar
from PdFrame import get_good_columns
import pandas as pd
selector = "Aussenfarbe_"
df, good_columns = get_good_columns()
columns = []
for col in df.columns.values:
if selector in col:
columns.append(col)
df[... | StarcoderdataPython |
3393626 | from models.orders_model import orders
from models.clients_model import clients
from models.items_model import items
from models.transactions_model import transactions
from models.order_logistics_model import order_logistics
from services.dbconn import DBConn
class FactoryModel():
obj = None
index = None
... | StarcoderdataPython |
139819 | <gh_stars>0
"""
Random Agent.
"""
import torch
import torch.nn as nn
from torch.nn.functional import one_hot
class RandomAgent(nn.Module):
def __init__(self, action_space='discrete', n_actions=2, action_range=(-1, 1)):
super(RandomAgent, self).__init__()
self.action_space = action_space
s... | StarcoderdataPython |
3244239 | <reponame>KejiZhaoLab/cLoops2<filename>cLoops2/cLoops2.py<gh_stars>10-100
#!/usr/bin/env python3
#--coding:utf-8 --
"""
cLoops2 main interface.
"""
__author__ = "<NAME>"
__date__ = ""
__modified__ = ""
__email__ = "<EMAIL>"
__version__ = "0.0.3"
#sys library
import warnings
warnings.filterwarnings("ignore")
import o... | StarcoderdataPython |
3338452 | <reponame>recognant/labyrinth<filename>level.py
class Level():
data = None
dim = (0, 0)
_defective = False
def __init__(self, path):
with open(path, 'r') as f:
content = f.readlines()
f.closed
try:
x, y, self.data = self._parse(content)
... | StarcoderdataPython |
1684265 | import sys
from typing import Union, Literal, List
from PyQt5 import QtCore, QtGui, QtWidgets
from pandasgui.store import PandasGuiStoreItem
from pandasgui.utility import summarize_json, traverse_tree_widget
from pandasgui.widgets import base_widgets
class JsonViewer(QtWidgets.QWidget, PandasGuiStoreItem):
def ... | StarcoderdataPython |
4839383 | <reponame>lynnli92/leetcode-group-solution
from heapq import heappush, heappop
class Solution:
def findItinerary(self, tickets: List[List[str]]) -> List[str]:
flights = collections.defaultdict(list)
result = []
for ticket in tickets:
heappush(flights[ticket[0]], ticket[1])
... | StarcoderdataPython |
1795999 | <reponame>bhimeshchauhan/competitive_programming
"""
Frequency of Items In subsequence of List
Given an array of integers arr and a positive integer m, your task is to find the frequency of the most common element within each contiguous subarray of length m in arr.
Return an array of these highest frequencies among s... | StarcoderdataPython |
3363591 | from typing import Union
from typing import List
from enum import Enum
from ibc.session import InteractiveBrokersSession
class MarketData():
def __init__(self, ib_client, ib_session: InteractiveBrokersSession) -> None:
"""Initializes the `MarketData` client.
### Parameters
----
i... | StarcoderdataPython |
163728 | <reponame>llja0112/counterfactual-gp
import numpy as np
class Trajectory:
def __init__(self, w, basis):
self.w = np.array(w)
self.basis = basis
def value(self, x):
return np.dot(self.basis.design(x), self.w)
class ObservationTimes:
def __init__(self, low, high, avg_n_obs):
... | StarcoderdataPython |
3349277 | """
Implementation of the CIME NCR test. This class inherits from SystemTestsCommon
Build two exectuables for this test:
The first runs two instances for each component with the same total number of tasks,
and runs each of them concurrently
The second is a default build
NOTE: This is currently untested, and may not ... | StarcoderdataPython |
1704840 | from sklearn.metrics import classification_report
from sklearn.metrics import confusion_matrix
import pandas as pd
def get_save_results(X_train, X_test, y_train, y_test, model, description, params=None):
# Fit model and log experiment
model.fit(X_train, y_train)
predictions = model.predict(X_test)
wri... | StarcoderdataPython |
3227227 | import os
import glob
import math
import subprocess
import re
import sys
from decimal import Decimal
import datetime
import getpass
from astropy.io import fits
from astropy import wcs
from astropy.io.fits import getheader
import astropy.coordinates as coord
import astropy.units as u
def logme( str ):
log.write(date... | StarcoderdataPython |
72169 | from pathlib import Path
from django.core.files.base import ContentFile
from django.utils.encoding import force_bytes
from mayan.apps.mimetype.api import get_mimetype
from mayan.apps.storage.utils import fs_cleanup, mkdtemp
from mayan.apps.testing.tests.base import BaseTestCase
from ..backends.compressedstorage impo... | StarcoderdataPython |
66450 | <reponame>achaiah/pywick
from .dataset import Dataset
class TransformDataset(Dataset):
"""
Dataset which transforms a given dataset with a given function.
Given a function `transform`, and a `dataset`, `TransformDataset` applies
the function in an on-the-fly manner when querying a sample with
`__... | StarcoderdataPython |
3353161 | import typer
import os
import sys
import requests
import json
from dotenv import load_dotenv, find_dotenv
from loguru import logger
from toolz import get, pluck, compose, get_in, thread_last
from typing import List, Dict, Any, Optional
from dataclasses import dataclass, asdict
listpluck = compose(list, pluck)
@data... | StarcoderdataPython |
1648878 | #7: Desenvolva um programa que leia as duas notas de um aluno, calcule e mostre a sua média.
n1 = float(input('Primeira nota: '))
n2 = float(input('Segunda nota: '))
m = (n1 + n2) / 2
print('A média entre {} e {} é igual a {:.1f}' . format(n1, n2, m))
| StarcoderdataPython |
1768440 | import boto3
from botocore.exceptions import ClientError
import logging
from django.conf import settings
logger = logging.getLogger('django')
SENDER = '<NAME> <<EMAIL>>'
AWS_REGION = 'us-east-1'
CHARSET = 'UTF-8'
client = boto3.client('ses', region_name=AWS_REGION)
def send_email(receiver, subject, html):
if ... | StarcoderdataPython |
3300982 | #!/usr/bin/env python
#
# generate_asm.py
#
# This source file is part of the FoundationDB open source project
#
# Copyright 2013-2018 Apple Inc. and the FoundationDB project authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# ... | StarcoderdataPython |
45466 | '''
@version: Python 3.7.3
@Author: Louis
@Date: 2020-06-15 13:27:40
LastEditors: Louis
LastEditTime: 2020-08-19 15:06:25
'''
import os
import sys
from enum import Enum
from datetime import datetime
TODAY = datetime.now().strftime("%Y%m%d")
TODAY_ = datetime.now().strftime("%Y-%m-%d")
TIME = datetime.now().strftime("... | StarcoderdataPython |
1701013 | '''
Module to load scraper as plugins
'''
import imp
import os
ScraperFolder = './scrapers'
MainModule = '__init__'
def getScrapers():
scrapers = []
possible_scrapers = os.listdir(ScraperFolder)
#print(possible_scrapers)
for i in possible_scrapers:
location = os.path.join(ScraperFolder, i)
... | StarcoderdataPython |
3361709 | <reponame>dhyon/go-spacemesh
import base64
from datetime import datetime
import pytest
from pytest_testconfig import config as testconfig
import re
import random
from random import choice
from string import ascii_lowercase
import time
# noinspection PyUnresolvedReferences
import tests.config as cnf
from tests.context ... | StarcoderdataPython |
1669671 | <reponame>rolker/noaadata
#!/usr/bin/env python
#
# A Python AIVDM/AIVDO decoder
#
# This decoder works by defining a declarative pseudolanguage in which
# to describe the process of extracting packed bitfields from an AIS
# message, a set of tables which contain instructions in the pseudolanguage,
# and a small amount... | StarcoderdataPython |
124517 | <gh_stars>1-10
import math
from typing import Iterable, Iterator, Union
class FloatToSignedFixedPointConverter:
"""
Create a fixed point representation as an unsigned int data type using two complements.
We might want to have this create its own type `FixedPointNumber` in
the future. That way we coul... | StarcoderdataPython |
54382 | # -*- coding: utf-8 -*-
import vcr
from django.test import TestCase
from rest_framework import status # noqa: F401
from rest_framework.test import APITestCase
moonshot_vcr = vcr.VCR(
serializer="json",
cassette_library_dir="./fixtures",
record_mode="once",
match_on=["uri", "method"],
filter_heade... | StarcoderdataPython |
3305034 | DEFAULT_SERVER_URL = "http://localhost:8000"
def make_config(project_name, url, period=0.1):
if url is None:
url = DEFAULT_SERVER_URL
else:
url = url.rstrip("/")
return {
'project_name': project_name,
'url': url,
'period': period,
}
| StarcoderdataPython |
1628614 | <gh_stars>1-10
import sys
import operator
import numpy as np
import matplotlib.pyplot as plt
import itertools, functools
import re
import argparse
""" Grid Layout
grid[0][0] = num_states
grid[0][1] = num_actions
"""
def load_args():
parser = argparse.ArgumentParser(description='Description of your program')
... | StarcoderdataPython |
4838268 | from .algorithmschema import AlgorithmSchema
| StarcoderdataPython |
3328980 | """
This python file inserts 100K rows into table prefetching in database end2end
"""
import pymysql
import string
import random
db = pymysql.connect(host='localhost', port=3306,
user='root', passwd='<PASSWORD>', db='end2end', charset='utf8')
cursor = db.cursor()
sql = "INSERT INTO prefetching(... | StarcoderdataPython |
169859 | from flask import request
from app.models import Menu
from flask_restful import Resource
from app.requests.menu import PostRequest, PutRequest
from app.middlewares.auth import user_auth, admin_auth
from app.middlewares.validation import validate
from app.utils import decoded_qs
class MenuResource(Resource):
@use... | StarcoderdataPython |
93032 | #!/usr/bin/env python3
import flask
import os
from PIL import Image, ImageFilter
import hashlib
import FileMimetypes as mime
app = flask.Flask(__name__)
app.jinja_env.trim_blocks = True
RELEASE_VERSION = '1.0.0'
app.config['APPLICATION_NAME'] = 'AutoGalleryIndex'
app.config['ROW_ITEMS_SHORT'] = 3
app.config['ROW_I... | StarcoderdataPython |
3316687 | """
Reasoning Visual Dialog with Sparse Graph Learning and Knowledge Transfer
<NAME>, <NAME>, <NAME>, <NAME>, <NAME>
https://arxiv.org/abs/2004.06698
"""
import numpy as np
import torch, math
import torch.nn as nn
import torch.nn.functional as F
from .net_utils import MLP
from torch.autograd import Variable
from torch.... | StarcoderdataPython |
45497 | <filename>main.py<gh_stars>0
import socket
import time
import utime
import machine
import os
import ntptime
from machine import Pin
from machine import Timer
from machine import RTC
from math import cos, sin, acos as arccos, asin as arcsin, tan as tg, degrees, radians
s = socket.socket()
#configuration... | StarcoderdataPython |
3322882 | from __future__ import absolute_import
from hashlib import md5
from sentry.testutils import TestCase
from sentry.models import EventUser
class EventUserTestCase(TestCase):
def test_build_hash(self):
cases = [
(
{
"ident": "ident",
"usern... | StarcoderdataPython |
88411 | <reponame>sagar-kohli/peragro-at<filename>tests/test_feature_extraction.py<gh_stars>1-10
import unittest
import os
from mock import Mock, patch
from damn_at.analyzers.audio import feature_extraction
from damn_at.analyzers.audio import acoustid_analyzer
from damn_at import mimetypes
from damn_at import utilities
class... | StarcoderdataPython |
48992 | <reponame>ArakniD/InvenTree
"""
The Stock module is responsible for Stock management.
It includes models for:
- StockLocation
- StockItem
- StockItemTracking
"""
| StarcoderdataPython |
3251407 | # -*- coding: utf-8 -*-
"""
sphinx.util.smartypants
~~~~~~~~~~~~~~~~~~~~~~~
This code is copied from docutils’ docutils/utils/smartquotes.py
version 1.7.1 (from 2017-03-19). It should be removed in the future.
:copyright: © 2010 <NAME>,
original `SmartyPants`_: © 2003 <NAME>
... | StarcoderdataPython |
3345941 | PENDING = 'Pending'
DECLINED = 'Declined'
COMPLETE = 'Complete'
CONSUMED = 'Consumed'
class PaymentStatus(object):
def __init__(self, amount):
self.amount = amount
@property
def status(self):
raise NotImplementedError('Subclass must implement status property')
def get_required_action... | StarcoderdataPython |
97426 | <filename>build/lib/discovery_imaging_utils/func_denoising.py
import os
import glob
import json
import _pickle as pickle
from discovery_imaging_utils import imaging_utils
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import scipy.interpolate as interp
from sklearn.decomposition import PCA
impo... | StarcoderdataPython |
1678331 | <gh_stars>1000+
from dagster import build_init_resource_context, build_op_context
from docs_snippets_crag.concepts.resources.resources import (
cereal_fetcher,
connect,
db_resource,
do_database_stuff_dev,
do_database_stuff_job,
do_database_stuff_prod,
op_requires_resources,
test_cm_resou... | StarcoderdataPython |
1698170 | from inspect import isawaitable
from typing import (
Any, Awaitable, Dict, Iterable, List, NamedTuple, Optional, Set, Union,
Tuple, cast)
from ..error import GraphQLError, INVALID, located_error
from ..language import (
DocumentNode, FieldNode, FragmentDefinitionNode,
FragmentSpreadNode, InlineFragment... | StarcoderdataPython |
3366981 | import unittest
from vectorformats.formats.geojson import GeoJSON
from base import BaseTest
class GeoJSONTestCase(BaseTest):
def decode(self, filename, **kwargs):
content = self.read_file(filename)
geojson = GeoJSON(**kwargs)
return geojson.decode(content)
def test_simple_point(sel... | StarcoderdataPython |
1627572 | <reponame>NASA-DEVELOP/dnppy
import os
import gc
import arcpy
from arcpy import env
from arcpy.sa import *
env.overwriteOutput = True
gc.disable()
arcpy.CheckOutExtension("Spatial")
env.workspace = "GENERAL WORKSPACE" ##SET AS PARAMETER
#Sum rasters
#change projection
#add color ramp
i = 0
j = 1
k = 2
dsilist = arcpy... | StarcoderdataPython |
3262197 | # encoding: utf-8
from mo_future import text
from mo_parsing.core import ParserElement
from mo_parsing.exceptions import ParseException
from mo_parsing.results import ParseResults
from mo_parsing.tokens import Literal
from mo_parsing.utils import Log
def run_tests(
self,
tests,
parse_all=True,
comme... | StarcoderdataPython |
9214 | <gh_stars>1000+
# Copyright (C) 2015, 2016 GoSecure Inc.
"""
Telnet Transport and Authentication for the Honeypot
@author: <NAME> <<EMAIL>>
"""
from __future__ import annotations
import struct
from twisted.conch.telnet import (
ECHO,
LINEMODE,
NAWS,
SGA,
AuthenticatingTelnetProtocol,
ITelnet... | StarcoderdataPython |
1680114 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import, unicode_literals
import glob, re, itertools, inspect
import gzip
from datetime import datetime
from collections import OrderedDict
from os import path
import numpy as np
import six
encoding = 'utf-8'
vr_pa... | StarcoderdataPython |
1665727 | #!/usr/bin/env python
##############################################################################
#
# convertNBERpatentDataToEstimNetdirectedFormat.py - convert NBER patent data
#
# File: convertNBERpatentDataToEstimNetdirectedFormat.py
# Author: <NAME>
# Created: December 2018
#
#
##############################... | StarcoderdataPython |
1670068 | <filename>negative-affect/pain_regression_allsubjs.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#from ggplot import *
from nltools.datasets import fetch_pain
import numpy as np
import pandas
from nltools.data import Brain_Data
from nltools.file_reader import onsets_to_dm
import matplotlib.pyplot as plt
import sea... | StarcoderdataPython |
1713957 | <filename>src/lambda_handlers/metrics_generator.py
import logging
import boto3
from datetime import datetime
TIMESTAMP_KEY = 'timestamp'
JOB_ID_KEY = 'jobId'
STATUS_KEY = 'status'
STATUS_DETAILS_KEY = 'statusDetails'
DOWNLOAD_TIME_KEY = 'downloadTime'
RETRY_COUNT_KEY = 'retryCount'
logger = logging.getLogger()
logge... | StarcoderdataPython |
1757716 | <gh_stars>1-10
from django.contrib.sitemaps import Sitemap
from .apps.podcasts.models import Podcast, Episode
from .apps.transcripts.models import Transcript
class PodcastSitemap(Sitemap):
def items(self):
return Podcast.objects.all()
class EpisodeSitemap(Sitemap):
def items(self):
return... | StarcoderdataPython |
3306945 | <filename>smpl/batch_lbs.py
# Code partly taken from https://github.com/akanazawa/hmr.
# The following license applies:
#
#
# MIT License
#
# This code base itself is MIT, but please follow the license for SMPL, MoSh data,
# and the respective dataset.
#
# Copyright (c) 2018 akanazawa
#
# Permission is hereby granted, ... | StarcoderdataPython |
3332320 | <filename>src/private/scripts/reports/epi/__init__.py
from .EpiExposureAssessmentTables import * # noqa
from .ResultTable import * # noqa
from .NtpResultTable import * # noqa
from .NtpEpiBiasTable import * # noqa
from .NtpEpiBiasRatings import * # noqa
from .html import * # noqa
| StarcoderdataPython |
3217752 | <gh_stars>0
from typing import AsyncGenerator, Tuple
import anyio
from p2pclient.libp2p_stubs.crypto.pb import crypto_pb2 as crypto_pb
from p2pclient.libp2p_stubs.peer.id import ID
from .control import DaemonConnector
from .datastructures import PeerInfo
from .exceptions import ControlFailure
from .pb import p2pd_pb2... | StarcoderdataPython |
63499 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2017-12-08 16:13
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('medicos', '0001_initial'),
('pacientes', '0005_auto... | StarcoderdataPython |
3286420 | <gh_stars>1000+
"""
Copyright 2018-present, Facebook, 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 agree... | StarcoderdataPython |
3329596 | <filename>KB_Build/model_test.py
# -*- coding: utf-8 -*-
import helper
import tensorflow as tf
from BILSTM_CRF import BILSTM_CRF
import numpy as np
class model_test():
def __init__(self):
self.model_path = 'model'
self.num_steps = 200
self.embedding_matrix = None
self.char2id, self.... | StarcoderdataPython |
3373975 | <gh_stars>1-10
#!/usr/bin/env python
from fig import db
def test_expr_builder(tmpdir):
where_builder = db.SqliteDb.where_builder
# sqlite3 rules:
# Parameters must always be a flat list, never nested. Have to unroll sublists.
# simple int
r = where_builder(id=1)
assert r.sql == "where id = ... | StarcoderdataPython |
3230437 | # MIT License
#
# Copyright(c) 2017 Aalborg University
# <NAME>, June 2017
#
# 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... | StarcoderdataPython |
143954 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 21 19:43:50 2022
Illustrating a basic transient magnetic diffusion problem, See Jackson Section 5.18
@author: zettergm
"""
import numpy as np
import scipy.sparse.linalg
import scipy.sparse
from scipy.special import erf
import matplotlib.pyplot as ... | StarcoderdataPython |
1608858 | <gh_stars>0
import cauldron
from cauldron import session
from cauldron.environ import Response
from cauldron.session.projects import Project
def get_project(response: Response):
"""
:return:
"""
project = cauldron.project.internal_project
if not project:
response.fail(
code=... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.