id stringlengths 2 8 | text stringlengths 16 264k | dataset_id stringclasses 1
value |
|---|---|---|
5187107 | from django.http import JsonResponse
from django.views.generic import UpdateView
from .models import Organization
class AvatarUploadView(UpdateView):
model = Organization
fields = ["avatar_image"]
def form_valid(self, form):
"""
override this to simply return a status 200 instead of a re... | StarcoderdataPython |
3523543 | <filename>src/serialbox-python/sdb/sdbgui/popuphalodescriptorwidget.py<gh_stars>1-10
#!/usr/bin/python3
# -*- coding: utf-8 -*-
##===-----------------------------------------------------------------------------*- Python -*-===##
##
## S E R I A L B O X
##
## This file is distributed un... | StarcoderdataPython |
162686 | <filename>ndflow/tools/match.py
import argparse
import multiprocessing
import os
import pickle
from ndflow import api
def match_single(source_gmm_path: str, target_gmm_path: str, output_path: str):
with open(source_gmm_path, 'rb') as f:
source_gmm = pickle.load(f)['gmm']
with open(target_gmm_path, 'r... | StarcoderdataPython |
221982 | from typing import NamedTuple, List, Dict, Any
import tensorflow as tf
import logging
import argparse
import datetime
import numpy as np
import json
import numbers
from kite.asserts.asserts import FieldValidator
from kite.model.model import TrainInputs, Config as BaseConfig, AdamTrainer, Model as BaseModel
from kite.... | StarcoderdataPython |
1971189 | # Copyright 2021 <NAME>.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, soft... | StarcoderdataPython |
11338342 | import subprocess
import click
from catwatch.lib.db_seed import seed_database
from catwatch.app import create_app
from catwatch.extensions import db
# Create a context for the database connection.
app = create_app()
db.app = app
SQLALCHEMY_DATABASE_URI = app.config.get('SQLALCHEMY_DATABASE_URI', None)
class Postg... | StarcoderdataPython |
385495 | # -*- coding: utf-8 -*-
"""
Created on Tue May 20 15:17:37 2014
@author: timothyh
"""
import argparse
from tempfile import NamedTemporaryFile
from ped_parser import family, individual, parser
def main():
argparser = argparse.ArgumentParser(description="Call denovo variants on a VCF file containing a trio")
... | StarcoderdataPython |
77631 | <reponame>cash/chepstow<gh_stars>0
import chepstow
import random
import time
import unittest
class BigTest(unittest.TestCase):
def test_something(self):
# randomly fails for testing purposes
agent = chepstow.Agent()
delay = random.randint(0, 10)
start = time.time()
agent.ru... | StarcoderdataPython |
5072742 | ##############################################################################
#
# Copyright (c) 2002 Zope Foundation and Contributors.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS I... | StarcoderdataPython |
8034677 | # Dépendances
from tkinter import *
from modules.jeu import *
# Variables globales
win = Tk() # Fenêtre Tkinter
# Configuration de la fenêtre Tkinter
win.title("FlickColor")
win.resizable(False, False)
win.configure(background = "white")
win.iconphoto(False, Pil_imageTk.PhotoImage(file = "./img/icon.pn... | StarcoderdataPython |
5138027 | def ask_ok(prompt, retries=4, reminder='Please try again!'):
while True:
ok = input(prompt)
if ok in ('y', 'yes', 'yep'):
return True
if ok in ('n', 'no', 'nop', 'nope'):
return False
retries = retries - 1
if retries < 0:
raise ValueError('... | StarcoderdataPython |
1976869 | import sys
import collections
import logging
from dynamo.fileop.base import FileQuery
from dynamo.fileop.transfer import FileTransferOperation, FileTransferQuery
from dynamo.fileop.deletion import FileDeletionOperation, FileDeletionQuery
from dynamo.utils.interface.mysql import MySQL
from dynamo.dataformat import File... | StarcoderdataPython |
1700551 | <filename>solarpv/training/s2/train_S2_unet.py<gh_stars>10-100
# Train S2-UNET
# built-in
import pickle, copy, logging, os, sys
# packages
import matplotlib
import matplotlib.pyplot as plt
from PIL import Image
import numpy as np
# ML
import tensorflow as tf
from tensorflow.python import keras
from keras.layers impo... | StarcoderdataPython |
11396289 | import os
import scrapy
import pandas as pd
import numpy as np
from scrapy.http import Request
class DocdownloaderSpider(scrapy.Spider):
name = 'docdownloader'
print("Doc Downloader Constructor Called !!!")
final_df = pd.read_excel('./scrapy_equippo.xlsx')
docs_df = final_df[final_df['Documents for t... | StarcoderdataPython |
5026088 | <filename>sync_tester/tests/test_receive_sync_core.py
"""
This pytest module include e2e test of second part of core's synchronization -> receive tiles and create layer:
* From core A
* GW
"""
import logging
import os
import time
from datetime import datetime
from conftest import *
from sync_tester.configuration impor... | StarcoderdataPython |
261428 | <filename>lib/surface/compute/vpn_tunnels/list.py<gh_stars>0
# -*- coding: utf-8 -*- #
# Copyright 2019 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
#
# ... | StarcoderdataPython |
12805706 | from ._core import make_figure
from ._doc import make_docstring
import plotly.graph_objs as go
_wide_mode_xy_append = [
"Either `x` or `y` can optionally be a list of column references or array_likes, ",
"in which case the data will be treated as if it were 'wide' rather than 'long'.",
]
_cartesian_append_dict... | StarcoderdataPython |
9671894 | <filename>lib/game/ui/elements/coop_play.py<gh_stars>10-100
from lib.game.ui.general import UIElement, Rect, load_ui_image
COOP_PLAY_LABEL = UIElement(name='COOP_PLAY_LABEL')
COOP_PLAY_LABEL.description = "CO-OP label in mission selection."
COOP_PLAY_LABEL.text_rect = Rect(0.07857142857142857, 0.29733163913595934, 0.... | StarcoderdataPython |
9653493 | import time
from PyQt5.QtCore import QObject, QThread, pyqtSlot, pyqtSignal
from PyQt5.QtWidgets import QApplication
class LoopTrigger(QObject):
"""
This class is used to synchronize the plotting of all of the graphs in a
similar way than QTimer, but it waits until all the plots has been painted.
"""... | StarcoderdataPython |
6484564 | <gh_stars>0
"""Binary Tree Inorder Traversal"""
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution(object):
def inorderTraversal(self, root):
"... | StarcoderdataPython |
3375024 | <gh_stars>0
# Copyright 2019 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | StarcoderdataPython |
8041785 | <reponame>xiaol/keras_<gh_stars>1-10
import numpy as np
import pytest
from keras.models import Sequential, weighted_objective
from keras.layers.core import TimeDistributedDense, Masking
from keras import objectives
from keras import backend as K
@pytest.mark.skipif(K._BACKEND == 'tensorflow',
rea... | StarcoderdataPython |
6485085 | import datetime
import json
import os
import requests
from skt.vault_utils import get_secrets
headers = {
"Catalog-User": os.environ.get("USER", "unknown_user"),
"Catalog-Hostname": os.environ.get("HOSTNAME", "unknown_hostname"),
"Catalog-NB-User": os.environ.get("NB_USER", None),
}
DATA_CATALOG_SECRET... | StarcoderdataPython |
4938209 | <reponame>ckarageorgkaneen/pybpod-gui-plugin
# !/usr/bin/python3
# -*- coding: utf-8 -*-
import logging
import os
from AnyQt.QtWidgets import QFileDialog, QMessageBox
import pyforms as app
from pyforms.controls import ControlText
from pyforms_generic_editor.models.project import GenericProject
from pybpodgui_api.m... | StarcoderdataPython |
8029052 | from configparser import RawConfigParser
import youtube_dl
from mpserver.grpc import mmp_pb2_grpc as rpc
from mpserver.grpc import mmp_pb2
from mpserver.interfaces import Logger, EventFiring
class MediaDownloader(rpc.MediaDownloaderServicer, Logger, EventFiring):
"""
Wrapper for the youtube_dl.YoutubeDL so... | StarcoderdataPython |
8123281 | # -*- coding: utf-8 -*-
"""
Created on Mon Sep 26 23:07:26 2016
Copyright (c) 2016, <NAME>. All rights reserved.
@author: <NAME>
@email: <EMAIL>
@license: BSD 3-clause.
"""
from nose.tools import assert_less
import numpy as np
import OnPLS.consts as consts
import OnPLS.estimators as estimators
im... | StarcoderdataPython |
6473260 | <filename>bot/update_status.py
from bot.args_twitter_keys import (
access_token,
access_token_secret,
api_key,
api_secret
)
import requests
from requests_oauthlib import OAuth1Session
twitter = OAuth1Session(
access_token,
access_token_secret,
api_key,
api_secret
)
def tweet(text):
... | StarcoderdataPython |
9686199 | <gh_stars>0
"""Training script for SinGAN."""
import torch
from src.singan import SinGAN
import argparse
# Arguments
parser = argparse.ArgumentParser()
parser.add_argument('--device', type=str, default='cuda', help='cuda or cpu')
parser.add_argument('--lr', type=float, default=5e-4, help='learning rate')
parser.add_ar... | StarcoderdataPython |
5039176 | from lock import Lock
from manifest import Manifest
from package import Package
from release import Release
| StarcoderdataPython |
11398022 | #!/usr/bin/env python2.7
import sys
import re
import json
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
from json2run import *
from pymongo import *
from multiprocessing import *
from collections import namedtuple
import logging as log
from multiprocessing import cpu_count
import datetime
from mat... | StarcoderdataPython |
4870585 | global leftController
global rightController
if starting:
leftController = OSVR.leftController()
rightController = OSVR.rightController()
hydra[0].enabled = True
hydra[0].isDocked = False
hydra[0].side = 'L'
hydra[1].enabled = True
hydra[1].isDocked = False
hydra[1].side = 'R'
def update():
global leftCon... | StarcoderdataPython |
11248150 | <reponame>jsabak/antycaptcha-solutions-locust
from locust import seq_task, TaskSequence
class Exercise1Steps(TaskSequence):
def __init__(self, parent):
super().__init__(parent)
self.seed = '553a09d3-baf5-45f6-ad89-83324bac051a'
@seq_task(1)
def exercises_exercise1(self):
response ... | StarcoderdataPython |
3230837 | <reponame>siliconcupcake/aioquic
import asyncio
import os
from functools import partial
from typing import Callable, Dict, Optional, Text, Union, cast
from aioquic.buffer import Buffer
from aioquic.quic.configuration import QuicConfiguration
from aioquic.quic.connection import NetworkAddress, QuicConnection
from aioqu... | StarcoderdataPython |
310744 | #!/usr/bin/env python
from __future__ import absolute_import, print_function, unicode_literals
import os
import subprocess
import sys
def warning(*objs):
print("WARNING: ", *objs, file=sys.stderr)
def fail(message):
sys.exit("Error: {message}".format(message=message))
def has_module(module_name):
tr... | StarcoderdataPython |
8163084 | """
This file contains shared functions for the project
@author: <NAME>
"""
import os, csv
# Parse input CSV file to get list of parameters
def parse_file(infile):
param_list = None
# check if the infile exists
if not os.path.exists(infile):
print("Parameter file is not exist: ", infile)
else:... | StarcoderdataPython |
8199455 | <reponame>vsoch/wordfish<gh_stars>0
from celery.decorators import periodic_task
from celery import shared_task, Celery
from celery.schedules import crontab
from django.conf import settings
from django.contrib.auth.models import User
from django.core.mail import EmailMessage
from django.utils import timezone
from noti... | StarcoderdataPython |
5111947 | <filename>lintcode/0157-unique-characters.py<gh_stars>1-10
# Description
# 中文
# English
# Implement an algorithm to determine if a string has all unique characters.
# Have you met this question in a real interview?
# Example
# Example 1:
# Input: "abc_____"
# Output: false
# Example 2:
# Input: "abc"
# Output: tr... | StarcoderdataPython |
6659094 | from django.conf.urls import url, include
from django.views.generic import TemplateView, DetailView
from django.contrib.auth.decorators import login_required
from securedpi_events import views
urlpatterns = [
url(r'^(?P<pk>\d+)/$',
login_required(views.EventView.as_view()),
name='events'),
url... | StarcoderdataPython |
1979030 | <reponame>JiahuaWU/fastai
import pytest, fastai
from fastai.gen_doc.doctest import this_tests
def test_has_version():
this_tests('na')
assert fastai.__version__
| StarcoderdataPython |
8029007 | from django.db import models
from .component import Component
from .test_status import TestStatus
from .contract_status import ContractStatus
from .lock_status import LockStatus
from .contract_type import ContractType
from .custom_field import CustomField
from django.contrib.contenttypes.fields import GenericRelation
f... | StarcoderdataPython |
1846894 | <filename>Python/100Excersises/.history/51 to 75/74/74_20201119130141.py<gh_stars>0
import pandas as p
d1=p | StarcoderdataPython |
389691 | import tensorflow as tf
def softmax_nd(target, axis, name=None):
"""
Multi dimensional softmax,
refer to https://github.com/tensorflow/tensorflow/issues/210
compute softmax along the dimension of target
the native softmax only supports batch_size x dimension
"""
with tf.name_scope(name, 's... | StarcoderdataPython |
6514698 | import unittest
import pytest
from geopyspark.geotrellis.constants import LayerType, ReadMethod
from geopyspark.geotrellis import Extent, GlobalLayout, LocalLayout, SourceInfo
from geopyspark.tests.base_test_class import BaseTestClass
from geopyspark.geotrellis.layer import TiledRasterLayer
class TiledRasterLayerTes... | StarcoderdataPython |
323413 | # Copyright (c) 2015 Mirantis 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 agreed to in writ... | StarcoderdataPython |
9758918 | <filename>code/finetune/loadTwitterData.py
import glob
import os
import pathlib
import pickle
from collections import defaultdict
import tensorflow as tf
from tensorflow.keras.preprocessing.image import img_to_array, load_img
from tqdm import tqdm
def get_all_images():
data_root = "/data4/zyr/projects/Hierachica... | StarcoderdataPython |
1612767 | <filename>envinorma/parametrization/consistency.py
import math
from datetime import date
from typing import List, Optional, Set, Tuple
from envinorma.models.condition import Condition, Equal, Greater, LeafCondition, Littler, Range, extract_leaf_conditions
from envinorma.models.parameter import Parameter, ParameterType... | StarcoderdataPython |
3202790 | <gh_stars>10-100
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
x1, y1 = 0.3, 0.3
x2, y2 = 0.7, 0.7
fig = plt.figure(1, figsize=(8,3))
fig.clf()
from mpl_toolkits.axes_grid.axes_grid import AxesGrid
from mpl_toolkits.axes_grid.anchored_artists import AnchoredText
#from matplotlib.font_manager... | StarcoderdataPython |
3578689 | <filename>beaker/services/secret.py
from typing import Union
from ..data_model import *
from ..exceptions import *
from .service_client import ServiceClient
class SecretClient(ServiceClient):
"""
Accessed via :data:`Beaker.secret <beaker.Beaker.secret>`.
"""
def get(self, secret: str, workspace: Opt... | StarcoderdataPython |
1645342 | <filename>mser.py
#TODO:
#1. Make a variable to store the musics' destination/folder/directory DONE
#2. Get rid of the mutagen, not needed. Became redundant DONE
import os
import sys
import time
import telepot
from telepot.loop import MessageLoop
import config
#Telegram bot key
bot = telepot.Bot(config.key)
#THis is t... | StarcoderdataPython |
11330503 | #
# author: <NAME> (<EMAIL>)
# last updated: December 29, 2020
#
"""These files are for implementing Student-:math:`t` process regression.
It is implemented, based on the following article:
(i) <NAME>., & <NAME>. (2006). Gaussian Process
Regression for Machine Learning. MIT Press.
(ii) <NAME>., <NAME>., & <NAME>. (20... | StarcoderdataPython |
5174840 | import utils.decisions_constants as log
from game.ai.strategies.chinitsu import ChinitsuStrategy
from game.ai.strategies.common_open_tempai import CommonOpenTempaiStrategy
from game.ai.strategies.formal_tempai import FormalTempaiStrategy
from game.ai.strategies.honitsu import HonitsuStrategy
from game.ai.strategies.mai... | StarcoderdataPython |
6472004 | from keras import backend as K
from keras.layers import ( # noqa
Input, Dense, Activation,
Reshape, Lambda, Dropout,
Bidirectional, BatchNormalization
)
from keras.layers.convolutional import Conv2D, MaxPooling2D
from keras.layers.merge import add, concatenate
from keras.layers.recurrent import GRU
from ke... | StarcoderdataPython |
1747457 | <filename>Data/OpenNpy.py
import numpy as np
import matplotlib.pyplot as plt
img_array = np.load('car.npy')
rimg = np.reshape(img_array[0], (28, 28))
plt.imshow(rimg, cmap="gray")
plt.show()
print(type(rimg))
print(rimg)
| StarcoderdataPython |
6494161 | <gh_stars>1-10
""" Define the Client model."""
# Django imports
from django.db import models
from django.utils.translation import gettext_lazy as _
# Utils Abstract model
from hisitter.utils.abstract_users import HisitterModel
# Models
from .users import User
class Client(HisitterModel):
""" Class which create... | StarcoderdataPython |
11397367 | # -*- coding: utf-8 -*-
"""
This module implements API endpoint handlers to query the database and
return data for the connexion app.
copyright: © 2019 by <NAME>.
license: MIT, see LICENSE for more details.
"""
from flask import abort, json
from data_access import DBClient
unspecified = object()
def read_parks()... | StarcoderdataPython |
4891619 | '''
code by <NAME>(<NAME>) @graykode
'''
import tensorflow as tf
import matplotlib.pyplot as plt
import numpy as np
tf.reset_default_graph()
# 3 Words Sentence
sentences = [ "i like dog", "i like cat", "i like animal",
"dog cat animal", "apple cat dog like", "dog fish milk like",
"dog ca... | StarcoderdataPython |
1888566 | #!/usr/bin/env python3
# type: ignore
# Configuration file for the Sphinx documentation builder.
# -- Path setup --------------------------------------------------------------
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is... | StarcoderdataPython |
11202268 | # -*- coding: utf-8 -*-
"""
Flow based cut algorithms
"""
# http://www.informatik.uni-augsburg.de/thi/personen/kammer/Graph_Connectivity.pdf
# http://www.cse.msu.edu/~cse835/Papers/Graph_connectivity_revised.pdf
import itertools
from operator import itemgetter
import networkx as nx
from networkx.algorithms.connectivity... | StarcoderdataPython |
6449863 | <reponame>mesoscope/cellpack
## Automatically adapted for numpy.oldnumeric Jul 23, 2007 by
#
# $Header: /opt/cvs/python/packages/share1.5/mglutil/math/transformation.py,v 1.45 2007/07/24 17:30:40 vareille Exp $
#
import numpy as np
from . import rotax
# from mglutil.math.VectorModule import Vector
Vector = None #... | StarcoderdataPython |
3219220 | from basis import node, Table, Stream, Context
@node(
inputs=[
Stream("source1_transactions", schema="common.Transaction"),
Table("customer_summary", schema="stripe.Charge"),
],
outputs=[
Table("customer_sales"),
Stream(
"customer_sales_stream",
sche... | StarcoderdataPython |
3290330 | # *******************************************************
# Copyright (c) VMware, Inc. 2020. All Rights Reserved.
# SPDX-License-Identifier: MIT
# *******************************************************
# *
# * DISCLAIMER. THIS PROGRAM IS PROVIDED TO YOU "AS IS" WITHOUT
# * WARRANTIES OR CONDITIONS OF ANY KIND, WHETHER... | StarcoderdataPython |
1606549 | <filename>collectionPointEvent.py
"""
Common event to send out about activity from this collection point
author: DaViD bEnGe
date: 6/9/2017
TODO: define this object better
"""
import datetime
class CollectionPointEvent():
def __init__(self, cpid, cptype, topic, extendedData={}, localOnly=False):
self._cp... | StarcoderdataPython |
4922561 | <gh_stars>0
# --------------
import numpy as np
from collections import Counter
# Not every data format will be in csv there are other file formats also.
# This exercise will help you deal with other file formats and how to read it.
data = np.genfromtxt(path, dtype = 'str', delimiter = ',', skip_header=1)
print(data.s... | StarcoderdataPython |
6685138 | <filename>sdg/inputs/InputMetaFiles.py
import os
import re
import git
import pandas as pd
from sdg.inputs import InputFiles
class InputMetaFiles(InputFiles):
"""Sources of SDG metadata that are local files."""
def __init__(self, path_pattern='', git=True, git_data_dir='data',
git_data_filemas... | StarcoderdataPython |
13681 | <reponame>alekratz/jayk
"""Common utilities used through this codebase."""
import logging
import logging.config
class LogMixin:
"""
A logging mixin class, which provides methods for writing log messages.
"""
def __init__(self, logger_name: str):
"""
Creates the logger with the specif... | StarcoderdataPython |
1691171 | <gh_stars>1-10
"""
@package mi.dataset.parser
@file /mi/dataset/parser/vel3d_cd_dcl.py
@author <NAME>
@brief Parser for the vel3d instrument series c,d through dcl dataset driver
"""
__author__ = '<NAME>'
__license__ = 'Apache 2.0'
import struct
import re
import os
import binascii
import base64
import ntplib
import ... | StarcoderdataPython |
9702052 | <reponame>NinjasCL-labs/masonite-i18n<filename>lang/helpers/filesystem/openers.py
# coding: utf-8
# See https://docs.pyfilesystem.org/en/latest/openers.html
OPERATING_SYSTEM = "osfs://"
MEMORY = "mem://"
| StarcoderdataPython |
270099 | <reponame>cerevo/-listnr-server-sample-py
# -*- coding: utf-8 -*-
# reference
# http://stackoverflow.com/questions/680305/using-multipartposthandler-to-post-form-data-with-python
from poster.encode import multipart_encode
from poster.streaminghttp import register_openers
import urllib2
import json
import sys
from Con... | StarcoderdataPython |
20684 | from sklearn.cluster import KMeans
import cv2
import PIL
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
from matplotlib import image as img1
import pandas as pd
from scipy.cluster.vq import whiten
import os
class DominantColors:
CLUSTERS = None
IMAGEPATH = None
I... | StarcoderdataPython |
11384119 | """
Generated by CHARMM-GUI (http://www.charmm-gui.org)
omm_readparams.py
This module is for reading coordinates and parameters in OpenMM.
Correspondance: <EMAIL> or <EMAIL>
Last update: March 29, 2017
"""
import os
from simtk.unit import *
from simtk.openmm import *
from simtk.openmm.app import *
def read_psf(fi... | StarcoderdataPython |
1806886 | # Copyright (c) 2020, Palo Alto Networks
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS... | StarcoderdataPython |
1738334 | <reponame>bgeisberger/gnsq
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division
import logging
from collections import defaultdict, deque
import blinker
import gevent
from gevent.event import AsyncResult
from gevent.pool import Group
from gevent.queue import Queue, Empty
from . import protocol a... | StarcoderdataPython |
3598579 | <filename>10_telephone/telephone.py
#!/usr/bin/env python3
"""
Author : hongm <<EMAIL>>
Date : 2022-04-02
Purpose: Rock the Casbah
"""
import argparse
import random
import os
import string
import sys
# --------------------------------------------------
def get_args():
"""Get command-line arguments"""
pars... | StarcoderdataPython |
4849329 | <gh_stars>0
from itertools import product
a, b = list(map(int, input().split())), list(map(int, input().split()))
print(*list(product(a, b))) | StarcoderdataPython |
6494554 | import bpy
import time
from bpy.types import Operator, Panel, PropertyGroup
from bpy.props import PointerProperty, StringProperty, FloatProperty
class VideoSMaskSettings(PropertyGroup):
url: StringProperty(
name="URL",
description="Server address",
default="localhost:9999",
)
thr... | StarcoderdataPython |
12820738 | <gh_stars>0
#!/usr/bin/env python3
import numpy as np
import struct
import sys
import nibabel as nib
import pdb
def readNii(fname):
"""Read a given filename and return a dict"""
img = nib.load(fname)
if type(img) != nib.nifti1.Nifti1Image\
and type(img) != nib.nifti1.Nifti2Image:
raise V... | StarcoderdataPython |
12846938 | # Generated by Django 3.1 on 2020-09-09 19:21
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('patient_app', '0005_auto_20200817_1713'),
]
operations = [
migrations.AlterField(
model_name='booking_patient',
... | StarcoderdataPython |
3250243 | import rlp
from rlp.sedes import big_endian_int, binary
from ethereum import utils
from plasma.utils.utils import get_sender, sign
from enum import IntEnum
from web3 import Web3
class Transaction(rlp.Serializable):
TxnType = IntEnum('TxnType', 'transfer make_order take_order')
UTXOType = IntEnum('UTXOType', 't... | StarcoderdataPython |
1884113 | from grtoolkit.Math import solveEqs
def kinematicsEq(find, printEq=False, **kwargs):
"""variables:
d=distance, d0=initial distance,
v=velocity, v0=initial velocity,
a=acceleration,
t=time"""
eq = list()
eq.append("Eq(d, v*t)")
eq.appen... | StarcoderdataPython |
8146057 | # 앞서 계산된 결과를 저장하기 위한 DP 테이블 초기화
d = [0] * 100
# 첫 번째 피보나치 수와 두 번째 피보나치 수는 1
d[1] = 1
d[2] = 1
n = 99
# 피보나치 함수(Fibonacci Function) 반복문으로 구현(보텀업 다이나믹 프로그래밍)
for i in range(3, n + 1):
d[i] = d[i - 1] + d[i - 2]
print(d[n]) # 실행결과 : 218922995834555169026 | StarcoderdataPython |
6651210 | # Copyright (c) 2019 - The Procedural Generation for Gazebo authors
# For information on the respective copyright owner see the NOTICE file
#
# 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 |
1680217 | <gh_stars>1-10
import os
import sys
import requests
APP_TEMPLATE_IDS = {
'Production' : 'f340796d-d2b8-4957-a544-0eaa3716c5f7',
'Preview' : 'bdbaaf2c-2925-401e-8ce8-c2b3fe6491e0',
'Staging' : 'd5e6a0c7-2540-4421-a961-eaf454e8f6b5',
'Test' : 'a8398609-32fa-4f3f-bad5-b9b9717ff64f',
'I... | StarcoderdataPython |
11217705 | <gh_stars>0
# -*- coding: utf-8 -*- #
# Copyright 2016 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
#
# U... | StarcoderdataPython |
345376 | <gh_stars>1-10
# Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# The Universal Permissive License (UPL), Version 1.0
#
# Subject to the condition set forth below, permission is hereby granted to any
# person obtaining a copy of t... | StarcoderdataPython |
9673125 | import numpy as np
import pandas as pd
from pprint import pprint
import argparse
from pytorch_pretrained_bert.tokenization import (BasicTokenizer,
BertTokenizer, whitespace_tokenize)
import collections
import torch
from torch.utils.data import TensorDataset
from pytorch... | StarcoderdataPython |
5002063 | <filename>portal/apps/videologue/templatetags/videologue_tags.py
# -*- coding: utf-8 -*-
from videologue.models import YouTubeVideo
from django.template import (Context, Library, loader, Node, TemplateSyntaxError)
from string import lower
register = Library()
TPL_DIR = 'videologue/templates/'
class RenderLatestVid... | StarcoderdataPython |
4975580 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import pandas as pd
import gym
class Numpy(gym.Wrapper):
"""
This wrapper converts
* states from pandas to numpy
"""
def _convert_state(self, state):
if isinstance(state, pd.DataFrame):
state = state.values.reshape(*self.obser... | StarcoderdataPython |
159575 | <filename>consolidator_script.py<gh_stars>1-10
'''
This program downloads the following
1. One zerodha holding excel sheet
2. Two icici direct holding excel sheet
3. All listed active equities on NSE (not in active code)
4. All listed active equities on BSE (not in active code)
5. Moves all the above files to the curre... | StarcoderdataPython |
1619210 | #!/usr/bin/env python3
# _*_coding:utf-8_*_
import os
from common.LogManage import get_logger
from common.settingLib import get_mongodb_db
settings = dict(
template_path=os.path.join(os.path.dirname(__file__), "templates"),
static_path=os.path.join(os.path.dirname(__file__), "static"),
cookie_secret="<KEY... | StarcoderdataPython |
11335463 | <reponame>KTH-UrbanT/MUBES_UBEM
""" This example uses FMpy as a environment to make FMU simulation. It deals only with
changing the set point for 2 hours for each building one after the other. Thus change frequency depends
on the number of FMU considered in total."""
import os,sys
from fmpy import *
#from fmpy.fmi... | StarcoderdataPython |
1913996 | <reponame>abhishekshah67/weebullet
#!/usr/bin/env python
# vim: set fileencoding=utf8 ts=4 sw=4 expandtab :
import json
import re
import urllib.parse
import time
import weechat as w
# Constant used to check if configs are required
REQUIRED = '_required'
w.register('weebullet',
'Lefty',
'0.5.1'... | StarcoderdataPython |
6509350 | from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction.text import HashingVectorizer
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.feature_extraction.text import TfidfTransformer
import os
# TODO
# compare vectorizers
def countvectorizer(inputpath=None... | StarcoderdataPython |
5001276 | <filename>lib/spack/spack/tag.py
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
"""Classes and functions to manage package tags"""
import collections
import copy
import s... | StarcoderdataPython |
8012424 | from builtins import range
import numpy as np
from random import shuffle
from past.builtins import xrange
def softmax_loss_naive(W, X, y, reg):
"""
Softmax loss function, naive implementation (with loops)
Inputs have dimension D, there are C classes, and we operate on minibatches
of N examples.
... | StarcoderdataPython |
4837059 | <filename>src/rf_network/plugins.py
# -*- coding: utf-8 -*-
import importlib
import sys
import pluggy
from . import hookspecs
DEFAULT_PLUGINS = (
"rf_network.connection.netmiko",
"rf_network.connection.scrapli",
)
plugin_manager = pluggy.PluginManager("rf_network")
plugin_manager.add_hookspecs(hookspecs)
i... | StarcoderdataPython |
8025223 | <filename>bims/models/data_source.py
from django.contrib.gis.db import models
class DataSource(models.Model):
"""Data source for forms"""
name = models.CharField(
null=False,
blank=False,
max_length=200
)
category = models.CharField(
null=True,
blank=True,
... | StarcoderdataPython |
3341556 | <filename>resources/lib/settingsCommandline.py
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: MIT
"""
The base settings module
Copyright 2020, Mediathekview
"""
from resources.lib.settingsInterface import SettingsInterface
class SettingsCommandline(SettingsInterface):
""" Standalone implementation of the se... | StarcoderdataPython |
393331 | <reponame>kr-g/pttydev
import serial # its pyserial
def pttyopen(**kwargs):
# a open function is required to reconnect properly the device in case of error
ser = serial.Serial(**kwargs)
return ser
| StarcoderdataPython |
8085621 | """
ASGI entrypoint. Configures Django and then runs the application
defined in the ASGI_APPLICATION setting.
"""
import os
import django
from channels.http import AsgiHandler
from channels.routing import ProtocolTypeRouter, URLRouter
from channels.security.websocket import AllowedHostsOriginValidator
from dakara_se... | StarcoderdataPython |
9648792 | """
13C Pure In-phase D-CEST
========================
Analyzes chemical exchange in the presence of 1H composite decoupling during
the D-CEST block. This keeps the spin system purely in-phase throughout, and
is calculated using the (3n)×(3n), single-spin matrix, where n is the number
of states::
{ Ix(a), Iy(a), I... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.