id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
9795579 | import os
import unittest2 as unittest
from collections import defaultdict
from tincmmgr.tincmm import PythonFileHandler, SQLFileHandler
from mpp.models import MPPTestCase, SQLTestCase
class PythonFileHandlerTests(unittest.TestCase):
def test_parser(self):
test_file_handle = PythonFileHandler(os.path.j... | StarcoderdataPython |
6588684 | <filename>run.py
#@<NAME>
import json
import yaml
import os
import sys
with open("config.json","r") as jFile:
jData=jFile.read()
jData=json.loads(jData)
with open("docker-compose.yml","r") as cFile:
yData=(yaml.safe_load(cFile))
domain=jData["DOMAIN"]
subdomain=jData["SUBDOMAIN"]
hostport=str(jData[... | StarcoderdataPython |
3217755 | import pandas as pd
import numpy as np
import tensorflow as tf
import os
import matplotlib.pyplot as plt
import seaborn as sns
import PIL
from typing import List
# EfficientNet
from tensorflow.keras.applications import EfficientNetB7, ResNet50
from tensorflow.keras.applications.efficientnet import preprocess_input
#... | StarcoderdataPython |
1684917 | # coding:utf-8
from ihome import create_app, db
# 数据库管理命令
from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand
app = create_app('develop')
manager = Manager(app)
Migrate(app, db)
manager.add_command('db', MigrateCommand)
if __name__ == '__main__':
app.run(host='127.0.0.1', port=8000, ... | StarcoderdataPython |
6684676 | import os
import sys
import random
import math
import re
import time
import numpy as np
import cv2
import matplotlib
import matplotlib.pyplot as plt
# Root directory of the project
ROOT_DIR = os.path.abspath("../../")
print(ROOT_DIR)
# Import Mask RCNN
sys.path.append(ROOT_DIR) # To find local version of the library
... | StarcoderdataPython |
9693732 | import sys
import random
n = int(sys.argv[1])
a = int(sys.argv[2])
b = int(sys.argv[3])
print(n)
for _ in range(n):
print(random.randint(a, b))
| StarcoderdataPython |
3418686 | print("Loading Libraries...")
import os
import numpy as np
import json
import tensorflow as tf
import nibabel
import sys
import nibabel as nib
import datetime
import tkinter
from tkinter import filedialog
import SimpleITK as sitk
from skimage import io
from skimage.io import imsave
from skimage.segmentati... | StarcoderdataPython |
11282038 | class Node:
def __init__(self, key, val, prev=None, next=None):
self.key = key
self.val = val
self.prev = prev
self.next = next
class LRUCache:
"""
@param: capacity: An integer
"""
def __init__(self, capacity):
self.capacity = capacity
self.count = 0... | StarcoderdataPython |
3550867 | <gh_stars>0
import sys
import unittest
from utils import sysfont
class FontTest(unittest.TestCase):
__tags__ = []
def test_init(self):
sysfont.init()
def test_list_fonts(self):
sansfonts = [f for f in sysfont.list_fonts() if "sans" in f[0]]
self.assertGreaterEqual(len(sansfonts),... | StarcoderdataPython |
3365179 | from core.himesis import Himesis
import uuid
class Hlayer1rule0(Himesis):
def __init__(self):
"""
Creates the himesis graph representing the DSLTrans rule layer1rule0.
"""
# Flag this instance as compiled now
self.is_compiled = True
... | StarcoderdataPython |
118962 | <filename>pydy/codegen/cython_code.py
#!/usr/bin/env python
import os
import sys
import shutil
import tempfile
import importlib
import subprocess
from collections import defaultdict
from .c_code import CMatrixGenerator
from ..utils import wrap_and_indent
class CythonMatrixGenerator(object):
"""This class genera... | StarcoderdataPython |
93197 | import os
from pyBigstick.nucleus import Nucleus
import streamlit as st
import numpy as np
import plotly.express as px
from barChartPlotly import plotly_barcharts_3d
from PIL import Image
he4_image = Image.open('assets/he4.png')
nucl_image = Image.open('assets/nucl_symbol.png')
table_image = Image.open('assets/table.... | StarcoderdataPython |
5007040 | # coding: utf-8
from __future__ import annotations
from datetime import date, datetime # noqa: F401
import re # noqa: F401
from typing import Any, Dict, List, Optional # noqa: F401
from pydantic import AnyUrl, BaseModel, EmailStr, validator # noqa: F401
from acapy_wrapper.models.attach_decorator import AttachDec... | StarcoderdataPython |
8123371 | # -*- coding: iso-8859-1 -*-
# Maintainer: joaander
from hoomd import *
from hoomd import md
context.initialize()
import unittest
import os
import math
import numpy
# tests dihedral.table
class dihedral_table_tests (unittest.TestCase):
def setUp(self):
print
snap = data.make_snapshot(N=40,
... | StarcoderdataPython |
5167587 | <reponame>andreyvit/pyjamas
def init():
JS("""
// Set up event dispatchers.
$wnd.__dispatchEvent = function() {
if ($wnd.event.returnValue == null) {
$wnd.event.returnValue = true;
if (!DOM.previewEvent($wnd.event))
return;
}
var listener, cur... | StarcoderdataPython |
6495814 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created on Fri Feb 06 17:39:01 2015
@author: tsz
"""
from __future__ import division
import numpy as np
class PV(object):
"""
Implementation of the PV class.
"""
def __init__(self, environment, method, area=0.0, peak_power=0.0, eta_noct=0.18, r... | StarcoderdataPython |
3429345 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2012 pyReScene
#
# 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 ... | StarcoderdataPython |
6436451 | <filename>stools-core/src/dev/python/scheduler.py
__author__ = 'lfischer'
# @author <NAME>
#
# Copyright 2016 University of Zurich
#
# 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 |
6625489 | <reponame>minhtannguyen/transformer-mgk<filename>language-modeling/fast_transformers/__init__.py<gh_stars>1-10
"""Provide a library with fast transformer implementations."""
__author__ = ""
__copyright__ = ""
__license__ = "MIT"
__maintainer__ = ""
__email__ = ""
__url__ = "https://github.com/idiap/fast-transformers"
... | StarcoderdataPython |
1971809 | <gh_stars>10-100
from util import Storage
class MockProtocol(Storage):
pass
class MockContact(Storage):
pass | StarcoderdataPython |
6410499 | import os
import re
from django.db.models import Q
from storage.models import RootPath, RelPath, File, ExcludeDir
from logger import init_logging
logger = init_logging(__name__)
class Scan(object):
"""Abstract functionality for scanning folders.
Either FullScan or QuickScan should be instantiated."""
... | StarcoderdataPython |
12840218 | <gh_stars>1-10
import hikari
import tanjun
from avgamah.core.client import Client
pussy_component = tanjun.Component()
@pussy_component.with_slash_command
@tanjun.with_own_permission_check(
hikari.Permissions.SEND_MESSAGES
| hikari.Permissions.VIEW_CHANNEL
| hikari.Permissions.EMBED_LINKS
)
@tanjun.with... | StarcoderdataPython |
1671866 | # A part of pdfrw (pdfrw.googlecode.com)
# Copyright (C) 2006-2012 <NAME>, Austin, Texas
# MIT license -- See LICENSE.txt for details
class PdfObject(str):
''' A PdfObject is a textual representation of any PDF file object
other than an array, dict or string. It has an indirect attribute
which defa... | StarcoderdataPython |
6633694 | <filename>hybridpy/dataset/triploader.py
__author__ = 'astyler'
import pandas as pd
import numpy as np
import math
import osmapping
from scipy.signal import butter, filtfilt
def load(fname):
trip = pd.read_csv(fname)
elapsed = np.cumsum(trip.PeriodMS / 1000.0)
elapsed -= elapsed[0]
trip['ElapsedSeconds... | StarcoderdataPython |
8101675 | <gh_stars>1-10
import pandas as pd
import numpy as np
from matplotlib import pyplot as plt
from pmdarima.arima import ndiffs
import sys
#from statsmodels.graphics.tsaplots import plot_pacf
from statsmodels.tsa.stattools import acf, pacf
if __name__ == "__main__":
data = pd.read_csv(sys.argv[1])
d ... | StarcoderdataPython |
6515482 | <filename>motion_detection.py
#####################################################################
# Import Libriries
#####################################################################
import cv2
import numpy as np
import time
#####################################################################
print("\n[INFO] Re... | StarcoderdataPython |
4950667 | from rest_framework import serializers
from .models import Notes
from .models import User
from rest_framework_simplejwt.tokens import RefreshToken
from . import string_to_JSX
class NotesInfoSerializer(serializers.ModelSerializer):
"""This serializer just gives a brief description of a Note"""
# A custom... | StarcoderdataPython |
3583188 | <reponame>ropable/wastd<gh_stars>1-10
from rest_framework.serializers import ModelSerializer
from rest_framework_gis.serializers import GeoFeatureModelSerializer
from taxonomy.models import (
Community,
Crossreference,
HbvFamily,
HbvGenus,
HbvGroup,
HbvName,
HbvParent,
HbvSpecies,
H... | StarcoderdataPython |
6446655 | # MultimediaCase for Raspberry Pi - by Joy-IT
# Addon published under MIT-License
import sys
sys.path.append('/storage/.kodi/addons/virtual.rpi-tools/lib')
sys.path.append('/storage/.kodi/addons/script.module.pyserial/lib')
import xbmcaddon
import xbmcgui
import subprocess
import time
import os
import serial
addon ... | StarcoderdataPython |
4999927 | from django.core.mail import backends
from django.test import TestCase
from .test_backends import ErrorRaisingBackend
from django_mail_admin.connections import connections
class ConnectionTest(TestCase):
def test_get_connection(self):
# Ensure ConnectionHandler returns the right connection
self.... | StarcoderdataPython |
8109507 | def recursive_digit_sum(n, k):
def repeat_to_length(s, wanted):
return s * wanted
def sum_digits(n):
r = 0
while n:
r, n = r + n % 10, n // 10
return r
p = repeat_to_length(n, k)
while len(str(p)) != 1:
p = sum_digits(int(p))
return p
print(... | StarcoderdataPython |
4852265 | from discord.ext import commands
import discord
import random
class Tips(commands.Cog):
"""Commands for providing tips about using the bot."""
def __init__(self, bot, config):
self.bot = bot
self.config = config[__name__.split(".")[-1]]
self.tips = ["Tip of this dick in your ass"]
... | StarcoderdataPython |
1966538 | from typing import List, Union
from structlog import get_logger
from app.api.client.apis_helper import Apis
from app.api.client.base_api_caller import BaseApiCaller
from app.core.config import settings
logger = get_logger()
def search_newly_added_videos(
published_after: str,
next_page_token: str,
cont... | StarcoderdataPython |
4828915 | <filename>opencv_load_image_bonus.py
# HOW TO RUN
# python3 opencv_load_image_bonus.py --image images/floppy_disk.jpg --output output.jpg
# python3 opencv_load_image_bonus.py --image images/floppy_disk.jpg
# import the necessary modules
import argparse
import cv2
# initialize the argument parser and establish the arg... | StarcoderdataPython |
1870536 | <filename>Regs/Block_E/RE113.py
from ..IReg import IReg
class RE113(IReg):
def __init__(self):
self._header = ['REG',
'COD_PART',
'COD_MOD',
'SER',
'SUB',
'NUM-DOC',
... | StarcoderdataPython |
3376673 |
from neural.loss.naive_entropy import NaiveEntropy
from neural.loss.mse import MeanSquaredError
__all__ = ['NaiveEntropy', 'MeanSquaredError']
| StarcoderdataPython |
6492746 | #!/usr/bin/env python
"""
Copyright 2017 ThoughtSpot
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, pu... | StarcoderdataPython |
320227 | """
Submarine.py
PURPOSE:
Creates the Submarine class that is usable by players.
"""
from __future__ import annotations
from Objects.Vessels.Vessel import TraditionalVessel
# Due to circular import, cannot import form Settings.py
GREEN = '\033[32m' # Green
YELLOW = '\033[33m' # Yellow
RED = '\033[31m' ... | StarcoderdataPython |
6546774 | # Step 3. Publish Scored Data
# Sample Python script designed to save scored data into a
# target (sink) datastore.
from azureml.core import Run, Workspace, Datastore, Dataset
from azureml.data.datapath import DataPath
import pandas as pd
import os
import argparse
# Get current run
current_run = Run.get_context()
#... | StarcoderdataPython |
1805334 | #!/usr/bin/env python
"""
Tutorial to demonstrate running parameter estimation on a binary neutron star
system taking into account tidal deformabilities.
This example estimates the masses using a uniform prior in both component masses
and also estimates the tidal deformabilities using a uniform prior in both
tidal def... | StarcoderdataPython |
6661850 | #!/usr/bin/env python
#-*- encoding: utf-8 -*-
'''
purpose: 实现邮件smtp客户端
author : <EMAIL>
date : 2017-06-21
history:
'''
import sys
import os
import smtplib
import mimetypes
import email
from email.utils import COMMASPACE
from email.utils import parseaddr, formataddr
from email.header import Header
from email.E... | StarcoderdataPython |
6487064 | <filename>venv/lib/python3.8/site-packages/azureml/_cli/folder/folder_commands.py<gh_stars>0
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import os
from azureml._cli.folder.fold... | StarcoderdataPython |
1720005 | from typing import List, Union, Type
from enum import Enum
__all__ = ("EnumConfig", "Config")
class ConfigType(Enum):
boolean = "boolean"
integer = "number"
string = "string"
class BaseConfig:
def __init__(self, *, name: str, description: str) -> None:
self.name = name
self.descrip... | StarcoderdataPython |
143836 | # REQUIRES: bindings_python
# XFAIL: true
# RUN: %PYTHON% %s | FileCheck %s
import mlir
import circt
from circt.design_entry import Input, Output, module
from circt.esi import types
from circt.dialects import comb, hw
import sys
@module
class PolynomialCompute:
"""Module to compute ax^3 + bx^2 + cx + d for desig... | StarcoderdataPython |
1651236 | <filename>pyqtgraph_extended/opengl/__init__.py
from pyqtgraph.opengl import *
from pyqtgraph_extensions.opengl import *
if __name__=="__main__":
def test_GLViewWidget():
view=GLViewWidget()
ai=GLAxisItem()
view.addItem(ai)
view.show()
return view
view=test_GLViewWidget(... | StarcoderdataPython |
3255461 | #
# Transmission Line Simulator
#
# Author(s): <NAME>
# Created: Aug-28-2017
#
# Copied from scipy so I don't have to import the whole scipy library.
import numpy as np
def gaussian(M, std, sym=True):
"""Return a Gaussian window.
Parameters
----------
M : int
Number of points in the output w... | StarcoderdataPython |
34524 | def print_lol(arr):
for row in arr:
if (isinstance(row, list)):
print_lol(row)
else:
print
row
| StarcoderdataPython |
5172610 | <gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
*****************************************
Author: zhlinh
Email: <EMAIL>
Version: 0.0.1
Created Time: 2016-02-22
Last_modify: 2016-02-22
******************************************
'''
'''
Given a collection of intervals, merge al... | StarcoderdataPython |
4861130 | # Generated by Django 3.2.11 on 2022-01-27 12:43
from django.db import migrations
from spritstat.models import Location, LocationType
def set_name(apps, schema_editor):
# Create the name from the address/city/plz/region_name fields
locations = Location.objects.all()
for loc in locations:
if lo... | StarcoderdataPython |
1791046 | <filename>ultraopt/optimizer/random_opt.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author : <NAME>
# @Contact : <EMAIL>
import numpy as np
from ultraopt.optimizer.base_opt import BaseOptimizer
class RandomOptimizer(BaseOptimizer):
def _new_result(self, budget, vectors: np.ndarray, losses: np.ndarr... | StarcoderdataPython |
217394 | # Copyright 2018 IBM Corporation
#
# 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, ... | StarcoderdataPython |
1671258 | # Copyright 2022 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.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | StarcoderdataPython |
1999288 | # coding: utf-8
import model
import model_exceptions
import view
class Control(object):
def __init__(self, file_name=None):
'''
parameters
----------
file_name : str
name for u json file(without .json extension); if None, the
file will receive the dafault na... | StarcoderdataPython |
1754524 | <reponame>DanielSBrown/osf.io
"""
With email confirmation enabled, the `date_confirmed` is used to filter users
for e.g. search results. This requires setting this field for all users
registered before confirmation was added. This migration sets each user's
`date_confirmed` to his / her `date_registered`.
"""
from web... | StarcoderdataPython |
6619549 | <gh_stars>0
# !/usr/bin/env python
# -*- coding: utf-8 -*-
# -------------------------------------------#
# author: <NAME> #
# email: <EMAIL> #
# -------------------------------------------#
from __future__ import absolute_import, unicode_literals
import sys
from xmnlp.conf... | StarcoderdataPython |
1879513 | import logging
from typing import List
logger = logging.getLogger(__name__)
class GameInfo:
def __init__(self):
self.server_id = None
self.server_name = None
self.match_guid = None
self.game_mode = None
self.mutator_index = None
self.rumble_mutator = None
def ... | StarcoderdataPython |
4939046 | <filename>src/lobster.py
#!/usr/bin/env python
#
# lobster.py - lobster
#
# (c) gdifiore 2018 <<EMAIL>>
#
import os
import sys
import json
from lobster_json import *
from bs4 import BeautifulSoup
type = sys.argv[1]
file = sys.argv[2]
theme = sys.argv[3]
if type == "simple":
def writeToHTML(title, header, content... | StarcoderdataPython |
11269970 | <reponame>rmrector/service.stinger.notification<filename>python/libs/quickjson.py
import collections
import json
import sys
import xbmc
movie_properties = ['imdbnumber', 'tag']
nostingertags_filter = {'and': [{'field': 'tag', 'operator':'isnot', 'value':'duringcreditsstinger'}, {'field': 'tag', 'operator':'isnot', 'v... | StarcoderdataPython |
9750084 | <gh_stars>1-10
#
# Shoulder
# Copyright (C) 2018 Assured Information Security, Inc.
#
# 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 rig... | StarcoderdataPython |
4850923 | #!/usr/bin/env python
class Solution:
def divide(self, dividend, divisor):
"""
:type dividend: int
:type divisor: int
:rtype: int
"""
n = 31
quotient = 0
flip = 1
if dividend < 0:
dividend = -dividend
flip = -flip
... | StarcoderdataPython |
3389278 | <filename>avwx_api/views.py<gh_stars>0
"""
<NAME> - <EMAIL>
avwx_api.views - Routes and views for the Quart application
"""
# pylint: disable=W0702
# stdlib
from dataclasses import asdict
# library
import avwx
from quart import Response, jsonify
from quart_openapi.cors import crossdomain
# module
from avwx_api impo... | StarcoderdataPython |
11201419 |
class SchedulerFixed(object):
def __init__(self, fixed_lr: float):
super().__init__()
self.fixed_lr = fixed_lr
def get_learning_rate(self, step: int):
return self.fixed_lr
| StarcoderdataPython |
5093503 | <gh_stars>0
"""
Copyright (c) Contributors to the Open 3D Engine Project.
For complete copyright and license terms please see the LICENSE at the root of this distribution.
SPDX-License-Identifier: Apache-2.0 OR MIT
"""
# Test Case Title : Check that network input can be created, received by the authority, and proces... | StarcoderdataPython |
1926688 | '''
Created on 07-May-2017
@author: <NAME>
'''
print("Program to check whether a character is vowel or consonant")
char=input("Enter a character...")
vowel=('a','e','i','o','u')
if char.isalpha() and len(char)==1:
for i in vowel:
if char == i:
val=1
else:
val=0
if val ==... | StarcoderdataPython |
1808726 | # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2018-09-18 06:41
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import geoposition.fields
import mptt.fields
class Migration(migrations.Migration):
initial = ... | StarcoderdataPython |
6702504 | <reponame>atsgen/tf-api-client
#!/usr/bin/env python
"""
python %prog [options] <in_schema.xsd> <out_schema.xsd>
Synopsis:
Prepare schema document. Replace include and import elements.
Examples:
python %prog myschema.xsd
python %prog myschema.xsd newschema.xsd
python %prog -f myschema.xsd newschem... | StarcoderdataPython |
93359 | <reponame>anushkrishnav/QiskitBot
import discord
from discord.ext import commands
import asyncio
import subprocess
import logging
import re
logger = logging.getLogger(__name__)
class DocInfo(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command(name = 'docs')
as... | StarcoderdataPython |
11223579 | import cv2
import numpy as np
import alglib.processing as processing
lower1 = np.array([0, 30, 0])
upper1 = np.array([180, 190, 256])
lower2 = np.array([26, 0, 0])
upper2 = np.array([40, 45, 256])
lower3 = np.array([25, 0, 0])
upper3 = np.array([160, 256, 256])
lower4 = np.array([160, 125, 0])
upper4 = np.array([18... | StarcoderdataPython |
6595401 | <filename>src/year2018/day09b.py
"""2018 - Day 9 Part 2: <NAME>.
Amused by the speed of your answer, the Elves are curious:
What would the new winning Elf's score be if the number of the last marble were
100 times larger?
"""
from src.year2018.day09a import Game
from src.year2018.day09a import parse_task
def solve(... | StarcoderdataPython |
6655813 | import matplotlib.pyplot as plt
#funzione per il plotting dei grafici riguardati la storia dell'addestramento di un modello.
def visualize(history):
# "Accuratezza"
plt.plot(history.history['accuracy'])
plt.plot(history.history['val_accuracy'])
plt.title('model accuracy')
plt.ylabel('accuracy')
plt.xlabel(... | StarcoderdataPython |
392520 |
'''Communicate with local or remote peercoin-daemon via JSON-RPC'''
from operator import itemgetter
from .common import Provider
from pypeerassets.exceptions import InsufficientFunds
from btcpy.structs.transaction import MutableTxIn, Sequence, ScriptSig
from decimal import Decimal, getcontext
getcontext().prec = 6
t... | StarcoderdataPython |
106525 | <reponame>code-review-doctor/orchestra
from rest_framework import permissions
from orchestra.models import Worker
from orchestra.models import Todo
from orchestra.models import TodoQA
class IsAssociatedWithTodosProject(permissions.BasePermission):
"""
Ensures that a user's worker is accoiated with the todo's... | StarcoderdataPython |
1658236 | <filename>src/estimate_biomass.py
import argparse
from pathlib import Path
import cv2
import numpy as np
import pandas as pd
import torch
import keypoints_detector.config as cfg
from keypoints_detector.model import keypoint_detector
from keypoints_detector.predict import predict, show_prediction
from scale_detector.s... | StarcoderdataPython |
5036212 | <filename>mobius/management/commands/create_admin_user.py
from django.core.management.base import BaseCommand, CommandError
class Command(BaseCommand):
def handle(self, *args, **options):
from django.contrib.auth import get_user_model
user, created = get_user_model().objects.get_or_create(usernam... | StarcoderdataPython |
1914711 | <reponame>cescalara/icecube_tools
import numpy as np
from pytest import approx
from icecube_tools.utils.vMF import get_kappa, get_theta_p
from icecube_tools.detector.angular_resolution import AngularResolution
def test_kappa_conversion():
theta_1sigma = 1.0
kappa = get_kappa(theta_1sigma, 0.68)
theta_... | StarcoderdataPython |
5074531 | <reponame>fmi-basel/dl-utils<filename>tests/test_runner.py<gh_stars>0
from dlutils.prediction.runner import runner
import pytest
import numpy as np
def test_runner(n_vals=100):
'''test runner with functions
'''
def generator_fn(val):
return val % 2, val
def processor_fn(key, val):
... | StarcoderdataPython |
5075694 | #!/usr/bin/env python
#coding: utf8
# some random homework, for neu.edu, TELE5330
import subprocess
# because the requirement is too clever to use `sys`
ARGV = subprocess.sys.argv
def nslookup(n):
stdout, _ = subprocess.Popen(
'nslookup "%s" | grep name' % n,
stdout=subprocess.PIPE,
stdi... | StarcoderdataPython |
3341937 | import datetime
from typing import Optional
from aioftx.types import Side
from aioftx.http import HTTPMethod, PaginatedResponse, Request, Response
from pydantic import BaseModel, Field
from ..quotes.schemas import Quote
from ..shared.schemas import Option, OptionStatus, OptionType
class QuoteRequest(BaseModel):
... | StarcoderdataPython |
1738101 | from django.contrib.auth import get_user_model
from home.models import Student, Teacher
from django.http import HttpRequest
from django.utils.translation import ugettext_lazy as _
from allauth.account import app_settings as allauth_settings
from allauth.account.forms import ResetPasswordForm
from allauth.utils import e... | StarcoderdataPython |
102930 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import absolute_import
from rest_framework_bulk.routes import BulkRouter
from rest_framework_nested.routers import NestedSimpleRouter
__all__ = ('BulkRouter', 'BulkNestedRouter')
# Map of HTTP verbs to rest_framework_bulk operations.
B... | StarcoderdataPython |
1871733 | <gh_stars>1-10
# flake8: noqa
from .version import __version__
default_app_config = 'entity_history.apps.EntityHistoryConfig'
| StarcoderdataPython |
11200600 | # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
from .import attestation_pb2 as attestation__pb2
from .import beacon_block_pb2 as beacon__block__pb2
from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2
from .import validator_pb2 as validator__pb2
class BeaconN... | StarcoderdataPython |
1779636 | from api.mon.backends.abstract import AbstractMonitoringBackend
from api.mon.backends.abstract.server import AbstractMonitoringServer
# noinspection PyAbstractClass
class DummyMonitoring(AbstractMonitoringBackend):
pass
class DummyMonitoringServer(AbstractMonitoringServer):
"""
Dummy model for represent... | StarcoderdataPython |
1779983 | <gh_stars>0
import json
import kiteconnect.exceptions as ex
import logging
from six.moves.urllib.parse import urljoin
import requests
from os import path
from kiteconnect import KiteConnect, KiteTicker
log = logging.getLogger(__name__)
class KiteExt(KiteConnect):
def login_with_credentials(self, userid, passwo... | StarcoderdataPython |
6575104 | """
========================================================
06. Remove epochs based on peak-to-peak (PTP) amplitudes
========================================================
Epochs containing peak-to-peak above the thresholds defined
in the 'reject' parameter are removed from the data.
This step will drop epochs con... | StarcoderdataPython |
8116754 | <filename>katana-nfv_mon/katana/utils/threadingUtis/threadingUtils.py
import threading
import logging
from katana.utils.mongoUtils import mongoUtils
from katana.utils.nfvoUtils import osmUtils
# Create the logger
logger = logging.getLogger(__name__)
stream_handler = logging.StreamHandler()
formatter = logging.Formatt... | StarcoderdataPython |
11364775 | <gh_stars>0
from django.contrib.auth.models import AbstractUser
from django.db import models
class User(AbstractUser):
def get_short_name(self):
return self.username
class Article(models.Model):
STATUS = (("Draft", "Default"), ("Publish", "Publish"))
users = models.ForeignKey(User, null=True, ... | StarcoderdataPython |
3434051 | """
Carros: Escreva uma função que armazene informações sobre um carro em um dicionário. A função sempre deve receber o
nome de um fabricante e um modelo. Um número de arbitrário de argumentos nomeados deverá ser aceito. Chame a função
com as informações necessárias e dois outros pares nme-valor, por exemplo, uma cor o... | StarcoderdataPython |
9707887 | #-*-coding:utf-8-*-
from scrapy import cmdline
from scrapy.crawler import CrawlerProcess
from scrapy.utils.project import get_project_settings
from FangSpider.spiders import NewFangSpider
# cmdline.execute("scrapy crawl LjSpider -o LjSpider.csv".split())
# cmdline.execute("scrapy crawl LjSpider -o LjSpider.xml".split... | StarcoderdataPython |
252764 | <reponame>tkaneko0204/python-rackclient<gh_stars>0
# Copyright (c) 2014 ITOCHU Techno-Solutions Corporation.
#
# 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.apa... | StarcoderdataPython |
3263322 | from elasticsearch_dsl import DocType, Search, Date, Integer, Keyword, Text, Ip
from elasticsearch_dsl import connections, InnerDoc, Nested, Object
class IoTDetailsDoc(DocType):
'''
Document storage for IoT IP cache
'''
id = Text(analyzer='snowball', fields={'raw': Keyword()})
time = Keyword()
... | StarcoderdataPython |
6504812 | <filename>fabtools/require/mercurial.py<gh_stars>0
"""
Mercurial
=========
This module provides high-level tools for managing `Mercurial`_ repositories.
.. _Mercurial: http://mercurial.selenic.com/
"""
from __future__ import with_statement
from fabric.api import run
from fabtools import mercurial
from fabtools.fi... | StarcoderdataPython |
1991617 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
"""=================================================================
@Project : Algorithm_YuweiYin/LeetCode-All-Solution/Python3
@File : LC-0003-Longest-Substring-Without-Repeating-Characters.py
@Author : [YuweiYin](https://github.com/YuweiYin)
@Date : 2022-01-06
====... | StarcoderdataPython |
12846192 | LEAGUES = [
'Scottish Premiership',
'Italy Serie A',
'French Ligue 1',
'Spanish Segunda Division',
'Australian A-League',
'Italy Serie B',
'Dutch Eredivisie',
'Mexican Primera Division Torneo Clausura',
'Russian Premier Liga',
'Spanish Primera Division',
'English League One',... | StarcoderdataPython |
3411660 | import cv2
from dbr import DynamsoftBarcodeReader
dbr = DynamsoftBarcodeReader()
import time
import os
import sys
sys.path.append('../')
import config
results = None
# The callback function for receiving barcode results
def onBarcodeResult(data):
global results
results = data
def get_time():
localtime = ... | StarcoderdataPython |
200202 | """This module contains the general information for VnicIPv4StaticRoute ManagedObject."""
from ...ucsmo import ManagedObject
from ...ucscoremeta import MoPropertyMeta, MoMeta
from ...ucsmeta import VersionMeta
class VnicIPv4StaticRouteConsts:
pass
class VnicIPv4StaticRoute(ManagedObject):
"""This is VnicIP... | StarcoderdataPython |
9719769 | <reponame>datahounds/fantasy-premier-league<gh_stars>1-10
import pandas as pd
import sasoptpy as so
import os
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
from subprocess import Popen, DEVNULL
from datasets import FplApiData
class SelectionModel:
def __init__(self, team_id, gw, forecasts_fi... | StarcoderdataPython |
6666473 | import flask
from contextvars_extras.context_management import bind_to_sandbox_context
class Flask(flask.Flask):
"""Flask app with contextvars extensions.
This is a subclass of :class:`flask.Flask`, that adds some integration
:mod:`contextvars` module.
Currently, it adds only 1 feature: it puts eac... | StarcoderdataPython |
169163 | <reponame>caioaraujo/bakery_payments_api_v2
# Generated by Django 2.1.5 on 2019-02-02 14:36
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('payment', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='payme... | StarcoderdataPython |
4939223 | import os, sys
from argparse import ArgumentParser
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.metrics.pairwise import cosine_similarity
from tqdm import tqdm
from util.util_funcs import load_jsonl, replace_entities, extract_sents, store_jsonl
from util.logger import get_logger
DIR_PATH =... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.