id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
314517 | """Huduma URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based ... | StarcoderdataPython |
215571 | <filename>yatamana/slurm_task_manager.py
from __future__ import (
print_function, division, absolute_import, unicode_literals)
import logging
from math import ceil
from collections import OrderedDict
from .utils import which
from .task_manager import TaskManager
def format_time(seconds):
"""Format time i... | StarcoderdataPython |
11254273 | from .base_trainer import BaseTrainer
from .base_dataloader import BaseDataLoader | StarcoderdataPython |
12820544 | <gh_stars>0
# -- coding:utf-8--
import multiprocessing
from urllib import request
import os
import shutil
import zipfile
import time
import datetime
import json
import sys
import socket
import uuid
import ssl
from mods import install_v2,lod_del,tool_win,update,lod_del,user,s_server,X,strat_v2,Aaes
ssl._create_defaul... | StarcoderdataPython |
3553750 | <filename>corehq/apps/reportfixtures/tests/test_indicator_fixture.py<gh_stars>1-10
from datetime import date, timedelta
from xml.etree import ElementTree
from sqlagg import SumColumn, filters
from sqlagg.base import AliasColumn
from sqlagg.columns import SimpleColumn
from corehq.apps.reports.sqlreport import AggregateC... | StarcoderdataPython |
9790617 | #! /usr/bin/env python3
def process(population, days) :
total = [population.count(i) for i in range(days)]
for day in range(days - 7) : total[day + 7] += total[day] + total[day - 2] * (day >= 2)
return sum(total) + sum(population.count(i) for i in range(days))
print(process(list(map(int, open("input").rea... | StarcoderdataPython |
3491586 | import logging
import copy
import re
import avi.migrationtools.f5_converter.converter_constants as conv_const
from avi.migrationtools.f5_converter.conversion_util import F5Util
from avi.migrationtools.avi_migration_utils import update_count
LOG = logging.getLogger(__name__)
# Creating f5 object for util library.
conv_u... | StarcoderdataPython |
6691010 | <reponame>Vikr-182/Air-Accidents-Visualizer
import json
with open("../data.json") as f:
data = json.load(f)
li = data.keys()
li = list(li)
for i in range(len(li)):
data[li[i]]["date"] = li[i]
f.close()
with open("../data.json") as f:
json.dump(data,f,indent=4,sort_keys=True)
| StarcoderdataPython |
9691460 | '''
ローカルMQTTサーバ(ブリッジ)からサブスクライブしたデータをinfluxdbに入れる
'''
import sys, os, re
import time
import json
import argparse
import paho.mqtt.client as mqtt # MQTTのライブラリをインポート
from time import sleep # 3秒間のウェイトのために使う
from influxdb_client import InfluxDBClient, Point, WriteOptions
from influxdb_client.client.wri... | StarcoderdataPython |
9778833 | <gh_stars>1-10
# Copyright (c) 2019 Riverbed Technology, Inc.
#
# This software is licensed under the terms and conditions of the MIT License
# accompanying the software ("License"). This software is distributed "AS IS"
# as set forth in the License.
import steelscript.appfwk.apps.report.modules.c3 as c3
import steel... | StarcoderdataPython |
11212807 | <gh_stars>10-100
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Recover images from HDF5 file, with image names matching the indices
'''
import h5py
from PIL import Image
base = '/Users/yliu0/data/'
rawpath = base + 'logos.hdf5'
imgbase = base + '/logos/'
if __name__ == '__main__':
f = h5py.File(rawpath, 'r'... | StarcoderdataPython |
3415623 | #!/usr/bin/env python3
from instastuff import *
# Numeric user id of the target user account.
#
# To find a user id use this tool - https://codeofaninja.com/tools/find-instagram-user-id/
#
# Example:
# target_user_id = '234567890'
target_user_id = '<user-id-here>'
# Value of the `sessionid` cookie when logged into... | StarcoderdataPython |
119245 | <reponame>binxio/git-release-tag
import click
import re
from collections import OrderedDict
from git_release_tag.release_info import ReleaseInfo
class SemVer(click.ParamType):
"""
a semantic version in the form of major.minor.patch
"""
name = "semver"
def convert(self, value, param, ctx) -> str:... | StarcoderdataPython |
3363635 | import numpy
from utils import *
class RBM(object):
def __init__(self, input=None, n_visible=27*27, n_hidden=500, \
W=None, hbias=None, vbias=None, numpy_rng=None):
self.input = input
self.n_visible = n_visible
self.n_hidden = n_hidden
if numpy_rng is None:
numpy_rng = numpy.random.Ran... | StarcoderdataPython |
9779183 | """
# -*- coding:utf-8 -*-
Class wrapping the Marcel Tencé dll for controlling an optical spectrometer.
"""
import sys, os
from ctypes import cdll, create_string_buffer, POINTER, byref
from ctypes import c_uint, c_int, c_char, c_char_p, c_void_p, c_int, c_long, c_bool, c_double, c_uint64, c_uint32, Array, CFUNCTYPE, WI... | StarcoderdataPython |
1857392 | import pytest
import requests
class APIClient:
"""
Упрощенный клиент для работы с API
Инициализируется базовым url на который пойдут запросы
"""
def __init__(self, base_address):
self.base_address = base_address
def create_session(self):
return requests.Session()
def cus... | StarcoderdataPython |
4893609 | from typing import Set
from fastapi import FastAPI
from pydantic import BaseModel
app = FastAPI()
class Item(BaseModel):
name: str
description: str = None
price: float
tax: float = None
tags: Set[str] = []
@app.post(
"/items/",
response_model=Item,
summary="Create an item",
des... | StarcoderdataPython |
1794660 | class Solution(object):
def XXX(self, root, targetSum):
"""
:type root: TreeNode
:type targetSum: int
:rtype: bool
"""
#递归
if not root:
return False
elif not root.left and not root.right: #root是否为叶子节点
return root.val == targetSu... | StarcoderdataPython |
8096975 | """
.. module:: wagtailsnapshotpublisher.views
"""
import json
import logging
from datetime import datetime
from django.apps import apps
from django.conf import settings
from django.forms.models import modelform_factory
from django.http import JsonResponse, HttpResponseServerError, Http404
from django.shortcuts impor... | StarcoderdataPython |
1904896 | from typing import Union, Callable
import torch
from torch import Tensor
def normalize_audio(signal: Tensor, normalization: Union[bool, float, Callable]) -> None:
"""Audio normalization of a tensor in-place. The normalization can be a bool,
a number, or a callable that takes the audio tensor as an input. So... | StarcoderdataPython |
1603912 | from typing import List, Optional, TreeNode
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def sortedArrayToBST(self, nums: List[int]) -> Optional[TreeNode... | StarcoderdataPython |
4840763 | from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^dt/create/', views.dtCreate, name="dt_create"),
url(r'^dt/new/', views.dtNew, name="dt_new"),
url(r'^dt/', views.dtIndex, name="dt_index"),
url(r'^qt/create/', views.qtCreate, name="qt_create"),
url(r'^qt/new/', views.qt... | StarcoderdataPython |
42228 | from pandapower.shortcircuit.calc_sc import calc_sc
from pandapower.shortcircuit.toolbox import * | StarcoderdataPython |
1902868 | <reponame>RodneyByte/main
import sys
from PyQt4 import QtCore, QtGui
from PyQt4.QtGui import QApplication
from PyQt4.QtCore import QUrl
from PyQt4.QtWebKit import QWebView
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.Unico... | StarcoderdataPython |
3530501 | # Training code for the CVAE driver sensor model. Code is adapted from: https://github.com/sisl/EvidentialSparsification and
# https://github.com/StanfordASL/Trajectron-plus-plus.
import os
import time
seed = 123
import numpy as np
np.random.seed(seed)
from matplotlib import pyplot as plt
import torch
torch.manual_s... | StarcoderdataPython |
281317 | """Elements which wrap the sqlfluff core library for public use."""
# flake8: noqa: F401
# Expose the simple api
from sqlfluff.api.simple import lint, fix, parse
from sqlfluff.api.info import list_rules, list_dialects
| StarcoderdataPython |
1933998 | val = [-1, 13, -29, 5, 41, 76, -33, 72, -45, -39, 51, 82, -55, 0, 68, 79, 63, 94, -90, 89, 99]
neg = list(filter(lambda x: x < 0, val))
print(neg)
| StarcoderdataPython |
1669185 | <reponame>Vino2001-hub/the-creative-vipers
#function for subtraction
def doSubtraction:
a=68
b=10
return (a-b)
result=doSubtraction() #subtraction function is invoked
print("Subtracte 10 from 68 is =",result)
| StarcoderdataPython |
9709417 | <gh_stars>0
import subprocess
# import asyncio
def secs_to_hhmm(secs):
t = int((secs + 30) / 60)
h = int(t / 60)
m = int(t % 60)
return h, m
def ping(ip):
cp = subprocess.run(['ping', '-c', '4', ip], stdout=subprocess.PIPE)
res = cp.stdout.decode()
return res
"""
async def ping(ip):
... | StarcoderdataPython |
8020432 | # Generated by Django 2.0.8 on 2018-09-11 15:00
from django.db import migrations
import wagtail.core.blocks
import wagtail.core.fields
import wagtail.documents.blocks
class Migration(migrations.Migration):
dependencies = [
('content', '0039_auto_20180911_1536'),
]
operations = [
migrati... | StarcoderdataPython |
5003086 | from flask import Flask, make_response, render_template
import yaha_analyzer
import plotly.plotly as py
import plotly
import plotly.graph_objs as go
import json
import sys
import collectobot
CSV_HEADER = 'Content-Disposition'
app = Flask(__name__)
@app.route('/')
def index():
scrape = yaha_analyzer.yaha_analyzer(... | StarcoderdataPython |
4853905 | <filename>pyserver/planner/routed_p2/route_finder.py
# Copyright (c) 2006-2013 Regents of the University of Minnesota.
# For licensing terms, see the file LICENSE.
# BUG nnnn: 2012.09.26: Search for a route from DT Mpls to DT St Paul (i.e.,
# the 94) at 9 AM and you may have to bike to a slow bus -- why
# ... | StarcoderdataPython |
3401188 | import numpy as np
import pandas as pd
import torch
import torch.nn as nn
import numpy as np
from torch.utils.data import Dataset, DataLoader
import os, sys
import argparse
import pickle
import math
from efficientnet_pytorch import EfficientNet
import torch.optim as optim
from torch.optim import lr_scheduler
import tim... | StarcoderdataPython |
6630062 | # Copyright 2014 Google Inc. 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 ag... | StarcoderdataPython |
4904631 | <reponame>StepFunctionLLC/mlutils
from setuptools import setup
setup(
name='mlutils',
version='0.1.1',
description='Public ML Utilities',
author='Dave',
author_email='<EMAIL>',
packages=['mlutils'], #same as name
install_requires=['matplotlib'], #external packages as dependencies
)
| StarcoderdataPython |
4907754 | # copy of https://github.com/dbrgn/result
# MIT licensed
from __future__ import print_function, division, absolute_import, unicode_literals
class Result(object):
"""
A simple `Result` type inspired by Rust.
Not all methods (https://doc.rust-lang.org/std/result/enum.Result.html)
have been implemented, ... | StarcoderdataPython |
6632871 | #!/usr/bin/env python
"""Instant output plugins used by the API for on-the-fly conversion."""
import itertools
import re
from grr.lib import rdfvalue
from grr.lib import registry
from grr.lib import utils
from grr.server import aff4
from grr.server import export
class InstantOutputPlugin(object):
"""The base clas... | StarcoderdataPython |
3598282 | <gh_stars>0
import numpy as np
from scipy import signal
from numpy import exp
from pylab import *
b = np.array([1.0])
a = np.array([3.0, 1.0])
B, A = signal.bilinear(b, a)
print B, A
#print 7*B, 7*A
| StarcoderdataPython |
4982105 | import pandas as pd
import nltk
from textblob.classifiers import NaiveBayesClassifier
from textblob import TextBlob
from pandas_ods_reader import read_ods
from pandas_ods_reader import read_ods
from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize
from string import punctuation
def shareCheck(fil... | StarcoderdataPython |
3396832 | import pytest
import inspect
import tubular.testing.helpers as h
import numpy as np
def test_arguments():
"""Test arguments for arguments of tubular.testing.helpers.assert_np_nan_eqal_msg."""
expected_arguments = ["actual", "expected", "msg"]
arg_spec = inspect.getfullargspec(h.assert_np_nan_eqal_msg)
... | StarcoderdataPython |
1735572 | <filename>src/network.py
"""
Package for interacting on the network at a high level.
"""
import binascii
import pickle
from twisted.internet.task import LoopingCall
from twisted.internet import defer, reactor, task
from log import Logger
from protocol import KademliaProtocol
from utils import deferred_dict, generate_... | StarcoderdataPython |
4971564 | <reponame>Lcvette/qtpyvcp
import os
from qtpy import uic
from qtpy.QtCore import Qt
from qtpy.QtWidgets import QDialog
from qtpyvcp.utilities.logger import getLogger
LOG = getLogger(__name__)
class BaseDialog(QDialog):
"""Base Dialog
Base QtPyVCP dialog class.
This is intended to be used as a base ... | StarcoderdataPython |
267734 | #!/usr/bin/python
#
# Copyright (C) 2008 Google, 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... | StarcoderdataPython |
9629206 | <filename>src/VideoSeparation/VideoSeparator.py<gh_stars>0
from os import write
from Utilities import Utilities as util
import cv2
import numpy as np
from tqdm import tqdm
from FaceDetection import FaceDetector as detector
class VideoSeparator:
def __init__(self, videoFileName):
self.videoFileName = video... | StarcoderdataPython |
3210694 | from invoke import Collection, task
# Default tasks are in core.tasks
import core.tasks.app as app
import core.tasks.notebooks as notebooks
import core.tasks.setup as setup
import core.tasks.destroy as destroy
# Add default task collections
ns = Collection()
ns.add_collection(app)
ns = Collection(app)
ns.add_collec... | StarcoderdataPython |
289732 | # Build a Boolean mask to filter out all the 'LAX' departure flights: mask
mask = df['Destination Airport'] == 'LAX'
# Use the mask to subset the data: la
la = df[mask]
# Combine two columns of data to create a datetime series: times_tz_none
times_tz_none = pd.to_datetime( la['Date (MM/DD/YYYY)'] + ' ' + la['Wheels-... | StarcoderdataPython |
38277 | from __future__ import absolute_import, division, print_function
import numpy as np
import tensorflow as tf
from IPython.core.debugger import Tracer; debug_here = Tracer();
batch_size = 5
max_it = tf.constant(6)
char_mat_1 = [[0.0, 0.0, 0.0, 0.9, 0.0, 0.0],
[0.0, 0.0, 0.0, 0.9, 0.0, 0.0],
... | StarcoderdataPython |
8110080 | import os
import numpy as np
import pandas as pd
from sklearn.model_selection import ShuffleSplit
import cv2
import matplotlib.pyplot as plt
import torch
import albumentations as alb
from albumentations.augmentations import transforms as albtr
from albumentations.pytorch import ToTensor as albToTensor
from ... | StarcoderdataPython |
162698 | import ctypes as ct
import numpy as np
import sharpy.utils.algebra as algebra
import sharpy.aero.utils.uvlmlib as uvlmlib
import sharpy.utils.cout_utils as cout
import sharpy.utils.settings as settings
from sharpy.utils.solver_interface import solver, BaseSolver
import sharpy.utils.generator_interface as gen_interface... | StarcoderdataPython |
3331504 | '''
@ file function: 词嵌入向量
@ author: 王中琦
@ date: 2022/3/15
'''
from gensim.models.word2vec import Word2Vec
from numpy import array
def seg_word(all) -> list:
'''
去除停用词
'''
stopwords = set()
with open('stopwords.txt', 'r', encoding='utf-8') as fr:
for i in fr:
... | StarcoderdataPython |
3291325 | <gh_stars>1-10
from aiogram.dispatcher.filters.state import StatesGroup, State
class DeathNote(StatesGroup):
surname_first_name = State()
cause_of_death = State() | StarcoderdataPython |
1822967 | import numpy as np
from matplotlib import pyplot as plt
from .activation_functions import sigmoid, sigmoid_prime
def predict(features, weights):
'''
Trả về một mảng 1D là các xác suất
mà nhãn danh mục đó == 1
'''
z = np.dot(features, weights)
return sigmoid(z)
def cost_function(features, lab... | StarcoderdataPython |
11354402 | from typing import Tuple, Union
import numpy as np
from scipy.spatial.transform import Rotation
def generate_billboards_2d(coords: np.ndarray, size: Union[float, np.ndarray] =20) -> Tuple[np.ndarray, np.ndarray, np.ndarray]:
"""
Returns (vertices, faces, texture coordinates) of a <n> standard 2D billboards of... | StarcoderdataPython |
6470370 | from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from app.core.constants import STEP_LIST_OBJECT_ROLE
from app.sections.step.step_store import StepEntity
from app.themes.theme_provider import is_dark
PADDING = 5
def step_selected_rect():
return QColor("#505153") if is_dark() el... | StarcoderdataPython |
3309673 | <reponame>ajarai/fast-weights<filename>fw/train.py
import cPickle
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import tensorflow as tf
import os
import time
import sys
from data_utils import (
generate_epoch,
)
from model import (
fast_weights_model,
)
from custom_GRU import (
... | StarcoderdataPython |
3260639 | __all__ = [
'change_dir',
'suppress_stderr',
'start_server',
]
import contextlib
import http.server
import io
import os
import socketserver
import sys
import threading
@contextlib.contextmanager
def change_dir(path):
cwd = os.getcwd()
os.chdir(str(path))
try:
yield path
finally:
... | StarcoderdataPython |
3238769 | # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2019-04-29 21:27
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependenc... | StarcoderdataPython |
6570360 | <filename>app/db/models/bewertung.py
"""Bewertung structure for the DB"""
from sqlalchemy import Column
from sqlalchemy import DateTime
from sqlalchemy import ForeignKey
from sqlalchemy import Integer
from sqlalchemy import String
from sqlalchemy.orm import relationship
from sqlalchemy.sql import func
from db.base imp... | StarcoderdataPython |
338804 | <filename>jet_sidebar/templatetags/__init__.py
__author__ = 'raif21x'
| StarcoderdataPython |
3468734 | <reponame>vyvivekyadav04/InstaClone<filename>ourfirstapp/views.py<gh_stars>1-10
from django.shortcuts import render, redirect
from forms import SignUpForm, LoginForm, PostForm, LikeForm, CommentForm
from models import UserModel, SessionToken, PostModel, LikeModel, CommentModel
from django.contrib.auth.hashers import m... | StarcoderdataPython |
4839637 | <gh_stars>0
#!/usr/bin/env python3
# continually logs the key presses and their frequency over 9 second window. Logs are written
# in logs/keyfreqX.txt every 9 seconds, where X is unix timestamp of 7am of the
# recording day.
import queue
from threading import Thread
from pynput import mouse
import pathlib
from os.p... | StarcoderdataPython |
6570730 | <reponame>giselemanuel/programming-challenges
"""
Exercício Python 29: Escreva um programa que leia a velocidade de um carro.
Se ele ultrapassar 80Km/h, mostre uma mensagem dizendo que ele foi multado.
A multa vai custar R$7,00 por cada Km acima do limite.
"""
print("-" * 40)
print(f"{'Radar Eletrônico':^40}")
print("-... | StarcoderdataPython |
9697453 | <reponame>alisterburt/eulerangles<filename>eulerangles/math/constants.py
valid_axes = (
'xyz',
'xyx',
'xzx',
'xzy',
'yxy',
'yxz',
'yzx',
'yzy',
'zxy',
'zxz',
'zyx',
'zyz',
)
valid_matrix_composition_modes = (
'intrinsic',
'extrinsic'
)
| StarcoderdataPython |
3591628 | import click
import pytorch_lightning as pl
import torch
from pytorch_lightning import loggers as pl_loggers
from pytorch_lightning.callbacks import EarlyStopping, ModelCheckpoint
from pytorch_lightning.plugins import DeepSpeedPlugin
from pytorch_pqrnn.dataset import create_dataloaders
from pytorch_pqrnn.model import P... | StarcoderdataPython |
12814169 | import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
import pickle as pkl
from sklearn.decomposition import PCA
class PCA_Analysis():
def __init__(self, X, y, PCA_N_components, feature_label=None):
self.X = X
self.y = y
self.N_components = PCA_N_compo... | StarcoderdataPython |
3223188 | <gh_stars>0
import os
ls=["python main.py --configs configs/train_medseg_unetplusplus_timm-regnetx_002_fold0_random_snow.yml",
"python main.py --configs configs/train_medseg_unetplusplus_timm-regnetx_002_fold1_random_snow.yml",
"python main.py --configs configs/train_medseg_unetplusplus_timm-regnetx_002_fold2_random_s... | StarcoderdataPython |
8137905 | <reponame>ivan-golub/rules_ios
feature_names = struct(
# Virtualize means that swift,clang read from llvm's in-memory file system
virtualize_frameworks = "apple.virtualize_frameworks",
# Use the ARM deps for the simulator - see rules/import_middleman.bzl
arm64_simulator_use_device_deps = "apple.arm64_s... | StarcoderdataPython |
3234094 | <filename>dot/tests/test_model.py
import numpy as np
from lightkurve import LightCurve
import pymc3 as pm
import pytest
from ..model import Model
np.random.seed(42)
# Create a grid of spot longitudes, latitudes, radii and stellar inclinations
# for iterating over in the tests below...
n_trials = 10
lon_grid = 2 * np... | StarcoderdataPython |
36096 | import pytest
from buyer import serializers
@pytest.mark.django_db
def test_buyer_deserialization():
data = {
'email': '<EMAIL>',
'name': '<NAME>',
'sector': 'AEROSPACE',
'company_name': 'Example corp',
'country': 'China',
}
serializer = serializers.BuyerSerialize... | StarcoderdataPython |
1610662 | <reponame>poizon/SublimeLinter
import sublime
import sublime_plugin
from Default import history_list
from itertools import dropwhile, takewhile
from .lint import persist, util
from .lint.util import flash
MYPY = False
if MYPY:
from typing import Union
from typing_extensions import Literal
Direction = U... | StarcoderdataPython |
67145 | <reponame>starofrainnight/ipgetter2<filename>tests/test_compatible.py
# -*- coding: utf-8 -*-
"""Tests for `compatible` package."""
def test_backport_random():
"""Test the backport randome for python 3.5"""
import random
from ipgetter2.compatible import backport_random_choices
population = range(1,... | StarcoderdataPython |
282233 | from flask import current_app, g, Flask
from src.models import init_base
def get_db():
"""
Get the loaded db object from neomodel
"""
pass
def close_db(e=None):
"""
Used to close the session and end the connection between the database
and the client
"""
pass
def init_app(app: F... | StarcoderdataPython |
167489 | <gh_stars>1-10
"""Code for LibUnion class"""
import string
import re
import os
import UserDict
import sys
import shutil
from . import setup_globals
from .setup_globals import gvars, SetupError
from .utils import get_rel_path
from .flash_lib import FlashLib
from .lazy_file import LazyFile
class LibUnion(UserDict.U... | StarcoderdataPython |
11326613 | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... | StarcoderdataPython |
5104703 | <filename>python/dgl/dataloading/neighbor.py
"""Data loading components for neighbor sampling"""
from .dataloader import BlockSampler
from .. import sampling, subgraph, distributed
class MultiLayerNeighborSampler(BlockSampler):
"""Sampler that builds computational dependency of node representations via
neighbo... | StarcoderdataPython |
5024423 | # Copyright 2018 NTRlab
#
# 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, softw... | StarcoderdataPython |
4883546 | import json
import re
import os
import pathlib
import requests
from urllib.parse import urlparse, urlunparse, parse_qs, unquote
from girder import events, logger
from girder.constants import AccessType
from girder.models.folder import Folder
from girder.models.setting import Setting
from ..import_providers import Imp... | StarcoderdataPython |
5052157 | from os import path
import sys
import json
from decimal import Decimal
sys.path.append(path.join(path.dirname(__file__), '../handlers'))
from helpers.utils import get_dynamodb_table, get_build_item
queue_table = get_dynamodb_table()
def stringify_decimal(obj):
if isinstance(obj, Decimal):
return str(obj... | StarcoderdataPython |
3460353 | # Generated by Django 3.2.3 on 2021-06-22 02:54
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('preelec9_camp', '0014_au... | StarcoderdataPython |
4874881 | <gh_stars>1-10
import argparse
import torch
from utils import channelwised_normalize, binarize, SSIM
import torch.nn as nn
import model as Model
import numpy as np
from tqdm import tqdm
import random
import torchvision
from tensorboardX import SummaryWriter
import os
from torch.utils.data import DataLoader
from torchvi... | StarcoderdataPython |
8173875 | import ctypes
from api.capi import c_lib, c_callback
from api.color import color
from api.base import base
c_lib.ui_set_font.argtypes = (ctypes.c_char_p, ctypes.c_int, ctypes.c_float, ctypes.c_char_p)
c_lib.ui_set_pivot.argtypes = (ctypes.c_int, ctypes.c_float, ctypes.c_float)
c_lib.ui_set_size.argtypes = (ctypes.c_in... | StarcoderdataPython |
8022868 | from datetime import datetime
import json
import mock
import pytest
import responses
from api.share.utils import update_share
from api_tests.utils import create_test_file
from framework.auth.core import Auth
from osf.models.spam import SpamStatus
from osf.utils.permissions import READ, WRITE, ADMIN
from osf_tests.... | StarcoderdataPython |
5019952 | <filename>Beginner/03. Python/Kadane.py
# implements the kadane algorithm
# https://en.wikipedia.org/wiki/Maximum_subarray_problem
def kadane(l): # max_ending_here, max_so_far
meh, msf = 0, 0
a, b = 0, 0
for i, x in enumerate(l):
meh += x
if meh < 0:
meh = 0
a = i + ... | StarcoderdataPython |
109559 | <filename>src/fibonacci.py
def main():
print("Iterative:")
print("n=0 ->", fibonacci_iterative(0))
print("n=1 ->", fibonacci_iterative(1))
print("n=6 ->", fibonacci_iterative(6))
print()
print("Recursive:")
print("n=0 ->", fibonacci_recursive(0))
print("n=1 ->", fibonacci_recursive(1))
... | StarcoderdataPython |
3262136 | <filename>version_0.2.0/static_tpo_v2.py
# -*- coding: utf-8 -*-
"""
Created on Sun Aug 2 07:02:43 2020
@author: alex1
twitter.com/beinghorizontal
"""
import pandas as pd
import plotly.graph_objects as go
from tpo_helper2 import get_ticksize, abc, get_mean, get_rf, get_context, get_dayrank, get_ibrank
i... | StarcoderdataPython |
273718 | from panda3d.core import VBase4
class Debug:
# XY indicator on stem
x = VBase4(1, 0, 0, 1)
y = VBase4(0, 1, 0, 1)
xyz_at_top = True # If False, indicators are at the stem bottom.
# skeleton geometry
stem = VBase4(1, 1, 1, 1) # Central axis of... | StarcoderdataPython |
3514199 | <filename>ecoli_in_pipe/wrapper_head_tail.py<gh_stars>1-10
import sys
import petsc4py
petsc4py.init(sys.argv)
from ecoli_in_pipe import head_tail
# import numpy as np
# from scipy.interpolate import interp1d
# from petsc4py import PETSc
# from ecoli_in_pipe import single_ecoli, ecoliInPipe, head_tail, ecoli_U
# from ... | StarcoderdataPython |
1693564 | from django.db import models
from .models import User
class Patient(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE, primary_key=True)
name = models.CharField(max_length=50, default="")
country = models.CharField(max_length=50, default="")
address = models.CharField(max_lengt... | StarcoderdataPython |
3446777 | <filename>core/userauthorization.py
from django.http import HttpResponse
from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response
from django.template import RequestContext
from core.pandajob.models import MonitorUsers
from django.core.cache import cache
from django.db.models import... | StarcoderdataPython |
3234926 | <reponame>Brun0C/projeto_python
def cadastrar_funcionario():
print('Operação realizada com sucesso')
def listar_funcionarios():
print('Operação realizada com sucesso')
| StarcoderdataPython |
4864097 | <filename>middleware.py<gh_stars>0
"""
Move this to wherever once we establish a setup for the Application Framework
"""
import re
from collections import deque
from typing import Callable, Deque
from time import perf_counter
from cloudcix_metrics import prepare_metrics
from django.http.response import HttpResponseBas... | StarcoderdataPython |
3319016 | <gh_stars>1-10
import numpy as np
from mz import base
from mz import sources # Import to populate helpers._MARKED_CLASSES.
from mz import filters # Import to populate helpers._MARKED_CLASSES.
from mz import helpers
import pytest
# Fixtures
# ------------------------------------------------------------------------... | StarcoderdataPython |
1675151 | import tfm__unit_interval
import tfm__2D_rows_sum_to_one__log
import tfm__2D_rows_sum_to_one__stickbreak
# Make a few functions easily available
logistic_sigmoid = tfm__unit_interval.logistic_sigmoid
inv_logistic_sigmoid = tfm__unit_interval.inv_logistic_sigmoid
from log_logistic_sigmoid import log_logistic_sigmoid | StarcoderdataPython |
9771926 | import movie, fresh_tomatoes
# instances of Movie class
jurassic_world = movie.Movie("Jurassic World",
"Twenty-two years after the events of Jurassic Park, Isla Nublar now \
features a fully functioning dinosaur theme park, Jurassic World, as \
originally envisioned by <NAME>...",
"Jun ... | StarcoderdataPython |
3332184 | import operator
from OOSML import SmlObject, SmlPredicate
import Python_sml_ClientInterface as sml
def iterator_is_empty(iter):
try:
iter.next()
except StopIteration:
return True
return False
def output_event_handler(id, userData, kernel, runFlags):
userData.update()
def init_event_ha... | StarcoderdataPython |
372098 | <reponame>pranavashok/personal-finance
from datetime import datetime, timedelta
from pf.goals import MonthlyGoal
from pf.goals import LumpsumGoal
def test_get_monthly_need_monthly_goal():
inflation_rate = 5
goal = MonthlyGoal(
monthly_amount=100,
start_date=datetime.now(),
end_date=d... | StarcoderdataPython |
1927055 | <reponame>myyerrol/xm_arm_workspace<filename>xm_arm_trajectory_control/scripts/xm_arm_trajectory_move_test.py
#!/usr/bin/env python
"""
********************************************************************
* Software License Agreement (BSD License)
*
* Copyright (c) 2016, Team-Xmbot-Service-Robot
* All rights re... | StarcoderdataPython |
12800673 | <reponame>lchloride/manga_rock_crawler<gh_stars>1-10
import sqlite3
class Chapter:
def __init__(self, iid=None, chapterId=None, seriesId=None, directory=None,
createTime=None, updateTime=None, name=None, publish_time=None):
self._id = iid
self._chapterId = chapterId
self._... | StarcoderdataPython |
8081663 | <filename>homeassistant/components/yamaha_musiccast/number.py<gh_stars>1-10
"""Number entities for musiccast."""
from aiomusiccast.capabilities import NumberSetter
from homeassistant.components.number import NumberEntity
from homeassistant.components.yamaha_musiccast import (
DOMAIN,
MusicCastCapabilityEntity... | StarcoderdataPython |
3350390 | <reponame>KimSoungRyoul/PersistenceLayerInPythonApplication
from datetime import date
from django.core.management.base import BaseCommand
from apps.orders.models import DailyOrderReport, Order
class Command(BaseCommand):
help = "주문 통계 보고서 뽑아주는 커맨드"
def add_arguments(self, parser):
parser.add_argume... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.