id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
4819128 | <filename>tests/test_sdflint_script.py
#!/usr/bin/env python
# Copyright (c) 2020 - 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 wi... | StarcoderdataPython |
129536 | <reponame>datakurre/ZServer<gh_stars>1-10
##############################################################################
#
# Copyright (c) 2002 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL shou... | StarcoderdataPython |
1643883 | <filename>arxiv/canonical/register/file.py
from .core import (Base, D, R, I, ICanonicalStorage, ICanonicalSource, _Self)
class RegisterFile(Base[str,
D.CanonicalFile,
R.RecordFile,
I.IntegrityEntry,
None,
... | StarcoderdataPython |
3275164 | from django.test import TestCase
from datetime import date
from .. import utilities
class CalculatePeriodTest(TestCase):
@classmethod
def setUpTestData(cls):
cls.start_date = date(2020, 8, 15)
def test_day_period(self):
dates = utilities.calculate_period("day", start_date=self.start_dat... | StarcoderdataPython |
3305773 | from openstuder import SIGatewayClient, SIStatus
import argparse
import datetime
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Export datalog values to CSV file.')
parser.add_argument('-H', '--host', type=str, default='localhost', help='Host to connect to, defaults to localhost.')
... | StarcoderdataPython |
1742168 | default_app_config = 'cmdbox.scaffold_templates.apps.ScaffoldTemplatesConfig'
| StarcoderdataPython |
119200 | <reponame>kandluis/cs224w
# coding: utf-8
# ## 1. Analyzing the Wikipedia voters network [9 points]
# Download the Wikipedia voting network wiki-Vote.txt.gz: http://snap.stanford.edu/
# data/wiki-Vote.html.
#
# Using one of the network analysis tools above, load the Wikipedia voting network.
#
# Note that Wikipedi... | StarcoderdataPython |
4836133 | <gh_stars>1-10
"""
File: _base.py
Author: <NAME>
GitHub: https://github.com/PanyiDong/
Mathematics Department, University of Illinois at Urbana-Champaign (UIUC)
Project: My_AutoML
Latest Version: 0.2.0
Relative Path: /My_AutoML/_imputation/_base.py
File Created: Tuesday, 5th April 2022 11:49:51 pm
Author: <NAME> (<EMA... | StarcoderdataPython |
1689710 | <reponame>sharma-divyanshu/YOLO-Keras
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 13 19:25:17 2018
@author: divyanshu
"""
from PIL import Image
import matplotlib.pyplot as plt
import numpy as np
import cv2
lola = cv2.imread('images.jpeg')
image = Image.open('images.jpeg')
opencv = np.asa... | StarcoderdataPython |
3249499 | import argparse
import sys
import warnings
import numpy as np
import skimage.io
import skimage.util
from medpy.filter.smoothing import anisotropic_diffusion
parser = argparse.ArgumentParser()
parser.add_argument('input_file', type=argparse.FileType('r'), default=sys.stdin, help='input file')
parser.add_argument('out_f... | StarcoderdataPython |
1651525 | # Copyright (c) OpenMMLab. All rights reserved.
import glob
import os
import torch
from ..utils import ext_loader
#ext_module = ext_loader.load_ext(
# '_ext', ['get_compiler_version', 'get_compiling_cuda_version'])
def get_compiler_version():
return '0.0.0'
#return ext_module.get_compiler_version()
def ... | StarcoderdataPython |
4801388 | <reponame>aryaanlambe/NatGeo-Daily-Photo
from bs4 import BeautifulSoup
import requests, shutil, datetime,os
'''
File: FILENAME:file_name
Author: <NAME>
Description: Get & Save Photo of the Day from nationalgeographic.com
'''
r = requests.get("https://www.nationalgeographic.com/photography/photo-of-the-day/")
data = r.... | StarcoderdataPython |
4807281 | <reponame>paccy-ops/locationApi<filename>locations/data/create_db.py
import psycopg2
class CreateDatabase:
def __init__(self):
self.db = 'map_api'
self.user = 'postgres'
self.password = '<PASSWORD>'
self.host = '127.0.0.1'
self.port = '5432'
self.message = 'Table c... | StarcoderdataPython |
3218614 | <gh_stars>1-10
"""Tests for the Bulb API."""
from typing import AsyncGenerator
from unittest.mock import patch
import pytest
from pywizlight import SCENES, PilotBuilder, wizlight
from pywizlight.bulb import states_match
from pywizlight.bulblibrary import BulbClass, BulbType, Features, KelvinRange
from pywizlight.disc... | StarcoderdataPython |
60109 | # ----------------------------------------------------------------------------
# CLASSES: nightly
#
# Test Case: h5part.py
#
# Programmer: <NAME>
# Date: January, 2009
#
# Modifications:
# <NAME>, Wed Jan 21 09:36:13 PST 2009
# Took Gunther's original code and integrated it with test suite.
#
# ----... | StarcoderdataPython |
1657906 | import gym
import numpy as np
from railrl.torch.dqn.double_dqn import DoubleDQN
import railrl.misc.hyperparameter as hyp
import railrl.torch.pytorch_util as ptu
from railrl.launchers.launcher_util import run_experiment
from railrl.torch.dqn.dqn import DQN
from railrl.torch.networks import Mlp
from torch import nn as ... | StarcoderdataPython |
29949 | import cv2
import numpy as np
from keras.models import load_model
bg = None
def run_avg(image, acc_weight):
global bg
if bg is None:
bg = image.copy().astype("float")
return
cv2.accumulateWeighted(image, bg, acc_weight)
def segment(image, threshold=10):
global bg
diff = cv2.absdif... | StarcoderdataPython |
1765500 | # Range01.py
# a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
a= list(range(10))
print(a)
b= list(range(1, 11))
print(b)
c= list(range(0, 11, 2))
print(c)
d= list(range(10, 0, -1))
print(d)
f= a[1::2]
f= [i for i in a if i%2 ==1]
print(f)
# a에서 홀수만 제곱해서 g에 복사
g = [i**2 for i in a if i%2 ==1]
print("g is : {}".format(g))
# a... | StarcoderdataPython |
3255280 | import pytest
from Tests.App import asyncClient
@pytest.mark.anyio
async def testLogin():
response = await asyncClient.post("/internalLogin",
data={"email": "<EMAIL>", "password": "<PASSWORD>"})
assert response.status_code == 303
@pytest.mark.anyio
async def testLoginI... | StarcoderdataPython |
3392262 | <filename>config.py<gh_stars>100-1000
# workspace = ""
workspace = "/vol/vssp/msos/qk/workspaces/ICASSP2018_dcase"
# config
sample_rate = 16000.
n_window = 1024
n_overlap = 360 # ensure 240 frames in 10 seconds
max_len = 240 # sequence max length is 10 s, 240 frames.
step_time_in_sec = float(n_window - n_... | StarcoderdataPython |
1696017 | import torch
import torch.nn as nn
import torch.nn.functional as F
import pdb
import numpy as np
import network.resnet38d
class Net(network.resnet38d.Net):
def __init__(self, k_cluster, from_round_nb):
super().__init__()
self.k = k_cluster
self.from_round_nb = from_round_nb
print... | StarcoderdataPython |
146882 | #!/usr/bin/python
# vim: tabstop=4 shiftwidth=4 softtabstop=4
"""
Name : smgr_edit.py
Author : <NAME>
Description : This program is a simple cli interface to
edit server manager configuration objects.
Objects can be cluster or server.
"""
import logging
import pdb
import sys
import ast
from itertools im... | StarcoderdataPython |
3328874 | <reponame>sajalshres/kanban-on-django-marionette<filename>backend/apps/profile/models.py
import os
from django.contrib.auth.models import AbstractUser
from django.db import models
class Icon(models.Model):
image = models.ImageField(upload_to="user-icons")
def __str__(self) -> str:
return os.path.bas... | StarcoderdataPython |
3366698 | <filename>pype/plugins/nuke/publish/extract_script_save.py
import nuke
import pyblish.api
class ExtractScriptSave(pyblish.api.Extractor):
"""
"""
label = 'Script Save'
order = pyblish.api.Extractor.order - 0.1
hosts = ['nuke']
def process(self, instance):
self.log.info('saving script... | StarcoderdataPython |
152710 | <reponame>nl2412/aci2019
import socket
import asyncio
import pyaudio
import sys
import struct
import math
import datetime
import logging
class SoundDetector():
def __init__(self, threshold):
self.chunk = 1024
self.format = pyaudio.paInt16
self.channels = 1
self.dev_index = 2
... | StarcoderdataPython |
3317711 | import os
import unittest
from conans.server.plugin_loader import load_authentication_plugin
from conans.test.utils.test_files import temp_folder
from conans.util.files import save
class AuthenticatorPluginTest(unittest.TestCase):
def instance_authenticator_test(self):
folder = temp_folder()
plu... | StarcoderdataPython |
1611358 | <filename>model/add_concepts.py
from clarifai.rest import ClarifaiApp
from clarifai.rest import Image as ClImage
import os
app = ClarifaiApp(api_key=os.environ['CLARIFAICONSTANT'])
def chunks(l, n):
"""Yield successive n-sized chunks from l."""
for i in range(0, len(l), n):
yield l[i:i + n]
cardboard... | StarcoderdataPython |
159574 | def counting():
y = 1
while y<500:
yield y #This is a great way to iterate through one number at a time. It will go forever if needed.
y += 1
for y in counting():
print(y) | StarcoderdataPython |
198597 | <gh_stars>0
"""This module defines defines operations for a singly linked lists.
"""
from copy import copy, deepcopy
class LinkedList:
"""A class that instantiates a new linked lists
"""
def __init__(self, iterable=None):
self.head = None
if iterable:
for value in iterable:
... | StarcoderdataPython |
160182 | from django.db import models
from companies_app.models import Company
class Documents(models.Model):
__choice =((1, "yarandi"),
(2, "gonderen imzaldir"),
(3, "qebul eden imzaldir"),
(4, "qebul eden imtina etdi"),
(5, "vaxti bitib"))
__doct_type_choice = ((1, "muqvile"),
(2, "hesab_faktura")... | StarcoderdataPython |
1674517 | <reponame>enriquecoronadozu/NEP_samples
import nep
import time
import nep # Import nep library
server = nep.server('127.0.0.1', 30000, 'normal') # Create a new server instance
while True:
msg = "server response" # Message to send as response (string)
request = server.listen_info() # Wait for clie... | StarcoderdataPython |
70732 | <filename>tests/cases/py_client/cli_test.py<gh_stars>0
# -*- coding: utf-8 -*-
import contextlib
import girder_client.cli
import io
import logging
import mock
import os
import requests
import shutil
import sys
import six
import httmock
from girder import config
from girder.models.api_key import ApiKey
from girder.mode... | StarcoderdataPython |
93526 | from datetime import datetime
from typing import List, Dict, Union
import pytest
from dataclasses import field
from krake.data.config import HooksConfiguration
from krake.data.core import Metadata, ListMetadata
from krake.data.kubernetes import ClusterList
from marshmallow import ValidationError
from krake.data.serial... | StarcoderdataPython |
1709521 | import numpy as np
from ConfigSpace.hyperparameters import (CategoricalHyperparameter,
OrdinalHyperparameter, Constant,
UniformFloatHyperparameter,
UniformIntegerHyperparameter)
def get_types(con... | StarcoderdataPython |
68129 | target_num = int(input())
sum_nums = 0
while sum_nums < target_num:
input_num = int(input())
sum_nums += input_num
print(sum_nums) | StarcoderdataPython |
3348961 | import os
import cv2
import random
import numpy as np
import shutil
'''
目录结构组织为(divide前):
.../
rootDir/
originDir/
bear/
bicycle/
bird/
...
目录结构组织为(divide之后):
.../
rootDir/
originDir/
be... | StarcoderdataPython |
3322092 | <gh_stars>0
""" 63 - Escreva um programa que leia um número N inteiro qualquer e mostre na tela os N primeiros elementos de uma
sequência de Fibonacci.
Exemplo: 0 - 1 - 1 - 2 - 3 - 5 - 8 - 13"""
# Minha resposta:
print('-' * 59)
print(f"{'Sequência de Fibonacci':^50}")
print('-' * 59)
n = int(input('Quantos termos voc... | StarcoderdataPython |
1755475 | <filename>src/benchmark/__main__.py<gh_stars>0
#!/usr/bin/env python3
"""
GAMS Benchmark
Author: <NAME>, GAMS Software GmbH
"""
import argparse
import os
import sys
from scheduler import Scheduler
from output import Output
def _check_int_positive(value):
try:
ivalue = int(value)
except ValueError:
... | StarcoderdataPython |
1761602 | <filename>GPErks/train/train_stats.py
import json
from typing import Dict, List
import numpy
from matplotlib import pyplot as plt
from GPErks.constants import HEIGHT, WIDTH
class TrainStats:
def __init__(self, metrics_names):
self.current_epoch: int = 0
self.best_epoch: int = 0
self.trai... | StarcoderdataPython |
11827 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
"""
Скрипт выводит список ip государственных организаций.
"""
import ipaddress
import sys
import requests
rs = requests.get('https://jarib.github.io/anon-history/RuGovEdits/ru/latest/ranges.json')
# Проверка удачного запроса и полученных д... | StarcoderdataPython |
3338192 | # More on this kata
# https://www.codewars.com/kata/55c45be3b2079eccff00010f
def order(sentence):
if sentence is None:
return []
letters, ret = {}, ''
for word in sentence.split():
for letter in word:
if letter.isdigit():
letters.update({word:int(letter)})
fo... | StarcoderdataPython |
1752166 | <gh_stars>1-10
class VaultError(Exception):
def __init__(self, message=None, errors=None):
if errors:
message = ', '.join(errors)
self.errors = errors
super(VaultError, self).__init__(message)
class InvalidRequest(VaultError):
pass
class Unauthorized(VaultError):
pa... | StarcoderdataPython |
3215021 | <reponame>tlambert03/image-demos<gh_stars>0
"""
Test adding an image with a range one dimensions.
There should be no slider shown for the axis corresponding to the range
one dimension.
"""
import numpy as np
from skimage import data
import napari
with napari.gui_qt():
viewer = napari.view_image(np.random.rando... | StarcoderdataPython |
3371896 | from setuptools import find_packages, setup
with open('VERSION.txt') as fp:
version = fp.read().strip()
with open('README.md') as fp:
readme = fp.read()
with open('requirements.txt') as fp:
requirements = fp.read().splitlines()
setup(
name='mcdb',
version=version,
author='Arcensoth',
aut... | StarcoderdataPython |
1613800 | # AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from __future__ import unicode_literals
from ..modelgen import SpecifySPMModel
def test_SpecifySPMModel_inputs():
input_map = dict(
bids_amplitude_column=dict(),
bids_condition_column=dict(usedefault=True, ),
bids_event_file=dict(
... | StarcoderdataPython |
3305375 | <reponame>mnursey/Battlesnake-2021
EMPTY = 0
FOOD = 1
MY_HEAD = 2
MY_BODY = 3
ENEMY_HEAD = 4
ENEMY_BODY = 5
class Board:
blocked_values = [MY_HEAD, MY_BODY, ENEMY_HEAD, ENEMY_BODY]
grid = None
width = 0
def __init__(self, data):
self.width = data['board']['width']
self.grid = [[EM... | StarcoderdataPython |
1760852 | #!/usr/bin/env python
import argparse
import sys
import os
import time
import traceback
import sys
import ctypes
import subprocess
from subprocess import Popen, PIPE
import shutil
from optparse import OptionParser
from biokbase.workspace.client import Workspace
import urllib
import urllib2
import json
from biokbase im... | StarcoderdataPython |
4831423 | # Copyright 2020 The Cirq Developers
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | StarcoderdataPython |
3275244 | from util.common import JavaCreator
JavaCreator.set_creator_class(
"com.intel.analytics.zoo.transform.vision.pythonapi.PythonVisionTransform")
| StarcoderdataPython |
1685762 | #!/usr/bin/env python
# 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, sof... | StarcoderdataPython |
3253335 | # Copyright 2017 AT&T Intellectual Property. All other 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... | StarcoderdataPython |
163450 | # Generated by Django 3.0.5 on 2020-10-18 22:25
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('shelter', '0023_animal_adopted_by'),
]
operations = [
migrations.AlterField(
model_name='animal... | StarcoderdataPython |
3275333 | <reponame>mribrgr/StuRa-Mitgliederdatenbank<filename>aemter/tests/test_apps.py
from django.apps import apps
from django.test import TestCase
from aemter.apps import AemterConfig
class ReportsConfigTest(TestCase):
def test_apps(self):
self.assertEqual(AemterConfig.name, 'aemter')
self.assertEqual(a... | StarcoderdataPython |
69295 | <filename>tests/test_inline_action/test.py
from uuoskit import chainapi, config, wallet
from uuoskit import test_helper
async def update_code_auth(uuosapi):
a = {
"account": test_account1,
"permission": "active",
"parent": "owner",
"auth": {
"threshold": 1,
"... | StarcoderdataPython |
1722432 | <reponame>MaggieQi/spartan<filename>tests/test_broadcast.py
from spartan import expr, util
from spartan.util import Assert
import test_common
import numpy as np
from scipy import sparse as sp
from spartan.expr import broadcast
class TestBroadcast(test_common.ClusterTest):
def test_broadcast(self):
a = expr.ones(... | StarcoderdataPython |
1785955 | def _repr(node, args=None, nameblacklist=None):
classname = node.__class__.__name__
args = args or []
nameblacklist = nameblacklist or []
for key, value in filter(lambda item: not item[0].startswith("_") and item[0] not in nameblacklist,
sorted(node.__dict__.items(),
... | StarcoderdataPython |
3219375 | <filename>stepwise_mol_bio/spin_cleanup.py
#!/usr/bin/env python3
import stepwise, appcli, autoprop
from inform import warn
from appcli import Key, Method, DocoptConfig
from stepwise import StepwiseConfig, PresetConfig, Quantity, oxford_comma
from stepwise_mol_bio import Cleanup, format_sec
from freezerbox import Make... | StarcoderdataPython |
77418 | <reponame>xlotlu/loghub<filename>loghub/tests/test_changelog.py<gh_stars>10-100
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) The Spyder Development Team
#
# Licensed under the terms of the MIT License
# (See LICENSE.txt for details)
# ----------... | StarcoderdataPython |
3271023 | <gh_stars>1-10
class Solution:
def findBestValue(self, arr, target):
n = len(arr)
def sum_of_replce_larger_than_value(value):
ret = 0
for e_ in arr:
ret += min(e_, value)
return ret
min_value = float("inf")
sum_arr = 0
max_... | StarcoderdataPython |
1754336 | <filename>2021/5/day5_1.py
with open('day5_1.txt') as file:
lines = file.readlines()
coord_map = {}
count = 0
max_row = float('-inf')
max_col = float('-inf')
for i in range(len(lines)):
line = [x.strip() for x in lines[i].strip().split("->")]
coord1 = line[0].split(',')
c... | StarcoderdataPython |
18932 | class GlobalOptions:
""" Class to evaluate global options for example: project path"""
@staticmethod
def evaluate_project_path(path):
""" Method to parse the project path provided by the user"""
first_dir_from_end = None
if path[-1] != "/":
path = path + "/"
new_p... | StarcoderdataPython |
68756 | from django.contrib.auth import authenticate, login, get_user_model
from django.shortcuts import render, redirect
from properties.models import Property
def home_page(request):
object_list = Property.objects.all().featured()
context = {
"object_list": object_list,
}
return render(request, 'i... | StarcoderdataPython |
119417 | <gh_stars>1-10
def parse_map(_map):
""" Returns a dictionary where from you can look
up which center a given orbiter has """
orbits = {}
for orbit in _map.split("\n"):
center, orbiter = orbit.split(")")
orbits[orbiter] = center
return orbits
def count_orbits(_map):
orbits = parse_map(_map)
orbiters = or... | StarcoderdataPython |
4802950 | import segment
import csv
class ochReader:
def __init__(self, inputFile, colNames):
self.inputFile = inputFile
self.segments = []
file = open(inputFile, 'r')
centralBody = ''
refFrame = ''
timeSystem = ''
numStates = -1
numControls = -1
numIntegrals = -1
data = []
metaFlag = False
dataFlag =... | StarcoderdataPython |
3277189 | class A(object):
pass
class B(object):
pass
def foo(c):
x = A if c else B
y = A if c else 10
z = A() if c else 10
return x(), y(), <warning descr="'z' is not callable">z()</warning>
| StarcoderdataPython |
1608738 | <filename>QUANTAXIS/QAUtil/QABar.py<gh_stars>1000+
# coding=utf-8
#
# The MIT License (MIT)
#
# Copyright (c) 2016-2021 yutiansut/QUANTAXIS
#
# 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 w... | StarcoderdataPython |
197735 | <gh_stars>0
from pycocotools.coco import COCO
from pycocoevalcap.eval import COCOEvalCap
import matplotlib.pyplot as plt
import skimage.io as io
import pylab
pylab.rcParams['figure.figsize'] = (10.0, 8.0)
import json
from json import encoder
encoder.FLOAT_REPR = lambda o: format(o, '.3f')
dataDir = '/home/dpchen/work... | StarcoderdataPython |
3317151 | #!/usr/bin/env python
# coding=utf-8
import logging
import application
from handlers.SyncServer.sockect import pro_status
def ReduceWitScore(DB,uid ,score_num):
# iWit = 0
# iWit_RMB = 0
# #print("ReduceWitScore:", uid, score_num)
# sql = "select Wit_Score,Wit_RMB from tb_userdata where uid = "+str... | StarcoderdataPython |
59020 | from typing import List, Dict, Optional
from myutils.registrar import Registrar
from myutils import dictionaries
import os, yaml
from os import path
import json
from .exceptions import FeatureConfigException
reg_plots = Registrar()
reg_features = Registrar()
KEY_SAMPLE = 'smp'
KEY_AVERAGE = 'avg'
KEY_TICKS = 'tck'
K... | StarcoderdataPython |
122412 | import argparse
import typing
def generate_argument_parser(parser: argparse.ArgumentParser = None):
if parser is None:
parser = argparse.ArgumentParser()
parser.add_argument('--log_level', help='Set logging level', default='WARNING',
type=str.upper,
choi... | StarcoderdataPython |
1748922 | <reponame>Duke-GCB/bespin-mailer
"""
Listens for 'SendEmail' messages on a AMQP queue.
When this message arrives it POSTs a message back to bespin-api asking for the email to be sent.
If this fails it queues the message in a retry exchange/queue that will retry the POST to bespin-api.
"""
import os
import pika
import ... | StarcoderdataPython |
4828233 | class American:
@staticmethod
def printNationality():
print("American")
anAmerican = American()
anAmerican.printNationality()
American.printNationality()
| StarcoderdataPython |
173804 | <reponame>swistakm/pyrilla
# -*- coding: utf-8 -*-
import time
from math import sin, cos
from pyrilla import core
from base import main
def pan_voices(lvoice, rvoice, t):
# use two sounds like two independent channels
# its not as good as HRTF but can fake that
# sound source moves if you really want to... | StarcoderdataPython |
3309172 | <filename>old_scripts/auto_preds.py<gh_stars>0
from sklearn.neighbors import KNeighborsRegressor
from sklearn.linear_model import Ridge
from sklearn.svm import SVR
from sklearn.model_selection import validation_curve
from sklearn.model_selection import learning_curve
from sklearn.metrics import mean_squared_error
from ... | StarcoderdataPython |
95806 | <reponame>eu-snehagupta/learningpython<gh_stars>0
def decimal_to_binary(decimal_integer):
return bin(decimal_integer).replace("0b", "")
def solution(binary_integer):
count = 0
max_count = 0
for element in binary_integer:
if element == "1":
count += 1
if max_count < coun... | StarcoderdataPython |
1779151 | # 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 |
1723194 | <reponame>nicococo/scRNA<gh_stars>10-100
###################################################
### ###
### Plot script for experiment on generated data ###
### written by <NAME>, <NAME>, ###
### <NAME> and <NAME> ###
### ###
###################################... | StarcoderdataPython |
45204 | class MNISTModel:
def __init__(self):
pass
def train_model(self):
"""
some notes
"""
pass
def evaluate_model(self
"""
more notes
"""
pass
| StarcoderdataPython |
1702805 | #!/usr/bin/env python3
""" greylost - DNS threat hunting. """
import os
import sys
import json
import copy
import argparse
import signal
import pickle
import atexit
import syslog
import statistics
from base64 import b64encode
from time import sleep, time
from datetime import datetime
import dnslib
from dmfrbloom.tim... | StarcoderdataPython |
70285 | import torch
from torch import optim
from torchvision import datasets, transforms
from vision import LeNet, CNN, weights_init
from PIL import Image
from utils import label_to_onehot, cross_entropy_for_onehot
import torch.nn.functional as F
import numpy as np
from skimage.metrics import structural_similarity as ssim
imp... | StarcoderdataPython |
188963 | <gh_stars>0
""" Interpret human-sent messages as AllyMessages """
from chuckle_bot import ally_message as am
class Interpreter:
_SENDER_PLACEHOLDER = "_x"
def __init__(self, encounter_context):
# The interpreter keeps the encounter context so that it
# is able to get the names of all the par... | StarcoderdataPython |
1733358 | #-*- coding:utf-8; mode:python; indent-tabs-mode: nil; c-basic-offset: 2; tab-width: 2 -*-
import sys
from bes.compat.StringIO import StringIO
from bes.common.check import check
from bes.python.code import code
from .version_info import version_info
class version_cli(object):
def __init__(self, mod):
self.i... | StarcoderdataPython |
157038 | <reponame>alexeyqu/madidea-lightsuse
"""
Tools for facial recognition and classification.
Toolset works on single images (no video streams).
"""
import keras_facenet
import face_recognition
import numpy as np
from scipy.spatial import cKDTree
import sqlite3
import PIL
import logging
import os
logging.basicConfig()
l... | StarcoderdataPython |
3216649 | #!/usr/bin/python
# coding: utf-8 -*-
# (c) 2014, Hewlett-Packard Development Company, L.P.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1'... | StarcoderdataPython |
1680500 | import asyncio
import time
from typing import Any, Awaitable, Callable, List
import multiaddr
from multiaddr import Multiaddr
from p2pclient import Client
import pytest
from libp2p.peer.id import ID
from libp2p.peer.peerinfo import PeerInfo, info_from_p2p_addr
from .constants import LOCALHOST_IP
from .envs import GO... | StarcoderdataPython |
3213689 | <reponame>kmn/indiesquare
import requests
import simplejson as json
"""
document: https://developer.indiesquare.me
"""
base_url = "https://api.indiesquare.me/v2/addresses"
api_urls = {
'balance' : '/balances',
'issuance' : '/issuances',
'history' : '/histories',
... | StarcoderdataPython |
1739752 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2019/3/13 11:22
# @Author : wendy
# @Usage : Use prediction final result to drawchart
# @File : draw_chart.py
# @Software: PyCharm
import plotly.graph_objs as go
import plotly.offline as off
from model.Config import Config as C
from utils import helper ... | StarcoderdataPython |
40373 | import kenlm
import os
import pickle
import tempfile
import zipfile
from config import KENLM_PATH
from pyro_utils import BGProc
from config import PORT_NUMBER, TEMP_DIR
import time
import subprocess
import shlex
def _unzip_to_tempdir(model_zip_path):
# temp folder (automatically deleted on exit)
tmpdir = te... | StarcoderdataPython |
1762387 | <reponame>yash7raut/IoT-For-Beginners<filename>6-consumer/lessons/3-spoken-feedback/code-spoken-response/virtual-iot-device/smart-timer/app.py
import requests
import threading
import time
from azure.cognitiveservices.speech import SpeechConfig, SpeechRecognizer, SpeechSynthesizer
speech_api_key = '<key>'
location = '<... | StarcoderdataPython |
1794375 | <gh_stars>0
import discord
from discord.ext import commands
#pip install requests
import requests
bot = commands.Bot(command_prefix = "m!")
@bot.event
async def on_ready():
print("準備完了")
@bot.command()
async def trans(ctx, *, msg):
trans_now = await ctx.send("日本語から英語に翻訳中です...")
api_key = "<KEY>"
par... | StarcoderdataPython |
3363270 | """Fichier principale du programme"""
import pygame as pg
import random
from settings import *
from sprites import Player, Platform, Cloud
from os import path
class Game:
"""La classe représentant le jeu"""
def __init__(self):
"""INITIALISATION ET CREATION DU JEU"""
self.highscore = 0
... | StarcoderdataPython |
1638019 | # Python 3 program to count numbers
# from 1 to n with 0 as a digit
# Returns 1 if x has 0, else 0
def has0(x):
# Traverse through all digits
# of x to check if it has 0.
while (x != 0):
# If current digit is 0,
# return true
if (x % 10 == 0):
return 1
x = x //... | StarcoderdataPython |
148950 | """
batch notifications
"""
import glob
import time
from omegaconf import OmegaConf
from plyer import notification
import time
title = "Time to relax your EYES"
message = "Relax your eyes"
app_name = "Opticcca"
timeout = 2
ticker = "Notification ticker"
app_icon = r"../statics/Icons/eyes/eyes_on_fire.ico"
toast = Fals... | StarcoderdataPython |
1646385 | <gh_stars>0
#!/usr/bin/python
### This plugin is used for monitoring PostGres Database
### For monitoring the performance metrics of your PostgreSQL database using Site24x7 Server Monitoring Plugins.
###
### Author: <NAME>
### Language : Python
### Tested in Ubuntu
import psycopg2
import json
from collections import... | StarcoderdataPython |
1700548 | import sys
import time
import collections
import numpy as np
from collections import OrderedDict
class AverageMeter(object):
"""Computes and stores the average and current value"""
def __init__(self):
self.reset()
def reset(self):
self.val = 0
self.avg = 0
s... | StarcoderdataPython |
1614846 | """
A runner of bin2pat.
"""
from regression_tests.tools.bin2pat import Bin2Pat
from regression_tests.tools.tool_runner import ToolRunner
from regression_tests.utils import overrides
class Bin2PatRunner(ToolRunner):
"""A runner of bin2pat."""
@property
@overrides(ToolRunner)
def _tool_class(self... | StarcoderdataPython |
182412 |
import os
import sys
sys.path.append("../")
from components import addComponent, Component
# Add components in order of dependency.
addComponent(Component(name="jsoncpp", srcDir=os.environ["SOURCE_DIR"]+"/../3rd_party/jsoncpp"))
addComponent(Component(name="Logger", runTestsCmd="./LoggerTest"))
addComponent( Compo... | StarcoderdataPython |
3372968 | <reponame>anjanadevi411/sensor_analysis
from django.apps import AppConfig
class VaappConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'vaapp'
| StarcoderdataPython |
1642736 | <reponame>mss10/riscv-python-model
from .insn import *
from .variant import RV64I,Extensions
@isa("lui", 0x37)
class InstructionLUI(InstructionUType):
"""
The Load Upper Immediate (LUI) instruction loads the given immediate (unsigned 20 bit) to the upper 20 bit
of the destination register. The lower bits ... | StarcoderdataPython |
24901 | <filename>ems/utils.py
import pandas as pd
def parse_headered_csv (file: str, desired_keys: list):
"""
Takes a headered CSV file and extracts the columns with the desired keys
:param file: CSV filename
:param desired_keys: Names of columns to extract
:return: pandas dataframe
"""
if file ... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.