id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
5187916 | import os
from celery import Celery
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'graphics_in_the_admin_panel_project.settings')
app = Celery('graphics_in_the_admin_panel_application')
app.config_from_object('django.conf:settings')
app.autodiscover_tasks()
| StarcoderdataPython |
5158712 |
fi = open("myfile.txt", "r")
#print(fi.read())
#print(type(fi))
txt = fi.read()
print(txt)
#print(type(txt))
fi.close()
with open("myfile.txt", "r") as f:
txt2 = f.readlines()
print(txt2)
print("end")
| StarcoderdataPython |
8048570 | import pytest
from datetime import datetime
from openstates.data.models import (
Jurisdiction,
Division,
Membership,
Organization,
Person,
Post,
LegislativeSession,
Event,
EventLocation,
VoteEvent,
Bill,
)
@pytest.fixture
def division():
div = Division.objects.create(
... | StarcoderdataPython |
5197595 | from calabiyau.views import virtual
from calabiyau.views import packages
from calabiyau.views import sessions
from calabiyau.views import pool
from calabiyau.views import subscribers
from calabiyau.views import radius
from calabiyau.views import vendors
from calabiyau.views import accounting
from calabiyau.views import... | StarcoderdataPython |
293111 | <reponame>shitikanth/ncdu-dropbox<filename>setup.py
from setuptools import setup, find_packages
def readme():
with open('README.rst') as f:
return f.read()
setup(
name='ncdu-dropbox',
version='0.1',
description='Generates ncdu compatible json file for Dropbox',
long_description=readme(),... | StarcoderdataPython |
3400000 | <reponame>valermor/pages
############################################################################
# Copyright 2015 Skyscanner Ltd #
# #
# Licensed under the Apache License, Version 2.0 (the "License")... | StarcoderdataPython |
5065103 | <reponame>classyobject/ceasercipher<filename>examples/keyword.py
import sys
import ceasercipher as cc
#######################################
def toint(_str, _def):
ret = 0
try:
ret = int(_str)
except ValueError:
ret = _def
return ret
if __name__=='__main__':
ceaser = ... | StarcoderdataPython |
1746550 | <filename>venv/lib/python3.7/site-packages/opt_einsum/tests/test_backends.py
import numpy as np
import pytest
from opt_einsum import (backends, contract, contract_expression, helpers, sharing)
from opt_einsum.contract import Shaped, infer_backend, parse_backend
try:
import cupy
found_cupy = True
except Import... | StarcoderdataPython |
9699112 | import unittest
import urllib
from webserver import app
class TestWebserver(unittest.TestCase):
def setUp(self):
self.app = app.test_client()
self.app.testing = True
def test_should_open_welcome_page(self):
# when
result = self.app.get("/")
# then
self.assertE... | StarcoderdataPython |
11338263 | <reponame>beingaditya/Major<filename>music.py
import requests
import os, random
def sentiments(text):
sentDoc = requests.post(url="http://text-processing.com/api/sentiment/", data={"text": text})
return sentDoc.json()['label']
def getRelevantSong(text):
sentiment = sentiments(text)
if sentiment == ... | StarcoderdataPython |
178376 | class InputError(Exception):
"""Exception raised for errors in the input.
Attributes:
expression -- input expression in which the error occurred
message -- explanation of the error
"""
def __init__(self, expression, options):
self.expression = expression
self.message = ... | StarcoderdataPython |
5067122 | import bpy
import mathutils
import json
import sys
class Vector3:
def __init__(self, x, y, z):
self.X = x
self.Y = y
self.Z = z
class zMAT3:
def __init__(self, matrix):
self.m = [[0 for x in range(3)] for y in range(3)]
self.m[0][0] = matrix[0][0]
... | StarcoderdataPython |
4841618 | # Copyright 2020 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | StarcoderdataPython |
1778670 | <reponame>frankfka/DashStarterApp<filename>template/{{cookiecutter.project_slug}}/views/graphs_page/other_sample_data_table.py
from dataclasses import fields
import dash_table
from models.OtherSampleDataItem import OtherSampleDataItem
from service.data_provider import app_data_provider
"""
Component creation functio... | StarcoderdataPython |
6655983 | #!/usr/bin/env python3
import argparse
import sys
from extract_gear.image_splitter import ImageSplitter
from extract_gear.class_repository import Configs, TaskProvider
from extract_gear.command_delegate import CommandDelegate
from folder.folder import Folder
parser = argparse.ArgumentParser(description='Delegate to... | StarcoderdataPython |
345377 | <filename>src/lib/enums.py
# coding: utf-8
from enum import IntEnum, Enum
class CompareEnum(IntEnum):
"""Compare Enumeration"""
AFTER = 1
BEFORE = -1
EQUAL = 0
class CompareEnum(IntEnum):
"""Compare Enumeration"""
AFTER = 1
BEFORE = -1
EQUAL = 0
class AppTypeEnum(str, Enum):
... | StarcoderdataPython |
202789 | <filename>src/server/server.py
import torch
from pathlib import Path
from mapworld.ttypes import *
from parse_config import ConfigParser
import model as module_arch
import utils.crf as postps_crf
try:
from mwfrontend import MapWorldMain
from mwfrontend.ttypes import *
enable_client = True
except Module... | StarcoderdataPython |
8197672 | from setuptools import setup
from setuptools import find_packages
setup(name='peanut_launcher',
version='1.0.0',
description='Easy launch for ROS project',
author='<NAME>',
author_email='<EMAIL>',
url='https://github.com/tianhaoz95/peanut_launcher',
download_url='https://github.com/... | StarcoderdataPython |
1735794 | # Copyright 2018 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 |
1975327 | <filename>generate_query_rows.py
#!/usr/bin/env python
# coding: utf-8
out_file_name = "query_rows_150000.txt"
out_file = open(out_file_name, 'w')
count = 1
while count < 150000:
out_file.write(str(count) + '\n')
count = count + 100 | StarcoderdataPython |
71207 | from io import StringIO
import pytest
from panel.widgets import __file__ as wfile, FileDownload, Progress
def test_progress_bounds():
progress = Progress()
progress.max = 200
assert progress.param.value.bounds == (-1, 200)
progress.value = 120
assert progress.value == 120
def test_file_downloa... | StarcoderdataPython |
8007816 | from rest_framework.test import APITestCase
class CustomAPITestCase(APITestCase):
ATTRIBUTES = []
def check_attributes(self, content, attrs=None):
if attrs is None:
attrs = self.ATTRIBUTES
missing_keys = list(set(attrs) - set(content.keys()))
extra_keys = list(set(content... | StarcoderdataPython |
9665152 | from pydantic import BaseModel, ValidationError
from pydantic.fields import ModelField
from typing import TypeVar, Generic
AgedType = TypeVar('AgedType')
QualityType = TypeVar('QualityType')
# This is not a pydantic model, it's an arbitrary generic class
class TastingModel(Generic[AgedType, QualityType]):
def __i... | StarcoderdataPython |
1730105 | <reponame>nassimeblinlaas/gepetto-viewer-corba-nouveau
import omniORB
omniORB.updateModule("gepetto.corbaserver")
import graphical_interface_idl
from client import Client
| StarcoderdataPython |
3491589 | <gh_stars>100-1000
from vyapp.app import root
class CursorStatus:
def __init__(self, area, timeout=1000):
self.area = area
self.timeout = timeout
self.funcid = None
area.install('cursor-status',
(-1, '<FocusIn>', lambda event: self.update()),
(-1, '<FocusOut>', ... | StarcoderdataPython |
1671210 | from pyspark.sql import Row
from pyspark import SparkContext
from pyspark.sql.functions import to_timestamp
from pyspark.sql.types import TimestampType
from pyspark.sql import SparkSession
if __name__ == "__main__":
sc = spark.SparkContext
lines = sc.textFile("/user/bl2514/nypdResult.txt")
parts = lines.map(lambda ... | StarcoderdataPython |
321146 | import math
import os
import random
from scripts.ssc.visualization.demo_kNN_kwc import annulus
from src.datasets.datasets import SwissRoll
from src.topology.witness_complex import WitnessComplex
if __name__ == "__main__":
path = '/Users/simons/PycharmProjects/MT-VAEs-TDA/output/TDA/SwissRoll'
dataset = Swiss... | StarcoderdataPython |
9775264 | <filename>web_api/api/migrations/0007_remove_node_responsible.py
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-02-04 12:04
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('api', '0006_node_owner'),
]
o... | StarcoderdataPython |
8128772 | <gh_stars>0
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def insertionSortList(self, head: Optional[ListNode]) -> Optional[ListNode]:
curi = head
while curi:
curj = c... | StarcoderdataPython |
190864 | from django.db.models.signals import post_save
from django.dispatch import receiver
from django.utils.html import strip_tags
from notifications.signals import notify
from likes.models import LikeRecord
@receiver(post_save, sender=LikeRecord)
def send_notification(sender, instance, **kwargs):
# 发送站内消息
if inst... | StarcoderdataPython |
3508404 | <gh_stars>10-100
import os
from collections import OrderedDict
import torch
import torch.nn.functional as F
from torch.jit.annotations import Tuple, List, Dict, Optional
from torch.autograd.function import Function
from torchvision.models.detection.backbone_utils import resnet_fpn_backbone
from torchvision.models.detec... | StarcoderdataPython |
1728197 | <filename>infra/bots/recipe_modules/flavor/gn_flavor.py<gh_stars>0
# Copyright 2016 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.
import default_flavor
"""GN flavor utils, used for building Skia with GN."""
class GNFlav... | StarcoderdataPython |
8165428 | import os
from datetime import timedelta
from flask_socketio import SocketIO
import flask_socketio
from data_labelling.redis import rd
from .app import app
from .admin import admin
from .models import *
from . import routes
def run():
running_rooms = Room.select().where(Room.status_code == Room.Status.RUNNING.va... | StarcoderdataPython |
12833362 | # -*- coding: utf-8 -*-
"""
Generating the CF-FM synthetic calls
====================================
Module that creates the data for accuracy testing horseshoe bat type calls
"""
import h5py
from itsfm.simulate_calls import make_cffm_call
import numpy as np
import pandas as pd
import scipy.signal as signal
from t... | StarcoderdataPython |
8171952 | <filename>awsrun/aws/aws_s3.py<gh_stars>0
import os
import json
import logging
import sys
import threading
import boto3
import enum
from boto3_type_annotations.s3 import ServiceResource, Bucket
from botocore.exceptions import ClientError
default_region = 'us-west-1'
# Enum for size units
class SIZE_UNIT(enum.Enum):
... | StarcoderdataPython |
9719829 | import pickle
import random
import time
import numpy as np
from sklearn.svm import SVC
from tqdm import tqdm
import hlt
import parse
from hlt import constants
from hlt import positionals
class HaliteModel:
MAX_FILES = 100
DIRECTION_ORDER = [positionals.Direction.West,
positionals.Dire... | StarcoderdataPython |
3462518 | import hazelcast
import logging
from hazelcast.serialization.api import Portable
class MessagePrinter(Portable):
FACTORY_ID = 1
CLASS_ID = 9
def __init__(self, message=None):
self.message = message
def write_portable(self, writer):
writer.write_utf("message", self.message)
def ... | StarcoderdataPython |
1611418 | # Written by Kitsune ως ατομικο project
import random
from pygame import mixer
from threading import Thread
from configparser import ConfigParser
from io import BytesIO
import pymysql
import ftplib
import paramiko
import time
import datetime
import pickle
import os
import keyboard
playerHealth = 100
enemyHealth = 100... | StarcoderdataPython |
253668 | <filename>zeton_backend/settings_dev.py
"""
Django settings for zeton_backend project.
Generated by 'django-admin startproject' using Django 3.0.7.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproj... | StarcoderdataPython |
5095812 | <reponame>noironetworks/python-group-based-policy-client
# Copyright 2015 OpenStack Foundation.
# 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... | StarcoderdataPython |
6595732 | from abc import ABC, abstractmethod
from typing import (
Union,
Any,
Optional,
Sequence,
Generator,
List,
Dict,
Callable,
)
from augmentedtree.core import LeafType, TreePath
class AnAugmentedTreeItem(ABC):
"""
It is mandatory to implement this abstract basic class for any kind... | StarcoderdataPython |
11216876 | <filename>frappe-bench/apps/erpnext/erpnext/restaurant/doctype/restaurant/test_restaurant.py<gh_stars>1-10
# -*- coding: utf-8 -*-
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest
test_records = [
dict(doctype... | StarcoderdataPython |
96096 | from unittest import mock
from io import StringIO
from snowfakery.data_generator import generate
class TestLocales:
def test_locales(self, generated_rows):
yaml = """
- var: snowfakery_locale
value: no_NO
- object: first
fields:
name:
fake: na... | StarcoderdataPython |
5055285 | """URLs for the API interfaces."""
from django.conf import settings
from django.conf.urls import include, url
from rest_framework.settings import import_from_string
from wagtail.api.v2.router import WagtailAPIRouter
from wagtail.admin import urls as wagtailadmin_urls
from wagtail.core import urls as wagtailcore_urls
... | StarcoderdataPython |
234669 | <reponame>umedoblock/fugou
# author: 梅濁酒(umedoblock)
# references: 妖精現実フェアリアル http://deztecc.jp/x/05/faireal/23-index.html
# : Elliptic curve http://en.wikipedia.org/wiki/Elliptic_curve
# Copyright 平成24年(2012)
import datetime
import math
import copy
import argparse
import unittest
import sys, os
dname... | StarcoderdataPython |
6527137 | <filename>pyqt4_mvc/test.py<gh_stars>0
#!/usr/bin/env python
"""
Tutorial from youtube.
"""
from PyQt4 import QtGui, QtCore, uic
import sys
if __name__ == '__main__':
app = QtGui.QApplication(sys.argv)
app.setStyle("cleanLooks")
# DATA
data = ["one", "two", "three", "four", "five"]
# LISTWID... | StarcoderdataPython |
11240660 | from siptrackdlib.objectregistry import object_registry
from siptrackdlib import treenodes
from siptrackdlib import attribute
from siptrackdlib import errors
from siptrackdlib import storagevalue
class Permission(treenodes.BaseNode):
"""A tree permission node.
Used to indicate user/group permissions for locat... | StarcoderdataPython |
9731563 | <reponame>Ruide/angr-dev
from PySide.QtGui import QLineEdit
class QAddressInput(QLineEdit):
def __init__(self, textchanged_callback, parent=None, default=None):
super(QAddressInput, self).__init__(parent)
if default is not None:
self.setText(str(default))
if textchanged_call... | StarcoderdataPython |
11295546 | from sqlalchemy import Column, Integer, String
from base import Base
class A(Base):
__tablename__ = 'A'
id = Column(Integer, primary_key=True)
name = Column(String)
| StarcoderdataPython |
6646720 | #!/usr/bin/env python
# ---------------------------------------------------------------------------
# Robust Model Predictive Control (RMPC)
# Author: <NAME>
# Email: <EMAIL>
# Create Date: 2019-11-06
# ---------------------------------------------------------------------------
from casadi import *
import numpy as np... | StarcoderdataPython |
5165878 | <gh_stars>1-10
import pickle
import numpy as np
import pytest
import tensorflow as tf
from metarl.tf.optimizers import LbfgsOptimizer
from metarl.tf.regressors import ContinuousMLPRegressor
from tests.fixtures import TfGraphTestCase
class TestContinuousMLPRegressor(TfGraphTestCase):
def test_fit_normalized(sel... | StarcoderdataPython |
3250467 | <reponame>srfunksensei/think-python
# 1
def do_twice(f):
f()
f()
def print_spam():
print('spam')
do_twice(print_spam)
# 2
def do_twice1(f, value):
f(value)
f(value)
# 3
def print_twice(value):
print(value)
print(value)
# 4
do_twice1(print_twice, 'spam')
# 5
def do_four(f, value):... | StarcoderdataPython |
3326411 | <filename>gb2260_v2/division.py<gh_stars>1-10
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import gb2260_v2.code as dcode
from gb2260_v2._compat import ensure_str
class Division(object):
__slots__ = ['_code', '_name', '_revision']
def __init__(self, code, name, revision):... | StarcoderdataPython |
11329091 | # Copyright 2022 Google LLC
#
# 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 |
12815345 | <reponame>CatalogueOfLife/frontend-tests
import os
HOSTNAME = 'localhost'
PORT = '3000'
PATH = os.path.dirname(os.path.realpath(__file__))
USER = os.environ['COLUSR']
PASSWORD = os.environ['COLPWD'] | StarcoderdataPython |
5139865 | import animals as an
class Zoo:
def __init__(self, animals=None):
if animals and type(animals) == list:
self.animals = animals
else:
self.animals = []
def check_animals(self):
habitat = input('Which habitat # do you need?\n')
while habitat != 'exit':
... | StarcoderdataPython |
266779 | """ Captcha.Visual.Pictures
Random collections of images
"""
#
# PyCAPTCHA Package
# Copyright (C) 2004 <NAME> <<EMAIL>>
#
from Captcha import File
from PIL import Image
class ImageFactory(File.RandomFileFactory):
"""A factory that generates random images from a list"""
extensions = [".png", ".jpeg"]
ba... | StarcoderdataPython |
3234355 | import os, logging
import operator
from Bio import SeqIO
from Bio.SeqRecord import SeqRecord
from Bio.Seq import Seq
from run_commands import run_command
class RemovedHit(object):
def __init__(self, left_flank, right_flank):
# reason for removal
self.reason = ''
# coordinates of left and ri... | StarcoderdataPython |
11229235 | <reponame>paul-kinghorn/rl-inference
# pylint: disable=not-callable
# pylint: disable=no-member
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.distributions import Normal
def swish(x):
return x * torch.sigmoid(x)
class EnsembleDenseLayer(nn.Module):
def __init__(self, in_size... | StarcoderdataPython |
1683691 | <filename>Assignment3/Lab01/server.py
import random
import socket
import time
from _thread import *
import threading
from datetime import datetime
import json
clients_lock = threading.Lock()
connected = 0
xStep = 1.5
clients = {}
# this is the receiving message loop
def connectionLoop(sock):
global xStep
glob... | StarcoderdataPython |
3451842 | # louka.py
# tento modul se importuje v souboru vypis.py
barva = 'modra'
def main():
print('AHOJ')
input('Zadej cislo: ')
if __name__ == '__main__':
main()
# https://stackoverflow.com/questions/419163/what-does-if-name-main-do
| StarcoderdataPython |
5025861 | <filename>pyart/io/tests/test_rsl.py
""" Unit Tests for Py-ART's io/rsl.py module. """
import numpy as np
from numpy.ma.core import MaskedArray
from numpy.testing.decorators import skipif
import pyart
############################################
# read_rsl tests (verify radar attributes) #
##########################... | StarcoderdataPython |
3533410 | <reponame>Vermee81/practice-coding-contests<filename>jsc2021/jsc2021_d.py
# https://atcoder.jp/contests/jsc2021/tasks/jsc2021_d
N, P = map(int, input().split())
MOD = 10**9 + 7
# a^n modを計算する
def modpow(a: int, n: int, m: int):
res = 1
while n > 0:
if n & 1:
res = res * a % m
a = a... | StarcoderdataPython |
3210267 | #!/usr/bin/env python3
# encoding: utf-8
from typing import Dict, List
import numpy as np
import torch as th
import torch.distributions as td
from rls.algorithms.base.sarl_on_policy import SarlOnPolicy
from rls.common.data import Data
from rls.common.decorator import iton
from rls.nn.models import (Actor... | StarcoderdataPython |
6680602 | """
Use goto() and setheading()
Create a face where the eyes are two triangles.
"""
import turtle as tt
def triangle(tt):
for _ in range(3):
tt.forward(50)
tt.left(120)
def center(tt):
tt.penup()
tt.home()
tt.pendown()
def align_for_smile(tt):
tt.penup()
tt.setx(-10)
t... | StarcoderdataPython |
95321 | import doctest
import unittest
from hypothesis import given
from hypothesis.strategies import (builds, from_regex, integers, just, lists,
recursive, tuples)
from src.main import *
def test__from_list():
data = [(0, "aaa"), (1, "bbb"), (2, "ccc"), (1, "ddd"), (2, "eee"), (2, "f... | StarcoderdataPython |
5052580 | # Generated by Django 3.2 on 2021-06-03 21:17
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
opera... | StarcoderdataPython |
1814747 | ##############################################################################
#
# Copyright (c) 2019 TomskSoft LLC
#
# 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, incl... | StarcoderdataPython |
6441207 | """
NASA Sloan Atlas dataset size reduction
---------------------------------------
The NASA Sloan Atlas dataset is contained in a ~0.5GB available at
http://www.nsatlas.org/data
This function fetches a ~50MB subset of that data. This subset is created
using the code that can be found at examples/datasets/truncate_n... | StarcoderdataPython |
4920397 | from redis import Redis
from config.settings import REDIS_URL
redis = Redis.from_url(REDIS_URL)
| StarcoderdataPython |
131314 | <reponame>paul-nameless/beanie
from typing import Type, TYPE_CHECKING, Optional, Union, Mapping
from pymongo.client_session import ClientSession
from beanie.odm.interfaces.session import SessionMethods
from beanie.odm.interfaces.update import (
UpdateMethods,
)
from beanie.odm.operators.update import BaseUpdateOp... | StarcoderdataPython |
282450 | #x = 3
#x = x*x
#print(x)
#y = input('enter a number:')
#print(y)
#x = int(input('Enter an integer'))
#if x%2 == 0:
# print('Even')
#else:
# print('Odd')
# if x%3 != 0:
# print('And not divisible by 3')
#Find the cube root of a perfect cube
#x = int(input('Enter an integer'))
#ans = 0
#while ans*ans*an... | StarcoderdataPython |
1965845 | from django.http import JsonResponse
from django.shortcuts import render
# Create your views here.
from django.views import View
from utils.views import LoginRequiredJSONMixin
from apps.orders.models import OrderInfo
class PayURLView(LoginRequiredJSONMixin, View):
def get(self, request, order_id):
... | StarcoderdataPython |
177916 | import re
from pathlib import Path
import numpy as np
from pandas import read_csv
from models.Function import FunctionType, Function
from type_replacement import normalize_type
from args import DATABASE_PATH
# Extract function name from DemangledName column
name_re = re.compile(r'::(~?\w+)\(*?')
def extract_name_... | StarcoderdataPython |
4949077 | <reponame>kadds/NaOS
#!/usr/bin/env python3
# This program extracts ASM
#
# python gen_debug_asm.py --help
import sys
import os
import argparse
import traceback
from mod import set_self_dir, run_shell
if __name__ == "__main__":
try:
targets = []
set_self_dir()
path = "../build/debug/"
... | StarcoderdataPython |
253077 | # Copyright 2018 Elasticsearch BV
# Copyright 2020, 2021 Curtin University
#
# 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 |
8174598 | import os
import sys
import csv
import time
import numpy as np
import torch
import torch.cuda as cuda
from lib.utils import *
from lib.beamsearch import BeamSearch
def Een_setting(device):
if device < 0:
env = torch.device('cpu')
print('Envirnment setting done, using device: cpu')
else:
... | StarcoderdataPython |
1987562 | #!/usr/bin/env python
from itertools import tee
import pprint
import xml.etree.ElementTree as ET
import nltk
# Settings you can change these to make them match your environment.
C18_FILE = 'data/c18-utf8.xml'
# pairs is a set of tuple pairs. should be easier to match this way.
PAIRS = {
("ample", "shield"),
... | StarcoderdataPython |
3502875 | def duplicados(numeros):
return len(numeros) - len(set(numeros));
print(duplicados([1,1,2,2,2,3,3,4,4])); | StarcoderdataPython |
11243849 | <filename>pyoxidized/__init__.py
from pyoxidized.api import OxidizedApi
| StarcoderdataPython |
8189155 | <reponame>oserikov/dream
from flask import request, Response
from prometheus_client import generate_latest, Counter, Histogram, Gauge, CONTENT_TYPE_LATEST
import time
REQUEST_COUNT = Counter(
"http_request_count",
"App Request Count",
[
"method",
"endpoint",
"code",
],
)
REQUES... | StarcoderdataPython |
6695375 | import yaml
def load_yaml(load_path):
"""load yaml file
"""
with open(load_path, 'r') as f:
loaded = yaml.load(f, Loader=yaml.Loader)
return loaded
| StarcoderdataPython |
6551352 | VL53L1_VHV_CONFIG__TIMEOUT_MACROP_LOOP_BOUND = 0x0008
GPIO__TIO_HV_STATUS = 0x0031
SYSTEM__INTERRUPT_CLEAR = 0x0086
SYSTEM__MODE_START = 0x0087
VL53L1_RESULT__FINAL_CROSSTALK_CORRECTED_RANGE_MM_SD0 = 0x0096
VL53L1_FIRMWARE__SYSTEM_STATUS = 0x00E5
| StarcoderdataPython |
3578164 | <filename>src/bl/temperature/meta.py
# -*- coding: utf-8 -*-
from bl.temperature.log import Log
class Meta:
"""
Describes temperature mode meta data object.
"""
def __init__(self, payload):
self.sensors_total = int(payload['sensors_total'])
self.cp = [float(v) for v in payload['cp']]
... | StarcoderdataPython |
12818569 | import os, glob, pickle
import pandas as pd
import numpy as np
def chunk_loader(directory, c_size=100_000, orient='columns', lines=True, read_limit=0, index_col=0, low_memory=False):
"""
Reads a directory in chunks, infers type if json or csv format
directory(str) = location of file
c_size(int) = size... | StarcoderdataPython |
6639832 | <filename>Server/app/utils.py
from functools import wraps
from dateutil.parser import parse
from flask import session
def from_string_to_datetime(d_str):
return parse(d_str)
## utils for pages which can autorefresh
# how often we refresh
refresh_every_seconds_key = 'rfrsh_seconds'
# should we refresh
refresh_flag... | StarcoderdataPython |
11257380 | """Base display module type."""
DEFAULT_MINIMUM_SAMPLE_COUNT = 2
class DisplayModule:
"""Base display module type."""
@classmethod
def name(cls):
"""Return module's unique identifier string."""
raise NotImplementedError()
@classmethod
def get_result_model(cls):
"""Retur... | StarcoderdataPython |
4931681 | #!/usr/bin/python3 -OO
# Copyright 2007-2021 The SABnzbd-Team <<EMAIL>>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version... | StarcoderdataPython |
3438943 | import os
import pytest
from test_study import create_study
def upload_files(client,data,study_id):
response = client.post('/files/' + study_id, data=data)
return response
def delete_image_file(client,data,study_id):
response = client.delete('/files/' + study_id, json=data)
return response
# def tes... | StarcoderdataPython |
1831786 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import unittest
from kaggler.online_model import SGD
DUMMY_SPARSE_STR = """0 1:1 3:1 10:1
0 3:1 5:1
1 4:1 6:1 8:1 10:1"""
DUMMY_Y = [0, 0, 1]
DUMMY_LEN_X = [3, 2, 4]
class TestSGD(unittest.TestCas... | StarcoderdataPython |
3306964 | <reponame>ttencate/smartmetertap
from django.apps import AppConfig
class PrikmeterConfig(AppConfig):
name = 'prikmeter'
| StarcoderdataPython |
8114598 | """
Given a linked list and a value n, remove the nth to last node and return the resulting list.
"""
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
def print_list(node: ListNode):
while node is not None:
print(str(node.val), end=" ")
no... | StarcoderdataPython |
3568400 | <filename>deep_q_rl/ale_experiment.py
"""The ALEExperiment class handles the logic for training a deep
Q-learning agent in the Arcade Learning Environment.
Author: <NAME>
"""
import logging
import numpy as np
import cv2
# Number of rows to crop off the bottom of the (downsampled) screen.
# This is appropriate for br... | StarcoderdataPython |
1639805 | import pandas as pd
import time
import seaborn
import numpy as np
from matplotlib import pyplot as plt
from sklearn import linear_model
import kernelml
train=pd.read_csv("data/kc_house_train_data.csv",dtype = {'bathrooms':float, 'waterfront':int, 'sqft_above':int, 'sqft_living15':float, 'grade':int, 'yr_renovated':int... | StarcoderdataPython |
11333369 | <filename>tests/test_payload.py
import array
from io import StringIO
from typing import Any, AsyncIterator, Iterator
import pytest
from aiohttp import payload
@pytest.fixture
def registry() -> Iterator[payload.PayloadRegistry]:
old = payload.PAYLOAD_REGISTRY
reg = payload.PAYLOAD_REGISTRY = payload.PayloadR... | StarcoderdataPython |
4934264 | '''OpenGL extension ARB.vertex_shader
Automatically generated by the get_gl_extensions script, do not edit!
'''
from OpenGL import platform, constants, constant, arrays
from OpenGL import extensions
from OpenGL.GL import glget
import ctypes
EXTENSION_NAME = 'GL_ARB_vertex_shader'
_DEPRECATED = False
GL_VERTEX_SHADER_A... | StarcoderdataPython |
8165637 | # Copyright (C) 2018 Bloomberg LP
#
# 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 writi... | StarcoderdataPython |
6493706 | # -*- coding: utf-8 -*-
from redap.specs.definitions import ERROR_RESPONSES, ERROR_DEFINITIONS
def get_spec(tag, summary=None, params=None, defs=None, responses=None):
spec = {
'summary': summary or '<Unknown>',
'tags': [tag],
'parameters': params or [],
'definitions': {
... | StarcoderdataPython |
77050 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
__author__ = '<NAME>'
| StarcoderdataPython |
6554028 | import logging
import pathlib
# Path to the file storage directory
FILES_DIR = pathlib.PurePath(__file__).parent.parent / 'files'
from .server import Server
def run():
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s: %(message)s')
server = Server(str(FILES_DIR))
server.start()
if __name__ =... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.