id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
3385791 | from __future__ import annotations
from typing import TYPE_CHECKING, Optional
from .user import User
if TYPE_CHECKING:
from .server import Server
from .state import State
from .types import Member as MemberPayload
__all__ = ("Member",)
def flattern_user(member: Member, user: User):
for attr in use... | StarcoderdataPython |
3296070 | <filename>var/spack/repos/builtin/packages/py-xdot/package.py
# Copyright 2013-2021 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)
from spack import *
class PyXdot(PythonPackage):
"""xd... | StarcoderdataPython |
3332257 | <filename>lizardanalysis/calculations/stride_length_and_frequency.py<gh_stars>1-10
def stride_length_and_frequency(**kwargs):
"""
Stride length = distance covered by body during one step (swing + stance) in px
Stride frequency = number of strides per second (determined with the framerate defined in the conf... | StarcoderdataPython |
162679 | """Config flow tests."""
import requests
from zoneminder.zm import ZoneMinder
from homeassistant import config_entries
from homeassistant.components.zoneminder import ClientAvailabilityResult, const
from homeassistant.const import (
CONF_HOST,
CONF_PASSWORD,
CONF_PATH,
CONF_SOURCE,
CONF_SSL,
CO... | StarcoderdataPython |
3348315 | # md5 : 7cf8d5549f3c4b0a7870d0e515a9c033
# sha1 : 2be54bd63ab58118a845ed5fd57ad35ee54301b4
# sha256 : b3094ce056324c5d330849d020e0c3a2e4a7359b17434be3ae13e0f8354ce14d
ord_names = {
1: b'OleUIAddVerbMenuA',
2: b'OleUICanConvertOrActivateAs',
3: b'OleUIInsertObjectA',
4: b'OleUIPasteSpecialA',
5: b'O... | StarcoderdataPython |
1670746 | <reponame>terry-brett/SimulatorX
#!/usr/bin/env python3
import pathlib
from utils import PROJECT_ROOT, error_handler, gray, print_with_time, red, run
def _isort(path: pathlib.Path) -> None:
"""
Run isort recursively on provided path. Print error message if path does not exist
"""
if path.exists():
... | StarcoderdataPython |
72404 | # coding=utf-8
# Copyright 2020 The Trax Authors.
#
# 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 a... | StarcoderdataPython |
3319365 | <reponame>chrisfrrrr/Tarea-preparatoria-1-proyectos-de-computaci-n<filename>pedirnumero.py<gh_stars>0
def comparacion():#Definiendo para hacer una comparación de valores
prueba = False
while(not prueba):
try:
A = int(input("Ingrese el primer valor\n"))
B = int(input("Ingrese el... | StarcoderdataPython |
1728435 | <filename>test_telneter.py
from __future__ import print_function
import mock
import unittest
import telneter
import find_IACSE
from telneter import IAC, SB, SE, WILL, WONT, DO, DONT, STATUS
def multi_parse(data):
parses = []
while data:
parses.append(telneter.parse(data))
data = parses[-1][-1... | StarcoderdataPython |
1719295 | import sys, os, plotly
import numpy as np
script_path = os.path.realpath(__file__)
script_dir = os.path.split(script_path)[0]
sys.path.insert(0, '%s/../python' % script_dir)
from vaxxer.models import VaxxerClassifier
from vaxxer.utils import show_dynamic_auc
from sklearn.metrics import roc_auc_score
prepared_data_dir ... | StarcoderdataPython |
3324503 | from .version import __version__ # noqa
from .buildsimhub import BuildSimHubAPIClient
import BuildSimHubAPI.htmlParser
import BuildSimHubAPI.helpers
import BuildSimHubAPI.measures
# import BuildSimHubAPI.postprocess
| StarcoderdataPython |
3227131 | <filename>moss/misc.py
"""Miscellaneous utility functions."""
import gzip
import itertools
import numpy as np
import pandas as pd
from scipy import stats
import six.moves.cPickle as pickle
def df_to_struct(df):
"""Converts a DataFrame to RPy-compatible structured array."""
struct_array = df.to_records()
... | StarcoderdataPython |
1738851 | """
Class used to model NICMOS specific instrument data.
:Authors: <NAME>, <NAME>, <NAME>
:License: :doc:`LICENSE`
"""
from stsci.tools import fileutil
from nictools import readTDD
import numpy as np
from .imageObject import imageObject
class NICMOSInputImage(imageObject):
SEPARATOR = '_'
def __init__(sel... | StarcoderdataPython |
3233174 | #!/usr/bin/env python
'''CloudWorker Node Agent Runner'''
from src import main
if __name__ == '__main__':
main.start()
| StarcoderdataPython |
3333408 | from xd.build.core.manifest import *
import os
import logging
log = logging.getLogger(__name__)
log.setLevel(logging.INFO)
parser_help = 'Show recipe specification'
def add_arguments(parser):
parser.add_argument(
'recipe',
help='recipe (name or path) to show')
return
def run(args, manifest, ... | StarcoderdataPython |
1639357 | <filename>setup.py
from setuptools import setup, find_packages
import openinghours as app
setup(
name="django-openinghours",
version=app.__version__,
description=open('DESCRIPTION').read(),
long_description=open('README.rst').read(),
license='The MIT License',
platforms=['OS Independent'],
... | StarcoderdataPython |
1751608 | <reponame>silence0201/Learn-Python
# coding: utf-8
#########################################################################
# 网站: <a href="http://www.crazyit.org">疯狂Java联盟</a> #
# author yeeku.H.lee <EMAIL> #
# ... | StarcoderdataPython |
3237232 | <reponame>AoWangDrexel/green-screen-effect
import greenscreen
import os
from PIL import Image
# The function loads the images from the folder from the desktop
def load_images():
global f_entries
global b_entries
f_entries = os.listdir('Desktop/img resource/foreground')
b_entries = os.listdir('Desktop... | StarcoderdataPython |
3391136 | import os
from detectron2.data import build_detection_test_loader, build_detection_train_loader
from detectron2.engine import DefaultTrainer
from detectron2.evaluation import DatasetEvaluators
from fibercnn import FiberDatasetMapper
from fibercnn.evaluation.coco_evaluator import CustomCOCOEvaluator
class Trainer(Def... | StarcoderdataPython |
1624448 | <filename>Task4.py
"""
Read file into texts and calls.
It's ok if you don't understand how to read files.
"""
import csv
with open('texts.csv', 'r') as f:
reader = csv.reader(f)
texts = list(reader)
with open('calls.csv', 'r') as f:
reader = csv.reader(f)
calls = list(reader)
"""
TASK 4:
The telephon... | StarcoderdataPython |
133900 | # Python code for Make Music with the Circuit Playground Express
# by <NAME>
# Copyright (c) 2020 <NAME> All rights reserved
# Buy the book at https://www.amazon.com/author/rleander#
#
# metronome with slide switch, buttons and lights
from adafruit_circuitplayground import cp
import time
# initial set... | StarcoderdataPython |
100332 | <gh_stars>1-10
"""Utilities for testing"""
import itertools
from gameanalysis import rsgame
def basic_games():
"""Small basic games for testing"""
yield rsgame.empty(1, 2)
yield rsgame.empty(2, 2)
yield rsgame.empty(2, 3)
yield rsgame.empty(3, 2)
yield rsgame.empty(3, 3)
yield rsgame.empt... | StarcoderdataPython |
127658 | <filename>tests/spec_test.py
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import os
import pytest
import simplejson
from jsonschema.exceptions import ValidationError
from pyramid_swagger.spec import API_DOCS_FILENAME
from pyramid_swagger.spec import validate_swagger_schema
def test_success_for_go... | StarcoderdataPython |
1692314 | <reponame>AndrissP/cmssw
import FWCore.ParameterSet.Config as cms
# reco hit production
from RecoCTPPS.TotemRPLocal.ctppsDiamondRecHits_cfi import ctppsDiamondRecHits
# local track fitting
from RecoCTPPS.TotemRPLocal.ctppsDiamondLocalTracks_cfi import ctppsDiamondLocalTracks
ctppsDiamondLocalReconstructionTask = cms... | StarcoderdataPython |
2231 | <gh_stars>0
#!/usr/bin/env python
import math
import numpy as np
def sd1(rr):
sdnn = np.std(rr)
return math.sqrt(0.5 * sdnn * sdnn) | StarcoderdataPython |
92355 | <reponame>RoastVeg/cports<gh_stars>10-100
pkgname = "python-py"
pkgver = "1.11.0"
pkgrel = 0
build_style = "python_module"
hostmakedepends = ["python-setuptools_scm"]
checkdepends = ["python-pytest"]
depends = ["python"]
pkgdesc = "Python development support library"
maintainer = "q66 <<EMAIL>>"
license = "MIT"
url = "... | StarcoderdataPython |
171219 | <filename>app.py
#!flask/bin/python
import sys
from flask import Flask
sys.path.insert(0, './local_sr')
app = Flask(__name__)
import api.sr
@app.route('/')
def index():
return "Hopefully this will eventually be a management console. For the moment, you get this message."
if __name__ == '__main__':
app.run... | StarcoderdataPython |
1741343 | # flake8: noqa
# There's no way to ignore "F401 '...' imported but unused" warnings in this
# module, but to preserve other warnings. So, don't check this module at all.
from ...file_utils import is_sentencepiece_available, is_torch_available
from .configuration_xlm_prophetnet import XLM_PROPHETNET_PRETRAINED_CONFIG_A... | StarcoderdataPython |
3327944 | <reponame>mishrakeshav/Competitive-Programming<filename>CodeChef/JULY20/CHFNSWPS.py
"""
1. The count of numbers that are not present in sequence 1 (c1 )
and count of numbers that are not present in sequence 2 (c2)
should be equal and each element should be present even number of time
in either of the se... | StarcoderdataPython |
1656316 | import os,sys,re
import datetime as dt
from fabric.api import *
from fabric.context_managers import hide
env.hosts = ['www']
env.root_dir = "/home/httpd"
env.projects = [ 'comics', 'chicks', 'redpics', 'earthporn', 'devgrabber' ]
def proj_path( proj ):
return os.path.join( env.root_dir, proj )
@task
def pil():
... | StarcoderdataPython |
1640662 | <gh_stars>1-10
from .hmm import HiddenMarkovModel, toy_example, new_left_to_right_hmm, restore_hmm, store_hmm
from .dataset import DataSet
| StarcoderdataPython |
1628634 | <reponame>koliupy/loldib
from getratings.models.ratings import Ratings
class NA_Caitlyn_Top_Aatrox(Ratings):
pass
class NA_Caitlyn_Top_Ahri(Ratings):
pass
class NA_Caitlyn_Top_Akali(Ratings):
pass
class NA_Caitlyn_Top_Alistar(Ratings):
pass
class NA_Caitlyn_Top_Amumu(Ratings):
pass
class NA_... | StarcoderdataPython |
1796545 | <reponame>n8henrie/urlmon
from urlmon.urlmon import Pushover
import keyring
def test_pushover():
"""Test pushover credentials"""
api_token = keyring.get_password('pushover', 'api_token')
pushover_user = keyring.get_password('pushover', 'user')
pushover = Pushover(api_token, pushover_user)
respon... | StarcoderdataPython |
163152 | import sys
from .danger import Danger, fail, markdown, message, warn
class DangerPlugin:
def __init__(self):
self._danger = None
self.message = message
self.markdown = markdown
self.warn = warn
self.fail = fail
def __init_subclass__(cls, **kwargs):
parent_modu... | StarcoderdataPython |
171448 | import numpy as np
from algorithms.ddpg.replay_buffer import ReplayBuffer
class PDSReplayBuffer(ReplayBuffer):
"""
Replay buffer for PDS-DDPG, just add some extra information to the basic replay buffer
"""
def __init__(self, state_dim, action_dim, length, batch_size):
super().__init__... | StarcoderdataPython |
3218654 | <filename>fuse_examples/classification/duke_breast_cancer/run_train_3dpatch.py
"""
(C) Copyright 2021 IBM Corp.
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/LICEN... | StarcoderdataPython |
154949 | <gh_stars>0
from __future__ import annotations
import random
from typing import List, Optional, Tuple, TYPE_CHECKING
import numpy as np # type: ignore
import tcod
from game.actions import Action, BossSpecialAttack, BumpAction, MeleeAction, MovementAction, WaitAction, BlindEnemyAction
if TYPE_CHECKING:
from enti... | StarcoderdataPython |
3237920 | from django.urls import path
from .views import GenerateOTP, VerifyOTP
urlpatterns = [
path("get_otp/", GenerateOTP.as_view(), name="get_otp"),
path("verify_otp/", VerifyOTP.as_view(), name="view_otp"),
] | StarcoderdataPython |
107066 | <gh_stars>0
from __future__ import absolute_import, division, unicode_literals
from . import support # noqa
import codecs
import sys
from io import BytesIO, StringIO
import pytest
import http.client as http_client
import urllib
from html5lib._inputstream import (BufferedStream, HTMLInputStream,
... | StarcoderdataPython |
58767 | from django.conf.urls import patterns, url
from irods_browser_app import views
urlpatterns = patterns('',
url(r'^login/$',views.login, name='irods_login'),
url(r'^store/$',views.store, name='irods_store'),
url(r'^upload/$',views.upload, name='irods_upload'),
url(r'^upload_add/$',views.upload_add, name=... | StarcoderdataPython |
3253844 | <reponame>emit-sds/emit-main
"""
This code contains the AcquisitionMonitor class that looks for recently modified acquisitions and creates tasks as
needed
Author: <NAME>, <EMAIL>
"""
import logging
import os
from emit_main.workflow.l1b_tasks import L1BCalibrate
from emit_main.workflow.l2b_tasks import L2BAbundance
f... | StarcoderdataPython |
3351237 | import re
from youtrackutils.fbugz.fogbugz import FogBugz
from youtrackutils.fbugz import FBUser, FBArea, FBMilestone, FBIssue, FBComment, FBAttachment
from datetime import datetime
import calendar
class FBClient(object):
def __init__(self, source_url, source_login, source_password):
self._source_url = so... | StarcoderdataPython |
1754202 | <filename>Introduction/scratch2.py
#08/03/2017
#with recurssive function
def heron_R(n, guess=1):
if abs((guess*guess)-n)<0.000001:
return guess
else:
guess=((guess+(n/guess))/2)
return heron_R(n,guess)
#iterative style
def heron_I(n):
guess=1
while abs((guess*guess)-n)>0.000001... | StarcoderdataPython |
19606 | <reponame>DanielJamesEvans/spectrophotometer_code<filename>get_image.py
"""This code contains functions called by gui.py.
This software is licensed under the MIT license.
"""
import time
from picamera.array import PiRGBArray
from picamera import PiCamera
from gpiozero import LED
import numpy as np
from PIL import ... | StarcoderdataPython |
1637388 | <reponame>Gogistics/prjGogistics
'''
Created on Jun 29, 2014
@author: user
'''
| StarcoderdataPython |
70371 | <reponame>briangu/pyEX
# *****************************************************************************
#
# Copyright (c) 2020, the pyEX authors.
#
# This file is part of the jupyterlab_templates library, distributed under the terms of
# the Apache License 2.0. The full license can be found in the LICENSE file.
#
# fo... | StarcoderdataPython |
3312877 | <filename>main.py
'''
AutomaticQA main
Created on 11/25/16
@author: xiaofo
'''
from src.AutomaticQA import AutomaticQA
from util.Dataloader import load
from util.PrintFunctions import show_relevant_questions
path = 'data/QueryResults.csv'
data = load(path)
automaticQA = AutomaticQA(data, 50)
#automaticQA.train()
#au... | StarcoderdataPython |
4813661 | <gh_stars>0
import importlib
from typing import Dict
from typing import Optional
from typing import Type
from flask import Flask
from posto.analytics.adapters import BaseAdapter
class AnalyticsConfigError(Exception):
pass
class AnalyticsClient:
"""Analytics adapter with adaptable storage engine."""
_... | StarcoderdataPython |
1648613 | from rubygems_utils import RubyGemsTestUtils
class RubyGemsTestrubygems_aws_sdk_databasemigrationservice(RubyGemsTestUtils):
def test_gem_list_rubygems_aws_sdk_databasemigrationservice(self):
self.gem_is_installed("aws-sdk-databasemigrationservice")
def test_load_aws_sdk_databasemigrationservice(self... | StarcoderdataPython |
3253731 | import cv2
import time
import numpy
import init_hand_tracking_module #initial file
import mediapipe
import math
from ctypes import cast, POINTER
from comtypes import CLSCTX_ALL
from pycaw.pycaw import AudioUtilities, IAudioEndpointVolume
| StarcoderdataPython |
1690980 | #Facebook Kaggle Competition
import time
import pandas as pd
import numpy as np
from sklearn.ensemble import RandomForestClassifier
from sklearn.preprocessing import LabelEncoder
XLIMIT = 10
YLIMIT = 10
FEATURE_LIST = ['x','y','accuracy','day','dow','hour']
def read_files(train_name, test_name):
types = {'row_id':... | StarcoderdataPython |
1627134 | # coding: utf8
import hmac
import time
import json
import ssl
import base64
import asyncio
import hashlib
import logging
from functools import partial
from http import HTTPStatus
from asyncio import iscoroutinefunction
from urllib.parse import urlencode, unquote_plus
from urllib.error import HTTPError, URLError
from ... | StarcoderdataPython |
1648449 | <reponame>zoeimogen/AoC2018<gh_stars>1-10
#!/usr/bin/python3
'''Advent of Code 2018 Day 20 solution'''
from typing import Dict, Tuple, Union
Grid = Dict[Tuple[int, int], int]
move_map = {'E': (1, 0),
'W': (-1, 0),
'N': (0, -1),
'S': (0, 1)}
def move(string: str, x: int = 0, y: int... | StarcoderdataPython |
46991 | """The pyccl package contains all of the submodules that are implemented in
individual files in CCL.
"""
# flake8: noqa
from pkg_resources import get_distribution, DistributionNotFound
try:
__version__ = get_distribution(__name__).version
except DistributionNotFound:
# package is not installed
pass
# Sets ... | StarcoderdataPython |
37694 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from time import timezone
from django.db import models
# Create your models here.
class UserInfo(models.Model):
user= models.CharField(max_length = 30)
pwd = models.CharField(max_length = 30)
# class Publisher(models.Model):
# name = models... | StarcoderdataPython |
142075 | # ------------------------------------------------------------------------------
# Hippocampus segmentation published by Dryad
# (https://datadryad.org/stash/dataset/doi:10.5061/dryad.gc72v)
# ------------------------------------------------------------------------------
import os
import SimpleITK as sitk
import mp.... | StarcoderdataPython |
136989 | <reponame>pasteben/bioinformatics-app
# DNA Toolset/Code testing file
from DNAToolkit import *
import sys
import json
import base64
content = json.loads(base64.b64decode(sys.argv[1]))
if "dataset" in content:
dataset = content["dataset"]
FASTADict = {}
FASTALabel = ""
for line in dataset.splitlines... | StarcoderdataPython |
3217431 | <filename>msdapp/msd/batchCompareMSD.py
# -*- coding: utf-8 -*-
"""
MSD Analysis script: compareMSD
Compiles MSD data from directories - expects input format:
STIM OR NOSTIM
| -- cell1 <-- uses this name as cell ID
| -- celldata
| -- Filtered_MSD.csv fi... | StarcoderdataPython |
3329876 | from django.contrib.auth import login, logout
from django.contrib.auth.forms import AuthenticationForm
from django.contrib.auth.views import LoginView, LogoutView
from django.http import HttpResponseRedirect
from django.shortcuts import redirect
from django.urls import reverse_lazy
from django.views.generic import Redi... | StarcoderdataPython |
3214930 | <filename>demo/testsuite-python/test_py_printnlogs.py
#
# version: 2.001
# <title>test print and logs</title>
# <description>This test doesn't do anything spectacular, prints and sends some logs.</description>
#
def test():
testName = 'test_py_printnlogs.py'
log_msg('logTest', "\nTestCase:%s starting\n" % testName... | StarcoderdataPython |
4802110 | <reponame>FirebirdSQL/firebird-qa
#coding:utf-8
#
# id: bugs.core_3283
# title: BAD PLAN with using LEFT OUTER JOIN in SUBSELECT
# decription:
# tracker_id: CORE-3283
# min_versions: ['2.5.1']
# versions: 2.5.1
# qmid: None
import pytest
from firebird.qa import db_factory, isql_act, A... | StarcoderdataPython |
1702662 | import cPickle as pkl
import h5py
from tqdm import tqdm
import os
train_h5_path = '../data/train36.hdf5'
val_h5_path = '../data/val36.hdf5'
train_id_path = '../data/train36_imgid2idx.pkl'
val_id_path = '../data/val36_imgid2idx.pkl'
save_obj_path = '../data/coco_obj'
train_obj_path = os.path.join(save_obj_p... | StarcoderdataPython |
1643767 |
import json
class DeleteUser:
def __init__(self, repo, requestParams, requestBody, pathParams):
self.repo = repo
self.requestParams = requestParams
self.requestBody = requestBody
self.pathParams = pathParams
def execute(self):
resp = self.repo.delete_user(self.pathParams['id'])
return {... | StarcoderdataPython |
1798201 | <filename>tests/test_protocol_getStates.py
import unittest
from tahoma.protocol import Protocol
from test_protocol_getSetup import SetupInput
class TestProtocolGetStates(unittest.TestCase):
def test_requestBuilding(self):
tahoma = Protocol("", "", unittest=1 )
tahoma._getSetup(SetupInput) # only ... | StarcoderdataPython |
44794 | <filename>tests/python_on_whales/components/test_system.py
import json
from datetime import date
from pathlib import Path
import pytest
from python_on_whales import docker
from python_on_whales.components.system.models import DockerEvent, SystemInfo
from python_on_whales.exceptions import DockerException
fro... | StarcoderdataPython |
3210461 | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from haystack import indexes
class AutocompleteEdgeNgramField(indexes.EdgeNgramField):
"""
Custom field for doing autocomplete searches.
"""
field_type = 'autocomplete_edge_ngram'
| StarcoderdataPython |
111437 | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | StarcoderdataPython |
3389228 | from re import sub
from res.ResourceFiles import NAMES_FILE, NODES_FILE, NODES_STATS_FILE
from TaxonomyTreeNode import TaxonomyTreeNode
class TaxonomyTree:
def __init__(self, databaseMode=False):
self.databaseMode = databaseMode
self.taxonomyNames = {} # key = TI
self.taxIDFromName = {... | StarcoderdataPython |
144211 | #!/usr/local/bin/python2.6
# Crawl Document Exporter
# Python code to export the crawling documents from the crawl repository out
#
# locate the input file and read the entire log file
# input: a MySQL database query
# output: a directory which contains the queried documents in hierachical order
# (or just in a batch... | StarcoderdataPython |
37943 | """ Session submodule
"""
from aiohttp import web
from servicelib.session import get_session
from servicelib.session import setup_session as do_setup_session
def setup(app: web.Application):
do_setup_session(app)
# alias
setup_session = setup
__all__ = (
"setup_session",
"get_session",
)
| StarcoderdataPython |
3362500 | <reponame>NoeCruzMW/zpy-flask-msc
from resources.greeting_resoource import GreetingResource
from config.api_configuration import apiConfig
from zpy.api import ZResource, api
@api(base="/api", config=apiConfig)
def create_api():
return [ZResource("/greeting", GreetingResource())]
app = create_api()
# 🚨 Only ... | StarcoderdataPython |
3336748 | <gh_stars>0
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-10-23 05:30
from __future__ import unicode_literals
from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = T... | StarcoderdataPython |
1724963 | import sys
from rest_framework.utils.field_mapping import get_relation_kwargs as drfget_relation_kwargs
from rest_framework.utils import field_mapping
def get_relation_kwargs(field_name, relation_info):
"""
DRF view_name doesn't know about namespaces
"""
field_kwargs = drfget_relation_kwargs(field_nam... | StarcoderdataPython |
9268 | <filename>emoji_utils.py
# unicode digit emojis
# digits from '0' to '9'
zero_digit_code = zd = 48
# excluded digits
excl_digits = [2, 4, 5, 7]
# unicode digit keycap
udkc = '\U0000fe0f\U000020e3'
hours_0_9 = [chr(i) + udkc for i in range(zd, zd + 10)
if i - zd not in excl_digits]
# number '10' emoji
hours_0_9... | StarcoderdataPython |
3232694 | from __future__ import division
import numpy as np
import tensorflow as tf
import rawpy
import math
import tensorflow.contrib.slim as slim
from Cchen import Cchen
class ModelBuilder:
#Tensorflow wrapper fuctions
#Assumes NHWC
def sliding_window(x,filter_size=1,strides=1,padding='VALID'):
if(type(fi... | StarcoderdataPython |
3371398 | <reponame>LizWanic/Client-Server<filename>Client_Final.py
#
# <NAME>
# Programming Assignment
# Step 2
# CS3502
# 21 February 2017
#
'''In order to run this program, Server_Final.py must also be running on a separate terminal. The program
can be run via the command line with the following syntax: python3 Client_Final... | StarcoderdataPython |
1689473 | """ contains generic test setup classes """
import itertools
class GenericTestSetup:
def __init__(self):
# reconfig parameters
self.WAVELENGTH_EDGE_VALUES = [100]
self.NODE_LIMITER_VALUES = [2]
self.CAPACITY_WAVELENGTH_VALUES = [100]
# topology specific
self.TOPOLO... | StarcoderdataPython |
140755 | <reponame>zbraniecki/pontoon<gh_stars>1-10
"""
Models for working with remote translation data stored in a VCS.
"""
import logging
import os
import shutil
from itertools import chain
from datetime import datetime
from django.utils import timezone
from django.utils.functional import cached_property
from pontoon.base ... | StarcoderdataPython |
1652592 | <filename>CNN Lanes/image_alteration.py
#%%
import numpy as np
import pickle
import os
import cv2
import copy
from imgaug import augmenters as iaa
import random
import noise
from scipy import misc
from sklearn import preprocessing
from PIL import Image, ImageFilter
import time
labels_path = 'labels/'
labels_pahts = os... | StarcoderdataPython |
1781383 | #!/usr/bin/env python
import boto3
import constants
s3 = boto3.resource('s3')
bucket = s3.Bucket(name=constants.BUCKET_NAME)
# Remove the images from the bucket
print('Emptying bucket', constants.BUCKET_NAME)
response = bucket.delete_objects(
Delete={
'Objects': [
{ 'Key': f"{constants.SANDW... | StarcoderdataPython |
3295735 | from rest_framework import viewsets
from .models import CustomUser
from .serializers import UserSerializer
class UserViewSet(viewsets.ReadOnlyModelViewSet):
queryset = CustomUser.objects.all()
serializer_class = UserSerializer
| StarcoderdataPython |
1763322 | <reponame>Dieg0Alejandr0/EquiBind
import copy
import inspect
import os
import shutil
from typing import Dict, Callable
import pyaml
import torch
import numpy as np
from datasets.samplers import HardSampler
from models import * # do not remove
from trainer.lr_schedulers import WarmUpWrapper # do not remove
from tor... | StarcoderdataPython |
1656824 | #!/usr/bin/python
# coding: utf8
from __future__ import absolute_import
import logging
import json
from geocoder.base import OneResult, MultipleResultsQuery
class OsmnResult(OneResult):
def __init__(self, json_content):
# proceed with super.__init__
super(OsmnResult, self).__init__(json_conten... | StarcoderdataPython |
4835861 | from . import conversions
from . import loadsave
from . import mapping
from . import readers
from . import writers
from .mapping import MappedAffine
from .loadsave import map, load, loadf, save, savef
# Import implementations
from .freesurfer.lta import LinearTransformArray
from .freesurfer.registerdat import Registe... | StarcoderdataPython |
117115 | import numpy as np
import cv2
face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
filename = "obama.jpg"
# Show the original image
img = cv2.imread(filename)
# Convert to grayscale, show it
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
faces = face_cascade.detectMultiScale(gray, 1.3, 5)
for ... | StarcoderdataPython |
1604808 | maximum = 0
length = 0
coll = [0, 1, 2]
for i in range(3, 1_000_001):
tmp = 0
calc = i
while calc > len(coll) - 1:
tmp += 1
calc = calc // 2 if calc % 2 == 0 else calc * 3 + 1
tmp += coll[calc]
coll.append(tmp)
if tmp > length:
length = tmp
maximum = i
print(ma... | StarcoderdataPython |
3362771 | <reponame>alexkunger/dialpad-python-sdk<filename>dialpad/resources/__init__.py<gh_stars>0
from .app_settings import AppSettingsResource
from .blocked_number import BlockedNumberResource
from .call import CallResource
from .call_router import CallRouterResource
from .callback import CallbackResource
from .callcenter imp... | StarcoderdataPython |
3222497 | <reponame>kjthegod/chromium<filename>build/android/pylib/local/device/local_device_environment.py
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from pylib.base import environment
from pylib.device import... | StarcoderdataPython |
3397011 | <gh_stars>0
import csv
import sys
with open(sys.argv[1]) as f1:
reader = csv.DictReader(f1)
times = []
for line in reader:
time_worked = int(line["WorkTimeInSeconds"])
times.append(time_worked)
avg_secs = sum(times)/len(times)
avg_mins = avg_secs / 60
avg_hrs = avg_mins / 60
print(f"av... | StarcoderdataPython |
1650426 | from . import ivy
from .ivy import *
| StarcoderdataPython |
3262153 | <gh_stars>100-1000
from click.testing import CliRunner
from google_drive_to_sqlite.cli import cli, DEFAULT_FIELDS
import httpx
import json
import pathlib
import pytest
import re
import stat
import sqlite_utils
TOKEN_REQUEST_CONTENT = (
b"grant_type=refresh_token&"
b"refresh_token=rtoken&"
b"client_id=14893... | StarcoderdataPython |
3225527 | <gh_stars>0
from typing import Dict, List, Tuple, Union
def flaecheninhalt(
breite: Union[float, int], laenge: Union[float, int]
) -> Union[float, int]:
return breite * laenge
def zeichenzaehlen(text: str) -> Dict[str, int]:
return {character: text.count(character) for character in text}
def fancy_fun... | StarcoderdataPython |
136107 | from PyQt5.QtWidgets import QMenuBar, QWidget
from PyQt5.QtCore import QCoreApplication, QEvent
from .command_menus import menus
class MenuBar(QMenuBar):
def __init__(self, parent: QWidget):
super().__init__(parent)
self.setup_menus()
def setup_menus(self):
for menu in menus:
... | StarcoderdataPython |
3396418 | <gh_stars>0
STATUS_WIN = "win"
STATUS_LOSE = "lose"
STATUS_ONGOING = "ongoing"
class Hangman:
def __init__(self, word):
self.word = word
self.masked_word = '_' * len(word)
self.remaining_guesses = 9
self.guesses = set()
self.status = STATUS_ONGOING
def guess(self, char... | StarcoderdataPython |
3203773 | from util.config import SO_POSTS_STORE_PATH, EUREKA_DATASET_STORE_PATH, EUREKA_FULL_DATASET_FILE_NAME, JAVADOC_GLOBAL_NAME, APIDOC_ROOT_URL, APIDOC_API_URL_REGEX_PATTERN
from bs4 import BeautifulSoup
from util.utils import get_all_indexes
from tqdm import tqdm
import os
import pickle
import json
import re
'''
EUREKA-... | StarcoderdataPython |
3248843 | <gh_stars>0
#!/usr/bin/env python
# -*- coding: utf8 -*-
#
# Copyright (c) 2014 unfoldingWord
# http://creativecommons.org/licenses/MIT/
# See LICENSE file for details.
#
# Contributors:
# <NAME> <<EMAIL>>
#
import os
import sys
import json
import codecs
import urllib2
api_url = u'https://api.unfoldingword.org/o... | StarcoderdataPython |
88171 | from django.urls import path
from django.urls import re_path
from . import views
app_name = 'events'
urlpatterns = [
path('', views.user_created, name='user_events'),
path('new', views.create_event, name='new_event'),
path('<int:pk>', views.event_detail, name='event_detail'),
path('<int:pk>/edit/', vi... | StarcoderdataPython |
1661796 | '''light_curve_class.py - <NAME> - Feb 2019
This contains a class useful for organizing an object's light curve and
other useful data, just to keep things clean going forward.
'''
import numpy as np
class light_curve():
''' A base class for storing the basic light curve data: times,
magnitudes, and errors.... | StarcoderdataPython |
3255743 | <gh_stars>100-1000
def main():
print("Hello".__len__())
a = 1
b = 2
print(a.__add__(b))
if __name__ == '__main__':
main() | StarcoderdataPython |
1734389 | from django.urls import path
from .views import ErrorLogView, ErrorLogListView
from registration import views
app_name = "logmanager"
urlpatterns = [
path('error/<ticket>/', ErrorLogListView.as_view(), name="error_list"),
path('error/<ticket>/<id>', ErrorLogView.as_view(), name='error_get'),
path('error/... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.